Merge branches 'futexes-for-linus', 'irq-core-for-linus' and 'bkl-drivers-for-linus...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 16:51:52 +0000 (08:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 16:51:52 +0000 (08:51 -0800)
* 'futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  futex: Protect pid lookup in compat code with RCU

* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  genirq: Fix documentation of default chip disable()

* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  nvram: Drop the BKL from nvram_open()

3080 files changed:
Documentation/ABI/testing/ima_policy
Documentation/ABI/testing/sysfs-devices-power [new file with mode: 0644]
Documentation/ABI/testing/sysfs-power
Documentation/DocBook/v4l/io.xml
Documentation/DocBook/v4l/vidioc-qbuf.xml
Documentation/DocBook/v4l/vidioc-querybuf.xml
Documentation/DocBook/v4l/vidioc-reqbufs.xml
Documentation/RCU/00-INDEX
Documentation/RCU/RTFP.txt
Documentation/RCU/checklist.txt
Documentation/RCU/lockdep.txt [new file with mode: 0644]
Documentation/RCU/rcu.txt
Documentation/RCU/stallwarn.txt [new file with mode: 0644]
Documentation/RCU/torture.txt
Documentation/RCU/whatisRCU.txt
Documentation/cachetlb.txt
Documentation/cpu-freq/governors.txt
Documentation/dontdiff
Documentation/dvb/get_dvb_firmware
Documentation/fault-injection/fault-injection.txt
Documentation/feature-removal-schedule.txt
Documentation/filesystems/dentry-locking.txt
Documentation/input/multi-touch-protocol.txt
Documentation/kernel-parameters.txt
Documentation/lguest/lguest.c
Documentation/networking/ip-sysctl.txt
Documentation/pcmcia/locking.txt [new file with mode: 0644]
Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt [new file with mode: 0644]
Documentation/powerpc/dts-bindings/fsl/spi.txt
Documentation/powerpc/ptrace.txt [new file with mode: 0644]
Documentation/s390/CommonIO
Documentation/s390/driver-model.txt
Documentation/scsi/ChangeLog.megaraid_sas
Documentation/trace/ftrace-design.txt
Documentation/trace/ftrace.txt
Documentation/trace/kprobetrace.txt
Documentation/video4linux/CARDLIST.cx23885
Documentation/video4linux/CARDLIST.saa7134
Documentation/video4linux/CARDLIST.tuner
Documentation/video4linux/README.tlg2300 [new file with mode: 0644]
Documentation/video4linux/gspca.txt
Documentation/video4linux/v4l2-framework.txt
Documentation/video4linux/videobuf [new file with mode: 0644]
Documentation/x86/x86_64/boot-options.txt
MAINTAINERS
Makefile
arch/Kconfig
arch/alpha/include/asm/topology.h
arch/alpha/kernel/pci.c
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/boot/compressed/head.S
arch/arm/boot/compressed/misc.c
arch/arm/include/asm/cacheflush.h
arch/arm/kernel/bios32.c
arch/arm/kernel/debug.S
arch/arm/kernel/elf.c
arch/arm/kernel/setup.c
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/include/mach/dm365.h
arch/arm/mach-davinci/include/mach/keyscan.h
arch/arm/mach-gemini/gpio.c
arch/arm/mach-gemini/include/mach/uncompress.h
arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
arch/arm/mach-mx25/clock.c
arch/arm/mach-mx25/mx25pdk.c
arch/arm/mach-mx3/mx31ads.c
arch/arm/mach-nomadik/cpu-8815.c
arch/arm/mach-omap1/clock.c
arch/arm/mach-omap2/clock34xx_data.c
arch/arm/mach-omap2/clock44xx_data.c
arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/gpmc.c
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/irq.c
arch/arm/mach-omap2/mmc-twl4030.c
arch/arm/mach-omap2/mux.c
arch/arm/mach-omap2/mux.h
arch/arm/mach-omap2/mux34xx.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/pm-debug.c
arch/arm/mach-omap2/pm.h
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/prcm.c
arch/arm/mach-omap2/prm.h
arch/arm/mach-omap2/prm44xx.h
arch/arm/mach-omap2/serial.c
arch/arm/mach-omap2/sleep34xx.S
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/include/mach/camera.h
arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
arch/arm/mach-pxa/irq.c
arch/arm/mach-realview/realview_pbx.c
arch/arm/mach-s3c2440/mach-mini2440.c
arch/arm/mach-s3c6410/mach-hmt.c
arch/arm/mach-s3c6410/mach-smdk6410.c
arch/arm/mm/alignment.c
arch/arm/mm/mmu.c
arch/arm/mm/proc-arm6_7.S
arch/arm/mm/proc-v6.S
arch/arm/mm/proc-v7.S
arch/arm/plat-mxc/audmux-v2.c
arch/arm/plat-mxc/include/mach/board-mx31lite.h
arch/arm/plat-mxc/include/mach/common.h
arch/arm/plat-mxc/include/mach/iomux-mx35.h
arch/arm/plat-mxc/include/mach/irqs.h
arch/arm/plat-mxc/include/mach/uncompress.h
arch/arm/plat-omap/clock.c
arch/arm/plat-omap/common.c
arch/arm/plat-omap/dma.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/gpio.c
arch/arm/plat-omap/include/plat/cpu.h
arch/arm/plat-omap/include/plat/irqs.h
arch/arm/plat-omap/include/plat/omap_hwmod.h
arch/arm/plat-omap/omap_device.c
arch/arm/plat-orion/pcie.c
arch/arm/plat-s3c/dev-nand.c
arch/arm/tools/mach-types
arch/arm/vfp/vfpmodule.c
arch/avr32/mach-at32ap/at32ap700x.c
arch/cris/arch-v32/drivers/pci/bios.c
arch/frv/mb93090-mb00/pci-frv.c
arch/h8300/mm/memory.c
arch/ia64/include/asm/acpi.h
arch/ia64/include/asm/elf.h
arch/ia64/kernel/kprobes.c
arch/ia64/kernel/time.c
arch/ia64/pci/pci.c
arch/ia64/sn/kernel/setup.c
arch/m68k/Kconfig
arch/m68k/amiga/config.c
arch/m68k/configs/mac_defconfig
arch/m68k/configs/multi_defconfig
arch/m68k/include/asm/machw.h
arch/m68k/include/asm/macints.h
arch/m68k/include/asm/ptrace.h
arch/m68k/include/asm/sigcontext.h
arch/m68k/include/asm/siginfo.h
arch/m68k/include/asm/swab.h
arch/m68k/include/asm/thread_info_mm.h
arch/m68k/include/asm/thread_info_no.h
arch/m68k/include/asm/ucontext.h
arch/m68k/include/asm/unistd.h
arch/m68k/include/asm/virtconvert.h
arch/m68k/kernel/entry.S
arch/m68k/kernel/process.c
arch/m68k/kernel/ptrace.c
arch/m68k/kernel/signal.c
arch/m68k/kernel/sys_m68k.c
arch/m68k/mac/Makefile
arch/m68k/mac/config.c
arch/m68k/mac/debug.c [deleted file]
arch/m68k/mac/macints.c
arch/m68k/mac/oss.c
arch/m68k/mac/via.c
arch/m68k/mm/kmap.c
arch/m68knommu/kernel/process.c
arch/m68knommu/kernel/ptrace.c
arch/m68knommu/kernel/sys_m68k.c
arch/m68knommu/kernel/syscalltable.S
arch/m68knommu/mm/memory.c
arch/m68knommu/platform/coldfire/pit.c
arch/microblaze/Kconfig
arch/microblaze/configs/mmu_defconfig
arch/microblaze/configs/nommu_defconfig
arch/microblaze/include/asm/io.h
arch/microblaze/include/asm/prom.h
arch/microblaze/include/asm/ptrace.h
arch/microblaze/include/asm/unistd.h
arch/microblaze/kernel/cpu/cache.c
arch/microblaze/kernel/entry-nommu.S
arch/microblaze/kernel/of_platform.c
arch/microblaze/kernel/prom.c
arch/microblaze/kernel/prom_parse.c
arch/microblaze/kernel/setup.c
arch/microblaze/kernel/syscall_table.S
arch/mips/Kconfig
arch/mips/Kconfig.debug
arch/mips/Makefile
arch/mips/alchemy/Kconfig
arch/mips/alchemy/common/Makefile
arch/mips/alchemy/common/clocks.c
arch/mips/alchemy/common/dbdma.c
arch/mips/alchemy/common/dma.c
arch/mips/alchemy/common/gpiolib-au1000.c
arch/mips/alchemy/common/irq.c
arch/mips/alchemy/common/platform.c
arch/mips/alchemy/common/prom.c
arch/mips/alchemy/common/puts.c [deleted file]
arch/mips/alchemy/common/reset.c [deleted file]
arch/mips/alchemy/common/setup.c
arch/mips/alchemy/common/time.c
arch/mips/alchemy/devboards/Makefile
arch/mips/alchemy/devboards/bcsr.c [new file with mode: 0644]
arch/mips/alchemy/devboards/db1200/Makefile [new file with mode: 0644]
arch/mips/alchemy/devboards/db1200/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/db1200/setup.c [new file with mode: 0644]
arch/mips/alchemy/devboards/db1x00/Makefile
arch/mips/alchemy/devboards/db1x00/board_setup.c
arch/mips/alchemy/devboards/db1x00/irqmap.c [deleted file]
arch/mips/alchemy/devboards/db1x00/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/pb1000/board_setup.c
arch/mips/alchemy/devboards/pb1100/Makefile
arch/mips/alchemy/devboards/pb1100/board_setup.c
arch/mips/alchemy/devboards/pb1100/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/pb1200/Makefile
arch/mips/alchemy/devboards/pb1200/board_setup.c
arch/mips/alchemy/devboards/pb1200/irqmap.c [deleted file]
arch/mips/alchemy/devboards/pb1200/platform.c
arch/mips/alchemy/devboards/pb1500/Makefile
arch/mips/alchemy/devboards/pb1500/board_setup.c
arch/mips/alchemy/devboards/pb1500/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/pb1550/Makefile
arch/mips/alchemy/devboards/pb1550/board_setup.c
arch/mips/alchemy/devboards/pb1550/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/platform.c [new file with mode: 0644]
arch/mips/alchemy/devboards/platform.h [new file with mode: 0644]
arch/mips/alchemy/devboards/pm.c
arch/mips/alchemy/devboards/prom.c
arch/mips/alchemy/mtx-1/Makefile
arch/mips/alchemy/mtx-1/board_setup.c
arch/mips/alchemy/mtx-1/init.c
arch/mips/alchemy/mtx-1/irqmap.c [deleted file]
arch/mips/alchemy/xxs1500/Makefile
arch/mips/alchemy/xxs1500/board_setup.c
arch/mips/alchemy/xxs1500/init.c
arch/mips/alchemy/xxs1500/irqmap.c [deleted file]
arch/mips/alchemy/xxs1500/platform.c [new file with mode: 0644]
arch/mips/ar7/clock.c
arch/mips/ar7/gpio.c
arch/mips/ar7/memory.c
arch/mips/ar7/platform.c
arch/mips/ar7/prom.c
arch/mips/ar7/setup.c
arch/mips/ar7/time.c
arch/mips/bcm47xx/gpio.c
arch/mips/bcm47xx/prom.c
arch/mips/bcm47xx/setup.c
arch/mips/bcm47xx/wgt634u.c
arch/mips/bcm63xx/boards/board_bcm963xx.c
arch/mips/bcm63xx/timer.c
arch/mips/boot/compressed/Makefile
arch/mips/boot/compressed/dbg.c
arch/mips/boot/compressed/decompress.c
arch/mips/boot/compressed/uart-alchemy.c [new file with mode: 0644]
arch/mips/cavium-octeon/dma-octeon.c
arch/mips/cavium-octeon/executive/cvmx-bootmem.c
arch/mips/cavium-octeon/executive/cvmx-sysinfo.c
arch/mips/cavium-octeon/octeon-irq.c
arch/mips/cavium-octeon/octeon-platform.c
arch/mips/cavium-octeon/smp.c
arch/mips/cobalt/pci.c
arch/mips/configs/db1000_defconfig
arch/mips/configs/db1100_defconfig
arch/mips/configs/db1200_defconfig
arch/mips/configs/db1500_defconfig
arch/mips/configs/db1550_defconfig
arch/mips/configs/ip27_defconfig
arch/mips/configs/lemote2f_defconfig
arch/mips/configs/pb1100_defconfig
arch/mips/configs/pb1200_defconfig [new file with mode: 0644]
arch/mips/configs/pb1500_defconfig
arch/mips/configs/pb1550_defconfig
arch/mips/dec/kn01-berr.c
arch/mips/dec/prom/locore.S
arch/mips/include/asm/atomic.h
arch/mips/include/asm/barrier.h
arch/mips/include/asm/bitops.h
arch/mips/include/asm/cmpxchg.h
arch/mips/include/asm/cpu-features.h
arch/mips/include/asm/cpu-info.h
arch/mips/include/asm/cpu.h
arch/mips/include/asm/current.h
arch/mips/include/asm/dec/kn01.h
arch/mips/include/asm/device.h
arch/mips/include/asm/elf.h
arch/mips/include/asm/ftrace.h
arch/mips/include/asm/i8259.h
arch/mips/include/asm/io.h
arch/mips/include/asm/irq.h
arch/mips/include/asm/mach-ar7/ar7.h
arch/mips/include/asm/mach-ar7/gpio.h
arch/mips/include/asm/mach-au1x00/au1000.h
arch/mips/include/asm/mach-au1x00/au1100_mmc.h
arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h
arch/mips/include/asm/mach-au1x00/au1xxx_eth.h [new file with mode: 0644]
arch/mips/include/asm/mach-au1x00/gpio-au1000.h
arch/mips/include/asm/mach-au1x00/gpio.h
arch/mips/include/asm/mach-au1x00/ioremap.h
arch/mips/include/asm/mach-au1x00/prom.h
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
arch/mips/include/asm/mach-db1x00/bcsr.h [new file with mode: 0644]
arch/mips/include/asm/mach-db1x00/db1200.h
arch/mips/include/asm/mach-db1x00/db1x00.h
arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h
arch/mips/include/asm/mach-loongson/loongson.h
arch/mips/include/asm/mach-loongson/machine.h
arch/mips/include/asm/mach-loongson/mem.h
arch/mips/include/asm/mach-loongson/pci.h
arch/mips/include/asm/mach-pb1x00/pb1100.h [deleted file]
arch/mips/include/asm/mach-pb1x00/pb1200.h
arch/mips/include/asm/mach-pb1x00/pb1500.h [deleted file]
arch/mips/include/asm/mach-pb1x00/pb1550.h
arch/mips/include/asm/mach-pnx833x/irq-mapping.h
arch/mips/include/asm/mach-powertv/asic_reg_map.h [new file with mode: 0644]
arch/mips/include/asm/mach-powertv/asic_regs.h
arch/mips/include/asm/mach-powertv/interrupts.h
arch/mips/include/asm/mipsregs.h
arch/mips/include/asm/msc01_ic.h
arch/mips/include/asm/nile4.h
arch/mips/include/asm/octeon/octeon-feature.h
arch/mips/include/asm/octeon/octeon.h
arch/mips/include/asm/page.h
arch/mips/include/asm/param.h
arch/mips/include/asm/parport.h
arch/mips/include/asm/pgalloc.h
arch/mips/include/asm/pgtable-32.h
arch/mips/include/asm/pgtable-64.h
arch/mips/include/asm/pgtable-bits.h
arch/mips/include/asm/pgtable.h
arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
arch/mips/include/asm/serial.h
arch/mips/include/asm/sgialib.h
arch/mips/include/asm/sibyte/bigsur.h
arch/mips/include/asm/sibyte/sb1250_ldt.h
arch/mips/include/asm/sn/klkernvars.h
arch/mips/include/asm/sparsemem.h
arch/mips/include/asm/spinlock.h
arch/mips/include/asm/spinlock_types.h
arch/mips/include/asm/system.h
arch/mips/include/asm/txx9/generic.h
arch/mips/include/asm/uasm.h [moved from arch/mips/mm/uasm.h with 97% similarity]
arch/mips/include/asm/ucontext.h
arch/mips/jazz/irq.c
arch/mips/kernel/Makefile
arch/mips/kernel/asm-offsets.c
arch/mips/kernel/cevt-gt641xx.c
arch/mips/kernel/cevt-r4k.c
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/ftrace.c
arch/mips/kernel/i8259.c
arch/mips/kernel/irq-gt641xx.c
arch/mips/kernel/linux32.c
arch/mips/kernel/mcount.S
arch/mips/kernel/octeon_switch.S
arch/mips/kernel/rtlx.c
arch/mips/kernel/spinlock_test.c [new file with mode: 0644]
arch/mips/kernel/traps.c
arch/mips/kernel/vpe.c
arch/mips/lasat/picvue.h
arch/mips/loongson/common/cmdline.c
arch/mips/loongson/common/cs5536/cs5536_acc.c
arch/mips/loongson/common/cs5536/cs5536_ehci.c
arch/mips/loongson/common/cs5536/cs5536_ide.c
arch/mips/loongson/common/cs5536/cs5536_isa.c
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
arch/mips/loongson/common/cs5536/cs5536_ohci.c
arch/mips/loongson/common/cs5536/cs5536_pci.c
arch/mips/loongson/common/early_printk.c
arch/mips/loongson/common/env.c
arch/mips/loongson/common/init.c
arch/mips/loongson/common/machtype.c
arch/mips/loongson/common/mem.c
arch/mips/loongson/common/platform.c
arch/mips/loongson/common/pm.c
arch/mips/loongson/common/reset.c
arch/mips/loongson/common/serial.c
arch/mips/loongson/common/time.c
arch/mips/loongson/common/uart_base.c
arch/mips/loongson/fuloong-2e/reset.c
arch/mips/loongson/lemote-2f/Makefile
arch/mips/loongson/lemote-2f/ec_kb3310b.c
arch/mips/loongson/lemote-2f/irq.c
arch/mips/loongson/lemote-2f/machtype.c [new file with mode: 0644]
arch/mips/loongson/lemote-2f/pm.c
arch/mips/loongson/lemote-2f/reset.c
arch/mips/math-emu/ieee754d.c
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754sp.c
arch/mips/math-emu/ieee754xcpt.c
arch/mips/mm/c-octeon.c
arch/mips/mm/cache.c
arch/mips/mm/fault.c
arch/mips/mm/highmem.c
arch/mips/mm/hugetlbpage.c
arch/mips/mm/init.c
arch/mips/mm/page.c
arch/mips/mm/pgtable-64.c
arch/mips/mm/tlb-r4k.c
arch/mips/mm/tlbex.c
arch/mips/mm/uasm.c
arch/mips/mti-malta/malta-int.c
arch/mips/nxp/pnx833x/common/interrupts.c
arch/mips/nxp/pnx833x/common/prom.c
arch/mips/nxp/pnx8550/common/prom.c
arch/mips/oprofile/common.c
arch/mips/oprofile/op_model_loongson2.c
arch/mips/pci/fixup-cobalt.c
arch/mips/pci/fixup-lemote2f.c
arch/mips/pci/ops-loongson2.c
arch/mips/pci/ops-pmcmsp.c
arch/mips/pci/pci-bcm47xx.c
arch/mips/pci/pci-octeon.c
arch/mips/pci/pci.c
arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
arch/mips/pmc-sierra/msp71xx/msp_prom.c
arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h
arch/mips/pmc-sierra/yosemite/ht.c
arch/mips/pmc-sierra/yosemite/smp.c
arch/mips/power/cpu.c
arch/mips/power/hibernate.S
arch/mips/powertv/asic/asic-calliope.c
arch/mips/powertv/asic/asic-cronus.c
arch/mips/powertv/asic/asic-zeus.c
arch/mips/powertv/asic/asic_devices.c
arch/mips/powertv/asic/asic_int.c
arch/mips/powertv/powertv_setup.c
arch/mips/sgi-ip27/ip27-klnuma.c
arch/mips/sgi-ip27/ip27-nmi.c
arch/mips/sgi-ip32/ip32-irq.c
arch/mips/sibyte/bcm1480/irq.c
arch/mips/sibyte/common/sb_tbprof.c
arch/mips/sibyte/sb1250/irq.c
arch/mips/sni/rm200.c
arch/mips/txx9/generic/setup.c
arch/mips/txx9/jmr3927/setup.c
arch/mips/txx9/rbtx4927/setup.c
arch/mips/txx9/rbtx4938/setup.c
arch/mn10300/unit-asb2305/pci-asb2305.c
arch/mn10300/unit-asb2305/pci.c
arch/parisc/Kconfig
arch/parisc/include/asm/cacheflush.h
arch/parisc/kernel/pci.c
arch/parisc/kernel/signal.c
arch/powerpc/Kconfig
arch/powerpc/boot/Makefile
arch/powerpc/boot/dts/arches.dts
arch/powerpc/boot/dts/gef_ppc9a.dts
arch/powerpc/boot/dts/gef_sbc310.dts
arch/powerpc/boot/dts/gef_sbc610.dts
arch/powerpc/boot/dts/glacier.dts
arch/powerpc/boot/dts/katmai.dts
arch/powerpc/boot/dts/mpc5121ads.dts
arch/powerpc/boot/dts/mpc8568mds.dts
arch/powerpc/boot/wrapper
arch/powerpc/configs/40x/acadia_defconfig
arch/powerpc/configs/40x/ep405_defconfig
arch/powerpc/configs/40x/hcu4_defconfig
arch/powerpc/configs/40x/kilauea_defconfig
arch/powerpc/configs/40x/makalu_defconfig
arch/powerpc/configs/40x/walnut_defconfig
arch/powerpc/configs/44x/arches_defconfig
arch/powerpc/configs/44x/bamboo_defconfig
arch/powerpc/configs/44x/canyonlands_defconfig
arch/powerpc/configs/44x/ebony_defconfig
arch/powerpc/configs/44x/eiger_defconfig
arch/powerpc/configs/44x/katmai_defconfig
arch/powerpc/configs/44x/rainier_defconfig
arch/powerpc/configs/44x/redwood_defconfig
arch/powerpc/configs/44x/sam440ep_defconfig
arch/powerpc/configs/44x/sequoia_defconfig
arch/powerpc/configs/44x/taishan_defconfig
arch/powerpc/configs/44x/warp_defconfig
arch/powerpc/configs/52xx/cm5200_defconfig
arch/powerpc/configs/52xx/lite5200b_defconfig
arch/powerpc/configs/52xx/motionpro_defconfig
arch/powerpc/configs/52xx/pcm030_defconfig
arch/powerpc/configs/52xx/tqm5200_defconfig
arch/powerpc/configs/83xx/asp8347_defconfig
arch/powerpc/configs/83xx/kmeter1_defconfig
arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
arch/powerpc/configs/83xx/mpc832x_mds_defconfig
arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
arch/powerpc/configs/83xx/mpc834x_itx_defconfig
arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
arch/powerpc/configs/83xx/mpc834x_mds_defconfig
arch/powerpc/configs/83xx/mpc836x_mds_defconfig
arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
arch/powerpc/configs/83xx/mpc837x_mds_defconfig
arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
arch/powerpc/configs/83xx/sbc834x_defconfig
arch/powerpc/configs/85xx/ksi8560_defconfig
arch/powerpc/configs/85xx/mpc8540_ads_defconfig
arch/powerpc/configs/85xx/mpc8560_ads_defconfig
arch/powerpc/configs/85xx/mpc85xx_cds_defconfig
arch/powerpc/configs/85xx/sbc8548_defconfig
arch/powerpc/configs/85xx/sbc8560_defconfig
arch/powerpc/configs/85xx/socrates_defconfig
arch/powerpc/configs/85xx/stx_gp3_defconfig
arch/powerpc/configs/85xx/tqm8540_defconfig
arch/powerpc/configs/85xx/tqm8541_defconfig
arch/powerpc/configs/85xx/tqm8548_defconfig
arch/powerpc/configs/85xx/tqm8555_defconfig
arch/powerpc/configs/85xx/tqm8560_defconfig
arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
arch/powerpc/configs/86xx/gef_ppc9a_defconfig
arch/powerpc/configs/86xx/gef_sbc310_defconfig
arch/powerpc/configs/86xx/gef_sbc610_defconfig
arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
arch/powerpc/configs/86xx/sbc8641d_defconfig
arch/powerpc/configs/adder875_defconfig
arch/powerpc/configs/c2k_defconfig
arch/powerpc/configs/ep8248e_defconfig
arch/powerpc/configs/ep88xc_defconfig
arch/powerpc/configs/linkstation_defconfig
arch/powerpc/configs/mgcoge_defconfig
arch/powerpc/configs/mgsuvd_defconfig
arch/powerpc/configs/mpc512x_defconfig [new file with mode: 0644]
arch/powerpc/configs/mpc5200_defconfig
arch/powerpc/configs/mpc7448_hpc2_defconfig
arch/powerpc/configs/mpc8272_ads_defconfig
arch/powerpc/configs/mpc83xx_defconfig
arch/powerpc/configs/mpc85xx_defconfig
arch/powerpc/configs/mpc85xx_smp_defconfig
arch/powerpc/configs/mpc866_ads_defconfig
arch/powerpc/configs/mpc86xx_defconfig
arch/powerpc/configs/mpc885_ads_defconfig
arch/powerpc/configs/ppc40x_defconfig
arch/powerpc/configs/ppc44x_defconfig
arch/powerpc/configs/ppc64_defconfig
arch/powerpc/configs/pq2fads_defconfig
arch/powerpc/configs/prpmc2800_defconfig
arch/powerpc/configs/pseries_defconfig
arch/powerpc/configs/storcenter_defconfig
arch/powerpc/include/asm/asm-compat.h
arch/powerpc/include/asm/atomic.h
arch/powerpc/include/asm/bitops.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/cputime.h
arch/powerpc/include/asm/elf.h
arch/powerpc/include/asm/feature-fixups.h
arch/powerpc/include/asm/futex.h
arch/powerpc/include/asm/hardirq.h
arch/powerpc/include/asm/local.h
arch/powerpc/include/asm/mpc5121.h [new file with mode: 0644]
arch/powerpc/include/asm/mpc52xx_psc.h
arch/powerpc/include/asm/mpic.h
arch/powerpc/include/asm/mutex.h
arch/powerpc/include/asm/param.h
arch/powerpc/include/asm/pmac_feature.h
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/include/asm/ppc-pci.h
arch/powerpc/include/asm/processor.h
arch/powerpc/include/asm/prom.h
arch/powerpc/include/asm/ptrace.h
arch/powerpc/include/asm/reg_booke.h
arch/powerpc/include/asm/spinlock.h
arch/powerpc/include/asm/synch.h
arch/powerpc/include/asm/system.h
arch/powerpc/include/asm/thread_info.h
arch/powerpc/include/asm/topology.h
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/firmware.c
arch/powerpc/kernel/head_8xx.S
arch/powerpc/kernel/head_fsl_booke.S
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/kgdb.c
arch/powerpc/kernel/kprobes.c
arch/powerpc/kernel/lparcfg.c
arch/powerpc/kernel/nvram_64.c
arch/powerpc/kernel/of_platform.c
arch/powerpc/kernel/pci-common.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/pci_of_scan.c
arch/powerpc/kernel/perf_callchain.c
arch/powerpc/kernel/perf_event.c
arch/powerpc/kernel/pmc.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/ptrace.c
arch/powerpc/kernel/rtas-proc.c
arch/powerpc/kernel/signal.c
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/swsusp_32.S
arch/powerpc/kernel/time.c
arch/powerpc/kernel/traps.c
arch/powerpc/kvm/Kconfig
arch/powerpc/lib/copypage_64.S
arch/powerpc/lib/copyuser_64.S
arch/powerpc/lib/feature-fixups.c
arch/powerpc/mm/40x_mmu.c
arch/powerpc/mm/hash_native_64.c
arch/powerpc/mm/mmap_64.c
arch/powerpc/mm/mmu_context_hash64.c
arch/powerpc/mm/mmu_context_nohash.c
arch/powerpc/mm/tlb_hash64.c
arch/powerpc/mm/tlb_low_64e.S
arch/powerpc/mm/tlb_nohash.c
arch/powerpc/platforms/512x/clock.c
arch/powerpc/platforms/512x/mpc5121_ads.c
arch/powerpc/platforms/512x/mpc5121_ads_cpld.c
arch/powerpc/platforms/512x/mpc5121_generic.c
arch/powerpc/platforms/512x/mpc512x.h
arch/powerpc/platforms/512x/mpc512x_shared.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/85xx/smp.c
arch/powerpc/platforms/85xx/socrates_fpga_pic.c
arch/powerpc/platforms/85xx/stx_gp3.c
arch/powerpc/platforms/85xx/xes_mpc85xx.c
arch/powerpc/platforms/cell/beat_htab.c
arch/powerpc/platforms/cell/beat_interrupt.c
arch/powerpc/platforms/cell/cbe_powerbutton.c
arch/powerpc/platforms/cell/interrupt.c
arch/powerpc/platforms/cell/ras.c
arch/powerpc/platforms/cell/spider-pic.c
arch/powerpc/platforms/cell/spu_manage.c
arch/powerpc/platforms/cell/spufs/coredump.c
arch/powerpc/platforms/fsl_uli1575.c
arch/powerpc/platforms/iseries/irq.c
arch/powerpc/platforms/iseries/proc.c
arch/powerpc/platforms/iseries/setup.c
arch/powerpc/platforms/iseries/vio.c
arch/powerpc/platforms/pasemi/cpufreq.c
arch/powerpc/platforms/powermac/bootx_init.c
arch/powerpc/platforms/powermac/cpufreq_32.c
arch/powerpc/platforms/powermac/cpufreq_64.c
arch/powerpc/platforms/powermac/feature.c
arch/powerpc/platforms/powermac/nvram.c
arch/powerpc/platforms/powermac/pfunc_base.c
arch/powerpc/platforms/powermac/pfunc_core.c
arch/powerpc/platforms/powermac/pic.c
arch/powerpc/platforms/powermac/smp.c
arch/powerpc/platforms/powermac/time.c
arch/powerpc/platforms/powermac/udbg_scc.c
arch/powerpc/platforms/pseries/dlpar.c
arch/powerpc/platforms/pseries/eeh.c
arch/powerpc/platforms/pseries/eeh_driver.c
arch/powerpc/platforms/pseries/eeh_event.c
arch/powerpc/platforms/pseries/hotplug-cpu.c
arch/powerpc/platforms/pseries/hvCall_inst.c
arch/powerpc/platforms/pseries/pci_dlpar.c
arch/powerpc/platforms/pseries/phyp_dump.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/platforms/pseries/xics.c
arch/powerpc/sysdev/cpm1.c
arch/powerpc/sysdev/cpm2_pic.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/grackle.c
arch/powerpc/sysdev/i8259.c
arch/powerpc/sysdev/ipic.c
arch/powerpc/sysdev/mpc8xx_pic.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/mpic_pasemi_msi.c
arch/powerpc/sysdev/mv64x60_dev.c
arch/powerpc/sysdev/ppc4xx_pci.c
arch/powerpc/sysdev/ppc4xx_soc.c
arch/powerpc/sysdev/qe_lib/qe_ic.c
arch/powerpc/sysdev/qe_lib/qe_io.c
arch/powerpc/sysdev/uic.c
arch/powerpc/xmon/xmon.c
arch/s390/Kconfig
arch/s390/Kconfig.debug
arch/s390/Makefile
arch/s390/boot/Makefile
arch/s390/boot/compressed/Makefile [new file with mode: 0644]
arch/s390/boot/compressed/head31.S [new file with mode: 0644]
arch/s390/boot/compressed/head64.S [new file with mode: 0644]
arch/s390/boot/compressed/misc.c [new file with mode: 0644]
arch/s390/boot/compressed/vmlinux.lds.S [new file with mode: 0644]
arch/s390/boot/compressed/vmlinux.scr [new file with mode: 0644]
arch/s390/crypto/aes_s390.c
arch/s390/defconfig
arch/s390/hypfs/hypfs_diag.c
arch/s390/include/asm/atomic.h
arch/s390/include/asm/bitops.h
arch/s390/include/asm/bug.h
arch/s390/include/asm/crw.h
arch/s390/include/asm/etr.h
arch/s390/include/asm/irqflags.h
arch/s390/include/asm/lowcore.h
arch/s390/include/asm/page.h
arch/s390/include/asm/processor.h
arch/s390/include/asm/ptrace.h
arch/s390/include/asm/qdio.h
arch/s390/include/asm/rwsem.h
arch/s390/include/asm/setup.h
arch/s390/include/asm/sigp.h
arch/s390/include/asm/smp.h
arch/s390/include/asm/spinlock.h
arch/s390/include/asm/swab.h
arch/s390/include/asm/syscall.h
arch/s390/include/asm/sysinfo.h
arch/s390/include/asm/system.h
arch/s390/include/asm/thread_info.h
arch/s390/include/asm/timex.h
arch/s390/include/asm/uaccess.h
arch/s390/include/asm/unistd.h
arch/s390/include/asm/vdso.h
arch/s390/kernel/Makefile
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/base.S
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/dis.c
arch/s390/kernel/early.c
arch/s390/kernel/entry.S
arch/s390/kernel/entry64.S
arch/s390/kernel/ftrace.c
arch/s390/kernel/head.S
arch/s390/kernel/head31.S
arch/s390/kernel/head64.S
arch/s390/kernel/ipl.c
arch/s390/kernel/machine_kexec.c
arch/s390/kernel/process.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/reipl.S
arch/s390/kernel/reipl64.S
arch/s390/kernel/sclp.S
arch/s390/kernel/setup.c
arch/s390/kernel/signal.c
arch/s390/kernel/smp.c
arch/s390/kernel/switch_cpu.S [new file with mode: 0644]
arch/s390/kernel/switch_cpu64.S [new file with mode: 0644]
arch/s390/kernel/swsusp_asm64.S
arch/s390/kernel/syscalls.S
arch/s390/kernel/time.c
arch/s390/kernel/topology.c
arch/s390/kernel/vdso.c
arch/s390/kvm/diag.c
arch/s390/kvm/intercept.c
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/priv.c
arch/s390/kvm/sigp.c
arch/s390/lib/Makefile
arch/s390/lib/spinlock.c
arch/s390/lib/usercopy.c [new file with mode: 0644]
arch/s390/mm/extmem.c
arch/s390/mm/fault.c
arch/s390/mm/init.c
arch/s390/mm/mmap.c
arch/score/mm/init.c
arch/sh/Kconfig
arch/sh/Kconfig.cpu
arch/sh/Makefile
arch/sh/boards/Kconfig
arch/sh/boards/Makefile
arch/sh/boards/board-magicpanelr2.c
arch/sh/boards/board-polaris.c
arch/sh/boards/board-sh7785lcr.c
arch/sh/boards/board-shmin.c
arch/sh/boards/board-titan.c [moved from arch/sh/boards/mach-titan/setup.c with 56% similarity]
arch/sh/boards/board-urquell.c
arch/sh/boards/mach-ap325rxa/setup.c
arch/sh/boards/mach-cayman/irq.c
arch/sh/boards/mach-dreamcast/irq.c
arch/sh/boards/mach-dreamcast/rtc.c
arch/sh/boards/mach-dreamcast/setup.c
arch/sh/boards/mach-ecovec24/sdram.S
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-highlander/irq-r7780mp.c
arch/sh/boards/mach-highlander/irq-r7780rp.c
arch/sh/boards/mach-highlander/irq-r7785rp.c
arch/sh/boards/mach-highlander/psw.c
arch/sh/boards/mach-highlander/setup.c
arch/sh/boards/mach-hp6xx/hp6xx_apm.c
arch/sh/boards/mach-hp6xx/pm.c
arch/sh/boards/mach-hp6xx/setup.c
arch/sh/boards/mach-kfr2r09/setup.c
arch/sh/boards/mach-landisk/gio.c
arch/sh/boards/mach-landisk/irq.c
arch/sh/boards/mach-landisk/psw.c
arch/sh/boards/mach-landisk/setup.c
arch/sh/boards/mach-lboxre2/setup.c
arch/sh/boards/mach-microdev/io.c
arch/sh/boards/mach-microdev/irq.c
arch/sh/boards/mach-migor/setup.c
arch/sh/boards/mach-r2d/irq.c
arch/sh/boards/mach-r2d/setup.c
arch/sh/boards/mach-rsk/devices-rsk7203.c
arch/sh/boards/mach-sdk7780/irq.c
arch/sh/boards/mach-sdk7780/setup.c
arch/sh/boards/mach-sdk7786/Makefile [new file with mode: 0644]
arch/sh/boards/mach-sdk7786/fpga.c [new file with mode: 0644]
arch/sh/boards/mach-sdk7786/irq.c [new file with mode: 0644]
arch/sh/boards/mach-sdk7786/setup.c [new file with mode: 0644]
arch/sh/boards/mach-se/7206/io.c
arch/sh/boards/mach-se/7206/irq.c
arch/sh/boards/mach-se/7206/setup.c
arch/sh/boards/mach-se/7343/irq.c
arch/sh/boards/mach-se/7343/setup.c
arch/sh/boards/mach-se/770x/irq.c
arch/sh/boards/mach-se/770x/setup.c
arch/sh/boards/mach-se/7721/irq.c
arch/sh/boards/mach-se/7721/setup.c
arch/sh/boards/mach-se/7722/irq.c
arch/sh/boards/mach-se/7722/setup.c
arch/sh/boards/mach-se/7724/irq.c
arch/sh/boards/mach-se/7724/sdram.S
arch/sh/boards/mach-se/7724/setup.c
arch/sh/boards/mach-se/7780/irq.c
arch/sh/boards/mach-se/7780/setup.c
arch/sh/boards/mach-sh03/rtc.c
arch/sh/boards/mach-sh03/setup.c
arch/sh/boards/mach-sh7763rdp/irq.c
arch/sh/boards/mach-sh7763rdp/setup.c
arch/sh/boards/mach-snapgear/setup.c
arch/sh/boards/mach-systemh/irq.c
arch/sh/boards/mach-titan/Makefile [deleted file]
arch/sh/boards/mach-titan/io.c [deleted file]
arch/sh/boards/mach-x3proto/ilsel.c
arch/sh/boards/mach-x3proto/setup.c
arch/sh/boot/Makefile
arch/sh/boot/compressed/Makefile
arch/sh/boot/compressed/misc.c
arch/sh/cchips/hd6446x/hd64461.c
arch/sh/configs/sdk7786_defconfig [new file with mode: 0644]
arch/sh/drivers/dma/dma-pvr2.c
arch/sh/drivers/dma/dma-sh.c
arch/sh/drivers/dma/dmabrg.c
arch/sh/drivers/heartbeat.c
arch/sh/drivers/pci/Makefile
arch/sh/drivers/pci/common.c [new file with mode: 0644]
arch/sh/drivers/pci/fixups-dreamcast.c
arch/sh/drivers/pci/fixups-r7780rp.c
arch/sh/drivers/pci/fixups-rts7751r2d.c
arch/sh/drivers/pci/fixups-sdk7780.c
arch/sh/drivers/pci/fixups-se7751.c
arch/sh/drivers/pci/ops-sh4.c
arch/sh/drivers/pci/pci-dreamcast.c
arch/sh/drivers/pci/pci-sh4.h
arch/sh/drivers/pci/pci-sh5.c
arch/sh/drivers/pci/pci-sh5.h
arch/sh/drivers/pci/pci-sh7751.c
arch/sh/drivers/pci/pci-sh7780.c
arch/sh/drivers/pci/pci-sh7780.h
arch/sh/drivers/pci/pci.c
arch/sh/drivers/pci/pcie-sh7786.c
arch/sh/drivers/pci/pcie-sh7786.h
arch/sh/drivers/superhyway/ops-sh4-202.c
arch/sh/include/asm/Kbuild
arch/sh/include/asm/addrspace.h
arch/sh/include/asm/alignment.h [new file with mode: 0644]
arch/sh/include/asm/atomic-grb.h
arch/sh/include/asm/atomic-llsc.h
arch/sh/include/asm/atomic.h
arch/sh/include/asm/cacheflush.h
arch/sh/include/asm/clock.h
arch/sh/include/asm/cmpxchg-grb.h
arch/sh/include/asm/dma-mapping.h
arch/sh/include/asm/dma-sh.h
arch/sh/include/asm/dwarf.h
arch/sh/include/asm/fixmap.h
arch/sh/include/asm/fpu.h
arch/sh/include/asm/hw_breakpoint.h [new file with mode: 0644]
arch/sh/include/asm/io.h
arch/sh/include/asm/kdebug.h
arch/sh/include/asm/mmu.h
arch/sh/include/asm/mmu_context.h
arch/sh/include/asm/mmu_context_32.h
arch/sh/include/asm/module.h
arch/sh/include/asm/page.h
arch/sh/include/asm/pci.h
arch/sh/include/asm/pgalloc.h
arch/sh/include/asm/pgtable-2level.h [new file with mode: 0644]
arch/sh/include/asm/pgtable-3level.h [new file with mode: 0644]
arch/sh/include/asm/pgtable.h
arch/sh/include/asm/pgtable_32.h
arch/sh/include/asm/pgtable_64.h
arch/sh/include/asm/processor.h
arch/sh/include/asm/processor_32.h
arch/sh/include/asm/processor_64.h
arch/sh/include/asm/ptrace.h
arch/sh/include/asm/reboot.h [new file with mode: 0644]
arch/sh/include/asm/setup.h
arch/sh/include/asm/sh_bios.h
arch/sh/include/asm/suspend.h
arch/sh/include/asm/syscall.h
arch/sh/include/asm/system.h
arch/sh/include/asm/system_32.h
arch/sh/include/asm/system_64.h
arch/sh/include/asm/thread_info.h
arch/sh/include/asm/tlb.h
arch/sh/include/asm/ubc.h [deleted file]
arch/sh/include/asm/uncached.h [new file with mode: 0644]
arch/sh/include/asm/unistd_32.h
arch/sh/include/asm/unistd_64.h
arch/sh/include/asm/vmlinux.lds.h
arch/sh/include/asm/watchdog.h
arch/sh/include/cpu-sh2/cpu/ubc.h [deleted file]
arch/sh/include/cpu-sh2/cpu/watchdog.h
arch/sh/include/cpu-sh3/cpu/dac.h
arch/sh/include/cpu-sh3/cpu/dma.h
arch/sh/include/cpu-sh3/cpu/ubc.h [deleted file]
arch/sh/include/cpu-sh4/cpu/addrspace.h
arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
arch/sh/include/cpu-sh4/cpu/dma.h
arch/sh/include/cpu-sh4/cpu/mmu_context.h
arch/sh/include/cpu-sh4/cpu/sq.h
arch/sh/include/cpu-sh4/cpu/ubc.h [deleted file]
arch/sh/include/mach-common/mach/magicpanelr2.h
arch/sh/include/mach-dreamcast/mach/sysasic.h
arch/sh/include/mach-sdk7786/mach/fpga.h [new file with mode: 0644]
arch/sh/include/mach-sdk7786/mach/irq.h [new file with mode: 0644]
arch/sh/include/mach-se/mach/se7343.h
arch/sh/kernel/Makefile
arch/sh/kernel/cpu/Makefile
arch/sh/kernel/cpu/adc.c
arch/sh/kernel/cpu/clock-cpg.c
arch/sh/kernel/cpu/clock.c
arch/sh/kernel/cpu/fpu.c [new file with mode: 0644]
arch/sh/kernel/cpu/init.c
arch/sh/kernel/cpu/irq/intc-sh5.c
arch/sh/kernel/cpu/sh2/clock-sh7619.c
arch/sh/kernel/cpu/sh2a/clock-sh7201.c
arch/sh/kernel/cpu/sh2a/clock-sh7203.c
arch/sh/kernel/cpu/sh2a/clock-sh7206.c
arch/sh/kernel/cpu/sh2a/fpu.c
arch/sh/kernel/cpu/sh3/clock-sh3.c
arch/sh/kernel/cpu/sh3/clock-sh7705.c
arch/sh/kernel/cpu/sh3/clock-sh7706.c
arch/sh/kernel/cpu/sh3/clock-sh7709.c
arch/sh/kernel/cpu/sh3/clock-sh7710.c
arch/sh/kernel/cpu/sh3/clock-sh7712.c
arch/sh/kernel/cpu/sh3/entry.S
arch/sh/kernel/cpu/sh3/ex.S
arch/sh/kernel/cpu/sh3/probe.c
arch/sh/kernel/cpu/sh3/setup-sh3.c
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
arch/sh/kernel/cpu/sh4/clock-sh4.c
arch/sh/kernel/cpu/sh4/fpu.c
arch/sh/kernel/cpu/sh4/probe.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4/sq.c
arch/sh/kernel/cpu/sh4a/Makefile
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
arch/sh/kernel/cpu/sh4a/clock-sh7757.c
arch/sh/kernel/cpu/sh4a/clock-sh7763.c
arch/sh/kernel/cpu/sh4a/clock-sh7770.c
arch/sh/kernel/cpu/sh4a/clock-sh7780.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
arch/sh/kernel/cpu/sh4a/clock-shx3.c
arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7757.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/smp-shx3.c
arch/sh/kernel/cpu/sh4a/ubc.c [new file with mode: 0644]
arch/sh/kernel/cpu/sh5/clock-sh5.c
arch/sh/kernel/cpu/sh5/entry.S
arch/sh/kernel/cpu/sh5/fpu.c
arch/sh/kernel/cpu/shmobile/pm.c
arch/sh/kernel/cpu/shmobile/sleep.S
arch/sh/kernel/debugtraps.S
arch/sh/kernel/dwarf.c
arch/sh/kernel/early_printk.c [deleted file]
arch/sh/kernel/entry-common.S
arch/sh/kernel/ftrace.c
arch/sh/kernel/head_32.S
arch/sh/kernel/head_64.S
arch/sh/kernel/hw_breakpoint.c [new file with mode: 0644]
arch/sh/kernel/idle.c
arch/sh/kernel/io_trapped.c
arch/sh/kernel/kgdb.c
arch/sh/kernel/machine_kexec.c
arch/sh/kernel/perf_callchain.c
arch/sh/kernel/process.c [new file with mode: 0644]
arch/sh/kernel/process_32.c
arch/sh/kernel/process_64.c
arch/sh/kernel/ptrace_32.c
arch/sh/kernel/ptrace_64.c
arch/sh/kernel/reboot.c [new file with mode: 0644]
arch/sh/kernel/setup.c
arch/sh/kernel/sh_bios.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sh/kernel/smp.c
arch/sh/kernel/syscalls_32.S
arch/sh/kernel/syscalls_64.S
arch/sh/kernel/traps.c
arch/sh/kernel/traps_32.c
arch/sh/kernel/traps_64.c
arch/sh/kernel/vmlinux.lds.S
arch/sh/math-emu/math.c
arch/sh/mm/Kconfig
arch/sh/mm/Makefile
arch/sh/mm/alignment.c [new file with mode: 0644]
arch/sh/mm/cache-debugfs.c
arch/sh/mm/cache-sh2.c
arch/sh/mm/cache-sh2a.c
arch/sh/mm/cache-sh3.c
arch/sh/mm/cache-sh4.c
arch/sh/mm/cache-sh7705.c
arch/sh/mm/cache.c
arch/sh/mm/fault_32.c
arch/sh/mm/init.c
arch/sh/mm/ioremap.c [moved from arch/sh/mm/ioremap_32.c with 78% similarity]
arch/sh/mm/ioremap_64.c [deleted file]
arch/sh/mm/ioremap_fixed.c [new file with mode: 0644]
arch/sh/mm/nommu.c
arch/sh/mm/pgtable.c [new file with mode: 0644]
arch/sh/mm/pmb.c
arch/sh/mm/tlb-pteaex.c
arch/sh/mm/tlb-sh3.c
arch/sh/mm/tlb-sh4.c
arch/sh/mm/tlb-sh5.c
arch/sh/mm/tlb-urb.c [new file with mode: 0644]
arch/sh/mm/tlbflush_32.c
arch/sh/mm/tlbflush_64.c
arch/sh/mm/uncached.c [new file with mode: 0644]
arch/sh/tools/Makefile
arch/sh/tools/mach-types
arch/sparc/Kconfig
arch/sparc/configs/sparc32_defconfig
arch/sparc/configs/sparc64_defconfig
arch/sparc/include/asm/elf_64.h
arch/sparc/include/asm/io_32.h
arch/sparc/include/asm/page_32.h
arch/sparc/include/asm/param.h
arch/sparc/include/asm/stat.h
arch/sparc/include/asm/syscall.h
arch/sparc/include/asm/thread_info_64.h
arch/sparc/include/asm/timex_32.h
arch/sparc/include/asm/topology_64.h
arch/sparc/include/asm/uaccess_32.h
arch/sparc/include/asm/uaccess_64.h
arch/sparc/kernel/central.c
arch/sparc/kernel/devices.c
arch/sparc/kernel/ftrace.c
arch/sparc/kernel/irq_64.c
arch/sparc/kernel/kstack.h
arch/sparc/kernel/of_device_32.c
arch/sparc/kernel/of_device_64.c
arch/sparc/kernel/pci.c
arch/sparc/kernel/pcic.c
arch/sparc/kernel/perf_event.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/sparc/kernel/prom.h
arch/sparc/kernel/prom_common.c
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/kernel/smp_64.c
arch/sparc/kernel/sys_sparc_64.c
arch/sparc/kernel/time_32.c
arch/sparc/kernel/tsb.S
arch/sparc/mm/fault_32.c
arch/sparc/mm/fault_64.c
arch/um/drivers/mconsole_kern.c
arch/um/sys-x86_64/Makefile
arch/x86/Kconfig
arch/x86/Kconfig.cpu
arch/x86/Makefile
arch/x86/boot/compressed/misc.c
arch/x86/boot/mkcpustr.c
arch/x86/boot/video-vga.c
arch/x86/boot/video.c
arch/x86/ia32/ia32_aout.c
arch/x86/include/asm/alternative.h
arch/x86/include/asm/amd_iommu_proto.h
arch/x86/include/asm/atomic.h
arch/x86/include/asm/atomic64_32.h [new file with mode: 0644]
arch/x86/include/asm/atomic64_64.h [new file with mode: 0644]
arch/x86/include/asm/atomic_32.h [deleted file]
arch/x86/include/asm/atomic_64.h [deleted file]
arch/x86/include/asm/cpu_debug.h [deleted file]
arch/x86/include/asm/cpufeature.h
arch/x86/include/asm/debugreg.h
arch/x86/include/asm/elf.h
arch/x86/include/asm/fb.h
arch/x86/include/asm/fixmap.h
arch/x86/include/asm/hpet.h
arch/x86/include/asm/i387.h
arch/x86/include/asm/io.h
arch/x86/include/asm/io_32.h [deleted file]
arch/x86/include/asm/io_64.h [deleted file]
arch/x86/include/asm/mce.h
arch/x86/include/asm/microcode.h
arch/x86/include/asm/mmzone_64.h
arch/x86/include/asm/nmi.h
arch/x86/include/asm/numa_64.h
arch/x86/include/asm/numaq.h
arch/x86/include/asm/page_types.h
arch/x86/include/asm/pci_x86.h
arch/x86/include/asm/perf_event.h
arch/x86/include/asm/pgalloc.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/ptrace.h
arch/x86/include/asm/rwsem.h
arch/x86/include/asm/smp.h
arch/x86/include/asm/stacktrace.h
arch/x86/include/asm/syscall.h
arch/x86/include/asm/system.h
arch/x86/include/asm/thread_info.h
arch/x86/include/asm/uaccess_64.h
arch/x86/include/asm/user.h
arch/x86/include/asm/uv/bios.h
arch/x86/include/asm/uv/uv.h
arch/x86/include/asm/uv/uv_hub.h
arch/x86/include/asm/x86_init.h
arch/x86/include/asm/xsave.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/alternative.c
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/amd_iommu_init.c
arch/x86/kernel/aperture_64.c
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/numaq_32.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/probe_64.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/bios_uv.c
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/cpu/addon_cpuid_features.c
arch/x86/kernel/cpu/cpu_debug.c [deleted file]
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/mtrr/Makefile
arch/x86/kernel/cpu/mtrr/amd.c
arch/x86/kernel/cpu/mtrr/centaur.c
arch/x86/kernel/cpu/mtrr/cyrix.c
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/cpu/mtrr/main.c
arch/x86/kernel/cpu/mtrr/mtrr.h
arch/x86/kernel/cpu/mtrr/state.c [deleted file]
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/cpu/perf_event_amd.c [new file with mode: 0644]
arch/x86/kernel/cpu/perf_event_intel.c [new file with mode: 0644]
arch/x86/kernel/cpu/perf_event_p6.c [new file with mode: 0644]
arch/x86/kernel/cpu/perfctr-watchdog.c
arch/x86/kernel/cpuid.c
arch/x86/kernel/dumpstack.c
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/e820.c
arch/x86/kernel/efi.c
arch/x86/kernel/ftrace.c
arch/x86/kernel/hpet.c
arch/x86/kernel/hw_breakpoint.c
arch/x86/kernel/i387.c
arch/x86/kernel/kgdb.c
arch/x86/kernel/kprobes.c
arch/x86/kernel/microcode_amd.c
arch/x86/kernel/microcode_core.c
arch/x86/kernel/microcode_intel.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/msr.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/quirks.c
arch/x86/kernel/reboot.c
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/traps.c
arch/x86/kernel/tsc.c
arch/x86/kernel/uv_sysfs.c
arch/x86/kernel/uv_time.c
arch/x86/kernel/x8664_ksyms_64.c
arch/x86/kernel/x86_init.c
arch/x86/kernel/xsave.c
arch/x86/kvm/i8254.c
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h
arch/x86/kvm/x86.c
arch/x86/lib/Makefile
arch/x86/lib/cache-smp.c [new file with mode: 0644]
arch/x86/lib/copy_user_64.S
arch/x86/lib/io_64.c [deleted file]
arch/x86/lib/memcpy_64.S
arch/x86/lib/memset_64.S
arch/x86/lib/rwsem_64.S [new file with mode: 0644]
arch/x86/mm/gup.c
arch/x86/mm/init.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/ioremap.c
arch/x86/mm/kmemcheck/kmemcheck.c
arch/x86/mm/kmemcheck/shadow.c
arch/x86/mm/kmemcheck/shadow.h
arch/x86/mm/kmmio.c
arch/x86/mm/mmap.c
arch/x86/mm/numa_64.c
arch/x86/mm/pgtable.c
arch/x86/mm/srat_64.c
arch/x86/mm/tlb.c
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_amd.c
arch/x86/oprofile/op_model_p4.c
arch/x86/oprofile/op_model_ppro.c
arch/x86/oprofile/op_x86_model.h
arch/x86/pci/Makefile
arch/x86/pci/acpi.c
arch/x86/pci/bus_numa.c
arch/x86/pci/bus_numa.h
arch/x86/pci/common.c
arch/x86/pci/i386.c
arch/x86/pci/intel_bus.c [deleted file]
arch/x86/pci/irq.c
arch/x86/pci/mmconfig-shared.c
arch/x86/pci/numaq_32.c
arch/x86/tools/test_get_len.c
arch/x86/xen/enlighten.c
arch/xtensa/kernel/pci.c
block/blk-cgroup.c
block/blk-core.c
block/blk-ioc.c
block/blk-settings.c
block/cfq-iosched.c
block/genhd.c
crypto/Kconfig
crypto/Makefile
crypto/ablkcipher.c
crypto/aead.c
crypto/aes_generic.c
crypto/algapi.c
crypto/anubis.c
crypto/api.c
crypto/authenc.c
crypto/blowfish.c
crypto/camellia.c
crypto/cast5.c
crypto/cast6.c
crypto/cipher.c
crypto/compress.c
crypto/crc32c.c
crypto/crypto_null.c
crypto/deflate.c
crypto/des_generic.c
crypto/ecb.c
crypto/fcrypt.c
crypto/gcm.c
crypto/md5.c
crypto/pcrypt.c [new file with mode: 0644]
crypto/testmgr.c
drivers/acpi/acpi_pad.c
drivers/acpi/acpica/acevents.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acobject.h
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evgpeblk.c
drivers/acpi/acpica/evmisc.c
drivers/acpi/acpica/evxface.c
drivers/acpi/acpica/evxfevnt.c
drivers/acpi/bus.c
drivers/acpi/button.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/internal.h
drivers/acpi/pci_bind.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/power.c
drivers/acpi/power_meter.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_pdc.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/sbs.c
drivers/acpi/sbshc.c
drivers/acpi/scan.c
drivers/acpi/sleep.c
drivers/acpi/system.c
drivers/acpi/tables.c
drivers/acpi/video.c
drivers/acpi/wakeup.c
drivers/ata/ahci.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/base/class.c
drivers/base/devtmpfs.c
drivers/base/memory.c
drivers/base/power/main.c
drivers/base/power/power.h
drivers/base/power/runtime.c
drivers/base/power/sysfs.c
drivers/block/ataflop.c
drivers/block/cciss.c
drivers/block/drbd/Kconfig
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_receiver.c
drivers/block/pktcdvd.c
drivers/block/swim.c
drivers/block/viodasd.c
drivers/block/virtio_blk.c
drivers/bluetooth/Kconfig
drivers/bluetooth/Makefile
drivers/bluetooth/ath3k.c [new file with mode: 0644]
drivers/bluetooth/bluecard_cs.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btmrvl_sdio.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/dtl1_cs.c
drivers/char/Kconfig
drivers/char/agp/amd64-agp.c
drivers/char/agp/intel-agp.c
drivers/char/hvc_beat.c
drivers/char/hvc_console.c
drivers/char/hvc_console.h
drivers/char/hvc_iseries.c
drivers/char/hvc_iucv.c
drivers/char/hvc_rtas.c
drivers/char/hvc_udbg.c
drivers/char/hvc_vio.c
drivers/char/hvc_xen.c
drivers/char/hw_random/Kconfig
drivers/char/hw_random/Makefile
drivers/char/hw_random/nomadik-rng.c [new file with mode: 0644]
drivers/char/hw_random/virtio-rng.c
drivers/char/mem.c
drivers/char/nozomi.c
drivers/char/nvram.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/random.c
drivers/char/tpm/tpm_infineon.c
drivers/char/tty_io.c
drivers/char/uv_mmtimer.c
drivers/char/virtio_console.c
drivers/char/vme_scc.c
drivers/clocksource/cs5535-clockevt.c
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c
drivers/connector/connector.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/crypto/amcc/crypto4xx_core.c
drivers/crypto/geode-aes.c
drivers/crypto/padlock-sha.c
drivers/crypto/talitos.c
drivers/dma/coh901318.c
drivers/dma/dmaengine.c
drivers/dma/dmatest.c
drivers/dma/ioat/dma_v2.c
drivers/dma/ipu/ipu_idmac.c
drivers/dma/shdma.c
drivers/dma/shdma.h
drivers/edac/amd64_edac.c
drivers/edac/i5000_edac.c
drivers/edac/mpc85xx_edac.c
drivers/firewire/core-card.c
drivers/firewire/core-cdev.c
drivers/firewire/net.c
drivers/firewire/ohci.c
drivers/firmware/iscsi_ibft.c
drivers/gpu/drm/Kconfig
drivers/gpu/drm/ati_pcigart.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_mm.c
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_bios.h
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_tv.c
drivers/gpu/drm/nouveau/nouveau_acpi.c
drivers/gpu/drm/nouveau/nouveau_bios.c
drivers/gpu/drm/nouveau/nouveau_bios.h
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_channel.c
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/nouveau/nouveau_dma.c
drivers/gpu/drm/nouveau/nouveau_dp.c
drivers/gpu/drm/nouveau/nouveau_drv.c
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_fbcon.c
drivers/gpu/drm/nouveau/nouveau_fbcon.h
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/nouveau/nouveau_grctx.c
drivers/gpu/drm/nouveau/nouveau_irq.c
drivers/gpu/drm/nouveau/nouveau_mem.c
drivers/gpu/drm/nouveau/nouveau_notifier.c
drivers/gpu/drm/nouveau/nouveau_object.c
drivers/gpu/drm/nouveau/nouveau_reg.h
drivers/gpu/drm/nouveau/nouveau_sgdma.c
drivers/gpu/drm/nouveau/nouveau_state.c
drivers/gpu/drm/nouveau/nv04_dac.c
drivers/gpu/drm/nouveau/nv04_fbcon.c
drivers/gpu/drm/nouveau/nv04_instmem.c
drivers/gpu/drm/nouveau/nv17_tv.c
drivers/gpu/drm/nouveau/nv50_crtc.c
drivers/gpu/drm/nouveau/nv50_fbcon.c
drivers/gpu/drm/nouveau/nv50_fifo.c
drivers/gpu/drm/nouveau/nv50_graph.c
drivers/gpu/drm/nouveau/nv50_instmem.c
drivers/gpu/drm/nouveau/nv50_sor.c
drivers/gpu/drm/radeon/Kconfig
drivers/gpu/drm/radeon/atom.c
drivers/gpu/drm/radeon/atom.h
drivers/gpu/drm/radeon/atombios_crtc.c
drivers/gpu/drm/radeon/atombios_dp.c
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/r200.c
drivers/gpu/drm/radeon/r300.c
drivers/gpu/drm/radeon/r420.c
drivers/gpu/drm/radeon/r520.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/r600_audio.c
drivers/gpu/drm/radeon/r600_blit_kms.c
drivers/gpu/drm/radeon/r600_cp.c
drivers/gpu/drm/radeon/r600_cs.c
drivers/gpu/drm/radeon/r600d.h
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_agp.c
drivers/gpu/drm/radeon/radeon_asic.h
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_benchmark.c
drivers/gpu/drm/radeon/radeon_clocks.c
drivers/gpu/drm/radeon/radeon_combios.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_cs.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_drv.h
drivers/gpu/drm/radeon/radeon_encoders.c
drivers/gpu/drm/radeon/radeon_fb.c
drivers/gpu/drm/radeon/radeon_gem.c
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
drivers/gpu/drm/radeon/radeon_legacy_encoders.c
drivers/gpu/drm/radeon/radeon_mode.h
drivers/gpu/drm/radeon/radeon_object.c
drivers/gpu/drm/radeon/radeon_object.h
drivers/gpu/drm/radeon/radeon_ring.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/radeon/reg_srcs/r200
drivers/gpu/drm/radeon/rs400.c
drivers/gpu/drm/radeon/rs600.c
drivers/gpu/drm/radeon/rs690.c
drivers/gpu/drm/radeon/rv515.c
drivers/gpu/drm/radeon/rv770.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_lock.c
drivers/gpu/drm/ttm/ttm_object.c
drivers/gpu/drm/ttm/ttm_tt.c
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
drivers/gpu/vga/Kconfig
drivers/gpu/vga/vgaarb.c
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-3m-pct.c [new file with mode: 0644]
drivers/hid/hid-apple.c
drivers/hid/hid-core.c
drivers/hid/hid-debug.c
drivers/hid/hid-ids.h
drivers/hid/hid-input.c
drivers/hid/hid-lg.c
drivers/hid/hid-lg.h
drivers/hid/hid-lg3ff.c [new file with mode: 0644]
drivers/hid/hid-lgff.c
drivers/hid/hid-magicmouse.c [new file with mode: 0644]
drivers/hid/hid-mosart.c [new file with mode: 0644]
drivers/hid/hid-ntrig.c
drivers/hid/hid-ortek.c [new file with mode: 0644]
drivers/hid/hid-quanta.c [new file with mode: 0644]
drivers/hid/hid-samsung.c
drivers/hid/hid-sony.c
drivers/hid/hid-stantum.c [new file with mode: 0644]
drivers/hid/hid-wacom.c
drivers/hid/hidraw.c
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-quirks.c
drivers/hid/usbhid/usbhid.h
drivers/hwmon/adt7462.c
drivers/hwmon/amc6821.c
drivers/hwmon/ams/ams-core.c
drivers/hwmon/ams/ams-i2c.c
drivers/hwmon/ams/ams-pmu.c
drivers/hwmon/ams/ams.h
drivers/hwmon/asus_atk0110.c
drivers/hwmon/fschmd.c
drivers/hwmon/lm78.c
drivers/hwmon/smsc47m1.c
drivers/hwmon/w83781d.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/Makefile
drivers/i2c/busses/i2c-ali1563.c
drivers/i2c/busses/i2c-imx.c
drivers/i2c/busses/i2c-octeon.c [new file with mode: 0644]
drivers/i2c/busses/i2c-pca-isa.c
drivers/i2c/busses/i2c-pca-platform.c
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-tiny-usb.c
drivers/i2c/busses/i2c-viapro.c
drivers/i2c/i2c-core.c
drivers/ide/au1xxx-ide.c
drivers/infiniband/core/cma.c
drivers/infiniband/hw/ipath/ipath_fs.c
drivers/input/evdev.c
drivers/input/input-polldev.c
drivers/input/input.c
drivers/input/joystick/gf2k.c
drivers/input/joystick/xpad.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/davinci_keyscan.c
drivers/input/misc/winbond-cir.c
drivers/input/mouse/bcm5974.c
drivers/input/mouse/lifebook.c
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/sentelic.c
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h
drivers/input/serio/i8042-x86ia64io.h
drivers/input/serio/i8042.c
drivers/input/touchscreen/ad7879.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/isdn/hisax/Kconfig
drivers/isdn/hisax/avm_pci.c
drivers/isdn/hisax/bkm_a4t.c
drivers/isdn/hisax/bkm_a8.c
drivers/isdn/hisax/diva.c
drivers/isdn/hisax/elsa.c
drivers/isdn/hisax/enternow_pci.c
drivers/isdn/hisax/gazel.c
drivers/isdn/hisax/hfc_pci.c
drivers/isdn/hisax/hisax.h
drivers/isdn/hisax/niccy.c
drivers/isdn/hisax/nj_s.c
drivers/isdn/hisax/nj_u.c
drivers/isdn/hisax/sedlbauer.c
drivers/isdn/hisax/telespci.c
drivers/isdn/hisax/w6692.c
drivers/macintosh/adb.c
drivers/macintosh/smu.c
drivers/macintosh/therm_adt746x.c
drivers/macintosh/therm_pm72.c
drivers/macintosh/therm_windtunnel.c
drivers/macintosh/via-cuda.c
drivers/macintosh/via-pmu-backlight.c
drivers/macintosh/via-pmu.c
drivers/macintosh/windfarm_core.c
drivers/macintosh/windfarm_cpufreq_clamp.c
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_max6690_sensor.c
drivers/macintosh/windfarm_pm112.c
drivers/macintosh/windfarm_pm121.c
drivers/macintosh/windfarm_pm81.c
drivers/macintosh/windfarm_pm91.c
drivers/macintosh/windfarm_smu_sensors.c
drivers/md/dm-log-userspace-transfer.c
drivers/md/dm-raid1.c
drivers/md/dm-region-hash.c
drivers/md/dm-snap-persistent.c
drivers/md/dm-stripe.c
drivers/md/dm-sysfs.c
drivers/md/dm-table.c
drivers/md/dm.c
drivers/md/md.c
drivers/md/raid5.c
drivers/media/IR/Makefile
drivers/media/IR/ir-functions.c
drivers/media/IR/ir-keymaps.c
drivers/media/IR/ir-keytable.c
drivers/media/IR/ir-sysfs.c [new file with mode: 0644]
drivers/media/common/saa7146_fops.c
drivers/media/common/saa7146_video.c
drivers/media/common/tuners/tda8290.c
drivers/media/common/tuners/tuner-types.c
drivers/media/common/tuners/tuner-xc2028.c
drivers/media/dvb/Kconfig
drivers/media/dvb/Makefile
drivers/media/dvb/bt8xx/bt878.c
drivers/media/dvb/bt8xx/dst.c
drivers/media/dvb/dm1105/Kconfig
drivers/media/dvb/dm1105/dm1105.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/dvb-core/dvb_ringbuffer.c
drivers/media/dvb/dvb-usb/Kconfig
drivers/media/dvb/dvb-usb/Makefile
drivers/media/dvb/dvb-usb/af9015.c
drivers/media/dvb/dvb-usb/af9015.h
drivers/media/dvb/dvb-usb/az6027.c [new file with mode: 0644]
drivers/media/dvb/dvb-usb/az6027.h [new file with mode: 0644]
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/dvb-usb/dib0700.h
drivers/media/dvb/dvb-usb/dib0700_core.c
drivers/media/dvb/dvb-usb/dib0700_devices.c
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
drivers/media/dvb/dvb-usb/dvb-usb-init.c
drivers/media/dvb/dvb-usb/dvb-usb-remote.c
drivers/media/dvb/dvb-usb/dw2102.c
drivers/media/dvb/dvb-usb/friio-fe.c
drivers/media/dvb/dvb-usb/m920x.c
drivers/media/dvb/dvb-usb/m920x.h
drivers/media/dvb/dvb-usb/opera1.c
drivers/media/dvb/firewire/firedtv-1394.c
drivers/media/dvb/firewire/firedtv-avc.c
drivers/media/dvb/firewire/firedtv-dvb.c
drivers/media/dvb/firewire/firedtv-fw.c
drivers/media/dvb/firewire/firedtv.h
drivers/media/dvb/frontends/Kconfig
drivers/media/dvb/frontends/Makefile
drivers/media/dvb/frontends/af9013.h
drivers/media/dvb/frontends/atbm8830.c
drivers/media/dvb/frontends/dib0090.c
drivers/media/dvb/frontends/dib8000.c
drivers/media/dvb/frontends/dib8000.h
drivers/media/dvb/frontends/dibx000_common.c
drivers/media/dvb/frontends/l64781.c
drivers/media/dvb/frontends/lgdt3305.h
drivers/media/dvb/frontends/lnbp21.c
drivers/media/dvb/frontends/mb86a16.c [new file with mode: 0644]
drivers/media/dvb/frontends/mb86a16.h [new file with mode: 0644]
drivers/media/dvb/frontends/mb86a16_priv.h [new file with mode: 0644]
drivers/media/dvb/frontends/si21xx.c
drivers/media/dvb/frontends/stv0900.h
drivers/media/dvb/frontends/stv0900_core.c
drivers/media/dvb/frontends/stv0900_priv.h
drivers/media/dvb/frontends/stv0900_reg.h
drivers/media/dvb/frontends/stv0900_sw.c
drivers/media/dvb/frontends/stv090x.c
drivers/media/dvb/frontends/stv090x.h
drivers/media/dvb/frontends/stv090x_priv.h
drivers/media/dvb/frontends/stv6110x.c
drivers/media/dvb/frontends/stv6110x.h
drivers/media/dvb/frontends/stv6110x_priv.h
drivers/media/dvb/frontends/tda10021.c
drivers/media/dvb/frontends/tda665x.c [new file with mode: 0644]
drivers/media/dvb/frontends/tda665x.h [new file with mode: 0644]
drivers/media/dvb/frontends/tda8261.c
drivers/media/dvb/frontends/zl10036.c
drivers/media/dvb/frontends/zl10039.c
drivers/media/dvb/mantis/Kconfig [new file with mode: 0644]
drivers/media/dvb/mantis/Makefile [new file with mode: 0644]
drivers/media/dvb/mantis/hopper_cards.c [new file with mode: 0644]
drivers/media/dvb/mantis/hopper_vp3028.c [new file with mode: 0644]
drivers/media/dvb/mantis/hopper_vp3028.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_ca.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_ca.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_cards.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_common.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_core.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_core.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_dma.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_dma.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_dvb.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_dvb.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_evm.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_hif.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_hif.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_i2c.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_i2c.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_input.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_ioc.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_ioc.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_link.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_pci.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_pci.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_pcmcia.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_reg.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_uart.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_uart.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1033.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1033.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1034.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1034.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1041.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp1041.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp2033.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp2033.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp2040.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp2040.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp3028.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp3028.h [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp3030.c [new file with mode: 0644]
drivers/media/dvb/mantis/mantis_vp3030.h [new file with mode: 0644]
drivers/media/dvb/ngene/Kconfig [new file with mode: 0644]
drivers/media/dvb/ngene/Makefile [new file with mode: 0644]
drivers/media/dvb/ngene/ngene-core.c [new file with mode: 0644]
drivers/media/dvb/ngene/ngene.h [new file with mode: 0644]
drivers/media/dvb/siano/sms-cards.c
drivers/media/dvb/siano/smscoreapi.c
drivers/media/dvb/siano/smscoreapi.h
drivers/media/dvb/siano/smsdvb.c
drivers/media/dvb/siano/smsir.c
drivers/media/dvb/ttpci/av7110_ir.c
drivers/media/dvb/ttpci/budget-ci.c
drivers/media/dvb/ttpci/budget.c
drivers/media/radio/Kconfig
drivers/media/radio/Makefile
drivers/media/radio/radio-timb.c [new file with mode: 0644]
drivers/media/radio/saa7706h.c [new file with mode: 0644]
drivers/media/radio/si470x/radio-si470x-common.c
drivers/media/radio/si470x/radio-si470x-usb.c
drivers/media/video/Kconfig
drivers/media/video/Makefile
drivers/media/video/bt819.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/bt8xx/bttv-i2c.c
drivers/media/video/bt8xx/bttv-input.c
drivers/media/video/bt8xx/bttvp.h
drivers/media/video/cafe_ccic.c
drivers/media/video/cpia.c
drivers/media/video/cx18/Kconfig
drivers/media/video/cx18/Makefile
drivers/media/video/cx18/cx18-alsa-main.c [new file with mode: 0644]
drivers/media/video/cx18/cx18-alsa-mixer.c [new file with mode: 0644]
drivers/media/video/cx18/cx18-alsa-mixer.h [new file with mode: 0644]
drivers/media/video/cx18/cx18-alsa-pcm.c [new file with mode: 0644]
drivers/media/video/cx18/cx18-alsa-pcm.h [new file with mode: 0644]
drivers/media/video/cx18/cx18-alsa.h [new file with mode: 0644]
drivers/media/video/cx18/cx18-cards.c
drivers/media/video/cx18/cx18-driver.c
drivers/media/video/cx18/cx18-driver.h
drivers/media/video/cx18/cx18-dvb.c
drivers/media/video/cx18/cx18-fileops.c
drivers/media/video/cx18/cx18-fileops.h
drivers/media/video/cx18/cx18-ioctl.c
drivers/media/video/cx18/cx18-mailbox.c
drivers/media/video/cx18/cx18-queue.c
drivers/media/video/cx18/cx18-streams.c
drivers/media/video/cx18/cx18-streams.h
drivers/media/video/cx18/cx18-version.h
drivers/media/video/cx18/cx23418.h
drivers/media/video/cx231xx/cx231xx-dvb.c
drivers/media/video/cx231xx/cx231xx-input.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx23885/cx23885-cards.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885-input.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx23885/cx23885.h
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx88/cx88-alsa.c
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-input.c
drivers/media/video/cx88/cx88-mpeg.c
drivers/media/video/cx88/cx88.h
drivers/media/video/dabusb.c
drivers/media/video/davinci/Makefile
drivers/media/video/davinci/dm355_ccdc.c
drivers/media/video/davinci/dm644x_ccdc.c
drivers/media/video/davinci/isif.c [new file with mode: 0644]
drivers/media/video/davinci/isif_regs.h [new file with mode: 0644]
drivers/media/video/davinci/vpfe_capture.c
drivers/media/video/davinci/vpss.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-core.c
drivers/media/video/em28xx/em28xx-dvb.c
drivers/media/video/em28xx/em28xx-input.c
drivers/media/video/em28xx/em28xx-reg.h
drivers/media/video/em28xx/em28xx-vbi.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/em28xx/em28xx.h
drivers/media/video/et61x251/Kconfig
drivers/media/video/gspca/Kconfig
drivers/media/video/gspca/Makefile
drivers/media/video/gspca/benq.c [new file with mode: 0644]
drivers/media/video/gspca/coarse_expo_autogain.h [new file with mode: 0644]
drivers/media/video/gspca/conex.c
drivers/media/video/gspca/cpia1.c [new file with mode: 0644]
drivers/media/video/gspca/etoms.c
drivers/media/video/gspca/gl860/gl860.c
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h
drivers/media/video/gspca/m5602/m5602_mt9m111.c
drivers/media/video/gspca/m5602/m5602_ov7660.c
drivers/media/video/gspca/m5602/m5602_ov7660.h
drivers/media/video/gspca/m5602/m5602_ov9650.c
drivers/media/video/gspca/m5602/m5602_po1030.c
drivers/media/video/gspca/m5602/m5602_s5k4aa.c
drivers/media/video/gspca/m5602/m5602_s5k83a.c
drivers/media/video/gspca/mars.c
drivers/media/video/gspca/mr97310a.c
drivers/media/video/gspca/ov519.c
drivers/media/video/gspca/ov534.c
drivers/media/video/gspca/ov534_9.c [new file with mode: 0644]
drivers/media/video/gspca/pac207.c
drivers/media/video/gspca/pac7302.c
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/pac_common.h
drivers/media/video/gspca/sn9c2028.c [new file with mode: 0644]
drivers/media/video/gspca/sn9c2028.h [new file with mode: 0644]
drivers/media/video/gspca/sn9c20x.c
drivers/media/video/gspca/sonixb.c
drivers/media/video/gspca/sonixj.c
drivers/media/video/gspca/spca500.c
drivers/media/video/gspca/spca501.c
drivers/media/video/gspca/spca505.c
drivers/media/video/gspca/spca506.c
drivers/media/video/gspca/spca508.c
drivers/media/video/gspca/spca561.c
drivers/media/video/gspca/sq905c.c
drivers/media/video/gspca/stk014.c
drivers/media/video/gspca/stv0680.c
drivers/media/video/gspca/stv06xx/stv06xx.c
drivers/media/video/gspca/stv06xx/stv06xx_vv6410.h
drivers/media/video/gspca/sunplus.c
drivers/media/video/gspca/t613.c
drivers/media/video/gspca/tv8532.c
drivers/media/video/gspca/vc032x.c
drivers/media/video/gspca/zc3xx.c
drivers/media/video/hdpvr/hdpvr-core.c
drivers/media/video/hdpvr/hdpvr-video.c
drivers/media/video/hdpvr/hdpvr.h
drivers/media/video/hexium_gemini.c
drivers/media/video/hexium_orion.c
drivers/media/video/ir-kbd-i2c.c
drivers/media/video/ivtv/ivtv-cards.c
drivers/media/video/ivtv/ivtv-cards.h
drivers/media/video/ivtv/ivtv-driver.c
drivers/media/video/ivtv/ivtv-firmware.c
drivers/media/video/ivtv/ivtv-irq.c
drivers/media/video/ivtv/ivtv-mailbox.c
drivers/media/video/ivtv/ivtv-mailbox.h
drivers/media/video/ivtv/ivtv-streams.c
drivers/media/video/ivtv/ivtv-udma.c
drivers/media/video/mt9t112.c
drivers/media/video/mt9v022.c
drivers/media/video/mx1_camera.c
drivers/media/video/mxb.c
drivers/media/video/ov772x.c
drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
drivers/media/video/pvrusb2/pvrusb2-hdw.c
drivers/media/video/pvrusb2/pvrusb2-hdw.h
drivers/media/video/pwc/pwc-ctrl.c
drivers/media/video/pxa_camera.c
drivers/media/video/rj54n1cb0c.c
drivers/media/video/saa7115.c
drivers/media/video/saa7127.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/saa7134/saa7134-input.c
drivers/media/video/saa7134/saa7134-ts.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h
drivers/media/video/saa7164/saa7164-api.c
drivers/media/video/sh_mobile_ceu_camera.c
drivers/media/video/sn9c102/Kconfig
drivers/media/video/sn9c102/sn9c102_devtable.h
drivers/media/video/soc_camera.c
drivers/media/video/soc_mediabus.c
drivers/media/video/tlg2300/Kconfig [new file with mode: 0644]
drivers/media/video/tlg2300/Makefile [new file with mode: 0644]
drivers/media/video/tlg2300/pd-alsa.c [new file with mode: 0644]
drivers/media/video/tlg2300/pd-common.h [new file with mode: 0644]
drivers/media/video/tlg2300/pd-dvb.c [new file with mode: 0644]
drivers/media/video/tlg2300/pd-main.c [new file with mode: 0644]
drivers/media/video/tlg2300/pd-radio.c [new file with mode: 0644]
drivers/media/video/tlg2300/pd-video.c [new file with mode: 0644]
drivers/media/video/tlg2300/vendorcmds.h [new file with mode: 0644]
drivers/media/video/tuner-core.c
drivers/media/video/tveeprom.c
drivers/media/video/tvp7002.c [new file with mode: 0644]
drivers/media/video/tvp7002_reg.h [new file with mode: 0644]
drivers/media/video/tw9910.c
drivers/media/video/usbvision/usbvision-video.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_queue.c
drivers/media/video/uvc/uvc_v4l2.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/uvc/uvcvideo.h
drivers/media/video/v4l2-compat-ioctl32.c
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-vmalloc.c
drivers/media/video/vivi.c
drivers/media/video/zc0301/Kconfig
drivers/media/video/zoran/zoran_device.c
drivers/media/video/zoran/zoran_driver.c
drivers/media/video/zr364xx.c
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptbase.h
drivers/message/fusion/mptctl.c
drivers/message/fusion/mptfc.c
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptscsih.c
drivers/mfd/Kconfig
drivers/mfd/Makefile
drivers/mfd/asic3.c
drivers/mfd/mc13783-core.c
drivers/mfd/t7l66xb.c
drivers/mfd/tc6387xb.c
drivers/mfd/tc6393xb.c
drivers/mfd/timberdale.c [new file with mode: 0644]
drivers/mfd/timberdale.h [new file with mode: 0644]
drivers/mfd/tmio_core.c [new file with mode: 0644]
drivers/mfd/wm8350-core.c
drivers/mfd/wm8350-irq.c
drivers/mmc/card/mmc_test.c
drivers/mmc/host/au1xmmc.c
drivers/mmc/host/tmio_mmc.c
drivers/mmc/host/tmio_mmc.h
drivers/mtd/maps/Kconfig
drivers/mtd/maps/Makefile
drivers/mtd/maps/alchemy-flash.c [deleted file]
drivers/mtd/maps/pismo.c [new file with mode: 0644]
drivers/mtd/mtdoops.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/au1550nd.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/tests/mtd_readtest.c
drivers/mtd/tests/mtd_speedtest.c
drivers/mtd/tests/mtd_stresstest.c
drivers/mtd/ubi/cdev.c
drivers/mtd/ubi/kapi.c
drivers/mtd/ubi/upd.c
drivers/mtd/ubi/vtbl.c
drivers/net/au1000_eth.c
drivers/net/au1000_eth.h
drivers/net/ax88796.c
drivers/net/benet/be.h
drivers/net/benet/be_cmds.c
drivers/net/benet/be_cmds.h
drivers/net/benet/be_main.c
drivers/net/bfin_mac.c
drivers/net/bonding/bond_main.c
drivers/net/cpmac.c
drivers/net/cxgb3/sge.c
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/e1000.h
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/netdev.c
drivers/net/e1000e/phy.c
drivers/net/igb/igb_main.c
drivers/net/igbvf/netdev.c
drivers/net/irda/au1k_ir.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgbe/Makefile
drivers/net/ixgbe/ixgbe.h
drivers/net/ixgbe/ixgbe_82598.c
drivers/net/ixgbe/ixgbe_82599.c
drivers/net/ixgbe/ixgbe_common.c
drivers/net/ixgbe/ixgbe_common.h
drivers/net/ixgbe/ixgbe_dcb.c
drivers/net/ixgbe/ixgbe_dcb.h
drivers/net/ixgbe/ixgbe_dcb_82598.c
drivers/net/ixgbe/ixgbe_dcb_82598.h
drivers/net/ixgbe/ixgbe_dcb_82599.c
drivers/net/ixgbe/ixgbe_dcb_82599.h
drivers/net/ixgbe/ixgbe_dcb_nl.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_fcoe.c
drivers/net/ixgbe/ixgbe_fcoe.h
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbe/ixgbe_phy.c
drivers/net/ixgbe/ixgbe_phy.h
drivers/net/ixgbe/ixgbe_type.h
drivers/net/ks8851_mll.c
drivers/net/mace.c
drivers/net/macmace.c
drivers/net/macsonic.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/qlge/qlge_main.c
drivers/net/s2io.c
drivers/net/sfc/efx.c
drivers/net/sfc/falcon_boards.c
drivers/net/sfc/mcdi.c
drivers/net/sfc/mcdi.h
drivers/net/sfc/mcdi_pcol.h
drivers/net/sfc/mtd.c
drivers/net/sfc/qt202x_phy.c
drivers/net/sfc/selftest.c
drivers/net/sky2.c
drivers/net/starfire.c
drivers/net/tc35815.c
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/tulip/tulip_core.c
drivers/net/ucc_geth.c
drivers/net/usb/cdc_ether.c
drivers/net/via-velocity.c
drivers/net/virtio_net.c
drivers/net/wimax/i2400m/i2400m-usb.h
drivers/net/wimax/i2400m/usb.c
drivers/net/wireless/ath/ath5k/eeprom.c
drivers/net/wireless/ath/ath5k/eeprom.h
drivers/net/wireless/ath/ath9k/Kconfig
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/main.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-devtrace.c
drivers/net/wireless/iwlwifi/iwl-devtrace.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-tx.c
drivers/net/wireless/iwmc3200wifi/commands.c
drivers/net/wireless/iwmc3200wifi/commands.h
drivers/net/wireless/iwmc3200wifi/rx.c
drivers/net/wireless/mwl8k.c
drivers/net/wireless/p54/p54pci.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rtl818x/rtl8187_dev.c
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/wireless/zd1211rw/zd_usb.c
drivers/of/Kconfig
drivers/of/Makefile
drivers/of/base.c
drivers/of/fdt.c [new file with mode: 0644]
drivers/of/gpio.c
drivers/of/of_i2c.c
drivers/of/of_mdio.c
drivers/of/of_spi.c
drivers/pci/Kconfig
drivers/pci/Makefile
drivers/pci/bus.c
drivers/pci/hotplug/acpiphp_core.c
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/hotplug/cpcihp_generic.c
drivers/pci/hotplug/cpqphp.h
drivers/pci/hotplug/cpqphp_core.c
drivers/pci/hotplug/cpqphp_ctrl.c
drivers/pci/hotplug/ibmphp_core.c
drivers/pci/hotplug/ibmphp_ebda.c
drivers/pci/hotplug/ibmphp_hpc.c
drivers/pci/hotplug/pci_hotplug_core.c
drivers/pci/hotplug/pciehp_core.c
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/pciehp_hpc.c
drivers/pci/hotplug/pciehp_pci.c
drivers/pci/hotplug/rpaphp_core.c
drivers/pci/hotplug/shpchp.h
drivers/pci/hotplug/shpchp_core.c
drivers/pci/hotplug/shpchp_ctrl.c
drivers/pci/hotplug/shpchp_hpc.c
drivers/pci/hotplug/shpchp_sysfs.c
drivers/pci/legacy.c [deleted file]
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/Kconfig
drivers/pci/pcie/Makefile
drivers/pci/pcie/aer/aer_inject.c
drivers/pci/pcie/pme/Makefile [new file with mode: 0644]
drivers/pci/pcie/pme/pcie_pme.c [new file with mode: 0644]
drivers/pci/pcie/pme/pcie_pme.h [new file with mode: 0644]
drivers/pci/pcie/pme/pcie_pme_acpi.c [new file with mode: 0644]
drivers/pci/pcie/portdrv.h
drivers/pci/pcie/portdrv_core.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/probe.c
drivers/pci/quirks.c
drivers/pci/setup-bus.c
drivers/pci/slot.c
drivers/pcmcia/Kconfig
drivers/pcmcia/Makefile
drivers/pcmcia/at91_cf.c
drivers/pcmcia/au1000_db1x00.c [deleted file]
drivers/pcmcia/au1000_generic.c
drivers/pcmcia/au1000_generic.h
drivers/pcmcia/au1000_pb1x00.c
drivers/pcmcia/au1000_xxs1500.c [deleted file]
drivers/pcmcia/bfin_cf_pcmcia.c
drivers/pcmcia/cardbus.c
drivers/pcmcia/cistpl.c
drivers/pcmcia/cs.c
drivers/pcmcia/cs_internal.h
drivers/pcmcia/db1xxx_ss.c [new file with mode: 0644]
drivers/pcmcia/ds.c
drivers/pcmcia/electra_cf.c
drivers/pcmcia/i82365.h
drivers/pcmcia/m32r_cfc.c
drivers/pcmcia/m8xx_pcmcia.c
drivers/pcmcia/o2micro.h
drivers/pcmcia/omap_cf.c
drivers/pcmcia/pcmcia_ioctl.c
drivers/pcmcia/pcmcia_resource.c
drivers/pcmcia/rsrc_mgr.c
drivers/pcmcia/rsrc_nonstatic.c
drivers/pcmcia/socket_sysfs.c
drivers/pcmcia/xxs1500_ss.c [new file with mode: 0644]
drivers/pcmcia/yenta_socket.c
drivers/platform/x86/Kconfig
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/classmate-laptop.c
drivers/platform/x86/compal-laptop.c
drivers/platform/x86/dell-laptop.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/hp-wmi.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/power/wm97xx_battery.c
drivers/ps3/ps3av.c
drivers/regulator/core.c
drivers/regulator/lp3971.c
drivers/regulator/wm8350-regulator.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-fm3130.c
drivers/rtc/rtc-mpc5121.c [new file with mode: 0644]
drivers/s390/block/dasd.c
drivers/s390/block/dasd_devmap.c
drivers/s390/block/dasd_eckd.c
drivers/s390/block/dasd_genhd.c
drivers/s390/block/dasd_int.h
drivers/s390/block/dasd_ioctl.c
drivers/s390/block/dasd_proc.c
drivers/s390/char/con3215.c
drivers/s390/char/fs3270.c
drivers/s390/char/sclp_vt220.c
drivers/s390/char/tape_block.c
drivers/s390/char/tape_char.c
drivers/s390/char/vmcp.c
drivers/s390/char/zcore.c
drivers/s390/cio/ccwreq.c
drivers/s390/cio/chsc.c
drivers/s390/cio/chsc_sch.c
drivers/s390/cio/cio.c
drivers/s390/cio/crw.c
drivers/s390/cio/css.c
drivers/s390/cio/css.h
drivers/s390/cio/device.c
drivers/s390/cio/device.h
drivers/s390/cio/device_fsm.c
drivers/s390/cio/qdio.h
drivers/s390/cio/qdio_debug.c
drivers/s390/cio/qdio_main.c
drivers/s390/cio/qdio_setup.c
drivers/s390/cio/qdio_thinint.c
drivers/s390/crypto/zcrypt_api.c
drivers/s390/crypto/zcrypt_pcicc.c
drivers/s390/crypto/zcrypt_pcixcc.c
drivers/s390/kvm/kvm_virtio.c
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_ccw.c
drivers/s390/scsi/zfcp_cfdc.c
drivers/s390/scsi/zfcp_dbf.c
drivers/s390/scsi/zfcp_dbf.h
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_fc.c
drivers/s390/scsi/zfcp_fc.h
drivers/s390/scsi/zfcp_fsf.c
drivers/s390/scsi/zfcp_qdio.c
drivers/s390/scsi/zfcp_qdio.h [new file with mode: 0644]
drivers/s390/scsi/zfcp_reqlist.h [new file with mode: 0644]
drivers/s390/scsi/zfcp_scsi.c
drivers/s390/scsi/zfcp_sysfs.c
drivers/sbus/char/openprom.c
drivers/scsi/FlashPoint.c
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/commctrl.c
drivers/scsi/aacraid/comminit.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/dpcsup.c
drivers/scsi/aic7xxx/aic79xx_core.c
drivers/scsi/arm/fas216.c
drivers/scsi/be2iscsi/be.h
drivers/scsi/be2iscsi/be_cmds.c
drivers/scsi/be2iscsi/be_cmds.h
drivers/scsi/be2iscsi/be_iscsi.c
drivers/scsi/be2iscsi/be_iscsi.h
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_main.h
drivers/scsi/be2iscsi/be_mgmt.c
drivers/scsi/be2iscsi/be_mgmt.h
drivers/scsi/bnx2i/bnx2i_iscsi.c
drivers/scsi/constants.c
drivers/scsi/cxgb3i/cxgb3i_iscsi.c
drivers/scsi/cxgb3i/cxgb3i_offload.c
drivers/scsi/cxgb3i/cxgb3i_pdu.c
drivers/scsi/device_handler/scsi_dh_alua.c
drivers/scsi/eata.c
drivers/scsi/esp_scsi.c
drivers/scsi/fcoe/fcoe.c
drivers/scsi/fcoe/libfcoe.c
drivers/scsi/fnic/fnic.h
drivers/scsi/fnic/fnic_main.c
drivers/scsi/fnic/vnic_devcmd.h
drivers/scsi/gdth.c
drivers/scsi/gdth.h
drivers/scsi/gdth_ioctl.h
drivers/scsi/gdth_proc.c
drivers/scsi/gdth_proc.h
drivers/scsi/hosts.c
drivers/scsi/hpsa.c
drivers/scsi/hpsa.h
drivers/scsi/hpsa_cmd.h
drivers/scsi/ibmmca.c
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libfc/fc_exch.c
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c
drivers/scsi/libiscsi.c
drivers/scsi/libiscsi_tcp.c
drivers/scsi/libsrp.c
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/lpfc/lpfc_bsg.h [new file with mode: 0644]
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c [changed mode: 0755->0644]
drivers/scsi/lpfc/lpfc_hw.h
drivers/scsi/lpfc/lpfc_hw4.h [changed mode: 0755->0644]
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_mbox.c
drivers/scsi/lpfc/lpfc_nl.h
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_scsi.h
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli.h
drivers/scsi/lpfc/lpfc_sli4.h
drivers/scsi/lpfc/lpfc_version.h
drivers/scsi/lpfc/lpfc_vport.c
drivers/scsi/mac_esp.c
drivers/scsi/megaraid/megaraid_sas.c
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/mpt2sas/Kconfig
drivers/scsi/mpt2sas/mpi/mpi2.h
drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
drivers/scsi/mpt2sas/mpi/mpi2_history.txt
drivers/scsi/mpt2sas/mpi/mpi2_init.h
drivers/scsi/mpt2sas/mpi/mpi2_ioc.h
drivers/scsi/mpt2sas/mpi/mpi2_sas.h
drivers/scsi/mpt2sas/mpt2sas_base.c
drivers/scsi/mpt2sas/mpt2sas_base.h
drivers/scsi/mpt2sas/mpt2sas_config.c
drivers/scsi/mpt2sas/mpt2sas_ctl.c
drivers/scsi/mpt2sas/mpt2sas_scsih.c
drivers/scsi/mpt2sas/mpt2sas_transport.c
drivers/scsi/pm8001/pm8001_init.c
drivers/scsi/qla1280.c
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_fw.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/qla2xxx/qla_version.h
drivers/scsi/qla4xxx/ql4_init.c
drivers/scsi/raid_class.c
drivers/scsi/scsi.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_sas_internal.h
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_sas.c
drivers/scsi/sd.c
drivers/scsi/ses.c
drivers/scsi/u14-34f.c
drivers/scsi/vmw_pvscsi.c
drivers/serial/8250.c
drivers/serial/8250_pnp.c
drivers/serial/Kconfig
drivers/serial/imx.c
drivers/serial/mpc52xx_uart.c
drivers/serial/pmac_zilog.c
drivers/serial/pmac_zilog.h
drivers/serial/serial_core.c
drivers/serial/serial_cs.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
drivers/serial/uartlite.c
drivers/sh/intc.c
drivers/sh/pfc.c
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/au1550_spi.c
drivers/spi/coldfire_qspi.c [new file with mode: 0644]
drivers/spi/davinci_spi.c [new file with mode: 0644]
drivers/spi/dw_spi.c
drivers/spi/dw_spi_mmio.c [new file with mode: 0644]
drivers/spi/dw_spi_pci.c
drivers/spi/mpc52xx_psc_spi.c
drivers/spi/mpc52xx_spi.c
drivers/spi/spi_imx.c
drivers/spi/spi_mpc8xxx.c
drivers/spi/spi_ppc4xx.c
drivers/spi/spi_s3c64xx.c
drivers/spi/spi_sh_msiof.c
drivers/spi/spi_stmp.c
drivers/spi/xilinx_spi.c
drivers/spi/xilinx_spi_of.c
drivers/ssb/main.c
drivers/staging/Kconfig
drivers/staging/asus_oled/asus_oled.c
drivers/staging/cx25821/cx25821-medusa-video.c
drivers/staging/et131x/et1310_address_map.h
drivers/staging/et131x/et1310_rx.c
drivers/staging/go7007/s2250-board.c
drivers/staging/hv/Hv.c
drivers/staging/hv/Hv.h
drivers/staging/hv/Vmbus.c
drivers/staging/octeon/Makefile
drivers/staging/octeon/ethernet-defines.h
drivers/staging/octeon/ethernet-mdio.c
drivers/staging/octeon/ethernet-mdio.h
drivers/staging/octeon/ethernet-mem.c
drivers/staging/octeon/ethernet-proc.c [deleted file]
drivers/staging/octeon/ethernet-proc.h [deleted file]
drivers/staging/octeon/ethernet-rgmii.c
drivers/staging/octeon/ethernet-rx.c
drivers/staging/octeon/ethernet-rx.h
drivers/staging/octeon/ethernet-sgmii.c
drivers/staging/octeon/ethernet-spi.c
drivers/staging/octeon/ethernet-tx.c
drivers/staging/octeon/ethernet-tx.h
drivers/staging/octeon/ethernet-util.h
drivers/staging/octeon/ethernet-xaui.c
drivers/staging/octeon/ethernet.c
drivers/staging/octeon/octeon-ethernet.h
drivers/staging/sm7xx/smtc2d.c
drivers/staging/sm7xx/smtc2d.h
drivers/staging/sm7xx/smtcfb.c
drivers/staging/sm7xx/smtcfb.h
drivers/usb/core/devices.c
drivers/usb/core/devio.c
drivers/usb/core/driver.c
drivers/usb/core/endpoint.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/core/message.c
drivers/usb/core/sysfs.c
drivers/usb/gadget/f_eem.c
drivers/usb/gadget/multi.c
drivers/usb/gadget/r8a66597-udc.c
drivers/usb/gadget/s3c-hsotg.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci-q.c
drivers/usb/host/fhci-hcd.c
drivers/usb/host/fhci-tds.c
drivers/usb/host/isp1362-hcd.c
drivers/usb/host/isp1760-hcd.c
drivers/usb/host/r8a66597-hcd.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/uhci-hub.c
drivers/usb/misc/sisusbvga/sisusb.c
drivers/usb/otg/Kconfig
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio_ids.h
drivers/usb/serial/generic.c
drivers/usb/serial/sierra.c
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/usb.c
drivers/video/aty/aty128fb.c
drivers/video/aty/atyfb_base.c
drivers/video/aty/radeon_backlight.c
drivers/video/efifb.c
drivers/video/fsl-diu-fb.c
drivers/video/imxfb.c
drivers/video/macfb.c
drivers/video/macmodes.c
drivers/video/mx3fb.c
drivers/video/pvr2fb.c
drivers/video/s3c-fb.c
drivers/video/sh_mobile_lcdcfb.c
drivers/video/valkyriefb.c
drivers/video/valkyriefb.h
drivers/video/via/accel.c
drivers/video/via/viafbdev.c
drivers/virtio/virtio_balloon.c
drivers/virtio/virtio_pci.c
drivers/virtio/virtio_ring.c
drivers/watchdog/Kconfig
drivers/watchdog/ar7_wdt.c
drivers/watchdog/bfin_wdt.c
drivers/watchdog/iTCO_wdt.c
drivers/watchdog/ixp2000_wdt.c
drivers/watchdog/sbc_fitpc2_wdt.c
drivers/xen/manage.c
fs/9p/v9fs.c
fs/9p/v9fs_vfs.h
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/9p/vfs_super.c
fs/affs/affs.h
fs/affs/namei.c
fs/affs/super.c
fs/affs/symlink.c
fs/befs/linuxvfs.c
fs/bfs/inode.c
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/binfmt_flat.c
fs/binfmt_som.c
fs/bio-integrity.c
fs/bio.c
fs/block_dev.c
fs/btrfs/acl.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_map.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c
fs/btrfs/relocation.c
fs/btrfs/super.c
fs/btrfs/volumes.c
fs/cachefiles/namei.c
fs/cifs/CHANGES
fs/cifs/cifs_dfs_ref.c
fs/cifs/cifsfs.h
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/inode.c
fs/cifs/readdir.c
fs/cifs/sess.c
fs/compat_ioctl.c
fs/configfs/symlink.c
fs/debugfs/inode.c
fs/dlm/ast.c
fs/dlm/ast.h
fs/dlm/debug_fs.c
fs/dlm/dlm_internal.h
fs/dlm/lock.c
fs/dlm/lockspace.c
fs/dlm/user.c
fs/dlm/user.h
fs/ecryptfs/crypto.c
fs/ecryptfs/file.c
fs/ecryptfs/inode.c
fs/ecryptfs/main.c
fs/eventfd.c
fs/exec.c
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/inode.c
fs/fcntl.c
fs/file.c
fs/file_table.c
fs/fuse/file.c
fs/gfs2/bmap.c
fs/gfs2/glock.c
fs/gfs2/glock.h
fs/gfs2/incore.h
fs/gfs2/lock_dlm.c
fs/gfs2/ops_fstype.c
fs/gfs2/ops_inode.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/hppfs/hppfs.c
fs/namei.c
fs/namespace.c
fs/nfs/Kconfig
fs/nfs/direct.c
fs/nfs/file.c
fs/nfs/fscache.c
fs/nfs/inode.c
fs/nfs/mount_clnt.c
fs/nfs/nfs2xdr.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/nfs/nfs4state.c
fs/nfs/nfs4xdr.c
fs/nfs/pagelist.c
fs/nfs/super.c
fs/nfs/sysctl.c
fs/nfs/write.c
fs/nfsd/export.c
fs/nfsd/vfs.c
fs/nilfs2/segment.c
fs/notify/inotify/inotify_fsnotify.c
fs/notify/inotify/inotify_user.c
fs/ocfs2/aops.c
fs/ocfs2/buffer_head_io.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/tcp.c
fs/ocfs2/cluster/tcp_internal.h
fs/ocfs2/dlm/dlmapi.h
fs/ocfs2/dlm/dlmast.c
fs/ocfs2/dlm/dlmconvert.c
fs/ocfs2/dlm/dlmdebug.c
fs/ocfs2/dlm/dlmdomain.c
fs/ocfs2/dlm/dlmlock.c
fs/ocfs2/dlm/dlmmaster.c
fs/ocfs2/dlm/dlmrecovery.c
fs/ocfs2/dlm/dlmunlock.c
fs/ocfs2/dlmglue.c
fs/ocfs2/export.c
fs/ocfs2/extent_map.c
fs/ocfs2/file.c
fs/ocfs2/inode.c
fs/ocfs2/ioctl.c
fs/ocfs2/journal.c
fs/ocfs2/ocfs2.h
fs/ocfs2/ocfs2_fs.h
fs/ocfs2/refcounttree.c
fs/ocfs2/stack_o2cb.c
fs/ocfs2/super.c
fs/ocfs2/symlink.c
fs/ocfs2/uptodate.c
fs/proc/array.c
fs/proc/base.c
fs/proc/proc_devtree.c
fs/ramfs/file-nommu.c
fs/reiserfs/inode.c
fs/reiserfs/journal.c
fs/romfs/super.c
fs/sysfs/inode.c
fs/xfs/Makefile
fs/xfs/linux-2.6/kmem.c
fs/xfs/linux-2.6/kmem.h
fs/xfs/linux-2.6/xfs_acl.c
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_buf.h
fs/xfs/linux-2.6/xfs_fs_subr.c
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/linux-2.6/xfs_ioctl.h
fs/xfs/linux-2.6/xfs_ioctl32.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_lrw.c
fs/xfs/linux-2.6/xfs_lrw.h
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/linux-2.6/xfs_sync.h
fs/xfs/linux-2.6/xfs_trace.h
fs/xfs/linux-2.6/xfs_xattr.c
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/quota/xfs_dquot_item.h
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm_bhv.c
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/quota/xfs_trans_dquot.c
fs/xfs/xfs_acl.h
fs/xfs/xfs_ag.h
fs/xfs/xfs_alloc.c
fs/xfs/xfs_alloc_btree.c
fs/xfs/xfs_attr.c
fs/xfs/xfs_attr.h
fs/xfs/xfs_attr_leaf.c
fs/xfs/xfs_attr_sf.h
fs/xfs/xfs_bmap.c
fs/xfs/xfs_bmap_btree.c
fs/xfs/xfs_bmap_btree.h
fs/xfs/xfs_btree.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_da_btree.c
fs/xfs/xfs_da_btree.h
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dfrag.h
fs/xfs/xfs_dir2.c
fs/xfs/xfs_dir2.h
fs/xfs/xfs_dir2_block.c
fs/xfs/xfs_dir2_leaf.c
fs/xfs/xfs_dir2_node.c
fs/xfs/xfs_dir2_node.h
fs/xfs/xfs_dir2_sf.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_filestream.c
fs/xfs/xfs_filestream.h
fs/xfs/xfs_fsops.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_iget.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_inode_item.h
fs/xfs/xfs_itable.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log.h
fs/xfs/xfs_log_priv.h
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_log_recover.h
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_mru_cache.c
fs/xfs/xfs_mru_cache.h
fs/xfs/xfs_quota.h
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_rw.c
fs/xfs/xfs_rw.h
fs/xfs/xfs_trans.c
fs/xfs/xfs_trans.h
fs/xfs/xfs_trans_ail.c
fs/xfs/xfs_trans_buf.c
fs/xfs/xfs_types.h
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.h
include/acpi/acpi_bus.h
include/acpi/acpi_drivers.h
include/acpi/acpixf.h
include/acpi/actypes.h
include/acpi/platform/aclinux.h
include/crypto/md5.h [new file with mode: 0644]
include/crypto/pcrypt.h [new file with mode: 0644]
include/drm/drm_mode.h
include/drm/nouveau_drm.h
include/drm/ttm/ttm_bo_driver.h
include/drm/vmwgfx_drm.h
include/linux/acpi.h
include/linux/amba/bus.h
include/linux/ata.h
include/linux/binfmts.h
include/linux/bitops.h
include/linux/blkdev.h
include/linux/cgroup.h
include/linux/clocksource.h
include/linux/compiler.h
include/linux/connector.h
include/linux/cpumask.h
include/linux/cred.h
include/linux/device.h
include/linux/drbd.h
include/linux/drbd_nl.h
include/linux/elf.h
include/linux/eventfd.h
include/linux/fdtable.h
include/linux/firewire-cdev.h
include/linux/fs.h
include/linux/ftrace.h
include/linux/ftrace_event.h
include/linux/genhd.h
include/linux/hid.h
include/linux/highmem.h
include/linux/hw_breakpoint.h
include/linux/ima.h
include/linux/input.h
include/linux/iocontext.h
include/linux/ioport.h
include/linux/kernel.h
include/linux/kfifo.h
include/linux/kmsg_dump.h
include/linux/list.h
include/linux/lmb.h
include/linux/lockdep.h
include/linux/mfd/tmio.h
include/linux/mfd/wm8350/pmic.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/mtd/pismo.h [new file with mode: 0644]
include/linux/mtd/sh_flctl.h
include/linux/of.h
include/linux/of_fdt.h
include/linux/padata.h [new file with mode: 0644]
include/linux/pagemap.h
include/linux/pci-acpi.h
include/linux/pci.h
include/linux/pci_hotplug.h
include/linux/pci_ids.h
include/linux/percpu_counter.h
include/linux/perf_event.h
include/linux/pfkeyv2.h
include/linux/phy.h
include/linux/plist.h
include/linux/pm.h
include/linux/pm_runtime.h
include/linux/ptrace.h
include/linux/raid_class.h
include/linux/rculist.h
include/linux/rculist_nulls.h
include/linux/rcupdate.h
include/linux/rcutiny.h
include/linux/rcutree.h
include/linux/resume-trace.h
include/linux/rtnetlink.h
include/linux/sched.h
include/linux/serio.h
include/linux/sh_intc.h
include/linux/spi/ad7879.h
include/linux/spi/dw_spi.h
include/linux/srcu.h
include/linux/string.h
include/linux/syscalls.h
include/linux/timex.h
include/linux/topology.h
include/linux/tty.h
include/linux/usb.h
include/linux/videodev2.h
include/linux/virtio.h
include/linux/virtio_balloon.h
include/linux/virtio_blk.h
include/linux/virtio_console.h
include/media/davinci/isif.h [new file with mode: 0644]
include/media/davinci/vpss.h
include/media/ir-common.h
include/media/ir-core.h
include/media/ir-kbd-i2c.h
include/media/ov772x.h
include/media/saa7146_vv.h
include/media/soc_camera.h
include/media/timb_radio.h [new file with mode: 0644]
include/media/tuner.h
include/media/tvp7002.h [new file with mode: 0644]
include/media/tw9910.h
include/media/v4l2-chip-ident.h
include/media/v4l2-subdev.h
include/net/addrconf.h
include/net/ip.h
include/net/netns/conntrack.h
include/net/netns/ipv4.h
include/net/netns/xfrm.h
include/net/netrom.h
include/net/xfrm.h
include/pcmcia/ds.h
include/pcmcia/ss.h
include/scsi/scsi_bsg_fc.h
include/scsi/scsi_device.h
include/scsi/scsi_transport_sas.h
include/trace/events/lock.h
include/trace/ftrace.h
include/trace/syscall.h
include/video/sh_mobile_lcdc.h
init/Kconfig
init/main.c
ipc/shm.c
kernel/Makefile
kernel/cgroup.c
kernel/cpu.c
kernel/cred.c
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/futex_compat.c
kernel/hw_breakpoint.c
kernel/kexec.c
kernel/kfifo.c
kernel/kgdb.c
kernel/kprobes.c
kernel/ksysfs.c
kernel/kthread.c
kernel/lockdep.c
kernel/notifier.c
kernel/padata.c [new file with mode: 0644]
kernel/panic.c
kernel/perf_event.c
kernel/pid.c
kernel/posix-timers.c
kernel/power/Kconfig
kernel/power/main.c
kernel/power/snapshot.c
kernel/power/swap.c
kernel/power/swsusp.c [deleted file]
kernel/power/user.c
kernel/printk.c
kernel/ptrace.c
kernel/rcupdate.c
kernel/rcutorture.c
kernel/rcutree.c
kernel/rcutree.h
kernel/rcutree_plugin.h
kernel/rcutree_trace.c
kernel/resource.c
kernel/sched.c
kernel/sched_cpupri.c
kernel/sched_fair.c
kernel/sched_idletask.c
kernel/sched_rt.c
kernel/smp.c
kernel/softirq.c
kernel/softlockup.c
kernel/srcu.c
kernel/sys.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/ntp.c
kernel/time/timekeeping.c
kernel/timer.c
kernel/trace/Kconfig
kernel/trace/Makefile
kernel/trace/ftrace.c
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_branch.c
kernel/trace/trace_event_profile.c
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c
kernel/trace/trace_export.c
kernel/trace/trace_functions_graph.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_stack.c
kernel/trace/trace_syscalls.c
kernel/user.c
lib/Kconfig.debug
lib/debug_locks.c
lib/dma-debug.c
lib/hweight.c
lib/idr.c
lib/lmb.c
lib/radix-tree.c
lib/string.c
lib/zlib_inflate/inffast.c
mm/Kconfig
mm/filemap.c
mm/hugetlb.c
mm/memcontrol.c
mm/migrate.c
mm/nommu.c
mm/oom_kill.c
mm/page_alloc.c
mm/truncate.c
mm/util.c
mm/vmalloc.c
mm/vmscan.c
net/8021q/vlan_dev.c
net/9p/client.c
net/9p/trans_fd.c
net/9p/trans_rdma.c
net/9p/trans_virtio.c
net/appletalk/aarp.c
net/ax25/ax25_out.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_event.c
net/bluetooth/hidp/core.c
net/bluetooth/hidp/hidp.h
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/core.c
net/core/dev.c
net/core/dst.c
net/core/ethtool.c
net/core/filter.c
net/core/net-sysfs.c
net/core/pktgen.c
net/core/rtnetlink.c
net/core/sock.c
net/dccp/ccid.c
net/dccp/ccid.h
net/dccp/probe.c
net/decnet/dn_route.c
net/ipv4/devinet.c
net/ipv4/igmp.c
net/ipv4/inet_diag.c
net/ipv4/ipcomp.c
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/ipv4/netfilter/nf_nat_core.c
net/ipv4/route.c
net/ipv4/tcp_input.c
net/ipv4/tcp_probe.c
net/ipv4/xfrm4_policy.c
net/ipv6/addrconf.c
net/ipv6/exthdrs.c
net/ipv6/ipcomp6.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/xfrm6_policy.c
net/irda/irnet/irnet_ppp.c
net/key/af_key.c
net/mac80211/cfg.c
net/mac80211/driver-trace.h
net/mac80211/ibss.c
net/mac80211/iface.c
net/mac80211/mlme.c
net/mac80211/rate.c
net/mac80211/rc80211_pid_algo.c
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/tx.c
net/mac80211/util.c
net/mac80211/wme.c
net/mac80211/wme.h
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_sip.c
net/netfilter/nf_conntrack_standalone.c
net/netlink/af_netlink.c
net/netrom/nr_route.c
net/packet/af_packet.c
net/rose/rose_link.c
net/rose/rose_route.c
net/sched/Kconfig
net/wireless/core.c
net/wireless/reg.c
net/wireless/sme.c
net/xfrm/xfrm_algo.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/.gitignore
scripts/Makefile.lib
scripts/binoffset.c [deleted file]
scripts/extract-ikconfig
scripts/get_maintainer.pl
scripts/kconfig/Makefile
scripts/kconfig/streamline_config.pl
scripts/kernel-doc
scripts/markup_oops.pl
scripts/mod/file2alias.c
scripts/recordmcount.pl
security/inode.c
security/integrity/ima/ima.h
security/integrity/ima/ima_api.c
security/integrity/ima/ima_iint.c
security/integrity/ima/ima_main.c
security/integrity/ima/ima_policy.c
security/keys/gc.c
security/keys/keyring.c
security/security.c
security/selinux/ss/ebitmap.c
security/tomoyo/tomoyo.c
sound/aoa/fabrics/layout.c
sound/core/sound.c
sound/core/sound_oss.c
sound/oss/au1550_ac97.c
sound/pci/ctxfi/ctatc.c
sound/pci/ctxfi/ctvmem.c
sound/pci/ctxfi/ctvmem.h
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/ice1712/aureon.c
sound/ppc/awacs.c
sound/ppc/burgundy.c
sound/ppc/pmac.c
sound/soc/au1x/Kconfig
sound/soc/au1x/Makefile
sound/soc/au1x/db1200.c [new file with mode: 0644]
sound/soc/au1x/dbdma2.c
sound/soc/au1x/sample-ac97.c [deleted file]
sound/soc/codecs/tlv320aic23.c
sound/soc/codecs/wm8903.c
sound/soc/fsl/efika-audio-fabric.c
sound/soc/fsl/pcm030-audio-fabric.c
sound/soc/omap/Makefile
sound/soc/omap/omap3pandora.c
sound/sound_core.c
tools/perf/.gitignore
tools/perf/Documentation/perf-archive.txt [new file with mode: 0644]
tools/perf/Documentation/perf-buildid-cache.txt [new file with mode: 0644]
tools/perf/Documentation/perf-probe.txt
tools/perf/Documentation/perf-top.txt
tools/perf/Documentation/perf-trace-perl.txt
tools/perf/Documentation/perf-trace-python.txt [new file with mode: 0644]
tools/perf/Documentation/perf-trace.txt
tools/perf/Documentation/perf.txt
tools/perf/Makefile
tools/perf/builtin-annotate.c
tools/perf/builtin-buildid-cache.c [new file with mode: 0644]
tools/perf/builtin-buildid-list.c
tools/perf/builtin-diff.c
tools/perf/builtin-help.c
tools/perf/builtin-kmem.c
tools/perf/builtin-lock.c [new file with mode: 0644]
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-stat.c
tools/perf/builtin-timechart.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/builtin.h
tools/perf/command-list.txt
tools/perf/design.txt
tools/perf/perf-archive.sh [new file with mode: 0644]
tools/perf/perf.c
tools/perf/scripts/perl/Perf-Trace-Util/Context.c
tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm
tools/perf/scripts/perl/bin/check-perf-trace-record
tools/perf/scripts/perl/bin/check-perf-trace-report [deleted file]
tools/perf/scripts/perl/bin/failed-syscalls-record [new file with mode: 0644]
tools/perf/scripts/perl/bin/failed-syscalls-report [new file with mode: 0644]
tools/perf/scripts/perl/failed-syscalls.pl [new file with mode: 0644]
tools/perf/scripts/python/Perf-Trace-Util/Context.c [new file with mode: 0644]
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py [new file with mode: 0644]
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py [new file with mode: 0644]
tools/perf/scripts/python/bin/failed-syscalls-by-pid-record [new file with mode: 0644]
tools/perf/scripts/python/bin/failed-syscalls-by-pid-report [new file with mode: 0644]
tools/perf/scripts/python/bin/syscall-counts-by-pid-record [new file with mode: 0644]
tools/perf/scripts/python/bin/syscall-counts-by-pid-report [new file with mode: 0644]
tools/perf/scripts/python/bin/syscall-counts-record [new file with mode: 0644]
tools/perf/scripts/python/bin/syscall-counts-report [new file with mode: 0644]
tools/perf/scripts/python/check-perf-trace.py [new file with mode: 0644]
tools/perf/scripts/python/failed-syscalls-by-pid.py [new file with mode: 0644]
tools/perf/scripts/python/syscall-counts-by-pid.py [new file with mode: 0644]
tools/perf/scripts/python/syscall-counts.py [new file with mode: 0644]
tools/perf/util/build-id.c [new file with mode: 0644]
tools/perf/util/build-id.h [new file with mode: 0644]
tools/perf/util/data_map.c [deleted file]
tools/perf/util/debug.c
tools/perf/util/debugfs.c
tools/perf/util/debugfs.h
tools/perf/util/event.c
tools/perf/util/event.h
tools/perf/util/header.c
tools/perf/util/header.h
tools/perf/util/include/linux/hash.h [new file with mode: 0644]
tools/perf/util/include/linux/kernel.h
tools/perf/util/map.c
tools/perf/util/map.h [new file with mode: 0644]
tools/perf/util/parse-events.c
tools/perf/util/probe-event.c
tools/perf/util/probe-event.h
tools/perf/util/probe-finder.c
tools/perf/util/probe-finder.h
tools/perf/util/scripting-engines/trace-event-perl.c [moved from tools/perf/util/trace-event-perl.c with 85% similarity]
tools/perf/util/scripting-engines/trace-event-python.c [new file with mode: 0644]
tools/perf/util/session.c
tools/perf/util/session.h
tools/perf/util/string.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/perf/util/thread.c
tools/perf/util/thread.h
tools/perf/util/trace-event-info.c
tools/perf/util/trace-event-parse.c
tools/perf/util/trace-event-perl.h [deleted file]
tools/perf/util/trace-event-read.c
tools/perf/util/trace-event-scripting.c [new file with mode: 0644]
tools/perf/util/trace-event.h
tools/perf/util/util.c [new file with mode: 0644]
tools/perf/util/util.h
tools/perf/util/values.c
virt/kvm/eventfd.c
virt/kvm/irq_comm.c

index 6434f0df012e3cd72d8e373bc30c406b7f0b3873..6cd6daefaaedeb160a6f1ac1d616de7871b38965 100644 (file)
@@ -20,7 +20,7 @@ Description:
                        lsm:    [[subj_user=] [subj_role=] [subj_type=]
                                 [obj_user=] [obj_role=] [obj_type=]]
 
-               base:   func:= [BPRM_CHECK][FILE_MMAP][INODE_PERMISSION]
+               base:   func:= [BPRM_CHECK][FILE_MMAP][FILE_CHECK]
                        mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC]
                        fsmagic:= hex value
                        uid:= decimal value
@@ -40,11 +40,11 @@ Description:
 
                        measure func=BPRM_CHECK
                        measure func=FILE_MMAP mask=MAY_EXEC
-                       measure func=INODE_PERM mask=MAY_READ uid=0
+                       measure func=FILE_CHECK mask=MAY_READ uid=0
 
                The default policy measures all executables in bprm_check,
                all files mmapped executable in file_mmap, and all files
-               open for read by root in inode_permission.
+               open for read by root in do_filp_open.
 
                Examples of LSM specific definitions:
 
@@ -54,8 +54,8 @@ Description:
 
                        dont_measure obj_type=var_log_t
                        dont_measure obj_type=auditd_log_t
-                       measure subj_user=system_u func=INODE_PERM mask=MAY_READ
-                       measure subj_role=system_r func=INODE_PERM mask=MAY_READ
+                       measure subj_user=system_u func=FILE_CHECK mask=MAY_READ
+                       measure subj_role=system_r func=FILE_CHECK mask=MAY_READ
 
                Smack:
-                       measure subj_user=_ func=INODE_PERM mask=MAY_READ
+                       measure subj_user=_ func=FILE_CHECK mask=MAY_READ
diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power
new file mode 100644 (file)
index 0000000..6123c52
--- /dev/null
@@ -0,0 +1,79 @@
+What:          /sys/devices/.../power/
+Date:          January 2009
+Contact:       Rafael J. Wysocki <rjw@sisk.pl>
+Description:
+               The /sys/devices/.../power directory contains attributes
+               allowing the user space to check and modify some power
+               management related properties of given device.
+
+What:          /sys/devices/.../power/wakeup
+Date:          January 2009
+Contact:       Rafael J. Wysocki <rjw@sisk.pl>
+Description:
+               The /sys/devices/.../power/wakeup attribute allows the user
+               space to check if the device is enabled to wake up the system
+               from sleep states, such as the memory sleep state (suspend to
+               RAM) and hibernation (suspend to disk), and to enable or disable
+               it to do that as desired.
+
+               Some devices support "wakeup" events, which are hardware signals
+               used to activate the system from a sleep state.  Such devices
+               have one of the following two values for the sysfs power/wakeup
+               file:
+
+               + "enabled\n" to issue the events;
+               + "disabled\n" not to do so;
+
+               In that cases the user space can change the setting represented
+               by the contents of this file by writing either "enabled", or
+               "disabled" to it.
+
+               For the devices that are not capable of generating system wakeup
+               events this file contains "\n".  In that cases the user space
+               cannot modify the contents of this file and the device cannot be
+               enabled to wake up the system.
+
+What:          /sys/devices/.../power/control
+Date:          January 2009
+Contact:       Rafael J. Wysocki <rjw@sisk.pl>
+Description:
+               The /sys/devices/.../power/control attribute allows the user
+               space to control the run-time power management of the device.
+
+               All devices have one of the following two values for the
+               power/control file:
+
+               + "auto\n" to allow the device to be power managed at run time;
+               + "on\n" to prevent the device from being power managed;
+
+               The default for all devices is "auto", which means that they may
+               be subject to automatic power management, depending on their
+               drivers.  Changing this attribute to "on" prevents the driver
+               from power managing the device at run time.  Doing that while
+               the device is suspended causes it to be woken up.
+
+What:          /sys/devices/.../power/async
+Date:          January 2009
+Contact:       Rafael J. Wysocki <rjw@sisk.pl>
+Description:
+               The /sys/devices/.../async attribute allows the user space to
+               enable or diasble the device's suspend and resume callbacks to
+               be executed asynchronously (ie. in separate threads, in parallel
+               with the main suspend/resume thread) during system-wide power
+               transitions (eg. suspend to RAM, hibernation).
+
+               All devices have one of the following two values for the
+               power/async file:
+
+               + "enabled\n" to permit the asynchronous suspend/resume;
+               + "disabled\n" to forbid it;
+
+               The value of this attribute may be changed by writing either
+               "enabled", or "disabled" to it.
+
+               It generally is unsafe to permit the asynchronous suspend/resume
+               of a device unless it is certain that all of the PM dependencies
+               of the device are known to the PM core.  However, for some
+               devices this attribute is set to "enabled" by bus type code or
+               device drivers and in that cases it should be safe to leave the
+               default value.
index dcff4d0623add0e7708c642d0cfe210b0c1f48ab..d6a801f45b484e4df433ff09e85a6f3bc07707d5 100644 (file)
@@ -101,3 +101,16 @@ Description:
 
                CAUTION: Using it will cause your machine's real-time (CMOS)
                clock to be set to a random invalid time after a resume.
+
+What:          /sys/power/pm_async
+Date:          January 2009
+Contact:       Rafael J. Wysocki <rjw@sisk.pl>
+Description:
+               The /sys/power/pm_async file controls the switch allowing the
+               user space to enable or disable asynchronous suspend and resume
+               of devices.  If enabled, this feature will cause some device
+               drivers' suspend and resume callbacks to be executed in parallel
+               with each other and with the main suspend thread.  It is enabled
+               if this file contains "1", which is the default.  It may be
+               disabled by writing "0" to this file, in which case all devices
+               will be suspended and resumed synchronously.
index f92f24323b2aad000a4f6890368c03aec5dcaf7b..e870330cbf772fc757f5c6400ed4cfb61ed72486 100644 (file)
@@ -589,7 +589,8 @@ number of a video input as in &v4l2-input; field
            <entry></entry>
            <entry>A place holder for future extensions and custom
 (driver defined) buffer types
-<constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher.</entry>
+<constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher. Applications
+should set this to 0.</entry>
          </row>
        </tbody>
       </tgroup>
index 1870817781548b409889d9ed93220cb26162ec74..b843bd7b389735725bd7d68954560509efe5cc41 100644 (file)
@@ -54,12 +54,10 @@ to enqueue an empty (capturing) or filled (output) buffer in the
 driver's incoming queue. The semantics depend on the selected I/O
 method.</para>
 
-    <para>To enqueue a <link linkend="mmap">memory mapped</link>
-buffer applications set the <structfield>type</structfield> field of a
-&v4l2-buffer; to the same buffer type as previously &v4l2-format;
-<structfield>type</structfield> and &v4l2-requestbuffers;
-<structfield>type</structfield>, the <structfield>memory</structfield>
-field to <constant>V4L2_MEMORY_MMAP</constant> and the
+    <para>To enqueue a buffer applications set the <structfield>type</structfield>
+field of a &v4l2-buffer; to the same buffer type as was previously used
+with &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers;
+<structfield>type</structfield>. Applications must also set the
 <structfield>index</structfield> field. Valid index numbers range from
 zero to the number of buffers allocated with &VIDIOC-REQBUFS;
 (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. The
@@ -70,8 +68,19 @@ intended for output (<structfield>type</structfield> is
 <constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant>) applications must also
 initialize the <structfield>bytesused</structfield>,
 <structfield>field</structfield> and
-<structfield>timestamp</structfield> fields. See <xref
-       linkend="buffer" /> for details. When
+<structfield>timestamp</structfield> fields, see <xref
+linkend="buffer" /> for details.
+Applications must also set <structfield>flags</structfield> to 0. If a driver
+supports capturing from specific video inputs and you want to specify a video
+input, then <structfield>flags</structfield> should be set to
+<constant>V4L2_BUF_FLAG_INPUT</constant> and the field
+<structfield>input</structfield> must be initialized to the desired input.
+The <structfield>reserved</structfield> field must be set to 0.
+</para>
+
+    <para>To enqueue a <link linkend="mmap">memory mapped</link>
+buffer applications set the <structfield>memory</structfield>
+field to <constant>V4L2_MEMORY_MMAP</constant>. When
 <constant>VIDIOC_QBUF</constant> is called with a pointer to this
 structure the driver sets the
 <constant>V4L2_BUF_FLAG_MAPPED</constant> and
@@ -81,14 +90,10 @@ structure the driver sets the
 &EINVAL;.</para>
 
     <para>To enqueue a <link linkend="userp">user pointer</link>
-buffer applications set the <structfield>type</structfield> field of a
-&v4l2-buffer; to the same buffer type as previously &v4l2-format;
-<structfield>type</structfield> and &v4l2-requestbuffers;
-<structfield>type</structfield>, the <structfield>memory</structfield>
-field to <constant>V4L2_MEMORY_USERPTR</constant> and the
+buffer applications set the <structfield>memory</structfield>
+field to <constant>V4L2_MEMORY_USERPTR</constant>, the
 <structfield>m.userptr</structfield> field to the address of the
-buffer and <structfield>length</structfield> to its size. When the
-buffer is intended for output additional fields must be set as above.
+buffer and <structfield>length</structfield> to its size.
 When <constant>VIDIOC_QBUF</constant> is called with a pointer to this
 structure the driver sets the <constant>V4L2_BUF_FLAG_QUEUED</constant>
 flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and
@@ -96,13 +101,14 @@ flag and clears the <constant>V4L2_BUF_FLAG_MAPPED</constant> and
 <structfield>flags</structfield> field, or it returns an error code.
 This ioctl locks the memory pages of the buffer in physical memory,
 they cannot be swapped out to disk. Buffers remain locked until
-dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl are
+dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is
 called, or until the device is closed.</para>
 
     <para>Applications call the <constant>VIDIOC_DQBUF</constant>
 ioctl to dequeue a filled (capturing) or displayed (output) buffer
 from the driver's outgoing queue. They just set the
-<structfield>type</structfield> and <structfield>memory</structfield>
+<structfield>type</structfield>, <structfield>memory</structfield>
+and <structfield>reserved</structfield>
 fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant>
 is called with a pointer to this structure the driver fills the
 remaining fields or returns an error code.</para>
index d834993e619172df3dae1f2b05495034c7ce1c73..e649805a4908838d2f4028099a8aa24a234c6db7 100644 (file)
@@ -54,12 +54,13 @@ buffer at any time after buffers have been allocated with the
 &VIDIOC-REQBUFS; ioctl.</para>
 
     <para>Applications set the <structfield>type</structfield> field
-    of a &v4l2-buffer; to the same buffer type as previously
+    of a &v4l2-buffer; to the same buffer type as was previously used with
 &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers;
 <structfield>type</structfield>, and the <structfield>index</structfield>
     field. Valid index numbers range from zero
 to the number of buffers allocated with &VIDIOC-REQBUFS;
     (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.
+The <structfield>reserved</structfield> field should to set to 0.
 After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to
     this structure drivers return an error code or fill the rest of
 the structure.</para>
@@ -68,8 +69,8 @@ the structure.</para>
 <constant>V4L2_BUF_FLAG_MAPPED</constant>,
 <constant>V4L2_BUF_FLAG_QUEUED</constant> and
 <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The
-<structfield>memory</structfield> field will be set to
-<constant>V4L2_MEMORY_MMAP</constant>, the <structfield>m.offset</structfield>
+<structfield>memory</structfield> field will be set to the current
+I/O method, the <structfield>m.offset</structfield>
 contains the offset of the buffer from the start of the device memory,
 the <structfield>length</structfield> field its size. The driver may
 or may not set the remaining fields and flags, they are meaningless in
index bab38084454fd0370985a72ff9cd44b4c457bfa0..1c08163720741d7f5fc081f8e0681e957fec0232 100644 (file)
@@ -54,23 +54,23 @@ I/O. Memory mapped buffers are located in device memory and must be
 allocated with this ioctl before they can be mapped into the
 application's address space. User buffers are allocated by
 applications themselves, and this ioctl is merely used to switch the
-driver into user pointer I/O mode.</para>
+driver into user pointer I/O mode and to setup some internal structures.</para>
 
-    <para>To allocate device buffers applications initialize three
-fields of a <structname>v4l2_requestbuffers</structname> structure.
+    <para>To allocate device buffers applications initialize all
+fields of the <structname>v4l2_requestbuffers</structname> structure.
 They set the <structfield>type</structfield> field to the respective
 stream or buffer type, the <structfield>count</structfield> field to
-the desired number of buffers, and <structfield>memory</structfield>
-must be set to <constant>V4L2_MEMORY_MMAP</constant>. When the ioctl
-is called with a pointer to this structure the driver attempts to
-allocate the requested number of buffers and stores the actual number
+the desired number of buffers, <structfield>memory</structfield>
+must be set to the requested I/O method and the reserved array
+must be zeroed. When the ioctl
+is called with a pointer to this structure the driver will attempt to allocate
+the requested number of buffers and it stores the actual number
 allocated in the <structfield>count</structfield> field. It can be
 smaller than the number requested, even zero, when the driver runs out
-of free memory. A larger number is possible when the driver requires
-more buffers to function correctly.<footnote>
-       <para>For example video output requires at least two buffers,
+of free memory. A larger number is also possible when the driver requires
+more buffers to function correctly. For example video output requires at least two buffers,
 one displayed and one filled by the application.</para>
-       </footnote> When memory mapping I/O is not supported the ioctl
+    <para>When the I/O method is not supported the ioctl
 returns an &EINVAL;.</para>
 
     <para>Applications can call <constant>VIDIOC_REQBUFS</constant>
@@ -81,14 +81,6 @@ in progress, an implicit &VIDIOC-STREAMOFF;. <!-- mhs: I see no
 reason why munmap()ping one or even all buffers must imply
 streamoff.--></para>
 
-    <para>To negotiate user pointer I/O, applications initialize only
-the <structfield>type</structfield> field and set
-<structfield>memory</structfield> to
-<constant>V4L2_MEMORY_USERPTR</constant>. When the ioctl is called
-with a pointer to this structure the driver prepares for user pointer
-I/O, when this I/O method is not supported the ioctl returns an
-&EINVAL;.</para>
-
     <table pgwide="1" frame="none" id="v4l2-requestbuffers">
       <title>struct <structname>v4l2_requestbuffers</structname></title>
       <tgroup cols="3">
@@ -97,9 +89,7 @@ I/O, when this I/O method is not supported the ioctl returns an
          <row>
            <entry>__u32</entry>
            <entry><structfield>count</structfield></entry>
-           <entry>The number of buffers requested or granted. This
-field is only used when <structfield>memory</structfield> is set to
-<constant>V4L2_MEMORY_MMAP</constant>.</entry>
+           <entry>The number of buffers requested or granted.</entry>
          </row>
          <row>
            <entry>&v4l2-buf-type;</entry>
@@ -120,7 +110,7 @@ as the &v4l2-format; <structfield>type</structfield> field. See <xref
            <entry><structfield>reserved</structfield>[2]</entry>
            <entry>A place holder for future extensions and custom
 (driver defined) buffer types <constant>V4L2_BUF_TYPE_PRIVATE</constant> and
-higher.</entry>
+higher. This array should be zeroed by applications.</entry>
          </row>
        </tbody>
       </tgroup>
index 9bb62f7b89c3ebaa7375a2fd8c79f65a34674c27..71b6f500ddb9ae3914ba8f31988470c4d8cb8d3c 100644 (file)
@@ -6,16 +6,22 @@ checklist.txt
        - Review Checklist for RCU Patches
 listRCU.txt
        - Using RCU to Protect Read-Mostly Linked Lists
+lockdep.txt
+       - RCU and lockdep checking
 NMI-RCU.txt
        - Using RCU to Protect Dynamic NMI Handlers
+rcubarrier.txt
+       - RCU and Unloadable Modules
+rculist_nulls.txt
+       - RCU list primitives for use with SLAB_DESTROY_BY_RCU
 rcuref.txt
        - Reference-count design for elements of lists/arrays protected by RCU
 rcu.txt
        - RCU Concepts
-rcubarrier.txt
-       - Unloading modules that use RCU callbacks
 RTFP.txt
        - List of RCU papers (bibliography) going back to 1980.
+stallwarn.txt
+       - RCU CPU stall warnings (CONFIG_RCU_CPU_STALL_DETECTOR)
 torture.txt
        - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST)
 trace.txt
index d2b85237c76e9cd4527f66bc5ffef3d40273e6c3..5aea459e3dd6cbbfa87ad224f0faec570ed77875 100644 (file)
@@ -25,10 +25,10 @@ to be referencing the data structure.  However, this mechanism was not
 optimized for modern computer systems, which is not surprising given
 that these overheads were not so expensive in the mid-80s.  Nonetheless,
 passive serialization appears to be the first deferred-destruction
-mechanism to be used in production.  Furthermore, the relevant patent has
-lapsed, so this approach may be used in non-GPL software, if desired.
-(In contrast, use of RCU is permitted only in software licensed under
-GPL.  Sorry!!!)
+mechanism to be used in production.  Furthermore, the relevant patent
+has lapsed, so this approach may be used in non-GPL software, if desired.
+(In contrast, implementation of RCU is permitted only in software licensed
+under either GPL or LGPL.  Sorry!!!)
 
 In 1990, Pugh [Pugh90] noted that explicitly tracking which threads
 were reading a given data structure permitted deferred free to operate
@@ -150,6 +150,18 @@ preemptible RCU [PaulEMcKenney2007PreemptibleRCU], and the three-part
 LWN "What is RCU?" series [PaulEMcKenney2007WhatIsRCUFundamentally,
 PaulEMcKenney2008WhatIsRCUUsage, and PaulEMcKenney2008WhatIsRCUAPI].
 
+2008 saw a journal paper on real-time RCU [DinakarGuniguntala2008IBMSysJ],
+a history of how Linux changed RCU more than RCU changed Linux
+[PaulEMcKenney2008RCUOSR], and a design overview of hierarchical RCU
+[PaulEMcKenney2008HierarchicalRCU].
+
+2009 introduced user-level RCU algorithms [PaulEMcKenney2009MaliciousURCU],
+which Mathieu Desnoyers is now maintaining [MathieuDesnoyers2009URCU]
+[MathieuDesnoyersPhD].  TINY_RCU [PaulEMcKenney2009BloatWatchRCU] made
+its appearance, as did expedited RCU [PaulEMcKenney2009expeditedRCU].
+The problem of resizeable RCU-protected hash tables may now be on a path
+to a solution [JoshTriplett2009RPHash].
+
 Bibtex Entries
 
 @article{Kung80
@@ -730,6 +742,11 @@ Revised:
 "
 }
 
+#
+#      "What is RCU?" LWN series.
+#
+########################################################################
+
 @article{DinakarGuniguntala2008IBMSysJ
 ,author="D. Guniguntala and P. E. McKenney and J. Triplett and J. Walpole"
 ,title="The read-copy-update mechanism for supporting real-time applications on shared-memory multiprocessor systems with {Linux}"
@@ -820,3 +837,39 @@ Revised:
        Uniprocessor assumptions allow simplified RCU implementation.
 "
 }
+
+@unpublished{PaulEMcKenney2009expeditedRCU
+,Author="Paul E. McKenney"
+,Title="[{PATCH} -tip 0/3] expedited 'big hammer' {RCU} grace periods"
+,month="June"
+,day="25"
+,year="2009"
+,note="Available:
+\url{http://lkml.org/lkml/2009/6/25/306}
+[Viewed August 16, 2009]"
+,annotation="
+       First posting of expedited RCU to be accepted into -tip.
+"
+}
+
+@unpublished{JoshTriplett2009RPHash
+,Author="Josh Triplett"
+,Title="Scalable concurrent hash tables via relativistic programming"
+,month="September"
+,year="2009"
+,note="Linux Plumbers Conference presentation"
+,annotation="
+       RP fun with hash tables.
+"
+}
+
+@phdthesis{MathieuDesnoyersPhD
+, title  = "Low-Impact Operating System Tracing"
+, author = "Mathieu Desnoyers"
+, school = "Ecole Polytechnique de Montr\'{e}al"
+, month  = "December"
+, year   = 2009
+,note="Available:
+\url{http://www.lttng.org/pub/thesis/desnoyers-dissertation-2009-12.pdf}
+[Viewed December 9, 2009]"
+}
index 51525a30e8b4015d9c1ca8c3866b274a6a5874f3..cbc180f90194fcb01bc273f8b953d91b28a79fae 100644 (file)
@@ -8,13 +8,12 @@ would cause.  This list is based on experiences reviewing such patches
 over a rather long period of time, but improvements are always welcome!
 
 0.     Is RCU being applied to a read-mostly situation?  If the data
-       structure is updated more than about 10% of the time, then
-       you should strongly consider some other approach, unless
-       detailed performance measurements show that RCU is nonetheless
-       the right tool for the job.  Yes, you might think of RCU
-       as simply cutting overhead off of the readers and imposing it
-       on the writers.  That is exactly why normal uses of RCU will
-       do much more reading than updating.
+       structure is updated more than about 10% of the time, then you
+       should strongly consider some other approach, unless detailed
+       performance measurements show that RCU is nonetheless the right
+       tool for the job.  Yes, RCU does reduce read-side overhead by
+       increasing write-side overhead, which is exactly why normal uses
+       of RCU will do much more reading than updating.
 
        Another exception is where performance is not an issue, and RCU
        provides a simpler implementation.  An example of this situation
@@ -35,13 +34,13 @@ over a rather long period of time, but improvements are always welcome!
 
        If you choose #b, be prepared to describe how you have handled
        memory barriers on weakly ordered machines (pretty much all of
-       them -- even x86 allows reads to be reordered), and be prepared
-       to explain why this added complexity is worthwhile.  If you
-       choose #c, be prepared to explain how this single task does not
-       become a major bottleneck on big multiprocessor machines (for
-       example, if the task is updating information relating to itself
-       that other tasks can read, there by definition can be no
-       bottleneck).
+       them -- even x86 allows later loads to be reordered to precede
+       earlier stores), and be prepared to explain why this added
+       complexity is worthwhile.  If you choose #c, be prepared to
+       explain how this single task does not become a major bottleneck on
+       big multiprocessor machines (for example, if the task is updating
+       information relating to itself that other tasks can read, there
+       by definition can be no bottleneck).
 
 2.     Do the RCU read-side critical sections make proper use of
        rcu_read_lock() and friends?  These primitives are needed
@@ -51,8 +50,10 @@ over a rather long period of time, but improvements are always welcome!
        actuarial risk of your kernel.
 
        As a rough rule of thumb, any dereference of an RCU-protected
-       pointer must be covered by rcu_read_lock() or rcu_read_lock_bh()
-       or by the appropriate update-side lock.
+       pointer must be covered by rcu_read_lock(), rcu_read_lock_bh(),
+       rcu_read_lock_sched(), or by the appropriate update-side lock.
+       Disabling of preemption can serve as rcu_read_lock_sched(), but
+       is less readable.
 
 3.     Does the update code tolerate concurrent accesses?
 
@@ -62,25 +63,27 @@ over a rather long period of time, but improvements are always welcome!
        of ways to handle this concurrency, depending on the situation:
 
        a.      Use the RCU variants of the list and hlist update
-               primitives to add, remove, and replace elements on an
-               RCU-protected list.  Alternatively, use the RCU-protected
-               trees that have been added to the Linux kernel.
+               primitives to add, remove, and replace elements on
+               an RCU-protected list.  Alternatively, use the other
+               RCU-protected data structures that have been added to
+               the Linux kernel.
 
                This is almost always the best approach.
 
        b.      Proceed as in (a) above, but also maintain per-element
                locks (that are acquired by both readers and writers)
                that guard per-element state.  Of course, fields that
-               the readers refrain from accessing can be guarded by the
-               update-side lock.
+               the readers refrain from accessing can be guarded by
+               some other lock acquired only by updaters, if desired.
 
                This works quite well, also.
 
        c.      Make updates appear atomic to readers.  For example,
-               pointer updates to properly aligned fields will appear
-               atomic, as will individual atomic primitives.  Operations
-               performed under a lock and sequences of multiple atomic
-               primitives will -not- appear to be atomic.
+               pointer updates to properly aligned fields will
+               appear atomic, as will individual atomic primitives.
+               Sequences of perations performed under a lock will -not-
+               appear to be atomic to RCU readers, nor will sequences
+               of multiple atomic primitives.
 
                This can work, but is starting to get a bit tricky.
 
@@ -98,9 +101,9 @@ over a rather long period of time, but improvements are always welcome!
                a new structure containing updated values.
 
 4.     Weakly ordered CPUs pose special challenges.  Almost all CPUs
-       are weakly ordered -- even i386 CPUs allow reads to be reordered.
-       RCU code must take all of the following measures to prevent
-       memory-corruption problems:
+       are weakly ordered -- even x86 CPUs allow later loads to be
+       reordered to precede earlier stores.  RCU code must take all of
+       the following measures to prevent memory-corruption problems:
 
        a.      Readers must maintain proper ordering of their memory
                accesses.  The rcu_dereference() primitive ensures that
@@ -113,14 +116,25 @@ over a rather long period of time, but improvements are always welcome!
                The rcu_dereference() primitive is also an excellent
                documentation aid, letting the person reading the code
                know exactly which pointers are protected by RCU.
-
-               The rcu_dereference() primitive is used by the various
-               "_rcu()" list-traversal primitives, such as the
-               list_for_each_entry_rcu().  Note that it is perfectly
-               legal (if redundant) for update-side code to use
-               rcu_dereference() and the "_rcu()" list-traversal
-               primitives.  This is particularly useful in code
-               that is common to readers and updaters.
+               Please note that compilers can also reorder code, and
+               they are becoming increasingly aggressive about doing
+               just that.  The rcu_dereference() primitive therefore
+               also prevents destructive compiler optimizations.
+
+               The rcu_dereference() primitive is used by the
+               various "_rcu()" list-traversal primitives, such
+               as the list_for_each_entry_rcu().  Note that it is
+               perfectly legal (if redundant) for update-side code to
+               use rcu_dereference() and the "_rcu()" list-traversal
+               primitives.  This is particularly useful in code that
+               is common to readers and updaters.  However, lockdep
+               will complain if you access rcu_dereference() outside
+               of an RCU read-side critical section.  See lockdep.txt
+               to learn what to do about this.
+
+               Of course, neither rcu_dereference() nor the "_rcu()"
+               list-traversal primitives can substitute for a good
+               concurrency design coordinating among multiple updaters.
 
        b.      If the list macros are being used, the list_add_tail_rcu()
                and list_add_rcu() primitives must be used in order
@@ -135,11 +149,14 @@ over a rather long period of time, but improvements are always welcome!
                readers.  Similarly, if the hlist macros are being used,
                the hlist_del_rcu() primitive is required.
 
-               The list_replace_rcu() primitive may be used to
-               replace an old structure with a new one in an
-               RCU-protected list.
+               The list_replace_rcu() and hlist_replace_rcu() primitives
+               may be used to replace an old structure with a new one
+               in their respective types of RCU-protected lists.
+
+       d.      Rules similar to (4b) and (4c) apply to the "hlist_nulls"
+               type of RCU-protected linked lists.
 
-       d.      Updates must ensure that initialization of a given
+       e.      Updates must ensure that initialization of a given
                structure happens before pointers to that structure are
                publicized.  Use the rcu_assign_pointer() primitive
                when publicizing a pointer to a structure that can
@@ -151,16 +168,31 @@ over a rather long period of time, but improvements are always welcome!
        it cannot block.
 
 6.     Since synchronize_rcu() can block, it cannot be called from
-       any sort of irq context.  Ditto for synchronize_sched() and
-       synchronize_srcu().
-
-7.     If the updater uses call_rcu(), then the corresponding readers
-       must use rcu_read_lock() and rcu_read_unlock().  If the updater
-       uses call_rcu_bh(), then the corresponding readers must use
-       rcu_read_lock_bh() and rcu_read_unlock_bh().  If the updater
-       uses call_rcu_sched(), then the corresponding readers must
-       disable preemption.  Mixing things up will result in confusion
-       and broken kernels.
+       any sort of irq context.  The same rule applies for
+       synchronize_rcu_bh(), synchronize_sched(), synchronize_srcu(),
+       synchronize_rcu_expedited(), synchronize_rcu_bh_expedited(),
+       synchronize_sched_expedite(), and synchronize_srcu_expedited().
+
+       The expedited forms of these primitives have the same semantics
+       as the non-expedited forms, but expediting is both expensive
+       and unfriendly to real-time workloads.  Use of the expedited
+       primitives should be restricted to rare configuration-change
+       operations that would not normally be undertaken while a real-time
+       workload is running.
+
+7.     If the updater uses call_rcu() or synchronize_rcu(), then the
+       corresponding readers must use rcu_read_lock() and
+       rcu_read_unlock().  If the updater uses call_rcu_bh() or
+       synchronize_rcu_bh(), then the corresponding readers must
+       use rcu_read_lock_bh() and rcu_read_unlock_bh().  If the
+       updater uses call_rcu_sched() or synchronize_sched(), then
+       the corresponding readers must disable preemption, possibly
+       by calling rcu_read_lock_sched() and rcu_read_unlock_sched().
+       If the updater uses synchronize_srcu(), the the corresponding
+       readers must use srcu_read_lock() and srcu_read_unlock(),
+       and with the same srcu_struct.  The rules for the expedited
+       primitives are the same as for their non-expedited counterparts.
+       Mixing things up will result in confusion and broken kernels.
 
        One exception to this rule: rcu_read_lock() and rcu_read_unlock()
        may be substituted for rcu_read_lock_bh() and rcu_read_unlock_bh()
@@ -212,6 +244,8 @@ over a rather long period of time, but improvements are always welcome!
        e.      Periodically invoke synchronize_rcu(), permitting a limited
                number of updates per grace period.
 
+       The same cautions apply to call_rcu_bh() and call_rcu_sched().
+
 9.     All RCU list-traversal primitives, which include
        rcu_dereference(), list_for_each_entry_rcu(),
        list_for_each_continue_rcu(), and list_for_each_safe_rcu(),
@@ -219,7 +253,9 @@ over a rather long period of time, but improvements are always welcome!
        must be protected by appropriate update-side locks.  RCU
        read-side critical sections are delimited by rcu_read_lock()
        and rcu_read_unlock(), or by similar primitives such as
-       rcu_read_lock_bh() and rcu_read_unlock_bh().
+       rcu_read_lock_bh() and rcu_read_unlock_bh(), in which case
+       the matching rcu_dereference() primitive must be used in order
+       to keep lockdep happy, in this case, rcu_dereference_bh().
 
        The reason that it is permissible to use RCU list-traversal
        primitives when the update-side lock is held is that doing so
@@ -229,7 +265,8 @@ over a rather long period of time, but improvements are always welcome!
 10.    Conversely, if you are in an RCU read-side critical section,
        and you don't hold the appropriate update-side lock, you -must-
        use the "_rcu()" variants of the list macros.  Failing to do so
-       will break Alpha and confuse people reading your code.
+       will break Alpha, cause aggressive compilers to generate bad code,
+       and confuse people trying to read your code.
 
 11.    Note that synchronize_rcu() -only- guarantees to wait until
        all currently executing rcu_read_lock()-protected RCU read-side
@@ -239,15 +276,21 @@ over a rather long period of time, but improvements are always welcome!
        rcu_read_lock()-protected read-side critical sections, do -not-
        use synchronize_rcu().
 
-       If you want to wait for some of these other things, you might
-       instead need to use synchronize_irq() or synchronize_sched().
+       Similarly, disabling preemption is not an acceptable substitute
+       for rcu_read_lock().  Code that attempts to use preemption
+       disabling where it should be using rcu_read_lock() will break
+       in real-time kernel builds.
+
+       If you want to wait for interrupt handlers, NMI handlers, and
+       code under the influence of preempt_disable(), you instead
+       need to use synchronize_irq() or synchronize_sched().
 
 12.    Any lock acquired by an RCU callback must be acquired elsewhere
        with softirq disabled, e.g., via spin_lock_irqsave(),
        spin_lock_bh(), etc.  Failing to disable irq on a given
-       acquisition of that lock will result in deadlock as soon as the
-       RCU callback happens to interrupt that acquisition's critical
-       section.
+       acquisition of that lock will result in deadlock as soon as
+       the RCU softirq handler happens to run your RCU callback while
+       interrupting that acquisition's critical section.
 
 13.    RCU callbacks can be and are executed in parallel.  In many cases,
        the callback code simply wrappers around kfree(), so that this
@@ -265,29 +308,30 @@ over a rather long period of time, but improvements are always welcome!
        not the case, a self-spawning RCU callback would prevent the
        victim CPU from ever going offline.)
 
-14.    SRCU (srcu_read_lock(), srcu_read_unlock(), and synchronize_srcu())
-       may only be invoked from process context.  Unlike other forms of
-       RCU, it -is- permissible to block in an SRCU read-side critical
-       section (demarked by srcu_read_lock() and srcu_read_unlock()),
-       hence the "SRCU": "sleepable RCU".  Please note that if you
-       don't need to sleep in read-side critical sections, you should
-       be using RCU rather than SRCU, because RCU is almost always
-       faster and easier to use than is SRCU.
+14.    SRCU (srcu_read_lock(), srcu_read_unlock(), srcu_dereference(),
+       synchronize_srcu(), and synchronize_srcu_expedited()) may only
+       be invoked from process context.  Unlike other forms of RCU, it
+       -is- permissible to block in an SRCU read-side critical section
+       (demarked by srcu_read_lock() and srcu_read_unlock()), hence the
+       "SRCU": "sleepable RCU".  Please note that if you don't need
+       to sleep in read-side critical sections, you should be using
+       RCU rather than SRCU, because RCU is almost always faster and
+       easier to use than is SRCU.
 
        Also unlike other forms of RCU, explicit initialization
        and cleanup is required via init_srcu_struct() and
        cleanup_srcu_struct().  These are passed a "struct srcu_struct"
        that defines the scope of a given SRCU domain.  Once initialized,
        the srcu_struct is passed to srcu_read_lock(), srcu_read_unlock()
-       and synchronize_srcu().  A given synchronize_srcu() waits only
-       for SRCU read-side critical sections governed by srcu_read_lock()
-       and srcu_read_unlock() calls that have been passd the same
-       srcu_struct.  This property is what makes sleeping read-side
-       critical sections tolerable -- a given subsystem delays only
-       its own updates, not those of other subsystems using SRCU.
-       Therefore, SRCU is less prone to OOM the system than RCU would
-       be if RCU's read-side critical sections were permitted to
-       sleep.
+       synchronize_srcu(), and synchronize_srcu_expedited().  A given
+       synchronize_srcu() waits only for SRCU read-side critical
+       sections governed by srcu_read_lock() and srcu_read_unlock()
+       calls that have been passed the same srcu_struct.  This property
+       is what makes sleeping read-side critical sections tolerable --
+       a given subsystem delays only its own updates, not those of other
+       subsystems using SRCU.  Therefore, SRCU is less prone to OOM the
+       system than RCU would be if RCU's read-side critical sections
+       were permitted to sleep.
 
        The ability to sleep in read-side critical sections does not
        come for free.  First, corresponding srcu_read_lock() and
@@ -311,12 +355,12 @@ over a rather long period of time, but improvements are always welcome!
        destructive operation, and -only- -then- invoke call_rcu(),
        synchronize_rcu(), or friends.
 
-       Because these primitives only wait for pre-existing readers,
-       it is the caller's responsibility to guarantee safety to
-       any subsequent readers.
+       Because these primitives only wait for pre-existing readers, it
+       is the caller's responsibility to guarantee that any subsequent
+       readers will execute safely.
 
-16.    The various RCU read-side primitives do -not- contain memory
-       barriers.  The CPU (and in some cases, the compiler) is free
-       to reorder code into and out of RCU read-side critical sections.
-       It is the responsibility of the RCU update-side primitives to
-       deal with this.
+16.    The various RCU read-side primitives do -not- necessarily contain
+       memory barriers.  You should therefore plan for the CPU
+       and the compiler to freely reorder code into and out of RCU
+       read-side critical sections.  It is the responsibility of the
+       RCU update-side primitives to deal with this.
diff --git a/Documentation/RCU/lockdep.txt b/Documentation/RCU/lockdep.txt
new file mode 100644 (file)
index 0000000..fe24b58
--- /dev/null
@@ -0,0 +1,67 @@
+RCU and lockdep checking
+
+All flavors of RCU have lockdep checking available, so that lockdep is
+aware of when each task enters and leaves any flavor of RCU read-side
+critical section.  Each flavor of RCU is tracked separately (but note
+that this is not the case in 2.6.32 and earlier).  This allows lockdep's
+tracking to include RCU state, which can sometimes help when debugging
+deadlocks and the like.
+
+In addition, RCU provides the following primitives that check lockdep's
+state:
+
+       rcu_read_lock_held() for normal RCU.
+       rcu_read_lock_bh_held() for RCU-bh.
+       rcu_read_lock_sched_held() for RCU-sched.
+       srcu_read_lock_held() for SRCU.
+
+These functions are conservative, and will therefore return 1 if they
+aren't certain (for example, if CONFIG_DEBUG_LOCK_ALLOC is not set).
+This prevents things like WARN_ON(!rcu_read_lock_held()) from giving false
+positives when lockdep is disabled.
+
+In addition, a separate kernel config parameter CONFIG_PROVE_RCU enables
+checking of rcu_dereference() primitives:
+
+       rcu_dereference(p):
+               Check for RCU read-side critical section.
+       rcu_dereference_bh(p):
+               Check for RCU-bh read-side critical section.
+       rcu_dereference_sched(p):
+               Check for RCU-sched read-side critical section.
+       srcu_dereference(p, sp):
+               Check for SRCU read-side critical section.
+       rcu_dereference_check(p, c):
+               Use explicit check expression "c".
+       rcu_dereference_raw(p)
+               Don't check.  (Use sparingly, if at all.)
+
+The rcu_dereference_check() check expression can be any boolean
+expression, but would normally include one of the rcu_read_lock_held()
+family of functions and a lockdep expression.  However, any boolean
+expression can be used.  For a moderately ornate example, consider
+the following:
+
+       file = rcu_dereference_check(fdt->fd[fd],
+                                    rcu_read_lock_held() ||
+                                    lockdep_is_held(&files->file_lock) ||
+                                    atomic_read(&files->count) == 1);
+
+This expression picks up the pointer "fdt->fd[fd]" in an RCU-safe manner,
+and, if CONFIG_PROVE_RCU is configured, verifies that this expression
+is used in:
+
+1.     An RCU read-side critical section, or
+2.     with files->file_lock held, or
+3.     on an unshared files_struct.
+
+In case (1), the pointer is picked up in an RCU-safe manner for vanilla
+RCU read-side critical sections, in case (2) the ->file_lock prevents
+any change from taking place, and finally, in case (3) the current task
+is the only task accessing the file_struct, again preventing any change
+from taking place.
+
+There are currently only "universal" versions of the rcu_assign_pointer()
+and RCU list-/tree-traversal primitives, which do not (yet) check for
+being in an RCU read-side critical section.  In the future, separate
+versions of these primitives might be created.
index 2a23523ce4712d2b972a0d99ea22fcf00912ab8c..31852705b5863063f453fbb500dd6e6dfa456498 100644 (file)
@@ -75,6 +75,8 @@ o     I hear that RCU is patented?  What is with that?
        search for the string "Patent" in RTFP.txt to find them.
        Of these, one was allowed to lapse by the assignee, and the
        others have been contributed to the Linux kernel under GPL.
+       There are now also LGPL implementations of user-level RCU
+       available (http://lttng.org/?q=node/18).
 
 o      I hear that RCU needs work in order to support realtime kernels?
 
@@ -91,48 +93,4 @@ o    Where can I find more information on RCU?
 
 o      What are all these files in this directory?
 
-
-       NMI-RCU.txt
-
-               Describes how to use RCU to implement dynamic
-               NMI handlers, which can be revectored on the fly,
-               without rebooting.
-
-       RTFP.txt
-
-               List of RCU-related publications and web sites.
-
-       UP.txt
-
-               Discussion of RCU usage in UP kernels.
-
-       arrayRCU.txt
-
-               Describes how to use RCU to protect arrays, with
-               resizeable arrays whose elements reference other
-               data structures being of the most interest.
-
-       checklist.txt
-
-               Lists things to check for when inspecting code that
-               uses RCU.
-
-       listRCU.txt
-
-               Describes how to use RCU to protect linked lists.
-               This is the simplest and most common use of RCU
-               in the Linux kernel.
-
-       rcu.txt
-
-               You are reading it!
-
-       rcuref.txt
-
-               Describes how to combine use of reference counts
-               with RCU.
-
-       whatisRCU.txt
-
-               Overview of how the RCU implementation works.  Along
-               the way, presents a conceptual view of RCU.
+       See 00-INDEX for the list.
diff --git a/Documentation/RCU/stallwarn.txt b/Documentation/RCU/stallwarn.txt
new file mode 100644 (file)
index 0000000..1423d25
--- /dev/null
@@ -0,0 +1,58 @@
+Using RCU's CPU Stall Detector
+
+The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables
+RCU's CPU stall detector, which detects conditions that unduly delay
+RCU grace periods.  The stall detector's idea of what constitutes
+"unduly delayed" is controlled by a pair of C preprocessor macros:
+
+RCU_SECONDS_TILL_STALL_CHECK
+
+       This macro defines the period of time that RCU will wait from
+       the beginning of a grace period until it issues an RCU CPU
+       stall warning.  It is normally ten seconds.
+
+RCU_SECONDS_TILL_STALL_RECHECK
+
+       This macro defines the period of time that RCU will wait after
+       issuing a stall warning until it issues another stall warning.
+       It is normally set to thirty seconds.
+
+RCU_STALL_RAT_DELAY
+
+       The CPU stall detector tries to make the offending CPU rat on itself,
+       as this often gives better-quality stack traces.  However, if
+       the offending CPU does not detect its own stall in the number
+       of jiffies specified by RCU_STALL_RAT_DELAY, then other CPUs will
+       complain.  This is normally set to two jiffies.
+
+The following problems can result in an RCU CPU stall warning:
+
+o      A CPU looping in an RCU read-side critical section.
+       
+o      A CPU looping with interrupts disabled.
+
+o      A CPU looping with preemption disabled.
+
+o      For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel
+       without invoking schedule().
+
+o      A bug in the RCU implementation.
+
+o      A hardware failure.  This is quite unlikely, but has occurred
+       at least once in a former life.  A CPU failed in a running system,
+       becoming unresponsive, but not causing an immediate crash.
+       This resulted in a series of RCU CPU stall warnings, eventually
+       leading the realization that the CPU had failed.
+
+The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning.
+SRCU does not do so directly, but its calls to synchronize_sched() will
+result in RCU-sched detecting any CPU stalls that might be occurring.
+
+To diagnose the cause of the stall, inspect the stack traces.  The offending
+function will usually be near the top of the stack.  If you have a series
+of stall warnings from a single extended stall, comparing the stack traces
+can often help determine where the stall is occurring, which will usually
+be in the function nearest the top of the stack that stays the same from
+trace to trace.
+
+RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE.
index 9dba3bb90e60a4710222d864124453d0d861b8c6..0e50bc2aa1e2e4f4682f5b5540a49987bfb00884 100644 (file)
@@ -30,6 +30,18 @@ MODULE PARAMETERS
 
 This module has the following parameters:
 
+fqs_duration   Duration (in microseconds) of artificially induced bursts
+               of force_quiescent_state() invocations.  In RCU
+               implementations having force_quiescent_state(), these
+               bursts help force races between forcing a given grace
+               period and that grace period ending on its own.
+
+fqs_holdoff    Holdoff time (in microseconds) between consecutive calls
+               to force_quiescent_state() within a burst.
+
+fqs_stutter    Wait time (in seconds) between consecutive bursts
+               of calls to force_quiescent_state().
+
 irqreaders     Says to invoke RCU readers from irq level.  This is currently
                done via timers.  Defaults to "1" for variants of RCU that
                permit this.  (Or, more accurately, variants of RCU that do
index d542ca243b80d52afcc0ce9a32e7e5faa20a0920..1dc00ee97163261bb3390e21499e45b9a44bde20 100644 (file)
@@ -323,14 +323,17 @@ used as follows:
        Defer                   Protect
 
 a.     synchronize_rcu()       rcu_read_lock() / rcu_read_unlock()
-       call_rcu()
+       call_rcu()              rcu_dereference()
 
 b.     call_rcu_bh()           rcu_read_lock_bh() / rcu_read_unlock_bh()
+                               rcu_dereference_bh()
 
-c.     synchronize_sched()     preempt_disable() / preempt_enable()
+c.     synchronize_sched()     rcu_read_lock_sched() / rcu_read_unlock_sched()
+                               preempt_disable() / preempt_enable()
                                local_irq_save() / local_irq_restore()
                                hardirq enter / hardirq exit
                                NMI enter / NMI exit
+                               rcu_dereference_sched()
 
 These three mechanisms are used as follows:
 
@@ -780,9 +783,8 @@ Linux-kernel source code, but it helps to have a full list of the
 APIs, since there does not appear to be a way to categorize them
 in docbook.  Here is the list, by category.
 
-RCU pointer/list traversal:
+RCU list traversal:
 
-       rcu_dereference
        list_for_each_entry_rcu
        hlist_for_each_entry_rcu
        hlist_nulls_for_each_entry_rcu
@@ -808,7 +810,7 @@ RCU:        Critical sections       Grace period            Barrier
 
        rcu_read_lock           synchronize_net         rcu_barrier
        rcu_read_unlock         synchronize_rcu
-                               synchronize_rcu_expedited
+       rcu_dereference         synchronize_rcu_expedited
                                call_rcu
 
 
@@ -816,7 +818,7 @@ bh: Critical sections       Grace period            Barrier
 
        rcu_read_lock_bh        call_rcu_bh             rcu_barrier_bh
        rcu_read_unlock_bh      synchronize_rcu_bh
-                               synchronize_rcu_bh_expedited
+       rcu_dereference_bh      synchronize_rcu_bh_expedited
 
 
 sched: Critical sections       Grace period            Barrier
@@ -825,12 +827,14 @@ sched:    Critical sections       Grace period            Barrier
        rcu_read_unlock_sched   call_rcu_sched
        [preempt_disable]       synchronize_sched_expedited
        [and friends]
+       rcu_dereference_sched
 
 
 SRCU:  Critical sections       Grace period            Barrier
 
        srcu_read_lock          synchronize_srcu        N/A
        srcu_read_unlock        synchronize_srcu_expedited
+       srcu_dereference
 
 SRCU:  Initialization/cleanup
        init_srcu_struct
index da42ab414c4864db4bb9d35b0cca9005b27670d2..b231414bb8bc4b84d218fc2f2f75d5665d0a0761 100644 (file)
@@ -377,3 +377,27 @@ maps this page at its virtual address.
        All the functionality of flush_icache_page can be implemented in
        flush_dcache_page and update_mmu_cache. In 2.7 the hope is to
        remove this interface completely.
+
+The final category of APIs is for I/O to deliberately aliased address
+ranges inside the kernel.  Such aliases are set up by use of the
+vmap/vmalloc API.  Since kernel I/O goes via physical pages, the I/O
+subsystem assumes that the user mapping and kernel offset mapping are
+the only aliases.  This isn't true for vmap aliases, so anything in
+the kernel trying to do I/O to vmap areas must manually manage
+coherency.  It must do this by flushing the vmap range before doing
+I/O and invalidating it after the I/O returns.
+
+  void flush_kernel_vmap_range(void *vaddr, int size)
+       flushes the kernel cache for a given virtual address range in
+       the vmap area.  This is to make sure that any data the kernel
+       modified in the vmap range is made visible to the physical
+       page.  The design is to make this area safe to perform I/O on.
+       Note that this API does *not* also flush the offset map alias
+       of the area.
+
+  void invalidate_kernel_vmap_range(void *vaddr, int size) invalidates
+       the cache for a given virtual address range in the vmap area
+       which prevents the processor from making the cache stale by
+       speculatively reading data while the I/O was occurring to the
+       physical pages.  This is only necessary for data reads into the
+       vmap area.
index aed082f49d09894be277ebcbfef898cf75ee1074..737988fca64d37712a7b5c7dfc2d316a57be9082 100644 (file)
@@ -145,8 +145,8 @@ show_sampling_rate_max: THIS INTERFACE IS DEPRECATED, DON'T USE IT.
 up_threshold: defines what the average CPU usage between the samplings
 of 'sampling_rate' needs to be for the kernel to make a decision on
 whether it should increase the frequency.  For example when it is set
-to its default value of '80' it means that between the checking
-intervals the CPU needs to be on average more than 80% in use to then
+to its default value of '95' it means that between the checking
+intervals the CPU needs to be on average more than 95% in use to then
 decide that the CPU frequency needs to be increased.  
 
 ignore_nice_load: this parameter takes a value of '0' or '1'. When
index 3ad6acead94950a3b83e4f14912e01cc64973b6b..d9bcffd594331d7b52a5608269327a7c6642af31 100644 (file)
@@ -69,7 +69,6 @@ av_permissions.h
 bbootsect
 bin2c
 binkernel.spec
-binoffset
 bootsect
 bounds.h
 bsetup
index 14b7b5a3bcb9a1c2b4f36948974c649c472afaa2..239cbdbf4d120edc39869cd1af74764c01c4acbe 100644 (file)
@@ -26,7 +26,7 @@ use IO::Handle;
                "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
                "or51211", "or51132_qam", "or51132_vsb", "bluebird",
                "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718",
-               "af9015");
+               "af9015", "ngene");
 
 # Check args
 syntax() if (scalar(@ARGV) != 1);
@@ -39,7 +39,7 @@ for ($i=0; $i < scalar(@components); $i++) {
        die $@ if $@;
        print STDERR <<EOF;
 Firmware(s) $outfile extracted successfully.
-Now copy it(they) to either /usr/lib/hotplug/firmware or /lib/firmware
+Now copy it(them) to either /usr/lib/hotplug/firmware or /lib/firmware
 (depending on configuration of firmware hotplug).
 EOF
        exit(0);
@@ -549,6 +549,24 @@ sub af9015 {
        close INFILE;
 }
 
+sub ngene {
+    my $url = "http://www.digitaldevices.de/download/";
+    my $file1 = "ngene_15.fw";
+    my $hash1 = "d798d5a757121174f0dbc5f2833c0c85";
+    my $file2 = "ngene_17.fw";
+    my $hash2 = "26b687136e127b8ac24b81e0eeafc20b";
+
+    checkstandard();
+
+    wgetfile($file1, $url . $file1);
+    verify($file1, $hash1);
+
+    wgetfile($file2, $url . $file2);
+    verify($file2, $hash2);
+
+    "$file1, $file2";
+}
+
 # ---------------------------------------------------------------
 # Utilities
 
@@ -667,6 +685,7 @@ sub delzero{
 sub syntax() {
     print STDERR "syntax: get_dvb_firmware <component>\n";
     print STDERR "Supported components:\n";
+    @components = sort @components;
     for($i=0; $i < scalar(@components); $i++) {
        print STDERR "\t" . $components[$i] . "\n";
     }
index 079305640790ee0436ab7ae46e49624498c333ce..7be15e44d48166246cd85c99e8219b08e0fce52c 100644 (file)
@@ -143,8 +143,8 @@ o provide a way to configure fault attributes
   failslab, fail_page_alloc, and fail_make_request use this way.
   Helper functions:
 
-       init_fault_attr_entries(entries, attr, name);
-       void cleanup_fault_attr_entries(entries);
+       init_fault_attr_dentries(entries, attr, name);
+       void cleanup_fault_attr_dentries(entries);
 
 - module parameters
 
index 870d190fe6178676067b4f2adadbfd07b56beacb..ea401495528d1e4e6ccd7042dd0deca7566a189b 100644 (file)
@@ -6,21 +6,6 @@ be removed from this file.
 
 ---------------------------
 
-What:  USER_SCHED
-When:  2.6.34
-
-Why:   USER_SCHED was implemented as a proof of concept for group scheduling.
-       The effect of USER_SCHED can already be achieved from userspace with
-       the help of libcgroup. The removal of USER_SCHED will also simplify
-       the scheduler code with the removal of one major ifdef. There are also
-       issues USER_SCHED has with USER_NS. A decision was taken not to fix
-       those and instead remove USER_SCHED. Also new group scheduling
-       features will not be implemented for USER_SCHED.
-
-Who:   Dhaval Giani <dhaval@linux.vnet.ibm.com>
-
----------------------------
-
 What:  PRISM54
 When:  2.6.34
 
@@ -64,6 +49,17 @@ Who: Robin Getz <rgetz@blackfin.uclinux.org> & Matt Mackall <mpm@selenic.com>
 
 ---------------------------
 
+What:  Deprecated snapshot ioctls
+When:  2.6.36
+
+Why:   The ioctls in kernel/power/user.c were marked as deprecated long time
+       ago. Now they notify users about that so that they need to replace
+       their userspace. After some more time, remove them completely.
+
+Who:   Jiri Slaby <jirislaby@gmail.com>
+
+---------------------------
+
 What:  The ieee80211_regdom module parameter
 When:  March 2010 / desktop catchup
 
@@ -493,3 +489,52 @@ Why:       These two features use non-standard interfaces. There are the
 Who:   Corentin Chary <corentin.chary@gmail.com>
 
 ----------------------------
+
+What:  usbvideo quickcam_messenger driver
+When:  2.6.35
+Files: drivers/media/video/usbvideo/quickcam_messenger.[ch]
+Why:   obsolete v4l1 driver replaced by gspca_stv06xx
+Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  ov511 v4l1 driver
+When:  2.6.35
+Files: drivers/media/video/ov511.[ch]
+Why:   obsolete v4l1 driver replaced by gspca_ov519
+Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  w9968cf v4l1 driver
+When:  2.6.35
+Files: drivers/media/video/w9968cf*.[ch]
+Why:   obsolete v4l1 driver replaced by gspca_ov519
+Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  ovcamchip sensor framework
+When:  2.6.35
+Files: drivers/media/video/ovcamchip/*
+Why:   Only used by obsoleted v4l1 drivers
+Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  stv680 v4l1 driver
+When:  2.6.35
+Files: drivers/media/video/stv680.[ch]
+Why:   obsolete v4l1 driver replaced by gspca_stv0680
+Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  zc0301 v4l driver
+When:  2.6.35
+Files: drivers/media/video/zc0301/*
+Why:   Duplicate functionality with the gspca_zc3xx driver, zc0301 only
+       supports 2 USB-ID's (because it only supports a limited set of
+       sensors) wich are also supported by the gspca_zc3xx driver
+       (which supports 53 USB-ID's in total)
+Who:   Hans de Goede <hdegoede@redhat.com>
index 4c0c575a40120709120f1b8824d50df5a8906ab0..79334ed5daa7fee4802c5f0a30bb58dde88dbbdc 100644 (file)
@@ -62,7 +62,8 @@ changes are :
 2. Insertion of a dentry into the hash table is done using
    hlist_add_head_rcu() which take care of ordering the writes - the
    writes to the dentry must be visible before the dentry is
-   inserted. This works in conjunction with hlist_for_each_rcu() while
+   inserted. This works in conjunction with hlist_for_each_rcu(),
+   which has since been replaced by hlist_for_each_entry_rcu(), while
    walking the hash chain. The only requirement is that all
    initialization to the dentry must be done before
    hlist_add_head_rcu() since we don't have dcache_lock protection
index a12ea3b586e6e15ecb66322c78bf5d6cb3e03f79..8490480ce4327beb95bb5936c8d55609a7ce7c82 100644 (file)
@@ -27,12 +27,30 @@ set of events/packets.
 
 A set of ABS_MT events with the desired properties is defined. The events
 are divided into categories, to allow for partial implementation.  The
-minimum set consists of ABS_MT_TOUCH_MAJOR, ABS_MT_POSITION_X and
-ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked.  If the
-device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide the size
-of the approaching finger. Anisotropy and direction may be specified with
-ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and ABS_MT_ORIENTATION.  The
-ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
+minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which
+allows for multiple fingers to be tracked.  If the device supports it, the
+ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size
+of the contact area and approaching finger, respectively.
+
+The TOUCH and WIDTH parameters have a geometrical interpretation; imagine
+looking through a window at someone gently holding a finger against the
+glass.  You will see two regions, one inner region consisting of the part
+of the finger actually touching the glass, and one outer region formed by
+the perimeter of the finger. The diameter of the inner region is the
+ABS_MT_TOUCH_MAJOR, the diameter of the outer region is
+ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger harder
+against the glass. The inner region will increase, and in general, the
+ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller than
+unity, is related to the finger pressure. For pressure-based devices,
+ABS_MT_PRESSURE may be used to provide the pressure on the contact area
+instead.
+
+In addition to the MAJOR parameters, the oval shape of the finger can be
+described by adding the MINOR parameters, such that MAJOR and MINOR are the
+major and minor axis of an ellipse. Finally, the orientation of the oval
+shape can be describe with the ORIENTATION parameter.
+
+The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
 finger or a pen or something else.  Devices with more granular information
 may specify general shapes as blobs, i.e., as a sequence of rectangular
 shapes grouped together by an ABS_MT_BLOB_ID. Finally, for the few devices
@@ -42,11 +60,9 @@ report finger tracking from hardware [5].
 Here is what a minimal event sequence for a two-finger touch would look
 like:
 
-   ABS_MT_TOUCH_MAJOR
    ABS_MT_POSITION_X
    ABS_MT_POSITION_Y
    SYN_MT_REPORT
-   ABS_MT_TOUCH_MAJOR
    ABS_MT_POSITION_X
    ABS_MT_POSITION_Y
    SYN_MT_REPORT
@@ -87,6 +103,12 @@ the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
 the notion of pressure. The fingers of the hand and the palm all have
 different characteristic widths [1].
 
+ABS_MT_PRESSURE
+
+The pressure, in arbitrary units, on the contact area. May be used instead
+of TOUCH and WIDTH for pressure-based devices or any device with a spatial
+signal intensity distribution.
+
 ABS_MT_ORIENTATION
 
 The orientation of the ellipse. The value should describe a signed quarter
@@ -170,6 +192,16 @@ There are a few devices that support trackingID in hardware. User space can
 make use of these native identifiers to reduce bandwidth and cpu usage.
 
 
+Gestures
+--------
+
+In the specific application of creating gesture events, the TOUCH and WIDTH
+parameters can be used to, e.g., approximate finger pressure or distinguish
+between index finger and thumb. With the addition of the MINOR parameters,
+one can also distinguish between a sweeping finger and a pointing finger,
+and with ORIENTATION, one can detect twisting of fingers.
+
+
 Notes
 -----
 
index 736d45602886ea7b08024f246f06e9c7c6dc1a05..8c666d80f0e7713b16ff48c18e3d2c71b63058f8 100644 (file)
@@ -199,6 +199,10 @@ and is between 256 and 4096 characters. It is defined in the file
                        acpi_display_output=video
                        See above.
 
+       acpi_early_pdc_eval     [HW,ACPI] Evaluate processor _PDC methods
+                               early. Needed on some platforms to properly
+                               initialize the EC.
+
        acpi_irq_balance [HW,ACPI]
                        ACPI will balance active IRQs
                        default in APIC mode
@@ -311,6 +315,11 @@ and is between 256 and 4096 characters. It is defined in the file
        aic79xx=        [HW,SCSI]
                        See Documentation/scsi/aic79xx.txt.
 
+       alignment=      [KNL,ARM]
+                       Allow the default userspace alignment fault handler
+                       behaviour to be specified.  Bit 0 enables warnings,
+                       bit 1 enables fixups, and bit 2 sends a segfault.
+
        amd_iommu=      [HW,X86-84]
                        Pass parameters to the AMD IOMMU driver in the system.
                        Possible values are:
@@ -1729,6 +1738,9 @@ and is between 256 and 4096 characters. It is defined in the file
        nomfgpt         [X86-32] Disable Multi-Function General Purpose
                        Timer usage (for AMD Geode machines).
 
+       nopat           [X86] Disable PAT (page attribute table extension of
+                       pagetables) support.
+
        norandmaps      Don't use address space randomization.  Equivalent to
                        echo 0 > /proc/sys/kernel/randomize_va_space
 
@@ -1939,8 +1951,12 @@ and is between 256 and 4096 characters. It is defined in the file
                                IRQ routing is enabled.
                noacpi          [X86] Do not use ACPI for IRQ routing
                                or for PCI scanning.
-               use_crs         [X86] Use _CRS for PCI resource
-                               allocation.
+               use_crs         [X86] Use PCI host bridge window information
+                               from ACPI.  On BIOSes from 2008 or later, this
+                               is enabled by default.  If you need to use this,
+                               please report a bug.
+               nocrs           [X86] Ignore PCI host bridge windows from ACPI.
+                               If you need to use this, please report a bug.
                routeirq        Do IRQ routing for all PCI devices.
                                This is normally done in pci_enable_device(),
                                so this option is a temporary workaround
@@ -1989,6 +2005,14 @@ and is between 256 and 4096 characters. It is defined in the file
                force   Enable ASPM even on devices that claim not to support it.
                        WARNING: Forcing ASPM on may cause system lockups.
 
+       pcie_pme=       [PCIE,PM] Native PCIe PME signaling options:
+               off     Do not use native PCIe PME signaling.
+               force   Use native PCIe PME signaling even if the BIOS refuses
+                       to allow the kernel to control the relevant PCIe config
+                       registers.
+               nomsi   Do not use MSI for native PCIe PME signaling (this makes
+                       all PCIe root ports use INTx for everything).
+
        pcmv=           [HW,PCMCIA] BadgePAD 4
 
        pd.             [PARIDE]
@@ -2694,6 +2718,13 @@ and is between 256 and 4096 characters. It is defined in the file
                                        medium is write-protected).
                        Example: quirks=0419:aaf5:rl,0421:0433:rc
 
+       userpte=
+                       [X86] Flags controlling user PTE allocations.
+
+                               nohigh = do not allocate PTE pages in
+                                       HIGHMEM regardless of setting
+                                       of CONFIG_HIGHPTE.
+
        vdso=           [X86,SH]
                        vdso=2: enable compat VDSO (default with COMPAT_VDSO)
                        vdso=1: enable VDSO (default)
index 42208511b5c054a20f513c350807e54d67abb724..3119f5db75bd62c7289f5bcee6ee729f51d595ac 100644 (file)
@@ -34,7 +34,6 @@
 #include <sys/uio.h>
 #include <termios.h>
 #include <getopt.h>
-#include <zlib.h>
 #include <assert.h>
 #include <sched.h>
 #include <limits.h>
index 006b39dec87d66f88edc62f9547482f554a6519e..e87f3cdc8a6afc42c36f9469e7afac9b1ec74b82 100644 (file)
@@ -1074,10 +1074,10 @@ regen_max_retry - INTEGER
        Default: 5
 
 max_addresses - INTEGER
-       Number of maximum addresses per interface.  0 disables limitation.
-       It is recommended not set too large value (or 0) because it would
-       be too easy way to crash kernel to allow to create too much of
-       autoconfigured addresses.
+       Maximum number of autoconfigured addresses per interface.  Setting
+       to zero disables the limitation.  It is not recommended to set this
+       value too large (or to zero) because it would be an easy way to
+       crash the kernel by allowing too many addresses to be created.
        Default: 16
 
 disable_ipv6 - BOOLEAN
diff --git a/Documentation/pcmcia/locking.txt b/Documentation/pcmcia/locking.txt
new file mode 100644 (file)
index 0000000..68f622b
--- /dev/null
@@ -0,0 +1,118 @@
+This file explains the locking and exclusion scheme used in the PCCARD
+and PCMCIA subsystems.
+
+
+A) Overview, Locking Hierarchy:
+===============================
+
+pcmcia_socket_list_rwsem       - protects only the list of sockets
+- skt_mutex                    - serializes card insert / ejection
+  - ops_mutex                  - serializes socket operation
+
+
+B) Exclusion
+============
+
+The following functions and callbacks to struct pcmcia_socket must
+be called with "skt_mutex" held:
+
+       socket_detect_change()
+       send_event()
+       socket_reset()
+       socket_shutdown()
+       socket_setup()
+       socket_remove()
+       socket_insert()
+       socket_early_resume()
+       socket_late_resume()
+       socket_resume()
+       socket_suspend()
+
+       struct pcmcia_callback  *callback
+
+The following functions and callbacks to struct pcmcia_socket must
+be called with "ops_mutex" held:
+
+       socket_reset()
+       socket_setup()
+
+       struct pccard_operations        *ops
+       struct pccard_resource_ops      *resource_ops;
+
+Note that send_event() and struct pcmcia_callback *callback must not be
+called with "ops_mutex" held.
+
+
+C) Protection
+=============
+
+1. Global Data:
+---------------
+struct list_head       pcmcia_socket_list;
+
+protected by pcmcia_socket_list_rwsem;
+
+
+2. Per-Socket Data:
+-------------------
+The resource_ops and their data are protected by ops_mutex.
+
+The "main" struct pcmcia_socket is protected as follows (read-only fields
+or single-use fields not mentioned):
+
+- by pcmcia_socket_list_rwsem:
+       struct list_head        socket_list;
+
+- by thread_lock:
+       unsigned int            thread_events;
+
+- by skt_mutex:
+       u_int                   suspended_state;
+       void                    (*tune_bridge);
+       struct pcmcia_callback  *callback;
+       int                     resume_status;
+
+- by ops_mutex:
+       socket_state_t          socket;
+       u_int                   state;
+       u_short                 lock_count;
+       pccard_mem_map          cis_mem;
+       void __iomem            *cis_virt;
+       struct { }              irq;
+       io_window_t             io[];
+       pccard_mem_map          win[];
+       struct list_head        cis_cache;
+       size_t                  fake_cis_len;
+       u8                      *fake_cis;
+       u_int                   irq_mask;
+       void                    (*zoom_video);
+       int                     (*power_hook);
+       u8                      resource...;
+       struct list_head        devices_list;
+       u8                      device_count;
+       struct                  pcmcia_state;
+
+
+3. Per PCMCIA-device Data:
+--------------------------
+
+The "main" struct pcmcia_devie is protected as follows (read-only fields
+or single-use fields not mentioned):
+
+
+- by pcmcia_socket->ops_mutex:
+       struct list_head        socket_device_list;
+       struct config_t         *function_config;
+       u16                     _irq:1;
+       u16                     _io:1;
+       u16                     _win:4;
+       u16                     _locked:1;
+       u16                     allow_func_id_match:1;
+       u16                     suspended:1;
+       u16                     _removed:1;
+
+- by the PCMCIA driver:
+       io_req_t                io;
+       irq_req_t               irq;
+       config_req_t            conf;
+       window_handle_t         win;
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt b/Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt
new file mode 100644 (file)
index 0000000..8832e87
--- /dev/null
@@ -0,0 +1,70 @@
+MPC5121 PSC Device Tree Bindings
+
+PSC in UART mode
+----------------
+
+For PSC in UART mode the needed PSC serial devices
+are specified by fsl,mpc5121-psc-uart nodes in the
+fsl,mpc5121-immr SoC node. Additionally the PSC FIFO
+Controller node fsl,mpc5121-psc-fifo is requered there:
+
+fsl,mpc5121-psc-uart nodes
+--------------------------
+
+Required properties :
+ - compatible : Should contain "fsl,mpc5121-psc-uart" and "fsl,mpc5121-psc"
+ - cell-index : Index of the PSC in hardware
+ - reg : Offset and length of the register set for the PSC device
+ - interrupts : <a b> where a is the interrupt number of the
+   PSC FIFO Controller and b is a field that represents an
+   encoding of the sense and level information for the interrupt.
+ - interrupt-parent : the phandle for the interrupt controller that
+   services interrupts for this device.
+
+Recommended properties :
+ - fsl,rx-fifo-size : the size of the RX fifo slice (a multiple of 4)
+ - fsl,tx-fifo-size : the size of the TX fifo slice (a multiple of 4)
+
+
+fsl,mpc5121-psc-fifo node
+-------------------------
+
+Required properties :
+ - compatible : Should be "fsl,mpc5121-psc-fifo"
+ - reg : Offset and length of the register set for the PSC
+         FIFO Controller
+ - interrupts : <a b> where a is the interrupt number of the
+   PSC FIFO Controller and b is a field that represents an
+   encoding of the sense and level information for the interrupt.
+ - interrupt-parent : the phandle for the interrupt controller that
+   services interrupts for this device.
+
+
+Example for a board using PSC0 and PSC1 devices in serial mode:
+
+serial@11000 {
+       compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
+       cell-index = <0>;
+       reg = <0x11000 0x100>;
+       interrupts = <40 0x8>;
+       interrupt-parent = < &ipic >;
+       fsl,rx-fifo-size = <16>;
+       fsl,tx-fifo-size = <16>;
+};
+
+serial@11100 {
+       compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
+       cell-index = <1>;
+       reg = <0x11100 0x100>;
+       interrupts = <40 0x8>;
+       interrupt-parent = < &ipic >;
+       fsl,rx-fifo-size = <16>;
+       fsl,tx-fifo-size = <16>;
+};
+
+pscfifo@11f00 {
+       compatible = "fsl,mpc5121-psc-fifo";
+       reg = <0x11f00 0x100>;
+       interrupts = <40 0x8>;
+       interrupt-parent = < &ipic >;
+};
index e7d9a344c4f450fda0e50d2b96d6ef30ecc3458a..80510c018eeaaec359d5d3b5f980d91938411a6e 100644 (file)
@@ -13,6 +13,11 @@ Required properties:
 - interrupt-parent : the phandle for the interrupt controller that
   services interrupts for this device.
 
+Optional properties:
+- gpios : specifies the gpio pins to be used for chipselects.
+  The gpios will be referred to as reg = <index> in the SPI child nodes.
+  If unspecified, a single SPI device without a chip select can be used.
+
 Example:
        spi@4c0 {
                cell-index = <0>;
@@ -21,4 +26,6 @@ Example:
                interrupts = <82 0>;
                interrupt-parent = <700>;
                mode = "cpu";
+               gpios = <&gpio 18 1     // device reg=<0>
+                        &gpio 19 1>;   // device reg=<1>
        };
diff --git a/Documentation/powerpc/ptrace.txt b/Documentation/powerpc/ptrace.txt
new file mode 100644 (file)
index 0000000..f4a5499
--- /dev/null
@@ -0,0 +1,134 @@
+GDB intends to support the following hardware debug features of BookE
+processors:
+
+4 hardware breakpoints (IAC)
+2 hardware watchpoints (read, write and read-write) (DAC)
+2 value conditions for the hardware watchpoints (DVC)
+
+For that, we need to extend ptrace so that GDB can query and set these
+resources. Since we're extending, we're trying to create an interface
+that's extendable and that covers both BookE and server processors, so
+that GDB doesn't need to special-case each of them. We added the
+following 3 new ptrace requests.
+
+1. PTRACE_PPC_GETHWDEBUGINFO
+
+Query for GDB to discover the hardware debug features. The main info to
+be returned here is the minimum alignment for the hardware watchpoints.
+BookE processors don't have restrictions here, but server processors have
+an 8-byte alignment restriction for hardware watchpoints. We'd like to avoid
+adding special cases to GDB based on what it sees in AUXV.
+
+Since we're at it, we added other useful info that the kernel can return to
+GDB: this query will return the number of hardware breakpoints, hardware
+watchpoints and whether it supports a range of addresses and a condition.
+The query will fill the following structure provided by the requesting process:
+
+struct ppc_debug_info {
+       unit32_t version;
+       unit32_t num_instruction_bps;
+       unit32_t num_data_bps;
+       unit32_t num_condition_regs;
+       unit32_t data_bp_alignment;
+       unit32_t sizeof_condition; /* size of the DVC register */
+       uint64_t features; /* bitmask of the individual flags */
+};
+
+features will have bits indicating whether there is support for:
+
+#define PPC_DEBUG_FEATURE_INSN_BP_RANGE                0x1
+#define PPC_DEBUG_FEATURE_INSN_BP_MASK         0x2
+#define PPC_DEBUG_FEATURE_DATA_BP_RANGE                0x4
+#define PPC_DEBUG_FEATURE_DATA_BP_MASK         0x8
+
+2. PTRACE_SETHWDEBUG
+
+Sets a hardware breakpoint or watchpoint, according to the provided structure:
+
+struct ppc_hw_breakpoint {
+        uint32_t version;
+#define PPC_BREAKPOINT_TRIGGER_EXECUTE  0x1
+#define PPC_BREAKPOINT_TRIGGER_READ     0x2
+#define PPC_BREAKPOINT_TRIGGER_WRITE    0x4
+        uint32_t trigger_type;       /* only some combinations allowed */
+#define PPC_BREAKPOINT_MODE_EXACT               0x0
+#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE     0x1
+#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE     0x2
+#define PPC_BREAKPOINT_MODE_MASK                0x3
+        uint32_t addr_mode;          /* address match mode */
+
+#define PPC_BREAKPOINT_CONDITION_MODE   0x3
+#define PPC_BREAKPOINT_CONDITION_NONE   0x0
+#define PPC_BREAKPOINT_CONDITION_AND    0x1
+#define PPC_BREAKPOINT_CONDITION_EXACT  0x1    /* different name for the same thing as above */
+#define PPC_BREAKPOINT_CONDITION_OR     0x2
+#define PPC_BREAKPOINT_CONDITION_AND_OR 0x3
+#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000     /* byte enable bits */
+#define PPC_BREAKPOINT_CONDITION_BE(n)  (1<<((n)+16))
+        uint32_t condition_mode;     /* break/watchpoint condition flags */
+
+        uint64_t addr;
+        uint64_t addr2;
+        uint64_t condition_value;
+};
+
+A request specifies one event, not necessarily just one register to be set.
+For instance, if the request is for a watchpoint with a condition, both the
+DAC and DVC registers will be set in the same request.
+
+With this GDB can ask for all kinds of hardware breakpoints and watchpoints
+that the BookE supports. COMEFROM breakpoints available in server processors
+are not contemplated, but that is out of the scope of this work.
+
+ptrace will return an integer (handle) uniquely identifying the breakpoint or
+watchpoint just created. This integer will be used in the PTRACE_DELHWDEBUG
+request to ask for its removal. Return -ENOSPC if the requested breakpoint
+can't be allocated on the registers.
+
+Some examples of using the structure to:
+
+- set a breakpoint in the first breakpoint register
+
+  p.version         = PPC_DEBUG_CURRENT_VERSION;
+  p.trigger_type    = PPC_BREAKPOINT_TRIGGER_EXECUTE;
+  p.addr_mode       = PPC_BREAKPOINT_MODE_EXACT;
+  p.condition_mode  = PPC_BREAKPOINT_CONDITION_NONE;
+  p.addr            = (uint64_t) address;
+  p.addr2           = 0;
+  p.condition_value = 0;
+
+- set a watchpoint which triggers on reads in the second watchpoint register
+
+  p.version         = PPC_DEBUG_CURRENT_VERSION;
+  p.trigger_type    = PPC_BREAKPOINT_TRIGGER_READ;
+  p.addr_mode       = PPC_BREAKPOINT_MODE_EXACT;
+  p.condition_mode  = PPC_BREAKPOINT_CONDITION_NONE;
+  p.addr            = (uint64_t) address;
+  p.addr2           = 0;
+  p.condition_value = 0;
+
+- set a watchpoint which triggers only with a specific value
+
+  p.version         = PPC_DEBUG_CURRENT_VERSION;
+  p.trigger_type    = PPC_BREAKPOINT_TRIGGER_READ;
+  p.addr_mode       = PPC_BREAKPOINT_MODE_EXACT;
+  p.condition_mode  = PPC_BREAKPOINT_CONDITION_AND | PPC_BREAKPOINT_CONDITION_BE_ALL;
+  p.addr            = (uint64_t) address;
+  p.addr2           = 0;
+  p.condition_value = (uint64_t) condition;
+
+- set a ranged hardware breakpoint
+
+  p.version         = PPC_DEBUG_CURRENT_VERSION;
+  p.trigger_type    = PPC_BREAKPOINT_TRIGGER_EXECUTE;
+  p.addr_mode       = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE;
+  p.condition_mode  = PPC_BREAKPOINT_CONDITION_NONE;
+  p.addr            = (uint64_t) begin_range;
+  p.addr2           = (uint64_t) end_range;
+  p.condition_value = 0;
+
+3. PTRACE_DELHWDEBUG
+
+Takes an integer which identifies an existing breakpoint or watchpoint
+(i.e., the value returned from PTRACE_SETHWDEBUG), and deletes the
+corresponding breakpoint or watchpoint..
index 339207d11d951a99e54257df96100ab0713e11a9..d378cba6645698d98678c75489ce1bd02b38bd82 100644 (file)
@@ -87,6 +87,12 @@ Command line parameters
   compatibility, by the device number in hexadecimal (0xabcd or abcd). Device
   numbers given as 0xabcd will be interpreted as 0.0.abcd.
 
+* /proc/cio_settle
+
+  A write request to this file is blocked until all queued cio actions are
+  handled. This will allow userspace to wait for pending work affecting
+  device availability after changing cio_ignore or the hardware configuration.
+
 * For some of the information present in the /proc filesystem in 2.4 (namely,
   /proc/subchannels and /proc/chpids), see driver-model.txt.
   Information formerly in /proc/irq_count is now in /proc/interrupts.
index bde473df748dc95ca903bcadd2155a7def8ed4c4..ed265cf54cde70f20c98de6a7bfbffa1758f3cfb 100644 (file)
@@ -223,8 +223,8 @@ touched by the driver - it should use the ccwgroup device's driver_data for its
 private data.
 
 To implement a ccwgroup driver, please refer to include/asm/ccwgroup.h. Keep in
-mind that most drivers will need to implement both a ccwgroup and a ccw driver
-(unless you have a meta ccw driver, like cu3088 for lcs and ctc).
+mind that most drivers will need to implement both a ccwgroup and a ccw
+driver.
 
 
 2. Channel paths
index 17ffa06077126a96441b867cc77fea8cfd093ed6..30023568805e2a56077fa4cfbd088ee666522ab0 100644 (file)
@@ -1,3 +1,19 @@
+1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
+                       (emaild-id:megaraidlinux@lsi.com)
+                       Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.12
+
+1.     Add the pad_0 in mfi frame structure to 0 to fix the
+       context value larger than 32bit value issue.
+
+2.     Add the logic drive list to the driver.  Driver will
+       keep the logic drive list internal after driver load.
+
+3.     driver fixed the device update issue after get the AEN
+       PD delete/ADD, LD add/delete from FW.
+
 1 Release Date    : Tues.  July 28, 2009 10:12:45 PST 2009 -
                        (emaild-id:megaraidlinux@lsi.com)
                        Bo Yang
index 239f14b2b55a28213e1a7170db4b870ab82ff1b9..f1f81afee8a04d19bc69a7231c25a91c0e0f17e0 100644 (file)
@@ -1,5 +1,6 @@
                function tracer guts
                ====================
+               By Mike Frysinger
 
 Introduction
 ------------
@@ -173,14 +174,16 @@ void ftrace_graph_caller(void)
 
        unsigned long *frompc = &...;
        unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
-       prepare_ftrace_return(frompc, selfpc);
+       /* passing frame pointer up is optional -- see below */
+       prepare_ftrace_return(frompc, selfpc, frame_pointer);
 
        /* restore all state needed by the ABI */
 }
 #endif
 
-For information on how to implement prepare_ftrace_return(), simply look at
-the x86 version.  The only architecture-specific piece in it is the setup of
+For information on how to implement prepare_ftrace_return(), simply look at the
+x86 version (the frame pointer passing is optional; see the next section for
+more information).  The only architecture-specific piece in it is the setup of
 the fault recovery table (the asm(...) code).  The rest should be the same
 across architectures.
 
@@ -205,6 +208,23 @@ void return_to_handler(void)
 #endif
 
 
+HAVE_FUNCTION_GRAPH_FP_TEST
+---------------------------
+
+An arch may pass in a unique value (frame pointer) to both the entering and
+exiting of a function.  On exit, the value is compared and if it does not
+match, then it will panic the kernel.  This is largely a sanity check for bad
+code generation with gcc.  If gcc for your port sanely updates the frame
+pointer under different opitmization levels, then ignore this option.
+
+However, adding support for it isn't terribly difficult.  In your assembly code
+that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument.
+Then in the C version of that function, do what the x86 port does and pass it
+along to ftrace_push_return_trace() instead of a stub value of 0.
+
+Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
+
+
 HAVE_FTRACE_NMI_ENTER
 ---------------------
 
@@ -218,11 +238,10 @@ HAVE_SYSCALL_TRACEPOINTS
 
 You need very few things to get the syscalls tracing in an arch.
 
+- Support HAVE_ARCH_TRACEHOOK (see arch/Kconfig).
 - Have a NR_syscalls variable in <asm/unistd.h> that provides the number
   of syscalls supported by the arch.
-- Implement arch_syscall_addr() that resolves a syscall address from a
-  syscall number.
-- Support the TIF_SYSCALL_TRACEPOINT thread flags
+- Support the TIF_SYSCALL_TRACEPOINT thread flags.
 - Put the trace_sys_enter() and trace_sys_exit() tracepoints calls from ptrace
   in the ptrace syscalls tracing path.
 - Tag this arch as HAVE_SYSCALL_TRACEPOINTS.
index 8179692fbb903a3ccb92de0422e7c370137e9d9d..bab3040da5485bf7886deb3ed15648d1ee27ba7b 100644 (file)
@@ -1625,7 +1625,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
 
  # echo sys_nanosleep hrtimer_interrupt \
                > set_ftrace_filter
- # echo ftrace > current_tracer
+ # echo function > current_tracer
  # echo 1 > tracing_enabled
  # usleep 1
  # echo 0 > tracing_enabled
index 47aabeebbdf63ddf8c30e0b39659eefac08c58e6..a9100b28eb844da1974dd24dcaa2a320887eddda 100644 (file)
@@ -24,6 +24,7 @@ Synopsis of kprobe_events
 -------------------------
   p[:[GRP/]EVENT] SYMBOL[+offs]|MEMADDR [FETCHARGS]    : Set a probe
   r[:[GRP/]EVENT] SYMBOL[+0] [FETCHARGS]               : Set a return probe
+  -:[GRP/]EVENT                                                : Clear a probe
 
  GRP           : Group name. If omitted, use "kprobes" for it.
  EVENT         : Event name. If omitted, the event name is generated
@@ -37,15 +38,12 @@ Synopsis of kprobe_events
   @SYM[+|-offs]        : Fetch memory at SYM +|- offs (SYM should be a data symbol)
   $stackN      : Fetch Nth entry of stack (N >= 0)
   $stack       : Fetch stack address.
-  $argN                : Fetch function argument. (N >= 0)(*)
-  $retval      : Fetch return value.(**)
-  +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(***)
+  $retval      : Fetch return value.(*)
+  +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
   NAME=FETCHARG: Set NAME as the argument name of FETCHARG.
 
-  (*) aN may not correct on asmlinkaged functions and at the middle of
-      function body.
-  (**) only for return probe.
-  (***) this is useful for fetching a field of data structures.
+  (*) only for return probe.
+  (**) this is useful for fetching a field of data structures.
 
 
 Per-Probe Event Filtering
@@ -82,13 +80,16 @@ Usage examples
 To add a probe as a new event, write a new definition to kprobe_events
 as below.
 
-  echo p:myprobe do_sys_open dfd=$arg0 filename=$arg1 flags=$arg2 mode=$arg3 > /sys/kernel/debug/tracing/kprobe_events
+  echo 'p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)' > /sys/kernel/debug/tracing/kprobe_events
 
  This sets a kprobe on the top of do_sys_open() function with recording
-1st to 4th arguments as "myprobe" event. As this example shows, users can
-choose more familiar names for each arguments.
+1st to 4th arguments as "myprobe" event. Note, which register/stack entry is
+assigned to each function argument depends on arch-specific ABI. If you unsure
+the ABI, please try to use probe subcommand of perf-tools (you can find it
+under tools/perf/).
+As this example shows, users can choose more familiar names for each arguments.
 
-  echo r:myretprobe do_sys_open $retval >> /sys/kernel/debug/tracing/kprobe_events
+  echo 'r:myretprobe do_sys_open $retval' >> /sys/kernel/debug/tracing/kprobe_events
 
  This sets a kretprobe on the return point of do_sys_open() function with
 recording return value as "myretprobe" event.
@@ -97,23 +98,24 @@ recording return value as "myretprobe" event.
 
   cat /sys/kernel/debug/tracing/events/kprobes/myprobe/format
 name: myprobe
-ID: 75
+ID: 780
 format:
-       field:unsigned short common_type;       offset:0;       size:2;
-       field:unsigned char common_flags;       offset:2;       size:1;
-       field:unsigned char common_preempt_count;       offset:3;       size:1;
-       field:int common_pid;   offset:4;       size:4;
-       field:int common_tgid;  offset:8;       size:4;
+        field:unsigned short common_type;       offset:0;       size:2; signed:0;
+        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
+        field:unsigned char common_preempt_count;       offset:3; size:1;signed:0;
+        field:int common_pid;   offset:4;       size:4; signed:1;
+        field:int common_lock_depth;    offset:8;       size:4; signed:1;
 
-       field: unsigned long ip;        offset:16;tsize:8;
-       field: int nargs;       offset:24;tsize:4;
-       field: unsigned long dfd;       offset:32;tsize:8;
-       field: unsigned long filename;  offset:40;tsize:8;
-       field: unsigned long flags;     offset:48;tsize:8;
-       field: unsigned long mode;      offset:56;tsize:8;
+        field:unsigned long __probe_ip; offset:12;      size:4; signed:0;
+        field:int __probe_nargs;        offset:16;      size:4; signed:1;
+        field:unsigned long dfd;        offset:20;      size:4; signed:0;
+        field:unsigned long filename;   offset:24;      size:4; signed:0;
+        field:unsigned long flags;      offset:28;      size:4; signed:0;
+        field:unsigned long mode;       offset:32;      size:4; signed:0;
 
-print fmt: "(%lx) dfd=%lx filename=%lx flags=%lx mode=%lx", REC->ip, REC->dfd, REC->filename, REC->flags, REC->mode
 
+print fmt: "(%lx) dfd=%lx filename=%lx flags=%lx mode=%lx", REC->__probe_ip,
+REC->dfd, REC->filename, REC->flags, REC->mode
 
  You can see that the event has 4 arguments as in the expressions you specified.
 
@@ -121,6 +123,12 @@ print fmt: "(%lx) dfd=%lx filename=%lx flags=%lx mode=%lx", REC->ip, REC->dfd, R
 
  This clears all probe points.
 
+ Or,
+
+  echo -:myprobe >> kprobe_events
+
+ This clears probe points selectively.
+
  Right after definition, each event is disabled by default. For tracing these
 events, you need to enable it.
 
@@ -146,4 +154,3 @@ events, you need to enable it.
 returns from SYMBOL(e.g. "sys_open+0x1b/0x1d <- do_sys_open" means kernel
 returns from do_sys_open to sys_open+0x1b).
 
-
index 7539e8fa1ffd91ba02dcbc2c4a422e0d2dd24d9e..16ca030e11856d93f246e86c8812784aff6837d9 100644 (file)
@@ -26,3 +26,4 @@
  25 -> Compro VideoMate E800                               [1858:e800]
  26 -> Hauppauge WinTV-HVR1290                             [0070:8551]
  27 -> Mygica X8558 PRO DMB-TH                             [14f1:8578]
+ 28 -> LEADTEK WinFast PxTV1200                            [107d:6f22]
index fce1e7eb047484bf7c50fd019a3e3842fd9434ce..b4a767060ed775f24f037ec858e58b41f2e0a8bc 100644 (file)
 173 -> Zolid Hybrid TV Tuner PCI                [1131:2004]
 174 -> Asus Europa Hybrid OEM                   [1043:4847]
 175 -> Leadtek Winfast DTV1000S                 [107d:6655]
+176 -> Beholder BeholdTV 505 RDS                [0000:5051]
index e0d298fe8830ce7f69e434a1542f632d56b7c286..9b2e0dd6017ed6b14d369e88a7dcbd02a4fb4808 100644 (file)
@@ -81,3 +81,4 @@ tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough
 tuner=81 - Partsnic (Daewoo) PTI-5NF05
 tuner=82 - Philips CU1216L
 tuner=83 - NXP TDA18271
+tuner=84 - Sony BTF-Pxn01Z
diff --git a/Documentation/video4linux/README.tlg2300 b/Documentation/video4linux/README.tlg2300
new file mode 100644 (file)
index 0000000..416ccb9
--- /dev/null
@@ -0,0 +1,47 @@
+tlg2300 release notes
+====================
+
+This is a v4l2/dvb device driver for the tlg2300 chip.
+
+
+current status
+==============
+
+video
+       - support mmap and read().(no overlay)
+
+audio
+       - The driver will register a ALSA card for the audio input.
+
+vbi
+       - Works for almost TV norms.
+
+dvb-t
+       - works for DVB-T
+
+FM
+       - Works for radio.
+
+---------------------------------------------------------------------------
+TESTED APPLICATIONS:
+
+-VLC1.0.4 test the video and dvb. The GUI is friendly to use.
+
+-Mplayer test the video.
+
+-Mplayer test the FM. The mplayer should be compiled with --enable-radio and
+        --enable-radio-capture.
+       The command runs as this(The alsa audio registers to card 1):
+       #mplayer radio://103.7/capture/ -radio adevice=hw=1,0:arate=48000 \
+               -rawaudio rate=48000:channels=2
+
+---------------------------------------------------------------------------
+KNOWN PROBLEMS:
+about preemphasis:
+       You can set the preemphasis for radio by the following command:
+       #v4l2-ctl -d /dev/radio0 --set-ctrl=pre_emphasis_settings=1
+
+       "pre_emphasis_settings=1" means that you select the 50us. If you want
+       to select the 75us, please use "pre_emphasis_settings=2"
+
+
index 1800a62cf13538e72e61d90e23d0abf327159210..181b9e6fd984ec62a80f5ba423566b85b0332572 100644 (file)
@@ -42,6 +42,7 @@ ov519         041e:4064       Creative Live! VISTA VF0420
 ov519          041e:4067       Creative Live! Cam Video IM (VF0350)
 ov519          041e:4068       Creative Live! VISTA VF0470
 spca561                0458:7004       Genius VideoCAM Express V2
+sn9c2028       0458:7005       Genius Smart 300, version 2
 sunplus                0458:7006       Genius Dsc 1.3 Smart
 zc3xx          0458:7007       Genius VideoCam V2
 zc3xx          0458:700c       Genius VideoCam V3
@@ -109,6 +110,7 @@ sunplus             04a5:3003       Benq DC 1300
 sunplus                04a5:3008       Benq DC 1500
 sunplus                04a5:300a       Benq DC 3410
 spca500                04a5:300c       Benq DC 1016
+benq           04a5:3035       Benq DC E300
 finepix                04cb:0104       Fujifilm FinePix 4800
 finepix                04cb:0109       Fujifilm FinePix A202
 finepix                04cb:010b       Fujifilm FinePix A203
@@ -142,6 +144,7 @@ sunplus             04fc:5360       Sunplus Generic
 spca500                04fc:7333       PalmPixDC85
 sunplus                04fc:ffff       Pure DigitalDakota
 spca501                0506:00df       3Com HomeConnect Lite
+sunplus                052b:1507       Megapixel 5 Pretec DC-1007
 sunplus                052b:1513       Megapix V4
 sunplus                052b:1803       MegaImage VI
 tv8532         0545:808b       Veo Stingray
@@ -151,6 +154,7 @@ sunplus             0546:3191       Polaroid Ion 80
 sunplus                0546:3273       Polaroid PDC2030
 ov519          054c:0154       Sonny toy4
 ov519          054c:0155       Sonny toy5
+cpia1          0553:0002       CPIA CPiA (version1) based cameras
 zc3xx          055f:c005       Mustek Wcam300A
 spca500                055f:c200       Mustek Gsmart 300
 sunplus                055f:c211       Kowa Bs888e Microcamera
@@ -188,8 +192,7 @@ spca500             06bd:0404       Agfa CL20
 spca500                06be:0800       Optimedia
 sunplus                06d6:0031       Trust 610 LCD PowerC@m Zoom
 spca506                06e1:a190       ADS Instant VCD
-ov534          06f8:3002       Hercules Blog Webcam
-ov534          06f8:3003       Hercules Dualpix HD Weblog
+ov534_9                06f8:3003       Hercules Dualpix HD Weblog
 sonixj         06f8:3004       Hercules Classic Silver
 sonixj         06f8:3008       Hercules Deluxe Optical Glass
 pac7302                06f8:3009       Hercules Classic Link
@@ -204,6 +207,7 @@ sunplus             0733:2221       Mercury Digital Pro 3.1p
 sunplus                0733:3261       Concord 3045 spca536a
 sunplus                0733:3281       Cyberpix S550V
 spca506                0734:043b       3DeMon USB Capture aka
+cpia1          0813:0001       QX3 camera
 ov519          0813:0002       Dual Mode USB Camera Plus
 spca500                084d:0003       D-Link DSC-350
 spca500                08ca:0103       Aiptek PocketDV
@@ -225,7 +229,8 @@ sunplus             08ca:2050       Medion MD 41437
 sunplus                08ca:2060       Aiptek PocketDV5300
 tv8532         0923:010f       ICM532 cams
 mars           093a:050f       Mars-Semi Pc-Camera
-mr97310a       093a:010f       Sakar Digital no. 77379
+mr97310a       093a:010e       All known CIF cams with this ID
+mr97310a       093a:010f       All known VGA cams with this ID
 pac207         093a:2460       Qtec Webcam 100
 pac207         093a:2461       HP Webcam
 pac207         093a:2463       Philips SPC 220 NC
@@ -302,6 +307,7 @@ sonixj              0c45:613b       Surfer SN-206
 sonixj         0c45:613c       Sonix Pccam168
 sonixj         0c45:6143       Sonix Pccam168
 sonixj         0c45:6148       Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia
+sonixj         0c45:614a       Frontech E-Ccam (JIL-2225)
 sn9c20x                0c45:6240       PC Camera (SN9C201 + MT9M001)
 sn9c20x                0c45:6242       PC Camera (SN9C201 + MT9M111)
 sn9c20x                0c45:6248       PC Camera (SN9C201 + OV9655)
@@ -324,6 +330,10 @@ sn9c20x            0c45:62b0       PC Camera (SN9C202 + MT9V011/MT9V111/MT9V112)
 sn9c20x                0c45:62b3       PC Camera (SN9C202 + OV9655)
 sn9c20x                0c45:62bb       PC Camera (SN9C202 + OV7660)
 sn9c20x                0c45:62bc       PC Camera (SN9C202 + HV7131R)
+sn9c2028       0c45:8001       Wild Planet Digital Spy Camera
+sn9c2028       0c45:8003       Sakar #11199, #6637x, #67480 keychain cams
+sn9c2028       0c45:8008       Mini-Shotz ms-350
+sn9c2028       0c45:800a       Vivitar Vivicam 3350B
 sunplus                0d64:0303       Sunplus FashionCam DXG
 ov519          0e96:c001       TRUST 380 USB2 SPACEC@M
 etoms          102c:6151       Qcam Sangha CIF
@@ -341,10 +351,11 @@ spca501           1776:501c       Arowana 300K CMOS Camera
 t613           17a1:0128       TASCORP JPEG Webcam, NGS Cyclops
 vc032x         17ef:4802       Lenovo Vc0323+MI1310_SOC
 pac207         2001:f115       D-Link DSB-C120
-sq905c         2770:9050       sq905c
-sq905c         2770:905c       DualCamera
-sq905          2770:9120       Argus Digital Camera DC1512
-sq905c         2770:913d       sq905c
+sq905c         2770:9050       Disney pix micro (CIF)
+sq905c         2770:9052       Disney pix micro 2 (VGA)
+sq905c         2770:905c       All 11 known cameras with this ID
+sq905          2770:9120       All 24 known cameras with this ID
+sq905c         2770:913d       All 4 known cameras with this ID
 spca500                2899:012c       Toptro Industrial
 ov519          8020:ef04       ov519
 spca508                8086:0110       Intel Easy PC Camera
index 74d677c8b036c076b49ffa8cc287f7948fe9f0e1..5155700c206b9bcd35d8edbdbb1c0bf56679e3d7 100644 (file)
@@ -599,99 +599,13 @@ video_device::minor fields.
 video buffer helper functions
 -----------------------------
 
-The v4l2 core API provides a standard method for dealing with video
-buffers. Those methods allow a driver to implement read(), mmap() and
-overlay() on a consistent way.
-
-There are currently methods for using video buffers on devices that
-supports DMA with scatter/gather method (videobuf-dma-sg), DMA with
-linear access (videobuf-dma-contig), and vmalloced buffers, mostly
-used on USB drivers (videobuf-vmalloc).
-
-Any driver using videobuf should provide operations (callbacks) for
-four handlers:
-
-ops->buf_setup   - calculates the size of the video buffers and avoid they
-                  to waste more than some maximum limit of RAM;
-ops->buf_prepare - fills the video buffer structs and calls
-                  videobuf_iolock() to alloc and prepare mmaped memory;
-ops->buf_queue   - advices the driver that another buffer were
-                  requested (by read() or by QBUF);
-ops->buf_release - frees any buffer that were allocated.
-
-In order to use it, the driver need to have a code (generally called at
-interrupt context) that will properly handle the buffer request lists,
-announcing that a new buffer were filled.
-
-The irq handling code should handle the videobuf task lists, in order
-to advice videobuf that a new frame were filled, in order to honor to a
-request. The code is generally like this one:
-       if (list_empty(&dma_q->active))
-               return;
-
-       buf = list_entry(dma_q->active.next, struct vbuffer, vb.queue);
-
-       if (!waitqueue_active(&buf->vb.done))
-               return;
-
-       /* Some logic to handle the buf may be needed here */
-
-       list_del(&buf->vb.queue);
-       do_gettimeofday(&buf->vb.ts);
-       wake_up(&buf->vb.done);
-
-Those are the videobuffer functions used on drivers, implemented on
-videobuf-core:
-
-- Videobuf init functions
-  videobuf_queue_sg_init()
-      Initializes the videobuf infrastructure. This function should be
-      called before any other videobuf function on drivers that uses DMA
-      Scatter/Gather buffers.
-
-  videobuf_queue_dma_contig_init
-      Initializes the videobuf infrastructure. This function should be
-      called before any other videobuf function on drivers that need DMA
-      contiguous buffers.
-
-  videobuf_queue_vmalloc_init()
-      Initializes the videobuf infrastructure. This function should be
-      called before any other videobuf function on USB (and other drivers)
-      that need a vmalloced type of videobuf.
-
-- videobuf_iolock()
-  Prepares the videobuf memory for the proper method (read, mmap, overlay).
-
-- videobuf_queue_is_busy()
-  Checks if a videobuf is streaming.
-
-- videobuf_queue_cancel()
-  Stops video handling.
-
-- videobuf_mmap_free()
-  frees mmap buffers.
-
-- videobuf_stop()
-  Stops video handling, ends mmap and frees mmap and other buffers.
-
-- V4L2 api functions. Those functions correspond to VIDIOC_foo ioctls:
-   videobuf_reqbufs(), videobuf_querybuf(), videobuf_qbuf(),
-   videobuf_dqbuf(), videobuf_streamon(), videobuf_streamoff().
-
-- V4L1 api function (corresponds to VIDIOCMBUF ioctl):
-   videobuf_cgmbuf()
-      This function is used to provide backward compatibility with V4L1
-      API.
-
-- Some help functions for read()/poll() operations:
-   videobuf_read_stream()
-      For continuous stream read()
-   videobuf_read_one()
-      For snapshot read()
-   videobuf_poll_stream()
-      polling help function
-
-The better way to understand it is to take a look at vivi driver. One
-of the main reasons for vivi is to be a videobuf usage example. the
-vivi_thread_tick() does the task that the IRQ callback would do on PCI
-drivers (or the irq callback on USB).
+The v4l2 core API provides a set of standard methods (called "videobuf")
+for dealing with video buffers. Those methods allow a driver to implement
+read(), mmap() and overlay() in a consistent way.  There are currently
+methods for using video buffers on devices that supports DMA with
+scatter/gather method (videobuf-dma-sg), DMA with linear access
+(videobuf-dma-contig), and vmalloced buffers, mostly used on USB drivers
+(videobuf-vmalloc).
+
+Please see Documentation/video4linux/videobuf for more information on how
+to use the videobuf layer.
diff --git a/Documentation/video4linux/videobuf b/Documentation/video4linux/videobuf
new file mode 100644 (file)
index 0000000..17a1f9a
--- /dev/null
@@ -0,0 +1,360 @@
+An introduction to the videobuf layer
+Jonathan Corbet <corbet@lwn.net>
+Current as of 2.6.33
+
+The videobuf layer functions as a sort of glue layer between a V4L2 driver
+and user space.  It handles the allocation and management of buffers for
+the storage of video frames.  There is a set of functions which can be used
+to implement many of the standard POSIX I/O system calls, including read(),
+poll(), and, happily, mmap().  Another set of functions can be used to
+implement the bulk of the V4L2 ioctl() calls related to streaming I/O,
+including buffer allocation, queueing and dequeueing, and streaming
+control.  Using videobuf imposes a few design decisions on the driver
+author, but the payback comes in the form of reduced code in the driver and
+a consistent implementation of the V4L2 user-space API.
+
+Buffer types
+
+Not all video devices use the same kind of buffers.  In fact, there are (at
+least) three common variations:
+
+ - Buffers which are scattered in both the physical and (kernel) virtual
+   address spaces.  (Almost) all user-space buffers are like this, but it
+   makes great sense to allocate kernel-space buffers this way as well when
+   it is possible.  Unfortunately, it is not always possible; working with
+   this kind of buffer normally requires hardware which can do
+   scatter/gather DMA operations.
+
+ - Buffers which are physically scattered, but which are virtually
+   contiguous; buffers allocated with vmalloc(), in other words.  These
+   buffers are just as hard to use for DMA operations, but they can be
+   useful in situations where DMA is not available but virtually-contiguous
+   buffers are convenient.
+
+ - Buffers which are physically contiguous.  Allocation of this kind of
+   buffer can be unreliable on fragmented systems, but simpler DMA
+   controllers cannot deal with anything else.
+
+Videobuf can work with all three types of buffers, but the driver author
+must pick one at the outset and design the driver around that decision.
+
+[It's worth noting that there's a fourth kind of buffer: "overlay" buffers
+which are located within the system's video memory.  The overlay
+functionality is considered to be deprecated for most use, but it still
+shows up occasionally in system-on-chip drivers where the performance
+benefits merit the use of this technique.  Overlay buffers can be handled
+as a form of scattered buffer, but there are very few implementations in
+the kernel and a description of this technique is currently beyond the
+scope of this document.]
+
+Data structures, callbacks, and initialization
+
+Depending on which type of buffers are being used, the driver should
+include one of the following files:
+
+    <media/videobuf-dma-sg.h>          /* Physically scattered */
+    <media/videobuf-vmalloc.h>         /* vmalloc() buffers    */
+    <media/videobuf-dma-contig.h>      /* Physically contiguous */
+
+The driver's data structure describing a V4L2 device should include a
+struct videobuf_queue instance for the management of the buffer queue,
+along with a list_head for the queue of available buffers.  There will also
+need to be an interrupt-safe spinlock which is used to protect (at least)
+the queue.
+
+The next step is to write four simple callbacks to help videobuf deal with
+the management of buffers:
+
+    struct videobuf_queue_ops {
+       int (*buf_setup)(struct videobuf_queue *q,
+                        unsigned int *count, unsigned int *size);
+       int (*buf_prepare)(struct videobuf_queue *q,
+                          struct videobuf_buffer *vb,
+                          enum v4l2_field field);
+       void (*buf_queue)(struct videobuf_queue *q,
+                         struct videobuf_buffer *vb);
+       void (*buf_release)(struct videobuf_queue *q,
+                           struct videobuf_buffer *vb);
+    };
+
+buf_setup() is called early in the I/O process, when streaming is being
+initiated; its purpose is to tell videobuf about the I/O stream.  The count
+parameter will be a suggested number of buffers to use; the driver should
+check it for rationality and adjust it if need be.  As a practical rule, a
+minimum of two buffers are needed for proper streaming, and there is
+usually a maximum (which cannot exceed 32) which makes sense for each
+device.  The size parameter should be set to the expected (maximum) size
+for each frame of data.
+
+Each buffer (in the form of a struct videobuf_buffer pointer) will be
+passed to buf_prepare(), which should set the buffer's size, width, height,
+and field fields properly.  If the buffer's state field is
+VIDEOBUF_NEEDS_INIT, the driver should pass it to:
+
+    int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
+                       struct v4l2_framebuffer *fbuf);
+
+Among other things, this call will usually allocate memory for the buffer.
+Finally, the buf_prepare() function should set the buffer's state to
+VIDEOBUF_PREPARED.
+
+When a buffer is queued for I/O, it is passed to buf_queue(), which should
+put it onto the driver's list of available buffers and set its state to
+VIDEOBUF_QUEUED.  Note that this function is called with the queue spinlock
+held; if it tries to acquire it as well things will come to a screeching
+halt.  Yes, this is the voice of experience.  Note also that videobuf may
+wait on the first buffer in the queue; placing other buffers in front of it
+could again gum up the works.  So use list_add_tail() to enqueue buffers.
+
+Finally, buf_release() is called when a buffer is no longer intended to be
+used.  The driver should ensure that there is no I/O active on the buffer,
+then pass it to the appropriate free routine(s):
+
+    /* Scatter/gather drivers */
+    int videobuf_dma_unmap(struct videobuf_queue *q,
+                          struct videobuf_dmabuf *dma);
+    int videobuf_dma_free(struct videobuf_dmabuf *dma);
+
+    /* vmalloc drivers */
+    void videobuf_vmalloc_free (struct videobuf_buffer *buf);
+
+    /* Contiguous drivers */
+    void videobuf_dma_contig_free(struct videobuf_queue *q,
+                                 struct videobuf_buffer *buf);
+
+One way to ensure that a buffer is no longer under I/O is to pass it to:
+
+    int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
+
+Here, vb is the buffer, non_blocking indicates whether non-blocking I/O
+should be used (it should be zero in the buf_release() case), and intr
+controls whether an interruptible wait is used.
+
+File operations
+
+At this point, much of the work is done; much of the rest is slipping
+videobuf calls into the implementation of the other driver callbacks.  The
+first step is in the open() function, which must initialize the
+videobuf queue.  The function to use depends on the type of buffer used:
+
+    void videobuf_queue_sg_init(struct videobuf_queue *q,
+                               struct videobuf_queue_ops *ops,
+                               struct device *dev,
+                               spinlock_t *irqlock,
+                               enum v4l2_buf_type type,
+                               enum v4l2_field field,
+                               unsigned int msize,
+                               void *priv);
+
+    void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
+                               struct videobuf_queue_ops *ops,
+                               struct device *dev,
+                               spinlock_t *irqlock,
+                               enum v4l2_buf_type type,
+                               enum v4l2_field field,
+                               unsigned int msize,
+                               void *priv);
+
+    void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
+                                      struct videobuf_queue_ops *ops,
+                                      struct device *dev,
+                                      spinlock_t *irqlock,
+                                      enum v4l2_buf_type type,
+                                      enum v4l2_field field,
+                                      unsigned int msize,
+                                      void *priv);
+
+In each case, the parameters are the same: q is the queue structure for the
+device, ops is the set of callbacks as described above, dev is the device
+structure for this video device, irqlock is an interrupt-safe spinlock to
+protect access to the data structures, type is the buffer type used by the
+device (cameras will use V4L2_BUF_TYPE_VIDEO_CAPTURE, for example), field
+describes which field is being captured (often V4L2_FIELD_NONE for
+progressive devices), msize is the size of any containing structure used
+around struct videobuf_buffer, and priv is a private data pointer which
+shows up in the priv_data field of struct videobuf_queue.  Note that these
+are void functions which, evidently, are immune to failure.
+
+V4L2 capture drivers can be written to support either of two APIs: the
+read() system call and the rather more complicated streaming mechanism.  As
+a general rule, it is necessary to support both to ensure that all
+applications have a chance of working with the device.  Videobuf makes it
+easy to do that with the same code.  To implement read(), the driver need
+only make a call to one of:
+
+    ssize_t videobuf_read_one(struct videobuf_queue *q,
+                             char __user *data, size_t count,
+                             loff_t *ppos, int nonblocking);
+
+    ssize_t videobuf_read_stream(struct videobuf_queue *q,
+                                char __user *data, size_t count,
+                                loff_t *ppos, int vbihack, int nonblocking);
+
+Either one of these functions will read frame data into data, returning the
+amount actually read; the difference is that videobuf_read_one() will only
+read a single frame, while videobuf_read_stream() will read multiple frames
+if they are needed to satisfy the count requested by the application.  A
+typical driver read() implementation will start the capture engine, call
+one of the above functions, then stop the engine before returning (though a
+smarter implementation might leave the engine running for a little while in
+anticipation of another read() call happening in the near future).
+
+The poll() function can usually be implemented with a direct call to:
+
+    unsigned int videobuf_poll_stream(struct file *file,
+                                     struct videobuf_queue *q,
+                                     poll_table *wait);
+
+Note that the actual wait queue eventually used will be the one associated
+with the first available buffer.
+
+When streaming I/O is done to kernel-space buffers, the driver must support
+the mmap() system call to enable user space to access the data.  In many
+V4L2 drivers, the often-complex mmap() implementation simplifies to a
+single call to:
+
+    int videobuf_mmap_mapper(struct videobuf_queue *q,
+                            struct vm_area_struct *vma);
+
+Everything else is handled by the videobuf code.
+
+The release() function requires two separate videobuf calls:
+
+    void videobuf_stop(struct videobuf_queue *q);
+    int videobuf_mmap_free(struct videobuf_queue *q);
+
+The call to videobuf_stop() terminates any I/O in progress - though it is
+still up to the driver to stop the capture engine.  The call to
+videobuf_mmap_free() will ensure that all buffers have been unmapped; if
+so, they will all be passed to the buf_release() callback.  If buffers
+remain mapped, videobuf_mmap_free() returns an error code instead.  The
+purpose is clearly to cause the closing of the file descriptor to fail if
+buffers are still mapped, but every driver in the 2.6.32 kernel cheerfully
+ignores its return value.
+
+ioctl() operations
+
+The V4L2 API includes a very long list of driver callbacks to respond to
+the many ioctl() commands made available to user space.  A number of these
+- those associated with streaming I/O - turn almost directly into videobuf
+calls.  The relevant helper functions are:
+
+    int videobuf_reqbufs(struct videobuf_queue *q,
+                        struct v4l2_requestbuffers *req);
+    int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b);
+    int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b);
+    int videobuf_dqbuf(struct videobuf_queue *q, struct v4l2_buffer *b,
+                      int nonblocking);
+    int videobuf_streamon(struct videobuf_queue *q);
+    int videobuf_streamoff(struct videobuf_queue *q);
+    int videobuf_cgmbuf(struct videobuf_queue *q, struct video_mbuf *mbuf,
+                       int count);
+
+So, for example, a VIDIOC_REQBUFS call turns into a call to the driver's
+vidioc_reqbufs() callback which, in turn, usually only needs to locate the
+proper struct videobuf_queue pointer and pass it to videobuf_reqbufs().
+These support functions can replace a great deal of buffer management
+boilerplate in a lot of V4L2 drivers.
+
+The vidioc_streamon() and vidioc_streamoff() functions will be a bit more
+complex, of course, since they will also need to deal with starting and
+stopping the capture engine.  videobuf_cgmbuf(), called from the driver's
+vidiocgmbuf() function, only exists if the V4L1 compatibility module has
+been selected with CONFIG_VIDEO_V4L1_COMPAT, so its use must be surrounded
+with #ifdef directives.
+
+Buffer allocation
+
+Thus far, we have talked about buffers, but have not looked at how they are
+allocated.  The scatter/gather case is the most complex on this front.  For
+allocation, the driver can leave buffer allocation entirely up to the
+videobuf layer; in this case, buffers will be allocated as anonymous
+user-space pages and will be very scattered indeed.  If the application is
+using user-space buffers, no allocation is needed; the videobuf layer will
+take care of calling get_user_pages() and filling in the scatterlist array.
+
+If the driver needs to do its own memory allocation, it should be done in
+the vidioc_reqbufs() function, *after* calling videobuf_reqbufs().  The
+first step is a call to:
+
+    struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
+
+The returned videobuf_dmabuf structure (defined in
+<media/videobuf-dma-sg.h>) includes a couple of relevant fields:
+
+    struct scatterlist  *sglist;
+    int                 sglen;
+
+The driver must allocate an appropriately-sized scatterlist array and
+populate it with pointers to the pieces of the allocated buffer; sglen
+should be set to the length of the array.
+
+Drivers using the vmalloc() method need not (and cannot) concern themselves
+with buffer allocation at all; videobuf will handle those details.  The
+same is normally true of contiguous-DMA drivers as well; videobuf will
+allocate the buffers (with dma_alloc_coherent()) when it sees fit.  That
+means that these drivers may be trying to do high-order allocations at any
+time, an operation which is not always guaranteed to work.  Some drivers
+play tricks by allocating DMA space at system boot time; videobuf does not
+currently play well with those drivers.
+
+As of 2.6.31, contiguous-DMA drivers can work with a user-supplied buffer,
+as long as that buffer is physically contiguous.  Normal user-space
+allocations will not meet that criterion, but buffers obtained from other
+kernel drivers, or those contained within huge pages, will work with these
+drivers.
+
+Filling the buffers
+
+The final part of a videobuf implementation has no direct callback - it's
+the portion of the code which actually puts frame data into the buffers,
+usually in response to interrupts from the device.  For all types of
+drivers, this process works approximately as follows:
+
+ - Obtain the next available buffer and make sure that somebody is actually
+   waiting for it.
+
+ - Get a pointer to the memory and put video data there.
+
+ - Mark the buffer as done and wake up the process waiting for it.
+
+Step (1) above is done by looking at the driver-managed list_head structure
+- the one which is filled in the buf_queue() callback.  Because starting
+the engine and enqueueing buffers are done in separate steps, it's possible
+for the engine to be running without any buffers available - in the
+vmalloc() case especially.  So the driver should be prepared for the list
+to be empty.  It is equally possible that nobody is yet interested in the
+buffer; the driver should not remove it from the list or fill it until a
+process is waiting on it.  That test can be done by examining the buffer's
+done field (a wait_queue_head_t structure) with waitqueue_active().
+
+A buffer's state should be set to VIDEOBUF_ACTIVE before being mapped for
+DMA; that ensures that the videobuf layer will not try to do anything with
+it while the device is transferring data.
+
+For scatter/gather drivers, the needed memory pointers will be found in the
+scatterlist structure described above.  Drivers using the vmalloc() method
+can get a memory pointer with:
+
+    void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
+
+For contiguous DMA drivers, the function to use is:
+
+    dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
+
+The contiguous DMA API goes out of its way to hide the kernel-space address
+of the DMA buffer from drivers.
+
+The final step is to set the size field of the relevant videobuf_buffer
+structure to the actual size of the captured image, set state to
+VIDEOBUF_DONE, then call wake_up() on the done queue.  At this point, the
+buffer is owned by the videobuf layer and the driver should not touch it
+again.
+
+Developers who are interested in more information can go into the relevant
+header files; there are a few low-level functions declared there which have
+not been talked about here.  Also worthwhile is the vivi driver
+(drivers/media/video/vivi.c), which is maintained as an example of how V4L2
+drivers should be written.  Vivi only uses the vmalloc() API, but it's good
+enough to get started with.  Note also that all of these calls are exported
+GPL-only, so they will not be available to non-GPL kernel modules.
index 29a6ff8bc7d34f02c99c402e048851ab3715a995..7fbbaf85f5b7ec8c0ada7cdd878ea5f201f27fa9 100644 (file)
@@ -166,19 +166,13 @@ NUMA
 
   numa=noacpi   Don't parse the SRAT table for NUMA setup
 
-  numa=fake=CMDLINE
-               If a number, fakes CMDLINE nodes and ignores NUMA setup of the
-               actual machine.  Otherwise, system memory is configured
-               depending on the sizes and coefficients listed.  For example:
-                       numa=fake=2*512,1024,4*256,*128
-               gives two 512M nodes, a 1024M node, four 256M nodes, and the
-               rest split into 128M chunks.  If the last character of CMDLINE
-               is a *, the remaining memory is divided up equally among its
-               coefficient:
-                       numa=fake=2*512,2*
-               gives two 512M nodes and the rest split into two nodes.
-               Otherwise, the remaining system RAM is allocated to an
-               additional node.
+  numa=fake=<size>[MG]
+               If given as a memory unit, fills all system RAM with nodes of
+               size interleaved over physical nodes.
+
+  numa=fake=<N>
+               If given as an integer, fills all system RAM with N fake nodes
+               interleaved over physical nodes.
 
 ACPI
 
index c8f47bf154f4b844ce01ce972a0c38f552a2070e..f520dd0862b1bcf25202ad96b2f069bd33ba799b 100644 (file)
@@ -221,6 +221,7 @@ F:  drivers/net/acenic*
 
 ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER
 M:     Peter Feuerer <peter@piie.net>
+L:     platform-driver-x86@vger.kernel.org
 W:     http://piie.net/?section=acerhdf
 S:     Maintained
 F:     drivers/platform/x86/acerhdf.c
@@ -228,6 +229,7 @@ F:  drivers/platform/x86/acerhdf.c
 ACER WMI LAPTOP EXTRAS
 M:     Carlos Corbacho <carlos@strangeworlds.co.uk>
 L:     aceracpi@googlegroups.com (subscribers-only)
+L:     platform-driver-x86@vger.kernel.org
 W:     http://code.google.com/p/aceracpi
 S:     Maintained
 F:     drivers/platform/x86/acer-wmi.c
@@ -288,7 +290,7 @@ F:  drivers/acpi/video.c
 
 ACPI WMI DRIVER
 M:     Carlos Corbacho <carlos@strangeworlds.co.uk>
-L:     linux-acpi@vger.kernel.org
+L:     platform-driver-x86@vger.kernel.org
 W:     http://www.lesswatts.org/projects/acpi/
 S:     Maintained
 F:     drivers/platform/x86/wmi.c
@@ -410,9 +412,8 @@ F:  drivers/i2c/busses/i2c-ali1563.c
 
 ALPHA PORT
 M:     Richard Henderson <rth@twiddle.net>
-S:     Odd Fixes for 2.4; Maintained for 2.6.
 M:     Ivan Kokshaysky <ink@jurassic.park.msu.ru>
-S:     Maintained for 2.4; PCI support for 2.6.
+M:     Matt Turner <mattst88@gmail.com>
 L:     linux-alpha@vger.kernel.org
 F:     arch/alpha/
 
@@ -617,10 +618,10 @@ M:        Richard Purdie <rpurdie@rpsys.net>
 S:     Maintained
 
 ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE
-M:     Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
+M:     Paulius Zaleckas <paulius.zaleckas@gmail.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 T:     git git://gitorious.org/linux-gemini/mainline.git
-S:     Maintained
+S:     Odd Fixes
 F:     arch/arm/mach-gemini/
 
 ARM/EBSA110 MACHINE SUPPORT
@@ -642,9 +643,9 @@ T:  topgit git://git.openezx.org/openezx.git
 F:     arch/arm/mach-pxa/ezx.c
 
 ARM/FARADAY FA526 PORT
-M:     Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
+M:     Paulius Zaleckas <paulius.zaleckas@gmail.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-S:     Maintained
+S:     Odd Fixes
 F:     arch/arm/mm/*-fa*
 
 ARM/FOOTBRIDGE ARCHITECTURE
@@ -969,6 +970,7 @@ ASUS ACPI EXTRAS DRIVER
 M:     Corentin Chary <corentincj@iksaif.net>
 M:     Karol Kozimor <sziwan@users.sourceforge.net>
 L:     acpi4asus-user@lists.sourceforge.net
+L:     platform-driver-x86@vger.kernel.org
 W:     http://acpi4asus.sf.net
 S:     Maintained
 F:     drivers/platform/x86/asus_acpi.c
@@ -982,13 +984,13 @@ F:        drivers/hwmon/asb100.c
 ASUS LAPTOP EXTRAS DRIVER
 M:     Corentin Chary <corentincj@iksaif.net>
 L:     acpi4asus-user@lists.sourceforge.net
+L:     platform-driver-x86@vger.kernel.org
 W:     http://acpi4asus.sf.net
 S:     Maintained
 F:     drivers/platform/x86/asus-laptop.c
 
 ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
 M:     Dan Williams <dan.j.williams@intel.com>
-M:     Maciej Sosnowski <maciej.sosnowski@intel.com>
 W:     http://sourceforge.net/projects/xscaleiop
 S:     Supported
 F:     Documentation/crypto/async-tx-api.txt
@@ -1475,6 +1477,7 @@ F:        drivers/scsi/fnic/
 CMPC ACPI DRIVER
 M:     Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
 M:     Daniel Oliveira Nascimento <don@syst.com.br>
+L:     platform-driver-x86@vger.kernel.org
 S:     Supported
 F:     drivers/platform/x86/classmate-laptop.c
 
@@ -1518,6 +1521,7 @@ F:        drivers/pci/hotplug/cpcihp_generic.c
 
 COMPAL LAPTOP SUPPORT
 M:     Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
+L:     platform-driver-x86@vger.kernel.org
 S:     Maintained
 F:     drivers/platform/x86/compal-laptop.c
 
@@ -1638,9 +1642,8 @@ S:        Maintained
 F:     sound/pci/cs5535audio/
 
 CX18 VIDEO4LINUX DRIVER
-M:     Hans Verkuil <hverkuil@xs4all.nl>
 M:     Andy Walls <awalls@radix.net>
-L:     ivtv-devel@ivtvdriver.org
+L:     ivtv-devel@ivtvdriver.org (moderated for non-subscribers)
 L:     linux-media@vger.kernel.org
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
 W:     http://linuxtv.org
@@ -1736,10 +1739,9 @@ F:       include/linux/tfrc.h
 F:     net/dccp/
 
 DECnet NETWORK LAYER
-M:     Christine Caulfield <christine.caulfield@googlemail.com>
 W:     http://linux-decnet.sourceforge.net
 L:     linux-decnet-user@lists.sourceforge.net
-S:     Maintained
+S:     Orphan
 F:     Documentation/networking/decnet.txt
 F:     net/decnet/
 
@@ -1750,6 +1752,7 @@ F:        drivers/net/defxx.*
 
 DELL LAPTOP DRIVER
 M:     Matthew Garrett <mjg59@srcf.ucam.org>
+L:     platform-driver-x86@vger.kernel.org
 S:     Maintained
 F:     drivers/platform/x86/dell-laptop.c
 
@@ -1825,7 +1828,6 @@ S:        Supported
 F:     fs/dlm/
 
 DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
-M:     Maciej Sosnowski <maciej.sosnowski@intel.com>
 M:     Dan Williams <dan.j.williams@intel.com>
 S:     Supported
 F:     drivers/dma/
@@ -2033,6 +2035,7 @@ F:        drivers/edac/r82600_edac.c
 EEEPC LAPTOP EXTRAS DRIVER
 M:     Corentin Chary <corentincj@iksaif.net>
 L:     acpi4asus-user@lists.sourceforge.net
+L:     platform-driver-x86@vger.kernel.org
 W:     http://acpi4asus.sf.net
 S:     Maintained
 F:     drivers/platform/x86/eeepc-laptop.c
@@ -2146,6 +2149,17 @@ S:       Supported
 F:     Documentation/fault-injection/
 F:     lib/fault-inject.c
 
+FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
+M:     Robert Love <robert.w.love@intel.com>
+L:     devel@open-fcoe.org
+W:     www.Open-FCoE.org
+S:     Supported
+F:     drivers/scsi/libfc/
+F:     drivers/scsi/fcoe/
+F:     include/scsi/fc/
+F:     include/scsi/libfc.h
+F:     include/scsi/libfcoe.h
+
 FILE LOCKING (flock() and fcntl()/lockf())
 M:     Matthew Wilcox <matthew@wil.cx>
 L:     linux-fsdevel@vger.kernel.org
@@ -2300,7 +2314,7 @@ F:        arch/frv/
 
 FUJITSU LAPTOP EXTRAS
 M:     Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
-L:     linux-acpi@vger.kernel.org
+L:     platform-driver-x86@vger.kernel.org
 S:     Maintained
 F:     drivers/platform/x86/fujitsu-laptop.c
 
@@ -2398,6 +2412,18 @@ L:       linuxppc-dev@ozlabs.org
 S:     Odd Fixes
 F:     drivers/char/hvc_*
 
+VIRTIO CONSOLE DRIVER
+M:     Amit Shah <amit.shah@redhat.com>
+L:     virtualization@lists.linux-foundation.org
+S:     Maintained
+F:     drivers/char/virtio_console.c
+
+iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER
+M:     Peter Jones <pjones@redhat.com>
+M:     Konrad Rzeszutek Wilk <konrad@kernel.org>
+S:     Maintained
+F:     drivers/firmware/iscsi_ibft*
+
 GSPCA FINEPIX SUBDRIVER
 M:     Frank Zago <frank@zago.net>
 L:     linux-media@vger.kernel.org
@@ -2566,6 +2592,7 @@ F:        drivers/net/wireless/hostap/
 
 HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER
 M:     Carlos Corbacho <carlos@strangeworlds.co.uk>
+L:     platform-driver-x86@vger.kernel.org
 S:     Odd Fixes
 F:     drivers/platform/x86/tc1100-wmi.c
 
@@ -2776,7 +2803,7 @@ F:        drivers/video/i810/
 
 INTEL MENLOW THERMAL DRIVER
 M:     Sujith Thomas <sujith.thomas@intel.com>
-L:     linux-acpi@vger.kernel.org
+L:     platform-driver-x86@vger.kernel.org
 W:     http://www.lesswatts.org/projects/acpi/
 S:     Supported
 F:     drivers/platform/x86/intel_menlow.c
@@ -2788,7 +2815,7 @@ F:        arch/x86/kernel/microcode_core.c
 F:     arch/x86/kernel/microcode_intel.c
 
 INTEL I/OAT DMA DRIVER
-M:     Maciej Sosnowski <maciej.sosnowski@intel.com>
+M:     Dan Williams <dan.j.williams@intel.com>
 S:     Supported
 F:     drivers/dma/ioat*
 
@@ -2826,10 +2853,11 @@ L:      netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/ixp2000/
 
-INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/ixgb/ixgbe)
+INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe)
 M:     Jeff Kirsher <jeffrey.t.kirsher@intel.com>
 M:     Jesse Brandeburg <jesse.brandeburg@intel.com>
 M:     Bruce Allan <bruce.w.allan@intel.com>
+M:     Alex Duyck <alexander.h.duyck@intel.com>
 M:     PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
 M:     John Ronciak <john.ronciak@intel.com>
 L:     e1000-devel@lists.sourceforge.net
@@ -2839,6 +2867,7 @@ F:        drivers/net/e100.c
 F:     drivers/net/e1000/
 F:     drivers/net/e1000e/
 F:     drivers/net/igb/
+F:     drivers/net/igbvf/
 F:     drivers/net/ixgb/
 F:     drivers/net/ixgbe/
 
@@ -3012,8 +3041,8 @@ S:        Maintained
 F:     drivers/isdn/hardware/eicon/
 
 IVTV VIDEO4LINUX DRIVER
-M:     Hans Verkuil <hverkuil@xs4all.nl>
-L:     ivtv-devel@ivtvdriver.org
+M:     Andy Walls <awalls@radix.net>
+L:     ivtv-devel@ivtvdriver.org (moderated for non-subscribers)
 L:     linux-media@vger.kernel.org
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
 W:     http://www.ivtvdriver.org
@@ -3413,8 +3442,10 @@ S:       Maintained
 F:     drivers/scsi/sym53c8xx_2/
 
 LTP (Linux Test Project)
-M:     Subrata Modak <subrata@linux.vnet.ibm.com>
-M:     Mike Frysinger <vapier@gentoo.org>
+M:     Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
+M:     Garrett Cooper <yanegomi@gmail.com>
+M:     Mike Frysinger <vapier@gentoo.org>
+M:     Subrata Modak <subrata@linux.vnet.ibm.com>
 L:     ltp-list@lists.sourceforge.net (subscribers-only)
 W:     http://ltp.sourceforge.net/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/galak/ltp.git
@@ -3490,9 +3521,9 @@ S:        Maintained
 F:     drivers/net/wireless/libertas/
 
 MARVELL MV643XX ETHERNET DRIVER
-M:     Lennert Buytenhek <buytenh@marvell.com>
+M:     Lennert Buytenhek <buytenh@wantstofly.org>
 L:     netdev@vger.kernel.org
-S:     Supported
+S:     Maintained
 F:     drivers/net/mv643xx_eth.*
 F:     include/linux/mv643xx.h
 
@@ -3638,6 +3669,7 @@ F:        drivers/char/mxser.*
 
 MSI LAPTOP SUPPORT
 M:     Lennart Poettering <mzxreary@0pointer.de>
+L:     platform-driver-x86@vger.kernel.org
 W:     https://tango.0pointer.de/mailman/listinfo/s270-linux
 W:     http://0pointer.de/lennart/tchibo.html
 S:     Maintained
@@ -3645,6 +3677,7 @@ F:        drivers/platform/x86/msi-laptop.c
 
 MSI WMI SUPPORT
 M:     Anisse Astier <anisse@astier.eu>
+L:     platform-driver-x86@vger.kernel.org
 S:     Supported
 F:     drivers/platform/x86/msi-wmi.c
 
@@ -3838,6 +3871,7 @@ NETWORKING DRIVERS
 L:     netdev@vger.kernel.org
 W:     http://www.linuxfoundation.org/en/Net
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
 S:     Odd Fixes
 F:     drivers/net/
 F:     include/linux/if_*
@@ -4096,6 +4130,7 @@ F:        drivers/i2c/busses/i2c-pasemi.c
 
 PANASONIC LAPTOP ACPI EXTRAS DRIVER
 M:     Harald Welte <laforge@gnumonks.org>
+L:     platform-driver-x86@vger.kernel.org
 S:     Maintained
 F:     drivers/platform/x86/panasonic-laptop.c
 
@@ -4509,7 +4544,7 @@ F:        drivers/net/wireless/ray*
 RCUTORTURE MODULE
 M:     Josh Triplett <josh@freedesktop.org>
 M:     "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
-S:     Maintained
+S:     Supported
 F:     Documentation/RCU/torture.txt
 F:     kernel/rcutorture.c
 
@@ -4534,11 +4569,12 @@ M:      Dipankar Sarma <dipankar@in.ibm.com>
 M:     "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 W:     http://www.rdrop.com/users/paulmck/rclock/
 S:     Supported
-F:     Documentation/RCU/rcu.txt
-F:     Documentation/RCU/rcuref.txt
-F:     include/linux/rcupdate.h
-F:     include/linux/srcu.h
-F:     kernel/rcupdate.c
+F:     Documentation/RCU/
+F:     include/linux/rcu*
+F:     include/linux/srcu*
+F:     kernel/rcu*
+F:     kernel/srcu*
+X:     kernel/rcutorture.c
 
 REAL TIME CLOCK DRIVER
 M:     Paul Gortmaker <p_gortmaker@yahoo.com>
@@ -4676,6 +4712,13 @@ F:       drivers/media/common/saa7146*
 F:     drivers/media/video/*7146*
 F:     include/media/*7146*
 
+TLG2300 VIDEO4LINUX-2 DRIVER
+M:     Huang Shijie <shijie8@gmail.com>
+M:     Kang Yong <kangyong@telegent.com>
+M:     Zhang Xiaobing <xbzhang@telegent.com>
+S:     Supported
+F:     drivers/media/video/tlg2300
+
 SC1200 WDT DRIVER
 M:     Zwane Mwaikambo <zwane@arm.linux.org.uk>
 S:     Maintained
@@ -5034,7 +5077,7 @@ F:        include/linux/ssb/
 
 SONY VAIO CONTROL DEVICE DRIVER
 M:     Mattia Dongili <malattia@linux.it>
-L:     linux-acpi@vger.kernel.org
+L:     platform-driver-x86@vger.kernel.org
 W:     http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
 S:     Maintained
 F:     Documentation/laptops/sony-laptop.txt
@@ -5240,6 +5283,7 @@ F:        arch/xtensa/
 THINKPAD ACPI EXTRAS DRIVER
 M:     Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
 L:     ibm-acpi-devel@lists.sourceforge.net
+L:     platform-driver-x86@vger.kernel.org
 W:     http://ibm-acpi.sourceforge.net
 W:     http://thinkwiki.org/wiki/Ibm-acpi
 T:     git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
@@ -5293,10 +5337,12 @@ F:      security/tomoyo/
 
 TOPSTAR LAPTOP EXTRAS DRIVER
 M:     Herton Ronaldo Krzesinski <herton@mandriva.com.br>
+L:     platform-driver-x86@vger.kernel.org
 S:     Maintained
 F:     drivers/platform/x86/topstar-laptop.c
 
 TOSHIBA ACPI EXTRAS DRIVER
+L:     platform-driver-x86@vger.kernel.org
 S:     Orphan
 F:     drivers/platform/x86/toshiba_acpi.c
 
@@ -6024,6 +6070,12 @@ S:       Maintained
 F:     Documentation/x86/
 F:     arch/x86/
 
+X86 PLATFORM DRIVERS
+M:     Matthew Garrett <mjg@redhat.com>
+L:     platform-driver-x86@vger.kernel.org
+S:     Maintained
+F:     drivers/platform/x86
+
 XEN HYPERVISOR INTERFACE
 M:     Jeremy Fitzhardinge <jeremy@xensource.com>
 M:     Chris Wright <chrisw@sous-sol.org>
index 9f64552f09d6a7bf2bf2dedb4f7e00deca0bcfaa..1b24895212d8d198587bed5152b56a2cef8134c3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 33
-EXTRAVERSION = -rc4
+EXTRAVERSION =
 NAME = Man-Eating Seals of Antiquity
 
 # *DOCUMENTATION*
@@ -18,10 +18,9 @@ MAKEFLAGS += -rR --no-print-directory
 
 # Avoid funny character set dependencies
 unexport LC_ALL
-LC_CTYPE=C
 LC_COLLATE=C
 LC_NUMERIC=C
-export LC_CTYPE LC_COLLATE LC_NUMERIC
+export LC_COLLATE LC_NUMERIC
 
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
index 9d055b4f058556450363c3843ad17f07518fae93..215e46073c453d63a691b4fc02bde826a9d4ad50 100644 (file)
@@ -3,11 +3,9 @@
 #
 
 config OPROFILE
-       tristate "OProfile system profiling (EXPERIMENTAL)"
+       tristate "OProfile system profiling"
        depends on PROFILING
        depends on HAVE_OPROFILE
-       depends on TRACING_SUPPORT
-       select TRACING
        select RING_BUFFER
        select RING_BUFFER_ALLOW_SWAP
        help
@@ -17,20 +15,6 @@ config OPROFILE
 
          If unsure, say N.
 
-config OPROFILE_IBS
-       bool "OProfile AMD IBS support (EXPERIMENTAL)"
-       default n
-       depends on OPROFILE && SMP && X86
-       help
-          Instruction-Based Sampling (IBS) is a new profiling
-          technique that provides rich, precise program performance
-          information. IBS is introduced by AMD Family10h processors
-          (AMD Opteron Quad-Core processor "Barcelona") to overcome
-          the limitations of conventional performance counter
-          sampling.
-
-         If unsure, say N.
-
 config OPROFILE_EVENT_MULTIPLEX
        bool "OProfile multiplexing support (EXPERIMENTAL)"
        default n
@@ -121,6 +105,14 @@ config HAVE_DMA_ATTRS
 config USE_GENERIC_SMP_HELPERS
        bool
 
+config HAVE_REGS_AND_STACK_ACCESS_API
+       bool
+       help
+         This symbol should be selected by an architecure if it supports
+         the API needed to access registers and stack entries from pt_regs,
+         declared in asm/ptrace.h
+         For example the kprobes-based event tracer needs this API.
+
 config HAVE_CLK
        bool
        help
index 36b3a30ba0e519d078d3c4ab9f349ff42aa84b9a..9251e13e144f668d0749528a8ffa2a89497f5730 100644 (file)
@@ -28,6 +28,9 @@ static const struct cpumask *cpumask_of_node(int node)
 {
        int cpu;
 
+       if (node == -1)
+               return cpu_all_mask;
+
        cpumask_clear(&node_to_cpumask_map[node]);
 
        for_each_online_cpu(cpu) {
index a91ba28999b57a03d34036f105fd1070fa8fe2d3..c9ab94ee1ca814090249356df8f90b992c59c5c1 100644 (file)
@@ -126,8 +126,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);
 #define MB                     (1024*KB)
 #define GB                     (1024*MB)
 
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                       resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
@@ -184,7 +184,7 @@ pcibios_align_resource(void *data, struct resource *res,
                }
        }
 
-       res->start = start;
+       return start;
 }
 #undef KB
 #undef MB
index c2238cd474c784e52872627586632f65608281a1..184a6bd548250aaeb6617618fd66e1a34305d144 100644 (file)
@@ -702,6 +702,7 @@ config ARCH_OMAP
        select ARCH_HAS_CPUFREQ
        select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
+       select ARCH_HAS_HOLES_MEMORYMODEL
        help
          Support for TI's OMAP platform (OMAP1 and OMAP2).
 
@@ -729,14 +730,26 @@ config ARCH_U8500
 
 endchoice
 
+source "arch/arm/mach-aaec2000/Kconfig"
+
+source "arch/arm/mach-at91/Kconfig"
+
+source "arch/arm/mach-bcmring/Kconfig"
+
 source "arch/arm/mach-clps711x/Kconfig"
 
+source "arch/arm/mach-davinci/Kconfig"
+
+source "arch/arm/mach-dove/Kconfig"
+
 source "arch/arm/mach-ep93xx/Kconfig"
 
 source "arch/arm/mach-footbridge/Kconfig"
 
 source "arch/arm/mach-gemini/Kconfig"
 
+source "arch/arm/mach-h720x/Kconfig"
+
 source "arch/arm/mach-integrator/Kconfig"
 
 source "arch/arm/mach-iop32x/Kconfig"
@@ -751,16 +764,26 @@ source "arch/arm/mach-ixp2000/Kconfig"
 
 source "arch/arm/mach-ixp23xx/Kconfig"
 
+source "arch/arm/mach-kirkwood/Kconfig"
+
+source "arch/arm/mach-ks8695/Kconfig"
+
+source "arch/arm/mach-lh7a40x/Kconfig"
+
 source "arch/arm/mach-loki/Kconfig"
 
+source "arch/arm/mach-msm/Kconfig"
+
 source "arch/arm/mach-mv78xx0/Kconfig"
 
-source "arch/arm/mach-pxa/Kconfig"
-source "arch/arm/plat-pxa/Kconfig"
+source "arch/arm/plat-mxc/Kconfig"
 
-source "arch/arm/mach-mmp/Kconfig"
+source "arch/arm/mach-netx/Kconfig"
 
-source "arch/arm/mach-sa1100/Kconfig"
+source "arch/arm/mach-nomadik/Kconfig"
+source "arch/arm/plat-nomadik/Kconfig"
+
+source "arch/arm/mach-ns9xxx/Kconfig"
 
 source "arch/arm/plat-omap/Kconfig"
 
@@ -770,9 +793,14 @@ source "arch/arm/mach-omap2/Kconfig"
 
 source "arch/arm/mach-orion5x/Kconfig"
 
-source "arch/arm/mach-kirkwood/Kconfig"
+source "arch/arm/mach-pxa/Kconfig"
+source "arch/arm/plat-pxa/Kconfig"
 
-source "arch/arm/mach-dove/Kconfig"
+source "arch/arm/mach-mmp/Kconfig"
+
+source "arch/arm/mach-realview/Kconfig"
+
+source "arch/arm/mach-sa1100/Kconfig"
 
 source "arch/arm/plat-samsung/Kconfig"
 source "arch/arm/plat-s3c24xx/Kconfig"
@@ -800,41 +828,14 @@ if ARCH_S5PC1XX
 source "arch/arm/mach-s5pc100/Kconfig"
 endif
 
-source "arch/arm/mach-lh7a40x/Kconfig"
+source "arch/arm/mach-u300/Kconfig"
 
-source "arch/arm/mach-h720x/Kconfig"
+source "arch/arm/mach-ux500/Kconfig"
 
 source "arch/arm/mach-versatile/Kconfig"
 
-source "arch/arm/mach-aaec2000/Kconfig"
-
-source "arch/arm/mach-realview/Kconfig"
-
-source "arch/arm/mach-at91/Kconfig"
-
-source "arch/arm/plat-mxc/Kconfig"
-
-source "arch/arm/mach-nomadik/Kconfig"
-source "arch/arm/plat-nomadik/Kconfig"
-
-source "arch/arm/mach-netx/Kconfig"
-
-source "arch/arm/mach-ns9xxx/Kconfig"
-
-source "arch/arm/mach-davinci/Kconfig"
-
-source "arch/arm/mach-ks8695/Kconfig"
-
-source "arch/arm/mach-msm/Kconfig"
-
-source "arch/arm/mach-u300/Kconfig"
-
 source "arch/arm/mach-w90x900/Kconfig"
 
-source "arch/arm/mach-bcmring/Kconfig"
-
-source "arch/arm/mach-ux500/Kconfig"
-
 # Definitions to make life easier
 config ARCH_ACORN
        bool
index e9da08483b3cdb74bd687cf3601ec4dccf395c25..356d702c080867183f9dd9f9c16dd5826426354a 100644 (file)
@@ -94,7 +94,7 @@ CFLAGS_ABI    +=-funwind-tables
 endif
 
 ifeq ($(CONFIG_THUMB2_KERNEL),y)
-AFLAGS_AUTOIT  :=$(call as-option,-Wa$(comma)-mimplicit-it=thumb,-Wa$(comma)-mauto-it)
+AFLAGS_AUTOIT  :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
 AFLAGS_NOWARN  :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
 CFLAGS_THUMB2  :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
 AFLAGS_THUMB2  :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
@@ -146,6 +146,7 @@ machine-$(CONFIG_ARCH_MX1)          := mx1
 machine-$(CONFIG_ARCH_MX2)             := mx2
 machine-$(CONFIG_ARCH_MX25)            := mx25
 machine-$(CONFIG_ARCH_MX3)             := mx3
+machine-$(CONFIG_ARCH_MXC91231)                := mxc91231
 machine-$(CONFIG_ARCH_NETX)            := netx
 machine-$(CONFIG_ARCH_NOMADIK)         := nomadik
 machine-$(CONFIG_ARCH_NS9XXX)          := ns9xxx
@@ -171,12 +172,12 @@ machine-$(CONFIG_ARCH_U8500)              := ux500
 machine-$(CONFIG_ARCH_VERSATILE)       := versatile
 machine-$(CONFIG_ARCH_W90X900)         := w90x900
 machine-$(CONFIG_FOOTBRIDGE)           := footbridge
-machine-$(CONFIG_ARCH_MXC91231)                := mxc91231
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 plat-$(CONFIG_ARCH_MXC)                := mxc
 plat-$(CONFIG_ARCH_OMAP)       := omap
+plat-$(CONFIG_ARCH_STMP3XXX)   := stmp3xxx
 plat-$(CONFIG_PLAT_IOP)                := iop
 plat-$(CONFIG_PLAT_NOMADIK)    := nomadik
 plat-$(CONFIG_PLAT_ORION)      := orion
@@ -184,7 +185,6 @@ plat-$(CONFIG_PLAT_PXA)             := pxa
 plat-$(CONFIG_PLAT_S3C24XX)    := s3c24xx s3c samsung
 plat-$(CONFIG_PLAT_S3C64XX)    := s3c64xx s3c samsung
 plat-$(CONFIG_PLAT_S5PC1XX)    := s5pc1xx s3c samsung
-plat-$(CONFIG_ARCH_STMP3XXX)   := stmp3xxx
 
 ifeq ($(CONFIG_ARCH_EBSA110),y)
 # This is what happens if you forget the IOCS16 line.
index d356af7cef829142a851a366244acdc36e18a0c5..4fddc509e78ed3e25a8d708521f6d20cd2282e96 100644 (file)
                .macro  writeb, ch, rb
                mcr     p14, 0, \ch, c0, c5, 0
                .endm
+#elif defined(CONFIG_CPU_V7)
+               .macro  loadsp, rb
+               .endm
+               .macro  writeb, ch, rb
+wait:          mrc     p14, 0, pc, c0, c1, 0
+               bcs     wait
+               mcr     p14, 0, \ch, c0, c5, 0
+               .endm
 #elif defined(CONFIG_CPU_XSCALE)
                .macro  loadsp, rb
                .endm
index 7e0fe4d42c7b4f8965c08661206736b6eea8c659..56a0d116d27147445a4f69aa18728074f431ef9a 100644 (file)
@@ -53,6 +53,18 @@ static void icedcc_putc(int ch)
 
        asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch));
 }
+
+#elif defined(CONFIG_CPU_V7)
+
+static void icedcc_putc(int ch)
+{
+       asm(
+       "wait:  mrc     p14, 0, pc, c0, c1, 0                   \n\
+               bcs     wait                                    \n\
+               mcr     p14, 0, %0, c0, c5, 0                   "
+       : : "r" (ch));
+}
+
 #elif defined(CONFIG_CPU_XSCALE)
 
 static void icedcc_putc(int ch)
@@ -88,7 +100,6 @@ static void icedcc_putc(int ch)
 #endif
 
 #define putc(ch)       icedcc_putc(ch)
-#define flush()        do { } while (0)
 #endif
 
 static void putstr(const char *ptr)
index 730aefcfbee3eb8e0c46ea0a6dc0b9ba0fd1e27f..5fe4a2ad7fa34deb2e7be770fdfa782359f6d245 100644 (file)
@@ -42,7 +42,8 @@
 #endif
 
 #if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
-    defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020)
+    defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \
+    defined(CONFIG_CPU_ARM1026)
 # define MULTI_CACHE 1
 #endif
 
  *     Please note that the implementation of these, and the required
  *     effects are cache-type (VIVT/VIPT/PIPT) specific.
  *
- *     flush_cache_kern_all()
+ *     flush_kern_all()
  *
  *             Unconditionally clean and invalidate the entire cache.
  *
- *     flush_cache_user_mm(mm)
+ *     flush_user_all()
  *
  *             Clean and invalidate all user space cache entries
  *             before a change of page tables.
  *
- *     flush_cache_user_range(start, end, flags)
+ *     flush_user_range(start, end, flags)
  *
  *             Clean and invalidate a range of cache entries in the
  *             specified address space before a change of page tables.
  *             - start  - virtual start address
  *             - end    - virtual end address
  *
+ *     coherent_user_range(start, end)
+ *
+ *             Ensure coherency between the Icache and the Dcache in the
+ *             region described by start, end.  If you have non-snooping
+ *             Harvard caches, you need to implement this function.
+ *             - start  - virtual start address
+ *             - end    - virtual end address
+ *
+ *     flush_kern_dcache_area(kaddr, size)
+ *
+ *             Ensure that the data held in page is written back.
+ *             - kaddr  - page address
+ *             - size   - region size
+ *
  *     DMA Cache Coherency
  *     ===================
  *
@@ -432,6 +447,16 @@ static inline void __flush_icache_all(void)
            : "r" (0));
 #endif
 }
+static inline void flush_kernel_vmap_range(void *addr, int size)
+{
+       if ((cache_is_vivt() || cache_is_vipt_aliasing()))
+         __cpuc_flush_dcache_area(addr, (size_t)size);
+}
+static inline void invalidate_kernel_vmap_range(void *addr, int size)
+{
+       if ((cache_is_vivt() || cache_is_vipt_aliasing()))
+         __cpuc_flush_dcache_area(addr, (size_t)size);
+}
 
 #define ARCH_HAS_FLUSH_ANON_PAGE
 static inline void flush_anon_page(struct vm_area_struct *vma,
index 809681900ec8705ee6d524707ffd251c31e12a4f..bd397e0b663e4565f16b4ebd8869f2f64c01971f 100644 (file)
@@ -616,15 +616,17 @@ char * __init pcibios_setup(char *str)
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might be mirrored at 0x0100-0x03ff..
  */
-void pcibios_align_resource(void *data, struct resource *res,
-                           resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
        resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO && start & 0x300)
                start = (start + 0x3ff) & ~0x3ff;
 
-       res->start = (start + align - 1) & ~(align - 1);
+       start = (start + align - 1) & ~(align - 1);
+
+       return start;
 }
 
 /**
index b121b6053cce4e74a1b650c6bc83665920225ede..5c91addcaebcb2d8d207a4deb920e3cb7ea48729 100644 (file)
 1002:
                .endm
 
+#elif defined(CONFIG_CPU_V7)
+
+               .macro  addruart, rx
+               .endm
+
+               .macro  senduart, rd, rx
+               mcr     p14, 0, \rd, c0, c5, 0
+               .endm
+
+               .macro  busyuart, rd, rx
+busy:          mrc     p14, 0, pc, c0, c1, 0
+               bcs     busy
+               .endm
+
+               .macro  waituart, rd, rx
+wait:          mrc     p14, 0, pc, c0, c1, 0
+               bcs     wait
+
+               .endm
+
 #elif defined(CONFIG_CPU_XSCALE)
 
                .macro  addruart, rx
index 950391f194c4a9198927b4977fa49d52e08c80de..d4a0da1e48f40988bb7f92ce34664d86adb74a32 100644 (file)
@@ -78,15 +78,6 @@ int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack)
                return 1;
        if (cpu_architecture() < CPU_ARCH_ARMv6)
                return 1;
-#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
-       /*
-        * If we have support for OABI programs, we can never allow NX
-        * support - our signal syscall restart mechanism relies upon
-        * being able to execute code placed on the user stack.
-        */
-       return 1;
-#else
        return 0;
-#endif
 }
 EXPORT_SYMBOL(arm_elf_read_implies_exec);
index c6c57b640b6bfe5c1129251d0f0e6a497ebc1700..621acad8ea43c274b948c275c9de46177a42542e 100644 (file)
@@ -102,6 +102,7 @@ struct cpu_cache_fns cpu_cache;
 #endif
 #ifdef CONFIG_OUTER_CACHE
 struct outer_cache_fns outer_cache;
+EXPORT_SYMBOL(outer_cache);
 #endif
 
 struct stack {
index b476395d2cd4369581e4307eb0df6dccba65f71d..38e9033d2e86dfe0e70b09e91edf58a907034f44 100644 (file)
@@ -37,6 +37,8 @@
 #include <mach/nand.h>
 #include <mach/keyscan.h>
 
+#include <media/tvp514x.h>
+
 static inline int have_imager(void)
 {
        /* REVISIT when it's supported, trigger via Kconfig */
@@ -306,6 +308,73 @@ static void dm365evm_mmc_configure(void)
        davinci_cfg_reg(DM365_SD1_DATA0);
 }
 
+static struct tvp514x_platform_data tvp5146_pdata = {
+       .clk_polarity = 0,
+       .hs_polarity = 1,
+       .vs_polarity = 1
+};
+
+#define TVP514X_STD_ALL        (V4L2_STD_NTSC | V4L2_STD_PAL)
+/* Inputs available at the TVP5146 */
+static struct v4l2_input tvp5146_inputs[] = {
+       {
+               .index = 0,
+               .name = "Composite",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = TVP514X_STD_ALL,
+       },
+       {
+               .index = 1,
+               .name = "S-Video",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = TVP514X_STD_ALL,
+       },
+};
+
+/*
+ * this is the route info for connecting each input to decoder
+ * ouput that goes to vpfe. There is a one to one correspondence
+ * with tvp5146_inputs
+ */
+static struct vpfe_route tvp5146_routes[] = {
+       {
+               .input = INPUT_CVBS_VI2B,
+               .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+       },
+{
+               .input = INPUT_SVIDEO_VI2C_VI1C,
+               .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+       },
+};
+
+static struct vpfe_subdev_info vpfe_sub_devs[] = {
+       {
+               .name = "tvp5146",
+               .grp_id = 0,
+               .num_inputs = ARRAY_SIZE(tvp5146_inputs),
+               .inputs = tvp5146_inputs,
+               .routes = tvp5146_routes,
+               .can_route = 1,
+               .ccdc_if_params = {
+                       .if_type = VPFE_BT656,
+                       .hdpol = VPFE_PINPOL_POSITIVE,
+                       .vdpol = VPFE_PINPOL_POSITIVE,
+               },
+               .board_info = {
+                       I2C_BOARD_INFO("tvp5146", 0x5d),
+                       .platform_data = &tvp5146_pdata,
+               },
+       },
+};
+
+static struct vpfe_config vpfe_cfg = {
+       .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
+       .sub_devs = vpfe_sub_devs,
+       .i2c_adapter_id = 1,
+       .card_name = "DM365 EVM",
+       .ccdc = "ISIF",
+};
+
 static void __init evm_init_i2c(void)
 {
        davinci_init_i2c(&i2c_pdata);
@@ -497,6 +566,8 @@ static struct davinci_uart_config uart_config __initdata = {
 
 static void __init dm365_evm_map_io(void)
 {
+       /* setup input configuration for VPFE input devices */
+       dm365_set_vpfe_config(&vpfe_cfg);
        dm365_init();
 }
 
index dedf4d4f3a27ce3db98f30d50da84f6d8620fb7d..d84e85414d20d9c4a098e97459b22b2f254d3371 100644 (file)
@@ -125,7 +125,6 @@ static struct clk vpss_slave_clk = {
        .lpsc = DAVINCI_LPSC_VPSSSLV,
 };
 
-
 static struct clk clkout1_clk = {
        .name = "clkout1",
        .parent = &pll1_aux_clk,
@@ -665,6 +664,17 @@ static struct platform_device dm355_asp1_device = {
        .resource       = dm355_asp1_resources,
 };
 
+static void dm355_ccdc_setup_pinmux(void)
+{
+       davinci_cfg_reg(DM355_VIN_PCLK);
+       davinci_cfg_reg(DM355_VIN_CAM_WEN);
+       davinci_cfg_reg(DM355_VIN_CAM_VD);
+       davinci_cfg_reg(DM355_VIN_CAM_HD);
+       davinci_cfg_reg(DM355_VIN_YIN_EN);
+       davinci_cfg_reg(DM355_VIN_CINL_EN);
+       davinci_cfg_reg(DM355_VIN_CINH_EN);
+}
+
 static struct resource dm355_vpss_resources[] = {
        {
                /* VPSS BL Base address */
@@ -701,6 +711,10 @@ static struct resource vpfe_resources[] = {
                .end            = IRQ_VDINT1,
                .flags          = IORESOURCE_IRQ,
        },
+};
+
+static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct resource dm355_ccdc_resource[] = {
        /* CCDC Base address */
        {
                .flags          = IORESOURCE_MEM,
@@ -708,8 +722,18 @@ static struct resource vpfe_resources[] = {
                .end            = 0x01c70600 + 0x1ff,
        },
 };
+static struct platform_device dm355_ccdc_dev = {
+       .name           = "dm355_ccdc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(dm355_ccdc_resource),
+       .resource       = dm355_ccdc_resource,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = dm355_ccdc_setup_pinmux,
+       },
+};
 
-static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
 static struct platform_device vpfe_capture_dev = {
        .name           = CAPTURE_DRV_NAME,
        .id             = -1,
@@ -857,20 +881,13 @@ static int __init dm355_init_devices(void)
        if (!cpu_is_davinci_dm355())
                return 0;
 
+       /* Add ccdc clock aliases */
+       clk_add_alias("master", dm355_ccdc_dev.name, "vpss_master", NULL);
+       clk_add_alias("slave", dm355_ccdc_dev.name, "vpss_master", NULL);
        davinci_cfg_reg(DM355_INT_EDMA_CC);
        platform_device_register(&dm355_edma_device);
        platform_device_register(&dm355_vpss_device);
-       /*
-        * setup Mux configuration for vpfe input and register
-        * vpfe capture platform device
-        */
-       davinci_cfg_reg(DM355_VIN_PCLK);
-       davinci_cfg_reg(DM355_VIN_CAM_WEN);
-       davinci_cfg_reg(DM355_VIN_CAM_VD);
-       davinci_cfg_reg(DM355_VIN_CAM_HD);
-       davinci_cfg_reg(DM355_VIN_YIN_EN);
-       davinci_cfg_reg(DM355_VIN_CINL_EN);
-       davinci_cfg_reg(DM355_VIN_CINH_EN);
+       platform_device_register(&dm355_ccdc_dev);
        platform_device_register(&vpfe_capture_dev);
 
        return 0;
index f53735cb922ebf756f17f29692ce56bf752430f6..ce9da43a628b91c9a471359976ee03d05c4a786d 100644 (file)
@@ -1008,6 +1008,97 @@ void __init dm365_init(void)
        davinci_common_init(&davinci_soc_info_dm365);
 }
 
+static struct resource dm365_vpss_resources[] = {
+       {
+               /* VPSS ISP5 Base address */
+               .name           = "isp5",
+               .start          = 0x01c70000,
+               .end            = 0x01c70000 + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               /* VPSS CLK Base address */
+               .name           = "vpss",
+               .start          = 0x01c70200,
+               .end            = 0x01c70200 + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm365_vpss_device = {
+       .name                   = "vpss",
+       .id                     = -1,
+       .dev.platform_data      = "dm365_vpss",
+       .num_resources          = ARRAY_SIZE(dm365_vpss_resources),
+       .resource               = dm365_vpss_resources,
+};
+
+static struct resource vpfe_resources[] = {
+       {
+               .start          = IRQ_VDINT0,
+               .end            = IRQ_VDINT0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = IRQ_VDINT1,
+               .end            = IRQ_VDINT1,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct platform_device vpfe_capture_dev = {
+       .name           = CAPTURE_DRV_NAME,
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(vpfe_resources),
+       .resource       = vpfe_resources,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+static void dm365_isif_setup_pinmux(void)
+{
+       davinci_cfg_reg(DM365_VIN_CAM_WEN);
+       davinci_cfg_reg(DM365_VIN_CAM_VD);
+       davinci_cfg_reg(DM365_VIN_CAM_HD);
+       davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
+       davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
+}
+
+static struct resource isif_resource[] = {
+       /* ISIF Base address */
+       {
+               .start          = 0x01c71000,
+               .end            = 0x01c71000 + 0x1ff,
+               .flags          = IORESOURCE_MEM,
+       },
+       /* ISIF Linearization table 0 */
+       {
+               .start          = 0x1C7C000,
+               .end            = 0x1C7C000 + 0x2ff,
+               .flags          = IORESOURCE_MEM,
+       },
+       /* ISIF Linearization table 1 */
+       {
+               .start          = 0x1C7C400,
+               .end            = 0x1C7C400 + 0x2ff,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+static struct platform_device dm365_isif_dev = {
+       .name           = "isif",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(isif_resource),
+       .resource       = isif_resource,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = dm365_isif_setup_pinmux,
+       },
+};
+
 static int __init dm365_init_devices(void)
 {
        if (!cpu_is_davinci_dm365())
@@ -1016,7 +1107,16 @@ static int __init dm365_init_devices(void)
        davinci_cfg_reg(DM365_INT_EDMA_CC);
        platform_device_register(&dm365_edma_device);
        platform_device_register(&dm365_emac_device);
-
+       /* Add isif clock alias */
+       clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
+       platform_device_register(&dm365_vpss_device);
+       platform_device_register(&dm365_isif_dev);
+       platform_device_register(&vpfe_capture_dev);
        return 0;
 }
 postcore_initcall(dm365_init_devices);
+
+void dm365_set_vpfe_config(struct vpfe_config *cfg)
+{
+       vpfe_capture_dev.dev.platform_data = cfg;
+}
index 2cd008156deaa6da7d055df27572ef9ae52383b3..92aeb560068010b126cf8bd08390d7ead77c584e 100644 (file)
@@ -612,6 +612,11 @@ static struct resource vpfe_resources[] = {
                .end            = IRQ_VDINT1,
                .flags          = IORESOURCE_IRQ,
        },
+};
+
+static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct resource dm644x_ccdc_resource[] = {
+       /* CCDC Base address */
        {
                .start          = 0x01c70400,
                .end            = 0x01c70400 + 0xff,
@@ -619,7 +624,17 @@ static struct resource vpfe_resources[] = {
        },
 };
 
-static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct platform_device dm644x_ccdc_dev = {
+       .name           = "dm644x_ccdc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(dm644x_ccdc_resource),
+       .resource       = dm644x_ccdc_resource,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
 static struct platform_device vpfe_capture_dev = {
        .name           = CAPTURE_DRV_NAME,
        .id             = -1,
@@ -769,9 +784,13 @@ static int __init dm644x_init_devices(void)
        if (!cpu_is_davinci_dm644x())
                return 0;
 
+       /* Add ccdc clock aliases */
+       clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL);
+       clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL);
        platform_device_register(&dm644x_edma_device);
        platform_device_register(&dm644x_emac_device);
        platform_device_register(&dm644x_vpss_device);
+       platform_device_register(&dm644x_ccdc_dev);
        platform_device_register(&vpfe_capture_dev);
 
        return 0;
index f1710a30e7baf2a7dbfca2bf7a98a9145eb030fb..9fc5a64a536424103361485102d32259e904f81c 100644 (file)
@@ -18,6 +18,7 @@
 #include <mach/emac.h>
 #include <mach/asp.h>
 #include <mach/keyscan.h>
+#include <media/davinci/vpfe_capture.h>
 
 #define DM365_EMAC_BASE                        (0x01D07000)
 #define DM365_EMAC_CNTRL_OFFSET                (0x0000)
@@ -36,4 +37,5 @@ void __init dm365_init_asp(struct snd_platform_data *pdata);
 void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
 void __init dm365_init_rtc(void);
 
+void dm365_set_vpfe_config(struct vpfe_config *cfg);
 #endif /* __ASM_ARCH_DM365_H */
index b4e21a2976d13ce16e9f4c6884d99f5812342ddf..7a560e05bda818290a7ebd86749055e2bf712a78 100644 (file)
@@ -29,6 +29,7 @@ enum davinci_matrix_types {
 };
 
 struct davinci_ks_platform_data {
+       int             (*device_enable)(struct device *dev);
        unsigned short  *keymap;
        u32             keymapsize;
        u8              rep:1;
index e7263854bc7b8ce1107757b13d3c17a6188677c9..fe3bd5ac8b10dd03b6841a028b035821b7c65fbf 100644 (file)
@@ -86,7 +86,7 @@ static int gpio_set_irq_type(unsigned int irq, unsigned int type)
        unsigned int reg_both, reg_level, reg_type;
 
        reg_type = __raw_readl(base + GPIO_INT_TYPE);
-       reg_level = __raw_readl(base + GPIO_INT_BOTH_EDGE);
+       reg_level = __raw_readl(base + GPIO_INT_LEVEL);
        reg_both = __raw_readl(base + GPIO_INT_BOTH_EDGE);
 
        switch (type) {
@@ -117,7 +117,7 @@ static int gpio_set_irq_type(unsigned int irq, unsigned int type)
        }
 
        __raw_writel(reg_type, base + GPIO_INT_TYPE);
-       __raw_writel(reg_level, base + GPIO_INT_BOTH_EDGE);
+       __raw_writel(reg_level, base + GPIO_INT_LEVEL);
        __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE);
 
        gpio_ack_irq(irq);
index 59c5df7e716cd5547ec4ba4bd9eb87ac12386db1..5483f61a80613baa9afc7c2afcc4558299b9ff18 100644 (file)
@@ -30,7 +30,9 @@ static inline void putc(char c)
        UART[UART_TX] = c;
 }
 
-#define flush() do { } while (0)
+static inline void flush(void)
+{
+}
 
 /*
  * nothing to do
index 8bf4153d0840f3a2ac08fff3adbf2ebca5308258..3bf6304158f64354b410461c87d9ec0778ba26cf 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/gpio.h>
 #include <linux/spi/flash.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/orion_spi.h>
@@ -53,6 +54,11 @@ static void __init rd88f6192_init(void)
         */
        kirkwood_init();
 
+       orion_gpio_set_valid(RD88F6192_GPIO_USB_VBUS, 1);
+       if (gpio_request(RD88F6192_GPIO_USB_VBUS, "USB VBUS") != 0 ||
+           gpio_direction_output(RD88F6192_GPIO_USB_VBUS, 1) != 0)
+               pr_err("RD-88F6192-NAS: failed to setup USB VBUS GPIO\n");
+
        kirkwood_ehci_init();
        kirkwood_ge00_init(&rd88f6192_ge00_data);
        kirkwood_sata_init(&rd88f6192_sata_data);
index 6e838b857712733784ceb3f00cff790d4ba80c84..6acc88bcdc403f415ff8526228e7ebca92303792 100644 (file)
@@ -119,6 +119,11 @@ static unsigned long get_rate_nfc(struct clk *clk)
        return get_rate_per(8);
 }
 
+static unsigned long get_rate_gpt(struct clk *clk)
+{
+       return get_rate_per(5);
+}
+
 static unsigned long get_rate_otg(struct clk *clk)
 {
        return 48000000; /* FIXME */
@@ -144,7 +149,7 @@ static void clk_cgcr_disable(struct clk *clk)
        __raw_writel(reg, clk->enable_reg);
 }
 
-#define DEFINE_CLOCK(name, i, er, es, gr, sr)          \
+#define DEFINE_CLOCK(name, i, er, es, gr, sr, s)       \
        static struct clk name = {                      \
                .id             = i,                    \
                .enable_reg     = CRM_BASE + er,        \
@@ -153,27 +158,30 @@ static void clk_cgcr_disable(struct clk *clk)
                .set_rate       = sr,                   \
                .enable         = clk_cgcr_enable,      \
                .disable        = clk_cgcr_disable,     \
+               .secondary      = s,                    \
        }
 
-DEFINE_CLOCK(gpt_clk,    0, CCM_CGCR0,  5, get_rate_ipg, NULL);
-DEFINE_CLOCK(cspi1_clk,  0, CCM_CGCR1,  5, get_rate_ipg, NULL);
-DEFINE_CLOCK(cspi2_clk,  0, CCM_CGCR1,  6, get_rate_ipg, NULL);
-DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, NULL);
-DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL);
-DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL);
-DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL);
-DEFINE_CLOCK(uart4_clk,  0, CCM_CGCR2, 17, get_rate_uart, NULL);
-DEFINE_CLOCK(uart5_clk,  0, CCM_CGCR2, 18, get_rate_uart, NULL);
-DEFINE_CLOCK(nfc_clk,    0, CCM_CGCR0,  8, get_rate_nfc, NULL);
-DEFINE_CLOCK(usbotg_clk, 0, CCM_CGCR0, 28, get_rate_otg, NULL);
-DEFINE_CLOCK(pwm1_clk,  0, CCM_CGCR1, 31, get_rate_ipg, NULL);
-DEFINE_CLOCK(pwm2_clk,  0, CCM_CGCR2,  0, get_rate_ipg, NULL);
-DEFINE_CLOCK(pwm3_clk,  0, CCM_CGCR2,  1, get_rate_ipg, NULL);
-DEFINE_CLOCK(pwm4_clk,  0, CCM_CGCR2,  2, get_rate_ipg, NULL);
-DEFINE_CLOCK(kpp_clk,   0, CCM_CGCR1, 28, get_rate_ipg, NULL);
-DEFINE_CLOCK(tsc_clk,   0, CCM_CGCR2, 13, get_rate_ipg, NULL);
-DEFINE_CLOCK(i2c_clk,   0, CCM_CGCR0,  6, get_rate_i2c, NULL);
-DEFINE_CLOCK(fec_clk,   0, CCM_CGCR0, 23, get_rate_ipg, NULL);
+DEFINE_CLOCK(gpt_clk,    0, CCM_CGCR0,  5, get_rate_gpt, NULL, NULL);
+DEFINE_CLOCK(uart_per_clk, 0, CCM_CGCR0, 15, get_rate_uart, NULL, NULL);
+DEFINE_CLOCK(cspi1_clk,  0, CCM_CGCR1,  5, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(cspi2_clk,  0, CCM_CGCR1,  6, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL,       NULL, NULL);
+DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
+DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
+DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
+DEFINE_CLOCK(uart4_clk,  0, CCM_CGCR2, 17, get_rate_uart, NULL, &uart_per_clk);
+DEFINE_CLOCK(uart5_clk,  0, CCM_CGCR2, 18, get_rate_uart, NULL, &uart_per_clk);
+DEFINE_CLOCK(nfc_clk,    0, CCM_CGCR0,  8, get_rate_nfc, NULL, NULL);
+DEFINE_CLOCK(usbotg_clk, 0, CCM_CGCR0, 28, get_rate_otg, NULL, NULL);
+DEFINE_CLOCK(pwm1_clk,  0, CCM_CGCR1, 31, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(pwm2_clk,  0, CCM_CGCR2,  0, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(pwm3_clk,  0, CCM_CGCR2,  1, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(pwm4_clk,  0, CCM_CGCR2,  2, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(kpp_clk,   0, CCM_CGCR1, 28, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(tsc_clk,   0, CCM_CGCR2, 13, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(i2c_clk,   0, CCM_CGCR0,  6, get_rate_i2c, NULL, NULL);
+DEFINE_CLOCK(fec_clk,   0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
 
 #define _REGISTER_CLOCK(d, n, c)       \
        {                               \
@@ -208,13 +216,21 @@ static struct clk_lookup lookups[] = {
        _REGISTER_CLOCK("fec.0", NULL, fec_clk)
 };
 
-int __init mx25_clocks_init(unsigned long fref)
+int __init mx25_clocks_init(void)
 {
        int i;
 
        for (i = 0; i < ARRAY_SIZE(lookups); i++)
                clkdev_add(&lookups[i]);
 
+       /* Turn off all clocks except the ones we need to survive, namely:
+        * EMI, GPIO1-3 (CCM_CGCR1[18:16]), GPT1, IOMUXC (CCM_CGCR1[27]), IIM,
+        * SCC
+        */
+       __raw_writel((1 << 19), CRM_BASE + CCM_CGCR0);
+       __raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
+       __raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
+
        mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
 
        return 0;
index 921bc99ea231f3c3dde70419a065c0b3c80294c2..6f06089246eb46f68ac5d6e9d85162ee66484e49 100644 (file)
@@ -91,7 +91,7 @@ static void __init mx25pdk_init(void)
 
 static void __init mx25pdk_timer_init(void)
 {
-       mx25_clocks_init(26000000);
+       mx25_clocks_init();
 }
 
 static struct sys_timer mx25pdk_timer = {
index 3e7bafa2ddbbf4fda5bb2e79dca81dda10e41c92..938c549767dcf3d018a201c5f5f4b9177f7d64c5 100644 (file)
@@ -173,6 +173,7 @@ static void expio_unmask_irq(u32 irq)
 }
 
 static struct irq_chip expio_irq_chip = {
+       .name = "EXPIO(CPLD)",
        .ack = expio_ack_irq,
        .mask = expio_mask_irq,
        .unmask = expio_unmask_irq,
@@ -302,6 +303,7 @@ static struct regulator_init_data ldo1_data = {
                .min_uV = 2800000,
                .max_uV = 2800000,
                .valid_modes_mask = REGULATOR_MODE_NORMAL,
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
                .apply_uV = 1,
        },
 };
@@ -322,6 +324,7 @@ static struct regulator_init_data ldo2_data = {
                .min_uV = 3300000,
                .max_uV = 3300000,
                .valid_modes_mask = REGULATOR_MODE_NORMAL,
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
                .apply_uV = 1,
        },
        .num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
@@ -459,6 +462,7 @@ static int mx31_wm8350_init(struct wm8350 *wm8350)
 
 static struct wm8350_platform_data __initdata mx31_wm8350_pdata = {
        .init = mx31_wm8350_init,
+       .irq_base = MXC_BOARD_IRQ_START + MXC_MAX_EXP_IO_LINES,
 };
 #endif
 
index f93c596341914f48954d35e04dd2cbc384814e54..9bf33b30a0251f4172d4ae4a33c320459f08087d 100644 (file)
@@ -86,11 +86,19 @@ static struct amba_device cpu8815_amba_gpio[] = {
        },
 };
 
+static struct amba_device cpu8815_amba_rng = {
+       .dev = {
+               .init_name = "rng",
+       },
+       __MEM_4K_RESOURCE(NOMADIK_RNG_BASE),
+};
+
 static struct amba_device *amba_devs[] __initdata = {
        cpu8815_amba_gpio + 0,
        cpu8815_amba_gpio + 1,
        cpu8815_amba_gpio + 2,
        cpu8815_amba_gpio + 3,
+       &cpu8815_amba_rng
 };
 
 static int __init cpu8815_init(void)
index 2ba9ab95373114507acd51460b0406cb59be8b2b..04f1d29cba2c231033133da8d6ae7eb3c360c6ab 100644 (file)
@@ -214,8 +214,8 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate)
        struct mpu_rate * ptr;
        unsigned long dpll1_rate, ref_rate;
 
-       dpll1_rate = clk_get_rate(ck_dpll1_p);
-       ref_rate = clk_get_rate(ck_ref_p);
+       dpll1_rate = ck_dpll1_p->rate;
+       ref_rate = ck_ref_p->rate;
 
        for (ptr = omap1_rate_table; ptr->rate; ptr++) {
                if (ptr->xtal != ref_rate)
@@ -306,7 +306,7 @@ long omap1_round_to_table_rate(struct clk *clk, unsigned long rate)
        long highest_rate;
        unsigned long ref_rate;
 
-       ref_rate = clk_get_rate(ck_ref_p);
+       ref_rate = ck_ref_p->rate;
 
        highest_rate = -EINVAL;
 
index c6031d74d6f68bd5710d85e0c87c30f80c7cec47..74930e3158e30b146f722a17c3de92b419b84d2d 100644 (file)
@@ -671,7 +671,6 @@ static struct clk dpll4_m3x2_ck = {
        .name           = "dpll4_m3x2_ck",
        .ops            = &clkops_omap2_dflt_wait,
        .parent         = &dpll4_m3_ck,
-       .init           = &omap2_init_clksel_parent,
        .enable_reg     = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
        .enable_bit     = OMAP3430_PWRDN_TV_SHIFT,
        .flags          = INVERT_ENABLE,
@@ -811,7 +810,6 @@ static struct clk dpll4_m6x2_ck = {
        .name           = "dpll4_m6x2_ck",
        .ops            = &clkops_omap2_dflt_wait,
        .parent         = &dpll4_m6_ck,
-       .init           = &omap2_init_clksel_parent,
        .enable_reg     = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
        .enable_bit     = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
        .flags          = INVERT_ENABLE,
@@ -1047,7 +1045,6 @@ static struct clk iva2_ck = {
        .name           = "iva2_ck",
        .ops            = &clkops_omap2_dflt_wait,
        .parent         = &dpll2_m2_ck,
-       .init           = &omap2_init_clksel_parent,
        .enable_reg     = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
        .enable_bit     = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
        .clkdm_name     = "iva2_clkdm",
@@ -1121,7 +1118,6 @@ static struct clk gfx_l3_ck = {
        .name           = "gfx_l3_ck",
        .ops            = &clkops_omap2_dflt_wait,
        .parent         = &l3_ick,
-       .init           = &omap2_init_clksel_parent,
        .enable_reg     = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
        .enable_bit     = OMAP_EN_GFX_SHIFT,
        .recalc         = &followparent_recalc,
index 2210e227d78a2b93fdd9ccba0d84f94a26cbb0bd..9d882bcb56e38b976b085a44dd12132e533aa127 100644 (file)
@@ -346,37 +346,37 @@ static struct clk aess_fclk = {
 };
 
 static const struct clksel_rate div31_1to31_rates[] = {
-       { .div = 1, .val = 0, .flags = RATE_IN_4430 },
-       { .div = 2, .val = 1, .flags = RATE_IN_4430 },
-       { .div = 3, .val = 2, .flags = RATE_IN_4430 },
-       { .div = 4, .val = 3, .flags = RATE_IN_4430 },
-       { .div = 5, .val = 4, .flags = RATE_IN_4430 },
-       { .div = 6, .val = 5, .flags = RATE_IN_4430 },
-       { .div = 7, .val = 6, .flags = RATE_IN_4430 },
-       { .div = 8, .val = 7, .flags = RATE_IN_4430 },
-       { .div = 9, .val = 8, .flags = RATE_IN_4430 },
-       { .div = 10, .val = 9, .flags = RATE_IN_4430 },
-       { .div = 11, .val = 10, .flags = RATE_IN_4430 },
-       { .div = 12, .val = 11, .flags = RATE_IN_4430 },
-       { .div = 13, .val = 12, .flags = RATE_IN_4430 },
-       { .div = 14, .val = 13, .flags = RATE_IN_4430 },
-       { .div = 15, .val = 14, .flags = RATE_IN_4430 },
-       { .div = 16, .val = 15, .flags = RATE_IN_4430 },
-       { .div = 17, .val = 16, .flags = RATE_IN_4430 },
-       { .div = 18, .val = 17, .flags = RATE_IN_4430 },
-       { .div = 19, .val = 18, .flags = RATE_IN_4430 },
-       { .div = 20, .val = 19, .flags = RATE_IN_4430 },
-       { .div = 21, .val = 20, .flags = RATE_IN_4430 },
-       { .div = 22, .val = 21, .flags = RATE_IN_4430 },
-       { .div = 23, .val = 22, .flags = RATE_IN_4430 },
-       { .div = 24, .val = 23, .flags = RATE_IN_4430 },
-       { .div = 25, .val = 24, .flags = RATE_IN_4430 },
-       { .div = 26, .val = 25, .flags = RATE_IN_4430 },
-       { .div = 27, .val = 26, .flags = RATE_IN_4430 },
-       { .div = 28, .val = 27, .flags = RATE_IN_4430 },
-       { .div = 29, .val = 28, .flags = RATE_IN_4430 },
-       { .div = 30, .val = 29, .flags = RATE_IN_4430 },
-       { .div = 31, .val = 30, .flags = RATE_IN_4430 },
+       { .div = 1, .val = 1, .flags = RATE_IN_4430 },
+       { .div = 2, .val = 2, .flags = RATE_IN_4430 },
+       { .div = 3, .val = 3, .flags = RATE_IN_4430 },
+       { .div = 4, .val = 4, .flags = RATE_IN_4430 },
+       { .div = 5, .val = 5, .flags = RATE_IN_4430 },
+       { .div = 6, .val = 6, .flags = RATE_IN_4430 },
+       { .div = 7, .val = 7, .flags = RATE_IN_4430 },
+       { .div = 8, .val = 8, .flags = RATE_IN_4430 },
+       { .div = 9, .val = 9, .flags = RATE_IN_4430 },
+       { .div = 10, .val = 10, .flags = RATE_IN_4430 },
+       { .div = 11, .val = 11, .flags = RATE_IN_4430 },
+       { .div = 12, .val = 12, .flags = RATE_IN_4430 },
+       { .div = 13, .val = 13, .flags = RATE_IN_4430 },
+       { .div = 14, .val = 14, .flags = RATE_IN_4430 },
+       { .div = 15, .val = 15, .flags = RATE_IN_4430 },
+       { .div = 16, .val = 16, .flags = RATE_IN_4430 },
+       { .div = 17, .val = 17, .flags = RATE_IN_4430 },
+       { .div = 18, .val = 18, .flags = RATE_IN_4430 },
+       { .div = 19, .val = 19, .flags = RATE_IN_4430 },
+       { .div = 20, .val = 20, .flags = RATE_IN_4430 },
+       { .div = 21, .val = 21, .flags = RATE_IN_4430 },
+       { .div = 22, .val = 22, .flags = RATE_IN_4430 },
+       { .div = 23, .val = 23, .flags = RATE_IN_4430 },
+       { .div = 24, .val = 24, .flags = RATE_IN_4430 },
+       { .div = 25, .val = 25, .flags = RATE_IN_4430 },
+       { .div = 26, .val = 26, .flags = RATE_IN_4430 },
+       { .div = 27, .val = 27, .flags = RATE_IN_4430 },
+       { .div = 28, .val = 28, .flags = RATE_IN_4430 },
+       { .div = 29, .val = 29, .flags = RATE_IN_4430 },
+       { .div = 30, .val = 30, .flags = RATE_IN_4430 },
+       { .div = 31, .val = 31, .flags = RATE_IN_4430 },
        { .div = 0 },
 };
 
index a26d6a08ae3f86dd49f3098772c36d481a570c34..12f0cbfc2894483ae10160efbad4d86406fb1e34 100644 (file)
@@ -137,7 +137,7 @@ return_sleep_time:
        local_irq_enable();
        local_fiq_enable();
 
-       return (u32)timespec_to_ns(&ts_idle)/1000;
+       return ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * USEC_PER_SEC;
 }
 
 /**
index bd8cb5974726bb670da33dd078965eb49ef96471..7027cdc1ba4915e4d8e924f58f89c58f948d6f79 100644 (file)
@@ -505,7 +505,7 @@ static void __init gpmc_mem_init(void)
 void __init gpmc_init(void)
 {
        u32 l;
-       char *ck;
+       char *ck = NULL;
 
        if (cpu_is_omap24xx()) {
                ck = "core_l3_ck";
@@ -521,6 +521,9 @@ void __init gpmc_init(void)
                l = OMAP44XX_GPMC_BASE;
        }
 
+       if (WARN_ON(!ck))
+               return;
+
        gpmc_l3_clk = clk_get(NULL, ck);
        if (IS_ERR(gpmc_l3_clk)) {
                printk(KERN_ERR "Could not get GPMC clock %s\n", ck);
@@ -534,6 +537,8 @@ void __init gpmc_init(void)
                BUG();
        }
 
+       clk_enable(gpmc_l3_clk);
+
        l = gpmc_read_reg(GPMC_REVISION);
        printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f);
        /* Set smart idle mode and automatic L3 clock gating */
index a091b53657b9744514dc1683e32194cccb261888..3d65c50bd0174bba7a209b80f4b02f6edf19abb3 100644 (file)
@@ -188,6 +188,8 @@ void __init omap3_check_revision(void)
        u16 hawkeye;
        u8 rev;
 
+       omap_chip.oc = CHIP_IS_OMAP3430;
+
        /*
         * We cannot access revision registers on ES1.0.
         * If the processor type is Cortex-A8 and the revision is 0x0
@@ -196,6 +198,7 @@ void __init omap3_check_revision(void)
        cpuid = read_cpuid(CPUID_ID);
        if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
                omap_revision = OMAP3430_REV_ES1_0;
+               omap_chip.oc |= CHIP_IS_OMAP3430ES1;
                return;
        }
 
@@ -216,18 +219,28 @@ void __init omap3_check_revision(void)
                case 0: /* Take care of early samples */
                case 1:
                        omap_revision = OMAP3430_REV_ES2_0;
+                       omap_chip.oc |= CHIP_IS_OMAP3430ES2;
                        break;
                case 2:
                        omap_revision = OMAP3430_REV_ES2_1;
+                       omap_chip.oc |= CHIP_IS_OMAP3430ES2;
                        break;
                case 3:
                        omap_revision = OMAP3430_REV_ES3_0;
+                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
                        break;
                case 4:
+                       omap_revision = OMAP3430_REV_ES3_1;
+                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
+                       break;
+               case 7:
                /* FALLTHROUGH */
                default:
                        /* Use the latest known revision as default */
-                       omap_revision = OMAP3430_REV_ES3_1;
+                       omap_revision = OMAP3430_REV_ES3_1_2;
+
+                       /* REVISIT: Add CHIP_IS_OMAP3430ES3_1_2? */
+                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
                }
                break;
        case 0xb868:
@@ -235,14 +248,18 @@ void __init omap3_check_revision(void)
                 *
                 * Set the device to be OMAP3505 here. Actual device
                 * is identified later based on the features.
+                *
+                * REVISIT: AM3505/AM3517 should have their own CHIP_IS
                 */
                omap_revision = OMAP3505_REV(rev);
+               omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
                break;
        case 0xb891:
        /* FALLTHROUGH */
        default:
                /* Unknown default to latest silicon rev as default*/
                omap_revision = OMAP3630_REV_ES1_0;
+               omap_chip.oc |= CHIP_IS_OMAP3630ES1;
        }
 }
 
@@ -360,6 +377,7 @@ void __init omap2_check_revision(void)
                omap3_check_revision();
                omap3_check_features();
                omap3_cpuinfo();
+               return;
        } else if (cpu_is_omap44xx()) {
                omap4_check_revision();
                return;
@@ -374,27 +392,14 @@ void __init omap2_check_revision(void)
        if (cpu_is_omap243x()) {
                /* Currently only supports 2430ES2.1 and 2430-all */
                omap_chip.oc |= CHIP_IS_OMAP2430;
+               return;
        } else if (cpu_is_omap242x()) {
                /* Currently only supports 2420ES2.1.1 and 2420-all */
                omap_chip.oc |= CHIP_IS_OMAP2420;
-       } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
-               omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3430ES3_1;
-       } else if (cpu_is_omap343x()) {
-               omap_chip.oc = CHIP_IS_OMAP3430;
-               if (omap_rev() == OMAP3430_REV_ES1_0)
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES1;
-               else if (omap_rev() >= OMAP3430_REV_ES2_0 &&
-                        omap_rev() <= OMAP3430_REV_ES2_1)
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES2;
-               else if (omap_rev() == OMAP3430_REV_ES3_0)
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
-               else if (omap_rev() == OMAP3430_REV_ES3_1)
-                       omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
-               else if (omap_rev() == OMAP3630_REV_ES1_0)
-                       omap_chip.oc |= CHIP_IS_OMAP3630ES1;
-       } else {
-               pr_err("Uninitialized omap_chip, please fix!\n");
+               return;
        }
+
+       pr_err("Uninitialized omap_chip, please fix!\n");
 }
 
 /*
index e9bc782fa414fad906db2740ac274d119910f894..26aeef560aa3920ac2c663d50985266bd10138d7 100644 (file)
@@ -194,7 +194,7 @@ void __init omap_init_irq(void)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
-               unsigned long base;
+               unsigned long base = 0;
                struct omap_irq_bank *bank = irq_banks + i;
 
                if (cpu_is_omap24xx())
@@ -202,6 +202,8 @@ void __init omap_init_irq(void)
                else if (cpu_is_omap34xx())
                        base = OMAP34XX_IC_BASE;
 
+               BUG_ON(!base);
+
                /* Static mapping, never released */
                bank->base_reg = ioremap(base, SZ_4K);
                if (!bank->base_reg) {
@@ -274,4 +276,22 @@ void omap_intc_restore_context(void)
        }
        /* MIRs are saved and restore with other PRCM registers */
 }
+
+void omap3_intc_suspend(void)
+{
+       /* A pending interrupt would prevent OMAP from entering suspend */
+       omap_ack_irq(0);
+}
+
+void omap3_intc_prepare_idle(void)
+{
+       /* Disable autoidle as it can stall interrupt controller */
+       intc_bank_write_reg(0, &irq_banks[0], INTC_SYSCONFIG);
+}
+
+void omap3_intc_resume_idle(void)
+{
+       /* Re-enable autoidle */
+       intc_bank_write_reg(1, &irq_banks[0], INTC_SYSCONFIG);
+}
 #endif /* CONFIG_ARCH_OMAP3 */
index 0c3c72d934bfb7673775c50d112f896900ca807a..8afe9dd3f150933f37a2222db24c5abf369464d1 100644 (file)
@@ -408,6 +408,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 {
        struct twl4030_hsmmc_info *c;
        int nr_hsmmc = ARRAY_SIZE(hsmmc_data);
+       int i;
 
        if (cpu_is_omap2430()) {
                control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
@@ -434,7 +435,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
                mmc = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
                if (!mmc) {
                        pr_err("Cannot allocate memory for mmc device!\n");
-                       return;
+                       goto done;
                }
 
                if (c->name)
@@ -532,6 +533,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
                        continue;
                c->dev = mmc->dev;
        }
+
+done:
+       for (i = 0; i < nr_hsmmc; i++)
+               kfree(hsmmc_data[i]);
 }
 
 #endif
index 459ef23ab8a818539aaa0da0464d5cf9e7af49bd..5fef73f4743dfc033d264e6f37b06d74f951ac28 100644 (file)
@@ -51,7 +51,7 @@ struct omap_mux_entry {
 static unsigned long mux_phys;
 static void __iomem *mux_base;
 
-static inline u16 omap_mux_read(u16 reg)
+u16 omap_mux_read(u16 reg)
 {
        if (cpu_is_omap24xx())
                return __raw_readb(mux_base + reg);
@@ -59,7 +59,7 @@ static inline u16 omap_mux_read(u16 reg)
                return __raw_readw(mux_base + reg);
 }
 
-static inline void omap_mux_write(u16 val, u16 reg)
+void omap_mux_write(u16 val, u16 reg)
 {
        if (cpu_is_omap24xx())
                __raw_writeb(val, mux_base + reg);
@@ -67,6 +67,14 @@ static inline void omap_mux_write(u16 val, u16 reg)
                __raw_writew(val, mux_base + reg);
 }
 
+void omap_mux_write_array(struct omap_board_mux *board_mux)
+{
+       while (board_mux->reg_offset !=  OMAP_MUX_TERMINATOR) {
+               omap_mux_write(board_mux->value, board_mux->reg_offset);
+               board_mux++;
+       }
+}
+
 #if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_OMAP_MUX)
 
 static struct omap_mux_cfg arch_mux_cfg;
@@ -478,7 +486,7 @@ int __init omap_mux_init_signal(char *muxname, int val)
 static inline void omap_mux_decode(struct seq_file *s, u16 val)
 {
        char *flags[OMAP_MUX_MAX_NR_FLAGS];
-       char mode[14];
+       char mode[sizeof("OMAP_MUX_MODE") + 1];
        int i = -1;
 
        sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);
@@ -545,6 +553,7 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
                if (!m0_name)
                        continue;
 
+               /* REVISIT: Needs to be updated if mode0 names get longer */
                for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) {
                        if (m0_name[i] == '\0') {
                                m0_def[i] = m0_name[i];
@@ -833,14 +842,6 @@ static void __init omap_mux_set_cmdline_signals(void)
        kfree(options);
 }
 
-static void __init omap_mux_set_board_signals(struct omap_board_mux *board_mux)
-{
-       while (board_mux->reg_offset !=  OMAP_MUX_TERMINATOR) {
-               omap_mux_write(board_mux->value, board_mux->reg_offset);
-               board_mux++;
-       }
-}
-
 static int __init omap_mux_copy_names(struct omap_mux *src,
                                        struct omap_mux *dst)
 {
@@ -960,7 +961,12 @@ static void __init omap_mux_init_list(struct omap_mux *superset)
        while (superset->reg_offset !=  OMAP_MUX_TERMINATOR) {
                struct omap_mux *entry;
 
-#ifndef CONFIG_OMAP_MUX
+#ifdef CONFIG_OMAP_MUX
+               if (!superset->muxnames || !superset->muxnames[0]) {
+                       superset++;
+                       continue;
+               }
+#else
                /* Skip pins that are not muxed as GPIO by bootloader */
                if (!OMAP_MODE_GPIO(omap_mux_read(superset->reg_offset))) {
                        superset++;
@@ -998,12 +1004,15 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size,
                omap_mux_package_fixup(package_subset, superset);
        if (package_balls)
                omap_mux_package_init_balls(package_balls, superset);
-       omap_mux_set_cmdline_signals();
-       omap_mux_set_board_signals(board_mux);
 #endif
 
        omap_mux_init_list(superset);
 
+#ifdef CONFIG_OMAP_MUX
+       omap_mux_set_cmdline_signals();
+       omap_mux_write_array(board_mux);
+#endif
+
        return 0;
 }
 
index d8b4d5ad22783ffe342611ba801a07a709ce6b18..f8c2e7a8f063afc4cc46284c7556c0bd482a17e7 100644 (file)
@@ -146,6 +146,30 @@ u16 omap_mux_get_gpio(int gpio);
  */
 void omap_mux_set_gpio(u16 val, int gpio);
 
+/**
+ * omap_mux_read() - read mux register
+ * @mux_offset:                Offset of the mux register
+ *
+ */
+u16 omap_mux_read(u16 mux_offset);
+
+/**
+ * omap_mux_write() - write mux register
+ * @val:               New mux register value
+ * @mux_offset:                Offset of the mux register
+ *
+ * This should be only needed for dynamic remuxing of non-gpio signals.
+ */
+void omap_mux_write(u16 val, u16 mux_offset);
+
+/**
+ * omap_mux_write_array() - write an array of mux registers
+ * @board_mux:         Array of mux registers terminated by MAP_MUX_TERMINATOR
+ *
+ * This should be only needed for dynamic remuxing of non-gpio signals.
+ */
+void omap_mux_write_array(struct omap_board_mux *board_mux);
+
 /**
  * omap3_mux_init() - initialize mux system with board specific set
  * @board_mux:         Board specific mux table
index 68e0a595f9a18f42878baa5048dfca08e9585d28..07aa7b3c95f7970743d0b108a3b7f3b3455b33cc 100644 (file)
@@ -649,6 +649,53 @@ static struct omap_mux __initdata omap3_muxmodes[] = {
        _OMAP3_MUXENTRY(UART3_TX_IRTX, 166,
                "uart3_tx_irtx", NULL, NULL, NULL,
                "gpio_166", NULL, NULL, "safe_mode"),
+
+       /* Only on 3630, see omap36xx_cbp_subset for the signals */
+       _OMAP3_MUXENTRY(GPMC_A11, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MBUSFLAG, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MREAD, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MWRITE, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_SBUSFLAG, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_SREAD, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_SWRITE, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(GPMC_A11, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD28, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD29, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD32, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD33, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD34, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD35, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
+       _OMAP3_MUXENTRY(SAD2D_MCAD36, 0,
+               NULL, NULL, NULL, NULL,
+               NULL, NULL, NULL, NULL),
        { .reg_offset = OMAP_MUX_TERMINATOR },
 };
 
index d8c8545875b18b84aa89449ffa87911d687d129e..478ae585ca39666327500057fd1a85e014e19657 100644 (file)
@@ -94,7 +94,8 @@ static int _update_sysc_cache(struct omap_hwmod *oh)
 
        oh->_sysc_cache = omap_hwmod_readl(oh, oh->sysconfig->sysc_offs);
 
-       oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED;
+       if (!(oh->sysconfig->sysc_flags & SYSC_NO_CACHE))
+               oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED;
 
        return 0;
 }
index 860b755d222074ce1bb061510f3a16fbc2cafa5b..a0866268aa41d1cdfe49a623b2265601f2ef75f6 100644 (file)
@@ -54,8 +54,6 @@ int omap2_pm_debug;
        regs[reg_count++].val = \
                         __raw_readl(OMAP2_L4_IO_ADDRESS(0x480fe000 + (off)))
 
-static int __init pm_dbg_init(void);
-
 void omap2_pm_dump(int mode, int resume, unsigned int us)
 {
        struct reg {
@@ -167,6 +165,8 @@ struct dentry *pm_dbg_dir;
 
 static int pm_dbg_init_done;
 
+static int __init pm_dbg_init(void);
+
 enum {
        DEBUG_FILE_COUNTERS = 0,
        DEBUG_FILE_TIMERS,
@@ -488,9 +488,11 @@ int pm_dbg_regset_init(int reg_set)
 
 static int pwrdm_suspend_get(void *data, u64 *val)
 {
-       *val = omap3_pm_get_suspend_state((struct powerdomain *)data);
+       int ret;
+       ret = omap3_pm_get_suspend_state((struct powerdomain *)data);
+       *val = ret;
 
-       if (*val >= 0)
+       if (ret >= 0)
                return 0;
        return *val;
 }
@@ -604,6 +606,4 @@ static int __init pm_dbg_init(void)
 }
 arch_initcall(pm_dbg_init);
 
-#else
-void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) {}
 #endif
index 0bf345db7147bc2ad88da43cfaab0e80db328f56..7a9c2d004511f9afff6c03636ef64751dd5a5036 100644 (file)
@@ -32,12 +32,16 @@ extern struct omap_dm_timer *gptimer_wakeup;
 #ifdef CONFIG_PM_DEBUG
 extern void omap2_pm_dump(int mode, int resume, unsigned int us);
 extern int omap2_pm_debug;
+#else
+#define omap2_pm_dump(mode, resume, us)                do {} while (0);
+#define omap2_pm_debug                         0
+#endif
+
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
 extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
 extern int pm_dbg_regset_save(int reg_set);
 extern int pm_dbg_regset_init(int reg_set);
 #else
-#define omap2_pm_dump(mode, resume, us)                do {} while (0);
-#define omap2_pm_debug                         0
 #define pm_dbg_update_time(pwrdm, prev) do {} while (0);
 #define pm_dbg_regset_save(reg_set) do {} while (0);
 #define pm_dbg_regset_init(reg_set) do {} while (0);
index c6cc809afb790fa5a0624f5a3e2f118c4aba3fa3..910a7acf542d1bd1257cfeff37cbf23403eaf7b5 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/clk.h>
+#include <linux/delay.h>
 
 #include <plat/sram.h>
 #include <plat/clockdomain.h>
@@ -126,7 +127,15 @@ static void omap3_core_save_context(void)
        /* wait for the save to complete */
        while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
                        & PADCONF_SAVE_DONE))
-               ;
+               udelay(1);
+
+       /*
+        * Force write last pad into memory, as this can fail in some
+        * cases according to erratas 1.157, 1.185
+        */
+       omap_ctrl_writel(omap_ctrl_readl(OMAP343X_PADCONF_ETK_D14),
+               OMAP343X_CONTROL_MEM_WKUP + 0x2a0);
+
        /* Save the Interrupt controller context */
        omap_intc_save_context();
        /* Save the GPMC context */
@@ -392,6 +401,7 @@ void omap_sram_idle(void)
                prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
                omap3_enable_io_chain();
        }
+       omap3_intc_prepare_idle();
 
        /*
        * On EMU/HS devices ROM code restores a SRDC value
@@ -438,6 +448,7 @@ void omap_sram_idle(void)
                                               OMAP3430_GR_MOD,
                                               OMAP3_PRM_VOLTCTRL_OFFSET);
        }
+       omap3_intc_resume_idle();
 
        /* PER */
        if (per_next_state < PWRDM_POWER_ON) {
@@ -578,6 +589,8 @@ static int omap3_pm_suspend(void)
        }
 
        omap_uart_prepare_suspend();
+       omap3_intc_suspend();
+
        omap_sram_idle();
 
 restore:
@@ -835,6 +848,8 @@ static void __init prcm_setup_regs(void)
                        CM_AUTOIDLE);
        }
 
+       omap_ctrl_writel(OMAP3430_AUTOIDLE, OMAP2_CONTROL_SYSCONFIG);
+
        /*
         * Set all plls to autoidle. This is needed until autoidle is
         * enabled by clockfw
@@ -875,15 +890,23 @@ static void __init prcm_setup_regs(void)
        prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN,
                          OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
 
+       /* Enable PM_WKEN to support DSS LPR */
+       prm_write_mod_reg(OMAP3430_PM_WKEN_DSS_EN_DSS,
+                               OMAP3430_DSS_MOD, PM_WKEN);
+
        /* Enable wakeups in PER */
        prm_write_mod_reg(OMAP3430_EN_GPIO2 | OMAP3430_EN_GPIO3 |
                          OMAP3430_EN_GPIO4 | OMAP3430_EN_GPIO5 |
-                         OMAP3430_EN_GPIO6 | OMAP3430_EN_UART3,
+                         OMAP3430_EN_GPIO6 | OMAP3430_EN_UART3 |
+                         OMAP3430_EN_MCBSP2 | OMAP3430_EN_MCBSP3 |
+                         OMAP3430_EN_MCBSP4,
                          OMAP3430_PER_MOD, PM_WKEN);
        /* and allow them to wake up MPU */
        prm_write_mod_reg(OMAP3430_GRPSEL_GPIO2 | OMAP3430_EN_GPIO3 |
                          OMAP3430_GRPSEL_GPIO4 | OMAP3430_EN_GPIO5 |
-                         OMAP3430_GRPSEL_GPIO6 | OMAP3430_EN_UART3,
+                         OMAP3430_GRPSEL_GPIO6 | OMAP3430_EN_UART3 |
+                         OMAP3430_EN_MCBSP2 | OMAP3430_EN_MCBSP3 |
+                         OMAP3430_EN_MCBSP4,
                          OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
 
        /* Don't attach IVA interrupts */
@@ -904,24 +927,6 @@ static void __init prcm_setup_regs(void)
        /* Clear any pending PRCM interrupts */
        prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
-       /* Don't attach IVA interrupts */
-       prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
-       prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
-       prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
-       prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL);
-
-       /* Clear any pending 'reset' flags */
-       prm_write_mod_reg(0xffffffff, MPU_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, CORE_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, RM_RSTST);
-       prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD, RM_RSTST);
-
-       /* Clear any pending PRCM interrupts */
-       prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
-
        omap3_iva_idle();
        omap3_d2d_idle();
 }
index 3ea8177ffb2508be4a2b821ff09e05b0ac826bed..cf466ea1dffcb3f867921452b19fb2a4c6dd68c3 100644 (file)
@@ -44,7 +44,6 @@ struct omap3_prcm_regs {
        u32 iva2_cm_clksel2;
        u32 cm_sysconfig;
        u32 sgx_cm_clksel;
-       u32 wkup_cm_clksel;
        u32 dss_cm_clksel;
        u32 cam_cm_clksel;
        u32 per_cm_clksel;
@@ -53,7 +52,6 @@ struct omap3_prcm_regs {
        u32 pll_cm_autoidle2;
        u32 pll_cm_clksel4;
        u32 pll_cm_clksel5;
-       u32 pll_cm_clken;
        u32 pll_cm_clken2;
        u32 cm_polctrl;
        u32 iva2_cm_fclken;
@@ -77,7 +75,6 @@ struct omap3_prcm_regs {
        u32 usbhost_cm_iclken;
        u32 iva2_cm_autiidle2;
        u32 mpu_cm_autoidle2;
-       u32 pll_cm_autoidle;
        u32 iva2_cm_clkstctrl;
        u32 mpu_cm_clkstctrl;
        u32 core_cm_clkstctrl;
@@ -274,7 +271,6 @@ void omap3_prcm_save_context(void)
        prcm_context.cm_sysconfig = __raw_readl(OMAP3430_CM_SYSCONFIG);
        prcm_context.sgx_cm_clksel =
                         cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
-       prcm_context.wkup_cm_clksel = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
        prcm_context.dss_cm_clksel =
                         cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSEL);
        prcm_context.cam_cm_clksel =
@@ -291,8 +287,6 @@ void omap3_prcm_save_context(void)
                        cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL4);
        prcm_context.pll_cm_clksel5 =
                         cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
-       prcm_context.pll_cm_clken =
-                       cm_read_mod_reg(PLL_MOD, CM_CLKEN);
        prcm_context.pll_cm_clken2 =
                        cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2);
        prcm_context.cm_polctrl = __raw_readl(OMAP3430_CM_POLCTRL);
@@ -338,8 +332,6 @@ void omap3_prcm_save_context(void)
                         cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
        prcm_context.mpu_cm_autoidle2 =
                         cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
-       prcm_context.pll_cm_autoidle =
-                        cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
        prcm_context.iva2_cm_clkstctrl =
                         cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
        prcm_context.mpu_cm_clkstctrl =
@@ -431,7 +423,6 @@ void omap3_prcm_restore_context(void)
        __raw_writel(prcm_context.cm_sysconfig, OMAP3430_CM_SYSCONFIG);
        cm_write_mod_reg(prcm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD,
                                         CM_CLKSEL);
-       cm_write_mod_reg(prcm_context.wkup_cm_clksel, WKUP_MOD, CM_CLKSEL);
        cm_write_mod_reg(prcm_context.dss_cm_clksel, OMAP3430_DSS_MOD,
                                         CM_CLKSEL);
        cm_write_mod_reg(prcm_context.cam_cm_clksel, OMAP3430_CAM_MOD,
@@ -448,7 +439,6 @@ void omap3_prcm_restore_context(void)
                                        OMAP3430ES2_CM_CLKSEL4);
        cm_write_mod_reg(prcm_context.pll_cm_clksel5, PLL_MOD,
                                         OMAP3430ES2_CM_CLKSEL5);
-       cm_write_mod_reg(prcm_context.pll_cm_clken, PLL_MOD, CM_CLKEN);
        cm_write_mod_reg(prcm_context.pll_cm_clken2, PLL_MOD,
                                        OMAP3430ES2_CM_CLKEN2);
        __raw_writel(prcm_context.cm_polctrl, OMAP3430_CM_POLCTRL);
@@ -487,7 +477,6 @@ void omap3_prcm_restore_context(void)
        cm_write_mod_reg(prcm_context.iva2_cm_autiidle2, OMAP3430_IVA2_MOD,
                                        CM_AUTOIDLE2);
        cm_write_mod_reg(prcm_context.mpu_cm_autoidle2, MPU_MOD, CM_AUTOIDLE2);
-       cm_write_mod_reg(prcm_context.pll_cm_autoidle, PLL_MOD, CM_AUTOIDLE);
        cm_write_mod_reg(prcm_context.iva2_cm_clkstctrl, OMAP3430_IVA2_MOD,
                                        CM_CLKSTCTRL);
        cm_write_mod_reg(prcm_context.mpu_cm_clkstctrl, MPU_MOD, CM_CLKSTCTRL);
index ea050ce188a7f9ea484649c489a480755e89b9da..40f006285163c95720a66bcd5f6893c1ccd570ef 100644 (file)
@@ -24,6 +24,8 @@
                OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
 #define OMAP44XX_PRM_REGADDR(module, reg)                              \
                OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
+#define OMAP44XX_CHIRONSS_REGADDR(module, reg)                         \
+               OMAP2_L4_IO_ADDRESS(OMAP4430_CHIRONSS_BASE + (module) + (reg))
 
 #include "prm44xx.h"
 
index 89be97f0589dd026b14629581c5dde7f911eea04..adb2558bb121740a0d0658a38c7c6eb020a50665 100644 (file)
 
 
 /* CHIRON_PRCM.CHIRONSS_OCP_SOCKET_PRCM register offsets */
-#define OMAP4430_REVISION_PRCM                         OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_OCP_SOCKET_PRCM_MOD, 0x0000)
+#define OMAP4430_REVISION_PRCM                         OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_OCP_SOCKET_PRCM_MOD, 0x0000)
 
 /* CHIRON_PRCM.CHIRONSS_DEVICE_PRM register offsets */
-#define OMAP4430_CHIRON_PRCM_PRM_RSTST                 OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_DEVICE_PRM_MOD, 0x0000)
+#define OMAP4430_CHIRON_PRCM_PRM_RSTST                 OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_DEVICE_PRM_MOD, 0x0000)
 
 /* CHIRON_PRCM.CHIRONSS_CPU0 register offsets */
-#define OMAP4430_PM_PDA_CPU0_PWRSTCTRL                 OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0000)
-#define OMAP4430_PM_PDA_CPU0_PWRSTST                   OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0004)
-#define OMAP4430_RM_PDA_CPU0_CPU0_CONTEXT              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0008)
-#define OMAP4430_RM_PDA_CPU0_CPU0_RSTCTRL              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x000c)
-#define OMAP4430_RM_PDA_CPU0_CPU0_RSTST                        OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0010)
-#define OMAP4430_CM_PDA_CPU0_CPU0_CLKCTRL              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0014)
-#define OMAP4430_CM_PDA_CPU0_CLKSTCTRL                 OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0018)
+#define OMAP4430_PM_PDA_CPU0_PWRSTCTRL                 OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0000)
+#define OMAP4430_PM_PDA_CPU0_PWRSTST                   OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0004)
+#define OMAP4430_RM_PDA_CPU0_CPU0_CONTEXT              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0008)
+#define OMAP4430_RM_PDA_CPU0_CPU0_RSTCTRL              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x000c)
+#define OMAP4430_RM_PDA_CPU0_CPU0_RSTST                        OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0010)
+#define OMAP4430_CM_PDA_CPU0_CPU0_CLKCTRL              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0014)
+#define OMAP4430_CM_PDA_CPU0_CLKSTCTRL                 OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0018)
 
 /* CHIRON_PRCM.CHIRONSS_CPU1 register offsets */
-#define OMAP4430_PM_PDA_CPU1_PWRSTCTRL                 OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0000)
-#define OMAP4430_PM_PDA_CPU1_PWRSTST                   OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0004)
-#define OMAP4430_RM_PDA_CPU1_CPU1_CONTEXT              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0008)
-#define OMAP4430_RM_PDA_CPU1_CPU1_RSTCTRL              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x000c)
-#define OMAP4430_RM_PDA_CPU1_CPU1_RSTST                        OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0010)
-#define OMAP4430_CM_PDA_CPU1_CPU1_CLKCTRL              OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0014)
-#define OMAP4430_CM_PDA_CPU1_CLKSTCTRL                 OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0018)
+#define OMAP4430_PM_PDA_CPU1_PWRSTCTRL                 OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0000)
+#define OMAP4430_PM_PDA_CPU1_PWRSTST                   OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0004)
+#define OMAP4430_RM_PDA_CPU1_CPU1_CONTEXT              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0008)
+#define OMAP4430_RM_PDA_CPU1_CPU1_RSTCTRL              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x000c)
+#define OMAP4430_RM_PDA_CPU1_CPU1_RSTST                        OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0010)
+#define OMAP4430_CM_PDA_CPU1_CPU1_CLKCTRL              OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0014)
+#define OMAP4430_CM_PDA_CPU1_CLKSTCTRL                 OMAP44XX_CHIRONSS_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0018)
 #endif
index 8c964bec8159771099e4958c4cd6d96e618a99b1..e10a02df6e1d957d4d7bae0c986a164d938b2c0e 100644 (file)
 #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV    0x52
 #define UART_OMAP_WER          0x17    /* Wake-up enable register */
 
-#define DEFAULT_TIMEOUT (5 * HZ)
+/*
+ * NOTE: By default the serial timeout is disabled as it causes lost characters
+ * over the serial ports. This means that the UART clocks will stay on until
+ * disabled via sysfs. This also causes that any deeper omap sleep states are
+ * blocked. 
+ */
+#define DEFAULT_TIMEOUT 0
 
 struct omap_uart_state {
        int num;
@@ -422,7 +428,8 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
        uart->timeout = DEFAULT_TIMEOUT;
        setup_timer(&uart->timer, omap_uart_idle_timer,
                    (unsigned long) uart);
-       mod_timer(&uart->timer, jiffies + uart->timeout);
+       if (uart->timeout)
+               mod_timer(&uart->timer, jiffies + uart->timeout);
        omap_uart_smart_idle_enable(uart, 0);
 
        if (cpu_is_omap34xx()) {
index 15268f8b61de4c1958413be48add223834207f5d..c3626ea4814330fb64abbb0fdd5e91fd51d99d51 100644 (file)
@@ -245,7 +245,8 @@ restore:
        mov     r1, #0          @ set task id for ROM code in r1
        mov     r2, #4          @ set some flags in r2, r6
        mov     r6, #0xff
-       adr     r3, write_aux_control_params    @ r3 points to parameters
+       ldr     r4, scratchpad_base
+       ldr     r3, [r4, #0xBC] @ r3 points to parameters
        mcr     p15, 0, r0, c7, c10, 4  @ data write barrier
        mcr     p15, 0, r0, c7, c10, 5  @ data memory barrier
        .word   0xE1600071              @ call SMI monitor (smi #1)
@@ -253,14 +254,14 @@ restore:
        b       logic_l1_restore
 l2_inv_api_params:
        .word   0x1, 0x00
-write_aux_control_params:
-       .word   0x1, 0x72
 l2_inv_gp:
        /* Execute smi to invalidate L2 cache */
        mov r12, #0x1                         @ set up to invalide L2
 smi:    .word 0xE1600070               @ Call SMI monitor (smieq)
        /* Write to Aux control register to set some bits */
-       mov     r0, #0x72
+       ldr     r4, scratchpad_base
+       ldr     r3, [r4,#0xBC]
+       ldr     r0, [r3,#4]
        mov     r12, #0x3
        .word 0xE1600070        @ Call SMI monitor (smieq)
 logic_l1_restore:
@@ -271,6 +272,7 @@ logic_l1_restore:
 
        ldr     r4, scratchpad_base
        ldr     r3, [r4,#0xBC]
+       adds    r3, r3, #8
        ldmia   r3!, {r4-r6}
        mov     sp, r4
        msr     spsr_cxsf, r5
@@ -387,6 +389,9 @@ usettbr0:
 save_context_wfi:
        /*b     save_context_wfi*/      @ enable to debug save code
        mov     r8, r0 /* Store SDRAM address in r8 */
+       mrc     p15, 0, r5, c1, c0, 1   @ Read Auxiliary Control Register
+       mov     r4, #0x1                @ Number of parameters for restore call
+       stmia   r8!, {r4-r5}
         /* Check what that target sleep state is:stored in r1*/
         /* 1 - Only L1 and logic lost */
         /* 2 - Only L2 lost */
index b31ca4cef3650fea425b0cbd5f910e94864b5923..8f159db4d08a8b80e6498efe738c936ba0376380 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
@@ -32,6 +33,7 @@
 
 #define DNS323_GPIO_LED_RIGHT_AMBER    1
 #define DNS323_GPIO_LED_LEFT_AMBER     2
+#define DNS323_GPIO_SYSTEM_UP          3
 #define DNS323_GPIO_LED_POWER          5
 #define DNS323_GPIO_OVERTEMP           6
 #define DNS323_GPIO_RTC                        7
@@ -239,7 +241,7 @@ static struct gpio_led dns323_leds[] = {
        {
                .name = "power:blue",
                .gpio = DNS323_GPIO_LED_POWER,
-               .active_low = 1,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
        }, {
                .name = "right:amber",
                .gpio = DNS323_GPIO_LED_RIGHT_AMBER,
@@ -334,7 +336,7 @@ static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = {
        {  0, MPP_UNUSED },
        {  1, MPP_GPIO },               /* right amber LED (sata ch0) */
        {  2, MPP_GPIO },               /* left amber LED (sata ch1) */
-       {  3, MPP_UNUSED },
+       {  3, MPP_GPIO },               /* system up flag */
        {  4, MPP_GPIO },               /* power button LED */
        {  5, MPP_GPIO },               /* power button LED */
        {  6, MPP_GPIO },               /* GMT G751-2f overtemp */
@@ -372,13 +374,23 @@ static struct i2c_board_info __initdata dns323_i2c_devices[] = {
        },
 };
 
-/* DNS-323 specific power off method */
-static void dns323_power_off(void)
+/* DNS-323 rev. A specific power off method */
+static void dns323a_power_off(void)
 {
        pr_info("%s: triggering power-off...\n", __func__);
        gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
 }
 
+/* DNS-323 rev B specific power off method */
+static void dns323b_power_off(void)
+{
+       pr_info("%s: triggering power-off...\n", __func__);
+       /* Pin has to be changed to 1 and back to 0 to do actual power off. */
+       gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
+       mdelay(100);
+       gpio_set_value(DNS323_GPIO_POWER_OFF, 0);
+}
+
 static void __init dns323_init(void)
 {
        /* Setup basic Orion functions. Need to be called early. */
@@ -424,11 +436,20 @@ static void __init dns323_init(void)
        if (dns323_dev_id() == MV88F5182_DEV_ID)
                orion5x_sata_init(&dns323_sata_data);
 
-       /* register dns323 specific power-off method */
+       /* The 5182 has flag to indicate the system is up. Without this flag
+        * set, power LED will flash and cannot be controlled via leds-gpio.
+        */
+       if (dns323_dev_id() == MV88F5182_DEV_ID)
+               gpio_set_value(DNS323_GPIO_SYSTEM_UP, 1);
+
+       /* Register dns323 specific power-off method */
        if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
            gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
                pr_err("DNS323: failed to setup power-off GPIO\n");
-       pm_power_off = dns323_power_off;
+       if (dns323_dev_id() == MV88F5182_DEV_ID)
+               pm_power_off = dns323b_power_off;
+       else
+               pm_power_off = dns323a_power_off;
 }
 
 /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
index 1b4ad9d5e2ebeedeab6804e47b52651cc3e6c74e..cb0feca193d442781ffeb887915b601554a5a99b 100644 (file)
@@ -15,6 +15,9 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/ethtool.h>
+#include <linux/leds.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
 #include "common.h"
 #include "mpp.h"
 
+/*
+ * LEDs attached to GPIO
+ */
+static struct gpio_led wrt350n_v2_led_pins[] = {
+       {
+               .name           = "wrt350nv2:green:power",
+               .gpio           = 0,
+               .active_low     = 1,
+       }, {
+               .name           = "wrt350nv2:green:security",
+               .gpio           = 1,
+               .active_low     = 1,
+       }, {
+               .name           = "wrt350nv2:orange:power",
+               .gpio           = 5,
+               .active_low     = 1,
+       }, {
+               .name           = "wrt350nv2:green:usb",
+               .gpio           = 6,
+               .active_low     = 1,
+       }, {
+               .name           = "wrt350nv2:green:wireless",
+               .gpio           = 7,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_led_platform_data wrt350n_v2_led_data = {
+       .leds           = wrt350n_v2_led_pins,
+       .num_leds       = ARRAY_SIZE(wrt350n_v2_led_pins),
+};
+
+static struct platform_device wrt350n_v2_leds = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &wrt350n_v2_led_data,
+       },
+};
+
+/*
+ * Buttons attached to GPIO
+ */
+static struct gpio_keys_button wrt350n_v2_buttons[] = {
+       {
+               .code           = KEY_RESTART,
+               .gpio           = 3,
+               .desc           = "Reset Button",
+               .active_low     = 1,
+       }, {
+               .code           = KEY_WLAN,
+               .gpio           = 2,
+               .desc           = "WPS Button",
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_platform_data wrt350n_v2_button_data = {
+       .buttons        = wrt350n_v2_buttons,
+       .nbuttons       = ARRAY_SIZE(wrt350n_v2_buttons),
+};
+
+static struct platform_device wrt350n_v2_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &wrt350n_v2_button_data,
+       },
+};
+
+/*
+ * General setup
+ */
 static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
        {  0, MPP_GPIO },               /* Power LED green (0=on) */
        {  1, MPP_GPIO },               /* Security LED (0=on) */
@@ -140,6 +217,8 @@ static void __init wrt350n_v2_init(void)
        orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
                                   WRT350N_V2_NOR_BOOT_SIZE);
        platform_device_register(&wrt350n_v2_nor_flash);
+       platform_device_register(&wrt350n_v2_leds);
+       platform_device_register(&wrt350n_v2_button_device);
 }
 
 static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
index 74446cf8ae69ad941dc75c2d10d5a89094fd7fc3..da3156d8690bf1465d9f7c8470fb0e4fea0be0a9 100644 (file)
@@ -457,6 +457,7 @@ static struct pxaficp_platform_data corgi_ficp_platform_data = {
  * USB Device Controller
  */
 static struct pxa2xx_udc_mach_info udc_info __initdata = {
+       .gpio_vbus              = -1,
        /* no connect GPIO; corgi can't tell connection status */
        .gpio_pullup            = CORGI_GPIO_USB_PULLUP,
 };
index 31abe6d514b896b259224cbf48ae01d0213b4893..6709b1cd7c77b7b4eb48b2fc7f7ce208b20a3d94 100644 (file)
@@ -35,8 +35,6 @@
 #define PXA_CAMERA_VSP         0x400
 
 struct pxacamera_platform_data {
-       int (*init)(struct device *);
-
        unsigned long flags;
        unsigned long mclk_10khz;
 };
index b13dc0269a6dddde342d269cf059c3e6a6072e23..9c787855cf24135b632c154acd2aa81a62ff9893 100644 (file)
 #define GPIO86_nSDCS2          MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH)
 #define GPIO87_nSDCS3          MFP_CFG_OUT(GPIO87, AF0, DRIVE_HIGH)
 #define GPIO88_RDnWR           MFP_CFG_OUT(GPIO88, AF0, DRIVE_HIGH)
-#define GPIO89_nACRESET                MFP_CFG_OUT(GPIO89, AF0, DRIVE_HIGH)
 
 /* USB */
 #define GPIO9_USB_RCV          MFP_CFG_IN(GPIO9, AF1)
 #define GPIO30_ASSP_TXD                MFP_CFG_OUT(GPIO30, AF3, DRIVE_LOW)
 #define GPIO31_ASSP_SFRM_IN    MFP_CFG_IN(GPIO31, AF1)
 #define GPIO31_ASSP_SFRM_OUT   MFP_CFG_OUT(GPIO31, AF3, DRIVE_LOW)
-#endif
+
+/* AC97 */
+#define GPIO89_AC97_nRESET     MFP_CFG_OUT(GPIO89, AF0, DRIVE_HIGH)
+#endif /* CONFIG_CPU_PXA26x */
 
 #endif /* __ASM_ARCH_MFP_PXA25X_H */
index 6112af431fa4f933b14869fc5cf4a1904f56ce06..1beb40f692fcc93a67e5121335254c58c81bf8bd 100644 (file)
@@ -164,8 +164,11 @@ static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state)
                saved_icmr[i] = _ICMR(irq);
                _ICMR(irq) = 0;
        }
-       for (i = 0; i < pxa_internal_irq_nr; i++)
-               saved_ipr[i] = IPR(i);
+
+       if (cpu_is_pxa27x() || cpu_is_pxa3xx()) {
+               for (i = 0; i < pxa_internal_irq_nr; i++)
+                       saved_ipr[i] = IPR(i);
+       }
 
        return 0;
 }
@@ -174,12 +177,15 @@ static int pxa_irq_resume(struct sys_device *dev)
 {
        int i, irq = PXA_IRQ(0);
 
+       if (cpu_is_pxa27x() || cpu_is_pxa3xx()) {
+               for (i = 0; i < pxa_internal_irq_nr; i++)
+                       IPR(i) = saved_ipr[i];
+       }
+
        for (i = 0; irq < PXA_IRQ(pxa_internal_irq_nr); i++, irq += 32) {
                _ICMR(irq) = saved_icmr[i];
                _ICLR(irq) = 0;
        }
-       for (i = 0; i < pxa_internal_irq_nr; i++)
-               IPR(i) = saved_ipr[i];
 
        ICCR = 1;
        return 0;
index a21a4b395f733ad44a07ceae7371104375f2d2cd..d94857eb0690d8d83dc67781ac4ef7dd2d5bdf7d 100644 (file)
@@ -334,8 +334,8 @@ static void realview_pbx_reset(char mode)
         * in the system FPGA
         */
        __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
-       __raw_writel(0x0000, reset_ctrl);
-       __raw_writel(0x0004, reset_ctrl);
+       __raw_writel(0x00F0, reset_ctrl);
+       __raw_writel(0x00F4, reset_ctrl);
 }
 
 static void __init realview_pbx_init(void)
index 547d4fc99131648636626cad75aa6114db3d354c..2068e9096a434ef59ef0f1f4f35057fe43e1592c 100644 (file)
@@ -288,7 +288,7 @@ static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
 
 /* DM9000AEP 10/100 ethernet controller */
 
-static struct resource mini2440_dm9k_resource[] __initdata = {
+static struct resource mini2440_dm9k_resource[] = {
        [0] = {
                .start = MACH_MINI2440_DM9K_BASE,
                .end   = MACH_MINI2440_DM9K_BASE + 3,
@@ -310,11 +310,11 @@ static struct resource mini2440_dm9k_resource[] __initdata = {
  * The DM9000 has no eeprom, and it's MAC address is set by
  * the bootloader before starting the kernel.
  */
-static struct dm9000_plat_data mini2440_dm9k_pdata __initdata = {
+static struct dm9000_plat_data mini2440_dm9k_pdata = {
        .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
 };
 
-static struct platform_device mini2440_device_eth __initdata = {
+static struct platform_device mini2440_device_eth = {
        .name           = "dm9000",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(mini2440_dm9k_resource),
@@ -341,7 +341,7 @@ static struct platform_device mini2440_device_eth __initdata = {
  *     |  |  +----+  +----+
  *       .....
  */
-static struct gpio_keys_button mini2440_buttons[] __initdata = {
+static struct gpio_keys_button mini2440_buttons[] = {
        {
                .gpio           = S3C2410_GPG(0),               /* K1 */
                .code           = KEY_F1,
@@ -384,12 +384,12 @@ static struct gpio_keys_button mini2440_buttons[] __initdata = {
 #endif
 };
 
-static struct gpio_keys_platform_data mini2440_button_data __initdata = {
+static struct gpio_keys_platform_data mini2440_button_data = {
        .buttons        = mini2440_buttons,
        .nbuttons       = ARRAY_SIZE(mini2440_buttons),
 };
 
-static struct platform_device mini2440_button_device __initdata = {
+static struct platform_device mini2440_button_device = {
        .name           = "gpio-keys",
        .id             = -1,
        .dev            = {
@@ -399,41 +399,41 @@ static struct platform_device mini2440_button_device __initdata = {
 
 /* LEDS */
 
-static struct s3c24xx_led_platdata mini2440_led1_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led1_pdata = {
        .name           = "led1",
        .gpio           = S3C2410_GPB(5),
        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
        .def_trigger    = "heartbeat",
 };
 
-static struct s3c24xx_led_platdata mini2440_led2_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led2_pdata = {
        .name           = "led2",
        .gpio           = S3C2410_GPB(6),
        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
        .def_trigger    = "nand-disk",
 };
 
-static struct s3c24xx_led_platdata mini2440_led3_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led3_pdata = {
        .name           = "led3",
        .gpio           = S3C2410_GPB(7),
        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
        .def_trigger    = "mmc0",
 };
 
-static struct s3c24xx_led_platdata mini2440_led4_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led4_pdata = {
        .name           = "led4",
        .gpio           = S3C2410_GPB(8),
        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
        .def_trigger    = "",
 };
 
-static struct s3c24xx_led_platdata mini2440_led_backlight_pdata __initdata = {
+static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
        .name           = "backlight",
        .gpio           = S3C2410_GPG(4),
        .def_trigger    = "backlight",
 };
 
-static struct platform_device mini2440_led1 __initdata = {
+static struct platform_device mini2440_led1 = {
        .name           = "s3c24xx_led",
        .id             = 1,
        .dev            = {
@@ -441,7 +441,7 @@ static struct platform_device mini2440_led1 __initdata = {
        },
 };
 
-static struct platform_device mini2440_led2 __initdata = {
+static struct platform_device mini2440_led2 = {
        .name           = "s3c24xx_led",
        .id             = 2,
        .dev            = {
@@ -449,7 +449,7 @@ static struct platform_device mini2440_led2 __initdata = {
        },
 };
 
-static struct platform_device mini2440_led3 __initdata = {
+static struct platform_device mini2440_led3 = {
        .name           = "s3c24xx_led",
        .id             = 3,
        .dev            = {
@@ -457,7 +457,7 @@ static struct platform_device mini2440_led3 __initdata = {
        },
 };
 
-static struct platform_device mini2440_led4 __initdata = {
+static struct platform_device mini2440_led4 = {
        .name           = "s3c24xx_led",
        .id             = 4,
        .dev            = {
@@ -465,7 +465,7 @@ static struct platform_device mini2440_led4 __initdata = {
        },
 };
 
-static struct platform_device mini2440_led_backlight __initdata = {
+static struct platform_device mini2440_led_backlight = {
        .name           = "s3c24xx_led",
        .id             = 5,
        .dev            = {
@@ -475,14 +475,14 @@ static struct platform_device mini2440_led_backlight __initdata = {
 
 /* AUDIO */
 
-static struct s3c24xx_uda134x_platform_data mini2440_audio_pins __initdata = {
+static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
        .l3_clk = S3C2410_GPB(4),
        .l3_mode = S3C2410_GPB(2),
        .l3_data = S3C2410_GPB(3),
        .model = UDA134X_UDA1341
 };
 
-static struct platform_device mini2440_audio __initdata = {
+static struct platform_device mini2440_audio = {
        .name           = "s3c24xx_uda134x",
        .id             = 0,
        .dev            = {
index cdd4b5378552a9a30d699046838d906b87ae4b47..7619456f2ae839bb100c6a41ea1069ee8dfa80f8 100644 (file)
@@ -82,7 +82,7 @@ static int hmt_bl_init(struct device *dev)
        return ret;
 }
 
-static int hmt_bl_notify(int brightness)
+static int hmt_bl_notify(struct device *dev, int brightness)
 {
        /*
         * translate from CIELUV/CIELAB L*->brightness, E.G. from
index 480d297c1de242bcf4725a3dfd82063fd566d0fe..8969fe73b83ffcf1f6be556c1cf6aa2b60c9a390 100644 (file)
@@ -211,6 +211,7 @@ static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
        .supply_name = "B_PWR_5V",
        .microvolts = 5000000,
        .init_data = &smdk6410_b_pwr_5v_data,
+       .gpio = -EINVAL,
 };
 
 static struct platform_device smdk6410_b_pwr_5v = {
index b270d6228fe26ab7dea9a8e4d4c1f1bdeb804667..62820eda84d9ea89bb1ec729b8934c626a74c20a 100644 (file)
@@ -11,6 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/moduleparam.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -77,6 +78,8 @@ static unsigned long ai_dword;
 static unsigned long ai_multi;
 static int ai_usermode;
 
+core_param(alignment, ai_usermode, int, 0600);
+
 #define UM_WARN                (1 << 0)
 #define UM_FIXUP       (1 << 1)
 #define UM_SIGNAL      (1 << 2)
index 1708da82da96c127267b8edc59f916a0bec6a286..761ffede6a23a9027bd6d805a7fdb8d5e674c7ec 100644 (file)
@@ -1067,4 +1067,6 @@ void setup_mm_for_reboot(char mode)
                pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));
                flush_pmd_entry(pmd);
        }
+
+       local_flush_tlb_all();
 }
index 3f9cd3d8f6d508c447e46c5cf29ca078dd1b630b..795dc615f43bb6f4b6513f4ac6a17a287911876e 100644 (file)
@@ -41,7 +41,7 @@ ENTRY(cpu_arm7_dcache_clean_area)
 ENTRY(cpu_arm7_data_abort)
        mrc     p15, 0, r1, c5, c0, 0           @ get FSR
        mrc     p15, 0, r0, c6, c0, 0           @ get FAR
-       ldr     r8, [r0]                        @ read arm instruction
+       ldr     r8, [r2]                        @ read arm instruction
        tst     r8, #1 << 20                    @ L = 0 -> write?
        orreq   r1, r1, #1 << 11                @ yes.
        and     r7, r8, #15 << 24
index 395cc90c6613d616f56c502102747464baa2b159..7a5337ed7d68b6b1112e59ede2ce2dd5ed630a5f 100644 (file)
@@ -59,8 +59,6 @@ ENTRY(cpu_v6_proc_fin)
  *     to what would be the reset vector.
  *
  *     - loc   - location to jump to for soft reset
- *
- *     It is assumed that:
  */
        .align  5
 ENTRY(cpu_v6_reset)
index 3a285218fd158ae56908c2d1a69d86181b529765..7aaf88a3b7aabb7a8a7268d435eda8aa78bd7671 100644 (file)
@@ -45,7 +45,14 @@ ENTRY(cpu_v7_proc_init)
 ENDPROC(cpu_v7_proc_init)
 
 ENTRY(cpu_v7_proc_fin)
-       mov     pc, lr
+       stmfd   sp!, {lr}
+       cpsid   if                              @ disable interrupts
+       bl      v7_flush_kern_cache_all
+       mrc     p15, 0, r0, c1, c0, 0           @ ctrl register
+       bic     r0, r0, #0x1000                 @ ...i............
+       bic     r0, r0, #0x0006                 @ .............ca.
+       mcr     p15, 0, r0, c1, c0, 0           @ disable caches
+       ldmfd   sp!, {pc}
 ENDPROC(cpu_v7_proc_fin)
 
 /*
@@ -56,8 +63,6 @@ ENDPROC(cpu_v7_proc_fin)
  *     to what would be the reset vector.
  *
  *     - loc   - location to jump to for soft reset
- *
- *     It is assumed that:
  */
        .align  5
 ENTRY(cpu_v7_reset)
index 6f21096086fdefb5000c6d10a1e5744c0698b318..b06954a844367cbafae3c075c810bcc2b7858d57 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <mach/audmux.h>
 #include <mach/hardware.h>
 
@@ -32,6 +33,140 @@ static void __iomem *audmux_base;
 #define MXC_AUDMUX_V2_PTCR(x)          ((x) * 8)
 #define MXC_AUDMUX_V2_PDCR(x)          ((x) * 8 + 4)
 
+#ifdef CONFIG_DEBUG_FS
+static struct dentry *audmux_debugfs_root;
+
+static int audmux_open_file(struct inode *inode, struct file *file)
+{
+       file->private_data = inode->i_private;
+       return 0;
+}
+
+/* There is an annoying discontinuity in the SSI numbering with regard
+ * to the Linux number of the devices */
+static const char *audmux_port_string(int port)
+{
+       switch (port) {
+       case MX31_AUDMUX_PORT1_SSI0:
+               return "imx-ssi.0";
+       case MX31_AUDMUX_PORT2_SSI1:
+               return "imx-ssi.1";
+       case MX31_AUDMUX_PORT3_SSI_PINS_3:
+               return "SSI3";
+       case MX31_AUDMUX_PORT4_SSI_PINS_4:
+               return "SSI4";
+       case MX31_AUDMUX_PORT5_SSI_PINS_5:
+               return "SSI5";
+       case MX31_AUDMUX_PORT6_SSI_PINS_6:
+               return "SSI6";
+       default:
+               return "UNKNOWN";
+       }
+}
+
+static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
+                               size_t count, loff_t *ppos)
+{
+       ssize_t ret;
+       char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+       int port = (int)file->private_data;
+       u32 pdcr, ptcr;
+
+       if (!buf)
+               return -ENOMEM;
+
+       if (audmux_clk)
+               clk_enable(audmux_clk);
+
+       ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port));
+       pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port));
+
+       if (audmux_clk)
+               clk_disable(audmux_clk);
+
+       ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
+                      pdcr, ptcr);
+
+       if (ptcr & MXC_AUDMUX_V2_PTCR_TFSDIR)
+               ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                               "TxFS output from %s, ",
+                               audmux_port_string((ptcr >> 27) & 0x7));
+       else
+               ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                               "TxFS input, ");
+
+       if (ptcr & MXC_AUDMUX_V2_PTCR_TCLKDIR)
+               ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                               "TxClk output from %s",
+                               audmux_port_string((ptcr >> 22) & 0x7));
+       else
+               ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                               "TxClk input");
+
+       ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");
+
+       if (ptcr & MXC_AUDMUX_V2_PTCR_SYN) {
+               ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                               "Port is symmetric");
+       } else {
+               if (ptcr & MXC_AUDMUX_V2_PTCR_RFSDIR)
+                       ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                                       "RxFS output from %s, ",
+                                       audmux_port_string((ptcr >> 17) & 0x7));
+               else
+                       ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                                       "RxFS input, ");
+
+               if (ptcr & MXC_AUDMUX_V2_PTCR_RCLKDIR)
+                       ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                                       "RxClk output from %s",
+                                       audmux_port_string((ptcr >> 12) & 0x7));
+               else
+                       ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                                       "RxClk input");
+       }
+
+       ret += snprintf(buf + ret, PAGE_SIZE - ret,
+                       "\nData received from %s\n",
+                       audmux_port_string((pdcr >> 13) & 0x7));
+
+       ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+
+       kfree(buf);
+
+       return ret;
+}
+
+static const struct file_operations audmux_debugfs_fops = {
+       .open = audmux_open_file,
+       .read = audmux_read_file,
+};
+
+static void audmux_debugfs_init(void)
+{
+       int i;
+       char buf[20];
+
+       audmux_debugfs_root = debugfs_create_dir("audmux", NULL);
+       if (!audmux_debugfs_root) {
+               pr_warning("Failed to create AUDMUX debugfs root\n");
+               return;
+       }
+
+       for (i = 1; i < 8; i++) {
+               snprintf(buf, sizeof(buf), "ssi%d", i);
+               if (!debugfs_create_file(buf, 0444, audmux_debugfs_root,
+                                        (void *)i, &audmux_debugfs_fops))
+                       pr_warning("Failed to create AUDMUX port %d debugfs file\n",
+                                  i);
+       }
+}
+#else
+static inline void audmux_debugfs_init(void)
+{
+}
+#endif
+
 int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
                unsigned int pdcr)
 {
@@ -68,6 +203,8 @@ static int mxc_audmux_v2_init(void)
        if (cpu_is_mx31() || cpu_is_mx35())
                audmux_base = IO_ADDRESS(AUDMUX_BASE_ADDR);
 
+       audmux_debugfs_init();
+
        return 0;
 }
 
index 0184b638c2683b796a9ef1780f249719489e0dfd..2b2da0367578dbb13a4dbf6e12894709f079acec 100644 (file)
@@ -25,7 +25,7 @@
 
 #ifndef __ASSEMBLY__
 
-enum mx31lilly_boards {
+enum mx31lite_boards {
        MX31LITE_NOBOARD        = 0,
        MX31LITE_DB             = 1,
 };
index 286cb9b0a25b1e6fc76292609ccabe6fe853b5cd..4bf1068ffad9a764781a0af769ac65323b849746 100644 (file)
@@ -32,7 +32,7 @@ extern void mxc91231_init_irq(void);
 extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
 extern int mx1_clocks_init(unsigned long fref);
 extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
-extern int mx25_clocks_init(unsigned long fref);
+extern int mx25_clocks_init(void);
 extern int mx27_clocks_init(unsigned long fref);
 extern int mx31_clocks_init(unsigned long fref);
 extern int mx35_clocks_init(void);
index 00b0ac1db225fd798ee3dadf47179b82dffd2b32..c88d40795f7ab63410a7e573ed864dc83040db26 100644 (file)
 #define MX35_PAD_LD8__SDMA_SDMA_DEBUG_PC_8                     IOMUX_PAD(0x634, 0x1d0, 6, 0x0,   0, NO_PAD_CTRL)
 
 #define MX35_PAD_LD9__IPU_DISPB_DAT_9                          IOMUX_PAD(0x638, 0x1d4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD9__GPIO2_9                                  IOMUX_PAD(0x638, 0x1d4, 5, 0x8e4  0, NO_PAD_CTRL)
+#define MX35_PAD_LD9__GPIO2_9                                  IOMUX_PAD(0x638, 0x1d4, 5, 0x8e4, 0, NO_PAD_CTRL)
 #define MX35_PAD_LD9__SDMA_SDMA_DEBUG_PC_9                     IOMUX_PAD(0x638, 0x1d4, 6, 0x0,   0, NO_PAD_CTRL)
 
 #define MX35_PAD_LD10__IPU_DISPB_DAT_10                                IOMUX_PAD(0x63c, 0x1d8, 0, 0x0,   0, NO_PAD_CTRL)
index ead9d592168da7fb57494409d772d551968c7d02..0cb347645db49cc8e9265b548eb1df3de37102f2 100644 (file)
  * within sensible limits.
  */
 #define MXC_BOARD_IRQ_START    (MXC_INTERNAL_IRQS + MXC_GPIO_IRQS)
+
+#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
+#define MXC_BOARD_IRQS  80
+#else
 #define MXC_BOARD_IRQS 16
+#endif
 
 #define MXC_IPU_IRQ_START      (MXC_BOARD_IRQ_START + MXC_BOARD_IRQS)
 
index 4d5d395ad63b68d5dbcf148e256e9007f99bbc84..d49384cb1e97e8584f0a823f7b04858eed7966f4 100644 (file)
@@ -60,7 +60,9 @@ static void putc(int ch)
        UART(TXR) = ch;
 }
 
-#define flush() do { } while (0)
+static inline void flush(void)
+{
+}
 
 #define MX1_UART1_BASE_ADDR    0x00206000
 #define MX25_UART1_BASE_ADDR   0x43f90000
index d9f8c844c385fa18f7b92aa88431296df9f75140..4becbdd1935cbe8e4c64edbafe82bb66c70f9fbe 100644 (file)
@@ -391,7 +391,7 @@ static struct dentry *clk_debugfs_root;
 static int clk_debugfs_register_one(struct clk *c)
 {
        int err;
-       struct dentry *d, *child;
+       struct dentry *d, *child, *child_tmp;
        struct clk *pa = c->parent;
        char s[255];
        char *p = s;
@@ -423,7 +423,7 @@ static int clk_debugfs_register_one(struct clk *c)
 
 err_out:
        d = c->dent;
-       list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+       list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
                debugfs_remove(child);
        debugfs_remove(c->dent);
        return err;
index bf1eaf3a27d452e915a83fb381ccc54490a4a88b..dddc0273bc8bc4157248c6677925bc3de3cc4446 100644 (file)
@@ -172,6 +172,32 @@ unsigned long long sched_clock(void)
                                  clocksource_32k.mult, clocksource_32k.shift);
 }
 
+/**
+ * read_persistent_clock -  Return time from a persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM, the
+ * 32k sync timer.  Convert the cycles elapsed since last read into
+ * nsecs and adds to a monotonically increasing timespec.
+ */
+static struct timespec persistent_ts;
+static cycles_t cycles, last_cycles;
+void read_persistent_clock(struct timespec *ts)
+{
+       unsigned long long nsecs;
+       cycles_t delta;
+       struct timespec *tsp = &persistent_ts;
+
+       last_cycles = cycles;
+       cycles = clocksource_32k.read(&clocksource_32k);
+       delta = cycles - last_cycles;
+
+       nsecs = clocksource_cyc2ns(delta,
+                                  clocksource_32k.mult, clocksource_32k.shift);
+
+       timespec_add_ns(tsp, nsecs);
+       *ts = *tsp;
+}
+
 static int __init omap_init_clocksource_32k(void)
 {
        static char err[] __initdata = KERN_ERR
index 09d82b3c66ce3f2331e9581dadea3f804bf075fd..728c642041847a8e91c1c22294c4f338af8308dc 100644 (file)
@@ -1183,7 +1183,7 @@ void omap_dma_unlink_lch(int lch_head, int lch_queue)
        }
 
        if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
-           (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) {
+           (dma_chan[lch_queue].flags & OMAP_DMA_ACTIVE)) {
                printk(KERN_ERR "omap_dma: You need to stop the DMA channels "
                       "before unlinking\n");
                dump_stack();
index 64f407ee0f4e61394cf47673abb082f3300e2d74..08ccf89225202d512de9242e5ceab12457087309 100644 (file)
@@ -551,6 +551,19 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
        if (l & OMAP_TIMER_CTRL_ST) {
                l &= ~0x1;
                omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+                       defined(CONFIG_ARCH_OMAP4)
+               /* Readback to make sure write has completed */
+               omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
+                /*
+                 * Wait for functional clock period x 3.5 to make sure that
+                 * timer is stopped
+                 */
+               udelay(3500000 / clk_get_rate(timer->fclk) + 1);
+               /* Ack possibly pending interrupt */
+               omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
+                               OMAP_TIMER_INT_OVERFLOW);
+#endif
        }
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
index d17620c50c286a9a7aa5f3e80a05872042acdd79..d2422c766cca215ecd6f51bfbfaa5ceeca303ac4 100644 (file)
@@ -750,6 +750,7 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
 }
 #endif
 
+#ifdef CONFIG_ARCH_OMAP1
 /*
  * This only applies to chips that can't do both rising and falling edge
  * detection at once.  For all other chips, this function is a noop.
@@ -760,11 +761,9 @@ static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
        u32 l = 0;
 
        switch (bank->method) {
-#ifdef CONFIG_ARCH_OMAP1
        case METHOD_MPUIO:
                reg += OMAP_MPUIO_GPIO_INT_EDGE;
                break;
-#endif
 #ifdef CONFIG_ARCH_OMAP15XX
        case METHOD_GPIO_1510:
                reg += OMAP1510_GPIO_INT_CONTROL;
@@ -787,6 +786,7 @@ static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
 
        __raw_writel(l, reg);
 }
+#endif
 
 static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
 {
index 9a028bdebb06797166f2a3fff44e0aacd685740b..a162f585b1e3bdf0652088eb1929aea836857aa0 100644 (file)
@@ -434,6 +434,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define OMAP3430_REV_ES2_1     0x34302034
 #define OMAP3430_REV_ES3_0     0x34303034
 #define OMAP3430_REV_ES3_1     0x34304034
+#define OMAP3430_REV_ES3_1_2   0x34305034
 
 #define OMAP3630_REV_ES1_0     0x36300034
 
index 97d6c50c3dcb00b24d1d43551e6a4a3b8402621f..c0ab7c80f72e75b1ec113acbb5147806c7623369 100644 (file)
@@ -499,6 +499,9 @@ extern void omap_init_irq(void);
 extern int omap_irq_pending(void);
 void omap_intc_save_context(void);
 void omap_intc_restore_context(void);
+void omap3_intc_suspend(void);
+void omap3_intc_prepare_idle(void);
+void omap3_intc_resume_idle(void);
 #endif
 
 #include <mach/hardware.h>
index 007935a921eaeaa4efd69ab1a0b53d757ad90587..33933256a2265815351307749768e73435d6cc01 100644 (file)
@@ -227,6 +227,7 @@ struct omap_hwmod_ocp_if {
 #define SYSC_HAS_SIDLEMODE     (1 << 5)
 #define SYSC_HAS_MIDLEMODE     (1 << 6)
 #define SYSS_MISSING           (1 << 7)
+#define SYSC_NO_CACHE          (1 << 8)  /* XXX SW flag, belongs elsewhere */
 
 /* omap_hwmod_sysconfig.clockact flags */
 #define CLOCKACT_TEST_BOTH     0x0
index 1e5648d3e3d8a04a08092e42777b593cca04f073..2ed72013c2e22efb43fc78ce2764250a25919447 100644 (file)
 #define USE_WAKEUP_LAT                 0
 #define IGNORE_WAKEUP_LAT              1
 
-/* XXX this should be moved into a separate file */
-#if defined(CONFIG_ARCH_OMAP2420)
-# define OMAP_32KSYNCT_BASE            0x48004000
-#elif defined(CONFIG_ARCH_OMAP2430)
-# define OMAP_32KSYNCT_BASE            0x49020000
-#elif defined(CONFIG_ARCH_OMAP3430)
-# define OMAP_32KSYNCT_BASE            0x48320000
-#else
-# error Unknown OMAP device
-#endif
 
 /* Private functions */
 
index d41d41d78ad98676dea41aeb6466fb1ebf2bb811..54c84a492a0f0ab95de7ffa1590e0c5cf5259dc1 100644 (file)
@@ -132,6 +132,12 @@ static void __init orion_pcie_setup_wins(void __iomem *base,
                size += cs->size;
        }
 
+       /*
+        * Round up 'size' to the nearest power of two.
+        */
+       if ((size & (size - 1)) != 0)
+               size = 1 << fls(size);
+
        /*
         * Setup BAR[1] to all DRAM banks.
         */
index 84808ccda70ebf8e528d6aa5e44ba36048b17a2c..a52fb6cf618fb93e77e1aae7a37a14a55efede77 100644 (file)
@@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
                        return -ENOMEM;
        }
        
-       size = sizeof(int) * set->nr_chips;
-       if (size) {
+       if (set->nr_map && set->nr_chips) {
+               size = sizeof(int) * set->nr_chips;
                ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
                set->nr_map = ptr;
 
index c3a74ce24ef6c16f101bb5898a0c23056e0ee9e8..31c2f4c30a95b94631bc9e9568247e644b9d0eb2 100644 (file)
@@ -12,7 +12,7 @@
 #
 #   http://www.arm.linux.org.uk/developer/machines/?action=new
 #
-# Last update: Wed Dec 16 20:06:34 2009
+# Last update: Sat Feb 20 14:16:15 2010
 #
 # machine_is_xxx       CONFIG_xxxx             MACH_TYPE_xxx           number
 #
@@ -2257,7 +2257,7 @@ oratisalog                MACH_ORATISALOG         ORATISALOG              2268
 oratismadi             MACH_ORATISMADI         ORATISMADI              2269
 oratisot16             MACH_ORATISOT16         ORATISOT16              2270
 oratisdesk             MACH_ORATISDESK         ORATISDESK              2271
-v2_ca9                 MACH_V2P_CA9            V2P_CA9                 2272
+vexpress               MACH_VEXPRESS           VEXPRESS                2272
 sintexo                        MACH_SINTEXO            SINTEXO                 2273
 cm3389                 MACH_CM3389             CM3389                  2274
 omap3_cio              MACH_OMAP3_CIO          OMAP3_CIO               2275
@@ -2536,6 +2536,7 @@ davinci_dm6467tevm        MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM      2548
 c3ax03                 MACH_C3AX03             C3AX03                  2549
 mxt_td60               MACH_MXT_TD60           MXT_TD60                2550
 esyx                   MACH_ESYX               ESYX                    2551
+dove_db2               MACH_DOVE_DB2           DOVE_DB2                2552
 bulldog                        MACH_BULLDOG            BULLDOG                 2553
 derell_me2000          MACH_DERELL_ME2000      DERELL_ME2000           2554
 bcmring_base           MACH_BCMRING_BASE       BCMRING_BASE            2555
@@ -2555,6 +2556,7 @@ iseo                      MACH_ISEO               ISEO                    2568
 cezanne                        MACH_CEZANNE            CEZANNE                 2569
 lucca                  MACH_LUCCA              LUCCA                   2570
 supersmart             MACH_SUPERSMART         SUPERSMART              2571
+arm11_board            MACH_CS_MISANO          CS_MISANO               2572
 magnolia2              MACH_MAGNOLIA2          MAGNOLIA2               2573
 emxx                   MACH_EMXX               EMXX                    2574
 outlaw                 MACH_OUTLAW             OUTLAW                  2575
@@ -2578,3 +2580,101 @@ glacier                 MACH_GLACIER            GLACIER                 2592
 phrazer_bulldog                MACH_PHRAZER_BULLDOG    PHRAZER_BULLDOG         2593
 omap3_bulldog          MACH_OMAP3_BULLDOG      OMAP3_BULLDOG           2594
 pca101                 MACH_PCA101             PCA101                  2595
+buzzc                  MACH_BUZZC              BUZZC                   2596
+sasie2                 MACH_SASIE2             SASIE2                  2597
+davinci_cio            MACH_DAVINCI_CIO        DAVINCI_CIO             2598
+smartmeter_dl          MACH_SMARTMETER_DL      SMARTMETER_DL           2599
+wzl6410                        MACH_WZL6410            WZL6410                 2600
+wzl6410m               MACH_WZL6410M           WZL6410M                2601
+wzl6410f               MACH_WZL6410F           WZL6410F                2602
+wzl6410i               MACH_WZL6410I           WZL6410I                2603
+spacecom1              MACH_SPACECOM1          SPACECOM1               2604
+pingu920               MACH_PINGU920           PINGU920                2605
+bravoc                 MACH_BRAVOC             BRAVOC                  2606
+cybo2440               MACH_CYBO2440           CYBO2440                2607
+vdssw                  MACH_VDSSW              VDSSW                   2608
+romulus                        MACH_ROMULUS            ROMULUS                 2609
+omap_magic             MACH_OMAP_MAGIC         OMAP_MAGIC              2610
+eltd100                        MACH_ELTD100            ELTD100                 2611
+capc7117               MACH_CAPC7117           CAPC7117                2612
+swan                   MACH_SWAN               SWAN                    2613
+veu                    MACH_VEU                VEU                     2614
+rm2                    MACH_RM2                RM2                     2615
+tt2100                 MACH_TT2100             TT2100                  2616
+venice                 MACH_VENICE             VENICE                  2617
+pc7323                 MACH_PC7323             PC7323                  2618
+masp                   MACH_MASP               MASP                    2619
+fujitsu_tvstbsoc0      MACH_FUJITSU_TVSTBSOC   FUJITSU_TVSTBSOC        2620
+fujitsu_tvstbsoc1      MACH_FUJITSU_TVSTBSOC1  FUJITSU_TVSTBSOC1       2621
+lexikon                        MACH_LEXIKON            LEXIKON                 2622
+mini2440v2             MACH_MINI2440V2         MINI2440V2              2623
+icontrol               MACH_ICONTROL           ICONTROL                2624
+sheevad                        MACH_SHEEVAD            SHEEVAD                 2625
+qsd8x50a_st1_1         MACH_QSD8X50A_ST1_1     QSD8X50A_ST1_1          2626
+qsd8x50a_st1_5         MACH_QSD8X50A_ST1_5     QSD8X50A_ST1_5          2627
+bee                    MACH_BEE                BEE                     2628
+mx23evk                        MACH_MX23EVK            MX23EVK                 2629
+ap4evb                 MACH_AP4EVB             AP4EVB                  2630
+stockholm              MACH_STOCKHOLM          STOCKHOLM               2631
+lpc_h3131              MACH_LPC_H3131          LPC_H3131               2632
+stingray               MACH_STINGRAY           STINGRAY                2633
+kraken                 MACH_KRAKEN             KRAKEN                  2634
+gw2388                 MACH_GW2388             GW2388                  2635
+jadecpu                        MACH_JADECPU            JADECPU                 2636
+carlisle               MACH_CARLISLE           CARLISLE                2637
+lux_sf9                        MACH_LUX_SFT9           LUX_SFT9                2638
+nemid_tb               MACH_NEMID_TB           NEMID_TB                2639
+terrier                        MACH_TERRIER            TERRIER                 2640
+turbot                 MACH_TURBOT             TURBOT                  2641
+sanddab                        MACH_SANDDAB            SANDDAB                 2642
+mx35_cicada            MACH_MX35_CICADA        MX35_CICADA             2643
+ghi2703d               MACH_GHI2703D           GHI2703D                2644
+lux_sfx9               MACH_LUX_SFX9           LUX_SFX9                2645
+lux_sf9g               MACH_LUX_SF9G           LUX_SF9G                2646
+lux_edk9               MACH_LUX_EDK9           LUX_EDK9                2647
+hw90240                        MACH_HW90240            HW90240                 2648
+dm365_leopard          MACH_DM365_LEOPARD      DM365_LEOPARD           2649
+mityomapl138           MACH_MITYOMAPL138       MITYOMAPL138            2650
+scat110                        MACH_SCAT110            SCAT110                 2651
+acer_a1                        MACH_ACER_A1            ACER_A1                 2652
+cmcontrol              MACH_CMCONTROL          CMCONTROL               2653
+pelco_lamar            MACH_PELCO_LAMAR        PELCO_LAMAR             2654
+rfp43                  MACH_RFP43              RFP43                   2655
+sk86r0301              MACH_SK86R0301          SK86R0301               2656
+ctpxa                  MACH_CTPXA              CTPXA                   2657
+epb_arm9_a             MACH_EPB_ARM9_A         EPB_ARM9_A              2658
+guruplug               MACH_GURUPLUG           GURUPLUG                2659
+spear310               MACH_SPEAR310           SPEAR310                2660
+spear320               MACH_SPEAR320           SPEAR320                2661
+robotx                 MACH_ROBOTX             ROBOTX                  2662
+lsxhl                  MACH_LSXHL              LSXHL                   2663
+smartlite              MACH_SMARTLITE          SMARTLITE               2664
+cws2                   MACH_CWS2               CWS2                    2665
+m619                   MACH_M619               M619                    2666
+smartview              MACH_SMARTVIEW          SMARTVIEW               2667
+lsa_salsa              MACH_LSA_SALSA          LSA_SALSA               2668
+kizbox                 MACH_KIZBOX             KIZBOX                  2669
+htccharmer             MACH_HTCCHARMER         HTCCHARMER              2670
+guf_neso_lt            MACH_GUF_NESO_LT        GUF_NESO_LT             2671
+pm9g45                 MACH_PM9G45             PM9G45                  2672
+htcpanther             MACH_HTCPANTHER         HTCPANTHER              2673
+htcpanther_cdma                MACH_HTCPANTHER_CDMA    HTCPANTHER_CDMA         2674
+reb01                  MACH_REB01              REB01                   2675
+aquila                 MACH_AQUILA             AQUILA                  2676
+spark_sls_hw2          MACH_SPARK_SLS_HW2      SPARK_SLS_HW2           2677
+sheeva_esata           MACH_ESATA_SHEEVAPLUG   ESATA_SHEEVAPLUG        2678
+surf7x30               MACH_SURF7X30           SURF7X30                2679
+micro2440              MACH_MICRO2440          MICRO2440               2680
+am2440                 MACH_AM2440             AM2440                  2681
+tq2440                 MACH_TQ2440             TQ2440                  2682
+lpc2478oem             MACH_LPC2478OEM         LPC2478OEM              2683
+ak880x                 MACH_AK880X             AK880X                  2684
+cobra3530              MACH_COBRA3530          COBRA3530               2685
+pmppb                  MACH_PMPPB              PMPPB                   2686
+u6715                  MACH_U6715              U6715                   2687
+axar1500_sender                MACH_AXAR1500_SENDER    AXAR1500_SENDER         2688
+g30_dvb                        MACH_G30_DVB            G30_DVB                 2689
+vc088x                 MACH_VC088X             VC088X                  2690
+mioa702                        MACH_MIOA702            MIOA702                 2691
+hpmin                  MACH_HPMIN              HPMIN                   2692
+ak880xak               MACH_AK880XAK           AK880XAK                2693
index f60a5400a25b055919621d572bf31fa45c2a94bb..a63c4be99b36eb576cbf2314aab9725960f2ea1d 100644 (file)
@@ -197,10 +197,13 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
        }
 
        /*
-        * Update the FPSCR with the additional exception flags.
+        * If any of the status flags are set, update the FPSCR.
         * Comparison instructions always return at least one of
         * these flags set.
         */
+       if (exceptions & (FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V))
+               fpscr &= ~(FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V);
+
        fpscr |= exceptions;
 
        fmxr(FPSCR, fpscr);
index 1aa1ea5e92127984428e06747289f3e2f055f1d1..b13d1879e51b9f0d961fdff8af8c15b9950dcd0e 100644 (file)
@@ -1325,7 +1325,7 @@ struct platform_device *__init
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 {
        struct platform_device          *pdev;
-       struct mci_dma_slave            *slave;
+       struct mci_dma_data             *slave;
        u32                             pioa_mask;
        u32                             piob_mask;
 
@@ -1344,7 +1344,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
                                ARRAY_SIZE(atmel_mci0_resource)))
                goto fail;
 
-       slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
+       slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
+       if (!slave)
+               goto fail;
 
        slave->sdata.dma_dev = &dw_dmac0_device.dev;
        slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
@@ -1357,7 +1359,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 
        if (platform_device_add_data(pdev, data,
                                sizeof(struct mci_platform_data)))
-               goto fail;
+               goto fail_free;
 
        /* CLK line is common to both slots */
        pioa_mask = 1 << 10;
@@ -1381,7 +1383,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
                /* Slot is unused */
                break;
        default:
-               goto fail;
+               goto fail_free;
        }
 
        select_peripheral(PIOA, pioa_mask, PERIPH_A, 0);
@@ -1408,7 +1410,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
                break;
        default:
                if (!data->slot[0].bus_width)
-                       goto fail;
+                       goto fail_free;
 
                data->slot[1].bus_width = 0;
                break;
@@ -1419,9 +1421,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
        platform_device_add(pdev);
        return pdev;
 
+fail_free:
+       kfree(slave);
 fail:
        data->dma_slave = NULL;
-       kfree(slave);
        platform_device_put(pdev);
        return NULL;
 }
index 77ee319193c32a1d9e4a4287b13e4e28d6506a7e..d4b9c36ddc0fb62f2f8f284897a9504f411307a6 100644 (file)
@@ -41,18 +41,16 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        return 0;
 }
 
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                       resource_size_t size, resource_size_t align)
 {
-       if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
+       resource_size_t start = res->start;
 
-               if (start & 0x300) {
-                       start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
-       }
+       if ((res->flags & IORESOURCE_IO) && (start & 0x300))
+               start = (start + 0x3ff) & ~0x3ff;
+
+       return start
 }
 
 int pcibios_enable_resources(struct pci_dev *dev, int mask)
index 566bdeb499d14e1c1a0a574505a8a887e541da9c..1ed15d7fea20c0e8975b22d492fa1e5da3bfb107 100644 (file)
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                       resource_size_t size, resource_size_t align)
 {
-       if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
+       resource_size_t start = res->start;
 
-               if (start & 0x300) {
-                       start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
-       }
+       if ((res->flags & IORESOURCE_IO) && (start & 0x300))
+               start = (start + 0x3ff) & ~0x3ff;
+
+       return start
 }
 
 
index ccd6ade816dd027cc86653f7050cc7d132602cd2..40d8aa811e4e4506dbc97fc5575ba2091845e159 100644 (file)
@@ -44,8 +44,8 @@ void cache_push_v (unsigned long vaddr, int len)
 {
 }
 
-/* Map some physical address range into the kernel address space. The
- * code is copied and adapted from map_chunk().
+/*
+ * Map some physical address range into the kernel address space.
  */
 
 unsigned long kernel_map(unsigned long paddr, unsigned long size,
index 7ae58892ba8d87ee699925380bcd92d59eca06ff..93997bd5edc3031bf724c6f54fcb53fc98c8feb3 100644 (file)
@@ -94,9 +94,11 @@ ia64_acpi_release_global_lock (unsigned int *lock)
 #define acpi_noirq 0   /* ACPI always enabled on IA64 */
 #define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
 #define acpi_strict 1  /* no ACPI spec workarounds on IA64 */
+#define acpi_ht 0      /* no HT-only mode on IA64 */
 #endif
 #define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
 static inline void disable_acpi(void) { }
+static inline void pci_acpi_crs_quirks(void) { }
 
 const char *acpi_get_sysname (void);
 int acpi_request_vector (u32 int_type);
index e14108b19c091a654eb2a28cbf45ff104efa5ace..4c41656ede87e828e95226fabf409fedc09406ca 100644 (file)
@@ -201,7 +201,9 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
    relevant until we have real hardware to play with... */
 #define ELF_PLATFORM   NULL
 
-#define SET_PERSONALITY(ex)    set_personality(PER_LINUX)
+#define SET_PERSONALITY(ex)    \
+       set_personality((current->personality & ~PER_MASK) | PER_LINUX)
+
 #define elf_read_implies_exec(ex, executable_stack)                                    \
        ((executable_stack!=EXSTACK_DISABLE_X) && ((ex).e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK) != 0)
 
index 9adac441ac9bb1f4400a6620951d7e07bbdcdfbe..7026b29e277a6785c397a4c7e6889c32cc91b69e 100644 (file)
@@ -870,7 +870,7 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
                return 1;
 
 ss_probe:
-#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
+#if !defined(CONFIG_PREEMPT)
        if (p->ainsn.inst_flag == INST_FLAG_BOOSTABLE && !p->post_handler) {
                /* Boost up -- we can execute copied instructions directly */
                ia64_psr(regs)->ri = p->ainsn.slot;
index a35c661e5e89a544b097f731af1e65486c3077c2..47a192781b0aab9f3144170394a1564fb0b30cff 100644 (file)
@@ -61,7 +61,7 @@ unsigned long long sched_clock(void)
 
 #ifdef CONFIG_PARAVIRT
 static void
-paravirt_clocksource_resume(void)
+paravirt_clocksource_resume(struct clocksource *cs)
 {
        if (pv_time_ops.clocksource_resume)
                pv_time_ops.clocksource_resume();
index df639db779f95192a71d93d5895113080b1bf41a..64aff520b899d59ef84a4c94032eb9cc13f7f3fa 100644 (file)
@@ -320,9 +320,9 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
 static void __devinit
 pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
 {
-       int i, j;
+       int i;
 
-       j = 0;
+       pci_bus_remove_resources(bus);
        for (i = 0; i < ctrl->windows; i++) {
                struct resource *res = &ctrl->window[i].resource;
                /* HP's firmware has a hack to work around a Windows bug.
@@ -330,13 +330,7 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
                if ((res->flags & IORESOURCE_MEM) &&
                    (res->end - res->start < 16))
                        continue;
-               if (j >= PCI_BUS_NUM_RESOURCES) {
-                       dev_warn(&bus->dev,
-                                "ignoring host bridge window %pR (no space)\n",
-                                res);
-                       continue;
-               }
-               bus->resource[j++] = res;
+               pci_bus_add_resource(bus, res, 0);
        }
 }
 
@@ -452,13 +446,12 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
 static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
 {
        unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
-       struct resource *devr = &dev->resource[idx];
+       struct resource *devr = &dev->resource[idx], *busr;
 
        if (!dev->bus)
                return 0;
-       for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) {
-               struct resource *busr = dev->bus->resource[i];
 
+       pci_bus_for_each_resource(dev->bus, busr, i) {
                if (!busr || ((busr->flags ^ devr->flags) & type_mask))
                        continue;
                if ((devr->start) && (devr->start >= busr->start) &&
@@ -547,10 +540,11 @@ pcibios_disable_device (struct pci_dev *dev)
                acpi_pci_irq_disable(dev);
 }
 
-void
-pcibios_align_resource (void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource (void *data, const struct resource *res,
                        resource_size_t size, resource_size_t align)
 {
+       return res->start;
 }
 
 /*
index ece1bf994499a1d55e33cf64d2c7fd9f13e8dad4..e456f062f2419deb5f2bfd9d0e968d88b1c79ac5 100644 (file)
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
 DEFINE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
 EXPORT_PER_CPU_SYMBOL(__sn_hub_info);
 
-DEFINE_PER_CPU(short [MAX_COMPACT_NODES], __sn_cnodeid_to_nasid);
+DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
 EXPORT_PER_CPU_SYMBOL(__sn_cnodeid_to_nasid);
 
 DEFINE_PER_CPU(struct nodepda_s *, __sn_nodepda);
index ecdc19a299b2333c335790a19eeaeb95ebadf853..b5da298ba61df539b07bcadd8ef979d465215d5d 100644 (file)
@@ -536,10 +536,6 @@ config GVPIOEXT_PLIP
          Say Y to enable doing IP over the parallel port on your GVP
          IO-Extender card, N otherwise.
 
-config MAC_SCC
-       tristate "Macintosh serial support"
-       depends on MAC
-
 config MAC_HID
        bool
        depends on INPUT_ADBHID
@@ -595,7 +591,7 @@ config DN_SERIAL
 
 config SERIAL_CONSOLE
        bool "Support for serial port console"
-       depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
+       depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
        ---help---
          If you say Y here, it will be possible to use a serial port as the
          system console (the system console is the device which receives all
index 6c74751c7b821bbc5eedfeeba20a2bc9673149bb..d2cc35d985328f7a240ad85216fc9123820be008 100644 (file)
@@ -480,7 +480,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
        static struct resource sched_res = {
                .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
        };
-       jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
+       jiffy_ticks = DIV_ROUND_CLOSEST(amiga_eclock, HZ);
 
        if (request_resource(&mb_resources._ciab, &sched_res))
                printk("Cannot allocate ciab.ta{lo,hi}\n");
index 9991b64fea575f0d741c5b1bf9884c39705f903d..c5f3232ff9161307213daaa19cbbbcd3819acaf8 100644 (file)
@@ -701,6 +701,11 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
 #
 # Non-8250 serial port support
 #
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_PMACZILOG=y
+CONFIG_SERIAL_PMACZILOG_TTYS=y
+CONFIG_SERIAL_PMACZILOG_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -834,9 +839,7 @@ CONFIG_HIDRAW=y
 #
 # Character devices
 #
-CONFIG_MAC_SCC=y
 CONFIG_MAC_HID=y
-CONFIG_SERIAL_CONSOLE=y
 
 #
 # File systems
index 69c43e2d8b45457944c79123866a8b26ce467cc2..a8bfa3fa71cfa5b31e04e06967e8d1ac35bf8d95 100644 (file)
@@ -822,6 +822,11 @@ CONFIG_A2232=y
 #
 # Non-8250 serial port support
 #
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_PMACZILOG=y
+CONFIG_SERIAL_PMACZILOG_TTYS=y
+CONFIG_SERIAL_PMACZILOG_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -982,7 +987,6 @@ CONFIG_ATARI_MIDI=y
 CONFIG_ATARI_DSP56K=m
 CONFIG_AMIGA_BUILTIN_SERIAL=y
 CONFIG_MULTIFACE_III_TTY=m
-CONFIG_MAC_SCC=y
 CONFIG_MAC_HID=y
 CONFIG_MVME147_SCC=y
 CONFIG_SERIAL167=y
index 2b4de0c2ce4a0a49c9cb5aec1fc48cea7378e22b..a220951649279e0cd2827fec7d0b4b84ebb10e2b 100644 (file)
 #define VIDEOMEMSIZE   (4096*1024)
 #define VIDEOMEMMASK   (-4096*1024)
 
-#ifndef __ASSEMBLY__
-
-#include <linux/types.h>
-
-#if 0
-/*
-** SCC Z8530
-*/
-
-#define MAC_SCC_BAS (0x50F04000)
-struct MAC_SCC
- {
-  u_char cha_a_ctrl;
-  u_char char_dummy1;
-  u_char cha_a_data;
-  u_char char_dummy2;
-  u_char cha_b_ctrl;
-  u_char char_dummy3;
-  u_char cha_b_data;
- };
-# define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS))
-#endif
-
-#endif /* __ASSEMBLY__ */
-
 #endif /* linux/machw.h */
index 679c48ab44076c3e31006c6b17406c6909df0106..ebe1b70fe90c822e5e2f4aad3ed95f51f56e5188 100644 (file)
@@ -37,7 +37,6 @@
 
 #define VIA1_SOURCE_BASE       8
 #define VIA2_SOURCE_BASE       16
-#define MAC_SCC_SOURCE_BASE    24
 #define PSC3_SOURCE_BASE       24
 #define PSC4_SOURCE_BASE       32
 #define PSC5_SOURCE_BASE       40
 #define IRQ_PSC3_2       (26)
 #define IRQ_PSC3_3       (27)
 
-/* Level 4 (SCC) interrupts */
-#define IRQ_SCC                     (32)
-#define IRQ_SCCA            (33)
-#define IRQ_SCCB            (34)
-#if 0 /* FIXME: are there multiple interrupt conditions on the SCC ?? */
-/* SCC interrupts */
-#define IRQ_SCCB_TX         (32)
-#define IRQ_SCCB_STAT       (33)
-#define IRQ_SCCB_RX         (34)
-#define IRQ_SCCB_SPCOND             (35)
-#define IRQ_SCCA_TX         (36)
-#define IRQ_SCCA_STAT       (37)
-#define IRQ_SCCA_RX         (38)
-#define IRQ_SCCA_SPCOND             (39)
-#endif
-
 /* Level 4 (PSC, AV Macs only) interrupts */
 #define IRQ_PSC4_0       (32)
 #define IRQ_PSC4_1       (33)
+#define IRQ_MAC_SCC_A    IRQ_PSC4_1
 #define IRQ_PSC4_2       (34)
+#define IRQ_MAC_SCC_B    IRQ_PSC4_2
 #define IRQ_PSC4_3       (35)
 #define IRQ_MAC_MACE_DMA  IRQ_PSC4_3
 
 #define IRQ_BABOON_2     (66)
 #define IRQ_BABOON_3     (67)
 
+/* On non-PSC machines, the serial ports share an IRQ */
+#define IRQ_MAC_SCC      IRQ_AUTO_4
+
 #define SLOT2IRQ(x)      (x + 47)
 #define IRQ2SLOT(x)      (x - 47)
 
index ee4011c232812819be83d47d5daa253b5ddef1df..21605c736f6985b12b8dbc1f8799a23d5df7d8bf 100644 (file)
@@ -71,6 +71,8 @@ struct switch_stack {
 #define PTRACE_GETFPREGS          14
 #define PTRACE_SETFPREGS          15
 
+#define PTRACE_GET_THREAD_AREA    25
+
 #define PTRACE_SINGLEBLOCK     33      /* resume execution until next branch */
 
 #ifdef __KERNEL__
index 523db2a51cf304137b52315cae08ee2e4a7c8144..1320eaa4cc2aab4b531a565c57ab62afb30bd0ec 100644 (file)
@@ -15,9 +15,15 @@ struct sigcontext {
        unsigned long  sc_pc;
        unsigned short sc_formatvec;
 #ifndef __uClinux__
+# ifdef __mcoldfire__
+       unsigned long  sc_fpregs[2][2]; /* room for two fp registers */
+       unsigned long  sc_fpcntl[3];
+       unsigned char  sc_fpstate[16+6*8];
+# else
        unsigned long  sc_fpregs[2*3];  /* room for two fp registers */
        unsigned long  sc_fpcntl[3];
        unsigned char  sc_fpstate[216];
+# endif
 #endif
 };
 
index ca7dde8fd22348987b85dcdf269996d9a4446bd2..851d3d784b53ba92206e6a1d5ad2a46d9293b49b 100644 (file)
@@ -1,97 +1,6 @@
 #ifndef _M68K_SIGINFO_H
 #define _M68K_SIGINFO_H
 
-#ifndef __uClinux__
-#define HAVE_ARCH_SIGINFO_T
-#define HAVE_ARCH_COPY_SIGINFO
-#endif
-
 #include <asm-generic/siginfo.h>
 
-#ifndef __uClinux__
-
-typedef struct siginfo {
-       int si_signo;
-       int si_errno;
-       int si_code;
-
-       union {
-               int _pad[SI_PAD_SIZE];
-
-               /* kill() */
-               struct {
-                       __kernel_pid_t _pid;    /* sender's pid */
-                       __kernel_uid_t _uid;    /* backwards compatibility */
-                       __kernel_uid32_t _uid32; /* sender's uid */
-               } _kill;
-
-               /* POSIX.1b timers */
-               struct {
-                       timer_t _tid;           /* timer id */
-                       int _overrun;           /* overrun count */
-                       char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
-                       sigval_t _sigval;       /* same as below */
-                       int _sys_private;       /* not to be passed to user */
-               } _timer;
-
-               /* POSIX.1b signals */
-               struct {
-                       __kernel_pid_t _pid;    /* sender's pid */
-                       __kernel_uid_t _uid;    /* backwards compatibility */
-                       sigval_t _sigval;
-                       __kernel_uid32_t _uid32; /* sender's uid */
-               } _rt;
-
-               /* SIGCHLD */
-               struct {
-                       __kernel_pid_t _pid;    /* which child */
-                       __kernel_uid_t _uid;    /* backwards compatibility */
-                       int _status;            /* exit code */
-                       clock_t _utime;
-                       clock_t _stime;
-                       __kernel_uid32_t _uid32; /* sender's uid */
-               } _sigchld;
-
-               /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-               struct {
-                       void *_addr; /* faulting insn/memory ref. */
-               } _sigfault;
-
-               /* SIGPOLL */
-               struct {
-                       int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
-                       int _fd;
-               } _sigpoll;
-       } _sifields;
-} siginfo_t;
-
-#define UID16_SIGINFO_COMPAT_NEEDED
-
-/*
- * How these fields are to be accessed.
- */
-#undef si_uid
-#ifdef __KERNEL__
-#define si_uid         _sifields._kill._uid32
-#define si_uid16       _sifields._kill._uid
-#else
-#define si_uid         _sifields._kill._uid
-#endif
-
-#ifdef __KERNEL__
-
-#include <linux/string.h>
-
-static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
-{
-       if (from->si_code < 0)
-               memcpy(to, from, sizeof(*to));
-       else
-               /* _sigchld is currently the largest know union member */
-               memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
-}
-
-#endif /* __KERNEL__ */
-#endif /* !__uClinux__ */
-
 #endif
index 5b754aace744959af8918e2b94ab3f7351c1ed1c..b7b37a40defc82d167a354fd9a8a63aeb4e4cf48 100644 (file)
@@ -14,7 +14,7 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
 }
 
 #define __arch_swab32 __arch_swab32
-#elif !defined(__uClinux__)
+#elif !defined(__mcoldfire__)
 
 static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
 {
index 167e518db41b69bcb01c43c4b1a9f056f0f0232d..67266c683453e34c05e4edf9bf5e1df2f2197a4d 100644 (file)
@@ -16,6 +16,7 @@ struct thread_info {
        struct exec_domain      *exec_domain;   /* execution domain */
        int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
        __u32 cpu; /* should always be 0 on m68k */
+       unsigned long           tp_value;       /* thread pointer */
        struct restart_block    restart_block;
 };
 #endif /* __ASSEMBLY__ */
index a6512bfdd01ddbe5dc304d7fc72e985bd3478259..884776f686cacf4159699a00953e4203ee0e8537 100644 (file)
@@ -37,6 +37,7 @@ struct thread_info {
        unsigned long      flags;               /* low level flags */
        int                cpu;                 /* cpu we're on */
        int                preempt_count;       /* 0 => preemptable, <0 => BUG */
+       unsigned long      tp_value;            /* thread pointer */
        struct restart_block restart_block;
 };
 
index e4e22669edc0669c55c1edc9a1947664b3c1d4bc..00dcc5176c577ba82d505b297f1447981fc7dac4 100644 (file)
@@ -7,7 +7,11 @@ typedef greg_t gregset_t[NGREG];
 
 typedef struct fpregset {
        int f_fpcntl[3];
+#ifdef __mcoldfire__
+       int f_fpregs[8][2];
+#else
        int f_fpregs[8*3];
+#endif
 } fpregset_t;
 
 struct mcontext {
index 48b87f5ced50bc60250ea4ae6399e60dc563f109..d72a71dabecb128e91f1e5bd0fa489504b274750 100644 (file)
 #define __NR_pwritev           330
 #define __NR_rt_tgsigqueueinfo 331
 #define __NR_perf_event_open   332
+#define __NR_get_thread_area   333
+#define __NR_set_thread_area   334
+#define __NR_atomic_cmpxchg_32 335
+#define __NR_atomic_barrier    336
 
 #ifdef __KERNEL__
 
-#define NR_syscalls            333
+#define NR_syscalls            337
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
index 3f834b3ab5bdad32a2281e80917f8df931a62d31..f35229b8651dcff3744b7b55010f53b615d70678 100644 (file)
@@ -31,12 +31,7 @@ static inline void *phys_to_virt(unsigned long address)
 #define page_to_phys(page) \
        __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
 #else
-#define page_to_phys(_page) ({                                         \
-       struct page *__page = _page;                                    \
-       struct pglist_data *pgdat;                                      \
-       pgdat = pg_data_table[page_to_nid(__page)];                     \
-       page_to_pfn(__page) << PAGE_SHIFT;                              \
-})
+#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
 #endif
 #else
 #define page_to_phys(page)     (((page) - mem_map) << PAGE_SHIFT)
index 77fc7c16bf4886b3cef7ea0f6f623a0651172fb6..e136b8cbe9b9ad1782f03ebd1809f02c0df37d36 100644 (file)
@@ -761,4 +761,8 @@ sys_call_table:
        .long sys_pwritev               /* 330 */
        .long sys_rt_tgsigqueueinfo
        .long sys_perf_event_open
+       .long sys_get_thread_area
+       .long sys_set_thread_area
+       .long sys_atomic_cmpxchg_32     /* 335 */
+       .long sys_atomic_barrier
 
index 05296593e71888060247903d71d5df8387cbe3bb..17c3f325255de36707bcb2dac5ec0981d57a7f42 100644 (file)
@@ -251,6 +251,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 
        p->thread.usp = usp;
        p->thread.ksp = (unsigned long)childstack;
+
+       if (clone_flags & CLONE_SETTLS)
+               task_thread_info(p)->tp_value = regs->d5;
+
        /*
         * Must save the current SFC/DFC value, NOT the value when
         * the parent was last descheduled - RGH  10-08-96
index 1fc217e5f06b97e323247319dd7d27b14892357c..616e59752c29bc15f6c0e64c219c626caf755dca 100644 (file)
@@ -245,6 +245,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                        ret = -EFAULT;
                break;
 
+       case PTRACE_GET_THREAD_AREA:
+               ret = put_user(task_thread_info(child)->tp_value,
+                              (unsigned long __user *)data);
+               break;
+
        default:
                ret = ptrace_request(child, request, addr, data);
                break;
index de2d05ddd86d9d8ca6c7699f3d93d9ca0ad05861..4b387538706f2275ab5fd6044e74bee1b2e6fde7 100644 (file)
@@ -897,10 +897,17 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
 
        /* Set up to return from userspace.  */
        err |= __put_user(frame->retcode, &frame->pretcode);
+#ifdef __mcoldfire__
+       /* movel #__NR_rt_sigreturn,d0; trap #0 */
+       err |= __put_user(0x203c0000, (long __user *)(frame->retcode + 0));
+       err |= __put_user(0x00004e40 + (__NR_rt_sigreturn << 16),
+                         (long __user *)(frame->retcode + 4));
+#else
        /* moveq #,d0; notb d0; trap #0 */
        err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
                          (long __user *)(frame->retcode + 0));
        err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
+#endif
 
        if (err)
                goto give_sigsegv;
index 218f441de667c6f5fb35de5d5caaefdeeb6f84fb..e3ad2d6719736fb123f062bea7ffeb4a946b5725 100644 (file)
 #include <asm/traps.h>
 #include <asm/page.h>
 #include <asm/unistd.h>
+#include <linux/elf.h>
+#include <asm/tlb.h>
+
+asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
+                            unsigned long error_code);
 
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
        unsigned long prot, unsigned long flags,
@@ -595,3 +600,79 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
                        : "d" (__a), "d" (__b), "d" (__c));
        return __res;
 }
+
+asmlinkage unsigned long sys_get_thread_area(void)
+{
+       return current_thread_info()->tp_value;
+}
+
+asmlinkage int sys_set_thread_area(unsigned long tp)
+{
+       current_thread_info()->tp_value = tp;
+       return 0;
+}
+
+/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
+   D1 (newval).  */
+asmlinkage int
+sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
+                     unsigned long __user * mem)
+{
+       /* This was borrowed from ARM's implementation.  */
+       for (;;) {
+               struct mm_struct *mm = current->mm;
+               pgd_t *pgd;
+               pmd_t *pmd;
+               pte_t *pte;
+               spinlock_t *ptl;
+               unsigned long mem_value;
+
+               down_read(&mm->mmap_sem);
+               pgd = pgd_offset(mm, (unsigned long)mem);
+               if (!pgd_present(*pgd))
+                       goto bad_access;
+               pmd = pmd_offset(pgd, (unsigned long)mem);
+               if (!pmd_present(*pmd))
+                       goto bad_access;
+               pte = pte_offset_map_lock(mm, pmd, (unsigned long)mem, &ptl);
+               if (!pte_present(*pte) || !pte_dirty(*pte)
+                   || !pte_write(*pte)) {
+                       pte_unmap_unlock(pte, ptl);
+                       goto bad_access;
+               }
+
+               mem_value = *mem;
+               if (mem_value == oldval)
+                       *mem = newval;
+
+               pte_unmap_unlock(pte, ptl);
+               up_read(&mm->mmap_sem);
+               return mem_value;
+
+             bad_access:
+               up_read(&mm->mmap_sem);
+               /* This is not necessarily a bad access, we can get here if
+                  a memory we're trying to write to should be copied-on-write.
+                  Make the kernel do the necessary page stuff, then re-iterate.
+                  Simulate a write access fault to do that.  */
+               {
+                       /* The first argument of the function corresponds to
+                          D1, which is the first field of struct pt_regs.  */
+                       struct pt_regs *fp = (struct pt_regs *)&newval;
+
+                       /* '3' is an RMW flag.  */
+                       if (do_page_fault(fp, (unsigned long)mem, 3))
+                               /* If the do_page_fault() failed, we don't
+                                  have anything meaningful to return.
+                                  There should be a SIGSEGV pending for
+                                  the process.  */
+                               return 0xdeadbeef;
+               }
+       }
+}
+
+asmlinkage int sys_atomic_barrier(void)
+{
+       /* no code needed for uniprocs */
+       return 0;
+}
index daebd80bdef030b1371ecc484a832d7315a7a891..b8d4c835f9a2a855d591b9495b4744a890334cba 100644 (file)
@@ -3,4 +3,4 @@
 #
 
 obj-y          := config.o macints.o iop.o via.o oss.o psc.o \
-                       baboon.o macboing.o debug.o misc.o
+                       baboon.o macboing.o misc.o
index be017984a456e66c58369748cec265f6da6f2c46..0356da9bf763abacdb678c7af196a091fd7300d3 100644 (file)
@@ -23,6 +23,8 @@
 #include <linux/init.h>
 #include <linux/vt_kern.h>
 #include <linux/platform_device.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
 
 #define BOOTINFO_COMPAT_1_0
 #include <asm/setup.h>
 #include <asm/mac_oss.h>
 #include <asm/mac_psc.h>
 
-/* platform device info */
-
-#define SWIM_IO_SIZE 0x2000    /* SWIM IO resource size */
-
 /* Mac bootinfo struct */
-
 struct mac_booter_data mac_bi_data;
 
 /* The phys. video addr. - might be bogus on some machines */
@@ -70,8 +67,6 @@ extern void baboon_init(void);
 
 extern void mac_mksound(unsigned int, unsigned int);
 
-extern void nubus_sweep_video(void);
-
 static void mac_get_model(char *str);
 static void mac_identify(void);
 static void mac_report_hardware(void);
@@ -167,12 +162,6 @@ void __init config_mac(void)
        mach_max_dma_address = 0xffffffff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
        mach_beep = mac_mksound;
-#endif
-#ifdef CONFIG_HEARTBEAT
-#if 0
-       mach_heartbeat = mac_heartbeat;
-       mach_heartbeat_irq = IRQ_MAC_TIMER;
-#endif
 #endif
 
        /*
@@ -191,27 +180,19 @@ void __init config_mac(void)
        if (macintosh_config->ident == MAC_MODEL_IICI
            || macintosh_config->ident == MAC_MODEL_IIFX)
                mach_l2_flush = mac_cache_card_flush;
-
-       /*
-        * Check for machine specific fixups.
-        */
-
-#ifdef OLD_NUBUS_CODE
-       nubus_sweep_video();
-#endif
 }
 
 
 /*
- *     Macintosh Table: hardcoded model configuration data.
+ * Macintosh Table: hardcoded model configuration data.
  *
- *     Much of this was defined by Alan, based on who knows what docs.
- *     I've added a lot more, and some of that was pure guesswork based
- *     on hardware pages present on the Mac web site. Possibly wildly
- *     inaccurate, so look here if a new Mac model won't run. Example: if
- *     a Mac crashes immediately after the VIA1 registers have been dumped
- *     to the screen, it probably died attempting to read DirB on a RBV.
- *     Meaning it should have MAC_VIA_IIci here :-)
+ * Much of this was defined by Alan, based on who knows what docs.
+ * I've added a lot more, and some of that was pure guesswork based
+ * on hardware pages present on the Mac web site. Possibly wildly
+ * inaccurate, so look here if a new Mac model won't run. Example: if
+ * a Mac crashes immediately after the VIA1 registers have been dumped
+ * to the screen, it probably died attempting to read DirB on a RBV.
+ * Meaning it should have MAC_VIA_IIci here :-)
  */
 
 struct mac_model *macintosh_config;
@@ -219,7 +200,7 @@ EXPORT_SYMBOL(macintosh_config);
 
 static struct mac_model mac_data_table[] = {
        /*
-        *      We'll pretend to be a Macintosh II, that's pretty safe.
+        * We'll pretend to be a Macintosh II, that's pretty safe.
         */
 
        {
@@ -230,12 +211,11 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_IWM
+               .floppy_type    = MAC_FLOPPY_IWM,
        },
 
        /*
-        *      Original MacII hardware
-        *
+        * Original Mac II hardware
         */
 
        {
@@ -246,7 +226,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_IWM
+               .floppy_type    = MAC_FLOPPY_IWM,
        }, {
                .ident          = MAC_MODEL_IIX,
                .name           = "IIx",
@@ -255,7 +235,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_IICX,
                .name           = "IIcx",
@@ -264,7 +244,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_SE30,
                .name           = "SE/30",
@@ -273,13 +253,13 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Weirdified MacII hardware - all subtly different. Gee thanks
-        *      Apple. All these boxes seem to have VIA2 in a different place to
-        *      the MacII (+1A000 rather than +4000)
+        * Weirdified Mac II hardware - all subtly different. Gee thanks
+        * Apple. All these boxes seem to have VIA2 in a different place to
+        * the Mac II (+1A000 rather than +4000)
         * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
         */
 
@@ -291,7 +271,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_IIFX,
                .name           = "IIfx",
@@ -300,7 +280,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_IOP,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_IOP
+               .floppy_type    = MAC_FLOPPY_SWIM_IOP,
        }, {
                .ident          = MAC_MODEL_IISI,
                .name           = "IIsi",
@@ -309,7 +289,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_IIVI,
                .name           = "IIvi",
@@ -318,7 +298,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_IIVX,
                .name           = "IIvx",
@@ -327,11 +307,11 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
+        * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
         */
 
        {
@@ -342,7 +322,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_CCL,
                .name           = "Color Classic",
@@ -351,11 +331,11 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
+        * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
         */
 
        {
@@ -366,7 +346,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_LCII,
                .name           = "LC II",
@@ -375,7 +355,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_LCIII,
                .name           = "LC III",
@@ -384,17 +364,17 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
-        *      as some of the stuff connected to VIA2 seems different. Better SCSI chip and
-        *      onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
-        *      AMD 79C940 (MACE).
-        *      The 700, 900 and 950 have some I/O chips in the wrong place to
-        *      confuse us. The 840AV has a SCSI location of its own (same as
-        *      the 660AV).
+        * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
+        * differently as some of the stuff connected to VIA2 seems different.
+        * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
+        * the 660AV and 840AV which use an AMD 79C940 (MACE).
+        * The 700, 900 and 950 have some I/O chips in the wrong place to
+        * confuse us. The 840AV has a SCSI location of its own (same as
+        * the 660AV).
         */
 
        {
@@ -405,7 +385,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_QUADRA,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q605_ACC,
                .name           = "Quadra 605",
@@ -414,7 +394,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_QUADRA,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q610,
                .name           = "Quadra 610",
@@ -424,7 +404,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q630,
                .name           = "Quadra 630",
@@ -435,7 +415,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q650,
                .name           = "Quadra 650",
@@ -445,9 +425,9 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        },
-       /*      The Q700 does have a NS Sonic */
+       /* The Q700 does have a NS Sonic */
        {
                .ident          = MAC_MODEL_Q700,
                .name           = "Quadra 700",
@@ -457,7 +437,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q800,
                .name           = "Quadra 800",
@@ -467,7 +447,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_Q840,
                .name           = "Quadra 840AV",
@@ -477,7 +457,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_PSC,
                .ether_type     = MAC_ETHER_MACE,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_AV
+               .floppy_type    = MAC_FLOPPY_AV,
        }, {
                .ident          = MAC_MODEL_Q900,
                .name           = "Quadra 900",
@@ -487,7 +467,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_IOP,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_IOP
+               .floppy_type    = MAC_FLOPPY_SWIM_IOP,
        }, {
                .ident          = MAC_MODEL_Q950,
                .name           = "Quadra 950",
@@ -497,60 +477,60 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_IOP,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_IOP
+               .floppy_type    = MAC_FLOPPY_SWIM_IOP,
        },
 
        /*
-        *      Performa - more LC type machines
+        * Performa - more LC type machines
         */
 
        {
                .ident          = MAC_MODEL_P460,
-               .name           =  "Performa 460",
+               .name           = "Performa 460",
                .adb_type       = MAC_ADB_IISI,
                .via_type       = MAC_VIA_IIci,
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_P475,
-               .name           =  "Performa 475",
+               .name           = "Performa 475",
                .adb_type       = MAC_ADB_CUDA,
                .via_type       = MAC_VIA_QUADRA,
                .scsi_type      = MAC_SCSI_QUADRA,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_P475F,
-               .name           =  "Performa 475",
+               .name           = "Performa 475",
                .adb_type       = MAC_ADB_CUDA,
                .via_type       = MAC_VIA_QUADRA,
                .scsi_type      = MAC_SCSI_QUADRA,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_P520,
-               .name           =  "Performa 520",
+               .name           = "Performa 520",
                .adb_type       = MAC_ADB_CUDA,
                .via_type       = MAC_VIA_IIci,
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_P550,
-               .name           =  "Performa 550",
+               .name           = "Performa 550",
                .adb_type       = MAC_ADB_CUDA,
                .via_type       = MAC_VIA_IIci,
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
-       /* These have the comm slot, and therefore the possibility of SONIC ethernet */
+       /* These have the comm slot, and therefore possibly SONIC ethernet */
        {
                .ident          = MAC_MODEL_P575,
                .name           = "Performa 575",
@@ -560,7 +540,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_II,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_P588,
                .name           = "Performa 588",
@@ -571,7 +551,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_II,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_TV,
                .name           = "TV",
@@ -580,7 +560,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_P600,
                .name           = "Performa 600",
@@ -589,14 +569,14 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_II,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Centris - just guessing again; maybe like Quadra
+        * Centris - just guessing again; maybe like Quadra.
+        * The C610 may or may not have SONIC. We probe to make sure.
         */
 
-       /* The C610 may or may not have SONIC.  We probe to make sure */
        {
                .ident          = MAC_MODEL_C610,
                .name           = "Centris 610",
@@ -606,7 +586,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_C650,
                .name           = "Centris 650",
@@ -616,7 +596,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR1,
        }, {
                .ident          = MAC_MODEL_C660,
                .name           = "Centris 660AV",
@@ -626,7 +606,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_PSC,
                .ether_type     = MAC_ETHER_MACE,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_AV
+               .floppy_type    = MAC_FLOPPY_AV,
        },
 
        /*
@@ -643,7 +623,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB145,
                .name           = "PowerBook 145",
@@ -652,7 +632,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB150,
                .name           = "PowerBook 150",
@@ -662,7 +642,7 @@ static struct mac_model mac_data_table[] = {
                .ide_type       = MAC_IDE_PB,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB160,
                .name           = "PowerBook 160",
@@ -671,7 +651,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB165,
                .name           = "PowerBook 165",
@@ -680,7 +660,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB165C,
                .name           = "PowerBook 165c",
@@ -689,7 +669,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB170,
                .name           = "PowerBook 170",
@@ -698,7 +678,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB180,
                .name           = "PowerBook 180",
@@ -707,7 +687,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB180C,
                .name           = "PowerBook 180c",
@@ -716,7 +696,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB190,
                .name           = "PowerBook 190",
@@ -726,7 +706,7 @@ static struct mac_model mac_data_table[] = {
                .ide_type       = MAC_IDE_BABOON,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB520,
                .name           = "PowerBook 520",
@@ -736,7 +716,7 @@ static struct mac_model mac_data_table[] = {
                .scc_type       = MAC_SCC_QUADRA,
                .ether_type     = MAC_ETHER_SONIC,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
@@ -757,7 +737,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB230,
                .name           = "PowerBook Duo 230",
@@ -766,7 +746,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB250,
                .name           = "PowerBook Duo 250",
@@ -775,7 +755,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB270C,
                .name           = "PowerBook Duo 270c",
@@ -784,7 +764,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB280,
                .name           = "PowerBook Duo 280",
@@ -793,7 +773,7 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        }, {
                .ident          = MAC_MODEL_PB280C,
                .name           = "PowerBook Duo 280c",
@@ -802,17 +782,44 @@ static struct mac_model mac_data_table[] = {
                .scsi_type      = MAC_SCSI_OLD,
                .scc_type       = MAC_SCC_QUADRA,
                .nubus_type     = MAC_NUBUS,
-               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2
+               .floppy_type    = MAC_FLOPPY_SWIM_ADDR2,
        },
 
        /*
-        *      Other stuff ??
+        * Other stuff?
         */
+
        {
                .ident          = -1
        }
 };
 
+static struct resource scc_a_rsrcs[] = {
+       { .flags = IORESOURCE_MEM },
+       { .flags = IORESOURCE_IRQ },
+};
+
+static struct resource scc_b_rsrcs[] = {
+       { .flags = IORESOURCE_MEM },
+       { .flags = IORESOURCE_IRQ },
+};
+
+struct platform_device scc_a_pdev = {
+       .name           = "scc",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(scc_a_rsrcs),
+       .resource       = scc_a_rsrcs,
+};
+EXPORT_SYMBOL(scc_a_pdev);
+
+struct platform_device scc_b_pdev = {
+       .name           = "scc",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(scc_b_rsrcs),
+       .resource       = scc_b_rsrcs,
+};
+EXPORT_SYMBOL(scc_b_pdev);
+
 static void __init mac_identify(void)
 {
        struct mac_model *m;
@@ -823,7 +830,8 @@ static void __init mac_identify(void)
                /* no bootinfo model id -> NetBSD booter was used! */
                /* XXX FIXME: breaks for model > 31 */
                model = (mac_bi_data.cpuid >> 2) & 63;
-               printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
+               printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
+                      "(obsolete bootloader?)\n");
        }
 
        macintosh_config = mac_data_table;
@@ -834,10 +842,29 @@ static void __init mac_identify(void)
                }
        }
 
-       /* We need to pre-init the IOPs, if any. Otherwise */
-       /* the serial console won't work if the user had   */
-       /* the serial ports set to "Faster" mode in MacOS. */
+       /* Set up serial port resources for the console initcall. */
+
+       scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
+       scc_a_rsrcs[0].end   = scc_a_rsrcs[0].start;
+       scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
+       scc_b_rsrcs[0].end   = scc_b_rsrcs[0].start;
 
+       switch (macintosh_config->scc_type) {
+       case MAC_SCC_PSC:
+               scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
+               scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
+               break;
+       default:
+               scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
+               scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
+               break;
+       }
+
+       /*
+        * We need to pre-init the IOPs, if any. Otherwise
+        * the serial console won't work if the user had
+        * the serial ports set to "Faster" mode in MacOS.
+        */
        iop_preinit();
 
        printk(KERN_INFO "Detected Macintosh model: %d \n", model);
@@ -846,7 +873,8 @@ static void __init mac_identify(void)
         * Report booter data:
         */
        printk(KERN_DEBUG " Penguin bootinfo data:\n");
-       printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
+       printk(KERN_DEBUG " Video: addr 0x%lx "
+               "row 0x%lx depth %lx dimensions %ld x %ld\n",
                mac_bi_data.videoaddr, mac_bi_data.videorow,
                mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
                mac_bi_data.dimensions >> 16);
@@ -863,6 +891,10 @@ static void __init mac_identify(void)
        oss_init();
        psc_init();
        baboon_init();
+
+#ifdef CONFIG_ADB_CUDA
+       find_via_cuda();
+#endif
 }
 
 static void __init mac_report_hardware(void)
@@ -876,23 +908,50 @@ static void mac_get_model(char *str)
        strcat(str, macintosh_config->name);
 }
 
-static struct resource swim_resources[1];
+static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
 
-static struct platform_device swim_device = {
+static struct platform_device swim_pdev = {
        .name           = "swim",
        .id             = -1,
-       .num_resources  = ARRAY_SIZE(swim_resources),
-       .resource       = swim_resources,
+       .num_resources  = 1,
+       .resource       = &swim_rsrc,
 };
 
-static struct platform_device *mac_platform_devices[] __initdata = {
-       &swim_device
+static struct platform_device esp_0_pdev = {
+       .name           = "mac_esp",
+       .id             = 0,
+};
+
+static struct platform_device esp_1_pdev = {
+       .name           = "mac_esp",
+       .id             = 1,
+};
+
+static struct platform_device sonic_pdev = {
+       .name           = "macsonic",
+       .id             = -1,
+};
+
+static struct platform_device mace_pdev = {
+       .name           = "macmace",
+       .id             = -1,
 };
 
 int __init mac_platform_init(void)
 {
        u8 *swim_base;
 
+       /*
+        * Serial devices
+        */
+
+       platform_device_register(&scc_a_pdev);
+       platform_device_register(&scc_b_pdev);
+
+       /*
+        * Floppy device
+        */
+
        switch (macintosh_config->floppy_type) {
        case MAC_FLOPPY_SWIM_ADDR1:
                swim_base = (u8 *)(VIA1_BASE + 0x1E000);
@@ -901,16 +960,47 @@ int __init mac_platform_init(void)
                swim_base = (u8 *)(VIA1_BASE + 0x16000);
                break;
        default:
-               return 0;
+               swim_base = NULL;
+               break;
        }
 
-       swim_resources[0].name = "swim-regs";
-       swim_resources[0].start = (resource_size_t)swim_base;
-       swim_resources[0].end = (resource_size_t)(swim_base + SWIM_IO_SIZE);
-       swim_resources[0].flags = IORESOURCE_MEM;
+       if (swim_base) {
+               swim_rsrc.start = (resource_size_t) swim_base,
+               swim_rsrc.end   = (resource_size_t) swim_base + 0x2000,
+               platform_device_register(&swim_pdev);
+       }
+
+       /*
+        * SCSI device(s)
+        */
+
+       switch (macintosh_config->scsi_type) {
+       case MAC_SCSI_QUADRA:
+       case MAC_SCSI_QUADRA3:
+               platform_device_register(&esp_0_pdev);
+               break;
+       case MAC_SCSI_QUADRA2:
+               platform_device_register(&esp_0_pdev);
+               if ((macintosh_config->ident == MAC_MODEL_Q900) ||
+                   (macintosh_config->ident == MAC_MODEL_Q950))
+                       platform_device_register(&esp_1_pdev);
+               break;
+       }
+
+       /*
+        * Ethernet device
+        */
+
+       switch (macintosh_config->ether_type) {
+       case MAC_ETHER_SONIC:
+               platform_device_register(&sonic_pdev);
+               break;
+       case MAC_ETHER_MACE:
+               platform_device_register(&mace_pdev);
+               break;
+       }
 
-       return platform_add_devices(mac_platform_devices,
-                                   ARRAY_SIZE(mac_platform_devices));
+       return 0;
 }
 
 arch_initcall(mac_platform_init);
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
deleted file mode 100644 (file)
index bce074c..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * linux/arch/m68k/mac/debug.c
- *
- * Shamelessly stolen (SCC code and general framework) from:
- *
- * linux/arch/m68k/atari/debug.c
- *
- * Atari debugging and serial console stuff
- *
- * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive
- * for more details.
- */
-
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/tty.h>
-#include <linux/console.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-
-#define BOOTINFO_COMPAT_1_0
-#include <asm/setup.h>
-#include <asm/bootinfo.h>
-#include <asm/macints.h>
-
-extern unsigned long mac_videobase;
-extern unsigned long mac_rowbytes;
-
-extern void mac_serial_print(const char *);
-
-#define DEBUG_HEADS
-#undef DEBUG_SCREEN
-#define DEBUG_SERIAL
-
-/*
- * These two auxiliary debug functions should go away ASAP. Only usage:
- * before the console output is up (after head.S come some other crucial
- * setup routines :-) it permits writing 'data' to the screen as bit patterns
- * (good luck reading those). Helped to figure that the bootinfo contained
- * garbage data on the amount and size of memory chunks ...
- *
- * The 'pos' argument now simply means 'linefeed after print' ...
- */
-
-#ifdef DEBUG_SCREEN
-static int peng, line;
-#endif
-
-#if 0
-
-void mac_debugging_short(int pos, short num)
-{
-#ifdef DEBUG_SCREEN
-       unsigned char *pengoffset;
-       unsigned char *pptr;
-       int i;
-#endif
-
-#ifdef DEBUG_SERIAL
-       printk("debug: %d !\n", num);
-#endif
-
-#ifdef DEBUG_SCREEN
-       if (!MACH_IS_MAC) {
-               /* printk("debug: %d !\n", num); */
-               return;
-       }
-
-       /* calculate current offset */
-       pengoffset = (unsigned char *)mac_videobase +
-               (150+line*2) * mac_rowbytes + 80 * peng;
-
-       pptr = pengoffset;
-
-       for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */
-               /*        value        mask for bit i, reverse order */
-               *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
-       }
-
-       peng++;
-
-       if (pos) {
-               line++;
-               peng = 0;
-       }
-#endif
-}
-
-void mac_debugging_long(int pos, long addr)
-{
-#ifdef DEBUG_SCREEN
-       unsigned char *pengoffset;
-       unsigned char *pptr;
-       int i;
-#endif
-
-#ifdef DEBUG_SERIAL
-       printk("debug: #%ld !\n", addr);
-#endif
-
-#ifdef DEBUG_SCREEN
-       if (!MACH_IS_MAC) {
-               /* printk("debug: #%ld !\n", addr); */
-               return;
-       }
-
-       pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
-                   +80*peng;
-
-       pptr = pengoffset;
-
-       for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
-               *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
-       }
-
-       peng++;
-
-       if (pos) {
-               line++;
-               peng = 0;
-       }
-#endif
-}
-
-#endif  /*  0  */
-
-#ifdef DEBUG_SERIAL
-/*
- * TODO: serial debug code
- */
-
-struct mac_SCC {
-       u_char cha_b_ctrl;
-       u_char char_dummy1;
-       u_char cha_a_ctrl;
-       u_char char_dummy2;
-       u_char cha_b_data;
-       u_char char_dummy3;
-       u_char cha_a_data;
-};
-
-# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
-
-static int scc_port = -1;
-
-static struct console mac_console_driver = {
-       .name   = "debug",
-       .flags  = CON_PRINTBUFFER,
-       .index  = -1,
-};
-
-/*
- * Crude hack to get console output to the screen before the framebuffer
- * is initialized (happens a lot later in 2.1!).
- * We just use the console routines declared in head.S, this will interfere
- * with regular framebuffer console output and should be used exclusively
- * to debug kernel problems manifesting before framebuffer init (aka WSOD)
- *
- * To keep this hack from interfering with the regular console driver, either
- * deregister this driver before/on framebuffer console init, or silence this
- * function after the fbcon driver is running (will lose console messages!?).
- * To debug real early bugs, need to write a 'mac_register_console_hack()'
- * that is called from start_kernel() before setup_arch() and just registers
- * this driver if Mac.
- */
-
-static void mac_debug_console_write(struct console *co, const char *str,
-                                   unsigned int count)
-{
-       mac_serial_print(str);
-}
-
-
-
-/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
-
-#define uSEC 1
-
-static inline void mac_sccb_out(char c)
-{
-       int i;
-
-       do {
-               for (i = uSEC; i > 0; --i)
-                       barrier();
-       } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
-       for (i = uSEC; i > 0; --i)
-               barrier();
-       scc.cha_b_data = c;
-}
-
-static inline void mac_scca_out(char c)
-{
-       int i;
-
-       do {
-               for (i = uSEC; i > 0; --i)
-                       barrier();
-       } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
-       for (i = uSEC; i > 0; --i)
-               barrier();
-       scc.cha_a_data = c;
-}
-
-static void mac_sccb_console_write(struct console *co, const char *str,
-                                  unsigned int count)
-{
-       while (count--) {
-               if (*str == '\n')
-                       mac_sccb_out('\r');
-               mac_sccb_out(*str++);
-       }
-}
-
-static void mac_scca_console_write(struct console *co, const char *str,
-                                  unsigned int count)
-{
-       while (count--) {
-               if (*str == '\n')
-                       mac_scca_out('\r');
-               mac_scca_out(*str++);
-       }
-}
-
-
-/* The following two functions do a quick'n'dirty initialization of the MFP or
- * SCC serial ports. They're used by the debugging interface, kgdb, and the
- * serial console code. */
-#define SCCB_WRITE(reg,val)                            \
-       do {                                            \
-               int i;                                  \
-               scc.cha_b_ctrl = (reg);                 \
-               for (i = uSEC; i > 0; --i)              \
-                       barrier();                      \
-               scc.cha_b_ctrl = (val);                 \
-               for (i = uSEC; i > 0; --i)              \
-                       barrier();                      \
-       } while(0)
-
-#define SCCA_WRITE(reg,val)                            \
-       do {                                            \
-               int i;                                  \
-               scc.cha_a_ctrl = (reg);                 \
-               for (i = uSEC; i > 0; --i)              \
-                       barrier();                      \
-               scc.cha_a_ctrl = (val);                 \
-               for (i = uSEC; i > 0; --i)              \
-                       barrier();                      \
-       } while(0)
-
-/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
- * delay of ~ 60us. */
-/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
-#define LONG_DELAY()                                   \
-       do {                                            \
-               int i;                                  \
-               for (i = 60*uSEC; i > 0; --i)           \
-                   barrier();                          \
-       } while(0)
-
-static void __init mac_init_scc_port(int cflag, int port)
-{
-       /*
-        * baud rates: 1200, 1800, 2400, 4800, 9600, 19.2k, 38.4k, 57.6k, 115.2k
-        */
-
-       static int clksrc_table[9] =
-               /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
-               { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
-       static int clkmode_table[9] =
-               /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
-               { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
-       static int div_table[9] =
-               /* reg12 (BRG low) */
-               { 94, 62, 46, 22, 10, 4, 1, 0, 0 };
-
-       int baud = cflag & CBAUD;
-       int clksrc, clkmode, div, reg3, reg5;
-
-       if (cflag & CBAUDEX)
-               baud += B38400;
-       if (baud < B1200 || baud > B38400+2)
-               baud = B9600; /* use default 9600bps for non-implemented rates */
-       baud -= B1200; /* tables starts at 1200bps */
-
-       clksrc  = clksrc_table[baud];
-       clkmode = clkmode_table[baud];
-       div     = div_table[baud];
-
-       reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40);
-       reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */;
-
-       if (port == 1) {
-               (void)scc.cha_b_ctrl;   /* reset reg pointer */
-               SCCB_WRITE(9, 0xc0);    /* reset */
-               LONG_DELAY();           /* extra delay after WR9 access */
-               SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
-                          0x04 /* 1 stopbit */ |
-                          clkmode);
-               SCCB_WRITE(3, reg3);
-               SCCB_WRITE(5, reg5);
-               SCCB_WRITE(9, 0);       /* no interrupts */
-               LONG_DELAY();           /* extra delay after WR9 access */
-               SCCB_WRITE(10, 0);      /* NRZ mode */
-               SCCB_WRITE(11, clksrc); /* main clock source */
-               SCCB_WRITE(12, div);    /* BRG value */
-               SCCB_WRITE(13, 0);      /* BRG high byte */
-               SCCB_WRITE(14, 1);
-               SCCB_WRITE(3, reg3 | 1);
-               SCCB_WRITE(5, reg5 | 8);
-       } else if (port == 0) {
-               (void)scc.cha_a_ctrl;   /* reset reg pointer */
-               SCCA_WRITE(9, 0xc0);    /* reset */
-               LONG_DELAY();           /* extra delay after WR9 access */
-               SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
-                         0x04 /* 1 stopbit */ |
-                         clkmode);
-               SCCA_WRITE(3, reg3);
-               SCCA_WRITE(5, reg5);
-               SCCA_WRITE(9, 0);       /* no interrupts */
-               LONG_DELAY();           /* extra delay after WR9 access */
-               SCCA_WRITE(10, 0);      /* NRZ mode */
-               SCCA_WRITE(11, clksrc); /* main clock source */
-               SCCA_WRITE(12, div);    /* BRG value */
-               SCCA_WRITE(13, 0);      /* BRG high byte */
-               SCCA_WRITE(14, 1);
-               SCCA_WRITE(3, reg3 | 1);
-               SCCA_WRITE(5, reg5 | 8);
-       }
-}
-#endif /* DEBUG_SERIAL */
-
-static int __init mac_debug_setup(char *arg)
-{
-       if (!MACH_IS_MAC)
-               return 0;
-
-#ifdef DEBUG_SERIAL
-       if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) {
-               /* Mac modem port */
-               mac_init_scc_port(B9600|CS8, 0);
-               mac_console_driver.write = mac_scca_console_write;
-               scc_port = 0;
-       } else if (!strcmp(arg, "ser2")) {
-               /* Mac printer port */
-               mac_init_scc_port(B9600|CS8, 1);
-               mac_console_driver.write = mac_sccb_console_write;
-               scc_port = 1;
-       }
-#endif
-#ifdef DEBUG_HEADS
-       if (!strcmp(arg, "scn") || !strcmp(arg, "con")) {
-               /* display, using head.S console routines */
-               mac_console_driver.write = mac_debug_console_write;
-       }
-#endif
-       if (mac_console_driver.write)
-               register_console(&mac_console_driver);
-       return 0;
-}
-
-early_param("debug", mac_debug_setup);
index 23711074e0e2d7ce12342a4e89436a74bf0f77ff..900d899f33235c32f02cc27a393d1e642f11810b 100644 (file)
@@ -34,9 +34,7 @@
  *
  *     3       - unused (?)
  *
- *     4       - SCC (slot number determined by reading RR3 on the SSC itself)
- *               - slot 1: SCC channel A
- *               - slot 2: SCC channel B
+ *     4       - SCC
  *
  *     5       - unused (?)
  *               [serial errors or special conditions seem to raise level 6
@@ -55,8 +53,6 @@
  *               - slot 5: Slot $E
  *
  *     4       - SCC IOP
- *               - slot 1: SCC channel A
- *               - slot 2: SCC channel B
  *
  *     5       - ISM IOP (ADB?)
  *
 #include <asm/irq_regs.h>
 #include <asm/mac_oss.h>
 
-#define DEBUG_SPURIOUS
 #define SHUTUP_SONIC
 
-/* SCC interrupt mask */
-
-static int scc_mask;
-
 /*
  * VIA/RBV hooks
  */
@@ -190,13 +181,6 @@ extern void baboon_irq_enable(int);
 extern void baboon_irq_disable(int);
 extern void baboon_irq_clear(int);
 
-/*
- * SCC interrupt routines
- */
-
-static void scc_irq_enable(unsigned int);
-static void scc_irq_disable(unsigned int);
-
 /*
  * console_loglevel determines NMI handler function
  */
@@ -221,8 +205,6 @@ void __init mac_init_IRQ(void)
 #ifdef DEBUG_MACINTS
        printk("mac_init_IRQ(): Setting things up...\n");
 #endif
-       scc_mask = 0;
-
        m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER,
                                  NUM_MAC_SOURCES - IRQ_USER);
        /* Make sure the SONIC interrupt is cleared or things get ugly */
@@ -283,15 +265,16 @@ void mac_enable_irq(unsigned int irq)
                        via_irq_enable(irq);
                break;
        case 3:
-       case 4:
        case 5:
        case 6:
                if (psc_present)
                        psc_irq_enable(irq);
                else if (oss_present)
                        oss_irq_enable(irq);
-               else if (irq_src == 4)
-                       scc_irq_enable(irq);
+               break;
+       case 4:
+               if (psc_present)
+                       psc_irq_enable(irq);
                break;
        case 8:
                if (baboon_present)
@@ -316,15 +299,16 @@ void mac_disable_irq(unsigned int irq)
                        via_irq_disable(irq);
                break;
        case 3:
-       case 4:
        case 5:
        case 6:
                if (psc_present)
                        psc_irq_disable(irq);
                else if (oss_present)
                        oss_irq_disable(irq);
-               else if (irq_src == 4)
-                       scc_irq_disable(irq);
+               break;
+       case 4:
+               if (psc_present)
+                       psc_irq_disable(irq);
                break;
        case 8:
                if (baboon_present)
@@ -347,7 +331,6 @@ void mac_clear_irq(unsigned int irq)
                        via_irq_clear(irq);
                break;
        case 3:
-       case 4:
        case 5:
        case 6:
                if (psc_present)
@@ -355,6 +338,10 @@ void mac_clear_irq(unsigned int irq)
                else if (oss_present)
                        oss_irq_clear(irq);
                break;
+       case 4:
+               if (psc_present)
+                       psc_irq_clear(irq);
+               break;
        case 8:
                if (baboon_present)
                        baboon_irq_clear(irq);
@@ -374,13 +361,17 @@ int mac_irq_pending(unsigned int irq)
                else
                        return via_irq_pending(irq);
        case 3:
-       case 4:
        case 5:
        case 6:
                if (psc_present)
                        return psc_irq_pending(irq);
                else if (oss_present)
                        return oss_irq_pending(irq);
+               break;
+       case 4:
+               if (psc_present)
+                       psc_irq_pending(irq);
+               break;
        }
        return 0;
 }
@@ -448,59 +439,3 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
        in_nmi--;
        return IRQ_HANDLED;
 }
-
-/*
- * Simple routines for masking and unmasking
- * SCC interrupts in cases where this can't be
- * done in hardware (only the PSC can do that.)
- */
-
-static void scc_irq_enable(unsigned int irq)
-{
-       int irq_idx = IRQ_IDX(irq);
-
-       scc_mask |= (1 << irq_idx);
-}
-
-static void scc_irq_disable(unsigned int irq)
-{
-       int irq_idx = IRQ_IDX(irq);
-
-       scc_mask &= ~(1 << irq_idx);
-}
-
-/*
- * SCC master interrupt handler. We have to do a bit of magic here
- * to figure out what channel gave us the interrupt; putting this
- * here is cleaner than hacking it into drivers/char/macserial.c.
- */
-
-void mac_scc_dispatch(int irq, void *dev_id)
-{
-       volatile unsigned char *scc = (unsigned char *) mac_bi_data.sccbase + 2;
-       unsigned char reg;
-       unsigned long flags;
-
-       /* Read RR3 from the chip. Always do this on channel A */
-       /* This must be an atomic operation so disable irqs.   */
-
-       local_irq_save(flags);
-       *scc = 3;
-       reg = *scc;
-       local_irq_restore(flags);
-
-       /* Now dispatch. Bits 0-2 are for channel B and */
-       /* bits 3-5 are for channel A. We can safely    */
-       /* ignore the remaining bits here.              */
-       /*                                              */
-       /* Note that we're ignoring scc_mask for now.   */
-       /* If we actually mask the ints then we tend to */
-       /* get hammered by very persistent SCC irqs,    */
-       /* and since they're autovector interrupts they */
-       /* pretty much kill the system.                 */
-
-       if (reg & 0x38)
-               m68k_handle_int(IRQ_SCCA);
-       if (reg & 0x07)
-               m68k_handle_int(IRQ_SCCB);
-}
index f3d23d6ebcf8a7ba35e7b07e70e0d4b7276f6ebb..a9c0f5ab4cc0251213dd8e1e034f7007d9d8a6d9 100644 (file)
@@ -33,7 +33,6 @@ static irqreturn_t oss_irq(int, void *);
 static irqreturn_t oss_nubus_irq(int, void *);
 
 extern irqreturn_t via1_irq(int, void *);
-extern irqreturn_t mac_scc_dispatch(int, void *);
 
 /*
  * Initialize the OSS
@@ -69,9 +68,6 @@ void __init oss_register_interrupts(void)
        if (request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK,
                        "scsi", (void *) oss))
                pr_err("Couldn't register %s interrupt\n", "scsi");
-       if (request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK,
-                       "scc", mac_scc_dispatch))
-               pr_err("Couldn't register %s interrupt\n", "scc");
        if (request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK,
                        "nubus", (void *) oss))
                pr_err("Couldn't register %s interrupt\n", "nubus");
@@ -172,9 +168,7 @@ void oss_irq_enable(int irq) {
        printk("oss_irq_enable(%d)\n", irq);
 #endif
        switch(irq) {
-               case IRQ_SCC:
-               case IRQ_SCCA:
-               case IRQ_SCCB:
+               case IRQ_MAC_SCC:
                        oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC;
                        break;
                case IRQ_MAC_ADB:
@@ -212,9 +206,7 @@ void oss_irq_disable(int irq) {
        printk("oss_irq_disable(%d)\n", irq);
 #endif
        switch(irq) {
-               case IRQ_SCC:
-               case IRQ_SCCA:
-               case IRQ_SCCB:
+               case IRQ_MAC_SCC:
                        oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_DISABLED;
                        break;
                case IRQ_MAC_ADB:
@@ -250,9 +242,7 @@ void oss_irq_disable(int irq) {
 void oss_irq_clear(int irq) {
        /* FIXME: how to do this on OSS? */
        switch(irq) {
-               case IRQ_SCC:
-               case IRQ_SCCA:
-               case IRQ_SCCB:
+               case IRQ_MAC_SCC:
                        oss->irq_pending &= ~OSS_IP_IOPSCC;
                        break;
                case IRQ_MAC_ADB:
@@ -280,9 +270,7 @@ void oss_irq_clear(int irq) {
 int oss_irq_pending(int irq)
 {
        switch(irq) {
-               case IRQ_SCC:
-               case IRQ_SCCA:
-               case IRQ_SCCB:
+               case IRQ_MAC_SCC:
                        return oss->irq_pending & OSS_IP_IOPSCC;
                        break;
                case IRQ_MAC_ADB:
index 11bce3cb6482624b024b239e1987af6fd99d1c56..e71166daec6adf5507f3aef1ef8d53ab996bdf7c 100644 (file)
@@ -84,8 +84,6 @@ void via_irq_enable(int irq);
 void via_irq_disable(int irq);
 void via_irq_clear(int irq);
 
-extern irqreturn_t mac_scc_dispatch(int, void *);
-
 /*
  * Initialize the VIAs
  *
@@ -311,11 +309,6 @@ void __init via_register_interrupts(void)
        if (request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
                        "via2", (void *) via2))
                pr_err("Couldn't register %s interrupt\n", "via2");
-       if (!psc_present) {
-               if (request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
-                               "scc", mac_scc_dispatch))
-                       pr_err("Couldn't register %s interrupt\n", "scc");
-       }
        if (request_irq(IRQ_MAC_NUBUS, via_nubus_irq,
                        IRQ_FLG_LOCK|IRQ_FLG_FAST, "nubus", (void *) via2))
                pr_err("Couldn't register %s interrupt\n", "nubus");
index df620ac2a296b7a7da77a87cf9e00c06ee0786e5..69345849454b9c03991258aa1eff409472896e2b 100644 (file)
@@ -99,8 +99,7 @@ static inline void free_io_area(void *addr)
 #endif
 
 /*
- * Map some physical address range into the kernel address space. The
- * code is copied and adapted from map_chunk().
+ * Map some physical address range into the kernel address space.
  */
 /* Rewritten by Andreas Schwab to remove all races. */
 
@@ -116,7 +115,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
        /*
         * Don't allow mappings that wrap..
         */
-       if (!size || size > physaddr + size)
+       if (!size || physaddr > (unsigned long)(-size))
                return NULL;
 
 #ifdef CONFIG_AMIGA
index 5c9ecd427090c0a8b5c701b2bdddf21072d44582..959cb249c759fd4cae926a49259a67c9893fac34 100644 (file)
@@ -221,6 +221,10 @@ int copy_thread(unsigned long clone_flags,
 
        p->thread.usp = usp;
        p->thread.ksp = (unsigned long)childstack;
+
+       if (clone_flags & CLONE_SETTLS)
+               task_thread_info(p)->tp_value = regs->d5;
+
        /*
         * Must save the current SFC/DFC value, NOT the value when
         * the parent was last descheduled - RGH  10-08-96
index 4d3828959fb05465d97de3e4e12cf288f8bd0276..85ed2f988f98d882e32b3c72cd400cba16e3974a 100644 (file)
@@ -319,6 +319,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
 #endif
 
+       case PTRACE_GET_THREAD_AREA:
+               ret = put_user(task_thread_info(child)->tp_value,
+                              (unsigned long __user *)data);
+               break;
+
                default:
                        ret = -EIO;
                        break;
index b67cbc735a9b13d7e0ca3d52fdef01b3ff944d09..923dd4aab8758378489d78c91cb11d37151335c8 100644 (file)
@@ -190,3 +190,39 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
                        : "d" (__a), "d" (__b), "d" (__c));
        return __res;
 }
+
+asmlinkage unsigned long sys_get_thread_area(void)
+{
+       return current_thread_info()->tp_value;
+}
+
+asmlinkage int sys_set_thread_area(unsigned long tp)
+{
+       current_thread_info()->tp_value = tp;
+       return 0;
+}
+
+/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
+   D1 (newval).  */
+asmlinkage int
+sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
+                     unsigned long __user * mem)
+{
+       struct mm_struct *mm = current->mm;
+       unsigned long mem_value;
+
+       down_read(&mm->mmap_sem);
+
+       mem_value = *mem;
+       if (mem_value == oldval)
+               *mem = newval;
+
+       up_read(&mm->mmap_sem);
+       return mem_value;
+}
+
+asmlinkage int sys_atomic_barrier(void)
+{
+       /* no code needed for uniprocs */
+       return 0;
+}
index 486837efa3d788d5196f77130675880d23a43a0d..56dd01ded148c09a1ee3751873db9e407ea4d336 100644 (file)
@@ -351,6 +351,10 @@ ENTRY(sys_call_table)
        .long sys_pwritev               /* 330 */
        .long sys_rt_tgsigqueueinfo
        .long sys_perf_event_open
+       .long sys_get_thread_area
+       .long sys_set_thread_area
+       .long sys_atomic_cmpxchg_32     /* 335 */
+       .long sys_atomic_barrier
 
        .rept NR_syscalls-(.-sys_call_table)/4
                .long sys_ni_syscall
index f93b88b51f9f1445bef0ee8e790b98d6580dc983..d5b9e1357808c40661b440b1d00a968068e05d53 100644 (file)
@@ -24,7 +24,6 @@
 
 /*
  * Map some physical address range into the kernel address space.
- * The code is copied and adapted from map_chunk().
  */
 
 unsigned long kernel_map(unsigned long paddr, unsigned long size,
index d8720ee345100abe26a4fa181b109f6ae9f0e7af..aebea19abd781e977a8d874ff753a695f31cf945 100644 (file)
@@ -146,7 +146,6 @@ static struct clocksource pit_clk = {
        .read   = pit_read_clk,
        .shift  = 20,
        .mask   = CLOCKSOURCE_MASK(32),
-       .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 /***************************************************************************/
index fd53e500be67b21e5d48c96f9e745d8dfa0e158a..b008168ae946b6e479c690911c8d2f0e451b1017 100644 (file)
@@ -90,7 +90,7 @@ source "arch/microblaze/platform/Kconfig.platform"
 
 menu "Processor type and features"
 
-source kernel/time/Kconfig
+source "kernel/time/Kconfig"
 
 source "kernel/Kconfig.preempt"
 
@@ -130,6 +130,7 @@ config CMDLINE_FORCE
 
 config OF
        def_bool y
+       select OF_FLATTREE
 
 config PROC_DEVICETREE
        bool "Support for device tree in /proc"
index bb7c374713adb7ddd40f0384e34ad305b5ad14dc..6fced1fe3bf06316fd7e3280d4a8b427128f7059 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31
-# Thu Sep 24 10:28:50 2009
+# Linux kernel version: 2.6.33-rc6
+# Wed Feb  3 10:02:59 2010
 #
 CONFIG_MICROBLAZE=y
 # CONFIG_SWAP is not set
@@ -19,8 +19,12 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 CONFIG_GENERIC_GPIO=y
 CONFIG_GENERIC_CSUM=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 # CONFIG_PCI is not set
 CONFIG_NO_DMA=y
+CONFIG_DTC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 CONFIG_CONSTRUCTORS=y
 
@@ -44,6 +48,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -64,10 +69,12 @@ CONFIG_INITRAMFS_ROOT_GID=0
 CONFIG_RD_GZIP=y
 # CONFIG_RD_BZIP2 is not set
 # CONFIG_RD_LZMA is not set
+# CONFIG_RD_LZO is not set
 # CONFIG_INITRAMFS_COMPRESSION_NONE is not set
 CONFIG_INITRAMFS_COMPRESSION_GZIP=y
 # CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
 # CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
+# CONFIG_INITRAMFS_COMPRESSION_LZO is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
 CONFIG_ANON_INODES=y
@@ -90,21 +97,20 @@ CONFIG_EVENTFD=y
 CONFIG_AIO=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
 CONFIG_VM_EVENT_COUNTERS=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
 # GCOV-based kernel profiling
 #
-# CONFIG_SLOW_WORK is not set
+CONFIG_SLOW_WORK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_BASE_SMALL=1
@@ -123,14 +129,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -139,11 +172,6 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 CONFIG_PLATFORM_GENERIC=y
 CONFIG_OPT_LIB_FUNCTION=y
 CONFIG_OPT_LIB_ASM=y
-CONFIG_ALLOW_EDIT_AUTO=y
-
-#
-# Automatic platform settings from Kconfig.auto
-#
 
 #
 # Definitions for MICROBLAZE0
@@ -203,12 +231,11 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_SPLIT_PTLOCK_CPUS=999999
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 
 #
@@ -289,7 +316,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -313,6 +346,10 @@ CONFIG_OF_DEVICE=y
 CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -349,7 +386,6 @@ CONFIG_NETDEVICES=y
 # CONFIG_PHYLIB is not set
 CONFIG_NET_ETHERNET=y
 # CONFIG_MII is not set
-# CONFIG_ETHOC is not set
 # CONFIG_DNET is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
 # CONFIG_IBM_NEW_EMAC_RGMII is not set
@@ -359,12 +395,12 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 CONFIG_XILINX_EMACLITE=y
 CONFIG_NETDEV_1000=y
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -408,6 +444,7 @@ CONFIG_SERIAL_UARTLITE=y
 CONFIG_SERIAL_UARTLITE_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -433,7 +470,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 
 #
@@ -526,8 +562,6 @@ CONFIG_PROC_FS=y
 CONFIG_PROC_SYSCTL=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SYSFS=y
-CONFIG_TMPFS=y
-# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
 CONFIG_MISC_FILESYSTEMS=y
@@ -638,11 +672,13 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 #
 # Kernel hacking
 #
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
@@ -662,6 +698,9 @@ CONFIG_DEBUG_SLAB=y
 # CONFIG_DEBUG_SLAB_LEAK is not set
 CONFIG_DEBUG_SPINLOCK=y
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -680,10 +719,29 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
 # CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_BOOT_TRACER is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_SAMPLES is not set
-# CONFIG_KMEMCHECK is not set
 CONFIG_EARLY_PRINTK=y
 # CONFIG_HEART_BEAT is not set
 CONFIG_DEBUG_BOOTMEM=y
@@ -694,7 +752,11 @@ CONFIG_DEBUG_BOOTMEM=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index adb839bab7044ea955b1e1150b6b56c9a3cb9cc4..ce2da535246a54df020ae48e053c2f8a2df1ff3f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31
-# Thu Sep 24 10:29:43 2009
+# Linux kernel version: 2.6.33-rc6
+# Wed Feb  3 10:03:21 2010
 #
 CONFIG_MICROBLAZE=y
 # CONFIG_SWAP is not set
@@ -19,8 +19,12 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 CONFIG_GENERIC_GPIO=y
 CONFIG_GENERIC_CSUM=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 # CONFIG_PCI is not set
 CONFIG_NO_DMA=y
+CONFIG_DTC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 CONFIG_CONSTRUCTORS=y
 
@@ -46,6 +50,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -81,16 +86,16 @@ CONFIG_EVENTFD=y
 CONFIG_AIO=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
 CONFIG_VM_EVENT_COUNTERS=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_MMAP_ALLOW_UNINITIALIZED is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
 # GCOV-based kernel profiling
@@ -116,14 +121,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -132,7 +164,10 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 CONFIG_PLATFORM_GENERIC=y
 # CONFIG_SELFMOD is not set
 # CONFIG_OPT_LIB_FUNCTION is not set
-# CONFIG_ALLOW_EDIT_AUTO is not set
+
+#
+# Definitions for MICROBLAZE0
+#
 CONFIG_KERNEL_BASE_ADDR=0x90000000
 CONFIG_XILINX_MICROBLAZE0_FAMILY="virtex5"
 CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
@@ -190,7 +225,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_VIRT_TO_BUS=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
 
 #
@@ -274,9 +308,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -301,9 +332,9 @@ CONFIG_STANDALONE=y
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_OF_PARTS is not set
@@ -387,6 +418,10 @@ CONFIG_OF_DEVICE=y
 CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -423,7 +458,6 @@ CONFIG_NETDEVICES=y
 # CONFIG_PHYLIB is not set
 CONFIG_NET_ETHERNET=y
 # CONFIG_MII is not set
-# CONFIG_ETHOC is not set
 # CONFIG_DNET is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
 # CONFIG_IBM_NEW_EMAC_RGMII is not set
@@ -433,12 +467,12 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -482,6 +516,7 @@ CONFIG_SERIAL_UARTLITE=y
 CONFIG_SERIAL_UARTLITE_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -508,7 +543,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 
 #
@@ -616,7 +650,6 @@ CONFIG_INOTIFY_USER=y
 CONFIG_PROC_FS=y
 CONFIG_PROC_SYSCTL=y
 CONFIG_SYSFS=y
-# CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
 CONFIG_MISC_FILESYSTEMS=y
@@ -672,11 +705,13 @@ CONFIG_MSDOS_PARTITION=y
 #
 # Kernel hacking
 #
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_UNUSED_SYMBOLS=y
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -695,12 +730,16 @@ CONFIG_DEBUG_OBJECTS=y
 CONFIG_DEBUG_OBJECTS_SELFTEST=y
 CONFIG_DEBUG_OBJECTS_FREE=y
 CONFIG_DEBUG_OBJECTS_TIMERS=y
+# CONFIG_DEBUG_OBJECTS_WORK is not set
 CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -720,8 +759,28 @@ CONFIG_DEBUG_SG=y
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
 # CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_BOOT_TRACER is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_EARLY_PRINTK=y
@@ -734,7 +793,11 @@ CONFIG_EARLY_PRINTK=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index fc9997b73c09de6183f20ceea4631d590c6d4697..267c7c779e537b1be0c475abaca0719170f54b1f 100644 (file)
@@ -217,7 +217,7 @@ static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,
  * Little endian
  */
 
-#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a));
+#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a))
 #define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))
 
 #define in_le32(a) __le32_to_cpu(__raw_readl(a))
index ef3ec1d6ceb382464be02fe743d99fb0b0b3ad1d..03f45a96320412b7a21ac2243f305608b8acae59 100644 (file)
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT        1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT        1
-
-#define of_compat_cmp(s1, s2, l)       strncasecmp((s1), (s2), (l))
-#define of_prop_cmp(s1, s2)            strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)            strcasecmp((s1), (s2))
-
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
-extern struct device_node *allnodes;   /* temporary while merging */
-extern rwlock_t devtree_lock;  /* temporary while merging */
-
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
-extern struct resource *request_OF_resource(struct device_node *node,
-                               int index, const char *name_postfix);
-extern int release_OF_resource(struct device_node *node, int index);
-
 /*
  * OF address retreival & translation
  */
index a917dc517736dd03715235505606e9be5afdf53e..d74dbfb92c0464a1fa4134778e2030bc061557e6 100644 (file)
@@ -54,6 +54,7 @@ struct pt_regs {
        int pt_mode;
 };
 
+#ifdef __KERNEL__
 #define kernel_mode(regs)              ((regs)->pt_mode)
 #define user_mode(regs)                        (!kernel_mode(regs))
 
@@ -62,6 +63,19 @@ struct pt_regs {
 
 void show_regs(struct pt_regs *);
 
+#else /* __KERNEL__ */
+
+/* pt_regs offsets used by gdbserver etc in ptrace syscalls */
+#define PT_GPR(n)       ((n) * sizeof(microblaze_reg_t))
+#define PT_PC           (32 * sizeof(microblaze_reg_t))
+#define PT_MSR          (33 * sizeof(microblaze_reg_t))
+#define PT_EAR          (34 * sizeof(microblaze_reg_t))
+#define PT_ESR          (35 * sizeof(microblaze_reg_t))
+#define PT_FSR          (36 * sizeof(microblaze_reg_t))
+#define PT_KERNEL_MODE  (37 * sizeof(microblaze_reg_t))
+
+#endif /* __KERNEL */
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_MICROBLAZE_PTRACE_H */
index cb05a07e55e969751e73c6b2b1411266c3cb80e7..2b67e92a773c25ae4864fa2d30310d4647da3c13 100644 (file)
 #define __NR_shutdown          359 /* new */
 #define __NR_sendmsg           360 /* new */
 #define __NR_recvmsg           361 /* new */
-#define __NR_accept04          362 /* new */
+#define __NR_accept          362 /* new */
 #define __NR_preadv            363 /* new */
 #define __NR_pwritev           364 /* new */
 #define __NR_rt_tgsigqueueinfo 365 /* new */
 #define __NR_perf_event_open   366 /* new */
+#define __NR_recvmmsg          367 /* new */
 
-#define __NR_syscalls          367
+#define __NR_syscalls          368
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
index d9d63831cc2f9d6318257fa358ac41d41553c789..2a56bccce4e02a822a5c3193b6ee72175bd03fd8 100644 (file)
@@ -172,16 +172,15 @@ do {                                                                      \
 /* It is used only first parameter for OP - for wic, wdc */
 #define CACHE_RANGE_LOOP_1(start, end, line_length, op)                        \
 do {                                                                   \
-       int step = -line_length;                                        \
-       int count = end - start;                                        \
-       BUG_ON(count <= 0);                                             \
+       int volatile temp;                                              \
+       BUG_ON(end - start <= 0);                                       \
                                                                        \
-       __asm__ __volatile__ (" 1:      addk    %0, %0, %1;             \
-                                       " #op " %0, r0;                 \
-                                       bgtid   %1, 1b;                 \
-                                       addk    %1, %1, %2;             \
-                                       " : : "r" (start), "r" (count), \
-                                       "r" (step) : "memory");         \
+       __asm__ __volatile__ (" 1:      " #op " %1, r0;                 \
+                                       cmpu    %0, %1, %2;             \
+                                       bgtid   %0, 1b;                 \
+                                       addk    %1, %1, %3;             \
+                               " : : "r" (temp), "r" (start), "r" (end),\
+                                       "r" (line_length) : "memory");  \
 } while (0);
 
 static void __flush_icache_range_msr_irq(unsigned long start, unsigned long end)
@@ -313,16 +312,6 @@ static void __invalidate_dcache_all_wb(void)
        pr_debug("%s\n", __func__);
        CACHE_ALL_LOOP2(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
                                        wdc.clear)
-
-#if 0
-       unsigned int i;
-
-       pr_debug("%s\n", __func__);
-
-       /* Just loop through cache size and invalidate it */
-       for (i = 0; i < cpuinfo.dcache_size; i += cpuinfo.dcache_line_length)
-                       __invalidate_dcache(0, i);
-#endif
 }
 
 static void __invalidate_dcache_range_wb(unsigned long start,
index 95b0855802dff0b342d77cfe279f1eaa23bf6828..391d6197fc3bbfb309f7bf1824c16ef80d2ca4cc 100644 (file)
@@ -122,7 +122,7 @@ ENTRY(_interrupt)
 
 ret_from_intr:
        lwi     r11, r1, PT_MODE
-       bneid   r11, 3f
+       bneid   r11, no_intr_resched
 
        lwi     r6, r31, TS_THREAD_INFO /* get thread info */
        lwi     r19, r6, TI_FLAGS       /* get flags in thread info */
@@ -133,16 +133,18 @@ ret_from_intr:
        bralid  r15, schedule
        nop
 1:     andi    r11, r19, _TIF_SIGPENDING
-       beqid   r11, no_intr_reshed
+       beqid   r11, no_intr_resched
        addk    r5, r1, r0
        addk    r7, r0, r0
        bralid  r15, do_signal
        addk    r6, r0, r0
 
-no_intr_reshed:
+no_intr_resched:
+       /* Disable interrupts, we are now committed to the state restore */
+       disable_irq
+
        /* save mode indicator */
        lwi     r11, r1, PT_MODE
-3:
        swi     r11, r0, PER_CPU(KM)
 
        /* save r31 */
index acf4574d0f188fd7fd99fec2ab911b8a4d0e446e..1c6d684996d7eae768686ba88945e79148180c74 100644 (file)
@@ -185,7 +185,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
 static int of_dev_phandle_match(struct device *dev, void *data)
 {
        phandle *ph = data;
-       return to_of_device(dev)->node->linux_phandle == *ph;
+       return to_of_device(dev)->node->phandle == *ph;
 }
 
 struct of_device *of_find_device_by_phandle(phandle ph)
index b817df172aa95d5e0c18784231e03f2435eeafe7..a15ef6d67ca92e037628f1c9808db4f5cd55e5ad 100644 (file)
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
-typedef u32 cell_t;
-
-static struct boot_param_header *initial_boot_params;
-
-/* export that to outside world */
-struct device_node *of_chosen;
-
-static inline char *find_flat_dt_string(u32 offset)
-{
-       return ((char *)initial_boot_params) +
-               initial_boot_params->off_dt_strings + offset;
-}
-
-/**
- * This function is used to scan the flattened device-tree, it is
- * used to extract the memory informations at boot before we can
- * unflatten the tree
- */
-int __init of_scan_flat_dt(int (*it)(unsigned long node,
-                                    const char *uname, int depth,
-                                    void *data),
-                          void *data)
-{
-       unsigned long p = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       int rc = 0;
-       int depth = -1;
-
-       do {
-               u32 tag = *((u32 *)p);
-               char *pathp;
-
-               p += 4;
-               if (tag == OF_DT_END_NODE) {
-                       depth--;
-                       continue;
-               }
-               if (tag == OF_DT_NOP)
-                       continue;
-               if (tag == OF_DT_END)
-                       break;
-               if (tag == OF_DT_PROP) {
-                       u32 sz = *((u32 *)p);
-                       p += 8;
-                       if (initial_boot_params->version < 0x10)
-                               p = _ALIGN(p, sz >= 8 ? 8 : 4);
-                       p += sz;
-                       p = _ALIGN(p, 4);
-                       continue;
-               }
-               if (tag != OF_DT_BEGIN_NODE) {
-                       printk(KERN_WARNING "Invalid tag %x scanning flattened"
-                               " device tree !\n", tag);
-                       return -EINVAL;
-               }
-               depth++;
-               pathp = (char *)p;
-               p = _ALIGN(p + strlen(pathp) + 1, 4);
-               if ((*pathp) == '/') {
-                       char *lp, *np;
-                       for (lp = NULL, np = pathp; *np; np++)
-                               if ((*np) == '/')
-                                       lp = np+1;
-                       if (lp != NULL)
-                               pathp = lp;
-               }
-               rc = it(p, pathp, depth, data);
-               if (rc != 0)
-                       break;
-       } while (1);
-
-       return rc;
-}
-
-unsigned long __init of_get_flat_dt_root(void)
-{
-       unsigned long p = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-
-       while (*((u32 *)p) == OF_DT_NOP)
-               p += 4;
-       BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE);
-       p += 4;
-       return _ALIGN(p + strlen((char *)p) + 1, 4);
-}
-
-/**
- * This function can be used within scan_flattened_dt callback to get
- * access to properties
- */
-void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
-                               unsigned long *size)
-{
-       unsigned long p = node;
-
-       do {
-               u32 tag = *((u32 *)p);
-               u32 sz, noff;
-               const char *nstr;
-
-               p += 4;
-               if (tag == OF_DT_NOP)
-                       continue;
-               if (tag != OF_DT_PROP)
-                       return NULL;
-
-               sz = *((u32 *)p);
-               noff = *((u32 *)(p + 4));
-               p += 8;
-               if (initial_boot_params->version < 0x10)
-                       p = _ALIGN(p, sz >= 8 ? 8 : 4);
-
-               nstr = find_flat_dt_string(noff);
-               if (nstr == NULL) {
-                       printk(KERN_WARNING "Can't find property index"
-                               " name !\n");
-                       return NULL;
-               }
-               if (strcmp(name, nstr) == 0) {
-                       if (size)
-                               *size = sz;
-                       return (void *)p;
-               }
-               p += sz;
-               p = _ALIGN(p, 4);
-       } while (1);
-}
-
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
-{
-       const char *cp;
-       unsigned long cplen, l;
-
-       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
-       if (cp == NULL)
-               return 0;
-       while (cplen > 0) {
-               if (strncasecmp(cp, compat, strlen(compat)) == 0)
-                       return 1;
-               l = strlen(cp) + 1;
-               cp += l;
-               cplen -= l;
-       }
-
-       return 0;
-}
-
-static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
-                                       unsigned long align)
-{
-       void *res;
-
-       *mem = _ALIGN(*mem, align);
-       res = (void *)*mem;
-       *mem += size;
-
-       return res;
-}
-
-static unsigned long __init unflatten_dt_node(unsigned long mem,
-                                       unsigned long *p,
-                                       struct device_node *dad,
-                                       struct device_node ***allnextpp,
-                                       unsigned long fpsize)
-{
-       struct device_node *np;
-       struct property *pp, **prev_pp = NULL;
-       char *pathp;
-       u32 tag;
-       unsigned int l, allocl;
-       int has_name = 0;
-       int new_format = 0;
-
-       tag = *((u32 *)(*p));
-       if (tag != OF_DT_BEGIN_NODE) {
-               printk("Weird tag at start of node: %x\n", tag);
-               return mem;
-       }
-       *p += 4;
-       pathp = (char *)*p;
-       l = allocl = strlen(pathp) + 1;
-       *p = _ALIGN(*p + l, 4);
-
-       /* version 0x10 has a more compact unit name here instead of the full
-        * path. we accumulate the full path size using "fpsize", we'll rebuild
-        * it later. We detect this because the first character of the name is
-        * not '/'.
-        */
-       if ((*pathp) != '/') {
-               new_format = 1;
-               if (fpsize == 0) {
-                       /* root node: special case. fpsize accounts for path
-                        * plus terminating zero. root node only has '/', so
-                        * fpsize should be 2, but we want to avoid the first
-                        * level nodes to have two '/' so we use fpsize 1 here
-                        */
-                       fpsize = 1;
-                       allocl = 2;
-               } else {
-                       /* account for '/' and path size minus terminal 0
-                        * already in 'l'
-                        */
-                       fpsize += l;
-                       allocl = fpsize;
-               }
-       }
-
-       np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
-                               __alignof__(struct device_node));
-       if (allnextpp) {
-               memset(np, 0, sizeof(*np));
-               np->full_name = ((char *)np) + sizeof(struct device_node);
-               if (new_format) {
-                       char *p2 = np->full_name;
-                       /* rebuild full path for new format */
-                       if (dad && dad->parent) {
-                               strcpy(p2, dad->full_name);
-#ifdef DEBUG
-                               if ((strlen(p2) + l + 1) != allocl) {
-                                       pr_debug("%s: p: %d, l: %d, a: %d\n",
-                                               pathp, (int)strlen(p2),
-                                               l, allocl);
-                               }
-#endif
-                               p2 += strlen(p2);
-                       }
-                       *(p2++) = '/';
-                       memcpy(p2, pathp, l);
-               } else
-                       memcpy(np->full_name, pathp, l);
-               prev_pp = &np->properties;
-               **allnextpp = np;
-               *allnextpp = &np->allnext;
-               if (dad != NULL) {
-                       np->parent = dad;
-                       /* we temporarily use the next field as `last_child'*/
-                       if (dad->next == NULL)
-                               dad->child = np;
-                       else
-                               dad->next->sibling = np;
-                       dad->next = np;
-               }
-               kref_init(&np->kref);
-       }
-       while (1) {
-               u32 sz, noff;
-               char *pname;
-
-               tag = *((u32 *)(*p));
-               if (tag == OF_DT_NOP) {
-                       *p += 4;
-                       continue;
-               }
-               if (tag != OF_DT_PROP)
-                       break;
-               *p += 4;
-               sz = *((u32 *)(*p));
-               noff = *((u32 *)((*p) + 4));
-               *p += 8;
-               if (initial_boot_params->version < 0x10)
-                       *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
-
-               pname = find_flat_dt_string(noff);
-               if (pname == NULL) {
-                       printk(KERN_INFO
-                               "Can't find property name in list !\n");
-                       break;
-               }
-               if (strcmp(pname, "name") == 0)
-                       has_name = 1;
-               l = strlen(pname) + 1;
-               pp = unflatten_dt_alloc(&mem, sizeof(struct property),
-                                       __alignof__(struct property));
-               if (allnextpp) {
-                       if (strcmp(pname, "linux,phandle") == 0) {
-                               np->node = *((u32 *)*p);
-                               if (np->linux_phandle == 0)
-                                       np->linux_phandle = np->node;
-                       }
-                       if (strcmp(pname, "ibm,phandle") == 0)
-                               np->linux_phandle = *((u32 *)*p);
-                       pp->name = pname;
-                       pp->length = sz;
-                       pp->value = (void *)*p;
-                       *prev_pp = pp;
-                       prev_pp = &pp->next;
-               }
-               *p = _ALIGN((*p) + sz, 4);
-       }
-       /* with version 0x10 we may not have the name property, recreate
-        * it here from the unit name if absent
-        */
-       if (!has_name) {
-               char *p1 = pathp, *ps = pathp, *pa = NULL;
-               int sz;
-
-               while (*p1) {
-                       if ((*p1) == '@')
-                               pa = p1;
-                       if ((*p1) == '/')
-                               ps = p1 + 1;
-                       p1++;
-               }
-               if (pa < ps)
-                       pa = p1;
-               sz = (pa - ps) + 1;
-               pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
-                                       __alignof__(struct property));
-               if (allnextpp) {
-                       pp->name = "name";
-                       pp->length = sz;
-                       pp->value = pp + 1;
-                       *prev_pp = pp;
-                       prev_pp = &pp->next;
-                       memcpy(pp->value, ps, sz - 1);
-                       ((char *)pp->value)[sz - 1] = 0;
-                       pr_debug("fixed up name for %s -> %s\n", pathp,
-                               (char *)pp->value);
-               }
-       }
-       if (allnextpp) {
-               *prev_pp = NULL;
-               np->name = of_get_property(np, "name", NULL);
-               np->type = of_get_property(np, "device_type", NULL);
-
-               if (!np->name)
-                       np->name = "<NULL>";
-               if (!np->type)
-                       np->type = "<NULL>";
-       }
-       while (tag == OF_DT_BEGIN_NODE) {
-               mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
-               tag = *((u32 *)(*p));
-       }
-       if (tag != OF_DT_END_NODE) {
-               printk(KERN_INFO "Weird tag at end of node: %x\n", tag);
-               return mem;
-       }
-       *p += 4;
-       return mem;
-}
-
-/**
- * unflattens the device-tree passed by the firmware, creating the
- * tree of struct device_node. It also fills the "name" and "type"
- * pointers of the nodes so the normal device-tree walking functions
- * can be used (this used to be done by finish_device_tree)
- */
-void __init unflatten_device_tree(void)
-{
-       unsigned long start, mem, size;
-       struct device_node **allnextp = &allnodes;
-
-       pr_debug(" -> unflatten_device_tree()\n");
-
-       /* First pass, scan for size */
-       start = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       size = unflatten_dt_node(0, &start, NULL, NULL, 0);
-       size = (size | 3) + 1;
-
-       pr_debug("  size is %lx, allocating...\n", size);
-
-       /* Allocate memory for the expanded device tree */
-       mem = lmb_alloc(size + 4, __alignof__(struct device_node));
-       mem = (unsigned long) __va(mem);
-
-       ((u32 *)mem)[size / 4] = 0xdeadbeef;
-
-       pr_debug("  unflattening %lx...\n", mem);
-
-       /* Second pass, do actual unflattening */
-       start = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
-       if (*((u32 *)start) != OF_DT_END)
-               printk(KERN_WARNING "Weird tag at end of tree: %08x\n",
-                       *((u32 *)start));
-       if (((u32 *)mem)[size / 4] != 0xdeadbeef)
-               printk(KERN_WARNING "End of tree marker overwritten: %08x\n",
-                       ((u32 *)mem)[size / 4]);
-       *allnextp = NULL;
-
-       /* Get pointer to OF "/chosen" node for use everywhere */
-       of_chosen = of_find_node_by_path("/chosen");
-       if (of_chosen == NULL)
-               of_chosen = of_find_node_by_path("/chosen@0");
-
-       pr_debug(" <- unflatten_device_tree()\n");
-}
-
-#define early_init_dt_scan_drconf_memory(node) 0
-
-static int __init early_init_dt_scan_cpus(unsigned long node,
-                                         const char *uname, int depth,
-                                         void *data)
-{
-       static int logical_cpuid;
-       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-       const u32 *intserv;
-       int i, nthreads;
-       int found = 0;
-
-       /* We are scanning "cpu" nodes only */
-       if (type == NULL || strcmp(type, "cpu") != 0)
-               return 0;
-
-       /* Get physical cpuid */
-       intserv = of_get_flat_dt_prop(node, "reg", NULL);
-       nthreads = 1;
-
-       /*
-        * Now see if any of these threads match our boot cpu.
-        * NOTE: This must match the parsing done in smp_setup_cpu_maps.
-        */
-       for (i = 0; i < nthreads; i++) {
-               /*
-                * version 2 of the kexec param format adds the phys cpuid of
-                * booted proc.
-                */
-               if (initial_boot_params && initial_boot_params->version >= 2) {
-                       if (intserv[i] ==
-                                       initial_boot_params->boot_cpuid_phys) {
-                               found = 1;
-                               break;
-                       }
-               } else {
-                       /*
-                        * Check if it's the boot-cpu, set it's hw index now,
-                        * unfortunately this format did not support booting
-                        * off secondary threads.
-                        */
-                       if (of_get_flat_dt_prop(node,
-                                       "linux,boot-cpu", NULL) != NULL) {
-                               found = 1;
-                               break;
-                       }
-               }
-
-#ifdef CONFIG_SMP
-               /* logical cpu id is always 0 on UP kernels */
-               logical_cpuid++;
-#endif
-       }
-
-       if (found) {
-               pr_debug("boot cpu: logical %d physical %d\n", logical_cpuid,
-                       intserv[i]);
-               boot_cpuid = logical_cpuid;
-       }
-
-       return 0;
-}
-
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-       unsigned long l;
-       u32 *prop;
-
-       pr_debug("Looking for initrd properties... ");
-
-       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-       if (prop) {
-               initrd_start = (unsigned long)
-                                       __va((u32)of_read_ulong(prop, l/4));
-
-               prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-               if (prop) {
-                       initrd_end = (unsigned long)
-                                       __va((u32)of_read_ulong(prop, 1/4));
-                       initrd_below_start_ok = 1;
-               } else {
-                       initrd_start = 0;
-               }
-       }
-
-       pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
-                                       initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-static int __init early_init_dt_scan_chosen(unsigned long node,
-                               const char *uname, int depth, void *data)
-{
-       unsigned long l;
-       char *p;
-
-       pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-       if (depth != 1 ||
-               (strcmp(uname, "chosen") != 0 &&
-                               strcmp(uname, "chosen@0") != 0))
-               return 0;
-
-#ifdef CONFIG_KEXEC
-       lprop = (u64 *)of_get_flat_dt_prop(node,
-                               "linux,crashkernel-base", NULL);
-       if (lprop)
-               crashk_res.start = *lprop;
-
-       lprop = (u64 *)of_get_flat_dt_prop(node,
-                               "linux,crashkernel-size", NULL);
-       if (lprop)
-               crashk_res.end = crashk_res.start + *lprop - 1;
-#endif
-
-       early_init_dt_check_for_initrd(node);
-
-       /* Retreive command line */
-       p = of_get_flat_dt_prop(node, "bootargs", &l);
-       if (p != NULL && l > 0)
-               strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-#ifndef CONFIG_CMDLINE_FORCE
-       if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-#endif
-               strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-       pr_debug("Command line is: %s\n", cmd_line);
-
-       /* break now */
-       return 1;
-}
-
-static int __init early_init_dt_scan_root(unsigned long node,
-                               const char *uname, int depth, void *data)
-{
-       u32 *prop;
-
-       if (depth != 0)
-               return 0;
-
-       prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-       dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-       pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-       prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-       dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-       pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-
-       /* break now */
-       return 1;
-}
-
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
-       cell_t *p = *cellp;
-
-       *cellp = p + s;
-       return of_read_number(p, s);
+       /* No Microblaze specific code here */
 }
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-                               const char *uname, int depth, void *data)
+void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 {
-       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-       cell_t *reg, *endp;
-       unsigned long l;
-
-       /* Look for the ibm,dynamic-reconfiguration-memory node */
-/*     if (depth == 1 &&
-               strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0)
-               return early_init_dt_scan_drconf_memory(node);
-*/
-       /* We are scanning "memory" nodes only */
-       if (type == NULL) {
-               /*
-                * The longtrail doesn't have a device_type on the
-                * /memory node, so look for the node called /memory@0.
-                */
-               if (depth != 1 || strcmp(uname, "memory@0") != 0)
-                       return 0;
-       } else if (strcmp(type, "memory") != 0)
-               return 0;
-
-       reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
-       if (reg == NULL)
-               reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
-       if (reg == NULL)
-               return 0;
-
-       endp = reg + (l / sizeof(cell_t));
-
-       pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
-               uname, l, reg[0], reg[1], reg[2], reg[3]);
-
-       while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
-               u64 base, size;
-
-               base = dt_mem_next_cell(dt_root_addr_cells, &reg);
-               size = dt_mem_next_cell(dt_root_size_cells, &reg);
-
-               if (size == 0)
-                       continue;
-               pr_debug(" - %llx ,  %llx\n", (unsigned long long)base,
-                       (unsigned long long)size);
-
-               lmb_add(base, size);
-       }
-       return 0;
+       lmb_add(base, size);
 }
 
-#ifdef CONFIG_PHYP_DUMP
-/**
- * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
- *
- * Function to find the largest size we need to reserve
- * during early boot process.
- *
- * It either looks for boot param and returns that OR
- * returns larger of 256 or 5% rounded down to multiples of 256MB.
- *
- */
-static inline unsigned long phyp_dump_calculate_reserve_size(void)
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
 {
-       unsigned long tmp;
-
-       if (phyp_dump_info->reserve_bootvar)
-               return phyp_dump_info->reserve_bootvar;
-
-       /* divide by 20 to get 5% of value */
-       tmp = lmb_end_of_DRAM();
-       do_div(tmp, 20);
-
-       /* round it down in multiples of 256 */
-       tmp = tmp & ~0x0FFFFFFFUL;
-
-       return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
+       return lmb_alloc(size, align);
 }
 
-/**
- * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
- *
- * This routine may reserve memory regions in the kernel only
- * if the system is supported and a dump was taken in last
- * boot instance or if the hardware is supported and the
- * scratch area needs to be setup. In other instances it returns
- * without reserving anything. The memory in case of dump being
- * active is freed when the dump is collected (by userland tools).
- */
-static void __init phyp_dump_reserve_mem(void)
-{
-       unsigned long base, size;
-       unsigned long variable_reserve_size;
-
-       if (!phyp_dump_info->phyp_dump_configured) {
-               printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
-               return;
-       }
-
-       if (!phyp_dump_info->phyp_dump_at_boot) {
-               printk(KERN_INFO "Phyp-dump disabled at boot time\n");
-               return;
-       }
-
-       variable_reserve_size = phyp_dump_calculate_reserve_size();
-
-       if (phyp_dump_info->phyp_dump_is_active) {
-               /* Reserve *everything* above RMR.Area freed by userland tools*/
-               base = variable_reserve_size;
-               size = lmb_end_of_DRAM() - base;
-
-               /* XXX crashed_ram_end is wrong, since it may be beyond
-                * the memory_limit, it will need to be adjusted. */
-               lmb_reserve(base, size);
-
-               phyp_dump_info->init_reserve_start = base;
-               phyp_dump_info->init_reserve_size = size;
-       } else {
-               size = phyp_dump_info->cpu_state_size +
-                       phyp_dump_info->hpte_region_size +
-                       variable_reserve_size;
-               base = lmb_end_of_DRAM() - size;
-               lmb_reserve(base, size);
-               phyp_dump_info->init_reserve_start = base;
-               phyp_dump_info->init_reserve_size = size;
-       }
-}
-#else
-static inline void __init phyp_dump_reserve_mem(void) {}
-#endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
-
 #ifdef CONFIG_EARLY_PRINTK
 /* MS this is Microblaze specifig function */
 static int __init early_init_dt_scan_serial(unsigned long node,
@@ -775,11 +98,6 @@ void __init early_init_devtree(void *params)
        /* Setup flat device-tree pointer */
        initial_boot_params = params;
 
-#ifdef CONFIG_PHYP_DUMP
-       /* scan tree to see if dump occured during last boot */
-       of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
        /* Retrieve various informations from the /chosen node of the
         * device-tree, including the platform type, initrd location and
         * size, TCE reserve, and more ...
@@ -799,33 +117,18 @@ void __init early_init_devtree(void *params)
 
        pr_debug("Phys. mem: %lx\n", (unsigned long) lmb_phys_mem_size());
 
-       pr_debug("Scanning CPUs ...\n");
-
-       /* Retreive CPU related informations from the flat tree
-        * (altivec support, boot CPU ID, ...)
-        */
-       of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
        pr_debug(" <- early_init_devtree()\n");
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
+#ifdef CONFIG_BLK_DEV_INITRD
+void __init early_init_dt_setup_initrd_arch(unsigned long start,
+               unsigned long end)
 {
-       struct device_node *root;
-       int rc = 0;
-
-       root = of_find_node_by_path("/");
-       if (root) {
-               rc = of_device_is_compatible(root, compat);
-               of_node_put(root);
-       }
-       return rc;
+       initrd_start = (unsigned long)__va(start);
+       initrd_end = (unsigned long)__va(end);
+       initrd_below_start_ok = 1;
 }
-EXPORT_SYMBOL(machine_is_compatible);
+#endif
 
 /*******
  *
@@ -838,273 +141,6 @@ EXPORT_SYMBOL(machine_is_compatible);
  *
  *******/
 
-/**
- *     of_find_node_by_phandle - Find a node given a phandle
- *     @handle:        phandle of the node to find
- *
- *     Returns a node pointer with refcount incremented, use
- *     of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       read_lock(&devtree_lock);
-       for (np = allnodes; np != NULL; np = np->allnext)
-               if (np->linux_phandle == handle)
-                       break;
-       of_node_get(np);
-       read_unlock(&devtree_lock);
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
-/**
- *     of_node_get - Increment refcount of a node
- *     @node:  Node to inc refcount, NULL is supported to
- *             simplify writing of callers
- *
- *     Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-       if (node)
-               kref_get(&node->kref);
-       return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node *kref_to_device_node(struct kref *kref)
-{
-       return container_of(kref, struct device_node, kref);
-}
-
-/**
- *     of_node_release - release a dynamically allocated node
- *     @kref:  kref element of the node to be released
- *
- *     In of_node_put() this function is passed to kref_put()
- *     as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-       struct device_node *node = kref_to_device_node(kref);
-       struct property *prop = node->properties;
-
-       /* We should never be releasing nodes that haven't been detached. */
-       if (!of_node_check_flag(node, OF_DETACHED)) {
-               printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n",
-                       node->full_name);
-               dump_stack();
-               kref_init(&node->kref);
-               return;
-       }
-
-       if (!of_node_check_flag(node, OF_DYNAMIC))
-               return;
-
-       while (prop) {
-               struct property *next = prop->next;
-               kfree(prop->name);
-               kfree(prop->value);
-               kfree(prop);
-               prop = next;
-
-               if (!prop) {
-                       prop = node->deadprops;
-                       node->deadprops = NULL;
-               }
-       }
-       kfree(node->full_name);
-       kfree(node->data);
-       kfree(node);
-}
-
-/**
- *     of_node_put - Decrement refcount of a node
- *     @node:  Node to dec refcount, NULL is supported to
- *             simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-       if (node)
-               kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
-/*
- * Plug a device node into the tree and global list.
- */
-void of_attach_node(struct device_node *np)
-{
-       unsigned long flags;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       np->sibling = np->parent->child;
-       np->allnext = allnodes;
-       np->parent->child = np;
-       allnodes = np;
-       write_unlock_irqrestore(&devtree_lock, flags);
-}
-
-/*
- * "Unplug" a node from the device tree.  The caller must hold
- * a reference to the node.  The memory associated with the node
- * is not freed until its refcount goes to zero.
- */
-void of_detach_node(struct device_node *np)
-{
-       struct device_node *parent;
-       unsigned long flags;
-
-       write_lock_irqsave(&devtree_lock, flags);
-
-       parent = np->parent;
-       if (!parent)
-               goto out_unlock;
-
-       if (allnodes == np)
-               allnodes = np->allnext;
-       else {
-               struct device_node *prev;
-               for (prev = allnodes;
-                    prev->allnext != np;
-                    prev = prev->allnext)
-                       ;
-               prev->allnext = np->allnext;
-       }
-
-       if (parent->child == np)
-               parent->child = np->sibling;
-       else {
-               struct device_node *prevsib;
-               for (prevsib = np->parent->child;
-                    prevsib->sibling != np;
-                    prevsib = prevsib->sibling)
-                       ;
-               prevsib->sibling = np->sibling;
-       }
-
-       of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
-       write_unlock_irqrestore(&devtree_lock, flags);
-}
-
-/*
- * Add a property to a node
- */
-int prom_add_property(struct device_node *np, struct property *prop)
-{
-       struct property **next;
-       unsigned long flags;
-
-       prop->next = NULL;
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (strcmp(prop->name, (*next)->name) == 0) {
-                       /* duplicate ! don't insert it */
-                       write_unlock_irqrestore(&devtree_lock, flags);
-                       return -1;
-               }
-               next = &(*next)->next;
-       }
-       *next = prop;
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to add to proc as well if it was initialized */
-       if (np->pde)
-               proc_device_tree_add_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
-/*
- * Remove a property from a node.  Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property.  Instead we just move the property
- * to the "dead properties" list, so it won't be found any more.
- */
-int prom_remove_property(struct device_node *np, struct property *prop)
-{
-       struct property **next;
-       unsigned long flags;
-       int found = 0;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (*next == prop) {
-                       /* found the node */
-                       *next = prop->next;
-                       prop->next = np->deadprops;
-                       np->deadprops = prop;
-                       found = 1;
-                       break;
-               }
-               next = &(*next)->next;
-       }
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-       if (!found)
-               return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to remove the proc node as well */
-       if (np->pde)
-               proc_device_tree_remove_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
-/*
- * Update a property in a node.  Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property.  Instead we just move the property
- * to the "dead properties" list, and add the new property to the
- * property list
- */
-int prom_update_property(struct device_node *np,
-                        struct property *newprop,
-                        struct property *oldprop)
-{
-       struct property **next;
-       unsigned long flags;
-       int found = 0;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (*next == oldprop) {
-                       /* found the node */
-                       newprop->next = oldprop->next;
-                       *next = newprop;
-                       oldprop->next = np->deadprops;
-                       np->deadprops = oldprop;
-                       found = 1;
-                       break;
-               }
-               next = &(*next)->next;
-       }
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-       if (!found)
-               return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to add to proc as well if it was initialized */
-       if (np->pde)
-               proc_device_tree_update_prop(np->pde, newprop, oldprop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
 #if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
 
index ae0352ecd5a9c72e5178064dc350ccc946346510..bf7e6c27e318f88a0cf5a8a352d7126f460f0be5 100644 (file)
@@ -256,7 +256,7 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
                if (ppdev == NULL) {
                        struct pci_controller *host;
                        host = pci_bus_to_host(pdev->bus);
-                       ppnode = host ? host->arch_data : NULL;
+                       ppnode = host ? host->dn : NULL;
                        /* No node for host bridge ? give up */
                        if (ppnode == NULL)
                                return -EINVAL;
index 5372b24ad049cf92cfd881927c21f5e559a54089..bb8c4b9ccb8019bb54cb585a5e8d1f2e77f3acb9 100644 (file)
@@ -54,6 +54,7 @@ void __init setup_arch(char **cmdline_p)
 
        microblaze_cache_init();
 
+       invalidate_dcache();
        enable_dcache();
 
        invalidate_icache();
index 4088be7d4e292ed307cdf4539df4f2b5adfc06be..03376dc814c9b406d16f12346d135e08039b2e90 100644 (file)
@@ -366,7 +366,7 @@ ENTRY(sys_call_table)
        .long sys_shutdown
        .long sys_sendmsg               /* 360 */
        .long sys_recvmsg
-       .long sys_ni_syscall
+       .long sys_accept4
        .long sys_ni_syscall
        .long sys_ni_syscall
        .long sys_rt_tgsigqueueinfo     /* 365 */
index 9541171f1220070d7d441718b7720489a6833cb7..591ca0cd4c2471a70841accab5f45a20a2d29a02 100644 (file)
@@ -41,7 +41,7 @@ config AR7
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_ZBOOT_UART16550
-       select GENERIC_GPIO
+       select ARCH_REQUIRE_GPIOLIB
        select GCD
        select VLYNQ
        help
@@ -180,7 +180,7 @@ config LASAT
 
 config MACH_LOONGSON
        bool "Loongson family of machines"
-       select SYS_SUPPORTS_ZBOOT_UART16550
+       select SYS_SUPPORTS_ZBOOT
        help
          This enables the support of Loongson family of machines.
 
@@ -1295,7 +1295,6 @@ config CPU_CAVIUM_OCTEON
        select SYS_SUPPORTS_SMP
        select NR_CPUS_DEFAULT_16
        select WEAK_ORDERING
-       select WEAK_REORDERING_BEYOND_LLSC
        select CPU_SUPPORTS_HIGHMEM
        select CPU_SUPPORTS_HUGEPAGES
        help
@@ -1311,6 +1310,7 @@ config SYS_SUPPORTS_ZBOOT
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_LZMA
+       select HAVE_KERNEL_LZO
 
 config SYS_SUPPORTS_ZBOOT_UART16550
        bool
@@ -1725,6 +1725,9 @@ config SB1_PASS_2_1_WORKAROUNDS
 config 64BIT_PHYS_ADDR
        bool
 
+config ARCH_PHYS_ADDR_T_64BIT
+       def_bool 64BIT_PHYS_ADDR
+
 config CPU_HAS_SMARTMIPS
        depends on SYS_SUPPORTS_SMARTMIPS
        bool "Support for the SmartMIPS ASE"
index d2b88a0be5199715b003668f5c528a0c6cefcafe..43dc279977308363e1f0aa538504b5f220cc8cb0 100644 (file)
@@ -102,4 +102,30 @@ config RUNTIME_DEBUG
          arch/mips/include/asm/debug.h for debugging macros.
          If unsure, say N.
 
+config DEBUG_ZBOOT
+       bool "Enable compressed kernel support debugging"
+       depends on DEBUG_KERNEL && SYS_SUPPORTS_ZBOOT
+       default n
+       help
+         If you want to add compressed kernel support to a new board, and the
+         board supports uart16550 compatible serial port, please select
+         SYS_SUPPORTS_ZBOOT_UART16550 for your board and enable this option to
+         debug it.
+
+         If your board doesn't support uart16550 compatible serial port, you
+         can try to select SYS_SUPPORTS_ZBOOT and use the other methods to
+         debug it. for example, add a new serial port support just as
+         arch/mips/boot/compressed/uart-16550.c does.
+
+         After the compressed kernel support works, please disable this option
+         to reduce the kernel image size and speed up the booting procedure a
+         little.
+
+config SPINLOCK_TEST
+       bool "Enable spinlock timing tests in debugfs"
+       depends on DEBUG_FS
+       default n
+       help
+         Add several files to the debugfs to test spinlock speed.
+
 endmenu
index 1893efd43fcab58b72c339dbf5917aedab17756a..2f2eac23332256005659a5c34bafdee0297f0b8e 100644 (file)
@@ -184,6 +184,15 @@ libs-$(CONFIG_CFE)         += arch/mips/fw/cfe/
 libs-$(CONFIG_SNIPROM)         += arch/mips/fw/sni/
 libs-y                         += arch/mips/fw/lib/
 
+#
+# Kernel compression
+#
+ifdef SYS_SUPPORTS_ZBOOT
+COMPRESSION_FNAME              = vmlinuz
+else
+COMPRESSION_FNAME              = vmlinux
+endif
+
 #
 # Board-dependent options and extra files
 #
@@ -332,11 +341,11 @@ load-$(CONFIG_WR_PPMC)            += 0xffffffff80100000
 #
 # Loongson family
 #
-core-$(CONFIG_MACH_LOONGSON) +=arch/mips/loongson/
+core-$(CONFIG_MACH_LOONGSON) += arch/mips/loongson/
 cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson \
                     -mno-branch-likely
-load-$(CONFIG_LEMOTE_FULOONG2E) +=0xffffffff80100000
-load-$(CONFIG_LEMOTE_MACH2F) +=0xffffffff80200000
+load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
+load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
 
 #
 # MIPS Malta board
@@ -344,7 +353,7 @@ load-$(CONFIG_LEMOTE_MACH2F) +=0xffffffff80200000
 core-$(CONFIG_MIPS_MALTA)      += arch/mips/mti-malta/
 cflags-$(CONFIG_MIPS_MALTA)    += -I$(srctree)/arch/mips/include/asm/mach-malta
 load-$(CONFIG_MIPS_MALTA)      += 0xffffffff80100000
-all-$(CONFIG_MIPS_MALTA)       := vmlinuz.bin
+all-$(CONFIG_MIPS_MALTA)       := $(COMPRESSION_FNAME).bin
 
 #
 # MIPS SIM
@@ -594,7 +603,7 @@ load-$(CONFIG_SNI_RM)               += 0xffffffff80600000
 else
 load-$(CONFIG_SNI_RM)          += 0xffffffff80030000
 endif
-all-$(CONFIG_SNI_RM)           := vmlinuz.ecoff
+all-$(CONFIG_SNI_RM)           := $(COMPRESSION_FNAME).ecoff
 
 #
 # Common TXx9
index 00b498e97c831b193c60f02ef5865ebe9e12ee82..df3b1a7eb15d98b7d5643ee940aef5a90d04bd9a 100644 (file)
@@ -1,5 +1,5 @@
-# au1000-style gpio
-config ALCHEMY_GPIO_AU1000
+# au1000-style gpio and interrupt controllers
+config ALCHEMY_GPIOINT_AU1000
        bool
 
 # select this in your board config if you don't want to use the gpio
@@ -20,12 +20,14 @@ config MIPS_MTX1
        select HW_HAS_PCI
        select SOC_AU1500
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_BOSPORUS
        bool "Alchemy Bosporus board"
        select SOC_AU1500
        select DMA_NONCOHERENT
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_DB1000
        bool "Alchemy DB1000 board"
@@ -33,12 +35,14 @@ config MIPS_DB1000
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_DB1100
        bool "Alchemy DB1100 board"
        select SOC_AU1100
        select DMA_NONCOHERENT
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_DB1200
        bool "Alchemy DB1200 board"
@@ -46,6 +50,7 @@ config MIPS_DB1200
        select DMA_COHERENT
        select MIPS_DISABLE_OBSOLETE_IDE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_DB1500
        bool "Alchemy DB1500 board"
@@ -55,6 +60,7 @@ config MIPS_DB1500
        select MIPS_DISABLE_OBSOLETE_IDE
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_DB1550
        bool "Alchemy DB1550 board"
@@ -63,12 +69,14 @@ config MIPS_DB1550
        select DMA_NONCOHERENT
        select MIPS_DISABLE_OBSOLETE_IDE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_MIRAGE
        bool "Alchemy Mirage board"
        select DMA_NONCOHERENT
        select SOC_AU1500
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_PB1000
        bool "Alchemy PB1000 board"
@@ -77,6 +85,7 @@ config MIPS_PB1000
        select HW_HAS_PCI
        select SWAP_IO_SPACE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_PB1100
        bool "Alchemy PB1100 board"
@@ -85,6 +94,7 @@ config MIPS_PB1100
        select HW_HAS_PCI
        select SWAP_IO_SPACE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_PB1200
        bool "Alchemy PB1200 board"
@@ -92,6 +102,7 @@ config MIPS_PB1200
        select DMA_NONCOHERENT
        select MIPS_DISABLE_OBSOLETE_IDE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_PB1500
        bool "Alchemy PB1500 board"
@@ -99,6 +110,7 @@ config MIPS_PB1500
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_PB1550
        bool "Alchemy PB1550 board"
@@ -107,39 +119,41 @@ config MIPS_PB1550
        select HW_HAS_PCI
        select MIPS_DISABLE_OBSOLETE_IDE
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 config MIPS_XXS1500
        bool "MyCable XXS1500 board"
        select DMA_NONCOHERENT
        select SOC_AU1500
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_EARLY_PRINTK
 
 endchoice
 
 config SOC_AU1000
        bool
        select SOC_AU1X00
-       select ALCHEMY_GPIO_AU1000
+       select ALCHEMY_GPIOINT_AU1000
 
 config SOC_AU1100
        bool
        select SOC_AU1X00
-       select ALCHEMY_GPIO_AU1000
+       select ALCHEMY_GPIOINT_AU1000
 
 config SOC_AU1500
        bool
        select SOC_AU1X00
-       select ALCHEMY_GPIO_AU1000
+       select ALCHEMY_GPIOINT_AU1000
 
 config SOC_AU1550
        bool
        select SOC_AU1X00
-       select ALCHEMY_GPIO_AU1000
+       select ALCHEMY_GPIOINT_AU1000
 
 config SOC_AU1200
        bool
        select SOC_AU1X00
-       select ALCHEMY_GPIO_AU1000
+       select ALCHEMY_GPIOINT_AU1000
 
 config SOC_AU1X00
        bool
index b67fb512529d11518ff6ea6e28628c6a317bcd67..06c0e65a54b5e079c1fd4f52ed71e289e68874c9 100644 (file)
@@ -5,14 +5,15 @@
 # Makefile for the Alchemy Au1xx0 CPUs, generic files.
 #
 
-obj-y += prom.o irq.o puts.o time.o reset.o \
-       clocks.o platform.o power.o setup.o \
+obj-y += prom.o time.o clocks.o platform.o power.o setup.o \
        sleeper.o dma.o dbdma.o
 
+obj-$(CONFIG_ALCHEMY_GPIOINT_AU1000) += irq.o
+
 # optional gpiolib support
 ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),)
  ifeq ($(CONFIG_GPIOLIB),y)
-  obj-$(CONFIG_ALCHEMY_GPIO_AU1000) += gpiolib-au1000.o
+  obj-$(CONFIG_ALCHEMY_GPIOINT_AU1000) += gpiolib-au1000.o
  endif
 endif
 
index d8991854530e2dbf50bd71297f7518a5a9e659a3..460c6285c1bbe00cda3f0f89b2da1b5867d6f223 100644 (file)
@@ -40,8 +40,6 @@
 static unsigned int au1x00_clock; /*  Hz */
 static unsigned long uart_baud_base;
 
-static DEFINE_SPINLOCK(time_lock);
-
 /*
  * Set the au1000_clock
  */
@@ -84,9 +82,6 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base)
 unsigned long au1xxx_calc_clock(void)
 {
        unsigned long cpu_speed;
-       unsigned long flags;
-
-       spin_lock_irqsave(&time_lock, flags);
 
        /*
         * On early Au1000, sys_cpupll was write-only. Since these
@@ -108,8 +103,6 @@ unsigned long au1xxx_calc_clock(void)
        set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)
                                                          & 0x03) + 2) * 16));
 
-       spin_unlock_irqrestore(&time_lock, flags);
-
        set_au1x00_speed(cpu_speed);
 
        return cpu_speed;
index 5c68569344c104966159121d385aca43576f6f12..99ae84ce5af3dc528e6ccdcebe833c2ef633ac1e 100644 (file)
@@ -30,6 +30,7 @@
  *
  */
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -58,7 +59,6 @@ static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);
 
 static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE;
 static int dbdma_initialized;
-static void au1xxx_dbdma_init(void);
 
 static dbdev_tab_t dbdev_tab[] = {
 #ifdef CONFIG_SOC_AU1550
@@ -237,7 +237,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
        void (*callback)(int, void *), void *callparam)
 {
        unsigned long   flags;
-       u32             used, chan, rv;
+       u32             used, chan;
        u32             dcp;
        int             i;
        dbdev_tab_t     *stp, *dtp;
@@ -250,8 +250,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
         * which can't be done successfully during board set up.
         */
        if (!dbdma_initialized)
-               au1xxx_dbdma_init();
-       dbdma_initialized = 1;
+               return 0;
 
        stp = find_dbdev_id(srcid);
        if (stp == NULL)
@@ -261,7 +260,6 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
                return 0;
 
        used = 0;
-       rv = 0;
 
        /* Check to see if we can get both channels. */
        spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
@@ -282,63 +280,65 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
                used++;
        spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
 
-       if (!used) {
-               /* Let's see if we can allocate a channel for it. */
-               ctp = NULL;
-               chan = 0;
-               spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
-               for (i = 0; i < NUM_DBDMA_CHANS; i++)
-                       if (chan_tab_ptr[i] == NULL) {
-                               /*
-                                * If kmalloc fails, it is caught below same
-                                * as a channel not available.
-                                */
-                               ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
-                               chan_tab_ptr[i] = ctp;
-                               break;
-                       }
-               spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
-
-               if (ctp != NULL) {
-                       memset(ctp, 0, sizeof(chan_tab_t));
-                       ctp->chan_index = chan = i;
-                       dcp = DDMA_CHANNEL_BASE;
-                       dcp += (0x0100 * chan);
-                       ctp->chan_ptr = (au1x_dma_chan_t *)dcp;
-                       cp = (au1x_dma_chan_t *)dcp;
-                       ctp->chan_src = stp;
-                       ctp->chan_dest = dtp;
-                       ctp->chan_callback = callback;
-                       ctp->chan_callparam = callparam;
-
-                       /* Initialize channel configuration. */
-                       i = 0;
-                       if (stp->dev_intlevel)
-                               i |= DDMA_CFG_SED;
-                       if (stp->dev_intpolarity)
-                               i |= DDMA_CFG_SP;
-                       if (dtp->dev_intlevel)
-                               i |= DDMA_CFG_DED;
-                       if (dtp->dev_intpolarity)
-                               i |= DDMA_CFG_DP;
-                       if ((stp->dev_flags & DEV_FLAGS_SYNC) ||
-                               (dtp->dev_flags & DEV_FLAGS_SYNC))
-                                       i |= DDMA_CFG_SYNC;
-                       cp->ddma_cfg = i;
-                       au_sync();
+       if (used)
+               return 0;
 
-                       /* Return a non-zero value that can be used to
-                        * find the channel information in subsequent
-                        * operations.
+       /* Let's see if we can allocate a channel for it. */
+       ctp = NULL;
+       chan = 0;
+       spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
+       for (i = 0; i < NUM_DBDMA_CHANS; i++)
+               if (chan_tab_ptr[i] == NULL) {
+                       /*
+                        * If kmalloc fails, it is caught below same
+                        * as a channel not available.
                         */
-                       rv = (u32)(&chan_tab_ptr[chan]);
-               } else {
-                       /* Release devices */
-                       stp->dev_flags &= ~DEV_FLAGS_INUSE;
-                       dtp->dev_flags &= ~DEV_FLAGS_INUSE;
+                       ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
+                       chan_tab_ptr[i] = ctp;
+                       break;
                }
+       spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
+
+       if (ctp != NULL) {
+               memset(ctp, 0, sizeof(chan_tab_t));
+               ctp->chan_index = chan = i;
+               dcp = DDMA_CHANNEL_BASE;
+               dcp += (0x0100 * chan);
+               ctp->chan_ptr = (au1x_dma_chan_t *)dcp;
+               cp = (au1x_dma_chan_t *)dcp;
+               ctp->chan_src = stp;
+               ctp->chan_dest = dtp;
+               ctp->chan_callback = callback;
+               ctp->chan_callparam = callparam;
+
+               /* Initialize channel configuration. */
+               i = 0;
+               if (stp->dev_intlevel)
+                       i |= DDMA_CFG_SED;
+               if (stp->dev_intpolarity)
+                       i |= DDMA_CFG_SP;
+               if (dtp->dev_intlevel)
+                       i |= DDMA_CFG_DED;
+               if (dtp->dev_intpolarity)
+                       i |= DDMA_CFG_DP;
+               if ((stp->dev_flags & DEV_FLAGS_SYNC) ||
+                       (dtp->dev_flags & DEV_FLAGS_SYNC))
+                               i |= DDMA_CFG_SYNC;
+               cp->ddma_cfg = i;
+               au_sync();
+
+               /*
+                * Return a non-zero value that can be used to find the channel
+                * information in subsequent operations.
+                */
+               return (u32)(&chan_tab_ptr[chan]);
        }
-       return rv;
+
+       /* Release devices */
+       stp->dev_flags &= ~DEV_FLAGS_INUSE;
+       dtp->dev_flags &= ~DEV_FLAGS_INUSE;
+
+       return 0;
 }
 EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);
 
@@ -412,8 +412,11 @@ u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
                if (desc_base == 0)
                        return 0;
 
+               ctp->cdb_membase = desc_base;
                desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));
-       }
+       } else
+               ctp->cdb_membase = desc_base;
+
        dp = (au1x_ddma_desc_t *)desc_base;
 
        /* Keep track of the base descriptor. */
@@ -569,7 +572,7 @@ EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc);
  * This updates the source pointer and byte count.  Normally used
  * for memory to fifo transfers.
  */
-u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
+u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
 {
        chan_tab_t              *ctp;
        au1x_ddma_desc_t        *dp;
@@ -595,7 +598,7 @@ u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
                return 0;
 
        /* Load up buffer address and byte count. */
-       dp->dscr_source0 = virt_to_phys(buf);
+       dp->dscr_source0 = buf & ~0UL;
        dp->dscr_cmd1 = nbytes;
        /* Check flags */
        if (flags & DDMA_FLAGS_IE)
@@ -622,14 +625,13 @@ u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
        /* Return something non-zero. */
        return nbytes;
 }
-EXPORT_SYMBOL(_au1xxx_dbdma_put_source);
+EXPORT_SYMBOL(au1xxx_dbdma_put_source);
 
 /* Put a destination buffer into the DMA ring.
  * This updates the destination pointer and byte count.  Normally used
  * to place an empty buffer into the ring for fifo to memory transfers.
  */
-u32
-_au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
+u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
 {
        chan_tab_t              *ctp;
        au1x_ddma_desc_t        *dp;
@@ -659,7 +661,7 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
        if (flags & DDMA_FLAGS_NOIE)
                dp->dscr_cmd0 &= ~DSCR_CMD0_IE;
 
-       dp->dscr_dest0 = virt_to_phys(buf);
+       dp->dscr_dest0 = buf & ~0UL;
        dp->dscr_cmd1 = nbytes;
 #if 0
        printk(KERN_DEBUG "cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n",
@@ -685,7 +687,7 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
        /* Return something non-zero. */
        return nbytes;
 }
-EXPORT_SYMBOL(_au1xxx_dbdma_put_dest);
+EXPORT_SYMBOL(au1xxx_dbdma_put_dest);
 
 /*
  * Get a destination buffer into the DMA ring.
@@ -831,7 +833,7 @@ void au1xxx_dbdma_chan_free(u32 chanid)
 
        au1xxx_dbdma_stop(chanid);
 
-       kfree((void *)ctp->chan_desc_base);
+       kfree((void *)ctp->cdb_membase);
 
        stp->dev_flags &= ~DEV_FLAGS_INUSE;
        dtp->dev_flags &= ~DEV_FLAGS_INUSE;
@@ -868,28 +870,6 @@ static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
        return IRQ_RETVAL(1);
 }
 
-static void au1xxx_dbdma_init(void)
-{
-       int irq_nr;
-
-       dbdma_gptr->ddma_config = 0;
-       dbdma_gptr->ddma_throttle = 0;
-       dbdma_gptr->ddma_inten = 0xffff;
-       au_sync();
-
-#if defined(CONFIG_SOC_AU1550)
-       irq_nr = AU1550_DDMA_INT;
-#elif defined(CONFIG_SOC_AU1200)
-       irq_nr = AU1200_DDMA_INT;
-#else
-       #error Unknown Au1x00 SOC
-#endif
-
-       if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED,
-                       "Au1xxx dbdma", (void *)dbdma_gptr))
-               printk(KERN_ERR "Can't get 1550 dbdma irq");
-}
-
 void au1xxx_dbdma_dump(u32 chanid)
 {
        chan_tab_t       *ctp;
@@ -903,7 +883,7 @@ void au1xxx_dbdma_dump(u32 chanid)
        dtp = ctp->chan_dest;
        cp = ctp->chan_ptr;
 
-       printk(KERN_DEBUG "Chan %x, stp %x (dev %d)  dtp %x (dev %d) \n",
+       printk(KERN_DEBUG "Chan %x, stp %x (dev %d)  dtp %x (dev %d)\n",
                          (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp,
                          dtp - dbdev_tab);
        printk(KERN_DEBUG "desc base %x, get %x, put %x, cur %x\n",
@@ -1038,4 +1018,38 @@ void au1xxx_dbdma_resume(void)
        }
 }
 #endif /* CONFIG_PM */
+
+static int __init au1xxx_dbdma_init(void)
+{
+       int irq_nr, ret;
+
+       dbdma_gptr->ddma_config = 0;
+       dbdma_gptr->ddma_throttle = 0;
+       dbdma_gptr->ddma_inten = 0xffff;
+       au_sync();
+
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1550:
+               irq_nr = AU1550_DDMA_INT;
+               break;
+       case ALCHEMY_CPU_AU1200:
+               irq_nr = AU1200_DDMA_INT;
+               break;
+       default:
+               return -ENODEV;
+       }
+
+       ret = request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED,
+                       "Au1xxx dbdma", (void *)dbdma_gptr);
+       if (ret)
+               printk(KERN_ERR "Cannot grab DBDMA interrupt!\n");
+       else {
+               dbdma_initialized = 1;
+               printk(KERN_INFO "Alchemy DBDMA initialized\n");
+       }
+
+       return ret;
+}
+subsys_initcall(au1xxx_dbdma_init);
+
 #endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */
index d6fbda232e6ae5b8cdf92eee346dbdae091fe1f2..d5278877891d924837960dbc6e04c56cf8395c69 100644 (file)
@@ -29,6 +29,8 @@
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
+
+#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -188,17 +190,14 @@ int request_au1000_dma(int dev_id, const char *dev_str,
                dev = &dma_dev_table[dev_id];
 
        if (irqhandler) {
-               chan->irq = AU1000_DMA_INT_BASE + i;
                chan->irq_dev = irq_dev_id;
                ret = request_irq(chan->irq, irqhandler, irqflags, dev_str,
                                  chan->irq_dev);
                if (ret) {
-                       chan->irq = 0;
                        chan->irq_dev = NULL;
                        return ret;
                }
        } else {
-               chan->irq = 0;
                chan->irq_dev = NULL;
        }
 
@@ -226,13 +225,40 @@ void free_au1000_dma(unsigned int dmanr)
        }
 
        disable_dma(dmanr);
-       if (chan->irq)
+       if (chan->irq_dev)
                free_irq(chan->irq, chan->irq_dev);
 
-       chan->irq = 0;
        chan->irq_dev = NULL;
        chan->dev_id = -1;
 }
 EXPORT_SYMBOL(free_au1000_dma);
 
+static int __init au1000_dma_init(void)
+{
+        int base, i;
+
+        switch (alchemy_get_cputype()) {
+        case ALCHEMY_CPU_AU1000:
+                base = AU1000_DMA_INT_BASE;
+                break;
+        case ALCHEMY_CPU_AU1500:
+                base = AU1500_DMA_INT_BASE;
+                break;
+        case ALCHEMY_CPU_AU1100:
+                base = AU1100_DMA_INT_BASE;
+                break;
+        default:
+                goto out;
+        }
+
+        for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++)
+                au1000_dma_table[i].irq = base + i;
+
+        printk(KERN_INFO "Alchemy DMA initialized\n");
+
+out:
+        return 0;
+}
+arch_initcall(au1000_dma_init);
+
 #endif /* AU1000 AU1500 AU1100 */
index 1bfa91f939f45721cbb3239a40bef3c72fc8d70b..c8e1a94d4a95d8c3c308c7fc0d946b78acdca064 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/gpio.h>
 
-#if !defined(CONFIG_SOC_AU1000)
 static int gpio2_get(struct gpio_chip *chip, unsigned offset)
 {
        return alchemy_gpio2_get_value(offset + ALCHEMY_GPIO2_BASE);
@@ -63,7 +62,7 @@ static int gpio2_to_irq(struct gpio_chip *chip, unsigned offset)
 {
        return alchemy_gpio2_to_irq(offset + ALCHEMY_GPIO2_BASE);
 }
-#endif /* !defined(CONFIG_SOC_AU1000) */
+
 
 static int gpio1_get(struct gpio_chip *chip, unsigned offset)
 {
@@ -104,7 +103,6 @@ struct gpio_chip alchemy_gpio_chip[] = {
                .base                   = ALCHEMY_GPIO1_BASE,
                .ngpio                  = ALCHEMY_GPIO1_NUM,
        },
-#if !defined(CONFIG_SOC_AU1000)
        [1] = {
                .label                  = "alchemy-gpio2",
                .direction_input        = gpio2_direction_input,
@@ -115,15 +113,13 @@ struct gpio_chip alchemy_gpio_chip[] = {
                .base                   = ALCHEMY_GPIO2_BASE,
                .ngpio                  = ALCHEMY_GPIO2_NUM,
        },
-#endif
 };
 
 static int __init alchemy_gpiolib_init(void)
 {
        gpiochip_add(&alchemy_gpio_chip[0]);
-#if !defined(CONFIG_SOC_AU1000)
-       gpiochip_add(&alchemy_gpio_chip[1]);
-#endif
+       if (alchemy_get_cputype() != ALCHEMY_CPU_AU1000)
+               gpiochip_add(&alchemy_gpio_chip[1]);
 
        return 0;
 }
index d670928afcfd50251ab39453ff90fce8cacc8cb6..b2821ace4d00590e40c63234ec02f390f31aecef 100644 (file)
 
 static int au1x_ic_settype(unsigned int irq, unsigned int flow_type);
 
+/* NOTE on interrupt priorities: The original writers of this code said:
+ *
+ * Because of the tight timing of SETUP token to reply transactions,
+ * the USB devices-side packet complete interrupt (USB_DEV_REQ_INT)
+ * needs the highest priority.
+ */
+
 /* per-processor fixed function irqs */
-struct au1xxx_irqmap au1xxx_ic0_map[] __initdata = {
-
-#if defined(CONFIG_SOC_AU1000)
-       { AU1000_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_UART2_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 },
-       { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 },
-
-#elif defined(CONFIG_SOC_AU1500)
-
-       { AU1500_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1500_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 },
-       { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1500_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1500_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 },
-
-#elif defined(CONFIG_SOC_AU1100)
-
-       { AU1100_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1100_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1100_SD_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1100_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 },
-       { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
+struct au1xxx_irqmap {
+       int im_irq;
+       int im_type;
+       int im_request;         /* set 1 to get higher priority */
+};
+
+struct au1xxx_irqmap au1000_irqmap[] __initdata = {
+       { AU1000_UART0_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_UART1_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_UART2_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_UART3_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_SSI0_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_SSI1_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+1,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+2,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+3,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+4,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+5,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+6,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_DMA_INT_BASE+7,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_TOY_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_TOY_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_TOY_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_TOY_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_RTC_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_RTC_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_RTC_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_RTC_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 1 },
+       { AU1000_IRDA_TX_INT,     IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_IRDA_RX_INT,     IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH,  1 },
        { AU1000_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1000_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1100_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1100_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 },
-
-#elif defined(CONFIG_SOC_AU1550)
-
-       { AU1550_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_CRYPTO_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_PCI_RST_INT, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PSC2_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_PSC3_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 },
-       { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1550_NAND_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1550_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
+       { AU1000_USB_HOST_INT,    IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1000_ACSYNC_INT,      IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1000_MAC0_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_MAC1_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1000_AC97C_INT,       IRQ_TYPE_EDGE_RISING, 0 },
+       { -1, },
+};
+
+struct au1xxx_irqmap au1500_irqmap[] __initdata = {
+       { AU1500_UART0_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_PCI_INTA,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1500_PCI_INTB,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1500_UART3_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_PCI_INTC,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1500_PCI_INTD,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1500_DMA_INT_BASE,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+1,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+2,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+3,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+4,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+5,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+6,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_DMA_INT_BASE+7,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_TOY_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_TOY_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_TOY_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_TOY_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_RTC_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_RTC_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_RTC_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_RTC_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 1 },
+       { AU1500_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH,  1 },
+       { AU1500_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_USB_HOST_INT,    IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1500_ACSYNC_INT,      IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1500_MAC0_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_MAC1_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1500_AC97C_INT,       IRQ_TYPE_EDGE_RISING, 0 },
+       { -1, },
+};
+
+struct au1xxx_irqmap au1100_irqmap[] __initdata = {
+       { AU1100_UART0_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_UART1_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_SD_INT,          IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_UART3_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_SSI0_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_SSI1_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+1,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+2,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+3,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+4,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+5,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+6,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_DMA_INT_BASE+7,  IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_TOY_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_TOY_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_TOY_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_TOY_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_RTC_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_RTC_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_RTC_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_RTC_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 1 },
+       { AU1100_IRDA_TX_INT,     IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_IRDA_RX_INT,     IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH,  1 },
+       { AU1100_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_USB_HOST_INT,    IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1100_ACSYNC_INT,      IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1100_MAC0_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_LCD_INT,         IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1100_AC97C_INT,       IRQ_TYPE_EDGE_RISING, 0 },
+       { -1, },
+};
+
+struct au1xxx_irqmap au1550_irqmap[] __initdata = {
+       { AU1550_UART0_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PCI_INTA,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_PCI_INTB,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_DDMA_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_CRYPTO_INT,      IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PCI_INTC,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_PCI_INTD,        IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_PCI_RST_INT,     IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_UART1_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_UART3_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PSC0_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PSC1_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PSC2_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_PSC3_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_TOY_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_TOY_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_TOY_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_TOY_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_RTC_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_RTC_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_RTC_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_RTC_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 1 },
+       { AU1550_NAND_INT,        IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1550_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH,  1 },
        { AU1550_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1550_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 },
-       { AU1550_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1550_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-
-#elif defined(CONFIG_SOC_AU1200)
-
-       { AU1200_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_SWT_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1200_SD_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_MAE_BE_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_MAE_FE_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_AES_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_CAMERA_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 },
-       { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1200_NAND_INT, IRQ_TYPE_EDGE_RISING, 0 },
-       { AU1200_USB_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-       { AU1200_MAE_BOTH_INT, IRQ_TYPE_LEVEL_HIGH, 0 },
-
-#else
-#error "Error: Unknown Alchemy SOC"
-#endif
+       { AU1550_USB_HOST_INT,    IRQ_TYPE_LEVEL_LOW,   0 },
+       { AU1550_MAC0_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1550_MAC1_DMA_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { -1, },
+};
+
+struct au1xxx_irqmap au1200_irqmap[] __initdata = {
+       { AU1200_UART0_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_SWT_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_SD_INT,          IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_DDMA_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_MAE_BE_INT,      IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_UART1_INT,       IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_MAE_FE_INT,      IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_PSC0_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_PSC1_INT,        IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_AES_INT,         IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_CAMERA_INT,      IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_TOY_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_TOY_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_TOY_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_TOY_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_RTC_INT,         IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_RTC_MATCH0_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_RTC_MATCH1_INT,  IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_RTC_MATCH2_INT,  IRQ_TYPE_EDGE_RISING, 1 },
+       { AU1200_NAND_INT,        IRQ_TYPE_EDGE_RISING, 0 },
+       { AU1200_USB_INT,         IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_LCD_INT,         IRQ_TYPE_LEVEL_HIGH,  0 },
+       { AU1200_MAE_BOTH_INT,    IRQ_TYPE_LEVEL_HIGH,  0 },
+       { -1, },
 };
 
 
@@ -306,7 +318,7 @@ static void au1x_ic1_unmask(unsigned int irq_nr)
  * nowhere in the current kernel sources is it disabled.       --mlau
  */
 #if defined(CONFIG_MIPS_PB1000)
-       if (irq_nr == AU1000_GPIO_15)
+       if (irq_nr == AU1000_GPIO15_INT)
                au_writel(0x4000, PB1000_MDR); /* enable int */
 #endif
        au_sync();
@@ -378,11 +390,13 @@ static void au1x_ic1_maskack(unsigned int irq_nr)
 
 static int au1x_ic1_setwake(unsigned int irq, unsigned int on)
 {
-       unsigned int bit = irq - AU1000_INTC1_INT_BASE;
+       int bit = irq - AU1000_INTC1_INT_BASE;
        unsigned long wakemsk, flags;
 
-       /* only GPIO 0-7 can act as wakeup source: */
-       if ((irq < AU1000_GPIO_0) || (irq > AU1000_GPIO_7))
+       /* only GPIO 0-7 can act as wakeup source.  Fortunately these
+        * are wired up identically on all supported variants.
+        */
+       if ((bit < 0) || (bit > 7))
                return -EINVAL;
 
        local_irq_save(flags);
@@ -504,11 +518,11 @@ static int au1x_ic_settype(unsigned int irq, unsigned int flow_type)
 asmlinkage void plat_irq_dispatch(void)
 {
        unsigned int pending = read_c0_status() & read_c0_cause();
-       unsigned long s, off, bit;
+       unsigned long s, off;
 
        if (pending & CAUSEF_IP7) {
-               do_IRQ(MIPS_CPU_IRQ_BASE + 7);
-               return;
+               off = MIPS_CPU_IRQ_BASE + 7;
+               goto handle;
        } else if (pending & CAUSEF_IP2) {
                s = IC0_REQ0INT;
                off = AU1000_INTC0_INT_BASE;
@@ -524,58 +538,20 @@ asmlinkage void plat_irq_dispatch(void)
        } else
                goto spurious;
 
-       bit = 0;
        s = au_readl(s);
        if (unlikely(!s)) {
 spurious:
                spurious_interrupt();
                return;
        }
-#ifdef AU1000_USB_DEV_REQ_INT
-       /*
-        * Because of the tight timing of SETUP token to reply
-        * transactions, the USB devices-side packet complete
-        * interrupt needs the highest priority.
-        */
-       bit = 1 << (AU1000_USB_DEV_REQ_INT - AU1000_INTC0_INT_BASE);
-       if ((pending & CAUSEF_IP2) && (s & bit)) {
-               do_IRQ(AU1000_USB_DEV_REQ_INT);
-               return;
-       }
-#endif
-       do_IRQ(__ffs(s) + off);
+       off += __ffs(s);
+handle:
+       do_IRQ(off);
 }
 
-/* setup edge/level and assign request 0/1 */
-void __init au1xxx_setup_irqmap(struct au1xxx_irqmap *map, int count)
+static void __init au1000_init_irq(struct au1xxx_irqmap *map)
 {
        unsigned int bit, irq_nr;
-
-       while (count--) {
-               irq_nr = map[count].im_irq;
-
-               if (((irq_nr < AU1000_INTC0_INT_BASE) ||
-                    (irq_nr >= AU1000_INTC0_INT_BASE + 32)) &&
-                   ((irq_nr < AU1000_INTC1_INT_BASE) ||
-                    (irq_nr >= AU1000_INTC1_INT_BASE + 32)))
-                       continue;
-
-               if (irq_nr >= AU1000_INTC1_INT_BASE) {
-                       bit = irq_nr - AU1000_INTC1_INT_BASE;
-                       if (map[count].im_request)
-                               au_writel(1 << bit, IC1_ASSIGNCLR);
-               } else {
-                       bit = irq_nr - AU1000_INTC0_INT_BASE;
-                       if (map[count].im_request)
-                               au_writel(1 << bit, IC0_ASSIGNCLR);
-               }
-
-               au1x_ic_settype(irq_nr, map[count].im_type);
-       }
-}
-
-void __init arch_init_irq(void)
-{
        int i;
 
        /*
@@ -585,7 +561,7 @@ void __init arch_init_irq(void)
        au_writel(0xffffffff, IC0_CFG1CLR);
        au_writel(0xffffffff, IC0_CFG2CLR);
        au_writel(0xffffffff, IC0_MASKCLR);
-       au_writel(0xffffffff, IC0_ASSIGNSET);
+       au_writel(0xffffffff, IC0_ASSIGNCLR);
        au_writel(0xffffffff, IC0_WAKECLR);
        au_writel(0xffffffff, IC0_SRCSET);
        au_writel(0xffffffff, IC0_FALLINGCLR);
@@ -596,7 +572,7 @@ void __init arch_init_irq(void)
        au_writel(0xffffffff, IC1_CFG1CLR);
        au_writel(0xffffffff, IC1_CFG2CLR);
        au_writel(0xffffffff, IC1_MASKCLR);
-       au_writel(0xffffffff, IC1_ASSIGNSET);
+       au_writel(0xffffffff, IC1_ASSIGNCLR);
        au_writel(0xffffffff, IC1_WAKECLR);
        au_writel(0xffffffff, IC1_SRCSET);
        au_writel(0xffffffff, IC1_FALLINGCLR);
@@ -619,11 +595,43 @@ void __init arch_init_irq(void)
        /*
         * Initialize IC0, which is fixed per processor.
         */
-       au1xxx_setup_irqmap(au1xxx_ic0_map, ARRAY_SIZE(au1xxx_ic0_map));
+       while (map->im_irq != -1) {
+               irq_nr = map->im_irq;
 
-       /* Boards can register additional (GPIO-based) IRQs.
-       */
-       board_init_irq();
+               if (irq_nr >= AU1000_INTC1_INT_BASE) {
+                       bit = irq_nr - AU1000_INTC1_INT_BASE;
+                       if (map->im_request)
+                               au_writel(1 << bit, IC1_ASSIGNSET);
+               } else {
+                       bit = irq_nr - AU1000_INTC0_INT_BASE;
+                       if (map->im_request)
+                               au_writel(1 << bit, IC0_ASSIGNSET);
+               }
+
+               au1x_ic_settype(irq_nr, map->im_type);
+               ++map;
+       }
 
        set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3);
 }
+
+void __init arch_init_irq(void)
+{
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1000:
+               au1000_init_irq(au1000_irqmap);
+               break;
+       case ALCHEMY_CPU_AU1500:
+               au1000_init_irq(au1500_irqmap);
+               break;
+       case ALCHEMY_CPU_AU1100:
+               au1000_init_irq(au1100_irqmap);
+               break;
+       case ALCHEMY_CPU_AU1550:
+               au1000_init_irq(au1550_irqmap);
+               break;
+       case ALCHEMY_CPU_AU1200:
+               au1000_init_irq(au1200_irqmap);
+               break;
+       }
+}
index 117f99f70649547f137a4442021444b2e8ef73fd..2580e77624d2072b4637b28eb32f5deb5053c1c0 100644 (file)
 #include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1xxx_dbdma.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
-
-#define PORT(_base, _irq)                              \
-       {                                               \
-               .iobase         = _base,                \
-               .membase        = (void __iomem *)_base,\
-               .mapbase        = CPHYSADDR(_base),     \
-               .irq            = _irq,                 \
-               .regshift       = 2,                    \
-               .iotype         = UPIO_AU,              \
-               .flags          = UPF_SKIP_TEST         \
+#include <asm/mach-au1x00/au1xxx_eth.h>
+
+#define PORT(_base, _irq)                                      \
+       {                                                       \
+               .mapbase        = _base,                        \
+               .irq            = _irq,                         \
+               .regshift       = 2,                            \
+               .iotype         = UPIO_AU,                      \
+               .flags          = UPF_SKIP_TEST | UPF_IOREMAP | \
+                                 UPF_FIXED_TYPE,               \
+               .type           = PORT_16550A,                  \
        }
 
 static struct plat_serial8250_port au1x00_uart_data[] = {
 #if defined(CONFIG_SERIAL_8250_AU1X00)
 #if defined(CONFIG_SOC_AU1000)
-       PORT(UART0_ADDR, AU1000_UART0_INT),
-       PORT(UART1_ADDR, AU1000_UART1_INT),
-       PORT(UART2_ADDR, AU1000_UART2_INT),
-       PORT(UART3_ADDR, AU1000_UART3_INT),
+       PORT(UART0_PHYS_ADDR, AU1000_UART0_INT),
+       PORT(UART1_PHYS_ADDR, AU1000_UART1_INT),
+       PORT(UART2_PHYS_ADDR, AU1000_UART2_INT),
+       PORT(UART3_PHYS_ADDR, AU1000_UART3_INT),
 #elif defined(CONFIG_SOC_AU1500)
-       PORT(UART0_ADDR, AU1500_UART0_INT),
-       PORT(UART3_ADDR, AU1500_UART3_INT),
+       PORT(UART0_PHYS_ADDR, AU1500_UART0_INT),
+       PORT(UART3_PHYS_ADDR, AU1500_UART3_INT),
 #elif defined(CONFIG_SOC_AU1100)
-       PORT(UART0_ADDR, AU1100_UART0_INT),
-       PORT(UART1_ADDR, AU1100_UART1_INT),
-       PORT(UART3_ADDR, AU1100_UART3_INT),
+       PORT(UART0_PHYS_ADDR, AU1100_UART0_INT),
+       PORT(UART1_PHYS_ADDR, AU1100_UART1_INT),
+       PORT(UART3_PHYS_ADDR, AU1100_UART3_INT),
 #elif defined(CONFIG_SOC_AU1550)
-       PORT(UART0_ADDR, AU1550_UART0_INT),
-       PORT(UART1_ADDR, AU1550_UART1_INT),
-       PORT(UART3_ADDR, AU1550_UART3_INT),
+       PORT(UART0_PHYS_ADDR, AU1550_UART0_INT),
+       PORT(UART1_PHYS_ADDR, AU1550_UART1_INT),
+       PORT(UART3_PHYS_ADDR, AU1550_UART3_INT),
 #elif defined(CONFIG_SOC_AU1200)
-       PORT(UART0_ADDR, AU1200_UART0_INT),
-       PORT(UART1_ADDR, AU1200_UART1_INT),
+       PORT(UART0_PHYS_ADDR, AU1200_UART0_INT),
+       PORT(UART1_PHYS_ADDR, AU1200_UART1_INT),
 #endif
 #endif /* CONFIG_SERIAL_8250_AU1X00 */
        { },
@@ -73,8 +74,8 @@ static struct resource au1xxx_usb_ohci_resources[] = {
                .flags          = IORESOURCE_MEM,
        },
        [1] = {
-               .start          = AU1000_USB_HOST_INT,
-               .end            = AU1000_USB_HOST_INT,
+               .start          = FOR_PLATFORM_C_USB_HOST_INT,
+               .end            = FOR_PLATFORM_C_USB_HOST_INT,
                .flags          = IORESOURCE_IRQ,
        },
 };
@@ -132,8 +133,8 @@ static struct resource au1xxx_usb_ehci_resources[] = {
                .flags          = IORESOURCE_MEM,
        },
        [1] = {
-               .start          = AU1000_USB_HOST_INT,
-               .end            = AU1000_USB_HOST_INT,
+               .start          = AU1200_USB_INT,
+               .end            = AU1200_USB_INT,
                .flags          = IORESOURCE_IRQ,
        },
 };
@@ -308,11 +309,6 @@ static struct platform_device au1200_mmc1_device = {
 #endif /* #ifndef CONFIG_MIPS_DB1200 */
 #endif /* #ifdef CONFIG_SOC_AU1200 */
 
-static struct platform_device au1x00_pcmcia_device = {
-       .name           = "au1x00-pcmcia",
-       .id             = 0,
-};
-
 /* All Alchemy demoboards with I2C have this #define in their headers */
 #ifdef SMBUS_PSC_BASE
 static struct resource pbdb_smbus_resources[] = {
@@ -331,10 +327,92 @@ static struct platform_device pbdb_smbus_device = {
 };
 #endif
 
+/* Macro to help defining the Ethernet MAC resources */
+#define MAC_RES(_base, _enable, _irq)                  \
+       {                                               \
+               .start  = CPHYSADDR(_base),             \
+               .end    = CPHYSADDR(_base + 0xffff),    \
+               .flags  = IORESOURCE_MEM,               \
+       },                                              \
+       {                                               \
+               .start  = CPHYSADDR(_enable),           \
+               .end    = CPHYSADDR(_enable + 0x3),     \
+               .flags  = IORESOURCE_MEM,               \
+       },                                              \
+       {                                               \
+               .start  = _irq,                         \
+               .end    = _irq,                         \
+               .flags  = IORESOURCE_IRQ                \
+       }
+
+static struct resource au1xxx_eth0_resources[] = {
+#if defined(CONFIG_SOC_AU1000)
+       MAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT),
+#elif defined(CONFIG_SOC_AU1100)
+       MAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT),
+#elif defined(CONFIG_SOC_AU1550)
+       MAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT),
+#elif defined(CONFIG_SOC_AU1500)
+       MAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT),
+#endif
+};
+
+
+static struct au1000_eth_platform_data au1xxx_eth0_platform_data = {
+       .phy1_search_mac0 = 1,
+};
+
+static struct platform_device au1xxx_eth0_device = {
+       .name           = "au1000-eth",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(au1xxx_eth0_resources),
+       .resource       = au1xxx_eth0_resources,
+       .dev.platform_data = &au1xxx_eth0_platform_data,
+};
+
+#ifndef CONFIG_SOC_AU1100
+static struct resource au1xxx_eth1_resources[] = {
+#if defined(CONFIG_SOC_AU1000)
+       MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT),
+#elif defined(CONFIG_SOC_AU1550)
+       MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT),
+#elif defined(CONFIG_SOC_AU1500)
+       MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT),
+#endif
+};
+
+static struct au1000_eth_platform_data au1xxx_eth1_platform_data = {
+       .phy1_search_mac0 = 1,
+};
+
+static struct platform_device au1xxx_eth1_device = {
+       .name           = "au1000-eth",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(au1xxx_eth1_resources),
+       .resource       = au1xxx_eth1_resources,
+       .dev.platform_data = &au1xxx_eth1_platform_data,
+};
+#endif
+
+void __init au1xxx_override_eth_cfg(unsigned int port,
+                       struct au1000_eth_platform_data *eth_data)
+{
+       if (!eth_data || port > 1)
+               return;
+
+       if (port == 0)
+               memcpy(&au1xxx_eth0_platform_data, eth_data,
+                       sizeof(struct au1000_eth_platform_data));
+#ifndef CONFIG_SOC_AU1100
+       else
+               memcpy(&au1xxx_eth1_platform_data, eth_data,
+                       sizeof(struct au1000_eth_platform_data));
+#endif
+}
+
 static struct platform_device *au1xxx_platform_devices[] __initdata = {
        &au1xx0_uart_device,
        &au1xxx_usb_ohci_device,
-       &au1x00_pcmcia_device,
 #ifdef CONFIG_FB_AU1100
        &au1100_lcd_device,
 #endif
@@ -351,6 +429,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
 #ifdef SMBUS_PSC_BASE
        &pbdb_smbus_device,
 #endif
+       &au1xxx_eth0_device,
 };
 
 static int __init au1xxx_platform_init(void)
@@ -362,6 +441,12 @@ static int __init au1xxx_platform_init(void)
        for (i = 0; au1x00_uart_data[i].flags; i++)
                au1x00_uart_data[i].uartclk = uartclk;
 
+#ifndef CONFIG_SOC_AU1100
+       /* Register second MAC if enabled in pinfunc */
+       if (!(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2))
+               platform_device_register(&au1xxx_eth1_device);
+#endif
+
        return platform_add_devices(au1xxx_platform_devices,
                                    ARRAY_SIZE(au1xxx_platform_devices));
 }
index 18b310b475ca28195904f653637aedbd9bb57d7c..c29511b11d44fd6732b0dd153d009dbd7051555d 100644 (file)
@@ -43,29 +43,15 @@ int prom_argc;
 char **prom_argv;
 char **prom_envp;
 
-char * __init_or_module prom_getcmdline(void)
-{
-       return &(arcs_cmdline[0]);
-}
-
 void prom_init_cmdline(void)
 {
-       char *cp;
-       int actr;
-
-       actr = 1; /* Always ignore argv[0] */
+       int i;
 
-       cp = &(arcs_cmdline[0]);
-       while (actr < prom_argc) {
-               strcpy(cp, prom_argv[actr]);
-               cp += strlen(prom_argv[actr]);
-               *cp++ = ' ';
-               actr++;
+       for (i = 1; i < prom_argc; i++) {
+               strlcat(arcs_cmdline, prom_argv[i], COMMAND_LINE_SIZE);
+               if (i < (prom_argc - 1))
+                       strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
        }
-       if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
-               --cp;
-       if (prom_argc > 1)
-               *cp = '\0';
 }
 
 char *prom_getenv(char *envname)
@@ -121,14 +107,12 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
 int prom_get_ethernet_addr(char *ethernet_addr)
 {
        char *ethaddr_str;
-       char *argptr;
 
        /* Check the environment variables first */
        ethaddr_str = prom_getenv("ethaddr");
        if (!ethaddr_str) {
                /* Check command line */
-               argptr = prom_getcmdline();
-               ethaddr_str = strstr(argptr, "ethaddr=");
+               ethaddr_str = strstr(arcs_cmdline, "ethaddr=");
                if (!ethaddr_str)
                        return -1;
 
diff --git a/arch/mips/alchemy/common/puts.c b/arch/mips/alchemy/common/puts.c
deleted file mode 100644 (file)
index 55bbe24..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * BRIEF MODULE DESCRIPTION
- *     Low level UART routines to directly access Alchemy UART.
- *
- * Copyright 2001, 2008 MontaVista Software Inc.
- * Author: MontaVista Software, Inc. <source@mvista.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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <asm/mach-au1x00/au1000.h>
-
-#define SERIAL_BASE   UART_BASE
-#define SER_CMD       0x7
-#define SER_DATA      0x1
-#define TX_BUSY       0x20
-
-#define TIMEOUT       0xffffff
-#define SLOW_DOWN
-
-static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE;
-
-#ifdef SLOW_DOWN
-static inline void slow_down(void)
-{
-       int k;
-
-       for (k = 0; k < 10000; k++);
-}
-#else
-#define slow_down()
-#endif
-
-void
-prom_putchar(const unsigned char c)
-{
-       unsigned char ch;
-       int i = 0;
-
-       do {
-               ch = com1[SER_CMD];
-               slow_down();
-               i++;
-               if (i > TIMEOUT)
-                       break;
-       } while (0 == (ch & TX_BUSY));
-
-       com1[SER_DATA] = c;
-}
diff --git a/arch/mips/alchemy/common/reset.c b/arch/mips/alchemy/common/reset.c
deleted file mode 100644 (file)
index 4791011..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *
- * BRIEF MODULE DESCRIPTION
- *     Au1xx0 reset routines.
- *
- * Copyright 2001, 2006, 2008 MontaVista Software Inc.
- * Author: MontaVista Software, Inc. <source@mvista.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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/gpio.h>
-
-#include <asm/cacheflush.h>
-#include <asm/mach-au1x00/au1000.h>
-
-void au1000_restart(char *command)
-{
-       /* Set all integrated peripherals to disabled states */
-       extern void board_reset(void);
-       u32 prid = read_c0_prid();
-
-       printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
-
-       switch (prid & 0xFF000000) {
-       case 0x00000000: /* Au1000 */
-               au_writel(0x02, 0xb0000010); /* ac97_enable */
-               au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-               asm("sync");
-               au_writel(0x00, 0xb017fffc); /* usbh_enable */
-               au_writel(0x00, 0xb0200058); /* usbd_enable */
-               au_writel(0x00, 0xb0300040); /* ir_enable */
-               au_writel(0x00, 0xb4004104); /* mac dma */
-               au_writel(0x00, 0xb4004114); /* mac dma */
-               au_writel(0x00, 0xb4004124); /* mac dma */
-               au_writel(0x00, 0xb4004134); /* mac dma */
-               au_writel(0x00, 0xb0520000); /* macen0 */
-               au_writel(0x00, 0xb0520004); /* macen1 */
-               au_writel(0x00, 0xb1000008); /* i2s_enable  */
-               au_writel(0x00, 0xb1100100); /* uart0_enable */
-               au_writel(0x00, 0xb1200100); /* uart1_enable */
-               au_writel(0x00, 0xb1300100); /* uart2_enable */
-               au_writel(0x00, 0xb1400100); /* uart3_enable */
-               au_writel(0x02, 0xb1600100); /* ssi0_enable */
-               au_writel(0x02, 0xb1680100); /* ssi1_enable */
-               au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-               au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-               au_writel(0x00, 0xb1900028); /* sys_clksrc */
-               au_writel(0x10, 0xb1900060); /* sys_cpupll */
-               au_writel(0x00, 0xb1900064); /* sys_auxpll */
-               au_writel(0x00, 0xb1900100); /* sys_pininputen */
-               break;
-       case 0x01000000: /* Au1500 */
-               au_writel(0x02, 0xb0000010); /* ac97_enable */
-               au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-               asm("sync");
-               au_writel(0x00, 0xb017fffc); /* usbh_enable */
-               au_writel(0x00, 0xb0200058); /* usbd_enable */
-               au_writel(0x00, 0xb4004104); /* mac dma */
-               au_writel(0x00, 0xb4004114); /* mac dma */
-               au_writel(0x00, 0xb4004124); /* mac dma */
-               au_writel(0x00, 0xb4004134); /* mac dma */
-               au_writel(0x00, 0xb1520000); /* macen0 */
-               au_writel(0x00, 0xb1520004); /* macen1 */
-               au_writel(0x00, 0xb1100100); /* uart0_enable */
-               au_writel(0x00, 0xb1400100); /* uart3_enable */
-               au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-               au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-               au_writel(0x00, 0xb1900028); /* sys_clksrc */
-               au_writel(0x10, 0xb1900060); /* sys_cpupll */
-               au_writel(0x00, 0xb1900064); /* sys_auxpll */
-               au_writel(0x00, 0xb1900100); /* sys_pininputen */
-               break;
-       case 0x02000000: /* Au1100 */
-               au_writel(0x02, 0xb0000010); /* ac97_enable */
-               au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
-               asm("sync");
-               au_writel(0x00, 0xb017fffc); /* usbh_enable */
-               au_writel(0x00, 0xb0200058); /* usbd_enable */
-               au_writel(0x00, 0xb0300040); /* ir_enable */
-               au_writel(0x00, 0xb4004104); /* mac dma */
-               au_writel(0x00, 0xb4004114); /* mac dma */
-               au_writel(0x00, 0xb4004124); /* mac dma */
-               au_writel(0x00, 0xb4004134); /* mac dma */
-               au_writel(0x00, 0xb0520000); /* macen0 */
-               au_writel(0x00, 0xb1000008); /* i2s_enable  */
-               au_writel(0x00, 0xb1100100); /* uart0_enable */
-               au_writel(0x00, 0xb1200100); /* uart1_enable */
-               au_writel(0x00, 0xb1400100); /* uart3_enable */
-               au_writel(0x02, 0xb1600100); /* ssi0_enable */
-               au_writel(0x02, 0xb1680100); /* ssi1_enable */
-               au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-               au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-               au_writel(0x00, 0xb1900028); /* sys_clksrc */
-               au_writel(0x10, 0xb1900060); /* sys_cpupll */
-               au_writel(0x00, 0xb1900064); /* sys_auxpll */
-               au_writel(0x00, 0xb1900100); /* sys_pininputen */
-               break;
-       case 0x03000000: /* Au1550 */
-               au_writel(0x00, 0xb1a00004); /* psc 0 */
-               au_writel(0x00, 0xb1b00004); /* psc 1 */
-               au_writel(0x00, 0xb0a00004); /* psc 2 */
-               au_writel(0x00, 0xb0b00004); /* psc 3 */
-               au_writel(0x00, 0xb017fffc); /* usbh_enable */
-               au_writel(0x00, 0xb0200058); /* usbd_enable */
-               au_writel(0x00, 0xb4004104); /* mac dma */
-               au_writel(0x00, 0xb4004114); /* mac dma */
-               au_writel(0x00, 0xb4004124); /* mac dma */
-               au_writel(0x00, 0xb4004134); /* mac dma */
-               au_writel(0x00, 0xb1520000); /* macen0 */
-               au_writel(0x00, 0xb1520004); /* macen1 */
-               au_writel(0x00, 0xb1100100); /* uart0_enable */
-               au_writel(0x00, 0xb1200100); /* uart1_enable */
-               au_writel(0x00, 0xb1400100); /* uart3_enable */
-               au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
-               au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
-               au_writel(0x00, 0xb1900028); /* sys_clksrc */
-               au_writel(0x10, 0xb1900060); /* sys_cpupll */
-               au_writel(0x00, 0xb1900064); /* sys_auxpll */
-               au_writel(0x00, 0xb1900100); /* sys_pininputen */
-               break;
-       }
-
-       set_c0_status(ST0_BEV | ST0_ERL);
-       change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
-       flush_cache_all();
-       write_c0_wired(0);
-
-       /* Give board a chance to do a hardware reset */
-       board_reset();
-
-       /* Jump to the beggining in case board_reset() is empty */
-       __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
-}
-
-void au1000_halt(void)
-{
-#if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
-       /* Power off system */
-       printk(KERN_NOTICE "\n** Powering off...\n");
-       au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C);
-       au_sync();
-       while (1); /* should not get here */
-#else
-       printk(KERN_NOTICE "\n** You can safely turn off the power\n");
-#ifdef CONFIG_MIPS_MIRAGE
-       gpio_direction_output(210, 1);
-#endif
-#ifdef CONFIG_MIPS_DB1200
-       au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
-#endif
-#ifdef CONFIG_PM
-       au_sleep();
-
-       /* Should not get here */
-       printk(KERN_ERR "Unable to put CPU in sleep mode\n");
-       while (1);
-#else
-       while (1)
-               __asm__(".set\tmips3\n\t"
-                       "wait\n\t"
-                       ".set\tmips0");
-#endif
-#endif /* defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) */
-}
-
-void au1000_power_off(void)
-{
-       au1000_halt();
-}
index 6184baa56786703af2ef195cf9ee77318cace225..561e5da2658b36f999c6da9bc8377c9f0b203289 100644 (file)
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
-#include <linux/pm.h>
 
 #include <asm/mipsregs.h>
-#include <asm/reboot.h>
 #include <asm/time.h>
 
 #include <au1000.h>
 
 extern void __init board_setup(void);
-extern void au1000_restart(char *);
-extern void au1000_halt(void);
-extern void au1000_power_off(void);
 extern void set_cpuspec(void);
 
 void __init plat_mem_setup(void)
@@ -57,10 +52,6 @@ void __init plat_mem_setup(void)
        /* this is faster than wasting cycles trying to approximate it */
        preset_lpj = (est_freq >> 1) / HZ;
 
-       _machine_restart = au1000_restart;
-       _machine_halt = au1000_halt;
-       pm_power_off = au1000_power_off;
-
        board_setup();  /* board specific setup */
 
        if (au1xxx_cpu_needs_config_od())
@@ -78,37 +69,20 @@ void __init plat_mem_setup(void)
        iomem_resource.end = IOMEM_RESOURCE_END;
 }
 
-#if defined(CONFIG_64BIT_PHYS_ADDR)
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_PCI)
 /* This routine should be valid for all Au1x based boards */
 phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
 {
+       u32 start = (u32)Au1500_PCI_MEM_START;
+       u32 end   = (u32)Au1500_PCI_MEM_END;
+
        /* Don't fixup 36-bit addresses */
        if ((phys_addr >> 32) != 0)
                return phys_addr;
 
-#ifdef CONFIG_PCI
-       {
-               u32 start = (u32)Au1500_PCI_MEM_START;
-               u32 end   = (u32)Au1500_PCI_MEM_END;
-
-               /* Check for PCI memory window */
-               if (phys_addr >= start && (phys_addr + size - 1) <= end)
-                       return (phys_t)
-                              ((phys_addr - start) + Au1500_PCI_MEM_START);
-       }
-#endif
-
-       /*
-        * All Au1xx0 SOCs have a PCMCIA controller.
-        * We setup our 32-bit pseudo addresses to be equal to the
-        * 36-bit addr >> 4, to make it easier to check the address
-        * and fix it.
-        * The PCMCIA socket 0 physical attribute address is 0xF 4000 0000.
-        * The pseudo address we use is 0xF400 0000. Any address over
-        * 0xF400 0000 is a PCMCIA pseudo address.
-        */
-       if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF))
-               return (phys_t)(phys_addr << 4);
+       /* Check for PCI memory window */
+       if (phys_addr >= start && (phys_addr + size - 1) <= end)
+               return (phys_t)((phys_addr - start) + Au1500_PCI_MEM_START);
 
        /* default nop */
        return phys_addr;
index 379a664809b0189458f96706b7cc84b157d70625..2aecb2fdf9827a6d3849916056a4661d14d93cfc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Manuel Lauss <mano@roarinelk.homelinux.net>
+ * Copyright (C) 2008-2009 Manuel Lauss <manuel.lauss@gmail.com>
  *
  * Previous incarnations were:
  * Copyright (C) 2001, 2006, 2008 MontaVista Software, <source@mvista.com>
@@ -85,7 +85,6 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = {
        .name           = "rtcmatch2",
        .features       = CLOCK_EVT_FEAT_ONESHOT,
        .rating         = 100,
-       .irq            = AU1000_RTC_MATCH2_INT,
        .set_next_event = au1x_rtcmatch2_set_next_event,
        .set_mode       = au1x_rtcmatch2_set_mode,
        .cpumask        = cpu_all_mask,
@@ -98,11 +97,13 @@ static struct irqaction au1x_rtcmatch2_irqaction = {
        .dev_id         = &au1x_rtcmatch2_clockdev,
 };
 
-void __init plat_time_init(void)
+static int __init alchemy_time_init(unsigned int m2int)
 {
        struct clock_event_device *cd = &au1x_rtcmatch2_clockdev;
        unsigned long t;
 
+       au1x_rtcmatch2_clockdev.irq = m2int;
+
        /* Check if firmware (YAMON, ...) has enabled 32kHz and clock
         * has been detected.  If so install the rtcmatch2 clocksource,
         * otherwise don't bother.  Note that both bits being set is by
@@ -148,13 +149,18 @@ void __init plat_time_init(void)
        cd->max_delta_ns = clockevent_delta2ns(0xffffffff, cd);
        cd->min_delta_ns = clockevent_delta2ns(8, cd);  /* ~0.25ms */
        clockevents_register_device(cd);
-       setup_irq(AU1000_RTC_MATCH2_INT, &au1x_rtcmatch2_irqaction);
+       setup_irq(m2int, &au1x_rtcmatch2_irqaction);
 
        printk(KERN_INFO "Alchemy clocksource installed\n");
 
-       return;
+       return 0;
 
 cntr_err:
+       return -1;
+}
+
+static void __init alchemy_setup_c0timer(void)
+{
        /*
         * MIPS kernel assigns 'au1k_wait' to 'cpu_wait' before this
         * function is called.  Because the Alchemy counters are unusable
@@ -166,3 +172,22 @@ cntr_err:
        r4k_clockevent_init();
        init_r4k_clocksource();
 }
+
+static int alchemy_m2inttab[] __initdata = {
+       AU1000_RTC_MATCH2_INT,
+       AU1500_RTC_MATCH2_INT,
+       AU1100_RTC_MATCH2_INT,
+       AU1550_RTC_MATCH2_INT,
+       AU1200_RTC_MATCH2_INT,
+};
+
+void __init plat_time_init(void)
+{
+       int t;
+
+       t = alchemy_get_cputype();
+       if (t == ALCHEMY_CPU_UNKNOWN)
+               alchemy_setup_c0timer();
+       else if (alchemy_time_init(alchemy_m2inttab[t]))
+               alchemy_setup_c0timer();
+}
index 730f9f2b30e81afbd4531f7dabdacd56239fa5ab..ecbd37f9ee873f77b37d52d11d1532c67cb80afa 100644 (file)
@@ -2,7 +2,7 @@
 # Alchemy Develboards
 #
 
-obj-y += prom.o
+obj-y += prom.o bcsr.o platform.o
 obj-$(CONFIG_PM)               += pm.o
 obj-$(CONFIG_MIPS_PB1000)      += pb1000/
 obj-$(CONFIG_MIPS_PB1100)      += pb1100/
@@ -11,8 +11,10 @@ obj-$(CONFIG_MIPS_PB1500)    += pb1500/
 obj-$(CONFIG_MIPS_PB1550)      += pb1550/
 obj-$(CONFIG_MIPS_DB1000)      += db1x00/
 obj-$(CONFIG_MIPS_DB1100)      += db1x00/
-obj-$(CONFIG_MIPS_DB1200)      += pb1200/
+obj-$(CONFIG_MIPS_DB1200)      += db1200/
 obj-$(CONFIG_MIPS_DB1500)      += db1x00/
 obj-$(CONFIG_MIPS_DB1550)      += db1x00/
 obj-$(CONFIG_MIPS_BOSPORUS)    += db1x00/
 obj-$(CONFIG_MIPS_MIRAGE)      += db1x00/
+
+EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboards/bcsr.c
new file mode 100644 (file)
index 0000000..3bc4fd2
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * bcsr.h -- Db1xxx/Pb1xxx Devboard CPLD registers ("BCSR") abstraction.
+ *
+ * All Alchemy development boards (except, of course, the weird PB1000)
+ * have a few registers in a CPLD with standardised layout; they mostly
+ * only differ in base address.
+ * All registers are 16bits wide with 32bit spacing.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <asm/addrspace.h>
+#include <asm/io.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+static struct bcsr_reg {
+       void __iomem *raddr;
+       spinlock_t lock;
+} bcsr_regs[BCSR_CNT];
+
+static void __iomem *bcsr_virt;        /* KSEG1 addr of BCSR base */
+static int bcsr_csc_base;      /* linux-irq of first cascaded irq */
+
+void __init bcsr_init(unsigned long bcsr1_phys, unsigned long bcsr2_phys)
+{
+       int i;
+
+       bcsr1_phys = KSEG1ADDR(CPHYSADDR(bcsr1_phys));
+       bcsr2_phys = KSEG1ADDR(CPHYSADDR(bcsr2_phys));
+
+       bcsr_virt = (void __iomem *)bcsr1_phys;
+
+       for (i = 0; i < BCSR_CNT; i++) {
+               if (i >= BCSR_HEXLEDS)
+                       bcsr_regs[i].raddr = (void __iomem *)bcsr2_phys +
+                                       (0x04 * (i - BCSR_HEXLEDS));
+               else
+                       bcsr_regs[i].raddr = (void __iomem *)bcsr1_phys +
+                                       (0x04 * i);
+
+               spin_lock_init(&bcsr_regs[i].lock);
+       }
+}
+
+unsigned short bcsr_read(enum bcsr_id reg)
+{
+       unsigned short r;
+       unsigned long flags;
+
+       spin_lock_irqsave(&bcsr_regs[reg].lock, flags);
+       r = __raw_readw(bcsr_regs[reg].raddr);
+       spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags);
+       return r;
+}
+EXPORT_SYMBOL_GPL(bcsr_read);
+
+void bcsr_write(enum bcsr_id reg, unsigned short val)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&bcsr_regs[reg].lock, flags);
+       __raw_writew(val, bcsr_regs[reg].raddr);
+       wmb();
+       spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags);
+}
+EXPORT_SYMBOL_GPL(bcsr_write);
+
+void bcsr_mod(enum bcsr_id reg, unsigned short clr, unsigned short set)
+{
+       unsigned short r;
+       unsigned long flags;
+
+       spin_lock_irqsave(&bcsr_regs[reg].lock, flags);
+       r = __raw_readw(bcsr_regs[reg].raddr);
+       r &= ~clr;
+       r |= set;
+       __raw_writew(r, bcsr_regs[reg].raddr);
+       wmb();
+       spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags);
+}
+EXPORT_SYMBOL_GPL(bcsr_mod);
+
+/*
+ * DB1200/PB1200 CPLD IRQ muxer
+ */
+static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d)
+{
+       unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT);
+
+       for ( ; bisr; bisr &= bisr - 1)
+               generic_handle_irq(bcsr_csc_base + __ffs(bisr));
+}
+
+/* NOTE: both the enable and mask bits must be cleared, otherwise the
+ * CPLD generates tons of spurious interrupts (at least on my DB1200).
+ *     -- mlau
+ */
+static void bcsr_irq_mask(unsigned int irq_nr)
+{
+       unsigned short v = 1 << (irq_nr - bcsr_csc_base);
+       __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR);
+       __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR);
+       wmb();
+}
+
+static void bcsr_irq_maskack(unsigned int irq_nr)
+{
+       unsigned short v = 1 << (irq_nr - bcsr_csc_base);
+       __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR);
+       __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR);
+       __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT);  /* ack */
+       wmb();
+}
+
+static void bcsr_irq_unmask(unsigned int irq_nr)
+{
+       unsigned short v = 1 << (irq_nr - bcsr_csc_base);
+       __raw_writew(v, bcsr_virt + BCSR_REG_INTSET);
+       __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET);
+       wmb();
+}
+
+static struct irq_chip bcsr_irq_type = {
+       .name           = "CPLD",
+       .mask           = bcsr_irq_mask,
+       .mask_ack       = bcsr_irq_maskack,
+       .unmask         = bcsr_irq_unmask,
+};
+
+void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq)
+{
+       unsigned int irq;
+
+       /* mask & disable & ack all */
+       __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTCLR);
+       __raw_writew(0xffff, bcsr_virt + BCSR_REG_MASKCLR);
+       __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTSTAT);
+       wmb();
+
+       bcsr_csc_base = csc_start;
+
+       for (irq = csc_start; irq <= csc_end; irq++)
+               set_irq_chip_and_handler_name(irq, &bcsr_irq_type,
+                       handle_level_irq, "level");
+
+       set_irq_chained_handler(hook_irq, bcsr_csc_handler);
+}
diff --git a/arch/mips/alchemy/devboards/db1200/Makefile b/arch/mips/alchemy/devboards/db1200/Makefile
new file mode 100644 (file)
index 0000000..17840a5
--- /dev/null
@@ -0,0 +1 @@
+obj-y += setup.o platform.o
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
new file mode 100644 (file)
index 0000000..3cb95a9
--- /dev/null
@@ -0,0 +1,561 @@
+/*
+ * DBAu1200 board platform device registration
+ *
+ * Copyright (C) 2008-2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/dma-mapping.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/leds.h>
+#include <linux/mmc/host.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/platform_device.h>
+#include <linux/serial_8250.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/smc91x.h>
+
+#include <asm/mach-au1x00/au1100_mmc.h>
+#include <asm/mach-au1x00/au1xxx_dbdma.h>
+#include <asm/mach-au1x00/au1550_spi.h>
+#include <asm/mach-db1x00/bcsr.h>
+#include <asm/mach-db1x00/db1200.h>
+
+#include "../platform.h"
+
+static struct mtd_partition db1200_spiflash_parts[] = {
+       {
+               .name   = "DB1200 SPI flash",
+               .offset = 0,
+               .size   = MTDPART_SIZ_FULL,
+       },
+};
+
+static struct flash_platform_data db1200_spiflash_data = {
+       .name           = "s25fl001",
+       .parts          = db1200_spiflash_parts,
+       .nr_parts       = ARRAY_SIZE(db1200_spiflash_parts),
+       .type           = "m25p10",
+};
+
+static struct spi_board_info db1200_spi_devs[] __initdata = {
+       {
+               /* TI TMP121AIDBVR temp sensor */
+               .modalias       = "tmp121",
+               .max_speed_hz   = 2000000,
+               .bus_num        = 0,
+               .chip_select    = 0,
+               .mode           = 0,
+       },
+       {
+               /* Spansion S25FL001D0FMA SPI flash */
+               .modalias       = "m25p80",
+               .max_speed_hz   = 50000000,
+               .bus_num        = 0,
+               .chip_select    = 1,
+               .mode           = 0,
+               .platform_data  = &db1200_spiflash_data,
+       },
+};
+
+static struct i2c_board_info db1200_i2c_devs[] __initdata = {
+       {
+               /* AT24C04-10 I2C eeprom */
+               I2C_BOARD_INFO("24c04", 0x52),
+       },
+       {
+               /* Philips NE1619 temp/voltage sensor (adm1025 drv) */
+               I2C_BOARD_INFO("ne1619", 0x2d),
+       },
+       {
+               /* I2S audio codec WM8731 */
+               I2C_BOARD_INFO("wm8731", 0x1b),
+       },
+};
+
+/**********************************************************************/
+
+static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
+                                unsigned int ctrl)
+{
+       struct nand_chip *this = mtd->priv;
+       unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
+
+       ioaddr &= 0xffffff00;
+
+       if (ctrl & NAND_CLE) {
+               ioaddr += MEM_STNAND_CMD;
+       } else if (ctrl & NAND_ALE) {
+               ioaddr += MEM_STNAND_ADDR;
+       } else {
+               /* assume we want to r/w real data  by default */
+               ioaddr += MEM_STNAND_DATA;
+       }
+       this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
+       if (cmd != NAND_CMD_NONE) {
+               __raw_writeb(cmd, this->IO_ADDR_W);
+               wmb();
+       }
+}
+
+static int au1200_nand_device_ready(struct mtd_info *mtd)
+{
+       return __raw_readl((void __iomem *)MEM_STSTAT) & 1;
+}
+
+static const char *db1200_part_probes[] = { "cmdlinepart", NULL };
+
+static struct mtd_partition db1200_nand_parts[] = {
+       {
+               .name   = "NAND FS 0",
+               .offset = 0,
+               .size   = 8 * 1024 * 1024,
+       },
+       {
+               .name   = "NAND FS 1",
+               .offset = MTDPART_OFS_APPEND,
+               .size   = MTDPART_SIZ_FULL
+       },
+};
+
+struct platform_nand_data db1200_nand_platdata = {
+       .chip = {
+               .nr_chips       = 1,
+               .chip_offset    = 0,
+               .nr_partitions  = ARRAY_SIZE(db1200_nand_parts),
+               .partitions     = db1200_nand_parts,
+               .chip_delay     = 20,
+               .part_probe_types = db1200_part_probes,
+       },
+       .ctrl = {
+               .dev_ready      = au1200_nand_device_ready,
+               .cmd_ctrl       = au1200_nand_cmd_ctrl,
+       },
+};
+
+static struct resource db1200_nand_res[] = {
+       [0] = {
+               .start  = DB1200_NAND_PHYS_ADDR,
+               .end    = DB1200_NAND_PHYS_ADDR + 0xff,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device db1200_nand_dev = {
+       .name           = "gen_nand",
+       .num_resources  = ARRAY_SIZE(db1200_nand_res),
+       .resource       = db1200_nand_res,
+       .id             = -1,
+       .dev            = {
+               .platform_data = &db1200_nand_platdata,
+       }
+};
+
+/**********************************************************************/
+
+static struct smc91x_platdata db1200_eth_data = {
+       .flags  = SMC91X_NOWAIT | SMC91X_USE_16BIT,
+       .leda   = RPC_LED_100_10,
+       .ledb   = RPC_LED_TX_RX,
+};
+
+static struct resource db1200_eth_res[] = {
+       [0] = {
+               .start  = DB1200_ETH_PHYS_ADDR,
+               .end    = DB1200_ETH_PHYS_ADDR + 0xf,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = DB1200_ETH_INT,
+               .end    = DB1200_ETH_INT,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device db1200_eth_dev = {
+       .dev    = {
+               .platform_data  = &db1200_eth_data,
+       },
+       .name           = "smc91x",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(db1200_eth_res),
+       .resource       = db1200_eth_res,
+};
+
+/**********************************************************************/
+
+static struct resource db1200_ide_res[] = {
+       [0] = {
+               .start  = DB1200_IDE_PHYS_ADDR,
+               .end    = DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = DB1200_IDE_INT,
+               .end    = DB1200_IDE_INT,
+               .flags  = IORESOURCE_IRQ,
+       }
+};
+
+static u64 ide_dmamask = DMA_32BIT_MASK;
+
+static struct platform_device db1200_ide_dev = {
+       .name           = "au1200-ide",
+       .id             = 0,
+       .dev = {
+               .dma_mask               = &ide_dmamask,
+               .coherent_dma_mask      = DMA_32BIT_MASK,
+       },
+       .num_resources  = ARRAY_SIZE(db1200_ide_res),
+       .resource       = db1200_ide_res,
+};
+
+/**********************************************************************/
+
+static struct platform_device db1200_rtc_dev = {
+       .name   = "rtc-au1xxx",
+       .id     = -1,
+};
+
+/**********************************************************************/
+
+/* SD carddetects:  they're supposed to be edge-triggered, but ack
+ * doesn't seem to work (CPLD Rev 2).  Instead, the screaming one
+ * is disabled and its counterpart enabled.  The 500ms timeout is
+ * because the carddetect isn't debounced in hardware.
+ */
+static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
+{
+       void(*mmc_cd)(struct mmc_host *, unsigned long);
+
+       if (irq == DB1200_SD0_INSERT_INT) {
+               disable_irq_nosync(DB1200_SD0_INSERT_INT);
+               enable_irq(DB1200_SD0_EJECT_INT);
+       } else {
+               disable_irq_nosync(DB1200_SD0_EJECT_INT);
+               enable_irq(DB1200_SD0_INSERT_INT);
+       }
+
+       /* link against CONFIG_MMC=m */
+       mmc_cd = symbol_get(mmc_detect_change);
+       if (mmc_cd) {
+               mmc_cd(ptr, msecs_to_jiffies(500));
+               symbol_put(mmc_detect_change);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static int db1200_mmc_cd_setup(void *mmc_host, int en)
+{
+       int ret;
+
+       if (en) {
+               ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
+                                 IRQF_DISABLED, "sd_insert", mmc_host);
+               if (ret)
+                       goto out;
+
+               ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
+                                 IRQF_DISABLED, "sd_eject", mmc_host);
+               if (ret) {
+                       free_irq(DB1200_SD0_INSERT_INT, mmc_host);
+                       goto out;
+               }
+
+               if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT)
+                       enable_irq(DB1200_SD0_EJECT_INT);
+               else
+                       enable_irq(DB1200_SD0_INSERT_INT);
+
+       } else {
+               free_irq(DB1200_SD0_INSERT_INT, mmc_host);
+               free_irq(DB1200_SD0_EJECT_INT, mmc_host);
+       }
+       ret = 0;
+out:
+       return ret;
+}
+
+static void db1200_mmc_set_power(void *mmc_host, int state)
+{
+       if (state) {
+               bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
+               msleep(400);    /* stabilization time */
+       } else
+               bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
+}
+
+static int db1200_mmc_card_readonly(void *mmc_host)
+{
+       return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
+}
+
+static int db1200_mmc_card_inserted(void *mmc_host)
+{
+       return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
+}
+
+static void db1200_mmcled_set(struct led_classdev *led,
+                             enum led_brightness brightness)
+{
+       if (brightness != LED_OFF)
+               bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
+       else
+               bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
+}
+
+static struct led_classdev db1200_mmc_led = {
+       .brightness_set = db1200_mmcled_set,
+};
+
+/* needed by arch/mips/alchemy/common/platform.c */
+struct au1xmmc_platform_data au1xmmc_platdata[] = {
+       [0] = {
+               .cd_setup       = db1200_mmc_cd_setup,
+               .set_power      = db1200_mmc_set_power,
+               .card_inserted  = db1200_mmc_card_inserted,
+               .card_readonly  = db1200_mmc_card_readonly,
+               .led            = &db1200_mmc_led,
+       },
+};
+
+/**********************************************************************/
+
+static struct resource au1200_psc0_res[] = {
+       [0] = {
+               .start  = PSC0_PHYS_ADDR,
+               .end    = PSC0_PHYS_ADDR + 0x000fffff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = AU1200_PSC0_INT,
+               .end    = AU1200_PSC0_INT,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [2] = {
+               .start  = DSCR_CMD0_PSC0_TX,
+               .end    = DSCR_CMD0_PSC0_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       [3] = {
+               .start  = DSCR_CMD0_PSC0_RX,
+               .end    = DSCR_CMD0_PSC0_RX,
+               .flags  = IORESOURCE_DMA,
+       },
+};
+
+static struct platform_device db1200_i2c_dev = {
+       .name           = "au1xpsc_smbus",
+       .id             = 0,    /* bus number */
+       .num_resources  = ARRAY_SIZE(au1200_psc0_res),
+       .resource       = au1200_psc0_res,
+};
+
+static void db1200_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
+{
+       if (cs)
+               bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_SPISEL);
+       else
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_SPISEL, 0);
+}
+
+static struct au1550_spi_info db1200_spi_platdata = {
+       .mainclk_hz     = 50000000,     /* PSC0 clock */
+       .num_chipselect = 2,
+       .activate_cs    = db1200_spi_cs_en,
+};
+
+static u64 spi_dmamask = DMA_32BIT_MASK;
+
+static struct platform_device db1200_spi_dev = {
+       .dev    = {
+               .dma_mask               = &spi_dmamask,
+               .coherent_dma_mask      = DMA_32BIT_MASK,
+               .platform_data          = &db1200_spi_platdata,
+       },
+       .name           = "au1550-spi",
+       .id             = 0,    /* bus number */
+       .num_resources  = ARRAY_SIZE(au1200_psc0_res),
+       .resource       = au1200_psc0_res,
+};
+
+static struct resource au1200_psc1_res[] = {
+       [0] = {
+               .start  = PSC1_PHYS_ADDR,
+               .end    = PSC1_PHYS_ADDR + 0x000fffff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = AU1200_PSC1_INT,
+               .end    = AU1200_PSC1_INT,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [2] = {
+               .start  = DSCR_CMD0_PSC1_TX,
+               .end    = DSCR_CMD0_PSC1_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       [3] = {
+               .start  = DSCR_CMD0_PSC1_RX,
+               .end    = DSCR_CMD0_PSC1_RX,
+               .flags  = IORESOURCE_DMA,
+       },
+};
+
+static struct platform_device db1200_audio_dev = {
+       /* name assigned later based on switch setting */
+       .id             = 1,    /* PSC ID */
+       .num_resources  = ARRAY_SIZE(au1200_psc1_res),
+       .resource       = au1200_psc1_res,
+};
+
+static struct platform_device *db1200_devs[] __initdata = {
+       NULL,           /* PSC0, selected by S6.8 */
+       &db1200_ide_dev,
+       &db1200_eth_dev,
+       &db1200_rtc_dev,
+       &db1200_nand_dev,
+       &db1200_audio_dev,
+};
+
+static int __init db1200_dev_init(void)
+{
+       unsigned long pfc;
+       unsigned short sw;
+       int swapped;
+
+       i2c_register_board_info(0, db1200_i2c_devs,
+                               ARRAY_SIZE(db1200_i2c_devs));
+       spi_register_board_info(db1200_spi_devs,
+                               ARRAY_SIZE(db1200_i2c_devs));
+
+       /* SWITCHES:    S6.8 I2C/SPI selector  (OFF=I2C  ON=SPI)
+        *              S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
+        */
+
+       /* NOTE: GPIO215 controls OTG VBUS supply.  In SPI mode however
+        * this pin is claimed by PSC0 (unused though, but pinmux doesn't
+        * allow to free it without crippling the SPI interface).
+        * As a result, in SPI mode, OTG simply won't work (PSC0 uses
+        * it as an input pin which is pulled high on the boards).
+        */
+       pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
+
+       /* switch off OTG VBUS supply */
+       gpio_request(215, "otg-vbus");
+       gpio_direction_output(215, 1);
+
+       printk(KERN_INFO "DB1200 device configuration:\n");
+
+       sw = bcsr_read(BCSR_SWITCHES);
+       if (sw & BCSR_SWITCHES_DIP_8) {
+               db1200_devs[0] = &db1200_i2c_dev;
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
+
+               pfc |= (2 << 17);       /* GPIO2 block owns GPIO215 */
+
+               printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n");
+               printk(KERN_INFO "   OTG port VBUS supply available!\n");
+       } else {
+               db1200_devs[0] = &db1200_spi_dev;
+               bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX);
+
+               pfc |= (1 << 17);       /* PSC0 owns GPIO215 */
+
+               printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
+               printk(KERN_INFO "   OTG port VBUS supply disabled\n");
+       }
+       __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
+       wmb();
+
+       /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
+        * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
+        */
+       sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7;
+       if (sw == BCSR_SWITCHES_DIP_8) {
+               bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
+               db1200_audio_dev.name = "au1xpsc_i2s";
+               printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
+       } else {
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
+               db1200_audio_dev.name = "au1xpsc_ac97";
+               printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
+       }
+
+       /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
+       __raw_writel(PSC_SEL_CLK_SERCLK,
+               (void __iomem *)KSEG1ADDR(PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
+       wmb();
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   DB1200_PC0_INT,
+                                   DB1200_PC0_INSERT_INT,
+                                   /*DB1200_PC0_STSCHG_INT*/0,
+                                   DB1200_PC0_EJECT_INT,
+                                   0);
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x004000000,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x004400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x004000000,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x004010000 - 1,
+                                   DB1200_PC1_INT,
+                                   DB1200_PC1_INSERT_INT,
+                                   /*DB1200_PC1_STSCHG_INT*/0,
+                                   DB1200_PC1_EJECT_INT,
+                                   1);
+
+       swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
+       db1x_register_norflash(64 << 20, 2, swapped);
+
+       return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
+}
+device_initcall(db1200_dev_init);
+
+/* au1200fb calls these: STERBT EINEN TRAGISCHEN TOD!!! */
+int board_au1200fb_panel(void)
+{
+       return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
+}
+
+int board_au1200fb_panel_init(void)
+{
+       /* Apply power */
+       bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                               BCSR_BOARD_LCDBL);
+       return 0;
+}
+
+int board_au1200fb_panel_shutdown(void)
+{
+       /* Remove power */
+       bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                            BCSR_BOARD_LCDBL, 0);
+       return 0;
+}
diff --git a/arch/mips/alchemy/devboards/db1200/setup.c b/arch/mips/alchemy/devboards/db1200/setup.c
new file mode 100644 (file)
index 0000000..379536e
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Alchemy/AMD/RMI DB1200 board setup.
+ *
+ * Licensed under the terms outlined in the file COPYING in the root of
+ * this source archive.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-db1x00/bcsr.h>
+#include <asm/mach-db1x00/db1200.h>
+
+const char *get_system_type(void)
+{
+       return "Alchemy Db1200";
+}
+
+void __init board_setup(void)
+{
+       unsigned long freq0, clksrc, div, pfc;
+       unsigned short whoami;
+
+       bcsr_init(DB1200_BCSR_PHYS_ADDR,
+                 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
+
+       whoami = bcsr_read(BCSR_WHOAMI);
+       printk(KERN_INFO "Alchemy/AMD/RMI DB1200 Board, CPLD Rev %d"
+               "  Board-ID %d  Daughtercard ID %d\n",
+               (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
+
+       /* SMBus/SPI on PSC0, Audio on PSC1 */
+       pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
+       pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
+       pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
+       pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
+       __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
+       wmb();
+
+       /* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from
+        * CPU clock; all other clock generators off/unused.
+        */
+       div = (get_au1x00_speed() + 25000000) / 50000000;
+       if (div & 1)
+               div++;
+       div = ((div >> 1) - 1) & 0xff;
+
+       freq0 = div << SYS_FC_FRDIV0_BIT;
+       __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
+       wmb();
+       freq0 |= SYS_FC_FE0;    /* enable F0 */
+       __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
+       wmb();
+
+       /* psc0_intclk comes 1:1 from F0 */
+       clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
+       __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
+       wmb();
+}
+
+/* use the hexleds to count the number of times the cpu has entered
+ * wait, the dots to indicate whether the CPU is currently idle or
+ * active (dots off = sleeping, dots on = working) for cases where
+ * the number doesn't change for a long(er) period of time.
+ */
+static void db1200_wait(void)
+{
+       __asm__("       .set    push                    \n"
+               "       .set    mips3                   \n"
+               "       .set    noreorder               \n"
+               "       cache   0x14, 0(%0)             \n"
+               "       cache   0x14, 32(%0)            \n"
+               "       cache   0x14, 64(%0)            \n"
+               /* dots off: we're about to call wait */
+               "       lui     $26, 0xb980             \n"
+               "       ori     $27, $0, 3              \n"
+               "       sb      $27, 0x18($26)          \n"
+               "       sync                            \n"
+               "       nop                             \n"
+               "       wait                            \n"
+               "       nop                             \n"
+               "       nop                             \n"
+               "       nop                             \n"
+               "       nop                             \n"
+               "       nop                             \n"
+               /* dots on: there's work to do, increment cntr */
+               "       lui     $26, 0xb980             \n"
+               "       sb      $0, 0x18($26)           \n"
+               "       lui     $26, 0xb9c0             \n"
+               "       lb      $27, 0($26)             \n"
+               "       addiu   $27, $27, 1             \n"
+               "       sb      $27, 0($26)             \n"
+               "       sync                            \n"
+               "       .set    pop                     \n"
+               : : "r" (db1200_wait));
+}
+
+static int __init db1200_arch_init(void)
+{
+       /* GPIO7 is low-level triggered CPLD cascade */
+       set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW);
+       bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
+
+       /* do not autoenable these: CPLD has broken edge int handling,
+        * and the CD handler setup requires manual enabling to work
+        * around that.
+        */
+       irq_to_desc(DB1200_SD0_INSERT_INT)->status |= IRQ_NOAUTOEN;
+       irq_to_desc(DB1200_SD0_EJECT_INT)->status |= IRQ_NOAUTOEN;
+
+       if (cpu_wait)
+               cpu_wait = db1200_wait;
+
+       return 0;
+}
+arch_initcall(db1200_arch_init);
index 432241ab8677dc59494f3499f402b1aa66c9c104..613c0c0c8be9268ae540f915ac32724406788d2c 100644 (file)
@@ -5,4 +5,4 @@
 # Makefile for the Alchemy Semiconductor DBAu1xx0 boards.
 #
 
-obj-y := board_setup.o irqmap.o
+obj-y := board_setup.o platform.o
index de30d8ea7176d3a706b828f0b63d936a57eb6bf4..50c9bef99daa58e93842cfd87926e3bcd07dd5be 100644 (file)
 
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
 
 #include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-au1x00/au1xxx_eth.h>
 #include <asm/mach-db1x00/db1x00.h>
+#include <asm/mach-db1x00/bcsr.h>
+#include <asm/reboot.h>
 
 #include <prom.h>
 
+#ifdef CONFIG_MIPS_DB1500
+char irq_tab_alchemy[][5] __initdata = {
+       [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - HPT371   */
+       [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */
+};
+
+#endif
 
-static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
+
+#ifdef CONFIG_MIPS_DB1550
+char irq_tab_alchemy[][5] __initdata = {
+       [11] = { -1, AU1550_PCI_INTC, 0xff, 0xff, 0xff }, /* IDSEL 11 - on-board HPT371 */
+       [12] = { -1, AU1550_PCI_INTB, AU1550_PCI_INTC, AU1550_PCI_INTD, AU1550_PCI_INTA }, /* IDSEL 12 - PCI slot 2 (left) */
+       [13] = { -1, AU1550_PCI_INTA, AU1550_PCI_INTB, AU1550_PCI_INTC, AU1550_PCI_INTD }, /* IDSEL 13 - PCI slot 1 (right) */
+};
+#endif
+
+
+#ifdef CONFIG_MIPS_BOSPORUS
+char irq_tab_alchemy[][5] __initdata = {
+       [11] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 11 - miniPCI  */
+       [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - SN1741   */
+       [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */
+};
+
+/*
+ * Micrel/Kendin 5 port switch attached to MAC0,
+ * MAC0 is associated with PHY address 5 (== WAN port)
+ * MAC1 is not associated with any PHY, since it's connected directly
+ * to the switch.
+ * no interrupts are used
+ */
+static struct au1000_eth_platform_data eth0_pdata = {
+       .phy_static_config      = 1,
+       .phy_addr               = 5,
+};
+
+static void bosporus_power_off(void)
+{
+       printk(KERN_INFO "It's now safe to turn off power\n");
+       while (1)
+               asm volatile (".set mips3 ; wait ; .set mips0");
+}
 
 const char *get_system_type(void)
 {
-#ifdef CONFIG_MIPS_BOSPORUS
        return "Alchemy Bosporus Gateway Reference";
-#else
-       return "Alchemy Db1x00";
+}
 #endif
+
+
+#ifdef CONFIG_MIPS_MIRAGE
+char irq_tab_alchemy[][5] __initdata = {
+       [11] = { -1, AU1500_PCI_INTD, 0xff, 0xff, 0xff }, /* IDSEL 11 - SMI VGX */
+       [12] = { -1, 0xff, 0xff, AU1500_PCI_INTC, 0xff }, /* IDSEL 12 - PNX1300 */
+       [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 13 - miniPCI */
+};
+
+static void mirage_power_off(void)
+{
+       alchemy_gpio_direction_output(210, 1);
+}
+
+const char *get_system_type(void)
+{
+       return "Alchemy Mirage";
+}
+#endif
+
+
+#if defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE)
+static void mips_softreset(void)
+{
+       asm volatile ("jr\t%0" : : "r"(0xbfc00000));
 }
 
-void board_reset(void)
+#else
+
+const char *get_system_type(void)
 {
-       /* Hit BCSR.SW_RESET[RESET] */
-       bcsr->swreset = 0x0000;
+       return "Alchemy Db1x00";
 }
+#endif
+
 
 void __init board_setup(void)
 {
-       u32 pin_func = 0;
-       char *argptr;
-
-       argptr = prom_getcmdline();
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
+       unsigned long bcsr1, bcsr2;
+       u32 pin_func;
+
+       bcsr1 = DB1000_BCSR_PHYS_ADDR;
+       bcsr2 = DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS;
+
+       pin_func = 0;
+
+#ifdef CONFIG_MIPS_DB1000
+       printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
+#endif
+#ifdef CONFIG_MIPS_DB1500
+       printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
 #endif
+#ifdef CONFIG_MIPS_DB1100
+       printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
+#endif
+#ifdef CONFIG_MIPS_BOSPORUS
+       au1xxx_override_eth_cfg(0, &eth0_pdata);
 
-#ifdef CONFIG_FB_AU1100
-       argptr = strstr(argptr, "video=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               /* default panel */
-               /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
-       }
+       printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
 #endif
+#ifdef CONFIG_MIPS_MIRAGE
+       printk(KERN_INFO "AMD Alchemy Mirage Board\n");
+#endif
+#ifdef CONFIG_MIPS_DB1550
+       printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
 
-#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
-       /* au1000 does not support vra, au1500 and au1100 do */
-       strcat(argptr, " au1000_audio=vra");
-       argptr = prom_getcmdline();
+       bcsr1 = DB1550_BCSR_PHYS_ADDR;
+       bcsr2 = DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS;
 #endif
 
+       /* initialize board register space */
+       bcsr_init(bcsr1, bcsr2);
+
        /* Not valid for Au1550 */
 #if defined(CONFIG_IRDA) && \
    (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
@@ -89,11 +169,10 @@ void __init board_setup(void)
        pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
        au_writel(pin_func, SYS_PINFUNC);
        /* Power off until the driver is in use */
-       bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
-       bcsr->resets |=  BCSR_RESETS_IRDA_MODE_OFF;
-       au_sync();
+       bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
+                               BCSR_RESETS_IRDA_MODE_OFF);
 #endif
-       bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
+       bcsr_write(BCSR_PCMCIA, 0);     /* turn off PCMCIA power */
 
        /* Enable GPIO[31:0] inputs */
        alchemy_gpio1_input_enable();
@@ -120,26 +199,53 @@ void __init board_setup(void)
         * be part of the audio driver.
         */
        alchemy_gpio_direction_output(209, 1);
-#endif
-
-       au_sync();
 
-#ifdef CONFIG_MIPS_DB1000
-       printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1500
-       printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1100
-       printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
+       pm_power_off = mirage_power_off;
+       _machine_halt = mirage_power_off;
+       _machine_restart = (void(*)(char *))mips_softreset;
 #endif
+
 #ifdef CONFIG_MIPS_BOSPORUS
-       printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
+       pm_power_off = bosporus_power_off;
+       _machine_halt = bosporus_power_off;
+       _machine_restart = (void(*)(char *))mips_softreset;
 #endif
-#ifdef CONFIG_MIPS_MIRAGE
-       printk(KERN_INFO "AMD Alchemy Mirage Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1550
-       printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
+       au_sync();
+}
+
+static int __init db1x00_init_irq(void)
+{
+#if defined(CONFIG_MIPS_MIRAGE)
+       set_irq_type(AU1500_GPIO7_INT, IRQF_TRIGGER_RISING); /* TS pendown */
+#elif defined(CONFIG_MIPS_DB1550)
+       set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW);  /* CD0# */
+       set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW);  /* CD1# */
+       set_irq_type(AU1550_GPIO3_INT, IRQF_TRIGGER_LOW);  /* CARD0# */
+       set_irq_type(AU1550_GPIO5_INT, IRQF_TRIGGER_LOW);  /* CARD1# */
+       set_irq_type(AU1550_GPIO21_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */
+       set_irq_type(AU1550_GPIO22_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */
+#elif defined(CONFIG_MIPS_DB1500)
+       set_irq_type(AU1500_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */
+       set_irq_type(AU1500_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */
+       set_irq_type(AU1500_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */
+       set_irq_type(AU1500_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */
+       set_irq_type(AU1500_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */
+       set_irq_type(AU1500_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */
+#elif defined(CONFIG_MIPS_DB1100)
+       set_irq_type(AU1100_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */
+       set_irq_type(AU1100_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */
+       set_irq_type(AU1100_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */
+       set_irq_type(AU1100_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */
+       set_irq_type(AU1100_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */
+       set_irq_type(AU1100_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */
+#elif defined(CONFIG_MIPS_DB1000)
+       set_irq_type(AU1000_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */
+       set_irq_type(AU1000_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */
+       set_irq_type(AU1000_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */
+       set_irq_type(AU1000_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */
+       set_irq_type(AU1000_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */
+       set_irq_type(AU1000_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */
 #endif
+       return 0;
 }
+arch_initcall(db1x00_init_irq);
diff --git a/arch/mips/alchemy/devboards/db1x00/irqmap.c b/arch/mips/alchemy/devboards/db1x00/irqmap.c
deleted file mode 100644 (file)
index 0b09025..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- *     Au1xxx irq map table
- *
- * Copyright 2003 Embedded Edge, LLC
- *             dan@embeddededge.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  SOFTWARE  IS PROVIDED          ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,          INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED          TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN         CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-
-#include <asm/mach-au1x00/au1000.h>
-
-#ifdef CONFIG_MIPS_DB1500
-char irq_tab_alchemy[][5] __initdata = {
-       [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - HPT371   */
-       [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
-};
-#endif
-
-#ifdef CONFIG_MIPS_BOSPORUS
-char irq_tab_alchemy[][5] __initdata = {
-       [11] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 11 - miniPCI  */
-       [12] = { -1, INTA, INTX, INTX, INTX }, /* IDSEL 12 - SN1741   */
-       [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot */
-};
-#endif
-
-#ifdef CONFIG_MIPS_MIRAGE
-char irq_tab_alchemy[][5] __initdata = {
-       [11] = { -1, INTD, INTX, INTX, INTX }, /* IDSEL 11 - SMI VGX */
-       [12] = { -1, INTX, INTX, INTC, INTX }, /* IDSEL 12 - PNX1300 */
-       [13] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 13 - miniPCI */
-};
-#endif
-
-#ifdef CONFIG_MIPS_DB1550
-char irq_tab_alchemy[][5] __initdata = {
-       [11] = { -1, INTC, INTX, INTX, INTX }, /* IDSEL 11 - on-board HPT371 */
-       [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left) */
-       [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
-};
-#endif
-
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-
-#ifndef CONFIG_MIPS_MIRAGE
-#ifdef CONFIG_MIPS_DB1550
-       { AU1000_GPIO_3, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 IRQ# */
-       { AU1000_GPIO_5, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 IRQ# */
-#else
-       { AU1000_GPIO_0, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 Fully_Interted# */
-       { AU1000_GPIO_1, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 STSCHG# */
-       { AU1000_GPIO_2, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 IRQ# */
-
-       { AU1000_GPIO_3, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 Fully_Interted# */
-       { AU1000_GPIO_4, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 STSCHG# */
-       { AU1000_GPIO_5, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 IRQ# */
-#endif
-#else
-       { AU1000_GPIO_7, IRQF_TRIGGER_RISING, 0 }, /* touchscreen pen down */
-#endif
-
-};
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
-}
diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c
new file mode 100644 (file)
index 0000000..978d5ab
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * DBAu1xxx board platform device registration
+ *
+ * Copyright (C) 2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-au1x00/au1xxx.h>
+#include <asm/mach-db1x00/bcsr.h>
+#include "../platform.h"
+
+/* DB1xxx PCMCIA interrupt sources:
+ * CD0/1       GPIO0/3
+ * STSCHG0/1   GPIO1/4
+ * CARD0/1     GPIO2/5
+ * Db1550:     0/1, 21/22, 3/5
+ */
+
+#define DB1XXX_HAS_PCMCIA
+#define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT)
+
+#if defined(CONFIG_MIPS_DB1000)
+#define DB1XXX_PCMCIA_CD0      AU1000_GPIO0_INT
+#define DB1XXX_PCMCIA_STSCHG0  AU1000_GPIO1_INT
+#define DB1XXX_PCMCIA_CARD0    AU1000_GPIO2_INT
+#define DB1XXX_PCMCIA_CD1      AU1000_GPIO3_INT
+#define DB1XXX_PCMCIA_STSCHG1  AU1000_GPIO4_INT
+#define DB1XXX_PCMCIA_CARD1    AU1000_GPIO5_INT
+#define BOARD_FLASH_SIZE       0x02000000 /* 32MB */
+#define BOARD_FLASH_WIDTH      4 /* 32-bits */
+#elif defined(CONFIG_MIPS_DB1100)
+#define DB1XXX_PCMCIA_CD0      AU1100_GPIO0_INT
+#define DB1XXX_PCMCIA_STSCHG0  AU1100_GPIO1_INT
+#define DB1XXX_PCMCIA_CARD0    AU1100_GPIO2_INT
+#define DB1XXX_PCMCIA_CD1      AU1100_GPIO3_INT
+#define DB1XXX_PCMCIA_STSCHG1  AU1100_GPIO4_INT
+#define DB1XXX_PCMCIA_CARD1    AU1100_GPIO5_INT
+#define BOARD_FLASH_SIZE       0x02000000 /* 32MB */
+#define BOARD_FLASH_WIDTH      4 /* 32-bits */
+#elif defined(CONFIG_MIPS_DB1500)
+#define DB1XXX_PCMCIA_CD0      AU1500_GPIO0_INT
+#define DB1XXX_PCMCIA_STSCHG0  AU1500_GPIO1_INT
+#define DB1XXX_PCMCIA_CARD0    AU1500_GPIO2_INT
+#define DB1XXX_PCMCIA_CD1      AU1500_GPIO3_INT
+#define DB1XXX_PCMCIA_STSCHG1  AU1500_GPIO4_INT
+#define DB1XXX_PCMCIA_CARD1    AU1500_GPIO5_INT
+#define BOARD_FLASH_SIZE       0x02000000 /* 32MB */
+#define BOARD_FLASH_WIDTH      4 /* 32-bits */
+#elif defined(CONFIG_MIPS_DB1550)
+#define DB1XXX_PCMCIA_CD0      AU1550_GPIO0_INT
+#define DB1XXX_PCMCIA_STSCHG0  AU1550_GPIO21_INT
+#define DB1XXX_PCMCIA_CARD0    AU1550_GPIO3_INT
+#define DB1XXX_PCMCIA_CD1      AU1550_GPIO1_INT
+#define DB1XXX_PCMCIA_STSCHG1  AU1550_GPIO22_INT
+#define DB1XXX_PCMCIA_CARD1    AU1550_GPIO5_INT
+#define BOARD_FLASH_SIZE       0x08000000 /* 128MB */
+#define BOARD_FLASH_WIDTH      4 /* 32-bits */
+#else
+/* other board: no PCMCIA */
+#undef DB1XXX_HAS_PCMCIA
+#undef F_SWAPPED
+#define F_SWAPPED 0
+#if defined(CONFIG_MIPS_BOSPORUS)
+#define BOARD_FLASH_SIZE       0x01000000 /* 16MB */
+#define BOARD_FLASH_WIDTH      2 /* 16-bits */
+#elif defined(CONFIG_MIPS_MIRAGE)
+#define BOARD_FLASH_SIZE       0x04000000 /* 64MB */
+#define BOARD_FLASH_WIDTH      4 /* 32-bits */
+#endif
+#endif
+
+static int __init db1xxx_dev_init(void)
+{
+#ifdef DB1XXX_HAS_PCMCIA
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   DB1XXX_PCMCIA_CARD0,
+                                   DB1XXX_PCMCIA_CD0,
+                                   /*DB1XXX_PCMCIA_STSCHG0*/0,
+                                   0,
+                                   0);
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x004000000,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x004400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x004000000,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x004010000 - 1,
+                                   DB1XXX_PCMCIA_CARD1,
+                                   DB1XXX_PCMCIA_CD1,
+                                   /*DB1XXX_PCMCIA_STSCHG1*/0,
+                                   0,
+                                   1);
+#endif
+       db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED);
+       return 0;
+}
+device_initcall(db1xxx_dev_init);
index cd273545e810df42cc9c5e2e636485a0d5fa7cb8..b5311d8a29abfade7a5ae9f77382663a43bbd096 100644 (file)
 #include <asm/mach-pb1x00/pb1000.h>
 #include <prom.h>
 
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1000_GPIO_15, IRQF_TRIGGER_LOW, 0 },
-};
-
+#include "../platform.h"
 
 const char *get_system_type(void)
 {
@@ -46,25 +42,14 @@ void board_reset(void)
 {
 }
 
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
-}
-
 void __init board_setup(void)
 {
        u32 pin_func, static_cfg0;
        u32 sys_freqctrl, sys_clksrc;
        u32 prid = read_c0_prid();
 
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       char *argptr = prom_getcmdline();
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
+       sys_freqctrl = 0;
+       sys_clksrc = 0;
 
        /* Set AUX clock to 12 MHz * 8 = 96 MHz */
        au_writel(8, SYS_AUXPLL);
@@ -193,3 +178,16 @@ void __init board_setup(void)
                break;
        }
 }
+
+static int __init pb1000_init_irq(void)
+{
+       set_irq_type(AU1000_GPIO15_INT, IRQF_TRIGGER_LOW);
+       return 0;
+}
+arch_initcall(pb1000_init_irq);
+
+static int __init pb1000_device_init(void)
+{
+       return db1x_register_norflash(8 * 1024 * 1024, 4, 0);
+}
+device_initcall(pb1000_device_init);
index c586dd7e91dcb7ba3d063405aba6c482c641073a..7e3756c83fe5293e78c3e29aec9e3d6fcab0ac3e 100644 (file)
@@ -5,4 +5,4 @@
 # Makefile for the Alchemy Semiconductor Pb1100 board.
 #
 
-obj-y := board_setup.o
+obj-y := board_setup.o platform.o
index 61263081ef58c1100ab5fa67821a29127225d130..c7b4caa81a356804f72cc70b64d230b6acb8187a 100644 (file)
 #include <linux/interrupt.h>
 
 #include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-pb1x00/pb1100.h>
+#include <asm/mach-db1x00/bcsr.h>
 
 #include <prom.h>
 
 
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1000_GPIO_9,  IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card Fully_Inserted# */
-       { AU1000_GPIO_10, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card STSCHG# */
-       { AU1000_GPIO_11, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card IRQ# */
-       { AU1000_GPIO_13, IRQF_TRIGGER_LOW, 0 }, /* DC_IRQ# */
-};
-
-
 const char *get_system_type(void)
 {
        return "Alchemy Pb1100";
@@ -49,43 +41,15 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       /* Hit BCSR.RST_VDDI[SOFT_RESET] */
-       au_writel(0x00000000, PB1100_RST_VDDI);
-}
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
        volatile void __iomem *base = (volatile void __iomem *)0xac000000UL;
-       char *argptr;
-
-       argptr = prom_getcmdline();
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
-
-#ifdef CONFIG_FB_AU1100
-       argptr = strstr(argptr, "video=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               /* default panel */
-               /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
-       }
-#endif
 
-#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
-       /* au1000 does not support vra, au1500 and au1100 do */
-       strcat(argptr, " au1000_audio=vra");
-       argptr = prom_getcmdline();
-#endif
+       bcsr_init(DB1000_BCSR_PHYS_ADDR,
+                 DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS);
 
        /* Set AUX clock to 12 MHz * 8 = 96 MHz */
        au_writel(8, SYS_AUXPLL);
@@ -155,3 +119,14 @@ void __init board_setup(void)
                au_sync();
        }
 }
+
+static int __init pb1100_init_irq(void)
+{
+       set_irq_type(AU1100_GPIO9_INT,  IRQF_TRIGGER_LOW); /* PCCD# */
+       set_irq_type(AU1100_GPIO10_INT, IRQF_TRIGGER_LOW); /* PCSTSCHG# */
+       set_irq_type(AU1100_GPIO11_INT, IRQF_TRIGGER_LOW); /* PCCard# */
+       set_irq_type(AU1100_GPIO13_INT, IRQF_TRIGGER_LOW); /* DC_IRQ# */
+
+       return 0;
+}
+arch_initcall(pb1100_init_irq);
diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c
new file mode 100644 (file)
index 0000000..2c8dc29
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Pb1100 board platform device registration
+ *
+ * Copyright (C) 2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/init.h>
+
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#include "../platform.h"
+
+static int __init pb1100_dev_init(void)
+{
+       int swapped;
+
+       /* PCMCIA. single socket, identical to Pb1500 */
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   AU1100_GPIO11_INT,   /* card */
+                                   AU1100_GPIO9_INT,    /* insert */
+                                   /*AU1100_GPIO10_INT*/0, /* stschg */
+                                   0,                   /* eject */
+                                   0);                  /* id */
+
+       swapped = bcsr_read(BCSR_STATUS) &  BCSR_STATUS_DB1000_SWAPBOOT;
+       db1x_register_norflash(64 * 1024 * 1024, 4, swapped);
+
+       return 0;
+}
+device_initcall(pb1100_dev_init);
index c8c3a99fb68a24ece7297a0632b91e34fd511209..2ea9b02ef09f4c9f0ca25c1ea23fae3af7e63a7c 100644 (file)
@@ -2,6 +2,6 @@
 # Makefile for the Alchemy Semiconductor Pb1200/DBAu1200 boards.
 #
 
-obj-y := board_setup.o irqmap.o platform.o
+obj-y := board_setup.o platform.o
 
 EXTRA_CFLAGS += -Werror
index 94e6b7e7753d3a3d2321493b8dc07911afb5cdb6..3184063f8042916524ab32d7ded779a937cc4b0f 100644 (file)
  */
 
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/sched.h>
 
-#include <prom.h>
-#include <au1xxx.h>
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#ifdef CONFIG_MIPS_PB1200
+#include <asm/mach-pb1x00/pb1200.h>
+#endif
+
+#ifdef CONFIG_MIPS_DB1200
+#include <asm/mach-db1x00/db1200.h>
+#define PB1200_INT_BEGIN DB1200_INT_BEGIN
+#define PB1200_INT_END DB1200_INT_END
+#endif
 
+#include <prom.h>
 
 const char *get_system_type(void)
 {
@@ -38,25 +50,15 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       bcsr->resets = 0;
-       bcsr->system = 0;
+       bcsr_write(BCSR_RESETS, 0);
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
-       char *argptr;
-
-       argptr = prom_getcmdline();
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
-#ifdef CONFIG_FB_AU1200
-       strcat(argptr, " video=au1200fb:panel:bs");
-#endif
+       printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
+       bcsr_init(PB1200_BCSR_PHYS_ADDR,
+                 PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
 
 #if 0
        {
@@ -82,7 +84,7 @@ void __init board_setup(void)
                u32 pin_func;
 
                /* Select SMBus in CPLD */
-               bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
 
                pin_func = au_readl(SYS_PINFUNC);
                au_sync();
@@ -116,38 +118,54 @@ void __init board_setup(void)
 
        /*
         * The Pb1200 development board uses external MUX for PSC0 to
-        * support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
+        * support SMB/SPI. bcsr_resets bit 12: 0=SMB 1=SPI
         */
 #ifdef CONFIG_I2C_AU1550
-       bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
+       bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
 #endif
        au_sync();
+}
 
-#ifdef CONFIG_MIPS_PB1200
-       printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1200
-       printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
-#endif
+static int __init pb1200_init_irq(void)
+{
+       /* We have a problem with CPLD rev 3. */
+       if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n");
+               printk(KERN_ERR "updated to latest revision. This software will\n");
+               printk(KERN_ERR "not work on anything less than CPLD rev 4.\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               printk(KERN_ERR "WARNING!!!\n");
+               panic("Game over.  Your score is 0.");
+       }
+
+       set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW);
+       bcsr_init_irq(PB1200_INT_BEGIN, PB1200_INT_END, AU1200_GPIO7_INT);
+
+       return 0;
 }
+arch_initcall(pb1200_init_irq);
+
 
 int board_au1200fb_panel(void)
 {
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-       int p;
-
-       p = bcsr->switches;
-       p >>= 8;
-       p &= 0x0F;
-       return p;
+       return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
 }
 
 int board_au1200fb_panel_init(void)
 {
        /* Apply power */
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-       bcsr->board |= BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL;
+       bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                               BCSR_BOARD_LCDBL);
        /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */
        return 0;
 }
@@ -155,10 +173,8 @@ int board_au1200fb_panel_init(void)
 int board_au1200fb_panel_shutdown(void)
 {
        /* Remove power */
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-       bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
-                        BCSR_BOARD_LCDBL);
+       bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                            BCSR_BOARD_LCDBL, 0);
        /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */
        return 0;
 }
diff --git a/arch/mips/alchemy/devboards/pb1200/irqmap.c b/arch/mips/alchemy/devboards/pb1200/irqmap.c
deleted file mode 100644 (file)
index fe47498..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- *     Au1xxx irq map table
- *
- *  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  SOFTWARE  IS PROVIDED          ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,          INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED          TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN         CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-
-#include <asm/mach-au1x00/au1000.h>
-
-#ifdef CONFIG_MIPS_PB1200
-#include <asm/mach-pb1x00/pb1200.h>
-#endif
-
-#ifdef CONFIG_MIPS_DB1200
-#include <asm/mach-db1x00/db1200.h>
-#define PB1200_INT_BEGIN DB1200_INT_BEGIN
-#define PB1200_INT_END DB1200_INT_END
-#endif
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       /* This is external interrupt cascade */
-       { AU1000_GPIO_7, IRQF_TRIGGER_LOW, 0 },
-};
-
-
-/*
- * Support for External interrupts on the Pb1200 Development platform.
- */
-
-static void pb1200_cascade_handler(unsigned int irq, struct irq_desc *d)
-{
-       unsigned short bisr = bcsr->int_status;
-
-       for ( ; bisr; bisr &= bisr - 1)
-               generic_handle_irq(PB1200_INT_BEGIN + __ffs(bisr));
-}
-
-/* NOTE: both the enable and mask bits must be cleared, otherwise the
- * CPLD generates tons of spurious interrupts (at least on the DB1200).
- */
-static void pb1200_mask_irq(unsigned int irq_nr)
-{
-       bcsr->intclr_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
-       bcsr->intclr = 1 << (irq_nr - PB1200_INT_BEGIN);
-       au_sync();
-}
-
-static void pb1200_maskack_irq(unsigned int irq_nr)
-{
-       bcsr->intclr_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
-       bcsr->intclr = 1 << (irq_nr - PB1200_INT_BEGIN);
-       bcsr->int_status = 1 << (irq_nr - PB1200_INT_BEGIN);    /* ack */
-       au_sync();
-}
-
-static void pb1200_unmask_irq(unsigned int irq_nr)
-{
-       bcsr->intset = 1 << (irq_nr - PB1200_INT_BEGIN);
-       bcsr->intset_mask = 1 << (irq_nr - PB1200_INT_BEGIN);
-       au_sync();
-}
-
-static struct irq_chip pb1200_cpld_irq_type = {
-#ifdef CONFIG_MIPS_PB1200
-       .name = "Pb1200 Ext",
-#endif
-#ifdef CONFIG_MIPS_DB1200
-       .name = "Db1200 Ext",
-#endif
-       .mask           = pb1200_mask_irq,
-       .mask_ack       = pb1200_maskack_irq,
-       .unmask         = pb1200_unmask_irq,
-};
-
-void __init board_init_irq(void)
-{
-       unsigned int irq;
-
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
-
-#ifdef CONFIG_MIPS_PB1200
-       /* We have a problem with CPLD rev 3. */
-       if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) {
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n");
-               printk(KERN_ERR "updated to latest revision. This software will\n");
-               printk(KERN_ERR "not work on anything less than CPLD rev 4.\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               printk(KERN_ERR "WARNING!!!\n");
-               panic("Game over.  Your score is 0.");
-       }
-#endif
-       /* mask & disable & ack all */
-       bcsr->intclr_mask = 0xffff;
-       bcsr->intclr = 0xffff;
-       bcsr->int_status = 0xffff;
-       au_sync();
-
-       for (irq = PB1200_INT_BEGIN; irq <= PB1200_INT_END; irq++)
-               set_irq_chip_and_handler_name(irq, &pb1200_cpld_irq_type,
-                                        handle_level_irq, "level");
-
-       set_irq_chained_handler(AU1000_GPIO_7, pb1200_cascade_handler);
-}
index b93dff4a6789ca4e5c054a42302e640b619e9f69..3ef2dceeb796a8abf807fdd71471f0527419136d 100644 (file)
 
 #include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#include "../platform.h"
 
 static int mmc_activity;
 
 static void pb1200mmc0_set_power(void *mmc_host, int state)
 {
        if (state)
-               bcsr->board |= BCSR_BOARD_SD0PWR;
+               bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
        else
-               bcsr->board &= ~BCSR_BOARD_SD0PWR;
+               bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
 
-       au_sync_delay(1);
+       msleep(1);
 }
 
 static int pb1200mmc0_card_readonly(void *mmc_host)
 {
-       return (bcsr->status & BCSR_STATUS_SD0WP) ? 1 : 0;
+       return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
 }
 
 static int pb1200mmc0_card_inserted(void *mmc_host)
 {
-       return (bcsr->sig_status & BCSR_INT_SD0INSERT) ? 1 : 0;
+       return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
 }
 
 static void pb1200_mmcled_set(struct led_classdev *led,
@@ -54,10 +57,10 @@ static void pb1200_mmcled_set(struct led_classdev *led,
 {
        if (brightness != LED_OFF) {
                if (++mmc_activity == 1)
-                       bcsr->disk_leds &= ~(1 << 8);
+                       bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
        } else {
                if (--mmc_activity == 0)
-                       bcsr->disk_leds |= (1 << 8);
+                       bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
        }
 }
 
@@ -65,27 +68,25 @@ static struct led_classdev pb1200mmc_led = {
        .brightness_set = pb1200_mmcled_set,
 };
 
-#ifndef CONFIG_MIPS_DB1200
 static void pb1200mmc1_set_power(void *mmc_host, int state)
 {
        if (state)
-               bcsr->board |= BCSR_BOARD_SD1PWR;
+               bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR);
        else
-               bcsr->board &= ~BCSR_BOARD_SD1PWR;
+               bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0);
 
-       au_sync_delay(1);
+       msleep(1);
 }
 
 static int pb1200mmc1_card_readonly(void *mmc_host)
 {
-       return (bcsr->status & BCSR_STATUS_SD1WP) ? 1 : 0;
+       return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0;
 }
 
 static int pb1200mmc1_card_inserted(void *mmc_host)
 {
-       return (bcsr->sig_status & BCSR_INT_SD1INSERT) ? 1 : 0;
+       return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0;
 }
-#endif
 
 const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
        [0] = {
@@ -95,7 +96,6 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
                .cd_setup       = NULL,         /* use poll-timer in driver */
                .led            = &pb1200mmc_led,
        },
-#ifndef CONFIG_MIPS_DB1200
        [1] = {
                .set_power      = pb1200mmc1_set_power,
                .card_inserted  = pb1200mmc1_card_inserted,
@@ -103,7 +103,6 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
                .cd_setup       = NULL,         /* use poll-timer in driver */
                .led            = &pb1200mmc_led,
        },
-#endif
 };
 
 static struct resource ide_resources[] = {
@@ -169,8 +168,36 @@ static struct platform_device *board_platform_devices[] __initdata = {
 
 static int __init board_register_devices(void)
 {
+       int swapped;
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   PB1200_PC0_INT,
+                                   PB1200_PC0_INSERT_INT,
+                                   /*PB1200_PC0_STSCHG_INT*/0,
+                                   PB1200_PC0_EJECT_INT,
+                                   0);
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR + 0x008000000,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x008000000,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x008400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x008000000,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x008010000 - 1,
+                                   PB1200_PC1_INT,
+                                   PB1200_PC1_INSERT_INT,
+                                   /*PB1200_PC1_STSCHG_INT*/0,
+                                   PB1200_PC1_EJECT_INT,
+                                   1);
+
+       swapped = bcsr_read(BCSR_STATUS) &  BCSR_STATUS_DB1200_SWAPBOOT;
+       db1x_register_norflash(128 * 1024 * 1024, 2, swapped);
+
        return platform_add_devices(board_platform_devices,
                                    ARRAY_SIZE(board_platform_devices));
 }
-
-arch_initcall(board_register_devices);
+device_initcall(board_register_devices);
index 173b419a7479977733441633029f4ea68919c30e..e83b151b5b6300642e49db70945baf4e1e40da50 100644 (file)
@@ -5,4 +5,4 @@
 # Makefile for the Alchemy Semiconductor Pb1500 board.
 #
 
-obj-y := board_setup.o
+obj-y := board_setup.o platform.o
index d7a56569e7ed594efd38f4f33b2cb09c0736bdb4..fa9770ac358a1649ea7a72bef3f6c040fe18dc2f 100644 (file)
 #include <linux/interrupt.h>
 
 #include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-pb1x00/pb1500.h>
+#include <asm/mach-db1x00/bcsr.h>
 
 #include <prom.h>
 
 
 char irq_tab_alchemy[][5] __initdata = {
-       [12] = { -1, INTA, INTX, INTX, INTX },   /* IDSEL 12 - HPT370   */
-       [13] = { -1, INTA, INTB, INTC, INTD },   /* IDSEL 13 - PCI slot */
-};
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1500_GPIO_204, IRQF_TRIGGER_HIGH, 0 },
-       { AU1500_GPIO_201, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_202, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_203, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_205, IRQF_TRIGGER_LOW, 0 },
+       [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff },   /* IDSEL 12 - HPT370        */
+       [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD },   /* IDSEL 13 - PCI slot */
 };
 
 
@@ -55,35 +47,16 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       /* Hit BCSR.RST_VDDI[SOFT_RESET] */
-       au_writel(0x00000000, PB1500_RST_VDDI);
-}
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
        u32 pin_func;
        u32 sys_freqctrl, sys_clksrc;
-       char *argptr;
-
-       argptr = prom_getcmdline();
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
 
-#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
-       /* au1000 does not support vra, au1500 and au1100 do */
-       strcat(argptr, " au1000_audio=vra");
-       argptr = prom_getcmdline();
-#endif
+       bcsr_init(DB1000_BCSR_PHYS_ADDR,
+                 DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS);
 
        sys_clksrc = sys_freqctrl = pin_func = 0;
        /* Set AUX clock to 12 MHz * 8 = 96 MHz */
@@ -163,3 +136,18 @@ void __init board_setup(void)
                au_sync();
        }
 }
+
+static int __init pb1500_init_irq(void)
+{
+       set_irq_type(AU1500_GPIO9_INT, IRQF_TRIGGER_LOW);   /* CD0# */
+       set_irq_type(AU1500_GPIO10_INT, IRQF_TRIGGER_LOW);  /* CARD0 */
+       set_irq_type(AU1500_GPIO11_INT, IRQF_TRIGGER_LOW);  /* STSCHG0# */
+       set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH);
+       set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW);
+
+       return 0;
+}
+arch_initcall(pb1500_init_irq);
diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c
new file mode 100644 (file)
index 0000000..d443bc7
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Pb1500 board platform device registration
+ *
+ * Copyright (C) 2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/init.h>
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#include "../platform.h"
+
+static int __init pb1500_dev_init(void)
+{
+       int swapped;
+
+       /* PCMCIA. single socket, identical to Pb1500 */
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   AU1500_GPIO11_INT,   /* card */
+                                   AU1500_GPIO9_INT,    /* insert */
+                                   /*AU1500_GPIO10_INT*/0, /* stschg */
+                                   0,                   /* eject */
+                                   0);                  /* id */
+
+       swapped = bcsr_read(BCSR_STATUS) &  BCSR_STATUS_DB1000_SWAPBOOT;
+       db1x_register_norflash(64 * 1024 * 1024, 4, swapped);
+
+       return 0;
+}
+device_initcall(pb1500_dev_init);
index cff95bcdb2cab4972d8bb889905308e2fd673315..9661b6ec5dd374283975395cb55e3e76a6866815 100644 (file)
@@ -5,4 +5,4 @@
 # Makefile for the Alchemy Semiconductor Pb1550 board.
 #
 
-obj-y := board_setup.o
+obj-y := board_setup.o platform.o
index b6e9e7d247a30693259576822a7e29b6b999fc95..1e8fb3ddd7269ca677686c1717b6bf13cb6dc008 100644 (file)
 
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-pb1x00/pb1550.h>
+#include <asm/mach-db1x00/bcsr.h>
+#include <asm/mach-au1x00/gpio.h>
 
 #include <prom.h>
 
 
 char irq_tab_alchemy[][5] __initdata = {
-       [12] = { -1, INTB, INTC, INTD, INTA }, /* IDSEL 12 - PCI slot 2 (left)  */
-       [13] = { -1, INTA, INTB, INTC, INTD }, /* IDSEL 13 - PCI slot 1 (right) */
-};
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1000_GPIO_0, IRQF_TRIGGER_LOW, 0 },
-       { AU1000_GPIO_1, IRQF_TRIGGER_LOW, 0 },
+       [12] = { -1, AU1550_PCI_INTB, AU1550_PCI_INTC, AU1550_PCI_INTD, AU1550_PCI_INTA }, /* IDSEL 12 - PCI slot 2 (left)  */
+       [13] = { -1, AU1550_PCI_INTA, AU1550_PCI_INTB, AU1550_PCI_INTC, AU1550_PCI_INTD }, /* IDSEL 13 - PCI slot 1 (right) */
 };
 
 const char *get_system_type(void)
@@ -53,28 +50,17 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       /* Hit BCSR.SYSTEM[RESET] */
-       au_writew(au_readw(0xAF00001C) & ~BCSR_SYSTEM_RESET, 0xAF00001C);
-}
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
        u32 pin_func;
 
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       char *argptr;
-       argptr = prom_getcmdline();
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
+       bcsr_init(PB1550_BCSR_PHYS_ADDR,
+                 PB1550_BCSR_PHYS_ADDR + PB1550_BCSR_HEXLED_OFS);
+
+       alchemy_gpio2_enable();
 
        /*
         * Enable PSC1 SYNC for AC'97.  Normaly done in audio driver,
@@ -85,8 +71,21 @@ void __init board_setup(void)
        pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
        au_writel(pin_func, SYS_PINFUNC);
 
-       au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */
-       au_sync();
+       bcsr_write(BCSR_PCMCIA, 0);     /* turn off PCMCIA power */
 
        printk(KERN_INFO "AMD Alchemy Pb1550 Board\n");
 }
+
+static int __init pb1550_init_irq(void)
+{
+       set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1550_GPIO201_205_INT, IRQF_TRIGGER_HIGH);
+
+       /* enable both PCMCIA card irqs in the shared line */
+       alchemy_gpio2_enable_int(201);
+       alchemy_gpio2_enable_int(202);
+
+       return 0;
+}
+arch_initcall(pb1550_init_irq);
diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550/platform.c
new file mode 100644 (file)
index 0000000..d7150d0
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Pb1550 board platform device registration
+ *
+ * Copyright (C) 2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/init.h>
+
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-pb1x00/pb1550.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#include "../platform.h"
+
+static int __init pb1550_dev_init(void)
+{
+       int swapped;
+
+       /* Pb1550, like all others, also has statuschange irqs; however they're
+       * wired up on one of the Au1550's shared GPIO201_205 line, which also
+       * services the PCMCIA card interrupts.  So we ignore statuschange and
+       * use the GPIO201_205 exclusively for card interrupts, since a) pcmcia
+       * drivers are used to shared irqs and b) statuschange isn't really use-
+       * ful anyway.
+       */
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
+                                   AU1550_GPIO201_205_INT,
+                                   AU1550_GPIO0_INT,
+                                   0,
+                                   0,
+                                   0);
+
+       db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR + 0x008000000,
+                                   PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x008000000,
+                                   PCMCIA_MEM_PHYS_ADDR  + 0x008400000 - 1,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x008000000,
+                                   PCMCIA_IO_PHYS_ADDR   + 0x008010000 - 1,
+                                   AU1550_GPIO201_205_INT,
+                                   AU1550_GPIO1_INT,
+                                   0,
+                                   0,
+                                   1);
+
+       swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT;
+       db1x_register_norflash(128 * 1024 * 1024, 4, swapped);
+
+       return 0;
+}
+device_initcall(pb1550_dev_init);
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
new file mode 100644 (file)
index 0000000..49a4b32
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * devoard misc stuff.
+ */
+
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/physmap.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
+
+#include <asm/reboot.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+static void db1x_power_off(void)
+{
+       bcsr_write(BCSR_RESETS, 0);
+       bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET);
+}
+
+static void db1x_reset(char *c)
+{
+       bcsr_write(BCSR_RESETS, 0);
+       bcsr_write(BCSR_SYSTEM, 0);
+}
+
+static int __init db1x_poweroff_setup(void)
+{
+       if (!pm_power_off)
+               pm_power_off = db1x_power_off;
+       if (!_machine_halt)
+               _machine_halt = db1x_power_off;
+       if (!_machine_restart)
+               _machine_restart = db1x_reset;
+
+       return 0;
+}
+late_initcall(db1x_poweroff_setup);
+
+/* register a pcmcia socket */
+int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,
+                                      phys_addr_t pcmcia_attr_end,
+                                      phys_addr_t pcmcia_mem_start,
+                                      phys_addr_t pcmcia_mem_end,
+                                      phys_addr_t pcmcia_io_start,
+                                      phys_addr_t pcmcia_io_end,
+                                      int card_irq,
+                                      int cd_irq,
+                                      int stschg_irq,
+                                      int eject_irq,
+                                      int id)
+{
+       int cnt, i, ret;
+       struct resource *sr;
+       struct platform_device *pd;
+
+       cnt = 5;
+       if (eject_irq)
+               cnt++;
+       if (stschg_irq)
+               cnt++;
+
+       sr = kzalloc(sizeof(struct resource) * cnt, GFP_KERNEL);
+       if (!sr)
+               return -ENOMEM;
+
+       pd = platform_device_alloc("db1xxx_pcmcia", id);
+       if (!pd) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       sr[0].name      = "pcmcia-attr";
+       sr[0].flags     = IORESOURCE_MEM;
+       sr[0].start     = pcmcia_attr_start;
+       sr[0].end       = pcmcia_attr_end;
+
+       sr[1].name      = "pcmcia-mem";
+       sr[1].flags     = IORESOURCE_MEM;
+       sr[1].start     = pcmcia_mem_start;
+       sr[1].end       = pcmcia_mem_end;
+
+       sr[2].name      = "pcmcia-io";
+       sr[2].flags     = IORESOURCE_MEM;
+       sr[2].start     = pcmcia_io_start;
+       sr[2].end       = pcmcia_io_end;
+
+       sr[3].name      = "insert";
+       sr[3].flags     = IORESOURCE_IRQ;
+       sr[3].start = sr[3].end = cd_irq;
+
+       sr[4].name      = "card";
+       sr[4].flags     = IORESOURCE_IRQ;
+       sr[4].start = sr[4].end = card_irq;
+
+       i = 5;
+       if (stschg_irq) {
+               sr[i].name      = "stschg";
+               sr[i].flags     = IORESOURCE_IRQ;
+               sr[i].start = sr[i].end = stschg_irq;
+               i++;
+       }
+       if (eject_irq) {
+               sr[i].name      = "eject";
+               sr[i].flags     = IORESOURCE_IRQ;
+               sr[i].start = sr[i].end = eject_irq;
+       }
+
+       pd->resource = sr;
+       pd->num_resources = cnt;
+
+       ret = platform_device_add(pd);
+       if (!ret)
+               return 0;
+
+       platform_device_put(pd);
+out:
+       kfree(sr);
+       return ret;
+}
+
+#define YAMON_SIZE     0x00100000
+#define YAMON_ENV_SIZE 0x00040000
+
+int __init db1x_register_norflash(unsigned long size, int width,
+                                 int swapped)
+{
+       struct physmap_flash_data *pfd;
+       struct platform_device *pd;
+       struct mtd_partition *parts;
+       struct resource *res;
+       int ret, i;
+
+       if (size < (8 * 1024 * 1024))
+               return -EINVAL;
+
+       ret = -ENOMEM;
+       parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL);
+       if (!parts)
+               goto out;
+
+       res = kzalloc(sizeof(struct resource), GFP_KERNEL);
+       if (!res)
+               goto out1;
+
+       pfd = kzalloc(sizeof(struct physmap_flash_data), GFP_KERNEL);
+       if (!pfd)
+               goto out2;
+
+       pd = platform_device_alloc("physmap-flash", 0);
+       if (!pd)
+               goto out3;
+
+       /* NOR flash ends at 0x20000000, regardless of size */
+       res->start = 0x20000000 - size;
+       res->end = 0x20000000 - 1;
+       res->flags = IORESOURCE_MEM;
+
+       /* partition setup.  Most Develboards have a switch which allows
+        * to swap the physical locations of the 2 NOR flash banks.
+        */
+       i = 0;
+       if (!swapped) {
+               /* first NOR chip */
+               parts[i].offset = 0;
+               parts[i].name = "User FS";
+               parts[i].size = size / 2;
+               i++;
+       }
+
+       parts[i].offset = MTDPART_OFS_APPEND;
+       parts[i].name = "User FS 2";
+       parts[i].size = (size / 2) - (0x20000000 - 0x1fc00000);
+       i++;
+
+       parts[i].offset = MTDPART_OFS_APPEND;
+       parts[i].name = "YAMON";
+       parts[i].size = YAMON_SIZE;
+       parts[i].mask_flags = MTD_WRITEABLE;
+       i++;
+
+       parts[i].offset = MTDPART_OFS_APPEND;
+       parts[i].name = "raw kernel";
+       parts[i].size = 0x00400000 - YAMON_SIZE - YAMON_ENV_SIZE;
+       i++;
+
+       parts[i].offset = MTDPART_OFS_APPEND;
+       parts[i].name = "YAMON Env";
+       parts[i].size = YAMON_ENV_SIZE;
+       parts[i].mask_flags = MTD_WRITEABLE;
+       i++;
+
+       if (swapped) {
+               parts[i].offset = MTDPART_OFS_APPEND;
+               parts[i].name = "User FS";
+               parts[i].size = size / 2;
+               i++;
+       }
+
+       pfd->width = width;
+       pfd->parts = parts;
+       pfd->nr_parts = 5;
+
+       pd->dev.platform_data = pfd;
+       pd->resource = res;
+       pd->num_resources = 1;
+
+       ret = platform_device_add(pd);
+       if (!ret)
+               return ret;
+
+       platform_device_put(pd);
+out3:
+       kfree(pfd);
+out2:
+       kfree(res);
+out1:
+       kfree(parts);
+out:
+       return ret;
+}
diff --git a/arch/mips/alchemy/devboards/platform.h b/arch/mips/alchemy/devboards/platform.h
new file mode 100644 (file)
index 0000000..5ac055d
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _DEVBOARD_PLATFORM_H_
+#define _DEVBOARD_PLATFORM_H_
+
+#include <linux/init.h>
+
+int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,
+                                      phys_addr_t pcmcia_attr_len,
+                                      phys_addr_t pcmcia_mem_start,
+                                      phys_addr_t pcmcia_mem_end,
+                                      phys_addr_t pcmcia_io_start,
+                                      phys_addr_t pcmcia_io_end,
+                                      int card_irq,
+                                      int cd_irq,
+                                      int stschg_irq,
+                                      int eject_irq,
+                                      int id);
+
+int __init db1x_register_norflash(unsigned long size, int width,
+                                 int swapped);
+
+#endif
index 632f9862a0fbdb57513f6fefeecdd300c8e360c2..4bbd3133e451cb81a67b51394a0048e95485bb95 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/sysfs.h>
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/gpio.h>
+#include <asm/mach-db1x00/bcsr.h>
 
 /*
  * Generic suspend userspace interface for Alchemy development boards.
@@ -26,6 +27,20 @@ static unsigned long db1x_pm_last_wakesrc;
 
 static int db1x_pm_enter(suspend_state_t state)
 {
+       unsigned short bcsrs[16];
+       int i, j, hasint;
+
+       /* save CPLD regs */
+       hasint = bcsr_read(BCSR_WHOAMI);
+       hasint = BCSR_WHOAMI_BOARD(hasint) >= BCSR_WHOAMI_DB1200;
+       j = (hasint) ? BCSR_MASKSET : BCSR_SYSTEM;
+
+       for (i = BCSR_STATUS; i <= j; i++)
+               bcsrs[i] = bcsr_read(i);
+
+       /* shut off hexleds */
+       bcsr_write(BCSR_HEXCLEAR, 3);
+
        /* enable GPIO based wakeup */
        alchemy_gpio1_input_enable();
 
@@ -52,6 +67,23 @@ static int db1x_pm_enter(suspend_state_t state)
        /* ...and now the sandman can come! */
        au_sleep();
 
+
+       /* restore CPLD regs */
+       for (i = BCSR_STATUS; i <= BCSR_SYSTEM; i++)
+               bcsr_write(i, bcsrs[i]);
+
+       /* restore CPLD int registers */
+       if (hasint) {
+               bcsr_write(BCSR_INTCLR, 0xffff);
+               bcsr_write(BCSR_MASKCLR, 0xffff);
+               bcsr_write(BCSR_INTSTAT, 0xffff);
+               bcsr_write(BCSR_INTSET, bcsrs[BCSR_INTSET]);
+               bcsr_write(BCSR_MASKSET, bcsrs[BCSR_MASKSET]);
+       }
+
+       /* light up hexleds */
+       bcsr_write(BCSR_HEXCLEAR, 0);
+
        return 0;
 }
 
index 0042bd6b1d7dc10495afda0ffc83d372370c7838..b30df5c97ad35e46e534b047c144975c01db6b76 100644 (file)
@@ -60,3 +60,8 @@ void __init prom_init(void)
                strict_strtoul(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
+
+void prom_putchar(unsigned char c)
+{
+    alchemy_uart_putchar(UART0_PHYS_ADDR, c);
+}
index 7c67b3d33bec16a6b132b1e38a12f987d9eeb944..4a53815b3c6c53558f4abf7f1f8a82819fbddd1c 100644 (file)
@@ -6,7 +6,7 @@
 # Makefile for 4G Systems MTX-1 board.
 #
 
-lib-y := init.o board_setup.o irqmap.o
+lib-y := init.o board_setup.o
 obj-y := platform.o
 
 EXTRA_CFLAGS += -Werror
index 45b61c9b82b9a8672d658df5fd2d9be842ccc578..a9f0336e1f1fd626cca60c57748c1430be64c8f4 100644 (file)
 
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
 
+#include <asm/reboot.h>
 #include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
+char irq_tab_alchemy[][5] __initdata = {
+       [0] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 00 - AdapterA-Slot0 (top) */
+       [1] = { -1, AU1500_PCI_INTB, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
+       [2] = { -1, AU1500_PCI_INTC, AU1500_PCI_INTD, 0xff, 0xff }, /* IDSEL 02 - AdapterB-Slot0 (top) */
+       [3] = { -1, AU1500_PCI_INTD, AU1500_PCI_INTC, 0xff, 0xff }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
+       [4] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 04 - AdapterC-Slot0 (top) */
+       [5] = { -1, AU1500_PCI_INTB, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
+       [6] = { -1, AU1500_PCI_INTC, AU1500_PCI_INTD, 0xff, 0xff }, /* IDSEL 06 - AdapterD-Slot0 (top) */
+       [7] = { -1, AU1500_PCI_INTD, AU1500_PCI_INTC, 0xff, 0xff }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
+};
+
 extern int (*board_pci_idsel)(unsigned int devsel, int assert);
 int mtx1_pci_idsel(unsigned int devsel, int assert);
 
-void board_reset(void)
+static void mtx1_reset(char *c)
 {
        /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
        au_writel(0x00000000, 0xAE00001C);
 }
 
-void __init board_setup(void)
+static void mtx1_power_off(void)
 {
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       char *argptr;
-       argptr = prom_getcmdline();
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
+       printk(KERN_ALERT "It's now safe to remove power\n");
+       while (1)
+               asm volatile (".set mips3 ; wait ; .set mips1");
+}
 
+void __init board_setup(void)
+{
        alchemy_gpio2_enable();
 
 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
@@ -86,6 +97,10 @@ void __init board_setup(void)
        alchemy_gpio_direction_output(211, 1);  /* green on */
        alchemy_gpio_direction_output(212, 0);  /* red off */
 
+       pm_power_off = mtx1_power_off;
+       _machine_halt = mtx1_power_off;
+       _machine_restart = mtx1_reset;
+
        printk(KERN_INFO "4G Systems MTX-1 Board\n");
 }
 
@@ -109,3 +124,15 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
        au_sync_udelay(1);
        return 1;
 }
+
+static int __init mtx1_init_irq(void)
+{
+       set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH);
+       set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW);
+
+       return 0;
+}
+arch_initcall(mtx1_init_irq);
index 5e871c8d9e964d96cad974abb20743dabff72c2a..f8d25575fa05a78bb6afce909191691a96a9ba2e 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/init.h>
 
 #include <asm/bootinfo.h>
+#include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
@@ -58,3 +59,8 @@ void __init prom_init(void)
                strict_strtoul(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
+
+void prom_putchar(unsigned char c)
+{
+       alchemy_uart_putchar(UART0_PHYS_ADDR, c);
+}
diff --git a/arch/mips/alchemy/mtx-1/irqmap.c b/arch/mips/alchemy/mtx-1/irqmap.c
deleted file mode 100644 (file)
index f1ab12a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- *     Au1xxx irq map table
- *
- * Copyright 2003 Embedded Edge, LLC
- *             dan@embeddededge.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  SOFTWARE  IS PROVIDED          ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,          INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED          TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN         CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <asm/mach-au1x00/au1000.h>
-
-char irq_tab_alchemy[][5] __initdata = {
-       [0] = { -1, INTA, INTA, INTX, INTX }, /* IDSEL 00 - AdapterA-Slot0 (top) */
-       [1] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
-       [2] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 02 - AdapterB-Slot0 (top) */
-       [3] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
-       [4] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 04 - AdapterC-Slot0 (top) */
-       [5] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
-       [6] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 06 - AdapterD-Slot0 (top) */
-       [7] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
-};
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1500_GPIO_204, IRQF_TRIGGER_HIGH, 0 },
-       { AU1500_GPIO_201, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_202, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_203, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_205, IRQF_TRIGGER_LOW, 0 },
-};
-
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
-}
index db3c526f64d8afd2d7eb39a329ad90d3da627410..4dc81d794cb8dc65b4af71868e3c5eed267d081f 100644 (file)
@@ -5,4 +5,6 @@
 # Makefile for MyCable XXS1500 board.
 #
 
-lib-y := init.o board_setup.o irqmap.o
+lib-y := init.o board_setup.o platform.o
+
+EXTRA_CFLAGS += -Werror
index 4de2d48caed807733385b3966c60052726bd2b99..47b42927607b2eb11d98a1cf8345515260538747 100644 (file)
 
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/pm.h>
 
+#include <asm/reboot.h>
 #include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
-void board_reset(void)
+static void xxs1500_reset(char *c)
 {
        /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
        au_writel(0x00000000, 0xAE00001C);
 }
 
+static void xxs1500_power_off(void)
+{
+       printk(KERN_ALERT "It's now safe to remove power\n");
+       while (1)
+               asm volatile (".set mips3 ; wait ; .set mips1");
+}
+
 void __init board_setup(void)
 {
        u32 pin_func;
 
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-       char *argptr;
-       argptr = prom_getcmdline();
-       argptr = strstr(argptr, "console=");
-       if (argptr == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " console=ttyS0,115200");
-       }
-#endif
+       pm_power_off = xxs1500_power_off;
+       _machine_halt = xxs1500_power_off;
+       _machine_restart = xxs1500_reset;
 
        alchemy_gpio1_input_enable();
        alchemy_gpio2_enable();
@@ -68,22 +72,6 @@ void __init board_setup(void)
        /* Enable DTR = USB power up */
        au_writel(0x01, UART3_ADDR + UART_MCR); /* UART_MCR_DTR is 0x01??? */
 
-#ifdef CONFIG_PCMCIA_XXS1500
-       /* GPIO 0, 1, and 4 are inputs */
-       alchemy_gpio_direction_input(0);
-       alchemy_gpio_direction_input(1);
-       alchemy_gpio_direction_input(4);
-
-       /* GPIO2 208/9/10/11 are inputs */
-       alchemy_gpio_direction_input(208);
-       alchemy_gpio_direction_input(209);
-       alchemy_gpio_direction_input(210);
-       alchemy_gpio_direction_input(211);
-
-       /* Turn off power */
-       alchemy_gpio_direction_output(214, 0);
-#endif
-
 #ifdef CONFIG_PCI
 #if defined(__MIPSEB__)
        au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
@@ -92,3 +80,23 @@ void __init board_setup(void)
 #endif
 #endif
 }
+
+static int __init xxs1500_init_irq(void)
+{
+       set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH);
+       set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO207_INT, IRQF_TRIGGER_LOW);
+
+       set_irq_type(AU1500_GPIO0_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO1_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO2_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO3_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO4_INT, IRQF_TRIGGER_LOW); /* CF irq */
+       set_irq_type(AU1500_GPIO5_INT, IRQF_TRIGGER_LOW);
+
+       return 0;
+}
+arch_initcall(xxs1500_init_irq);
index 456fa142c0934ac094e733889b7c07cd2bbd0644..15125c2fda7d7397de3dcee2ec1f1555babc1f85 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/kernel.h>
 
 #include <asm/bootinfo.h>
+#include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
@@ -56,3 +57,8 @@ void __init prom_init(void)
                strict_strtoul(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
+
+void prom_putchar(unsigned char c)
+{
+       alchemy_uart_putchar(UART0_PHYS_ADDR, c);
+}
diff --git a/arch/mips/alchemy/xxs1500/irqmap.c b/arch/mips/alchemy/xxs1500/irqmap.c
deleted file mode 100644 (file)
index 0f0f301..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- *     Au1xxx irq map table
- *
- * Copyright 2003 Embedded Edge, LLC
- *             dan@embeddededge.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  SOFTWARE  IS PROVIDED          ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,          INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED          TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN         CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <asm/mach-au1x00/au1000.h>
-
-struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
-       { AU1500_GPIO_204, IRQF_TRIGGER_HIGH, 0 },
-       { AU1500_GPIO_201, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_202, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_203, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_205, IRQF_TRIGGER_LOW, 0 },
-       { AU1500_GPIO_207, IRQF_TRIGGER_LOW, 0 },
-
-       { AU1000_GPIO_0, IRQF_TRIGGER_LOW, 0 },
-       { AU1000_GPIO_1, IRQF_TRIGGER_LOW, 0 },
-       { AU1000_GPIO_2, IRQF_TRIGGER_LOW, 0 },
-       { AU1000_GPIO_3, IRQF_TRIGGER_LOW, 0 },
-       { AU1000_GPIO_4, IRQF_TRIGGER_LOW, 0 }, /* CF interrupt */
-       { AU1000_GPIO_5, IRQF_TRIGGER_LOW, 0 },
-};
-
-void __init board_init_irq(void)
-{
-       au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
-}
diff --git a/arch/mips/alchemy/xxs1500/platform.c b/arch/mips/alchemy/xxs1500/platform.c
new file mode 100644 (file)
index 0000000..e87c45c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * XXS1500 board platform device registration
+ *
+ * Copyright (C) 2009 Manuel Lauss
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-au1x00/au1000.h>
+
+static struct resource xxs1500_pcmcia_res[] = {
+       {
+               .name   = "pcmcia-io",
+               .flags  = IORESOURCE_MEM,
+               .start  = PCMCIA_IO_PHYS_ADDR,
+               .end    = PCMCIA_IO_PHYS_ADDR + 0x000400000 - 1,
+       },
+       {
+               .name   = "pcmcia-attr",
+               .flags  = IORESOURCE_MEM,
+               .start  = PCMCIA_ATTR_PHYS_ADDR,
+               .end    = PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
+       },
+       {
+               .name   = "pcmcia-mem",
+               .flags  = IORESOURCE_MEM,
+               .start  = PCMCIA_MEM_PHYS_ADDR,
+               .end    = PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
+       },
+};
+
+static struct platform_device xxs1500_pcmcia_dev = {
+       .name           = "xxs1500_pcmcia",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(xxs1500_pcmcia_res),
+       .resource       = xxs1500_pcmcia_res,
+};
+
+static struct platform_device *xxs1500_devs[] __initdata = {
+       &xxs1500_pcmcia_dev,
+};
+
+static int __init xxs1500_dev_init(void)
+{
+       return platform_add_devices(xxs1500_devs,
+                                   ARRAY_SIZE(xxs1500_devs));
+}
+device_initcall(xxs1500_dev_init);
index cc65c8eb391b06ef8a42bfe88542ed25a36de0da..fc0e7154e8d69835c56eb45891a9e98beca0e82f 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
  * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org>
+ * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
  *
  * 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
@@ -24,6 +25,8 @@
 #include <linux/delay.h>
 #include <linux/gcd.h>
 #include <linux/io.h>
+#include <linux/err.h>
+#include <linux/clk.h>
 
 #include <asm/addrspace.h>
 #include <asm/mach-ar7/ar7.h>
@@ -94,12 +97,16 @@ struct tnetd7200_clocks {
        struct tnetd7200_clock usb;
 };
 
-int ar7_cpu_clock = 150000000;
-EXPORT_SYMBOL(ar7_cpu_clock);
-int ar7_bus_clock = 125000000;
-EXPORT_SYMBOL(ar7_bus_clock);
-int ar7_dsp_clock;
-EXPORT_SYMBOL(ar7_dsp_clock);
+static struct clk bus_clk = {
+       .rate   = 125000000,
+};
+
+static struct clk cpu_clk = {
+       .rate   = 150000000,
+};
+
+static struct clk dsp_clk;
+static struct clk vbus_clk;
 
 static void approximate(int base, int target, int *prediv,
                        int *postdiv, int *mul)
@@ -185,7 +192,7 @@ static int tnetd7300_get_clock(u32 shift, struct tnetd7300_clock *clock,
                base_clock = AR7_XTAL_CLOCK;
                break;
        case BOOT_PLL_SOURCE_CPU:
-               base_clock = ar7_cpu_clock;
+               base_clock = cpu_clk.rate;
                break;
        }
 
@@ -212,11 +219,11 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock,
        u32 *bootcr, u32 frequency)
 {
        int prediv, postdiv, mul;
-       int base_clock = ar7_bus_clock;
+       int base_clock = bus_clk.rate;
 
        switch ((*bootcr & (BOOT_PLL_SOURCE_MASK << shift)) >> shift) {
        case BOOT_PLL_SOURCE_BUS:
-               base_clock = ar7_bus_clock;
+               base_clock = bus_clk.rate;
                break;
        case BOOT_PLL_SOURCE_REF:
                base_clock = AR7_REF_CLOCK;
@@ -225,7 +232,7 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock,
                base_clock = AR7_XTAL_CLOCK;
                break;
        case BOOT_PLL_SOURCE_CPU:
-               base_clock = ar7_cpu_clock;
+               base_clock = cpu_clk.rate;
                break;
        }
 
@@ -247,18 +254,18 @@ static void __init tnetd7300_init_clocks(void)
                                        ioremap_nocache(UR8_REGS_CLOCKS,
                                        sizeof(struct tnetd7300_clocks));
 
-       ar7_bus_clock = tnetd7300_get_clock(BUS_PLL_SOURCE_SHIFT,
+       bus_clk.rate = tnetd7300_get_clock(BUS_PLL_SOURCE_SHIFT,
                &clocks->bus, bootcr, AR7_AFE_CLOCK);
 
        if (*bootcr & BOOT_PLL_ASYNC_MODE)
-               ar7_cpu_clock = tnetd7300_get_clock(CPU_PLL_SOURCE_SHIFT,
+               cpu_clk.rate = tnetd7300_get_clock(CPU_PLL_SOURCE_SHIFT,
                        &clocks->cpu, bootcr, AR7_AFE_CLOCK);
        else
-               ar7_cpu_clock = ar7_bus_clock;
+               cpu_clk.rate = bus_clk.rate;
 
-       if (ar7_dsp_clock == 250000000)
+       if (dsp_clk.rate == 250000000)
                tnetd7300_set_clock(DSP_PLL_SOURCE_SHIFT, &clocks->dsp,
-                       bootcr, ar7_dsp_clock);
+                       bootcr, dsp_clk.rate);
 
        iounmap(clocks);
        iounmap(bootcr);
@@ -343,20 +350,20 @@ static void __init tnetd7200_init_clocks(void)
                printk(KERN_INFO "Clocks: Setting DSP clock\n");
                calculate(dsp_base, TNETD7200_DEF_DSP_CLK,
                        &dsp_prediv, &dsp_postdiv, &dsp_mul);
-               ar7_bus_clock =
+               bus_clk.rate =
                        ((dsp_base / dsp_prediv) * dsp_mul) / dsp_postdiv;
                tnetd7200_set_clock(dsp_base, &clocks->dsp,
                        dsp_prediv, dsp_postdiv * 2, dsp_postdiv, dsp_mul * 2,
-                       ar7_bus_clock);
+                       bus_clk.rate);
 
                printk(KERN_INFO "Clocks: Setting CPU clock\n");
                calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv,
                        &cpu_postdiv, &cpu_mul);
-               ar7_cpu_clock =
+               cpu_clk.rate =
                        ((cpu_base / cpu_prediv) * cpu_mul) / cpu_postdiv;
                tnetd7200_set_clock(cpu_base, &clocks->cpu,
                        cpu_prediv, cpu_postdiv, -1, cpu_mul,
-                       ar7_cpu_clock);
+                       cpu_clk.rate);
 
        } else
                if (*bootcr & BOOT_PLL_2TO1_MODE) {
@@ -365,48 +372,90 @@ static void __init tnetd7200_init_clocks(void)
                        printk(KERN_INFO "Clocks: Setting CPU clock\n");
                        calculate(cpu_base, TNETD7200_DEF_CPU_CLK, &cpu_prediv,
                                &cpu_postdiv, &cpu_mul);
-                       ar7_cpu_clock = ((cpu_base / cpu_prediv) * cpu_mul)
+                       cpu_clk.rate = ((cpu_base / cpu_prediv) * cpu_mul)
                                                                / cpu_postdiv;
                        tnetd7200_set_clock(cpu_base, &clocks->cpu,
                                cpu_prediv, cpu_postdiv, -1, cpu_mul,
-                               ar7_cpu_clock);
+                               cpu_clk.rate);
 
                        printk(KERN_INFO "Clocks: Setting DSP clock\n");
                        calculate(dsp_base, TNETD7200_DEF_DSP_CLK, &dsp_prediv,
                                &dsp_postdiv, &dsp_mul);
-                       ar7_bus_clock = ar7_cpu_clock / 2;
+                       bus_clk.rate = cpu_clk.rate / 2;
                        tnetd7200_set_clock(dsp_base, &clocks->dsp,
                                dsp_prediv, dsp_postdiv * 2, dsp_postdiv,
-                               dsp_mul * 2, ar7_bus_clock);
+                               dsp_mul * 2, bus_clk.rate);
                } else {
                        printk(KERN_INFO "Clocks: Sync 1:1 mode\n");
 
                        printk(KERN_INFO "Clocks: Setting DSP clock\n");
                        calculate(dsp_base, TNETD7200_DEF_DSP_CLK, &dsp_prediv,
                                &dsp_postdiv, &dsp_mul);
-                       ar7_bus_clock = ((dsp_base / dsp_prediv) * dsp_mul)
+                       bus_clk.rate = ((dsp_base / dsp_prediv) * dsp_mul)
                                                                / dsp_postdiv;
                        tnetd7200_set_clock(dsp_base, &clocks->dsp,
                                dsp_prediv, dsp_postdiv * 2, dsp_postdiv,
-                               dsp_mul * 2, ar7_bus_clock);
+                               dsp_mul * 2, bus_clk.rate);
 
-                       ar7_cpu_clock = ar7_bus_clock;
+                       cpu_clk.rate = bus_clk.rate;
                }
 
        printk(KERN_INFO "Clocks: Setting USB clock\n");
-       usb_base = ar7_bus_clock;
+       usb_base = bus_clk.rate;
        calculate(usb_base, TNETD7200_DEF_USB_CLK, &usb_prediv,
                &usb_postdiv, &usb_mul);
        tnetd7200_set_clock(usb_base, &clocks->usb,
                usb_prediv, usb_postdiv, -1, usb_mul,
                TNETD7200_DEF_USB_CLK);
 
-       ar7_dsp_clock = ar7_cpu_clock;
+       dsp_clk.rate = cpu_clk.rate;
 
        iounmap(clocks);
        iounmap(bootcr);
 }
 
+/*
+ * Linux clock API
+ */
+int clk_enable(struct clk *clk)
+{
+       return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+       return clk->rate;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+       if (!strcmp(id, "bus"))
+               return &bus_clk;
+       /* cpmac and vbus share the same rate */
+       if (!strcmp(id, "cpmac"))
+               return &vbus_clk;
+       if (!strcmp(id, "cpu"))
+               return &cpu_clk;
+       if (!strcmp(id, "dsp"));
+               return &dsp_clk;
+       if (!strcmp(id, "vbus"))
+               return &vbus_clk;
+       return ERR_PTR(-ENOENT);
+}
+EXPORT_SYMBOL(clk_get);
+
+void clk_put(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_put);
+
 int __init ar7_init_clocks(void)
 {
        switch (ar7_chip_id()) {
@@ -415,12 +464,14 @@ int __init ar7_init_clocks(void)
                tnetd7200_init_clocks();
                break;
        case AR7_CHIP_7300:
-               ar7_dsp_clock = tnetd7300_dsp_clock();
+               dsp_clk.rate = tnetd7300_dsp_clock();
                tnetd7300_init_clocks();
                break;
        default:
                break;
        }
+       /* adjust vbus clock rate */
+       vbus_clk.rate = bus_clk.rate / 2;
 
        return 0;
 }
index 74e14a3dbf4aad05ab5ac6acdc1c0f55438919af..c32fbb57441aceabb3627abc430755133a7164cd 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
  * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org>
+ * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
  *
  * 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
  */
 
 #include <linux/module.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-ar7/gpio.h>
 
-static const char *ar7_gpio_list[AR7_GPIO_MAX];
+struct ar7_gpio_chip {
+       void __iomem            *regs;
+       struct gpio_chip        chip;
+};
 
-int gpio_request(unsigned gpio, const char *label)
+static int ar7_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
 {
-       if (gpio >= AR7_GPIO_MAX)
-               return -EINVAL;
+       struct ar7_gpio_chip *gpch =
+                               container_of(chip, struct ar7_gpio_chip, chip);
+       void __iomem *gpio_in = gpch->regs + AR7_GPIO_INPUT;
 
-       if (ar7_gpio_list[gpio])
-               return -EBUSY;
+       return readl(gpio_in) & (1 << gpio);
+}
+
+static void ar7_gpio_set_value(struct gpio_chip *chip,
+                               unsigned gpio, int value)
+{
+       struct ar7_gpio_chip *gpch =
+                               container_of(chip, struct ar7_gpio_chip, chip);
+       void __iomem *gpio_out = gpch->regs + AR7_GPIO_OUTPUT;
+       unsigned tmp;
+
+       tmp = readl(gpio_out) & ~(1 << gpio);
+       if (value)
+               tmp |= 1 << gpio;
+       writel(tmp, gpio_out);
+}
+
+static int ar7_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
+{
+       struct ar7_gpio_chip *gpch =
+                               container_of(chip, struct ar7_gpio_chip, chip);
+       void __iomem *gpio_dir = gpch->regs + AR7_GPIO_DIR;
 
-       if (label)
-               ar7_gpio_list[gpio] = label;
-       else
-               ar7_gpio_list[gpio] = "busy";
+       writel(readl(gpio_dir) | (1 << gpio), gpio_dir);
 
        return 0;
 }
-EXPORT_SYMBOL(gpio_request);
 
-void gpio_free(unsigned gpio)
+static int ar7_gpio_direction_output(struct gpio_chip *chip,
+                                       unsigned gpio, int value)
 {
-       BUG_ON(!ar7_gpio_list[gpio]);
-       ar7_gpio_list[gpio] = NULL;
+       struct ar7_gpio_chip *gpch =
+                               container_of(chip, struct ar7_gpio_chip, chip);
+       void __iomem *gpio_dir = gpch->regs + AR7_GPIO_DIR;
+
+       ar7_gpio_set_value(chip, gpio, value);
+       writel(readl(gpio_dir) & ~(1 << gpio), gpio_dir);
+
+       return 0;
+}
+
+static struct ar7_gpio_chip ar7_gpio_chip = {
+       .chip = {
+               .label                  = "ar7-gpio",
+               .direction_input        = ar7_gpio_direction_input,
+               .direction_output       = ar7_gpio_direction_output,
+               .set                    = ar7_gpio_set_value,
+               .get                    = ar7_gpio_get_value,
+               .base                   = 0,
+               .ngpio                  = AR7_GPIO_MAX,
+       }
+};
+
+int ar7_gpio_enable(unsigned gpio)
+{
+       void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE;
+
+       writel(readl(gpio_en) | (1 << gpio), gpio_en);
+
+       return 0;
+}
+EXPORT_SYMBOL(ar7_gpio_enable);
+
+int ar7_gpio_disable(unsigned gpio)
+{
+       void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE;
+
+       writel(readl(gpio_en) & ~(1 << gpio), gpio_en);
+
+       return 0;
+}
+EXPORT_SYMBOL(ar7_gpio_disable);
+
+static int __init ar7_gpio_init(void)
+{
+       int ret;
+
+       ar7_gpio_chip.regs = ioremap_nocache(AR7_REGS_GPIO,
+                                       AR7_REGS_GPIO + 0x10);
+
+       if (!ar7_gpio_chip.regs) {
+               printk(KERN_ERR "ar7-gpio: failed to ioremap regs\n");
+               return -ENOMEM;
+       }
+
+       ret = gpiochip_add(&ar7_gpio_chip.chip);
+       if (ret) {
+               printk(KERN_ERR "ar7-gpio: failed to add gpiochip\n");
+               return ret;
+       }
+       printk(KERN_INFO "ar7-gpio: registered %d GPIOs\n",
+                               ar7_gpio_chip.chip.ngpio);
+       return ret;
 }
-EXPORT_SYMBOL(gpio_free);
+arch_initcall(ar7_gpio_init);
index 696c723dc6d42629cab14aedeb62aef983cf59ed..28abfeef09d6ff21c74c3975721ed70a3fa45d7e 100644 (file)
@@ -62,8 +62,7 @@ void __init prom_meminit(void)
        unsigned long pages;
 
        pages = memsize() >> PAGE_SHIFT;
-       add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT,
-                         BOOT_MEM_RAM);
+       add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT, BOOT_MEM_RAM);
 }
 
 void __init prom_free_prom_memory(void)
index 85169c08d8dca73d03736a90c7d869bea72565c8..246df7aca2e7147b762f6f069381e7d942c17e4a 100644 (file)
 #include <linux/etherdevice.h>
 #include <linux/phy.h>
 #include <linux/phy_fixed.h>
+#include <linux/gpio.h>
+#include <linux/clk.h>
 
 #include <asm/addrspace.h>
 #include <asm/mach-ar7/ar7.h>
 #include <asm/mach-ar7/gpio.h>
 #include <asm/mach-ar7/prom.h>
 
+/*****************************************************************************
+ * VLYNQ Bus
+ ****************************************************************************/
 struct plat_vlynq_data {
        struct plat_vlynq_ops ops;
        int gpio_bit;
        int reset_bit;
 };
 
-
 static int vlynq_on(struct vlynq_device *dev)
 {
-       int result;
+       int ret;
        struct plat_vlynq_data *pdata = dev->dev.platform_data;
 
-       result = gpio_request(pdata->gpio_bit, "vlynq");
-       if (result)
+       ret = gpio_request(pdata->gpio_bit, "vlynq");
+       if (ret)
                goto out;
 
        ar7_device_reset(pdata->reset_bit);
 
-       result = ar7_gpio_disable(pdata->gpio_bit);
-       if (result)
+       ret = ar7_gpio_disable(pdata->gpio_bit);
+       if (ret)
                goto out_enabled;
 
-       result = ar7_gpio_enable(pdata->gpio_bit);
-       if (result)
+       ret = ar7_gpio_enable(pdata->gpio_bit);
+       if (ret)
                goto out_enabled;
 
-       result = gpio_direction_output(pdata->gpio_bit, 0);
-       if (result)
+       ret = gpio_direction_output(pdata->gpio_bit, 0);
+       if (ret)
                goto out_gpio_enabled;
 
        msleep(50);
 
        gpio_set_value(pdata->gpio_bit, 1);
+
        msleep(50);
 
        return 0;
@@ -83,320 +88,384 @@ out_enabled:
        ar7_device_disable(pdata->reset_bit);
        gpio_free(pdata->gpio_bit);
 out:
-       return result;
+       return ret;
 }
 
 static void vlynq_off(struct vlynq_device *dev)
 {
        struct plat_vlynq_data *pdata = dev->dev.platform_data;
+
        ar7_gpio_disable(pdata->gpio_bit);
        gpio_free(pdata->gpio_bit);
        ar7_device_disable(pdata->reset_bit);
 }
 
-static struct resource physmap_flash_resource = {
-       .name = "mem",
-       .flags = IORESOURCE_MEM,
-       .start = 0x10000000,
-       .end = 0x107fffff,
-};
-
-static struct resource cpmac_low_res[] = {
+static struct resource vlynq_low_res[] = {
        {
-               .name = "regs",
-               .flags = IORESOURCE_MEM,
-               .start = AR7_REGS_MAC0,
-               .end = AR7_REGS_MAC0 + 0x7ff,
+               .name   = "regs",
+               .flags  = IORESOURCE_MEM,
+               .start  = AR7_REGS_VLYNQ0,
+               .end    = AR7_REGS_VLYNQ0 + 0xff,
        },
        {
-               .name = "irq",
-               .flags = IORESOURCE_IRQ,
-               .start = 27,
-               .end = 27,
+               .name   = "irq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 29,
+               .end    = 29,
        },
-};
-
-static struct resource cpmac_high_res[] = {
        {
-               .name = "regs",
-               .flags = IORESOURCE_MEM,
-               .start = AR7_REGS_MAC1,
-               .end = AR7_REGS_MAC1 + 0x7ff,
+               .name   = "mem",
+               .flags  = IORESOURCE_MEM,
+               .start  = 0x04000000,
+               .end    = 0x04ffffff,
        },
        {
-               .name = "irq",
-               .flags = IORESOURCE_IRQ,
-               .start = 41,
-               .end = 41,
+               .name   = "devirq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 80,
+               .end    = 111,
        },
 };
 
-static struct resource vlynq_low_res[] = {
+static struct resource vlynq_high_res[] = {
        {
-               .name = "regs",
-               .flags = IORESOURCE_MEM,
-               .start = AR7_REGS_VLYNQ0,
-               .end = AR7_REGS_VLYNQ0 + 0xff,
+               .name   = "regs",
+               .flags  = IORESOURCE_MEM,
+               .start  = AR7_REGS_VLYNQ1,
+               .end    = AR7_REGS_VLYNQ1 + 0xff,
        },
        {
-               .name = "irq",
-               .flags = IORESOURCE_IRQ,
-               .start = 29,
-               .end = 29,
+               .name   = "irq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 33,
+               .end    = 33,
        },
        {
-               .name = "mem",
-               .flags = IORESOURCE_MEM,
-               .start = 0x04000000,
-               .end = 0x04ffffff,
+               .name   = "mem",
+               .flags  = IORESOURCE_MEM,
+               .start  = 0x0c000000,
+               .end    = 0x0cffffff,
        },
        {
-               .name = "devirq",
-               .flags = IORESOURCE_IRQ,
-               .start = 80,
-               .end = 111,
+               .name   = "devirq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 112,
+               .end    = 143,
        },
 };
 
-static struct resource vlynq_high_res[] = {
-       {
-               .name = "regs",
-               .flags = IORESOURCE_MEM,
-               .start = AR7_REGS_VLYNQ1,
-               .end = AR7_REGS_VLYNQ1 + 0xff,
+static struct plat_vlynq_data vlynq_low_data = {
+       .ops = {
+               .on     = vlynq_on,
+               .off    = vlynq_off,
        },
-       {
-               .name = "irq",
-               .flags = IORESOURCE_IRQ,
-               .start = 33,
-               .end = 33,
+       .reset_bit      = 20,
+       .gpio_bit       = 18,
+};
+
+static struct plat_vlynq_data vlynq_high_data = {
+       .ops = {
+               .on     = vlynq_on,
+               .off    = vlynq_off,
        },
-       {
-               .name = "mem",
-               .flags = IORESOURCE_MEM,
-               .start = 0x0c000000,
-               .end = 0x0cffffff,
+       .reset_bit      = 26,
+       .gpio_bit       = 19,
+};
+
+static struct platform_device vlynq_low = {
+       .id             = 0,
+       .name           = "vlynq",
+       .dev = {
+               .platform_data  = &vlynq_low_data,
        },
-       {
-               .name = "devirq",
-               .flags = IORESOURCE_IRQ,
-               .start = 112,
-               .end = 143,
+       .resource       = vlynq_low_res,
+       .num_resources  = ARRAY_SIZE(vlynq_low_res),
+};
+
+static struct platform_device vlynq_high = {
+       .id             = 1,
+       .name           = "vlynq",
+       .dev = {
+               .platform_data  = &vlynq_high_data,
        },
+       .resource       = vlynq_high_res,
+       .num_resources  = ARRAY_SIZE(vlynq_high_res),
 };
 
-static struct resource usb_res[] = {
-       {
-               .name = "regs",
-               .flags = IORESOURCE_MEM,
-               .start = AR7_REGS_USB,
-               .end = AR7_REGS_USB + 0xff,
+/*****************************************************************************
+ * Flash
+ ****************************************************************************/
+static struct resource physmap_flash_resource = {
+       .name   = "mem",
+       .flags  = IORESOURCE_MEM,
+       .start  = 0x10000000,
+       .end    = 0x107fffff,
+};
+
+static struct physmap_flash_data physmap_flash_data = {
+       .width  = 2,
+};
+
+static struct platform_device physmap_flash = {
+       .name           = "physmap-flash",
+       .dev = {
+               .platform_data  = &physmap_flash_data,
        },
+       .resource       = &physmap_flash_resource,
+       .num_resources  = 1,
+};
+
+/*****************************************************************************
+ * Ethernet
+ ****************************************************************************/
+static struct resource cpmac_low_res[] = {
        {
-               .name = "irq",
-               .flags = IORESOURCE_IRQ,
-               .start = 32,
-               .end = 32,
+               .name   = "regs",
+               .flags  = IORESOURCE_MEM,
+               .start  = AR7_REGS_MAC0,
+               .end    = AR7_REGS_MAC0 + 0x7ff,
        },
        {
-               .name = "mem",
-               .flags = IORESOURCE_MEM,
-               .start = 0x03400000,
-               .end = 0x034001fff,
+               .name   = "irq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 27,
+               .end    = 27,
        },
 };
 
-static struct physmap_flash_data physmap_flash_data = {
-       .width = 2,
+static struct resource cpmac_high_res[] = {
+       {
+               .name   = "regs",
+               .flags  = IORESOURCE_MEM,
+               .start  = AR7_REGS_MAC1,
+               .end    = AR7_REGS_MAC1 + 0x7ff,
+       },
+       {
+               .name   = "irq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 41,
+               .end    = 41,
+       },
 };
 
 static struct fixed_phy_status fixed_phy_status __initdata = {
-       .link = 1,
-       .speed = 100,
-       .duplex = 1,
+       .link           = 1,
+       .speed          = 100,
+       .duplex         = 1,
 };
 
 static struct plat_cpmac_data cpmac_low_data = {
-       .reset_bit = 17,
-       .power_bit = 20,
-       .phy_mask = 0x80000000,
+       .reset_bit      = 17,
+       .power_bit      = 20,
+       .phy_mask       = 0x80000000,
 };
 
 static struct plat_cpmac_data cpmac_high_data = {
-       .reset_bit = 21,
-       .power_bit = 22,
-       .phy_mask = 0x7fffffff,
-};
-
-static struct plat_vlynq_data vlynq_low_data = {
-       .ops.on = vlynq_on,
-       .ops.off = vlynq_off,
-       .reset_bit = 20,
-       .gpio_bit = 18,
-};
-
-static struct plat_vlynq_data vlynq_high_data = {
-       .ops.on = vlynq_on,
-       .ops.off = vlynq_off,
-       .reset_bit = 16,
-       .gpio_bit = 19,
-};
-
-static struct platform_device physmap_flash = {
-       .id = 0,
-       .name = "physmap-flash",
-       .dev.platform_data = &physmap_flash_data,
-       .resource = &physmap_flash_resource,
-       .num_resources = 1,
+       .reset_bit      = 21,
+       .power_bit      = 22,
+       .phy_mask       = 0x7fffffff,
 };
 
 static u64 cpmac_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device cpmac_low = {
-       .id = 0,
-       .name = "cpmac",
+       .id             = 0,
+       .name           = "cpmac",
        .dev = {
-               .dma_mask = &cpmac_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &cpmac_low_data,
+               .dma_mask               = &cpmac_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &cpmac_low_data,
        },
-       .resource = cpmac_low_res,
-       .num_resources = ARRAY_SIZE(cpmac_low_res),
+       .resource       = cpmac_low_res,
+       .num_resources  = ARRAY_SIZE(cpmac_low_res),
 };
 
 static struct platform_device cpmac_high = {
-       .id = 1,
-       .name = "cpmac",
+       .id             = 1,
+       .name           = "cpmac",
        .dev = {
-               .dma_mask = &cpmac_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &cpmac_high_data,
+               .dma_mask               = &cpmac_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &cpmac_high_data,
        },
-       .resource = cpmac_high_res,
-       .num_resources = ARRAY_SIZE(cpmac_high_res),
+       .resource       = cpmac_high_res,
+       .num_resources  = ARRAY_SIZE(cpmac_high_res),
 };
 
-static struct platform_device vlynq_low = {
-       .id = 0,
-       .name = "vlynq",
-       .dev.platform_data = &vlynq_low_data,
-       .resource = vlynq_low_res,
-       .num_resources = ARRAY_SIZE(vlynq_low_res),
-};
+static inline unsigned char char2hex(char h)
+{
+       switch (h) {
+       case '0': case '1': case '2': case '3': case '4':
+       case '5': case '6': case '7': case '8': case '9':
+               return h - '0';
+       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+               return h - 'A' + 10;
+       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+               return h - 'a' + 10;
+       default:
+               return 0;
+       }
+}
 
-static struct platform_device vlynq_high = {
-       .id = 1,
-       .name = "vlynq",
-       .dev.platform_data = &vlynq_high_data,
-       .resource = vlynq_high_res,
-       .num_resources = ARRAY_SIZE(vlynq_high_res),
+static void cpmac_get_mac(int instance, unsigned char *dev_addr)
+{
+       int i;
+       char name[5], default_mac[ETH_ALEN], *mac;
+
+       mac = NULL;
+       sprintf(name, "mac%c", 'a' + instance);
+       mac = prom_getenv(name);
+       if (!mac) {
+               sprintf(name, "mac%c", 'a');
+               mac = prom_getenv(name);
+       }
+       if (!mac) {
+               random_ether_addr(default_mac);
+               mac = default_mac;
+       }
+       for (i = 0; i < 6; i++)
+               dev_addr[i] = (char2hex(mac[i * 3]) << 4) +
+                       char2hex(mac[i * 3 + 1]);
+}
+
+/*****************************************************************************
+ * USB
+ ****************************************************************************/
+static struct resource usb_res[] = {
+       {
+               .name   = "regs",
+               .flags  = IORESOURCE_MEM,
+               .start  = AR7_REGS_USB,
+               .end    = AR7_REGS_USB + 0xff,
+       },
+       {
+               .name   = "irq",
+               .flags  = IORESOURCE_IRQ,
+               .start  = 32,
+               .end    = 32,
+       },
+       {
+               .name   = "mem",
+               .flags  = IORESOURCE_MEM,
+               .start  = 0x03400000,
+               .end    = 0x03401fff,
+       },
 };
 
+static struct platform_device ar7_udc = {
+       .name           = "ar7_udc",
+       .resource       = usb_res,
+       .num_resources  = ARRAY_SIZE(usb_res),
+};
 
+/*****************************************************************************
+ * LEDs
+ ****************************************************************************/
 static struct gpio_led default_leds[] = {
        {
-               .name = "status",
-               .gpio = 8,
-               .active_low = 1,
+               .name                   = "status",
+               .gpio                   = 8,
+               .active_low             = 1,
        },
 };
 
 static struct gpio_led dsl502t_leds[] = {
        {
-               .name = "status",
-               .gpio = 9,
-               .active_low = 1,
+               .name                   = "status",
+               .gpio                   = 9,
+               .active_low             = 1,
        },
        {
-               .name = "ethernet",
-               .gpio = 7,
-               .active_low = 1,
+               .name                   = "ethernet",
+               .gpio                   = 7,
+               .active_low             = 1,
        },
        {
-               .name = "usb",
-               .gpio = 12,
-               .active_low = 1,
+               .name                   = "usb",
+               .gpio                   = 12,
+               .active_low             = 1,
        },
 };
 
 static struct gpio_led dg834g_leds[] = {
        {
-               .name = "ppp",
-               .gpio = 6,
-               .active_low = 1,
+               .name                   = "ppp",
+               .gpio                   = 6,
+               .active_low             = 1,
        },
        {
-               .name = "status",
-               .gpio = 7,
-               .active_low = 1,
+               .name                   = "status",
+               .gpio                   = 7,
+               .active_low             = 1,
        },
        {
-               .name = "adsl",
-               .gpio = 8,
-               .active_low = 1,
+               .name                   = "adsl",
+               .gpio                   = 8,
+               .active_low             = 1,
        },
        {
-               .name = "wifi",
-               .gpio = 12,
-               .active_low = 1,
+               .name                   = "wifi",
+               .gpio                   = 12,
+               .active_low             = 1,
        },
        {
-               .name = "power",
-               .gpio = 14,
-               .active_low = 1,
-               .default_trigger = "default-on",
+               .name                   = "power",
+               .gpio                   = 14,
+               .active_low             = 1,
+               .default_trigger        = "default-on",
        },
 };
 
 static struct gpio_led fb_sl_leds[] = {
        {
-               .name = "1",
-               .gpio = 7,
+               .name                   = "1",
+               .gpio                   = 7,
        },
        {
-               .name = "2",
-               .gpio = 13,
-               .active_low = 1,
+               .name                   = "2",
+               .gpio                   = 13,
+               .active_low             = 1,
        },
        {
-               .name = "3",
-               .gpio = 10,
-               .active_low = 1,
+               .name                   = "3",
+               .gpio                   = 10,
+               .active_low             = 1,
        },
        {
-               .name = "4",
-               .gpio = 12,
-               .active_low = 1,
+               .name                   = "4",
+               .gpio                   = 12,
+               .active_low             = 1,
        },
        {
-               .name = "5",
-               .gpio = 9,
-               .active_low = 1,
+               .name                   = "5",
+               .gpio                   = 9,
+               .active_low             = 1,
        },
 };
 
 static struct gpio_led fb_fon_leds[] = {
        {
-               .name = "1",
-               .gpio = 8,
+               .name                   = "1",
+               .gpio                   = 8,
        },
        {
-               .name = "2",
-               .gpio = 3,
-               .active_low = 1,
+               .name                   = "2",
+               .gpio                   = 3,
+               .active_low             = 1,
        },
        {
-               .name = "3",
-               .gpio = 5,
+               .name                   = "3",
+               .gpio                   = 5,
        },
        {
-               .name = "4",
-               .gpio = 4,
-               .active_low = 1,
+               .name                   = "4",
+               .gpio                   = 4,
+               .active_low             = 1,
        },
        {
-               .name = "5",
-               .gpio = 11,
-               .active_low = 1,
+               .name                   = "5",
+               .gpio                   = 11,
+               .active_low             = 1,
        },
 };
 
@@ -404,69 +473,11 @@ static struct gpio_led_platform_data ar7_led_data;
 
 static struct platform_device ar7_gpio_leds = {
        .name = "leds-gpio",
-       .id = -1,
        .dev = {
                .platform_data = &ar7_led_data,
        }
 };
 
-static struct platform_device ar7_udc = {
-       .id = -1,
-       .name = "ar7_udc",
-       .resource = usb_res,
-       .num_resources = ARRAY_SIZE(usb_res),
-};
-
-static struct resource ar7_wdt_res = {
-       .name = "regs",
-       .start = -1, /* Filled at runtime */
-       .end = -1, /* Filled at runtime */
-       .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device ar7_wdt = {
-       .id = -1,
-       .name  = "ar7_wdt",
-       .resource = &ar7_wdt_res,
-       .num_resources = 1,
-};
-
-static inline unsigned char char2hex(char h)
-{
-       switch (h) {
-       case '0': case '1': case '2': case '3': case '4':
-       case '5': case '6': case '7': case '8': case '9':
-               return h - '0';
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-               return h - 'A' + 10;
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-               return h - 'a' + 10;
-       default:
-               return 0;
-       }
-}
-
-static void cpmac_get_mac(int instance, unsigned char *dev_addr)
-{
-       int i;
-       char name[5], default_mac[ETH_ALEN], *mac;
-
-       mac = NULL;
-       sprintf(name, "mac%c", 'a' + instance);
-       mac = prom_getenv(name);
-       if (!mac) {
-               sprintf(name, "mac%c", 'a');
-               mac = prom_getenv(name);
-       }
-       if (!mac) {
-               random_ether_addr(default_mac);
-               mac = default_mac;
-       }
-       for (i = 0; i < 6; i++)
-               dev_addr[i] = (char2hex(mac[i * 3]) << 4) +
-                       char2hex(mac[i * 3 + 1]);
-}
-
 static void __init detect_leds(void)
 {
        char *prid, *usb_prod;
@@ -499,111 +510,149 @@ static void __init detect_leds(void)
        }
 }
 
-static int __init ar7_register_devices(void)
+/*****************************************************************************
+ * Watchdog
+ ****************************************************************************/
+static struct resource ar7_wdt_res = {
+       .name           = "regs",
+       .flags          = IORESOURCE_MEM,
+       .start          = -1,   /* Filled at runtime */
+       .end            = -1,   /* Filled at runtime */
+};
+
+static struct platform_device ar7_wdt = {
+       .name           = "ar7_wdt",
+       .resource       = &ar7_wdt_res,
+       .num_resources  = 1,
+};
+
+/*****************************************************************************
+ * Init
+ ****************************************************************************/
+static int __init ar7_register_uarts(void)
 {
-       u16 chip_id;
-       int res;
-       u32 *bootcr, val;
 #ifdef CONFIG_SERIAL_8250
-       static struct uart_port uart_port[2] __initdata;
-
-       memset(uart_port, 0, sizeof(struct uart_port) * 2);
-
-       uart_port[0].type = PORT_16550A;
-       uart_port[0].line = 0;
-       uart_port[0].irq = AR7_IRQ_UART0;
-       uart_port[0].uartclk = ar7_bus_freq() / 2;
-       uart_port[0].iotype = UPIO_MEM32;
-       uart_port[0].mapbase = AR7_REGS_UART0;
-       uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
-       uart_port[0].regshift = 2;
-       res = early_serial_setup(&uart_port[0]);
+       static struct uart_port uart_port __initdata;
+       struct clk *bus_clk;
+       int res;
+
+       memset(&uart_port, 0, sizeof(struct uart_port));
+
+       bus_clk = clk_get(NULL, "bus");
+       if (IS_ERR(bus_clk))
+               panic("unable to get bus clk\n");
+
+       uart_port.type          = PORT_16550A;
+       uart_port.uartclk       = clk_get_rate(bus_clk) / 2;
+       uart_port.iotype        = UPIO_MEM32;
+       uart_port.regshift      = 2;
+
+       uart_port.line          = 0;
+       uart_port.irq           = AR7_IRQ_UART0;
+       uart_port.mapbase       = AR7_REGS_UART0;
+       uart_port.membase       = ioremap(uart_port.mapbase, 256);
+
+       res = early_serial_setup(&uart_port);
        if (res)
                return res;
 
-
        /* Only TNETD73xx have a second serial port */
        if (ar7_has_second_uart()) {
-               uart_port[1].type = PORT_16550A;
-               uart_port[1].line = 1;
-               uart_port[1].irq = AR7_IRQ_UART1;
-               uart_port[1].uartclk = ar7_bus_freq() / 2;
-               uart_port[1].iotype = UPIO_MEM32;
-               uart_port[1].mapbase = UR8_REGS_UART1;
-               uart_port[1].membase = ioremap(uart_port[1].mapbase, 256);
-               uart_port[1].regshift = 2;
-               res = early_serial_setup(&uart_port[1]);
+               uart_port.line          = 1;
+               uart_port.irq           = AR7_IRQ_UART1;
+               uart_port.mapbase       = UR8_REGS_UART1;
+               uart_port.membase       = ioremap(uart_port.mapbase, 256);
+
+               res = early_serial_setup(&uart_port);
                if (res)
                        return res;
        }
-#endif /* CONFIG_SERIAL_8250 */
+#endif
+
+       return 0;
+}
+
+static int __init ar7_register_devices(void)
+{
+       void __iomem *bootcr;
+       u32 val;
+       u16 chip_id;
+       int res;
+
+       res = ar7_register_uarts();
+       if (res)
+               pr_err("unable to setup uart(s): %d\n", res);
+
        res = platform_device_register(&physmap_flash);
        if (res)
-               return res;
+               pr_warning("unable to register physmap-flash: %d\n", res);
 
        ar7_device_disable(vlynq_low_data.reset_bit);
        res = platform_device_register(&vlynq_low);
        if (res)
-               return res;
+               pr_warning("unable to register vlynq-low: %d\n", res);
 
        if (ar7_has_high_vlynq()) {
                ar7_device_disable(vlynq_high_data.reset_bit);
                res = platform_device_register(&vlynq_high);
                if (res)
-                       return res;
+                       pr_warning("unable to register vlynq-high: %d\n", res);
        }
 
        if (ar7_has_high_cpmac()) {
-               res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
-               if (res && res != -ENODEV)
-                       return res;
-               cpmac_get_mac(1, cpmac_high_data.dev_addr);
-               res = platform_device_register(&cpmac_high);
-               if (res)
-                       return res;
-       } else {
+               if (!res) {
+                       cpmac_get_mac(1, cpmac_high_data.dev_addr);
+
+                       res = platform_device_register(&cpmac_high);
+                       if (res)
+                               pr_warning("unable to register cpmac-high: %d\n", res);
+               } else
+                       pr_warning("unable to add cpmac-high phy: %d\n", res);
+       } else
                cpmac_low_data.phy_mask = 0xffffffff;
-       }
 
        res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
-       if (res && res != -ENODEV)
-               return res;
-
-       cpmac_get_mac(0, cpmac_low_data.dev_addr);
-       res = platform_device_register(&cpmac_low);
-       if (res)
-               return res;
+       if (!res) {
+               cpmac_get_mac(0, cpmac_low_data.dev_addr);
+               res = platform_device_register(&cpmac_low);
+               if (res)
+                       pr_warning("unable to register cpmac-low: %d\n", res);
+       } else
+               pr_warning("unable to add cpmac-low phy: %d\n", res);
 
        detect_leds();
        res = platform_device_register(&ar7_gpio_leds);
        if (res)
-               return res;
+               pr_warning("unable to register leds: %d\n", res);
 
        res = platform_device_register(&ar7_udc);
-
-       chip_id = ar7_chip_id();
-       switch (chip_id) {
-       case AR7_CHIP_7100:
-       case AR7_CHIP_7200:
-               ar7_wdt_res.start = AR7_REGS_WDT;
-               break;
-       case AR7_CHIP_7300:
-               ar7_wdt_res.start = UR8_REGS_WDT;
-               break;
-       default:
-               break;
-       }
-
-       ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
-
-       bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
-       val = *bootcr;
-       iounmap(bootcr);
+       if (res)
+               pr_warning("unable to register usb slave: %d\n", res);
 
        /* Register watchdog only if enabled in hardware */
-       if (val & AR7_WDT_HW_ENA)
+       bootcr = ioremap_nocache(AR7_REGS_DCL, 4);
+       val = readl(bootcr);
+       iounmap(bootcr);
+       if (val & AR7_WDT_HW_ENA) {
+               chip_id = ar7_chip_id();
+               switch (chip_id) {
+               case AR7_CHIP_7100:
+               case AR7_CHIP_7200:
+                       ar7_wdt_res.start = AR7_REGS_WDT;
+                       break;
+               case AR7_CHIP_7300:
+                       ar7_wdt_res.start = UR8_REGS_WDT;
+                       break;
+               default:
+                       break;
+               }
+
+               ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
                res = platform_device_register(&ar7_wdt);
+               if (res)
+                       pr_warning("unable to register watchdog: %d\n", res);
+       }
 
-       return res;
+       return 0;
 }
 arch_initcall(ar7_register_devices);
index c1fdd368281292618fa568793b0eceaf7d5b8937..52385790e5c168c70eacec3dc74feab7d755b459 100644 (file)
@@ -32,8 +32,8 @@
 #define MAX_ENTRY 80
 
 struct env_var {
-       char *name;
-       char *value;
+       char    *name;
+       char    *value;
 };
 
 static struct env_var adam2_env[MAX_ENTRY];
@@ -41,6 +41,7 @@ static struct env_var adam2_env[MAX_ENTRY];
 char *prom_getenv(const char *name)
 {
        int i;
+
        for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++)
                if (!strcmp(name, adam2_env[i].name))
                        return adam2_env[i].value;
@@ -49,65 +50,50 @@ char *prom_getenv(const char *name)
 }
 EXPORT_SYMBOL(prom_getenv);
 
-char * __init prom_getcmdline(void)
-{
-       return &(arcs_cmdline[0]);
-}
-
 static void  __init ar7_init_cmdline(int argc, char *argv[])
 {
-       char *cp;
-       int actr;
-
-       actr = 1; /* Always ignore argv[0] */
+       int i;
 
-       cp = &(arcs_cmdline[0]);
-       while (actr < argc) {
-               strcpy(cp, argv[actr]);
-               cp += strlen(argv[actr]);
-               *cp++ = ' ';
-               actr++;
-       }
-       if (cp != &(arcs_cmdline[0])) {
-               /* get rid of trailing space */
-               --cp;
-               *cp = '\0';
+       for (i = 1; i < argc; i++) {
+               strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
+               if (i < (argc - 1))
+                       strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
        }
 }
 
 struct psbl_rec {
-       u32 psbl_size;
-       u32 env_base;
-       u32 env_size;
-       u32 ffs_base;
-       u32 ffs_size;
+       u32     psbl_size;
+       u32     env_base;
+       u32     env_size;
+       u32     ffs_base;
+       u32     ffs_size;
 };
 
 static __initdata char psp_env_version[] = "TIENV0.8";
 
 struct psp_env_chunk {
-       u8 num;
-       u8 ctrl;
-       u16 csum;
-       u8 len;
-       char data[11];
+       u8      num;
+       u8      ctrl;
+       u16     csum;
+       u8      len;
+       char    data[11];
 } __attribute__ ((packed));
 
 struct psp_var_map_entry {
-       u8 num;
-       char *value;
+       u8      num;
+       char    *value;
 };
 
 static struct psp_var_map_entry psp_var_map[] = {
-       { 1, "cpufrequency" },
-       { 2, "memsize" },
-       { 3, "flashsize" },
-       { 4, "modetty0" },
-       { 5, "modetty1" },
-       { 8, "maca" },
-       { 9, "macb" },
-       { 28, "sysfrequency" },
-       { 38, "mipsfrequency" },
+       {  1,   "cpufrequency" },
+       {  2,   "memsize" },
+       {  3,   "flashsize" },
+       {  4,   "modetty0" },
+       {  5,   "modetty1" },
+       {  8,   "maca" },
+       {  9,   "macb" },
+       { 28,   "sysfrequency" },
+       { 38,   "mipsfrequency" },
 };
 
 /*
@@ -154,6 +140,7 @@ static char * __init lookup_psp_var_map(u8 num)
 static void __init add_adam2_var(char *name, char *value)
 {
        int i;
+
        for (i = 0; i < MAX_ENTRY; i++) {
                if (!adam2_env[i].name) {
                        adam2_env[i].name = name;
@@ -216,7 +203,7 @@ static void __init console_config(void)
        char parity = '\0', bits = '\0', flow = '\0';
        char *s, *p;
 
-       if (strstr(prom_getcmdline(), "console="))
+       if (strstr(arcs_cmdline, "console="))
                return;
 
        s = prom_getenv("modetty0");
@@ -250,7 +237,7 @@ static void __init console_config(void)
        else
                sprintf(console_string, " console=ttyS0,%d%c%c", baud, parity,
                        bits);
-       strcat(prom_getcmdline(), console_string);
+       strlcat(arcs_cmdline, console_string, COMMAND_LINE_SIZE);
 #endif
 }
 
@@ -279,4 +266,3 @@ int prom_putchar(char c)
        serial_out(UART_TX, c);
        return 1;
 }
-
index 39f6b5b9646345b0def3722815656ae49c56951b..3a801d2cb6e5531ce64622c36a58e28b1263faea 100644 (file)
@@ -26,8 +26,8 @@
 
 static void ar7_machine_restart(char *command)
 {
-       u32 *softres_reg = ioremap(AR7_REGS_RESET +
-                                         AR7_RESET_SOFTWARE, 1);
+       u32 *softres_reg = ioremap(AR7_REGS_RESET + AR7_RESET_SOFTWARE, 1);
+
        writel(1, softres_reg);
 }
 
@@ -41,6 +41,7 @@ static void ar7_machine_power_off(void)
 {
        u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
        u32 power_state = readl(power_reg) | (3 << 30);
+
        writel(power_state, power_reg);
        ar7_machine_halt();
 }
@@ -49,14 +50,14 @@ const char *get_system_type(void)
 {
        u16 chip_id = ar7_chip_id();
        switch (chip_id) {
-       case AR7_CHIP_7300:
-               return "TI AR7 (TNETD7300)";
        case AR7_CHIP_7100:
                return "TI AR7 (TNETD7100)";
        case AR7_CHIP_7200:
                return "TI AR7 (TNETD7200)";
+       case AR7_CHIP_7300:
+               return "TI AR7 (TNETD7300)";
        default:
-               return "TI AR7 (Unknown)";
+               return "TI AR7 (unknown)";
        }
 }
 
@@ -70,7 +71,6 @@ console_initcall(ar7_init_console);
  * Initializes basic routines and structures pointers, memory size (as
  * given by the bios and saves the command line.
  */
-
 void __init plat_mem_setup(void)
 {
        unsigned long io_base;
@@ -88,6 +88,5 @@ void __init plat_mem_setup(void)
        prom_meminit();
 
        printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
-                                       get_system_type(),
-               ar7_chip_id(), ar7_chip_rev());
+                       get_system_type(), ar7_chip_id(), ar7_chip_rev());
 }
index a1fba894daa25b6d15f27e545e01ad26013dfc36..5fb8a01340855f402340914784c65924faaa163e 100644 (file)
 
 #include <linux/init.h>
 #include <linux/time.h>
+#include <linux/err.h>
+#include <linux/clk.h>
 
 #include <asm/time.h>
 #include <asm/mach-ar7/ar7.h>
 
 void __init plat_time_init(void)
 {
-       mips_hpt_frequency = ar7_cpu_freq() / 2;
+       struct clk *cpu_clk;
+
+       cpu_clk = clk_get(NULL, "cpu");
+       if (IS_ERR(cpu_clk)) {
+               printk(KERN_ERR "unable to get cpu clock\n");
+               return;
+       }
+
+       mips_hpt_frequency = clk_get_rate(cpu_clk) / 2;
 }
index 9b798800258c3db159cb8ea78718d47feefe2836..e4a5ee9c97217381e324774d2c4777f7801d85c5 100644 (file)
@@ -59,4 +59,3 @@ int gpio_to_irq(unsigned gpio)
                return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(gpio_to_irq);
-
index c51405e5792117d868b99dc2fe21c30c8f06061d..0fa646c5a844bfb18186db1625c26e1b6f6e5114 100644 (file)
@@ -141,6 +141,14 @@ static __init void prom_init_mem(void)
                        break;
        }
 
+       /* Ignoring the last page when ddr size is 128M. Cached
+        * accesses to last page is causing the processor to prefetch
+        * using address above 128M stepping out of the ddr address
+        * space.
+        */
+       if (mem == 0x8000000)
+               mem -= 0x1000;
+
        add_memory_region(0, mem, BOOT_MEM_RAM);
 }
 
@@ -155,4 +163,3 @@ void __init prom_init(void)
 void __init prom_free_prom_memory(void)
 {
 }
-
index 2f580fa160c9f2ca33de248385ce743c8cf58365..d442e11625fa6aa9c18d3ed31a3b283c2a73fd94 100644 (file)
@@ -121,4 +121,3 @@ void __init plat_mem_setup(void)
        _machine_halt = bcm47xx_machine_halt;
        pm_power_off = bcm47xx_machine_halt;
 }
-
index ef00e7f58c24f16d998430b04c899aaf4d364775..74d06965326f7ccd6e140b367b088a04d915d809 100644 (file)
@@ -164,4 +164,3 @@ static int __init wgt634u_init(void)
 }
 
 module_init(wgt634u_init);
-
index 1fe412c431712a9399928786ae4f405231c37035..ea17941168ca2d0cd5be6b69a13892ce3b3c6978 100644 (file)
@@ -836,4 +836,3 @@ int __init board_register_devices(void)
 
        return 0;
 }
-
index ba522bdcde4b85ca53ce4fd12a96b7ebe509ae97..5f11359815688d5350a56cce5704971e4e533b1a 100644 (file)
@@ -17,8 +17,8 @@
 #include <bcm63xx_timer.h>
 #include <bcm63xx_regs.h>
 
-static DEFINE_SPINLOCK(timer_reg_lock);
-static DEFINE_SPINLOCK(timer_data_lock);
+static DEFINE_RAW_SPINLOCK(timer_reg_lock);
+static DEFINE_RAW_SPINLOCK(timer_data_lock);
 static struct clk *periph_clk;
 
 static struct timer_data {
@@ -31,23 +31,23 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
        u32 stat;
        int i;
 
-       spin_lock(&timer_reg_lock);
+       raw_spin_lock(&timer_reg_lock);
        stat = bcm_timer_readl(TIMER_IRQSTAT_REG);
        bcm_timer_writel(stat, TIMER_IRQSTAT_REG);
-       spin_unlock(&timer_reg_lock);
+       raw_spin_unlock(&timer_reg_lock);
 
        for (i = 0; i < BCM63XX_TIMER_COUNT; i++) {
                if (!(stat & TIMER_IRQSTAT_TIMER_CAUSE(i)))
                        continue;
 
-               spin_lock(&timer_data_lock);
+               raw_spin_lock(&timer_data_lock);
                if (!timer_data[i].cb) {
-                       spin_unlock(&timer_data_lock);
+                       raw_spin_unlock(&timer_data_lock);
                        continue;
                }
 
                timer_data[i].cb(timer_data[i].data);
-               spin_unlock(&timer_data_lock);
+               raw_spin_unlock(&timer_data_lock);
        }
 
        return IRQ_HANDLED;
@@ -61,7 +61,7 @@ int bcm63xx_timer_enable(int id)
        if (id >= BCM63XX_TIMER_COUNT)
                return -EINVAL;
 
-       spin_lock_irqsave(&timer_reg_lock, flags);
+       raw_spin_lock_irqsave(&timer_reg_lock, flags);
 
        reg = bcm_timer_readl(TIMER_CTLx_REG(id));
        reg |= TIMER_CTL_ENABLE_MASK;
@@ -71,7 +71,7 @@ int bcm63xx_timer_enable(int id)
        reg |= TIMER_IRQSTAT_TIMER_IR_EN(id);
        bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
 
-       spin_unlock_irqrestore(&timer_reg_lock, flags);
+       raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
        return 0;
 }
 
@@ -85,7 +85,7 @@ int bcm63xx_timer_disable(int id)
        if (id >= BCM63XX_TIMER_COUNT)
                return -EINVAL;
 
-       spin_lock_irqsave(&timer_reg_lock, flags);
+       raw_spin_lock_irqsave(&timer_reg_lock, flags);
 
        reg = bcm_timer_readl(TIMER_CTLx_REG(id));
        reg &= ~TIMER_CTL_ENABLE_MASK;
@@ -95,7 +95,7 @@ int bcm63xx_timer_disable(int id)
        reg &= ~TIMER_IRQSTAT_TIMER_IR_EN(id);
        bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
 
-       spin_unlock_irqrestore(&timer_reg_lock, flags);
+       raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
        return 0;
 }
 
@@ -110,7 +110,7 @@ int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
                return -EINVAL;
 
        ret = 0;
-       spin_lock_irqsave(&timer_data_lock, flags);
+       raw_spin_lock_irqsave(&timer_data_lock, flags);
        if (timer_data[id].cb) {
                ret = -EBUSY;
                goto out;
@@ -120,7 +120,7 @@ int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
        timer_data[id].data = data;
 
 out:
-       spin_unlock_irqrestore(&timer_data_lock, flags);
+       raw_spin_unlock_irqrestore(&timer_data_lock, flags);
        return ret;
 }
 
@@ -133,9 +133,9 @@ void bcm63xx_timer_unregister(int id)
        if (id >= BCM63XX_TIMER_COUNT)
                return;
 
-       spin_lock_irqsave(&timer_data_lock, flags);
+       raw_spin_lock_irqsave(&timer_data_lock, flags);
        timer_data[id].cb = NULL;
-       spin_unlock_irqrestore(&timer_data_lock, flags);
+       raw_spin_unlock_irqrestore(&timer_data_lock, flags);
 }
 
 EXPORT_SYMBOL(bcm63xx_timer_unregister);
@@ -159,7 +159,7 @@ int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
        if (countdown & ~TIMER_CTL_COUNTDOWN_MASK)
                return -EINVAL;
 
-       spin_lock_irqsave(&timer_reg_lock, flags);
+       raw_spin_lock_irqsave(&timer_reg_lock, flags);
        reg = bcm_timer_readl(TIMER_CTLx_REG(id));
 
        if (monotonic)
@@ -171,7 +171,7 @@ int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
        reg |= countdown;
        bcm_timer_writel(reg, TIMER_CTLx_REG(id));
 
-       spin_unlock_irqrestore(&timer_reg_lock, flags);
+       raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
        return 0;
 }
 
index 671d3448fad4e327df0acab143a5bc39e1ed691c..790ddd39762080b9e0900f3c3b1e32b51ad7860b 100644 (file)
@@ -9,13 +9,16 @@
 # modified by Cort (cort@cs.nmt.edu)
 #
 # Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University
-# Author: Wu Zhangjin <wuzj@lemote.com>
+# Author: Wu Zhangjin <wuzhangjin@gmail.com>
 #
 
 # compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
 VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
-VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
-VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" ] && printf %x $$(($(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE))))
+VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo -n $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
+# VMLINUZ_LOAD_ADDRESS = concat "high32 of VMLINUX_LOAD_ADDRESS" and "(low32 of VMLINUX_LOAD_ADDRESS) + VMLINUX_SIZE"
+HIGH32 := $(shell A=$(VMLINUX_LOAD_ADDRESS); [ $${\#A} -gt 10 ] && expr substr "$(VMLINUX_LOAD_ADDRESS)" 3 $$(($${\#A} - 10)))
+LOW32 := $(shell [ -n "$(HIGH32)" ] && A=11 || A=3; expr substr "$(VMLINUX_LOAD_ADDRESS)" $${A} 8)
+VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" -a -n "$(LOW32)" ] && printf "$(HIGH32)%08x" $$(($(VMLINUX_SIZE) + 0x$(LOW32))))
 
 # set the default size of the mallocing area for decompressing
 BOOT_HEAP_SIZE := 0x400000
@@ -24,15 +27,18 @@ BOOT_HEAP_SIZE := 0x400000
 KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
 
 KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
-       -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" \
+       -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
 
 KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
-       -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) \
-       -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE)
+       -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
+       -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ )
 
 obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
 
+ifdef CONFIG_DEBUG_ZBOOT
 obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
+obj-$(CONFIG_MACH_ALCHEMY)                += $(obj)/uart-alchemy.o
+endif
 
 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
 $(obj)/vmlinux.bin: $(KBUILD_IMAGE)
@@ -41,9 +47,11 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE)
 suffix_$(CONFIG_KERNEL_GZIP)  = gz
 suffix_$(CONFIG_KERNEL_BZIP2) = bz2
 suffix_$(CONFIG_KERNEL_LZMA)  = lzma
+suffix_$(CONFIG_KERNEL_LZO)   = lzo
 tool_$(CONFIG_KERNEL_GZIP)    = gzip
 tool_$(CONFIG_KERNEL_BZIP2)   = bzip2
 tool_$(CONFIG_KERNEL_LZMA)    = lzma
+tool_$(CONFIG_KERNEL_LZO)     = lzo
 $(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin
        $(call if_changed,$(tool_y))
 
index ff4dc7a33a9f69e47dbd63105f3660af986fbf7d..134a6162e39413679609450387aa2f692eb3a9ce 100644 (file)
@@ -5,11 +5,11 @@
  * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. othewise, you
  * need to implement your own putc().
  */
-
+#include <linux/compiler.h>
 #include <linux/init.h>
 #include <linux/types.h>
 
-void __attribute__ ((weak)) putc(char c)
+void __weak putc(char c)
 {
 }
 
index e48fd72898a877cba114fbf6fabea77929b198a2..5db43c58b1bf7e844eeaa683d3a61d45c0ea340a 100644 (file)
@@ -5,8 +5,8 @@
  * Author: Matt Porter <mporter@mvista.com> Derived from
  * arch/ppc/boot/prep/misc.c
  *
- * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Copyright (C) 2009 Lemote, Inc.
+ * Author: Wu Zhangjin <wuzhangjin@gmail.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
@@ -77,6 +77,10 @@ void *memset(void *s, int c, size_t n)
 #include "../../../../lib/decompress_unlzma.c"
 #endif
 
+#ifdef CONFIG_KERNEL_LZO
+#include "../../../../lib/decompress_unlzo.c"
+#endif
+
 void decompress_kernel(unsigned long boot_heap_start)
 {
        int zimage_size;
diff --git a/arch/mips/boot/compressed/uart-alchemy.c b/arch/mips/boot/compressed/uart-alchemy.c
new file mode 100644 (file)
index 0000000..1bff22f
--- /dev/null
@@ -0,0 +1,7 @@
+#include <asm/mach-au1x00/au1000.h>
+
+void putc(char c)
+{
+       /* all current (Jan. 2010) in-kernel boards */
+       alchemy_uart_putchar(UART0_PHYS_ADDR, c);
+}
index 4b92bfc662db0b629e253a92336a9396b41555ac..be531ec1f2064b590b58dfe8b4db4f5534999bab 100644 (file)
@@ -41,7 +41,7 @@ struct bar1_index_state {
 };
 
 #ifdef CONFIG_PCI
-static DEFINE_SPINLOCK(bar1_lock);
+static DEFINE_RAW_SPINLOCK(bar1_lock);
 static struct bar1_index_state bar1_state[32];
 #endif
 
@@ -198,7 +198,7 @@ dma_addr_t octeon_map_dma_mem(struct device *dev, void *ptr, size_t size)
                start_index = 31;
 
        /* Only one processor can access the Bar register at once */
-       spin_lock_irqsave(&bar1_lock, flags);
+       raw_spin_lock_irqsave(&bar1_lock, flags);
 
        /* Look through Bar1 for existing mapping that will work */
        for (index = start_index; index >= 0; index--) {
@@ -250,7 +250,7 @@ dma_addr_t octeon_map_dma_mem(struct device *dev, void *ptr, size_t size)
               (unsigned long long) physical);
 
 done_unlock:
-       spin_unlock_irqrestore(&bar1_lock, flags);
+       raw_spin_unlock_irqrestore(&bar1_lock, flags);
 done:
        pr_debug("dma_map_single 0x%llx->0x%llx\n", physical, result);
        return result;
@@ -324,14 +324,14 @@ void octeon_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr)
                      "Attempt to unmap an invalid address (0x%llx)\n",
                      dma_addr);
 
-       spin_lock_irqsave(&bar1_lock, flags);
+       raw_spin_lock_irqsave(&bar1_lock, flags);
        bar1_state[index].ref_count--;
        if (bar1_state[index].ref_count == 0)
                octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index), 0);
        else if (unlikely(bar1_state[index].ref_count < 0))
                panic("dma_unmap_single: Bar1[%u] reference count < 0\n",
                      (int) index);
-       spin_unlock_irqrestore(&bar1_lock, flags);
+       raw_spin_unlock_irqrestore(&bar1_lock, flags);
 done:
        pr_debug("dma_unmap_single 0x%llx\n", dma_addr);
        return;
index 25666da17b2234697925fcdab1318d20af42b8bd..fdf5f19bfdb06226b0296ab52ce1d3b453c1ccdd 100644 (file)
@@ -253,7 +253,7 @@ int64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min,
         * impossible requests up front. (NOP for address_min == 0)
         */
        if (alignment)
-               address_min = __ALIGN_MASK(address_min, (alignment - 1));
+               address_min = ALIGN(address_min, alignment);
 
        /*
         * Reject inconsistent args.  We have adjusted these, so this
@@ -291,7 +291,7 @@ int64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min,
                 * satisfy request.
                 */
                usable_base =
-                   __ALIGN_MASK(max(address_min, ent_addr), alignment - 1);
+                   ALIGN(max(address_min, ent_addr), alignment);
                usable_max = min(address_max, ent_addr + ent_size);
                /*
                 * We should be able to allocate block at address
@@ -671,7 +671,7 @@ int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
         * coallesced when they are freed.  The alloc routine does the
         * same rounding up on all allocations.
         */
-       size = __ALIGN_MASK(size, (CVMX_BOOTMEM_ALIGNMENT_SIZE - 1));
+       size = ALIGN(size, CVMX_BOOTMEM_ALIGNMENT_SIZE);
 
        addr_allocated = cvmx_bootmem_phy_alloc(size, min_addr, max_addr,
                                                alignment,
index e5838890cba5a313d76173499b40f8a982f364fb..8b18a20cc7b3aace25c1cf60bdcdc7fc00958148 100644 (file)
@@ -115,4 +115,3 @@ int cvmx_sysinfo_minimal_initialize(void *phy_mem_desc_ptr,
 
        return 1;
 }
-
index 6f2acf09328dbe00a80215cc84acc6e6739bfe50..c424cd158dc6c7f195a3c4c3a29f8e4793da8493 100644 (file)
@@ -13,9 +13,8 @@
 #include <asm/octeon/cvmx-pexp-defs.h>
 #include <asm/octeon/cvmx-npi-defs.h>
 
-DEFINE_RWLOCK(octeon_irq_ciu0_rwlock);
-DEFINE_RWLOCK(octeon_irq_ciu1_rwlock);
-DEFINE_SPINLOCK(octeon_irq_msi_lock);
+static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock);
+static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock);
 
 static int octeon_coreid_for_cpu(int cpu)
 {
@@ -51,9 +50,6 @@ static void octeon_irq_core_eoi(unsigned int irq)
         */
        if (desc->status & IRQ_DISABLED)
                return;
-
-       /* There is a race here.  We should fix it.  */
-
        /*
         * We don't need to disable IRQs to make these atomic since
         * they are already disabled earlier in the low level
@@ -141,19 +137,12 @@ static void octeon_irq_ciu0_enable(unsigned int irq)
        uint64_t en0;
        int bit = irq - OCTEON_IRQ_WORKQ0;      /* Bit 0-63 of EN0 */
 
-       /*
-        * A read lock is used here to make sure only one core is ever
-        * updating the CIU enable bits at a time. During an enable
-        * the cores don't interfere with each other. During a disable
-        * the write lock stops any enables that might cause a
-        * problem.
-        */
-       read_lock_irqsave(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
        en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
        en0 |= 1ull << bit;
        cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);
        cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
-       read_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
 }
 
 static void octeon_irq_ciu0_disable(unsigned int irq)
@@ -162,7 +151,7 @@ static void octeon_irq_ciu0_disable(unsigned int irq)
        unsigned long flags;
        uint64_t en0;
        int cpu;
-       write_lock_irqsave(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
        for_each_online_cpu(cpu) {
                int coreid = octeon_coreid_for_cpu(cpu);
                en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
@@ -174,7 +163,7 @@ static void octeon_irq_ciu0_disable(unsigned int irq)
         * of them are done.
         */
        cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));
-       write_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
 }
 
 /*
@@ -193,7 +182,7 @@ static void octeon_irq_ciu0_enable_v2(unsigned int irq)
  * Disable the irq on the current core for chips that have the EN*_W1{S,C}
  * registers.
  */
-static void octeon_irq_ciu0_disable_v2(unsigned int irq)
+static void octeon_irq_ciu0_ack_v2(unsigned int irq)
 {
        int index = cvmx_get_core_num() * 2;
        u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
@@ -201,6 +190,43 @@ static void octeon_irq_ciu0_disable_v2(unsigned int irq)
        cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
 }
 
+/*
+ * CIU timer type interrupts must be acknoleged by writing a '1' bit
+ * to their sum0 bit.
+ */
+static void octeon_irq_ciu0_timer_ack(unsigned int irq)
+{
+       int index = cvmx_get_core_num() * 2;
+       uint64_t mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
+       cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);
+}
+
+static void octeon_irq_ciu0_timer_ack_v1(unsigned int irq)
+{
+       octeon_irq_ciu0_timer_ack(irq);
+       octeon_irq_ciu0_ack(irq);
+}
+
+static void octeon_irq_ciu0_timer_ack_v2(unsigned int irq)
+{
+       octeon_irq_ciu0_timer_ack(irq);
+       octeon_irq_ciu0_ack_v2(irq);
+}
+
+/*
+ * Enable the irq on the current core for chips that have the EN*_W1{S,C}
+ * registers.
+ */
+static void octeon_irq_ciu0_eoi_v2(unsigned int irq)
+{
+       struct irq_desc *desc = irq_desc + irq;
+       int index = cvmx_get_core_num() * 2;
+       u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
+
+       if ((desc->status & IRQ_DISABLED) == 0)
+               cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
+}
+
 /*
  * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
  * registers.
@@ -223,7 +249,7 @@ static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *
        unsigned long flags;
        int bit = irq - OCTEON_IRQ_WORKQ0;      /* Bit 0-63 of EN0 */
 
-       write_lock_irqsave(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
        for_each_online_cpu(cpu) {
                int coreid = octeon_coreid_for_cpu(cpu);
                uint64_t en0 =
@@ -239,7 +265,7 @@ static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *
         * of them are done.
         */
        cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));
-       write_unlock_irqrestore(&octeon_irq_ciu0_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
 
        return 0;
 }
@@ -272,8 +298,8 @@ static struct irq_chip octeon_irq_chip_ciu0_v2 = {
        .name = "CIU0",
        .enable = octeon_irq_ciu0_enable_v2,
        .disable = octeon_irq_ciu0_disable_all_v2,
-       .ack = octeon_irq_ciu0_disable_v2,
-       .eoi = octeon_irq_ciu0_enable_v2,
+       .ack = octeon_irq_ciu0_ack_v2,
+       .eoi = octeon_irq_ciu0_eoi_v2,
 #ifdef CONFIG_SMP
        .set_affinity = octeon_irq_ciu0_set_affinity_v2,
 #endif
@@ -290,6 +316,28 @@ static struct irq_chip octeon_irq_chip_ciu0 = {
 #endif
 };
 
+static struct irq_chip octeon_irq_chip_ciu0_timer_v2 = {
+       .name = "CIU0-T",
+       .enable = octeon_irq_ciu0_enable_v2,
+       .disable = octeon_irq_ciu0_disable_all_v2,
+       .ack = octeon_irq_ciu0_timer_ack_v2,
+       .eoi = octeon_irq_ciu0_eoi_v2,
+#ifdef CONFIG_SMP
+       .set_affinity = octeon_irq_ciu0_set_affinity_v2,
+#endif
+};
+
+static struct irq_chip octeon_irq_chip_ciu0_timer = {
+       .name = "CIU0-T",
+       .enable = octeon_irq_ciu0_enable,
+       .disable = octeon_irq_ciu0_disable,
+       .ack = octeon_irq_ciu0_timer_ack_v1,
+       .eoi = octeon_irq_ciu0_eoi,
+#ifdef CONFIG_SMP
+       .set_affinity = octeon_irq_ciu0_set_affinity,
+#endif
+};
+
 
 static void octeon_irq_ciu1_ack(unsigned int irq)
 {
@@ -322,19 +370,12 @@ static void octeon_irq_ciu1_enable(unsigned int irq)
        uint64_t en1;
        int bit = irq - OCTEON_IRQ_WDOG0;       /* Bit 0-63 of EN1 */
 
-       /*
-        * A read lock is used here to make sure only one core is ever
-        * updating the CIU enable bits at a time.  During an enable
-        * the cores don't interfere with each other.  During a disable
-        * the write lock stops any enables that might cause a
-        * problem.
-        */
-       read_lock_irqsave(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
        en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
        en1 |= 1ull << bit;
        cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);
        cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
-       read_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
 }
 
 static void octeon_irq_ciu1_disable(unsigned int irq)
@@ -343,7 +384,7 @@ static void octeon_irq_ciu1_disable(unsigned int irq)
        unsigned long flags;
        uint64_t en1;
        int cpu;
-       write_lock_irqsave(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
        for_each_online_cpu(cpu) {
                int coreid = octeon_coreid_for_cpu(cpu);
                en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
@@ -355,7 +396,7 @@ static void octeon_irq_ciu1_disable(unsigned int irq)
         * of them are done.
         */
        cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));
-       write_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
 }
 
 /*
@@ -374,7 +415,7 @@ static void octeon_irq_ciu1_enable_v2(unsigned int irq)
  * Disable the irq on the current core for chips that have the EN*_W1{S,C}
  * registers.
  */
-static void octeon_irq_ciu1_disable_v2(unsigned int irq)
+static void octeon_irq_ciu1_ack_v2(unsigned int irq)
 {
        int index = cvmx_get_core_num() * 2 + 1;
        u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
@@ -382,6 +423,20 @@ static void octeon_irq_ciu1_disable_v2(unsigned int irq)
        cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
 }
 
+/*
+ * Enable the irq on the current core for chips that have the EN*_W1{S,C}
+ * registers.
+ */
+static void octeon_irq_ciu1_eoi_v2(unsigned int irq)
+{
+       struct irq_desc *desc = irq_desc + irq;
+       int index = cvmx_get_core_num() * 2 + 1;
+       u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
+
+       if ((desc->status & IRQ_DISABLED) == 0)
+               cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
+}
+
 /*
  * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
  * registers.
@@ -405,7 +460,7 @@ static int octeon_irq_ciu1_set_affinity(unsigned int irq,
        unsigned long flags;
        int bit = irq - OCTEON_IRQ_WDOG0;       /* Bit 0-63 of EN1 */
 
-       write_lock_irqsave(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
        for_each_online_cpu(cpu) {
                int coreid = octeon_coreid_for_cpu(cpu);
                uint64_t en1 =
@@ -422,7 +477,7 @@ static int octeon_irq_ciu1_set_affinity(unsigned int irq,
         * of them are done.
         */
        cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));
-       write_unlock_irqrestore(&octeon_irq_ciu1_rwlock, flags);
+       raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
 
        return 0;
 }
@@ -455,8 +510,8 @@ static struct irq_chip octeon_irq_chip_ciu1_v2 = {
        .name = "CIU0",
        .enable = octeon_irq_ciu1_enable_v2,
        .disable = octeon_irq_ciu1_disable_all_v2,
-       .ack = octeon_irq_ciu1_disable_v2,
-       .eoi = octeon_irq_ciu1_enable_v2,
+       .ack = octeon_irq_ciu1_ack_v2,
+       .eoi = octeon_irq_ciu1_eoi_v2,
 #ifdef CONFIG_SMP
        .set_affinity = octeon_irq_ciu1_set_affinity_v2,
 #endif
@@ -475,6 +530,8 @@ static struct irq_chip octeon_irq_chip_ciu1 = {
 
 #ifdef CONFIG_PCI_MSI
 
+static DEFINE_RAW_SPINLOCK(octeon_irq_msi_lock);
+
 static void octeon_irq_msi_ack(unsigned int irq)
 {
        if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
@@ -515,12 +572,12 @@ static void octeon_irq_msi_enable(unsigned int irq)
                 */
                uint64_t en;
                unsigned long flags;
-               spin_lock_irqsave(&octeon_irq_msi_lock, flags);
+               raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
                en = cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
                en |= 1ull << (irq - OCTEON_IRQ_MSI_BIT0);
                cvmx_write_csr(CVMX_PEXP_NPEI_MSI_ENB0, en);
                cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
-               spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
+               raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
        }
 }
 
@@ -537,12 +594,12 @@ static void octeon_irq_msi_disable(unsigned int irq)
                 */
                uint64_t en;
                unsigned long flags;
-               spin_lock_irqsave(&octeon_irq_msi_lock, flags);
+               raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
                en = cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
                en &= ~(1ull << (irq - OCTEON_IRQ_MSI_BIT0));
                cvmx_write_csr(CVMX_PEXP_NPEI_MSI_ENB0, en);
                cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
-               spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
+               raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
        }
 }
 
@@ -559,6 +616,7 @@ void __init arch_init_irq(void)
 {
        int irq;
        struct irq_chip *chip0;
+       struct irq_chip *chip0_timer;
        struct irq_chip *chip1;
 
 #ifdef CONFIG_SMP
@@ -574,9 +632,11 @@ void __init arch_init_irq(void)
            OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||
            OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X)) {
                chip0 = &octeon_irq_chip_ciu0_v2;
+               chip0_timer = &octeon_irq_chip_ciu0_timer_v2;
                chip1 = &octeon_irq_chip_ciu1_v2;
        } else {
                chip0 = &octeon_irq_chip_ciu0;
+               chip0_timer = &octeon_irq_chip_ciu0_timer;
                chip1 = &octeon_irq_chip_ciu1;
        }
 
@@ -590,7 +650,21 @@ void __init arch_init_irq(void)
 
        /* 24 - 87 CIU_INT_SUM0 */
        for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) {
-               set_irq_chip_and_handler(irq, chip0, handle_percpu_irq);
+               switch (irq) {
+               case OCTEON_IRQ_GMX_DRP0:
+               case OCTEON_IRQ_GMX_DRP1:
+               case OCTEON_IRQ_IPD_DRP:
+               case OCTEON_IRQ_KEY_ZERO:
+               case OCTEON_IRQ_TIMER0:
+               case OCTEON_IRQ_TIMER1:
+               case OCTEON_IRQ_TIMER2:
+               case OCTEON_IRQ_TIMER3:
+                       set_irq_chip_and_handler(irq, chip0_timer, handle_percpu_irq);
+                       break;
+               default:
+                       set_irq_chip_and_handler(irq, chip0, handle_percpu_irq);
+                       break;
+               }
        }
 
        /* 88 - 151 CIU_INT_SUM1 */
index cfdb4c2ac5c3d7ad1a59f6dc6a08e2dcf37259c9..62ac30eef5e8a1ff5dfac8bfdbf94e846a52b6e0 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/init.h>
 #include <linux/irq.h>
+#include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
@@ -159,6 +160,90 @@ out:
 }
 device_initcall(octeon_rng_device_init);
 
+static struct i2c_board_info __initdata octeon_i2c_devices[] = {
+       {
+               I2C_BOARD_INFO("ds1337", 0x68),
+       },
+};
+
+static int __init octeon_i2c_devices_init(void)
+{
+       return i2c_register_board_info(0, octeon_i2c_devices,
+                                      ARRAY_SIZE(octeon_i2c_devices));
+}
+arch_initcall(octeon_i2c_devices_init);
+
+#define OCTEON_I2C_IO_BASE 0x1180000001000ull
+#define OCTEON_I2C_IO_UNIT_OFFSET 0x200
+
+static struct octeon_i2c_data octeon_i2c_data[2];
+
+static int __init octeon_i2c_device_init(void)
+{
+       struct platform_device *pd;
+       int ret = 0;
+       int port, num_ports;
+
+       struct resource i2c_resources[] = {
+               {
+                       .flags  = IORESOURCE_MEM,
+               }, {
+                       .flags  = IORESOURCE_IRQ,
+               }
+       };
+
+       if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX))
+               num_ports = 2;
+       else
+               num_ports = 1;
+
+       for (port = 0; port < num_ports; port++) {
+               octeon_i2c_data[port].sys_freq = octeon_get_clock_rate();
+               /*FIXME: should be examined. At the moment is set for 100Khz */
+               octeon_i2c_data[port].i2c_freq = 100000;
+
+               pd = platform_device_alloc("i2c-octeon", port);
+               if (!pd) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+
+               pd->dev.platform_data = octeon_i2c_data + port;
+
+               i2c_resources[0].start =
+                       OCTEON_I2C_IO_BASE + (port * OCTEON_I2C_IO_UNIT_OFFSET);
+               i2c_resources[0].end = i2c_resources[0].start + 0x1f;
+               switch (port) {
+               case 0:
+                       i2c_resources[1].start = OCTEON_IRQ_TWSI;
+                       i2c_resources[1].end = OCTEON_IRQ_TWSI;
+                       break;
+               case 1:
+                       i2c_resources[1].start = OCTEON_IRQ_TWSI2;
+                       i2c_resources[1].end = OCTEON_IRQ_TWSI2;
+                       break;
+               default:
+                       BUG();
+               }
+
+               ret = platform_device_add_resources(pd,
+                                                   i2c_resources,
+                                                   ARRAY_SIZE(i2c_resources));
+               if (ret)
+                       goto fail;
+
+               ret = platform_device_add(pd);
+               if (ret)
+                       goto fail;
+       }
+       return ret;
+fail:
+       platform_device_put(pd);
+out:
+       return ret;
+}
+device_initcall(octeon_i2c_device_init);
+
 /* Octeon SMI/MDIO interface.  */
 static int __init octeon_mdiobus_device_init(void)
 {
index c198efdf583e88dd6d23c5342f7a7cc170e5178e..51e980290ce1088f307d639c17b4455f5094b191 100644 (file)
@@ -327,7 +327,7 @@ static void octeon_cpu_die(unsigned int cpu)
                                   avail_coremask);
        }
 
-       pr_info("Reset core %d. Available Coremask = %x \n", coreid,
+       pr_info("Reset core %d. Available Coremask = %x\n", coreid,
                avail_coremask);
        cvmx_write_csr(CVMX_CIU_PP_RST, 1 << coreid);
        cvmx_write_csr(CVMX_CIU_PP_RST, 0);
index cfce7af1bca91c45f3489b9e5580bfed3fd850ab..85ec9cc31d6661a91253d0e008214b6f9886d2f3 100644 (file)
@@ -25,7 +25,7 @@ static struct resource cobalt_mem_resource = {
 
 static struct resource cobalt_io_resource = {
        .start  = 0x1000,
-       .end    = GT_DEF_PCI0_IO_SIZE - 1,
+       .end    = 0xffffffUL,
        .name   = "PCI I/O",
        .flags  = IORESOURCE_IO,
 };
index 68e90cd6b2d4a9f6d7fc102debd540c0dc5ac296..f66d406aadceac31d47599bd88e480adf120eb3e 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:24 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 08:46:14 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-CONFIG_MIPS_DB1000=y
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+CONFIG_MIPS_DB1000=y
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1000=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1000=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -85,6 +109,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -92,11 +117,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -106,184 +134,244 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-db1000"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 # CONFIG_PCI is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
+# CONFIG_PCMCIA_IOCTL is not set
 
 #
 # PC-card bridges
 #
 # CONFIG_PCMCIA_AU1X00 is not set
-
-#
-# PCI Hotplug Support
-#
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -294,110 +382,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -407,27 +410,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -436,25 +436,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -467,6 +467,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -492,14 +493,13 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -516,174 +516,115 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
+# UBI - Unsorted block images
 #
-# CONFIG_PNPACPI is not set
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
 
 #
-# Block devices
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
 #
-# 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_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
-
-#
-# Misc devices
-#
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# PHY device support
-#
+# CONFIG_VETH is not set
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # 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 is not set
-
-#
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_NET_PCMCIA is not set
 # CONFIG_WAN is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -691,16 +632,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -710,35 +649,33 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
 
 #
 # Serial drivers
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_CS=m
+# CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
@@ -750,198 +687,291 @@ CONFIG_SERIAL_8250_AU1X00=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 
 #
-# Dallas's 1-wire bus
+# PPS support
 #
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
+# Display device support
 #
-# CONFIG_SOUND is not set
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
-# HID Devices
-#
-# CONFIG_HID is not set
-
-#
-# USB support
+# Console display driver support
 #
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 # CONFIG_USB_ARCH_HAS_EHCI is not set
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
 
 #
-# Real Time Clock
+# OTG and related infrastructure
 #
-# CONFIG_RTC_CLASS is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# DMA Engine support
+# RTC interfaces
 #
-# CONFIG_DMA_ENGINE is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+# CONFIG_EXT3_FS_XATTR is not set
+# CONFIG_EXT4_FS is not set
 CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -960,74 +990,65 @@ CONFIG_GENERIC_ACL=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_CRAMFS=y
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+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_850=y
 # CONFIG_NLS_CODEPAGE_852 is not set
 # CONFIG_NLS_CODEPAGE_855 is not set
 # CONFIG_NLS_CODEPAGE_857 is not set
@@ -1045,10 +1066,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_1250=y
 # CONFIG_NLS_CODEPAGE_1251 is not set
 # CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 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
@@ -1058,38 +1079,75 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1097,67 +1155,29 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+# CONFIG_SECURITYFS is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index 90812830e940c560ed44da60a8e457778ea46095..abb9a5805adcca5ef362eb620bcd24d0aa0f4dac 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:24 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 08:50:15 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-CONFIG_MIPS_DB1100=y
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+CONFIG_MIPS_DB1100=y
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1100=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1100=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -85,6 +109,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -92,11 +117,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -106,173 +134,242 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-db1100"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_SLAB=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
 CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 CONFIG_MMU=y
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
+CONFIG_PCMCIA_LOAD_CIS=y
+# CONFIG_PCMCIA_IOCTL is not set
 
 #
-# PCCARD (PCMCIA/CardBus) support
-#
-# CONFIG_PCCARD is not set
-
-#
-# PCI Hotplug Support
+# PC-card bridges
 #
+# CONFIG_PCMCIA_AU1X00 is not set
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -283,110 +380,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -396,27 +408,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -425,25 +434,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -456,6 +465,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -481,14 +491,13 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -505,161 +514,123 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
+# UBI - Unsorted block images
 #
-# 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_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+# CONFIG_BLK_DEV is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
+CONFIG_IDE=y
 
 #
-# Misc devices
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+# CONFIG_BLK_DEV_IDECS is not set
+# CONFIG_BLK_DEV_IDECD is not set
+# CONFIG_BLK_DEV_IDETAPE is not set
+CONFIG_IDE_TASK_IOCTL=y
+CONFIG_IDE_PROC_FS=y
 
 #
-# ATA/ATAPI/MFM/RLL support
+# IDE chipset support/bugfixes
 #
-# CONFIG_IDE is not set
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# PHY device support
-#
+# CONFIG_VETH is not set
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # 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 is not set
-
-#
-# Wan interfaces
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_NET_PCMCIA is not set
 # CONFIG_WAN is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -667,16 +638,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -686,34 +655,33 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-CONFIG_SERIO_LIBPS2=m
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
 
 #
 # Serial drivers
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
@@ -725,78 +693,91 @@ CONFIG_SERIAL_8250_AU1X00=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-# CONFIG_RAW_DRIVER is not set
 
 #
-# TPM devices
+# PCMCIA character devices
 #
+# CONFIG_SYNCLINK_CS is not set
+# CONFIG_CARDMAN_4000 is not set
+# CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
+# CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 
 #
-# Dallas's 1-wire bus
+# PPS support
 #
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
 CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_COPYAREA=y
 CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
 # CONFIG_FB_MODE_HELPERS is not set
 # CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
 # CONFIG_FB_S1D13XXX is not set
 CONFIG_FB_AU1100=y
 # CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
 # Console display driver support
@@ -804,9 +785,10 @@ CONFIG_FB_AU1100=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
 # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
 CONFIG_FONTS=y
-CONFIG_FONT_8x8=y
+# CONFIG_FONT_8x8 is not set
 CONFIG_FONT_8x16=y
 # CONFIG_FONT_6x11 is not set
 # CONFIG_FONT_7x14 is not set
@@ -816,132 +798,186 @@ CONFIG_FONT_8x16=y
 # CONFIG_FONT_SUN8x16 is not set
 # CONFIG_FONT_SUN12x22 is not set
 # CONFIG_FONT_10x18 is not set
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
+# CONFIG_LOGO is not set
 # CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
-# CONFIG_HID is not set
-
-#
-# USB support
-#
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 # CONFIG_USB_ARCH_HAS_EHCI is not set
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
 
 #
-# Real Time Clock
+# OTG and related infrastructure
 #
-# CONFIG_RTC_CLASS is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# DMA Engine support
+# RTC interfaces
 #
-# CONFIG_DMA_ENGINE is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -960,69 +996,76 @@ CONFIG_GENERIC_ACL=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+CONFIG_JFFS2_FS_POSIX_ACL=y
+CONFIG_JFFS2_FS_SECURITY=y
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_CODEPAGE_437 is not set
 # CONFIG_NLS_CODEPAGE_737 is not set
@@ -1062,34 +1105,71 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1097,67 +1177,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index dabf03032e06155d03e30f3091cc03cace3638da..991c20adf471cbf25035d5065d550c7774e534b1 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:25 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 10:18:09 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-CONFIG_MIPS_DB1200=y
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+CONFIG_MIPS_DB1200=y
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1200=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_COHERENT=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1200=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -85,6 +109,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -92,11 +117,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -106,180 +134,235 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+CONFIG_KSM=y
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-db1200"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_SYSFS_DEPRECATED=y
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
 # CONFIG_RELAY is not set
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+# CONFIG_FREEZER is not set
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
+# CONFIG_PCMCIA_IOCTL is not set
 
 #
 # PC-card bridges
 #
-CONFIG_PCMCIA_AU1X00=m
-
-#
-# PCI Hotplug Support
-#
+# CONFIG_PCMCIA_AU1X00 is not set
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=y
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PM is not set
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
-# CONFIG_IP_PNP is not set
+CONFIG_IP_PNP=y
+# CONFIG_IP_PNP_DHCP is not set
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -290,107 +373,25 @@ CONFIG_IP_FIB_HASH=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-# CONFIG_NETFILTER_NETLINK is not set
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -400,21 +401,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-# CONFIG_IEEE80211 is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -423,25 +427,25 @@ CONFIG_NET_CLS_ROUTE=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -454,6 +458,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -479,19 +484,21 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
 # Self-contained MTD device drivers
 #
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SST25L is not set
 # CONFIG_MTD_SLRAM is not set
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
@@ -503,224 +510,134 @@ CONFIG_MTD_ALCHEMY=y
 # 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 is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_AU1550 is not set
 # CONFIG_MTD_NAND_DISKONCHIP is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
-
-#
-# OneNAND Flash Device Drivers
-#
+CONFIG_MTD_NAND_PLATFORM=y
+# CONFIG_MTD_ALAUDA is not set
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # 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=4096
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
-# CONFIG_CDROM_PKTCDVD is not set
-# CONFIG_ATA_OVER_ETH is not set
 
 #
-# Misc devices
-#
-
-#
-# ATA/ATAPI/MFM/RLL support
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
 #
+# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_UB=y
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=4
-CONFIG_BLK_DEV_IDE=y
 
 #
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_ATAPI=y
 # CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_IDECD is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+CONFIG_BLK_DEV_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
 # 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
+CONFIG_IDE_TASK_IOCTL=y
+# CONFIG_IDE_PROC_FS is not set
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
 CONFIG_BLK_DEV_IDE_AU1XXX=y
 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y
 # CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set
-CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
-# 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=y
-CONFIG_SCSI_TGT=m
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=y
-# CONFIG_CHR_DEV_ST is not set
-# CONFIG_CHR_DEV_OSST is not set
-CONFIG_BLK_DEV_SR=y
-# CONFIG_BLK_DEV_SR_VENDOR is not set
-CONFIG_CHR_DEV_SG=y
-# 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
-CONFIG_SCSI_SCAN_ASYNC=y
-
-#
-# SCSI Transports
-#
-# 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
-# CONFIG_SCSI_SAS_LIBSAS is not set
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_ISCSI_TCP 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
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# PHY device support
-#
+# CONFIG_VETH is not set
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 # CONFIG_MIPS_AU1X00_ENET is not set
-# CONFIG_SMC91X is not set
+CONFIG_SMC91X=y
 # CONFIG_DM9000 is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# PCMCIA network device support
-#
+# CONFIG_ENC28J60 is not set
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
 # CONFIG_NET_PCMCIA is not set
-
-#
-# Wan interfaces
-#
 # CONFIG_WAN is not set
 # CONFIG_PPP 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
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -728,16 +645,14 @@ CONFIG_MII=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -747,28 +662,26 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=y
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
 
 #
 # Serial drivers
@@ -776,33 +689,22 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_SERIAL_8250_CS is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
 # CONFIG_SERIAL_8250_EXTENDED is not set
 CONFIG_SERIAL_8250_AU1X00=y
 
 #
 # Non-8250 serial port support
 #
+# CONFIG_SERIAL_MAX3100 is not set
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 
 #
@@ -811,223 +713,624 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
 
 #
-# TPM devices
+# I2C Algorithms
 #
-# CONFIG_TCG_TPM is not set
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
 
 #
-# I2C support
+# I2C Hardware Bus support
 #
-# CONFIG_I2C is not set
 
 #
-# SPI support
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+CONFIG_I2C_AU1550=y
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
 
 #
-# Dallas's 1-wire bus
+# External I2C/SMBus adapter drivers
 #
-# CONFIG_W1 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
 
 #
-# Hardware Monitoring support
+# Other I2C/SMBus bus drivers
 #
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
 
 #
-# Multimedia devices
+# Miscellaneous I2C Chip support
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SENSORS_TSL2550 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
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
 
 #
-# Digital Video Broadcasting Devices
+# SPI Master Controller Drivers
 #
-# CONFIG_DVB is not set
+CONFIG_SPI_AU1550=y
+CONFIG_SPI_BITBANG=y
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO expanders:
+#
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_GPIO_PCF857X is not set
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+
+#
+# AC97 GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+CONFIG_HWMON=y
+CONFIG_HWMON_VID=y
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+CONFIG_SENSORS_ADM1025=y
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A 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_LM70=y
+# CONFIG_SENSORS_LM73 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_LM93 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_UCB1400_CORE is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13783 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
 CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_COPYAREA=y
 CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
 # CONFIG_FB_MODE_HELPERS is not set
 # CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
 # CONFIG_FB_S1D13XXX is not set
 CONFIG_FB_AU1200=y
 # CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
 # Console display driver support
 #
-CONFIG_VGA_CONSOLE=y
-# CONFIG_VGACON_SOFT_SCROLLBACK is not set
+# CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE is not set
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+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
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+# CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_VERBOSE_PROCFS is not set
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+CONFIG_SND_VMASTER=y
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_AC97_CODEC=y
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_SPI is not set
+# CONFIG_SND_MIPS is not set
+# CONFIG_SND_USB is not set
+# CONFIG_SND_PCMCIA is not set
+CONFIG_SND_SOC=y
+CONFIG_SND_SOC_AC97_BUS=y
+CONFIG_SND_SOC_AU1XPSC=y
+CONFIG_SND_SOC_AU1XPSC_I2S=y
+CONFIG_SND_SOC_AU1XPSC_AC97=y
+CONFIG_SND_SOC_DB1200=y
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_AC97_CODEC=y
+CONFIG_SND_SOC_WM8731=y
+# CONFIG_SOUND_PRIME is not set
+CONFIG_AC97_BUS=y
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HIDRAW=y
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+CONFIG_USB_HIDDEV=y
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+CONFIG_USB_DEBUG=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 
 #
-# Logo configuration
+# Miscellaneous USB options
 #
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# Sound
+# USB Host Controller Drivers
 #
-# CONFIG_SOUND is not set
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# HID Devices
+# USB Device Class drivers
 #
-CONFIG_HID=y
-# CONFIG_HID_DEBUG is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# USB support
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# USB Gadget Support
+# USB Imaging devices
 #
-CONFIG_USB_GADGET=m
-# 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_AT91 is not set
-# CONFIG_USB_GADGET_DUMMY_HCD is not set
-# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_MDC800 is not set
 
 #
-# MMC/SD Card support
+# USB port drivers
 #
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
 CONFIG_MMC=y
 # CONFIG_MMC_DEBUG is not set
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_AU1X=y
+# CONFIG_MMC_UNSAFE_RESUME is not set
 
 #
-# LED devices
+# MMC/SD/SDIO Card Drivers
 #
-# CONFIG_NEW_LEDS is not set
+CONFIG_MMC_BLOCK=y
+# CONFIG_MMC_BLOCK_BOUNCE is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
 
 #
-# LED drivers
+# MMC/SD/SDIO Host Controller Drivers
 #
+# CONFIG_MMC_SDHCI is not set
+CONFIG_MMC_AU1X=y
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
+# CONFIG_MMC_SPI is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
 
 #
-# LED Triggers
+# LED drivers
 #
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_PCA955X is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
 
 #
-# InfiniBand support
+# LED Triggers
 #
+CONFIG_LEDS_TRIGGERS=y
+# CONFIG_LEDS_TRIGGER_TIMER is not set
+# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
+# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
+# CONFIG_LEDS_TRIGGER_GPIO is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# iptables trigger is under Netfilter config (LED target)
 #
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# Real Time Clock
+# RTC interfaces
 #
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Engine support
+# I2C RTC drivers
 #
-# CONFIG_DMA_ENGINE is not set
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
 # CONFIG_REISERFS_FS is not set
-CONFIG_JFS_FS=y
-# CONFIG_JFS_POSIX_ACL is not set
-# CONFIG_JFS_SECURITY is not set
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=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
-CONFIG_GENERIC_ACL=y
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
 #
-CONFIG_ISO9660_FS=m
+CONFIG_ISO9660_FS=y
 CONFIG_JOLIET=y
 CONFIG_ZISOFS=y
-CONFIG_UDF_FS=m
+CONFIG_UDF_FS=y
 CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
 #
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
 CONFIG_FAT_DEFAULT_CODEPAGE=437
 CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
@@ -1036,21 +1339,17 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_FS is not set
 # CONFIG_HFS_FS is not set
 # CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
@@ -1059,27 +1358,36 @@ CONFIG_CONFIGFS_FS=m
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
-# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
 # CONFIG_JFFS2_FS_XATTR is not set
-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
 CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=y
 CONFIG_JFFS2_RTIME=y
-# CONFIG_JFFS2_RUBIN is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_RUBIN=y
+# CONFIG_JFFS2_CMODE_NONE is not set
+CONFIG_JFFS2_CMODE_PRIORITY=y
+# CONFIG_JFFS2_CMODE_SIZE is not set
+# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=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_ROOT_NFS=y
 # CONFIG_NFSD is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
@@ -1087,93 +1395,140 @@ CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
-CONFIG_SMB_FS=y
-# CONFIG_SMB_NLS_DEFAULT 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_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
-
-#
-# Native Language Support
-#
+# 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_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_CODEPAGE_737=m
-CONFIG_NLS_CODEPAGE_775=m
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-CONFIG_NLS_CODEPAGE_855=m
-CONFIG_NLS_CODEPAGE_857=m
-CONFIG_NLS_CODEPAGE_860=m
-CONFIG_NLS_CODEPAGE_861=m
-CONFIG_NLS_CODEPAGE_862=m
-CONFIG_NLS_CODEPAGE_863=m
-CONFIG_NLS_CODEPAGE_864=m
-CONFIG_NLS_CODEPAGE_865=m
-CONFIG_NLS_CODEPAGE_866=m
-CONFIG_NLS_CODEPAGE_869=m
-CONFIG_NLS_CODEPAGE_936=m
-CONFIG_NLS_CODEPAGE_950=m
-CONFIG_NLS_CODEPAGE_932=m
-CONFIG_NLS_CODEPAGE_949=m
-CONFIG_NLS_CODEPAGE_874=m
-CONFIG_NLS_ISO8859_8=m
-CONFIG_NLS_CODEPAGE_1250=m
-CONFIG_NLS_CODEPAGE_1251=m
-CONFIG_NLS_ASCII=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-CONFIG_NLS_ISO8859_5=m
-CONFIG_NLS_ISO8859_6=m
-CONFIG_NLS_ISO8859_7=m
-CONFIG_NLS_ISO8859_9=m
-CONFIG_NLS_ISO8859_13=m
-CONFIG_NLS_ISO8859_14=m
-CONFIG_NLS_ISO8859_15=m
-CONFIG_NLS_KOI8_R=m
-CONFIG_NLS_KOI8_U=m
-CONFIG_NLS_UTF8=m
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+CONFIG_NLS_CODEPAGE_850=y
+CONFIG_NLS_CODEPAGE_852=y
+# 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=y
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_2=y
+# 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=y
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="mem=48M"
+CONFIG_CMDLINE="console=ttyS0,115200"
 # CONFIG_CMDLINE_OVERRIDE is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1181,67 +1536,32 @@ CONFIG_CMDLINE="mem=48M"
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=m
-CONFIG_CRYPTO_MANAGER=m
-CONFIG_CRYPTO_HMAC=m
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=y
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index a151313731381c5be32c574eeff84641fa297da6..5424c9167bf2b891e2e711d81c85c863aeb95679 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:26 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 08:46:33 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-CONFIG_MIPS_DB1500=y
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+CONFIG_MIPS_DB1500=y
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1500=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1500=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -87,6 +111,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -94,11 +119,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -108,137 +136,207 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_RESOURCES_64BIT=y
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-db1500"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_PCI_QUIRKS=y
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCI_LEGACY is not set
+# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
-CONFIG_CARDBUS=y
+# CONFIG_PCMCIA_IOCTL is not set
+# CONFIG_CARDBUS is not set
 
 #
 # PC-card bridges
@@ -246,51 +344,49 @@ CONFIG_CARDBUS=y
 # CONFIG_YENTA is not set
 # CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
-CONFIG_PCMCIA_AU1X00=m
-
-#
-# PCI Hotplug Support
-#
+# CONFIG_PCMCIA_AU1X00 is not set
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -301,110 +397,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -414,27 +425,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -443,25 +451,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -474,6 +482,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -499,14 +508,14 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -524,152 +533,152 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
+# LPDDR flash memory drivers
 #
-# CONFIG_PNPACPI is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM 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_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
 # CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
-
-#
-# Misc devices
-#
-CONFIG_SGI_IOC4=m
-# CONFIG_TIFM_CORE is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=4
-CONFIG_BLK_DEV_IDE=y
 
 #
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+CONFIG_IDE_XFER_MODE=y
 # CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_DELKIN is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI 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
+CONFIG_IDE_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
 # CONFIG_IDE_GENERIC is not set
-# CONFIG_BLK_DEV_IDEPCI is not set
-# 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
+# CONFIG_BLK_DEV_PLATFORM is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
+CONFIG_BLK_DEV_IDEPCI=y
+# CONFIG_IDEPCI_PCIBUS_ORDER is not set
+# CONFIG_BLK_DEV_OFFBOARD is not set
+# CONFIG_BLK_DEV_GENERIC is not set
+# CONFIG_BLK_DEV_OPTI621 is not set
+CONFIG_BLK_DEV_IDEDMA_PCI=y
+# CONFIG_BLK_DEV_AEC62XX is not set
+# CONFIG_BLK_DEV_ALI15X3 is not set
+# CONFIG_BLK_DEV_AMD74XX is not set
+# CONFIG_BLK_DEV_CMD64X is not set
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+CONFIG_BLK_DEV_HPT366=y
+# CONFIG_BLK_DEV_JMICRON is not set
+# CONFIG_BLK_DEV_SC1200 is not set
+# CONFIG_BLK_DEV_PIIX is not set
+# CONFIG_BLK_DEV_IT8172 is not set
+# CONFIG_BLK_DEV_IT8213 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 is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+# CONFIG_BLK_DEV_VIA82CXXX is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
+CONFIG_BLK_DEV_IDEDMA=y
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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
+# You can enable one or both FireWire driver stacks.
 #
-# CONFIG_I2O is not set
 
 #
-# Network device support
+# The newer stack is recommended.
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -677,88 +686,51 @@ CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# 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_SKY2 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=m
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=m
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=m
-
-#
-# Token Ring devices
-#
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_ATL2 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
+# CONFIG_WLAN is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Enable WiMAX (Networking options) to see the WiMAX drivers
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# PCMCIA network device support
+# USB Network Adapters
 #
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
 # CONFIG_NET_PCMCIA is not set
-
-#
-# Wan interfaces
-#
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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_VMXNET3 is not set
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -766,16 +738,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -785,33 +755,34 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
+# CONFIG_NOZOMI is not set
 
 #
 # Serial drivers
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
+# CONFIG_SERIAL_8250_PCI is not set
 # CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
@@ -825,301 +796,143 @@ 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
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 
 #
-# Dallas's 1-wire bus
+# PPS support
 #
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
-# CONFIG_USB_DABUSB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGA_ARB is not set
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
-#
-CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-CONFIG_SND_RAWMIDI=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_PCM_OSS_PLUGINS=y
-CONFIG_SND_SEQUENCER_OSS=y
-# CONFIG_SND_DYNAMIC_MINORS is not set
-CONFIG_SND_SUPPORT_OLD_API=y
-CONFIG_SND_VERBOSE_PROCFS=y
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_AC97_CODEC=m
-# CONFIG_SND_DUMMY is not set
-CONFIG_SND_VIRMIDI=m
-CONFIG_SND_MTPAV=m
-# CONFIG_SND_SERIAL_U16550 is not set
-# CONFIG_SND_MPU401 is not set
-
-#
-# PCI devices
-#
-# CONFIG_SND_AD1889 is not set
-# CONFIG_SND_ALS300 is not set
-# CONFIG_SND_ALI5451 is not set
-# CONFIG_SND_ATIIXP is not set
-# CONFIG_SND_ATIIXP_MODEM is not set
-# CONFIG_SND_AU8810 is not set
-# CONFIG_SND_AU8820 is not set
-# CONFIG_SND_AU8830 is not set
-# CONFIG_SND_AZT3328 is not set
-# CONFIG_SND_BT87X is not set
-# CONFIG_SND_CA0106 is not set
-# CONFIG_SND_CMIPCI is not set
-# CONFIG_SND_CS4281 is not set
-# CONFIG_SND_CS46XX is not set
-# CONFIG_SND_DARLA20 is not set
-# CONFIG_SND_GINA20 is not set
-# CONFIG_SND_LAYLA20 is not set
-# CONFIG_SND_DARLA24 is not set
-# CONFIG_SND_GINA24 is not set
-# CONFIG_SND_LAYLA24 is not set
-# CONFIG_SND_MONA is not set
-# CONFIG_SND_MIA is not set
-# CONFIG_SND_ECHO3G is not set
-# CONFIG_SND_INDIGO is not set
-# CONFIG_SND_INDIGOIO is not set
-# CONFIG_SND_INDIGODJ is not set
-# CONFIG_SND_EMU10K1 is not set
-# CONFIG_SND_EMU10K1X is not set
-# CONFIG_SND_ENS1370 is not set
-# CONFIG_SND_ENS1371 is not set
-# CONFIG_SND_ES1938 is not set
-# CONFIG_SND_ES1968 is not set
-# CONFIG_SND_FM801 is not set
-# CONFIG_SND_HDA_INTEL is not set
-# CONFIG_SND_HDSP is not set
-# CONFIG_SND_HDSPM is not set
-# CONFIG_SND_ICE1712 is not set
-# CONFIG_SND_ICE1724 is not set
-# CONFIG_SND_INTEL8X0 is not set
-# CONFIG_SND_INTEL8X0M is not set
-# CONFIG_SND_KORG1212 is not set
-# CONFIG_SND_MAESTRO3 is not set
-# CONFIG_SND_MIXART is not set
-# CONFIG_SND_NM256 is not set
-# CONFIG_SND_PCXHR is not set
-# CONFIG_SND_RIPTIDE is not set
-# CONFIG_SND_RME32 is not set
-# CONFIG_SND_RME96 is not set
-# CONFIG_SND_RME9652 is not set
-# CONFIG_SND_SONICVIBES is not set
-# CONFIG_SND_TRIDENT is not set
-# CONFIG_SND_VIA82XX is not set
-# CONFIG_SND_VIA82XX_MODEM is not set
-# CONFIG_SND_VX222 is not set
-# CONFIG_SND_YMFPCI is not set
-# CONFIG_SND_AC97_POWER_SAVE is not set
-
-#
-# ALSA MIPS devices
-#
-CONFIG_SND_AU1X00=m
-
-#
-# USB devices
-#
-# CONFIG_SND_USB_AUDIO is not set
-
-#
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_PDAUDIOCF is not set
-
-#
-# SoC audio support
-#
-# CONFIG_SND_SOC is not set
-
-#
-# Open Sound System
-#
-CONFIG_SOUND_PRIME=y
-# CONFIG_OBSOLETE_OSS is not set
-# CONFIG_SOUND_BT878 is not set
-# CONFIG_SOUND_ICH is not set
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
-# CONFIG_SOUND_VIA82CXXX is not set
-CONFIG_AC97_BUS=m
-
-#
-# HID Devices
-#
-CONFIG_HID=y
-# CONFIG_HID_DEBUG is not set
-
-#
-# USB support
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
 #
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_USB=y
 # CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
 #
 # CONFIG_USB_DEVICEFS is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
 CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_UHCI_HCD is not set
 # CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
 # USB Device Class drivers
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# also be needed; see USB_STORAGE Help for more info
 #
 # CONFIG_USB_LIBUSUAL is not set
 
-#
-# USB Input Devices
-#
-CONFIG_USB_HID=y
-# CONFIG_USB_HIDINPUT_POWERBOOK is not set
-# CONFIG_HID_FF is not set
-# CONFIG_USB_HIDDEV is not set
-# CONFIG_USB_AIPTEK is not set
-# CONFIG_USB_WACOM is not set
-# CONFIG_USB_ACECAD is not set
-# CONFIG_USB_KBTAB is not set
-# CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_TOUCHSCREEN is not set
-CONFIG_USB_YEALINK=m
-# CONFIG_USB_XPAD is not set
-# CONFIG_USB_ATI_REMOTE is not set
-# CONFIG_USB_ATI_REMOTE2 is not set
-# CONFIG_USB_KEYSPAN_REMOTE is not set
-# CONFIG_USB_APPLETOUCH is not set
-# CONFIG_USB_GTCO is not set
-
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
 
-#
-# USB Network Adapters
-#
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_USBNET_MII is not set
-# CONFIG_USB_USBNET is not set
-CONFIG_USB_MON=y
-
 #
 # USB port drivers
 #
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -1128,7 +941,7 @@ CONFIG_USB_MON=y
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
 # CONFIG_USB_ADUTUX is not set
-# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_SEVSEG is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
@@ -1136,112 +949,107 @@ CONFIG_USB_MON=y
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGET is not set
 # CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_FTDI_ELAN is not set
 # CONFIG_USB_APPLEDISPLAY is not set
-CONFIG_USB_LD=m
+# CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
 
 #
-# MMC/SD Card support
+# OTG and related infrastructure
 #
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
 # CONFIG_MMC is not set
-
-#
-# LED devices
-#
+# CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
+# CONFIG_ACCESSIBILITY is not set
 # CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
+# RTC interfaces
 #
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Engine support
+# SPI RTC drivers
 #
-# CONFIG_DMA_ENGINE is not set
 
 #
-# DMA Clients
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# DMA Devices
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Auxiliary Display support
-#
-
-#
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -1260,74 +1068,81 @@ CONFIG_GENERIC_ACL=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+CONFIG_JFFS2_FS_POSIX_ACL=y
+CONFIG_JFFS2_FS_SECURITY=y
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+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_850=y
 # CONFIG_NLS_CODEPAGE_852 is not set
 # CONFIG_NLS_CODEPAGE_855 is not set
 # CONFIG_NLS_CODEPAGE_857 is not set
@@ -1345,10 +1160,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_1250=y
 # CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 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
@@ -1358,38 +1173,76 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1397,67 +1250,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index 6b64339c0014ada688a086d4389479df40fe603c..949b6dcf634b873e75cc9e2a49fe322dfc368641 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:27 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 08:58:22 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-CONFIG_MIPS_DB1550=y
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+CONFIG_MIPS_DB1550=y
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1550=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1550=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -86,6 +110,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -93,11 +118,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -107,137 +135,205 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_RESOURCES_64BIT=y
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-db1550"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_PCI_QUIRKS=y
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
-CONFIG_CARDBUS=y
+# CONFIG_PCMCIA_IOCTL is not set
+# CONFIG_CARDBUS is not set
 
 #
 # PC-card bridges
@@ -245,51 +341,49 @@ CONFIG_CARDBUS=y
 # CONFIG_YENTA is not set
 # CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
-CONFIG_PCMCIA_AU1X00=m
-
-#
-# PCI Hotplug Support
-#
+# CONFIG_PCMCIA_AU1X00 is not set
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -300,110 +394,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -413,27 +422,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -442,25 +448,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -473,6 +479,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -498,20 +505,23 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
 # Self-contained MTD device drivers
 #
 # CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SST25L is not set
 # CONFIG_MTD_SLRAM is not set
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
@@ -523,105 +533,96 @@ CONFIG_MTD_ALCHEMY=y
 # 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=m
+CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_VERIFY_WRITE is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
-CONFIG_MTD_NAND_IDS=m
-CONFIG_MTD_NAND_AU1550=m
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=y
+CONFIG_MTD_NAND_AU1550=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
 # CONFIG_MTD_NAND_CAFE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
-
-#
-# OneNAND Flash Device Drivers
-#
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM 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_SX8 is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
-
-#
-# Misc devices
-#
-CONFIG_SGI_IOC4=m
-# CONFIG_TIFM_CORE is not set
+# CONFIG_BLK_DEV_LOOP is not set
 
 #
-# ATA/ATAPI/MFM/RLL support
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
 #
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_UB=y
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=4
-CONFIG_BLK_DEV_IDE=y
 
 #
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_ATAPI=y
 # CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_DELKIN is not set
-# CONFIG_BLK_DEV_IDECD is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+CONFIG_BLK_DEV_IDECD=y
+# CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_TASK_IOCTL=y
+CONFIG_IDE_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
 CONFIG_BLK_DEV_IDEPCI=y
-# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_IDEPCI_PCIBUS_ORDER is not set
 # CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_GENERIC is not set
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_PCI_AUTO is not set
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 # CONFIG_BLK_DEV_AMD74XX is not set
 # CONFIG_BLK_DEV_CMD64X is not set
 # CONFIG_BLK_DEV_TRIFLEX is not set
-# CONFIG_BLK_DEV_CY82C693 is not set
 # CONFIG_BLK_DEV_CS5520 is not set
 # CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_HPT34X is not set
-# CONFIG_BLK_DEV_HPT366 is not set
+CONFIG_BLK_DEV_HPT366=y
 # CONFIG_BLK_DEV_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
 # CONFIG_BLK_DEV_PIIX is not set
-CONFIG_BLK_DEV_IT8213=m
+# CONFIG_BLK_DEV_IT8172 is not set
+# CONFIG_BLK_DEV_IT8213 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
@@ -631,82 +632,65 @@ CONFIG_BLK_DEV_IT8213=m
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
-CONFIG_BLK_DEV_TC86C001=m
-# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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
+# You can enable one or both FireWire driver stacks.
 #
-# CONFIG_I2O is not set
 
 #
-# Network device support
+# The newer stack is recommended.
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -714,96 +698,53 @@ CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_ENC28J60 is not set
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# 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_SKY2 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=m
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=m
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=m
-
-#
-# Token Ring devices
-#
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_ATL2 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
+# CONFIG_WLAN is not set
 
 #
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# PCMCIA network device support
+# Enable WiMAX (Networking options) to see the WiMAX drivers
 #
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
 
 #
-# Wan interfaces
+# USB Network Adapters
 #
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_NET_PCMCIA is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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_VMXNET3 is not set
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -811,16 +752,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -830,26 +769,27 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
+# CONFIG_NOZOMI is not set
 
 #
 # Serial drivers
@@ -866,199 +806,420 @@ CONFIG_SERIAL_8250_AU1X00=y
 #
 # Non-8250 serial port support
 #
+# CONFIG_SERIAL_MAX3100 is not set
 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
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_DEVPORT=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
 
 #
-# TPM devices
+# I2C Algorithms
 #
-# CONFIG_TCG_TPM is not set
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
 
 #
-# I2C support
+# I2C Hardware Bus support
 #
-# CONFIG_I2C is not set
 
 #
-# SPI support
+# PC SMBus host controller drivers
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_ISCH is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
 
 #
-# Dallas's 1-wire bus
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
-# CONFIG_W1 is not set
+CONFIG_I2C_AU1550=y
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
 
 #
-# Hardware Monitoring support
+# External I2C/SMBus adapter drivers
 #
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
 
 #
-# Multimedia devices
+# Other I2C/SMBus bus drivers
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Miscellaneous I2C Chip support
 #
-# CONFIG_DVB is not set
+# CONFIG_SENSORS_TSL2550 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
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
 
 #
-# Graphics support
+# SPI Master Controller Drivers
 #
-# CONFIG_FIRMWARE_EDID is not set
-# CONFIG_FB is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+CONFIG_SPI_AU1550=y
+CONFIG_SPI_BITBANG=y
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
-# Sound
+# SPI Protocol Masters
 #
-# CONFIG_SOUND is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
 
 #
-# HID Devices
+# PPS support
 #
-# CONFIG_HID is not set
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# USB support
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13783 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGA_ARB is not set
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
 #
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+CONFIG_SND_HRTIMER=y
+CONFIG_SND_DYNAMIC_MINORS=y
+# CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_VERBOSE_PROCFS is not set
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_PCI is not set
+# CONFIG_SND_SPI is not set
+# CONFIG_SND_MIPS is not set
+CONFIG_SND_USB=y
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_PCMCIA is not set
+CONFIG_SND_SOC=y
+CONFIG_SND_SOC_AU1XPSC=y
+# CONFIG_SND_SOC_DB1200 is not set
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+# CONFIG_SOUND_PRIME is not set
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
-# CONFIG_INFINIBAND is not set
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# Real Time Clock
+# RTC interfaces
 #
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Engine support
+# I2C RTC drivers
 #
-# CONFIG_DMA_ENGINE is not set
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -1077,75 +1238,82 @@ CONFIG_GENERIC_ACL=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_CONFIGFS_FS=y
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+# CONFIG_JFFS2_FS_POSIX_ACL is not set
+# CONFIG_JFFS2_FS_SECURITY is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+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_850=y
+CONFIG_NLS_CODEPAGE_852=y
 # CONFIG_NLS_CODEPAGE_855 is not set
 # CONFIG_NLS_CODEPAGE_857 is not set
 # CONFIG_NLS_CODEPAGE_860 is not set
@@ -1162,10 +1330,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_1250=y
 # CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 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
@@ -1175,38 +1343,75 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1214,67 +1419,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index ed84b4cb3c8dc2d0f7ac49fbbf9cfbf6967da512..84b6503f10b9411b7119be86360964c6aa50fa6d 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc2
-# Tue Aug  7 13:04:24 2007
+# Linux kernel version: 2.6.33-rc6
+# Wed Feb  3 18:12:31 2010
 #
 CONFIG_MIPS=y
 
@@ -9,20 +9,28 @@ CONFIG_MIPS=y
 # Machine selection
 #
 # CONFIG_MACH_ALCHEMY is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
-# CONFIG_LEMOTE_FULONG is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_NEC_MARKEINS is not set
 # CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
 # CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 CONFIG_SGI_IP27=y
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
 # CONFIG_SIBYTE_CRHINE is not set
 # CONFIG_SIBYTE_CARMEL is not set
@@ -33,32 +41,39 @@ CONFIG_SGI_IP27=y
 # CONFIG_SIBYTE_SENTOSA is not set
 # CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
 # CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
 CONFIG_SGI_SN_M_MODE=y
 # CONFIG_SGI_SN_N_MODE is not set
 # CONFIG_MAPPED_KERNEL is not set
 # CONFIG_REPLICATE_KTEXT is not set
 # CONFIG_REPLICATE_EXHANDLERS is not set
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 CONFIG_ARC=y
 CONFIG_DMA_COHERENT=y
-CONFIG_EARLY_PRINTK=y
 CONFIG_SYS_HAS_EARLY_PRINTK=y
 # CONFIG_NO_IOPORT is not set
 CONFIG_CPU_BIG_ENDIAN=y
 # CONFIG_CPU_LITTLE_ENDIAN is not set
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_DEFAULT_SGI_PARTITION=y
 CONFIG_MIPS_L1_CACHE_SHIFT=7
 CONFIG_ARC64=y
 CONFIG_BOOT_ELF64=y
@@ -66,7 +81,8 @@ CONFIG_BOOT_ELF64=y
 #
 # CPU selection
 #
-# CONFIG_CPU_LOONGSON2 is not set
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 # CONFIG_CPU_MIPS32_R1 is not set
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -79,6 +95,7 @@ CONFIG_BOOT_ELF64=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -86,6 +103,7 @@ CONFIG_CPU_R10000=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
 CONFIG_SYS_HAS_CPU_R10000=y
 CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
@@ -99,6 +117,7 @@ CONFIG_64BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
@@ -110,6 +129,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_NUMA=y
 CONFIG_SYS_SUPPORTS_NUMA=y
 CONFIG_NODES_SHIFT=6
@@ -120,16 +140,22 @@ CONFIG_DISCONTIGMEM_MANUAL=y
 CONFIG_DISCONTIGMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_NEED_MULTIPLE_NODES=y
-# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-CONFIG_RESOURCES_64BIT=y
+CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
 CONFIG_SMP=y
 CONFIG_SYS_SUPPORTS_SMP=y
 CONFIG_NR_CPUS_DEFAULT_64=y
 CONFIG_NR_CPUS=64
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
 # CONFIG_HZ_100 is not set
 # CONFIG_HZ_128 is not set
@@ -142,13 +168,13 @@ CONFIG_HZ=1000
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
-CONFIG_PREEMPT_BKL=y
 # CONFIG_MIPS_INSANE_LARGE is not set
 # CONFIG_KEXEC is not set
 CONFIG_SECCOMP=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -162,20 +188,41 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=64
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=15
+# CONFIG_GROUP_SCHED is not set
 CONFIG_CGROUPS=y
+# CONFIG_CGROUP_DEBUG is not set
+# CONFIG_CGROUP_NS is not set
+# CONFIG_CGROUP_FREEZER is not set
+# CONFIG_CGROUP_DEVICE is not set
 CONFIG_CPUSETS=y
-CONFIG_SYSFS_DEPRECATED=y
+CONFIG_PROC_PID_CPUSET=y
+# CONFIG_CGROUP_CPUACCT is not set
+# CONFIG_RESOURCE_COUNTERS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
 CONFIG_RELAY=y
+# CONFIG_NAMESPACES is not set
 # CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -184,44 +231,92 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_PCI_QUIRKS=y
+CONFIG_COMPAT_BRK=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_SYSCALL_WRAPPERS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+
+#
+# GCOV-based kernel profiling
+#
+CONFIG_SLOW_WORK=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_BLOCK=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+# CONFIG_BLK_CGROUP is not set
+CONFIG_BLOCK_COMPAT=y
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_CFQ_GROUP_IOSCHED is not set
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+# CONFIG_FREEZER is not set
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
@@ -230,11 +325,10 @@ CONFIG_HW_HAS_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCI_LEGACY is not set
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 
@@ -242,8 +336,9 @@ CONFIG_MMU=y
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_BUILD_ELF64 is not set
 CONFIG_MIPS32_COMPAT=y
 CONFIG_COMPAT=y
 CONFIG_SYSVIPC_COMPAT=y
@@ -255,13 +350,10 @@ CONFIG_BINFMT_ELF32=y
 # Power management options
 #
 CONFIG_PM=y
-# CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-
-#
-# Networking
-#
+# CONFIG_PM_RUNTIME is not set
 CONFIG_NET=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
 
 #
 # Networking options
@@ -273,6 +365,8 @@ CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 # CONFIG_XFRM_SUB_POLICY is not set
 CONFIG_XFRM_MIGRATE=y
+CONFIG_XFRM_STATISTICS=y
+CONFIG_XFRM_IPCOMP=m
 CONFIG_NET_KEY=y
 CONFIG_NET_KEY_MIGRATE=y
 CONFIG_INET=y
@@ -292,19 +386,40 @@ CONFIG_IP_PNP=y
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_TUNNEL=m
 CONFIG_INET_XFRM_MODE_TRANSPORT=m
 CONFIG_INET_XFRM_MODE_TUNNEL=m
 CONFIG_INET_XFRM_MODE_BEET=m
+CONFIG_INET_LRO=y
 CONFIG_INET_DIAG=y
 CONFIG_INET_TCP_DIAG=y
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_TCP_MD5SIG=y
-# CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=m
+CONFIG_INET6_ESP=m
+CONFIG_INET6_IPCOMP=m
+CONFIG_IPV6_MIP6=m
+CONFIG_INET6_XFRM_TUNNEL=m
+CONFIG_INET6_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
+CONFIG_IPV6_SIT=m
+CONFIG_IPV6_SIT_6RD=y
+CONFIG_IPV6_NDISC_NODETYPE=y
+CONFIG_IPV6_TUNNEL=m
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+CONFIG_IPV6_MROUTE=y
+CONFIG_IPV6_PIMSM_V2=y
 CONFIG_NETWORK_SECMARK=y
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -314,9 +429,11 @@ CONFIG_IP_SCTP=m
 # CONFIG_SCTP_HMAC_NONE is not set
 # CONFIG_SCTP_HMAC_SHA1 is not set
 CONFIG_SCTP_HMAC_MD5=y
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -326,12 +443,9 @@ CONFIG_SCTP_HMAC_MD5=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_FIFO=y
 
 #
 # Queueing/Scheduling
@@ -340,7 +454,7 @@ CONFIG_NET_SCH_CBQ=m
 CONFIG_NET_SCH_HTB=m
 CONFIG_NET_SCH_HFSC=m
 CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RR=m
+CONFIG_NET_SCH_MULTIQ=y
 CONFIG_NET_SCH_RED=m
 CONFIG_NET_SCH_SFQ=m
 CONFIG_NET_SCH_TEQL=m
@@ -348,6 +462,7 @@ CONFIG_NET_SCH_TBF=m
 CONFIG_NET_SCH_GRED=m
 CONFIG_NET_SCH_DSMARK=m
 CONFIG_NET_SCH_NETEM=m
+# CONFIG_NET_SCH_DRR is not set
 CONFIG_NET_SCH_INGRESS=m
 
 #
@@ -364,41 +479,63 @@ CONFIG_NET_CLS_U32=m
 CONFIG_CLS_U32_MARK=y
 CONFIG_NET_CLS_RSVP=m
 CONFIG_NET_CLS_RSVP6=m
+CONFIG_NET_CLS_FLOW=m
+CONFIG_NET_CLS_CGROUP=y
 # CONFIG_NET_EMATCH is not set
 CONFIG_NET_CLS_ACT=y
 CONFIG_NET_ACT_POLICE=y
 CONFIG_NET_ACT_GACT=m
 CONFIG_GACT_PROB=y
 CONFIG_NET_ACT_MIRRED=m
+CONFIG_NET_ACT_NAT=m
 CONFIG_NET_ACT_PEDIT=m
 # CONFIG_NET_ACT_SIMP is not set
-CONFIG_NET_CLS_POLICE=y
+CONFIG_NET_ACT_SKBEDIT=m
 # CONFIG_NET_CLS_IND is not set
+CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-
-#
-# Wireless
-#
-CONFIG_CFG80211=m
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
 CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=m
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_WIRELESS_OLD_REGULATORY is not set
+CONFIG_CFG80211_WEXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
+CONFIG_LIB80211=m
+CONFIG_LIB80211_CRYPT_WEP=m
+CONFIG_LIB80211_CRYPT_CCMP=m
+CONFIG_LIB80211_CRYPT_TKIP=m
+# CONFIG_LIB80211_DEBUG is not set
 CONFIG_MAC80211=m
-# CONFIG_MAC80211_DEBUG is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_CRYPT_TKIP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
+CONFIG_MAC80211_RC_PID=y
+CONFIG_MAC80211_RC_MINSTREL=y
+# CONFIG_MAC80211_RC_DEFAULT_PID is not set
+CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
+CONFIG_MAC80211_RC_DEFAULT="minstrel"
+# CONFIG_MAC80211_MESH is not set
+CONFIG_MAC80211_LEDS=y
+# CONFIG_MAC80211_DEBUG_MENU is not set
+# CONFIG_WIMAX is not set
 CONFIG_RFKILL=m
+CONFIG_RFKILL_LEDS=y
 # CONFIG_NET_9P is not set
 
 #
@@ -408,9 +545,13 @@ CONFIG_RFKILL=m
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 CONFIG_CONNECTOR=m
 # CONFIG_MTD is not set
@@ -423,14 +564,19 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_OSD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
 CONFIG_CDROM_PKTCDVD=m
 CONFIG_CDROM_PKTCDVD_BUFFERS=8
 # CONFIG_CDROM_PKTCDVD_WCACHE is not set
 CONFIG_ATA_OVER_ETH=m
+# CONFIG_BLK_DEV_HD is not set
 # CONFIG_MISC_DEVICES is not set
+CONFIG_EEPROM_93CX6=m
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -453,10 +599,6 @@ CONFIG_BLK_DEV_SR=m
 CONFIG_BLK_DEV_SR_VENDOR=y
 CONFIG_CHR_DEV_SG=m
 CONFIG_CHR_DEV_SCH=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
 # CONFIG_SCSI_MULTI_LUN is not set
 CONFIG_SCSI_CONSTANTS=y
 CONFIG_SCSI_LOGGING=y
@@ -471,11 +613,18 @@ CONFIG_SCSI_FC_ATTRS=y
 CONFIG_SCSI_ISCSI_ATTRS=m
 CONFIG_SCSI_SAS_ATTRS=m
 CONFIG_SCSI_SAS_LIBSAS=m
+CONFIG_SCSI_SAS_HOST_SMP=y
 # CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+CONFIG_SCSI_CXGB3_ISCSI=m
+CONFIG_SCSI_BNX2_ISCSI=m
+CONFIG_BE2ISCSI=m
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+CONFIG_SCSI_HPSA=m
 # CONFIG_SCSI_3W_9XXX is not set
+CONFIG_SCSI_3W_SAS=m
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -483,11 +632,21 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_AIC79XX is not set
 CONFIG_SCSI_AIC94XX=m
 # CONFIG_AIC94XX_DEBUG is not set
+CONFIG_SCSI_MVSAS=m
+# CONFIG_SCSI_MVSAS_DEBUG is not set
+CONFIG_SCSI_DPT_I2O=m
+# CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_ARCMSR is not set
 # CONFIG_MEGARAID_NEWGEN is not set
 # CONFIG_MEGARAID_LEGACY is not set
 # CONFIG_MEGARAID_SAS is not set
+CONFIG_SCSI_MPT2SAS=m
+CONFIG_SCSI_MPT2SAS_MAX_SGE=128
+# CONFIG_SCSI_MPT2SAS_LOGGING is not set
 # CONFIG_SCSI_HPTIOP is not set
+CONFIG_LIBFC=m
+# CONFIG_LIBFCOE is not set
+# CONFIG_FCOE is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_IPS is not set
@@ -502,16 +661,31 @@ CONFIG_SCSI_QLOGIC_1280=y
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_DEBUG is not set
+CONFIG_SCSI_PMCRAID=m
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
+CONFIG_SCSI_BFA_FC=m
+CONFIG_SCSI_DH=m
+CONFIG_SCSI_DH_RDAC=m
+CONFIG_SCSI_DH_HP_SW=m
+CONFIG_SCSI_DH_EMC=m
+CONFIG_SCSI_DH_ALUA=m
+CONFIG_SCSI_OSD_INITIATOR=m
+CONFIG_SCSI_OSD_ULD=m
+CONFIG_SCSI_OSD_DPRINT_SENSE=1
+# CONFIG_SCSI_OSD_DEBUG is not set
 # CONFIG_ATA is not set
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
+CONFIG_MD_AUTODETECT=y
 CONFIG_MD_LINEAR=m
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
 CONFIG_MD_RAID10=m
 CONFIG_MD_RAID456=y
-CONFIG_MD_RAID5_RESHAPE=y
+# CONFIG_MULTICORE_RAID456 is not set
+CONFIG_MD_RAID6_PQ=y
+# CONFIG_ASYNC_RAID6_TEST is not set
 CONFIG_MD_MULTIPATH=m
 CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=m
@@ -519,36 +693,39 @@ CONFIG_BLK_DEV_DM=m
 CONFIG_DM_CRYPT=m
 CONFIG_DM_SNAPSHOT=m
 CONFIG_DM_MIRROR=m
+CONFIG_DM_LOG_USERSPACE=m
 CONFIG_DM_ZERO=m
 CONFIG_DM_MULTIPATH=m
-CONFIG_DM_MULTIPATH_EMC=m
-CONFIG_DM_MULTIPATH_RDAC=m
+CONFIG_DM_MULTIPATH_QL=m
+CONFIG_DM_MULTIPATH_ST=m
 # CONFIG_DM_DELAY is not set
+CONFIG_DM_UEVENT=y
+# CONFIG_FUSION is not set
 
 #
-# Fusion MPT device support
+# IEEE 1394 (FireWire) support
 #
-# CONFIG_FUSION is not set
-# CONFIG_FUSION_SPI is not set
-# CONFIG_FUSION_FC is not set
-# CONFIG_FUSION_SAS is not set
 
 #
-# IEEE 1394 (FireWire) support
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-CONFIG_NETDEVICES_MULTIQUEUE=y
 CONFIG_IFB=m
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 CONFIG_MACVLAN=m
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
+CONFIG_VETH=m
 # CONFIG_ARCNET is not set
-CONFIG_PHYLIB=m
+CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
@@ -562,23 +739,51 @@ CONFIG_VITESSE_PHY=m
 CONFIG_SMSC_PHY=m
 # CONFIG_BROADCOM_PHY is not set
 CONFIG_ICPLUS_PHY=m
+CONFIG_REALTEK_PHY=m
+CONFIG_NATIONAL_PHY=m
+CONFIG_STE10XP=m
+CONFIG_LSI_ET1011C_PHY=m
 # CONFIG_FIXED_PHY is not set
+CONFIG_MDIO_BITBANG=m
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 CONFIG_AX88796=m
+CONFIG_AX88796_93CX6=y
 CONFIG_SGI_IOC3_ETH=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+CONFIG_SMC91X=m
 # CONFIG_DM9000 is not set
+CONFIG_ETHOC=m
+CONFIG_SMSC911X=m
+CONFIG_DNET=m
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
+CONFIG_B44=m
+CONFIG_B44_PCI_AUTOSELECT=y
+CONFIG_B44_PCICORE_AUTOSELECT=y
+CONFIG_B44_PCI=y
+CONFIG_KS8842=m
+CONFIG_KS8851_MLL=m
+CONFIG_ATL2=m
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
+CONFIG_E1000E=m
+CONFIG_IP1000=m
+CONFIG_IGB=m
+CONFIG_IGBVF=m
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -588,24 +793,75 @@ CONFIG_NETDEV_1000=y
 # CONFIG_SKY2 is not set
 CONFIG_VIA_VELOCITY=m
 # CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
+CONFIG_BNX2=m
+CONFIG_CNIC=m
 CONFIG_QLA3XXX=m
 # CONFIG_ATL1 is not set
+CONFIG_ATL1E=m
+CONFIG_ATL1C=m
+CONFIG_JME=m
 CONFIG_NETDEV_10000=y
+CONFIG_MDIO=m
 # CONFIG_CHELSIO_T1 is not set
+CONFIG_CHELSIO_T3_DEPENDS=y
 CONFIG_CHELSIO_T3=m
+CONFIG_ENIC=m
+CONFIG_IXGBE=m
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+CONFIG_VXGE=m
+# CONFIG_VXGE_DEBUG_TRACE_ALL is not set
 # CONFIG_MYRI10GE is not set
 CONFIG_NETXEN_NIC=m
-# CONFIG_MLX4_CORE is not set
+CONFIG_NIU=m
+CONFIG_MLX4_EN=m
+CONFIG_MLX4_CORE=m
+# CONFIG_MLX4_DEBUG is not set
+CONFIG_TEHUTI=m
+CONFIG_BNX2X=m
+CONFIG_QLGE=m
+CONFIG_SFC=m
+CONFIG_BE2NET=m
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-CONFIG_WLAN_80211=y
+CONFIG_WLAN=y
+CONFIG_LIBERTAS_THINFIRM=m
+CONFIG_ATMEL=m
+CONFIG_PCI_ATMEL=m
+CONFIG_PRISM54=m
+CONFIG_RTL8180=m
+CONFIG_ADM8211=m
+# CONFIG_MAC80211_HWSIM is not set
+CONFIG_MWL8K=m
+CONFIG_ATH_COMMON=m
+# CONFIG_ATH_DEBUG is not set
+CONFIG_ATH5K=m
+# CONFIG_ATH5K_DEBUG is not set
+CONFIG_ATH9K_HW=m
+CONFIG_ATH9K_COMMON=m
+CONFIG_ATH9K=m
+CONFIG_B43=m
+CONFIG_B43_PCI_AUTOSELECT=y
+CONFIG_B43_PCICORE_AUTOSELECT=y
+CONFIG_B43_PHY_LP=y
+CONFIG_B43_LEDS=y
+CONFIG_B43_HWRNG=y
+# CONFIG_B43_DEBUG is not set
+CONFIG_B43LEGACY=m
+CONFIG_B43LEGACY_PCI_AUTOSELECT=y
+CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
+CONFIG_B43LEGACY_LEDS=y
+CONFIG_B43LEGACY_HWRNG=y
+# CONFIG_B43LEGACY_DEBUG is not set
+CONFIG_B43LEGACY_DMA=y
+CONFIG_B43LEGACY_PIO=y
+CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y
+# CONFIG_B43LEGACY_DMA_MODE is not set
+# CONFIG_B43LEGACY_PIO_MODE is not set
+CONFIG_HOSTAP=m
+CONFIG_HOSTAP_FIRMWARE=y
+CONFIG_HOSTAP_FIRMWARE_NVRAM=y
+CONFIG_HOSTAP_PLX=m
+CONFIG_HOSTAP_PCI=m
 CONFIG_IPW2100=m
 CONFIG_IPW2100_MONITOR=y
 CONFIG_IPW2100_DEBUG=y
@@ -615,38 +871,57 @@ CONFIG_IPW2200_RADIOTAP=y
 CONFIG_IPW2200_PROMISCUOUS=y
 CONFIG_IPW2200_QOS=y
 CONFIG_IPW2200_DEBUG=y
+CONFIG_LIBIPW=m
+# CONFIG_LIBIPW_DEBUG is not set
+CONFIG_IWLWIFI=m
+CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
+# CONFIG_IWLWIFI_DEBUG is not set
+CONFIG_IWLAGN=m
+CONFIG_IWL4965=y
+CONFIG_IWL5000=y
+CONFIG_IWL3945=m
+CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
 CONFIG_LIBERTAS=m
 # CONFIG_LIBERTAS_DEBUG is not set
 CONFIG_HERMES=m
+# CONFIG_HERMES_CACHE_FW_ON_INIT is not set
 CONFIG_PLX_HERMES=m
 CONFIG_TMD_HERMES=m
 CONFIG_NORTEL_HERMES=m
 CONFIG_PCI_HERMES=m
-CONFIG_ATMEL=m
-CONFIG_PCI_ATMEL=m
-CONFIG_PRISM54=m
-CONFIG_HOSTAP=m
-CONFIG_HOSTAP_FIRMWARE=y
-CONFIG_HOSTAP_FIRMWARE_NVRAM=y
-CONFIG_HOSTAP_PLX=m
-CONFIG_HOSTAP_PCI=m
-CONFIG_BCM43XX=m
-CONFIG_BCM43XX_DEBUG=y
-CONFIG_BCM43XX_DMA=y
-CONFIG_BCM43XX_PIO=y
-CONFIG_BCM43XX_DMA_AND_PIO_MODE=y
-# CONFIG_BCM43XX_DMA_MODE is not set
-# CONFIG_BCM43XX_PIO_MODE is not set
+CONFIG_P54_COMMON=m
+CONFIG_P54_PCI=m
+CONFIG_P54_LEDS=y
+CONFIG_RT2X00=m
+CONFIG_RT2400PCI=m
+CONFIG_RT2500PCI=m
+CONFIG_RT61PCI=m
+CONFIG_RT2800PCI_PCI=m
+CONFIG_RT2800PCI=m
+CONFIG_RT2800_LIB=m
+CONFIG_RT2X00_LIB_PCI=m
+CONFIG_RT2X00_LIB=m
+CONFIG_RT2X00_LIB_HT=y
+CONFIG_RT2X00_LIB_FIRMWARE=y
+CONFIG_RT2X00_LIB_CRYPTO=y
+CONFIG_RT2X00_LIB_LEDS=y
+# CONFIG_RT2X00_DEBUG is not set
+CONFIG_WL12XX=m
+CONFIG_WL1251=m
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 # CONFIG_NET_FC 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
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -664,13 +939,16 @@ CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_PCIPS2 is not set
 CONFIG_SERIO_LIBPS2=m
 CONFIG_SERIO_RAW=m
+CONFIG_SERIO_ALTERA_PS2=m
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
 # CONFIG_VT is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
+CONFIG_NOZOMI=m
 
 #
 # Serial drivers
@@ -693,95 +971,258 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=m
-# CONFIG_RTC is not set
+CONFIG_HW_RANDOM_TIMERIOMEM=m
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
-# CONFIG_I2C is not set
+CONFIG_I2C=m
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=m
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=m
+CONFIG_I2C_ALGOPCA=m
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# PC SMBus host controller drivers
+#
+CONFIG_I2C_ALI1535=m
+CONFIG_I2C_ALI1563=m
+CONFIG_I2C_ALI15X3=m
+CONFIG_I2C_AMD756=m
+CONFIG_I2C_AMD8111=m
+CONFIG_I2C_I801=m
+CONFIG_I2C_ISCH=m
+CONFIG_I2C_PIIX4=m
+CONFIG_I2C_NFORCE2=m
+CONFIG_I2C_SIS5595=m
+CONFIG_I2C_SIS630=m
+CONFIG_I2C_SIS96X=m
+CONFIG_I2C_VIA=m
+CONFIG_I2C_VIAPRO=m
 
 #
-# SPI support
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
+CONFIG_I2C_OCORES=m
+CONFIG_I2C_SIMTEC=m
+
+#
+# External I2C/SMBus adapter drivers
+#
+CONFIG_I2C_PARPORT_LIGHT=m
+CONFIG_I2C_TAOS_EVM=m
+
+#
+# Other I2C/SMBus bus drivers
+#
+CONFIG_I2C_PCA_PLATFORM=m
+CONFIG_I2C_STUB=m
+
+#
+# Miscellaneous I2C Chip support
+#
+CONFIG_SENSORS_TSL2550=m
+# 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
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+
+#
+# PPS support
+#
+CONFIG_PPS=m
+# CONFIG_PPS_DEBUG is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
+CONFIG_THERMAL=m
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multifunction device drivers
-#
-# CONFIG_MFD_SM501 is not set
+# Sonics Silicon Backplane
+#
+CONFIG_SSB=m
+CONFIG_SSB_SPROM=y
+CONFIG_SSB_PCIHOST_POSSIBLE=y
+CONFIG_SSB_PCIHOST=y
+CONFIG_SSB_B43_PCI_BRIDGE=y
+# CONFIG_SSB_SILENT is not set
+# CONFIG_SSB_DEBUG is not set
+CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
+CONFIG_SSB_DRIVER_PCICORE=y
+# CONFIG_SSB_DRIVER_MIPS is not set
 
 #
-# Multimedia devices
+# Multifunction device drivers
 #
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_DAB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_WM8400 is not set
+CONFIG_MFD_WM8350=m
+CONFIG_MFD_WM8350_I2C=m
+CONFIG_MFD_PCF50633=m
+CONFIG_PCF50633_ADC=m
+CONFIG_PCF50633_GPIO=m
+CONFIG_AB3100_CORE=m
+CONFIG_AB3100_OTP=m
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Display device support
-#
-# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGA_ARB is not set
+# CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
+# Display device support
 #
+# CONFIG_DISPLAY_SUPPORT is not set
 # CONFIG_SOUND is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_USB is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Enable Host or Gadget support to see Inventra options
 #
 
 #
-# USB Gadget Support
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_UWB is not set
 # CONFIG_MMC is not set
-# CONFIG_NEW_LEDS is not set
-# CONFIG_INFINIBAND is not set
-# CONFIG_RTC_CLASS is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=m
+
+#
+# LED drivers
+#
+CONFIG_LEDS_LP3944=m
+CONFIG_LEDS_PCA955X=m
+CONFIG_LEDS_WM8350=m
+CONFIG_LEDS_BD2802=m
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=m
+CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+CONFIG_LEDS_TRIGGER_BACKLIGHT=m
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
 
 #
-# DMA Engine support
+# iptables trigger is under Netfilter config (LED target)
 #
-# CONFIG_DMA_ENGINE is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# DMA Clients
+# RTC interfaces
 #
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Devices
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+
+#
+# SPI RTC drivers
+#
+
 #
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+CONFIG_RTC_DRV_M48T35=y
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+# CONFIG_RTC_DRV_WM8350 is not set
+# CONFIG_RTC_DRV_PCF50633 is not set
+CONFIG_RTC_DRV_AB3100=m
 
 #
-# Userspace I/O
+# on-CPU RTC drivers
 #
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 CONFIG_UIO=y
 # CONFIG_UIO_CIF is not set
+# CONFIG_UIO_PDRV is not set
+# CONFIG_UIO_PDRV_GENIRQ is not set
+CONFIG_UIO_SMX=m
+CONFIG_UIO_AEC=m
+CONFIG_UIO_SERCOS3=m
+CONFIG_UIO_PCI_GENERIC=m
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING is not set
 
 #
 # File systems
@@ -792,35 +1233,57 @@ CONFIG_EXT2_FS_POSIX_ACL=y
 CONFIG_EXT2_FS_SECURITY=y
 # CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
 CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_XATTR=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_EXT4_FS_SECURITY=y
+# CONFIG_EXT4_DEBUG is not set
 CONFIG_JBD=y
-CONFIG_JBD_DEBUG=y
+CONFIG_JBD2=y
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
 CONFIG_XFS_FS=m
 CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
 CONFIG_XFS_POSIX_ACL=y
 # CONFIG_XFS_RT is not set
+# CONFIG_XFS_DEBUG is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+CONFIG_BTRFS_FS=m
+CONFIG_BTRFS_FS_POSIX_ACL=y
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
+CONFIG_QUOTA_NETLINK_INTERFACE=y
 CONFIG_QUOTACTL=y
-CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=m
 # CONFIG_AUTOFS4_FS is not set
 CONFIG_FUSE_FS=m
+CONFIG_CUSE=m
 CONFIG_GENERIC_ACL=y
 
+#
+# Caches
+#
+CONFIG_FSCACHE=m
+CONFIG_FSCACHE_STATS=y
+# CONFIG_FSCACHE_HISTOGRAM is not set
+# CONFIG_FSCACHE_DEBUG is not set
+# CONFIG_FSCACHE_OBJECT_LIST is not set
+CONFIG_CACHEFILES=m
+# CONFIG_CACHEFILES_DEBUG is not set
+# CONFIG_CACHEFILES_HISTOGRAM is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -840,16 +1303,13 @@ CONFIG_GENERIC_ACL=y
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
 CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_ECRYPT_FS is not set
@@ -859,28 +1319,32 @@ CONFIG_CONFIGFS_FS=m
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=m
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+CONFIG_OMFS_FS=m
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_EXOFS_FS=m
+# CONFIG_EXOFS_DEBUG is not set
+CONFIG_NETWORK_FILESYSTEMS=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 is not set
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
 CONFIG_SUNRPC_GSS=y
-# CONFIG_SUNRPC_BIND34 is not set
 CONFIG_RPCSEC_GSS_KRB5=y
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -910,35 +1374,37 @@ CONFIG_SGI_PARTITION=y
 # CONFIG_KARMA_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
 # CONFIG_SYSV68_PARTITION is not set
-
-#
-# Native Language Support
-#
 # CONFIG_NLS is not set
-
-#
-# Distributed Lock Manager
-#
 CONFIG_DLM=m
 # CONFIG_DLM_DEBUG is not set
 
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=2048
 # CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-CONFIG_CROSSCOMPILE=y
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
 
 #
@@ -947,65 +1413,140 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-CONFIG_XOR_BLOCKS=m
-CONFIG_ASYNC_CORE=m
-CONFIG_ASYNC_MEMCPY=m
-CONFIG_ASYNC_XOR=m
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_XOR_BLOCKS=y
+CONFIG_ASYNC_CORE=y
+CONFIG_ASYNC_MEMCPY=y
+CONFIG_ASYNC_XOR=y
+CONFIG_ASYNC_PQ=y
+CONFIG_ASYNC_RAID6_RECOV=y
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_FIPS=y
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_ABLKCIPHER=m
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=m
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=m
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_GF128MUL=m
+CONFIG_CRYPTO_NULL=m
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_CRYPTO_CRYPTD=m
+CONFIG_CRYPTO_AUTHENC=m
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+CONFIG_CRYPTO_CCM=m
+CONFIG_CRYPTO_GCM=m
+CONFIG_CRYPTO_SEQIV=m
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_CTR=m
+CONFIG_CRYPTO_CTS=m
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_LRW=m
+CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_XTS=m
+
+#
+# Hash modes
+#
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
+CONFIG_CRYPTO_VMAC=m
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=m
+CONFIG_CRYPTO_GHASH=m
 CONFIG_CRYPTO_MD4=m
 CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_RMD128=m
+CONFIG_CRYPTO_RMD160=m
+CONFIG_CRYPTO_RMD256=m
+CONFIG_CRYPTO_RMD320=m
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_CRYPTD=m
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=m
-CONFIG_CRYPTO_SERPENT=m
+CONFIG_CRYPTO_WP512=m
+
+#
+# Ciphers
+#
 CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_ANUBIS=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_BLOWFISH=m
+CONFIG_CRYPTO_CAMELLIA=m
 CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_TEA=m
-CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_FCRYPT=m
 CONFIG_CRYPTO_KHAZAD=m
-CONFIG_CRYPTO_ANUBIS=m
+CONFIG_CRYPTO_SALSA20=m
+CONFIG_CRYPTO_SEED=m
+CONFIG_CRYPTO_SERPENT=m
+CONFIG_CRYPTO_TEA=m
+CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_TWOFISH_COMMON=m
+
+#
+# Compression
+#
 CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-CONFIG_CRYPTO_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
+CONFIG_CRYPTO_ZLIB=m
+CONFIG_CRYPTO_LZO=m
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=m
 CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_HIFN_795X=m
+# CONFIG_CRYPTO_DEV_HIFN_795X_RNG is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 CONFIG_CRC_CCITT=m
-# CONFIG_CRC16 is not set
-# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC16=y
+CONFIG_CRC_T10DIF=m
+CONFIG_CRC_ITU_T=m
 CONFIG_CRC32=y
-# CONFIG_CRC7 is not set
+CONFIG_CRC7=m
 CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=m
 CONFIG_ZLIB_DEFLATE=m
-CONFIG_PLIST=y
+CONFIG_LZO_COMPRESS=m
+CONFIG_LZO_DECOMPRESS=m
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index b71a0a4fb95f227c7e5fe78990cad427fa09b179..4caa0e0fee81ade48b0a9a9b798377b2de962c31 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc6
-# Mon Nov  9 23:42:42 2009
+# Linux kernel version: 2.6.33-rc2
+# Mon Jan  4 13:41:09 2010
 #
 CONFIG_MIPS=y
 
@@ -27,6 +27,7 @@ CONFIG_MACH_LOONGSON=y
 # CONFIG_PNX8550_STB810 is not set
 # CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
 # CONFIG_SGI_IP28 is not set
@@ -51,6 +52,9 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
 # CONFIG_LEMOTE_FULOONG2E is not set
 CONFIG_LEMOTE_MACH2F=y
 CONFIG_CS5536=y
+CONFIG_CS5536_MFGPT=y
+CONFIG_LOONGSON_SUSPEND=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
@@ -63,13 +67,8 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
-CONFIG_CEVT_R4K_LIB=y
-CONFIG_CEVT_R4K=y
-CONFIG_CSRC_R4K_LIB=y
-CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_EARLY_PRINTK=y
 CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_I8259=y
 # CONFIG_NO_IOPORT is not set
@@ -109,13 +108,15 @@ CONFIG_CPU_LOONGSON2F=y
 # CONFIG_CPU_SB1 is not set
 # CONFIG_CPU_CAVIUM_OCTEON is not set
 CONFIG_SYS_SUPPORTS_ZBOOT=y
-CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y
 CONFIG_CPU_LOONGSON2=y
 CONFIG_SYS_HAS_CPU_LOONGSON2F=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_CPUFREQ=y
+CONFIG_CPU_SUPPORTS_ADDRWINCFG=y
+CONFIG_CPU_SUPPORTS_UNCACHED_ACCELERATED=y
 
 #
 # Kernel type
@@ -137,7 +138,6 @@ CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_SYS_SUPPORTS_HIGHMEM=y
-CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
 # CONFIG_FLATMEM_MANUAL is not set
@@ -146,17 +146,11 @@ CONFIG_SPARSEMEM_MANUAL=y
 CONFIG_SPARSEMEM=y
 CONFIG_HAVE_MEMORY_PRESENT=y
 CONFIG_SPARSEMEM_STATIC=y
-
-#
-# Memory hotplug is currently incompatible with Software Suspend
-#
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_TICK_ONESHOT=y
@@ -175,7 +169,7 @@ CONFIG_HZ=250
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-# CONFIG_KEXEC is not set
+CONFIG_KEXEC=y
 # CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
@@ -194,9 +188,9 @@ CONFIG_LOCALVERSION=""
 CONFIG_HAVE_KERNEL_GZIP=y
 CONFIG_HAVE_KERNEL_BZIP2=y
 CONFIG_HAVE_KERNEL_LZMA=y
-# CONFIG_KERNEL_GZIP is not set
+CONFIG_KERNEL_GZIP=y
 # CONFIG_KERNEL_BZIP2 is not set
-CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZMA is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
@@ -211,6 +205,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=64
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -224,7 +219,11 @@ CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
 # CONFIG_NAMESPACES is not set
-# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
 CONFIG_ANON_INODES=y
@@ -256,14 +255,18 @@ CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
-# CONFIG_PROFILING is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=m
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_SYSCALL_WRAPPERS=y
 
 #
 # GCOV-based kernel profiling
 #
-# CONFIG_SLOW_WORK is not set
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_SLOW_WORK=y
+# CONFIG_SLOW_WORK_DEBUG is not set
 CONFIG_HAVE_GENERIC_DMA_COHERENT=y
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -283,14 +286,41 @@ CONFIG_BLOCK_COMPAT=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_DEADLINE=m
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 CONFIG_FREEZER=y
 
 #
@@ -314,7 +344,7 @@ CONFIG_MMU=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_HAVE_AOUT is not set
-# CONFIG_BINFMT_MISC is not set
+CONFIG_BINFMT_MISC=m
 CONFIG_MIPS32_COMPAT=y
 CONFIG_COMPAT=y
 CONFIG_SYSVIPC_COMPAT=y
@@ -335,9 +365,34 @@ CONFIG_SUSPEND_FREEZER=y
 CONFIG_HIBERNATION_NVS=y
 CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION="/dev/hda3"
-# CONFIG_PM_RUNTIME is not set
+CONFIG_PM_RUNTIME=y
+CONFIG_MIPS_EXTERNAL_TIMER=y
+CONFIG_MIPS_CPUFREQ=y
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_DEBUG=y
+CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_STAT_DETAILS=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
+
+#
+# CPUFreq processor drivers
+#
+CONFIG_LOONGSON2_CPUFREQ=m
 CONFIG_NET=y
-CONFIG_COMPAT_NETLINK_MESSAGES=y
 
 #
 # Networking options
@@ -346,11 +401,12 @@ CONFIG_PACKET=y
 CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
 CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
+CONFIG_XFRM_USER=m
 # CONFIG_XFRM_SUB_POLICY is not set
 # CONFIG_XFRM_MIGRATE is not set
 # CONFIG_XFRM_STATISTICS is not set
-# CONFIG_NET_KEY is not set
+CONFIG_NET_KEY=m
+# CONFIG_NET_KEY_MIGRATE is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
@@ -361,12 +417,13 @@ CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_MULTIPATH=y
 CONFIG_IP_ROUTE_VERBOSE=y
 # CONFIG_IP_PNP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
+CONFIG_NET_IPIP=m
+CONFIG_NET_IPGRE=m
+# CONFIG_NET_IPGRE_BROADCAST is not set
 CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
 CONFIG_IP_PIMSM_V2=y
-# CONFIG_ARPD is not set
+CONFIG_ARPD=y
 CONFIG_SYN_COOKIES=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -399,30 +456,34 @@ CONFIG_DEFAULT_BIC=y
 # CONFIG_DEFAULT_WESTWOOD is not set
 # CONFIG_DEFAULT_RENO is not set
 CONFIG_DEFAULT_TCP_CONG="bic"
-# CONFIG_TCP_MD5SIG is not set
+CONFIG_TCP_MD5SIG=y
 CONFIG_IPV6=m
 CONFIG_IPV6_PRIVACY=y
-# CONFIG_IPV6_ROUTER_PREF is not set
+CONFIG_IPV6_ROUTER_PREF=y
+# CONFIG_IPV6_ROUTE_INFO is not set
 # CONFIG_IPV6_OPTIMISTIC_DAD is not set
 # CONFIG_INET6_AH is not set
 # CONFIG_INET6_ESP is not set
 # CONFIG_INET6_IPCOMP is not set
 # CONFIG_IPV6_MIP6 is not set
 # CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
+CONFIG_INET6_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_TRANSPORT=m
 CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
-# CONFIG_IPV6_TUNNEL is not set
-# CONFIG_IPV6_MULTIPLE_TABLES is not set
+CONFIG_IPV6_TUNNEL=m
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
 # CONFIG_IPV6_MROUTE is not set
 CONFIG_NETWORK_SECMARK=y
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 CONFIG_NETFILTER_ADVANCED=y
+CONFIG_BRIDGE_NETFILTER=y
 
 #
 # Core Netfilter Configuration
@@ -446,17 +507,22 @@ CONFIG_NETFILTER_ADVANCED=y
 #
 # CONFIG_IP6_NF_QUEUE is not set
 # CONFIG_IP6_NF_IPTABLES is not set
+# CONFIG_BRIDGE_NF_EBTABLES is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
 # CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
+CONFIG_STP=m
+CONFIG_BRIDGE=m
 # CONFIG_NET_DSA is not set
-# CONFIG_VLAN_8021Q is not set
+CONFIG_VLAN_8021Q=m
+# CONFIG_VLAN_8021Q_GVRP is not set
 # CONFIG_DECNET is not set
+CONFIG_LLC=m
 # CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
+CONFIG_IPX=m
+# CONFIG_IPX_INTERN is not set
 # CONFIG_ATALK is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
@@ -518,26 +584,61 @@ CONFIG_NET_SCH_FIFO=y
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_DROP_MONITOR is not set
 # CONFIG_HAMRADIO is not set
 # CONFIG_CAN is not set
 # CONFIG_IRDA is not set
-# CONFIG_BT 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_HCIBTUSB=m
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+CONFIG_BT_HCIBFUSB=m
+CONFIG_BT_HCIVHCI=m
+# CONFIG_BT_MRVL is not set
 # CONFIG_AF_RXRPC is not set
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
-# CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_CFG80211=m
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
 # CONFIG_WIRELESS_OLD_REGULATORY is not set
-CONFIG_WIRELESS_EXT=y
+CONFIG_CFG80211_WEXT=y
 CONFIG_WIRELESS_EXT_SYSFS=y
-# CONFIG_LIB80211 is not set
-
-#
-# CFG80211 needs to be enabled for MAC80211
-#
+CONFIG_LIB80211=m
+CONFIG_LIB80211_DEBUG=y
+CONFIG_MAC80211=m
+# CONFIG_MAC80211_RC_PID is not set
+CONFIG_MAC80211_RC_MINSTREL=y
+# CONFIG_MAC80211_RC_DEFAULT_PID is not set
+CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
+CONFIG_MAC80211_RC_DEFAULT="minstrel"
+# CONFIG_MAC80211_MESH is not set
+CONFIG_MAC80211_LEDS=y
+# CONFIG_MAC80211_DEBUGFS is not set
+# CONFIG_MAC80211_DEBUG_MENU is not set
 # CONFIG_WIMAX is not set
 CONFIG_RFKILL=m
-# CONFIG_RFKILL_INPUT is not set
+CONFIG_RFKILL_LEDS=y
+CONFIG_RFKILL_INPUT=y
 # CONFIG_NET_9P is not set
 
 #
@@ -555,7 +656,7 @@ CONFIG_FW_LOADER=y
 CONFIG_FIRMWARE_IN_KERNEL=y
 CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
-# CONFIG_CONNECTOR is not set
+CONFIG_CONNECTOR=m
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
 # CONFIG_PNP is not set
@@ -566,7 +667,12 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_CRYPTOLOOP=y
+CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -577,19 +683,7 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
-CONFIG_MISC_DEVICES=y
-# CONFIG_PHANTOM is not set
-# CONFIG_SGI_IOC4 is not set
-# CONFIG_TIFM_CORE is not set
-# CONFIG_ENCLOSURE_SERVICES is not set
-# CONFIG_HP_ILO is not set
-# CONFIG_C2PORT is not set
-
-#
-# EEPROM support
-#
-# CONFIG_EEPROM_93CX6 is not set
-# CONFIG_CB710_CORE is not set
+# CONFIG_MISC_DEVICES is not set
 CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
 
@@ -619,8 +713,7 @@ CONFIG_BLK_DEV_IDEDMA_SFF=y
 #
 CONFIG_BLK_DEV_IDEPCI=y
 # CONFIG_IDEPCI_PCIBUS_ORDER is not set
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_GENERIC is not set
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
 # CONFIG_BLK_DEV_AEC62XX is not set
@@ -700,7 +793,29 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_DH is not set
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
-# CONFIG_MD is not set
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=m
+CONFIG_MD_LINEAR=m
+CONFIG_MD_RAID0=m
+CONFIG_MD_RAID1=m
+CONFIG_MD_RAID10=m
+CONFIG_MD_RAID456=m
+CONFIG_MD_RAID6_PQ=m
+# CONFIG_ASYNC_RAID6_TEST is not set
+CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
+CONFIG_BLK_DEV_DM=m
+CONFIG_DM_DEBUG=y
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_LOG_USERSPACE=m
+CONFIG_DM_ZERO=m
+CONFIG_DM_MULTIPATH=m
+CONFIG_DM_MULTIPATH_QL=m
+CONFIG_DM_MULTIPATH_ST=m
+CONFIG_DM_DELAY=m
+CONFIG_DM_UEVENT=y
 # CONFIG_FUSION is not set
 
 #
@@ -712,19 +827,19 @@ CONFIG_SCSI_WAIT_SCAN=m
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
 # CONFIG_IFB is not set
-# CONFIG_DUMMY is not set
+CONFIG_DUMMY=m
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-# CONFIG_VETH is not set
+CONFIG_TUN=m
+CONFIG_VETH=m
 # CONFIG_ARCNET is not set
 # CONFIG_PHYLIB is not set
 CONFIG_NET_ETHERNET=y
@@ -738,6 +853,7 @@ CONFIG_MII=y
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
 # CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
 # CONFIG_NET_VENDOR_RACAL is not set
 # CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
@@ -769,7 +885,7 @@ CONFIG_NET_PCI=y
 # CONFIG_8139CP is not set
 CONFIG_8139TOO=y
 # CONFIG_8139TOO_PIO is not set
-CONFIG_8139TOO_TUNE_TWISTER=y
+# CONFIG_8139TOO_TUNE_TWISTER is not set
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
 # CONFIG_R6040 is not set
@@ -795,6 +911,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 CONFIG_R8169=y
+CONFIG_R8169_VLAN=y
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
@@ -810,15 +927,31 @@ CONFIG_R8169=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-CONFIG_WLAN_PRE80211=y
-# CONFIG_STRIP is not set
-# CONFIG_WAVELAN is not set
-CONFIG_WLAN_80211=y
-# CONFIG_LIBERTAS is not set
+# CONFIG_LIBERTAS_THINFIRM is not set
 # CONFIG_ATMEL is not set
+# CONFIG_AT76C50X_USB is not set
 # CONFIG_PRISM54 is not set
 # CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_RTL8180 is not set
+# CONFIG_RTL8187 is not set
+# CONFIG_ADM8211 is not set
+# CONFIG_MAC80211_HWSIM is not set
+# CONFIG_MWL8K is not set
+# CONFIG_ATH_COMMON is not set
+# CONFIG_B43 is not set
+# CONFIG_B43LEGACY is not set
 # CONFIG_HOSTAP is not set
+# CONFIG_IPW2100 is not set
+# CONFIG_IPW2200 is not set
+# CONFIG_IWLWIFI is not set
+# CONFIG_IWM is not set
+# CONFIG_LIBERTAS is not set
+# CONFIG_HERMES is not set
+# CONFIG_P54_COMMON is not set
+# CONFIG_RT2X00 is not set
+# CONFIG_WL12XX is not set
+# CONFIG_ZD1211RW is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -831,17 +964,39 @@ CONFIG_WLAN_80211=y
 # CONFIG_USB_KAWETH is not set
 # CONFIG_USB_PEGASUS is not set
 # CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_USBNET is not set
+CONFIG_USB_USBNET=m
+CONFIG_USB_NET_AX8817X=m
+CONFIG_USB_NET_CDCETHER=m
+CONFIG_USB_NET_CDC_EEM=m
+# CONFIG_USB_NET_DM9601 is not set
+# CONFIG_USB_NET_SMSC95XX is not set
+# CONFIG_USB_NET_GL620A is not set
+CONFIG_USB_NET_NET1080=m
+# CONFIG_USB_NET_PLUSB is not set
+# CONFIG_USB_NET_MCS7830 is not set
+# CONFIG_USB_NET_RNDIS_HOST is not set
+CONFIG_USB_NET_CDC_SUBSET=m
+# CONFIG_USB_ALI_M5632 is not set
+# CONFIG_USB_AN2720 is not set
+CONFIG_USB_BELKIN=y
+CONFIG_USB_ARMLINUX=y
+# CONFIG_USB_EPSON2888 is not set
+# CONFIG_USB_KC2190 is not set
+CONFIG_USB_NET_ZAURUS=m
 # CONFIG_USB_HSO is not set
+# CONFIG_USB_NET_INT51X1 is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 # CONFIG_NET_FC is not set
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_NETCONSOLE=m
+CONFIG_NETCONSOLE_DYNAMIC=y
+CONFIG_NETPOLL=y
+# CONFIG_NETPOLL_TRAP is not set
+CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -849,8 +1004,9 @@ CONFIG_WLAN_80211=y
 # Input device support
 #
 CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS is not set
-# CONFIG_INPUT_POLLDEV is not set
+CONFIG_INPUT_FF_MEMLESS=m
+CONFIG_INPUT_POLLDEV=m
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -884,7 +1040,7 @@ CONFIG_MOUSE_PS2_SYNAPTICS=y
 # CONFIG_MOUSE_PS2_SENTELIC is not set
 # CONFIG_MOUSE_PS2_TOUCHKIT is not set
 # CONFIG_MOUSE_SERIAL is not set
-# CONFIG_MOUSE_APPLETOUCH is not set
+CONFIG_MOUSE_APPLETOUCH=m
 # CONFIG_MOUSE_BCM5974 is not set
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
@@ -904,6 +1060,7 @@ CONFIG_SERIO_I8042=y
 # CONFIG_SERIO_PCIPS2 is not set
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -934,8 +1091,7 @@ CONFIG_SERIAL_NONSTANDARD=y
 #
 # Serial drivers
 #
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250=m
 # CONFIG_SERIAL_8250_PCI is not set
 CONFIG_SERIAL_8250_NR_UARTS=16
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
@@ -953,8 +1109,7 @@ CONFIG_SERIAL_8250_FOURPORT=y
 #
 # Non-8250 serial port support
 #
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_CORE=m
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
@@ -1033,14 +1188,18 @@ CONFIG_VIDEO_MEDIA=m
 #
 # Multimedia drivers
 #
+CONFIG_IR_CORE=m
+CONFIG_VIDEO_IR=m
 # CONFIG_MEDIA_ATTACH is not set
 CONFIG_VIDEO_V4L2=m
 CONFIG_VIDEO_V4L1=m
+CONFIG_VIDEOBUF_GEN=m
+CONFIG_VIDEOBUF_VMALLOC=m
 CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_ADV_DEBUG is not set
 # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
 CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
-# CONFIG_VIDEO_VIVI is not set
+CONFIG_VIDEO_VIVI=m
 # CONFIG_VIDEO_PMS is not set
 # CONFIG_VIDEO_CPIA is not set
 # CONFIG_VIDEO_CPIA2 is not set
@@ -1049,52 +1208,55 @@ CONFIG_V4L_USB_DRIVERS=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
 CONFIG_USB_GSPCA=m
-# CONFIG_USB_M5602 is not set
-# CONFIG_USB_STV06XX is not set
+CONFIG_USB_M5602=m
+CONFIG_USB_STV06XX=m
 # CONFIG_USB_GL860 is not set
-# CONFIG_USB_GSPCA_CONEX is not set
-# CONFIG_USB_GSPCA_ETOMS is not set
-# CONFIG_USB_GSPCA_FINEPIX is not set
+CONFIG_USB_GSPCA_CONEX=m
+CONFIG_USB_GSPCA_ETOMS=m
+CONFIG_USB_GSPCA_FINEPIX=m
 # CONFIG_USB_GSPCA_JEILINJ is not set
-# CONFIG_USB_GSPCA_MARS is not set
-# CONFIG_USB_GSPCA_MR97310A is not set
-# CONFIG_USB_GSPCA_OV519 is not set
-# CONFIG_USB_GSPCA_OV534 is not set
-# CONFIG_USB_GSPCA_PAC207 is not set
-# CONFIG_USB_GSPCA_PAC7311 is not set
-# CONFIG_USB_GSPCA_SN9C20X is not set
-# CONFIG_USB_GSPCA_SONIXB is not set
-# CONFIG_USB_GSPCA_SONIXJ is not set
-# CONFIG_USB_GSPCA_SPCA500 is not set
-# CONFIG_USB_GSPCA_SPCA501 is not set
-# CONFIG_USB_GSPCA_SPCA505 is not set
-# CONFIG_USB_GSPCA_SPCA506 is not set
-# CONFIG_USB_GSPCA_SPCA508 is not set
-# CONFIG_USB_GSPCA_SPCA561 is not set
-# CONFIG_USB_GSPCA_SQ905 is not set
-# CONFIG_USB_GSPCA_SQ905C is not set
-# CONFIG_USB_GSPCA_STK014 is not set
-# CONFIG_USB_GSPCA_SUNPLUS is not set
-# CONFIG_USB_GSPCA_T613 is not set
-# CONFIG_USB_GSPCA_TV8532 is not set
-# CONFIG_USB_GSPCA_VC032X is not set
-# CONFIG_USB_GSPCA_ZC3XX is not set
+CONFIG_USB_GSPCA_MARS=m
+CONFIG_USB_GSPCA_MR97310A=m
+CONFIG_USB_GSPCA_OV519=m
+CONFIG_USB_GSPCA_OV534=m
+CONFIG_USB_GSPCA_PAC207=m
+# CONFIG_USB_GSPCA_PAC7302 is not set
+CONFIG_USB_GSPCA_PAC7311=m
+CONFIG_USB_GSPCA_SN9C20X=m
+CONFIG_USB_GSPCA_SN9C20X_EVDEV=y
+CONFIG_USB_GSPCA_SONIXB=m
+CONFIG_USB_GSPCA_SONIXJ=m
+CONFIG_USB_GSPCA_SPCA500=m
+CONFIG_USB_GSPCA_SPCA501=m
+CONFIG_USB_GSPCA_SPCA505=m
+CONFIG_USB_GSPCA_SPCA506=m
+CONFIG_USB_GSPCA_SPCA508=m
+CONFIG_USB_GSPCA_SPCA561=m
+CONFIG_USB_GSPCA_SQ905=m
+CONFIG_USB_GSPCA_SQ905C=m
+CONFIG_USB_GSPCA_STK014=m
+# CONFIG_USB_GSPCA_STV0680 is not set
+CONFIG_USB_GSPCA_SUNPLUS=m
+CONFIG_USB_GSPCA_T613=m
+CONFIG_USB_GSPCA_TV8532=m
+CONFIG_USB_GSPCA_VC032X=m
+CONFIG_USB_GSPCA_ZC3XX=m
 # CONFIG_VIDEO_HDPVR is not set
 # CONFIG_USB_VICAM is not set
 # CONFIG_USB_IBMCAM is not set
 # CONFIG_USB_KONICAWC is not set
 # CONFIG_USB_QUICKCAM_MESSENGER is not set
-# CONFIG_USB_ET61X251 is not set
+CONFIG_USB_ET61X251=m
 # CONFIG_USB_OV511 is not set
 # CONFIG_USB_SE401 is not set
-# CONFIG_USB_SN9C102 is not set
+CONFIG_USB_SN9C102=m
 # CONFIG_USB_STV680 is not set
-# CONFIG_USB_ZC0301 is not set
+CONFIG_USB_ZC0301=m
 # CONFIG_USB_PWC is not set
 CONFIG_USB_PWC_INPUT_EVDEV=y
-# CONFIG_USB_ZR364XX is not set
-# CONFIG_USB_STKWEBCAM is not set
-# CONFIG_USB_S2255 is not set
+CONFIG_USB_ZR364XX=m
+CONFIG_USB_STKWEBCAM=m
+CONFIG_USB_S2255=m
 # CONFIG_RADIO_ADAPTERS is not set
 # CONFIG_DAB is not set
 
@@ -1132,6 +1294,7 @@ CONFIG_FB_TILEBLITTING=y
 # CONFIG_FB_CYBER2000 is not set
 # CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
+# CONFIG_FB_UVESA is not set
 # CONFIG_FB_S1D13XXX is not set
 # CONFIG_FB_NVIDIA is not set
 # CONFIG_FB_RIVA is not set
@@ -1161,7 +1324,7 @@ CONFIG_FB_SIS_315=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 # CONFIG_LCD_CLASS_DEVICE is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
-CONFIG_BACKLIGHT_GENERIC=y
+CONFIG_BACKLIGHT_GENERIC=m
 
 #
 # Display device support
@@ -1193,28 +1356,44 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_LOGO_LINUX_CLUT224=y
 CONFIG_SOUND=m
-# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
 CONFIG_SND=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
-# CONFIG_SND_SEQUENCER is not set
-# CONFIG_SND_MIXER_OSS is not set
-# CONFIG_SND_PCM_OSS is not set
-# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_HWDEP=m
+CONFIG_SND_RAWMIDI=m
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_HRTIMER=m
+CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
 # CONFIG_SND_RTCTIMER is not set
 # CONFIG_SND_DYNAMIC_MINORS is not set
-# CONFIG_SND_SUPPORT_OLD_API is not set
-# CONFIG_SND_VERBOSE_PROCFS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
 # CONFIG_SND_VERBOSE_PRINTK is not set
 # CONFIG_SND_DEBUG is not set
 CONFIG_SND_VMASTER=y
-# CONFIG_SND_RAWMIDI_SEQ is not set
+CONFIG_SND_RAWMIDI_SEQ=m
 # CONFIG_SND_OPL3_LIB_SEQ is not set
 # CONFIG_SND_OPL4_LIB_SEQ is not set
 # CONFIG_SND_SBAWE_SEQ is not set
 # CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_MPU401_UART=m
 CONFIG_SND_AC97_CODEC=m
-# CONFIG_SND_DRIVERS is not set
+CONFIG_SND_DRIVERS=y
+CONFIG_SND_DUMMY=m
+CONFIG_SND_VIRMIDI=m
+# CONFIG_SND_MTPAV is not set
+CONFIG_SND_SERIAL_U16550=m
+CONFIG_SND_MPU401=m
+CONFIG_SND_AC97_POWER_SAVE=y
+CONFIG_SND_AC97_POWER_SAVE_DEFAULT=10
 CONFIG_SND_PCI=y
 # CONFIG_SND_AD1889 is not set
 # CONFIG_SND_ALS300 is not set
@@ -1281,7 +1460,10 @@ CONFIG_SND_CS5535AUDIO=m
 # CONFIG_SND_VX222 is not set
 # CONFIG_SND_YMFPCI is not set
 # CONFIG_SND_MIPS is not set
-# CONFIG_SND_USB is not set
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=m
+CONFIG_SND_USB_CAIAQ=m
+CONFIG_SND_USB_CAIAQ_INPUT=y
 # CONFIG_SND_SOC is not set
 # CONFIG_SOUND_PRIME is not set
 CONFIG_AC97_BUS=m
@@ -1299,32 +1481,41 @@ CONFIG_USB_HIDDEV=y
 #
 # Special HID drivers
 #
-# CONFIG_HID_A4TECH is not set
-# CONFIG_HID_APPLE is not set
-# CONFIG_HID_BELKIN is not set
-# CONFIG_HID_CHERRY is not set
-# CONFIG_HID_CHICONY is not set
-# CONFIG_HID_CYPRESS is not set
-# CONFIG_HID_DRAGONRISE is not set
-# CONFIG_HID_EZKEY is not set
-# CONFIG_HID_KYE is not set
-# CONFIG_HID_GYRATION is not set
-# CONFIG_HID_TWINHAN is not set
-# CONFIG_HID_KENSINGTON is not set
-# CONFIG_HID_LOGITECH is not set
-# CONFIG_HID_MICROSOFT is not set
-# CONFIG_HID_MONTEREY is not set
-# CONFIG_HID_NTRIG is not set
-# CONFIG_HID_PANTHERLORD is not set
-# CONFIG_HID_PETALYNX is not set
-# CONFIG_HID_SAMSUNG is not set
-# CONFIG_HID_SONY is not set
-# CONFIG_HID_SUNPLUS is not set
-# CONFIG_HID_GREENASIA is not set
-# CONFIG_HID_SMARTJOYPLUS is not set
-# CONFIG_HID_TOPSEED is not set
-# CONFIG_HID_THRUSTMASTER is not set
-# CONFIG_HID_ZEROPLUS is not set
+CONFIG_HID_A4TECH=m
+CONFIG_HID_APPLE=m
+CONFIG_HID_BELKIN=m
+CONFIG_HID_CHERRY=m
+CONFIG_HID_CHICONY=m
+CONFIG_HID_CYPRESS=m
+CONFIG_HID_DRAGONRISE=m
+CONFIG_DRAGONRISE_FF=y
+CONFIG_HID_EZKEY=m
+CONFIG_HID_KYE=m
+CONFIG_HID_GYRATION=m
+CONFIG_HID_TWINHAN=m
+CONFIG_HID_KENSINGTON=m
+CONFIG_HID_LOGITECH=m
+CONFIG_LOGITECH_FF=y
+CONFIG_LOGIRUMBLEPAD2_FF=y
+CONFIG_HID_MICROSOFT=m
+CONFIG_HID_MONTEREY=m
+CONFIG_HID_NTRIG=m
+CONFIG_HID_PANTHERLORD=m
+CONFIG_PANTHERLORD_FF=y
+CONFIG_HID_PETALYNX=m
+CONFIG_HID_SAMSUNG=m
+CONFIG_HID_SONY=m
+CONFIG_HID_SUNPLUS=m
+CONFIG_HID_GREENASIA=m
+CONFIG_GREENASIA_FF=y
+CONFIG_HID_SMARTJOYPLUS=m
+CONFIG_SMARTJOYPLUS_FF=y
+CONFIG_HID_TOPSEED=m
+CONFIG_HID_THRUSTMASTER=m
+CONFIG_THRUSTMASTER_FF=y
+CONFIG_HID_WACOM=m
+CONFIG_HID_ZEROPLUS=m
+CONFIG_ZEROPLUS_FF=y
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1344,7 +1535,7 @@ CONFIG_USB_SUSPEND=y
 CONFIG_USB_OTG_WHITELIST=y
 # CONFIG_USB_OTG_BLACKLIST_HUB is not set
 CONFIG_USB_MON=y
-# CONFIG_USB_WUSB is not set
+CONFIG_USB_WUSB=m
 # CONFIG_USB_WUSB_CBAF is not set
 
 #
@@ -1366,14 +1557,15 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 CONFIG_USB_UHCI_HCD=m
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
-# CONFIG_USB_WHCI_HCD is not set
-# CONFIG_USB_HWA_HCD is not set
+CONFIG_USB_WHCI_HCD=m
+CONFIG_USB_HWA_HCD=m
+# CONFIG_USB_GADGET_MUSB_HDRC is not set
 
 #
 # USB Device Class drivers
 #
 CONFIG_USB_ACM=m
-# CONFIG_USB_PRINTER is not set
+CONFIG_USB_PRINTER=m
 CONFIG_USB_WDM=m
 # CONFIG_USB_TMC is not set
 
@@ -1397,7 +1589,7 @@ CONFIG_USB_STORAGE_ALAUDA=m
 # CONFIG_USB_STORAGE_ONETOUCH is not set
 # CONFIG_USB_STORAGE_KARMA is not set
 # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
-# CONFIG_USB_LIBUSUAL is not set
+CONFIG_USB_LIBUSUAL=y
 
 #
 # USB Imaging devices
@@ -1467,7 +1659,7 @@ CONFIG_USB_SERIAL_GENERIC=y
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_BERRY_CHARGE is not set
-# CONFIG_USB_LED is not set
+CONFIG_USB_LED=m
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
 # CONFIG_USB_IDMOUSE is not set
@@ -1480,16 +1672,95 @@ CONFIG_USB_SERIAL_GENERIC=y
 # CONFIG_USB_TEST is not set
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
-# CONFIG_USB_GADGET is not set
+CONFIG_USB_GADGET=m
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=2
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_ATMEL_USBA is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_PXA25X is not set
+# CONFIG_USB_GADGET_R8A66597 is not set
+# CONFIG_USB_GADGET_PXA27X is not set
+# CONFIG_USB_GADGET_S3C_HSOTG is not set
+# CONFIG_USB_GADGET_IMX is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+CONFIG_USB_GADGET_M66592=y
+CONFIG_USB_M66592=m
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_QE is not set
+# CONFIG_USB_GADGET_CI13XXX is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LANGWELL is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_MULTI is not set
 
 #
 # OTG and related infrastructure
 #
 # CONFIG_NOP_USB_XCEIV is not set
-# CONFIG_UWB is not set
-# CONFIG_MMC is not set
+CONFIG_UWB=m
+CONFIG_UWB_HWA=m
+CONFIG_UWB_WHCI=m
+# CONFIG_UWB_WLP is not set
+# CONFIG_UWB_I1480U is not set
+CONFIG_MMC=m
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=m
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
+# CONFIG_MMC_TIFM_SD is not set
+# CONFIG_MMC_CB710 is not set
+# CONFIG_MMC_VIA_SDMMC is not set
 # CONFIG_MEMSTICK is not set
-# CONFIG_NEW_LEDS is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=m
+
+#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+# CONFIG_LEDS_TRIGGER_TIMER is not set
+# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
+# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
+
+#
+# iptables trigger is under Netfilter config (LED target)
+#
 # CONFIG_ACCESSIBILITY is not set
 # CONFIG_INFINIBAND is not set
 # CONFIG_RTC_CLASS is not set
@@ -1504,21 +1775,17 @@ CONFIG_STAGING=y
 # CONFIG_STAGING_EXCLUDE_BUILD is not set
 # CONFIG_ET131X is not set
 # CONFIG_USB_IP_COMMON is not set
-# CONFIG_PRISM2_USB is not set
+# CONFIG_W35UND is not set
 # CONFIG_ECHO is not set
+# CONFIG_OTUS is not set
 # CONFIG_COMEDI is not set
 # CONFIG_ASUS_OLED is not set
 # CONFIG_ALTERA_PCIE_CHDMA is not set
-# CONFIG_RTL8187SE is not set
-# CONFIG_RTL8192SU is not set
+# CONFIG_R8187SE is not set
 # CONFIG_RTL8192E is not set
 # CONFIG_INPUT_MIMIO is not set
 # CONFIG_TRANZPORT is not set
 
-#
-# Android
-#
-
 #
 # Qualcomm MSM Camera And Video
 #
@@ -1527,7 +1794,6 @@ CONFIG_STAGING=y
 # Camera Sensor Selection
 #
 # CONFIG_INPUT_GPIO is not set
-# CONFIG_DST is not set
 # CONFIG_POHMELFS is not set
 # CONFIG_B3DFG is not set
 # CONFIG_PLAN9AUTH is not set
@@ -1544,28 +1810,55 @@ CONFIG_STAGING=y
 #
 # CONFIG_RAR_REGISTER is not set
 # CONFIG_IIO is not set
+# CONFIG_RAMZSWAP is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_STRIP is not set
+# CONFIG_WAVELAN is not set
 CONFIG_FB_SM7XX=y
-CONFIG_FB_SM7XX_ACCEL=y
+# CONFIG_FB_SM7XX_ACCEL is not set
 
 #
 # File systems
 #
-# CONFIG_EXT2_FS is not set
+CONFIG_EXT2_FS=m
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=y
 # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
 CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
 CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
 CONFIG_FS_MBCACHE=y
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+CONFIG_REISERFS_PROC_INFO=y
+CONFIG_REISERFS_FS_XATTR=y
+# CONFIG_REISERFS_FS_POSIX_ACL is not set
+# CONFIG_REISERFS_FS_SECURITY is not set
+CONFIG_JFS_FS=m
+CONFIG_JFS_POSIX_ACL=y
+# CONFIG_JFS_SECURITY is not set
+# CONFIG_JFS_DEBUG is not set
+# CONFIG_JFS_STATISTICS is not set
 CONFIG_FS_POSIX_ACL=y
-# CONFIG_XFS_FS is not set
+CONFIG_XFS_FS=m
+CONFIG_XFS_QUOTA=y
+CONFIG_XFS_POSIX_ACL=y
+# CONFIG_XFS_RT is not set
+# CONFIG_XFS_DEBUG is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_BTRFS_FS is not set
+CONFIG_BTRFS_FS=m
+# CONFIG_BTRFS_FS_POSIX_ACL is not set
 # CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
 CONFIG_FSNOTIFY=y
@@ -1575,17 +1868,25 @@ CONFIG_INOTIFY_USER=y
 CONFIG_QUOTA=y
 # CONFIG_QUOTA_NETLINK_INTERFACE is not set
 CONFIG_PRINT_QUOTA_WARNING=y
+CONFIG_QUOTA_TREE=m
 # CONFIG_QFMT_V1 is not set
-# CONFIG_QFMT_V2 is not set
+CONFIG_QFMT_V2=m
 CONFIG_QUOTACTL=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
+CONFIG_AUTOFS_FS=m
+CONFIG_AUTOFS4_FS=m
 # CONFIG_FUSE_FS is not set
 
 #
 # Caches
 #
-# CONFIG_FSCACHE is not set
+CONFIG_FSCACHE=m
+# CONFIG_FSCACHE_STATS is not set
+# CONFIG_FSCACHE_HISTOGRAM is not set
+# CONFIG_FSCACHE_DEBUG is not set
+# CONFIG_FSCACHE_OBJECT_LIST is not set
+CONFIG_CACHEFILES=m
+# CONFIG_CACHEFILES_DEBUG is not set
+# CONFIG_CACHEFILES_HISTOGRAM is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -1599,11 +1900,13 @@ CONFIG_ZISOFS=y
 # DOS/FAT/NT Filesystems
 #
 CONFIG_FAT_FS=m
-# CONFIG_MSDOS_FS is not set
+CONFIG_MSDOS_FS=m
 CONFIG_VFAT_FS=m
 CONFIG_FAT_DEFAULT_CODEPAGE=437
 CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
-# CONFIG_NTFS_FS is not set
+CONFIG_NTFS_FS=m
+# CONFIG_NTFS_DEBUG is not set
+CONFIG_NTFS_RW=y
 
 #
 # Pseudo filesystems
@@ -1616,23 +1919,60 @@ CONFIG_SYSFS=y
 CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-# CONFIG_CONFIGFS_FS is not set
-# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_CONFIGFS_FS=m
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_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_CRAMFS=m
+CONFIG_SQUASHFS=m
+CONFIG_SQUASHFS_EMBEDDED=y
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+CONFIG_ROMFS_FS=m
+CONFIG_ROMFS_BACKED_BY_BLOCK=y
+# CONFIG_ROMFS_BACKED_BY_MTD is not set
+# CONFIG_ROMFS_BACKED_BY_BOTH is not set
+CONFIG_ROMFS_ON_BLOCK=y
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=m
 CONFIG_NFS_V3=y
 CONFIG_NFS_V3_ACL=y
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFSD is not set
+# CONFIG_NFS_FSCACHE is not set
+CONFIG_NFSD=m
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V3_ACL is not set
+CONFIG_NFSD_V4=y
 CONFIG_LOCKD=m
 CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
 CONFIG_NFS_ACL_SUPPORT=m
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=m
-# CONFIG_RPCSEC_GSS_KRB5 is not set
+CONFIG_SUNRPC_GSS=m
+CONFIG_RPCSEC_GSS_KRB5=m
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
+CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -1643,45 +1983,45 @@ CONFIG_SUNRPC=m
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
 CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="utf-8"
-# CONFIG_NLS_CODEPAGE_437 is not set
-# 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 is not set
-# 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 is not set
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=y
 # CONFIG_DLM is not set
 
 #
@@ -1695,125 +2035,155 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
 CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
+CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+CONFIG_STACKTRACE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
 CONFIG_TRACING_SUPPORT=y
 # CONFIG_FTRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
 
 #
 # Security options
 #
-# CONFIG_KEYS is not set
+CONFIG_KEYS=y
+CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_XOR_BLOCKS=m
+CONFIG_ASYNC_CORE=m
+CONFIG_ASYNC_MEMCPY=m
+CONFIG_ASYNC_XOR=m
+CONFIG_ASYNC_PQ=m
+CONFIG_ASYNC_RAID6_RECOV=m
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
+CONFIG_CRYPTO_FIPS=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=m
 CONFIG_CRYPTO_AEAD2=y
-CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER=m
 CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=m
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_PCOMP=y
-CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER=m
 CONFIG_CRYPTO_MANAGER2=y
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_GF128MUL=m
+CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_WORKQUEUE=y
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_AUTHENC is not set
-# CONFIG_CRYPTO_TEST is not set
+CONFIG_CRYPTO_CRYPTD=m
+CONFIG_CRYPTO_AUTHENC=m
+CONFIG_CRYPTO_TEST=m
 
 #
 # Authenticated Encryption with Associated Data
 #
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_SEQIV is not set
+CONFIG_CRYPTO_CCM=m
+CONFIG_CRYPTO_GCM=m
+CONFIG_CRYPTO_SEQIV=m
 
 #
 # Block modes
 #
-CONFIG_CRYPTO_CBC=y
-# CONFIG_CRYPTO_CTR is not set
+CONFIG_CRYPTO_CBC=m
+CONFIG_CRYPTO_CTR=m
 # CONFIG_CRYPTO_CTS is not set
-# CONFIG_CRYPTO_ECB is not set
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_PCBC is not set
-# CONFIG_CRYPTO_XTS is not set
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_LRW=m
+CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_XTS=m
 
 #
 # Hash modes
 #
-# CONFIG_CRYPTO_HMAC is not set
-# CONFIG_CRYPTO_XCBC is not set
+CONFIG_CRYPTO_HMAC=m
+CONFIG_CRYPTO_XCBC=m
 # CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_GHASH is not set
-# CONFIG_CRYPTO_MD4 is not set
-# CONFIG_CRYPTO_MD5 is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_RMD128 is not set
-# CONFIG_CRYPTO_RMD160 is not set
-# CONFIG_CRYPTO_RMD256 is not set
-# CONFIG_CRYPTO_RMD320 is not set
-# CONFIG_CRYPTO_SHA1 is not set
-# CONFIG_CRYPTO_SHA256 is not set
-# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_WP512 is not set
+CONFIG_CRYPTO_CRC32C=m
+CONFIG_CRYPTO_GHASH=m
+CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_RMD128=m
+CONFIG_CRYPTO_RMD160=m
+CONFIG_CRYPTO_RMD256=m
+CONFIG_CRYPTO_RMD320=m
+CONFIG_CRYPTO_SHA1=m
+CONFIG_CRYPTO_SHA256=m
+CONFIG_CRYPTO_SHA512=m
+CONFIG_CRYPTO_TGR192=m
+CONFIG_CRYPTO_WP512=m
 
 #
 # Ciphers
 #
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_CAST5 is not set
-# CONFIG_CRYPTO_CAST6 is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_SALSA20 is not set
-# CONFIG_CRYPTO_SEED is not set
-# CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_TWOFISH is not set
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_ANUBIS=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_BLOWFISH=m
+CONFIG_CRYPTO_CAMELLIA=m
+CONFIG_CRYPTO_CAST5=m
+CONFIG_CRYPTO_CAST6=m
+CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_FCRYPT=m
+CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_SALSA20=m
+CONFIG_CRYPTO_SEED=m
+CONFIG_CRYPTO_SERPENT=m
+CONFIG_CRYPTO_TEA=m
+CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_TWOFISH_COMMON=m
 
 #
 # Compression
 #
-# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_ZLIB is not set
-# CONFIG_CRYPTO_LZO is not set
+CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRYPTO_ZLIB=m
+CONFIG_CRYPTO_LZO=m
 
 #
 # Random Number Generation
 #
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_ANSI_CPRNG=m
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
-# CONFIG_BINARY_PRINTF is not set
+CONFIG_BINARY_PRINTF=y
 
 #
 # Library routines
@@ -1821,14 +2191,20 @@ CONFIG_CRYPTO_HW=y
 CONFIG_BITREVERSE=y
 CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
-# CONFIG_CRC16 is not set
+CONFIG_CRC16=y
 CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
-# CONFIG_LIBCRC32C is not set
+CONFIG_LIBCRC32C=m
 CONFIG_AUDIT_GENERIC=y
-CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_LZO_COMPRESS=m
+CONFIG_LZO_DECOMPRESS=m
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
index ddf67f63919495bd1639a6b732fe37ec1744ba3b..97382b698b9be94c1c68961f912eea7341db9b77 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:37 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 09:53:29 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-CONFIG_MIPS_PB1100=y
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+CONFIG_MIPS_PB1100=y
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1100=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1100=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_SWAP_IO_SPACE=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -86,6 +110,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -93,11 +118,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -107,184 +135,244 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-pb1100"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 # CONFIG_PCI is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
+# CONFIG_PCMCIA_IOCTL is not set
 
 #
 # PC-card bridges
 #
 # CONFIG_PCMCIA_AU1X00 is not set
-
-#
-# PCI Hotplug Support
-#
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -295,110 +383,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -408,27 +411,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -437,25 +437,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -468,6 +468,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -493,14 +494,13 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -517,166 +517,136 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_UB=y
 # CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
+CONFIG_IDE=y
 
 #
-# Misc devices
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+# CONFIG_BLK_DEV_IDECD is not set
+# CONFIG_BLK_DEV_IDETAPE is not set
+CONFIG_IDE_TASK_IOCTL=y
+# CONFIG_IDE_PROC_FS is not set
 
 #
-# ATA/ATAPI/MFM/RLL support
+# IDE chipset support/bugfixes
 #
-# CONFIG_IDE is not set
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# PHY device support
-#
-CONFIG_PHYLIB=m
+# CONFIG_VETH is not set
+CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
-# CONFIG_MIPS_AU1X00_ENET is not set
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
+CONFIG_MIPS_AU1X00_ENET=y
 # 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 is not set
-
-#
-# PCMCIA network device support
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
 # CONFIG_NET_PCMCIA is not set
-
-#
-# Wan interfaces
-#
 # CONFIG_WAN is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -684,16 +654,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -703,28 +671,26 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
 
 #
 # Serial drivers
@@ -743,198 +709,288 @@ CONFIG_SERIAL_8250_AU1X00=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 
 #
-# Dallas's 1-wire bus
+# PPS support
 #
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
+# Display device support
 #
-# CONFIG_SOUND is not set
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
-# HID Devices
-#
-# CONFIG_HID is not set
-
-#
-# USB support
+# Console display driver support
 #
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HIDRAW=y
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+CONFIG_USB_HIDDEV=y
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 # CONFIG_USB_ARCH_HAS_EHCI is not set
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
 
 #
-# Real Time Clock
+# OTG and related infrastructure
 #
-# CONFIG_RTC_CLASS is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# DMA Engine support
+# RTC interfaces
 #
-# CONFIG_DMA_ENGINE is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -953,69 +1009,76 @@ CONFIG_GENERIC_ACL=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+# CONFIG_JFFS2_FS_POSIX_ACL is not set
+# CONFIG_JFFS2_FS_SECURITY is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_CODEPAGE_437 is not set
 # CONFIG_NLS_CODEPAGE_737 is not set
@@ -1055,34 +1118,71 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1090,67 +1190,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
diff --git a/arch/mips/configs/pb1200_defconfig b/arch/mips/configs/pb1200_defconfig
new file mode 100644 (file)
index 0000000..e9ad773
--- /dev/null
@@ -0,0 +1,1568 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.33
+# Fri Feb 26 10:23:34 2010
+#
+CONFIG_MIPS=y
+
+#
+# Machine selection
+#
+CONFIG_MACH_ALCHEMY=y
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
+# CONFIG_MIPS_COBALT is not set
+# CONFIG_MACH_DECSTATION is not set
+# CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
+# CONFIG_MIPS_MALTA is not set
+# CONFIG_MIPS_SIM is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
+# CONFIG_PNX8550_JBS is not set
+# CONFIG_PNX8550_STB810 is not set
+# CONFIG_PMC_MSP is not set
+# CONFIG_PMC_YOSEMITE is not set
+# CONFIG_POWERTV is not set
+# CONFIG_SGI_IP22 is not set
+# CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
+# CONFIG_SGI_IP32 is not set
+# CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
+# CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
+# CONFIG_SNI_RM is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+CONFIG_MIPS_PB1200=y
+# CONFIG_MIPS_PB1500 is not set
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1200=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+CONFIG_CPU_LITTLE_ENDIAN=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
+CONFIG_IRQ_CPU=y
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+
+#
+# CPU selection
+#
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
+CONFIG_CPU_MIPS32_R1=y
+# CONFIG_CPU_MIPS32_R2 is not set
+# CONFIG_CPU_MIPS64_R1 is not set
+# CONFIG_CPU_MIPS64_R2 is not set
+# CONFIG_CPU_R3000 is not set
+# CONFIG_CPU_TX39XX is not set
+# CONFIG_CPU_VR41XX is not set
+# CONFIG_CPU_R4300 is not set
+# CONFIG_CPU_R4X00 is not set
+# CONFIG_CPU_TX49XX is not set
+# CONFIG_CPU_R5000 is not set
+# CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
+# CONFIG_CPU_R6000 is not set
+# CONFIG_CPU_NEVADA is not set
+# CONFIG_CPU_R8000 is not set
+# CONFIG_CPU_R10000 is not set
+# CONFIG_CPU_RM7000 is not set
+# CONFIG_CPU_RM9000 is not set
+# CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_CPU_MIPS32=y
+CONFIG_CPU_MIPSR1=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+
+#
+# Kernel type
+#
+CONFIG_32BIT=y
+# CONFIG_64BIT is not set
+CONFIG_PAGE_SIZE_4KB=y
+# CONFIG_PAGE_SIZE_8KB is not set
+# CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
+# CONFIG_PAGE_SIZE_64KB is not set
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MIPS_MT_SMP is not set
+# CONFIG_MIPS_MT_SMTC is not set
+CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+CONFIG_CPU_HAS_SYNC=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+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_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+CONFIG_KSM=y
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_48 is not set
+CONFIG_HZ_100=y
+# CONFIG_HZ_128 is not set
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_256 is not set
+# CONFIG_HZ_1000 is not set
+# CONFIG_HZ_1024 is not set
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_HZ=100
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-pb1200"
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+# CONFIG_FREEZER is not set
+
+#
+# Bus options (PCI, PCMCIA, EISA, ISA, TC)
+#
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_MMU=y
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
+CONFIG_PCMCIA_LOAD_CIS=y
+# CONFIG_PCMCIA_IOCTL is not set
+
+#
+# PC-card bridges
+#
+# CONFIG_PCMCIA_AU1X00 is not set
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
+
+#
+# Executable file formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=y
+CONFIG_TRAD_SIGNALS=y
+
+#
+# Power management options
+#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+# CONFIG_PM is not set
+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=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+# CONFIG_IP_PNP_DHCP is not set
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA 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_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS 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_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# 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 is not set
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SST25L is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM 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
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=y
+# CONFIG_MTD_NAND_AU1550 is not set
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+CONFIG_MTD_NAND_PLATFORM=y
+# CONFIG_MTD_ALAUDA is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_UB=y
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
+CONFIG_IDE=y
+
+#
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
+#
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_ATAPI=y
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+CONFIG_BLK_DEV_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
+# CONFIG_BLK_DEV_IDETAPE is not set
+CONFIG_IDE_TASK_IOCTL=y
+# CONFIG_IDE_PROC_FS is not set
+
+#
+# IDE chipset support/bugfixes
+#
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+CONFIG_BLK_DEV_IDE_AU1XXX=y
+CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y
+# CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_PHYLIB is not set
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
+# CONFIG_MIPS_AU1X00_ENET is not set
+CONFIG_SMC91X=y
+# CONFIG_DM9000 is not set
+# CONFIG_ENC28J60 is not set
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_NET_PCMCIA is not set
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET 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_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_SERIAL_8250_CS is not set
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
+# CONFIG_SERIAL_8250_EXTENDED is not set
+CONFIG_SERIAL_8250_AU1X00=y
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_R3964 is not set
+
+#
+# PCMCIA character devices
+#
+# CONFIG_SYNCLINK_CS is not set
+# CONFIG_CARDMAN_4000 is not set
+# CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_AU1550=y
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_TSL2550 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
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+CONFIG_SPI_AU1550=y
+CONFIG_SPI_BITBANG=y
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO expanders:
+#
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_GPIO_PCF857X is not set
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+
+#
+# AC97 GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+CONFIG_HWMON=y
+CONFIG_HWMON_VID=y
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+CONFIG_SENSORS_ADM1025=y
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A 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_LM70=y
+# CONFIG_SENSORS_LM73 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_LM93 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_UCB1400_CORE is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13783 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_AU1200=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+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
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+# CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_VERBOSE_PROCFS is not set
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+CONFIG_SND_VMASTER=y
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_AC97_CODEC=y
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_SPI is not set
+# CONFIG_SND_MIPS is not set
+# CONFIG_SND_USB is not set
+# CONFIG_SND_PCMCIA is not set
+CONFIG_SND_SOC=y
+CONFIG_SND_SOC_AC97_BUS=y
+CONFIG_SND_SOC_AU1XPSC=y
+CONFIG_SND_SOC_AU1XPSC_I2S=y
+CONFIG_SND_SOC_AU1XPSC_AC97=y
+CONFIG_SND_SOC_DB1200=y
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_AC97_CODEC=y
+CONFIG_SND_SOC_WM8731=y
+# CONFIG_SOUND_PRIME is not set
+CONFIG_AC97_BUS=y
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HIDRAW=y
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+CONFIG_USB_HIDDEV=y
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+CONFIG_USB_DEBUG=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+# CONFIG_MMC_BLOCK_BOUNCE is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+CONFIG_MMC_AU1X=y
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
+# CONFIG_MMC_SPI is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_PCA955X is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+# CONFIG_LEDS_TRIGGER_TIMER is not set
+# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
+# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
+# CONFIG_LEDS_TRIGGER_GPIO is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
+
+#
+# iptables trigger is under Netfilter config (LED target)
+#
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING 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_EXT4_FS 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_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_UDF_FS=y
+CONFIG_UDF_NLS=y
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+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_PROC_KCORE is not set
+CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# 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_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+# CONFIG_JFFS2_FS_XATTR is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+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
+# 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
+
+#
+# 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_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+CONFIG_NLS_CODEPAGE_850=y
+CONFIG_NLS_CODEPAGE_852=y
+# 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=y
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_2=y
+# 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=y
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
+
+#
+# Kernel hacking
+#
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_STRIP_ASM_SYMS=y
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyS0,115200"
+# CONFIG_CMDLINE_OVERRIDE is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+CONFIG_KEYS_DEBUG_PROC_KEYS=y
+# CONFIG_SECURITY is not set
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index 5ec60836b6451048d07f5f4e1c5ad27bfff1bb01..7497d3306b91f4a1c52862579432c6c9ccb84fc5 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:37 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 10:05:27 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-CONFIG_MIPS_PB1500=y
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+CONFIG_MIPS_PB1500=y
+# CONFIG_MIPS_PB1550 is not set
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1500=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1500=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -85,6 +109,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -92,11 +117,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -106,190 +134,255 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_RESOURCES_64BIT=y
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-pb1500"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_PCI_QUIRKS=y
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
 CONFIG_PCMCIA_IOCTL=y
-CONFIG_CARDBUS=y
+# CONFIG_CARDBUS is not set
 
 #
 # PC-card bridges
 #
 # CONFIG_YENTA is not set
-CONFIG_PD6729=m
+# CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
 # CONFIG_PCMCIA_AU1X00 is not set
-CONFIG_PCCARD_NONSTATIC=m
-
-#
-# PCI Hotplug Support
-#
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -300,110 +393,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -413,27 +421,24 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -442,25 +447,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -473,6 +478,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -498,14 +504,14 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -523,30 +529,20 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# LPDDR flash memory drivers
 #
-# CONFIG_PARPORT is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
@@ -554,67 +550,66 @@ CONFIG_MTD_ALCHEMY=y
 # 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_SX8 is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
-
-#
-# Misc devices
-#
-CONFIG_SGI_IOC4=m
-# CONFIG_TIFM_CORE is not set
 
 #
-# ATA/ATAPI/MFM/RLL support
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
 #
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_UB=y
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=4
-CONFIG_BLK_DEV_IDE=y
 
 #
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_ATAPI=y
 # CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_DELKIN is not set
-# CONFIG_BLK_DEV_IDECD is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+CONFIG_BLK_DEV_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
 # CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_TASK_IOCTL=y
+CONFIG_IDE_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
 CONFIG_BLK_DEV_IDEPCI=y
-# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_IDEPCI_PCIBUS_ORDER is not set
 # CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_GENERIC is not set
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_PCI_AUTO is not set
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 # CONFIG_BLK_DEV_AMD74XX is not set
 # CONFIG_BLK_DEV_CMD64X is not set
 # CONFIG_BLK_DEV_TRIFLEX is not set
-# CONFIG_BLK_DEV_CY82C693 is not set
 # CONFIG_BLK_DEV_CS5520 is not set
 # CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_HPT34X is not set
 CONFIG_BLK_DEV_HPT366=y
 # CONFIG_BLK_DEV_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
 # CONFIG_BLK_DEV_PIIX is not set
-CONFIG_BLK_DEV_IT8213=m
+# CONFIG_BLK_DEV_IT8172 is not set
+# CONFIG_BLK_DEV_IT8213 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
@@ -624,82 +619,65 @@ CONFIG_BLK_DEV_IT8213=m
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
-CONFIG_BLK_DEV_TC86C001=m
-# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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
+# You can enable one or both FireWire driver stacks.
 #
-# CONFIG_I2O is not set
 
 #
-# Network device support
+# The newer stack is recommended.
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -707,96 +685,51 @@ CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# 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_SKY2 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=m
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=m
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=m
-
-#
-# Token Ring devices
-#
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_ATL2 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
+# CONFIG_WLAN is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Enable WiMAX (Networking options) to see the WiMAX drivers
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
+# USB Network Adapters
 #
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_NET_PCMCIA is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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_VMXNET3 is not set
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -804,16 +737,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -823,33 +754,34 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
+# CONFIG_NOZOMI is not set
 
 #
 # Serial drivers
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
+# CONFIG_SERIAL_8250_PCI is not set
 # CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
@@ -863,282 +795,450 @@ 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
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 
 #
-# Dallas's 1-wire bus
+# PPS support
 #
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
-# CONFIG_FB is not set
+# CONFIG_VGA_ARB is not set
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_CIRRUS is not set
+# CONFIG_FB_PM2 is not set
+# CONFIG_FB_CYBER2000 is not set
+# CONFIG_FB_ASILIANT is not set
+# CONFIG_FB_IMSTT is not set
+CONFIG_FB_S1D13XXX=y
+# CONFIG_FB_NVIDIA is not set
+# CONFIG_FB_RIVA is not set
+# CONFIG_FB_MATROX is not set
+# CONFIG_FB_RADEON is not set
+# CONFIG_FB_ATY128 is not set
+# CONFIG_FB_ATY is not set
+# CONFIG_FB_S3 is not set
+# CONFIG_FB_SAVAGE is not set
+# CONFIG_FB_SIS is not set
+# CONFIG_FB_VIA is not set
+# CONFIG_FB_NEOMAGIC is not set
+# CONFIG_FB_KYRO is not set
+# CONFIG_FB_3DFX is not set
+# CONFIG_FB_VOODOO1 is not set
+# CONFIG_FB_VT8623 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_ARK is not set
+# CONFIG_FB_PM3 is not set
+# CONFIG_FB_CARMINE is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
+# Display device support
 #
-# CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
-# CONFIG_HID is not set
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
-# USB support
+# Console display driver support
 #
+CONFIG_VGA_CONSOLE=y
+# CONFIG_VGACON_SOFT_SCROLLBACK is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE is not set
+# CONFIG_LOGO is not set
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+CONFIG_USB_HIDDEV=y
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_DYNAMIC_MINORS=y
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_OTG is not set
+CONFIG_USB_OTG_WHITELIST=y
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
+# CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
-# CONFIG_INFINIBAND is not set
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
 
 #
-# Real Time Clock
+# OTG and related infrastructure
 #
-# CONFIG_RTC_CLASS is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# DMA Engine support
+# RTC interfaces
 #
-# CONFIG_DMA_ENGINE is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
 #
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_UDF_FS=y
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
 #
+CONFIG_FAT_FS=y
 # CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
+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_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+# CONFIG_JFFS2_FS_XATTR is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+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_850=y
+CONFIG_NLS_CODEPAGE_852=y
 # CONFIG_NLS_CODEPAGE_855 is not set
 # CONFIG_NLS_CODEPAGE_857 is not set
 # CONFIG_NLS_CODEPAGE_860 is not set
@@ -1155,10 +1255,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_1250=y
 # CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 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
@@ -1168,38 +1268,75 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1207,67 +1344,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=y
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index 6647642b5d9713281d7047b523438619f454223d..aa526f53cb1b1db8c179fdc350a731eba84c655a 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:37 2007
+# Linux kernel version: 2.6.33
+# Fri Feb 26 10:06:07 2010
 #
 CONFIG_MIPS=y
 
 #
 # Machine selection
 #
-CONFIG_ZONE_DMA=y
 CONFIG_MACH_ALCHEMY=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-CONFIG_MIPS_PB1550=y
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_AR7 is not set
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
+# CONFIG_MACH_LOONGSON is not set
 # CONFIG_MIPS_MALTA is not set
-# CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MIPS_XXS1500 is not set
+# CONFIG_NEC_MARKEINS is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_MACH_VR41XX is not set
+# CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
-# CONFIG_MARKEINS is not set
+# CONFIG_POWERTV is not set
 # CONFIG_SGI_IP22 is not set
 # CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
 # CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
 # CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CARMEL is not set
 # CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SWARM is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_BIGSUR is not set
 # CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+# CONFIG_WR_PPMC is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+CONFIG_ALCHEMY_GPIOINT_AU1000=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+# CONFIG_MIPS_MTX1 is not set
+# CONFIG_MIPS_BOSPORUS is not set
+# CONFIG_MIPS_DB1000 is not set
+# CONFIG_MIPS_DB1100 is not set
+# CONFIG_MIPS_DB1200 is not set
+# CONFIG_MIPS_DB1500 is not set
+# CONFIG_MIPS_DB1550 is not set
+# CONFIG_MIPS_MIRAGE is not set
+# CONFIG_MIPS_PB1000 is not set
+# CONFIG_MIPS_PB1100 is not set
+# CONFIG_MIPS_PB1200 is not set
+# CONFIG_MIPS_PB1500 is not set
+CONFIG_MIPS_PB1550=y
+# CONFIG_MIPS_XXS1500 is not set
+CONFIG_SOC_AU1550=y
+CONFIG_SOC_AU1X00=y
+CONFIG_LOONGSON_UART_BASE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_GPIO=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SOC_AU1550=y
-CONFIG_SOC_AU1X00=y
+CONFIG_IRQ_CPU=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 
 #
 # CPU selection
 #
+# CONFIG_CPU_LOONGSON2E is not set
+# CONFIG_CPU_LOONGSON2F is not set
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
 # CONFIG_CPU_MIPS64_R1 is not set
@@ -86,6 +110,7 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_R5000 is not set
 # CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
 # CONFIG_CPU_R6000 is not set
 # CONFIG_CPU_NEVADA is not set
 # CONFIG_CPU_R8000 is not set
@@ -93,11 +118,14 @@ CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_RM7000 is not set
 # CONFIG_CPU_RM9000 is not set
 # CONFIG_CPU_SB1 is not set
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_HARDWARE_WATCHPOINTS=y
 
 #
 # Kernel type
@@ -107,190 +135,255 @@ CONFIG_32BIT=y
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_8KB is not set
 # CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_32KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
 CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
 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_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_RESOURCES_64BIT=y
-CONFIG_ZONE_DMA_FLAG=1
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
+CONFIG_HZ_100=y
 # CONFIG_HZ_128 is not set
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
+# CONFIG_HZ_1000 is not set
 # CONFIG_HZ_1024 is not set
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
+CONFIG_HZ=100
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_KEXEC is not set
+# CONFIG_SECCOMP is not set
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION="-pb1550"
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+CONFIG_KERNEL_LZMA=y
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+# CONFIG_TREE_RCU is not set
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TINY_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+# CONFIG_PCSPKR_PLATFORM is not set
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_PCI_QUIRKS=y
+# CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
+# CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
 
 #
-# Loadable module support
+# GCOV-based kernel profiling
 #
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
 CONFIG_HW_HAS_PCI=y
 CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=y
+CONFIG_PCMCIA=y
 CONFIG_PCMCIA_LOAD_CIS=y
 CONFIG_PCMCIA_IOCTL=y
-CONFIG_CARDBUS=y
+# CONFIG_CARDBUS is not set
 
 #
 # PC-card bridges
 #
 # CONFIG_YENTA is not set
-CONFIG_PD6729=m
+# CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
 # CONFIG_PCMCIA_AU1X00 is not set
-CONFIG_PCCARD_NONSTATIC=m
-
-#
-# PCI Hotplug Support
-#
+CONFIG_PCMCIA_ALCHEMY_DEVBOARD=y
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 CONFIG_TRAD_SIGNALS=y
 
 #
 # Power management options
 #
-# CONFIG_PM is not set
-
-#
-# Networking
-#
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
 
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
+CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
+CONFIG_IP_PNP_RARP=y
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
@@ -301,110 +394,25 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=m
-CONFIG_INET_XFRM_MODE_TUNNEL=m
-CONFIG_INET_XFRM_MODE_BEET=m
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_LRO=y
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# Core Netfilter Configuration
-#
-CONFIG_NETFILTER_NETLINK=m
-CONFIG_NETFILTER_NETLINK_QUEUE=m
-CONFIG_NETFILTER_NETLINK_LOG=m
-CONFIG_NF_CONNTRACK_ENABLED=m
-CONFIG_NF_CONNTRACK_SUPPORT=y
-# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set
-CONFIG_NF_CONNTRACK=m
-CONFIG_NF_CT_ACCT=y
-CONFIG_NF_CONNTRACK_MARK=y
-CONFIG_NF_CONNTRACK_SECMARK=y
-CONFIG_NF_CONNTRACK_EVENTS=y
-CONFIG_NF_CT_PROTO_GRE=m
-CONFIG_NF_CT_PROTO_SCTP=m
-CONFIG_NF_CONNTRACK_AMANDA=m
-CONFIG_NF_CONNTRACK_FTP=m
-CONFIG_NF_CONNTRACK_H323=m
-CONFIG_NF_CONNTRACK_IRC=m
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-CONFIG_NF_CONNTRACK_PPTP=m
-CONFIG_NF_CONNTRACK_SANE=m
-CONFIG_NF_CONNTRACK_SIP=m
-CONFIG_NF_CONNTRACK_TFTP=m
-CONFIG_NF_CT_NETLINK=m
-CONFIG_NETFILTER_XTABLES=m
-CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
-CONFIG_NETFILTER_XT_TARGET_MARK=m
-CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
-CONFIG_NETFILTER_XT_TARGET_NFLOG=m
-CONFIG_NETFILTER_XT_TARGET_SECMARK=m
-CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
-CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_COMMENT=m
-CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
-CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
-CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
-CONFIG_NETFILTER_XT_MATCH_DCCP=m
-CONFIG_NETFILTER_XT_MATCH_DSCP=m
-CONFIG_NETFILTER_XT_MATCH_ESP=m
-CONFIG_NETFILTER_XT_MATCH_HELPER=m
-CONFIG_NETFILTER_XT_MATCH_LENGTH=m
-CONFIG_NETFILTER_XT_MATCH_LIMIT=m
-CONFIG_NETFILTER_XT_MATCH_MAC=m
-CONFIG_NETFILTER_XT_MATCH_MARK=m
-CONFIG_NETFILTER_XT_MATCH_POLICY=m
-CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
-CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
-CONFIG_NETFILTER_XT_MATCH_QUOTA=m
-CONFIG_NETFILTER_XT_MATCH_REALM=m
-CONFIG_NETFILTER_XT_MATCH_SCTP=m
-CONFIG_NETFILTER_XT_MATCH_STATE=m
-CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
-CONFIG_NETFILTER_XT_MATCH_STRING=m
-CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
-CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_NF_CONNTRACK_IPV4=m
-CONFIG_NF_CONNTRACK_PROC_COMPAT=y
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -414,27 +422,30 @@ CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-CONFIG_IEEE80211_CRYPT_CCMP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -443,25 +454,25 @@ CONFIG_WIRELESS_EXT=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=m
-
-#
-# Memory Technology Devices (MTD)
-#
+# CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -474,6 +485,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -499,14 +511,14 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_ALCHEMY=y
+CONFIG_MTD_PHYSMAP=y
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -524,30 +536,30 @@ CONFIG_MTD_ALCHEMY=y
 # 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
-
-#
-# OneNAND Flash Device Drivers
-#
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=y
+CONFIG_MTD_NAND_AU1550=y
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_CAFE is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
+# LPDDR flash memory drivers
 #
-# CONFIG_PNPACPI is not set
+# CONFIG_MTD_LPDDR is not set
 
 #
-# Block devices
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
@@ -555,67 +567,66 @@ CONFIG_MTD_ALCHEMY=y
 # 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_SX8 is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=m
 
 #
-# Misc devices
-#
-CONFIG_SGI_IOC4=m
-# CONFIG_TIFM_CORE is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
 #
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_UB=y
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+# CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
-CONFIG_IDE_MAX_HWIFS=4
-CONFIG_BLK_DEV_IDE=y
 
 #
-# Please see Documentation/ide.txt for help/info on IDE drives
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
 #
+CONFIG_IDE_XFER_MODE=y
+CONFIG_IDE_ATAPI=y
 # CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_DELKIN is not set
-# CONFIG_BLK_DEV_IDECD is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECS=y
+CONFIG_BLK_DEV_IDECD=y
+# CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
 CONFIG_BLK_DEV_IDEPCI=y
-# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_IDEPCI_PCIBUS_ORDER is not set
 # CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_GENERIC is not set
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_PCI_AUTO is not set
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 # CONFIG_BLK_DEV_AMD74XX is not set
 # CONFIG_BLK_DEV_CMD64X is not set
 # CONFIG_BLK_DEV_TRIFLEX is not set
-# CONFIG_BLK_DEV_CY82C693 is not set
 # CONFIG_BLK_DEV_CS5520 is not set
 # CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_HPT34X is not set
 CONFIG_BLK_DEV_HPT366=y
 # CONFIG_BLK_DEV_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
 # CONFIG_BLK_DEV_PIIX is not set
-CONFIG_BLK_DEV_IT8213=m
+# CONFIG_BLK_DEV_IT8172 is not set
+# CONFIG_BLK_DEV_IT8213 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
@@ -625,82 +636,65 @@ CONFIG_BLK_DEV_IT8213=m
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
-CONFIG_BLK_DEV_TC86C001=m
-# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
 #
-CONFIG_RAID_ATTRS=m
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA 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
+# You can enable one or both FireWire driver stacks.
 #
-# CONFIG_I2O is not set
 
 #
-# Network device support
+# The newer stack is recommended.
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 CONFIG_PHYLIB=y
 
 #
 # MII PHY device drivers
 #
-CONFIG_MARVELL_PHY=m
-CONFIG_DAVICOM_PHY=m
-CONFIG_QSEMI_PHY=m
-CONFIG_LXT_PHY=m
-CONFIG_CICADA_PHY=m
-CONFIG_VITESSE_PHY=m
-CONFIG_SMSC_PHY=m
-# CONFIG_BROADCOM_PHY is not set
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
 # CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
 CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -708,88 +702,51 @@ CONFIG_MIPS_AU1X00_ENET=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_ETHOC is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# 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_SKY2 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=m
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=m
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=m
-
-#
-# Token Ring devices
-#
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_ATL2 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
+# CONFIG_WLAN is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Enable WiMAX (Networking options) to see the WiMAX drivers
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# PCMCIA network device support
+# USB Network Adapters
 #
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
 # CONFIG_NET_PCMCIA is not set
-
-#
-# Wan interfaces
-#
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
+# CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-CONFIG_SLHC=m
-# 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_VMXNET3 is not set
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -797,16 +754,14 @@ CONFIG_SLHC=m
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# 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
 
@@ -816,33 +771,34 @@ CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=m
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_AU1X00_GPIO is not set
+# CONFIG_NOZOMI is not set
 
 #
 # Serial drivers
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
+# CONFIG_SERIAL_8250_PCI is not set
 # CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RUNTIME_UARTS=4
@@ -856,282 +812,492 @@ 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
-
-#
-# IPMI
-#
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 
 #
 # PCMCIA character devices
 #
-CONFIG_SYNCLINK_CS=m
+# CONFIG_SYNCLINK_CS is not set
 # CONFIG_CARDMAN_4000 is not set
 # CONFIG_CARDMAN_4040 is not set
+# CONFIG_IPWIRELESS is not set
 # CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_DEVPORT=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
 
 #
-# TPM devices
+# I2C Algorithms
 #
-# CONFIG_TCG_TPM is not set
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
 
 #
-# I2C support
+# I2C Hardware Bus support
 #
-# CONFIG_I2C is not set
 
 #
-# SPI support
+# PC SMBus host controller drivers
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_ISCH is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
 
 #
-# Dallas's 1-wire bus
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
-# CONFIG_W1 is not set
+CONFIG_I2C_AU1550=y
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
 
 #
-# Hardware Monitoring support
+# Other I2C/SMBus bus drivers
 #
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_TSL2550 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
+# CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
-# Multimedia devices
+# Sonics Silicon Backplane
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_SSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multifunction device drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
-# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_VGA_ARB is not set
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# HID Devices
+# Display device support
 #
-# CONFIG_HID is not set
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
-# USB support
+# Console display driver support
 #
+CONFIG_VGA_CONSOLE=y
+# CONFIG_VGACON_SOFT_SCROLLBACK is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HIDRAW=y
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+CONFIG_USB_HIDDEV=y
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# Miscellaneous USB options
 #
+CONFIG_USB_DEVICEFS=y
+CONFIG_USB_DEVICE_CLASS=y
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
-# USB Gadget Support
+# USB Host Controller Drivers
 #
-# CONFIG_USB_GADGET is not set
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 
 #
-# MMC/SD Card support
+# USB Device Class drivers
 #
-# CONFIG_MMC is not set
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# LED devices
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
-# CONFIG_NEW_LEDS is not set
 
 #
-# LED drivers
+# also be needed; see USB_STORAGE Help for more info
 #
+# CONFIG_USB_LIBUSUAL is not set
 
 #
-# LED Triggers
+# USB Imaging devices
 #
+# CONFIG_USB_MDC800 is not set
 
 #
-# InfiniBand support
+# USB port drivers
 #
-# CONFIG_INFINIBAND is not set
+# CONFIG_USB_SERIAL is not set
 
 #
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+# USB Miscellaneous drivers
 #
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# Real Time Clock
+# RTC interfaces
 #
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# DMA Engine support
+# I2C RTC drivers
 #
-# CONFIG_DMA_ENGINE is not set
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
 
 #
-# DMA Clients
+# SPI RTC drivers
 #
 
 #
-# DMA Devices
+# Platform RTC drivers
 #
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Auxiliary Display support
+# on-CPU RTC drivers
 #
+CONFIG_RTC_DRV_AU1XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
 
 #
-# Virtualization
+# TI VLYNQ
 #
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 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_XATTR 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
-CONFIG_EXT3_FS_SECURITY=y
-# CONFIG_EXT4DEV_FS is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-CONFIG_FUSE_FS=m
-CONFIG_GENERIC_ACL=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
 
 #
 # CD-ROM/DVD Filesystems
 #
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_UDF_FS=y
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
 #
+CONFIG_FAT_FS=y
 # CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
+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_PROC_KCORE=y
+# CONFIG_PROC_KCORE is not set
 CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
 CONFIG_SYSFS=y
 CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_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_JFFS2_FS is not set
-CONFIG_CRAMFS=m
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+# CONFIG_JFFS2_FS_XATTR is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=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_JFFS2_CMODE_FAVOURLZO is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+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=m
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
-CONFIG_EXPORTFS=m
+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
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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=m
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+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_850=y
+CONFIG_NLS_CODEPAGE_852=y
 # CONFIG_NLS_CODEPAGE_855 is not set
 # CONFIG_NLS_CODEPAGE_857 is not set
 # CONFIG_NLS_CODEPAGE_860 is not set
@@ -1148,10 +1314,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_1250=y
 # CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 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
@@ -1161,38 +1327,75 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # 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_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=m
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
+CONFIG_NLS_UTF8=y
+# CONFIG_DLM is not set
 
 #
 # Kernel hacking
 #
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
+CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_DETECT_SOFTLOCKUP is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_EARLY_PRINTK=y
 # CONFIG_CMDLINE_BOOL is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_RUNTIME_DEBUG is not set
+CONFIG_DEBUG_ZBOOT=y
 
 #
 # Security options
@@ -1200,67 +1403,32 @@ CONFIG_CROSSCOMPILE=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=m
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_TGR192=m
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_LRW=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_TWOFISH_COMMON=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_CAMELLIA=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_SECURITYFS=y
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-CONFIG_CRC16=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=y
 CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_TEXTSEARCH=y
-CONFIG_TEXTSEARCH_KMP=m
-CONFIG_TEXTSEARCH_BM=m
-CONFIG_TEXTSEARCH_FSM=m
-CONFIG_PLIST=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
index b0dc6d53edd61fbb88283b8e4f18dae73ad5aacf..94d23b4a7dc3e30afb4835a617b25d6d262e9b99 100644 (file)
@@ -46,7 +46,7 @@
  * There is no default value -- it has to be initialized.
  */
 u16 cached_kn01_csr;
-DEFINE_SPINLOCK(kn01_lock);
+static DEFINE_RAW_SPINLOCK(kn01_lock);
 
 
 static inline void dec_kn01_be_ack(void)
@@ -54,12 +54,12 @@ static inline void dec_kn01_be_ack(void)
        volatile u16 *csr = (void *)CKSEG1ADDR(KN01_SLOT_BASE + KN01_CSR);
        unsigned long flags;
 
-       spin_lock_irqsave(&kn01_lock, flags);
+       raw_spin_lock_irqsave(&kn01_lock, flags);
 
        *csr = cached_kn01_csr | KN01_CSR_MEMERR;       /* Clear bus IRQ. */
        iob();
 
-       spin_unlock_irqrestore(&kn01_lock, flags);
+       raw_spin_unlock_irqrestore(&kn01_lock, flags);
 }
 
 static int dec_kn01_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
@@ -182,7 +182,7 @@ void __init dec_kn01_be_init(void)
        volatile u16 *csr = (void *)CKSEG1ADDR(KN01_SLOT_BASE + KN01_CSR);
        unsigned long flags;
 
-       spin_lock_irqsave(&kn01_lock, flags);
+       raw_spin_lock_irqsave(&kn01_lock, flags);
 
        /* Preset write-only bits of the Control Register cache. */
        cached_kn01_csr = *csr;
@@ -194,7 +194,7 @@ void __init dec_kn01_be_init(void)
        *csr = cached_kn01_csr;
        iob();
 
-       spin_unlock_irqrestore(&kn01_lock, flags);
+       raw_spin_unlock_irqrestore(&kn01_lock, flags);
 
        /* Clear any leftover errors from the firmware. */
        dec_kn01_be_ack();
index d9acdcefee8158d3e22ef7bb0eb8d108ea471885..f72b5741025fa8cc10a83dd430b0feb51b3a83d0 100644 (file)
@@ -27,4 +27,3 @@ NESTED(genexcept_early, 0, sp)
        jr      k0
         rfe
 END(genexcept_early)
-
index dd75d673447e37147c438991829b70c15c7c721b..519197ede0898f2ce7bd0a3019fd4ac1f541d057 100644 (file)
@@ -137,7 +137,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
 {
        int result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                int temp;
@@ -189,7 +189,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
 {
        int result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                int temp;
@@ -249,7 +249,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
 {
        int result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                int temp;
@@ -516,7 +516,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
 {
        long result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                long temp;
@@ -568,7 +568,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
 {
        long result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                long temp;
@@ -628,7 +628,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
 {
        long result;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                long temp;
@@ -788,9 +788,9 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
  * atomic*_return operations are serializing but not the non-*_return
  * versions.
  */
-#define smp_mb__before_atomic_dec()    smp_llsc_mb()
+#define smp_mb__before_atomic_dec()    smp_mb__before_llsc()
 #define smp_mb__after_atomic_dec()     smp_llsc_mb()
-#define smp_mb__before_atomic_inc()    smp_llsc_mb()
+#define smp_mb__before_atomic_inc()    smp_mb__before_llsc()
 #define smp_mb__after_atomic_inc()     smp_llsc_mb()
 
 #include <asm-generic/atomic-long.h>
index 8e9ac313ca3b498906df6086065c0a067e90614e..c0884f02d3a64ea2a7ad8b1a042a19e69a905a03 100644 (file)
                : /* no output */               \
                : "m" (*(int *)CKSEG1)          \
                : "memory")
-
-#define fast_wmb()     __sync()
-#define fast_rmb()     __sync()
-#define fast_mb()      __sync()
-#ifdef CONFIG_SGI_IP28
-#define fast_iob()                             \
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+# define OCTEON_SYNCW_STR      ".set push\n.set arch=octeon\nsyncw\nsyncw\n.set pop\n"
+# define __syncw()     __asm__ __volatile__(OCTEON_SYNCW_STR : : : "memory")
+
+# define fast_wmb()    __syncw()
+# define fast_rmb()    barrier()
+# define fast_mb()     __sync()
+# define fast_iob()    do { } while (0)
+#else /* ! CONFIG_CPU_CAVIUM_OCTEON */
+# define fast_wmb()    __sync()
+# define fast_rmb()    __sync()
+# define fast_mb()     __sync()
+# ifdef CONFIG_SGI_IP28
+#  define fast_iob()                           \
        __asm__ __volatile__(                   \
                ".set   push\n\t"               \
                ".set   noreorder\n\t"          \
                : /* no output */               \
                : "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
                : "memory")
-#else
-#define fast_iob()                             \
+# else
+#  define fast_iob()                           \
        do {                                    \
                __sync();                       \
                __fast_iob();                   \
        } while (0)
-#endif
+# endif
+#endif /* CONFIG_CPU_CAVIUM_OCTEON */
 
 #ifdef CONFIG_CPU_HAS_WB
 
 #endif /* !CONFIG_CPU_HAS_WB */
 
 #if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
-#define __WEAK_ORDERING_MB     "       sync    \n"
+# ifdef CONFIG_CPU_CAVIUM_OCTEON
+#  define smp_mb()     __sync()
+#  define smp_rmb()    barrier()
+#  define smp_wmb()    __syncw()
+# else
+#  define smp_mb()     __asm__ __volatile__("sync" : : :"memory")
+#  define smp_rmb()    __asm__ __volatile__("sync" : : :"memory")
+#  define smp_wmb()    __asm__ __volatile__("sync" : : :"memory")
+# endif
 #else
-#define __WEAK_ORDERING_MB     "               \n"
+#define smp_mb()       barrier()
+#define smp_rmb()      barrier()
+#define smp_wmb()      barrier()
 #endif
+
 #if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
 #define __WEAK_LLSC_MB         "       sync    \n"
 #else
 #define __WEAK_LLSC_MB         "               \n"
 #endif
 
-#define smp_mb()       __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
-#define smp_rmb()      __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
-#define smp_wmb()      __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
-
 #define set_mb(var, value) \
        do { var = value; smp_mb(); } while (0)
 
 #define smp_llsc_mb()  __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
-#define smp_llsc_rmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
-#define smp_llsc_wmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
+
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+#define smp_mb__before_llsc() smp_wmb()
+/* Cause previous writes to become visible on all CPUs as soon as possible */
+#define nudge_writes() __asm__ __volatile__(".set push\n\t"            \
+                                           ".set arch=octeon\n\t"      \
+                                           "syncw\n\t"                 \
+                                           ".set pop" : : : "memory")
+#else
+#define smp_mb__before_llsc() smp_llsc_mb()
+#define nudge_writes() mb()
+#endif
 
 #endif /* __ASM_BARRIER_H */
index 84a383806b2cd823d9acbb362df004ae27c15854..9255cfbee4596b2281a470a740d8bb0d493d5700 100644 (file)
@@ -42,7 +42,7 @@
 /*
  * clear_bit() doesn't provide any barrier for the compiler.
  */
-#define smp_mb__before_clear_bit()     smp_llsc_mb()
+#define smp_mb__before_clear_bit()     smp_mb__before_llsc()
 #define smp_mb__after_clear_bit()      smp_llsc_mb()
 
 /*
@@ -258,7 +258,7 @@ static inline int test_and_set_bit(unsigned long nr,
        unsigned short bit = nr & SZLONG_MASK;
        unsigned long res;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
@@ -395,7 +395,7 @@ static inline int test_and_clear_bit(unsigned long nr,
        unsigned short bit = nr & SZLONG_MASK;
        unsigned long res;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
@@ -485,7 +485,7 @@ static inline int test_and_change_bit(unsigned long nr,
        unsigned short bit = nr & SZLONG_MASK;
        unsigned long res;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
index 815a438a268da85962b1e0a59d6bc0b90e7eee9c..ed9aaaaf0749932495c93c11e1ff24838c66cdc6 100644 (file)
  */
 extern void __cmpxchg_called_with_bad_pointer(void);
 
-#define __cmpxchg(ptr, old, new, barrier)                              \
+#define __cmpxchg(ptr, old, new, pre_barrier, post_barrier)            \
 ({                                                                     \
        __typeof__(ptr) __ptr = (ptr);                                  \
        __typeof__(*(ptr)) __old = (old);                               \
        __typeof__(*(ptr)) __new = (new);                               \
        __typeof__(*(ptr)) __res = 0;                                   \
                                                                        \
-       barrier;                                                        \
+       pre_barrier;                                                    \
                                                                        \
        switch (sizeof(*(__ptr))) {                                     \
        case 4:                                                         \
@@ -96,13 +96,13 @@ extern void __cmpxchg_called_with_bad_pointer(void);
                break;                                                  \
        }                                                               \
                                                                        \
-       barrier;                                                        \
+       post_barrier;                                                   \
                                                                        \
        __res;                                                          \
 })
 
-#define cmpxchg(ptr, old, new)         __cmpxchg(ptr, old, new, smp_llsc_mb())
-#define cmpxchg_local(ptr, old, new)   __cmpxchg(ptr, old, new, )
+#define cmpxchg(ptr, old, new)         __cmpxchg(ptr, old, new, smp_mb__before_llsc(), smp_llsc_mb())
+#define cmpxchg_local(ptr, old, new)   __cmpxchg(ptr, old, new, )
 
 #define cmpxchg64(ptr, o, n)                                           \
   ({                                                                   \
index 1f4df647c384723b179a7b0a8de8873a0fb8b9e8..ac73cede3a0a5eec6487b97433e618daa5efea39 100644 (file)
@@ -95,6 +95,9 @@
 #ifndef cpu_has_smartmips
 #define cpu_has_smartmips      (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)
 #endif
+#ifndef kernel_uses_smartmips_rixi
+#define kernel_uses_smartmips_rixi 0
+#endif
 #ifndef cpu_has_vtag_icache
 #define cpu_has_vtag_icache    (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
 #endif
 # ifndef cpu_has_64bit_addresses
 # define cpu_has_64bit_addresses       0
 # endif
+# ifndef cpu_vmbits
+# define cpu_vmbits 31
+# endif
 #endif
 
 #ifdef CONFIG_64BIT
 # ifndef cpu_has_64bit_addresses
 # define cpu_has_64bit_addresses       1
 # endif
+# ifndef cpu_vmbits
+# define cpu_vmbits cpu_data[0].vmbits
+# define __NEED_VMBITS_PROBE
+# endif
 #endif
 
 #if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
index 126044308dec310fac7f66a28bca08ade3964f94..b39def3f6e03bdd950544b05cd4f765fbeb2b2e2 100644 (file)
@@ -58,6 +58,9 @@ struct cpuinfo_mips {
        struct cache_desc       tcache; /* Tertiary/split secondary cache */
        int                     srsets; /* Shadow register sets */
        int                     core;   /* physical core number */
+#ifdef CONFIG_64BIT
+       int                     vmbits; /* Virtual memory size in bits */
+#endif
 #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
        /*
         * In the MIPS MT "SMTC" model, each TC is considered
index cf373a95fe4ad1e7ee1391f2dceeac41dba5ad2e..a5acda41694696f598c957e0a1d8124dfb7d40cf 100644 (file)
@@ -224,7 +224,7 @@ enum cpu_type_enum {
         * MIPS64 class processors
         */
        CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2,
-       CPU_CAVIUM_OCTEON,
+       CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS,
 
        CPU_LAST
 };
index 559db66b97904fddf9697c711701bc1337843dcd..4c51401b5537c20d6f37923cfaa2e564bc54de4d 100644 (file)
@@ -1,23 +1 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1998, 2002 Ralf Baechle
- * Copyright (C) 1999 Silicon Graphics, Inc.
- */
-#ifndef _ASM_CURRENT_H
-#define _ASM_CURRENT_H
-
-#include <linux/thread_info.h>
-
-struct task_struct;
-
-static inline struct task_struct * get_current(void)
-{
-       return current_thread_info()->task;
-}
-
-#define current                get_current()
-
-#endif /* _ASM_CURRENT_H */
+#include <asm-generic/current.h>
index 28fa717ac423fb169177436027843f6058a720db..88d9ffd742588b41c99975943c7769fb75f18d25 100644 (file)
@@ -80,7 +80,6 @@
 struct pt_regs;
 
 extern u16 cached_kn01_csr;
-extern spinlock_t kn01_lock;
 
 extern void dec_kn01_be_init(void);
 extern int dec_kn01_be_handler(struct pt_regs *regs, int is_fixup);
index d8f9872b0e2dc3587a9e658adc957f093b7906fb..06746c5e80993d45b234cc047b22de19f6b7ffe4 100644 (file)
@@ -4,4 +4,3 @@
  * This file is released under the GPLv2
  */
 #include <asm-generic/device.h>
-
index 7a6a35dbe529c91ad71529e5d77218811be556cf..e53d7bed5cda3b2abcca04f411b6477d4254afee 100644 (file)
@@ -334,14 +334,14 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
 
 #define ELF_HWCAP       (0)
 
-/* This yields a string that ld.so will use to load implementation
-   specific libraries for optimization.  This is more specific in
-   intent than poking at uname or /proc/cpuinfo.
-
-   For the moment, we have only optimizations for the Intel generations,
-   but that could change... */
+/*
+ * This yields a string that ld.so will use to load implementation
+ * specific libraries for optimization.  This is more specific in
+ * intent than poking at uname or /proc/cpuinfo.
+ */
 
-#define ELF_PLATFORM  (NULL)
+#define ELF_PLATFORM  __elf_platform
+extern const char *__elf_platform;
 
 /*
  * See comments in asm-alpha/elf.h, this is the same thing
index 3986cd8704f38367ad21e416a9eb73f9afe6cb7a..ce35c9af0c28b2dd8d179e1f5ad75d9fc610ba4c 100644 (file)
@@ -4,7 +4,7 @@
  * more details.
  *
  * Copyright (C) 2009 DSLab, Lanzhou University, China
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  */
 
 #ifndef _ASM_MIPS_FTRACE_H
index 8572a2d90484946c539ab48c585755bb8594ac4e..c7e278447c0af7a237d024c3869dc4436b960d01 100644 (file)
@@ -35,7 +35,7 @@
 #define SLAVE_ICW4_DEFAULT     0x01
 #define PIC_ICW4_AEOI          2
 
-extern spinlock_t i8259A_lock;
+extern raw_spinlock_t i8259A_lock;
 
 extern int i8259A_irq_pending(unsigned int irq);
 extern void make_8259A_irq(unsigned int irq);
@@ -51,7 +51,7 @@ static inline int i8259_irq(void)
 {
        int irq;
 
-       spin_lock(&i8259A_lock);
+       raw_spin_lock(&i8259A_lock);
 
        /* Perform an interrupt acknowledge cycle on controller 1. */
        outb(0x0C, PIC_MASTER_CMD);             /* prepare for poll */
@@ -78,7 +78,7 @@ static inline int i8259_irq(void)
                        irq = -1;
        }
 
-       spin_unlock(&i8259A_lock);
+       raw_spin_unlock(&i8259A_lock);
 
        return likely(irq >= 0) ? irq + I8259A_IRQ_BASE : irq;
 }
index 436878e4e0639e26761561641f6ccf30223a88d6..c98bf514ec7de9efe6596721cfa472d878da3f16 100644 (file)
@@ -447,6 +447,24 @@ __BUILDIO(q, u64)
 #define readl_relaxed                  readl
 #define readq_relaxed                  readq
 
+#define readb_be(addr)                                                 \
+       __raw_readb((__force unsigned *)(addr))
+#define readw_be(addr)                                                 \
+       be16_to_cpu(__raw_readw((__force unsigned *)(addr)))
+#define readl_be(addr)                                                 \
+       be32_to_cpu(__raw_readl((__force unsigned *)(addr)))
+#define readq_be(addr)                                                 \
+       be64_to_cpu(__raw_readq((__force unsigned *)(addr)))
+
+#define writeb_be(val, addr)                                           \
+       __raw_writeb((val), (__force unsigned *)(addr))
+#define writew_be(val, addr)                                           \
+       __raw_writew(cpu_to_be16((val)), (__force unsigned *)(addr))
+#define writel_be(val, addr)                                           \
+       __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr))
+#define writeq_be(val, addr)                                           \
+       __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr))
+
 /*
  * Some code tests for these symbols
  */
index 06960364c96b961a2a91eb5432c8e318309659b8..dea4aed6478f7de6652c8b5491ebfc165cf52d53 100644 (file)
@@ -135,6 +135,7 @@ extern void free_irqno(unsigned int irq);
 #define CP0_LEGACY_COMPARE_IRQ 7
 
 extern int cp0_compare_irq;
+extern int cp0_compare_irq_shift;
 extern int cp0_perfcount_irq;
 
 #endif /* _ASM_IRQ_H */
index 21cbbc7064481d992cb999c1849276e84bc0028b..f1cf389434971a31bf4f1e1f963bed7134a55205 100644 (file)
@@ -105,26 +105,9 @@ static inline u8 ar7_chip_rev(void)
        return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x14)) >> 16) & 0xff;
 }
 
-static inline int ar7_cpu_freq(void)
-{
-       return ar7_cpu_clock;
-}
-
-static inline int ar7_bus_freq(void)
-{
-       return ar7_bus_clock;
-}
-
-static inline int ar7_vbus_freq(void)
-{
-       return ar7_bus_clock / 2;
-}
-#define ar7_cpmac_freq ar7_vbus_freq
-
-static inline int ar7_dsp_freq(void)
-{
-       return ar7_dsp_clock;
-}
+struct clk {
+       unsigned int    rate;
+};
 
 static inline int ar7_has_high_cpmac(void)
 {
index cbe9c4f126df6ca549ebaf374dd2d5eab203496d..73f9b162c9700b5a0fa4f5bfdce4fc712e06441f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
+ * Copyright (C) 2007-2009 Florian Fainelli <florian@openwrt.org>
  *
  * 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
 #include <asm/mach-ar7/ar7.h>
 
 #define AR7_GPIO_MAX 32
+#define NR_BUILTIN_GPIO AR7_GPIO_MAX
 
-extern int gpio_request(unsigned gpio, const char *label);
-extern void gpio_free(unsigned gpio);
+#define gpio_to_irq(gpio)      NULL
 
-/* Common GPIO layer */
-static inline int gpio_get_value(unsigned gpio)
-{
-       void __iomem *gpio_in =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
+#define gpio_get_value __gpio_get_value
+#define gpio_set_value __gpio_set_value
 
-       return readl(gpio_in) & (1 << gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       void __iomem *gpio_out =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
-       unsigned tmp;
-
-       tmp = readl(gpio_out) & ~(1 << gpio);
-       if (value)
-               tmp |= 1 << gpio;
-       writel(tmp, gpio_out);
-}
-
-static inline int gpio_direction_input(unsigned gpio)
-{
-       void __iomem *gpio_dir =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
-
-       if (gpio >= AR7_GPIO_MAX)
-               return -EINVAL;
-
-       writel(readl(gpio_dir) | (1 << gpio), gpio_dir);
-
-       return 0;
-}
-
-static inline int gpio_direction_output(unsigned gpio, int value)
-{
-       void __iomem *gpio_dir =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
-
-       if (gpio >= AR7_GPIO_MAX)
-               return -EINVAL;
-
-       gpio_set_value(gpio, value);
-       writel(readl(gpio_dir) & ~(1 << gpio), gpio_dir);
-
-       return 0;
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return -EINVAL;
-}
-
-static inline int irq_to_gpio(unsigned irq)
-{
-       return -EINVAL;
-}
+#define gpio_cansleep __gpio_cansleep
 
 /* Board specific GPIO functions */
-static inline int ar7_gpio_enable(unsigned gpio)
-{
-       void __iomem *gpio_en =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
-
-       writel(readl(gpio_en) | (1 << gpio), gpio_en);
-
-       return 0;
-}
-
-static inline int ar7_gpio_disable(unsigned gpio)
-{
-       void __iomem *gpio_en =
-               (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
-
-       writel(readl(gpio_en) & ~(1 << gpio), gpio_en);
-
-       return 0;
-}
+int ar7_gpio_enable(unsigned gpio);
+int ar7_gpio_disable(unsigned gpio);
 
 #include <asm-generic/gpio.h>
 
index 854e95f1b07c345edaf69aab4c7e03b6cc83e118..ae07423e6e821aa863a990e5f1751ef4734f8eb0 100644 (file)
@@ -130,6 +130,56 @@ static inline int au1xxx_cpu_needs_config_od(void)
        return 0;
 }
 
+#define ALCHEMY_CPU_UNKNOWN    -1
+#define ALCHEMY_CPU_AU1000     0
+#define ALCHEMY_CPU_AU1500     1
+#define ALCHEMY_CPU_AU1100     2
+#define ALCHEMY_CPU_AU1550     3
+#define ALCHEMY_CPU_AU1200     4
+
+static inline int alchemy_get_cputype(void)
+{
+       switch (read_c0_prid() & 0xffff0000) {
+       case 0x00030000:
+               return ALCHEMY_CPU_AU1000;
+               break;
+       case 0x01030000:
+               return ALCHEMY_CPU_AU1500;
+               break;
+       case 0x02030000:
+               return ALCHEMY_CPU_AU1100;
+               break;
+       case 0x03030000:
+               return ALCHEMY_CPU_AU1550;
+               break;
+       case 0x04030000:
+       case 0x05030000:
+               return ALCHEMY_CPU_AU1200;
+               break;
+       }
+
+       return ALCHEMY_CPU_UNKNOWN;
+}
+
+static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
+{
+       void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
+       int timeout, i;
+
+       /* check LSR TX_EMPTY bit */
+       timeout = 0xffffff;
+       do {
+               if (__raw_readl(base + 0x1c) & 0x20)
+                       break;
+               /* slow down */
+               for (i = 10000; i; i--)
+                       asm volatile ("nop");
+       } while (--timeout);
+
+       __raw_writel(c, base + 0x04);   /* tx */
+       wmb();
+}
+
 /* arch/mips/au1000/common/clocks.c */
 extern void set_au1x00_speed(unsigned int new_freq);
 extern unsigned int get_au1x00_speed(void);
@@ -143,20 +193,332 @@ void au_sleep(void);
 void save_au1xxx_intctl(void);
 void restore_au1xxx_intctl(void);
 
-/*
- * Every board describes its IRQ mapping with this table.
- */
-struct au1xxx_irqmap {
-       int     im_irq;
-       int     im_type;
-       int     im_request;
+
+/* SOC Interrupt numbers */
+
+#define AU1000_INTC0_INT_BASE  (MIPS_CPU_IRQ_BASE + 8)
+#define AU1000_INTC0_INT_LAST  (AU1000_INTC0_INT_BASE + 31)
+#define AU1000_INTC1_INT_BASE  (AU1000_INTC0_INT_LAST + 1)
+#define AU1000_INTC1_INT_LAST  (AU1000_INTC1_INT_BASE + 31)
+#define AU1000_MAX_INTR        AU1000_INTC1_INT_LAST
+
+enum soc_au1000_ints {
+       AU1000_FIRST_INT        = AU1000_INTC0_INT_BASE,
+       AU1000_UART0_INT        = AU1000_FIRST_INT,
+       AU1000_UART1_INT,
+       AU1000_UART2_INT,
+       AU1000_UART3_INT,
+       AU1000_SSI0_INT,
+       AU1000_SSI1_INT,
+       AU1000_DMA_INT_BASE,
+
+       AU1000_TOY_INT          = AU1000_FIRST_INT + 14,
+       AU1000_TOY_MATCH0_INT,
+       AU1000_TOY_MATCH1_INT,
+       AU1000_TOY_MATCH2_INT,
+       AU1000_RTC_INT,
+       AU1000_RTC_MATCH0_INT,
+       AU1000_RTC_MATCH1_INT,
+       AU1000_RTC_MATCH2_INT,
+       AU1000_IRDA_TX_INT,
+       AU1000_IRDA_RX_INT,
+       AU1000_USB_DEV_REQ_INT,
+       AU1000_USB_DEV_SUS_INT,
+       AU1000_USB_HOST_INT,
+       AU1000_ACSYNC_INT,
+       AU1000_MAC0_DMA_INT,
+       AU1000_MAC1_DMA_INT,
+       AU1000_I2S_UO_INT,
+       AU1000_AC97C_INT,
+       AU1000_GPIO0_INT,
+       AU1000_GPIO1_INT,
+       AU1000_GPIO2_INT,
+       AU1000_GPIO3_INT,
+       AU1000_GPIO4_INT,
+       AU1000_GPIO5_INT,
+       AU1000_GPIO6_INT,
+       AU1000_GPIO7_INT,
+       AU1000_GPIO8_INT,
+       AU1000_GPIO9_INT,
+       AU1000_GPIO10_INT,
+       AU1000_GPIO11_INT,
+       AU1000_GPIO12_INT,
+       AU1000_GPIO13_INT,
+       AU1000_GPIO14_INT,
+       AU1000_GPIO15_INT,
+       AU1000_GPIO16_INT,
+       AU1000_GPIO17_INT,
+       AU1000_GPIO18_INT,
+       AU1000_GPIO19_INT,
+       AU1000_GPIO20_INT,
+       AU1000_GPIO21_INT,
+       AU1000_GPIO22_INT,
+       AU1000_GPIO23_INT,
+       AU1000_GPIO24_INT,
+       AU1000_GPIO25_INT,
+       AU1000_GPIO26_INT,
+       AU1000_GPIO27_INT,
+       AU1000_GPIO28_INT,
+       AU1000_GPIO29_INT,
+       AU1000_GPIO30_INT,
+       AU1000_GPIO31_INT,
 };
 
-/* core calls this function to let boards initialize other IRQ sources */
-void board_init_irq(void);
+enum soc_au1100_ints {
+       AU1100_FIRST_INT        = AU1000_INTC0_INT_BASE,
+       AU1100_UART0_INT        = AU1100_FIRST_INT,
+       AU1100_UART1_INT,
+       AU1100_SD_INT,
+       AU1100_UART3_INT,
+       AU1100_SSI0_INT,
+       AU1100_SSI1_INT,
+       AU1100_DMA_INT_BASE,
+
+       AU1100_TOY_INT          = AU1100_FIRST_INT + 14,
+       AU1100_TOY_MATCH0_INT,
+       AU1100_TOY_MATCH1_INT,
+       AU1100_TOY_MATCH2_INT,
+       AU1100_RTC_INT,
+       AU1100_RTC_MATCH0_INT,
+       AU1100_RTC_MATCH1_INT,
+       AU1100_RTC_MATCH2_INT,
+       AU1100_IRDA_TX_INT,
+       AU1100_IRDA_RX_INT,
+       AU1100_USB_DEV_REQ_INT,
+       AU1100_USB_DEV_SUS_INT,
+       AU1100_USB_HOST_INT,
+       AU1100_ACSYNC_INT,
+       AU1100_MAC0_DMA_INT,
+       AU1100_GPIO208_215_INT,
+       AU1100_LCD_INT,
+       AU1100_AC97C_INT,
+       AU1100_GPIO0_INT,
+       AU1100_GPIO1_INT,
+       AU1100_GPIO2_INT,
+       AU1100_GPIO3_INT,
+       AU1100_GPIO4_INT,
+       AU1100_GPIO5_INT,
+       AU1100_GPIO6_INT,
+       AU1100_GPIO7_INT,
+       AU1100_GPIO8_INT,
+       AU1100_GPIO9_INT,
+       AU1100_GPIO10_INT,
+       AU1100_GPIO11_INT,
+       AU1100_GPIO12_INT,
+       AU1100_GPIO13_INT,
+       AU1100_GPIO14_INT,
+       AU1100_GPIO15_INT,
+       AU1100_GPIO16_INT,
+       AU1100_GPIO17_INT,
+       AU1100_GPIO18_INT,
+       AU1100_GPIO19_INT,
+       AU1100_GPIO20_INT,
+       AU1100_GPIO21_INT,
+       AU1100_GPIO22_INT,
+       AU1100_GPIO23_INT,
+       AU1100_GPIO24_INT,
+       AU1100_GPIO25_INT,
+       AU1100_GPIO26_INT,
+       AU1100_GPIO27_INT,
+       AU1100_GPIO28_INT,
+       AU1100_GPIO29_INT,
+       AU1100_GPIO30_INT,
+       AU1100_GPIO31_INT,
+};
 
-/* boards call this to register additional (GPIO) interrupts */
-void au1xxx_setup_irqmap(struct au1xxx_irqmap *map, int count);
+enum soc_au1500_ints {
+       AU1500_FIRST_INT        = AU1000_INTC0_INT_BASE,
+       AU1500_UART0_INT        = AU1500_FIRST_INT,
+       AU1500_PCI_INTA,
+       AU1500_PCI_INTB,
+       AU1500_UART3_INT,
+       AU1500_PCI_INTC,
+       AU1500_PCI_INTD,
+       AU1500_DMA_INT_BASE,
+
+       AU1500_TOY_INT          = AU1500_FIRST_INT + 14,
+       AU1500_TOY_MATCH0_INT,
+       AU1500_TOY_MATCH1_INT,
+       AU1500_TOY_MATCH2_INT,
+       AU1500_RTC_INT,
+       AU1500_RTC_MATCH0_INT,
+       AU1500_RTC_MATCH1_INT,
+       AU1500_RTC_MATCH2_INT,
+       AU1500_PCI_ERR_INT,
+       AU1500_RESERVED_INT,
+       AU1500_USB_DEV_REQ_INT,
+       AU1500_USB_DEV_SUS_INT,
+       AU1500_USB_HOST_INT,
+       AU1500_ACSYNC_INT,
+       AU1500_MAC0_DMA_INT,
+       AU1500_MAC1_DMA_INT,
+       AU1500_AC97C_INT        = AU1500_FIRST_INT + 31,
+       AU1500_GPIO0_INT,
+       AU1500_GPIO1_INT,
+       AU1500_GPIO2_INT,
+       AU1500_GPIO3_INT,
+       AU1500_GPIO4_INT,
+       AU1500_GPIO5_INT,
+       AU1500_GPIO6_INT,
+       AU1500_GPIO7_INT,
+       AU1500_GPIO8_INT,
+       AU1500_GPIO9_INT,
+       AU1500_GPIO10_INT,
+       AU1500_GPIO11_INT,
+       AU1500_GPIO12_INT,
+       AU1500_GPIO13_INT,
+       AU1500_GPIO14_INT,
+       AU1500_GPIO15_INT,
+       AU1500_GPIO200_INT,
+       AU1500_GPIO201_INT,
+       AU1500_GPIO202_INT,
+       AU1500_GPIO203_INT,
+       AU1500_GPIO20_INT,
+       AU1500_GPIO204_INT,
+       AU1500_GPIO205_INT,
+       AU1500_GPIO23_INT,
+       AU1500_GPIO24_INT,
+       AU1500_GPIO25_INT,
+       AU1500_GPIO26_INT,
+       AU1500_GPIO27_INT,
+       AU1500_GPIO28_INT,
+       AU1500_GPIO206_INT,
+       AU1500_GPIO207_INT,
+       AU1500_GPIO208_215_INT,
+};
+
+enum soc_au1550_ints {
+       AU1550_FIRST_INT        = AU1000_INTC0_INT_BASE,
+       AU1550_UART0_INT        = AU1550_FIRST_INT,
+       AU1550_PCI_INTA,
+       AU1550_PCI_INTB,
+       AU1550_DDMA_INT,
+       AU1550_CRYPTO_INT,
+       AU1550_PCI_INTC,
+       AU1550_PCI_INTD,
+       AU1550_PCI_RST_INT,
+       AU1550_UART1_INT,
+       AU1550_UART3_INT,
+       AU1550_PSC0_INT,
+       AU1550_PSC1_INT,
+       AU1550_PSC2_INT,
+       AU1550_PSC3_INT,
+       AU1550_TOY_INT,
+       AU1550_TOY_MATCH0_INT,
+       AU1550_TOY_MATCH1_INT,
+       AU1550_TOY_MATCH2_INT,
+       AU1550_RTC_INT,
+       AU1550_RTC_MATCH0_INT,
+       AU1550_RTC_MATCH1_INT,
+       AU1550_RTC_MATCH2_INT,
+
+       AU1550_NAND_INT         = AU1550_FIRST_INT + 23,
+       AU1550_USB_DEV_REQ_INT,
+       AU1550_USB_DEV_SUS_INT,
+       AU1550_USB_HOST_INT,
+       AU1550_MAC0_DMA_INT,
+       AU1550_MAC1_DMA_INT,
+       AU1550_GPIO0_INT        = AU1550_FIRST_INT + 32,
+       AU1550_GPIO1_INT,
+       AU1550_GPIO2_INT,
+       AU1550_GPIO3_INT,
+       AU1550_GPIO4_INT,
+       AU1550_GPIO5_INT,
+       AU1550_GPIO6_INT,
+       AU1550_GPIO7_INT,
+       AU1550_GPIO8_INT,
+       AU1550_GPIO9_INT,
+       AU1550_GPIO10_INT,
+       AU1550_GPIO11_INT,
+       AU1550_GPIO12_INT,
+       AU1550_GPIO13_INT,
+       AU1550_GPIO14_INT,
+       AU1550_GPIO15_INT,
+       AU1550_GPIO200_INT,
+       AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
+       AU1550_GPIO16_INT,
+       AU1550_GPIO17_INT,
+       AU1550_GPIO20_INT,
+       AU1550_GPIO21_INT,
+       AU1550_GPIO22_INT,
+       AU1550_GPIO23_INT,
+       AU1550_GPIO24_INT,
+       AU1550_GPIO25_INT,
+       AU1550_GPIO26_INT,
+       AU1550_GPIO27_INT,
+       AU1550_GPIO28_INT,
+       AU1550_GPIO206_INT,
+       AU1550_GPIO207_INT,
+       AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
+};
+
+enum soc_au1200_ints {
+       AU1200_FIRST_INT        = AU1000_INTC0_INT_BASE,
+       AU1200_UART0_INT        = AU1200_FIRST_INT,
+       AU1200_SWT_INT,
+       AU1200_SD_INT,
+       AU1200_DDMA_INT,
+       AU1200_MAE_BE_INT,
+       AU1200_GPIO200_INT,
+       AU1200_GPIO201_INT,
+       AU1200_GPIO202_INT,
+       AU1200_UART1_INT,
+       AU1200_MAE_FE_INT,
+       AU1200_PSC0_INT,
+       AU1200_PSC1_INT,
+       AU1200_AES_INT,
+       AU1200_CAMERA_INT,
+       AU1200_TOY_INT,
+       AU1200_TOY_MATCH0_INT,
+       AU1200_TOY_MATCH1_INT,
+       AU1200_TOY_MATCH2_INT,
+       AU1200_RTC_INT,
+       AU1200_RTC_MATCH0_INT,
+       AU1200_RTC_MATCH1_INT,
+       AU1200_RTC_MATCH2_INT,
+       AU1200_GPIO203_INT,
+       AU1200_NAND_INT,
+       AU1200_GPIO204_INT,
+       AU1200_GPIO205_INT,
+       AU1200_GPIO206_INT,
+       AU1200_GPIO207_INT,
+       AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
+       AU1200_USB_INT,
+       AU1200_LCD_INT,
+       AU1200_MAE_BOTH_INT,
+       AU1200_GPIO0_INT,
+       AU1200_GPIO1_INT,
+       AU1200_GPIO2_INT,
+       AU1200_GPIO3_INT,
+       AU1200_GPIO4_INT,
+       AU1200_GPIO5_INT,
+       AU1200_GPIO6_INT,
+       AU1200_GPIO7_INT,
+       AU1200_GPIO8_INT,
+       AU1200_GPIO9_INT,
+       AU1200_GPIO10_INT,
+       AU1200_GPIO11_INT,
+       AU1200_GPIO12_INT,
+       AU1200_GPIO13_INT,
+       AU1200_GPIO14_INT,
+       AU1200_GPIO15_INT,
+       AU1200_GPIO16_INT,
+       AU1200_GPIO17_INT,
+       AU1200_GPIO18_INT,
+       AU1200_GPIO19_INT,
+       AU1200_GPIO20_INT,
+       AU1200_GPIO21_INT,
+       AU1200_GPIO22_INT,
+       AU1200_GPIO23_INT,
+       AU1200_GPIO24_INT,
+       AU1200_GPIO25_INT,
+       AU1200_GPIO26_INT,
+       AU1200_GPIO27_INT,
+       AU1200_GPIO28_INT,
+       AU1200_GPIO29_INT,
+       AU1200_GPIO30_INT,
+       AU1200_GPIO31_INT,
+};
 
 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
 
@@ -549,78 +911,16 @@ void au1xxx_setup_irqmap(struct au1xxx_irqmap *map, int count);
 
 #define IC1_TESTBIT            0xB1800080
 
-/* Interrupt Numbers */
+
 /* Au1000 */
 #ifdef CONFIG_SOC_AU1000
-enum soc_au1000_ints {
-       AU1000_FIRST_INT        = MIPS_CPU_IRQ_BASE + 8,
-       AU1000_UART0_INT        = AU1000_FIRST_INT,
-       AU1000_UART1_INT,                               /* au1000 */
-       AU1000_UART2_INT,                               /* au1000 */
-       AU1000_UART3_INT,
-       AU1000_SSI0_INT,                                /* au1000 */
-       AU1000_SSI1_INT,                                /* au1000 */
-       AU1000_DMA_INT_BASE,
-
-       AU1000_TOY_INT          = AU1000_FIRST_INT + 14,
-       AU1000_TOY_MATCH0_INT,
-       AU1000_TOY_MATCH1_INT,
-       AU1000_TOY_MATCH2_INT,
-       AU1000_RTC_INT,
-       AU1000_RTC_MATCH0_INT,
-       AU1000_RTC_MATCH1_INT,
-       AU1000_RTC_MATCH2_INT,
-       AU1000_IRDA_TX_INT,                             /* au1000 */
-       AU1000_IRDA_RX_INT,                             /* au1000 */
-       AU1000_USB_DEV_REQ_INT,
-       AU1000_USB_DEV_SUS_INT,
-       AU1000_USB_HOST_INT,
-       AU1000_ACSYNC_INT,
-       AU1000_MAC0_DMA_INT,
-       AU1000_MAC1_DMA_INT,
-       AU1000_I2S_UO_INT,                              /* au1000 */
-       AU1000_AC97C_INT,
-       AU1000_GPIO_0,
-       AU1000_GPIO_1,
-       AU1000_GPIO_2,
-       AU1000_GPIO_3,
-       AU1000_GPIO_4,
-       AU1000_GPIO_5,
-       AU1000_GPIO_6,
-       AU1000_GPIO_7,
-       AU1000_GPIO_8,
-       AU1000_GPIO_9,
-       AU1000_GPIO_10,
-       AU1000_GPIO_11,
-       AU1000_GPIO_12,
-       AU1000_GPIO_13,
-       AU1000_GPIO_14,
-       AU1000_GPIO_15,
-       AU1000_GPIO_16,
-       AU1000_GPIO_17,
-       AU1000_GPIO_18,
-       AU1000_GPIO_19,
-       AU1000_GPIO_20,
-       AU1000_GPIO_21,
-       AU1000_GPIO_22,
-       AU1000_GPIO_23,
-       AU1000_GPIO_24,
-       AU1000_GPIO_25,
-       AU1000_GPIO_26,
-       AU1000_GPIO_27,
-       AU1000_GPIO_28,
-       AU1000_GPIO_29,
-       AU1000_GPIO_30,
-       AU1000_GPIO_31,
-};
 
 #define UART0_ADDR             0xB1100000
-#define UART1_ADDR             0xB1200000
-#define UART2_ADDR             0xB1300000
 #define UART3_ADDR             0xB1400000
 
 #define USB_OHCI_BASE          0x10100000      /* phys addr for ioremap */
 #define USB_HOST_CONFIG        0xB017FFFC
+#define FOR_PLATFORM_C_USB_HOST_INT AU1000_USB_HOST_INT
 
 #define AU1000_ETH0_BASE       0xB0500000
 #define AU1000_ETH1_BASE       0xB0510000
@@ -631,78 +931,13 @@ enum soc_au1000_ints {
 
 /* Au1500 */
 #ifdef CONFIG_SOC_AU1500
-enum soc_au1500_ints {
-       AU1500_FIRST_INT        = MIPS_CPU_IRQ_BASE + 8,
-       AU1500_UART0_INT        = AU1500_FIRST_INT,
-       AU1000_PCI_INTA,                                /* au1500 */
-       AU1000_PCI_INTB,                                /* au1500 */
-       AU1500_UART3_INT,
-       AU1000_PCI_INTC,                                /* au1500 */
-       AU1000_PCI_INTD,                                /* au1500 */
-       AU1000_DMA_INT_BASE,
-
-       AU1000_TOY_INT          = AU1500_FIRST_INT + 14,
-       AU1000_TOY_MATCH0_INT,
-       AU1000_TOY_MATCH1_INT,
-       AU1000_TOY_MATCH2_INT,
-       AU1000_RTC_INT,
-       AU1000_RTC_MATCH0_INT,
-       AU1000_RTC_MATCH1_INT,
-       AU1000_RTC_MATCH2_INT,
-       AU1500_PCI_ERR_INT,
-       AU1500_RESERVED_INT,
-       AU1000_USB_DEV_REQ_INT,
-       AU1000_USB_DEV_SUS_INT,
-       AU1000_USB_HOST_INT,
-       AU1000_ACSYNC_INT,
-       AU1500_MAC0_DMA_INT,
-       AU1500_MAC1_DMA_INT,
-       AU1000_AC97C_INT        = AU1500_FIRST_INT + 31,
-       AU1000_GPIO_0,
-       AU1000_GPIO_1,
-       AU1000_GPIO_2,
-       AU1000_GPIO_3,
-       AU1000_GPIO_4,
-       AU1000_GPIO_5,
-       AU1000_GPIO_6,
-       AU1000_GPIO_7,
-       AU1000_GPIO_8,
-       AU1000_GPIO_9,
-       AU1000_GPIO_10,
-       AU1000_GPIO_11,
-       AU1000_GPIO_12,
-       AU1000_GPIO_13,
-       AU1000_GPIO_14,
-       AU1000_GPIO_15,
-       AU1500_GPIO_200,
-       AU1500_GPIO_201,
-       AU1500_GPIO_202,
-       AU1500_GPIO_203,
-       AU1500_GPIO_20,
-       AU1500_GPIO_204,
-       AU1500_GPIO_205,
-       AU1500_GPIO_23,
-       AU1500_GPIO_24,
-       AU1500_GPIO_25,
-       AU1500_GPIO_26,
-       AU1500_GPIO_27,
-       AU1500_GPIO_28,
-       AU1500_GPIO_206,
-       AU1500_GPIO_207,
-       AU1500_GPIO_208_215,
-};
-
-/* shortcuts */
-#define INTA AU1000_PCI_INTA
-#define INTB AU1000_PCI_INTB
-#define INTC AU1000_PCI_INTC
-#define INTD AU1000_PCI_INTD
 
 #define UART0_ADDR             0xB1100000
 #define UART3_ADDR             0xB1400000
 
 #define USB_OHCI_BASE          0x10100000      /* phys addr for ioremap */
 #define USB_HOST_CONFIG        0xB017fffc
+#define FOR_PLATFORM_C_USB_HOST_INT AU1500_USB_HOST_INT
 
 #define AU1500_ETH0_BASE       0xB1500000
 #define AU1500_ETH1_BASE       0xB1510000
@@ -713,74 +948,13 @@ enum soc_au1500_ints {
 
 /* Au1100 */
 #ifdef CONFIG_SOC_AU1100
-enum soc_au1100_ints {
-       AU1100_FIRST_INT        = MIPS_CPU_IRQ_BASE + 8,
-       AU1100_UART0_INT        = AU1100_FIRST_INT,
-       AU1100_UART1_INT,
-       AU1100_SD_INT,
-       AU1100_UART3_INT,
-       AU1000_SSI0_INT,
-       AU1000_SSI1_INT,
-       AU1000_DMA_INT_BASE,
-
-       AU1000_TOY_INT          = AU1100_FIRST_INT + 14,
-       AU1000_TOY_MATCH0_INT,
-       AU1000_TOY_MATCH1_INT,
-       AU1000_TOY_MATCH2_INT,
-       AU1000_RTC_INT,
-       AU1000_RTC_MATCH0_INT,
-       AU1000_RTC_MATCH1_INT,
-       AU1000_RTC_MATCH2_INT,
-       AU1000_IRDA_TX_INT,
-       AU1000_IRDA_RX_INT,
-       AU1000_USB_DEV_REQ_INT,
-       AU1000_USB_DEV_SUS_INT,
-       AU1000_USB_HOST_INT,
-       AU1000_ACSYNC_INT,
-       AU1100_MAC0_DMA_INT,
-       AU1100_GPIO_208_215,
-       AU1100_LCD_INT,
-       AU1000_AC97C_INT,
-       AU1000_GPIO_0,
-       AU1000_GPIO_1,
-       AU1000_GPIO_2,
-       AU1000_GPIO_3,
-       AU1000_GPIO_4,
-       AU1000_GPIO_5,
-       AU1000_GPIO_6,
-       AU1000_GPIO_7,
-       AU1000_GPIO_8,
-       AU1000_GPIO_9,
-       AU1000_GPIO_10,
-       AU1000_GPIO_11,
-       AU1000_GPIO_12,
-       AU1000_GPIO_13,
-       AU1000_GPIO_14,
-       AU1000_GPIO_15,
-       AU1000_GPIO_16,
-       AU1000_GPIO_17,
-       AU1000_GPIO_18,
-       AU1000_GPIO_19,
-       AU1000_GPIO_20,
-       AU1000_GPIO_21,
-       AU1000_GPIO_22,
-       AU1000_GPIO_23,
-       AU1000_GPIO_24,
-       AU1000_GPIO_25,
-       AU1000_GPIO_26,
-       AU1000_GPIO_27,
-       AU1000_GPIO_28,
-       AU1000_GPIO_29,
-       AU1000_GPIO_30,
-       AU1000_GPIO_31,
-};
 
 #define UART0_ADDR             0xB1100000
-#define UART1_ADDR             0xB1200000
 #define UART3_ADDR             0xB1400000
 
 #define USB_OHCI_BASE          0x10100000      /* phys addr for ioremap */
 #define USB_HOST_CONFIG        0xB017FFFC
+#define FOR_PLATFORM_C_USB_HOST_INT AU1100_USB_HOST_INT
 
 #define AU1100_ETH0_BASE       0xB0500000
 #define AU1100_MAC0_ENABLE     0xB0520000
@@ -788,87 +962,12 @@ enum soc_au1100_ints {
 #endif /* CONFIG_SOC_AU1100 */
 
 #ifdef CONFIG_SOC_AU1550
-enum soc_au1550_ints {
-       AU1550_FIRST_INT        = MIPS_CPU_IRQ_BASE + 8,
-       AU1550_UART0_INT        = AU1550_FIRST_INT,
-       AU1550_PCI_INTA,
-       AU1550_PCI_INTB,
-       AU1550_DDMA_INT,
-       AU1550_CRYPTO_INT,
-       AU1550_PCI_INTC,
-       AU1550_PCI_INTD,
-       AU1550_PCI_RST_INT,
-       AU1550_UART1_INT,
-       AU1550_UART3_INT,
-       AU1550_PSC0_INT,
-       AU1550_PSC1_INT,
-       AU1550_PSC2_INT,
-       AU1550_PSC3_INT,
-       AU1000_TOY_INT,
-       AU1000_TOY_MATCH0_INT,
-       AU1000_TOY_MATCH1_INT,
-       AU1000_TOY_MATCH2_INT,
-       AU1000_RTC_INT,
-       AU1000_RTC_MATCH0_INT,
-       AU1000_RTC_MATCH1_INT,
-       AU1000_RTC_MATCH2_INT,
-
-       AU1550_NAND_INT                 = AU1550_FIRST_INT + 23,
-       AU1550_USB_DEV_REQ_INT,
-       AU1000_USB_DEV_REQ_INT          = AU1550_USB_DEV_REQ_INT,
-       AU1550_USB_DEV_SUS_INT,
-       AU1000_USB_DEV_SUS_INT          = AU1550_USB_DEV_SUS_INT,
-       AU1550_USB_HOST_INT,
-       AU1000_USB_HOST_INT             = AU1550_USB_HOST_INT,
-       AU1550_MAC0_DMA_INT,
-       AU1550_MAC1_DMA_INT,
-       AU1000_GPIO_0                   = AU1550_FIRST_INT + 32,
-       AU1000_GPIO_1,
-       AU1000_GPIO_2,
-       AU1000_GPIO_3,
-       AU1000_GPIO_4,
-       AU1000_GPIO_5,
-       AU1000_GPIO_6,
-       AU1000_GPIO_7,
-       AU1000_GPIO_8,
-       AU1000_GPIO_9,
-       AU1000_GPIO_10,
-       AU1000_GPIO_11,
-       AU1000_GPIO_12,
-       AU1000_GPIO_13,
-       AU1000_GPIO_14,
-       AU1000_GPIO_15,
-       AU1550_GPIO_200,
-       AU1500_GPIO_201_205,                    /* Logical or of GPIO201:205 */
-       AU1500_GPIO_16,
-       AU1500_GPIO_17,
-       AU1500_GPIO_20,
-       AU1500_GPIO_21,
-       AU1500_GPIO_22,
-       AU1500_GPIO_23,
-       AU1500_GPIO_24,
-       AU1500_GPIO_25,
-       AU1500_GPIO_26,
-       AU1500_GPIO_27,
-       AU1500_GPIO_28,
-       AU1500_GPIO_206,
-       AU1500_GPIO_207,
-       AU1500_GPIO_208_218,                    /* Logical or of GPIO208:218 */
-};
-
-/* shortcuts */
-#define INTA AU1550_PCI_INTA
-#define INTB AU1550_PCI_INTB
-#define INTC AU1550_PCI_INTC
-#define INTD AU1550_PCI_INTD
-
 #define UART0_ADDR             0xB1100000
-#define UART1_ADDR             0xB1200000
-#define UART3_ADDR             0xB1400000
 
 #define USB_OHCI_BASE          0x14020000      /* phys addr for ioremap */
 #define USB_OHCI_LEN           0x00060000
 #define USB_HOST_CONFIG        0xB4027ffc
+#define FOR_PLATFORM_C_USB_HOST_INT AU1550_USB_HOST_INT
 
 #define AU1550_ETH0_BASE       0xB0500000
 #define AU1550_ETH1_BASE       0xB0510000
@@ -877,78 +976,10 @@ enum soc_au1550_ints {
 #define NUM_ETH_INTERFACES 2
 #endif /* CONFIG_SOC_AU1550 */
 
+
 #ifdef CONFIG_SOC_AU1200
-enum soc_au1200_ints {
-       AU1200_FIRST_INT        = MIPS_CPU_IRQ_BASE + 8,
-       AU1200_UART0_INT        = AU1200_FIRST_INT,
-       AU1200_SWT_INT,
-       AU1200_SD_INT,
-       AU1200_DDMA_INT,
-       AU1200_MAE_BE_INT,
-       AU1200_GPIO_200,
-       AU1200_GPIO_201,
-       AU1200_GPIO_202,
-       AU1200_UART1_INT,
-       AU1200_MAE_FE_INT,
-       AU1200_PSC0_INT,
-       AU1200_PSC1_INT,
-       AU1200_AES_INT,
-       AU1200_CAMERA_INT,
-       AU1000_TOY_INT,
-       AU1000_TOY_MATCH0_INT,
-       AU1000_TOY_MATCH1_INT,
-       AU1000_TOY_MATCH2_INT,
-       AU1000_RTC_INT,
-       AU1000_RTC_MATCH0_INT,
-       AU1000_RTC_MATCH1_INT,
-       AU1000_RTC_MATCH2_INT,
-       AU1200_GPIO_203,
-       AU1200_NAND_INT,
-       AU1200_GPIO_204,
-       AU1200_GPIO_205,
-       AU1200_GPIO_206,
-       AU1200_GPIO_207,
-       AU1200_GPIO_208_215,                    /* Logical OR of 208:215 */
-       AU1200_USB_INT,
-       AU1000_USB_HOST_INT     = AU1200_USB_INT,
-       AU1200_LCD_INT,
-       AU1200_MAE_BOTH_INT,
-       AU1000_GPIO_0,
-       AU1000_GPIO_1,
-       AU1000_GPIO_2,
-       AU1000_GPIO_3,
-       AU1000_GPIO_4,
-       AU1000_GPIO_5,
-       AU1000_GPIO_6,
-       AU1000_GPIO_7,
-       AU1000_GPIO_8,
-       AU1000_GPIO_9,
-       AU1000_GPIO_10,
-       AU1000_GPIO_11,
-       AU1000_GPIO_12,
-       AU1000_GPIO_13,
-       AU1000_GPIO_14,
-       AU1000_GPIO_15,
-       AU1000_GPIO_16,
-       AU1000_GPIO_17,
-       AU1000_GPIO_18,
-       AU1000_GPIO_19,
-       AU1000_GPIO_20,
-       AU1000_GPIO_21,
-       AU1000_GPIO_22,
-       AU1000_GPIO_23,
-       AU1000_GPIO_24,
-       AU1000_GPIO_25,
-       AU1000_GPIO_26,
-       AU1000_GPIO_27,
-       AU1000_GPIO_28,
-       AU1000_GPIO_29,
-       AU1000_GPIO_30,
-       AU1000_GPIO_31,
-};
 
 #define UART0_ADDR             0xB1100000
-#define UART1_ADDR             0xB1200000
 
 #define USB_UOC_BASE           0x14020020
 #define USB_UOC_LEN            0x20
@@ -974,15 +1005,9 @@ enum soc_au1200_ints {
 #define USBMSRMCFG_RDCOMB      30
 #define USBMSRMCFG_PFEN        31
 
-#endif /* CONFIG_SOC_AU1200 */
-
-#define AU1000_INTC0_INT_BASE  (MIPS_CPU_IRQ_BASE + 8)
-#define AU1000_INTC0_INT_LAST  (AU1000_INTC0_INT_BASE + 31)
-#define AU1000_INTC1_INT_BASE  (AU1000_INTC0_INT_BASE + 32)
-#define AU1000_INTC1_INT_LAST  (AU1000_INTC1_INT_BASE + 31)
+#define FOR_PLATFORM_C_USB_HOST_INT AU1200_USB_INT
 
-#define AU1000_MAX_INTR        AU1000_INTC1_INT_LAST
-#define INTX                   0xFF                    /* not valid */
+#endif /* CONFIG_SOC_AU1200 */
 
 /* Programmable Counters 0 and 1 */
 #define SYS_BASE               0xB1900000
@@ -1231,14 +1256,6 @@ enum soc_au1200_ints {
 #define MAC_RX_BUFF3_STATUS    0x30
 #define MAC_RX_BUFF3_ADDR      0x34
 
-/* UARTS 0-3 */
-#define UART_BASE              UART0_ADDR
-#ifdef CONFIG_SOC_AU1200
-#define UART_DEBUG_BASE        UART1_ADDR
-#else
-#define UART_DEBUG_BASE        UART3_ADDR
-#endif
-
 #define UART_RX                0       /* Receive buffer */
 #define UART_TX                4       /* Transmit buffer */
 #define UART_IER       8       /* Interrupt Enable Register */
@@ -1251,84 +1268,6 @@ enum soc_au1200_ints {
 #define UART_CLK       0x28    /* Baud Rate Clock Divider */
 #define UART_MOD_CNTRL 0x100   /* Module Control */
 
-#define UART_FCR_ENABLE_FIFO   0x01 /* Enable the FIFO */
-#define UART_FCR_CLEAR_RCVR    0x02 /* Clear the RCVR FIFO */
-#define UART_FCR_CLEAR_XMIT    0x04 /* Clear the XMIT FIFO */
-#define UART_FCR_DMA_SELECT    0x08 /* For DMA applications */
-#define UART_FCR_TRIGGER_MASK  0xF0 /* Mask for the FIFO trigger range */
-#define UART_FCR_R_TRIGGER_1   0x00 /* Mask for receive trigger set at 1 */
-#define UART_FCR_R_TRIGGER_4   0x40 /* Mask for receive trigger set at 4 */
-#define UART_FCR_R_TRIGGER_8   0x80 /* Mask for receive trigger set at 8 */
-#define UART_FCR_R_TRIGGER_14   0xA0 /* Mask for receive trigger set at 14 */
-#define UART_FCR_T_TRIGGER_0   0x00 /* Mask for transmit trigger set at 0 */
-#define UART_FCR_T_TRIGGER_4   0x10 /* Mask for transmit trigger set at 4 */
-#define UART_FCR_T_TRIGGER_8    0x20 /* Mask for transmit trigger set at 8 */
-#define UART_FCR_T_TRIGGER_12  0x30 /* Mask for transmit trigger set at 12 */
-
-/*
- * These are the definitions for the Line Control Register
- */
-#define UART_LCR_SBC   0x40    /* Set break control */
-#define UART_LCR_SPAR  0x20    /* Stick parity (?) */
-#define UART_LCR_EPAR  0x10    /* Even parity select */
-#define UART_LCR_PARITY        0x08    /* Parity Enable */
-#define UART_LCR_STOP  0x04    /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
-#define UART_LCR_WLEN5  0x00   /* Wordlength: 5 bits */
-#define UART_LCR_WLEN6  0x01   /* Wordlength: 6 bits */
-#define UART_LCR_WLEN7  0x02   /* Wordlength: 7 bits */
-#define UART_LCR_WLEN8  0x03   /* Wordlength: 8 bits */
-
-/*
- * These are the definitions for the Line Status Register
- */
-#define UART_LSR_TEMT  0x40    /* Transmitter empty */
-#define UART_LSR_THRE  0x20    /* Transmit-hold-register empty */
-#define UART_LSR_BI    0x10    /* Break interrupt indicator */
-#define UART_LSR_FE    0x08    /* Frame error indicator */
-#define UART_LSR_PE    0x04    /* Parity error indicator */
-#define UART_LSR_OE    0x02    /* Overrun error indicator */
-#define UART_LSR_DR    0x01    /* Receiver data ready */
-
-/*
- * These are the definitions for the Interrupt Identification Register
- */
-#define UART_IIR_NO_INT        0x01    /* No interrupts pending */
-#define UART_IIR_ID    0x06    /* Mask for the interrupt ID */
-#define UART_IIR_MSI   0x00    /* Modem status interrupt */
-#define UART_IIR_THRI  0x02    /* Transmitter holding register empty */
-#define UART_IIR_RDI   0x04    /* Receiver data interrupt */
-#define UART_IIR_RLSI  0x06    /* Receiver line status interrupt */
-
-/*
- * These are the definitions for the Interrupt Enable Register
- */
-#define UART_IER_MSI   0x08    /* Enable Modem status interrupt */
-#define UART_IER_RLSI  0x04    /* Enable receiver line status interrupt */
-#define UART_IER_THRI  0x02    /* Enable Transmitter holding register int. */
-#define UART_IER_RDI   0x01    /* Enable receiver data interrupt */
-
-/*
- * These are the definitions for the Modem Control Register
- */
-#define UART_MCR_LOOP  0x10    /* Enable loopback test mode */
-#define UART_MCR_OUT2  0x08    /* Out2 complement */
-#define UART_MCR_OUT1  0x04    /* Out1 complement */
-#define UART_MCR_RTS   0x02    /* RTS complement */
-#define UART_MCR_DTR   0x01    /* DTR complement */
-
-/*
- * These are the definitions for the Modem Status Register
- */
-#define UART_MSR_DCD   0x80    /* Data Carrier Detect */
-#define UART_MSR_RI    0x40    /* Ring Indicator */
-#define UART_MSR_DSR   0x20    /* Data Set Ready */
-#define UART_MSR_CTS   0x10    /* Clear to Send */
-#define UART_MSR_DDCD  0x08    /* Delta DCD */
-#define UART_MSR_TERI  0x04    /* Trailing edge ring indicator */
-#define UART_MSR_DDSR  0x02    /* Delta DSR */
-#define UART_MSR_DCTS  0x01    /* Delta CTS */
-#define UART_MSR_ANY_DELTA 0x0F        /* Any of the delta bits! */
-
 /* SSIO */
 #define SSI0_STATUS            0xB1600000
 #  define SSI_STATUS_BF        (1 << 4)
@@ -1720,7 +1659,7 @@ enum soc_au1200_ints {
 #define IOPORT_RESOURCE_START  0x00001000      /* skip legacy probing */
 #define IOPORT_RESOURCE_END    0xffffffff
 #define IOMEM_RESOURCE_START   0x10000000
-#define IOMEM_RESOURCE_END     0xffffffff
+#define IOMEM_RESOURCE_END     0xfffffffffULL
 
 #else /* Au1000 and Au1100 and Au1200 */
 
@@ -1728,7 +1667,7 @@ enum soc_au1200_ints {
 #define IOPORT_RESOURCE_START  0x10000000
 #define IOPORT_RESOURCE_END    0xffffffff
 #define IOMEM_RESOURCE_START   0x10000000
-#define IOMEM_RESOURCE_END     0xffffffff
+#define IOMEM_RESOURCE_END     0xfffffffffULL
 
 #define PCI_IO_START   0
 #define PCI_IO_END     0
@@ -1739,53 +1678,4 @@ enum soc_au1200_ints {
 
 #endif
 
-#ifndef _LANGUAGE_ASSEMBLY
-typedef volatile struct {
-       /* 0x0000 */ u32 toytrim;
-       /* 0x0004 */ u32 toywrite;
-       /* 0x0008 */ u32 toymatch0;
-       /* 0x000C */ u32 toymatch1;
-       /* 0x0010 */ u32 toymatch2;
-       /* 0x0014 */ u32 cntrctrl;
-       /* 0x0018 */ u32 scratch0;
-       /* 0x001C */ u32 scratch1;
-       /* 0x0020 */ u32 freqctrl0;
-       /* 0x0024 */ u32 freqctrl1;
-       /* 0x0028 */ u32 clksrc;
-       /* 0x002C */ u32 pinfunc;
-       /* 0x0030 */ u32 reserved0;
-       /* 0x0034 */ u32 wakemsk;
-       /* 0x0038 */ u32 endian;
-       /* 0x003C */ u32 powerctrl;
-       /* 0x0040 */ u32 toyread;
-       /* 0x0044 */ u32 rtctrim;
-       /* 0x0048 */ u32 rtcwrite;
-       /* 0x004C */ u32 rtcmatch0;
-       /* 0x0050 */ u32 rtcmatch1;
-       /* 0x0054 */ u32 rtcmatch2;
-       /* 0x0058 */ u32 rtcread;
-       /* 0x005C */ u32 wakesrc;
-       /* 0x0060 */ u32 cpupll;
-       /* 0x0064 */ u32 auxpll;
-       /* 0x0068 */ u32 reserved1;
-       /* 0x006C */ u32 reserved2;
-       /* 0x0070 */ u32 reserved3;
-       /* 0x0074 */ u32 reserved4;
-       /* 0x0078 */ u32 slppwr;
-       /* 0x007C */ u32 sleep;
-       /* 0x0080 */ u32 reserved5[32];
-       /* 0x0100 */ u32 trioutrd;
-#define trioutclr trioutrd
-       /* 0x0104 */ u32 reserved6;
-       /* 0x0108 */ u32 outputrd;
-#define outputset outputrd
-       /* 0x010C */ u32 outputclr;
-       /* 0x0110 */ u32 pinstaterd;
-#define pininputen pinstaterd
-} AU1X00_SYS;
-
-static AU1X00_SYS * const sys = (AU1X00_SYS *)SYS_BASE;
-
-#endif
-
 #endif
index c35e209184907fd9f7bdab54bed0457aa36bcaa1..94000a3b6f0b7c7e07feab37f33a74c82c40d535 100644 (file)
@@ -46,6 +46,7 @@ struct au1xmmc_platform_data {
        int(*card_readonly)(void *mmc_host);
        void(*set_power)(void *mmc_host, int state);
        struct led_classdev *led;
+       unsigned long mask_host_caps;
 };
 
 #define SD0_BASE       0xB0600000
@@ -205,4 +206,3 @@ struct au1xmmc_platform_data {
 
 
 #endif /* __ASM_AU1100_MMC_H */
-
index 06f68f43800aef31adbcf9a1fced2e38b654bd94..8c6b1105ce0b80ca6caea79b81b8364bd50f4b58 100644 (file)
@@ -305,6 +305,7 @@ typedef struct dbdma_chan_config {
        dbdev_tab_t             *chan_dest;
        au1x_dma_chan_t         *chan_ptr;
        au1x_ddma_desc_t        *chan_desc_base;
+       u32                     cdb_membase; /* kmalloc base of above */
        au1x_ddma_desc_t        *get_ptr, *put_ptr, *cur_ptr;
        void                    *chan_callparam;
        void                    (*chan_callback)(int, void *);
@@ -338,8 +339,8 @@ u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
 u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
 
 /* Put buffers on source/destination descriptors. */
-u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags);
-u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags);
+u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags);
+u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags);
 
 /* Get a buffer from the destination descriptor. */
 u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
@@ -362,25 +363,6 @@ void au1xxx_dbdma_suspend(void);
 void au1xxx_dbdma_resume(void);
 #endif
 
-
-/*
- * Some compatibilty macros -- needed to make changes to API
- * without breaking existing drivers.
- */
-#define au1xxx_dbdma_put_source(chanid, buf, nbytes)                   \
-       _au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE)
-#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags)      \
-       _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags)
-#define put_source_flags(chanid, buf, nbytes, flags)                   \
-       au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags)
-
-#define au1xxx_dbdma_put_dest(chanid, buf, nbytes)                     \
-       _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE)
-#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags)        \
-       _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags)
-#define put_dest_flags(chanid, buf, nbytes, flags)                     \
-       au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags)
-
 /*
  *     Flags for the put_source/put_dest functions.
  */
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
new file mode 100644 (file)
index 0000000..bae9b75
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __AU1X00_ETH_DATA_H
+#define __AU1X00_ETH_DATA_H
+
+/* Platform specific PHY configuration passed to the MAC driver */
+struct au1000_eth_platform_data {
+       int phy_static_config;
+       int phy_search_highest_addr;
+       int phy1_search_mac0;
+       int phy_addr;
+       int phy_busid;
+       int phy_irq;
+};
+
+void __init au1xxx_override_eth_cfg(unsigned port,
+                       struct au1000_eth_platform_data *eth_data);
+
+#endif /* __AU1X00_ETH_DATA_H */
index 91595fa89034eb20991ef0723c09d55d6f6d6f8e..62d2f136d94115d1334ff726881b77fd6a6ae4fa 100644 (file)
@@ -35,15 +35,13 @@ static inline int au1000_gpio2_to_irq(int gpio)
        return -ENXIO;
 }
 
-#ifdef CONFIG_SOC_AU1000
 static inline int au1000_irq_to_gpio(int irq)
 {
-       if ((irq >= AU1000_GPIO_0) && (irq <= AU1000_GPIO_31))
-               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
+       if ((irq >= AU1000_GPIO0_INT) && (irq <= AU1000_GPIO31_INT))
+               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO0_INT) + 0;
 
        return -ENXIO;
 }
-#endif
 
 static inline int au1500_gpio1_to_irq(int gpio)
 {
@@ -71,27 +69,25 @@ static inline int au1500_gpio2_to_irq(int gpio)
        return -ENXIO;
 }
 
-#ifdef CONFIG_SOC_AU1500
 static inline int au1500_irq_to_gpio(int irq)
 {
        switch (irq) {
-       case AU1000_GPIO_0 ... AU1000_GPIO_15:
-       case AU1500_GPIO_20:
-       case AU1500_GPIO_23 ... AU1500_GPIO_28:
-               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
-       case AU1500_GPIO_200 ... AU1500_GPIO_203:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_200) + 0;
-       case AU1500_GPIO_204 ... AU1500_GPIO_205:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_204) + 4;
-       case AU1500_GPIO_206 ... AU1500_GPIO_207:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6;
-       case AU1500_GPIO_208_215:
+       case AU1500_GPIO0_INT ... AU1500_GPIO15_INT:
+       case AU1500_GPIO20_INT:
+       case AU1500_GPIO23_INT ... AU1500_GPIO28_INT:
+               return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO0_INT) + 0;
+       case AU1500_GPIO200_INT ... AU1500_GPIO203_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO200_INT) + 0;
+       case AU1500_GPIO204_INT ... AU1500_GPIO205_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO204_INT) + 4;
+       case AU1500_GPIO206_INT ... AU1500_GPIO207_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO206_INT) + 6;
+       case AU1500_GPIO208_215_INT:
                return ALCHEMY_GPIO2_BASE + 8;
        }
 
        return -ENXIO;
 }
-#endif
 
 static inline int au1100_gpio1_to_irq(int gpio)
 {
@@ -108,19 +104,17 @@ static inline int au1100_gpio2_to_irq(int gpio)
        return -ENXIO;
 }
 
-#ifdef CONFIG_SOC_AU1100
 static inline int au1100_irq_to_gpio(int irq)
 {
        switch (irq) {
-       case AU1000_GPIO_0 ... AU1000_GPIO_31:
-               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
-       case AU1100_GPIO_208_215:
+       case AU1100_GPIO0_INT ... AU1100_GPIO31_INT:
+               return ALCHEMY_GPIO1_BASE + (irq - AU1100_GPIO0_INT) + 0;
+       case AU1100_GPIO208_215_INT:
                return ALCHEMY_GPIO2_BASE + 8;
        }
 
        return -ENXIO;
 }
-#endif
 
 static inline int au1550_gpio1_to_irq(int gpio)
 {
@@ -149,24 +143,22 @@ static inline int au1550_gpio2_to_irq(int gpio)
        return -ENXIO;
 }
 
-#ifdef CONFIG_SOC_AU1550
 static inline int au1550_irq_to_gpio(int irq)
 {
        switch (irq) {
-       case AU1000_GPIO_0 ... AU1000_GPIO_15:
-               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
-       case AU1550_GPIO_200:
-       case AU1500_GPIO_201_205:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO_200) + 0;
-       case AU1500_GPIO_16 ... AU1500_GPIO_28:
-               return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO_16) + 16;
-       case AU1500_GPIO_206 ... AU1500_GPIO_208_218:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO_206) + 6;
+       case AU1550_GPIO0_INT ... AU1550_GPIO15_INT:
+               return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO0_INT) + 0;
+       case AU1550_GPIO200_INT:
+       case AU1550_GPIO201_205_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO200_INT) + 0;
+       case AU1550_GPIO16_INT ... AU1550_GPIO28_INT:
+               return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO16_INT) + 16;
+       case AU1550_GPIO206_INT ... AU1550_GPIO208_215_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO206_INT) + 6;
        }
 
        return -ENXIO;
 }
-#endif
 
 static inline int au1200_gpio1_to_irq(int gpio)
 {
@@ -187,23 +179,21 @@ static inline int au1200_gpio2_to_irq(int gpio)
        return -ENXIO;
 }
 
-#ifdef CONFIG_SOC_AU1200
 static inline int au1200_irq_to_gpio(int irq)
 {
        switch (irq) {
-       case AU1000_GPIO_0 ... AU1000_GPIO_31:
-               return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO_0) + 0;
-       case AU1200_GPIO_200 ... AU1200_GPIO_202:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_200) + 0;
-       case AU1200_GPIO_203:
+       case AU1200_GPIO0_INT ... AU1200_GPIO31_INT:
+               return ALCHEMY_GPIO1_BASE + (irq - AU1200_GPIO0_INT) + 0;
+       case AU1200_GPIO200_INT ... AU1200_GPIO202_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO200_INT) + 0;
+       case AU1200_GPIO203_INT:
                return ALCHEMY_GPIO2_BASE + 3;
-       case AU1200_GPIO_204 ... AU1200_GPIO_208_215:
-               return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO_204) + 4;
+       case AU1200_GPIO204_INT ... AU1200_GPIO208_215_INT:
+               return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO204_INT) + 4;
        }
 
        return -ENXIO;
 }
-#endif
 
 /*
  * GPIO1 block macros for common linux gpio functions.
@@ -246,19 +236,19 @@ static inline int alchemy_gpio1_is_valid(int gpio)
 
 static inline int alchemy_gpio1_to_irq(int gpio)
 {
-#if defined(CONFIG_SOC_AU1000)
-       return au1000_gpio1_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1100)
-       return au1100_gpio1_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1500)
-       return au1500_gpio1_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1550)
-       return au1550_gpio1_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1200)
-       return au1200_gpio1_to_irq(gpio);
-#else
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1000:
+               return au1000_gpio1_to_irq(gpio);
+       case ALCHEMY_CPU_AU1100:
+               return au1100_gpio1_to_irq(gpio);
+       case ALCHEMY_CPU_AU1500:
+               return au1500_gpio1_to_irq(gpio);
+       case ALCHEMY_CPU_AU1550:
+               return au1550_gpio1_to_irq(gpio);
+       case ALCHEMY_CPU_AU1200:
+               return au1200_gpio1_to_irq(gpio);
+       }
        return -ENXIO;
-#endif
 }
 
 /*
@@ -316,19 +306,19 @@ static inline int alchemy_gpio2_is_valid(int gpio)
 
 static inline int alchemy_gpio2_to_irq(int gpio)
 {
-#if defined(CONFIG_SOC_AU1000)
-       return au1000_gpio2_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1100)
-       return au1100_gpio2_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1500)
-       return au1500_gpio2_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1550)
-       return au1550_gpio2_to_irq(gpio);
-#elif defined(CONFIG_SOC_AU1200)
-       return au1200_gpio2_to_irq(gpio);
-#else
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1000:
+               return au1000_gpio2_to_irq(gpio);
+       case ALCHEMY_CPU_AU1100:
+               return au1100_gpio2_to_irq(gpio);
+       case ALCHEMY_CPU_AU1500:
+               return au1500_gpio2_to_irq(gpio);
+       case ALCHEMY_CPU_AU1550:
+               return au1550_gpio2_to_irq(gpio);
+       case ALCHEMY_CPU_AU1200:
+               return au1200_gpio2_to_irq(gpio);
+       }
        return -ENXIO;
-#endif
 }
 
 /**********************************************************************/
@@ -384,10 +374,13 @@ static inline void alchemy_gpio2_enable_int(int gpio2)
 
        gpio2 -= ALCHEMY_GPIO2_BASE;
 
-#if defined(CONFIG_SOC_AU1100) || defined(CONFIG_SOC_AU1500)
        /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
-       gpio2 -= 8;
-#endif
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1100:
+       case ALCHEMY_CPU_AU1500:
+               gpio2 -= 8;
+       }
+
        local_irq_save(flags);
        __alchemy_gpio2_mod_int(gpio2, 1);
        local_irq_restore(flags);
@@ -405,10 +398,13 @@ static inline void alchemy_gpio2_disable_int(int gpio2)
 
        gpio2 -= ALCHEMY_GPIO2_BASE;
 
-#if defined(CONFIG_SOC_AU1100) || defined(CONFIG_SOC_AU1500)
        /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
-       gpio2 -= 8;
-#endif
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1100:
+       case ALCHEMY_CPU_AU1500:
+               gpio2 -= 8;
+       }
+
        local_irq_save(flags);
        __alchemy_gpio2_mod_int(gpio2, 0);
        local_irq_restore(flags);
@@ -494,19 +490,19 @@ static inline int alchemy_gpio_to_irq(int gpio)
 
 static inline int alchemy_irq_to_gpio(int irq)
 {
-#if defined(CONFIG_SOC_AU1000)
-       return au1000_irq_to_gpio(irq);
-#elif defined(CONFIG_SOC_AU1100)
-       return au1100_irq_to_gpio(irq);
-#elif defined(CONFIG_SOC_AU1500)
-       return au1500_irq_to_gpio(irq);
-#elif defined(CONFIG_SOC_AU1550)
-       return au1550_irq_to_gpio(irq);
-#elif defined(CONFIG_SOC_AU1200)
-       return au1200_irq_to_gpio(irq);
-#else
+       switch (alchemy_get_cputype()) {
+       case ALCHEMY_CPU_AU1000:
+               return au1000_irq_to_gpio(irq);
+       case ALCHEMY_CPU_AU1100:
+               return au1100_irq_to_gpio(irq);
+       case ALCHEMY_CPU_AU1500:
+               return au1500_irq_to_gpio(irq);
+       case ALCHEMY_CPU_AU1550:
+               return au1550_irq_to_gpio(irq);
+       case ALCHEMY_CPU_AU1200:
+               return au1200_irq_to_gpio(irq);
+       }
        return -ENXIO;
-#endif
 }
 
 /**********************************************************************/
index f9b7d41c659a53da89dce10f9d26eee32aef8423..c3f60cdc320371e49d58461f6a20ce157ddfadf1 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _ALCHEMY_GPIO_H_
 #define _ALCHEMY_GPIO_H_
 
-#if defined(CONFIG_ALCHEMY_GPIO_AU1000)
+#if defined(CONFIG_ALCHEMY_GPIOINT_AU1000)
 
 #include <asm/mach-au1x00/gpio-au1000.h>
 
index 364cea2dc71fbaec28a061f41fca299109c49796..75a94ad3ac91db4db4446f0c217beba96836156c 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <linux/types.h>
 
-#ifdef CONFIG_64BIT_PHYS_ADDR
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_PCI)
 extern phys_t __fixup_bigphys_addr(phys_t, phys_t);
 #else
 static inline phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
index e38715577c51cd8486f7e8d328ceaeeb46b3bed4..4c0e09cf1735c58215e40b4a276687e35604c9d5 100644 (file)
@@ -6,7 +6,6 @@ extern char **prom_argv;
 extern char **prom_envp;
 
 extern void prom_init_cmdline(void);
-extern char *prom_getcmdline(void);
 extern char *prom_getenv(char *envname);
 extern int prom_get_ethernet_addr(char *ethernet_addr);
 
index ed4ccec87dd4c25c0b5b0b1ab06f049ce1879e53..85fd27509aac5732687910e04ac305e354056550 100644 (file)
 #define DMIPSPLLCFG_N2_MASK            (0x7 << DMIPSPLLCFG_N2_SHIFT)
 
 #endif /* BCM63XX_REGS_H_ */
-
index 425e708d4fb9726f1d48b5d0fa293044f074566b..bbf05404239565927c2f4bea282863cf4766b132 100644 (file)
@@ -58,6 +58,9 @@
 #define cpu_has_vint           0
 #define cpu_has_veic           0
 #define cpu_hwrena_impl_bits   0xc0000000
+
+#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS)
+
 #define ARCH_HAS_READ_CURRENT_TIMER 1
 #define ARCH_HAS_IRQ_PER_CPU   1
 #define ARCH_HAS_SPINLOCK_PREFETCH 1
diff --git a/arch/mips/include/asm/mach-db1x00/bcsr.h b/arch/mips/include/asm/mach-db1x00/bcsr.h
new file mode 100644 (file)
index 0000000..618d2de
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * bcsr.h -- Db1xxx/Pb1xxx Devboard CPLD registers ("BCSR") abstraction.
+ *
+ * All Alchemy development boards (except, of course, the weird PB1000)
+ * have a few registers in a CPLD with standardised layout; they mostly
+ * only differ in base address and bit meanings in the RESETS and BOARD
+ * registers.
+ *
+ * All data taken from the official AMD board documentation sheets.
+ */
+
+#ifndef _DB1XXX_BCSR_H_
+#define _DB1XXX_BCSR_H_
+
+
+/* BCSR base addresses on various boards. BCSR base 2 refers to the
+ * physical address of the first HEXLEDS register, which is usually
+ * a variable offset from the WHOAMI register.
+ */
+
+/* DB1000, DB1100, DB1500, PB1100, PB1500 */
+#define DB1000_BCSR_PHYS_ADDR  0x0E000000
+#define DB1000_BCSR_HEXLED_OFS 0x01000000
+
+#define DB1550_BCSR_PHYS_ADDR  0x0F000000
+#define DB1550_BCSR_HEXLED_OFS 0x00400000
+
+#define PB1550_BCSR_PHYS_ADDR  0x0F000000
+#define PB1550_BCSR_HEXLED_OFS 0x00800000
+
+#define DB1200_BCSR_PHYS_ADDR  0x19800000
+#define DB1200_BCSR_HEXLED_OFS 0x00400000
+
+#define PB1200_BCSR_PHYS_ADDR  0x0D800000
+#define PB1200_BCSR_HEXLED_OFS 0x00400000
+
+
+enum bcsr_id {
+       /* BCSR base 1 */
+       BCSR_WHOAMI     = 0,
+       BCSR_STATUS,
+       BCSR_SWITCHES,
+       BCSR_RESETS,
+       BCSR_PCMCIA,
+       BCSR_BOARD,
+       BCSR_LEDS,
+       BCSR_SYSTEM,
+       /* Au1200/1300 based boards */
+       BCSR_INTCLR,
+       BCSR_INTSET,
+       BCSR_MASKCLR,
+       BCSR_MASKSET,
+       BCSR_SIGSTAT,
+       BCSR_INTSTAT,
+
+       /* BCSR base 2 */
+       BCSR_HEXLEDS,
+       BCSR_RSVD1,
+       BCSR_HEXCLEAR,
+
+       BCSR_CNT,
+};
+
+/* register offsets, valid for all Db1xxx/Pb1xxx boards */
+#define BCSR_REG_WHOAMI                0x00
+#define BCSR_REG_STATUS                0x04
+#define BCSR_REG_SWITCHES      0x08
+#define BCSR_REG_RESETS                0x0c
+#define BCSR_REG_PCMCIA                0x10
+#define BCSR_REG_BOARD         0x14
+#define BCSR_REG_LEDS          0x18
+#define BCSR_REG_SYSTEM                0x1c
+/* Au1200/Au1300 based boards: CPLD IRQ muxer */
+#define BCSR_REG_INTCLR                0x20
+#define BCSR_REG_INTSET                0x24
+#define BCSR_REG_MASKCLR       0x28
+#define BCSR_REG_MASKSET       0x2c
+#define BCSR_REG_SIGSTAT       0x30
+#define BCSR_REG_INTSTAT       0x34
+
+/* hexled control, offset from BCSR base 2 */
+#define BCSR_REG_HEXLEDS       0x00
+#define BCSR_REG_HEXCLEAR      0x08
+
+/*
+ * Register Bits and Pieces.
+ */
+#define BCSR_WHOAMI_DCID(x)            ((x) & 0xf)
+#define BCSR_WHOAMI_CPLD(x)            (((x) >> 4) & 0xf)
+#define BCSR_WHOAMI_BOARD(x)           (((x) >> 8) & 0xf)
+
+/* register "WHOAMI" bits 11:8 identify the board */
+enum bcsr_whoami_boards {
+       BCSR_WHOAMI_PB1500 = 1,
+       BCSR_WHOAMI_PB1500R2,
+       BCSR_WHOAMI_PB1100,
+       BCSR_WHOAMI_DB1000,
+       BCSR_WHOAMI_DB1100,
+       BCSR_WHOAMI_DB1500,
+       BCSR_WHOAMI_DB1550,
+       BCSR_WHOAMI_PB1550_DDR,
+       BCSR_WHOAMI_PB1550 = BCSR_WHOAMI_PB1550_DDR,
+       BCSR_WHOAMI_PB1550_SDR,
+       BCSR_WHOAMI_PB1200_DDR1,
+       BCSR_WHOAMI_PB1200 = BCSR_WHOAMI_PB1200_DDR1,
+       BCSR_WHOAMI_PB1200_DDR2,
+       BCSR_WHOAMI_DB1200,
+};
+
+/* STATUS reg.  Unless otherwise noted, they're valid on all boards.
+ * PB1200 = DB1200.
+ */
+#define BCSR_STATUS_PC0VS              0x0003
+#define BCSR_STATUS_PC1VS              0x000C
+#define BCSR_STATUS_PC0FI              0x0010
+#define BCSR_STATUS_PC1FI              0x0020
+#define BCSR_STATUS_PB1550_SWAPBOOT    0x0040
+#define BCSR_STATUS_SRAMWIDTH          0x0080
+#define BCSR_STATUS_FLASHBUSY          0x0100
+#define BCSR_STATUS_ROMBUSY            0x0400
+#define BCSR_STATUS_SD0WP              0x0400  /* DB1200 */
+#define BCSR_STATUS_SD1WP              0x0800
+#define BCSR_STATUS_USBOTGID           0x0800  /* PB/DB1550 */
+#define BCSR_STATUS_DB1000_SWAPBOOT    0x2000
+#define BCSR_STATUS_DB1200_SWAPBOOT    0x0040  /* DB1200 */
+#define BCSR_STATUS_IDECBLID           0x0200  /* DB1200 */
+#define BCSR_STATUS_DB1200_U0RXD       0x1000  /* DB1200 */
+#define BCSR_STATUS_DB1200_U1RXD       0x2000  /* DB1200 */
+#define BCSR_STATUS_FLASHDEN           0xC000
+#define BCSR_STATUS_DB1550_U0RXD       0x1000  /* DB1550 */
+#define BCSR_STATUS_DB1550_U3RXD       0x2000  /* DB1550 */
+#define BCSR_STATUS_PB1550_U0RXD       0x1000  /* PB1550 */
+#define BCSR_STATUS_PB1550_U1RXD       0x2000  /* PB1550 */
+#define BCSR_STATUS_PB1550_U3RXD       0x8000  /* PB1550 */
+
+
+/* DB/PB1000,1100,1500,1550 */
+#define BCSR_RESETS_PHY0               0x0001
+#define BCSR_RESETS_PHY1               0x0002
+#define BCSR_RESETS_DC                 0x0004
+#define BCSR_RESETS_FIR_SEL            0x2000
+#define BCSR_RESETS_IRDA_MODE_MASK     0xC000
+#define BCSR_RESETS_IRDA_MODE_FULL     0x0000
+#define BCSR_RESETS_PB1550_WSCFSM      0x2000
+#define BCSR_RESETS_IRDA_MODE_OFF      0x4000
+#define BCSR_RESETS_IRDA_MODE_2_3      0x8000
+#define BCSR_RESETS_IRDA_MODE_1_3      0xC000
+#define BCSR_RESETS_DMAREQ             0x8000  /* PB1550 */
+
+#define BCSR_BOARD_PCIM66EN            0x0001
+#define BCSR_BOARD_SD0PWR              0x0040
+#define BCSR_BOARD_SD1PWR              0x0080
+#define BCSR_BOARD_PCIM33              0x0100
+#define BCSR_BOARD_PCIEXTARB           0x0200
+#define BCSR_BOARD_GPIO200RST          0x0400
+#define BCSR_BOARD_PCICLKOUT           0x0800
+#define BCSR_BOARD_PCICFG              0x1000
+#define BCSR_BOARD_SPISEL              0x4000  /* PB/DB1550 */
+#define BCSR_BOARD_SD0WP               0x4000  /* DB1100 */
+#define BCSR_BOARD_SD1WP               0x8000  /* DB1100 */
+
+
+/* DB/PB1200 */
+#define BCSR_RESETS_ETH                        0x0001
+#define BCSR_RESETS_CAMERA             0x0002
+#define BCSR_RESETS_DC                 0x0004
+#define BCSR_RESETS_IDE                        0x0008
+#define BCSR_RESETS_TV                 0x0010  /* DB1200 */
+/* Not resets but in the same register */
+#define BCSR_RESETS_PWMR1MUX           0x0800  /* DB1200 */
+#define BCSR_RESETS_PB1200_WSCFSM      0x0800  /* PB1200 */
+#define BCSR_RESETS_PSC0MUX            0x1000
+#define BCSR_RESETS_PSC1MUX            0x2000
+#define BCSR_RESETS_SPISEL             0x4000
+#define BCSR_RESETS_SD1MUX             0x8000  /* PB1200 */
+
+#define BCSR_BOARD_LCDVEE              0x0001
+#define BCSR_BOARD_LCDVDD              0x0002
+#define BCSR_BOARD_LCDBL               0x0004
+#define BCSR_BOARD_CAMSNAP             0x0010
+#define BCSR_BOARD_CAMPWR              0x0020
+#define BCSR_BOARD_SD0PWR              0x0040
+
+
+#define BCSR_SWITCHES_DIP              0x00FF
+#define BCSR_SWITCHES_DIP_1            0x0080
+#define BCSR_SWITCHES_DIP_2            0x0040
+#define BCSR_SWITCHES_DIP_3            0x0020
+#define BCSR_SWITCHES_DIP_4            0x0010
+#define BCSR_SWITCHES_DIP_5            0x0008
+#define BCSR_SWITCHES_DIP_6            0x0004
+#define BCSR_SWITCHES_DIP_7            0x0002
+#define BCSR_SWITCHES_DIP_8            0x0001
+#define BCSR_SWITCHES_ROTARY           0x0F00
+
+
+#define BCSR_PCMCIA_PC0VPP             0x0003
+#define BCSR_PCMCIA_PC0VCC             0x000C
+#define BCSR_PCMCIA_PC0DRVEN           0x0010
+#define BCSR_PCMCIA_PC0RST             0x0080
+#define BCSR_PCMCIA_PC1VPP             0x0300
+#define BCSR_PCMCIA_PC1VCC             0x0C00
+#define BCSR_PCMCIA_PC1DRVEN           0x1000
+#define BCSR_PCMCIA_PC1RST             0x8000
+
+
+#define BCSR_LEDS_DECIMALS             0x0003
+#define BCSR_LEDS_LED0                 0x0100
+#define BCSR_LEDS_LED1                 0x0200
+#define BCSR_LEDS_LED2                 0x0400
+#define BCSR_LEDS_LED3                 0x0800
+
+
+#define BCSR_SYSTEM_RESET              0x8000  /* clear to reset */
+#define BCSR_SYSTEM_PWROFF             0x4000  /* set to power off */
+#define BCSR_SYSTEM_VDDI               0x001F  /* PB1xxx boards */
+
+
+
+
+/* initialize BCSR for a board. Provide the PHYSICAL addresses of both
+ * BCSR spaces.
+ */
+void __init bcsr_init(unsigned long bcsr1_phys, unsigned long bcsr2_phys);
+
+/* read a board register */
+unsigned short bcsr_read(enum bcsr_id reg);
+
+/* write to a board register */
+void bcsr_write(enum bcsr_id reg, unsigned short val);
+
+/* modify a register. clear bits set in 'clr', set bits set in 'set' */
+void bcsr_mod(enum bcsr_id reg, unsigned short clr, unsigned short set);
+
+/* install CPLD IRQ demuxer (DB1200/PB1200) */
+void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq);
+
+#endif
index 27f26102b1bb374d982527b95bedc1e8b848aa72..3404248f50946e377e37964b6042765432b34896 100644 (file)
 #define __ASM_DB1200_H
 
 #include <linux/types.h>
+#include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1xxx_psc.h>
 
-#define DBDMA_AC97_TX_CHAN     DSCR_CMD0_PSC1_TX
-#define DBDMA_AC97_RX_CHAN     DSCR_CMD0_PSC1_RX
-#define DBDMA_I2S_TX_CHAN      DSCR_CMD0_PSC1_TX
-#define DBDMA_I2S_RX_CHAN      DSCR_CMD0_PSC1_RX
-
-/*
- * SPI and SMB are muxed on the DBAu1200 board.
- * Refer to board documentation.
- */
-#define SPI_PSC_BASE           PSC0_BASE_ADDR
-#define SMBUS_PSC_BASE         PSC0_BASE_ADDR
-/*
- * AC'97 and I2S are muxed on the DBAu1200 board.
- * Refer to board documentation.
- */
-#define AC97_PSC_BASE          PSC1_BASE_ADDR
-#define I2S_PSC_BASE           PSC1_BASE_ADDR
-
-#define BCSR_KSEG1_ADDR        0xB9800000
-
-typedef volatile struct
-{
-       /*00*/  u16 whoami;
-               u16 reserved0;
-       /*04*/  u16 status;
-               u16 reserved1;
-       /*08*/  u16 switches;
-               u16 reserved2;
-       /*0C*/  u16 resets;
-               u16 reserved3;
-
-       /*10*/  u16 pcmcia;
-               u16 reserved4;
-       /*14*/  u16 board;
-               u16 reserved5;
-       /*18*/  u16 disk_leds;
-               u16 reserved6;
-       /*1C*/  u16 system;
-               u16 reserved7;
-
-       /*20*/  u16 intclr;
-               u16 reserved8;
-       /*24*/  u16 intset;
-               u16 reserved9;
-       /*28*/  u16 intclr_mask;
-               u16 reserved10;
-       /*2C*/  u16 intset_mask;
-               u16 reserved11;
-
-       /*30*/  u16 sig_status;
-               u16 reserved12;
-       /*34*/  u16 int_status;
-               u16 reserved13;
-       /*38*/  u16 reserved14;
-               u16 reserved15;
-       /*3C*/  u16 reserved16;
-               u16 reserved17;
-
-} BCSR;
-
-static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-/*
- * Register bit definitions for the BCSRs
- */
-#define BCSR_WHOAMI_DCID       0x000F
-#define BCSR_WHOAMI_CPLD       0x00F0
-#define BCSR_WHOAMI_BOARD      0x0F00
-
-#define BCSR_STATUS_PCMCIA0VS  0x0003
-#define BCSR_STATUS_PCMCIA1VS  0x000C
-#define BCSR_STATUS_SWAPBOOT   0x0040
-#define BCSR_STATUS_FLASHBUSY  0x0100
-#define BCSR_STATUS_IDECBLID   0x0200
-#define BCSR_STATUS_SD0WP      0x0400
-#define BCSR_STATUS_U0RXD      0x1000
-#define BCSR_STATUS_U1RXD      0x2000
-
-#define BCSR_SWITCHES_OCTAL    0x00FF
-#define BCSR_SWITCHES_DIP_1    0x0080
-#define BCSR_SWITCHES_DIP_2    0x0040
-#define BCSR_SWITCHES_DIP_3    0x0020
-#define BCSR_SWITCHES_DIP_4    0x0010
-#define BCSR_SWITCHES_DIP_5    0x0008
-#define BCSR_SWITCHES_DIP_6    0x0004
-#define BCSR_SWITCHES_DIP_7    0x0002
-#define BCSR_SWITCHES_DIP_8    0x0001
-#define BCSR_SWITCHES_ROTARY   0x0F00
-
-#define BCSR_RESETS_ETH                0x0001
-#define BCSR_RESETS_CAMERA     0x0002
-#define BCSR_RESETS_DC         0x0004
-#define BCSR_RESETS_IDE                0x0008
-#define BCSR_RESETS_TV         0x0010
-/* Not resets but in the same register */
-#define BCSR_RESETS_PWMR1MUX   0x0800
-#define BCSR_RESETS_PCS0MUX    0x1000
-#define BCSR_RESETS_PCS1MUX    0x2000
-#define BCSR_RESETS_SPISEL     0x4000
-
-#define BCSR_PCMCIA_PC0VPP     0x0003
-#define BCSR_PCMCIA_PC0VCC     0x000C
-#define BCSR_PCMCIA_PC0DRVEN   0x0010
-#define BCSR_PCMCIA_PC0RST     0x0080
-#define BCSR_PCMCIA_PC1VPP     0x0300
-#define BCSR_PCMCIA_PC1VCC     0x0C00
-#define BCSR_PCMCIA_PC1DRVEN   0x1000
-#define BCSR_PCMCIA_PC1RST     0x8000
-
-#define BCSR_BOARD_LCDVEE      0x0001
-#define BCSR_BOARD_LCDVDD      0x0002
-#define BCSR_BOARD_LCDBL       0x0004
-#define BCSR_BOARD_CAMSNAP     0x0010
-#define BCSR_BOARD_CAMPWR      0x0020
-#define BCSR_BOARD_SD0PWR      0x0040
-
-#define BCSR_LEDS_DECIMALS     0x0003
-#define BCSR_LEDS_LED0         0x0100
-#define BCSR_LEDS_LED1         0x0200
-#define BCSR_LEDS_LED2         0x0400
-#define BCSR_LEDS_LED3         0x0800
-
-#define BCSR_SYSTEM_POWEROFF   0x4000
-#define BCSR_SYSTEM_RESET      0x8000
-
 /* Bit positions for the different interrupt sources */
 #define BCSR_INT_IDE           0x0001
 #define BCSR_INT_ETH           0x0002
@@ -168,17 +44,15 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
 #define BCSR_INT_SD0INSERT     0x1000
 #define BCSR_INT_SD0EJECT      0x2000
 
-#define SMC91C111_PHYS_ADDR    0x19000300
-#define SMC91C111_INT          DB1200_ETH_INT
-
 #define IDE_PHYS_ADDR          0x18800000
 #define IDE_REG_SHIFT          5
-#define IDE_PHYS_LEN           (16 << IDE_REG_SHIFT)
-#define IDE_INT                DB1200_IDE_INT
 #define IDE_DDMA_REQ           DSCR_CMD0_DMA_REQ1
 #define IDE_RQSIZE             128
 
-#define NAND_PHYS_ADDR         0x20000000
+#define DB1200_IDE_PHYS_ADDR   IDE_PHYS_ADDR
+#define DB1200_IDE_PHYS_LEN    (16 << IDE_REG_SHIFT)
+#define DB1200_ETH_PHYS_ADDR   0x19000300
+#define DB1200_NAND_PHYS_ADDR  0x20000000
 
 /*
  * External Interrupts for DBAu1200 as of 8/6/2004.
@@ -188,7 +62,7 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
  *   Example: IDE bis pos is  = 64 - 64
  *            ETH bit pos is  = 65 - 64
  */
-enum external_pb1200_ints {
+enum external_db1200_ints {
        DB1200_INT_BEGIN        = AU1000_MAX_INTR + 1,
 
        DB1200_IDE_INT          = DB1200_INT_BEGIN,
@@ -209,22 +83,4 @@ enum external_pb1200_ints {
        DB1200_INT_END          = DB1200_INT_BEGIN + 15,
 };
 
-
-/*
- * DBAu1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
- */
-#define PCMCIA_MAX_SOCK  1
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP, SLOT) \
-       ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
-
-#define BOARD_PC0_INT  DB1200_PC0_INT
-#define BOARD_PC1_INT  DB1200_PC1_INT
-#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
-
-/* NAND chip select */
-#define NAND_CS 1
-
 #endif /* __ASM_DB1200_H */
index 1a515b8c870f8afd1d131656e1b718e24d50a812..a919dac525a177410f4c67bdad9e18be044b2f24 100644 (file)
 #define SMBUS_PSC_BASE         PSC2_BASE_ADDR
 #define I2S_PSC_BASE           PSC3_BASE_ADDR
 
-#define BCSR_KSEG1_ADDR        0xAF000000
 #define NAND_PHYS_ADDR         0x20000000
 
-#else
-#define BCSR_KSEG1_ADDR 0xAE000000
 #endif
 
-/*
- * Overlay data structure of the DBAu1x00 board registers.
- * Registers are located at physical 0E0000xx, KSEG1 0xAE0000xx.
- */
-typedef volatile struct
-{
-       /*00*/  unsigned short whoami;
-       unsigned short reserved0;
-       /*04*/  unsigned short status;
-       unsigned short reserved1;
-       /*08*/  unsigned short switches;
-       unsigned short reserved2;
-       /*0C*/  unsigned short resets;
-       unsigned short reserved3;
-       /*10*/  unsigned short pcmcia;
-       unsigned short reserved4;
-       /*14*/  unsigned short specific;
-       unsigned short reserved5;
-       /*18*/  unsigned short leds;
-       unsigned short reserved6;
-       /*1C*/  unsigned short swreset;
-       unsigned short reserved7;
-
-} BCSR;
-
-
-/*
- * Register/mask bit definitions for the BCSRs
- */
-#define BCSR_WHOAMI_DCID               0x000F
-#define BCSR_WHOAMI_CPLD               0x00F0
-#define BCSR_WHOAMI_BOARD              0x0F00
-
-#define BCSR_STATUS_PC0VS              0x0003
-#define BCSR_STATUS_PC1VS              0x000C
-#define BCSR_STATUS_PC0FI              0x0010
-#define BCSR_STATUS_PC1FI              0x0020
-#define BCSR_STATUS_FLASHBUSY          0x0100
-#define BCSR_STATUS_ROMBUSY            0x0400
-#define BCSR_STATUS_SWAPBOOT           0x2000
-#define BCSR_STATUS_FLASHDEN           0xC000
-
-#define BCSR_SWITCHES_DIP              0x00FF
-#define BCSR_SWITCHES_DIP_1            0x0080
-#define BCSR_SWITCHES_DIP_2            0x0040
-#define BCSR_SWITCHES_DIP_3            0x0020
-#define BCSR_SWITCHES_DIP_4            0x0010
-#define BCSR_SWITCHES_DIP_5            0x0008
-#define BCSR_SWITCHES_DIP_6            0x0004
-#define BCSR_SWITCHES_DIP_7            0x0002
-#define BCSR_SWITCHES_DIP_8            0x0001
-#define BCSR_SWITCHES_ROTARY           0x0F00
-
-#define BCSR_RESETS_PHY0               0x0001
-#define BCSR_RESETS_PHY1               0x0002
-#define BCSR_RESETS_DC                 0x0004
-#define BCSR_RESETS_FIR_SEL            0x2000
-#define BCSR_RESETS_IRDA_MODE_MASK     0xC000
-#define BCSR_RESETS_IRDA_MODE_FULL     0x0000
-#define BCSR_RESETS_IRDA_MODE_OFF      0x4000
-#define BCSR_RESETS_IRDA_MODE_2_3      0x8000
-#define BCSR_RESETS_IRDA_MODE_1_3      0xC000
-
-#define BCSR_PCMCIA_PC0VPP             0x0003
-#define BCSR_PCMCIA_PC0VCC             0x000C
-#define BCSR_PCMCIA_PC0DRVEN           0x0010
-#define BCSR_PCMCIA_PC0RST             0x0080
-#define BCSR_PCMCIA_PC1VPP             0x0300
-#define BCSR_PCMCIA_PC1VCC             0x0C00
-#define BCSR_PCMCIA_PC1DRVEN           0x1000
-#define BCSR_PCMCIA_PC1RST             0x8000
-
-#define BCSR_BOARD_PCIM66EN            0x0001
-#define BCSR_BOARD_SD0_PWR             0x0040
-#define BCSR_BOARD_SD1_PWR             0x0080
-#define BCSR_BOARD_PCIM33              0x0100
-#define BCSR_BOARD_GPIO200RST          0x0400
-#define BCSR_BOARD_PCICFG              0x1000
-#define BCSR_BOARD_SD0_WP              0x4000
-#define BCSR_BOARD_SD1_WP              0x8000
-
-#define BCSR_LEDS_DECIMALS             0x0003
-#define BCSR_LEDS_LED0                 0x0100
-#define BCSR_LEDS_LED1                 0x0200
-#define BCSR_LEDS_LED2                 0x0400
-#define BCSR_LEDS_LED3                 0x0800
-
-#define BCSR_SWRESET_RESET             0x0080
-
-/* PCMCIA DBAu1x00 specific defines */
-#define PCMCIA_MAX_SOCK  1
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP, SLOT)\
-       ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
-
 /*
  * NAND defines
  *
index 9947e57c91ded01216ff49274df87dd96cb19129..16210cedd929870b97017ab33bc8c8309094ed8c 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2009 Wu Zhangjin <wuzj@lemote.com>
+ * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
  *
index 6305bea7e18ea7888ffe76f8cf252d0d7976f6d8..21c4ecedebe78013adf8c56f1eea989eaa2cecd6 100644 (file)
@@ -2,7 +2,7 @@
  * the read/write interfaces for Virtual Support Module(VSM)
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  */
 
 #ifndef        _CS5536_VSM_H
index ee8bc83769723ebd8282cbe814ff7ac985f6ea6e..1cf7b1401ee43259ed8947e60ccb1b8d91605fe8 100644 (file)
@@ -1,12 +1,11 @@
 /*
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.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.
- *
  */
 
 #ifndef __ASM_MACH_LOONGSON_LOONGSON_H
@@ -23,7 +22,7 @@ extern void mach_prepare_reboot(void);
 extern void mach_prepare_shutdown(void);
 
 /* environment arguments from bootloader */
-extern unsigned long bus_clock, cpu_clock_freq;
+extern unsigned long cpu_clock_freq;
 extern unsigned long memsize, highmemsize;
 
 /* loongson-specific command line, env and memory initialization */
index acf8359cb1358cfc1e063867c191e2c74ec5cd71..43213388c174a3609faae87ad2ac3a7e0ba7a12c 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Copyright (C) 2009 Lemote, Inc.
+ * Author: Wu Zhangjin <wuzhangjin@gmail.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
index e9960f341b96f0891ec2b1d389b0cf047de87469..3b23ee8647d6dd443251b4757ea2fd0780002c4a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.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
index a199a4f6de4e9633b584a0fa8a388a0a6a7b1d42..bc99dab4ef63b080eb0d7b2eaa318a8f2997a423 100644 (file)
@@ -1,23 +1,12 @@
 /*
  * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
- * Copyright (c) 2009 Wu Zhangjin <wuzj@lemote.com>
+ * Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.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., 675 Mass Ave, Cambridge, MA
- * 02139, USA.
  */
 
 #ifndef __ASM_MACH_LOONGSON_PCI_H_
diff --git a/arch/mips/include/asm/mach-pb1x00/pb1100.h b/arch/mips/include/asm/mach-pb1x00/pb1100.h
deleted file mode 100644 (file)
index b1a60f1..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Alchemy Semi Pb1100 Referrence Board
- *
- * Copyright 2001, 2008 MontaVista Software Inc.
- * Author: MontaVista Software, Inc. <source@mvista.com>
- *
- * ########################################################################
- *
- *  This program is free software; you can distribute it and/or modify it
- *  under the terms of the GNU General Public License (Version 2) as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope 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.
- *
- * ########################################################################
- *
- *
- */
-#ifndef __ASM_PB1100_H
-#define __ASM_PB1100_H
-
-#define PB1100_IDENT           0xAE000000
-#define BOARD_STATUS_REG       0xAE000004
-#  define PB1100_ROM_SEL       (1 << 15)
-#  define PB1100_ROM_SIZ       (1 << 14)
-#  define PB1100_SWAP_BOOT     (1 << 13)
-#  define PB1100_FLASH_WP      (1 << 12)
-#  define PB1100_ROM_H_STS     (1 << 11)
-#  define PB1100_ROM_L_STS     (1 << 10)
-#  define PB1100_FLASH_H_STS   (1 << 9)
-#  define PB1100_FLASH_L_STS   (1 << 8)
-#  define PB1100_SRAM_SIZ      (1 << 7)
-#  define PB1100_TSC_BUSY      (1 << 6)
-#  define PB1100_PCMCIA_VS_MASK (3 << 4)
-#  define PB1100_RS232_CD      (1 << 3)
-#  define PB1100_RS232_CTS     (1 << 2)
-#  define PB1100_RS232_DSR     (1 << 1)
-#  define PB1100_RS232_RI      (1 << 0)
-
-#define PB1100_IRDA_RS232      0xAE00000C
-#  define PB1100_IRDA_FULL     (0 << 14)       /* full power           */
-#  define PB1100_IRDA_SHUTDOWN (1 << 14)
-#  define PB1100_IRDA_TT       (2 << 14)       /* 2/3 power            */
-#  define PB1100_IRDA_OT       (3 << 14)       /* 1/3 power            */
-#  define PB1100_IRDA_FIR      (1 << 13)
-
-#define PCMCIA_BOARD_REG       0xAE000010
-#  define PB1100_SD_WP1_RO     (1 << 15)       /* read only            */
-#  define PB1100_SD_WP0_RO     (1 << 14)       /* read only            */
-#  define PB1100_SD_PWR1       (1 << 11)       /* applies power to SD1 */
-#  define PB1100_SD_PWR0       (1 << 10)       /* applies power to SD0 */
-#  define PB1100_SEL_SD_CONN1  (1 << 9)
-#  define PB1100_SEL_SD_CONN0  (1 << 8)
-#  define PC_DEASSERT_RST      (1 << 7)
-#  define PC_DRV_EN            (1 << 4)
-
-#define PB1100_G_CONTROL       0xAE000014      /* graphics control     */
-
-#define PB1100_RST_VDDI        0xAE00001C
-#  define PB1100_SOFT_RESET    (1 << 15)       /* clear to reset the board */
-#  define PB1100_VDDI_MASK     0x1F
-
-#define PB1100_LEDS            0xAE000018
-
-/*
- * 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
- * 7:0  is the LED Display's decimal points.
- */
-#define PB1100_HEX_LED         0xAE000018
-
-/* PCMCIA Pb1100 specific defines */
-#define PCMCIA_MAX_SOCK  0
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
-
-#endif /* __ASM_PB1100_H */
index c8618df88cb51abedc40b29cd4468f61d2505f6c..962eb55dc88039cd93c13f222d564063d3ab9b14 100644 (file)
@@ -25,6 +25,7 @@
 #define __ASM_PB1200_H
 
 #include <linux/types.h>
+#include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1xxx_psc.h>
 
 #define DBDMA_AC97_TX_CHAN     DSCR_CMD0_PSC1_TX
  * Refer to board documentation.
  */
 #define AC97_PSC_BASE       PSC1_BASE_ADDR
-#define I2S_PSC_BASE           PSC1_BASE_ADDR
+#define I2S_PSC_BASE   PSC1_BASE_ADDR
 
-#define BCSR_KSEG1_ADDR 0xAD800000
-
-typedef volatile struct
-{
-       /*00*/  u16 whoami;
-               u16 reserved0;
-       /*04*/  u16 status;
-               u16 reserved1;
-       /*08*/  u16 switches;
-               u16 reserved2;
-       /*0C*/  u16 resets;
-               u16 reserved3;
-
-       /*10*/  u16 pcmcia;
-               u16 reserved4;
-       /*14*/  u16 board;
-               u16 reserved5;
-       /*18*/  u16 disk_leds;
-               u16 reserved6;
-       /*1C*/  u16 system;
-               u16 reserved7;
-
-       /*20*/  u16 intclr;
-               u16 reserved8;
-       /*24*/  u16 intset;
-               u16 reserved9;
-       /*28*/  u16 intclr_mask;
-               u16 reserved10;
-       /*2C*/  u16 intset_mask;
-               u16 reserved11;
-
-       /*30*/  u16 sig_status;
-               u16 reserved12;
-       /*34*/  u16 int_status;
-               u16 reserved13;
-       /*38*/  u16 reserved14;
-               u16 reserved15;
-       /*3C*/  u16 reserved16;
-               u16 reserved17;
-
-} BCSR;
-
-static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-/*
- * Register bit definitions for the BCSRs
- */
-#define BCSR_WHOAMI_DCID       0x000F
-#define BCSR_WHOAMI_CPLD       0x00F0
-#define BCSR_WHOAMI_BOARD      0x0F00
-
-#define BCSR_STATUS_PCMCIA0VS  0x0003
-#define BCSR_STATUS_PCMCIA1VS  0x000C
-#define BCSR_STATUS_SWAPBOOT   0x0040
-#define BCSR_STATUS_FLASHBUSY  0x0100
-#define BCSR_STATUS_IDECBLID   0x0200
-#define BCSR_STATUS_SD0WP      0x0400
-#define BCSR_STATUS_SD1WP      0x0800
-#define BCSR_STATUS_U0RXD      0x1000
-#define BCSR_STATUS_U1RXD      0x2000
-
-#define BCSR_SWITCHES_OCTAL    0x00FF
-#define BCSR_SWITCHES_DIP_1    0x0080
-#define BCSR_SWITCHES_DIP_2    0x0040
-#define BCSR_SWITCHES_DIP_3    0x0020
-#define BCSR_SWITCHES_DIP_4    0x0010
-#define BCSR_SWITCHES_DIP_5    0x0008
-#define BCSR_SWITCHES_DIP_6    0x0004
-#define BCSR_SWITCHES_DIP_7    0x0002
-#define BCSR_SWITCHES_DIP_8    0x0001
-#define BCSR_SWITCHES_ROTARY   0x0F00
-
-#define BCSR_RESETS_ETH                0x0001
-#define BCSR_RESETS_CAMERA     0x0002
-#define BCSR_RESETS_DC         0x0004
-#define BCSR_RESETS_IDE                0x0008
-/* not resets but in the same register */
-#define BCSR_RESETS_WSCFSM     0x0800
-#define BCSR_RESETS_PCS0MUX    0x1000
-#define BCSR_RESETS_PCS1MUX    0x2000
-#define BCSR_RESETS_SPISEL     0x4000
-#define BCSR_RESETS_SD1MUX     0x8000
-
-#define BCSR_PCMCIA_PC0VPP     0x0003
-#define BCSR_PCMCIA_PC0VCC     0x000C
-#define BCSR_PCMCIA_PC0DRVEN   0x0010
-#define BCSR_PCMCIA_PC0RST     0x0080
-#define BCSR_PCMCIA_PC1VPP     0x0300
-#define BCSR_PCMCIA_PC1VCC     0x0C00
-#define BCSR_PCMCIA_PC1DRVEN   0x1000
-#define BCSR_PCMCIA_PC1RST     0x8000
-
-#define BCSR_BOARD_LCDVEE      0x0001
-#define BCSR_BOARD_LCDVDD      0x0002
-#define BCSR_BOARD_LCDBL       0x0004
-#define BCSR_BOARD_CAMSNAP     0x0010
-#define BCSR_BOARD_CAMPWR      0x0020
-#define BCSR_BOARD_SD0PWR      0x0040
-#define BCSR_BOARD_SD1PWR      0x0080
-
-#define BCSR_LEDS_DECIMALS     0x00FF
-#define BCSR_LEDS_LED0         0x0100
-#define BCSR_LEDS_LED1         0x0200
-#define BCSR_LEDS_LED2         0x0400
-#define BCSR_LEDS_LED3         0x0800
 
 #define BCSR_SYSTEM_VDDI       0x001F
 #define BCSR_SYSTEM_POWEROFF   0x4000
@@ -239,20 +135,6 @@ enum external_pb1200_ints {
        PB1200_INT_END          = PB1200_INT_BEGIN + 15
 };
 
-/*
- * Pb1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
- */
-#define PCMCIA_MAX_SOCK  1
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP, SLOT) \
-       ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
-
-#define BOARD_PC0_INT  PB1200_PC0_INT
-#define BOARD_PC1_INT  PB1200_PC1_INT
-#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
-
 /* NAND chip select */
 #define NAND_CS 1
 
diff --git a/arch/mips/include/asm/mach-pb1x00/pb1500.h b/arch/mips/include/asm/mach-pb1x00/pb1500.h
deleted file mode 100644 (file)
index da51a2e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Alchemy Semi Pb1500 Referrence Board
- *
- * Copyright 2001, 2008 MontaVista Software Inc.
- * Author: MontaVista Software, Inc. <source@mvista.com>
- *
- * ########################################################################
- *
- *  This program is free software; you can distribute it and/or modify it
- *  under the terms of the GNU General Public License (Version 2) as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope 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.
- *
- * ########################################################################
- *
- *
- */
-#ifndef __ASM_PB1500_H
-#define __ASM_PB1500_H
-
-#define IDENT_BOARD_REG        0xAE000000
-#define BOARD_STATUS_REG       0xAE000004
-#define PCI_BOARD_REG          0xAE000010
-#define PCMCIA_BOARD_REG       0xAE000010
-#  define PC_DEASSERT_RST            0x80
-#  define PC_DRV_EN                  0x10
-#define PB1500_G_CONTROL       0xAE000014
-#define PB1500_RST_VDDI        0xAE00001C
-#define PB1500_LEDS            0xAE000018
-
-#define PB1500_HEX_LED         0xAF000004
-#define PB1500_HEX_LED_BLANK   0xAF000008
-
-/* PCMCIA Pb1500 specific defines */
-#define PCMCIA_MAX_SOCK  0
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
-
-#endif /* __ASM_PB1500_H */
index 6704a11497dbd701cccb62bdc822625ade559ac6..58796410bd6ed375f7fa6b2d28a54d5a1faf7774 100644 (file)
 #define SMBUS_PSC_BASE         PSC2_BASE_ADDR
 #define I2S_PSC_BASE           PSC3_BASE_ADDR
 
-#define BCSR_PHYS_ADDR 0xAF000000
-
-typedef volatile struct
-{
-       /*00*/  u16 whoami;
-               u16 reserved0;
-       /*04*/  u16 status;
-               u16 reserved1;
-       /*08*/  u16 switches;
-               u16 reserved2;
-       /*0C*/  u16 resets;
-               u16 reserved3;
-       /*10*/  u16 pcmcia;
-               u16 reserved4;
-       /*14*/  u16 pci;
-               u16 reserved5;
-       /*18*/  u16 leds;
-               u16 reserved6;
-       /*1C*/  u16 system;
-               u16 reserved7;
-
-} BCSR;
-
-static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
-
-/*
- * Register bit definitions for the BCSRs
- */
-#define BCSR_WHOAMI_DCID       0x000F
-#define BCSR_WHOAMI_CPLD       0x00F0
-#define BCSR_WHOAMI_BOARD      0x0F00
-
-#define BCSR_STATUS_PCMCIA0VS  0x0003
-#define BCSR_STATUS_PCMCIA1VS  0x000C
-#define BCSR_STATUS_PCMCIA0FI  0x0010
-#define BCSR_STATUS_PCMCIA1FI  0x0020
-#define BCSR_STATUS_SWAPBOOT   0x0040
-#define BCSR_STATUS_SRAMWIDTH  0x0080
-#define BCSR_STATUS_FLASHBUSY  0x0100
-#define BCSR_STATUS_ROMBUSY    0x0200
-#define BCSR_STATUS_USBOTGID   0x0800
-#define BCSR_STATUS_U0RXD      0x1000
-#define BCSR_STATUS_U1RXD      0x2000
-#define BCSR_STATUS_U3RXD      0x8000
-
-#define BCSR_SWITCHES_OCTAL    0x00FF
-#define BCSR_SWITCHES_DIP_1    0x0080
-#define BCSR_SWITCHES_DIP_2    0x0040
-#define BCSR_SWITCHES_DIP_3    0x0020
-#define BCSR_SWITCHES_DIP_4    0x0010
-#define BCSR_SWITCHES_DIP_5    0x0008
-#define BCSR_SWITCHES_DIP_6    0x0004
-#define BCSR_SWITCHES_DIP_7    0x0002
-#define BCSR_SWITCHES_DIP_8    0x0001
-#define BCSR_SWITCHES_ROTARY   0x0F00
-
-#define BCSR_RESETS_PHY0       0x0001
-#define BCSR_RESETS_PHY1       0x0002
-#define BCSR_RESETS_DC         0x0004
-#define BCSR_RESETS_WSC                0x2000
-#define BCSR_RESETS_SPISEL     0x4000
-#define BCSR_RESETS_DMAREQ     0x8000
-
-#define BCSR_PCMCIA_PC0VPP     0x0003
-#define BCSR_PCMCIA_PC0VCC     0x000C
-#define BCSR_PCMCIA_PC0DRVEN   0x0010
-#define BCSR_PCMCIA_PC0RST     0x0080
-#define BCSR_PCMCIA_PC1VPP     0x0300
-#define BCSR_PCMCIA_PC1VCC     0x0C00
-#define BCSR_PCMCIA_PC1DRVEN   0x1000
-#define BCSR_PCMCIA_PC1RST     0x8000
-
-#define BCSR_PCI_M66EN         0x0001
-#define BCSR_PCI_M33           0x0100
-#define BCSR_PCI_EXTERNARB     0x0200
-#define BCSR_PCI_GPIO200RST    0x0400
-#define BCSR_PCI_CLKOUT                0x0800
-#define BCSR_PCI_CFGHOST       0x1000
-
-#define BCSR_LEDS_DECIMALS     0x00FF
-#define BCSR_LEDS_LED0         0x0100
-#define BCSR_LEDS_LED1         0x0200
-#define BCSR_LEDS_LED2         0x0400
-#define BCSR_LEDS_LED3         0x0800
-
-#define BCSR_SYSTEM_VDDI       0x001F
-#define BCSR_SYSTEM_POWEROFF   0x4000
-#define BCSR_SYSTEM_RESET      0x8000
-
-#define PCMCIA_MAX_SOCK  1
-#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
-
-/* VPP/VCC */
-#define SET_VCC_VPP(VCC, VPP, SLOT) \
-       ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
-
 #if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
 #define PB1550_BOTH_BANKS
 #elif defined(CONFIG_MTD_PB1550_BOOT) && !defined(CONFIG_MTD_PB1550_USER)
index 657f089b17243f80cae0fb9fae870e332d2fe50f..6d70264557b23005fcca2d44235d0a8e1417faa4 100644 (file)
 #define PNX833X_GPIO_15_INT                    (PNX833X_GPIO_IRQ_BASE + 15)
 
 #endif
-
diff --git a/arch/mips/include/asm/mach-powertv/asic_reg_map.h b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
new file mode 100644 (file)
index 0000000..6f26cb0
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ *                             asic_reg_map.h
+ *
+ * A macro-enclosed list of the elements for the register_map structure for
+ * use in defining and manipulating the structure.
+ *
+ * Copyright (C) 2009  Cisco Systems, Inc.
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+REGISTER_MAP_ELEMENT(eic_slow0_strt_add)
+REGISTER_MAP_ELEMENT(eic_cfg_bits)
+REGISTER_MAP_ELEMENT(eic_ready_status)
+REGISTER_MAP_ELEMENT(chipver3)
+REGISTER_MAP_ELEMENT(chipver2)
+REGISTER_MAP_ELEMENT(chipver1)
+REGISTER_MAP_ELEMENT(chipver0)
+REGISTER_MAP_ELEMENT(uart1_intstat)
+REGISTER_MAP_ELEMENT(uart1_inten)
+REGISTER_MAP_ELEMENT(uart1_config1)
+REGISTER_MAP_ELEMENT(uart1_config2)
+REGISTER_MAP_ELEMENT(uart1_divisorhi)
+REGISTER_MAP_ELEMENT(uart1_divisorlo)
+REGISTER_MAP_ELEMENT(uart1_data)
+REGISTER_MAP_ELEMENT(uart1_status)
+REGISTER_MAP_ELEMENT(int_stat_3)
+REGISTER_MAP_ELEMENT(int_stat_2)
+REGISTER_MAP_ELEMENT(int_stat_1)
+REGISTER_MAP_ELEMENT(int_stat_0)
+REGISTER_MAP_ELEMENT(int_config)
+REGISTER_MAP_ELEMENT(int_int_scan)
+REGISTER_MAP_ELEMENT(ien_int_3)
+REGISTER_MAP_ELEMENT(ien_int_2)
+REGISTER_MAP_ELEMENT(ien_int_1)
+REGISTER_MAP_ELEMENT(ien_int_0)
+REGISTER_MAP_ELEMENT(int_level_3_3)
+REGISTER_MAP_ELEMENT(int_level_3_2)
+REGISTER_MAP_ELEMENT(int_level_3_1)
+REGISTER_MAP_ELEMENT(int_level_3_0)
+REGISTER_MAP_ELEMENT(int_level_2_3)
+REGISTER_MAP_ELEMENT(int_level_2_2)
+REGISTER_MAP_ELEMENT(int_level_2_1)
+REGISTER_MAP_ELEMENT(int_level_2_0)
+REGISTER_MAP_ELEMENT(int_level_1_3)
+REGISTER_MAP_ELEMENT(int_level_1_2)
+REGISTER_MAP_ELEMENT(int_level_1_1)
+REGISTER_MAP_ELEMENT(int_level_1_0)
+REGISTER_MAP_ELEMENT(int_level_0_3)
+REGISTER_MAP_ELEMENT(int_level_0_2)
+REGISTER_MAP_ELEMENT(int_level_0_1)
+REGISTER_MAP_ELEMENT(int_level_0_0)
+REGISTER_MAP_ELEMENT(int_docsis_en)
+REGISTER_MAP_ELEMENT(mips_pll_setup)
+REGISTER_MAP_ELEMENT(usb_fs)
+REGISTER_MAP_ELEMENT(test_bus)
+REGISTER_MAP_ELEMENT(crt_spare)
+REGISTER_MAP_ELEMENT(usb2_ohci_int_mask)
+REGISTER_MAP_ELEMENT(usb2_strap)
+REGISTER_MAP_ELEMENT(ehci_hcapbase)
+REGISTER_MAP_ELEMENT(ohci_hc_revision)
+REGISTER_MAP_ELEMENT(bcm1_bs_lmi_steer)
+REGISTER_MAP_ELEMENT(usb2_control)
+REGISTER_MAP_ELEMENT(usb2_stbus_obc)
+REGISTER_MAP_ELEMENT(usb2_stbus_mess_size)
+REGISTER_MAP_ELEMENT(usb2_stbus_chunk_size)
+REGISTER_MAP_ELEMENT(pcie_regs)
+REGISTER_MAP_ELEMENT(tim_ch)
+REGISTER_MAP_ELEMENT(tim_cl)
+REGISTER_MAP_ELEMENT(gpio_dout)
+REGISTER_MAP_ELEMENT(gpio_din)
+REGISTER_MAP_ELEMENT(gpio_dir)
+REGISTER_MAP_ELEMENT(watchdog)
+REGISTER_MAP_ELEMENT(front_panel)
+REGISTER_MAP_ELEMENT(misc_clk_ctl1)
+REGISTER_MAP_ELEMENT(misc_clk_ctl2)
+REGISTER_MAP_ELEMENT(crt_ext_ctl)
+REGISTER_MAP_ELEMENT(register_maps)
index 9a65c93782f94d7d37b9c488cc8703d7f820b809..1e11236c6dbcaf4b4968f64abb6bdd2c801c5aac 100644 (file)
@@ -35,11 +35,12 @@ enum asic_type {
 #define CRONUS_11      0x0B4C1C21
 #define CRONUSLITE_10  0x0B4C1C40
 
-#define NAND_FLASH_BASE        0x03000000
-#define ZEUS_IO_BASE   0x09000000
+#define NAND_FLASH_BASE                0x03000000
 #define CALLIOPE_IO_BASE       0x08000000
-#define CRONUS_IO_BASE 0x09000000
-#define ASIC_IO_SIZE   0x01000000
+#define CRONUS_IO_BASE         0x09000000
+#define ZEUS_IO_BASE           0x09000000
+
+#define ASIC_IO_SIZE           0x01000000
 
 /* Definitions for backward compatibility */
 #define UART1_INTSTAT  uart1_intstat
@@ -52,96 +53,62 @@ enum asic_type {
 #define UART1_STATUS   uart1_status
 
 /* ASIC register enumeration */
+union register_map_entry {
+       unsigned long phys;
+       u32 *virt;
+};
+
+#define REGISTER_MAP_ELEMENT(x) union register_map_entry x;
 struct register_map {
-       u32 eic_slow0_strt_add;
-       u32 eic_cfg_bits;
-       u32 eic_ready_status;
-
-       u32 chipver3;
-       u32 chipver2;
-       u32 chipver1;
-       u32 chipver0;
-
-       u32 uart1_intstat;
-       u32 uart1_inten;
-       u32 uart1_config1;
-       u32 uart1_config2;
-       u32 uart1_divisorhi;
-       u32 uart1_divisorlo;
-       u32 uart1_data;
-       u32 uart1_status;
-
-       u32 int_stat_3;
-       u32 int_stat_2;
-       u32 int_stat_1;
-       u32 int_stat_0;
-       u32 int_config;
-       u32 int_int_scan;
-       u32 ien_int_3;
-       u32 ien_int_2;
-       u32 ien_int_1;
-       u32 ien_int_0;
-       u32 int_level_3_3;
-       u32 int_level_3_2;
-       u32 int_level_3_1;
-       u32 int_level_3_0;
-       u32 int_level_2_3;
-       u32 int_level_2_2;
-       u32 int_level_2_1;
-       u32 int_level_2_0;
-       u32 int_level_1_3;
-       u32 int_level_1_2;
-       u32 int_level_1_1;
-       u32 int_level_1_0;
-       u32 int_level_0_3;
-       u32 int_level_0_2;
-       u32 int_level_0_1;
-       u32 int_level_0_0;
-       u32 int_docsis_en;
-
-       u32 mips_pll_setup;
-       u32 usb_fs;
-       u32 test_bus;
-       u32 crt_spare;
-       u32 usb2_ohci_int_mask;
-       u32 usb2_strap;
-       u32 ehci_hcapbase;
-       u32 ohci_hc_revision;
-       u32 bcm1_bs_lmi_steer;
-       u32 usb2_control;
-       u32 usb2_stbus_obc;
-       u32 usb2_stbus_mess_size;
-       u32 usb2_stbus_chunk_size;
-
-       u32 pcie_regs;
-       u32 tim_ch;
-       u32 tim_cl;
-       u32 gpio_dout;
-       u32 gpio_din;
-       u32 gpio_dir;
-       u32 watchdog;
-       u32 front_panel;
-
-       u32 register_maps;
+#include <asm/mach-powertv/asic_reg_map.h>
 };
+#undef REGISTER_MAP_ELEMENT
+
+/**
+ * register_map_offset_phys - add an offset to the physical address
+ * @map:       Pointer to the &struct register_map
+ * @offset:    Value to add
+ *
+ * Only adds the base to non-zero physical addresses
+ */
+static inline void register_map_offset_phys(struct register_map *map,
+       unsigned long offset)
+{
+#define REGISTER_MAP_ELEMENT(x)                do {                            \
+               if (map->x.phys != 0)                                   \
+                       map->x.phys += offset;                          \
+       } while (false);
+
+#include <asm/mach-powertv/asic_reg_map.h>
+#undef REGISTER_MAP_ELEMENT
+}
+
+/**
+ * register_map_virtualize - Convert &register_map to virtual addresses
+ * @map:       Pointer to &register_map to virtualize
+ */
+static inline void register_map_virtualize(struct register_map *map)
+{
+#define REGISTER_MAP_ELEMENT(x)                do {                            \
+               map->x.virt = (!map->x.phys) ? NULL :                   \
+                       UNCAC_ADDR(phys_to_virt(map->x.phys));          \
+       } while (false);
+
+#include <asm/mach-powertv/asic_reg_map.h>
+#undef REGISTER_MAP_ELEMENT
+}
 
-extern enum asic_type asic;
-extern const struct register_map *register_map;
-extern unsigned long asic_phy_base;    /* Physical address of ASIC */
-extern unsigned long asic_base;                /* Virtual address of ASIC */
+extern struct register_map _asic_register_map;
 
 /*
  * Macros to interface to registers through their ioremapped address
- * asic_reg_offset     Returns the offset of a given register from the start
- *                     of the ASIC address space
  * asic_reg_phys_addr  Returns the physical address of the given register
  * asic_reg_addr       Returns the iomapped virtual address of the given
  *                     register.
  */
-#define asic_reg_offset(x)     (register_map->x)
-#define asic_reg_phys_addr(x)  (asic_phy_base + asic_reg_offset(x))
-#define asic_reg_addr(x) \
-       ((unsigned int *) (asic_base + asic_reg_offset(x)))
+#define asic_reg_addr(x)       (_asic_register_map.x.virt)
+#define asic_reg_phys_addr(x)  (virt_to_phys((void *) CAC_ADDR(        \
+                                       (unsigned long) asic_reg_addr(x))))
 
 /*
  * The asic_reg macro is gone. It should be replaced by either asic_read or
index 629a57413657861aceda4472338c8302194c2412..4fd652ceb52afc8ebc571a3df39365f5f1f462cf 100644 (file)
                                                 * channel 3. */
 #define irq_mpeg_d             (ibase+0)       /* MPEG Decoder Interrupt */
 #endif /* _ASM_MACH_POWERTV_INTERRUPTS_H_ */
-
index a581d60cbcc21e395a1e7a9ba772c4b0be5dcb4b..49382d5e891a35a98b09be21abcdb13366b2cca9 100644 (file)
 #define PL_64M         26
 #define PL_256M                28
 
+/*
+ * PageGrain bits
+ */
+#define PG_RIE         (_ULCAST_(1) <<  31)
+#define PG_XIE         (_ULCAST_(1) <<  30)
+#define PG_ELPA                (_ULCAST_(1) <<  29)
+#define PG_ESP         (_ULCAST_(1) <<  28)
+
 /*
  * R4x00 interrupt enable / cause bits
  */
 #define ST0_CU3                        0x80000000
 #define ST0_XX                 0x80000000      /* MIPS IV naming */
 
+/*
+ * Bitfields and bit numbers in the coprocessor 0 IntCtl register. (MIPSR2)
+ *
+ * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
+ */
+#define INTCTLB_IPPCI          26
+#define INTCTLF_IPPCI          (_ULCAST_(7) << INTCTLB_IPPCI)
+#define INTCTLB_IPTI           29
+#define INTCTLF_IPTI           (_ULCAST_(7) << INTCTLB_IPTI)
+
 /*
  * Bitfields and bit numbers in the coprocessor 0 cause register.
  *
 #define  CAUSEF_IV             (_ULCAST_(1)   << 23)
 #define  CAUSEB_CE             28
 #define  CAUSEF_CE             (_ULCAST_(3)   << 28)
+#define  CAUSEB_TI             30
+#define  CAUSEF_TI             (_ULCAST_(1)   << 30)
 #define  CAUSEB_BD             31
 #define  CAUSEF_BD             (_ULCAST_(1)   << 31)
 
 #define MIPS_CONF3_DSP         (_ULCAST_(1) << 10)
 #define MIPS_CONF3_ULRI                (_ULCAST_(1) << 13)
 
+#define MIPS_CONF4_MMUSIZEEXT  (_ULCAST_(255) << 0)
+#define MIPS_CONF4_MMUEXTDEF   (_ULCAST_(3) << 14)
+#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
+
 #define MIPS_CONF7_WII         (_ULCAST_(1) << 31)
 
 #define MIPS_CONF7_RPS         (_ULCAST_(1) << 2)
@@ -814,6 +838,9 @@ do {                                                                        \
 #define read_c0_pagemask()     __read_32bit_c0_register($5, 0)
 #define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
 
+#define read_c0_pagegrain()    __read_32bit_c0_register($5, 1)
+#define write_c0_pagegrain(val)        __write_32bit_c0_register($5, 1, val)
+
 #define read_c0_wired()                __read_32bit_c0_register($6, 0)
 #define write_c0_wired(val)    __write_32bit_c0_register($6, 0, val)
 
index 7989b9ffc1d26541b19b412738ed1ad0d70f3bf2..d92406ae2841747ef3ec99f3adbe6039eae83427 100644 (file)
@@ -145,4 +145,3 @@ extern void __init init_msc_irqs(unsigned long icubase, unsigned int base, msc_i
 extern void ll_msc_irq(void);
 
 #endif /* __ASM_MIPS_BOARDS_MSC01_IC_H */
-
index c3ca959aa4d984cd5c1b72909e7e14d46681c0c7..af0e51a9f68a879b8a139124755ff64ecf8b8702 100644 (file)
@@ -307,4 +307,3 @@ extern u8 nile4_i8259_iack(void);
 extern void nile4_dump_irq_status(void);       /* Debug */
 
 #endif
-
index ef24a7b4ea57858332da5ac11acaf43e59fbb50c..cba6fbed9f438249fde6cd3f346577a77fa7c3e2 100644 (file)
@@ -99,6 +99,8 @@ static inline int octeon_has_feature(enum octeon_feature feature)
                return !cvmx_fuse_read(90);
 
        case OCTEON_FEATURE_PCIE:
+       case OCTEON_FEATURE_MGMT_PORT:
+       case OCTEON_FEATURE_RAID:
                return OCTEON_IS_MODEL(OCTEON_CN56XX)
                        || OCTEON_IS_MODEL(OCTEON_CN52XX);
 
@@ -110,12 +112,6 @@ static inline int octeon_has_feature(enum octeon_feature feature)
        case OCTEON_FEATURE_TRA:
                return !(OCTEON_IS_MODEL(OCTEON_CN30XX)
                         || OCTEON_IS_MODEL(OCTEON_CN50XX));
-       case OCTEON_FEATURE_MGMT_PORT:
-               return OCTEON_IS_MODEL(OCTEON_CN56XX)
-                       || OCTEON_IS_MODEL(OCTEON_CN52XX);
-       case OCTEON_FEATURE_RAID:
-               return OCTEON_IS_MODEL(OCTEON_CN56XX)
-                       || OCTEON_IS_MODEL(OCTEON_CN52XX);
        case OCTEON_FEATURE_USB:
                return !(OCTEON_IS_MODEL(OCTEON_CN38XX)
                         || OCTEON_IS_MODEL(OCTEON_CN58XX));
index 4d0a8c61fc3eed3a160d7ba0116341e442c28037..ca6214b5ccb96c3baa86bbd5cc5380179249c6e3 100644 (file)
@@ -213,6 +213,11 @@ struct octeon_cf_data {
        int             dma_engine;     /* -1 for no DMA */
 };
 
+struct octeon_i2c_data {
+       unsigned int    sys_freq;
+       unsigned int    i2c_freq;
+};
+
 extern void octeon_write_lcd(const char *s);
 extern void octeon_check_cpu_bist(void);
 extern int octeon_get_boot_debug_flag(void);
index f266295cce51ba982f4396b892306ef1286eb979..ac32572430f42c3e359531b6079968196969195b 100644 (file)
@@ -106,18 +106,6 @@ typedef struct { unsigned long pte; } pte_t;
 #endif
 typedef struct page *pgtable_t;
 
-/*
- * For 3-level pagetables we defines these ourselves, for 2-level the
- * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
- */
-#ifdef CONFIG_64BIT
-
-typedef struct { unsigned long pmd; } pmd_t;
-#define pmd_val(x)     ((x).pmd)
-#define __pmd(x)       ((pmd_t) { (x) } )
-
-#endif
-
 /*
  * Right now we don't support 4-level pagetables, so all pud-related
  * definitions come from <asm-generic/pgtable-nopud.h>.
index 1d9bb8c5ab246cc52f62eca86d77d33764ee2f05..da3920fce9ad666c55af424312383dcdf81780df 100644 (file)
@@ -9,23 +9,8 @@
 #ifndef _ASM_PARAM_H
 #define _ASM_PARAM_H
 
-#ifdef __KERNEL__
-
-# define HZ            CONFIG_HZ       /* Internal kernel timer frequency */
-# define USER_HZ       100             /* .. some user interfaces are in "ticks" */
-# define CLOCKS_PER_SEC        (USER_HZ)       /* like times() */
-#endif
-
-#ifndef HZ
-#define HZ 100
-#endif
-
 #define EXEC_PAGESIZE  65536
 
-#ifndef NOGROUP
-#define NOGROUP                (-1)
-#endif
-
-#define MAXHOSTNAMELEN 64      /* max length of hostname */
+#include <asm-generic/param.h>
 
 #endif /* _ASM_PARAM_H */
index f52656826cce914b1356524c4c99a5b6af149c66..cf252af6459087e0d01e92362bc7e2d5170e4c94 100644 (file)
@@ -1,15 +1 @@
-/*
- * Copyright (C) 1999, 2000  Tim Waugh <tim@cyberelk.demon.co.uk>
- *
- * This file should only be included by drivers/parport/parport_pc.c.
- */
-#ifndef _ASM_PARPORT_H
-#define _ASM_PARPORT_H
-
-static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
-static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
-{
-       return parport_pc_find_isa_ports(autoirq, autodma);
-}
-
-#endif /* _ASM_PARPORT_H */
+#include <asm-generic/parport.h>
index 3738f4b48cbd63b75b9b91095c6ef9807f26866d..881d18b4e298009661619a1f98777fbc45b38ff2 100644 (file)
@@ -31,7 +31,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
  */
 extern void pmd_init(unsigned long page, unsigned long pagetable);
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 
 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 {
@@ -104,7 +104,7 @@ do {                                                        \
        tlb_remove_page((tlb), pte);                    \
 } while (0)
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
index 55813d6150c7ecc47ab0aa63e78e53e278e7f40b..ae90412556d026fc58d5a97bc9e2761c76080e49 100644 (file)
@@ -127,8 +127,8 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
 #define pte_pfn(x)             ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
 #define pfn_pte(pfn, prot)     __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
 #else
-#define pte_pfn(x)             ((unsigned long)((x).pte >> PAGE_SHIFT))
-#define pfn_pte(pfn, prot)     __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
+#define pte_pfn(x)             ((unsigned long)((x).pte >> _PFN_SHIFT))
+#define pfn_pte(pfn, prot)     __pte(((unsigned long long)(pfn) << _PFN_SHIFT) | pgprot_val(prot))
 #endif
 #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
 
index 9cd508993956b325d71dd654255d1a2aa92a459f..26dc69d792a613d71ea693db1b45944fd1089d0c 100644 (file)
 #include <asm/cachectl.h>
 #include <asm/fixmap.h>
 
+#ifdef CONFIG_PAGE_SIZE_64KB
+#include <asm-generic/pgtable-nopmd.h>
+#else
 #include <asm-generic/pgtable-nopud.h>
+#endif
 
 /*
  * Each address space has 2 4K pages as its page directory, giving 1024
  * fault address - VMALLOC_START.
  */
 
+
+/* PGDIR_SHIFT determines what a third-level page table entry can map */
+#ifdef __PAGETABLE_PMD_FOLDED
+#define PGDIR_SHIFT    (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3)
+#else
+
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define PMD_SHIFT      (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
 #define PMD_SIZE       (1UL << PMD_SHIFT)
 #define PMD_MASK       (~(PMD_SIZE-1))
 
-/* PGDIR_SHIFT determines what a third-level page table entry can map */
+
 #define PGDIR_SHIFT    (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
+#endif
 #define PGDIR_SIZE     (1UL << PGDIR_SHIFT)
 #define PGDIR_MASK     (~(PGDIR_SIZE-1))
 
 #ifdef CONFIG_PAGE_SIZE_64KB
 #define PGD_ORDER              0
 #define PUD_ORDER              aieeee_attempt_to_allocate_pud
-#define PMD_ORDER              0
+#define PMD_ORDER              aieeee_attempt_to_allocate_pmd
 #define PTE_ORDER              0
 #endif
 
 #define PTRS_PER_PGD   ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+#ifndef __PAGETABLE_PMD_FOLDED
 #define PTRS_PER_PMD   ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
+#endif
 #define PTRS_PER_PTE   ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
 
 #if PGDIR_SIZE >= TASK_SIZE
 #define VMALLOC_START          MAP_BASE
 #define VMALLOC_END    \
        (VMALLOC_START + \
-        PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE - (1UL << 32))
+        min(PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \
+            (1UL << cpu_vmbits)) - (1UL << 32))
+
 #if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
        VMALLOC_START != CKSSEG
 /* Load modules into 32bit-compatible segment. */
 
 #define pte_ERROR(e) \
        printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
+#ifndef __PAGETABLE_PMD_FOLDED
 #define pmd_ERROR(e) \
        printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
+#endif
 #define pgd_ERROR(e) \
        printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
 
 extern pte_t invalid_pte_table[PTRS_PER_PTE];
 extern pte_t empty_bad_page_table[PTRS_PER_PTE];
+
+
+#ifndef __PAGETABLE_PMD_FOLDED
+/*
+ * For 3-level pagetables we defines these ourselves, for 2-level the
+ * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
+ */
+typedef struct { unsigned long pmd; } pmd_t;
+#define pmd_val(x)     ((x).pmd)
+#define __pmd(x)       ((pmd_t) { (x) } )
+
+
 extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
 extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
+#endif
 
 /*
  * Empty pgd/pmd entries point to the invalid_pte_table.
@@ -149,6 +179,7 @@ static inline void pmd_clear(pmd_t *pmdp)
 {
        pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
 }
+#ifndef __PAGETABLE_PMD_FOLDED
 
 /*
  * Empty pud entries point to the invalid_pmd_table.
@@ -172,6 +203,7 @@ static inline void pud_clear(pud_t *pudp)
 {
        pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
 }
+#endif
 
 #define pte_page(x)            pfn_to_page(pte_pfn(x))
 
@@ -179,8 +211,8 @@ static inline void pud_clear(pud_t *pudp)
 #define pte_pfn(x)             ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
 #define pfn_pte(pfn, prot)     __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
 #else
-#define pte_pfn(x)             ((unsigned long)((x).pte >> PAGE_SHIFT))
-#define pfn_pte(pfn, prot)     __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
+#define pte_pfn(x)             ((unsigned long)((x).pte >> _PFN_SHIFT))
+#define pfn_pte(pfn, prot)     __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
 #endif
 
 #define __pgd_offset(address)  pgd_index(address)
@@ -196,6 +228,7 @@ static inline void pud_clear(pud_t *pudp)
 /* to find an entry in a page-table-directory */
 #define pgd_offset(mm, addr)   ((mm)->pgd + pgd_index(addr))
 
+#ifndef __PAGETABLE_PMD_FOLDED
 static inline unsigned long pud_page_vaddr(pud_t pud)
 {
        return pud_val(pud);
@@ -208,6 +241,7 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
 {
        return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
 }
+#endif
 
 /* Find an entry in the third-level page table.. */
 #define __pte_offset(address)                                          \
index 1073e6df8621038a4fc921d4e18b7a79b7e89f01..e9fe7e97ce4cbf23f9bb198a9c351b92005346f7 100644 (file)
@@ -50,7 +50,7 @@
 #define _CACHE_SHIFT                3
 #define _CACHE_MASK                 (7<<3)
 
-#else
+#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
 
 #define _PAGE_PRESENT               (1<<0)  /* implemented in software */
 #define _PAGE_READ                  (1<<1)  /* implemented in software */
@@ -59,8 +59,6 @@
 #define _PAGE_MODIFIED              (1<<4)  /* implemented in software */
 #define _PAGE_FILE                  (1<<4)  /* set:pagecache unset:swap */
 
-#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
-
 #define _PAGE_GLOBAL                (1<<8)
 #define _PAGE_VALID                 (1<<9)
 #define _PAGE_SILENT_READ           (1<<9)  /* synonym                 */
 #define _CACHE_UNCACHED             (1<<11)
 #define _CACHE_MASK                 (1<<11)
 
+#else /* 'Normal' r4K case */
+/*
+ * When using the RI/XI bit support, we have 13 bits of flags below
+ * the physical address. The RI/XI bits are placed such that a SRL 5
+ * can strip off the software bits, then a ROTR 2 can move the RI/XI
+ * into bits [63:62]. This also limits physical address to 56 bits,
+ * which is more than we need right now.
+ */
+
+/* implemented in software */
+#define _PAGE_PRESENT_SHIFT    (0)
+#define _PAGE_PRESENT          (1 << _PAGE_PRESENT_SHIFT)
+/* implemented in software, should be unused if kernel_uses_smartmips_rixi. */
+#define _PAGE_READ_SHIFT       (kernel_uses_smartmips_rixi ? _PAGE_PRESENT_SHIFT : _PAGE_PRESENT_SHIFT + 1)
+#define _PAGE_READ ({if (kernel_uses_smartmips_rixi) BUG(); 1 << _PAGE_READ_SHIFT; })
+/* implemented in software */
+#define _PAGE_WRITE_SHIFT      (_PAGE_READ_SHIFT + 1)
+#define _PAGE_WRITE            (1 << _PAGE_WRITE_SHIFT)
+/* implemented in software */
+#define _PAGE_ACCESSED_SHIFT   (_PAGE_WRITE_SHIFT + 1)
+#define _PAGE_ACCESSED         (1 << _PAGE_ACCESSED_SHIFT)
+/* implemented in software */
+#define _PAGE_MODIFIED_SHIFT   (_PAGE_ACCESSED_SHIFT + 1)
+#define _PAGE_MODIFIED         (1 << _PAGE_MODIFIED_SHIFT)
+/* set:pagecache unset:swap */
+#define _PAGE_FILE             (_PAGE_MODIFIED)
+
+#ifdef CONFIG_HUGETLB_PAGE
+/* huge tlb page */
+#define _PAGE_HUGE_SHIFT       (_PAGE_MODIFIED_SHIFT + 1)
+#define _PAGE_HUGE             (1 << _PAGE_HUGE_SHIFT)
 #else
+#define _PAGE_HUGE_SHIFT       (_PAGE_MODIFIED_SHIFT)
+#define _PAGE_HUGE             ({BUG(); 1; })  /* Dummy value */
+#endif
 
-#define _PAGE_R4KBUG                (1<<5)  /* workaround for r4k bug  */
-#define _PAGE_HUGE                  (1<<5)  /* huge tlb page */
-#define _PAGE_GLOBAL                (1<<6)
-#define _PAGE_VALID                 (1<<7)
-#define _PAGE_SILENT_READ           (1<<7)  /* synonym                 */
-#define _PAGE_DIRTY                 (1<<8)  /* The MIPS dirty bit      */
-#define _PAGE_SILENT_WRITE          (1<<8)
-#define _CACHE_SHIFT               9
-#define _CACHE_MASK                 (7<<9)
+/* Page cannot be executed */
+#define _PAGE_NO_EXEC_SHIFT    (kernel_uses_smartmips_rixi ? _PAGE_HUGE_SHIFT + 1 : _PAGE_HUGE_SHIFT)
+#define _PAGE_NO_EXEC          ({if (!kernel_uses_smartmips_rixi) BUG(); 1 << _PAGE_NO_EXEC_SHIFT; })
+
+/* Page cannot be read */
+#define _PAGE_NO_READ_SHIFT    (kernel_uses_smartmips_rixi ? _PAGE_NO_EXEC_SHIFT + 1 : _PAGE_NO_EXEC_SHIFT)
+#define _PAGE_NO_READ          ({if (!kernel_uses_smartmips_rixi) BUG(); 1 << _PAGE_NO_READ_SHIFT; })
+
+#define _PAGE_GLOBAL_SHIFT     (_PAGE_NO_READ_SHIFT + 1)
+#define _PAGE_GLOBAL           (1 << _PAGE_GLOBAL_SHIFT)
+
+#define _PAGE_VALID_SHIFT      (_PAGE_GLOBAL_SHIFT + 1)
+#define _PAGE_VALID            (1 << _PAGE_VALID_SHIFT)
+/* synonym                 */
+#define _PAGE_SILENT_READ      (_PAGE_VALID)
+
+/* The MIPS dirty bit      */
+#define _PAGE_DIRTY_SHIFT      (_PAGE_VALID_SHIFT + 1)
+#define _PAGE_DIRTY            (1 << _PAGE_DIRTY_SHIFT)
+#define _PAGE_SILENT_WRITE     (_PAGE_DIRTY)
+
+#define _CACHE_SHIFT           (_PAGE_DIRTY_SHIFT + 1)
+#define _CACHE_MASK            (7 << _CACHE_SHIFT)
+
+#define _PFN_SHIFT             (PAGE_SHIFT - 12 + _CACHE_SHIFT + 3)
 
-#endif
 #endif /* defined(CONFIG_64BIT_PHYS_ADDR && defined(CONFIG_CPU_MIPS32) */
 
+#ifndef _PFN_SHIFT
+#define _PFN_SHIFT                  PAGE_SHIFT
+#endif
+#define _PFN_MASK              (~((1 << (_PFN_SHIFT)) - 1))
+
+#ifndef _PAGE_NO_READ
+#define _PAGE_NO_READ ({BUG(); 0; })
+#define _PAGE_NO_READ_SHIFT ({BUG(); 0; })
+#endif
+#ifndef _PAGE_NO_EXEC
+#define _PAGE_NO_EXEC ({BUG(); 0; })
+#endif
+#ifndef _PAGE_GLOBAL_SHIFT
+#define _PAGE_GLOBAL_SHIFT ilog2(_PAGE_GLOBAL)
+#endif
+
+
+#ifndef __ASSEMBLY__
+/*
+ * pte_to_entrylo converts a page table entry (PTE) into a Mips
+ * entrylo0/1 value.
+ */
+static inline uint64_t pte_to_entrylo(unsigned long pte_val)
+{
+       if (kernel_uses_smartmips_rixi) {
+               int sa;
+#ifdef CONFIG_32BIT
+               sa = 31 - _PAGE_NO_READ_SHIFT;
+#else
+               sa = 63 - _PAGE_NO_READ_SHIFT;
+#endif
+               /*
+                * C has no way to express that this is a DSRL
+                * _PAGE_NO_EXEC_SHIFT followed by a ROTR 2.  Luckily
+                * in the fast path this is done in assembly
+                */
+               return (pte_val >> _PAGE_GLOBAL_SHIFT) |
+                       ((pte_val & (_PAGE_NO_EXEC | _PAGE_NO_READ)) << sa);
+       }
+
+       return pte_val >> _PAGE_GLOBAL_SHIFT;
+}
+#endif
 
 /*
  * Cache attributes
 
 #endif
 
-#define __READABLE     (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
+#define __READABLE     (_PAGE_SILENT_READ | _PAGE_ACCESSED | (kernel_uses_smartmips_rixi ? 0 : _PAGE_READ))
 #define __WRITEABLE    (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
 
-#define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
+#define _PAGE_CHG_MASK  (_PFN_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
 
 #endif /* _ASM_PGTABLE_BITS_H */
index 1854336e56a299d70e1b9b045edc93334f2829bf..93598ba013556eaccdf5c37b6551d9111afd1683 100644 (file)
@@ -22,23 +22,24 @@ struct mm_struct;
 struct vm_area_struct;
 
 #define PAGE_NONE      __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
-#define PAGE_SHARED    __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
+#define PAGE_SHARED    __pgprot(_PAGE_PRESENT | _PAGE_WRITE | (kernel_uses_smartmips_rixi ? 0 : _PAGE_READ) | \
                                 _page_cachable_default)
-#define PAGE_COPY      __pgprot(_PAGE_PRESENT | _PAGE_READ | \
-                                _page_cachable_default)
-#define PAGE_READONLY  __pgprot(_PAGE_PRESENT | _PAGE_READ | \
+#define PAGE_COPY      __pgprot(_PAGE_PRESENT | (kernel_uses_smartmips_rixi ? 0 : _PAGE_READ) | \
+                                (kernel_uses_smartmips_rixi ?  _PAGE_NO_EXEC : 0) | _page_cachable_default)
+#define PAGE_READONLY  __pgprot(_PAGE_PRESENT | (kernel_uses_smartmips_rixi ? 0 : _PAGE_READ) | \
                                 _page_cachable_default)
 #define PAGE_KERNEL    __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
                                 _PAGE_GLOBAL | _page_cachable_default)
-#define PAGE_USERIO    __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
+#define PAGE_USERIO    __pgprot(_PAGE_PRESENT | (kernel_uses_smartmips_rixi ? 0 : _PAGE_READ) | _PAGE_WRITE | \
                                 _page_cachable_default)
 #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \
                        __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
 
 /*
- * MIPS can't do page protection for execute, and considers that the same like
- * read. Also, write permissions imply read permissions. This is the closest
- * we can get by reasonable means..
+ * If _PAGE_NO_EXEC is not defined, we can't do page protection for
+ * execute, and consider it to be the same as read. Also, write
+ * permissions imply read permissions. This is the closest we can get
+ * by reasonable means..
  */
 
 /*
@@ -177,7 +178,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
  */
 #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
 
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 /*
  * (puds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
@@ -298,8 +299,13 @@ static inline pte_t pte_mkdirty(pte_t pte)
 static inline pte_t pte_mkyoung(pte_t pte)
 {
        pte_val(pte) |= _PAGE_ACCESSED;
-       if (pte_val(pte) & _PAGE_READ)
-               pte_val(pte) |= _PAGE_SILENT_READ;
+       if (kernel_uses_smartmips_rixi) {
+               if (!(pte_val(pte) & _PAGE_NO_READ))
+                       pte_val(pte) |= _PAGE_SILENT_READ;
+       } else {
+               if (pte_val(pte) & _PAGE_READ)
+                       pte_val(pte) |= _PAGE_SILENT_READ;
+       }
        return pte;
 }
 
index 14ca7dc382a8e037ddc27b96f81d14971ccc18b1..54ef1a96d7ceb9fe37299e789101cd7b794a6485 100644 (file)
 #define ZSP_DUET               'D'     /* one DUET zsp engine */
 #define ZSP_TRIAD              'T'     /* two TRIAD zsp engines */
 
-extern char *prom_getcmdline(void);
 extern char *prom_getenv(char *name);
 extern void prom_init_cmdline(void);
 extern void prom_meminit(void);
index c07ebd8eb9e78e55fe517769c2ad4e79d2283bf0..a0cb0caff15241a41973f67b68756510b8bfe90e 100644 (file)
@@ -1,22 +1 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1999 by Ralf Baechle
- * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
- */
-#ifndef _ASM_SERIAL_H
-#define _ASM_SERIAL_H
-
-
-/*
- * This assumes you have a 1.8432 MHz clock for your UART.
- *
- * It'd be nice if someone built a serial card with a 24.576 MHz
- * clock, since the 16550A is capable of handling a top speed of 1.5
- * megabits/second; but this requires the faster clock.
- */
-#define BASE_BAUD (1843200 / 16)
-
-#endif /* _ASM_SERIAL_H */
+#include <asm-generic/serial.h>
index 63741ca1e422ebfd3970adb70fa692c52c1f35dc..2a2f1bddc276c0a0750943a820169cf6dc5b4b0a 100644 (file)
@@ -33,14 +33,6 @@ extern int prom_flags;
 extern void prom_putchar(char c);
 extern char prom_getchar(void);
 
-/* Memory descriptor management. */
-#define PROM_MAX_PMEMBLOCKS    32
-struct prom_pmemblock {
-       LONG    base;           /* Within KSEG0 or XKPHYS. */
-       ULONG   size;           /* In bytes. */
-       ULONG   type;           /* free or prom memory */
-};
-
 /* Get next memory descriptor after CURR, returns first descriptor
  * in chain is CURR is NULL.
  */
@@ -51,7 +43,6 @@ extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
  * array.
  */
 extern void prom_meminit(void);
-extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
 
 /* PROM device tree library routines. */
 #define PROM_NULL_COMPONENT ((pcomponent *) 0)
@@ -62,20 +53,6 @@ extern pcomponent *ArcGetPeer(pcomponent *this);
 /* Get child component of THIS. */
 extern pcomponent *ArcGetChild(pcomponent *this);
 
-/* Get parent component of CHILD. */
-extern pcomponent *prom_getparent(pcomponent *child);
-
-/* Copy component opaque data of component THIS into BUFFER
- * if component THIS has opaque data.  Returns success or
- * failure status.
- */
-extern long prom_getcdata(void *buffer, pcomponent *this);
-
-/* Other misc. component routines. */
-extern pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data);
-extern long prom_delcomponent(pcomponent *this);
-extern pcomponent *prom_componentbypath(char *path);
-
 /* This is called at prom_init time to identify the
  * ARC architecture we are running on
  */
@@ -88,35 +65,13 @@ extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
 /* ARCS command line parsing. */
 extern void prom_init_cmdline(void);
 
-/* Acquiring info about the current time, etc. */
-extern struct linux_tinfo *prom_gettinfo(void);
-extern unsigned long prom_getrtime(void);
-
 /* File operations. */
-extern long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt);
-extern long prom_open(char *name, enum linux_omode md, unsigned long *fd);
-extern long prom_close(unsigned long fd);
 extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
-extern long prom_getrstatus(unsigned long fd);
 extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
-extern long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm);
-extern long prom_mount(char *name, enum linux_mountops op);
-extern long prom_getfinfo(unsigned long fd, struct linux_finfo *buf);
-extern long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk);
-
-/* Running stand-along programs. */
-extern long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr);
-extern long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp);
-extern long prom_exec(char *name, long argc, char **argv, char **envp);
 
 /* Misc. routines. */
-extern VOID prom_halt(VOID) __attribute__((noreturn));
-extern VOID prom_powerdown(VOID) __attribute__((noreturn));
-extern VOID prom_restart(VOID) __attribute__((noreturn));
 extern VOID ArcReboot(VOID) __attribute__((noreturn));
 extern VOID ArcEnterInteractiveMode(VOID) __attribute__((noreturn));
-extern long prom_cfgsave(VOID);
-extern struct linux_sysid *prom_getsysid(VOID);
 extern VOID ArcFlushAllCaches(VOID);
 extern DISPLAY_STATUS *ArcGetDisplayStatus(ULONG FileID);
 
index ebefe797fc1d5dde93379da55bae6284d6aad148..2d1a26d3436adcd2bddaaff4583030f1dbcc8391 100644 (file)
@@ -46,4 +46,3 @@
 #endif
 
 #endif /* __ASM_SIBYTE_BIGSUR_H */
-
index 081e8b1c4ad02eb5128c9df2fc25c2b6361f00f3..1e76cf13799571d3411c4b4afbe14fd203a16393 100644 (file)
 #endif /* 1250 PASS2 || 112x PASS1 */
 
 #endif
-
index 5de4c5e8ab305e093ded4304aa4e56a117f818e4..6af25ba41ade8be3821c0e7b0728e91d373d7282 100644 (file)
@@ -26,4 +26,3 @@ typedef struct kern_vars_s {
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_SN_KLKERNVARS_H */
-
index 795ac6c23203ad21815153f8c36115999dd687ab..7165333ad043b4ac22fa3304cb711f4e371e1cf0 100644 (file)
@@ -11,4 +11,3 @@
 
 #endif /* CONFIG_SPARSEMEM */
 #endif /* _MIPS_SPARSEMEM_H */
-
index 21ef9efbde43f9e61cf726961e81e91c7252d6b5..396e402fbe2c2915c4313fcd92e70881bfc8c985 100644 (file)
@@ -36,9 +36,9 @@
 
 static inline int arch_spin_is_locked(arch_spinlock_t *lock)
 {
-       unsigned int counters = ACCESS_ONCE(lock->lock);
+       u32 counters = ACCESS_ONCE(lock->lock);
 
-       return ((counters >> 14) ^ counters) & 0x1fff;
+       return ((counters >> 16) ^ counters) & 0xffff;
 }
 
 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
@@ -47,9 +47,9 @@ static inline int arch_spin_is_locked(arch_spinlock_t *lock)
 
 static inline int arch_spin_is_contended(arch_spinlock_t *lock)
 {
-       unsigned int counters = ACCESS_ONCE(lock->lock);
+       u32 counters = ACCESS_ONCE(lock->lock);
 
-       return (((counters >> 14) - counters) & 0x1fff) > 1;
+       return (((counters >> 16) - counters) & 0xffff) > 1;
 }
 #define arch_spin_is_contended arch_spin_is_contended
 
@@ -57,6 +57,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
 {
        int my_ticket;
        int tmp;
+       int inc = 0x10000;
 
        if (R10000_LLSC_WAR) {
                __asm__ __volatile__ (
@@ -64,25 +65,24 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
                "       .set noreorder                                  \n"
                "                                                       \n"
                "1:     ll      %[ticket], %[ticket_ptr]                \n"
-               "       addiu   %[my_ticket], %[ticket], 0x4000         \n"
+               "       addu    %[my_ticket], %[ticket], %[inc]         \n"
                "       sc      %[my_ticket], %[ticket_ptr]             \n"
                "       beqzl   %[my_ticket], 1b                        \n"
                "        nop                                            \n"
-               "       srl     %[my_ticket], %[ticket], 14             \n"
-               "       andi    %[my_ticket], %[my_ticket], 0x1fff      \n"
-               "       andi    %[ticket], %[ticket], 0x1fff            \n"
+               "       srl     %[my_ticket], %[ticket], 16             \n"
+               "       andi    %[ticket], %[ticket], 0xffff            \n"
+               "       andi    %[my_ticket], %[my_ticket], 0xffff      \n"
                "       bne     %[ticket], %[my_ticket], 4f             \n"
                "        subu   %[ticket], %[my_ticket], %[ticket]      \n"
                "2:                                                     \n"
                "       .subsection 2                                   \n"
-               "4:     andi    %[ticket], %[ticket], 0x1fff            \n"
+               "4:     andi    %[ticket], %[ticket], 0xffff            \n"
                "       sll     %[ticket], 5                            \n"
                "                                                       \n"
                "6:     bnez    %[ticket], 6b                           \n"
                "        subu   %[ticket], 1                            \n"
                "                                                       \n"
-               "       lw      %[ticket], %[ticket_ptr]                \n"
-               "       andi    %[ticket], %[ticket], 0x1fff            \n"
+               "       lhu     %[ticket], %[serving_now_ptr]           \n"
                "       beq     %[ticket], %[my_ticket], 2b             \n"
                "        subu   %[ticket], %[my_ticket], %[ticket]      \n"
                "       b       4b                                      \n"
@@ -90,36 +90,33 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
                "       .previous                                       \n"
                "       .set pop                                        \n"
                : [ticket_ptr] "+m" (lock->lock),
+                 [serving_now_ptr] "+m" (lock->h.serving_now),
                  [ticket] "=&r" (tmp),
-                 [my_ticket] "=&r" (my_ticket));
+                 [my_ticket] "=&r" (my_ticket)
+               : [inc] "r" (inc));
        } else {
                __asm__ __volatile__ (
                "       .set push               # arch_spin_lock        \n"
                "       .set noreorder                                  \n"
                "                                                       \n"
-               "       ll      %[ticket], %[ticket_ptr]                \n"
-               "1:     addiu   %[my_ticket], %[ticket], 0x4000         \n"
+               "1:     ll      %[ticket], %[ticket_ptr]                \n"
+               "       addu    %[my_ticket], %[ticket], %[inc]         \n"
                "       sc      %[my_ticket], %[ticket_ptr]             \n"
-               "       beqz    %[my_ticket], 3f                        \n"
-               "        nop                                            \n"
-               "       srl     %[my_ticket], %[ticket], 14             \n"
-               "       andi    %[my_ticket], %[my_ticket], 0x1fff      \n"
-               "       andi    %[ticket], %[ticket], 0x1fff            \n"
+               "       beqz    %[my_ticket], 1b                        \n"
+               "        srl    %[my_ticket], %[ticket], 16             \n"
+               "       andi    %[ticket], %[ticket], 0xffff            \n"
+               "       andi    %[my_ticket], %[my_ticket], 0xffff      \n"
                "       bne     %[ticket], %[my_ticket], 4f             \n"
                "        subu   %[ticket], %[my_ticket], %[ticket]      \n"
                "2:                                                     \n"
                "       .subsection 2                                   \n"
-               "3:     b       1b                                      \n"
-               "        ll     %[ticket], %[ticket_ptr]                \n"
-               "                                                       \n"
                "4:     andi    %[ticket], %[ticket], 0x1fff            \n"
                "       sll     %[ticket], 5                            \n"
                "                                                       \n"
                "6:     bnez    %[ticket], 6b                           \n"
                "        subu   %[ticket], 1                            \n"
                "                                                       \n"
-               "       lw      %[ticket], %[ticket_ptr]                \n"
-               "       andi    %[ticket], %[ticket], 0x1fff            \n"
+               "       lhu     %[ticket], %[serving_now_ptr]           \n"
                "       beq     %[ticket], %[my_ticket], 2b             \n"
                "        subu   %[ticket], %[my_ticket], %[ticket]      \n"
                "       b       4b                                      \n"
@@ -127,8 +124,10 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
                "       .previous                                       \n"
                "       .set pop                                        \n"
                : [ticket_ptr] "+m" (lock->lock),
+                 [serving_now_ptr] "+m" (lock->h.serving_now),
                  [ticket] "=&r" (tmp),
-                 [my_ticket] "=&r" (my_ticket));
+                 [my_ticket] "=&r" (my_ticket)
+               : [inc] "r" (inc));
        }
 
        smp_llsc_mb();
@@ -136,47 +135,16 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
 
 static inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
-       int tmp;
-
-       smp_llsc_mb();
-
-       if (R10000_LLSC_WAR) {
-               __asm__ __volatile__ (
-               "                               # arch_spin_unlock      \n"
-               "1:     ll      %[ticket], %[ticket_ptr]                \n"
-               "       addiu   %[ticket], %[ticket], 1                 \n"
-               "       ori     %[ticket], %[ticket], 0x2000            \n"
-               "       xori    %[ticket], %[ticket], 0x2000            \n"
-               "       sc      %[ticket], %[ticket_ptr]                \n"
-               "       beqzl   %[ticket], 1b                           \n"
-               : [ticket_ptr] "+m" (lock->lock),
-                 [ticket] "=&r" (tmp));
-       } else {
-               __asm__ __volatile__ (
-               "       .set push               # arch_spin_unlock      \n"
-               "       .set noreorder                                  \n"
-               "                                                       \n"
-               "       ll      %[ticket], %[ticket_ptr]                \n"
-               "1:     addiu   %[ticket], %[ticket], 1                 \n"
-               "       ori     %[ticket], %[ticket], 0x2000            \n"
-               "       xori    %[ticket], %[ticket], 0x2000            \n"
-               "       sc      %[ticket], %[ticket_ptr]                \n"
-               "       beqz    %[ticket], 2f                           \n"
-               "        nop                                            \n"
-               "                                                       \n"
-               "       .subsection 2                                   \n"
-               "2:     b       1b                                      \n"
-               "        ll     %[ticket], %[ticket_ptr]                \n"
-               "       .previous                                       \n"
-               "       .set pop                                        \n"
-               : [ticket_ptr] "+m" (lock->lock),
-                 [ticket] "=&r" (tmp));
-       }
+       unsigned int serving_now = lock->h.serving_now + 1;
+       wmb();
+       lock->h.serving_now = (u16)serving_now;
+       nudge_writes();
 }
 
 static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
 {
        int tmp, tmp2, tmp3;
+       int inc = 0x10000;
 
        if (R10000_LLSC_WAR) {
                __asm__ __volatile__ (
@@ -184,11 +152,11 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
                "       .set noreorder                                  \n"
                "                                                       \n"
                "1:     ll      %[ticket], %[ticket_ptr]                \n"
-               "       srl     %[my_ticket], %[ticket], 14             \n"
-               "       andi    %[my_ticket], %[my_ticket], 0x1fff      \n"
-               "       andi    %[now_serving], %[ticket], 0x1fff       \n"
+               "       srl     %[my_ticket], %[ticket], 16             \n"
+               "       andi    %[my_ticket], %[my_ticket], 0xffff      \n"
+               "       andi    %[now_serving], %[ticket], 0xffff       \n"
                "       bne     %[my_ticket], %[now_serving], 3f        \n"
-               "        addiu  %[ticket], %[ticket], 0x4000            \n"
+               "        addu   %[ticket], %[ticket], %[inc]            \n"
                "       sc      %[ticket], %[ticket_ptr]                \n"
                "       beqzl   %[ticket], 1b                           \n"
                "        li     %[ticket], 1                            \n"
@@ -201,33 +169,33 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
                : [ticket_ptr] "+m" (lock->lock),
                  [ticket] "=&r" (tmp),
                  [my_ticket] "=&r" (tmp2),
-                 [now_serving] "=&r" (tmp3));
+                 [now_serving] "=&r" (tmp3)
+               : [inc] "r" (inc));
        } else {
                __asm__ __volatile__ (
                "       .set push               # arch_spin_trylock     \n"
                "       .set noreorder                                  \n"
                "                                                       \n"
-               "       ll      %[ticket], %[ticket_ptr]                \n"
-               "1:     srl     %[my_ticket], %[ticket], 14             \n"
-               "       andi    %[my_ticket], %[my_ticket], 0x1fff      \n"
-               "       andi    %[now_serving], %[ticket], 0x1fff       \n"
+               "1:     ll      %[ticket], %[ticket_ptr]                \n"
+               "       srl     %[my_ticket], %[ticket], 16             \n"
+               "       andi    %[my_ticket], %[my_ticket], 0xffff      \n"
+               "       andi    %[now_serving], %[ticket], 0xffff       \n"
                "       bne     %[my_ticket], %[now_serving], 3f        \n"
-               "        addiu  %[ticket], %[ticket], 0x4000            \n"
+               "        addu   %[ticket], %[ticket], %[inc]            \n"
                "       sc      %[ticket], %[ticket_ptr]                \n"
-               "       beqz    %[ticket], 4f                           \n"
+               "       beqz    %[ticket], 1b                           \n"
                "        li     %[ticket], 1                            \n"
                "2:                                                     \n"
                "       .subsection 2                                   \n"
                "3:     b       2b                                      \n"
                "        li     %[ticket], 0                            \n"
-               "4:     b       1b                                      \n"
-               "        ll     %[ticket], %[ticket_ptr]                \n"
                "       .previous                                       \n"
                "       .set pop                                        \n"
                : [ticket_ptr] "+m" (lock->lock),
                  [ticket] "=&r" (tmp),
                  [my_ticket] "=&r" (tmp2),
-                 [now_serving] "=&r" (tmp3));
+                 [now_serving] "=&r" (tmp3)
+               : [inc] "r" (inc));
        }
 
        smp_llsc_mb();
@@ -305,7 +273,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
 {
        unsigned int tmp;
 
-       smp_llsc_mb();
+       smp_mb__before_llsc();
 
        if (R10000_LLSC_WAR) {
                __asm__ __volatile__(
index ee197c2f9c98725985d99289dc20f6e3a5110738..c52f36013a9da4e77b7307ca61b233be10ad974b 100644 (file)
@@ -5,16 +5,28 @@
 # error "please don't include this file directly"
 #endif
 
-typedef struct {
+#include <linux/types.h>
+
+#include <asm/byteorder.h>
+
+typedef union {
        /*
-        * bits  0..13: serving_now
-        * bits 14    : junk data
-        * bits 15..28: ticket
+        * bits  0..15 : serving_now
+        * bits 16..31 : ticket
         */
-       unsigned int lock;
+       u32 lock;
+       struct {
+#ifdef __BIG_ENDIAN
+               u16 ticket;
+               u16 serving_now;
+#else
+               u16 serving_now;
+               u16 ticket;
+#endif
+       } h;
 } arch_spinlock_t;
 
-#define __ARCH_SPIN_LOCK_UNLOCKED      { 0 }
+#define __ARCH_SPIN_LOCK_UNLOCKED      { .lock = 0 }
 
 typedef struct {
        volatile unsigned int lock;
index 83b5509e09e8cf99a6bd966ee991ce0234806566..bb937ccfba1ea92507214309cf21d8d54d03fd6e 100644 (file)
@@ -95,6 +95,8 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
 {
        __u32 retval;
 
+       smp_mb__before_llsc();
+
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                unsigned long dummy;
 
@@ -147,6 +149,8 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
 {
        __u64 retval;
 
+       smp_mb__before_llsc();
+
        if (kernel_uses_llsc && R10000_LLSC_WAR) {
                unsigned long dummy;
 
index 827dc22be2ea0f9c343540cde1eb71edf231ddf6..64887d3c7ec3200d8e812d8befbd5c5537d28ce5 100644 (file)
@@ -42,7 +42,6 @@ struct txx9_board_vec {
 };
 extern struct txx9_board_vec *txx9_board_vec;
 extern int (*txx9_irq_dispatch)(int pending);
-char *prom_getcmdline(void);
 const char *prom_getenv(const char *name);
 void txx9_wdt_init(unsigned long base);
 void txx9_wdt_now(unsigned long base);
similarity index 97%
rename from arch/mips/mm/uasm.h
rename to arch/mips/include/asm/uasm.h
index 3d153edaa51ec28c95da7166fa824c7e9f45d184..b99bd07e199b541fe17ff8489480aa20125b0ac2 100644 (file)
@@ -92,9 +92,11 @@ Ip_u2s3u1(_sd);
 Ip_u2u1u3(_sll);
 Ip_u2u1u3(_sra);
 Ip_u2u1u3(_srl);
+Ip_u2u1u3(_rotr);
 Ip_u3u1u2(_subu);
 Ip_u2s3u1(_sw);
 Ip_0(_tlbp);
+Ip_0(_tlbr);
 Ip_0(_tlbwi);
 Ip_0(_tlbwr);
 Ip_u3u1u2(_xor);
@@ -129,6 +131,7 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
 # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh)
 # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh)
 # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh)
+# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh)
 # define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd)
 # define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd)
 # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val)
@@ -142,6 +145,7 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
 # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh)
 # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh)
 # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
+# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh)
 # define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd)
 # define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd)
 # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val)
index 8a4b20e88b8132d743efecec50593f000d6360c3..9bc07b9f30fba10518b48cadc01d9aa4eaa4260f 100644 (file)
@@ -1,21 +1 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Low level exception handling
- *
- * Copyright (C) 1998, 1999 by Ralf Baechle
- */
-#ifndef _ASM_UCONTEXT_H
-#define _ASM_UCONTEXT_H
-
-struct ucontext {
-       unsigned long     uc_flags;
-       struct ucontext  *uc_link;
-       stack_t           uc_stack;
-       struct sigcontext uc_mcontext;
-       sigset_t          uc_sigmask;   /* mask last for extensibility */
-};
-
-#endif /* _ASM_UCONTEXT_H */
+#include <asm-generic/ucontext.h>
index 7bd32d04c2cc7c0df7867d8e7f6a81385f38ebca..ee18028efe9222ba4c4c9fa54fa37296d3800055 100644 (file)
 #include <asm/jazz.h>
 #include <asm/pgtable.h>
 
-static DEFINE_SPINLOCK(r4030_lock);
+static DEFINE_RAW_SPINLOCK(r4030_lock);
 
 static void enable_r4030_irq(unsigned int irq)
 {
        unsigned int mask = 1 << (irq - JAZZ_IRQ_START);
        unsigned long flags;
 
-       spin_lock_irqsave(&r4030_lock, flags);
+       raw_spin_lock_irqsave(&r4030_lock, flags);
        mask |= r4030_read_reg16(JAZZ_IO_IRQ_ENABLE);
        r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, mask);
-       spin_unlock_irqrestore(&r4030_lock, flags);
+       raw_spin_unlock_irqrestore(&r4030_lock, flags);
 }
 
 void disable_r4030_irq(unsigned int irq)
@@ -38,10 +38,10 @@ void disable_r4030_irq(unsigned int irq)
        unsigned int mask = ~(1 << (irq - JAZZ_IRQ_START));
        unsigned long flags;
 
-       spin_lock_irqsave(&r4030_lock, flags);
+       raw_spin_lock_irqsave(&r4030_lock, flags);
        mask &= r4030_read_reg16(JAZZ_IO_IRQ_ENABLE);
        r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, mask);
-       spin_unlock_irqrestore(&r4030_lock, flags);
+       raw_spin_unlock_irqrestore(&r4030_lock, flags);
 }
 
 static struct irq_chip r4030_irq_type = {
index 9326af5186fe0f8a7a10cb8d69fabe56b7b4082b..ef20957ca14b7af284f604fe321317e5ecc09157 100644 (file)
@@ -93,6 +93,7 @@ obj-$(CONFIG_GPIO_TXX9)               += gpio_txx9.o
 
 obj-$(CONFIG_KEXEC)            += machine_kexec.o relocate_kernel.o
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
+obj-$(CONFIG_SPINLOCK_TEST)    += spinlock_test.o
 
 CFLAGS_cpu-bugs64.o    = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
 
index 2c1e1d02338b23fb935b504aba53cdad6cf6cd8e..ca6c83218caa8df0c49f283593a2c2974315af2e 100644 (file)
@@ -188,11 +188,15 @@ void output_mm_defines(void)
        DEFINE(_PTE_T_SIZE, sizeof(pte_t));
        BLANK();
        DEFINE(_PGD_T_LOG2, PGD_T_LOG2);
+#ifndef __PAGETABLE_PMD_FOLDED
        DEFINE(_PMD_T_LOG2, PMD_T_LOG2);
+#endif
        DEFINE(_PTE_T_LOG2, PTE_T_LOG2);
        BLANK();
        DEFINE(_PGD_ORDER, PGD_ORDER);
+#ifndef __PAGETABLE_PMD_FOLDED
        DEFINE(_PMD_ORDER, PMD_ORDER);
+#endif
        DEFINE(_PTE_ORDER, PTE_ORDER);
        BLANK();
        DEFINE(_PMD_SHIFT, PMD_SHIFT);
index f5d265eb6eae7f5708e53912d06ff63b4f7cd42a..392ef3756c56e0692d46e38cf5647b4f24bac951 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/gt64120.h>
 #include <asm/time.h>
 
-static DEFINE_SPINLOCK(gt641xx_timer_lock);
+static DEFINE_RAW_SPINLOCK(gt641xx_timer_lock);
 static unsigned int gt641xx_base_clock;
 
 void gt641xx_set_base_clock(unsigned int clock)
@@ -49,7 +49,7 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
 {
        u32 ctrl;
 
-       spin_lock(&gt641xx_timer_lock);
+       raw_spin_lock(&gt641xx_timer_lock);
 
        ctrl = GT_READ(GT_TC_CONTROL_OFS);
        ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -58,7 +58,7 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
        GT_WRITE(GT_TC0_OFS, delta);
        GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
 
-       spin_unlock(&gt641xx_timer_lock);
+       raw_spin_unlock(&gt641xx_timer_lock);
 
        return 0;
 }
@@ -68,7 +68,7 @@ static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
 {
        u32 ctrl;
 
-       spin_lock(&gt641xx_timer_lock);
+       raw_spin_lock(&gt641xx_timer_lock);
 
        ctrl = GT_READ(GT_TC_CONTROL_OFS);
        ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -86,7 +86,7 @@ static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
 
        GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
 
-       spin_unlock(&gt641xx_timer_lock);
+       raw_spin_unlock(&gt641xx_timer_lock);
 }
 
 static void gt641xx_timer0_event_handler(struct clock_event_device *dev)
index b469ad05d520c3629348368a3037d07a0ef7a631..0b2450ceb13f1c6aaf0cef071216158b06c3de62 100644 (file)
@@ -97,7 +97,7 @@ void mips_event_handler(struct clock_event_device *dev)
  */
 static int c0_compare_int_pending(void)
 {
-       return (read_c0_cause() >> cp0_compare_irq) & 0x100;
+       return (read_c0_cause() >> cp0_compare_irq_shift) & (1ul << CAUSEB_IP);
 }
 
 /*
index 80e202eca0562ecbbb9a0eba2db38f7ef464602a..be5bb16be4e0a01df31ba41c21298367780eff97 100644 (file)
@@ -162,6 +162,7 @@ void __init check_wait(void)
        case CPU_BCM6348:
        case CPU_BCM6358:
        case CPU_CAVIUM_OCTEON:
+       case CPU_CAVIUM_OCTEON_PLUS:
                cpu_wait = r4k_wait;
                break;
 
@@ -284,6 +285,15 @@ static inline int __cpu_has_fpu(void)
        return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
 }
 
+static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
+{
+#ifdef __NEED_VMBITS_PROBE
+       write_c0_entryhi(0x3fffffffffffe000ULL);
+       back_to_back_c0_hazard();
+       c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
+#endif
+}
+
 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
                | MIPS_CPU_COUNTER)
 
@@ -691,6 +701,19 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
        return config3 & MIPS_CONF_M;
 }
 
+static inline unsigned int decode_config4(struct cpuinfo_mips *c)
+{
+       unsigned int config4;
+
+       config4 = read_c0_config4();
+
+       if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT
+           && cpu_has_tlb)
+               c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
+
+       return config4 & MIPS_CONF_M;
+}
+
 static void __cpuinit decode_configs(struct cpuinfo_mips *c)
 {
        int ok;
@@ -709,6 +732,8 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c)
                ok = decode_config2(c);
        if (ok)
                ok = decode_config3(c);
+       if (ok)
+               ok = decode_config4(c);
 
        mips_probe_watch_registers(c);
 }
@@ -722,9 +747,6 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
                __cpu_name[cpu] = "MIPS 4Kc";
                break;
        case PRID_IMP_4KEC:
-               c->cputype = CPU_4KEC;
-               __cpu_name[cpu] = "MIPS 4KEc";
-               break;
        case PRID_IMP_4KECR2:
                c->cputype = CPU_4KEC;
                __cpu_name[cpu] = "MIPS 4KEc";
@@ -890,12 +912,18 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
        case PRID_IMP_CAVIUM_CN38XX:
        case PRID_IMP_CAVIUM_CN31XX:
        case PRID_IMP_CAVIUM_CN30XX:
+               c->cputype = CPU_CAVIUM_OCTEON;
+               __cpu_name[cpu] = "Cavium Octeon";
+               goto platform;
        case PRID_IMP_CAVIUM_CN58XX:
        case PRID_IMP_CAVIUM_CN56XX:
        case PRID_IMP_CAVIUM_CN50XX:
        case PRID_IMP_CAVIUM_CN52XX:
-               c->cputype = CPU_CAVIUM_OCTEON;
-               __cpu_name[cpu] = "Cavium Octeon";
+               c->cputype = CPU_CAVIUM_OCTEON_PLUS;
+               __cpu_name[cpu] = "Cavium Octeon+";
+platform:
+               if (cpu == 0)
+                       __elf_platform = "octeon";
                break;
        default:
                printk(KERN_INFO "Unknown Octeon chip!\n");
@@ -905,6 +933,7 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
 }
 
 const char *__cpu_name[NR_CPUS];
+const char *__elf_platform;
 
 __cpuinit void cpu_probe(void)
 {
@@ -969,6 +998,8 @@ __cpuinit void cpu_probe(void)
                c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
        else
                c->srsets = 1;
+
+       cpu_probe_vmbits(c);
 }
 
 __cpuinit void cpu_report(void)
index 68b067040d8b20283a30f822458405f43a78a102..e9e64e0ff7aa428470204fca8f9970d73d9c0dac 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
  * Copyright (C) 2009 DSLab, Lanzhou University, China
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  *
  * Thanks goes to Steven Rostedt for writing the original x86 version.
  */
index 01c0885a8061569dffe59d31e7ec7aee97588773..27799113332cfa9c952d7402164201c3acf057c3 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 static int i8259A_auto_eoi = -1;
-DEFINE_SPINLOCK(i8259A_lock);
+DEFINE_RAW_SPINLOCK(i8259A_lock);
 static void disable_8259A_irq(unsigned int irq);
 static void enable_8259A_irq(unsigned int irq);
 static void mask_and_ack_8259A(unsigned int irq);
@@ -65,13 +65,13 @@ static void disable_8259A_irq(unsigned int irq)
 
        irq -= I8259A_IRQ_BASE;
        mask = 1 << irq;
-       spin_lock_irqsave(&i8259A_lock, flags);
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
        cached_irq_mask |= mask;
        if (irq & 8)
                outb(cached_slave_mask, PIC_SLAVE_IMR);
        else
                outb(cached_master_mask, PIC_MASTER_IMR);
-       spin_unlock_irqrestore(&i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
 static void enable_8259A_irq(unsigned int irq)
@@ -81,13 +81,13 @@ static void enable_8259A_irq(unsigned int irq)
 
        irq -= I8259A_IRQ_BASE;
        mask = ~(1 << irq);
-       spin_lock_irqsave(&i8259A_lock, flags);
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
        cached_irq_mask &= mask;
        if (irq & 8)
                outb(cached_slave_mask, PIC_SLAVE_IMR);
        else
                outb(cached_master_mask, PIC_MASTER_IMR);
-       spin_unlock_irqrestore(&i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
 int i8259A_irq_pending(unsigned int irq)
@@ -98,12 +98,12 @@ int i8259A_irq_pending(unsigned int irq)
 
        irq -= I8259A_IRQ_BASE;
        mask = 1 << irq;
-       spin_lock_irqsave(&i8259A_lock, flags);
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
        if (irq < 8)
                ret = inb(PIC_MASTER_CMD) & mask;
        else
                ret = inb(PIC_SLAVE_CMD) & (mask >> 8);
-       spin_unlock_irqrestore(&i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 
        return ret;
 }
@@ -151,7 +151,7 @@ static void mask_and_ack_8259A(unsigned int irq)
 
        irq -= I8259A_IRQ_BASE;
        irqmask = 1 << irq;
-       spin_lock_irqsave(&i8259A_lock, flags);
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
        /*
         * Lightweight spurious IRQ detection. We do not want
         * to overdo spurious IRQ handling - it's usually a sign
@@ -183,7 +183,7 @@ handle_real_irq:
                outb(0x60+irq, PIC_MASTER_CMD); /* 'Specific EOI to master */
        }
        smtc_im_ack_irq(irq);
-       spin_unlock_irqrestore(&i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259A_lock, flags);
        return;
 
 spurious_8259A_irq:
@@ -264,7 +264,7 @@ static void init_8259A(int auto_eoi)
 
        i8259A_auto_eoi = auto_eoi;
 
-       spin_lock_irqsave(&i8259A_lock, flags);
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
 
        outb(0xff, PIC_MASTER_IMR);     /* mask all of 8259A-1 */
        outb(0xff, PIC_SLAVE_IMR);      /* mask all of 8259A-2 */
@@ -298,7 +298,7 @@ static void init_8259A(int auto_eoi)
        outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */
        outb(cached_slave_mask, PIC_SLAVE_IMR);   /* restore slave IRQ mask */
 
-       spin_unlock_irqrestore(&i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
 /*
index ebcc5f7ad9c21e6155413e826613c5dc39c58220..42ef81461bfc2ee5c7354b4858fdcff005de7d61 100644 (file)
 
 #define GT641XX_IRQ_TO_BIT(irq)        (1U << (irq - GT641XX_IRQ_BASE))
 
-static DEFINE_SPINLOCK(gt641xx_irq_lock);
+static DEFINE_RAW_SPINLOCK(gt641xx_irq_lock);
 
 static void ack_gt641xx_irq(unsigned int irq)
 {
        unsigned long flags;
        u32 cause;
 
-       spin_lock_irqsave(&gt641xx_irq_lock, flags);
+       raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
        cause = GT_READ(GT_INTRCAUSE_OFS);
        cause &= ~GT641XX_IRQ_TO_BIT(irq);
        GT_WRITE(GT_INTRCAUSE_OFS, cause);
-       spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
 }
 
 static void mask_gt641xx_irq(unsigned int irq)
@@ -46,11 +46,11 @@ static void mask_gt641xx_irq(unsigned int irq)
        unsigned long flags;
        u32 mask;
 
-       spin_lock_irqsave(&gt641xx_irq_lock, flags);
+       raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
        mask = GT_READ(GT_INTRMASK_OFS);
        mask &= ~GT641XX_IRQ_TO_BIT(irq);
        GT_WRITE(GT_INTRMASK_OFS, mask);
-       spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
 }
 
 static void mask_ack_gt641xx_irq(unsigned int irq)
@@ -58,7 +58,7 @@ static void mask_ack_gt641xx_irq(unsigned int irq)
        unsigned long flags;
        u32 cause, mask;
 
-       spin_lock_irqsave(&gt641xx_irq_lock, flags);
+       raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
        mask = GT_READ(GT_INTRMASK_OFS);
        mask &= ~GT641XX_IRQ_TO_BIT(irq);
        GT_WRITE(GT_INTRMASK_OFS, mask);
@@ -66,7 +66,7 @@ static void mask_ack_gt641xx_irq(unsigned int irq)
        cause = GT_READ(GT_INTRCAUSE_OFS);
        cause &= ~GT641XX_IRQ_TO_BIT(irq);
        GT_WRITE(GT_INTRCAUSE_OFS, cause);
-       spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
 }
 
 static void unmask_gt641xx_irq(unsigned int irq)
@@ -74,11 +74,11 @@ static void unmask_gt641xx_irq(unsigned int irq)
        unsigned long flags;
        u32 mask;
 
-       spin_lock_irqsave(&gt641xx_irq_lock, flags);
+       raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
        mask = GT_READ(GT_INTRMASK_OFS);
        mask |= GT641XX_IRQ_TO_BIT(irq);
        GT_WRITE(GT_INTRMASK_OFS, mask);
-       spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
 }
 
 static struct irq_chip gt641xx_irq_chip = {
index f042563c924f66f9da2ef3a88f4e75032f55871f..bde79ef602e6e84dbdf48c2de52e02907f52eb16 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/file.h>
-#include <linux/smp_lock.h>
 #include <linux/highuid.h>
 #include <linux/resource.h>
 #include <linux/highmem.h>
index 0a9cfdb271dd2c2c92f0cb8f31930f84d73c6127..6851fc97a5111736b88a4a3d6f6c9d3d95ddbe6e 100644 (file)
@@ -6,7 +6,7 @@
  * more details.
  *
  * Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University, China
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  */
 
 #include <asm/regdef.h>
index 3952b8323efac5d3017c86bc99a4b72434fe66d3..dd18b26a358a982a817b9f17b9ba340d5f0ae9e2 100644 (file)
@@ -500,4 +500,3 @@ done_restore:
         nop
        END(octeon_mult_restore)
        .set pop
-
index 364f066cb4979533336a37ea437d424047111402..dcaed1bbbfe5c7e099768a17c9aad126c8c80429 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/vmalloc.h>
 #include <linux/elf.h>
 #include <linux/seq_file.h>
-#include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 #include <linux/moduleloader.h>
 #include <linux/interrupt.h>
diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c
new file mode 100644 (file)
index 0000000..da61134
--- /dev/null
@@ -0,0 +1,141 @@
+#include <linux/init.h>
+#include <linux/kthread.h>
+#include <linux/hrtimer.h>
+#include <linux/fs.h>
+#include <linux/debugfs.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+
+
+static int ss_get(void *data, u64 *val)
+{
+       ktime_t start, finish;
+       int loops;
+       int cont;
+       DEFINE_RAW_SPINLOCK(ss_spin);
+
+       loops = 1000000;
+       cont = 1;
+
+       start = ktime_get();
+
+       while (cont) {
+               raw_spin_lock(&ss_spin);
+               loops--;
+               if (loops == 0)
+                       cont = 0;
+               raw_spin_unlock(&ss_spin);
+       }
+
+       finish = ktime_get();
+
+       *val = ktime_us_delta(finish, start);
+
+       return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n");
+
+
+
+struct spin_multi_state {
+       raw_spinlock_t lock;
+       atomic_t start_wait;
+       atomic_t enter_wait;
+       atomic_t exit_wait;
+       int loops;
+};
+
+struct spin_multi_per_thread {
+       struct spin_multi_state *state;
+       ktime_t start;
+};
+
+static int multi_other(void *data)
+{
+       int loops;
+       int cont;
+       struct spin_multi_per_thread *pt = data;
+       struct spin_multi_state *s = pt->state;
+
+       loops = s->loops;
+       cont = 1;
+
+       atomic_dec(&s->enter_wait);
+
+       while (atomic_read(&s->enter_wait))
+               ; /* spin */
+
+       pt->start = ktime_get();
+
+       atomic_dec(&s->start_wait);
+
+       while (atomic_read(&s->start_wait))
+               ; /* spin */
+
+       while (cont) {
+               raw_spin_lock(&s->lock);
+               loops--;
+               if (loops == 0)
+                       cont = 0;
+               raw_spin_unlock(&s->lock);
+       }
+
+       atomic_dec(&s->exit_wait);
+       while (atomic_read(&s->exit_wait))
+               ; /* spin */
+       return 0;
+}
+
+static int multi_get(void *data, u64 *val)
+{
+       ktime_t finish;
+       struct spin_multi_state ms;
+       struct spin_multi_per_thread t1, t2;
+
+       ms.lock = __RAW_SPIN_LOCK_UNLOCKED("multi_get");
+       ms.loops = 1000000;
+
+       atomic_set(&ms.start_wait, 2);
+       atomic_set(&ms.enter_wait, 2);
+       atomic_set(&ms.exit_wait, 2);
+       t1.state = &ms;
+       t2.state = &ms;
+
+       kthread_run(multi_other, &t2, "multi_get");
+
+       multi_other(&t1);
+
+       finish = ktime_get();
+
+       *val = ktime_us_delta(finish, t1.start);
+
+       return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
+
+
+extern struct dentry *mips_debugfs_dir;
+static int __init spinlock_test(void)
+{
+       struct dentry *d;
+
+       if (!mips_debugfs_dir)
+               return -ENODEV;
+
+       d = debugfs_create_file("spin_single", S_IRUGO,
+                               mips_debugfs_dir, NULL,
+                               &fops_ss);
+       if (!d)
+               return -ENOMEM;
+
+       d = debugfs_create_file("spin_multi", S_IRUGO,
+                               mips_debugfs_dir, NULL,
+                               &fops_multi);
+       if (!d)
+               return -ENOMEM;
+
+       return 0;
+}
+device_initcall(spinlock_test);
index 308e434608647a2b1f1df35a8486bb9c3275f25e..4e00f9bc23ee99e333685f176800275941577a3c 100644 (file)
@@ -50,6 +50,7 @@
 #include <asm/types.h>
 #include <asm/stacktrace.h>
 #include <asm/irq.h>
+#include <asm/uasm.h>
 
 extern void check_wait(void);
 extern asmlinkage void r4k_wait(void);
@@ -1271,21 +1272,25 @@ unsigned long ebase;
 unsigned long exception_handlers[32];
 unsigned long vi_handlers[64];
 
-/*
- * As a side effect of the way this is implemented we're limited
- * to interrupt handlers in the address range from
- * KSEG0 <= x < KSEG0 + 256mb on the Nevada.  Oh well ...
- */
-void *set_except_vector(int n, void *addr)
+void __init *set_except_vector(int n, void *addr)
 {
        unsigned long handler = (unsigned long) addr;
        unsigned long old_handler = exception_handlers[n];
 
        exception_handlers[n] = handler;
        if (n == 0 && cpu_has_divec) {
-               *(u32 *)(ebase + 0x200) = 0x08000000 |
-                                         (0x03ffffff & (handler >> 2));
-               local_flush_icache_range(ebase + 0x200, ebase + 0x204);
+               unsigned long jump_mask = ~((1 << 28) - 1);
+               u32 *buf = (u32 *)(ebase + 0x200);
+               unsigned int k0 = 26;
+               if ((handler & jump_mask) == ((ebase + 0x200) & jump_mask)) {
+                       uasm_i_j(&buf, handler & ~jump_mask);
+                       uasm_i_nop(&buf);
+               } else {
+                       UASM_i_LA(&buf, k0, handler);
+                       uasm_i_jr(&buf, k0);
+                       uasm_i_nop(&buf);
+               }
+               local_flush_icache_range(ebase + 0x200, (unsigned long)buf);
        }
        return (void *)old_handler;
 }
@@ -1403,6 +1408,7 @@ extern void flush_tlb_handlers(void);
  * Timer interrupt
  */
 int cp0_compare_irq;
+int cp0_compare_irq_shift;
 
 /*
  * Performance counter IRQ or -1 if shared with timer
@@ -1493,12 +1499,14 @@ void __cpuinit per_cpu_trap_init(void)
         *  o read IntCtl.IPPCI to determine the performance counter interrupt
         */
        if (cpu_has_mips_r2) {
-               cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
-               cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
+               cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP;
+               cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7;
+               cp0_perfcount_irq = (read_c0_intctl() >> INTCTLB_IPPCI) & 7;
                if (cp0_perfcount_irq == cp0_compare_irq)
                        cp0_perfcount_irq = -1;
        } else {
                cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
+               cp0_compare_irq_shift = cp0_compare_irq;
                cp0_perfcount_irq = -1;
        }
 
index 60477529362eb004945808cef384ee30ed3573f6..2bd2151c586a9c219e3eb1a574f65f0105589774 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/vmalloc.h>
 #include <linux/elf.h>
 #include <linux/seq_file.h>
-#include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 #include <linux/moduleloader.h>
 #include <linux/interrupt.h>
index 91df553711279b76054d5eac4a69b12f83110209..2f0757738fdb2d777c253426856fd58230b18d26 100644 (file)
@@ -42,4 +42,3 @@ void pvc_move(u8 cmd);
 
 void pvc_clear(void);
 void pvc_home(void);
-
index 7ad47f227477d6d10fdabde77b5f28d986b55784..1a06defc4f7f565fd45a0c33d8e24a17bdd22091 100644 (file)
@@ -10,7 +10,7 @@
  * Author: Fuxin Zhang, zhangfx@lemote.com
  *
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
 
 #include <loongson.h>
 
-int prom_argc;
-/* pmon passes arguments in 32bit pointers */
-int *_prom_argv;
-
 void __init prom_init_cmdline(void)
 {
+       int prom_argc;
+       /* pmon passes arguments in 32bit pointers */
+       int *_prom_argv;
        int i;
        long l;
 
index b49485f187e0823840448cec1f09878e0a4b1830..b3fd5eab6548cc07388304088314a1c7d790d5ca 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 74f9c59d36afbdce61018451a14c4187a23348e4..eaf8b86e331816bcd34881607296c8e6443df44f 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 3f61594b3884175f84b89cc11565534cb66ff439..9a96b5664c787930293db78e500f4be04a21775c 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index b6f17f538e48b23838e9ad621cac6e479277366c..f5c0818831b25a30e3c240a653c2cf3280aa4f12 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 6cb44dbaeec2826822a733d1ae829dffface0698..8c807c9651990bb973d2c13123ac911abb35e23f 100644 (file)
@@ -5,7 +5,7 @@
  * Author: Yanhua, yanh@lemote.com
  *
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu zhangjin, wuzj@lemote.com
+ * Author: Wu zhangjin, wuzhangjin@gmail.com
  *
  * Reference: AMD Geode(TM) CS5536 Companion Device Data Book
  *
index 8fdb02b6e90f79a52699a10e85e9ca55c8d3fd15..db5900aadd6b0c923d6ccd45f295174606f71cca 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index e23f3d7d2c1dbdc5bbeb87f3384facfaafa5f5e8..6dfeab11af08c1f1a048496839059d17384e145e 100644 (file)
@@ -5,7 +5,7 @@
  * Author : jlliu, liujl@lemote.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 23e7a8f8897f6626b77d1511df9fcf6176b8e5e0..a71736f004430fb595313bdeb184b506fb24afaf 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
  *  Copyright (c) 2009 Lemote Inc.
- *  Author: Wu Zhangjin, wuzj@lemote.com
+ *  Author: Wu Zhangjin, wuzhangjin@gmail.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
index 196d947d929afcf39362aaa1069ee83b01e17ae7..ae4cff97a56c5073d75925a7c89a94ee5a410513 100644 (file)
@@ -9,8 +9,8 @@
  * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
  * Author: Fuxin Zhang, zhangfx@lemote.com
  *
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
 
 #include <loongson.h>
 
-unsigned long bus_clock, cpu_clock_freq;
+unsigned long cpu_clock_freq;
 EXPORT_SYMBOL(cpu_clock_freq);
 unsigned long memsize, highmemsize;
 
-/* pmon passes arguments in 32bit pointers */
-int *_prom_envp;
-
 #define parse_even_earlier(res, option, p)                             \
 do {                                                                   \
        if (strncmp(option, (char *)p, strlen(option)) == 0)            \
@@ -39,6 +36,10 @@ do {                                                                 \
 
 void __init prom_init_env(void)
 {
+       /* pmon passes arguments in 32bit pointers */
+       int *_prom_envp;
+       unsigned long bus_clock;
+       unsigned int processor_id;
        long l;
 
        /* firmware arguments are initialized in head.S */
@@ -55,6 +56,22 @@ void __init prom_init_env(void)
        }
        if (memsize == 0)
                memsize = 256;
+       if (bus_clock == 0)
+               bus_clock = 66000000;
+       if (cpu_clock_freq == 0) {
+               processor_id = (&current_cpu_data)->processor_id;
+               switch (processor_id & PRID_REV_MASK) {
+               case PRID_REV_LOONGSON2E:
+                       cpu_clock_freq = 533080000;
+                       break;
+               case PRID_REV_LOONGSON2F:
+                       cpu_clock_freq = 797000000;
+                       break;
+               default:
+                       cpu_clock_freq = 100000000;
+                       break;
+               }
+       }
 
        pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n",
                bus_clock, cpu_clock_freq, memsize, highmemsize);
index a2abd9355737140d91c98e2c092a7d51543eee32..19d341591254eb1df1061384791d494958f00565 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 0ed52b3f5314ccc1d9b4d6e3761c4f7467001a57..853f184b793e0abfc0561d00fab435ef7ac3a930 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzhangjin@gmail.com
  *
  * Copyright (c) 2009 Zhang Le <r0bertz@gentoo.org>
  *
@@ -35,6 +35,10 @@ const char *get_system_type(void)
        return system_types[mips_machtype];
 }
 
+void __weak __init mach_prom_init_machtype(void)
+{
+}
+
 void __init prom_init_machtype(void)
 {
        char *p, str[MACHTYPE_LEN];
@@ -43,8 +47,10 @@ void __init prom_init_machtype(void)
        mips_machtype = LOONGSON_MACHTYPE;
 
        p = strstr(arcs_cmdline, "machtype=");
-       if (!p)
+       if (!p) {
+               mach_prom_init_machtype();
                return;
+       }
        p += strlen("machtype=");
        strncpy(str, p, MACHTYPE_LEN);
        p = strstr(str, " ");
index ceacd092b4461f00679eab624c92b8412b6141db..ec2f7964a0b0d5c6a6d6f1edfa8e92062c3076aa 100644 (file)
 
 void __init prom_init_memory(void)
 {
-    add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
+       add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
+
+       add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize <<
+                               20), BOOT_MEM_RESERVED);
 
-    add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize <<
-                           20), BOOT_MEM_RESERVED);
 #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
        {
                int bit;
index be81777eb94dc7e94e398d44cc95499669854d45..ed007a2e0e1f0641e0406c63e3b0b7c48c5d9feb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index b625fec8a4d5e6767d6f2c4881a3d498d3b308ff..6c1fd9001712262fbe4e3f42f84c666024abc835 100644 (file)
@@ -2,7 +2,7 @@
  * loongson-specific suspend support
  *
  *  Copyright (C) 2009 Lemote Inc.
- *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *  Author: Wu Zhangjin <wuzhangjin@gmail.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
index d57f1719da959b669dc7810b121cb95a7cf2a112..4bd9c18b07a533c087d21f01276b43a65a592950 100644 (file)
@@ -6,8 +6,8 @@
  *
  * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
  * Author: Fuxin Zhang, zhangfx@lemote.com
- * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
- * Author: Zhangjin Wu, wuzj@lemote.com
+ * Copyright (C) 2009 Lemote, Inc.
+ * Author: Zhangjin Wu, wuzhangjin@gmail.com
  */
 #include <linux/init.h>
 #include <linux/pm.h>
@@ -25,18 +25,26 @@ static void loongson_restart(char *command)
        ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
 }
 
-static void loongson_halt(void)
+static void loongson_poweroff(void)
 {
        mach_prepare_shutdown();
-       while (1)
-               ;
+       unreachable();
+}
+
+static void loongson_halt(void)
+{
+       pr_notice("\n\n** You can safely turn off the power now **\n\n");
+       while (1) {
+               if (cpu_wait)
+                       cpu_wait();
+       }
 }
 
 static int __init mips_reboot_setup(void)
 {
        _machine_restart = loongson_restart;
        _machine_halt = loongson_halt;
-       pm_power_off = loongson_halt;
+       pm_power_off = loongson_poweroff;
 
        return 0;
 }
index 23b66a5f88cb2dcc3a3e27db58b1304a2c882e19..7580873143c84df81f5e6d372de0db9d5ce23364 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (C) 2009 Lemote, Inc.
  * Author: Yan hua (yanhua@lemote.com)
- * Author: Wu Zhangjin (wuzj@lemote.com)
+ * Author: Wu Zhangjin (wuzhangjin@gmail.com)
  */
 
 #include <linux/io.h>
index 35f0b66a94f5a96dc13db103ff9e557894c9eba5..9fdd01f6c56a008eb7af3110100fe0b5b84b8486 100644 (file)
@@ -2,8 +2,8 @@
  * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
  * Author: Fuxin Zhang, zhangfx@lemote.com
  *
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 78ff66ae749e74e4d1687009b6657f837846d369..d69ea54bc3d19a00fa4553cdbfa27dcf8272af81 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index fc16c677d476ae0848af43d80f8f51daf9b14f15..bc39ec62c8c237828af2fb1397fc69f9dfd5921a 100644 (file)
@@ -1,8 +1,8 @@
 /* Board-specific reboot/shutdown routines
  * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
  *
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 4d84b27dc41bd650b1beec909c017d8cbebda0a3..8699a53f0477ee5e14e50d76f7282415acec185e 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o ec_kb3310b.o
+obj-y += machtype.o irq.o reset.o ec_kb3310b.o
 
 #
 # Suspend Support
index 4d84111a2cd442b091dda8f6c6f7ae7d11556770..64057244eec549b732fdc4e550e2388cf54c013a 100644 (file)
@@ -75,6 +75,8 @@ int ec_query_seq(unsigned char cmd)
                udelay(EC_REG_DELAY);
        }
 
+       spin_unlock_irqrestore(&port_access_lock, flags);
+
        if (timeout <= 0) {
                printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
                ret = -EINVAL;
@@ -83,8 +85,6 @@ int ec_query_seq(unsigned char cmd)
                           "(%x/%d)ec issued command %d status : 0x%x\n",
                           timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
 
-       spin_unlock_irqrestore(&port_access_lock, flags);
-
        return ret;
 }
 EXPORT_SYMBOL_GPL(ec_query_seq);
index 77d32f9cf31e62537c5efae038c93bf8a44ad166..882dfcd42c00cd8769d7e47bac7121b50dba76af 100644 (file)
@@ -38,7 +38,7 @@ int mach_i8259_irq(void)
        irq = -1;
 
        if ((LOONGSON_INTISR & LOONGSON_INTEN) & LOONGSON_INT_BIT_INT0) {
-               spin_lock(&i8259A_lock);
+               raw_spin_lock(&i8259A_lock);
                isr = inb(PIC_MASTER_CMD) &
                        ~inb(PIC_MASTER_IMR) & ~(1 << PIC_CASCADE_IR);
                if (!isr)
@@ -56,7 +56,7 @@ int mach_i8259_irq(void)
                        if (~inb(PIC_MASTER_ISR) & 0x80)
                                irq = -1;
                }
-               spin_unlock(&i8259A_lock);
+               raw_spin_unlock(&i8259A_lock);
        }
 
        return irq;
diff --git a/arch/mips/loongson/lemote-2f/machtype.c b/arch/mips/loongson/lemote-2f/machtype.c
new file mode 100644 (file)
index 0000000..e860a27
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Lemote Inc.
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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 <asm/bootinfo.h>
+
+#include <loongson.h>
+
+void __init mach_prom_init_machtype(void)
+{
+       /* We share the same kernel image file among Lemote 2F family
+        * of machines, and provide the machtype= kernel command line
+        * to users to indicate their machine, this command line will
+        * be passed by the latest PMON automatically. and fortunately,
+        * up to now, we can get the machine type from the PMON_VER=
+        * commandline directly except the NAS machine, In the old
+        * machines, this will help the users a lot.
+        *
+        * If no "machtype=" passed, get machine type from "PMON_VER=".
+        *      PMON_VER=LM8089         Lemote 8.9'' netbook
+        *               LM8101         Lemote 10.1'' netbook
+        *      (The above two netbooks have the same kernel support)
+        *               LM6XXX         Lemote FuLoong(2F) box series
+        *               LM9XXX         Lemote LynLoong PC series
+        */
+       if (strstr(arcs_cmdline, "PMON_VER=LM")) {
+               if (strstr(arcs_cmdline, "PMON_VER=LM8"))
+                       mips_machtype = MACH_LEMOTE_YL2F89;
+               else if (strstr(arcs_cmdline, "PMON_VER=LM6"))
+                       mips_machtype = MACH_LEMOTE_FL2F;
+               else if (strstr(arcs_cmdline, "PMON_VER=LM9"))
+                       mips_machtype = MACH_LEMOTE_LL2F;
+               else
+                       mips_machtype = MACH_LEMOTE_NAS;
+
+               strcat(arcs_cmdline, " machtype=");
+               strcat(arcs_cmdline, get_system_type());
+               strcat(arcs_cmdline, " ");
+       }
+}
index d7af2e6165923dd5a121e5ad09f0110c95c4cd18..cac4d382ea73f4f9801eec9d9f6a097ddd33e5ba 100644 (file)
@@ -2,7 +2,7 @@
  *  Lemote loongson2f family machines' specific suspend support
  *
  *  Copyright (C) 2009 Lemote Inc.
- *  Author: Wu Zhangjin <wuzj@lemote.com>
+ *  Author: Wu Zhangjin <wuzhangjin@gmail.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
index 51d1a60d53495eac0a1533e705fa9563e8ee291e..36020a07e18036f001ad88ef2f216f96980ca9fd 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
  *
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.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
index 7e900f30987ed792c3654c636b2174389bcbb042..a0325337b76cb410fa963bcf78433bb72c437e2d 100644 (file)
@@ -135,4 +135,3 @@ ieee754sp ieee754sp_dump(char *m, ieee754sp x)
        printk("\n");
        return x;
 }
-
index 6d2d89f324721115a6577d8726f1f38404d08c9d..2f22fd7fd78445c356d4775c5d18acd14353d322 100644 (file)
@@ -148,7 +148,6 @@ ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
 
                        switch(ieee754_csr.rm) {
                        case IEEE754_RN:
-                               return ieee754dp_zero(sn);
                        case IEEE754_RZ:
                                return ieee754dp_zero(sn);
                        case IEEE754_RU:    /* toward +Infinity */
index 463534045ab60ac68243b1bf5a2b104b77ccad83..a19b72185ab94c4700c069cbba72ba1e4461ab13 100644 (file)
@@ -149,7 +149,6 @@ ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
 
                        switch(ieee754_csr.rm) {
                        case IEEE754_RN:
-                               return ieee754sp_zero(sn);
                        case IEEE754_RZ:
                                return ieee754sp_zero(sn);
                        case IEEE754_RU:      /* toward +Infinity */
index 7d8ef8965067890fc119c0b7cb671f2f7ca0e0e5..e02423a0ae231b3f9320517a99530aff95c26287 100644 (file)
@@ -46,4 +46,3 @@ void ieee754_xcpt(struct ieee754xctx *xcp)
        printk(KERN_DEBUG "floating point exception in \"%s\", type=%s\n",
                xcp->op, rtnames[xcp->rt]);
 }
-
index 94e05e5733c1c4e108baa4076a044c48bdd612e6..0f9c488044d155aa0c9a7c262edfe6e1777d405e 100644 (file)
@@ -174,7 +174,7 @@ static void octeon_flush_cache_page(struct vm_area_struct *vma,
  * Probe Octeon's caches
  *
  */
-static void __devinit probe_octeon(void)
+static void __cpuinit probe_octeon(void)
 {
        unsigned long icache_size;
        unsigned long dcache_size;
@@ -183,6 +183,7 @@ static void __devinit probe_octeon(void)
 
        switch (c->cputype) {
        case CPU_CAVIUM_OCTEON:
+       case CPU_CAVIUM_OCTEON_PLUS:
                config1 = read_c0_config1();
                c->icache.linesz = 2 << ((config1 >> 19) & 7);
                c->icache.sets = 64 << ((config1 >> 22) & 7);
@@ -192,10 +193,10 @@ static void __devinit probe_octeon(void)
                        c->icache.sets * c->icache.ways * c->icache.linesz;
                c->icache.waybit = ffs(icache_size / c->icache.ways) - 1;
                c->dcache.linesz = 128;
-               if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
-                       c->dcache.sets = 1; /* CN3XXX has one Dcache set */
-               else
+               if (c->cputype == CPU_CAVIUM_OCTEON_PLUS)
                        c->dcache.sets = 2; /* CN5XXX has two Dcache sets */
+               else
+                       c->dcache.sets = 1; /* CN3XXX has one Dcache set */
                c->dcache.ways = 64;
                dcache_size =
                        c->dcache.sets * c->dcache.ways * c->dcache.linesz;
@@ -235,7 +236,7 @@ static void __devinit probe_octeon(void)
  * Setup the Octeon cache flush routines
  *
  */
-void __devinit octeon_cache_init(void)
+void __cpuinit octeon_cache_init(void)
 {
        extern unsigned long ebase;
        extern char except_vec2_octeon;
@@ -305,4 +306,3 @@ asmlinkage void cache_parity_error_octeon_non_recoverable(void)
 {
        cache_parity_error_octeon(1);
 }
-
index 102b2dfa542a7c2d6da79fff1f9382e768c3bf54..be8627bc5b02e8782a94e65eee4386508622da56 100644 (file)
@@ -137,25 +137,46 @@ EXPORT_SYMBOL_GPL(_page_cachable_default);
 
 static inline void setup_protection_map(void)
 {
-       protection_map[0] = PAGE_NONE;
-       protection_map[1] = PAGE_READONLY;
-       protection_map[2] = PAGE_COPY;
-       protection_map[3] = PAGE_COPY;
-       protection_map[4] = PAGE_READONLY;
-       protection_map[5] = PAGE_READONLY;
-       protection_map[6] = PAGE_COPY;
-       protection_map[7] = PAGE_COPY;
-       protection_map[8] = PAGE_NONE;
-       protection_map[9] = PAGE_READONLY;
-       protection_map[10] = PAGE_SHARED;
-       protection_map[11] = PAGE_SHARED;
-       protection_map[12] = PAGE_READONLY;
-       protection_map[13] = PAGE_READONLY;
-       protection_map[14] = PAGE_SHARED;
-       protection_map[15] = PAGE_SHARED;
+       if (kernel_uses_smartmips_rixi) {
+               protection_map[0]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+               protection_map[1]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
+               protection_map[2]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+               protection_map[3]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
+               protection_map[4]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
+               protection_map[5]  = __pgprot(_page_cachable_default | _PAGE_PRESENT);
+               protection_map[6]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
+               protection_map[7]  = __pgprot(_page_cachable_default | _PAGE_PRESENT);
+
+               protection_map[8]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+               protection_map[9]  = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
+               protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
+               protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
+               protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
+               protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
+               protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE  | _PAGE_NO_READ);
+               protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
+
+       } else {
+               protection_map[0] = PAGE_NONE;
+               protection_map[1] = PAGE_READONLY;
+               protection_map[2] = PAGE_COPY;
+               protection_map[3] = PAGE_COPY;
+               protection_map[4] = PAGE_READONLY;
+               protection_map[5] = PAGE_READONLY;
+               protection_map[6] = PAGE_COPY;
+               protection_map[7] = PAGE_COPY;
+               protection_map[8] = PAGE_NONE;
+               protection_map[9] = PAGE_READONLY;
+               protection_map[10] = PAGE_SHARED;
+               protection_map[11] = PAGE_SHARED;
+               protection_map[12] = PAGE_READONLY;
+               protection_map[13] = PAGE_READONLY;
+               protection_map[14] = PAGE_SHARED;
+               protection_map[15] = PAGE_SHARED;
+       }
 }
 
-void __devinit cpu_cache_init(void)
+void __cpuinit cpu_cache_init(void)
 {
        if (cpu_has_3k_cache) {
                extern void __weak r3k_cache_init(void);
index e97a7a2fb2c0980346c75791fce09b4026ee334b..b78f7d913ca4f468a56a9771c4b0619440efa9fc 100644 (file)
@@ -99,8 +99,31 @@ good_area:
                if (!(vma->vm_flags & VM_WRITE))
                        goto bad_area;
        } else {
-               if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)))
-                       goto bad_area;
+               if (kernel_uses_smartmips_rixi) {
+                       if (address == regs->cp0_epc && !(vma->vm_flags & VM_EXEC)) {
+#if 0
+                               pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] XI violation\n",
+                                         raw_smp_processor_id(),
+                                         current->comm, current->pid,
+                                         field, address, write,
+                                         field, regs->cp0_epc);
+#endif
+                               goto bad_area;
+                       }
+                       if (!(vma->vm_flags & VM_READ)) {
+#if 0
+                               pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n",
+                                         raw_smp_processor_id(),
+                                         current->comm, current->pid,
+                                         field, address, write,
+                                         field, regs->cp0_epc);
+#endif
+                               goto bad_area;
+                       }
+               } else {
+                       if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)))
+                               goto bad_area;
+               }
        }
 
        /*
index e274fda329f4e5bc9ef0a90484972b650390e2b0..127d732474bf0ceb63dd38c75db8d0cfde1312c0 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/module.h>
 #include <linux/highmem.h>
+#include <linux/sched.h>
 #include <linux/smp.h>
 #include <asm/fixmap.h>
 #include <asm/tlbflush.h>
index 8c2834f5919da563a06a861206cf37164b06615c..cd0660c51f28357f4ac1b2a9f5501fe85ad16189 100644 (file)
@@ -97,4 +97,3 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
                page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
        return page;
 }
-
index 1651942f7febe79eeea81927f34264e01c7c4217..12539af38a990bff5e271a2ddfadce886fd867d5 100644 (file)
@@ -143,7 +143,7 @@ void *kmap_coherent(struct page *page, unsigned long addr)
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
        entrylo = pte.pte_high;
 #else
-       entrylo = pte_val(pte) >> 6;
+       entrylo = pte_to_entrylo(pte_val(pte));
 #endif
 
        ENTER_CRITICAL(flags);
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long start, unsigned long end,
 }
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
 {
        int i;
 
@@ -477,7 +477,7 @@ unsigned long pgd_current[NR_CPUS];
  * will officially be retired.
  */
 pgd_t swapper_pg_dir[_PTRS_PER_PGD] __page_aligned(_PGD_ORDER);
-#ifdef CONFIG_64BIT
+#ifndef __PAGETABLE_PMD_FOLDED
 pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned(PMD_ORDER);
 #endif
 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER);
index f5c73754d664ec9ef4d84a1c12245cecb8dfbc67..36272f7d3744dc9d1a02e046f296b625a4c740cd 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/sibyte/sb1250_dma.h>
 #endif
 
-#include "uasm.h"
+#include <asm/uasm.h>
 
 /* Registers used in the assembled routines. */
 #define ZERO 0
index 1121019fa45652cb953dfd59014ee21b3fee430f..78eaa4f0b0eccd4980ad1fa692343e76e50e63e3 100644 (file)
 void pgd_init(unsigned long page)
 {
        unsigned long *p, *end;
+       unsigned long entry;
+
+#ifdef __PAGETABLE_PMD_FOLDED
+       entry = (unsigned long)invalid_pte_table;
+#else
+       entry = (unsigned long)invalid_pmd_table;
+#endif
 
        p = (unsigned long *) page;
        end = p + PTRS_PER_PGD;
 
        while (p < end) {
-               p[0] = (unsigned long) invalid_pmd_table;
-               p[1] = (unsigned long) invalid_pmd_table;
-               p[2] = (unsigned long) invalid_pmd_table;
-               p[3] = (unsigned long) invalid_pmd_table;
-               p[4] = (unsigned long) invalid_pmd_table;
-               p[5] = (unsigned long) invalid_pmd_table;
-               p[6] = (unsigned long) invalid_pmd_table;
-               p[7] = (unsigned long) invalid_pmd_table;
+               p[0] = entry;
+               p[1] = entry;
+               p[2] = entry;
+               p[3] = entry;
+               p[4] = entry;
+               p[5] = entry;
+               p[6] = entry;
+               p[7] = entry;
                p += 8;
        }
 }
 
+#ifndef __PAGETABLE_PMD_FOLDED
 void pmd_init(unsigned long addr, unsigned long pagetable)
 {
        unsigned long *p, *end;
@@ -40,17 +48,18 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
        end = p + PTRS_PER_PMD;
 
        while (p < end) {
-               p[0] = (unsigned long)pagetable;
-               p[1] = (unsigned long)pagetable;
-               p[2] = (unsigned long)pagetable;
-               p[3] = (unsigned long)pagetable;
-               p[4] = (unsigned long)pagetable;
-               p[5] = (unsigned long)pagetable;
-               p[6] = (unsigned long)pagetable;
-               p[7] = (unsigned long)pagetable;
+               p[0] = pagetable;
+               p[1] = pagetable;
+               p[2] = pagetable;
+               p[3] = pagetable;
+               p[4] = pagetable;
+               p[5] = pagetable;
+               p[6] = pagetable;
+               p[7] = pagetable;
                p += 8;
        }
 }
+#endif
 
 void __init pagetable_init(void)
 {
@@ -59,8 +68,9 @@ void __init pagetable_init(void)
 
        /* Initialize the entire pgd.  */
        pgd_init((unsigned long)swapper_pg_dir);
+#ifndef __PAGETABLE_PMD_FOLDED
        pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
-
+#endif
        pgd_base = swapper_pg_dir;
        /*
         * Fixed mappings:
index d73428b18b0a41da13e81c64021e62505200ff2d..c618eed933a12be9f36c4fd6b8f85d54b92cfb8b 100644 (file)
@@ -303,7 +303,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
                unsigned long lo;
                write_c0_pagemask(PM_HUGE_MASK);
                ptep = (pte_t *)pmdp;
-               lo = pte_val(*ptep) >> 6;
+               lo = pte_to_entrylo(pte_val(*ptep));
                write_c0_entrylo0(lo);
                write_c0_entrylo1(lo + (HPAGE_SIZE >> 7));
 
@@ -323,8 +323,8 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
                ptep++;
                write_c0_entrylo1(ptep->pte_high);
 #else
-               write_c0_entrylo0(pte_val(*ptep++) >> 6);
-               write_c0_entrylo1(pte_val(*ptep) >> 6);
+               write_c0_entrylo0(pte_to_entrylo(pte_val(*ptep++)));
+               write_c0_entrylo1(pte_to_entrylo(pte_val(*ptep)));
 #endif
                mtc0_tlbw_hazard();
                if (idx < 0)
@@ -337,40 +337,6 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
        EXIT_CRITICAL(flags);
 }
 
-#if 0
-static void r4k_update_mmu_cache_hwbug(struct vm_area_struct * vma,
-                                      unsigned long address, pte_t pte)
-{
-       unsigned long flags;
-       unsigned int asid;
-       pgd_t *pgdp;
-       pmd_t *pmdp;
-       pte_t *ptep;
-       int idx;
-
-       ENTER_CRITICAL(flags);
-       address &= (PAGE_MASK << 1);
-       asid = read_c0_entryhi() & ASID_MASK;
-       write_c0_entryhi(address | asid);
-       pgdp = pgd_offset(vma->vm_mm, address);
-       mtc0_tlbw_hazard();
-       tlb_probe();
-       tlb_probe_hazard();
-       pmdp = pmd_offset(pgdp, address);
-       idx = read_c0_index();
-       ptep = pte_offset_map(pmdp, address);
-       write_c0_entrylo0(pte_val(*ptep++) >> 6);
-       write_c0_entrylo1(pte_val(*ptep) >> 6);
-       mtc0_tlbw_hazard();
-       if (idx < 0)
-               tlb_write_random();
-       else
-               tlb_write_indexed();
-       tlbw_use_hazard();
-       EXIT_CRITICAL(flags);
-}
-#endif
-
 void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
        unsigned long entryhi, unsigned long pagemask)
 {
@@ -447,34 +413,6 @@ out:
        return ret;
 }
 
-static void __cpuinit probe_tlb(unsigned long config)
-{
-       struct cpuinfo_mips *c = &current_cpu_data;
-       unsigned int reg;
-
-       /*
-        * If this isn't a MIPS32 / MIPS64 compliant CPU.  Config 1 register
-        * is not supported, we assume R4k style.  Cpu probing already figured
-        * out the number of tlb entries.
-        */
-       if ((c->processor_id & 0xff0000) == PRID_COMP_LEGACY)
-               return;
-#ifdef CONFIG_MIPS_MT_SMTC
-       /*
-        * If TLB is shared in SMTC system, total size already
-        * has been calculated and written into cpu_data tlbsize
-        */
-       if((smtc_status & SMTC_TLB_SHARED) == SMTC_TLB_SHARED)
-               return;
-#endif /* CONFIG_MIPS_MT_SMTC */
-
-       reg = read_c0_config1();
-       if (!((config >> 7) & 3))
-               panic("No TLB present");
-
-       c->tlbsize = ((reg >> 25) & 0x3f) + 1;
-}
-
 static int __cpuinitdata ntlb;
 static int __init set_ntlb(char *str)
 {
@@ -486,8 +424,6 @@ __setup("ntlb=", set_ntlb);
 
 void __cpuinit tlb_init(void)
 {
-       unsigned int config = read_c0_config();
-
        /*
         * You should never change this register:
         *   - On R4600 1.7 the tlbp never hits for pages smaller than
@@ -495,13 +431,25 @@ void __cpuinit tlb_init(void)
         *   - The entire mm handling assumes the c0_pagemask register to
         *     be set to fixed-size pages.
         */
-       probe_tlb(config);
        write_c0_pagemask(PM_DEFAULT_MASK);
        write_c0_wired(0);
        if (current_cpu_type() == CPU_R10000 ||
            current_cpu_type() == CPU_R12000 ||
            current_cpu_type() == CPU_R14000)
                write_c0_framemask(0);
+
+       if (kernel_uses_smartmips_rixi) {
+               /*
+                * Enable the no read, no exec bits, and enable large virtual
+                * address.
+                */
+               u32 pg = PG_RIE | PG_XIE;
+#ifdef CONFIG_64BIT
+               pg |= PG_ELPA;
+#endif
+               write_c0_pagegrain(pg);
+       }
+
        temp_tlb_entry = current_cpu_data.tlbsize - 1;
 
         /* From this point on the ARC firmware is dead.  */
index badcf5e8d695605a08e030eb62008151479c5ce2..0de0e4127d6600743d7a8d453b4fd1278939e428 100644 (file)
@@ -29,8 +29,7 @@
 
 #include <asm/mmu_context.h>
 #include <asm/war.h>
-
-#include "uasm.h"
+#include <asm/uasm.h>
 
 static inline int r45k_bvahwbug(void)
 {
@@ -77,6 +76,8 @@ enum label_id {
        label_vmalloc_done,
        label_tlbw_hazard,
        label_split,
+       label_tlbl_goaround1,
+       label_tlbl_goaround2,
        label_nopage_tlbl,
        label_nopage_tlbs,
        label_nopage_tlbm,
@@ -93,6 +94,8 @@ UASM_L_LA(_vmalloc)
 UASM_L_LA(_vmalloc_done)
 UASM_L_LA(_tlbw_hazard)
 UASM_L_LA(_split)
+UASM_L_LA(_tlbl_goaround1)
+UASM_L_LA(_tlbl_goaround2)
 UASM_L_LA(_nopage_tlbl)
 UASM_L_LA(_nopage_tlbs)
 UASM_L_LA(_nopage_tlbm)
@@ -397,36 +400,60 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
        }
 }
 
-#ifdef CONFIG_HUGETLB_PAGE
-static __cpuinit void build_huge_tlb_write_entry(u32 **p,
-                                                struct uasm_label **l,
-                                                struct uasm_reloc **r,
-                                                unsigned int tmp,
-                                                enum tlb_write_entry wmode)
+static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
+                                                                 unsigned int reg)
 {
-       /* Set huge page tlb entry size */
-       uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16);
-       uasm_i_ori(p, tmp, tmp, PM_HUGE_MASK & 0xffff);
-       uasm_i_mtc0(p, tmp, C0_PAGEMASK);
+       if (kernel_uses_smartmips_rixi) {
+               UASM_i_SRL(p, reg, reg, ilog2(_PAGE_NO_EXEC));
+               UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
+       } else {
+#ifdef CONFIG_64BIT_PHYS_ADDR
+               uasm_i_dsrl(p, reg, reg, ilog2(_PAGE_GLOBAL));
+#else
+               UASM_i_SRL(p, reg, reg, ilog2(_PAGE_GLOBAL));
+#endif
+       }
+}
 
-       build_tlb_write_entry(p, l, r, wmode);
+#ifdef CONFIG_HUGETLB_PAGE
 
+static __cpuinit void build_restore_pagemask(u32 **p,
+                                            struct uasm_reloc **r,
+                                            unsigned int tmp,
+                                            enum label_id lid)
+{
        /* Reset default page size */
        if (PM_DEFAULT_MASK >> 16) {
                uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16);
                uasm_i_ori(p, tmp, tmp, PM_DEFAULT_MASK & 0xffff);
-               uasm_il_b(p, r, label_leave);
+               uasm_il_b(p, r, lid);
                uasm_i_mtc0(p, tmp, C0_PAGEMASK);
        } else if (PM_DEFAULT_MASK) {
                uasm_i_ori(p, tmp, 0, PM_DEFAULT_MASK);
-               uasm_il_b(p, r, label_leave);
+               uasm_il_b(p, r, lid);
                uasm_i_mtc0(p, tmp, C0_PAGEMASK);
        } else {
-               uasm_il_b(p, r, label_leave);
+               uasm_il_b(p, r, lid);
                uasm_i_mtc0(p, 0, C0_PAGEMASK);
        }
 }
 
+static __cpuinit void build_huge_tlb_write_entry(u32 **p,
+                                                struct uasm_label **l,
+                                                struct uasm_reloc **r,
+                                                unsigned int tmp,
+                                                enum tlb_write_entry wmode)
+{
+       /* Set huge page tlb entry size */
+       uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16);
+       uasm_i_ori(p, tmp, tmp, PM_HUGE_MASK & 0xffff);
+       uasm_i_mtc0(p, tmp, C0_PAGEMASK);
+
+       build_tlb_write_entry(p, l, r, wmode);
+
+       build_restore_pagemask(p, r, tmp, label_leave);
+}
+
 /*
  * Check if Huge PTE is present, if so then jump to LABEL.
  */
@@ -460,15 +487,15 @@ static __cpuinit void build_huge_update_entries(u32 **p,
        if (!small_sequence)
                uasm_i_lui(p, tmp, HPAGE_SIZE >> (7 + 16));
 
-       UASM_i_SRL(p, pte, pte, 6); /* convert to entrylo */
-       uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* load it */
+       build_convert_pte_to_entrylo(p, pte);
+       UASM_i_MTC0(p, pte, C0_ENTRYLO0); /* load it */
        /* convert to entrylo1 */
        if (small_sequence)
                UASM_i_ADDIU(p, pte, pte, HPAGE_SIZE >> 7);
        else
                UASM_i_ADDU(p, pte, pte, tmp);
 
-       uasm_i_mtc0(p, pte, C0_ENTRYLO1); /* load it */
+       UASM_i_MTC0(p, pte, C0_ENTRYLO1); /* load it */
 }
 
 static __cpuinit void build_huge_handler_tail(u32 **p,
@@ -549,11 +576,13 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
 
        uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3);
        uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */
+#ifndef __PAGETABLE_PMD_FOLDED
        uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */
        uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */
        uasm_i_dsrl(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */
        uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3);
        uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */
+#endif
 }
 
 /*
@@ -684,35 +713,53 @@ static void __cpuinit build_update_entries(u32 **p, unsigned int tmp,
        if (cpu_has_64bits) {
                uasm_i_ld(p, tmp, 0, ptep); /* get even pte */
                uasm_i_ld(p, ptep, sizeof(pte_t), ptep); /* get odd pte */
-               uasm_i_dsrl(p, tmp, tmp, 6); /* convert to entrylo0 */
-               uasm_i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
-               uasm_i_dsrl(p, ptep, ptep, 6); /* convert to entrylo1 */
-               uasm_i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
+               if (kernel_uses_smartmips_rixi) {
+                       UASM_i_SRL(p, tmp, tmp, ilog2(_PAGE_NO_EXEC));
+                       UASM_i_SRL(p, ptep, ptep, ilog2(_PAGE_NO_EXEC));
+                       UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
+                       UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
+                       UASM_i_ROTR(p, ptep, ptep, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
+               } else {
+                       uasm_i_dsrl(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); /* convert to entrylo0 */
+                       UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
+                       uasm_i_dsrl(p, ptep, ptep, ilog2(_PAGE_GLOBAL)); /* convert to entrylo1 */
+               }
+               UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */
        } else {
                int pte_off_even = sizeof(pte_t) / 2;
                int pte_off_odd = pte_off_even + sizeof(pte_t);
 
                /* The pte entries are pre-shifted */
                uasm_i_lw(p, tmp, pte_off_even, ptep); /* get even pte */
-               uasm_i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
+               UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
                uasm_i_lw(p, ptep, pte_off_odd, ptep); /* get odd pte */
-               uasm_i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
+               UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */
        }
 #else
        UASM_i_LW(p, tmp, 0, ptep); /* get even pte */
        UASM_i_LW(p, ptep, sizeof(pte_t), ptep); /* get odd pte */
        if (r45k_bvahwbug())
                build_tlb_probe_entry(p);
-       UASM_i_SRL(p, tmp, tmp, 6); /* convert to entrylo0 */
-       if (r4k_250MHZhwbug())
-               uasm_i_mtc0(p, 0, C0_ENTRYLO0);
-       uasm_i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
-       UASM_i_SRL(p, ptep, ptep, 6); /* convert to entrylo1 */
-       if (r45k_bvahwbug())
-               uasm_i_mfc0(p, tmp, C0_INDEX);
+       if (kernel_uses_smartmips_rixi) {
+               UASM_i_SRL(p, tmp, tmp, ilog2(_PAGE_NO_EXEC));
+               UASM_i_SRL(p, ptep, ptep, ilog2(_PAGE_NO_EXEC));
+               UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
+               if (r4k_250MHZhwbug())
+                       UASM_i_MTC0(p, 0, C0_ENTRYLO0);
+               UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
+               UASM_i_ROTR(p, ptep, ptep, ilog2(_PAGE_GLOBAL) - ilog2(_PAGE_NO_EXEC));
+       } else {
+               UASM_i_SRL(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); /* convert to entrylo0 */
+               if (r4k_250MHZhwbug())
+                       UASM_i_MTC0(p, 0, C0_ENTRYLO0);
+               UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
+               UASM_i_SRL(p, ptep, ptep, ilog2(_PAGE_GLOBAL)); /* convert to entrylo1 */
+               if (r45k_bvahwbug())
+                       uasm_i_mfc0(p, tmp, C0_INDEX);
+       }
        if (r4k_250MHZhwbug())
-               uasm_i_mtc0(p, 0, C0_ENTRYLO1);
-       uasm_i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
+               UASM_i_MTC0(p, 0, C0_ENTRYLO1);
+       UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */
 #endif
 }
 
@@ -985,9 +1032,14 @@ static void __cpuinit
 build_pte_present(u32 **p, struct uasm_reloc **r,
                  unsigned int pte, unsigned int ptr, enum label_id lid)
 {
-       uasm_i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
-       uasm_i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
-       uasm_il_bnez(p, r, pte, lid);
+       if (kernel_uses_smartmips_rixi) {
+               uasm_i_andi(p, pte, pte, _PAGE_PRESENT);
+               uasm_il_beqz(p, r, pte, lid);
+       } else {
+               uasm_i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
+               uasm_i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
+               uasm_il_bnez(p, r, pte, lid);
+       }
        iPTE_LW(p, pte, ptr);
 }
 
@@ -1272,6 +1324,34 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
        build_pte_present(&p, &r, K0, K1, label_nopage_tlbl);
        if (m4kc_tlbp_war())
                build_tlb_probe_entry(&p);
+
+       if (kernel_uses_smartmips_rixi) {
+               /*
+                * If the page is not _PAGE_VALID, RI or XI could not
+                * have triggered it.  Skip the expensive test..
+                */
+               uasm_i_andi(&p, K0, K0, _PAGE_VALID);
+               uasm_il_beqz(&p, &r, K0, label_tlbl_goaround1);
+               uasm_i_nop(&p);
+
+               uasm_i_tlbr(&p);
+               /* Examine  entrylo 0 or 1 based on ptr. */
+               uasm_i_andi(&p, K0, K1, sizeof(pte_t));
+               uasm_i_beqz(&p, K0, 8);
+
+               UASM_i_MFC0(&p, K0, C0_ENTRYLO0); /* load it in the delay slot*/
+               UASM_i_MFC0(&p, K0, C0_ENTRYLO1); /* load it if ptr is odd */
+               /*
+                * If the entryLo (now in K0) is valid (bit 1), RI or
+                * XI must have triggered it.
+                */
+               uasm_i_andi(&p, K0, K0, 2);
+               uasm_il_bnez(&p, &r, K0, label_nopage_tlbl);
+
+               uasm_l_tlbl_goaround1(&l, p);
+               /* Reload the PTE value */
+               iPTE_LW(&p, K0, K1);
+       }
        build_make_valid(&p, &r, K0, K1);
        build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1);
 
@@ -1284,6 +1364,40 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
        iPTE_LW(&p, K0, K1);
        build_pte_present(&p, &r, K0, K1, label_nopage_tlbl);
        build_tlb_probe_entry(&p);
+
+       if (kernel_uses_smartmips_rixi) {
+               /*
+                * If the page is not _PAGE_VALID, RI or XI could not
+                * have triggered it.  Skip the expensive test..
+                */
+               uasm_i_andi(&p, K0, K0, _PAGE_VALID);
+               uasm_il_beqz(&p, &r, K0, label_tlbl_goaround2);
+               uasm_i_nop(&p);
+
+               uasm_i_tlbr(&p);
+               /* Examine  entrylo 0 or 1 based on ptr. */
+               uasm_i_andi(&p, K0, K1, sizeof(pte_t));
+               uasm_i_beqz(&p, K0, 8);
+
+               UASM_i_MFC0(&p, K0, C0_ENTRYLO0); /* load it in the delay slot*/
+               UASM_i_MFC0(&p, K0, C0_ENTRYLO1); /* load it if ptr is odd */
+               /*
+                * If the entryLo (now in K0) is valid (bit 1), RI or
+                * XI must have triggered it.
+                */
+               uasm_i_andi(&p, K0, K0, 2);
+               uasm_il_beqz(&p, &r, K0, label_tlbl_goaround2);
+               /* Reload the PTE value */
+               iPTE_LW(&p, K0, K1);
+
+               /*
+                * We clobbered C0_PAGEMASK, restore it.  On the other branch
+                * it is restored in build_huge_tlb_write_entry.
+                */
+               build_restore_pagemask(&p, &r, K0, label_nopage_tlbl);
+
+               uasm_l_tlbl_goaround2(&l, p);
+       }
        uasm_i_ori(&p, K0, K0, (_PAGE_ACCESSED | _PAGE_VALID));
        build_huge_handler_tail(&p, &r, &l, K0, K1);
 #endif
index 0a165c5179a125b737bc80e0d4ee48e05f63d0ac..1581e985246194cc106460ec2c6360f36a886c72 100644 (file)
@@ -19,8 +19,7 @@
 #include <asm/inst.h>
 #include <asm/elf.h>
 #include <asm/bugs.h>
-
-#include "uasm.h"
+#include <asm/uasm.h>
 
 enum fields {
        RS = 0x001,
@@ -63,8 +62,9 @@ enum opcode {
        insn_dsrl32, insn_drotr, insn_dsubu, insn_eret, insn_j, insn_jal,
        insn_jr, insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0,
        insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd,
-       insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw,
-       insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, insn_dins
+       insn_sd, insn_sll, insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw,
+       insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori,
+       insn_dins
 };
 
 struct insn {
@@ -126,9 +126,11 @@ static struct insn insn_table[] __cpuinitdata = {
        { insn_sll,  M(spec_op, 0, 0, 0, 0, sll_op),  RT | RD | RE },
        { insn_sra,  M(spec_op, 0, 0, 0, 0, sra_op),  RT | RD | RE },
        { insn_srl,  M(spec_op, 0, 0, 0, 0, srl_op),  RT | RD | RE },
+       { insn_rotr,  M(spec_op, 1, 0, 0, 0, srl_op),  RT | RD | RE },
        { insn_subu,  M(spec_op, 0, 0, 0, 0, subu_op),  RS | RT | RD },
        { insn_sw,  M(sw_op, 0, 0, 0, 0, 0),  RS | RT | SIMM },
        { insn_tlbp,  M(cop0_op, cop_op, 0, 0, 0, tlbp_op),  0 },
+       { insn_tlbr,  M(cop0_op, cop_op, 0, 0, 0, tlbr_op),  0 },
        { insn_tlbwi,  M(cop0_op, cop_op, 0, 0, 0, tlbwi_op),  0 },
        { insn_tlbwr,  M(cop0_op, cop_op, 0, 0, 0, tlbwr_op),  0 },
        { insn_xor,  M(spec_op, 0, 0, 0, 0, xor_op),  RS | RT | RD },
@@ -379,9 +381,11 @@ I_u2s3u1(_sd)
 I_u2u1u3(_sll)
 I_u2u1u3(_sra)
 I_u2u1u3(_srl)
+I_u2u1u3(_rotr)
 I_u3u1u2(_subu)
 I_u2s3u1(_sw)
 I_0(_tlbp)
+I_0(_tlbr)
 I_0(_tlbwi)
 I_0(_tlbwr)
 I_u3u1u2(_xor)
index 4c3fca18a1711b4c60241b2dbd95a1902a2afaf4..2cb5ae79020326ecffdc4aa455f74d5a54afa506 100644 (file)
@@ -52,7 +52,7 @@ static unsigned long _msc01_biu_base;
 static unsigned long _gcmp_base;
 static unsigned int ipi_map[NR_CPUS];
 
-static DEFINE_SPINLOCK(mips_irq_lock);
+static DEFINE_RAW_SPINLOCK(mips_irq_lock);
 
 static inline int mips_pcibios_iack(void)
 {
@@ -103,7 +103,7 @@ static inline int get_int(void)
 {
        unsigned long flags;
        int irq;
-       spin_lock_irqsave(&mips_irq_lock, flags);
+       raw_spin_lock_irqsave(&mips_irq_lock, flags);
 
        irq = mips_pcibios_iack();
 
@@ -113,7 +113,7 @@ static inline int get_int(void)
         * on an SMP system,  so leave it up to the generic code...
         */
 
-       spin_unlock_irqrestore(&mips_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&mips_irq_lock, flags);
 
        return irq;
 }
index 3a467c04f81122698002b979e71692ceb30ef9aa..941916f8aaff03a0d9673e519ab72b2ed8e5e2f7 100644 (file)
@@ -156,19 +156,19 @@ static int irqflags[PNX833X_PIC_NUM_IRQ]; /* initialized by zeroes */
 #define IRQFLAG_STARTED                1
 #define IRQFLAG_DISABLED       2
 
-static DEFINE_SPINLOCK(pnx833x_irq_lock);
+static DEFINE_RAW_SPINLOCK(pnx833x_irq_lock);
 
 static unsigned int pnx833x_startup_pic_irq(unsigned int irq)
 {
        unsigned long flags;
        unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
 
-       spin_lock_irqsave(&pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_irq_lock, flags);
 
        irqflags[pic_irq] = IRQFLAG_STARTED;    /* started, not disabled */
        pnx833x_hard_enable_pic_irq(pic_irq);
 
-       spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
        return 0;
 }
 
@@ -177,12 +177,12 @@ static void pnx833x_shutdown_pic_irq(unsigned int irq)
        unsigned long flags;
        unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
 
-       spin_lock_irqsave(&pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_irq_lock, flags);
 
        irqflags[pic_irq] = 0;                  /* not started */
        pnx833x_hard_disable_pic_irq(pic_irq);
 
-       spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
 }
 
 static void pnx833x_enable_pic_irq(unsigned int irq)
@@ -190,13 +190,13 @@ static void pnx833x_enable_pic_irq(unsigned int irq)
        unsigned long flags;
        unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
 
-       spin_lock_irqsave(&pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_irq_lock, flags);
 
        irqflags[pic_irq] &= ~IRQFLAG_DISABLED;
        if (irqflags[pic_irq] == IRQFLAG_STARTED)
                pnx833x_hard_enable_pic_irq(pic_irq);
 
-       spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
 }
 
 static void pnx833x_disable_pic_irq(unsigned int irq)
@@ -204,12 +204,12 @@ static void pnx833x_disable_pic_irq(unsigned int irq)
        unsigned long flags;
        unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE;
 
-       spin_lock_irqsave(&pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_irq_lock, flags);
 
        irqflags[pic_irq] |= IRQFLAG_DISABLED;
        pnx833x_hard_disable_pic_irq(pic_irq);
 
-       spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags);
 }
 
 static void pnx833x_ack_pic_irq(unsigned int irq)
@@ -220,15 +220,15 @@ static void pnx833x_end_pic_irq(unsigned int irq)
 {
 }
 
-static DEFINE_SPINLOCK(pnx833x_gpio_pnx833x_irq_lock);
+static DEFINE_RAW_SPINLOCK(pnx833x_gpio_pnx833x_irq_lock);
 
 static unsigned int pnx833x_startup_gpio_irq(unsigned int irq)
 {
        int pin = irq - PNX833X_GPIO_IRQ_BASE;
        unsigned long flags;
-       spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
        pnx833x_gpio_enable_irq(pin);
-       spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
        return 0;
 }
 
@@ -236,18 +236,18 @@ static void pnx833x_enable_gpio_irq(unsigned int irq)
 {
        int pin = irq - PNX833X_GPIO_IRQ_BASE;
        unsigned long flags;
-       spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
        pnx833x_gpio_enable_irq(pin);
-       spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
 }
 
 static void pnx833x_disable_gpio_irq(unsigned int irq)
 {
        int pin = irq - PNX833X_GPIO_IRQ_BASE;
        unsigned long flags;
-       spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
        pnx833x_gpio_disable_irq(pin);
-       spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
 }
 
 static void pnx833x_ack_gpio_irq(unsigned int irq)
@@ -258,9 +258,9 @@ static void pnx833x_end_gpio_irq(unsigned int irq)
 {
        int pin = irq - PNX833X_GPIO_IRQ_BASE;
        unsigned long flags;
-       spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags);
        pnx833x_gpio_clear_irq(pin);
-       spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags);
 }
 
 static int pnx833x_set_type_gpio_irq(unsigned int irq, unsigned int flow_type)
@@ -377,4 +377,3 @@ void __init plat_time_init(void)
 
        mips_hpt_frequency *= 500000;
 }
-
index 2a41e8fec210788a46e65478ac9404b5409bd051..29969f90a6b0f5ac715943ee356704c5eb9f5012 100644 (file)
@@ -62,9 +62,3 @@ char __init *prom_getenv(char *envname)
 void __init prom_free_prom_memory(void)
 {
 }
-
-char * __init prom_getcmdline(void)
-{
-       return arcs_cmdline;
-}
-
index 2f567452e7acd890b4609bc7e166ab4bc98e743e..32f70097c3c746e1584537e7fb8c451a5f80346c 100644 (file)
@@ -124,6 +124,5 @@ void prom_putchar(char c)
        }
 }
 
-EXPORT_SYMBOL(prom_getcmdline);
 EXPORT_SYMBOL(get_ethernet_addr);
 EXPORT_SYMBOL(str2eaddr);
index 7832ad257a14c7e2b9cfb12d96e8b7d23964a202..f9eb1aba6345ae398853acc8b9982e54bd468c18 100644 (file)
@@ -6,6 +6,7 @@
  * Copyright (C) 2004, 2005 Ralf Baechle
  * Copyright (C) 2005 MIPS Technologies, Inc.
  */
+#include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/oprofile.h>
@@ -14,9 +15,9 @@
 
 #include "op_impl.h"
 
-extern struct op_mips_model op_model_mipsxx_ops __attribute__((weak));
-extern struct op_mips_model op_model_rm9000_ops __attribute__((weak));
-extern struct op_mips_model op_model_loongson2_ops __attribute__((weak));
+extern struct op_mips_model op_model_mipsxx_ops __weak;
+extern struct op_mips_model op_model_rm9000_ops __weak;
+extern struct op_mips_model op_model_loongson2_ops __weak;
 
 static struct op_mips_model *model;
 
index 475ff46712ab7a1871b4d242d713003c39fe0515..29e2326b62577b3d2f6c5ae2a2620ce0e532d731 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2009 Lemote Inc.
  * Author: Yanhua <yanh@lemote.com>
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -47,8 +47,6 @@ static struct loongson2_register_config {
        int cnt1_enabled, cnt2_enabled;
 } reg;
 
-DEFINE_SPINLOCK(sample_lock);
-
 static char *oprofid = "LoongsonPerf";
 static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id);
 /* Compute all of the registers in preparation for enabling profiling.  */
@@ -115,7 +113,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
        uint64_t counter, counter1, counter2;
        struct pt_regs *regs = get_irq_regs();
        int enabled;
-       unsigned long flags;
 
        /*
         * LOONGSON2 defines two 32-bit performance counters.
@@ -136,8 +133,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
        counter1 = counter & 0xffffffff;
        counter2 = counter >> 32;
 
-       spin_lock_irqsave(&sample_lock, flags);
-
        if (counter1 & LOONGSON2_PERFCNT_OVERFLOW) {
                if (reg.cnt1_enabled)
                        oprofile_add_sample(regs, 0);
@@ -149,8 +144,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
                counter2 = reg.reset_counter2;
        }
 
-       spin_unlock_irqrestore(&sample_lock, flags);
-
        write_c0_perfcnt((counter2 << 32) | counter1);
 
        return IRQ_HANDLED;
index 9553b14002dda51a757cf06ccb0bca5483b86c1a..acacd1407c63e1eb5aa800bffc8a0941b3bc849b 100644 (file)
@@ -51,6 +51,67 @@ static void qube_raq_galileo_early_fixup(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111,
         qube_raq_galileo_early_fixup);
 
+static void __devinit cobalt_legacy_ide_resource_fixup(struct pci_dev *dev,
+                                                      struct resource *res)
+{
+       struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
+       unsigned long offset = hose->io_offset;
+       struct resource orig = *res;
+
+       if (!(res->flags & IORESOURCE_IO) ||
+           !(res->flags & IORESOURCE_PCI_FIXED))
+               return;
+
+       res->start -= offset;
+       res->end -= offset;
+       dev_printk(KERN_DEBUG, &dev->dev, "converted legacy %pR to bus %pR\n",
+                  &orig, res);
+}
+
+static void __devinit cobalt_legacy_ide_fixup(struct pci_dev *dev)
+{
+       u32 class;
+       u8 progif;
+
+       /*
+        * If the IDE controller is in legacy mode, pci_setup_device() fills in
+        * the resources with the legacy addresses that normally appear on the
+        * PCI bus, just as if we had read them from a BAR.
+        *
+        * However, with the GT-64111, those legacy addresses, e.g., 0x1f0,
+        * will never appear on the PCI bus because it converts memory accesses
+        * in the PCI I/O region (which is never at address zero) into I/O port
+        * accesses with no address translation.
+        *
+        * For example, if GT_DEF_PCI0_IO_BASE is 0x10000000, a load or store
+        * to physical address 0x100001f0 will become a PCI access to I/O port
+        * 0x100001f0.  There's no way to generate an access to I/O port 0x1f0,
+        * but the VT82C586 IDE controller does respond at 0x100001f0 because
+        * it only decodes the low 24 bits of the address.
+        *
+        * When this quirk runs, the pci_dev resources should contain bus
+        * addresses, not Linux I/O port numbers, so convert legacy addresses
+        * like 0x1f0 to bus addresses like 0x100001f0.  Later, we'll convert
+        * them back with pcibios_fixup_bus() or pcibios_bus_to_resource().
+        */
+       class = dev->class >> 8;
+       if (class != PCI_CLASS_STORAGE_IDE)
+               return;
+
+       pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
+       if ((progif & 1) == 0) {
+               cobalt_legacy_ide_resource_fixup(dev, &dev->resource[0]);
+               cobalt_legacy_ide_resource_fixup(dev, &dev->resource[1]);
+       }
+       if ((progif & 4) == 0) {
+               cobalt_legacy_ide_resource_fixup(dev, &dev->resource[2]);
+               cobalt_legacy_ide_resource_fixup(dev, &dev->resource[3]);
+       }
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
+         cobalt_legacy_ide_fixup);
+
 static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
 {
        unsigned short cfgword;
index caf2edeb02f06a310b32ee08e36c82fbb50f6304..4b9768d5d72948b200d7431b4754fb7c21a27bc9 100644 (file)
@@ -131,7 +131,7 @@ static void __init loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
 
        /* Serial short detect enable */
        _rdmsr(USB_MSR_REG(USB_CONFIG), &hi, &lo);
-       _wrmsr(USB_MSR_REG(USB_CONFIG), (1 << 1) | (1 << 2) | (1 << 3), lo);
+       _wrmsr(USB_MSR_REG(USB_CONFIG), (1 << 1) | (1 << 3), lo);
 
        /* setting the USB2.0 micro frame length */
        pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000);
index aa5d3da27212bbcfd4cd9ebffeab6f0e3143dd0d..2bb4057bf6c7f045796cd76eca3d99a3751eea6d 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * fuloong2e specific PCI support.
- *
  * Copyright (C) 1999, 2000, 2004  MIPS Technologies, Inc.
  *     All rights reserved.
  *     Authors: Carsten Langgaard <carstenl@mips.com>
  *              Maciej W. Rozycki <macro@mips.com>
  *
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin <wuzj@lemote.com>
+ * Author: Wu Zhangjin <wuzhangjin@gmail.com>
  *
  *  This program is free software; you can distribute it and/or modify it
  *  under the terms of the GNU General Public License (Version 2) as
index 32548b5d68d6738ec7bf5709cf0a26f6055da3f4..04b31478a6d7d6631ad3faa684be6f41e66e2a09 100644 (file)
@@ -206,7 +206,7 @@ static void pci_proc_init(void)
 }
 #endif /* CONFIG_PROC_FS && PCI_COUNTERS */
 
-DEFINE_SPINLOCK(bpci_lock);
+static DEFINE_SPINLOCK(bpci_lock);
 
 /*****************************************************************************
  *
index bea9b6cdfdbf55ea236c1cda6ffb3e20a5ec7267..455f8e50a0070b6be32c0e2c0cde56af487aafac 100644 (file)
@@ -57,4 +57,3 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
        dev->irq = res;
        return 0;
 }
-
index 9cb0c807f564bdc00ac7e0f3f4e6ee43d4c1d730..d248b707eff3c02c00f2b62eca1b8fa0d88782a4 100644 (file)
@@ -209,16 +209,14 @@ const char *octeon_get_pci_interrupts(void)
        case CVMX_BOARD_TYPE_NAO38:
                /* This is really the NAC38 */
                return "AAAAADABAAAAAAAAAAAAAAAAAAAAAAAA";
-       case CVMX_BOARD_TYPE_THUNDER:
-               return "";
-       case CVMX_BOARD_TYPE_EBH3000:
-               return "";
        case CVMX_BOARD_TYPE_EBH3100:
        case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
        case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
                return "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
        case CVMX_BOARD_TYPE_BBGW_REF:
                return "AABCD";
+       case CVMX_BOARD_TYPE_THUNDER:
+       case CVMX_BOARD_TYPE_EBH3000:
        default:
                return "";
        }
index 9a11c22268914ab6ea87823e6e2a3667d54237e4..38bc28005b4a47f7166af021b35d619234df7519 100644 (file)
@@ -49,8 +49,8 @@ static int pci_initialized;
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                       resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
@@ -73,7 +73,7 @@ pcibios_align_resource(void *data, struct resource *res,
                        start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
        }
 
-       res->start = start;
+       return start;
 }
 
 static void __devinit pcibios_scanbus(struct pci_controller *hose)
@@ -251,8 +251,6 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
        for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                if (!dev->resource[i].start)
                        continue;
-               if (dev->resource[i].flags & IORESOURCE_PCI_FIXED)
-                       continue;
                if (dev->resource[i].flags & IORESOURCE_IO)
                        offset = hose->io_offset;
                else if (dev->resource[i].flags & IORESOURCE_MEM)
index 5175357d0a25042edea4d358899d980c2d4db64f..94c9c2c9fbc1d650897ac14eec91d68377c8ac5e 100644 (file)
@@ -131,4 +131,3 @@ void msp_cic_irq_dispatch(void)
        else
                do_IRQ(ffs(pending) + intbase - 1);
 }
-
index c317a3623ce93fd88a56fada8e20f090e5e55975..db98d87a09225679a076e5b5df405e351db1563e 100644 (file)
@@ -303,12 +303,6 @@ char *prom_getenv(char *env_name)
 }
 
 /* PROM commandline functions */
-char *prom_getcmdline(void)
-{
-       return &(arcs_cmdline[0]);
-}
-EXPORT_SYMBOL(prom_getcmdline);
-
 void  __init prom_init_cmdline(void)
 {
        char *cp;
index fc990cb319415b41e30df315b5f078e576f8a88a..d6f8bdff8cbb853480e1d1696a109a8e38117125 100644 (file)
@@ -127,7 +127,7 @@ static int recv_ack(void)
 
        if (ack) {
                do_idle();
-               printk(KERN_ERR "Error reading the Atmel 24C32/24C64 EEPROM \n");
+               printk(KERN_ERR "Error reading the Atmel 24C32/24C64 EEPROM\n");
                return -1;
        }
 
index a31288335fba180644f3044aa0061bd1f37ff700..d6c7ec469fa85f09330e9235cdc72ffe37140298 100644 (file)
@@ -65,4 +65,3 @@
 const char rts = TIOCM_RTS;
 const char dtr = TIOCM_DTR;
 int fd;
-
index 678388fd34b1a9e521d812c307a0aec42478fbc4..fd22597edb64bcf2338e7ae693eed99f855c723f 100644 (file)
@@ -345,14 +345,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
         return pcibios_enable_resources(dev);
 }
 
-void pcibios_align_resource(void *data, struct resource *res,
-                            resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
         struct pci_dev *dev = data;
+       resource_size_t start = res->start;
 
         if (res->flags & IORESOURCE_IO) {
-                resource_size_t start = res->start;
-
                 /* We need to avoid collisions with `mirrored' VGA ports
                    and other strange ISA hardware, so we always want the
                    addresses kilobyte aligned.  */
@@ -363,8 +362,9 @@ void pcibios_align_resource(void *data, struct resource *res,
                 }
 
                 start = (start + 1024 - 1) & ~(1024 - 1);
-                res->start = start;
         }
+
+       return start;
 }
 
 struct pci_ops titan_pci_ops = {
index 326fe7a392e88c5e63b47fd843f60728edf6e806..efc9e889b34939d6a3cbd5f14303317eb0e51bef 100644 (file)
@@ -8,7 +8,7 @@
 
 #define LAUNCHSTACK_SIZE 256
 
-static __cpuinitdata DEFINE_SPINLOCK(launch_lock);
+static __cpuinitdata arch_spinlock_t launch_lock = __ARCH_SPIN_LOCK_UNLOCKED;
 
 static unsigned long secondary_sp __cpuinitdata;
 static unsigned long secondary_gp __cpuinitdata;
@@ -20,7 +20,7 @@ static void __init prom_smp_bootstrap(void)
 {
        local_irq_disable();
 
-       while (spin_is_locked(&launch_lock));
+       while (arch_spin_is_locked(&launch_lock));
 
        __asm__ __volatile__(
        "       move    $sp, %0         \n"
@@ -37,7 +37,7 @@ static void __init prom_smp_bootstrap(void)
  */
 void __init prom_grab_secondary(void)
 {
-       spin_lock(&launch_lock);
+       arch_spin_lock(&launch_lock);
 
        pmon_cpustart(1, &prom_smp_bootstrap,
                      launchstack + LAUNCHSTACK_SIZE, 0);
@@ -138,7 +138,7 @@ static void __cpuinit yos_boot_secondary(int cpu, struct task_struct *idle)
        secondary_sp = sp;
        secondary_gp = gp;
 
-       spin_unlock(&launch_lock);
+       arch_spin_unlock(&launch_lock);
 }
 
 /*
index 7995df45dc8daa30e81e43d5b9855fcda717bf5b..26a6ef19d71fe6b40a7056445c650ef0ac3776e2 100644 (file)
@@ -3,9 +3,9 @@
  *
  * Licensed under the GPLv2
  *
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
+ * Copyright (C) 2009 Lemote Inc.
  * Author: Hu Hongbing <huhb@lemote.com>
- *         Wu Zhangjin <wuzj@lemote.com>
+ *         Wu Zhangjin <wuzhangjin@gmail.com>
  */
 #include <asm/suspend.h>
 #include <asm/fpu.h>
index 0cf86fb32ec3d8531a6921d450e76ffbf011fefd..dbb5c7b4b70fcebdd25229bf084470dd9d60d6ef 100644 (file)
@@ -3,9 +3,9 @@
  *
  * Licensed under the GPLv2
  *
- * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
+ * Copyright (C) 2009 Lemote Inc.
  * Author: Hu Hongbing <huhb@lemote.com>
- *         Wu Zhangjin <wuzj@lemote.com>
+ *         Wu Zhangjin <wuzhangjin@gmail.com>
  */
 #include <asm/asm-offsets.h>
 #include <asm/page.h>
index 03d3884c627040589d2dd2ee64fb87536de86b0b..1ae6623444b2d5c6d3cf21f51c47b58f17f83224 100644 (file)
  * Description:  Defines the platform resources for the SA settop.
  */
 
+#include <linux/init.h>
 #include <asm/mach-powertv/asic.h>
 
-const struct register_map calliope_register_map = {
-       .eic_slow0_strt_add = 0x800000,
-       .eic_cfg_bits = 0x800038,
-       .eic_ready_status = 0x80004c,
+#define CALLIOPE_ADDR(x)       (CALLIOPE_IO_BASE + (x))
 
-       .chipver3 = 0xA00800,
-       .chipver2 = 0xA00804,
-       .chipver1 = 0xA00808,
-       .chipver0 = 0xA0080c,
+const struct register_map calliope_register_map __initdata = {
+       .eic_slow0_strt_add = {.phys = CALLIOPE_ADDR(0x800000)},
+       .eic_cfg_bits = {.phys = CALLIOPE_ADDR(0x800038)},
+       .eic_ready_status = {.phys = CALLIOPE_ADDR(0x80004c)},
+
+       .chipver3 = {.phys = CALLIOPE_ADDR(0xA00800)},
+       .chipver2 = {.phys = CALLIOPE_ADDR(0xA00804)},
+       .chipver1 = {.phys = CALLIOPE_ADDR(0xA00808)},
+       .chipver0 = {.phys = CALLIOPE_ADDR(0xA0080c)},
 
        /* The registers of IRBlaster */
-       .uart1_intstat = 0xA01800,
-       .uart1_inten = 0xA01804,
-       .uart1_config1 = 0xA01808,
-       .uart1_config2 = 0xA0180C,
-       .uart1_divisorhi = 0xA01810,
-       .uart1_divisorlo = 0xA01814,
-       .uart1_data = 0xA01818,
-       .uart1_status = 0xA0181C,
+       .uart1_intstat = {.phys = CALLIOPE_ADDR(0xA01800)},
+       .uart1_inten = {.phys = CALLIOPE_ADDR(0xA01804)},
+       .uart1_config1 = {.phys = CALLIOPE_ADDR(0xA01808)},
+       .uart1_config2 = {.phys = CALLIOPE_ADDR(0xA0180C)},
+       .uart1_divisorhi = {.phys = CALLIOPE_ADDR(0xA01810)},
+       .uart1_divisorlo = {.phys = CALLIOPE_ADDR(0xA01814)},
+       .uart1_data = {.phys = CALLIOPE_ADDR(0xA01818)},
+       .uart1_status = {.phys = CALLIOPE_ADDR(0xA0181C)},
 
-       .int_stat_3 = 0xA02800,
-       .int_stat_2 = 0xA02804,
-       .int_stat_1 = 0xA02808,
-       .int_stat_0 = 0xA0280c,
-       .int_config = 0xA02810,
-       .int_int_scan = 0xA02818,
-       .ien_int_3 = 0xA02830,
-       .ien_int_2 = 0xA02834,
-       .ien_int_1 = 0xA02838,
-       .ien_int_0 = 0xA0283c,
-       .int_level_3_3 = 0xA02880,
-       .int_level_3_2 = 0xA02884,
-       .int_level_3_1 = 0xA02888,
-       .int_level_3_0 = 0xA0288c,
-       .int_level_2_3 = 0xA02890,
-       .int_level_2_2 = 0xA02894,
-       .int_level_2_1 = 0xA02898,
-       .int_level_2_0 = 0xA0289c,
-       .int_level_1_3 = 0xA028a0,
-       .int_level_1_2 = 0xA028a4,
-       .int_level_1_1 = 0xA028a8,
-       .int_level_1_0 = 0xA028ac,
-       .int_level_0_3 = 0xA028b0,
-       .int_level_0_2 = 0xA028b4,
-       .int_level_0_1 = 0xA028b8,
-       .int_level_0_0 = 0xA028bc,
-       .int_docsis_en = 0xA028F4,
+       .int_stat_3 = {.phys = CALLIOPE_ADDR(0xA02800)},
+       .int_stat_2 = {.phys = CALLIOPE_ADDR(0xA02804)},
+       .int_stat_1 = {.phys = CALLIOPE_ADDR(0xA02808)},
+       .int_stat_0 = {.phys = CALLIOPE_ADDR(0xA0280c)},
+       .int_config = {.phys = CALLIOPE_ADDR(0xA02810)},
+       .int_int_scan = {.phys = CALLIOPE_ADDR(0xA02818)},
+       .ien_int_3 = {.phys = CALLIOPE_ADDR(0xA02830)},
+       .ien_int_2 = {.phys = CALLIOPE_ADDR(0xA02834)},
+       .ien_int_1 = {.phys = CALLIOPE_ADDR(0xA02838)},
+       .ien_int_0 = {.phys = CALLIOPE_ADDR(0xA0283c)},
+       .int_level_3_3 = {.phys = CALLIOPE_ADDR(0xA02880)},
+       .int_level_3_2 = {.phys = CALLIOPE_ADDR(0xA02884)},
+       .int_level_3_1 = {.phys = CALLIOPE_ADDR(0xA02888)},
+       .int_level_3_0 = {.phys = CALLIOPE_ADDR(0xA0288c)},
+       .int_level_2_3 = {.phys = CALLIOPE_ADDR(0xA02890)},
+       .int_level_2_2 = {.phys = CALLIOPE_ADDR(0xA02894)},
+       .int_level_2_1 = {.phys = CALLIOPE_ADDR(0xA02898)},
+       .int_level_2_0 = {.phys = CALLIOPE_ADDR(0xA0289c)},
+       .int_level_1_3 = {.phys = CALLIOPE_ADDR(0xA028a0)},
+       .int_level_1_2 = {.phys = CALLIOPE_ADDR(0xA028a4)},
+       .int_level_1_1 = {.phys = CALLIOPE_ADDR(0xA028a8)},
+       .int_level_1_0 = {.phys = CALLIOPE_ADDR(0xA028ac)},
+       .int_level_0_3 = {.phys = CALLIOPE_ADDR(0xA028b0)},
+       .int_level_0_2 = {.phys = CALLIOPE_ADDR(0xA028b4)},
+       .int_level_0_1 = {.phys = CALLIOPE_ADDR(0xA028b8)},
+       .int_level_0_0 = {.phys = CALLIOPE_ADDR(0xA028bc)},
+       .int_docsis_en = {.phys = CALLIOPE_ADDR(0xA028F4)},
 
-       .mips_pll_setup = 0x980000,
-       .usb_fs = 0x980030,             /* -default 72800028- */
-       .test_bus = 0x9800CC,
-       .crt_spare = 0x9800d4,
-       .usb2_ohci_int_mask = 0x9A000c,
-       .usb2_strap = 0x9A0014,
-       .ehci_hcapbase = 0x9BFE00,
-       .ohci_hc_revision = 0x9BFC00,
-       .bcm1_bs_lmi_steer = 0x9E0004,
-       .usb2_control = 0x9E0054,
-       .usb2_stbus_obc = 0x9BFF00,
-       .usb2_stbus_mess_size = 0x9BFF04,
-       .usb2_stbus_chunk_size = 0x9BFF08,
+       .mips_pll_setup = {.phys = CALLIOPE_ADDR(0x980000)},
+       .usb_fs = {.phys = CALLIOPE_ADDR(0x980030)},
+       .test_bus = {.phys = CALLIOPE_ADDR(0x9800CC)},
+       .crt_spare = {.phys = CALLIOPE_ADDR(0x9800d4)},
+       .usb2_ohci_int_mask = {.phys = CALLIOPE_ADDR(0x9A000c)},
+       .usb2_strap = {.phys = CALLIOPE_ADDR(0x9A0014)},
+       .ehci_hcapbase = {.phys = CALLIOPE_ADDR(0x9BFE00)},
+       .ohci_hc_revision = {.phys = CALLIOPE_ADDR(0x9BFC00)},
+       .bcm1_bs_lmi_steer = {.phys = CALLIOPE_ADDR(0x9E0004)},
+       .usb2_control = {.phys = CALLIOPE_ADDR(0x9E0054)},
+       .usb2_stbus_obc = {.phys = CALLIOPE_ADDR(0x9BFF00)},
+       .usb2_stbus_mess_size = {.phys = CALLIOPE_ADDR(0x9BFF04)},
+       .usb2_stbus_chunk_size = {.phys = CALLIOPE_ADDR(0x9BFF08)},
 
-       .pcie_regs = 0x000000,          /* -doesn't exist- */
-       .tim_ch = 0xA02C10,
-       .tim_cl = 0xA02C14,
-       .gpio_dout = 0xA02c20,
-       .gpio_din = 0xA02c24,
-       .gpio_dir = 0xA02c2C,
-       .watchdog = 0xA02c30,
-       .front_panel = 0x000000,        /* -not used- */
+       .pcie_regs = {.phys = 0x000000},        /* -doesn't exist- */
+       .tim_ch = {.phys = CALLIOPE_ADDR(0xA02C10)},
+       .tim_cl = {.phys = CALLIOPE_ADDR(0xA02C14)},
+       .gpio_dout = {.phys = CALLIOPE_ADDR(0xA02c20)},
+       .gpio_din = {.phys = CALLIOPE_ADDR(0xA02c24)},
+       .gpio_dir = {.phys = CALLIOPE_ADDR(0xA02c2C)},
+       .watchdog = {.phys = CALLIOPE_ADDR(0xA02c30)},
+       .front_panel = {.phys = 0x000000},      /* -not used- */
 };
index 5f4589c9f83d27ec71455aeef1d19fd3f8e0bc6d..5bb64bfb508b1e83e5f81dab74351d76d9413639 100644 (file)
  * Description:  Defines the platform resources for the SA settop.
  */
 
+#include <linux/init.h>
 #include <asm/mach-powertv/asic.h>
 
-const struct register_map cronus_register_map = {
-       .eic_slow0_strt_add = 0x000000,
-       .eic_cfg_bits = 0x000038,
-       .eic_ready_status = 0x00004C,
+#define CRONUS_ADDR(x) (CRONUS_IO_BASE + (x))
 
-       .chipver3 = 0x2A0800,
-       .chipver2 = 0x2A0804,
-       .chipver1 = 0x2A0808,
-       .chipver0 = 0x2A080C,
+const struct register_map cronus_register_map __initdata = {
+       .eic_slow0_strt_add = {.phys = CRONUS_ADDR(0x000000)},
+       .eic_cfg_bits = {.phys = CRONUS_ADDR(0x000038)},
+       .eic_ready_status = {.phys = CRONUS_ADDR(0x00004C)},
+
+       .chipver3 = {.phys = CRONUS_ADDR(0x2A0800)},
+       .chipver2 = {.phys = CRONUS_ADDR(0x2A0804)},
+       .chipver1 = {.phys = CRONUS_ADDR(0x2A0808)},
+       .chipver0 = {.phys = CRONUS_ADDR(0x2A080C)},
 
        /* The registers of IRBlaster */
-       .uart1_intstat = 0x2A1800,
-       .uart1_inten = 0x2A1804,
-       .uart1_config1 = 0x2A1808,
-       .uart1_config2 = 0x2A180C,
-       .uart1_divisorhi = 0x2A1810,
-       .uart1_divisorlo = 0x2A1814,
-       .uart1_data = 0x2A1818,
-       .uart1_status = 0x2A181C,
+       .uart1_intstat = {.phys = CRONUS_ADDR(0x2A1800)},
+       .uart1_inten = {.phys = CRONUS_ADDR(0x2A1804)},
+       .uart1_config1 = {.phys = CRONUS_ADDR(0x2A1808)},
+       .uart1_config2 = {.phys = CRONUS_ADDR(0x2A180C)},
+       .uart1_divisorhi = {.phys = CRONUS_ADDR(0x2A1810)},
+       .uart1_divisorlo = {.phys = CRONUS_ADDR(0x2A1814)},
+       .uart1_data = {.phys = CRONUS_ADDR(0x2A1818)},
+       .uart1_status = {.phys = CRONUS_ADDR(0x2A181C)},
 
-       .int_stat_3 = 0x2A2800,
-       .int_stat_2 = 0x2A2804,
-       .int_stat_1 = 0x2A2808,
-       .int_stat_0 = 0x2A280C,
-       .int_config = 0x2A2810,
-       .int_int_scan = 0x2A2818,
-       .ien_int_3 = 0x2A2830,
-       .ien_int_2 = 0x2A2834,
-       .ien_int_1 = 0x2A2838,
-       .ien_int_0 = 0x2A283C,
-       .int_level_3_3 = 0x2A2880,
-       .int_level_3_2 = 0x2A2884,
-       .int_level_3_1 = 0x2A2888,
-       .int_level_3_0 = 0x2A288C,
-       .int_level_2_3 = 0x2A2890,
-       .int_level_2_2 = 0x2A2894,
-       .int_level_2_1 = 0x2A2898,
-       .int_level_2_0 = 0x2A289C,
-       .int_level_1_3 = 0x2A28A0,
-       .int_level_1_2 = 0x2A28A4,
-       .int_level_1_1 = 0x2A28A8,
-       .int_level_1_0 = 0x2A28AC,
-       .int_level_0_3 = 0x2A28B0,
-       .int_level_0_2 = 0x2A28B4,
-       .int_level_0_1 = 0x2A28B8,
-       .int_level_0_0 = 0x2A28BC,
-       .int_docsis_en = 0x2A28F4,
+       .int_stat_3 = {.phys = CRONUS_ADDR(0x2A2800)},
+       .int_stat_2 = {.phys = CRONUS_ADDR(0x2A2804)},
+       .int_stat_1 = {.phys = CRONUS_ADDR(0x2A2808)},
+       .int_stat_0 = {.phys = CRONUS_ADDR(0x2A280C)},
+       .int_config = {.phys = CRONUS_ADDR(0x2A2810)},
+       .int_int_scan = {.phys = CRONUS_ADDR(0x2A2818)},
+       .ien_int_3 = {.phys = CRONUS_ADDR(0x2A2830)},
+       .ien_int_2 = {.phys = CRONUS_ADDR(0x2A2834)},
+       .ien_int_1 = {.phys = CRONUS_ADDR(0x2A2838)},
+       .ien_int_0 = {.phys = CRONUS_ADDR(0x2A283C)},
+       .int_level_3_3 = {.phys = CRONUS_ADDR(0x2A2880)},
+       .int_level_3_2 = {.phys = CRONUS_ADDR(0x2A2884)},
+       .int_level_3_1 = {.phys = CRONUS_ADDR(0x2A2888)},
+       .int_level_3_0 = {.phys = CRONUS_ADDR(0x2A288C)},
+       .int_level_2_3 = {.phys = CRONUS_ADDR(0x2A2890)},
+       .int_level_2_2 = {.phys = CRONUS_ADDR(0x2A2894)},
+       .int_level_2_1 = {.phys = CRONUS_ADDR(0x2A2898)},
+       .int_level_2_0 = {.phys = CRONUS_ADDR(0x2A289C)},
+       .int_level_1_3 = {.phys = CRONUS_ADDR(0x2A28A0)},
+       .int_level_1_2 = {.phys = CRONUS_ADDR(0x2A28A4)},
+       .int_level_1_1 = {.phys = CRONUS_ADDR(0x2A28A8)},
+       .int_level_1_0 = {.phys = CRONUS_ADDR(0x2A28AC)},
+       .int_level_0_3 = {.phys = CRONUS_ADDR(0x2A28B0)},
+       .int_level_0_2 = {.phys = CRONUS_ADDR(0x2A28B4)},
+       .int_level_0_1 = {.phys = CRONUS_ADDR(0x2A28B8)},
+       .int_level_0_0 = {.phys = CRONUS_ADDR(0x2A28BC)},
+       .int_docsis_en = {.phys = CRONUS_ADDR(0x2A28F4)},
 
-       .mips_pll_setup = 0x1C0000,
-       .usb_fs = 0x1C0018,
-       .test_bus = 0x1C00CC,
-       .crt_spare = 0x1c00d4,
-       .usb2_ohci_int_mask = 0x20000C,
-       .usb2_strap = 0x200014,
-       .ehci_hcapbase = 0x21FE00,
-       .ohci_hc_revision = 0x1E0000,
-       .bcm1_bs_lmi_steer = 0x2E0008,
-       .usb2_control = 0x2E004C,
-       .usb2_stbus_obc = 0x21FF00,
-       .usb2_stbus_mess_size = 0x21FF04,
-       .usb2_stbus_chunk_size = 0x21FF08,
+       .mips_pll_setup = {.phys = CRONUS_ADDR(0x1C0000)},
+       .usb_fs = {.phys = CRONUS_ADDR(0x1C0018)},
+       .test_bus = {.phys = CRONUS_ADDR(0x1C00CC)},
+       .crt_spare = {.phys = CRONUS_ADDR(0x1c00d4)},
+       .usb2_ohci_int_mask = {.phys = CRONUS_ADDR(0x20000C)},
+       .usb2_strap = {.phys = CRONUS_ADDR(0x200014)},
+       .ehci_hcapbase = {.phys = CRONUS_ADDR(0x21FE00)},
+       .ohci_hc_revision = {.phys = CRONUS_ADDR(0x1E0000)},
+       .bcm1_bs_lmi_steer = {.phys = CRONUS_ADDR(0x2E0008)},
+       .usb2_control = {.phys = CRONUS_ADDR(0x2E004C)},
+       .usb2_stbus_obc = {.phys = CRONUS_ADDR(0x21FF00)},
+       .usb2_stbus_mess_size = {.phys = CRONUS_ADDR(0x21FF04)},
+       .usb2_stbus_chunk_size = {.phys = CRONUS_ADDR(0x21FF08)},
 
-       .pcie_regs = 0x220000,
-       .tim_ch = 0x2A2C10,
-       .tim_cl = 0x2A2C14,
-       .gpio_dout = 0x2A2C20,
-       .gpio_din = 0x2A2C24,
-       .gpio_dir = 0x2A2C2C,
-       .watchdog = 0x2A2C30,
-       .front_panel = 0x2A3800,
+       .pcie_regs = {.phys = CRONUS_ADDR(0x220000)},
+       .tim_ch = {.phys = CRONUS_ADDR(0x2A2C10)},
+       .tim_cl = {.phys = CRONUS_ADDR(0x2A2C14)},
+       .gpio_dout = {.phys = CRONUS_ADDR(0x2A2C20)},
+       .gpio_din = {.phys = CRONUS_ADDR(0x2A2C24)},
+       .gpio_dir = {.phys = CRONUS_ADDR(0x2A2C2C)},
+       .watchdog = {.phys = CRONUS_ADDR(0x2A2C30)},
+       .front_panel = {.phys = CRONUS_ADDR(0x2A3800)},
 };
index 1469daab920e61cc8923c0fe9a2f1e95a0009641..095cbe10ebb90e92833ea4517df7bec9c81f3f21 100644 (file)
  * Description:  Defines the platform resources for the SA settop.
  */
 
+#include <linux/init.h>
 #include <asm/mach-powertv/asic.h>
 
-const struct register_map zeus_register_map = {
-       .eic_slow0_strt_add = 0x000000,
-       .eic_cfg_bits = 0x000038,
-       .eic_ready_status = 0x00004c,
+#define ZEUS_ADDR(x)   (ZEUS_IO_BASE + (x))
 
-       .chipver3 = 0x280800,
-       .chipver2 = 0x280804,
-       .chipver1 = 0x280808,
-       .chipver0 = 0x28080c,
+const struct register_map zeus_register_map __initdata = {
+       .eic_slow0_strt_add = {.phys = ZEUS_ADDR(0x000000)},
+       .eic_cfg_bits = {.phys = ZEUS_ADDR(0x000038)},
+       .eic_ready_status = {.phys = ZEUS_ADDR(0x00004c)},
+
+       .chipver3 = {.phys = ZEUS_ADDR(0x280800)},
+       .chipver2 = {.phys = ZEUS_ADDR(0x280804)},
+       .chipver1 = {.phys = ZEUS_ADDR(0x280808)},
+       .chipver0 = {.phys = ZEUS_ADDR(0x28080c)},
 
        /* The registers of IRBlaster */
-       .uart1_intstat = 0x281800,
-       .uart1_inten = 0x281804,
-       .uart1_config1 = 0x281808,
-       .uart1_config2 = 0x28180C,
-       .uart1_divisorhi = 0x281810,
-       .uart1_divisorlo = 0x281814,
-       .uart1_data = 0x281818,
-       .uart1_status = 0x28181C,
+       .uart1_intstat = {.phys = ZEUS_ADDR(0x281800)},
+       .uart1_inten = {.phys = ZEUS_ADDR(0x281804)},
+       .uart1_config1 = {.phys = ZEUS_ADDR(0x281808)},
+       .uart1_config2 = {.phys = ZEUS_ADDR(0x28180C)},
+       .uart1_divisorhi = {.phys = ZEUS_ADDR(0x281810)},
+       .uart1_divisorlo = {.phys = ZEUS_ADDR(0x281814)},
+       .uart1_data = {.phys = ZEUS_ADDR(0x281818)},
+       .uart1_status = {.phys = ZEUS_ADDR(0x28181C)},
 
-       .int_stat_3 = 0x282800,
-       .int_stat_2 = 0x282804,
-       .int_stat_1 = 0x282808,
-       .int_stat_0 = 0x28280c,
-       .int_config = 0x282810,
-       .int_int_scan = 0x282818,
-       .ien_int_3 = 0x282830,
-       .ien_int_2 = 0x282834,
-       .ien_int_1 = 0x282838,
-       .ien_int_0 = 0x28283c,
-       .int_level_3_3 = 0x282880,
-       .int_level_3_2 = 0x282884,
-       .int_level_3_1 = 0x282888,
-       .int_level_3_0 = 0x28288c,
-       .int_level_2_3 = 0x282890,
-       .int_level_2_2 = 0x282894,
-       .int_level_2_1 = 0x282898,
-       .int_level_2_0 = 0x28289c,
-       .int_level_1_3 = 0x2828a0,
-       .int_level_1_2 = 0x2828a4,
-       .int_level_1_1 = 0x2828a8,
-       .int_level_1_0 = 0x2828ac,
-       .int_level_0_3 = 0x2828b0,
-       .int_level_0_2 = 0x2828b4,
-       .int_level_0_1 = 0x2828b8,
-       .int_level_0_0 = 0x2828bc,
-       .int_docsis_en = 0x2828F4,
+       .int_stat_3 = {.phys = ZEUS_ADDR(0x282800)},
+       .int_stat_2 = {.phys = ZEUS_ADDR(0x282804)},
+       .int_stat_1 = {.phys = ZEUS_ADDR(0x282808)},
+       .int_stat_0 = {.phys = ZEUS_ADDR(0x28280c)},
+       .int_config = {.phys = ZEUS_ADDR(0x282810)},
+       .int_int_scan = {.phys = ZEUS_ADDR(0x282818)},
+       .ien_int_3 = {.phys = ZEUS_ADDR(0x282830)},
+       .ien_int_2 = {.phys = ZEUS_ADDR(0x282834)},
+       .ien_int_1 = {.phys = ZEUS_ADDR(0x282838)},
+       .ien_int_0 = {.phys = ZEUS_ADDR(0x28283c)},
+       .int_level_3_3 = {.phys = ZEUS_ADDR(0x282880)},
+       .int_level_3_2 = {.phys = ZEUS_ADDR(0x282884)},
+       .int_level_3_1 = {.phys = ZEUS_ADDR(0x282888)},
+       .int_level_3_0 = {.phys = ZEUS_ADDR(0x28288c)},
+       .int_level_2_3 = {.phys = ZEUS_ADDR(0x282890)},
+       .int_level_2_2 = {.phys = ZEUS_ADDR(0x282894)},
+       .int_level_2_1 = {.phys = ZEUS_ADDR(0x282898)},
+       .int_level_2_0 = {.phys = ZEUS_ADDR(0x28289c)},
+       .int_level_1_3 = {.phys = ZEUS_ADDR(0x2828a0)},
+       .int_level_1_2 = {.phys = ZEUS_ADDR(0x2828a4)},
+       .int_level_1_1 = {.phys = ZEUS_ADDR(0x2828a8)},
+       .int_level_1_0 = {.phys = ZEUS_ADDR(0x2828ac)},
+       .int_level_0_3 = {.phys = ZEUS_ADDR(0x2828b0)},
+       .int_level_0_2 = {.phys = ZEUS_ADDR(0x2828b4)},
+       .int_level_0_1 = {.phys = ZEUS_ADDR(0x2828b8)},
+       .int_level_0_0 = {.phys = ZEUS_ADDR(0x2828bc)},
+       .int_docsis_en = {.phys = ZEUS_ADDR(0x2828F4)},
 
-       .mips_pll_setup = 0x1a0000,
-       .usb_fs = 0x1a0018,
-       .test_bus = 0x1a0238,
-       .crt_spare = 0x1a0090,
-       .usb2_ohci_int_mask = 0x1e000c,
-       .usb2_strap = 0x1e0014,
-       .ehci_hcapbase = 0x1FFE00,
-       .ohci_hc_revision = 0x1FFC00,
-       .bcm1_bs_lmi_steer = 0x2C0008,
-       .usb2_control = 0x2c01a0,
-       .usb2_stbus_obc = 0x1FFF00,
-       .usb2_stbus_mess_size = 0x1FFF04,
-       .usb2_stbus_chunk_size = 0x1FFF08,
+       .mips_pll_setup = {.phys = ZEUS_ADDR(0x1a0000)},
+       .usb_fs = {.phys = ZEUS_ADDR(0x1a0018)},
+       .test_bus = {.phys = ZEUS_ADDR(0x1a0238)},
+       .crt_spare = {.phys = ZEUS_ADDR(0x1a0090)},
+       .usb2_ohci_int_mask = {.phys = ZEUS_ADDR(0x1e000c)},
+       .usb2_strap = {.phys = ZEUS_ADDR(0x1e0014)},
+       .ehci_hcapbase = {.phys = ZEUS_ADDR(0x1FFE00)},
+       .ohci_hc_revision = {.phys = ZEUS_ADDR(0x1FFC00)},
+       .bcm1_bs_lmi_steer = {.phys = ZEUS_ADDR(0x2C0008)},
+       .usb2_control = {.phys = ZEUS_ADDR(0x2c01a0)},
+       .usb2_stbus_obc = {.phys = ZEUS_ADDR(0x1FFF00)},
+       .usb2_stbus_mess_size = {.phys = ZEUS_ADDR(0x1FFF04)},
+       .usb2_stbus_chunk_size = {.phys = ZEUS_ADDR(0x1FFF08)},
 
-       .pcie_regs = 0x200000,
-       .tim_ch = 0x282C10,
-       .tim_cl = 0x282C14,
-       .gpio_dout = 0x282c20,
-       .gpio_din = 0x282c24,
-       .gpio_dir = 0x282c2C,
-       .watchdog = 0x282c30,
-       .front_panel = 0x283800,
+       .pcie_regs = {.phys = ZEUS_ADDR(0x200000)},
+       .tim_ch = {.phys = ZEUS_ADDR(0x282C10)},
+       .tim_cl = {.phys = ZEUS_ADDR(0x282C14)},
+       .gpio_dout = {.phys = ZEUS_ADDR(0x282c20)},
+       .gpio_din = {.phys = ZEUS_ADDR(0x282c24)},
+       .gpio_dir = {.phys = ZEUS_ADDR(0x282c2C)},
+       .watchdog = {.phys = ZEUS_ADDR(0x282c30)},
+       .front_panel = {.phys = ZEUS_ADDR(0x283800)},
 };
index bae82880b6b5ab3a09373539a9c1579b1d5d0566..217424231eb6f8ebcb1bcdc25735b848f76a25e6 100644 (file)
@@ -67,8 +67,8 @@ enum asic_type asic;
 
 unsigned int platform_features;
 unsigned int platform_family;
-const struct register_map  *register_map;
-EXPORT_SYMBOL(register_map);                   /* Exported for testing */
+struct register_map _asic_register_map;
+EXPORT_SYMBOL(_asic_register_map);             /* Exported for testing */
 unsigned long asic_phy_base;
 unsigned long asic_base;
 EXPORT_SYMBOL(asic_base);                      /* Exported for testing */
@@ -340,10 +340,6 @@ static void __init platform_configure_usb(void)
 
        switch (asic) {
        case ASIC_ZEUS:
-               fs_update(0x0000, 0x11, 0x02, 0);
-               bcm1_usb2_ctl = 0x803;
-               break;
-
        case ASIC_CRONUS:
        case ASIC_CRONUSLITE:
                fs_update(0x0000, 0x11, 0x02, 0);
@@ -418,6 +414,15 @@ void platform_unconfigure_usb_ohci()
 {
 }
 
+static void __init set_register_map(unsigned long phys_base,
+       const struct register_map *map)
+{
+       asic_phy_base = phys_base;
+       _asic_register_map = *map;
+       register_map_virtualize(&_asic_register_map);
+       asic_base = (unsigned long)ioremap_nocache(phys_base, ASIC_IO_SIZE);
+}
+
 /**
  * configure_platform - configuration based on platform type.
  */
@@ -431,10 +436,7 @@ void __init configure_platform(void)
        case FAMILY_1500VZF:
                platform_features = FFS_CAPABLE;
                asic = ASIC_CALLIOPE;
-               asic_phy_base = CALLIOPE_IO_BASE;
-               register_map = &calliope_register_map;
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
+               set_register_map(CALLIOPE_IO_BASE, &calliope_register_map);
 
                if (platform_family == FAMILY_1500VZE) {
                        gp_resources = non_dvr_vze_calliope_resources;
@@ -455,10 +457,7 @@ void __init configure_platform(void)
                platform_features = FFS_CAPABLE | PCIE_CAPABLE |
                        DISPLAY_CAPABLE;
                asic = ASIC_ZEUS;
-               asic_phy_base = ZEUS_IO_BASE;
-               register_map = &zeus_register_map;
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
+               set_register_map(ZEUS_IO_BASE, &zeus_register_map);
                gp_resources = non_dvr_zeus_resources;
 
                pr_info("Platform: 4500 - ZEUS, NON_DVR_CAPABLE\n");
@@ -471,11 +470,6 @@ void __init configure_platform(void)
                /* The settop has PCIE but it isn't used, so don't advertise
                 * it*/
                platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
-               asic_phy_base = CRONUS_IO_BASE;   /* same as Cronus */
-               register_map = &cronus_register_map;   /* same as Cronus */
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
-               gp_resources = non_dvr_cronuslite_resources;
 
                /* ASIC version will determine if this is a real CronusLite or
                 * Castrati(Cronus) */
@@ -489,6 +483,9 @@ void __init configure_platform(void)
                else
                        asic = ASIC_CRONUSLITE;
 
+               /* Cronus and Cronus Lite have the same register map */
+               set_register_map(CRONUS_IO_BASE, &cronus_register_map);
+               gp_resources = non_dvr_cronuslite_resources;
                pr_info("Platform: 4600 - %s, NON_DVR_CAPABLE, "
                        "chipversion=0x%08X\n",
                        (asic == ASIC_CRONUS) ? "CRONUS" : "CRONUS LITE",
@@ -498,10 +495,7 @@ void __init configure_platform(void)
        case FAMILY_4600VZA:
                platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
                asic = ASIC_CRONUS;
-               asic_phy_base = CRONUS_IO_BASE;
-               register_map = &cronus_register_map;
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
+               set_register_map(CRONUS_IO_BASE, &cronus_register_map);
                gp_resources = non_dvr_cronus_resources;
 
                pr_info("Platform: Vz Class A - CRONUS, NON_DVR_CAPABLE\n");
@@ -512,10 +506,7 @@ void __init configure_platform(void)
                platform_features = DVR_CAPABLE | PCIE_CAPABLE |
                        DISPLAY_CAPABLE;
                asic = ASIC_ZEUS;
-               asic_phy_base = ZEUS_IO_BASE;
-               register_map = &zeus_register_map;
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
+               set_register_map(ZEUS_IO_BASE, &zeus_register_map);
                gp_resources = dvr_zeus_resources;
 
                pr_info("Platform: 8500/RNG200 - ZEUS, DVR_CAPABLE\n");
@@ -526,10 +517,7 @@ void __init configure_platform(void)
                platform_features = DVR_CAPABLE | PCIE_CAPABLE |
                        DISPLAY_CAPABLE;
                asic = ASIC_CRONUS;
-               asic_phy_base = CRONUS_IO_BASE;
-               register_map = &cronus_register_map;
-               asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
-                       ASIC_IO_SIZE);
+               set_register_map(CRONUS_IO_BASE, &cronus_register_map);
                gp_resources = dvr_cronus_resources;
 
                pr_info("Platform: 8600/Vz Class B - CRONUS, "
index 80b2eed21ac3d5f81549a09773b6961d48824e9a..325fab9685d1c57ce73d806e194dbc0e167f4946 100644 (file)
 
 #include <asm/mach-powertv/asic_regs.h>
 
-static DEFINE_SPINLOCK(asic_irq_lock);
+static DEFINE_RAW_SPINLOCK(asic_irq_lock);
 
 static inline int get_int(void)
 {
        unsigned long flags;
        int irq;
 
-       spin_lock_irqsave(&asic_irq_lock, flags);
+       raw_spin_lock_irqsave(&asic_irq_lock, flags);
 
        irq = (asic_read(int_int_scan) >> 4) - 1;
 
        if (irq == 0 || irq >= NR_IRQS)
                irq = -1;
 
-       spin_unlock_irqrestore(&asic_irq_lock, flags);
+       raw_spin_unlock_irqrestore(&asic_irq_lock, flags);
 
        return irq;
 }
index 698b1eafbe98656764c1f49df51f3bcfac776975..af2cae0a5ab3ee44aa9810d31236be9462aadb90 100644 (file)
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h>
 #include <linux/ctype.h>
-
 #include <linux/cpu.h>
+#include <linux/time.h>
+
 #include <asm/bootinfo.h>
 #include <asm/irq.h>
 #include <asm/mips-boards/generic.h>
 #include <asm/mips-boards/prom.h>
 #include <asm/dma.h>
-#include <linux/time.h>
+#include <asm/asm.h>
 #include <asm/traps.h>
 #include <asm/asm-offsets.h>
 #include "reset.h"
 
 /*
  * Macros for loading addresses and storing registers:
- * PTR_LA      Load the address into a register
- * LONG_S      Store the full width of the given register.
- * LONG_L      Load the full width of the given register
- * PTR_ADDIU   Add a constant value to a register used as a pointer
+ * LONG_L_     Stringified version of LONG_L for use in asm() statement
+ * LONG_S_     Stringified version of LONG_S for use in asm() statement
+ * PTR_LA_     Stringified version of PTR_LA for use in asm() statement
  * REG_SIZE    Number of 8-bit bytes in a full width register
  */
+#define LONG_L_                VAL(LONG_L) " "
+#define LONG_S_                VAL(LONG_S) " "
+#define PTR_LA_                VAL(PTR_LA) " "
+
 #ifdef CONFIG_64BIT
 #warning TODO: 64-bit code needs to be verified
-#define PTR_LA         "dla    "
-#define LONG_S         "sd     "
-#define LONG_L         "ld     "
-#define PTR_ADDIU      "daddiu "
 #define REG_SIZE       "8"             /* In bytes */
 #endif
 
 #ifdef CONFIG_32BIT
-#define PTR_LA         "la     "
-#define LONG_S         "sw     "
-#define LONG_L         "lw     "
-#define PTR_ADDIU      "addiu  "
 #define REG_SIZE       "4"             /* In bytes */
 #endif
 
@@ -113,9 +109,9 @@ static int panic_handler(struct notifier_block *notifier_block,
                 * structure. */
                __asm__ __volatile__ (
                        ".set   noat\n"
-                       LONG_S          "$at, %[at]\n"
-                       LONG_S          "$2, %[v0]\n"
-                       LONG_S          "$3, %[v1]\n"
+                       LONG_S_         "$at, %[at]\n"
+                       LONG_S_         "$2, %[v0]\n"
+                       LONG_S_         "$3, %[v1]\n"
                :
                        [at] "=m" (at),
                        [v0] "=m" (v0),
@@ -129,54 +125,54 @@ static int panic_handler(struct notifier_block *notifier_block,
                        "move           $at, %[pt_regs]\n"
 
                        /* Argument registers */
-                       LONG_S          "$4, " VAL(PT_R4) "($at)\n"
-                       LONG_S          "$5, " VAL(PT_R5) "($at)\n"
-                       LONG_S          "$6, " VAL(PT_R6) "($at)\n"
-                       LONG_S          "$7, " VAL(PT_R7) "($at)\n"
+                       LONG_S_         "$4, " VAL(PT_R4) "($at)\n"
+                       LONG_S_         "$5, " VAL(PT_R5) "($at)\n"
+                       LONG_S_         "$6, " VAL(PT_R6) "($at)\n"
+                       LONG_S_         "$7, " VAL(PT_R7) "($at)\n"
 
                        /* Temporary regs */
-                       LONG_S          "$8, " VAL(PT_R8) "($at)\n"
-                       LONG_S          "$9, " VAL(PT_R9) "($at)\n"
-                       LONG_S          "$10, " VAL(PT_R10) "($at)\n"
-                       LONG_S          "$11, " VAL(PT_R11) "($at)\n"
-                       LONG_S          "$12, " VAL(PT_R12) "($at)\n"
-                       LONG_S          "$13, " VAL(PT_R13) "($at)\n"
-                       LONG_S          "$14, " VAL(PT_R14) "($at)\n"
-                       LONG_S          "$15, " VAL(PT_R15) "($at)\n"
+                       LONG_S_         "$8, " VAL(PT_R8) "($at)\n"
+                       LONG_S_         "$9, " VAL(PT_R9) "($at)\n"
+                       LONG_S_         "$10, " VAL(PT_R10) "($at)\n"
+                       LONG_S_         "$11, " VAL(PT_R11) "($at)\n"
+                       LONG_S_         "$12, " VAL(PT_R12) "($at)\n"
+                       LONG_S_         "$13, " VAL(PT_R13) "($at)\n"
+                       LONG_S_         "$14, " VAL(PT_R14) "($at)\n"
+                       LONG_S_         "$15, " VAL(PT_R15) "($at)\n"
 
                        /* "Saved" registers */
-                       LONG_S          "$16, " VAL(PT_R16) "($at)\n"
-                       LONG_S          "$17, " VAL(PT_R17) "($at)\n"
-                       LONG_S          "$18, " VAL(PT_R18) "($at)\n"
-                       LONG_S          "$19, " VAL(PT_R19) "($at)\n"
-                       LONG_S          "$20, " VAL(PT_R20) "($at)\n"
-                       LONG_S          "$21, " VAL(PT_R21) "($at)\n"
-                       LONG_S          "$22, " VAL(PT_R22) "($at)\n"
-                       LONG_S          "$23, " VAL(PT_R23) "($at)\n"
+                       LONG_S_         "$16, " VAL(PT_R16) "($at)\n"
+                       LONG_S_         "$17, " VAL(PT_R17) "($at)\n"
+                       LONG_S_         "$18, " VAL(PT_R18) "($at)\n"
+                       LONG_S_         "$19, " VAL(PT_R19) "($at)\n"
+                       LONG_S_         "$20, " VAL(PT_R20) "($at)\n"
+                       LONG_S_         "$21, " VAL(PT_R21) "($at)\n"
+                       LONG_S_         "$22, " VAL(PT_R22) "($at)\n"
+                       LONG_S_         "$23, " VAL(PT_R23) "($at)\n"
 
                        /* Add'l temp regs */
-                       LONG_S          "$24, " VAL(PT_R24) "($at)\n"
-                       LONG_S          "$25, " VAL(PT_R25) "($at)\n"
+                       LONG_S_         "$24, " VAL(PT_R24) "($at)\n"
+                       LONG_S_         "$25, " VAL(PT_R25) "($at)\n"
 
                        /* Kernel temp regs */
-                       LONG_S          "$26, " VAL(PT_R26) "($at)\n"
-                       LONG_S          "$27, " VAL(PT_R27) "($at)\n"
+                       LONG_S_         "$26, " VAL(PT_R26) "($at)\n"
+                       LONG_S_         "$27, " VAL(PT_R27) "($at)\n"
 
                        /* Global pointer, stack pointer, frame pointer and
                         * return address */
-                       LONG_S          "$gp, " VAL(PT_R28) "($at)\n"
-                       LONG_S          "$sp, " VAL(PT_R29) "($at)\n"
-                       LONG_S          "$fp, " VAL(PT_R30) "($at)\n"
-                       LONG_S          "$ra, " VAL(PT_R31) "($at)\n"
+                       LONG_S_         "$gp, " VAL(PT_R28) "($at)\n"
+                       LONG_S_         "$sp, " VAL(PT_R29) "($at)\n"
+                       LONG_S_         "$fp, " VAL(PT_R30) "($at)\n"
+                       LONG_S_         "$ra, " VAL(PT_R31) "($at)\n"
 
                        /* Now we can get the $at and v0 registers back and
                         * store them */
-                       LONG_L          "$8, %[at]\n"
-                       LONG_S          "$8, " VAL(PT_R1) "($at)\n"
-                       LONG_L          "$8, %[v0]\n"
-                       LONG_S          "$8, " VAL(PT_R2) "($at)\n"
-                       LONG_L          "$8, %[v1]\n"
-                       LONG_S          "$8, " VAL(PT_R3) "($at)\n"
+                       LONG_L_         "$8, %[at]\n"
+                       LONG_S_         "$8, " VAL(PT_R1) "($at)\n"
+                       LONG_L_         "$8, %[v0]\n"
+                       LONG_S_         "$8, " VAL(PT_R2) "($at)\n"
+                       LONG_L_         "$8, %[v1]\n"
+                       LONG_S_         "$8, " VAL(PT_R3) "($at)\n"
                :
                :
                        [at] "m" (at),
@@ -191,8 +187,8 @@ static int panic_handler(struct notifier_block *notifier_block,
                __asm__ __volatile__ (
                        ".set   noat\n"
                "1:\n"
-                       PTR_LA          "$at, 1b\n"
-                       LONG_S          "$at, %[cp0_epc]\n"
+                       PTR_LA_         "$at, 1b\n"
+                       LONG_S_         "$at, %[cp0_epc]\n"
                :
                        [cp0_epc] "=m" (my_regs.cp0_epc)
                :
index d9c79d8be81d1b65745e2454b12e56db05ea75c5..c3d30a88daf3a1555f9a1495f058210479a3b0ce 100644 (file)
@@ -133,4 +133,3 @@ pfn_t node_getfirstfree(cnodeid_t cnode)
                return (KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >>
                                                                PAGE_SHIFT);
 }
-
index 6c5a630566f93d77997839577fbc5386c5830c97..bc4fa8dd67f318b4f5f1881d7f353b6ab80b49f8 100644 (file)
 #endif
 
 #define CNODEID_NONE (cnodeid_t)-1
-#define enter_panic_mode()     spin_lock(&nmi_lock)
 
 typedef unsigned long machreg_t;
 
-DEFINE_SPINLOCK(nmi_lock);
+static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED;
 
 /*
  * Lets see what else we need to do here. Set up sp, gp?
@@ -193,9 +192,9 @@ cont_nmi_dump(void)
        atomic_inc(&nmied_cpus);
 #endif
        /*
-        * Use enter_panic_mode to allow only 1 cpu to proceed
+        * Only allow 1 cpu to proceed
         */
-       enter_panic_mode();
+       arch_spin_lock(&nmi_lock);
 
 #ifdef REAL_NMI_SIGNAL
        /*
index 5c2bf111ca67ecf7a36230bccd2b19701f36f367..d8b65204d28868561d9cff524bc8853fad824f0a 100644 (file)
@@ -512,10 +512,6 @@ void __init arch_init_irq(void)
                                "level");
                        break;
 
-               case CRIME_GBE0_IRQ ... CRIME_GBE3_IRQ:
-                       set_irq_chip_and_handler_name(irq,
-                               &crime_edge_interrupt, handle_edge_irq, "edge");
-                       break;
                case CRIME_CPUERR_IRQ:
                case CRIME_MEMERR_IRQ:
                        set_irq_chip_and_handler_name(irq,
@@ -523,12 +519,9 @@ void __init arch_init_irq(void)
                                "level");
                        break;
 
+               case CRIME_GBE0_IRQ ... CRIME_GBE3_IRQ:
                case CRIME_RE_EMPTY_E_IRQ ... CRIME_RE_IDLE_E_IRQ:
                case CRIME_SOFT0_IRQ ... CRIME_SOFT2_IRQ:
-                       set_irq_chip_and_handler_name(irq,
-                               &crime_edge_interrupt, handle_edge_irq, "edge");
-                       break;
-
                case CRIME_VICE_IRQ:
                        set_irq_chip_and_handler_name(irq,
                                &crime_edge_interrupt, handle_edge_irq, "edge");
index 4070268aa769826c46bb3c5328f398a71abc0283..06e25d949768bff9f35679951bca010830682484 100644 (file)
@@ -73,14 +73,14 @@ static struct irq_chip bcm1480_irq_type = {
 /* Store the CPU id (not the logical number) */
 int bcm1480_irq_owner[BCM1480_NR_IRQS];
 
-DEFINE_SPINLOCK(bcm1480_imr_lock);
+static DEFINE_RAW_SPINLOCK(bcm1480_imr_lock);
 
 void bcm1480_mask_irq(int cpu, int irq)
 {
        unsigned long flags, hl_spacing;
        u64 cur_ints;
 
-       spin_lock_irqsave(&bcm1480_imr_lock, flags);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
        hl_spacing = 0;
        if ((irq >= BCM1480_NR_IRQS_HALF) && (irq <= BCM1480_NR_IRQS)) {
                hl_spacing = BCM1480_IMR_HL_SPACING;
@@ -89,7 +89,7 @@ void bcm1480_mask_irq(int cpu, int irq)
        cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
        cur_ints |= (((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
-       spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
 }
 
 void bcm1480_unmask_irq(int cpu, int irq)
@@ -97,7 +97,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
        unsigned long flags, hl_spacing;
        u64 cur_ints;
 
-       spin_lock_irqsave(&bcm1480_imr_lock, flags);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
        hl_spacing = 0;
        if ((irq >= BCM1480_NR_IRQS_HALF) && (irq <= BCM1480_NR_IRQS)) {
                hl_spacing = BCM1480_IMR_HL_SPACING;
@@ -106,7 +106,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
        cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
        cur_ints &= ~(((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
-       spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
 }
 
 #ifdef CONFIG_SMP
@@ -123,7 +123,7 @@ static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)
        cpu = cpu_logical_map(i);
 
        /* Protect against other affinity changers and IMR manipulation */
-       spin_lock_irqsave(&bcm1480_imr_lock, flags);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
 
        /* Swizzle each CPU's IMR (but leave the IP selection alone) */
        old_cpu = bcm1480_irq_owner[irq];
@@ -148,7 +148,7 @@ static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)
                        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING)));
                }
        }
-       spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
 
        return 0;
 }
index 15ea778b5e6664c0f305681b3c9a0c3c2fad3f2e..ed2453eab5cbab8b2f0c8d31da28be35e465570f 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
-#include <linux/smp_lock.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/errno.h>
index 5e7f2016cceb77bc543b1c0396fef16b918cadb4..ab44a2f59ee497a973da4c74a2405b6f7f5fcf3c 100644 (file)
@@ -72,20 +72,20 @@ static struct irq_chip sb1250_irq_type = {
 /* Store the CPU id (not the logical number) */
 int sb1250_irq_owner[SB1250_NR_IRQS];
 
-DEFINE_SPINLOCK(sb1250_imr_lock);
+static DEFINE_RAW_SPINLOCK(sb1250_imr_lock);
 
 void sb1250_mask_irq(int cpu, int irq)
 {
        unsigned long flags;
        u64 cur_ints;
 
-       spin_lock_irqsave(&sb1250_imr_lock, flags);
+       raw_spin_lock_irqsave(&sb1250_imr_lock, flags);
        cur_ints = ____raw_readq(IOADDR(A_IMR_MAPPER(cpu) +
                                        R_IMR_INTERRUPT_MASK));
        cur_ints |= (((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
                                        R_IMR_INTERRUPT_MASK));
-       spin_unlock_irqrestore(&sb1250_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags);
 }
 
 void sb1250_unmask_irq(int cpu, int irq)
@@ -93,13 +93,13 @@ void sb1250_unmask_irq(int cpu, int irq)
        unsigned long flags;
        u64 cur_ints;
 
-       spin_lock_irqsave(&sb1250_imr_lock, flags);
+       raw_spin_lock_irqsave(&sb1250_imr_lock, flags);
        cur_ints = ____raw_readq(IOADDR(A_IMR_MAPPER(cpu) +
                                        R_IMR_INTERRUPT_MASK));
        cur_ints &= ~(((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
                                        R_IMR_INTERRUPT_MASK));
-       spin_unlock_irqrestore(&sb1250_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags);
 }
 
 #ifdef CONFIG_SMP
@@ -115,7 +115,7 @@ static int sb1250_set_affinity(unsigned int irq, const struct cpumask *mask)
        cpu = cpu_logical_map(i);
 
        /* Protect against other affinity changers and IMR manipulation */
-       spin_lock_irqsave(&sb1250_imr_lock, flags);
+       raw_spin_lock_irqsave(&sb1250_imr_lock, flags);
 
        /* Swizzle each CPU's IMR (but leave the IP selection alone) */
        old_cpu = sb1250_irq_owner[irq];
@@ -137,7 +137,7 @@ static int sb1250_set_affinity(unsigned int irq, const struct cpumask *mask)
                ____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
                                        R_IMR_INTERRUPT_MASK));
        }
-       spin_unlock_irqrestore(&sb1250_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags);
 
        return 0;
 }
index 46f00691f448865888991202e529ee9334bf9044..90c558f7c0fa91b18df793a903cf8296fffc12fa 100644 (file)
@@ -132,7 +132,7 @@ device_initcall(snirm_setup_devinit);
  * readb/writeb to access them
  */
 
-DEFINE_SPINLOCK(sni_rm200_i8259A_lock);
+static DEFINE_RAW_SPINLOCK(sni_rm200_i8259A_lock);
 #define PIC_CMD    0x00
 #define PIC_IMR    0x01
 #define PIC_ISR    PIC_CMD
@@ -161,13 +161,13 @@ static void sni_rm200_disable_8259A_irq(unsigned int irq)
 
        irq -= RM200_I8259A_IRQ_BASE;
        mask = 1 << irq;
-       spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
+       raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
        rm200_cached_irq_mask |= mask;
        if (irq & 8)
                writeb(cached_slave_mask, rm200_pic_slave + PIC_IMR);
        else
                writeb(cached_master_mask, rm200_pic_master + PIC_IMR);
-       spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
 }
 
 static void sni_rm200_enable_8259A_irq(unsigned int irq)
@@ -177,13 +177,13 @@ static void sni_rm200_enable_8259A_irq(unsigned int irq)
 
        irq -= RM200_I8259A_IRQ_BASE;
        mask = ~(1 << irq);
-       spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
+       raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
        rm200_cached_irq_mask &= mask;
        if (irq & 8)
                writeb(cached_slave_mask, rm200_pic_slave + PIC_IMR);
        else
                writeb(cached_master_mask, rm200_pic_master + PIC_IMR);
-       spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
 }
 
 static inline int sni_rm200_i8259A_irq_real(unsigned int irq)
@@ -216,7 +216,7 @@ void sni_rm200_mask_and_ack_8259A(unsigned int irq)
 
        irq -= RM200_I8259A_IRQ_BASE;
        irqmask = 1 << irq;
-       spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
+       raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
        /*
         * Lightweight spurious IRQ detection. We do not want
         * to overdo spurious IRQ handling - it's usually a sign
@@ -247,7 +247,7 @@ handle_real_irq:
                writeb(cached_master_mask, rm200_pic_master + PIC_IMR);
                writeb(0x60+irq, rm200_pic_master + PIC_CMD);
        }
-       spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
        return;
 
 spurious_8259A_irq:
@@ -298,7 +298,7 @@ static inline int sni_rm200_i8259_irq(void)
 {
        int irq;
 
-       spin_lock(&sni_rm200_i8259A_lock);
+       raw_spin_lock(&sni_rm200_i8259A_lock);
 
        /* Perform an interrupt acknowledge cycle on controller 1. */
        writeb(0x0C, rm200_pic_master + PIC_CMD);       /* prepare for poll */
@@ -325,7 +325,7 @@ static inline int sni_rm200_i8259_irq(void)
                        irq = -1;
        }
 
-       spin_unlock(&sni_rm200_i8259A_lock);
+       raw_spin_unlock(&sni_rm200_i8259A_lock);
 
        return likely(irq >= 0) ? irq + RM200_I8259A_IRQ_BASE : irq;
 }
@@ -334,7 +334,7 @@ void sni_rm200_init_8259A(void)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
+       raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags);
 
        writeb(0xff, rm200_pic_master + PIC_IMR);
        writeb(0xff, rm200_pic_slave + PIC_IMR);
@@ -352,7 +352,7 @@ void sni_rm200_init_8259A(void)
        writeb(cached_master_mask, rm200_pic_master + PIC_IMR);
        writeb(cached_slave_mask, rm200_pic_slave + PIC_IMR);
 
-       spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
+       raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags);
 }
 
 /*
@@ -404,7 +404,7 @@ void __init sni_rm200_i8259_irqs(void)
        if (!rm200_pic_master)
                return;
        rm200_pic_slave = ioremap_nocache(0x160000a0, 4);
-       if (!rm200_pic_master) {
+       if (!rm200_pic_slave) {
                iounmap(rm200_pic_master);
                return;
        }
index e27809b6d04ffcdb437808622e358585962f57a6..7174d830dd05824dfb4e1c925e39837bce8a1e16 100644 (file)
@@ -399,11 +399,6 @@ const char *get_system_type(void)
        return txx9_system_type;
 }
 
-char * __init prom_getcmdline(void)
-{
-       return &(arcs_cmdline[0]);
-}
-
 const char *__init prom_getenv(const char *name)
 {
        const s32 *str;
index 25e50a7be3877692d1ffb8ec40c5f23aa17813fa..3206f76f300b727a91d5566c92bbc64cddd82be0 100644 (file)
@@ -67,8 +67,6 @@ static void jmr3927_board_init(void);
 
 static void __init jmr3927_mem_setup(void)
 {
-       char *argptr;
-
        set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
 
        _machine_restart = jmr3927_machine_restart;
@@ -97,11 +95,6 @@ static void __init jmr3927_mem_setup(void)
        jmr3927_board_init();
 
        tx3927_sio_init(0, 1 << 1); /* ch1: noCTS */
-#ifdef CONFIG_SERIAL_TXX9_CONSOLE
-       argptr = prom_getcmdline();
-       if (!strstr(argptr, "console="))
-               strcat(argptr, " console=ttyS1,115200");
-#endif
 }
 
 static void __init jmr3927_pci_setup(void)
index ee468eaee4f7cda6a02db29a1a1b04c11878e1b2..b15adfc2d7264e81271147759f80096c1624b2ac 100644 (file)
@@ -187,8 +187,6 @@ static void __init rbtx4937_clock_init(void);
 
 static void __init rbtx4927_mem_setup(void)
 {
-       char *argptr;
-
        if (TX4927_REV_PCODE() == 0x4927) {
                rbtx4927_clock_init();
                tx4927_setup();
@@ -213,11 +211,6 @@ static void __init rbtx4927_mem_setup(void)
        gpio_direction_output(15, 1);
 
        tx4927_sio_init(0, 0);
-#ifdef CONFIG_SERIAL_TXX9_CONSOLE
-       argptr = prom_getcmdline();
-       if (!strstr(argptr, "console="))
-               strcat(argptr, " console=ttyS0,38400");
-#endif
 }
 
 static void __init rbtx4927_clock_init(void)
index d66509b1428460653e5334a4f2de4cdce3eede73..d6e70dab3bd3b064e052850ae2c72aad8e1768b2 100644 (file)
@@ -153,7 +153,6 @@ static void __init rbtx4938_time_init(void)
 static void __init rbtx4938_mem_setup(void)
 {
        unsigned long long pcfg;
-       char *argptr;
 
        if (txx9_master_clock == 0)
                txx9_master_clock = 25000000; /* 25MHz */
@@ -168,11 +167,6 @@ static void __init rbtx4938_mem_setup(void)
 #endif
 
        tx4938_sio_init(7372800, 0);
-#ifdef CONFIG_SERIAL_TXX9_CONSOLE
-       argptr = prom_getcmdline();
-       if (!strstr(argptr, "console="))
-               strcat(argptr, " console=ttyS0,38400");
-#endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
        pr_info("PIOSEL: disabling both ATA and NAND selection\n");
index 78cd134ddf7dc19f5c51b4ebd5ce48f8c9d01847..d6119b879a9812f9f1e50749b06d764c38ebfb5c 100644 (file)
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void pcibios_align_resource(void *data, struct resource *res,
-                           resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
+       resource_size_t start = res->start;
+
 #if 0
        struct pci_dev *dev = data;
 
@@ -47,14 +49,10 @@ void pcibios_align_resource(void *data, struct resource *res,
               );
 #endif
 
-       if (res->flags & IORESOURCE_IO) {
-               unsigned long start = res->start;
+       if ((res->flags & IORESOURCE_IO) && (start & 0x300))
+               start = (start + 0x3ff) & ~0x3ff;
 
-               if (start & 0x300) {
-                       start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
-       }
+       return start;
 }
 
 
index 2cb7e75ba1c0164bf34a0174adc67b136a847e08..6d8720a0a59945bfa4b3c60d70c4d2ceb48c8a12 100644 (file)
@@ -331,12 +331,10 @@ static int __init pci_check_direct(void)
 static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
 {
        unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
-       struct resource *devr = &dev->resource[idx];
+       struct resource *devr = &dev->resource[idx], *busr;
 
        if (dev->bus) {
-               for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-                       struct resource *busr = dev->bus->resource[i];
-
+               pci_bus_for_each_resource(dev->bus, busr, i) {
                        if (!busr || (busr->flags ^ devr->flags) & type_mask)
                                continue;
 
index 524d9352f17e56a4120008d601d219590fad6a23..f388dc68f60544cf941dfd66267b2a6f7167db1f 100644 (file)
@@ -18,7 +18,6 @@ config PARISC
        select BUG
        select HAVE_PERF_EVENTS
        select GENERIC_ATOMIC64 if !64BIT
-       select HAVE_ARCH_TRACEHOOK
        help
          The PA-RISC microprocessor is designed by Hewlett-Packard and used
          in many of their workstations & servers (HP9000 700 and 800 series,
index 7a73b615c23d29c7d2702958d2688d8fc6fd1e85..477277739da5f8bd895b8bd814fd59c733dfc962 100644 (file)
@@ -38,6 +38,18 @@ void flush_cache_mm(struct mm_struct *mm);
 
 #define flush_kernel_dcache_range(start,size) \
        flush_kernel_dcache_range_asm((start), (start)+(size));
+/* vmap range flushes and invalidates.  Architecturally, we don't need
+ * the invalidate, because the CPU should refuse to speculate once an
+ * area has been flushed, so invalidate is left empty */
+static inline void flush_kernel_vmap_range(void *vaddr, int size)
+{
+       unsigned long start = (unsigned long)vaddr;
+
+       flush_kernel_dcache_range_asm(start, start + size);
+}
+static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
+{
+}
 
 #define flush_cache_vmap(start, end)           flush_cache_all()
 #define flush_cache_vunmap(start, end)         flush_cache_all()
index f7064abc3bb6e60a544e3bfb97c12f468768fd89..38372e7cbb88f1d53372061e5e6e23684bcbc4a9 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <asm/io.h>
 #include <asm/system.h>
-#include <asm/cache.h>         /* for L1_CACHE_BYTES */
 #include <asm/superio.h>
 
 #define DEBUG_RESOURCES 0
@@ -123,6 +122,10 @@ static int __init pcibios_init(void)
        } else {
                printk(KERN_WARNING "pci_bios != NULL but init() is!\n");
        }
+
+       /* Set the CLS for PCI as early as possible. */
+       pci_cache_line_size = pci_dfl_cache_line_size;
+
        return 0;
 }
 
@@ -171,7 +174,7 @@ void pcibios_set_master(struct pci_dev *dev)
        ** upper byte is PCI_LATENCY_TIMER.
        */
        pci_write_config_word(dev, PCI_CACHE_LINE_SIZE,
-                               (0x80 << 8) | (L1_CACHE_BYTES / sizeof(u32)));
+                             (0x80 << 8) | pci_cache_line_size);
 }
 
 
@@ -254,10 +257,10 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
  * Since we are just checking candidates, don't use any fields other
  * than res->start.
  */
-void pcibios_align_resource(void *data, struct resource *res,
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
                                resource_size_t size, resource_size_t alignment)
 {
-       resource_size_t mask, align;
+       resource_size_t mask, align, start = res->start;
 
        DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n",
                pci_name(((struct pci_dev *) data)),
@@ -269,10 +272,10 @@ void pcibios_align_resource(void *data, struct resource *res,
 
        /* Align to largest of MIN or input size */
        mask = max(alignment, align) - 1;
-       res->start += mask;
-       res->start &= ~mask;
+       start += mask;
+       start &= ~mask;
 
-       /* The caller updates the end field, we don't.  */
+       return start;
 }
 
 
index fb37ac52e46c72c225774241a02ef9322d625662..35c827e94e311366af3bcaff6554688558d6dde5 100644 (file)
@@ -468,7 +468,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
-       tracehook_signal_handler(sig, info, ka, regs, 0);
+       tracehook_signal_handler(sig, info, ka, regs, 
+               test_thread_flag(TIF_SINGLESTEP) ||
+               test_thread_flag(TIF_BLOCKSTEP));
 
        return 1;
 }
index ba3948c700727b212aa2952e729176b7c1501442..155d571f5e261c82d59f55ea2758d9accd6af15a 100644 (file)
@@ -58,7 +58,7 @@ config IRQ_PER_CPU
 
 config NR_IRQS
        int "Number of virtual interrupt numbers"
-       range 32 512
+       range 32 32768
        default "512"
        help
          This defines the number of virtual interrupt numbers the kernel
@@ -173,6 +173,7 @@ config PPC_OF
 
 config OF
        def_bool y
+       select OF_FLATTREE
 
 config PPC_UDBG_16550
        bool
@@ -240,6 +241,33 @@ config PPC_OF_PLATFORM_PCI
 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
        def_bool y
 
+config PPC_ADV_DEBUG_REGS
+       bool
+       depends on 40x || BOOKE
+       default y
+
+config PPC_ADV_DEBUG_IACS
+       int
+       depends on PPC_ADV_DEBUG_REGS
+       default 4 if 44x
+       default 2
+
+config PPC_ADV_DEBUG_DACS
+       int
+       depends on PPC_ADV_DEBUG_REGS
+       default 2
+
+config PPC_ADV_DEBUG_DVCS
+       int
+       depends on PPC_ADV_DEBUG_REGS
+       default 2 if 44x
+       default 0
+
+config PPC_ADV_DEBUG_DAC_RANGE
+       bool
+       depends on PPC_ADV_DEBUG_REGS && 44x
+       default y
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
index 826a30a00f5966386fb98140787657a1e7088859..bb2465bcb32766598c663ddca9d0893399891564 100644 (file)
@@ -20,7 +20,7 @@
 all: $(obj)/zImage
 
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-                -fno-strict-aliasing -Os -msoft-float -pipe -D__KERNEL__\
+                -fno-strict-aliasing -Os -msoft-float -pipe \
                 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
                 -isystem $(shell $(CROSS32CC) -print-file-name=include)
 BOOTAFLAGS     := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
@@ -34,8 +34,6 @@ BOOTCFLAGS    += -fno-stack-protector
 endif
 
 BOOTCFLAGS     += -I$(obj) -I$(srctree)/$(obj)
-BOOTCFLAGS     += -include include/linux/autoconf.h -Iarch/powerpc/include
-BOOTCFLAGS     += -Iinclude
 
 DTS_FLAGS      ?= -p 1024
 
index 414ef8b7e5753b7f5b31a2c26ec7f7e54dbc8cb5..30f41204acfa10c9a377a17b10763c4ec0572e72 100644 (file)
@@ -60,6 +60,7 @@
                        d-cache-size = <32768>;
                        dcr-controller;
                        dcr-access-method = "native";
+                       next-level-cache = <&L2C0>;
                };
        };
 
                        dcr-reg = <0x010 0x002>;
                };
 
+               CRYPTO: crypto@180000 {
+                       compatible = "amcc,ppc460gt-crypto", "amcc,ppc4xx-crypto";
+                       reg = <4 0x00180000 0x80400>;
+                       interrupt-parent = <&UIC0>;
+                       interrupts = <0x1d 0x4>;
+               };
+
                MAL0: mcmal {
                        compatible = "ibm,mcmal-460gt", "ibm,mcmal2";
                        dcr-reg = <0x180 0x062>;
                                max-frame-size = <9000>;
                                rx-fifo-size = <4096>;
                                tx-fifo-size = <2048>;
+                               rx-fifo-size-gige = <16384>;
                                phy-mode = "sgmii";
                                phy-map = <0xffffffff>;
                                gpcs-address = <0x0000000a>;
                                max-frame-size = <9000>;
                                rx-fifo-size = <4096>;
                                tx-fifo-size = <2048>;
+                               rx-fifo-size-gige = <16384>;
                                phy-mode = "sgmii";
                                phy-map = <0x00000000>;
                                gpcs-address = <0x0000000b>;
                                max-frame-size = <9000>;
                                rx-fifo-size = <4096>;
                                tx-fifo-size = <2048>;
+                               rx-fifo-size-gige = <16384>;
+                               tx-fifo-size-gige = <16384>; /* emac2&3 only */
                                phy-mode = "sgmii";
                                phy-map = <0x00000001>;
                                gpcs-address = <0x0000000C>;
index c86114e93f1e62400cf0fc9073c9645960471102..977f260d5e64ce3e2fae9b40a067446a80b8fe2a 100644 (file)
                        device_type = "open-pic";
                };
 
+               msi@41600 {
+                       compatible = "fsl,mpc8641-msi", "fsl,mpic-msi";
+                       reg = <0x41600 0x80>;
+                       msi-available-ranges = <0 0x100>;
+                       interrupts = <
+                               0xe0 0
+                               0xe1 0
+                               0xe2 0
+                               0xe3 0
+                               0xe4 0
+                               0xe5 0
+                               0xe6 0
+                               0xe7 0>;
+                       interrupt-parent = <&mpic>;
+               };
+
                global-utilities@e0000 {
                        compatible = "fsl,mpc8641-guts";
                        reg = <0xe0000 0x1000>;
index 820c2b355ab1fddacf2cf8d059f4a0d729c2acb8..8e4efff3bda13fc197cbc00272c09d24e2f24d26 100644 (file)
@@ -32,6 +32,7 @@
                serial0 = &serial0;
                serial1 = &serial1;
                pci0 = &pci0;
+               pci1 = &pci1;
        };
 
        cpus {
                        device_type = "open-pic";
                };
 
+               msi@41600 {
+                       compatible = "fsl,mpc8641-msi", "fsl,mpic-msi";
+                       reg = <0x41600 0x80>;
+                       msi-available-ranges = <0 0x100>;
+                       interrupts = <
+                               0xe0 0
+                               0xe1 0
+                               0xe2 0
+                               0xe3 0
+                               0xe4 0
+                               0xe5 0
+                               0xe6 0
+                               0xe7 0>;
+                       interrupt-parent = <&mpic>;
+               };
+
                global-utilities@e0000 {
                        compatible = "fsl,mpc8641-guts";
                        reg = <0xe0000 0x1000>;
                clock-frequency = <33333333>;
                interrupt-parent = <&mpic>;
                interrupts = <0x18 0x2>;
-               interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+               interrupt-map-mask = <0xff00 0x0 0x0 0x7>;
                interrupt-map = <
                        0x0000 0x0 0x0 0x1 &mpic 0x0 0x2
                        0x0000 0x0 0x0 0x2 &mpic 0x1 0x2
index 30911adefc8ebe361b467bfc2b5ecc0ce74d6426..bb7060078fb4d6b1bd5131e1944453d1df21b7cd 100644 (file)
                interrupts = <19 2>;
                interrupt-parent = <&mpic>;
 
-               ranges = <0 0 0xff000000 0x01000000     // 16MB Boot flash
-                         1 0 0xe8000000 0x08000000     // Paged Flash 0
-                         2 0 0xe0000000 0x08000000     // Paged Flash 1
-                         3 0 0xfc100000 0x00020000     // NVRAM
-                         4 0 0xfc000000 0x00008000     // FPGA
-                         5 0 0xfc008000 0x00008000     // AFIX FPGA
-                         6 0 0xfd000000 0x00800000     // IO FPGA (8-bit)
-                         7 0 0xfd800000 0x00800000>;   // IO FPGA (32-bit)
+               ranges = <0 0 0xff000000 0x01000000     // 16MB Boot flash
+                         1 0 0xe8000000 0x08000000     // Paged Flash 0
+                         2 0 0xe0000000 0x08000000     // Paged Flash 1
+                         3 0 0xfc100000 0x00020000     // NVRAM
+                         4 0 0xfc000000 0x00008000     // FPGA
+                         5 0 0xfc008000 0x00008000     // AFIX FPGA
+                         6 0 0xfd000000 0x00800000     // IO FPGA (8-bit)
+                         7 0 0xfd800000 0x00800000>;   // IO FPGA (32-bit)
+
+               /* flash@0,0 is a mirror of part of the memory in flash@1,0
+               flash@0,0 {
+                       compatible = "gef,sbc610-firmware-mirror", "cfi-flash";
+                       reg = <0x0 0x0 0x1000000>;
+                       bank-width = <4>;
+                       device-width = <2>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       partition@0 {
+                               label = "firmware";
+                               reg = <0x0 0x1000000>;
+                               read-only;
+                       };
+               };
+               */
+
+               flash@1,0 {
+                       compatible = "gef,sbc610-paged-flash", "cfi-flash";
+                       reg = <0x1 0x0 0x8000000>;
+                       bank-width = <4>;
+                       device-width = <2>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       partition@0 {
+                               label = "user";
+                               reg = <0x0 0x7800000>;
+                       };
+                       partition@7800000 {
+                               label = "firmware";
+                               reg = <0x7800000 0x800000>;
+                               read-only;
+                       };
+               };
 
                nvram@3,0 {
                        device_type = "nvram";
                        device_type = "open-pic";
                };
 
+               msi@41600 {
+                       compatible = "fsl,mpc8641-msi", "fsl,mpic-msi";
+                       reg = <0x41600 0x80>;
+                       msi-available-ranges = <0 0x100>;
+                       interrupts = <
+                               0xe0 0
+                               0xe1 0
+                               0xe2 0
+                               0xe3 0
+                               0xe4 0
+                               0xe5 0
+                               0xe6 0
+                               0xe7 0>;
+                       interrupt-parent = <&mpic>;
+               };
+
                global-utilities@e0000 {
                        compatible = "fsl,mpc8641-guts";
                        reg = <0xe0000 0x1000>;
index f6f618939293ff95a0f20d1f19d3e115ee75529c..d62a4fb6f93ce31e139c1112084eab2f11d92fa3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Source for AMCC Glacier (460GT)
  *
- * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
+ * Copyright 2008-2010 DENX Software Engineering, Stefan Roese <sr@denx.de>
  *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without
@@ -42,6 +42,7 @@
                        d-cache-size = <32768>;
                        dcr-controller;
                        dcr-access-method = "native";
+                       next-level-cache = <&L2C0>;
                };
        };
 
                dcr-reg = <0x00c 0x002>;
        };
 
+       L2C0: l2c {
+               compatible = "ibm,l2-cache-460gt", "ibm,l2-cache";
+               dcr-reg = <0x020 0x008          /* Internal SRAM DCR's */
+                          0x030 0x008>;        /* L2 cache DCR's */
+               cache-line-size = <32>;         /* 32 bytes */
+               cache-size = <262144>;          /* L2, 256K */
+               interrupt-parent = <&UIC1>;
+               interrupts = <11 1>;
+       };
+
        plb {
                compatible = "ibm,plb-460gt", "ibm,plb4";
                #address-cells = <2>;
                        dcr-reg = <0x010 0x002>;
                };
 
+               CRYPTO: crypto@180000 {
+                       compatible = "amcc,ppc460gt-crypto", "amcc,ppc4xx-crypto";
+                       reg = <4 0x00180000 0x80400>;
+                       interrupt-parent = <&UIC0>;
+                       interrupts = <0x1d 0x4>;
+               };
+
                MAL0: mcmal {
                        compatible = "ibm,mcmal-460gt", "ibm,mcmal2";
                        dcr-reg = <0x180 0x062>;
                                                reg = <0x03fa0000 0x00060000>;
                                        };
                                };
+
+                               ndfc@3,0 {
+                                       compatible = "ibm,ndfc";
+                                       reg = <0x00000003 0x00000000 0x00002000>;
+                                       ccr = <0x00001000>;
+                                       bank-settings = <0x80002222>;
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       nand {
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+
+                                               partition@0 {
+                                                       label = "u-boot";
+                                                       reg = <0x00000000 0x00100000>;
+                                               };
+                                               partition@100000 {
+                                                       label = "user";
+                                                       reg = <0x00000000 0x03f00000>;
+                                               };
+                                       };
+                               };
                        };
 
                        UART0: serial@ef600300 {
                                reg = <0xef600700 0x00000014>;
                                interrupt-parent = <&UIC0>;
                                interrupts = <0x2 0x4>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               rtc@68 {
+                                       compatible = "stm,m41t80";
+                                       reg = <0x68>;
+                                       interrupt-parent = <&UIC2>;
+                                       interrupts = <0x19 0x8>;
+                               };
+                               sttm@48 {
+                                       compatible = "ad,ad7414";
+                                       reg = <0x48>;
+                                       interrupt-parent = <&UIC1>;
+                                       interrupts = <0x14 0x8>;
+                               };
                        };
 
                        IIC1: i2c@ef600800 {
 
                        EMAC0: ethernet@ef600e00 {
                                device_type = "network";
-                               compatible = "ibm,emac-460gt", "ibm,emac4";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
                                interrupt-parent = <&EMAC0>;
                                interrupts = <0x0 0x1>;
                                #interrupt-cells = <1>;
                                #size-cells = <0>;
                                interrupt-map = </*Status*/ 0x0 &UIC2 0x10 0x4
                                                 /*Wake*/   0x1 &UIC2 0x14 0x4>;
-                               reg = <0xef600e00 0x00000074>;
+                               reg = <0xef600e00 0x000000c4>;
                                local-mac-address = [000000000000]; /* Filled in by U-Boot */
                                mal-device = <&MAL0>;
                                mal-tx-channel = <0>;
 
                        EMAC1: ethernet@ef600f00 {
                                device_type = "network";
-                               compatible = "ibm,emac-460gt", "ibm,emac4";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
                                interrupt-parent = <&EMAC1>;
                                interrupts = <0x0 0x1>;
                                #interrupt-cells = <1>;
                                #size-cells = <0>;
                                interrupt-map = </*Status*/ 0x0 &UIC2 0x11 0x4
                                                 /*Wake*/   0x1 &UIC2 0x15 0x4>;
-                               reg = <0xef600f00 0x00000074>;
+                               reg = <0xef600f00 0x000000c4>;
                                local-mac-address = [000000000000]; /* Filled in by U-Boot */
                                mal-device = <&MAL0>;
                                mal-tx-channel = <1>;
 
                        EMAC2: ethernet@ef601100 {
                                device_type = "network";
-                               compatible = "ibm,emac-460gt", "ibm,emac4";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
                                interrupt-parent = <&EMAC2>;
                                interrupts = <0x0 0x1>;
                                #interrupt-cells = <1>;
                                #size-cells = <0>;
                                interrupt-map = </*Status*/ 0x0 &UIC2 0x12 0x4
                                                 /*Wake*/   0x1 &UIC2 0x16 0x4>;
-                               reg = <0xef601100 0x00000074>;
+                               reg = <0xef601100 0x000000c4>;
                                local-mac-address = [000000000000]; /* Filled in by U-Boot */
                                mal-device = <&MAL0>;
                                mal-tx-channel = <2>;
 
                        EMAC3: ethernet@ef601200 {
                                device_type = "network";
-                               compatible = "ibm,emac-460gt", "ibm,emac4";
+                               compatible = "ibm,emac-460gt", "ibm,emac4sync";
                                interrupt-parent = <&EMAC3>;
                                interrupts = <0x0 0x1>;
                                #interrupt-cells = <1>;
                                #size-cells = <0>;
                                interrupt-map = </*Status*/ 0x0 &UIC2 0x13 0x4
                                                 /*Wake*/   0x1 &UIC2 0x17 0x4>;
-                               reg = <0xef601200 0x00000074>;
+                               reg = <0xef601200 0x000000c4>;
                                local-mac-address = [000000000000]; /* Filled in by U-Boot */
                                mal-device = <&MAL0>;
                                mal-tx-channel = <3>;
                         * later cannot be changed
                         */
                        ranges = <0x02000000 0x00000000 0x80000000 0x0000000d 0x80000000 0x00000000 0x80000000
+                                 0x02000000 0x00000000 0x00000000 0x0000000c 0x0ee00000 0x00000000 0x00100000
                                  0x01000000 0x00000000 0x00000000 0x0000000c 0x08000000 0x00000000 0x00010000>;
 
                        /* Inbound 2GB range starting at 0 */
                         * later cannot be changed
                         */
                        ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000
+                                 0x02000000 0x00000000 0x00000000 0x0000000f 0x00000000 0x00000000 0x00100000
                                  0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>;
 
                        /* Inbound 2GB range starting at 0 */
                         * later cannot be changed
                         */
                        ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x80000000 0x00000000 0x80000000
+                                 0x02000000 0x00000000 0x00000000 0x0000000f 0x00100000 0x00000000 0x00100000
                                  0x01000000 0x00000000 0x00000000 0x0000000f 0x80010000 0x00000000 0x00010000>;
 
                        /* Inbound 2GB range starting at 0 */
index 8f345de960cd7407a811ca0a4891348a0b4bc782..8cf2c0c88c0584d5ced42fe26cde120bcdba7580 100644 (file)
                        compatible = "ibm,opb-440spe", "ibm,opb-440gp", "ibm,opb";
                        #address-cells = <1>;
                        #size-cells = <1>;
-                       ranges = <0x00000000 0x00000004 0xe0000000 0x20000000>;
+                       ranges = <0xe0000000 0x00000004 0xe0000000 0x20000000>;
                        clock-frequency = <0>; /* Filled in by zImage */
 
                        EBC0: ebc {
                                #address-cells = <2>;
                                #size-cells = <1>;
                                clock-frequency = <0>; /* Filled in by zImage */
+                               /* ranges property is supplied by U-Boot */
                                interrupts = <0x5 0x1>;
                                interrupt-parent = <&UIC1>;
+
+                               nor_flash@0,0 {
+                                       compatible = "cfi-flash";
+                                       bank-width = <2>;
+                                       reg = <0x00000000 0x00000000 0x01000000>;
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+                                       partition@0 {
+                                               label = "kernel";
+                                               reg = <0x00000000 0x001e0000>;
+                                       };
+                                       partition@1e0000 {
+                                               label = "dtb";
+                                               reg = <0x001e0000 0x00020000>;
+                                       };
+                                       partition@200000 {
+                                               label = "root";
+                                               reg = <0x00200000 0x00200000>;
+                                       };
+                                       partition@400000 {
+                                               label = "user";
+                                               reg = <0x00400000 0x00b60000>;
+                                       };
+                                       partition@f60000 {
+                                               label = "env";
+                                               reg = <0x00f60000 0x00040000>;
+                                       };
+                                       partition@fa0000 {
+                                               label = "u-boot";
+                                               reg = <0x00fa0000 0x00060000>;
+                                       };
+                               };
                        };
 
-                       UART0: serial@10000200 {
+                       UART0: serial@f0000200 {
                                device_type = "serial";
                                compatible = "ns16550";
-                               reg = <0x10000200 0x00000008>;
+                               reg = <0xf0000200 0x00000008>;
                                virtual-reg = <0xa0000200>;
                                clock-frequency = <0>; /* Filled in by zImage */
                                current-speed = <115200>;
                                interrupts = <0x0 0x4>;
                        };
 
-                       UART1: serial@10000300 {
+                       UART1: serial@f0000300 {
                                device_type = "serial";
                                compatible = "ns16550";
-                               reg = <0x10000300 0x00000008>;
+                               reg = <0xf0000300 0x00000008>;
                                virtual-reg = <0xa0000300>;
                                clock-frequency = <0>;
                                current-speed = <0>;
                        };
 
 
-                       UART2: serial@10000600 {
+                       UART2: serial@f0000600 {
                                device_type = "serial";
                                compatible = "ns16550";
-                               reg = <0x10000600 0x00000008>;
+                               reg = <0xf0000600 0x00000008>;
                                virtual-reg = <0xa0000600>;
                                clock-frequency = <0>;
                                current-speed = <0>;
                                interrupts = <0x5 0x4>;
                        };
 
-                       IIC0: i2c@10000400 {
+                       IIC0: i2c@f0000400 {
                                compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
-                               reg = <0x10000400 0x00000014>;
+                               reg = <0xf0000400 0x00000014>;
                                interrupt-parent = <&UIC0>;
                                interrupts = <0x2 0x4>;
                        };
 
-                       IIC1: i2c@10000500 {
+                       IIC1: i2c@f0000500 {
                                compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
-                               reg = <0x10000500 0x00000014>;
+                               reg = <0xf0000500 0x00000014>;
                                interrupt-parent = <&UIC0>;
                                interrupts = <0x3 0x4>;
                        };
 
-                       EMAC0: ethernet@10000800 {
+                       EMAC0: ethernet@f0000800 {
                                linux,network-index = <0x0>;
                                device_type = "network";
                                compatible = "ibm,emac-440spe", "ibm,emac4";
                                interrupt-parent = <&UIC1>;
                                interrupts = <0x1c 0x4 0x1d 0x4>;
-                               reg = <0x10000800 0x00000074>;
+                               reg = <0xf0000800 0x00000074>;
                                local-mac-address = [000000000000];
                                mal-device = <&MAL0>;
                                mal-tx-channel = <0>;
                        primary;
                        large-inbound-windows;
                        enable-msi-hole;
-                       reg = <0x0000000c 0x0ec00000   0x00000008       /* Config space access */
-                              0x00000000 0x00000000 0x00000000         /* no IACK cycles */
-                              0x0000000c 0x0ed00000   0x00000004   /* Special cycles */
-                              0x0000000c 0x0ec80000 0x00000100 /* Internal registers */
-                              0x0000000c 0x0ec80100  0x000000fc>;      /* Internal messaging registers */
+                       reg = <0x0000000c 0x0ec00000 0x00000008   /* Config space access */
+                              0x00000000 0x00000000 0x00000000   /* no IACK cycles */
+                              0x0000000c 0x0ed00000 0x00000004   /* Special cycles */
+                              0x0000000c 0x0ec80000 0x00000100   /* Internal registers */
+                              0x0000000c 0x0ec80100 0x000000fc>; /* Internal messaging registers */
 
                        /* Outbound ranges, one memory and one IO,
                         * later cannot be changed
        };
 
        chosen {
-               linux,stdout-path = "/plb/opb/serial@10000200";
+               linux,stdout-path = "/plb/opb/serial@f0000200";
        };
 };
index c353dac33416a705ef4872b00a9448a1a2792cd2..c9ef6bbe26cf7a43a9d240a790f466dc77ed77fb 100644 (file)
                interrupt-parent = < &ipic >;
                #address-cells = <1>;
                #size-cells = <1>;
-               bank-width = <1>;
                // ADS has two Hynix 512MB Nand flash chips in a single
-               // stacked package .
+               // stacked package.
                chips = <2>;
-               nand0@0 {
-                       label = "nand0";
-                       reg = <0x00000000 0x02000000>;  // first 32 MB of chip 0
-               };
-               nand1@20000000 {
-                       label = "nand1";
-                       reg = <0x20000000 0x02000000>;  // first 32 MB of chip 1
+               nand@0 {
+                       label = "nand";
+                       reg = <0x00000000 0x40000000>;  // 512MB + 512MB
                };
        };
 
                        interrupt-parent = < &ipic >;
                };
 
+               reset@e00 {     // Reset module
+                       compatible = "fsl,mpc5121-reset";
+                       reg = <0xe00 0x100>;
+               };
+
                clock@f00 {     // Clock control
                        compatible = "fsl,mpc5121-clock";
                        reg = <0xf00 0x100>;
                        interrupt-parent = < &ipic >;
                };
 
-               mscan@1300 {
+               can@1300 {
                        compatible = "fsl,mpc5121-mscan";
-                       cell-index = <0>;
                        interrupts = <12 0x8>;
                        interrupt-parent = < &ipic >;
                        reg = <0x1300 0x80>;
                };
 
-               mscan@1380 {
+               can@1380 {
                        compatible = "fsl,mpc5121-mscan";
-                       cell-index = <1>;
                        interrupts = <13 0x8>;
                        interrupt-parent = < &ipic >;
                        reg = <0x1380 0x80>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-                       cell-index = <0>;
                        reg = <0x1700 0x20>;
                        interrupts = <9 0x8>;
                        interrupt-parent = < &ipic >;
+                       fsl,preserve-clocking;
+
+                       hwmon@4a {
+                               compatible = "adi,ad7414";
+                               reg = <0x4a>;
+                       };
+
+                       eeprom@50 {
+                               compatible = "at,24c32";
+                               reg = <0x50>;
+                       };
+
+                       rtc@68 {
+                               compatible = "stm,m41t62";
+                               reg = <0x68>;
+                       };
                };
 
                i2c@1720 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-                       cell-index = <1>;
                        reg = <0x1720 0x20>;
                        interrupts = <10 0x8>;
                        interrupt-parent = < &ipic >;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-                       cell-index = <2>;
                        reg = <0x1740 0x20>;
                        interrupts = <11 0x8>;
                        interrupt-parent = < &ipic >;
                };
 
                display@2100 {
-                       compatible = "fsl,mpc5121-diu", "fsl-diu";
+                       compatible = "fsl,mpc5121-diu";
                        reg = <0x2100 0x100>;
                        interrupts = <64 0x8>;
                        interrupt-parent = < &ipic >;
 
                // USB1 using external ULPI PHY
                //usb@3000 {
-               //      compatible = "fsl,mpc5121-usb2-dr", "fsl-usb2-dr";
+               //      compatible = "fsl,mpc5121-usb2-dr";
                //      reg = <0x3000 0x1000>;
                //      #address-cells = <1>;
                //      #size-cells = <0>;
                //      interrupts = <43 0x8>;
                //      dr_mode = "otg";
                //      phy_type = "ulpi";
-               //      port1;
                //};
 
                // USB0 using internal UTMI PHY
                usb@4000 {
-                       compatible = "fsl,mpc5121-usb2-dr", "fsl-usb2-dr";
+                       compatible = "fsl,mpc5121-usb2-dr";
                        reg = <0x4000 0x1000>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        interrupts = <44 0x8>;
                        dr_mode = "otg";
                        phy_type = "utmi_wide";
-                       port0;
+                       fsl,invert-drvvbus;
+                       fsl,invert-pwr-fault;
                };
 
                // IO control
                };
 
                dma@14000 {
-                       compatible = "fsl,mpc5121-dma2";
+                       compatible = "fsl,mpc5121-dma";
                        reg = <0x14000 0x1800>;
                        interrupts = <65 0x8>;
                        interrupt-parent = < &ipic >;
index 6d892ba74e55f4125b55b2591dee798fd32ab552..92fb17876e7dbdfb483d1fd579b6800b3a982d46 100644 (file)
                reg = <0x0 0x10000000>;
        };
 
-       bcsr@f8000000 {
-               compatible = "fsl,mpc8568mds-bcsr";
-               reg = <0xf8000000 0x8000>;
+       localbus@e0005000 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               compatible = "fsl,mpc8568-localbus", "fsl,pq3-localbus",
+                            "simple-bus";
+               reg = <0xe0005000 0x1000>;
+
+               ranges = <0x0 0x0 0xfe000000 0x02000000
+                         0x1 0x0 0xf8000000 0x00008000
+                         0x2 0x0 0xf0000000 0x04000000
+                         0x4 0x0 0xf8008000 0x00008000
+                         0x5 0x0 0xf8010000 0x00008000>;
+
+               nor@0,0 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "cfi-flash";
+                       reg = <0x0 0x0 0x02000000>;
+                       bank-width = <2>;
+                       device-width = <2>;
+               };
+
+               bcsr@1,0 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "fsl,mpc8568mds-bcsr";
+                       reg = <1 0 0x8000>;
+                       ranges = <0 1 0 0x8000>;
+
+                       bcsr5: gpio-controller@11 {
+                               #gpio-cells = <2>;
+                               compatible = "fsl,mpc8568mds-bcsr-gpio";
+                               reg = <0x5 0x1>;
+                               gpio-controller;
+                       };
+               };
+
+               pib@4,0 {
+                       compatible = "fsl,mpc8568mds-pib";
+                       reg = <4 0 0x8000>;
+               };
+
+               pib@5,0 {
+                       compatible = "fsl,mpc8568mds-pib";
+                       reg = <5 0 0x8000>;
+               };
        };
 
        soc8568@e0000000 {
                sleep = <&pmc 0x00080000   /* controller */
                         &pmc 0x00040000>; /* message unit */
        };
+
+       leds {
+               compatible = "gpio-leds";
+
+               green {
+                       gpios = <&bcsr5 1 0>;
+               };
+
+               amber {
+                       gpios = <&bcsr5 2 0>;
+               };
+
+               red {
+                       gpios = <&bcsr5 3 0>;
+               };
+       };
 };
index 390512ae7f86e087cf53ba765b038f17daa5e291..f4594ed09a20895e788b6650a0b9964706b8622e 100755 (executable)
@@ -43,6 +43,9 @@ gzip=.gz
 # cross-compilation prefix
 CROSS=
 
+# mkimage wrapper script
+MKIMAGE=$srctree/scripts/mkuboot.sh
+
 # directory for object and other files used by this script
 object=arch/powerpc/boot
 objbin=$object
@@ -267,7 +270,7 @@ membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'`
 case "$platform" in
 uboot)
     rm -f "$ofile"
-    mkimage -A ppc -O linux -T kernel -C gzip -a $membase -e $membase \
+    ${MKIMAGE} -A ppc -O linux -T kernel -C gzip -a $membase -e $membase \
        $uboot_version -d "$vmz" "$ofile"
     if [ -z "$cacheit" ]; then
        rm -f "$vmz"
@@ -327,7 +330,7 @@ coff)
     ;;
 cuboot*)
     gzip -f -9 "$ofile"
-    mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
+    ${MKIMAGE} -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
             $uboot_version -d "$ofile".gz "$ofile"
     ;;
 treeboot*)
index 173a5bb77ca1ab86ce7a6cd3cabd57ec46acbf11..8e95f8d227b94764fe73f397c25ce4ca5b8d0ecd 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:17:46 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:33:07 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -27,15 +28,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -49,11 +53,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -67,9 +75,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -84,31 +104,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -120,6 +149,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -131,8 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -140,19 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -166,6 +224,7 @@ CONFIG_CLASSIC_RCU=y
 CONFIG_ACADIA=y
 # CONFIG_EP405 is not set
 # CONFIG_HCU4 is not set
+# CONFIG_HOTFOOT is not set
 # CONFIG_KILAUEA is not set
 # CONFIG_MAKALU is not set
 # CONFIG_WALNUT is not set
@@ -208,10 +267,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -227,10 +288,12 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -255,6 +318,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -272,14 +336,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -316,6 +378,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -329,6 +392,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -341,8 +406,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -355,6 +425,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -367,9 +438,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -445,7 +516,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -461,6 +531,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -491,7 +562,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -512,6 +587,8 @@ CONFIG_MII=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -530,17 +607,18 @@ CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT=y
 CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -553,6 +631,7 @@ CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -598,6 +677,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -614,6 +694,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -636,27 +721,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -678,7 +749,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -689,14 +765,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -705,6 +784,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -760,7 +844,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -776,6 +859,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -790,11 +874,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -804,6 +890,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -812,16 +899,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -833,35 +927,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -877,13 +981,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -892,10 +999,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -923,11 +1032,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -964,6 +1075,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -972,5 +1084,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index e9b8495cde0cd4a5ad6861a5770712a569557394..918f23fd2b1896b93093172b0527d038225e67a9 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:17:48 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:37:34 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -27,15 +28,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -49,11 +53,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -67,9 +75,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -84,31 +104,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -120,6 +149,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -131,8 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -140,19 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -166,6 +224,7 @@ CONFIG_CLASSIC_RCU=y
 # CONFIG_ACADIA is not set
 CONFIG_EP405=y
 # CONFIG_HCU4 is not set
+# CONFIG_HOTFOOT is not set
 # CONFIG_KILAUEA is not set
 # CONFIG_MAKALU is not set
 # CONFIG_WALNUT is not set
@@ -210,10 +269,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -229,10 +290,12 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -257,6 +320,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -274,14 +338,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -318,6 +380,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -331,6 +394,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -343,8 +408,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -357,6 +427,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -369,9 +440,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -447,7 +518,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -463,6 +533,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -476,12 +547,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -501,7 +577,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -522,6 +602,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -540,7 +622,10 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -548,6 +633,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -558,9 +644,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -570,6 +660,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -579,14 +670,14 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -608,6 +699,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -653,6 +745,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -669,6 +762,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -691,27 +789,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -748,14 +832,16 @@ CONFIG_USB_MON=y
 # USB Host Controller Drivers
 #
 # CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
+CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PCI=y
 CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
 CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
@@ -775,11 +861,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 
 #
-# see USB_STORAGE Help for more information
+# also be needed; see USB_STORAGE Help for more info
 #
 # CONFIG_USB_LIBUSUAL is not set
 
@@ -807,7 +893,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGET is not set
 # CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_FTDI_ELAN is not set
 # CONFIG_USB_APPLEDISPLAY is not set
@@ -822,6 +907,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 #
 # OTG and related infrastructure
 #
+# CONFIG_NOP_USB_XCEIV is not set
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -831,7 +917,12 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -842,14 +933,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -858,6 +952,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -913,7 +1012,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -927,8 +1025,48 @@ CONFIG_SUNRPC=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-# CONFIG_NLS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+# CONFIG_NLS_CODEPAGE_437 is not set
+# 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 is not set
+# 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 is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -943,11 +1081,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -957,6 +1097,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -965,16 +1106,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -986,35 +1134,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1030,13 +1188,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -1045,10 +1206,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -1076,11 +1239,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1117,6 +1282,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1125,5 +1291,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 8c019d79bf2a007ba0028352e058bf61e02d67a3..f87ef0382280f0695ed21a0ef58f284db4d3e20f 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:17:50 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:45:11 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -27,15 +28,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -49,11 +53,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -67,9 +75,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -84,31 +104,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -120,6 +149,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -131,8 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -140,19 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -166,6 +224,7 @@ CONFIG_CLASSIC_RCU=y
 # CONFIG_ACADIA is not set
 # CONFIG_EP405 is not set
 CONFIG_HCU4=y
+# CONFIG_HOTFOOT is not set
 # CONFIG_KILAUEA is not set
 # CONFIG_MAKALU is not set
 # CONFIG_WALNUT is not set
@@ -208,10 +267,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -227,10 +288,12 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -255,6 +318,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -272,14 +336,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -316,6 +378,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -329,6 +392,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -341,8 +406,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -355,6 +425,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -367,9 +438,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -445,7 +516,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -461,6 +531,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -473,12 +544,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -498,7 +574,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -519,6 +599,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -537,7 +619,10 @@ CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -545,6 +630,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -555,9 +641,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -567,6 +657,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -576,14 +667,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -596,6 +686,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -641,6 +732,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -657,13 +749,17 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -680,27 +776,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -722,7 +804,12 @@ CONFIG_VIDEO_OUTPUT_CONTROL=m
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -733,14 +820,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -749,6 +839,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -804,7 +899,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -820,6 +914,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -834,11 +929,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -848,6 +945,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -856,16 +954,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -877,35 +982,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -921,13 +1036,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -936,10 +1054,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -967,11 +1087,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1008,6 +1130,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1016,5 +1139,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 9a05ec0ec312180fedfab9095980b1898b72f9dd..19fbcb0753760b1932bdaee567e79da3cac71277 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31-rc4
-# Wed Jul 29 13:28:37 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:51:23 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -29,7 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -52,6 +55,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
@@ -79,11 +83,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -121,22 +127,21 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -144,6 +149,8 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
 
 #
 # GCOV-based kernel profiling
@@ -169,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -190,6 +224,7 @@ CONFIG_PPC4xx_PCI_EXPRESS=y
 # CONFIG_ACADIA is not set
 # CONFIG_EP405 is not set
 # CONFIG_HCU4 is not set
+# CONFIG_HOTFOOT is not set
 CONFIG_KILAUEA=y
 # CONFIG_MAKALU is not set
 # CONFIG_WALNUT is not set
@@ -233,10 +268,11 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
 # CONFIG_SWIOTLB is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -252,8 +288,7 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
@@ -343,6 +378,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -370,7 +406,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -383,6 +425,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -395,9 +438,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -498,6 +541,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -574,16 +618,17 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -596,6 +641,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -641,6 +687,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -656,6 +703,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -695,11 +743,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -709,10 +752,6 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -730,6 +769,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 # CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
@@ -753,6 +797,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -779,6 +824,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_VT8231 is not set
@@ -790,7 +836,6 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
 CONFIG_THERMAL=y
 # CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
@@ -810,10 +855,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -821,6 +869,7 @@ CONFIG_SSB_POSSIBLE=y
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -868,6 +917,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -889,7 +939,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -913,6 +965,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
@@ -920,6 +973,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
 CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
@@ -979,7 +1033,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -1037,6 +1090,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1054,6 +1108,7 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1072,10 +1127,12 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -1099,10 +1156,10 @@ CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
-# CONFIG_KMEMCHECK is not set
 # CONFIG_PPC_DISABLE_WERROR is not set
 CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
@@ -1124,13 +1181,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -1172,11 +1232,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index 1467475478730bf73837577c05ff90be2426ec00..eb41cd695979550e3ec9152f4fa49ab0f7e45c83 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.30-rc7
-# Wed Jun  3 09:11:02 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:55:12 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -29,14 +30,16 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -52,11 +55,13 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -78,11 +83,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -108,7 +115,6 @@ CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
@@ -121,6 +127,13 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
@@ -129,7 +142,6 @@ CONFIG_COMPAT_BRK=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -137,6 +149,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
 # CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
@@ -149,7 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -157,14 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -178,6 +224,7 @@ CONFIG_PPC4xx_PCI_EXPRESS=y
 # CONFIG_ACADIA is not set
 # CONFIG_EP405 is not set
 # CONFIG_HCU4 is not set
+# CONFIG_HOTFOOT is not set
 # CONFIG_KILAUEA is not set
 CONFIG_MAKALU=y
 # CONFIG_WALNUT is not set
@@ -220,10 +267,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -239,9 +288,8 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
@@ -330,6 +378,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -344,6 +393,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -356,7 +406,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -369,6 +425,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -381,9 +438,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -474,6 +531,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -504,14 +562,17 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 # CONFIG_MACINTOSH_DRIVERS is not set
 CONFIG_NETDEVICES=y
-CONFIG_COMPAT_NET_DEV_OPS=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -546,16 +607,18 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -568,6 +631,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -613,6 +677,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -629,6 +694,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -651,27 +721,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -695,6 +751,10 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -705,14 +765,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -770,7 +833,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -818,6 +880,7 @@ CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
 CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -827,6 +890,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -844,10 +908,14 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -859,11 +927,12 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -873,24 +942,26 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_TRACING_SUPPORT=y
-
-#
-# Tracers
-#
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
-# CONFIG_EVENT_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_KMEMTRACE is not set
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
@@ -910,13 +981,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -958,11 +1032,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index 5ab29dddd21ccea6090b341fb8475e4d506b65f9..bfff0eae39d29bf01c4af98f65a0aa40f14f3793 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:17:57 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:56:30 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -27,15 +28,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -49,11 +53,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -67,9 +75,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -84,31 +104,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -120,6 +149,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -131,8 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -140,19 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -166,6 +224,7 @@ CONFIG_CLASSIC_RCU=y
 # CONFIG_ACADIA is not set
 # CONFIG_EP405 is not set
 # CONFIG_HCU4 is not set
+# CONFIG_HOTFOOT is not set
 # CONFIG_KILAUEA is not set
 # CONFIG_MAKALU is not set
 CONFIG_WALNUT=y
@@ -211,10 +270,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -230,10 +291,12 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -258,6 +321,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -275,14 +339,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -319,6 +381,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -332,6 +395,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -344,8 +409,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -358,6 +428,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -370,9 +441,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -448,7 +519,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -464,6 +534,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -476,12 +547,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -501,7 +577,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -522,6 +602,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -540,7 +622,10 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -548,6 +633,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -558,9 +644,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -570,6 +660,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -579,14 +670,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -599,6 +689,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -644,6 +735,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -660,6 +752,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -682,27 +779,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -727,7 +810,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -743,7 +826,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -754,14 +842,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -770,6 +861,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -825,7 +921,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -841,6 +936,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -855,11 +951,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -869,6 +967,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -877,16 +976,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -898,35 +1004,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -942,13 +1058,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -957,10 +1076,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -988,11 +1109,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1029,6 +1152,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1037,5 +1161,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 6f976b51cdd05e0632d7005336bbbea39ffddcc5..1f6d0490e28d10582be09dc89065ac608e8d66b7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31-rc5
-# Thu Aug 13 14:14:07 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:02:35 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -33,7 +34,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -56,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
@@ -83,11 +87,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_GROUP_SCHED is not set
@@ -121,22 +127,21 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -144,6 +149,8 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
 
 #
 # GCOV-based kernel profiling
@@ -169,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -198,6 +232,7 @@ CONFIG_ARCHES=y
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
 # CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -241,10 +276,11 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
 # CONFIG_SWIOTLB is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -260,8 +296,7 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
@@ -352,6 +387,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -379,7 +415,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -392,6 +434,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -404,9 +447,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -497,6 +540,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -573,16 +617,17 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -595,6 +640,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -640,6 +686,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -656,6 +703,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -695,11 +743,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -709,10 +752,6 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -730,6 +769,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
@@ -753,6 +797,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -779,6 +824,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_VT8231 is not set
@@ -790,9 +836,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -810,10 +854,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -821,6 +868,7 @@ CONFIG_SSB_POSSIBLE=y
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -858,6 +906,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
@@ -865,6 +914,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
 CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
@@ -934,7 +984,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -993,6 +1042,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1010,6 +1060,7 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1028,10 +1079,12 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -1055,10 +1108,10 @@ CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
-# CONFIG_KMEMCHECK is not set
 # CONFIG_PPC_DISABLE_WERROR is not set
 CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
@@ -1080,7 +1133,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index e57f1e4c1795196a3f6fddb2abedc41fc143628a..788faac6c27a0d4c213f9308ef29fdd8d2fc8348 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:33 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:09:03 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -53,11 +57,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -71,9 +79,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -88,8 +108,12 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -99,19 +123,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -123,6 +153,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -134,8 +172,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -143,19 +180,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -176,6 +235,8 @@ CONFIG_BAMBOO=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -218,10 +279,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -237,10 +300,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -265,6 +331,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -282,14 +349,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -326,6 +391,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -339,6 +405,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -351,8 +419,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -365,6 +438,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -386,6 +460,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -398,12 +473,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -423,7 +503,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -444,6 +528,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -462,7 +548,10 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -470,6 +559,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -480,9 +570,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -492,6 +586,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -501,14 +596,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -521,6 +615,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -566,6 +661,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -582,6 +678,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -604,27 +705,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -649,7 +736,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -665,7 +752,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -676,14 +768,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -692,6 +787,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -746,7 +846,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -762,6 +861,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -776,11 +876,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -790,6 +892,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -798,16 +901,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -819,35 +929,45 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -863,13 +983,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -878,10 +1001,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -909,11 +1034,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -950,6 +1077,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -958,5 +1086,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index b312b166be66eb19f5d295f08cc23d82a39c48b2..4ef8bcab61f838dc8298dd5eea4790ddff1aa15b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31-rc4
-# Wed Jul 29 17:27:20 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:12:20 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -33,7 +34,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -56,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
@@ -83,11 +87,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_GROUP_SCHED is not set
@@ -121,22 +127,21 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -144,6 +149,8 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
 
 #
 # GCOV-based kernel profiling
@@ -169,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -198,6 +232,7 @@ CONFIG_PPC4xx_PCI_EXPRESS=y
 CONFIG_CANYONLANDS=y
 # CONFIG_GLACIER is not set
 # CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -241,10 +276,11 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
 # CONFIG_SWIOTLB is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -260,8 +296,7 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
@@ -352,6 +387,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -379,7 +415,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -392,6 +434,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -404,9 +447,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -508,6 +551,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -585,16 +629,18 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -616,6 +662,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -661,6 +708,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -676,6 +724,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -716,11 +765,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -730,10 +774,6 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -751,6 +791,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
@@ -774,6 +819,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -800,6 +846,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_VT8231 is not set
@@ -811,9 +858,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -831,10 +876,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -842,6 +890,7 @@ CONFIG_SSB_POSSIBLE=y
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -882,10 +931,12 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=m
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
@@ -993,6 +1044,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8583 is not set
 CONFIG_RTC_DRV_M41T80=y
 # CONFIG_RTC_DRV_M41T80_WDT is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1014,7 +1066,9 @@ CONFIG_RTC_DRV_M41T80=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1038,6 +1092,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
@@ -1045,6 +1100,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
 CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
@@ -1104,7 +1160,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -1201,6 +1256,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1218,6 +1274,7 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1236,10 +1293,12 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -1263,10 +1322,10 @@ CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
-# CONFIG_KMEMCHECK is not set
 # CONFIG_PPC_DISABLE_WERROR is not set
 CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
@@ -1288,7 +1347,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index b652f7dcab5a322bf59ede66ec39374a124074d3..ca17b1496e32c82adc26d1438bc283804dabc8b2 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:36 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:20:46 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -19,6 +19,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -30,15 +31,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -52,11 +56,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -70,9 +78,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -87,31 +107,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -123,6 +152,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -134,8 +171,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -143,19 +179,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -176,6 +234,8 @@ CONFIG_EBONY=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 # CONFIG_PPC44x_SIMPLE is not set
@@ -218,10 +278,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_MATH_EMULATION=y
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -237,10 +299,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -264,6 +329,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -281,14 +347,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -325,6 +389,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -338,6 +403,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -350,8 +417,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -364,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -376,9 +449,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
 CONFIG_MTD_OF_PARTS=y
@@ -453,7 +526,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -469,6 +541,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -481,12 +554,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -506,7 +584,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -527,6 +609,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -545,7 +629,10 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -553,6 +640,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -563,9 +651,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -575,6 +667,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -584,14 +677,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -604,6 +696,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -649,6 +742,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -665,6 +759,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -687,27 +786,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -732,7 +817,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -748,7 +833,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -759,14 +849,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -775,6 +868,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -840,7 +938,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -856,6 +953,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -871,11 +969,13 @@ CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -885,6 +985,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -893,16 +994,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -914,35 +1022,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -958,13 +1076,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -973,10 +1094,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -1004,11 +1127,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1045,6 +1170,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
index 007f3bd939e7a46a025196e6b8b4a20df20811da..e3149bade0b25c6d101eb081ef58e568752baf03 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31-rc6
-# Wed Aug 19 13:06:50 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:33:04 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -34,7 +34,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -57,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
@@ -84,11 +87,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_GROUP_SCHED is not set
@@ -122,22 +127,21 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -145,6 +149,8 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
 
 #
 # GCOV-based kernel profiling
@@ -170,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -243,10 +276,11 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
 # CONFIG_SWIOTLB is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -262,8 +296,7 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
@@ -358,6 +391,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -387,14 +421,11 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
 # CFG80211 needs to be enabled for MAC80211
 #
-CONFIG_MAC80211_DEFAULT_PS_VALUE=0
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -407,6 +438,7 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -419,9 +451,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -522,6 +554,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -573,8 +606,11 @@ CONFIG_SCSI_SAS_ATTRS=y
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -611,7 +647,10 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
@@ -682,7 +721,9 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -711,12 +752,11 @@ CONFIG_E1000E=y
 # CONFIG_JME is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -730,6 +770,7 @@ CONFIG_E1000E=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -775,6 +816,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -791,6 +833,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -830,11 +873,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -844,10 +882,6 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 CONFIG_I2C_DEBUG_CORE=y
 CONFIG_I2C_DEBUG_ALGO=y
@@ -865,7 +899,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -883,10 +916,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -894,6 +930,7 @@ CONFIG_SSB_POSSIBLE=y
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -935,6 +972,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
@@ -942,6 +980,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
 CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
@@ -1001,7 +1040,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -1059,6 +1097,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1095,10 +1134,12 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -1122,10 +1163,10 @@ CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
-# CONFIG_KMEMCHECK is not set
 # CONFIG_PPC_DISABLE_WERROR is not set
 CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
@@ -1147,13 +1188,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD=y
@@ -1197,11 +1241,13 @@ CONFIG_CRYPTO_XTS=y
 #
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_XCBC=y
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+CONFIG_CRYPTO_GHASH=y
 CONFIG_CRYPTO_MD4=y
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index c23a4ef13e45a5c8ccb899c2dc99f157dc894bf3..af244e1d255e2908dd107b5f97f5aacc44559b18 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:38 2009
+# Linux kernel version: 2.6.33-rc5
+# Tue Jan 26 14:40:58 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -19,6 +19,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -30,15 +31,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -52,11 +56,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -70,9 +78,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_GROUP_SCHED is not set
@@ -83,8 +103,13 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_LZO is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -94,19 +119,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -118,6 +149,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -129,8 +167,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -138,19 +175,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -171,6 +230,8 @@ CONFIG_KATMAI=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -212,10 +273,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -231,10 +294,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -259,6 +325,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -276,14 +343,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -320,6 +385,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -333,6 +399,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -345,8 +413,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -359,6 +432,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -369,7 +443,90 @@ CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
-# CONFIG_MTD is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS 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_OF_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS 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_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# 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 is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_PHYSMAP_OF=y
+# CONFIG_MTD_INTEL_VR_NOR is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM 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
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
 CONFIG_OF_DEVICE=y
 # CONFIG_PARPORT is not set
 CONFIG_BLK_DEV=y
@@ -380,6 +537,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -392,12 +550,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -417,7 +580,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -440,6 +607,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -458,7 +627,10 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -466,6 +638,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -476,9 +649,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -488,6 +665,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -497,14 +675,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -517,6 +694,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -562,6 +740,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -578,13 +757,17 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -601,27 +784,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -646,7 +815,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -662,7 +831,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -676,11 +850,13 @@ CONFIG_EXT2_FS=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -689,6 +865,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -722,6 +903,7 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
 CONFIG_CRAMFS=y
 # CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
@@ -743,7 +925,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -759,6 +940,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -773,11 +955,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -787,6 +971,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
@@ -795,16 +980,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -816,35 +1008,43 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -859,13 +1059,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -874,10 +1077,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -905,11 +1110,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -946,6 +1153,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -954,5 +1162,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index b25fad1343dc17cc304abab9c59bd3ffd8d75269..8fed3b26af2e39c450b68012121bebbfce6b81c6 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:41 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 14:59:12 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -19,6 +19,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -30,15 +31,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -52,11 +56,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -70,9 +78,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -87,8 +107,12 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -98,19 +122,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -122,6 +152,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -133,8 +171,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -142,19 +179,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -175,6 +234,8 @@ CONFIG_RAINIER=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -216,10 +277,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_MATH_EMULATION=y
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -235,10 +298,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -263,6 +329,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -280,14 +347,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -324,6 +389,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -337,6 +403,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -349,8 +417,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -363,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -375,9 +449,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -453,7 +527,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -469,6 +542,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -481,12 +555,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -506,7 +585,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -533,6 +616,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -543,9 +627,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -555,6 +643,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -564,14 +653,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -584,6 +672,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -629,6 +718,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -645,6 +735,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -667,27 +762,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -712,7 +793,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -728,7 +809,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -739,14 +825,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -755,6 +844,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -820,7 +914,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -836,6 +929,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -851,11 +945,13 @@ CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -865,6 +961,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -873,16 +970,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -894,35 +998,45 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -942,6 +1056,7 @@ CONFIG_PPC_EARLY_DEBUG=y
 CONFIG_PPC_EARLY_DEBUG_44x=y
 # CONFIG_PPC_EARLY_DEBUG_40x is not set
 # CONFIG_PPC_EARLY_DEBUG_CPM is not set
+# CONFIG_PPC_EARLY_DEBUG_USBGECKO is not set
 CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW=0xef600300
 CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x1
 
@@ -951,13 +1066,16 @@ CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x1
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -966,10 +1084,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -997,11 +1117,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1038,6 +1160,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1046,5 +1169,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index ed31d4f17b5a93102cbc2bbb14398a8cf927779d..a67ec91a28c3ebcdffff742122d1ee414979e912 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc3
-# Wed Feb  4 14:31:09 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:05:05 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -53,11 +57,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -71,6 +79,7 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
@@ -78,11 +87,13 @@ CONFIG_POSIX_MQUEUE=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_GROUP_SCHED is not set
@@ -93,8 +104,12 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -104,19 +119,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -128,6 +149,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -139,8 +168,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -148,14 +176,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -177,6 +232,7 @@ CONFIG_PPC4xx_PCI_EXPRESS=y
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
 CONFIG_REDWOOD=y
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -219,10 +275,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -238,10 +296,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -262,12 +323,15 @@ CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_SYSCALL=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCIEAER=y
+# CONFIG_PCIE_ECRC is not set
+# CONFIG_PCIEAER_INJECT is not set
 # CONFIG_PCIEASPM is not set
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -285,14 +349,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -329,6 +391,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -342,6 +405,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -354,13 +419,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
-# CONFIG_MAC80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -373,6 +438,7 @@ CONFIG_WIRELESS_OLD_REGULATORY=y
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -385,9 +451,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -462,7 +528,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -479,6 +544,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -512,10 +578,6 @@ CONFIG_BLK_DEV_SD=y
 # CONFIG_BLK_DEV_SR is not set
 CONFIG_CHR_DEV_SG=y
 # CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
 # CONFIG_SCSI_MULTI_LUN is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
@@ -533,23 +595,30 @@ CONFIG_SCSI_SAS_ATTRS=y
 # CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+# CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
 # CONFIG_SCSI_AIC94XX is not set
+# CONFIG_SCSI_MVSAS is not set
 # CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_ARCMSR is not set
 # CONFIG_MEGARAID_NEWGEN is not set
 # CONFIG_MEGARAID_LEGACY is not set
 # CONFIG_MEGARAID_SAS is not set
+# CONFIG_SCSI_MPT2SAS is not set
 # CONFIG_SCSI_HPTIOP is not set
 # CONFIG_SCSI_BUSLOGIC is not set
 # CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
 # CONFIG_FCOE is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
@@ -558,7 +627,6 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_MVSAS is not set
 # CONFIG_SCSI_STEX is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -569,8 +637,12 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_FUSION=y
@@ -586,7 +658,11 @@ CONFIG_FUSION_MAX_SGE=128
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -614,6 +690,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -632,7 +710,10 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -640,6 +721,7 @@ CONFIG_NETDEV_1000=y
 CONFIG_E1000E=y
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -650,19 +732,21 @@ CONFIG_E1000E=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -676,6 +760,7 @@ CONFIG_E1000E=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -721,6 +806,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -737,6 +823,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -776,11 +863,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -790,25 +872,23 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_MAX6875 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 CONFIG_I2C_DEBUG_CORE=y
 CONFIG_I2C_DEBUG_ALGO=y
 CONFIG_I2C_DEBUG_BUS=y
 CONFIG_I2C_DEBUG_CHIP=y
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -826,31 +906,21 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -876,7 +946,12 @@ CONFIG_DMADEVICES=y
 #
 # DMA Devices
 #
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -887,14 +962,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -903,6 +981,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -958,7 +1041,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -974,6 +1056,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -988,11 +1071,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -1002,6 +1087,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1010,16 +1096,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1031,35 +1124,45 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1075,13 +1178,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD=y
@@ -1092,10 +1198,12 @@ CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 CONFIG_CRYPTO_GF128MUL=y
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_CRYPTO_CRYPTD=y
 CONFIG_CRYPTO_AUTHENC=y
 # CONFIG_CRYPTO_TEST is not set
@@ -1123,11 +1231,13 @@ CONFIG_CRYPTO_XTS=y
 #
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_XCBC=y
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+CONFIG_CRYPTO_GHASH=y
 CONFIG_CRYPTO_MD4=y
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1164,6 +1274,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1172,5 +1283,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index e14e89a5e06b67afed0500ae5bf80e78ec8ef250..886cb6aa64326fa1441d70b3f5e1b9f5655c4e8b 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:42 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:11:24 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -53,11 +57,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -71,9 +79,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 CONFIG_IKCONFIG=y
 # CONFIG_IKCONFIG_PROC is not set
 CONFIG_LOG_BUF_SHIFT=14
@@ -89,8 +109,12 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -99,19 +123,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -123,6 +153,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -134,8 +171,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -143,19 +179,41 @@ CONFIG_BLOCK=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -176,6 +234,8 @@ CONFIG_SAM440EP=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 # CONFIG_PPC44x_SIMPLE is not set
@@ -218,10 +278,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -237,10 +299,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -264,6 +329,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -281,14 +347,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -325,6 +389,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -338,6 +403,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -350,8 +417,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -364,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -385,6 +458,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -420,10 +494,6 @@ CONFIG_BLK_DEV_SR=y
 # CONFIG_BLK_DEV_SR_VENDOR is not set
 CONFIG_CHR_DEV_SG=y
 # CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
 # CONFIG_SCSI_MULTI_LUN is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
@@ -440,8 +510,10 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SRP_ATTRS is not set
 # CONFIG_SCSI_LOWLEVEL is not set
 # CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_ATA_VERBOSE_ERROR=y
 # CONFIG_SATA_PMP is not set
 # CONFIG_SATA_AHCI is not set
 # CONFIG_SATA_SIL24 is not set
@@ -463,6 +535,7 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_ALI is not set
 # CONFIG_PATA_AMD is not set
 # CONFIG_PATA_ARTOP is not set
+# CONFIG_PATA_ATP867X is not set
 # CONFIG_PATA_ATIIXP is not set
 # CONFIG_PATA_CMD640_PCI is not set
 # CONFIG_PATA_CMD64X is not set
@@ -488,14 +561,16 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
+# CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -508,7 +583,11 @@ CONFIG_SATA_SIL=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -529,6 +608,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -547,17 +628,19 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -580,6 +663,7 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -589,6 +673,7 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -605,25 +690,30 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # Input Device Drivers
 #
 CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
 CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_QT2160 is not set
 # CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
 # CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
 CONFIG_MOUSE_PS2_ALPS=y
 CONFIG_MOUSE_PS2_LOGIPS2PP=y
 CONFIG_MOUSE_PS2_SYNAPTICS=y
-CONFIG_MOUSE_PS2_LIFEBOOK=y
 CONFIG_MOUSE_PS2_TRACKPOINT=y
 # CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
 # CONFIG_MOUSE_PS2_TOUCHKIT is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_APPLETOUCH is not set
 # CONFIG_MOUSE_BCM5974 is not set
 # CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -639,6 +729,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -676,6 +767,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -691,6 +783,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 # CONFIG_I2C_CHARDEV is not set
 CONFIG_I2C_HELPER_AUTO=y
 CONFIG_I2C_ALGOBIT=y
@@ -732,11 +825,6 @@ CONFIG_I2C_IBM_IIC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -746,27 +834,23 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_MAX6875 is not set
 # CONFIG_SENSORS_TSL2550 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
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -784,31 +868,21 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=y
@@ -870,6 +944,7 @@ CONFIG_FB_RADEON_BACKLIGHT=y
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_FB_METRONOME is not set
 # CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 CONFIG_LCD_CLASS_DEVICE=y
 # CONFIG_LCD_ILI9320 is not set
@@ -899,7 +974,6 @@ CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_SOUND is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
-# CONFIG_HID_DEBUG is not set
 # CONFIG_HIDRAW is not set
 
 #
@@ -912,15 +986,18 @@ CONFIG_USB_HID=y
 #
 # Special HID drivers
 #
-CONFIG_HID_COMPAT=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
 CONFIG_HID_CHERRY=y
 CONFIG_HID_CHICONY=y
 CONFIG_HID_CYPRESS=y
+# CONFIG_HID_DRAGONRISE is not set
 CONFIG_HID_EZKEY=y
+# CONFIG_HID_KYE is not set
 CONFIG_HID_GYRATION=y
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
 CONFIG_HID_LOGITECH=y
 # CONFIG_LOGITECH_FF is not set
 # CONFIG_LOGIRUMBLEPAD2_FF is not set
@@ -933,10 +1010,11 @@ CONFIG_HID_PETALYNX=y
 CONFIG_HID_SAMSUNG=y
 CONFIG_HID_SONY=y
 CONFIG_HID_SUNPLUS=y
-# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
 # CONFIG_HID_TOPSEED is not set
-CONFIG_THRUSTMASTER_FF=m
-CONFIG_ZEROPLUS_FF=m
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
@@ -962,17 +1040,20 @@ CONFIG_USB_DEVICEFS=y
 # USB Host Controller Drivers
 #
 # CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
 CONFIG_USB_EHCI_HCD=m
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
+CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PCI=y
 CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
 CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
@@ -992,11 +1073,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 
 #
-# see USB_STORAGE Help for more information
+# also be needed; see USB_STORAGE Help for more info
 #
 CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_DEBUG is not set
@@ -1038,7 +1119,6 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGET is not set
 # CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_FTDI_ELAN is not set
 # CONFIG_USB_APPLEDISPLAY is not set
@@ -1054,6 +1134,7 @@ CONFIG_USB_STORAGE=m
 #
 # OTG and related infrastructure
 #
+# CONFIG_NOP_USB_XCEIV is not set
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -1090,9 +1171,11 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8583 is not set
 CONFIG_RTC_DRV_M41T80=y
 CONFIG_RTC_DRV_M41T80_WDT=y
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
 
 #
 # SPI RTC drivers
@@ -1110,15 +1193,22 @@ CONFIG_RTC_DRV_M41T80_WDT=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
 # on-CPU RTC drivers
 #
-# CONFIG_RTC_DRV_PPC is not set
+# CONFIG_RTC_DRV_GENERIC is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -1130,6 +1220,7 @@ 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_DEFAULTS_TO_ORDERED is not set
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
 # CONFIG_EXT3_FS_SECURITY is not set
@@ -1142,10 +1233,13 @@ CONFIG_REISERFS_FS=y
 # CONFIG_REISERFS_FS_XATTR is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1154,6 +1248,11 @@ CONFIG_INOTIFY_USER=y
 CONFIG_AUTOFS4_FS=y
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -1267,6 +1366,7 @@ CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -1281,11 +1381,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -1295,27 +1397,29 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_IRQSTACKS is not set
 # CONFIG_PPC_EARLY_DEBUG is not set
@@ -1326,7 +1430,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 6400aae04dda9a6dbaa43a8259b3712b6e6acae0..1b2f41dbcafbb7e5020d3eab045ef7cebb494286 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29
-# Tue Apr  7 17:04:52 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:15:51 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -53,12 +57,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -72,6 +79,7 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
@@ -79,11 +87,13 @@ CONFIG_POSIX_MQUEUE=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -121,6 +131,13 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
@@ -129,7 +146,6 @@ CONFIG_COMPAT_BRK=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -137,6 +153,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
 # CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
@@ -149,7 +172,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -157,14 +180,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -186,6 +236,7 @@ CONFIG_SEQUOIA=y
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
 # CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -228,10 +279,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -247,9 +300,8 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
@@ -293,11 +345,11 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # Default settings for advanced configuration options are used
 #
 CONFIG_LOWMEM_SIZE=0x30000000
-CONFIG_LOWMEM_CAM_NUM=3
 CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
+CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
@@ -339,6 +391,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -353,6 +406,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -365,7 +419,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -378,6 +438,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -390,9 +451,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -493,6 +554,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -515,6 +577,7 @@ CONFIG_MISC_DEVICES=y
 # EEPROM support
 #
 # CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -534,14 +597,17 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 # CONFIG_MACINTOSH_DRIVERS is not set
 CONFIG_NETDEVICES=y
-CONFIG_COMPAT_NET_DEV_OPS=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -576,7 +642,10 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -584,6 +653,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -594,6 +664,9 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
@@ -619,12 +692,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_SFC is not set
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -637,6 +709,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -682,6 +755,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -698,6 +772,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -720,27 +799,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -783,6 +848,10 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -793,14 +862,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -916,6 +988,7 @@ CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
 CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -925,6 +998,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -933,16 +1007,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -954,11 +1035,12 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -968,27 +1050,30 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_TRACING_SUPPORT=y
-
-#
-# Tracers
-#
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
-# CONFIG_EVENT_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_KMEMTRACE is not set
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1004,13 +1089,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -1052,11 +1140,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index ef32cc4f82eb0e9fcd0539d37a89af502e441683..12041d355b8ca1a9e47914d68211d416a405fb92 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Tue Jan 20 08:22:47 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:21:04 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -19,6 +19,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -30,15 +31,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
@@ -52,11 +56,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -70,9 +78,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -87,8 +107,12 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
@@ -98,19 +122,25 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -122,6 +152,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -133,8 +171,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -142,19 +179,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 # CONFIG_PPC4xx_PCI_EXPRESS is not set
 
@@ -175,6 +234,8 @@ CONFIG_TAISHAN=y
 # CONFIG_ARCHES is not set
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
+# CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 CONFIG_PPC44x_SIMPLE=y
@@ -216,10 +277,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -235,10 +298,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 CONFIG_CMDLINE_BOOL=y
@@ -263,6 +329,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -280,14 +347,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -324,6 +389,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -337,6 +403,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -349,8 +417,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -363,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -375,9 +449,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_OF_PARTS is not set
@@ -453,7 +527,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -469,6 +542,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -481,12 +555,17 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -506,7 +585,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -529,6 +612,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -547,7 +632,10 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -555,6 +643,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -565,9 +654,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -577,6 +670,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -586,14 +680,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -606,6 +699,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -651,6 +745,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -667,6 +762,11 @@ CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
@@ -689,27 +789,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-CONFIG_DAB=y
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -734,7 +820,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -750,7 +836,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -761,14 +852,17 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4_FS is not set
+CONFIG_EXT4_USE_FOR_EXT23=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -777,6 +871,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -832,7 +931,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -848,6 +946,7 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 # CONFIG_NLS is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -862,11 +961,13 @@ CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -876,6 +977,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -884,16 +986,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -905,35 +1014,45 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -949,13 +1068,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -964,10 +1086,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -995,11 +1119,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1036,6 +1162,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYPTO_LZO is not set
 
 #
@@ -1044,5 +1171,6 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 787635f23d8fd0ca3772416c4240055754c3680f..99eff4dd93640c680ac6dfbdee3182e6612f69b9 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.30
-# Tue Jun  9 23:35:36 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 15:27:46 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_GPIO=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
@@ -56,11 +60,13 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -81,11 +87,13 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 # RCU Subsystem
 #
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
 # CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
@@ -111,7 +119,6 @@ CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
@@ -124,6 +131,13 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_SLUB_DEBUG=y
 CONFIG_COMPAT_BRK=y
@@ -131,7 +145,6 @@ CONFIG_COMPAT_BRK=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -139,6 +152,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
 # CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
@@ -151,7 +171,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-# CONFIG_LBD is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -159,14 +179,41 @@ CONFIG_BLOCK=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -187,6 +234,7 @@ CONFIG_WARP=y
 # CONFIG_CANYONLANDS is not set
 # CONFIG_GLACIER is not set
 # CONFIG_REDWOOD is not set
+# CONFIG_EIGER is not set
 # CONFIG_YOSEMITE is not set
 # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
 # CONFIG_PPC44x_SIMPLE is not set
@@ -229,10 +277,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -248,9 +298,8 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
@@ -356,6 +405,7 @@ CONFIG_NETFILTER_ADVANCED=y
 # CONFIG_IP_NF_ARPTABLES is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -371,6 +421,7 @@ CONFIG_VLAN_8021Q=y
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -383,7 +434,13 @@ CONFIG_VLAN_8021Q=y
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -396,6 +453,7 @@ CONFIG_VLAN_8021Q=y
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 # CONFIG_STANDALONE is not set
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -407,9 +465,9 @@ CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -513,6 +571,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
@@ -524,9 +586,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_XILINX_SYSACE is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -534,7 +598,9 @@ CONFIG_MISC_DEVICES=y
 #
 CONFIG_EEPROM_AT24=y
 # CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
 # CONFIG_EEPROM_93CX6 is not set
+# CONFIG_IWMC3200TOP is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -557,15 +623,11 @@ CONFIG_BLK_DEV_SD=y
 # CONFIG_BLK_DEV_SR is not set
 # CONFIG_CHR_DEV_SG is not set
 # CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
 # CONFIG_SCSI_MULTI_LUN is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 # CONFIG_SCSI_SCAN_ASYNC is not set
-# CONFIG_SCSI_WAIT_SCAN is not set
+CONFIG_SCSI_WAIT_SCAN=m
 
 #
 # SCSI Transports
@@ -582,7 +644,6 @@ CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_MD is not set
 # CONFIG_MACINTOSH_DRIVERS is not set
 CONFIG_NETDEVICES=y
-CONFIG_COMPAT_NET_DEV_OPS=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -609,14 +670,14 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
 # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_XILINX_EMACLITE is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -678,6 +739,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -693,6 +755,7 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 # CONFIG_I2C_CHARDEV is not set
 CONFIG_I2C_HELPER_AUTO=y
 
@@ -725,17 +788,17 @@ CONFIG_I2C_IBM_IIC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_MAX6875 is not set
 # CONFIG_SENSORS_TSL2550 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
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -761,10 +824,19 @@ CONFIG_GPIO_SYSFS=y
 #
 # SPI GPIO expanders:
 #
+
+#
+# AC97 GPIO expanders:
+#
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
@@ -787,6 +859,7 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -812,6 +885,8 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83791D is not set
@@ -821,7 +896,6 @@ CONFIG_SENSORS_AD7414=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
 CONFIG_THERMAL=y
 CONFIG_THERMAL_HWMON=y
 CONFIG_WATCHDOG=y
@@ -855,26 +929,15 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
@@ -917,10 +980,11 @@ CONFIG_USB_MON=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
+CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
 CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -988,6 +1052,7 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
@@ -1014,7 +1079,8 @@ CONFIG_MMC_BLOCK_BOUNCE=y
 #
 # CONFIG_MMC_SDHCI is not set
 # CONFIG_MMC_WBSD is not set
-CONFIG_MMC_PIKASD=y
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
 # CONFIG_MEMSTICK is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
@@ -1025,9 +1091,10 @@ CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
 # CONFIG_LEDS_GPIO_PLATFORM is not set
 CONFIG_LEDS_GPIO_OF=y
-# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP3944 is not set
 # CONFIG_LEDS_PCA955X is not set
 # CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
 
 #
 # LED Triggers
@@ -1048,6 +1115,10 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -1065,10 +1136,13 @@ CONFIG_JBD=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1145,7 +1219,6 @@ CONFIG_CRAMFS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_NILFS2_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
@@ -1235,6 +1308,7 @@ CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
 CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -1244,6 +1318,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1261,10 +1336,14 @@ CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1276,11 +1355,12 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
@@ -1290,27 +1370,30 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_TRACING_SUPPORT=y
-
-#
-# Tracers
-#
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
-# CONFIG_EVENT_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_KMEMTRACE is not set
 # CONFIG_WORKQUEUE_TRACER is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1326,13 +1409,16 @@ CONFIG_IRQSTACKS=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 # CONFIG_CRYPTO_MANAGER is not set
@@ -1366,11 +1452,13 @@ CONFIG_CRYPTO_ALGAPI2=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 # CONFIG_CRYPTO_MD5 is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index 0396ce7bffc688eb2845a2cacfcf50467149fb96..ff9bdb28197db264036e02f4717f41c99efbb4e3 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:22 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 14:45:07 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -166,14 +169,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -189,6 +219,7 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_PPC_MEDIA5200 is not set
 # CONFIG_PPC_MPC5200_BUGFIX is not set
 # CONFIG_PPC_MPC5200_GPIO is not set
+# CONFIG_PPC_MPC5200_LPBFIFO is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -243,6 +274,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -259,8 +291,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -273,6 +303,7 @@ CONFIG_PROC_DEVICETREE=y
 CONFIG_EXTRA_TARGETS=""
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -378,7 +409,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -489,6 +526,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
@@ -587,8 +628,8 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -643,6 +684,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=57600
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -688,7 +730,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -735,11 +776,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -797,7 +840,6 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
 # CONFIG_USB_HWA_HCD is not set
-# CONFIG_USB_MUSB_HDRC is not set
 
 #
 # USB Device Class drivers
@@ -1137,6 +1179,7 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1180,7 +1223,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index f5c07fd72239def09c0c7bd21c1e494ef0702eb0..7b3f4d0ed404d2f65d4325b979d0adcc64c827e9 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:24 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 14:45:09 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -86,6 +88,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 CONFIG_FREEZER=y
 
 #
@@ -196,6 +226,7 @@ CONFIG_PPC_LITE5200=y
 # CONFIG_PPC_MEDIA5200 is not set
 # CONFIG_PPC_MPC5200_BUGFIX is not set
 # CONFIG_PPC_MPC5200_GPIO is not set
+# CONFIG_PPC_MPC5200_LPBFIFO is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -252,6 +283,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -268,8 +300,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -285,6 +315,7 @@ CONFIG_PM=y
 CONFIG_PM_SLEEP=y
 CONFIG_SUSPEND=y
 CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -398,7 +429,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -433,6 +470,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -443,6 +484,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -450,6 +492,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -502,7 +545,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -541,6 +586,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -596,15 +642,16 @@ CONFIG_PATA_MPC52xx=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -726,8 +773,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -741,6 +790,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -778,6 +828,7 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -835,11 +886,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -849,7 +895,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -884,11 +929,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1129,6 +1176,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1172,7 +1220,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 4f77a1bdc8f9534d1306900e96b94351083bc890..eaae2d469aa0a84524208407e10df3e146848fcb 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:22 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 14:45:08 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -166,14 +169,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -189,6 +219,7 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_PPC_MEDIA5200 is not set
 # CONFIG_PPC_MPC5200_BUGFIX is not set
 # CONFIG_PPC_MPC5200_GPIO is not set
+# CONFIG_PPC_MPC5200_LPBFIFO is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -244,6 +275,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -260,8 +292,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -274,6 +304,7 @@ CONFIG_PROC_DEVICETREE=y
 CONFIG_EXTRA_TARGETS=""
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -379,7 +410,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -490,6 +527,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -499,9 +540,11 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -610,8 +653,7 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -657,6 +699,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -700,7 +743,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -745,6 +787,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -805,11 +848,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -881,6 +926,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -902,7 +948,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1172,6 +1220,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1215,7 +1264,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index f9168c1a2fa577732fcacae70f5aa17009e97306..1742c0200b7543c9faef9450215136419b493628 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:25 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 14:45:10 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -87,6 +89,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -172,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -195,6 +225,7 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_PPC_MEDIA5200 is not set
 # CONFIG_PPC_MPC5200_BUGFIX is not set
 # CONFIG_PPC_MPC5200_GPIO is not set
+# CONFIG_PPC_MPC5200_LPBFIFO is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -251,6 +282,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -267,8 +299,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -385,7 +415,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -585,15 +621,16 @@ CONFIG_PATA_MPC52xx=m
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -673,8 +710,11 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -697,6 +737,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -734,6 +775,7 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=9600
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -790,11 +832,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -804,7 +841,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -839,11 +875,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -908,7 +946,6 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_R8A66597_HCD is not set
 # CONFIG_USB_WHCI_HCD is not set
 # CONFIG_USB_HWA_HCD is not set
-# CONFIG_USB_MUSB_HDRC is not set
 
 #
 # USB Device Class drivers
@@ -1011,6 +1048,7 @@ CONFIG_RTC_INTF_DEV=y
 CONFIG_RTC_DRV_PCF8563=m
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1032,7 +1070,9 @@ CONFIG_RTC_DRV_PCF8563=m
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1243,10 +1283,11 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
@@ -1269,7 +1310,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 CONFIG_PPC_CLOCK=y
 CONFIG_PPC_LIB_RHEAP=y
index 75c835c2ae6699247a038f40660d9120e840e308..3972438db719e17b9b505a052fa86d2c068a2a83 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:23 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 14:45:09 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -171,14 +174,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -194,6 +224,7 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_PPC_MEDIA5200 is not set
 CONFIG_PPC_MPC5200_BUGFIX=y
 # CONFIG_PPC_MPC5200_GPIO is not set
+# CONFIG_PPC_MPC5200_LPBFIFO is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -249,6 +280,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -265,8 +297,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -279,6 +309,7 @@ CONFIG_PROC_DEVICETREE=y
 CONFIG_EXTRA_TARGETS=""
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -384,7 +415,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -496,6 +533,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
@@ -607,8 +648,8 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -663,6 +704,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -708,7 +750,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -753,6 +794,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -818,11 +860,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -880,7 +924,6 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
 # CONFIG_USB_HWA_HCD is not set
-# CONFIG_USB_MUSB_HDRC is not set
 
 #
 # USB Device Class drivers
@@ -984,6 +1027,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1005,7 +1049,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1275,6 +1321,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1318,7 +1365,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 466f09ac315311ff4c30fb0c55d682698937ae81..baa2bbb6c096a8bb120b6cb91638d777073ddcbe 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:20 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:14 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -60,6 +61,7 @@ CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
 CONFIG_REDBOOT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -88,6 +90,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -174,14 +177,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -260,6 +290,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +307,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -530,6 +556,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -541,6 +571,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -548,6 +579,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -581,7 +613,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -668,8 +700,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -691,6 +726,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -700,6 +736,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -751,6 +788,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -806,11 +844,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -820,7 +853,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -866,6 +898,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -904,6 +937,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 CONFIG_THERMAL=y
 # CONFIG_THERMAL_HWMON is not set
 CONFIG_WATCHDOG=y
@@ -942,11 +976,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -996,6 +1032,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1101,6 +1138,7 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1122,7 +1160,9 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1347,7 +1387,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1374,7 +1414,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 6694fb73cd993c83b29a039910429f0482a6e1da..8b1aa806e548dc7f99dc8acbc3a0cb2adcaadcd5 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:21 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:14 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -89,6 +91,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -168,14 +171,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -253,6 +283,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -269,8 +300,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -384,7 +413,13 @@ CONFIG_LLC=m
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -512,6 +547,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_RAM is not set
 # CONFIG_CDROM_PKTCDVD is not set
@@ -581,8 +620,7 @@ CONFIG_UCC_GETH=y
 # CONFIG_MV643XX_ETH is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -652,6 +690,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_QE is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -697,7 +736,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -732,11 +770,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -933,7 +973,7 @@ CONFIG_FRAME_WARN=1024
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -963,7 +1003,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 # CONFIG_PPC_CLOCK is not set
 CONFIG_PPC_LIB_RHEAP=y
index 86df19f041a4327c283d5fae0ec53d300df4ef8e..2f2d98558e44da0592277114125d6803098bce32 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:22 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:15 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -544,6 +570,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -555,6 +585,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -562,6 +593,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -615,7 +648,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -653,6 +688,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -680,7 +716,7 @@ CONFIG_MD_RAID1=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -805,8 +841,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -829,6 +868,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -838,6 +878,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -890,6 +931,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -946,11 +988,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -960,7 +997,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -975,6 +1011,8 @@ CONFIG_SPI_MASTER=y
 #
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -1022,6 +1060,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1062,6 +1101,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1099,6 +1139,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -1106,6 +1147,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1173,6 +1216,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1287,15 +1331,17 @@ CONFIG_USB_NET2280=y
 CONFIG_USB_GADGET_DUALSPEED=y
 # CONFIG_USB_ZERO is not set
 # CONFIG_USB_AUDIO is not set
-CONFIG_USB_ETH=y
+CONFIG_USB_ETH=m
 CONFIG_USB_ETH_RNDIS=y
 # CONFIG_USB_ETH_EEM is not set
 # CONFIG_USB_GADGETFS is not set
 # CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
 # CONFIG_USB_G_SERIAL is not set
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
 # CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_MULTI is not set
 
 #
 # OTG and related infrastructure
@@ -1336,6 +1382,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1365,7 +1412,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1676,7 +1725,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 7bf71d5770335d81f37785203f892d5ec53f5d27..633e61194603f14717c4a2f84720e48605908d16 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:23 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:16 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -544,6 +570,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -555,6 +585,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -562,6 +593,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -615,7 +648,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -654,6 +689,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -709,15 +745,16 @@ CONFIG_ATA_SFF=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -744,7 +781,7 @@ CONFIG_MD_RAID1=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -869,8 +906,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -893,6 +933,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -902,6 +943,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -954,6 +996,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1010,11 +1053,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1024,7 +1062,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1039,6 +1076,8 @@ CONFIG_SPI_MASTER=y
 #
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -1086,6 +1125,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1126,6 +1166,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1163,6 +1204,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -1170,6 +1212,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1237,6 +1281,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1351,15 +1396,17 @@ CONFIG_USB_NET2280=y
 CONFIG_USB_GADGET_DUALSPEED=y
 # CONFIG_USB_ZERO is not set
 # CONFIG_USB_AUDIO is not set
-CONFIG_USB_ETH=y
+CONFIG_USB_ETH=m
 CONFIG_USB_ETH_RNDIS=y
 # CONFIG_USB_ETH_EEM is not set
 # CONFIG_USB_GADGETFS is not set
 # CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
 # CONFIG_USB_G_SERIAL is not set
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
 # CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_MULTI is not set
 
 #
 # OTG and related infrastructure
@@ -1400,6 +1447,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1429,7 +1477,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1740,7 +1790,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 7def83518a6cf21aeb3ac91bfa839d8b671dec18..0b4262bd49175c5da64a0be5c032efb6ecc6f544 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:24 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:17 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -260,6 +290,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +307,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -444,6 +470,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -454,6 +484,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -461,6 +492,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -513,7 +545,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -551,6 +585,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -568,7 +603,7 @@ CONFIG_SCSI_LOWLEVEL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -675,8 +710,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -690,6 +727,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -699,6 +737,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -751,6 +790,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_QE is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -806,11 +846,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -820,7 +855,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -866,6 +900,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -904,6 +939,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -936,11 +972,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1023,6 +1061,7 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1044,7 +1083,9 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1220,7 +1261,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1247,7 +1288,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index b398b9b2b6355193dfe8a0e8440c26908a34e70a..155af009f7b5a483b876ef3b29e04e769b24234c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:24 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:18 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -260,6 +290,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +307,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -445,6 +471,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -456,6 +486,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -463,6 +494,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -474,6 +507,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_EEPROM_MAX6875 is not set
 # CONFIG_EEPROM_93CX6 is not set
 # CONFIG_CB710_CORE is not set
+# CONFIG_IWMC3200TOP is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -516,7 +550,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -554,6 +590,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -571,7 +608,7 @@ CONFIG_SCSI_LOWLEVEL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -680,8 +717,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -704,6 +744,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -713,6 +754,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -766,6 +808,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_QE is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -824,11 +867,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -838,7 +876,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -852,6 +889,8 @@ CONFIG_SPI_MASTER=y
 #
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -899,6 +938,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -939,6 +979,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -976,6 +1017,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -983,6 +1025,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1050,6 +1094,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1387,7 +1432,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1414,7 +1459,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index f67317e1934c3cebd7d9f5eb08dc6ef561d02126..ff45f490448883499aea992b16d260741fefdafe 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:25 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:19 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -403,9 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -528,6 +554,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -539,6 +569,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -546,6 +577,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -647,7 +680,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -686,6 +721,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -741,15 +777,16 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 CONFIG_PATA_PLATFORM=y
@@ -777,7 +814,7 @@ CONFIG_MD_RAID1=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -860,8 +897,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -884,6 +924,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -925,6 +966,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -981,11 +1023,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -995,7 +1032,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1009,6 +1045,8 @@ CONFIG_SPI_MASTER=y
 #
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -1062,6 +1100,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -1069,6 +1108,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1117,6 +1158,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1235,6 +1277,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1264,7 +1307,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1485,7 +1530,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1512,7 +1557,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index a668110c10f658a2cae1d6c0ce98dfe49fa3d187..28d8ff3e8fcaac69d79d7cf3a6bb26ffd9023af9 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:26 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:20 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -403,9 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -528,6 +554,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -539,6 +569,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -546,6 +577,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -599,7 +632,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -637,6 +672,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -654,7 +690,7 @@ CONFIG_SCSI_LOWLEVEL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -737,8 +773,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -761,6 +800,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -802,6 +842,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -858,11 +899,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -872,7 +908,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -886,6 +921,8 @@ CONFIG_SPI_MASTER=y
 #
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -939,6 +976,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -946,6 +984,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -994,6 +1034,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1112,6 +1153,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1141,7 +1183,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1362,7 +1406,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1389,7 +1433,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index c4e92ba5c38b601cc2ee46639ae9c9b0ca7e020e..6252ab5bf1813b8c9d5d957c4ccd51f95c13cb1e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:27 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:21 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -403,9 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -443,6 +469,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -453,6 +483,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -460,6 +491,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -493,7 +525,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -616,8 +648,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -630,6 +664,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -639,6 +674,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -690,6 +726,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -744,11 +781,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -758,7 +790,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -804,6 +835,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -842,6 +874,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -874,11 +907,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -961,6 +996,7 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -982,7 +1018,9 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1156,7 +1194,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1183,7 +1221,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 4f434b1492fadd1c1d2457be697132f24b12679c..78227378e67859e4d6ca363070488725728b704b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:28 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:21 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +176,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -258,6 +288,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -274,8 +305,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -402,9 +431,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -525,6 +551,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -535,6 +565,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -542,6 +573,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -594,7 +626,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -632,6 +666,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -649,7 +684,7 @@ CONFIG_SCSI_LOWLEVEL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -756,8 +791,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -771,6 +808,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -780,6 +818,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -832,6 +871,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_QE is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -887,11 +927,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -901,7 +936,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -947,6 +981,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -985,6 +1020,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1017,11 +1053,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1104,6 +1142,7 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1125,7 +1164,9 @@ CONFIG_RTC_DRV_DS1374=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1302,7 +1343,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1329,7 +1370,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index b52ec08616791c4aff2a4047af5a5d70b6784c20..9451d6e5c8024ded16162a929a864c3974ecba9a 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:30 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:23 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -60,6 +61,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -88,6 +90,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -174,14 +177,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -258,6 +288,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -274,8 +305,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +433,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -539,6 +565,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -549,6 +579,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -556,6 +587,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -590,7 +623,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -657,8 +690,10 @@ CONFIG_UCC_GETH=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -671,6 +706,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -680,6 +716,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -737,6 +774,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 CONFIG_SERIAL_QE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -794,11 +832,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -808,7 +841,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -823,6 +855,8 @@ CONFIG_SPI_MASTER=y
 CONFIG_SPI_BITBANG=y
 # CONFIG_SPI_GPIO is not set
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -854,6 +888,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -903,6 +938,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -910,6 +946,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1199,7 +1237,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1230,6 +1268,7 @@ CONFIG_PPC_EARLY_DEBUG=y
 # CONFIG_PPC_EARLY_DEBUG_44x is not set
 # CONFIG_PPC_EARLY_DEBUG_40x is not set
 # CONFIG_PPC_EARLY_DEBUG_CPM is not set
+# CONFIG_PPC_EARLY_DEBUG_USBGECKO is not set
 
 #
 # Security options
@@ -1237,7 +1276,11 @@ CONFIG_PPC_EARLY_DEBUG=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 730061574f96b79e31b54c8b7d21afddb6d1359c..f67b70d0b29215fa5f705e0e044ece6e64d1a72a 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:29 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:22 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -174,14 +177,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -403,9 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -443,6 +469,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -453,6 +483,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -460,6 +491,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -512,7 +544,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -551,6 +585,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -606,15 +641,16 @@ CONFIG_ATA_SFF=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -631,7 +667,7 @@ CONFIG_ATA_SFF=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -736,8 +772,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -751,6 +789,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -760,6 +799,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -811,6 +851,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -867,11 +908,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -881,7 +917,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -927,6 +962,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -965,6 +1001,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -997,11 +1034,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1226,7 +1265,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1253,7 +1292,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 9e9158a5b190116b645aec5237e12d7607ee81e9..a84fd1194e2b0a372089f16f91443de1833042e0 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:30 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:24 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -174,14 +177,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +289,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -398,9 +427,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -438,6 +464,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -449,6 +479,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -456,6 +487,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -507,7 +539,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -546,6 +580,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -601,15 +636,16 @@ CONFIG_ATA_SFF=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -638,7 +674,7 @@ CONFIG_MD_RAID6_PQ=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -725,8 +761,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -749,6 +788,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -758,6 +798,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -809,6 +850,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -866,11 +908,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -880,7 +917,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -926,6 +962,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -964,6 +1001,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1001,11 +1039,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1097,6 +1137,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1385,7 +1426,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1412,7 +1453,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_XOR_BLOCKS=y
 CONFIG_ASYNC_CORE=y
 CONFIG_ASYNC_MEMCPY=y
index 6b399154970fecf320b7e80329ebab7c8c6f3a6f..72c2067137b974f90b51f0fa1e4ab803aeca6a05 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:31 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:25 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -172,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -257,6 +287,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -273,8 +304,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -401,9 +430,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -524,6 +550,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -535,6 +565,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -542,6 +573,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -604,7 +636,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -691,8 +723,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -715,6 +750,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -724,6 +760,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -775,6 +812,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -832,11 +870,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -846,7 +879,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -892,6 +924,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -930,6 +963,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -967,11 +1001,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1039,6 +1075,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1321,7 +1358,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1348,7 +1385,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index a5bde8da462c140d12c769e95f3c975ba042b061..21dad38b156f175eab1ac55c15a2dfca863c1fac 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:32 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:26 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -169,14 +173,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -185,7 +216,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -204,6 +235,7 @@ CONFIG_KSI8560=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -248,6 +280,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -264,8 +297,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -385,9 +416,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -503,6 +531,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -603,8 +635,7 @@ CONFIG_GIANFAR=y
 # CONFIG_MV643XX_ETH is not set
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -624,6 +655,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -669,6 +701,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1051,7 +1084,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index c10e26f8763ff78feba998c4c58989f875a46c4e..5db54cd274c69d94833b53bea36491935e670738 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:33 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:27 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -170,14 +174,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -186,7 +217,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 CONFIG_MPC8540_ADS=y
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -205,6 +236,7 @@ CONFIG_MPC8540_ADS=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -249,6 +281,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -265,8 +298,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -386,9 +417,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -423,6 +451,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -500,8 +532,7 @@ CONFIG_GIANFAR=y
 # CONFIG_MV643XX_ETH is not set
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -521,6 +552,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -570,6 +602,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -920,7 +953,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 8d9f0a4b5205fdbbfad3c3d29abceca61fc5e6c6..76c7018c5cd21c872d7cbd6879a3ec51afff5c24 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:34 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:28 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,14 +177,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -189,7 +220,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 CONFIG_MPC8560_ADS=y
 # CONFIG_MPC85xx_CDS is not set
@@ -208,6 +239,7 @@ CONFIG_MPC8560_ADS=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -252,6 +284,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -268,8 +301,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -398,9 +429,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -440,6 +468,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -485,7 +517,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -594,8 +626,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -608,6 +642,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -617,6 +652,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -664,6 +700,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -705,6 +742,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1054,7 +1092,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 9b63e258dac6f5695032077497931c243663a61d..fab8adacbf792c47d594505c0c57947e1514dd95 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:35 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:29 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -171,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -187,7 +218,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 CONFIG_MPC85xx_CDS=y
@@ -206,6 +237,7 @@ CONFIG_MPC85xx_CDS=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -250,6 +282,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -266,8 +299,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -396,9 +427,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -437,6 +465,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -537,7 +569,7 @@ CONFIG_BLK_DEV_IDEDMA=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -642,8 +674,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -656,6 +690,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -665,6 +700,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -717,6 +753,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1079,7 +1116,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 1b235683017306c3aefacafd3ef2e040529a0aa0..8290385e9b94bcfe434021a3b658e7597a6a0767 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:36 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:29 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -169,14 +173,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -185,7 +216,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -204,6 +235,7 @@ CONFIG_MPC85xx=y
 # CONFIG_TQM8560 is not set
 CONFIG_SBC8548=y
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -247,6 +279,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -263,8 +296,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -392,9 +423,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -431,6 +459,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -476,7 +508,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -581,8 +613,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -595,6 +629,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -604,6 +639,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -656,6 +692,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -889,7 +926,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -915,7 +952,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 959d0281431b211646aca885eab17a9fb761e88f..2499b5ba71418871398e805861fd232eba72806b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:37 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:30 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -169,14 +173,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -185,7 +216,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -204,6 +235,7 @@ CONFIG_MPC85xx=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 CONFIG_SBC8560=y
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -247,6 +279,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -263,8 +296,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -384,9 +415,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -421,6 +449,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -498,8 +530,7 @@ CONFIG_GIANFAR=y
 # CONFIG_MV643XX_ETH is not set
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -519,6 +550,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -568,6 +600,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -702,7 +735,9 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 CONFIG_RTC_DRV_M48T59=y
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -948,6 +983,7 @@ CONFIG_PPC_EARLY_DEBUG=y
 # CONFIG_PPC_EARLY_DEBUG_44x is not set
 # CONFIG_PPC_EARLY_DEBUG_40x is not set
 # CONFIG_PPC_EARLY_DEBUG_CPM is not set
+# CONFIG_PPC_EARLY_DEBUG_USBGECKO is not set
 
 #
 # Security options
@@ -955,7 +991,11 @@ CONFIG_PPC_EARLY_DEBUG=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 7f5ec35bf1990e3eb586ed30795ed4ac7c602437..e2edb79cfd1a1d8905cc02b21993b861d2d0a79f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:37 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:31 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -174,14 +178,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -190,7 +221,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -209,6 +240,7 @@ CONFIG_SOCRATES=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -252,6 +284,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -268,8 +301,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,9 +435,6 @@ CONFIG_CAN_BCM=y
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-# CONFIG_WIRELESS_OLD_REGULATORY is not set
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -540,6 +568,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -551,6 +583,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -558,6 +591,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -621,7 +656,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -710,8 +745,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -734,6 +772,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -743,6 +782,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -768,6 +808,7 @@ CONFIG_INPUT_TOUCHSCREEN=y
 # CONFIG_TOUCHSCREEN_AD7879_I2C is not set
 # CONFIG_TOUCHSCREEN_AD7879_SPI is not set
 # CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
 # CONFIG_TOUCHSCREEN_EETI is not set
 # CONFIG_TOUCHSCREEN_FUJITSU is not set
 # CONFIG_TOUCHSCREEN_GUNZE is not set
@@ -826,6 +867,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -882,11 +924,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -896,7 +933,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -910,6 +946,8 @@ CONFIG_SPI_MASTER=y
 #
 # CONFIG_SPI_BITBANG is not set
 # CONFIG_SPI_MPC8xxx is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -957,6 +995,7 @@ CONFIG_HWMON_DEBUG_CHIP=y
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -997,6 +1036,7 @@ CONFIG_SENSORS_W83781D=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1015,6 +1055,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -1022,6 +1063,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1192,6 +1235,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1318,6 +1362,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1347,7 +1392,9 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1574,7 +1621,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1600,7 +1647,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index c8327e88a987d6589b2f2d2b90a1820a6c40b408..ce313259df14a26c8d967644747da1dcec6c72a3 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:38 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:32 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -178,14 +182,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -194,7 +225,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -213,6 +244,7 @@ CONFIG_STX_GP3=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -257,6 +289,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -273,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -463,9 +494,6 @@ CONFIG_NET_PKTGEN=y
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -513,6 +541,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -523,6 +555,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -530,6 +563,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -633,7 +667,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -673,6 +709,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -690,7 +727,7 @@ CONFIG_SCSI_LOWLEVEL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -797,8 +834,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -813,6 +852,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -822,6 +862,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -881,6 +922,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -905,6 +947,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -969,11 +1012,6 @@ CONFIG_I2C_ALGOBIT=m
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -983,7 +1021,6 @@ CONFIG_I2C_ALGOBIT=m
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1016,6 +1053,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1058,6 +1096,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1097,6 +1136,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1115,7 +1155,6 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TPS65010 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_MFD_WM8400 is not set
-# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
@@ -1465,7 +1504,11 @@ CONFIG_BDI_SWITCH=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 82563703d5e38972e51182f1a7fb238e678877e8..0824b46672296510e693aa4b27f8a2fe6bb61e31 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:39 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:33 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -169,14 +173,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -185,7 +216,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -204,6 +235,7 @@ CONFIG_TQM8540=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -248,6 +280,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -264,8 +297,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -391,9 +422,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -510,6 +538,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -520,6 +552,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -527,6 +560,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -615,7 +649,7 @@ CONFIG_BLK_DEV_IDEDMA=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -738,8 +772,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -752,6 +788,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -761,6 +798,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -813,6 +851,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -870,11 +909,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -883,7 +917,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -929,6 +962,7 @@ CONFIG_HWMON_DEBUG_CHIP=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -967,6 +1001,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -985,11 +1020,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1220,7 +1257,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1246,7 +1283,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 91d85d733827511fad6c0e4361e3ac777dfacdcc..2137be4100ed4b7fb5c7ccf7eb0008c09b2fdc8f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:40 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:34 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -171,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -187,7 +218,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -206,6 +237,7 @@ CONFIG_TQM8541=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -251,6 +283,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -267,8 +300,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -394,9 +425,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -514,6 +542,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -524,6 +556,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -531,6 +564,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -619,7 +653,7 @@ CONFIG_BLK_DEV_IDEDMA=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -743,8 +777,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -757,6 +793,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -766,6 +803,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -820,6 +858,7 @@ CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -880,11 +919,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -893,7 +927,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -925,6 +958,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -967,6 +1001,7 @@ CONFIG_HWMON_DEBUG_CHIP=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1006,6 +1041,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1025,11 +1061,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1260,7 +1298,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1286,7 +1324,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index debe268f43d183f06b312d6548fdedf58f5655ba..5cc89aac3fec9660626531db046813b121bacb9f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:41 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:35 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -177,14 +181,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -193,7 +224,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -212,6 +243,7 @@ CONFIG_TQM8548=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -257,6 +289,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -273,8 +306,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -406,7 +437,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -535,6 +572,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -545,6 +586,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -552,6 +594,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -585,7 +628,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -690,8 +733,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -704,6 +749,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -713,6 +759,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -765,6 +812,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -819,11 +867,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -833,7 +876,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -879,6 +921,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -917,6 +960,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -935,11 +979,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1003,6 +1049,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1024,7 +1071,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1280,7 +1329,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 74515501f5b79889b6d8a4ab5190e704b32be391..e7b9148e58cf648857cb32c729ebeca847e8ed8c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:42 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:36 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -171,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -187,7 +218,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -206,6 +237,7 @@ CONFIG_TQM8555=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -251,6 +283,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -267,8 +300,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -394,9 +425,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -514,6 +542,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -524,6 +556,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -531,6 +564,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -619,7 +653,7 @@ CONFIG_BLK_DEV_IDEDMA=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -743,8 +777,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -757,6 +793,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -766,6 +803,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -820,6 +858,7 @@ CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -880,11 +919,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -893,7 +927,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -925,6 +958,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -967,6 +1001,7 @@ CONFIG_HWMON_DEBUG_CHIP=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1006,6 +1041,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1025,11 +1061,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1260,7 +1298,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1286,7 +1324,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 631d92b4d4e619ed6a982030c390a925829e52ac..a998e401bbfc93b8b28a266f40dbb07754b41ca6 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:43 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:36 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -89,6 +92,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -171,14 +175,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -187,7 +218,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -206,6 +237,7 @@ CONFIG_MPC85xx=y
 CONFIG_TQM8560=y
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -251,6 +283,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -267,8 +300,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -394,9 +425,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -514,6 +542,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -524,6 +556,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -531,6 +564,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -619,7 +653,7 @@ CONFIG_BLK_DEV_IDEDMA=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -743,8 +777,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -757,6 +793,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -766,6 +803,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -820,6 +858,7 @@ CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -880,11 +919,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -893,7 +927,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -925,6 +958,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -967,6 +1001,7 @@ CONFIG_HWMON_DEBUG_CHIP=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1006,6 +1041,7 @@ CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1025,11 +1061,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1260,7 +1298,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1286,7 +1324,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 52acbac0c4fe1bd2c92fc24481a5ad9c0cf98efd..fc656af04ea1572de6ed96b6914855b1038d3c73 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:44 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:37 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -40,6 +40,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -63,6 +64,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -93,6 +96,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -181,14 +185,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 CONFIG_PPC_MSI_BITMAP=y
 
@@ -198,7 +229,7 @@ CONFIG_PPC_MSI_BITMAP=y
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 # CONFIG_MPC8540_ADS is not set
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
@@ -217,6 +248,7 @@ CONFIG_XES_MPC85xx=y
 # CONFIG_TQM8560 is not set
 # CONFIG_SBC8548 is not set
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
@@ -261,6 +293,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_IRQ_ALL_CPUS is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -277,8 +310,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -404,6 +435,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -441,7 +473,13 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
 CONFIG_FIB_RULES=y
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -576,6 +614,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -587,6 +629,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -594,6 +637,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -646,7 +690,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -685,6 +731,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -740,15 +787,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -765,7 +813,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -852,8 +900,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -876,6 +927,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -885,6 +937,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -914,6 +967,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -950,6 +1004,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1006,11 +1061,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1020,7 +1070,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1053,6 +1102,7 @@ CONFIG_GPIO_PCA953X=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1095,6 +1145,7 @@ CONFIG_SENSORS_DS1621=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1134,6 +1185,7 @@ CONFIG_SENSORS_LM90=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1172,11 +1224,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1368,6 +1422,7 @@ CONFIG_LEDS_GPIO_OF=y
 # CONFIG_LEDS_LP3944 is not set
 CONFIG_LEDS_PCA955X=y
 # CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
 
 #
 # LED Triggers
@@ -1391,7 +1446,6 @@ CONFIG_EDAC=y
 #
 # CONFIG_EDAC_DEBUG is not set
 CONFIG_EDAC_MM_EDAC=y
-CONFIG_EDAC_MPC85XX=y
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -1420,6 +1474,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1441,7 +1496,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1772,7 +1829,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 6cd2cd65c2cdfbefa7e71527a4cbbed4ae0a8f9a..622d84f48aba9f218796e134802bdd74592f48ec 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:49 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:43 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -91,6 +94,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -181,14 +185,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +290,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +307,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -314,7 +344,6 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_STUB is not set
 # CONFIG_PCI_IOV is not set
 CONFIG_PCCARD=y
-# CONFIG_PCMCIA_DEBUG is not set
 CONFIG_PCMCIA=y
 # CONFIG_PCMCIA_LOAD_CIS is not set
 # CONFIG_PCMCIA_IOCTL is not set
@@ -414,6 +443,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -451,7 +481,13 @@ CONFIG_NET_PKTGEN=m
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
 CONFIG_FIB_RULES=y
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -570,6 +606,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -581,6 +621,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -588,6 +629,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+CONFIG_DS1682=y
 # CONFIG_C2PORT is not set
 
 #
@@ -689,7 +731,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -728,6 +772,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
@@ -785,15 +830,16 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
 # CONFIG_PATA_PCMCIA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -810,7 +856,7 @@ CONFIG_SATA_SIL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -897,8 +943,14 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_PCMCIA_RAYCS is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_AIRO_CS is not set
+# CONFIG_PCMCIA_WL3501 is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -937,6 +989,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -946,6 +999,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -1005,6 +1059,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -1069,11 +1124,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1083,7 +1133,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-CONFIG_DS1682=y
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1115,6 +1164,7 @@ CONFIG_GPIO_SYSFS=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1157,6 +1207,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1196,6 +1247,7 @@ CONFIG_SENSORS_LM92=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1235,11 +1287,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1338,6 +1392,7 @@ CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 # CONFIG_USB_EHCI_HCD_PPC_OF is not set
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1464,6 +1519,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 CONFIG_RTC_DRV_RX8581=y
@@ -1485,7 +1541,9 @@ CONFIG_RTC_DRV_RX8581=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1499,7 +1557,52 @@ CONFIG_RTC_DRV_RX8581=y
 #
 # TI VLYNQ
 #
-# CONFIG_STAGING is not set
+CONFIG_STAGING=y
+# CONFIG_STAGING_EXCLUDE_BUILD is not set
+# CONFIG_ET131X is not set
+# CONFIG_ME4000 is not set
+# CONFIG_MEILHAUS is not set
+# CONFIG_USB_IP_COMMON is not set
+# CONFIG_ECHO is not set
+# CONFIG_COMEDI is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_ALTERA_PCIE_CHDMA is not set
+# CONFIG_INPUT_MIMIO is not set
+# CONFIG_TRANZPORT is not set
+
+#
+# Android
+#
+# CONFIG_ANDROID is not set
+# CONFIG_DST is not set
+# CONFIG_POHMELFS is not set
+# CONFIG_B3DFG is not set
+# CONFIG_IDE_PHISON is not set
+# CONFIG_PLAN9AUTH is not set
+# CONFIG_HECI is not set
+# CONFIG_USB_CPC is not set
+
+#
+# Qualcomm MSM Camera And Video
+#
+
+#
+# Camera Sensor Selection
+#
+# CONFIG_HYPERV_STORAGE is not set
+# CONFIG_HYPERV_BLOCK is not set
+# CONFIG_HYPERV_NET is not set
+CONFIG_VME_BUS=y
+
+#
+# VME Bridge Drivers
+#
+CONFIG_VME_TSI148=y
+
+#
+# VME Device Drivers
+#
+# CONFIG_VME_USER is not set
 
 #
 # File systems
@@ -1710,7 +1813,7 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1737,7 +1840,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index a6a3768f73041e614089d960b49aa308d2889117..eb58dec11a6108695b502b1424dbf4587b964ada 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:47 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:41 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -91,6 +94,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -181,14 +185,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -259,6 +290,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -275,8 +307,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -314,7 +344,6 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_STUB is not set
 # CONFIG_PCI_IOV is not set
 CONFIG_PCCARD=y
-# CONFIG_PCMCIA_DEBUG is not set
 CONFIG_PCMCIA=y
 # CONFIG_PCMCIA_LOAD_CIS is not set
 # CONFIG_PCMCIA_IOCTL is not set
@@ -414,6 +443,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -451,7 +481,13 @@ CONFIG_NET_PKTGEN=m
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
 CONFIG_FIB_RULES=y
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -570,6 +606,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -581,6 +621,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -588,6 +629,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+CONFIG_DS1682=y
 # CONFIG_C2PORT is not set
 
 #
@@ -689,7 +731,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -728,6 +772,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
@@ -753,7 +798,7 @@ CONFIG_SATA_SIL24=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -840,8 +885,14 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_PCMCIA_RAYCS is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_AIRO_CS is not set
+# CONFIG_PCMCIA_WL3501 is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -880,6 +931,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -889,6 +941,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -948,6 +1001,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -1012,11 +1066,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1026,7 +1075,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-CONFIG_DS1682=y
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1058,6 +1106,7 @@ CONFIG_GPIO_SYSFS=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1100,6 +1149,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1139,6 +1189,7 @@ CONFIG_SENSORS_LM92=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1178,11 +1229,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1281,6 +1334,7 @@ CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 # CONFIG_USB_EHCI_HCD_PPC_OF is not set
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1407,6 +1461,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 CONFIG_RTC_DRV_RX8581=y
@@ -1428,7 +1483,9 @@ CONFIG_RTC_DRV_RX8581=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1653,7 +1710,7 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1680,7 +1737,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 1975d41e07632ee093ff437141f3e0406bd71beb..62c2b81a4a8fad310c6f6abaf92dad9e75108972 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:48 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:42 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -91,6 +94,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -182,14 +186,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -234,7 +265,7 @@ CONFIG_MMIO_NVRAM=y
 #
 # Kernel options
 #
-# CONFIG_HIGHMEM is not set
+CONFIG_HIGHMEM=y
 CONFIG_TICK_ONESHOT=y
 # CONFIG_NO_HZ is not set
 CONFIG_HIGH_RES_TIMERS=y
@@ -260,6 +291,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +308,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -400,6 +430,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -588,9 +619,6 @@ CONFIG_NET_PKTGEN=m
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -623,7 +651,7 @@ CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_OF_PARTS is not set
+CONFIG_MTD_OF_PARTS=y
 # CONFIG_MTD_AR7_PARTS is not set
 
 #
@@ -643,13 +671,9 @@ CONFIG_MTD_BLOCK=y
 # RAM/ROM/Flash chip drivers
 #
 CONFIG_MTD_CFI=y
-# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_JEDECPROBE=y
 CONFIG_MTD_GEN_PROBE=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_NOSWAP is not set
-# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
-CONFIG_MTD_CFI_LE_BYTE_SWAP=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 CONFIG_MTD_MAP_BANK_WIDTH_2=y
 CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -660,7 +684,6 @@ 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_OTP is not set
 CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_CFI_AMDSTD=y
 # CONFIG_MTD_CFI_STAA is not set
@@ -719,6 +742,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -730,6 +757,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -737,6 +765,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+CONFIG_DS1682=y
 # CONFIG_C2PORT is not set
 
 #
@@ -789,7 +818,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -828,6 +859,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -883,15 +915,16 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -908,7 +941,7 @@ CONFIG_SATA_SIL=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -995,8 +1028,11 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -1050,6 +1086,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -1059,6 +1096,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -1117,6 +1155,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -1173,11 +1212,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1187,7 +1221,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-CONFIG_DS1682=y
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1220,6 +1253,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1262,6 +1296,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1301,6 +1336,7 @@ CONFIG_SENSORS_LM92=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1340,11 +1376,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1443,6 +1481,7 @@ CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 # CONFIG_USB_EHCI_HCD_PPC_OF is not set
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1570,6 +1609,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 CONFIG_RTC_DRV_RX8581=y
@@ -1591,7 +1631,9 @@ CONFIG_RTC_DRV_RX8581=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1605,7 +1647,44 @@ CONFIG_RTC_DRV_RX8581=y
 #
 # TI VLYNQ
 #
-# CONFIG_STAGING is not set
+CONFIG_STAGING=y
+# CONFIG_STAGING_EXCLUDE_BUILD is not set
+# CONFIG_ET131X is not set
+# CONFIG_ME4000 is not set
+# CONFIG_MEILHAUS is not set
+# CONFIG_USB_IP_COMMON is not set
+# CONFIG_ECHO is not set
+# CONFIG_COMEDI is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_ALTERA_PCIE_CHDMA is not set
+# CONFIG_INPUT_MIMIO is not set
+# CONFIG_TRANZPORT is not set
+
+#
+# Android
+#
+# CONFIG_ANDROID is not set
+# CONFIG_DST is not set
+# CONFIG_POHMELFS is not set
+# CONFIG_B3DFG is not set
+# CONFIG_IDE_PHISON is not set
+# CONFIG_PLAN9AUTH is not set
+# CONFIG_HECI is not set
+# CONFIG_VT6655 is not set
+# CONFIG_USB_CPC is not set
+# CONFIG_RDC_17F3101X is not set
+CONFIG_VME_BUS=y
+
+#
+# VME Bridge Drivers
+#
+# CONFIG_VME_CA91CX42 is not set
+CONFIG_VME_TSI148=y
+
+#
+# VME Device Drivers
+#
+# CONFIG_VME_USER is not set
 
 #
 # File systems
@@ -1682,7 +1761,17 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS2_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
@@ -1827,6 +1916,7 @@ CONFIG_DEBUG_PREEMPT=y
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_HIGHMEM is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
 CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_VM is not set
@@ -1891,9 +1981,12 @@ CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 # CONFIG_SECURITY_NETWORK_XFRM is not set
 # CONFIG_SECURITY_PATH is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
-# CONFIG_SECURITY_ROOTPLUG is not set
 # CONFIG_SECURITY_TOMOYO is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index de4d52504fe4eb33e826684fe173605fdc95b126..aab3baebab8cbbb7e025546777c8afb77b5b1e27 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:45 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:39 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -86,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -176,14 +180,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -254,6 +285,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -270,8 +302,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -382,6 +412,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -420,9 +451,6 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -555,6 +583,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -565,6 +597,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -572,6 +605,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -671,7 +705,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -710,6 +746,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -765,15 +802,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -790,7 +828,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -838,8 +876,10 @@ CONFIG_ULI526X=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -853,6 +893,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -862,6 +903,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -891,6 +933,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -927,6 +970,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -980,11 +1024,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -994,7 +1033,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1029,11 +1067,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1163,6 +1203,7 @@ CONFIG_SND_PCI=y
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS5530 is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1282,6 +1323,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1303,7 +1345,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1606,7 +1650,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 754a79ba74a934377b237674baddbfd0410228bc..727a8c8d15b5309b10b4e74fef986f4e1e6dcfdc 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:46 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:40 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -60,6 +61,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -90,6 +93,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -182,14 +186,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -260,6 +291,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 # CONFIG_IRQ_ALL_CPUS is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +308,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -395,6 +425,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -439,9 +470,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -483,6 +511,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -494,6 +526,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -501,6 +534,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -554,7 +588,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -593,6 +629,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -648,15 +685,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -673,7 +711,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -778,8 +816,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -802,6 +843,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -811,6 +853,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -840,6 +883,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -876,6 +920,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -931,11 +976,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -945,7 +985,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -980,11 +1019,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1059,6 +1100,7 @@ CONFIG_SND_PCI=y
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS5530 is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1186,6 +1228,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1312,6 +1355,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1333,7 +1377,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1648,7 +1694,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 89991f157ae836b6aa37d7539240eda5421580ed..4fb04dd2cde3c05423d1f725f085c69958d39ffb 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:45 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:38 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -90,6 +93,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -162,6 +166,7 @@ CONFIG_HAVE_DMA_API_DEBUG=y
 #
 # CONFIG_GCOV_KERNEL is not set
 CONFIG_SLOW_WORK=y
+# CONFIG_SLOW_WORK_DEBUG is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -182,14 +187,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -260,6 +292,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -276,8 +309,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -399,6 +430,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -587,9 +619,6 @@ CONFIG_NET_PKTGEN=m
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -717,6 +746,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -727,6 +760,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -734,6 +768,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -786,7 +821,7 @@ CONFIG_DM_ZERO=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -873,8 +908,10 @@ CONFIG_GIANFAR=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -918,6 +955,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -927,6 +965,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -985,6 +1024,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1041,11 +1081,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1055,7 +1090,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1101,6 +1135,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1139,6 +1174,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1171,11 +1207,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1281,7 +1319,6 @@ CONFIG_OCFS2_FS_O2CB=m
 CONFIG_OCFS2_FS_STATS=y
 CONFIG_OCFS2_DEBUG_MASKLOG=y
 # CONFIG_OCFS2_DEBUG_FS is not set
-# CONFIG_OCFS2_FS_POSIX_ACL is not set
 # CONFIG_BTRFS_FS is not set
 # CONFIG_NILFS2_FS is not set
 CONFIG_FILE_LOCKING=y
@@ -1556,8 +1593,12 @@ CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 # CONFIG_SECURITY_NETWORK_XFRM is not set
 # CONFIG_SECURITY_PATH is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_SECURITY_TOMOYO is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 052cf134e01858d9955e8890fffd207a0554d9cf..5c1dc768bbd80847f434cb0b958d892a35806f0c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:04 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:23:58 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -32,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -55,6 +56,7 @@ CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
 CONFIG_REDBOOT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -82,6 +84,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -161,14 +164,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -242,6 +272,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -258,8 +289,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -373,9 +402,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -546,8 +572,7 @@ CONFIG_FS_ENET_MDIO_FEC=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -567,6 +592,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -615,6 +641,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -637,6 +664,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -898,6 +926,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -943,7 +972,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 CONFIG_PPC_CLOCK=y
 CONFIG_PPC_LIB_RHEAP=y
index 0fb65a85dfdf3724abcc52500c55765ad52cc116..72137cd881da77144b57258d261b8bcee9eafba7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:05 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:23:59 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -92,6 +94,7 @@ CONFIG_AUDIT_TREE=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -173,6 +176,7 @@ CONFIG_HAVE_DMA_API_DEBUG=y
 #
 # CONFIG_GCOV_KERNEL is not set
 CONFIG_SLOW_WORK=y
+# CONFIG_SLOW_WORK_DEBUG is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -192,14 +196,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -224,6 +255,8 @@ CONFIG_EMBEDDED6xx=y
 # CONFIG_PPC_PRPMC2800 is not set
 CONFIG_PPC_C2K=y
 CONFIG_MV64X60=y
+# CONFIG_GAMECUBE is not set
+# CONFIG_WII is not set
 # CONFIG_AMIGAONE is not set
 CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_IPIC is not set
@@ -286,6 +319,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -296,14 +330,12 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_SPLIT_PTLOCK_CPUS=999999
 CONFIG_MIGRATION=y
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -316,6 +348,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_EXTRA_TARGETS=""
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -424,6 +457,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -687,10 +721,6 @@ CONFIG_BT_HCIVHCI=m
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-CONFIG_WIRELESS_EXT=y
-CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_LIB80211 is not set
 
 #
@@ -773,7 +803,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
 # CONFIG_MTD_PHYSMAP is not set
 CONFIG_MTD_PHYSMAP_OF=y
 # CONFIG_MTD_PCI is not set
-# CONFIG_MTD_GPIO_ADDR is not set
 # CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -817,6 +846,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -870,7 +903,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 CONFIG_BLK_DEV_3W_XXXX_RAID=m
+# CONFIG_SCSI_HPSA is not set
 CONFIG_SCSI_3W_9XXX=m
+# CONFIG_SCSI_3W_SAS is not set
 CONFIG_SCSI_ACARD=m
 CONFIG_SCSI_AACRAID=m
 CONFIG_SCSI_AIC7XXX=m
@@ -925,6 +960,7 @@ CONFIG_SCSI_LPFC=m
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -942,7 +978,7 @@ CONFIG_SCSI_LPFC=m
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -1027,8 +1063,11 @@ CONFIG_MV643XX_ETH=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -1054,6 +1093,7 @@ CONFIG_NETCONSOLE=m
 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -1063,6 +1103,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -1121,8 +1162,6 @@ CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_N_HDLC is not set
 # CONFIG_RISCOM8 is not set
 # CONFIG_SPECIALIX is not set
-# CONFIG_SX is not set
-# CONFIG_RIO is not set
 # CONFIG_STALDRV is not set
 # CONFIG_NOZOMI is not set
 
@@ -1140,6 +1179,7 @@ CONFIG_SERIAL_MPSC_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -1199,11 +1239,6 @@ CONFIG_I2C_MV64XXX=m
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1213,7 +1248,6 @@ CONFIG_I2C_MV64XXX=m
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1259,6 +1293,7 @@ CONFIG_SENSORS_GL518SM=m
 # CONFIG_SENSORS_GL520SM is not set
 CONFIG_SENSORS_IT87=m
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 CONFIG_SENSORS_LM75=m
 CONFIG_SENSORS_LM77=m
 CONFIG_SENSORS_LM78=m
@@ -1297,6 +1332,7 @@ CONFIG_SENSORS_W83L785TS=m
 # CONFIG_SENSORS_W83L786NG is not set
 CONFIG_SENSORS_W83627HF=m
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1333,7 +1369,6 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_MFD_WM8400 is not set
-# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
@@ -1392,6 +1427,7 @@ CONFIG_USB_MON=m
 CONFIG_USB_EHCI_HCD=m
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
@@ -1923,7 +1959,6 @@ CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 # CONFIG_SECURITY_NETWORK_XFRM is not set
 # CONFIG_SECURITY_PATH is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_LSM_MMAP_MIN_ADDR=65536
 CONFIG_SECURITY_SELINUX=y
 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
@@ -1934,6 +1969,11 @@ CONFIG_SECURITY_SELINUX_AVC_STATS=y
 CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
 # CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set
 # CONFIG_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_SELINUX=y
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+# CONFIG_DEFAULT_SECURITY_DAC is not set
+CONFIG_DEFAULT_SECURITY="selinux"
 CONFIG_CRYPTO=y
 
 #
index ef5edc7203f5700a7392f48b16b6a5d2ce2623e2..79105413884e8e85a00ade7f92ec68278b8cf24f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:06 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:23:59 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -160,14 +163,41 @@ CONFIG_BLK_DEV_BSG=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -237,6 +267,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -249,8 +280,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -400,9 +429,6 @@ CONFIG_NETFILTER_ADVANCED=y
 # CONFIG_BT is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -523,6 +549,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
@@ -553,7 +583,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -658,8 +688,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -670,6 +701,7 @@ CONFIG_WLAN=y
 # CONFIG_SLIP is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -705,6 +737,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -741,6 +774,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1061,7 +1095,11 @@ CONFIG_BDI_SWITCH=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 73ef9be4128086cf5d4a2ea6c8c797433bda5112..58f7ca71a59d93be9502d58e643b4665af4fe4e7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:07 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:00 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -32,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -54,6 +55,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -81,6 +83,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -159,14 +162,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -241,6 +271,7 @@ CONFIG_8XX_MINIMAL_FPEMU=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -257,8 +288,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -372,9 +401,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -545,8 +571,7 @@ CONFIG_FS_ENET_MDIO_FEC=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -591,6 +616,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -851,6 +877,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -893,7 +920,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 CONFIG_PPC_CLOCK=y
 CONFIG_PPC_LIB_RHEAP=y
index 63c3e8de8f16f3e4de49abd43be1164b39a36e43..9a0c981277eb179b608ef97f0f0cfb7f56113226 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:08 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:01 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -86,6 +88,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -181,14 +184,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -215,6 +245,8 @@ CONFIG_LINKSTATION=y
 CONFIG_MPC10X_BRIDGE=y
 CONFIG_MPC10X_OPENPIC=y
 # CONFIG_MPC10X_STORE_GATHERING is not set
+# CONFIG_GAMECUBE is not set
+# CONFIG_WII is not set
 # CONFIG_AMIGAONE is not set
 CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_IPIC is not set
@@ -261,6 +293,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -277,8 +310,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -517,10 +548,6 @@ CONFIG_IP_NF_ARP_MANGLE=m
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-CONFIG_WIRELESS_EXT=y
-CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_LIB80211 is not set
 
 #
@@ -650,6 +677,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -661,6 +692,7 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -668,6 +700,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -720,7 +753,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -759,6 +794,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -814,15 +850,16 @@ CONFIG_PATA_IT821X=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 CONFIG_PATA_SIL680=y
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -839,7 +876,7 @@ CONFIG_PATA_SIL680=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -934,8 +971,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -960,6 +1000,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 # CONFIG_NETPOLL_TRAP is not set
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -969,6 +1010,7 @@ CONFIG_NET_POLL_CONTROLLER=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -1007,6 +1049,7 @@ CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_PCIPS2 is not set
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -1039,6 +1082,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1095,11 +1139,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1109,7 +1148,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1155,6 +1193,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1193,6 +1232,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1211,11 +1251,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1281,6 +1323,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1454,6 +1497,7 @@ CONFIG_RTC_DRV_RS5C372=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1475,7 +1519,9 @@ CONFIG_RTC_DRV_RS5C372=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1786,7 +1832,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 520b04a0def9798a2c2e5c3d3acb638682aa7010..4c2c877f93631955870cb12c56a62f752b08f52c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:09 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:02 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,7 +60,6 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
-CONFIG_HIBERNATE_32=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -168,14 +169,41 @@ CONFIG_BLK_DEV_BSG=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -208,7 +236,8 @@ CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
 CONFIG_PPC_I8259=y
 CONFIG_PPC_RTAS=y
-# CONFIG_RTAS_ERROR_LOGGING is not set
+CONFIG_RTAS_ERROR_LOGGING=y
+CONFIG_PPC_RTAS_DAEMON=y
 CONFIG_RTAS_PROC=y
 # CONFIG_MMIO_NVRAM is not set
 CONFIG_PPC_MPC106=y
@@ -250,6 +279,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -262,8 +292,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -395,9 +423,6 @@ CONFIG_NETFILTER_ADVANCED=y
 # CONFIG_BT is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -525,6 +550,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -558,7 +587,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -625,8 +654,9 @@ CONFIG_FS_ENET_MDIO_FCC=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -637,6 +667,7 @@ CONFIG_WLAN=y
 # CONFIG_SLIP is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -673,6 +704,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -733,11 +765,6 @@ CONFIG_I2C_CPM=y
 #
 # CONFIG_I2C_PARPORT_LIGHT is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -775,6 +802,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -807,11 +835,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1118,7 +1148,11 @@ CONFIG_BDI_SWITCH=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 43c3c4fcdce36c208fbeaf38fcbb01201130c0cd..9e090f2c7e36456316a0e7a60978674c1660ee20 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:10 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:03 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -32,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -53,6 +54,7 @@ CONFIG_OF=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -80,6 +82,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -162,14 +165,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -244,6 +274,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -260,8 +291,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -379,9 +408,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -497,6 +523,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
@@ -568,8 +598,7 @@ CONFIG_FS_ENET_HAS_SCC=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -614,6 +643,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -863,6 +893,7 @@ CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
@@ -887,7 +918,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
diff --git a/arch/powerpc/configs/mpc512x_defconfig b/arch/powerpc/configs/mpc512x_defconfig
new file mode 100644 (file)
index 0000000..a047272
--- /dev/null
@@ -0,0 +1,1694 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.33-rc6
+# Fri Feb  5 11:48:29 2010
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_PPC_BOOK3S_32=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_BOOK3S=y
+CONFIG_6xx=y
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC_HAVE_PMU_SUPPORT=y
+# CONFIG_SMP is not set
+CONFIG_NOT_COHERENT_CACHE=y
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
+CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=16
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+CONFIG_RD_LZO=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+# CONFIG_EMBEDDED is not set
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
+CONFIG_VM_EVENT_COUNTERS=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_SLOW_WORK is not set
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+# CONFIG_FREEZER is not set
+
+#
+# Platform support
+#
+# CONFIG_PPC_CHRP is not set
+CONFIG_PPC_MPC512x=y
+CONFIG_PPC_MPC5121=y
+CONFIG_MPC5121_ADS=y
+# CONFIG_MPC5121_GENERIC is not set
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PPC_82xx is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+# CONFIG_EMBEDDED6xx is not set
+# CONFIG_AMIGAONE is not set
+CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
+CONFIG_IPIC=y
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_QUICC_ENGINE is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_SIMPLE_GPIO is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_300 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
+# CONFIG_SCHED_HRTICK is not set
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+# CONFIG_IOMMU_HELPER is not set
+# CONFIG_SWIOTLB is not set
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_HAS_WALK_MEMORY=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+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_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_MIGRATION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_CMDLINE_BOOL is not set
+CONFIG_EXTRA_TARGETS=""
+# CONFIG_PM is not set
+# CONFIG_SECCOMP is not set
+CONFIG_ISA_DMA_API=y
+
+#
+# Bus options
+#
+CONFIG_ZONE_DMA=y
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_FSL_SOC=y
+CONFIG_PPC_PCI_CHOICE=y
+# CONFIG_PCI is not set
+# CONFIG_PCI_DOMAINS is not set
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+# CONFIG_HAS_RAPIDIO is not set
+
+#
+# Advanced setup
+#
+# CONFIG_ADVANCED_OPTIONS is not set
+
+#
+# Default settings for advanced configuration options are used
+#
+CONFIG_LOWMEM_SIZE=0x30000000
+CONFIG_PAGE_OFFSET=0xc0000000
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_PHYSICAL_START=0x00000000
+CONFIG_TASK_SIZE=0xc0000000
+CONFIG_CONSISTENT_SIZE=0x00200000
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+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=y
+# CONFIG_IP_PNP_DHCP is not set
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA 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_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+CONFIG_CAN=y
+CONFIG_CAN_RAW=y
+CONFIG_CAN_BCM=y
+
+#
+# CAN Device Drivers
+#
+CONFIG_CAN_VCAN=y
+CONFIG_CAN_DEV=y
+# CONFIG_CAN_CALC_BITTIMING is not set
+CONFIG_CAN_MSCAN=y
+# CONFIG_CAN_SJA1000 is not set
+
+#
+# CAN USB interfaces
+#
+# CONFIG_CAN_EMS_USB is not set
+CONFIG_CAN_DEBUG_DEVICES=y
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_FW_LOADER=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
+CONFIG_MTD_CONCAT=y
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_OF_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS 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_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# 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 is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_PHYSMAP_OF=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_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
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+CONFIG_MTD_NAND_IDS=y
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
+# CONFIG_MTD_NAND_FSL_ELBC is not set
+CONFIG_MTD_NAND_MPC5121_NFC=y
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTD_UBI_BEB_RESERVE=1
+# CONFIG_MTD_UBI_GLUEBI is not set
+
+#
+# UBI debugging options
+#
+# CONFIG_MTD_UBI_DEBUG is not set
+CONFIG_OF_DEVICE=y
+CONFIG_OF_I2C=y
+CONFIG_OF_MDIO=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=1
+CONFIG_BLK_DEV_RAM_SIZE=8192
+CONFIG_BLK_DEV_XIP=y
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+CONFIG_EEPROM_AT24=y
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_SCSI_PROC_FS is not set
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+# CONFIG_CHR_DEV_SCH is not set
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_MACINTOSH_DRIVERS is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+CONFIG_MARVELL_PHY=y
+CONFIG_DAVICOM_PHY=y
+CONFIG_QSEMI_PHY=y
+CONFIG_LXT_PHY=y
+CONFIG_CICADA_PHY=y
+CONFIG_VITESSE_PHY=y
+CONFIG_SMSC_PHY=y
+CONFIG_BROADCOM_PHY=y
+CONFIG_ICPLUS_PHY=y
+CONFIG_REALTEK_PHY=y
+CONFIG_NATIONAL_PHY=y
+CONFIG_STE10XP=y
+CONFIG_LSI_ET1011C_PHY=y
+CONFIG_FIXED_PHY=y
+CONFIG_MDIO_BITBANG=y
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_XILINX_EMACLITE is not set
+CONFIG_FS_ENET=y
+CONFIG_FS_ENET_MPC5121_FEC=y
+CONFIG_FS_ENET_HAS_FEC=y
+CONFIG_FS_ENET_MDIO_FEC=y
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+# CONFIG_DEVKMEM is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_UARTLITE is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_MPC52xx=y
+CONFIG_SERIAL_MPC52xx_CONSOLE=y
+CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_HVC_UDBG is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+CONFIG_I2C_MPC=y
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_TSL2550 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
+# CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_REGULATOR is not set
+CONFIG_MEDIA_SUPPORT=y
+
+#
+# Multimedia core support
+#
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_VIDEO_ALLOW_V4L1 is not set
+CONFIG_VIDEO_V4L1_COMPAT=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=y
+
+#
+# Multimedia drivers
+#
+CONFIG_IR_CORE=y
+CONFIG_VIDEO_IR=y
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_MEDIA_TUNER=y
+# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
+CONFIG_MEDIA_TUNER_SIMPLE=y
+CONFIG_MEDIA_TUNER_TDA8290=y
+CONFIG_MEDIA_TUNER_TDA9887=y
+CONFIG_MEDIA_TUNER_TEA5761=y
+CONFIG_MEDIA_TUNER_TEA5767=y
+CONFIG_MEDIA_TUNER_MT20XX=y
+CONFIG_MEDIA_TUNER_XC2028=y
+CONFIG_MEDIA_TUNER_XC5000=y
+CONFIG_MEDIA_TUNER_MC44S803=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+CONFIG_VIDEO_ADV_DEBUG=y
+# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
+# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
+CONFIG_VIDEO_IR_I2C=y
+
+#
+# Encoders/decoders and other helper chips
+#
+
+#
+# Audio decoders
+#
+# CONFIG_VIDEO_TVAUDIO is not set
+# CONFIG_VIDEO_TDA7432 is not set
+# CONFIG_VIDEO_TDA9840 is not set
+# CONFIG_VIDEO_TDA9875 is not set
+# CONFIG_VIDEO_TEA6415C is not set
+# CONFIG_VIDEO_TEA6420 is not set
+# CONFIG_VIDEO_MSP3400 is not set
+# CONFIG_VIDEO_CS5345 is not set
+# CONFIG_VIDEO_CS53L32A is not set
+# CONFIG_VIDEO_M52790 is not set
+# CONFIG_VIDEO_TLV320AIC23B is not set
+# CONFIG_VIDEO_WM8775 is not set
+# CONFIG_VIDEO_WM8739 is not set
+# CONFIG_VIDEO_VP27SMPX is not set
+
+#
+# RDS decoders
+#
+# CONFIG_VIDEO_SAA6588 is not set
+
+#
+# Video decoders
+#
+# CONFIG_VIDEO_ADV7180 is not set
+# CONFIG_VIDEO_BT819 is not set
+# CONFIG_VIDEO_BT856 is not set
+# CONFIG_VIDEO_BT866 is not set
+# CONFIG_VIDEO_KS0127 is not set
+# CONFIG_VIDEO_OV7670 is not set
+# CONFIG_VIDEO_MT9V011 is not set
+# CONFIG_VIDEO_TCM825X is not set
+# CONFIG_VIDEO_SAA7110 is not set
+CONFIG_VIDEO_SAA711X=y
+# CONFIG_VIDEO_SAA717X is not set
+# CONFIG_VIDEO_TVP514X is not set
+# CONFIG_VIDEO_TVP5150 is not set
+# CONFIG_VIDEO_VPX3220 is not set
+
+#
+# Video and audio decoders
+#
+# CONFIG_VIDEO_CX25840 is not set
+
+#
+# MPEG video encoders
+#
+# CONFIG_VIDEO_CX2341X is not set
+
+#
+# Video encoders
+#
+# CONFIG_VIDEO_SAA7127 is not set
+# CONFIG_VIDEO_SAA7185 is not set
+# CONFIG_VIDEO_ADV7170 is not set
+# CONFIG_VIDEO_ADV7175 is not set
+# CONFIG_VIDEO_THS7303 is not set
+# CONFIG_VIDEO_ADV7343 is not set
+
+#
+# Video improvement chips
+#
+# CONFIG_VIDEO_UPD64031A is not set
+# CONFIG_VIDEO_UPD64083 is not set
+# CONFIG_VIDEO_VIVI is not set
+# CONFIG_VIDEO_SAA5246A is not set
+# CONFIG_VIDEO_SAA5249 is not set
+# CONFIG_SOC_CAMERA is not set
+CONFIG_V4L_USB_DRIVERS=y
+# CONFIG_USB_VIDEO_CLASS is not set
+CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
+CONFIG_USB_GSPCA=m
+# CONFIG_USB_M5602 is not set
+# CONFIG_USB_STV06XX is not set
+# CONFIG_USB_GL860 is not set
+# CONFIG_USB_GSPCA_CONEX is not set
+# CONFIG_USB_GSPCA_ETOMS is not set
+# CONFIG_USB_GSPCA_FINEPIX is not set
+# CONFIG_USB_GSPCA_JEILINJ is not set
+# CONFIG_USB_GSPCA_MARS is not set
+# CONFIG_USB_GSPCA_MR97310A is not set
+# CONFIG_USB_GSPCA_OV519 is not set
+# CONFIG_USB_GSPCA_OV534 is not set
+# CONFIG_USB_GSPCA_PAC207 is not set
+# CONFIG_USB_GSPCA_PAC7302 is not set
+# CONFIG_USB_GSPCA_PAC7311 is not set
+# CONFIG_USB_GSPCA_SN9C20X is not set
+# CONFIG_USB_GSPCA_SONIXB is not set
+# CONFIG_USB_GSPCA_SONIXJ is not set
+# CONFIG_USB_GSPCA_SPCA500 is not set
+# CONFIG_USB_GSPCA_SPCA501 is not set
+# CONFIG_USB_GSPCA_SPCA505 is not set
+# CONFIG_USB_GSPCA_SPCA506 is not set
+# CONFIG_USB_GSPCA_SPCA508 is not set
+# CONFIG_USB_GSPCA_SPCA561 is not set
+# CONFIG_USB_GSPCA_SQ905 is not set
+# CONFIG_USB_GSPCA_SQ905C is not set
+# CONFIG_USB_GSPCA_STK014 is not set
+# CONFIG_USB_GSPCA_STV0680 is not set
+# CONFIG_USB_GSPCA_SUNPLUS is not set
+# CONFIG_USB_GSPCA_T613 is not set
+# CONFIG_USB_GSPCA_TV8532 is not set
+# CONFIG_USB_GSPCA_VC032X is not set
+# CONFIG_USB_GSPCA_ZC3XX is not set
+# CONFIG_VIDEO_PVRUSB2 is not set
+# CONFIG_VIDEO_HDPVR is not set
+# CONFIG_VIDEO_EM28XX is not set
+# CONFIG_VIDEO_CX231XX is not set
+# CONFIG_VIDEO_USBVISION is not set
+# CONFIG_USB_ET61X251 is not set
+# CONFIG_USB_SN9C102 is not set
+# CONFIG_USB_ZC0301 is not set
+CONFIG_USB_PWC_INPUT_EVDEV=y
+# CONFIG_USB_ZR364XX is not set
+# CONFIG_USB_STKWEBCAM is not set
+# CONFIG_USB_S2255 is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_I2C_SI4713 is not set
+# CONFIG_RADIO_SI4713 is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_RADIO_SI470X is not set
+# CONFIG_USB_MR800 is not set
+# CONFIG_RADIO_TEA5764 is not set
+# CONFIG_RADIO_TEF6862 is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_OF is not set
+# CONFIG_FB_VGA16 is not set
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_FSL_DIU=y
+# CONFIG_FB_IBM_GXT4500 is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+# CONFIG_LOGO is not set
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+CONFIG_HID_A4TECH=y
+CONFIG_HID_APPLE=y
+CONFIG_HID_BELKIN=y
+CONFIG_HID_CHERRY=y
+CONFIG_HID_CHICONY=y
+CONFIG_HID_CYPRESS=y
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+CONFIG_HID_EZKEY=y
+CONFIG_HID_KYE=y
+CONFIG_HID_GYRATION=y
+CONFIG_HID_TWINHAN=y
+CONFIG_HID_KENSINGTON=y
+CONFIG_HID_LOGITECH=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+CONFIG_HID_MICROSOFT=y
+CONFIG_HID_MONTEREY=y
+CONFIG_HID_NTRIG=y
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+CONFIG_HID_PETALYNX=y
+CONFIG_HID_SAMSUNG=y
+CONFIG_HID_SONY=y
+CONFIG_HID_SUNPLUS=y
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+CONFIG_HID_SMARTJOYPLUS=y
+# CONFIG_SMARTJOYPLUS_FF is not set
+CONFIG_HID_TOPSEED=y
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
+CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y
+# CONFIG_XPS_USB_HCD_XILINX is not set
+CONFIG_USB_EHCI_FSL=y
+CONFIG_USB_EHCI_HCD_PPC_OF=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+# 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_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_ALAUDA is not set
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_EDAC is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+CONFIG_RTC_DRV_M41T80=y
+# CONFIG_RTC_DRV_M41T80_WDT is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+
+#
+# SPI RTC drivers
+#
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_GENERIC is not set
+CONFIG_RTC_DRV_MPC5121=y
+CONFIG_DMADEVICES=y
+
+#
+# DMA Devices
+#
+# CONFIG_FSL_DMA is not set
+CONFIG_MPC512X_DMA=y
+CONFIG_DMA_ENGINE=y
+
+#
+# DMA Clients
+#
+# CONFIG_NET_DMA is not set
+# CONFIG_ASYNC_TX_DMA is not set
+# CONFIG_DMATEST is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT2_FS_XIP=y
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_FS_XIP=y
+CONFIG_JBD=y
+CONFIG_FS_MBCACHE=y
+# 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_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY is not set
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE 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 is not set
+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_PROC_KCORE is not set
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# 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_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_XATTR is not set
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_FS_DEBUG is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+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
+# 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
+
+#
+# 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_KARMA_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+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 is not set
+# CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DECOMPRESS_LZO=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACING_SUPPORT=y
+# CONFIG_FTRACE is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
+CONFIG_PRINT_STACK_DEPTH=64
+# CONFIG_IRQSTACKS is not set
+# CONFIG_BOOTX_TEXT is not set
+# CONFIG_PPC_EARLY_DEBUG is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MANAGER2 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+CONFIG_CRYPTO_LZO=y
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set
+CONFIG_PPC_CLOCK=y
+CONFIG_PPC_LIB_RHEAP=y
+# CONFIG_VIRTUALIZATION is not set
index 523d5fe18c0edd8259593f046de55f4ec0123257..61cf73d0000fdc04cdb7e22cc7fecb93e4ccf8c3 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc4
-# Thu Oct 15 10:33:21 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Dec 30 15:08:52 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -87,6 +89,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -170,14 +173,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 CONFIG_FREEZER=y
 
 #
@@ -193,6 +223,7 @@ CONFIG_PPC_LITE5200=y
 CONFIG_PPC_MEDIA5200=y
 CONFIG_PPC_MPC5200_BUGFIX=y
 CONFIG_PPC_MPC5200_GPIO=y
+CONFIG_PPC_MPC5200_LPBFIFO=m
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -211,6 +242,7 @@ CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_PPC_I8259 is not set
 CONFIG_PPC_RTAS=y
 # CONFIG_RTAS_ERROR_LOGGING is not set
+# CONFIG_PPC_RTAS_DAEMON is not set
 CONFIG_RTAS_PROC=y
 # CONFIG_MMIO_NVRAM is not set
 # CONFIG_PPC_MPC106 is not set
@@ -223,6 +255,7 @@ CONFIG_RTAS_PROC=y
 CONFIG_PPC_BESTCOMM=y
 CONFIG_PPC_BESTCOMM_ATA=y
 CONFIG_PPC_BESTCOMM_FEC=y
+CONFIG_PPC_BESTCOMM_GEN_BD=m
 CONFIG_SIMPLE_GPIO=y
 
 #
@@ -253,6 +286,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -269,8 +303,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -286,6 +318,7 @@ CONFIG_PM=y
 CONFIG_PM_SLEEP=y
 CONFIG_SUSPEND=y
 CONFIG_SUSPEND_FREEZER=y
+# CONFIG_HIBERNATION is not set
 # CONFIG_PM_RUNTIME is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
@@ -399,7 +432,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -530,6 +569,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -541,6 +584,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -548,6 +592,8 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -600,7 +646,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -639,6 +687,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -694,15 +743,16 @@ CONFIG_PATA_MPC52xx=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 CONFIG_PATA_PLATFORM=y
@@ -785,8 +835,11 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -809,6 +862,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -818,6 +872,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -874,6 +929,7 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -933,11 +989,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -947,7 +998,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -962,7 +1012,10 @@ CONFIG_SPI_MASTER=y
 #
 # CONFIG_SPI_BITBANG is not set
 # CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_MPC52xx is not set
 CONFIG_SPI_MPC52xx_PSC=m
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
 
 #
 # SPI Protocol Masters
@@ -995,6 +1048,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1042,6 +1096,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1083,6 +1138,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1122,6 +1178,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
@@ -1129,6 +1186,8 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_MC13783 is not set
 # CONFIG_AB3100_CORE is not set
 # CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1322,7 +1381,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_R8A66597_HCD is not set
 # CONFIG_USB_WHCI_HCD is not set
 # CONFIG_USB_HWA_HCD is not set
-# CONFIG_USB_MUSB_HDRC is not set
 
 #
 # USB Device Class drivers
@@ -1440,6 +1498,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1469,7 +1528,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1731,6 +1792,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1774,7 +1836,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index d8b364a4594463f19a1ff2722ef7314ed1a10fa4..1315b775a6d2c2439131da713c5d4742f80ba294 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:10 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:04 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -167,14 +170,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -199,6 +229,8 @@ CONFIG_MPC7448HPC2=y
 # CONFIG_PPC_PRPMC2800 is not set
 # CONFIG_PPC_C2K is not set
 CONFIG_TSI108_BRIDGE=y
+# CONFIG_GAMECUBE is not set
+# CONFIG_WII is not set
 # CONFIG_AMIGAONE is not set
 CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_IPIC is not set
@@ -244,6 +276,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -260,8 +293,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -385,9 +416,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -424,6 +452,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -487,7 +519,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -526,6 +560,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -580,15 +615,16 @@ CONFIG_SATA_MV=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -605,7 +641,7 @@ CONFIG_SATA_MV=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -731,8 +767,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -746,6 +784,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -755,6 +794,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -806,6 +846,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1091,7 +1132,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1118,7 +1159,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 00fad81b6fce7eb1755c282dd2dc8a1967c35e2a..9073778d35751ce10803860f0e3616c1bb58e2ea 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:11 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:05 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -161,14 +164,41 @@ CONFIG_BLK_DEV_BSG=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -240,6 +270,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -252,8 +283,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -403,9 +432,6 @@ CONFIG_NETFILTER_ADVANCED=y
 # CONFIG_BT is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -526,6 +552,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
@@ -556,7 +586,7 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -661,8 +691,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -679,6 +710,7 @@ CONFIG_PPP_DEFLATE=y
 CONFIG_SLHC=y
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -688,6 +720,7 @@ CONFIG_SLHC=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -740,6 +773,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -763,6 +797,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -799,6 +834,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1131,7 +1167,11 @@ CONFIG_BDI_SWITCH=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 64dff21516cbe95cc13e6070b1b9ace23bc1e8e5..05bec4835687100a88885871b68f420d254f8ae5 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:12 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:06 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -37,6 +37,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,7 @@ CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
 CONFIG_REDBOOT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
@@ -89,6 +91,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -176,14 +179,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -266,6 +296,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -282,8 +313,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -413,9 +442,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -548,6 +574,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -559,6 +589,7 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -566,6 +597,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -618,7 +650,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -657,6 +691,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -712,15 +747,16 @@ CONFIG_ATA_SFF=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -737,7 +773,7 @@ CONFIG_ATA_SFF=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -844,8 +880,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -868,6 +907,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -877,6 +917,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -929,6 +970,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 # CONFIG_SERIAL_QE is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -988,11 +1030,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1002,7 +1039,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1034,6 +1070,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1076,6 +1113,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1115,6 +1153,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -1153,11 +1192,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1249,6 +1290,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1542,7 +1584,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1569,7 +1611,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index a12e7ba87a4341be51e3325ecd3710b84e107fb5..8f35f8049c9268f3d74c8fb649f83548c369d0e8 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:25:20 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:06 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -39,6 +39,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -62,6 +63,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -92,6 +95,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -184,14 +188,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC_MSI_BITMAP=y
 
@@ -201,7 +232,7 @@ CONFIG_PPC_MSI_BITMAP=y
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 CONFIG_MPC8540_ADS=y
 CONFIG_MPC8560_ADS=y
 CONFIG_MPC85xx_CDS=y
@@ -220,6 +251,7 @@ CONFIG_TQM8555=y
 CONFIG_TQM8560=y
 CONFIG_SBC8548=y
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -267,6 +299,7 @@ CONFIG_SWIOTLB=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -283,8 +316,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -405,6 +436,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -449,9 +481,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -494,6 +523,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -505,6 +538,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -512,6 +546,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -565,7 +600,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -604,6 +641,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -659,15 +697,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -684,7 +723,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -795,8 +834,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -820,6 +862,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -829,6 +872,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -858,6 +902,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -896,6 +941,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 CONFIG_SERIAL_QE=m
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -955,11 +1001,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -969,7 +1010,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1002,6 +1042,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1035,11 +1076,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1114,6 +1157,7 @@ CONFIG_SND_PCI=y
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS5530 is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1241,6 +1285,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1347,7 +1392,6 @@ CONFIG_EDAC=y
 #
 # CONFIG_EDAC_DEBUG is not set
 CONFIG_EDAC_MM_EDAC=y
-CONFIG_EDAC_MPC85XX=y
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -1376,6 +1420,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1397,7 +1442,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1731,7 +1778,11 @@ CONFIG_VIRQ_DEBUG=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index cd70b4a4ce0145d6cff83280ddb8d50e23fea393..8755ea3c7f5fbc82a1b93c1508686eec1062e5e9 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:26:01 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:07 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -16,9 +16,9 @@ CONFIG_PPC_85xx=y
 # CONFIG_E200 is not set
 CONFIG_E500=y
 # CONFIG_PPC_E500MC is not set
+CONFIG_FSL_EMB_PERFMON=y
 CONFIG_BOOKE=y
 CONFIG_FSL_BOOKE=y
-CONFIG_FSL_EMB_PERFMON=y
 # CONFIG_PHYS_64BIT is not set
 CONFIG_SPE=y
 CONFIG_PPC_MMU_NOHASH=y
@@ -40,6 +40,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -63,6 +64,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -93,6 +96,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -187,14 +191,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 CONFIG_PPC_MSI_BITMAP=y
 
@@ -204,7 +235,7 @@ CONFIG_PPC_MSI_BITMAP=y
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
-CONFIG_MPC85xx=y
+CONFIG_FSL_SOC_BOOKE=y
 CONFIG_MPC8540_ADS=y
 CONFIG_MPC8560_ADS=y
 CONFIG_MPC85xx_CDS=y
@@ -223,6 +254,7 @@ CONFIG_TQM8555=y
 CONFIG_TQM8560=y
 CONFIG_SBC8548=y
 # CONFIG_SBC8560 is not set
+# CONFIG_P4080_DS is not set
 CONFIG_TQM85xx=y
 # CONFIG_IPIC is not set
 CONFIG_MPIC=y
@@ -271,6 +303,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_IRQ_ALL_CPUS is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -287,8 +320,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -409,6 +440,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -453,9 +485,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -498,6 +527,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -509,6 +542,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -516,6 +550,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -569,7 +604,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -608,6 +645,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -663,15 +701,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -688,7 +727,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -799,8 +838,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -824,6 +866,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -833,6 +876,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -862,6 +906,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -900,6 +945,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
 CONFIG_SERIAL_QE=m
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -959,11 +1005,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -973,7 +1014,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1006,6 +1046,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1039,11 +1080,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1118,6 +1161,7 @@ CONFIG_SND_PCI=y
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS5530 is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1245,6 +1289,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1351,7 +1396,6 @@ CONFIG_EDAC=y
 #
 # CONFIG_EDAC_DEBUG is not set
 CONFIG_EDAC_MM_EDAC=y
-CONFIG_EDAC_MPC85XX=y
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -1380,6 +1424,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1401,7 +1446,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1735,7 +1782,11 @@ CONFIG_VIRQ_DEBUG=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 40d6f0568ca5d8f92ae5fe9b7c6f8bba94b718e9..3f6b11b6f4f395d12efb90a961063eac68628d80 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:15 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:08 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -32,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -53,6 +54,7 @@ CONFIG_OF=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -80,6 +82,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -158,14 +161,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -240,6 +270,7 @@ CONFIG_MATH_EMULATION=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -256,8 +287,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -375,9 +404,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -407,6 +433,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_RAM is not set
 # CONFIG_CDROM_PKTCDVD is not set
@@ -485,8 +515,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_MV643XX_ETH is not set
 CONFIG_NETDEV_10000=y
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -506,6 +535,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -554,6 +584,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -576,6 +607,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -855,6 +887,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
@@ -876,7 +909,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 5b3abb42ae30238ec2ff3df5292cd5f97e513985..41884c97a4f36fadd8d0bb69adf1dac67cb1df3a 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:16 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:09 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -61,6 +62,8 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -91,6 +94,7 @@ CONFIG_AUDIT=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -183,14 +187,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -221,7 +252,7 @@ CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
 CONFIG_PPC_I8259=y
 # CONFIG_PPC_RTAS is not set
-# CONFIG_MMIO_NVRAM is not set
+CONFIG_MMIO_NVRAM=y
 # CONFIG_PPC_MPC106 is not set
 # CONFIG_PPC_970_NAP is not set
 # CONFIG_PPC_INDIRECT_IO is not set
@@ -262,6 +293,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 # CONFIG_IRQ_ALL_CPUS is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -278,8 +310,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -397,6 +427,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -441,9 +472,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_FIB_RULES=y
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -486,6 +514,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -497,6 +529,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -504,6 +537,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -557,7 +591,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -596,6 +632,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -651,15 +688,16 @@ CONFIG_PATA_ALI=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -676,7 +714,7 @@ CONFIG_PATA_ALI=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -781,8 +819,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -805,6 +846,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -814,6 +856,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -843,6 +886,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -879,6 +923,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -935,11 +980,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -949,7 +989,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -982,6 +1021,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -1015,11 +1055,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1094,6 +1136,7 @@ CONFIG_SND_PCI=y
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS5530 is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1221,6 +1264,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1348,6 +1392,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1369,7 +1414,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1684,7 +1731,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index 1da3488a603d1d33f4181f5a48069b1d4166ca72..6b9e6bd2c98d4a7bcf306aac773ee5fee2a9a22e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:17 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:10 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -32,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -54,6 +55,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -81,6 +83,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -159,14 +162,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
 CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
 CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -248,6 +278,7 @@ CONFIG_8XX_MINIMAL_FPEMU=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -264,8 +295,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -379,9 +408,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -556,8 +582,7 @@ CONFIG_FS_ENET_MDIO_FEC=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -602,6 +627,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -862,6 +888,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -904,7 +931,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 # CONFIG_CRYPTO is not set
 CONFIG_PPC_CLOCK=y
 CONFIG_PPC_LIB_RHEAP=y
index 326205cabf77be142313abec36ae947909060e9e..35b60683cde5570c314b33360113f1617e369e7a 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Fri Jan 23 08:44:03 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 13:54:06 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 CONFIG_40x=y
@@ -16,6 +16,7 @@ CONFIG_40x=y
 # CONFIG_E200 is not set
 CONFIG_4xx=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -27,15 +28,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_GPIO=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
@@ -50,11 +54,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
-# CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_DTC=y
+CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -68,9 +76,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -85,31 +105,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -121,6 +150,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -132,8 +169,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -141,19 +177,41 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -168,12 +226,14 @@ CONFIG_XILINX_VIRTEX=y
 CONFIG_ACADIA=y
 CONFIG_EP405=y
 CONFIG_HCU4=y
+CONFIG_HOTFOOT=y
 CONFIG_KILAUEA=y
 CONFIG_MAKALU=y
 CONFIG_WALNUT=y
 CONFIG_XILINX_VIRTEX_GENERIC_BOARD=y
 CONFIG_PPC40x_SIMPLE=y
 CONFIG_405GP=y
+CONFIG_405EP=y
 CONFIG_405EX=y
 CONFIG_405EZ=y
 CONFIG_405GPR=y
@@ -195,6 +255,7 @@ CONFIG_IBM405_ERR51=y
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_OF_RTC=y
 # CONFIG_SIMPLE_GPIO is not set
+# CONFIG_XILINX_PCI is not set
 
 #
 # Kernel options
@@ -218,10 +279,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_MATH_EMULATION is not set
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -237,10 +300,12 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -265,6 +330,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -282,14 +348,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -341,6 +405,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -349,6 +414,7 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -362,6 +428,8 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -374,13 +442,13 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
-# CONFIG_MAC80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -393,6 +461,7 @@ CONFIG_WIRELESS_OLD_REGULATORY=y
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -405,9 +474,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_OF_PARTS=y
@@ -483,7 +552,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -491,7 +559,7 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_UBI=m
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 CONFIG_MTD_UBI_BEB_RESERVE=1
-CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_MTD_UBI_GLUEBI=m
 
 #
 # UBI debugging options
@@ -509,6 +577,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -520,14 +589,25 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 CONFIG_XILINX_SYSACE=m
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -547,7 +627,11 @@ CONFIG_HAVE_IDE=y
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -568,6 +652,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -586,7 +672,10 @@ CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT=y
 CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR=y
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -594,6 +683,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -604,9 +694,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -616,6 +710,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -625,14 +720,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -645,6 +739,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -663,6 +758,7 @@ CONFIG_SERIO=m
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_RAW is not set
 CONFIG_SERIO_XILINX_XPS_PS2=m
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -697,6 +793,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -714,6 +811,7 @@ CONFIG_XILINX_HWICAP=m
 CONFIG_DEVPORT=y
 CONFIG_I2C=m
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=m
 CONFIG_I2C_HELPER_AUTO=y
 CONFIG_I2C_ALGOBIT=m
@@ -755,11 +853,6 @@ CONFIG_I2C_IBM_IIC=m
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -769,20 +862,17 @@ CONFIG_I2C_IBM_IIC=m
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_MAX6875 is not set
 # CONFIG_SENSORS_TSL2550 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
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -804,11 +894,17 @@ CONFIG_GPIO_XILINX=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
+# CONFIG_GPIO_LANGWELL is not set
 
 #
 # SPI GPIO expanders:
 #
+
+#
+# AC97 GPIO expanders:
+#
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
@@ -832,28 +928,15 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -909,6 +992,7 @@ CONFIG_FB_XILINX=m
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_FB_METRONOME is not set
 # CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
@@ -930,7 +1014,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 # CONFIG_USB_GADGET is not set
 
@@ -946,7 +1030,12 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -956,6 +1045,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
 # CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=m
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
 # CONFIG_EXT3_FS_SECURITY is not set
@@ -966,11 +1056,13 @@ CONFIG_FS_MBCACHE=m
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -979,6 +1071,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -1053,7 +1150,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1108,6 +1204,7 @@ CONFIG_NLS_ISO8859_1=m
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -1125,11 +1222,13 @@ CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_LZO_COMPRESS=m
 CONFIG_LZO_DECOMPRESS=m
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -1139,6 +1238,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1147,16 +1247,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1168,35 +1275,45 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_PPC_EMULATED_STATS is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1212,13 +1329,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -1227,10 +1347,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -1258,11 +1380,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1299,6 +1423,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_ZLIB is not set
 CONFIG_CRYPTO_LZO=m
 
 #
@@ -1307,5 +1432,6 @@ CONFIG_CRYPTO_LZO=m
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
+# CONFIG_CRYPTO_DEV_PPC4XX is not set
 # CONFIG_PPC_CLOCK is not set
 # CONFIG_VIRTUALIZATION is not set
index 5e6d55f006bb511d6b9b4caa00937fc8ad9504c6..46f5c47e9f8512287db8d4aecc02c59aee9690da 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29-rc2
-# Fri Jan 23 08:43:46 2009
+# Linux kernel version: 2.6.33-rc1
+# Mon Jan  4 13:42:17 2010
 #
 # CONFIG_PPC64 is not set
 
 #
 # Processor support
 #
-# CONFIG_6xx is not set
+# CONFIG_PPC_BOOK3S_32 is not set
 # CONFIG_PPC_85xx is not set
 # CONFIG_PPC_8xx is not set
 # CONFIG_40x is not set
@@ -20,6 +20,7 @@ CONFIG_BOOKE=y
 CONFIG_PTE_64BIT=y
 CONFIG_PHYS_64BIT=y
 CONFIG_PPC_MMU_NOHASH=y
+CONFIG_PPC_MMU_NOHASH_32=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
@@ -31,15 +32,18 @@ CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_GPIO=y
 # CONFIG_ARCH_NO_VIRT_TO_BUS is not set
@@ -54,11 +58,15 @@ CONFIG_PPC_UDBG_16550=y
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
-# CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_DTC=y
+CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_PPC_DCR_NATIVE=y
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_PPC_DCR=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
 
 #
 # General setup
@@ -72,9 +80,21 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_GROUP_SCHED=y
@@ -89,31 +109,40 @@ CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
 CONFIG_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_STRIP_GENERATED=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
@@ -125,6 +154,13 @@ CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_SLOW_WORK is not set
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -136,8 +172,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_BLOCK=y
-CONFIG_LBD=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_LBDAF=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -145,20 +180,42 @@ CONFIG_LBD=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
 CONFIG_PREEMPT_NOTIFIERS=y
-CONFIG_CLASSIC_RCU=y
-# CONFIG_TREE_RCU is not set
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
 
@@ -179,8 +236,11 @@ CONFIG_WARP=y
 CONFIG_ARCHES=y
 CONFIG_CANYONLANDS=y
 CONFIG_GLACIER=y
+CONFIG_REDWOOD=y
+CONFIG_EIGER=y
 CONFIG_YOSEMITE=y
 CONFIG_XILINX_VIRTEX440_GENERIC_BOARD=y
+# CONFIG_XILINX_ML510 is not set
 CONFIG_PPC44x_SIMPLE=y
 CONFIG_PPC4xx_GPIO=y
 CONFIG_440EP=y
@@ -190,6 +250,7 @@ CONFIG_440GP=y
 CONFIG_440GX=y
 CONFIG_440SPe=y
 CONFIG_460EX=y
+CONFIG_460SX=y
 CONFIG_IBM440EP_ERR42=y
 CONFIG_XILINX_VIRTEX=y
 CONFIG_XILINX_VIRTEX_5_FXT=y
@@ -207,6 +268,7 @@ CONFIG_XILINX_VIRTEX_5_FXT=y
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_OF_RTC=y
 # CONFIG_SIMPLE_GPIO is not set
+# CONFIG_XILINX_PCI is not set
 
 #
 # Kernel options
@@ -230,10 +292,12 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_MATH_EMULATION=y
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_PPC_NEED_DMA_SYNC_OPS=y
+# CONFIG_SWIOTLB is not set
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -249,10 +313,13 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_UNEVICTABLE_LRU=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_STDBINUTILS=y
 CONFIG_PPC_4K_PAGES=y
 # CONFIG_PPC_16K_PAGES is not set
 # CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -276,6 +343,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -293,14 +361,12 @@ CONFIG_PAGE_OFFSET=0xc0000000
 CONFIG_KERNEL_START=0xc0000000
 CONFIG_PHYSICAL_START=0x00000000
 CONFIG_TASK_SIZE=0xc0000000
-CONFIG_CONSISTENT_START=0xff100000
 CONFIG_CONSISTENT_SIZE=0x00200000
 CONFIG_NET=y
 
 #
 # Networking options
 #
-CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -352,6 +418,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -360,6 +427,7 @@ CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 CONFIG_STP=m
@@ -375,6 +443,8 @@ CONFIG_LLC=m
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
 # CONFIG_NET_SCHED is not set
 # CONFIG_DCB is not set
 
@@ -387,8 +457,13 @@ CONFIG_LLC=m
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-# CONFIG_PHONET is not set
-# CONFIG_WIRELESS is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
 # CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
@@ -401,6 +476,7 @@ CONFIG_LLC=m
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -413,9 +489,9 @@ CONFIG_CONNECTOR=y
 CONFIG_PROC_EVENTS=y
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
 CONFIG_MTD_OF_PARTS=y
@@ -490,7 +566,6 @@ CONFIG_MTD_PHYSMAP_OF=y
 # LPDDR flash memory drivers
 #
 # CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_QINFO_PROBE is not set
 
 #
 # UBI - Unsorted block images
@@ -498,7 +573,7 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_UBI=m
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 CONFIG_MTD_UBI_BEB_RESERVE=1
-CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_MTD_UBI_GLUEBI=m
 
 #
 # UBI debugging options
@@ -516,6 +591,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -528,14 +604,25 @@ CONFIG_BLK_DEV_RAM_SIZE=35000
 CONFIG_XILINX_SYSACE=m
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -558,10 +645,6 @@ CONFIG_BLK_DEV_SD=m
 # CONFIG_BLK_DEV_SR is not set
 # CONFIG_CHR_DEV_SG is not set
 # CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
 # CONFIG_SCSI_MULTI_LUN is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
@@ -578,6 +661,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SRP_ATTRS is not set
 # CONFIG_SCSI_LOWLEVEL is not set
 # CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 # CONFIG_FUSION is not set
@@ -587,7 +671,11 @@ CONFIG_SCSI_WAIT_SCAN=m
 #
 
 #
-# Enable only one of the two stacks, unless you know what you are doing
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# See the help texts for more information.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -608,6 +696,8 @@ CONFIG_NET_ETHERNET=y
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_IBM_NEW_EMAC=y
@@ -626,7 +716,10 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
 # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
+# CONFIG_XILINX_EMACLITE is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
@@ -634,6 +727,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_E1000E is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
+# CONFIG_IGBVF is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -644,9 +738,13 @@ CONFIG_NETDEV_1000=y
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
+# CONFIG_CNIC is not set
+# CONFIG_MV643XX_ETH is not set
+# CONFIG_XILINX_LL_TEMAC is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
 # CONFIG_ATL1E is not set
+# CONFIG_ATL1C is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
@@ -656,6 +754,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
+# CONFIG_VXGE is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_NIU is not set
@@ -665,14 +764,14 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
 # CONFIG_SFC is not set
+# CONFIG_BE2NET is not set
 # CONFIG_TR is not set
-
-#
-# Wireless LAN
-#
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
+CONFIG_WLAN=y
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -695,6 +794,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -713,6 +813,7 @@ CONFIG_SERIO=m
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_RAW is not set
 CONFIG_SERIO_XILINX_XPS_PS2=m
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -747,6 +848,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -764,6 +866,7 @@ CONFIG_XILINX_HWICAP=m
 CONFIG_DEVPORT=y
 CONFIG_I2C=m
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 CONFIG_I2C_CHARDEV=m
 CONFIG_I2C_HELPER_AUTO=y
 CONFIG_I2C_ALGOBIT=m
@@ -806,11 +909,6 @@ CONFIG_I2C_IBM_IIC=m
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -820,20 +918,17 @@ CONFIG_I2C_IBM_IIC=m
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_MAX6875 is not set
 # CONFIG_SENSORS_TSL2550 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
 # CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
@@ -855,16 +950,21 @@ CONFIG_GPIO_XILINX=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
+# CONFIG_GPIO_LANGWELL is not set
 
 #
 # SPI GPIO expanders:
 #
+
+#
+# AC97 GPIO expanders:
+#
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -884,28 +984,15 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
 # CONFIG_REGULATOR is not set
-
-#
-# Multimedia devices
-#
-
-#
-# Multimedia core support
-#
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
-# CONFIG_DAB is not set
+# CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
 # CONFIG_AGP is not set
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -961,6 +1048,7 @@ CONFIG_FB_XILINX=m
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_FB_METRONOME is not set
 # CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
@@ -994,19 +1082,22 @@ CONFIG_USB_DEVICE_CLASS=y
 # USB Host Controller Drivers
 #
 # CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
 CONFIG_USB_EHCI_HCD=m
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
 CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_OHCI_HCD_PPC_OF=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set
+CONFIG_USB_OHCI_HCD_PPC_OF=y
 # CONFIG_USB_OHCI_HCD_PCI is not set
 CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y
 CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
@@ -1030,11 +1121,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
 #
 
 #
-# see USB_STORAGE Help for more information
+# also be needed; see USB_STORAGE Help for more info
 #
 CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_DEBUG is not set
@@ -1075,7 +1166,6 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGET is not set
 # CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_FTDI_ELAN is not set
 # CONFIG_USB_APPLEDISPLAY is not set
@@ -1083,6 +1173,7 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
@@ -1091,6 +1182,7 @@ CONFIG_USB_STORAGE=m
 # OTG and related infrastructure
 #
 # CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_NOP_USB_XCEIV is not set
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -1100,7 +1192,12 @@ CONFIG_USB_STORAGE=m
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
 # CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
 # CONFIG_STAGING is not set
 
 #
@@ -1110,6 +1207,7 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
 # CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=m
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
 # CONFIG_EXT3_FS_SECURITY is not set
@@ -1119,11 +1217,13 @@ CONFIG_FS_MBCACHE=m
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1132,6 +1232,11 @@ CONFIG_INOTIFY_USER=y
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
 
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
 #
 # CD-ROM/DVD Filesystems
 #
@@ -1206,7 +1311,6 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1261,6 +1365,7 @@ CONFIG_NLS_ISO8859_1=m
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
+# CONFIG_BINARY_PRINTF is not set
 
 #
 # Library routines
@@ -1278,11 +1383,13 @@ CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_LZO_COMPRESS=m
 CONFIG_LZO_DECOMPRESS=m
-CONFIG_PLIST=y
+CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
 CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
 
 #
 # Kernel hacking
@@ -1292,6 +1399,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
@@ -1300,16 +1408,23 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1321,35 +1436,43 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
 # CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-
-#
-# Tracers
-#
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
 # CONFIG_BOOT_TRACER is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
 # CONFIG_STACK_TRACER is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DMA_API_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
 CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
 # CONFIG_MSI_BITMAP_SELFTEST is not set
@@ -1363,13 +1486,16 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
 # Crypto core or helper
 #
-# CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_ALGAPI2=y
 CONFIG_CRYPTO_AEAD2=y
@@ -1378,10 +1504,12 @@ CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
 # CONFIG_CRYPTO_CRYPTD is not set
 # CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_TEST is not set
@@ -1409,11 +1537,13 @@ CONFIG_CRYPTO_PCBC=y
 #
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
 
 #
 # Digest
 #
 # CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1450,6 +1580,7 @@ CONFIG_CRYPTO_DES=y
 # Compression
 #
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_ZLIB is not set
 CONFIG_CRYPTO_LZO=m
 
 #
index 7b3804a6e363e10806b0a5fac0c72bc77c77cefc..b5b2599607948f20489555f19bb59de8cde696eb 100644 (file)
@@ -137,8 +137,9 @@ CONFIG_TRACEPOINTS=y
 CONFIG_MARKERS=y
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
-# CONFIG_KPROBES is not set
+CONFIG_KPROBES=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_KRETPROBES=y
 CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
@@ -191,6 +192,7 @@ CONFIG_SCANLOG=m
 CONFIG_LPARCFG=y
 CONFIG_PPC_SMLPAR=y
 CONFIG_CMM=y
+CONFIG_DTL=y
 CONFIG_PPC_ISERIES=y
 
 #
@@ -328,9 +330,10 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 CONFIG_KEXEC=y
 # CONFIG_PHYP_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
-# CONFIG_NUMA is not set
+CONFIG_NUMA=y
+CONFIG_NODES_SHIFT=8
+CONFIG_MAX_ACTIVE_REGIONS=256
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
-CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -339,6 +342,7 @@ CONFIG_SELECT_MEMORY_MODEL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
 CONFIG_SPARSEMEM_MANUAL=y
 CONFIG_SPARSEMEM=y
+CONFIG_NEED_MULTIPLE_NODES=y
 CONFIG_HAVE_MEMORY_PRESENT=y
 CONFIG_SPARSEMEM_EXTREME=y
 CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
@@ -354,11 +358,12 @@ CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_NODES_SPAN_OTHER_NODES=y
 CONFIG_ARCH_MEMORY_PROBE=y
 CONFIG_PPC_HAS_HASH_64K=y
 # CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=13
-# CONFIG_SCHED_SMT is not set
+CONFIG_SCHED_SMT=y
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
 CONFIG_EXTRA_TARGETS=""
@@ -790,12 +795,12 @@ CONFIG_SCSI_IPR=y
 CONFIG_SCSI_IPR_TRACE=y
 CONFIG_SCSI_IPR_DUMP=y
 # CONFIG_SCSI_QLOGIC_1280 is not set
-# CONFIG_SCSI_QLA_FC is not set
+CONFIG_SCSI_QLA_FC=m
 # CONFIG_SCSI_QLA_ISCSI is not set
 CONFIG_SCSI_LPFC=m
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-CONFIG_SCSI_DEBUG=m
+# CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
 # CONFIG_SCSI_DH is not set
@@ -867,9 +872,8 @@ CONFIG_MD_AUTODETECT=y
 CONFIG_MD_LINEAR=y
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
-CONFIG_MD_RAID10=y
-CONFIG_MD_RAID456=y
-CONFIG_MD_RAID5_RESHAPE=y
+CONFIG_MD_RAID10=m
+CONFIG_MD_RAID456=m
 CONFIG_MD_MULTIPATH=m
 CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
@@ -984,7 +988,7 @@ CONFIG_ACENIC=m
 CONFIG_ACENIC_OMIT_TIGON_I=y
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
-# CONFIG_E1000E is not set
+CONFIG_E1000E=m
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
@@ -1006,19 +1010,19 @@ CONFIG_GELIC_WIRELESS=y
 # CONFIG_ATL1E is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
-# CONFIG_CHELSIO_T1 is not set
-# CONFIG_CHELSIO_T3 is not set
+CONFIG_CHELSIO_T1=m
+CONFIG_CHELSIO_T3=m
 CONFIG_EHEA=m
 # CONFIG_ENIC is not set
-# CONFIG_IXGBE is not set
+CONFIG_IXGBE=m
 CONFIG_IXGB=m
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-# CONFIG_NETXEN_NIC is not set
+CONFIG_S2IO=m
+CONFIG_MYRI10GE=m
+CONFIG_NETXEN_NIC=m
 # CONFIG_NIU is not set
 CONFIG_PASEMI_MAC=y
-# CONFIG_MLX4_EN is not set
-# CONFIG_MLX4_CORE is not set
+CONFIG_MLX4_EN=m
+CONFIG_MLX4_CORE=m
 # CONFIG_TEHUTI is not set
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
@@ -1169,7 +1173,7 @@ CONFIG_SERIAL_TXX9=y
 CONFIG_HAS_TXX9_SERIAL=y
 CONFIG_SERIAL_TXX9_NR_UARTS=6
 CONFIG_SERIAL_TXX9_CONSOLE=y
-# CONFIG_SERIAL_JSM is not set
+CONFIG_SERIAL_JSM=m
 # CONFIG_SERIAL_OF_PLATFORM is not set
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
@@ -1586,7 +1590,7 @@ CONFIG_USB_DEVICEFS=y
 CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
-# CONFIG_USB_MON is not set
+CONFIG_USB_MON=m
 # CONFIG_USB_WUSB is not set
 # CONFIG_USB_WUSB_CBAF is not set
 
@@ -1686,21 +1690,22 @@ CONFIG_USB_APPLEDISPLAY=m
 # CONFIG_NEW_LEDS is not set
 # CONFIG_ACCESSIBILITY is not set
 CONFIG_INFINIBAND=m
-# CONFIG_INFINIBAND_USER_MAD is not set
-# CONFIG_INFINIBAND_USER_ACCESS is not set
+CONFIG_INFINIBAND_USER_MAD=m
+CONFIG_INFINIBAND_USER_ACCESS=m
+CONFIG_INFINIBAND_USER_MEM=y
 CONFIG_INFINIBAND_ADDR_TRANS=y
 CONFIG_INFINIBAND_MTHCA=m
 CONFIG_INFINIBAND_MTHCA_DEBUG=y
-# CONFIG_INFINIBAND_IPATH is not set
+CONFIG_INFINIBAND_IPATH=m
 CONFIG_INFINIBAND_EHCA=m
 # CONFIG_INFINIBAND_AMSO1100 is not set
-# CONFIG_MLX4_INFINIBAND is not set
+CONFIG_MLX4_INFINIBAND=m
 # CONFIG_INFINIBAND_NES is not set
 CONFIG_INFINIBAND_IPOIB=m
-# CONFIG_INFINIBAND_IPOIB_CM is not set
+CONFIG_INFINIBAND_IPOIB_CM=y
 CONFIG_INFINIBAND_IPOIB_DEBUG=y
 # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
-# CONFIG_INFINIBAND_SRP is not set
+CONFIG_INFINIBAND_SRP=m
 CONFIG_INFINIBAND_ISER=m
 CONFIG_EDAC=y
 
@@ -1798,7 +1803,7 @@ CONFIG_REISERFS_FS=y
 CONFIG_REISERFS_FS_XATTR=y
 CONFIG_REISERFS_FS_POSIX_ACL=y
 CONFIG_REISERFS_FS_SECURITY=y
-CONFIG_JFS_FS=y
+CONFIG_JFS_FS=m
 CONFIG_JFS_POSIX_ACL=y
 CONFIG_JFS_SECURITY=y
 # CONFIG_JFS_DEBUG is not set
@@ -1811,14 +1816,22 @@ CONFIG_XFS_POSIX_ACL=y
 # CONFIG_XFS_RT is not set
 # CONFIG_XFS_DEBUG is not set
 # CONFIG_GFS2_FS is not set
-# CONFIG_OCFS2_FS is not set
+CONFIG_OCFS2_FS=m
+CONFIG_OCFS2_FS_O2CB=m
+CONFIG_OCFS2_FS_STATS=y
+CONFIG_OCFS2_DEBUG_MASKLOG=y
+# CONFIG_OCFS2_DEBUG_FS is not set
+# CONFIG_OCFS2_COMPAT_JBD is not set
+CONFIG_BTRFS_FS=m
+CONFIG_BTRFS_FS_POSIX_ACL=y
+CONFIG_NILFS2_FS=m
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
 # CONFIG_AUTOFS_FS is not set
 CONFIG_AUTOFS4_FS=m
-# CONFIG_FUSE_FS is not set
+CONFIG_FUSE_FS=m
 
 #
 # CD-ROM/DVD Filesystems
@@ -1851,7 +1864,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
-# CONFIG_CONFIGFS_FS is not set
+CONFIG_CONFIGFS_FS=m
 
 #
 # Miscellaneous filesystems
@@ -2075,7 +2088,7 @@ CONFIG_XMON=y
 CONFIG_XMON_DISASSEMBLY=y
 CONFIG_DEBUGGER=y
 CONFIG_IRQSTACKS=y
-# CONFIG_VIRQ_DEBUG is not set
+CONFIG_VIRQ_DEBUG=y
 CONFIG_BOOTX_TEXT=y
 # CONFIG_PPC_EARLY_DEBUG is not set
 
index b7911216af781f5bc90eac6695ab9e0461cb70f1..5d06f2cb8e5e074dbcdaa1c617c1368ce0a916d8 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:17 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:11 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -59,6 +60,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -165,14 +168,41 @@ CONFIG_BLK_DEV_BSG=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -243,6 +273,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -255,8 +286,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -407,9 +436,6 @@ CONFIG_NETFILTER_ADVANCED=y
 # CONFIG_BT is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -530,6 +556,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
@@ -616,7 +646,7 @@ CONFIG_IDE_PROC_FS=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -721,8 +751,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -739,6 +770,7 @@ CONFIG_PPP_DEFLATE=y
 CONFIG_SLHC=y
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -748,6 +780,7 @@ CONFIG_SLHC=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -802,6 +835,7 @@ CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 # CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -825,6 +859,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_CPM=y
 CONFIG_SERIAL_CPM_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -861,6 +896,7 @@ CONFIG_GPIOLIB=y
 #
 # PCI GPIO expanders:
 #
+# CONFIG_GPIO_CS5535 is not set
 # CONFIG_GPIO_BT8XX is not set
 # CONFIG_GPIO_LANGWELL is not set
 
@@ -955,10 +991,12 @@ CONFIG_USB_ETH_RNDIS=y
 # CONFIG_USB_ETH_EEM is not set
 # CONFIG_USB_GADGETFS is not set
 # CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
 # CONFIG_USB_G_SERIAL is not set
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
 # CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_MULTI is not set
 
 #
 # OTG and related infrastructure
@@ -1248,7 +1286,11 @@ CONFIG_BDI_SWITCH=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index ef50ce45d50bc9123ec72d5ad668751ee62d8966..57ab5748a34d7e0b33611e98c135e07f67654dcf 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:18 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:12 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -38,6 +38,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -60,6 +61,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -88,6 +90,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -175,14 +178,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
 # CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -207,6 +237,8 @@ CONFIG_EMBEDDED6xx=y
 CONFIG_PPC_PRPMC2800=y
 # CONFIG_PPC_C2K is not set
 CONFIG_MV64X60=y
+# CONFIG_GAMECUBE is not set
+# CONFIG_WII is not set
 # CONFIG_AMIGAONE is not set
 CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_IPIC is not set
@@ -252,6 +284,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -268,8 +301,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -394,9 +425,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -518,6 +546,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -529,6 +561,7 @@ CONFIG_BLK_DEV_RAM_SIZE=131072
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -536,6 +569,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -641,7 +675,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -680,6 +716,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -734,15 +771,16 @@ CONFIG_SATA_MV=y
 # CONFIG_PATA_NS87415 is not set
 # CONFIG_PATA_OPTI is not set
 # CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_PDC_OLD is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RDC is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
 # CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
 # CONFIG_PATA_SIL680 is not set
 # CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
@@ -759,7 +797,7 @@ CONFIG_SATA_MV=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -886,8 +924,11 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_BE2NET is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -910,6 +951,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -919,6 +961,7 @@ CONFIG_WLAN=y
 CONFIG_INPUT=y
 CONFIG_INPUT_FF_MEMLESS=y
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -973,6 +1016,7 @@ CONFIG_SERIAL_MPSC_CONSOLE=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -1029,11 +1073,6 @@ CONFIG_I2C_MV64XXX=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -1042,7 +1081,6 @@ CONFIG_I2C_MV64XXX=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -1088,6 +1126,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -1126,6 +1165,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1144,11 +1184,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -1250,6 +1292,7 @@ CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
@@ -1362,6 +1405,7 @@ CONFIG_RTC_DRV_MAX6900=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1383,7 +1427,9 @@ CONFIG_RTC_DRV_MAX6900=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1626,7 +1672,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index ca9ff9aad74a882a3de122f2ad2bffad17f4df88..41de3ddc9f24f39855ea5e1cfcc688124d25fbc3 100644 (file)
@@ -159,7 +159,7 @@ CONFIG_MODULE_SRCVERSION_ALL=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_BLOCK=y
-# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_BLK_DEV_IO_TRACE=y
 CONFIG_BLK_DEV_BSG=y
 # CONFIG_BLK_DEV_INTEGRITY is not set
 CONFIG_BLOCK_COMPAT=y
@@ -191,6 +191,7 @@ CONFIG_SCANLOG=m
 CONFIG_LPARCFG=y
 CONFIG_PPC_SMLPAR=y
 CONFIG_CMM=y
+CONFIG_DTL=y
 # CONFIG_PPC_ISERIES is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_MAPLE is not set
@@ -255,7 +256,8 @@ CONFIG_KEXEC=y
 # CONFIG_PHYP_DUMP is not set
 CONFIG_IRQ_ALL_CPUS=y
 CONFIG_NUMA=y
-CONFIG_NODES_SHIFT=4
+CONFIG_NODES_SHIFT=8
+CONFIG_MAX_ACTIVE_REGIONS=256
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
@@ -270,7 +272,9 @@ CONFIG_HAVE_MEMORY_PRESENT=y
 CONFIG_SPARSEMEM_EXTREME=y
 CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
 CONFIG_SPARSEMEM_VMEMMAP=y
-# CONFIG_MEMORY_HOTPLUG is not set
+CONFIG_MEMORY_HOTPLUG=y
+CONFIG_MEMORY_HOTPLUG_SPARSE=y
+CONFIG_MEMORY_HOTREMOVE=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
@@ -705,7 +709,7 @@ CONFIG_MD_LINEAR=y
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
 CONFIG_MD_RAID10=m
-# CONFIG_MD_RAID456 is not set
+CONFIG_MD_RAID456=m
 CONFIG_MD_MULTIPATH=m
 CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
@@ -800,7 +804,7 @@ CONFIG_ACENIC=m
 CONFIG_ACENIC_OMIT_TIGON_I=y
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
-# CONFIG_E1000E is not set
+CONFIG_E1000E=m
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
@@ -818,18 +822,18 @@ CONFIG_TIGON3=y
 # CONFIG_ATL1E is not set
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
-# CONFIG_CHELSIO_T1 is not set
-# CONFIG_CHELSIO_T3 is not set
+CONFIG_CHELSIO_T1=m
+CONFIG_CHELSIO_T3=m
 CONFIG_EHEA=y
 # CONFIG_ENIC is not set
-# CONFIG_IXGBE is not set
+CONFIG_IXGBE=m
 CONFIG_IXGB=m
 CONFIG_S2IO=m
-# CONFIG_MYRI10GE is not set
-# CONFIG_NETXEN_NIC is not set
+CONFIG_MYRI10GE=m
+CONFIG_NETXEN_NIC=m
 # CONFIG_NIU is not set
-# CONFIG_MLX4_EN is not set
-# CONFIG_MLX4_CORE is not set
+CONFIG_MLX4_EN=m
+CONFIG_MLX4_CORE=m
 # CONFIG_TEHUTI is not set
 # CONFIG_BNX2X is not set
 # CONFIG_QLGE is not set
@@ -894,7 +898,7 @@ CONFIG_INPUT_MOUSEDEV=y
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_EVDEV is not set
+CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_EVBUG is not set
 
 #
@@ -1271,7 +1275,7 @@ CONFIG_USB_DEVICEFS=y
 CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
-CONFIG_USB_MON=y
+CONFIG_USB_MON=m
 # CONFIG_USB_WUSB is not set
 # CONFIG_USB_WUSB_CBAF is not set
 
@@ -1311,7 +1315,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 #
 # may also be needed; see USB_STORAGE Help for more information
 #
-CONFIG_USB_STORAGE=y
+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
@@ -1322,7 +1326,7 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_SDDR55 is not set
 # CONFIG_USB_STORAGE_JUMPSHOT is not set
 # CONFIG_USB_STORAGE_ALAUDA is not set
-CONFIG_USB_STORAGE_ONETOUCH=y
+# CONFIG_USB_STORAGE_ONETOUCH is not set
 # CONFIG_USB_STORAGE_KARMA is not set
 # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
 # CONFIG_USB_LIBUSUAL is not set
@@ -1377,17 +1381,17 @@ CONFIG_INFINIBAND_USER_MEM=y
 CONFIG_INFINIBAND_ADDR_TRANS=y
 CONFIG_INFINIBAND_MTHCA=m
 CONFIG_INFINIBAND_MTHCA_DEBUG=y
-# CONFIG_INFINIBAND_IPATH is not set
+CONFIG_INFINIBAND_IPATH=m
 CONFIG_INFINIBAND_EHCA=m
 # CONFIG_INFINIBAND_AMSO1100 is not set
-# CONFIG_MLX4_INFINIBAND is not set
+CONFIG_MLX4_INFINIBAND=m
 # CONFIG_INFINIBAND_NES is not set
 CONFIG_INFINIBAND_IPOIB=m
-# CONFIG_INFINIBAND_IPOIB_CM is not set
+CONFIG_INFINIBAND_IPOIB_CM=y
 CONFIG_INFINIBAND_IPOIB_DEBUG=y
 # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
 CONFIG_INFINIBAND_SRP=m
-# CONFIG_INFINIBAND_ISER is not set
+CONFIG_INFINIBAND_ISER=m
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
@@ -1443,6 +1447,9 @@ CONFIG_OCFS2_FS_STATS=y
 CONFIG_OCFS2_DEBUG_MASKLOG=y
 # CONFIG_OCFS2_DEBUG_FS is not set
 # CONFIG_OCFS2_COMPAT_JBD is not set
+CONFIG_BTRFS_FS=m
+CONFIG_BTRFS_FS_POSIX_ACL=y
+CONFIG_NILFS2_FS=m
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1455,8 +1462,8 @@ CONFIG_FUSE_FS=m
 # CD-ROM/DVD Filesystems
 #
 CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
 CONFIG_UDF_FS=m
 CONFIG_UDF_NLS=y
 
@@ -1508,14 +1515,14 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFS_V3_ACL=y
 CONFIG_NFS_V4=y
-CONFIG_NFSD=y
+CONFIG_NFSD=m
 CONFIG_NFSD_V2_ACL=y
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V3_ACL=y
 CONFIG_NFSD_V4=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=y
+CONFIG_EXPORTFS=m
 CONFIG_NFS_ACL_SUPPORT=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
@@ -1681,12 +1688,12 @@ CONFIG_DYNAMIC_PRINTK_DEBUG=y
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
 CONFIG_DEBUG_STACKOVERFLOW=y
-# CONFIG_DEBUG_STACK_USAGE is not set
+CONFIG_DEBUG_STACK_USAGE=y
 # CONFIG_DEBUG_PAGEALLOC is not set
 # CONFIG_HCALL_STATS is not set
-# CONFIG_CODE_PATCHING_SELFTEST is not set
-# CONFIG_FTR_FIXUP_SELFTEST is not set
-# CONFIG_MSI_BITMAP_SELFTEST is not set
+CONFIG_CODE_PATCHING_SELFTEST=y
+CONFIG_FTR_FIXUP_SELFTEST=y
+CONFIG_MSI_BITMAP_SELFTEST=y
 CONFIG_XMON=y
 CONFIG_XMON_DEFAULT=y
 CONFIG_XMON_DISASSEMBLY=y
index 524263158fc00bc017ae2fb10282951897350225..f2f832161463266198abd8e2ae19debb08280bc6 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.32-rc5
-# Thu Nov  5 08:20:19 2009
+# Linux kernel version: 2.6.33-rc3
+# Wed Jan  6 09:24:13 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -36,6 +36,7 @@ CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
 # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
 CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -58,6 +59,7 @@ CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DTC=y
 # CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -85,6 +87,7 @@ CONFIG_SYSVIPC_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -167,14 +170,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -201,6 +231,8 @@ CONFIG_STORCENTER=y
 CONFIG_MPC10X_BRIDGE=y
 CONFIG_MPC10X_OPENPIC=y
 # CONFIG_MPC10X_STORE_GATHERING is not set
+# CONFIG_GAMECUBE is not set
+# CONFIG_WII is not set
 # CONFIG_AMIGAONE is not set
 CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
 # CONFIG_IPIC is not set
@@ -246,6 +278,7 @@ CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SPARSE_IRQ=y
 CONFIG_MAX_ACTIVE_REGIONS=32
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
@@ -262,8 +295,6 @@ CONFIG_MIGRATION=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
 # CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_PPC_4K_PAGES=y
@@ -384,9 +415,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -507,6 +535,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -515,6 +547,7 @@ CONFIG_BLK_DEV=y
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -522,6 +555,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -628,7 +662,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_BNX2_ISCSI is not set
 # CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -666,6 +702,7 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
 # CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
@@ -695,7 +732,7 @@ CONFIG_MD_RAID6_PQ=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -741,8 +778,11 @@ CONFIG_R8169=y
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 CONFIG_WLAN=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+# CONFIG_AIRO is not set
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -765,6 +805,7 @@ CONFIG_WLAN=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -805,6 +846,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 # CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -861,11 +903,6 @@ CONFIG_I2C_MPC=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -875,7 +912,6 @@ CONFIG_I2C_MPC=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -910,11 +946,13 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
@@ -963,6 +1001,7 @@ CONFIG_USB_DEVICE_CLASS=y
 CONFIG_USB_EHCI_HCD=y
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_XPS_USB_HCD_XILINX is not set
 # CONFIG_USB_EHCI_FSL is not set
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 # CONFIG_USB_OXU210HP_HCD is not set
@@ -1087,6 +1126,7 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1108,7 +1148,9 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1322,7 +1364,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SLUB_DEBUG_ON is not set
 # CONFIG_SLUB_STATS is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
@@ -1349,7 +1391,11 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_XOR_BLOCKS=y
 CONFIG_ASYNC_CORE=y
 CONFIG_ASYNC_MEMCPY=y
index 8f0fe797194992829dd5926ef2d80605415e5059..c1b475a941eb9d08a272f6b378cfdfa7d14cdf9c 100644 (file)
@@ -2,6 +2,7 @@
 #define _ASM_POWERPC_ASM_COMPAT_H
 
 #include <asm/types.h>
+#include <asm/ppc-opcode.h>
 
 #ifdef __ASSEMBLY__
 #  define stringify_in_c(...)  __VA_ARGS__
@@ -24,7 +25,7 @@
 #define PPC_LONG       stringify_in_c(.llong)
 #define PPC_LONG_ALIGN stringify_in_c(.balign 8)
 #define PPC_TLNEI      stringify_in_c(tdnei)
-#define PPC_LLARX      stringify_in_c(ldarx)
+#define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
 #define PPC_STLCX      stringify_in_c(stdcx.)
 #define PPC_CNTLZL     stringify_in_c(cntlzd)
 
@@ -46,7 +47,7 @@
 #define PPC_LONG       stringify_in_c(.long)
 #define PPC_LONG_ALIGN stringify_in_c(.balign 4)
 #define PPC_TLNEI      stringify_in_c(twnei)
-#define PPC_LLARX      stringify_in_c(lwarx)
+#define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
 #define PPC_STLCX      stringify_in_c(stwcx.)
 #define PPC_CNTLZL     stringify_in_c(cntlzw)
 #define PPC_MTOCRF     stringify_in_c(mtcrf)
index 4012483b1899d32a84097bbbdb543c80f025f0d0..b8f152ece02572be5a15acb75ec5ac312d9ec0d9 100644 (file)
@@ -49,13 +49,13 @@ static __inline__ int atomic_add_return(int a, atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%2         # atomic_add_return\n\
        add     %0,%1,%0\n"
        PPC405_ERR77(0,%2)
 "      stwcx.  %0,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (a), "r" (&v->counter)
        : "cc", "memory");
@@ -85,13 +85,13 @@ static __inline__ int atomic_sub_return(int a, atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%2         # atomic_sub_return\n\
        subf    %0,%1,%0\n"
        PPC405_ERR77(0,%2)
 "      stwcx.  %0,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (a), "r" (&v->counter)
        : "cc", "memory");
@@ -119,13 +119,13 @@ static __inline__ int atomic_inc_return(atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%1         # atomic_inc_return\n\
        addic   %0,%0,1\n"
        PPC405_ERR77(0,%1)
 "      stwcx.  %0,0,%1 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (&v->counter)
        : "cc", "xer", "memory");
@@ -163,13 +163,13 @@ static __inline__ int atomic_dec_return(atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%1         # atomic_dec_return\n\
        addic   %0,%0,-1\n"
        PPC405_ERR77(0,%1)
 "      stwcx.  %0,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (&v->counter)
        : "cc", "xer", "memory");
@@ -194,7 +194,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
        int t;
 
        __asm__ __volatile__ (
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%1         # atomic_add_unless\n\
        cmpw    0,%0,%3 \n\
        beq-    2f \n\
@@ -202,7 +202,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
        PPC405_ERR77(0,%2)
 "      stwcx.  %0,0,%1 \n\
        bne-    1b \n"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
 "      subf    %0,%2,%0 \n\
 2:"
        : "=&r" (t)
@@ -227,7 +227,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%1         # atomic_dec_if_positive\n\
        cmpwi   %0,1\n\
        addi    %0,%0,-1\n\
@@ -235,7 +235,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
        PPC405_ERR77(0,%1)
 "      stwcx.  %0,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        "\n\
 2:"    : "=&b" (t)
        : "r" (&v->counter)
@@ -286,12 +286,12 @@ static __inline__ long atomic64_add_return(long a, atomic64_t *v)
        long t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%2         # atomic64_add_return\n\
        add     %0,%1,%0\n\
        stdcx.  %0,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (a), "r" (&v->counter)
        : "cc", "memory");
@@ -320,12 +320,12 @@ static __inline__ long atomic64_sub_return(long a, atomic64_t *v)
        long t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%2         # atomic64_sub_return\n\
        subf    %0,%1,%0\n\
        stdcx.  %0,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (a), "r" (&v->counter)
        : "cc", "memory");
@@ -352,12 +352,12 @@ static __inline__ long atomic64_inc_return(atomic64_t *v)
        long t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%1         # atomic64_inc_return\n\
        addic   %0,%0,1\n\
        stdcx.  %0,0,%1 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (&v->counter)
        : "cc", "xer", "memory");
@@ -394,12 +394,12 @@ static __inline__ long atomic64_dec_return(atomic64_t *v)
        long t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%1         # atomic64_dec_return\n\
        addic   %0,%0,-1\n\
        stdcx.  %0,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (&v->counter)
        : "cc", "xer", "memory");
@@ -419,13 +419,13 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
        long t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%1         # atomic64_dec_if_positive\n\
        addic.  %0,%0,-1\n\
        blt-    2f\n\
        stdcx.  %0,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        "\n\
 2:"    : "=&r" (t)
        : "r" (&v->counter)
@@ -451,14 +451,14 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
        long t;
 
        __asm__ __volatile__ (
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%1         # atomic_add_unless\n\
        cmpd    0,%0,%3 \n\
        beq-    2f \n\
        add     %0,%2,%0 \n"
 "      stdcx.  %0,0,%1 \n\
        bne-    1b \n"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
 "      subf    %0,%2,%0 \n\
 2:"
        : "=&r" (t)
index 56f2f2ea56319fc13897e5a94647ae54f6fc5cd3..30964ae2d096a9c754407d7fd33a6e96ab9c9692 100644 (file)
@@ -65,7 +65,7 @@ static __inline__ void fn(unsigned long mask, \
        unsigned long *p = (unsigned long *)_p; \
        __asm__ __volatile__ (                  \
        prefix                                  \
-"1:"   PPC_LLARX "%0,0,%3\n"                   \
+"1:"   PPC_LLARX(%0,0,%3,0) "\n"               \
        stringify_in_c(op) "%0,%0,%2\n"         \
        PPC405_ERR77(0,%3)                      \
        PPC_STLCX "%0,0,%3\n"                   \
@@ -78,7 +78,7 @@ static __inline__ void fn(unsigned long mask, \
 
 DEFINE_BITOP(set_bits, or, "", "")
 DEFINE_BITOP(clear_bits, andc, "", "")
-DEFINE_BITOP(clear_bits_unlock, andc, LWSYNC_ON_SMP, "")
+DEFINE_BITOP(clear_bits_unlock, andc, PPC_RELEASE_BARRIER, "")
 DEFINE_BITOP(change_bits, xor, "", "")
 
 static __inline__ void set_bit(int nr, volatile unsigned long *addr)
@@ -103,31 +103,35 @@ static __inline__ void change_bit(int nr, volatile unsigned long *addr)
 
 /* Like DEFINE_BITOP(), with changes to the arguments to 'op' and the output
  * operands. */
-#define DEFINE_TESTOP(fn, op, prefix, postfix) \
-static __inline__ unsigned long fn(            \
-               unsigned long mask,             \
-               volatile unsigned long *_p)     \
-{                                              \
-       unsigned long old, t;                   \
-       unsigned long *p = (unsigned long *)_p; \
-       __asm__ __volatile__ (                  \
-       prefix                                  \
-"1:"   PPC_LLARX "%0,0,%3\n"                   \
-       stringify_in_c(op) "%1,%0,%2\n"         \
-       PPC405_ERR77(0,%3)                      \
-       PPC_STLCX "%1,0,%3\n"                   \
-       "bne- 1b\n"                             \
-       postfix                                 \
-       : "=&r" (old), "=&r" (t)                \
-       : "r" (mask), "r" (p)                   \
-       : "cc", "memory");                      \
-       return (old & mask);                    \
+#define DEFINE_TESTOP(fn, op, prefix, postfix, eh)     \
+static __inline__ unsigned long fn(                    \
+               unsigned long mask,                     \
+               volatile unsigned long *_p)             \
+{                                                      \
+       unsigned long old, t;                           \
+       unsigned long *p = (unsigned long *)_p;         \
+       __asm__ __volatile__ (                          \
+       prefix                                          \
+"1:"   PPC_LLARX(%0,0,%3,eh) "\n"                      \
+       stringify_in_c(op) "%1,%0,%2\n"                 \
+       PPC405_ERR77(0,%3)                              \
+       PPC_STLCX "%1,0,%3\n"                           \
+       "bne- 1b\n"                                     \
+       postfix                                         \
+       : "=&r" (old), "=&r" (t)                        \
+       : "r" (mask), "r" (p)                           \
+       : "cc", "memory");                              \
+       return (old & mask);                            \
 }
 
-DEFINE_TESTOP(test_and_set_bits, or, LWSYNC_ON_SMP, ISYNC_ON_SMP)
-DEFINE_TESTOP(test_and_set_bits_lock, or, "", ISYNC_ON_SMP)
-DEFINE_TESTOP(test_and_clear_bits, andc, LWSYNC_ON_SMP, ISYNC_ON_SMP)
-DEFINE_TESTOP(test_and_change_bits, xor, LWSYNC_ON_SMP, ISYNC_ON_SMP)
+DEFINE_TESTOP(test_and_set_bits, or, PPC_RELEASE_BARRIER,
+             PPC_ACQUIRE_BARRIER, 0)
+DEFINE_TESTOP(test_and_set_bits_lock, or, "",
+             PPC_ACQUIRE_BARRIER, 1)
+DEFINE_TESTOP(test_and_clear_bits, andc, PPC_RELEASE_BARRIER,
+             PPC_ACQUIRE_BARRIER, 0)
+DEFINE_TESTOP(test_and_change_bits, xor, PPC_RELEASE_BARRIER,
+             PPC_ACQUIRE_BARRIER, 0)
 
 static __inline__ int test_and_set_bit(unsigned long nr,
                                       volatile unsigned long *addr)
@@ -158,7 +162,7 @@ static __inline__ int test_and_change_bit(unsigned long nr,
 
 static __inline__ void __clear_bit_unlock(int nr, volatile unsigned long *addr)
 {
-       __asm__ __volatile__(LWSYNC_ON_SMP "" ::: "memory");
+       __asm__ __volatile__(PPC_RELEASE_BARRIER "" ::: "memory");
        __clear_bit(nr, addr);
 }
 
index 80f315e8a421b2f0bde0bb6cc9d931c7fb5d5372..abb833b0e58f71951acd570397990e72b5bc2722 100644 (file)
@@ -381,9 +381,9 @@ extern const char *powerpc_base_platform;
 #define CPU_FTRS_GENERIC_32    (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
 
 /* 64-bit CPUs */
-#define CPU_FTRS_POWER3        (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
+#define CPU_FTRS_POWER3        (CPU_FTR_USE_TB | \
            CPU_FTR_IABR | CPU_FTR_PPC_LE)
-#define CPU_FTRS_RS64  (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
+#define CPU_FTRS_RS64  (CPU_FTR_USE_TB | \
            CPU_FTR_IABR | \
            CPU_FTR_MMCRA | CPU_FTR_CTRL)
 #define CPU_FTRS_POWER4        (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
index fa19f3fe05ff95cf8a6b9e4e89c2d4d7dcbd7c57..8bdc6a9e57733109eb75ec47d664cd37be22e94f 100644 (file)
@@ -73,10 +73,9 @@ static inline unsigned long cputime_to_jiffies(const cputime_t ct)
 static inline cputime_t cputime_to_scaled(const cputime_t ct)
 {
        if (cpu_has_feature(CPU_FTR_SPURR) &&
-           per_cpu(cputime_last_delta, smp_processor_id()))
-               return ct *
-                       per_cpu(cputime_scaled_last_delta, smp_processor_id())/
-                       per_cpu(cputime_last_delta, smp_processor_id());
+           __get_cpu_var(cputime_last_delta))
+               return ct * __get_cpu_var(cputime_scaled_last_delta) /
+                           __get_cpu_var(cputime_last_delta);
        return ct;
 }
 
index 17828ad411ebbecdb920a1cbdd8ee44886b669af..c376eda153139673bc879e8b5489470db7a00e99 100644 (file)
@@ -235,14 +235,10 @@ typedef elf_vrregset_t elf_fpxregset_t;
 #ifdef __powerpc64__
 # define SET_PERSONALITY(ex)                                   \
 do {                                                           \
-       unsigned long new_flags = 0;                            \
        if ((ex).e_ident[EI_CLASS] == ELFCLASS32)               \
-               new_flags = _TIF_32BIT;                         \
-       if ((current_thread_info()->flags & _TIF_32BIT)         \
-           != new_flags)                                       \
-               set_thread_flag(TIF_ABI_PENDING);               \
+               set_thread_flag(TIF_32BIT);                     \
        else                                                    \
-               clear_thread_flag(TIF_ABI_PENDING);             \
+               clear_thread_flag(TIF_32BIT);                   \
        if (personality(current->personality) != PER_LINUX32)   \
                set_personality(PER_LINUX |                     \
                        (current->personality & (~PER_MASK)));  \
index cbd4dfa4bce2e7dc6c5343a310c028757e8cfa86..96a7d067fbb260ce03f0d03a8163a3d755d4c08a 100644 (file)
@@ -165,7 +165,7 @@ label##2:                                           \
        .pushsection sect,"a";                          \
        .align 2;                                       \
 label##3:                                              \
-       .long label##1b-label##3b;                      \
+       FTR_ENTRY_OFFSET label##1b-label##3b;           \
        .popsection;
 
 #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
index 9696cc36d2dcf50ae3cb33784cf2a2362edf942a..7c589ef81fb0eec42eee5f17cfbfc25563bb66fa 100644 (file)
@@ -11,7 +11,7 @@
 
 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
   __asm__ __volatile ( \
-       LWSYNC_ON_SMP \
+       PPC_RELEASE_BARRIER \
 "1:    lwarx   %0,0,%2\n" \
        insn \
        PPC405_ERR77(0, %2) \
@@ -90,14 +90,14 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
                return -EFAULT;
 
         __asm__ __volatile__ (
-        LWSYNC_ON_SMP
+        PPC_RELEASE_BARRIER
 "1:     lwarx   %0,0,%2         # futex_atomic_cmpxchg_inatomic\n\
         cmpw    0,%0,%3\n\
         bne-    3f\n"
         PPC405_ERR77(0,%2)
 "2:     stwcx.  %4,0,%2\n\
         bne-    1b\n"
-        ISYNC_ON_SMP
+        PPC_ACQUIRE_BARRIER
 "3:    .section .fixup,\"ax\"\n\
 4:     li      %0,%5\n\
        b       3b\n\
index fb3c05a0cbbf11e48551550270d354b0e0eb7dc1..3147a29701254eb882bbd1995f03b862e2e6c4e1 100644 (file)
@@ -1 +1,29 @@
-#include <asm-generic/hardirq.h>
+#ifndef _ASM_POWERPC_HARDIRQ_H
+#define _ASM_POWERPC_HARDIRQ_H
+
+#include <linux/threads.h>
+#include <linux/irq.h>
+
+typedef struct {
+       unsigned int __softirq_pending;
+       unsigned int timer_irqs;
+       unsigned int pmu_irqs;
+       unsigned int mce_exceptions;
+       unsigned int spurious_irqs;
+} ____cacheline_aligned irq_cpustat_t;
+
+DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
+
+#define __ARCH_IRQ_STAT
+
+#define local_softirq_pending()        __get_cpu_var(irq_stat).__softirq_pending
+
+static inline void ack_bad_irq(unsigned int irq)
+{
+       printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
+}
+
+extern u64 arch_irq_stat_cpu(unsigned int cpu);
+#define arch_irq_stat_cpu      arch_irq_stat_cpu
+
+#endif /* _ASM_POWERPC_HARDIRQ_H */
index 84b457a3c1bcda476a0c475d2bddf594a134e9bc..ce58c80e1bcf0f4cb153c18de99135686e4f3d04 100644 (file)
@@ -24,7 +24,7 @@ static __inline__ long local_add_return(long a, local_t *l)
        long t;
 
        __asm__ __volatile__(
-"1:"   PPC_LLARX       "%0,0,%2                # local_add_return\n\
+"1:"   PPC_LLARX(%0,0,%2,0) "                  # local_add_return\n\
        add     %0,%1,%0\n"
        PPC405_ERR77(0,%2)
        PPC_STLCX       "%0,0,%2 \n\
@@ -43,7 +43,7 @@ static __inline__ long local_sub_return(long a, local_t *l)
        long t;
 
        __asm__ __volatile__(
-"1:"   PPC_LLARX       "%0,0,%2                # local_sub_return\n\
+"1:"   PPC_LLARX(%0,0,%2,0) "                  # local_sub_return\n\
        subf    %0,%1,%0\n"
        PPC405_ERR77(0,%2)
        PPC_STLCX       "%0,0,%2 \n\
@@ -60,7 +60,7 @@ static __inline__ long local_inc_return(local_t *l)
        long t;
 
        __asm__ __volatile__(
-"1:"   PPC_LLARX       "%0,0,%1                # local_inc_return\n\
+"1:"   PPC_LLARX(%0,0,%1,0) "                  # local_inc_return\n\
        addic   %0,%0,1\n"
        PPC405_ERR77(0,%1)
        PPC_STLCX       "%0,0,%1 \n\
@@ -87,7 +87,7 @@ static __inline__ long local_dec_return(local_t *l)
        long t;
 
        __asm__ __volatile__(
-"1:"   PPC_LLARX       "%0,0,%1                # local_dec_return\n\
+"1:"   PPC_LLARX(%0,0,%1,0) "                  # local_dec_return\n\
        addic   %0,%0,-1\n"
        PPC405_ERR77(0,%1)
        PPC_STLCX       "%0,0,%1\n\
@@ -117,7 +117,7 @@ static __inline__ int local_add_unless(local_t *l, long a, long u)
        long t;
 
        __asm__ __volatile__ (
-"1:"   PPC_LLARX       "%0,0,%1                # local_add_unless\n\
+"1:"   PPC_LLARX(%0,0,%1,0) "                  # local_add_unless\n\
        cmpw    0,%0,%3 \n\
        beq-    2f \n\
        add     %0,%2,%0 \n"
@@ -147,7 +147,7 @@ static __inline__ long local_dec_if_positive(local_t *l)
        long t;
 
        __asm__ __volatile__(
-"1:"   PPC_LLARX       "%0,0,%1                # local_dec_if_positive\n\
+"1:"   PPC_LLARX(%0,0,%1,0) "                  # local_dec_if_positive\n\
        cmpwi   %0,1\n\
        addi    %0,%0,-1\n\
        blt-    2f\n"
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
new file mode 100644 (file)
index 0000000..e6a30bb
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * MPC5121 Prototypes and definitions
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.
+ */
+
+#ifndef __ASM_POWERPC_MPC5121_H__
+#define __ASM_POWERPC_MPC5121_H__
+
+/* MPC512x Reset module registers */
+struct mpc512x_reset_module {
+       u32     rcwlr;  /* Reset Configuration Word Low Register */
+       u32     rcwhr;  /* Reset Configuration Word High Register */
+       u32     reserved1;
+       u32     reserved2;
+       u32     rsr;    /* Reset Status Register */
+       u32     rmr;    /* Reset Mode Register */
+       u32     rpr;    /* Reset Protection Register */
+       u32     rcr;    /* Reset Control Register */
+       u32     rcer;   /* Reset Control Enable Register */
+};
+
+#endif /* __ASM_POWERPC_MPC5121_H__ */
index fb841205745055151c43100d2e15ba33b80f9eed..42561f4f032d0250e3bad6b0727cf7a4e123dad0 100644 (file)
 #include <asm/types.h>
 
 /* Max number of PSCs */
+#ifdef CONFIG_PPC_MPC512x
+#define MPC52xx_PSC_MAXNUM     12
+#else
 #define MPC52xx_PSC_MAXNUM     6
+#endif
 
 /* Programmable Serial Controller (PSC) status register bits */
 #define MPC52xx_PSC_SR_UNEX_RX 0x0001
index a002682f3a6dfe4b2dfe4e2ac88b6f935839b137..61913d9a21a025b5b1269ec2d797ed8229f50c74 100644 (file)
@@ -289,7 +289,7 @@ struct mpic
 #ifdef CONFIG_MPIC_U3_HT_IRQS
        /* The fixup table */
        struct mpic_irq_fixup   *fixups;
-       spinlock_t              fixup_lock;
+       raw_spinlock_t  fixup_lock;
 #endif
 
        /* Register access method */
index dabc01c727b86efb4b35c1d8f30e58e0ce95ede4..5399f7e18102f7144bcb1464ff5f13c2fac4468c 100644 (file)
@@ -15,7 +15,7 @@ static inline int __mutex_cmpxchg_lock(atomic_t *v, int old, int new)
        PPC405_ERR77(0,%1)
 "      stwcx.  %3,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        "\n\
 2:"
        : "=&r" (t)
@@ -35,7 +35,7 @@ static inline int __mutex_dec_return_lock(atomic_t *v)
        PPC405_ERR77(0,%1)
 "      stwcx.  %0,0,%1\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (t)
        : "r" (&v->counter)
        : "cc", "memory");
@@ -48,7 +48,7 @@ static inline int __mutex_inc_return_unlock(atomic_t *v)
        int t;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%1         # mutex unlock\n\
        addic   %0,%0,1\n"
        PPC405_ERR77(0,%1)
index 094f63d4d5ca4a87743c965ae6a4bb86a2eead0c..965d45427975907ae67efb45e20c8f500fd1ad3a 100644 (file)
@@ -1,22 +1 @@
-#ifndef _ASM_POWERPC_PARAM_H
-#define _ASM_POWERPC_PARAM_H
-
-#ifdef __KERNEL__
-#define HZ             CONFIG_HZ       /* internal kernel timer frequency */
-#define USER_HZ                100             /* for user interfaces in "ticks" */
-#define CLOCKS_PER_SEC (USER_HZ)       /* frequency at which times() counts */
-#endif /* __KERNEL__ */
-
-#ifndef HZ
-#define HZ 100
-#endif
-
-#define EXEC_PAGESIZE  4096
-
-#ifndef NOGROUP
-#define NOGROUP                (-1)
-#endif
-
-#define MAXHOSTNAMELEN 64      /* max length of hostname */
-
-#endif /* _ASM_POWERPC_PARAM_H */
+#include <asm-generic/param.h>
index 877c35a4356ed954317e1aa0546b07980f57a434..00eedc5a4e616b7b51fdf31dd0b0b9b68508ff23 100644 (file)
@@ -378,7 +378,7 @@ extern struct macio_chip* macio_find(struct device_node* child, int type);
  * Those are exported by pmac feature for internal use by arch code
  * only like the platform function callbacks, do not use directly in drivers
  */
-extern spinlock_t feature_lock;
+extern raw_spinlock_t feature_lock;
 extern struct device_node *uninorth_node;
 extern u32 __iomem *uninorth_base;
 
index ef9aa84cac5ad290eaeb53032491eae92dcd2808..aea71479759030651b24361b7eb965fefa65772c 100644 (file)
 #define PPC_INST_DCBZL                 0x7c2007ec
 #define PPC_INST_ISEL                  0x7c00001e
 #define PPC_INST_ISEL_MASK             0xfc00003e
+#define PPC_INST_LDARX                 0x7c0000a8
 #define PPC_INST_LSWI                  0x7c0004aa
 #define PPC_INST_LSWX                  0x7c00042a
+#define PPC_INST_LWARX                 0x7c000029
 #define PPC_INST_LWSYNC                        0x7c2004ac
 #define PPC_INST_LXVD2X                        0x7c000698
 #define PPC_INST_MCRXR                 0x7c000400
 #define __PPC_RA(a)    (((a) & 0x1f) << 16)
 #define __PPC_RB(b)    (((b) & 0x1f) << 11)
 #define __PPC_RS(s)    (((s) & 0x1f) << 21)
+#define __PPC_RT(s)    __PPC_RS(s)
 #define __PPC_XS(s)    ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5))
 #define __PPC_T_TLB(t) (((t) & 0x3) << 21)
 #define __PPC_WC(w)    (((w) & 0x3) << 21)
+/*
+ * Only use the larx hint bit on 64bit CPUs. Once we verify it doesn't have
+ * any side effects on all 32bit processors, we can do this all the time.
+ */
+#ifdef CONFIG_PPC64
+#define __PPC_EH(eh)   (((eh) & 0x1) << 0)
+#else
+#define __PPC_EH(eh)   0
+#endif
 
 /* Deal with instructions that older assemblers aren't aware of */
 #define        PPC_DCBAL(a, b)         stringify_in_c(.long PPC_INST_DCBAL | \
                                        __PPC_RA(a) | __PPC_RB(b))
 #define        PPC_DCBZL(a, b)         stringify_in_c(.long PPC_INST_DCBZL | \
                                        __PPC_RA(a) | __PPC_RB(b))
+#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \
+                                       __PPC_RT(t) | __PPC_RA(a) | \
+                                       __PPC_RB(b) | __PPC_EH(eh))
+#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \
+                                       __PPC_RT(t) | __PPC_RA(a) | \
+                                       __PPC_RB(b) | __PPC_EH(eh))
 #define PPC_MSGSND(b)          stringify_in_c(.long PPC_INST_MSGSND | \
                                        __PPC_RB(b))
 #define PPC_RFCI               stringify_in_c(.long PPC_INST_RFCI)
index 2828f9d0f66ddb1d66be47662c999282fc25fdaf..42fdff0e4b329a266b6398893fda81bd80de0b8d 100644 (file)
@@ -137,6 +137,11 @@ struct device_node * find_device_pe(struct device_node *dn);
 void eeh_sysfs_add_device(struct pci_dev *pdev);
 void eeh_sysfs_remove_device(struct pci_dev *pdev);
 
+static inline const char *eeh_pci_name(struct pci_dev *pdev) 
+{ 
+       return pdev ? pci_name(pdev) : "<null>";
+} 
+
 #endif /* CONFIG_EEH */
 
 #else /* CONFIG_PCI */
index 9eed29eee604713957dc9cd64c933c0262928eb6..221ba62404644d598ae2e9a6d20db6a3322656d0 100644 (file)
@@ -161,9 +161,41 @@ struct thread_struct {
 #ifdef CONFIG_PPC32
        void            *pgdir;         /* root of page-table tree */
 #endif
-#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
-       unsigned long   dbcr0;          /* debug control register values */
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+       /*
+        * The following help to manage the use of Debug Control Registers
+        * om the BookE platforms.
+        */
+       unsigned long   dbcr0;
        unsigned long   dbcr1;
+#ifdef CONFIG_BOOKE
+       unsigned long   dbcr2;
+#endif
+       /*
+        * The stored value of the DBSR register will be the value at the
+        * last debug interrupt. This register can only be read from the
+        * user (will never be written to) and has value while helping to
+        * describe the reason for the last debug trap.  Torez
+        */
+       unsigned long   dbsr;
+       /*
+        * The following will contain addresses used by debug applications
+        * to help trace and trap on particular address locations.
+        * The bits in the Debug Control Registers above help define which
+        * of the following registers will contain valid data and/or addresses.
+        */
+       unsigned long   iac1;
+       unsigned long   iac2;
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+       unsigned long   iac3;
+       unsigned long   iac4;
+#endif
+       unsigned long   dac1;
+       unsigned long   dac2;
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+       unsigned long   dvc1;
+       unsigned long   dvc2;
+#endif
 #endif
        /* FP and VSX 0-31 register set */
        double          fpr[32][TS_FPRWIDTH];
index 2ab9cbd98826555ffb3e3f8be70f43846b415074..ddd408a93b5a526c1c30d24c7c4d1a119365e338 100644 (file)
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT        1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT        1
-
-#define of_compat_cmp(s1, s2, l)       strcasecmp((s1), (s2))
-#define of_prop_cmp(s1, s2)            strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)            strcasecmp((s1), (s2))
-
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-
 #ifdef CONFIG_PPC32
 /*
  * PCI <-> OF matching functions
@@ -52,11 +39,6 @@ extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
 extern void pci_create_OF_bus_map(void);
 #endif
 
-extern struct resource *request_OF_resource(struct device_node* node,
-                               int index, const char* name_postfix);
-extern int release_OF_resource(struct device_node* node, int index);
-
-
 /*
  * OF address retreival & translation
  */
index cbd759e3cd7879d106eec0dea779e40f1790f97b..b451081265624990ebbd08a0f67275cf71296793 100644 (file)
  * 2 of the License, or (at your option) any later version.
  */
 
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#endif
+
 #ifndef __ASSEMBLY__
 
 struct pt_regs {
@@ -294,4 +300,75 @@ extern void user_disable_single_step(struct task_struct *);
 
 #define PTRACE_SINGLEBLOCK     0x100   /* resume execution until next branch */
 
+#define PPC_PTRACE_GETHWDBGINFO        0x89
+#define PPC_PTRACE_SETHWDEBUG  0x88
+#define PPC_PTRACE_DELHWDEBUG  0x87
+
+#ifndef __ASSEMBLY__
+
+struct ppc_debug_info {
+       uint32_t version;               /* Only version 1 exists to date */
+       uint32_t num_instruction_bps;
+       uint32_t num_data_bps;
+       uint32_t num_condition_regs;
+       uint32_t data_bp_alignment;
+       uint32_t sizeof_condition;      /* size of the DVC register */
+       uint64_t features;
+};
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * features will have bits indication whether there is support for:
+ */
+#define PPC_DEBUG_FEATURE_INSN_BP_RANGE                0x0000000000000001
+#define PPC_DEBUG_FEATURE_INSN_BP_MASK         0x0000000000000002
+#define PPC_DEBUG_FEATURE_DATA_BP_RANGE                0x0000000000000004
+#define PPC_DEBUG_FEATURE_DATA_BP_MASK         0x0000000000000008
+
+#ifndef __ASSEMBLY__
+
+struct ppc_hw_breakpoint {
+       uint32_t version;               /* currently, version must be 1 */
+       uint32_t trigger_type;          /* only some combinations allowed */
+       uint32_t addr_mode;             /* address match mode */
+       uint32_t condition_mode;        /* break/watchpoint condition flags */
+       uint64_t addr;                  /* break/watchpoint address */
+       uint64_t addr2;                 /* range end or mask */
+       uint64_t condition_value;       /* contents of the DVC register */
+};
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Trigger Type
+ */
+#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x00000001
+#define PPC_BREAKPOINT_TRIGGER_READ    0x00000002
+#define PPC_BREAKPOINT_TRIGGER_WRITE   0x00000004
+#define PPC_BREAKPOINT_TRIGGER_RW      \
+       (PPC_BREAKPOINT_TRIGGER_READ | PPC_BREAKPOINT_TRIGGER_WRITE)
+
+/*
+ * Address Mode
+ */
+#define PPC_BREAKPOINT_MODE_EXACT              0x00000000
+#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE    0x00000001
+#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE    0x00000002
+#define PPC_BREAKPOINT_MODE_MASK               0x00000003
+
+/*
+ * Condition Mode
+ */
+#define PPC_BREAKPOINT_CONDITION_MODE  0x00000003
+#define PPC_BREAKPOINT_CONDITION_NONE  0x00000000
+#define PPC_BREAKPOINT_CONDITION_AND   0x00000001
+#define PPC_BREAKPOINT_CONDITION_EXACT PPC_BREAKPOINT_CONDITION_AND
+#define PPC_BREAKPOINT_CONDITION_OR    0x00000002
+#define PPC_BREAKPOINT_CONDITION_AND_OR        0x00000003
+#define PPC_BREAKPOINT_CONDITION_BE_ALL        0x00ff0000
+#define PPC_BREAKPOINT_CONDITION_BE_SHIFT      16
+#define PPC_BREAKPOINT_CONDITION_BE(n) \
+       (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
+
 #endif /* _ASM_POWERPC_PTRACE_H */
index 3bf783505528ceb712c8858ac45252eaba65adcf..8808d307fe7e5a94dd572cf5dcc13ac1a3691ac3 100644 (file)
 #define DBSR_RET       0x00008000      /* Return Debug Event */
 #define DBSR_CIRPT     0x00000040      /* Critical Interrupt Taken Event */
 #define DBSR_CRET      0x00000020      /* Critical Return Debug Event */
+#define DBSR_IAC12ATS  0x00000002      /* Instr Address Compare 1/2 Toggle */
+#define DBSR_IAC34ATS  0x00000001      /* Instr Address Compare 3/4 Toggle */
 #endif
 #ifdef CONFIG_40x
 #define DBSR_IC                0x80000000      /* Instruction Completion */
 #define DBCR0_IA12T    0x00008000      /* Instr Addr 1-2 range Toggle */
 #define DBCR0_IA34T    0x00004000      /* Instr Addr 3-4 range Toggle */
 #define DBCR0_FT       0x00000001      /* Freeze Timers on debug event */
+
+#define dbcr_iac_range(task)   ((task)->thread.dbcr0)
+#define DBCR_IAC12I    DBCR0_IA12                      /* Range Inclusive */
+#define DBCR_IAC12X    (DBCR0_IA12 | DBCR0_IA12X)      /* Range Exclusive */
+#define DBCR_IAC12MODE (DBCR0_IA12 | DBCR0_IA12X)      /* IAC 1-2 Mode Bits */
+#define DBCR_IAC34I    DBCR0_IA34                      /* Range Inclusive */
+#define DBCR_IAC34X    (DBCR0_IA34 | DBCR0_IA34X)      /* Range Exclusive */
+#define DBCR_IAC34MODE (DBCR0_IA34 | DBCR0_IA34X)      /* IAC 3-4 Mode Bits */
+
+/* Bit definitions related to the DBCR1. */
+#define DBCR1_DAC1R    0x80000000      /* DAC1 Read Debug Event */
+#define DBCR1_DAC2R    0x40000000      /* DAC2 Read Debug Event */
+#define DBCR1_DAC1W    0x20000000      /* DAC1 Write Debug Event */
+#define DBCR1_DAC2W    0x10000000      /* DAC2 Write Debug Event */
+
+#define dbcr_dac(task) ((task)->thread.dbcr1)
+#define DBCR_DAC1R     DBCR1_DAC1R
+#define DBCR_DAC1W     DBCR1_DAC1W
+#define DBCR_DAC2R     DBCR1_DAC2R
+#define DBCR_DAC2W     DBCR1_DAC2W
+
+/*
+ * Are there any active Debug Events represented in the
+ * Debug Control Registers?
+ */
+#define DBCR0_ACTIVE_EVENTS    (DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \
+                                DBCR0_IAC3 | DBCR0_IAC4)
+#define DBCR1_ACTIVE_EVENTS    (DBCR1_DAC1R | DBCR1_DAC2R | \
+                                DBCR1_DAC1W | DBCR1_DAC2W)
+#define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1)  (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \
+                                          ((dbcr1) & DBCR1_ACTIVE_EVENTS))
+
 #elif defined(CONFIG_BOOKE)
 #define DBCR0_EDM      0x80000000      /* External Debug Mode */
 #define DBCR0_IDM      0x40000000      /* Internal Debug Mode */
 #define DBCR0_CRET     0x00000020      /* Critical Return Debug Event */
 #define DBCR0_FT       0x00000001      /* Freeze Timers on debug event */
 
+#define dbcr_dac(task) ((task)->thread.dbcr0)
+#define DBCR_DAC1R     DBCR0_DAC1R
+#define DBCR_DAC1W     DBCR0_DAC1W
+#define DBCR_DAC2R     DBCR0_DAC2R
+#define DBCR_DAC2W     DBCR0_DAC2W
+
 /* Bit definitions related to the DBCR1. */
+#define DBCR1_IAC1US   0xC0000000      /* Instr Addr Cmp 1 Sup/User   */
+#define DBCR1_IAC1ER   0x30000000      /* Instr Addr Cmp 1 Eff/Real */
+#define DBCR1_IAC1ER_01        0x10000000      /* reserved */
+#define DBCR1_IAC1ER_10        0x20000000      /* Instr Addr Cmp 1 Eff/Real MSR[IS]=0 */
+#define DBCR1_IAC1ER_11        0x30000000      /* Instr Addr Cmp 1 Eff/Real MSR[IS]=1 */
+#define DBCR1_IAC2US   0x0C000000      /* Instr Addr Cmp 2 Sup/User   */
+#define DBCR1_IAC2ER   0x03000000      /* Instr Addr Cmp 2 Eff/Real */
+#define DBCR1_IAC2ER_01        0x01000000      /* reserved */
+#define DBCR1_IAC2ER_10        0x02000000      /* Instr Addr Cmp 2 Eff/Real MSR[IS]=0 */
+#define DBCR1_IAC2ER_11        0x03000000      /* Instr Addr Cmp 2 Eff/Real MSR[IS]=1 */
 #define DBCR1_IAC12M   0x00800000      /* Instr Addr 1-2 range enable */
 #define DBCR1_IAC12MX  0x00C00000      /* Instr Addr 1-2 range eXclusive */
 #define DBCR1_IAC12AT  0x00010000      /* Instr Addr 1-2 range Toggle */
+#define DBCR1_IAC3US   0x0000C000      /* Instr Addr Cmp 3 Sup/User   */
+#define DBCR1_IAC3ER   0x00003000      /* Instr Addr Cmp 3 Eff/Real */
+#define DBCR1_IAC3ER_01        0x00001000      /* reserved */
+#define DBCR1_IAC3ER_10        0x00002000      /* Instr Addr Cmp 3 Eff/Real MSR[IS]=0 */
+#define DBCR1_IAC3ER_11        0x00003000      /* Instr Addr Cmp 3 Eff/Real MSR[IS]=1 */
+#define DBCR1_IAC4US   0x00000C00      /* Instr Addr Cmp 4 Sup/User   */
+#define DBCR1_IAC4ER   0x00000300      /* Instr Addr Cmp 4 Eff/Real */
+#define DBCR1_IAC4ER_01        0x00000100      /* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */
+#define DBCR1_IAC4ER_10        0x00000200      /* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */
+#define DBCR1_IAC4ER_11        0x00000300      /* Instr Addr Cmp 4 Eff/Real MSR[IS]=1 */
 #define DBCR1_IAC34M   0x00000080      /* Instr Addr 3-4 range enable */
 #define DBCR1_IAC34MX  0x000000C0      /* Instr Addr 3-4 range eXclusive */
 #define DBCR1_IAC34AT  0x00000001      /* Instr Addr 3-4 range Toggle */
 
+#define dbcr_iac_range(task)   ((task)->thread.dbcr1)
+#define DBCR_IAC12I    DBCR1_IAC12M    /* Range Inclusive */
+#define DBCR_IAC12X    DBCR1_IAC12MX   /* Range Exclusive */
+#define DBCR_IAC12MODE DBCR1_IAC12MX   /* IAC 1-2 Mode Bits */
+#define DBCR_IAC34I    DBCR1_IAC34M    /* Range Inclusive */
+#define DBCR_IAC34X    DBCR1_IAC34MX   /* Range Exclusive */
+#define DBCR_IAC34MODE DBCR1_IAC34MX   /* IAC 3-4 Mode Bits */
+
 /* Bit definitions related to the DBCR2. */
+#define DBCR2_DAC1US   0xC0000000      /* Data Addr Cmp 1 Sup/User   */
+#define DBCR2_DAC1ER   0x30000000      /* Data Addr Cmp 1 Eff/Real */
+#define DBCR2_DAC2US   0x00000000      /* Data Addr Cmp 2 Sup/User   */
+#define DBCR2_DAC2ER   0x00000000      /* Data Addr Cmp 2 Eff/Real */
 #define DBCR2_DAC12M   0x00800000      /* DAC 1-2 range enable */
+#define DBCR2_DAC12MM  0x00400000      /* DAC 1-2 Mask mode*/
 #define DBCR2_DAC12MX  0x00C00000      /* DAC 1-2 range eXclusive */
+#define DBCR2_DAC12MODE        0x00C00000      /* DAC 1-2 Mode Bits */
 #define DBCR2_DAC12A   0x00200000      /* DAC 1-2 Asynchronous */
-#endif
+#define DBCR2_DVC1M    0x000C0000      /* Data Value Comp 1 Mode */
+#define DBCR2_DVC1M_SHIFT      18      /* # of bits to shift DBCR2_DVC1M */
+#define DBCR2_DVC2M    0x00030000      /* Data Value Comp 2 Mode */
+#define DBCR2_DVC2M_SHIFT      16      /* # of bits to shift DBCR2_DVC2M */
+#define DBCR2_DVC1BE   0x00000F00      /* Data Value Comp 1 Byte */
+#define DBCR2_DVC1BE_SHIFT     8       /* # of bits to shift DBCR2_DVC1BE */
+#define DBCR2_DVC2BE   0x0000000F      /* Data Value Comp 2 Byte */
+#define DBCR2_DVC2BE_SHIFT     0       /* # of bits to shift DBCR2_DVC2BE */
+
+/*
+ * Are there any active Debug Events represented in the
+ * Debug Control Registers?
+ */
+#define DBCR0_ACTIVE_EVENTS  (DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \
+                             DBCR0_IAC3 | DBCR0_IAC4 | DBCR0_DAC1R | \
+                             DBCR0_DAC1W  | DBCR0_DAC2R | DBCR0_DAC2W)
+#define DBCR1_ACTIVE_EVENTS    0
+
+#define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1)  (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \
+                                          ((dbcr1) & DBCR1_ACTIVE_EVENTS))
+#endif /* #elif defined(CONFIG_BOOKE) */
 
 /* Bit definitions related to the TCR. */
 #define TCR_WP(x)      (((x)&0x3)<<30) /* WDT Period */
index 764094cff68172609db5ce6d4e05a1a2b8229598..f9611bd69ed2a102b38e67da0451be7694c70a5b 100644 (file)
@@ -27,6 +27,7 @@
 #endif
 #include <asm/asm-compat.h>
 #include <asm/synch.h>
+#include <asm/ppc-opcode.h>
 
 #define arch_spin_is_locked(x)         ((x)->slock != 0)
 
@@ -60,13 +61,14 @@ static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock)
 
        token = LOCK_TOKEN;
        __asm__ __volatile__(
-"1:    lwarx           %0,0,%2\n\
+"1:    " PPC_LWARX(%0,0,%2,1) "\n\
        cmpwi           0,%0,0\n\
        bne-            2f\n\
        stwcx.          %1,0,%2\n\
-       bne-            1b\n\
-       isync\n\
-2:"    : "=&r" (tmp)
+       bne-            1b\n"
+       PPC_ACQUIRE_BARRIER
+"2:"
+       : "=&r" (tmp)
        : "r" (token), "r" (&lock->slock)
        : "cr0", "memory");
 
@@ -144,7 +146,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
        SYNC_IO;
        __asm__ __volatile__("# arch_spin_unlock\n\t"
-                               LWSYNC_ON_SMP: : :"memory");
+                               PPC_RELEASE_BARRIER: : :"memory");
        lock->slock = 0;
 }
 
@@ -186,15 +188,15 @@ static inline long __arch_read_trylock(arch_rwlock_t *rw)
        long tmp;
 
        __asm__ __volatile__(
-"1:    lwarx           %0,0,%1\n"
+"1:    " PPC_LWARX(%0,0,%1,1) "\n"
        __DO_SIGN_EXTEND
 "      addic.          %0,%0,1\n\
        ble-            2f\n"
        PPC405_ERR77(0,%1)
 "      stwcx.          %0,0,%1\n\
-       bne-            1b\n\
-       isync\n\
-2:"    : "=&r" (tmp)
+       bne-            1b\n"
+       PPC_ACQUIRE_BARRIER
+"2:"   : "=&r" (tmp)
        : "r" (&rw->lock)
        : "cr0", "xer", "memory");
 
@@ -211,14 +213,14 @@ static inline long __arch_write_trylock(arch_rwlock_t *rw)
 
        token = WRLOCK_TOKEN;
        __asm__ __volatile__(
-"1:    lwarx           %0,0,%2\n\
+"1:    " PPC_LWARX(%0,0,%2,1) "\n\
        cmpwi           0,%0,0\n\
        bne-            2f\n"
        PPC405_ERR77(0,%1)
 "      stwcx.          %1,0,%2\n\
-       bne-            1b\n\
-       isync\n\
-2:"    : "=&r" (tmp)
+       bne-            1b\n"
+       PPC_ACQUIRE_BARRIER
+"2:"   : "=&r" (tmp)
        : "r" (token), "r" (&rw->lock)
        : "cr0", "memory");
 
@@ -269,7 +271,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
 
        __asm__ __volatile__(
        "# read_unlock\n\t"
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx           %0,0,%1\n\
        addic           %0,%0,-1\n"
        PPC405_ERR77(0,%1)
@@ -283,7 +285,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw)
 static inline void arch_write_unlock(arch_rwlock_t *rw)
 {
        __asm__ __volatile__("# write_unlock\n\t"
-                               LWSYNC_ON_SMP: : :"memory");
+                               PPC_RELEASE_BARRIER: : :"memory");
        rw->lock = 0;
 }
 
index 28f6ddbff4cf31d6e9fa8d420563dc8228e1db5a..d7cab44643c51d90f1f79509939e3c734b735eba 100644 (file)
@@ -37,11 +37,15 @@ static inline void isync(void)
 #endif
 
 #ifdef CONFIG_SMP
-#define ISYNC_ON_SMP   "\n\tisync\n"
-#define LWSYNC_ON_SMP  stringify_in_c(LWSYNC) "\n"
+#define __PPC_ACQUIRE_BARRIER                          \
+       START_LWSYNC_SECTION(97);                       \
+       isync;                                          \
+       MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup);
+#define PPC_ACQUIRE_BARRIER    "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER)
+#define PPC_RELEASE_BARRIER    stringify_in_c(LWSYNC) "\n"
 #else
-#define ISYNC_ON_SMP
-#define LWSYNC_ON_SMP
+#define PPC_ACQUIRE_BARRIER
+#define PPC_RELEASE_BARRIER
 #endif
 
 #endif /* __KERNEL__ */
index bb8e006a47c67655d9f68d2608abd438e0e21d48..a6297c67c3d6ab4e0e4a81246342dbf282dedb27 100644 (file)
@@ -112,8 +112,13 @@ static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
 #endif
 
 extern int set_dabr(unsigned long dabr);
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+extern void do_send_trap(struct pt_regs *regs, unsigned long address,
+                        unsigned long error_code, int signal_code, int brkpt);
+#else
 extern void do_dabr(struct pt_regs *regs, unsigned long address,
                    unsigned long error_code);
+#endif
 extern void print_backtrace(unsigned long *);
 extern void show_regs(struct pt_regs * regs);
 extern void flush_instruction_cache(void);
@@ -232,12 +237,12 @@ __xchg_u32(volatile void *p, unsigned long val)
        unsigned long prev;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%2 \n"
        PPC405_ERR77(0,%2)
 "      stwcx.  %3,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (prev), "+m" (*(volatile unsigned int *)p)
        : "r" (p), "r" (val)
        : "cc", "memory");
@@ -275,12 +280,12 @@ __xchg_u64(volatile void *p, unsigned long val)
        unsigned long prev;
 
        __asm__ __volatile__(
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%2 \n"
        PPC405_ERR77(0,%2)
 "      stdcx.  %3,0,%2 \n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        : "=&r" (prev), "+m" (*(volatile unsigned long *)p)
        : "r" (p), "r" (val)
        : "cc", "memory");
@@ -366,14 +371,14 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
        unsigned int prev;
 
        __asm__ __volatile__ (
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    lwarx   %0,0,%2         # __cmpxchg_u32\n\
        cmpw    0,%0,%3\n\
        bne-    2f\n"
        PPC405_ERR77(0,%2)
 "      stwcx.  %4,0,%2\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        "\n\
 2:"
        : "=&r" (prev), "+m" (*p)
@@ -412,13 +417,13 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
        unsigned long prev;
 
        __asm__ __volatile__ (
-       LWSYNC_ON_SMP
+       PPC_RELEASE_BARRIER
 "1:    ldarx   %0,0,%2         # __cmpxchg_u64\n\
        cmpd    0,%0,%3\n\
        bne-    2f\n\
        stdcx.  %4,0,%2\n\
        bne-    1b"
-       ISYNC_ON_SMP
+       PPC_ACQUIRE_BARRIER
        "\n\
 2:"
        : "=&r" (prev), "+m" (*p)
index c8b329255678802bc34e27c85e84bf5338be25ea..aa9d383a1c09525daab6721a24b67607fcaeaf8f 100644 (file)
@@ -111,7 +111,6 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_NOTIFY_RESUME      13      /* callback before returning to user */
 #define TIF_FREEZE             14      /* Freezing for suspend */
 #define TIF_RUNLATCH           15      /* Is the runlatch enabled? */
-#define TIF_ABI_PENDING                16      /* 32/64 bit switch needed */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
@@ -129,7 +128,6 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_FREEZE            (1<<TIF_FREEZE)
 #define _TIF_RUNLATCH          (1<<TIF_RUNLATCH)
-#define _TIF_ABI_PENDING       (1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_T_OR_A    (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
 #define _TIF_USER_WORK_MASK    (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
index 22f738d12ad966b293d25a7036696db79a954606..8eaec310a25bb1b60528fabffe8a950055fe26c3 100644 (file)
@@ -17,7 +17,9 @@ static inline int cpu_to_node(int cpu)
 
 #define parent_node(node)      (node)
 
-#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
+#define cpumask_of_node(node) ((node) == -1 ?                          \
+                              cpu_all_mask :                           \
+                              &numa_cpumask_lookup_table[node])
 
 int of_node_to_nid(struct device_node *device);
 
@@ -36,27 +38,33 @@ static inline int pcibus_to_node(struct pci_bus *bus)
                                 cpumask_of_node(pcibus_to_node(bus)))
 
 /* sched_domains SD_NODE_INIT for PPC64 machines */
-#define SD_NODE_INIT (struct sched_domain) {           \
-       .parent                 = NULL,                 \
-       .child                  = NULL,                 \
-       .groups                 = NULL,                 \
-       .min_interval           = 8,                    \
-       .max_interval           = 32,                   \
-       .busy_factor            = 32,                   \
-       .imbalance_pct          = 125,                  \
-       .cache_nice_tries       = 1,                    \
-       .busy_idx               = 3,                    \
-       .idle_idx               = 1,                    \
-       .newidle_idx            = 0,                    \
-       .wake_idx               = 0,                    \
-       .flags                  = SD_LOAD_BALANCE       \
-                               | SD_BALANCE_EXEC       \
-                               | SD_BALANCE_FORK       \
-                               | SD_BALANCE_NEWIDLE    \
-                               | SD_SERIALIZE,         \
-       .last_balance           = jiffies,              \
-       .balance_interval       = 1,                    \
-       .nr_balance_failed      = 0,                    \
+#define SD_NODE_INIT (struct sched_domain) {                           \
+       .min_interval           = 8,                                    \
+       .max_interval           = 32,                                   \
+       .busy_factor            = 32,                                   \
+       .imbalance_pct          = 125,                                  \
+       .cache_nice_tries       = 1,                                    \
+       .busy_idx               = 3,                                    \
+       .idle_idx               = 1,                                    \
+       .newidle_idx            = 0,                                    \
+       .wake_idx               = 0,                                    \
+       .forkexec_idx           = 0,                                    \
+                                                                       \
+       .flags                  = 1*SD_LOAD_BALANCE                     \
+                               | 1*SD_BALANCE_NEWIDLE                  \
+                               | 1*SD_BALANCE_EXEC                     \
+                               | 1*SD_BALANCE_FORK                     \
+                               | 0*SD_BALANCE_WAKE                     \
+                               | 0*SD_WAKE_AFFINE                      \
+                               | 0*SD_PREFER_LOCAL                     \
+                               | 0*SD_SHARE_CPUPOWER                   \
+                               | 0*SD_POWERSAVINGS_BALANCE             \
+                               | 0*SD_SHARE_PKG_RESOURCES              \
+                               | 1*SD_SERIALIZE                        \
+                               | 0*SD_PREFER_SIBLING                   \
+                               ,                                       \
+       .last_balance           = jiffies,                              \
+       .balance_interval       = 1,                                    \
 }
 
 extern void __init dump_numa_cpu_topology(void);
index bdcb557d470ab1a3f272f0783e0e77244f88cbe2..07109d843787118dba501c5b9bb383912348417b 100644 (file)
@@ -791,9 +791,8 @@ _GLOBAL(enter_rtas)
        
         li      r9,1
         rldicr  r9,r9,MSR_SF_LG,(63-MSR_SF_LG)
-       ori     r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP
+       ori     r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI
        andc    r6,r0,r9
-       ori     r6,r6,MSR_RI
        sync                            /* disable interrupts so SRR0/1 */
        mtmsrd  r0                      /* don't get trashed */
 
index 1679a70bbcad7e6bfe2370c142c2bd9b33688db5..6b1f4271eb5366a4ce8855b2a1b55ebfd46a4631 100644 (file)
@@ -17,5 +17,5 @@
 
 #include <asm/firmware.h>
 
-unsigned long powerpc_firmware_features;
+unsigned long powerpc_firmware_features __read_mostly;
 EXPORT_SYMBOL_GPL(powerpc_firmware_features);
index 678f98cd5e640c13c97b9edd60ebd721f9218c71..3ef743fa5d7c1664e928ef9d3cda654a9ba389ab 100644 (file)
@@ -542,11 +542,11 @@ DARFixed:/* Return from dcbx instruction bug workaround, r10 holds value of DAR
 FixupDAR:/* Entry point for dcbx workaround. */
        /* fetch instruction from memory. */
        mfspr   r10, SPRN_SRR0
+       andis.  r11, r10, 0x8000        /* Address >= 0x80000000 */
        DO_8xx_CPU6(0x3780, r3)
        mtspr   SPRN_MD_EPN, r10
        mfspr   r11, SPRN_M_TWB /* Get level 1 table entry address */
-       cmplwi  cr0, r11, 0x0800
-       blt-    3f              /* Branch if user space */
+       beq-    3f              /* Branch if user space */
        lis     r11, (swapper_pg_dir-PAGE_OFFSET)@h
        ori     r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l
        rlwimi  r11, r10, 32-20, 0xffc /* r11 = r11&~0xffc|(r10>>20)&0xffc */
@@ -768,12 +768,12 @@ start_here:
  */
 initial_mmu:
        tlbia                   /* Invalidate all TLB entries */
-#ifdef CONFIG_PIN_TLB
+/* Always pin the first 8 MB ITLB to prevent ITLB
+   misses while mucking around with SRR0/SRR1 in asm
+*/
        lis     r8, MI_RSV4I@h
        ori     r8, r8, 0x1c00
-#else
-       li      r8, 0
-#endif
+
        mtspr   SPRN_MI_CTR, r8 /* Set instruction MMU control */
 
 #ifdef CONFIG_PIN_TLB
index 7f4bd7f3b6af36bb5c87127b5c4be3d1be44c43d..25793bb0e7828ad5c60ff550bbb19ec832e8a30d 100644 (file)
@@ -214,11 +214,11 @@ skpinv:   addi    r6,r6,1                         /* Increment */
        bl      1f              /* Find our address */
 1:     mflr    r9
        rlwimi  r7,r9,0,20,31
-       addi    r7,r7,24
+       addi    r7,r7,(2f - 1b)
        mtspr   SPRN_SRR0,r7
        mtspr   SPRN_SRR1,r6
        rfi
-
+2:
 /* 4. Clear out PIDs & Search info */
        li      r6,0
        mtspr   SPRN_MAS6,r6
index 9040330b0530f1dae82f75c4f5b5218495e7c4f1..64f6f2031c226901dc54105c7a0f433566e2846d 100644 (file)
 #define CREATE_TRACE_POINTS
 #include <asm/trace.h>
 
+DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
+EXPORT_PER_CPU_SYMBOL(irq_stat);
+
 int __irq_offset_value;
-static int ppc_spurious_interrupts;
 
 #ifdef CONFIG_PPC32
 EXPORT_SYMBOL(__irq_offset_value);
@@ -180,30 +182,64 @@ notrace void raw_local_irq_restore(unsigned long en)
 EXPORT_SYMBOL(raw_local_irq_restore);
 #endif /* CONFIG_PPC64 */
 
+static int show_other_interrupts(struct seq_file *p, int prec)
+{
+       int j;
+
+#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
+       if (tau_initialized) {
+               seq_printf(p, "%*s: ", prec, "TAU");
+               for_each_online_cpu(j)
+                       seq_printf(p, "%10u ", tau_interrupts(j));
+               seq_puts(p, "  PowerPC             Thermal Assist (cpu temp)\n");
+       }
+#endif /* CONFIG_PPC32 && CONFIG_TAU_INT */
+
+       seq_printf(p, "%*s: ", prec, "LOC");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs);
+        seq_printf(p, "  Local timer interrupts\n");
+
+       seq_printf(p, "%*s: ", prec, "SPU");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs);
+       seq_printf(p, "  Spurious interrupts\n");
+
+       seq_printf(p, "%*s: ", prec, "CNT");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
+       seq_printf(p, "  Performance monitoring interrupts\n");
+
+       seq_printf(p, "%*s: ", prec, "MCE");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
+       seq_printf(p, "  Machine check exceptions\n");
+
+       return 0;
+}
+
 int show_interrupts(struct seq_file *p, void *v)
 {
-       int i = *(loff_t *)v, j;
+       unsigned long flags, any_count = 0;
+       int i = *(loff_t *) v, j, prec;
        struct irqaction *action;
        struct irq_desc *desc;
-       unsigned long flags;
 
+       if (i > nr_irqs)
+               return 0;
+
+       for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
+               j *= 10;
+
+       if (i == nr_irqs)
+               return show_other_interrupts(p, prec);
+
+       /* print header */
        if (i == 0) {
-               seq_puts(p, "           ");
+               seq_printf(p, "%*s", prec + 8, "");
                for_each_online_cpu(j)
-                       seq_printf(p, "CPU%d       ", j);
+                       seq_printf(p, "CPU%-8d", j);
                seq_putc(p, '\n');
-       } else if (i == nr_irqs) {
-#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
-               if (tau_initialized){
-                       seq_puts(p, "TAU: ");
-                       for_each_online_cpu(j)
-                               seq_printf(p, "%10u ", tau_interrupts(j));
-                       seq_puts(p, "  PowerPC             Thermal Assist (cpu temp)\n");
-               }
-#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/
-               seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
-
-               return 0;
        }
 
        desc = irq_to_desc(i);
@@ -211,37 +247,48 @@ int show_interrupts(struct seq_file *p, void *v)
                return 0;
 
        raw_spin_lock_irqsave(&desc->lock, flags);
-
+       for_each_online_cpu(j)
+               any_count |= kstat_irqs_cpu(i, j);
        action = desc->action;
-       if (!action || !action->handler)
-               goto skip;
+       if (!action && !any_count)
+               goto out;
 
-       seq_printf(p, "%3d: ", i);
-#ifdef CONFIG_SMP
+       seq_printf(p, "%*d: ", prec, i);
        for_each_online_cpu(j)
                seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
-#else
-       seq_printf(p, "%10u ", kstat_irqs(i));
-#endif /* CONFIG_SMP */
 
        if (desc->chip)
-               seq_printf(p, " %s ", desc->chip->name);
+               seq_printf(p, "  %-16s", desc->chip->name);
        else
-               seq_puts(p, "  None      ");
+               seq_printf(p, "  %-16s", "None");
+       seq_printf(p, " %-8s", (desc->status & IRQ_LEVEL) ? "Level" : "Edge");
 
-       seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge  ");
-       seq_printf(p, "    %s", action->name);
+       if (action) {
+               seq_printf(p, "     %s", action->name);
+               while ((action = action->next) != NULL)
+                       seq_printf(p, ", %s", action->name);
+       }
 
-       for (action = action->next; action; action = action->next)
-               seq_printf(p, ", %s", action->name);
        seq_putc(p, '\n');
-
-skip:
+out:
        raw_spin_unlock_irqrestore(&desc->lock, flags);
-
        return 0;
 }
 
+/*
+ * /proc/stat helpers
+ */
+u64 arch_irq_stat_cpu(unsigned int cpu)
+{
+       u64 sum = per_cpu(irq_stat, cpu).timer_irqs;
+
+       sum += per_cpu(irq_stat, cpu).pmu_irqs;
+       sum += per_cpu(irq_stat, cpu).mce_exceptions;
+       sum += per_cpu(irq_stat, cpu).spurious_irqs;
+
+       return sum;
+}
+
 #ifdef CONFIG_HOTPLUG_CPU
 void fixup_irqs(cpumask_t map)
 {
@@ -353,8 +400,7 @@ void do_IRQ(struct pt_regs *regs)
        if (irq != NO_IRQ && irq != NO_IRQ_IGNORE)
                handle_one_irq(irq);
        else if (irq != NO_IRQ_IGNORE)
-               /* That's not SMP safe ... but who cares ? */
-               ppc_spurious_interrupts++;
+               __get_cpu_var(irq_stat).spurious_irqs++;
 
        irq_exit();
        set_irq_regs(old_regs);
@@ -474,7 +520,7 @@ void do_softirq(void)
  */
 
 static LIST_HEAD(irq_hosts);
-static DEFINE_SPINLOCK(irq_big_lock);
+static DEFINE_RAW_SPINLOCK(irq_big_lock);
 static unsigned int revmap_trees_allocated;
 static DEFINE_MUTEX(revmap_trees_mutex);
 struct irq_map_entry irq_map[NR_IRQS];
@@ -520,14 +566,14 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
        if (host->ops->match == NULL)
                host->ops->match = default_irq_host_match;
 
-       spin_lock_irqsave(&irq_big_lock, flags);
+       raw_spin_lock_irqsave(&irq_big_lock, flags);
 
        /* If it's a legacy controller, check for duplicates and
         * mark it as allocated (we use irq 0 host pointer for that
         */
        if (revmap_type == IRQ_HOST_MAP_LEGACY) {
                if (irq_map[0].host != NULL) {
-                       spin_unlock_irqrestore(&irq_big_lock, flags);
+                       raw_spin_unlock_irqrestore(&irq_big_lock, flags);
                        /* If we are early boot, we can't free the structure,
                         * too bad...
                         * this will be fixed once slab is made available early
@@ -541,7 +587,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
        }
 
        list_add(&host->link, &irq_hosts);
-       spin_unlock_irqrestore(&irq_big_lock, flags);
+       raw_spin_unlock_irqrestore(&irq_big_lock, flags);
 
        /* Additional setups per revmap type */
        switch(revmap_type) {
@@ -592,13 +638,13 @@ struct irq_host *irq_find_host(struct device_node *node)
         * the absence of a device node. This isn't a problem so far
         * yet though...
         */
-       spin_lock_irqsave(&irq_big_lock, flags);
+       raw_spin_lock_irqsave(&irq_big_lock, flags);
        list_for_each_entry(h, &irq_hosts, link)
                if (h->ops->match(h, node)) {
                        found = h;
                        break;
                }
-       spin_unlock_irqrestore(&irq_big_lock, flags);
+       raw_spin_unlock_irqrestore(&irq_big_lock, flags);
        return found;
 }
 EXPORT_SYMBOL_GPL(irq_find_host);
@@ -967,7 +1013,7 @@ unsigned int irq_alloc_virt(struct irq_host *host,
        if (count == 0 || count > (irq_virq_count - NUM_ISA_INTERRUPTS))
                return NO_IRQ;
 
-       spin_lock_irqsave(&irq_big_lock, flags);
+       raw_spin_lock_irqsave(&irq_big_lock, flags);
 
        /* Use hint for 1 interrupt if any */
        if (count == 1 && hint >= NUM_ISA_INTERRUPTS &&
@@ -991,7 +1037,7 @@ unsigned int irq_alloc_virt(struct irq_host *host,
                }
        }
        if (found == NO_IRQ) {
-               spin_unlock_irqrestore(&irq_big_lock, flags);
+               raw_spin_unlock_irqrestore(&irq_big_lock, flags);
                return NO_IRQ;
        }
  hint_found:
@@ -1000,7 +1046,7 @@ unsigned int irq_alloc_virt(struct irq_host *host,
                smp_wmb();
                irq_map[i].host = host;
        }
-       spin_unlock_irqrestore(&irq_big_lock, flags);
+       raw_spin_unlock_irqrestore(&irq_big_lock, flags);
        return found;
 }
 
@@ -1012,7 +1058,7 @@ void irq_free_virt(unsigned int virq, unsigned int count)
        WARN_ON (virq < NUM_ISA_INTERRUPTS);
        WARN_ON (count == 0 || (virq + count) > irq_virq_count);
 
-       spin_lock_irqsave(&irq_big_lock, flags);
+       raw_spin_lock_irqsave(&irq_big_lock, flags);
        for (i = virq; i < (virq + count); i++) {
                struct irq_host *host;
 
@@ -1025,7 +1071,7 @@ void irq_free_virt(unsigned int virq, unsigned int count)
                smp_wmb();
                irq_map[i].host = NULL;
        }
-       spin_unlock_irqrestore(&irq_big_lock, flags);
+       raw_spin_unlock_irqrestore(&irq_big_lock, flags);
 }
 
 int arch_early_irq_init(void)
index b6bd1eaa1c24b4e043814d22477e58acc07b77e8..41bada0298c8b106e4c9fff4334ed793e6641e4c 100644 (file)
@@ -333,7 +333,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
                atomic_set(&kgdb_cpu_doing_single_step, -1);
                /* set the trace bit if we're stepping */
                if (remcom_in_buffer[0] == 's') {
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                        mtspr(SPRN_DBCR0,
                              mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
                        linux_regs->msr |= MSR_DE;
index c9329786073b2295d53cf7707abc21ded2f0a9a0..3fd1af90211236dfad7b488206bdf0b7214deaf3 100644 (file)
@@ -36,7 +36,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
-#ifdef CONFIG_BOOKE
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
 #define MSR_SINGLESTEP (MSR_DE)
 #else
 #define MSR_SINGLESTEP (MSR_SE)
@@ -110,7 +110,7 @@ static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
         * like Decrementer or External Interrupt */
        regs->msr &= ~MSR_EE;
        regs->msr |= MSR_SINGLESTEP;
-#ifdef CONFIG_BOOKE
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
        regs->msr &= ~MSR_CE;
        mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
 #endif
index 79a00bb9c64ca86c77d1af2b8889683d710e434d..d09d1c615150bcd61b79bae01b0168f5d788d68c 100644 (file)
@@ -359,7 +359,7 @@ static void parse_system_parameter_string(struct seq_file *m)
 
        unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
        if (!local_buffer) {
-               printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
+               printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
                       __FILE__, __func__, __LINE__);
                return;
        }
@@ -383,13 +383,13 @@ static void parse_system_parameter_string(struct seq_file *m)
                int idx, w_idx;
                char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
                if (!workbuffer) {
-                       printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
+                       printk(KERN_ERR "%s %s kmalloc failure at line %d\n",
                               __FILE__, __func__, __LINE__);
                        kfree(local_buffer);
                        return;
                }
 #ifdef LPARCFG_DEBUG
-               printk(KERN_INFO "success calling get-system-parameter \n");
+               printk(KERN_INFO "success calling get-system-parameter\n");
 #endif
                splpar_strlen = local_buffer[0] * 256 + local_buffer[1];
                local_buffer += 2;      /* step over strlen value */
@@ -440,7 +440,7 @@ static int lparcfg_count_active_processors(void)
 
        while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) {
 #ifdef LPARCFG_DEBUG
-               printk(KERN_ERR "cpus_dn %p \n", cpus_dn);
+               printk(KERN_ERR "cpus_dn %p\n", cpus_dn);
 #endif
                count++;
        }
@@ -725,7 +725,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
        const unsigned int *lp_index_ptr;
        unsigned int lp_index = 0;
 
-       seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
+       seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
 
        rootdn = of_find_node_by_path("/");
        if (rootdn) {
index ad461e735aec027b17e5004f04421228a1410ed9..9cf197f01e943f1ffb95ad441436e5ee6486ded3 100644 (file)
@@ -338,8 +338,8 @@ static int __init nvram_create_os_partition(void)
 
        rc = nvram_write_header(new_part);
        if (rc <= 0) {
-               printk(KERN_ERR "nvram_create_os_partition: nvram_write_header \
-                               failed (%d)\n", rc);
+               printk(KERN_ERR "nvram_create_os_partition: nvram_write_header "
+                               "failed (%d)\n", rc);
                return rc;
        }
 
@@ -349,7 +349,7 @@ static int __init nvram_create_os_partition(void)
        rc = ppc_md.nvram_write((char *)&seq_init, sizeof(seq_init), &tmp_index);
        if (rc <= 0) {
                printk(KERN_ERR "nvram_create_os_partition: nvram_write "
-                               "failed (%d)\n", rc);
+                      "failed (%d)\n", rc);
                return rc;
        }
        
index 1a4fc0d11a031706ab19018959074ea6fbbfc4f7..666d08db319e313f87c0d1c975a267461df51ca2 100644 (file)
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
 static int of_dev_phandle_match(struct device *dev, void *data)
 {
        phandle *ph = data;
-       return to_of_device(dev)->node->linux_phandle == *ph;
+       return to_of_device(dev)->node->phandle == *ph;
 }
 
 struct of_device *of_find_device_by_phandle(phandle ph)
index cadbed679fbbc17cc8cac85426a50c6cc631db34..2597f9545d8ae61522a9d18226c807831c752955 100644 (file)
@@ -1047,10 +1047,8 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
 
        struct pci_dev *dev = bus->self;
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
-               if ((res = bus->resource[i]) == NULL)
-                       continue;
-               if (!res->flags)
+       pci_bus_for_each_resource(bus, res, i) {
+               if (!res || !res->flags)
                        continue;
                if (i >= 3 && bus->self->transparent)
                        continue;
@@ -1181,21 +1179,20 @@ static int skip_isa_ioresource_align(struct pci_dev *dev)
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void pcibios_align_resource(void *data, struct resource *res,
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
                                resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
+       resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
-
                if (skip_isa_ioresource_align(dev))
-                       return;
-               if (start & 0x300) {
+                       return start;
+               if (start & 0x300)
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
        }
+
+       return start;
 }
 EXPORT_SYMBOL(pcibios_align_resource);
 
@@ -1278,9 +1275,8 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
        pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
                 pci_domain_nr(bus), bus->number);
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
-               if ((res = bus->resource[i]) == NULL || !res->flags
-                   || res->start > res->end || res->parent)
+       pci_bus_for_each_resource(bus, res, i) {
+               if (!res || !res->flags || res->start > res->end || res->parent)
                        continue;
                if (bus->parent == NULL)
                        pr = (res->flags & IORESOURCE_IO) ?
index ccf56ac92de552fd0f5d7867430f6d510977064f..d43fc65749c1161e1b016f884792fcf73948479d 100644 (file)
@@ -224,7 +224,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
         * G5 machines... So when something asks for bus 0 io base
         * (bus 0 is HT root), we return the AGP one instead.
         */
-       if (in_bus == 0 && machine_is_compatible("MacRISC4")) {
+       if (in_bus == 0 && of_machine_is_compatible("MacRISC4")) {
                struct device_node *agp;
 
                agp = of_find_compatible_node(NULL, NULL, "u3-agp");
index 7311fdfb9bf803f7c070d546330a604718640c5b..cd11d5ca80dfffa8cf863df49d1f911931cddf24 100644 (file)
@@ -123,6 +123,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 {
        struct pci_dev *dev;
        const char *type;
+       struct pci_slot *slot;
 
        dev = alloc_pci_dev();
        if (!dev)
@@ -140,6 +141,11 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
        dev->devfn = devfn;
        dev->multifunction = 0;         /* maybe a lie? */
        dev->needs_freset = 0;          /* pcie fundamental reset required */
+       set_pcie_port_type(dev);
+
+       list_for_each_entry(slot, &dev->bus->slots, list)
+               if (PCI_SLOT(dev->devfn) == slot->number)
+                       dev->slot = slot;
 
        dev->vendor = get_int_prop(node, "vendor-id", 0xffff);
        dev->device = get_int_prop(node, "device-id", 0xffff);
@@ -160,10 +166,14 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
        dev->error_state = pci_channel_io_normal;
        dev->dma_mask = 0xffffffff;
 
+       /* Early fixups, before probing the BARs */
+       pci_fixup_device(pci_fixup_early, dev);
+
        if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
                /* a PCI-PCI bridge */
                dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
                dev->rom_base_reg = PCI_ROM_ADDRESS1;
+               set_pcie_hotplug_bridge(dev);
        } else if (!strcmp(type, "cardbus")) {
                dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
        } else {
@@ -294,7 +304,7 @@ static void __devinit __of_scan_bus(struct device_node *node,
        int reglen, devfn;
        struct pci_dev *dev;
 
-       pr_debug("of_scan_bus(%s) bus no %d... \n",
+       pr_debug("of_scan_bus(%s) bus no %d...\n",
                 node->full_name, bus->number);
 
        /* Scan direct children */
index a3c11cac3d7154d1381d77a83ec513e5c6601c11..95ad9dad298e9d4773117b0406bc4a3378d77e5e 100644 (file)
@@ -495,9 +495,6 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
 
        entry->nr = 0;
 
-       if (current->pid == 0)          /* idle task? */
-               return entry;
-
        if (!user_mode(regs)) {
                perf_callchain_kernel(regs, entry);
                if (current->mm)
index 1eb85fbf53a50277f48be5ae5d8c57772d216d61..b6cf8f1f4d35b834f5fb62977c66d38aaf143654 100644 (file)
@@ -718,10 +718,10 @@ static int collect_events(struct perf_event *group, int max_count,
        return n;
 }
 
-static void event_sched_in(struct perf_event *event, int cpu)
+static void event_sched_in(struct perf_event *event)
 {
        event->state = PERF_EVENT_STATE_ACTIVE;
-       event->oncpu = cpu;
+       event->oncpu = smp_processor_id();
        event->tstamp_running += event->ctx->time - event->tstamp_stopped;
        if (is_software_event(event))
                event->pmu->enable(event);
@@ -735,7 +735,7 @@ static void event_sched_in(struct perf_event *event, int cpu)
  */
 int hw_perf_group_sched_in(struct perf_event *group_leader,
               struct perf_cpu_context *cpuctx,
-              struct perf_event_context *ctx, int cpu)
+              struct perf_event_context *ctx)
 {
        struct cpu_hw_events *cpuhw;
        long i, n, n0;
@@ -766,10 +766,10 @@ int hw_perf_group_sched_in(struct perf_event *group_leader,
                cpuhw->event[i]->hw.config = cpuhw->events[i];
        cpuctx->active_oncpu += n;
        n = 1;
-       event_sched_in(group_leader, cpu);
+       event_sched_in(group_leader);
        list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
                if (sub->state != PERF_EVENT_STATE_OFF) {
-                       event_sched_in(sub, cpu);
+                       event_sched_in(sub);
                        ++n;
                }
        }
index 0516e2d3e02ea5b1807d2b17e5ed148118d6535c..461499b43cff4efc29ea5996f6dafa200aaba872 100644 (file)
@@ -37,7 +37,7 @@ static void dummy_perf(struct pt_regs *regs)
 }
 
 
-static DEFINE_SPINLOCK(pmc_owner_lock);
+static DEFINE_RAW_SPINLOCK(pmc_owner_lock);
 static void *pmc_owner_caller; /* mostly for debugging */
 perf_irq_t perf_irq = dummy_perf;
 
@@ -45,7 +45,7 @@ int reserve_pmc_hardware(perf_irq_t new_perf_irq)
 {
        int err = 0;
 
-       spin_lock(&pmc_owner_lock);
+       raw_spin_lock(&pmc_owner_lock);
 
        if (pmc_owner_caller) {
                printk(KERN_WARNING "reserve_pmc_hardware: "
@@ -59,21 +59,21 @@ int reserve_pmc_hardware(perf_irq_t new_perf_irq)
        perf_irq = new_perf_irq ? new_perf_irq : dummy_perf;
 
  out:
-       spin_unlock(&pmc_owner_lock);
+       raw_spin_unlock(&pmc_owner_lock);
        return err;
 }
 EXPORT_SYMBOL_GPL(reserve_pmc_hardware);
 
 void release_pmc_hardware(void)
 {
-       spin_lock(&pmc_owner_lock);
+       raw_spin_lock(&pmc_owner_lock);
 
        WARN_ON(! pmc_owner_caller);
 
        pmc_owner_caller = NULL;
        perf_irq = dummy_perf;
 
-       spin_unlock(&pmc_owner_lock);
+       raw_spin_unlock(&pmc_owner_lock);
 }
 EXPORT_SYMBOL_GPL(release_pmc_hardware);
 
index c930ac38e59f0274cf488d28c441aafe4b6c0c65..e4d71ced97ef7cb5ce438766e80d82252c2ec09f 100644 (file)
@@ -245,6 +245,24 @@ void discard_lazy_cpu_state(void)
 }
 #endif /* CONFIG_SMP */
 
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+void do_send_trap(struct pt_regs *regs, unsigned long address,
+                 unsigned long error_code, int signal_code, int breakpt)
+{
+       siginfo_t info;
+
+       if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
+                       11, SIGSEGV) == NOTIFY_STOP)
+               return;
+
+       /* Deliver the signal to userspace */
+       info.si_signo = SIGTRAP;
+       info.si_errno = breakpt;        /* breakpoint or watchpoint id */
+       info.si_code = signal_code;
+       info.si_addr = (void __user *)address;
+       force_sig_info(SIGTRAP, &info, current);
+}
+#else  /* !CONFIG_PPC_ADV_DEBUG_REGS */
 void do_dabr(struct pt_regs *regs, unsigned long address,
                    unsigned long error_code)
 {
@@ -257,12 +275,6 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
        if (debugger_dabr_match(regs))
                return;
 
-       /* Clear the DAC and struct entries.  One shot trigger */
-#if defined(CONFIG_BOOKE)
-       mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
-                                                       | DBCR0_IDM));
-#endif
-
        /* Clear the DABR */
        set_dabr(0);
 
@@ -273,9 +285,82 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
        info.si_addr = (void __user *)address;
        force_sig_info(SIGTRAP, &info, current);
 }
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
 
 static DEFINE_PER_CPU(unsigned long, current_dabr);
 
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+/*
+ * Set the debug registers back to their default "safe" values.
+ */
+static void set_debug_reg_defaults(struct thread_struct *thread)
+{
+       thread->iac1 = thread->iac2 = 0;
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+       thread->iac3 = thread->iac4 = 0;
+#endif
+       thread->dac1 = thread->dac2 = 0;
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+       thread->dvc1 = thread->dvc2 = 0;
+#endif
+       thread->dbcr0 = 0;
+#ifdef CONFIG_BOOKE
+       /*
+        * Force User/Supervisor bits to b11 (user-only MSR[PR]=1)
+        */
+       thread->dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US |   \
+                       DBCR1_IAC3US | DBCR1_IAC4US;
+       /*
+        * Force Data Address Compare User/Supervisor bits to be User-only
+        * (0b11 MSR[PR]=1) and set all other bits in DBCR2 register to be 0.
+        */
+       thread->dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US;
+#else
+       thread->dbcr1 = 0;
+#endif
+}
+
+static void prime_debug_regs(struct thread_struct *thread)
+{
+       mtspr(SPRN_IAC1, thread->iac1);
+       mtspr(SPRN_IAC2, thread->iac2);
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+       mtspr(SPRN_IAC3, thread->iac3);
+       mtspr(SPRN_IAC4, thread->iac4);
+#endif
+       mtspr(SPRN_DAC1, thread->dac1);
+       mtspr(SPRN_DAC2, thread->dac2);
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+       mtspr(SPRN_DVC1, thread->dvc1);
+       mtspr(SPRN_DVC2, thread->dvc2);
+#endif
+       mtspr(SPRN_DBCR0, thread->dbcr0);
+       mtspr(SPRN_DBCR1, thread->dbcr1);
+#ifdef CONFIG_BOOKE
+       mtspr(SPRN_DBCR2, thread->dbcr2);
+#endif
+}
+/*
+ * Unless neither the old or new thread are making use of the
+ * debug registers, set the debug registers from the values
+ * stored in the new thread.
+ */
+static void switch_booke_debug_regs(struct thread_struct *new_thread)
+{
+       if ((current->thread.dbcr0 & DBCR0_IDM)
+               || (new_thread->dbcr0 & DBCR0_IDM))
+                       prime_debug_regs(new_thread);
+}
+#else  /* !CONFIG_PPC_ADV_DEBUG_REGS */
+static void set_debug_reg_defaults(struct thread_struct *thread)
+{
+       if (thread->dabr) {
+               thread->dabr = 0;
+               set_dabr(0);
+       }
+}
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
+
 int set_dabr(unsigned long dabr)
 {
        __get_cpu_var(current_dabr) = dabr;
@@ -284,7 +369,7 @@ int set_dabr(unsigned long dabr)
                return ppc_md.set_dabr(dabr);
 
        /* XXX should we have a CPU_FTR_HAS_DABR ? */
-#if defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
        mtspr(SPRN_DAC1, dabr);
 #elif defined(CONFIG_PPC_BOOK3S)
        mtspr(SPRN_DABR, dabr);
@@ -371,10 +456,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
 
 #endif /* CONFIG_SMP */
 
-#if defined(CONFIG_BOOKE)
-       /* If new thread DAC (HW breakpoint) is the same then leave it */
-       if (new->thread.dabr)
-               set_dabr(new->thread.dabr);
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+       switch_booke_debug_regs(&new->thread);
 #else
        if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
                set_dabr(new->thread.dabr);
@@ -514,7 +597,7 @@ void show_regs(struct pt_regs * regs)
        printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
        trap = TRAP(regs);
        if (trap == 0x300 || trap == 0x600)
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr);
 #else
                printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
@@ -554,28 +637,9 @@ void exit_thread(void)
 
 void flush_thread(void)
 {
-#ifdef CONFIG_PPC64
-       struct thread_info *t = current_thread_info();
-
-       if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
-               clear_ti_thread_flag(t, TIF_ABI_PENDING);
-               if (test_ti_thread_flag(t, TIF_32BIT))
-                       clear_ti_thread_flag(t, TIF_32BIT);
-               else
-                       set_ti_thread_flag(t, TIF_32BIT);
-       }
-#endif
-
        discard_lazy_cpu_state();
 
-       if (current->thread.dabr) {
-               current->thread.dabr = 0;
-               set_dabr(0);
-
-#if defined(CONFIG_BOOKE)
-               current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W);
-#endif
-       }
+       set_debug_reg_defaults(&current->thread);
 }
 
 void
index 4ec3008624662e8a7eb9df4ba1709dd255b8e245..43238b2054b68735a678d0bef885bf193b530fa9 100644 (file)
 #define DBG(fmt...)
 #endif
 
-
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 #ifdef CONFIG_PPC64
 int __initdata iommu_is_off;
 int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-typedef u32 cell_t;
-
-#if 0
-static struct boot_param_header *initial_boot_params __initdata;
-#else
-struct boot_param_header *initial_boot_params;
-#endif
-
-extern struct device_node *allnodes;   /* temporary while merging */
-
-extern rwlock_t devtree_lock;  /* temporary while merging */
-
-/* export that to outside world */
-struct device_node *of_chosen;
-
-static inline char *find_flat_dt_string(u32 offset)
-{
-       return ((char *)initial_boot_params) +
-               initial_boot_params->off_dt_strings + offset;
-}
-
-/**
- * This function is used to scan the flattened device-tree, it is
- * used to extract the memory informations at boot before we can
- * unflatten the tree
- */
-int __init of_scan_flat_dt(int (*it)(unsigned long node,
-                                    const char *uname, int depth,
-                                    void *data),
-                          void *data)
-{
-       unsigned long p = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       int rc = 0;
-       int depth = -1;
-
-       do {
-               u32 tag = *((u32 *)p);
-               char *pathp;
-               
-               p += 4;
-               if (tag == OF_DT_END_NODE) {
-                       depth --;
-                       continue;
-               }
-               if (tag == OF_DT_NOP)
-                       continue;
-               if (tag == OF_DT_END)
-                       break;
-               if (tag == OF_DT_PROP) {
-                       u32 sz = *((u32 *)p);
-                       p += 8;
-                       if (initial_boot_params->version < 0x10)
-                               p = _ALIGN(p, sz >= 8 ? 8 : 4);
-                       p += sz;
-                       p = _ALIGN(p, 4);
-                       continue;
-               }
-               if (tag != OF_DT_BEGIN_NODE) {
-                       printk(KERN_WARNING "Invalid tag %x scanning flattened"
-                              " device tree !\n", tag);
-                       return -EINVAL;
-               }
-               depth++;
-               pathp = (char *)p;
-               p = _ALIGN(p + strlen(pathp) + 1, 4);
-               if ((*pathp) == '/') {
-                       char *lp, *np;
-                       for (lp = NULL, np = pathp; *np; np++)
-                               if ((*np) == '/')
-                                       lp = np+1;
-                       if (lp != NULL)
-                               pathp = lp;
-               }
-               rc = it(p, pathp, depth, data);
-               if (rc != 0)
-                       break;          
-       } while(1);
-
-       return rc;
-}
-
-unsigned long __init of_get_flat_dt_root(void)
-{
-       unsigned long p = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-
-       while(*((u32 *)p) == OF_DT_NOP)
-               p += 4;
-       BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
-       p += 4;
-       return _ALIGN(p + strlen((char *)p) + 1, 4);
-}
-
-/**
- * This  function can be used within scan_flattened_dt callback to get
- * access to properties
- */
-void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
-                                unsigned long *size)
-{
-       unsigned long p = node;
-
-       do {
-               u32 tag = *((u32 *)p);
-               u32 sz, noff;
-               const char *nstr;
-
-               p += 4;
-               if (tag == OF_DT_NOP)
-                       continue;
-               if (tag != OF_DT_PROP)
-                       return NULL;
-
-               sz = *((u32 *)p);
-               noff = *((u32 *)(p + 4));
-               p += 8;
-               if (initial_boot_params->version < 0x10)
-                       p = _ALIGN(p, sz >= 8 ? 8 : 4);
-
-               nstr = find_flat_dt_string(noff);
-               if (nstr == NULL) {
-                       printk(KERN_WARNING "Can't find property index"
-                              " name !\n");
-                       return NULL;
-               }
-               if (strcmp(name, nstr) == 0) {
-                       if (size)
-                               *size = sz;
-                       return (void *)p;
-               }
-               p += sz;
-               p = _ALIGN(p, 4);
-       } while(1);
-}
-
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
-{
-       const char* cp;
-       unsigned long cplen, l;
-
-       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
-       if (cp == NULL)
-               return 0;
-       while (cplen > 0) {
-               if (strncasecmp(cp, compat, strlen(compat)) == 0)
-                       return 1;
-               l = strlen(cp) + 1;
-               cp += l;
-               cplen -= l;
-       }
-
-       return 0;
-}
-
-static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
-                                      unsigned long align)
-{
-       void *res;
-
-       *mem = _ALIGN(*mem, align);
-       res = (void *)*mem;
-       *mem += size;
-
-       return res;
-}
-
-static unsigned long __init unflatten_dt_node(unsigned long mem,
-                                             unsigned long *p,
-                                             struct device_node *dad,
-                                             struct device_node ***allnextpp,
-                                             unsigned long fpsize)
-{
-       struct device_node *np;
-       struct property *pp, **prev_pp = NULL;
-       char *pathp;
-       u32 tag;
-       unsigned int l, allocl;
-       int has_name = 0;
-       int new_format = 0;
-
-       tag = *((u32 *)(*p));
-       if (tag != OF_DT_BEGIN_NODE) {
-               printk("Weird tag at start of node: %x\n", tag);
-               return mem;
-       }
-       *p += 4;
-       pathp = (char *)*p;
-       l = allocl = strlen(pathp) + 1;
-       *p = _ALIGN(*p + l, 4);
-
-       /* version 0x10 has a more compact unit name here instead of the full
-        * path. we accumulate the full path size using "fpsize", we'll rebuild
-        * it later. We detect this because the first character of the name is
-        * not '/'.
-        */
-       if ((*pathp) != '/') {
-               new_format = 1;
-               if (fpsize == 0) {
-                       /* root node: special case. fpsize accounts for path
-                        * plus terminating zero. root node only has '/', so
-                        * fpsize should be 2, but we want to avoid the first
-                        * level nodes to have two '/' so we use fpsize 1 here
-                        */
-                       fpsize = 1;
-                       allocl = 2;
-               } else {
-                       /* account for '/' and path size minus terminal 0
-                        * already in 'l'
-                        */
-                       fpsize += l;
-                       allocl = fpsize;
-               }
-       }
-
-
-       np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
-                               __alignof__(struct device_node));
-       if (allnextpp) {
-               memset(np, 0, sizeof(*np));
-               np->full_name = ((char*)np) + sizeof(struct device_node);
-               if (new_format) {
-                       char *p = np->full_name;
-                       /* rebuild full path for new format */
-                       if (dad && dad->parent) {
-                               strcpy(p, dad->full_name);
-#ifdef DEBUG
-                               if ((strlen(p) + l + 1) != allocl) {
-                                       DBG("%s: p: %d, l: %d, a: %d\n",
-                                           pathp, (int)strlen(p), l, allocl);
-                               }
-#endif
-                               p += strlen(p);
-                       }
-                       *(p++) = '/';
-                       memcpy(p, pathp, l);
-               } else
-                       memcpy(np->full_name, pathp, l);
-               prev_pp = &np->properties;
-               **allnextpp = np;
-               *allnextpp = &np->allnext;
-               if (dad != NULL) {
-                       np->parent = dad;
-                       /* we temporarily use the next field as `last_child'*/
-                       if (dad->next == 0)
-                               dad->child = np;
-                       else
-                               dad->next->sibling = np;
-                       dad->next = np;
-               }
-               kref_init(&np->kref);
-       }
-       while(1) {
-               u32 sz, noff;
-               char *pname;
-
-               tag = *((u32 *)(*p));
-               if (tag == OF_DT_NOP) {
-                       *p += 4;
-                       continue;
-               }
-               if (tag != OF_DT_PROP)
-                       break;
-               *p += 4;
-               sz = *((u32 *)(*p));
-               noff = *((u32 *)((*p) + 4));
-               *p += 8;
-               if (initial_boot_params->version < 0x10)
-                       *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
-
-               pname = find_flat_dt_string(noff);
-               if (pname == NULL) {
-                       printk("Can't find property name in list !\n");
-                       break;
-               }
-               if (strcmp(pname, "name") == 0)
-                       has_name = 1;
-               l = strlen(pname) + 1;
-               pp = unflatten_dt_alloc(&mem, sizeof(struct property),
-                                       __alignof__(struct property));
-               if (allnextpp) {
-                       if (strcmp(pname, "linux,phandle") == 0) {
-                               np->node = *((u32 *)*p);
-                               if (np->linux_phandle == 0)
-                                       np->linux_phandle = np->node;
-                       }
-                       if (strcmp(pname, "ibm,phandle") == 0)
-                               np->linux_phandle = *((u32 *)*p);
-                       pp->name = pname;
-                       pp->length = sz;
-                       pp->value = (void *)*p;
-                       *prev_pp = pp;
-                       prev_pp = &pp->next;
-               }
-               *p = _ALIGN((*p) + sz, 4);
-       }
-       /* with version 0x10 we may not have the name property, recreate
-        * it here from the unit name if absent
-        */
-       if (!has_name) {
-               char *p = pathp, *ps = pathp, *pa = NULL;
-               int sz;
-
-               while (*p) {
-                       if ((*p) == '@')
-                               pa = p;
-                       if ((*p) == '/')
-                               ps = p + 1;
-                       p++;
-               }
-               if (pa < ps)
-                       pa = p;
-               sz = (pa - ps) + 1;
-               pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
-                                       __alignof__(struct property));
-               if (allnextpp) {
-                       pp->name = "name";
-                       pp->length = sz;
-                       pp->value = pp + 1;
-                       *prev_pp = pp;
-                       prev_pp = &pp->next;
-                       memcpy(pp->value, ps, sz - 1);
-                       ((char *)pp->value)[sz - 1] = 0;
-                       DBG("fixed up name for %s -> %s\n", pathp,
-                               (char *)pp->value);
-               }
-       }
-       if (allnextpp) {
-               *prev_pp = NULL;
-               np->name = of_get_property(np, "name", NULL);
-               np->type = of_get_property(np, "device_type", NULL);
-
-               if (!np->name)
-                       np->name = "<NULL>";
-               if (!np->type)
-                       np->type = "<NULL>";
-       }
-       while (tag == OF_DT_BEGIN_NODE) {
-               mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
-               tag = *((u32 *)(*p));
-       }
-       if (tag != OF_DT_END_NODE) {
-               printk("Weird tag at end of node: %x\n", tag);
-               return mem;
-       }
-       *p += 4;
-       return mem;
-}
-
 static int __init early_parse_mem(char *p)
 {
        if (!p)
@@ -446,7 +93,7 @@ static void __init move_device_tree(void)
        DBG("-> move_device_tree\n");
 
        start = __pa(initial_boot_params);
-       size = initial_boot_params->totalsize;
+       size = be32_to_cpu(initial_boot_params->totalsize);
 
        if ((memory_limit && (start + size) > memory_limit) ||
                        overlaps_crashkernel(start, size)) {
@@ -459,54 +106,6 @@ static void __init move_device_tree(void)
        DBG("<- move_device_tree\n");
 }
 
-/**
- * unflattens the device-tree passed by the firmware, creating the
- * tree of struct device_node. It also fills the "name" and "type"
- * pointers of the nodes so the normal device-tree walking functions
- * can be used (this used to be done by finish_device_tree)
- */
-void __init unflatten_device_tree(void)
-{
-       unsigned long start, mem, size;
-       struct device_node **allnextp = &allnodes;
-
-       DBG(" -> unflatten_device_tree()\n");
-
-       /* First pass, scan for size */
-       start = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       size = unflatten_dt_node(0, &start, NULL, NULL, 0);
-       size = (size | 3) + 1;
-
-       DBG("  size is %lx, allocating...\n", size);
-
-       /* Allocate memory for the expanded device tree */
-       mem = lmb_alloc(size + 4, __alignof__(struct device_node));
-       mem = (unsigned long) __va(mem);
-
-       ((u32 *)mem)[size / 4] = 0xdeadbeef;
-
-       DBG("  unflattening %lx...\n", mem);
-
-       /* Second pass, do actual unflattening */
-       start = ((unsigned long)initial_boot_params) +
-               initial_boot_params->off_dt_struct;
-       unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
-       if (*((u32 *)start) != OF_DT_END)
-               printk(KERN_WARNING "Weird tag at end of tree: %08x\n", *((u32 *)start));
-       if (((u32 *)mem)[size / 4] != 0xdeadbeef)
-               printk(KERN_WARNING "End of tree marker overwritten: %08x\n",
-                      ((u32 *)mem)[size / 4] );
-       *allnextp = NULL;
-
-       /* Get pointer to OF "/chosen" node for use everywhere */
-       of_chosen = of_find_node_by_path("/chosen");
-       if (of_chosen == NULL)
-               of_chosen = of_find_node_by_path("/chosen@0");
-
-       DBG(" <- unflatten_device_tree()\n");
-}
-
 /*
  * ibm,pa-features is a per-cpu property that contains a string of
  * attribute descriptors, each of which has a 2 byte header plus up
@@ -763,48 +362,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
        return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-       unsigned long l;
-       u32 *prop;
-
-       DBG("Looking for initrd properties... ");
-
-       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-       if (prop) {
-               initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-
-               prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-               if (prop) {
-                       initrd_end = (unsigned long)
-                                       __va(of_read_ulong(prop, l/4));
-                       initrd_below_start_ok = 1;
-               } else {
-                       initrd_start = 0;
-               }
-       }
-
-       DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-static int __init early_init_dt_scan_chosen(unsigned long node,
-                                           const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
        unsigned long *lprop;
-       unsigned long l;
-       char *p;
-
-       DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-       if (depth != 1 ||
-           (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
-               return 0;
 
 #ifdef CONFIG_PPC64
        /* check if iommu is forced on or off */
@@ -815,17 +375,17 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 #endif
 
        /* mem=x on the command line is the preferred mechanism */
-       lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
-       if (lprop)
-               memory_limit = *lprop;
+       lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
+       if (lprop)
+               memory_limit = *lprop;
 
 #ifdef CONFIG_PPC64
-       lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
-       if (lprop)
-               tce_alloc_start = *lprop;
-       lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
-       if (lprop)
-               tce_alloc_end = *lprop;
+       lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
+       if (lprop)
+               tce_alloc_start = *lprop;
+       lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
+       if (lprop)
+               tce_alloc_end = *lprop;
 #endif
 
 #ifdef CONFIG_KEXEC
@@ -837,51 +397,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
        if (lprop)
                crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
-
-       early_init_dt_check_for_initrd(node);
-
-       /* Retreive command line */
-       p = of_get_flat_dt_prop(node, "bootargs", &l);
-       if (p != NULL && l > 0)
-               strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-       if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-               strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-       DBG("Command line is: %s\n", cmd_line);
-
-       /* break now */
-       return 1;
-}
-
-static int __init early_init_dt_scan_root(unsigned long node,
-                                         const char *uname, int depth, void *data)
-{
-       u32 *prop;
-
-       if (depth != 0)
-               return 0;
-
-       prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-       dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-       DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-       prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-       dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-       DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-       
-       /* break now */
-       return 1;
-}
-
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-       cell_t *p = *cellp;
-
-       *cellp = p + s;
-       return of_read_number(p, s);
 }
 
 #ifdef CONFIG_PPC_PSERIES
@@ -893,22 +408,22 @@ static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
  */
 static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 {
-       cell_t *dm, *ls, *usm;
+       __be32 *dm, *ls, *usm;
        unsigned long l, n, flags;
        u64 base, size, lmb_size;
        unsigned int is_kexec_kdump = 0, rngs;
 
        ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
-       if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
+       if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
                return 0;
        lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
 
        dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
-       if (dm == NULL || l < sizeof(cell_t))
+       if (dm == NULL || l < sizeof(__be32))
                return 0;
 
        n = *dm++;      /* number of entries */
-       if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
+       if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(__be32))
                return 0;
 
        /* check if this is a kexec/kdump kernel. */
@@ -963,65 +478,47 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 #define early_init_dt_scan_drconf_memory(node) 0
 #endif /* CONFIG_PPC_PSERIES */
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-                                           const char *uname, int depth, void *data)
+static int __init early_init_dt_scan_memory_ppc(unsigned long node,
+                                               const char *uname,
+                                               int depth, void *data)
 {
-       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-       cell_t *reg, *endp;
-       unsigned long l;
-
-       /* Look for the ibm,dynamic-reconfiguration-memory node */
        if (depth == 1 &&
            strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0)
                return early_init_dt_scan_drconf_memory(node);
+       
+       return early_init_dt_scan_memory(node, uname, depth, data);
+}
 
-       /* We are scanning "memory" nodes only */
-       if (type == NULL) {
-               /*
-                * The longtrail doesn't have a device_type on the
-                * /memory node, so look for the node called /memory@0.
-                */
-               if (depth != 1 || strcmp(uname, "memory@0") != 0)
-                       return 0;
-       } else if (strcmp(type, "memory") != 0)
-               return 0;
-
-       reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
-       if (reg == NULL)
-               reg = of_get_flat_dt_prop(node, "reg", &l);
-       if (reg == NULL)
-               return 0;
-
-       endp = reg + (l / sizeof(cell_t));
-
-       DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
-           uname, l, reg[0], reg[1], reg[2], reg[3]);
-
-       while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
-               u64 base, size;
+void __init early_init_dt_add_memory_arch(u64 base, u64 size)
+{
+#if defined(CONFIG_PPC64)
+       if (iommu_is_off) {
+               if (base >= 0x80000000ul)
+                       return;
+               if ((base + size) > 0x80000000ul)
+                       size = 0x80000000ul - base;
+       }
+#endif
 
-               base = dt_mem_next_cell(dt_root_addr_cells, &reg);
-               size = dt_mem_next_cell(dt_root_size_cells, &reg);
+       lmb_add(base, size);
 
-               if (size == 0)
-                       continue;
-               DBG(" - %llx ,  %llx\n", (unsigned long long)base,
-                   (unsigned long long)size);
-#ifdef CONFIG_PPC64
-               if (iommu_is_off) {
-                       if (base >= 0x80000000ul)
-                               continue;
-                       if ((base + size) > 0x80000000ul)
-                               size = 0x80000000ul - base;
-               }
-#endif
-               lmb_add(base, size);
+       memstart_addr = min((u64)memstart_addr, base);
+}
 
-               memstart_addr = min((u64)memstart_addr, base);
-       }
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+       return lmb_alloc(size, align);
+}
 
-       return 0;
+#ifdef CONFIG_BLK_DEV_INITRD
+void __init early_init_dt_setup_initrd_arch(unsigned long start,
+               unsigned long end)
+{
+       initrd_start = (unsigned long)__va(start);
+       initrd_end = (unsigned long)__va(end);
+       initrd_below_start_ok = 1;
 }
+#endif
 
 static void __init early_reserve_mem(void)
 {
@@ -1186,7 +683,7 @@ void __init early_init_devtree(void *params)
        /* Scan memory nodes and rebuild LMBs */
        lmb_init();
        of_scan_flat_dt(early_init_dt_scan_root, NULL);
-       of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+       of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
 
        /* Save command line for /proc/cmdline and then parse parameters */
        strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
@@ -1234,25 +731,6 @@ void __init early_init_devtree(void *params)
        DBG(" <- early_init_devtree()\n");
 }
 
-
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-       struct device_node *root;
-       int rc = 0;
-
-       root = of_find_node_by_path("/");
-       if (root) {
-               rc = of_device_is_compatible(root, compat);
-               of_node_put(root);
-       }
-       return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
@@ -1264,27 +742,6 @@ EXPORT_SYMBOL(machine_is_compatible);
  *
  *******/
 
-/**
- *     of_find_node_by_phandle - Find a node given a phandle
- *     @handle:        phandle of the node to find
- *
- *     Returns a node pointer with refcount incremented, use
- *     of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       read_lock(&devtree_lock);
-       for (np = allnodes; np != 0; np = np->allnext)
-               if (np->linux_phandle == handle)
-                       break;
-       of_node_get(np);
-       read_unlock(&devtree_lock);
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
 /**
  *     of_find_next_cache_node - Find a node's subsidiary cache
  *     @np:    node of type "cpu" or "cache"
@@ -1316,138 +773,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
        return NULL;
 }
 
-/**
- *     of_node_get - Increment refcount of a node
- *     @node:  Node to inc refcount, NULL is supported to
- *             simplify writing of callers
- *
- *     Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-       if (node)
-               kref_get(&node->kref);
-       return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node * kref_to_device_node(struct kref *kref)
-{
-       return container_of(kref, struct device_node, kref);
-}
-
-/**
- *     of_node_release - release a dynamically allocated node
- *     @kref:  kref element of the node to be released
- *
- *     In of_node_put() this function is passed to kref_put()
- *     as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-       struct device_node *node = kref_to_device_node(kref);
-       struct property *prop = node->properties;
-
-       /* We should never be releasing nodes that haven't been detached. */
-       if (!of_node_check_flag(node, OF_DETACHED)) {
-               printk("WARNING: Bad of_node_put() on %s\n", node->full_name);
-               dump_stack();
-               kref_init(&node->kref);
-               return;
-       }
-
-       if (!of_node_check_flag(node, OF_DYNAMIC))
-               return;
-
-       while (prop) {
-               struct property *next = prop->next;
-               kfree(prop->name);
-               kfree(prop->value);
-               kfree(prop);
-               prop = next;
-
-               if (!prop) {
-                       prop = node->deadprops;
-                       node->deadprops = NULL;
-               }
-       }
-       kfree(node->full_name);
-       kfree(node->data);
-       kfree(node);
-}
-
-/**
- *     of_node_put - Decrement refcount of a node
- *     @node:  Node to dec refcount, NULL is supported to
- *             simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-       if (node)
-               kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
-/*
- * Plug a device node into the tree and global list.
- */
-void of_attach_node(struct device_node *np)
-{
-       unsigned long flags;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       np->sibling = np->parent->child;
-       np->allnext = allnodes;
-       np->parent->child = np;
-       allnodes = np;
-       write_unlock_irqrestore(&devtree_lock, flags);
-}
-
-/*
- * "Unplug" a node from the device tree.  The caller must hold
- * a reference to the node.  The memory associated with the node
- * is not freed until its refcount goes to zero.
- */
-void of_detach_node(struct device_node *np)
-{
-       struct device_node *parent;
-       unsigned long flags;
-
-       write_lock_irqsave(&devtree_lock, flags);
-
-       parent = np->parent;
-       if (!parent)
-               goto out_unlock;
-
-       if (allnodes == np)
-               allnodes = np->allnext;
-       else {
-               struct device_node *prev;
-               for (prev = allnodes;
-                    prev->allnext != np;
-                    prev = prev->allnext)
-                       ;
-               prev->allnext = np->allnext;
-       }
-
-       if (parent->child == np)
-               parent->child = np->sibling;
-       else {
-               struct device_node *prevsib;
-               for (prevsib = np->parent->child;
-                    prevsib->sibling != np;
-                    prevsib = prevsib->sibling)
-                       ;
-               prevsib->sibling = np->sibling;
-       }
-
-       of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
-       write_unlock_irqrestore(&devtree_lock, flags);
-}
-
 #ifdef CONFIG_PPC_PSERIES
 /*
  * Fix up the uninitialized fields in a new device node:
@@ -1479,9 +804,9 @@ static int of_finish_dynamic_node(struct device_node *node)
        if (machine_is(powermac))
                return -ENODEV;
 
-       /* fix up new node's linux_phandle field */
+       /* fix up new node's phandle field */
        if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
-               node->linux_phandle = *ibm_phandle;
+               node->phandle = *ibm_phandle;
 
 out:
        of_node_put(parent);
@@ -1520,120 +845,6 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif
 
-/*
- * Add a property to a node
- */
-int prom_add_property(struct device_node* np, struct property* prop)
-{
-       struct property **next;
-       unsigned long flags;
-
-       prop->next = NULL;      
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (strcmp(prop->name, (*next)->name) == 0) {
-                       /* duplicate ! don't insert it */
-                       write_unlock_irqrestore(&devtree_lock, flags);
-                       return -1;
-               }
-               next = &(*next)->next;
-       }
-       *next = prop;
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to add to proc as well if it was initialized */
-       if (np->pde)
-               proc_device_tree_add_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
-/*
- * Remove a property from a node.  Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property.  Instead we just move the property
- * to the "dead properties" list, so it won't be found any more.
- */
-int prom_remove_property(struct device_node *np, struct property *prop)
-{
-       struct property **next;
-       unsigned long flags;
-       int found = 0;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (*next == prop) {
-                       /* found the node */
-                       *next = prop->next;
-                       prop->next = np->deadprops;
-                       np->deadprops = prop;
-                       found = 1;
-                       break;
-               }
-               next = &(*next)->next;
-       }
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-       if (!found)
-               return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to remove the proc node as well */
-       if (np->pde)
-               proc_device_tree_remove_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
-/*
- * Update a property in a node.  Note that we don't actually
- * remove it, since we have given out who-knows-how-many pointers
- * to the data using get-property.  Instead we just move the property
- * to the "dead properties" list, and add the new property to the
- * property list
- */
-int prom_update_property(struct device_node *np,
-                        struct property *newprop,
-                        struct property *oldprop)
-{
-       struct property **next;
-       unsigned long flags;
-       int found = 0;
-
-       write_lock_irqsave(&devtree_lock, flags);
-       next = &np->properties;
-       while (*next) {
-               if (*next == oldprop) {
-                       /* found the node */
-                       newprop->next = oldprop->next;
-                       *next = newprop;
-                       oldprop->next = np->deadprops;
-                       np->deadprops = oldprop;
-                       found = 1;
-                       break;
-               }
-               next = &(*next)->next;
-       }
-       write_unlock_irqrestore(&devtree_lock, flags);
-
-       if (!found)
-               return -ENODEV;
-
-#ifdef CONFIG_PROC_DEVICETREE
-       /* try to add to proc as well if it was initialized */
-       if (np->pde)
-               proc_device_tree_update_prop(np->pde, newprop, oldprop);
-#endif /* CONFIG_PROC_DEVICETREE */
-
-       return 0;
-}
-
-
 /* Find the device node for a given logical cpu number, also returns the cpu
  * local thread number (index in ibm,interrupt-server#s) if relevant and
  * asked for (non NULL)
index bafac2e41ae1f0a9ab971d7e3f5397c5ab0e63bd..5f306c4946e542bedf94001cc3eb0372032dba95 100644 (file)
@@ -654,6 +654,9 @@ static void __init early_cmdline_parse(void)
 #define OV5_CMO                        0x00
 #endif
 
+/* Option Vector 6: IBM PAPR hints */
+#define OV6_LINUX              0x02    /* Linux is our OS */
+
 /*
  * The architecture vector has an array of PVR mask/value pairs,
  * followed by # option vectors - 1, followed by the option vectors.
@@ -665,7 +668,7 @@ static unsigned char ibm_architecture_vec[] = {
        W(0xffffffff), W(0x0f000003),   /* all 2.06-compliant */
        W(0xffffffff), W(0x0f000002),   /* all 2.05-compliant */
        W(0xfffffffe), W(0x0f000001),   /* all 2.04-compliant and earlier */
-       5 - 1,                          /* 5 option vectors */
+       6 - 1,                          /* 6 option vectors */
 
        /* option vector 1: processor architectures supported */
        3 - 2,                          /* length */
@@ -697,12 +700,29 @@ static unsigned char ibm_architecture_vec[] = {
        0,                              /* don't halt */
 
        /* option vector 5: PAPR/OF options */
-       5 - 2,                          /* length */
+       13 - 2,                         /* length */
        0,                              /* don't ignore, don't halt */
        OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
        OV5_DONATE_DEDICATE_CPU | OV5_MSI,
        0,
        OV5_CMO,
+       0,
+       0,
+       0,
+       0,
+       /* WARNING: The offset of the "number of cores" field below
+        * must match by the macro below. Update the definition if
+        * the structure layout changes.
+        */
+#define IBM_ARCH_VEC_NRCORES_OFFSET    100
+       W(NR_CPUS),                     /* number of cores supported */
+
+       /* option vector 6: IBM PAPR hints */
+       4 - 2,                          /* length */
+       0,
+       0,
+       OV6_LINUX,
+
 };
 
 /* Old method - ELF header with PT_NOTE sections */
@@ -792,13 +812,70 @@ static struct fake_elf {
        }
 };
 
+static int __init prom_count_smt_threads(void)
+{
+       phandle node;
+       char type[64];
+       unsigned int plen;
+
+       /* Pick up th first CPU node we can find */
+       for (node = 0; prom_next_node(&node); ) {
+               type[0] = 0;
+               prom_getprop(node, "device_type", type, sizeof(type));
+
+               if (strcmp(type, RELOC("cpu")))
+                       continue;
+               /*
+                * There is an entry for each smt thread, each entry being
+                * 4 bytes long.  All cpus should have the same number of
+                * smt threads, so return after finding the first.
+                */
+               plen = prom_getproplen(node, "ibm,ppc-interrupt-server#s");
+               if (plen == PROM_ERROR)
+                       break;
+               plen >>= 2;
+               prom_debug("Found 0x%x smt threads per core\n", (unsigned long)plen);
+
+               /* Sanity check */
+               if (plen < 1 || plen > 64) {
+                       prom_printf("Threads per core 0x%x out of bounds, assuming 1\n",
+                                   (unsigned long)plen);
+                       return 1;
+               }
+               return plen;
+       }
+       prom_debug("No threads found, assuming 1 per core\n");
+
+       return 1;
+
+}
+
+
 static void __init prom_send_capabilities(void)
 {
        ihandle elfloader, root;
        prom_arg_t ret;
+       u32 *cores;
 
        root = call_prom("open", 1, 1, ADDR("/"));
        if (root != 0) {
+               /* We need to tell the FW about the number of cores we support.
+                *
+                * To do that, we count the number of threads on the first core
+                * (we assume this is the same for all cores) and use it to
+                * divide NR_CPUS.
+                */
+               cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
+               if (*cores != NR_CPUS) {
+                       prom_printf("WARNING ! "
+                                   "ibm_architecture_vec structure inconsistent: 0x%x !\n",
+                                   *cores);
+               } else {
+                       *cores = NR_CPUS / prom_count_smt_threads();
+                       prom_printf("Max number of cores passed to firmware: 0x%x\n",
+                                   (unsigned long)*cores);
+               }
+
                /* try calling the ibm,client-architecture-support method */
                prom_printf("Calling ibm,client-architecture-support...");
                if (call_prom_ret("call-method", 3, 2, &ret,
index ef149880c145bf5d0ac639e87ba57c094b86bf51..d9b05866615f8cce01ca53a977adf3dd05676735 100644 (file)
@@ -46,7 +46,7 @@
 /*
  * Set of msr bits that gdb can change on behalf of a process.
  */
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
 #define MSR_DEBUGCHANGE        0
 #else
 #define MSR_DEBUGCHANGE        (MSR_SE | MSR_BE)
@@ -703,7 +703,7 @@ void user_enable_single_step(struct task_struct *task)
        struct pt_regs *regs = task->thread.regs;
 
        if (regs != NULL) {
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                task->thread.dbcr0 &= ~DBCR0_BT;
                task->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC;
                regs->msr |= MSR_DE;
@@ -720,7 +720,7 @@ void user_enable_block_step(struct task_struct *task)
        struct pt_regs *regs = task->thread.regs;
 
        if (regs != NULL) {
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                task->thread.dbcr0 &= ~DBCR0_IC;
                task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT;
                regs->msr |= MSR_DE;
@@ -737,17 +737,25 @@ void user_disable_single_step(struct task_struct *task)
        struct pt_regs *regs = task->thread.regs;
 
        if (regs != NULL) {
-#if defined(CONFIG_BOOKE)
-               /* If DAC don't clear DBCRO_IDM or MSR_DE */
-               if (task->thread.dabr)
-                       task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT);
-               else {
-                       task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM);
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+               /*
+                * The logic to disable single stepping should be as
+                * simple as turning off the Instruction Complete flag.
+                * And, after doing so, if all debug flags are off, turn
+                * off DBCR0(IDM) and MSR(DE) .... Torez
+                */
+               task->thread.dbcr0 &= ~DBCR0_IC;
+               /*
+                * Test to see if any of the DBCR_ACTIVE_EVENTS bits are set.
+                */
+               if (!DBCR_ACTIVE_EVENTS(task->thread.dbcr0,
+                                       task->thread.dbcr1)) {
+                       /*
+                        * All debug events were off.....
+                        */
+                       task->thread.dbcr0 &= ~DBCR0_IDM;
                        regs->msr &= ~MSR_DE;
                }
-#elif defined(CONFIG_40x)
-               task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM);
-               regs->msr &= ~MSR_DE;
 #else
                regs->msr &= ~(MSR_SE | MSR_BE);
 #endif
@@ -769,8 +777,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
        if ((data & ~0x7UL) >= TASK_SIZE)
                return -EIO;
 
-#ifndef CONFIG_BOOKE
-
+#ifndef CONFIG_PPC_ADV_DEBUG_REGS
        /* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
         *  It was assumed, on previous implementations, that 3 bits were
         *  passed together with the data address, fitting the design of the
@@ -789,21 +796,22 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 
        /* Move contents to the DABR register */
        task->thread.dabr = data;
-
-#endif
-#if defined(CONFIG_BOOKE)
-
+#else /* CONFIG_PPC_ADV_DEBUG_REGS */
        /* As described above, it was assumed 3 bits were passed with the data
         *  address, but we will assume only the mode bits will be passed
         *  as to not cause alignment restrictions for DAC-based processors.
         */
 
        /* DAC's hold the whole address without any mode flags */
-       task->thread.dabr = data & ~0x3UL;
-
-       if (task->thread.dabr == 0) {
-               task->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W | DBCR0_IDM);
-               task->thread.regs->msr &= ~MSR_DE;
+       task->thread.dac1 = data & ~0x3UL;
+
+       if (task->thread.dac1 == 0) {
+               dbcr_dac(task) &= ~(DBCR_DAC1R | DBCR_DAC1W);
+               if (!DBCR_ACTIVE_EVENTS(task->thread.dbcr0,
+                                       task->thread.dbcr1)) {
+                       task->thread.regs->msr &= ~MSR_DE;
+                       task->thread.dbcr0 &= ~DBCR0_IDM;
+               }
                return 0;
        }
 
@@ -814,17 +822,17 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 
        /* Set the Internal Debugging flag (IDM bit 1) for the DBCR0
           register */
-       task->thread.dbcr0 = DBCR0_IDM;
+       task->thread.dbcr0 |= DBCR0_IDM;
 
        /* Check for write and read flags and set DBCR0
           accordingly */
+       dbcr_dac(task) &= ~(DBCR_DAC1R|DBCR_DAC1W);
        if (data & 0x1UL)
-               task->thread.dbcr0 |= DBSR_DAC1R;
+               dbcr_dac(task) |= DBCR_DAC1R;
        if (data & 0x2UL)
-               task->thread.dbcr0 |= DBSR_DAC1W;
-
+               dbcr_dac(task) |= DBCR_DAC1W;
        task->thread.regs->msr |= MSR_DE;
-#endif
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
        return 0;
 }
 
@@ -839,6 +847,394 @@ void ptrace_disable(struct task_struct *child)
        user_disable_single_step(child);
 }
 
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+static long set_intruction_bp(struct task_struct *child,
+                             struct ppc_hw_breakpoint *bp_info)
+{
+       int slot;
+       int slot1_in_use = ((child->thread.dbcr0 & DBCR0_IAC1) != 0);
+       int slot2_in_use = ((child->thread.dbcr0 & DBCR0_IAC2) != 0);
+       int slot3_in_use = ((child->thread.dbcr0 & DBCR0_IAC3) != 0);
+       int slot4_in_use = ((child->thread.dbcr0 & DBCR0_IAC4) != 0);
+
+       if (dbcr_iac_range(child) & DBCR_IAC12MODE)
+               slot2_in_use = 1;
+       if (dbcr_iac_range(child) & DBCR_IAC34MODE)
+               slot4_in_use = 1;
+
+       if (bp_info->addr >= TASK_SIZE)
+               return -EIO;
+
+       if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
+
+               /* Make sure range is valid. */
+               if (bp_info->addr2 >= TASK_SIZE)
+                       return -EIO;
+
+               /* We need a pair of IAC regsisters */
+               if ((!slot1_in_use) && (!slot2_in_use)) {
+                       slot = 1;
+                       child->thread.iac1 = bp_info->addr;
+                       child->thread.iac2 = bp_info->addr2;
+                       child->thread.dbcr0 |= DBCR0_IAC1;
+                       if (bp_info->addr_mode ==
+                                       PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
+                               dbcr_iac_range(child) |= DBCR_IAC12X;
+                       else
+                               dbcr_iac_range(child) |= DBCR_IAC12I;
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+               } else if ((!slot3_in_use) && (!slot4_in_use)) {
+                       slot = 3;
+                       child->thread.iac3 = bp_info->addr;
+                       child->thread.iac4 = bp_info->addr2;
+                       child->thread.dbcr0 |= DBCR0_IAC3;
+                       if (bp_info->addr_mode ==
+                                       PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
+                               dbcr_iac_range(child) |= DBCR_IAC34X;
+                       else
+                               dbcr_iac_range(child) |= DBCR_IAC34I;
+#endif
+               } else
+                       return -ENOSPC;
+       } else {
+               /* We only need one.  If possible leave a pair free in
+                * case a range is needed later
+                */
+               if (!slot1_in_use) {
+                       /*
+                        * Don't use iac1 if iac1-iac2 are free and either
+                        * iac3 or iac4 (but not both) are free
+                        */
+                       if (slot2_in_use || (slot3_in_use == slot4_in_use)) {
+                               slot = 1;
+                               child->thread.iac1 = bp_info->addr;
+                               child->thread.dbcr0 |= DBCR0_IAC1;
+                               goto out;
+                       }
+               }
+               if (!slot2_in_use) {
+                       slot = 2;
+                       child->thread.iac2 = bp_info->addr;
+                       child->thread.dbcr0 |= DBCR0_IAC2;
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+               } else if (!slot3_in_use) {
+                       slot = 3;
+                       child->thread.iac3 = bp_info->addr;
+                       child->thread.dbcr0 |= DBCR0_IAC3;
+               } else if (!slot4_in_use) {
+                       slot = 4;
+                       child->thread.iac4 = bp_info->addr;
+                       child->thread.dbcr0 |= DBCR0_IAC4;
+#endif
+               } else
+                       return -ENOSPC;
+       }
+out:
+       child->thread.dbcr0 |= DBCR0_IDM;
+       child->thread.regs->msr |= MSR_DE;
+
+       return slot;
+}
+
+static int del_instruction_bp(struct task_struct *child, int slot)
+{
+       switch (slot) {
+       case 1:
+               if (child->thread.iac1 == 0)
+                       return -ENOENT;
+
+               if (dbcr_iac_range(child) & DBCR_IAC12MODE) {
+                       /* address range - clear slots 1 & 2 */
+                       child->thread.iac2 = 0;
+                       dbcr_iac_range(child) &= ~DBCR_IAC12MODE;
+               }
+               child->thread.iac1 = 0;
+               child->thread.dbcr0 &= ~DBCR0_IAC1;
+               break;
+       case 2:
+               if (child->thread.iac2 == 0)
+                       return -ENOENT;
+
+               if (dbcr_iac_range(child) & DBCR_IAC12MODE)
+                       /* used in a range */
+                       return -EINVAL;
+               child->thread.iac2 = 0;
+               child->thread.dbcr0 &= ~DBCR0_IAC2;
+               break;
+#if CONFIG_PPC_ADV_DEBUG_IACS > 2
+       case 3:
+               if (child->thread.iac3 == 0)
+                       return -ENOENT;
+
+               if (dbcr_iac_range(child) & DBCR_IAC34MODE) {
+                       /* address range - clear slots 3 & 4 */
+                       child->thread.iac4 = 0;
+                       dbcr_iac_range(child) &= ~DBCR_IAC34MODE;
+               }
+               child->thread.iac3 = 0;
+               child->thread.dbcr0 &= ~DBCR0_IAC3;
+               break;
+       case 4:
+               if (child->thread.iac4 == 0)
+                       return -ENOENT;
+
+               if (dbcr_iac_range(child) & DBCR_IAC34MODE)
+                       /* Used in a range */
+                       return -EINVAL;
+               child->thread.iac4 = 0;
+               child->thread.dbcr0 &= ~DBCR0_IAC4;
+               break;
+#endif
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
+static int set_dac(struct task_struct *child, struct ppc_hw_breakpoint *bp_info)
+{
+       int byte_enable =
+               (bp_info->condition_mode >> PPC_BREAKPOINT_CONDITION_BE_SHIFT)
+               & 0xf;
+       int condition_mode =
+               bp_info->condition_mode & PPC_BREAKPOINT_CONDITION_MODE;
+       int slot;
+
+       if (byte_enable && (condition_mode == 0))
+               return -EINVAL;
+
+       if (bp_info->addr >= TASK_SIZE)
+               return -EIO;
+
+       if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0) {
+               slot = 1;
+               if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
+                       dbcr_dac(child) |= DBCR_DAC1R;
+               if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
+                       dbcr_dac(child) |= DBCR_DAC1W;
+               child->thread.dac1 = (unsigned long)bp_info->addr;
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+               if (byte_enable) {
+                       child->thread.dvc1 =
+                               (unsigned long)bp_info->condition_value;
+                       child->thread.dbcr2 |=
+                               ((byte_enable << DBCR2_DVC1BE_SHIFT) |
+                                (condition_mode << DBCR2_DVC1M_SHIFT));
+               }
+#endif
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+       } else if (child->thread.dbcr2 & DBCR2_DAC12MODE) {
+               /* Both dac1 and dac2 are part of a range */
+               return -ENOSPC;
+#endif
+       } else if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0) {
+               slot = 2;
+               if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
+                       dbcr_dac(child) |= DBCR_DAC2R;
+               if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
+                       dbcr_dac(child) |= DBCR_DAC2W;
+               child->thread.dac2 = (unsigned long)bp_info->addr;
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+               if (byte_enable) {
+                       child->thread.dvc2 =
+                               (unsigned long)bp_info->condition_value;
+                       child->thread.dbcr2 |=
+                               ((byte_enable << DBCR2_DVC2BE_SHIFT) |
+                                (condition_mode << DBCR2_DVC2M_SHIFT));
+               }
+#endif
+       } else
+               return -ENOSPC;
+       child->thread.dbcr0 |= DBCR0_IDM;
+       child->thread.regs->msr |= MSR_DE;
+
+       return slot + 4;
+}
+
+static int del_dac(struct task_struct *child, int slot)
+{
+       if (slot == 1) {
+               if (child->thread.dac1 == 0)
+                       return -ENOENT;
+
+               child->thread.dac1 = 0;
+               dbcr_dac(child) &= ~(DBCR_DAC1R | DBCR_DAC1W);
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+               if (child->thread.dbcr2 & DBCR2_DAC12MODE) {
+                       child->thread.dac2 = 0;
+                       child->thread.dbcr2 &= ~DBCR2_DAC12MODE;
+               }
+               child->thread.dbcr2 &= ~(DBCR2_DVC1M | DBCR2_DVC1BE);
+#endif
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+               child->thread.dvc1 = 0;
+#endif
+       } else if (slot == 2) {
+               if (child->thread.dac1 == 0)
+                       return -ENOENT;
+
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+               if (child->thread.dbcr2 & DBCR2_DAC12MODE)
+                       /* Part of a range */
+                       return -EINVAL;
+               child->thread.dbcr2 &= ~(DBCR2_DVC2M | DBCR2_DVC2BE);
+#endif
+#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
+               child->thread.dvc2 = 0;
+#endif
+               child->thread.dac2 = 0;
+               dbcr_dac(child) &= ~(DBCR_DAC2R | DBCR_DAC2W);
+       } else
+               return -EINVAL;
+
+       return 0;
+}
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
+
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+static int set_dac_range(struct task_struct *child,
+                        struct ppc_hw_breakpoint *bp_info)
+{
+       int mode = bp_info->addr_mode & PPC_BREAKPOINT_MODE_MASK;
+
+       /* We don't allow range watchpoints to be used with DVC */
+       if (bp_info->condition_mode)
+               return -EINVAL;
+
+       /*
+        * Best effort to verify the address range.  The user/supervisor bits
+        * prevent trapping in kernel space, but let's fail on an obvious bad
+        * range.  The simple test on the mask is not fool-proof, and any
+        * exclusive range will spill over into kernel space.
+        */
+       if (bp_info->addr >= TASK_SIZE)
+               return -EIO;
+       if (mode == PPC_BREAKPOINT_MODE_MASK) {
+               /*
+                * dac2 is a bitmask.  Don't allow a mask that makes a
+                * kernel space address from a valid dac1 value
+                */
+               if (~((unsigned long)bp_info->addr2) >= TASK_SIZE)
+                       return -EIO;
+       } else {
+               /*
+                * For range breakpoints, addr2 must also be a valid address
+                */
+               if (bp_info->addr2 >= TASK_SIZE)
+                       return -EIO;
+       }
+
+       if (child->thread.dbcr0 &
+           (DBCR0_DAC1R | DBCR0_DAC1W | DBCR0_DAC2R | DBCR0_DAC2W))
+               return -ENOSPC;
+
+       if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
+               child->thread.dbcr0 |= (DBCR0_DAC1R | DBCR0_IDM);
+       if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
+               child->thread.dbcr0 |= (DBCR0_DAC1W | DBCR0_IDM);
+       child->thread.dac1 = bp_info->addr;
+       child->thread.dac2 = bp_info->addr2;
+       if (mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE)
+               child->thread.dbcr2  |= DBCR2_DAC12M;
+       else if (mode == PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
+               child->thread.dbcr2  |= DBCR2_DAC12MX;
+       else    /* PPC_BREAKPOINT_MODE_MASK */
+               child->thread.dbcr2  |= DBCR2_DAC12MM;
+       child->thread.regs->msr |= MSR_DE;
+
+       return 5;
+}
+#endif /* CONFIG_PPC_ADV_DEBUG_DAC_RANGE */
+
+static long ppc_set_hwdebug(struct task_struct *child,
+                    struct ppc_hw_breakpoint *bp_info)
+{
+       if (bp_info->version != 1)
+               return -ENOTSUPP;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+       /*
+        * Check for invalid flags and combinations
+        */
+       if ((bp_info->trigger_type == 0) ||
+           (bp_info->trigger_type & ~(PPC_BREAKPOINT_TRIGGER_EXECUTE |
+                                      PPC_BREAKPOINT_TRIGGER_RW)) ||
+           (bp_info->addr_mode & ~PPC_BREAKPOINT_MODE_MASK) ||
+           (bp_info->condition_mode &
+            ~(PPC_BREAKPOINT_CONDITION_MODE |
+              PPC_BREAKPOINT_CONDITION_BE_ALL)))
+               return -EINVAL;
+#if CONFIG_PPC_ADV_DEBUG_DVCS == 0
+       if (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)
+               return -EINVAL;
+#endif
+
+       if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_EXECUTE) {
+               if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) ||
+                   (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE))
+                       return -EINVAL;
+               return set_intruction_bp(child, bp_info);
+       }
+       if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
+               return set_dac(child, bp_info);
+
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+       return set_dac_range(child, bp_info);
+#else
+       return -EINVAL;
+#endif
+#else /* !CONFIG_PPC_ADV_DEBUG_DVCS */
+       /*
+        * We only support one data breakpoint
+        */
+       if (((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0) ||
+           ((bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0) ||
+           (bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_WRITE) ||
+           (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) ||
+           (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE))
+               return -EINVAL;
+
+       if (child->thread.dabr)
+               return -ENOSPC;
+
+       if ((unsigned long)bp_info->addr >= TASK_SIZE)
+               return -EIO;
+
+       child->thread.dabr = (unsigned long)bp_info->addr;
+
+       return 1;
+#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
+}
+
+static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
+{
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+       int rc;
+
+       if (data <= 4)
+               rc = del_instruction_bp(child, (int)data);
+       else
+               rc = del_dac(child, (int)data - 4);
+
+       if (!rc) {
+               if (!DBCR_ACTIVE_EVENTS(child->thread.dbcr0,
+                                       child->thread.dbcr1)) {
+                       child->thread.dbcr0 &= ~DBCR0_IDM;
+                       child->thread.regs->msr &= ~MSR_DE;
+               }
+       }
+       return rc;
+#else
+       if (data != 1)
+               return -EINVAL;
+       if (child->thread.dabr == 0)
+               return -ENOENT;
+
+       child->thread.dabr = 0;
+
+       return 0;
+#endif
+}
+
 /*
  * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
  * we mark them as obsolete now, they will be removed in a future version
@@ -932,13 +1328,77 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
        }
 
+       case PPC_PTRACE_GETHWDBGINFO: {
+               struct ppc_debug_info dbginfo;
+
+               dbginfo.version = 1;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+               dbginfo.num_instruction_bps = CONFIG_PPC_ADV_DEBUG_IACS;
+               dbginfo.num_data_bps = CONFIG_PPC_ADV_DEBUG_DACS;
+               dbginfo.num_condition_regs = CONFIG_PPC_ADV_DEBUG_DVCS;
+               dbginfo.data_bp_alignment = 4;
+               dbginfo.sizeof_condition = 4;
+               dbginfo.features = PPC_DEBUG_FEATURE_INSN_BP_RANGE |
+                                  PPC_DEBUG_FEATURE_INSN_BP_MASK;
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+               dbginfo.features |=
+                                  PPC_DEBUG_FEATURE_DATA_BP_RANGE |
+                                  PPC_DEBUG_FEATURE_DATA_BP_MASK;
+#endif
+#else /* !CONFIG_PPC_ADV_DEBUG_REGS */
+               dbginfo.num_instruction_bps = 0;
+               dbginfo.num_data_bps = 1;
+               dbginfo.num_condition_regs = 0;
+#ifdef CONFIG_PPC64
+               dbginfo.data_bp_alignment = 8;
+#else
+               dbginfo.data_bp_alignment = 4;
+#endif
+               dbginfo.sizeof_condition = 0;
+               dbginfo.features = 0;
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
+
+               if (!access_ok(VERIFY_WRITE, data,
+                              sizeof(struct ppc_debug_info)))
+                       return -EFAULT;
+               ret = __copy_to_user((struct ppc_debug_info __user *)data,
+                                    &dbginfo, sizeof(struct ppc_debug_info)) ?
+                     -EFAULT : 0;
+               break;
+       }
+
+       case PPC_PTRACE_SETHWDEBUG: {
+               struct ppc_hw_breakpoint bp_info;
+
+               if (!access_ok(VERIFY_READ, data,
+                              sizeof(struct ppc_hw_breakpoint)))
+                       return -EFAULT;
+               ret = __copy_from_user(&bp_info,
+                                      (struct ppc_hw_breakpoint __user *)data,
+                                      sizeof(struct ppc_hw_breakpoint)) ?
+                     -EFAULT : 0;
+               if (!ret)
+                       ret = ppc_set_hwdebug(child, &bp_info);
+               break;
+       }
+
+       case PPC_PTRACE_DELHWDEBUG: {
+               ret = ppc_del_hwdebug(child, addr, data);
+               break;
+       }
+
        case PTRACE_GET_DEBUGREG: {
                ret = -EINVAL;
                /* We only support one DABR and no IABRS at the moment */
                if (addr > 0)
                        break;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+               ret = put_user(child->thread.dac1,
+                              (unsigned long __user *)data);
+#else
                ret = put_user(child->thread.dabr,
                               (unsigned long __user *)data);
+#endif
                break;
        }
 
index 1be9fe38bcb570f990f5b5f462913c3c75929ef1..8777fb02349f29055b68f4f65aaa67140131cfd0 100644 (file)
@@ -262,19 +262,19 @@ static int __init proc_rtas_init(void)
        if (rtas_node == NULL)
                return -ENODEV;
 
-       proc_create("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL,
+       proc_create("powerpc/rtas/progress", S_IRUGO|S_IWUSR, NULL,
                    &ppc_rtas_progress_operations);
-       proc_create("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL,
+       proc_create("powerpc/rtas/clock", S_IRUGO|S_IWUSR, NULL,
                    &ppc_rtas_clock_operations);
-       proc_create("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL,
+       proc_create("powerpc/rtas/poweron", S_IWUSR|S_IRUGO, NULL,
                    &ppc_rtas_poweron_operations);
-       proc_create("ppc64/rtas/sensors", S_IRUGO, NULL,
+       proc_create("powerpc/rtas/sensors", S_IRUGO, NULL,
                    &ppc_rtas_sensors_operations);
-       proc_create("ppc64/rtas/frequency", S_IWUSR|S_IRUGO, NULL,
+       proc_create("powerpc/rtas/frequency", S_IWUSR|S_IRUGO, NULL,
                    &ppc_rtas_tone_freq_operations);
-       proc_create("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL,
+       proc_create("powerpc/rtas/volume", S_IWUSR|S_IRUGO, NULL,
                    &ppc_rtas_tone_volume_operations);
-       proc_create("ppc64/rtas/rmo_buffer", S_IRUSR, NULL,
+       proc_create("powerpc/rtas/rmo_buffer", S_IRUSR, NULL,
                    &ppc_rtas_rmo_buf_ops);
        return 0;
 }
index 00b5078da9a3f10f2e34ba160c72db098f67c612..a0afb555a7c98c28533e3fd48c55acb630cc142e 100644 (file)
@@ -140,17 +140,15 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
                return 0;               /* no signals delivered */
        }
 
+#ifndef CONFIG_PPC_ADV_DEBUG_REGS
         /*
         * Reenable the DABR before delivering the signal to
         * user space. The DABR will have been cleared if it
         * triggered inside the kernel.
         */
-       if (current->thread.dabr) {
+       if (current->thread.dabr)
                set_dabr(current->thread.dabr);
-#if defined(CONFIG_BOOKE)
-               mtspr(SPRN_DBCR0, current->thread.dbcr0);
 #endif
-       }
 
        if (is32) {
                if (ka.sa.sa_flags & SA_SIGINFO)
index d670429a1608fe32a37a0b645df09aff7b904107..266610119f664970c66b72832ebb571eb842b1bc 100644 (file)
@@ -1078,7 +1078,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
        int i;
        unsigned char tmp;
        unsigned long new_msr = regs->msr;
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
        unsigned long new_dbcr0 = current->thread.dbcr0;
 #endif
 
@@ -1087,13 +1087,17 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
                        return -EFAULT;
                switch (op.dbg_type) {
                case SIG_DBG_SINGLE_STEPPING:
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                        if (op.dbg_value) {
                                new_msr |= MSR_DE;
                                new_dbcr0 |= (DBCR0_IDM | DBCR0_IC);
                        } else {
-                               new_msr &= ~MSR_DE;
-                               new_dbcr0 &= ~(DBCR0_IDM | DBCR0_IC);
+                               new_dbcr0 &= ~DBCR0_IC;
+                               if (!DBCR_ACTIVE_EVENTS(new_dbcr0,
+                                               current->thread.dbcr1)) {
+                                       new_msr &= ~MSR_DE;
+                                       new_dbcr0 &= ~DBCR0_IDM;
+                               }
                        }
 #else
                        if (op.dbg_value)
@@ -1103,7 +1107,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
 #endif
                        break;
                case SIG_DBG_BRANCH_TRACING:
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
                        return -EINVAL;
 #else
                        if (op.dbg_value)
@@ -1124,7 +1128,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
           failure is a problem, anyway, and it's very unlikely unless
           the user is really doing something wrong. */
        regs->msr = new_msr;
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
        current->thread.dbcr0 = new_dbcr0;
 #endif
 
index a521fb8a40ee2fcb206397cf490aab9550cf9c96..c2ee1449807766cd24969621c31469386f208ebb 100644 (file)
@@ -619,4 +619,16 @@ void __cpu_die(unsigned int cpu)
        if (smp_ops->cpu_die)
                smp_ops->cpu_die(cpu);
 }
+
+static DEFINE_MUTEX(powerpc_cpu_hotplug_driver_mutex);
+
+void cpu_hotplug_driver_lock()
+{
+       mutex_lock(&powerpc_cpu_hotplug_driver_mutex);
+}
+
+void cpu_hotplug_driver_unlock()
+{
+       mutex_unlock(&powerpc_cpu_hotplug_driver_mutex);
+}
 #endif
index b47d8ceffb5232e21e8990b86ea29d18f2f16024..b0754e237438a0c9e3e919c738231c58eb3c5df4 100644 (file)
@@ -303,7 +303,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
        lis     r4,0x1000
 1:     addic.  r4,r4,-0x1000
        tlbie   r4
-       blt     1b
+       bgt     1b
        sync
 
        /* restore the MSR and turn on the MMU */
index 9ba2cc88591d66f276eaf81e5f3c31948312731d..1b16b9a3e49a57dbc0e444e230528763b1faa762 100644 (file)
@@ -265,8 +265,8 @@ void account_system_vtime(struct task_struct *tsk)
                account_system_time(tsk, 0, delta, deltascaled);
        else
                account_idle_time(delta);
-       per_cpu(cputime_last_delta, smp_processor_id()) = delta;
-       per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
+       __get_cpu_var(cputime_last_delta) = delta;
+       __get_cpu_var(cputime_scaled_last_delta) = deltascaled;
        local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(account_system_vtime);
@@ -575,6 +575,8 @@ void timer_interrupt(struct pt_regs * regs)
 
        trace_timer_interrupt_entry(regs);
 
+       __get_cpu_var(irq_stat).timer_irqs++;
+
        /* Ensure a positive value is written to the decrementer, or else
         * some CPUs will continuue to take decrementer exceptions */
        set_dec(DECREMENTER_MAX);
@@ -903,12 +905,21 @@ static void decrementer_set_mode(enum clock_event_mode mode,
                decrementer_set_next_event(DECREMENTER_MAX, dev);
 }
 
+static inline uint64_t div_sc64(unsigned long ticks, unsigned long nsec,
+                               int shift)
+{
+       uint64_t tmp = ((uint64_t)ticks) << shift;
+
+       do_div(tmp, nsec);
+       return tmp;
+}
+
 static void __init setup_clockevent_multiplier(unsigned long hz)
 {
        u64 mult, shift = 32;
 
        while (1) {
-               mult = div_sc(hz, NSEC_PER_SEC, shift);
+               mult = div_sc64(hz, NSEC_PER_SEC, shift);
                if (mult && (mult >> 32UL) == 0UL)
                        break;
 
@@ -926,8 +937,8 @@ static void register_decrementer_clockevent(int cpu)
        *dec = decrementer_clockevent;
        dec->cpumask = cpumask_of(cpu);
 
-       printk(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
-              dec->name, dec->mult, dec->shift, cpu);
+       printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
+                   dec->name, dec->mult, dec->shift, cpu);
 
        clockevents_register_device(dec);
 }
index d069ff8a7e036c0022fe1e9f3a62112713033af6..696626a2e83536f90364dc1c5a0f3136ab8cf8f0 100644 (file)
 #endif
 
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
-int (*__debugger)(struct pt_regs *regs);
-int (*__debugger_ipi)(struct pt_regs *regs);
-int (*__debugger_bpt)(struct pt_regs *regs);
-int (*__debugger_sstep)(struct pt_regs *regs);
-int (*__debugger_iabr_match)(struct pt_regs *regs);
-int (*__debugger_dabr_match)(struct pt_regs *regs);
-int (*__debugger_fault_handler)(struct pt_regs *regs);
+int (*__debugger)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_ipi)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_bpt)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_sstep)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_iabr_match)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_dabr_match)(struct pt_regs *regs) __read_mostly;
+int (*__debugger_fault_handler)(struct pt_regs *regs) __read_mostly;
 
 EXPORT_SYMBOL(__debugger);
 EXPORT_SYMBOL(__debugger_ipi);
@@ -102,11 +102,11 @@ static inline void pmac_backlight_unblank(void) { }
 int die(const char *str, struct pt_regs *regs, long err)
 {
        static struct {
-               spinlock_t lock;
+               raw_spinlock_t lock;
                u32 lock_owner;
                int lock_owner_depth;
        } die = {
-               .lock =                 __SPIN_LOCK_UNLOCKED(die.lock),
+               .lock =                 __RAW_SPIN_LOCK_UNLOCKED(die.lock),
                .lock_owner =           -1,
                .lock_owner_depth =     0
        };
@@ -120,7 +120,7 @@ int die(const char *str, struct pt_regs *regs, long err)
 
        if (die.lock_owner != raw_smp_processor_id()) {
                console_verbose();
-               spin_lock_irqsave(&die.lock, flags);
+               raw_spin_lock_irqsave(&die.lock, flags);
                die.lock_owner = smp_processor_id();
                die.lock_owner_depth = 0;
                bust_spinlocks(1);
@@ -146,6 +146,11 @@ int die(const char *str, struct pt_regs *regs, long err)
 #endif
                printk("%s\n", ppc_md.name ? ppc_md.name : "");
 
+               sysfs_printk_last_file();
+               if (notify_die(DIE_OOPS, str, regs, err, 255,
+                              SIGSEGV) == NOTIFY_STOP)
+                       return 1;
+
                print_modules();
                show_regs(regs);
        } else {
@@ -155,7 +160,7 @@ int die(const char *str, struct pt_regs *regs, long err)
        bust_spinlocks(0);
        die.lock_owner = -1;
        add_taint(TAINT_DIE);
-       spin_unlock_irqrestore(&die.lock, flags);
+       raw_spin_unlock_irqrestore(&die.lock, flags);
 
        if (kexec_should_crash(current) ||
                kexec_sr_activated(smp_processor_id()))
@@ -294,7 +299,7 @@ static inline int check_io_access(struct pt_regs *regs)
        return 0;
 }
 
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
 /* On 4xx, the reason for the machine check or program exception
    is in the ESR. */
 #define get_reason(regs)       ((regs)->dsisr)
@@ -478,6 +483,8 @@ void machine_check_exception(struct pt_regs *regs)
 {
        int recover = 0;
 
+       __get_cpu_var(irq_stat).mce_exceptions++;
+
        /* See if any machine dependent calls. In theory, we would want
         * to call the CPU first, and call the ppc_md. one if the CPU
         * one returns a positive number. However there is existing code
@@ -960,6 +967,8 @@ void vsx_unavailable_exception(struct pt_regs *regs)
 
 void performance_monitor_exception(struct pt_regs *regs)
 {
+       __get_cpu_var(irq_stat).pmu_irqs++;
+
        perf_irq(regs);
 }
 
@@ -1024,10 +1033,69 @@ void SoftwareEmulation(struct pt_regs *regs)
 }
 #endif /* CONFIG_8xx */
 
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+static void handle_debug(struct pt_regs *regs, unsigned long debug_status)
+{
+       int changed = 0;
+       /*
+        * Determine the cause of the debug event, clear the
+        * event flags and send a trap to the handler. Torez
+        */
+       if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) {
+               dbcr_dac(current) &= ~(DBCR_DAC1R | DBCR_DAC1W);
+#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
+               current->thread.dbcr2 &= ~DBCR2_DAC12MODE;
+#endif
+               do_send_trap(regs, mfspr(SPRN_DAC1), debug_status, TRAP_HWBKPT,
+                            5);
+               changed |= 0x01;
+       }  else if (debug_status & (DBSR_DAC2R | DBSR_DAC2W)) {
+               dbcr_dac(current) &= ~(DBCR_DAC2R | DBCR_DAC2W);
+               do_send_trap(regs, mfspr(SPRN_DAC2), debug_status, TRAP_HWBKPT,
+                            6);
+               changed |= 0x01;
+       }  else if (debug_status & DBSR_IAC1) {
+               current->thread.dbcr0 &= ~DBCR0_IAC1;
+               dbcr_iac_range(current) &= ~DBCR_IAC12MODE;
+               do_send_trap(regs, mfspr(SPRN_IAC1), debug_status, TRAP_HWBKPT,
+                            1);
+               changed |= 0x01;
+       }  else if (debug_status & DBSR_IAC2) {
+               current->thread.dbcr0 &= ~DBCR0_IAC2;
+               do_send_trap(regs, mfspr(SPRN_IAC2), debug_status, TRAP_HWBKPT,
+                            2);
+               changed |= 0x01;
+       }  else if (debug_status & DBSR_IAC3) {
+               current->thread.dbcr0 &= ~DBCR0_IAC3;
+               dbcr_iac_range(current) &= ~DBCR_IAC34MODE;
+               do_send_trap(regs, mfspr(SPRN_IAC3), debug_status, TRAP_HWBKPT,
+                            3);
+               changed |= 0x01;
+       }  else if (debug_status & DBSR_IAC4) {
+               current->thread.dbcr0 &= ~DBCR0_IAC4;
+               do_send_trap(regs, mfspr(SPRN_IAC4), debug_status, TRAP_HWBKPT,
+                            4);
+               changed |= 0x01;
+       }
+       /*
+        * At the point this routine was called, the MSR(DE) was turned off.
+        * Check all other debug flags and see if that bit needs to be turned
+        * back on or not.
+        */
+       if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, current->thread.dbcr1))
+               regs->msr |= MSR_DE;
+       else
+               /* Make sure the IDM flag is off */
+               current->thread.dbcr0 &= ~DBCR0_IDM;
+
+       if (changed & 0x01)
+               mtspr(SPRN_DBCR0, current->thread.dbcr0);
+}
 
 void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status)
 {
+       current->thread.dbsr = debug_status;
+
        /* Hack alert: On BookE, Branch Taken stops on the branch itself, while
         * on server, it stops on the target of the branch. In order to simulate
         * the server behaviour, we thus restart right away with a single step
@@ -1071,29 +1139,23 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status)
                if (debugger_sstep(regs))
                        return;
 
-               if (user_mode(regs))
-                       current->thread.dbcr0 &= ~(DBCR0_IC);
-
-               _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
-       } else if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) {
-               regs->msr &= ~MSR_DE;
-
                if (user_mode(regs)) {
-                       current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W |
-                                                               DBCR0_IDM);
-               } else {
-                       /* Disable DAC interupts */
-                       mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R |
-                                               DBSR_DAC1W | DBCR0_IDM));
-
-                       /* Clear the DAC event */
-                       mtspr(SPRN_DBSR, (DBSR_DAC1R | DBSR_DAC1W));
+                       current->thread.dbcr0 &= ~DBCR0_IC;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+                       if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0,
+                                              current->thread.dbcr1))
+                               regs->msr |= MSR_DE;
+                       else
+                               /* Make sure the IDM bit is off */
+                               current->thread.dbcr0 &= ~DBCR0_IDM;
+#endif
                }
-               /* Setup and send the trap to the handler */
-               do_dabr(regs, mfspr(SPRN_DAC1), debug_status);
-       }
+
+               _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
+       } else
+               handle_debug(regs, debug_status);
 }
-#endif /* CONFIG_4xx || CONFIG_BOOKE */
+#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
 
 #if !defined(CONFIG_TAU_INT)
 void TAUException(struct pt_regs *regs)
index 07703f72330e1f0f468be6a0ce75d4b19a12daa8..6fb6e8aa389039a4258d4a2935817cf1c8428e3e 100644 (file)
@@ -53,7 +53,7 @@ config KVM_440
 
 config KVM_EXIT_TIMING
        bool "Detailed exit timing"
-       depends on KVM
+       depends on KVM_440 || KVM_E500
        ---help---
          Calculate elapsed time for every exit/enter cycle. A per-vcpu
          report is available in debugfs kvm/vm#_vcpu#_timing.
index e68beac0a171f41918e37a47aed0722bc0081218..4d4eeb9004868a3da2f95b7728f4b0d67192a34c 100644 (file)
@@ -43,62 +43,62 @@ END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
        ld      r7,16(r4)
        ldu     r8,24(r4)
 1:     std     r5,8(r3)
-       ld      r9,8(r4)
        std     r6,16(r3)
+       ld      r9,8(r4)
        ld      r10,16(r4)
        std     r7,24(r3)
-       ld      r11,24(r4)
        std     r8,32(r3)
+       ld      r11,24(r4)
        ld      r12,32(r4)
        std     r9,40(r3)
-       ld      r5,40(r4)
        std     r10,48(r3)
+       ld      r5,40(r4)
        ld      r6,48(r4)
        std     r11,56(r3)
-       ld      r7,56(r4)
        std     r12,64(r3)
+       ld      r7,56(r4)
        ld      r8,64(r4)
        std     r5,72(r3)
-       ld      r9,72(r4)
        std     r6,80(r3)
+       ld      r9,72(r4)
        ld      r10,80(r4)
        std     r7,88(r3)
-       ld      r11,88(r4)
        std     r8,96(r3)
+       ld      r11,88(r4)
        ld      r12,96(r4)
        std     r9,104(r3)
-       ld      r5,104(r4)
        std     r10,112(r3)
+       ld      r5,104(r4)
        ld      r6,112(r4)
        std     r11,120(r3)
-       ld      r7,120(r4)
        stdu    r12,128(r3)
+       ld      r7,120(r4)
        ldu     r8,128(r4)
        bdnz    1b
 
        std     r5,8(r3)
-       ld      r9,8(r4)
        std     r6,16(r3)
+       ld      r9,8(r4)
        ld      r10,16(r4)
        std     r7,24(r3)
-       ld      r11,24(r4)
        std     r8,32(r3)
+       ld      r11,24(r4)
        ld      r12,32(r4)
        std     r9,40(r3)
-       ld      r5,40(r4)
        std     r10,48(r3)
+       ld      r5,40(r4)
        ld      r6,48(r4)
        std     r11,56(r3)
-       ld      r7,56(r4)
        std     r12,64(r3)
+       ld      r7,56(r4)
        ld      r8,64(r4)
        std     r5,72(r3)
-       ld      r9,72(r4)
        std     r6,80(r3)
+       ld      r9,72(r4)
        ld      r10,80(r4)
        std     r7,88(r3)
-       ld      r11,88(r4)
        std     r8,96(r3)
+       ld      r11,88(r4)
        ld      r12,96(r4)
        std     r9,104(r3)
        std     r10,112(r3)
index 693b14a778fa152f4c595b22e30ca52bc724bee5..578b625d6a3ca96692db05f62796593a11824348 100644 (file)
@@ -44,37 +44,55 @@ BEGIN_FTR_SECTION
        andi.   r0,r4,7
        bne     .Lsrc_unaligned
 END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
-       srdi    r7,r5,4
-20:    ld      r9,0(r4)
-       addi    r4,r4,-8
-       mtctr   r7
-       andi.   r5,r5,7
-       bf      cr7*4+0,22f
-       addi    r3,r3,8
-       addi    r4,r4,8
-       mr      r8,r9
-       blt     cr1,72f
-21:    ld      r9,8(r4)
-70:    std     r8,8(r3)
-22:    ldu     r8,16(r4)
-71:    stdu    r9,16(r3)
+       blt     cr1,.Ldo_tail           /* if < 16 bytes to copy */
+       srdi    r0,r5,5
+       cmpdi   cr1,r0,0
+20:    ld      r7,0(r4)
+220:   ld      r6,8(r4)
+       addi    r4,r4,16
+       mtctr   r0
+       andi.   r0,r5,0x10
+       beq     22f
+       addi    r3,r3,16
+       addi    r4,r4,-16
+       mr      r9,r7
+       mr      r8,r6
+       beq     cr1,72f
+21:    ld      r7,16(r4)
+221:   ld      r6,24(r4)
+       addi    r4,r4,32
+70:    std     r9,0(r3)
+270:   std     r8,8(r3)
+22:    ld      r9,0(r4)
+222:   ld      r8,8(r4)
+71:    std     r7,16(r3)
+271:   std     r6,24(r3)
+       addi    r3,r3,32
        bdnz    21b
-72:    std     r8,8(r3)
+72:    std     r9,0(r3)
+272:   std     r8,8(r3)
+       andi.   r5,r5,0xf
        beq+    3f
-       addi    r3,r3,16
+       addi    r4,r4,16
 .Ldo_tail:
-       bf      cr7*4+1,1f
-23:    lwz     r9,8(r4)
+       addi    r3,r3,16
+       bf      cr7*4+0,246f
+244:   ld      r9,0(r4)
+       addi    r4,r4,8
+245:   std     r9,0(r3)
+       addi    r3,r3,8
+246:   bf      cr7*4+1,1f
+23:    lwz     r9,0(r4)
        addi    r4,r4,4
 73:    stw     r9,0(r3)
        addi    r3,r3,4
 1:     bf      cr7*4+2,2f
-44:    lhz     r9,8(r4)
+44:    lhz     r9,0(r4)
        addi    r4,r4,2
 74:    sth     r9,0(r3)
        addi    r3,r3,2
 2:     bf      cr7*4+3,3f
-45:    lbz     r9,8(r4)
+45:    lbz     r9,0(r4)
 75:    stb     r9,0(r3)
 3:     li      r3,0
        blr
@@ -220,7 +238,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
 131:
        addi    r3,r3,8
 120:
+320:
 122:
+322:
 124:
 125:
 126:
@@ -229,9 +249,11 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
 129:
 133:
        addi    r3,r3,8
-121:
 132:
        addi    r3,r3,8
+121:
+321:
+344:
 134:
 135:
 138:
@@ -303,18 +325,22 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
 183:
        add     r3,r3,r7
        b       1f
+371:
 180:
        addi    r3,r3,8
 171:
 177:
        addi    r3,r3,8
-170:
-172:
+370:
+372:
 176:
 178:
        addi    r3,r3,4
 185:
        addi    r3,r3,4
+170:
+172:
+345:
 173:
 174:
 175:
@@ -341,11 +367,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
        .section __ex_table,"a"
        .align  3
        .llong  20b,120b
+       .llong  220b,320b
        .llong  21b,121b
+       .llong  221b,321b
        .llong  70b,170b
+       .llong  270b,370b
        .llong  22b,122b
+       .llong  222b,322b
        .llong  71b,171b
+       .llong  271b,371b
        .llong  72b,172b
+       .llong  272b,372b
+       .llong  244b,344b
+       .llong  245b,345b
        .llong  23b,123b
        .llong  73b,173b
        .llong  44b,144b
index 7e8865bcd683a5291861f3d31e07d75d9e98277d..e640175b65ae0fd53836f78df004a46a168bf27e 100644 (file)
@@ -112,7 +112,8 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
 
 void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
 {
-       unsigned int *start, *end, *dest;
+       long *start, *end;
+       unsigned int *dest;
 
        if (!(value & CPU_FTR_LWSYNC))
                return ;
index 08dfa8e6d86fa6a842474074f43d0b77e7d87fe6..65abfcfaaa9e72be187902357b3d29577fd06d28 100644 (file)
@@ -84,8 +84,8 @@ void __init MMU_init_hw(void)
         * vectors and the kernel live in real-mode.
         */
 
-        mtspr(SPRN_DCCR, 0xF0000000);  /* 512 MB of data space at 0x0. */
-        mtspr(SPRN_ICCR, 0xF0000000);  /* 512 MB of instr. space at 0x0. */
+        mtspr(SPRN_DCCR, 0xFFFF0000);  /* 2GByte of data space at 0x0. */
+        mtspr(SPRN_ICCR, 0xFFFF0000);  /* 2GByte of instr. space at 0x0. */
 }
 
 #define LARGE_PAGE_SIZE_16M    (1<<24)
index 056d23a1b105f851757a082bcb04001e374a48b3..784a400e078145acaa90ad839d75e9c494162882 100644 (file)
@@ -37,7 +37,7 @@
 
 #define HPTE_LOCK_BIT 3
 
-static DEFINE_SPINLOCK(native_tlbie_lock);
+static DEFINE_RAW_SPINLOCK(native_tlbie_lock);
 
 static inline void __tlbie(unsigned long va, int psize, int ssize)
 {
@@ -104,7 +104,7 @@ static inline void tlbie(unsigned long va, int psize, int ssize, int local)
        if (use_local)
                use_local = mmu_psize_defs[psize].tlbiel;
        if (lock_tlbie && !use_local)
-               spin_lock(&native_tlbie_lock);
+               raw_spin_lock(&native_tlbie_lock);
        asm volatile("ptesync": : :"memory");
        if (use_local) {
                __tlbiel(va, psize, ssize);
@@ -114,7 +114,7 @@ static inline void tlbie(unsigned long va, int psize, int ssize, int local)
                asm volatile("eieio; tlbsync; ptesync": : :"memory");
        }
        if (lock_tlbie && !use_local)
-               spin_unlock(&native_tlbie_lock);
+               raw_spin_unlock(&native_tlbie_lock);
 }
 
 static inline void native_lock_hpte(struct hash_pte *hptep)
@@ -122,7 +122,7 @@ static inline void native_lock_hpte(struct hash_pte *hptep)
        unsigned long *word = &hptep->v;
 
        while (1) {
-               if (!test_and_set_bit(HPTE_LOCK_BIT, word))
+               if (!test_and_set_bit_lock(HPTE_LOCK_BIT, word))
                        break;
                while(test_bit(HPTE_LOCK_BIT, word))
                        cpu_relax();
@@ -133,8 +133,7 @@ static inline void native_unlock_hpte(struct hash_pte *hptep)
 {
        unsigned long *word = &hptep->v;
 
-       asm volatile("lwsync":::"memory");
-       clear_bit(HPTE_LOCK_BIT, word);
+       clear_bit_unlock(HPTE_LOCK_BIT, word);
 }
 
 static long native_hpte_insert(unsigned long hpte_group, unsigned long va,
@@ -434,7 +433,7 @@ static void native_hpte_clear(void)
        /* we take the tlbie lock and hold it.  Some hardware will
         * deadlock if we try to tlbie from two processors at once.
         */
-       spin_lock(&native_tlbie_lock);
+       raw_spin_lock(&native_tlbie_lock);
 
        slots = pteg_count * HPTES_PER_GROUP;
 
@@ -458,7 +457,7 @@ static void native_hpte_clear(void)
        }
 
        asm volatile("eieio; tlbsync; ptesync":::"memory");
-       spin_unlock(&native_tlbie_lock);
+       raw_spin_unlock(&native_tlbie_lock);
        local_irq_restore(flags);
 }
 
@@ -521,7 +520,7 @@ static void native_flush_hash_range(unsigned long number, int local)
                int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
                if (lock_tlbie)
-                       spin_lock(&native_tlbie_lock);
+                       raw_spin_lock(&native_tlbie_lock);
 
                asm volatile("ptesync":::"memory");
                for (i = 0; i < number; i++) {
@@ -536,7 +535,7 @@ static void native_flush_hash_range(unsigned long number, int local)
                asm volatile("eieio; tlbsync; ptesync":::"memory");
 
                if (lock_tlbie)
-                       spin_unlock(&native_tlbie_lock);
+                       raw_spin_unlock(&native_tlbie_lock);
        }
 
        local_irq_restore(flags);
index 0d957a4c70feda668078a7b412bb29adbd67a5fb..5a783d8e8e8e757719f5b055cf8142d56becc1d9 100644 (file)
@@ -47,7 +47,7 @@ static inline int mmap_is_legacy(void)
        if (current->personality & ADDR_COMPAT_LAYOUT)
                return 1;
 
-       if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
+       if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
                return 1;
 
        return sysctl_legacy_va_layout;
@@ -77,7 +77,7 @@ static unsigned long mmap_rnd(void)
 
 static inline unsigned long mmap_base(void)
 {
-       unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+       unsigned long gap = rlimit(RLIMIT_STACK);
 
        if (gap < MIN_GAP)
                gap = MIN_GAP;
index b910d37aea1aa921b567b0d3a9054b76d9a22ec7..51622daae09d27928591757509c1b23c156decd8 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/mmu_context.h>
 
 static DEFINE_SPINLOCK(mmu_context_lock);
-static DEFINE_IDR(mmu_context_idr);
+static DEFINE_IDA(mmu_context_ida);
 
 /*
  * The proto-VSID space has 2^35 - 1 segments available for user mappings.
@@ -39,11 +39,11 @@ int __init_new_context(void)
        int err;
 
 again:
-       if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL))
+       if (!ida_pre_get(&mmu_context_ida, GFP_KERNEL))
                return -ENOMEM;
 
        spin_lock(&mmu_context_lock);
-       err = idr_get_new_above(&mmu_context_idr, NULL, 1, &index);
+       err = ida_get_new_above(&mmu_context_ida, 1, &index);
        spin_unlock(&mmu_context_lock);
 
        if (err == -EAGAIN)
@@ -53,7 +53,7 @@ again:
 
        if (index > MAX_CONTEXT) {
                spin_lock(&mmu_context_lock);
-               idr_remove(&mmu_context_idr, index);
+               ida_remove(&mmu_context_ida, index);
                spin_unlock(&mmu_context_lock);
                return -ENOMEM;
        }
@@ -85,7 +85,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 void __destroy_context(int context_id)
 {
        spin_lock(&mmu_context_lock);
-       idr_remove(&mmu_context_idr, context_id);
+       ida_remove(&mmu_context_ida, context_id);
        spin_unlock(&mmu_context_lock);
 }
 EXPORT_SYMBOL_GPL(__destroy_context);
index 1044a634b6d0a475d5978aecc8c37115f8c49abd..dbc692145ecb1aea313fc64992010519c73f1c28 100644 (file)
@@ -56,7 +56,7 @@ static unsigned int next_context, nr_free_contexts;
 static unsigned long *context_map;
 static unsigned long *stale_map[NR_CPUS];
 static struct mm_struct **context_mm;
-static DEFINE_SPINLOCK(context_lock);
+static DEFINE_RAW_SPINLOCK(context_lock);
 
 #define CTX_MAP_SIZE   \
        (sizeof(unsigned long) * (last_context / BITS_PER_LONG + 1))
@@ -121,9 +121,9 @@ static unsigned int steal_context_smp(unsigned int id)
        /* This will happen if you have more CPUs than available contexts,
         * all we can do here is wait a bit and try again
         */
-       spin_unlock(&context_lock);
+       raw_spin_unlock(&context_lock);
        cpu_relax();
-       spin_lock(&context_lock);
+       raw_spin_lock(&context_lock);
 
        /* This will cause the caller to try again */
        return MMU_NO_CONTEXT;
@@ -194,7 +194,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
        unsigned long *map;
 
        /* No lockless fast path .. yet */
-       spin_lock(&context_lock);
+       raw_spin_lock(&context_lock);
 
        pr_hard("[%d] activating context for mm @%p, active=%d, id=%d",
                cpu, next, next->context.active, next->context.id);
@@ -278,7 +278,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
        /* Flick the MMU and release lock */
        pr_hardcont(" -> %d\n", id);
        set_context(id, next->pgd);
-       spin_unlock(&context_lock);
+       raw_spin_unlock(&context_lock);
 }
 
 /*
@@ -307,7 +307,7 @@ void destroy_context(struct mm_struct *mm)
 
        WARN_ON(mm->context.active != 0);
 
-       spin_lock_irqsave(&context_lock, flags);
+       raw_spin_lock_irqsave(&context_lock, flags);
        id = mm->context.id;
        if (id != MMU_NO_CONTEXT) {
                __clear_bit(id, context_map);
@@ -318,7 +318,7 @@ void destroy_context(struct mm_struct *mm)
                context_mm[id] = NULL;
                nr_free_contexts++;
        }
-       spin_unlock_irqrestore(&context_lock, flags);
+       raw_spin_unlock_irqrestore(&context_lock, flags);
 }
 
 #ifdef CONFIG_SMP
index 282d9306361f58f3ba3443648f73dd6955a75fd4..1ec06576f619bc8e3e73fecc9d04cabeb7263240 100644 (file)
@@ -63,15 +63,21 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
        if (huge) {
 #ifdef CONFIG_HUGETLB_PAGE
                psize = get_slice_psize(mm, addr);
+               /* Mask the address for the correct page size */
+               addr &= ~((1UL << mmu_psize_defs[psize].shift) - 1);
 #else
                BUG();
                psize = pte_pagesize_index(mm, addr, pte); /* shutup gcc */
 #endif
-       } else
+       } else {
                psize = pte_pagesize_index(mm, addr, pte);
+               /* Mask the address for the standard page size.  If we
+                * have a 64k page kernel, but the hardware does not
+                * support 64k pages, this might be different from the
+                * hardware page size encoded in the slice table. */
+               addr &= PAGE_MASK;
+       }
 
-       /* Mask the address for the correct page size */
-       addr &= ~((1UL << mmu_psize_defs[psize].shift) - 1);
 
        /* Build full vaddr */
        if (!is_kernel_addr(addr)) {
index f288279e679d739fc6b8a7b0e5ff35fcb19947df..8b04c54e596f2a5a1bf770cb44013808eaf27246 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Low leve TLB miss handlers for Book3E
+ *  Low level TLB miss handlers for Book3E
  *
  *  Copyright (C) 2008-2009
  *      Ben. Herrenschmidt (benh@kernel.crashing.org), IBM Corp.
index 2fbc680c2c7147f8ca2800d383c00a4500cb0b69..e81d5d67f834021c9304e9c35ab2030864a027a9 100644 (file)
@@ -150,7 +150,7 @@ EXPORT_SYMBOL(local_flush_tlb_page);
  */
 #ifdef CONFIG_SMP
 
-static DEFINE_SPINLOCK(tlbivax_lock);
+static DEFINE_RAW_SPINLOCK(tlbivax_lock);
 
 static int mm_is_core_local(struct mm_struct *mm)
 {
@@ -232,10 +232,10 @@ void __flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
                if (mmu_has_feature(MMU_FTR_USE_TLBIVAX_BCAST)) {
                        int lock = mmu_has_feature(MMU_FTR_LOCK_BCAST_INVAL);
                        if (lock)
-                               spin_lock(&tlbivax_lock);
+                               raw_spin_lock(&tlbivax_lock);
                        _tlbivax_bcast(vmaddr, pid, tsize, ind);
                        if (lock)
-                               spin_unlock(&tlbivax_lock);
+                               raw_spin_unlock(&tlbivax_lock);
                        goto bail;
                } else {
                        struct tlb_flush_param p = {
index 84544d0720431837aab591dce6cc5c13481d48a3..4c42246b86a7f1b95be762ed5a4b29b58674415f 100644 (file)
@@ -698,8 +698,7 @@ static struct clk_interface mpc5121_clk_functions = {
        .clk_get_parent         = NULL,
 };
 
-static int
-mpc5121_clk_init(void)
+int __init mpc5121_clk_init(void)
 {
        struct device_node *np;
 
@@ -724,6 +723,3 @@ mpc5121_clk_init(void)
        clk_functions = mpc5121_clk_functions;
        return 0;
 }
-
-
-arch_initcall(mpc5121_clk_init);
index 441abc488851c9f95bf6b674b7198041bf2cd79f..ee6ae129c25c31b09619d82ce20bf808f5cecf51 100644 (file)
@@ -64,8 +64,9 @@ define_machine(mpc5121_ads) {
        .name                   = "MPC5121 ADS",
        .probe                  = mpc5121_ads_probe,
        .setup_arch             = mpc5121_ads_setup_arch,
-       .init                   = mpc512x_declare_of_platform_devices,
+       .init                   = mpc512x_init,
        .init_IRQ               = mpc5121_ads_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
+       .restart                = mpc512x_restart,
 };
index da9b20a637690fb0bed45176ad668ad98cb0feb3..4ecf4cf9a51b4735760762c4bcc50ddb801e1359 100644 (file)
@@ -79,7 +79,7 @@ cpld_unmask_irq(unsigned int irq)
 }
 
 static struct irq_chip cpld_pic = {
-       .name = " CPLD PIC ",
+       .name = "CPLD PIC",
        .mask = cpld_mask_irq,
        .ack = cpld_mask_irq,
        .unmask = cpld_unmask_irq,
index 2479de9e2d12ac2f757312ca68220123d5e84b43..a6c0e3a2615d13f1600069cbf78e5caf4488a5f9 100644 (file)
@@ -51,8 +51,9 @@ static int __init mpc5121_generic_probe(void)
 define_machine(mpc5121_generic) {
        .name                   = "MPC5121 generic",
        .probe                  = mpc5121_generic_probe,
-       .init                   = mpc512x_declare_of_platform_devices,
+       .init                   = mpc512x_init,
        .init_IRQ               = mpc512x_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
+       .restart                = mpc512x_restart,
 };
index 22a5352407e0ae0c64ed5bd00177cc211156e792..b2daca0d1488954d506aa371ef25a428a7c6e5d9 100644 (file)
@@ -12,5 +12,8 @@
 #ifndef __MPC512X_H__
 #define __MPC512X_H__
 extern void __init mpc512x_init_IRQ(void);
+extern void __init mpc512x_init(void);
+extern int __init mpc5121_clk_init(void);
 void __init mpc512x_declare_of_platform_devices(void);
+extern void mpc512x_restart(char *cmd);
 #endif                         /* __MPC512X_H__ */
index 434d683df5a0e927931660fb55a328ffc40301e4..b7f518a60f031d0e5beec01144f8a0d45650b63e 100644 (file)
 #include <asm/ipic.h>
 #include <asm/prom.h>
 #include <asm/time.h>
+#include <asm/mpc5121.h>
 
 #include "mpc512x.h"
 
+static struct mpc512x_reset_module __iomem *reset_module_base;
+
+static void __init mpc512x_restart_init(void)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset");
+       if (!np)
+               return;
+
+       reset_module_base = of_iomap(np, 0);
+       of_node_put(np);
+}
+
+void mpc512x_restart(char *cmd)
+{
+       if (reset_module_base) {
+               /* Enable software reset "RSTE" */
+               out_be32(&reset_module_base->rpr, 0x52535445);
+               /* Set software hard reset */
+               out_be32(&reset_module_base->rcr, 0x2);
+       } else {
+               pr_err("Restart module not mapped.\n");
+       }
+       for (;;)
+               ;
+}
+
 void __init mpc512x_init_IRQ(void)
 {
        struct device_node *np;
@@ -53,8 +82,22 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 void __init mpc512x_declare_of_platform_devices(void)
 {
+       struct device_node *np;
+
        if (of_platform_bus_probe(NULL, of_bus_ids, NULL))
                printk(KERN_ERR __FILE__ ": "
                        "Error while probing of_platform bus\n");
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-nfc");
+       if (np) {
+               of_platform_device_create(np, NULL, NULL);
+               of_node_put(np);
+       }
 }
 
+void __init mpc512x_init(void)
+{
+       mpc512x_declare_of_platform_devices();
+       mpc5121_clk_init();
+       mpc512x_restart_init();
+}
index 21f61b8c445b8863b0c22969c205983b21b2b6b7..04d105d689f1ff45deb822801624b447592cb563 100644 (file)
@@ -302,11 +302,14 @@ static struct of_device_id mpc85xx_ids[] = {
        { .compatible = "gianfar", },
        { .compatible = "fsl,rapidio-delta", },
        { .compatible = "fsl,mpc8548-guts", },
+       { .compatible = "gpio-leds", },
        {},
 };
 
 static int __init mpc85xx_publish_devices(void)
 {
+       if (machine_is(mpc8568_mds))
+               simple_gpiochip_init("fsl,mpc8568mds-bcsr-gpio");
        if (machine_is(mpc8569_mds))
                simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
 
@@ -338,7 +341,8 @@ static void __init mpc85xx_mds_pic_init(void)
        }
 
        mpic = mpic_alloc(np, r.start,
-                       MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
+                       MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
+                       MPIC_BROKEN_FRR_NIRQS,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
        of_node_put(np);
index 04160a4cc699a163bfabf725bcbfc3fbcd22998f..a15f582300d82666e2bd8d07f9e19a7bf7399d18 100644 (file)
@@ -46,6 +46,7 @@ smp_85xx_kick_cpu(int nr)
        __iomem u32 *bptr_vaddr;
        struct device_node *np;
        int n = 0;
+       int ioremappable;
 
        WARN_ON (nr < 0 || nr >= NR_CPUS);
 
@@ -59,21 +60,37 @@ smp_85xx_kick_cpu(int nr)
                return;
        }
 
+       /*
+        * A secondary core could be in a spinloop in the bootpage
+        * (0xfffff000), somewhere in highmem, or somewhere in lowmem.
+        * The bootpage and highmem can be accessed via ioremap(), but
+        * we need to directly access the spinloop if its in lowmem.
+        */
+       ioremappable = *cpu_rel_addr > virt_to_phys(high_memory);
+
        /* Map the spin table */
-       bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY);
+       if (ioremappable)
+               bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY);
+       else
+               bptr_vaddr = phys_to_virt(*cpu_rel_addr);
 
        local_irq_save(flags);
 
        out_be32(bptr_vaddr + BOOT_ENTRY_PIR, nr);
        out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start));
 
+       if (!ioremappable)
+               flush_dcache_range((ulong)bptr_vaddr,
+                               (ulong)(bptr_vaddr + SIZE_BOOT_ENTRY));
+
        /* Wait a bit for the CPU to ack. */
        while ((__secondary_hold_acknowledge != nr) && (++n < 1000))
                mdelay(1);
 
        local_irq_restore(flags);
 
-       iounmap(bptr_vaddr);
+       if (ioremappable)
+               iounmap(bptr_vaddr);
 
        pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
 }
index e5da5f62b24af4ef2a71b67455ce179f3a879896..42e87f08aa01eab9f7f50a5a262670eeb3f34275 100644 (file)
@@ -232,7 +232,7 @@ static int socrates_fpga_pic_set_type(unsigned int virq,
 }
 
 static struct irq_chip socrates_fpga_pic_chip = {
-       .name           = " FPGA-PIC ",
+       .name           = "FPGA-PIC",
        .ack            = socrates_fpga_pic_ack,
        .mask           = socrates_fpga_pic_mask,
        .mask_ack       = socrates_fpga_pic_mask_ack,
index f559918f3c6ff7485606032c0abfabf5c2543f36..bc33d1859ae718f0892c8c0666629a64f90d09bf 100644 (file)
@@ -134,7 +134,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
        pvid = mfspr(SPRN_PVR);
        svid = mfspr(SPRN_SVR);
 
-       seq_printf(m, "Vendor\t\t: RPC Electronics STx \n");
+       seq_printf(m, "Vendor\t\t: RPC Electronics STx\n");
        seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
        seq_printf(m, "SVR\t\t: 0x%x\n", svid);
 
index 1b426050a2f91952cb588f2a61388430e387780a..0125604d096e917de7c7c6a923aa61df37c538a8 100644 (file)
@@ -80,8 +80,8 @@ static void xes_mpc85xx_configure_l2(void __iomem *l2_base)
        printk(KERN_INFO "xes_mpc85xx: Enabling L2 as cache\n");
 
        ctl = MPC85xx_L2CTL_L2E | MPC85xx_L2CTL_L2I;
-       if (machine_is_compatible("MPC8540") ||
-           machine_is_compatible("MPC8560"))
+       if (of_machine_is_compatible("MPC8540") ||
+           of_machine_is_compatible("MPC8560"))
                /*
                 * Assume L2 SRAM is used fully for cache, so set
                 * L2BLKSZ (bits 4:5) to match L2SIZ (bits 2:3).
index 35b1ec492715613becadbfad8680c6f2fc479117..2516c1cf8467cfd2c557a99d59b75c4114cb4b5b 100644 (file)
@@ -40,7 +40,7 @@
 #define DBG_LOW(fmt...) do { } while (0)
 #endif
 
-static DEFINE_SPINLOCK(beat_htab_lock);
+static DEFINE_RAW_SPINLOCK(beat_htab_lock);
 
 static inline unsigned int beat_read_mask(unsigned hpte_group)
 {
@@ -114,18 +114,18 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
        if (rflags & _PAGE_NO_CACHE)
                hpte_r &= ~_PAGE_COHERENT;
 
-       spin_lock(&beat_htab_lock);
+       raw_spin_lock(&beat_htab_lock);
        lpar_rc = beat_read_mask(hpte_group);
        if (lpar_rc == 0) {
                if (!(vflags & HPTE_V_BOLTED))
                        DBG_LOW(" full\n");
-               spin_unlock(&beat_htab_lock);
+               raw_spin_unlock(&beat_htab_lock);
                return -1;
        }
 
        lpar_rc = beat_insert_htab_entry(0, hpte_group, lpar_rc << 48,
                hpte_v, hpte_r, &slot);
-       spin_unlock(&beat_htab_lock);
+       raw_spin_unlock(&beat_htab_lock);
 
        /*
         * Since we try and ioremap PHBs we don't own, the pte insert
@@ -198,17 +198,17 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
                "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
                want_v & HPTE_V_AVPN, slot, psize, newpp);
 
-       spin_lock(&beat_htab_lock);
+       raw_spin_lock(&beat_htab_lock);
        dummy0 = beat_lpar_hpte_getword0(slot);
        if ((dummy0 & ~0x7FUL) != (want_v & ~0x7FUL)) {
                DBG_LOW("not found !\n");
-               spin_unlock(&beat_htab_lock);
+               raw_spin_unlock(&beat_htab_lock);
                return -1;
        }
 
        lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, &dummy0,
                                        &dummy1);
-       spin_unlock(&beat_htab_lock);
+       raw_spin_unlock(&beat_htab_lock);
        if (lpar_rc != 0 || dummy0 == 0) {
                DBG_LOW("not found !\n");
                return -1;
@@ -262,13 +262,13 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
        vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M);
        va = (vsid << 28) | (ea & 0x0fffffff);
 
-       spin_lock(&beat_htab_lock);
+       raw_spin_lock(&beat_htab_lock);
        slot = beat_lpar_hpte_find(va, psize);
        BUG_ON(slot == -1);
 
        lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7,
                &dummy0, &dummy1);
-       spin_unlock(&beat_htab_lock);
+       raw_spin_unlock(&beat_htab_lock);
 
        BUG_ON(lpar_rc != 0);
 }
@@ -285,18 +285,18 @@ static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
                slot, va, psize, local);
        want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M);
 
-       spin_lock_irqsave(&beat_htab_lock, flags);
+       raw_spin_lock_irqsave(&beat_htab_lock, flags);
        dummy1 = beat_lpar_hpte_getword0(slot);
 
        if ((dummy1 & ~0x7FUL) != (want_v & ~0x7FUL)) {
                DBG_LOW("not found !\n");
-               spin_unlock_irqrestore(&beat_htab_lock, flags);
+               raw_spin_unlock_irqrestore(&beat_htab_lock, flags);
                return;
        }
 
        lpar_rc = beat_write_htab_entry(0, slot, 0, 0, HPTE_V_VALID, 0,
                &dummy1, &dummy2);
-       spin_unlock_irqrestore(&beat_htab_lock, flags);
+       raw_spin_unlock_irqrestore(&beat_htab_lock, flags);
 
        BUG_ON(lpar_rc != 0);
 }
index 36052a9ebcda68e7fb4f5380309f684d1f9df47f..682af97321a86e3382d17ff5b38f91593419f9bd 100644 (file)
@@ -30,7 +30,7 @@
 #include "beat_wrapper.h"
 
 #define        MAX_IRQS        NR_IRQS
-static DEFINE_SPINLOCK(beatic_irq_mask_lock);
+static DEFINE_RAW_SPINLOCK(beatic_irq_mask_lock);
 static uint64_t        beatic_irq_mask_enable[(MAX_IRQS+255)/64];
 static uint64_t        beatic_irq_mask_ack[(MAX_IRQS+255)/64];
 
@@ -65,30 +65,30 @@ static void beatic_mask_irq(unsigned int irq_plug)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&beatic_irq_mask_lock, flags);
+       raw_spin_lock_irqsave(&beatic_irq_mask_lock, flags);
        beatic_irq_mask_enable[irq_plug/64] &= ~(1UL << (63 - (irq_plug%64)));
        beatic_update_irq_mask(irq_plug);
-       spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
+       raw_spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
 }
 
 static void beatic_unmask_irq(unsigned int irq_plug)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&beatic_irq_mask_lock, flags);
+       raw_spin_lock_irqsave(&beatic_irq_mask_lock, flags);
        beatic_irq_mask_enable[irq_plug/64] |= 1UL << (63 - (irq_plug%64));
        beatic_update_irq_mask(irq_plug);
-       spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
+       raw_spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
 }
 
 static void beatic_ack_irq(unsigned int irq_plug)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&beatic_irq_mask_lock, flags);
+       raw_spin_lock_irqsave(&beatic_irq_mask_lock, flags);
        beatic_irq_mask_ack[irq_plug/64] &= ~(1UL << (63 - (irq_plug%64)));
        beatic_update_irq_mask(irq_plug);
-       spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
+       raw_spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
 }
 
 static void beatic_end_irq(unsigned int irq_plug)
@@ -103,14 +103,14 @@ static void beatic_end_irq(unsigned int irq_plug)
 
                printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug);
        }
-       spin_lock_irqsave(&beatic_irq_mask_lock, flags);
+       raw_spin_lock_irqsave(&beatic_irq_mask_lock, flags);
        beatic_irq_mask_ack[irq_plug/64] |= 1UL << (63 - (irq_plug%64));
        beatic_update_irq_mask(irq_plug);
-       spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
+       raw_spin_unlock_irqrestore(&beatic_irq_mask_lock, flags);
 }
 
 static struct irq_chip beatic_pic = {
-       .name = " CELL-BEAT ",
+       .name = "CELL-BEAT",
        .unmask = beatic_unmask_irq,
        .mask = beatic_mask_irq,
        .eoi = beatic_end_irq,
index dcddaa5fcb665164bcd0b25370f28bd3fb9d934c..f75a4daa4ca2821439b17177a43a0969e1d2cf82 100644 (file)
@@ -48,7 +48,7 @@ static int __init cbe_powerbutton_init(void)
        int ret = 0;
        struct input_dev *dev;
 
-       if (!machine_is_compatible("IBM,CBPLUS-1.0")) {
+       if (!of_machine_is_compatible("IBM,CBPLUS-1.0")) {
                printk(KERN_ERR "%s: Not a cell blade.\n", __func__);
                ret = -ENODEV;
                goto out;
index 6829cf7e2bdada1284e63a0d91fcb8ae6c80f31b..10eb1a443626b2b4411e0c488ad6386e3f2e8976 100644 (file)
@@ -88,7 +88,7 @@ static void iic_eoi(unsigned int irq)
 }
 
 static struct irq_chip iic_chip = {
-       .name = " CELL-IIC ",
+       .name = "CELL-IIC",
        .mask = iic_mask,
        .unmask = iic_unmask,
        .eoi = iic_eoi,
@@ -133,7 +133,7 @@ static void iic_ioexc_cascade(unsigned int irq, struct irq_desc *desc)
 
 
 static struct irq_chip iic_ioexc_chip = {
-       .name = " CELL-IOEX",
+       .name = "CELL-IOEX",
        .mask = iic_mask,
        .unmask = iic_unmask,
        .eoi = iic_ioexc_eoi,
index 5e0a191764fc0158b5eb7377af019615c3540767..608fd2b584c910548aff61f8a6c4d421a731b572 100644 (file)
@@ -255,7 +255,7 @@ static int __init cbe_sysreset_init(void)
 {
        struct cbe_pmd_regs __iomem *regs;
 
-       sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0");
+       sysreset_hack = of_machine_is_compatible("IBM,CBPLUS-1.0");
        if (!sysreset_hack)
                return 0;
 
index 01244f254a115ee32ff3019222b61abdc470a987..5876e888e41251020c71495935125ea8bbe37f83 100644 (file)
@@ -168,7 +168,7 @@ static int spider_set_irq_type(unsigned int virq, unsigned int type)
 }
 
 static struct irq_chip spider_pic = {
-       .name = " SPIDER   ",
+       .name = "SPIDER",
        .unmask = spider_unmask_irq,
        .mask = spider_mask_irq,
        .ack = spider_ack_irq,
index 4c506c1463cd28a1bc5c8e3604f0738ea36df688..891f18e337a269a75f07dbcdfb54a1ae11b9c30d 100644 (file)
@@ -457,7 +457,7 @@ neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid)
                        continue;
                vic_handles = of_get_property(spu_dn, "vicinity", &lenp);
                for (i=0; i < (lenp / sizeof(phandle)); i++) {
-                       if (vic_handles[i] == target->linux_phandle)
+                       if (vic_handles[i] == target->phandle)
                                return spu;
                }
        }
@@ -499,7 +499,7 @@ static void init_affinity_node(int cbe)
 
                        if (strcmp(name, "spe") == 0) {
                                spu = devnode_spu(cbe, vic_dn);
-                               avoid_ph = last_spu_dn->linux_phandle;
+                               avoid_ph = last_spu_dn->phandle;
                        } else {
                                /*
                                 * "mic-tm" and "bif0" nodes do not have
@@ -514,7 +514,7 @@ static void init_affinity_node(int cbe)
                                        last_spu->has_mem_affinity = 1;
                                        spu->has_mem_affinity = 1;
                                }
-                               avoid_ph = vic_dn->linux_phandle;
+                               avoid_ph = vic_dn->phandle;
                        }
 
                        list_add_tail(&spu->aff_list, &last_spu->aff_list);
index c4d4a19235e078c9ad834fa08e7530e327c5c18b..eea120229cdbc800a9540f534e49978adb0a446c 100644 (file)
@@ -54,7 +54,7 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
  */
 static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
 {
-       unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
+       unsigned long limit = rlimit(RLIMIT_CORE);
        ssize_t written;
 
        if (*foffset + nr > limit)
index fd23a1d4b39d28458bca7cc3322085e3975b0314..8b0c2082a78305967c2f05089add88a2a6d3965b 100644 (file)
@@ -222,6 +222,7 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
        int i;
        u8 *dummy;
        struct pci_bus *bus = dev->bus;
+       struct resource *res;
        resource_size_t end = 0;
 
        for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
@@ -230,13 +231,12 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
                        end = pci_resource_end(dev, i);
        }
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               if ((bus->resource[i]) &&
-                       (bus->resource[i]->flags & IORESOURCE_MEM)) {
-                       if (bus->resource[i]->end == end)
-                               dummy = ioremap(bus->resource[i]->start, 0x4);
+       pci_bus_for_each_resource(bus, res, i) {
+               if (res && res->flags & IORESOURCE_MEM) {
+                       if (res->end == end)
+                               dummy = ioremap(res->start, 0x4);
                        else
-                               dummy = ioremap(bus->resource[i]->end - 3, 0x4);
+                               dummy = ioremap(res->end - 3, 0x4);
                        if (dummy) {
                                in_8(dummy);
                                iounmap(dummy);
index 86c4b29eea891d949673c3a282cd415555201fbf..ba446bf355a9b6ac35ff73a228a25d01534c58a9 100644 (file)
@@ -273,7 +273,7 @@ static void iseries_end_IRQ(unsigned int irq)
 }
 
 static struct irq_chip iseries_pic = {
-       .name   = "iSeries irq controller",
+       .name           = "iSeries",
        .startup        = iseries_startup_IRQ,
        .shutdown       = iseries_shutdown_IRQ,
        .unmask         = iseries_enable_IRQ,
index 91f4c6cd4b9936fea9635b14e30f48b858a657c8..06763682db478a213350f877820b1057b8b84c55 100644 (file)
@@ -85,7 +85,7 @@ static int proc_titantod_show(struct seq_file *m, void *v)
 
                seq_printf(m, "  titan elapsed = %lu uSec\n", titan_usec);
                seq_printf(m, "  tb elapsed    = %lu ticks\n", tb_ticks);
-               seq_printf(m, "  titan jiffies = %lu.%04lu \n", titan_jiffies,
+               seq_printf(m, "  titan jiffies = %lu.%04lu\n", titan_jiffies,
                           titan_jiff_rem_usec);
                seq_printf(m, "  tb jiffies    = %lu.%04lu\n", tb_jiffies,
                           tb_jiff_rem_usec);
index a6cd3394feaa4d5baa313a51475209ae0382cd98..b0863410517f517129d111c4891cec990736abb4 100644 (file)
@@ -256,7 +256,7 @@ static unsigned long iSeries_process_mainstore_vpd(struct MemoryBlock *mb_array,
                mem_blocks = iSeries_process_Condor_mainstore_vpd(mb_array,
                                max_entries);
 
-       printk("Mainstore_VPD: numMemoryBlocks = %ld \n", mem_blocks);
+       printk("Mainstore_VPD: numMemoryBlocks = %ld\n", mem_blocks);
        for (i = 0; i < mem_blocks; ++i) {
                printk("Mainstore_VPD: block %3ld logical chunks %016lx - %016lx\n"
                       "                             abs chunks %016lx - %016lx\n",
index 657b72f68493f63190fed4184e82d6cae427bfc8..2aa8b5631bebe54fc58df8b24d338c5eb2c8c888 100644 (file)
@@ -474,6 +474,8 @@ static void __init get_viotape_info(struct device_node *vio_root)
        struct vio_waitevent we;
        int ret;
 
+       init_completion(&we.com);
+
        ret = viopath_open(viopath_hostLp, viomajorsubtype_tape, 2);
        if (ret) {
                printk(KERN_WARNING "get_viotape_info: "
index be2527a516eabcd5cc6c8db97d22c613abfdcc9a..d35e0520abf007d5278f0f07eaac082a09e170e4 100644 (file)
@@ -304,8 +304,8 @@ static struct cpufreq_driver pas_cpufreq_driver = {
 
 static int __init pas_cpufreq_init(void)
 {
-       if (!machine_is_compatible("PA6T-1682M") &&
-           !machine_is_compatible("pasemi,pwrficient"))
+       if (!of_machine_is_compatible("PA6T-1682M") &&
+           !of_machine_is_compatible("pasemi,pwrficient"))
                return -ENODEV;
 
        return cpufreq_register_driver(&pas_cpufreq_driver);
index 9dd789a7370d8b210d2c7907d2c3a5e97238d735..84d7fd9bcc696ecbb2f5c94fc06c33ab25395557 100644 (file)
@@ -539,7 +539,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
                if (model
                    && (strcmp(model, "iMac,1") == 0
                        || strcmp(model, "PowerMac1,1") == 0)) {
-                       bootx_printf("iMac,1 detected, shutting down USB \n");
+                       bootx_printf("iMac,1 detected, shutting down USB\n");
                        out_le32((unsigned __iomem *)0x80880008, 1);    /* XXX */
                }
        }
@@ -554,7 +554,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
        } else
                space = bi->totalParamsSize;
 
-       bootx_printf("Total space used by parameters & ramdisk: 0x%x \n", space);
+       bootx_printf("Total space used by parameters & ramdisk: 0x%x\n", space);
 
        /* New BootX will have flushed all TLBs and enters kernel with
         * MMU switched OFF, so this should not be useful anymore.
index 08d94e4cedd359909782c71b3b8219409745fc5b..d4f127d18141192bef0d3771e81bc79529d707fc 100644 (file)
@@ -657,31 +657,31 @@ static int __init pmac_cpufreq_setup(void)
        cur_freq = (*value) / 1000;
 
        /*  Check for 7447A based MacRISC3 */
-       if (machine_is_compatible("MacRISC3") &&
+       if (of_machine_is_compatible("MacRISC3") &&
            of_get_property(cpunode, "dynamic-power-step", NULL) &&
            PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
                pmac_cpufreq_init_7447A(cpunode);
        /* Check for other MacRISC3 machines */
-       } else if (machine_is_compatible("PowerBook3,4") ||
-                  machine_is_compatible("PowerBook3,5") ||
-                  machine_is_compatible("MacRISC3")) {
+       } else if (of_machine_is_compatible("PowerBook3,4") ||
+                  of_machine_is_compatible("PowerBook3,5") ||
+                  of_machine_is_compatible("MacRISC3")) {
                pmac_cpufreq_init_MacRISC3(cpunode);
        /* Else check for iBook2 500/600 */
-       } else if (machine_is_compatible("PowerBook4,1")) {
+       } else if (of_machine_is_compatible("PowerBook4,1")) {
                hi_freq = cur_freq;
                low_freq = 400000;
                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) {
+       else if (of_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")) {
+       else if (of_machine_is_compatible("PowerBook3,2")) {
                /* We only know about the 400 MHz and the 500Mhz model
                 * they both have 300 MHz as low frequency
                 */
index 708c751333770b216009d1d4d112a0b0a74c08d1..3ed288e68ec4e613546b12b3ce4f9ec734830488 100644 (file)
@@ -398,11 +398,11 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
        int rc = -ENODEV;
 
        /* Check supported platforms */
-       if (machine_is_compatible("PowerMac8,1") ||
-           machine_is_compatible("PowerMac8,2") ||
-           machine_is_compatible("PowerMac9,1"))
+       if (of_machine_is_compatible("PowerMac8,1") ||
+           of_machine_is_compatible("PowerMac8,2") ||
+           of_machine_is_compatible("PowerMac9,1"))
                use_volts_smu = 1;
-       else if (machine_is_compatible("PowerMac11,2"))
+       else if (of_machine_is_compatible("PowerMac11,2"))
                use_volts_vdnap = 1;
        else
                return -ENODEV;
@@ -729,9 +729,9 @@ static int __init g5_cpufreq_init(void)
                return -ENODEV;
        }
 
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                rc = g5_pm72_cpufreq_init(cpus);
 #ifdef CONFIG_PMAC_SMU
        else
index fbc9bbd74dbdc9337ca2880f1d50a590d8f9f3a1..9e1b9fd7520614d3c3840fe839a7611c5824408e 100644 (file)
@@ -59,10 +59,10 @@ extern struct device_node *k2_skiplist[2];
  * We use a single global lock to protect accesses. Each driver has
  * to take care of its own locking
  */
-DEFINE_SPINLOCK(feature_lock);
+DEFINE_RAW_SPINLOCK(feature_lock);
 
-#define LOCK(flags)    spin_lock_irqsave(&feature_lock, flags);
-#define UNLOCK(flags)  spin_unlock_irqrestore(&feature_lock, flags);
+#define LOCK(flags)    raw_spin_lock_irqsave(&feature_lock, flags);
+#define UNLOCK(flags)  raw_spin_unlock_irqrestore(&feature_lock, flags);
 
 
 /*
@@ -2426,7 +2426,7 @@ static int __init probe_motherboard(void)
            }
        }
        for(i=0; i<ARRAY_SIZE(pmac_mb_defs); i++) {
-           if (machine_is_compatible(pmac_mb_defs[i].model_string)) {
+           if (of_machine_is_compatible(pmac_mb_defs[i].model_string)) {
                pmac_mb = pmac_mb_defs[i];
                goto found;
            }
index c6f0f9e738e562293eca7a71f486e2d6405135e2..80a5258d0364f39162a9ce32562b9b3948dfa6fe 100644 (file)
@@ -80,7 +80,7 @@ static int is_core_99;
 static int core99_bank = 0;
 static int nvram_partitions[3];
 // XXX Turn that into a sem
-static DEFINE_SPINLOCK(nv_lock);
+static DEFINE_RAW_SPINLOCK(nv_lock);
 
 static int (*core99_write_bank)(int bank, u8* datas);
 static int (*core99_erase_bank)(int bank);
@@ -165,10 +165,10 @@ static unsigned char indirect_nvram_read_byte(int addr)
        unsigned char val;
        unsigned long flags;
 
-       spin_lock_irqsave(&nv_lock, flags);
+       raw_spin_lock_irqsave(&nv_lock, flags);
        out_8(nvram_addr, addr >> 5);
        val = in_8(&nvram_data[(addr & 0x1f) << 4]);
-       spin_unlock_irqrestore(&nv_lock, flags);
+       raw_spin_unlock_irqrestore(&nv_lock, flags);
 
        return val;
 }
@@ -177,10 +177,10 @@ static void indirect_nvram_write_byte(int addr, unsigned char val)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&nv_lock, flags);
+       raw_spin_lock_irqsave(&nv_lock, flags);
        out_8(nvram_addr, addr >> 5);
        out_8(&nvram_data[(addr & 0x1f) << 4], val);
-       spin_unlock_irqrestore(&nv_lock, flags);
+       raw_spin_unlock_irqrestore(&nv_lock, flags);
 }
 
 
@@ -481,7 +481,7 @@ static void core99_nvram_sync(void)
        if (!is_core_99 || !nvram_data || !nvram_image)
                return;
 
-       spin_lock_irqsave(&nv_lock, flags);
+       raw_spin_lock_irqsave(&nv_lock, flags);
        if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
                NVRAM_SIZE))
                goto bail;
@@ -503,7 +503,7 @@ static void core99_nvram_sync(void)
                if (core99_write_bank(core99_bank, nvram_image))
                        printk("nvram: Error writing bank %d\n", core99_bank);
  bail:
-       spin_unlock_irqrestore(&nv_lock, flags);
+       raw_spin_unlock_irqrestore(&nv_lock, flags);
 
 #ifdef DEBUG
                mdelay(2000);
index db20de512f3e259c80f5e5c051a1b582d5fe9905..f5e3cda6660e0751656018377a31cc47f8c33ec4 100644 (file)
@@ -50,13 +50,13 @@ static int macio_do_gpio_write(PMF_STD_ARGS, u8 value, u8 mask)
                value = ~value;
 
        /* Toggle the GPIO */
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        tmp = readb(addr);
        tmp = (tmp & ~mask) | (value & mask);
        DBG("Do write 0x%02x to GPIO %s (%p)\n",
            tmp, func->node->full_name, addr);
        writeb(tmp, addr);
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
 
        return 0;
 }
@@ -145,9 +145,9 @@ static int macio_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask)
        struct macio_chip *macio = func->driver_data;
        unsigned long flags;
 
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        MACIO_OUT32(offset, (MACIO_IN32(offset) & ~mask) | (value & mask));
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
        return 0;
 }
 
@@ -168,9 +168,9 @@ static int macio_do_write_reg8(PMF_STD_ARGS, u32 offset, u8 value, u8 mask)
        struct macio_chip *macio = func->driver_data;
        unsigned long flags;
 
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        MACIO_OUT8(offset, (MACIO_IN8(offset) & ~mask) | (value & mask));
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
        return 0;
 }
 
@@ -223,12 +223,12 @@ static int macio_do_write_reg32_slm(PMF_STD_ARGS, u32 offset, u32 shift,
        if (args == NULL || args->count == 0)
                return -EINVAL;
 
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        tmp = MACIO_IN32(offset);
        val = args->u[0].v << shift;
        tmp = (tmp & ~mask) | (val & mask);
        MACIO_OUT32(offset, tmp);
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
        return 0;
 }
 
@@ -243,12 +243,12 @@ static int macio_do_write_reg8_slm(PMF_STD_ARGS, u32 offset, u32 shift,
        if (args == NULL || args->count == 0)
                return -EINVAL;
 
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        tmp = MACIO_IN8(offset);
        val = args->u[0].v << shift;
        tmp = (tmp & ~mask) | (val & mask);
        MACIO_OUT8(offset, tmp);
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
        return 0;
 }
 
@@ -278,12 +278,12 @@ static int unin_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&feature_lock, flags);
+       raw_spin_lock_irqsave(&feature_lock, flags);
        /* This is fairly bogus in darwin, but it should work for our needs
         * implemeted that way:
         */
        UN_OUT(offset, (UN_IN(offset) & ~mask) | (value & mask));
-       spin_unlock_irqrestore(&feature_lock, flags);
+       raw_spin_unlock_irqrestore(&feature_lock, flags);
        return 0;
 }
 
index 96d5ce50364eab840571b216c10819e71834408d..ede49e78a8da4f631632d7e553513dab2924f8af 100644 (file)
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
        list_for_each_entry(func, &dev->functions, link) {
                if (name && strcmp(name, func->name))
                        continue;
-               if (func->phandle && target->node != func->phandle)
+               if (func->phandle && target->phandle != func->phandle)
                        continue;
                if ((func->flags & flags) == 0)
                        continue;
index 09e827296276e24d3fa32ea728adcb040f95a8c1..630a533d0e5938a9ad28beb064587a3223a060c0 100644 (file)
@@ -57,7 +57,7 @@ static int max_irqs;
 static int max_real_irqs;
 static u32 level_mask[4];
 
-static DEFINE_SPINLOCK(pmac_pic_lock);
+static DEFINE_RAW_SPINLOCK(pmac_pic_lock);
 
 #define NR_MASK_WORDS  ((NR_IRQS + 31) / 32)
 static unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
@@ -85,7 +85,7 @@ static void pmac_mask_and_ack_irq(unsigned int virq)
         int i = src >> 5;
         unsigned long flags;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
         __clear_bit(src, ppc_cached_irq_mask);
         if (__test_and_clear_bit(src, ppc_lost_interrupts))
                 atomic_dec(&ppc_n_lost_interrupts);
@@ -97,7 +97,7 @@ static void pmac_mask_and_ack_irq(unsigned int virq)
                 mb();
         } while((in_le32(&pmac_irq_hw[i]->enable) & bit)
                 != (ppc_cached_irq_mask[i] & bit));
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
 }
 
 static void pmac_ack_irq(unsigned int virq)
@@ -107,12 +107,12 @@ static void pmac_ack_irq(unsigned int virq)
         int i = src >> 5;
         unsigned long flags;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        if (__test_and_clear_bit(src, ppc_lost_interrupts))
                 atomic_dec(&ppc_n_lost_interrupts);
         out_le32(&pmac_irq_hw[i]->ack, bit);
         (void)in_le32(&pmac_irq_hw[i]->ack);
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
 }
 
 static void __pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
@@ -152,12 +152,12 @@ static unsigned int pmac_startup_irq(unsigned int virq)
         unsigned long bit = 1UL << (src & 0x1f);
         int i = src >> 5;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        if ((irq_to_desc(virq)->status & IRQ_LEVEL) == 0)
                out_le32(&pmac_irq_hw[i]->ack, bit);
         __set_bit(src, ppc_cached_irq_mask);
         __pmac_set_irq_mask(src, 0);
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
 
        return 0;
 }
@@ -167,10 +167,10 @@ static void pmac_mask_irq(unsigned int virq)
        unsigned long flags;
        unsigned int src = irq_map[virq].hwirq;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
         __clear_bit(src, ppc_cached_irq_mask);
         __pmac_set_irq_mask(src, 1);
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
 }
 
 static void pmac_unmask_irq(unsigned int virq)
@@ -178,24 +178,24 @@ static void pmac_unmask_irq(unsigned int virq)
        unsigned long flags;
        unsigned int src = irq_map[virq].hwirq;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        __set_bit(src, ppc_cached_irq_mask);
         __pmac_set_irq_mask(src, 0);
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
 }
 
 static int pmac_retrigger(unsigned int virq)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        __pmac_retrigger(irq_map[virq].hwirq);
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
        return 1;
 }
 
 static struct irq_chip pmac_pic = {
-       .name           = " PMAC-PIC ",
+       .name           = "PMAC-PIC",
        .startup        = pmac_startup_irq,
        .mask           = pmac_mask_irq,
        .ack            = pmac_ack_irq,
@@ -210,7 +210,7 @@ static irqreturn_t gatwick_action(int cpl, void *dev_id)
        int irq, bits;
        int rc = IRQ_NONE;
 
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) {
                int i = irq >> 5;
                bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
@@ -220,12 +220,12 @@ static irqreturn_t gatwick_action(int cpl, void *dev_id)
                if (bits == 0)
                        continue;
                irq += __ilog2(bits);
-               spin_unlock_irqrestore(&pmac_pic_lock, flags);
+               raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
                generic_handle_irq(irq);
-               spin_lock_irqsave(&pmac_pic_lock, flags);
+               raw_spin_lock_irqsave(&pmac_pic_lock, flags);
                rc = IRQ_HANDLED;
        }
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
        return rc;
 }
 
@@ -244,7 +244,7 @@ static unsigned int pmac_pic_get_irq(void)
                return NO_IRQ_IGNORE;   /* ignore, already handled */
         }
 #endif /* CONFIG_SMP */
-       spin_lock_irqsave(&pmac_pic_lock, flags);
+       raw_spin_lock_irqsave(&pmac_pic_lock, flags);
        for (irq = max_real_irqs; (irq -= 32) >= 0; ) {
                int i = irq >> 5;
                bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
@@ -256,7 +256,7 @@ static unsigned int pmac_pic_get_irq(void)
                irq += __ilog2(bits);
                break;
        }
-       spin_unlock_irqrestore(&pmac_pic_lock, flags);
+       raw_spin_unlock_irqrestore(&pmac_pic_lock, flags);
        if (unlikely(irq < 0))
                return NO_IRQ;
        return irq_linear_revmap(pmac_pic_host, irq);
index b40c22d697f006d06f2e952a5a602dee999bc333..6898e8241cd03826335aae8653e82a1775b5eb24 100644 (file)
@@ -693,9 +693,9 @@ static void __init smp_core99_setup(int ncpus)
 #ifdef CONFIG_PPC64
 
        /* i2c based HW sync on some G5s */
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                smp_core99_setup_i2c_hwsync(ncpus);
 
        /* pfunc based HW sync on recent G5s */
@@ -713,7 +713,7 @@ static void __init smp_core99_setup(int ncpus)
 #else /* CONFIG_PPC64 */
 
        /* GPIO based HW sync on ppc32 Core99 */
-       if (pmac_tb_freeze == NULL && !machine_is_compatible("MacRISC4")) {
+       if (pmac_tb_freeze == NULL && !of_machine_is_compatible("MacRISC4")) {
                struct device_node *cpu;
                const u32 *tbprop = NULL;
 
@@ -750,7 +750,7 @@ static void __init smp_core99_setup(int ncpus)
 #endif
 
        /* 32 bits SMP can't NAP */
-       if (!machine_is_compatible("MacRISC4"))
+       if (!of_machine_is_compatible("MacRISC4"))
                powersave_nap = 0;
 }
 
@@ -852,7 +852,7 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr)
                /* If we didn't start the second CPU, we must take
                 * it off the bus
                 */
-               if (machine_is_compatible("MacRISC4") &&
+               if (of_machine_is_compatible("MacRISC4") &&
                    num_online_cpus() < 2)              
                        g5_phy_disable_cpu1();
 #endif /* CONFIG_PPC64 */
index 1810e4226e5615543999e7242a8c467991707907..48211ca134c3b3845c80af2a8ab58d9549ffa776 100644 (file)
@@ -317,9 +317,9 @@ void __init pmac_calibrate_decr(void)
         * calibration. That's better since the VIA itself seems
         * to be slightly off. --BenH
         */
-       if (!machine_is_compatible("MacRISC2") &&
-           !machine_is_compatible("MacRISC3") &&
-           !machine_is_compatible("MacRISC4"))
+       if (!of_machine_is_compatible("MacRISC2") &&
+           !of_machine_is_compatible("MacRISC3") &&
+           !of_machine_is_compatible("MacRISC4"))
                if (via_calibrate_decr())
                        return;
 
@@ -328,7 +328,7 @@ void __init pmac_calibrate_decr(void)
         * probably implement calibration based on the KL timer on these
         * machines anyway... -BenH
         */
-       if (machine_is_compatible("PowerMac3,5"))
+       if (of_machine_is_compatible("PowerMac3,5"))
                if (via_calibrate_decr())
                        return;
 #endif
index 9490157da62e06a066073db4b462890ff16f038c..d83135a9830ead5f677b5af278fc183949d6df30 100644 (file)
@@ -132,9 +132,9 @@ void udbg_scc_init(int force_scc)
                scc_inittab[1] = in_8(sccc);
                out_8(sccc, 12);
                scc_inittab[3] = in_8(sccc);
-       } else if (machine_is_compatible("RackMac1,1")
-                  || machine_is_compatible("RackMac1,2")
-                  || machine_is_compatible("MacRISC4")) {
+       } else if (of_machine_is_compatible("RackMac1,1")
+                  || of_machine_is_compatible("RackMac1,2")
+                  || of_machine_is_compatible("MacRISC4")) {
                /* Xserves and G5s default to 57600 */
                scc_inittab[1] = 0;
                scc_inittab[3] = 0;
index 67b7a10f9fce9b11079b6603a615e7dd43b36172..37bce52526da52f156841e364ed6998456d6a18a 100644 (file)
@@ -236,7 +236,9 @@ static struct device_node *derive_parent(const char *path)
 
 int dlpar_attach_node(struct device_node *dn)
 {
+#ifdef CONFIG_PROC_DEVICETREE
        struct proc_dir_entry *ent;
+#endif
        int rc;
 
        of_node_set_flag(dn, OF_DYNAMIC);
@@ -267,10 +269,10 @@ int dlpar_attach_node(struct device_node *dn)
 
 int dlpar_detach_node(struct device_node *dn)
 {
+#ifdef CONFIG_PROC_DEVICETREE
        struct device_node *parent = dn->parent;
        struct property *prop = dn->properties;
 
-#ifdef CONFIG_PROC_DEVICETREE
        while (prop) {
                remove_proc_entry(prop->name, dn->pde);
                prop = prop->next;
@@ -344,20 +346,6 @@ int dlpar_release_drc(u32 drc_index)
 
 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
 
-static DEFINE_MUTEX(pseries_cpu_hotplug_mutex);
-
-void cpu_hotplug_driver_lock(void)
-__acquires(pseries_cpu_hotplug_mutex)
-{
-       mutex_lock(&pseries_cpu_hotplug_mutex);
-}
-
-void cpu_hotplug_driver_unlock(void)
-__releases(pseries_cpu_hotplug_mutex)
-{
-       mutex_unlock(&pseries_cpu_hotplug_mutex);
-}
-
 static int dlpar_online_cpu(struct device_node *dn)
 {
        int rc = 0;
index ccd8dd03b8c987e701e476fe43a8f84348901d13..7df7fbb7cacb4e96a558c14b77ec6fba490f60dd 100644 (file)
@@ -100,7 +100,7 @@ int eeh_subsystem_enabled;
 EXPORT_SYMBOL(eeh_subsystem_enabled);
 
 /* Lock to avoid races due to multiple reports of an error */
-static DEFINE_SPINLOCK(confirm_error_lock);
+static DEFINE_RAW_SPINLOCK(confirm_error_lock);
 
 /* Buffer for reporting slot-error-detail rtas calls. Its here
  * in BSS, and not dynamically alloced, so that it ends up in
@@ -436,7 +436,7 @@ static void __eeh_clear_slot(struct device_node *parent, int mode_flag)
 void eeh_clear_slot (struct device_node *dn, int mode_flag)
 {
        unsigned long flags;
-       spin_lock_irqsave(&confirm_error_lock, flags);
+       raw_spin_lock_irqsave(&confirm_error_lock, flags);
        
        dn = find_device_pe (dn);
        
@@ -447,7 +447,7 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag)
        PCI_DN(dn)->eeh_mode &= ~mode_flag;
        PCI_DN(dn)->eeh_check_count = 0;
        __eeh_clear_slot(dn, mode_flag);
-       spin_unlock_irqrestore(&confirm_error_lock, flags);
+       raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
 }
 
 /**
@@ -491,7 +491,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
            pdn->eeh_mode & EEH_MODE_NOCHECK) {
                ignored_check++;
                pr_debug("EEH: Ignored check (%x) for %s %s\n",
-                        pdn->eeh_mode, pci_name (dev), dn->full_name);
+                        pdn->eeh_mode, eeh_pci_name(dev), dn->full_name);
                return 0;
        }
 
@@ -506,7 +506,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
         * in one slot might report errors simultaneously, and we
         * only want one error recovery routine running.
         */
-       spin_lock_irqsave(&confirm_error_lock, flags);
+       raw_spin_lock_irqsave(&confirm_error_lock, flags);
        rc = 1;
        if (pdn->eeh_mode & EEH_MODE_ISOLATED) {
                pdn->eeh_check_count ++;
@@ -515,7 +515,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
                        printk (KERN_ERR "EEH: %d reads ignored for recovering device at "
                                "location=%s driver=%s pci addr=%s\n",
                                pdn->eeh_check_count, location,
-                               dev->driver->name, pci_name(dev));
+                               dev->driver->name, eeh_pci_name(dev));
                        printk (KERN_ERR "EEH: Might be infinite loop in %s driver\n",
                                dev->driver->name);
                        dump_stack();
@@ -575,7 +575,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
         * with other functions on this device, and functions under
         * bridges. */
        eeh_mark_slot (dn, EEH_MODE_ISOLATED);
-       spin_unlock_irqrestore(&confirm_error_lock, flags);
+       raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
 
        eeh_send_failure_event (dn, dev);
 
@@ -586,7 +586,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
        return 1;
 
 dn_unlock:
-       spin_unlock_irqrestore(&confirm_error_lock, flags);
+       raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
        return rc;
 }
 
@@ -1064,7 +1064,7 @@ void __init eeh_init(void)
        struct device_node *phb, *np;
        struct eeh_early_enable_info info;
 
-       spin_lock_init(&confirm_error_lock);
+       raw_spin_lock_init(&confirm_error_lock);
        spin_lock_init(&slot_errbuf_lock);
 
        np = of_find_node_by_path("/rtas");
index ef8e45448480836bba0097606e6dca9c92afb6a3..b8d70f5d9aa984de1a44b91f762493820c58b4c8 100644 (file)
@@ -337,7 +337,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
                location = location ? location : "unknown";
                printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
                                "for location=%s pci addr=%s\n",
-                       location, pci_name(event->dev));
+                       location, eeh_pci_name(event->dev));
                return NULL;
        }
 
@@ -368,7 +368,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
                pci_str = pci_name (frozen_pdn->pcidev);
                drv_str = pcid_name (frozen_pdn->pcidev);
        } else {
-               pci_str = pci_name (event->dev);
+               pci_str = eeh_pci_name(event->dev);
                drv_str = pcid_name (event->dev);
        }
        
@@ -478,9 +478,9 @@ excess_failures:
         * due to actual, failed cards.
         */
        printk(KERN_ERR
-          "EEH: PCI device at location=%s driver=%s pci addr=%s \n"
+          "EEH: PCI device at location=%s driver=%s pci addr=%s\n"
                "has failed %d times in the last hour "
-               "and has been permanently disabled. \n"
+               "and has been permanently disabled.\n"
                "Please try reseating this device or replacing it.\n",
                location, drv_str, pci_str, frozen_pdn->eeh_freeze_count);
        goto perm_error;
@@ -488,7 +488,7 @@ excess_failures:
 hard_fail:
        printk(KERN_ERR
           "EEH: Unable to recover from failure of PCI device "
-          "at location=%s driver=%s pci addr=%s \n"
+          "at location=%s driver=%s pci addr=%s\n"
           "Please try reseating this device or replacing it.\n",
                location, drv_str, pci_str);
 
index ddb80f5d850b77231783b7f05c1d7adadd6f9aed..ec5df8f519c7417327923bcadafdbda76874ec04 100644 (file)
@@ -80,7 +80,7 @@ static int eeh_event_handler(void * dummy)
        eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
 
        printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n",
-              pci_name(event->dev));
+              eeh_pci_name(event->dev));
 
        pdn = handle_eeh_events(event);
 
index 6ea4698d9176dc08b9ec73f139e5e25544693555..d1b124e44d7701204c688d1a12df57d15d6f62e1 100644 (file)
@@ -387,24 +387,12 @@ static char cede_parameters[CEDE_LATENCY_PARAM_MAX_LENGTH];
 
 static int parse_cede_parameters(void)
 {
-       int call_status;
-
        memset(cede_parameters, 0, CEDE_LATENCY_PARAM_MAX_LENGTH);
-       call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
-                               NULL,
-                               CEDE_LATENCY_TOKEN,
-                               __pa(cede_parameters),
-                               CEDE_LATENCY_PARAM_MAX_LENGTH);
-
-       if (call_status != 0)
-               printk(KERN_INFO "CEDE_LATENCY: \
-                       %s %s Error calling get-system-parameter(0x%x)\n",
-                       __FILE__, __func__, call_status);
-       else
-               printk(KERN_INFO "CEDE_LATENCY: \
-                       get-system-parameter successful.\n");
-
-       return call_status;
+       return rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
+                        NULL,
+                        CEDE_LATENCY_TOKEN,
+                        __pa(cede_parameters),
+                        CEDE_LATENCY_PARAM_MAX_LENGTH);
 }
 
 static int __init pseries_cpu_hotplug_init(void)
index 2f58c71b72593911694cc0cd6a33588a0259ef20..1fefae76e295de282e696d480c1ffb66846480e2 100644 (file)
@@ -124,8 +124,8 @@ static void probe_hcall_exit(unsigned long opcode, unsigned long retval,
 
        h = &__get_cpu_var(hcall_stats)[opcode / 4];
        h->num_calls++;
-       h->tb_total = mftb() - h->tb_start;
-       h->purr_total = mfspr(SPRN_PURR) - h->purr_start;
+       h->tb_total += mftb() - h->tb_start;
+       h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
 
        put_cpu_var(hcall_stats);
 }
index b6fa3e4b51b5ee6c351ee97237dcd0564b1c204b..4b7a062dee15373e93b0b44c66c5ad0fbd5ee086 100644 (file)
@@ -165,7 +165,7 @@ int remove_phb_dynamic(struct pci_controller *phb)
        struct resource *res;
        int rc, i;
 
-       pr_debug("PCI: Removing PHB %04x:%02x... \n",
+       pr_debug("PCI: Removing PHB %04x:%02x...\n",
                 pci_domain_nr(b), b->number);
 
        /* We cannot to remove a root bus that has children */
index 15eb6107bcd2ac144ca7c7ea83b0c81441addb39..225a50ab14be555c9ca6aa92889bb6432e5fcf3d 100644 (file)
@@ -150,7 +150,7 @@ static void print_dump_header(const struct phyp_dump_header *ph)
        printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto);
 
        /*set cpu state and hpte states as well scratch pad area */
-       printk(KERN_INFO " CPU AREA \n");
+       printk(KERN_INFO " CPU AREA\n");
        printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags);
        printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type);
        printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags);
@@ -161,7 +161,7 @@ static void print_dump_header(const struct phyp_dump_header *ph)
        printk(KERN_INFO "cpu length_copied =%llx\n",
                ph->cpu_data.length_copied);
 
-       printk(KERN_INFO " HPTE AREA \n");
+       printk(KERN_INFO " HPTE AREA\n");
        printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags);
        printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type);
        printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags);
@@ -172,7 +172,7 @@ static void print_dump_header(const struct phyp_dump_header *ph)
        printk(KERN_INFO "HPTE length_copied =%llx\n",
                ph->hpte_data.length_copied);
 
-       printk(KERN_INFO " SRSD AREA \n");
+       printk(KERN_INFO " SRSD AREA\n");
        printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags);
        printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type);
        printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags);
index b4886635972c6dbf88b30bb9a69a21f569396ad8..4e7f89a84561e9ae3170a5eb13cee199426c10d1 100644 (file)
@@ -144,8 +144,8 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
                hcpuid = get_hard_smp_processor_id(nr);
                rc = plpar_hcall_norets(H_PROD, hcpuid);
                if (rc != H_SUCCESS)
-                       printk(KERN_ERR "Error: Prod to wake up processor %d\
-                                               Ret= %ld\n", nr, rc);
+                       printk(KERN_ERR "Error: Prod to wake up processor %d "
+                                               "Ret= %ld\n", nr, rc);
        }
 }
 
index b9b9e11609eca7db69e2b2a0711293cc49d667f2..4ca641042ec36a078b1b055bd163eff0a0dddd9a 100644 (file)
@@ -127,7 +127,7 @@ static inline unsigned int lpar_xirr_info_get(void)
 
        lpar_rc = plpar_xirr(&return_value);
        if (lpar_rc != H_SUCCESS)
-               panic(" bad return code xirr - rc = %lx \n", lpar_rc);
+               panic(" bad return code xirr - rc = %lx\n", lpar_rc);
        return (unsigned int)return_value;
 }
 
@@ -163,14 +163,13 @@ static inline void lpar_qirr_info(int n_cpu , u8 value)
 /* Interface to generic irq subsystem */
 
 #ifdef CONFIG_SMP
-static int get_irq_server(unsigned int virq, unsigned int strict_check)
+static int get_irq_server(unsigned int virq, cpumask_t cpumask,
+                         unsigned int strict_check)
 {
        int server;
        /* For the moment only implement delivery to all cpus or one cpu */
-       cpumask_t cpumask;
        cpumask_t tmp = CPU_MASK_NONE;
 
-       cpumask_copy(&cpumask, irq_to_desc(virq)->affinity);
        if (!distribute_irqs)
                return default_server;
 
@@ -192,10 +191,7 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check)
        return default_server;
 }
 #else
-static int get_irq_server(unsigned int virq, unsigned int strict_check)
-{
-       return default_server;
-}
+#define get_irq_server(virq, cpumask, strict_check) (default_server)
 #endif
 
 static void xics_unmask_irq(unsigned int virq)
@@ -211,7 +207,7 @@ static void xics_unmask_irq(unsigned int virq)
        if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
                return;
 
-       server = get_irq_server(virq, 0);
+       server = get_irq_server(virq, *(irq_to_desc(virq)->affinity), 0);
 
        call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
                                DEFAULT_PRIORITY);
@@ -405,7 +401,7 @@ static int xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)
         * For the moment only implement delivery to all cpus or one cpu.
         * Get current irq_server for the given irq
         */
-       irq_server = get_irq_server(virq, 1);
+       irq_server = get_irq_server(virq, *cpumask, 1);
        if (irq_server == -1) {
                char cpulist[128];
                cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask);
@@ -428,7 +424,7 @@ static int xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)
 }
 
 static struct irq_chip xics_pic_direct = {
-       .name = " XICS     ",
+       .name = "XICS",
        .startup = xics_startup,
        .mask = xics_mask_irq,
        .unmask = xics_unmask_irq,
@@ -437,7 +433,7 @@ static struct irq_chip xics_pic_direct = {
 };
 
 static struct irq_chip xics_pic_lpar = {
-       .name = " XICS     ",
+       .name = "XICS",
        .startup = xics_startup,
        .mask = xics_mask_irq,
        .unmask = xics_unmask_irq,
@@ -514,15 +510,13 @@ static void __init xics_init_host(void)
 /*
  * XICS only has a single IPI, so encode the messages per CPU
  */
-struct xics_ipi_struct {
-        unsigned long value;
-       } ____cacheline_aligned;
-
-static struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
+static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned long, xics_ipi_message);
 
 static inline void smp_xics_do_message(int cpu, int msg)
 {
-       set_bit(msg, &xics_ipi_message[cpu].value);
+       unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
+
+       set_bit(msg, tgt);
        mb();
        if (firmware_has_feature(FW_FEATURE_LPAR))
                lpar_qirr_info(cpu, IPI_PRIORITY);
@@ -548,25 +542,23 @@ void smp_xics_message_pass(int target, int msg)
 
 static irqreturn_t xics_ipi_dispatch(int cpu)
 {
+       unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
+
        WARN_ON(cpu_is_offline(cpu));
 
        mb();   /* order mmio clearing qirr */
-       while (xics_ipi_message[cpu].value) {
-               if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION,
-                                      &xics_ipi_message[cpu].value)) {
+       while (*tgt) {
+               if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION, tgt)) {
                        smp_message_recv(PPC_MSG_CALL_FUNCTION);
                }
-               if (test_and_clear_bit(PPC_MSG_RESCHEDULE,
-                                      &xics_ipi_message[cpu].value)) {
+               if (test_and_clear_bit(PPC_MSG_RESCHEDULE, tgt)) {
                        smp_message_recv(PPC_MSG_RESCHEDULE);
                }
-               if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE,
-                                      &xics_ipi_message[cpu].value)) {
+               if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE, tgt)) {
                        smp_message_recv(PPC_MSG_CALL_FUNC_SINGLE);
                }
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
-               if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
-                                      &xics_ipi_message[cpu].value)) {
+               if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK, tgt)) {
                        smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
                }
 #endif
@@ -788,9 +780,13 @@ static void xics_set_cpu_priority(unsigned char cppr)
 {
        struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr);
 
-       BUG_ON(os_cppr->index != 0);
+       /*
+        * we only really want to set the priority when there's
+        * just one cppr value on the stack
+        */
+       WARN_ON(os_cppr->index != 0);
 
-       os_cppr->stack[os_cppr->index] = cppr;
+       os_cppr->stack[0] = cppr;
 
        if (firmware_has_feature(FW_FEATURE_LPAR))
                lpar_cppr_info(cppr);
@@ -825,8 +821,14 @@ void xics_setup_cpu(void)
 
 void xics_teardown_cpu(void)
 {
+       struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr);
        int cpu = smp_processor_id();
 
+       /*
+        * we have to reset the cppr index to 0 because we're
+        * not going to return from the IPI
+        */
+       os_cppr->index = 0;
        xics_set_cpu_priority(0);
 
        /* Clear any pending IPI request */
index a4b41dbde128ca261146cbde35de5ae9fe26d76c..ecad10d4e9281790928ea0b7d9512b9ebbc6e68b 100644 (file)
@@ -77,7 +77,7 @@ static void cpm_end_irq(unsigned int irq)
 }
 
 static struct irq_chip cpm_pic = {
-       .name = " CPM PIC ",
+       .name = "CPM PIC",
        .mask = cpm_mask_irq,
        .unmask = cpm_unmask_irq,
        .eoi = cpm_end_irq,
index 1709ac5aac7cf87407599701d488565f78541448..fcea4ff825ddd5f61ed8401aaa9fc2ace66e8238 100644 (file)
@@ -198,7 +198,7 @@ err_sense:
 }
 
 static struct irq_chip cpm2_pic = {
-       .name = " CPM2 SIU ",
+       .name = "CPM2 SIU",
        .mask = cpm2_mask_irq,
        .unmask = cpm2_unmask_irq,
        .ack = cpm2_ack,
index c6e11b0771086fa611660385cfbec6cf30e66339..e094367d7739e00f8949aab22de0c7c5f0fb1f9d 100644 (file)
@@ -47,7 +47,7 @@ static struct irq_chip fsl_msi_chip = {
        .mask           = mask_msi_irq,
        .unmask         = unmask_msi_irq,
        .ack            = fsl_msi_end_irq,
-       .name   = " FSL-MSI  ",
+       .name           = "FSL-MSI",
 };
 
 static int fsl_msi_host_map(struct irq_host *h, unsigned int virq,
index 5da37c2f22ee28db96e064aae1172e3b61e4a3c1..cf27df6e508bb8ea2d6a0e33c0be595d8d2ad58b 100644 (file)
@@ -56,9 +56,9 @@ static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable)
 void __init setup_grackle(struct pci_controller *hose)
 {
        setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0);
-       if (machine_is_compatible("PowerMac1,1"))
+       if (of_machine_is_compatible("PowerMac1,1"))
                ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
-       if (machine_is_compatible("AAPL,PowerBook1998"))
+       if (of_machine_is_compatible("AAPL,PowerBook1998"))
                grackle_set_loop_snoop(hose, 1);
 #if 0  /* Disabled for now, HW problems ??? */
        grackle_set_stg(hose, 1);
index 0a55db8a5a2912ae1f7a55b87d4a0fe05aa8d045..6323e70e6bf41902e65ce0c2265674ae7a1a7497 100644 (file)
@@ -23,7 +23,7 @@ static unsigned char cached_8259[2] = { 0xff, 0xff };
 #define cached_A1 (cached_8259[0])
 #define cached_21 (cached_8259[1])
 
-static DEFINE_SPINLOCK(i8259_lock);
+static DEFINE_RAW_SPINLOCK(i8259_lock);
 
 static struct irq_host *i8259_host;
 
@@ -42,7 +42,7 @@ unsigned int i8259_irq(void)
        if (pci_intack)
                irq = readb(pci_intack);
        else {
-               spin_lock(&i8259_lock);
+               raw_spin_lock(&i8259_lock);
                lock = 1;
 
                /* Perform an interrupt acknowledge cycle on controller 1. */
@@ -74,7 +74,7 @@ unsigned int i8259_irq(void)
                irq = NO_IRQ;
 
        if (lock)
-               spin_unlock(&i8259_lock);
+               raw_spin_unlock(&i8259_lock);
        return irq;
 }
 
@@ -82,7 +82,7 @@ static void i8259_mask_and_ack_irq(unsigned int irq_nr)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&i8259_lock, flags);
+       raw_spin_lock_irqsave(&i8259_lock, flags);
        if (irq_nr > 7) {
                cached_A1 |= 1 << (irq_nr-8);
                inb(0xA1);      /* DUMMY */
@@ -95,7 +95,7 @@ static void i8259_mask_and_ack_irq(unsigned int irq_nr)
                outb(cached_21, 0x21);
                outb(0x20, 0x20);       /* Non-specific EOI */
        }
-       spin_unlock_irqrestore(&i8259_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259_lock, flags);
 }
 
 static void i8259_set_irq_mask(int irq_nr)
@@ -110,13 +110,13 @@ static void i8259_mask_irq(unsigned int irq_nr)
 
        pr_debug("i8259_mask_irq(%d)\n", irq_nr);
 
-       spin_lock_irqsave(&i8259_lock, flags);
+       raw_spin_lock_irqsave(&i8259_lock, flags);
        if (irq_nr < 8)
                cached_21 |= 1 << irq_nr;
        else
                cached_A1 |= 1 << (irq_nr-8);
        i8259_set_irq_mask(irq_nr);
-       spin_unlock_irqrestore(&i8259_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259_lock, flags);
 }
 
 static void i8259_unmask_irq(unsigned int irq_nr)
@@ -125,17 +125,17 @@ static void i8259_unmask_irq(unsigned int irq_nr)
 
        pr_debug("i8259_unmask_irq(%d)\n", irq_nr);
 
-       spin_lock_irqsave(&i8259_lock, flags);
+       raw_spin_lock_irqsave(&i8259_lock, flags);
        if (irq_nr < 8)
                cached_21 &= ~(1 << irq_nr);
        else
                cached_A1 &= ~(1 << (irq_nr-8));
        i8259_set_irq_mask(irq_nr);
-       spin_unlock_irqrestore(&i8259_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259_lock, flags);
 }
 
 static struct irq_chip i8259_pic = {
-       .name           = " i8259    ",
+       .name           = "i8259",
        .mask           = i8259_mask_irq,
        .disable        = i8259_mask_irq,
        .unmask         = i8259_unmask_irq,
@@ -241,7 +241,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
        unsigned long flags;
 
        /* initialize the controller */
-       spin_lock_irqsave(&i8259_lock, flags);
+       raw_spin_lock_irqsave(&i8259_lock, flags);
 
        /* Mask all first */
        outb(0xff, 0xA1);
@@ -273,7 +273,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
        outb(cached_A1, 0xA1);
        outb(cached_21, 0x21);
 
-       spin_unlock_irqrestore(&i8259_lock, flags);
+       raw_spin_unlock_irqrestore(&i8259_lock, flags);
 
        /* create a legacy host */
        i8259_host = irq_alloc_host(node, IRQ_HOST_MAP_LEGACY,
index 28cdddd2f89e6265aca60a1ec8f41ba68b66caa9..d7b9b9c6928743a6042699991b341a5ca0c6ccbb 100644 (file)
@@ -32,7 +32,7 @@
 
 static struct ipic * primary_ipic;
 static struct irq_chip ipic_level_irq_chip, ipic_edge_irq_chip;
-static DEFINE_SPINLOCK(ipic_lock);
+static DEFINE_RAW_SPINLOCK(ipic_lock);
 
 static struct ipic_info ipic_info[] = {
        [1] = {
@@ -530,13 +530,13 @@ static void ipic_unmask_irq(unsigned int virq)
        unsigned long flags;
        u32 temp;
 
-       spin_lock_irqsave(&ipic_lock, flags);
+       raw_spin_lock_irqsave(&ipic_lock, flags);
 
        temp = ipic_read(ipic->regs, ipic_info[src].mask);
        temp |= (1 << (31 - ipic_info[src].bit));
        ipic_write(ipic->regs, ipic_info[src].mask, temp);
 
-       spin_unlock_irqrestore(&ipic_lock, flags);
+       raw_spin_unlock_irqrestore(&ipic_lock, flags);
 }
 
 static void ipic_mask_irq(unsigned int virq)
@@ -546,7 +546,7 @@ static void ipic_mask_irq(unsigned int virq)
        unsigned long flags;
        u32 temp;
 
-       spin_lock_irqsave(&ipic_lock, flags);
+       raw_spin_lock_irqsave(&ipic_lock, flags);
 
        temp = ipic_read(ipic->regs, ipic_info[src].mask);
        temp &= ~(1 << (31 - ipic_info[src].bit));
@@ -556,7 +556,7 @@ static void ipic_mask_irq(unsigned int virq)
         * for nearly all cases. */
        mb();
 
-       spin_unlock_irqrestore(&ipic_lock, flags);
+       raw_spin_unlock_irqrestore(&ipic_lock, flags);
 }
 
 static void ipic_ack_irq(unsigned int virq)
@@ -566,7 +566,7 @@ static void ipic_ack_irq(unsigned int virq)
        unsigned long flags;
        u32 temp;
 
-       spin_lock_irqsave(&ipic_lock, flags);
+       raw_spin_lock_irqsave(&ipic_lock, flags);
 
        temp = 1 << (31 - ipic_info[src].bit);
        ipic_write(ipic->regs, ipic_info[src].ack, temp);
@@ -575,7 +575,7 @@ static void ipic_ack_irq(unsigned int virq)
         * for nearly all cases. */
        mb();
 
-       spin_unlock_irqrestore(&ipic_lock, flags);
+       raw_spin_unlock_irqrestore(&ipic_lock, flags);
 }
 
 static void ipic_mask_irq_and_ack(unsigned int virq)
@@ -585,7 +585,7 @@ static void ipic_mask_irq_and_ack(unsigned int virq)
        unsigned long flags;
        u32 temp;
 
-       spin_lock_irqsave(&ipic_lock, flags);
+       raw_spin_lock_irqsave(&ipic_lock, flags);
 
        temp = ipic_read(ipic->regs, ipic_info[src].mask);
        temp &= ~(1 << (31 - ipic_info[src].bit));
@@ -598,7 +598,7 @@ static void ipic_mask_irq_and_ack(unsigned int virq)
         * for nearly all cases. */
        mb();
 
-       spin_unlock_irqrestore(&ipic_lock, flags);
+       raw_spin_unlock_irqrestore(&ipic_lock, flags);
 }
 
 static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
@@ -660,7 +660,7 @@ static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
 
 /* level interrupts and edge interrupts have different ack operations */
 static struct irq_chip ipic_level_irq_chip = {
-       .name           = " IPIC  ",
+       .name           = "IPIC",
        .unmask         = ipic_unmask_irq,
        .mask           = ipic_mask_irq,
        .mask_ack       = ipic_mask_irq,
@@ -668,7 +668,7 @@ static struct irq_chip ipic_level_irq_chip = {
 };
 
 static struct irq_chip ipic_edge_irq_chip = {
-       .name           = " IPIC  ",
+       .name           = "IPIC",
        .unmask         = ipic_unmask_irq,
        .mask           = ipic_mask_irq,
        .mask_ack       = ipic_mask_irq_and_ack,
index 69bd6f4dff83a3f67ee1a8e3d1c958cd293d48a2..8c27d261aba857351775ccccac1808901386d9c3 100644 (file)
@@ -94,7 +94,7 @@ static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type)
 }
 
 static struct irq_chip mpc8xx_pic = {
-       .name = " MPC8XX SIU ",
+       .name = "MPC8XX SIU",
        .unmask = mpc8xx_unmask_irq,
        .mask = mpc8xx_mask_irq,
        .ack = mpc8xx_ack,
index 470dc6c11d57e3ef7716a09d05b62559bd0ebeee..339e8a3e26d2071cb37cb01d86d050ea446e1b37 100644 (file)
@@ -46,7 +46,7 @@
 
 static struct mpic *mpics;
 static struct mpic *mpic_primary;
-static DEFINE_SPINLOCK(mpic_lock);
+static DEFINE_RAW_SPINLOCK(mpic_lock);
 
 #ifdef CONFIG_PPC32    /* XXX for now */
 #ifdef CONFIG_IRQ_ALL_CPUS
@@ -347,10 +347,10 @@ static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source)
                unsigned int mask = 1U << (fixup->index & 0x1f);
                writel(mask, fixup->applebase + soff);
        } else {
-               spin_lock(&mpic->fixup_lock);
+               raw_spin_lock(&mpic->fixup_lock);
                writeb(0x11 + 2 * fixup->index, fixup->base + 2);
                writel(fixup->data, fixup->base + 4);
-               spin_unlock(&mpic->fixup_lock);
+               raw_spin_unlock(&mpic->fixup_lock);
        }
 }
 
@@ -366,7 +366,7 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
 
        DBG("startup_ht_interrupt(0x%x, 0x%x) index: %d\n",
            source, irqflags, fixup->index);
-       spin_lock_irqsave(&mpic->fixup_lock, flags);
+       raw_spin_lock_irqsave(&mpic->fixup_lock, flags);
        /* Enable and configure */
        writeb(0x10 + 2 * fixup->index, fixup->base + 2);
        tmp = readl(fixup->base + 4);
@@ -374,7 +374,7 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
        if (irqflags & IRQ_LEVEL)
                tmp |= 0x22;
        writel(tmp, fixup->base + 4);
-       spin_unlock_irqrestore(&mpic->fixup_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags);
 
 #ifdef CONFIG_PM
        /* use the lowest bit inverted to the actual HW,
@@ -396,12 +396,12 @@ static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source,
        DBG("shutdown_ht_interrupt(0x%x, 0x%x)\n", source, irqflags);
 
        /* Disable */
-       spin_lock_irqsave(&mpic->fixup_lock, flags);
+       raw_spin_lock_irqsave(&mpic->fixup_lock, flags);
        writeb(0x10 + 2 * fixup->index, fixup->base + 2);
        tmp = readl(fixup->base + 4);
        tmp |= 1;
        writel(tmp, fixup->base + 4);
-       spin_unlock_irqrestore(&mpic->fixup_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags);
 
 #ifdef CONFIG_PM
        /* use the lowest bit inverted to the actual HW,
@@ -515,7 +515,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
        BUG_ON(mpic->fixups == NULL);
 
        /* Init spinlock */
-       spin_lock_init(&mpic->fixup_lock);
+       raw_spin_lock_init(&mpic->fixup_lock);
 
        /* Map U3 config space. We assume all IO-APICs are on the primary bus
         * so we only need to map 64kB.
@@ -573,12 +573,12 @@ static int irq_choose_cpu(const cpumask_t *mask)
 
        if (cpumask_equal(mask, cpu_all_mask)) {
                static int irq_rover;
-               static DEFINE_SPINLOCK(irq_rover_lock);
+               static DEFINE_RAW_SPINLOCK(irq_rover_lock);
                unsigned long flags;
 
                /* Round-robin distribution... */
        do_round_robin:
-               spin_lock_irqsave(&irq_rover_lock, flags);
+               raw_spin_lock_irqsave(&irq_rover_lock, flags);
 
                while (!cpu_online(irq_rover)) {
                        if (++irq_rover >= NR_CPUS)
@@ -590,7 +590,7 @@ static int irq_choose_cpu(const cpumask_t *mask)
                                irq_rover = 0;
                } while (!cpu_online(irq_rover));
 
-               spin_unlock_irqrestore(&irq_rover_lock, flags);
+               raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
        } else {
                cpuid = cpumask_first_and(mask, cpu_online_mask);
                if (cpuid >= nr_cpu_ids)
@@ -1368,14 +1368,14 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
        unsigned long flags;
        u32 v;
 
-       spin_lock_irqsave(&mpic_lock, flags);
+       raw_spin_lock_irqsave(&mpic_lock, flags);
        v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1);
        if (enable)
                v |= MPIC_GREG_GLOBAL_CONF_1_SIE;
        else
                v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE;
        mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v);
-       spin_unlock_irqrestore(&mpic_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic_lock, flags);
 }
 
 void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
@@ -1388,7 +1388,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
        if (!mpic)
                return;
 
-       spin_lock_irqsave(&mpic_lock, flags);
+       raw_spin_lock_irqsave(&mpic_lock, flags);
        if (mpic_is_ipi(mpic, irq)) {
                reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
                        ~MPIC_VECPRI_PRIORITY_MASK;
@@ -1400,7 +1400,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
                mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
                               reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
        }
-       spin_unlock_irqrestore(&mpic_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic_lock, flags);
 }
 
 void mpic_setup_this_cpu(void)
@@ -1415,7 +1415,7 @@ void mpic_setup_this_cpu(void)
 
        DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
 
-       spin_lock_irqsave(&mpic_lock, flags);
+       raw_spin_lock_irqsave(&mpic_lock, flags);
 
        /* let the mpic know we want intrs. default affinity is 0xffffffff
         * until changed via /proc. That's how it's done on x86. If we want
@@ -1431,7 +1431,7 @@ void mpic_setup_this_cpu(void)
        /* Set current processor priority to 0 */
        mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0);
 
-       spin_unlock_irqrestore(&mpic_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic_lock, flags);
 #endif /* CONFIG_SMP */
 }
 
@@ -1460,7 +1460,7 @@ void mpic_teardown_this_cpu(int secondary)
        BUG_ON(mpic == NULL);
 
        DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
-       spin_lock_irqsave(&mpic_lock, flags);
+       raw_spin_lock_irqsave(&mpic_lock, flags);
 
        /* let the mpic know we don't want intrs.  */
        for (i = 0; i < mpic->num_sources ; i++)
@@ -1474,7 +1474,7 @@ void mpic_teardown_this_cpu(int secondary)
         */
        mpic_eoi(mpic);
 
-       spin_unlock_irqrestore(&mpic_lock, flags);
+       raw_spin_unlock_irqrestore(&mpic_lock, flags);
 }
 
 
@@ -1575,7 +1575,7 @@ void mpic_request_ipis(void)
        int i;
        BUG_ON(mpic == NULL);
 
-       printk(KERN_INFO "mpic: requesting IPIs ... \n");
+       printk(KERN_INFO "mpic: requesting IPIs...\n");
 
        for (i = 0; i < 4; i++) {
                unsigned int vipi = irq_create_mapping(mpic->irqhost,
index 0f6ab06f8474bdd55c009c60a8833b919d2b6ce3..3b6a9a43718fb46ba240f52fa581c256075129cc 100644 (file)
@@ -60,7 +60,7 @@ static struct irq_chip mpic_pasemi_msi_chip = {
        .eoi            = mpic_end_irq,
        .set_type       = mpic_set_irq_type,
        .set_affinity   = mpic_set_affinity,
-       .name           = "PASEMI-MSI ",
+       .name           = "PASEMI-MSI",
 };
 
 static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
index b6bd775d2e222d765e5bbad2e986c5d9ac19def3..31acd3b1718b8f09be498fd2a15d82aa72464ca5 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/mv643xx.h>
 #include <linux/platform_device.h>
 #include <linux/of_platform.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/prom.h>
 
@@ -189,6 +190,7 @@ static int __init mv64x60_mpsc_device_setup(struct device_node *np, int id)
        pdev = platform_device_alloc(MPSC_CTLR_NAME, port_number);
        if (!pdev)
                return -ENOMEM;
+       pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
        err = platform_device_add_resources(pdev, r, 5);
        if (err)
@@ -302,6 +304,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id,
        if (!pdev)
                return -ENOMEM;
 
+       pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
        err = platform_device_add_resources(pdev, r, 1);
        if (err)
                goto error;
index 6ff9d71b4c0d877e99aedef1fd9d3820bd424a3d..8aa33021e50b39d412d725e3c6dd72afba5e1099 100644 (file)
@@ -569,7 +569,8 @@ static void __init ppc4xx_probe_pcix_bridge(struct device_node *np)
        hose->last_busno = bus_range ? bus_range[1] : 0xff;
 
        /* Setup config space */
-       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, 0);
+       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4,
+                                       PPC_INDIRECT_TYPE_SET_CFG_TYPE);
 
        /* Disable all windows */
        writel(0, reg + PCIX0_POM0SA);
index 5b32adc9a9b249a3ae49392ce26d9e0c0c755fe1..5c014350bf16fdc379d3be5c203b7f52e925a227 100644 (file)
@@ -174,7 +174,8 @@ static int __init ppc4xx_l2c_probe(void)
                | L2C_CFG_CPIM | L2C_CFG_TPIM | L2C_CFG_LIM | L2C_CFG_SMCM;
 
        /* Check for 460EX/GT special handling */
-       if (of_device_is_compatible(np, "ibm,l2-cache-460ex"))
+       if (of_device_is_compatible(np, "ibm,l2-cache-460ex") ||
+           of_device_is_compatible(np, "ibm,l2-cache-460gt"))
                r |= L2C_CFG_RDBW;
 
        mtdcr(dcrbase_l2c + DCRN_L2C0_CFG, r);
index 2acc928d192062a7c50089c5dce154189bfaa923..d927da893ec404087d47a3e2eef29e09858f06bb 100644 (file)
@@ -237,7 +237,7 @@ static void qe_ic_mask_irq(unsigned int virq)
 }
 
 static struct irq_chip qe_ic_irq_chip = {
-       .name = " QEIC  ",
+       .name = "QEIC",
        .unmask = qe_ic_unmask_irq,
        .mask = qe_ic_mask_irq,
        .mask_ack = qe_ic_mask_irq,
@@ -256,7 +256,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq,
        struct irq_chip *chip;
 
        if (qe_ic_info[hw].mask == 0) {
-               printk(KERN_ERR "Can't map reserved IRQ \n");
+               printk(KERN_ERR "Can't map reserved IRQ\n");
                return -EINVAL;
        }
        /* Default chip */
index 7c87460179ef9767afd8401c63947bc1f56b4ac6..77e4934b88c5463dcd73c4b0f531aea79682b7d3 100644 (file)
@@ -157,13 +157,13 @@ int par_io_of_config(struct device_node *np)
        const unsigned int *pio_map;
 
        if (par_io == NULL) {
-               printk(KERN_ERR "par_io not initialized \n");
+               printk(KERN_ERR "par_io not initialized\n");
                return -1;
        }
 
        ph = of_get_property(np, "pio-handle", NULL);
        if (ph == NULL) {
-               printk(KERN_ERR "pio-handle not available \n");
+               printk(KERN_ERR "pio-handle not available\n");
                return -1;
        }
 
@@ -171,12 +171,12 @@ int par_io_of_config(struct device_node *np)
 
        pio_map = of_get_property(pio, "pio-map", &pio_map_len);
        if (pio_map == NULL) {
-               printk(KERN_ERR "pio-map is not set! \n");
+               printk(KERN_ERR "pio-map is not set!\n");
                return -1;
        }
        pio_map_len /= sizeof(unsigned int);
        if ((pio_map_len % 6) != 0) {
-               printk(KERN_ERR "pio-map format wrong! \n");
+               printk(KERN_ERR "pio-map format wrong!\n");
                return -1;
        }
 
index 6f220a913e4293ef89a4f02252fe09a11b6b07dc..0038fb78f09468a4774f32b5836399afe8208d34 100644 (file)
@@ -177,7 +177,7 @@ static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
 }
 
 static struct irq_chip uic_irq_chip = {
-       .name           = " UIC  ",
+       .name           = "UIC",
        .unmask         = uic_unmask_irq,
        .mask           = uic_mask_irq,
        .mask_ack       = uic_mask_ack_irq,
index 4e6152c13764e173aa7811c249c8a359b5a60a5c..8bad7d5f32afb696e8cb0c9e225b3d62913df856 100644 (file)
@@ -61,7 +61,7 @@ static int xmon_owner;
 static int xmon_gate;
 #endif /* CONFIG_SMP */
 
-static unsigned long in_xmon = 0;
+static unsigned long in_xmon __read_mostly = 0;
 
 static unsigned long adrs;
 static int size = 1;
index c80235206c017a89df2b365b5792845f3ecb850b..0d8cd9bbe101a07c9e39aa3a1759ba85a76381e6 100644 (file)
@@ -54,6 +54,9 @@ config GENERIC_BUG
        depends on BUG
        default y
 
+config GENERIC_BUG_RELATIVE_POINTERS
+       def_bool y
+
 config NO_IOMEM
        def_bool y
 
@@ -87,6 +90,7 @@ config S390
        select HAVE_SYSCALL_TRACEPOINTS
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FUNCTION_GRAPH_TRACER
+       select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_DEFAULT_NO_SPIN_MUTEXES
        select HAVE_OPROFILE
        select HAVE_KPROBES
@@ -95,6 +99,9 @@ config S390
        select HAVE_ARCH_TRACEHOOK
        select INIT_ALL_POSSIBLE
        select HAVE_PERF_EVENTS
+       select HAVE_KERNEL_GZIP
+       select HAVE_KERNEL_BZIP2
+       select HAVE_KERNEL_LZMA
        select ARCH_INLINE_SPIN_TRYLOCK
        select ARCH_INLINE_SPIN_TRYLOCK_BH
        select ARCH_INLINE_SPIN_LOCK
index 2283933a9a93eef48b2de37aefe944540af03ff4..45e0c6199f36d6484df7adc657527c02c7974a4e 100644 (file)
@@ -6,4 +6,17 @@ config TRACE_IRQFLAGS_SUPPORT
 
 source "lib/Kconfig.debug"
 
+config DEBUG_STRICT_USER_COPY_CHECKS
+       bool "Strict user copy size checks"
+       ---help---
+         Enabling this option turns a certain set of sanity checks for user
+         copy operations into compile time warnings.
+
+         The copy_from_user() etc checks are there to help test if there
+         are sufficient security checks on the length argument of
+         the copy operation, by having gcc prove that the argument is
+         within bounds.
+
+         If unsure, or if you run an older (pre 4.4) gcc, say N.
+
 endmenu
index fc8fb20e7fc03ff5abdd5192216a8ebbf9f41006..0da10746e0e52ea3bdfd82bf0cad14dd8e28d295 100644 (file)
@@ -14,6 +14,7 @@
 #
 
 ifndef CONFIG_64BIT
+LD_BFD         := elf32-s390
 LDFLAGS                := -m elf_s390
 KBUILD_CFLAGS  += -m31
 KBUILD_AFLAGS  += -m31
@@ -21,6 +22,7 @@ UTS_MACHINE   := s390
 STACK_SIZE     := 8192
 CHECKFLAGS     += -D__s390__ -msize-long
 else
+LD_BFD         := elf64-s390
 LDFLAGS                := -m elf64_s390
 MODFLAGS       += -fpic -D__PIC__
 KBUILD_CFLAGS  += -m64
@@ -30,6 +32,8 @@ STACK_SIZE    := 16384
 CHECKFLAGS     += -D__s390__ -D__s390x__
 endif
 
+export LD_BFD
+
 cflags-$(CONFIG_MARCH_G5)   += $(call cc-option,-march=g5)
 cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
 cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
@@ -85,7 +89,9 @@ KBUILD_AFLAGS += $(aflags-y)
 OBJCOPYFLAGS   := -O binary
 LDFLAGS_vmlinux := -e start
 
-head-y         := arch/s390/kernel/head.o arch/s390/kernel/init_task.o
+head-y         := arch/s390/kernel/head.o
+head-y         += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o)
+head-y         += arch/s390/kernel/init_task.o
 
 core-y         += arch/s390/mm/ arch/s390/kernel/ arch/s390/crypto/ \
                   arch/s390/appldata/ arch/s390/hypfs/ arch/s390/kvm/
@@ -99,12 +105,12 @@ drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
 
 boot           := arch/s390/boot
 
-all: image
+all: image bzImage
 
 install: vmlinux
        $(Q)$(MAKE) $(build)=$(boot) $@
 
-image: vmlinux
+image bzImage: vmlinux
        $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 zfcpdump:
@@ -116,4 +122,5 @@ archclean:
 # Don't use tabs in echo arguments
 define archhelp
   echo  '* image           - Kernel image for IPL ($(boot)/image)'
+  echo '* bzImage         - Compressed kernel image for IPL ($(boot)/bzImage)'
 endef
index 4d97eef36b8d60b0a0ceadce77565de44a9e5f09..8800cf090694766b87b6a881f28a93d77346aec2 100644 (file)
@@ -9,10 +9,18 @@ COMPILE_VERSION := __linux_compile_version_id__`hostname |  \
 EXTRA_CFLAGS  := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I.
 
 targets := image
+targets += bzImage
+subdir- := compressed
 
 $(obj)/image: vmlinux FORCE
        $(call if_changed,objcopy)
 
+$(obj)/bzImage: $(obj)/compressed/vmlinux FORCE
+       $(call if_changed,objcopy)
+
+$(obj)/compressed/vmlinux: FORCE
+       $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+
 install: $(CONFIGURE) $(obj)/image
        sh -x  $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/image \
              System.map Kerntypes "$(INSTALL_PATH)"
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
new file mode 100644 (file)
index 0000000..6e4a67a
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# linux/arch/s390/boot/compressed/Makefile
+#
+# create a compressed vmlinux image from the original vmlinux
+#
+
+BITS := $(if $(CONFIG_64BIT),64,31)
+
+targets        := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
+          vmlinux.bin.lzma misc.o piggy.o sizes.h head$(BITS).o
+
+KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
+KBUILD_CFLAGS += $(cflags-y)
+KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
+KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
+
+GCOV_PROFILE := n
+
+OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o)
+OBJECTS += $(obj)/head$(BITS).o $(obj)/misc.o $(obj)/piggy.o
+
+LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
+$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
+       $(call if_changed,ld)
+       @:
+
+sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 0x\1/p'
+
+quiet_cmd_sizes = GEN $@
+      cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
+
+$(obj)/sizes.h: vmlinux
+       $(call if_changed,sizes)
+
+AFLAGS_head$(BITS).o += -I$(obj)
+$(obj)/head$(BITS).o: $(obj)/sizes.h
+
+CFLAGS_misc.o += -I$(obj)
+$(obj)/misc.o: $(obj)/sizes.h
+
+OBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
+$(obj)/vmlinux.bin: vmlinux
+       $(call if_changed,objcopy)
+
+vmlinux.bin.all-y := $(obj)/vmlinux.bin
+
+suffix-$(CONFIG_KERNEL_GZIP)  := gz
+suffix-$(CONFIG_KERNEL_BZIP2) := bz2
+suffix-$(CONFIG_KERNEL_LZMA)  := lzma
+
+$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
+       $(call if_changed,gzip)
+$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
+       $(call if_changed,bzip2)
+$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
+       $(call if_changed,lzma)
+
+LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
+$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
+       $(call if_changed,ld)
diff --git a/arch/s390/boot/compressed/head31.S b/arch/s390/boot/compressed/head31.S
new file mode 100644 (file)
index 0000000..2a5523a
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Startup glue code to uncompress the kernel
+ *
+ * Copyright IBM Corp. 2010
+ *
+ *   Author(s):        Martin Schwidefsky <schwidefsky@de.ibm.com>
+ */
+
+#include <linux/init.h>
+#include <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+#include <asm/page.h>
+#include "sizes.h"
+
+__HEAD
+       .globl  startup_continue
+startup_continue:
+       basr    %r13,0                  # get base
+.LPG1:
+       # setup stack
+       l       %r15,.Lstack-.LPG1(%r13)
+       ahi     %r15,-96
+       l       %r1,.Ldecompress-.LPG1(%r13)
+       basr    %r14,%r1
+       # setup registers for memory mover & branch to target
+       lr      %r4,%r2
+       l       %r2,.Loffset-.LPG1(%r13)
+       la      %r4,0(%r2,%r4)
+       l       %r3,.Lmvsize-.LPG1(%r13)
+       lr      %r5,%r3
+       # move the memory mover someplace safe
+       la      %r1,0x200
+       mvc     0(mover_end-mover,%r1),mover-.LPG1(%r13)
+       # decompress image is started at 0x11000
+       lr      %r6,%r2
+       br      %r1
+mover:
+       mvcle   %r2,%r4,0
+       jo      mover
+       br      %r6
+mover_end:
+
+       .align  8
+.Lstack:
+       .long   0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
+.Ldecompress:
+       .long   decompress_kernel
+.Loffset:
+       .long   0x11000
+.Lmvsize:
+       .long   SZ__bss_start
diff --git a/arch/s390/boot/compressed/head64.S b/arch/s390/boot/compressed/head64.S
new file mode 100644 (file)
index 0000000..2982cb1
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Startup glue code to uncompress the kernel
+ *
+ * Copyright IBM Corp. 2010
+ *
+ *   Author(s):        Martin Schwidefsky <schwidefsky@de.ibm.com>
+ */
+
+#include <linux/init.h>
+#include <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+#include <asm/page.h>
+#include "sizes.h"
+
+__HEAD
+       .globl  startup_continue
+startup_continue:
+       basr    %r13,0                  # get base
+.LPG1:
+       # setup stack
+       lg      %r15,.Lstack-.LPG1(%r13)
+       aghi    %r15,-160
+       brasl   %r14,decompress_kernel
+       # setup registers for memory mover & branch to target
+       lgr     %r4,%r2
+       lg      %r2,.Loffset-.LPG1(%r13)
+       la      %r4,0(%r2,%r4)
+       lg      %r3,.Lmvsize-.LPG1(%r13)
+       lgr     %r5,%r3
+       # move the memory mover someplace safe
+       la      %r1,0x200
+       mvc     0(mover_end-mover,%r1),mover-.LPG1(%r13)
+       # decompress image is started at 0x11000
+       lgr     %r6,%r2
+       br      %r1
+mover:
+       mvcle   %r2,%r4,0
+       jo      mover
+       br      %r6
+mover_end:
+
+       .align  8
+.Lstack:
+       .quad   0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
+.Loffset:
+       .quad   0x11000
+.Lmvsize:
+       .quad   SZ__bss_start
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
new file mode 100644 (file)
index 0000000..a97d695
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Definitions and wrapper functions for kernel decompressor
+ *
+ * Copyright IBM Corp. 2010
+ *
+ * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
+ */
+
+#include <asm/uaccess.h>
+#include <asm/page.h>
+#include <asm/ipl.h>
+#include "sizes.h"
+
+/*
+ * gzip declarations
+ */
+#define STATIC static
+
+#undef memset
+#undef memcpy
+#undef memmove
+#define memzero(s, n) memset((s), 0, (n))
+
+/* Symbols defined by linker scripts */
+extern char input_data[];
+extern int input_len;
+extern int _text;
+extern int _end;
+
+static void error(char *m);
+
+static unsigned long free_mem_ptr;
+static unsigned long free_mem_end_ptr;
+
+#ifdef CONFIG_HAVE_KERNEL_BZIP2
+#define HEAP_SIZE      0x400000
+#else
+#define HEAP_SIZE      0x10000
+#endif
+
+#ifdef CONFIG_KERNEL_GZIP
+#include "../../../../lib/decompress_inflate.c"
+#endif
+
+#ifdef CONFIG_KERNEL_BZIP2
+#include "../../../../lib/decompress_bunzip2.c"
+#endif
+
+#ifdef CONFIG_KERNEL_LZMA
+#include "../../../../lib/decompress_unlzma.c"
+#endif
+
+extern _sclp_print_early(const char *);
+
+int puts(const char *s)
+{
+       _sclp_print_early(s);
+       return 0;
+}
+
+void *memset(void *s, int c, size_t n)
+{
+       char *xs;
+
+       if (c == 0)
+               return __builtin_memset(s, 0, n);
+
+       xs = (char *) s;
+       if (n > 0)
+               do {
+                       *xs++ = c;
+               } while (--n > 0);
+       return s;
+}
+
+void *memcpy(void *__dest, __const void *__src, size_t __n)
+{
+       return __builtin_memcpy(__dest, __src, __n);
+}
+
+void *memmove(void *__dest, __const void *__src, size_t __n)
+{
+       char *d;
+       const char *s;
+
+       if (__dest <= __src)
+               return __builtin_memcpy(__dest, __src, __n);
+       d = __dest + __n;
+       s = __src + __n;
+       while (__n--)
+               *--d = *--s;
+       return __dest;
+}
+
+static void error(char *x)
+{
+       unsigned long long psw = 0x000a0000deadbeefULL;
+
+       puts("\n\n");
+       puts(x);
+       puts("\n\n -- System halted");
+
+       asm volatile("lpsw %0" : : "Q" (psw));
+}
+
+/*
+ * Safe guard the ipl parameter block against a memory area that will be
+ * overwritten. The validity check for the ipl parameter block is complex
+ * (see cio_get_iplinfo and ipl_save_parameters) but if the pointer to
+ * the ipl parameter block intersects with the passed memory area we can
+ * safely assume that we can read from that memory. In that case just copy
+ * the memory to IPL_PARMBLOCK_ORIGIN even if there is no ipl parameter
+ * block.
+ */
+static void check_ipl_parmblock(void *start, unsigned long size)
+{
+       void *src, *dst;
+
+       src = (void *)(unsigned long) S390_lowcore.ipl_parmblock_ptr;
+       if (src + PAGE_SIZE <= start || src >= start + size)
+               return;
+       dst = (void *) IPL_PARMBLOCK_ORIGIN;
+       memmove(dst, src, PAGE_SIZE);
+       S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
+}
+
+unsigned long decompress_kernel(void)
+{
+       unsigned long output_addr;
+       unsigned char *output;
+
+       free_mem_ptr = (unsigned long)&_end;
+       free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
+       output = (unsigned char *) ((free_mem_end_ptr + 4095UL) & -4096UL);
+
+       check_ipl_parmblock((void *) 0, (unsigned long) output + SZ__bss_start);
+
+#ifdef CONFIG_BLK_DEV_INITRD
+       /*
+        * Move the initrd right behind the end of the decompressed
+        * kernel image.
+        */
+       if (INITRD_START && INITRD_SIZE &&
+           INITRD_START < (unsigned long) output + SZ__bss_start) {
+               check_ipl_parmblock(output + SZ__bss_start,
+                                   INITRD_START + INITRD_SIZE);
+               memmove(output + SZ__bss_start,
+                       (void *) INITRD_START, INITRD_SIZE);
+               INITRD_START = (unsigned long) output + SZ__bss_start;
+       }
+#endif
+
+       puts("Uncompressing Linux... ");
+       decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+       puts("Ok, booting the kernel.\n");
+       return (unsigned long) output;
+}
+
diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S
new file mode 100644 (file)
index 0000000..d80f79d
--- /dev/null
@@ -0,0 +1,55 @@
+#include <asm-generic/vmlinux.lds.h>
+
+#ifdef CONFIG_64BIT
+OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
+OUTPUT_ARCH(s390:64-bit)
+#else
+OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
+OUTPUT_ARCH(s390)
+#endif
+
+ENTRY(startup)
+
+SECTIONS
+{
+       /* Be careful parts of head_64.S assume startup_32 is at
+        * address 0.
+        */
+       . = 0;
+       .head.text : {
+               _head = . ;
+               HEAD_TEXT
+               _ehead = . ;
+       }
+       .rodata.compressed : {
+               *(.rodata.compressed)
+       }
+       .text : {
+               _text = .;      /* Text */
+               *(.text)
+               *(.text.*)
+               _etext = . ;
+       }
+       .rodata : {
+               _rodata = . ;
+               *(.rodata)       /* read-only data */
+               *(.rodata.*)
+               _erodata = . ;
+       }
+       .data : {
+               _data = . ;
+               *(.data)
+               *(.data.*)
+               _edata = . ;
+       }
+       . = ALIGN(256);
+       .bss : {
+               _bss = . ;
+               *(.bss)
+               *(.bss.*)
+               *(COMMON)
+               . = ALIGN(8);   /* For convenience during zeroing */
+               _ebss = .;
+       }
+       _end = .;
+}
diff --git a/arch/s390/boot/compressed/vmlinux.scr b/arch/s390/boot/compressed/vmlinux.scr
new file mode 100644 (file)
index 0000000..f02382a
--- /dev/null
@@ -0,0 +1,10 @@
+SECTIONS
+{
+  .rodata.compressed : {
+       input_len = .;
+       LONG(input_data_end - input_data) input_data = .;
+       *(.data)
+       output_len = . - 4;
+       input_data_end = .;
+       }
+}
index 6be4503201ac4b03d6943fd3c37edacb795f2779..58f46734465ffad0f7dcb8412799b747c923ffd2 100644 (file)
@@ -78,14 +78,14 @@ static int setkey_fallback_cip(struct crypto_tfm *tfm, const u8 *in_key,
        struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
        int ret;
 
-       sctx->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
-       sctx->fallback.blk->base.crt_flags |= (tfm->crt_flags &
+       sctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
+       sctx->fallback.cip->base.crt_flags |= (tfm->crt_flags &
                        CRYPTO_TFM_REQ_MASK);
 
        ret = crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len);
        if (ret) {
                tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK;
-               tfm->crt_flags |= (sctx->fallback.blk->base.crt_flags &
+               tfm->crt_flags |= (sctx->fallback.cip->base.crt_flags &
                                CRYPTO_TFM_RES_MASK);
        }
        return ret;
index b416aa11b91eb506a0d5c6bcbc1108ae231e664f..7ae71cc56973adfdb75b42b1d22ee54fa09a74f5 100644 (file)
@@ -36,6 +36,13 @@ CONFIG_LOCK_KERNEL=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
 CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_BZIP2 is not set
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_LZO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
index 2b92d501425f20262c0f38e5c34f4634634732db..87cf523192e98527d85b00c7ee646b79b00b74d5 100644 (file)
@@ -488,7 +488,7 @@ out:
 
 static int diag224(void *ptr)
 {
-       int rc = -ENOTSUPP;
+       int rc = -EOPNOTSUPP;
 
        asm volatile(
                "       diag    %1,%2,0x224\n"
@@ -507,7 +507,7 @@ static int diag224_get_name_table(void)
                return -ENOMEM;
        if (diag224(diag224_cpu_names)) {
                kfree(diag224_cpu_names);
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
        EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
        return 0;
index 2a113d6a7dfd1fe95d63ba1c73edd49449f8c4e0..451bfbb9db3dbac8830ace5d850ae98ee75ad341 100644 (file)
@@ -18,8 +18,6 @@
 
 #define ATOMIC_INIT(i)  { (i) }
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-
 #define __CS_LOOP(ptr, op_val, op_string) ({                           \
        int old_val, new_val;                                           \
        asm volatile(                                                   \
        new_val;                                                        \
 })
 
-#else /* __GNUC__ */
-
-#define __CS_LOOP(ptr, op_val, op_string) ({                           \
-       int old_val, new_val;                                           \
-       asm volatile(                                                   \
-               "       l       %0,0(%3)\n"                             \
-               "0:     lr      %1,%0\n"                                \
-               op_string "     %1,%4\n"                                \
-               "       cs      %0,%1,0(%3)\n"                          \
-               "       jl      0b"                                     \
-               : "=&d" (old_val), "=&d" (new_val),                     \
-                 "=m" (((atomic_t *)(ptr))->counter)                   \
-               : "a" (ptr), "d" (op_val),                              \
-                 "m" (((atomic_t *)(ptr))->counter)                    \
-               : "cc", "memory");                                      \
-       new_val;                                                        \
-})
-
-#endif /* __GNUC__ */
-
 static inline int atomic_read(const atomic_t *v)
 {
        barrier();
@@ -101,19 +79,11 @@ static inline void atomic_set_mask(unsigned long mask, atomic_t *v)
 
 static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
 {
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
        asm volatile(
                "       cs      %0,%2,%1"
                : "+d" (old), "=Q" (v->counter)
                : "d" (new), "Q" (v->counter)
                : "cc", "memory");
-#else /* __GNUC__ */
-       asm volatile(
-               "       cs      %0,%3,0(%2)"
-               : "+d" (old), "=m" (v->counter)
-               : "a" (v), "d" (new), "m" (v->counter)
-               : "cc", "memory");
-#endif /* __GNUC__ */
        return old;
 }
 
@@ -140,8 +110,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
 
 #ifdef CONFIG_64BIT
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-
 #define __CSG_LOOP(ptr, op_val, op_string) ({                          \
        long long old_val, new_val;                                     \
        asm volatile(                                                   \
@@ -157,26 +125,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
        new_val;                                                        \
 })
 
-#else /* __GNUC__ */
-
-#define __CSG_LOOP(ptr, op_val, op_string) ({                          \
-       long long old_val, new_val;                                     \
-       asm volatile(                                                   \
-               "       lg      %0,0(%3)\n"                             \
-               "0:     lgr     %1,%0\n"                                \
-               op_string "     %1,%4\n"                                \
-               "       csg     %0,%1,0(%3)\n"                          \
-               "       jl      0b"                                     \
-               : "=&d" (old_val), "=&d" (new_val),                     \
-                 "=m" (((atomic_t *)(ptr))->counter)                   \
-               : "a" (ptr), "d" (op_val),                              \
-                 "m" (((atomic_t *)(ptr))->counter)                    \
-               : "cc", "memory");                                      \
-       new_val;                                                        \
-})
-
-#endif /* __GNUC__ */
-
 static inline long long atomic64_read(const atomic64_t *v)
 {
        barrier();
@@ -214,19 +162,11 @@ static inline void atomic64_set_mask(unsigned long mask, atomic64_t *v)
 static inline long long atomic64_cmpxchg(atomic64_t *v,
                                             long long old, long long new)
 {
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
        asm volatile(
                "       csg     %0,%2,%1"
                : "+d" (old), "=Q" (v->counter)
                : "d" (new), "Q" (v->counter)
                : "cc", "memory");
-#else /* __GNUC__ */
-       asm volatile(
-               "       csg     %0,%3,0(%2)"
-               : "+d" (old), "=m" (v->counter)
-               : "a" (v), "d" (new), "m" (v->counter)
-               : "cc", "memory");
-#endif /* __GNUC__ */
        return old;
 }
 
@@ -243,10 +183,8 @@ static inline long long atomic64_read(const atomic64_t *v)
        register_pair rp;
 
        asm volatile(
-               "       lm      %0,%N0,0(%1)"
-               : "=&d" (rp)
-               : "a" (&v->counter), "m" (v->counter)
-               );
+               "       lm      %0,%N0,%1"
+               : "=&d" (rp) : "Q" (v->counter) );
        return rp.pair;
 }
 
@@ -255,10 +193,8 @@ static inline void atomic64_set(atomic64_t *v, long long i)
        register_pair rp = {.pair = i};
 
        asm volatile(
-               "       stm     %1,%N1,0(%2)"
-               : "=m" (v->counter)
-               : "d" (rp), "a" (&v->counter)
-               );
+               "       stm     %1,%N1,%0"
+               : "=Q" (v->counter) : "d" (rp) );
 }
 
 static inline long long atomic64_xchg(atomic64_t *v, long long new)
@@ -267,11 +203,11 @@ static inline long long atomic64_xchg(atomic64_t *v, long long new)
        register_pair rp_old;
 
        asm volatile(
-               "       lm      %0,%N0,0(%2)\n"
-               "0:     cds     %0,%3,0(%2)\n"
+               "       lm      %0,%N0,%1\n"
+               "0:     cds     %0,%2,%1\n"
                "       jl      0b\n"
-               : "=&d" (rp_old), "+m" (v->counter)
-               : "a" (&v->counter), "d" (rp_new)
+               : "=&d" (rp_old), "=Q" (v->counter)
+               : "d" (rp_new), "Q" (v->counter)
                : "cc");
        return rp_old.pair;
 }
@@ -283,9 +219,9 @@ static inline long long atomic64_cmpxchg(atomic64_t *v,
        register_pair rp_new = {.pair = new};
 
        asm volatile(
-               "       cds     %0,%3,0(%2)"
-               : "+&d" (rp_old), "+m" (v->counter)
-               : "a" (&v->counter), "d" (rp_new)
+               "       cds     %0,%2,%1"
+               : "+&d" (rp_old), "=Q" (v->counter)
+               : "d" (rp_new), "Q" (v->counter)
                : "cc");
        return rp_old.pair;
 }
index b30606f6d5230e45b4eb8f4e3f009eb929d02a84..2e05972c5085cec285a0653b9b314fb2dbf6d40c 100644 (file)
@@ -71,8 +71,6 @@ extern const char _sb_findmap[];
 #define __BITOPS_AND           "nr"
 #define __BITOPS_XOR           "xr"
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-
 #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)        \
        asm volatile(                                           \
                "       l       %0,%2\n"                        \
@@ -85,22 +83,6 @@ extern const char _sb_findmap[];
                : "d" (__val), "Q" (*(unsigned long *) __addr)  \
                : "cc");
 
-#else /* __GNUC__ */
-
-#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)        \
-       asm volatile(                                           \
-               "       l       %0,0(%4)\n"                     \
-               "0:     lr      %1,%0\n"                        \
-               __op_string "   %1,%3\n"                        \
-               "       cs      %0,%1,0(%4)\n"                  \
-               "       jl      0b"                             \
-               : "=&d" (__old), "=&d" (__new),                 \
-                 "=m" (*(unsigned long *) __addr)              \
-               : "d" (__val), "a" (__addr),                    \
-                 "m" (*(unsigned long *) __addr) : "cc");
-
-#endif /* __GNUC__ */
-
 #else /* __s390x__ */
 
 #define __BITOPS_ALIGN         7
@@ -109,8 +91,6 @@ extern const char _sb_findmap[];
 #define __BITOPS_AND           "ngr"
 #define __BITOPS_XOR           "xgr"
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-
 #define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)        \
        asm volatile(                                           \
                "       lg      %0,%2\n"                        \
@@ -123,23 +103,6 @@ extern const char _sb_findmap[];
                : "d" (__val), "Q" (*(unsigned long *) __addr)  \
                : "cc");
 
-#else /* __GNUC__ */
-
-#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)        \
-       asm volatile(                                           \
-               "       lg      %0,0(%4)\n"                     \
-               "0:     lgr     %1,%0\n"                        \
-               __op_string "   %1,%3\n"                        \
-               "       csg     %0,%1,0(%4)\n"                  \
-               "       jl      0b"                             \
-               : "=&d" (__old), "=&d" (__new),                 \
-                 "=m" (*(unsigned long *) __addr)              \
-               : "d" (__val), "a" (__addr),                    \
-                 "m" (*(unsigned long *) __addr) : "cc");
-
-
-#endif /* __GNUC__ */
-
 #endif /* __s390x__ */
 
 #define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
@@ -261,9 +224,8 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
 
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        asm volatile(
-               "       oc      0(1,%1),0(%2)"
-               : "=m" (*(char *) addr) : "a" (addr),
-                 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
+               "       oc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
 }
 
 static inline void 
@@ -290,9 +252,8 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr)
 
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        asm volatile(
-               "       nc      0(1,%1),0(%2)"
-               : "=m" (*(char *) addr) : "a" (addr),
-                 "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc");
+               "       nc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7]) : "cc" );
 }
 
 static inline void 
@@ -318,9 +279,8 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
 
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        asm volatile(
-               "       xc      0(1,%1),0(%2)"
-               :  "=m" (*(char *) addr) : "a" (addr),
-                  "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
+               "       xc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
 }
 
 static inline void 
@@ -349,10 +309,9 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        ch = *(unsigned char *) addr;
        asm volatile(
-               "       oc      0(1,%1),0(%2)"
-               : "=m" (*(char *) addr)
-               : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
-                 "m" (*(char *) addr) : "cc", "memory");
+               "       oc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
+               : "cc", "memory");
        return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_set_bit(X,Y)                test_and_set_bit_simple(X,Y)
@@ -369,10 +328,9 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        ch = *(unsigned char *) addr;
        asm volatile(
-               "       nc      0(1,%1),0(%2)"
-               : "=m" (*(char *) addr)
-               : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
-                 "m" (*(char *) addr) : "cc", "memory");
+               "       nc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7])
+               : "cc", "memory");
        return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_clear_bit(X,Y)      test_and_clear_bit_simple(X,Y)
@@ -389,10 +347,9 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
        addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
        ch = *(unsigned char *) addr;
        asm volatile(
-               "       xc      0(1,%1),0(%2)"
-               : "=m" (*(char *) addr)
-               : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
-                 "m" (*(char *) addr) : "cc", "memory");
+               "       xc      %O0(1,%R0),%1"
+               : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7])
+               : "cc", "memory");
        return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_change_bit(X,Y)     test_and_change_bit_simple(X,Y)
@@ -591,11 +548,11 @@ static inline unsigned long __load_ulong_le(const unsigned long *p,
        p = (unsigned long *)((unsigned long) p + offset);
 #ifndef __s390x__
        asm volatile(
-               "       ic      %0,0(%1)\n"
-               "       icm     %0,2,1(%1)\n"
-               "       icm     %0,4,2(%1)\n"
-               "       icm     %0,8,3(%1)"
-               : "=&d" (word) : "a" (p), "m" (*p) : "cc");
+               "       ic      %0,%O1(%R1)\n"
+               "       icm     %0,2,%O1+1(%R1)\n"
+               "       icm     %0,4,%O1+2(%R1)\n"
+               "       icm     %0,8,%O1+3(%R1)"
+               : "=&d" (word) : "Q" (*p) : "cc");
 #else
        asm volatile(
                "       lrvg    %0,%1"
index efb74fd5156e8f14590e012260dc6f568b627d3f..9beeb9db9b23a7695adaf435755d1b1ae5bd37af 100644 (file)
@@ -5,12 +5,6 @@
 
 #ifdef CONFIG_BUG
 
-#ifdef CONFIG_64BIT
-#define S390_LONG ".quad"
-#else
-#define S390_LONG ".long"
-#endif
-
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 
 #define __EMIT_BUG(x) do {                                     \
@@ -21,7 +15,7 @@
                "2:     .asciz  \""__FILE__"\"\n"               \
                ".previous\n"                                   \
                ".section __bug_table,\"a\"\n"                  \
-               "3:\t"  S390_LONG "\t1b,2b\n"                   \
+               "3:     .long   1b-3b,2b-3b\n"                  \
                "       .short  %0,%1\n"                        \
                "       .org    3b+%2\n"                        \
                ".previous\n"                                   \
@@ -37,7 +31,7 @@
                "0:     j       0b+2\n"                 \
                "1:\n"                                  \
                ".section __bug_table,\"a\"\n"          \
-               "2:\t"  S390_LONG "\t1b\n"              \
+               "2:     .long   1b-2b\n"                \
                "       .short  %0\n"                   \
                "       .org    2b+%1\n"                \
                ".previous\n"                           \
        unreachable();                                  \
 } while (0)
 
+#define __WARN() do {                                  \
+       __EMIT_BUG(BUGFLAG_WARNING);                    \
+} while (0)
+
 #define WARN_ON(x) ({                                  \
        int __ret_warn_on = !!(x);                      \
        if (__builtin_constant_p(__ret_warn_on)) {      \
index 2185a6d619d326b53e58f60ac928d35b782d8fd4..749a97e61bea0b014cc54639a1d8b9528e62f8c7 100644 (file)
@@ -32,6 +32,7 @@ typedef void (*crw_handler_t)(struct crw *, struct crw *, int);
 extern int crw_register_handler(int rsc, crw_handler_t handler);
 extern void crw_unregister_handler(int rsc);
 extern void crw_handle_channel_report(void);
+void crw_wait_for_channel_report(void);
 
 #define NR_RSCS 16
 
index 80ef58c619709b9d7a576772f64339041a734b06..538e1b36a726e71c2149e90041ff6cada6d2b2cc 100644 (file)
@@ -145,11 +145,11 @@ static inline int etr_setr(struct etr_eacr *ctrl)
        int rc = -ENOSYS;
 
        asm volatile(
-               "       .insn   s,0xb2160000,0(%2)\n"
+               "       .insn   s,0xb2160000,%1\n"
                "0:     la      %0,0\n"
                "1:\n"
                EX_TABLE(0b,1b)
-               : "+d" (rc) : "m" (*ctrl), "a" (ctrl));
+               : "+d" (rc) : "Q" (*ctrl));
        return rc;
 }
 
@@ -159,11 +159,11 @@ static inline int etr_stetr(struct etr_aib *aib)
        int rc = -ENOSYS;
 
        asm volatile(
-               "       .insn   s,0xb2170000,0(%2)\n"
+               "       .insn   s,0xb2170000,%1\n"
                "0:     la      %0,0\n"
                "1:\n"
                EX_TABLE(0b,1b)
-               : "+d" (rc) : "m" (*aib), "a" (aib));
+               : "+d" (rc) : "Q" (*aib));
        return rc;
 }
 
@@ -174,11 +174,11 @@ static inline int etr_steai(struct etr_aib *aib, unsigned int func)
        int rc = -ENOSYS;
 
        asm volatile(
-               "       .insn   s,0xb2b30000,0(%2)\n"
+               "       .insn   s,0xb2b30000,%1\n"
                "0:     la      %0,0\n"
                "1:\n"
                EX_TABLE(0b,1b)
-               : "+d" (rc) : "m" (*aib), "a" (aib), "d" (reg0));
+               : "+d" (rc) : "Q" (*aib), "d" (reg0));
        return rc;
 }
 
index 3f26131120b746c47c81e7d370d76a2422b46153..15b3ac253898d8029e886c192f5d887bf1b3948f 100644 (file)
@@ -1,16 +1,12 @@
 /*
- *  include/asm-s390/irqflags.h
- *
- *    Copyright (C) IBM Corp. 2006
- *    Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
+ *    Copyright IBM Corp. 2006,2010
+ *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
 
 #ifndef __ASM_IRQFLAGS_H
 #define __ASM_IRQFLAGS_H
 
-#ifdef __KERNEL__
-
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
+#include <linux/types.h>
 
 /* store then or system mask. */
 #define __raw_local_irq_stosm(__or)                                    \
        asm volatile("ssm   %0" : : "Q" (__mask) : "memory");           \
 })
 
-#else /* __GNUC__ */
-
-/* store then or system mask. */
-#define __raw_local_irq_stosm(__or)                                    \
-({                                                                     \
-       unsigned long __mask;                                           \
-       asm volatile(                                                   \
-               "       stosm   0(%1),%2"                               \
-               : "=m" (__mask)                                         \
-               : "a" (&__mask), "i" (__or) : "memory");                \
-       __mask;                                                         \
-})
-
-/* store then and system mask. */
-#define __raw_local_irq_stnsm(__and)                                   \
-({                                                                     \
-       unsigned long __mask;                                           \
-       asm volatile(                                                   \
-               "       stnsm   0(%1),%2"                               \
-               : "=m" (__mask)                                         \
-               : "a" (&__mask), "i" (__and) : "memory");               \
-       __mask;                                                         \
-})
-
-/* set system mask. */
-#define __raw_local_irq_ssm(__mask)                                    \
-({                                                                     \
-       asm volatile(                                                   \
-               "       ssm     0(%0)"                                  \
-               : : "a" (&__mask), "m" (__mask) : "memory");            \
-})
-
-#endif /* __GNUC__ */
-
 /* interrupt control.. */
 static inline unsigned long raw_local_irq_enable(void)
 {
@@ -102,5 +64,4 @@ static inline int raw_irqs_disabled_flags(unsigned long flags)
 /* For spinlocks etc */
 #define raw_local_irq_save(x)  ((x) = raw_local_irq_disable())
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_IRQFLAGS_H */
index f2ef4b619ce1a7415966169b89b5cb3779b198ab..05527c040b7a7ceb1d517c3d3ca332ac1bc0573c 100644 (file)
 /*
- *  include/asm-s390/lowcore.h
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
+ *    Copyright IBM Corp. 1999,2010
+ *    Author(s): Hartmut Penner <hp@de.ibm.com>,
+ *              Martin Schwidefsky <schwidefsky@de.ibm.com>,
+ *              Denis Joseph Barrow,
  */
 
 #ifndef _ASM_S390_LOWCORE_H
 #define _ASM_S390_LOWCORE_H
 
-#define __LC_IPL_PARMBLOCK_PTR         0x0014
-#define __LC_EXT_PARAMS                        0x0080
-#define __LC_CPU_ADDRESS               0x0084
-#define __LC_EXT_INT_CODE              0x0086
-
-#define __LC_SVC_ILC                   0x0088
-#define __LC_SVC_INT_CODE              0x008a
-#define __LC_PGM_ILC                   0x008c
-#define __LC_PGM_INT_CODE              0x008e
-
-#define __LC_PER_ATMID                 0x0096
-#define __LC_PER_ADDRESS               0x0098
-#define __LC_PER_ACCESS_ID             0x00a1
-#define __LC_AR_MODE_ID                        0x00a3
-
-#define __LC_SUBCHANNEL_ID             0x00b8
-#define __LC_SUBCHANNEL_NR             0x00ba
-#define __LC_IO_INT_PARM               0x00bc
-#define __LC_IO_INT_WORD               0x00c0
-#define __LC_STFL_FAC_LIST             0x00c8
-#define __LC_MCCK_CODE                 0x00e8
-
-#define __LC_DUMP_REIPL                        0x0e00
-
-#ifndef __s390x__
-#define __LC_EXT_OLD_PSW               0x0018
-#define __LC_SVC_OLD_PSW               0x0020
-#define __LC_PGM_OLD_PSW               0x0028
-#define __LC_MCK_OLD_PSW               0x0030
-#define __LC_IO_OLD_PSW                        0x0038
-#define __LC_EXT_NEW_PSW               0x0058
-#define __LC_SVC_NEW_PSW               0x0060
-#define __LC_PGM_NEW_PSW               0x0068
-#define __LC_MCK_NEW_PSW               0x0070
-#define __LC_IO_NEW_PSW                        0x0078
-#define __LC_SAVE_AREA                 0x0200
-#define __LC_RETURN_PSW                        0x0240
-#define __LC_RETURN_MCCK_PSW           0x0248
-#define __LC_SYNC_ENTER_TIMER          0x0250
-#define __LC_ASYNC_ENTER_TIMER         0x0258
-#define __LC_EXIT_TIMER                        0x0260
-#define __LC_USER_TIMER                        0x0268
-#define __LC_SYSTEM_TIMER              0x0270
-#define __LC_STEAL_TIMER               0x0278
-#define __LC_LAST_UPDATE_TIMER         0x0280
-#define __LC_LAST_UPDATE_CLOCK         0x0288
-#define __LC_CURRENT                   0x0290
-#define __LC_THREAD_INFO               0x0294
-#define __LC_KERNEL_STACK              0x0298
-#define __LC_ASYNC_STACK               0x029c
-#define __LC_PANIC_STACK               0x02a0
-#define __LC_KERNEL_ASCE               0x02a4
-#define __LC_USER_ASCE                 0x02a8
-#define __LC_USER_EXEC_ASCE            0x02ac
-#define __LC_CPUID                     0x02b0
-#define __LC_INT_CLOCK                 0x02c8
-#define __LC_MACHINE_FLAGS             0x02d8
-#define __LC_FTRACE_FUNC               0x02dc
-#define __LC_IRB                       0x0300
-#define __LC_PFAULT_INTPARM            0x0080
-#define __LC_CPU_TIMER_SAVE_AREA       0x00d8
-#define __LC_CLOCK_COMP_SAVE_AREA      0x00e0
-#define __LC_PSW_SAVE_AREA             0x0100
-#define __LC_PREFIX_SAVE_AREA          0x0108
-#define __LC_AREGS_SAVE_AREA           0x0120
-#define __LC_FPREGS_SAVE_AREA          0x0160
-#define __LC_GPREGS_SAVE_AREA          0x0180
-#define __LC_CREGS_SAVE_AREA           0x01c0
-#else /* __s390x__ */
-#define __LC_LAST_BREAK                        0x0110
-#define __LC_EXT_OLD_PSW               0x0130
-#define __LC_SVC_OLD_PSW               0x0140
-#define __LC_PGM_OLD_PSW               0x0150
-#define __LC_MCK_OLD_PSW               0x0160
-#define __LC_IO_OLD_PSW                        0x0170
-#define __LC_RESTART_PSW               0x01a0
-#define __LC_EXT_NEW_PSW               0x01b0
-#define __LC_SVC_NEW_PSW               0x01c0
-#define __LC_PGM_NEW_PSW               0x01d0
-#define __LC_MCK_NEW_PSW               0x01e0
-#define __LC_IO_NEW_PSW                        0x01f0
-#define __LC_SAVE_AREA                 0x0200
-#define __LC_RETURN_PSW                        0x0280
-#define __LC_RETURN_MCCK_PSW           0x0290
-#define __LC_SYNC_ENTER_TIMER          0x02a0
-#define __LC_ASYNC_ENTER_TIMER         0x02a8
-#define __LC_EXIT_TIMER                        0x02b0
-#define __LC_USER_TIMER                        0x02b8
-#define __LC_SYSTEM_TIMER              0x02c0
-#define __LC_STEAL_TIMER               0x02c8
-#define __LC_LAST_UPDATE_TIMER         0x02d0
-#define __LC_LAST_UPDATE_CLOCK         0x02d8
-#define __LC_CURRENT                   0x02e0
-#define __LC_THREAD_INFO               0x02e8
-#define __LC_KERNEL_STACK              0x02f0
-#define __LC_ASYNC_STACK               0x02f8
-#define __LC_PANIC_STACK               0x0300
-#define __LC_KERNEL_ASCE               0x0308
-#define __LC_USER_ASCE                 0x0310
-#define __LC_USER_EXEC_ASCE            0x0318
-#define __LC_CPUID                     0x0320
-#define __LC_INT_CLOCK                 0x0340
-#define __LC_VDSO_PER_CPU              0x0350
-#define __LC_MACHINE_FLAGS             0x0358
-#define __LC_FTRACE_FUNC               0x0360
-#define __LC_IRB                       0x0380
-#define __LC_PASTE                     0x03c0
-#define __LC_PFAULT_INTPARM            0x11b8
-#define __LC_FPREGS_SAVE_AREA          0x1200
-#define __LC_GPREGS_SAVE_AREA          0x1280
-#define __LC_PSW_SAVE_AREA             0x1300
-#define __LC_PREFIX_SAVE_AREA          0x1318
-#define __LC_FP_CREG_SAVE_AREA         0x131c
-#define __LC_TODREG_SAVE_AREA          0x1324
-#define __LC_CPU_TIMER_SAVE_AREA       0x1328
-#define __LC_CLOCK_COMP_SAVE_AREA      0x1331
-#define __LC_AREGS_SAVE_AREA           0x1340
-#define __LC_CREGS_SAVE_AREA           0x1380
-#endif /* __s390x__ */
-
-#ifndef __ASSEMBLY__
-
-#include <asm/cpu.h>
-#include <asm/ptrace.h>
 #include <linux/types.h>
+#include <asm/ptrace.h>
+#include <asm/cpu.h>
 
 void restart_int_handler(void);
 void ext_int_handler(void);
@@ -144,7 +19,12 @@ void pgm_check_handler(void);
 void mcck_int_handler(void);
 void io_int_handler(void);
 
-struct save_area_s390 {
+#ifdef CONFIG_32BIT
+
+#define LC_ORDER 0
+#define LC_PAGES 1
+
+struct save_area {
        u32     ext_save;
        u64     timer;
        u64     clk_cmp;
@@ -156,54 +36,13 @@ struct save_area_s390 {
        u64     fp_regs[4];
        u32     gp_regs[16];
        u32     ctrl_regs[16];
-}  __attribute__((packed));
-
-struct save_area_s390x {
-       u64     fp_regs[16];
-       u64     gp_regs[16];
-       u8      psw[16];
-       u8      pad1[8];
-       u32     pref_reg;
-       u32     fp_ctrl_reg;
-       u8      pad2[4];
-       u32     tod_reg;
-       u64     timer;
-       u64     clk_cmp;
-       u8      pad3[8];
-       u32     acc_regs[16];
-       u64     ctrl_regs[16];
-}  __attribute__((packed));
-
-union save_area {
-       struct save_area_s390   s390;
-       struct save_area_s390x  s390x;
-};
-
-#define SAVE_AREA_BASE_S390    0xd4
-#define SAVE_AREA_BASE_S390X   0x1200
-
-#ifndef __s390x__
-#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
-#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
-#else
-#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
-#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
-#endif
-
-#ifndef __s390x__
-#define LC_ORDER 0
-#else
-#define LC_ORDER 1
-#endif
-
-#define LC_PAGES (1UL << LC_ORDER)
+} __packed;
 
-struct _lowcore
-{
-#ifndef __s390x__
-       /* 0x0000 - 0x01ff: defined by architecture */
+struct _lowcore {
        psw_t   restart_psw;                    /* 0x0000 */
-       __u32   ccw2[4];                        /* 0x0008 */
+       psw_t   restart_old_psw;                /* 0x0008 */
+       __u8    pad_0x0010[0x0014-0x0010];      /* 0x0010 */
+       __u32   ipl_parmblock_ptr;              /* 0x0014 */
        psw_t   external_old_psw;               /* 0x0018 */
        psw_t   svc_old_psw;                    /* 0x0020 */
        psw_t   program_old_psw;                /* 0x0028 */
@@ -229,7 +68,9 @@ struct _lowcore
        __u32   monitor_code;                   /* 0x009c */
        __u8    exc_access_id;                  /* 0x00a0 */
        __u8    per_access_id;                  /* 0x00a1 */
-       __u8    pad_0x00a2[0x00b8-0x00a2];      /* 0x00a2 */
+       __u8    op_access_id;                   /* 0x00a2 */
+       __u8    ar_access_id;                   /* 0x00a3 */
+       __u8    pad_0x00a4[0x00b8-0x00a4];      /* 0x00a4 */
        __u16   subchannel_id;                  /* 0x00b8 */
        __u16   subchannel_nr;                  /* 0x00ba */
        __u32   io_int_parm;                    /* 0x00bc */
@@ -245,8 +86,9 @@ struct _lowcore
        __u32   external_damage_code;           /* 0x00f4 */
        __u32   failing_storage_address;        /* 0x00f8 */
        __u8    pad_0x00fc[0x0100-0x00fc];      /* 0x00fc */
-       __u32   st_status_fixed_logout[4];      /* 0x0100 */
-       __u8    pad_0x0110[0x0120-0x0110];      /* 0x0110 */
+       psw_t   psw_save_area;                  /* 0x0100 */
+       __u32   prefixreg_save_area;            /* 0x0108 */
+       __u8    pad_0x010c[0x0120-0x010c];      /* 0x010c */
 
        /* CPU register save area: defined by architecture */
        __u32   access_regs_save_area[16];      /* 0x0120 */
@@ -293,12 +135,12 @@ struct _lowcore
        __u64   clock_comparator;               /* 0x02d0 */
        __u32   machine_flags;                  /* 0x02d8 */
        __u32   ftrace_func;                    /* 0x02dc */
-       __u8    pad_0x02f0[0x0300-0x02f0];      /* 0x02f0 */
+       __u8    pad_0x02e0[0x0300-0x02e0];      /* 0x02e0 */
 
        /* Interrupt response block */
        __u8    irb[64];                        /* 0x0300 */
 
-       __u8    pad_0x0400[0x0e00-0x0400];      /* 0x0400 */
+       __u8    pad_0x0340[0x0e00-0x0340];      /* 0x0340 */
 
        /*
         * 0xe00 contains the address of the IPL Parameter Information
@@ -310,10 +152,32 @@ struct _lowcore
 
        /* Align to the top 1k of prefix area */
        __u8    pad_0x0e08[0x1000-0x0e08];      /* 0x0e08 */
-#else /* !__s390x__ */
-       /* 0x0000 - 0x01ff: defined by architecture */
-       __u32   ccw1[2];                        /* 0x0000 */
-       __u32   ccw2[4];                        /* 0x0008 */
+} __packed;
+
+#else /* CONFIG_32BIT */
+
+#define LC_ORDER 1
+#define LC_PAGES 2
+
+struct save_area {
+       u64     fp_regs[16];
+       u64     gp_regs[16];
+       u8      psw[16];
+       u8      pad1[8];
+       u32     pref_reg;
+       u32     fp_ctrl_reg;
+       u8      pad2[4];
+       u32     tod_reg;
+       u64     timer;
+       u64     clk_cmp;
+       u8      pad3[8];
+       u32     acc_regs[16];
+       u64     ctrl_regs[16];
+} __packed;
+
+struct _lowcore {
+       __u8    pad_0x0000[0x0014-0x0000];      /* 0x0000 */
+       __u32   ipl_parmblock_ptr;              /* 0x0014 */
        __u8    pad_0x0018[0x0080-0x0018];      /* 0x0018 */
        __u32   ext_params;                     /* 0x0080 */
        __u16   cpu_addr;                       /* 0x0084 */
@@ -344,7 +208,9 @@ struct _lowcore
        __u8    pad_0x00f0[0x00f4-0x00f0];      /* 0x00f0 */
        __u32   external_damage_code;           /* 0x00f4 */
        addr_t  failing_storage_address;        /* 0x00f8 */
-       __u8    pad_0x0100[0x0120-0x0100];      /* 0x0100 */
+       __u8    pad_0x0100[0x0110-0x0100];      /* 0x0100 */
+       __u64   breaking_event_addr;            /* 0x0110 */
+       __u8    pad_0x0118[0x0120-0x0118];      /* 0x0118 */
        psw_t   restart_old_psw;                /* 0x0120 */
        psw_t   external_old_psw;               /* 0x0130 */
        psw_t   svc_old_psw;                    /* 0x0140 */
@@ -425,7 +291,7 @@ struct _lowcore
        /* CPU register save area: defined by architecture */
        __u64   floating_pt_save_area[16];      /* 0x1200 */
        __u64   gpregs_save_area[16];           /* 0x1280 */
-       __u32   st_status_fixed_logout[4];      /* 0x1300 */
+       psw_t   psw_save_area;                  /* 0x1300 */
        __u8    pad_0x1310[0x1318-0x1310];      /* 0x1310 */
        __u32   prefixreg_save_area;            /* 0x1318 */
        __u32   fpt_creg_save_area;             /* 0x131c */
@@ -439,10 +305,12 @@ struct _lowcore
 
        /* align to the top of the prefix area */
        __u8    pad_0x1400[0x2000-0x1400];      /* 0x1400 */
-#endif /* !__s390x__ */
-} __attribute__((packed)); /* End structure*/
+} __packed;
+
+#endif /* CONFIG_32BIT */
 
 #define S390_lowcore (*((struct _lowcore *) 0))
+
 extern struct _lowcore *lowcore_ptr[];
 
 static inline void set_prefix(__u32 address)
@@ -458,6 +326,4 @@ static inline __u32 store_prefix(void)
        return address;
 }
 
-#endif
-
-#endif
+#endif /* _ASM_S390_LOWCORE_H */
index 5e9daf5d7f223b744dca0993c1e09f08877fbcf9..af650fb472064a82c09ab508cab7ccd341412c79 100644 (file)
@@ -107,9 +107,6 @@ typedef pte_t *pgtable_t;
 #define __pgd(x)        ((pgd_t) { (x) } )
 #define __pgprot(x)     ((pgprot_t) { (x) } )
 
-/* default storage key used for all pages */
-extern unsigned int default_storage_key;
-
 static inline void
 page_set_storage_key(unsigned long addr, unsigned int skey)
 {
index b42715458312d185e49f51cabfa7ac866cfa7bf9..73e259834e10d9bc3ecc5cced06860f6b3dd0b86 100644 (file)
@@ -28,7 +28,7 @@
 
 static inline void get_cpu_id(struct cpuid *ptr)
 {
-       asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr));
+       asm volatile("stidp %0" : "=Q" (*ptr));
 }
 
 extern void s390_adjust_jiffies(void);
@@ -184,9 +184,9 @@ static inline void psw_set_key(unsigned int key)
 static inline void __load_psw(psw_t psw)
 {
 #ifndef __s390x__
-       asm volatile("lpsw  0(%0)" : : "a" (&psw), "m" (psw) : "cc");
+       asm volatile("lpsw  %0" : : "Q" (psw) : "cc");
 #else
-       asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
+       asm volatile("lpswe %0" : : "Q" (psw) : "cc");
 #endif
 }
 
@@ -206,17 +206,17 @@ static inline void __load_psw_mask (unsigned long mask)
        asm volatile(
                "       basr    %0,0\n"
                "0:     ahi     %0,1f-0b\n"
-               "       st      %0,4(%1)\n"
-               "       lpsw    0(%1)\n"
+               "       st      %0,%O1+4(%R1)\n"
+               "       lpsw    %1\n"
                "1:"
-               : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
+               : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc");
 #else /* __s390x__ */
        asm volatile(
                "       larl    %0,1f\n"
-               "       stg     %0,8(%1)\n"
-               "       lpswe   0(%1)\n"
+               "       stg     %0,%O1+8(%R1)\n"
+               "       lpswe   %1\n"
                "1:"
-               : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
+               : "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc");
 #endif /* __s390x__ */
 }
  
index 95dcf183a28df8565afe8892a8968c8c4bd2c23c..dd2d913afcaed7464dedab631b419a7a8ca719e6 100644 (file)
@@ -492,13 +492,24 @@ struct user_regs_struct
 struct task_struct;
 extern void user_enable_single_step(struct task_struct *);
 extern void user_disable_single_step(struct task_struct *);
+extern void show_regs(struct pt_regs * regs);
 
 #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
 #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
 #define user_stack_pointer(regs)((regs)->gprs[15])
 #define regs_return_value(regs)((regs)->gprs[2])
 #define profile_pc(regs) instruction_pointer(regs)
-extern void show_regs(struct pt_regs * regs);
+
+int regs_query_register_offset(const char *name);
+const char *regs_query_register_name(unsigned int offset);
+unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset);
+unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n);
+
+static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
+{
+       return regs->gprs[15] & PSW_ADDR_INSN;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 
index 79d849f014f06223945646145c362547dce6057d..c666bfe5e9847dc055ad7bcc5f7c863afa89f4cb 100644 (file)
@@ -13,7 +13,8 @@
 #include <asm/cio.h>
 #include <asm/ccwdev.h>
 
-#define QDIO_MAX_QUEUES_PER_IRQ                32
+/* only use 4 queues to save some cachelines */
+#define QDIO_MAX_QUEUES_PER_IRQ                4
 #define QDIO_MAX_BUFFERS_PER_Q         128
 #define QDIO_MAX_BUFFERS_MASK          (QDIO_MAX_BUFFERS_PER_Q - 1)
 #define QDIO_MAX_ELEMENTS_PER_BUFFER   16
index 9d2a179718056758304a194ff67766be5a5b72ce..423fdda2322dd6ee3f51add1cea21ce96f0b63f0 100644 (file)
@@ -124,21 +124,21 @@ static inline void __down_read(struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       ahi     %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       ahi     %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       aghi    %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       aghi    %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count),
-                 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
+               : "cc", "memory");
        if (old < 0)
                rwsem_down_read_failed(sem);
 }
@@ -152,25 +152,25 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     ltr     %1,%0\n"
                "       jm      1f\n"
-               "       ahi     %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       ahi     %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b\n"
                "1:"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     ltgr    %1,%0\n"
                "       jm      1f\n"
-               "       aghi    %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       aghi    %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b\n"
                "1:"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count),
-                 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
+               : "cc", "memory");
        return old >= 0 ? 1 : 0;
 }
 
@@ -184,20 +184,20 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
        tmp = RWSEM_ACTIVE_WRITE_BIAS;
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       a       %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       a       %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       ag      %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       ag      %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count), "m" (tmp)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "m" (tmp)
                : "cc", "memory");
        if (old != 0)
                rwsem_down_write_failed(sem);
@@ -217,22 +217,22 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%2)\n"
+               "       l       %0,%1\n"
                "0:     ltr     %0,%0\n"
                "       jnz     1f\n"
-               "       cs      %0,%4,0(%2)\n"
+               "       cs      %0,%3,%1\n"
                "       jl      0b\n"
 #else /* __s390x__ */
-               "       lg      %0,0(%2)\n"
+               "       lg      %0,%1\n"
                "0:     ltgr    %0,%0\n"
                "       jnz     1f\n"
-               "       csg     %0,%4,0(%2)\n"
+               "       csg     %0,%3,%1\n"
                "       jl      0b\n"
 #endif /* __s390x__ */
                "1:"
-               : "=&d" (old), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count),
-                 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory");
+               : "=&d" (old), "=Q" (sem->count)
+               : "Q" (sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS)
+               : "cc", "memory");
        return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
 }
 
@@ -245,21 +245,20 @@ static inline void __up_read(struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       ahi     %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       ahi     %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       aghi    %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       aghi    %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count),
-                 "i" (-RWSEM_ACTIVE_READ_BIAS)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS)
                : "cc", "memory");
        if (new < 0)
                if ((new & RWSEM_ACTIVE_MASK) == 0)
@@ -276,20 +275,20 @@ static inline void __up_write(struct rw_semaphore *sem)
        tmp = -RWSEM_ACTIVE_WRITE_BIAS;
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       a       %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       a       %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       ag      %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       ag      %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count), "m" (tmp)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "m" (tmp)
                : "cc", "memory");
        if (new < 0)
                if ((new & RWSEM_ACTIVE_MASK) == 0)
@@ -306,20 +305,20 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
        tmp = -RWSEM_WAITING_BIAS;
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       a       %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       a       %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       ag      %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       ag      %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count), "m" (tmp)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "m" (tmp)
                : "cc", "memory");
        if (new > 1)
                rwsem_downgrade_wake(sem);
@@ -334,20 +333,20 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       ar      %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       ar      %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       agr     %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       agr     %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count), "d" (delta)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "d" (delta)
                : "cc", "memory");
 }
 
@@ -360,20 +359,20 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
 
        asm volatile(
 #ifndef __s390x__
-               "       l       %0,0(%3)\n"
+               "       l       %0,%2\n"
                "0:     lr      %1,%0\n"
-               "       ar      %1,%5\n"
-               "       cs      %0,%1,0(%3)\n"
+               "       ar      %1,%4\n"
+               "       cs      %0,%1,%2\n"
                "       jl      0b"
 #else /* __s390x__ */
-               "       lg      %0,0(%3)\n"
+               "       lg      %0,%2\n"
                "0:     lgr     %1,%0\n"
-               "       agr     %1,%5\n"
-               "       csg     %0,%1,0(%3)\n"
+               "       agr     %1,%4\n"
+               "       csg     %0,%1,%2\n"
                "       jl      0b"
 #endif /* __s390x__ */
-               : "=&d" (old), "=&d" (new), "=m" (sem->count)
-               : "a" (&sem->count), "m" (sem->count), "d" (delta)
+               : "=&d" (old), "=&d" (new), "=Q" (sem->count)
+               : "Q" (sem->count), "d" (delta)
                : "cc", "memory");
        return new;
 }
index 52a779c337e857ab16a49ef9342c46519c4af35d..9ab6bd3a65d10424835a01cc7beedaa21fc7ef5c 100644 (file)
 
 #ifdef __KERNEL__
 
-#include <asm/lowcore.h>
-#include <asm/types.h>
-
 #define PARMAREA               0x10400
 #define MEMORY_CHUNKS          256
 
 #ifndef __ASSEMBLY__
 
+#include <asm/lowcore.h>
+#include <asm/types.h>
+
 #ifndef __s390x__
 #define IPL_DEVICE        (*(unsigned long *)  (0x10404))
 #define INITRD_START      (*(unsigned long *)  (0x1040C))
@@ -71,9 +71,12 @@ extern unsigned int user_mode;
 #define MACHINE_FLAG_KVM       (1UL << 9)
 #define MACHINE_FLAG_HPAGE     (1UL << 10)
 #define MACHINE_FLAG_PFMF      (1UL << 11)
+#define MACHINE_FLAG_LPAR      (1UL << 12)
 
 #define MACHINE_IS_VM          (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
 #define MACHINE_IS_KVM         (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
+#define MACHINE_IS_LPAR                (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
+
 #define MACHINE_HAS_DIAG9C     (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
 
 #ifndef __s390x__
index ec403d4304f81c64d2fa2818187ba9731ef49944..e3bffd4e2d6662b08e8dab76cd4dc924508ead3d 100644 (file)
 /*
- *  include/asm-s390/sigp.h
+ *  Routines and structures for signalling other processors.
  *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *               Heiko Carstens (heiko.carstens@de.ibm.com)
- *
- *  sigp.h by D.J. Barrow (c) IBM 1999
- *  contains routines / structures for signalling other S/390 processors in an
- *  SMP configuration.
+ *    Copyright IBM Corp. 1999,2010
+ *    Author(s): Denis Joseph Barrow,
+ *              Martin Schwidefsky <schwidefsky@de.ibm.com>,
+ *              Heiko Carstens <heiko.carstens@de.ibm.com>,
  */
 
-#ifndef __SIGP__
-#define __SIGP__
+#ifndef __ASM_SIGP_H
+#define __ASM_SIGP_H
 
-#include <asm/ptrace.h>
-#include <asm/atomic.h>
+#include <asm/system.h>
 
-/* get real cpu address from logical cpu number */
-extern volatile int __cpu_logical_map[];
+/* Get real cpu address from logical cpu number. */
+extern unsigned short __cpu_logical_map[];
 
-typedef enum
-{
-       sigp_unassigned=0x0,
-       sigp_sense,
-       sigp_external_call,
-       sigp_emergency_signal,
-       sigp_start,
-       sigp_stop,
-       sigp_restart,
-       sigp_unassigned1,
-       sigp_unassigned2,
-       sigp_stop_and_store_status,
-       sigp_unassigned3,
-       sigp_initial_cpu_reset,
-       sigp_cpu_reset,
-       sigp_set_prefix,
-       sigp_store_status_at_address,
-       sigp_store_extended_status_at_address
-} sigp_order_code;
-
-typedef __u32 sigp_status_word;
-
-typedef enum
+static inline int cpu_logical_map(int cpu)
 {
-        sigp_order_code_accepted=0,
-       sigp_status_stored,
-       sigp_busy,
-       sigp_not_operational
-} sigp_ccode;
+#ifdef CONFIG_SMP
+       return __cpu_logical_map[cpu];
+#else
+       return stap();
+#endif
+}
 
+enum {
+       sigp_sense = 1,
+       sigp_external_call = 2,
+       sigp_emergency_signal = 3,
+       sigp_start = 4,
+       sigp_stop = 5,
+       sigp_restart = 6,
+       sigp_stop_and_store_status = 9,
+       sigp_initial_cpu_reset = 11,
+       sigp_cpu_reset = 12,
+       sigp_set_prefix = 13,
+       sigp_store_status_at_address = 14,
+       sigp_store_extended_status_at_address = 15,
+       sigp_set_architecture = 18,
+       sigp_conditional_emergency_signal = 19,
+       sigp_sense_running = 21,
+};
+
+enum {
+       sigp_order_code_accepted = 0,
+       sigp_status_stored = 1,
+       sigp_busy = 2,
+       sigp_not_operational = 3,
+};
 
 /*
- * Definitions for the external call
+ * Definitions for external call.
  */
-
-/* 'Bit' signals, asynchronous */
-typedef enum
-{
-       ec_schedule=0,
+enum {
+       ec_schedule = 0,
        ec_call_function,
        ec_call_function_single,
-       ec_bit_last
-} ec_bit_sig;
+};
 
 /*
- * Signal processor
+ * Signal processor.
  */
-static inline sigp_ccode
-signal_processor(__u16 cpu_addr, sigp_order_code order_code)
+static inline int raw_sigp(u16 cpu, int order)
 {
        register unsigned long reg1 asm ("1") = 0;
-       sigp_ccode ccode;
+       int ccode;
 
        asm volatile(
                "       sigp    %1,%2,0(%3)\n"
                "       ipm     %0\n"
                "       srl     %0,28\n"
                :       "=d"    (ccode)
-               : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
-                 "a" (order_code) : "cc" , "memory");
+               : "d" (reg1), "d" (cpu),
+                 "a" (order) : "cc" , "memory");
        return ccode;
 }
 
 /*
- * Signal processor with parameter
+ * Signal processor with parameter.
  */
-static inline sigp_ccode
-signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
+static inline int raw_sigp_p(u32 parameter, u16 cpu, int order)
 {
        register unsigned int reg1 asm ("1") = parameter;
-       sigp_ccode ccode;
+       int ccode;
 
        asm volatile(
                "       sigp    %1,%2,0(%3)\n"
                "       ipm     %0\n"
                "       srl     %0,28\n"
                : "=d" (ccode)
-               : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
-                 "a" (order_code) : "cc" , "memory");
+               : "d" (reg1), "d" (cpu),
+                 "a" (order) : "cc" , "memory");
        return ccode;
 }
 
 /*
- * Signal processor with parameter and return status
+ * Signal processor with parameter and return status.
  */
-static inline sigp_ccode
-signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
-                   sigp_order_code order_code)
+static inline int raw_sigp_ps(u32 *status, u32 parm, u16 cpu, int order)
 {
-       register unsigned int reg1 asm ("1") = parameter;
-       sigp_ccode ccode;
+       register unsigned int reg1 asm ("1") = parm;
+       int ccode;
 
        asm volatile(
                "       sigp    %1,%2,0(%3)\n"
                "       ipm     %0\n"
                "       srl     %0,28\n"
                : "=d" (ccode), "+d" (reg1)
-               : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
+               : "d" (cpu), "a" (order)
                : "cc" , "memory");
-       *statusptr = reg1;
+       *status = reg1;
        return ccode;
 }
 
-#endif /* __SIGP__ */
+static inline int sigp(int cpu, int order)
+{
+       return raw_sigp(cpu_logical_map(cpu), order);
+}
+
+static inline int sigp_p(u32 parameter, int cpu, int order)
+{
+       return raw_sigp_p(parameter, cpu_logical_map(cpu), order);
+}
+
+static inline int sigp_ps(u32 *status, u32 parm, int cpu, int order)
+{
+       return raw_sigp_ps(status, parm, cpu_logical_map(cpu), order);
+}
+
+#endif /* __ASM_SIGP_H */
index 2ab1141eeb50b4e8849441551e6167ce96f33549..edc03cb9cd79d2c9771419092d6192b56137aecc 100644 (file)
@@ -29,7 +29,43 @@ extern int smp_cpu_polarization[];
 extern void arch_send_call_function_single_ipi(int cpu);
 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
 
-extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
+extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
+
+extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *);
+extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp,
+                             int from, int to);
+extern void smp_restart_cpu(void);
+
+/*
+ * returns 1 if (virtual) cpu is scheduled
+ * returns 0 otherwise
+ */
+static inline int smp_vcpu_scheduled(int cpu)
+{
+       u32 status;
+
+       switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) {
+       case sigp_status_stored:
+               /* Check for running status */
+               if (status & 0x400)
+                       return 0;
+               break;
+       case sigp_not_operational:
+               return 0;
+       default:
+               break;
+       }
+       return 1;
+}
+
+#else /* CONFIG_SMP */
+
+static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
+{
+       func(data);
+}
+
+#define smp_vcpu_scheduled     (1)
 
 #endif /* CONFIG_SMP */
 
index a587907d77f32e208cc0c8ed6e8da87f050c757e..56612fc8186ef25251ab235458b187bcda73f2b2 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <linux/smp.h>
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-
 static inline int
 _raw_compare_and_swap(volatile unsigned int *lock,
                      unsigned int old, unsigned int new)
@@ -27,22 +25,6 @@ _raw_compare_and_swap(volatile unsigned int *lock,
        return old;
 }
 
-#else /* __GNUC__ */
-
-static inline int
-_raw_compare_and_swap(volatile unsigned int *lock,
-                     unsigned int old, unsigned int new)
-{
-       asm volatile(
-               "       cs      %0,%3,0(%4)"
-               : "=d" (old), "=m" (*lock)
-               : "0" (old), "d" (new), "a" (lock), "m" (*lock)
-               : "cc", "memory" );
-       return old;
-}
-
-#endif /* __GNUC__ */
-
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
  * on the local processor, one does not.
index eb18dc1f327bf906187358713a92e1c7066417e3..6bdee21c077e0755ab0e0bc2084e118bdcb5e83f 100644 (file)
@@ -47,11 +47,11 @@ static inline __u32 __arch_swab32p(const __u32 *x)
        
        asm volatile(
 #ifndef __s390x__
-               "       icm     %0,8,3(%1)\n"
-               "       icm     %0,4,2(%1)\n"
-               "       icm     %0,2,1(%1)\n"
-               "       ic      %0,0(%1)"
-               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
+               "       icm     %0,8,%O1+3(%R1)\n"
+               "       icm     %0,4,%O1+2(%R1)\n"
+               "       icm     %0,2,%O1+1(%R1)\n"
+               "       ic      %0,%1"
+               : "=&d" (result) : "Q" (*x) : "cc");
 #else /* __s390x__ */
                "       lrv     %0,%1"
                : "=d" (result) : "m" (*x));
@@ -77,9 +77,9 @@ static inline __u16 __arch_swab16p(const __u16 *x)
        
        asm volatile(
 #ifndef __s390x__
-               "       icm     %0,2,1(%1)\n"
-               "       ic      %0,0(%1)\n"
-               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
+               "       icm     %0,2,%O+1(%R1)\n"
+               "       ic      %0,%1\n"
+               : "=&d" (result) : "Q" (*x) : "cc");
 #else /* __s390x__ */
                "       lrvh    %0,%1"
                : "=d" (result) : "m" (*x));
index e0a73d3eb8371be3bb599413aa09cd65a7f7da56..8429686951f94f7ffeff1fafdb9ea2f5bba6a7d6 100644 (file)
 #include <linux/sched.h>
 #include <asm/ptrace.h>
 
+/*
+ * The syscall table always contains 32 bit pointers since we know that the
+ * address of the function to be called is (way) below 4GB.  So the "int"
+ * type here is what we want [need] for both 32 bit and 64 bit systems.
+ */
+extern const unsigned int sys_call_table[];
+
 static inline long syscall_get_nr(struct task_struct *task,
                                  struct pt_regs *regs)
 {
index 9d70057d828c604796082b21d61535eebcd19f87..22bdb2a0ee5f00724d02e67e814c41f4aa115e49 100644 (file)
@@ -87,7 +87,8 @@ struct sysinfo_2_2_2 {
 
 struct sysinfo_3_2_2 {
        char reserved_0[31];
-       unsigned char count;
+       unsigned char :4;
+       unsigned char count:4;
        struct {
                char reserved_0[4];
                unsigned short cpus_total;
index 379661d2f81ac9ce68863ec48e7c85e1244177ec..67ee6c3c6bb3aa352484c94449c135315b0763ec 100644 (file)
@@ -24,65 +24,65 @@ extern struct task_struct *__switch_to(void *, void *);
 static inline void save_fp_regs(s390_fp_regs *fpregs)
 {
        asm volatile(
-               "       std     0,8(%1)\n"
-               "       std     2,24(%1)\n"
-               "       std     4,40(%1)\n"
-               "       std     6,56(%1)"
-               : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
+               "       std     0,%O0+8(%R0)\n"
+               "       std     2,%O0+24(%R0)\n"
+               "       std     4,%O0+40(%R0)\n"
+               "       std     6,%O0+56(%R0)"
+               : "=Q" (*fpregs) : "Q" (*fpregs));
        if (!MACHINE_HAS_IEEE)
                return;
        asm volatile(
-               "       stfpc   0(%1)\n"
-               "       std     1,16(%1)\n"
-               "       std     3,32(%1)\n"
-               "       std     5,48(%1)\n"
-               "       std     7,64(%1)\n"
-               "       std     8,72(%1)\n"
-               "       std     9,80(%1)\n"
-               "       std     10,88(%1)\n"
-               "       std     11,96(%1)\n"
-               "       std     12,104(%1)\n"
-               "       std     13,112(%1)\n"
-               "       std     14,120(%1)\n"
-               "       std     15,128(%1)\n"
-               : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
+               "       stfpc   %0\n"
+               "       std     1,%O0+16(%R0)\n"
+               "       std     3,%O0+32(%R0)\n"
+               "       std     5,%O0+48(%R0)\n"
+               "       std     7,%O0+64(%R0)\n"
+               "       std     8,%O0+72(%R0)\n"
+               "       std     9,%O0+80(%R0)\n"
+               "       std     10,%O0+88(%R0)\n"
+               "       std     11,%O0+96(%R0)\n"
+               "       std     12,%O0+104(%R0)\n"
+               "       std     13,%O0+112(%R0)\n"
+               "       std     14,%O0+120(%R0)\n"
+               "       std     15,%O0+128(%R0)\n"
+               : "=Q" (*fpregs) : "Q" (*fpregs));
 }
 
 static inline void restore_fp_regs(s390_fp_regs *fpregs)
 {
        asm volatile(
-               "       ld      0,8(%0)\n"
-               "       ld      2,24(%0)\n"
-               "       ld      4,40(%0)\n"
-               "       ld      6,56(%0)"
-               : : "a" (fpregs), "m" (*fpregs));
+               "       ld      0,%O0+8(%R0)\n"
+               "       ld      2,%O0+24(%R0)\n"
+               "       ld      4,%O0+40(%R0)\n"
+               "       ld      6,%O0+56(%R0)"
+               : : "Q" (*fpregs));
        if (!MACHINE_HAS_IEEE)
                return;
        asm volatile(
-               "       lfpc    0(%0)\n"
-               "       ld      1,16(%0)\n"
-               "       ld      3,32(%0)\n"
-               "       ld      5,48(%0)\n"
-               "       ld      7,64(%0)\n"
-               "       ld      8,72(%0)\n"
-               "       ld      9,80(%0)\n"
-               "       ld      10,88(%0)\n"
-               "       ld      11,96(%0)\n"
-               "       ld      12,104(%0)\n"
-               "       ld      13,112(%0)\n"
-               "       ld      14,120(%0)\n"
-               "       ld      15,128(%0)\n"
-               : : "a" (fpregs), "m" (*fpregs));
+               "       lfpc    %0\n"
+               "       ld      1,%O0+16(%R0)\n"
+               "       ld      3,%O0+32(%R0)\n"
+               "       ld      5,%O0+48(%R0)\n"
+               "       ld      7,%O0+64(%R0)\n"
+               "       ld      8,%O0+72(%R0)\n"
+               "       ld      9,%O0+80(%R0)\n"
+               "       ld      10,%O0+88(%R0)\n"
+               "       ld      11,%O0+96(%R0)\n"
+               "       ld      12,%O0+104(%R0)\n"
+               "       ld      13,%O0+112(%R0)\n"
+               "       ld      14,%O0+120(%R0)\n"
+               "       ld      15,%O0+128(%R0)\n"
+               : : "Q" (*fpregs));
 }
 
 static inline void save_access_regs(unsigned int *acrs)
 {
-       asm volatile("stam 0,15,0(%0)" : : "a" (acrs) : "memory");
+       asm volatile("stam 0,15,%0" : "=Q" (*acrs));
 }
 
 static inline void restore_access_regs(unsigned int *acrs)
 {
-       asm volatile("lam 0,15,0(%0)" : : "a" (acrs));
+       asm volatile("lam 0,15,%0" : : "Q" (*acrs));
 }
 
 #define switch_to(prev,next,last) do {                                      \
@@ -139,48 +139,48 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
                shift = (3 ^ (addr & 3)) << 3;
                addr ^= addr & 3;
                asm volatile(
-                       "       l       %0,0(%4)\n"
+                       "       l       %0,%4\n"
                        "0:     lr      0,%0\n"
                        "       nr      0,%3\n"
                        "       or      0,%2\n"
-                       "       cs      %0,0,0(%4)\n"
+                       "       cs      %0,0,%4\n"
                        "       jl      0b\n"
-                       : "=&d" (old), "=m" (*(int *) addr)
-                       : "d" (x << shift), "d" (~(255 << shift)), "a" (addr),
-                         "m" (*(int *) addr) : "memory", "cc", "0");
+                       : "=&d" (old), "=Q" (*(int *) addr)
+                       : "d" (x << shift), "d" (~(255 << shift)),
+                         "Q" (*(int *) addr) : "memory", "cc", "0");
                return old >> shift;
        case 2:
                addr = (unsigned long) ptr;
                shift = (2 ^ (addr & 2)) << 3;
                addr ^= addr & 2;
                asm volatile(
-                       "       l       %0,0(%4)\n"
+                       "       l       %0,%4\n"
                        "0:     lr      0,%0\n"
                        "       nr      0,%3\n"
                        "       or      0,%2\n"
-                       "       cs      %0,0,0(%4)\n"
+                       "       cs      %0,0,%4\n"
                        "       jl      0b\n"
-                       : "=&d" (old), "=m" (*(int *) addr)
-                       : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr),
-                         "m" (*(int *) addr) : "memory", "cc", "0");
+                       : "=&d" (old), "=Q" (*(int *) addr)
+                       : "d" (x << shift), "d" (~(65535 << shift)),
+                         "Q" (*(int *) addr) : "memory", "cc", "0");
                return old >> shift;
        case 4:
                asm volatile(
-                       "       l       %0,0(%3)\n"
-                       "0:     cs      %0,%2,0(%3)\n"
+                       "       l       %0,%3\n"
+                       "0:     cs      %0,%2,%3\n"
                        "       jl      0b\n"
-                       : "=&d" (old), "=m" (*(int *) ptr)
-                       : "d" (x), "a" (ptr), "m" (*(int *) ptr)
+                       : "=&d" (old), "=Q" (*(int *) ptr)
+                       : "d" (x), "Q" (*(int *) ptr)
                        : "memory", "cc");
                return old;
 #ifdef __s390x__
        case 8:
                asm volatile(
-                       "       lg      %0,0(%3)\n"
-                       "0:     csg     %0,%2,0(%3)\n"
+                       "       lg      %0,%3\n"
+                       "0:     csg     %0,%2,%3\n"
                        "       jl      0b\n"
                        : "=&d" (old), "=m" (*(long *) ptr)
-                       : "d" (x), "a" (ptr), "m" (*(long *) ptr)
+                       : "d" (x), "Q" (*(long *) ptr)
                        : "memory", "cc");
                return old;
 #endif /* __s390x__ */
@@ -215,20 +215,20 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
                shift = (3 ^ (addr & 3)) << 3;
                addr ^= addr & 3;
                asm volatile(
-                       "       l       %0,0(%4)\n"
+                       "       l       %0,%2\n"
                        "0:     nr      %0,%5\n"
                        "       lr      %1,%0\n"
                        "       or      %0,%2\n"
                        "       or      %1,%3\n"
-                       "       cs      %0,%1,0(%4)\n"
+                       "       cs      %0,%1,%2\n"
                        "       jnl     1f\n"
                        "       xr      %1,%0\n"
                        "       nr      %1,%5\n"
                        "       jnz     0b\n"
                        "1:"
-                       : "=&d" (prev), "=&d" (tmp)
-                       : "d" (old << shift), "d" (new << shift), "a" (ptr),
-                         "d" (~(255 << shift))
+                       : "=&d" (prev), "=&d" (tmp), "=Q" (*(int *) ptr)
+                       : "d" (old << shift), "d" (new << shift),
+                         "d" (~(255 << shift)), "Q" (*(int *) ptr)
                        : "memory", "cc");
                return prev >> shift;
        case 2:
@@ -236,33 +236,35 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
                shift = (2 ^ (addr & 2)) << 3;
                addr ^= addr & 2;
                asm volatile(
-                       "       l       %0,0(%4)\n"
+                       "       l       %0,%2\n"
                        "0:     nr      %0,%5\n"
                        "       lr      %1,%0\n"
                        "       or      %0,%2\n"
                        "       or      %1,%3\n"
-                       "       cs      %0,%1,0(%4)\n"
+                       "       cs      %0,%1,%2\n"
                        "       jnl     1f\n"
                        "       xr      %1,%0\n"
                        "       nr      %1,%5\n"
                        "       jnz     0b\n"
                        "1:"
-                       : "=&d" (prev), "=&d" (tmp)
-                       : "d" (old << shift), "d" (new << shift), "a" (ptr),
-                         "d" (~(65535 << shift))
+                       : "=&d" (prev), "=&d" (tmp), "=Q" (*(int *) ptr)
+                       : "d" (old << shift), "d" (new << shift),
+                         "d" (~(65535 << shift)), "Q" (*(int *) ptr)
                        : "memory", "cc");
                return prev >> shift;
        case 4:
                asm volatile(
-                       "       cs      %0,%2,0(%3)\n"
-                       : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
+                       "       cs      %0,%3,%1\n"
+                       : "=&d" (prev), "=Q" (*(int *) ptr)
+                       : "0" (old), "d" (new), "Q" (*(int *) ptr)
                        : "memory", "cc");
                return prev;
 #ifdef __s390x__
        case 8:
                asm volatile(
-                       "       csg     %0,%2,0(%3)\n"
-                       : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
+                       "       csg     %0,%3,%1\n"
+                       : "=&d" (prev), "=Q" (*(long *) ptr)
+                       : "0" (old), "d" (new), "Q" (*(long *) ptr)
                        : "memory", "cc");
                return prev;
 #endif /* __s390x__ */
@@ -302,17 +304,17 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 #define __ctl_load(array, low, high) ({                                \
        typedef struct { char _[sizeof(array)]; } addrtype;     \
        asm volatile(                                           \
-               "       lctlg   %1,%2,0(%0)\n"                  \
-               : : "a" (&array), "i" (low), "i" (high),        \
-                   "m" (*(addrtype *)(&array)));               \
+               "       lctlg   %1,%2,%0\n"                     \
+               : : "Q" (*(addrtype *)(&array)),                \
+                   "i" (low), "i" (high));                     \
        })
 
 #define __ctl_store(array, low, high) ({                       \
        typedef struct { char _[sizeof(array)]; } addrtype;     \
        asm volatile(                                           \
-               "       stctg   %2,%3,0(%1)\n"                  \
-               : "=m" (*(addrtype *)(&array))                  \
-               : "a" (&array), "i" (low), "i" (high));         \
+               "       stctg   %1,%2,%0\n"                     \
+               : "=Q" (*(addrtype *)(&array))                  \
+               : "i" (low), "i" (high));                       \
        })
 
 #else /* __s390x__ */
@@ -320,17 +322,17 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 #define __ctl_load(array, low, high) ({                                \
        typedef struct { char _[sizeof(array)]; } addrtype;     \
        asm volatile(                                           \
-               "       lctl    %1,%2,0(%0)\n"                  \
-               : : "a" (&array), "i" (low), "i" (high),        \
-                   "m" (*(addrtype *)(&array)));               \
+               "       lctl    %1,%2,%0\n"                     \
+               : : "Q" (*(addrtype *)(&array)),                \
+                   "i" (low), "i" (high));                     \
 })
 
 #define __ctl_store(array, low, high) ({                       \
        typedef struct { char _[sizeof(array)]; } addrtype;     \
        asm volatile(                                           \
-               "       stctl   %2,%3,0(%1)\n"                  \
-               : "=m" (*(addrtype *)(&array))                  \
-               : "a" (&array), "i" (low), "i" (high));         \
+               "       stctl   %1,%2,%0\n"                     \
+               : "=Q" (*(addrtype *)(&array))                  \
+               : "i" (low), "i" (high));                       \
        })
 
 #endif /* __s390x__ */
index 07eb61b2fb3a7f1b4e47bc1d5b180d7bddef0dc3..34f0873d65258aeb34f938e2aaa881d2401468ac 100644 (file)
@@ -73,7 +73,7 @@ struct thread_info {
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
-       return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE);
+       return (struct thread_info *)(S390_lowcore.kernel_stack - THREAD_SIZE);
 }
 
 #define THREAD_SIZE_ORDER THREAD_ORDER
@@ -93,13 +93,12 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_SYSCALL_AUDIT      9       /* syscall auditing active */
 #define TIF_SECCOMP            10      /* secure computing */
 #define TIF_SYSCALL_TRACEPOINT 11      /* syscall tracepoint instrumentation */
-#define TIF_USEDFPU            16      /* FPU was used by this task this quantum (SMP) */
-#define TIF_POLLING_NRFLAG     17      /* true if poll_idle() is polling 
+#define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_31BIT              18      /* 32bit process */ 
-#define TIF_MEMDIE             19
-#define TIF_RESTORE_SIGMASK    20      /* restore signal mask in do_signal() */
-#define TIF_FREEZE             21      /* thread is freezing for suspend */
+#define TIF_31BIT              17      /* 32bit process */
+#define TIF_MEMDIE             18
+#define TIF_RESTORE_SIGMASK    19      /* restore signal mask in do_signal() */
+#define TIF_FREEZE             20      /* thread is freezing for suspend */
 
 #define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_RESTORE_SIGMASK   (1<<TIF_RESTORE_SIGMASK)
@@ -112,7 +111,6 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_SYSCALL_AUDIT     (1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP           (1<<TIF_SECCOMP)
 #define _TIF_SYSCALL_TRACEPOINT        (1<<TIF_SYSCALL_TRACEPOINT)
-#define _TIF_USEDFPU           (1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
 #define _TIF_31BIT             (1<<TIF_31BIT)
 #define _TIF_FREEZE            (1<<TIF_FREEZE)
index 68d9fea34b4bdf4fb212b11c6e148bf8527e254e..f174bdaa6b599e857863f1d61a202f0799e29e3d 100644 (file)
@@ -20,10 +20,10 @@ static inline int set_clock(__u64 time)
        int cc;
 
        asm volatile(
-               "   sck   0(%2)\n"
+               "   sck   %1\n"
                "   ipm   %0\n"
                "   srl   %0,28\n"
-               : "=d" (cc) : "m" (time), "a" (&time) : "cc");
+               : "=d" (cc) : "Q" (time) : "cc");
        return cc;
 }
 
@@ -32,21 +32,21 @@ static inline int store_clock(__u64 *time)
        int cc;
 
        asm volatile(
-               "   stck  0(%2)\n"
+               "   stck  %1\n"
                "   ipm   %0\n"
                "   srl   %0,28\n"
-               : "=d" (cc), "=m" (*time) : "a" (time) : "cc");
+               : "=d" (cc), "=Q" (*time) : : "cc");
        return cc;
 }
 
 static inline void set_clock_comparator(__u64 time)
 {
-       asm volatile("sckc 0(%1)" : : "m" (time), "a" (&time));
+       asm volatile("sckc %0" : : "Q" (time));
 }
 
 static inline void store_clock_comparator(__u64 *time)
 {
-       asm volatile("stckc 0(%1)" : "=m" (*time) : "a" (time));
+       asm volatile("stckc %0" : "=Q" (*time));
 }
 
 #define CLOCK_TICK_RATE        1193180 /* Underlying HZ */
@@ -57,11 +57,7 @@ static inline unsigned long long get_clock (void)
 {
        unsigned long long clk;
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
        asm volatile("stck %0" : "=Q" (clk) : : "cc");
-#else /* __GNUC__ */
-       asm volatile("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc");
-#endif /* __GNUC__ */
        return clk;
 }
 
@@ -69,13 +65,7 @@ static inline unsigned long long get_clock_xt(void)
 {
        unsigned char clk[16];
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
        asm volatile("stcke %0" : "=Q" (clk) : : "cc");
-#else /* __GNUC__ */
-       asm volatile("stcke 0(%1)" : "=m" (clk)
-                                  : "a" (clk) : "cc");
-#endif /* __GNUC__ */
-
        return *((unsigned long long *)&clk[1]);
 }
 
index cbf0a8745bf419cf251a77aa2959e580ef31efe8..d6b1ed0ec52b3b8bb5a27537a2fa378cfddce34b 100644 (file)
@@ -265,6 +265,12 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
                return uaccess.copy_from_user(n, from, to);
 }
 
+extern void copy_from_user_overflow(void)
+#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
+__compiletime_warning("copy_from_user() buffer size is not provably correct")
+#endif
+;
+
 /**
  * copy_from_user: - Copy a block of data from user space.
  * @to:   Destination address, in kernel space.
@@ -284,7 +290,13 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
 static inline unsigned long __must_check
 copy_from_user(void *to, const void __user *from, unsigned long n)
 {
+       unsigned int sz = __compiletime_object_size(to);
+
        might_fault();
+       if (unlikely(sz != -1 && sz < n)) {
+               copy_from_user_overflow();
+               return n;
+       }
        if (access_ok(VERIFY_READ, from, n))
                n = __copy_from_user(to, from, n);
        else
index 192a7203a14f703d63ab7486987869ca796c4f75..6e9f049fa823eba6a042492602b3b41dcfa7772f 100644 (file)
 #define        __NR_pwritev            329
 #define __NR_rt_tgsigqueueinfo 330
 #define __NR_perf_event_open   331
-#define __NR_recvmmsg          332
-#define NR_syscalls 333
+#define NR_syscalls 332
 
 /* 
  * There are some system calls that are not present on 64 bit, some
 #define __IGNORE_migrate_pages
 #define __IGNORE_move_pages
 
+/* Ignore system calls that are also reachable via sys_socket */
+#define __IGNORE_recvmmsg
+
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_SYS_ALARM
index 7bdd7c8ebc91410f6d3eb616fab0d3660a13add7..4a76d9480cce533dd5b95d658acb0c6ecd6808e9 100644 (file)
@@ -7,7 +7,7 @@
 #define VDSO32_LBASE   0
 #define VDSO64_LBASE   0
 
-#define VDSO_VERSION_STRING    LINUX_2.6.26
+#define VDSO_VERSION_STRING    LINUX_2.6.29
 
 #ifndef __ASSEMBLY__
 
index 683f6381cc593695fff6e041eca8abb63421ccc7..64230bc392fa39a26a61d5839ddb93f6bd4d0618 100644 (file)
@@ -29,9 +29,12 @@ obj-y        += $(if $(CONFIG_64BIT),entry64.o,entry.o)
 obj-y  += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
 
 extra-y                                += head.o init_task.o vmlinux.lds
+extra-y                                += $(if $(CONFIG_64BIT),head64.o,head31.o)
 
 obj-$(CONFIG_MODULES)          += s390_ksyms.o module.o
 obj-$(CONFIG_SMP)              += smp.o topology.o
+obj-$(CONFIG_SMP)              += $(if $(CONFIG_64BIT),switch_cpu64.o, \
+                                                       switch_cpu.o)
 obj-$(CONFIG_HIBERNATION)      += suspend.o swsusp_asm64.o
 obj-$(CONFIG_AUDIT)            += audit.o
 compat-obj-$(CONFIG_AUDIT)     += compat_audit.o
index 63e46433e81d2637d9c36670d023b9e2c95817be..08db736dded00192b435129698a6cf5efee420ac 100644 (file)
@@ -4,18 +4,27 @@
  * and format the required data.
  */
 
-#include <linux/sched.h>
+#define ASM_OFFSETS_C
+
 #include <linux/kbuild.h>
+#include <linux/sched.h>
 #include <asm/vdso.h>
 #include <asm/sigp.h>
 
+/*
+ * Make sure that the compiler is new enough. We want a compiler that
+ * is known to work with the "Q" assembler constraint.
+ */
+#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
+#error Your compiler is too old; please use version 3.3.3 or newer
+#endif
+
 int main(void)
 {
        DEFINE(__THREAD_info, offsetof(struct task_struct, stack));
        DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp));
        DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info));
-       DEFINE(__THREAD_mm_segment,
-              offsetof(struct task_struct, thread.mm_segment));
+       DEFINE(__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment));
        BLANK();
        DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
        BLANK();
@@ -52,18 +61,94 @@ int main(void)
        DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
        DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
        DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
-       DEFINE(__VDSO_ECTG_BASE,
-              offsetof(struct vdso_per_cpu_data, ectg_timer_base));
-       DEFINE(__VDSO_ECTG_USER,
-              offsetof(struct vdso_per_cpu_data, ectg_user_time));
+       DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
+       DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
        /* constants used by the vdso */
        DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
        DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
        DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
+       BLANK();
        /* constants for SIGP */
        DEFINE(__SIGP_STOP, sigp_stop);
        DEFINE(__SIGP_RESTART, sigp_restart);
        DEFINE(__SIGP_SENSE, sigp_sense);
        DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset);
+       BLANK();
+       /* lowcore offsets */
+       DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
+       DEFINE(__LC_CPU_ADDRESS, offsetof(struct _lowcore, cpu_addr));
+       DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code));
+       DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc));
+       DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code));
+       DEFINE(__LC_PGM_ILC, offsetof(struct _lowcore, pgm_ilc));
+       DEFINE(__LC_PGM_INT_CODE, offsetof(struct _lowcore, pgm_code));
+       DEFINE(__LC_PER_ATMID, offsetof(struct _lowcore, per_perc_atmid));
+       DEFINE(__LC_PER_ADDRESS, offsetof(struct _lowcore, per_address));
+       DEFINE(__LC_PER_ACCESS_ID, offsetof(struct _lowcore, per_access_id));
+       DEFINE(__LC_AR_MODE_ID, offsetof(struct _lowcore, ar_access_id));
+       DEFINE(__LC_SUBCHANNEL_ID, offsetof(struct _lowcore, subchannel_id));
+       DEFINE(__LC_SUBCHANNEL_NR, offsetof(struct _lowcore, subchannel_nr));
+       DEFINE(__LC_IO_INT_PARM, offsetof(struct _lowcore, io_int_parm));
+       DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word));
+       DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list));
+       DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code));
+       DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
+       BLANK();
+       DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
+       DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw));
+       DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw));
+       DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw));
+       DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw));
+       DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw));
+       DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw));
+       DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw));
+       DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw));
+       DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw));
+       DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw));
+       DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw));
+       DEFINE(__LC_SAVE_AREA, offsetof(struct _lowcore, save_area));
+       DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw));
+       DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw));
+       DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer));
+       DEFINE(__LC_ASYNC_ENTER_TIMER, offsetof(struct _lowcore, async_enter_timer));
+       DEFINE(__LC_EXIT_TIMER, offsetof(struct _lowcore, exit_timer));
+       DEFINE(__LC_USER_TIMER, offsetof(struct _lowcore, user_timer));
+       DEFINE(__LC_SYSTEM_TIMER, offsetof(struct _lowcore, system_timer));
+       DEFINE(__LC_STEAL_TIMER, offsetof(struct _lowcore, steal_timer));
+       DEFINE(__LC_LAST_UPDATE_TIMER, offsetof(struct _lowcore, last_update_timer));
+       DEFINE(__LC_LAST_UPDATE_CLOCK, offsetof(struct _lowcore, last_update_clock));
+       DEFINE(__LC_CURRENT, offsetof(struct _lowcore, current_task));
+       DEFINE(__LC_THREAD_INFO, offsetof(struct _lowcore, thread_info));
+       DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
+       DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
+       DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
+       DEFINE(__LC_KERNEL_ASCE, offsetof(struct _lowcore, kernel_asce));
+       DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
+       DEFINE(__LC_USER_EXEC_ASCE, offsetof(struct _lowcore, user_exec_asce));
+       DEFINE(__LC_CPUID, offsetof(struct _lowcore, cpu_id));
+       DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
+       DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
+       DEFINE(__LC_FTRACE_FUNC, offsetof(struct _lowcore, ftrace_func));
+       DEFINE(__LC_IRB, offsetof(struct _lowcore, irb));
+       DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area));
+       DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area));
+       DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area));
+       DEFINE(__LC_PREFIX_SAVE_AREA, offsetof(struct _lowcore, prefixreg_save_area));
+       DEFINE(__LC_AREGS_SAVE_AREA, offsetof(struct _lowcore, access_regs_save_area));
+       DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
+       DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
+       DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
+#ifdef CONFIG_32BIT
+       DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params));
+       DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr));
+#else /* CONFIG_32BIT */
+       DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params2));
+       DEFINE(__LC_EXT_PARAMS2, offsetof(struct _lowcore, ext_params2));
+       DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, floating_pt_save_area));
+       DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
+       DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
+       DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
+       DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
+#endif /* CONFIG_32BIT */
        return 0;
 }
index dc7e5259770f6c97affe2cbbbad7f57e7ceb366d..15e46ca943354501c495a8ae6c921a96162c5833 100644 (file)
@@ -6,8 +6,8 @@
  *              Michael Holzheu <holzheu@de.ibm.com>
  */
 
+#include <asm/asm-offsets.h>
 #include <asm/ptrace.h>
-#include <asm/lowcore.h>
 
 #ifdef CONFIG_64BIT
 
index 22c9e557bb22b9f79b275fe3707f27cb133e6c8c..11c3aba664ea6840604c50399a61121e8742d387 100644 (file)
@@ -616,44 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
  */
 
 struct mmap_arg_struct_emu31 {
-       u32     addr;
-       u32     len;
-       u32     prot;
-       u32     flags;
-       u32     fd;
-       u32     offset;
+       compat_ulong_t addr;
+       compat_ulong_t len;
+       compat_ulong_t prot;
+       compat_ulong_t flags;
+       compat_ulong_t fd;
+       compat_ulong_t offset;
 };
 
-asmlinkage unsigned long
-old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
+asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
 {
        struct mmap_arg_struct_emu31 a;
-       int error = -EFAULT;
 
        if (copy_from_user(&a, arg, sizeof(a)))
-               goto out;
-
-       error = -EINVAL;
+               return -EFAULT;
        if (a.offset & ~PAGE_MASK)
-               goto out;
-
-       error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
-                              a.offset >> PAGE_SHIFT);
-out:
-       return error;
+               return -EINVAL;
+       a.addr = (unsigned long) compat_ptr(a.addr);
+       return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
+                             a.offset >> PAGE_SHIFT);
 }
 
-asmlinkage long 
-sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
+asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
 {
        struct mmap_arg_struct_emu31 a;
-       int error = -EFAULT;
 
        if (copy_from_user(&a, arg, sizeof(a)))
-               goto out;
-       error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
-out:
-       return error;
+               return -EFAULT;
+       a.addr = (unsigned long) compat_ptr(a.addr);
+       return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
 }
 
 asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
index faeaccc7d7d98ddffccdfa83b41d92b341df57d5..30de2d0e52bb421e41efabd67cdbc677bb7e5539 100644 (file)
@@ -1853,12 +1853,3 @@ sys32_execve_wrapper:
        llgtr   %r3,%r3                 # compat_uptr_t *
        llgtr   %r4,%r4                 # compat_uptr_t *
        jg      sys32_execve            # branch to system call
-
-       .globl  compat_sys_recvmmsg_wrapper
-compat_sys_recvmmsg_wrapper:
-       lgfr    %r2,%r2                 # int
-       llgtr   %r3,%r3                 # struct compat_mmsghdr *
-       llgfr   %r4,%r4                 # unsigned int
-       llgfr   %r5,%r5                 # unsigned int
-       llgtr   %r6,%r6                 # struct compat_timespec *
-       jg      compat_sys_recvmmsg
index db943a7ec51331f5f471c23f838e454eb46c99b2..b39b27d68b456bf04c0b8eca232c027d900d8117 100644 (file)
@@ -86,10 +86,17 @@ enum {
        U4_12,  /* 4 bit unsigned value starting at 12 */
        U4_16,  /* 4 bit unsigned value starting at 16 */
        U4_20,  /* 4 bit unsigned value starting at 20 */
+       U4_32,  /* 4 bit unsigned value starting at 32 */
        U8_8,   /* 8 bit unsigned value starting at 8 */
        U8_16,  /* 8 bit unsigned value starting at 16 */
+       U8_24,  /* 8 bit unsigned value starting at 24 */
+       U8_32,  /* 8 bit unsigned value starting at 32 */
+       I8_8,   /* 8 bit signed value starting at 8 */
+       I8_32,  /* 8 bit signed value starting at 32 */
        I16_16, /* 16 bit signed value starting at 16 */
+       I16_32, /* 32 bit signed value starting at 16 */
        U16_16, /* 16 bit unsigned value starting at 16 */
+       U16_32, /* 32 bit unsigned value starting at 16 */
        J16_16, /* PC relative jump offset at 16 */
        J32_16, /* PC relative long offset at 16 */
        I32_16, /* 32 bit signed value starting at 16 */
@@ -104,21 +111,37 @@ enum {
  */
 enum {
        INSTR_INVALID,
-       INSTR_E, INSTR_RIE_RRP, INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU,
-       INSTR_RIL_UP, INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
+       INSTR_E,
+       INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
+       INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU,
+       INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
+       INSTR_RIS_R0RDU, INSTR_RIS_R0UU, INSTR_RIS_RURDI, INSTR_RIS_RURDU,
+       INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
        INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0,
-       INSTR_RRE_FF, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF, INSTR_RRE_RR,
-       INSTR_RRE_RR_OPT, INSTR_RRF_F0FF, INSTR_RRF_FUFF, INSTR_RRF_M0RR,
-       INSTR_RRF_R0RR, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF,
+       INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
+       INSTR_RRE_RR, INSTR_RRE_RR_OPT,
+       INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
+       INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_M0RR, INSTR_RRF_R0RR,
+       INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, INSTR_RRF_U0RR,
+       INSTR_RRF_UUFF, INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
        INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
-       INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD, INSTR_RSI_RRP,
-       INSTR_RSL_R0RD, INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD,
-       INSTR_RSY_RURD, INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD,
-       INSTR_RS_RRRD, INSTR_RS_RURD, INSTR_RXE_FRRD, INSTR_RXE_RRRD,
-       INSTR_RXF_FRRDF, INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RX_FRRD,
-       INSTR_RX_RRRD, INSTR_RX_URRD, INSTR_SIY_URD, INSTR_SI_URD,
-       INSTR_SSE_RDRD, INSTR_SSF_RRDRD, INSTR_SS_L0RDRD, INSTR_SS_LIRDRD,
-       INSTR_SS_LLRDRD, INSTR_SS_RRRDRD, INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
+       INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
+       INSTR_RSI_RRP,
+       INSTR_RSL_R0RD,
+       INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
+       INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
+       INSTR_RS_RURD,
+       INSTR_RXE_FRRD, INSTR_RXE_RRRD,
+       INSTR_RXF_FRRDF,
+       INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RXY_URRD,
+       INSTR_RX_FRRD, INSTR_RX_RRRD, INSTR_RX_URRD,
+       INSTR_SIL_RDI, INSTR_SIL_RDU,
+       INSTR_SIY_IRD, INSTR_SIY_URD,
+       INSTR_SI_URD,
+       INSTR_SSE_RDRD,
+       INSTR_SSF_RRDRD,
+       INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
+       INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
        INSTR_S_00, INSTR_S_RD,
 };
 
@@ -129,7 +152,7 @@ struct operand {
 };
 
 struct insn {
-       const char name[5];
+       const char name[6];
        unsigned char opfrag;
        unsigned char format;
 };
@@ -170,11 +193,16 @@ static const struct operand operands[] =
        [U4_12]  = {  4, 12, 0 },
        [U4_16]  = {  4, 16, 0 },
        [U4_20]  = {  4, 20, 0 },
+       [U4_32]  = {  4, 32, 0 },
        [U8_8]   = {  8,  8, 0 },
        [U8_16]  = {  8, 16, 0 },
+       [U8_24]  = {  8, 24, 0 },
+       [U8_32]  = {  8, 32, 0 },
        [I16_16] = { 16, 16, OPERAND_SIGNED },
        [U16_16] = { 16, 16, 0 },
+       [U16_32] = { 16, 32, 0 },
        [J16_16] = { 16, 16, OPERAND_PCREL },
+       [I16_32] = { 16, 32, OPERAND_SIGNED },
        [J32_16] = { 32, 16, OPERAND_PCREL },
        [I32_16] = { 32, 16, OPERAND_SIGNED },
        [U32_16] = { 32, 16, 0 },
@@ -183,82 +211,93 @@ static const struct operand operands[] =
 };
 
 static const unsigned char formats[][7] = {
-       [INSTR_E]         = { 0xff, 0,0,0,0,0,0 },             /* e.g. pr    */
-       [INSTR_RIE_RRP]   = { 0xff, R_8,R_12,J16_16,0,0,0 },   /* e.g. brxhg */
-       [INSTR_RIL_RP]    = { 0x0f, R_8,J32_16,0,0,0,0 },      /* e.g. brasl */
-       [INSTR_RIL_UP]    = { 0x0f, U4_8,J32_16,0,0,0,0 },     /* e.g. brcl  */
-       [INSTR_RIL_RI]    = { 0x0f, R_8,I32_16,0,0,0,0 },      /* e.g. afi   */
-       [INSTR_RIL_RU]    = { 0x0f, R_8,U32_16,0,0,0,0 },      /* e.g. alfi  */
-       [INSTR_RI_RI]     = { 0x0f, R_8,I16_16,0,0,0,0 },      /* e.g. ahi   */
-       [INSTR_RI_RP]     = { 0x0f, R_8,J16_16,0,0,0,0 },      /* e.g. brct  */
-       [INSTR_RI_RU]     = { 0x0f, R_8,U16_16,0,0,0,0 },      /* e.g. tml   */
-       [INSTR_RI_UP]     = { 0x0f, U4_8,J16_16,0,0,0,0 },     /* e.g. brc   */
-       [INSTR_RRE_00]    = { 0xff, 0,0,0,0,0,0 },             /* e.g. palb  */
-       [INSTR_RRE_0R]    = { 0xff, R_28,0,0,0,0,0 },          /* e.g. tb    */
-       [INSTR_RRE_AA]    = { 0xff, A_24,A_28,0,0,0,0 },       /* e.g. cpya  */
-       [INSTR_RRE_AR]    = { 0xff, A_24,R_28,0,0,0,0 },       /* e.g. sar   */
-       [INSTR_RRE_F0]    = { 0xff, F_24,0,0,0,0,0 },          /* e.g. sqer  */
-       [INSTR_RRE_FF]    = { 0xff, F_24,F_28,0,0,0,0 },       /* e.g. debr  */
-       [INSTR_RRE_R0]    = { 0xff, R_24,0,0,0,0,0 },          /* e.g. ipm   */
-       [INSTR_RRE_RA]    = { 0xff, R_24,A_28,0,0,0,0 },       /* e.g. ear   */
-       [INSTR_RRE_RF]    = { 0xff, R_24,F_28,0,0,0,0 },       /* e.g. cefbr */
-       [INSTR_RRE_RR]    = { 0xff, R_24,R_28,0,0,0,0 },       /* e.g. lura  */
-       [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },      /* efpc, sfpc */
-       [INSTR_RRF_F0FF]  = { 0xff, F_16,F_24,F_28,0,0,0 },    /* e.g. madbr */
-       [INSTR_RRF_FUFF]  = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */
-       [INSTR_RRF_RURR]  = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */
-       [INSTR_RRF_R0RR]  = { 0xff, R_24,R_16,R_28,0,0,0 },    /* e.g. idte  */
-       [INSTR_RRF_U0FF]  = { 0xff, F_24,U4_16,F_28,0,0,0 },   /* e.g. fixr  */
-       [INSTR_RRF_U0RF]  = { 0xff, R_24,U4_16,F_28,0,0,0 },   /* e.g. cfebr */
-       [INSTR_RRF_M0RR]  = { 0xff, R_24,R_28,M_16,0,0,0 },    /* e.g. sske  */
-       [INSTR_RR_FF]     = { 0xff, F_8,F_12,0,0,0,0 },        /* e.g. adr   */
-       [INSTR_RR_R0]     = { 0xff, R_8, 0,0,0,0,0 },          /* e.g. spm   */
-       [INSTR_RR_RR]     = { 0xff, R_8,R_12,0,0,0,0 },        /* e.g. lr    */
-       [INSTR_RR_U0]     = { 0xff, U8_8, 0,0,0,0,0 },         /* e.g. svc   */
-       [INSTR_RR_UR]     = { 0xff, U4_8,R_12,0,0,0,0 },       /* e.g. bcr   */
-       [INSTR_RSE_RRRD]  = { 0xff, R_8,R_12,D_20,B_16,0,0 },  /* e.g. lmh   */
-       [INSTR_RSE_CCRD]  = { 0xff, C_8,C_12,D_20,B_16,0,0 },  /* e.g. lmh   */
-       [INSTR_RSE_RURD]  = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icmh  */
-       [INSTR_RSL_R0RD]  = { 0xff, R_8,D_20,B_16,0,0,0 },     /* e.g. tp    */
-       [INSTR_RSI_RRP]   = { 0xff, R_8,R_12,J16_16,0,0,0 },   /* e.g. brxh  */
-       [INSTR_RSY_RRRD]  = { 0xff, R_8,R_12,D20_20,B_16,0,0 },/* e.g. stmy  */
+       [INSTR_E]         = { 0xff, 0,0,0,0,0,0 },
+       [INSTR_RIE_R0UU]  = { 0xff, R_8,U16_16,U4_32,0,0,0 },
+       [INSTR_RIE_RRPU]  = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
+       [INSTR_RIE_RRP]   = { 0xff, R_8,R_12,J16_16,0,0,0 },
+       [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
+       [INSTR_RIE_RUPI]  = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
+       [INSTR_RIL_RI]    = { 0x0f, R_8,I32_16,0,0,0,0 },
+       [INSTR_RIL_RP]    = { 0x0f, R_8,J32_16,0,0,0,0 },
+       [INSTR_RIL_RU]    = { 0x0f, R_8,U32_16,0,0,0,0 },
+       [INSTR_RIL_UP]    = { 0x0f, U4_8,J32_16,0,0,0,0 },
+       [INSTR_RIS_R0RDU] = { 0xff, R_8,U8_32,D_20,B_16,0,0 },
+       [INSTR_RIS_RURDI] = { 0xff, R_8,I8_32,U4_12,D_20,B_16,0 },
+       [INSTR_RIS_RURDU] = { 0xff, R_8,U8_32,U4_12,D_20,B_16,0 },
+       [INSTR_RI_RI]     = { 0x0f, R_8,I16_16,0,0,0,0 },
+       [INSTR_RI_RP]     = { 0x0f, R_8,J16_16,0,0,0,0 },
+       [INSTR_RI_RU]     = { 0x0f, R_8,U16_16,0,0,0,0 },
+       [INSTR_RI_UP]     = { 0x0f, U4_8,J16_16,0,0,0,0 },
+       [INSTR_RRE_00]    = { 0xff, 0,0,0,0,0,0 },
+       [INSTR_RRE_0R]    = { 0xff, R_28,0,0,0,0,0 },
+       [INSTR_RRE_AA]    = { 0xff, A_24,A_28,0,0,0,0 },
+       [INSTR_RRE_AR]    = { 0xff, A_24,R_28,0,0,0,0 },
+       [INSTR_RRE_F0]    = { 0xff, F_24,0,0,0,0,0 },
+       [INSTR_RRE_FF]    = { 0xff, F_24,F_28,0,0,0,0 },
+       [INSTR_RRE_FR]    = { 0xff, F_24,R_28,0,0,0,0 },
+       [INSTR_RRE_R0]    = { 0xff, R_24,0,0,0,0,0 },
+       [INSTR_RRE_RA]    = { 0xff, R_24,A_28,0,0,0,0 },
+       [INSTR_RRE_RF]    = { 0xff, R_24,F_28,0,0,0,0 },
+       [INSTR_RRE_RR]    = { 0xff, R_24,R_28,0,0,0,0 },
+       [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },
+       [INSTR_RRF_0UFF]  = { 0xff, F_24,F_28,U4_20,0,0,0 },
+       [INSTR_RRF_F0FF2] = { 0xff, F_24,F_16,F_28,0,0,0 },
+       [INSTR_RRF_F0FF]  = { 0xff, F_16,F_24,F_28,0,0,0 },
+       [INSTR_RRF_F0FR]  = { 0xff, F_24,F_16,R_28,0,0,0 },
+       [INSTR_RRF_FFRU]  = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
+       [INSTR_RRF_FUFF]  = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
+       [INSTR_RRF_M0RR]  = { 0xff, R_24,R_28,M_16,0,0,0 },
+       [INSTR_RRF_R0RR]  = { 0xff, R_24,R_16,R_28,0,0,0 },
+       [INSTR_RRF_RURR]  = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
+       [INSTR_RRF_U0FF]  = { 0xff, F_24,U4_16,F_28,0,0,0 },
+       [INSTR_RRF_U0RF]  = { 0xff, R_24,U4_16,F_28,0,0,0 },
+       [INSTR_RRF_U0RR]  = { 0xff, R_24,R_28,U4_16,0,0,0 },
+       [INSTR_RRF_UUFF]  = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
+       [INSTR_RRR_F0FF]  = { 0xff, F_24,F_28,F_16,0,0,0 },
+       [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
+       [INSTR_RR_FF]     = { 0xff, F_8,F_12,0,0,0,0 },
+       [INSTR_RR_R0]     = { 0xff, R_8, 0,0,0,0,0 },
+       [INSTR_RR_RR]     = { 0xff, R_8,R_12,0,0,0,0 },
+       [INSTR_RR_U0]     = { 0xff, U8_8, 0,0,0,0,0 },
+       [INSTR_RR_UR]     = { 0xff, U4_8,R_12,0,0,0,0 },
+       [INSTR_RSE_CCRD]  = { 0xff, C_8,C_12,D_20,B_16,0,0 },
+       [INSTR_RSE_RRRD]  = { 0xff, R_8,R_12,D_20,B_16,0,0 },
+       [INSTR_RSE_RURD]  = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
+       [INSTR_RSI_RRP]   = { 0xff, R_8,R_12,J16_16,0,0,0 },
+       [INSTR_RSL_R0RD]  = { 0xff, D_20,L4_8,B_16,0,0,0 },
+       [INSTR_RSY_AARD]  = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
+       [INSTR_RSY_CCRD]  = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
+       [INSTR_RSY_RRRD]  = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
        [INSTR_RSY_RURD]  = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
-                                                              /* e.g. icmh  */
-       [INSTR_RSY_AARD]  = { 0xff, A_8,A_12,D20_20,B_16,0,0 },/* e.g. lamy  */
-       [INSTR_RSY_CCRD]  = { 0xff, C_8,C_12,D20_20,B_16,0,0 },/* e.g. lamy  */
-       [INSTR_RS_AARD]   = { 0xff, A_8,A_12,D_20,B_16,0,0 },  /* e.g. lam   */
-       [INSTR_RS_CCRD]   = { 0xff, C_8,C_12,D_20,B_16,0,0 },  /* e.g. lctl  */
-       [INSTR_RS_R0RD]   = { 0xff, R_8,D_20,B_16,0,0,0 },     /* e.g. sll   */
-       [INSTR_RS_RRRD]   = { 0xff, R_8,R_12,D_20,B_16,0,0 },  /* e.g. cs    */
-       [INSTR_RS_RURD]   = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icm   */
-       [INSTR_RXE_FRRD]  = { 0xff, F_8,D_20,X_12,B_16,0,0 },  /* e.g. axbr  */
-       [INSTR_RXE_RRRD]  = { 0xff, R_8,D_20,X_12,B_16,0,0 },  /* e.g. lg    */
+       [INSTR_RS_AARD]   = { 0xff, A_8,A_12,D_20,B_16,0,0 },
+       [INSTR_RS_CCRD]   = { 0xff, C_8,C_12,D_20,B_16,0,0 },
+       [INSTR_RS_R0RD]   = { 0xff, R_8,D_20,B_16,0,0,0 },
+       [INSTR_RS_RRRD]   = { 0xff, R_8,R_12,D_20,B_16,0,0 },
+       [INSTR_RS_RURD]   = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
+       [INSTR_RXE_FRRD]  = { 0xff, F_8,D_20,X_12,B_16,0,0 },
+       [INSTR_RXE_RRRD]  = { 0xff, R_8,D_20,X_12,B_16,0,0 },
        [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 },
-                                                              /* e.g. madb  */
-       [INSTR_RXY_RRRD]  = { 0xff, R_8,D20_20,X_12,B_16,0,0 },/* e.g. ly    */
-       [INSTR_RXY_FRRD]  = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley   */
-       [INSTR_RX_FRRD]   = { 0xff, F_8,D_20,X_12,B_16,0,0 },  /* e.g. ae    */
-       [INSTR_RX_RRRD]   = { 0xff, R_8,D_20,X_12,B_16,0,0 },  /* e.g. l     */
-       [INSTR_RX_URRD]   = { 0xff, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc    */
-       [INSTR_SI_URD]    = { 0xff, D_20,B_16,U8_8,0,0,0 },    /* e.g. cli   */
-       [INSTR_SIY_URD]   = { 0xff, D20_20,B_16,U8_8,0,0,0 },  /* e.g. tmy   */
-       [INSTR_SSE_RDRD]  = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */
+       [INSTR_RXY_FRRD]  = { 0xff, F_8,D20_20,X_12,B_16,0,0 },
+       [INSTR_RXY_RRRD]  = { 0xff, R_8,D20_20,X_12,B_16,0,0 },
+       [INSTR_RXY_URRD]  = { 0xff, U4_8,D20_20,X_12,B_16,0,0 },
+       [INSTR_RX_FRRD]   = { 0xff, F_8,D_20,X_12,B_16,0,0 },
+       [INSTR_RX_RRRD]   = { 0xff, R_8,D_20,X_12,B_16,0,0 },
+       [INSTR_RX_URRD]   = { 0xff, U4_8,D_20,X_12,B_16,0,0 },
+       [INSTR_SIL_RDI]   = { 0xff, D_20,B_16,I16_32,0,0,0 },
+       [INSTR_SIL_RDU]   = { 0xff, D_20,B_16,U16_32,0,0,0 },
+       [INSTR_SIY_IRD]   = { 0xff, D20_20,B_16,I8_8,0,0,0 },
+       [INSTR_SIY_URD]   = { 0xff, D20_20,B_16,U8_8,0,0,0 },
+       [INSTR_SI_URD]    = { 0xff, D_20,B_16,U8_8,0,0,0 },
+       [INSTR_SSE_RDRD]  = { 0xff, D_20,B_16,D_36,B_32,0,0 },
+       [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
        [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
-                                                              /* e.g. mvc   */
        [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
-                                                              /* e.g. srp   */
        [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
-                                                              /* e.g. pack  */
-       [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
-                                                              /* e.g. mvck  */
        [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 },
-                                                              /* e.g. plo   */
        [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 },
-                                                              /* e.g. lmd   */
-       [INSTR_S_00]      = { 0xff, 0,0,0,0,0,0 },             /* e.g. hsch  */
-       [INSTR_S_RD]      = { 0xff, D_20,B_16,0,0,0,0 },       /* e.g. lpsw  */
-       [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
-                                                              /* e.g. mvcos */
+       [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
+       [INSTR_S_00]      = { 0xff, 0,0,0,0,0,0 },
+       [INSTR_S_RD]      = { 0xff, D_20,B_16,0,0,0,0 },
 };
 
 static struct insn opcode[] = {
@@ -454,6 +493,8 @@ static struct insn opcode[] = {
 static struct insn opcode_01[] = {
 #ifdef CONFIG_64BIT
        { "sam64", 0x0e, INSTR_E },
+       { "pfpo", 0x0a, INSTR_E },
+       { "ptff", 0x04, INSTR_E },
 #endif
        { "pr", 0x01, INSTR_E },
        { "upt", 0x02, INSTR_E },
@@ -519,6 +560,8 @@ static struct insn opcode_b2[] = {
        { "cutfu", 0xa7, INSTR_RRF_M0RR },
        { "stfle", 0xb0, INSTR_S_RD },
        { "lpswe", 0xb2, INSTR_S_RD },
+       { "srnmt", 0xb9, INSTR_S_RD },
+       { "lfas", 0xbd, INSTR_S_RD },
 #endif
        { "stidp", 0x02, INSTR_S_RD },
        { "sck", 0x04, INSTR_S_RD },
@@ -589,7 +632,6 @@ static struct insn opcode_b2[] = {
        { "clst", 0x5d, INSTR_RRE_RR },
        { "srst", 0x5e, INSTR_RRE_RR },
        { "cmpsc", 0x63, INSTR_RRE_RR },
-       { "cmpsc", 0x63, INSTR_RRE_RR },
        { "siga", 0x74, INSTR_S_RD },
        { "xsch", 0x76, INSTR_S_00 },
        { "rp", 0x77, INSTR_S_RD },
@@ -630,6 +672,57 @@ static struct insn opcode_b3[] = {
        { "cger", 0xc8, INSTR_RRF_U0RF },
        { "cgdr", 0xc9, INSTR_RRF_U0RF },
        { "cgxr", 0xca, INSTR_RRF_U0RF },
+       { "lpdfr", 0x70, INSTR_RRE_FF },
+       { "lndfr", 0x71, INSTR_RRE_FF },
+       { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
+       { "lcdfr", 0x73, INSTR_RRE_FF },
+       { "ldgr", 0xc1, INSTR_RRE_FR },
+       { "lgdr", 0xcd, INSTR_RRE_RF },
+       { "adtr", 0xd2, INSTR_RRR_F0FF },
+       { "axtr", 0xda, INSTR_RRR_F0FF },
+       { "cdtr", 0xe4, INSTR_RRE_FF },
+       { "cxtr", 0xec, INSTR_RRE_FF },
+       { "kdtr", 0xe0, INSTR_RRE_FF },
+       { "kxtr", 0xe8, INSTR_RRE_FF },
+       { "cedtr", 0xf4, INSTR_RRE_FF },
+       { "cextr", 0xfc, INSTR_RRE_FF },
+       { "cdgtr", 0xf1, INSTR_RRE_FR },
+       { "cxgtr", 0xf9, INSTR_RRE_FR },
+       { "cdstr", 0xf3, INSTR_RRE_FR },
+       { "cxstr", 0xfb, INSTR_RRE_FR },
+       { "cdutr", 0xf2, INSTR_RRE_FR },
+       { "cxutr", 0xfa, INSTR_RRE_FR },
+       { "cgdtr", 0xe1, INSTR_RRF_U0RF },
+       { "cgxtr", 0xe9, INSTR_RRF_U0RF },
+       { "csdtr", 0xe3, INSTR_RRE_RF },
+       { "csxtr", 0xeb, INSTR_RRE_RF },
+       { "cudtr", 0xe2, INSTR_RRE_RF },
+       { "cuxtr", 0xea, INSTR_RRE_RF },
+       { "ddtr", 0xd1, INSTR_RRR_F0FF },
+       { "dxtr", 0xd9, INSTR_RRR_F0FF },
+       { "eedtr", 0xe5, INSTR_RRE_RF },
+       { "eextr", 0xed, INSTR_RRE_RF },
+       { "esdtr", 0xe7, INSTR_RRE_RF },
+       { "esxtr", 0xef, INSTR_RRE_RF },
+       { "iedtr", 0xf6, INSTR_RRF_F0FR },
+       { "iextr", 0xfe, INSTR_RRF_F0FR },
+       { "ltdtr", 0xd6, INSTR_RRE_FF },
+       { "ltxtr", 0xde, INSTR_RRE_FF },
+       { "fidtr", 0xd7, INSTR_RRF_UUFF },
+       { "fixtr", 0xdf, INSTR_RRF_UUFF },
+       { "ldetr", 0xd4, INSTR_RRF_0UFF },
+       { "lxdtr", 0xdc, INSTR_RRF_0UFF },
+       { "ledtr", 0xd5, INSTR_RRF_UUFF },
+       { "ldxtr", 0xdd, INSTR_RRF_UUFF },
+       { "mdtr", 0xd0, INSTR_RRR_F0FF },
+       { "mxtr", 0xd8, INSTR_RRR_F0FF },
+       { "qadtr", 0xf5, INSTR_RRF_FUFF },
+       { "qaxtr", 0xfd, INSTR_RRF_FUFF },
+       { "rrdtr", 0xf7, INSTR_RRF_FFRU },
+       { "rrxtr", 0xff, INSTR_RRF_FFRU },
+       { "sfasr", 0x85, INSTR_RRE_R0 },
+       { "sdtr", 0xd3, INSTR_RRR_F0FF },
+       { "sxtr", 0xdb, INSTR_RRR_F0FF },
 #endif
        { "lpebr", 0x00, INSTR_RRE_FF },
        { "lnebr", 0x01, INSTR_RRE_FF },
@@ -780,6 +873,14 @@ static struct insn opcode_b9[] = {
        { "cu24", 0xb1, INSTR_RRF_M0RR },
        { "cu41", 0xb2, INSTR_RRF_M0RR },
        { "cu42", 0xb3, INSTR_RRF_M0RR },
+       { "crt", 0x72, INSTR_RRF_U0RR },
+       { "cgrt", 0x60, INSTR_RRF_U0RR },
+       { "clrt", 0x73, INSTR_RRF_U0RR },
+       { "clgrt", 0x61, INSTR_RRF_U0RR },
+       { "ptf", 0xa2, INSTR_RRE_R0 },
+       { "pfmf", 0xaf, INSTR_RRE_RR },
+       { "trte", 0xbf, INSTR_RRF_M0RR },
+       { "trtre", 0xbd, INSTR_RRF_M0RR },
 #endif
        { "kmac", 0x1e, INSTR_RRE_RR },
        { "lrvr", 0x1f, INSTR_RRE_RR },
@@ -835,6 +936,43 @@ static struct insn opcode_c2[] = {
        { "cfi", 0x0d, INSTR_RIL_RI },
        { "clgfi", 0x0e, INSTR_RIL_RU },
        { "clfi", 0x0f, INSTR_RIL_RU },
+       { "msfi", 0x01, INSTR_RIL_RI },
+       { "msgfi", 0x00, INSTR_RIL_RI },
+#endif
+       { "", 0, INSTR_INVALID }
+};
+
+static struct insn opcode_c4[] = {
+#ifdef CONFIG_64BIT
+       { "lrl", 0x0d, INSTR_RIL_RP },
+       { "lgrl", 0x08, INSTR_RIL_RP },
+       { "lgfrl", 0x0c, INSTR_RIL_RP },
+       { "lhrl", 0x05, INSTR_RIL_RP },
+       { "lghrl", 0x04, INSTR_RIL_RP },
+       { "llgfrl", 0x0e, INSTR_RIL_RP },
+       { "llhrl", 0x02, INSTR_RIL_RP },
+       { "llghrl", 0x06, INSTR_RIL_RP },
+       { "strl", 0x0f, INSTR_RIL_RP },
+       { "stgrl", 0x0b, INSTR_RIL_RP },
+       { "sthrl", 0x07, INSTR_RIL_RP },
+#endif
+       { "", 0, INSTR_INVALID }
+};
+
+static struct insn opcode_c6[] = {
+#ifdef CONFIG_64BIT
+       { "crl", 0x0d, INSTR_RIL_RP },
+       { "cgrl", 0x08, INSTR_RIL_RP },
+       { "cgfrl", 0x0c, INSTR_RIL_RP },
+       { "chrl", 0x05, INSTR_RIL_RP },
+       { "cghrl", 0x04, INSTR_RIL_RP },
+       { "clrl", 0x0f, INSTR_RIL_RP },
+       { "clgrl", 0x0a, INSTR_RIL_RP },
+       { "clgfrl", 0x0e, INSTR_RIL_RP },
+       { "clhrl", 0x07, INSTR_RIL_RP },
+       { "clghrl", 0x06, INSTR_RIL_RP },
+       { "pfdrl", 0x02, INSTR_RIL_UP },
+       { "exrl", 0x00, INSTR_RIL_RP },
 #endif
        { "", 0, INSTR_INVALID }
 };
@@ -842,6 +980,8 @@ static struct insn opcode_c2[] = {
 static struct insn opcode_c8[] = {
 #ifdef CONFIG_64BIT
        { "mvcos", 0x00, INSTR_SSF_RRDRD },
+       { "ectg", 0x01, INSTR_SSF_RRDRD },
+       { "csst", 0x02, INSTR_SSF_RRDRD },
 #endif
        { "", 0, INSTR_INVALID }
 };
@@ -917,6 +1057,12 @@ static struct insn opcode_e3[] = {
        { "llgh", 0x91, INSTR_RXY_RRRD },
        { "llc", 0x94, INSTR_RXY_RRRD },
        { "llh", 0x95, INSTR_RXY_RRRD },
+       { "cgh", 0x34, INSTR_RXY_RRRD },
+       { "laey", 0x75, INSTR_RXY_RRRD },
+       { "ltgf", 0x32, INSTR_RXY_RRRD },
+       { "mfy", 0x5c, INSTR_RXY_RRRD },
+       { "mhy", 0x7c, INSTR_RXY_RRRD },
+       { "pfd", 0x36, INSTR_RXY_URRD },
 #endif
        { "lrv", 0x1e, INSTR_RXY_RRRD },
        { "lrvh", 0x1f, INSTR_RXY_RRRD },
@@ -931,6 +1077,15 @@ static struct insn opcode_e3[] = {
 static struct insn opcode_e5[] = {
 #ifdef CONFIG_64BIT
        { "strag", 0x02, INSTR_SSE_RDRD },
+       { "chhsi", 0x54, INSTR_SIL_RDI },
+       { "chsi", 0x5c, INSTR_SIL_RDI },
+       { "cghsi", 0x58, INSTR_SIL_RDI },
+       { "clhhsi", 0x55, INSTR_SIL_RDU },
+       { "clfhsi", 0x5d, INSTR_SIL_RDU },
+       { "clghsi", 0x59, INSTR_SIL_RDU },
+       { "mvhhi", 0x44, INSTR_SIL_RDI },
+       { "mvhi", 0x4c, INSTR_SIL_RDI },
+       { "mvghi", 0x48, INSTR_SIL_RDI },
 #endif
        { "lasp", 0x00, INSTR_SSE_RDRD },
        { "tprot", 0x01, INSTR_SSE_RDRD },
@@ -977,6 +1132,11 @@ static struct insn opcode_eb[] = {
        { "lmy", 0x98, INSTR_RSY_RRRD },
        { "lamy", 0x9a, INSTR_RSY_AARD },
        { "stamy", 0x9b, INSTR_RSY_AARD },
+       { "asi", 0x6a, INSTR_SIY_IRD },
+       { "agsi", 0x7a, INSTR_SIY_IRD },
+       { "alsi", 0x6e, INSTR_SIY_IRD },
+       { "algsi", 0x7e, INSTR_SIY_IRD },
+       { "ecag", 0x4c, INSTR_RSY_RRRD },
 #endif
        { "rll", 0x1d, INSTR_RSY_RRRD },
        { "mvclu", 0x8e, INSTR_RSY_RRRD },
@@ -988,6 +1148,30 @@ static struct insn opcode_ec[] = {
 #ifdef CONFIG_64BIT
        { "brxhg", 0x44, INSTR_RIE_RRP },
        { "brxlg", 0x45, INSTR_RIE_RRP },
+       { "crb", 0xf6, INSTR_RRS_RRRDU },
+       { "cgrb", 0xe4, INSTR_RRS_RRRDU },
+       { "crj", 0x76, INSTR_RIE_RRPU },
+       { "cgrj", 0x64, INSTR_RIE_RRPU },
+       { "cib", 0xfe, INSTR_RIS_RURDI },
+       { "cgib", 0xfc, INSTR_RIS_RURDI },
+       { "cij", 0x7e, INSTR_RIE_RUPI },
+       { "cgij", 0x7c, INSTR_RIE_RUPI },
+       { "cit", 0x72, INSTR_RIE_R0IU },
+       { "cgit", 0x70, INSTR_RIE_R0IU },
+       { "clrb", 0xf7, INSTR_RRS_RRRDU },
+       { "clgrb", 0xe5, INSTR_RRS_RRRDU },
+       { "clrj", 0x77, INSTR_RIE_RRPU },
+       { "clgrj", 0x65, INSTR_RIE_RRPU },
+       { "clib", 0xff, INSTR_RIS_RURDU },
+       { "clgib", 0xfd, INSTR_RIS_RURDU },
+       { "clij", 0x7f, INSTR_RIE_RUPU },
+       { "clgij", 0x7d, INSTR_RIE_RUPU },
+       { "clfit", 0x73, INSTR_RIE_R0UU },
+       { "clgit", 0x71, INSTR_RIE_R0UU },
+       { "rnsbg", 0x54, INSTR_RIE_RRUUU },
+       { "rxsbg", 0x57, INSTR_RIE_RRUUU },
+       { "rosbg", 0x56, INSTR_RIE_RRUUU },
+       { "risbg", 0x55, INSTR_RIE_RRUUU },
 #endif
        { "", 0, INSTR_INVALID }
 };
@@ -1004,6 +1188,16 @@ static struct insn opcode_ed[] = {
        { "ldy", 0x65, INSTR_RXY_FRRD },
        { "stey", 0x66, INSTR_RXY_FRRD },
        { "stdy", 0x67, INSTR_RXY_FRRD },
+       { "sldt", 0x40, INSTR_RXF_FRRDF },
+       { "slxt", 0x48, INSTR_RXF_FRRDF },
+       { "srdt", 0x41, INSTR_RXF_FRRDF },
+       { "srxt", 0x49, INSTR_RXF_FRRDF },
+       { "tdcet", 0x50, INSTR_RXE_FRRD },
+       { "tdcdt", 0x54, INSTR_RXE_FRRD },
+       { "tdcxt", 0x58, INSTR_RXE_FRRD },
+       { "tdget", 0x51, INSTR_RXE_FRRD },
+       { "tdgdt", 0x55, INSTR_RXE_FRRD },
+       { "tdgxt", 0x59, INSTR_RXE_FRRD },
 #endif
        { "ldeb", 0x04, INSTR_RXE_FRRD },
        { "lxdb", 0x05, INSTR_RXE_FRRD },
@@ -1037,6 +1231,7 @@ static struct insn opcode_ed[] = {
        { "mae", 0x2e, INSTR_RXF_FRRDF },
        { "mse", 0x2f, INSTR_RXF_FRRDF },
        { "sqe", 0x34, INSTR_RXE_FRRD },
+       { "sqd", 0x35, INSTR_RXE_FRRD },
        { "mee", 0x37, INSTR_RXE_FRRD },
        { "mad", 0x3e, INSTR_RXF_FRRDF },
        { "msd", 0x3f, INSTR_RXF_FRRDF },
@@ -1117,6 +1312,12 @@ static struct insn *find_insn(unsigned char *code)
        case 0xc2:
                table = opcode_c2;
                break;
+       case 0xc4:
+               table = opcode_c4;
+               break;
+       case 0xc6:
+               table = opcode_c6;
+               break;
        case 0xc8:
                table = opcode_c8;
                break;
index e49e9e0c69fd88278eaa707271c18466d23f70ad..31d618a443af545db6d9c41327507261f55dbf53 100644 (file)
@@ -214,10 +214,13 @@ static __initdata struct sysinfo_3_2_2 vmms __aligned(PAGE_SIZE);
 
 static noinline __init void detect_machine_type(void)
 {
-       /* No VM information? Looks like LPAR */
-       if (stsi(&vmms, 3, 2, 2) == -ENOSYS)
+       /* Check current-configuration-level */
+       if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) {
+               S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR;
                return;
-       if (!vmms.count)
+       }
+       /* Get virtual-machine cpu information. */
+       if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count)
                return;
 
        /* Running under KVM? If not we assume z/VM */
@@ -402,8 +405,19 @@ static void __init append_to_cmdline(size_t (*ipl_data)(char *, size_t))
 
 static void __init setup_boot_command_line(void)
 {
+       int i;
+
+       /* convert arch command line to ascii */
+       for (i = 0; i < ARCH_COMMAND_LINE_SIZE; i++)
+               if (COMMAND_LINE[i] & 0x80)
+                       break;
+       if (i < ARCH_COMMAND_LINE_SIZE)
+               EBCASC(COMMAND_LINE, ARCH_COMMAND_LINE_SIZE);
+       COMMAND_LINE[ARCH_COMMAND_LINE_SIZE-1] = 0;
+
        /* copy arch command line */
-       strlcpy(boot_command_line, COMMAND_LINE, ARCH_COMMAND_LINE_SIZE);
+       strlcpy(boot_command_line, strstrip(COMMAND_LINE),
+               ARCH_COMMAND_LINE_SIZE);
 
        /* append IPL PARM data to the boot command line */
        if (MACHINE_IS_VM)
index 48215d15762b2d3d6a3be7eaf6fe509a45268567..4348f9bc5393f445221c1444b8e9a2ddfaeb486c 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 #include <asm/cache.h>
-#include <asm/lowcore.h>
 #include <asm/errno.h>
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
@@ -571,6 +570,7 @@ pgm_svcper:
        mvc     __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
        oi      __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
        TRACE_IRQS_ON
+       lm      %r2,%r6,SP_R2(%r15)     # load svc arguments
        stosm   __SF_EMPTY(%r15),0x03   # reenable interrupts
        b       BASED(sysc_do_svc)
 
index 9aff1d449b6e83c2be03275ad46cf6f3e3599a7c..29fd0f1e6ec41fba888f37d43794871bd2106f6f 100644 (file)
@@ -9,11 +9,9 @@
  *              Heiko Carstens <heiko.carstens@de.ibm.com>
  */
 
-#include <linux/sys.h>
 #include <linux/linkage.h>
 #include <linux/init.h>
 #include <asm/cache.h>
-#include <asm/lowcore.h>
 #include <asm/errno.h>
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
@@ -549,6 +547,7 @@ pgm_svcper:
        mvc     __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
        oi      __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
        TRACE_IRQS_ON
+       lmg     %r2,%r6,SP_R2(%r15)     # load svc arguments
        stosm   __SF_EMPTY(%r15),0x03   # reenable interrupts
        j       sysc_do_svc
 
index 5a82bc68193ed472b1c143e88d4f498b6fb02a99..6a83d05813171cfa2e4768fc0e9b596c92aae9d8 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <trace/syscall.h>
-#include <asm/lowcore.h>
+#include <asm/asm-offsets.h>
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 
@@ -200,13 +200,3 @@ out:
        return parent;
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-
-extern unsigned int sys_call_table[];
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-       return (unsigned long)sys_call_table[nr];
-}
-#endif
index c52b4f7742fa64cb4a82da9d5a68b8cf0ee051e2..ca4a62bd862fc8507966c1efdf64e41cae6efe20 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright IBM Corp. 1999,2009
+ * Copyright IBM Corp. 1999,2010
  *
  *    Author(s): Hartmut Penner <hp@de.ibm.com>
  *              Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
 
 #include <linux/init.h>
-#include <asm/setup.h>
-#include <asm/lowcore.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 #include <asm/page.h>
-#include <asm/cpu.h>
 
 #ifdef CONFIG_64BIT
 #define ARCH_OFFSET    4
@@ -288,19 +285,7 @@ iplstart:
        bz      .Lagain1                # skip dateset trailer
        la      %r5,0(%r4,%r2)
        lr      %r3,%r2
-.Lidebc:
-       tm      0(%r5),0x80             # high order bit set ?
-       bo      .Ldocv                  #  yes -> convert from EBCDIC
-       ahi     %r5,-1
-       bct     %r3,.Lidebc
-       b       .Lnocv
-.Ldocv:
-       l       %r3,.Lcvtab
-       tr      0(256,%r4),0(%r3)       # convert parameters to ascii
-       tr      256(256,%r4),0(%r3)
-       tr      512(256,%r4),0(%r3)
-       tr      768(122,%r4),0(%r3)
-.Lnocv: la     %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
+       la      %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
        mvc     0(256,%r3),0(%r4)
        mvc     256(256,%r3),256(%r4)
        mvc     512(256,%r3),512(%r4)
@@ -384,7 +369,6 @@ iplstart:
 .Linitrd:.long _end + 0x400000         # default address of initrd
 .Lparm:        .long  PARMAREA
 .Lstartup: .long startup
-.Lcvtab:.long  _ebcasc                 # ebcdic to ascii table
 .Lreset:.byte  0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
        .byte   0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
        .byte   0xc8,0xd6,0xd3,0xc4     # "change rdr all keep nohold"
@@ -417,13 +401,10 @@ start:
 .sk8x8:
        mvc     0(240,%r8),0(%r9)       # copy iplparms into buffer
 .gotr:
-       l       %r10,.tbl               # EBCDIC to ASCII table
-       tr      0(240,%r8),0(%r10)
        slr     %r0,%r0
        st      %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11)
        st      %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11)
        j       startup                 # continue with startup
-.tbl:  .long   _ebcasc                 # translate table
 .cmd:  .long   COMMAND_LINE            # address of command line buffer
 .parm: .long   PARMAREA
 .lowcase:
@@ -467,16 +448,15 @@ start:
 # or linload or SALIPL
 #
        .org    0x10000
-startup:basr   %r13,0                  # get base
+       .globl  startup
+startup:
+       basr    %r13,0                  # get base
 .LPG0:
        xc      0x200(256),0x200        # partially clear lowcore
        xc      0x300(256),0x300
-       l       %r1,5f-.LPG0(%r13)
-       stck    0(%r1)
-       spt     6f-.LPG0(%r13)
-       mvc     __LC_LAST_UPDATE_CLOCK(8),0(%r1)
-       mvc     __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
-       mvc     __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
+       stck    __LC_LAST_UPDATE_CLOCK
+       spt     5f-.LPG0(%r13)
+       mvc     __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
 #ifndef CONFIG_MARCH_G5
        # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
        xc      __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
@@ -494,7 +474,6 @@ startup:basr        %r13,0                  # get base
        cl      %r0,2f+12-.LPG0(%r13)
        je      3f
 1:     l       %r15,.Lstack-.LPG0(%r13)
-       ahi     %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
        ahi     %r15,-96
        la      %r2,.Lals_string-.LPG0(%r13)
        l       %r3,.Lsclp_print-.LPG0(%r13)
@@ -505,7 +484,7 @@ startup:basr        %r13,0                  # get base
 .Lsclp_print:
        .long   _sclp_print_early
 .Lstack:
-       .long   init_thread_union
+       .long   0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
        .align 16
 2:     .long   0x000a0000,0x8badcccc
 #if defined(CONFIG_64BIT)
@@ -532,13 +511,22 @@ startup:basr      %r13,0                  # get base
 3:
 #endif
 
+#ifdef CONFIG_64BIT
+       mvi     __LC_AR_MODE_ID,1       # set esame flag
+       slr     %r0,%r0                 # set cpuid to zero
+       lhi     %r1,2                   # mode 2 = esame (dump)
+       sigp    %r1,%r0,0x12            # switch to esame mode
+       sam64                           # switch to 64 bit mode
+       jg      startup_continue
+#else
+       mvi     __LC_AR_MODE_ID,0       # set ESA flag (mode 0)
        l       %r13,4f-.LPG0(%r13)
        b       0(%r13)
-       .align  4
+       .align  8
 4:     .long   startup_continue
-5:     .long   sched_clock_base_cc
+#endif
        .align  8
-6:     .long   0x7fffffff,0xffffffff
+5:     .long   0x7fffffff,0xffffffff
 
 #
 # params at 10400 (setup.h)
@@ -552,8 +540,4 @@ startup:basr        %r13,0                  # get base
        .byte   "root=/dev/ram0 ro"
        .byte   0
 
-#ifdef CONFIG_64BIT
-#include "head64.S"
-#else
-#include "head31.S"
-#endif
+       .org    0x11000
index 602b508cd4c41d3ef4792d6fbcdaae300c5aff39..1bbcc499d455c87096b84f89bab35a629a5ab388 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/s390/kernel/head31.S
  *
- * Copyright (C) IBM Corp. 2005,2006
+ * Copyright (C) IBM Corp. 2005,2010
  *
  *   Author(s):        Hartmut Penner <hp@de.ibm.com>
  *             Martin Schwidefsky <schwidefsky@de.ibm.com>
  *
  */
 
-       .org    0x11000
+#include <linux/init.h>
+#include <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+#include <asm/page.h>
 
+__HEAD
+       .globl  startup_continue
 startup_continue:
        basr    %r13,0                  # get base
 .LPG1:
 
-       mvi     __LC_AR_MODE_ID,0       # set ESA flag (mode 0)
+       l       %r1,.Lbase_cc-.LPG1(%r13)
+       mvc     0(8,%r1),__LC_LAST_UPDATE_CLOCK
        lctl    %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
        l       %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
                                        # move IPL device to lowcore
@@ -69,10 +75,12 @@ startup_continue:
 .Lduald:.rept  8
        .long   0x80000000,0,0,0        # invalid access-list entries
        .endr
+.Lbase_cc:
+       .long   sched_clock_base_cc
 
-       .org    0x12000
        .globl  _ehead
 _ehead:
+
 #ifdef CONFIG_SHARED_KERNEL
        .org    0x100000
 #endif
index d984a2a380c3ba91bcc9de5c947f70bf44e89e65..39580e768658e0b23f76587b6fb59e5c000936f1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/s390/kernel/head64.S
  *
- * Copyright (C) IBM Corp. 1999,2006
+ * Copyright (C) IBM Corp. 1999,2010
  *
  *   Author(s):        Hartmut Penner <hp@de.ibm.com>
  *             Martin Schwidefsky <schwidefsky@de.ibm.com>
  *
  */
 
-       .org    0x11000
+#include <linux/init.h>
+#include <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+#include <asm/page.h>
 
+__HEAD
+       .globl  startup_continue
 startup_continue:
-       basr    %r13,0                  # get base
-.LPG1: sll     %r13,1                  # remove high order bit
-       srl     %r13,1
-
-#ifdef CONFIG_ZFCPDUMP
-
-       # check if we have been ipled using zfcp dump:
-
-       tm      0xb9,0x01               # test if subchannel is enabled
-       jno     .nodump                 # subchannel disabled
-       l       %r1,0xb8
-       la      %r5,.Lipl_schib-.LPG1(%r13)
-       stsch   0(%r5)                  # get schib of subchannel
-       jne     .nodump                 # schib not available
-       tm      5(%r5),0x01             # devno valid?
-       jno     .nodump
-       tm      4(%r5),0x80             # qdio capable device?
-       jno     .nodump
-       l       %r2,20(%r0)             # address of ipl parameter block
-       lhi     %r3,0
-       ic      %r3,0x148(%r2)          # get opt field
-       chi     %r3,0x20                # load with dump?
-       jne     .nodump
-
-       # store all prefix registers in case of load with dump:
-
-       la      %r7,0                   # base register for 0 page
-       la      %r8,0                   # first cpu
-       l       %r11,.Lpref_arr_ptr-.LPG1(%r13) # address of prefix array
-       ahi     %r11,4                  # skip boot cpu
-       lr      %r12,%r11
-       ahi     %r12,(CONFIG_NR_CPUS*4) # end of prefix array
-       stap    .Lcurrent_cpu+2-.LPG1(%r13)     # store current cpu addr
-1:
-       cl      %r8,.Lcurrent_cpu-.LPG1(%r13)   # is ipl cpu ?
-       je      4f                              # if yes get next cpu
-2:
-       lr      %r9,%r7
-       sigp    %r9,%r8,0x9             # stop & store status of cpu
-       brc     8,3f                    # accepted
-       brc     4,4f                    # status stored: next cpu
-       brc     2,2b                    # busy:          try again
-       brc     1,4f                    # not op:        next cpu
-3:
-       mvc     0(4,%r11),264(%r7)      # copy prefix register to prefix array
-       ahi     %r11,4                  # next element in prefix array
-       clr     %r11,%r12
-       je      5f                      # no more space in prefix array
-4:
-       ahi     %r8,1                   # next cpu (r8 += 1)
-       chi     %r8,MAX_CPU_ADDRESS     # is last possible cpu ?
-       jle     1b                      # jump if not last cpu
-5:
-       lhi     %r1,2                   # mode 2 = esame (dump)
-       j       6f
-       .align 4
-.Lipl_schib:
-       .rept 13
-       .long 0
-       .endr
-.nodump:
-       lhi     %r1,1                   # mode 1 = esame (normal ipl)
-6:
-#else
-       lhi     %r1,1                   # mode 1 = esame (normal ipl)
-#endif /* CONFIG_ZFCPDUMP */
-       mvi     __LC_AR_MODE_ID,1       # set esame flag
-       slr     %r0,%r0                 # set cpuid to zero
-       sigp    %r1,%r0,0x12            # switch to esame mode
-       sam64                           # switch to 64 bit mode
-       llgfr   %r13,%r13               # clear high-order half of base reg
+       larl    %r1,sched_clock_base_cc
+       mvc     0(8,%r1),__LC_LAST_UPDATE_CLOCK
+       larl    %r13,.LPG1              # get base
        lmh     %r0,%r15,.Lzero64-.LPG1(%r13)   # clear high-order half
        lctlg   %c0,%c15,.Lctl-.LPG1(%r13)      # load control registers
        lg      %r12,.Lparmaddr-.LPG1(%r13)     # pointer to parameter area
@@ -108,6 +45,7 @@ startup_continue:
        lpswe   .Lentry-.LPG1(13)       # jump to _stext in primary-space,
                                        # virtual and never return ...
        .align  16
+.LPG1:
 .Lentry:.quad  0x0000000180000000,_stext
 .Lctl: .quad   0x04350002              # cr0: various things
        .quad   0                       # cr1: primary space segment table
@@ -130,12 +68,6 @@ startup_continue:
 .Lscan2g:.quad 0x80000000 + 0x20000 - 8        # 2GB + 128K - 8
 .Lnop: .long   0x07000700
 .Lzero64:.fill 16,4,0x0
-#ifdef CONFIG_ZFCPDUMP
-.Lcurrent_cpu:
-       .long 0x0
-.Lpref_arr_ptr:
-       .long zfcpdump_prefix_array
-#endif /* CONFIG_ZFCPDUMP */
 .Lparmaddr:
        .quad   PARMAREA
        .align  64
@@ -146,9 +78,9 @@ startup_continue:
        .long   0x80000000,0,0,0        # invalid access-list entries
        .endr
 
-       .org    0x12000
        .globl  _ehead
 _ehead:
+
 #ifdef CONFIG_SHARED_KERNEL
        .org    0x100000
 #endif
index 4d73296fed74274f96574879e48a842be7f195ae..7eedbbcb54aa5901bf989397cbaa9b405c260529 100644 (file)
@@ -553,7 +553,7 @@ out:
        return rc;
 }
 
-static void ipl_run(struct shutdown_trigger *trigger)
+static void __ipl_run(void *unused)
 {
        diag308(DIAG308_IPL, NULL);
        if (MACHINE_IS_VM)
@@ -562,6 +562,11 @@ static void ipl_run(struct shutdown_trigger *trigger)
                reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
 }
 
+static void ipl_run(struct shutdown_trigger *trigger)
+{
+       smp_switch_to_ipl_cpu(__ipl_run, NULL);
+}
+
 static int __init ipl_init(void)
 {
        int rc;
@@ -1039,7 +1044,7 @@ static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
                sprintf(dst + pos, " PARM %s", vmparm);
 }
 
-static void reipl_run(struct shutdown_trigger *trigger)
+static void __reipl_run(void *unused)
 {
        struct ccw_dev_id devid;
        static char buf[128];
@@ -1087,6 +1092,11 @@ static void reipl_run(struct shutdown_trigger *trigger)
        disabled_wait((unsigned long) __builtin_return_address(0));
 }
 
+static void reipl_run(struct shutdown_trigger *trigger)
+{
+       smp_switch_to_ipl_cpu(__reipl_run, NULL);
+}
+
 static void reipl_block_ccw_init(struct ipl_parameter_block *ipb)
 {
        ipb->hdr.len = IPL_PARM_BLK_CCW_LEN;
@@ -1369,20 +1379,18 @@ static struct kobj_attribute dump_type_attr =
 
 static struct kset *dump_kset;
 
-static void dump_run(struct shutdown_trigger *trigger)
+static void __dump_run(void *unused)
 {
        struct ccw_dev_id devid;
        static char buf[100];
 
        switch (dump_method) {
        case DUMP_METHOD_CCW_CIO:
-               smp_send_stop();
                devid.devno = dump_block_ccw->ipl_info.ccw.devno;
                devid.ssid  = 0;
                reipl_ccw_dev(&devid);
                break;
        case DUMP_METHOD_CCW_VM:
-               smp_send_stop();
                sprintf(buf, "STORE STATUS");
                __cpcmd(buf, NULL, 0, NULL);
                sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
@@ -1396,10 +1404,17 @@ static void dump_run(struct shutdown_trigger *trigger)
                diag308(DIAG308_SET, dump_block_fcp);
                diag308(DIAG308_DUMP, NULL);
                break;
-       case DUMP_METHOD_NONE:
-               return;
+       default:
+               break;
        }
-       printk(KERN_EMERG "Dump failed!\n");
+}
+
+static void dump_run(struct shutdown_trigger *trigger)
+{
+       if (dump_method == DUMP_METHOD_NONE)
+               return;
+       smp_send_stop();
+       smp_switch_to_ipl_cpu(__dump_run, NULL);
 }
 
 static int __init dump_ccw_init(void)
@@ -1577,7 +1592,7 @@ static void vmcmd_run(struct shutdown_trigger *trigger)
 static int vmcmd_init(void)
 {
        if (!MACHINE_IS_VM)
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj);
        if (!vmcmd_kset)
                return -ENOMEM;
@@ -1595,7 +1610,7 @@ static void stop_run(struct shutdown_trigger *trigger)
 {
        if (strcmp(trigger->name, ON_PANIC_STR) == 0)
                disabled_wait((unsigned long) __builtin_return_address(0));
-       while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy)
+       while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
                cpu_relax();
        for (;;);
 }
@@ -1902,7 +1917,6 @@ void __init ipl_update_parameters(void)
 void __init ipl_save_parameters(void)
 {
        struct cio_iplinfo iplinfo;
-       unsigned int *ipl_ptr;
        void *src, *dst;
 
        if (cio_get_iplinfo(&iplinfo))
@@ -1913,11 +1927,10 @@ void __init ipl_save_parameters(void)
        if (!iplinfo.is_qdio)
                return;
        ipl_flags |= IPL_PARMBLOCK_VALID;
-       ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR;
-       src = (void *)(unsigned long)*ipl_ptr;
+       src = (void *)(unsigned long)S390_lowcore.ipl_parmblock_ptr;
        dst = (void *)IPL_PARMBLOCK_ORIGIN;
        memmove(dst, src, PAGE_SIZE);
-       *ipl_ptr = IPL_PARMBLOCK_ORIGIN;
+       S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
 }
 
 static LIST_HEAD(rcall);
index 131d7ee8b416d8f6f8bb7f053c3799a3803e97ef..a922d51df6bfc6edb6b41ed044500ba6ff8729c3 100644 (file)
@@ -54,11 +54,11 @@ void machine_shutdown(void)
 {
 }
 
-void machine_kexec(struct kimage *image)
+static void __machine_kexec(void *data)
 {
        relocate_kernel_t data_mover;
+       struct kimage *image = data;
 
-       smp_send_stop();
        pfault_fini();
        s390_reset_system();
 
@@ -68,3 +68,9 @@ void machine_kexec(struct kimage *image)
        (*data_mover)(&image->head, image->start);
        for (;;);
 }
+
+void machine_kexec(struct kimage *image)
+{
+       smp_send_stop();
+       smp_switch_to_ipl_cpu(__machine_kexec, image);
+}
index 5417eb57271aed29ac041f948a27d20a9f42a25e..00b6d1d292f2a6efecf23d5abde930f89f68878b 100644 (file)
@@ -153,8 +153,6 @@ void exit_thread(void)
 
 void flush_thread(void)
 {
-       clear_used_math();
-       clear_tsk_thread_flag(current, TIF_USEDFPU);
 }
 
 void release_thread(struct task_struct *dead_task)
@@ -217,6 +215,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
        p->thread.mm_segment = get_fs();
        /* Don't copy debug registers */
        memset(&p->thread.per_info, 0, sizeof(p->thread.per_info));
+       clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
        /* Initialize per thread user and system timer values */
        ti = task_thread_info(p);
        ti->user_timer = 0;
index 13815d39f7dd2c757590c416298c71176f795f81..33fdc5a7976472831185126e419a637807e48b1d 100644 (file)
@@ -65,6 +65,7 @@ FixPerRegisters(struct task_struct *task)
 {
        struct pt_regs *regs;
        per_struct *per_info;
+       per_cr_words cr_words;
 
        regs = task_pt_regs(task);
        per_info = (per_struct *) &task->thread.per_info;
@@ -98,6 +99,13 @@ FixPerRegisters(struct task_struct *task)
                per_info->control_regs.bits.storage_alt_space_ctl = 1;
        else
                per_info->control_regs.bits.storage_alt_space_ctl = 0;
+
+       if (task == current) {
+               __ctl_store(cr_words, 9, 11);
+               if (memcmp(&cr_words, &per_info->control_regs.words,
+                          sizeof(cr_words)) != 0)
+                       __ctl_load(per_info->control_regs.words, 9, 11);
+       }
 }
 
 void user_enable_single_step(struct task_struct *task)
@@ -984,3 +992,61 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
 #endif
        return &user_s390_view;
 }
+
+static const char *gpr_names[NUM_GPRS] = {
+       "r0", "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
+       "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+};
+
+unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset)
+{
+       if (offset >= NUM_GPRS)
+               return 0;
+       return regs->gprs[offset];
+}
+
+int regs_query_register_offset(const char *name)
+{
+       unsigned long offset;
+
+       if (!name || *name != 'r')
+               return -EINVAL;
+       if (strict_strtoul(name + 1, 10, &offset))
+               return -EINVAL;
+       if (offset >= NUM_GPRS)
+               return -EINVAL;
+       return offset;
+}
+
+const char *regs_query_register_name(unsigned int offset)
+{
+       if (offset >= NUM_GPRS)
+               return NULL;
+       return gpr_names[offset];
+}
+
+static int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
+{
+       unsigned long ksp = kernel_stack_pointer(regs);
+
+       return (addr & ~(THREAD_SIZE - 1)) == (ksp & ~(THREAD_SIZE - 1));
+}
+
+/**
+ * regs_get_kernel_stack_nth() - get Nth entry of the stack
+ * @regs:pt_regs which contains kernel stack pointer.
+ * @n:stack entry number.
+ *
+ * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
+ * is specifined by @regs. If the @n th entry is NOT in the kernel stack,
+ * this returns 0.
+ */
+unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
+{
+       unsigned long addr;
+
+       addr = kernel_stack_pointer(regs) + n * sizeof(long);
+       if (!regs_within_kernel_stack(regs, addr))
+               return 0;
+       return *(unsigned long *)addr;
+}
index 2f481cc3d1c9c13bc5db45ad4987f51e4a07e9a5..cb899d9f85050864c6f17a1873270006cef8e1d4 100644 (file)
@@ -6,7 +6,7 @@
  *    Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
  */
 
-#include <asm/lowcore.h>
+#include <asm/asm-offsets.h>
 
 #
 # do_reipl_asm
index 774147824c3dc8a6643ad3d786a8e2207f7ca478..5e73dee63baaabe36a2aa8f924e7870f0bfa443e 100644 (file)
@@ -4,7 +4,7 @@
  *              Denis Joseph Barrow,
  */
 
-#include <asm/lowcore.h>
+#include <asm/asm-offsets.h>
 
 #
 # do_reipl_asm
index e27ca63076d1d1946ee5c6518d074b1cce6d0f9f..27af3bf3a0098722ca6d0bee52562a1abd27d812 100644 (file)
@@ -9,8 +9,10 @@
  */
 
 LC_EXT_NEW_PSW         = 0x58                  # addr of ext int handler
+LC_EXT_NEW_PSW_64      = 0x1b0                 # addr of ext int handler 64 bit
 LC_EXT_INT_PARAM       = 0x80                  # addr of ext int parameter
 LC_EXT_INT_CODE                = 0x86                  # addr of ext int code
+LC_AR_MODE_ID          = 0xa3
 
 #
 # Subroutine which waits synchronously until either an external interruption
@@ -30,8 +32,16 @@ _sclp_wait_int:
 .LbaseS1:
        ahi     %r15,-96                        # create stack frame
        la      %r8,LC_EXT_NEW_PSW              # register int handler
-       mvc     .LoldpswS1-.LbaseS1(8,%r13),0(%r8)
-       mvc     0(8,%r8),.LextpswS1-.LbaseS1(%r13)
+       la      %r9,.LextpswS1-.LbaseS1(%r13)
+#ifdef CONFIG_64BIT
+       tm      LC_AR_MODE_ID,1
+       jno     .Lesa1
+       la      %r8,LC_EXT_NEW_PSW_64           # register int handler 64 bit
+       la      %r9,.LextpswS1_64-.LbaseS1(%r13)
+.Lesa1:
+#endif
+       mvc     .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
+       mvc     0(16,%r8),0(%r9)
        lhi     %r6,0x0200                      # cr mask for ext int (cr0.54)
        ltr     %r2,%r2
        jz      .LsetctS1
@@ -64,15 +74,19 @@ _sclp_wait_int:
 .LtimeoutS1:
        lctl    %c0,%c0,.LctlS1-.LbaseS1(%r13)  # restore interrupt setting
        # restore old handler
-       mvc     0(8,%r8),.LoldpswS1-.LbaseS1(%r13)
+       mvc     0(16,%r8),.LoldpswS1-.LbaseS1(%r13)
        lm      %r6,%r15,120(%r15)              # restore registers
        br      %r14                            # return to caller
 
        .align  8
 .LoldpswS1:
-       .long   0, 0                            # old ext int PSW
+       .long   0, 0, 0, 0                      # old ext int PSW
 .LextpswS1:
        .long   0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
+#ifdef CONFIG_64BIT
+.LextpswS1_64:
+       .quad   0x0000000180000000, .LwaitS1    # PSW to handle ext int, 64 bit
+#endif
 .LwaitpswS1:
        .long   0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
 .LtimeS1:
@@ -250,6 +264,13 @@ _sclp_print:
 _sclp_print_early:
        stm     %r6,%r15,24(%r15)               # save registers
        ahi     %r15,-96                        # create stack frame
+#ifdef CONFIG_64BIT
+       tm      LC_AR_MODE_ID,1
+       jno     .Lesa2
+       ahi     %r15,-80
+       stmh    %r6,%r15,96(%r15)               # store upper register halves
+.Lesa2:
+#endif
        lr      %r10,%r2                        # save string pointer
        lhi     %r2,0
        bras    %r14,_sclp_setup                # enable console
@@ -262,6 +283,13 @@ _sclp_print_early:
        lhi     %r2,1
        bras    %r14,_sclp_setup                # disable console
 .LendS5:
+#ifdef CONFIG_64BIT
+       tm      LC_AR_MODE_ID,1
+       jno     .Lesa3
+       lmh     %r6,%r15,96(%r15)               # store upper register halves
+       ahi     %r15,80
+.Lesa3:
+#endif
        lm      %r6,%r15,120(%r15)              # restore registers
        br      %r14
 
index 0663287fa1b30f2c45d5cb24da59acf15608e914..77a63ae419f00c8196a5e8cc944ac6224795ad2f 100644 (file)
@@ -87,7 +87,6 @@ unsigned long elf_hwcap = 0;
 char elf_platform[ELF_PLATFORM_SIZE];
 
 struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
-volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
 
 int __initdata memory_end_set;
 unsigned long __initdata memory_end;
@@ -124,12 +123,6 @@ void __cpuinit cpu_init(void)
          */
        get_cpu_id(&S390_lowcore.cpu_id);
 
-        /*
-         * Force FPU initialization:
-         */
-        clear_thread_flag(TIF_USEDFPU);
-        clear_used_math();
-
        atomic_inc(&init_mm.mm_count);
        current->active_mm = &init_mm;
        BUG_ON(current->mm);
@@ -403,15 +396,12 @@ static void __init
 setup_lowcore(void)
 {
        struct _lowcore *lc;
-       int lc_pages;
 
        /*
         * Setup lowcore for boot cpu
         */
-       lc_pages = sizeof(void *) == 8 ? 2 : 1;
-       lc = (struct _lowcore *)
-               __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
-       memset(lc, 0, lc_pages * PAGE_SIZE);
+       BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
+       lc = __alloc_bootmem(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
        lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
        lc->restart_psw.addr =
                PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
@@ -811,7 +801,7 @@ setup_arch(char **cmdline_p)
        if (MACHINE_IS_VM)
                pr_info("Linux is running as a z/VM "
                        "guest operating system in 31-bit mode\n");
-       else
+       else if (MACHINE_IS_LPAR)
                pr_info("Linux is running natively in 31-bit mode\n");
        if (MACHINE_HAS_IEEE)
                pr_info("The hardware system has IEEE compatible "
@@ -825,7 +815,7 @@ setup_arch(char **cmdline_p)
                        "guest operating system in 64-bit mode\n");
        else if (MACHINE_IS_KVM)
                pr_info("Linux is running under KVM in 64-bit mode\n");
-       else
+       else if (MACHINE_IS_LPAR)
                pr_info("Linux is running natively in 64-bit mode\n");
 #endif /* CONFIG_64BIT */
 
@@ -855,7 +845,6 @@ setup_arch(char **cmdline_p)
        setup_lowcore();
 
         cpu_init();
-       __cpu_logical_map[0] = stap();
        s390_init_cpu_topology();
 
        /*
index 6b4fef877f9d0ccf0fd28ea654b9553ab3b70df9..6289945562b01d4278bea7286ded246eb13efe3c 100644 (file)
@@ -64,7 +64,7 @@ SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
-       current->state = TASK_INTERRUPTIBLE;
+       set_current_state(TASK_INTERRUPTIBLE);
        schedule();
        set_thread_flag(TIF_RESTORE_SIGMASK);
 
@@ -499,19 +499,11 @@ void do_signal(struct pt_regs *regs)
                        if (test_thread_flag(TIF_RESTORE_SIGMASK))
                                clear_thread_flag(TIF_RESTORE_SIGMASK);
 
-                       /*
-                        * If we would have taken a single-step trap
-                        * for a normal instruction, act like we took
-                        * one for the handler setup.
-                        */
-                       if (current->thread.per_info.single_step)
-                               set_thread_flag(TIF_SINGLE_STEP);
-
                        /*
                         * Let tracing know that we've done the handler setup.
                         */
                        tracehook_signal_handler(signr, &info, &ka, regs,
-                                        test_thread_flag(TIF_SINGLE_STEP));
+                                       current->thread.per_info.single_step);
                }
                return;
        }
index 93e52039321b1f6bcb2a89c335c3c9b4ef1c1104..8b10127c00ada4e69e85ac9e8617a5380c853e32 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/cpu.h>
 #include <linux/timex.h>
 #include <linux/bootmem.h>
+#include <asm/asm-offsets.h>
 #include <asm/ipl.h>
 #include <asm/setup.h>
 #include <asm/sigp.h>
@@ -52,6 +53,9 @@
 #include <asm/cpu.h>
 #include "entry.h"
 
+/* logical cpu to cpu address */
+unsigned short __cpu_logical_map[NR_CPUS];
+
 static struct task_struct *current_set[NR_CPUS];
 
 static u8 smp_cpu_type;
@@ -69,13 +73,13 @@ static int cpu_management;
 
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
-static void smp_ext_bitcall(int, ec_bit_sig);
+static void smp_ext_bitcall(int, int);
 
-static int cpu_stopped(int cpu)
+static int raw_cpu_stopped(int cpu)
 {
-       __u32 status;
+       u32 status;
 
-       switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
+       switch (raw_sigp_ps(&status, 0, cpu, sigp_sense)) {
        case sigp_status_stored:
                /* Check for stopped and check stop state */
                if (status & 0x50)
@@ -87,6 +91,44 @@ static int cpu_stopped(int cpu)
        return 0;
 }
 
+static inline int cpu_stopped(int cpu)
+{
+       return raw_cpu_stopped(cpu_logical_map(cpu));
+}
+
+void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
+{
+       struct _lowcore *lc, *current_lc;
+       struct stack_frame *sf;
+       struct pt_regs *regs;
+       unsigned long sp;
+
+       if (smp_processor_id() == 0)
+               func(data);
+       __load_psw_mask(PSW_BASE_BITS | PSW_DEFAULT_KEY);
+       /* Disable lowcore protection */
+       __ctl_clear_bit(0, 28);
+       current_lc = lowcore_ptr[smp_processor_id()];
+       lc = lowcore_ptr[0];
+       if (!lc)
+               lc = current_lc;
+       lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
+       lc->restart_psw.addr = PSW_ADDR_AMODE | (unsigned long) smp_restart_cpu;
+       if (!cpu_online(0))
+               smp_switch_to_cpu(func, data, 0, stap(), __cpu_logical_map[0]);
+       while (sigp(0, sigp_stop_and_store_status) == sigp_busy)
+               cpu_relax();
+       sp = lc->panic_stack;
+       sp -= sizeof(struct pt_regs);
+       regs = (struct pt_regs *) sp;
+       memcpy(&regs->gprs, &current_lc->gpregs_save_area, sizeof(regs->gprs));
+       regs->psw = lc->psw_save_area;
+       sp -= STACK_FRAME_OVERHEAD;
+       sf = (struct stack_frame *) sp;
+       sf->back_chain = regs->gprs[15];
+       smp_switch_to_cpu(func, data, sp, stap(), __cpu_logical_map[0]);
+}
+
 void smp_send_stop(void)
 {
        int cpu, rc;
@@ -100,7 +142,7 @@ void smp_send_stop(void)
                if (cpu == smp_processor_id())
                        continue;
                do {
-                       rc = signal_processor(cpu, sigp_stop);
+                       rc = sigp(cpu, sigp_stop);
                } while (rc == sigp_busy);
 
                while (!cpu_stopped(cpu))
@@ -136,13 +178,13 @@ static void do_ext_call_interrupt(__u16 code)
  * Send an external call sigp to another cpu and return without waiting
  * for its completion.
  */
-static void smp_ext_bitcall(int cpu, ec_bit_sig sig)
+static void smp_ext_bitcall(int cpu, int sig)
 {
        /*
         * Set signaling bit in lowcore of target cpu and kick it
         */
        set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
-       while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy)
+       while (sigp(cpu, sigp_emergency_signal) == sigp_busy)
                udelay(10);
 }
 
@@ -236,24 +278,8 @@ void smp_ctl_clear_bit(int cr, int bit)
 }
 EXPORT_SYMBOL(smp_ctl_clear_bit);
 
-/*
- * In early ipl state a temp. logically cpu number is needed, so the sigp
- * functions can be used to sense other cpus. Since NR_CPUS is >= 2 on
- * CONFIG_SMP and the ipl cpu is logical cpu 0, it must be 1.
- */
-#define CPU_INIT_NO    1
-
 #ifdef CONFIG_ZFCPDUMP
 
-/*
- * zfcpdump_prefix_array holds prefix registers for the following scenario:
- * 64 bit zfcpdump kernel and 31 bit kernel which is to be dumped. We have to
- * save its prefix registers, since they get lost, when switching from 31 bit
- * to 64 bit.
- */
-unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \
-       __attribute__((__section__(".data")));
-
 static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
 {
        if (ipl_info.type != IPL_TYPE_FCP_DUMP)
@@ -263,21 +289,15 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
                           "the dump\n", cpu, NR_CPUS - 1);
                return;
        }
-       zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL);
-       __cpu_logical_map[CPU_INIT_NO] = (__u16) phy_cpu;
-       while (signal_processor(CPU_INIT_NO, sigp_stop_and_store_status) ==
-              sigp_busy)
+       zfcpdump_save_areas[cpu] = kmalloc(sizeof(struct save_area), GFP_KERNEL);
+       while (raw_sigp(phy_cpu, sigp_stop_and_store_status) == sigp_busy)
                cpu_relax();
        memcpy(zfcpdump_save_areas[cpu],
               (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE,
-              SAVE_AREA_SIZE);
-#ifdef CONFIG_64BIT
-       /* copy original prefix register */
-       zfcpdump_save_areas[cpu]->s390x.pref_reg = zfcpdump_prefix_array[cpu];
-#endif
+              sizeof(struct save_area));
 }
 
-union save_area *zfcpdump_save_areas[NR_CPUS + 1];
+struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
 EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
 
 #else
@@ -386,8 +406,7 @@ static void __init smp_detect_cpus(void)
                for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) {
                        if (cpu == boot_cpu_addr)
                                continue;
-                       __cpu_logical_map[CPU_INIT_NO] = cpu;
-                       if (!cpu_stopped(CPU_INIT_NO))
+                       if (!raw_cpu_stopped(cpu))
                                continue;
                        smp_get_save_area(c_cpus, cpu);
                        c_cpus++;
@@ -410,8 +429,7 @@ static void __init smp_detect_cpus(void)
                cpu_addr = info->cpu[cpu].address;
                if (cpu_addr == boot_cpu_addr)
                        continue;
-               __cpu_logical_map[CPU_INIT_NO] = cpu_addr;
-               if (!cpu_stopped(CPU_INIT_NO)) {
+               if (!raw_cpu_stopped(cpu_addr)) {
                        s_cpus++;
                        continue;
                }
@@ -530,18 +548,18 @@ static void smp_free_lowcore(int cpu)
 /* Upping and downing of CPUs */
 int __cpuinit __cpu_up(unsigned int cpu)
 {
-       struct task_struct *idle;
        struct _lowcore *cpu_lowcore;
+       struct task_struct *idle;
        struct stack_frame *sf;
-       sigp_ccode ccode;
        u32 lowcore;
+       int ccode;
 
        if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED)
                return -EIO;
        if (smp_alloc_lowcore(cpu))
                return -ENOMEM;
        do {
-               ccode = signal_processor(cpu, sigp_initial_cpu_reset);
+               ccode = sigp(cpu, sigp_initial_cpu_reset);
                if (ccode == sigp_busy)
                        udelay(10);
                if (ccode == sigp_not_operational)
@@ -549,7 +567,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
        } while (ccode == sigp_busy);
 
        lowcore = (u32)(unsigned long)lowcore_ptr[cpu];
-       while (signal_processor_p(lowcore, cpu, sigp_set_prefix) == sigp_busy)
+       while (sigp_p(lowcore, cpu, sigp_set_prefix) == sigp_busy)
                udelay(10);
 
        idle = current_set[cpu];
@@ -575,7 +593,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
        cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func;
        eieio();
 
-       while (signal_processor(cpu, sigp_restart) == sigp_busy)
+       while (sigp(cpu, sigp_restart) == sigp_busy)
                udelay(10);
 
        while (!cpu_online(cpu))
@@ -637,7 +655,7 @@ void __cpu_die(unsigned int cpu)
        /* Wait until target cpu is down */
        while (!cpu_stopped(cpu))
                cpu_relax();
-       while (signal_processor_p(0, cpu, sigp_set_prefix) == sigp_busy)
+       while (sigp_p(0, cpu, sigp_set_prefix) == sigp_busy)
                udelay(10);
        smp_free_lowcore(cpu);
        pr_info("Processor %d stopped\n", cpu);
@@ -646,7 +664,7 @@ void __cpu_die(unsigned int cpu)
 void cpu_die(void)
 {
        idle_task_exit();
-       while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy)
+       while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
                cpu_relax();
        for (;;);
 }
@@ -717,6 +735,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
 {
 }
 
+void __init smp_setup_processor_id(void)
+{
+       S390_lowcore.cpu_nr = 0;
+       __cpu_logical_map[0] = stap();
+}
+
 /*
  * the frequency of the profiling timer can be changed
  * by writing a multiplier value into /proc/profile.
@@ -756,7 +780,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev,
        get_online_cpus();
        mutex_lock(&smp_cpu_state_mutex);
        rc = -EBUSY;
-       if (cpu_online(cpu))
+       /* disallow configuration changes of online cpus and cpu 0 */
+       if (cpu_online(cpu) || cpu == 0)
                goto out;
        rc = 0;
        switch (val) {
diff --git a/arch/s390/kernel/switch_cpu.S b/arch/s390/kernel/switch_cpu.S
new file mode 100644 (file)
index 0000000..469f11b
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 31-bit switch cpu code
+ *
+ * Copyright IBM Corp. 2009
+ *
+ */
+
+#include <asm/asm-offsets.h>
+#include <asm/ptrace.h>
+
+# smp_switch_to_cpu switches to destination cpu and executes the passed function
+# Parameter: %r2 - function to call
+#           %r3 - function parameter
+#           %r4 - stack poiner
+#           %r5 - current cpu
+#           %r6 - destination cpu
+
+       .section .text
+       .align 4
+       .globl smp_switch_to_cpu
+smp_switch_to_cpu:
+       stm     %r6,%r15,__SF_GPRS(%r15)
+       lr      %r1,%r15
+       ahi     %r15,-STACK_FRAME_OVERHEAD
+       st      %r1,__SF_BACKCHAIN(%r15)
+       basr    %r13,0
+0:     la      %r1,.gprregs_addr-0b(%r13)
+       l       %r1,0(%r1)
+       stm     %r0,%r15,0(%r1)
+1:     sigp    %r0,%r6,__SIGP_RESTART  /* start destination CPU */
+       brc     2,1b                    /* busy, try again */
+2:     sigp    %r0,%r5,__SIGP_STOP     /* stop current CPU */
+       brc     2,2b                    /* busy, try again */
+3:     j       3b
+
+       .globl  smp_restart_cpu
+smp_restart_cpu:
+       basr    %r13,0
+0:     la      %r1,.gprregs_addr-0b(%r13)
+       l       %r1,0(%r1)
+       lm      %r0,%r15,0(%r1)
+1:     sigp    %r0,%r5,__SIGP_SENSE    /* Wait for calling CPU */
+       brc     10,1b                   /* busy, accepted (status 0), running */
+       tmll    %r0,0x40                /* Test if calling CPU is stopped */
+       jz      1b
+       ltr     %r4,%r4                 /* New stack ? */
+       jz      1f
+       lr      %r15,%r4
+1:     basr    %r14,%r2
+
+.gprregs_addr:
+       .long   .gprregs
+
+       .section .data,"aw",@progbits
+.gprregs:
+       .rept   16
+       .long   0
+       .endr
diff --git a/arch/s390/kernel/switch_cpu64.S b/arch/s390/kernel/switch_cpu64.S
new file mode 100644 (file)
index 0000000..d94aacc
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 64-bit switch cpu code
+ *
+ * Copyright IBM Corp. 2009
+ *
+ */
+
+#include <asm/asm-offsets.h>
+#include <asm/ptrace.h>
+
+# smp_switch_to_cpu switches to destination cpu and executes the passed function
+# Parameter: %r2 - function to call
+#           %r3 - function parameter
+#           %r4 - stack poiner
+#           %r5 - current cpu
+#           %r6 - destination cpu
+
+       .section .text
+       .align 4
+       .globl smp_switch_to_cpu
+smp_switch_to_cpu:
+       stmg    %r6,%r15,__SF_GPRS(%r15)
+       lgr     %r1,%r15
+       aghi    %r15,-STACK_FRAME_OVERHEAD
+       stg     %r1,__SF_BACKCHAIN(%r15)
+       larl    %r1,.gprregs
+       stmg    %r0,%r15,0(%r1)
+1:     sigp    %r0,%r6,__SIGP_RESTART  /* start destination CPU */
+       brc     2,1b                    /* busy, try again */
+2:     sigp    %r0,%r5,__SIGP_STOP     /* stop current CPU */
+       brc     2,2b                    /* busy, try again */
+3:     j       3b
+
+       .globl  smp_restart_cpu
+smp_restart_cpu:
+       larl    %r1,.gprregs
+       lmg     %r0,%r15,0(%r1)
+1:     sigp    %r0,%r5,__SIGP_SENSE    /* Wait for calling CPU */
+       brc     10,1b                   /* busy, accepted (status 0), running */
+       tmll    %r0,0x40                /* Test if calling CPU is stopped */
+       jz      1b
+       ltgr    %r4,%r4                 /* New stack ? */
+       jz      1f
+       lgr     %r15,%r4
+1:     basr    %r14,%r2
+
+       .section .data,"aw",@progbits
+.gprregs:
+       .rept   16
+       .quad   0
+       .endr
index 0c26cc1898ec68a96e4b176be0eeff29bff57882..b354427e03b7508a1454385d6a53518f1f7e07e3 100644 (file)
@@ -176,7 +176,7 @@ pgm_check_entry:
        cgr     %r1,%r2
        je      restore_registers               /* r1 = r2 -> nothing to do */
        larl    %r4,.Lrestart_suspend_psw       /* Set new restart PSW */
-       mvc     __LC_RESTART_PSW(16,%r0),0(%r4)
+       mvc     __LC_RST_NEW_PSW(16,%r0),0(%r4)
 3:
        sigp    %r9,%r1,__SIGP_INITIAL_CPU_RESET
        brc     8,4f    /* accepted */
index 4f292c936872dbed56e0f82cc57184809c3b4321..30eca070d4268953d209b54394c99806afced91e 100644 (file)
@@ -340,4 +340,3 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
 SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
 SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
-SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper)
index 65065ac48ed36eeedb0c943c0cd6a9e154506825..a8f93f1705aded37002e654bcf85c485335d1995 100644 (file)
 #define USECS_PER_JIFFY     ((unsigned long) 1000000/HZ)
 #define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
 
-/*
- * Create a small time difference between the timer interrupts
- * on the different cpus to avoid lock contention.
- */
-#define CPU_DEVIATION       (smp_processor_id() << 12)
-
-#define TICK_SIZE tick
-
 u64 sched_clock_base_cc = -1;  /* Force to data section. */
 EXPORT_SYMBOL_GPL(sched_clock_base_cc);
 
index 3c72c9cf22b68f8f40a6b68d0da1972b9c112bf1..14ef6f05e4324b94f7146f0207e9203aa9a62df5 100644 (file)
@@ -114,7 +114,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core)
 
                rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin;
                for_each_present_cpu(lcpu) {
-                       if (__cpu_logical_map[lcpu] == rcpu) {
+                       if (cpu_logical_map(lcpu) == rcpu) {
                                cpu_set(lcpu, core->mask);
                                smp_cpu_polarization[lcpu] = tl_cpu->pp;
                        }
index 5f99e66c51c36d2d2843bcfb90a01b7cf99cb8be..6bc9c197aa9130b6ae2a0d922c387b030642c748 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/security.h>
 #include <linux/bootmem.h>
 #include <linux/compat.h>
+#include <asm/asm-offsets.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
 #include <asm/processor.h>
index 8300309698fa3abce3b9b84a5884aba432c372fe..9e4c84187cf504fc0fdffed9afb80ce3a393b05a 100644 (file)
@@ -39,7 +39,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
                vcpu->run->s390_reset_flags = 0;
                break;
        default:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
@@ -62,6 +62,6 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
        case 0x308:
                return __diag_ipl_functions(vcpu);
        default:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 }
index ba9d8a7bc1ac93d6b41fff692ec4f3e3b2e30e9d..3ddc30895e31f8bb9a3d87ff40fd357c671edb21 100644 (file)
@@ -32,7 +32,7 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
 
        vcpu->stat.instruction_lctlg++;
        if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f)
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        useraddr = disp2;
        if (base2)
@@ -138,7 +138,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
                rc = __kvm_s390_vcpu_store_status(vcpu,
                                                  KVM_S390_STORE_STATUS_NOADDR);
                if (rc >= 0)
-                       rc = -ENOTSUPP;
+                       rc = -EOPNOTSUPP;
        }
 
        if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) {
@@ -150,7 +150,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
        if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
                vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP;
                VCPU_EVENT(vcpu, 3, "%s", "cpu stopped");
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
        }
 
        spin_unlock_bh(&vcpu->arch.local_int.lock);
@@ -171,9 +171,9 @@ static int handle_validity(struct kvm_vcpu *vcpu)
                         2*PAGE_SIZE);
                if (rc)
                        /* user will receive sigsegv, exit to user */
-                       rc = -ENOTSUPP;
+                       rc = -EOPNOTSUPP;
        } else
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
 
        if (rc)
                VCPU_EVENT(vcpu, 2, "unhandled validity intercept code %d",
@@ -189,7 +189,7 @@ static int handle_instruction(struct kvm_vcpu *vcpu)
        handler = instruction_handlers[vcpu->arch.sie_block->ipa >> 8];
        if (handler)
                return handler(vcpu);
-       return -ENOTSUPP;
+       return -EOPNOTSUPP;
 }
 
 static int handle_prog(struct kvm_vcpu *vcpu)
@@ -206,14 +206,14 @@ static int handle_instruction_and_prog(struct kvm_vcpu *vcpu)
        rc = handle_instruction(vcpu);
        rc2 = handle_prog(vcpu);
 
-       if (rc == -ENOTSUPP)
+       if (rc == -EOPNOTSUPP)
                vcpu->arch.sie_block->icptcode = 0x04;
        if (rc)
                return rc;
        return rc2;
 }
 
-static const intercept_handler_t intercept_funcs[0x48 >> 2] = {
+static const intercept_handler_t intercept_funcs[] = {
        [0x00 >> 2] = handle_noop,
        [0x04 >> 2] = handle_instruction,
        [0x08 >> 2] = handle_prog,
@@ -230,10 +230,10 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
        intercept_handler_t func;
        u8 code = vcpu->arch.sie_block->icptcode;
 
-       if (code & 3 || code > 0x48)
-               return -ENOTSUPP;
+       if (code & 3 || (code >> 2) >= ARRAY_SIZE(intercept_funcs))
+               return -EOPNOTSUPP;
        func = intercept_funcs[code >> 2];
        if (func)
                return func(vcpu);
-       return -ENOTSUPP;
+       return -EOPNOTSUPP;
 }
index 43486c2408e1c571c1b933d1105f23dd06e2e2db..834774d8d5f3021c3867c6385a6754abbec04410 100644 (file)
  *    Author(s): Carsten Otte <cotte@de.ibm.com>
  */
 
-#include <asm/lowcore.h>
-#include <asm/uaccess.h>
-#include <linux/hrtimer.h>
 #include <linux/interrupt.h>
 #include <linux/kvm_host.h>
+#include <linux/hrtimer.h>
 #include <linux/signal.h>
+#include <asm/asm-offsets.h>
+#include <asm/uaccess.h>
 #include "kvm-s390.h"
 #include "gaccess.h"
 
@@ -187,8 +187,8 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
                if (rc == -EFAULT)
                        exception = 1;
 
-               rc = put_guest_u64(vcpu, __LC_PFAULT_INTPARM,
-                       inti->ext.ext_params2);
+               rc = put_guest_u64(vcpu, __LC_EXT_PARAMS2,
+                                  inti->ext.ext_params2);
                if (rc == -EFAULT)
                        exception = 1;
                break;
@@ -342,7 +342,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
        if (psw_interrupts_disabled(vcpu)) {
                VCPU_EVENT(vcpu, 3, "%s", "disabled wait");
                __unset_cpu_idle(vcpu);
-               return -ENOTSUPP; /* disabled wait */
+               return -EOPNOTSUPP; /* disabled wait */
        }
 
        if (psw_extint_disabled(vcpu) ||
index f8bcaefd7d3458bec798afc96ccd76f4e2eb2d06..3fa0a10e4668f1ec5df6b0a892ba11b4131cd7c9 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/timer.h>
+#include <asm/asm-offsets.h>
 #include <asm/lowcore.h>
 #include <asm/pgtable.h>
 #include <asm/nmi.h>
@@ -543,7 +544,7 @@ rerun_vcpu:
                rc = -EINTR;
        }
 
-       if (rc == -ENOTSUPP) {
+       if (rc == -EOPNOTSUPP) {
                /* intercept cannot be handled in-kernel, prepare kvm-run */
                kvm_run->exit_reason         = KVM_EXIT_S390_SIEIC;
                kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
@@ -603,45 +604,45 @@ int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
        } else
                prefix = 0;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, fp_regs),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
                        vcpu->arch.guest_fpregs.fprs, 128, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, gp_regs),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, gp_regs),
                        vcpu->arch.guest_gprs, 128, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, psw),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, psw),
                        &vcpu->arch.sie_block->gpsw, 16, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, pref_reg),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, pref_reg),
                        &vcpu->arch.sie_block->prefix, 4, prefix))
                return -EFAULT;
 
        if (__guestcopy(vcpu,
-                       addr + offsetof(struct save_area_s390x, fp_ctrl_reg),
+                       addr + offsetof(struct save_area, fp_ctrl_reg),
                        &vcpu->arch.guest_fpregs.fpc, 4, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, tod_reg),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, tod_reg),
                        &vcpu->arch.sie_block->todpr, 4, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, timer),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, timer),
                        &vcpu->arch.sie_block->cputm, 8, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, clk_cmp),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, clk_cmp),
                        &vcpu->arch.sie_block->ckc, 8, prefix))
                return -EFAULT;
 
-       if (__guestcopy(vcpu, addr + offsetof(struct save_area_s390x, acc_regs),
+       if (__guestcopy(vcpu, addr + offsetof(struct save_area, acc_regs),
                        &vcpu->arch.guest_acrs, 64, prefix))
                return -EFAULT;
 
        if (__guestcopy(vcpu,
-                       addr + offsetof(struct save_area_s390x, ctrl_regs),
+                       addr + offsetof(struct save_area, ctrl_regs),
                        &vcpu->arch.sie_block->gcr, 128, prefix))
                return -EFAULT;
        return 0;
index d426aac8095de3552177158bc88fa72e1ef9a82e..28c55677eb399c33f472a564d596666f01bcedd3 100644 (file)
@@ -323,5 +323,5 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
                else
                        return handler(vcpu);
        }
-       return -ENOTSUPP;
+       return -EOPNOTSUPP;
 }
index 15ee1111de58facc30bc852df866aac3c69e46af..241a48459b666fab172d376ddfda2da4562145ad 100644 (file)
@@ -172,7 +172,7 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter)
                rc = 0; /* order accepted */
                break;
        default:
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
        }
        return rc;
 }
@@ -293,7 +293,7 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
                vcpu->stat.instruction_sigp_restart++;
                /* user space must know about restart */
        default:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        if (rc < 0)
index 97975ec7a27471253a8da274af72d14a16e9f171..cd54a1c352afece8f14ab2b6355af070c328d843 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for s390-specific library files..
 #
 
-lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
+lib-y += delay.o string.o uaccess_std.o uaccess_pt.o usercopy.o
 obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o
 lib-$(CONFIG_64BIT) += uaccess_mvcos.o
 lib-$(CONFIG_SMP) += spinlock.o
index 10754a3756684900ea1570cc1c21b5d6bc800240..91754ffb9203a79fc3d7005d3cf8d80905ceb1d3 100644 (file)
@@ -34,7 +34,7 @@ static inline void _raw_yield_cpu(int cpu)
 {
        if (MACHINE_HAS_DIAG9C)
                asm volatile("diag %0,0,0x9c"
-                            : : "d" (__cpu_logical_map[cpu]));
+                            : : "d" (cpu_logical_map(cpu)));
        else
                _raw_yield();
 }
@@ -43,16 +43,24 @@ void arch_spin_lock_wait(arch_spinlock_t *lp)
 {
        int count = spin_retry;
        unsigned int cpu = ~smp_processor_id();
+       unsigned int owner;
 
        while (1) {
-               if (count-- <= 0) {
-                       unsigned int owner = lp->owner_cpu;
-                       if (owner != 0)
-                               _raw_yield_cpu(~owner);
-                       count = spin_retry;
+               owner = lp->owner_cpu;
+               if (!owner || smp_vcpu_scheduled(~owner)) {
+                       for (count = spin_retry; count > 0; count--) {
+                               if (arch_spin_is_locked(lp))
+                                       continue;
+                               if (_raw_compare_and_swap(&lp->owner_cpu, 0,
+                                                         cpu) == 0)
+                                       return;
+                       }
+                       if (MACHINE_IS_LPAR)
+                               continue;
                }
-               if (arch_spin_is_locked(lp))
-                       continue;
+               owner = lp->owner_cpu;
+               if (owner)
+                       _raw_yield_cpu(~owner);
                if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
                        return;
        }
@@ -63,17 +71,27 @@ void arch_spin_lock_wait_flags(arch_spinlock_t *lp, unsigned long flags)
 {
        int count = spin_retry;
        unsigned int cpu = ~smp_processor_id();
+       unsigned int owner;
 
        local_irq_restore(flags);
        while (1) {
-               if (count-- <= 0) {
-                       unsigned int owner = lp->owner_cpu;
-                       if (owner != 0)
-                               _raw_yield_cpu(~owner);
-                       count = spin_retry;
+               owner = lp->owner_cpu;
+               if (!owner || smp_vcpu_scheduled(~owner)) {
+                       for (count = spin_retry; count > 0; count--) {
+                               if (arch_spin_is_locked(lp))
+                                       continue;
+                               local_irq_disable();
+                               if (_raw_compare_and_swap(&lp->owner_cpu, 0,
+                                                         cpu) == 0)
+                                       return;
+                               local_irq_restore(flags);
+                       }
+                       if (MACHINE_IS_LPAR)
+                               continue;
                }
-               if (arch_spin_is_locked(lp))
-                       continue;
+               owner = lp->owner_cpu;
+               if (owner)
+                       _raw_yield_cpu(~owner);
                local_irq_disable();
                if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
                        return;
@@ -100,8 +118,11 @@ EXPORT_SYMBOL(arch_spin_trylock_retry);
 void arch_spin_relax(arch_spinlock_t *lock)
 {
        unsigned int cpu = lock->owner_cpu;
-       if (cpu != 0)
-               _raw_yield_cpu(~cpu);
+       if (cpu != 0) {
+               if (MACHINE_IS_VM || MACHINE_IS_KVM ||
+                   !smp_vcpu_scheduled(~cpu))
+                       _raw_yield_cpu(~cpu);
+       }
 }
 EXPORT_SYMBOL(arch_spin_relax);
 
diff --git a/arch/s390/lib/usercopy.c b/arch/s390/lib/usercopy.c
new file mode 100644 (file)
index 0000000..14b363f
--- /dev/null
@@ -0,0 +1,8 @@
+#include <linux/module.h>
+#include <linux/bug.h>
+
+void copy_from_user_overflow(void)
+{
+       WARN(1, "Buffer overflow detected!\n");
+}
+EXPORT_SYMBOL(copy_from_user_overflow);
index 5c8457129603233e020c6799101360707f51354c..6409fd57eb049c837bd9693db08e835908121c99 100644 (file)
@@ -309,7 +309,7 @@ query_segment_type (struct dcss_segment *seg)
        }
 #endif
        if (qout->segcnt > 6) {
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
                goto out_free;
        }
 
@@ -324,11 +324,11 @@ query_segment_type (struct dcss_segment *seg)
                for (i=0; i<qout->segcnt; i++) {
                        if (((qout->range[i].start & 0xff) != SEG_TYPE_EW) &&
                            ((qout->range[i].start & 0xff) != SEG_TYPE_EN)) {
-                               rc = -ENOTSUPP;
+                               rc = -EOPNOTSUPP;
                                goto out_free;
                        }
                        if (start != qout->range[i].start >> PAGE_SHIFT) {
-                               rc = -ENOTSUPP;
+                               rc = -EOPNOTSUPP;
                                goto out_free;
                        }
                        start = (qout->range[i].end >> PAGE_SHIFT) + 1;
@@ -357,7 +357,7 @@ query_segment_type (struct dcss_segment *seg)
  * -ENOSYS  : we are not running on VM
  * -EIO     : could not perform query diagnose
  * -ENOENT  : no such segment
- * -ENOTSUPP: multi-part segment cannot be used with linux
+ * -EOPNOTSUPP: multi-part segment cannot be used with linux
  * -ENOMEM  : out of memory
  * 0 .. 6   : type of segment as defined in include/asm-s390/extmem.h
  */
@@ -515,7 +515,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
  * -ENOSYS  : we are not running on VM
  * -EIO     : could not perform query or load diagnose
  * -ENOENT  : no such segment
- * -ENOTSUPP: multi-part segment cannot be used with linux
+ * -EOPNOTSUPP: multi-part segment cannot be used with linux
  * -ENOSPC  : segment cannot be used (overlaps with storage)
  * -EBUSY   : segment can temporarily not be used (overlaps with dcss)
  * -ERANGE  : segment cannot be used (exceeds kernel mapping range)
@@ -742,7 +742,7 @@ void segment_warning(int rc, char *seg_name)
                pr_err("Loading or querying DCSS %s resulted in a "
                       "hardware error\n", seg_name);
                break;
-       case -ENOTSUPP:
+       case -EOPNOTSUPP:
                pr_err("DCSS %s has multiple page ranges and cannot be "
                       "loaded or queried\n", seg_name);
                break;
index fc102e70d9c2be1a7d8d6a79d00df0de1c83f739..3040d7c78fe083768451e7ca4da99483cba59ce3 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/kprobes.h>
 #include <linux/uaccess.h>
 #include <linux/hugetlb.h>
+#include <asm/asm-offsets.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
 #include <asm/s390_ext.h>
@@ -59,15 +60,13 @@ static inline int notify_page_fault(struct pt_regs *regs)
 {
        int ret = 0;
 
-#ifdef CONFIG_KPROBES
        /* kprobe_running() needs smp_processor_id() */
-       if (!user_mode(regs)) {
+       if (kprobes_built_in() && !user_mode(regs)) {
                preempt_disable();
                if (kprobe_running() && kprobe_fault_handler(regs, 14))
                        ret = 1;
                preempt_enable();
        }
-#endif
        return ret;
 }
 
index 76564795222161d882c90d08899f6ecce905969b..d5865e4024cebb6f6c6e295f95b34096484e07a7 100644 (file)
@@ -143,33 +143,34 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
 }
 #endif
 
-void free_initmem(void)
+void free_init_pages(char *what, unsigned long begin, unsigned long end)
 {
-        unsigned long addr;
+       unsigned long addr = begin;
 
-        addr = (unsigned long)(&__init_begin);
-        for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
+       if (begin >= end)
+               return;
+       for (; addr < end; addr += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(addr));
                init_page_count(virt_to_page(addr));
-               memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
+               memset((void *)(addr & PAGE_MASK), POISON_FREE_INITMEM,
+                      PAGE_SIZE);
                free_page(addr);
                totalram_pages++;
-        }
-        printk ("Freeing unused kernel memory: %ldk freed\n",
-               ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10);
+       }
+       printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
+}
+
+void free_initmem(void)
+{
+       free_init_pages("unused kernel memory",
+                       (unsigned long)&__init_begin,
+                       (unsigned long)&__init_end);
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-        if (start < end)
-                printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
-        for (; start < end; start += PAGE_SIZE) {
-                ClearPageReserved(virt_to_page(start));
-                init_page_count(virt_to_page(start));
-                free_page(start);
-                totalram_pages++;
-        }
+       free_init_pages("initrd memory", start, end);
 }
 #endif
 
index f4558ccf02b9cd266ad005cb2925a2dfa5d7ea89..869efbaed3eadf76db6c90de2bd75550fb630bf6 100644 (file)
@@ -40,7 +40,7 @@
 
 static inline unsigned long mmap_base(void)
 {
-       unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+       unsigned long gap = rlimit(RLIMIT_STACK);
 
        if (gap < MIN_GAP)
                gap = MIN_GAP;
@@ -61,7 +61,7 @@ static inline int mmap_is_legacy(void)
 #endif
        return sysctl_legacy_va_layout ||
            (current->personality & ADDR_COMPAT_LAYOUT) ||
-           current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY;
+           rlimit(RLIMIT_STACK) == RLIM_INFINITY;
 }
 
 #ifndef CONFIG_64BIT
index dfaf458d6702459ba9b5f85d7be5e30b1528a2ba..7f001bbedb00a463d0746c2690421eec1df5bf3a 100644 (file)
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(void)
 }
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
 {
        if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
                return 1;
index 2121fbb2ff4c313c5f0891b783ea4cbf3a571fe0..05cef50612930d76cc62c318b230eeeb0b1de368 100644 (file)
@@ -13,7 +13,6 @@ config SUPERH
        select HAVE_LMB
        select HAVE_OPROFILE
        select HAVE_GENERIC_DMA_COHERENT
-       select HAVE_IOREMAP_PROT if MMU
        select HAVE_ARCH_TRACEHOOK
        select HAVE_DMA_API_DEBUG
        select HAVE_DMA_ATTRS
@@ -22,6 +21,7 @@ config SUPERH
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_LZMA
+       select HAVE_KERNEL_LZO
        select HAVE_SYSCALL_TRACEPOINTS
        select RTC_LIB
        select GENERIC_ATOMIC64
@@ -35,6 +35,7 @@ config SUPERH32
        def_bool ARCH = "sh"
        select HAVE_KPROBES
        select HAVE_KRETPROBES
+       select HAVE_IOREMAP_PROT if MMU && !X2TLB
        select HAVE_FUNCTION_TRACER
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_DYNAMIC_FTRACE
@@ -42,6 +43,8 @@ config SUPERH32
        select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_ARCH_KGDB
+       select HAVE_HW_BREAKPOINT
+       select PERF_EVENTS if HAVE_HW_BREAKPOINT
        select ARCH_HIBERNATION_POSSIBLE if MMU
 
 config SUPERH64
@@ -78,11 +81,12 @@ config GENERIC_HARDIRQS
 config GENERIC_HARDIRQS_NO__DO_IRQ
        def_bool y
 
-config GENERIC_IRQ_PROBE
+config IRQ_PER_CPU
        def_bool y
 
-config IRQ_PER_CPU
+config SPARSE_IRQ
        def_bool y
+       depends on SUPERH32
 
 config GENERIC_GPIO
        def_bool n
@@ -548,8 +552,7 @@ config SH_PCLK_FREQ
                              CPU_SUBTYPE_SH7203 || \
                              CPU_SUBTYPE_SH7206 || \
                              CPU_SUBTYPE_SH7263 || \
-                             CPU_SUBTYPE_MXG    || \
-                             CPU_SUBTYPE_SH7786
+                             CPU_SUBTYPE_MXG
        default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
        default "66000000" if CPU_SUBTYPE_SH4_202
        default "50000000"
@@ -563,7 +566,8 @@ config SH_CLK_CPG
 
 config SH_CLK_CPG_LEGACY
        depends on SH_CLK_CPG
-       def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE
+       def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \
+                     !CPU_SUBTYPE_SH7786
 
 config SH_CLK_MD
        int "CPU Mode Pin Setting"
@@ -725,18 +729,6 @@ config GUSA_RB
          LLSC, this should be more efficient than the other alternative of
          disabling interrupts around the atomic sequence.
 
-config SPARSE_IRQ
-       bool "Support sparse irq numbering"
-       depends on EXPERIMENTAL
-       help
-         This enables support for sparse irqs. This is useful in general
-         as most CPUs have a fairly sparse array of IRQ vectors, which
-         the irq_desc then maps directly on to. Systems with a high
-         number of off-chip IRQs will want to treat this as
-         experimental until they have been independently verified.
-
-         If you don't know what to do here, say N.
-
 endmenu
 
 menu "Boot options"
@@ -822,11 +814,15 @@ config MAPLE
 config PCI
        bool "PCI support"
        depends on SYS_SUPPORTS_PCI
+       select PCI_DOMAINS
        help
          Find out whether you have a PCI motherboard. PCI is the name of a
          bus system, i.e. the way the CPU talks to the other stuff inside
          your box. If you have PCI, say Y, otherwise N.
 
+config PCI_DOMAINS
+       bool
+
 source "drivers/pci/pcie/Kconfig"
 
 source "drivers/pci/Kconfig"
index cd6e3ea598d5b8d028720fb806ddb82a39b2e863..ddf096c7d8bf8e230abc484977956ade22c34029 100644 (file)
@@ -68,7 +68,8 @@ config SH_STORE_QUEUES
 
 config SPECULATIVE_EXECUTION
        bool "Speculative subroutine return"
-       depends on CPU_SUBTYPE_SH7780 && EXPERIMENTAL
+       depends on EXPERIMENTAL
+       depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 || CPU_SUBTYPE_SH7786
        help
          This enables support for a speculative instruction fetch for
          subroutine return. There are various pitfalls associated with
index db91925c79d1185665dafc0216c01f7df8c346af..588579ac2e3526b2fed044684c419749f0804433 100644 (file)
@@ -83,6 +83,7 @@ defaultimage-$(CONFIG_SH_AP325RXA)            := uImage
 defaultimage-$(CONFIG_SH_7724_SOLUTION_ENGINE) := uImage
 defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE) := vmlinux
 defaultimage-$(CONFIG_SH_7619_SOLUTION_ENGINE) := vmlinux
+defaultimage-$(CONFIG_SH_SDK7786)              := vmlinux.bin
 
 # Set some sensible Kbuild defaults
 KBUILD_IMAGE           := $(defaultimage-y)
@@ -143,11 +144,11 @@ machdir-$(CONFIG_SH_AP325RXA)                     += mach-ap325rxa
 machdir-$(CONFIG_SH_KFR2R09)                   += mach-kfr2r09
 machdir-$(CONFIG_SH_ECOVEC)                    += mach-ecovec24
 machdir-$(CONFIG_SH_SDK7780)                   += mach-sdk7780
+machdir-$(CONFIG_SH_SDK7786)                   += mach-sdk7786
 machdir-$(CONFIG_SH_X3PROTO)                   += mach-x3proto
 machdir-$(CONFIG_SH_SH7763RDP)                 += mach-sh7763rdp
 machdir-$(CONFIG_SH_SH4202_MICRODEV)           += mach-microdev
 machdir-$(CONFIG_SH_LANDISK)                   += mach-landisk
-machdir-$(CONFIG_SH_TITAN)                     += mach-titan
 machdir-$(CONFIG_SH_LBOX_RE2)                  += mach-lboxre2
 machdir-$(CONFIG_SH_CAYMAN)                    += mach-cayman
 machdir-$(CONFIG_SH_RSK)                       += mach-rsk
@@ -203,8 +204,9 @@ endif
 libs-$(CONFIG_SUPERH32)                := arch/sh/lib/ $(libs-y)
 libs-$(CONFIG_SUPERH64)                := arch/sh/lib64/ $(libs-y)
 
-BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \
-              zImage vmlinux.srec romImage
+BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.lzo \
+              uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \
+              romImage
 PHONY += $(BOOT_TARGETS)
 
 all: $(KBUILD_IMAGE)
@@ -225,10 +227,12 @@ define archhelp
        @echo '  zImage                    - Compressed kernel image'
        @echo '  romImage                  - Compressed ROM image, if supported'
        @echo '  vmlinux.srec              - Create an ELF S-record'
+       @echo '  vmlinux.bin               - Create an uncompressed binary image'
        @echo '* uImage                    - Alias to bootable U-Boot image'
        @echo '  uImage.srec               - Create an S-record for U-Boot'
        @echo '  uImage.bin                - Kernel-only image for U-Boot (bin)'
        @echo '* uImage.gz                 - Kernel-only image for U-Boot (gzip)'
        @echo '  uImage.bz2                - Kernel-only image for U-Boot (bzip2)'
        @echo '  uImage.lzma               - Kernel-only image for U-Boot (lzma)'
+       @echo '  uImage.lzo                - Kernel-only image for U-Boot (lzo)'
 endef
index aedd9deb5de2b94077a7ee04b404d2589efb9b7f..938e87d51482e991bd3fab373e8b1df67de070ce 100644 (file)
@@ -150,6 +150,14 @@ config SH_SDK7780
          Select SDK7780 if configuring for a Renesas SH7780 SDK7780R3
          evaluation board.
 
+config SH_SDK7786
+       bool "SDK7786"
+       depends on CPU_SUBTYPE_SH7786
+       select SYS_SUPPORTS_PCI
+       help
+         Select SDK7786 if configuring for a Renesas Technology Europe
+         SH7786-65nm board.
+
 config SH_HIGHLANDER
        bool "Highlander"
        depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
index ce0f2638178469b53fbd497c3ee4928efeae5cce..4f90f9b7a9228e3991e900a04190b5f88c01dd10 100644 (file)
@@ -8,3 +8,4 @@ obj-$(CONFIG_SH_SHMIN)          += board-shmin.o
 obj-$(CONFIG_SH_EDOSK7760)     += board-edosk7760.o
 obj-$(CONFIG_SH_ESPT)          += board-espt.o
 obj-$(CONFIG_SH_POLARIS)       += board-polaris.o
+obj-$(CONFIG_SH_TITAN)         += board-titan.o
index 99ffc5f1c0dd3900f3aa8a24337dd1a65b8e90ce..efba450a051838fa49d792676f3a9285ae9a1ff8 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/heartbeat.h>
 #include <cpu/sh7720.h>
 
-#define LAN9115_READY  (ctrl_inl(0xA8000084UL) & 0x00000001UL)
+#define LAN9115_READY  (__raw_readl(0xA8000084UL) & 0x00000001UL)
 
 /* Prefer cmdline over RedBoot */
 static const char *probes[] = { "cmdlinepart", "RedBoot", NULL };
@@ -60,33 +60,33 @@ static void __init setup_chip_select(void)
 {
        /* CS2: LAN (0x08000000 - 0x0bffffff) */
        /* no idle cycles, normal space, 8 bit data bus */
-       ctrl_outl(0x36db0400, CS2BCR);
+       __raw_writel(0x36db0400, CS2BCR);
        /* (SW:1.5 WR:3 HW:1.5), ext. wait */
-       ctrl_outl(0x000003c0, CS2WCR);
+       __raw_writel(0x000003c0, CS2WCR);
 
        /* CS4: CAN1 (0xb0000000 - 0xb3ffffff) */
        /* no idle cycles, normal space, 8 bit data bus */
-       ctrl_outl(0x00000200, CS4BCR);
+       __raw_writel(0x00000200, CS4BCR);
        /* (SW:1.5 WR:3 HW:1.5), ext. wait */
-       ctrl_outl(0x00100981, CS4WCR);
+       __raw_writel(0x00100981, CS4WCR);
 
        /* CS5a: CAN2 (0xb4000000 - 0xb5ffffff) */
        /* no idle cycles, normal space, 8 bit data bus */
-       ctrl_outl(0x00000200, CS5ABCR);
+       __raw_writel(0x00000200, CS5ABCR);
        /* (SW:1.5 WR:3 HW:1.5), ext. wait */
-       ctrl_outl(0x00100981, CS5AWCR);
+       __raw_writel(0x00100981, CS5AWCR);
 
        /* CS5b: CAN3 (0xb6000000 - 0xb7ffffff) */
        /* no idle cycles, normal space, 8 bit data bus */
-       ctrl_outl(0x00000200, CS5BBCR);
+       __raw_writel(0x00000200, CS5BBCR);
        /* (SW:1.5 WR:3 HW:1.5), ext. wait */
-       ctrl_outl(0x00100981, CS5BWCR);
+       __raw_writel(0x00100981, CS5BWCR);
 
        /* CS6a: Rotary (0xb8000000 - 0xb9ffffff) */
        /* no idle cycles, normal space, 8 bit data bus */
-       ctrl_outl(0x00000200, CS6ABCR);
+       __raw_writel(0x00000200, CS6ABCR);
        /* (SW:1.5 WR:3 HW:1.5), no ext. wait */
-       ctrl_outl(0x001009C1, CS6AWCR);
+       __raw_writel(0x001009C1, CS6AWCR);
 }
 
 static void __init setup_port_multiplexing(void)
@@ -94,71 +94,71 @@ static void __init setup_port_multiplexing(void)
        /* A7 GPO(LED8);     A6 GPO(LED7);     A5 GPO(LED6);      A4 GPO(LED5);
         * A3 GPO(LED4);     A2 GPO(LED3);     A1 GPO(LED2);      A0 GPO(LED1);
         */
-       ctrl_outw(0x5555, PORT_PACR);   /* 01 01 01 01 01 01 01 01 */
+       __raw_writew(0x5555, PORT_PACR);        /* 01 01 01 01 01 01 01 01 */
 
        /* B7 GPO(RST4);   B6 GPO(RST3);  B5 GPO(RST2);    B4 GPO(RST1);
         * B3 GPO(PB3);    B2 GPO(PB2);   B1 GPO(PB1);     B0 GPO(PB0);
         */
-       ctrl_outw(0x5555, PORT_PBCR);   /* 01 01 01 01 01 01 01 01 */
+       __raw_writew(0x5555, PORT_PBCR);        /* 01 01 01 01 01 01 01 01 */
 
        /* C7 GPO(PC7);   C6 GPO(PC6);    C5 GPO(PC5);     C4 GPO(PC4);
         * C3 LCD_DATA3;  C2 LCD_DATA2;   C1 LCD_DATA1;    C0 LCD_DATA0;
         */
-       ctrl_outw(0x5500, PORT_PCCR);   /* 01 01 01 01 00 00 00 00 */
+       __raw_writew(0x5500, PORT_PCCR);        /* 01 01 01 01 00 00 00 00 */
 
        /* D7 GPO(PD7); D6 GPO(PD6);    D5 GPO(PD5);       D4 GPO(PD4);
         * D3 GPO(PD3); D2 GPO(PD2);    D1 GPO(PD1);       D0 GPO(PD0);
         */
-       ctrl_outw(0x5555, PORT_PDCR);   /* 01 01 01 01 01 01 01 01 */
+       __raw_writew(0x5555, PORT_PDCR);        /* 01 01 01 01 01 01 01 01 */
 
        /* E7 (x);        E6 GPI(nu);    E5 GPI(nu);      E4 LCD_M_DISP;
         * E3 LCD_CL1;    E2 LCD_CL2;    E1 LCD_DON;      E0 LCD_FLM;
         */
-       ctrl_outw(0x3C00, PORT_PECR);   /* 00 11 11 00 00 00 00 00 */
+       __raw_writew(0x3C00, PORT_PECR);        /* 00 11 11 00 00 00 00 00 */
 
        /* F7 (x);           F6 DA1(VLCD);     F5 DA0(nc);        F4 AN3;
         * F3 AN2(MID_AD);   F2 AN1(EARTH_AD); F1 AN0(TEMP);      F0 GPI+(nc);
         */
-       ctrl_outw(0x0002, PORT_PFCR);   /* 00 00 00 00 00 00 00 10 */
+       __raw_writew(0x0002, PORT_PFCR);        /* 00 00 00 00 00 00 00 10 */
 
        /* G7 (x);        G6 IRQ5(TOUCH_BUSY); G5 IRQ4(TOUCH_IRQ); G4 GPI(KEY2);
         * G3 GPI(KEY1);  G2 GPO(LED11);        G1 GPO(LED10);     G0 GPO(LED9);
         */
-       ctrl_outw(0x03D5, PORT_PGCR);   /* 00 00 00 11 11 01 01 01 */
+       __raw_writew(0x03D5, PORT_PGCR);        /* 00 00 00 11 11 01 01 01 */
 
        /* H7 (x);            H6 /RAS(BRAS);      H5 /CAS(BCAS); H4 CKE(BCKE);
         * H3 GPO(EARTH_OFF); H2 GPO(EARTH_TEST); H1 USB2_PWR;   H0 USB1_PWR;
         */
-       ctrl_outw(0x0050, PORT_PHCR);   /* 00 00 00 00 01 01 00 00 */
+       __raw_writew(0x0050, PORT_PHCR);        /* 00 00 00 00 01 01 00 00 */
 
        /* J7 (x);        J6 AUDCK;        J5 ASEBRKAK;     J4 AUDATA3;
         * J3 AUDATA2;    J2 AUDATA1;      J1 AUDATA0;      J0 AUDSYNC;
         */
-       ctrl_outw(0x0000, PORT_PJCR);   /* 00 00 00 00 00 00 00 00 */
+       __raw_writew(0x0000, PORT_PJCR);        /* 00 00 00 00 00 00 00 00 */
 
        /* K7 (x);          K6 (x);          K5 (x);       K4 (x);
         * K3 PINT7(/PWR2); K2 PINT6(/PWR1); K1 PINT5(nu); K0 PINT4(FLASH_READY)
         */
-       ctrl_outw(0x00FF, PORT_PKCR);   /* 00 00 00 00 11 11 11 11 */
+       __raw_writew(0x00FF, PORT_PKCR);        /* 00 00 00 00 11 11 11 11 */
 
        /* L7 TRST;        L6 TMS;           L5 TDO;              L4 TDI;
         * L3 TCK;         L2 (x);           L1 (x);              L0 (x);
         */
-       ctrl_outw(0x0000, PORT_PLCR);   /* 00 00 00 00 00 00 00 00 */
+       __raw_writew(0x0000, PORT_PLCR);        /* 00 00 00 00 00 00 00 00 */
 
        /* M7 GPO(CURRENT_SINK);    M6 GPO(PWR_SWITCH);     M5 GPO(LAN_SPEED);
         * M4 GPO(LAN_RESET);       M3 GPO(BUZZER);         M2 GPO(LCD_BL);
         * M1 CS5B(CAN3_CS);        M0 GPI+(nc);
         */
-       ctrl_outw(0x5552, PORT_PMCR);      /* 01 01 01 01 01 01 00 10 */
+       __raw_writew(0x5552, PORT_PMCR);           /* 01 01 01 01 01 01 00 10 */
 
        /* CURRENT_SINK=off,    PWR_SWITCH=off, LAN_SPEED=100MBit,
         * LAN_RESET=off,       BUZZER=off,     LCD_BL=off
         */
 #if CONFIG_SH_MAGIC_PANEL_R2_VERSION == 2
-       ctrl_outb(0x30, PORT_PMDR);
+       __raw_writeb(0x30, PORT_PMDR);
 #elif CONFIG_SH_MAGIC_PANEL_R2_VERSION == 3
-       ctrl_outb(0xF0, PORT_PMDR);
+       __raw_writeb(0xF0, PORT_PMDR);
 #else
 #error Unknown revision of PLATFORM_MP_R2
 #endif
@@ -167,8 +167,8 @@ static void __init setup_port_multiplexing(void)
         * P4 GPO(nu);         P3 IRQ3(LAN_IRQ);  P2 IRQ2(CAN3_IRQ);
         * P1 IRQ1(CAN2_IRQ);  P0 IRQ0(CAN1_IRQ)
         */
-       ctrl_outw(0x0100, PORT_PPCR);   /* 00 00 00 01 00 00 00 00 */
-       ctrl_outb(0x10, PORT_PPDR);
+       __raw_writew(0x0100, PORT_PPCR);        /* 00 00 00 01 00 00 00 00 */
+       __raw_writeb(0x10, PORT_PPDR);
 
        /* R7 A25;           R6 A24;         R5 A23;              R4 A22;
         * R3 A21;           R2 A20;         R1 A19;              R0 A0;
@@ -185,22 +185,22 @@ static void __init setup_port_multiplexing(void)
        /* S7 (x);              S6 (x);        S5 (x);       S4 GPO(EEPROM_CS2);
         * S3 GPO(EEPROM_CS1);  S2 SIOF0_TXD;  S1 SIOF0_RXD; S0 SIOF0_SCK;
         */
-       ctrl_outw(0x0140, PORT_PSCR);   /* 00 00 00 01 01 00 00 00 */
+       __raw_writew(0x0140, PORT_PSCR);        /* 00 00 00 01 01 00 00 00 */
 
        /* T7 (x);         T6 (x);        T5 (x);         T4 COM1_CTS;
         * T3 COM1_RTS;    T2 COM1_TXD;   T1 COM1_RXD;    T0 GPO(WDOG)
         */
-       ctrl_outw(0x0001, PORT_PTCR);   /* 00 00 00 00 00 00 00 01 */
+       __raw_writew(0x0001, PORT_PTCR);        /* 00 00 00 00 00 00 00 01 */
 
        /* U7 (x);           U6 (x);       U5 (x);        U4 GPI+(/AC_FAULT);
         * U3 GPO(TOUCH_CS); U2 TOUCH_TXD; U1 TOUCH_RXD;  U0 TOUCH_SCK;
         */
-       ctrl_outw(0x0240, PORT_PUCR);   /* 00 00 00 10 01 00 00 00 */
+       __raw_writew(0x0240, PORT_PUCR);        /* 00 00 00 10 01 00 00 00 */
 
        /* V7 (x);        V6 (x);       V5 (x);           V4 GPO(MID2);
         * V3 GPO(MID1);  V2 CARD_TxD;  V1 CARD_RxD;      V0 GPI+(/BAT_FAULT);
         */
-       ctrl_outw(0x0142, PORT_PVCR);   /* 00 00 00 01 01 00 00 10 */
+       __raw_writew(0x0142, PORT_PVCR);        /* 00 00 00 01 01 00 00 10 */
 }
 
 static void __init mpr2_setup(char **cmdline_p)
@@ -209,24 +209,24 @@ static void __init mpr2_setup(char **cmdline_p)
         * /PCC_CD1, /PCC_CD2,  PCC_BVD1, PCC_BVD2,
         * /IOIS16,  IRQ4,      IRQ5,     USB1d_SUSPEND
         */
-       ctrl_outw(0xAABC, PORT_PSELA);
+       __raw_writew(0xAABC, PORT_PSELA);
        /* set Pin Select Register B:
         * /SCIF0_RTS, /SCIF0_CTS, LCD_VCPWC,
         * LCD_VEPWC,  IIC_SDA,    IIC_SCL, Reserved
         */
-       ctrl_outw(0x3C00, PORT_PSELB);
+       __raw_writew(0x3C00, PORT_PSELB);
        /* set Pin Select Register C:
         * SIOF1_SCK, SIOF1_RxD, SCIF1_RxD, SCIF1_TxD, Reserved
         */
-       ctrl_outw(0x0000, PORT_PSELC);
+       __raw_writew(0x0000, PORT_PSELC);
        /* set Pin Select Register D: Reserved, SIOF1_TxD, Reserved, SIOF1_MCLK,
         * Reserved, SIOF1_SYNC, Reserved, SCIF1_SCK, Reserved
         */
-       ctrl_outw(0x0000, PORT_PSELD);
+       __raw_writew(0x0000, PORT_PSELD);
        /* set USB TxRx Control: Reserved, DRV, Reserved, USB_TRANS, USB_SEL */
-       ctrl_outw(0x0101, PORT_UTRCTL);
+       __raw_writew(0x0101, PORT_UTRCTL);
        /* set USB Clock Control: USSCS, USSTB, Reserved (HighByte always A5) */
-       ctrl_outw(0xA5C0, PORT_UCLKCR_W);
+       __raw_writew(0xA5C0, PORT_UCLKCR_W);
 
        setup_chip_select();
 
index 62607eb5100444985c164b29df04ccaec9d980da..594866356c247cbc6ecb2aa10943443f09ca2030 100644 (file)
@@ -59,15 +59,12 @@ static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 };
 static struct heartbeat_data heartbeat_data = {
        .bit_pos        = heartbeat_bit_pos,
        .nr_bits        = ARRAY_SIZE(heartbeat_bit_pos),
-       .regsize        = 8,
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PORT_PCDR,
-               .end    = PORT_PCDR,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PORT_PCDR,
+       .end    = PORT_PCDR,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
 };
 
 static struct platform_device heartbeat_device = {
@@ -76,8 +73,8 @@ static struct platform_device heartbeat_device = {
        .dev    = {
                .platform_data  = &heartbeat_data,
        },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 static struct platform_device *polaris_devices[] __initdata = {
@@ -92,15 +89,15 @@ static int __init polaris_initialise(void)
        printk(KERN_INFO "Configuring Polaris external bus\n");
 
        /* Configure area 5 with 2 wait states */
-       wcr = ctrl_inw(WCR2);
+       wcr = __raw_readw(WCR2);
        wcr &= (~AREA5_WAIT_CTRL);
        wcr |= (WAIT_STATES_10 << 10);
-       ctrl_outw(wcr, WCR2);
+       __raw_writew(wcr, WCR2);
 
        /* Configure area 5 for 32-bit access */
-       bcr_mask = ctrl_inw(BCR2);
+       bcr_mask = __raw_readw(BCR2);
        bcr_mask |= 1 << 10;
-       ctrl_outw(bcr_mask, BCR2);
+       __raw_writew(bcr_mask, BCR2);
 
        return platform_add_devices(polaris_devices,
                                    ARRAY_SIZE(polaris_devices));
@@ -131,13 +128,13 @@ static struct ipr_desc ipr_irq_desc = {
 static void __init init_polaris_irq(void)
 {
        /* Disable all interrupts */
-       ctrl_outw(0, BCR_ILCRA);
-       ctrl_outw(0, BCR_ILCRB);
-       ctrl_outw(0, BCR_ILCRC);
-       ctrl_outw(0, BCR_ILCRD);
-       ctrl_outw(0, BCR_ILCRE);
-       ctrl_outw(0, BCR_ILCRF);
-       ctrl_outw(0, BCR_ILCRG);
+       __raw_writew(0, BCR_ILCRA);
+       __raw_writew(0, BCR_ILCRB);
+       __raw_writew(0, BCR_ILCRC);
+       __raw_writew(0, BCR_ILCRD);
+       __raw_writew(0, BCR_ILCRE);
+       __raw_writew(0, BCR_ILCRF);
+       __raw_writew(0, BCR_ILCRG);
 
        register_ipr_controller(&ipr_irq_desc);
 }
index e5a8a2fde39c12b61c6afe53f30a45ef47649f39..fe7e686c94ac004fc19bc569df8ee271aad932f1 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/i2c-algo-pca.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/irq.h>
+#include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/errno.h>
 #include <mach/sh7785lcr.h>
  * NOTE: This board has 2 physical memory maps.
  *      Please look at include/asm-sh/sh7785lcr.h or hardware manual.
  */
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PLD_LEDCR,
-               .end    = PLD_LEDCR,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 8,
+static struct resource heartbeat_resource = {
+       .start  = PLD_LEDCR,
+       .end    = PLD_LEDCR,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev    = {
-               .platform_data  = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 static struct mtd_partition nor_flash_partitions[] = {
@@ -341,8 +333,14 @@ static void __init sh7785lcr_setup(char **cmdline_p)
        pm_power_off = sh7785lcr_power_off;
 
        /* sm501 DRAM configuration */
-       sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL;
-       writel(0x000307c2, sm501_reg);
+       sm501_reg = ioremap_nocache(SM107_REG_ADDR, SM501_DRAM_CONTROL);
+       if (!sm501_reg) {
+               printk(KERN_ERR "%s: ioremap error.\n", __func__);
+               return;
+       }
+
+       writel(0x000307c2, sm501_reg + SM501_DRAM_CONTROL);
+       iounmap(sm501_reg);
 }
 
 /* Return the board specific boot mode pin configuration */
index b1dcbbc89188856d51cadc0292bee7c1cfe0986d..325bed53b87e71fdab20550f8b6e5f394d2b38e2 100644 (file)
@@ -17,8 +17,8 @@
 
 static void __init init_shmin_irq(void)
 {
-       ctrl_outw(0x2a00, PFC_PHCR);    // IRQ0-3=IRQ
-       ctrl_outw(0x0aaa, INTC_ICR1);   // IRQ0-3=IRQ-mode,Low-active.
+       __raw_writew(0x2a00, PFC_PHCR); // IRQ0-3=IRQ
+       __raw_writew(0x0aaa, INTC_ICR1);        // IRQ0-3=IRQ-mode,Low-active.
        plat_irq_setup_pins(IRQ_MODE_IRQ);
 }
 
similarity index 56%
rename from arch/sh/boards/mach-titan/setup.c
rename to arch/sh/boards/board-titan.c
index 81e7e0f03863d510f9144d9c99f3eff1ed0fe938..94c36c7bc0b3bc1701768f938e8d92e6d3add5b9 100644 (file)
@@ -19,26 +19,6 @@ static void __init init_titan_irq(void)
 }
 
 static struct sh_machine_vector mv_titan __initmv = {
-       .mv_name =      "Titan",
-
-       .mv_inb =       titan_inb,
-       .mv_inw =       titan_inw,
-       .mv_inl =       titan_inl,
-       .mv_outb =      titan_outb,
-       .mv_outw =      titan_outw,
-       .mv_outl =      titan_outl,
-
-       .mv_inb_p =     titan_inb_p,
-       .mv_inw_p =     titan_inw,
-       .mv_inl_p =     titan_inl,
-       .mv_outb_p =    titan_outb_p,
-       .mv_outw_p =    titan_outw,
-       .mv_outl_p =    titan_outl,
-
-       .mv_insl =      titan_insl,
-       .mv_outsl =     titan_outsl,
-
-       .mv_ioport_map = titan_ioport_map,
-
-       .mv_init_irq =  init_titan_irq,
+       .mv_name        = "Titan",
+       .mv_init_irq    = init_titan_irq,
 };
index 36b8bac9b1247f25ad1fa88c3d010af9b7e4f131..a9bd6e3ee10b9eabf5d5d5e72924ffcfacd47e00 100644 (file)
@@ -2,7 +2,7 @@
  * Renesas Technology Corp. SH7786 Urquell Support.
  *
  * Copyright (C) 2008  Kuninori Morimoto <morimoto.kuninori@renesas.com>
- * Copyright (C) 2009  Paul Mundt
+ * Copyright (C) 2009, 2010  Paul Mundt
  *
  * Based on board-sh7785lcr.c
  * Copyright (C) 2008  Yoshihiro Shimoda
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/irq.h>
+#include <linux/clk.h>
 #include <mach/urquell.h>
 #include <cpu/sh7786.h>
 #include <asm/heartbeat.h>
  */
 
 /* HeartBeat */
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = BOARDREG(SLEDR),
-               .end    = BOARDREG(SLEDR),
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
+static struct resource heartbeat_resource = {
+       .start  = BOARDREG(SLEDR),
+       .end    = BOARDREG(SLEDR),
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev    = {
-               .platform_data  = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* LAN91C111 */
@@ -184,6 +176,27 @@ static int urquell_mode_pins(void)
        return __raw_readw(UBOARDREG(MDSWMR));
 }
 
+static int urquell_clk_init(void)
+{
+       struct clk *clk;
+       int ret;
+
+       /*
+        * Only handle the EXTAL case, anyone interfacing a crystal
+        * resonator will need to provide their own input clock.
+        */
+       if (test_mode_pin(MODE_PIN9))
+               return -EINVAL;
+
+       clk = clk_get(NULL, "extal");
+       if (!clk || IS_ERR(clk))
+               return PTR_ERR(clk);
+       ret = clk_set_rate(clk, 33333333);
+       clk_put(clk);
+
+       return ret;
+}
+
 /* Initialize the board */
 static void __init urquell_setup(char **cmdline_p)
 {
@@ -200,4 +213,5 @@ static struct sh_machine_vector mv_urquell __initmv = {
        .mv_setup       = urquell_setup,
        .mv_init_irq    = urquell_init_irq,
        .mv_mode_pins   = urquell_mode_pins,
+       .mv_clk_init    = urquell_clk_init,
 };
index 1f5fa5c44f6df77d42f0166893abf815ed54c981..57e37e2842082e84588718007fdd45f599b6c8a5 100644 (file)
@@ -159,21 +159,21 @@ static void ap320_wvga_power_on(void *board_data)
        msleep(100);
 
        /* ASD AP-320/325 LCD ON */
-       ctrl_outw(FPGA_LCDREG_VAL, FPGA_LCDREG);
+       __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
 
        /* backlight */
        gpio_set_value(GPIO_PTS3, 0);
-       ctrl_outw(0x100, FPGA_BKLREG);
+       __raw_writew(0x100, FPGA_BKLREG);
 }
 
 static void ap320_wvga_power_off(void *board_data)
 {
        /* backlight */
-       ctrl_outw(0, FPGA_BKLREG);
+       __raw_writew(0, FPGA_BKLREG);
        gpio_set_value(GPIO_PTS3, 1);
 
        /* ASD AP-320/325 LCD OFF */
-       ctrl_outw(0, FPGA_LCDREG);
+       __raw_writew(0, FPGA_LCDREG);
 }
 
 static struct sh_mobile_lcdc_info lcdc_info = {
@@ -420,7 +420,7 @@ static struct resource sdhi0_cn3_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 101,
+               .start  = 100,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -443,7 +443,7 @@ static struct resource sdhi1_cn7_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 24,
+               .start  = 23,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-       .buswidth       = SOCAM_DATAWIDTH_8,
-       .flags          = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+       .flags          = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
+                         OV772X_FLAG_8BIT,
        .edgectrl       = OV772X_AUTO_EDGECTRL(0xf, 0),
 };
 
@@ -595,7 +595,7 @@ static int __init ap325rxa_devices_setup(void)
        gpio_request(GPIO_PTZ4, NULL);
        gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
 
-       ctrl_outw(ctrl_inw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
+       __raw_writew(__raw_readw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
 
        /* FLCTL */
        gpio_request(GPIO_FN_FCE, NULL);
@@ -613,9 +613,9 @@ static int __init ap325rxa_devices_setup(void)
        gpio_request(GPIO_FN_FWE, NULL);
        gpio_request(GPIO_FN_FRB, NULL);
 
-       ctrl_outw(0, PORT_HIZCRC);
-       ctrl_outw(0xFFFF, PORT_DRVCRA);
-       ctrl_outw(0xFFFF, PORT_DRVCRB);
+       __raw_writew(0, PORT_HIZCRC);
+       __raw_writew(0xFFFF, PORT_DRVCRA);
+       __raw_writew(0xFFFF, PORT_DRVCRB);
 
        platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
 
index 33f77085631937fef9d1489590980016dd0f2d15..1394b078db36bbbd557ad8acd6ed99febe4c1097 100644 (file)
@@ -66,9 +66,9 @@ static void enable_cayman_irq(unsigned int irq)
        reg = EPLD_MASK_BASE + ((irq / 8) << 2);
        bit = 1<<(irq % 8);
        local_irq_save(flags);
-       mask = ctrl_inl(reg);
+       mask = __raw_readl(reg);
        mask |= bit;
-       ctrl_outl(mask, reg);
+       __raw_writel(mask, reg);
        local_irq_restore(flags);
 }
 
@@ -83,9 +83,9 @@ void disable_cayman_irq(unsigned int irq)
        reg = EPLD_MASK_BASE + ((irq / 8) << 2);
        bit = 1<<(irq % 8);
        local_irq_save(flags);
-       mask = ctrl_inl(reg);
+       mask = __raw_readl(reg);
        mask &= ~bit;
-       ctrl_outl(mask, reg);
+       __raw_writel(mask, reg);
        local_irq_restore(flags);
 }
 
@@ -109,8 +109,8 @@ int cayman_irq_demux(int evt)
                unsigned long status;
                int i;
 
-               status = ctrl_inl(EPLD_STATUS_BASE) &
-                        ctrl_inl(EPLD_MASK_BASE) & 0xff;
+               status = __raw_readl(EPLD_STATUS_BASE) &
+                        __raw_readl(EPLD_MASK_BASE) & 0xff;
                if (status == 0) {
                        irq = -1;
                } else {
@@ -126,8 +126,8 @@ int cayman_irq_demux(int evt)
                unsigned long status;
                int i;
 
-               status = ctrl_inl(EPLD_STATUS_BASE + 3 * sizeof(u32)) &
-                        ctrl_inl(EPLD_MASK_BASE + 3 * sizeof(u32)) & 0xff;
+               status = __raw_readl(EPLD_STATUS_BASE + 3 * sizeof(u32)) &
+                        __raw_readl(EPLD_MASK_BASE + 3 * sizeof(u32)) & 0xff;
                if (status == 0) {
                        irq = -1;
                } else {
index f55fc8e795e9ef3bd11b381df49b5f903aa7a17d..d932667410ab9f79533f10be378e5b4218c37e4c 100644 (file)
@@ -135,3 +135,30 @@ int systemasic_irq_demux(int irq)
        /* Not reached */
        return irq;
 }
+
+void systemasic_irq_init(void)
+{
+       int i, nid = cpu_to_node(boot_cpu_data);
+
+       /* Assign all virtual IRQs to the System ASIC int. handler */
+       for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++) {
+               unsigned int irq;
+
+               irq = create_irq_nr(i, nid);
+               if (unlikely(irq == 0)) {
+                       pr_err("%s: failed hooking irq %d for systemasic\n",
+                              __func__, i);
+                       return;
+               }
+
+               if (unlikely(irq != i)) {
+                       pr_err("%s: got irq %d but wanted %d, bailing.\n",
+                              __func__, irq, i);
+                       destroy_irq(irq);
+                       return;
+               }
+
+               set_irq_chip_and_handler(i, &systemasic_int,
+                                        handle_level_irq);
+       }
+}
index a7433685798d83b26695c5530de6750f1dcdc377..061d65714fcc2782ab0dae15daec9e33223d43c3 100644 (file)
@@ -35,11 +35,11 @@ static void aica_rtc_gettimeofday(struct timespec *ts)
        unsigned long val1, val2;
 
        do {
-               val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
-                       (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
+               val1 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) |
+                       (__raw_readl(AICA_RTC_SECS_L) & 0xffff);
 
-               val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
-                       (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
+               val2 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) |
+                       (__raw_readl(AICA_RTC_SECS_L) & 0xffff);
        } while (val1 != val2);
 
        ts->tv_sec = val1 - TWENTY_YEARS;
@@ -60,14 +60,14 @@ static int aica_rtc_settimeofday(const time_t secs)
        unsigned long adj = secs + TWENTY_YEARS;
 
        do {
-               ctrl_outl((adj & 0xffff0000) >> 16, AICA_RTC_SECS_H);
-               ctrl_outl((adj & 0xffff), AICA_RTC_SECS_L);
+               __raw_writel((adj & 0xffff0000) >> 16, AICA_RTC_SECS_H);
+               __raw_writel((adj & 0xffff), AICA_RTC_SECS_L);
 
-               val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
-                       (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
+               val1 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) |
+                       (__raw_readl(AICA_RTC_SECS_L) & 0xffff);
 
-               val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
-                       (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
+               val2 = ((__raw_readl(AICA_RTC_SECS_H) & 0xffff) << 16) |
+                       (__raw_readl(AICA_RTC_SECS_L) & 0xffff);
        } while (val1 != val2);
 
        return 0;
index a4b7402d6176245b0f0387bf983d0db0d6f9dafa..ad1a4db72e0406308484ce7bebe6ad514433696b 100644 (file)
 #include <asm/machvec.h>
 #include <mach/sysasic.h>
 
-extern struct irq_chip systemasic_int;
-extern void aica_time_init(void);
-extern int systemasic_irq_demux(int);
-
 static void __init dreamcast_setup(char **cmdline_p)
 {
-       int i;
-
-       /* Mask all hardware events */
-       /* XXX */
-
-       /* Acknowledge any previous events */
-       /* XXX */
-
-       /* Assign all virtual IRQs to the System ASIC int. handler */
-       for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++)
-               set_irq_chip_and_handler(i, &systemasic_int,
-                                        handle_level_irq);
-
        board_time_init = aica_time_init;
 }
 
@@ -54,4 +37,5 @@ static struct sh_machine_vector mv_dreamcast __initmv = {
        .mv_name                = "Sega Dreamcast",
        .mv_setup               = dreamcast_setup,
        .mv_irq_demux           = systemasic_irq_demux,
+       .mv_init_irq            = systemasic_irq_init,
 };
index 833440044407598da49dcac134abd9ef0f9da513..3963c6f23d52bb5fa8a7e7e60b9d18bb5677d498 100644 (file)
@@ -37,6 +37,10 @@ ENTRY(ecovec24_sdram_enter_end)
        .balign 4
 ENTRY(ecovec24_sdram_leave_start)
 
+       mov.l   @(SH_SLEEP_MODE, r5), r0
+       tst     #SUSP_SH_RSTANDBY, r0
+       bf      resume_rstandby
+
        /* DBSC: put memory in auto-refresh mode */
 
        ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
@@ -49,4 +53,59 @@ ENTRY(ecovec24_sdram_leave_start)
        rts
         nop
 
+resume_rstandby:
+
+       /* DBSC: re-initialize and put in auto-refresh */
+
+       ED 0xFD000108, 0x00000181 /* DBPDCNT0 */
+       ED 0xFD000020, 0x015B0002 /* DBCONF */
+       ED 0xFD000030, 0x03071502 /* DBTR0 */
+       ED 0xFD000034, 0x02020102 /* DBTR1 */
+       ED 0xFD000038, 0x01090405 /* DBTR2 */
+       ED 0xFD00003C, 0x00000002 /* DBTR3 */
+       ED 0xFD000008, 0x00000005 /* DBKIND */
+       ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
+       ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
+       ED 0xFD000018, 0x00000001 /* DBCKECNT */
+
+       mov     #100,r0
+WAIT_400NS:
+       dt      r0
+       bf      WAIT_400NS
+
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000060, 0x00020000 /* DBMRCNT (EMR2) */
+       ED 0xFD000060, 0x00030000 /* DBMRCNT (EMR3) */
+       ED 0xFD000060, 0x00010004 /* DBMRCNT (EMR) */
+       ED 0xFD000060, 0x00000532 /* DBMRCNT (MRS) */
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000060, 0x00000432 /* DBMRCNT (MRS) */
+       ED 0xFD000060, 0x000103c0 /* DBMRCNT (EMR) */
+       ED 0xFD000060, 0x00010040 /* DBMRCNT (EMR) */
+
+       mov     #100,r0
+WAIT_400NS_2:
+       dt      r0
+       bf      WAIT_400NS_2
+
+       ED 0xFD000010, 0x00000001 /* DBEN */
+       ED 0xFD000044, 0x0000050f /* DBRFPDN1 */
+       ED 0xFD000048, 0x236800e6 /* DBRFPDN2 */
+
+       mov.l   DUMMY,r0
+       mov.l   @r0, r1 /* force single dummy read */
+
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000108, 0x00000080 /* DBPDCNT0 */
+       ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
+
+       rts
+        nop
+
+       .balign 4
+DUMMY: .long   0xac400000
+
 ENTRY(ecovec24_sdram_leave_end)
index 6a8861b39f05cd169138c9dbf5c5a254ad236a8a..39ed8722d11ad0b12469e6d17d4a98b671328634 100644 (file)
 
 /* Heartbeat */
 static unsigned char led_pos[] = { 0, 1, 2, 3 };
+
 static struct heartbeat_data heartbeat_data = {
-       .regsize = 8,
        .nr_bits = 4,
        .bit_pos = led_pos,
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = 0xA405012C, /* PTG */
-               .end    = 0xA405012E - 1,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = 0xA405012C, /* PTG */
+       .end    = 0xA405012E - 1,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
 };
 
 static struct platform_device heartbeat_device = {
@@ -84,8 +82,8 @@ static struct platform_device heartbeat_device = {
        .dev = {
                .platform_data = &heartbeat_data,
        },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* MTD */
@@ -353,6 +351,10 @@ static struct i2c_board_info i2c1_devices[] = {
        {
                I2C_BOARD_INFO("r2025sd", 0x32),
        },
+       {
+               I2C_BOARD_INFO("lis3lv02d", 0x1c),
+               .irq = 33,
+       }
 };
 
 /* KEYSC */
@@ -451,7 +453,7 @@ static struct resource sdhi0_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 101,
+               .start  = 100,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -487,7 +489,7 @@ static struct resource sdhi1_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 24,
+               .start  = 23,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -694,13 +696,13 @@ static struct platform_device camera_devices[] = {
 #define FCLKBCR                0xa415000c
 static void fsimck_init(struct clk *clk)
 {
-       u32 status = ctrl_inl(clk->enable_reg);
+       u32 status = __raw_readl(clk->enable_reg);
 
        /* use external clock */
        status &= ~0x000000ff;
        status |= 0x00000080;
 
-       ctrl_outl(status, clk->enable_reg);
+       __raw_writel(status, clk->enable_reg);
 }
 
 static struct clk_ops fsimck_clk_ops = {
@@ -749,6 +751,26 @@ static struct platform_device fsi_device = {
        },
 };
 
+/* IrDA */
+static struct resource irda_resources[] = {
+       [0] = {
+               .name   = "IrDA",
+               .start  = 0xA45D0000,
+               .end    = 0xA45D0049,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 20,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device irda_device = {
+       .name           = "sh_sir",
+       .num_resources  = ARRAY_SIZE(irda_resources),
+       .resource       = irda_resources,
+};
+
 static struct platform_device *ecovec_devices[] __initdata = {
        &heartbeat_device,
        &nor_flash_device,
@@ -769,8 +791,10 @@ static struct platform_device *ecovec_devices[] __initdata = {
        &camera_devices[1],
        &camera_devices[2],
        &fsi_device,
+       &irda_device,
 };
 
+#ifdef CONFIG_I2C
 #define EEPROM_ADDR 0x50
 static u8 mac_read(struct i2c_adapter *a, u8 command)
 {
@@ -813,6 +837,12 @@ static void __init sh_eth_init(struct sh_eth_plat_data *pd)
                msleep(10);
        }
 }
+#else
+static void __init sh_eth_init(struct sh_eth_plat_data *pd)
+{
+       pr_err("unable to read sh_eth MAC address\n");
+}
+#endif
 
 #define PORT_HIZA 0xA4050158
 #define IODRIVEA  0xA405018A
@@ -827,7 +857,8 @@ static int __init arch_setup(void)
        struct clk *clk;
 
        /* register board specific self-refresh code */
-       sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
+       sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
+                                       SUSP_SH_RSTANDBY,
                                        &ecovec24_sdram_enter_start,
                                        &ecovec24_sdram_enter_end,
                                        &ecovec24_sdram_leave_start,
@@ -851,7 +882,7 @@ static int __init arch_setup(void)
        gpio_direction_output(GPIO_PTG1, 0);
        gpio_direction_output(GPIO_PTG2, 0);
        gpio_direction_output(GPIO_PTG3, 0);
-       ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
+       __raw_writew((__raw_readw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
 
        /* enable SH-Eth */
        gpio_request(GPIO_PTA1, NULL);
@@ -871,16 +902,16 @@ static int __init arch_setup(void)
        gpio_request(GPIO_FN_LNKSTA,       NULL);
 
        /* enable USB */
-       ctrl_outw(0x0000, 0xA4D80000);
-       ctrl_outw(0x0000, 0xA4D90000);
+       __raw_writew(0x0000, 0xA4D80000);
+       __raw_writew(0x0000, 0xA4D90000);
        gpio_request(GPIO_PTB3,  NULL);
        gpio_request(GPIO_PTB4,  NULL);
        gpio_request(GPIO_PTB5,  NULL);
        gpio_direction_input(GPIO_PTB3);
        gpio_direction_output(GPIO_PTB4, 0);
        gpio_direction_output(GPIO_PTB5, 0);
-       ctrl_outw(0x0600, 0xa40501d4);
-       ctrl_outw(0x0600, 0xa4050192);
+       __raw_writew(0x0600, 0xa40501d4);
+       __raw_writew(0x0600, 0xa4050192);
 
        if (gpio_get_value(GPIO_PTB3)) {
                printk(KERN_INFO "USB1 function is selected\n");
@@ -921,7 +952,7 @@ static int __init arch_setup(void)
        gpio_request(GPIO_FN_LCDVSYN,  NULL);
        gpio_request(GPIO_FN_LCDDON,   NULL);
        gpio_request(GPIO_FN_LCDLCLK,  NULL);
-       ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
+       __raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA);
 
        gpio_request(GPIO_PTE6, NULL);
        gpio_request(GPIO_PTU1, NULL);
@@ -933,7 +964,7 @@ static int __init arch_setup(void)
        gpio_direction_output(GPIO_PTA2, 0);
 
        /* I/O buffer drive ability is high */
-       ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
+       __raw_writew((__raw_readw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
 
        if (gpio_get_value(GPIO_PTE6)) {
                /* DVI */
@@ -1065,7 +1096,7 @@ static int __init arch_setup(void)
        gpio_direction_output(GPIO_PTB7, 0);
 
        /* I/O buffer drive ability is high for SDHI1 */
-       ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
+       __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
 #else
        /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
        gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
@@ -1103,6 +1134,11 @@ static int __init arch_setup(void)
        gpio_request(GPIO_FN_FSIOBLRCK,  NULL);
        gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
 
+       /* set SPU2 clock to 83.4 MHz */
+       clk = clk_get(NULL, "spu_clk");
+       clk_set_rate(clk, clk_round_rate(clk, 83333333));
+       clk_put(clk);
+
        /* change parent of FSI B */
        clk = clk_get(NULL, "fsib_clk");
        clk_register(&fsimckb_clk);
@@ -1115,6 +1151,21 @@ static int __init arch_setup(void)
        gpio_direction_output(GPIO_PTU0, 0);
        mdelay(20);
 
+       /* enable motion sensor */
+       gpio_request(GPIO_FN_INTC_IRQ1, NULL);
+       gpio_direction_input(GPIO_FN_INTC_IRQ1);
+
+       /* set VPU clock to 166 MHz */
+       clk = clk_get(NULL, "vpu_clk");
+       clk_set_rate(clk, clk_round_rate(clk, 166000000));
+       clk_put(clk);
+
+       /* enable IrDA */
+       gpio_request(GPIO_FN_IRDA_OUT, NULL);
+       gpio_request(GPIO_FN_IRDA_IN,  NULL);
+       gpio_request(GPIO_PTU5, NULL);
+       gpio_direction_output(GPIO_PTU5, 0);
+
        /* enable I2C device */
        i2c_register_board_info(0, i2c0_devices,
                                ARRAY_SIZE(i2c0_devices));
index 83c28bcd4d2a7de7f9a6f176487d1be987c246c6..9893fd3a13587f8e79e4eb9ae6489e79390e83ed 100644 (file)
@@ -64,7 +64,7 @@ static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
 
 unsigned char * __init highlander_plat_irq_setup(void)
 {
-       if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) {
+       if ((__raw_readw(0xa4000700) & 0xf000) == 0x2000) {
                printk(KERN_INFO "Using r7780mp interrupt controller.\n");
                register_intc_controller(&intc_desc);
                return irl2irq;
index b721e86b5af4b226c59a7d44ef75d121e83254f6..0805b2151452caaaa46a776228d61a3127b15976 100644 (file)
@@ -57,7 +57,7 @@ static DECLARE_INTC_DESC(intc_desc, "r7780rp", vectors,
 
 unsigned char * __init highlander_plat_irq_setup(void)
 {
-       if (ctrl_inw(0xa5000600)) {
+       if (__raw_readw(0xa5000600)) {
                printk(KERN_INFO "Using r7780rp interrupt controller.\n");
                register_intc_controller(&intc_desc);
                return irl2irq;
index 3811b060a39b4f922b62456470eb0bb043d4f6f8..558b248627768d9fbd9bb68fa026853184c14edc 100644 (file)
@@ -66,20 +66,20 @@ static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
 
 unsigned char * __init highlander_plat_irq_setup(void)
 {
-       if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000)
+       if ((__raw_readw(0xa4000158) & 0xf000) != 0x1000)
                return NULL;
 
        printk(KERN_INFO "Using r7785rp interrupt controller.\n");
 
-       ctrl_outw(0x0000, PA_IRLSSR1);  /* FPGA IRLSSR1(CF_CD clear) */
+       __raw_writew(0x0000, PA_IRLSSR1);       /* FPGA IRLSSR1(CF_CD clear) */
 
        /* Setup the FPGA IRL */
-       ctrl_outw(0x0000, PA_IRLPRA);   /* FPGA IRLA */
-       ctrl_outw(0xe598, PA_IRLPRB);   /* FPGA IRLB */
-       ctrl_outw(0x7060, PA_IRLPRC);   /* FPGA IRLC */
-       ctrl_outw(0x0000, PA_IRLPRD);   /* FPGA IRLD */
-       ctrl_outw(0x4321, PA_IRLPRE);   /* FPGA IRLE */
-       ctrl_outw(0xdcba, PA_IRLPRF);   /* FPGA IRLF */
+       __raw_writew(0x0000, PA_IRLPRA);        /* FPGA IRLA */
+       __raw_writew(0xe598, PA_IRLPRB);        /* FPGA IRLB */
+       __raw_writew(0x7060, PA_IRLPRC);        /* FPGA IRLC */
+       __raw_writew(0x0000, PA_IRLPRD);        /* FPGA IRLD */
+       __raw_writew(0x4321, PA_IRLPRE);        /* FPGA IRLE */
+       __raw_writew(0xdcba, PA_IRLPRF);        /* FPGA IRLF */
 
        register_intc_controller(&intc_desc);
        return irl2irq;
index 37b1a2ee71a5398685b1579ad3a67170fc94a2e3..522786318d36c4f5dbee20c8cbdee94009bbf201 100644 (file)
@@ -24,7 +24,7 @@ static irqreturn_t psw_irq_handler(int irq, void *arg)
        unsigned int l, mask;
        int ret = 0;
 
-       l = ctrl_inw(PA_DBSW);
+       l = __raw_readw(PA_DBSW);
 
        /* Nothing to do if there's no state change */
        if (psw->state) {
@@ -45,7 +45,7 @@ static irqreturn_t psw_irq_handler(int irq, void *arg)
 out:
        /* Clear the switch IRQs */
        l |= (0x7 << 12);
-       ctrl_outw(l, PA_DBSW);
+       __raw_writew(l, PA_DBSW);
 
        return IRQ_RETVAL(ret);
 }
index f663c14d88857b86c7fa091726dd10df5ef33564..affd66747ba3dadaf441098fd85ac40da9cbb695 100644 (file)
@@ -311,13 +311,13 @@ device_initcall(r7780rp_devices_setup);
  */
 static int ivdr_clk_enable(struct clk *clk)
 {
-       ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
+       __raw_writew(__raw_readw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
        return 0;
 }
 
 static void ivdr_clk_disable(struct clk *clk)
 {
-       ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
+       __raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
 }
 
 static struct clk_ops ivdr_clk_ops = {
@@ -337,7 +337,7 @@ static struct clk *r7780rp_clocks[] = {
 static void r7780rp_power_off(void)
 {
        if (mach_is_r7780mp() || mach_is_r7785rp())
-               ctrl_outw(0x0001, PA_POFF);
+               __raw_writew(0x0001, PA_POFF);
 }
 
 /*
@@ -345,7 +345,7 @@ static void r7780rp_power_off(void)
  */
 static void __init highlander_setup(char **cmdline_p)
 {
-       u16 ver = ctrl_inw(PA_VERREG);
+       u16 ver = __raw_readw(PA_VERREG);
        int i;
 
        printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
@@ -370,12 +370,12 @@ static void __init highlander_setup(char **cmdline_p)
                clk_enable(clk);
        }
 
-       ctrl_outw(0x0000, PA_OBLED);    /* Clear LED. */
+       __raw_writew(0x0000, PA_OBLED); /* Clear LED. */
 
        if (mach_is_r7780rp())
-               ctrl_outw(0x0001, PA_SDPOW);    /* SD Power ON */
+               __raw_writew(0x0001, PA_SDPOW); /* SD Power ON */
 
-       ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);     /* Si13112 */
+       __raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);       /* Si13112 */
 
        pm_power_off = r7780rp_power_off;
 }
index e85212faf40a8c1bfea2635e1de6dee710f1ce0c..b49535c0ddd9f528d90eacf6fdfc82209294e1f5 100644 (file)
@@ -53,7 +53,7 @@ static void hp6x0_apm_get_power_status(struct apm_power_info *info)
        info->ac_line_status = (battery > HP680_BATTERY_AC_ON) ?
                         APM_AC_ONLINE : APM_AC_OFFLINE;
 
-       pgdr = ctrl_inb(PGDR);
+       pgdr = __raw_readb(PGDR);
        if (pgdr & PGDR_MAIN_BATTERY_OUT) {
                info->battery_status    = APM_BATTERY_STATUS_NOT_PRESENT;
                info->battery_flag      = 0x80;
index d936c1af7620263244d6471fb4890432a0b54184..4499a3749d40fba67e53991d9b2a50f884b97755 100644 (file)
@@ -53,17 +53,17 @@ static void pm_enter(void)
        sh_wdt_write_cnt(0);
 
        /* disable PLL1 */
-       frqcr = ctrl_inw(FRQCR);
+       frqcr = __raw_readw(FRQCR);
        frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
-       ctrl_outw(frqcr, FRQCR);
+       __raw_writew(frqcr, FRQCR);
 
        /* enable standby */
-       stbcr = ctrl_inb(STBCR);
-       ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
+       stbcr = __raw_readb(STBCR);
+       __raw_writeb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
 
        /* set self-refresh */
-       mcr = ctrl_inw(MCR);
-       ctrl_outw(mcr & ~MCR_RFSH, MCR);
+       mcr = __raw_readw(MCR);
+       __raw_writew(mcr & ~MCR_RFSH, MCR);
 
        /* set interrupt handler */
        asm volatile("stc vbr, %0" : "=r" (vbr_old));
@@ -73,8 +73,8 @@ static void pm_enter(void)
               &wakeup_start, &wakeup_end - &wakeup_start);
        asm volatile("ldc %0, vbr" : : "r" (vbr_new));
 
-       ctrl_outw(0, RTCNT);
-       ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
+       __raw_writew(0, RTCNT);
+       __raw_writew(mcr | MCR_RFSH | MCR_RMODE, MCR);
 
        cpu_sleep();
 
@@ -83,14 +83,14 @@ static void pm_enter(void)
        free_page(vbr_new);
 
        /* enable PLL1 */
-       frqcr = ctrl_inw(FRQCR);
+       frqcr = __raw_readw(FRQCR);
        frqcr |= FRQCR_PSTBY;
-       ctrl_outw(frqcr, FRQCR);
+       __raw_writew(frqcr, FRQCR);
        udelay(50);
        frqcr |= FRQCR_PLLEN;
-       ctrl_outw(frqcr, FRQCR);
+       __raw_writew(frqcr, FRQCR);
 
-       ctrl_outb(stbcr, STBCR);
+       __raw_writeb(stbcr, STBCR);
 
        clear_bl_bit();
 }
@@ -115,21 +115,21 @@ static int hp6x0_pm_enter(suspend_state_t state)
        outw(hd64461_stbcr, HD64461_STBCR);
 #endif
 
-       ctrl_outb(0x1f, DACR);
+       __raw_writeb(0x1f, DACR);
 
-       stbcr = ctrl_inb(STBCR);
-       ctrl_outb(0x01, STBCR);
+       stbcr = __raw_readb(STBCR);
+       __raw_writeb(0x01, STBCR);
 
-       stbcr2 = ctrl_inb(STBCR2);
-       ctrl_outb(0x7f , STBCR2);
+       stbcr2 = __raw_readb(STBCR2);
+       __raw_writeb(0x7f , STBCR2);
 
        outw(0xf07f, HD64461_SCPUCR);
 
        pm_enter();
 
        outw(0, HD64461_SCPUCR);
-       ctrl_outb(stbcr, STBCR);
-       ctrl_outb(stbcr2, STBCR2);
+       __raw_writeb(stbcr, STBCR);
+       __raw_writeb(stbcr2, STBCR2);
 
 #ifdef CONFIG_HD64461_ENABLER
        hd64461_stbcr = inw(HD64461_STBCR);
index e6dd5e96321e1e1a7d8f31eaea28d76ca8a7a6ef..8c9add5f4cfae08facb9bba4e525dd7713083b5c 100644 (file)
@@ -149,19 +149,19 @@ static void __init hp6xx_setup(char **cmdline_p)
 
        sh_dac_output(0, DAC_SPEAKER_VOLUME);
        sh_dac_disable(DAC_SPEAKER_VOLUME);
-       v8 = ctrl_inb(DACR);
+       v8 = __raw_readb(DACR);
        v8 &= ~DACR_DAE;
-       ctrl_outb(v8,DACR);
+       __raw_writeb(v8,DACR);
 
-       v8 = ctrl_inb(SCPDR);
+       v8 = __raw_readb(SCPDR);
        v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
        v8 &= ~SCPDR_TS_SCAN_ENABLE;
-       ctrl_outb(v8, SCPDR);
+       __raw_writeb(v8, SCPDR);
 
-       v = ctrl_inw(SCPCR);
+       v = __raw_readw(SCPCR);
        v &= ~SCPCR_TS_MASK;
        v |= SCPCR_TS_ENABLE;
-       ctrl_outw(v, SCPCR);
+       __raw_writew(v, SCPCR);
 }
 device_initcall(hp6xx_devices_setup);
 
index 5d7b5d92475e46227b5b4c0e932a78f37ad0697f..b2cd0ed8664efff8697fb54c4702384cc211f0d9 100644 (file)
@@ -282,7 +282,7 @@ static int camera_power(struct device *dev, int mode)
                 * use 1.8 V for VccQ_VIO
                 * use 2.85V for VccQ_SR
                 */
-               ctrl_outw((ctrl_inw(DRVCRB) & ~0x0003) | 0x0001, DRVCRB);
+               __raw_writew((__raw_readw(DRVCRB) & ~0x0003) | 0x0001, DRVCRB);
 
                /* reset clear */
                ret = gpio_request(GPIO_PTB4, NULL);
@@ -351,7 +351,7 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 101,
+               .start  = 100,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -492,13 +492,13 @@ static int kfr2r09_usb0_gadget_setup(void)
        if (kfr2r09_usb0_gadget_i2c_setup() != 0)
                return -ENODEV; /* unable to configure using i2c */
 
-       ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
+       __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
        gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
        gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
        gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
        msleep(20); /* wait 20ms to let the clock settle */
        clk_enable(clk_get(NULL, "usb0"));
-       ctrl_outw(0x0600, 0xa40501d4);
+       __raw_writew(0x0600, 0xa40501d4);
 
        return 0;
 }
@@ -526,12 +526,12 @@ static int __init kfr2r09_devices_setup(void)
        gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
 
        /* setup NOR flash at CS0 */
-       ctrl_outl(0x36db0400, BSC_CS0BCR);
-       ctrl_outl(0x00000500, BSC_CS0WCR);
+       __raw_writel(0x36db0400, BSC_CS0BCR);
+       __raw_writel(0x00000500, BSC_CS0WCR);
 
        /* setup NAND flash at CS4 */
-       ctrl_outl(0x36db0400, BSC_CS4BCR);
-       ctrl_outl(0x00000500, BSC_CS4WCR);
+       __raw_writel(0x36db0400, BSC_CS4BCR);
+       __raw_writel(0x00000500, BSC_CS4WCR);
 
        /* setup KEYSC pins */
        gpio_request(GPIO_FN_KEYOUT0, NULL);
index 528013188196faae625b7202cb45b56e85b81592..01e6abb769b9ede9d901df10e2161ac0c106cd34 100644 (file)
@@ -76,39 +76,39 @@ static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                break;
 
        case GIODRV_IOCSGIODATA1:       /* write byte */
-               ctrl_outb((unsigned char)(0x0ff & data), addr);
+               __raw_writeb((unsigned char)(0x0ff & data), addr);
                break;
 
        case GIODRV_IOCSGIODATA2:       /* write word */
                if (addr & 0x01) {
                        return -EFAULT;
                }
-               ctrl_outw((unsigned short int)(0x0ffff & data), addr);
+               __raw_writew((unsigned short int)(0x0ffff & data), addr);
                break;
 
        case GIODRV_IOCSGIODATA4:       /* write long */
                if (addr & 0x03) {
                        return -EFAULT;
                }
-               ctrl_outl(data, addr);
+               __raw_writel(data, addr);
                break;
 
        case GIODRV_IOCGGIODATA1:       /* read byte */
-               data = ctrl_inb(addr);
+               data = __raw_readb(addr);
                break;
 
        case GIODRV_IOCGGIODATA2:       /* read word */
                if (addr & 0x01) {
                        return -EFAULT;
                }
-               data = ctrl_inw(addr);
+               data = __raw_readw(addr);
                break;
 
        case GIODRV_IOCGGIODATA4:       /* read long */
                if (addr & 0x03) {
                        return -EFAULT;
                }
-               data = ctrl_inl(addr);
+               data = __raw_readl(addr);
                break;
        default:
                return -EFAULT;
index 7b284cde1f586c93436a5bd6cf328b06936d4932..96f38a4187d0f95fb61fe7fbe3b919bbe0ec0ae8 100644 (file)
@@ -22,14 +22,14 @@ static void disable_landisk_irq(unsigned int irq)
 {
        unsigned char mask = 0xff ^ (0x01 << (irq - 5));
 
-       ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
+       __raw_writeb(__raw_readb(PA_IMASK) & mask, PA_IMASK);
 }
 
 static void enable_landisk_irq(unsigned int irq)
 {
        unsigned char value = (0x01 << (irq - 5));
 
-       ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
+       __raw_writeb(__raw_readb(PA_IMASK) | value, PA_IMASK);
 }
 
 static struct irq_chip landisk_irq_chip __read_mostly = {
@@ -52,5 +52,5 @@ void __init init_landisk_IRQ(void)
                                              handle_level_irq, "level");
                enable_landisk_irq(i);
        }
-       ctrl_outb(0x00, PA_PWRINT_CLR);
+       __raw_writeb(0x00, PA_PWRINT_CLR);
 }
index e6b0efa098d1d70b00b0b136ab6d832dd90977ce..bef83522f958c25ed186dc21187963607757ed89 100644 (file)
@@ -25,7 +25,7 @@ static irqreturn_t psw_irq_handler(int irq, void *arg)
        unsigned int sw_value;
        int ret = 0;
 
-       sw_value = (0x0ff & (~ctrl_inb(PA_STATUS)));
+       sw_value = (0x0ff & (~__raw_readb(PA_STATUS)));
 
        /* Nothing to do if there's no state change */
        if (psw->state) {
@@ -42,7 +42,7 @@ static irqreturn_t psw_irq_handler(int irq, void *arg)
 
 out:
        /* Clear the switch IRQs */
-       ctrl_outb(0x00, PA_PWRINT_CLR);
+       __raw_writeb(0x00, PA_PWRINT_CLR);
 
        return IRQ_RETVAL(ret);
 }
index db22ea2e6d4942454f7e9ad231033ff970d85f2f..50337acc18c5aa9d80b9e0fa832c7c9da57a7487 100644 (file)
@@ -25,7 +25,7 @@ void init_landisk_IRQ(void);
 
 static void landisk_power_off(void)
 {
-        ctrl_outb(0x01, PA_SHUTDOWN);
+        __raw_writeb(0x01, PA_SHUTDOWN);
 }
 
 static struct resource cf_ide_resources[3];
@@ -63,7 +63,7 @@ static int __init landisk_devices_setup(void)
        /* open I/O area window */
        paddrbase = virt_to_phys((void *)PA_AREA5_IO);
        prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-       cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
+       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
        if (!cf_ide_base) {
                printk("allocate_cf_area : can't open CF I/O window!\n");
                return -ENOMEM;
@@ -88,7 +88,7 @@ __initcall(landisk_devices_setup);
 static void __init landisk_setup(char **cmdline_p)
 {
         /* LED ON */
-       ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
+       __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 
        printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
        pm_power_off = landisk_power_off;
index 2b0b5818e1e477d23ea6a95529a560b736a73e25..79b4e0d77b716e6141b8f05076aa7713c8602e86 100644 (file)
@@ -56,8 +56,8 @@ static int __init lboxre2_devices_setup(void)
        /* open I/O area window */
        paddrbase = virt_to_phys((void*)PA_AREA5_IO);
        psize = PAGE_SIZE;
-       prot = PAGE_KERNEL_PCC( 1 , _PAGE_PCC_IO16);
-       cf0_io_base = (u32)p3_ioremap(paddrbase, psize, prot.pgprot);
+       prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
+       cf0_io_base = (u32)ioremap_prot(paddrbase, psize, pgprot_val(prot));
        if (!cf0_io_base) {
                printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ );
                return -ENOMEM;
index 52dd748211c769607f99834913261340eba3f143..2960c659020ee92e6c60c5c1d16d8d05ab73e267 100644 (file)
@@ -141,10 +141,10 @@ static inline void delay(void)
 #if defined(CONFIG_PCI)
        /* System board present, just make a dummy SRAM access.  (CS0 will be
           mapped to PCI memory, probably good to avoid it.) */
-       ctrl_inw(0xa6800000);
+       __raw_readw(0xa6800000);
 #else
        /* CS0 will be mapped to flash, ROM etc so safe to access it. */
-       ctrl_inw(0xa0000000);
+       __raw_readw(0xa0000000);
 #endif
 }
 
index b551963579c1c792f21bd4cc61abc381f6103a0b..a26d16669aa2e377928cc606eaf144205ac150a1 100644 (file)
@@ -88,7 +88,7 @@ static void disable_microdev_irq(unsigned int irq)
        fpgaIrq = fpgaIrqTable[irq].fpgaIrq;
 
        /* disable interrupts on the FPGA INTC register */
-       ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG);
+       __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG);
 }
 
 static void enable_microdev_irq(unsigned int irq)
@@ -107,13 +107,13 @@ static void enable_microdev_irq(unsigned int irq)
        priorityReg = MICRODEV_FPGA_INTPRI_REG(fpgaIrq);
 
        /* set priority for the interrupt */
-       priorities = ctrl_inl(priorityReg);
+       priorities = __raw_readl(priorityReg);
        priorities &= ~MICRODEV_FPGA_INTPRI_MASK(fpgaIrq);
        priorities |= MICRODEV_FPGA_INTPRI_LEVEL(fpgaIrq, pri);
-       ctrl_outl(priorities, priorityReg);
+       __raw_writel(priorities, priorityReg);
 
        /* enable interrupts on the FPGA INTC register */
-       ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
+       __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
 }
 
 /* This function sets the desired irq handler to be a MicroDev type */
@@ -134,7 +134,7 @@ extern void __init init_microdev_irq(void)
        int i;
 
        /* disable interrupts on the FPGA INTC register */
-       ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG);
+       __raw_writel(~0ul, MICRODEV_FPGA_INTDSB_REG);
 
        for (i = 0; i < NUM_EXTERNAL_IRQS; i++)
                make_microdev_irq(i);
index 507c77be476d649c454f6b0b0653df1ca8ce907f..be300aaca6fed6ceea4c8ddfe64c3b3190f1384e 100644 (file)
@@ -397,7 +397,7 @@ static struct resource sdhi_cn9_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 101,
+               .start  = 100,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = {
 };
 
 static struct ov772x_camera_info ov7725_info = {
-       .buswidth       = SOCAM_DATAWIDTH_8,
+       .flags          = OV772X_FLAG_8BIT,
 };
 
 static struct soc_camera_link ov7725_link = {
@@ -496,28 +496,16 @@ static int __init migor_devices_setup(void)
                                        &migor_sdram_enter_end,
                                        &migor_sdram_leave_start,
                                        &migor_sdram_leave_end);
-#ifdef CONFIG_PM
        /* Let D11 LED show STATUS0 */
        gpio_request(GPIO_FN_STATUS0, NULL);
 
        /* Lit D12 LED show PDSTATUS */
        gpio_request(GPIO_FN_PDSTATUS, NULL);
-#else
-       /* Lit D11 LED */
-       gpio_request(GPIO_PTJ7, NULL);
-       gpio_direction_output(GPIO_PTJ7, 1);
-       gpio_export(GPIO_PTJ7, 0);
-
-       /* Lit D12 LED */
-       gpio_request(GPIO_PTJ5, NULL);
-       gpio_direction_output(GPIO_PTJ5, 1);
-       gpio_export(GPIO_PTJ5, 0);
-#endif
 
        /* SMC91C111 - Enable IRQ0, Setup CS4 for 16-bit fast access */
        gpio_request(GPIO_FN_IRQ0, NULL);
-       ctrl_outl(0x00003400, BSC_CS4BCR);
-       ctrl_outl(0x00110080, BSC_CS4WCR);
+       __raw_writel(0x00003400, BSC_CS4BCR);
+       __raw_writel(0x00110080, BSC_CS4WCR);
 
        /* KEYSC */
        gpio_request(GPIO_FN_KEYOUT0, NULL);
@@ -533,7 +521,7 @@ static int __init migor_devices_setup(void)
 
        /* NAND Flash */
        gpio_request(GPIO_FN_CS6A_CE2B, NULL);
-       ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
+       __raw_writel((__raw_readl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
        gpio_request(GPIO_PTA1, NULL);
        gpio_direction_input(GPIO_PTA1);
 
@@ -627,7 +615,7 @@ static int __init migor_devices_setup(void)
 #else
        gpio_direction_output(GPIO_PTT0, 1);
 #endif
-       ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2000, PORT_MSELCRB); /* D15->D8 */
+       __raw_writew(__raw_readw(PORT_MSELCRB) | 0x2000, PORT_MSELCRB); /* D15->D8 */
 
        platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20);
 
index 78d7b27c80da0cd0d5364fcbaac57905cc872a61..574f009c3c31099437d581250449f60d7264119d 100644 (file)
@@ -129,7 +129,7 @@ void __init init_rts7751r2d_IRQ(void)
 {
        struct intc_desc *d;
 
-       switch (ctrl_inw(PA_VERREG) & 0xf0) {
+       switch (__raw_readw(PA_VERREG) & 0xf0) {
 #ifdef CONFIG_RTS7751R2D_PLUS
        case 0x10:
                printk(KERN_INFO "Using R2D-PLUS interrupt controller.\n");
@@ -147,7 +147,7 @@ void __init init_rts7751r2d_IRQ(void)
 #endif
        default:
                printk(KERN_INFO "Unknown R2D interrupt controller 0x%04x\n",
-                      ctrl_inw(PA_VERREG));
+                      __raw_readw(PA_VERREG));
                return;
        }
 
index a625ecb93e47ee55a6300c87986c17445ad9f0a3..b84df6a3a93c3af0c225c21fb3a3e594c4bffa6c 100644 (file)
@@ -70,7 +70,7 @@ static struct spi_board_info spi_bus[] = {
 static void r2d_chip_select(struct sh_spi_info *spi, int cs, int state)
 {
        BUG_ON(cs != 0);  /* Single Epson RTC-9701JE attached on CS0 */
-       ctrl_outw(state == BITBANG_CS_ACTIVE, PA_RTCCE);
+       __raw_writew(state == BITBANG_CS_ACTIVE, PA_RTCCE);
 }
 
 static struct sh_spi_info spi_info = {
@@ -262,7 +262,7 @@ __initcall(rts7751r2d_devices_setup);
 
 static void rts7751r2d_power_off(void)
 {
-       ctrl_outw(0x0001, PA_POWOFF);
+       __raw_writew(0x0001, PA_POWOFF);
 }
 
 /*
@@ -271,14 +271,14 @@ static void rts7751r2d_power_off(void)
 static void __init rts7751r2d_setup(char **cmdline_p)
 {
        void __iomem *sm501_reg;
-       u16 ver = ctrl_inw(PA_VERREG);
+       u16 ver = __raw_readw(PA_VERREG);
 
        printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
 
        printk(KERN_INFO "FPGA version:%d (revision:%d)\n",
                                        (ver >> 4) & 0xf, ver & 0xf);
 
-       ctrl_outw(0x0000, PA_OUTPORT);
+       __raw_writew(0x0000, PA_OUTPORT);
        pm_power_off = rts7751r2d_power_off;
 
        /* sm501 dram configuration:
index c37617e6322031d892d33ed3b4266fdc62e4f9ca..4fa08ba10253b40b0088e280a6f60ee6d22cee78 100644 (file)
@@ -96,7 +96,7 @@ static int __init rsk7203_devices_setup(void)
        gpio_request(GPIO_FN_RXD0, NULL);
 
        /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
-       ctrl_outl(0x36db0400, 0xfffc0008); /* CS1BCR */
+       __raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */
        gpio_request(GPIO_FN_IRQ0_PB, NULL);
 
        return platform_add_devices(rsk7203_devices,
index 855558163c58686c62c4830be9b4bbe6d3b485bd..e5f7564f2511f0aa623cf6b17a3037e925e2f703 100644 (file)
@@ -37,9 +37,9 @@ void __init init_sdk7780_IRQ(void)
 {
        printk(KERN_INFO "Using SDK7780 interrupt controller.\n");
 
-       ctrl_outw(0xFFFF, FPGA_IRQ0MR);
+       __raw_writew(0xFFFF, FPGA_IRQ0MR);
        /* Setup IRL 0-3 */
-       ctrl_outw(0x0003, FPGA_IMSR);
+       __raw_writew(0x0003, FPGA_IMSR);
        plat_irq_setup_pins(IRQ_MODE_IRL3210);
 
        register_intc_controller(&fpga_intc_desc);
index aad94a78dc702a3c98b3673d0d99f9596cc48dc0..4da38db4b5fef3c49cf85528fdae54814db8360b 100644 (file)
 
 #define GPIO_PECR        0xFFEA0008
 
-//* Heartbeat */
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
-};
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+/* Heartbeat */
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev = {
-               .platform_data = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* SMC91x */
@@ -83,8 +74,8 @@ device_initcall(sdk7780_devices_setup);
 
 static void __init sdk7780_setup(char **cmdline_p)
 {
-       u16 ver = ctrl_inw(FPGA_FPVERR);
-       u16 dateStamp = ctrl_inw(FPGA_FPDATER);
+       u16 ver = __raw_readw(FPGA_FPVERR);
+       u16 dateStamp = __raw_readw(FPGA_FPDATER);
 
        printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
        printk(KERN_INFO "Board version: %d (revision %d), "
@@ -94,7 +85,7 @@ static void __init sdk7780_setup(char **cmdline_p)
                         dateStamp);
 
        /* Setup pin mux'ing for PCIC */
-       ctrl_outw(0x0000, GPIO_PECR);
+       __raw_writew(0x0000, GPIO_PECR);
 }
 
 /*
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile
new file mode 100644 (file)
index 0000000..a29f19e
--- /dev/null
@@ -0,0 +1 @@
+obj-y  := setup.o fpga.o irq.o
diff --git a/arch/sh/boards/mach-sdk7786/fpga.c b/arch/sh/boards/mach-sdk7786/fpga.c
new file mode 100644 (file)
index 0000000..3e4ec66
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * SDK7786 FPGA Support.
+ *
+ * Copyright (C) 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/bcd.h>
+#include <mach/fpga.h>
+#include <asm/sizes.h>
+
+#define FPGA_REGS_OFFSET       0x03fff800
+#define FPGA_REGS_SIZE         0x490
+
+/*
+ * The FPGA can be mapped in any of the generally available areas,
+ * so we attempt to scan for it using the fixed SRSTR read magic.
+ *
+ * Once the FPGA is located, the rest of the mapping data for the other
+ * components can be determined dynamically from its section mapping
+ * registers.
+ */
+static void __iomem *sdk7786_fpga_probe(void)
+{
+       unsigned long area;
+       void __iomem *base;
+
+       /*
+        * Iterate over all of the areas where the FPGA could be mapped.
+        * The possible range is anywhere from area 0 through 6, area 7
+        * is reserved.
+        */
+       for (area = PA_AREA0; area < PA_AREA7; area += SZ_64M) {
+               base = ioremap_nocache(area + FPGA_REGS_OFFSET, FPGA_REGS_SIZE);
+               if (!base) {
+                       /* Failed to remap this area, move along. */
+                       continue;
+               }
+
+               if (ioread16(base + SRSTR) == SRSTR_MAGIC)
+                       return base;    /* Found it! */
+
+               iounmap(base);
+       }
+
+       return NULL;
+}
+
+void __iomem *sdk7786_fpga_base;
+
+void __init sdk7786_fpga_init(void)
+{
+       u16 version, date;
+
+       sdk7786_fpga_base = sdk7786_fpga_probe();
+       if (unlikely(!sdk7786_fpga_base)) {
+               panic("FPGA detection failed.\n");
+               return;
+       }
+
+       version = fpga_read_reg(FPGAVR);
+       date = fpga_read_reg(FPGADR);
+
+       pr_info("\tFPGA version:\t%d.%d (built on %d/%d/%d)\n",
+               bcd2bin(version >> 8) & 0xf, bcd2bin(version & 0xf),
+               ((date >> 12) & 0xf) + 2000,
+               (date >> 8) & 0xf, bcd2bin(date & 0xff));
+}
diff --git a/arch/sh/boards/mach-sdk7786/irq.c b/arch/sh/boards/mach-sdk7786/irq.c
new file mode 100644 (file)
index 0000000..46943a0
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * SDK7786 FPGA IRQ Controller Support.
+ *
+ * Copyright (C) 2010  Matt Fleming
+ * Copyright (C) 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/irq.h>
+#include <mach/fpga.h>
+#include <mach/irq.h>
+
+enum {
+       ATA_IRQ_BIT             = 1,
+       SPI_BUSY_BIT            = 2,
+       LIRQ5_BIT               = 3,
+       LIRQ6_BIT               = 4,
+       LIRQ7_BIT               = 5,
+       LIRQ8_BIT               = 6,
+       KEY_IRQ_BIT             = 7,
+       PEN_IRQ_BIT             = 8,
+       ETH_IRQ_BIT             = 9,
+       RTC_ALARM_BIT           = 10,
+       CRYSTAL_FAIL_BIT        = 12,
+       ETH_PME_BIT             = 14,
+};
+
+void __init sdk7786_init_irq(void)
+{
+       unsigned int tmp;
+
+       /* Enable priority encoding for all IRLs */
+       fpga_write_reg(fpga_read_reg(INTMSR) | 0x0303, INTMSR);
+
+       /* Clear FPGA interrupt status registers */
+       fpga_write_reg(0x0000, INTASR);
+       fpga_write_reg(0x0000, INTBSR);
+
+       /* Unmask FPGA interrupts */
+       tmp = fpga_read_reg(INTAMR);
+       tmp &= ~(1 << ETH_IRQ_BIT);
+       fpga_write_reg(tmp, INTAMR);
+
+       plat_irq_setup_pins(IRQ_MODE_IRL7654_MASK);
+       plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK);
+}
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
new file mode 100644 (file)
index 0000000..f094ea2
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Renesas Technology Europe SDK7786 Support.
+ *
+ * Copyright (C) 2010  Matt Fleming
+ * Copyright (C) 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/smsc911x.h>
+#include <linux/i2c.h>
+#include <linux/irq.h>
+#include <linux/clk.h>
+#include <mach/fpga.h>
+#include <mach/irq.h>
+#include <asm/machvec.h>
+#include <asm/heartbeat.h>
+#include <asm/sizes.h>
+#include <asm/reboot.h>
+
+static struct resource heartbeat_resource = {
+       .start          = 0x07fff8b0,
+       .end            = 0x07fff8b0 + sizeof(u16) - 1,
+       .flags          = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
+};
+
+static struct platform_device heartbeat_device = {
+       .name           = "heartbeat",
+       .id             = -1,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
+};
+
+static struct resource smsc911x_resources[] = {
+       [0] = {
+               .name           = "smsc911x-memory",
+               .start          = 0x07ffff00,
+               .end            = 0x07ffff00 + SZ_256 - 1,
+               .flags          = IORESOURCE_MEM,
+       },
+       [1] = {
+               .name           = "smsc911x-irq",
+               .start          = evt2irq(0x2c0),
+               .end            = evt2irq(0x2c0),
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct smsc911x_platform_config smsc911x_config = {
+       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+       .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
+       .flags          = SMSC911X_USE_32BIT,
+       .phy_interface  = PHY_INTERFACE_MODE_MII,
+};
+
+static struct platform_device smsc911x_device = {
+       .name           = "smsc911x",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(smsc911x_resources),
+       .resource       = smsc911x_resources,
+       .dev = {
+               .platform_data = &smsc911x_config,
+       },
+};
+
+static struct resource smbus_fpga_resource = {
+       .start          = 0x07fff9e0,
+       .end            = 0x07fff9e0 + SZ_32 - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device smbus_fpga_device = {
+       .name           = "i2c-sdk7786",
+       .id             = 0,
+       .num_resources  = 1,
+       .resource       = &smbus_fpga_resource,
+};
+
+static struct resource smbus_pcie_resource = {
+       .start          = 0x07fffc30,
+       .end            = 0x07fffc30 + SZ_32 - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device smbus_pcie_device = {
+       .name           = "i2c-sdk7786",
+       .id             = 1,
+       .num_resources  = 1,
+       .resource       = &smbus_pcie_resource,
+};
+
+static struct i2c_board_info __initdata sdk7786_i2c_devices[] = {
+       {
+               I2C_BOARD_INFO("max6900", 0x68),
+       },
+};
+
+static struct platform_device *sh7786_devices[] __initdata = {
+       &heartbeat_device,
+       &smsc911x_device,
+       &smbus_fpga_device,
+       &smbus_pcie_device,
+};
+
+static int sdk7786_i2c_setup(void)
+{
+       unsigned int tmp;
+
+       /*
+        * Hand over I2C control to the FPGA.
+        */
+       tmp = fpga_read_reg(SBCR);
+       tmp &= ~SCBR_I2CCEN;
+       tmp |= SCBR_I2CMEN;
+       fpga_write_reg(tmp, SBCR);
+
+       return i2c_register_board_info(0, sdk7786_i2c_devices,
+                                      ARRAY_SIZE(sdk7786_i2c_devices));
+}
+
+static int __init sdk7786_devices_setup(void)
+{
+       int ret;
+
+       ret = platform_add_devices(sh7786_devices, ARRAY_SIZE(sh7786_devices));
+       if (unlikely(ret != 0))
+               return ret;
+
+       return sdk7786_i2c_setup();
+}
+__initcall(sdk7786_devices_setup);
+
+static int sdk7786_mode_pins(void)
+{
+       return fpga_read_reg(MODSWR);
+}
+
+static int sdk7786_clk_init(void)
+{
+       struct clk *clk;
+       int ret;
+
+       /*
+        * Only handle the EXTAL case, anyone interfacing a crystal
+        * resonator will need to provide their own input clock.
+        */
+       if (test_mode_pin(MODE_PIN9))
+               return -EINVAL;
+
+       clk = clk_get(NULL, "extal");
+       if (!clk || IS_ERR(clk))
+               return PTR_ERR(clk);
+       ret = clk_set_rate(clk, 33333333);
+       clk_put(clk);
+
+       return ret;
+}
+
+static void sdk7786_restart(char *cmd)
+{
+       fpga_write_reg(0xa5a5, SRSTR);
+}
+
+/* Initialize the board */
+static void __init sdk7786_setup(char **cmdline_p)
+{
+       pr_info("Renesas Technology Europe SDK7786 support:\n");
+
+       sdk7786_fpga_init();
+
+       pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
+
+       machine_ops.restart = sdk7786_restart;
+}
+
+/*
+ * The Machine Vector
+ */
+static struct sh_machine_vector mv_sdk7786 __initmv = {
+       .mv_name                = "SDK7786",
+       .mv_setup               = sdk7786_setup,
+       .mv_mode_pins           = sdk7786_mode_pins,
+       .mv_clk_init            = sdk7786_clk_init,
+       .mv_init_irq            = sdk7786_init_irq,
+};
index 180455642a432ce08bd639f02b06826209cd9ac5..adadc77532ee247154ed7cfabd9bcb7ef617bf5f 100644 (file)
@@ -16,7 +16,7 @@
 
 static inline void delay(void)
 {
-       ctrl_inw(0x20000000);  /* P2 ROM Area */
+       __raw_readw(0x20000000);  /* P2 ROM Area */
 }
 
 /* MS7750 requires special versions of in*, out* routines, since
index aef7f052851a30ef96f278258f3aecd5ce63557b..8d82175d83ab139a6a00d5b29ebf62f0ca6ebe21 100644 (file)
@@ -32,12 +32,12 @@ static void disable_se7206_irq(unsigned int irq)
        unsigned short msk0,msk1;
 
        /* Set the priority in IPR to 0 */
-       val = ctrl_inw(INTC_IPR01);
+       val = __raw_readw(INTC_IPR01);
        val &= mask;
-       ctrl_outw(val, INTC_IPR01);
+       __raw_writew(val, INTC_IPR01);
        /* FPGA mask set */
-       msk0 = ctrl_inw(INTMSK0);
-       msk1 = ctrl_inw(INTMSK1);
+       msk0 = __raw_readw(INTMSK0);
+       msk1 = __raw_readw(INTMSK1);
 
        switch (irq) {
        case IRQ0_IRQ:
@@ -51,8 +51,8 @@ static void disable_se7206_irq(unsigned int irq)
                msk1 |= 0x00ff;
                break;
        }
-       ctrl_outw(msk0, INTMSK0);
-       ctrl_outw(msk1, INTMSK1);
+       __raw_writew(msk0, INTMSK0);
+       __raw_writew(msk1, INTMSK1);
 }
 
 static void enable_se7206_irq(unsigned int irq)
@@ -62,13 +62,13 @@ static void enable_se7206_irq(unsigned int irq)
        unsigned short msk0,msk1;
 
        /* Set priority in IPR back to original value */
-       val = ctrl_inw(INTC_IPR01);
+       val = __raw_readw(INTC_IPR01);
        val |= value;
-       ctrl_outw(val, INTC_IPR01);
+       __raw_writew(val, INTC_IPR01);
 
        /* FPGA mask reset */
-       msk0 = ctrl_inw(INTMSK0);
-       msk1 = ctrl_inw(INTMSK1);
+       msk0 = __raw_readw(INTMSK0);
+       msk1 = __raw_readw(INTMSK1);
 
        switch (irq) {
        case IRQ0_IRQ:
@@ -82,19 +82,20 @@ static void enable_se7206_irq(unsigned int irq)
                msk1 &= ~0x00ff;
                break;
        }
-       ctrl_outw(msk0, INTMSK0);
-       ctrl_outw(msk1, INTMSK1);
+       __raw_writew(msk0, INTMSK0);
+       __raw_writew(msk1, INTMSK1);
 }
 
 static void eoi_se7206_irq(unsigned int irq)
 {
        unsigned short sts0,sts1;
+       struct irq_desc *desc = irq_to_desc(irq);
 
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+       if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
                enable_se7206_irq(irq);
        /* FPGA isr clear */
-       sts0 = ctrl_inw(INTSTS0);
-       sts1 = ctrl_inw(INTSTS1);
+       sts0 = __raw_readw(INTSTS0);
+       sts1 = __raw_readw(INTSTS1);
 
        switch (irq) {
        case IRQ0_IRQ:
@@ -108,8 +109,8 @@ static void eoi_se7206_irq(unsigned int irq)
                sts1 &= ~0x00ff;
                break;
        }
-       ctrl_outw(sts0, INTSTS0);
-       ctrl_outw(sts1, INTSTS1);
+       __raw_writew(sts0, INTSTS0);
+       __raw_writew(sts1, INTSTS1);
 }
 
 static struct irq_chip se7206_irq_chip __read_mostly = {
@@ -136,11 +137,11 @@ void __init init_se7206_IRQ(void)
        make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
        make_se7206_irq(IRQ1_IRQ); /* ATA */
        make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
-       ctrl_outw(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
+       __raw_writew(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
 
        /* FPGA System register setup*/
-       ctrl_outw(0x0000,INTSTS0); /* Clear INTSTS0 */
-       ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */
+       __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */
+       __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */
        /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
-       ctrl_outw(0x0001,INTSEL);
+       __raw_writew(0x0001,INTSEL);
 }
index f5466384972ec8f3be07160a359d25f9ef0c685c..8f5c65d43d1d85a6e1db054cd5f065ee3aa72119 100644 (file)
@@ -50,15 +50,12 @@ static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
 static struct heartbeat_data heartbeat_data = {
        .bit_pos        = heartbeat_bit_pos,
        .nr_bits        = ARRAY_SIZE(heartbeat_bit_pos),
-       .regsize        = 32,
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
 };
 
 static struct platform_device heartbeat_device = {
@@ -67,8 +64,8 @@ static struct platform_device heartbeat_device = {
        .dev    = {
                .platform_data  = &heartbeat_data,
        },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 static struct platform_device *se7206_devices[] __initdata = {
index 051c29d4eae0ed472c687218c3ab4b5b928f04aa..d4305c26e9f71e69f4cd643bd18b4ab7c20a5efd 100644 (file)
 #include <linux/io.h>
 #include <mach-se/mach/se7343.h>
 
+unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, };
+
 static void disable_se7343_irq(unsigned int irq)
 {
-       unsigned int bit = irq - SE7343_FPGA_IRQ_BASE;
-       ctrl_outw(ctrl_inw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK);
+       unsigned int bit = (unsigned int)get_irq_chip_data(irq);
+       __raw_writew(__raw_readw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK);
 }
 
 static void enable_se7343_irq(unsigned int irq)
 {
-       unsigned int bit = irq - SE7343_FPGA_IRQ_BASE;
-       ctrl_outw(ctrl_inw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK);
+       unsigned int bit = (unsigned int)get_irq_chip_data(irq);
+       __raw_writew(__raw_readw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK);
 }
 
 static struct irq_chip se7343_irq_chip __read_mostly = {
@@ -37,19 +39,16 @@ static struct irq_chip se7343_irq_chip __read_mostly = {
 
 static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-       unsigned short intv = ctrl_inw(PA_CPLD_ST);
-       struct irq_desc *ext_desc;
-       unsigned int ext_irq = SE7343_FPGA_IRQ_BASE;
+       unsigned short intv = __raw_readw(PA_CPLD_ST);
+       unsigned int ext_irq = 0;
 
        intv &= (1 << SE7343_FPGA_IRQ_NR) - 1;
 
-       while (intv) {
-               if (intv & 1) {
-                       ext_desc = irq_desc + ext_irq;
-                       handle_level_irq(ext_irq, ext_desc);
-               }
-               intv >>= 1;
-               ext_irq++;
+       for (; intv; intv >>= 1, ext_irq++) {
+               if (!(intv & 1))
+                       continue;
+
+               generic_handle_irq(se7343_fpga_irq[ext_irq]);
        }
 }
 
@@ -58,16 +57,24 @@ static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
  */
 void __init init_7343se_IRQ(void)
 {
-       int i;
+       int i, irq;
+
+       __raw_writew(0, PA_CPLD_IMSK);  /* disable all irqs */
+       __raw_writew(0x2000, 0xb03fffec);       /* mrshpc irq enable */
 
-       ctrl_outw(0, PA_CPLD_IMSK);     /* disable all irqs */
-       ctrl_outw(0x2000, 0xb03fffec);  /* mrshpc irq enable */
+       for (i = 0; i < SE7343_FPGA_IRQ_NR; i++) {
+               irq = create_irq();
+               if (irq < 0)
+                       return;
+               se7343_fpga_irq[i] = irq;
 
-       for (i = 0; i < SE7343_FPGA_IRQ_NR; i++)
-               set_irq_chip_and_handler_name(SE7343_FPGA_IRQ_BASE + i,
+               set_irq_chip_and_handler_name(se7343_fpga_irq[i],
                                              &se7343_irq_chip,
                                              handle_level_irq, "level");
 
+               set_irq_chip_data(se7343_fpga_irq[i], (void *)i);
+       }
+
        set_irq_chained_handler(IRQ0_IRQ, se7343_irq_demux);
        set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
        set_irq_chained_handler(IRQ1_IRQ, se7343_irq_demux);
index 4de56f35f41905ed07a48191b1e7d6267bd018fb..d2370af56d772a83630d6dacdc5a02f846b799ea 100644 (file)
 #include <asm/irq.h>
 #include <asm/io.h>
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev = {
-               .platform_data = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 static struct mtd_partition nor_flash_partitions[] = {
@@ -82,7 +73,6 @@ static struct plat_serial8250_port serial_platform_data[] = {
                .mapbase        = 0x16000000,
                .regshift       = 1,
                .flags          = ST16C2550C_FLAGS,
-               .irq            = UARTA_IRQ,
                .uartclk        = 7372800,
        },
        [1] = {
@@ -90,7 +80,6 @@ static struct plat_serial8250_port serial_platform_data[] = {
                .mapbase        = 0x17000000,
                .regshift       = 1,
                .flags          = ST16C2550C_FLAGS,
-               .irq            = UARTB_IRQ,
                .uartclk        = 7372800,
        },
        { },
@@ -121,7 +110,7 @@ static struct resource usb_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [2] = {
-               .start  = USB_IRQ,
+               /* Filled in later */
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -138,8 +127,8 @@ static struct isp116x_platform_data usb_platform_data = {
 static struct platform_device usb_device = {
        .name                   = "isp116x-hcd",
        .id                     = -1,
-       .num_resources          = ARRAY_SIZE(usb_resources),
-       .resource               = usb_resources,
+       .num_resources          = ARRAY_SIZE(usb_resources),
+       .resource               = usb_resources,
        .dev                    = {
                .platform_data  = &usb_platform_data,
        },
@@ -155,6 +144,13 @@ static struct platform_device *sh7343se_platform_devices[] __initdata = {
 
 static int __init sh7343se_devices_setup(void)
 {
+       /* Wire-up dynamic vectors */
+       serial_platform_data[0].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTA];
+       serial_platform_data[1].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTB];
+
+       usb_resources[2].start = usb_resources[2].end =
+               se7343_fpga_irq[SE7343_FPGA_IRQ_USB];
+
        return platform_add_devices(sh7343se_platform_devices,
                                    ARRAY_SIZE(sh7343se_platform_devices));
 }
@@ -165,10 +161,10 @@ device_initcall(sh7343se_devices_setup);
  */
 static void __init sh7343se_setup(char **cmdline_p)
 {
-       ctrl_outw(0xf900, FPGA_OUT);    /* FPGA */
+       __raw_writew(0xf900, FPGA_OUT); /* FPGA */
 
-       ctrl_outw(0x0002, PORT_PECR);   /* PORT E 1 = IRQ5 */
-       ctrl_outw(0x0020, PORT_PSELD);
+       __raw_writew(0x0002, PORT_PECR);        /* PORT E 1 = IRQ5 */
+       __raw_writew(0x0020, PORT_PSELD);
 
        printk(KERN_INFO "MS7343CP01 Setup...done\n");
 }
@@ -179,6 +175,5 @@ static void __init sh7343se_setup(char **cmdline_p)
 static struct sh_machine_vector mv_7343se __initmv = {
        .mv_name = "SolutionEngine 7343",
        .mv_setup = sh7343se_setup,
-       .mv_nr_irqs = SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_NR,
        .mv_init_irq = init_7343se_IRQ,
 };
index ec1fea571b523f8c77fade4332cbe7054dd7a633..1028c17b81bc0e6cca575a8989db1826ac8c48ac 100644 (file)
@@ -96,13 +96,13 @@ static struct ipr_desc ipr_irq_desc = {
 void __init init_se_IRQ(void)
 {
        /* Disable all interrupts */
-       ctrl_outw(0, BCR_ILCRA);
-       ctrl_outw(0, BCR_ILCRB);
-       ctrl_outw(0, BCR_ILCRC);
-       ctrl_outw(0, BCR_ILCRD);
-       ctrl_outw(0, BCR_ILCRE);
-       ctrl_outw(0, BCR_ILCRF);
-       ctrl_outw(0, BCR_ILCRG);
+       __raw_writew(0, BCR_ILCRA);
+       __raw_writew(0, BCR_ILCRB);
+       __raw_writew(0, BCR_ILCRC);
+       __raw_writew(0, BCR_ILCRD);
+       __raw_writew(0, BCR_ILCRE);
+       __raw_writew(0, BCR_ILCRF);
+       __raw_writew(0, BCR_ILCRG);
 
        register_ipr_controller(&ipr_irq_desc);
 }
index 527eb6b12610289248be45bff91d28dc66b993fc..66d39d1b0901de5a9b6da4c7fb7978223b18b502 100644 (file)
@@ -93,15 +93,12 @@ static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
 static struct heartbeat_data heartbeat_data = {
        .bit_pos        = heartbeat_bit_pos,
        .nr_bits        = ARRAY_SIZE(heartbeat_bit_pos),
-       .regsize        = 16,
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
@@ -110,8 +107,8 @@ static struct platform_device heartbeat_device = {
        .dev    = {
                .platform_data  = &heartbeat_data,
        },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
index b417acc4dad0d06a493d610650b258e5eee74ca0..d85022ea3f12f752825413ad138c255e2d11bc7e 100644 (file)
@@ -38,7 +38,7 @@ static DECLARE_INTC_DESC(intc_desc, "SE7721", vectors,
 void __init init_se7721_IRQ(void)
 {
        /* PPCR */
-       ctrl_outw(ctrl_inw(0xa4050118) & ~0x00ff, 0xa4050118);
+       __raw_writew(__raw_readw(0xa4050118) & ~0x00ff, 0xa4050118);
 
        register_intc_controller(&intc_desc);
        intc_set_priority(MRSHPC_IRQ0, 0xf - MRSHPC_IRQ0);
index 55af4c36b43a1f9d52b45f91edd00b8b56af11a6..7416ad7ee53a99c605e54d6a2668b82eb9ce0b05 100644 (file)
@@ -23,15 +23,12 @@ static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
 static struct heartbeat_data heartbeat_data = {
        .bit_pos        = heartbeat_bit_pos,
        .nr_bits        = ARRAY_SIZE(heartbeat_bit_pos),
-       .regsize        = 16,
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
@@ -40,8 +37,8 @@ static struct platform_device heartbeat_device = {
        .dev    = {
                .platform_data  = &heartbeat_data,
        },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 static struct resource cf_ide_resources[] = {
@@ -83,10 +80,10 @@ device_initcall(se7721_devices_setup);
 static void __init se7721_setup(char **cmdline_p)
 {
        /* for USB */
-       ctrl_outw(0x0000, 0xA405010C);  /* PGCR */
-       ctrl_outw(0x0000, 0xA405010E);  /* PHCR */
-       ctrl_outw(0x00AA, 0xA4050118);  /* PPCR */
-       ctrl_outw(0x0000, 0xA4050124);  /* PSELA */
+       __raw_writew(0x0000, 0xA405010C);       /* PGCR */
+       __raw_writew(0x0000, 0xA405010E);       /* PHCR */
+       __raw_writew(0x00AA, 0xA4050118);       /* PPCR */
+       __raw_writew(0x0000, 0xA4050124);       /* PSELA */
 }
 
 /*
index b221b6842b0d9142dbaf4e01b2f524d6c20728c2..61605db04ee6ef130758cc59255c0a2d9ab36af1 100644 (file)
@@ -21,13 +21,13 @@ unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, };
 static void disable_se7722_irq(unsigned int irq)
 {
        unsigned int bit = (unsigned int)get_irq_chip_data(irq);
-       ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
+       __raw_writew(__raw_readw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
 }
 
 static void enable_se7722_irq(unsigned int irq)
 {
        unsigned int bit = (unsigned int)get_irq_chip_data(irq);
-       ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
+       __raw_writew(__raw_readw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
 }
 
 static struct irq_chip se7722_irq_chip __read_mostly = {
@@ -39,7 +39,7 @@ static struct irq_chip se7722_irq_chip __read_mostly = {
 
 static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-       unsigned short intv = ctrl_inw(IRQ01_STS);
+       unsigned short intv = __raw_readw(IRQ01_STS);
        unsigned int ext_irq = 0;
 
        intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
@@ -59,8 +59,8 @@ void __init init_se7722_IRQ(void)
 {
        int i, irq;
 
-       ctrl_outw(0, IRQ01_MASK);       /* disable all irqs */
-       ctrl_outw(0x2000, 0xb03fffec);  /* mrshpc irq enable */
+       __raw_writew(0, IRQ01_MASK);       /* disable all irqs */
+       __raw_writew(0x2000, 0xb03fffec);  /* mrshpc irq enable */
 
        for (i = 0; i < SE7722_FPGA_IRQ_NR; i++) {
                irq = create_irq();
index b1cb9425b600a8b78ea1ae6d30ccb817f1481e89..80a4e571b310f99e79c04f991236ef92c1d232be 100644 (file)
 #include <cpu/sh7722.h>
 
 /* Heartbeat */
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
-};
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev = {
-               .platform_data = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* SMC91x */
@@ -165,32 +156,32 @@ device_initcall(se7722_devices_setup);
 
 static void __init se7722_setup(char **cmdline_p)
 {
-       ctrl_outw(0x010D, FPGA_OUT);    /* FPGA */
+       __raw_writew(0x010D, FPGA_OUT);    /* FPGA */
 
-       ctrl_outw(0x0000, PORT_PECR);   /* PORT E 1 = IRQ5 ,E 0 = BS */
-       ctrl_outw(0x1000, PORT_PJCR);   /* PORT J 1 = IRQ1,J 0 =IRQ0 */
+       __raw_writew(0x0000, PORT_PECR);   /* PORT E 1 = IRQ5 ,E 0 = BS */
+       __raw_writew(0x1000, PORT_PJCR);   /* PORT J 1 = IRQ1,J 0 =IRQ0 */
 
        /* LCDC I/O */
-       ctrl_outw(0x0020, PORT_PSELD);
+       __raw_writew(0x0020, PORT_PSELD);
 
        /* SIOF1*/
-       ctrl_outw(0x0003, PORT_PSELB);
-       ctrl_outw(0xe000, PORT_PSELC);
-       ctrl_outw(0x0000, PORT_PKCR);
+       __raw_writew(0x0003, PORT_PSELB);
+       __raw_writew(0xe000, PORT_PSELC);
+       __raw_writew(0x0000, PORT_PKCR);
 
        /* LCDC */
-       ctrl_outw(0x4020, PORT_PHCR);
-       ctrl_outw(0x0000, PORT_PLCR);
-       ctrl_outw(0x0000, PORT_PMCR);
-       ctrl_outw(0x0002, PORT_PRCR);
-       ctrl_outw(0x0000, PORT_PXCR);   /* LCDC,CS6A */
+       __raw_writew(0x4020, PORT_PHCR);
+       __raw_writew(0x0000, PORT_PLCR);
+       __raw_writew(0x0000, PORT_PMCR);
+       __raw_writew(0x0002, PORT_PRCR);
+       __raw_writew(0x0000, PORT_PXCR);   /* LCDC,CS6A */
 
        /* KEYSC */
-       ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
-       ctrl_outw(0x0000, PORT_PYCR);
-       ctrl_outw(0x0000, PORT_PZCR);
-       ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
-       ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
+       __raw_writew(0x0A10, PORT_PSELA); /* BS,SHHID2 */
+       __raw_writew(0x0000, PORT_PYCR);
+       __raw_writew(0x0000, PORT_PZCR);
+       __raw_writew(__raw_readw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
+       __raw_writew(__raw_readw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
 }
 
 /*
index f76cf3b49f2375f458b105aa78517373f971c0ce..0942be2daef6e1612884a45dfdeb5e2f2e1eadf7 100644 (file)
@@ -72,14 +72,14 @@ static void disable_se7724_irq(unsigned int irq)
 {
        struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
        unsigned int bit = irq - set.base;
-       ctrl_outw(ctrl_inw(set.mraddr) | 0x0001 << bit, set.mraddr);
+       __raw_writew(__raw_readw(set.mraddr) | 0x0001 << bit, set.mraddr);
 }
 
 static void enable_se7724_irq(unsigned int irq)
 {
        struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
        unsigned int bit = irq - set.base;
-       ctrl_outw(ctrl_inw(set.mraddr) & ~(0x0001 << bit), set.mraddr);
+       __raw_writew(__raw_readw(set.mraddr) & ~(0x0001 << bit), set.mraddr);
 }
 
 static struct irq_chip se7724_irq_chip __read_mostly = {
@@ -92,19 +92,16 @@ static struct irq_chip se7724_irq_chip __read_mostly = {
 static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
        struct fpga_irq set = get_fpga_irq(irq);
-       unsigned short intv = ctrl_inw(set.sraddr);
-       struct irq_desc *ext_desc;
+       unsigned short intv = __raw_readw(set.sraddr);
        unsigned int ext_irq = set.base;
 
        intv &= set.mask;
 
-       while (intv) {
-               if (intv & 0x0001) {
-                       ext_desc = irq_desc + ext_irq;
-                       handle_level_irq(ext_irq, ext_desc);
-               }
-               intv >>= 1;
-               ext_irq++;
+       for (; intv; intv >>= 1, ext_irq++) {
+               if (!(intv & 1))
+                       continue;
+
+               generic_handle_irq(ext_irq);
        }
 }
 
@@ -113,20 +110,39 @@ static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
  */
 void __init init_se7724_IRQ(void)
 {
-       int i;
-
-       ctrl_outw(0xffff, IRQ0_MR);  /* mask all */
-       ctrl_outw(0xffff, IRQ1_MR);  /* mask all */
-       ctrl_outw(0xffff, IRQ2_MR);  /* mask all */
-       ctrl_outw(0x0000, IRQ0_SR);  /* clear irq */
-       ctrl_outw(0x0000, IRQ1_SR);  /* clear irq */
-       ctrl_outw(0x0000, IRQ2_SR);  /* clear irq */
-       ctrl_outw(0x002a, IRQ_MODE); /* set irq type */
-
-       for (i = 0; i < SE7724_FPGA_IRQ_NR; i++)
-               set_irq_chip_and_handler_name(SE7724_FPGA_IRQ_BASE + i,
+       int i, nid = cpu_to_node(boot_cpu_data);
+
+       __raw_writew(0xffff, IRQ0_MR);  /* mask all */
+       __raw_writew(0xffff, IRQ1_MR);  /* mask all */
+       __raw_writew(0xffff, IRQ2_MR);  /* mask all */
+       __raw_writew(0x0000, IRQ0_SR);  /* clear irq */
+       __raw_writew(0x0000, IRQ1_SR);  /* clear irq */
+       __raw_writew(0x0000, IRQ2_SR);  /* clear irq */
+       __raw_writew(0x002a, IRQ_MODE); /* set irq type */
+
+       for (i = 0; i < SE7724_FPGA_IRQ_NR; i++) {
+               int irq, wanted;
+
+               wanted = SE7724_FPGA_IRQ_BASE + i;
+
+               irq = create_irq_nr(wanted, nid);
+               if (unlikely(irq == 0)) {
+                       pr_err("%s: failed hooking irq %d for FPGA\n",
+                              __func__, wanted);
+                       return;
+               }
+
+               if (unlikely(irq != wanted)) {
+                       pr_err("%s: got irq %d but wanted %d, bailing.\n",
+                              __func__, irq, wanted);
+                       destroy_irq(irq);
+                       return;
+               }
+
+               set_irq_chip_and_handler_name(irq,
                                              &se7724_irq_chip,
                                              handle_level_irq, "level");
+       }
 
        set_irq_chained_handler(IRQ0_IRQ, se7724_irq_demux);
        set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
index 9040167d502274a32cc5b81e1f77ef71b0f333e1..6fa4734d09c796ee6e3d3be60349df639f0210e7 100644 (file)
@@ -39,6 +39,10 @@ ENTRY(ms7724se_sdram_leave_start)
 
        /* DBSC: put memory in auto-refresh mode */
 
+       mov.l   @(SH_SLEEP_MODE, r5), r0
+       tst     #SUSP_SH_RSTANDBY, r0
+       bf      resume_rstandby
+
        ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
        WAIT 1
        ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
@@ -49,4 +53,79 @@ ENTRY(ms7724se_sdram_leave_start)
        rts
         nop
 
+resume_rstandby:
+
+       /* CPG: setup clocks before restarting external memory */
+
+       ED 0xA4150024, 0x00004000 /* PLLCR */
+
+       mov.l   FRQCRA,r0
+       mov.l   @r0,r3
+       mov.l   KICK,r1
+       or      r1, r3
+       mov.l   r3, @r0
+
+       mov.l   LSTATS,r0
+       mov     #1,r1
+WAIT_LSTATS:
+       mov.l   @r0,r3
+       tst     r1,r3
+       bf      WAIT_LSTATS
+
+       /* DBSC: re-initialize and put in auto-refresh */
+
+       ED 0xFD000108, 0x00000181 /* DBPDCNT0 */
+       ED 0xFD000020, 0x015B0002 /* DBCONF */
+       ED 0xFD000030, 0x03071502 /* DBTR0 */
+       ED 0xFD000034, 0x02020102 /* DBTR1 */
+       ED 0xFD000038, 0x01090405 /* DBTR2 */
+       ED 0xFD00003C, 0x00000002 /* DBTR3 */
+       ED 0xFD000008, 0x00000005 /* DBKIND */
+       ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
+       ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
+       ED 0xFD000018, 0x00000001 /* DBCKECNT */
+
+       mov     #100,r0
+WAIT_400NS:
+       dt      r0
+       bf      WAIT_400NS
+
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000060, 0x00020000 /* DBMRCNT (EMR2) */
+       ED 0xFD000060, 0x00030000 /* DBMRCNT (EMR3) */
+       ED 0xFD000060, 0x00010004 /* DBMRCNT (EMR) */
+       ED 0xFD000060, 0x00000532 /* DBMRCNT (MRS) */
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000060, 0x00000432 /* DBMRCNT (MRS) */
+       ED 0xFD000060, 0x000103c0 /* DBMRCNT (EMR) */
+       ED 0xFD000060, 0x00010040 /* DBMRCNT (EMR) */
+
+       mov     #100,r0
+WAIT_400NS_2:
+       dt      r0
+       bf      WAIT_400NS_2
+
+       ED 0xFD000010, 0x00000001 /* DBEN */
+       ED 0xFD000044, 0x0000050f /* DBRFPDN1 */
+       ED 0xFD000048, 0x236800e6 /* DBRFPDN2 */
+
+       mov.l   DUMMY,r0
+       mov.l   @r0, r1 /* force single dummy read */
+
+       ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
+       ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
+       ED 0xFD000108, 0x00000080 /* DBPDCNT0 */
+       ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
+
+       rts
+        nop
+
+       .balign 4
+DUMMY: .long   0xac400000
+FRQCRA:        .long   0xa4150000
+KICK:  .long   0x80000000
+LSTATS:        .long   0xa4150060
+
 ENTRY(ms7724se_sdram_leave_end)
index 5d0f70b46c97435dab2e565498ec33cf98ba34f3..66cdbc3c7af9d0ae5e131099da29221fc997b8fd 100644 (file)
  */
 
 /* Heartbeat */
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
-};
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev = {
-               .platform_data = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* LAN91C111 */
@@ -265,12 +256,12 @@ static struct platform_device ceu1_device = {
 #define FCLKACR                0xa4150008
 static void fsimck_init(struct clk *clk)
 {
-       u32 status = ctrl_inl(clk->enable_reg);
+       u32 status = __raw_readl(clk->enable_reg);
 
        /* use external clock */
        status &= ~0x000000ff;
        status |= 0x00000080;
-       ctrl_outl(status, clk->enable_reg);
+       __raw_writel(status, clk->enable_reg);
 }
 
 static struct clk_ops fsimck_clk_ops = {
@@ -322,7 +313,7 @@ static struct platform_device fsi_device = {
 /* KEYSC in SoC (Needs SW33-2 set to ON) */
 static struct sh_keysc_info keysc_info = {
        .mode = SH_KEYSC_MODE_1,
-       .scan_timing = 10,
+       .scan_timing = 3,
        .delay = 50,
        .keycodes = {
                KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
@@ -460,7 +451,7 @@ static struct resource sdhi0_cn7_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 101,
+               .start  = 100,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -483,7 +474,7 @@ static struct resource sdhi1_cn8_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 24,
+               .start  = 23,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -498,6 +489,26 @@ static struct platform_device sdhi1_cn8_device = {
        },
 };
 
+/* IrDA */
+static struct resource irda_resources[] = {
+       [0] = {
+               .name   = "IrDA",
+               .start  = 0xA45D0000,
+               .end    = 0xA45D0049,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 20,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device irda_device = {
+       .name           = "sh_sir",
+       .num_resources  = ARRAY_SIZE(irda_resources),
+       .resource       = irda_resources,
+};
+
 static struct platform_device *ms7724se_devices[] __initdata = {
        &heartbeat_device,
        &smc91x_eth_device,
@@ -512,6 +523,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
        &fsi_device,
        &sdhi0_cn7_device,
        &sdhi1_cn8_device,
+       &irda_device,
 };
 
 /* I2C device */
@@ -531,9 +543,9 @@ static int __init sh_eth_is_eeprom_ready(void)
        int t = 10000;
 
        while (t--) {
-               if (!ctrl_inw(EEPROM_STAT))
+               if (!__raw_readw(EEPROM_STAT))
                        return 1;
-               cpu_relax();
+               udelay(1);
        }
 
        printk(KERN_ERR "ms7724se can not access to eeprom\n");
@@ -551,13 +563,13 @@ static void __init sh_eth_init(void)
 
        /* read MAC addr from EEPROM */
        for (i = 0 ; i < 3 ; i++) {
-               ctrl_outw(0x0, EEPROM_OP); /* read */
-               ctrl_outw(i*2, EEPROM_ADR);
-               ctrl_outw(0x1, EEPROM_STRT);
+               __raw_writew(0x0, EEPROM_OP); /* read */
+               __raw_writew(i*2, EEPROM_ADR);
+               __raw_writew(0x1, EEPROM_STRT);
                if (!sh_eth_is_eeprom_ready())
                        return;
 
-               mac = ctrl_inw(EEPROM_DATA);
+               mac = __raw_readw(EEPROM_DATA);
                sh_eth_plat.mac_addr[i << 1] = mac & 0xff;
                sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8;
        }
@@ -594,28 +606,29 @@ arch_initcall(arch_setup);
 
 static int __init devices_setup(void)
 {
-       u16 sw = ctrl_inw(SW4140); /* select camera, monitor */
-       struct clk *fsia_clk;
+       u16 sw = __raw_readw(SW4140); /* select camera, monitor */
+       struct clk *clk;
 
        /* register board specific self-refresh code */
-       sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
+       sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
+                                       SUSP_SH_RSTANDBY,
                                        &ms7724se_sdram_enter_start,
                                        &ms7724se_sdram_enter_end,
                                        &ms7724se_sdram_leave_start,
                                        &ms7724se_sdram_leave_end);
        /* Reset Release */
-       ctrl_outw(ctrl_inw(FPGA_OUT) &
+       __raw_writew(__raw_readw(FPGA_OUT) &
                  ~((1 << 1)  | /* LAN */
                    (1 << 6)  | /* VIDEO DAC */
                    (1 << 7)  | /* AK4643 */
+                   (1 << 8)  | /* IrDA */
                    (1 << 12) | /* USB0 */
                    (1 << 14)), /* RMII */
                  FPGA_OUT);
 
        /* turn on USB clocks, use external clock */
-       ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
+       __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
 
-#ifdef CONFIG_PM
        /* Let LED9 show STATUS2 */
        gpio_request(GPIO_FN_STATUS2, NULL);
 
@@ -624,28 +637,12 @@ static int __init devices_setup(void)
 
        /* Lit LED11 show PDSTATUS */
        gpio_request(GPIO_FN_PDSTATUS, NULL);
-#else
-       /* Lit LED9 */
-       gpio_request(GPIO_PTJ6, NULL);
-       gpio_direction_output(GPIO_PTJ6, 1);
-       gpio_export(GPIO_PTJ6, 0);
-
-       /* Lit LED10 */
-       gpio_request(GPIO_PTJ5, NULL);
-       gpio_direction_output(GPIO_PTJ5, 1);
-       gpio_export(GPIO_PTJ5, 0);
-
-       /* Lit LED11 */
-       gpio_request(GPIO_PTJ7, NULL);
-       gpio_direction_output(GPIO_PTJ7, 1);
-       gpio_export(GPIO_PTJ7, 0);
-#endif
 
        /* enable USB0 port */
-       ctrl_outw(0x0600, 0xa40501d4);
+       __raw_writew(0x0600, 0xa40501d4);
 
        /* enable USB1 port */
-       ctrl_outw(0x0600, 0xa4050192);
+       __raw_writew(0x0600, 0xa4050192);
 
        /* enable IRQ 0,1,2 */
        gpio_request(GPIO_FN_INTC_IRQ0, NULL);
@@ -693,7 +690,7 @@ static int __init devices_setup(void)
        gpio_request(GPIO_FN_LCDVCPWC, NULL);
        gpio_request(GPIO_FN_LCDRD,    NULL);
        gpio_request(GPIO_FN_LCDLCLK,  NULL);
-       ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
+       __raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA);
 
        /* enable CEU0 */
        gpio_request(GPIO_FN_VIO0_D15, NULL);
@@ -764,13 +761,18 @@ static int __init devices_setup(void)
        gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
        gpio_request(GPIO_FN_FSIIASD,    NULL);
 
+       /* set SPU2 clock to 83.4 MHz */
+       clk = clk_get(NULL, "spu_clk");
+       clk_set_rate(clk, clk_round_rate(clk, 83333333));
+       clk_put(clk);
+
        /* change parent of FSI A */
-       fsia_clk = clk_get(NULL, "fsia_clk");
+       clk = clk_get(NULL, "fsia_clk");
        clk_register(&fsimcka_clk);
-       clk_set_parent(fsia_clk, &fsimcka_clk);
-       clk_set_rate(fsia_clk, 11000);
+       clk_set_parent(clk, &fsimcka_clk);
+       clk_set_rate(clk, 11000);
        clk_set_rate(&fsimcka_clk, 11000);
-       clk_put(fsia_clk);
+       clk_put(clk);
 
        /* SDHI0 connected to cn7 */
        gpio_request(GPIO_FN_SDHI0CD, NULL);
@@ -792,6 +794,10 @@ static int __init devices_setup(void)
        gpio_request(GPIO_FN_SDHI1CMD, NULL);
        gpio_request(GPIO_FN_SDHI1CLK, NULL);
 
+       /* enable IrDA */
+       gpio_request(GPIO_FN_IRDA_OUT, NULL);
+       gpio_request(GPIO_FN_IRDA_IN,  NULL);
+
        /*
         * enable SH-Eth
         *
index 121744c087144bc48ea6f85f197f3cd00760dbc3..d5c9edc172a3d22e32370b120f9c5d67fd61d8d4 100644 (file)
 void __init init_se7780_IRQ(void)
 {
        /* enable all interrupt at FPGA */
-       ctrl_outw(0, FPGA_INTMSK1);
+       __raw_writew(0, FPGA_INTMSK1);
        /* mask SM501 interrupt */
-       ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
+       __raw_writew((__raw_readw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
        /* enable all interrupt at FPGA */
-       ctrl_outw(0, FPGA_INTMSK2);
+       __raw_writew(0, FPGA_INTMSK2);
 
        /* set FPGA INTSEL register */
        /* FPGA + 0x06 */
-       ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) |
+       __raw_writew( ((IRQPIN_SM501 << IRQPOS_SM501) |
                (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1);
 
        /* FPGA + 0x08 */
-       ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
+       __raw_writew(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
                (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) |
                (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) |
                (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2);
 
        /* FPGA + 0x0A */
-       ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
+       __raw_writew((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
 
        plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */
 
        /* ICR1: detect low level(for 2ndcut) */
-       ctrl_outl(0xAAAA0000, INTC_ICR1);
+       __raw_writel(0xAAAA0000, INTC_ICR1);
 
        /*
         * FPGA PCISEL register initialize
@@ -63,6 +63,6 @@ void __init init_se7780_IRQ(void)
         *  INTD || INTD  | INTC  |  --   | INTA
         *  -------------------------------------
         */
-       ctrl_outw(0x0013, FPGA_PCI_INTSEL1);
-       ctrl_outw(0xE402, FPGA_PCI_INTSEL2);
+       __raw_writew(0x0013, FPGA_PCI_INTSEL1);
+       __raw_writew(0xE402, FPGA_PCI_INTSEL2);
 }
index 1d3a867e94e3ad90fd653086705b181898605105..6f7c207138e14ce10b4c009d7c87cd64a34a4a6b 100644 (file)
 #include <asm/heartbeat.h>
 
 /* Heartbeat */
-static struct heartbeat_data heartbeat_data = {
-       .regsize = 16,
-};
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED,
-               .flags  = IORESOURCE_MEM,
-       },
+static struct resource heartbeat_resource = {
+       .start  = PA_LED,
+       .end    = PA_LED,
+       .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
 };
 
 static struct platform_device heartbeat_device = {
        .name           = "heartbeat",
        .id             = -1,
-       .dev = {
-               .platform_data = &heartbeat_data,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
+       .num_resources  = 1,
+       .resource       = &heartbeat_resource,
 };
 
 /* SMC91x */
@@ -84,14 +75,14 @@ device_initcall(se7780_devices_setup);
 static void __init se7780_setup(char **cmdline_p)
 {
        /* "SH-Linux" on LED Display */
-       ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
-       ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
-       ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
-       ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
-       ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
-       ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
-       ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
-       ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
+       __raw_writew( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
+       __raw_writew( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
+       __raw_writew( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
+       __raw_writew( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
+       __raw_writew( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
+       __raw_writew( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
+       __raw_writew( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
+       __raw_writew( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
 
        printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
 
@@ -102,15 +93,15 @@ static void __init se7780_setup(char **cmdline_p)
         *   REQ2/GNT2 -> Serial ATA
         *   REQ3/GNT3 -> PCI slot
         */
-       ctrl_outw(0x0213, FPGA_REQSEL);
+       __raw_writew(0x0213, FPGA_REQSEL);
 
        /* GPIO setting */
-       ctrl_outw(0x0000, GPIO_PECR);
-       ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
-       ctrl_outw(0x0c00, GPIO_PMSELR);
+       __raw_writew(0x0000, GPIO_PECR);
+       __raw_writew(__raw_readw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
+       __raw_writew(0x0c00, GPIO_PMSELR);
 
        /* iVDR Power ON */
-       ctrl_outw(0x0001, FPGA_IVDRPW);
+       __raw_writew(0x0001, FPGA_IVDRPW);
 }
 
 /*
index a8b9f844ab5b5ed1ea8fe1e275c6f3da6a0cb676..1b200990500c706b265dabd926424ee4956db485 100644 (file)
@@ -44,15 +44,15 @@ unsigned long get_cmos_time(void)
        spin_lock(&sh03_rtc_lock);
  again:
        do {
-               sec  = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10;
-               min  = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10;
-               hour = (ctrl_inb(RTC_HOU1) & 0xf) + (ctrl_inb(RTC_HOU10) & 0xf) * 10;
-               day  = (ctrl_inb(RTC_DAY1) & 0xf) + (ctrl_inb(RTC_DAY10) & 0xf) * 10;
-               mon  = (ctrl_inb(RTC_MON1) & 0xf) + (ctrl_inb(RTC_MON10) & 0xf) * 10;
-               year = (ctrl_inb(RTC_YEA1) & 0xf) + (ctrl_inb(RTC_YEA10) & 0xf) * 10
-                    + (ctrl_inb(RTC_YEA100 ) & 0xf) * 100
-                    + (ctrl_inb(RTC_YEA1000) & 0xf) * 1000;
-       } while (sec != (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10);
+               sec  = (__raw_readb(RTC_SEC1) & 0xf) + (__raw_readb(RTC_SEC10) & 0x7) * 10;
+               min  = (__raw_readb(RTC_MIN1) & 0xf) + (__raw_readb(RTC_MIN10) & 0xf) * 10;
+               hour = (__raw_readb(RTC_HOU1) & 0xf) + (__raw_readb(RTC_HOU10) & 0xf) * 10;
+               day  = (__raw_readb(RTC_DAY1) & 0xf) + (__raw_readb(RTC_DAY10) & 0xf) * 10;
+               mon  = (__raw_readb(RTC_MON1) & 0xf) + (__raw_readb(RTC_MON10) & 0xf) * 10;
+               year = (__raw_readb(RTC_YEA1) & 0xf) + (__raw_readb(RTC_YEA10) & 0xf) * 10
+                    + (__raw_readb(RTC_YEA100 ) & 0xf) * 100
+                    + (__raw_readb(RTC_YEA1000) & 0xf) * 1000;
+       } while (sec != (__raw_readb(RTC_SEC1) & 0xf) + (__raw_readb(RTC_SEC10) & 0x7) * 10);
        if (year == 0 || mon < 1 || mon > 12 || day > 31 || day < 1 ||
            hour > 23 || min > 59 || sec > 59) {
                printk(KERN_ERR
@@ -60,16 +60,16 @@ unsigned long get_cmos_time(void)
                printk("year=%d, mon=%d, day=%d, hour=%d, min=%d, sec=%d\n",
                       year, mon, day, hour, min, sec);
 
-               ctrl_outb(0, RTC_SEC1); ctrl_outb(0, RTC_SEC10);
-               ctrl_outb(0, RTC_MIN1); ctrl_outb(0, RTC_MIN10);
-               ctrl_outb(0, RTC_HOU1); ctrl_outb(0, RTC_HOU10);
-               ctrl_outb(6, RTC_WEE1);
-               ctrl_outb(1, RTC_DAY1); ctrl_outb(0, RTC_DAY10);
-               ctrl_outb(1, RTC_MON1); ctrl_outb(0, RTC_MON10);
-               ctrl_outb(0, RTC_YEA1); ctrl_outb(0, RTC_YEA10);
-               ctrl_outb(0, RTC_YEA100);
-               ctrl_outb(2, RTC_YEA1000);
-               ctrl_outb(0, RTC_CTL);
+               __raw_writeb(0, RTC_SEC1); __raw_writeb(0, RTC_SEC10);
+               __raw_writeb(0, RTC_MIN1); __raw_writeb(0, RTC_MIN10);
+               __raw_writeb(0, RTC_HOU1); __raw_writeb(0, RTC_HOU10);
+               __raw_writeb(6, RTC_WEE1);
+               __raw_writeb(1, RTC_DAY1); __raw_writeb(0, RTC_DAY10);
+               __raw_writeb(1, RTC_MON1); __raw_writeb(0, RTC_MON10);
+               __raw_writeb(0, RTC_YEA1); __raw_writeb(0, RTC_YEA10);
+               __raw_writeb(0, RTC_YEA100);
+               __raw_writeb(2, RTC_YEA1000);
+               __raw_writeb(0, RTC_CTL);
                goto again;
        }
 
@@ -93,9 +93,9 @@ static int set_rtc_mmss(unsigned long nowtime)
        /* gets recalled with irq locally disabled */
        spin_lock(&sh03_rtc_lock);
        for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
-               if (!(ctrl_inb(RTC_CTL) & RTC_BUSY))
+               if (!(__raw_readb(RTC_CTL) & RTC_BUSY))
                        break;
-       cmos_minutes = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10;
+       cmos_minutes = (__raw_readb(RTC_MIN1) & 0xf) + (__raw_readb(RTC_MIN10) & 0xf) * 10;
        real_seconds = nowtime % 60;
        real_minutes = nowtime / 60;
        if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
@@ -103,10 +103,10 @@ static int set_rtc_mmss(unsigned long nowtime)
        real_minutes %= 60;
 
        if (abs(real_minutes - cmos_minutes) < 30) {
-               ctrl_outb(real_seconds % 10, RTC_SEC1);
-               ctrl_outb(real_seconds / 10, RTC_SEC10);
-               ctrl_outb(real_minutes % 10, RTC_MIN1);
-               ctrl_outb(real_minutes / 10, RTC_MIN10);
+               __raw_writeb(real_seconds % 10, RTC_SEC1);
+               __raw_writeb(real_seconds / 10, RTC_SEC10);
+               __raw_writeb(real_minutes % 10, RTC_MIN1);
+               __raw_writeb(real_minutes / 10, RTC_MIN10);
        } else {
                printk(KERN_WARNING
                       "set_rtc_mmss: can't update from %d to %d\n",
index 74cfb4b8b03d520ca654164483a77bbf4cdf40bd..af4a0c012a9648e6d01954a8c3cb1069081d4cc5 100644 (file)
@@ -82,7 +82,7 @@ static int __init sh03_devices_setup(void)
        /* open I/O area window */
        paddrbase = virt_to_phys((void *)PA_AREA5_IO);
        prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-       cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
+       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
        if (!cf_ide_base) {
                printk("allocate_cf_area : can't open CF I/O window!\n");
                return -ENOMEM;
index d8ebfa7d8c7616de1a66a0999ad1da7f18276a32..add698c8f2b44ebf4a056d6054c7c521915373be 100644 (file)
 void __init init_sh7763rdp_IRQ(void)
 {
        /* GPIO enabled */
-       ctrl_outl(1 << 25, INTC_INT2MSKCR);
+       __raw_writel(1 << 25, INTC_INT2MSKCR);
 
        /* enable GPIO interrupts */
-       ctrl_outl((ctrl_inl(INTC_INT2PRI7) & 0xFF00FFFF) | 0x000F0000,
+       __raw_writel((__raw_readl(INTC_INT2PRI7) & 0xFF00FFFF) | 0x000F0000,
                  INTC_INT2PRI7);
 
        /* USBH enabled */
-       ctrl_outl(1 << 17, INTC_INT2MSKCR1);
+       __raw_writel(1 << 17, INTC_INT2MSKCR1);
 
        /* GETHER enabled */
-       ctrl_outl(1 << 16, INTC_INT2MSKCR1);
+       __raw_writel(1 << 16, INTC_INT2MSKCR1);
 
        /* DMAC enabled */
-       ctrl_outl(1 << 8, INTC_INT2MSKCR);
+       __raw_writel(1 << 8, INTC_INT2MSKCR);
 }
index 390534a0b35c860a9545678b00e4d4c633867ca4..f64a6918224c75c6bf9c676958816481e7f06209 100644 (file)
@@ -158,50 +158,50 @@ device_initcall(sh7763rdp_devices_setup);
 static void __init sh7763rdp_setup(char **cmdline_p)
 {
        /* Board version check */
-       if (ctrl_inw(CPLD_BOARD_ID_ERV_REG) == 0xECB1)
+       if (__raw_readw(CPLD_BOARD_ID_ERV_REG) == 0xECB1)
                printk(KERN_INFO "RTE Standard Configuration\n");
        else
                printk(KERN_INFO "RTA Standard Configuration\n");
 
        /* USB pin select bits (clear bit 5-2 to 0) */
-       ctrl_outw((ctrl_inw(PORT_PSEL2) & 0xFFC3), PORT_PSEL2);
+       __raw_writew((__raw_readw(PORT_PSEL2) & 0xFFC3), PORT_PSEL2);
        /* USBH setup port I controls to other (clear bits 4-9 to 0) */
-       ctrl_outw(ctrl_inw(PORT_PICR) & 0xFC0F, PORT_PICR);
+       __raw_writew(__raw_readw(PORT_PICR) & 0xFC0F, PORT_PICR);
 
        /* Select USB Host controller */
-       ctrl_outw(0x00, USB_USBHSC);
+       __raw_writew(0x00, USB_USBHSC);
 
        /* For LCD */
        /* set PTJ7-1, bits 15-2 of PJCR to 0 */
-       ctrl_outw(ctrl_inw(PORT_PJCR) & 0x0003, PORT_PJCR);
+       __raw_writew(__raw_readw(PORT_PJCR) & 0x0003, PORT_PJCR);
        /* set PTI5, bits 11-10 of PICR to 0 */
-       ctrl_outw(ctrl_inw(PORT_PICR) & 0xF3FF, PORT_PICR);
-       ctrl_outw(0, PORT_PKCR);
-       ctrl_outw(0, PORT_PLCR);
+       __raw_writew(__raw_readw(PORT_PICR) & 0xF3FF, PORT_PICR);
+       __raw_writew(0, PORT_PKCR);
+       __raw_writew(0, PORT_PLCR);
        /* set PSEL2 bits 14-8, 5-4, of PSEL2 to 0 */
-       ctrl_outw((ctrl_inw(PORT_PSEL2) & 0x00C0), PORT_PSEL2);
+       __raw_writew((__raw_readw(PORT_PSEL2) & 0x00C0), PORT_PSEL2);
        /* set PSEL3 bits 14-12, 6-4, 2-0 of PSEL3 to 0 */
-       ctrl_outw((ctrl_inw(PORT_PSEL3) & 0x0700), PORT_PSEL3);
+       __raw_writew((__raw_readw(PORT_PSEL3) & 0x0700), PORT_PSEL3);
 
        /* For HAC */
        /* bit3-0  0100:HAC & SSI1 enable */
-       ctrl_outw((ctrl_inw(PORT_PSEL1) & 0xFFF0) | 0x0004, PORT_PSEL1);
+       __raw_writew((__raw_readw(PORT_PSEL1) & 0xFFF0) | 0x0004, PORT_PSEL1);
        /* bit14      1:SSI_HAC_CLK enable */
-       ctrl_outw(ctrl_inw(PORT_PSEL4) | 0x4000, PORT_PSEL4);
+       __raw_writew(__raw_readw(PORT_PSEL4) | 0x4000, PORT_PSEL4);
 
        /* SH-Ether */
-       ctrl_outw((ctrl_inw(PORT_PSEL1) & ~0xff00) | 0x2400, PORT_PSEL1);
-       ctrl_outw(0x0, PORT_PFCR);
-       ctrl_outw(0x0, PORT_PFCR);
-       ctrl_outw(0x0, PORT_PFCR);
+       __raw_writew((__raw_readw(PORT_PSEL1) & ~0xff00) | 0x2400, PORT_PSEL1);
+       __raw_writew(0x0, PORT_PFCR);
+       __raw_writew(0x0, PORT_PFCR);
+       __raw_writew(0x0, PORT_PFCR);
 
        /* MMC */
        /*selects SCIF and MMC other functions */
-       ctrl_outw(0x0001, PORT_PSEL0);
+       __raw_writew(0x0001, PORT_PSEL0);
        /* MMC clock operates */
-       ctrl_outl(ctrl_inl(MSTPCR1) & ~0x8, MSTPCR1);
-       ctrl_outw(ctrl_inw(PORT_PACR) & ~0x3000, PORT_PACR);
-       ctrl_outw(ctrl_inw(PORT_PCCR) & ~0xCFC3, PORT_PCCR);
+       __raw_writel(__raw_readl(MSTPCR1) & ~0x8, MSTPCR1);
+       __raw_writew(__raw_readw(PORT_PACR) & ~0x3000, PORT_PACR);
+       __raw_writew(__raw_readw(PORT_PCCR) & ~0xCFC3, PORT_PCCR);
 }
 
 static struct sh_machine_vector mv_sh7763rdp __initmv = {
index a3277a23cf14a2904dc22dbe8fd88ee84212c1d2..331745dee3798b2f9465c197827bd2ab90bb49fb 100644 (file)
@@ -30,7 +30,7 @@
 
 static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
 {
-       (void)ctrl_inb(0xb8000000);     /* dummy read */
+       (void)__raw_readb(0xb8000000);  /* dummy read */
 
        printk("SnapGear: erase switch interrupt!\n");
 
index 986a0e71d22004b7e56b89427a25f80aba00a362..523aea5dc94e2476b69e603c28d66a4b3e7e9575 100644 (file)
@@ -41,13 +41,13 @@ static void disable_systemh_irq(unsigned int irq)
                unsigned long val, mask = 0x01 << 1;
 
                /* Clear the "irq"th bit in the mask and set it in the request */
-               val = ctrl_inl((unsigned long)systemh_irq_mask_register);
+               val = __raw_readl((unsigned long)systemh_irq_mask_register);
                val &= ~mask;
-               ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
+               __raw_writel(val, (unsigned long)systemh_irq_mask_register);
 
-               val = ctrl_inl((unsigned long)systemh_irq_request_register);
+               val = __raw_readl((unsigned long)systemh_irq_request_register);
                val |= mask;
-               ctrl_outl(val, (unsigned long)systemh_irq_request_register);
+               __raw_writel(val, (unsigned long)systemh_irq_request_register);
        }
 }
 
@@ -57,9 +57,9 @@ static void enable_systemh_irq(unsigned int irq)
                unsigned long val, mask = 0x01 << 1;
 
                /* Set "irq"th bit in the mask register */
-               val = ctrl_inl((unsigned long)systemh_irq_mask_register);
+               val = __raw_readl((unsigned long)systemh_irq_mask_register);
                val |= mask;
-               ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
+               __raw_writel(val, (unsigned long)systemh_irq_mask_register);
        }
 }
 
diff --git a/arch/sh/boards/mach-titan/Makefile b/arch/sh/boards/mach-titan/Makefile
deleted file mode 100644 (file)
index 08d7537..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the Nimble Microsystems TITAN specific parts of the kernel
-#
-
-obj-y   := setup.o io.o
diff --git a/arch/sh/boards/mach-titan/io.c b/arch/sh/boards/mach-titan/io.c
deleted file mode 100644 (file)
index 0130e98..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *     I/O routines for Titan
- */
-#include <linux/pci.h>
-#include <asm/machvec.h>
-#include <asm/addrspace.h>
-#include <mach/titan.h>
-#include <asm/io.h>
-
-static inline unsigned int port2adr(unsigned int port)
-{
-        maybebadio((unsigned long)port);
-        return port;
-}
-
-u8 titan_inb(unsigned long port)
-{
-        if (PXSEG(port))
-                return ctrl_inb(port);
-        return ctrl_inw(port2adr(port)) & 0xff;
-}
-
-u8 titan_inb_p(unsigned long port)
-{
-        u8 v;
-
-        if (PXSEG(port))
-                v = ctrl_inb(port);
-        else
-                v = ctrl_inw(port2adr(port)) & 0xff;
-        ctrl_delay();
-        return v;
-}
-
-u16 titan_inw(unsigned long port)
-{
-        if (PXSEG(port))
-                return ctrl_inw(port);
-        else if (port >= 0x2000)
-                return ctrl_inw(port2adr(port));
-        else
-                maybebadio(port);
-        return 0;
-}
-
-u32 titan_inl(unsigned long port)
-{
-        if (PXSEG(port))
-                return ctrl_inl(port);
-        else if (port >= 0x2000)
-                return ctrl_inw(port2adr(port));
-        else
-                maybebadio(port);
-        return 0;
-}
-
-void titan_outb(u8 value, unsigned long port)
-{
-        if (PXSEG(port))
-                ctrl_outb(value, port);
-        else
-                ctrl_outw(value, port2adr(port));
-}
-
-void titan_outb_p(u8 value, unsigned long port)
-{
-        if (PXSEG(port))
-                ctrl_outb(value, port);
-        else
-                ctrl_outw(value, port2adr(port));
-        ctrl_delay();
-}
-
-void titan_outw(u16 value, unsigned long port)
-{
-        if (PXSEG(port))
-                ctrl_outw(value, port);
-        else if (port >= 0x2000)
-                ctrl_outw(value, port2adr(port));
-        else
-                maybebadio(port);
-}
-
-void titan_outl(u32 value, unsigned long port)
-{
-        if (PXSEG(port))
-                ctrl_outl(value, port);
-        else
-                maybebadio(port);
-}
-
-void titan_insl(unsigned long port, void *dst, unsigned long count)
-{
-        maybebadio(port);
-}
-
-void titan_outsl(unsigned long port, const void *src, unsigned long count)
-{
-        maybebadio(port);
-}
-
-void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
-{
-       if (PXSEG(port))
-               return (void __iomem *)port;
-
-       return (void __iomem *)port2adr(port);
-}
index b5c673c39337ef14fb6b7b7ab99de0b6d838c0c6..5c9842704c60f39cc1039f8c5cc8180ad67f91fb 100644 (file)
@@ -70,10 +70,10 @@ static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
        pr_debug("%s: bit#%d: addr - 0x%08lx (shift %d, set %d)\n",
                 __func__, bit, addr, shift, set);
 
-       tmp = ctrl_inw(addr);
+       tmp = __raw_readw(addr);
        tmp &= ~(0xf << shift);
        tmp |= set << shift;
-       ctrl_outw(tmp, addr);
+       __raw_writew(tmp, addr);
 }
 
 /**
@@ -142,9 +142,9 @@ void ilsel_disable(unsigned int irq)
 
        addr = mk_ilsel_addr(irq);
 
-       tmp = ctrl_inw(addr);
+       tmp = __raw_readw(addr);
        tmp &= ~(0xf << mk_ilsel_shift(irq));
-       ctrl_outw(tmp, addr);
+       __raw_writew(tmp, addr);
 
        clear_bit(irq, &ilsel_level_map);
 }
index efe4cb9f8a77d27edc8fe632b25aafd2acb19e1f..e284592fd42a2eb6d828ee9fdb348e79747ddaa8 100644 (file)
@@ -149,7 +149,7 @@ static void __init x3proto_init_irq(void)
        plat_irq_setup_pins(IRQ_MODE_IRL3210);
 
        /* Set ICR0.LVLMODE */
-       ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
+       __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
 }
 
 static struct sh_machine_vector mv_x3proto __initmv = {
index cb8cf5572e7977f701b777c7ddf86fc04b6547fb..1ce63624c9b9c8140a1eb9d348442b7fa2d560e8 100644 (file)
@@ -21,12 +21,15 @@ CONFIG_ZERO_PAGE_OFFSET     ?= 0x00001000
 CONFIG_ENTRY_OFFSET    ?= 0x00001000
 
 suffix-y := bin
-suffix-$(CONFIG_KERNEL_GZIP)  := gz
-suffix-$(CONFIG_KERNEL_BZIP2) := bz2
-suffix-$(CONFIG_KERNEL_LZMA)  := lzma
-
-targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma uImage.bin
-extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
+suffix-$(CONFIG_KERNEL_GZIP)   := gz
+suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
+suffix-$(CONFIG_KERNEL_LZMA)   := lzma
+suffix-$(CONFIG_KERNEL_LZO)    := lzo
+
+targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \
+          uImage.bz2 uImage.lzma uImage.lzo uImage.bin
+extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
+          vmlinux.bin.lzo
 subdir- := compressed romimage
 
 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
@@ -43,15 +46,8 @@ $(obj)/romImage: $(obj)/romimage/vmlinux FORCE
 $(obj)/romimage/vmlinux: $(obj)/zImage FORCE
        $(Q)$(MAKE) $(build)=$(obj)/romimage $@
 
-KERNEL_MEMORY := 0x00000000
-ifeq ($(CONFIG_PMB_FIXED),y)
-KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
+KERNEL_MEMORY  := $(shell /bin/bash -c 'printf "0x%08x" \
                     $$[$(CONFIG_MEMORY_START) & 0x1fffffff]')
-endif
-ifeq ($(CONFIG_29BIT),y)
-KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
-                    $$[$(CONFIG_MEMORY_START)]')
-endif
 
 KERNEL_LOAD    := $(shell /bin/bash -c 'printf "0x%08x" \
                     $$[$(CONFIG_PAGE_OFFSET)  + \
@@ -80,6 +76,9 @@ $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
        $(call if_changed,lzma)
 
+$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
+       $(call if_changed,lzo)
+
 $(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
        $(call if_changed,uimage,bzip2)
 
@@ -89,6 +88,9 @@ $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
 $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
        $(call if_changed,uimage,lzma)
 
+$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo
+       $(call if_changed,uimage,lzo)
+
 $(obj)/uImage.bin: $(obj)/vmlinux.bin
        $(call if_changed,uimage,none)
 
index 6182eca5180ac53390acc88f527c035a228ed027..5d660b90943b05bb4662ca9209fa1957da60192a 100644 (file)
@@ -6,14 +6,11 @@
 
 targets                := vmlinux vmlinux.bin vmlinux.bin.gz \
                   vmlinux.bin.bz2 vmlinux.bin.lzma \
+                  vmlinux.bin.lzo \
                   head_$(BITS).o misc.o piggy.o
 
 OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
 
-ifdef CONFIG_SH_STANDARD_BIOS
-OBJECTS += $(obj)/../../kernel/sh_bios.o
-endif
-
 #
 # IMAGE_OFFSET is the load offset of the compression loader
 #
@@ -47,6 +44,8 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
        $(call if_changed,bzip2)
 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
        $(call if_changed,lzma)
+$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
+       $(call if_changed,lzo)
 
 OBJCOPYFLAGS += -R .empty_zero_page
 
index b51b1fc4baae91cd8db937d5e28ad4594311d0ad..27140a6b365d60b610c25ddc21d38e709cd4cc23 100644 (file)
@@ -14,7 +14,6 @@
 #include <asm/uaccess.h>
 #include <asm/addrspace.h>
 #include <asm/page.h>
-#include <asm/sh_bios.h>
 
 /*
  * gzip declarations
@@ -62,29 +61,15 @@ static unsigned long free_mem_end_ptr;
 #include "../../../../lib/decompress_unlzma.c"
 #endif
 
-#ifdef CONFIG_SH_STANDARD_BIOS
-size_t strlen(const char *s)
-{
-       int i = 0;
-
-       while (*s++)
-               i++;
-       return i;
-}
+#ifdef CONFIG_KERNEL_LZO
+#include "../../../../lib/decompress_unlzo.c"
+#endif
 
-int puts(const char *s)
-{
-       int len = strlen(s);
-       sh_bios_console_write(s, len);
-       return len;
-}
-#else
 int puts(const char *s)
 {
        /* This should be updated to use the sh-sci routines */
        return 0;
 }
-#endif
 
 void* memset(void* s, int c, size_t n)
 {
@@ -132,7 +117,7 @@ void decompress_kernel(void)
        output_addr = (CONFIG_MEMORY_START + 0x2000);
 #else
        output_addr = __pa((unsigned long)&_text+PAGE_SIZE);
-#ifdef CONFIG_29BIT
+#if defined(CONFIG_29BIT)
        output_addr |= P2SEG;
 #endif
 #endif
index 50aa0c1f76ea76964b6762efa546e0260efeebe7..bcb31ae84a5183118b07d5e6bc25c2d10bc8ba31 100644 (file)
@@ -55,25 +55,22 @@ static struct irq_chip hd64461_irq_chip = {
 
 static void hd64461_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-       unsigned short intv = ctrl_inw(HD64461_NIRR);
-       struct irq_desc *ext_desc;
+       unsigned short intv = __raw_readw(HD64461_NIRR);
        unsigned int ext_irq = HD64461_IRQBASE;
 
        intv &= (1 << HD64461_IRQ_NUM) - 1;
 
-       while (intv) {
-               if (intv & 1) {
-                       ext_desc = irq_desc + ext_irq;
-                       handle_level_irq(ext_irq, ext_desc);
-               }
-               intv >>= 1;
-               ext_irq++;
+       for (; intv; intv >>= 1, ext_irq++) {
+               if (!(intv & 1))
+                       continue;
+
+               generic_handle_irq(ext_irq);
        }
 }
 
 int __init setup_hd64461(void)
 {
-       int i;
+       int i, nid = cpu_to_node(boot_cpu_data);
 
        if (!MACH_HD64461)
                return 0;
@@ -90,9 +87,26 @@ int __init setup_hd64461(void)
        __raw_writew(0xffff, HD64461_NIMR);
 
        /*  IRQ 80 -> 95 belongs to HD64461  */
-       for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++)
+       for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) {
+               unsigned int irq;
+
+               irq = create_irq_nr(i, nid);
+               if (unlikely(irq == 0)) {
+                       pr_err("%s: failed hooking irq %d for HD64461\n",
+                              __func__, i);
+                       return -EBUSY;
+               }
+
+               if (unlikely(irq != i)) {
+                       pr_err("%s: got irq %d but wanted %d, bailing.\n",
+                              __func__, irq, i);
+                       destroy_irq(irq);
+                       return -EINVAL;
+               }
+
                set_irq_chip_and_handler(i, &hd64461_irq_chip,
                                         handle_level_irq);
+       }
 
        set_irq_chained_handler(CONFIG_HD64461_IRQ, hd64461_irq_demux);
        set_irq_type(CONFIG_HD64461_IRQ, IRQ_TYPE_LEVEL_LOW);
diff --git a/arch/sh/configs/sdk7786_defconfig b/arch/sh/configs/sdk7786_defconfig
new file mode 100644 (file)
index 0000000..9b331ea
--- /dev/null
@@ -0,0 +1,1754 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.33-rc7
+# Tue Feb  9 15:27:06 2010
+#
+CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+# CONFIG_SUPERH64 is not set
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_IRQ_PER_CPU=y
+CONFIG_SPARSE_IRQ=y
+# CONFIG_GENERIC_GPIO is not set
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_SYS_SUPPORTS_HUGETLBFS=y
+CONFIG_SYS_SUPPORTS_SMP=y
+CONFIG_SYS_SUPPORTS_NUMA=y
+CONFIG_SYS_SUPPORTS_PCI=y
+CONFIG_SYS_SUPPORTS_TMU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_NO_VIRT_TO_BUS=y
+CONFIG_ARCH_HAS_DEFAULT_IDLE=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_DMA_COHERENT=y
+# CONFIG_DMA_NONCOHERENT is not set
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_BZIP2 is not set
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
+CONFIG_RCU_TRACE=y
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+CONFIG_TREE_RCU_TRACE=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_GROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_RT_GROUP_SCHED=y
+CONFIG_USER_SCHED=y
+# CONFIG_CGROUP_SCHED is not set
+CONFIG_CGROUPS=y
+# CONFIG_CGROUP_DEBUG is not set
+CONFIG_CGROUP_NS=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_DEVICE=y
+# CONFIG_CPUSETS is not set
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+CONFIG_CGROUP_MEM_RES_CTLR=y
+# CONFIG_CGROUP_MEM_RES_CTLR_SWAP is not set
+CONFIG_MM_OWNER=y
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+CONFIG_NAMESPACES=y
+CONFIG_UTS_NS=y
+CONFIG_IPC_NS=y
+CONFIG_USER_NS=y
+CONFIG_PID_NS=y
+CONFIG_NET_NS=y
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+CONFIG_EVENT_PROFILE=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_PCI_QUIRKS=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+# CONFIG_OPROFILE is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+CONFIG_BLK_CGROUP=y
+# CONFIG_DEBUG_BLK_CGROUP is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_CFQ_GROUP_IOSCHED=y
+# CONFIG_DEBUG_CFQ_IOSCHED is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
+
+#
+# System type
+#
+CONFIG_CPU_SH4=y
+CONFIG_CPU_SH4A=y
+CONFIG_CPU_SHX3=y
+# CONFIG_CPU_SUBTYPE_SH7619 is not set
+# CONFIG_CPU_SUBTYPE_SH7201 is not set
+# CONFIG_CPU_SUBTYPE_SH7203 is not set
+# CONFIG_CPU_SUBTYPE_SH7206 is not set
+# CONFIG_CPU_SUBTYPE_SH7263 is not set
+# CONFIG_CPU_SUBTYPE_MXG is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
+# CONFIG_CPU_SUBTYPE_SH7706 is not set
+# CONFIG_CPU_SUBTYPE_SH7707 is not set
+# CONFIG_CPU_SUBTYPE_SH7708 is not set
+# CONFIG_CPU_SUBTYPE_SH7709 is not set
+# CONFIG_CPU_SUBTYPE_SH7710 is not set
+# CONFIG_CPU_SUBTYPE_SH7712 is not set
+# CONFIG_CPU_SUBTYPE_SH7720 is not set
+# CONFIG_CPU_SUBTYPE_SH7721 is not set
+# CONFIG_CPU_SUBTYPE_SH7750 is not set
+# CONFIG_CPU_SUBTYPE_SH7091 is not set
+# CONFIG_CPU_SUBTYPE_SH7750R is not set
+# CONFIG_CPU_SUBTYPE_SH7750S is not set
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
+# CONFIG_CPU_SUBTYPE_SH7751R is not set
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
+# CONFIG_CPU_SUBTYPE_SH7723 is not set
+# CONFIG_CPU_SUBTYPE_SH7724 is not set
+# CONFIG_CPU_SUBTYPE_SH7757 is not set
+# CONFIG_CPU_SUBTYPE_SH7763 is not set
+# CONFIG_CPU_SUBTYPE_SH7770 is not set
+# CONFIG_CPU_SUBTYPE_SH7780 is not set
+# CONFIG_CPU_SUBTYPE_SH7785 is not set
+CONFIG_CPU_SUBTYPE_SH7786=y
+# CONFIG_CPU_SUBTYPE_SHX3 is not set
+# CONFIG_CPU_SUBTYPE_SH7343 is not set
+# CONFIG_CPU_SUBTYPE_SH7722 is not set
+# CONFIG_CPU_SUBTYPE_SH7366 is not set
+
+#
+# Memory management options
+#
+CONFIG_QUICKLIST=y
+CONFIG_MMU=y
+CONFIG_PAGE_OFFSET=0x80000000
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_MEMORY_START=0x60000000
+CONFIG_MEMORY_SIZE=0x20000000
+# CONFIG_29BIT is not set
+CONFIG_32BIT=y
+CONFIG_PMB=y
+# CONFIG_PMB_LEGACY is not set
+CONFIG_X2TLB=y
+CONFIG_VSYSCALL=y
+# CONFIG_NUMA is not set
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_MAX_ACTIVE_REGIONS=1
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_ARCH_MEMORY_PROBE=y
+CONFIG_IOREMAP_FIXED=y
+CONFIG_PAGE_SIZE_4KB=y
+# CONFIG_PAGE_SIZE_8KB is not set
+# CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_64KB is not set
+# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
+# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
+CONFIG_HUGETLB_PAGE_SIZE_1MB=y
+# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
+# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
+# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+# CONFIG_FLATMEM_MANUAL is not set
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_STATIC=y
+CONFIG_MEMORY_HOTPLUG=y
+CONFIG_MEMORY_HOTPLUG_SPARSE=y
+CONFIG_MEMORY_HOTREMOVE=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_NR_QUICK=1
+CONFIG_KSM=y
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+
+#
+# Cache configuration
+#
+CONFIG_CACHE_WRITEBACK=y
+# CONFIG_CACHE_WRITETHROUGH is not set
+# CONFIG_CACHE_OFF is not set
+
+#
+# Processor features
+#
+CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_CPU_BIG_ENDIAN is not set
+CONFIG_SH_FPU=y
+CONFIG_SH_STORE_QUEUES=y
+CONFIG_CPU_HAS_INTEVT=y
+CONFIG_CPU_HAS_SR_RB=y
+CONFIG_CPU_HAS_PTEAEX=y
+CONFIG_CPU_HAS_FPU=y
+
+#
+# Board support
+#
+CONFIG_SH_SDK7786=y
+# CONFIG_SH_URQUELL is not set
+
+#
+# Timer and clock configuration
+#
+CONFIG_SH_TIMER_TMU=y
+CONFIG_SH_CLK_CPG=y
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+# CONFIG_CPU_FREQ_DEBUG is not set
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
+CONFIG_SH_CPU_FREQ=y
+
+#
+# DMA support
+#
+# CONFIG_SH_DMA is not set
+
+#
+# Companion Chips
+#
+
+#
+# Additional SuperH Device Drivers
+#
+CONFIG_HEARTBEAT=y
+# CONFIG_PUSH_SWITCH is not set
+
+#
+# Kernel features
+#
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_SCHED_HRTICK=y
+CONFIG_KEXEC=y
+# CONFIG_CRASH_DUMP is not set
+CONFIG_SECCOMP=y
+# CONFIG_SMP is not set
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_GUSA=y
+
+#
+# Boot options
+#
+CONFIG_ZERO_PAGE_OFFSET=0x00001000
+CONFIG_BOOT_LINK_OFFSET=0x00800000
+CONFIG_ENTRY_OFFSET=0x00001000
+CONFIG_CMDLINE_OVERWRITE=y
+# CONFIG_CMDLINE_EXTEND is not set
+CONFIG_CMDLINE="console=ttySC1,115200 earlyprintk=sh-sci.1,115200 root=/dev/sda1 nmi_debug=state,debounce rootdelay=10"
+
+#
+# Bus options
+#
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIEAER=y
+# CONFIG_PCIE_ECRC is not set
+CONFIG_PCIEAER_INJECT=y
+CONFIG_PCIEASPM=y
+CONFIG_PCIEASPM_DEBUG=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCI_LEGACY is not set
+CONFIG_PCI_DEBUG=y
+# CONFIG_PCI_STUB is not set
+# CONFIG_PCI_IOV is not set
+# CONFIG_PCCARD is not set
+# CONFIG_HOTPLUG_PCI is not set
+
+#
+# Executable file formats
+#
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=y
+
+#
+# Power management options (EXPERIMENTAL)
+#
+CONFIG_PM=y
+CONFIG_PM_DEBUG=y
+CONFIG_PM_VERBOSE=y
+# CONFIG_HIBERNATION is not set
+CONFIG_PM_RUNTIME=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+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_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE 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=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA 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_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_PHANTOM is not set
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_HP_ILO is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_CB710_CORE is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_AIC94XX is not set
+# CONFIG_SCSI_MVSAS is not set
+# CONFIG_SCSI_ARCMSR is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_MEGARAID_SAS is not set
+# CONFIG_SCSI_MPT2SAS is not set
+# CONFIG_SCSI_HPTIOP is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_FCOE is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_STEX is not set
+# CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+# CONFIG_SCSI_QLA_FC is not set
+# CONFIG_SCSI_QLA_ISCSI is not set
+# CONFIG_SCSI_LPFC is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_NSP32 is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
+# CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_BFA_FC is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+CONFIG_ATA=y
+# CONFIG_ATA_NONSTANDARD is not set
+CONFIG_ATA_VERBOSE_ERROR=y
+CONFIG_SATA_PMP=y
+# CONFIG_SATA_AHCI is not set
+CONFIG_SATA_SIL24=y
+CONFIG_ATA_SFF=y
+# CONFIG_SATA_SVW is not set
+# CONFIG_ATA_PIIX is not set
+# CONFIG_SATA_MV is not set
+# CONFIG_SATA_NV is not set
+# CONFIG_PDC_ADMA is not set
+# CONFIG_SATA_QSTOR is not set
+# CONFIG_SATA_PROMISE is not set
+# CONFIG_SATA_SX4 is not set
+# CONFIG_SATA_SIL is not set
+# CONFIG_SATA_SIS is not set
+# CONFIG_SATA_ULI is not set
+# CONFIG_SATA_VIA is not set
+# CONFIG_SATA_VITESSE is not set
+# CONFIG_SATA_INIC162X is not set
+# CONFIG_PATA_ALI is not set
+# CONFIG_PATA_AMD is not set
+# CONFIG_PATA_ARTOP is not set
+# CONFIG_PATA_ATP867X is not set
+# CONFIG_PATA_ATIIXP is not set
+# CONFIG_PATA_CMD640_PCI is not set
+# CONFIG_PATA_CMD64X is not set
+# CONFIG_PATA_CS5520 is not set
+# CONFIG_PATA_CS5530 is not set
+# CONFIG_PATA_CYPRESS is not set
+# CONFIG_PATA_EFAR is not set
+# CONFIG_ATA_GENERIC is not set
+# CONFIG_PATA_HPT366 is not set
+# CONFIG_PATA_HPT37X is not set
+# CONFIG_PATA_HPT3X2N is not set
+# CONFIG_PATA_HPT3X3 is not set
+# CONFIG_PATA_IT821X is not set
+# CONFIG_PATA_IT8213 is not set
+# CONFIG_PATA_JMICRON is not set
+# CONFIG_PATA_TRIFLEX is not set
+# CONFIG_PATA_MARVELL is not set
+# CONFIG_PATA_MPIIX is not set
+# CONFIG_PATA_OLDPIIX is not set
+# CONFIG_PATA_NETCELL is not set
+# CONFIG_PATA_NINJA32 is not set
+# CONFIG_PATA_NS87410 is not set
+# CONFIG_PATA_NS87415 is not set
+# CONFIG_PATA_OPTI is not set
+# CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC2027X is not set
+# CONFIG_PATA_PDC_OLD is not set
+# CONFIG_PATA_RADISYS is not set
+# CONFIG_PATA_RDC is not set
+# CONFIG_PATA_RZ1000 is not set
+# CONFIG_PATA_SC1200 is not set
+# CONFIG_PATA_SERVERWORKS is not set
+# CONFIG_PATA_SIL680 is not set
+# CONFIG_PATA_SIS is not set
+# CONFIG_PATA_TOSHIBA is not set
+# CONFIG_PATA_VIA is not set
+# CONFIG_PATA_WINBOND is not set
+CONFIG_PATA_PLATFORM=y
+# CONFIG_PATA_SCH is not set
+# CONFIG_MD is not set
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# You can enable one or both FireWire driver stacks.
+#
+
+#
+# The newer stack is recommended.
+#
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_ARCNET is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_FIXED_PHY is not set
+CONFIG_MDIO_BITBANG=y
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_AX88796 is not set
+# CONFIG_STNIC is not set
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_CASSINI is not set
+# CONFIG_NET_VENDOR_3COM is not set
+CONFIG_SMC91X=y
+# CONFIG_ENC28J60 is not set
+# CONFIG_ETHOC is not set
+# CONFIG_SMC911X is not set
+CONFIG_SMSC911X=y
+# CONFIG_DNET is not set
+# CONFIG_NET_TULIP is not set
+# CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_NET_PCI is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_ATL2 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_TR is not set
+CONFIG_WLAN=y
+# CONFIG_ATMEL is not set
+# CONFIG_PRISM54 is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_SH_KEYSC is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_NOZOMI is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_NR_UARTS=6
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_JSM is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_DEVPORT=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# PC SMBus host controller drivers
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_ISCH is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SH_MOBILE is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_TSL2550 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
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_SH_MSIOF is not set
+# CONFIG_SPI_SH_SCI is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_ALIM7101_WDT is not set
+# CONFIG_SH_WDT is not set
+
+#
+# PCI-based Watchdog Cards
+#
+# CONFIG_PCIPCWATCHDOG is not set
+# CONFIG_WDTPCI is not set
+
+#
+# USB-based Watchdog Cards
+#
+# CONFIG_USBPCWATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_SH_MOBILE_SDHI is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13783 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_88PM8607 is not set
+# CONFIG_AB4500_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+CONFIG_VGA_ARB=y
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+CONFIG_VIDEO_OUTPUT_CONTROL=m
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+CONFIG_USB_MON=y
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_XHCI_HCD is not set
+# CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
+# CONFIG_USB_GADGET_MUSB_HDRC is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+# 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_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_ALAUDA is not set
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG is not set
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=2
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_ATMEL_USBA is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_PXA25X is not set
+# CONFIG_USB_GADGET_R8A66597 is not set
+# CONFIG_USB_GADGET_PXA27X is not set
+# CONFIG_USB_GADGET_S3C_HSOTG is not set
+# CONFIG_USB_GADGET_IMX is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+CONFIG_USB_GADGET_M66592=y
+CONFIG_USB_M66592=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_QE is not set
+# CONFIG_USB_GADGET_CI13XXX is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LANGWELL is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_MULTI is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_UWB is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+CONFIG_RTC_DRV_MAX6900=y
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+CONFIG_RTC_DRV_SH=y
+# CONFIG_RTC_DRV_GENERIC is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+CONFIG_UIO=m
+# CONFIG_UIO_CIF is not set
+# CONFIG_UIO_PDRV is not set
+# CONFIG_UIO_PDRV_GENIRQ is not set
+# CONFIG_UIO_SMX is not set
+# CONFIG_UIO_AEC is not set
+# CONFIG_UIO_SERCOS3 is not set
+# CONFIG_UIO_PCI_GENERIC is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING 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=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4_FS 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 is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+CONFIG_HUGETLBFS=y
+CONFIG_HUGETLB_PAGE=y
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# 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_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+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
+# 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
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+# CONFIG_NLS_CODEPAGE_437 is not set
+# 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 is not set
+# 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 is not set
+# CONFIG_DLM is not set
+
+#
+# Kernel hacking
+#
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_PRINTK_TIME=y
+CONFIG_ENABLE_WARN_DEPRECATED=y
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+CONFIG_DEBUG_SHIRQ=y
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_VM=y
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_FTRACE_SYSCALLS is not set
+# CONFIG_BOOT_TRACER is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+CONFIG_KSYM_TRACER=y
+# CONFIG_PROFILE_KSYM_TRACER is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_STACK_DEBUG is not set
+CONFIG_DEBUG_STACK_USAGE=y
+# CONFIG_4KSTACKS is not set
+CONFIG_DUMP_CODE=y
+CONFIG_DWARF_UNWINDER=y
+# CONFIG_SH_NO_BSS_INIT is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MANAGER2 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
index 391cbe1c295662e8a769838ea37b36fd5be7d5a5..3cee58e7f1e5ff0677a1b003030d3fe19e3ffa09 100644 (file)
@@ -40,10 +40,10 @@ static irqreturn_t pvr2_dma_interrupt(int irq, void *dev_id)
 
 static int pvr2_request_dma(struct dma_channel *chan)
 {
-       if (ctrl_inl(PVR2_DMA_MODE) != 0)
+       if (__raw_readl(PVR2_DMA_MODE) != 0)
                return -EBUSY;
 
-       ctrl_outl(0, PVR2_DMA_LMMODE0);
+       __raw_writel(0, PVR2_DMA_LMMODE0);
 
        return 0;
 }
@@ -60,9 +60,9 @@ static int pvr2_xfer_dma(struct dma_channel *chan)
 
        xfer_complete = 0;
 
-       ctrl_outl(chan->dar, PVR2_DMA_ADDR);
-       ctrl_outl(chan->count, PVR2_DMA_COUNT);
-       ctrl_outl(chan->mode & DMA_MODE_MASK, PVR2_DMA_MODE);
+       __raw_writel(chan->dar, PVR2_DMA_ADDR);
+       __raw_writel(chan->count, PVR2_DMA_COUNT);
+       __raw_writel(chan->mode & DMA_MODE_MASK, PVR2_DMA_MODE);
 
        return 0;
 }
index 37fb5b8bbc3f122d0e0a1b3e50ee43b6e630fcc6..827208781ed5942220401895a1d75f7b7dc0e2b8 100644 (file)
@@ -52,11 +52,14 @@ static inline unsigned int get_dmte_irq(unsigned int chan)
  *
  * iterations to complete the transfer.
  */
+static unsigned int ts_shift[] = TS_SHIFT;
 static inline unsigned int calc_xmit_shift(struct dma_channel *chan)
 {
-       u32 chcr = ctrl_inl(dma_base_addr[chan->chan] + CHCR);
+       u32 chcr = __raw_readl(dma_base_addr[chan->chan] + CHCR);
+       int cnt = ((chcr & CHCR_TS_LOW_MASK) >> CHCR_TS_LOW_SHIFT) |
+               ((chcr & CHCR_TS_HIGH_MASK) >> CHCR_TS_HIGH_SHIFT);
 
-       return ts_shift[(chcr & CHCR_TS_MASK)>>CHCR_TS_SHIFT];
+       return ts_shift[cnt];
 }
 
 /*
@@ -70,13 +73,13 @@ static irqreturn_t dma_tei(int irq, void *dev_id)
        struct dma_channel *chan = dev_id;
        u32 chcr;
 
-       chcr = ctrl_inl(dma_base_addr[chan->chan] + CHCR);
+       chcr = __raw_readl(dma_base_addr[chan->chan] + CHCR);
 
        if (!(chcr & CHCR_TE))
                return IRQ_NONE;
 
        chcr &= ~(CHCR_IE | CHCR_DE);
-       ctrl_outl(chcr, (dma_base_addr[chan->chan] + CHCR));
+       __raw_writel(chcr, (dma_base_addr[chan->chan] + CHCR));
 
        wake_up(&chan->wait_queue);
 
@@ -115,7 +118,7 @@ sh_dmac_configure_channel(struct dma_channel *chan, unsigned long chcr)
                chan->flags &= ~DMA_TEI_CAPABLE;
        }
 
-       ctrl_outl(chcr, (dma_base_addr[chan->chan] + CHCR));
+       __raw_writel(chcr, (dma_base_addr[chan->chan] + CHCR));
 
        chan->flags |= DMA_CONFIGURED;
        return 0;
@@ -126,13 +129,13 @@ static void sh_dmac_enable_dma(struct dma_channel *chan)
        int irq;
        u32 chcr;
 
-       chcr = ctrl_inl(dma_base_addr[chan->chan] + CHCR);
+       chcr = __raw_readl(dma_base_addr[chan->chan] + CHCR);
        chcr |= CHCR_DE;
 
        if (chan->flags & DMA_TEI_CAPABLE)
                chcr |= CHCR_IE;
 
-       ctrl_outl(chcr, (dma_base_addr[chan->chan] + CHCR));
+       __raw_writel(chcr, (dma_base_addr[chan->chan] + CHCR));
 
        if (chan->flags & DMA_TEI_CAPABLE) {
                irq = get_dmte_irq(chan->chan);
@@ -150,9 +153,9 @@ static void sh_dmac_disable_dma(struct dma_channel *chan)
                disable_irq(irq);
        }
 
-       chcr = ctrl_inl(dma_base_addr[chan->chan] + CHCR);
+       chcr = __raw_readl(dma_base_addr[chan->chan] + CHCR);
        chcr &= ~(CHCR_DE | CHCR_TE | CHCR_IE);
-       ctrl_outl(chcr, (dma_base_addr[chan->chan] + CHCR));
+       __raw_writel(chcr, (dma_base_addr[chan->chan] + CHCR));
 }
 
 static int sh_dmac_xfer_dma(struct dma_channel *chan)
@@ -183,12 +186,12 @@ static int sh_dmac_xfer_dma(struct dma_channel *chan)
         */
        if (chan->sar || (mach_is_dreamcast() &&
                          chan->chan == PVR2_CASCADE_CHAN))
-               ctrl_outl(chan->sar, (dma_base_addr[chan->chan]+SAR));
+               __raw_writel(chan->sar, (dma_base_addr[chan->chan]+SAR));
        if (chan->dar || (mach_is_dreamcast() &&
                          chan->chan == PVR2_CASCADE_CHAN))
-               ctrl_outl(chan->dar, (dma_base_addr[chan->chan] + DAR));
+               __raw_writel(chan->dar, (dma_base_addr[chan->chan] + DAR));
 
-       ctrl_outl(chan->count >> calc_xmit_shift(chan),
+       __raw_writel(chan->count >> calc_xmit_shift(chan),
                (dma_base_addr[chan->chan] + TCR));
 
        sh_dmac_enable_dma(chan);
@@ -198,10 +201,10 @@ static int sh_dmac_xfer_dma(struct dma_channel *chan)
 
 static int sh_dmac_get_dma_residue(struct dma_channel *chan)
 {
-       if (!(ctrl_inl(dma_base_addr[chan->chan] + CHCR) & CHCR_DE))
+       if (!(__raw_readl(dma_base_addr[chan->chan] + CHCR) & CHCR_DE))
                return 0;
 
-       return ctrl_inl(dma_base_addr[chan->chan] + TCR)
+       return __raw_readl(dma_base_addr[chan->chan] + TCR)
                 << calc_xmit_shift(chan);
 }
 
index 5e22689c2fcfd57ced1bce69ee805334db7b483d..72622e3076136d425c8e574487332619dc910fab 100644 (file)
@@ -86,8 +86,8 @@ static irqreturn_t dmabrg_irq(int irq, void *data)
        unsigned long dcr;
        unsigned int i;
 
-       dcr = ctrl_inl(DMABRGCR);
-       ctrl_outl(dcr & ~0x00ff0003, DMABRGCR); /* ack all */
+       dcr = __raw_readl(DMABRGCR);
+       __raw_writel(dcr & ~0x00ff0003, DMABRGCR);      /* ack all */
        dcr &= dcr >> 8;        /* ignore masked */
 
        /* USB stuff, get it out of the way first */
@@ -109,17 +109,17 @@ static irqreturn_t dmabrg_irq(int irq, void *data)
 static void dmabrg_disable_irq(unsigned int dmairq)
 {
        unsigned long dcr;
-       dcr = ctrl_inl(DMABRGCR);
+       dcr = __raw_readl(DMABRGCR);
        dcr &= ~(1 << ((dmairq > 1) ? dmairq + 22 : dmairq + 8));
-       ctrl_outl(dcr, DMABRGCR);
+       __raw_writel(dcr, DMABRGCR);
 }
 
 static void dmabrg_enable_irq(unsigned int dmairq)
 {
        unsigned long dcr;
-       dcr = ctrl_inl(DMABRGCR);
+       dcr = __raw_readl(DMABRGCR);
        dcr |= (1 << ((dmairq > 1) ? dmairq + 22 : dmairq + 8));
-       ctrl_outl(dcr, DMABRGCR);
+       __raw_writel(dcr, DMABRGCR);
 }
 
 int dmabrg_request_irq(unsigned int dmairq, void(*handler)(void*),
@@ -165,13 +165,13 @@ static int __init dmabrg_init(void)
                printk(KERN_INFO "DMABRG: DMAC ch0 not reserved!\n");
 #endif
 
-       ctrl_outl(0, DMABRGCR);
-       ctrl_outl(0, DMACHCR0);
-       ctrl_outl(0x94000000, DMARSRA); /* enable DMABRG in DMAC 0 */
+       __raw_writel(0, DMABRGCR);
+       __raw_writel(0, DMACHCR0);
+       __raw_writel(0x94000000, DMARSRA);      /* enable DMABRG in DMAC 0 */
 
        /* enable DMABRG mode, enable the DMAC */
-       or = ctrl_inl(DMAOR);
-       ctrl_outl(or | DMAOR_BRG | DMAOR_DMEN, DMAOR);
+       or = __raw_readl(DMAOR);
+       __raw_writel(or | DMAOR_BRG | DMAOR_DMEN, DMAOR);
 
        ret = request_irq(DMABRGI0, dmabrg_irq, IRQF_DISABLED,
                        "DMABRG USB address error", NULL);
index a9339a6174fc5d1fd527a5f6d76e378f2623c5a3..2acbc793032de7da013c16db1c3e1e4eb3ed2c12 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Generic heartbeat driver for regular LED banks
  *
- * Copyright (C) 2007  Paul Mundt
+ * Copyright (C) 2007 - 2010  Paul Mundt
  *
  * Most SH reference boards include a number of individual LEDs that can
  * be independently controlled (either via a pre-defined hardware
@@ -27,7 +27,7 @@
 #include <asm/heartbeat.h>
 
 #define DRV_NAME "heartbeat"
-#define DRV_VERSION "0.1.1"
+#define DRV_VERSION "0.1.2"
 
 static unsigned char default_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
 
@@ -98,7 +98,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
                        return -ENOMEM;
        }
 
-       hd->base = ioremap_nocache(res->start, res->end - res->start + 1);
+       hd->base = ioremap_nocache(res->start, resource_size(res));
        if (unlikely(!hd->base)) {
                dev_err(&pdev->dev, "ioremap failed\n");
 
@@ -117,8 +117,20 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
        for (i = 0; i < hd->nr_bits; i++)
                hd->mask |= (1 << hd->bit_pos[i]);
 
-       if (!hd->regsize)
-               hd->regsize = 8;        /* default access size */
+       if (!hd->regsize) {
+               switch (res->flags & IORESOURCE_MEM_TYPE_MASK) {
+               case IORESOURCE_MEM_32BIT:
+                       hd->regsize = 32;
+                       break;
+               case IORESOURCE_MEM_16BIT:
+                       hd->regsize = 16;
+                       break;
+               case IORESOURCE_MEM_8BIT:
+               default:
+                       hd->regsize = 8;
+                       break;
+               }
+       }
 
        setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd);
        platform_set_drvdata(pdev, hd);
index 08af1f4597569a1ec761e43dc6cf40a94789ab74..4a59e6890876cd2d1546e991011c887c4a230983 100644 (file)
@@ -1,14 +1,14 @@
 #
 # Makefile for the PCI specific kernel interface routines under Linux.
 #
-obj-y                                  += pci.o
+obj-y                                  += common.o pci.o
 
 obj-$(CONFIG_CPU_SUBTYPE_SH7751)       += pci-sh7751.o ops-sh4.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7751R)      += pci-sh7751.o ops-sh4.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7763)       += pci-sh7780.o ops-sh4.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7780)       += pci-sh7780.o ops-sh4.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7785)       += pci-sh7780.o ops-sh4.o
-obj-$(CONFIG_CPU_SUBTYPE_SH7786)       += ops-sh7786.o
+obj-$(CONFIG_CPU_SUBTYPE_SH7786)       += pcie-sh7786.o ops-sh7786.o
 obj-$(CONFIG_CPU_SH5)                  += pci-sh5.o ops-sh5.o
 
 obj-$(CONFIG_SH_DREAMCAST)             += ops-dreamcast.o fixups-dreamcast.o \
@@ -25,4 +25,3 @@ obj-$(CONFIG_SH_TITAN)                        += fixups-titan.o
 obj-$(CONFIG_SH_LANDISK)               += fixups-landisk.o
 obj-$(CONFIG_SH_LBOX_RE2)              += fixups-rts7751r2d.o
 obj-$(CONFIG_SH_CAYMAN)                        += fixups-cayman.o
-obj-$(CONFIG_SH_URQUELL)               += pcie-sh7786.o
diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
new file mode 100644 (file)
index 0000000..dbf1381
--- /dev/null
@@ -0,0 +1,162 @@
+#include <linux/pci.h>
+#include <linux/interrupt.h>
+#include <linux/timer.h>
+#include <linux/kernel.h>
+
+/*
+ * These functions are used early on before PCI scanning is done
+ * and all of the pci_dev and pci_bus structures have been created.
+ */
+static struct pci_dev *fake_pci_dev(struct pci_channel *hose,
+       int top_bus, int busnr, int devfn)
+{
+       static struct pci_dev dev;
+       static struct pci_bus bus;
+
+       dev.bus = &bus;
+       dev.sysdata = hose;
+       dev.devfn = devfn;
+       bus.number = busnr;
+       bus.sysdata = hose;
+       bus.ops = hose->pci_ops;
+
+       if(busnr != top_bus)
+               /* Fake a parent bus structure. */
+               bus.parent = &bus;
+       else
+               bus.parent = NULL;
+
+       return &dev;
+}
+
+#define EARLY_PCI_OP(rw, size, type)                                   \
+int __init early_##rw##_config_##size(struct pci_channel *hose,                \
+       int top_bus, int bus, int devfn, int offset, type value)        \
+{                                                                      \
+       return pci_##rw##_config_##size(                                \
+               fake_pci_dev(hose, top_bus, bus, devfn),                \
+               offset, value);                                         \
+}
+
+EARLY_PCI_OP(read, byte, u8 *)
+EARLY_PCI_OP(read, word, u16 *)
+EARLY_PCI_OP(read, dword, u32 *)
+EARLY_PCI_OP(write, byte, u8)
+EARLY_PCI_OP(write, word, u16)
+EARLY_PCI_OP(write, dword, u32)
+
+int __init pci_is_66mhz_capable(struct pci_channel *hose,
+                               int top_bus, int current_bus)
+{
+       u32 pci_devfn;
+       unsigned short vid;
+       int cap66 = -1;
+       u16 stat;
+
+       printk(KERN_INFO "PCI: Checking 66MHz capabilities...\n");
+
+       for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
+               if (PCI_FUNC(pci_devfn))
+                       continue;
+               if (early_read_config_word(hose, top_bus, current_bus,
+                                          pci_devfn, PCI_VENDOR_ID, &vid) !=
+                   PCIBIOS_SUCCESSFUL)
+                       continue;
+               if (vid == 0xffff)
+                       continue;
+
+               /* check 66MHz capability */
+               if (cap66 < 0)
+                       cap66 = 1;
+               if (cap66) {
+                       early_read_config_word(hose, top_bus, current_bus,
+                                              pci_devfn, PCI_STATUS, &stat);
+                       if (!(stat & PCI_STATUS_66MHZ)) {
+                               printk(KERN_DEBUG
+                                      "PCI: %02x:%02x not 66MHz capable.\n",
+                                      current_bus, pci_devfn);
+                               cap66 = 0;
+                               break;
+                       }
+               }
+       }
+
+       return cap66 > 0;
+}
+
+static void pcibios_enable_err(unsigned long __data)
+{
+       struct pci_channel *hose = (struct pci_channel *)__data;
+
+       del_timer(&hose->err_timer);
+       printk(KERN_DEBUG "PCI: re-enabling error IRQ.\n");
+       enable_irq(hose->err_irq);
+}
+
+static void pcibios_enable_serr(unsigned long __data)
+{
+       struct pci_channel *hose = (struct pci_channel *)__data;
+
+       del_timer(&hose->serr_timer);
+       printk(KERN_DEBUG "PCI: re-enabling system error IRQ.\n");
+       enable_irq(hose->serr_irq);
+}
+
+void pcibios_enable_timers(struct pci_channel *hose)
+{
+       if (hose->err_irq) {
+               init_timer(&hose->err_timer);
+               hose->err_timer.data = (unsigned long)hose;
+               hose->err_timer.function = pcibios_enable_err;
+       }
+
+       if (hose->serr_irq) {
+               init_timer(&hose->serr_timer);
+               hose->serr_timer.data = (unsigned long)hose;
+               hose->serr_timer.function = pcibios_enable_serr;
+       }
+}
+
+/*
+ * A simple handler for the regular PCI status errors, called from IRQ
+ * context.
+ */
+unsigned int pcibios_handle_status_errors(unsigned long addr,
+                                         unsigned int status,
+                                         struct pci_channel *hose)
+{
+       unsigned int cmd = 0;
+
+       if (status & PCI_STATUS_REC_MASTER_ABORT) {
+               printk(KERN_DEBUG "PCI: master abort, pc=0x%08lx\n", addr);
+               cmd |= PCI_STATUS_REC_MASTER_ABORT;
+       }
+
+       if (status & PCI_STATUS_REC_TARGET_ABORT) {
+               printk(KERN_DEBUG "PCI: target abort: ");
+               pcibios_report_status(PCI_STATUS_REC_TARGET_ABORT |
+                                     PCI_STATUS_SIG_TARGET_ABORT |
+                                     PCI_STATUS_REC_MASTER_ABORT, 1);
+               printk("\n");
+
+               cmd |= PCI_STATUS_REC_TARGET_ABORT;
+       }
+
+       if (status & (PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY)) {
+               printk(KERN_DEBUG "PCI: parity error detected: ");
+               pcibios_report_status(PCI_STATUS_PARITY |
+                                     PCI_STATUS_DETECTED_PARITY, 1);
+               printk("\n");
+
+               cmd |= PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY;
+
+               /* Now back off of the IRQ for awhile */
+               if (hose->err_irq) {
+                       disable_irq_nosync(hose->err_irq);
+                       hose->err_timer.expires = jiffies + HZ;
+                       add_timer(&hose->err_timer);
+               }
+       }
+
+       return cmd;
+}
index ed7f489936f1e3075428434ef61b8f0739150084..942ef4f155f534ebe46aa77ca8279c95002b8d35 100644 (file)
@@ -39,7 +39,7 @@ static void __init gapspci_fixup_resources(struct pci_dev *dev)
                /*
                 * We also assume that dev->devfn == 0
                 */
-               dev->resource[1].start  = p->io_resource->start  + 0x100;
+               dev->resource[1].start  = p->resources[0].start  + 0x100;
                dev->resource[1].end    = dev->resource[1].start + 0x200 - 1;
 
                /*
index 15ca65cb667e780afc576ef69158161b53b0c362..08b2d8658a00b525acb13bd3662fc5fd2583c2c3 100644 (file)
@@ -22,15 +22,3 @@ int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
 {
        return irq_tab[slot];
 }
-
-int pci_fixup_pcic(struct pci_channel *chan)
-{
-       pci_write_reg(chan, 0x000043ff, SH4_PCIINTM);
-       pci_write_reg(chan, 0x00000000, SH7780_PCIIBAR);
-       pci_write_reg(chan, 0x08000000, SH7780_PCICSCR0);
-       pci_write_reg(chan, 0x0000001b, SH7780_PCICSAR0);
-       pci_write_reg(chan, 0xfd000000, SH7780_PCICSCR1);
-       pci_write_reg(chan, 0x0000000f, SH7780_PCICSAR1);
-
-       return 0;
-}
index 7898f14d6641e701dc8438a53b539d4a89fa624b..e248516118a960fb3789d1cd2ea63a61d744ba50 100644 (file)
@@ -43,7 +43,7 @@ int pci_fixup_pcic(struct pci_channel *chan)
 {
        unsigned long bcr1, mcr;
 
-       bcr1 = ctrl_inl(SH7751_BCR1);
+       bcr1 = __raw_readl(SH7751_BCR1);
        bcr1 |= 0x40080000;     /* Enable Bit 19 BREQEN, set PCIC to slave */
        pci_write_reg(chan, bcr1, SH4_PCIBCR1);
 
@@ -54,7 +54,7 @@ int pci_fixup_pcic(struct pci_channel *chan)
        pci_write_reg(chan, 0xfb900047, SH7751_PCICONF1);
        pci_write_reg(chan, 0xab000001, SH7751_PCICONF4);
 
-       mcr = ctrl_inl(SH7751_MCR);
+       mcr = __raw_readl(SH7751_MCR);
        mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
        pci_write_reg(chan, mcr, SH4_PCIMCR);
 
index 250b0edd736538b3e92bda9ee29cda962b931a28..0930f988ac29914a1a34af4993d0a09d4756f88a 100644 (file)
@@ -31,22 +31,3 @@ int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
 {
        return sdk7780_irq_tab[pin-1][slot];
 }
-int pci_fixup_pcic(struct pci_channel *chan)
-{
-       /* Enable all interrupts, so we know what to fix */
-       pci_write_reg(chan, 0x0000C3FF, SH7780_PCIIMR);
-
-       /* Set up standard PCI config registers */
-       pci_write_reg(chan, 0x08000000, SH7780_PCIMBAR0);       /* PCI */
-       pci_write_reg(chan, 0x08000000, SH4_PCILAR0);   /* SHwy */
-       pci_write_reg(chan, 0x07F00001, SH4_PCILSR0);   /* size 128M w/ MBAR */
-
-       pci_write_reg(chan, 0x00000000, SH7780_PCIMBAR1);
-       pci_write_reg(chan, 0x00000000, SH4_PCILAR1);
-       pci_write_reg(chan, 0x00000000, SH4_PCILSR1);
-
-       pci_write_reg(chan, 0xAB000801, SH7780_PCIIBAR);
-       pci_write_reg(chan, 0xA5000C01, SH4_PCICR);
-
-       return 0;
-}
index 475fa9f0fe2ccc0e23b4275e2bf6cbb6b7faa5d2..a4c7d3a4efca4ef65296d8c8dcba1b517ce844c2 100644 (file)
@@ -97,12 +97,12 @@ int pci_fixup_pcic(struct pci_channel *chan)
        * meaning all calls go straight through... use BUG_ON to
        * catch erroneous assumption.
        */
-       BUG_ON(chan->mem_resource->start != SH7751_PCI_MEMORY_BASE);
+       BUG_ON(chan->resources[1].start != SH7751_PCI_MEMORY_BASE);
 
-       PCIC_WRITE(SH7751_PCIMBR, chan->mem_resource->start);
+       PCIC_WRITE(SH7751_PCIMBR, chan->resources[1].start);
 
        /* Set IOBR for window containing area specified in pci.h */
-       PCIC_WRITE(SH7751_PCIIOBR, (chan->io_resource->start & SH7751_PCIIOBR_MASK));
+       PCIC_WRITE(SH7751_PCIIOBR, (chan->resources[0].start & SH7751_PCIIOBR_MASK));
 
        /* All done, may as well say so... */
        printk("SH7751 PCI: Finished initialization of the PCI controller\n");
index 78bebebdc99c33aa3fd1970a3a533f25f0180d81..0b81999fb88ba96c15de7606fe80fa02956ae37e 100644 (file)
@@ -16,7 +16,7 @@
  * Direct access to PCI hardware...
  */
 #define CONFIG_CMD(bus, devfn, where) \
-       (P1SEG | (bus->number << 16) | (devfn << 8) | (where & ~3))
+       (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
 
 static DEFINE_SPINLOCK(sh4_pci_lock);
 
@@ -102,34 +102,6 @@ struct pci_ops sh4_pci_ops = {
        .write          = sh4_pci_write,
 };
 
-/*
- * Not really related to pci_ops, but it's common and not worth shoving
- * somewhere else for now..
- */
-int __init sh4_pci_check_direct(struct pci_channel *chan)
-{
-       /*
-        * Check if configuration works.
-        */
-       unsigned int tmp = pci_read_reg(chan, SH4_PCIPAR);
-
-       pci_write_reg(chan, P1SEG, SH4_PCIPAR);
-
-       if (pci_read_reg(chan, SH4_PCIPAR) == P1SEG) {
-               pci_write_reg(chan, tmp, SH4_PCIPAR);
-               printk(KERN_INFO "PCI: Using configuration type 1\n");
-               request_region(chan->reg_base + SH4_PCIPAR, 8,
-                              "PCI conf1");
-               return 0;
-       }
-
-       pci_write_reg(chan, tmp, SH4_PCIPAR);
-
-       printk(KERN_ERR "PCI: %s failed\n", __func__);
-
-       return -EINVAL;
-}
-
 int __attribute__((weak)) pci_fixup_pcic(struct pci_channel *chan)
 {
        /* Nothing to do. */
index 210f9d4af1411c3aa0efe893302043c487e4d463..633694193af8f7c08011ac971c28d3f58424dd2a 100644 (file)
 #include <asm/irq.h>
 #include <mach/pci.h>
 
-static struct resource gapspci_io_resource = {
-       .name   = "GAPSPCI IO",
-       .start  = GAPSPCI_BBA_CONFIG,
-       .end    = GAPSPCI_BBA_CONFIG + GAPSPCI_BBA_CONFIG_SIZE - 1,
-       .flags  = IORESOURCE_IO,
-};
-
-static struct resource gapspci_mem_resource = {
-       .name   = "GAPSPCI mem",
-       .start  = GAPSPCI_DMA_BASE,
-       .end    = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1,
-       .flags  = IORESOURCE_MEM,
+static struct resource gapspci_resources[] = {
+       {
+               .name   = "GAPSPCI IO",
+               .start  = GAPSPCI_BBA_CONFIG,
+               .end    = GAPSPCI_BBA_CONFIG + GAPSPCI_BBA_CONFIG_SIZE - 1,
+               .flags  = IORESOURCE_IO,
+       },  {
+               .name   = "GAPSPCI mem",
+               .start  = GAPSPCI_DMA_BASE,
+               .end    = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
 };
 
 static struct pci_channel dreamcast_pci_controller = {
        .pci_ops        = &gapspci_pci_ops,
-       .io_resource    = &gapspci_io_resource,
+       .resources      = gapspci_resources,
+       .nr_resources   = ARRAY_SIZE(gapspci_resources),
        .io_offset      = 0x00000000,
-       .mem_resource   = &gapspci_mem_resource,
        .mem_offset     = 0x00000000,
 };
 
@@ -95,8 +95,6 @@ static int __init gapspci_init(void)
        outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10);
        outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14);
 
-       register_pci_controller(&dreamcast_pci_controller);
-
-       return 0;
+       return register_pci_controller(&dreamcast_pci_controller);
 }
 arch_initcall(gapspci_init);
index 3d5296cde622d2ccd27af59ec75dd73650b9388d..cbf763b3015eb6ccb50608f5f53efc909ed60570 100644 (file)
   #define SH4_PCIINT_MWPD        0x00000002    /* Master Write PERR Detect */
   #define SH4_PCIINT_MRPD        0x00000001    /* Master Read PERR Detect */
 #define SH4_PCIINTM            0x118           /* PCI Interrupt Mask */
+  #define SH4_PCIINTM_TTADIM     BIT(14)       /* Target-target abort interrupt */
+  #define SH4_PCIINTM_TMTOIM     BIT(9)        /* Target retry timeout */
+  #define SH4_PCIINTM_MDEIM      BIT(8)        /* Master function disable error */
+  #define SH4_PCIINTM_APEDIM     BIT(7)        /* Address parity error detection */
+  #define SH4_PCIINTM_SDIM       BIT(6)        /* SERR detection */
+  #define SH4_PCIINTM_DPEITWM    BIT(5)        /* Data parity error for target write */
+  #define SH4_PCIINTM_PEDITRM    BIT(4)        /* PERR detection for target read */
+  #define SH4_PCIINTM_TADIMM     BIT(3)        /* Target abort for master */
+  #define SH4_PCIINTM_MADIMM     BIT(2)        /* Master abort for master */
+  #define SH4_PCIINTM_MWPDIM     BIT(1)        /* Master write data parity error */
+  #define SH4_PCIINTM_MRDPEIM    BIT(0)        /* Master read data parity error */
 #define SH4_PCIALR             0x11C           /* Error Address Register */
 #define SH4_PCICLR             0x120           /* Error Command/Data */
   #define SH4_PCICLR_MPIO        0x80000000
@@ -61,7 +72,7 @@
 #define SH4_PCIAINT            0x130           /* Arbiter Interrupt Register */
   #define SH4_PCIAINT_MBKN       0x00002000    /* Master Broken Interrupt */
   #define SH4_PCIAINT_TBTO       0x00001000    /* Target Bus Time Out */
-  #define SH4_PCIAINT_MBTO       0x00001000    /* Master Bus Time Out */
+  #define SH4_PCIAINT_MBTO       0x00000800    /* Master Bus Time Out */
   #define SH4_PCIAINT_TABT       0x00000008    /* Target Abort */
   #define SH4_PCIAINT_MABT       0x00000004    /* Master Abort */
   #define SH4_PCIAINT_RDPE       0x00000002    /* Read Data Parity Error */
 
 /* arch/sh/kernel/drivers/pci/ops-sh4.c */
 extern struct pci_ops sh4_pci_ops;
-int sh4_pci_check_direct(struct pci_channel *chan);
 int pci_fixup_pcic(struct pci_channel *chan);
 
 struct sh4_pci_address_space {
@@ -167,13 +177,13 @@ struct sh4_pci_address_map {
 static inline void pci_write_reg(struct pci_channel *chan,
                                 unsigned long val, unsigned long reg)
 {
-       ctrl_outl(val, chan->reg_base + reg);
+       __raw_writel(val, chan->reg_base + reg);
 }
 
 static inline unsigned long pci_read_reg(struct pci_channel *chan,
                                         unsigned long reg)
 {
-       return ctrl_inl(chan->reg_base + reg);
+       return __raw_readl(chan->reg_base + reg);
 }
 
 #endif /* __PCI_SH4_H */
index 873ed2b4405575a53bcb2f0c3b453ebea0cfc473..0bf296c7879593b1d1aa9f9c020b5f54e7682a2e 100644 (file)
@@ -89,14 +89,13 @@ static irqreturn_t pcish5_serr_irq(int irq, void *dev_id)
        return IRQ_NONE;
 }
 
-static struct resource sh5_io_resource = { /* place holder */ };
-static struct resource sh5_mem_resource = { /* place holder */ };
+static struct resource sh5_pci_resources[2];
 
 static struct pci_channel sh5pci_controller = {
        .pci_ops                = &sh5_pci_ops,
-       .mem_resource           = &sh5_mem_resource,
+       .resources              = sh5_pci_resources,
+       .nr_resources           = ARRAY_SIZE(sh5_pci_resources),
        .mem_offset             = 0x00000000,
-       .io_resource            = &sh5_io_resource,
        .io_offset              = 0x00000000,
 };
 
@@ -210,14 +209,12 @@ static int __init sh5pci_init(void)
         SH5PCI_WRITE(AINTM, ~0);
         SH5PCI_WRITE(PINTM, ~0);
 
-       sh5_io_resource.start = PCI_IO_AREA;
-       sh5_io_resource.end = PCI_IO_AREA + 0x10000;
+       sh5_pci_resources[0].start = PCI_IO_AREA;
+       sh5_pci_resources[0].end = PCI_IO_AREA + 0x10000;
 
-       sh5_mem_resource.start = memStart;
-       sh5_mem_resource.end = memStart + memSize;
+       sh5_pci_resources[1].start = memStart;
+       sh5_pci_resources[1].end = memStart + memSize;
 
-       register_pci_controller(&sh5pci_controller);
-
-       return 0;
+       return register_pci_controller(&sh5pci_controller);
 }
 arch_initcall(sh5pci_init);
index f277628221f3c04c4d23a930f24d118d5a8cda7e..3f01decb43076d53e89710342400efd31b0853ae 100644 (file)
@@ -86,14 +86,14 @@ extern unsigned long pcicr_virt;
 /* #define PCISH5_VCR_REG(x)                ( SH5PCI_VCR_BASE (PCISH5_VCR_##x)) */
 
 /* Write I/O functions */
-#define SH5PCI_WRITE(reg,val)        ctrl_outl((u32)(val),PCISH5_ICR_REG(reg))
-#define SH5PCI_WRITE_SHORT(reg,val)  ctrl_outw((u16)(val),PCISH5_ICR_REG(reg))
-#define SH5PCI_WRITE_BYTE(reg,val)   ctrl_outb((u8)(val),PCISH5_ICR_REG(reg))
+#define SH5PCI_WRITE(reg,val)        __raw_writel((u32)(val),PCISH5_ICR_REG(reg))
+#define SH5PCI_WRITE_SHORT(reg,val)  __raw_writew((u16)(val),PCISH5_ICR_REG(reg))
+#define SH5PCI_WRITE_BYTE(reg,val)   __raw_writeb((u8)(val),PCISH5_ICR_REG(reg))
 
 /* Read I/O functions */
-#define SH5PCI_READ(reg)             ctrl_inl(PCISH5_ICR_REG(reg))
-#define SH5PCI_READ_SHORT(reg)       ctrl_inw(PCISH5_ICR_REG(reg))
-#define SH5PCI_READ_BYTE(reg)        ctrl_inb(PCISH5_ICR_REG(reg))
+#define SH5PCI_READ(reg)             __raw_readl(PCISH5_ICR_REG(reg))
+#define SH5PCI_READ_SHORT(reg)       __raw_readw(PCISH5_ICR_REG(reg))
+#define SH5PCI_READ_BYTE(reg)        __raw_readb(PCISH5_ICR_REG(reg))
 
 /* Set PCI config bits */
 #define SET_CONFIG_BITS(bus,devfn,where)  ((((bus) << 16) | ((devfn) << 8) | ((where) & ~3)) | 0x80000000)
index 70c1999a0ec4c4494a5dd33c263a03d6aabd74f2..17811e5d287bd46b159f908a8e880972ab4251b2 100644 (file)
@@ -44,25 +44,25 @@ static int __init __area_sdram_check(struct pci_channel *chan,
        return 1;
 }
 
-static struct resource sh7751_io_resource = {
-       .name   = "SH7751_IO",
-       .start  = SH7751_PCI_IO_BASE,
-       .end    = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
-       .flags  = IORESOURCE_IO
-};
-
-static struct resource sh7751_mem_resource = {
-       .name   = "SH7751_mem",
-       .start  = SH7751_PCI_MEMORY_BASE,
-       .end    = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
-       .flags  = IORESOURCE_MEM
+static struct resource sh7751_pci_resources[] = {
+       {
+               .name   = "SH7751_IO",
+               .start  = SH7751_PCI_IO_BASE,
+               .end    = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
+               .flags  = IORESOURCE_IO
+       }, {
+               .name   = "SH7751_mem",
+               .start  = SH7751_PCI_MEMORY_BASE,
+               .end    = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
+               .flags  = IORESOURCE_MEM
+       },
 };
 
 static struct pci_channel sh7751_pci_controller = {
        .pci_ops        = &sh4_pci_ops,
-       .mem_resource   = &sh7751_mem_resource,
+       .resources      = sh7751_pci_resources,
+       .nr_resources   = ARRAY_SIZE(sh7751_pci_resources),
        .mem_offset     = 0x00000000,
-       .io_resource    = &sh7751_io_resource,
        .io_offset      = 0x00000000,
        .io_map_base    = SH7751_PCI_IO_BASE,
 };
@@ -79,7 +79,6 @@ static int __init sh7751_pci_init(void)
        struct pci_channel *chan = &sh7751_pci_controller;
        unsigned int id;
        u32 word, reg;
-       int ret;
 
        printk(KERN_NOTICE "PCI: Starting intialization.\n");
 
@@ -93,13 +92,10 @@ static int __init sh7751_pci_init(void)
                return -ENODEV;
        }
 
-       if ((ret = sh4_pci_check_direct(chan)) != 0)
-               return ret;
-
        /* Set the BCR's to enable PCI access */
-       reg = ctrl_inl(SH7751_BCR1);
+       reg = __raw_readl(SH7751_BCR1);
        reg |= 0x80000;
-       ctrl_outl(reg, SH7751_BCR1);
+       __raw_writel(reg, SH7751_BCR1);
 
        /* Turn the clocks back on (not done in reset)*/
        pci_write_reg(chan, 0, SH4_PCICLKR);
@@ -132,13 +128,13 @@ static int __init sh7751_pci_init(void)
        /* Set the local 16MB PCI memory space window to
         * the lowest PCI mapped address
         */
-       word = chan->mem_resource->start & SH4_PCIMBR_MASK;
+       word = chan->resources[1].start & SH4_PCIMBR_MASK;
        pr_debug("PCI: Setting upper bits of Memory window to 0x%x\n", word);
        pci_write_reg(chan, word , SH4_PCIMBR);
 
        /* Make sure the MSB's of IO window are set to access PCI space
         * correctly */
-       word = chan->io_resource->start & SH4_PCIIOBR_MASK;
+       word = chan->resources[0].start & SH4_PCIIOBR_MASK;
        pr_debug("PCI: Setting upper bits of IO window to 0x%x\n", word);
        pci_write_reg(chan, word, SH4_PCIIOBR);
 
@@ -159,13 +155,13 @@ static int __init sh7751_pci_init(void)
                return -1;
 
        /* configure the wait control registers */
-       word = ctrl_inl(SH7751_WCR1);
+       word = __raw_readl(SH7751_WCR1);
        pci_write_reg(chan, word, SH4_PCIWCR1);
-       word = ctrl_inl(SH7751_WCR2);
+       word = __raw_readl(SH7751_WCR2);
        pci_write_reg(chan, word, SH4_PCIWCR2);
-       word = ctrl_inl(SH7751_WCR3);
+       word = __raw_readl(SH7751_WCR3);
        pci_write_reg(chan, word, SH4_PCIWCR3);
-       word = ctrl_inl(SH7751_MCR);
+       word = __raw_readl(SH7751_MCR);
        pci_write_reg(chan, word, SH4_PCIMCR);
 
        /* NOTE: I'm ignoring the PCI error IRQs for now..
@@ -180,8 +176,6 @@ static int __init sh7751_pci_init(void)
        word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM;
        pci_write_reg(chan, word, SH4_PCICR);
 
-       register_pci_controller(chan);
-
-       return 0;
+       return register_pci_controller(chan);
 }
 arch_initcall(sh7751_pci_init);
index 323b92d565fee57f2725bcd54b5758723535e458..ffdcbf10b95e08b6f8b40ce860b2a21539ca63b1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Low-Level PCI Support for the SH7780
  *
- *  Copyright (C) 2005 - 2009  Paul Mundt
+ *  Copyright (C) 2005 - 2010  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/interrupt.h>
+#include <linux/timer.h>
+#include <linux/irq.h>
 #include <linux/errno.h>
 #include <linux/delay.h>
+#include <linux/log2.h>
 #include "pci-sh4.h"
+#include <asm/mmu.h>
+#include <asm/sizes.h>
 
-static struct resource sh7785_io_resource = {
-       .name   = "SH7785_IO",
-       .start  = SH7780_PCI_IO_BASE,
-       .end    = SH7780_PCI_IO_BASE + SH7780_PCI_IO_SIZE - 1,
-       .flags  = IORESOURCE_IO
-};
-
-static struct resource sh7785_mem_resource = {
-       .name   = "SH7785_mem",
-       .start  = SH7780_PCI_MEMORY_BASE,
-       .end    = SH7780_PCI_MEMORY_BASE + SH7780_PCI_MEM_SIZE - 1,
-       .flags  = IORESOURCE_MEM
+static struct resource sh7785_pci_resources[] = {
+       {
+               .name   = "PCI IO",
+               .start  = 0x1000,
+               .end    = SZ_4M - 1,
+               .flags  = IORESOURCE_IO,
+       }, {
+               .name   = "PCI MEM 0",
+               .start  = 0xfd000000,
+               .end    = 0xfd000000 + SZ_16M - 1,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "PCI MEM 1",
+               .start  = 0x10000000,
+               .end    = 0x10000000 + SZ_64M - 1,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               /*
+                * 32-bit only resources must be last.
+                */
+               .name   = "PCI MEM 2",
+               .start  = 0xc0000000,
+               .end    = 0xc0000000 + SZ_512M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+       },
 };
 
 static struct pci_channel sh7780_pci_controller = {
        .pci_ops        = &sh4_pci_ops,
-       .mem_resource   = &sh7785_mem_resource,
-       .mem_offset     = 0x00000000,
-       .io_resource    = &sh7785_io_resource,
-       .io_offset      = 0x00000000,
-       .io_map_base    = SH7780_PCI_IO_BASE,
+       .resources      = sh7785_pci_resources,
+       .nr_resources   = ARRAY_SIZE(sh7785_pci_resources),
+       .io_offset      = 0,
+       .mem_offset     = 0,
+       .io_map_base    = 0xfe200000,
+       .serr_irq       = evt2irq(0xa00),
+       .err_irq        = evt2irq(0xaa0),
 };
 
-static struct sh4_pci_address_map sh7780_pci_map = {
-       .window0        = {
-#if defined(CONFIG_32BIT)
-               .base   = SH7780_32BIT_DDR_BASE_ADDR,
-               .size   = 0x40000000,
-#else
-               .base   = SH7780_CS0_BASE_ADDR,
-               .size   = 0x20000000,
-#endif
-       },
+struct pci_errors {
+       unsigned int    mask;
+       const char      *str;
+} pci_arbiter_errors[] = {
+       { SH4_PCIAINT_MBKN,     "master broken" },
+       { SH4_PCIAINT_TBTO,     "target bus time out" },
+       { SH4_PCIAINT_MBTO,     "master bus time out" },
+       { SH4_PCIAINT_TABT,     "target abort" },
+       { SH4_PCIAINT_MABT,     "master abort" },
+       { SH4_PCIAINT_RDPE,     "read data parity error" },
+       { SH4_PCIAINT_WDPE,     "write data parity error" },
+}, pci_interrupt_errors[] = {
+       { SH4_PCIINT_MLCK,      "master lock error" },
+       { SH4_PCIINT_TABT,      "target-target abort" },
+       { SH4_PCIINT_TRET,      "target retry time out" },
+       { SH4_PCIINT_MFDE,      "master function disable erorr" },
+       { SH4_PCIINT_PRTY,      "address parity error" },
+       { SH4_PCIINT_SERR,      "SERR" },
+       { SH4_PCIINT_TWDP,      "data parity error for target write" },
+       { SH4_PCIINT_TRDP,      "PERR detected for target read" },
+       { SH4_PCIINT_MTABT,     "target abort for master" },
+       { SH4_PCIINT_MMABT,     "master abort for master" },
+       { SH4_PCIINT_MWPD,      "master write data parity error" },
+       { SH4_PCIINT_MRPD,      "master read data parity error" },
 };
 
+static irqreturn_t sh7780_pci_err_irq(int irq, void *dev_id)
+{
+       struct pci_channel *hose = dev_id;
+       unsigned long addr;
+       unsigned int status;
+       unsigned int cmd;
+       int i;
+
+       addr = __raw_readl(hose->reg_base + SH4_PCIALR);
+
+       /*
+        * Handle status errors.
+        */
+       status = __raw_readw(hose->reg_base + PCI_STATUS);
+       if (status & (PCI_STATUS_PARITY |
+                     PCI_STATUS_DETECTED_PARITY |
+                     PCI_STATUS_SIG_TARGET_ABORT |
+                     PCI_STATUS_REC_TARGET_ABORT |
+                     PCI_STATUS_REC_MASTER_ABORT)) {
+               cmd = pcibios_handle_status_errors(addr, status, hose);
+               if (likely(cmd))
+                       __raw_writew(cmd, hose->reg_base + PCI_STATUS);
+       }
+
+       /*
+        * Handle arbiter errors.
+        */
+       status = __raw_readl(hose->reg_base + SH4_PCIAINT);
+       for (i = cmd = 0; i < ARRAY_SIZE(pci_arbiter_errors); i++) {
+               if (status & pci_arbiter_errors[i].mask) {
+                       printk(KERN_DEBUG "PCI: %s, addr=%08lx\n",
+                              pci_arbiter_errors[i].str, addr);
+                       cmd |= pci_arbiter_errors[i].mask;
+               }
+       }
+       __raw_writel(cmd, hose->reg_base + SH4_PCIAINT);
+
+       /*
+        * Handle the remaining PCI errors.
+        */
+       status = __raw_readl(hose->reg_base + SH4_PCIINT);
+       for (i = cmd = 0; i < ARRAY_SIZE(pci_interrupt_errors); i++) {
+               if (status & pci_interrupt_errors[i].mask) {
+                       printk(KERN_DEBUG "PCI: %s, addr=%08lx\n",
+                              pci_interrupt_errors[i].str, addr);
+                       cmd |= pci_interrupt_errors[i].mask;
+               }
+       }
+       __raw_writel(cmd, hose->reg_base + SH4_PCIINT);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t sh7780_pci_serr_irq(int irq, void *dev_id)
+{
+       struct pci_channel *hose = dev_id;
+
+       printk(KERN_DEBUG "PCI: system error received: ");
+       pcibios_report_status(PCI_STATUS_SIG_SYSTEM_ERROR, 1);
+       printk("\n");
+
+       /* Deassert SERR */
+       __raw_writel(SH4_PCIINTM_SDIM, hose->reg_base + SH4_PCIINTM);
+
+       /* Back off the IRQ for awhile */
+       disable_irq_nosync(irq);
+       hose->serr_timer.expires = jiffies + HZ;
+       add_timer(&hose->serr_timer);
+
+       return IRQ_HANDLED;
+}
+
+static int __init sh7780_pci_setup_irqs(struct pci_channel *hose)
+{
+       int ret;
+
+       /* Clear out PCI arbiter IRQs */
+       __raw_writel(0, hose->reg_base + SH4_PCIAINT);
+
+       /* Clear all error conditions */
+       __raw_writew(PCI_STATUS_DETECTED_PARITY  | \
+                    PCI_STATUS_SIG_SYSTEM_ERROR | \
+                    PCI_STATUS_REC_MASTER_ABORT | \
+                    PCI_STATUS_REC_TARGET_ABORT | \
+                    PCI_STATUS_SIG_TARGET_ABORT | \
+                    PCI_STATUS_PARITY, hose->reg_base + PCI_STATUS);
+
+       ret = request_irq(hose->serr_irq, sh7780_pci_serr_irq, IRQF_DISABLED,
+                         "PCI SERR interrupt", hose);
+       if (unlikely(ret)) {
+               printk(KERN_ERR "PCI: Failed hooking SERR IRQ\n");
+               return ret;
+       }
+
+       /*
+        * The PCI ERR IRQ needs to be IRQF_SHARED since all of the power
+        * down IRQ vectors are routed through the ERR IRQ vector. We
+        * only request_irq() once as there is only a single masking
+        * source for multiple events.
+        */
+       ret = request_irq(hose->err_irq, sh7780_pci_err_irq, IRQF_SHARED,
+                         "PCI ERR interrupt", hose);
+       if (unlikely(ret)) {
+               free_irq(hose->serr_irq, hose);
+               return ret;
+       }
+
+       /* Unmask all of the arbiter IRQs. */
+       __raw_writel(SH4_PCIAINT_MBKN | SH4_PCIAINT_TBTO | SH4_PCIAINT_MBTO | \
+                    SH4_PCIAINT_TABT | SH4_PCIAINT_MABT | SH4_PCIAINT_RDPE | \
+                    SH4_PCIAINT_WDPE, hose->reg_base + SH4_PCIAINTM);
+
+       /* Unmask all of the PCI IRQs */
+       __raw_writel(SH4_PCIINTM_TTADIM  | SH4_PCIINTM_TMTOIM  | \
+                    SH4_PCIINTM_MDEIM   | SH4_PCIINTM_APEDIM  | \
+                    SH4_PCIINTM_SDIM    | SH4_PCIINTM_DPEITWM | \
+                    SH4_PCIINTM_PEDITRM | SH4_PCIINTM_TADIMM  | \
+                    SH4_PCIINTM_MADIMM  | SH4_PCIINTM_MWPDIM  | \
+                    SH4_PCIINTM_MRDPEIM, hose->reg_base + SH4_PCIINTM);
+
+       return ret;
+}
+
+static inline void __init sh7780_pci_teardown_irqs(struct pci_channel *hose)
+{
+       free_irq(hose->err_irq, hose);
+       free_irq(hose->serr_irq, hose);
+}
+
+static void __init sh7780_pci66_init(struct pci_channel *hose)
+{
+       unsigned int tmp;
+
+       if (!pci_is_66mhz_capable(hose, 0, 0))
+               return;
+
+       /* Enable register access */
+       tmp = __raw_readl(hose->reg_base + SH4_PCICR);
+       tmp |= SH4_PCICR_PREFIX;
+       __raw_writel(tmp, hose->reg_base + SH4_PCICR);
+
+       /* Enable 66MHz operation */
+       tmp = __raw_readw(hose->reg_base + PCI_STATUS);
+       tmp |= PCI_STATUS_66MHZ;
+       __raw_writew(tmp, hose->reg_base + PCI_STATUS);
+
+       /* Done */
+       tmp = __raw_readl(hose->reg_base + SH4_PCICR);
+       tmp |= SH4_PCICR_PREFIX | SH4_PCICR_CFIN;
+       __raw_writel(tmp, hose->reg_base + SH4_PCICR);
+}
+
 static int __init sh7780_pci_init(void)
 {
        struct pci_channel *chan = &sh7780_pci_controller;
+       phys_addr_t memphys;
+       size_t memsize;
        unsigned int id;
-       const char *type = NULL;
-       int ret;
-       u32 word;
+       const char *type;
+       int ret, i;
 
        printk(KERN_NOTICE "PCI: Starting intialization.\n");
 
@@ -65,17 +253,28 @@ static int __init sh7780_pci_init(void)
        /* Enable CPU access to the PCIC registers. */
        __raw_writel(PCIECR_ENBL, PCIECR);
 
-       id = __raw_readw(chan->reg_base + SH7780_PCIVID);
-       if (id != SH7780_VENDOR_ID) {
+       /* Reset */
+       __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST,
+                    chan->reg_base + SH4_PCICR);
+
+       /*
+        * Wait for it to come back up. The spec says to allow for up to
+        * 1 second after toggling the reset pin, but in practice 100ms
+        * is more than enough.
+        */
+       mdelay(100);
+
+       id = __raw_readw(chan->reg_base + PCI_VENDOR_ID);
+       if (id != PCI_VENDOR_ID_RENESAS) {
                printk(KERN_ERR "PCI: Unknown vendor ID 0x%04x.\n", id);
                return -ENODEV;
        }
 
-       id = __raw_readw(chan->reg_base + SH7780_PCIDID);
-       type = (id == SH7763_DEVICE_ID) ? "SH7763" :
-              (id == SH7780_DEVICE_ID) ? "SH7780" :
-              (id == SH7781_DEVICE_ID) ? "SH7781" :
-              (id == SH7785_DEVICE_ID) ? "SH7785" :
+       id = __raw_readw(chan->reg_base + PCI_DEVICE_ID);
+       type = (id == PCI_DEVICE_ID_RENESAS_SH7763) ? "SH7763" :
+              (id == PCI_DEVICE_ID_RENESAS_SH7780) ? "SH7780" :
+              (id == PCI_DEVICE_ID_RENESAS_SH7781) ? "SH7781" :
+              (id == PCI_DEVICE_ID_RENESAS_SH7785) ? "SH7785" :
                                          NULL;
        if (unlikely(!type)) {
                printk(KERN_ERR "PCI: Found an unsupported Renesas host "
@@ -85,62 +284,119 @@ static int __init sh7780_pci_init(void)
 
        printk(KERN_NOTICE "PCI: Found a Renesas %s host "
               "controller, revision %d.\n", type,
-              __raw_readb(chan->reg_base + SH7780_PCIRID));
+              __raw_readb(chan->reg_base + PCI_REVISION_ID));
 
-       if ((ret = sh4_pci_check_direct(chan)) != 0)
+       /*
+        * Now throw it in to register initialization mode and
+        * start the real work.
+        */
+       __raw_writel(SH4_PCICR_PREFIX, chan->reg_base + SH4_PCICR);
+
+       memphys = __pa(memory_start);
+       memsize = roundup_pow_of_two(memory_end - memory_start);
+
+       /*
+        * If there's more than 512MB of memory, we need to roll over to
+        * LAR1/LSR1.
+        */
+       if (memsize > SZ_512M) {
+               __raw_writel(memphys + SZ_512M, chan->reg_base + SH4_PCILAR1);
+               __raw_writel((((memsize - SZ_512M) - SZ_1M) & 0x1ff00000) | 1,
+                            chan->reg_base + SH4_PCILSR1);
+               memsize = SZ_512M;
+       } else {
+               /*
+                * Otherwise just zero it out and disable it.
+                */
+               __raw_writel(0, chan->reg_base + SH4_PCILAR1);
+               __raw_writel(0, chan->reg_base + SH4_PCILSR1);
+       }
+
+       /*
+        * LAR0/LSR0 covers up to the first 512MB, which is enough to
+        * cover all of lowmem on most platforms.
+        */
+       __raw_writel(memphys, chan->reg_base + SH4_PCILAR0);
+       __raw_writel(((memsize - SZ_1M) & 0x1ff00000) | 1,
+                    chan->reg_base + SH4_PCILSR0);
+
+       /*
+        * Hook up the ERR and SERR IRQs.
+        */
+       ret = sh7780_pci_setup_irqs(chan);
+       if (unlikely(ret))
                return ret;
 
        /*
-        * Set the class and sub-class codes.
+        * Disable the cache snoop controller for non-coherent DMA.
         */
-       __raw_writeb(PCI_CLASS_BRIDGE_HOST >> 8,
-                    chan->reg_base + SH7780_PCIBCC);
-       __raw_writeb(PCI_CLASS_BRIDGE_HOST & 0xff,
-                    chan->reg_base + SH7780_PCISUB);
+       __raw_writel(0, chan->reg_base + SH7780_PCICSCR0);
+       __raw_writel(0, chan->reg_base + SH7780_PCICSAR0);
+       __raw_writel(0, chan->reg_base + SH7780_PCICSCR1);
+       __raw_writel(0, chan->reg_base + SH7780_PCICSAR1);
 
        /*
-        * Set IO and Mem windows to local address
-        * Make PCI and local address the same for easy 1 to 1 mapping
+        * Setup the memory BARs
         */
-       pci_write_reg(chan, sh7780_pci_map.window0.size - 0xfffff, SH4_PCILSR0);
-       /* Set the values on window 0 PCI config registers */
-       pci_write_reg(chan, sh7780_pci_map.window0.base, SH4_PCILAR0);
-       pci_write_reg(chan, sh7780_pci_map.window0.base, SH7780_PCIMBAR0);
+       for (i = 1; i < chan->nr_resources; i++) {
+               struct resource *res = chan->resources + i;
+               resource_size_t size;
 
-       pci_write_reg(chan, 0x0000380f, SH4_PCIAINTM);
+               if (unlikely(res->flags & IORESOURCE_IO))
+                       continue;
 
-       /* Set up standard PCI config registers */
-       __raw_writew(0xFB00, chan->reg_base + SH7780_PCISTATUS);
-       __raw_writew(0x0047, chan->reg_base + SH7780_PCICMD);
-       __raw_writew(0x1912, chan->reg_base + SH7780_PCISVID);
-       __raw_writew(0x0001, chan->reg_base + SH7780_PCISID);
+               /*
+                * Make sure we're in the right physical addressing mode
+                * for dealing with the resource.
+                */
+               if ((res->flags & IORESOURCE_MEM_32BIT) && __in_29bit_mode()) {
+                       chan->nr_resources--;
+                       continue;
+               }
 
-       __raw_writeb(0x00, chan->reg_base + SH7780_PCIPIF);
+               size = resource_size(res);
+
+               /*
+                * The MBMR mask is calculated in units of 256kB, which
+                * keeps things pretty simple.
+                */
+               __raw_writel(((roundup_pow_of_two(size) / SZ_256K) - 1) << 18,
+                            chan->reg_base + SH7780_PCIMBMR(i - 1));
+               __raw_writel(res->start, chan->reg_base + SH7780_PCIMBR(i - 1));
+       }
 
-       /* Apply any last-minute PCIC fixups */
-       pci_fixup_pcic(chan);
+       /*
+        * And I/O.
+        */
+       __raw_writel(0, chan->reg_base + PCI_BASE_ADDRESS_0);
+       __raw_writel(0, chan->reg_base + SH7780_PCIIOBR);
+       __raw_writel(0, chan->reg_base + SH7780_PCIIOBMR);
 
-       pci_write_reg(chan, 0xfd000000, SH7780_PCIMBR0);
-       pci_write_reg(chan, 0x00fc0000, SH7780_PCIMBMR0);
+       __raw_writew(PCI_COMMAND_SERR   | PCI_COMMAND_WAIT   | \
+                    PCI_COMMAND_PARITY | PCI_COMMAND_MASTER | \
+                    PCI_COMMAND_MEMORY, chan->reg_base + PCI_COMMAND);
 
-#ifdef CONFIG_32BIT
-       pci_write_reg(chan, 0xc0000000, SH7780_PCIMBR2);
-       pci_write_reg(chan, 0x20000000 - SH7780_PCI_IO_SIZE, SH7780_PCIMBMR2);
-#endif
+       /*
+        * Initialization mode complete, release the control register and
+        * enable round robin mode to stop device overruns/starvation.
+        */
+       __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO,
+                    chan->reg_base + SH4_PCICR);
 
-       /* Set IOBR for windows containing area specified in pci.h */
-       pci_write_reg(chan, chan->io_resource->start & ~(SH7780_PCI_IO_SIZE-1),
-                     SH7780_PCIIOBR);
-       pci_write_reg(chan, ((SH7780_PCI_IO_SIZE-1) & (7<<18)),
-                     SH7780_PCIIOBMR);
+       ret = register_pci_controller(chan);
+       if (unlikely(ret))
+               goto err;
 
-       /* SH7780 init done, set central function init complete */
-       /* use round robin mode to stop a device starving/overruning */
-       word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO;
-       pci_write_reg(chan, word, SH4_PCICR);
+       sh7780_pci66_init(chan);
 
-       register_pci_controller(chan);
+       printk(KERN_NOTICE "PCI: Running at %dMHz.\n",
+              (__raw_readw(chan->reg_base + PCI_STATUS) & PCI_STATUS_66MHZ) ?
+              66 : 33);
 
        return 0;
+
+err:
+       sh7780_pci_teardown_irqs(chan);
+       return ret;
 }
 arch_initcall(sh7780_pci_init);
index 4a52478c97cf61e331748e8f3a9dd264ce09efe3..205dcbefe2756270f239c8ec7ea499aa0051ac92 100644 (file)
 #ifndef _PCI_SH7780_H_
 #define _PCI_SH7780_H_
 
-/* Platform Specific Values */
-#define SH7780_VENDOR_ID       0x1912
-#define SH7781_DEVICE_ID       0x0001
-#define SH7780_DEVICE_ID       0x0002
-#define SH7763_DEVICE_ID       0x0004
-#define SH7785_DEVICE_ID       0x0007
+#define PCI_VENDOR_ID_RENESAS          0x1912
+#define PCI_DEVICE_ID_RENESAS_SH7781   0x0001
+#define PCI_DEVICE_ID_RENESAS_SH7780   0x0002
+#define PCI_DEVICE_ID_RENESAS_SH7763   0x0004
+#define PCI_DEVICE_ID_RENESAS_SH7785   0x0007
 
 /* SH7780 Control Registers */
 #define        PCIECR                  0xFE000008
 #define SH7780_PCI_CONFIG_BASE 0xFD000000      /* Config space base addr */
 #define SH7780_PCI_CONFIG_SIZE 0x01000000      /* Config space size */
 
-#define SH7780_PCI_MEMORY_BASE 0xFD000000      /* Memory space base addr */
-#define SH7780_PCI_MEM_SIZE    0x01000000      /* Size of Memory window */
-
-#define SH7780_PCI_IO_BASE     0xFE200000      /* IO space base address */
-#define SH7780_PCI_IO_SIZE     0x00400000      /* Size of IO window */
-
 #define SH7780_PCIREG_BASE     0xFE040000      /* PCI regs base address */
 
 /* SH7780 PCI Config Registers */
-#define SH7780_PCIVID          0x000           /* Vendor ID */
-#define SH7780_PCIDID          0x002           /* Device ID */
-#define SH7780_PCICMD          0x004           /* Command */
-#define SH7780_PCISTATUS       0x006           /* Status */
-#define SH7780_PCIRID          0x008           /* Revision ID */
-#define SH7780_PCIPIF          0x009           /* Program Interface */
-#define SH7780_PCISUB          0x00a           /* Sub class code */
-#define SH7780_PCIBCC          0x00b           /* Base class code */
-#define SH7780_PCICLS          0x00c           /* Cache line size */
-#define SH7780_PCILTM          0x00d           /* latency timer */
-#define SH7780_PCIHDR          0x00e           /* Header type */
-#define SH7780_PCIBIST         0x00f           /* BIST */
-#define SH7780_PCIIBAR         0x010           /* IO Base address */
-#define SH7780_PCIMBAR0                0x014           /* Memory base address0 */
-#define SH7780_PCIMBAR1                0x018           /* Memory base address1 */
-#define SH7780_PCISVID         0x02c           /* Sub system vendor ID */
-#define SH7780_PCISID          0x02e           /* Sub system ID */
-#define SH7780_PCICP           0x034
-#define SH7780_PCIINTLINE      0x03c           /* Interrupt line */
-#define SH7780_PCIINTPIN       0x03d           /* Interrupt pin */
-#define SH7780_PCIMINGNT       0x03e           /* Minumum grand */
-#define SH7780_PCIMAXLAT       0x03f           /* Maxmum latency */
-#define SH7780_PCICID          0x040
-#define SH7780_PCINIP          0x041
-#define SH7780_PCIPMC          0x042
-#define SH7780_PCIPMCSR                0x044
-#define SH7780_PCIPMCSR_BSE    0x046
-#define SH7780_PCICDD          0x047
-
 #define SH7780_PCIIR           0x114           /* PCI Interrupt Register */
 #define SH7780_PCIIMR          0x118           /* PCI Interrupt Mask Register */
 #define SH7780_PCIAIR          0x11C           /* Error Address Register */
 #define SH7780_PCIPINT         0x1CC           /* Power Mgmnt Int. Register */
 #define SH7780_PCIPINTM                0x1D0           /* Power Mgmnt Mask Register */
 
-#define SH7780_PCIMBR0         0x1E0
-#define SH7780_PCIMBMR0                0x1E4
-#define SH7780_PCIMBR2         0x1F0
-#define SH7780_PCIMBMR2                0x1F4
+#define SH7780_PCIMBR(x)       (0x1E0 + ((x) * 8))
+#define SH7780_PCIMBMR(x)      (0x1E4 + ((x) * 8))
 #define SH7780_PCIIOBR         0x1F8
 #define SH7780_PCIIOBMR                0x1FC
 #define SH7780_PCICSCR0                0x210           /* Cache Snoop1 Cnt. Register */
 #define SH7780_PCICSAR0                0x218   /* Cache Snoop1 Addr. Register */
 #define SH7780_PCICSAR1                0x21C   /* Cache Snoop2 Addr. Register */
 
-/* General Memory Config Addresses */
-#define SH7780_CS0_BASE_ADDR   0x0
-#define SH7780_MEM_REGION_SIZE 0x04000000
-#define SH7780_CS1_BASE_ADDR   (SH7780_CS0_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-#define SH7780_CS2_BASE_ADDR   (SH7780_CS1_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-#define SH7780_CS3_BASE_ADDR   (SH7780_CS2_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-#define SH7780_CS4_BASE_ADDR   (SH7780_CS3_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-#define SH7780_CS5_BASE_ADDR   (SH7780_CS4_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-#define SH7780_CS6_BASE_ADDR   (SH7780_CS5_BASE_ADDR + SH7780_MEM_REGION_SIZE)
-
-#define SH7780_32BIT_DDR_BASE_ADDR     0x40000000
-
 #endif /* _PCI_SH7780_H_ */
index c481df6390223c7d1a50469ee4c2b1f03c15f780..953af139e2300947ee9f76f1248c1f1267ac262c 100644 (file)
@@ -33,15 +33,22 @@ static int pci_initialized;
 static void __devinit pcibios_scanbus(struct pci_channel *hose)
 {
        static int next_busno;
+       static int need_domain_info;
        struct pci_bus *bus;
 
        bus = pci_scan_bus(next_busno, hose->pci_ops, hose);
+       hose->bus = bus;
+
+       need_domain_info = need_domain_info || hose->index;
+       hose->need_domain_info = need_domain_info;
        if (bus) {
                next_busno = bus->subordinate + 1;
                /* Don't allow 8-bit bus number overflow inside the hose -
                   reserve some space for bridges. */
-               if (next_busno > 224)
+               if (next_busno > 224) {
                        next_busno = 0;
+                       need_domain_info = 1;
+               }
 
                pci_bus_size_bridges(bus);
                pci_bus_assign_resources(bus);
@@ -51,10 +58,21 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
 
 static DEFINE_MUTEX(pci_scan_mutex);
 
-void __devinit register_pci_controller(struct pci_channel *hose)
+int __devinit register_pci_controller(struct pci_channel *hose)
 {
-       request_resource(&iomem_resource, hose->mem_resource);
-       request_resource(&ioport_resource, hose->io_resource);
+       int i;
+
+       for (i = 0; i < hose->nr_resources; i++) {
+               struct resource *res = hose->resources + i;
+
+               if (res->flags & IORESOURCE_IO) {
+                       if (request_resource(&ioport_resource, res) < 0)
+                               goto out;
+               } else {
+                       if (request_resource(&iomem_resource, res) < 0)
+                               goto out;
+               }
+       }
 
        *hose_tail = hose;
        hose_tail = &hose->next;
@@ -67,6 +85,11 @@ void __devinit register_pci_controller(struct pci_channel *hose)
                       "registering PCI controller with io_map_base unset\n");
        }
 
+       /*
+        * Setup the ERR/PERR and SERR timers, if available.
+        */
+       pcibios_enable_timers(hose);
+
        /*
         * Scan the bus if it is register after the PCI subsystem
         * initialization.
@@ -76,6 +99,15 @@ void __devinit register_pci_controller(struct pci_channel *hose)
                pcibios_scanbus(hose);
                mutex_unlock(&pci_scan_mutex);
        }
+
+       return 0;
+
+out:
+       for (--i; i >= 0; i--)
+               release_resource(&hose->resources[i]);
+
+       printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n");
+       return -1;
 }
 
 static int __init pcibios_init(void)
@@ -127,11 +159,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
 {
        struct pci_dev *dev = bus->self;
        struct list_head *ln;
-       struct pci_channel *chan = bus->sysdata;
+       struct pci_channel *hose = bus->sysdata;
 
        if (!dev) {
-               bus->resource[0] = chan->io_resource;
-               bus->resource[1] = chan->mem_resource;
+               int i;
+
+               for (i = 0; i < hose->nr_resources; i++)
+                       bus->resource[i] = hose->resources + i;
        }
 
        for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
@@ -148,34 +182,29 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
  * addresses to be allocated in the 0x000-0x0ff region
  * modulo 0x400.
  */
-void pcibios_align_resource(void *data, struct resource *res,
-                           resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
-       struct pci_channel *chan = dev->sysdata;
+       struct pci_channel *hose = dev->sysdata;
        resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO) {
-               if (start < PCIBIOS_MIN_IO + chan->io_resource->start)
-                       start = PCIBIOS_MIN_IO + chan->io_resource->start;
+               if (start < PCIBIOS_MIN_IO + hose->resources[0].start)
+                       start = PCIBIOS_MIN_IO + hose->resources[0].start;
 
                /*
                  * Put everything into 0x00-0xff region modulo 0x400.
                 */
-               if (start & 0x300) {
+               if (start & 0x300)
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
-       } else if (res->flags & IORESOURCE_MEM) {
-               if (start < PCIBIOS_MIN_MEM + chan->mem_resource->start)
-                       start = PCIBIOS_MIN_MEM + chan->mem_resource->start;
        }
 
-       res->start = start;
+       return start;
 }
 
 void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
-                        struct resource *res)
+                            struct resource *res)
 {
        struct pci_channel *hose = dev->sysdata;
        unsigned long offset = 0;
@@ -189,9 +218,8 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
        region->end = res->end - offset;
 }
 
-void __devinit
-pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
-                       struct pci_bus_region *region)
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+                            struct pci_bus_region *region)
 {
        struct pci_channel *hose = dev->sysdata;
        unsigned long offset = 0;
@@ -274,6 +302,86 @@ char * __devinit pcibios_setup(char *str)
        return str;
 }
 
+static void __init
+pcibios_bus_report_status_early(struct pci_channel *hose,
+                               int top_bus, int current_bus,
+                               unsigned int status_mask, int warn)
+{
+       unsigned int pci_devfn;
+       u16 status;
+       int ret;
+
+       for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
+               if (PCI_FUNC(pci_devfn))
+                       continue;
+               ret = early_read_config_word(hose, top_bus, current_bus,
+                                            pci_devfn, PCI_STATUS, &status);
+               if (ret != PCIBIOS_SUCCESSFUL)
+                       continue;
+               if (status == 0xffff)
+                       continue;
+
+               early_write_config_word(hose, top_bus, current_bus,
+                                       pci_devfn, PCI_STATUS,
+                                       status & status_mask);
+               if (warn)
+                       printk("(%02x:%02x: %04X) ", current_bus,
+                              pci_devfn, status);
+       }
+}
+
+/*
+ * We can't use pci_find_device() here since we are
+ * called from interrupt context.
+ */
+static void __init_refok
+pcibios_bus_report_status(struct pci_bus *bus, unsigned int status_mask,
+                         int warn)
+{
+       struct pci_dev *dev;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               u16 status;
+
+               /*
+                * ignore host bridge - we handle
+                * that separately
+                */
+               if (dev->bus->number == 0 && dev->devfn == 0)
+                       continue;
+
+               pci_read_config_word(dev, PCI_STATUS, &status);
+               if (status == 0xffff)
+                       continue;
+
+               if ((status & status_mask) == 0)
+                       continue;
+
+               /* clear the status errors */
+               pci_write_config_word(dev, PCI_STATUS, status & status_mask);
+
+               if (warn)
+                       printk("(%s: %04X) ", pci_name(dev), status);
+       }
+
+       list_for_each_entry(dev, &bus->devices, bus_list)
+               if (dev->subordinate)
+                       pcibios_bus_report_status(dev->subordinate, status_mask, warn);
+}
+
+void __init_refok pcibios_report_status(unsigned int status_mask, int warn)
+{
+       struct pci_channel *hose;
+
+       for (hose = hose_head; hose; hose = hose->next) {
+               if (unlikely(!hose->bus))
+                       pcibios_bus_report_status_early(hose, hose_head->index,
+                                       hose->index, status_mask, warn);
+               else
+                       pcibios_bus_report_status(hose->bus, status_mask, warn);
+       }
+}
+
 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
@@ -302,9 +410,15 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
 {
        struct pci_channel *chan = dev->sysdata;
 
-       if (!chan->io_map_base)
+       if (unlikely(!chan->io_map_base)) {
                chan->io_map_base = generic_io_base;
 
+               if (pci_domains_supported)
+                       panic("To avoid data corruption io_map_base MUST be "
+                             "set with multiple PCI domains.");
+       }
+
+
        return (void __iomem *)(chan->io_map_base + port);
 }
 
@@ -321,20 +435,9 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 
        if (flags & IORESOURCE_IO)
                return ioport_map_pci(dev, start, len);
-
-       /*
-        * Presently the IORESOURCE_MEM case is a bit special, most
-        * SH7751 style PCI controllers have PCI memory at a fixed
-        * location in the address space where no remapping is desired.
-        * With the IORESOURCE_MEM case more care has to be taken
-        * to inhibit page table mapping for legacy cores, but this is
-        * punted off to __ioremap().
-        *                                      -- PFM.
-        */
        if (flags & IORESOURCE_MEM) {
                if (flags & IORESOURCE_CACHEABLE)
                        return ioremap(start, len);
-
                return ioremap_nocache(start, len);
        }
 
index ac37ee879babb8bc230a0e432af326b832ab6ee6..ae91a2dd9183c829ee2177af54c6df627f9c75cb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Low-Level PCI Express Support for the SH7786
  *
- *  Copyright (C) 2009  Paul Mundt
+ *  Copyright (C) 2009 - 2010  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -30,60 +30,84 @@ static struct sh7786_pcie_hwops {
        int (*port_init_hw)(struct sh7786_pcie_port *port);
 } *sh7786_pcie_hwops;
 
-static struct resource sh7786_pci_32bit_mem_resources[] = {
+static struct resource sh7786_pci0_resources[] = {
        {
-               .name   = "pci0_mem",
-               .start  = SH4A_PCIMEM_BASEA,
-               .end    = SH4A_PCIMEM_BASEA + SZ_64M - 1,
-               .flags  = IORESOURCE_MEM,
+               .name   = "PCIe0 IO",
+               .start  = 0xfd000000,
+               .end    = 0xfd000000 + SZ_8M - 1,
+               .flags  = IORESOURCE_IO,
        }, {
-               .name   = "pci1_mem",
-               .start  = SH4A_PCIMEM_BASEA1,
-               .end    = SH4A_PCIMEM_BASEA1 + SZ_64M - 1,
-               .flags  = IORESOURCE_MEM,
+               .name   = "PCIe0 MEM 0",
+               .start  = 0xc0000000,
+               .end    = 0xc0000000 + SZ_512M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
        }, {
-               .name   = "pci2_mem",
-               .start  = SH4A_PCIMEM_BASEA2,
-               .end    = SH4A_PCIMEM_BASEA2 + SZ_64M - 1,
+               .name   = "PCIe0 MEM 1",
+               .start  = 0x10000000,
+               .end    = 0x10000000 + SZ_64M - 1,
                .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "PCIe0 MEM 2",
+               .start  = 0xfe100000,
+               .end    = 0xfe100000 + SZ_1M - 1,
        },
 };
 
-static struct resource sh7786_pci_29bit_mem_resource = {
-       .start  = SH4A_PCIMEM_BASE,
-       .end    = SH4A_PCIMEM_BASE + SZ_64M - 1,
-       .flags  = IORESOURCE_MEM,
+static struct resource sh7786_pci1_resources[] = {
+       {
+               .name   = "PCIe1 IO",
+               .start  = 0xfd800000,
+               .end    = 0xfd800000 + SZ_8M - 1,
+               .flags  = IORESOURCE_IO,
+       }, {
+               .name   = "PCIe1 MEM 0",
+               .start  = 0xa0000000,
+               .end    = 0xa0000000 + SZ_512M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+       }, {
+               .name   = "PCIe1 MEM 1",
+               .start  = 0x30000000,
+               .end    = 0x30000000 + SZ_256M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+       }, {
+               .name   = "PCIe1 MEM 2",
+               .start  = 0xfe300000,
+               .end    = 0xfe300000 + SZ_1M - 1,
+       },
 };
 
-static struct resource sh7786_pci_io_resources[] = {
+static struct resource sh7786_pci2_resources[] = {
        {
-               .name   = "pci0_io",
-               .start  = SH4A_PCIIO_BASE,
-               .end    = SH4A_PCIIO_BASE + SZ_8M - 1,
-               .flags  = IORESOURCE_IO,
+               .name   = "PCIe2 IO",
+               .start  = 0xfc800000,
+               .end    = 0xfc800000 + SZ_4M - 1,
        }, {
-               .name   = "pci1_io",
-               .start  = SH4A_PCIIO_BASE1,
-               .end    = SH4A_PCIIO_BASE1 + SZ_8M - 1,
-               .flags  = IORESOURCE_IO,
+               .name   = "PCIe2 MEM 0",
+               .start  = 0x80000000,
+               .end    = 0x80000000 + SZ_512M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
        }, {
-               .name   = "pci2_io",
-               .start  = SH4A_PCIIO_BASE2,
-               .end    = SH4A_PCIIO_BASE2 + SZ_4M - 1,
-               .flags  = IORESOURCE_IO,
+               .name   = "PCIe2 MEM 1",
+               .start  = 0x20000000,
+               .end    = 0x20000000 + SZ_256M - 1,
+               .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+       }, {
+               .name   = "PCIe2 MEM 2",
+               .start  = 0xfcd00000,
+               .end    = 0xfcd00000 + SZ_1M - 1,
        },
 };
 
 extern struct pci_ops sh7786_pci_ops;
 
-#define DEFINE_CONTROLLER(start, idx)                          \
-{                                                              \
-       .pci_ops        = &sh7786_pci_ops,                      \
-       .reg_base       = start,                                \
-       /* mem_resource filled in at probe time */              \
-       .mem_offset     = 0,                                    \
-       .io_resource    = &sh7786_pci_io_resources[idx],        \
-       .io_offset      = 0,                                    \
+#define DEFINE_CONTROLLER(start, idx)                                  \
+{                                                                      \
+       .pci_ops        = &sh7786_pci_ops,                              \
+       .resources      = sh7786_pci##idx##_resources,                  \
+       .nr_resources   = ARRAY_SIZE(sh7786_pci##idx##_resources),      \
+       .reg_base       = start,                                        \
+       .mem_offset     = 0,                                            \
+       .io_offset      = 0,                                            \
 }
 
 static struct pci_channel sh7786_pci_channels[] = {
@@ -180,7 +204,9 @@ static int pcie_init(struct sh7786_pcie_port *port)
 {
        struct pci_channel *chan = port->hose;
        unsigned int data;
-       int ret;
+       phys_addr_t memphys;
+       size_t memsize;
+       int ret, i;
 
        /* Begin initialization */
        pci_write_reg(chan, 0, SH4A_PCIETCTLR);
@@ -203,15 +229,24 @@ static int pcie_init(struct sh7786_pcie_port *port)
        data |= PCI_CAP_ID_EXP;
        pci_write_reg(chan, data, SH4A_PCIEEXPCAP0);
 
-       /* Enable x4 link width and extended sync. */
+       /* Enable data link layer active state reporting */
+       pci_write_reg(chan, PCI_EXP_LNKCAP_DLLLARC, SH4A_PCIEEXPCAP3);
+
+       /* Enable extended sync and ASPM L0s support */
        data = pci_read_reg(chan, SH4A_PCIEEXPCAP4);
-       data &= ~(PCI_EXP_LNKSTA_NLW << 16);
-       data |= (1 << 22) | PCI_EXP_LNKCTL_ES;
+       data &= ~PCI_EXP_LNKCTL_ASPMC;
+       data |= PCI_EXP_LNKCTL_ES | 1;
        pci_write_reg(chan, data, SH4A_PCIEEXPCAP4);
 
+       /* Write out the physical slot number */
+       data = pci_read_reg(chan, SH4A_PCIEEXPCAP5);
+       data &= ~PCI_EXP_SLTCAP_PSN;
+       data |= (port->index + 1) << 19;
+       pci_write_reg(chan, data, SH4A_PCIEEXPCAP5);
+
        /* Set the completion timer timeout to the maximum 32ms. */
        data = pci_read_reg(chan, SH4A_PCIETLCTLR);
-       data &= ~0xffff;
+       data &= ~0x3f00;
        data |= 0x32 << 8;
        pci_write_reg(chan, data, SH4A_PCIETLCTLR);
 
@@ -224,6 +259,33 @@ static int pcie_init(struct sh7786_pcie_port *port)
        data |= (0xff << 16);
        pci_write_reg(chan, data, SH4A_PCIEMACCTLR);
 
+       memphys = __pa(memory_start);
+       memsize = roundup_pow_of_two(memory_end - memory_start);
+
+       /*
+        * If there's more than 512MB of memory, we need to roll over to
+        * LAR1/LAMR1.
+        */
+       if (memsize > SZ_512M) {
+               __raw_writel(memphys + SZ_512M, chan->reg_base + SH4A_PCIELAR1);
+               __raw_writel(((memsize - SZ_512M) - SZ_256) | 1,
+                            chan->reg_base + SH4A_PCIELAMR1);
+               memsize = SZ_512M;
+       } else {
+               /*
+                * Otherwise just zero it out and disable it.
+                */
+               __raw_writel(0, chan->reg_base + SH4A_PCIELAR1);
+               __raw_writel(0, chan->reg_base + SH4A_PCIELAMR1);
+       }
+
+       /*
+        * LAR0/LAMR0 covers up to the first 512MB, which is enough to
+        * cover all of lowmem on most platforms.
+        */
+       __raw_writel(memphys, chan->reg_base + SH4A_PCIELAR0);
+       __raw_writel((memsize - SZ_256) | 1, chan->reg_base + SH4A_PCIELAMR0);
+
        /* Finish initialization */
        data = pci_read_reg(chan, SH4A_PCIETCTLR);
        data |= 0x1;
@@ -243,10 +305,14 @@ static int pcie_init(struct sh7786_pcie_port *port)
        if (unlikely(ret != 0))
                return -ENODEV;
 
-       pci_write_reg(chan, 0x00100007, SH4A_PCIEPCICONF1);
+       data = pci_read_reg(chan, SH4A_PCIEPCICONF1);
+       data &= ~(PCI_STATUS_DEVSEL_MASK << 16);
+       data |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
+               (PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_FAST) << 16;
+       pci_write_reg(chan, data, SH4A_PCIEPCICONF1);
+
        pci_write_reg(chan, 0x80888000, SH4A_PCIETXVC0DCTLR);
        pci_write_reg(chan, 0x00222000, SH4A_PCIERXVC0DCTLR);
-       pci_write_reg(chan, 0x000050A0, SH4A_PCIEEXPCAP2);
 
        wmb();
 
@@ -254,15 +320,32 @@ static int pcie_init(struct sh7786_pcie_port *port)
        printk(KERN_NOTICE "PCI: PCIe#%d link width %d\n",
               port->index, (data >> 20) & 0x3f);
 
-       pci_write_reg(chan, 0x007c0000, SH4A_PCIEPAMR0);
-       pci_write_reg(chan, 0x00000000, SH4A_PCIEPARH0);
-       pci_write_reg(chan, 0x00000000, SH4A_PCIEPARL0);
-       pci_write_reg(chan, 0x80000100, SH4A_PCIEPTCTLR0);
 
-       pci_write_reg(chan, 0x03fc0000, SH4A_PCIEPAMR2);
-       pci_write_reg(chan, 0x00000000, SH4A_PCIEPARH2);
-       pci_write_reg(chan, 0x00000000, SH4A_PCIEPARL2);
-       pci_write_reg(chan, 0x80000000, SH4A_PCIEPTCTLR2);
+       for (i = 0; i < chan->nr_resources; i++) {
+               struct resource *res = chan->resources + i;
+               resource_size_t size;
+               u32 enable_mask;
+
+               pci_write_reg(chan, 0x00000000, SH4A_PCIEPTCTLR(i));
+
+               size = resource_size(res);
+
+               /*
+                * The PAMR mask is calculated in units of 256kB, which
+                * keeps things pretty simple.
+                */
+               __raw_writel(((roundup_pow_of_two(size) / SZ_256K) - 1) << 18,
+                            chan->reg_base + SH4A_PCIEPAMR(i));
+
+               pci_write_reg(chan, 0x00000000, SH4A_PCIEPARH(i));
+               pci_write_reg(chan, 0x00000000, SH4A_PCIEPARL(i));
+
+               enable_mask = MASK_PARE;
+               if (res->flags & IORESOURCE_IO)
+                       enable_mask |= MASK_SPC;
+
+               pci_write_reg(chan, enable_mask, SH4A_PCIEPTCTLR(i));
+       }
 
        return 0;
 }
@@ -296,9 +379,7 @@ static int __devinit sh7786_pcie_init_hw(struct sh7786_pcie_port *port)
        if (unlikely(ret < 0))
                return ret;
 
-       register_pci_controller(port->hose);
-
-       return 0;
+       return register_pci_controller(port->hose);
 }
 
 static struct sh7786_pcie_hwops sh7786_65nm_pcie_hwops __initdata = {
@@ -332,17 +413,7 @@ static int __init sh7786_pcie_init(void)
 
                port->index             = i;
                port->hose              = sh7786_pci_channels + i;
-               port->hose->io_map_base = port->hose->io_resource->start;
-
-               /*
-                * Check if we are booting in 29 or 32-bit mode
-                *
-                * 32-bit mode provides each controller with its own
-                * memory window, while 29-bit mode uses a shared one.
-                */
-               port->hose->mem_resource = test_mode_pin(MODE_PIN10) ?
-                       &sh7786_pci_32bit_mem_resources[i] :
-                       &sh7786_pci_29bit_mem_resource;
+               port->hose->io_map_base = port->hose->resources[0].start;
 
                ret |= sh7786_pcie_hwops->port_init_hw(port);
        }
index c655290a7750e0d307c058473c8acda91cf6b681..90a6992576b0bb479828bd0d88acd711d9762128 100644 (file)
  * for other(Max Payload Size=4096B,PCIIO_SIZE=8M)
  */
 
-/* PCI0-0: PCI I/O space */
-#define SH4A_PCIIO_BASE                0xFD000000      /* PCI I/O for controller 0 */
-#define SH4A_PCIIO_BASE1       0xFD800000      /* PCI I/O for controller 1 (Rev1.14)*/
-#define SH4A_PCIIO_BASE2       0xFC800000      /* PCI I/O for controller 2 (Rev1.171)*/
-
-#define SH4A_PCIIO_SIZE64      0x00010000      /* PLX allows only 64K */
-#define SH4A_PCIIO_SIZE                0x00800000      /* 8M */
-#define SH4A_PCIIO_SIZE2       0x00400000      /* 4M (Rev1.171)*/
-
-/* PCI0-1: PCI memory space 29-bit address */
-#define SH4A_PCIMEM_BASE       0x10000000
-#define SH4A_PCIMEM_SIZE       0x04000000      /* 64M */
-
-/* PCI0-2: PCI memory space 32-bit address */
-#define SH4A_PCIMEM_BASEA      0xC0000000      /*  for controller 0 */
-#define SH4A_PCIMEM_BASEA1     0xA0000000      /*  for controller 1 (Rev1.14)*/
-#define SH4A_PCIMEM_BASEA2     0x80000000      /*  for controller 2 (Rev1.171)*/
-#define SH4A_PCIMEM_SIZEA      0x20000000      /* 512M */
-
 /* PCI0: PCI memory target transfer 32-bit address translation value(Rev1.11T)*/
 #define SH4A_PCIBMSTR_TRANSLATION      0x20000000
 
-#define SH4A_PCI_DEVICE_ID             0x0002
-#define SH4A_PCI_VENDOR_ID             0x1912
-
-// PCI compatible 000-03f
-#define PCI_CMD                0x004
-#define PCI_RID                0x008
-#define PCI_IBAR       0x010
-#define PCI_MBAR0      0x014
-#define PCI_MBAR1      0x018
-
-/* PCI power management/MSI/capablity 040-0ff */
-/* PCIE extended 100-fff */
-
-/* SH7786 device identification */     // Rev1.171
-#define SH4A_PVR               (0xFF000030)
-#define SH4A_PVR_SHX3          (0x10400000)
-#define SH4A_PRR               (0xFF000044)
-#define SH4A_PRR_SH7786                (0x00000400)    // Rev1.171
-
 /*     SPVCR0          */
 #define        SH4A_PCIEVCR0           (0x000000)      /* R - 0x0000 0000 32 */
 #define                BITS_TOP_MB     (24)
 #define        SH4A_PCIECSAR5          (0x0202B4)      /* R/W R/W 0x0000 0000 32 */
 #define        SH4A_PCIESTCTLR5        (0x0202B8)      /* R/W R/W 0x0000 0000 32 */
 
-/*     PCIEPARL0       */
-#define        SH4A_PCIEPARL0          (0x020400)      /* R/W R/W 0x0000 0000 32 */
+/*     PCIEPARL        */
+#define        SH4A_PCIEPARL(x)        (0x020400 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
 #define                BITS_PAL        (18)
 #define                MASK_PAL        (0x3fff<<BITS_PAL)
 
-/*     PCIEPARH0       */
-#define        SH4A_PCIEPARH0          (0x020404)      /* R/W R/W 0x0000 0000 32 */
+/*     PCIEPARH        */
+#define        SH4A_PCIEPARH(x)        (0x020404 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
 #define                BITS_PAH        (0)
 #define                MASK_PAH        (0xffffffff<<BITS_PAH)
 
-/*     PCIEPAMR0        */
-#define        SH4A_PCIEPAMR0          (0x020408)      /* R/W R/W 0x0000 0000 32 */
+/*     PCIEPAMR         */
+#define        SH4A_PCIEPAMR(x)        (0x020408 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
 #define                BITS_PAM        (18)
 #define                MASK_PAM        (0x3fff<<BITS_PAM)
 
-/*     PCIEPTCTLR0     */
-#define        SH4A_PCIEPTCTLR0        (0x02040C)      /* R/W R/W 0x0000 0000 32 */
+/*     PCIEPTCTLR      */
+#define SH4A_PCIEPTCTLR(x)     (0x02040C + ((x) * 0x20))
 #define                BITS_PARE       (31)
 #define                MASK_PARE       (0x1<<BITS_PARE)
 #define                BITS_TC         (20)
 #define                BITS_SPC        (8)
 #define                MASK_SPC        (0x1<<BITS_SPC)
 
-#define        SH4A_PCIEPARL1          (0x020420)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARH1          (0x020424)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPAMR1          (0x020428)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPTCTLR1        (0x02042C)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARL2          (0x020440)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARH2          (0x020444)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPAMR2          (0x020448)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPTCTLR2        (0x02044C)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARL3          (0x020460)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARH3          (0x020464)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPAMR3          (0x020468)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPTCTLR3        (0x02046C)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARL4          (0x020480)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARH4          (0x020484)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPAMR4          (0x020488)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPTCTLR4        (0x02048C)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARL5          (0x0204A0)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPARH5          (0x0204A4)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPAMR5          (0x0204A8)      /* R/W R/W 0x0000 0000 32 */
-#define        SH4A_PCIEPTCTLR5        (0x0204AC)      /* R/W R/W 0x0000 0000 32 */
 #define        SH4A_PCIEDMAOR          (0x021000)      /* R/W R/W 0x0000 0000 32 */
 #define        SH4A_PCIEDMSAR0         (0x021100)      /* R/W R/W 0x0000 0000 32 */
 #define        SH4A_PCIEDMSAHR0        (0x021104)      /* R/W R/W 0x0000 0000 32 */
index 3b14bf860db60703d06a6323ecb0ffc2fba3306d..6da62e9475c45a498becee4c8041d3a0b248b19f 100644 (file)
@@ -134,8 +134,8 @@ static int sh4202_read_vcr(unsigned long base, struct superhyway_vcr_info *vcr)
         *
         * Do not trust the documentation, for it is evil.
         */
-       vcrh = ctrl_inl(base);
-       vcrl = ctrl_inl(base + sizeof(u32));
+       vcrh = __raw_readl(base);
+       vcrl = __raw_readl(base + sizeof(u32));
 
        tmp = ((u64)vcrh << 32) | vcrl;
        memcpy(vcr, &tmp, sizeof(u64));
@@ -147,8 +147,8 @@ static int sh4202_write_vcr(unsigned long base, struct superhyway_vcr_info vcr)
 {
        u64 tmp = *(u64 *)&vcr;
 
-       ctrl_outl((tmp >> 32) & 0xffffffff, base);
-       ctrl_outl(tmp & 0xffffffff, base + sizeof(u32));
+       __raw_writel((tmp >> 32) & 0xffffffff, base);
+       __raw_writel(tmp & 0xffffffff, base + sizeof(u32));
 
        return 0;
 }
index e121c30f797d8e54a4254ab5b8a9b1cdfaf0bb4f..46cb93477bcb1f11a1994c8950bc5b40e61ab346 100644 (file)
@@ -1,6 +1,8 @@
 include include/asm-generic/Kbuild.asm
 
-header-y += cachectl.h cpu-features.h
+header-y += cachectl.h
+header-y += cpu-features.h
+header-y += hw_breakpoint.h
 
 unifdef-y += unistd_32.h
 unifdef-y += unistd_64.h
index 99d6b3ecbe22d41167d2f4221d8d6223250f7017..446b3831c2149380265476f47674d4ad4ea72b1e 100644 (file)
@@ -28,7 +28,7 @@
 /* Returns the privileged segment base of a given address  */
 #define PXSEG(a)       (((unsigned long)(a)) & 0xe0000000)
 
-#if defined(CONFIG_29BIT) || defined(CONFIG_PMB_FIXED)
+#ifdef CONFIG_29BIT
 /*
  * Map an address to a certain privileged segment
  */
        ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
 #define P4SEGADDR(a)   \
        ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
-#endif /* 29BIT || PMB_FIXED */
+#else
+/*
+ * These will never work in 32-bit, don't even bother.
+ */
+#define P1SEGADDR(a)   __futile_remapping_attempt
+#define P2SEGADDR(a)   __futile_remapping_attempt
+#define P3SEGADDR(a)   __futile_remapping_attempt
+#define P4SEGADDR(a)   __futile_remapping_attempt
+#endif
 #endif /* P1SEG */
 
 /* Check if an address can be reached in 29 bits */
 #define P3_ADDR_MAX            P4SEG
 #endif
 
-#ifndef __ASSEMBLY__
-#ifdef CONFIG_PMB
-extern int __in_29bit_mode(void);
-#endif /* CONFIG_PMB */
-#endif /* __ASSEMBLY__ */
-
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/arch/sh/include/asm/alignment.h b/arch/sh/include/asm/alignment.h
new file mode 100644 (file)
index 0000000..b12efec
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __ASM_SH_ALIGNMENT_H
+#define __ASM_SH_ALIGNMENT_H
+
+#include <linux/types.h>
+
+extern void inc_unaligned_byte_access(void);
+extern void inc_unaligned_word_access(void);
+extern void inc_unaligned_dword_access(void);
+extern void inc_unaligned_multi_access(void);
+extern void inc_unaligned_user_access(void);
+extern void inc_unaligned_kernel_access(void);
+
+#define UM_WARN                (1 << 0)
+#define UM_FIXUP       (1 << 1)
+#define UM_SIGNAL      (1 << 2)
+
+extern unsigned int unaligned_user_action(void);
+
+extern void unaligned_fixups_notify(struct task_struct *, insn_size_t, struct pt_regs *);
+
+#endif /* __ASM_SH_ALIGNMENT_H */
index 4c5b7dbfcedb1deb80a759799cd2d5de1e3402ee..a273c88578fc99d81cc4a2879d628372349b8fbd 100644 (file)
@@ -120,50 +120,4 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
                : "memory" , "r0", "r1");
 }
 
-static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-{
-       int ret;
-
-       __asm__ __volatile__ (
-               "   .align 2            \n\t"
-               "   mova     1f,  r0    \n\t"
-               "   nop                 \n\t"
-               "   mov     r15,  r1    \n\t"
-               "   mov    #-8,  r15    \n\t"
-               "   mov.l   @%1,  %0    \n\t"
-               "   cmp/eq   %2,  %0    \n\t"
-               "   bf       1f         \n\t"
-               "   mov.l    %3, @%1    \n\t"
-               "1: mov      r1,  r15   \n\t"
-               : "=&r" (ret)
-               : "r" (v), "r" (old), "r" (new)
-               : "memory" , "r0", "r1" , "t");
-
-       return ret;
-}
-
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int ret;
-       unsigned long tmp;
-
-       __asm__ __volatile__ (
-               "   .align 2            \n\t"
-               "   mova    1f,   r0    \n\t"
-               "   nop                 \n\t"
-               "   mov    r15,   r1    \n\t"
-               "   mov    #-12,  r15   \n\t"
-               "   mov.l  @%2,   %1    \n\t"
-               "   mov     %1,   %0    \n\t"
-               "   cmp/eq  %4,   %0    \n\t"
-               "   bt/s    1f          \n\t"
-               "    add    %3,   %1    \n\t"
-               "   mov.l   %1,  @%2    \n\t"
-               "1: mov     r1,   r15   \n\t"
-               : "=&r" (ret), "=&r" (tmp)
-               : "r" (v), "r" (a), "r" (u)
-               : "memory" , "r0", "r1" , "t");
-
-       return ret != u;
-}
 #endif /* __ASM_SH_ATOMIC_GRB_H */
index b040e1e086108c606c6da8ecbd712b0dca2b1734..4b00b78e3f4f3a6a5be4a70a924123c84f32c895 100644 (file)
@@ -104,31 +104,4 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
        : "t");
 }
 
-#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
-
-/**
- * atomic_add_unless - add unless the number is a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as it was not @u.
- * Returns non-zero if @v was not @u, and zero otherwise.
- */
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int c, old;
-       c = atomic_read(v);
-       for (;;) {
-               if (unlikely(c == (u)))
-                       break;
-               old = atomic_cmpxchg((v), c, c + (a));
-               if (likely(old == c))
-                       break;
-               c = old;
-       }
-
-       return c != (u);
-}
-
 #endif /* __ASM_SH_ATOMIC_LLSC_H */
index b16388d719546a3c2cdb70e2b1a94eec897a180e..275a448ae8c27bd38bb6cd19fbe7280d8b54198a 100644 (file)
 #endif
 
 #define atomic_add_negative(a, v)      (atomic_add_return((a), (v)) < 0)
+#define atomic_dec_return(v)           atomic_sub_return(1, (v))
+#define atomic_inc_return(v)           atomic_add_return(1, (v))
+#define atomic_inc_and_test(v)         (atomic_inc_return(v) == 0)
+#define atomic_sub_and_test(i,v)       (atomic_sub_return((i), (v)) == 0)
+#define atomic_dec_and_test(v)         (atomic_sub_return(1, (v)) == 0)
+#define atomic_inc_not_zero(v)         atomic_add_unless((v), 1, 0)
 
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
+#define atomic_inc(v)                  atomic_add(1, (v))
+#define atomic_dec(v)                  atomic_sub(1, (v))
 
-/*
- * atomic_inc_and_test - increment and test
+#define atomic_xchg(v, new)            (xchg(&((v)->counter), new))
+#define atomic_cmpxchg(v, o, n)                (cmpxchg(&((v)->counter), (o), (n)))
+
+/**
+ * atomic_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
+ * @a: the amount to add to v...
+ * @u: ...unless v is equal to u.
  *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases.
+ * Atomically adds @a to @v, so long as it was not @u.
+ * Returns non-zero if @v was not @u, and zero otherwise.
  */
-#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
-
-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-#define atomic_inc(v) atomic_add(1,(v))
-#define atomic_dec(v) atomic_sub(1,(v))
-
-#if !defined(CONFIG_GUSA_RB) && !defined(CONFIG_CPU_SH4A)
-static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-{
-       int ret;
-       unsigned long flags;
-
-       local_irq_save(flags);
-       ret = v->counter;
-       if (likely(ret == old))
-               v->counter = new;
-       local_irq_restore(flags);
-
-       return ret;
-}
-
 static inline int atomic_add_unless(atomic_t *v, int a, int u)
 {
-       int ret;
-       unsigned long flags;
-
-       local_irq_save(flags);
-       ret = v->counter;
-       if (ret != u)
-               v->counter += a;
-       local_irq_restore(flags);
-
-       return ret != u;
+       int c, old;
+       c = atomic_read(v);
+       for (;;) {
+               if (unlikely(c == (u)))
+                       break;
+               old = atomic_cmpxchg((v), c, c + (a));
+               if (likely(old == c))
+                       break;
+               c = old;
+       }
+
+       return c != (u);
 }
-#endif /* !CONFIG_GUSA_RB && !CONFIG_CPU_SH4A */
-
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
 
 #define smp_mb__before_atomic_dec()    smp_mb()
 #define smp_mb__after_atomic_dec()     smp_mb()
index dda96eb3e7c06b31bb764915a4474bec649f9c2d..da3ebec921a70db7941f3bfac3f47261c759bc76 100644 (file)
@@ -63,6 +63,14 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
        if (boot_cpu_data.dcache.n_aliases && PageAnon(page))
                __flush_anon_page(page, vmaddr);
 }
+static inline void flush_kernel_vmap_range(void *addr, int size)
+{
+       __flush_wback_region(addr, size);
+}
+static inline void invalidate_kernel_vmap_range(void *addr, int size)
+{
+       __flush_invalidate_region(addr, size);
+}
 
 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
 static inline void flush_kernel_dcache_page(struct page *page)
index 9fe7d7f8af404646dfcce651d53727f69fc91653..11da4c5beb68a3f980707db0580b46087a1007e4 100644 (file)
@@ -146,8 +146,17 @@ int sh_clk_mstp32_register(struct clk *clks, int nr);
        .flags = _flags,                                                \
 }
 
+struct clk_div4_table {
+       struct clk_div_mult_table *div_mult_table;
+       void (*kick)(struct clk *clk);
+};
+
 int sh_clk_div4_register(struct clk *clks, int nr,
-                        struct clk_div_mult_table *table);
+                        struct clk_div4_table *table);
+int sh_clk_div4_enable_register(struct clk *clks, int nr,
+                        struct clk_div4_table *table);
+int sh_clk_div4_reparent_register(struct clk *clks, int nr,
+                        struct clk_div4_table *table);
 
 #define SH_CLK_DIV6(_name, _parent, _reg, _flags)      \
 {                                                      \
index e2681abe764f49f625966abb08cd9a47655d9797..4676bf57693a0ec3daf573d885731cfe7ed21963 100644 (file)
@@ -57,11 +57,10 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
                "   mov.l  @%1,   %0      \n\t" /* load  old value */
                "   cmp/eq  %0,   %2      \n\t"
                "   bf            1f      \n\t" /* if not equal */
-               "   mov.l   %2,   @%1     \n\t" /* store new value */
+               "   mov.l   %3,   @%1     \n\t" /* store new value */
                "1: mov     r1,   r15     \n\t" /* LOGOUT */
-               : "=&r" (retval),
-                 "+r"  (m)
-               : "r"   (new)
+               : "=&r" (retval)
+               :  "r"  (m), "r"  (old), "r"  (new)
                : "memory" , "r0", "r1", "t");
 
        return retval;
index 87ced133a363d56172f16fa3f4642b4523d139c8..bea3337a426a13d4e05e45aca90d45a9778a0d06 100644 (file)
@@ -89,8 +89,6 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 {
        struct dma_map_ops *ops = get_dma_ops(dev);
 
-       WARN_ON(irqs_disabled());       /* for portability */
-
        if (dma_release_from_coherent(dev, get_order(size), vaddr))
                return;
 
index 78eed3e0bdf548dc6c5f1761b51eefeb17cdb0a0..e934a2e666517ce4dae593928c9791516362efa1 100644 (file)
     defined(CONFIG_CPU_SUBTYPE_SH7780) || \
     defined(CONFIG_CPU_SUBTYPE_SH7785)
 #define dmaor_read_reg(n) \
-    (n ? ctrl_inw(SH_DMAC_BASE1 + DMAOR) \
-       : ctrl_inw(SH_DMAC_BASE0 + DMAOR))
+    (n ? __raw_readw(SH_DMAC_BASE1 + DMAOR) \
+       : __raw_readw(SH_DMAC_BASE0 + DMAOR))
 #define dmaor_write_reg(n, data) \
-    (n ? ctrl_outw(data, SH_DMAC_BASE1 + DMAOR) \
-    : ctrl_outw(data, SH_DMAC_BASE0 + DMAOR))
+    (n ? __raw_writew(data, SH_DMAC_BASE1 + DMAOR) \
+    : __raw_writew(data, SH_DMAC_BASE0 + DMAOR))
 #else /* Other CPU */
-#define dmaor_read_reg(n) ctrl_inw(SH_DMAC_BASE0 + DMAOR)
-#define dmaor_write_reg(n, data) ctrl_outw(data, SH_DMAC_BASE0 + DMAOR)
+#define dmaor_read_reg(n) __raw_readw(SH_DMAC_BASE0 + DMAOR)
+#define dmaor_write_reg(n, data) __raw_writew(data, SH_DMAC_BASE0 + DMAOR)
 #endif
 
 static int dmte_irq_map[] __maybe_unused = {
@@ -64,8 +64,10 @@ static int dmte_irq_map[] __maybe_unused = {
 #define ACK_L  0x00010000
 #define DM_INC 0x00004000
 #define DM_DEC 0x00008000
+#define DM_FIX 0x0000c000
 #define SM_INC 0x00001000
 #define SM_DEC 0x00002000
+#define SM_FIX 0x00003000
 #define RS_IN  0x00000200
 #define RS_OUT 0x00000300
 #define TS_BLK 0x00000040
@@ -83,7 +85,7 @@ static int dmte_irq_map[] __maybe_unused = {
  * Define the default configuration for dual address memory-memory transfer.
  * The 0x400 value represents auto-request, external->external.
  */
-#define RS_DUAL        (DM_INC | SM_INC | 0x400 | TS_32)
+#define RS_DUAL        (DM_INC | SM_INC | 0x400 | TS_INDEX2VAL(XMIT_SZ_32BIT))
 
 /* DMA base address */
 static u32 dma_base_addr[] __maybe_unused = {
@@ -123,10 +125,47 @@ static u32 dma_base_addr[] __maybe_unused = {
  */
 #define SHDMA_MIX_IRQ  (1 << 1)
 #define SHDMA_DMAOR1   (1 << 2)
-#define SHDMA_DMAE1            (1 << 3)
+#define SHDMA_DMAE1    (1 << 3)
+
+enum sh_dmae_slave_chan_id {
+       SHDMA_SLAVE_SCIF0_TX,
+       SHDMA_SLAVE_SCIF0_RX,
+       SHDMA_SLAVE_SCIF1_TX,
+       SHDMA_SLAVE_SCIF1_RX,
+       SHDMA_SLAVE_SCIF2_TX,
+       SHDMA_SLAVE_SCIF2_RX,
+       SHDMA_SLAVE_SCIF3_TX,
+       SHDMA_SLAVE_SCIF3_RX,
+       SHDMA_SLAVE_SCIF4_TX,
+       SHDMA_SLAVE_SCIF4_RX,
+       SHDMA_SLAVE_SCIF5_TX,
+       SHDMA_SLAVE_SCIF5_RX,
+       SHDMA_SLAVE_SIUA_TX,
+       SHDMA_SLAVE_SIUA_RX,
+       SHDMA_SLAVE_SIUB_TX,
+       SHDMA_SLAVE_SIUB_RX,
+       SHDMA_SLAVE_NUMBER,     /* Must stay last */
+};
+
+struct sh_dmae_slave_config {
+       enum sh_dmae_slave_chan_id      slave_id;
+       dma_addr_t                      addr;
+       u32                             chcr;
+       char                            mid_rid;
+};
 
 struct sh_dmae_pdata {
        unsigned int mode;
+       struct sh_dmae_slave_config *config;
+       int config_num;
+};
+
+struct device;
+
+struct sh_dmae_slave {
+       enum sh_dmae_slave_chan_id      slave_id; /* Set by the platform */
+       struct device                   *dma_dev; /* Set by the platform */
+       struct sh_dmae_slave_config     *config;  /* Set by the driver */
 };
 
 #endif /* __DMA_SH_H */
index bdccbbfdc0bd9abbce7c5cbc37168a8429c09808..d62abd1d0c05b31b9da9d4e07dfff264d35abb82 100644 (file)
@@ -243,16 +243,13 @@ struct dwarf_cie {
 
        unsigned long cie_pointer;
 
-       struct list_head link;
-
        unsigned long flags;
 #define DWARF_CIE_Z_AUGMENTATION       (1 << 0)
 
-       /*
-        * 'mod' will be non-NULL if this CIE came from a module's
-        * .eh_frame section.
-        */
-       struct module *mod;
+       /* linked-list entry if this CIE is from a module */
+       struct list_head link;
+
+       struct rb_node node;
 };
 
 /**
@@ -266,13 +263,11 @@ struct dwarf_fde {
        unsigned long address_range;
        unsigned char *instructions;
        unsigned char *end;
+
+       /* linked-list entry if this FDE is from a module */
        struct list_head link;
 
-       /*
-        * 'mod' will be non-NULL if this FDE came from a module's
-        * .eh_frame section.
-        */
-       struct module *mod;
+       struct rb_node node;
 };
 
 /**
index 5ac1e40a511c14d344057b6a5aeba84b38b58999..6e7cea453895a7bcd020a1c70e8d95f8cd218796 100644 (file)
@@ -55,16 +55,29 @@ enum fixed_addresses {
 #define FIX_N_COLOURS 8
        FIX_CMAP_BEGIN,
        FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS) - 1,
-       FIX_UNCACHED,
+
 #ifdef CONFIG_HIGHMEM
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
        FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #endif
+
+#ifdef CONFIG_IOREMAP_FIXED
+       /*
+        * FIX_IOREMAP entries are useful for mapping physical address
+        * space before ioremap() is useable, e.g. really early in boot
+        * before kmalloc() is working.
+        */
+#define FIX_N_IOREMAPS 32
+       FIX_IOREMAP_BEGIN,
+       FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS,
+#endif
+
        __end_of_fixed_addresses
 };
 
 extern void __set_fixmap(enum fixed_addresses idx,
                         unsigned long phys, pgprot_t flags);
+extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);
 
 #define set_fixmap(idx, phys) \
                __set_fixmap(idx, phys, PAGE_KERNEL)
index fb6bbb9b1cc8e704191f5a6fb73ce001d3c9644f..06c4281aab65604af414c5081dde2b9871a3f952 100644 (file)
@@ -2,8 +2,8 @@
 #define __ASM_SH_FPU_H
 
 #ifndef __ASSEMBLY__
-#include <linux/preempt.h>
-#include <asm/ptrace.h>
+
+struct task_struct;
 
 #ifdef CONFIG_SH_FPU
 static inline void release_fpu(struct pt_regs *regs)
@@ -16,22 +16,23 @@ static inline void grab_fpu(struct pt_regs *regs)
        regs->sr &= ~SR_FD;
 }
 
-struct task_struct;
-
 extern void save_fpu(struct task_struct *__tsk);
-void fpu_state_restore(struct pt_regs *regs);
+extern void restore_fpu(struct task_struct *__tsk);
+extern void fpu_state_restore(struct pt_regs *regs);
+extern void __fpu_state_restore(void);
 #else
-
-#define save_fpu(tsk)          do { } while (0)
-#define release_fpu(regs)      do { } while (0)
-#define grab_fpu(regs)         do { } while (0)
-#define fpu_state_restore(regs)        do { } while (0)
-
+#define save_fpu(tsk)                  do { } while (0)
+#define restore_fpu(tsk)               do { } while (0)
+#define release_fpu(regs)              do { } while (0)
+#define grab_fpu(regs)                 do { } while (0)
+#define fpu_state_restore(regs)                do { } while (0)
+#define __fpu_state_restore(regs)      do { } while (0)
 #endif
 
 struct user_regset;
 
 extern int do_fpu_inst(unsigned short, struct pt_regs *);
+extern int init_fpu(struct task_struct *);
 
 extern int fpregs_get(struct task_struct *target,
                      const struct user_regset *regset,
@@ -65,18 +66,6 @@ static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs)
        preempt_enable();
 }
 
-static inline int init_fpu(struct task_struct *tsk)
-{
-       if (tsk_used_math(tsk)) {
-               if ((boot_cpu_data.flags & CPU_HAS_FPU) && tsk == current)
-                       unlazy_fpu(tsk, task_pt_regs(tsk));
-               return 0;
-       }
-
-       set_stopped_child_used_math(tsk);
-       return 0;
-}
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_SH_FPU_H */
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
new file mode 100644 (file)
index 0000000..965dd78
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef __ASM_SH_HW_BREAKPOINT_H
+#define __ASM_SH_HW_BREAKPOINT_H
+
+#ifdef __KERNEL__
+#define __ARCH_HW_BREAKPOINT_H
+
+#include <linux/kdebug.h>
+#include <linux/types.h>
+
+struct arch_hw_breakpoint {
+       char            *name; /* Contains name of the symbol to set bkpt */
+       unsigned long   address;
+       u16             len;
+       u16             type;
+};
+
+enum {
+       SH_BREAKPOINT_READ      = (1 << 1),
+       SH_BREAKPOINT_WRITE     = (1 << 2),
+       SH_BREAKPOINT_RW        = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
+
+       SH_BREAKPOINT_LEN_1     = (1 << 12),
+       SH_BREAKPOINT_LEN_2     = (1 << 13),
+       SH_BREAKPOINT_LEN_4     = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
+       SH_BREAKPOINT_LEN_8     = (1 << 14),
+};
+
+struct sh_ubc {
+       const char      *name;
+       unsigned int    num_events;
+       unsigned int    trap_nr;
+       void            (*enable)(struct arch_hw_breakpoint *, int);
+       void            (*disable)(struct arch_hw_breakpoint *, int);
+       void            (*enable_all)(unsigned long);
+       void            (*disable_all)(void);
+       unsigned long   (*active_mask)(void);
+       unsigned long   (*triggered_mask)(void);
+       void            (*clear_triggered_mask)(unsigned long);
+       struct clk      *clk;   /* optional interface clock / MSTP bit */
+};
+
+struct perf_event;
+struct task_struct;
+struct pmu;
+
+/* Maximum number of UBC channels */
+#define HBP_NUM                2
+
+/* arch/sh/kernel/hw_breakpoint.c */
+extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len);
+extern int arch_validate_hwbkpt_settings(struct perf_event *bp,
+                                        struct task_struct *tsk);
+extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
+                                          unsigned long val, void *data);
+
+int arch_install_hw_breakpoint(struct perf_event *bp);
+void arch_uninstall_hw_breakpoint(struct perf_event *bp);
+void hw_breakpoint_pmu_read(struct perf_event *bp);
+void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
+
+extern void arch_fill_perf_breakpoint(struct perf_event *bp);
+extern int register_sh_ubc(struct sh_ubc *);
+
+extern struct pmu perf_ops_bp;
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_SH_HW_BREAKPOINT_H */
index 026dd659a6400cf70f6105167cfa927e4670f978..7dab7b23a5ecff3fd1d1bedc6384ef289aa20531 100644 (file)
@@ -22,6 +22,7 @@
  * for old compat code for I/O offseting to SuperIOs, all of which are
  * better handled through the machvec ioport mapping routines these days.
  */
+#include <linux/errno.h>
 #include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/addrspace.h>
 #define writel(v,a)            ({ __raw_writel((v),(a)); mb(); })
 #define writeq(v,a)            ({ __raw_writeq((v),(a)); mb(); })
 
-/* SuperH on-chip I/O functions */
-#define ctrl_inb               __raw_readb
-#define ctrl_inw               __raw_readw
-#define ctrl_inl               __raw_readl
-#define ctrl_inq               __raw_readq
+/*
+ * Legacy SuperH on-chip I/O functions
+ *
+ * These are all deprecated, all new (and especially cross-platform) code
+ * should be using the __raw_xxx() routines directly.
+ */
+static inline u8 __deprecated ctrl_inb(unsigned long addr)
+{
+       return __raw_readb(addr);
+}
+
+static inline u16 __deprecated ctrl_inw(unsigned long addr)
+{
+       return __raw_readw(addr);
+}
+
+static inline u32 __deprecated ctrl_inl(unsigned long addr)
+{
+       return __raw_readl(addr);
+}
+
+static inline u64 __deprecated ctrl_inq(unsigned long addr)
+{
+       return __raw_readq(addr);
+}
+
+static inline void __deprecated ctrl_outb(u8 v, unsigned long addr)
+{
+       __raw_writeb(v, addr);
+}
+
+static inline void __deprecated ctrl_outw(u16 v, unsigned long addr)
+{
+       __raw_writew(v, addr);
+}
 
-#define ctrl_outb              __raw_writeb
-#define ctrl_outw              __raw_writew
-#define ctrl_outl              __raw_writel
-#define ctrl_outq              __raw_writeq
+static inline void __deprecated ctrl_outl(u32 v, unsigned long addr)
+{
+       __raw_writel(v, addr);
+}
+
+static inline void __deprecated ctrl_outq(u64 v, unsigned long addr)
+{
+       __raw_writeq(v, addr);
+}
 
 extern unsigned long generic_io_base;
 
@@ -97,6 +133,28 @@ static inline void ctrl_delay(void)
        __raw_readw(generic_io_base);
 }
 
+#define __BUILD_UNCACHED_IO(bwlq, type)                                        \
+static inline type read##bwlq##_uncached(unsigned long addr)           \
+{                                                                      \
+       type ret;                                                       \
+       jump_to_uncached();                                             \
+       ret = __raw_read##bwlq(addr);                                   \
+       back_to_cached();                                               \
+       return ret;                                                     \
+}                                                                      \
+                                                                       \
+static inline void write##bwlq##_uncached(type v, unsigned long addr)  \
+{                                                                      \
+       jump_to_uncached();                                             \
+       __raw_write##bwlq(v, addr);                                     \
+       back_to_cached();                                               \
+}
+
+__BUILD_UNCACHED_IO(b, u8)
+__BUILD_UNCACHED_IO(w, u16)
+__BUILD_UNCACHED_IO(l, u32)
+__BUILD_UNCACHED_IO(q, u64)
+
 #define __BUILD_MEMORY_STRING(bwlq, type)                              \
                                                                        \
 static inline void __raw_writes##bwlq(volatile void __iomem *mem,      \
@@ -234,28 +292,21 @@ unsigned long long poke_real_address_q(unsigned long long addr,
  */
 #ifdef CONFIG_MMU
 void __iomem *__ioremap_caller(unsigned long offset, unsigned long size,
-                              unsigned long flags, void *caller);
+                              pgprot_t prot, void *caller);
 void __iounmap(void __iomem *addr);
 
 static inline void __iomem *
-__ioremap(unsigned long offset, unsigned long size, unsigned long flags)
+__ioremap(unsigned long offset, unsigned long size, pgprot_t prot)
 {
-       return __ioremap_caller(offset, size, flags, __builtin_return_address(0));
+       return __ioremap_caller(offset, size, prot, __builtin_return_address(0));
 }
 
 static inline void __iomem *
-__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
+__ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot)
 {
-#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED) && !defined(CONFIG_PMB)
+#ifdef CONFIG_29BIT
        unsigned long last_addr = offset + size - 1;
-#endif
-       void __iomem *ret;
 
-       ret = __ioremap_trapped(offset, size);
-       if (ret)
-               return ret;
-
-#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED) && !defined(CONFIG_PMB)
        /*
         * For P1 and P2 space this is trivial, as everything is already
         * mapped. Uncached access for P1 addresses are done through P2.
@@ -263,7 +314,7 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
         * mapping must be done by the PMB or by using page tables.
         */
        if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
-               if (unlikely(flags & _PAGE_CACHABLE))
+               if (unlikely(pgprot_val(prot) & _PAGE_CACHABLE))
                        return (void __iomem *)P1SEGADDR(offset);
 
                return (void __iomem *)P2SEGADDR(offset);
@@ -274,26 +325,70 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
                return (void __iomem *)P4SEGADDR(offset);
 #endif
 
-       return __ioremap(offset, size, flags);
+       return NULL;
+}
+
+static inline void __iomem *
+__ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot)
+{
+       void __iomem *ret;
+
+       ret = __ioremap_trapped(offset, size);
+       if (ret)
+               return ret;
+
+       ret = __ioremap_29bit(offset, size, prot);
+       if (ret)
+               return ret;
+
+       return __ioremap(offset, size, prot);
 }
 #else
-#define __ioremap(offset, size, flags)         ((void __iomem *)(offset))
-#define __ioremap_mode(offset, size, flags)    ((void __iomem *)(offset))
+#define __ioremap(offset, size, prot)          ((void __iomem *)(offset))
+#define __ioremap_mode(offset, size, prot)     ((void __iomem *)(offset))
 #define __iounmap(addr)                                do { } while (0)
 #endif /* CONFIG_MMU */
 
-#define ioremap(offset, size)                          \
-       __ioremap_mode((offset), (size), 0)
-#define ioremap_nocache(offset, size)                  \
-       __ioremap_mode((offset), (size), 0)
-#define ioremap_cache(offset, size)                    \
-       __ioremap_mode((offset), (size), _PAGE_CACHABLE)
-#define p3_ioremap(offset, size, flags)                        \
-       __ioremap((offset), (size), (flags))
-#define ioremap_prot(offset, size, flags)              \
-       __ioremap_mode((offset), (size), (flags))
-#define iounmap(addr)                                  \
-       __iounmap((addr))
+static inline void __iomem *
+ioremap(unsigned long offset, unsigned long size)
+{
+       return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
+}
+
+static inline void __iomem *
+ioremap_cache(unsigned long offset, unsigned long size)
+{
+       return __ioremap_mode(offset, size, PAGE_KERNEL);
+}
+
+#ifdef CONFIG_HAVE_IOREMAP_PROT
+static inline void __iomem *
+ioremap_prot(resource_size_t offset, unsigned long size, unsigned long flags)
+{
+       return __ioremap_mode(offset, size, __pgprot(flags));
+}
+#endif
+
+#ifdef CONFIG_IOREMAP_FIXED
+extern void __iomem *ioremap_fixed(resource_size_t, unsigned long,
+                                  unsigned long, pgprot_t);
+extern int iounmap_fixed(void __iomem *);
+extern void ioremap_fixed_init(void);
+#else
+static inline void __iomem *
+ioremap_fixed(resource_size_t phys_addr, unsigned long offset,
+             unsigned long size, pgprot_t prot)
+{
+       BUG();
+       return NULL;
+}
+
+static inline void ioremap_fixed_init(void) { }
+static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
+#endif
+
+#define ioremap_nocache        ioremap
+#define iounmap                __iounmap
 
 #define maybebadio(port) \
        printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \
index 985219f9759ef0aaa908e7308930627730498d6c..5f6d2e9ccb7c24f16e4420ab3153d5746e0d66e9 100644 (file)
@@ -6,6 +6,8 @@ enum die_val {
        DIE_TRAP,
        DIE_NMI,
        DIE_OOPS,
+       DIE_BREAKPOINT,
+       DIE_SSTEP,
 };
 
 #endif /* __ASM_SH_KDEBUG_H */
index c7426ad9926e7c03bda9d717ec79108c345f63d1..15a05b615ba7f60e293928723215c73e392362e8 100644 (file)
@@ -11,7 +11,9 @@
 
 #define PMB_ADDR               0xf6100000
 #define PMB_DATA               0xf7100000
-#define PMB_ENTRY_MAX          16
+
+#define NR_PMB_ENTRIES         16
+
 #define PMB_E_MASK             0x0000000f
 #define PMB_E_SHIFT            8
 
 #define PMB_C                  0x00000008
 #define PMB_WT                 0x00000001
 #define PMB_UB                 0x00000200
+#define PMB_CACHE_MASK         (PMB_C | PMB_WT | PMB_UB)
 #define PMB_V                  0x00000100
 
 #define PMB_NO_ENTRY           (-1)
 
 #ifndef __ASSEMBLY__
+#include <linux/errno.h>
+#include <linux/threads.h>
+#include <asm/page.h>
 
 /* Default "unsigned long" context */
 typedef unsigned long mm_context_id_t[NR_CPUS];
@@ -47,29 +53,30 @@ typedef struct {
 #endif
 } mm_context_t;
 
-struct pmb_entry;
-
-struct pmb_entry {
-       unsigned long vpn;
-       unsigned long ppn;
-       unsigned long flags;
-
-       /*
-        * 0 .. NR_PMB_ENTRIES for specific entry selection, or
-        * PMB_NO_ENTRY to search for a free one
-        */
-       int entry;
-
-       struct pmb_entry *next;
-       /* Adjacent entry link for contiguous multi-entry mappings */
-       struct pmb_entry *link;
-};
-
+#ifdef CONFIG_PMB
 /* arch/sh/mm/pmb.c */
 long pmb_remap(unsigned long virt, unsigned long phys,
-              unsigned long size, unsigned long flags);
+              unsigned long size, pgprot_t prot);
 void pmb_unmap(unsigned long addr);
-int pmb_init(void);
+void pmb_init(void);
+bool __in_29bit_mode(void);
+#else
+static inline long pmb_remap(unsigned long virt, unsigned long phys,
+                            unsigned long size, pgprot_t prot)
+{
+       return -EINVAL;
+}
+
+#define pmb_unmap(addr)                do { } while (0)
+#define pmb_init(addr)         do { } while (0)
+
+#ifdef CONFIG_29BIT
+#define __in_29bit_mode()      (1)
+#else
+#define __in_29bit_mode()      (0)
+#endif
+
+#endif /* CONFIG_PMB */
 #endif /* __ASSEMBLY__ */
 
 #endif /* __MMU_H */
index 41080b173a7abf4cae0b37f100051434cd26e336..384c7471a374b05ea5bf2fe96ec5306b3723266a 100644 (file)
@@ -158,7 +158,7 @@ static inline void enable_mmu(void)
        unsigned int cpu = smp_processor_id();
 
        /* Enable MMU */
-       ctrl_outl(MMU_CONTROL_INIT, MMUCR);
+       __raw_writel(MMU_CONTROL_INIT, MMUCR);
        ctrl_barrier();
 
        if (asid_cache(cpu) == NO_CONTEXT)
@@ -171,9 +171,9 @@ static inline void disable_mmu(void)
 {
        unsigned long cr;
 
-       cr = ctrl_inl(MMUCR);
+       cr = __raw_readl(MMUCR);
        cr &= ~MMU_CONTROL_INIT;
-       ctrl_outl(cr, MMUCR);
+       __raw_writel(cr, MMUCR);
 
        ctrl_barrier();
 }
index 8ef800c549abcfd4be2ff3e8db9325ed88762442..10e2e17210d28592d1c9a1c7fdc92b4cc2679235 100644 (file)
@@ -49,11 +49,11 @@ static inline unsigned long get_asid(void)
 /* MMU_TTB is used for optimizing the fault handling. */
 static inline void set_TTB(pgd_t *pgd)
 {
-       ctrl_outl((unsigned long)pgd, MMU_TTB);
+       __raw_writel((unsigned long)pgd, MMU_TTB);
 }
 
 static inline pgd_t *get_TTB(void)
 {
-       return (pgd_t *)ctrl_inl(MMU_TTB);
+       return (pgd_t *)__raw_readl(MMU_TTB);
 }
 #endif /* __ASM_SH_MMU_CONTEXT_32_H */
index 068bf1659750def61fe9e35f1dbb01a20d3fbd0b..b7927de86f9fcfb9d220abfd03872d06307cf149 100644 (file)
@@ -1,7 +1,22 @@
 #ifndef _ASM_SH_MODULE_H
 #define _ASM_SH_MODULE_H
 
-#include <asm-generic/module.h>
+struct mod_arch_specific {
+#ifdef CONFIG_DWARF_UNWINDER
+       struct list_head fde_list;
+       struct list_head cie_list;
+#endif
+};
+
+#ifdef CONFIG_64BIT
+#define Elf_Shdr Elf64_Shdr
+#define Elf_Sym Elf64_Sym
+#define Elf_Ehdr Elf64_Ehdr
+#else
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+#endif
 
 #ifdef CONFIG_CPU_LITTLE_ENDIAN
 # ifdef CONFIG_CPU_SH2
index 81bffc0d6860972953ed2beef9be548fee7b40fe..d71feb35930489a2086c7de46ee6fa54a3ae5a60 100644 (file)
@@ -45,6 +45,7 @@
 #endif
 
 #ifndef __ASSEMBLY__
+#include <asm/uncached.h>
 
 extern unsigned long shm_align_mask;
 extern unsigned long max_low_pfn, min_low_pfn;
@@ -56,7 +57,6 @@ pages_do_alias(unsigned long addr1, unsigned long addr2)
        return (addr1 ^ addr2) & shm_align_mask;
 }
 
-
 #define clear_page(page)       memset((void *)(page), 0, PAGE_SIZE)
 extern void copy_page(void *to, void *from);
 
@@ -88,7 +88,7 @@ typedef struct { unsigned long pgd; } pgd_t;
 #define __pte(x)       ((pte_t) { (x) } )
 #else
 typedef struct { unsigned long long pte_low; } pte_t;
-typedef struct { unsigned long pgprot; } pgprot_t;
+typedef struct { unsigned long long pgprot; } pgprot_t;
 typedef struct { unsigned long pgd; } pgd_t;
 #define pte_val(x)     ((x).pte_low)
 #define __pte(x)       ((pte_t) { (x) } )
@@ -127,12 +127,7 @@ typedef struct page *pgtable_t;
  * is not visible (it is part of the PMB mapping) and so needs to be
  * added or subtracted as required.
  */
-#if defined(CONFIG_PMB_FIXED)
-/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */
-#define PMB_OFFSET     (PAGE_OFFSET - PXSEG(__MEMORY_START))
-#define __pa(x)        ((unsigned long)(x) - PMB_OFFSET)
-#define __va(x)        ((void *)((unsigned long)(x) + PMB_OFFSET))
-#elif defined(CONFIG_32BIT)
+#ifdef CONFIG_PMB
 #define __pa(x)        ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
 #define __va(x)        ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
 #else
@@ -140,6 +135,14 @@ typedef struct page *pgtable_t;
 #define __va(x)        ((void *)((unsigned long)(x)+PAGE_OFFSET))
 #endif
 
+#ifdef CONFIG_UNCACHED_MAPPING
+#define UNCAC_ADDR(addr)       ((addr) - PAGE_OFFSET + uncached_start)
+#define CAC_ADDR(addr)         ((addr) - uncached_start + PAGE_OFFSET)
+#else
+#define UNCAC_ADDR(addr)       ((addr))
+#define CAC_ADDR(addr)         ((addr))
+#endif
+
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 #define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
 
index 67f3999b544e89ac2fe243c871c08266b592b10e..1042f7f0a48be795a84732af62ca6f565e3773ac 100644 (file)
  */
 struct pci_channel {
        struct pci_channel      *next;
+       struct pci_bus          *bus;
 
        struct pci_ops          *pci_ops;
-       struct resource         *io_resource;
-       struct resource         *mem_resource;
+
+       struct resource         *resources;
+       unsigned int            nr_resources;
 
        unsigned long           io_offset;
        unsigned long           mem_offset;
 
        unsigned long           reg_base;
-
        unsigned long           io_map_base;
+
+       unsigned int            index;
+       unsigned int            need_domain_info;
+
+       /* Optional error handling */
+       struct timer_list       err_timer, serr_timer;
+       unsigned int            err_irq, serr_irq;
 };
 
-extern void register_pci_controller(struct pci_channel *hose);
+/* arch/sh/drivers/pci/pci.c */
+extern int register_pci_controller(struct pci_channel *hose);
+extern void pcibios_report_status(unsigned int status_mask, int warn);
+
+/* arch/sh/drivers/pci/common.c */
+extern int early_read_config_byte(struct pci_channel *hose, int top_bus,
+                                 int bus, int devfn, int offset, u8 *value);
+extern int early_read_config_word(struct pci_channel *hose, int top_bus,
+                                 int bus, int devfn, int offset, u16 *value);
+extern int early_read_config_dword(struct pci_channel *hose, int top_bus,
+                                  int bus, int devfn, int offset, u32 *value);
+extern int early_write_config_byte(struct pci_channel *hose, int top_bus,
+                                  int bus, int devfn, int offset, u8 value);
+extern int early_write_config_word(struct pci_channel *hose, int top_bus,
+                                  int bus, int devfn, int offset, u16 value);
+extern int early_write_config_dword(struct pci_channel *hose, int top_bus,
+                                   int bus, int devfn, int offset, u32 value);
+extern void pcibios_enable_timers(struct pci_channel *hose);
+extern unsigned int pcibios_handle_status_errors(unsigned long addr,
+                                unsigned int status, struct pci_channel *hose);
+extern int pci_is_66mhz_capable(struct pci_channel *hose,
+                               int top_bus, int current_bus);
 
 extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
 
@@ -99,20 +128,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 }
 #endif
 
-#ifdef CONFIG_SUPERH32
-/*
- * If we're on an SH7751 or SH7780 PCI controller, PCI memory is mapped
- * at the end of the address space in a special non-translatable area.
- */
-#define PCI_MEM_FIXED_START    0xfd000000
-#define PCI_MEM_FIXED_END      (PCI_MEM_FIXED_START + 0x01000000)
-
-#define is_pci_memory_fixed_range(s, e)        \
-       ((s) >= PCI_MEM_FIXED_START && (e) < PCI_MEM_FIXED_END)
-#else
-#define is_pci_memory_fixed_range(s, e)        (0)
-#endif
-
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
 
@@ -122,6 +137,14 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,
 extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
                                    struct pci_bus_region *region);
 
+#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
+
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+       struct pci_channel *hose = bus->sysdata;
+       return hose->need_domain_info;
+}
+
 /* Chances are this interrupt is wired PC-style ...  */
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
index 63ca37bd9a9557a27735fa1dc4c53cdb066d066a..8c00785c60d5b2517dd83c3b75b7ac50b0d10e1d 100644 (file)
@@ -4,8 +4,16 @@
 #include <linux/quicklist.h>
 #include <asm/page.h>
 
-#define QUICK_PGD 0    /* We preserve special mappings over free */
-#define QUICK_PT 1     /* Other page table pages that are zero on free */
+#define QUICK_PT 0     /* Other page table pages that are zero on free */
+
+extern pgd_t *pgd_alloc(struct mm_struct *);
+extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
+
+#if PAGETABLE_LEVELS > 2
+extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
+extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
+extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
+#endif
 
 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
                                       pte_t *pte)
@@ -20,28 +28,9 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
 }
 #define pmd_pgtable(pmd) pmd_page(pmd)
 
-static inline void pgd_ctor(void *x)
-{
-       pgd_t *pgd = x;
-
-       memcpy(pgd + USER_PTRS_PER_PGD,
-              swapper_pg_dir + USER_PTRS_PER_PGD,
-              (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
-}
-
 /*
  * Allocate and free page tables.
  */
-static inline pgd_t *pgd_alloc(struct mm_struct *mm)
-{
-       return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
-}
-
-static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
-{
-       quicklist_free(QUICK_PGD, NULL, pgd);
-}
-
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
                                          unsigned long address)
 {
@@ -81,7 +70,6 @@ do {                                                  \
 
 static inline void check_pgt_cache(void)
 {
-       quicklist_trim(QUICK_PGD, NULL, 25, 16);
        quicklist_trim(QUICK_PT, NULL, 25, 16);
 }
 
diff --git a/arch/sh/include/asm/pgtable-2level.h b/arch/sh/include/asm/pgtable-2level.h
new file mode 100644 (file)
index 0000000..19bd89d
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __ASM_SH_PGTABLE_2LEVEL_H
+#define __ASM_SH_PGTABLE_2LEVEL_H
+
+#include <asm-generic/pgtable-nopmd.h>
+
+/*
+ * traditional two-level paging structure
+ */
+#define PAGETABLE_LEVELS       2
+
+/* PTE bits */
+#define PTE_MAGNITUDE          2       /* 32-bit PTEs */
+
+#define PTE_SHIFT              PAGE_SHIFT
+#define PTE_BITS               (PTE_SHIFT - PTE_MAGNITUDE)
+
+/* PGD bits */
+#define PGDIR_SHIFT            (PTE_SHIFT + PTE_BITS)
+
+#define PTRS_PER_PGD           (PAGE_SIZE / (1 << PTE_MAGNITUDE))
+#define USER_PTRS_PER_PGD      (TASK_SIZE/PGDIR_SIZE)
+
+#endif /* __ASM_SH_PGTABLE_2LEVEL_H */
diff --git a/arch/sh/include/asm/pgtable-3level.h b/arch/sh/include/asm/pgtable-3level.h
new file mode 100644 (file)
index 0000000..249a985
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef __ASM_SH_PGTABLE_3LEVEL_H
+#define __ASM_SH_PGTABLE_3LEVEL_H
+
+#include <asm-generic/pgtable-nopud.h>
+
+/*
+ * Some cores need a 3-level page table layout, for example when using
+ * 64-bit PTEs and 4K pages.
+ */
+#define PAGETABLE_LEVELS       3
+
+#define PTE_MAGNITUDE          3       /* 64-bit PTEs on SH-X2 TLB */
+
+/* PGD bits */
+#define PGDIR_SHIFT            30
+
+#define PTRS_PER_PGD           4
+#define USER_PTRS_PER_PGD      2
+
+/* PMD bits */
+#define PMD_SHIFT      (PAGE_SHIFT + (PAGE_SHIFT - PTE_MAGNITUDE))
+#define PMD_SIZE       (1UL << PMD_SHIFT)
+#define PMD_MASK       (~(PMD_SIZE-1))
+
+#define PTRS_PER_PMD   ((1 << PGDIR_SHIFT) / PMD_SIZE)
+
+#define pmd_ERROR(e) \
+       printk("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))
+
+typedef struct { unsigned long long pmd; } pmd_t;
+#define pmd_val(x)     ((x).pmd)
+#define __pmd(x)       ((pmd_t) { (x) } )
+
+static inline unsigned long pud_page_vaddr(pud_t pud)
+{
+       return pud_val(pud);
+}
+
+#define pmd_index(address)     (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
+static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
+{
+       return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
+}
+
+#define pud_none(x)    (!pud_val(x))
+#define pud_present(x) (pud_val(x))
+#define pud_clear(xp)  do { set_pud(xp, __pud(0)); } while (0)
+#define        pud_bad(x)      (pud_val(x) & ~PAGE_MASK)
+
+/*
+ * (puds are folded into pgds so this doesn't get actually called,
+ * but the define is needed for a generic inline function.)
+ */
+#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
+
+#endif /* __ASM_SH_PGTABLE_3LEVEL_H */
index ba3046e4f06f32f915368952ef085e3d2c82e1fc..aab76528abb979fe6d7b0c871aa03efb86396751 100644 (file)
 #ifndef __ASM_SH_PGTABLE_H
 #define __ASM_SH_PGTABLE_H
 
-#include <asm-generic/pgtable-nopmd.h>
+#ifdef CONFIG_X2TLB
+#include <asm/pgtable-3level.h>
+#else
+#include <asm/pgtable-2level.h>
+#endif
 #include <asm/page.h>
 
 #ifndef __ASSEMBLY__
@@ -51,28 +55,12 @@ static inline unsigned long long neff_sign_extend(unsigned long val)
 #define        NPHYS_SIGN      (1LL << (NPHYS - 1))
 #define        NPHYS_MASK      (-1LL << NPHYS)
 
-/*
- * traditional two-level paging structure
- */
-/* PTE bits */
-#if defined(CONFIG_X2TLB) || defined(CONFIG_SUPERH64)
-# define PTE_MAGNITUDE 3       /* 64-bit PTEs on extended mode SH-X2 TLB */
-#else
-# define PTE_MAGNITUDE 2       /* 32-bit PTEs */
-#endif
-#define PTE_SHIFT      PAGE_SHIFT
-#define PTE_BITS       (PTE_SHIFT - PTE_MAGNITUDE)
-
-/* PGD bits */
-#define PGDIR_SHIFT    (PTE_SHIFT + PTE_BITS)
 #define PGDIR_SIZE     (1UL << PGDIR_SHIFT)
 #define PGDIR_MASK     (~(PGDIR_SIZE-1))
 
 /* Entries per level */
 #define PTRS_PER_PTE   (PAGE_SIZE / (1 << PTE_MAGNITUDE))
-#define PTRS_PER_PGD   (PAGE_SIZE / sizeof(pgd_t))
 
-#define USER_PTRS_PER_PGD      (TASK_SIZE/PGDIR_SIZE)
 #define FIRST_USER_ADDRESS     0
 
 #define PHYS_ADDR_MASK29               0x1fffffff
@@ -153,9 +141,9 @@ typedef pte_t *pte_addr_t;
 #define pte_pfn(x)             ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
 
 /*
- * No page table caches to initialise
+ * Initialise the page table caches
  */
-#define pgtable_cache_init()   do { } while (0)
+extern void pgtable_cache_init(void);
 
 struct vm_area_struct;
 
index 5003ee86f67bd9215ca2d40083455727d2de9784..e172d696e52bbfaa9e21e6017f343cea7e32d3fd 100644 (file)
@@ -71,6 +71,8 @@
 #define _PAGE_EXT_KERN_WRITE   0x1000  /* EPR4-bit: Kernel space writable */
 #define _PAGE_EXT_KERN_READ    0x2000  /* EPR5-bit: Kernel space readable */
 
+#define _PAGE_EXT_WIRED                0x4000  /* software: Wire TLB entry */
+
 /* Wrapper for extended mode pgprot twiddling */
 #define _PAGE_EXT(x)           ((unsigned long long)(x) << 32)
 
@@ -141,12 +143,14 @@ static inline unsigned long copy_ptea_attributes(unsigned long x)
 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
 #  define _PAGE_SZHUGE (_PAGE_EXT_ESZ2 | _PAGE_EXT_ESZ3)
 # endif
+# define _PAGE_WIRED   (_PAGE_EXT(_PAGE_EXT_WIRED))
 #else
 # if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
 #  define _PAGE_SZHUGE (_PAGE_SZ1)
 # elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
 #  define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
 # endif
+# define _PAGE_WIRED   (0)
 #endif
 
 /*
index 17cdbecc3adc2c756c604ae66e84ba6e28b5873e..0ee46776dad6d9c7032a45856710e357d9fb90d1 100644 (file)
@@ -43,11 +43,6 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
 }
 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
-static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
-{
-       pmd_val(*pmdp) = (unsigned long) ptep;
-}
-
 /*
  * PGD defines. Top level.
  */
@@ -128,8 +123,21 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
 #define _PAGE_DIRTY    0x400  /* software: page accessed in write */
 #define _PAGE_ACCESSED 0x800  /* software: page referenced */
 
+/* Wrapper for extended mode pgprot twiddling */
+#define _PAGE_EXT(x)           ((unsigned long long)(x) << 32)
+
+/*
+ * We can use the sign-extended bits in the PTEL to get 32 bits of
+ * software flags. This works for now because no implementations uses
+ * anything above the PPN field.
+ */
+#define _PAGE_WIRED    _PAGE_EXT(0x001) /* software: wire the tlb entry */
+
+#define _PAGE_CLEAR_FLAGS      (_PAGE_PRESENT | _PAGE_FILE | _PAGE_SHARED | \
+                                _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WIRED)
+
 /* Mask which drops software flags */
-#define _PAGE_FLAGS_HARDWARE_MASK      0xfffffffffffff3dbLL
+#define _PAGE_FLAGS_HARDWARE_MASK      (NEFF_MASK & ~(_PAGE_CLEAR_FLAGS))
 
 /*
  * HugeTLB support
@@ -202,12 +210,6 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
 #define pgprot_noncached(x) __pgprot(((x).pgprot & ~(_PAGE_CACHABLE)) | _PAGE_DEVICE)
 #define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
 
-/*
- * Handling allocation failures during page table setup.
- */
-extern void __handle_bad_pmd_kernel(pmd_t * pmd);
-#define __handle_bad_pmd(x)    __handle_bad_pmd_kernel(x)
-
 /*
  * PTE level access routines.
  *
index 017e0c1807b263fe864a04d775e0eef502c59985..9605e062840fc6d2323e4fabb09cb604b444e384 100644 (file)
@@ -98,13 +98,34 @@ extern struct sh_cpuinfo cpu_data[];
 
 /* Forward decl */
 struct seq_operations;
+struct task_struct;
 
 extern struct pt_regs fake_swapper_regs;
 
+/* arch/sh/kernel/process.c */
+extern unsigned int xstate_size;
+extern void free_thread_xstate(struct task_struct *);
+extern struct kmem_cache *task_xstate_cachep;
+
+/* arch/sh/mm/alignment.c */
+extern int get_unalign_ctl(struct task_struct *, unsigned long addr);
+extern int set_unalign_ctl(struct task_struct *, unsigned int val);
+
+#define GET_UNALIGN_CTL(tsk, addr)     get_unalign_ctl((tsk), (addr))
+#define SET_UNALIGN_CTL(tsk, val)      set_unalign_ctl((tsk), (val))
+
+/* arch/sh/mm/init.c */
+extern unsigned int mem_init_done;
+
 /* arch/sh/kernel/setup.c */
 const char *get_cpu_subtype(struct sh_cpuinfo *c);
 extern const struct seq_operations cpuinfo_op;
 
+/* thread_struct flags */
+#define SH_THREAD_UAC_NOPRINT  (1 << 0)
+#define SH_THREAD_UAC_SIGBUS   (1 << 1)
+#define SH_THREAD_UAC_MASK     (SH_THREAD_UAC_NOPRINT | SH_THREAD_UAC_SIGBUS)
+
 /* processor boot mode configuration */
 #define MODE_PIN0 (1 << 0)
 #define MODE_PIN1 (1 << 1)
index 1f3d6fab660c9bf1ecebb76e3bd3a60f8445dbe4..572b4eb094932ca80e9024728a83eedb63fbf9ea 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/page.h>
 #include <asm/types.h>
 #include <asm/ptrace.h>
+#include <asm/hw_breakpoint.h>
 
 /*
  * Default implementation of macro that returns current
@@ -90,9 +91,9 @@ struct sh_fpu_soft_struct {
        unsigned long entry_pc;
 };
 
-union sh_fpu_union {
-       struct sh_fpu_hard_struct hard;
-       struct sh_fpu_soft_struct soft;
+union thread_xstate {
+       struct sh_fpu_hard_struct hardfpu;
+       struct sh_fpu_soft_struct softfpu;
 };
 
 struct thread_struct {
@@ -100,38 +101,30 @@ struct thread_struct {
        unsigned long sp;
        unsigned long pc;
 
-       /* Hardware debugging registers */
-       unsigned long ubc_pc;
+       /* Various thread flags, see SH_THREAD_xxx */
+       unsigned long flags;
 
-       /* floating point info */
-       union sh_fpu_union fpu;
+       /* Save middle states of ptrace breakpoints */
+       struct perf_event *ptrace_bps[HBP_NUM];
 
 #ifdef CONFIG_SH_DSP
        /* Dsp status information */
        struct sh_dsp_struct dsp_status;
 #endif
-};
 
-/* Count of active tasks with UBC settings */
-extern int ubc_usercnt;
+       /* Extended processor state */
+       union thread_xstate *xstate;
+};
 
 #define INIT_THREAD  {                                         \
        .sp = sizeof(init_stack) + (long) &init_stack,          \
+       .flags = 0,                                             \
 }
 
-/*
- * Do necessary setup to start up a newly executed thread.
- */
-#define start_thread(_regs, new_pc, new_sp)     \
-       set_fs(USER_DS);                         \
-       _regs->pr = 0;                           \
-       _regs->sr = SR_FD;      /* User mode. */ \
-       _regs->pc = new_pc;                      \
-       _regs->regs[15] = new_sp
-
 /* Forward declaration, a strange C thing */
 struct task_struct;
-struct mm_struct;
+
+extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp);
 
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
index 5727d31b0ccfd89f6e80c5f610b36bd5f48c0dc5..621bc4618c6b2ed168dfb4c90d911bc2c6d423f7 100644 (file)
@@ -87,26 +87,31 @@ struct sh_fpu_hard_struct {
        /* long status; * software status information */
 };
 
-#if 0
 /* Dummy fpu emulator  */
 struct sh_fpu_soft_struct {
-       unsigned long long fp_regs[32];
+       unsigned long fp_regs[64];
        unsigned int fpscr;
        unsigned char lookahead;
        unsigned long entry_pc;
 };
-#endif
 
-union sh_fpu_union {
-       struct sh_fpu_hard_struct hard;
-       /* 'hard' itself only produces 32 bit alignment, yet we need
-          to access it using 64 bit load/store as well. */
+union thread_xstate {
+       struct sh_fpu_hard_struct hardfpu;
+       struct sh_fpu_soft_struct softfpu;
+       /*
+        * The structure definitions only produce 32 bit alignment, yet we need
+        * to access them using 64 bit load/store as well.
+        */
        unsigned long long alignment_dummy;
 };
 
 struct thread_struct {
        unsigned long sp;
        unsigned long pc;
+
+       /* Various thread flags, see SH_THREAD_xxx */
+       unsigned long flags;
+
        /* This stores the address of the pt_regs built during a context
           switch, or of the register save area built for a kernel mode
           exception.  It is used for backtracing the stack of a sleeping task
@@ -122,7 +127,7 @@ struct thread_struct {
        /* Hardware debugging registers may come here */
 
        /* floating point info */
-       union sh_fpu_union fpu;
+       union thread_xstate *xstate;
 };
 
 #define INIT_MMAP \
@@ -137,7 +142,7 @@ struct thread_struct {
        .trap_no        = 0,                    \
        .error_code     = 0,                    \
        .address        = 0,                    \
-       .fpu            = { { { 0, } }, }       \
+       .flags          = 0,                    \
 }
 
 /*
index 1dc12cb44a2d7acfa6b918c0f14e5487ed8785ff..e11b14ea2c4399af7764cc8f19d4b819d517a890 100644 (file)
@@ -102,13 +102,15 @@ struct pt_dspregs {
 #define        PTRACE_GETDSPREGS       55      /* DSP registers */
 #define        PTRACE_SETDSPREGS       56
 
-#define PT_TEXT_END_ADDR       240
-#define PT_TEXT_ADDR           244     /* &(struct user)->start_code */
-#define PT_DATA_ADDR           248     /* &(struct user)->start_data */
+#define PT_TEXT_END_ADDR       240
+#define PT_TEXT_ADDR           244     /* &(struct user)->start_code */
+#define PT_DATA_ADDR           248     /* &(struct user)->start_data */
 #define PT_TEXT_LEN            252
 
 #ifdef __KERNEL__
 #include <asm/addrspace.h>
+#include <asm/page.h>
+#include <asm/system.h>
 
 #define user_mode(regs)                        (((regs)->sr & 0x40000000)==0)
 #define instruction_pointer(regs)      ((unsigned long)(regs)->pc)
@@ -124,6 +126,12 @@ struct task_struct;
 extern void user_enable_single_step(struct task_struct *);
 extern void user_disable_single_step(struct task_struct *);
 
+struct perf_event;
+struct perf_sample_data;
+
+extern void ptrace_triggered(struct perf_event *bp, int nmi,
+                     struct perf_sample_data *data, struct pt_regs *regs);
+
 #define task_pt_regs(task) \
        ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1)
 
@@ -131,10 +139,8 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
 {
        unsigned long pc = instruction_pointer(regs);
 
-#ifdef P2SEG
-       if (pc >= P2SEG && pc < P3SEG)
-               pc -= 0x20000000;
-#endif
+       if (virt_addr_uncached(pc))
+               return CAC_ADDR(pc);
 
        return pc;
 }
diff --git a/arch/sh/include/asm/reboot.h b/arch/sh/include/asm/reboot.h
new file mode 100644 (file)
index 0000000..b3da0c6
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __ASM_SH_REBOOT_H
+#define __ASM_SH_REBOOT_H
+
+#include <linux/kdebug.h>
+
+struct pt_regs;
+
+struct machine_ops {
+       void (*restart)(char *cmd);
+       void (*halt)(void);
+       void (*power_off)(void);
+       void (*shutdown)(void);
+       void (*crash_shutdown)(struct pt_regs *);
+};
+
+extern struct machine_ops machine_ops;
+
+/* arch/sh/kernel/machine_kexec.c */
+void native_machine_crash_shutdown(struct pt_regs *regs);
+
+#endif /* __ASM_SH_REBOOT_H */
index ce3743599b2794289a2a38d6d44bdf831d6b4276..4758325bb24a8fd6275a74eec370c3978f7d4880 100644 (file)
@@ -18,7 +18,6 @@
 /* ... */
 #define COMMAND_LINE ((char *) (PARAM+0x100))
 
-int setup_early_printk(char *);
 void sh_mv_setup(void);
 
 #endif /* __KERNEL__ */
index d9c96d7cf6c77c77ddeb744a21ea2d7b822c25ca..95714c28422b14eca127557896c2179fa36dbe23 100644 (file)
@@ -1,18 +1,27 @@
 #ifndef __ASM_SH_BIOS_H
 #define __ASM_SH_BIOS_H
 
+#ifdef CONFIG_SH_STANDARD_BIOS
+
 /*
  * Copyright (C) 2000 Greg Banks, Mitch Davis
  * C API to interface to the standard LinuxSH BIOS
  * usually from within the early stages of kernel boot.
  */
-
-
 extern void sh_bios_console_write(const char *buf, unsigned int len);
-extern void sh_bios_char_out(char ch);
 extern void sh_bios_gdb_detach(void);
 
 extern void sh_bios_get_node_addr(unsigned char *node_addr);
 extern void sh_bios_shutdown(unsigned int how);
 
+extern void sh_bios_vbr_init(void);
+extern void sh_bios_vbr_reload(void);
+
+#else
+
+static inline void sh_bios_vbr_init(void) { }
+static inline void sh_bios_vbr_reload(void) { }
+
+#endif /* CONFIG_SH_STANDARD_BIOS */
+
 #endif /* __ASM_SH_BIOS_H */
index fe9c2a1ad047279baf8506dc0fa1548ee8d61851..64eb41a063e8162c7bde64bdcf0cd8ce3e4c45b1 100644 (file)
@@ -92,5 +92,6 @@ extern unsigned long sh_mobile_sleep_supported;
 #define SUSP_SH_USTANDBY       (1 << 3) /* SH-Mobile U-standby mode */
 #define SUSP_SH_SF             (1 << 4) /* Enable self-refresh */
 #define SUSP_SH_MMU            (1 << 5) /* Save/restore MMU and cache */
+#define SUSP_SH_REGS           (1 << 6) /* Save/restore registers */
 
 #endif /* _ASM_SH_SUSPEND_H */
index 6a381429ee9d4cbddcb9639779dba8cac52edd3c..aa7777bdc37036fdc3d2938c6c6f8115784f16bf 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_SH_SYSCALL_H
 #define __ASM_SH_SYSCALL_H
 
+extern const unsigned long sys_call_table[];
+
 #ifdef CONFIG_SUPERH32
 # include "syscall_32.h"
 #else
index c15415b4b169fe9b98b87aa6acb85534227207cd..0bd7a17d5e1a0162a7968a8c11ee18d99b493a9d 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <asm/types.h>
-#include <asm/ptrace.h>
 
 #define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
 
@@ -32,7 +31,7 @@
 #define mb()           __asm__ __volatile__ ("synco": : :"memory")
 #define rmb()          mb()
 #define wmb()          __asm__ __volatile__ ("synco": : :"memory")
-#define ctrl_barrier() __icbi(0xa8000000)
+#define ctrl_barrier() __icbi(PAGE_OFFSET)
 #define read_barrier_depends() do { } while(0)
 #else
 #define mb()           __asm__ __volatile__ ("": : :"memory")
@@ -114,6 +113,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
                                    (unsigned long)_n_, sizeof(*(ptr))); \
   })
 
+struct pt_regs;
+
 extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
 void free_initmem(void);
 void free_initrd_mem(unsigned long start, unsigned long end);
@@ -137,14 +138,14 @@ extern unsigned int instruction_size(unsigned int insn);
 #endif
 
 extern unsigned long cached_to_uncached;
+extern unsigned long uncached_size;
 
 extern struct dentry *sh_debugfs_root;
 
 void per_cpu_trap_init(void);
 void default_idle(void);
 void cpu_idle_wait(void);
-
-asmlinkage void break_point_trap(void);
+void stop_this_cpu(void *);
 
 #ifdef CONFIG_SUPERH32
 #define BUILD_TRAP_HANDLER(name)                                       \
index 06814f5b59c7b95f81c9e6cab7fbea7b43f10364..51296b36770e3b1be77acefedd2476f2fd8206f3 100644 (file)
@@ -2,6 +2,7 @@
 #define __ASM_SH_SYSTEM_32_H
 
 #include <linux/types.h>
+#include <asm/mmu.h>
 
 #ifdef CONFIG_SH_DSP
 
@@ -144,9 +145,6 @@ do {                                                                \
                __restore_dsp(prev);                            \
 } while (0)
 
-#define __uses_jump_to_uncached \
-       noinline __attribute__ ((__section__ (".uncached.text")))
-
 /*
  * Jump to uncached area.
  * When handling TLB or caches, we need to do it from an uncached area.
@@ -216,6 +214,17 @@ static inline reg_size_t register_align(void *val)
 int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
                            struct mem_access *ma, int);
 
+static inline void trigger_address_error(void)
+{
+       if (__in_29bit_mode())
+               __asm__ __volatile__ (
+                       "ldc %0, sr\n\t"
+                       "mov.l @%1, %0"
+                       :
+                       : "r" (0x10000000), "r" (0x80000001)
+               );
+}
+
 asmlinkage void do_address_error(struct pt_regs *regs,
                                 unsigned long writeaccess,
                                 unsigned long address);
index ab1dd917ea87daa7ea7b82a061c8eb03f660c84a..36338646dfc81832227e78d39ccf6cdc71df4963 100644 (file)
@@ -18,6 +18,7 @@
 /*
  *     switch_to() should switch tasks to task nr n, first
  */
+struct thread_struct;
 struct task_struct *sh64_switch_to(struct task_struct *prev,
                                   struct thread_struct *prev_thread,
                                   struct task_struct *next,
@@ -33,8 +34,6 @@ do {                                                          \
                              &next->thread);                   \
 } while (0)
 
-#define __uses_jump_to_uncached
-
 #define jump_to_uncached()     do { } while (0)
 #define back_to_cached()       do { } while (0)
 
@@ -48,6 +47,13 @@ static inline reg_size_t register_align(void *val)
        return (unsigned long long)(signed long long)(signed long)val;
 }
 
+extern void phys_stext(void);
+
+static inline void trigger_address_error(void)
+{
+       phys_stext();
+}
+
 #define SR_BL_LL       0x0000000010000000LL
 
 static inline void set_bl_bit(void)
index 1f3d927e22659c1a99564958a584db4aafe042c2..55a36fef6875d2cb3bb985143d3ea07781887e76 100644 (file)
@@ -93,14 +93,16 @@ static inline struct thread_info *current_thread_info(void)
 
 #define THREAD_SIZE_ORDER      (THREAD_SHIFT - PAGE_SHIFT)
 
-#else /* THREAD_SHIFT < PAGE_SHIFT */
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+#endif
 
 extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
 extern void free_thread_info(struct thread_info *ti);
+extern void arch_task_cache_init(void);
+#define arch_task_cache_init arch_task_cache_init
+extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern void init_thread_xstate(void);
 
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
+#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
 
 #endif /* __ASSEMBLY__ */
 
index da8fe7ab87283904adac91d7fae1a7bea65af497..75abb38dffd5d479e0b848615b7df115b72abad5 100644 (file)
@@ -11,6 +11,7 @@
 #ifdef CONFIG_MMU
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
+#include <asm/mmu_context.h>
 
 /*
  * TLB handling.  This allows us to remove pages from the page
@@ -97,6 +98,22 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
 
 #define tlb_migrate_finish(mm)         do { } while (0)
 
+#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SUPERH64)
+extern void tlb_wire_entry(struct vm_area_struct *, unsigned long, pte_t);
+extern void tlb_unwire_entry(void);
+#else
+static inline void tlb_wire_entry(struct vm_area_struct *vma ,
+                                 unsigned long addr, pte_t pte)
+{
+       BUG();
+}
+
+static inline void tlb_unwire_entry(void)
+{
+       BUG();
+}
+#endif
+
 #else /* CONFIG_MMU */
 
 #define tlb_start_vma(tlb, vma)                                do { } while (0)
diff --git a/arch/sh/include/asm/ubc.h b/arch/sh/include/asm/ubc.h
deleted file mode 100644 (file)
index 9bf9616..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * include/asm-sh/ubc.h
- *
- * Copyright (C) 1999 Niibe Yutaka
- * Copyright (C) 2002, 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#ifndef __ASM_SH_UBC_H
-#define __ASM_SH_UBC_H
-#ifdef __KERNEL__
-
-#include <cpu/ubc.h>
-
-/* User Break Controller */
-#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
-#define UBC_TYPE_SH7729        (current_cpu_data.type == CPU_SH7729)
-#else
-#define UBC_TYPE_SH7729        0
-#endif
-
-#define BAMR_ASID              (1 << 2)
-#define BAMR_NONE              0
-#define BAMR_10                        0x1
-#define BAMR_12                        0x2
-#define BAMR_ALL               0x3
-#define BAMR_16                        0x8
-#define BAMR_20                        0x9
-
-#define BBR_INST               (1 << 4)
-#define BBR_DATA               (2 << 4)
-#define BBR_READ               (1 << 2)
-#define BBR_WRITE              (2 << 2)
-#define BBR_BYTE               0x1
-#define BBR_HALF               0x2
-#define BBR_LONG               0x3
-#define BBR_QUAD               (1 << 6)        /* SH7750 */
-#define BBR_CPU                        (1 << 6)        /* SH7709A,SH7729 */
-#define BBR_DMA                        (2 << 6)        /* SH7709A,SH7729 */
-
-#define BRCR_CMFA              (1 << 15)
-#define BRCR_CMFB              (1 << 14)
-
-#if defined CONFIG_CPU_SH2A
-#define BRCR_CMFCA             (1 << 15)
-#define BRCR_CMFCB             (1 << 14)
-#define BRCR_CMFDA             (1 << 13)
-#define BRCR_CMFDB             (1 << 12)
-#define BRCR_PCBB              (1 << 6)        /* 1: after execution */
-#define BRCR_PCBA              (1 << 5)        /* 1: after execution */
-#define BRCR_PCTE              0
-#else
-#define BRCR_PCTE              (1 << 11)
-#define BRCR_PCBA              (1 << 10)       /* 1: after execution */
-#define BRCR_DBEB              (1 << 7)
-#define BRCR_PCBB              (1 << 6)
-#define BRCR_SEQ               (1 << 3)
-#define BRCR_UBDE              (1 << 0)
-#endif
-
-#endif /* __KERNEL__ */
-#endif /* __ASM_SH_UBC_H */
diff --git a/arch/sh/include/asm/uncached.h b/arch/sh/include/asm/uncached.h
new file mode 100644 (file)
index 0000000..e3419f9
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __ASM_SH_UNCACHED_H
+#define __ASM_SH_UNCACHED_H
+
+#include <linux/bug.h>
+
+#ifdef CONFIG_UNCACHED_MAPPING
+extern unsigned long uncached_start, uncached_end;
+
+extern int virt_addr_uncached(unsigned long kaddr);
+extern void uncached_init(void);
+extern void uncached_resize(unsigned long size);
+#else
+#define virt_addr_uncached(kaddr)      (0)
+#define uncached_init()                        do { } while (0)
+#define uncached_resize(size)          BUG()
+#endif
+
+#endif /* __ASM_SH_UNCACHED_H */
index f18c4f9baf27920d4ef71621303d4c9a63a62448..365744b05269c2f1e1e9c3456308d7d5cd6e6605 100644 (file)
 #define __NR_pwritev           334
 #define __NR_rt_tgsigqueueinfo 335
 #define __NR_perf_event_open   336
-#define __NR_recvmmsg          337
 
-#define NR_syscalls 338
+#define NR_syscalls 337
 
 #ifdef __KERNEL__
 
+#define __IGNORE_recvmmsg
+
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
index 3e7645d111307e5d12db6e7172961b47f486e704..25de158aac3a84baa5e0c64033291b49b3b574f9 100644 (file)
 #define __NR_rt_tgsigqueueinfo 363
 #define __NR_perf_event_open   364
 #define __NR_recvmmsg          365
+#define __NR_accept4           366
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 366
+#define NR_syscalls 367
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
index 244ec4ad9a79242ebb14ea57c06554555381aadc..d58ad493b3a6767000f8fd9c430c31f9a6131420 100644 (file)
 #define DWARF_EH_FRAME
 #endif
 
+#ifdef CONFIG_SUPERH64
+#define EXTRA_TEXT             \
+       *(.text64)              \
+       *(.text..SHmedia32)
+#else
+#define EXTRA_TEXT
+#endif
+
 #endif /* __ASM_SH_VMLINUX_LDS_H */
index 19dfff5c85115ad97dbfc3794389cd85febb7ca0..85a7aca7fb8f37dd42c13f8b658a14edfd9f89ca 100644 (file)
@@ -70,7 +70,7 @@
  */
 static inline __u32 sh_wdt_read_cnt(void)
 {
-       return ctrl_inl(WTCNT_R);
+       return __raw_readl(WTCNT_R);
 }
 
 /**
@@ -82,7 +82,7 @@ static inline __u32 sh_wdt_read_cnt(void)
  */
 static inline void sh_wdt_write_cnt(__u32 val)
 {
-       ctrl_outl((WTCNT_HIGH << 24) | (__u32)val, WTCNT);
+       __raw_writel((WTCNT_HIGH << 24) | (__u32)val, WTCNT);
 }
 
 /**
@@ -94,7 +94,7 @@ static inline void sh_wdt_write_cnt(__u32 val)
  */
 static inline void sh_wdt_write_bst(__u32 val)
 {
-       ctrl_outl((WTBST_HIGH << 24) | (__u32)val, WTBST);
+       __raw_writel((WTBST_HIGH << 24) | (__u32)val, WTBST);
 }
 /**
  *     sh_wdt_read_csr - Read from Control/Status Register
@@ -103,7 +103,7 @@ static inline void sh_wdt_write_bst(__u32 val)
  */
 static inline __u32 sh_wdt_read_csr(void)
 {
-       return ctrl_inl(WTCSR_R);
+       return __raw_readl(WTCSR_R);
 }
 
 /**
@@ -115,7 +115,7 @@ static inline __u32 sh_wdt_read_csr(void)
  */
 static inline void sh_wdt_write_csr(__u32 val)
 {
-       ctrl_outl((WTCSR_HIGH << 24) | (__u32)val, WTCSR);
+       __raw_writel((WTCSR_HIGH << 24) | (__u32)val, WTCSR);
 }
 #else
 /**
@@ -124,7 +124,7 @@ static inline void sh_wdt_write_csr(__u32 val)
  */
 static inline __u8 sh_wdt_read_cnt(void)
 {
-       return ctrl_inb(WTCNT_R);
+       return __raw_readb(WTCNT_R);
 }
 
 /**
@@ -136,7 +136,7 @@ static inline __u8 sh_wdt_read_cnt(void)
  */
 static inline void sh_wdt_write_cnt(__u8 val)
 {
-       ctrl_outw((WTCNT_HIGH << 8) | (__u16)val, WTCNT);
+       __raw_writew((WTCNT_HIGH << 8) | (__u16)val, WTCNT);
 }
 
 /**
@@ -146,7 +146,7 @@ static inline void sh_wdt_write_cnt(__u8 val)
  */
 static inline __u8 sh_wdt_read_csr(void)
 {
-       return ctrl_inb(WTCSR_R);
+       return __raw_readb(WTCSR_R);
 }
 
 /**
@@ -158,7 +158,7 @@ static inline __u8 sh_wdt_read_csr(void)
  */
 static inline void sh_wdt_write_csr(__u8 val)
 {
-       ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
+       __raw_writew((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
 }
 #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */
 #endif /* __KERNEL__ */
diff --git a/arch/sh/include/cpu-sh2/cpu/ubc.h b/arch/sh/include/cpu-sh2/cpu/ubc.h
deleted file mode 100644 (file)
index ba0e87f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * include/asm-sh/cpu-sh2/ubc.h
- *
- * Copyright (C) 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#ifndef __ASM_CPU_SH2_UBC_H
-#define __ASM_CPU_SH2_UBC_H
-
-#define UBC_BARA                0xffffff40
-#define UBC_BAMRA               0xffffff44
-#define UBC_BBRA                0xffffff48
-#define UBC_BARB                0xffffff60
-#define UBC_BAMRB               0xffffff64
-#define UBC_BBRB                0xffffff68
-#define UBC_BDRB                0xffffff70
-#define UBC_BDMRB               0xffffff74
-#define UBC_BRCR                0xffffff78
-
-/*
- * We don't have any ASID changes to make in the UBC on the SH-2.
- *
- * Make these purposely invalid to track misuse.
- */
-#define UBC_BASRA              0x00000000
-#define UBC_BASRB              0x00000000
-
-#endif /* __ASM_CPU_SH2_UBC_H */
-
index 393161c9c6d0550e262cbecda9e27903cbdd6909..1eab8aa63a6d611fad7afb2e9bc0a584ac4c7875 100644 (file)
@@ -44,7 +44,7 @@ static inline __u8 sh_wdt_read_rstcsr(void)
        /*
         * Same read/write brain-damage as for WTCNT here..
         */
-       return ctrl_inb(RSTCSR_R);
+       return __raw_readb(RSTCSR_R);
 }
 
 /**
@@ -62,7 +62,7 @@ static inline void sh_wdt_write_rstcsr(__u8 val)
         * we can't presently touch the WOVF bit, since the upper byte
         * has to be swapped for this. So just leave it alone..
         */
-       ctrl_outw((WTCNT_HIGH << 8) | (__u16)val, RSTCSR);
+       __raw_writeb((WTCNT_HIGH << 8) | (__u16)val, RSTCSR);
 }
 
 #endif /* __ASM_CPU_SH2_WATCHDOG_H */
index 05fda8316ebcaf577155965f1d9fc55234c880e4..98f1d15f0ab5e3a0a0b988bd634d3ab121ab4694 100644 (file)
 static __inline__ void sh_dac_enable(int channel)
 {
        unsigned char v;
-       v = ctrl_inb(DACR);
+       v = __raw_readb(DACR);
        if(channel) v |= DACR_DAOE1;
        else v |= DACR_DAOE0;
-       ctrl_outb(v,DACR);
+       __raw_writeb(v,DACR);
 }
 
 static __inline__ void sh_dac_disable(int channel)
 {
        unsigned char v;
-       v = ctrl_inb(DACR);
+       v = __raw_readb(DACR);
        if(channel) v &= ~DACR_DAOE1;
        else v &= ~DACR_DAOE0;
-       ctrl_outb(v,DACR);
+       __raw_writeb(v,DACR);
 }
 
 static __inline__ void sh_dac_output(u8 value, int channel)
 {
-       if(channel) ctrl_outb(value,DADR1);
-       else ctrl_outb(value,DADR0);
+       if(channel) __raw_writeb(value,DADR1);
+       else __raw_writeb(value,DADR0);
 }
 
 #endif /* __ASM_CPU_SH3_DAC_H */
index 0ea15f3f236346a625a65d10e02b0eac4ef49880..207811a7a65047c494667cf32fa434344d4cfa8f 100644 (file)
 #define TS_32          0x00000010
 #define TS_128         0x00000018
 
-#define CHCR_TS_MASK   0x18
-#define CHCR_TS_SHIFT  3
+#define CHCR_TS_LOW_MASK       0x18
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
 
 #define DMAOR_INIT     DMAOR_DME
 
@@ -36,11 +38,13 @@ enum {
        XMIT_SZ_128BIT,
 };
 
-static unsigned int ts_shift[] __maybe_unused = {
-       [XMIT_SZ_8BIT]          = 0,
-       [XMIT_SZ_16BIT]         = 1,
-       [XMIT_SZ_32BIT]         = 2,
-       [XMIT_SZ_128BIT]        = 4,
-};
+#define TS_SHIFT {                     \
+       [XMIT_SZ_8BIT]          = 0,    \
+       [XMIT_SZ_16BIT]         = 1,    \
+       [XMIT_SZ_32BIT]         = 2,    \
+       [XMIT_SZ_128BIT]        = 4,    \
+}
+
+#define TS_INDEX2VAL(i)        (((i) & 3) << CHCR_TS_LOW_SHIFT)
 
 #endif /* __ASM_CPU_SH3_DMA_H */
diff --git a/arch/sh/include/cpu-sh3/cpu/ubc.h b/arch/sh/include/cpu-sh3/cpu/ubc.h
deleted file mode 100644 (file)
index 4e6381d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * include/asm-sh/cpu-sh3/ubc.h
- *
- * Copyright (C) 1999 Niibe Yutaka
- * Copyright (C) 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#ifndef __ASM_CPU_SH3_UBC_H
-#define __ASM_CPU_SH3_UBC_H
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7710) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7721)
-#define UBC_BARA               0xa4ffffb0
-#define UBC_BAMRA              0xa4ffffb4
-#define UBC_BBRA               0xa4ffffb8
-#define UBC_BASRA              0xffffffe4
-#define UBC_BARB               0xa4ffffa0
-#define UBC_BAMRB              0xa4ffffa4
-#define UBC_BBRB               0xa4ffffa8
-#define UBC_BASRB              0xffffffe8
-#define UBC_BDRB               0xa4ffff90
-#define UBC_BDMRB              0xa4ffff94
-#define UBC_BRCR               0xa4ffff98
-#else
-#define UBC_BARA                0xffffffb0
-#define UBC_BAMRA               0xffffffb4
-#define UBC_BBRA                0xffffffb8
-#define UBC_BASRA               0xffffffe4
-#define UBC_BARB                0xffffffa0
-#define UBC_BAMRB               0xffffffa4
-#define UBC_BBRB                0xffffffa8
-#define UBC_BASRB               0xffffffe8
-#define UBC_BDRB                0xffffff90
-#define UBC_BDMRB               0xffffff94
-#define UBC_BRCR                0xffffff98
-#endif
-
-#endif /* __ASM_CPU_SH3_UBC_H */
index a3fa733c1c7d7865f3e51c95ab6ff1bb6b8c8238..d51da25da72c401267a05e01ed70bb86d0b03d82 100644 (file)
 #define P4SEG_TLB_DATA 0xf7000000
 #define P4SEG_REG_BASE 0xff000000
 
+#define PA_AREA0       0x00000000
+#define PA_AREA1       0x04000000
+#define PA_AREA2       0x08000000
+#define PA_AREA3       0x0c000000
+#define PA_AREA4       0x10000000
+#define PA_AREA5       0x14000000
+#define PA_AREA6       0x18000000
+#define PA_AREA7       0x1c000000
+
 #define PA_AREA5_IO    0xb4000000      /* Area 5 IO Memory */
 #define PA_AREA6_IO    0xb8000000      /* Area 6 IO Memory */
 
index c4ed660c14cfaf2dec064d62df164f616e35ed9c..e734ea47d8a09b57990f31add924a99cca373697 100644 (file)
@@ -2,22 +2,38 @@
 #define __ASM_SH_CPU_SH4_DMA_SH7780_H
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7343) || \
-       defined(CONFIG_CPU_SUBTYPE_SH7722) || \
        defined(CONFIG_CPU_SUBTYPE_SH7730)
 #define DMTE0_IRQ      48
 #define DMTE4_IRQ      76
 #define DMAE0_IRQ      78      /* DMA Error IRQ*/
 #define SH_DMAC_BASE0  0xFE008020
-#define SH_DMARS_BASE  0xFE009000
+#define SH_DMARS_BASE0 0xFE009000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
+#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+#define DMTE0_IRQ      48
+#define DMTE4_IRQ      76
+#define DMAE0_IRQ      78      /* DMA Error IRQ*/
+#define SH_DMAC_BASE0  0xFE008020
+#define SH_DMARS_BASE0 0xFE009000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0x00300000
+#define CHCR_TS_HIGH_SHIFT     20
 #elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
        defined(CONFIG_CPU_SUBTYPE_SH7764)
 #define DMTE0_IRQ      34
 #define DMTE4_IRQ      44
 #define DMAE0_IRQ      38
 #define SH_DMAC_BASE0  0xFF608020
-#define SH_DMARS_BASE  0xFF609000
-#elif defined(CONFIG_CPU_SUBTYPE_SH7723) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7724)
+#define SH_DMARS_BASE0 0xFF609000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
+#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
 #define DMTE0_IRQ      48      /* DMAC0A*/
 #define DMTE4_IRQ      76      /* DMAC0B */
 #define DMTE6_IRQ      40
 #define DMAE1_IRQ      74      /* DMA Error IRQ*/
 #define SH_DMAC_BASE0  0xFE008020
 #define SH_DMAC_BASE1  0xFDC08020
-#define SH_DMARS_BASE  0xFDC09000
+#define SH_DMARS_BASE0 0xFDC09000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
+#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
+#define DMTE0_IRQ      48      /* DMAC0A*/
+#define DMTE4_IRQ      76      /* DMAC0B */
+#define DMTE6_IRQ      40
+#define DMTE8_IRQ      42      /* DMAC1A */
+#define DMTE9_IRQ      43
+#define DMTE10_IRQ     72      /* DMAC1B */
+#define DMTE11_IRQ     73
+#define DMAE0_IRQ      78      /* DMA Error IRQ*/
+#define DMAE1_IRQ      74      /* DMA Error IRQ*/
+#define SH_DMAC_BASE0  0xFE008020
+#define SH_DMAC_BASE1  0xFDC08020
+#define SH_DMARS_BASE0 0xFE009000
+#define SH_DMARS_BASE1 0xFDC09000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0x00600000
+#define CHCR_TS_HIGH_SHIFT     21
 #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
 #define DMTE0_IRQ      34
 #define DMTE4_IRQ      44
 #define DMAE0_IRQ      38      /* DMA Error IRQ */
 #define SH_DMAC_BASE0  0xFC808020
 #define SH_DMAC_BASE1  0xFC818020
-#define SH_DMARS_BASE  0xFC809000
+#define SH_DMARS_BASE0 0xFC809000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
 #else /* SH7785 */
 #define DMTE0_IRQ      33
 #define DMTE4_IRQ      37
 #define DMAE1_IRQ      58      /* DMA Error IRQ1 */
 #define SH_DMAC_BASE0  0xFC808020
 #define SH_DMAC_BASE1  0xFCC08020
-#define SH_DMARS_BASE  0xFC809000
+#define SH_DMARS_BASE0 0xFC809000
+#define CHCR_TS_LOW_MASK       0x00000018
+#define CHCR_TS_LOW_SHIFT      3
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
 #endif
 
-#define REQ_HE 0x000000C0
-#define REQ_H  0x00000080
-#define REQ_LE 0x00000040
-#define TM_BURST 0x0000020
-#define TS_8   0x00000000
-#define TS_16  0x00000008
-#define TS_32  0x00000010
-#define TS_16BLK       0x00000018
-#define TS_32BLK       0x00100000
+#define REQ_HE         0x000000C0
+#define REQ_H          0x00000080
+#define REQ_LE         0x00000040
+#define TM_BURST       0x00000020
 
 /*
  * The SuperH DMAC supports a number of transmit sizes, we list them here,
  * Defaults to a 64-bit transfer size.
  */
 enum {
-       XMIT_SZ_8BIT,
-       XMIT_SZ_16BIT,
-       XMIT_SZ_32BIT,
-       XMIT_SZ_128BIT,
-       XMIT_SZ_256BIT,
+       XMIT_SZ_8BIT            = 0,
+       XMIT_SZ_16BIT           = 1,
+       XMIT_SZ_32BIT           = 2,
+       XMIT_SZ_64BIT           = 7,
+       XMIT_SZ_128BIT          = 3,
+       XMIT_SZ_256BIT          = 4,
+       XMIT_SZ_128BIT_BLK      = 0xb,
+       XMIT_SZ_256BIT_BLK      = 0xc,
 };
 
 /*
  * The DMA count is defined as the number of bytes to transfer.
  */
-static unsigned int ts_shift[] __maybe_unused = {
-       [XMIT_SZ_8BIT]          = 0,
-       [XMIT_SZ_16BIT]         = 1,
-       [XMIT_SZ_32BIT]         = 2,
-       [XMIT_SZ_128BIT]        = 4,
-       [XMIT_SZ_256BIT]        = 5,
-};
+#define TS_SHIFT {                     \
+       [XMIT_SZ_8BIT]          = 0,    \
+       [XMIT_SZ_16BIT]         = 1,    \
+       [XMIT_SZ_32BIT]         = 2,    \
+       [XMIT_SZ_64BIT]         = 3,    \
+       [XMIT_SZ_128BIT]        = 4,    \
+       [XMIT_SZ_256BIT]        = 5,    \
+       [XMIT_SZ_128BIT_BLK]    = 4,    \
+       [XMIT_SZ_256BIT_BLK]    = 5,    \
+}
+
+#define TS_INDEX2VAL(i)        ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
+                        ((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
 
 #endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */
index bcb30246e85c9fce6c85593736884eac76242bcf..114a369705bcfddc30c60eb7f9981edee6f1c75b 100644 (file)
@@ -6,8 +6,6 @@
 #ifdef CONFIG_CPU_SH4A
 
 #define DMAOR_INIT     (DMAOR_DME)
-#define CHCR_TS_MASK   0x18
-#define CHCR_TS_SHIFT  3
 
 #include <cpu/dma-sh4a.h>
 #else /* CONFIG_CPU_SH4A */
 #define TS_32          0x00000030
 #define TS_64          0x00000000
 
-#define CHCR_TS_MASK   0x70
-#define CHCR_TS_SHIFT  4
+#define CHCR_TS_LOW_MASK       0x70
+#define CHCR_TS_LOW_SHIFT      4
+#define CHCR_TS_HIGH_MASK      0
+#define CHCR_TS_HIGH_SHIFT     0
 
 #define DMAOR_COD      0x00000008
 
  * Defaults to a 64-bit transfer size.
  */
 enum {
-       XMIT_SZ_64BIT,
-       XMIT_SZ_8BIT,
-       XMIT_SZ_16BIT,
-       XMIT_SZ_32BIT,
-       XMIT_SZ_256BIT,
+       XMIT_SZ_8BIT    = 1,
+       XMIT_SZ_16BIT   = 2,
+       XMIT_SZ_32BIT   = 3,
+       XMIT_SZ_64BIT   = 0,
+       XMIT_SZ_256BIT  = 4,
 };
 
 /*
  * The DMA count is defined as the number of bytes to transfer.
  */
-static unsigned int ts_shift[] __maybe_unused = {
-       [XMIT_SZ_64BIT]         = 3,
-       [XMIT_SZ_8BIT]          = 0,
-       [XMIT_SZ_16BIT]         = 1,
-       [XMIT_SZ_32BIT]         = 2,
-       [XMIT_SZ_256BIT]        = 5,
-};
+#define TS_SHIFT {                     \
+       [XMIT_SZ_8BIT]          = 0,    \
+       [XMIT_SZ_16BIT]         = 1,    \
+       [XMIT_SZ_32BIT]         = 2,    \
+       [XMIT_SZ_64BIT]         = 3,    \
+       [XMIT_SZ_256BIT]        = 5,    \
+}
+
+#define TS_INDEX2VAL(i)        (((i) & 7) << CHCR_TS_LOW_SHIFT)
+
 #endif
 
 #endif /* __ASM_CPU_SH4_DMA_H */
index 3ce7ef6c29789ae0ff876703257f6f4b0d42d8d0..03ea75c5315d4887380d996624e153e603d486df 100644 (file)
 
 #define MMUCR_TI               (1<<2)
 
+#define MMUCR_URB              0x00FC0000
+#define MMUCR_URB_SHIFT                18
+#define MMUCR_URB_NENTRIES     64
+
 #if defined(CONFIG_32BIT) && defined(CONFIG_CPU_SUBTYPE_ST40)
 #define MMUCR_SE               (1 << 4)
 #else
index 586d6491816aed1fa0741eeaffeab31fb4eb0586..74716ba2dc3cd3fb1cb3135c25689401e6dcf3ca 100644 (file)
@@ -12,6 +12,7 @@
 #define __ASM_CPU_SH4_SQ_H
 
 #include <asm/addrspace.h>
+#include <asm/page.h>
 
 /*
  * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be
@@ -28,7 +29,7 @@
 
 /* arch/sh/kernel/cpu/sh4/sq.c */
 unsigned long sq_remap(unsigned long phys, unsigned int size,
-                      const char *name, unsigned long flags);
+                      const char *name, pgprot_t prot);
 void sq_unmap(unsigned long vaddr);
 void sq_flush_range(unsigned long start, unsigned int len);
 
diff --git a/arch/sh/include/cpu-sh4/cpu/ubc.h b/arch/sh/include/cpu-sh4/cpu/ubc.h
deleted file mode 100644 (file)
index c86e170..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * include/asm-sh/cpu-sh4/ubc.h
- *
- * Copyright (C) 1999 Niibe Yutaka
- * Copyright (C) 2003 Paul Mundt
- * Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#ifndef __ASM_CPU_SH4_UBC_H
-#define __ASM_CPU_SH4_UBC_H
-
-#if defined(CONFIG_CPU_SH4A)
-#define UBC_CBR0               0xff200000
-#define UBC_CRR0               0xff200004
-#define UBC_CAR0               0xff200008
-#define UBC_CAMR0              0xff20000c
-#define UBC_CBR1               0xff200020
-#define UBC_CRR1               0xff200024
-#define UBC_CAR1               0xff200028
-#define UBC_CAMR1              0xff20002c
-#define UBC_CDR1               0xff200030
-#define UBC_CDMR1              0xff200034
-#define UBC_CETR1              0xff200038
-#define UBC_CCMFR              0xff200600
-#define UBC_CBCR               0xff200620
-
-/* CBR */
-#define UBC_CBR_AIE            (0x01<<30)
-#define UBC_CBR_ID_INST                (0x01<<4)
-#define UBC_CBR_RW_READ                (0x01<<1)
-#define UBC_CBR_CE             (0x01)
-
-#define        UBC_CBR_AIV_MASK        (0x00FF0000)
-#define        UBC_CBR_AIV_SHIFT       (16)
-#define UBC_CBR_AIV_SET(asid)  (((asid)<<UBC_CBR_AIV_SHIFT) & UBC_CBR_AIV_MASK)
-
-#define UBC_CBR_INIT           0x20000000
-
-/* CRR */
-#define UBC_CRR_RES            (0x01<<13)
-#define UBC_CRR_PCB            (0x01<<1)
-#define UBC_CRR_BIE            (0x01)
-
-#define UBC_CRR_INIT           0x00002000
-
-#else  /* CONFIG_CPU_SH4 */
-#define UBC_BARA               0xff200000
-#define UBC_BAMRA              0xff200004
-#define UBC_BBRA               0xff200008
-#define UBC_BASRA              0xff000014
-#define UBC_BARB               0xff20000c
-#define UBC_BAMRB              0xff200010
-#define UBC_BBRB               0xff200014
-#define UBC_BASRB              0xff000018
-#define UBC_BDRB               0xff200018
-#define UBC_BDMRB              0xff20001c
-#define UBC_BRCR               0xff200020
-#endif /* CONFIG_CPU_SH4 */
-
-#endif /* __ASM_CPU_SH4_UBC_H */
-
index c644a77ee3576ef027714d9922795568f41de36c..183a2f7442515c630267ccc5f72131f44be82395 100644 (file)
 #include <asm/io_generic.h>
 
 
-#define SETBITS_OUTB(mask, reg)   ctrl_outb(ctrl_inb(reg) | mask, reg)
-#define SETBITS_OUTW(mask, reg)   ctrl_outw(ctrl_inw(reg) | mask, reg)
-#define SETBITS_OUTL(mask, reg)   ctrl_outl(ctrl_inl(reg) | mask, reg)
-#define CLRBITS_OUTB(mask, reg)   ctrl_outb(ctrl_inb(reg) & ~mask, reg)
-#define CLRBITS_OUTW(mask, reg)   ctrl_outw(ctrl_inw(reg) & ~mask, reg)
-#define CLRBITS_OUTL(mask, reg)   ctrl_outl(ctrl_inl(reg) & ~mask, reg)
+#define SETBITS_OUTB(mask, reg)   __raw_writeb(__raw_readb(reg) | mask, reg)
+#define SETBITS_OUTW(mask, reg)   __raw_writew(__raw_readw(reg) | mask, reg)
+#define SETBITS_OUTL(mask, reg)   __raw_writel(__raw_readl(reg) | mask, reg)
+#define CLRBITS_OUTB(mask, reg)   __raw_writeb(__raw_readb(reg) & ~mask, reg)
+#define CLRBITS_OUTW(mask, reg)   __raw_writew(__raw_readw(reg) & ~mask, reg)
+#define CLRBITS_OUTL(mask, reg)   __raw_writel(__raw_readl(reg) & ~mask, reg)
 
 
 #define PA_LED          PORT_PADR      /* LED */
index f33426608a87e36a45bc061fc4f6b3a41214081d..58f710e1ebc2af30dc235cd4c17370798f986e23 100644 (file)
 
 #define HW_EVENT_IRQ_MAX (HW_EVENT_IRQ_BASE + 95)
 
+/* arch/sh/boards/mach-dreamcast/irq.c */
+extern int systemasic_irq_demux(int);
+extern void systemasic_irq_init(void);
+extern void aica_time_init(void);
+
 #endif /* __ASM_SH_DREAMCAST_SYSASIC_H */
 
diff --git a/arch/sh/include/mach-sdk7786/mach/fpga.h b/arch/sh/include/mach-sdk7786/mach/fpga.h
new file mode 100644 (file)
index 0000000..2120d67
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef __MACH_SDK7786_FPGA_H
+#define __MACH_SDK7786_FPGA_H
+
+#include <linux/io.h>
+#include <linux/types.h>
+#include <linux/bitops.h>
+
+#define SRSTR          0x000
+#define  SRSTR_MAGIC   0x1971  /* Fixed magical read value */
+
+#define INTASR         0x010
+#define INTAMR         0x020
+#define MODSWR         0x030
+#define INTTESTR       0x040
+#define SYSSR          0x050
+#define NRGPR          0x060
+#define NMISR          0x070
+
+#define NMIMR          0x080
+#define  NMIMR_MAN_NMIM        BIT(0)  /* Manual NMI mask */
+#define  NMIMR_AUX_NMIM        BIT(1)  /* Auxiliary NMI mask */
+
+#define INTBSR         0x090
+#define INTBMR         0x0a0
+#define USRLEDR                0x0b0
+#define MAPSWR         0x0c0
+#define FPGAVR         0x0d0
+#define FPGADR         0x0e0
+#define PCBRR          0x0f0
+#define RSR            0x100
+#define EXTASR         0x110
+#define SPCAR          0x120
+#define INTMSR         0x130
+#define PCIECR         0x140
+#define FAER           0x150
+#define USRGPIR                0x160
+/* 0x170 reserved */
+#define LCLASR         0x180
+
+#define SBCR           0x190
+#define  SCBR_I2CMEN   BIT(0)  /* FPGA I2C master enable */
+#define  SCBR_I2CCEN   BIT(1)  /* CPU I2C master enable */
+
+#define PWRCR          0x1a0
+#define SPCBR          0x1b0
+#define SPICR          0x1c0
+#define SPIDR          0x1d0
+#define I2CCR          0x1e0
+#define I2CDR          0x1f0
+#define FPGACR         0x200
+#define IASELR1                0x210
+#define IASELR2                0x220
+#define IASELR3                0x230
+#define IASELR4                0x240
+#define IASELR5                0x250
+#define IASELR6                0x260
+#define IASELR7                0x270
+#define IASELR8                0x280
+#define IASELR9                0x290
+#define IASELR10       0x2a0
+#define IASELR11       0x2b0
+#define IASELR12       0x2c0
+#define IASELR13       0x2d0
+#define IASELR14       0x2e0
+#define IASELR15       0x2f0
+/* 0x300 reserved */
+#define IBSELR1                0x310
+#define IBSELR2                0x320
+#define IBSELR3                0x330
+#define IBSELR4                0x340
+#define IBSELR5                0x350
+#define IBSELR6                0x360
+#define IBSELR7                0x370
+#define IBSELR8                0x380
+#define IBSELR9                0x390
+#define IBSELR10       0x3a0
+#define IBSELR11       0x3b0
+#define IBSELR12       0x3c0
+#define IBSELR13       0x3d0
+#define IBSELR14       0x3e0
+#define IBSELR15       0x3f0
+#define USRACR         0x400
+#define BEEPR          0x410
+#define USRLCDR                0x420
+#define SMBCR          0x430
+#define SMBDR          0x440
+#define USBCR          0x450
+#define AMSR           0x460
+#define ACCR           0x470
+#define SDIFCR         0x480
+
+/* arch/sh/boards/mach-sdk7786/fpga.c */
+extern void __iomem *sdk7786_fpga_base;
+extern void sdk7786_fpga_init(void);
+
+#define SDK7786_FPGA_REGADDR(reg)      (sdk7786_fpga_base + (reg))
+
+/*
+ * A convenience wrapper from register offset to internal I2C address,
+ * when the FPGA is in I2C slave mode.
+ */
+#define SDK7786_FPGA_I2CADDR(reg)      ((reg) >> 3)
+
+static inline u16 fpga_read_reg(unsigned int reg)
+{
+       return ioread16(sdk7786_fpga_base + reg);
+}
+
+static inline void fpga_write_reg(u16 val, unsigned int reg)
+{
+       iowrite16(val, sdk7786_fpga_base + reg);
+}
+
+#endif /* __MACH_SDK7786_FPGA_H */
diff --git a/arch/sh/include/mach-sdk7786/mach/irq.h b/arch/sh/include/mach-sdk7786/mach/irq.h
new file mode 100644 (file)
index 0000000..0f58463
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __MACH_SDK7786_IRQ_H
+#define __MACH_SDK7786_IRQ_H
+
+/* arch/sh/boards/mach-sdk7786/irq.c */
+extern void sdk7786_init_irq(void);
+
+#endif /* __MACH_SDK7786_IRQ_H */
index 749914b400fbe7a187840e744b31e384e20cc324..8d8170d6cc43dbbb189055c6195f9f5748e2f62d 100644 (file)
 
 #define PORT_DRVCR     0xA4050180
 
-#define PORT_PADR      0xA4050120
-#define PORT_PBDR      0xA4050122
-#define PORT_PCDR      0xA4050124
-#define PORT_PDDR      0xA4050126
-#define PORT_PEDR      0xA4050128
-#define PORT_PFDR      0xA405012A
-#define PORT_PGDR      0xA405012C
-#define PORT_PHDR      0xA405012E
-#define PORT_PJDR      0xA4050130
-#define PORT_PKDR      0xA4050132
-#define PORT_PLDR      0xA4050134
-#define PORT_PMDR      0xA4050136
-#define PORT_PNDR      0xA4050138
-#define PORT_PQDR      0xA405013A
-#define PORT_PRDR      0xA405013C
-#define PORT_PTDR      0xA4050160
-#define PORT_PUDR      0xA4050162
-#define PORT_PVDR      0xA4050164
-#define PORT_PWDR      0xA4050166
-#define PORT_PYDR      0xA4050168
+#define PORT_PADR      0xA4050120
+#define PORT_PBDR      0xA4050122
+#define PORT_PCDR      0xA4050124
+#define PORT_PDDR      0xA4050126
+#define PORT_PEDR      0xA4050128
+#define PORT_PFDR      0xA405012A
+#define PORT_PGDR      0xA405012C
+#define PORT_PHDR      0xA405012E
+#define PORT_PJDR      0xA4050130
+#define PORT_PKDR      0xA4050132
+#define PORT_PLDR      0xA4050134
+#define PORT_PMDR      0xA4050136
+#define PORT_PNDR      0xA4050138
+#define PORT_PQDR      0xA405013A
+#define PORT_PRDR      0xA405013C
+#define PORT_PTDR      0xA4050160
+#define PORT_PUDR      0xA4050162
+#define PORT_PVDR      0xA4050164
+#define PORT_PWDR      0xA4050166
+#define PORT_PYDR      0xA4050168
 
 #define FPGA_IN                0xb1400000
 #define FPGA_OUT       0xb1400002
 #define SE7343_FPGA_IRQ_UARTB  11
 
 #define SE7343_FPGA_IRQ_NR     12
-#define SE7343_FPGA_IRQ_BASE   120
-
-#define MRSHPC_IRQ3            (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC3)
-#define MRSHPC_IRQ2            (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC2)
-#define MRSHPC_IRQ1            (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC1)
-#define MRSHPC_IRQ0            (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC0)
-#define SMC_IRQ                (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_SMC)
-#define USB_IRQ                (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_USB)
-#define UARTA_IRQ      (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTA)
-#define UARTB_IRQ      (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTB)
 
 /* arch/sh/boards/se/7343/irq.c */
+extern unsigned int se7343_fpga_irq[];
+
 void init_7343se_IRQ(void);
 
 #endif  /* __ASM_SH_HITACHI_SE7343_H */
index 0d587da1ef12bfa8ab402531ed0593d3b9bae9fa..02fd3ae8b0eeb4fc7bcf4b651060d5bf9054a22f 100644 (file)
@@ -13,8 +13,9 @@ CFLAGS_REMOVE_return_address.o = -pg
 
 obj-y  := debugtraps.o dma-nommu.o dumpstack.o                         \
           idle.o io.o io_generic.o irq.o                               \
-          irq_$(BITS).o machvec.o nmi_debug.o process_$(BITS).o        \
-          ptrace_$(BITS).o return_address.o                            \
+          irq_$(BITS).o machvec.o nmi_debug.o process.o                \
+          process_$(BITS).o ptrace_$(BITS).o                           \
+          reboot.o return_address.o                                    \
           setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o            \
           syscalls_$(BITS).o time.o topology.o traps.o                 \
           traps_$(BITS).o unwinder.o
@@ -22,7 +23,7 @@ obj-y := debugtraps.o dma-nommu.o dumpstack.o                         \
 obj-y                          += cpu/
 obj-$(CONFIG_VSYSCALL)         += vsyscall/
 obj-$(CONFIG_SMP)              += smp.o
-obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o early_printk.o
+obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
 obj-$(CONFIG_KGDB)             += kgdb.o
 obj-$(CONFIG_SH_CPU_FREQ)      += cpufreq.o
 obj-$(CONFIG_MODULES)          += sh_ksyms_$(BITS).o module.o
@@ -39,6 +40,7 @@ obj-$(CONFIG_HIBERNATION)     += swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)   += dwarf.o
 obj-$(CONFIG_PERF_EVENTS)      += perf_event.o perf_callchain.o
 
+obj-$(CONFIG_HAVE_HW_BREAKPOINT)               += hw_breakpoint.o
 obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)    += localtimer.o
 
 EXTRA_CFLAGS += -Werror
index d97c803719ecb939431c910d084a3c774b366ddd..0e48bc61c272e4eb4ebc1dfe4e1a8b7c755a0cd5 100644 (file)
@@ -17,5 +17,7 @@ obj-$(CONFIG_ARCH_SHMOBILE)   += shmobile/
 
 obj-$(CONFIG_SH_ADC)           += adc.o
 obj-$(CONFIG_SH_CLK_CPG)       += clock-cpg.o
+obj-$(CONFIG_SH_FPU)           += fpu.o
+obj-$(CONFIG_SH_FPU_EMU)       += fpu.o
 
 obj-y  += irq/ init.o clock.o hwblk.o
index da3d6877f93d571692b2bf8fe420341323daec6f..d307571d54b6a7c08a40a765b21d45cd451f7188 100644 (file)
@@ -18,19 +18,19 @@ int adc_single(unsigned int channel)
 
        off = (channel & 0x03) << 2;
 
-       csr = ctrl_inb(ADCSR);
+       csr = __raw_readb(ADCSR);
        csr = channel | ADCSR_ADST | ADCSR_CKS;
-       ctrl_outb(csr, ADCSR);
+       __raw_writeb(csr, ADCSR);
 
        do {
-               csr = ctrl_inb(ADCSR);
+               csr = __raw_readb(ADCSR);
        } while ((csr & ADCSR_ADF) == 0);
 
        csr &= ~(ADCSR_ADF | ADCSR_ADST);
-       ctrl_outb(csr, ADCSR);
+       __raw_writeb(csr, ADCSR);
 
-       return (((ctrl_inb(ADDRAH + off) << 8) |
-               ctrl_inb(ADDRAL + off)) >> 6);
+       return (((__raw_readb(ADDRAH + off) << 8) |
+               __raw_readb(ADDRAL + off)) >> 6);
 }
 
 EXPORT_SYMBOL(adc_single);
index 6dfe2cced3fc6e5ed32c7104b4d9f5487e2f823e..eed5eaff96bae6fc92eac566325cb4f593453203 100644 (file)
@@ -149,7 +149,8 @@ int __init sh_clk_div6_register(struct clk *clks, int nr)
 
 static unsigned long sh_clk_div4_recalc(struct clk *clk)
 {
-       struct clk_div_mult_table *table = clk->priv;
+       struct clk_div4_table *d4t = clk->priv;
+       struct clk_div_mult_table *table = d4t->div_mult_table;
        unsigned int idx;
 
        clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
@@ -160,17 +161,90 @@ static unsigned long sh_clk_div4_recalc(struct clk *clk)
        return clk->freq_table[idx].frequency;
 }
 
+static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent)
+{
+       struct clk_div4_table *d4t = clk->priv;
+       struct clk_div_mult_table *table = d4t->div_mult_table;
+       u32 value;
+       int ret;
+
+       if (!strcmp("pll_clk", parent->name))
+               value = __raw_readl(clk->enable_reg) & ~(1 << 7);
+       else
+               value = __raw_readl(clk->enable_reg) | (1 << 7);
+
+       ret = clk_reparent(clk, parent);
+       if (ret < 0)
+               return ret;
+
+       __raw_writel(value, clk->enable_reg);
+
+       /* Rebiuld the frequency table */
+       clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
+                            table, &clk->arch_flags);
+
+       return 0;
+}
+
+static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate, int algo_id)
+{
+       struct clk_div4_table *d4t = clk->priv;
+       unsigned long value;
+       int idx = clk_rate_table_find(clk, clk->freq_table, rate);
+       if (idx < 0)
+               return idx;
+
+       value = __raw_readl(clk->enable_reg);
+       value &= ~(0xf << clk->enable_bit);
+       value |= (idx << clk->enable_bit);
+       __raw_writel(value, clk->enable_reg);
+
+       if (d4t->kick)
+               d4t->kick(clk);
+
+       return 0;
+}
+
+static int sh_clk_div4_enable(struct clk *clk)
+{
+       __raw_writel(__raw_readl(clk->enable_reg) & ~(1 << 8), clk->enable_reg);
+       return 0;
+}
+
+static void sh_clk_div4_disable(struct clk *clk)
+{
+       __raw_writel(__raw_readl(clk->enable_reg) | (1 << 8), clk->enable_reg);
+}
+
 static struct clk_ops sh_clk_div4_clk_ops = {
        .recalc         = sh_clk_div4_recalc,
+       .set_rate       = sh_clk_div4_set_rate,
        .round_rate     = sh_clk_div_round_rate,
 };
 
-int __init sh_clk_div4_register(struct clk *clks, int nr,
-                               struct clk_div_mult_table *table)
+static struct clk_ops sh_clk_div4_enable_clk_ops = {
+       .recalc         = sh_clk_div4_recalc,
+       .set_rate       = sh_clk_div4_set_rate,
+       .round_rate     = sh_clk_div_round_rate,
+       .enable         = sh_clk_div4_enable,
+       .disable        = sh_clk_div4_disable,
+};
+
+static struct clk_ops sh_clk_div4_reparent_clk_ops = {
+       .recalc         = sh_clk_div4_recalc,
+       .set_rate       = sh_clk_div4_set_rate,
+       .round_rate     = sh_clk_div_round_rate,
+       .enable         = sh_clk_div4_enable,
+       .disable        = sh_clk_div4_disable,
+       .set_parent     = sh_clk_div4_set_parent,
+};
+
+static int __init sh_clk_div4_register_ops(struct clk *clks, int nr,
+                       struct clk_div4_table *table, struct clk_ops *ops)
 {
        struct clk *clkp;
        void *freq_table;
-       int nr_divs = table->nr_divisors;
+       int nr_divs = table->div_mult_table->nr_divisors;
        int freq_table_size = sizeof(struct cpufreq_frequency_table);
        int ret = 0;
        int k;
@@ -185,7 +259,7 @@ int __init sh_clk_div4_register(struct clk *clks, int nr,
        for (k = 0; !ret && (k < nr); k++) {
                clkp = clks + k;
 
-               clkp->ops = &sh_clk_div4_clk_ops;
+               clkp->ops = ops;
                clkp->id = -1;
                clkp->priv = table;
 
@@ -198,6 +272,26 @@ int __init sh_clk_div4_register(struct clk *clks, int nr,
        return ret;
 }
 
+int __init sh_clk_div4_register(struct clk *clks, int nr,
+                               struct clk_div4_table *table)
+{
+       return sh_clk_div4_register_ops(clks, nr, table, &sh_clk_div4_clk_ops);
+}
+
+int __init sh_clk_div4_enable_register(struct clk *clks, int nr,
+                               struct clk_div4_table *table)
+{
+       return sh_clk_div4_register_ops(clks, nr, table,
+                                       &sh_clk_div4_enable_clk_ops);
+}
+
+int __init sh_clk_div4_reparent_register(struct clk *clks, int nr,
+                               struct clk_div4_table *table)
+{
+       return sh_clk_div4_register_ops(clks, nr, table,
+                                       &sh_clk_div4_reparent_clk_ops);
+}
+
 #ifdef CONFIG_SH_CLK_CPG_LEGACY
 static struct clk master_clk = {
        .name           = "master_clk",
index f3a46be2ae81c169ffebbd486fec123b643f9118..83da5debeedff422f4683fdbb0af5eda9a9bab5f 100644 (file)
@@ -598,7 +598,7 @@ static struct dentry *clk_debugfs_root;
 static int clk_debugfs_register_one(struct clk *c)
 {
        int err;
-       struct dentry *d, *child;
+       struct dentry *d, *child, *child_tmp;
        struct clk *pa = c->parent;
        char s[255];
        char *p = s;
@@ -630,7 +630,7 @@ static int clk_debugfs_register_one(struct clk *c)
 
 err_out:
        d = c->dentry;
-       list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+       list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
                debugfs_remove(child);
        debugfs_remove(c->dentry);
        return err;
diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
new file mode 100644 (file)
index 0000000..f059ed6
--- /dev/null
@@ -0,0 +1,84 @@
+#include <linux/sched.h>
+#include <asm/processor.h>
+#include <asm/fpu.h>
+
+int init_fpu(struct task_struct *tsk)
+{
+       if (tsk_used_math(tsk)) {
+               if ((boot_cpu_data.flags & CPU_HAS_FPU) && tsk == current)
+                       unlazy_fpu(tsk, task_pt_regs(tsk));
+               return 0;
+       }
+
+       /*
+        * Memory allocation at the first usage of the FPU and other state.
+        */
+       if (!tsk->thread.xstate) {
+               tsk->thread.xstate = kmem_cache_alloc(task_xstate_cachep,
+                                                     GFP_KERNEL);
+               if (!tsk->thread.xstate)
+                       return -ENOMEM;
+       }
+
+       if (boot_cpu_data.flags & CPU_HAS_FPU) {
+               struct sh_fpu_hard_struct *fp = &tsk->thread.xstate->hardfpu;
+               memset(fp, 0, xstate_size);
+               fp->fpscr = FPSCR_INIT;
+       } else {
+               struct sh_fpu_soft_struct *fp = &tsk->thread.xstate->softfpu;
+               memset(fp, 0, xstate_size);
+               fp->fpscr = FPSCR_INIT;
+       }
+
+       set_stopped_child_used_math(tsk);
+       return 0;
+}
+
+#ifdef CONFIG_SH_FPU
+void __fpu_state_restore(void)
+{
+       struct task_struct *tsk = current;
+
+       restore_fpu(tsk);
+
+       task_thread_info(tsk)->status |= TS_USEDFPU;
+       tsk->fpu_counter++;
+}
+
+void fpu_state_restore(struct pt_regs *regs)
+{
+       struct task_struct *tsk = current;
+
+       if (unlikely(!user_mode(regs))) {
+               printk(KERN_ERR "BUG: FPU is used in kernel mode.\n");
+               BUG();
+               return;
+       }
+
+       if (!tsk_used_math(tsk)) {
+               local_irq_enable();
+               /*
+                * does a slab alloc which can sleep
+                */
+               if (init_fpu(tsk)) {
+                       /*
+                        * ran out of memory!
+                        */
+                       do_group_exit(SIGKILL);
+                       return;
+               }
+               local_irq_disable();
+       }
+
+       grab_fpu(regs);
+
+       __fpu_state_restore();
+}
+
+BUILD_TRAP_HANDLER(fpu_state_restore)
+{
+       TRAP_HANDLER_DECL;
+
+       fpu_state_restore(regs);
+}
+#endif /* CONFIG_SH_FPU */
index 89b4b76c0d763d58f6c77229ddc8963fbc8d5508..c736422344ebf03b4b849a7b22af26d4d04b1535 100644 (file)
 #include <asm/elf.h>
 #include <asm/io.h>
 #include <asm/smp.h>
-#ifdef CONFIG_SUPERH32
-#include <asm/ubc.h>
+#include <asm/sh_bios.h>
+
+#ifdef CONFIG_SH_FPU
+#define cpu_has_fpu    1
+#else
+#define cpu_has_fpu    0
+#endif
+
+#ifdef CONFIG_SH_DSP
+#define cpu_has_dsp    1
+#else
+#define cpu_has_dsp    0
 #endif
 
 /*
  * Generic wrapper for command line arguments to disable on-chip
  * peripherals (nofpu, nodsp, and so forth).
  */
-#define onchip_setup(x)                                \
-static int x##_disabled __initdata = 0;                \
-                                               \
-static int __init x##_setup(char *opts)                \
-{                                              \
-       x##_disabled = 1;                       \
-       return 1;                               \
-}                                              \
+#define onchip_setup(x)                                        \
+static int x##_disabled __initdata = !cpu_has_##x;     \
+                                                       \
+static int __init x##_setup(char *opts)                        \
+{                                                      \
+       x##_disabled = 1;                               \
+       return 1;                                       \
+}                                                      \
 __setup("no" __stringify(x), x##_setup);
 
 onchip_setup(fpu);
@@ -52,10 +62,10 @@ onchip_setup(dsp);
 static void __init speculative_execution_init(void)
 {
        /* Clear RABD */
-       ctrl_outl(ctrl_inl(CPUOPM) & ~CPUOPM_RABD, CPUOPM);
+       __raw_writel(__raw_readl(CPUOPM) & ~CPUOPM_RABD, CPUOPM);
 
        /* Flush the update */
-       (void)ctrl_inl(CPUOPM);
+       (void)__raw_readl(CPUOPM);
        ctrl_barrier();
 }
 #else
@@ -89,7 +99,7 @@ static void __init expmask_init(void)
 #endif
 
 /* 2nd-level cache init */
-void __uses_jump_to_uncached __attribute__ ((weak)) l2_cache_init(void)
+void __attribute__ ((weak)) l2_cache_init(void)
 {
 }
 
@@ -97,12 +107,12 @@ void __uses_jump_to_uncached __attribute__ ((weak)) l2_cache_init(void)
  * Generic first-level cache init
  */
 #ifdef CONFIG_SUPERH32
-static void __uses_jump_to_uncached cache_init(void)
+static void cache_init(void)
 {
        unsigned long ccr, flags;
 
        jump_to_uncached();
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
 
        /*
         * At this point we don't know whether the cache is enabled or not - a
@@ -146,7 +156,7 @@ static void __uses_jump_to_uncached cache_init(void)
                        for (addr = addrstart;
                             addr < addrstart + waysize;
                             addr += current_cpu_data.dcache.linesz)
-                               ctrl_outl(0, addr);
+                               __raw_writel(0, addr);
 
                        addrstart += current_cpu_data.dcache.way_incr;
                } while (--ways);
@@ -179,7 +189,7 @@ static void __uses_jump_to_uncached cache_init(void)
 
        l2_cache_init();
 
-       ctrl_outl(flags, CCR);
+       __raw_writel(flags, CCR);
        back_to_cached();
 }
 #else
@@ -207,6 +217,18 @@ static void detect_cache_shape(void)
                l2_cache_shape = -1; /* No S-cache */
 }
 
+static void __init fpu_init(void)
+{
+       /* Disable the FPU */
+       if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) {
+               printk("FPU Disabled\n");
+               current_cpu_data.flags &= ~CPU_HAS_FPU;
+       }
+
+       disable_fpu();
+       clear_used_math();
+}
+
 #ifdef CONFIG_SH_DSP
 static void __init release_dsp(void)
 {
@@ -244,28 +266,35 @@ static void __init dsp_init(void)
        if (sr & SR_DSP)
                current_cpu_data.flags |= CPU_HAS_DSP;
 
+       /* Disable the DSP */
+       if (dsp_disabled && (current_cpu_data.flags & CPU_HAS_DSP)) {
+               printk("DSP Disabled\n");
+               current_cpu_data.flags &= ~CPU_HAS_DSP;
+       }
+
        /* Now that we've determined the DSP status, clear the DSP bit. */
        release_dsp();
 }
+#else
+static inline void __init dsp_init(void) { }
 #endif /* CONFIG_SH_DSP */
 
 /**
  * sh_cpu_init
  *
- * This is our initial entry point for each CPU, and is invoked on the boot
- * CPU prior to calling start_kernel(). For SMP, a combination of this and
- * start_secondary() will bring up each processor to a ready state prior
- * to hand forking the idle loop.
+ * This is our initial entry point for each CPU, and is invoked on the
+ * boot CPU prior to calling start_kernel(). For SMP, a combination of
+ * this and start_secondary() will bring up each processor to a ready
+ * state prior to hand forking the idle loop.
  *
- * We do all of the basic processor init here, including setting up the
- * caches, FPU, DSP, kicking the UBC, etc. By the time start_kernel() is
- * hit (and subsequently platform_setup()) things like determining the
- * CPU subtype and initial configuration will all be done.
+ * We do all of the basic processor init here, including setting up
+ * the caches, FPU, DSP, etc. By the time start_kernel() is hit (and
+ * subsequently platform_setup()) things like determining the CPU
+ * subtype and initial configuration will all be done.
  *
  * Each processor family is still responsible for doing its own probing
  * and cache configuration in detect_cpu_and_cache_system().
  */
-
 asmlinkage void __init sh_cpu_init(void)
 {
        current_thread_info()->cpu = hard_smp_processor_id();
@@ -302,18 +331,8 @@ asmlinkage void __init sh_cpu_init(void)
                detect_cache_shape();
        }
 
-       /* Disable the FPU */
-       if (fpu_disabled) {
-               printk("FPU Disabled\n");
-               current_cpu_data.flags &= ~CPU_HAS_FPU;
-       }
-
-       /* FPU initialization */
-       disable_fpu();
-       if ((current_cpu_data.flags & CPU_HAS_FPU)) {
-               current_thread_info()->status &= ~TS_USEDFPU;
-               clear_used_math();
-       }
+       fpu_init();
+       dsp_init();
 
        /*
         * Initialize the per-CPU ASID cache very early, since the
@@ -321,18 +340,24 @@ asmlinkage void __init sh_cpu_init(void)
         */
        current_cpu_data.asid_cache = NO_CONTEXT;
 
-#ifdef CONFIG_SH_DSP
-       /* Probe for DSP */
-       dsp_init();
-
-       /* Disable the DSP */
-       if (dsp_disabled) {
-               printk("DSP Disabled\n");
-               current_cpu_data.flags &= ~CPU_HAS_DSP;
-               release_dsp();
-       }
-#endif
-
        speculative_execution_init();
        expmask_init();
+
+       /* Do the rest of the boot processor setup */
+       if (raw_smp_processor_id() == 0) {
+               /* Save off the BIOS VBR, if there is one */
+               sh_bios_vbr_init();
+
+               /*
+                * Setup VBR for boot CPU. Secondary CPUs do this through
+                * start_secondary().
+                */
+               per_cpu_trap_init();
+
+               /*
+                * Boot processor to setup the FP and extended state
+                * context info.
+                */
+               init_thread_xstate();
+       }
 }
index 06e7e2959b542e9b862566d4f078e18953ff964b..96a2395839482dd02451187bc0f4e79a71257346 100644 (file)
@@ -123,7 +123,7 @@ static void enable_intc_irq(unsigned int irq)
                bitmask = 1 << (irq - 32);
        }
 
-       ctrl_outl(bitmask, reg);
+       __raw_writel(bitmask, reg);
 }
 
 static void disable_intc_irq(unsigned int irq)
@@ -139,7 +139,7 @@ static void disable_intc_irq(unsigned int irq)
                bitmask = 1 << (irq - 32);
        }
 
-       ctrl_outl(bitmask, reg);
+       __raw_writel(bitmask, reg);
 }
 
 static void mask_and_ack_intc(unsigned int irq)
@@ -170,11 +170,11 @@ void __init plat_irq_setup(void)
 
 
        /* Disable all interrupts and set all priorities to 0 to avoid trouble */
-       ctrl_outl(-1, INTC_INTDSB_0);
-       ctrl_outl(-1, INTC_INTDSB_1);
+       __raw_writel(-1, INTC_INTDSB_0);
+       __raw_writel(-1, INTC_INTDSB_1);
 
        for (reg = INTC_INTPRI_0, i = 0; i < INTC_INTPRI_PREGS; i++, reg += 8)
-               ctrl_outl( NO_PRIORITY, reg);
+               __raw_writel( NO_PRIORITY, reg);
 
 
 #ifdef CONFIG_SH_CAYMAN
@@ -199,7 +199,7 @@ void __init plat_irq_setup(void)
                        reg = INTC_ICR_SET;
                        i = IRQ_IRL0;
                }
-               ctrl_outl(INTC_ICR_IRLM, reg);
+               __raw_writel(INTC_ICR_IRLM, reg);
 
                /* Set interrupt priorities according to platform description */
                for (data = 0, reg = INTC_INTPRI_0; i < NR_INTC_IRQS; i++) {
@@ -207,7 +207,7 @@ void __init plat_irq_setup(void)
                                ((i % INTC_INTPRI_PPREG) * 4);
                        if ((i % INTC_INTPRI_PPREG) == (INTC_INTPRI_PPREG - 1)) {
                                /* Upon the 7th, set Priority Register */
-                               ctrl_outl(data, reg);
+                               __raw_writel(data, reg);
                                data = 0;
                                reg += 8;
                        }
index 4fe863170e315d6ec192b893ab11365951274c14..0c9f24d7a02f16151939b8efd6007cb42eba0816 100644 (file)
@@ -31,7 +31,7 @@ static const int pfc_divisors[] = {1,2,0,4};
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
+       clk->rate *= PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 7];
 }
 
 static struct clk_ops sh7619_master_clk_ops = {
@@ -40,7 +40,7 @@ static struct clk_ops sh7619_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -50,7 +50,7 @@ static struct clk_ops sh7619_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
+       return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 7];
 }
 
 static struct clk_ops sh7619_bus_clk_ops = {
index 7814c76159a7299fdcd512bf7d62b1cf8ce782a7..b26264dc2aefef75e0292cb6c9a4862e8b4f9785 100644 (file)
@@ -34,7 +34,7 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
 
 static void master_clk_init(struct clk *clk)
 {
-       return 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
+       return 10000000 * PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
 }
 
 static struct clk_ops sh7201_master_clk_ops = {
@@ -43,7 +43,7 @@ static struct clk_ops sh7201_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -53,7 +53,7 @@ static struct clk_ops sh7201_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -63,7 +63,7 @@ static struct clk_ops sh7201_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
+       int idx = ((__raw_readw(FREQCR) >> 4) & 0x0007);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
index 940986965102468535ce920668d83e2f3d3827ba..7e75d8f795027a35a8d17c8b6c129682db0b54d7 100644 (file)
@@ -39,7 +39,7 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0003] * PLL2 ;
+       clk->rate *= pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0003] * PLL2 ;
 }
 
 static struct clk_ops sh7203_master_clk_ops = {
@@ -48,7 +48,7 @@ static struct clk_ops sh7203_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -58,7 +58,7 @@ static struct clk_ops sh7203_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx-2];
 }
 
index c2268bdeceeb80a30d6522041e40433b5f2518bb..b27a5e2687ab1e85ffe7e06420ab149ca15678fd 100644 (file)
@@ -34,7 +34,7 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
+       clk->rate *= PLL2 * pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
 }
 
 static struct clk_ops sh7206_master_clk_ops = {
@@ -43,7 +43,7 @@ static struct clk_ops sh7206_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -53,7 +53,7 @@ static struct clk_ops sh7206_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
+       return clk->parent->rate / pll1rate[(__raw_readw(FREQCR) >> 8) & 0x0007];
 }
 
 static struct clk_ops sh7206_bus_clk_ops = {
@@ -62,7 +62,7 @@ static struct clk_ops sh7206_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FREQCR) & 0x0007);
+       int idx = (__raw_readw(FREQCR) & 0x0007);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
index d395ce5740e7dff1cd66c3f786e592a0ba9c97b2..488d24e0cdf0b1aa59988a17afc7a9edd9a7e898 100644 (file)
@@ -26,8 +26,7 @@
 /*
  * Save FPU registers onto task structure.
  */
-void
-save_fpu(struct task_struct *tsk)
+void save_fpu(struct task_struct *tsk)
 {
        unsigned long dummy;
 
@@ -52,7 +51,7 @@ save_fpu(struct task_struct *tsk)
                     "fmov.s    fr0, @-%0\n\t"
                     "lds       %3, fpscr\n\t"
                     : "=r" (dummy)
-                    : "0" ((char *)(&tsk->thread.fpu.hard.status)),
+                    : "0" ((char *)(&tsk->thread.xstate->hardfpu.status)),
                       "r" (FPSCR_RCHG),
                       "r" (FPSCR_INIT)
                     : "memory");
@@ -60,8 +59,7 @@ save_fpu(struct task_struct *tsk)
        disable_fpu();
 }
 
-static void
-restore_fpu(struct task_struct *tsk)
+void restore_fpu(struct task_struct *tsk)
 {
        unsigned long dummy;
 
@@ -85,44 +83,11 @@ restore_fpu(struct task_struct *tsk)
                     "lds.l     @%0+, fpscr\n\t"
                     "lds.l     @%0+, fpul\n\t"
                     : "=r" (dummy)
-                    : "0" (&tsk->thread.fpu), "r" (FPSCR_RCHG)
+                    : "0" (tsk->thread.xstate), "r" (FPSCR_RCHG)
                     : "memory");
        disable_fpu();
 }
 
-/*
- * Load the FPU with signalling NANS.  This bit pattern we're using
- * has the property that no matter wether considered as single or as
- * double precission represents signaling NANS.
- */
-
-static void
-fpu_init(void)
-{
-       enable_fpu();
-       asm volatile("lds       %0, fpul\n\t"
-                    "fsts      fpul, fr0\n\t"
-                    "fsts      fpul, fr1\n\t"
-                    "fsts      fpul, fr2\n\t"
-                    "fsts      fpul, fr3\n\t"
-                    "fsts      fpul, fr4\n\t"
-                    "fsts      fpul, fr5\n\t"
-                    "fsts      fpul, fr6\n\t"
-                    "fsts      fpul, fr7\n\t"
-                    "fsts      fpul, fr8\n\t"
-                    "fsts      fpul, fr9\n\t"
-                    "fsts      fpul, fr10\n\t"
-                    "fsts      fpul, fr11\n\t"
-                    "fsts      fpul, fr12\n\t"
-                    "fsts      fpul, fr13\n\t"
-                    "fsts      fpul, fr14\n\t"
-                    "fsts      fpul, fr15\n\t"
-                    "lds       %2, fpscr\n\t"
-                    : /* no output */
-                    : "r" (0), "r" (FPSCR_RCHG), "r" (FPSCR_INIT));
-       disable_fpu();
-}
-
 /*
  *     Emulate arithmetic ops on denormalized number for some FPU insns.
  */
@@ -490,9 +455,9 @@ ieee_fpe_handler (struct pt_regs *regs)
        if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */
                struct task_struct *tsk = current;
 
-               if ((tsk->thread.fpu.hard.fpscr & FPSCR_FPU_ERROR)) {
+               if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_FPU_ERROR)) {
                        /* FPU error */
-                       denormal_to_double (&tsk->thread.fpu.hard,
+                       denormal_to_double (&tsk->thread.xstate->hardfpu,
                                            (finsn >> 8) & 0xf);
                } else
                        return 0;
@@ -507,9 +472,9 @@ ieee_fpe_handler (struct pt_regs *regs)
 
                n = (finsn >> 8) & 0xf;
                m = (finsn >> 4) & 0xf;
-               hx = tsk->thread.fpu.hard.fp_regs[n];
-               hy = tsk->thread.fpu.hard.fp_regs[m];
-               fpscr = tsk->thread.fpu.hard.fpscr;
+               hx = tsk->thread.xstate->hardfpu.fp_regs[n];
+               hy = tsk->thread.xstate->hardfpu.fp_regs[m];
+               fpscr = tsk->thread.xstate->hardfpu.fpscr;
                prec = fpscr & (1 << 19);
 
                if ((fpscr & FPSCR_FPU_ERROR)
@@ -519,15 +484,15 @@ ieee_fpe_handler (struct pt_regs *regs)
 
                        /* FPU error because of denormal */
                        llx = ((long long) hx << 32)
-                              | tsk->thread.fpu.hard.fp_regs[n+1];
+                              | tsk->thread.xstate->hardfpu.fp_regs[n+1];
                        lly = ((long long) hy << 32)
-                              | tsk->thread.fpu.hard.fp_regs[m+1];
+                              | tsk->thread.xstate->hardfpu.fp_regs[m+1];
                        if ((hx & 0x7fffffff) >= 0x00100000)
                                llx = denormal_muld(lly, llx);
                        else
                                llx = denormal_muld(llx, lly);
-                       tsk->thread.fpu.hard.fp_regs[n] = llx >> 32;
-                       tsk->thread.fpu.hard.fp_regs[n+1] = llx & 0xffffffff;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32;
+                       tsk->thread.xstate->hardfpu.fp_regs[n+1] = llx & 0xffffffff;
                } else if ((fpscr & FPSCR_FPU_ERROR)
                     && (!prec && ((hx & 0x7fffffff) < 0x00800000
                                   || (hy & 0x7fffffff) < 0x00800000))) {
@@ -536,7 +501,7 @@ ieee_fpe_handler (struct pt_regs *regs)
                                hx = denormal_mulf(hy, hx);
                        else
                                hx = denormal_mulf(hx, hy);
-                       tsk->thread.fpu.hard.fp_regs[n] = hx;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = hx;
                } else
                        return 0;
 
@@ -550,9 +515,9 @@ ieee_fpe_handler (struct pt_regs *regs)
 
                n = (finsn >> 8) & 0xf;
                m = (finsn >> 4) & 0xf;
-               hx = tsk->thread.fpu.hard.fp_regs[n];
-               hy = tsk->thread.fpu.hard.fp_regs[m];
-               fpscr = tsk->thread.fpu.hard.fpscr;
+               hx = tsk->thread.xstate->hardfpu.fp_regs[n];
+               hy = tsk->thread.xstate->hardfpu.fp_regs[m];
+               fpscr = tsk->thread.xstate->hardfpu.fpscr;
                prec = fpscr & (1 << 19);
 
                if ((fpscr & FPSCR_FPU_ERROR)
@@ -562,15 +527,15 @@ ieee_fpe_handler (struct pt_regs *regs)
 
                        /* FPU error because of denormal */
                        llx = ((long long) hx << 32)
-                              | tsk->thread.fpu.hard.fp_regs[n+1];
+                              | tsk->thread.xstate->hardfpu.fp_regs[n+1];
                        lly = ((long long) hy << 32)
-                              | tsk->thread.fpu.hard.fp_regs[m+1];
+                              | tsk->thread.xstate->hardfpu.fp_regs[m+1];
                        if ((finsn & 0xf00f) == 0xf000)
                                llx = denormal_addd(llx, lly);
                        else
                                llx = denormal_addd(llx, lly ^ (1LL << 63));
-                       tsk->thread.fpu.hard.fp_regs[n] = llx >> 32;
-                       tsk->thread.fpu.hard.fp_regs[n+1] = llx & 0xffffffff;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32;
+                       tsk->thread.xstate->hardfpu.fp_regs[n+1] = llx & 0xffffffff;
                } else if ((fpscr & FPSCR_FPU_ERROR)
                     && (!prec && ((hx & 0x7fffffff) < 0x00800000
                                   || (hy & 0x7fffffff) < 0x00800000))) {
@@ -579,7 +544,7 @@ ieee_fpe_handler (struct pt_regs *regs)
                                hx = denormal_addf(hx, hy);
                        else
                                hx = denormal_addf(hx, hy ^ 0x80000000);
-                       tsk->thread.fpu.hard.fp_regs[n] = hx;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = hx;
                } else
                        return 0;
 
@@ -597,7 +562,7 @@ BUILD_TRAP_HANDLER(fpu_error)
 
        __unlazy_fpu(tsk, regs);
        if (ieee_fpe_handler(regs)) {
-               tsk->thread.fpu.hard.fpscr &=
+               tsk->thread.xstate->hardfpu.fpscr &=
                        ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK);
                grab_fpu(regs);
                restore_fpu(tsk);
@@ -607,33 +572,3 @@ BUILD_TRAP_HANDLER(fpu_error)
 
        force_sig(SIGFPE, tsk);
 }
-
-void fpu_state_restore(struct pt_regs *regs)
-{
-       struct task_struct *tsk = current;
-
-       grab_fpu(regs);
-       if (unlikely(!user_mode(regs))) {
-               printk(KERN_ERR "BUG: FPU is used in kernel mode.\n");
-               BUG();
-               return;
-       }
-
-       if (likely(used_math())) {
-               /* Using the FPU again.  */
-               restore_fpu(tsk);
-       } else  {
-               /* First time FPU user.  */
-               fpu_init();
-               set_used_math();
-       }
-       task_thread_info(tsk)->status |= TS_USEDFPU;
-       tsk->fpu_counter++;
-}
-
-BUILD_TRAP_HANDLER(fpu_state_restore)
-{
-       TRAP_HANDLER_DECL;
-
-       fpu_state_restore(regs);
-}
index 27b8738f0b0986d5b255e5cfe2b63dc4b33d13c1..b78384afac090de66a7e04e1ff14b274fff5ff9f 100644 (file)
@@ -28,7 +28,7 @@ static int pfc_divisors[]    = { 1, 2, 3, 4, 6, 1, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        clk->rate *= pfc_divisors[idx];
@@ -40,7 +40,7 @@ static struct clk_ops sh3_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        return clk->parent->rate / pfc_divisors[idx];
@@ -52,7 +52,7 @@ static struct clk_ops sh3_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
 
        return clk->parent->rate / stc_multipliers[idx];
@@ -64,7 +64,7 @@ static struct clk_ops sh3_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
        return clk->parent->rate / ifc_divisors[idx];
index 0ca8f2c3646c558be6bbf8c9da0ed64cc25e2b54..0ecea1451c6f079db7c0e9856c83077589d6353a 100644 (file)
@@ -32,7 +32,7 @@ static int pfc_divisors[]    = { 1, 2, 3, 4, 6, 1, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[ctrl_inw(FRQCR) & 0x0003];
+       clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0003];
 }
 
 static struct clk_ops sh7705_master_clk_ops = {
@@ -41,7 +41,7 @@ static struct clk_ops sh7705_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = ctrl_inw(FRQCR) & 0x0003;
+       int idx = __raw_readw(FRQCR) & 0x0003;
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -51,7 +51,7 @@ static struct clk_ops sh7705_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8;
+       int idx = (__raw_readw(FRQCR) & 0x0300) >> 8;
        return clk->parent->rate / stc_multipliers[idx];
 }
 
@@ -61,7 +61,7 @@ static struct clk_ops sh7705_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4;
+       int idx = (__raw_readw(FRQCR) & 0x0030) >> 4;
        return clk->parent->rate / ifc_divisors[idx];
 }
 
index 4bf7887d310af2cf1b59bc1088ab52835279bf37..6f9ff8b57dd69a9d849c9c67631021b4472be255 100644 (file)
@@ -24,7 +24,7 @@ static int pfc_divisors[]    = { 1, 2, 4, 1, 3, 6, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        clk->rate *= pfc_divisors[idx];
@@ -36,7 +36,7 @@ static struct clk_ops sh7706_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        return clk->parent->rate / pfc_divisors[idx];
@@ -48,7 +48,7 @@ static struct clk_ops sh7706_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
 
        return clk->parent->rate / stc_multipliers[idx];
@@ -60,7 +60,7 @@ static struct clk_ops sh7706_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
        return clk->parent->rate / ifc_divisors[idx];
index e8749505bd2a9143d4445fe271e483faeae59977..f302ba09e681f1f2ec5bd9ee21495b1247980a1d 100644 (file)
@@ -24,7 +24,7 @@ static int pfc_divisors[]    = { 1, 2, 4, 1, 3, 6, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        clk->rate *= pfc_divisors[idx];
@@ -36,7 +36,7 @@ static struct clk_ops sh7709_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
        return clk->parent->rate / pfc_divisors[idx];
@@ -48,7 +48,7 @@ static struct clk_ops sh7709_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = (frqcr & 0x0080) ?
                ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1;
 
@@ -61,7 +61,7 @@ static struct clk_ops sh7709_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
        return clk->parent->rate / ifc_divisors[idx];
index 030a58ba18a5070c6c36ce50c01d4e18a2fcca49..29a87d8946a42e66e81e69fb80da9ce4fd8e431c 100644 (file)
@@ -26,7 +26,7 @@ static int md_table[] = { 1, 2, 3, 4, 6, 8, 12 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= md_table[ctrl_inw(FRQCR) & 0x0007];
+       clk->rate *= md_table[__raw_readw(FRQCR) & 0x0007];
 }
 
 static struct clk_ops sh7710_master_clk_ops = {
@@ -35,7 +35,7 @@ static struct clk_ops sh7710_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0007);
+       int idx = (__raw_readw(FRQCR) & 0x0007);
        return clk->parent->rate / md_table[idx];
 }
 
@@ -45,7 +45,7 @@ static struct clk_ops sh7710_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0700) >> 8;
+       int idx = (__raw_readw(FRQCR) & 0x0700) >> 8;
        return clk->parent->rate / md_table[idx];
 }
 
@@ -55,7 +55,7 @@ static struct clk_ops sh7710_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0070) >> 4;
+       int idx = (__raw_readw(FRQCR) & 0x0070) >> 4;
        return clk->parent->rate / md_table[idx];
 }
 
index 6428ee6c77edc4c028d5b6ecd21437993a92ce8b..b0d0c5203996926c971ff14c67ffb8ad6578f671 100644 (file)
@@ -23,7 +23,7 @@ static int divisors[]    = { 1, 2, 3, 4, 6 };
 
 static void master_clk_init(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = (frqcr & 0x0300) >> 8;
 
        clk->rate *= multipliers[idx];
@@ -35,7 +35,7 @@ static struct clk_ops sh7712_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = frqcr & 0x0007;
 
        return clk->parent->rate / divisors[idx];
@@ -47,7 +47,7 @@ static struct clk_ops sh7712_module_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int frqcr = ctrl_inw(FRQCR);
+       int frqcr = __raw_readw(FRQCR);
        int idx = (frqcr & 0x0030) >> 4;
 
        return clk->parent->rate / divisors[idx];
index 3f7e2a22c7c2a6bd1d4303ac5427b5461ff43d6c..f6a389c996cbbb16ce9b8cf5daaf45b34db16188 100644 (file)
@@ -132,7 +132,6 @@ ENTRY(tlb_protection_violation_store)
         mov    #1, r5
 
 call_handle_tlbmiss:
-       setup_frame_reg
        mov.l   1f, r0
        mov     r5, r8
        mov.l   @r0, r6
@@ -365,6 +364,8 @@ handle_exception:
         mov.l  @k2, k2         ! read out vector and keep in k2
 
 handle_exception_special:
+       setup_frame_reg
+
        ! Setup return address and jump to exception handler
        mov.l   7f, r9          ! fetch return address
        stc     r2_bank, r0     ! k2 (vector)
index 46610c35c232e8f5d051a485dfff69ff214bb1bc..99b4d020179a5a0c17b52e9927cbda49d225ed38 100644 (file)
@@ -49,7 +49,7 @@ ENTRY(exception_handling_table)
        .long   exception_error ! reserved_instruction (filled by trap_init) /* 180 */
        .long   exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/
        .long   nmi_trap_handler        /* 1C0 */       ! Allow trap to debugger
-       .long   break_point_trap        /* 1E0 */
+       .long   breakpoint_trap_handler /* 1E0 */
 
        /*
         * Pad the remainder of the table out, exceptions residing in far
index f9c7df64eb010ed7dc5e80b26d2ee635e41cd56c..295ec4c99e9885b1084f918eb88bb1f527239a5e 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/cache.h>
 #include <asm/io.h>
 
-int __uses_jump_to_uncached detect_cpu_and_cache_system(void)
+int detect_cpu_and_cache_system(void)
 {
        unsigned long addr0, addr1, data0, data1, data2, data3;
 
@@ -30,23 +30,23 @@ int __uses_jump_to_uncached detect_cpu_and_cache_system(void)
        addr1 = CACHE_OC_ADDRESS_ARRAY + (1 << 12);
 
        /* First, write back & invalidate */
-       data0  = ctrl_inl(addr0);
-       ctrl_outl(data0&~(SH_CACHE_VALID|SH_CACHE_UPDATED), addr0);
-       data1  = ctrl_inl(addr1);
-       ctrl_outl(data1&~(SH_CACHE_VALID|SH_CACHE_UPDATED), addr1);
+       data0  = __raw_readl(addr0);
+       __raw_writel(data0&~(SH_CACHE_VALID|SH_CACHE_UPDATED), addr0);
+       data1  = __raw_readl(addr1);
+       __raw_writel(data1&~(SH_CACHE_VALID|SH_CACHE_UPDATED), addr1);
 
        /* Next, check if there's shadow or not */
-       data0 = ctrl_inl(addr0);
+       data0 = __raw_readl(addr0);
        data0 ^= SH_CACHE_VALID;
-       ctrl_outl(data0, addr0);
-       data1 = ctrl_inl(addr1);
+       __raw_writel(data0, addr0);
+       data1 = __raw_readl(addr1);
        data2 = data1 ^ SH_CACHE_VALID;
-       ctrl_outl(data2, addr1);
-       data3 = ctrl_inl(addr0);
+       __raw_writel(data2, addr1);
+       data3 = __raw_readl(addr0);
 
        /* Lastly, invaliate them. */
-       ctrl_outl(data0&~SH_CACHE_VALID, addr0);
-       ctrl_outl(data2&~SH_CACHE_VALID, addr1);
+       __raw_writel(data0&~SH_CACHE_VALID, addr0);
+       __raw_writel(data2&~SH_CACHE_VALID, addr1);
 
        back_to_cached();
 
@@ -94,9 +94,9 @@ int __uses_jump_to_uncached detect_cpu_and_cache_system(void)
                boot_cpu_data.dcache.way_incr   = (1 << 13);
                boot_cpu_data.dcache.entry_mask = 0x1ff0;
                boot_cpu_data.dcache.sets       = 512;
-               ctrl_outl(CCR_CACHE_32KB, CCR3_REG);
+               __raw_writel(CCR_CACHE_32KB, CCR3_REG);
 #else
-               ctrl_outl(CCR_CACHE_16KB, CCR3_REG);
+               __raw_writel(CCR_CACHE_16KB, CCR3_REG);
 #endif
 #endif
        }
index c988468578550c3e885588594280c1e32915c7d4..53be70b9811615b70d5a56974965bc2e9d0398cc 100644 (file)
@@ -58,7 +58,7 @@ static DECLARE_INTC_DESC_ACK(intc_desc_irq45, "sh3-irq45",
 void __init plat_irq_setup_pins(int mode)
 {
        if (mode == IRQ_MODE_IRQ) {
-               ctrl_outw(ctrl_inw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1);
+               __raw_writew(__raw_readw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1);
                register_intc_controller(&intc_desc_irq0123);
                return;
        }
index 21421e34e7d5b92d2610b840dc59c201efbf6faa..6b80850294da5a426bc21d4603bec1c7cb85b2ab 100644 (file)
@@ -23,7 +23,7 @@ static int frqcr3_values[]   = { 0, 1, 2, 3, 4, 5, 6  };
 
 static unsigned long emi_clk_recalc(struct clk *clk)
 {
-       int idx = ctrl_inl(CPG2_FRQCR3) & 0x0007;
+       int idx = __raw_readl(CPG2_FRQCR3) & 0x0007;
        return clk->parent->rate / frqcr3_divisors[idx];
 }
 
@@ -52,7 +52,7 @@ static struct clk sh4202_emi_clk = {
 
 static unsigned long femi_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(CPG2_FRQCR3) >> 3) & 0x0007;
+       int idx = (__raw_readl(CPG2_FRQCR3) >> 3) & 0x0007;
        return clk->parent->rate / frqcr3_divisors[idx];
 }
 
@@ -92,7 +92,7 @@ static void shoc_clk_init(struct clk *clk)
 
 static unsigned long shoc_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(CPG2_FRQCR3) >> 6) & 0x0007;
+       int idx = (__raw_readl(CPG2_FRQCR3) >> 6) & 0x0007;
        return clk->parent->rate / frqcr3_divisors[idx];
 }
 
@@ -122,10 +122,10 @@ static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)
 
        tmp = frqcr3_lookup(clk, rate);
 
-       frqcr3 = ctrl_inl(CPG2_FRQCR3);
+       frqcr3 = __raw_readl(CPG2_FRQCR3);
        frqcr3 &= ~(0x0007 << 6);
        frqcr3 |= tmp << 6;
-       ctrl_outl(frqcr3, CPG2_FRQCR3);
+       __raw_writel(frqcr3, CPG2_FRQCR3);
 
        clk->rate = clk->parent->rate / frqcr3_divisors[tmp];
 
index 73294d9cd0492fe69637be663e3c22a72f21eef2..5add75c1f53954ef1bdaaa7fbd64912d99193c5a 100644 (file)
@@ -28,7 +28,7 @@ static int pfc_divisors[] = { 2, 3, 4, 6, 8, 2, 2, 2 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[ctrl_inw(FRQCR) & 0x0007];
+       clk->rate *= pfc_divisors[__raw_readw(FRQCR) & 0x0007];
 }
 
 static struct clk_ops sh4_master_clk_ops = {
@@ -37,7 +37,7 @@ static struct clk_ops sh4_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) & 0x0007);
+       int idx = (__raw_readw(FRQCR) & 0x0007);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -47,7 +47,7 @@ static struct clk_ops sh4_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) >> 3) & 0x0007;
+       int idx = (__raw_readw(FRQCR) >> 3) & 0x0007;
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -57,7 +57,7 @@ static struct clk_ops sh4_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(FRQCR) >> 6) & 0x0007;
+       int idx = (__raw_readw(FRQCR) >> 6) & 0x0007;
        return clk->parent->rate / ifc_divisors[idx];
 }
 
index e97857aec8a0461c496d5512170a55e7c54816d1..447482d7f65e6bdf573c33dabe67317afbe19cdd 100644 (file)
@@ -85,14 +85,14 @@ void save_fpu(struct task_struct *tsk)
                      "fmov.s   fr1, @-%0\n\t"
                      "fmov.s   fr0, @-%0\n\t"
                      "lds      %3, fpscr\n\t":"=r" (dummy)
-                     :"0"((char *)(&tsk->thread.fpu.hard.status)),
+                     :"0"((char *)(&tsk->thread.xstate->hardfpu.status)),
                      "r"(FPSCR_RCHG), "r"(FPSCR_INIT)
                      :"memory");
 
        disable_fpu();
 }
 
-static void restore_fpu(struct task_struct *tsk)
+void restore_fpu(struct task_struct *tsk)
 {
        unsigned long dummy;
 
@@ -135,62 +135,11 @@ static void restore_fpu(struct task_struct *tsk)
                      "lds.l    @%0+, fpscr\n\t"
                      "lds.l    @%0+, fpul\n\t"
                      :"=r" (dummy)
-                     :"0"(&tsk->thread.fpu), "r"(FPSCR_RCHG)
+                     :"0" (tsk->thread.xstate), "r" (FPSCR_RCHG)
                      :"memory");
        disable_fpu();
 }
 
-/*
- * Load the FPU with signalling NANS.  This bit pattern we're using
- * has the property that no matter wether considered as single or as
- * double precision represents signaling NANS.
- */
-
-static void fpu_init(void)
-{
-       enable_fpu();
-       asm volatile (  "lds    %0, fpul\n\t"
-                       "lds    %1, fpscr\n\t"
-                       "fsts   fpul, fr0\n\t"
-                       "fsts   fpul, fr1\n\t"
-                       "fsts   fpul, fr2\n\t"
-                       "fsts   fpul, fr3\n\t"
-                       "fsts   fpul, fr4\n\t"
-                       "fsts   fpul, fr5\n\t"
-                       "fsts   fpul, fr6\n\t"
-                       "fsts   fpul, fr7\n\t"
-                       "fsts   fpul, fr8\n\t"
-                       "fsts   fpul, fr9\n\t"
-                       "fsts   fpul, fr10\n\t"
-                       "fsts   fpul, fr11\n\t"
-                       "fsts   fpul, fr12\n\t"
-                       "fsts   fpul, fr13\n\t"
-                       "fsts   fpul, fr14\n\t"
-                       "fsts   fpul, fr15\n\t"
-                       "frchg\n\t"
-                       "fsts   fpul, fr0\n\t"
-                       "fsts   fpul, fr1\n\t"
-                       "fsts   fpul, fr2\n\t"
-                       "fsts   fpul, fr3\n\t"
-                       "fsts   fpul, fr4\n\t"
-                       "fsts   fpul, fr5\n\t"
-                       "fsts   fpul, fr6\n\t"
-                       "fsts   fpul, fr7\n\t"
-                       "fsts   fpul, fr8\n\t"
-                       "fsts   fpul, fr9\n\t"
-                       "fsts   fpul, fr10\n\t"
-                       "fsts   fpul, fr11\n\t"
-                       "fsts   fpul, fr12\n\t"
-                       "fsts   fpul, fr13\n\t"
-                       "fsts   fpul, fr14\n\t"
-                       "fsts   fpul, fr15\n\t"
-                       "frchg\n\t"
-                       "lds    %2, fpscr\n\t"
-                       :       /* no output */
-                       :"r" (0), "r"(FPSCR_RCHG), "r"(FPSCR_INIT));
-       disable_fpu();
-}
-
 /**
  *      denormal_to_double - Given denormalized float number,
  *                           store double float
@@ -282,9 +231,9 @@ static int ieee_fpe_handler(struct pt_regs *regs)
                /* fcnvsd */
                struct task_struct *tsk = current;
 
-               if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR))
+               if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_CAUSE_ERROR))
                        /* FPU error */
-                       denormal_to_double(&tsk->thread.fpu.hard,
+                       denormal_to_double(&tsk->thread.xstate->hardfpu,
                                           (finsn >> 8) & 0xf);
                else
                        return 0;
@@ -300,9 +249,9 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                n = (finsn >> 8) & 0xf;
                m = (finsn >> 4) & 0xf;
-               hx = tsk->thread.fpu.hard.fp_regs[n];
-               hy = tsk->thread.fpu.hard.fp_regs[m];
-               fpscr = tsk->thread.fpu.hard.fpscr;
+               hx = tsk->thread.xstate->hardfpu.fp_regs[n];
+               hy = tsk->thread.xstate->hardfpu.fp_regs[m];
+               fpscr = tsk->thread.xstate->hardfpu.fpscr;
                prec = fpscr & FPSCR_DBL_PRECISION;
 
                if ((fpscr & FPSCR_CAUSE_ERROR)
@@ -312,18 +261,18 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                        /* FPU error because of denormal (doubles) */
                        llx = ((long long)hx << 32)
-                           | tsk->thread.fpu.hard.fp_regs[n + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[n + 1];
                        lly = ((long long)hy << 32)
-                           | tsk->thread.fpu.hard.fp_regs[m + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[m + 1];
                        llx = float64_mul(llx, lly);
-                       tsk->thread.fpu.hard.fp_regs[n] = llx >> 32;
-                       tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32;
+                       tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff;
                } else if ((fpscr & FPSCR_CAUSE_ERROR)
                           && (!prec && ((hx & 0x7fffffff) < 0x00800000
                                         || (hy & 0x7fffffff) < 0x00800000))) {
                        /* FPU error because of denormal (floats) */
                        hx = float32_mul(hx, hy);
-                       tsk->thread.fpu.hard.fp_regs[n] = hx;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = hx;
                } else
                        return 0;
 
@@ -338,9 +287,9 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                n = (finsn >> 8) & 0xf;
                m = (finsn >> 4) & 0xf;
-               hx = tsk->thread.fpu.hard.fp_regs[n];
-               hy = tsk->thread.fpu.hard.fp_regs[m];
-               fpscr = tsk->thread.fpu.hard.fpscr;
+               hx = tsk->thread.xstate->hardfpu.fp_regs[n];
+               hy = tsk->thread.xstate->hardfpu.fp_regs[m];
+               fpscr = tsk->thread.xstate->hardfpu.fpscr;
                prec = fpscr & FPSCR_DBL_PRECISION;
 
                if ((fpscr & FPSCR_CAUSE_ERROR)
@@ -350,15 +299,15 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                        /* FPU error because of denormal (doubles) */
                        llx = ((long long)hx << 32)
-                           | tsk->thread.fpu.hard.fp_regs[n + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[n + 1];
                        lly = ((long long)hy << 32)
-                           | tsk->thread.fpu.hard.fp_regs[m + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[m + 1];
                        if ((finsn & 0xf00f) == 0xf000)
                                llx = float64_add(llx, lly);
                        else
                                llx = float64_sub(llx, lly);
-                       tsk->thread.fpu.hard.fp_regs[n] = llx >> 32;
-                       tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32;
+                       tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff;
                } else if ((fpscr & FPSCR_CAUSE_ERROR)
                           && (!prec && ((hx & 0x7fffffff) < 0x00800000
                                         || (hy & 0x7fffffff) < 0x00800000))) {
@@ -367,7 +316,7 @@ static int ieee_fpe_handler(struct pt_regs *regs)
                                hx = float32_add(hx, hy);
                        else
                                hx = float32_sub(hx, hy);
-                       tsk->thread.fpu.hard.fp_regs[n] = hx;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = hx;
                } else
                        return 0;
 
@@ -382,9 +331,9 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                n = (finsn >> 8) & 0xf;
                m = (finsn >> 4) & 0xf;
-               hx = tsk->thread.fpu.hard.fp_regs[n];
-               hy = tsk->thread.fpu.hard.fp_regs[m];
-               fpscr = tsk->thread.fpu.hard.fpscr;
+               hx = tsk->thread.xstate->hardfpu.fp_regs[n];
+               hy = tsk->thread.xstate->hardfpu.fp_regs[m];
+               fpscr = tsk->thread.xstate->hardfpu.fpscr;
                prec = fpscr & FPSCR_DBL_PRECISION;
 
                if ((fpscr & FPSCR_CAUSE_ERROR)
@@ -394,20 +343,20 @@ static int ieee_fpe_handler(struct pt_regs *regs)
 
                        /* FPU error because of denormal (doubles) */
                        llx = ((long long)hx << 32)
-                           | tsk->thread.fpu.hard.fp_regs[n + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[n + 1];
                        lly = ((long long)hy << 32)
-                           | tsk->thread.fpu.hard.fp_regs[m + 1];
+                           | tsk->thread.xstate->hardfpu.fp_regs[m + 1];
 
                        llx = float64_div(llx, lly);
 
-                       tsk->thread.fpu.hard.fp_regs[n] = llx >> 32;
-                       tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32;
+                       tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff;
                } else if ((fpscr & FPSCR_CAUSE_ERROR)
                           && (!prec && ((hx & 0x7fffffff) < 0x00800000
                                         || (hy & 0x7fffffff) < 0x00800000))) {
                        /* FPU error because of denormal (floats) */
                        hx = float32_div(hx, hy);
-                       tsk->thread.fpu.hard.fp_regs[n] = hx;
+                       tsk->thread.xstate->hardfpu.fp_regs[n] = hx;
                } else
                        return 0;
 
@@ -420,17 +369,17 @@ static int ieee_fpe_handler(struct pt_regs *regs)
                unsigned int hx;
 
                m = (finsn >> 8) & 0x7;
-               hx = tsk->thread.fpu.hard.fp_regs[m];
+               hx = tsk->thread.xstate->hardfpu.fp_regs[m];
 
-               if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR)
+               if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_CAUSE_ERROR)
                        && ((hx & 0x7fffffff) < 0x00100000)) {
                        /* subnormal double to float conversion */
                        long long llx;
 
-                       llx = ((long long)tsk->thread.fpu.hard.fp_regs[m] << 32)
-                           | tsk->thread.fpu.hard.fp_regs[m + 1];
+                       llx = ((long long)tsk->thread.xstate->hardfpu.fp_regs[m] << 32)
+                           | tsk->thread.xstate->hardfpu.fp_regs[m + 1];
 
-                       tsk->thread.fpu.hard.fpul = float64_to_float32(llx);
+                       tsk->thread.xstate->hardfpu.fpul = float64_to_float32(llx);
                } else
                        return 0;
 
@@ -449,7 +398,7 @@ void float_raise(unsigned int flags)
 int float_rounding_mode(void)
 {
        struct task_struct *tsk = current;
-       int roundingMode = FPSCR_ROUNDING_MODE(tsk->thread.fpu.hard.fpscr);
+       int roundingMode = FPSCR_ROUNDING_MODE(tsk->thread.xstate->hardfpu.fpscr);
        return roundingMode;
 }
 
@@ -461,16 +410,16 @@ BUILD_TRAP_HANDLER(fpu_error)
        __unlazy_fpu(tsk, regs);
        fpu_exception_flags = 0;
        if (ieee_fpe_handler(regs)) {
-               tsk->thread.fpu.hard.fpscr &=
+               tsk->thread.xstate->hardfpu.fpscr &=
                    ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK);
-               tsk->thread.fpu.hard.fpscr |= fpu_exception_flags;
+               tsk->thread.xstate->hardfpu.fpscr |= fpu_exception_flags;
                /* Set the FPSCR flag as well as cause bits - simply
                 * replicate the cause */
-               tsk->thread.fpu.hard.fpscr |= (fpu_exception_flags >> 10);
+               tsk->thread.xstate->hardfpu.fpscr |= (fpu_exception_flags >> 10);
                grab_fpu(regs);
                restore_fpu(tsk);
                task_thread_info(tsk)->status |= TS_USEDFPU;
-               if ((((tsk->thread.fpu.hard.fpscr & FPSCR_ENABLE_MASK) >> 7) &
+               if ((((tsk->thread.xstate->hardfpu.fpscr & FPSCR_ENABLE_MASK) >> 7) &
                     (fpu_exception_flags >> 2)) == 0) {
                        return;
                }
@@ -478,33 +427,3 @@ BUILD_TRAP_HANDLER(fpu_error)
 
        force_sig(SIGFPE, tsk);
 }
-
-void fpu_state_restore(struct pt_regs *regs)
-{
-       struct task_struct *tsk = current;
-
-       grab_fpu(regs);
-       if (unlikely(!user_mode(regs))) {
-               printk(KERN_ERR "BUG: FPU is used in kernel mode.\n");
-               BUG();
-               return;
-       }
-
-       if (likely(used_math())) {
-               /* Using the FPU again.  */
-               restore_fpu(tsk);
-       } else {
-               /* First time FPU user.  */
-               fpu_init();
-               set_used_math();
-       }
-       task_thread_info(tsk)->status |= TS_USEDFPU;
-       tsk->fpu_counter++;
-}
-
-BUILD_TRAP_HANDLER(fpu_state_restore)
-{
-       TRAP_HANDLER_DECL;
-
-       fpu_state_restore(regs);
-}
index d36f0c45f55f3f218956d3dc605eaf02d5cd4e53..822977a06d84c2d23c6858ff10ffa5825c94c481 100644 (file)
@@ -28,9 +28,9 @@ int __init detect_cpu_and_cache_system(void)
                [9] = (1 << 16)
        };
 
-       pvr = (ctrl_inl(CCN_PVR) >> 8) & 0xffffff;
-       prr = (ctrl_inl(CCN_PRR) >> 4) & 0xff;
-       cvr = (ctrl_inl(CCN_CVR));
+       pvr = (__raw_readl(CCN_PVR) >> 8) & 0xffffff;
+       prr = (__raw_readl(CCN_PRR) >> 4) & 0xff;
+       cvr = (__raw_readl(CCN_CVR));
 
        /*
         * Setup some sane SH-4 defaults for the icache
@@ -71,11 +71,11 @@ int __init detect_cpu_and_cache_system(void)
                boot_cpu_data.dcache.ways = 4;
        } else {
                /* And some SH-4 defaults.. */
-               boot_cpu_data.flags |= CPU_HAS_PTEA;
+               boot_cpu_data.flags |= CPU_HAS_PTEA | CPU_HAS_FPU;
                boot_cpu_data.family = CPU_FAMILY_SH4;
        }
 
-       /* FPU detection works for everyone */
+       /* FPU detection works for almost everyone */
        if ((cvr & 0x20000000))
                boot_cpu_data.flags |= CPU_HAS_FPU;
 
@@ -124,6 +124,7 @@ int __init detect_cpu_and_cache_system(void)
                boot_cpu_data.type = CPU_SH7785;
                break;
        case 0x4004:
+       case 0x4005:
                boot_cpu_data.type = CPU_SH7786;
                boot_cpu_data.flags |= CPU_HAS_PTEAEX | CPU_HAS_L2_CACHE;
                break;
@@ -160,6 +161,7 @@ int __init detect_cpu_and_cache_system(void)
                break;
        case 0x700:
                boot_cpu_data.type = CPU_SH4_501;
+               boot_cpu_data.flags &= ~CPU_HAS_FPU;
                boot_cpu_data.icache.ways = 2;
                boot_cpu_data.dcache.ways = 2;
                break;
@@ -227,7 +229,7 @@ int __init detect_cpu_and_cache_system(void)
                         * Size calculation is much more sensible
                         * than it is for the L1.
                         *
-                        * Sizes are 128KB, 258KB, 512KB, and 1MB.
+                        * Sizes are 128KB, 256KB, 512KB, and 1MB.
                         */
                        size = (cvr & 0xf) << 17;
 
index 4b733715cdb555458a43d89a5b1b82c528f8b042..b9b7e10ad68f9fa744a743471134cd4c840a02ec 100644 (file)
@@ -198,7 +198,7 @@ void __init plat_irq_setup_pins(int mode)
 {
        switch (mode) {
        case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */
-               ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
+               __raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
                register_intc_controller(&intc_desc_irlm);
                break;
        default:
index b2a9df1af64c187e3c3bb8b26d91bf9bbfc503e8..ffd79e57254ff84f4b0b481df95cc8bb16455369 100644 (file)
@@ -442,7 +442,7 @@ void __init plat_irq_setup_pins(int mode)
 
        switch (mode) {
        case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */
-               ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
+               __raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
                register_intc_controller(&intc_desc_irlm);
                break;
        default:
index 5b74cc0b43daaa69a8962b10f9c1fe3f66109f2a..a16eb3656f4b1ad60860fdea2c52ec5c8048cb7b 100644 (file)
@@ -319,7 +319,7 @@ void __init plat_irq_setup_pins(int mode)
 {
        switch (mode) {
        case IRQ_MODE_IRQ:
-               ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
+               __raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
                register_intc_controller(&intc_desc_irq);
                break;
        default:
index 8a8a993f55ea1b6504ffab4408ef2f220b1dc92e..fc065f9da6e557cd66376535497cf071f2df4148 100644 (file)
@@ -43,9 +43,9 @@ static unsigned long *sq_bitmap;
 
 #define store_queue_barrier()                  \
 do {                                           \
-       (void)ctrl_inl(P4SEG_STORE_QUE);        \
-       ctrl_outl(0, P4SEG_STORE_QUE + 0);      \
-       ctrl_outl(0, P4SEG_STORE_QUE + 8);      \
+       (void)__raw_readl(P4SEG_STORE_QUE);     \
+       __raw_writel(0, P4SEG_STORE_QUE + 0);   \
+       __raw_writel(0, P4SEG_STORE_QUE + 8);   \
 } while (0);
 
 /**
@@ -100,7 +100,7 @@ static inline void sq_mapping_list_del(struct sq_mapping *map)
        spin_unlock_irq(&sq_mapping_lock);
 }
 
-static int __sq_remap(struct sq_mapping *map, unsigned long flags)
+static int __sq_remap(struct sq_mapping *map, pgprot_t prot)
 {
 #if defined(CONFIG_MMU)
        struct vm_struct *vma;
@@ -113,7 +113,7 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags)
 
        if (ioremap_page_range((unsigned long)vma->addr,
                               (unsigned long)vma->addr + map->size,
-                              vma->phys_addr, __pgprot(flags))) {
+                              vma->phys_addr, prot)) {
                vunmap(vma->addr);
                return -EAGAIN;
        }
@@ -123,8 +123,8 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags)
         * straightforward, as we can just load up each queue's QACR with
         * the physical address appropriately masked.
         */
-       ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR0);
-       ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR1);
+       __raw_writel(((map->addr >> 26) << 2) & 0x1c, SQ_QACR0);
+       __raw_writel(((map->addr >> 26) << 2) & 0x1c, SQ_QACR1);
 #endif
 
        return 0;
@@ -135,14 +135,14 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags)
  * @phys: Physical address of mapping.
  * @size: Length of mapping.
  * @name: User invoking mapping.
- * @flags: Protection flags.
+ * @prot: Protection bits.
  *
  * Remaps the physical address @phys through the next available store queue
  * address of @size length. @name is logged at boot time as well as through
  * the sysfs interface.
  */
 unsigned long sq_remap(unsigned long phys, unsigned int size,
-                      const char *name, unsigned long flags)
+                      const char *name, pgprot_t prot)
 {
        struct sq_mapping *map;
        unsigned long end;
@@ -177,7 +177,7 @@ unsigned long sq_remap(unsigned long phys, unsigned int size,
 
        map->sq_addr = P4SEG_STORE_QUE + (page << PAGE_SHIFT);
 
-       ret = __sq_remap(map, pgprot_val(PAGE_KERNEL_NOCACHE) | flags);
+       ret = __sq_remap(map, prot);
        if (unlikely(ret != 0))
                goto out;
 
@@ -309,8 +309,7 @@ static ssize_t mapping_store(const char *buf, size_t count)
                return -EIO;
 
        if (likely(len)) {
-               int ret = sq_remap(base, len, "Userspace",
-                                  pgprot_val(PAGE_SHARED));
+               int ret = sq_remap(base, len, "Userspace", PAGE_SHARED);
                if (ret < 0)
                        return ret;
        } else
index 33bab477d2e2de42bbd51a635ab0fb63e82f382c..b144e8af89dc696b8285bbb5e60fbb032a1d2bb6 100644 (file)
@@ -41,7 +41,8 @@ pinmux-$(CONFIG_CPU_SUBTYPE_SH7757)   := pinmux-sh7757.o
 pinmux-$(CONFIG_CPU_SUBTYPE_SH7785)    := pinmux-sh7785.o
 pinmux-$(CONFIG_CPU_SUBTYPE_SH7786)    := pinmux-sh7786.o
 
-obj-y                          += $(clock-y)
-obj-$(CONFIG_SMP)              += $(smp-y)
-obj-$(CONFIG_GENERIC_GPIO)     += $(pinmux-y)
-obj-$(CONFIG_PERF_EVENTS)      += perf_event.o
+obj-y                                  += $(clock-y)
+obj-$(CONFIG_SMP)                      += $(smp-y)
+obj-$(CONFIG_GENERIC_GPIO)             += $(pinmux-y)
+obj-$(CONFIG_PERF_EVENTS)              += perf_event.o
+obj-$(CONFIG_HAVE_HW_BREAKPOINT)       += ubc.o
index 0ee3ee86125241c4518dc3e646b72ce95d196f06..2c16df37eda64bd836baf45dbefb8e26aa7ee269 100644 (file)
@@ -107,13 +107,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
        DIV4_SIUA, DIV4_SIUB, DIV4_NR };
 
index a95ebaba095c0e7030c4482a1a60cd0627a4611c..91588d280cd83a1e68d68246ecfcc00dd83ed9fd 100644 (file)
@@ -110,13 +110,17 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
        DIV4_SIUA, DIV4_SIUB, DIV4_NR };
 
index ea38b554dc05348d318d165b1149b982e88e7f6a..15db6d521c5cb39a0548c72a6d5974f03f6726f4 100644 (file)
@@ -110,19 +110,22 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
-enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
-       DIV4_SIUA, DIV4_SIUB, DIV4_IRDA, DIV4_NR };
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
 
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
   SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags)
 
+enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR };
+
 struct clk div4_clks[DIV4_NR] = {
        [DIV4_I] = DIV4("cpu_clk", FRQCR, 20, 0x1fef, CLK_ENABLE_ON_INIT),
        [DIV4_U] = DIV4("umem_clk", FRQCR, 16, 0x1fff, CLK_ENABLE_ON_INIT),
@@ -130,9 +133,19 @@ struct clk div4_clks[DIV4_NR] = {
        [DIV4_B] = DIV4("bus_clk", FRQCR, 8, 0x1fff, CLK_ENABLE_ON_INIT),
        [DIV4_B3] = DIV4("b3_clk", FRQCR, 4, 0x1fff, CLK_ENABLE_ON_INIT),
        [DIV4_P] = DIV4("peripheral_clk", FRQCR, 0, 0x1fff, 0),
+};
+
+enum { DIV4_IRDA, DIV4_ENABLE_NR };
+
+struct clk div4_enable_clks[DIV4_ENABLE_NR] = {
+       [DIV4_IRDA] = DIV4("irda_clk", IRDACLKCR, 0, 0x1fff, 0),
+};
+
+enum { DIV4_SIUA, DIV4_SIUB, DIV4_REPARENT_NR };
+
+struct clk div4_reparent_clks[DIV4_REPARENT_NR] = {
        [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x1fff, 0),
        [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0),
-       [DIV4_IRDA] = DIV4("irda_clk", IRDACLKCR, 0, 0x1fff, 0),
 };
 
 struct clk div6_clks[] = {
@@ -188,6 +201,14 @@ int __init arch_clk_init(void)
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
 
+       if (!ret)
+               ret = sh_clk_div4_enable_register(div4_enable_clks,
+                                       DIV4_ENABLE_NR, &div4_table);
+
+       if (!ret)
+               ret = sh_clk_div4_reparent_register(div4_reparent_clks,
+                                       DIV4_REPARENT_NR, &div4_table);
+
        if (!ret)
                ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks));
 
index 20a31c2255a848611a3568cdfad89599d629ddaf..50babe01fe44eabaee9300652286c0881c883727 100644 (file)
@@ -110,15 +110,18 @@ struct clk *main_clks[] = {
 static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
        .multipliers = multipliers,
        .nr_multipliers = ARRAY_SIZE(multipliers),
 };
 
-enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P,
-       DIV4_SIUA, DIV4_SIUB, DIV4_IRDA, DIV4_NR };
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
+enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR };
 
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
   SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags)
@@ -130,11 +133,20 @@ struct clk div4_clks[DIV4_NR] = {
        [DIV4_B] = DIV4("bus_clk", FRQCR, 8, 0x0dbf, CLK_ENABLE_ON_INIT),
        [DIV4_B3] = DIV4("b3_clk", FRQCR, 4, 0x0db4, CLK_ENABLE_ON_INIT),
        [DIV4_P] = DIV4("peripheral_clk", FRQCR, 0, 0x0dbf, 0),
-       [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x0dbf, 0),
-       [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x0dbf, 0),
+};
+
+enum { DIV4_IRDA, DIV4_ENABLE_NR };
+
+struct clk div4_enable_clks[DIV4_ENABLE_NR] = {
        [DIV4_IRDA] = DIV4("irda_clk", IRDACLKCR, 0, 0x0dbf, 0),
 };
 
+enum { DIV4_SIUA, DIV4_SIUB, DIV4_REPARENT_NR };
+
+struct clk div4_reparent_clks[DIV4_REPARENT_NR] = {
+       [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x0dbf, 0),
+       [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x0dbf, 0),
+};
 struct clk div6_clks[] = {
        SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0),
 };
@@ -215,6 +227,14 @@ int __init arch_clk_init(void)
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
 
+       if (!ret)
+               ret = sh_clk_div4_enable_register(div4_enable_clks,
+                                       DIV4_ENABLE_NR, &div4_table);
+
+       if (!ret)
+               ret = sh_clk_div4_reparent_register(div4_reparent_clks,
+                                       DIV4_REPARENT_NR, &div4_table);
+
        if (!ret)
                ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks));
 
index 9db743802f06d04afc176d5e6200a206c9673f07..6707061fbf54daa05c21b0d2e52b873028f511ef 100644 (file)
@@ -127,13 +127,28 @@ struct clk *main_clks[] = {
        &div3_clk,
 };
 
+static void div4_kick(struct clk *clk)
+{
+       unsigned long value;
+
+       /* set KICK bit in FRQCRA to update hardware setting */
+       value = __raw_readl(FRQCRA);
+       value |= (1 << 31);
+       __raw_writel(value, FRQCRA);
+}
+
 static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = divisors,
        .nr_divisors = ARRAY_SIZE(divisors),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+       .kick = div4_kick,
+};
+
 enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_P, DIV4_M1, DIV4_NR };
 
 #define DIV4(_str, _reg, _bit, _mask, _flags) \
@@ -144,7 +159,7 @@ struct clk div4_clks[DIV4_NR] = {
        [DIV4_SH] = DIV4("shyway_clk", FRQCRA, 12, 0x2f7c, CLK_ENABLE_ON_INIT),
        [DIV4_B] = DIV4("bus_clk", FRQCRA, 8, 0x2f7c, CLK_ENABLE_ON_INIT),
        [DIV4_P] = DIV4("peripheral_clk", FRQCRA, 0, 0x2f7c, 0),
-       [DIV4_M1] = DIV4("vpu_clk", FRQCRB, 4, 0x2f7c, 0),
+       [DIV4_M1] = DIV4("vpu_clk", FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT),
 };
 
 struct clk div6_clks[] = {
index ddc235ca9664c17dd3ff212d4c965652a17efa83..86aae60677dc88756e823771c1533fa6fb91321a 100644 (file)
@@ -35,7 +35,7 @@ static struct clk_ops sh7757_master_clk_ops = {
 
 static void module_clk_recalc(struct clk *clk)
 {
-       int idx = ctrl_inl(FRQCR) & 0x0000000f;
+       int idx = __raw_readl(FRQCR) & 0x0000000f;
        clk->rate = clk->parent->rate / p1fc_divisors[idx];
 }
 
@@ -45,7 +45,7 @@ static struct clk_ops sh7757_module_clk_ops = {
 
 static void bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) >> 8) & 0x0000000f;
+       int idx = (__raw_readl(FRQCR) >> 8) & 0x0000000f;
        clk->rate = clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -55,7 +55,7 @@ static struct clk_ops sh7757_bus_clk_ops = {
 
 static void cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) >> 20) & 0x0000000f;
+       int idx = (__raw_readl(FRQCR) >> 20) & 0x0000000f;
        clk->rate = clk->parent->rate / ifc_divisors[idx];
 }
 
@@ -78,7 +78,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 
 static void shyway_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) >> 12) & 0x0000000f;
+       int idx = (__raw_readl(FRQCR) >> 12) & 0x0000000f;
        clk->rate = clk->parent->rate / sfc_divisors[idx];
 }
 
index 370cd47642efcbfc3ec36827a3a581ba4bf7bc7a..9f401163e71eb961bb24f68c0b9ca4249043df0e 100644 (file)
@@ -22,7 +22,7 @@ static int cfc_divisors[] = { 1, 1, 4, 1, 1, 1, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= p0fc_divisors[(ctrl_inl(FRQCR) >> 4) & 0x07];
+       clk->rate *= p0fc_divisors[(__raw_readl(FRQCR) >> 4) & 0x07];
 }
 
 static struct clk_ops sh7763_master_clk_ops = {
@@ -31,7 +31,7 @@ static struct clk_ops sh7763_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 4) & 0x07);
+       int idx = ((__raw_readl(FRQCR) >> 4) & 0x07);
        return clk->parent->rate / p0fc_divisors[idx];
 }
 
@@ -41,7 +41,7 @@ static struct clk_ops sh7763_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 16) & 0x07);
+       int idx = ((__raw_readl(FRQCR) >> 16) & 0x07);
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -68,7 +68,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 
 static unsigned long shyway_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 20) & 0x07);
+       int idx = ((__raw_readl(FRQCR) >> 20) & 0x07);
        return clk->parent->rate / cfc_divisors[idx];
 }
 
index e0b896769205a291809ac035dab984c309db3392..9e3354365d4049970b1b7afae84f86adfd2206ff 100644 (file)
@@ -21,7 +21,7 @@ static int pfc_divisors[] = { 1, 8, 1,10,12,16, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[(ctrl_inl(FRQCR) >> 28) & 0x000f];
+       clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> 28) & 0x000f];
 }
 
 static struct clk_ops sh7770_master_clk_ops = {
@@ -30,7 +30,7 @@ static struct clk_ops sh7770_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 28) & 0x000f);
+       int idx = ((__raw_readl(FRQCR) >> 28) & 0x000f);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -40,7 +40,7 @@ static struct clk_ops sh7770_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) & 0x000f);
+       int idx = (__raw_readl(FRQCR) & 0x000f);
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -50,7 +50,7 @@ static struct clk_ops sh7770_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 24) & 0x000f);
+       int idx = ((__raw_readl(FRQCR) >> 24) & 0x000f);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
index a249d823578ea1406468bfa75d4c84c9c0f0b24e..150963a6001e714a1f69fac95b66147f57be44fb 100644 (file)
@@ -22,7 +22,7 @@ static int cfc_divisors[] = { 1, 1, 4, 1, 6, 1, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[ctrl_inl(FRQCR) & 0x0003];
+       clk->rate *= pfc_divisors[__raw_readl(FRQCR) & 0x0003];
 }
 
 static struct clk_ops sh7780_master_clk_ops = {
@@ -31,7 +31,7 @@ static struct clk_ops sh7780_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) & 0x0003);
+       int idx = (__raw_readl(FRQCR) & 0x0003);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -41,7 +41,7 @@ static struct clk_ops sh7780_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007);
+       int idx = ((__raw_readl(FRQCR) >> 16) & 0x0007);
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -51,7 +51,7 @@ static struct clk_ops sh7780_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001);
+       int idx = ((__raw_readl(FRQCR) >> 24) & 0x0001);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
@@ -74,7 +74,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 
 static unsigned long shyway_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007);
+       int idx = ((__raw_readl(FRQCR) >> 20) & 0x0007);
        return clk->parent->rate / cfc_divisors[idx];
 }
 
index 73abfbf2f16d29aa79e9255278725210e365b981..d997f0a25b104a519a7854d101fbd06a9472a5e0 100644 (file)
@@ -57,11 +57,15 @@ static struct clk *clks[] = {
 static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18,
                               24, 32, 36, 48 };
 
-static struct clk_div_mult_table div4_table = {
+static struct clk_div_mult_table div4_div_mult_table = {
        .divisors = div2,
        .nr_divisors = ARRAY_SIZE(div2),
 };
 
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
+};
+
 enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_GA,
        DIV4_DU, DIV4_P, DIV4_NR };
 
index a0e8869071ace5480fa1d9f3857b5c8f9af102c5..af69fd4687038e5eecd53a5e95c988c600cdc956 100644 (file)
@@ -3,11 +3,7 @@
  *
  * SH7786 support for the clock framework
  *
- * Copyright (C) 2008, 2009  Renesas Solutions Corp.
- * Kuninori Morimoto <morimoto.kuninori@renesas.com>
- *
- * Based on SH7785
- *  Copyright (C) 2007  Paul Mundt
+ *  Copyright (C) 2010  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/clk.h>
+#include <linux/io.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
-#include <asm/io.h>
-
-static int ifc_divisors[] = { 1, 2, 4, 1 };
-static int sfc_divisors[] = { 1, 1, 4, 1 };
-static int bfc_divisors[] = { 1, 1, 1, 1, 1, 12, 16, 1,
-                            24, 32, 1, 1, 1, 1, 1, 1 };
-static int mfc_divisors[] = { 1, 1, 4, 1 };
-static int pfc_divisors[] = { 1, 1, 1, 1, 1, 1, 16, 1,
-                             24, 32, 1, 48, 1, 1, 1, 1 };
 
-static void master_clk_init(struct clk *clk)
-{
-       clk->rate *= pfc_divisors[ctrl_inl(FRQMR1) & 0x000f];
-}
-
-static struct clk_ops sh7786_master_clk_ops = {
-       .init           = master_clk_init,
+/*
+ * Default rate for the root input clock, reset this with clk_set_rate()
+ * from the platform code.
+ */
+static struct clk extal_clk = {
+       .name           = "extal",
+       .id             = -1,
+       .rate           = 33333333,
 };
 
-static unsigned long module_clk_recalc(struct clk *clk)
+static unsigned long pll_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQMR1) & 0x000f);
-       return clk->parent->rate / pfc_divisors[idx];
-}
+       int multiplier;
 
-static struct clk_ops sh7786_module_clk_ops = {
-       .recalc         = module_clk_recalc,
-};
+       /*
+        * Clock modes 0, 1, and 2 use an x64 multiplier against PLL1,
+        * while modes 3, 4, and 5 use an x32.
+        */
+       multiplier = (sh_mv.mv_mode_pins() & 0xf) < 3 ? 64 : 32;
 
-static unsigned long bus_clk_recalc(struct clk *clk)
-{
-       int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f);
-       return clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate * multiplier;
 }
 
-static struct clk_ops sh7786_bus_clk_ops = {
-       .recalc         = bus_clk_recalc,
+static struct clk_ops pll_clk_ops = {
+       .recalc         = pll_recalc,
 };
 
-static unsigned long cpu_clk_recalc(struct clk *clk)
-{
-       int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003);
-       return clk->parent->rate / ifc_divisors[idx];
-}
-
-static struct clk_ops sh7786_cpu_clk_ops = {
-       .recalc         = cpu_clk_recalc,
+static struct clk pll_clk = {
+       .name           = "pll_clk",
+       .id             = -1,
+       .ops            = &pll_clk_ops,
+       .parent         = &extal_clk,
+       .flags          = CLK_ENABLE_ON_INIT,
 };
 
-static struct clk_ops *sh7786_clk_ops[] = {
-       &sh7786_master_clk_ops,
-       &sh7786_module_clk_ops,
-       &sh7786_bus_clk_ops,
-       &sh7786_cpu_clk_ops,
+static struct clk *clks[] = {
+       &extal_clk,
+       &pll_clk,
 };
 
-void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
-{
-       if (idx < ARRAY_SIZE(sh7786_clk_ops))
-               *ops = sh7786_clk_ops[idx];
-}
+static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18,
+                              24, 32, 36, 48 };
 
-static unsigned long shyway_clk_recalc(struct clk *clk)
-{
-       int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003);
-       return clk->parent->rate / sfc_divisors[idx];
-}
-
-static struct clk_ops sh7786_shyway_clk_ops = {
-       .recalc         = shyway_clk_recalc,
+static struct clk_div_mult_table div4_div_mult_table = {
+       .divisors = div2,
+       .nr_divisors = ARRAY_SIZE(div2),
 };
 
-static struct clk sh7786_shyway_clk = {
-       .name           = "shyway_clk",
-       .flags          = CLK_ENABLE_ON_INIT,
-       .ops            = &sh7786_shyway_clk_ops,
+static struct clk_div4_table div4_table = {
+       .div_mult_table = &div4_div_mult_table,
 };
 
-static unsigned long ddr_clk_recalc(struct clk *clk)
-{
-       int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003);
-       return clk->parent->rate / mfc_divisors[idx];
-}
+enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_DU, DIV4_P, DIV4_NR };
 
-static struct clk_ops sh7786_ddr_clk_ops = {
-       .recalc         = ddr_clk_recalc,
-};
+#define DIV4(_str, _bit, _mask, _flags) \
+  SH_CLK_DIV4(_str, &pll_clk, FRQMR1, _bit, _mask, _flags)
 
-static struct clk sh7786_ddr_clk = {
-       .name           = "ddr_clk",
-       .flags          = CLK_ENABLE_ON_INIT,
-       .ops            = &sh7786_ddr_clk_ops,
+struct clk div4_clks[DIV4_NR] = {
+       [DIV4_P] = DIV4("peripheral_clk", 0, 0x0b40, 0),
+       [DIV4_DU] = DIV4("du_clk", 4, 0x0010, 0),
+       [DIV4_DDR] = DIV4("ddr_clk", 12, 0x0002, CLK_ENABLE_ON_INIT),
+       [DIV4_B] = DIV4("bus_clk", 16, 0x0360, CLK_ENABLE_ON_INIT),
+       [DIV4_SH] = DIV4("shyway_clk", 20, 0x0002, CLK_ENABLE_ON_INIT),
+       [DIV4_I] = DIV4("cpu_clk", 28, 0x0006, CLK_ENABLE_ON_INIT),
 };
 
-/*
- * Additional SH7786-specific on-chip clocks that aren't already part of the
- * clock framework
- */
-static struct clk *sh7786_onchip_clocks[] = {
-       &sh7786_shyway_clk,
-       &sh7786_ddr_clk,
+#define MSTPCR0                0xffc40030
+#define MSTPCR1                0xffc40034
+
+static struct clk mstp_clks[] = {
+       /* MSTPCR0 */
+       SH_CLK_MSTP32("scif_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
+       SH_CLK_MSTP32("scif_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
+       SH_CLK_MSTP32("scif_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
+       SH_CLK_MSTP32("scif_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
+       SH_CLK_MSTP32("scif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
+       SH_CLK_MSTP32("scif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
+       SH_CLK_MSTP32("ssi_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 23, 0),
+       SH_CLK_MSTP32("ssi_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 22, 0),
+       SH_CLK_MSTP32("ssi_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 21, 0),
+       SH_CLK_MSTP32("ssi_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 20, 0),
+       SH_CLK_MSTP32("hac_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 17, 0),
+       SH_CLK_MSTP32("hac_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 16, 0),
+       SH_CLK_MSTP32("i2c_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 15, 0),
+       SH_CLK_MSTP32("i2c_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 14, 0),
+       SH_CLK_MSTP32("tmu9_11_fck", -1, &div4_clks[DIV4_P], MSTPCR0, 11, 0),
+       SH_CLK_MSTP32("tmu678_fck", -1, &div4_clks[DIV4_P], MSTPCR0, 10, 0),
+       SH_CLK_MSTP32("tmu345_fck", -1, &div4_clks[DIV4_P], MSTPCR0, 9, 0),
+       SH_CLK_MSTP32("tmu012_fck", -1, &div4_clks[DIV4_P], MSTPCR0, 8, 0),
+       SH_CLK_MSTP32("sdif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 5, 0),
+       SH_CLK_MSTP32("sdif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 4, 0),
+       SH_CLK_MSTP32("hspi_fck", -1, &div4_clks[DIV4_P], MSTPCR0, 2, 0),
+
+       /* MSTPCR1 */
+       SH_CLK_MSTP32("usb_fck", -1, NULL, MSTPCR1, 12, 0),
+       SH_CLK_MSTP32("pcie_fck", 2, NULL, MSTPCR1, 10, 0),
+       SH_CLK_MSTP32("pcie_fck", 1, NULL, MSTPCR1, 9, 0),
+       SH_CLK_MSTP32("pcie_fck", 0, NULL, MSTPCR1, 8, 0),
+       SH_CLK_MSTP32("dmac_11_6_fck", -1, NULL, MSTPCR1, 5, 0),
+       SH_CLK_MSTP32("dmac_5_0_fck", -1, NULL, MSTPCR1, 4, 0),
+       SH_CLK_MSTP32("du_fck", -1, NULL, MSTPCR1, 3, 0),
+       SH_CLK_MSTP32("ether_fck", -1, NULL, MSTPCR1, 2, 0),
 };
 
 int __init arch_clk_init(void)
 {
-       struct clk *clk;
        int i, ret = 0;
 
-       cpg_clk_init();
-
-       clk = clk_get(NULL, "master_clk");
-       for (i = 0; i < ARRAY_SIZE(sh7786_onchip_clocks); i++) {
-               struct clk *clkp = sh7786_onchip_clocks[i];
-
-               clkp->parent = clk;
-               ret |= clk_register(clkp);
-       }
+       for (i = 0; i < ARRAY_SIZE(clks); i++)
+               ret |= clk_register(clks[i]);
 
-       clk_put(clk);
+       if (!ret)
+               ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
+                                          &div4_table);
+       if (!ret)
+               ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks));
 
        return ret;
 }
index 23c27d32d9823136e38f725dca53f6ffe92b76b5..e75c57bdfa5ecf1efb1722013331c8b6016ceb7f 100644 (file)
@@ -33,7 +33,7 @@ static int cfc_divisors[] = { 1, 1, 4, 6 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[(ctrl_inl(FRQCR) >> PFC_POS) & PFC_MSK];
+       clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> PFC_POS) & PFC_MSK];
 }
 
 static struct clk_ops shx3_master_clk_ops = {
@@ -42,7 +42,7 @@ static struct clk_ops shx3_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> PFC_POS) & PFC_MSK);
+       int idx = ((__raw_readl(FRQCR) >> PFC_POS) & PFC_MSK);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -52,7 +52,7 @@ static struct clk_ops shx3_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> BFC_POS) & BFC_MSK);
+       int idx = ((__raw_readl(FRQCR) >> BFC_POS) & BFC_MSK);
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -62,7 +62,7 @@ static struct clk_ops shx3_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> IFC_POS) & IFC_MSK);
+       int idx = ((__raw_readl(FRQCR) >> IFC_POS) & IFC_MSK);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
@@ -85,7 +85,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 
 static unsigned long shyway_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> CFC_POS) & CFC_MSK);
+       int idx = ((__raw_readl(FRQCR) >> CFC_POS) & CFC_MSK);
        return clk->parent->rate / cfc_divisors[idx];
 }
 
index cb9d07bd59f87711a671bef93d8fd455d9b3d3c3..0688a7502f865cb1d278fa0b12f869f82e028aa2 100644 (file)
@@ -278,6 +278,7 @@ enum {
        HIZA8_LCDC, HIZA8_HIZ,
        HIZA7_LCDC, HIZA7_HIZ,
        HIZA6_LCDC, HIZA6_HIZ,
+       HIZB4_SIUA, HIZB4_HIZ,
        HIZB1_VIO, HIZB1_HIZ,
        HIZB0_VIO, HIZB0_HIZ,
        HIZC15_IRQ7, HIZC15_HIZ,
@@ -546,7 +547,7 @@ static pinmux_enum_t pinmux_data[] = {
        PINMUX_DATA(VIO_VD2_MARK, PSE3_VIO, MSELB9_VIO2,
                    HIZB0_VIO, FOE_VIO_VD2),
        PINMUX_DATA(VIO_HD2_MARK, PSE3_VIO, MSELB9_VIO2,
-                   HIZB1_VIO, HIZB1_VIO, FCE_VIO_HD2),
+                   HIZB1_VIO, FCE_VIO_HD2),
        PINMUX_DATA(VIO_CLK2_MARK, PSE3_VIO, MSELB9_VIO2,
                    HIZB1_VIO, FRB_VIO_CLK2),
 
@@ -658,14 +659,14 @@ static pinmux_enum_t pinmux_data[] = {
        PINMUX_DATA(SDHICLK_MARK, SDHICLK),
 
        /* SIU - Port A */
-       PINMUX_DATA(SIUAOLR_MARK, PSC13_SIUAOLR, SIUAOLR_SIOF1_SYNC),
-       PINMUX_DATA(SIUAOBT_MARK, PSC14_SIUAOBT, SIUAOBT_SIOF1_SCK),
-       PINMUX_DATA(SIUAISLD_MARK, PSC15_SIUAISLD, SIUAISLD_SIOF1_RXD),
-       PINMUX_DATA(SIUAILR_MARK, PSC11_SIUAILR, SIUAILR_SIOF1_SS2),
-       PINMUX_DATA(SIUAIBT_MARK, PSC12_SIUAIBT, SIUAIBT_SIOF1_SS1),
-       PINMUX_DATA(SIUAOSLD_MARK, PSB0_SIUAOSLD, SIUAOSLD_SIOF1_TXD),
-       PINMUX_DATA(SIUMCKA_MARK, PSE11_SIUMCKA_SIOF1_MCK, PSB1_SIUMCKA, PTK0),
-       PINMUX_DATA(SIUFCKA_MARK, PSE11_SIUFCKA, PTK0),
+       PINMUX_DATA(SIUAOLR_MARK, PSC13_SIUAOLR, HIZB4_SIUA, SIUAOLR_SIOF1_SYNC),
+       PINMUX_DATA(SIUAOBT_MARK, PSC14_SIUAOBT, HIZB4_SIUA, SIUAOBT_SIOF1_SCK),
+       PINMUX_DATA(SIUAISLD_MARK, PSC15_SIUAISLD, HIZB4_SIUA, SIUAISLD_SIOF1_RXD),
+       PINMUX_DATA(SIUAILR_MARK, PSC11_SIUAILR, HIZB4_SIUA, SIUAILR_SIOF1_SS2),
+       PINMUX_DATA(SIUAIBT_MARK, PSC12_SIUAIBT, HIZB4_SIUA, SIUAIBT_SIOF1_SS1),
+       PINMUX_DATA(SIUAOSLD_MARK, PSB0_SIUAOSLD, HIZB4_SIUA, SIUAOSLD_SIOF1_TXD),
+       PINMUX_DATA(SIUMCKA_MARK, PSE11_SIUMCKA_SIOF1_MCK, HIZB4_SIUA, PSB1_SIUMCKA, PTK0),
+       PINMUX_DATA(SIUFCKA_MARK, PSE11_SIUFCKA, HIZB4_SIUA, PTK0),
 
        /* SIU - Port B */
        PINMUX_DATA(SIUBOLR_MARK, PSB11_SIUBOLR, SIOSTRB1_SIUBOLR),
@@ -1612,7 +1613,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
                0, 0,
                0, 0,
                0, 0,
-               0, 0,
+               HIZB4_SIUA, HIZB4_HIZ,
                0, 0,
                0, 0,
                HIZB1_VIO, HIZB1_HIZ,
index b5335b5e309cd23b53e5b35d155bfcd71e6e630e..ef3f97827808b1a678ee69e2a87f45aa696149ef 100644 (file)
@@ -446,6 +446,8 @@ void __init plat_early_device_setup(void)
 
 enum {
        UNUSED=0,
+       ENABLED,
+       DISABLED,
 
        /* interrupt sources */
        IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
@@ -461,7 +463,6 @@ enum {
        SCIF0, SCIF1, SCIF2, SIOF0, SIOF1, SIO,
        FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
        I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI,
-       SDHI0, SDHI1, SDHI2, SDHI3,
        CMT, TSIF, SIU, TWODG,
        TMU0, TMU1, TMU2,
        IRDA, JPU, LCDC,
@@ -494,8 +495,8 @@ static struct intc_vect vectors[] __initdata = {
        INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
        INTC_VECT(I2C_ALI, 0xe00), INTC_VECT(I2C_TACKI, 0xe20),
        INTC_VECT(I2C_WAITI, 0xe40), INTC_VECT(I2C_DTEI, 0xe60),
-       INTC_VECT(SDHI0, 0xe80), INTC_VECT(SDHI1, 0xea0),
-       INTC_VECT(SDHI2, 0xec0), INTC_VECT(SDHI3, 0xee0),
+       INTC_VECT(SDHI, 0xe80), INTC_VECT(SDHI, 0xea0),
+       INTC_VECT(SDHI, 0xec0), INTC_VECT(SDHI, 0xee0),
        INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
        INTC_VECT(SIU, 0xf80), INTC_VECT(TWODG, 0xfa0),
        INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
@@ -513,7 +514,6 @@ static struct intc_group groups[] __initdata = {
        INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
                   FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
        INTC_GROUP(I2C, I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI),
-       INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2, SDHI3),
 };
 
 static struct intc_mask_reg mask_registers[] __initdata = {
@@ -535,7 +535,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
          { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
            FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
        { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
-         { SDHI3, SDHI2, SDHI1, SDHI0, 0, 0, TWODG, SIU } },
+         { DISABLED, DISABLED, ENABLED, ENABLED, 0, 0, TWODG, SIU } },
        { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
          { 0, 0, 0, CMT, 0, USB_USBI1, USB_USBI0, } },
        { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
@@ -573,9 +573,13 @@ static struct intc_mask_reg ack_registers[] __initdata = {
          { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
 };
 
-static DECLARE_INTC_DESC_ACK(intc_desc, "sh7722", vectors, groups,
-                            mask_registers, prio_registers, sense_registers,
-                            ack_registers);
+static struct intc_desc intc_desc __initdata = {
+       .name = "sh7722",
+       .force_enable = ENABLED,
+       .force_disable = DISABLED,
+       .hw = INTC_HW_DESC(vectors, groups, mask_registers,
+                          prio_registers, sense_registers, ack_registers),
+};
 
 void __init plat_irq_setup(void)
 {
index 772b9265d0e475f445b30ef6a85940dd45ee2d31..85c61f624702ab784adbacb2bd7fbab9c4249a79 100644 (file)
@@ -592,14 +592,17 @@ void __init plat_early_device_setup(void)
 #define RAMCR_CACHE_L2FC       0x0002
 #define RAMCR_CACHE_L2E                0x0001
 #define L2_CACHE_ENABLE                (RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
-void __uses_jump_to_uncached l2_cache_init(void)
+
+void l2_cache_init(void)
 {
        /* Enable L2 cache */
-       ctrl_outl(L2_CACHE_ENABLE, RAMCR);
+       __raw_writel(L2_CACHE_ENABLE, RAMCR);
 }
 
 enum {
        UNUSED=0,
+       ENABLED,
+       DISABLED,
 
        /* interrupt sources */
        IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
@@ -622,7 +625,6 @@ enum {
        SCIFA_SCIFA1,
        FLCTL_FLSTEI,FLCTL_FLTENDI,FLCTL_FLTREQ0I,FLCTL_FLTREQ1I,
        I2C_ALI,I2C_TACKI,I2C_WAITI,I2C_DTEI,
-       SDHI0_SDHII0,SDHI0_SDHII1,SDHI0_SDHII2,
        CMT_CMTI,
        TSIF_TSIFI,
        SIU_SIUI,
@@ -630,7 +632,6 @@ enum {
        TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
        IRDA_IRDAI,
        ATAPI_ATAPII,
-       SDHI1_SDHII0,SDHI1_SDHII1,SDHI1_SDHII2,
        VEU2H1_VEU2HI,
        LCDC_LCDCI,
        TMU1_TUNI0,TMU1_TUNI1,TMU1_TUNI2,
@@ -701,9 +702,9 @@ static struct intc_vect vectors[] __initdata = {
        INTC_VECT(I2C_WAITI,0xE40),
        INTC_VECT(I2C_DTEI,0xE60),
 
-       INTC_VECT(SDHI0_SDHII0,0xE80),
-       INTC_VECT(SDHI0_SDHII1,0xEA0),
-       INTC_VECT(SDHI0_SDHII2,0xEC0),
+       INTC_VECT(SDHI00xE80),
+       INTC_VECT(SDHI00xEA0),
+       INTC_VECT(SDHI00xEC0),
 
        INTC_VECT(CMT_CMTI,0xF00),
        INTC_VECT(TSIF_TSIFI,0xF20),
@@ -717,9 +718,9 @@ static struct intc_vect vectors[] __initdata = {
        INTC_VECT(IRDA_IRDAI,0x480),
        INTC_VECT(ATAPI_ATAPII,0x4A0),
 
-       INTC_VECT(SDHI1_SDHII0,0x4E0),
-       INTC_VECT(SDHI1_SDHII1,0x500),
-       INTC_VECT(SDHI1_SDHII2,0x520),
+       INTC_VECT(SDHI10x4E0),
+       INTC_VECT(SDHI10x500),
+       INTC_VECT(SDHI10x520),
 
        INTC_VECT(VEU2H1_VEU2HI,0x560),
        INTC_VECT(LCDC_LCDCI,0x580),
@@ -738,15 +739,14 @@ static struct intc_group groups[] __initdata = {
        INTC_GROUP(FLCTL,FLCTL_FLSTEI,FLCTL_FLTENDI,FLCTL_FLTREQ0I,FLCTL_FLTREQ1I),
        INTC_GROUP(I2C,I2C_ALI,I2C_TACKI,I2C_WAITI,I2C_DTEI),
        INTC_GROUP(_2DG, _2DG_TRI,_2DG_INI,_2DG_CEI),
-       INTC_GROUP(SDHI1, SDHI1_SDHII0,SDHI1_SDHII1,SDHI1_SDHII2),
        INTC_GROUP(RTC, RTC_ATI,RTC_PRI,RTC_CUI),
        INTC_GROUP(DMAC1B, DMAC1B_DEI4,DMAC1B_DEI5,DMAC1B_DADERR),
-       INTC_GROUP(SDHI0,SDHI0_SDHII0,SDHI0_SDHII1,SDHI0_SDHII2),
 };
 
 static struct intc_mask_reg mask_registers[] __initdata = {
        { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
-         { 0,  TMU1_TUNI2,TMU1_TUNI1,TMU1_TUNI0,0,SDHI1_SDHII2,SDHI1_SDHII1,SDHI1_SDHII0} },
+         { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
+           0, DISABLED, ENABLED, ENABLED } },
        { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
          { VIO_VOUI, VIO_VEU2HI,VIO_BEUI,VIO_CEUI,DMAC0A_DEI3,DMAC0A_DEI2,DMAC0A_DEI1,DMAC0A_DEI0 } },
        { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
@@ -763,7 +763,8 @@ static struct intc_mask_reg mask_registers[] __initdata = {
          { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
            FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
        { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
-         { 0,SDHI0_SDHII2,SDHI0_SDHII1,SDHI0_SDHII0,0,0,SCIFA_SCIFA2,SIU_SIUI } },
+         { 0, DISABLED, ENABLED, ENABLED,
+           0, 0, SCIFA_SCIFA2, SIU_SIUI } },
        { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
          { 0, 0, 0, CMT_CMTI, 0, 0, USB_USI0,0 } },
        { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
@@ -803,9 +804,13 @@ static struct intc_mask_reg ack_registers[] __initdata = {
          { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
 };
 
-static DECLARE_INTC_DESC_ACK(intc_desc, "sh7723", vectors, groups,
-                            mask_registers, prio_registers, sense_registers,
-                            ack_registers);
+static struct intc_desc intc_desc __initdata = {
+       .name = "sh7723",
+       .force_enable = ENABLED,
+       .force_disable = DISABLED,
+       .hw = INTC_HW_DESC(vectors, groups, mask_registers,
+                          prio_registers, sense_registers, ack_registers),
+};
 
 void __init plat_irq_setup(void)
 {
index d32f96c1cc15f9ed7d911bfd4e28474f731661d7..31e3451f7e3d1d1f75312baf587847926fa2aa61 100644 (file)
@@ -714,14 +714,17 @@ void __init plat_early_device_setup(void)
 #define RAMCR_CACHE_L2FC       0x0002
 #define RAMCR_CACHE_L2E                0x0001
 #define L2_CACHE_ENABLE                (RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
-void __uses_jump_to_uncached l2_cache_init(void)
+
+void l2_cache_init(void)
 {
        /* Enable L2 cache */
-       ctrl_outl(L2_CACHE_ENABLE, RAMCR);
+       __raw_writel(L2_CACHE_ENABLE, RAMCR);
 }
 
 enum {
        UNUSED = 0,
+       ENABLED,
+       DISABLED,
 
        /* interrupt sources */
        IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
@@ -750,14 +753,12 @@ enum {
        ETHI,
        I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI,
        I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
-       SDHI0_SDHII0, SDHI0_SDHII1, SDHI0_SDHII2, SDHI0_SDHII3,
        CMT,
        TSIF,
        FSI,
        SCIFA5,
        TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
        IRDA,
-       SDHI1_SDHII0, SDHI1_SDHII1, SDHI1_SDHII2,
        JPU,
        _2DDMAC,
        MMC_MMC2I, MMC_MMC3I,
@@ -839,10 +840,10 @@ static struct intc_vect vectors[] __initdata = {
        INTC_VECT(I2C0_WAITI, 0xE40),
        INTC_VECT(I2C0_DTEI, 0xE60),
 
-       INTC_VECT(SDHI0_SDHII0, 0xE80),
-       INTC_VECT(SDHI0_SDHII1, 0xEA0),
-       INTC_VECT(SDHI0_SDHII2, 0xEC0),
-       INTC_VECT(SDHI0_SDHII3, 0xEE0),
+       INTC_VECT(SDHI0, 0xE80),
+       INTC_VECT(SDHI0, 0xEA0),
+       INTC_VECT(SDHI0, 0xEC0),
+       INTC_VECT(SDHI0, 0xEE0),
 
        INTC_VECT(CMT,    0xF00),
        INTC_VECT(TSIF,   0xF20),
@@ -855,9 +856,9 @@ static struct intc_vect vectors[] __initdata = {
 
        INTC_VECT(IRDA,    0x480),
 
-       INTC_VECT(SDHI1_SDHII0, 0x4E0),
-       INTC_VECT(SDHI1_SDHII1, 0x500),
-       INTC_VECT(SDHI1_SDHII2, 0x520),
+       INTC_VECT(SDHI1, 0x4E0),
+       INTC_VECT(SDHI1, 0x500),
+       INTC_VECT(SDHI1, 0x520),
 
        INTC_VECT(JPU, 0x560),
        INTC_VECT(_2DDMAC, 0x4A0),
@@ -883,8 +884,6 @@ static struct intc_group groups[] __initdata = {
        INTC_GROUP(DMAC0B, DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR),
        INTC_GROUP(I2C0, I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI),
        INTC_GROUP(I2C1, I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI),
-       INTC_GROUP(SDHI0, SDHI0_SDHII0, SDHI0_SDHII1, SDHI0_SDHII2, SDHI0_SDHII3),
-       INTC_GROUP(SDHI1, SDHI1_SDHII0, SDHI1_SDHII1, SDHI1_SDHII2),
        INTC_GROUP(SPU, SPU_SPUI0, SPU_SPUI1),
        INTC_GROUP(MMCIF, MMC_MMC2I, MMC_MMC3I),
 };
@@ -892,7 +891,7 @@ static struct intc_group groups[] __initdata = {
 static struct intc_mask_reg mask_registers[] __initdata = {
        { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
          { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
-           0, SDHI1_SDHII2, SDHI1_SDHII1, SDHI1_SDHII0 } },
+           0, DISABLED, ENABLED, ENABLED } },
        { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
          { VIO_VOU, VIO_VEU1, VIO_BEU0, VIO_CEU0,
            DMAC0A_DEI3, DMAC0A_DEI2, DMAC0A_DEI1, DMAC0A_DEI0 } },
@@ -914,7 +913,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
          { I2C0_DTEI, I2C0_WAITI, I2C0_TACKI, I2C0_ALI,
            I2C1_DTEI, I2C1_WAITI, I2C1_TACKI, I2C1_ALI } },
        { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
-         { SDHI0_SDHII3, SDHI0_SDHII2, SDHI0_SDHII1, SDHI0_SDHII0,
+         { DISABLED, DISABLED, ENABLED, ENABLED,
            0, 0, SCIFA5, FSI } },
        { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
          { 0, 0, 0, CMT, 0, USB1, USB0, 0 } },
@@ -961,9 +960,13 @@ static struct intc_mask_reg ack_registers[] __initdata = {
          { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
 };
 
-static DECLARE_INTC_DESC_ACK(intc_desc, "sh7724", vectors, groups,
-                            mask_registers, prio_registers, sense_registers,
-                            ack_registers);
+static struct intc_desc intc_desc __initdata = {
+       .name = "sh7724",
+       .force_enable = ENABLED,
+       .force_disable = DISABLED,
+       .hw = INTC_HW_DESC(vectors, groups, mask_registers,
+                          prio_registers, sense_registers, ack_registers),
+};
 
 void __init plat_irq_setup(void)
 {
index 37e32efbbaa77bad26d11ce8c62a6693c4a339f2..e75edf58796a48725e76a7eef3d205bfb0edb747 100644 (file)
@@ -487,17 +487,17 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7757-irl4567", vectors_irl4567,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ3-0 + IRQ7-4 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        /* select IRL mode for IRL3-0 + IRL7-4 */
-       ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        /* disable holding function, ie enable "SH-4 Mode" */
-       ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
 }
@@ -507,32 +507,32 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ7654:
                /* select IRQ mode for IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00400000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00400000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq4567);
                break;
        case IRQ_MODE_IRQ3210:
                /* select IRQ mode for IRL3-0 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00800000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00800000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq0123);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl4567);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl0123);
                break;
        default:
index 6aba26fec4163c4d6274344218ff527f638f34cb..7f6b0a5f7f82531d97e788874f9ebe99181f705d 100644 (file)
@@ -538,11 +538,11 @@ static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7763-irl3210", irl_vectors,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ7-0 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        register_intc_controller(&intc_desc);
 }
@@ -552,27 +552,27 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ:
                /* select IRQ mode for IRL3-0 + IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
                register_intc_controller(&intc_irq_desc);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl7654_desc);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl3210_desc);
                break;
        default:
index c1643bc9590d8a46581b9569bc2adf4516044ec6..86d681ecf90ee696e278648e3399a581c62b1479 100644 (file)
@@ -694,17 +694,17 @@ static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ7-0 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        /* select IRL mode for IRL3-0 + IRL7-4 */
-       ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        /* disable holding function, ie enable "SH-4 Mode" */
-       ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
 }
@@ -714,27 +714,27 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ:
                /* select IRQ mode for IRL3-0 + IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
                register_intc_controller(&intc_irq_desc);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl7654_desc);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl3210_desc);
                break;
        default:
index c310558490d590a52ffa5e1cbdb7055ca3d09fae..f8f21618d78597f9b3a7b1ca352abb9b6a4d0ce7 100644 (file)
@@ -461,17 +461,17 @@ static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ7-0 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        /* select IRL mode for IRL3-0 + IRL7-4 */
-       ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        /* disable holding function, ie enable "SH-4 Mode" */
-       ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
 }
@@ -481,27 +481,27 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ:
                /* select IRQ mode for IRL3-0 + IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
                register_intc_controller(&intc_irq_desc);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl7654_desc);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_irl3210_desc);
                break;
        default:
index f685b9b219997afec1021bb1b03055c5e84a2ecb..23448d8c6711d9c6c16f6290438afea72b76f7cf 100644 (file)
@@ -541,17 +541,17 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7785-irl4567", vectors_irl4567,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ3-0 + IRQ7-4 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        /* select IRL mode for IRL3-0 + IRL7-4 */
-       ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        /* disable holding function, ie enable "SH-4 Mode" */
-       ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
 }
@@ -561,32 +561,32 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ7654:
                /* select IRQ mode for IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00400000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00400000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq4567);
                break;
        case IRQ_MODE_IRQ3210:
                /* select IRQ mode for IRL3-0 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00800000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00800000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq0123);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl4567);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl0123);
                break;
        default:
index 71673487ace028c9889c3bd9bcaf0e5b203e8ed9..7e585320710a16a68bac17f5c25348b7e0f40913 100644 (file)
@@ -867,14 +867,14 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567,
 void __init plat_irq_setup(void)
 {
        /* disable IRQ3-0 + IRQ7-4 */
-       ctrl_outl(0xff000000, INTC_INTMSK0);
+       __raw_writel(0xff000000, INTC_INTMSK0);
 
        /* disable IRL3-0 + IRL7-4 */
-       ctrl_outl(0xc0000000, INTC_INTMSK1);
-       ctrl_outl(0xfffefffe, INTC_INTMSK2);
+       __raw_writel(0xc0000000, INTC_INTMSK1);
+       __raw_writel(0xfffefffe, INTC_INTMSK2);
 
        /* select IRL mode for IRL3-0 + IRL7-4 */
-       ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
+       __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
 }
@@ -884,32 +884,32 @@ void __init plat_irq_setup_pins(int mode)
        switch (mode) {
        case IRQ_MODE_IRQ7654:
                /* select IRQ mode for IRL7-4 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00400000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00400000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq4567);
                break;
        case IRQ_MODE_IRQ3210:
                /* select IRQ mode for IRL3-0 */
-               ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00800000, INTC_ICR0);
+               __raw_writel(__raw_readl(INTC_ICR0) | 0x00800000, INTC_ICR0);
                register_intc_controller(&intc_desc_irq0123);
                break;
        case IRQ_MODE_IRL7654:
                /* enable IRL7-4 but don't provide any masking */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
-               ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL3210:
                /* enable IRL0-3 but don't provide any masking */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
-               ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
                break;
        case IRQ_MODE_IRL7654_MASK:
                /* enable IRL7-4 and mask using cpu intc controller */
-               ctrl_outl(0x40000000, INTC_INTMSKCLR1);
+               __raw_writel(0x40000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl4567);
                break;
        case IRQ_MODE_IRL3210_MASK:
                /* enable IRL0-3 and mask using cpu intc controller */
-               ctrl_outl(0x80000000, INTC_INTMSKCLR1);
+               __raw_writel(0x80000000, INTC_INTMSKCLR1);
                register_intc_controller(&intc_desc_irl0123);
                break;
        default:
index 5863e0c4d02f03e9d4993bc4197736410cd00401..11bf4c1e25c0ae9a562972ff0f80d8d0f7df7b0c 100644 (file)
@@ -78,7 +78,10 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
 
 void plat_start_cpu(unsigned int cpu, unsigned long entry_point)
 {
-       __raw_writel(entry_point, RESET_REG(cpu));
+       if (__in_29bit_mode())
+               __raw_writel(entry_point, RESET_REG(cpu));
+       else
+               __raw_writel(virt_to_phys(entry_point), RESET_REG(cpu));
 
        if (!(__raw_readl(STBCR_REG(cpu)) & STBCR_MSTP))
                __raw_writel(STBCR_MSTP, STBCR_REG(cpu));
diff --git a/arch/sh/kernel/cpu/sh4a/ubc.c b/arch/sh/kernel/cpu/sh4a/ubc.c
new file mode 100644 (file)
index 0000000..efb2745
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * arch/sh/kernel/cpu/sh4a/ubc.c
+ *
+ * On-chip UBC support for SH-4A CPUs.
+ *
+ * Copyright (C) 2009 - 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <asm/hw_breakpoint.h>
+
+#define UBC_CBR(idx)   (0xff200000 + (0x20 * idx))
+#define UBC_CRR(idx)   (0xff200004 + (0x20 * idx))
+#define UBC_CAR(idx)   (0xff200008 + (0x20 * idx))
+#define UBC_CAMR(idx)  (0xff20000c + (0x20 * idx))
+
+#define UBC_CCMFR      0xff200600
+#define UBC_CBCR       0xff200620
+
+/* CRR */
+#define UBC_CRR_PCB    (1 << 1)
+#define UBC_CRR_BIE    (1 << 0)
+
+/* CBR */
+#define UBC_CBR_CE     (1 << 0)
+
+static struct sh_ubc sh4a_ubc;
+
+static void sh4a_ubc_enable(struct arch_hw_breakpoint *info, int idx)
+{
+       __raw_writel(UBC_CBR_CE | info->len | info->type, UBC_CBR(idx));
+       __raw_writel(info->address, UBC_CAR(idx));
+}
+
+static void sh4a_ubc_disable(struct arch_hw_breakpoint *info, int idx)
+{
+       __raw_writel(0, UBC_CBR(idx));
+       __raw_writel(0, UBC_CAR(idx));
+}
+
+static void sh4a_ubc_enable_all(unsigned long mask)
+{
+       int i;
+
+       for (i = 0; i < sh4a_ubc.num_events; i++)
+               if (mask & (1 << i))
+                       __raw_writel(__raw_readl(UBC_CBR(i)) | UBC_CBR_CE,
+                                    UBC_CBR(i));
+}
+
+static void sh4a_ubc_disable_all(void)
+{
+       int i;
+
+       for (i = 0; i < sh4a_ubc.num_events; i++)
+               __raw_writel(__raw_readl(UBC_CBR(i)) & ~UBC_CBR_CE,
+                            UBC_CBR(i));
+}
+
+static unsigned long sh4a_ubc_active_mask(void)
+{
+       unsigned long active = 0;
+       int i;
+
+       for (i = 0; i < sh4a_ubc.num_events; i++)
+               if (__raw_readl(UBC_CBR(i)) & UBC_CBR_CE)
+                       active |= (1 << i);
+
+       return active;
+}
+
+static unsigned long sh4a_ubc_triggered_mask(void)
+{
+       return __raw_readl(UBC_CCMFR);
+}
+
+static void sh4a_ubc_clear_triggered_mask(unsigned long mask)
+{
+       __raw_writel(__raw_readl(UBC_CCMFR) & ~mask, UBC_CCMFR);
+}
+
+static struct sh_ubc sh4a_ubc = {
+       .name                   = "SH-4A",
+       .num_events             = 2,
+       .trap_nr                = 0x1e0,
+       .enable                 = sh4a_ubc_enable,
+       .disable                = sh4a_ubc_disable,
+       .enable_all             = sh4a_ubc_enable_all,
+       .disable_all            = sh4a_ubc_disable_all,
+       .active_mask            = sh4a_ubc_active_mask,
+       .triggered_mask         = sh4a_ubc_triggered_mask,
+       .clear_triggered_mask   = sh4a_ubc_clear_triggered_mask,
+};
+
+static int __init sh4a_ubc_init(void)
+{
+       struct clk *ubc_iclk = clk_get(NULL, "ubc0");
+       int i;
+
+       /*
+        * The UBC MSTP bit is optional, as not all platforms will have
+        * it. Just ignore it if we can't find it.
+        */
+       if (IS_ERR(ubc_iclk))
+               ubc_iclk = NULL;
+
+       clk_enable(ubc_iclk);
+
+       __raw_writel(0, UBC_CBCR);
+
+       for (i = 0; i < sh4a_ubc.num_events; i++) {
+               __raw_writel(0, UBC_CAMR(i));
+               __raw_writel(0, UBC_CBR(i));
+
+               __raw_writel(UBC_CRR_BIE | UBC_CRR_PCB, UBC_CRR(i));
+
+               /* dummy read for write posting */
+               (void)__raw_readl(UBC_CRR(i));
+       }
+
+       clk_disable(ubc_iclk);
+
+       sh4a_ubc.clk = ubc_iclk;
+
+       return register_sh_ubc(&sh4a_ubc);
+}
+arch_initcall(sh4a_ubc_init);
index 7f864ebc51d3b054cb561826c69f577abc3ed144..9cfc19b8dbe465a2f8f9b7f2210bd4e238818dce 100644 (file)
@@ -24,7 +24,7 @@ static unsigned long cprc_base;
 
 static void master_clk_init(struct clk *clk)
 {
-       int idx = (ctrl_inl(cprc_base + 0x00) >> 6) & 0x0007;
+       int idx = (__raw_readl(cprc_base + 0x00) >> 6) & 0x0007;
        clk->rate *= ifc_table[idx];
 }
 
@@ -34,7 +34,7 @@ static struct clk_ops sh5_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(cprc_base) >> 12) & 0x0007;
+       int idx = (__raw_readw(cprc_base) >> 12) & 0x0007;
        return clk->parent->rate / ifc_table[idx];
 }
 
@@ -44,7 +44,7 @@ static struct clk_ops sh5_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(cprc_base) >> 3) & 0x0007;
+       int idx = (__raw_readw(cprc_base) >> 3) & 0x0007;
        return clk->parent->rate / ifc_table[idx];
 }
 
@@ -54,7 +54,7 @@ static struct clk_ops sh5_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inw(cprc_base) & 0x0007);
+       int idx = (__raw_readw(cprc_base) & 0x0007);
        return clk->parent->rate / ifc_table[idx];
 }
 
index 8f13f73cb2cbdcd74ab40419bf623b8be7c06610..6b80295dd7a4bd5a612faf9001467c5be95c150d 100644 (file)
@@ -187,7 +187,7 @@ trap_jtable:
        .rept 6
                .long do_exception_error        /* 0x880 - 0x920 */
        .endr
-       .long   do_software_break_point /* 0x940 */
+       .long   breakpoint_trap_handler /* 0x940 */
        .long   do_exception_error              /* 0x960 */
        .long   do_single_step          /* 0x980 */
 
@@ -1124,7 +1124,7 @@ fpu_error_or_IRQA:
        pta     its_IRQ, tr0
        beqi/l  r4, EVENT_INTERRUPT, tr0
 #ifdef CONFIG_SH_FPU
-       movi    do_fpu_state_restore, r6
+       movi    fpu_state_restore_trap_handler, r6
 #else
        movi    do_exception_error, r6
 #endif
@@ -1135,7 +1135,7 @@ fpu_error_or_IRQB:
        pta     its_IRQ, tr0
        beqi/l  r4, EVENT_INTERRUPT, tr0
 #ifdef CONFIG_SH_FPU
-       movi    do_fpu_state_restore, r6
+       movi    fpu_state_restore_trap_handler, r6
 #else
        movi    do_exception_error, r6
 #endif
index 4648ccee6c4d2b5ebdf20fb58db5387022ebc2cc..4b3bb35e99f3701db410d641d810d929ba853677 100644 (file)
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <asm/processor.h>
-#include <asm/user.h>
-#include <asm/io.h>
-#include <asm/fpu.h>
-
-/*
- * Initially load the FPU with signalling NANS.  This bit pattern
- * has the property that no matter whether considered as single or as
- * double precision, it still represents a signalling NAN.
- */
-#define sNAN64         0xFFFFFFFFFFFFFFFFULL
-#define sNAN32         0xFFFFFFFFUL
-
-static union sh_fpu_union init_fpuregs = {
-       .hard = {
-               .fp_regs = { [0 ... 63] = sNAN32 },
-               .fpscr = FPSCR_INIT
-       }
-};
 
 void save_fpu(struct task_struct *tsk)
 {
@@ -72,12 +54,11 @@ void save_fpu(struct task_struct *tsk)
                     "fgetscr   fr63\n\t"
                     "fst.s     %0, (32*8), fr63\n\t"
                : /* no output */
-               : "r" (&tsk->thread.fpu.hard)
+               : "r" (&tsk->thread.xstate->hardfpu)
                : "memory");
 }
 
-static inline void
-fpload(struct sh_fpu_hard_struct *fpregs)
+void restore_fpu(struct task_struct *tsk)
 {
        asm volatile("fld.p     %0, (0*8), fp0\n\t"
                     "fld.p     %0, (1*8), fp2\n\t"
@@ -116,16 +97,11 @@ fpload(struct sh_fpu_hard_struct *fpregs)
 
                     "fld.p     %0, (31*8), fp62\n\t"
                : /* no output */
-               : "r" (fpregs) );
-}
-
-void fpinit(struct sh_fpu_hard_struct *fpregs)
-{
-       *fpregs = init_fpuregs.hard;
+               : "r" (&tsk->thread.xstate->hardfpu)
+               : "memory");
 }
 
-asmlinkage void
-do_fpu_error(unsigned long ex, struct pt_regs *regs)
+asmlinkage void do_fpu_error(unsigned long ex, struct pt_regs *regs)
 {
        struct task_struct *tsk = current;
 
@@ -133,35 +109,6 @@ do_fpu_error(unsigned long ex, struct pt_regs *regs)
 
        tsk->thread.trap_no = 11;
        tsk->thread.error_code = 0;
-       force_sig(SIGFPE, tsk);
-}
-
-
-asmlinkage void
-do_fpu_state_restore(unsigned long ex, struct pt_regs *regs)
-{
-       void die(const char *str, struct pt_regs *regs, long err);
-
-       if (! user_mode(regs))
-               die("FPU used in kernel", regs, ex);
 
-       regs->sr &= ~SR_FD;
-
-       if (last_task_used_math == current)
-               return;
-
-       enable_fpu();
-       if (last_task_used_math != NULL)
-               /* Other processes fpu state, save away */
-               save_fpu(last_task_used_math);
-
-        last_task_used_math = current;
-        if (used_math()) {
-                fpload(&current->thread.fpu.hard);
-        } else {
-               /* First time FPU user.  */
-               fpload(&init_fpuregs.hard);
-                set_used_math();
-        }
-       disable_fpu();
+       force_sig(SIGFPE, tsk);
 }
index ca029a44743c31bd50bdd1eb63721a22d1e1a635..e55968712706ced993660240b04417ac0a59e5ca 100644 (file)
@@ -33,7 +33,8 @@ ATOMIC_NOTIFIER_HEAD(sh_mobile_post_sleep_notifier_list);
 #define SUSP_MODE_SLEEP                (SUSP_SH_SLEEP)
 #define SUSP_MODE_SLEEP_SF     (SUSP_SH_SLEEP | SUSP_SH_SF)
 #define SUSP_MODE_STANDBY_SF   (SUSP_SH_STANDBY | SUSP_SH_SF)
-#define SUSP_MODE_RSTANDBY     (SUSP_SH_RSTANDBY | SUSP_SH_MMU | SUSP_SH_SF)
+#define SUSP_MODE_RSTANDBY_SF \
+       (SUSP_SH_RSTANDBY | SUSP_SH_MMU | SUSP_SH_REGS | SUSP_SH_SF)
  /*
   * U-standby mode is unsupported since it needs bootloader hacks
   */
index e9dd7fa0abd269dee8c631788f9311e754159616..e6aac65f5750495c61ae17949b65f17a29cfac10 100644 (file)
@@ -48,8 +48,48 @@ ENTRY(sh_mobile_sleep_enter_start)
        stc     sr, r0
        mov.l   r0, @(SH_SLEEP_SR, r5)
 
-       /* save sp */
+       /* save general purpose registers to stack if needed */
+       mov.l   @(SH_SLEEP_MODE, r5), r0
+       tst     #SUSP_SH_REGS, r0
+       bt      skip_regs_save
+
+       sts.l   pr, @-r15
+       mov.l   r14, @-r15
+       mov.l   r13, @-r15
+       mov.l   r12, @-r15
+       mov.l   r11, @-r15
+       mov.l   r10, @-r15
+       mov.l   r9, @-r15
+       mov.l   r8, @-r15
+
+       /* make sure bank0 is selected, save low registers */
+       mov.l   rb_bit, r9
+       not     r9, r9
+       bsr     set_sr
+        mov    #0, r10
+
+       bsr     save_low_regs
+        nop
+
+       /* switch to bank 1, save low registers */
+       mov.l   rb_bit, r10
+       bsr     set_sr
+        mov    #-1, r9
+
+       bsr     save_low_regs
+        nop
+
+       /* switch back to bank 0 */
+       mov.l   rb_bit, r9
+       not     r9, r9
+       bsr     set_sr
+        mov    #0, r10
+
+skip_regs_save:
+
+       /* save sp, also set to internal ram */
        mov.l   r15, @(SH_SLEEP_SP, r5)
+       mov     r5, r15
 
        /* save stbcr */
        bsr     save_register
@@ -60,7 +100,7 @@ ENTRY(sh_mobile_sleep_enter_start)
        tst     #SUSP_SH_MMU, r0
        bt      skip_mmu_save_disable
 
-       /* save mmu state */
+       /* save mmu state */
        bsr     save_register
         mov    #SH_SLEEP_REG_PTEH, r0
 
@@ -177,6 +217,29 @@ get_register:
        mov.l   @(r0, r5), r0
        rts
         nop
+
+set_sr:
+       stc     sr, r8
+       and     r9, r8
+       or      r10, r8
+       ldc     r8, sr
+       rts
+        nop
+
+save_low_regs:
+       mov.l   r7, @-r15
+       mov.l   r6, @-r15
+       mov.l   r5, @-r15
+       mov.l   r4, @-r15
+       mov.l   r3, @-r15
+       mov.l   r2, @-r15
+       mov.l   r1, @-r15
+       rts
+        mov.l  r0, @-r15
+
+       .balign 4
+rb_bit:        .long   0x20000000 ! RB=1
+
 ENTRY(sh_mobile_sleep_enter_end)
 
        .balign 4
@@ -270,6 +333,40 @@ skip_restore_sf:
        icbi    @r0
 
 skip_restore_mmu:
+
+       /* restore general purpose registers if needed */
+       mov.l   @(SH_SLEEP_MODE, r5), r0
+       tst     #SUSP_SH_REGS, r0
+       bt      skip_restore_regs
+
+       /* switch to bank 1, restore low registers */
+       mov.l   _rb_bit, r10
+       bsr     _set_sr
+        mov    #-1, r9
+
+       bsr     restore_low_regs
+        nop
+
+       /* switch to bank0, restore low registers */
+       mov.l   _rb_bit, r9
+       not     r9, r9
+       bsr     _set_sr
+        mov    #0, r10
+
+       bsr     restore_low_regs
+        nop
+
+       /* restore the rest of the registers */
+       mov.l   @r15+, r8
+       mov.l   @r15+, r9
+       mov.l   @r15+, r10
+       mov.l   @r15+, r11
+       mov.l   @r15+, r12
+       mov.l   @r15+, r13
+       mov.l   @r15+, r14
+       lds.l   @r15+, pr
+
+skip_restore_regs:
        rte
         nop
 
@@ -283,6 +380,26 @@ restore_register:
        rts
         nop
 
+_set_sr:
+       stc     sr, r8
+       and     r9, r8
+       or      r10, r8
+       ldc     r8, sr
+       rts
+        nop
+
+restore_low_regs:
+       mov.l   @r15+, r0
+       mov.l   @r15+, r1
+       mov.l   @r15+, r2
+       mov.l   @r15+, r3
+       mov.l   @r15+, r4
+       mov.l   @r15+, r5
+       mov.l   @r15+, r6
+       rts
+        mov.l  @r15+, r7
+
        .balign 4
+_rb_bit:       .long   0x20000000 ! RB=1
 1:     .long   ~0x7ff
 ENTRY(sh_mobile_sleep_resume_end)
index 591741383ee6addd2fe537aa800d869b24ac26c0..7a1b46fec0f46c08c540f5c6e8f99e17275669f5 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/linkage.h>
 
 #if !defined(CONFIG_KGDB)
-#define breakpoint_trap_handler                debug_trap_handler
 #define singlestep_trap_handler                debug_trap_handler
 #endif
 
index 3576b709f052a2ec0e40e6ceb7472dd19e3643bf..bd1c497280a66b927b1b07e8eaa4817fd278920a 100644 (file)
@@ -39,10 +39,10 @@ static mempool_t *dwarf_frame_pool;
 static struct kmem_cache *dwarf_reg_cachep;
 static mempool_t *dwarf_reg_pool;
 
-static LIST_HEAD(dwarf_cie_list);
+static struct rb_root cie_root;
 static DEFINE_SPINLOCK(dwarf_cie_lock);
 
-static LIST_HEAD(dwarf_fde_list);
+static struct rb_root fde_root;
 static DEFINE_SPINLOCK(dwarf_fde_lock);
 
 static struct dwarf_cie *cached_cie;
@@ -301,7 +301,8 @@ static inline int dwarf_entry_len(char *addr, unsigned long *len)
  */
 static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
 {
-       struct dwarf_cie *cie;
+       struct rb_node **rb_node = &cie_root.rb_node;
+       struct dwarf_cie *cie = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&dwarf_cie_lock, flags);
@@ -315,16 +316,24 @@ static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
                goto out;
        }
 
-       list_for_each_entry(cie, &dwarf_cie_list, link) {
-               if (cie->cie_pointer == cie_ptr) {
-                       cached_cie = cie;
-                       break;
+       while (*rb_node) {
+               struct dwarf_cie *cie_tmp;
+
+               cie_tmp = rb_entry(*rb_node, struct dwarf_cie, node);
+               BUG_ON(!cie_tmp);
+
+               if (cie_ptr == cie_tmp->cie_pointer) {
+                       cie = cie_tmp;
+                       cached_cie = cie_tmp;
+                       goto out;
+               } else {
+                       if (cie_ptr < cie_tmp->cie_pointer)
+                               rb_node = &(*rb_node)->rb_left;
+                       else
+                               rb_node = &(*rb_node)->rb_right;
                }
        }
 
-       /* Couldn't find the entry in the list. */
-       if (&cie->link == &dwarf_cie_list)
-               cie = NULL;
 out:
        spin_unlock_irqrestore(&dwarf_cie_lock, flags);
        return cie;
@@ -336,25 +345,34 @@ out:
  */
 struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
 {
-       struct dwarf_fde *fde;
+       struct rb_node **rb_node = &fde_root.rb_node;
+       struct dwarf_fde *fde = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&dwarf_fde_lock, flags);
 
-       list_for_each_entry(fde, &dwarf_fde_list, link) {
-               unsigned long start, end;
+       while (*rb_node) {
+               struct dwarf_fde *fde_tmp;
+               unsigned long tmp_start, tmp_end;
 
-               start = fde->initial_location;
-               end = fde->initial_location + fde->address_range;
+               fde_tmp = rb_entry(*rb_node, struct dwarf_fde, node);
+               BUG_ON(!fde_tmp);
 
-               if (pc >= start && pc < end)
-                       break;
-       }
+               tmp_start = fde_tmp->initial_location;
+               tmp_end = fde_tmp->initial_location + fde_tmp->address_range;
 
-       /* Couldn't find the entry in the list. */
-       if (&fde->link == &dwarf_fde_list)
-               fde = NULL;
+               if (pc < tmp_start) {
+                       rb_node = &(*rb_node)->rb_left;
+               } else {
+                       if (pc < tmp_end) {
+                               fde = fde_tmp;
+                               goto out;
+                       } else
+                               rb_node = &(*rb_node)->rb_right;
+               }
+       }
 
+out:
        spin_unlock_irqrestore(&dwarf_fde_lock, flags);
 
        return fde;
@@ -540,6 +558,8 @@ void dwarf_free_frame(struct dwarf_frame *frame)
        mempool_free(frame, dwarf_frame_pool);
 }
 
+extern void ret_from_irq(void);
+
 /**
  *     dwarf_unwind_stack - unwind the stack
  *
@@ -550,8 +570,8 @@ void dwarf_free_frame(struct dwarf_frame *frame)
  *     on the callstack. Each of the lower (older) stack frames are
  *     linked via the "prev" member.
  */
-struct dwarf_frame * dwarf_unwind_stack(unsigned long pc,
-                                       struct dwarf_frame *prev)
+struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
+                                      struct dwarf_frame *prev)
 {
        struct dwarf_frame *frame;
        struct dwarf_cie *cie;
@@ -678,6 +698,24 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc,
        addr = frame->cfa + reg->addr;
        frame->return_addr = __raw_readl(addr);
 
+       /*
+        * Ah, the joys of unwinding through interrupts.
+        *
+        * Interrupts are tricky - the DWARF info needs to be _really_
+        * accurate and unfortunately I'm seeing a lot of bogus DWARF
+        * info. For example, I've seen interrupts occur in epilogues
+        * just after the frame pointer (r14) had been restored. The
+        * problem was that the DWARF info claimed that the CFA could be
+        * reached by using the value of the frame pointer before it was
+        * restored.
+        *
+        * So until the compiler can be trusted to produce reliable
+        * DWARF info when it really matters, let's stop unwinding once
+        * we've calculated the function that was interrupted.
+        */
+       if (prev && prev->pc == (unsigned long)ret_from_irq)
+               frame->return_addr = 0;
+
        return frame;
 
 bail:
@@ -688,6 +726,8 @@ bail:
 static int dwarf_parse_cie(void *entry, void *p, unsigned long len,
                           unsigned char *end, struct module *mod)
 {
+       struct rb_node **rb_node = &cie_root.rb_node;
+       struct rb_node *parent;
        struct dwarf_cie *cie;
        unsigned long flags;
        int count;
@@ -782,11 +822,30 @@ static int dwarf_parse_cie(void *entry, void *p, unsigned long len,
        cie->initial_instructions = p;
        cie->instructions_end = end;
 
-       cie->mod = mod;
-
        /* Add to list */
        spin_lock_irqsave(&dwarf_cie_lock, flags);
-       list_add_tail(&cie->link, &dwarf_cie_list);
+
+       while (*rb_node) {
+               struct dwarf_cie *cie_tmp;
+
+               cie_tmp = rb_entry(*rb_node, struct dwarf_cie, node);
+
+               parent = *rb_node;
+
+               if (cie->cie_pointer < cie_tmp->cie_pointer)
+                       rb_node = &parent->rb_left;
+               else if (cie->cie_pointer >= cie_tmp->cie_pointer)
+                       rb_node = &parent->rb_right;
+               else
+                       WARN_ON(1);
+       }
+
+       rb_link_node(&cie->node, parent, rb_node);
+       rb_insert_color(&cie->node, &cie_root);
+
+       if (mod != NULL)
+               list_add_tail(&cie->link, &mod->arch.cie_list);
+
        spin_unlock_irqrestore(&dwarf_cie_lock, flags);
 
        return 0;
@@ -796,6 +855,8 @@ static int dwarf_parse_fde(void *entry, u32 entry_type,
                           void *start, unsigned long len,
                           unsigned char *end, struct module *mod)
 {
+       struct rb_node **rb_node = &fde_root.rb_node;
+       struct rb_node *parent;
        struct dwarf_fde *fde;
        struct dwarf_cie *cie;
        unsigned long flags;
@@ -843,11 +904,38 @@ static int dwarf_parse_fde(void *entry, u32 entry_type,
        fde->instructions = p;
        fde->end = end;
 
-       fde->mod = mod;
-
        /* Add to list. */
        spin_lock_irqsave(&dwarf_fde_lock, flags);
-       list_add_tail(&fde->link, &dwarf_fde_list);
+
+       while (*rb_node) {
+               struct dwarf_fde *fde_tmp;
+               unsigned long tmp_start, tmp_end;
+               unsigned long start, end;
+
+               fde_tmp = rb_entry(*rb_node, struct dwarf_fde, node);
+
+               start = fde->initial_location;
+               end = fde->initial_location + fde->address_range;
+
+               tmp_start = fde_tmp->initial_location;
+               tmp_end = fde_tmp->initial_location + fde_tmp->address_range;
+
+               parent = *rb_node;
+
+               if (start < tmp_start)
+                       rb_node = &parent->rb_left;
+               else if (start >= tmp_end)
+                       rb_node = &parent->rb_right;
+               else
+                       WARN_ON(1);
+       }
+
+       rb_link_node(&fde->node, parent, rb_node);
+       rb_insert_color(&fde->node, &fde_root);
+
+       if (mod != NULL)
+               list_add_tail(&fde->link, &mod->arch.fde_list);
+
        spin_unlock_irqrestore(&dwarf_fde_lock, flags);
 
        return 0;
@@ -892,19 +980,29 @@ static struct unwinder dwarf_unwinder = {
 
 static void dwarf_unwinder_cleanup(void)
 {
-       struct dwarf_cie *cie;
-       struct dwarf_fde *fde;
+       struct rb_node **fde_rb_node = &fde_root.rb_node;
+       struct rb_node **cie_rb_node = &cie_root.rb_node;
 
        /*
         * Deallocate all the memory allocated for the DWARF unwinder.
         * Traverse all the FDE/CIE lists and remove and free all the
         * memory associated with those data structures.
         */
-       list_for_each_entry(cie, &dwarf_cie_list, link)
-               kfree(cie);
+       while (*fde_rb_node) {
+               struct dwarf_fde *fde;
 
-       list_for_each_entry(fde, &dwarf_fde_list, link)
+               fde = rb_entry(*fde_rb_node, struct dwarf_fde, node);
+               rb_erase(*fde_rb_node, &fde_root);
                kfree(fde);
+       }
+
+       while (*cie_rb_node) {
+               struct dwarf_cie *cie;
+
+               cie = rb_entry(*cie_rb_node, struct dwarf_cie, node);
+               rb_erase(*cie_rb_node, &cie_root);
+               kfree(cie);
+       }
 
        kmem_cache_destroy(dwarf_reg_cachep);
        kmem_cache_destroy(dwarf_frame_cachep);
@@ -1004,6 +1102,8 @@ int module_dwarf_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
 
        /* Did we find the .eh_frame section? */
        if (i != hdr->e_shnum) {
+               INIT_LIST_HEAD(&me->arch.cie_list);
+               INIT_LIST_HEAD(&me->arch.fde_list);
                err = dwarf_parse_section((char *)start, (char *)end, me);
                if (err) {
                        printk(KERN_WARNING "%s: failed to parse DWARF info\n",
@@ -1024,38 +1124,26 @@ int module_dwarf_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
  */
 void module_dwarf_cleanup(struct module *mod)
 {
-       struct dwarf_fde *fde;
-       struct dwarf_cie *cie;
+       struct dwarf_fde *fde, *ftmp;
+       struct dwarf_cie *cie, *ctmp;
        unsigned long flags;
 
        spin_lock_irqsave(&dwarf_cie_lock, flags);
 
-again_cie:
-       list_for_each_entry(cie, &dwarf_cie_list, link) {
-               if (cie->mod == mod)
-                       break;
-       }
-
-       if (&cie->link != &dwarf_cie_list) {
+       list_for_each_entry_safe(cie, ctmp, &mod->arch.cie_list, link) {
                list_del(&cie->link);
+               rb_erase(&cie->node, &cie_root);
                kfree(cie);
-               goto again_cie;
        }
 
        spin_unlock_irqrestore(&dwarf_cie_lock, flags);
 
        spin_lock_irqsave(&dwarf_fde_lock, flags);
 
-again_fde:
-       list_for_each_entry(fde, &dwarf_fde_list, link) {
-               if (fde->mod == mod)
-                       break;
-       }
-
-       if (&fde->link != &dwarf_fde_list) {
+       list_for_each_entry_safe(fde, ftmp, &mod->arch.fde_list, link) {
                list_del(&fde->link);
+               rb_erase(&fde->node, &fde_root);
                kfree(fde);
-               goto again_fde;
        }
 
        spin_unlock_irqrestore(&dwarf_fde_lock, flags);
@@ -1074,8 +1162,6 @@ again_fde:
 static int __init dwarf_unwinder_init(void)
 {
        int err;
-       INIT_LIST_HEAD(&dwarf_cie_list);
-       INIT_LIST_HEAD(&dwarf_fde_list);
 
        dwarf_frame_cachep = kmem_cache_create("dwarf_frames",
                        sizeof(struct dwarf_frame), 0,
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
deleted file mode 100644 (file)
index f8bb50c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * arch/sh/kernel/early_printk.c
- *
- *  Copyright (C) 1999, 2000  Niibe Yutaka
- *  Copyright (C) 2002  M. R. Brown
- *  Copyright (C) 2004 - 2007  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/console.h>
-#include <linux/tty.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#include <asm/sh_bios.h>
-
-/*
- *     Print a string through the BIOS
- */
-static void sh_console_write(struct console *co, const char *s,
-                                unsigned count)
-{
-       sh_bios_console_write(s, count);
-}
-
-/*
- *     Setup initial baud/bits/parity. We do two things here:
- *     - construct a cflag setting for the first rs_open()
- *     - initialize the serial port
- *     Return non-zero if we didn't find a serial port.
- */
-static int __init sh_console_setup(struct console *co, char *options)
-{
-       int     cflag = CREAD | HUPCL | CLOCAL;
-
-       /*
-        *      Now construct a cflag setting.
-        *      TODO: this is a totally bogus cflag, as we have
-        *      no idea what serial settings the BIOS is using, or
-        *      even if its using the serial port at all.
-        */
-       cflag |= B115200 | CS8 | /*no parity*/0;
-
-       co->cflag = cflag;
-
-       return 0;
-}
-
-static struct console bios_console = {
-       .name           = "bios",
-       .write          = sh_console_write,
-       .setup          = sh_console_setup,
-       .flags          = CON_PRINTBUFFER,
-       .index          = -1,
-};
-
-static struct console *early_console;
-
-static int __init setup_early_printk(char *buf)
-{
-       int keep_early = 0;
-
-       if (!buf)
-               return 0;
-
-       if (strstr(buf, "keep"))
-               keep_early = 1;
-
-       if (!strncmp(buf, "bios", 4))
-               early_console = &bios_console;
-
-       if (likely(early_console)) {
-               if (keep_early)
-                       early_console->flags &= ~CON_BOOT;
-               else
-                       early_console->flags |= CON_BOOT;
-               register_console(early_console);
-       }
-
-       return 0;
-}
-early_param("earlyprintk", setup_early_printk);
index f0abd58c3a69c4c439e485653f3b86a4e66b94fe..2b15ae60c3a0257ed1ea48b34da0044c6a4bfaf6 100644 (file)
@@ -70,8 +70,14 @@ ret_from_exception:
        CFI_STARTPROC simple
        CFI_DEF_CFA r14, 0
        CFI_REL_OFFSET 17, 64
-       CFI_REL_OFFSET 15, 0
+       CFI_REL_OFFSET 15, 60
        CFI_REL_OFFSET 14, 56
+       CFI_REL_OFFSET 13, 52
+       CFI_REL_OFFSET 12, 48
+       CFI_REL_OFFSET 11, 44
+       CFI_REL_OFFSET 10, 40
+       CFI_REL_OFFSET 9, 36
+       CFI_REL_OFFSET 8, 32
        preempt_stop()
 ENTRY(ret_from_irq)
        !
index a48cdedc73b5f934444b7169a6cae0f583a5f562..30e13196d35bf0b96c1367788635b5778464f2ba 100644 (file)
@@ -399,12 +399,3 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
        }
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-extern unsigned long *sys_call_table;
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-       return (unsigned long)sys_call_table[nr];
-}
-#endif /* CONFIG_FTRACE_SYSCALLS */
index 1151ecdffa719e4283b32d78cd82adfc97fa97a8..fe0b743881b00eb70cc57a155a7f09635e4d20f8 100644 (file)
@@ -3,6 +3,7 @@
  *  arch/sh/kernel/head.S
  *
  *  Copyright (C) 1999, 2000  Niibe Yutaka & Kaz Kojima
+ *  Copyright (C) 2010  Matt Fleming
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -13,6 +14,8 @@
 #include <linux/init.h>
 #include <linux/linkage.h>
 #include <asm/thread_info.h>
+#include <asm/mmu.h>
+#include <cpu/mmu_context.h>
 
 #ifdef CONFIG_CPU_SH4A
 #define SYNCO()                synco
@@ -33,7 +36,7 @@ ENTRY(empty_zero_page)
        .long   1               /* LOADER_TYPE */
        .long   0x00000000      /* INITRD_START */
        .long   0x00000000      /* INITRD_SIZE */
-#if defined(CONFIG_32BIT) && defined(CONFIG_PMB_FIXED)
+#ifdef CONFIG_32BIT
        .long   0x53453f00 + 32 /* "SE?" = 32 bit */
 #else
        .long   0x53453f00 + 29 /* "SE?" = 29 bit */
@@ -82,6 +85,209 @@ ENTRY(_stext)
        ldc     r0, r7_bank     ! ... and initial thread_info
 #endif
 
+#ifdef CONFIG_PMB
+/*
+ * Reconfigure the initial PMB mappings setup by the hardware.
+ *
+ * When we boot in 32-bit MMU mode there are 2 PMB entries already
+ * setup for us.
+ *
+ * Entry       VPN        PPN      V   SZ      C       UB      WT
+ * ---------------------------------------------------------------
+ *   0     0x80000000 0x00000000   1  512MB    1       0       1
+ *   1     0xA0000000 0x00000000   1  512MB    0       0       0
+ *
+ * But we reprogram them here because we want complete control over
+ * our address space and the initial mappings may not map PAGE_OFFSET
+ * to __MEMORY_START (or even map all of our RAM).
+ *
+ * Once we've setup cached and uncached mappings we clear the rest of the
+ * PMB entries. This clearing also deals with the fact that PMB entries
+ * can persist across reboots. The PMB could have been left in any state
+ * when the reboot occurred, so to be safe we clear all entries and start
+ * with with a clean slate.
+ *
+ * The uncached mapping is constructed using the smallest possible
+ * mapping with a single unbufferable page. Only the kernel text needs to
+ * be covered via the uncached mapping so that certain functions can be
+ * run uncached.
+ *
+ * Drivers and the like that have previously abused the 1:1 identity
+ * mapping are unsupported in 32-bit mode and must specify their caching
+ * preference when page tables are constructed.
+ *
+ * This frees up the P2 space for more nefarious purposes.
+ *
+ * Register utilization is as follows:
+ *
+ *     r0 = PMB_DATA data field
+ *     r1 = PMB_DATA address field
+ *     r2 = PMB_ADDR data field
+ *     r3 = PMB_ADDR address field
+ *     r4 = PMB_E_SHIFT
+ *     r5 = remaining amount of RAM to map
+ *     r6 = PMB mapping size we're trying to use
+ *     r7 = cached_to_uncached
+ *     r8 = scratch register
+ *     r9 = scratch register
+ *     r10 = number of PMB entries we've setup
+ */
+
+       mov.l   .LMMUCR, r1     /* Flush the TLB */
+       mov.l   @r1, r0
+       or      #MMUCR_TI, r0
+       mov.l   r0, @r1
+
+       mov.l   .LMEMORY_SIZE, r5
+
+       mov     #PMB_E_SHIFT, r0
+       mov     #0x1, r4
+       shld    r0, r4
+
+       mov.l   .LFIRST_DATA_ENTRY, r0
+       mov.l   .LPMB_DATA, r1
+       mov.l   .LFIRST_ADDR_ENTRY, r2
+       mov.l   .LPMB_ADDR, r3
+
+       /*
+        * First we need to walk the PMB and figure out if there are any
+        * existing mappings that match the initial mappings VPN/PPN.
+        * If these have already been established by the bootloader, we
+        * don't bother setting up new entries here, and let the late PMB
+        * initialization take care of things instead.
+        *
+        * Note that we may need to coalesce and merge entries in order
+        * to reclaim more available PMB slots, which is much more than
+        * we want to do at this early stage.
+        */
+       mov     #0, r10
+       mov     #NR_PMB_ENTRIES, r9
+
+       mov     r1, r7          /* temporary PMB_DATA iter */
+
+.Lvalidate_existing_mappings:
+
+       mov.l   @r7, r8
+       and     r0, r8
+       cmp/eq  r0, r8          /* Check for valid __MEMORY_START mappings */
+       bt      .Lpmb_done
+
+       add     #1, r10         /* Increment the loop counter */
+       cmp/eq  r9, r10
+       bf/s    .Lvalidate_existing_mappings
+        add    r4, r7          /* Increment to the next PMB_DATA entry */
+
+       /*
+        * If we've fallen through, continue with setting up the initial
+        * mappings.
+        */
+
+       mov     r5, r7          /* cached_to_uncached */
+       mov     #0, r10
+
+#ifdef CONFIG_UNCACHED_MAPPING
+       /*
+        * Uncached mapping
+        */
+       mov     #(PMB_SZ_16M >> 2), r9
+       shll2   r9
+
+       mov     #(PMB_UB >> 8), r8
+       shll8   r8
+
+       or      r0, r8
+       or      r9, r8
+       mov.l   r8, @r1
+       mov     r2, r8
+       add     r7, r8
+       mov.l   r8, @r3
+
+       add     r4, r1
+       add     r4, r3
+       add     #1, r10
+#endif
+
+/*
+ * Iterate over all of the available sizes from largest to
+ * smallest for constructing the cached mapping.
+ */
+#define __PMB_ITER_BY_SIZE(size)                       \
+.L##size:                                              \
+       mov     #(size >> 4), r6;                       \
+       shll16  r6;                                     \
+       shll8   r6;                                     \
+                                                       \
+       cmp/hi  r5, r6;                                 \
+       bt      9999f;                                  \
+                                                       \
+       mov     #(PMB_SZ_##size##M >> 2), r9;           \
+       shll2   r9;                                     \
+                                                       \
+       /*                                              \
+        * Cached mapping                               \
+        */                                             \
+       mov     #PMB_C, r8;                             \
+       or      r0, r8;                                 \
+       or      r9, r8;                                 \
+       mov.l   r8, @r1;                                \
+       mov.l   r2, @r3;                                \
+                                                       \
+       /* Increment to the next PMB_DATA entry */      \
+       add     r4, r1;                                 \
+       /* Increment to the next PMB_ADDR entry */      \
+       add     r4, r3;                                 \
+       /* Increment number of PMB entries */           \
+       add     #1, r10;                                \
+                                                       \
+       sub     r6, r5;                                 \
+       add     r6, r0;                                 \
+       add     r6, r2;                                 \
+                                                       \
+       bra     .L##size;                               \
+9999:
+
+       __PMB_ITER_BY_SIZE(512)
+       __PMB_ITER_BY_SIZE(128)
+       __PMB_ITER_BY_SIZE(64)
+       __PMB_ITER_BY_SIZE(16)
+
+#ifdef CONFIG_UNCACHED_MAPPING
+       /*
+        * Now that we can access it, update cached_to_uncached and
+        * uncached_size.
+        */
+       mov.l   .Lcached_to_uncached, r0
+       mov.l   r7, @r0
+
+       mov.l   .Luncached_size, r0
+       mov     #1, r7
+       shll16  r7
+       shll8   r7
+       mov.l   r7, @r0
+#endif
+
+       /*
+        * Clear the remaining PMB entries.
+        *
+        * r3 = entry to begin clearing from
+        * r10 = number of entries we've setup so far
+        */
+       mov     #0, r1
+       mov     #NR_PMB_ENTRIES, r0
+
+.Lagain:
+       mov.l   r1, @r3         /* Clear PMB_ADDR entry */
+       add     #1, r10         /* Increment the loop counter */
+       cmp/eq  r0, r10
+       bf/s    .Lagain
+        add    r4, r3          /* Increment to the next PMB_ADDR entry */
+
+       mov.l   6f, r0
+       icbi    @r0
+
+.Lpmb_done:
+#endif /* CONFIG_PMB */
+
 #ifndef CONFIG_SH_NO_BSS_INIT
        /*
         * Don't clear BSS if running on slow platforms such as an RTL simulation,
@@ -131,3 +337,16 @@ ENTRY(stack_start)
 5:     .long   start_kernel
 6:     .long   sh_cpu_init
 7:     .long   init_thread_union
+
+#ifdef CONFIG_PMB
+.LPMB_ADDR:            .long   PMB_ADDR
+.LPMB_DATA:            .long   PMB_DATA
+.LFIRST_ADDR_ENTRY:    .long   PAGE_OFFSET | PMB_V
+.LFIRST_DATA_ENTRY:    .long   __MEMORY_START | PMB_V
+.LMMUCR:               .long   MMUCR
+.LMEMORY_SIZE:         .long   __MEMORY_SIZE
+#ifdef CONFIG_UNCACHED_MAPPING
+.Lcached_to_uncached:  .long   cached_to_uncached
+.Luncached_size:       .long   uncached_size
+#endif
+#endif
index 3ea765844c74838ff0c26ac5cf1730d26e449ec0..defd851abefa5c48f5972c1f063256e3ef5fe985 100644 (file)
@@ -220,7 +220,6 @@ clear_DTLB:
        add.l   r22, r63, r22           /* Sign extend */
        putcfg  r21, 0, r22             /* Set MMUDR[0].PTEH */
 
-#ifdef CONFIG_EARLY_PRINTK
        /*
         * Setup a DTLB translation for SCIF phys.
         */
@@ -231,7 +230,6 @@ clear_DTLB:
        movi    0xfa03, r22     /* 0xfa030000, fixed SCIF virt */
        shori   0x0003, r22
        putcfg  r21, 0, r22     /* PTEH last */
-#endif
 
        /*
         * Set cache behaviours.
diff --git a/arch/sh/kernel/hw_breakpoint.c b/arch/sh/kernel/hw_breakpoint.c
new file mode 100644 (file)
index 0000000..e2f1753
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * arch/sh/kernel/hw_breakpoint.c
+ *
+ * Unified kernel/user-space hardware breakpoint facility for the on-chip UBC.
+ *
+ * Copyright (C) 2009 - 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/perf_event.h>
+#include <linux/hw_breakpoint.h>
+#include <linux/percpu.h>
+#include <linux/kallsyms.h>
+#include <linux/notifier.h>
+#include <linux/kprobes.h>
+#include <linux/kdebug.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <asm/hw_breakpoint.h>
+#include <asm/mmu_context.h>
+#include <asm/ptrace.h>
+
+/*
+ * Stores the breakpoints currently in use on each breakpoint address
+ * register for each cpus
+ */
+static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]);
+
+/*
+ * A dummy placeholder for early accesses until the CPUs get a chance to
+ * register their UBCs later in the boot process.
+ */
+static struct sh_ubc ubc_dummy = { .num_events = 0 };
+
+static struct sh_ubc *sh_ubc __read_mostly = &ubc_dummy;
+
+/*
+ * Install a perf counter breakpoint.
+ *
+ * We seek a free UBC channel and use it for this breakpoint.
+ *
+ * Atomic: we hold the counter->ctx->lock and we only handle variables
+ * and registers local to this cpu.
+ */
+int arch_install_hw_breakpoint(struct perf_event *bp)
+{
+       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+       int i;
+
+       for (i = 0; i < sh_ubc->num_events; i++) {
+               struct perf_event **slot = &__get_cpu_var(bp_per_reg[i]);
+
+               if (!*slot) {
+                       *slot = bp;
+                       break;
+               }
+       }
+
+       if (WARN_ONCE(i == sh_ubc->num_events, "Can't find any breakpoint slot"))
+               return -EBUSY;
+
+       clk_enable(sh_ubc->clk);
+       sh_ubc->enable(info, i);
+
+       return 0;
+}
+
+/*
+ * Uninstall the breakpoint contained in the given counter.
+ *
+ * First we search the debug address register it uses and then we disable
+ * it.
+ *
+ * Atomic: we hold the counter->ctx->lock and we only handle variables
+ * and registers local to this cpu.
+ */
+void arch_uninstall_hw_breakpoint(struct perf_event *bp)
+{
+       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+       int i;
+
+       for (i = 0; i < sh_ubc->num_events; i++) {
+               struct perf_event **slot = &__get_cpu_var(bp_per_reg[i]);
+
+               if (*slot == bp) {
+                       *slot = NULL;
+                       break;
+               }
+       }
+
+       if (WARN_ONCE(i == sh_ubc->num_events, "Can't find any breakpoint slot"))
+               return;
+
+       sh_ubc->disable(info, i);
+       clk_disable(sh_ubc->clk);
+}
+
+static int get_hbp_len(u16 hbp_len)
+{
+       unsigned int len_in_bytes = 0;
+
+       switch (hbp_len) {
+       case SH_BREAKPOINT_LEN_1:
+               len_in_bytes = 1;
+               break;
+       case SH_BREAKPOINT_LEN_2:
+               len_in_bytes = 2;
+               break;
+       case SH_BREAKPOINT_LEN_4:
+               len_in_bytes = 4;
+               break;
+       case SH_BREAKPOINT_LEN_8:
+               len_in_bytes = 8;
+               break;
+       }
+       return len_in_bytes;
+}
+
+/*
+ * Check for virtual address in user space.
+ */
+int arch_check_va_in_userspace(unsigned long va, u16 hbp_len)
+{
+       unsigned int len;
+
+       len = get_hbp_len(hbp_len);
+
+       return (va <= TASK_SIZE - len);
+}
+
+/*
+ * Check for virtual address in kernel space.
+ */
+static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len)
+{
+       unsigned int len;
+
+       len = get_hbp_len(hbp_len);
+
+       return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
+}
+
+/*
+ * Store a breakpoint's encoded address, length, and type.
+ */
+static int arch_store_info(struct perf_event *bp)
+{
+       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+
+       /*
+        * User-space requests will always have the address field populated
+        * For kernel-addresses, either the address or symbol name can be
+        * specified.
+        */
+       if (info->name)
+               info->address = (unsigned long)kallsyms_lookup_name(info->name);
+       if (info->address)
+               return 0;
+
+       return -EINVAL;
+}
+
+int arch_bp_generic_fields(int sh_len, int sh_type,
+                          int *gen_len, int *gen_type)
+{
+       /* Len */
+       switch (sh_len) {
+       case SH_BREAKPOINT_LEN_1:
+               *gen_len = HW_BREAKPOINT_LEN_1;
+               break;
+       case SH_BREAKPOINT_LEN_2:
+               *gen_len = HW_BREAKPOINT_LEN_2;
+               break;
+       case SH_BREAKPOINT_LEN_4:
+               *gen_len = HW_BREAKPOINT_LEN_4;
+               break;
+       case SH_BREAKPOINT_LEN_8:
+               *gen_len = HW_BREAKPOINT_LEN_8;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       /* Type */
+       switch (sh_type) {
+       case SH_BREAKPOINT_READ:
+               *gen_type = HW_BREAKPOINT_R;
+       case SH_BREAKPOINT_WRITE:
+               *gen_type = HW_BREAKPOINT_W;
+               break;
+       case SH_BREAKPOINT_RW:
+               *gen_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int arch_build_bp_info(struct perf_event *bp)
+{
+       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+
+       info->address = bp->attr.bp_addr;
+
+       /* Len */
+       switch (bp->attr.bp_len) {
+       case HW_BREAKPOINT_LEN_1:
+               info->len = SH_BREAKPOINT_LEN_1;
+               break;
+       case HW_BREAKPOINT_LEN_2:
+               info->len = SH_BREAKPOINT_LEN_2;
+               break;
+       case HW_BREAKPOINT_LEN_4:
+               info->len = SH_BREAKPOINT_LEN_4;
+               break;
+       case HW_BREAKPOINT_LEN_8:
+               info->len = SH_BREAKPOINT_LEN_8;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       /* Type */
+       switch (bp->attr.bp_type) {
+       case HW_BREAKPOINT_R:
+               info->type = SH_BREAKPOINT_READ;
+               break;
+       case HW_BREAKPOINT_W:
+               info->type = SH_BREAKPOINT_WRITE;
+               break;
+       case HW_BREAKPOINT_W | HW_BREAKPOINT_R:
+               info->type = SH_BREAKPOINT_RW;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/*
+ * Validate the arch-specific HW Breakpoint register settings
+ */
+int arch_validate_hwbkpt_settings(struct perf_event *bp,
+                                 struct task_struct *tsk)
+{
+       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+       unsigned int align;
+       int ret;
+
+       ret = arch_build_bp_info(bp);
+       if (ret)
+               return ret;
+
+       ret = -EINVAL;
+
+       switch (info->len) {
+       case SH_BREAKPOINT_LEN_1:
+               align = 0;
+               break;
+       case SH_BREAKPOINT_LEN_2:
+               align = 1;
+               break;
+       case SH_BREAKPOINT_LEN_4:
+               align = 3;
+               break;
+       case SH_BREAKPOINT_LEN_8:
+               align = 7;
+               break;
+       default:
+               return ret;
+       }
+
+       ret = arch_store_info(bp);
+
+       if (ret < 0)
+               return ret;
+
+       /*
+        * Check that the low-order bits of the address are appropriate
+        * for the alignment implied by len.
+        */
+       if (info->address & align)
+               return -EINVAL;
+
+       /* Check that the virtual address is in the proper range */
+       if (tsk) {
+               if (!arch_check_va_in_userspace(info->address, info->len))
+                       return -EFAULT;
+       } else {
+               if (!arch_check_va_in_kernelspace(info->address, info->len))
+                       return -EFAULT;
+       }
+
+       return 0;
+}
+
+/*
+ * Release the user breakpoints used by ptrace
+ */
+void flush_ptrace_hw_breakpoint(struct task_struct *tsk)
+{
+       int i;
+       struct thread_struct *t = &tsk->thread;
+
+       for (i = 0; i < sh_ubc->num_events; i++) {
+               unregister_hw_breakpoint(t->ptrace_bps[i]);
+               t->ptrace_bps[i] = NULL;
+       }
+}
+
+static int __kprobes hw_breakpoint_handler(struct die_args *args)
+{
+       int cpu, i, rc = NOTIFY_STOP;
+       struct perf_event *bp;
+       unsigned int cmf, resume_mask;
+
+       /*
+        * Do an early return if none of the channels triggered.
+        */
+       cmf = sh_ubc->triggered_mask();
+       if (unlikely(!cmf))
+               return NOTIFY_DONE;
+
+       /*
+        * By default, resume all of the active channels.
+        */
+       resume_mask = sh_ubc->active_mask();
+
+       /*
+        * Disable breakpoints during exception handling.
+        */
+       sh_ubc->disable_all();
+
+       cpu = get_cpu();
+       for (i = 0; i < sh_ubc->num_events; i++) {
+               unsigned long event_mask = (1 << i);
+
+               if (likely(!(cmf & event_mask)))
+                       continue;
+
+               /*
+                * The counter may be concurrently released but that can only
+                * occur from a call_rcu() path. We can then safely fetch
+                * the breakpoint, use its callback, touch its counter
+                * while we are in an rcu_read_lock() path.
+                */
+               rcu_read_lock();
+
+               bp = per_cpu(bp_per_reg[i], cpu);
+               if (bp)
+                       rc = NOTIFY_DONE;
+
+               /*
+                * Reset the condition match flag to denote completion of
+                * exception handling.
+                */
+               sh_ubc->clear_triggered_mask(event_mask);
+
+               /*
+                * bp can be NULL due to concurrent perf counter
+                * removing.
+                */
+               if (!bp) {
+                       rcu_read_unlock();
+                       break;
+               }
+
+               /*
+                * Don't restore the channel if the breakpoint is from
+                * ptrace, as it always operates in one-shot mode.
+                */
+               if (bp->overflow_handler == ptrace_triggered)
+                       resume_mask &= ~(1 << i);
+
+               perf_bp_event(bp, args->regs);
+
+               /* Deliver the signal to userspace */
+               if (arch_check_va_in_userspace(bp->attr.bp_addr,
+                                              bp->attr.bp_len)) {
+                       siginfo_t info;
+
+                       info.si_signo = args->signr;
+                       info.si_errno = notifier_to_errno(rc);
+                       info.si_code = TRAP_HWBKPT;
+
+                       force_sig_info(args->signr, &info, current);
+               }
+
+               rcu_read_unlock();
+       }
+
+       if (cmf == 0)
+               rc = NOTIFY_DONE;
+
+       sh_ubc->enable_all(resume_mask);
+
+       put_cpu();
+
+       return rc;
+}
+
+BUILD_TRAP_HANDLER(breakpoint)
+{
+       unsigned long ex = lookup_exception_vector();
+       TRAP_HANDLER_DECL;
+
+       notify_die(DIE_BREAKPOINT, "breakpoint", regs, 0, ex, SIGTRAP);
+}
+
+/*
+ * Handle debug exception notifications.
+ */
+int __kprobes hw_breakpoint_exceptions_notify(struct notifier_block *unused,
+                                   unsigned long val, void *data)
+{
+       struct die_args *args = data;
+
+       if (val != DIE_BREAKPOINT)
+               return NOTIFY_DONE;
+
+       /*
+        * If the breakpoint hasn't been triggered by the UBC, it's
+        * probably from a debugger, so don't do anything more here.
+        *
+        * This also permits the UBC interface clock to remain off for
+        * non-UBC breakpoints, as we don't need to check the triggered
+        * or active channel masks.
+        */
+       if (args->trapnr != sh_ubc->trap_nr)
+               return NOTIFY_DONE;
+
+       return hw_breakpoint_handler(data);
+}
+
+void hw_breakpoint_pmu_read(struct perf_event *bp)
+{
+       /* TODO */
+}
+
+void hw_breakpoint_pmu_unthrottle(struct perf_event *bp)
+{
+       /* TODO */
+}
+
+int register_sh_ubc(struct sh_ubc *ubc)
+{
+       /* Bail if it's already assigned */
+       if (sh_ubc != &ubc_dummy)
+               return -EBUSY;
+       sh_ubc = ubc;
+
+       pr_info("HW Breakpoints: %s UBC support registered\n", ubc->name);
+
+       WARN_ON(ubc->num_events > HBP_NUM);
+
+       return 0;
+}
index 6b3d706deac10954b91bb1721639ce6e91044710..0fd7b41f0a2242c0e6a59e4e00048f7bd7f01c25 100644 (file)
 #include <asm/system.h>
 #include <asm/atomic.h>
 
-static int hlt_counter;
 void (*pm_idle)(void) = NULL;
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
+
+static int hlt_counter;
 
 static int __init nohlt_setup(char *__unused)
 {
@@ -131,6 +130,15 @@ static void do_nothing(void *unused)
 {
 }
 
+void stop_this_cpu(void *unused)
+{
+       local_irq_disable();
+       cpu_clear(smp_processor_id(), cpu_online_map);
+
+       for (;;)
+               cpu_sleep();
+}
+
 /*
  * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
  * pm_idle and update to new pm_idle value. Required while changing pm_idle
index 69be603aa2d74e26eeb468501fd69cbdd567db8b..4a8bb4eeb8ad7ffc5dee5a312712fafda419028c 100644 (file)
@@ -184,31 +184,31 @@ static unsigned long long copy_word(unsigned long src_addr, int src_len,
 
        switch (src_len) {
        case 1:
-               tmp = ctrl_inb(src_addr);
+               tmp = __raw_readb(src_addr);
                break;
        case 2:
-               tmp = ctrl_inw(src_addr);
+               tmp = __raw_readw(src_addr);
                break;
        case 4:
-               tmp = ctrl_inl(src_addr);
+               tmp = __raw_readl(src_addr);
                break;
        case 8:
-               tmp = ctrl_inq(src_addr);
+               tmp = __raw_readq(src_addr);
                break;
        }
 
        switch (dst_len) {
        case 1:
-               ctrl_outb(tmp, dst_addr);
+               __raw_writeb(tmp, dst_addr);
                break;
        case 2:
-               ctrl_outw(tmp, dst_addr);
+               __raw_writew(tmp, dst_addr);
                break;
        case 4:
-               ctrl_outl(tmp, dst_addr);
+               __raw_writel(tmp, dst_addr);
                break;
        case 8:
-               ctrl_outq(tmp, dst_addr);
+               __raw_writeq(tmp, dst_addr);
                break;
        }
 
@@ -271,6 +271,8 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address)
        insn_size_t instruction;
        int tmp;
 
+       if (trapped_io_disable)
+               return 0;
        if (!lookup_tiop(address))
                return 0;
 
index 3e532d0d4a5cde48288b5d7081405ada2590860e..70c69659b8466b50ce8f3f4773f42320e765f176 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SuperH KGDB support
  *
- * Copyright (C) 2008  Paul Mundt
+ * Copyright (C) 2008 - 2009  Paul Mundt
  *
  * Single stepping taken from the old stub by Henry Bell and Jeremy Siegel.
  *
@@ -251,24 +251,60 @@ BUILD_TRAP_HANDLER(singlestep)
        local_irq_restore(flags);
 }
 
+static int __kgdb_notify(struct die_args *args, unsigned long cmd)
+{
+       int ret;
+
+       switch (cmd) {
+       case DIE_BREAKPOINT:
+               /*
+                * This means a user thread is single stepping
+                * a system call which should be ignored
+                */
+               if (test_thread_flag(TIF_SINGLESTEP))
+                       return NOTIFY_DONE;
+
+               ret = kgdb_handle_exception(args->trapnr & 0xff, args->signr,
+                                           args->err, args->regs);
+               if (ret)
+                       return NOTIFY_DONE;
+
+               break;
+       }
 
-BUILD_TRAP_HANDLER(breakpoint)
+       return NOTIFY_STOP;
+}
+
+static int
+kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
 {
        unsigned long flags;
-       TRAP_HANDLER_DECL;
+       int ret;
 
        local_irq_save(flags);
-       kgdb_handle_exception(vec >> 2, SIGTRAP, 0, regs);
+       ret = __kgdb_notify(ptr, cmd);
        local_irq_restore(flags);
+
+       return ret;
 }
 
+static struct notifier_block kgdb_notifier = {
+       .notifier_call  = kgdb_notify,
+
+       /*
+        * Lowest-prio notifier priority, we want to be notified last:
+        */
+       .priority       = -INT_MAX,
+};
+
 int kgdb_arch_init(void)
 {
-       return 0;
+       return register_die_notifier(&kgdb_notifier);
 }
 
 void kgdb_arch_exit(void)
 {
+       unregister_die_notifier(&kgdb_notifier);
 }
 
 struct kgdb_arch arch_kgdb_ops = {
index 76f280223ebd1d74abc9493cd83b9e63e3bfca3b..7672141c841bfad756aa2457b7d3320577191eae 100644 (file)
@@ -21,6 +21,8 @@
 #include <asm/mmu_context.h>
 #include <asm/io.h>
 #include <asm/cacheflush.h>
+#include <asm/sh_bios.h>
+#include <asm/reboot.h>
 
 typedef void (*relocate_new_kernel_t)(unsigned long indirection_page,
                                      unsigned long reboot_code_buffer,
@@ -28,15 +30,11 @@ typedef void (*relocate_new_kernel_t)(unsigned long indirection_page,
 
 extern const unsigned char relocate_new_kernel[];
 extern const unsigned int relocate_new_kernel_size;
-extern void *gdb_vbr_vector;
 extern void *vbr_base;
 
-void machine_shutdown(void)
-{
-}
-
-void machine_crash_shutdown(struct pt_regs *regs)
+void native_machine_crash_shutdown(struct pt_regs *regs)
 {
+       /* Nothing to do for UP, but definitely broken for SMP.. */
 }
 
 /*
@@ -117,11 +115,7 @@ void machine_kexec(struct kimage *image)
        kexec_info(image);
        flush_cache_all();
 
-#if defined(CONFIG_SH_STANDARD_BIOS)
-       asm volatile("ldc %0, vbr" :
-                    : "r" (((unsigned long) gdb_vbr_vector) - 0x100)
-                    : "memory");
-#endif
+       sh_bios_vbr_reload();
 
        /* now call it */
        rnk = (relocate_new_kernel_t) reboot_code_buffer;
index 24ea837eac5bebc4f55018e8940386bb322636bc..a9dd3abde28e3f45bbd7d7654e8717c13aed8f34 100644 (file)
@@ -68,9 +68,6 @@ perf_do_callchain(struct pt_regs *regs, struct perf_callchain_entry *entry)
 
        is_user = user_mode(regs);
 
-       if (!current || current->pid == 0)
-               return;
-
        if (is_user && current->state != TASK_RUNNING)
                return;
 
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
new file mode 100644 (file)
index 0000000..81add9b
--- /dev/null
@@ -0,0 +1,100 @@
+#include <linux/mm.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+
+struct kmem_cache *task_xstate_cachep = NULL;
+unsigned int xstate_size;
+
+int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
+{
+       *dst = *src;
+
+       if (src->thread.xstate) {
+               dst->thread.xstate = kmem_cache_alloc(task_xstate_cachep,
+                                                     GFP_KERNEL);
+               if (!dst->thread.xstate)
+                       return -ENOMEM;
+               memcpy(dst->thread.xstate, src->thread.xstate, xstate_size);
+       }
+
+       return 0;
+}
+
+void free_thread_xstate(struct task_struct *tsk)
+{
+       if (tsk->thread.xstate) {
+               kmem_cache_free(task_xstate_cachep, tsk->thread.xstate);
+               tsk->thread.xstate = NULL;
+       }
+}
+
+#if THREAD_SHIFT < PAGE_SHIFT
+static struct kmem_cache *thread_info_cache;
+
+struct thread_info *alloc_thread_info(struct task_struct *tsk)
+{
+       struct thread_info *ti;
+
+       ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
+       if (unlikely(ti == NULL))
+               return NULL;
+#ifdef CONFIG_DEBUG_STACK_USAGE
+       memset(ti, 0, THREAD_SIZE);
+#endif
+       return ti;
+}
+
+void free_thread_info(struct thread_info *ti)
+{
+       free_thread_xstate(ti->task);
+       kmem_cache_free(thread_info_cache, ti);
+}
+
+void thread_info_cache_init(void)
+{
+       thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
+                                             THREAD_SIZE, SLAB_PANIC, NULL);
+}
+#else
+struct thread_info *alloc_thread_info(struct task_struct *tsk)
+{
+#ifdef CONFIG_DEBUG_STACK_USAGE
+       gfp_t mask = GFP_KERNEL | __GFP_ZERO;
+#else
+       gfp_t mask = GFP_KERNEL;
+#endif
+       return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER);
+}
+
+void free_thread_info(struct thread_info *ti)
+{
+       free_thread_xstate(ti->task);
+       free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
+}
+#endif /* THREAD_SHIFT < PAGE_SHIFT */
+
+void arch_task_cache_init(void)
+{
+       if (!xstate_size)
+               return;
+
+       task_xstate_cachep = kmem_cache_create("task_xstate", xstate_size,
+                                              __alignof__(union thread_xstate),
+                                              SLAB_PANIC | SLAB_NOTRACK, NULL);
+}
+
+#ifdef CONFIG_SH_FPU_EMU
+# define HAVE_SOFTFP   1
+#else
+# define HAVE_SOFTFP   0
+#endif
+
+void init_thread_xstate(void)
+{
+       if (boot_cpu_data.flags & CPU_HAS_FPU)
+               xstate_size = sizeof(struct sh_fpu_hard_struct);
+       else if (HAVE_SOFTFP)
+               xstate_size = sizeof(struct sh_fpu_soft_struct);
+       else
+               xstate_size = 0;
+}
index d8af889366a44c21b225cc53c24a1f45df2f9f46..3cb88f114d7affd459d6db2db55ac67be00b5423 100644 (file)
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/elfcore.h>
-#include <linux/pm.h>
 #include <linux/kallsyms.h>
-#include <linux/kexec.h>
-#include <linux/kdebug.h>
-#include <linux/tick.h>
-#include <linux/reboot.h>
 #include <linux/fs.h>
 #include <linux/ftrace.h>
-#include <linux/preempt.h>
+#include <linux/hw_breakpoint.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
-#include <asm/pgalloc.h>
 #include <asm/system.h>
-#include <asm/ubc.h>
 #include <asm/fpu.h>
 #include <asm/syscalls.h>
-#include <asm/watchdog.h>
-
-int ubc_usercnt = 0;
-
-#ifdef CONFIG_32BIT
-static void watchdog_trigger_immediate(void)
-{
-       sh_wdt_write_cnt(0xFF);
-       sh_wdt_write_csr(0xC2);
-}
-
-void machine_restart(char * __unused)
-{
-       local_irq_disable();
-
-       /* Use watchdog timer to trigger reset */
-       watchdog_trigger_immediate();
-
-       while (1)
-               cpu_sleep();
-}
-#else
-void machine_restart(char * __unused)
-{
-       /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
-       asm volatile("ldc %0, sr\n\t"
-                    "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
-}
-#endif
-
-void machine_halt(void)
-{
-       local_irq_disable();
-
-       while (1)
-               cpu_sleep();
-}
-
-void machine_power_off(void)
-{
-       if (pm_power_off)
-               pm_power_off();
-}
 
 void show_regs(struct pt_regs * regs)
 {
@@ -91,7 +41,7 @@ void show_regs(struct pt_regs * regs)
        printk("PC  : %08lx SP  : %08lx SR  : %08lx ",
               regs->pc, regs->regs[15], regs->sr);
 #ifdef CONFIG_MMU
-       printk("TEA : %08x\n", ctrl_inl(MMU_TEA));
+       printk("TEA : %08x\n", __raw_readl(MMU_TEA));
 #else
        printk("\n");
 #endif
@@ -147,21 +97,34 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 }
 EXPORT_SYMBOL(kernel_thread);
 
+void start_thread(struct pt_regs *regs, unsigned long new_pc,
+                 unsigned long new_sp)
+{
+       set_fs(USER_DS);
+
+       regs->pr = 0;
+       regs->sr = SR_FD;
+       regs->pc = new_pc;
+       regs->regs[15] = new_sp;
+
+       free_thread_xstate(current);
+}
+EXPORT_SYMBOL(start_thread);
+
 /*
  * Free current thread data structures etc..
  */
 void exit_thread(void)
 {
-       if (current->thread.ubc_pc) {
-               current->thread.ubc_pc = 0;
-               ubc_usercnt -= 1;
-       }
 }
 
 void flush_thread(void)
 {
-#if defined(CONFIG_SH_FPU)
        struct task_struct *tsk = current;
+
+       flush_ptrace_hw_breakpoint(tsk);
+
+#if defined(CONFIG_SH_FPU)
        /* Forget lazy FPU state */
        clear_fpu(tsk, task_pt_regs(tsk));
        clear_used_math();
@@ -209,11 +172,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 {
        struct thread_info *ti = task_thread_info(p);
        struct pt_regs *childregs;
+
 #if defined(CONFIG_SH_DSP)
        struct task_struct *tsk = current;
-#endif
 
-#if defined(CONFIG_SH_DSP)
        if (is_dsp_enabled(tsk)) {
                /* We can use the __save_dsp or just copy the struct:
                 * __save_dsp(p);
@@ -244,53 +206,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
        p->thread.sp = (unsigned long) childregs;
        p->thread.pc = (unsigned long) ret_from_fork;
 
-       p->thread.ubc_pc = 0;
+       memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
 
        return 0;
 }
 
-/* Tracing by user break controller.  */
-static void ubc_set_tracing(int asid, unsigned long pc)
-{
-#if defined(CONFIG_CPU_SH4A)
-       unsigned long val;
-
-       val = (UBC_CBR_ID_INST | UBC_CBR_RW_READ | UBC_CBR_CE);
-       val |= (UBC_CBR_AIE | UBC_CBR_AIV_SET(asid));
-
-       ctrl_outl(val, UBC_CBR0);
-       ctrl_outl(pc,  UBC_CAR0);
-       ctrl_outl(0x0, UBC_CAMR0);
-       ctrl_outl(0x0, UBC_CBCR);
-
-       val = (UBC_CRR_RES | UBC_CRR_PCB | UBC_CRR_BIE);
-       ctrl_outl(val, UBC_CRR0);
-
-       /* Read UBC register that we wrote last, for checking update */
-       val = ctrl_inl(UBC_CRR0);
-
-#else  /* CONFIG_CPU_SH4A */
-       ctrl_outl(pc, UBC_BARA);
-
-#ifdef CONFIG_MMU
-       ctrl_outb(asid, UBC_BASRA);
-#endif
-
-       ctrl_outl(0, UBC_BAMRA);
-
-       if (current_cpu_data.type == CPU_SH7729 ||
-           current_cpu_data.type == CPU_SH7710 ||
-           current_cpu_data.type == CPU_SH7712 ||
-           current_cpu_data.type == CPU_SH7203){
-               ctrl_outw(BBR_INST | BBR_READ | BBR_CPU, UBC_BBRA);
-               ctrl_outl(BRCR_PCBA | BRCR_PCTE, UBC_BRCR);
-       } else {
-               ctrl_outw(BBR_INST | BBR_READ, UBC_BBRA);
-               ctrl_outw(BRCR_PCBA, UBC_BRCR);
-       }
-#endif /* CONFIG_CPU_SH4A */
-}
-
 /*
  *     switch_to(x,y) should switch tasks from x to y.
  *
@@ -304,7 +224,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
 
        /* we're going to use this soon, after a few expensive things */
        if (next->fpu_counter > 5)
-               prefetch(&next_t->fpu.hard);
+               prefetch(next_t->xstate);
 
 #ifdef CONFIG_MMU
        /*
@@ -316,32 +236,13 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
                     : "r" (task_thread_info(next)));
 #endif
 
-       /* If no tasks are using the UBC, we're done */
-       if (ubc_usercnt == 0)
-               /* If no tasks are using the UBC, we're done */;
-       else if (next->thread.ubc_pc && next->mm) {
-               int asid = 0;
-#ifdef CONFIG_MMU
-               asid |= cpu_asid(smp_processor_id(), next->mm);
-#endif
-               ubc_set_tracing(asid, next->thread.ubc_pc);
-       } else {
-#if defined(CONFIG_CPU_SH4A)
-               ctrl_outl(UBC_CBR_INIT, UBC_CBR0);
-               ctrl_outl(UBC_CRR_INIT, UBC_CRR0);
-#else
-               ctrl_outw(0, UBC_BBRA);
-               ctrl_outw(0, UBC_BBRB);
-#endif
-       }
-
        /*
         * If the task has used fpu the last 5 timeslices, just do a full
         * restore of the math state immediately to avoid the trap; the
         * chances of needing FPU soon are obviously high now
         */
        if (next->fpu_counter > 5)
-               fpu_state_restore(task_pt_regs(next));
+               __fpu_state_restore();
 
        return prev;
 }
@@ -434,20 +335,3 @@ unsigned long get_wchan(struct task_struct *p)
 
        return pc;
 }
-
-asmlinkage void break_point_trap(void)
-{
-       /* Clear tracing.  */
-#if defined(CONFIG_CPU_SH4A)
-       ctrl_outl(UBC_CBR_INIT, UBC_CBR0);
-       ctrl_outl(UBC_CRR_INIT, UBC_CRR0);
-#else
-       ctrl_outw(0, UBC_BBRA);
-       ctrl_outw(0, UBC_BBRB);
-       ctrl_outl(0, UBC_BRCR);
-#endif
-       current->thread.ubc_pc = 0;
-       ubc_usercnt -= 1;
-
-       force_sig(SIGTRAP, current);
-}
index 31f80c61b031ad5ada25630e17c71a543c9fc59a..c90957a459ac9f59bf85d82f68b2c6caba917071 100644 (file)
 
 struct task_struct *last_task_used_math = NULL;
 
-void machine_restart(char * __unused)
-{
-       extern void phys_stext(void);
-
-       phys_stext();
-}
-
-void machine_halt(void)
-{
-       for (;;);
-}
-
-void machine_power_off(void)
-{
-       __asm__ __volatile__ (
-               "sleep\n\t"
-               "synci\n\t"
-               "nop;nop;nop;nop\n\t"
-       );
-
-       panic("Unexpected wakeup!\n");
-}
-
-void show_regs(struct pt_regs * regs)
+void show_regs(struct pt_regs *regs)
 {
        unsigned long long ah, al, bh, bl, ch, cl;
 
@@ -368,7 +345,7 @@ void exit_thread(void)
 void flush_thread(void)
 {
 
-       /* Called by fs/exec.c (flush_old_exec) to remove traces of a
+       /* Called by fs/exec.c (setup_new_exec) to remove traces of a
         * previously running executable. */
 #ifdef CONFIG_SH_FPU
        if (last_task_used_math == current) {
@@ -410,7 +387,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
                        regs->sr |= SR_FD;
                }
 
-               memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
+               memcpy(fpu, &tsk->thread.xstate->hardfpu, sizeof(*fpu));
        }
 
        return fpvalid;
index 9be35f34809356f40b006c91fea36ba77deea458..c625cdab76dd4143d6001f8b3913699c26e351df 100644 (file)
@@ -2,7 +2,7 @@
  * SuperH process tracing
  *
  * Copyright (C) 1999, 2000  Kaz Kojima & Niibe Yutaka
- * Copyright (C) 2002 - 2008  Paul Mundt
+ * Copyright (C) 2002 - 2009  Paul Mundt
  *
  * Audit support by Yuichi Nakamura <ynakam@hitachisoft.jp>
  *
@@ -26,6 +26,7 @@
 #include <linux/tracehook.h>
 #include <linux/elf.h>
 #include <linux/regset.h>
+#include <linux/hw_breakpoint.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -63,33 +64,64 @@ static inline int put_stack_long(struct task_struct *task, int offset,
        return 0;
 }
 
-void user_enable_single_step(struct task_struct *child)
+void ptrace_triggered(struct perf_event *bp, int nmi,
+                     struct perf_sample_data *data, struct pt_regs *regs)
 {
-       /* Next scheduling will set up UBC */
-       if (child->thread.ubc_pc == 0)
-               ubc_usercnt += 1;
+       struct perf_event_attr attr;
+
+       /*
+        * Disable the breakpoint request here since ptrace has defined a
+        * one-shot behaviour for breakpoint exceptions.
+        */
+       attr = bp->attr;
+       attr.disabled = true;
+       modify_user_hw_breakpoint(bp, &attr);
+}
+
+static int set_single_step(struct task_struct *tsk, unsigned long addr)
+{
+       struct thread_struct *thread = &tsk->thread;
+       struct perf_event *bp;
+       struct perf_event_attr attr;
+
+       bp = thread->ptrace_bps[0];
+       if (!bp) {
+               hw_breakpoint_init(&attr);
+
+               attr.bp_addr = addr;
+               attr.bp_len = HW_BREAKPOINT_LEN_2;
+               attr.bp_type = HW_BREAKPOINT_R;
+
+               bp = register_user_hw_breakpoint(&attr, ptrace_triggered, tsk);
+               if (IS_ERR(bp))
+                       return PTR_ERR(bp);
+
+               thread->ptrace_bps[0] = bp;
+       } else {
+               int err;
+
+               attr = bp->attr;
+               attr.bp_addr = addr;
+               err = modify_user_hw_breakpoint(bp, &attr);
+               if (unlikely(err))
+                       return err;
+       }
+
+       return 0;
+}
 
-       child->thread.ubc_pc = get_stack_long(child,
-                               offsetof(struct pt_regs, pc));
+void user_enable_single_step(struct task_struct *child)
+{
+       unsigned long pc = get_stack_long(child, offsetof(struct pt_regs, pc));
 
        set_tsk_thread_flag(child, TIF_SINGLESTEP);
+
+       set_single_step(child, pc);
 }
 
 void user_disable_single_step(struct task_struct *child)
 {
        clear_tsk_thread_flag(child, TIF_SINGLESTEP);
-
-       /*
-        * Ensure the UBC is not programmed at the next context switch.
-        *
-        * Normally this is not needed but there are sequences such as
-        * singlestep, signal delivery, and continue that leave the
-        * ubc_pc non-zero leading to spurious SIGTRAPs.
-        */
-       if (child->thread.ubc_pc != 0) {
-               ubc_usercnt -= 1;
-               child->thread.ubc_pc = 0;
-       }
 }
 
 /*
@@ -163,10 +195,10 @@ int fpregs_get(struct task_struct *target,
 
        if ((boot_cpu_data.flags & CPU_HAS_FPU))
                return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
-                                          &target->thread.fpu.hard, 0, -1);
+                                          &target->thread.xstate->hardfpu, 0, -1);
 
        return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
-                                  &target->thread.fpu.soft, 0, -1);
+                                  &target->thread.xstate->softfpu, 0, -1);
 }
 
 static int fpregs_set(struct task_struct *target,
@@ -184,10 +216,10 @@ static int fpregs_set(struct task_struct *target,
 
        if ((boot_cpu_data.flags & CPU_HAS_FPU))
                return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-                                         &target->thread.fpu.hard, 0, -1);
+                                         &target->thread.xstate->hardfpu, 0, -1);
 
        return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-                                 &target->thread.fpu.soft, 0, -1);
+                                 &target->thread.xstate->softfpu, 0, -1);
 }
 
 static int fpregs_active(struct task_struct *target,
@@ -333,7 +365,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                                else
                                        tmp = 0;
                        } else
-                               tmp = ((long *)&child->thread.fpu)
+                               tmp = ((long *)child->thread.xstate)
                                        [(addr - (long)&dummy->fpu) >> 2];
                } else if (addr == (long) &dummy->u_fpvalid)
                        tmp = !!tsk_used_math(child);
@@ -362,7 +394,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                else if (addr >= (long) &dummy->fpu &&
                         addr < (long) &dummy->u_fpvalid) {
                        set_stopped_child_used_math(child);
-                       ((long *)&child->thread.fpu)
+                       ((long *)child->thread.xstate)
                                [(addr - (long)&dummy->fpu) >> 2] = data;
                        ret = 0;
                } else if (addr == (long) &dummy->u_fpvalid) {
index 873ebdc4f98efcaed37132f524f78d35fb7c9d3a..5fd644da7f022dc88380bb3422c215d578c8410d 100644 (file)
@@ -88,7 +88,7 @@ get_fpu_long(struct task_struct *task, unsigned long addr)
                regs->sr |= SR_FD;
        }
 
-       tmp = ((long *)&task->thread.fpu)[addr / sizeof(unsigned long)];
+       tmp = ((long *)task->thread.xstate)[addr / sizeof(unsigned long)];
        return tmp;
 }
 
@@ -114,8 +114,7 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
        regs = (struct pt_regs*)((unsigned char *)task + THREAD_SIZE) - 1;
 
        if (!tsk_used_math(task)) {
-               fpinit(&task->thread.fpu.hard);
-               set_stopped_child_used_math(task);
+               init_fpu(task);
        } else if (last_task_used_math == task) {
                enable_fpu();
                save_fpu(task);
@@ -124,7 +123,7 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
                regs->sr |= SR_FD;
        }
 
-       ((long *)&task->thread.fpu)[addr / sizeof(unsigned long)] = data;
+       ((long *)task->thread.xstate)[addr / sizeof(unsigned long)] = data;
        return 0;
 }
 
@@ -133,6 +132,8 @@ void user_enable_single_step(struct task_struct *child)
        struct pt_regs *regs = child->thread.uregs;
 
        regs->sr |= SR_SSTEP;   /* auto-resetting upon exception */
+
+       set_tsk_thread_flag(child, TIF_SINGLESTEP);
 }
 
 void user_disable_single_step(struct task_struct *child)
@@ -140,6 +141,8 @@ void user_disable_single_step(struct task_struct *child)
        struct pt_regs *regs = child->thread.uregs;
 
        regs->sr &= ~SR_SSTEP;
+
+       clear_tsk_thread_flag(child, TIF_SINGLESTEP);
 }
 
 static int genregs_get(struct task_struct *target,
@@ -222,7 +225,7 @@ int fpregs_get(struct task_struct *target,
                return ret;
 
        return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
-                                  &target->thread.fpu.hard, 0, -1);
+                                  &target->thread.xstate->hardfpu, 0, -1);
 }
 
 static int fpregs_set(struct task_struct *target,
@@ -239,7 +242,7 @@ static int fpregs_set(struct task_struct *target,
        set_stopped_child_used_math(target);
 
        return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-                                 &target->thread.fpu.hard, 0, -1);
+                                 &target->thread.xstate->hardfpu, 0, -1);
 }
 
 static int fpregs_active(struct task_struct *target,
@@ -454,6 +457,8 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
 
 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
 {
+       int step;
+
        if (unlikely(current->audit_context))
                audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
                                   regs->regs[9]);
@@ -461,8 +466,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
        if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
                trace_sys_exit(regs, regs->regs[9]);
 
-       if (test_thread_flag(TIF_SYSCALL_TRACE))
-               tracehook_report_syscall_exit(regs, 0);
+       step = test_thread_flag(TIF_SINGLESTEP);
+       if (step || test_thread_flag(TIF_SYSCALL_TRACE))
+               tracehook_report_syscall_exit(regs, step);
 }
 
 /* Called with interrupts disabled */
@@ -479,9 +485,10 @@ asmlinkage void do_single_step(unsigned long long vec, struct pt_regs *regs)
 }
 
 /* Called with interrupts disabled */
-asmlinkage void do_software_break_point(unsigned long long vec,
-                                       struct pt_regs *regs)
+BUILD_TRAP_HANDLER(breakpoint)
 {
+       TRAP_HANDLER_DECL;
+
        /* We need to forward step the PC, to counteract the backstep done
           in signal.c. */
        local_irq_enable();
diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
new file mode 100644 (file)
index 0000000..b1fca66
--- /dev/null
@@ -0,0 +1,98 @@
+#include <linux/pm.h>
+#include <linux/kexec.h>
+#include <linux/kernel.h>
+#include <linux/reboot.h>
+#include <linux/module.h>
+#ifdef CONFIG_SUPERH32
+#include <asm/watchdog.h>
+#endif
+#include <asm/addrspace.h>
+#include <asm/reboot.h>
+#include <asm/system.h>
+
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
+#ifdef CONFIG_SUPERH32
+static void watchdog_trigger_immediate(void)
+{
+       sh_wdt_write_cnt(0xFF);
+       sh_wdt_write_csr(0xC2);
+}
+#endif
+
+static void native_machine_restart(char * __unused)
+{
+       local_irq_disable();
+
+       /* Address error with SR.BL=1 first. */
+       trigger_address_error();
+
+#ifdef CONFIG_SUPERH32
+       /* If that fails or is unsupported, go for the watchdog next. */
+       watchdog_trigger_immediate();
+#endif
+
+       /*
+        * Give up and sleep.
+        */
+       while (1)
+               cpu_sleep();
+}
+
+static void native_machine_shutdown(void)
+{
+       smp_send_stop();
+}
+
+static void native_machine_power_off(void)
+{
+       if (pm_power_off)
+               pm_power_off();
+}
+
+static void native_machine_halt(void)
+{
+       /* stop other cpus */
+       machine_shutdown();
+
+       /* stop this cpu */
+       stop_this_cpu(NULL);
+}
+
+struct machine_ops machine_ops = {
+       .power_off      = native_machine_power_off,
+       .shutdown       = native_machine_shutdown,
+       .restart        = native_machine_restart,
+       .halt           = native_machine_halt,
+#ifdef CONFIG_KEXEC
+       .crash_shutdown = native_machine_crash_shutdown,
+#endif
+};
+
+void machine_power_off(void)
+{
+       machine_ops.power_off();
+}
+
+void machine_shutdown(void)
+{
+       machine_ops.shutdown();
+}
+
+void machine_restart(char *cmd)
+{
+       machine_ops.restart(cmd);
+}
+
+void machine_halt(void)
+{
+       machine_ops.halt();
+}
+
+#ifdef CONFIG_KEXEC
+void machine_crash_shutdown(struct pt_regs *regs)
+{
+       machine_ops.crash_shutdown(regs);
+}
+#endif
index 8b0e69792cf47faec445adc8f784d8debf4b2899..3459e70eed722c51859e01ee53fcc3bbab46dcdd 100644 (file)
@@ -421,6 +421,8 @@ void __init setup_arch(char **cmdline_p)
 
        parse_early_param();
 
+       uncached_init();
+
        plat_early_device_setup();
 
        /* Let earlyprintk output early console messages */
@@ -449,17 +451,15 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_DUMMY_CONSOLE
        conswitchp = &dummy_con;
 #endif
+       paging_init();
+       pmb_init();
+
+       ioremap_fixed_init();
 
        /* Perform the machine specific initialisation */
        if (likely(sh_mv.mv_setup))
                sh_mv.mv_setup(cmdline_p);
 
-       paging_init();
-
-#ifdef CONFIG_PMB_ENABLE
-       pmb_init();
-#endif
-
 #ifdef CONFIG_SMP
        plat_smp_setup();
 #endif
index c852f780572803b53ac346eefd3ceed994a20223..47475cca068a95e361eeba16845db285f13e1c58 100644 (file)
@@ -1,19 +1,30 @@
 /*
- *  linux/arch/sh/kernel/sh_bios.c
  *  C interface for trapping into the standard LinuxSH BIOS.
  *
  *  Copyright (C) 2000 Greg Banks, Mitch Davis
+ *  Copyright (C) 1999, 2000  Niibe Yutaka
+ *  Copyright (C) 2002  M. R. Brown
+ *  Copyright (C) 2004 - 2010  Paul Mundt
  *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
  */
 #include <linux/module.h>
+#include <linux/console.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/delay.h>
 #include <asm/sh_bios.h>
 
 #define BIOS_CALL_CONSOLE_WRITE                0
 #define BIOS_CALL_ETH_NODE_ADDR                10
 #define BIOS_CALL_SHUTDOWN             11
-#define BIOS_CALL_CHAR_OUT             0x1f    /* TODO: hack */
 #define BIOS_CALL_GDB_DETACH           0xff
 
+void *gdb_vbr_vector = NULL;
+
 static inline long sh_bios_call(long func, long arg0, long arg1, long arg2,
                                    long arg3)
 {
@@ -23,6 +34,9 @@ static inline long sh_bios_call(long func, long arg0, long arg1, long arg2,
        register long r6 __asm__("r6") = arg2;
        register long r7 __asm__("r7") = arg3;
 
+       if (!gdb_vbr_vector)
+               return -ENOSYS;
+
        __asm__ __volatile__("trapa     #0x3f":"=z"(r0)
                             :"0"(r0), "r"(r4), "r"(r5), "r"(r6), "r"(r7)
                             :"memory");
@@ -34,11 +48,6 @@ void sh_bios_console_write(const char *buf, unsigned int len)
        sh_bios_call(BIOS_CALL_CONSOLE_WRITE, (long)buf, (long)len, 0, 0);
 }
 
-void sh_bios_char_out(char ch)
-{
-       sh_bios_call(BIOS_CALL_CHAR_OUT, ch, 0, 0, 0);
-}
-
 void sh_bios_gdb_detach(void)
 {
        sh_bios_call(BIOS_CALL_GDB_DETACH, 0, 0, 0, 0);
@@ -55,3 +64,109 @@ void sh_bios_shutdown(unsigned int how)
 {
        sh_bios_call(BIOS_CALL_SHUTDOWN, how, 0, 0, 0);
 }
+
+/*
+ * Read the old value of the VBR register to initialise the vector
+ * through which debug and BIOS traps are delegated by the Linux trap
+ * handler.
+ */
+void sh_bios_vbr_init(void)
+{
+       unsigned long vbr;
+
+       if (unlikely(gdb_vbr_vector))
+               return;
+
+       __asm__ __volatile__ ("stc vbr, %0" : "=r" (vbr));
+
+       if (vbr) {
+               gdb_vbr_vector = (void *)(vbr + 0x100);
+               printk(KERN_NOTICE "Setting GDB trap vector to %p\n",
+                      gdb_vbr_vector);
+       } else
+               printk(KERN_NOTICE "SH-BIOS not detected\n");
+}
+
+/**
+ * sh_bios_vbr_reload - Re-load the system VBR from the BIOS vector.
+ *
+ * This can be used by save/restore code to reinitialize the system VBR
+ * from the fixed BIOS VBR. A no-op if no BIOS VBR is known.
+ */
+void sh_bios_vbr_reload(void)
+{
+       if (gdb_vbr_vector)
+               __asm__ __volatile__ (
+                       "ldc %0, vbr"
+                       :
+                       : "r" (((unsigned long) gdb_vbr_vector) - 0x100)
+                       : "memory"
+               );
+}
+
+/*
+ *     Print a string through the BIOS
+ */
+static void sh_console_write(struct console *co, const char *s,
+                                unsigned count)
+{
+       sh_bios_console_write(s, count);
+}
+
+/*
+ *     Setup initial baud/bits/parity. We do two things here:
+ *     - construct a cflag setting for the first rs_open()
+ *     - initialize the serial port
+ *     Return non-zero if we didn't find a serial port.
+ */
+static int __init sh_console_setup(struct console *co, char *options)
+{
+       int     cflag = CREAD | HUPCL | CLOCAL;
+
+       /*
+        *      Now construct a cflag setting.
+        *      TODO: this is a totally bogus cflag, as we have
+        *      no idea what serial settings the BIOS is using, or
+        *      even if its using the serial port at all.
+        */
+       cflag |= B115200 | CS8 | /*no parity*/0;
+
+       co->cflag = cflag;
+
+       return 0;
+}
+
+static struct console bios_console = {
+       .name           = "bios",
+       .write          = sh_console_write,
+       .setup          = sh_console_setup,
+       .flags          = CON_PRINTBUFFER,
+       .index          = -1,
+};
+
+static struct console *early_console;
+
+static int __init setup_early_printk(char *buf)
+{
+       int keep_early = 0;
+
+       if (!buf)
+               return 0;
+
+       if (strstr(buf, "keep"))
+               keep_early = 1;
+
+       if (!strncmp(buf, "bios", 4))
+               early_console = &bios_console;
+
+       if (likely(early_console)) {
+               if (keep_early)
+                       early_console->flags &= ~CON_BOOT;
+               else
+                       early_console->flags |= CON_BOOT;
+               register_console(early_console);
+       }
+
+       return 0;
+}
+early_param("earlyprintk", setup_early_printk);
index 12815ce01ecd935022eb2f13779d26eb6e74e59a..579cd2ca358d8b786fa6c38e109238c5685807e2 100644 (file)
@@ -150,7 +150,7 @@ static inline int restore_sigcontext_fpu(struct sigcontext __user *sc)
                return 0;
 
        set_used_math();
-       return __copy_from_user(&tsk->thread.fpu.hard, &sc->sc_fpregs[0],
+       return __copy_from_user(&tsk->thread.xstate->hardfpu, &sc->sc_fpregs[0],
                                sizeof(long)*(16*2+2));
 }
 
@@ -175,7 +175,7 @@ static inline int save_sigcontext_fpu(struct sigcontext __user *sc,
        clear_used_math();
 
        unlazy_fpu(tsk, regs);
-       return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.fpu.hard,
+       return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.xstate->hardfpu,
                              sizeof(long)*(16*2+2));
 }
 #endif /* CONFIG_SH_FPU */
@@ -528,7 +528,7 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
                /* fallthrough */
                case -ERESTARTNOINTR:
                        regs->regs[0] = save_r0;
-                       regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
+                       regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
                        break;
        }
 }
@@ -626,9 +626,9 @@ no_signal:
                    regs->regs[0] == -ERESTARTSYS ||
                    regs->regs[0] == -ERESTARTNOINTR) {
                        regs->regs[0] = save_r0;
-                       regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
+                       regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
                } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) {
-                       regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
+                       regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
                        regs->regs[3] = __NR_restart_syscall;
                }
        }
index ce76dbdef2940fa8e920dcbc8f4bc265a0607b5f..5a9f1f10ebf4b359f573a35f3e70ea34b88fc388 100644 (file)
@@ -118,7 +118,9 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset)
                         * clear the TS_RESTORE_SIGMASK flag.
                         */
                        current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
-                       tracehook_signal_handler(signr, &info, &ka, regs, 0);
+
+                       tracehook_signal_handler(signr, &info, &ka, regs,
+                                       test_thread_flag(TIF_SINGLESTEP));
                        return 1;
                }
        }
@@ -295,7 +297,7 @@ restore_sigcontext_fpu(struct pt_regs *regs, struct sigcontext __user *sc)
                regs->sr |= SR_FD;
        }
 
-       err |= __copy_from_user(&current->thread.fpu.hard, &sc->sc_fpregs[0],
+       err |= __copy_from_user(&current->thread.xstate->hardfpu, &sc->sc_fpregs[0],
                                (sizeof(long long) * 32) + (sizeof(int) * 1));
 
        return err;
@@ -320,7 +322,7 @@ setup_sigcontext_fpu(struct pt_regs *regs, struct sigcontext __user *sc)
                regs->sr |= SR_FD;
        }
 
-       err |= __copy_to_user(&sc->sc_fpregs[0], &current->thread.fpu.hard,
+       err |= __copy_to_user(&sc->sc_fpregs[0], &current->thread.xstate->hardfpu,
                              (sizeof(long long) * 32) + (sizeof(int) * 1));
        clear_used_math();
 
index 983e0792d5f31e8abea6fa7b99aeebcccc0c04ab..e124cf7008df46ed2e6de79f450901bd4161fbc5 100644 (file)
@@ -161,15 +161,6 @@ void smp_send_reschedule(int cpu)
        plat_send_ipi(cpu, SMP_MSG_RESCHEDULE);
 }
 
-static void stop_this_cpu(void *unused)
-{
-       cpu_clear(smp_processor_id(), cpu_online_map);
-       local_irq_disable();
-
-       for (;;)
-               cpu_relax();
-}
-
 void smp_send_stop(void)
 {
        smp_call_function(stop_this_cpu, 0, 0);
index 4bd5a1146956deafcc96afe26be07cbc5ab18b23..19fd11dd9871aadf7c6667eb9d97f473a5e813dc 100644 (file)
@@ -353,4 +353,3 @@ ENTRY(sys_call_table)
        .long sys_pwritev
        .long sys_rt_tgsigqueueinfo     /* 335 */
        .long sys_perf_event_open
-       .long sys_recvmmsg
index 07d2aaea9ae8c901406ed95197e7041cce8a939f..2048a20d7c80c4172b80f1bc3074290e935f42bd 100644 (file)
@@ -392,3 +392,4 @@ sys_call_table:
        .long sys_rt_tgsigqueueinfo
        .long sys_perf_event_open
        .long sys_recvmmsg              /* 365 */
+       .long sys_accept4
index 7b036339dc92f23a1247e6850ba23f46f4221d22..0830c2a9f712bfad77aaff2bb3a823717a567389 100644 (file)
@@ -58,7 +58,7 @@ BUILD_TRAP_HANDLER(debug)
        TRAP_HANDLER_DECL;
 
        /* Rewind */
-       regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
+       regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
 
        if (notify_die(DIE_TRAP, "debug trap", regs, 0, vec & 0xff,
                       SIGTRAP) == NOTIFY_STOP)
@@ -75,7 +75,7 @@ BUILD_TRAP_HANDLER(bug)
        TRAP_HANDLER_DECL;
 
        /* Rewind */
-       regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
+       regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
 
        if (notify_die(DIE_TRAP, "bug trap", regs, 0, TRAPA_BUG_OPCODE & 0xff,
                       SIGTRAP) == NOTIFY_STOP)
index 86639beac3a2d1d7b32e44e4ded50e1e1329bfdb..c3d86fa71ddfc9bbe2b98819fe9a2513becb5e8e 100644 (file)
 #include <linux/kdebug.h>
 #include <linux/kexec.h>
 #include <linux/limits.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
 #include <linux/sysfs.h>
+#include <linux/uaccess.h>
 #include <asm/system.h>
-#include <asm/uaccess.h>
+#include <asm/alignment.h>
 #include <asm/fpu.h>
 #include <asm/kprobes.h>
 
 #define TRAP_ILLEGAL_SLOT_INST 13
 #endif
 
-static unsigned long se_user;
-static unsigned long se_sys;
-static unsigned long se_half;
-static unsigned long se_word;
-static unsigned long se_dword;
-static unsigned long se_multi;
-/* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not
-   valid! */
-static int se_usermode = 3;
-/* 0: no warning 1: print a warning message, disabled by default */
-static int se_kernmode_warn;
-
-#ifdef CONFIG_PROC_FS
-static const char *se_usermode_action[] = {
-       "ignored",
-       "warn",
-       "fixup",
-       "fixup+warn",
-       "signal",
-       "signal+warn"
-};
-
-static int alignment_proc_show(struct seq_file *m, void *v)
-{
-       seq_printf(m, "User:\t\t%lu\n", se_user);
-       seq_printf(m, "System:\t\t%lu\n", se_sys);
-       seq_printf(m, "Half:\t\t%lu\n", se_half);
-       seq_printf(m, "Word:\t\t%lu\n", se_word);
-       seq_printf(m, "DWord:\t\t%lu\n", se_dword);
-       seq_printf(m, "Multi:\t\t%lu\n", se_multi);
-       seq_printf(m, "User faults:\t%i (%s)\n", se_usermode,
-                       se_usermode_action[se_usermode]);
-       seq_printf(m, "Kernel faults:\t%i (fixup%s)\n", se_kernmode_warn,
-                       se_kernmode_warn ? "+warn" : "");
-       return 0;
-}
-
-static int alignment_proc_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, alignment_proc_show, NULL);
-}
-
-static ssize_t alignment_proc_write(struct file *file,
-               const char __user *buffer, size_t count, loff_t *pos)
-{
-       int *data = PDE(file->f_path.dentry->d_inode)->data;
-       char mode;
-
-       if (count > 0) {
-               if (get_user(mode, buffer))
-                       return -EFAULT;
-               if (mode >= '0' && mode <= '5')
-                       *data = mode - '0';
-       }
-       return count;
-}
-
-static const struct file_operations alignment_proc_fops = {
-       .owner          = THIS_MODULE,
-       .open           = alignment_proc_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-       .write          = alignment_proc_write,
-};
-#endif
-
 static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
 {
        unsigned long p;
@@ -265,10 +197,10 @@ static int handle_unaligned_ins(insn_size_t instruction, struct pt_regs *regs,
        count = 1<<(instruction&3);
 
        switch (count) {
-       case 1: se_half  += 1; break;
-       case 2: se_word  += 1; break;
-       case 4: se_dword += 1; break;
-       case 8: se_multi += 1; break; /* ??? */
+       case 1: inc_unaligned_byte_access(); break;
+       case 2: inc_unaligned_word_access(); break;
+       case 4: inc_unaligned_dword_access(); break;
+       case 8: inc_unaligned_multi_access(); break;
        }
 
        ret = -EFAULT;
@@ -452,18 +384,8 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
        rm = regs->regs[index];
 
        /* shout about fixups */
-       if (!expected) {
-               if (user_mode(regs) && (se_usermode & 1) && printk_ratelimit())
-                       pr_notice("Fixing up unaligned userspace access "
-                                 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
-                                 current->comm, task_pid_nr(current),
-                                 (void *)regs->pc, instruction);
-               else if (se_kernmode_warn && printk_ratelimit())
-                       pr_notice("Fixing up unaligned kernel access "
-                                 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
-                                 current->comm, task_pid_nr(current),
-                                 (void *)regs->pc, instruction);
-       }
+       if (!expected)
+               unaligned_fixups_notify(current, instruction, regs);
 
        ret = -EFAULT;
        switch (instruction&0xF000) {
@@ -616,10 +538,10 @@ asmlinkage void do_address_error(struct pt_regs *regs,
 
        if (user_mode(regs)) {
                int si_code = BUS_ADRERR;
+               unsigned int user_action;
 
                local_irq_enable();
-
-               se_user += 1;
+               inc_unaligned_user_access();
 
                set_fs(USER_DS);
                if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1),
@@ -630,16 +552,12 @@ asmlinkage void do_address_error(struct pt_regs *regs,
                set_fs(oldfs);
 
                /* shout about userspace fixups */
-               if (se_usermode & 1)
-                       printk(KERN_NOTICE "Unaligned userspace access "
-                              "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
-                              current->comm, current->pid, (void *)regs->pc,
-                              instruction);
+               unaligned_fixups_notify(current, instruction, regs);
 
-               if (se_usermode & 2)
+               user_action = unaligned_user_action();
+               if (user_action & UM_FIXUP)
                        goto fixup;
-
-               if (se_usermode & 4)
+               if (user_action & UM_SIGNAL)
                        goto uspace_segv;
                else {
                        /* ignore */
@@ -659,7 +577,7 @@ fixup:
                                              &user_mem_access, 0);
                set_fs(oldfs);
 
-               if (tmp==0)
+               if (tmp == 0)
                        return; /* sorted */
 uspace_segv:
                printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned "
@@ -672,7 +590,7 @@ uspace_segv:
                info.si_addr = (void __user *)address;
                force_sig_info(SIGBUS, &info, current);
        } else {
-               se_sys += 1;
+               inc_unaligned_kernel_access();
 
                if (regs->pc & 1)
                        die("unaligned program counter", regs, error_code);
@@ -687,11 +605,7 @@ uspace_segv:
                        die("insn faulting in do_address_error", regs, 0);
                }
 
-               if (se_kernmode_warn)
-                       printk(KERN_NOTICE "Unaligned kernel access "
-                              "on behalf of \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
-                              current->comm, current->pid, (void *)regs->pc,
-                              instruction);
+               unaligned_fixups_notify(current, instruction, regs);
 
                handle_unaligned_access(instruction, regs,
                                        &user_mem_access, 0);
@@ -876,35 +790,10 @@ asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
        die_if_kernel("exception", regs, ex);
 }
 
-#if defined(CONFIG_SH_STANDARD_BIOS)
-void *gdb_vbr_vector;
-
-static inline void __init gdb_vbr_init(void)
-{
-       register unsigned long vbr;
-
-       /*
-        * Read the old value of the VBR register to initialise
-        * the vector through which debug and BIOS traps are
-        * delegated by the Linux trap handler.
-        */
-       asm volatile("stc vbr, %0" : "=r" (vbr));
-
-       gdb_vbr_vector = (void *)(vbr + 0x100);
-       printk("Setting GDB trap vector to 0x%08lx\n",
-              (unsigned long)gdb_vbr_vector);
-}
-#endif
-
 void __cpuinit per_cpu_trap_init(void)
 {
        extern void *vbr_base;
 
-#ifdef CONFIG_SH_STANDARD_BIOS
-       if (raw_smp_processor_id() == 0)
-               gdb_vbr_init();
-#endif
-
        /* NOTE: The VBR value should be at P1
           (or P2, virtural "fixed" address space).
           It's definitely should not in physical address.  */
@@ -956,11 +845,8 @@ void __init trap_init(void)
 #endif
 
 #ifdef TRAP_UBC
-       set_exception_table_vec(TRAP_UBC, break_point_trap);
+       set_exception_table_vec(TRAP_UBC, breakpoint_trap_handler);
 #endif
-
-       /* Setup VBR for boot cpu */
-       per_cpu_trap_init();
 }
 
 void show_stack(struct task_struct *tsk, unsigned long *sp)
@@ -985,34 +871,3 @@ void dump_stack(void)
        show_stack(NULL, NULL);
 }
 EXPORT_SYMBOL(dump_stack);
-
-#ifdef CONFIG_PROC_FS
-/*
- * This needs to be done after sysctl_init, otherwise sys/ will be
- * overwritten.  Actually, this shouldn't be in sys/ at all since
- * it isn't a sysctl, and it doesn't contain sysctl information.
- * We now locate it in /proc/cpu/alignment instead.
- */
-static int __init alignment_init(void)
-{
-       struct proc_dir_entry *dir, *res;
-
-       dir = proc_mkdir("cpu", NULL);
-       if (!dir)
-               return -ENOMEM;
-
-       res = proc_create_data("alignment", S_IWUSR | S_IRUGO, dir,
-                              &alignment_proc_fops, &se_usermode);
-       if (!res)
-               return -ENOMEM;
-
-        res = proc_create_data("kernel_alignment", S_IWUSR | S_IRUGO, dir,
-                              &alignment_proc_fops, &se_kernmode_warn);
-        if (!res)
-                return -ENOMEM;
-
-       return 0;
-}
-
-fs_initcall(alignment_init);
-#endif
index d86f5315a0c1422c54b888153a70927c32e5a6ca..e3f92eb05ffdb684d5392121c2cdcf0096573988 100644 (file)
@@ -611,19 +611,19 @@ static int misaligned_fpu_load(struct pt_regs *regs,
 
                switch (width_shift) {
                case 2:
-                       current->thread.fpu.hard.fp_regs[destreg] = buflo;
+                       current->thread.xstate->hardfpu.fp_regs[destreg] = buflo;
                        break;
                case 3:
                        if (do_paired_load) {
-                               current->thread.fpu.hard.fp_regs[destreg] = buflo;
-                               current->thread.fpu.hard.fp_regs[destreg+1] = bufhi;
+                               current->thread.xstate->hardfpu.fp_regs[destreg] = buflo;
+                               current->thread.xstate->hardfpu.fp_regs[destreg+1] = bufhi;
                        } else {
 #if defined(CONFIG_CPU_LITTLE_ENDIAN)
-                               current->thread.fpu.hard.fp_regs[destreg] = bufhi;
-                               current->thread.fpu.hard.fp_regs[destreg+1] = buflo;
+                               current->thread.xstate->hardfpu.fp_regs[destreg] = bufhi;
+                               current->thread.xstate->hardfpu.fp_regs[destreg+1] = buflo;
 #else
-                               current->thread.fpu.hard.fp_regs[destreg] = buflo;
-                               current->thread.fpu.hard.fp_regs[destreg+1] = bufhi;
+                               current->thread.xstate->hardfpu.fp_regs[destreg] = buflo;
+                               current->thread.xstate->hardfpu.fp_regs[destreg+1] = bufhi;
 #endif
                        }
                        break;
@@ -681,19 +681,19 @@ static int misaligned_fpu_store(struct pt_regs *regs,
 
                switch (width_shift) {
                case 2:
-                       buflo = current->thread.fpu.hard.fp_regs[srcreg];
+                       buflo = current->thread.xstate->hardfpu.fp_regs[srcreg];
                        break;
                case 3:
                        if (do_paired_load) {
-                               buflo = current->thread.fpu.hard.fp_regs[srcreg];
-                               bufhi = current->thread.fpu.hard.fp_regs[srcreg+1];
+                               buflo = current->thread.xstate->hardfpu.fp_regs[srcreg];
+                               bufhi = current->thread.xstate->hardfpu.fp_regs[srcreg+1];
                        } else {
 #if defined(CONFIG_CPU_LITTLE_ENDIAN)
-                               bufhi = current->thread.fpu.hard.fp_regs[srcreg];
-                               buflo = current->thread.fpu.hard.fp_regs[srcreg+1];
+                               bufhi = current->thread.xstate->hardfpu.fp_regs[srcreg];
+                               buflo = current->thread.xstate->hardfpu.fp_regs[srcreg+1];
 #else
-                               buflo = current->thread.fpu.hard.fp_regs[srcreg];
-                               bufhi = current->thread.fpu.hard.fp_regs[srcreg+1];
+                               buflo = current->thread.xstate->hardfpu.fp_regs[srcreg];
+                               bufhi = current->thread.xstate->hardfpu.fp_regs[srcreg+1];
 #endif
                        }
                        break;
index a1e4ec24f1f5de82450606dc8ff7cc20e8756424..7f8a709c3adaa3c9f9f5b31ca3f2c1c7a9650895 100644 (file)
@@ -3,7 +3,7 @@
  * Written by Niibe Yutaka and Paul Mundt
  */
 #ifdef CONFIG_SUPERH64
-#define LOAD_OFFSET    CONFIG_PAGE_OFFSET
+#define LOAD_OFFSET    PAGE_OFFSET
 OUTPUT_ARCH(sh:sh5)
 #else
 #define LOAD_OFFSET    0
@@ -14,17 +14,16 @@ OUTPUT_ARCH(sh)
 #include <asm/cache.h>
 #include <asm/vmlinux.lds.h>
 
+#ifdef CONFIG_PMB
+ #define MEMORY_OFFSET 0
+#else
+ #define MEMORY_OFFSET __MEMORY_START
+#endif
+
 ENTRY(_start)
 SECTIONS
 {
-#ifdef CONFIG_PMB_FIXED
-       . = CONFIG_PAGE_OFFSET + (CONFIG_MEMORY_START & 0x1fffffff) +
-           CONFIG_ZERO_PAGE_OFFSET;
-#elif defined(CONFIG_32BIT)
-       . = CONFIG_PAGE_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
-#else
-       . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
-#endif
+       . = PAGE_OFFSET + MEMORY_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
 
        _text = .;              /* Text and read-only data */
 
@@ -35,12 +34,7 @@ SECTIONS
        .text : AT(ADDR(.text) - LOAD_OFFSET) {
                HEAD_TEXT
                TEXT_TEXT
-
-#ifdef CONFIG_SUPERH64
-               *(.text64)
-               *(.text..SHmedia32)
-#endif
-
+               EXTRA_TEXT
                SCHED_TEXT
                LOCK_TEXT
                KPROBES_TEXT
@@ -51,24 +45,12 @@ SECTIONS
        } = 0x0009
 
        EXCEPTION_TABLE(16)
-
        NOTES
-       RO_DATA(PAGE_SIZE)
-
-       /*
-        * Code which must be executed uncached and the associated data
-        */
-       . = ALIGN(PAGE_SIZE);
-       .uncached : AT(ADDR(.uncached) - LOAD_OFFSET) {
-               __uncached_start = .;
-               *(.uncached.text)
-               *(.uncached.data)
-               __uncached_end = .;
-       }
 
+       _sdata = .;
+       RO_DATA(PAGE_SIZE)
        RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
-
-       _edata = .;                     /* End of data section */
+       _edata = .;
 
        DWARF_EH_FRAME
 
index d6c15cae0912b487549efc059a7370fb76cacc73..1fcdb12209754ed20fb92721ca7906a05b7d3bb9 100644 (file)
@@ -471,10 +471,10 @@ static int fpu_emulate(u16 code, struct sh_fpu_soft_struct *fregs, struct pt_reg
  *     denormal_to_double - Given denormalized float number,
  *                          store double float
  *
- *     @fpu: Pointer to sh_fpu_hard structure
+ *     @fpu: Pointer to sh_fpu_soft structure
  *     @n: Index to FP register
  */
-static void denormal_to_double(struct sh_fpu_hard_struct *fpu, int n)
+static void denormal_to_double(struct sh_fpu_soft_struct *fpu, int n)
 {
        unsigned long du, dl;
        unsigned long x = fpu->fpul;
@@ -552,11 +552,11 @@ static int ieee_fpe_handler(struct pt_regs *regs)
        if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */
                struct task_struct *tsk = current;
 
-               if ((tsk->thread.fpu.hard.fpscr & (1 << 17))) {
+               if ((tsk->thread.xstate->softfpu.fpscr & (1 << 17))) {
                        /* FPU error */
-                       denormal_to_double (&tsk->thread.fpu.hard,
+                       denormal_to_double (&tsk->thread.xstate->softfpu,
                                            (finsn >> 8) & 0xf);
-                       tsk->thread.fpu.hard.fpscr &=
+                       tsk->thread.xstate->softfpu.fpscr &=
                                ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK);
                        task_thread_info(tsk)->status |= TS_USEDFPU;
                } else {
@@ -617,7 +617,7 @@ static void fpu_init(struct sh_fpu_soft_struct *fpu)
 int do_fpu_inst(unsigned short inst, struct pt_regs *regs)
 {
        struct task_struct *tsk = current;
-       struct sh_fpu_soft_struct *fpu = &(tsk->thread.fpu.soft);
+       struct sh_fpu_soft_struct *fpu = &(tsk->thread.xstate->softfpu);
 
        if (!(task_thread_info(tsk)->status & TS_USEDFPU)) {
                /* initialize once. */
index 986a71b88ca31cf68abea4e487ab7d5441788191..1445ca6257df65640b1fd9007ab66bee52fed924 100644 (file)
@@ -75,52 +75,25 @@ config MEMORY_SIZE
 config 29BIT
        def_bool !32BIT
        depends on SUPERH32
+       select UNCACHED_MAPPING
 
 config 32BIT
        bool
        default y if CPU_SH5
 
-config PMB_ENABLE
-       bool "Support 32-bit physical addressing through PMB"
-       depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
-       help
-         If you say Y here, physical addressing will be extended to
-         32-bits through the SH-4A PMB. If this is not set, legacy
-         29-bit physical addressing will be used.
-
-choice
-       prompt "PMB handling type"
-       depends on PMB_ENABLE
-       default PMB_FIXED
-
 config PMB
-       bool "PMB"
+       bool "Support 32-bit physical addressing through PMB"
        depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
+       select 32BIT
+       select UNCACHED_MAPPING
        help
          If you say Y here, physical addressing will be extended to
          32-bits through the SH-4A PMB. If this is not set, legacy
          29-bit physical addressing will be used.
 
-config PMB_FIXED
-       bool "fixed PMB"
-       depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
-       select 32BIT
-       help
-         If this option is enabled, fixed PMB mappings are inherited
-         from the boot loader, and the kernel does not attempt dynamic
-         management. This is the closest to legacy 29-bit physical mode,
-         and allows systems to support up to 512MiB of system memory.
-
-endchoice
-
 config X2TLB
-       bool "Enable extended TLB mode"
-       depends on (CPU_SHX2 || CPU_SHX3) && MMU && EXPERIMENTAL
-       help
-         Selecting this option will enable the extended mode of the SH-X2
-         TLB. For legacy SH-X behaviour and interoperability, say N. For
-         all of the fun new features and a willingless to submit bug reports,
-         say Y.
+       def_bool y
+       depends on (CPU_SHX2 || CPU_SHX3) && MMU
 
 config VSYSCALL
        bool "Support vsyscall page"
@@ -188,14 +161,19 @@ config ARCH_MEMORY_PROBE
        def_bool y
        depends on MEMORY_HOTPLUG
 
+config IOREMAP_FIXED
+       def_bool y
+       depends on X2TLB || SUPERH64
+
+config UNCACHED_MAPPING
+       bool
+
 choice
        prompt "Kernel page size"
-       default PAGE_SIZE_8KB if X2TLB
        default PAGE_SIZE_4KB
 
 config PAGE_SIZE_4KB
        bool "4kB"
-       depends on !MMU || !X2TLB
        help
          This is the default page size used by all SuperH CPUs.
 
index 8a70535fa7cec245b99b0f1641739a34f17c10e1..3dc8a8a63822f94ada6a29ab59a8b43f4f04b07b 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the Linux SuperH-specific parts of the memory manager.
 #
 
-obj-y                  := cache.o init.o consistent.o mmap.o
+obj-y                  := alignment.o cache.o init.o consistent.o mmap.o
 
 cacheops-$(CONFIG_CPU_SH2)             := cache-sh2.o
 cacheops-$(CONFIG_CPU_SH2A)            := cache-sh2a.o
@@ -15,7 +15,7 @@ obj-y                 += $(cacheops-y)
 
 mmu-y                  := nommu.o extable_32.o
 mmu-$(CONFIG_MMU)      := extable_$(BITS).o fault_$(BITS).o \
-                          ioremap_$(BITS).o kmap.o tlbflush_$(BITS).o
+                          ioremap.o kmap.o pgtable.o tlbflush_$(BITS).o
 
 obj-y                  += $(mmu-y)
 obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
@@ -26,15 +26,17 @@ endif
 
 ifdef CONFIG_MMU
 tlb-$(CONFIG_CPU_SH3)          := tlb-sh3.o
-tlb-$(CONFIG_CPU_SH4)          := tlb-sh4.o
+tlb-$(CONFIG_CPU_SH4)          := tlb-sh4.o tlb-urb.o
 tlb-$(CONFIG_CPU_SH5)          := tlb-sh5.o
-tlb-$(CONFIG_CPU_HAS_PTEAEX)   := tlb-pteaex.o
+tlb-$(CONFIG_CPU_HAS_PTEAEX)   := tlb-pteaex.o tlb-urb.o
 obj-y                          += $(tlb-y)
 endif
 
 obj-$(CONFIG_HUGETLB_PAGE)     += hugetlbpage.o
-obj-$(CONFIG_PMB_ENABLE)       += pmb.o
+obj-$(CONFIG_PMB)              += pmb.o
 obj-$(CONFIG_NUMA)             += numa.o
+obj-$(CONFIG_IOREMAP_FIXED)    += ioremap_fixed.o
+obj-$(CONFIG_UNCACHED_MAPPING) += uncached.o
 
 # Special flags for fault_64.o.  This puts restrictions on the number of
 # caller-save registers that the compiler can target when building this file.
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c
new file mode 100644 (file)
index 0000000..b2595b8
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Alignment access counters and corresponding user-space interfaces.
+ *
+ * Copyright (C) 2009 ST Microelectronics
+ * Copyright (C) 2009 - 2010 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/seq_file.h>
+#include <linux/proc_fs.h>
+#include <linux/uaccess.h>
+#include <asm/alignment.h>
+#include <asm/processor.h>
+
+static unsigned long se_user;
+static unsigned long se_sys;
+static unsigned long se_half;
+static unsigned long se_word;
+static unsigned long se_dword;
+static unsigned long se_multi;
+/* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not
+   valid! */
+static int se_usermode = UM_WARN | UM_FIXUP;
+/* 0: no warning 1: print a warning message, disabled by default */
+static int se_kernmode_warn;
+
+core_param(alignment, se_usermode, int, 0600);
+
+void inc_unaligned_byte_access(void)
+{
+       se_half++;
+}
+
+void inc_unaligned_word_access(void)
+{
+       se_word++;
+}
+
+void inc_unaligned_dword_access(void)
+{
+       se_dword++;
+}
+
+void inc_unaligned_multi_access(void)
+{
+       se_multi++;
+}
+
+void inc_unaligned_user_access(void)
+{
+       se_user++;
+}
+
+void inc_unaligned_kernel_access(void)
+{
+       se_sys++;
+}
+
+/*
+ * This defaults to the global policy which can be set from the command
+ * line, while processes can overload their preferences via prctl().
+ */
+unsigned int unaligned_user_action(void)
+{
+       unsigned int action = se_usermode;
+
+       if (current->thread.flags & SH_THREAD_UAC_SIGBUS) {
+               action &= ~UM_FIXUP;
+               action |= UM_SIGNAL;
+       }
+
+       if (current->thread.flags & SH_THREAD_UAC_NOPRINT)
+               action &= ~UM_WARN;
+
+       return action;
+}
+
+int get_unalign_ctl(struct task_struct *tsk, unsigned long addr)
+{
+       return put_user(tsk->thread.flags & SH_THREAD_UAC_MASK,
+                       (unsigned int __user *)addr);
+}
+
+int set_unalign_ctl(struct task_struct *tsk, unsigned int val)
+{
+       tsk->thread.flags = (tsk->thread.flags & ~SH_THREAD_UAC_MASK) |
+                           (val & SH_THREAD_UAC_MASK);
+       return 0;
+}
+
+void unaligned_fixups_notify(struct task_struct *tsk, insn_size_t insn,
+                            struct pt_regs *regs)
+{
+       if (user_mode(regs) && (se_usermode & UM_WARN) && printk_ratelimit())
+               pr_notice("Fixing up unaligned userspace access "
+                         "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
+                         tsk->comm, task_pid_nr(tsk),
+                         (void *)instruction_pointer(regs), insn);
+       else if (se_kernmode_warn && printk_ratelimit())
+               pr_notice("Fixing up unaligned kernel access "
+                         "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
+                         tsk->comm, task_pid_nr(tsk),
+                         (void *)instruction_pointer(regs), insn);
+}
+
+static const char *se_usermode_action[] = {
+       "ignored",
+       "warn",
+       "fixup",
+       "fixup+warn",
+       "signal",
+       "signal+warn"
+};
+
+static int alignment_proc_show(struct seq_file *m, void *v)
+{
+       seq_printf(m, "User:\t\t%lu\n", se_user);
+       seq_printf(m, "System:\t\t%lu\n", se_sys);
+       seq_printf(m, "Half:\t\t%lu\n", se_half);
+       seq_printf(m, "Word:\t\t%lu\n", se_word);
+       seq_printf(m, "DWord:\t\t%lu\n", se_dword);
+       seq_printf(m, "Multi:\t\t%lu\n", se_multi);
+       seq_printf(m, "User faults:\t%i (%s)\n", se_usermode,
+                       se_usermode_action[se_usermode]);
+       seq_printf(m, "Kernel faults:\t%i (fixup%s)\n", se_kernmode_warn,
+                       se_kernmode_warn ? "+warn" : "");
+       return 0;
+}
+
+static int alignment_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, alignment_proc_show, NULL);
+}
+
+static ssize_t alignment_proc_write(struct file *file,
+               const char __user *buffer, size_t count, loff_t *pos)
+{
+       int *data = PDE(file->f_path.dentry->d_inode)->data;
+       char mode;
+
+       if (count > 0) {
+               if (get_user(mode, buffer))
+                       return -EFAULT;
+               if (mode >= '0' && mode <= '5')
+                       *data = mode - '0';
+       }
+       return count;
+}
+
+static const struct file_operations alignment_proc_fops = {
+       .owner          = THIS_MODULE,
+       .open           = alignment_proc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+       .write          = alignment_proc_write,
+};
+
+/*
+ * This needs to be done after sysctl_init, otherwise sys/ will be
+ * overwritten.  Actually, this shouldn't be in sys/ at all since
+ * it isn't a sysctl, and it doesn't contain sysctl information.
+ * We now locate it in /proc/cpu/alignment instead.
+ */
+static int __init alignment_init(void)
+{
+       struct proc_dir_entry *dir, *res;
+
+       dir = proc_mkdir("cpu", NULL);
+       if (!dir)
+               return -ENOMEM;
+
+       res = proc_create_data("alignment", S_IWUSR | S_IRUGO, dir,
+                              &alignment_proc_fops, &se_usermode);
+       if (!res)
+               return -ENOMEM;
+
+        res = proc_create_data("kernel_alignment", S_IWUSR | S_IRUGO, dir,
+                              &alignment_proc_fops, &se_kernmode_warn);
+        if (!res)
+                return -ENOMEM;
+
+       return 0;
+}
+fs_initcall(alignment_init);
index 5ba067b2659109caf9d013e79d59e91c4f5278eb..690ed010d00207251f8104ea119bda948849323c 100644 (file)
@@ -22,8 +22,7 @@ enum cache_type {
        CACHE_TYPE_UNIFIED,
 };
 
-static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
-                                                 void *iter)
+static int cache_seq_show(struct seq_file *file, void *iter)
 {
        unsigned int cache_type = (unsigned int)file->private;
        struct cache_info *cache;
@@ -37,7 +36,7 @@ static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
         */
        jump_to_uncached();
 
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
        if ((ccr & CCR_CACHE_ENABLE) == 0) {
                back_to_cached();
 
@@ -90,7 +89,7 @@ static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
                for (addr = addrstart, line = 0;
                     addr < addrstart + waysize;
                     addr += cache->linesz, line++) {
-                       unsigned long data = ctrl_inl(addr);
+                       unsigned long data = __raw_readl(addr);
 
                        /* Check the V bit, ignore invalid cachelines */
                        if ((data & 1) == 0)
index 699a71f463279ca7e36ebe2f47b85eafa2dfead6..defcf719f2e84eb5cae2b6be57fed58227eeb6ec 100644 (file)
@@ -28,10 +28,10 @@ static void sh2__flush_wback_region(void *start, int size)
                unsigned long addr = CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0);
                int way;
                for (way = 0; way < 4; way++) {
-                       unsigned long data =  ctrl_inl(addr | (way << 12));
+                       unsigned long data =  __raw_readl(addr | (way << 12));
                        if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
                                data &= ~SH_CACHE_UPDATED;
-                               ctrl_outl(data, addr | (way << 12));
+                               __raw_writel(data, addr | (way << 12));
                        }
                }
        }
@@ -47,7 +47,7 @@ static void sh2__flush_purge_region(void *start, int size)
                & ~(L1_CACHE_BYTES-1);
 
        for (v = begin; v < end; v+=L1_CACHE_BYTES)
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
 }
 
@@ -63,9 +63,9 @@ static void sh2__flush_invalidate_region(void *start, int size)
        local_irq_save(flags);
        jump_to_uncached();
 
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
        ccr |= CCR_CACHE_INVALIDATE;
-       ctrl_outl(ccr, CCR);
+       __raw_writel(ccr, CCR);
 
        back_to_cached();
        local_irq_restore(flags);
@@ -78,7 +78,7 @@ static void sh2__flush_invalidate_region(void *start, int size)
                & ~(L1_CACHE_BYTES-1);
 
        for (v = begin; v < end; v+=L1_CACHE_BYTES)
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
 #endif
 }
index 975899d83564e1af4abeb87015f5b2d549f80939..1f51225426a2124e9dcd9ef4769fa4cb9e73272e 100644 (file)
@@ -32,10 +32,10 @@ static void sh2a__flush_wback_region(void *start, int size)
                unsigned long addr = CACHE_OC_ADDRESS_ARRAY | (v & 0x000007f0);
                int way;
                for (way = 0; way < 4; way++) {
-                       unsigned long data =  ctrl_inl(addr | (way << 11));
+                       unsigned long data =  __raw_readl(addr | (way << 11));
                        if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
                                data &= ~SH_CACHE_UPDATED;
-                               ctrl_outl(data, addr | (way << 11));
+                               __raw_writel(data, addr | (way << 11));
                        }
                }
        }
@@ -58,7 +58,7 @@ static void sh2a__flush_purge_region(void *start, int size)
        jump_to_uncached();
 
        for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_OC_ADDRESS_ARRAY | (v & 0x000007f0) | 0x00000008);
        }
        back_to_cached();
@@ -78,17 +78,17 @@ static void sh2a__flush_invalidate_region(void *start, int size)
        jump_to_uncached();
 
 #ifdef CONFIG_CACHE_WRITEBACK
-       ctrl_outl(ctrl_inl(CCR) | CCR_OCACHE_INVALIDATE, CCR);
+       __raw_writel(__raw_readl(CCR) | CCR_OCACHE_INVALIDATE, CCR);
        /* I-cache invalidate */
        for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_IC_ADDRESS_ARRAY | (v & 0x000007f0) | 0x00000008);
        }
 #else
        for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_IC_ADDRESS_ARRAY | (v & 0x000007f0) | 0x00000008);
-               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+               __raw_writel((v & CACHE_PHYSADDR_MASK),
                          CACHE_OC_ADDRESS_ARRAY | (v & 0x000007f0) | 0x00000008);
        }
 #endif
@@ -115,14 +115,14 @@ static void sh2a_flush_icache_range(void *args)
                int way;
                /* O-Cache writeback */
                for (way = 0; way < 4; way++) {
-                       unsigned long data =  ctrl_inl(CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
+                       unsigned long data =  __raw_readl(CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
                        if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
                                data &= ~SH_CACHE_UPDATED;
-                               ctrl_outl(data, CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
+                               __raw_writel(data, CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
                        }
                }
                /* I-Cache invalidate */
-               ctrl_outl(addr,
+               __raw_writel(addr,
                          CACHE_IC_ADDRESS_ARRAY | addr | 0x00000008);
        }
 
index faef80c98134973c38ad8f6e0d80dd64cba00c84..e37523f651950b1ad38a0102155521698e40188d 100644 (file)
@@ -50,12 +50,12 @@ static void sh3__flush_wback_region(void *start, int size)
                        p = __pa(v);
                        addr = addrstart | (v & current_cpu_data.dcache.entry_mask);
                        local_irq_save(flags);
-                       data = ctrl_inl(addr);
+                       data = __raw_readl(addr);
 
                        if ((data & CACHE_PHYSADDR_MASK) ==
                            (p & CACHE_PHYSADDR_MASK)) {
                                data &= ~SH_CACHE_UPDATED;
-                               ctrl_outl(data, addr);
+                               __raw_writel(data, addr);
                                local_irq_restore(flags);
                                break;
                        }
@@ -86,7 +86,7 @@ static void sh3__flush_purge_region(void *start, int size)
                data = (v & 0xfffffc00); /* _Virtual_ address, ~U, ~V */
                addr = CACHE_OC_ADDRESS_ARRAY |
                        (v & current_cpu_data.dcache.entry_mask) | SH_CACHE_ASSOC;
-               ctrl_outl(data, addr);
+               __raw_writel(data, addr);
        }
 }
 
index 560ddb6bc8a79dd6e480255bb0aefdc45d7ac7f7..2cfae81914aaac53289df444123cfb9f5f99476d 100644 (file)
@@ -36,7 +36,7 @@ static void __flush_cache_one(unsigned long addr, unsigned long phys,
  * Called from kernel/module.c:sys_init_module and routine for a.out format,
  * signal handler code and kprobes code
  */
-static void __uses_jump_to_uncached sh4_flush_icache_range(void *args)
+static void sh4_flush_icache_range(void *args)
 {
        struct flusher_data *data = args;
        unsigned long start, end;
@@ -109,6 +109,7 @@ static inline void flush_cache_one(unsigned long start, unsigned long phys)
 static void sh4_flush_dcache_page(void *arg)
 {
        struct page *page = arg;
+       unsigned long addr = (unsigned long)page_address(page);
 #ifndef CONFIG_SMP
        struct address_space *mapping = page_mapping(page);
 
@@ -116,22 +117,14 @@ static void sh4_flush_dcache_page(void *arg)
                set_bit(PG_dcache_dirty, &page->flags);
        else
 #endif
-       {
-               unsigned long phys = page_to_phys(page);
-               unsigned long addr = CACHE_OC_ADDRESS_ARRAY;
-               int i, n;
-
-               /* Loop all the D-cache */
-               n = boot_cpu_data.dcache.n_aliases;
-               for (i = 0; i < n; i++, addr += PAGE_SIZE)
-                       flush_cache_one(addr, phys);
-       }
+               flush_cache_one(CACHE_OC_ADDRESS_ARRAY |
+                               (addr & shm_align_mask), page_to_phys(page));
 
        wmb();
 }
 
 /* TODO: Selective icache invalidation through IC address array.. */
-static void __uses_jump_to_uncached flush_icache_all(void)
+static void flush_icache_all(void)
 {
        unsigned long flags, ccr;
 
@@ -139,9 +132,9 @@ static void __uses_jump_to_uncached flush_icache_all(void)
        jump_to_uncached();
 
        /* Flush I-cache */
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
        ccr |= CCR_CACHE_ICI;
-       ctrl_outl(ccr, CCR);
+       __raw_writel(ccr, CCR);
 
        /*
         * back_to_cached() will take care of the barrier for us, don't add
@@ -384,9 +377,9 @@ extern void __weak sh4__flush_region_init(void);
 void __init sh4_cache_init(void)
 {
        printk("PVR=%08x CVR=%08x PRR=%08x\n",
-               ctrl_inl(CCN_PVR),
-               ctrl_inl(CCN_CVR),
-               ctrl_inl(CCN_PRR));
+               __raw_readl(CCN_PVR),
+               __raw_readl(CCN_CVR),
+               __raw_readl(CCN_PRR));
 
        local_flush_icache_range        = sh4_flush_icache_range;
        local_flush_dcache_page         = sh4_flush_dcache_page;
index f527fb70fce63988b92e7c1eb0c48fc0908e49a3..f498da1cce7ac5a070e3c563f94d04a1b812f17f 100644 (file)
@@ -48,10 +48,10 @@ static inline void cache_wback_all(void)
                        unsigned long data;
                        int v = SH_CACHE_UPDATED | SH_CACHE_VALID;
 
-                       data = ctrl_inl(addr);
+                       data = __raw_readl(addr);
 
                        if ((data & v) == v)
-                               ctrl_outl(data & ~v, addr);
+                               __raw_writel(data & ~v, addr);
 
                }
 
@@ -78,7 +78,7 @@ static void sh7705_flush_icache_range(void *args)
 /*
  * Writeback&Invalidate the D-cache of the page
  */
-static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys)
+static void __flush_dcache_page(unsigned long phys)
 {
        unsigned long ways, waysize, addrstart;
        unsigned long flags;
@@ -115,10 +115,10 @@ static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys)
                     addr += current_cpu_data.dcache.linesz) {
                        unsigned long data;
 
-                       data = ctrl_inl(addr) & (0x1ffffC00 | SH_CACHE_VALID);
+                       data = __raw_readl(addr) & (0x1ffffC00 | SH_CACHE_VALID);
                        if (data == phys) {
                                data &= ~(SH_CACHE_VALID | SH_CACHE_UPDATED);
-                               ctrl_outl(data, addr);
+                               __raw_writel(data, addr);
                        }
                }
 
@@ -144,7 +144,7 @@ static void sh7705_flush_dcache_page(void *arg)
                __flush_dcache_page(__pa(page_address(page)));
 }
 
-static void __uses_jump_to_uncached sh7705_flush_cache_all(void *args)
+static void sh7705_flush_cache_all(void *args)
 {
        unsigned long flags;
 
index b8607fa7ae121a36b203a83e47617cdeed29fcad..0f4095d7ac8b07a8068166725f6905ad8b5fd8d1 100644 (file)
@@ -2,7 +2,7 @@
  * arch/sh/mm/cache.c
  *
  * Copyright (C) 1999, 2000, 2002  Niibe Yutaka
- * Copyright (C) 2002 - 2009  Paul Mundt
+ * Copyright (C) 2002 - 2010  Paul Mundt
  *
  * Released under the terms of the GNU GPL v2.0.
  */
@@ -41,8 +41,17 @@ static inline void cacheop_on_each_cpu(void (*func) (void *info), void *info,
                                    int wait)
 {
        preempt_disable();
-       smp_call_function(func, info, wait);
+
+       /*
+        * It's possible that this gets called early on when IRQs are
+        * still disabled due to ioremapping by the boot CPU, so don't
+        * even attempt IPIs unless there are other CPUs online.
+        */
+       if (num_online_cpus() > 1)
+               smp_call_function(func, info, wait);
+
        func(info);
+
        preempt_enable();
 }
 
index 47530104e0ad1857a4e35171fcb4ab7864023ac7..28e22839c665d8badf9c9aa359ed555fc3f8539e 100644 (file)
@@ -53,6 +53,9 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
        if (!pud_present(*pud_k))
                return NULL;
 
+       if (!pud_present(*pud))
+           set_pud(pud, *pud_k);
+
        pmd = pmd_offset(pud, address);
        pmd_k = pmd_offset(pud_k, address);
        if (!pmd_present(*pmd_k))
index 432acd07e76a01815a26a74caeef7fa8ecfcdc0a..68028e8f26ce76a42ad5173684f1700406007802 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/sections.h>
 #include <asm/cache.h>
+#include <asm/sizes.h>
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
-#ifdef CONFIG_SUPERH32
-/*
- * Handle trivial transitions between cached and uncached
- * segments, making use of the 1:1 mapping relationship in
- * 512MB lowmem.
- *
- * This is the offset of the uncached section from its cached alias.
- * Default value only valid in 29 bit mode, in 32bit mode will be
- * overridden in pmb_init.
- */
-unsigned long cached_to_uncached = P2SEG - P1SEG;
-#endif
-
 #ifdef CONFIG_MMU
-static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
+static pte_t *__get_pte_phys(unsigned long addr)
 {
        pgd_t *pgd;
        pud_t *pud;
@@ -49,22 +37,30 @@ static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
        pgd = pgd_offset_k(addr);
        if (pgd_none(*pgd)) {
                pgd_ERROR(*pgd);
-               return;
+               return NULL;
        }
 
        pud = pud_alloc(NULL, pgd, addr);
        if (unlikely(!pud)) {
                pud_ERROR(*pud);
-               return;
+               return NULL;
        }
 
        pmd = pmd_alloc(NULL, pud, addr);
        if (unlikely(!pmd)) {
                pmd_ERROR(*pmd);
-               return;
+               return NULL;
        }
 
        pte = pte_offset_kernel(pmd, addr);
+       return pte;
+}
+
+static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
+{
+       pte_t *pte;
+
+       pte = __get_pte_phys(addr);
        if (!pte_none(*pte)) {
                pte_ERROR(*pte);
                return;
@@ -72,23 +68,24 @@ static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
 
        set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, prot));
        local_flush_tlb_one(get_asid(), addr);
+
+       if (pgprot_val(prot) & _PAGE_WIRED)
+               tlb_wire_entry(NULL, addr, *pte);
+}
+
+static void clear_pte_phys(unsigned long addr, pgprot_t prot)
+{
+       pte_t *pte;
+
+       pte = __get_pte_phys(addr);
+
+       if (pgprot_val(prot) & _PAGE_WIRED)
+               tlb_unwire_entry();
+
+       set_pte(pte, pfn_pte(0, __pgprot(0)));
+       local_flush_tlb_one(get_asid(), addr);
 }
 
-/*
- * As a performance optimization, other platforms preserve the fixmap mapping
- * across a context switch, we don't presently do this, but this could be done
- * in a similar fashion as to the wired TLB interface that sh64 uses (by way
- * of the memory mapped UTLB configuration) -- this unfortunately forces us to
- * give up a TLB entry for each mapping we want to preserve. While this may be
- * viable for a small number of fixmaps, it's not particularly useful for
- * everything and needs to be carefully evaluated. (ie, we may want this for
- * the vsyscall page).
- *
- * XXX: Perhaps add a _PAGE_WIRED flag or something similar that we can pass
- * in at __set_fixmap() time to determine the appropriate behavior to follow.
- *
- *                                      -- PFM.
- */
 void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
 {
        unsigned long address = __fix_to_virt(idx);
@@ -101,6 +98,18 @@ void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
        set_pte_phys(address, phys, prot);
 }
 
+void __clear_fixmap(enum fixed_addresses idx, pgprot_t prot)
+{
+       unsigned long address = __fix_to_virt(idx);
+
+       if (idx >= __end_of_fixed_addresses) {
+               BUG();
+               return;
+       }
+
+       clear_pte_phys(address, prot);
+}
+
 void __init page_table_range_init(unsigned long start, unsigned long end,
                                         pgd_t *pgd_base)
 {
@@ -120,7 +129,13 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
        for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
                pud = (pud_t *)pgd;
                for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) {
+#ifdef __PAGETABLE_PMD_FOLDED
                        pmd = (pmd_t *)pud;
+#else
+                       pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
+                       pud_populate(&init_mm, pud, pmd);
+                       pmd += k;
+#endif
                        for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) {
                                if (pmd_none(*pmd)) {
                                        pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
@@ -182,9 +197,6 @@ void __init paging_init(void)
        }
 
        free_area_init_nodes(max_zone_pfns);
-
-       /* Set up the uncached fixmap */
-       set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start));
 }
 
 /*
@@ -195,6 +207,8 @@ static void __init iommu_init(void)
        no_iommu_init();
 }
 
+unsigned int mem_init_done = 0;
+
 void __init mem_init(void)
 {
        int codesize, datasize, initsize;
@@ -231,6 +245,8 @@ void __init mem_init(void)
        memset(empty_zero_page, 0, PAGE_SIZE);
        __flush_wback_region(empty_zero_page, PAGE_SIZE);
 
+       vsyscall_init();
+
        codesize =  (unsigned long) &_etext - (unsigned long) &_text;
        datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
        initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
@@ -243,8 +259,48 @@ void __init mem_init(void)
                datasize >> 10,
                initsize >> 10);
 
-       /* Initialize the vDSO */
-       vsyscall_init();
+       printk(KERN_INFO "virtual kernel memory layout:\n"
+               "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+#ifdef CONFIG_HIGHMEM
+               "    pkmap   : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+#endif
+               "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
+               "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB) (cached)\n"
+#ifdef CONFIG_UNCACHED_MAPPING
+               "            : 0x%08lx - 0x%08lx   (%4ld MB) (uncached)\n"
+#endif
+               "      .init : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+               "      .data : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+               "      .text : 0x%08lx - 0x%08lx   (%4ld kB)\n",
+               FIXADDR_START, FIXADDR_TOP,
+               (FIXADDR_TOP - FIXADDR_START) >> 10,
+
+#ifdef CONFIG_HIGHMEM
+               PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
+               (LAST_PKMAP*PAGE_SIZE) >> 10,
+#endif
+
+               (unsigned long)VMALLOC_START, VMALLOC_END,
+               (VMALLOC_END - VMALLOC_START) >> 20,
+
+               (unsigned long)memory_start, (unsigned long)high_memory,
+               ((unsigned long)high_memory - (unsigned long)memory_start) >> 20,
+
+#ifdef CONFIG_UNCACHED_MAPPING
+               uncached_start, uncached_end, uncached_size >> 20,
+#endif
+
+               (unsigned long)&__init_begin, (unsigned long)&__init_end,
+               ((unsigned long)&__init_end -
+                (unsigned long)&__init_begin) >> 10,
+
+               (unsigned long)&_etext, (unsigned long)&_edata,
+               ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
+
+               (unsigned long)&_text, (unsigned long)&_etext,
+               ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
+
+       mem_init_done = 1;
 }
 
 void free_initmem(void)
@@ -277,35 +333,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
-#if THREAD_SHIFT < PAGE_SHIFT
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info(struct task_struct *tsk)
-{
-       struct thread_info *ti;
-
-       ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
-       if (unlikely(ti == NULL))
-               return NULL;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-       memset(ti, 0, THREAD_SIZE);
-#endif
-       return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-       kmem_cache_free(thread_info_cache, ti);
-}
-
-void thread_info_cache_init(void)
-{
-       thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-                                             THREAD_SIZE, 0, NULL);
-       BUG_ON(thread_info_cache == NULL);
-}
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 int arch_add_memory(int nid, u64 start, u64 size)
 {
@@ -336,10 +363,3 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
 #endif
 
 #endif /* CONFIG_MEMORY_HOTPLUG */
-
-#ifdef CONFIG_PMB
-int __in_29bit_mode(void)
-{
-       return !(ctrl_inl(PMB_PASCR) & PASCR_SE);
-}
-#endif /* CONFIG_PMB */
similarity index 78%
rename from arch/sh/mm/ioremap_32.c
rename to arch/sh/mm/ioremap.c
index 2141befb4f918c3ab98b020d8cd8e9598cccaefa..c68d2d7d00a96343e7ab9efee4c7287e02af03f4 100644 (file)
@@ -1,13 +1,13 @@
 /*
  * arch/sh/mm/ioremap.c
  *
+ * (C) Copyright 1995 1996 Linus Torvalds
+ * (C) Copyright 2005 - 2010  Paul Mundt
+ *
  * Re-map IO memory to kernel address space so that we can access it.
  * This is needed for high PCI addresses that aren't mapped in the
  * 640k-1MB IO memory area on PC's
  *
- * (C) Copyright 1995 1996 Linus Torvalds
- * (C) Copyright 2005, 2006 Paul Mundt
- *
  * This file is subject to the terms and conditions of the GNU General
  * Public License. See the file "COPYING" in the main directory of this
  * archive for more details.
  * have to convert them into an offset in a page-aligned mapping, but the
  * caller shouldn't need to know that small detail.
  */
-void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
-                              unsigned long flags, void *caller)
+void __iomem * __init_refok
+__ioremap_caller(unsigned long phys_addr, unsigned long size,
+                pgprot_t pgprot, void *caller)
 {
        struct vm_struct *area;
        unsigned long offset, last_addr, addr, orig_addr;
-       pgprot_t pgprot;
 
        /* Don't allow wraparound or zero size */
        last_addr = phys_addr + size - 1;
        if (!size || last_addr < phys_addr)
                return NULL;
 
-       /*
-        * If we're in the fixed PCI memory range, mapping through page
-        * tables is not only pointless, but also fundamentally broken.
-        * Just return the physical address instead.
-        *
-        * For boards that map a small PCI memory aperture somewhere in
-        * P1/P2 space, ioremap() will already do the right thing,
-        * and we'll never get this far.
-        */
-       if (is_pci_memory_fixed_range(phys_addr, size))
-               return (void __iomem *)phys_addr;
-
        /*
         * Mappings have to be page-aligned
         */
@@ -64,6 +52,12 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
        phys_addr &= PAGE_MASK;
        size = PAGE_ALIGN(last_addr+1) - phys_addr;
 
+       /*
+        * If we can't yet use the regular approach, go the fixmap route.
+        */
+       if (!mem_init_done)
+               return ioremap_fixed(phys_addr, offset, size, pgprot);
+
        /*
         * Ok, go for it..
         */
@@ -84,8 +78,9 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
         * PMB entries are all pre-faulted.
         */
        if (unlikely(phys_addr >= P1SEG)) {
-               unsigned long mapped = pmb_remap(addr, phys_addr, size, flags);
+               unsigned long mapped;
 
+               mapped = pmb_remap(addr, phys_addr, size, pgprot);
                if (likely(mapped)) {
                        addr            += mapped;
                        phys_addr       += mapped;
@@ -94,7 +89,6 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
        }
 #endif
 
-       pgprot = __pgprot(pgprot_val(PAGE_KERNEL_NOCACHE) | flags);
        if (likely(size))
                if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) {
                        vunmap((void *)orig_addr);
@@ -105,15 +99,38 @@ void __iomem *__ioremap_caller(unsigned long phys_addr, unsigned long size,
 }
 EXPORT_SYMBOL(__ioremap_caller);
 
+/*
+ * Simple checks for non-translatable mappings.
+ */
+static inline int iomapping_nontranslatable(unsigned long offset)
+{
+#ifdef CONFIG_29BIT
+       /*
+        * In 29-bit mode this includes the fixed P1/P2 areas, as well as
+        * parts of P3.
+        */
+       if (PXSEG(offset) < P3SEG || offset >= P3_ADDR_MAX)
+               return 1;
+#endif
+
+       return 0;
+}
+
 void __iounmap(void __iomem *addr)
 {
        unsigned long vaddr = (unsigned long __force)addr;
-       unsigned long seg = PXSEG(vaddr);
        struct vm_struct *p;
 
-       if (seg < P3SEG || vaddr >= P3_ADDR_MAX)
+       /*
+        * Nothing to do if there is no translatable mapping.
+        */
+       if (iomapping_nontranslatable(vaddr))
                return;
-       if (is_pci_memory_fixed_range(vaddr, 0))
+
+       /*
+        * There's no VMA if it's from an early fixed mapping.
+        */
+       if (iounmap_fixed(addr) == 0)
                return;
 
 #ifdef CONFIG_PMB
diff --git a/arch/sh/mm/ioremap_64.c b/arch/sh/mm/ioremap_64.c
deleted file mode 100644 (file)
index ef43465..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * arch/sh/mm/ioremap_64.c
- *
- * Copyright (C) 2000, 2001  Paolo Alberelli
- * Copyright (C) 2003 - 2007  Paul Mundt
- *
- * Mostly derived from arch/sh/mm/ioremap.c which, in turn is mostly
- * derived from arch/i386/mm/ioremap.c .
- *
- *   (C) Copyright 1995 1996 Linus Torvalds
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/vmalloc.h>
-#include <linux/ioport.h>
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/io.h>
-#include <linux/bootmem.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <asm/page.h>
-#include <asm/pgalloc.h>
-#include <asm/addrspace.h>
-#include <asm/cacheflush.h>
-#include <asm/tlbflush.h>
-#include <asm/mmu.h>
-
-static struct resource shmedia_iomap = {
-       .name   = "shmedia_iomap",
-       .start  = IOBASE_VADDR + PAGE_SIZE,
-       .end    = IOBASE_END - 1,
-};
-
-static void shmedia_mapioaddr(unsigned long pa, unsigned long va,
-                             unsigned long flags);
-static void shmedia_unmapioaddr(unsigned long vaddr);
-static void __iomem *shmedia_ioremap(struct resource *res, u32 pa,
-                                    int sz, unsigned long flags);
-
-/*
- * We have the same problem as the SPARC, so lets have the same comment:
- * Our mini-allocator...
- * Boy this is gross! We need it because we must map I/O for
- * timers and interrupt controller before the kmalloc is available.
- */
-
-#define XNMLN  15
-#define XNRES  10
-
-struct xresource {
-       struct resource xres;   /* Must be first */
-       int xflag;              /* 1 == used */
-       char xname[XNMLN+1];
-};
-
-static struct xresource xresv[XNRES];
-
-static struct xresource *xres_alloc(void)
-{
-       struct xresource *xrp;
-       int n;
-
-       xrp = xresv;
-       for (n = 0; n < XNRES; n++) {
-               if (xrp->xflag == 0) {
-                       xrp->xflag = 1;
-                       return xrp;
-               }
-               xrp++;
-       }
-       return NULL;
-}
-
-static void xres_free(struct xresource *xrp)
-{
-       xrp->xflag = 0;
-}
-
-static struct resource *shmedia_find_resource(struct resource *root,
-                                             unsigned long vaddr)
-{
-       struct resource *res;
-
-       for (res = root->child; res; res = res->sibling)
-               if (res->start <= vaddr && res->end >= vaddr)
-                       return res;
-
-       return NULL;
-}
-
-static void __iomem *shmedia_alloc_io(unsigned long phys, unsigned long size,
-                                     const char *name, unsigned long flags)
-{
-       struct xresource *xres;
-       struct resource *res;
-       char *tack;
-       int tlen;
-
-       if (name == NULL)
-               name = "???";
-
-       xres = xres_alloc();
-       if (xres != 0) {
-               tack = xres->xname;
-               res = &xres->xres;
-       } else {
-               printk_once(KERN_NOTICE "%s: done with statics, "
-                              "switching to kmalloc\n", __func__);
-               tlen = strlen(name);
-               tack = kmalloc(sizeof(struct resource) + tlen + 1, GFP_KERNEL);
-               if (!tack)
-                       return NULL;
-               memset(tack, 0, sizeof(struct resource));
-               res = (struct resource *) tack;
-               tack += sizeof(struct resource);
-       }
-
-       strncpy(tack, name, XNMLN);
-       tack[XNMLN] = 0;
-       res->name = tack;
-
-       return shmedia_ioremap(res, phys, size, flags);
-}
-
-static void __iomem *shmedia_ioremap(struct resource *res, u32 pa, int sz,
-                                    unsigned long flags)
-{
-       unsigned long offset = ((unsigned long) pa) & (~PAGE_MASK);
-       unsigned long round_sz = (offset + sz + PAGE_SIZE-1) & PAGE_MASK;
-       unsigned long va;
-       unsigned int psz;
-
-       if (allocate_resource(&shmedia_iomap, res, round_sz,
-                             shmedia_iomap.start, shmedia_iomap.end,
-                             PAGE_SIZE, NULL, NULL) != 0) {
-               panic("alloc_io_res(%s): cannot occupy\n",
-                     (res->name != NULL) ? res->name : "???");
-       }
-
-       va = res->start;
-       pa &= PAGE_MASK;
-
-       psz = (res->end - res->start + (PAGE_SIZE - 1)) / PAGE_SIZE;
-
-       for (psz = res->end - res->start + 1; psz != 0; psz -= PAGE_SIZE) {
-               shmedia_mapioaddr(pa, va, flags);
-               va += PAGE_SIZE;
-               pa += PAGE_SIZE;
-       }
-
-       return (void __iomem *)(unsigned long)(res->start + offset);
-}
-
-static void shmedia_free_io(struct resource *res)
-{
-       unsigned long len = res->end - res->start + 1;
-
-       BUG_ON((len & (PAGE_SIZE - 1)) != 0);
-
-       while (len) {
-               len -= PAGE_SIZE;
-               shmedia_unmapioaddr(res->start + len);
-       }
-
-       release_resource(res);
-}
-
-static __init_refok void *sh64_get_page(void)
-{
-       void *page;
-
-       if (slab_is_available())
-               page = (void *)get_zeroed_page(GFP_KERNEL);
-       else
-               page = alloc_bootmem_pages(PAGE_SIZE);
-
-       if (!page || ((unsigned long)page & ~PAGE_MASK))
-               panic("sh64_get_page: Out of memory already?\n");
-
-       return page;
-}
-
-static void shmedia_mapioaddr(unsigned long pa, unsigned long va,
-                             unsigned long flags)
-{
-       pgd_t *pgdp;
-       pud_t *pudp;
-       pmd_t *pmdp;
-       pte_t *ptep, pte;
-       pgprot_t prot;
-
-       pr_debug("shmedia_mapiopage pa %08lx va %08lx\n",  pa, va);
-
-       if (!flags)
-               flags = 1; /* 1 = CB0-1 device */
-
-       pgdp = pgd_offset_k(va);
-       if (pgd_none(*pgdp) || !pgd_present(*pgdp)) {
-               pudp = (pud_t *)sh64_get_page();
-               set_pgd(pgdp, __pgd((unsigned long)pudp | _KERNPG_TABLE));
-       }
-
-       pudp = pud_offset(pgdp, va);
-       if (pud_none(*pudp) || !pud_present(*pudp)) {
-               pmdp = (pmd_t *)sh64_get_page();
-               set_pud(pudp, __pud((unsigned long)pmdp | _KERNPG_TABLE));
-       }
-
-       pmdp = pmd_offset(pudp, va);
-       if (pmd_none(*pmdp) || !pmd_present(*pmdp)) {
-               ptep = (pte_t *)sh64_get_page();
-               set_pmd(pmdp, __pmd((unsigned long)ptep + _PAGE_TABLE));
-       }
-
-       prot = __pgprot(_PAGE_PRESENT | _PAGE_READ     | _PAGE_WRITE  |
-                       _PAGE_DIRTY   | _PAGE_ACCESSED | _PAGE_SHARED | flags);
-
-       pte = pfn_pte(pa >> PAGE_SHIFT, prot);
-       ptep = pte_offset_kernel(pmdp, va);
-
-       if (!pte_none(*ptep) &&
-           pte_val(*ptep) != pte_val(pte))
-               pte_ERROR(*ptep);
-
-       set_pte(ptep, pte);
-
-       flush_tlb_kernel_range(va, PAGE_SIZE);
-}
-
-static void shmedia_unmapioaddr(unsigned long vaddr)
-{
-       pgd_t *pgdp;
-       pud_t *pudp;
-       pmd_t *pmdp;
-       pte_t *ptep;
-
-       pgdp = pgd_offset_k(vaddr);
-       if (pgd_none(*pgdp) || pgd_bad(*pgdp))
-               return;
-
-       pudp = pud_offset(pgdp, vaddr);
-       if (pud_none(*pudp) || pud_bad(*pudp))
-               return;
-
-       pmdp = pmd_offset(pudp, vaddr);
-       if (pmd_none(*pmdp) || pmd_bad(*pmdp))
-               return;
-
-       ptep = pte_offset_kernel(pmdp, vaddr);
-
-       if (pte_none(*ptep) || !pte_present(*ptep))
-               return;
-
-       clear_page((void *)ptep);
-       pte_clear(&init_mm, vaddr, ptep);
-}
-
-void __iomem *__ioremap_caller(unsigned long offset, unsigned long size,
-                              unsigned long flags, void *caller)
-{
-       char name[14];
-
-       sprintf(name, "phys_%08x", (u32)offset);
-       return shmedia_alloc_io(offset, size, name, flags);
-}
-EXPORT_SYMBOL(__ioremap_caller);
-
-void __iounmap(void __iomem *virtual)
-{
-       unsigned long vaddr = (unsigned long)virtual & PAGE_MASK;
-       struct resource *res;
-       unsigned int psz;
-
-       res = shmedia_find_resource(&shmedia_iomap, vaddr);
-       if (!res) {
-               printk(KERN_ERR "%s: Failed to free 0x%08lx\n",
-                      __func__, vaddr);
-               return;
-       }
-
-       psz = (res->end - res->start + (PAGE_SIZE - 1)) / PAGE_SIZE;
-
-       shmedia_free_io(res);
-
-       if ((char *)res >= (char *)xresv &&
-           (char *)res <  (char *)&xresv[XNRES]) {
-               xres_free((struct xresource *)res);
-       } else {
-               kfree(res);
-       }
-}
-EXPORT_SYMBOL(__iounmap);
-
-static int
-ioremap_proc_info(char *buf, char **start, off_t fpos, int length, int *eof,
-                 void *data)
-{
-       char *p = buf, *e = buf + length;
-       struct resource *r;
-       const char *nm;
-
-       for (r = ((struct resource *)data)->child; r != NULL; r = r->sibling) {
-               if (p + 32 >= e)        /* Better than nothing */
-                       break;
-               nm = r->name;
-               if (nm == NULL)
-                       nm = "???";
-
-               p += sprintf(p, "%08lx-%08lx: %s\n",
-                            (unsigned long)r->start,
-                            (unsigned long)r->end, nm);
-       }
-
-       return p-buf;
-}
-
-static int __init register_proc_onchip(void)
-{
-       create_proc_read_entry("io_map", 0, 0, ioremap_proc_info,
-                              &shmedia_iomap);
-       return 0;
-}
-late_initcall(register_proc_onchip);
diff --git a/arch/sh/mm/ioremap_fixed.c b/arch/sh/mm/ioremap_fixed.c
new file mode 100644 (file)
index 0000000..0b78b1e
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Re-map IO memory to kernel address space so that we can access it.
+ *
+ * These functions should only be used when it is necessary to map a
+ * physical address space into the kernel address space before ioremap()
+ * can be used, e.g. early in boot before paging_init().
+ *
+ * Copyright (C) 2009  Matt Fleming
+ */
+
+#include <linux/vmalloc.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/io.h>
+#include <linux/bootmem.h>
+#include <linux/proc_fs.h>
+#include <linux/slab.h>
+#include <asm/fixmap.h>
+#include <asm/page.h>
+#include <asm/pgalloc.h>
+#include <asm/addrspace.h>
+#include <asm/cacheflush.h>
+#include <asm/tlbflush.h>
+#include <asm/mmu.h>
+#include <asm/mmu_context.h>
+
+struct ioremap_map {
+       void __iomem *addr;
+       unsigned long size;
+       unsigned long fixmap_addr;
+};
+
+static struct ioremap_map ioremap_maps[FIX_N_IOREMAPS];
+
+void __init ioremap_fixed_init(void)
+{
+       struct ioremap_map *map;
+       int i;
+
+       for (i = 0; i < FIX_N_IOREMAPS; i++) {
+               map = &ioremap_maps[i];
+               map->fixmap_addr = __fix_to_virt(FIX_IOREMAP_BEGIN + i);
+       }
+}
+
+void __init __iomem *
+ioremap_fixed(resource_size_t phys_addr, unsigned long offset,
+             unsigned long size, pgprot_t prot)
+{
+       enum fixed_addresses idx0, idx;
+       struct ioremap_map *map;
+       unsigned int nrpages;
+       int i, slot;
+
+       slot = -1;
+       for (i = 0; i < FIX_N_IOREMAPS; i++) {
+               map = &ioremap_maps[i];
+               if (!map->addr) {
+                       map->size = size;
+                       slot = i;
+                       break;
+               }
+       }
+
+       if (slot < 0)
+               return NULL;
+
+       /*
+        * Mappings have to fit in the FIX_IOREMAP area.
+        */
+       nrpages = size >> PAGE_SHIFT;
+       if (nrpages > FIX_N_IOREMAPS)
+               return NULL;
+
+       /*
+        * Ok, go for it..
+        */
+       idx0 = FIX_IOREMAP_BEGIN + slot;
+       idx = idx0;
+       while (nrpages > 0) {
+               pgprot_val(prot) |= _PAGE_WIRED;
+               __set_fixmap(idx, phys_addr, prot);
+               phys_addr += PAGE_SIZE;
+               idx++;
+               --nrpages;
+       }
+
+       map->addr = (void __iomem *)(offset + map->fixmap_addr);
+       return map->addr;
+}
+
+int iounmap_fixed(void __iomem *addr)
+{
+       enum fixed_addresses idx;
+       struct ioremap_map *map;
+       unsigned int nrpages;
+       int i, slot;
+
+       slot = -1;
+       for (i = 0; i < FIX_N_IOREMAPS; i++) {
+               map = &ioremap_maps[i];
+               if (map->addr == addr) {
+                       slot = i;
+                       break;
+               }
+       }
+
+       /*
+        * If we don't match, it's not for us.
+        */
+       if (slot < 0)
+               return -EINVAL;
+
+       nrpages = map->size >> PAGE_SHIFT;
+
+       idx = FIX_IOREMAP_BEGIN + slot + nrpages - 1;
+       while (nrpages > 0) {
+               __clear_fixmap(idx, __pgprot(_PAGE_WIRED));
+               --idx;
+               --nrpages;
+       }
+
+       map->size = 0;
+       map->addr = NULL;
+
+       return 0;
+}
index ac16c05917eff3c09b1788203fa1fb687001146f..7694f50c90347d619ac1c5a77be8e5d636f2f5fb 100644 (file)
@@ -94,3 +94,7 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
 void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
 {
 }
+
+void pgtable_cache_init(void)
+{
+}
diff --git a/arch/sh/mm/pgtable.c b/arch/sh/mm/pgtable.c
new file mode 100644 (file)
index 0000000..6f21fb1
--- /dev/null
@@ -0,0 +1,56 @@
+#include <linux/mm.h>
+
+#define PGALLOC_GFP GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO
+
+static struct kmem_cache *pgd_cachep;
+#if PAGETABLE_LEVELS > 2
+static struct kmem_cache *pmd_cachep;
+#endif
+
+void pgd_ctor(void *x)
+{
+       pgd_t *pgd = x;
+
+       memcpy(pgd + USER_PTRS_PER_PGD,
+              swapper_pg_dir + USER_PTRS_PER_PGD,
+              (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+}
+
+void pgtable_cache_init(void)
+{
+       pgd_cachep = kmem_cache_create("pgd_cache",
+                                      PTRS_PER_PGD * (1<<PTE_MAGNITUDE),
+                                      PAGE_SIZE, SLAB_PANIC, pgd_ctor);
+#if PAGETABLE_LEVELS > 2
+       pmd_cachep = kmem_cache_create("pmd_cache",
+                                      PTRS_PER_PMD * (1<<PTE_MAGNITUDE),
+                                      PAGE_SIZE, SLAB_PANIC, NULL);
+#endif
+}
+
+pgd_t *pgd_alloc(struct mm_struct *mm)
+{
+       return kmem_cache_alloc(pgd_cachep, PGALLOC_GFP);
+}
+
+void pgd_free(struct mm_struct *mm, pgd_t *pgd)
+{
+       kmem_cache_free(pgd_cachep, pgd);
+}
+
+#if PAGETABLE_LEVELS > 2
+void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
+{
+       set_pud(pud, __pud((unsigned long)pmd));
+}
+
+pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+       return kmem_cache_alloc(pmd_cachep, PGALLOC_GFP);
+}
+
+void pmd_free(struct mm_struct *mm, pmd_t *pmd)
+{
+       kmem_cache_free(pmd_cachep, pmd);
+}
+#endif /* PAGETABLE_LEVELS > 2 */
index 280f6a166035fe9c418dd831e1f188eb6a923e6b..198bcff5e96f864a39e4dbd7c8c5c0980f7d697a 100644 (file)
@@ -3,11 +3,8 @@
  *
  * Privileged Space Mapping Buffer (PMB) Support.
  *
- * Copyright (C) 2005, 2006, 2007 Paul Mundt
- *
- * P1/P2 Section mapping definitions from map32.h, which was:
- *
- *     Copyright 2003 (c) Lineo Solutions,Inc.
+ * Copyright (C) 2005 - 2010  Paul Mundt
+ * Copyright (C) 2010  Matt Fleming
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
 #include <linux/fs.h>
 #include <linux/seq_file.h>
 #include <linux/err.h>
+#include <linux/io.h>
+#include <linux/spinlock.h>
+#include <linux/rwlock.h>
+#include <asm/sizes.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
+#include <asm/page.h>
 #include <asm/mmu.h>
-#include <asm/io.h>
 #include <asm/mmu_context.h>
 
-#define NR_PMB_ENTRIES 16
+struct pmb_entry;
+
+struct pmb_entry {
+       unsigned long vpn;
+       unsigned long ppn;
+       unsigned long flags;
+       unsigned long size;
 
-static void __pmb_unmap(struct pmb_entry *);
+       spinlock_t lock;
+
+       /*
+        * 0 .. NR_PMB_ENTRIES for specific entry selection, or
+        * PMB_NO_ENTRY to search for a free one
+        */
+       int entry;
 
+       /* Adjacent entry link for contiguous multi-entry mappings */
+       struct pmb_entry *link;
+};
+
+static void pmb_unmap_entry(struct pmb_entry *, int depth);
+
+static DEFINE_RWLOCK(pmb_rwlock);
 static struct pmb_entry pmb_entry_list[NR_PMB_ENTRIES];
-static unsigned long pmb_map;
+static DECLARE_BITMAP(pmb_map, NR_PMB_ENTRIES);
 
-static inline unsigned long mk_pmb_entry(unsigned int entry)
+static __always_inline unsigned long mk_pmb_entry(unsigned int entry)
 {
        return (entry & PMB_E_MASK) << PMB_E_SHIFT;
 }
 
-static inline unsigned long mk_pmb_addr(unsigned int entry)
+static __always_inline unsigned long mk_pmb_addr(unsigned int entry)
 {
        return mk_pmb_entry(entry) | PMB_ADDR;
 }
 
-static inline unsigned long mk_pmb_data(unsigned int entry)
+static __always_inline unsigned long mk_pmb_data(unsigned int entry)
 {
        return mk_pmb_entry(entry) | PMB_DATA;
 }
 
 static int pmb_alloc_entry(void)
 {
-       unsigned int pos;
-
-repeat:
-       pos = find_first_zero_bit(&pmb_map, NR_PMB_ENTRIES);
-
-       if (unlikely(pos > NR_PMB_ENTRIES))
-               return -ENOSPC;
+       int pos;
 
-       if (test_and_set_bit(pos, &pmb_map))
-               goto repeat;
+       pos = find_first_zero_bit(pmb_map, NR_PMB_ENTRIES);
+       if (pos >= 0 && pos < NR_PMB_ENTRIES)
+               __set_bit(pos, pmb_map);
+       else
+               pos = -ENOSPC;
 
        return pos;
 }
@@ -73,21 +90,34 @@ static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
                                   unsigned long flags, int entry)
 {
        struct pmb_entry *pmbe;
+       unsigned long irqflags;
+       void *ret = NULL;
        int pos;
 
+       write_lock_irqsave(&pmb_rwlock, irqflags);
+
        if (entry == PMB_NO_ENTRY) {
                pos = pmb_alloc_entry();
-               if (pos < 0)
-                       return ERR_PTR(pos);
+               if (unlikely(pos < 0)) {
+                       ret = ERR_PTR(pos);
+                       goto out;
+               }
        } else {
-               if (test_bit(entry, &pmb_map))
-                       return ERR_PTR(-ENOSPC);
+               if (__test_and_set_bit(entry, pmb_map)) {
+                       ret = ERR_PTR(-ENOSPC);
+                       goto out;
+               }
+
                pos = entry;
        }
 
+       write_unlock_irqrestore(&pmb_rwlock, irqflags);
+
        pmbe = &pmb_entry_list[pos];
-       if (!pmbe)
-               return ERR_PTR(-ENOMEM);
+
+       memset(pmbe, 0, sizeof(struct pmb_entry));
+
+       spin_lock_init(&pmbe->lock);
 
        pmbe->vpn       = vpn;
        pmbe->ppn       = ppn;
@@ -95,101 +125,113 @@ static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
        pmbe->entry     = pos;
 
        return pmbe;
+
+out:
+       write_unlock_irqrestore(&pmb_rwlock, irqflags);
+       return ret;
 }
 
 static void pmb_free(struct pmb_entry *pmbe)
 {
-       int pos = pmbe->entry;
-
-       pmbe->vpn       = 0;
-       pmbe->ppn       = 0;
-       pmbe->flags     = 0;
-       pmbe->entry     = 0;
+       __clear_bit(pmbe->entry, pmb_map);
 
-       clear_bit(pos, &pmb_map);
+       pmbe->entry     = PMB_NO_ENTRY;
+       pmbe->link      = NULL;
 }
 
 /*
- * Must be in P2 for __set_pmb_entry()
+ * Ensure that the PMB entries match our cache configuration.
+ *
+ * When we are in 32-bit address extended mode, CCR.CB becomes
+ * invalid, so care must be taken to manually adjust cacheable
+ * translations.
  */
-static void __set_pmb_entry(unsigned long vpn, unsigned long ppn,
-                           unsigned long flags, int pos)
+static __always_inline unsigned long pmb_cache_flags(void)
 {
-       ctrl_outl(vpn | PMB_V, mk_pmb_addr(pos));
+       unsigned long flags = 0;
 
-#ifdef CONFIG_CACHE_WRITETHROUGH
-       /*
-        * When we are in 32-bit address extended mode, CCR.CB becomes
-        * invalid, so care must be taken to manually adjust cacheable
-        * translations.
-        */
-       if (likely(flags & PMB_C))
-               flags |= PMB_WT;
+#if defined(CONFIG_CACHE_WRITETHROUGH)
+       flags |= PMB_C | PMB_WT | PMB_UB;
+#elif defined(CONFIG_CACHE_WRITEBACK)
+       flags |= PMB_C;
 #endif
 
-       ctrl_outl(ppn | flags | PMB_V, mk_pmb_data(pos));
+       return flags;
 }
 
-static void __uses_jump_to_uncached set_pmb_entry(struct pmb_entry *pmbe)
+/*
+ * Must be run uncached.
+ */
+static void __set_pmb_entry(struct pmb_entry *pmbe)
 {
-       jump_to_uncached();
-       __set_pmb_entry(pmbe->vpn, pmbe->ppn, pmbe->flags, pmbe->entry);
-       back_to_cached();
+       writel_uncached(pmbe->vpn | PMB_V, mk_pmb_addr(pmbe->entry));
+       writel_uncached(pmbe->ppn | pmbe->flags | PMB_V,
+                       mk_pmb_data(pmbe->entry));
 }
 
-static void __uses_jump_to_uncached clear_pmb_entry(struct pmb_entry *pmbe)
+static void __clear_pmb_entry(struct pmb_entry *pmbe)
 {
-       unsigned int entry = pmbe->entry;
-       unsigned long addr;
+       unsigned long addr, data;
+       unsigned long addr_val, data_val;
 
-       if (unlikely(entry >= NR_PMB_ENTRIES))
-               return;
+       addr = mk_pmb_addr(pmbe->entry);
+       data = mk_pmb_data(pmbe->entry);
 
-       jump_to_uncached();
+       addr_val = __raw_readl(addr);
+       data_val = __raw_readl(data);
 
        /* Clear V-bit */
-       addr = mk_pmb_addr(entry);
-       ctrl_outl(ctrl_inl(addr) & ~PMB_V, addr);
+       writel_uncached(addr_val & ~PMB_V, addr);
+       writel_uncached(data_val & ~PMB_V, data);
+}
 
-       addr = mk_pmb_data(entry);
-       ctrl_outl(ctrl_inl(addr) & ~PMB_V, addr);
+static void set_pmb_entry(struct pmb_entry *pmbe)
+{
+       unsigned long flags;
 
-       back_to_cached();
+       spin_lock_irqsave(&pmbe->lock, flags);
+       __set_pmb_entry(pmbe);
+       spin_unlock_irqrestore(&pmbe->lock, flags);
 }
 
-
 static struct {
        unsigned long size;
        int flag;
 } pmb_sizes[] = {
-       { .size = 0x20000000, .flag = PMB_SZ_512M, },
-       { .size = 0x08000000, .flag = PMB_SZ_128M, },
-       { .size = 0x04000000, .flag = PMB_SZ_64M,  },
-       { .size = 0x01000000, .flag = PMB_SZ_16M,  },
+       { .size = SZ_512M, .flag = PMB_SZ_512M, },
+       { .size = SZ_128M, .flag = PMB_SZ_128M, },
+       { .size = SZ_64M,  .flag = PMB_SZ_64M,  },
+       { .size = SZ_16M,  .flag = PMB_SZ_16M,  },
 };
 
 long pmb_remap(unsigned long vaddr, unsigned long phys,
-              unsigned long size, unsigned long flags)
+              unsigned long size, pgprot_t prot)
 {
        struct pmb_entry *pmbp, *pmbe;
        unsigned long wanted;
        int pmb_flags, i;
        long err;
+       u64 flags;
+
+       flags = pgprot_val(prot);
+
+       pmb_flags = PMB_WT | PMB_UB;
 
        /* Convert typical pgprot value to the PMB equivalent */
        if (flags & _PAGE_CACHABLE) {
-               if (flags & _PAGE_WT)
-                       pmb_flags = PMB_WT;
-               else
-                       pmb_flags = PMB_C;
-       } else
-               pmb_flags = PMB_WT | PMB_UB;
+               pmb_flags |= PMB_C;
+
+               if ((flags & _PAGE_WT) == 0)
+                       pmb_flags &= ~(PMB_WT | PMB_UB);
+       }
 
        pmbp = NULL;
        wanted = size;
 
 again:
        for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++) {
+               unsigned long flags;
+
                if (size < pmb_sizes[i].size)
                        continue;
 
@@ -200,18 +242,25 @@ again:
                        goto out;
                }
 
-               set_pmb_entry(pmbe);
+               spin_lock_irqsave(&pmbe->lock, flags);
+
+               __set_pmb_entry(pmbe);
 
                phys    += pmb_sizes[i].size;
                vaddr   += pmb_sizes[i].size;
                size    -= pmb_sizes[i].size;
 
+               pmbe->size = pmb_sizes[i].size;
+
                /*
                 * Link adjacent entries that span multiple PMB entries
                 * for easier tear-down.
                 */
-               if (likely(pmbp))
+               if (likely(pmbp)) {
+                       spin_lock(&pmbp->lock);
                        pmbp->link = pmbe;
+                       spin_unlock(&pmbp->lock);
+               }
 
                pmbp = pmbe;
 
@@ -221,16 +270,17 @@ again:
                 * pmb_sizes[i].size again.
                 */
                i--;
+
+               spin_unlock_irqrestore(&pmbe->lock, flags);
        }
 
-       if (size >= 0x1000000)
+       if (size >= SZ_16M)
                goto again;
 
        return wanted - size;
 
 out:
-       if (pmbp)
-               __pmb_unmap(pmbp);
+       pmb_unmap_entry(pmbp, NR_PMB_ENTRIES);
 
        return err;
 }
@@ -240,24 +290,52 @@ void pmb_unmap(unsigned long addr)
        struct pmb_entry *pmbe = NULL;
        int i;
 
+       read_lock(&pmb_rwlock);
+
        for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
-               if (test_bit(i, &pmb_map)) {
+               if (test_bit(i, pmb_map)) {
                        pmbe = &pmb_entry_list[i];
                        if (pmbe->vpn == addr)
                                break;
                }
        }
 
-       if (unlikely(!pmbe))
-               return;
+       read_unlock(&pmb_rwlock);
 
-       __pmb_unmap(pmbe);
+       pmb_unmap_entry(pmbe, NR_PMB_ENTRIES);
 }
 
-static void __pmb_unmap(struct pmb_entry *pmbe)
+static bool pmb_can_merge(struct pmb_entry *a, struct pmb_entry *b)
 {
-       BUG_ON(!test_bit(pmbe->entry, &pmb_map));
+       return (b->vpn == (a->vpn + a->size)) &&
+              (b->ppn == (a->ppn + a->size)) &&
+              (b->flags == a->flags);
+}
 
+static bool pmb_size_valid(unsigned long size)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++)
+               if (pmb_sizes[i].size == size)
+                       return true;
+
+       return false;
+}
+
+static int pmb_size_to_flags(unsigned long size)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++)
+               if (pmb_sizes[i].size == size)
+                       return pmb_sizes[i].flag;
+
+       return 0;
+}
+
+static void __pmb_unmap_entry(struct pmb_entry *pmbe, int depth)
+{
        do {
                struct pmb_entry *pmblink = pmbe;
 
@@ -268,102 +346,312 @@ static void __pmb_unmap(struct pmb_entry *pmbe)
                 * this entry in pmb_alloc() (even if we haven't filled
                 * it yet).
                 *
-                * Therefore, calling clear_pmb_entry() is safe as no
+                * Therefore, calling __clear_pmb_entry() is safe as no
                 * other mapping can be using that slot.
                 */
-               clear_pmb_entry(pmbe);
+               __clear_pmb_entry(pmbe);
 
                pmbe = pmblink->link;
 
                pmb_free(pmblink);
-       } while (pmbe);
+       } while (pmbe && --depth);
+}
+
+static void pmb_unmap_entry(struct pmb_entry *pmbe, int depth)
+{
+       unsigned long flags;
+
+       if (unlikely(!pmbe))
+               return;
+
+       write_lock_irqsave(&pmb_rwlock, flags);
+       __pmb_unmap_entry(pmbe, depth);
+       write_unlock_irqrestore(&pmb_rwlock, flags);
+}
+
+static __always_inline unsigned int pmb_ppn_in_range(unsigned long ppn)
+{
+       return ppn >= __pa(memory_start) && ppn < __pa(memory_end);
 }
 
-#ifdef CONFIG_PMB
-int __uses_jump_to_uncached pmb_init(void)
+static void __init pmb_notify(void)
 {
-       unsigned int i;
-       long size, ret;
+       int i;
 
-       jump_to_uncached();
+       pr_info("PMB: boot mappings:\n");
+
+       read_lock(&pmb_rwlock);
+
+       for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
+               struct pmb_entry *pmbe;
+
+               if (!test_bit(i, pmb_map))
+                       continue;
+
+               pmbe = &pmb_entry_list[i];
+
+               pr_info("       0x%08lx -> 0x%08lx [ %4ldMB %2scached ]\n",
+                       pmbe->vpn >> PAGE_SHIFT, pmbe->ppn >> PAGE_SHIFT,
+                       pmbe->size >> 20, (pmbe->flags & PMB_C) ? "" : "un");
+       }
+
+       read_unlock(&pmb_rwlock);
+}
+
+/*
+ * Sync our software copy of the PMB mappings with those in hardware. The
+ * mappings in the hardware PMB were either set up by the bootloader or
+ * very early on by the kernel.
+ */
+static void __init pmb_synchronize(void)
+{
+       struct pmb_entry *pmbp = NULL;
+       int i, j;
 
        /*
-        * Insert PMB entries for the P1 and P2 areas so that, after
-        * we've switched the MMU to 32-bit mode, the semantics of P1
-        * and P2 are the same as in 29-bit mode, e.g.
+        * Run through the initial boot mappings, log the established
+        * ones, and blow away anything that falls outside of the valid
+        * PPN range. Specifically, we only care about existing mappings
+        * that impact the cached/uncached sections.
         *
-        *      P1 - provides a cached window onto physical memory
-        *      P2 - provides an uncached window onto physical memory
+        * Note that touching these can be a bit of a minefield; the boot
+        * loader can establish multi-page mappings with the same caching
+        * attributes, so we need to ensure that we aren't modifying a
+        * mapping that we're presently executing from, or may execute
+        * from in the case of straddling page boundaries.
+        *
+        * In the future we will have to tidy up after the boot loader by
+        * jumping between the cached and uncached mappings and tearing
+        * down alternating mappings while executing from the other.
         */
-       size = __MEMORY_START + __MEMORY_SIZE;
+       for (i = 0; i < NR_PMB_ENTRIES; i++) {
+               unsigned long addr, data;
+               unsigned long addr_val, data_val;
+               unsigned long ppn, vpn, flags;
+               unsigned long irqflags;
+               unsigned int size;
+               struct pmb_entry *pmbe;
 
-       ret = pmb_remap(P1SEG, 0x00000000, size, PMB_C);
-       BUG_ON(ret != size);
+               addr = mk_pmb_addr(i);
+               data = mk_pmb_data(i);
 
-       ret = pmb_remap(P2SEG, 0x00000000, size, PMB_WT | PMB_UB);
-       BUG_ON(ret != size);
+               addr_val = __raw_readl(addr);
+               data_val = __raw_readl(data);
 
-       ctrl_outl(0, PMB_IRMCR);
+               /*
+                * Skip over any bogus entries
+                */
+               if (!(data_val & PMB_V) || !(addr_val & PMB_V))
+                       continue;
 
-       /* PMB.SE and UB[7] */
-       ctrl_outl(PASCR_SE | (1 << 7), PMB_PASCR);
+               ppn = data_val & PMB_PFN_MASK;
+               vpn = addr_val & PMB_PFN_MASK;
 
-       /* Flush out the TLB */
-       i =  ctrl_inl(MMUCR);
-       i |= MMUCR_TI;
-       ctrl_outl(i, MMUCR);
+               /*
+                * Only preserve in-range mappings.
+                */
+               if (!pmb_ppn_in_range(ppn)) {
+                       /*
+                        * Invalidate anything out of bounds.
+                        */
+                       writel_uncached(addr_val & ~PMB_V, addr);
+                       writel_uncached(data_val & ~PMB_V, data);
+                       continue;
+               }
 
-       back_to_cached();
+               /*
+                * Update the caching attributes if necessary
+                */
+               if (data_val & PMB_C) {
+                       data_val &= ~PMB_CACHE_MASK;
+                       data_val |= pmb_cache_flags();
 
-       return 0;
+                       writel_uncached(data_val, data);
+               }
+
+               size = data_val & PMB_SZ_MASK;
+               flags = size | (data_val & PMB_CACHE_MASK);
+
+               pmbe = pmb_alloc(vpn, ppn, flags, i);
+               if (IS_ERR(pmbe)) {
+                       WARN_ON_ONCE(1);
+                       continue;
+               }
+
+               spin_lock_irqsave(&pmbe->lock, irqflags);
+
+               for (j = 0; j < ARRAY_SIZE(pmb_sizes); j++)
+                       if (pmb_sizes[j].flag == size)
+                               pmbe->size = pmb_sizes[j].size;
+
+               if (pmbp) {
+                       spin_lock(&pmbp->lock);
+
+                       /*
+                        * Compare the previous entry against the current one to
+                        * see if the entries span a contiguous mapping. If so,
+                        * setup the entry links accordingly. Compound mappings
+                        * are later coalesced.
+                        */
+                       if (pmb_can_merge(pmbp, pmbe))
+                               pmbp->link = pmbe;
+
+                       spin_unlock(&pmbp->lock);
+               }
+
+               pmbp = pmbe;
+
+               spin_unlock_irqrestore(&pmbe->lock, irqflags);
+       }
+}
+
+static void __init pmb_merge(struct pmb_entry *head)
+{
+       unsigned long span, newsize;
+       struct pmb_entry *tail;
+       int i = 1, depth = 0;
+
+       span = newsize = head->size;
+
+       tail = head->link;
+       while (tail) {
+               span += tail->size;
+
+               if (pmb_size_valid(span)) {
+                       newsize = span;
+                       depth = i;
+               }
+
+               /* This is the end of the line.. */
+               if (!tail->link)
+                       break;
+
+               tail = tail->link;
+               i++;
+       }
+
+       /*
+        * The merged page size must be valid.
+        */
+       if (!pmb_size_valid(newsize))
+               return;
+
+       head->flags &= ~PMB_SZ_MASK;
+       head->flags |= pmb_size_to_flags(newsize);
+
+       head->size = newsize;
+
+       __pmb_unmap_entry(head->link, depth);
+       __set_pmb_entry(head);
 }
-#else
-int __uses_jump_to_uncached pmb_init(void)
+
+static void __init pmb_coalesce(void)
 {
+       unsigned long flags;
        int i;
-       unsigned long addr, data;
 
-       jump_to_uncached();
+       write_lock_irqsave(&pmb_rwlock, flags);
 
-       for (i = 0; i < PMB_ENTRY_MAX; i++) {
+       for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
                struct pmb_entry *pmbe;
-               unsigned long vpn, ppn, flags;
 
-               addr = PMB_DATA + (i << PMB_E_SHIFT);
-               data = ctrl_inl(addr);
-               if (!(data & PMB_V))
+               if (!test_bit(i, pmb_map))
                        continue;
 
-               if (data & PMB_C) {
-#if defined(CONFIG_CACHE_WRITETHROUGH)
-                       data |= PMB_WT;
-#elif defined(CONFIG_CACHE_WRITEBACK)
-                       data &= ~PMB_WT;
-#else
-                       data &= ~(PMB_C | PMB_WT);
-#endif
-               }
-               ctrl_outl(data, addr);
+               pmbe = &pmb_entry_list[i];
 
-               ppn = data & PMB_PFN_MASK;
+               /*
+                * We're only interested in compound mappings
+                */
+               if (!pmbe->link)
+                       continue;
 
-               flags = data & (PMB_C | PMB_WT | PMB_UB);
-               flags |= data & PMB_SZ_MASK;
+               /*
+                * Nothing to do if it already uses the largest possible
+                * page size.
+                */
+               if (pmbe->size == SZ_512M)
+                       continue;
 
-               addr = PMB_ADDR + (i << PMB_E_SHIFT);
-               data = ctrl_inl(addr);
+               pmb_merge(pmbe);
+       }
 
-               vpn = data & PMB_PFN_MASK;
+       write_unlock_irqrestore(&pmb_rwlock, flags);
+}
 
-               pmbe = pmb_alloc(vpn, ppn, flags, i);
-               WARN_ON(IS_ERR(pmbe));
+#ifdef CONFIG_UNCACHED_MAPPING
+static void __init pmb_resize(void)
+{
+       int i;
+
+       /*
+        * If the uncached mapping was constructed by the kernel, it will
+        * already be a reasonable size.
+        */
+       if (uncached_size == SZ_16M)
+               return;
+
+       read_lock(&pmb_rwlock);
+
+       for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
+               struct pmb_entry *pmbe;
+               unsigned long flags;
+
+               if (!test_bit(i, pmb_map))
+                       continue;
+
+               pmbe = &pmb_entry_list[i];
+
+               if (pmbe->vpn != uncached_start)
+                       continue;
+
+               /*
+                * Found it, now resize it.
+                */
+               spin_lock_irqsave(&pmbe->lock, flags);
+
+               pmbe->size = SZ_16M;
+               pmbe->flags &= ~PMB_SZ_MASK;
+               pmbe->flags |= pmb_size_to_flags(pmbe->size);
+
+               uncached_resize(pmbe->size);
+
+               __set_pmb_entry(pmbe);
+
+               spin_unlock_irqrestore(&pmbe->lock, flags);
        }
 
-       back_to_cached();
+       read_lock(&pmb_rwlock);
+}
+#endif
+
+void __init pmb_init(void)
+{
+       /* Synchronize software state */
+       pmb_synchronize();
 
-       return 0;
+       /* Attempt to combine compound mappings */
+       pmb_coalesce();
+
+#ifdef CONFIG_UNCACHED_MAPPING
+       /* Resize initial mappings, if necessary */
+       pmb_resize();
+#endif
+
+       /* Log them */
+       pmb_notify();
+
+       writel_uncached(0, PMB_IRMCR);
+
+       /* Flush out the TLB */
+       __raw_writel(__raw_readl(MMUCR) | MMUCR_TI, MMUCR);
+       ctrl_barrier();
+}
+
+bool __in_29bit_mode(void)
+{
+        return (__raw_readl(PMB_PASCR) & PASCR_SE) == 0;
 }
-#endif /* CONFIG_PMB */
 
 static int pmb_seq_show(struct seq_file *file, void *iter)
 {
@@ -378,8 +666,8 @@ static int pmb_seq_show(struct seq_file *file, void *iter)
                unsigned int size;
                char *sz_str = NULL;
 
-               addr = ctrl_inl(mk_pmb_addr(i));
-               data = ctrl_inl(mk_pmb_data(i));
+               addr = __raw_readl(mk_pmb_addr(i));
+               data = __raw_readl(mk_pmb_data(i));
 
                size = data & PMB_SZ_MASK;
                sz_str = (size == PMB_SZ_16M)  ? " 16MB":
@@ -437,14 +725,21 @@ static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state)
        if (state.event == PM_EVENT_ON &&
            prev_state.event == PM_EVENT_FREEZE) {
                struct pmb_entry *pmbe;
+
+               read_lock(&pmb_rwlock);
+
                for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
-                       if (test_bit(i, &pmb_map)) {
+                       if (test_bit(i, pmb_map)) {
                                pmbe = &pmb_entry_list[i];
                                set_pmb_entry(pmbe);
                        }
                }
+
+               read_unlock(&pmb_rwlock);
        }
+
        prev_state = state;
+
        return 0;
 }
 
@@ -462,6 +757,5 @@ static int __init pmb_sysdev_init(void)
 {
        return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver);
 }
-
 subsys_initcall(pmb_sysdev_init);
 #endif
index 409b7c2b4b9d9485082f714150aa2db85e0f351f..32dc674c550c12ec2424adaf46c5856b90a0ea72 100644 (file)
@@ -68,8 +68,7 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
  * in extended mode, the legacy 8-bit ASID field in address array 1 has
  * undefined behaviour.
  */
-void __uses_jump_to_uncached local_flush_tlb_one(unsigned long asid,
-                                                unsigned long page)
+void local_flush_tlb_one(unsigned long asid, unsigned long page)
 {
        jump_to_uncached();
        __raw_writel(page, MMU_UTLB_ADDRESS_ARRAY | MMU_PAGE_ASSOC_BIT);
index ace8e6d2f59d05830cf12b76a2fcd2b269cad560..4f5f7cbdd508e7e9f1e87f4f5404eab538118281 100644 (file)
@@ -41,14 +41,14 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
 
        /* Set PTEH register */
        vpn = (address & MMU_VPN_MASK) | get_asid();
-       ctrl_outl(vpn, MMU_PTEH);
+       __raw_writel(vpn, MMU_PTEH);
 
        pteval = pte_val(pte);
 
        /* Set PTEL register */
        pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
        /* conveniently, we want all the software flags to be 0 anyway */
-       ctrl_outl(pteval, MMU_PTEL);
+       __raw_writel(pteval, MMU_PTEL);
 
        /* Load the TLB */
        asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
@@ -75,5 +75,5 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
        }
 
        for (i = 0; i < ways; i++)
-               ctrl_outl(data, addr + (i << 8));
+               __raw_writel(data, addr + (i << 8));
 }
index 8cf550e2570fde753a8405e77c722f9b5fc13032..ccac77f504a8532192d063ef2d423b4c4a613948 100644 (file)
@@ -29,7 +29,7 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
 
        /* Set PTEH register */
        vpn = (address & MMU_VPN_MASK) | get_asid();
-       ctrl_outl(vpn, MMU_PTEH);
+       __raw_writel(vpn, MMU_PTEH);
 
        pteval = pte.pte_low;
 
@@ -41,13 +41,13 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
         * the protection bits (with the exception of the compat-mode SZ
         * and PR bits, which are cleared) being written out in PTEL.
         */
-       ctrl_outl(pte.pte_high, MMU_PTEA);
+       __raw_writel(pte.pte_high, MMU_PTEA);
 #else
        if (cpu_data->flags & CPU_HAS_PTEA) {
                /* The last 3 bits and the first one of pteval contains
                 * the PTEA timing control and space attribute bits
                 */
-               ctrl_outl(copy_ptea_attributes(pteval), MMU_PTEA);
+               __raw_writel(copy_ptea_attributes(pteval), MMU_PTEA);
        }
 #endif
 
@@ -57,15 +57,14 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
        pteval |= _PAGE_WT;
 #endif
        /* conveniently, we want all the software flags to be 0 anyway */
-       ctrl_outl(pteval, MMU_PTEL);
+       __raw_writel(pteval, MMU_PTEL);
 
        /* Load the TLB */
        asm volatile("ldtlb": /* no output */ : /* no input */ : "memory");
        local_irq_restore(flags);
 }
 
-void __uses_jump_to_uncached local_flush_tlb_one(unsigned long asid,
-                                                unsigned long page)
+void local_flush_tlb_one(unsigned long asid, unsigned long page)
 {
        unsigned long addr, data;
 
@@ -78,6 +77,6 @@ void __uses_jump_to_uncached local_flush_tlb_one(unsigned long asid,
        addr = MMU_UTLB_ADDRESS_ARRAY | MMU_PAGE_ASSOC_BIT;
        data = page | asid; /* VALID bit is off */
        jump_to_uncached();
-       ctrl_outl(data, addr);
+       __raw_writel(data, addr);
        back_to_cached();
 }
index fdb64e41ec501bdbada0b68edd7d1826944063a9..f27dbe1c15992ed3f5f74a431de1ceea710c29c6 100644 (file)
@@ -143,3 +143,42 @@ void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr,
  */
 void sh64_teardown_tlb_slot(unsigned long long config_addr)
        __attribute__ ((alias("__flush_tlb_slot")));
+
+static int dtlb_entry;
+static unsigned long long dtlb_entries[64];
+
+void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
+{
+       unsigned long long entry;
+       unsigned long paddr, flags;
+
+       BUG_ON(dtlb_entry == ARRAY_SIZE(dtlb_entries));
+
+       local_irq_save(flags);
+
+       entry = sh64_get_wired_dtlb_entry();
+       dtlb_entries[dtlb_entry++] = entry;
+
+       paddr = pte_val(pte) & _PAGE_FLAGS_HARDWARE_MASK;
+       paddr &= ~PAGE_MASK;
+
+       sh64_setup_tlb_slot(entry, addr, get_asid(), paddr);
+
+       local_irq_restore(flags);
+}
+
+void tlb_unwire_entry(void)
+{
+       unsigned long long entry;
+       unsigned long flags;
+
+       BUG_ON(!dtlb_entry);
+
+       local_irq_save(flags);
+       entry = dtlb_entries[dtlb_entry--];
+
+       sh64_teardown_tlb_slot(entry);
+       sh64_put_wired_dtlb_entry(entry);
+
+       local_irq_restore(flags);
+}
diff --git a/arch/sh/mm/tlb-urb.c b/arch/sh/mm/tlb-urb.c
new file mode 100644 (file)
index 0000000..bb5b909
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * arch/sh/mm/tlb-urb.c
+ *
+ * TLB entry wiring helpers for URB-equipped parts.
+ *
+ * Copyright (C) 2010  Matt Fleming
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/mm.h>
+#include <linux/io.h>
+#include <asm/tlb.h>
+#include <asm/mmu_context.h>
+
+/*
+ * Load the entry for 'addr' into the TLB and wire the entry.
+ */
+void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
+{
+       unsigned long status, flags;
+       int urb;
+
+       local_irq_save(flags);
+
+       /* Load the entry into the TLB */
+       __update_tlb(vma, addr, pte);
+
+       /* ... and wire it up. */
+       status = __raw_readl(MMUCR);
+       urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT;
+       status &= ~MMUCR_URB;
+
+       /*
+        * Make sure we're not trying to wire the last TLB entry slot.
+        */
+       BUG_ON(!--urb);
+
+       urb = urb % MMUCR_URB_NENTRIES;
+
+       status |= (urb << MMUCR_URB_SHIFT);
+       __raw_writel(status, MMUCR);
+       ctrl_barrier();
+
+       local_irq_restore(flags);
+}
+
+/*
+ * Unwire the last wired TLB entry.
+ *
+ * It should also be noted that it is not possible to wire and unwire
+ * TLB entries in an arbitrary order. If you wire TLB entry N, followed
+ * by entry N+1, you must unwire entry N+1 first, then entry N. In this
+ * respect, it works like a stack or LIFO queue.
+ */
+void tlb_unwire_entry(void)
+{
+       unsigned long status, flags;
+       int urb;
+
+       local_irq_save(flags);
+
+       status = __raw_readl(MMUCR);
+       urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT;
+       status &= ~MMUCR_URB;
+
+       /*
+        * Make sure we're not trying to unwire a TLB entry when none
+        * have been wired.
+        */
+       BUG_ON(urb++ == MMUCR_URB_NENTRIES);
+
+       urb = urb % MMUCR_URB_NENTRIES;
+
+       status |= (urb << MMUCR_URB_SHIFT);
+       __raw_writel(status, MMUCR);
+       ctrl_barrier();
+
+       local_irq_restore(flags);
+}
index 6f45c1f8a7fedd72a3d839190cfa33d5acc4d53e..004bb3f25b5f5f7e080505e967fea140328d480b 100644 (file)
@@ -132,9 +132,9 @@ void local_flush_tlb_all(void)
         *      It's same position, bit #2.
         */
        local_irq_save(flags);
-       status = ctrl_inl(MMUCR);
+       status = __raw_readl(MMUCR);
        status |= 0x04;
-       ctrl_outl(status, MMUCR);
+       __raw_writel(status, MMUCR);
        ctrl_barrier();
        local_irq_restore(flags);
 }
index de0b0e881823c26ad5b3747eef517d842784832b..706da1d3a67a0f58ab645694b5a532b084ee38e6 100644 (file)
@@ -36,7 +36,7 @@ extern void die(const char *,struct pt_regs *,long);
 
 static inline void print_prots(pgprot_t prot)
 {
-       printk("prot is 0x%08lx\n",pgprot_val(prot));
+       printk("prot is 0x%016llx\n",pgprot_val(prot));
 
        printk("%s %s %s %s %s\n",PPROT(_PAGE_SHARED),PPROT(_PAGE_READ),
               PPROT(_PAGE_EXECUTE),PPROT(_PAGE_WRITE),PPROT(_PAGE_USER));
diff --git a/arch/sh/mm/uncached.c b/arch/sh/mm/uncached.c
new file mode 100644 (file)
index 0000000..cf20a5c
--- /dev/null
@@ -0,0 +1,34 @@
+#include <linux/init.h>
+#include <asm/sizes.h>
+#include <asm/page.h>
+
+/*
+ * This is the offset of the uncached section from its cached alias.
+ *
+ * Legacy platforms handle trivial transitions between cached and
+ * uncached segments by making use of the 1:1 mapping relationship in
+ * 512MB lowmem, others via a special uncached mapping.
+ *
+ * Default value only valid in 29 bit mode, in 32bit mode this will be
+ * updated by the early PMB initialization code.
+ */
+unsigned long cached_to_uncached = SZ_512M;
+unsigned long uncached_size = SZ_512M;
+unsigned long uncached_start, uncached_end;
+
+int virt_addr_uncached(unsigned long kaddr)
+{
+       return (kaddr >= uncached_start) && (kaddr < uncached_end);
+}
+
+void __init uncached_init(void)
+{
+       uncached_start = memory_end;
+       uncached_end = uncached_start + uncached_size;
+}
+
+void __init uncached_resize(unsigned long size)
+{
+       uncached_size = size;
+       uncached_end = uncached_start + uncached_size;
+}
index 558a56bcc7cff69d0e5fbd7035ed9a717ab94061..2082af1f3fef7036601c0f09da06b414e02e4f19 100644 (file)
@@ -13,4 +13,4 @@
 include/generated/machtypes.h: $(src)/gen-mach-types $(src)/mach-types
        @echo '  Generating $@'
        $(Q)mkdir -p $(dir $@)
-       $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
+       $(Q)LC_ALL=C $(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
index 6639b25d8d574cd255fe97ab7831658219b8c9e2..b25aa554ee5e8d03882ef1ce52576796a096055d 100644 (file)
@@ -32,6 +32,7 @@ DREAMCAST             SH_DREAMCAST
 SNAPGEAR               SH_SECUREEDGE5410
 EDOSK7705              SH_EDOSK7705
 EDOSK7760              SH_EDOSK7760
+SDK7786                        SH_SDK7786
 SH4202_MICRODEV                SH_SH4202_MICRODEV
 SH03                   SH_SH03
 LANDISK                        SH_LANDISK
index 108197ac0d56eda5d0effb398560629f6a276352..4097f6a10860c764bb2b4981bc32bef506c9ef28 100644 (file)
@@ -64,8 +64,11 @@ config BITS
        default 64 if SPARC64
 
 config GENERIC_TIME
+       def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
        bool
-       default y if SPARC64
+       default y if SPARC32
 
 config GENERIC_CMOS_UPDATE
        bool
index 983d59824a286d0cba34fa48ce078c7ab70eaa04..99a1f191497be29ce8e1cae10b5db72272551214 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31
-# Wed Sep 16 00:03:43 2009
+# Linux kernel version: 2.6.33-rc2
+# Mon Jan 11 23:20:31 2010
 #
 # CONFIG_64BIT is not set
 CONFIG_SPARC=y
@@ -41,6 +41,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=32
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -88,21 +89,21 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_PERF_COUNTERS is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
-# CONFIG_STRIP_ASM_SYMS is not set
 CONFIG_COMPAT_BRK=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
 CONFIG_HAVE_DMA_ATTRS=y
@@ -131,14 +132,41 @@ CONFIG_LBDAF=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
 # CONFIG_DEFAULT_DEADLINE is not set
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
 # CONFIG_FREEZER is not set
 
 #
@@ -168,8 +196,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 CONFIG_SUN_PM=y
 # CONFIG_SPARC_LED is not set
@@ -257,6 +284,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -295,9 +323,6 @@ CONFIG_NET_PKTGEN=m
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -335,6 +360,10 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
@@ -398,8 +427,11 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_CXGB3_ISCSI is not set
 # CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -434,7 +466,9 @@ CONFIG_SCSI_QLOGICPTI=m
 # CONFIG_SCSI_DEBUG is not set
 CONFIG_SCSI_SUNESP=y
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
@@ -450,7 +484,7 @@ CONFIG_SCSI_SUNESP=y
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -487,6 +521,7 @@ CONFIG_SUNQE=m
 # CONFIG_NET_PCI is not set
 # CONFIG_B44 is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_ATL2 is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
@@ -546,6 +581,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -555,6 +591,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -574,6 +611,7 @@ CONFIG_INPUT_KEYBOARD=y
 CONFIG_KEYBOARD_ATKBD=m
 # CONFIG_KEYBOARD_LKKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_KEYBOARD_SUNKBD=m
 # CONFIG_KEYBOARD_XTKBD is not set
@@ -604,6 +642,7 @@ CONFIG_SERIO_SERPORT=m
 # CONFIG_SERIO_PCIPS2 is not set
 CONFIG_SERIO_LIBPS2=m
 # CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -636,6 +675,7 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_CONSOLE_POLL=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
@@ -661,6 +701,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 # CONFIG_SENSORS_I5K_AMB is not set
 # CONFIG_SENSORS_F71805F is not set
 # CONFIG_SENSORS_F71882FG is not set
@@ -675,9 +720,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_VT8231 is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -699,6 +742,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Graphics support
 #
+CONFIG_VGA_ARB=y
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
@@ -776,7 +820,9 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 CONFIG_RTC_DRV_M48T59=y
+# CONFIG_RTC_DRV_MSM6242 is not set
 # CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -955,6 +1001,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
@@ -1003,9 +1050,9 @@ CONFIG_KGDB=y
 CONFIG_KGDB_SERIAL_CONSOLE=y
 CONFIG_KGDB_TESTS=y
 # CONFIG_KGDB_TESTS_ON_BOOT is not set
-# CONFIG_KMEMCHECK is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_STACK_DEBUG is not set
+# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
 
 #
 # Security options
@@ -1013,7 +1060,11 @@ CONFIG_KGDB_TESTS=y
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_CRYPTO=y
 
 #
index f80b881dfea77be89459b343c71fdeaa61a1ad68..41c5a56aa6f28b5a20c6c9e25215dafde9b3099b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.31
-# Tue Sep 15 17:06:03 2009
+# Linux kernel version: 2.6.33-rc2
+# Wed Jan 20 16:31:47 2010
 #
 CONFIG_64BIT=y
 CONFIG_SPARC=y
@@ -20,6 +20,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_HAVE_SETUP_PER_CPU_AREA=y
 CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
+CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 CONFIG_MMU=y
 CONFIG_ARCH_NO_VIRT_TO_BUS=y
@@ -50,6 +51,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
 #
 CONFIG_TREE_RCU=y
 # CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_TINY_RCU is not set
 # CONFIG_RCU_TRACE is not set
 CONFIG_RCU_FANOUT=64
 # CONFIG_RCU_FANOUT_EXACT is not set
@@ -62,8 +64,7 @@ CONFIG_RT_GROUP_SCHED=y
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
 # CONFIG_CGROUPS is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
 CONFIG_RELAY=y
 CONFIG_NAMESPACES=y
 # CONFIG_UTS_NS is not set
@@ -97,24 +98,25 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_AIO=y
-CONFIG_HAVE_PERF_COUNTERS=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
 
 #
-# Performance Counters
+# Kernel Performance Events And Counters
 #
-CONFIG_PERF_COUNTERS=y
+CONFIG_PERF_EVENTS=y
 CONFIG_EVENT_PROFILE=y
+CONFIG_PERF_COUNTERS=y
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_PCI_QUIRKS=y
 CONFIG_SLUB_DEBUG=y
-# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_COMPAT_BRK is not set
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 CONFIG_PROFILING=y
 CONFIG_TRACEPOINTS=y
-CONFIG_MARKERS=y
 CONFIG_OPROFILE=m
 CONFIG_HAVE_OPROFILE=y
 CONFIG_KPROBES=y
@@ -152,14 +154,41 @@ CONFIG_BLOCK_COMPAT=y
 # IO Schedulers
 #
 CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
+CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+CONFIG_INLINE_READ_UNLOCK=y
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+CONFIG_INLINE_WRITE_UNLOCK=y
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
 # CONFIG_FREEZER is not set
 
 #
@@ -179,6 +208,7 @@ CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_SPARC64_SMP=y
+CONFIG_EARLYFB=y
 CONFIG_SPARC64_PAGE_SIZE_8KB=y
 # CONFIG_SPARC64_PAGE_SIZE_64KB is not set
 CONFIG_SECCOMP=y
@@ -216,8 +246,7 @@ CONFIG_MIGRATION=y
 CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_NR_QUICK=1
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
 CONFIG_DEFAULT_MMAP_MIN_ADDR=8192
 CONFIG_SCHED_SMT=y
 CONFIG_SCHED_MC=y
@@ -315,6 +344,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
 CONFIG_INET6_XFRM_MODE_BEET=m
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
 CONFIG_IPV6_NDISC_NODETYPE=y
 CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -356,9 +386,6 @@ CONFIG_NET_TCPPROBE=m
 # CONFIG_AF_RXRPC is not set
 CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
-CONFIG_CFG80211_DEFAULT_PS_VALUE=0
-CONFIG_WIRELESS_OLD_REGULATORY=y
-# CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 
 #
@@ -376,6 +403,7 @@ CONFIG_WIRELESS_OLD_REGULATORY=y
 # Generic Driver Options
 #
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
 CONFIG_STANDALONE=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 CONFIG_FW_LOADER=y
@@ -397,6 +425,11 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_DRBD is not set
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
@@ -408,6 +441,7 @@ CONFIG_ATA_OVER_ETH=m
 CONFIG_SUNVDC=m
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
+# CONFIG_AD525X_DPOT is not set
 # CONFIG_PHANTOM is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
@@ -415,6 +449,7 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_ISL29003 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_C2PORT is not set
 
 #
@@ -522,8 +557,11 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_CXGB3_ISCSI is not set
 # CONFIG_SCSI_BNX2_ISCSI is not set
+# CONFIG_BE2ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_HPSA is not set
 # CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_3W_SAS is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -557,7 +595,9 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SUNESP is not set
 # CONFIG_SCSI_PMCRAID is not set
+# CONFIG_SCSI_PM8001 is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_BFA_FC is not set
 # CONFIG_SCSI_DH is not set
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
@@ -568,7 +608,9 @@ CONFIG_MD_RAID0=m
 CONFIG_MD_RAID1=m
 CONFIG_MD_RAID10=m
 CONFIG_MD_RAID456=m
+# CONFIG_MULTICORE_RAID456 is not set
 CONFIG_MD_RAID6_PQ=m
+# CONFIG_ASYNC_RAID6_TEST is not set
 CONFIG_MD_MULTIPATH=m
 # CONFIG_MD_FAULTY is not set
 CONFIG_BLK_DEV_DM=m
@@ -592,7 +634,7 @@ CONFIG_DM_ZERO=m
 #
 
 #
-# See the help texts for more information.
+# The newer stack is recommended.
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
@@ -664,6 +706,7 @@ CONFIG_NET_PCI=y
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
 # CONFIG_VIA_RHINE is not set
 # CONFIG_SC92031 is not set
 # CONFIG_ATL2 is not set
@@ -745,6 +788,7 @@ CONFIG_SLHC=m
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_VMXNET3 is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
@@ -754,6 +798,7 @@ CONFIG_SLHC=m
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
 # CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
 
 #
 # Userland interfaces
@@ -770,9 +815,13 @@ CONFIG_INPUT_EVDEV=y
 # Input Device Drivers
 #
 CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
 CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_QT2160 is not set
 CONFIG_KEYBOARD_LKKBD=m
+# CONFIG_KEYBOARD_MAX7359 is not set
 # CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_KEYBOARD_SUNKBD=y
 # CONFIG_KEYBOARD_XTKBD is not set
@@ -812,6 +861,7 @@ CONFIG_SERIO_I8042=y
 CONFIG_SERIO_PCIPS2=m
 CONFIG_SERIO_LIBPS2=y
 CONFIG_SERIO_RAW=m
+# CONFIG_SERIO_ALTERA_PS2 is not set
 # CONFIG_GAMEPORT is not set
 
 #
@@ -844,6 +894,7 @@ CONFIG_SERIAL_SUNHV=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
+# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -858,6 +909,7 @@ CONFIG_HW_RANDOM_N2RNG=m
 CONFIG_DEVPORT=y
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
 # CONFIG_I2C_CHARDEV is not set
 CONFIG_I2C_HELPER_AUTO=y
 CONFIG_I2C_ALGOBIT=y
@@ -897,11 +949,6 @@ CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_TINY_USB is not set
 
-#
-# Graphics adapter I2C/DDC channel drivers
-#
-# CONFIG_I2C_VOODOO3 is not set
-
 #
 # Other I2C/SMBus bus drivers
 #
@@ -911,10 +958,6 @@ CONFIG_I2C_ALGOBIT=y
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_DS1682 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
@@ -932,6 +975,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 # CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
@@ -955,6 +1003,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_GL520SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM73 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
@@ -981,6 +1030,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_VT8231 is not set
@@ -993,9 +1043,8 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_ULTRA45 is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
 
@@ -1013,16 +1062,20 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
+# CONFIG_PMIC_ADP5520 is not set
 # CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
 # CONFIG_MFD_WM8350_I2C is not set
 # CONFIG_MFD_PCF50633 is not set
 # CONFIG_AB3100_CORE is not set
+# CONFIG_MFD_88PM8607 is not set
 # CONFIG_REGULATOR is not set
 # CONFIG_MEDIA_SUPPORT is not set
 
 #
 # Graphics support
 #
+CONFIG_VGA_ARB=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -1176,6 +1229,7 @@ CONFIG_SND_ALI5451=m
 # CONFIG_SND_OXYGEN is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_CS46XX is not set
+# CONFIG_SND_CS5535AUDIO is not set
 # CONFIG_SND_CTXFI is not set
 # CONFIG_SND_DARLA20 is not set
 # CONFIG_SND_GINA20 is not set
@@ -1311,6 +1365,7 @@ CONFIG_USB_EHCI_HCD=m
 # CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1426,6 +1481,7 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
 # CONFIG_RTC_DRV_RX8581 is not set
@@ -1447,7 +1503,9 @@ CONFIG_RTC_DRV_CMOS=y
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_M48T35 is not set
 CONFIG_RTC_DRV_M48T59=y
+# CONFIG_RTC_DRV_MSM6242 is not set
 CONFIG_RTC_DRV_BQ4802=y
+# CONFIG_RTC_DRV_RP5C01 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
@@ -1625,6 +1683,7 @@ CONFIG_PRINTK_TIME=y
 CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=2048
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
@@ -1678,9 +1737,11 @@ CONFIG_NOP_TRACER=y
 CONFIG_HAVE_FUNCTION_TRACER=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_RING_BUFFER=y
 CONFIG_EVENT_TRACING=y
 CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
 CONFIG_TRACING=y
 CONFIG_GENERIC_TRACER=y
 CONFIG_TRACING_SUPPORT=y
@@ -1688,6 +1749,7 @@ CONFIG_FTRACE=y
 # CONFIG_FUNCTION_TRACER is not set
 # CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
+# CONFIG_FTRACE_SYSCALLS is not set
 # CONFIG_BOOT_TRACER is not set
 CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
@@ -1706,6 +1768,7 @@ CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_DCFLUSH is not set
 # CONFIG_STACK_DEBUG is not set
+# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
 
 #
 # Security options
@@ -1714,11 +1777,17 @@ CONFIG_KEYS=y
 # CONFIG_KEYS_DEBUG_PROC_KEYS is not set
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_DEFAULT_SECURITY_SELINUX is not set
+# CONFIG_DEFAULT_SECURITY_SMACK is not set
+# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
 CONFIG_XOR_BLOCKS=m
 CONFIG_ASYNC_CORE=m
 CONFIG_ASYNC_MEMCPY=m
 CONFIG_ASYNC_XOR=m
+CONFIG_ASYNC_PQ=m
+CONFIG_ASYNC_RAID6_RECOV=m
 CONFIG_CRYPTO=y
 
 #
index ff66bb88537b37539812173a7825d1da39a82810..e67880381b84e6a0ebe04f1d6ef8efd2ce00d662 100644 (file)
@@ -195,17 +195,10 @@ static inline unsigned int sparc64_elf_hwcap(void)
 #define ELF_PLATFORM   (NULL)
 
 #define SET_PERSONALITY(ex)                            \
-do {   unsigned long new_flags = current_thread_info()->flags; \
-       new_flags &= _TIF_32BIT;                        \
-       if ((ex).e_ident[EI_CLASS] == ELFCLASS32)       \
-               new_flags |= _TIF_32BIT;                \
+do {   if ((ex).e_ident[EI_CLASS] == ELFCLASS32)       \
+               set_thread_flag(TIF_32BIT);             \
        else                                            \
-               new_flags &= ~_TIF_32BIT;               \
-       if ((current_thread_info()->flags & _TIF_32BIT) \
-           != new_flags)                               \
-               set_thread_flag(TIF_ABI_PENDING);       \
-       else                                            \
-               clear_thread_flag(TIF_ABI_PENDING);     \
+               clear_thread_flag(TIF_32BIT);           \
        /* flush_thread will update pgd cache */        \
        if (personality(current->personality) != PER_LINUX32)   \
                set_personality(PER_LINUX |             \
index 93fe21e02c86b0c7607f06c813532223220a68cf..679c7504625acc86deab57d1e1feada4ef408317 100644 (file)
@@ -8,7 +8,7 @@
 #include <asm/page.h>      /* IO address mapping routines need this */
 #include <asm/system.h>
 
-#define page_to_phys(page)     (((page) - mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
 
 static inline u32 flip_dword (u32 l)
 {
index f72080bdda947ec81edce5206842d836755f4521..156707b0f18d1ba4a5fbd01fc972fbec8c529c0d 100644 (file)
@@ -143,7 +143,7 @@ extern unsigned long pfn_base;
 #define phys_to_virt           __va
 
 #define ARCH_PFN_OFFSET                (pfn_base)
-#define virt_to_page(kaddr)    (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT)))
+#define virt_to_page(kaddr)    pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 
 #define pfn_valid(pfn)         (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr))
 #define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr)
index 9836d9a3cb9abd31b17ac51a5da51209ea72fa5d..0bc356bf8c505d1087d1668de130b30ef1234d40 100644 (file)
@@ -1,22 +1,7 @@
 #ifndef _ASMSPARC_PARAM_H
 #define _ASMSPARC_PARAM_H
 
-#ifdef __KERNEL__
-# define HZ            CONFIG_HZ       /* Internal kernel timer frequency */
-# define USER_HZ       100     /* .. some user interfaces are in "ticks" */
-# define CLOCKS_PER_SEC (USER_HZ)
-#endif
-
-#ifndef HZ
-#define HZ 100
-#endif
-
 #define EXEC_PAGESIZE  8192    /* Thanks for sun4's we carry baggage... */
+#include <asm-generic/param.h>
 
-#ifndef NOGROUP
-#define NOGROUP                (-1)
-#endif
-
-#define MAXHOSTNAMELEN 64      /* max length of hostname */
-
-#endif
+#endif /* _ASMSPARC_PARAM_H */
index 55db5eca08e25da163b4c2156c51783b5b036f74..39327d6a57eb3b60b50d5bd47473c9f14223581c 100644 (file)
@@ -53,8 +53,8 @@ struct stat {
        ino_t           st_ino;
        mode_t          st_mode;
        short           st_nlink;
-       uid_t           st_uid;
-       gid_t           st_gid;
+       uid16_t         st_uid;
+       gid16_t         st_gid;
        unsigned short  st_rdev;
        off_t           st_size;
        time_t          st_atime;
index 7486c605e23cb36832ec74019c4adad2a68ec0a9..025a02ad2e31c9a87c15350241234b8943e04ae6 100644 (file)
@@ -5,6 +5,13 @@
 #include <linux/sched.h>
 #include <asm/ptrace.h>
 
+/*
+ * The syscall table always contains 32 bit pointers since we know that the
+ * address of the function to be called is (way) below 4GB.  So the "int"
+ * type here is what we want [need] for both 32 bit and 64 bit systems.
+ */
+extern const unsigned int sys_call_table[];
+
 /* The system call number is given by the user in %g1 */
 static inline long syscall_get_nr(struct task_struct *task,
                                  struct pt_regs *regs)
index 7257ebb8f3949818ede9fc562fc1a6ddb6d8be1f..39be9f256e5a5b6f24d1f1604759b6cbad2b5f4b 100644 (file)
@@ -228,12 +228,11 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define TIF_SECCOMP            9       /* secure computing */
 #define TIF_SYSCALL_AUDIT      10      /* syscall auditing active */
 #define TIF_SYSCALL_TRACEPOINT 11      /* syscall tracepoint instrumentation */
-/* flag bit 11 is available */
 /* NOTE: Thread flags >= 12 should be ones we have no interest
  *       in using in assembly, else we can't use the mask as
  *       an immediate value in instructions such as andcc.
  */
-#define TIF_ABI_PENDING                12
+/* flag bit 12 is available */
 #define TIF_MEMDIE             13
 #define TIF_POLLING_NRFLAG     14
 #define TIF_FREEZE             15      /* is freezing for suspend */
@@ -248,7 +247,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define _TIF_SECCOMP           (1<<TIF_SECCOMP)
 #define _TIF_SYSCALL_AUDIT     (1<<TIF_SYSCALL_AUDIT)
 #define _TIF_SYSCALL_TRACEPOINT        (1<<TIF_SYSCALL_TRACEPOINT)
-#define _TIF_ABI_PENDING       (1<<TIF_ABI_PENDING)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE            (1<<TIF_FREEZE)
 
index b6ccdb0d6f7de3fb23b8691c036be8acaa62e91f..a254750e4c03715c57389a4767928af18feb0593 100644 (file)
@@ -12,4 +12,5 @@
 typedef unsigned long cycles_t;
 #define get_cycles()   (0)
 
+extern u32 (*do_arch_gettimeoffset)(void);
 #endif
index 600a79035fa1066038861b0f435e9a44f8c4e49d..1c79f32734a05694a5297c7034ff0e6b93fe83f6 100644 (file)
@@ -12,7 +12,9 @@ static inline int cpu_to_node(int cpu)
 
 #define parent_node(node)      (node)
 
-#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
+#define cpumask_of_node(node) ((node) == -1 ?                          \
+                              cpu_all_mask :                           \
+                              &numa_cpumask_lookup_table[node])
 
 struct pci_bus;
 #ifdef CONFIG_PCI
index 489d2ba92bcb504e3d6243e36cef99bddf08e4c3..25f1d10155e8a3d6c0a9de590d9e14b2664508ba 100644 (file)
@@ -274,7 +274,7 @@ static inline unsigned long copy_from_user(void *to, const void __user *from, un
 
        if (unlikely(sz != -1 && sz < n)) {
                copy_from_user_overflow();
-               return -EFAULT;
+               return n;
        }
 
        if (n && __access_ok((unsigned long) from, n))
index dbc141660994915c23c059b844772ae855681bdc..2406788bfe5f6b1a65c90dde46029ffbeb065807 100644 (file)
@@ -221,8 +221,8 @@ extern unsigned long copy_from_user_fixup(void *to, const void __user *from,
 static inline unsigned long __must_check
 copy_from_user(void *to, const void __user *from, unsigned long size)
 {
-       unsigned long ret = (unsigned long) -EFAULT;
        int sz = __compiletime_object_size(to);
+       unsigned long ret = size;
 
        if (likely(sz == -1 || sz >= size)) {
                ret = ___copy_from_user(to, from, size);
index f3b5466c389cc5fe1a4e44decf12b3e1a65bae9c..4589ca33220ff6463dbd7191259d01debb5fb13f 100644 (file)
@@ -99,7 +99,7 @@ static int __devinit clock_board_probe(struct of_device *op,
 
        p->leds_resource.start = (unsigned long)
                (p->clock_regs + CLOCK_CTRL);
-       p->leds_resource.end = p->leds_resource.end;
+       p->leds_resource.end = p->leds_resource.start;
        p->leds_resource.name = "leds";
 
        p->leds_pdev.name = "sunfire-clockboard-leds";
@@ -194,7 +194,7 @@ static int __devinit fhc_probe(struct of_device *op,
        if (!p->central) {
                p->leds_resource.start = (unsigned long)
                        (p->pregs + FHC_PREGS_CTRL);
-               p->leds_resource.end = p->leds_resource.end;
+               p->leds_resource.end = p->leds_resource.start;
                p->leds_resource.name = "leds";
 
                p->leds_pdev.name = "sunfire-fhc-leds";
index b171ae8de90dc5b49aa410c03c166603c37b4d02..b062de9424a484d51e1513e8a0b2ffb86a86faff 100644 (file)
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
 
        cur_inst = 0;
        for_each_node_by_type(dp, "cpu") {
-               int err = check_cpu_node(dp->node, &cur_inst,
+               int err = check_cpu_node(dp->phandle, &cur_inst,
                                         compare, compare_arg,
                                         prom_node, mid);
                if (!err) {
index 29973daa993013f404c711b29fcf1fcc3c6ea457..9103a56b39e839aed5af1f1f7b8fa78b9f7beee3 100644 (file)
@@ -91,14 +91,3 @@ int __init ftrace_dyn_arch_init(void *data)
        return 0;
 }
 #endif
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-
-extern unsigned int sys_call_table[];
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-       return (unsigned long)sys_call_table[nr];
-}
-
-#endif
index 8d6882bb480a7b9aea91eabc7aee588db563055f..e1cbdb94d97bc10030e7ac5add8f1b22a54cc47e 100644 (file)
@@ -250,12 +250,12 @@ struct irq_handler_data {
 };
 
 #ifdef CONFIG_SMP
-static int irq_choose_cpu(unsigned int virt_irq)
+static int irq_choose_cpu(unsigned int virt_irq, const struct cpumask *affinity)
 {
        cpumask_t mask;
        int cpuid;
 
-       cpumask_copy(&mask, irq_desc[virt_irq].affinity);
+       cpumask_copy(&mask, affinity);
        if (cpus_equal(mask, cpu_online_map)) {
                cpuid = map_to_cpu(virt_irq);
        } else {
@@ -268,10 +268,8 @@ static int irq_choose_cpu(unsigned int virt_irq)
        return cpuid;
 }
 #else
-static int irq_choose_cpu(unsigned int virt_irq)
-{
-       return real_hard_smp_processor_id();
-}
+#define irq_choose_cpu(virt_irq, affinity)     \
+       real_hard_smp_processor_id()
 #endif
 
 static void sun4u_irq_enable(unsigned int virt_irq)
@@ -282,7 +280,8 @@ static void sun4u_irq_enable(unsigned int virt_irq)
                unsigned long cpuid, imap, val;
                unsigned int tid;
 
-               cpuid = irq_choose_cpu(virt_irq);
+               cpuid = irq_choose_cpu(virt_irq,
+                                      irq_desc[virt_irq].affinity);
                imap = data->imap;
 
                tid = sun4u_compute_tid(imap, cpuid);
@@ -299,7 +298,24 @@ static void sun4u_irq_enable(unsigned int virt_irq)
 static int sun4u_set_affinity(unsigned int virt_irq,
                               const struct cpumask *mask)
 {
-       sun4u_irq_enable(virt_irq);
+       struct irq_handler_data *data = get_irq_chip_data(virt_irq);
+
+       if (likely(data)) {
+               unsigned long cpuid, imap, val;
+               unsigned int tid;
+
+               cpuid = irq_choose_cpu(virt_irq, mask);
+               imap = data->imap;
+
+               tid = sun4u_compute_tid(imap, cpuid);
+
+               val = upa_readq(imap);
+               val &= ~(IMAP_TID_UPA | IMAP_TID_JBUS |
+                        IMAP_AID_SAFARI | IMAP_NID_SAFARI);
+               val |= tid | IMAP_VALID;
+               upa_writeq(val, imap);
+               upa_writeq(ICLR_IDLE, data->iclr);
+       }
 
        return 0;
 }
@@ -340,7 +356,8 @@ static void sun4u_irq_eoi(unsigned int virt_irq)
 static void sun4v_irq_enable(unsigned int virt_irq)
 {
        unsigned int ino = virt_irq_table[virt_irq].dev_ino;
-       unsigned long cpuid = irq_choose_cpu(virt_irq);
+       unsigned long cpuid = irq_choose_cpu(virt_irq,
+                                            irq_desc[virt_irq].affinity);
        int err;
 
        err = sun4v_intr_settarget(ino, cpuid);
@@ -361,7 +378,7 @@ static int sun4v_set_affinity(unsigned int virt_irq,
                               const struct cpumask *mask)
 {
        unsigned int ino = virt_irq_table[virt_irq].dev_ino;
-       unsigned long cpuid = irq_choose_cpu(virt_irq);
+       unsigned long cpuid = irq_choose_cpu(virt_irq, mask);
        int err;
 
        err = sun4v_intr_settarget(ino, cpuid);
@@ -403,7 +420,7 @@ static void sun4v_virq_enable(unsigned int virt_irq)
        unsigned long cpuid, dev_handle, dev_ino;
        int err;
 
-       cpuid = irq_choose_cpu(virt_irq);
+       cpuid = irq_choose_cpu(virt_irq, irq_desc[virt_irq].affinity);
 
        dev_handle = virt_irq_table[virt_irq].dev_handle;
        dev_ino = virt_irq_table[virt_irq].dev_ino;
@@ -433,7 +450,7 @@ static int sun4v_virt_set_affinity(unsigned int virt_irq,
        unsigned long cpuid, dev_handle, dev_ino;
        int err;
 
-       cpuid = irq_choose_cpu(virt_irq);
+       cpuid = irq_choose_cpu(virt_irq, mask);
 
        dev_handle = virt_irq_table[virt_irq].dev_handle;
        dev_ino = virt_irq_table[virt_irq].dev_ino;
index 4248d969272f1f92a7470a15bc631c72bd628f24..5247283d1c03e57c94d40ebfea4074cdf7db3100 100644 (file)
@@ -11,6 +11,10 @@ static inline bool kstack_valid(struct thread_info *tp, unsigned long sp)
 {
        unsigned long base = (unsigned long) tp;
 
+       /* Stack pointer must be 16-byte aligned.  */
+       if (sp & (16UL - 1))
+               return false;
+
        if (sp >= (base + sizeof(struct thread_info)) &&
            sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
                return true;
index 4c26eb59e742ae0cd301ce0a982a8190dd7af6d6..da527b33ebc708ad2693d9932bbae97f671e2d88 100644 (file)
@@ -105,7 +105,7 @@ static unsigned long of_bus_sbus_get_flags(const u32 *addr, unsigned long flags)
 
 static int of_bus_ambapp_match(struct device_node *np)
 {
-       return !strcmp(np->name, "ambapp");
+       return !strcmp(np->type, "ambapp");
 }
 
 static void of_bus_ambapp_count_cells(struct device_node *child,
@@ -433,7 +433,7 @@ build_resources:
        if (!parent)
                dev_set_name(&op->dev, "root");
        else
-               dev_set_name(&op->dev, "%08x", dp->node);
+               dev_set_name(&op->dev, "%08x", dp->phandle);
 
        if (of_device_register(op)) {
                printk("%s: Could not register of device.\n",
index 0a6f2d1798d11b37b5f8570b8bafb0326531d164..b3d4cb5d21b333c54fee00998491644397eb92d1 100644 (file)
@@ -676,7 +676,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
        if (!parent)
                dev_set_name(&op->dev, "root");
        else
-               dev_set_name(&op->dev, "%08x", dp->node);
+               dev_set_name(&op->dev, "%08x", dp->phandle);
 
        if (of_device_register(op)) {
                printk("%s: Could not register of device.\n",
index 539e83f8e087a56bda4e0749ebb39329ea7eab93..37b66c60abe32f7d76471bbcca7fbe49f7530749 100644 (file)
@@ -247,6 +247,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
                                         struct pci_bus *bus, int devfn)
 {
        struct dev_archdata *sd;
+       struct pci_slot *slot;
        struct of_device *op;
        struct pci_dev *dev;
        const char *type;
@@ -286,6 +287,11 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        dev->dev.bus = &pci_bus_type;
        dev->devfn = devfn;
        dev->multifunction = 0;         /* maybe a lie? */
+       set_pcie_port_type(dev);
+
+       list_for_each_entry(slot, &dev->bus->slots, list)
+               if (PCI_SLOT(dev->devfn) == slot->number)
+                       dev->slot = slot;
 
        dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
        dev->device = of_getintprop_default(node, "device-id", 0xffff);
@@ -322,6 +328,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
 
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
+       dev->dma_mask = 0xffffffff;
 
        if (!strcmp(node->name, "pci")) {
                /* a PCI-PCI bridge */
@@ -715,9 +722,10 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
 {
 }
 
-void pcibios_align_resource(void *data, struct resource *res,
-                           resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
+       return res->start;
 }
 
 int pcibios_enable_device(struct pci_dev *dev, int mask)
index 85e7037429b97cac7a9d5eedebe80bab00eb5eee..75e88c00bca397cf7738227a825ebe71f9e60100 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/oplib.h>
 #include <asm/prom.h>
 #include <asm/pcic.h>
+#include <asm/timex.h>
 #include <asm/timer.h>
 #include <asm/uaccess.h>
 #include <asm/irq_regs.h>
@@ -163,8 +164,6 @@ void __iomem *pcic_regs;
 volatile int pcic_speculative;
 volatile int pcic_trapped;
 
-static void pci_do_gettimeofday(struct timeval *tv);
-static int pci_do_settimeofday(struct timespec *tv);
 
 #define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
 
@@ -716,19 +715,27 @@ static irqreturn_t pcic_timer_handler (int irq, void *h)
 #define USECS_PER_JIFFY  10000  /* We have 100HZ "standard" timer for sparc */
 #define TICK_TIMER_LIMIT ((100*1000000/4)/100)
 
+u32 pci_gettimeoffset(void)
+{
+       /*
+        * We divide all by 100
+        * to have microsecond resolution and to avoid overflow
+        */
+       unsigned long count =
+           readl(pcic0.pcic_regs+PCI_SYS_COUNTER) & ~PCI_SYS_COUNTER_OVERFLOW;
+       count = ((count/100)*USECS_PER_JIFFY) / (TICK_TIMER_LIMIT/100);
+       return count * 1000;
+}
+
+
 void __init pci_time_init(void)
 {
        struct linux_pcic *pcic = &pcic0;
        unsigned long v;
        int timer_irq, irq;
 
-       /* A hack until do_gettimeofday prototype is moved to arch specific headers
-          and btfixupped. Patch do_gettimeofday with ba pci_do_gettimeofday; nop */
-       ((unsigned int *)do_gettimeofday)[0] = 
-           0x10800000 | ((((unsigned long)pci_do_gettimeofday -
-            (unsigned long)do_gettimeofday) >> 2) & 0x003fffff);
-       ((unsigned int *)do_gettimeofday)[1] = 0x01000000;
-       BTFIXUPSET_CALL(bus_do_settimeofday, pci_do_settimeofday, BTFIXUPCALL_NORM);
+       do_arch_gettimeoffset = pci_gettimeoffset;
+
        btfixup();
 
        writel (TICK_TIMER_LIMIT, pcic->pcic_regs+PCI_SYS_LIMIT);
@@ -746,84 +753,6 @@ void __init pci_time_init(void)
        local_irq_enable();
 }
 
-static inline unsigned long do_gettimeoffset(void)
-{
-       /*
-        * We divide all by 100
-        * to have microsecond resolution and to avoid overflow
-        */
-       unsigned long count =
-           readl(pcic0.pcic_regs+PCI_SYS_COUNTER) & ~PCI_SYS_COUNTER_OVERFLOW;
-       count = ((count/100)*USECS_PER_JIFFY) / (TICK_TIMER_LIMIT/100);
-       return count;
-}
-
-static void pci_do_gettimeofday(struct timeval *tv)
-{
-       unsigned long flags;
-       unsigned long seq;
-       unsigned long usec, sec;
-       unsigned long max_ntp_tick = tick_usec - tickadj;
-
-       do {
-               seq = read_seqbegin_irqsave(&xtime_lock, flags);
-               usec = do_gettimeoffset();
-
-               /*
-                * If time_adjust is negative then NTP is slowing the clock
-                * so make sure not to go into next possible interval.
-                * Better to lose some accuracy than have time go backwards..
-                */
-               if (unlikely(time_adjust < 0))
-                       usec = min(usec, max_ntp_tick);
-
-               sec = xtime.tv_sec;
-               usec += (xtime.tv_nsec / 1000);
-       } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
-       while (usec >= 1000000) {
-               usec -= 1000000;
-               sec++;
-       }
-
-       tv->tv_sec = sec;
-       tv->tv_usec = usec;
-}
-
-static int pci_do_settimeofday(struct timespec *tv)
-{
-       if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
-               return -EINVAL;
-
-       /*
-        * This is revolting. We need to set "xtime" correctly. However, the
-        * value in this location is the value at the most recent update of
-        * wall time.  Discover what correction gettimeofday() would have
-        * made, and then undo it!
-        */
-       tv->tv_nsec -= 1000 * do_gettimeoffset();
-       while (tv->tv_nsec < 0) {
-               tv->tv_nsec += NSEC_PER_SEC;
-               tv->tv_sec--;
-       }
-
-       wall_to_monotonic.tv_sec += xtime.tv_sec - tv->tv_sec;
-       wall_to_monotonic.tv_nsec += xtime.tv_nsec - tv->tv_nsec;
-
-       if (wall_to_monotonic.tv_nsec > NSEC_PER_SEC) {
-               wall_to_monotonic.tv_nsec -= NSEC_PER_SEC;
-               wall_to_monotonic.tv_sec++;
-       }
-       if (wall_to_monotonic.tv_nsec < 0) {
-               wall_to_monotonic.tv_nsec += NSEC_PER_SEC;
-               wall_to_monotonic.tv_sec--;
-       }
-
-       xtime.tv_sec = tv->tv_sec;
-       xtime.tv_nsec = tv->tv_nsec;
-       ntp_clear();
-       return 0;
-}
 
 #if 0
 static void watchdog_reset() {
@@ -839,9 +768,10 @@ char * __devinit pcibios_setup(char *str)
        return str;
 }
 
-void pcibios_align_resource(void *data, struct resource *res,
-                           resource_size_t size, resource_size_t align)
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
+       return res->start;
 }
 
 int pcibios_enable_device(struct pci_dev *pdev, int mask)
index 198fb4e79ba2875289a58cae60acb47c3442fb23..9f2b2bac8b2be58f86486343037c36e457e8c5ed 100644 (file)
@@ -1,6 +1,6 @@
 /* Performance event support for sparc64.
  *
- * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
+ * Copyright (C) 2009, 2010 David S. Miller <davem@davemloft.net>
  *
  * This code is based almost entirely upon the x86 perf event
  * code, which is:
 #include <linux/kdebug.h>
 #include <linux/mutex.h>
 
+#include <asm/stacktrace.h>
 #include <asm/cpudata.h>
+#include <asm/uaccess.h>
 #include <asm/atomic.h>
 #include <asm/nmi.h>
 #include <asm/pcr.h>
 
+#include "kstack.h"
+
 /* Sparc64 chips have two performance counters, 32-bits each, with
  * overflow interrupts generated on transition from 0xffffffff to 0.
  * The counters are accessed in one go using a 64-bit register.
 
 #define PIC_UPPER_INDEX                        0
 #define PIC_LOWER_INDEX                        1
+#define PIC_NO_INDEX                   -1
 
 struct cpu_hw_events {
-       struct perf_event       *events[MAX_HWEVENTS];
-       unsigned long           used_mask[BITS_TO_LONGS(MAX_HWEVENTS)];
-       unsigned long           active_mask[BITS_TO_LONGS(MAX_HWEVENTS)];
+       /* Number of events currently scheduled onto this cpu.
+        * This tells how many entries in the arrays below
+        * are valid.
+        */
+       int                     n_events;
+
+       /* Number of new events added since the last hw_perf_disable().
+        * This works because the perf event layer always adds new
+        * events inside of a perf_{disable,enable}() sequence.
+        */
+       int                     n_added;
+
+       /* Array of events current scheduled on this cpu.  */
+       struct perf_event       *event[MAX_HWEVENTS];
+
+       /* Array of encoded longs, specifying the %pcr register
+        * encoding and the mask of PIC counters this even can
+        * be scheduled on.  See perf_event_encode() et al.
+        */
+       unsigned long           events[MAX_HWEVENTS];
+
+       /* The current counter index assigned to an event.  When the
+        * event hasn't been programmed into the cpu yet, this will
+        * hold PIC_NO_INDEX.  The event->hw.idx value tells us where
+        * we ought to schedule the event.
+        */
+       int                     current_idx[MAX_HWEVENTS];
+
+       /* Software copy of %pcr register on this cpu.  */
        u64                     pcr;
+
+       /* Enabled/disable state.  */
        int                     enabled;
 };
 DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
 
+/* An event map describes the characteristics of a performance
+ * counter event.  In particular it gives the encoding as well as
+ * a mask telling which counters the event can be measured on.
+ */
 struct perf_event_map {
        u16     encoding;
        u8      pic_mask;
@@ -69,15 +106,20 @@ struct perf_event_map {
 #define PIC_LOWER      0x02
 };
 
+/* Encode a perf_event_map entry into a long.  */
 static unsigned long perf_event_encode(const struct perf_event_map *pmap)
 {
        return ((unsigned long) pmap->encoding << 16) | pmap->pic_mask;
 }
 
-static void perf_event_decode(unsigned long val, u16 *enc, u8 *msk)
+static u8 perf_event_get_msk(unsigned long val)
 {
-       *msk = val & 0xff;
-       *enc = val >> 16;
+       return val & 0xff;
+}
+
+static u64 perf_event_get_enc(unsigned long val)
+{
+       return val >> 16;
 }
 
 #define C(x) PERF_COUNT_HW_CACHE_##x
@@ -491,53 +533,6 @@ static inline void sparc_pmu_disable_event(struct cpu_hw_events *cpuc, struct hw
        pcr_ops->write(cpuc->pcr);
 }
 
-void hw_perf_enable(void)
-{
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       u64 val;
-       int i;
-
-       if (cpuc->enabled)
-               return;
-
-       cpuc->enabled = 1;
-       barrier();
-
-       val = cpuc->pcr;
-
-       for (i = 0; i < MAX_HWEVENTS; i++) {
-               struct perf_event *cp = cpuc->events[i];
-               struct hw_perf_event *hwc;
-
-               if (!cp)
-                       continue;
-               hwc = &cp->hw;
-               val |= hwc->config_base;
-       }
-
-       cpuc->pcr = val;
-
-       pcr_ops->write(cpuc->pcr);
-}
-
-void hw_perf_disable(void)
-{
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       u64 val;
-
-       if (!cpuc->enabled)
-               return;
-
-       cpuc->enabled = 0;
-
-       val = cpuc->pcr;
-       val &= ~(PCR_UTRACE | PCR_STRACE |
-                sparc_pmu->hv_bit | sparc_pmu->irq_bit);
-       cpuc->pcr = val;
-
-       pcr_ops->write(cpuc->pcr);
-}
-
 static u32 read_pmc(int idx)
 {
        u64 val;
@@ -566,6 +561,30 @@ static void write_pmc(int idx, u64 val)
        write_pic(pic);
 }
 
+static u64 sparc_perf_event_update(struct perf_event *event,
+                                  struct hw_perf_event *hwc, int idx)
+{
+       int shift = 64 - 32;
+       u64 prev_raw_count, new_raw_count;
+       s64 delta;
+
+again:
+       prev_raw_count = atomic64_read(&hwc->prev_count);
+       new_raw_count = read_pmc(idx);
+
+       if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+                            new_raw_count) != prev_raw_count)
+               goto again;
+
+       delta = (new_raw_count << shift) - (prev_raw_count << shift);
+       delta >>= shift;
+
+       atomic64_add(delta, &event->count);
+       atomic64_sub(delta, &hwc->period_left);
+
+       return new_raw_count;
+}
+
 static int sparc_perf_event_set_period(struct perf_event *event,
                                       struct hw_perf_event *hwc, int idx)
 {
@@ -598,81 +617,166 @@ static int sparc_perf_event_set_period(struct perf_event *event,
        return ret;
 }
 
-static int sparc_pmu_enable(struct perf_event *event)
+/* If performance event entries have been added, move existing
+ * events around (if necessary) and then assign new entries to
+ * counters.
+ */
+static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
 {
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       struct hw_perf_event *hwc = &event->hw;
-       int idx = hwc->idx;
+       int i;
 
-       if (test_and_set_bit(idx, cpuc->used_mask))
-               return -EAGAIN;
+       if (!cpuc->n_added)
+               goto out;
 
-       sparc_pmu_disable_event(cpuc, hwc, idx);
+       /* Read in the counters which are moving.  */
+       for (i = 0; i < cpuc->n_events; i++) {
+               struct perf_event *cp = cpuc->event[i];
 
-       cpuc->events[idx] = event;
-       set_bit(idx, cpuc->active_mask);
+               if (cpuc->current_idx[i] != PIC_NO_INDEX &&
+                   cpuc->current_idx[i] != cp->hw.idx) {
+                       sparc_perf_event_update(cp, &cp->hw,
+                                               cpuc->current_idx[i]);
+                       cpuc->current_idx[i] = PIC_NO_INDEX;
+               }
+       }
 
-       sparc_perf_event_set_period(event, hwc, idx);
-       sparc_pmu_enable_event(cpuc, hwc, idx);
-       perf_event_update_userpage(event);
-       return 0;
+       /* Assign to counters all unassigned events.  */
+       for (i = 0; i < cpuc->n_events; i++) {
+               struct perf_event *cp = cpuc->event[i];
+               struct hw_perf_event *hwc = &cp->hw;
+               int idx = hwc->idx;
+               u64 enc;
+
+               if (cpuc->current_idx[i] != PIC_NO_INDEX)
+                       continue;
+
+               sparc_perf_event_set_period(cp, hwc, idx);
+               cpuc->current_idx[i] = idx;
+
+               enc = perf_event_get_enc(cpuc->events[i]);
+               pcr |= event_encoding(enc, idx);
+       }
+out:
+       return pcr;
 }
 
-static u64 sparc_perf_event_update(struct perf_event *event,
-                                  struct hw_perf_event *hwc, int idx)
+void hw_perf_enable(void)
 {
-       int shift = 64 - 32;
-       u64 prev_raw_count, new_raw_count;
-       s64 delta;
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       u64 pcr;
 
-again:
-       prev_raw_count = atomic64_read(&hwc->prev_count);
-       new_raw_count = read_pmc(idx);
+       if (cpuc->enabled)
+               return;
 
-       if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
-                            new_raw_count) != prev_raw_count)
-               goto again;
+       cpuc->enabled = 1;
+       barrier();
 
-       delta = (new_raw_count << shift) - (prev_raw_count << shift);
-       delta >>= shift;
+       pcr = cpuc->pcr;
+       if (!cpuc->n_events) {
+               pcr = 0;
+       } else {
+               pcr = maybe_change_configuration(cpuc, pcr);
 
-       atomic64_add(delta, &event->count);
-       atomic64_sub(delta, &hwc->period_left);
+               /* We require that all of the events have the same
+                * configuration, so just fetch the settings from the
+                * first entry.
+                */
+               cpuc->pcr = pcr | cpuc->event[0]->hw.config_base;
+       }
 
-       return new_raw_count;
+       pcr_ops->write(cpuc->pcr);
+}
+
+void hw_perf_disable(void)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       u64 val;
+
+       if (!cpuc->enabled)
+               return;
+
+       cpuc->enabled = 0;
+       cpuc->n_added = 0;
+
+       val = cpuc->pcr;
+       val &= ~(PCR_UTRACE | PCR_STRACE |
+                sparc_pmu->hv_bit | sparc_pmu->irq_bit);
+       cpuc->pcr = val;
+
+       pcr_ops->write(cpuc->pcr);
 }
 
 static void sparc_pmu_disable(struct perf_event *event)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
        struct hw_perf_event *hwc = &event->hw;
-       int idx = hwc->idx;
+       unsigned long flags;
+       int i;
 
-       clear_bit(idx, cpuc->active_mask);
-       sparc_pmu_disable_event(cpuc, hwc, idx);
+       local_irq_save(flags);
+       perf_disable();
+
+       for (i = 0; i < cpuc->n_events; i++) {
+               if (event == cpuc->event[i]) {
+                       int idx = cpuc->current_idx[i];
+
+                       /* Shift remaining entries down into
+                        * the existing slot.
+                        */
+                       while (++i < cpuc->n_events) {
+                               cpuc->event[i - 1] = cpuc->event[i];
+                               cpuc->events[i - 1] = cpuc->events[i];
+                               cpuc->current_idx[i - 1] =
+                                       cpuc->current_idx[i];
+                       }
+
+                       /* Absorb the final count and turn off the
+                        * event.
+                        */
+                       sparc_pmu_disable_event(cpuc, hwc, idx);
+                       barrier();
+                       sparc_perf_event_update(event, hwc, idx);
 
-       barrier();
+                       perf_event_update_userpage(event);
 
-       sparc_perf_event_update(event, hwc, idx);
-       cpuc->events[idx] = NULL;
-       clear_bit(idx, cpuc->used_mask);
+                       cpuc->n_events--;
+                       break;
+               }
+       }
 
-       perf_event_update_userpage(event);
+       perf_enable();
+       local_irq_restore(flags);
+}
+
+static int active_event_index(struct cpu_hw_events *cpuc,
+                             struct perf_event *event)
+{
+       int i;
+
+       for (i = 0; i < cpuc->n_events; i++) {
+               if (cpuc->event[i] == event)
+                       break;
+       }
+       BUG_ON(i == cpuc->n_events);
+       return cpuc->current_idx[i];
 }
 
 static void sparc_pmu_read(struct perf_event *event)
 {
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       int idx = active_event_index(cpuc, event);
        struct hw_perf_event *hwc = &event->hw;
 
-       sparc_perf_event_update(event, hwc, hwc->idx);
+       sparc_perf_event_update(event, hwc, idx);
 }
 
 static void sparc_pmu_unthrottle(struct perf_event *event)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       int idx = active_event_index(cpuc, event);
        struct hw_perf_event *hwc = &event->hw;
 
-       sparc_pmu_enable_event(cpuc, hwc, hwc->idx);
+       sparc_pmu_enable_event(cpuc, hwc, idx);
 }
 
 static atomic_t active_events = ATOMIC_INIT(0);
@@ -750,43 +854,75 @@ static void hw_perf_event_destroy(struct perf_event *event)
 /* Make sure all events can be scheduled into the hardware at
  * the same time.  This is simplified by the fact that we only
  * need to support 2 simultaneous HW events.
+ *
+ * As a side effect, the evts[]->hw.idx values will be assigned
+ * on success.  These are pending indexes.  When the events are
+ * actually programmed into the chip, these values will propagate
+ * to the per-cpu cpuc->current_idx[] slots, see the code in
+ * maybe_change_configuration() for details.
  */
-static int sparc_check_constraints(unsigned long *events, int n_ev)
+static int sparc_check_constraints(struct perf_event **evts,
+                                  unsigned long *events, int n_ev)
 {
-       if (n_ev <= perf_max_events) {
-               u8 msk1, msk2;
-               u16 dummy;
-
-               if (n_ev == 1)
-                       return 0;
-               BUG_ON(n_ev != 2);
-               perf_event_decode(events[0], &dummy, &msk1);
-               perf_event_decode(events[1], &dummy, &msk2);
-
-               /* If both events can go on any counter, OK.  */
-               if (msk1 == (PIC_UPPER | PIC_LOWER) &&
-                   msk2 == (PIC_UPPER | PIC_LOWER))
-                       return 0;
-
-               /* If one event is limited to a specific counter,
-                * and the other can go on both, OK.
-                */
-               if ((msk1 == PIC_UPPER || msk1 == PIC_LOWER) &&
-                   msk2 == (PIC_UPPER | PIC_LOWER))
-                       return 0;
-               if ((msk2 == PIC_UPPER || msk2 == PIC_LOWER) &&
-                   msk1 == (PIC_UPPER | PIC_LOWER))
-                       return 0;
-
-               /* If the events are fixed to different counters, OK.  */
-               if ((msk1 == PIC_UPPER && msk2 == PIC_LOWER) ||
-                   (msk1 == PIC_LOWER && msk2 == PIC_UPPER))
-                       return 0;
-
-               /* Otherwise, there is a conflict.  */
+       u8 msk0 = 0, msk1 = 0;
+       int idx0 = 0;
+
+       /* This case is possible when we are invoked from
+        * hw_perf_group_sched_in().
+        */
+       if (!n_ev)
+               return 0;
+
+       if (n_ev > perf_max_events)
+               return -1;
+
+       msk0 = perf_event_get_msk(events[0]);
+       if (n_ev == 1) {
+               if (msk0 & PIC_LOWER)
+                       idx0 = 1;
+               goto success;
        }
+       BUG_ON(n_ev != 2);
+       msk1 = perf_event_get_msk(events[1]);
+
+       /* If both events can go on any counter, OK.  */
+       if (msk0 == (PIC_UPPER | PIC_LOWER) &&
+           msk1 == (PIC_UPPER | PIC_LOWER))
+               goto success;
 
+       /* If one event is limited to a specific counter,
+        * and the other can go on both, OK.
+        */
+       if ((msk0 == PIC_UPPER || msk0 == PIC_LOWER) &&
+           msk1 == (PIC_UPPER | PIC_LOWER)) {
+               if (msk0 & PIC_LOWER)
+                       idx0 = 1;
+               goto success;
+       }
+
+       if ((msk1 == PIC_UPPER || msk1 == PIC_LOWER) &&
+           msk0 == (PIC_UPPER | PIC_LOWER)) {
+               if (msk1 & PIC_UPPER)
+                       idx0 = 1;
+               goto success;
+       }
+
+       /* If the events are fixed to different counters, OK.  */
+       if ((msk0 == PIC_UPPER && msk1 == PIC_LOWER) ||
+           (msk0 == PIC_LOWER && msk1 == PIC_UPPER)) {
+               if (msk0 & PIC_LOWER)
+                       idx0 = 1;
+               goto success;
+       }
+
+       /* Otherwise, there is a conflict.  */
        return -1;
+
+success:
+       evts[0]->hw.idx = idx0;
+       if (n_ev == 2)
+               evts[1]->hw.idx = idx0 ^ 1;
+       return 0;
 }
 
 static int check_excludes(struct perf_event **evts, int n_prev, int n_new)
@@ -818,7 +954,8 @@ static int check_excludes(struct perf_event **evts, int n_prev, int n_new)
 }
 
 static int collect_events(struct perf_event *group, int max_count,
-                         struct perf_event *evts[], unsigned long *events)
+                         struct perf_event *evts[], unsigned long *events,
+                         int *current_idx)
 {
        struct perf_event *event;
        int n = 0;
@@ -827,7 +964,8 @@ static int collect_events(struct perf_event *group, int max_count,
                if (n >= max_count)
                        return -1;
                evts[n] = group;
-               events[n++] = group->hw.event_base;
+               events[n] = group->hw.event_base;
+               current_idx[n++] = PIC_NO_INDEX;
        }
        list_for_each_entry(event, &group->sibling_list, group_entry) {
                if (!is_software_event(event) &&
@@ -835,20 +973,100 @@ static int collect_events(struct perf_event *group, int max_count,
                        if (n >= max_count)
                                return -1;
                        evts[n] = event;
-                       events[n++] = event->hw.event_base;
+                       events[n] = event->hw.event_base;
+                       current_idx[n++] = PIC_NO_INDEX;
                }
        }
        return n;
 }
 
+static void event_sched_in(struct perf_event *event)
+{
+       event->state = PERF_EVENT_STATE_ACTIVE;
+       event->oncpu = smp_processor_id();
+       event->tstamp_running += event->ctx->time - event->tstamp_stopped;
+       if (is_software_event(event))
+               event->pmu->enable(event);
+}
+
+int hw_perf_group_sched_in(struct perf_event *group_leader,
+                          struct perf_cpu_context *cpuctx,
+                          struct perf_event_context *ctx)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       struct perf_event *sub;
+       int n0, n;
+
+       if (!sparc_pmu)
+               return 0;
+
+       n0 = cpuc->n_events;
+       n = collect_events(group_leader, perf_max_events - n0,
+                          &cpuc->event[n0], &cpuc->events[n0],
+                          &cpuc->current_idx[n0]);
+       if (n < 0)
+               return -EAGAIN;
+       if (check_excludes(cpuc->event, n0, n))
+               return -EINVAL;
+       if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0))
+               return -EAGAIN;
+       cpuc->n_events = n0 + n;
+       cpuc->n_added += n;
+
+       cpuctx->active_oncpu += n;
+       n = 1;
+       event_sched_in(group_leader);
+       list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
+               if (sub->state != PERF_EVENT_STATE_OFF) {
+                       event_sched_in(sub);
+                       n++;
+               }
+       }
+       ctx->nr_active += n;
+
+       return 1;
+}
+
+static int sparc_pmu_enable(struct perf_event *event)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       int n0, ret = -EAGAIN;
+       unsigned long flags;
+
+       local_irq_save(flags);
+       perf_disable();
+
+       n0 = cpuc->n_events;
+       if (n0 >= perf_max_events)
+               goto out;
+
+       cpuc->event[n0] = event;
+       cpuc->events[n0] = event->hw.event_base;
+       cpuc->current_idx[n0] = PIC_NO_INDEX;
+
+       if (check_excludes(cpuc->event, n0, 1))
+               goto out;
+       if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1))
+               goto out;
+
+       cpuc->n_events++;
+       cpuc->n_added++;
+
+       ret = 0;
+out:
+       perf_enable();
+       local_irq_restore(flags);
+       return ret;
+}
+
 static int __hw_perf_event_init(struct perf_event *event)
 {
        struct perf_event_attr *attr = &event->attr;
        struct perf_event *evts[MAX_HWEVENTS];
        struct hw_perf_event *hwc = &event->hw;
        unsigned long events[MAX_HWEVENTS];
+       int current_idx_dmy[MAX_HWEVENTS];
        const struct perf_event_map *pmap;
-       u64 enc;
        int n;
 
        if (atomic_read(&nmi_active) < 0)
@@ -865,10 +1083,7 @@ static int __hw_perf_event_init(struct perf_event *event)
        } else
                return -EOPNOTSUPP;
 
-       /* We save the enable bits in the config_base.  So to
-        * turn off sampling just write 'config', and to enable
-        * things write 'config | config_base'.
-        */
+       /* We save the enable bits in the config_base.  */
        hwc->config_base = sparc_pmu->irq_bit;
        if (!attr->exclude_user)
                hwc->config_base |= PCR_UTRACE;
@@ -879,13 +1094,11 @@ static int __hw_perf_event_init(struct perf_event *event)
 
        hwc->event_base = perf_event_encode(pmap);
 
-       enc = pmap->encoding;
-
        n = 0;
        if (event->group_leader != event) {
                n = collect_events(event->group_leader,
                                   perf_max_events - 1,
-                                  evts, events);
+                                  evts, events, current_idx_dmy);
                if (n < 0)
                        return -EINVAL;
        }
@@ -895,9 +1108,11 @@ static int __hw_perf_event_init(struct perf_event *event)
        if (check_excludes(evts, n, 1))
                return -EINVAL;
 
-       if (sparc_check_constraints(events, n + 1))
+       if (sparc_check_constraints(evts, events, n + 1))
                return -EINVAL;
 
+       hwc->idx = PIC_NO_INDEX;
+
        /* Try to do all error checking before this point, as unwinding
         * state after grabbing the PMC is difficult.
         */
@@ -910,15 +1125,6 @@ static int __hw_perf_event_init(struct perf_event *event)
                atomic64_set(&hwc->period_left, hwc->sample_period);
        }
 
-       if (pmap->pic_mask & PIC_UPPER) {
-               hwc->idx = PIC_UPPER_INDEX;
-               enc <<= sparc_pmu->upper_shift;
-       } else {
-               hwc->idx = PIC_LOWER_INDEX;
-               enc <<= sparc_pmu->lower_shift;
-       }
-
-       hwc->config |= enc;
        return 0;
 }
 
@@ -968,7 +1174,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
        struct perf_sample_data data;
        struct cpu_hw_events *cpuc;
        struct pt_regs *regs;
-       int idx;
+       int i;
 
        if (!atomic_read(&active_events))
                return NOTIFY_DONE;
@@ -997,13 +1203,12 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
        if (sparc_pmu->irq_bit)
                pcr_ops->write(cpuc->pcr);
 
-       for (idx = 0; idx < MAX_HWEVENTS; idx++) {
-               struct perf_event *event = cpuc->events[idx];
+       for (i = 0; i < cpuc->n_events; i++) {
+               struct perf_event *event = cpuc->event[i];
+               int idx = cpuc->current_idx[i];
                struct hw_perf_event *hwc;
                u64 val;
 
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
                hwc = &event->hw;
                val = sparc_perf_event_update(event, hwc, idx);
                if (val & (1ULL << 31))
@@ -1055,10 +1260,122 @@ void __init init_hw_perf_events(void)
 
        pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type);
 
-       /* All sparc64 PMUs currently have 2 events.  But this simple
-        * driver only supports one active event at a time.
-        */
-       perf_max_events = 1;
+       /* All sparc64 PMUs currently have 2 events.  */
+       perf_max_events = 2;
 
        register_die_notifier(&perf_event_nmi_notifier);
 }
+
+static inline void callchain_store(struct perf_callchain_entry *entry, u64 ip)
+{
+       if (entry->nr < PERF_MAX_STACK_DEPTH)
+               entry->ip[entry->nr++] = ip;
+}
+
+static void perf_callchain_kernel(struct pt_regs *regs,
+                                 struct perf_callchain_entry *entry)
+{
+       unsigned long ksp, fp;
+
+       callchain_store(entry, PERF_CONTEXT_KERNEL);
+       callchain_store(entry, regs->tpc);
+
+       ksp = regs->u_regs[UREG_I6];
+       fp = ksp + STACK_BIAS;
+       do {
+               struct sparc_stackf *sf;
+               struct pt_regs *regs;
+               unsigned long pc;
+
+               if (!kstack_valid(current_thread_info(), fp))
+                       break;
+
+               sf = (struct sparc_stackf *) fp;
+               regs = (struct pt_regs *) (sf + 1);
+
+               if (kstack_is_trap_frame(current_thread_info(), regs)) {
+                       if (user_mode(regs))
+                               break;
+                       pc = regs->tpc;
+                       fp = regs->u_regs[UREG_I6] + STACK_BIAS;
+               } else {
+                       pc = sf->callers_pc;
+                       fp = (unsigned long)sf->fp + STACK_BIAS;
+               }
+               callchain_store(entry, pc);
+       } while (entry->nr < PERF_MAX_STACK_DEPTH);
+}
+
+static void perf_callchain_user_64(struct pt_regs *regs,
+                                  struct perf_callchain_entry *entry)
+{
+       unsigned long ufp;
+
+       callchain_store(entry, PERF_CONTEXT_USER);
+       callchain_store(entry, regs->tpc);
+
+       ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
+       do {
+               struct sparc_stackf *usf, sf;
+               unsigned long pc;
+
+               usf = (struct sparc_stackf *) ufp;
+               if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
+                       break;
+
+               pc = sf.callers_pc;
+               ufp = (unsigned long)sf.fp + STACK_BIAS;
+               callchain_store(entry, pc);
+       } while (entry->nr < PERF_MAX_STACK_DEPTH);
+}
+
+static void perf_callchain_user_32(struct pt_regs *regs,
+                                  struct perf_callchain_entry *entry)
+{
+       unsigned long ufp;
+
+       callchain_store(entry, PERF_CONTEXT_USER);
+       callchain_store(entry, regs->tpc);
+
+       ufp = regs->u_regs[UREG_I6];
+       do {
+               struct sparc_stackf32 *usf, sf;
+               unsigned long pc;
+
+               usf = (struct sparc_stackf32 *) ufp;
+               if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
+                       break;
+
+               pc = sf.callers_pc;
+               ufp = (unsigned long)sf.fp;
+               callchain_store(entry, pc);
+       } while (entry->nr < PERF_MAX_STACK_DEPTH);
+}
+
+/* Like powerpc we can't get PMU interrupts within the PMU handler,
+ * so no need for seperate NMI and IRQ chains as on x86.
+ */
+static DEFINE_PER_CPU(struct perf_callchain_entry, callchain);
+
+struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
+{
+       struct perf_callchain_entry *entry = &__get_cpu_var(callchain);
+
+       entry->nr = 0;
+       if (!user_mode(regs)) {
+               stack_trace_flush();
+               perf_callchain_kernel(regs, entry);
+               if (current->mm)
+                       regs = task_pt_regs(current);
+               else
+                       regs = NULL;
+       }
+       if (regs) {
+               flushw_user();
+               if (test_thread_flag(TIF_32BIT))
+                       perf_callchain_user_32(regs, entry);
+               else
+                       perf_callchain_user_64(regs, entry);
+       }
+       return entry;
+}
index 2830b415e2147ecfda36acc99d620408472128bd..c49865b30719d2e8113313591834f34d4d5fa063 100644 (file)
@@ -526,7 +526,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
                         * Set some valid stack frames to give to the child.
                         */
                        childstack = (struct sparc_stackf __user *)
-                               (sp & ~0x7UL);
+                               (sp & ~0xfUL);
                        parentstack = (struct sparc_stackf __user *)
                                regs->u_regs[UREG_FP];
 
index 18d67854a1b8e9c9768a6eb11104ea3df0bfe797..cb70476bd8f5ccd72a6f72900195f8a74f6abfcb 100644 (file)
@@ -365,14 +365,6 @@ void flush_thread(void)
        struct thread_info *t = current_thread_info();
        struct mm_struct *mm;
 
-       if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
-               clear_ti_thread_flag(t, TIF_ABI_PENDING);
-               if (test_ti_thread_flag(t, TIF_32BIT))
-                       clear_ti_thread_flag(t, TIF_32BIT);
-               else
-                       set_ti_thread_flag(t, TIF_32BIT);
-       }
-
        mm = t->task->mm;
        if (mm)
                tsb_context_switch(mm);
@@ -406,11 +398,11 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
        } else
                __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
 
-       /* Now 8-byte align the stack as this is mandatory in the
-        * Sparc ABI due to how register windows work.  This hides
-        * the restriction from thread libraries etc.  -DaveM
+       /* Now align the stack as this is mandatory in the Sparc ABI
+        * due to how register windows work.  This hides the
+        * restriction from thread libraries etc.
         */
-       csp &= ~7UL;
+       csp &= ~15UL;
 
        distance = fp - psp;
        rval = (csp - distance);
index 453397fe5e14035fbc980689d844e5673312d4a3..a8591ef2636d4e55a64738e836c4a084a840d71c 100644 (file)
@@ -4,9 +4,6 @@
 #include <linux/spinlock.h>
 #include <asm/prom.h>
 
-extern struct device_node *allnodes;   /* temporary while merging */
-extern rwlock_t devtree_lock;  /* temporary while merging */
-
 extern void * prom_early_alloc(unsigned long size);
 extern void irq_trans_init(struct device_node *dp);
 
index d80a65d9e893df99c26cb8d0b7c5d7f77528163a..57ac9e28be0caff3b08be55f0228fa8655863739 100644 (file)
@@ -37,18 +37,6 @@ EXPORT_SYMBOL(of_console_path);
 char *of_console_options;
 EXPORT_SYMBOL(of_console_options);
 
-struct device_node *of_find_node_by_phandle(phandle handle)
-{
-       struct device_node *np;
-
-       for (np = allnodes; np; np = np->allnext)
-               if (np->node == handle)
-                       break;
-
-       return np;
-}
-EXPORT_SYMBOL(of_find_node_by_phandle);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
        struct property *prop;
@@ -89,7 +77,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
                        void *old_val = prop->value;
                        int ret;
 
-                       ret = prom_setprop(dp->node, name, val, len);
+                       ret = prom_setprop(dp->phandle, name, val, len);
 
                        err = -EINVAL;
                        if (ret >= 0) {
@@ -236,7 +224,7 @@ static struct device_node * __init prom_create_node(phandle node,
 
        dp->name = get_one_property(node, "name");
        dp->type = get_one_property(node, "device_type");
-       dp->node = node;
+       dp->phandle = node;
 
        dp->properties = build_prop_list(node);
 
@@ -313,7 +301,7 @@ void __init prom_build_devicetree(void)
 
        nextp = &allnodes->allnext;
        allnodes->child = prom_build_tree(allnodes,
-                                         prom_getchild(allnodes->node),
+                                         prom_getchild(allnodes->phandle),
                                          &nextp);
        of_console_init();
 
index ba5b09ad6666397a953af76945205961868edb29..ea22cd373c64f4bc371478d2b7be14f71cd32560 100644 (file)
@@ -120,8 +120,8 @@ struct rt_signal_frame32 {
 };
 
 /* Align macros */
-#define SF_ALIGNEDSZ  (((sizeof(struct signal_frame32) + 7) & (~7)))
-#define RT_ALIGNEDSZ  (((sizeof(struct rt_signal_frame32) + 7) & (~7)))
+#define SF_ALIGNEDSZ  (((sizeof(struct signal_frame32) + 15) & (~15)))
+#define RT_ALIGNEDSZ  (((sizeof(struct rt_signal_frame32) + 15) & (~15)))
 
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
@@ -420,15 +420,17 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
                        sp = current->sas_ss_sp + current->sas_ss_size;
        }
 
+       sp -= framesize;
+
        /* Always align the stack frame.  This handles two cases.  First,
         * sigaltstack need not be mindful of platform specific stack
         * alignment.  Second, if we took this signal because the stack
         * is not aligned properly, we'd like to take the signal cleanly
         * and report that.
         */
-       sp &= ~7UL;
+       sp &= ~15UL;
 
-       return (void __user *)(sp - framesize);
+       return (void __user *) sp;
 }
 
 static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
index 7ce1a1005b1da4c3b13f8b87927d060376279f2a..9882df92ba0a2c8b8da4639f7e181214930c8ed6 100644 (file)
@@ -267,15 +267,17 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
                        sp = current->sas_ss_sp + current->sas_ss_size;
        }
 
+       sp -= framesize;
+
        /* Always align the stack frame.  This handles two cases.  First,
         * sigaltstack need not be mindful of platform specific stack
         * alignment.  Second, if we took this signal because the stack
         * is not aligned properly, we'd like to take the signal cleanly
         * and report that.
         */
-       sp &= ~7UL;
+       sp &= ~15UL;
 
-       return (void __user *)(sp - framesize);
+       return (void __user *) sp;
 }
 
 static inline int
index 647afbda7ae1f170896675dcc4603dfe5c58ec0b..9fa48c30037e5356c2f686be695ea8bcfb3613f3 100644 (file)
@@ -353,7 +353,7 @@ segv:
 /* Checks if the fp is valid */
 static int invalid_frame_pointer(void __user *fp, int fplen)
 {
-       if (((unsigned long) fp) & 7)
+       if (((unsigned long) fp) & 15)
                return 1;
        return 0;
 }
@@ -396,15 +396,17 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *
                        sp = current->sas_ss_sp + current->sas_ss_size;
        }
 
+       sp -= framesize;
+
        /* Always align the stack frame.  This handles two cases.  First,
         * sigaltstack need not be mindful of platform specific stack
         * alignment.  Second, if we took this signal because the stack
         * is not aligned properly, we'd like to take the signal cleanly
         * and report that.
         */
-       sp &= ~7UL;
+       sp &= ~15UL;
 
-       return (void __user *)(sp - framesize);
+       return (void __user *) sp;
 }
 
 static inline void
index aa36223497b931c9dc96c1ef2d536672aa36248d..eb14844a0021bbccb76d6981c3f9cabb9ac75c35 100644 (file)
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
        } else {
                struct device_node *dp = of_find_node_by_cpuid(cpu);
 
-               prom_startcpu(dp->node, entry, cookie);
+               prom_startcpu(dp->phandle, entry, cookie);
        }
 
        for (timeout = 0; timeout < 50000; timeout++) {
index cfa0e19abe3bd62b2e0f64f2b5b5d15499b0b9c9..d77f54316948e83cdc035c9e04d76cbd8d4702a1 100644 (file)
@@ -365,6 +365,7 @@ EXPORT_SYMBOL(get_fb_unmapped_area);
 void arch_pick_mmap_layout(struct mm_struct *mm)
 {
        unsigned long random_factor = 0UL;
+       unsigned long gap;
 
        if (current->flags & PF_RANDOMIZE) {
                random_factor = get_random_int();
@@ -379,9 +380,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
         * Fall back to the standard layout if the personality
         * bit is set, or if the expected stack growth is unlimited:
         */
+       gap = rlimit(RLIMIT_STACK);
        if (!test_thread_flag(TIF_32BIT) ||
            (current->personality & ADDR_COMPAT_LAYOUT) ||
-           current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY ||
+           gap == RLIM_INFINITY ||
            sysctl_legacy_va_layout) {
                mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
                mm->get_unmapped_area = arch_get_unmapped_area;
@@ -389,9 +391,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
        } else {
                /* We know it's 32-bit */
                unsigned long task_size = STACK_TOP32;
-               unsigned long gap;
 
-               gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
                if (gap < 128 * 1024 * 1024)
                        gap = 128 * 1024 * 1024;
                if (gap > (task_size / 6 * 5))
index 5b2f595fe65b58aad400fafc876bca36bef4ce07..0d4c09b15efc9da4edf6b9354d003384b1f405d9 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/oplib.h>
+#include <asm/timex.h>
 #include <asm/timer.h>
 #include <asm/system.h>
 #include <asm/irq.h>
@@ -51,7 +52,6 @@ DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL(rtc_lock);
 
 static int set_rtc_mmss(unsigned long);
-static int sbus_do_settimeofday(struct timespec *tv);
 
 unsigned long profile_pc(struct pt_regs *regs)
 {
@@ -76,6 +76,8 @@ EXPORT_SYMBOL(profile_pc);
 
 __volatile__ unsigned int *master_l10_counter;
 
+u32 (*do_arch_gettimeoffset)(void);
+
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
@@ -196,35 +198,14 @@ static int __init clock_init(void)
 {
        return of_register_driver(&clock_driver, &of_platform_bus_type);
 }
-
 /* Must be after subsys_initcall() so that busses are probed.  Must
  * be before device_initcall() because things like the RTC driver
  * need to see the clock registers.
  */
 fs_initcall(clock_init);
 
-static void __init sbus_time_init(void)
-{
-
-       BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
-       btfixup();
-
-       sparc_init_timers(timer_interrupt);
-}
-
-void __init time_init(void)
-{
-#ifdef CONFIG_PCI
-       extern void pci_time_init(void);
-       if (pcic_present()) {
-               pci_time_init();
-               return;
-       }
-#endif
-       sbus_time_init();
-}
 
-static inline unsigned long do_gettimeoffset(void)
+u32 sbus_do_gettimeoffset(void)
 {
        unsigned long val = *master_l10_counter;
        unsigned long usec = (val >> 10) & 0x1fffff;
@@ -233,86 +214,39 @@ static inline unsigned long do_gettimeoffset(void)
        if (val & 0x80000000)
                usec += 1000000 / HZ;
 
-       return usec;
+       return usec * 1000;
 }
 
-/* Ok, my cute asm atomicity trick doesn't work anymore.
- * There are just too many variables that need to be protected
- * now (both members of xtime, et al.)
- */
-void do_gettimeofday(struct timeval *tv)
-{
-       unsigned long flags;
-       unsigned long seq;
-       unsigned long usec, sec;
-       unsigned long max_ntp_tick = tick_usec - tickadj;
-
-       do {
-               seq = read_seqbegin_irqsave(&xtime_lock, flags);
-               usec = do_gettimeoffset();
-
-               /*
-                * If time_adjust is negative then NTP is slowing the clock
-                * so make sure not to go into next possible interval.
-                * Better to lose some accuracy than have time go backwards..
-                */
-               if (unlikely(time_adjust < 0))
-                       usec = min(usec, max_ntp_tick);
-
-               sec = xtime.tv_sec;
-               usec += (xtime.tv_nsec / 1000);
-       } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
-       while (usec >= 1000000) {
-               usec -= 1000000;
-               sec++;
-       }
 
-       tv->tv_sec = sec;
-       tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
+u32 arch_gettimeoffset(void)
 {
-       int ret;
-
-       write_seqlock_irq(&xtime_lock);
-       ret = bus_do_settimeofday(tv);
-       write_sequnlock_irq(&xtime_lock);
-       clock_was_set();
-       return ret;
+       if (unlikely(!do_arch_gettimeoffset))
+               return 0;
+       return do_arch_gettimeoffset();
 }
 
-EXPORT_SYMBOL(do_settimeofday);
-
-static int sbus_do_settimeofday(struct timespec *tv)
+static void __init sbus_time_init(void)
 {
-       time_t wtm_sec, sec = tv->tv_sec;
-       long wtm_nsec, nsec = tv->tv_nsec;
+       do_arch_gettimeoffset = sbus_do_gettimeoffset;
 
-       if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
-               return -EINVAL;
-
-       /*
-        * This is revolting. We need to set "xtime" correctly. However, the
-        * value in this location is the value at the most recent update of
-        * wall time.  Discover what correction gettimeofday() would have
-        * made, and then undo it!
-        */
-       nsec -= 1000 * do_gettimeoffset();
-
-       wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
-       wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
+       btfixup();
 
-       set_normalized_timespec(&xtime, sec, nsec);
-       set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
+       sparc_init_timers(timer_interrupt);
+}
 
-       ntp_clear();
-       return 0;
+void __init time_init(void)
+{
+#ifdef CONFIG_PCI
+       extern void pci_time_init(void);
+       if (pcic_present()) {
+               pci_time_init();
+               return;
+       }
+#endif
+       sbus_time_init();
 }
 
+
 static int set_rtc_mmss(unsigned long secs)
 {
        struct rtc_device *rtc = rtc_class_open("rtc0");
index 8c91d9b29a2f24023849498a41f440b5ec1e6938..db15d123f05447f9eac74c5fd168c14084eb25a3 100644 (file)
@@ -191,10 +191,12 @@ tsb_dtlb_load:
 
 tsb_itlb_load:
        /* Executable bit must be set.  */
-661:   andcc           %g5, _PAGE_EXEC_4U, %g0
-       .section        .sun4v_1insn_patch, "ax"
+661:   sethi           %hi(_PAGE_EXEC_4U), %g4
+       andcc           %g5, %g4, %g0
+       .section        .sun4v_2insn_patch, "ax"
        .word           661b
        andcc           %g5, _PAGE_EXEC_4V, %g0
+       nop
        .previous
 
        be,pn           %xcc, tsb_do_fault
index b99f81c4906f72ae3486c54d3cc1e69d15822383..a3413acb8f127ce4bbd92d6305a83a9e428819fe 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/signal.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/perf_event.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/kdebug.h>
@@ -203,6 +204,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
         if (in_atomic() || !mm)
                 goto no_context;
 
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
+
        down_read(&mm->mmap_sem);
 
        /*
@@ -249,10 +252,15 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (fault & VM_FAULT_MAJOR)
+       if (fault & VM_FAULT_MAJOR) {
                current->maj_flt++;
-       else
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
+                             regs, address);
+       } else {
                current->min_flt++;
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
+                             regs, address);
+       }
        up_read(&mm->mmap_sem);
        return;
 
index 6081936bf03b84579ce488b7488b8bc7c6e395ac..b9d4ff02b8fc2229a9f0028e38fb621f5376b7b6 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/perf_event.h>
 #include <linux/interrupt.h>
 #include <linux/kprobes.h>
 #include <linux/kdebug.h>
@@ -296,6 +297,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
        if (in_atomic() || !mm)
                goto intr_or_no_mm;
 
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
+
        if (!down_read_trylock(&mm->mmap_sem)) {
                if ((regs->tstate & TSTATE_PRIV) &&
                    !search_exception_tables(regs->tpc)) {
@@ -400,11 +403,15 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (fault & VM_FAULT_MAJOR)
+       if (fault & VM_FAULT_MAJOR) {
                current->maj_flt++;
-       else
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
+                             regs, address);
+       } else {
                current->min_flt++;
-
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
+                             regs, address);
+       }
        up_read(&mm->mmap_sem);
 
        mm_rss = get_mm_rss(mm);
index 51069245b79a207274547c51ce904206f5ffb939..3b3c36601a7b39e3634458eb11c5b0245261cb3e 100644 (file)
@@ -125,50 +125,36 @@ void mconsole_log(struct mc_request *req)
 void mconsole_proc(struct mc_request *req)
 {
        struct nameidata nd;
-       struct file_system_type *proc;
-       struct super_block *super;
+       struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt;
        struct file *file;
        int n, err;
        char *ptr = req->request.data, *buf;
+       mm_segment_t old_fs = get_fs();
 
        ptr += strlen("proc");
        ptr = skip_spaces(ptr);
 
-       proc = get_fs_type("proc");
-       if (proc == NULL) {
-               mconsole_reply(req, "procfs not registered", 1, 0);
+       err = vfs_path_lookup(mnt->mnt_root, mnt, ptr, LOOKUP_FOLLOW, &nd);
+       if (err) {
+               mconsole_reply(req, "Failed to look up file", 1, 0);
                goto out;
        }
 
-       super = (*proc->get_sb)(proc, 0, NULL, NULL);
-       put_filesystem(proc);
-       if (super == NULL) {
-               mconsole_reply(req, "Failed to get procfs superblock", 1, 0);
+       err = may_open(&nd.path, MAY_READ, FMODE_READ);
+       if (result) {
+               mconsole_reply(req, "Failed to open file", 1, 0);
+               path_put(&nd.path);
                goto out;
        }
-       up_write(&super->s_umount);
-
-       nd.path.dentry = super->s_root;
-       nd.path.mnt = NULL;
-       nd.flags = O_RDONLY + 1;
-       nd.last_type = LAST_ROOT;
-
-       /* START: it was experienced that the stability problems are closed
-        * if commenting out these two calls + the below read cycle. To
-        * make UML crash again, it was enough to readd either one.*/
-       err = link_path_walk(ptr, &nd);
-       if (err) {
-               mconsole_reply(req, "Failed to look up file", 1, 0);
-               goto out_kill;
-       }
 
        file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY,
                           current_cred());
+       err = PTR_ERR(file);
        if (IS_ERR(file)) {
                mconsole_reply(req, "Failed to open file", 1, 0);
-               goto out_kill;
+               path_put(&nd.path);
+               goto out;
        }
-       /*END*/
 
        buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (buf == NULL) {
@@ -176,10 +162,13 @@ void mconsole_proc(struct mc_request *req)
                goto out_fput;
        }
 
-       if ((file->f_op != NULL) && (file->f_op->read != NULL)) {
+       if (file->f_op->read) {
                do {
-                       n = (*file->f_op->read)(file, buf, PAGE_SIZE - 1,
-                                               &file->f_pos);
+                       loff_t pos;
+                       set_fs(KERNEL_DS);
+                       n = vfs_read(file, buf, PAGE_SIZE - 1, &pos);
+                       file_pos_write(file, pos);
+                       set_fs(old_fs);
                        if (n >= 0) {
                                buf[n] = '\0';
                                mconsole_reply(req, buf, 0, (n > 0));
@@ -197,8 +186,6 @@ void mconsole_proc(struct mc_request *req)
        kfree(buf);
  out_fput:
        fput(file);
- out_kill:
-       deactivate_super(super);
  out: ;
 }
 #endif
index 2201e9c20e4a85ec4673939f27e15a3ef3431f94..c1ea9eb04466b00a35c8a895d09887546e78abfc 100644 (file)
@@ -8,7 +8,8 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \
        setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \
        sysrq.o ksyms.o tls.o
 
-subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
+subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o \
+               lib/rwsem_64.o
 subarch-obj-$(CONFIG_MODULES) += kernel/module.o
 
 ldt-y = ../sys-i386/ldt.o
index cbcbfdee3ee08695b8dbdbf873755dac7762d324..0896008f75091bae6edf5ca92ad127be06bc9bf9 100644 (file)
@@ -45,6 +45,7 @@ config X86
        select HAVE_GENERIC_DMA_COHERENT if X86_32
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
        select USER_STACKTRACE_SUPPORT
+       select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_DMA_API_DEBUG
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_BZIP2
@@ -989,12 +990,6 @@ config X86_CPUID
          with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
          /dev/cpu/31/cpuid.
 
-config X86_CPU_DEBUG
-       tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support"
-       ---help---
-         If you select this option, this will provide various x86 CPUs
-         information through debugfs.
-
 choice
        prompt "High Memory Support"
        default HIGHMEM4G if !X86_NUMAQ
index f20ddf84a89397c322d4f35657400d5590891832..a19829374e6a006b80a5db969a19c4f7dbae3449 100644 (file)
@@ -319,7 +319,7 @@ config X86_L1_CACHE_SHIFT
 
 config X86_XADD
        def_bool y
-       depends on X86_32 && !M386
+       depends on X86_64 || !M386
 
 config X86_PPRO_FENCE
        bool "PentiumPro memory ordering errata workaround"
index 78b32be55e9e7a82dafcdf96a5b59be4a26decd8..0a43dc515e4c10dcd38f2d5adbd7e42b614069f4 100644 (file)
@@ -135,9 +135,7 @@ drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/
 # suspend and hibernation support
 drivers-$(CONFIG_PM) += arch/x86/power/
 
-ifeq ($(CONFIG_X86_32),y)
 drivers-$(CONFIG_FB) += arch/x86/video/
-endif
 
 ####
 # boot loader support. Several targets are kept for legacy purposes
index 3b22fe8ab91bc90d2e25f2d33e53d315860e3c30..51e240779a44c5b912957c31c7e877b29d058d9c 100644 (file)
 #define _ASM_X86_DESC_H 1
 #endif
 
-#ifdef CONFIG_X86_64
-#define _LINUX_STRING_H_ 1
-#define __LINUX_BITMAP_H 1
-#endif
-
 #include <linux/linkage.h>
 #include <linux/screen_info.h>
 #include <linux/elf.h>
@@ -131,8 +126,8 @@ static void error(char *m);
 static struct boot_params *real_mode;          /* Pointer to real-mode data */
 static int quiet;
 
-static void *memset(void *s, int c, unsigned n);
-void *memcpy(void *dest, const void *src, unsigned n);
+void *memset(void *s, int c, size_t n);
+void *memcpy(void *dest, const void *src, size_t n);
 
 static void __putstr(int, const char *);
 #define putstr(__x)  __putstr(0, __x)
@@ -185,11 +180,9 @@ static void __putstr(int error, const char *s)
                return;
 #endif
 
-#ifdef CONFIG_X86_32
        if (real_mode->screen_info.orig_video_mode == 0 &&
            lines == 0 && cols == 0)
                return;
-#endif
 
        x = real_mode->screen_info.orig_x;
        y = real_mode->screen_info.orig_y;
@@ -223,7 +216,7 @@ static void __putstr(int error, const char *s)
        outb(0xff & (pos >> 1), vidport+1);
 }
 
-static void *memset(void *s, int c, unsigned n)
+void *memset(void *s, int c, size_t n)
 {
        int i;
        char *ss = s;
@@ -233,7 +226,7 @@ static void *memset(void *s, int c, unsigned n)
        return s;
 }
 
-void *memcpy(void *dest, const void *src, unsigned n)
+void *memcpy(void *dest, const void *src, size_t n)
 {
        int i;
        const char *s = src;
index 8ef60f20b371017efc47f60fc371d090d0e76014..919257f526f233ee1dee836bdd26c25c77076c3f 100644 (file)
@@ -22,7 +22,7 @@ int main(void)
        int i, j;
        const char *str;
 
-       printf("static const char x86_cap_strs[] = \n");
+       printf("static const char x86_cap_strs[] =\n");
 
        for (i = 0; i < NCAPINTS; i++) {
                for (j = 0; j < 32; j++) {
index 819caa1f200879887c3726de406cbf664a771960..ed7aeff786b277d01b281a47c418eb5c988ea249 100644 (file)
@@ -42,22 +42,15 @@ static u8 vga_set_basic_mode(void)
 {
        struct biosregs ireg, oreg;
        u16 ax;
-       u8 rows;
        u8 mode;
 
        initregs(&ireg);
 
+       /* Query current mode */
        ax = 0x0f00;
        intcall(0x10, &ireg, &oreg);
        mode = oreg.al;
 
-       set_fs(0);
-       rows = rdfs8(0x484);    /* rows minus one */
-
-       if ((oreg.ax == 0x5003 || oreg.ax == 0x5007) &&
-           (rows == 0 || rows == 24))
-               return mode;
-
        if (mode != 3 && mode != 7)
                mode = 3;
 
index f767164cd5df91e1aaf2088fca44a3a26213f69c..43eda284d27fe96c2a4d407273f4b8d61bae87e2 100644 (file)
@@ -298,11 +298,18 @@ static void restore_screen(void)
        }
 
        /* Restore cursor position */
+       if (saved.curx >= xs)
+               saved.curx = xs-1;
+       if (saved.cury >= ys)
+               saved.cury = ys-1;
+
        initregs(&ireg);
        ireg.ah = 0x02;         /* Set cursor position */
        ireg.dh = saved.cury;
        ireg.dl = saved.curx;
        intcall(0x10, &ireg, NULL);
+
+       store_cursor_position();
 }
 
 void set_video(void)
index 2a4d073d2cf12124830ddcd2879485c5f61629b0..9046e4af66ce7a36d2ed5e83522046d04a3a6081 100644 (file)
@@ -297,7 +297,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
         * size limits imposed on them by creating programs with large
         * arrays in the data or bss.
         */
-       rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
+       rlim = rlimit(RLIMIT_DATA);
        if (rlim >= RLIM_INFINITY)
                rlim = ~0;
        if (ex.a_data + ex.a_bss > rlim)
@@ -308,14 +308,15 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
        if (retval)
                return retval;
 
-       regs->cs = __USER32_CS;
-       regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
-               regs->r13 = regs->r14 = regs->r15 = 0;
-
        /* OK, This is the point of no return */
        set_personality(PER_LINUX);
        set_thread_flag(TIF_IA32);
-       clear_thread_flag(TIF_ABI_PENDING);
+
+       setup_new_exec(bprm);
+
+       regs->cs = __USER32_CS;
+       regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
+               regs->r13 = regs->r14 = regs->r15 = 0;
 
        current->mm->end_code = ex.a_text +
                (current->mm->start_code = N_TXTADDR(ex));
index 69b74a7b877f917cd3f0bc9014045a1ea70d9412..f1e253ceba4be4b4835bd78250bc6b19f3f8c23a 100644 (file)
@@ -65,12 +65,17 @@ extern void alternatives_smp_module_add(struct module *mod, char *name,
                                        void *text, void *text_end);
 extern void alternatives_smp_module_del(struct module *mod);
 extern void alternatives_smp_switch(int smp);
+extern int alternatives_text_reserved(void *start, void *end);
 #else
 static inline void alternatives_smp_module_add(struct module *mod, char *name,
                                               void *locks, void *locks_end,
                                               void *text, void *text_end) {}
 static inline void alternatives_smp_module_del(struct module *mod) {}
 static inline void alternatives_smp_switch(int smp) {}
+static inline int alternatives_text_reserved(void *start, void *end)
+{
+       return 0;
+}
 #endif /* CONFIG_SMP */
 
 /* alternative assembly primitive: */
@@ -125,11 +130,16 @@ static inline void alternatives_smp_switch(int smp) {}
        asm volatile (ALTERNATIVE(oldinstr, newinstr, feature)          \
                : output : "i" (0), ## input)
 
+/* Like alternative_io, but for replacing a direct call with another one. */
+#define alternative_call(oldfunc, newfunc, feature, output, input...)  \
+       asm volatile (ALTERNATIVE("call %P[old]", "call %P[new]", feature) \
+               : output : [old] "i" (oldfunc), [new] "i" (newfunc), ## input)
+
 /*
  * use this macro(s) if you need more than one output parameter
  * in alternative_io
  */
-#define ASM_OUTPUT2(a, b) a, b
+#define ASM_OUTPUT2(a...) a
 
 struct paravirt_patch_site;
 #ifdef CONFIG_PARAVIRT
index 4d817f9e6e770b582e66b72788d31ebc091c766a..d2544f1d705d3eb9cad310ac3486f94c2358b51d 100644 (file)
@@ -31,6 +31,7 @@ extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
 extern int amd_iommu_init_devices(void);
 extern void amd_iommu_uninit_devices(void);
 extern void amd_iommu_init_notifier(void);
+extern void amd_iommu_init_api(void);
 #ifndef CONFIG_AMD_IOMMU_STATS
 
 static inline void amd_iommu_stats_init(void) { }
index 4e1b8873c47438dbbd646eebef82b9c6005259ed..8f8217b9bdac67a7312959cad211232f60fbb8ce 100644 (file)
@@ -1,5 +1,300 @@
+#ifndef _ASM_X86_ATOMIC_H
+#define _ASM_X86_ATOMIC_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/processor.h>
+#include <asm/alternative.h>
+#include <asm/cmpxchg.h>
+
+/*
+ * Atomic operations that C can't guarantee us.  Useful for
+ * resource counting etc..
+ */
+
+#define ATOMIC_INIT(i) { (i) }
+
+/**
+ * atomic_read - read atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically reads the value of @v.
+ */
+static inline int atomic_read(const atomic_t *v)
+{
+       return v->counter;
+}
+
+/**
+ * atomic_set - set atomic variable
+ * @v: pointer of type atomic_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i.
+ */
+static inline void atomic_set(atomic_t *v, int i)
+{
+       v->counter = i;
+}
+
+/**
+ * atomic_add - add integer to atomic variable
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v.
+ */
+static inline void atomic_add(int i, atomic_t *v)
+{
+       asm volatile(LOCK_PREFIX "addl %1,%0"
+                    : "+m" (v->counter)
+                    : "ir" (i));
+}
+
+/**
+ * atomic_sub - subtract integer from atomic variable
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v.
+ */
+static inline void atomic_sub(int i, atomic_t *v)
+{
+       asm volatile(LOCK_PREFIX "subl %1,%0"
+                    : "+m" (v->counter)
+                    : "ir" (i));
+}
+
+/**
+ * atomic_sub_and_test - subtract value from variable and test result
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_sub_and_test(int i, atomic_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
+                    : "+m" (v->counter), "=qm" (c)
+                    : "ir" (i) : "memory");
+       return c;
+}
+
+/**
+ * atomic_inc - increment atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1.
+ */
+static inline void atomic_inc(atomic_t *v)
+{
+       asm volatile(LOCK_PREFIX "incl %0"
+                    : "+m" (v->counter));
+}
+
+/**
+ * atomic_dec - decrement atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1.
+ */
+static inline void atomic_dec(atomic_t *v)
+{
+       asm volatile(LOCK_PREFIX "decl %0"
+                    : "+m" (v->counter));
+}
+
+/**
+ * atomic_dec_and_test - decrement and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases.
+ */
+static inline int atomic_dec_and_test(atomic_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "decl %0; sete %1"
+                    : "+m" (v->counter), "=qm" (c)
+                    : : "memory");
+       return c != 0;
+}
+
+/**
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_inc_and_test(atomic_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "incl %0; sete %1"
+                    : "+m" (v->counter), "=qm" (c)
+                    : : "memory");
+       return c != 0;
+}
+
+/**
+ * atomic_add_negative - add and test if negative
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero.
+ */
+static inline int atomic_add_negative(int i, atomic_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
+                    : "+m" (v->counter), "=qm" (c)
+                    : "ir" (i) : "memory");
+       return c;
+}
+
+/**
+ * atomic_add_return - add integer and return
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v and returns @i + @v
+ */
+static inline int atomic_add_return(int i, atomic_t *v)
+{
+       int __i;
+#ifdef CONFIG_M386
+       unsigned long flags;
+       if (unlikely(boot_cpu_data.x86 <= 3))
+               goto no_xadd;
+#endif
+       /* Modern 486+ processor */
+       __i = i;
+       asm volatile(LOCK_PREFIX "xaddl %0, %1"
+                    : "+r" (i), "+m" (v->counter)
+                    : : "memory");
+       return i + __i;
+
+#ifdef CONFIG_M386
+no_xadd: /* Legacy 386 processor */
+       raw_local_irq_save(flags);
+       __i = atomic_read(v);
+       atomic_set(v, i + __i);
+       raw_local_irq_restore(flags);
+       return i + __i;
+#endif
+}
+
+/**
+ * atomic_sub_return - subtract integer and return
+ * @v: pointer of type atomic_t
+ * @i: integer value to subtract
+ *
+ * Atomically subtracts @i from @v and returns @v - @i
+ */
+static inline int atomic_sub_return(int i, atomic_t *v)
+{
+       return atomic_add_return(-i, v);
+}
+
+#define atomic_inc_return(v)  (atomic_add_return(1, v))
+#define atomic_dec_return(v)  (atomic_sub_return(1, v))
+
+static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
+{
+       return cmpxchg(&v->counter, old, new);
+}
+
+static inline int atomic_xchg(atomic_t *v, int new)
+{
+       return xchg(&v->counter, new);
+}
+
+/**
+ * atomic_add_unless - add unless the number is already a given value
+ * @v: pointer of type atomic_t
+ * @a: the amount to add to v...
+ * @u: ...unless v is equal to u.
+ *
+ * Atomically adds @a to @v, so long as @v was not already @u.
+ * Returns non-zero if @v was not @u, and zero otherwise.
+ */
+static inline int atomic_add_unless(atomic_t *v, int a, int u)
+{
+       int c, old;
+       c = atomic_read(v);
+       for (;;) {
+               if (unlikely(c == (u)))
+                       break;
+               old = atomic_cmpxchg((v), c, c + (a));
+               if (likely(old == c))
+                       break;
+               c = old;
+       }
+       return c != (u);
+}
+
+#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
+
+/**
+ * atomic_inc_short - increment of a short integer
+ * @v: pointer to type int
+ *
+ * Atomically adds 1 to @v
+ * Returns the new value of @u
+ */
+static inline short int atomic_inc_short(short int *v)
+{
+       asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
+       return *v;
+}
+
+#ifdef CONFIG_X86_64
+/**
+ * atomic_or_long - OR of two long integers
+ * @v1: pointer to type unsigned long
+ * @v2: pointer to type unsigned long
+ *
+ * Atomically ORs @v1 and @v2
+ * Returns the result of the OR
+ */
+static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
+{
+       asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
+}
+#endif
+
+/* These are x86-specific, used by some header files */
+#define atomic_clear_mask(mask, addr)                          \
+       asm volatile(LOCK_PREFIX "andl %0,%1"                   \
+                    : : "r" (~(mask)), "m" (*(addr)) : "memory")
+
+#define atomic_set_mask(mask, addr)                            \
+       asm volatile(LOCK_PREFIX "orl %0,%1"                    \
+                    : : "r" ((unsigned)(mask)), "m" (*(addr))  \
+                    : "memory")
+
+/* Atomic operations are already serializing on x86 */
+#define smp_mb__before_atomic_dec()    barrier()
+#define smp_mb__after_atomic_dec()     barrier()
+#define smp_mb__before_atomic_inc()    barrier()
+#define smp_mb__after_atomic_inc()     barrier()
+
 #ifdef CONFIG_X86_32
-# include "atomic_32.h"
+# include "atomic64_32.h"
 #else
-# include "atomic_64.h"
+# include "atomic64_64.h"
 #endif
+
+#include <asm-generic/atomic-long.h>
+#endif /* _ASM_X86_ATOMIC_H */
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
new file mode 100644 (file)
index 0000000..03027bf
--- /dev/null
@@ -0,0 +1,160 @@
+#ifndef _ASM_X86_ATOMIC64_32_H
+#define _ASM_X86_ATOMIC64_32_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/processor.h>
+//#include <asm/cmpxchg.h>
+
+/* An 64bit atomic type */
+
+typedef struct {
+       u64 __aligned(8) counter;
+} atomic64_t;
+
+#define ATOMIC64_INIT(val)     { (val) }
+
+extern u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val);
+
+/**
+ * atomic64_xchg - xchg atomic64 variable
+ * @ptr:      pointer to type atomic64_t
+ * @new_val:  value to assign
+ *
+ * Atomically xchgs the value of @ptr to @new_val and returns
+ * the old value.
+ */
+extern u64 atomic64_xchg(atomic64_t *ptr, u64 new_val);
+
+/**
+ * atomic64_set - set atomic64 variable
+ * @ptr:      pointer to type atomic64_t
+ * @new_val:  value to assign
+ *
+ * Atomically sets the value of @ptr to @new_val.
+ */
+extern void atomic64_set(atomic64_t *ptr, u64 new_val);
+
+/**
+ * atomic64_read - read atomic64 variable
+ * @ptr:      pointer to type atomic64_t
+ *
+ * Atomically reads the value of @ptr and returns it.
+ */
+static inline u64 atomic64_read(atomic64_t *ptr)
+{
+       u64 res;
+
+       /*
+        * Note, we inline this atomic64_t primitive because
+        * it only clobbers EAX/EDX and leaves the others
+        * untouched. We also (somewhat subtly) rely on the
+        * fact that cmpxchg8b returns the current 64-bit value
+        * of the memory location we are touching:
+        */
+       asm volatile(
+               "mov %%ebx, %%eax\n\t"
+               "mov %%ecx, %%edx\n\t"
+               LOCK_PREFIX "cmpxchg8b %1\n"
+                       : "=&A" (res)
+                       : "m" (*ptr)
+               );
+
+       return res;
+}
+
+extern u64 atomic64_read(atomic64_t *ptr);
+
+/**
+ * atomic64_add_return - add and return
+ * @delta: integer value to add
+ * @ptr:   pointer to type atomic64_t
+ *
+ * Atomically adds @delta to @ptr and returns @delta + *@ptr
+ */
+extern u64 atomic64_add_return(u64 delta, atomic64_t *ptr);
+
+/*
+ * Other variants with different arithmetic operators:
+ */
+extern u64 atomic64_sub_return(u64 delta, atomic64_t *ptr);
+extern u64 atomic64_inc_return(atomic64_t *ptr);
+extern u64 atomic64_dec_return(atomic64_t *ptr);
+
+/**
+ * atomic64_add - add integer to atomic64 variable
+ * @delta: integer value to add
+ * @ptr:   pointer to type atomic64_t
+ *
+ * Atomically adds @delta to @ptr.
+ */
+extern void atomic64_add(u64 delta, atomic64_t *ptr);
+
+/**
+ * atomic64_sub - subtract the atomic64 variable
+ * @delta: integer value to subtract
+ * @ptr:   pointer to type atomic64_t
+ *
+ * Atomically subtracts @delta from @ptr.
+ */
+extern void atomic64_sub(u64 delta, atomic64_t *ptr);
+
+/**
+ * atomic64_sub_and_test - subtract value from variable and test result
+ * @delta: integer value to subtract
+ * @ptr:   pointer to type atomic64_t
+ *
+ * Atomically subtracts @delta from @ptr and returns
+ * true if the result is zero, or false for all
+ * other cases.
+ */
+extern int atomic64_sub_and_test(u64 delta, atomic64_t *ptr);
+
+/**
+ * atomic64_inc - increment atomic64 variable
+ * @ptr: pointer to type atomic64_t
+ *
+ * Atomically increments @ptr by 1.
+ */
+extern void atomic64_inc(atomic64_t *ptr);
+
+/**
+ * atomic64_dec - decrement atomic64 variable
+ * @ptr: pointer to type atomic64_t
+ *
+ * Atomically decrements @ptr by 1.
+ */
+extern void atomic64_dec(atomic64_t *ptr);
+
+/**
+ * atomic64_dec_and_test - decrement and test
+ * @ptr: pointer to type atomic64_t
+ *
+ * Atomically decrements @ptr by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases.
+ */
+extern int atomic64_dec_and_test(atomic64_t *ptr);
+
+/**
+ * atomic64_inc_and_test - increment and test
+ * @ptr: pointer to type atomic64_t
+ *
+ * Atomically increments @ptr by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+extern int atomic64_inc_and_test(atomic64_t *ptr);
+
+/**
+ * atomic64_add_negative - add and test if negative
+ * @delta: integer value to add
+ * @ptr:   pointer to type atomic64_t
+ *
+ * Atomically adds @delta to @ptr and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero.
+ */
+extern int atomic64_add_negative(u64 delta, atomic64_t *ptr);
+
+#endif /* _ASM_X86_ATOMIC64_32_H */
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
new file mode 100644 (file)
index 0000000..51c5b40
--- /dev/null
@@ -0,0 +1,224 @@
+#ifndef _ASM_X86_ATOMIC64_64_H
+#define _ASM_X86_ATOMIC64_64_H
+
+#include <linux/types.h>
+#include <asm/alternative.h>
+#include <asm/cmpxchg.h>
+
+/* The 64-bit atomic type */
+
+#define ATOMIC64_INIT(i)       { (i) }
+
+/**
+ * atomic64_read - read atomic64 variable
+ * @v: pointer of type atomic64_t
+ *
+ * Atomically reads the value of @v.
+ * Doesn't imply a read memory barrier.
+ */
+static inline long atomic64_read(const atomic64_t *v)
+{
+       return v->counter;
+}
+
+/**
+ * atomic64_set - set atomic64 variable
+ * @v: pointer to type atomic64_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i.
+ */
+static inline void atomic64_set(atomic64_t *v, long i)
+{
+       v->counter = i;
+}
+
+/**
+ * atomic64_add - add integer to atomic64 variable
+ * @i: integer value to add
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically adds @i to @v.
+ */
+static inline void atomic64_add(long i, atomic64_t *v)
+{
+       asm volatile(LOCK_PREFIX "addq %1,%0"
+                    : "=m" (v->counter)
+                    : "er" (i), "m" (v->counter));
+}
+
+/**
+ * atomic64_sub - subtract the atomic64 variable
+ * @i: integer value to subtract
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically subtracts @i from @v.
+ */
+static inline void atomic64_sub(long i, atomic64_t *v)
+{
+       asm volatile(LOCK_PREFIX "subq %1,%0"
+                    : "=m" (v->counter)
+                    : "er" (i), "m" (v->counter));
+}
+
+/**
+ * atomic64_sub_and_test - subtract value from variable and test result
+ * @i: integer value to subtract
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic64_sub_and_test(long i, atomic64_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
+                    : "=m" (v->counter), "=qm" (c)
+                    : "er" (i), "m" (v->counter) : "memory");
+       return c;
+}
+
+/**
+ * atomic64_inc - increment atomic64 variable
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically increments @v by 1.
+ */
+static inline void atomic64_inc(atomic64_t *v)
+{
+       asm volatile(LOCK_PREFIX "incq %0"
+                    : "=m" (v->counter)
+                    : "m" (v->counter));
+}
+
+/**
+ * atomic64_dec - decrement atomic64 variable
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically decrements @v by 1.
+ */
+static inline void atomic64_dec(atomic64_t *v)
+{
+       asm volatile(LOCK_PREFIX "decq %0"
+                    : "=m" (v->counter)
+                    : "m" (v->counter));
+}
+
+/**
+ * atomic64_dec_and_test - decrement and test
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases.
+ */
+static inline int atomic64_dec_and_test(atomic64_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "decq %0; sete %1"
+                    : "=m" (v->counter), "=qm" (c)
+                    : "m" (v->counter) : "memory");
+       return c != 0;
+}
+
+/**
+ * atomic64_inc_and_test - increment and test
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic64_inc_and_test(atomic64_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "incq %0; sete %1"
+                    : "=m" (v->counter), "=qm" (c)
+                    : "m" (v->counter) : "memory");
+       return c != 0;
+}
+
+/**
+ * atomic64_add_negative - add and test if negative
+ * @i: integer value to add
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero.
+ */
+static inline int atomic64_add_negative(long i, atomic64_t *v)
+{
+       unsigned char c;
+
+       asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
+                    : "=m" (v->counter), "=qm" (c)
+                    : "er" (i), "m" (v->counter) : "memory");
+       return c;
+}
+
+/**
+ * atomic64_add_return - add and return
+ * @i: integer value to add
+ * @v: pointer to type atomic64_t
+ *
+ * Atomically adds @i to @v and returns @i + @v
+ */
+static inline long atomic64_add_return(long i, atomic64_t *v)
+{
+       long __i = i;
+       asm volatile(LOCK_PREFIX "xaddq %0, %1;"
+                    : "+r" (i), "+m" (v->counter)
+                    : : "memory");
+       return i + __i;
+}
+
+static inline long atomic64_sub_return(long i, atomic64_t *v)
+{
+       return atomic64_add_return(-i, v);
+}
+
+#define atomic64_inc_return(v)  (atomic64_add_return(1, (v)))
+#define atomic64_dec_return(v)  (atomic64_sub_return(1, (v)))
+
+static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
+{
+       return cmpxchg(&v->counter, old, new);
+}
+
+static inline long atomic64_xchg(atomic64_t *v, long new)
+{
+       return xchg(&v->counter, new);
+}
+
+/**
+ * atomic64_add_unless - add unless the number is a given value
+ * @v: pointer of type atomic64_t
+ * @a: the amount to add to v...
+ * @u: ...unless v is equal to u.
+ *
+ * Atomically adds @a to @v, so long as it was not @u.
+ * Returns non-zero if @v was not @u, and zero otherwise.
+ */
+static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
+{
+       long c, old;
+       c = atomic64_read(v);
+       for (;;) {
+               if (unlikely(c == (u)))
+                       break;
+               old = atomic64_cmpxchg((v), c, c + (a));
+               if (likely(old == c))
+                       break;
+               c = old;
+       }
+       return c != (u);
+}
+
+#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
+
+#endif /* _ASM_X86_ATOMIC64_64_H */
diff --git a/arch/x86/include/asm/atomic_32.h b/arch/x86/include/asm/atomic_32.h
deleted file mode 100644 (file)
index dc5a667..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-#ifndef _ASM_X86_ATOMIC_32_H
-#define _ASM_X86_ATOMIC_32_H
-
-#include <linux/compiler.h>
-#include <linux/types.h>
-#include <asm/processor.h>
-#include <asm/cmpxchg.h>
-
-/*
- * Atomic operations that C can't guarantee us.  Useful for
- * resource counting etc..
- */
-
-#define ATOMIC_INIT(i) { (i) }
-
-/**
- * atomic_read - read atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically reads the value of @v.
- */
-static inline int atomic_read(const atomic_t *v)
-{
-       return v->counter;
-}
-
-/**
- * atomic_set - set atomic variable
- * @v: pointer of type atomic_t
- * @i: required value
- *
- * Atomically sets the value of @v to @i.
- */
-static inline void atomic_set(atomic_t *v, int i)
-{
-       v->counter = i;
-}
-
-/**
- * atomic_add - add integer to atomic variable
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v.
- */
-static inline void atomic_add(int i, atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "addl %1,%0"
-                    : "+m" (v->counter)
-                    : "ir" (i));
-}
-
-/**
- * atomic_sub - subtract integer from atomic variable
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v.
- */
-static inline void atomic_sub(int i, atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "subl %1,%0"
-                    : "+m" (v->counter)
-                    : "ir" (i));
-}
-
-/**
- * atomic_sub_and_test - subtract value from variable and test result
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v and returns
- * true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic_sub_and_test(int i, atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
-                    : "+m" (v->counter), "=qm" (c)
-                    : "ir" (i) : "memory");
-       return c;
-}
-
-/**
- * atomic_inc - increment atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1.
- */
-static inline void atomic_inc(atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "incl %0"
-                    : "+m" (v->counter));
-}
-
-/**
- * atomic_dec - decrement atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1.
- */
-static inline void atomic_dec(atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "decl %0"
-                    : "+m" (v->counter));
-}
-
-/**
- * atomic_dec_and_test - decrement and test
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1 and
- * returns true if the result is 0, or false for all other
- * cases.
- */
-static inline int atomic_dec_and_test(atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "decl %0; sete %1"
-                    : "+m" (v->counter), "=qm" (c)
-                    : : "memory");
-       return c != 0;
-}
-
-/**
- * atomic_inc_and_test - increment and test
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic_inc_and_test(atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "incl %0; sete %1"
-                    : "+m" (v->counter), "=qm" (c)
-                    : : "memory");
-       return c != 0;
-}
-
-/**
- * atomic_add_negative - add and test if negative
- * @v: pointer of type atomic_t
- * @i: integer value to add
- *
- * Atomically adds @i to @v and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero.
- */
-static inline int atomic_add_negative(int i, atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
-                    : "+m" (v->counter), "=qm" (c)
-                    : "ir" (i) : "memory");
-       return c;
-}
-
-/**
- * atomic_add_return - add integer and return
- * @v: pointer of type atomic_t
- * @i: integer value to add
- *
- * Atomically adds @i to @v and returns @i + @v
- */
-static inline int atomic_add_return(int i, atomic_t *v)
-{
-       int __i;
-#ifdef CONFIG_M386
-       unsigned long flags;
-       if (unlikely(boot_cpu_data.x86 <= 3))
-               goto no_xadd;
-#endif
-       /* Modern 486+ processor */
-       __i = i;
-       asm volatile(LOCK_PREFIX "xaddl %0, %1"
-                    : "+r" (i), "+m" (v->counter)
-                    : : "memory");
-       return i + __i;
-
-#ifdef CONFIG_M386
-no_xadd: /* Legacy 386 processor */
-       local_irq_save(flags);
-       __i = atomic_read(v);
-       atomic_set(v, i + __i);
-       local_irq_restore(flags);
-       return i + __i;
-#endif
-}
-
-/**
- * atomic_sub_return - subtract integer and return
- * @v: pointer of type atomic_t
- * @i: integer value to subtract
- *
- * Atomically subtracts @i from @v and returns @v - @i
- */
-static inline int atomic_sub_return(int i, atomic_t *v)
-{
-       return atomic_add_return(-i, v);
-}
-
-static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-{
-       return cmpxchg(&v->counter, old, new);
-}
-
-static inline int atomic_xchg(atomic_t *v, int new)
-{
-       return xchg(&v->counter, new);
-}
-
-/**
- * atomic_add_unless - add unless the number is already a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as @v was not already @u.
- * Returns non-zero if @v was not @u, and zero otherwise.
- */
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int c, old;
-       c = atomic_read(v);
-       for (;;) {
-               if (unlikely(c == (u)))
-                       break;
-               old = atomic_cmpxchg((v), c, c + (a));
-               if (likely(old == c))
-                       break;
-               c = old;
-       }
-       return c != (u);
-}
-
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-
-#define atomic_inc_return(v)  (atomic_add_return(1, v))
-#define atomic_dec_return(v)  (atomic_sub_return(1, v))
-
-/* These are x86-specific, used by some header files */
-#define atomic_clear_mask(mask, addr)                          \
-       asm volatile(LOCK_PREFIX "andl %0,%1"                   \
-                    : : "r" (~(mask)), "m" (*(addr)) : "memory")
-
-#define atomic_set_mask(mask, addr)                            \
-       asm volatile(LOCK_PREFIX "orl %0,%1"                            \
-                    : : "r" (mask), "m" (*(addr)) : "memory")
-
-/* Atomic operations are already serializing on x86 */
-#define smp_mb__before_atomic_dec()    barrier()
-#define smp_mb__after_atomic_dec()     barrier()
-#define smp_mb__before_atomic_inc()    barrier()
-#define smp_mb__after_atomic_inc()     barrier()
-
-/* An 64bit atomic type */
-
-typedef struct {
-       u64 __aligned(8) counter;
-} atomic64_t;
-
-#define ATOMIC64_INIT(val)     { (val) }
-
-extern u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val);
-
-/**
- * atomic64_xchg - xchg atomic64 variable
- * @ptr:      pointer to type atomic64_t
- * @new_val:  value to assign
- *
- * Atomically xchgs the value of @ptr to @new_val and returns
- * the old value.
- */
-extern u64 atomic64_xchg(atomic64_t *ptr, u64 new_val);
-
-/**
- * atomic64_set - set atomic64 variable
- * @ptr:      pointer to type atomic64_t
- * @new_val:  value to assign
- *
- * Atomically sets the value of @ptr to @new_val.
- */
-extern void atomic64_set(atomic64_t *ptr, u64 new_val);
-
-/**
- * atomic64_read - read atomic64 variable
- * @ptr:      pointer to type atomic64_t
- *
- * Atomically reads the value of @ptr and returns it.
- */
-static inline u64 atomic64_read(atomic64_t *ptr)
-{
-       u64 res;
-
-       /*
-        * Note, we inline this atomic64_t primitive because
-        * it only clobbers EAX/EDX and leaves the others
-        * untouched. We also (somewhat subtly) rely on the
-        * fact that cmpxchg8b returns the current 64-bit value
-        * of the memory location we are touching:
-        */
-       asm volatile(
-               "mov %%ebx, %%eax\n\t"
-               "mov %%ecx, %%edx\n\t"
-               LOCK_PREFIX "cmpxchg8b %1\n"
-                       : "=&A" (res)
-                       : "m" (*ptr)
-               );
-
-       return res;
-}
-
-extern u64 atomic64_read(atomic64_t *ptr);
-
-/**
- * atomic64_add_return - add and return
- * @delta: integer value to add
- * @ptr:   pointer to type atomic64_t
- *
- * Atomically adds @delta to @ptr and returns @delta + *@ptr
- */
-extern u64 atomic64_add_return(u64 delta, atomic64_t *ptr);
-
-/*
- * Other variants with different arithmetic operators:
- */
-extern u64 atomic64_sub_return(u64 delta, atomic64_t *ptr);
-extern u64 atomic64_inc_return(atomic64_t *ptr);
-extern u64 atomic64_dec_return(atomic64_t *ptr);
-
-/**
- * atomic64_add - add integer to atomic64 variable
- * @delta: integer value to add
- * @ptr:   pointer to type atomic64_t
- *
- * Atomically adds @delta to @ptr.
- */
-extern void atomic64_add(u64 delta, atomic64_t *ptr);
-
-/**
- * atomic64_sub - subtract the atomic64 variable
- * @delta: integer value to subtract
- * @ptr:   pointer to type atomic64_t
- *
- * Atomically subtracts @delta from @ptr.
- */
-extern void atomic64_sub(u64 delta, atomic64_t *ptr);
-
-/**
- * atomic64_sub_and_test - subtract value from variable and test result
- * @delta: integer value to subtract
- * @ptr:   pointer to type atomic64_t
- *
- * Atomically subtracts @delta from @ptr and returns
- * true if the result is zero, or false for all
- * other cases.
- */
-extern int atomic64_sub_and_test(u64 delta, atomic64_t *ptr);
-
-/**
- * atomic64_inc - increment atomic64 variable
- * @ptr: pointer to type atomic64_t
- *
- * Atomically increments @ptr by 1.
- */
-extern void atomic64_inc(atomic64_t *ptr);
-
-/**
- * atomic64_dec - decrement atomic64 variable
- * @ptr: pointer to type atomic64_t
- *
- * Atomically decrements @ptr by 1.
- */
-extern void atomic64_dec(atomic64_t *ptr);
-
-/**
- * atomic64_dec_and_test - decrement and test
- * @ptr: pointer to type atomic64_t
- *
- * Atomically decrements @ptr by 1 and
- * returns true if the result is 0, or false for all other
- * cases.
- */
-extern int atomic64_dec_and_test(atomic64_t *ptr);
-
-/**
- * atomic64_inc_and_test - increment and test
- * @ptr: pointer to type atomic64_t
- *
- * Atomically increments @ptr by 1
- * and returns true if the result is zero, or false for all
- * other cases.
- */
-extern int atomic64_inc_and_test(atomic64_t *ptr);
-
-/**
- * atomic64_add_negative - add and test if negative
- * @delta: integer value to add
- * @ptr:   pointer to type atomic64_t
- *
- * Atomically adds @delta to @ptr and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero.
- */
-extern int atomic64_add_negative(u64 delta, atomic64_t *ptr);
-
-#include <asm-generic/atomic-long.h>
-#endif /* _ASM_X86_ATOMIC_32_H */
diff --git a/arch/x86/include/asm/atomic_64.h b/arch/x86/include/asm/atomic_64.h
deleted file mode 100644 (file)
index d605dc2..0000000
+++ /dev/null
@@ -1,485 +0,0 @@
-#ifndef _ASM_X86_ATOMIC_64_H
-#define _ASM_X86_ATOMIC_64_H
-
-#include <linux/types.h>
-#include <asm/alternative.h>
-#include <asm/cmpxchg.h>
-
-/*
- * Atomic operations that C can't guarantee us.  Useful for
- * resource counting etc..
- */
-
-#define ATOMIC_INIT(i) { (i) }
-
-/**
- * atomic_read - read atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically reads the value of @v.
- */
-static inline int atomic_read(const atomic_t *v)
-{
-       return v->counter;
-}
-
-/**
- * atomic_set - set atomic variable
- * @v: pointer of type atomic_t
- * @i: required value
- *
- * Atomically sets the value of @v to @i.
- */
-static inline void atomic_set(atomic_t *v, int i)
-{
-       v->counter = i;
-}
-
-/**
- * atomic_add - add integer to atomic variable
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v.
- */
-static inline void atomic_add(int i, atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "addl %1,%0"
-                    : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
-}
-
-/**
- * atomic_sub - subtract the atomic variable
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v.
- */
-static inline void atomic_sub(int i, atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "subl %1,%0"
-                    : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
-}
-
-/**
- * atomic_sub_and_test - subtract value from variable and test result
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v and returns
- * true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic_sub_and_test(int i, atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
-       return c;
-}
-
-/**
- * atomic_inc - increment atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1.
- */
-static inline void atomic_inc(atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "incl %0"
-                    : "=m" (v->counter)
-                    : "m" (v->counter));
-}
-
-/**
- * atomic_dec - decrement atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1.
- */
-static inline void atomic_dec(atomic_t *v)
-{
-       asm volatile(LOCK_PREFIX "decl %0"
-                    : "=m" (v->counter)
-                    : "m" (v->counter));
-}
-
-/**
- * atomic_dec_and_test - decrement and test
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1 and
- * returns true if the result is 0, or false for all other
- * cases.
- */
-static inline int atomic_dec_and_test(atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "decl %0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "m" (v->counter) : "memory");
-       return c != 0;
-}
-
-/**
- * atomic_inc_and_test - increment and test
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic_inc_and_test(atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "incl %0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "m" (v->counter) : "memory");
-       return c != 0;
-}
-
-/**
- * atomic_add_negative - add and test if negative
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero.
- */
-static inline int atomic_add_negative(int i, atomic_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
-       return c;
-}
-
-/**
- * atomic_add_return - add and return
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v and returns @i + @v
- */
-static inline int atomic_add_return(int i, atomic_t *v)
-{
-       int __i = i;
-       asm volatile(LOCK_PREFIX "xaddl %0, %1"
-                    : "+r" (i), "+m" (v->counter)
-                    : : "memory");
-       return i + __i;
-}
-
-static inline int atomic_sub_return(int i, atomic_t *v)
-{
-       return atomic_add_return(-i, v);
-}
-
-#define atomic_inc_return(v)  (atomic_add_return(1, v))
-#define atomic_dec_return(v)  (atomic_sub_return(1, v))
-
-/* The 64-bit atomic type */
-
-#define ATOMIC64_INIT(i)       { (i) }
-
-/**
- * atomic64_read - read atomic64 variable
- * @v: pointer of type atomic64_t
- *
- * Atomically reads the value of @v.
- * Doesn't imply a read memory barrier.
- */
-static inline long atomic64_read(const atomic64_t *v)
-{
-       return v->counter;
-}
-
-/**
- * atomic64_set - set atomic64 variable
- * @v: pointer to type atomic64_t
- * @i: required value
- *
- * Atomically sets the value of @v to @i.
- */
-static inline void atomic64_set(atomic64_t *v, long i)
-{
-       v->counter = i;
-}
-
-/**
- * atomic64_add - add integer to atomic64 variable
- * @i: integer value to add
- * @v: pointer to type atomic64_t
- *
- * Atomically adds @i to @v.
- */
-static inline void atomic64_add(long i, atomic64_t *v)
-{
-       asm volatile(LOCK_PREFIX "addq %1,%0"
-                    : "=m" (v->counter)
-                    : "er" (i), "m" (v->counter));
-}
-
-/**
- * atomic64_sub - subtract the atomic64 variable
- * @i: integer value to subtract
- * @v: pointer to type atomic64_t
- *
- * Atomically subtracts @i from @v.
- */
-static inline void atomic64_sub(long i, atomic64_t *v)
-{
-       asm volatile(LOCK_PREFIX "subq %1,%0"
-                    : "=m" (v->counter)
-                    : "er" (i), "m" (v->counter));
-}
-
-/**
- * atomic64_sub_and_test - subtract value from variable and test result
- * @i: integer value to subtract
- * @v: pointer to type atomic64_t
- *
- * Atomically subtracts @i from @v and returns
- * true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic64_sub_and_test(long i, atomic64_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "er" (i), "m" (v->counter) : "memory");
-       return c;
-}
-
-/**
- * atomic64_inc - increment atomic64 variable
- * @v: pointer to type atomic64_t
- *
- * Atomically increments @v by 1.
- */
-static inline void atomic64_inc(atomic64_t *v)
-{
-       asm volatile(LOCK_PREFIX "incq %0"
-                    : "=m" (v->counter)
-                    : "m" (v->counter));
-}
-
-/**
- * atomic64_dec - decrement atomic64 variable
- * @v: pointer to type atomic64_t
- *
- * Atomically decrements @v by 1.
- */
-static inline void atomic64_dec(atomic64_t *v)
-{
-       asm volatile(LOCK_PREFIX "decq %0"
-                    : "=m" (v->counter)
-                    : "m" (v->counter));
-}
-
-/**
- * atomic64_dec_and_test - decrement and test
- * @v: pointer to type atomic64_t
- *
- * Atomically decrements @v by 1 and
- * returns true if the result is 0, or false for all other
- * cases.
- */
-static inline int atomic64_dec_and_test(atomic64_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "decq %0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "m" (v->counter) : "memory");
-       return c != 0;
-}
-
-/**
- * atomic64_inc_and_test - increment and test
- * @v: pointer to type atomic64_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases.
- */
-static inline int atomic64_inc_and_test(atomic64_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "incq %0; sete %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "m" (v->counter) : "memory");
-       return c != 0;
-}
-
-/**
- * atomic64_add_negative - add and test if negative
- * @i: integer value to add
- * @v: pointer to type atomic64_t
- *
- * Atomically adds @i to @v and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero.
- */
-static inline int atomic64_add_negative(long i, atomic64_t *v)
-{
-       unsigned char c;
-
-       asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
-                    : "=m" (v->counter), "=qm" (c)
-                    : "er" (i), "m" (v->counter) : "memory");
-       return c;
-}
-
-/**
- * atomic64_add_return - add and return
- * @i: integer value to add
- * @v: pointer to type atomic64_t
- *
- * Atomically adds @i to @v and returns @i + @v
- */
-static inline long atomic64_add_return(long i, atomic64_t *v)
-{
-       long __i = i;
-       asm volatile(LOCK_PREFIX "xaddq %0, %1;"
-                    : "+r" (i), "+m" (v->counter)
-                    : : "memory");
-       return i + __i;
-}
-
-static inline long atomic64_sub_return(long i, atomic64_t *v)
-{
-       return atomic64_add_return(-i, v);
-}
-
-#define atomic64_inc_return(v)  (atomic64_add_return(1, (v)))
-#define atomic64_dec_return(v)  (atomic64_sub_return(1, (v)))
-
-static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
-{
-       return cmpxchg(&v->counter, old, new);
-}
-
-static inline long atomic64_xchg(atomic64_t *v, long new)
-{
-       return xchg(&v->counter, new);
-}
-
-static inline long atomic_cmpxchg(atomic_t *v, int old, int new)
-{
-       return cmpxchg(&v->counter, old, new);
-}
-
-static inline long atomic_xchg(atomic_t *v, int new)
-{
-       return xchg(&v->counter, new);
-}
-
-/**
- * atomic_add_unless - add unless the number is a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as it was not @u.
- * Returns non-zero if @v was not @u, and zero otherwise.
- */
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int c, old;
-       c = atomic_read(v);
-       for (;;) {
-               if (unlikely(c == (u)))
-                       break;
-               old = atomic_cmpxchg((v), c, c + (a));
-               if (likely(old == c))
-                       break;
-               c = old;
-       }
-       return c != (u);
-}
-
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-
-/**
- * atomic64_add_unless - add unless the number is a given value
- * @v: pointer of type atomic64_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as it was not @u.
- * Returns non-zero if @v was not @u, and zero otherwise.
- */
-static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
-{
-       long c, old;
-       c = atomic64_read(v);
-       for (;;) {
-               if (unlikely(c == (u)))
-                       break;
-               old = atomic64_cmpxchg((v), c, c + (a));
-               if (likely(old == c))
-                       break;
-               c = old;
-       }
-       return c != (u);
-}
-
-/**
- * atomic_inc_short - increment of a short integer
- * @v: pointer to type int
- *
- * Atomically adds 1 to @v
- * Returns the new value of @u
- */
-static inline short int atomic_inc_short(short int *v)
-{
-       asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
-       return *v;
-}
-
-/**
- * atomic_or_long - OR of two long integers
- * @v1: pointer to type unsigned long
- * @v2: pointer to type unsigned long
- *
- * Atomically ORs @v1 and @v2
- * Returns the result of the OR
- */
-static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
-{
-       asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
-}
-
-#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
-
-/* These are x86-specific, used by some header files */
-#define atomic_clear_mask(mask, addr)                                  \
-       asm volatile(LOCK_PREFIX "andl %0,%1"                           \
-                    : : "r" (~(mask)), "m" (*(addr)) : "memory")
-
-#define atomic_set_mask(mask, addr)                                    \
-       asm volatile(LOCK_PREFIX "orl %0,%1"                            \
-                    : : "r" ((unsigned)(mask)), "m" (*(addr))          \
-                    : "memory")
-
-/* Atomic operations are already serializing on x86 */
-#define smp_mb__before_atomic_dec()    barrier()
-#define smp_mb__after_atomic_dec()     barrier()
-#define smp_mb__before_atomic_inc()    barrier()
-#define smp_mb__after_atomic_inc()     barrier()
-
-#include <asm-generic/atomic-long.h>
-#endif /* _ASM_X86_ATOMIC_64_H */
diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
deleted file mode 100644 (file)
index d96c1ee..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef _ASM_X86_CPU_DEBUG_H
-#define _ASM_X86_CPU_DEBUG_H
-
-/*
- * CPU x86 architecture debug
- *
- * Copyright(C) 2009 Jaswinder Singh Rajput
- */
-
-/* Register flags */
-enum cpu_debug_bit {
-/* Model Specific Registers (MSRs)                                     */
-       CPU_MC_BIT,                             /* Machine Check        */
-       CPU_MONITOR_BIT,                        /* Monitor              */
-       CPU_TIME_BIT,                           /* Time                 */
-       CPU_PMC_BIT,                            /* Performance Monitor  */
-       CPU_PLATFORM_BIT,                       /* Platform             */
-       CPU_APIC_BIT,                           /* APIC                 */
-       CPU_POWERON_BIT,                        /* Power-on             */
-       CPU_CONTROL_BIT,                        /* Control              */
-       CPU_FEATURES_BIT,                       /* Features control     */
-       CPU_LBRANCH_BIT,                        /* Last Branch          */
-       CPU_BIOS_BIT,                           /* BIOS                 */
-       CPU_FREQ_BIT,                           /* Frequency            */
-       CPU_MTTR_BIT,                           /* MTRR                 */
-       CPU_PERF_BIT,                           /* Performance          */
-       CPU_CACHE_BIT,                          /* Cache                */
-       CPU_SYSENTER_BIT,                       /* Sysenter             */
-       CPU_THERM_BIT,                          /* Thermal              */
-       CPU_MISC_BIT,                           /* Miscellaneous        */
-       CPU_DEBUG_BIT,                          /* Debug                */
-       CPU_PAT_BIT,                            /* PAT                  */
-       CPU_VMX_BIT,                            /* VMX                  */
-       CPU_CALL_BIT,                           /* System Call          */
-       CPU_BASE_BIT,                           /* BASE Address         */
-       CPU_VER_BIT,                            /* Version ID           */
-       CPU_CONF_BIT,                           /* Configuration        */
-       CPU_SMM_BIT,                            /* System mgmt mode     */
-       CPU_SVM_BIT,                            /*Secure Virtual Machine*/
-       CPU_OSVM_BIT,                           /* OS-Visible Workaround*/
-/* Standard Registers                                                  */
-       CPU_TSS_BIT,                            /* Task Stack Segment   */
-       CPU_CR_BIT,                             /* Control Registers    */
-       CPU_DT_BIT,                             /* Descriptor Table     */
-/* End of Registers flags                                              */
-       CPU_REG_ALL_BIT,                        /* Select all Registers */
-};
-
-#define        CPU_REG_ALL             (~0)            /* Select all Registers */
-
-#define        CPU_MC                  (1 << CPU_MC_BIT)
-#define        CPU_MONITOR             (1 << CPU_MONITOR_BIT)
-#define        CPU_TIME                (1 << CPU_TIME_BIT)
-#define        CPU_PMC                 (1 << CPU_PMC_BIT)
-#define        CPU_PLATFORM            (1 << CPU_PLATFORM_BIT)
-#define        CPU_APIC                (1 << CPU_APIC_BIT)
-#define        CPU_POWERON             (1 << CPU_POWERON_BIT)
-#define        CPU_CONTROL             (1 << CPU_CONTROL_BIT)
-#define        CPU_FEATURES            (1 << CPU_FEATURES_BIT)
-#define        CPU_LBRANCH             (1 << CPU_LBRANCH_BIT)
-#define        CPU_BIOS                (1 << CPU_BIOS_BIT)
-#define        CPU_FREQ                (1 << CPU_FREQ_BIT)
-#define        CPU_MTRR                (1 << CPU_MTTR_BIT)
-#define        CPU_PERF                (1 << CPU_PERF_BIT)
-#define        CPU_CACHE               (1 << CPU_CACHE_BIT)
-#define        CPU_SYSENTER            (1 << CPU_SYSENTER_BIT)
-#define        CPU_THERM               (1 << CPU_THERM_BIT)
-#define        CPU_MISC                (1 << CPU_MISC_BIT)
-#define        CPU_DEBUG               (1 << CPU_DEBUG_BIT)
-#define        CPU_PAT                 (1 << CPU_PAT_BIT)
-#define        CPU_VMX                 (1 << CPU_VMX_BIT)
-#define        CPU_CALL                (1 << CPU_CALL_BIT)
-#define        CPU_BASE                (1 << CPU_BASE_BIT)
-#define        CPU_VER                 (1 << CPU_VER_BIT)
-#define        CPU_CONF                (1 << CPU_CONF_BIT)
-#define        CPU_SMM                 (1 << CPU_SMM_BIT)
-#define        CPU_SVM                 (1 << CPU_SVM_BIT)
-#define        CPU_OSVM                (1 << CPU_OSVM_BIT)
-#define        CPU_TSS                 (1 << CPU_TSS_BIT)
-#define        CPU_CR                  (1 << CPU_CR_BIT)
-#define        CPU_DT                  (1 << CPU_DT_BIT)
-
-/* Register file flags */
-enum cpu_file_bit {
-       CPU_INDEX_BIT,                          /* index                */
-       CPU_VALUE_BIT,                          /* value                */
-};
-
-#define        CPU_FILE_VALUE          (1 << CPU_VALUE_BIT)
-
-#define MAX_CPU_FILES          512
-
-struct cpu_private {
-       unsigned                cpu;
-       unsigned                type;
-       unsigned                reg;
-       unsigned                file;
-};
-
-struct cpu_debug_base {
-       char                    *name;          /* Register name        */
-       unsigned                flag;           /* Register flag        */
-       unsigned                write;          /* Register write flag  */
-};
-
-/*
- * Currently it looks similar to cpu_debug_base but once we add more files
- * cpu_file_base will go in different direction
- */
-struct cpu_file_base {
-       char                    *name;          /* Register file name   */
-       unsigned                flag;           /* Register file flag   */
-       unsigned                write;          /* Register write flag  */
-};
-
-struct cpu_cpuX_base {
-       struct dentry           *dentry;        /* Register dentry      */
-       int                     init;           /* Register index file  */
-};
-
-struct cpu_debug_range {
-       unsigned                min;            /* Register range min   */
-       unsigned                max;            /* Register range max   */
-       unsigned                flag;           /* Supported flags      */
-};
-
-#endif /* _ASM_X86_CPU_DEBUG_H */
index 637e1ec963c397bec02f447e96992ca1dcd3a9f4..0cd82d06861333b1c42f8ac2dba79462c11e24ce 100644 (file)
 #define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */
 #define X86_FEATURE_EPT         (8*32+ 3) /* Intel Extended Page Table */
 #define X86_FEATURE_VPID        (8*32+ 4) /* Intel Virtual Processor ID */
+#define X86_FEATURE_NPT                (8*32+5)  /* AMD Nested Page Table support */
+#define X86_FEATURE_LBRV       (8*32+6)  /* AMD LBR Virtualization support */
+#define X86_FEATURE_SVML       (8*32+7)  /* "svm_lock" AMD SVM locking MSR */
+#define X86_FEATURE_NRIPS      (8*32+8)  /* "nrip_save" AMD SVM next_rip save */
 
 #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
 
index 8240f76b531e0959be5a4fa823b1820d5d5952b5..b81002f23614bb9ef6d9b75502f8ab08e228bc0d 100644 (file)
@@ -14,6 +14,9 @@
    which debugging register was responsible for the trap.  The other bits
    are either reserved or not of interest to us. */
 
+/* Define reserved bits in DR6 which are always set to 1 */
+#define DR6_RESERVED   (0xFFFF0FF0)
+
 #define DR_TRAP0       (0x1)           /* db0 */
 #define DR_TRAP1       (0x2)           /* db1 */
 #define DR_TRAP2       (0x4)           /* db2 */
index b4501ee223ad66e4e589d1340aee77b483e8da7c..f2ad2163109daab72f9fed6bee91839f3e83601e 100644 (file)
@@ -170,10 +170,7 @@ static inline void elf_common_init(struct thread_struct *t,
 }
 
 #define ELF_PLAT_INIT(_r, load_addr)                   \
-do {                                                   \
-       elf_common_init(&current->thread, _r, 0);       \
-       clear_thread_flag(TIF_IA32);                    \
-} while (0)
+       elf_common_init(&current->thread, _r, 0)
 
 #define        COMPAT_ELF_PLAT_INIT(regs, load_addr)           \
        elf_common_init(&current->thread, regs, __USER_DS)
@@ -181,14 +178,8 @@ do {                                                       \
 void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp);
 #define compat_start_thread start_thread_ia32
 
-#define COMPAT_SET_PERSONALITY(ex)                     \
-do {                                                   \
-       if (test_thread_flag(TIF_IA32))                 \
-               clear_thread_flag(TIF_ABI_PENDING);     \
-       else                                            \
-               set_thread_flag(TIF_ABI_PENDING);       \
-       current->personality |= force_personality32;    \
-} while (0)
+void set_personality_ia32(void);
+#define COMPAT_SET_PERSONALITY(ex) set_personality_ia32()
 
 #define COMPAT_ELF_PLATFORM                    ("i686")
 
index 53018464aea653a407dc32e6be3d95ac14230306..2519d0679d990963993eb8e024fbdd00e55df477 100644 (file)
@@ -12,10 +12,6 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
 }
 
-#ifdef CONFIG_X86_32
 extern int fb_is_primary_device(struct fb_info *info);
-#else
-static inline int fb_is_primary_device(struct fb_info *info) { return 0; }
-#endif
 
 #endif /* _ASM_X86_FB_H */
index 14f9890eb495a31a203fa780b3caf16b018d68ef..635f03bb499528ff7905b3b96f112a910d4c57e3 100644 (file)
@@ -118,14 +118,20 @@ enum fixed_addresses {
         * 256 temporary boot-time mappings, used by early_ioremap(),
         * before ioremap() is functional.
         *
-        * We round it up to the next 256 pages boundary so that we
-        * can have a single pgd entry and a single pte table:
+        * If necessary we round it up to the next 256 pages boundary so
+        * that we can have a single pgd entry and a single pte table:
         */
 #define NR_FIX_BTMAPS          64
 #define FIX_BTMAPS_SLOTS       4
-       FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
-                       (__end_of_permanent_fixed_addresses & 255),
-       FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
+#define TOTAL_FIX_BTMAPS       (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
+       FIX_BTMAP_END =
+        (__end_of_permanent_fixed_addresses ^
+         (__end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS - 1)) &
+        -PTRS_PER_PTE
+        ? __end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS -
+          (__end_of_permanent_fixed_addresses & (TOTAL_FIX_BTMAPS - 1))
+        : __end_of_permanent_fixed_addresses,
+       FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
        FIX_OHCI1394_BASE,
 #endif
index 5d89fd2a3690664e5dc205b915e2ddf65f97b231..1d5c08a1bdfdb5b61c72cb286dfb0ac382c17e76 100644 (file)
@@ -67,6 +67,7 @@ extern unsigned long hpet_address;
 extern unsigned long force_hpet_address;
 extern u8 hpet_blockid;
 extern int hpet_force_user;
+extern u8 hpet_msi_disable;
 extern int is_hpet_enabled(void);
 extern int hpet_enable(void);
 extern void hpet_disable(void);
index ebfb8a9e11f7eaef0e6896dd1dcfc7f3bdd74aae..da2930924501547c0349570d12323b37522115e2 100644 (file)
@@ -33,8 +33,16 @@ extern void init_thread_xstate(void);
 extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
 
 extern user_regset_active_fn fpregs_active, xfpregs_active;
-extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;
-extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set;
+extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get,
+                               xstateregs_get;
+extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set,
+                                xstateregs_set;
+
+/*
+ * xstateregs_active == fpregs_active. Please refer to the comment
+ * at the definition of fpregs_active.
+ */
+#define xstateregs_active      fpregs_active
 
 extern struct _fpx_sw_bytes fx_sw_reserved;
 #ifdef CONFIG_IA32_EMULATION
index 73739322b6d05675ca8155aac9f5126a5e701460..a1dcfa3ab17dd505c7400869463ed81adfcca91b 100644 (file)
@@ -1,8 +1,42 @@
 #ifndef _ASM_X86_IO_H
 #define _ASM_X86_IO_H
 
+/*
+ * This file contains the definitions for the x86 IO instructions
+ * inb/inw/inl/outb/outw/outl and the "string versions" of the same
+ * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
+ * versions of the single-IO instructions (inb_p/inw_p/..).
+ *
+ * This file is not meant to be obfuscating: it's just complicated
+ * to (a) handle it all in a way that makes gcc able to optimize it
+ * as well as possible and (b) trying to avoid writing the same thing
+ * over and over again with slight variations and possibly making a
+ * mistake somewhere.
+ */
+
+/*
+ * Thanks to James van Artsdalen for a better timing-fix than
+ * the two short jumps: using outb's to a nonexistent port seems
+ * to guarantee better timings even on fast machines.
+ *
+ * On the other hand, I'd like to be sure of a non-existent port:
+ * I feel a bit unsafe about using 0x80 (should be safe, though)
+ *
+ *             Linus
+ */
+
+ /*
+  *  Bit simplified and optimized by Jan Hubicka
+  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
+  *
+  *  isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
+  *  isa_read[wl] and isa_write[wl] fixed
+  *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+  */
+
 #define ARCH_HAS_IOREMAP_WC
 
+#include <linux/string.h>
 #include <linux/compiler.h>
 #include <asm-generic/int-ll64.h>
 #include <asm/page.h>
@@ -173,11 +207,126 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
 extern void iounmap(volatile void __iomem *addr);
 
 
-#ifdef CONFIG_X86_32
-# include "io_32.h"
+#ifdef __KERNEL__
+
+#include <asm-generic/iomap.h>
+
+#include <linux/vmalloc.h>
+
+/*
+ * Convert a virtual cached pointer to an uncached pointer
+ */
+#define xlate_dev_kmem_ptr(p)  p
+
+static inline void
+memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
+{
+       memset((void __force *)addr, val, count);
+}
+
+static inline void
+memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
+{
+       memcpy(dst, (const void __force *)src, count);
+}
+
+static inline void
+memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
+{
+       memcpy((void __force *)dst, src, count);
+}
+
+/*
+ * ISA space is 'always mapped' on a typical x86 system, no need to
+ * explicitly ioremap() it. The fact that the ISA IO space is mapped
+ * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
+ * are physical addresses. The following constant pointer can be
+ * used as the IO-area pointer (it can be iounmapped as well, so the
+ * analogy with PCI is quite large):
+ */
+#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
+
+/*
+ *     Cache management
+ *
+ *     This needed for two cases
+ *     1. Out of order aware processors
+ *     2. Accidentally out of order processors (PPro errata #51)
+ */
+
+static inline void flush_write_buffers(void)
+{
+#if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)
+       asm volatile("lock; addl $0,0(%%esp)": : :"memory");
+#endif
+}
+
+#endif /* __KERNEL__ */
+
+extern void native_io_delay(void);
+
+extern int io_delay_type;
+extern void io_delay_init(void);
+
+#if defined(CONFIG_PARAVIRT)
+#include <asm/paravirt.h>
 #else
-# include "io_64.h"
+
+static inline void slow_down_io(void)
+{
+       native_io_delay();
+#ifdef REALLY_SLOW_IO
+       native_io_delay();
+       native_io_delay();
+       native_io_delay();
 #endif
+}
+
+#endif
+
+#define BUILDIO(bwl, bw, type)                                         \
+static inline void out##bwl(unsigned type value, int port)             \
+{                                                                      \
+       asm volatile("out" #bwl " %" #bw "0, %w1"                       \
+                    : : "a"(value), "Nd"(port));                       \
+}                                                                      \
+                                                                       \
+static inline unsigned type in##bwl(int port)                          \
+{                                                                      \
+       unsigned type value;                                            \
+       asm volatile("in" #bwl " %w1, %" #bw "0"                        \
+                    : "=a"(value) : "Nd"(port));                       \
+       return value;                                                   \
+}                                                                      \
+                                                                       \
+static inline void out##bwl##_p(unsigned type value, int port)         \
+{                                                                      \
+       out##bwl(value, port);                                          \
+       slow_down_io();                                                 \
+}                                                                      \
+                                                                       \
+static inline unsigned type in##bwl##_p(int port)                      \
+{                                                                      \
+       unsigned type value = in##bwl(port);                            \
+       slow_down_io();                                                 \
+       return value;                                                   \
+}                                                                      \
+                                                                       \
+static inline void outs##bwl(int port, const void *addr, unsigned long count) \
+{                                                                      \
+       asm volatile("rep; outs" #bwl                                   \
+                    : "+S"(addr), "+c"(count) : "d"(port));            \
+}                                                                      \
+                                                                       \
+static inline void ins##bwl(int port, void *addr, unsigned long count) \
+{                                                                      \
+       asm volatile("rep; ins" #bwl                                    \
+                    : "+D"(addr), "+c"(count) : "d"(port));            \
+}
+
+BUILDIO(b, b, char)
+BUILDIO(w, w, short)
+BUILDIO(l, , int)
 
 extern void *xlate_dev_mem_ptr(unsigned long phys);
 extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
diff --git a/arch/x86/include/asm/io_32.h b/arch/x86/include/asm/io_32.h
deleted file mode 100644 (file)
index a299900..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#ifndef _ASM_X86_IO_32_H
-#define _ASM_X86_IO_32_H
-
-#include <linux/string.h>
-#include <linux/compiler.h>
-
-/*
- * This file contains the definitions for the x86 IO instructions
- * inb/inw/inl/outb/outw/outl and the "string versions" of the same
- * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
- * versions of the single-IO instructions (inb_p/inw_p/..).
- *
- * This file is not meant to be obfuscating: it's just complicated
- * to (a) handle it all in a way that makes gcc able to optimize it
- * as well as possible and (b) trying to avoid writing the same thing
- * over and over again with slight variations and possibly making a
- * mistake somewhere.
- */
-
-/*
- * Thanks to James van Artsdalen for a better timing-fix than
- * the two short jumps: using outb's to a nonexistent port seems
- * to guarantee better timings even on fast machines.
- *
- * On the other hand, I'd like to be sure of a non-existent port:
- * I feel a bit unsafe about using 0x80 (should be safe, though)
- *
- *             Linus
- */
-
- /*
-  *  Bit simplified and optimized by Jan Hubicka
-  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
-  *
-  *  isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
-  *  isa_read[wl] and isa_write[wl] fixed
-  *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-  */
-
-#define XQUAD_PORTIO_BASE 0xfe400000
-#define XQUAD_PORTIO_QUAD 0x40000  /* 256k per quad. */
-
-#ifdef __KERNEL__
-
-#include <asm-generic/iomap.h>
-
-#include <linux/vmalloc.h>
-
-/*
- * Convert a virtual cached pointer to an uncached pointer
- */
-#define xlate_dev_kmem_ptr(p)  p
-
-static inline void
-memset_io(volatile void __iomem *addr, unsigned char val, int count)
-{
-       memset((void __force *)addr, val, count);
-}
-
-static inline void
-memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
-{
-       __memcpy(dst, (const void __force *)src, count);
-}
-
-static inline void
-memcpy_toio(volatile void __iomem *dst, const void *src, int count)
-{
-       __memcpy((void __force *)dst, src, count);
-}
-
-/*
- * ISA space is 'always mapped' on a typical x86 system, no need to
- * explicitly ioremap() it. The fact that the ISA IO space is mapped
- * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
- * are physical addresses. The following constant pointer can be
- * used as the IO-area pointer (it can be iounmapped as well, so the
- * analogy with PCI is quite large):
- */
-#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
-
-/*
- *     Cache management
- *
- *     This needed for two cases
- *     1. Out of order aware processors
- *     2. Accidentally out of order processors (PPro errata #51)
- */
-
-#if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)
-
-static inline void flush_write_buffers(void)
-{
-       asm volatile("lock; addl $0,0(%%esp)": : :"memory");
-}
-
-#else
-
-#define flush_write_buffers() do { } while (0)
-
-#endif
-
-#endif /* __KERNEL__ */
-
-extern void native_io_delay(void);
-
-extern int io_delay_type;
-extern void io_delay_init(void);
-
-#if defined(CONFIG_PARAVIRT)
-#include <asm/paravirt.h>
-#else
-
-static inline void slow_down_io(void)
-{
-       native_io_delay();
-#ifdef REALLY_SLOW_IO
-       native_io_delay();
-       native_io_delay();
-       native_io_delay();
-#endif
-}
-
-#endif
-
-#define __BUILDIO(bwl, bw, type)                               \
-static inline void out##bwl(unsigned type value, int port)     \
-{                                                              \
-       out##bwl##_local(value, port);                          \
-}                                                              \
-                                                               \
-static inline unsigned type in##bwl(int port)                  \
-{                                                              \
-       return in##bwl##_local(port);                           \
-}
-
-#define BUILDIO(bwl, bw, type)                                         \
-static inline void out##bwl##_local(unsigned type value, int port)     \
-{                                                                      \
-       asm volatile("out" #bwl " %" #bw "0, %w1"               \
-                    : : "a"(value), "Nd"(port));                       \
-}                                                                      \
-                                                                       \
-static inline unsigned type in##bwl##_local(int port)                  \
-{                                                                      \
-       unsigned type value;                                            \
-       asm volatile("in" #bwl " %w1, %" #bw "0"                \
-                    : "=a"(value) : "Nd"(port));                       \
-       return value;                                                   \
-}                                                                      \
-                                                                       \
-static inline void out##bwl##_local_p(unsigned type value, int port)   \
-{                                                                      \
-       out##bwl##_local(value, port);                                  \
-       slow_down_io();                                                 \
-}                                                                      \
-                                                                       \
-static inline unsigned type in##bwl##_local_p(int port)                        \
-{                                                                      \
-       unsigned type value = in##bwl##_local(port);                    \
-       slow_down_io();                                                 \
-       return value;                                                   \
-}                                                                      \
-                                                                       \
-__BUILDIO(bwl, bw, type)                                               \
-                                                                       \
-static inline void out##bwl##_p(unsigned type value, int port)         \
-{                                                                      \
-       out##bwl(value, port);                                          \
-       slow_down_io();                                                 \
-}                                                                      \
-                                                                       \
-static inline unsigned type in##bwl##_p(int port)                      \
-{                                                                      \
-       unsigned type value = in##bwl(port);                            \
-       slow_down_io();                                                 \
-       return value;                                                   \
-}                                                                      \
-                                                                       \
-static inline void outs##bwl(int port, const void *addr, unsigned long count) \
-{                                                                      \
-       asm volatile("rep; outs" #bwl                                   \
-                    : "+S"(addr), "+c"(count) : "d"(port));            \
-}                                                                      \
-                                                                       \
-static inline void ins##bwl(int port, void *addr, unsigned long count) \
-{                                                                      \
-       asm volatile("rep; ins" #bwl                                    \
-                    : "+D"(addr), "+c"(count) : "d"(port));            \
-}
-
-BUILDIO(b, b, char)
-BUILDIO(w, w, short)
-BUILDIO(l, , int)
-
-#endif /* _ASM_X86_IO_32_H */
diff --git a/arch/x86/include/asm/io_64.h b/arch/x86/include/asm/io_64.h
deleted file mode 100644 (file)
index 2440678..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#ifndef _ASM_X86_IO_64_H
-#define _ASM_X86_IO_64_H
-
-
-/*
- * This file contains the definitions for the x86 IO instructions
- * inb/inw/inl/outb/outw/outl and the "string versions" of the same
- * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
- * versions of the single-IO instructions (inb_p/inw_p/..).
- *
- * This file is not meant to be obfuscating: it's just complicated
- * to (a) handle it all in a way that makes gcc able to optimize it
- * as well as possible and (b) trying to avoid writing the same thing
- * over and over again with slight variations and possibly making a
- * mistake somewhere.
- */
-
-/*
- * Thanks to James van Artsdalen for a better timing-fix than
- * the two short jumps: using outb's to a nonexistent port seems
- * to guarantee better timings even on fast machines.
- *
- * On the other hand, I'd like to be sure of a non-existent port:
- * I feel a bit unsafe about using 0x80 (should be safe, though)
- *
- *             Linus
- */
-
- /*
-  *  Bit simplified and optimized by Jan Hubicka
-  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
-  *
-  *  isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
-  *  isa_read[wl] and isa_write[wl] fixed
-  *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-  */
-
-extern void native_io_delay(void);
-
-extern int io_delay_type;
-extern void io_delay_init(void);
-
-#if defined(CONFIG_PARAVIRT)
-#include <asm/paravirt.h>
-#else
-
-static inline void slow_down_io(void)
-{
-       native_io_delay();
-#ifdef REALLY_SLOW_IO
-       native_io_delay();
-       native_io_delay();
-       native_io_delay();
-#endif
-}
-#endif
-
-/*
- * Talk about misusing macros..
- */
-#define __OUT1(s, x)                                                   \
-static inline void out##s(unsigned x value, unsigned short port) {
-
-#define __OUT2(s, s1, s2)                              \
-asm volatile ("out" #s " %" s1 "0,%" s2 "1"
-
-#ifndef REALLY_SLOW_IO
-#define REALLY_SLOW_IO
-#define UNSET_REALLY_SLOW_IO
-#endif
-
-#define __OUT(s, s1, x)                                                        \
-       __OUT1(s, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port));  \
-       }                                                               \
-       __OUT1(s##_p, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port)); \
-       slow_down_io();                                                 \
-}
-
-#define __IN1(s)                                                       \
-static inline RETURN_TYPE in##s(unsigned short port)                   \
-{                                                                      \
-       RETURN_TYPE _v;
-
-#define __IN2(s, s1, s2)                                               \
-       asm volatile ("in" #s " %" s2 "1,%" s1 "0"
-
-#define __IN(s, s1, i...)                                              \
-       __IN1(s) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i);     \
-       return _v;                                                      \
-       }                                                               \
-       __IN1(s##_p) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); \
-       slow_down_io(); \
-       return _v; }
-
-#ifdef UNSET_REALLY_SLOW_IO
-#undef REALLY_SLOW_IO
-#endif
-
-#define __INS(s)                                                       \
-static inline void ins##s(unsigned short port, void *addr,             \
-                         unsigned long count)                          \
-{                                                                      \
-       asm volatile ("rep ; ins" #s                                    \
-                     : "=D" (addr), "=c" (count)                       \
-                     : "d" (port), "0" (addr), "1" (count));           \
-}
-
-#define __OUTS(s)                                                      \
-static inline void outs##s(unsigned short port, const void *addr,      \
-                          unsigned long count)                         \
-{                                                                      \
-       asm volatile ("rep ; outs" #s                                   \
-                     : "=S" (addr), "=c" (count)                       \
-                     : "d" (port), "0" (addr), "1" (count));           \
-}
-
-#define RETURN_TYPE unsigned char
-__IN(b, "")
-#undef RETURN_TYPE
-#define RETURN_TYPE unsigned short
-__IN(w, "")
-#undef RETURN_TYPE
-#define RETURN_TYPE unsigned int
-__IN(l, "")
-#undef RETURN_TYPE
-
-__OUT(b, "b", char)
-__OUT(w, "w", short)
-__OUT(l, , int)
-
-__INS(b)
-__INS(w)
-__INS(l)
-
-__OUTS(b)
-__OUTS(w)
-__OUTS(l)
-
-#if defined(__KERNEL__) && defined(__x86_64__)
-
-#include <linux/vmalloc.h>
-
-#include <asm-generic/iomap.h>
-
-void __memcpy_fromio(void *, unsigned long, unsigned);
-void __memcpy_toio(unsigned long, const void *, unsigned);
-
-static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
-                                unsigned len)
-{
-       __memcpy_fromio(to, (unsigned long)from, len);
-}
-
-static inline void memcpy_toio(volatile void __iomem *to, const void *from,
-                              unsigned len)
-{
-       __memcpy_toio((unsigned long)to, from, len);
-}
-
-void memset_io(volatile void __iomem *a, int b, size_t c);
-
-/*
- * ISA space is 'always mapped' on a typical x86 system, no need to
- * explicitly ioremap() it. The fact that the ISA IO space is mapped
- * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
- * are physical addresses. The following constant pointer can be
- * used as the IO-area pointer (it can be iounmapped as well, so the
- * analogy with PCI is quite large):
- */
-#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
-
-#define flush_write_buffers()
-
-/*
- * Convert a virtual cached pointer to an uncached pointer
- */
-#define xlate_dev_kmem_ptr(p)  p
-
-#endif /* __KERNEL__ */
-
-#endif /* _ASM_X86_IO_64_H */
index 858baa061cfce365a51e48bf162f92cb00a8e8ba..6c3fdd631ed3df7652ed0ad261377006297b7f5f 100644 (file)
@@ -108,10 +108,11 @@ struct mce_log {
 #define K8_MCE_THRESHOLD_BANK_5    (MCE_THRESHOLD_BASE + 5 * 9)
 #define K8_MCE_THRESHOLD_DRAM_ECC  (MCE_THRESHOLD_BANK_4 + 0)
 
-extern struct atomic_notifier_head x86_mce_decoder_chain;
 
 #ifdef __KERNEL__
 
+extern struct atomic_notifier_head x86_mce_decoder_chain;
+
 #include <linux/percpu.h>
 #include <linux/init.h>
 #include <asm/atomic.h>
index c24ca9a56458e029da2e3c107f9a0fc2c80908eb..ef51b501e22a6e53bf4ae7e2d9e2566760f72ee1 100644 (file)
@@ -12,8 +12,6 @@ struct device;
 enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
 
 struct microcode_ops {
-       void (*init)(struct device *device);
-       void (*fini)(void);
        enum ucode_state (*request_microcode_user) (int cpu,
                                const void __user *buf, size_t size);
 
index a29f48c2a3229fc5a8a23599fdf51bcfb94c3dea..288b96f815a6b53571b6b6192469276db283a8ac 100644 (file)
@@ -39,11 +39,5 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
 #define node_start_pfn(nid)    (NODE_DATA(nid)->node_start_pfn)
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn +      \
                                 NODE_DATA(nid)->node_spanned_pages)
-
-#ifdef CONFIG_NUMA_EMU
-#define FAKE_NODE_MIN_SIZE     (64 * 1024 * 1024)
-#define FAKE_NODE_MIN_HASH_MASK        (~(FAKE_NODE_MIN_SIZE - 1UL))
-#endif
-
 #endif
 #endif /* _ASM_X86_MMZONE_64_H */
index 139d4c1a33a7c85a2989a8ab02ee1f6cee52d601..93da9c3f334120b64165a8124b79b09e71365bf4 100644 (file)
@@ -19,7 +19,6 @@ extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
 extern int check_nmi_watchdog(void);
 extern int nmi_watchdog_enabled;
 extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
-extern int avail_to_resrv_perfctr_nmi(unsigned int);
 extern int reserve_perfctr_nmi(unsigned int);
 extern void release_perfctr_nmi(unsigned int);
 extern int reserve_evntsel_nmi(unsigned int);
index c4ae822e415f907093eabd2531d97506a891b691..823e070e7c2603f6e42c65ef22d98d6dcd72cddc 100644 (file)
@@ -36,6 +36,11 @@ extern void __cpuinit numa_set_node(int cpu, int node);
 extern void __cpuinit numa_clear_node(int cpu);
 extern void __cpuinit numa_add_cpu(int cpu);
 extern void __cpuinit numa_remove_cpu(int cpu);
+
+#ifdef CONFIG_NUMA_EMU
+#define FAKE_NODE_MIN_SIZE     ((u64)64 << 20)
+#define FAKE_NODE_MIN_HASH_MASK        (~(FAKE_NODE_MIN_SIZE - 1UL))
+#endif /* CONFIG_NUMA_EMU */
 #else
 static inline void init_cpu_to_node(void)              { }
 static inline void numa_set_node(int cpu, int node)    { }
index 9f0a5f5d29ec6ff29aae7d427484ad9c2416822f..13370b95ea9481c32132961d2b804fd3d7ebea6b 100644 (file)
@@ -33,6 +33,10 @@ extern int get_memcfg_numaq(void);
 
 extern void *xquad_portio;
 
+#define XQUAD_PORTIO_BASE 0xfe400000
+#define XQUAD_PORTIO_QUAD 0x40000  /* 256k per quad. */
+#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
+
 /*
  * SYS_CFG_DATA_PRIV_ADDR, struct eachquadmem, and struct sys_cfg_data are the
  */
index 642fe34b36a2014806f282b42cd7fd50d33374d9..a667f24c72549e6c8171892fc6fbf63ac54006d0 100644 (file)
@@ -40,7 +40,6 @@
 
 #ifndef __ASSEMBLY__
 
-extern int page_is_ram(unsigned long pagenr);
 extern int devmem_is_allowed(unsigned long pagenr);
 
 extern unsigned long max_low_pfn_mapped;
index b4bf9a942ed0810418613f75b156e328fc0fd5d9..05b58ccb2e826521e627e439e466412e3e42027a 100644 (file)
@@ -29,6 +29,7 @@
 #define PCI_CHECK_ENABLE_AMD_MMCONF    0x20000
 #define PCI_HAS_IO_ECS         0x40000
 #define PCI_NOASSIGN_ROMS      0x80000
+#define PCI_ROOT_NO_CRS                0x100000
 
 extern unsigned int pci_probe;
 extern unsigned long pirq_table_addr;
index 8d9f8548a870498e94e3de1ced5811692238962c..befd172c82ada4c1c4c4e24b539e79689ddb3054 100644 (file)
@@ -19,6 +19,7 @@
 #define MSR_ARCH_PERFMON_EVENTSEL1                          0x187
 
 #define ARCH_PERFMON_EVENTSEL0_ENABLE                    (1 << 22)
+#define ARCH_PERFMON_EVENTSEL_ANY                        (1 << 21)
 #define ARCH_PERFMON_EVENTSEL_INT                        (1 << 20)
 #define ARCH_PERFMON_EVENTSEL_OS                         (1 << 17)
 #define ARCH_PERFMON_EVENTSEL_USR                        (1 << 16)
 /*
  * Includes eventsel and unit mask as well:
  */
-#define ARCH_PERFMON_EVENT_MASK                                    0xffff
+
+
+#define INTEL_ARCH_EVTSEL_MASK         0x000000FFULL
+#define INTEL_ARCH_UNIT_MASK           0x0000FF00ULL
+#define INTEL_ARCH_EDGE_MASK           0x00040000ULL
+#define INTEL_ARCH_INV_MASK            0x00800000ULL
+#define INTEL_ARCH_CNT_MASK            0xFF000000ULL
+#define INTEL_ARCH_EVENT_MASK  (INTEL_ARCH_UNIT_MASK|INTEL_ARCH_EVTSEL_MASK)
 
 /*
  * filter mask to validate fixed counter events.
  *  The other filters are supported by fixed counters.
  *  The any-thread option is supported starting with v3.
  */
-#define ARCH_PERFMON_EVENT_FILTER_MASK                 0xff840000
+#define INTEL_ARCH_FIXED_MASK \
+       (INTEL_ARCH_CNT_MASK| \
+        INTEL_ARCH_INV_MASK| \
+        INTEL_ARCH_EDGE_MASK|\
+        INTEL_ARCH_UNIT_MASK|\
+        INTEL_ARCH_EVTSEL_MASK)
 
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL                0x3c
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK                (0x00 << 8)
index 0e8c2a0fd9222d4b75793fb664591de22461e7d7..271de94c3810d9bbdb2c01bbfbb43f221b46ee24 100644 (file)
@@ -22,6 +22,11 @@ static inline void paravirt_release_pmd(unsigned long pfn) {}
 static inline void paravirt_release_pud(unsigned long pfn) {}
 #endif
 
+/*
+ * Flags to use when allocating a user page table page.
+ */
+extern gfp_t __userpte_alloc_gfp;
+
 /*
  * Allocate and free page tables.
  */
index fc801bab1b3b7683f39d6e38e3a6fc17003e7da1..b753ea59703a114f056b32d9b1455622d7b131a9 100644 (file)
@@ -450,6 +450,8 @@ struct thread_struct {
        struct perf_event       *ptrace_bps[HBP_NUM];
        /* Debug status used for traps, single steps, etc... */
        unsigned long           debugreg6;
+       /* Keep track of the exact dr7 value set by the user */
+       unsigned long           ptrace_dr7;
        /* Fault info: */
        unsigned long           cr2;
        unsigned long           trap_no;
index 9d369f6803216cd365358d1660c6aab999287d51..20102808b191b2b2a046133e31f90aed0f91fa49 100644 (file)
@@ -274,10 +274,6 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
                return 0;
 }
 
-/* Get Nth argument at function call */
-extern unsigned long regs_get_argument_nth(struct pt_regs *regs,
-                                          unsigned int n);
-
 /*
  * These are defined as per linux/ptrace.h, which see.
  */
index ca7517d3377634b6251ce727326d06dd30627fc5..606ede126972e568b992268da3df6f64b7e98480 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/lockdep.h>
+#include <asm/asm.h>
 
 struct rwsem_waiter;
 
@@ -55,17 +56,28 @@ extern asmregparm struct rw_semaphore *
 
 /*
  * the semaphore definition
+ *
+ * The bias values and the counter type limits the number of
+ * potential readers/writers to 32767 for 32 bits and 2147483647
+ * for 64 bits.
  */
 
-#define RWSEM_UNLOCKED_VALUE           0x00000000
-#define RWSEM_ACTIVE_BIAS              0x00000001
-#define RWSEM_ACTIVE_MASK              0x0000ffff
-#define RWSEM_WAITING_BIAS             (-0x00010000)
+#ifdef CONFIG_X86_64
+# define RWSEM_ACTIVE_MASK             0xffffffffL
+#else
+# define RWSEM_ACTIVE_MASK             0x0000ffffL
+#endif
+
+#define RWSEM_UNLOCKED_VALUE           0x00000000L
+#define RWSEM_ACTIVE_BIAS              0x00000001L
+#define RWSEM_WAITING_BIAS             (-RWSEM_ACTIVE_MASK-1)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
 
+typedef signed long rwsem_count_t;
+
 struct rw_semaphore {
-       signed long             count;
+       rwsem_count_t           count;
        spinlock_t              wait_lock;
        struct list_head        wait_list;
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -105,7 +117,7 @@ do {                                                                \
 static inline void __down_read(struct rw_semaphore *sem)
 {
        asm volatile("# beginning down_read\n\t"
-                    LOCK_PREFIX "  incl      (%%eax)\n\t"
+                    LOCK_PREFIX _ASM_INC "(%1)\n\t"
                     /* adds 0x00000001, returns the old value */
                     "  jns        1f\n"
                     "  call call_rwsem_down_read_failed\n"
@@ -121,14 +133,14 @@ static inline void __down_read(struct rw_semaphore *sem)
  */
 static inline int __down_read_trylock(struct rw_semaphore *sem)
 {
-       __s32 result, tmp;
+       rwsem_count_t result, tmp;
        asm volatile("# beginning __down_read_trylock\n\t"
-                    "  movl      %0,%1\n\t"
+                    "  mov          %0,%1\n\t"
                     "1:\n\t"
-                    "  movl         %1,%2\n\t"
-                    "  addl      %3,%2\n\t"
+                    "  mov          %1,%2\n\t"
+                    "  add          %3,%2\n\t"
                     "  jle          2f\n\t"
-                    LOCK_PREFIX "  cmpxchgl  %2,%0\n\t"
+                    LOCK_PREFIX "  cmpxchg  %2,%0\n\t"
                     "  jnz          1b\n\t"
                     "2:\n\t"
                     "# ending __down_read_trylock\n\t"
@@ -143,13 +155,13 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
  */
 static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
 {
-       int tmp;
+       rwsem_count_t tmp;
 
        tmp = RWSEM_ACTIVE_WRITE_BIAS;
        asm volatile("# beginning down_write\n\t"
-                    LOCK_PREFIX "  xadd      %%edx,(%%eax)\n\t"
+                    LOCK_PREFIX "  xadd      %1,(%2)\n\t"
                     /* subtract 0x0000ffff, returns the old value */
-                    "  testl     %%edx,%%edx\n\t"
+                    "  test      %1,%1\n\t"
                     /* was the count 0 before? */
                     "  jz        1f\n"
                     "  call call_rwsem_down_write_failed\n"
@@ -170,9 +182,9 @@ static inline void __down_write(struct rw_semaphore *sem)
  */
 static inline int __down_write_trylock(struct rw_semaphore *sem)
 {
-       signed long ret = cmpxchg(&sem->count,
-                                 RWSEM_UNLOCKED_VALUE,
-                                 RWSEM_ACTIVE_WRITE_BIAS);
+       rwsem_count_t ret = cmpxchg(&sem->count,
+                                   RWSEM_UNLOCKED_VALUE,
+                                   RWSEM_ACTIVE_WRITE_BIAS);
        if (ret == RWSEM_UNLOCKED_VALUE)
                return 1;
        return 0;
@@ -183,9 +195,9 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
  */
 static inline void __up_read(struct rw_semaphore *sem)
 {
-       __s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
+       rwsem_count_t tmp = -RWSEM_ACTIVE_READ_BIAS;
        asm volatile("# beginning __up_read\n\t"
-                    LOCK_PREFIX "  xadd      %%edx,(%%eax)\n\t"
+                    LOCK_PREFIX "  xadd      %1,(%2)\n\t"
                     /* subtracts 1, returns the old value */
                     "  jns        1f\n\t"
                     "  call call_rwsem_wake\n"
@@ -201,18 +213,18 @@ static inline void __up_read(struct rw_semaphore *sem)
  */
 static inline void __up_write(struct rw_semaphore *sem)
 {
+       rwsem_count_t tmp;
        asm volatile("# beginning __up_write\n\t"
-                    "  movl      %2,%%edx\n\t"
-                    LOCK_PREFIX "  xaddl     %%edx,(%%eax)\n\t"
+                    LOCK_PREFIX "  xadd      %1,(%2)\n\t"
                     /* tries to transition
                        0xffff0001 -> 0x00000000 */
                     "  jz       1f\n"
                     "  call call_rwsem_wake\n"
                     "1:\n\t"
                     "# ending __up_write\n"
-                    : "+m" (sem->count)
-                    : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS)
-                    : "memory", "cc", "edx");
+                    : "+m" (sem->count), "=d" (tmp)
+                    : "a" (sem), "1" (-RWSEM_ACTIVE_WRITE_BIAS)
+                    : "memory", "cc");
 }
 
 /*
@@ -221,33 +233,38 @@ static inline void __up_write(struct rw_semaphore *sem)
 static inline void __downgrade_write(struct rw_semaphore *sem)
 {
        asm volatile("# beginning __downgrade_write\n\t"
-                    LOCK_PREFIX "  addl      %2,(%%eax)\n\t"
-                    /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
+                    LOCK_PREFIX _ASM_ADD "%2,(%1)\n\t"
+                    /*
+                     * transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
+                     *     0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
+                     */
                     "  jns       1f\n\t"
                     "  call call_rwsem_downgrade_wake\n"
                     "1:\n\t"
                     "# ending __downgrade_write\n"
                     : "+m" (sem->count)
-                    : "a" (sem), "i" (-RWSEM_WAITING_BIAS)
+                    : "a" (sem), "er" (-RWSEM_WAITING_BIAS)
                     : "memory", "cc");
 }
 
 /*
  * implement atomic add functionality
  */
-static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
+static inline void rwsem_atomic_add(rwsem_count_t delta,
+                                   struct rw_semaphore *sem)
 {
-       asm volatile(LOCK_PREFIX "addl %1,%0"
+       asm volatile(LOCK_PREFIX _ASM_ADD "%1,%0"
                     : "+m" (sem->count)
-                    : "ir" (delta));
+                    : "er" (delta));
 }
 
 /*
  * implement exchange and add functionality
  */
-static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
+static inline rwsem_count_t rwsem_atomic_update(rwsem_count_t delta,
+                                               struct rw_semaphore *sem)
 {
-       int tmp = delta;
+       rwsem_count_t tmp = delta;
 
        asm volatile(LOCK_PREFIX "xadd %0,%1"
                     : "+r" (tmp), "+m" (sem->count)
index 1e796782cd7b9e606e59f2f5c39b4819fb9131c7..4cfc908240684c561b4554281c36850643fc139f 100644 (file)
@@ -135,6 +135,8 @@ int native_cpu_disable(void);
 void native_cpu_die(unsigned int cpu);
 void native_play_dead(void);
 void play_dead_common(void);
+void wbinvd_on_cpu(int cpu);
+int wbinvd_on_all_cpus(void);
 
 void native_send_call_func_ipi(const struct cpumask *mask);
 void native_send_call_func_single_ipi(int cpu);
@@ -147,6 +149,13 @@ static inline int num_booting_cpus(void)
 {
        return cpumask_weight(cpu_callout_mask);
 }
+#else /* !CONFIG_SMP */
+#define wbinvd_on_cpu(cpu)     wbinvd()
+static inline int wbinvd_on_all_cpus(void)
+{
+       wbinvd();
+       return 0;
+}
 #endif /* CONFIG_SMP */
 
 extern unsigned disabled_cpus __cpuinitdata;
index 35e89122a42f53191bdce81156417b305fe005ac..4dab78edbad9ff7315a8c30aebeb734f4e87da1e 100644 (file)
@@ -3,8 +3,6 @@
 
 extern int kstack_depth_to_print;
 
-int x86_is_stack_id(int id, char *name);
-
 struct thread_info;
 struct stacktrace_ops;
 
index 8d33bc5462d1bd30af43bcb4156fec351149eaa6..c4a348f7bd43de3932f88d0f8ddb5b66a7526863 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/sched.h>
 #include <linux/err.h>
 
+extern const unsigned long sys_call_table[];
+
 /*
  * Only the low 32 bits of orig_ax are meaningful, so we return int.
  * This importantly ignores the high bits on 64-bit, so comparisons
index ecb544e65382893970f2090dd3bb341d03583f4a..e04740f7a0bb2d0343871064ec8b1039b0028b72 100644 (file)
@@ -11,9 +11,9 @@
 #include <linux/irqflags.h>
 
 /* entries in ARCH_DLINFO: */
-#ifdef CONFIG_IA32_EMULATION
+#if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64)
 # define AT_VECTOR_SIZE_ARCH 2
-#else
+#else /* else it's non-compat x86-64 */
 # define AT_VECTOR_SIZE_ARCH 1
 #endif
 
index 375c917c37d2276858979c322dc3e1901c65d900..e0d28901e9691ee53fcd57edf0fa08a6cd5ce8c2 100644 (file)
@@ -87,7 +87,6 @@ struct thread_info {
 #define TIF_NOTSC              16      /* TSC is not accessible in userland */
 #define TIF_IA32               17      /* 32bit process */
 #define TIF_FORK               18      /* ret_from_fork */
-#define TIF_ABI_PENDING                19
 #define TIF_MEMDIE             20
 #define TIF_DEBUG              21      /* uses debug registers */
 #define TIF_IO_BITMAP          22      /* uses I/O bitmap */
@@ -112,7 +111,6 @@ struct thread_info {
 #define _TIF_NOTSC             (1 << TIF_NOTSC)
 #define _TIF_IA32              (1 << TIF_IA32)
 #define _TIF_FORK              (1 << TIF_FORK)
-#define _TIF_ABI_PENDING       (1 << TIF_ABI_PENDING)
 #define _TIF_DEBUG             (1 << TIF_DEBUG)
 #define _TIF_IO_BITMAP         (1 << TIF_IO_BITMAP)
 #define _TIF_FREEZE            (1 << TIF_FREEZE)
index 535e421498f6148ed36adaf698f54a13c58393de..316708d5af92d2c5ecd2f7e22e0bc1852b003d7d 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/errno.h>
 #include <linux/prefetch.h>
 #include <linux/lockdep.h>
+#include <asm/alternative.h>
+#include <asm/cpufeature.h>
 #include <asm/page.h>
 
 /*
 
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 __must_check unsigned long
-copy_user_generic(void *to, const void *from, unsigned len);
+copy_user_generic_string(void *to, const void *from, unsigned len);
+__must_check unsigned long
+copy_user_generic_unrolled(void *to, const void *from, unsigned len);
+
+static __always_inline __must_check unsigned long
+copy_user_generic(void *to, const void *from, unsigned len)
+{
+       unsigned ret;
+
+       alternative_call(copy_user_generic_unrolled,
+                        copy_user_generic_string,
+                        X86_FEATURE_REP_GOOD,
+                        ASM_OUTPUT2("=a" (ret), "=D" (to), "=S" (from),
+                                    "=d" (len)),
+                        "1" (to), "2" (from), "3" (len)
+                        : "memory", "rcx", "r8", "r9", "r10", "r11");
+       return ret;
+}
 
 __must_check unsigned long
 _copy_to_user(void __user *to, const void *from, unsigned len);
index 999873b22e7f4fd9e3531d8a19a47d2e716f96b8..24532c7da3d6d069f01d5be24affcf53dfafa5d4 100644 (file)
@@ -1,5 +1,63 @@
+#ifndef _ASM_X86_USER_H
+#define _ASM_X86_USER_H
+
 #ifdef CONFIG_X86_32
 # include "user_32.h"
 #else
 # include "user_64.h"
 #endif
+
+#include <asm/types.h>
+
+struct user_ymmh_regs {
+       /* 16 * 16 bytes for each YMMH-reg */
+       __u32 ymmh_space[64];
+};
+
+struct user_xsave_hdr {
+       __u64 xstate_bv;
+       __u64 reserved1[2];
+       __u64 reserved2[5];
+};
+
+/*
+ * The structure layout of user_xstateregs, used for exporting the
+ * extended register state through ptrace and core-dump (NT_X86_XSTATE note)
+ * interfaces will be same as the memory layout of xsave used by the processor
+ * (except for the bytes 464..511, which can be used by the software) and hence
+ * the size of this structure varies depending on the features supported by the
+ * processor and OS. The size of the structure that users need to use can be
+ * obtained by doing:
+ *     cpuid_count(0xd, 0, &eax, &ptrace_xstateregs_struct_size, &ecx, &edx);
+ * i.e., cpuid.(eax=0xd,ecx=0).ebx will be the size that user (debuggers, etc.)
+ * need to use.
+ *
+ * For now, only the first 8 bytes of the software usable bytes[464..471] will
+ * be used and will be set to OS enabled xstate mask (which is same as the
+ * 64bit mask returned by the xgetbv's xCR0).  Users (analyzing core dump
+ * remotely, etc.) can use this mask as well as the mask saved in the
+ * xstate_hdr bytes and interpret what states the processor/OS supports
+ * and what states are in modified/initialized conditions for the
+ * particular process/thread.
+ *
+ * Also when the user modifies certain state FP/SSE/etc through the
+ * ptrace interface, they must ensure that the xsave_hdr.xstate_bv
+ * bytes[512..519] of the memory layout are updated correspondingly.
+ * i.e., for example when FP state is modified to a non-init state,
+ * xsave_hdr.xstate_bv's bit 0 must be set to '1', when SSE is modified to
+ * non-init state, xsave_hdr.xstate_bv's bit 1 must to be set to '1', etc.
+ */
+#define USER_XSTATE_FX_SW_WORDS 6
+#define USER_XSTATE_XCR0_WORD  0
+
+struct user_xstateregs {
+       struct {
+               __u64 fpx_space[58];
+               __u64 xstate_fx_sw[USER_XSTATE_FX_SW_WORDS];
+       } i387;
+       struct user_xsave_hdr xsave_hdr;
+       struct user_ymmh_regs ymmh;
+       /* further processor state extensions go here */
+};
+
+#endif /* _ASM_X86_USER_H */
index 2751f3075d8bc746ad548cefe5543960956cc3bd..71605c7d5c5c52989d64a3c9305f58b091cd15eb 100644 (file)
@@ -18,8 +18,8 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
- *  Copyright (c) Russ Anderson
+ *  Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
+ *  Copyright (c) Russ Anderson <rja@sgi.com>
  */
 
 #include <linux/rtc.h>
@@ -36,7 +36,8 @@ enum uv_bios_cmd {
        UV_BIOS_WATCHLIST_ALLOC,
        UV_BIOS_WATCHLIST_FREE,
        UV_BIOS_MEMPROTECT,
-       UV_BIOS_GET_PARTITION_ADDR
+       UV_BIOS_GET_PARTITION_ADDR,
+       UV_BIOS_SET_LEGACY_VGA_TARGET
 };
 
 /*
@@ -89,13 +90,14 @@ extern s64 uv_bios_call(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 extern s64 uv_bios_call_irqsave(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 extern s64 uv_bios_call_reentrant(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 
-extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *);
+extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *, long *);
 extern s64 uv_bios_freq_base(u64, u64 *);
 extern int uv_bios_mq_watchlist_alloc(unsigned long, unsigned int,
                                        unsigned long *);
 extern int uv_bios_mq_watchlist_free(int, int);
 extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
 extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
+extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);
 
 extern void uv_bios_init(void);
 
@@ -104,6 +106,7 @@ extern int uv_type;
 extern long sn_partition_id;
 extern long sn_coherency_id;
 extern long sn_region_size;
+extern long system_serial_number;
 #define partition_coherence_id()       (sn_coherency_id)
 
 extern struct kobject *sgi_uv_kobj;    /* /sys/firmware/sgi_uv */
index c0a01b5d985bec4078e60c1856fcb1c1e7c99376..3bb9491b76590d6d9b5281f43e6e0e0d1ff4ccd2 100644 (file)
@@ -11,6 +11,7 @@ struct mm_struct;
 extern enum uv_system_type get_uv_system_type(void);
 extern int is_uv_system(void);
 extern void uv_cpu_init(void);
+extern void uv_nmi_init(void);
 extern void uv_system_init(void);
 extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
                                                 struct mm_struct *mm,
index bc54fa965af3a053530b85c65852784375d04a51..14cc74ba5d23471c1656812ef61765d4403bb4ed 100644 (file)
@@ -329,7 +329,8 @@ static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset
  */
 static inline unsigned long uv_global_gru_mmr_address(int pnode, unsigned long offset)
 {
-       return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val);
+       return UV_GLOBAL_GRU_MMR_BASE | offset |
+               ((unsigned long)pnode << uv_hub_info->m_val);
 }
 
 static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val)
@@ -495,5 +496,17 @@ static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
        uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
 }
 
+/*
+ * Get the minimum revision number of the hub chips within the partition.
+ *     1 - initial rev 1.0 silicon
+ *     2 - rev 2.0 production silicon
+ */
+static inline int uv_get_min_hub_revision_id(void)
+{
+       extern int uv_min_hub_revision_id;
+
+       return uv_min_hub_revision_id;
+}
+
 #endif /* CONFIG_X86_64 */
 #endif /* _ASM_X86_UV_UV_HUB_H */
index ea0e8ea15e155e6033c34b9ec3bab17f7cc28f9c..60cc3526908377d98fe787f5956cf34c1f2346eb 100644 (file)
@@ -126,6 +126,7 @@ struct x86_cpuinit_ops {
  * @get_wallclock:             get time from HW clock like RTC etc.
  * @set_wallclock:             set time back to HW clock
  * @is_untracked_pat_range     exclude from PAT logic
+ * @nmi_init                   enable NMI on cpus
  */
 struct x86_platform_ops {
        unsigned long (*calibrate_tsc)(void);
@@ -133,6 +134,7 @@ struct x86_platform_ops {
        int (*set_wallclock)(unsigned long nowtime);
        void (*iommu_shutdown)(void);
        bool (*is_untracked_pat_range)(u64 start, u64 end);
+       void (*nmi_init)(void);
 };
 
 extern struct x86_init_ops x86_init;
index 727acc152344b1a28c4cc0fa57d0bc078070cd60..ddc04ccad03b467de69b4b5d189f0a7a06156f82 100644 (file)
 extern unsigned int xstate_size;
 extern u64 pcntxt_mask;
 extern struct xsave_struct *init_xstate_buf;
+extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
 
 extern void xsave_cntxt_init(void);
 extern void xsave_init(void);
+extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
 extern int init_fpu(struct task_struct *child);
 extern int check_for_xstate(struct i387_fxsave_struct __user *buf,
                            void __user *fpstate,
index fb1035cd9a6a9763ddd20fece684228a1239a543..f95703098f8dc9e4b6c0f4e4cd482217783c2d5e 100644 (file)
@@ -49,6 +49,7 @@ EXPORT_SYMBOL(acpi_disabled);
 
 #ifdef CONFIG_X86_64
 # include <asm/proto.h>
+# include <asm/numa_64.h>
 #endif                         /* X86 */
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
@@ -482,6 +483,25 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 
+static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+{
+#ifdef CONFIG_ACPI_NUMA
+       int nid;
+
+       nid = acpi_get_node(handle);
+       if (nid == -1 || !node_online(nid))
+               return;
+#ifdef CONFIG_X86_64
+       apicid_to_node[physid] = nid;
+       numa_set_node(cpu, nid);
+#else /* CONFIG_X86_32 */
+       apicid_2_node[physid] = nid;
+       cpu_to_node_map[cpu] = nid;
+#endif
+
+#endif
+}
+
 static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
 {
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -540,6 +560,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
        }
 
        cpu = cpumask_first(new_map);
+       acpi_map_cpu2node(handle, cpu, physid);
 
        *pcpu = cpu;
        retval = 0;
@@ -1185,9 +1206,6 @@ static void __init acpi_process_madt(void)
                if (!error) {
                        acpi_lapic = 1;
 
-#ifdef CONFIG_X86_BIGSMP
-                       generic_bigsmp_probe();
-#endif
                        /*
                         * Parse MADT IO-APIC entries
                         */
@@ -1197,8 +1215,6 @@ static void __init acpi_process_madt(void)
                                acpi_ioapic = 1;
 
                                smp_found_config = 1;
-                               if (apic->setup_apic_routing)
-                                       apic->setup_apic_routing();
                        }
                }
                if (error == -EINVAL) {
@@ -1347,14 +1363,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                     DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
                     },
         },
-       {
-        .callback = force_acpi_ht,
-        .ident = "ASUS P2B-DS",
-        .matches = {
-                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
-                    DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
-                    },
-        },
        {
         .callback = force_acpi_ht,
         .ident = "ASUS CUR-DLS",
@@ -1529,16 +1537,10 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
  *     if acpi_blacklisted() acpi_disabled = 1;
  *     acpi_irq_model=...
  *     ...
- *
- * return value: (currently ignored)
- *     0: success
- *     !0: failure
  */
 
-int __init acpi_boot_table_init(void)
+void __init acpi_boot_table_init(void)
 {
-       int error;
-
        dmi_check_system(acpi_dmi_table);
 
        /*
@@ -1546,15 +1548,14 @@ int __init acpi_boot_table_init(void)
         * One exception: acpi=ht continues far enough to enumerate LAPICs
         */
        if (acpi_disabled && !acpi_ht)
-               return 1;
+               return
 
        /*
         * Initialize the ACPI boot-time table parser.
         */
-       error = acpi_table_init();
-       if (error) {
+       if (acpi_table_init()) {
                disable_acpi();
-               return error;
+               return;
        }
 
        acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
@@ -1562,18 +1563,15 @@ int __init acpi_boot_table_init(void)
        /*
         * blacklist may disable ACPI entirely
         */
-       error = acpi_blacklisted();
-       if (error) {
+       if (acpi_blacklisted()) {
                if (acpi_force) {
                        printk(KERN_WARNING PREFIX "acpi=force override\n");
                } else {
                        printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
                        disable_acpi();
-                       return error;
+                       return;
                }
        }
-
-       return 0;
 }
 
 int __init early_acpi_boot_init(void)
index de7353c0ce9ca5bbb029e513bd55773a6c2396d5..e6ea0342c8f86e424ae164a479c5b3ffd411e867 100644 (file)
@@ -205,7 +205,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
                                         struct alt_instr *end)
 {
        struct alt_instr *a;
-       char insnbuf[MAX_PATCH_LEN];
+       u8 insnbuf[MAX_PATCH_LEN];
 
        DPRINTK("%s: alt table %p -> %p\n", __func__, start, end);
        for (a = start; a < end; a++) {
@@ -223,6 +223,8 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
                }
 #endif
                memcpy(insnbuf, a->replacement, a->replacementlen);
+               if (*insnbuf == 0xe8 && a->replacementlen == 5)
+                   *(s32 *)(insnbuf + 1) += a->replacement - a->instr;
                add_nops(insnbuf + a->replacementlen,
                         a->instrlen - a->replacementlen);
                text_poke_early(instr, insnbuf, a->instrlen);
@@ -390,6 +392,24 @@ void alternatives_smp_switch(int smp)
        mutex_unlock(&smp_alt);
 }
 
+/* Return 1 if the address range is reserved for smp-alternatives */
+int alternatives_text_reserved(void *start, void *end)
+{
+       struct smp_alt_module *mod;
+       u8 **ptr;
+       u8 *text_start = start;
+       u8 *text_end = end;
+
+       list_for_each_entry(mod, &smp_alt_modules, next) {
+               if (mod->text > text_end || mod->text_end < text_start)
+                       continue;
+               for (ptr = mod->locks; ptr < mod->locks_end; ptr++)
+                       if (text_start <= *ptr && text_end >= *ptr)
+                               return 1;
+       }
+
+       return 0;
+}
 #endif
 
 #ifdef CONFIG_PARAVIRT
index 23824fef789cb458d909b12ffd7e9e9ffe1bc53e..adb0ba025702938b37586c9a8c2999cf68b135dd 100644 (file)
@@ -980,7 +980,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
 {
        int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
        struct amd_iommu *iommu;
-       int i;
+       unsigned long i;
 
 #ifdef CONFIG_IOMMU_STRESS
        populate = false;
@@ -1489,11 +1489,14 @@ static void __detach_device(struct device *dev)
 {
        struct iommu_dev_data *dev_data = get_dev_data(dev);
        struct iommu_dev_data *alias_data;
+       struct protection_domain *domain;
        unsigned long flags;
 
        BUG_ON(!dev_data->domain);
 
-       spin_lock_irqsave(&dev_data->domain->lock, flags);
+       domain = dev_data->domain;
+
+       spin_lock_irqsave(&domain->lock, flags);
 
        if (dev_data->alias != dev) {
                alias_data = get_dev_data(dev_data->alias);
@@ -1504,13 +1507,15 @@ static void __detach_device(struct device *dev)
        if (atomic_dec_and_test(&dev_data->bind))
                do_detach(dev);
 
-       spin_unlock_irqrestore(&dev_data->domain->lock, flags);
+       spin_unlock_irqrestore(&domain->lock, flags);
 
        /*
         * If we run in passthrough mode the device must be assigned to the
-        * passthrough domain if it is detached from any other domain
+        * passthrough domain if it is detached from any other domain.
+        * Make sure we can deassign from the pt_domain itself.
         */
-       if (iommu_pass_through && dev_data->domain == NULL)
+       if (iommu_pass_through &&
+           (dev_data->domain == NULL && domain != pt_domain))
                __attach_device(dev, pt_domain);
 }
 
@@ -2218,6 +2223,12 @@ static struct dma_map_ops amd_iommu_dma_ops = {
 /*
  * The function which clues the AMD IOMMU driver into dma_ops.
  */
+
+void __init amd_iommu_init_api(void)
+{
+       register_iommu(&amd_iommu_ops);
+}
+
 int __init amd_iommu_init_dma_ops(void)
 {
        struct amd_iommu *iommu;
@@ -2253,8 +2264,6 @@ int __init amd_iommu_init_dma_ops(void)
        /* Make the driver finally visible to the drivers */
        dma_ops = &amd_iommu_dma_ops;
 
-       register_iommu(&amd_iommu_ops);
-
        amd_iommu_stats_init();
 
        return 0;
index fb490ce7dd55193b88b6f4d359cbfaa79a26eafe..9dc91b4314703ff6157222bfbecac53329c34372 100644 (file)
@@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void)
                ret = amd_iommu_init_passthrough();
        else
                ret = amd_iommu_init_dma_ops();
+
        if (ret)
                goto free;
 
+       amd_iommu_init_api();
+
        amd_iommu_init_notifier();
 
        enable_iommus();
index 3704997e8b2573bda630720f4c47bd4a7ec3b8c5..f147a95fd84a17646892072e0e929a0fcb1b28f1 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/x86_init.h>
 
 int gart_iommu_aperture;
+EXPORT_SYMBOL_GPL(gart_iommu_aperture);
 int gart_iommu_aperture_disabled __initdata;
 int gart_iommu_aperture_allowed __initdata;
 
index e80f291472a4158535e44ed9afac24f8400453b8..6e29b2a77aa89e113e3605136cf74770317e99aa 100644 (file)
@@ -61,12 +61,6 @@ unsigned int boot_cpu_physical_apicid = -1U;
 
 /*
  * The highest APIC ID seen during enumeration.
- *
- * This determines the messaging protocol we can use: if all APIC IDs
- * are in the 0 ... 7 range, then we can use logical addressing which
- * has some performance advantages (better broadcasting).
- *
- * If there's an APIC ID above 8, we use physical addressing.
  */
 unsigned int max_physical_apicid;
 
@@ -587,7 +581,7 @@ calibrate_by_pmtimer(long deltapm, long *delta, long *deltatsc)
                res = (((u64)(*deltatsc)) * pm_100ms);
                do_div(res, deltapm);
                apic_printk(APIC_VERBOSE, "TSC delta adjusted to "
-                                         "PM-Timer: %lu (%ld) \n",
+                                         "PM-Timer: %lu (%ld)\n",
                                        (unsigned long)res, *deltatsc);
                *deltatsc = (long)res;
        }
@@ -1647,9 +1641,7 @@ int __init APIC_init_uniprocessor(void)
 #endif
 
        enable_IR_x2apic();
-#ifdef CONFIG_X86_64
        default_setup_apic_routing();
-#endif
 
        verify_local_APIC();
        connect_bsp_APIC();
@@ -1897,28 +1889,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
        if (apicid > max_physical_apicid)
                max_physical_apicid = apicid;
 
-#ifdef CONFIG_X86_32
-       /*
-        * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
-        * but we need to work other dependencies like SMP_SUSPEND etc
-        * before this can be done without some confusion.
-        * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
-        *       - Ashok Raj <ashok.raj@intel.com>
-        */
-       if (max_physical_apicid >= 8) {
-               switch (boot_cpu_data.x86_vendor) {
-               case X86_VENDOR_INTEL:
-                       if (!APIC_XAPIC(version)) {
-                               def_to_bigsmp = 0;
-                               break;
-                       }
-                       /* If P4 and above fall through */
-               case X86_VENDOR_AMD:
-                       def_to_bigsmp = 1;
-               }
-       }
-#endif
-
 #if defined(CONFIG_SMP) || defined(CONFIG_X86_64)
        early_per_cpu(x86_cpu_to_apicid, cpu) = apicid;
        early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
index eacbd2b31d27c0b947c3949c2ece59b549c9007a..e3c3d820c325b2cdacd136358efeb31d815b6dd4 100644 (file)
@@ -240,6 +240,11 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
                printk(KERN_DEBUG "system APIC only can use physical flat");
                return 1;
        }
+
+       if (!strncmp(oem_id, "IBM", 3) && !strncmp(oem_table_id, "EXA", 3)) {
+               printk(KERN_DEBUG "IBM Summit detected, will use apic physical");
+               return 1;
+       }
 #endif
 
        return 0;
index 53243ca7816d131ee2821733b722ec0e4d8bd0b3..6bdd2c7ead755827ab67f62e0af854c95b27f485 100644 (file)
@@ -1647,7 +1647,7 @@ __apicdebuginit(void) print_IO_APIC(void)
        printk(KERN_DEBUG ".... IRQ redirection table:\n");
 
        printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
-                         " Stat Dmod Deli Vect:   \n");
+                         " Stat Dmod Deli Vect:\n");
 
        for (i = 0; i <= reg_01.bits.entries; i++) {
                struct IO_APIC_route_entry entry;
index 98c4665f251c8927638e5fa43407a3a45e4bc76d..47dd856708e5c160789253d30dd3f105061bc4b5 100644 (file)
@@ -225,7 +225,7 @@ static void __init smp_read_mpc_oem(struct mpc_table *mpc)
 
        mpc_record = 0;
        printk(KERN_INFO
-               "Found an OEM MPC table at %8p - parsing it ... \n", oemtable);
+               "Found an OEM MPC table at %8p - parsing it...\n", oemtable);
 
        if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) {
                printk(KERN_WARNING
index 1a6559f6768c063af1e31c0a04a4bf60f591b3e4..99d2fe01608420bef1646f206a476ae4a8e3ba26 100644 (file)
@@ -52,7 +52,32 @@ static int __init print_ipi_mode(void)
 }
 late_initcall(print_ipi_mode);
 
-void default_setup_apic_routing(void)
+void __init default_setup_apic_routing(void)
+{
+       int version = apic_version[boot_cpu_physical_apicid];
+
+       if (num_possible_cpus() > 8) {
+               switch (boot_cpu_data.x86_vendor) {
+               case X86_VENDOR_INTEL:
+                       if (!APIC_XAPIC(version)) {
+                               def_to_bigsmp = 0;
+                               break;
+                       }
+                       /* If P4 and above fall through */
+               case X86_VENDOR_AMD:
+                       def_to_bigsmp = 1;
+               }
+       }
+
+#ifdef CONFIG_X86_BIGSMP
+       generic_bigsmp_probe();
+#endif
+
+       if (apic->setup_apic_routing)
+               apic->setup_apic_routing();
+}
+
+static void setup_apic_flat_routing(void)
 {
 #ifdef CONFIG_X86_IO_APIC
        printk(KERN_INFO
@@ -103,7 +128,7 @@ struct apic apic_default = {
        .init_apic_ldr                  = default_init_apic_ldr,
 
        .ioapic_phys_id_map             = default_ioapic_phys_id_map,
-       .setup_apic_routing             = default_setup_apic_routing,
+       .setup_apic_routing             = setup_apic_flat_routing,
        .multi_timer_check              = NULL,
        .apicid_to_node                 = default_apicid_to_node,
        .cpu_to_logical_apicid          = default_cpu_to_logical_apicid,
index 65edc180fc8297be82347bec05e3cd62d155a86d..83e9be4778e2b597791306a85ca9ca527003e2c2 100644 (file)
@@ -64,15 +64,13 @@ void __init default_setup_apic_routing(void)
                        apic = &apic_x2apic_phys;
                else
                        apic = &apic_x2apic_cluster;
-               printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
        }
 #endif
 
-       if (apic == &apic_flat) {
-               if (max_physical_apicid >= 8)
+       if (apic == &apic_flat && num_possible_cpus() > 8)
                        apic = &apic_physflat;
-               printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
-       }
+
+       printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
 
        if (is_vsmp_box()) {
                /* need to update phys_pkg_id */
index 5f92494dab613b9fff4c987b270fed149e4e90f9..3740c8a4eae7d8afa65c86785b2a3004c7dff871 100644 (file)
@@ -5,7 +5,7 @@
  *
  * SGI UV APIC functions (note: not an Intel compatible APIC)
  *
- * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Silicon Graphics, Inc. All rights reserved.
  */
 #include <linux/cpumask.h>
 #include <linux/hardirq.h>
@@ -20,6 +20,8 @@
 #include <linux/cpu.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/pci.h>
+#include <linux/kdebug.h>
 
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
 
 DEFINE_PER_CPU(int, x2apic_extra_bits);
 
+#define PR_DEVEL(fmt, args...) pr_devel("%s: " fmt, __func__, args)
+
 static enum uv_system_type uv_system_type;
 static u64 gru_start_paddr, gru_end_paddr;
+int uv_min_hub_revision_id;
+EXPORT_SYMBOL_GPL(uv_min_hub_revision_id);
+static DEFINE_SPINLOCK(uv_nmi_lock);
 
 static inline bool is_GRU_range(u64 start, u64 end)
 {
@@ -55,20 +62,28 @@ static int early_get_nodeid(void)
        mmr = early_ioremap(UV_LOCAL_MMR_BASE | UVH_NODE_ID, sizeof(*mmr));
        node_id.v = *mmr;
        early_iounmap(mmr, sizeof(*mmr));
+
+       /* Currently, all blades have same revision number */
+       uv_min_hub_revision_id = node_id.s.revision;
+
        return node_id.s.node_id;
 }
 
 static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
+       int nodeid;
+
        if (!strcmp(oem_id, "SGI")) {
+               nodeid = early_get_nodeid();
                x86_platform.is_untracked_pat_range =  uv_is_untracked_pat_range;
+               x86_platform.nmi_init = uv_nmi_init;
                if (!strcmp(oem_table_id, "UVL"))
                        uv_system_type = UV_LEGACY_APIC;
                else if (!strcmp(oem_table_id, "UVX"))
                        uv_system_type = UV_X2APIC;
                else if (!strcmp(oem_table_id, "UVH")) {
                        __get_cpu_var(x2apic_extra_bits) =
-                               early_get_nodeid() << (UV_APIC_PNODE_SHIFT - 1);
+                               nodeid << (UV_APIC_PNODE_SHIFT - 1);
                        uv_system_type = UV_NON_UNIQUE_APIC;
                        return 1;
                }
@@ -374,13 +389,13 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
 
 enum map_type {map_wb, map_uc};
 
-static __init void map_high(char *id, unsigned long base, int shift,
-                           int max_pnode, enum map_type map_type)
+static __init void map_high(char *id, unsigned long base, int pshift,
+                       int bshift, int max_pnode, enum map_type map_type)
 {
        unsigned long bytes, paddr;
 
-       paddr = base << shift;
-       bytes = (1UL << shift) * (max_pnode + 1);
+       paddr = base << pshift;
+       bytes = (1UL << bshift) * (max_pnode + 1);
        printk(KERN_INFO "UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr,
                                                paddr + bytes);
        if (map_type == map_uc)
@@ -396,7 +411,7 @@ static __init void map_gru_high(int max_pnode)
 
        gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
        if (gru.s.enable) {
-               map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
+               map_high("GRU", gru.s.base, shift, shift, max_pnode, map_wb);
                gru_start_paddr = ((u64)gru.s.base << shift);
                gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1);
 
@@ -410,7 +425,7 @@ static __init void map_mmr_high(int max_pnode)
 
        mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR);
        if (mmr.s.enable)
-               map_high("MMR", mmr.s.base, shift, max_pnode, map_uc);
+               map_high("MMR", mmr.s.base, shift, shift, max_pnode, map_uc);
 }
 
 static __init void map_mmioh_high(int max_pnode)
@@ -420,7 +435,8 @@ static __init void map_mmioh_high(int max_pnode)
 
        mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR);
        if (mmioh.s.enable)
-               map_high("MMIOH", mmioh.s.base, shift, max_pnode, map_uc);
+               map_high("MMIOH", mmioh.s.base, shift, mmioh.s.m_io,
+                       max_pnode, map_uc);
 }
 
 static __init void map_low_mmrs(void)
@@ -472,7 +488,7 @@ static void uv_heartbeat(unsigned long ignored)
 
 static void __cpuinit uv_heartbeat_enable(int cpu)
 {
-       if (!uv_cpu_hub_info(cpu)->scir.enabled) {
+       while (!uv_cpu_hub_info(cpu)->scir.enabled) {
                struct timer_list *timer = &uv_cpu_hub_info(cpu)->scir.timer;
 
                uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY);
@@ -480,11 +496,10 @@ static void __cpuinit uv_heartbeat_enable(int cpu)
                timer->expires = jiffies + SCIR_CPU_HB_INTERVAL;
                add_timer_on(timer, cpu);
                uv_cpu_hub_info(cpu)->scir.enabled = 1;
-       }
 
-       /* check boot cpu */
-       if (!uv_cpu_hub_info(0)->scir.enabled)
-               uv_heartbeat_enable(0);
+               /* also ensure that boot cpu is enabled */
+               cpu = 0;
+       }
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -543,6 +558,30 @@ late_initcall(uv_init_heartbeat);
 
 #endif /* !CONFIG_HOTPLUG_CPU */
 
+/* Direct Legacy VGA I/O traffic to designated IOH */
+int uv_set_vga_state(struct pci_dev *pdev, bool decode,
+                     unsigned int command_bits, bool change_bridge)
+{
+       int domain, bus, rc;
+
+       PR_DEVEL("devfn %x decode %d cmd %x chg_brdg %d\n",
+                       pdev->devfn, decode, command_bits, change_bridge);
+
+       if (!change_bridge)
+               return 0;
+
+       if ((command_bits & PCI_COMMAND_IO) == 0)
+               return 0;
+
+       domain = pci_domain_nr(pdev->bus);
+       bus = pdev->bus->number;
+
+       rc = uv_bios_set_legacy_vga_target(decode, domain, bus);
+       PR_DEVEL("vga decode %d %x:%x, rc: %d\n", decode, domain, bus, rc);
+
+       return rc;
+}
+
 /*
  * Called on each cpu to initialize the per_cpu UV data area.
  * FIXME: hotplug not supported yet
@@ -559,6 +598,46 @@ void __cpuinit uv_cpu_init(void)
                set_x2apic_extra_bits(uv_hub_info->pnode);
 }
 
+/*
+ * When NMI is received, print a stack trace.
+ */
+int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
+{
+       if (reason != DIE_NMI_IPI)
+               return NOTIFY_OK;
+       /*
+        * Use a lock so only one cpu prints at a time
+        * to prevent intermixed output.
+        */
+       spin_lock(&uv_nmi_lock);
+       pr_info("NMI stack dump cpu %u:\n", smp_processor_id());
+       dump_stack();
+       spin_unlock(&uv_nmi_lock);
+
+       return NOTIFY_STOP;
+}
+
+static struct notifier_block uv_dump_stack_nmi_nb = {
+       .notifier_call  = uv_handle_nmi
+};
+
+void uv_register_nmi_notifier(void)
+{
+       if (register_die_notifier(&uv_dump_stack_nmi_nb))
+               printk(KERN_WARNING "UV NMI handler failed to register\n");
+}
+
+void uv_nmi_init(void)
+{
+       unsigned int value;
+
+       /*
+        * Unmask NMI on all cpus
+        */
+       value = apic_read(APIC_LVT1) | APIC_DM_NMI;
+       value &= ~APIC_LVT_MASKED;
+       apic_write(APIC_LVT1, value);
+}
 
 void __init uv_system_init(void)
 {
@@ -624,8 +703,8 @@ void __init uv_system_init(void)
        }
 
        uv_bios_init();
-       uv_bios_get_sn_info(0, &uv_type, &sn_partition_id,
-                           &sn_coherency_id, &sn_region_size);
+       uv_bios_get_sn_info(0, &uv_type, &sn_partition_id, &sn_coherency_id,
+                           &sn_region_size, &system_serial_number);
        uv_rtc_init();
 
        for_each_present_cpu(cpu) {
@@ -680,5 +759,9 @@ void __init uv_system_init(void)
 
        uv_cpu_init();
        uv_scir_register_cpu_notifier();
+       uv_register_nmi_notifier();
        proc_mkdir("sgi_uv", NULL);
+
+       /* register Legacy VGA I/O redirection handler */
+       pci_register_set_vga_state(uv_set_vga_state);
 }
index b5b6b23bce537f2b71324013b33f63bde2cf8056..031aa887b0ebae42d98ecfeacb66eeede0a8910a 100644 (file)
@@ -1992,8 +1992,8 @@ static int __init apm_is_horked_d850md(const struct dmi_system_id *d)
                apm_info.disabled = 1;
                printk(KERN_INFO "%s machine detected. "
                       "Disabling APM.\n", d->ident);
-               printk(KERN_INFO "This bug is fixed in bios P15 which is available for \n");
-               printk(KERN_INFO "download from support.intel.com \n");
+               printk(KERN_INFO "This bug is fixed in bios P15 which is available for\n");
+               printk(KERN_INFO "download from support.intel.com\n");
        }
        return 0;
 }
index b0206a211b09db5bb050fdd56775add9bbb80e43..8bc57baaa9ad506d1dc486322f137fae0d858384 100644 (file)
@@ -15,8 +15,8 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
- *  Copyright (c) Russ Anderson
+ *  Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
+ *  Copyright (c) Russ Anderson <rja@sgi.com>
  */
 
 #include <linux/efi.h>
@@ -30,6 +30,7 @@ static struct uv_systab uv_systab;
 s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 {
        struct uv_systab *tab = &uv_systab;
+       s64 ret;
 
        if (!tab->function)
                /*
@@ -37,9 +38,11 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
                 */
                return BIOS_STATUS_UNIMPLEMENTED;
 
-       return efi_call6((void *)__va(tab->function),
-                                       (u64)which, a1, a2, a3, a4, a5);
+       ret = efi_call6((void *)__va(tab->function), (u64)which,
+                       a1, a2, a3, a4, a5);
+       return ret;
 }
+EXPORT_SYMBOL_GPL(uv_bios_call);
 
 s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
                                        u64 a4, u64 a5)
@@ -73,11 +76,14 @@ long sn_coherency_id;
 EXPORT_SYMBOL_GPL(sn_coherency_id);
 long sn_region_size;
 EXPORT_SYMBOL_GPL(sn_region_size);
+long system_serial_number;
+EXPORT_SYMBOL_GPL(system_serial_number);
 int uv_type;
+EXPORT_SYMBOL_GPL(uv_type);
 
 
 s64 uv_bios_get_sn_info(int fc, int *uvtype, long *partid, long *coher,
-               long *region)
+               long *region, long *ssn)
 {
        s64 ret;
        u64 v0, v1;
@@ -97,8 +103,11 @@ s64 uv_bios_get_sn_info(int fc, int *uvtype, long *partid, long *coher,
                *coher = part.coherence_id;
        if (region)
                *region = part.region_size;
+       if (ssn)
+               *ssn = v1;
        return ret;
 }
+EXPORT_SYMBOL_GPL(uv_bios_get_sn_info);
 
 int
 uv_bios_mq_watchlist_alloc(unsigned long addr, unsigned int mq_size,
@@ -154,6 +163,25 @@ s64 uv_bios_freq_base(u64 clock_type, u64 *ticks_per_second)
 }
 EXPORT_SYMBOL_GPL(uv_bios_freq_base);
 
+/*
+ * uv_bios_set_legacy_vga_target - Set Legacy VGA I/O Target
+ * @decode: true to enable target, false to disable target
+ * @domain: PCI domain number
+ * @bus: PCI bus number
+ *
+ * Returns:
+ *    0: Success
+ *    -EINVAL: Invalid domain or bus number
+ *    -ENOSYS: Capability not available
+ *    -EBUSY: Legacy VGA I/O cannot be retargeted at this time
+ */
+int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus)
+{
+       return uv_bios_call(UV_BIOS_SET_LEGACY_VGA_TARGET,
+                               (u64)decode, (u64)domain, (u64)bus, 0, 0);
+}
+EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
+
 
 #ifdef CONFIG_EFI
 void uv_bios_init(void)
@@ -185,4 +213,3 @@ void uv_bios_init(void)
 
 void uv_bios_init(void) { }
 #endif
-
index 1d2cb383410ebef206fb48e2ccecbe8fd03f90ce..c202b62f36719b1c00ca635e75f91e996d55c4e3 100644 (file)
@@ -19,8 +19,6 @@ obj-y                 += vmware.o hypervisor.o sched.o
 obj-$(CONFIG_X86_32)   += bugs.o cmpxchg.o
 obj-$(CONFIG_X86_64)   += bugs_64.o
 
-obj-$(CONFIG_X86_CPU_DEBUG)            += cpu_debug.o
-
 obj-$(CONFIG_CPU_SUP_INTEL)            += intel.o
 obj-$(CONFIG_CPU_SUP_AMD)              += amd.o
 obj-$(CONFIG_CPU_SUP_CYRIX_32)         += cyrix.o
index 468489b57aae6d8d3eefabc0a27358f6e9553112..97ad79cdf688d785e1c34f1aaa053da9804d60c1 100644 (file)
@@ -32,6 +32,10 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
        static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
                { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
                { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 },
+               { X86_FEATURE_NPT,   CR_EDX, 0, 0x8000000a },
+               { X86_FEATURE_LBRV,  CR_EDX, 1, 0x8000000a },
+               { X86_FEATURE_SVML,  CR_EDX, 2, 0x8000000a },
+               { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a },
                { 0, 0, 0, 0 }
        };
 
diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
deleted file mode 100644 (file)
index b368cd8..0000000
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * CPU x86 architecture debug code
- *
- * Copyright(C) 2009 Jaswinder Singh Rajput
- *
- * For licencing details see kernel-base/COPYING
- */
-
-#include <linux/interrupt.h>
-#include <linux/compiler.h>
-#include <linux/seq_file.h>
-#include <linux/debugfs.h>
-#include <linux/kprobes.h>
-#include <linux/uaccess.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/percpu.h>
-#include <linux/signal.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/smp.h>
-
-#include <asm/cpu_debug.h>
-#include <asm/paravirt.h>
-#include <asm/system.h>
-#include <asm/traps.h>
-#include <asm/apic.h>
-#include <asm/desc.h>
-
-static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpud_arr);
-static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], cpud_priv_arr);
-static DEFINE_PER_CPU(int, cpud_priv_count);
-
-static DEFINE_MUTEX(cpu_debug_lock);
-
-static struct dentry *cpu_debugfs_dir;
-
-static struct cpu_debug_base cpu_base[] = {
-       { "mc",         CPU_MC,         0       },
-       { "monitor",    CPU_MONITOR,    0       },
-       { "time",       CPU_TIME,       0       },
-       { "pmc",        CPU_PMC,        1       },
-       { "platform",   CPU_PLATFORM,   0       },
-       { "apic",       CPU_APIC,       0       },
-       { "poweron",    CPU_POWERON,    0       },
-       { "control",    CPU_CONTROL,    0       },
-       { "features",   CPU_FEATURES,   0       },
-       { "lastbranch", CPU_LBRANCH,    0       },
-       { "bios",       CPU_BIOS,       0       },
-       { "freq",       CPU_FREQ,       0       },
-       { "mtrr",       CPU_MTRR,       0       },
-       { "perf",       CPU_PERF,       0       },
-       { "cache",      CPU_CACHE,      0       },
-       { "sysenter",   CPU_SYSENTER,   0       },
-       { "therm",      CPU_THERM,      0       },
-       { "misc",       CPU_MISC,       0       },
-       { "debug",      CPU_DEBUG,      0       },
-       { "pat",        CPU_PAT,        0       },
-       { "vmx",        CPU_VMX,        0       },
-       { "call",       CPU_CALL,       0       },
-       { "base",       CPU_BASE,       0       },
-       { "ver",        CPU_VER,        0       },
-       { "conf",       CPU_CONF,       0       },
-       { "smm",        CPU_SMM,        0       },
-       { "svm",        CPU_SVM,        0       },
-       { "osvm",       CPU_OSVM,       0       },
-       { "tss",        CPU_TSS,        0       },
-       { "cr",         CPU_CR,         0       },
-       { "dt",         CPU_DT,         0       },
-       { "registers",  CPU_REG_ALL,    0       },
-};
-
-static struct cpu_file_base cpu_file[] = {
-       { "index",      CPU_REG_ALL,    0       },
-       { "value",      CPU_REG_ALL,    1       },
-};
-
-/* CPU Registers Range */
-static struct cpu_debug_range cpu_reg_range[] = {
-       { 0x00000000, 0x00000001, CPU_MC,       },
-       { 0x00000006, 0x00000007, CPU_MONITOR,  },
-       { 0x00000010, 0x00000010, CPU_TIME,     },
-       { 0x00000011, 0x00000013, CPU_PMC,      },
-       { 0x00000017, 0x00000017, CPU_PLATFORM, },
-       { 0x0000001B, 0x0000001B, CPU_APIC,     },
-       { 0x0000002A, 0x0000002B, CPU_POWERON,  },
-       { 0x0000002C, 0x0000002C, CPU_FREQ,     },
-       { 0x0000003A, 0x0000003A, CPU_CONTROL,  },
-       { 0x00000040, 0x00000047, CPU_LBRANCH,  },
-       { 0x00000060, 0x00000067, CPU_LBRANCH,  },
-       { 0x00000079, 0x00000079, CPU_BIOS,     },
-       { 0x00000088, 0x0000008A, CPU_CACHE,    },
-       { 0x0000008B, 0x0000008B, CPU_BIOS,     },
-       { 0x0000009B, 0x0000009B, CPU_MONITOR,  },
-       { 0x000000C1, 0x000000C4, CPU_PMC,      },
-       { 0x000000CD, 0x000000CD, CPU_FREQ,     },
-       { 0x000000E7, 0x000000E8, CPU_PERF,     },
-       { 0x000000FE, 0x000000FE, CPU_MTRR,     },
-
-       { 0x00000116, 0x0000011E, CPU_CACHE,    },
-       { 0x00000174, 0x00000176, CPU_SYSENTER, },
-       { 0x00000179, 0x0000017B, CPU_MC,       },
-       { 0x00000186, 0x00000189, CPU_PMC,      },
-       { 0x00000198, 0x00000199, CPU_PERF,     },
-       { 0x0000019A, 0x0000019A, CPU_TIME,     },
-       { 0x0000019B, 0x0000019D, CPU_THERM,    },
-       { 0x000001A0, 0x000001A0, CPU_MISC,     },
-       { 0x000001C9, 0x000001C9, CPU_LBRANCH,  },
-       { 0x000001D7, 0x000001D8, CPU_LBRANCH,  },
-       { 0x000001D9, 0x000001D9, CPU_DEBUG,    },
-       { 0x000001DA, 0x000001E0, CPU_LBRANCH,  },
-
-       { 0x00000200, 0x0000020F, CPU_MTRR,     },
-       { 0x00000250, 0x00000250, CPU_MTRR,     },
-       { 0x00000258, 0x00000259, CPU_MTRR,     },
-       { 0x00000268, 0x0000026F, CPU_MTRR,     },
-       { 0x00000277, 0x00000277, CPU_PAT,      },
-       { 0x000002FF, 0x000002FF, CPU_MTRR,     },
-
-       { 0x00000300, 0x00000311, CPU_PMC,      },
-       { 0x00000345, 0x00000345, CPU_PMC,      },
-       { 0x00000360, 0x00000371, CPU_PMC,      },
-       { 0x0000038D, 0x00000390, CPU_PMC,      },
-       { 0x000003A0, 0x000003BE, CPU_PMC,      },
-       { 0x000003C0, 0x000003CD, CPU_PMC,      },
-       { 0x000003E0, 0x000003E1, CPU_PMC,      },
-       { 0x000003F0, 0x000003F2, CPU_PMC,      },
-
-       { 0x00000400, 0x00000417, CPU_MC,       },
-       { 0x00000480, 0x0000048B, CPU_VMX,      },
-
-       { 0x00000600, 0x00000600, CPU_DEBUG,    },
-       { 0x00000680, 0x0000068F, CPU_LBRANCH,  },
-       { 0x000006C0, 0x000006CF, CPU_LBRANCH,  },
-
-       { 0x000107CC, 0x000107D3, CPU_PMC,      },
-
-       { 0xC0000080, 0xC0000080, CPU_FEATURES, },
-       { 0xC0000081, 0xC0000084, CPU_CALL,     },
-       { 0xC0000100, 0xC0000102, CPU_BASE,     },
-       { 0xC0000103, 0xC0000103, CPU_TIME,     },
-
-       { 0xC0010000, 0xC0010007, CPU_PMC,      },
-       { 0xC0010010, 0xC0010010, CPU_CONF,     },
-       { 0xC0010015, 0xC0010015, CPU_CONF,     },
-       { 0xC0010016, 0xC001001A, CPU_MTRR,     },
-       { 0xC001001D, 0xC001001D, CPU_MTRR,     },
-       { 0xC001001F, 0xC001001F, CPU_CONF,     },
-       { 0xC0010030, 0xC0010035, CPU_BIOS,     },
-       { 0xC0010044, 0xC0010048, CPU_MC,       },
-       { 0xC0010050, 0xC0010056, CPU_SMM,      },
-       { 0xC0010058, 0xC0010058, CPU_CONF,     },
-       { 0xC0010060, 0xC0010060, CPU_CACHE,    },
-       { 0xC0010061, 0xC0010068, CPU_SMM,      },
-       { 0xC0010069, 0xC001006B, CPU_SMM,      },
-       { 0xC0010070, 0xC0010071, CPU_SMM,      },
-       { 0xC0010111, 0xC0010113, CPU_SMM,      },
-       { 0xC0010114, 0xC0010118, CPU_SVM,      },
-       { 0xC0010140, 0xC0010141, CPU_OSVM,     },
-       { 0xC0011022, 0xC0011023, CPU_CONF,     },
-};
-
-static int is_typeflag_valid(unsigned cpu, unsigned flag)
-{
-       int i;
-
-       /* Standard Registers should be always valid */
-       if (flag >= CPU_TSS)
-               return 1;
-
-       for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
-               if (cpu_reg_range[i].flag == flag)
-                       return 1;
-       }
-
-       /* Invalid */
-       return 0;
-}
-
-static unsigned get_cpu_range(unsigned cpu, unsigned *min, unsigned *max,
-                             int index, unsigned flag)
-{
-       if (cpu_reg_range[index].flag == flag) {
-               *min = cpu_reg_range[index].min;
-               *max = cpu_reg_range[index].max;
-       } else
-               *max = 0;
-
-       return *max;
-}
-
-/* This function can also be called with seq = NULL for printk */
-static void print_cpu_data(struct seq_file *seq, unsigned type,
-                          u32 low, u32 high)
-{
-       struct cpu_private *priv;
-       u64 val = high;
-
-       if (seq) {
-               priv = seq->private;
-               if (priv->file) {
-                       val = (val << 32) | low;
-                       seq_printf(seq, "0x%llx\n", val);
-               } else
-                       seq_printf(seq, " %08x: %08x_%08x\n",
-                                  type, high, low);
-       } else
-               printk(KERN_INFO " %08x: %08x_%08x\n", type, high, low);
-}
-
-/* This function can also be called with seq = NULL for printk */
-static void print_msr(struct seq_file *seq, unsigned cpu, unsigned flag)
-{
-       unsigned msr, msr_min, msr_max;
-       struct cpu_private *priv;
-       u32 low, high;
-       int i;
-
-       if (seq) {
-               priv = seq->private;
-               if (priv->file) {
-                       if (!rdmsr_safe_on_cpu(priv->cpu, priv->reg,
-                                              &low, &high))
-                               print_cpu_data(seq, priv->reg, low, high);
-                       return;
-               }
-       }
-
-       for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
-               if (!get_cpu_range(cpu, &msr_min, &msr_max, i, flag))
-                       continue;
-
-               for (msr = msr_min; msr <= msr_max; msr++) {
-                       if (rdmsr_safe_on_cpu(cpu, msr, &low, &high))
-                               continue;
-                       print_cpu_data(seq, msr, low, high);
-               }
-       }
-}
-
-static void print_tss(void *arg)
-{
-       struct pt_regs *regs = task_pt_regs(current);
-       struct seq_file *seq = arg;
-       unsigned int seg;
-
-       seq_printf(seq, " RAX\t: %016lx\n", regs->ax);
-       seq_printf(seq, " RBX\t: %016lx\n", regs->bx);
-       seq_printf(seq, " RCX\t: %016lx\n", regs->cx);
-       seq_printf(seq, " RDX\t: %016lx\n", regs->dx);
-
-       seq_printf(seq, " RSI\t: %016lx\n", regs->si);
-       seq_printf(seq, " RDI\t: %016lx\n", regs->di);
-       seq_printf(seq, " RBP\t: %016lx\n", regs->bp);
-       seq_printf(seq, " ESP\t: %016lx\n", regs->sp);
-
-#ifdef CONFIG_X86_64
-       seq_printf(seq, " R08\t: %016lx\n", regs->r8);
-       seq_printf(seq, " R09\t: %016lx\n", regs->r9);
-       seq_printf(seq, " R10\t: %016lx\n", regs->r10);
-       seq_printf(seq, " R11\t: %016lx\n", regs->r11);
-       seq_printf(seq, " R12\t: %016lx\n", regs->r12);
-       seq_printf(seq, " R13\t: %016lx\n", regs->r13);
-       seq_printf(seq, " R14\t: %016lx\n", regs->r14);
-       seq_printf(seq, " R15\t: %016lx\n", regs->r15);
-#endif
-
-       asm("movl %%cs,%0" : "=r" (seg));
-       seq_printf(seq, " CS\t:             %04x\n", seg);
-       asm("movl %%ds,%0" : "=r" (seg));
-       seq_printf(seq, " DS\t:             %04x\n", seg);
-       seq_printf(seq, " SS\t:             %04lx\n", regs->ss & 0xffff);
-       asm("movl %%es,%0" : "=r" (seg));
-       seq_printf(seq, " ES\t:             %04x\n", seg);
-       asm("movl %%fs,%0" : "=r" (seg));
-       seq_printf(seq, " FS\t:             %04x\n", seg);
-       asm("movl %%gs,%0" : "=r" (seg));
-       seq_printf(seq, " GS\t:             %04x\n", seg);
-
-       seq_printf(seq, " EFLAGS\t: %016lx\n", regs->flags);
-
-       seq_printf(seq, " EIP\t: %016lx\n", regs->ip);
-}
-
-static void print_cr(void *arg)
-{
-       struct seq_file *seq = arg;
-
-       seq_printf(seq, " cr0\t: %016lx\n", read_cr0());
-       seq_printf(seq, " cr2\t: %016lx\n", read_cr2());
-       seq_printf(seq, " cr3\t: %016lx\n", read_cr3());
-       seq_printf(seq, " cr4\t: %016lx\n", read_cr4_safe());
-#ifdef CONFIG_X86_64
-       seq_printf(seq, " cr8\t: %016lx\n", read_cr8());
-#endif
-}
-
-static void print_desc_ptr(char *str, struct seq_file *seq, struct desc_ptr dt)
-{
-       seq_printf(seq, " %s\t: %016llx\n", str, (u64)(dt.address | dt.size));
-}
-
-static void print_dt(void *seq)
-{
-       struct desc_ptr dt;
-       unsigned long ldt;
-
-       /* IDT */
-       store_idt((struct desc_ptr *)&dt);
-       print_desc_ptr("IDT", seq, dt);
-
-       /* GDT */
-       store_gdt((struct desc_ptr *)&dt);
-       print_desc_ptr("GDT", seq, dt);
-
-       /* LDT */
-       store_ldt(ldt);
-       seq_printf(seq, " LDT\t: %016lx\n", ldt);
-
-       /* TR */
-       store_tr(ldt);
-       seq_printf(seq, " TR\t: %016lx\n", ldt);
-}
-
-static void print_dr(void *arg)
-{
-       struct seq_file *seq = arg;
-       unsigned long dr;
-       int i;
-
-       for (i = 0; i < 8; i++) {
-               /* Ignore db4, db5 */
-               if ((i == 4) || (i == 5))
-                       continue;
-               get_debugreg(dr, i);
-               seq_printf(seq, " dr%d\t: %016lx\n", i, dr);
-       }
-
-       seq_printf(seq, "\n MSR\t:\n");
-}
-
-static void print_apic(void *arg)
-{
-       struct seq_file *seq = arg;
-
-#ifdef CONFIG_X86_LOCAL_APIC
-       seq_printf(seq, " LAPIC\t:\n");
-       seq_printf(seq, " ID\t\t: %08x\n",  apic_read(APIC_ID) >> 24);
-       seq_printf(seq, " LVR\t\t: %08x\n",  apic_read(APIC_LVR));
-       seq_printf(seq, " TASKPRI\t: %08x\n",  apic_read(APIC_TASKPRI));
-       seq_printf(seq, " ARBPRI\t\t: %08x\n",  apic_read(APIC_ARBPRI));
-       seq_printf(seq, " PROCPRI\t: %08x\n",  apic_read(APIC_PROCPRI));
-       seq_printf(seq, " LDR\t\t: %08x\n",  apic_read(APIC_LDR));
-       seq_printf(seq, " DFR\t\t: %08x\n",  apic_read(APIC_DFR));
-       seq_printf(seq, " SPIV\t\t: %08x\n",  apic_read(APIC_SPIV));
-       seq_printf(seq, " ISR\t\t: %08x\n",  apic_read(APIC_ISR));
-       seq_printf(seq, " ESR\t\t: %08x\n",  apic_read(APIC_ESR));
-       seq_printf(seq, " ICR\t\t: %08x\n",  apic_read(APIC_ICR));
-       seq_printf(seq, " ICR2\t\t: %08x\n",  apic_read(APIC_ICR2));
-       seq_printf(seq, " LVTT\t\t: %08x\n",  apic_read(APIC_LVTT));
-       seq_printf(seq, " LVTTHMR\t: %08x\n",  apic_read(APIC_LVTTHMR));
-       seq_printf(seq, " LVTPC\t\t: %08x\n",  apic_read(APIC_LVTPC));
-       seq_printf(seq, " LVT0\t\t: %08x\n",  apic_read(APIC_LVT0));
-       seq_printf(seq, " LVT1\t\t: %08x\n",  apic_read(APIC_LVT1));
-       seq_printf(seq, " LVTERR\t\t: %08x\n",  apic_read(APIC_LVTERR));
-       seq_printf(seq, " TMICT\t\t: %08x\n",  apic_read(APIC_TMICT));
-       seq_printf(seq, " TMCCT\t\t: %08x\n",  apic_read(APIC_TMCCT));
-       seq_printf(seq, " TDCR\t\t: %08x\n",  apic_read(APIC_TDCR));
-       if (boot_cpu_has(X86_FEATURE_EXTAPIC)) {
-               unsigned int i, v, maxeilvt;
-
-               v = apic_read(APIC_EFEAT);
-               maxeilvt = (v >> 16) & 0xff;
-               seq_printf(seq, " EFEAT\t\t: %08x\n", v);
-               seq_printf(seq, " ECTRL\t\t: %08x\n", apic_read(APIC_ECTRL));
-
-               for (i = 0; i < maxeilvt; i++) {
-                       v = apic_read(APIC_EILVTn(i));
-                       seq_printf(seq, " EILVT%d\t\t: %08x\n", i, v);
-               }
-       }
-#endif /* CONFIG_X86_LOCAL_APIC */
-       seq_printf(seq, "\n MSR\t:\n");
-}
-
-static int cpu_seq_show(struct seq_file *seq, void *v)
-{
-       struct cpu_private *priv = seq->private;
-
-       if (priv == NULL)
-               return -EINVAL;
-
-       switch (cpu_base[priv->type].flag) {
-       case CPU_TSS:
-               smp_call_function_single(priv->cpu, print_tss, seq, 1);
-               break;
-       case CPU_CR:
-               smp_call_function_single(priv->cpu, print_cr, seq, 1);
-               break;
-       case CPU_DT:
-               smp_call_function_single(priv->cpu, print_dt, seq, 1);
-               break;
-       case CPU_DEBUG:
-               if (priv->file == CPU_INDEX_BIT)
-                       smp_call_function_single(priv->cpu, print_dr, seq, 1);
-               print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
-               break;
-       case CPU_APIC:
-               if (priv->file == CPU_INDEX_BIT)
-                       smp_call_function_single(priv->cpu, print_apic, seq, 1);
-               print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
-               break;
-
-       default:
-               print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
-               break;
-       }
-       seq_printf(seq, "\n");
-
-       return 0;
-}
-
-static void *cpu_seq_start(struct seq_file *seq, loff_t *pos)
-{
-       if (*pos == 0) /* One time is enough ;-) */
-               return seq;
-
-       return NULL;
-}
-
-static void *cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
-{
-       (*pos)++;
-
-       return cpu_seq_start(seq, pos);
-}
-
-static void cpu_seq_stop(struct seq_file *seq, void *v)
-{
-}
-
-static const struct seq_operations cpu_seq_ops = {
-       .start          = cpu_seq_start,
-       .next           = cpu_seq_next,
-       .stop           = cpu_seq_stop,
-       .show           = cpu_seq_show,
-};
-
-static int cpu_seq_open(struct inode *inode, struct file *file)
-{
-       struct cpu_private *priv = inode->i_private;
-       struct seq_file *seq;
-       int err;
-
-       err = seq_open(file, &cpu_seq_ops);
-       if (!err) {
-               seq = file->private_data;
-               seq->private = priv;
-       }
-
-       return err;
-}
-
-static int write_msr(struct cpu_private *priv, u64 val)
-{
-       u32 low, high;
-
-       high = (val >> 32) & 0xffffffff;
-       low = val & 0xffffffff;
-
-       if (!wrmsr_safe_on_cpu(priv->cpu, priv->reg, low, high))
-               return 0;
-
-       return -EPERM;
-}
-
-static int write_cpu_register(struct cpu_private *priv, const char *buf)
-{
-       int ret = -EPERM;
-       u64 val;
-
-       ret = strict_strtoull(buf, 0, &val);
-       if (ret < 0)
-               return ret;
-
-       /* Supporting only MSRs */
-       if (priv->type < CPU_TSS_BIT)
-               return write_msr(priv, val);
-
-       return ret;
-}
-
-static ssize_t cpu_write(struct file *file, const char __user *ubuf,
-                            size_t count, loff_t *off)
-{
-       struct seq_file *seq = file->private_data;
-       struct cpu_private *priv = seq->private;
-       char buf[19];
-
-       if ((priv == NULL) || (count >= sizeof(buf)))
-               return -EINVAL;
-
-       if (copy_from_user(&buf, ubuf, count))
-               return -EFAULT;
-
-       buf[count] = 0;
-
-       if ((cpu_base[priv->type].write) && (cpu_file[priv->file].write))
-               if (!write_cpu_register(priv, buf))
-                       return count;
-
-       return -EACCES;
-}
-
-static const struct file_operations cpu_fops = {
-       .owner          = THIS_MODULE,
-       .open           = cpu_seq_open,
-       .read           = seq_read,
-       .write          = cpu_write,
-       .llseek         = seq_lseek,
-       .release        = seq_release,
-};
-
-static int cpu_create_file(unsigned cpu, unsigned type, unsigned reg,
-                          unsigned file, struct dentry *dentry)
-{
-       struct cpu_private *priv = NULL;
-
-       /* Already intialized */
-       if (file == CPU_INDEX_BIT)
-               if (per_cpu(cpud_arr[type].init, cpu))
-                       return 0;
-
-       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-       if (priv == NULL)
-               return -ENOMEM;
-
-       priv->cpu = cpu;
-       priv->type = type;
-       priv->reg = reg;
-       priv->file = file;
-       mutex_lock(&cpu_debug_lock);
-       per_cpu(cpud_priv_arr[type], cpu) = priv;
-       per_cpu(cpud_priv_count, cpu)++;
-       mutex_unlock(&cpu_debug_lock);
-
-       if (file)
-               debugfs_create_file(cpu_file[file].name, S_IRUGO,
-                                   dentry, (void *)priv, &cpu_fops);
-       else {
-               debugfs_create_file(cpu_base[type].name, S_IRUGO,
-                                   per_cpu(cpud_arr[type].dentry, cpu),
-                                   (void *)priv, &cpu_fops);
-               mutex_lock(&cpu_debug_lock);
-               per_cpu(cpud_arr[type].init, cpu) = 1;
-               mutex_unlock(&cpu_debug_lock);
-       }
-
-       return 0;
-}
-
-static int cpu_init_regfiles(unsigned cpu, unsigned int type, unsigned reg,
-                            struct dentry *dentry)
-{
-       unsigned file;
-       int err = 0;
-
-       for (file = 0; file <  ARRAY_SIZE(cpu_file); file++) {
-               err = cpu_create_file(cpu, type, reg, file, dentry);
-               if (err)
-                       return err;
-       }
-
-       return err;
-}
-
-static int cpu_init_msr(unsigned cpu, unsigned type, struct dentry *dentry)
-{
-       struct dentry *cpu_dentry = NULL;
-       unsigned reg, reg_min, reg_max;
-       int i, err = 0;
-       char reg_dir[12];
-       u32 low, high;
-
-       for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
-               if (!get_cpu_range(cpu, &reg_min, &reg_max, i,
-                                  cpu_base[type].flag))
-                       continue;
-
-               for (reg = reg_min; reg <= reg_max; reg++) {
-                       if (rdmsr_safe_on_cpu(cpu, reg, &low, &high))
-                               continue;
-
-                       sprintf(reg_dir, "0x%x", reg);
-                       cpu_dentry = debugfs_create_dir(reg_dir, dentry);
-                       err = cpu_init_regfiles(cpu, type, reg, cpu_dentry);
-                       if (err)
-                               return err;
-               }
-       }
-
-       return err;
-}
-
-static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
-{
-       struct dentry *cpu_dentry = NULL;
-       unsigned type;
-       int err = 0;
-
-       for (type = 0; type <  ARRAY_SIZE(cpu_base) - 1; type++) {
-               if (!is_typeflag_valid(cpu, cpu_base[type].flag))
-                       continue;
-               cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry);
-               per_cpu(cpud_arr[type].dentry, cpu) = cpu_dentry;
-
-               if (type < CPU_TSS_BIT)
-                       err = cpu_init_msr(cpu, type, cpu_dentry);
-               else
-                       err = cpu_create_file(cpu, type, 0, CPU_INDEX_BIT,
-                                             cpu_dentry);
-               if (err)
-                       return err;
-       }
-
-       return err;
-}
-
-static int cpu_init_cpu(void)
-{
-       struct dentry *cpu_dentry = NULL;
-       struct cpuinfo_x86 *cpui;
-       char cpu_dir[12];
-       unsigned cpu;
-       int err = 0;
-
-       for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
-               cpui = &cpu_data(cpu);
-               if (!cpu_has(cpui, X86_FEATURE_MSR))
-                       continue;
-
-               sprintf(cpu_dir, "cpu%d", cpu);
-               cpu_dentry = debugfs_create_dir(cpu_dir, cpu_debugfs_dir);
-               err = cpu_init_allreg(cpu, cpu_dentry);
-
-               pr_info("cpu%d(%d) debug files %d\n",
-                       cpu, nr_cpu_ids, per_cpu(cpud_priv_count, cpu));
-               if (per_cpu(cpud_priv_count, cpu) > MAX_CPU_FILES) {
-                       pr_err("Register files count %d exceeds limit %d\n",
-                               per_cpu(cpud_priv_count, cpu), MAX_CPU_FILES);
-                       per_cpu(cpud_priv_count, cpu) = MAX_CPU_FILES;
-                       err = -ENFILE;
-               }
-               if (err)
-                       return err;
-       }
-
-       return err;
-}
-
-static int __init cpu_debug_init(void)
-{
-       cpu_debugfs_dir = debugfs_create_dir("cpu", arch_debugfs_dir);
-
-       return cpu_init_cpu();
-}
-
-static void __exit cpu_debug_exit(void)
-{
-       int i, cpu;
-
-       if (cpu_debugfs_dir)
-               debugfs_remove_recursive(cpu_debugfs_dir);
-
-       for (cpu = 0; cpu <  nr_cpu_ids; cpu++)
-               for (i = 0; i < per_cpu(cpud_priv_count, cpu); i++)
-                       kfree(per_cpu(cpud_priv_arr[i], cpu));
-}
-
-module_init(cpu_debug_init);
-module_exit(cpu_debug_exit);
-
-MODULE_AUTHOR("Jaswinder Singh Rajput");
-MODULE_DESCRIPTION("CPU Debug module");
-MODULE_LICENSE("GPL");
index f125e5c551c0db827d33110dfd0d25688053e3c7..6e44519960c8f6413c3f0f54ba85ed591f172e81 100644 (file)
@@ -1356,6 +1356,7 @@ static int __devexit powernowk8_cpu_exit(struct cpufreq_policy *pol)
 
        kfree(data->powernow_table);
        kfree(data);
+       per_cpu(powernow_data, pol->cpu) = NULL;
 
        return 0;
 }
@@ -1375,7 +1376,7 @@ static unsigned int powernowk8_get(unsigned int cpu)
        int err;
 
        if (!data)
-               return -EINVAL;
+               return 0;
 
        smp_call_function_single(cpu, query_values_on_cpu, &err, true);
        if (err)
index fc6c8ef92dcc5f0bd9c846b2597f0463e50209af..eddb1bdd1b8f8e2aedc51360d401eeabe9f9592d 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/processor.h>
 #include <linux/smp.h>
 #include <asm/k8.h>
+#include <asm/smp.h>
 
 #define LVL_1_INST     1
 #define LVL_1_DATA     2
@@ -31,6 +32,8 @@ struct _cache_table {
        short size;
 };
 
+#define MB(x)  ((x) * 1024)
+
 /* All the cache descriptor types we care about (no TLB or
    trace cache entries) */
 
@@ -44,9 +47,9 @@ static const struct _cache_table __cpuinitconst cache_table[] =
        { 0x0d, LVL_1_DATA, 16 },       /* 4-way set assoc, 64 byte line size */
        { 0x21, LVL_2,      256 },      /* 8-way set assoc, 64 byte line size */
        { 0x22, LVL_3,      512 },      /* 4-way set assoc, sectored cache, 64 byte line size */
-       { 0x23, LVL_3,      1024 },     /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x25, LVL_3,      2048 },     /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x29, LVL_3,      4096 },     /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x23, LVL_3,      MB(1) },    /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x25, LVL_3,      MB(2) },    /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x29, LVL_3,      MB(4) },    /* 8-way set assoc, sectored cache, 64 byte line size */
        { 0x2c, LVL_1_DATA, 32 },       /* 8-way set assoc, 64 byte line size */
        { 0x30, LVL_1_INST, 32 },       /* 8-way set assoc, 64 byte line size */
        { 0x39, LVL_2,      128 },      /* 4-way set assoc, sectored cache, 64 byte line size */
@@ -59,16 +62,16 @@ static const struct _cache_table __cpuinitconst cache_table[] =
        { 0x41, LVL_2,      128 },      /* 4-way set assoc, 32 byte line size */
        { 0x42, LVL_2,      256 },      /* 4-way set assoc, 32 byte line size */
        { 0x43, LVL_2,      512 },      /* 4-way set assoc, 32 byte line size */
-       { 0x44, LVL_2,      1024 },     /* 4-way set assoc, 32 byte line size */
-       { 0x45, LVL_2,      2048 },     /* 4-way set assoc, 32 byte line size */
-       { 0x46, LVL_3,      4096 },     /* 4-way set assoc, 64 byte line size */
-       { 0x47, LVL_3,      8192 },     /* 8-way set assoc, 64 byte line size */
-       { 0x49, LVL_3,      4096 },     /* 16-way set assoc, 64 byte line size */
-       { 0x4a, LVL_3,      6144 },     /* 12-way set assoc, 64 byte line size */
-       { 0x4b, LVL_3,      8192 },     /* 16-way set assoc, 64 byte line size */
-       { 0x4c, LVL_3,     12288 },     /* 12-way set assoc, 64 byte line size */
-       { 0x4d, LVL_3,     16384 },     /* 16-way set assoc, 64 byte line size */
-       { 0x4e, LVL_2,      6144 },     /* 24-way set assoc, 64 byte line size */
+       { 0x44, LVL_2,      MB(1) },    /* 4-way set assoc, 32 byte line size */
+       { 0x45, LVL_2,      MB(2) },    /* 4-way set assoc, 32 byte line size */
+       { 0x46, LVL_3,      MB(4) },    /* 4-way set assoc, 64 byte line size */
+       { 0x47, LVL_3,      MB(8) },    /* 8-way set assoc, 64 byte line size */
+       { 0x49, LVL_3,      MB(4) },    /* 16-way set assoc, 64 byte line size */
+       { 0x4a, LVL_3,      MB(6) },    /* 12-way set assoc, 64 byte line size */
+       { 0x4b, LVL_3,      MB(8) },    /* 16-way set assoc, 64 byte line size */
+       { 0x4c, LVL_3,      MB(12) },   /* 12-way set assoc, 64 byte line size */
+       { 0x4d, LVL_3,      MB(16) },   /* 16-way set assoc, 64 byte line size */
+       { 0x4e, LVL_2,      MB(6) },    /* 24-way set assoc, 64 byte line size */
        { 0x60, LVL_1_DATA, 16 },       /* 8-way set assoc, sectored cache, 64 byte line size */
        { 0x66, LVL_1_DATA, 8 },        /* 4-way set assoc, sectored cache, 64 byte line size */
        { 0x67, LVL_1_DATA, 16 },       /* 4-way set assoc, sectored cache, 64 byte line size */
@@ -77,34 +80,34 @@ static const struct _cache_table __cpuinitconst cache_table[] =
        { 0x71, LVL_TRACE,  16 },       /* 8-way set assoc */
        { 0x72, LVL_TRACE,  32 },       /* 8-way set assoc */
        { 0x73, LVL_TRACE,  64 },       /* 8-way set assoc */
-       { 0x78, LVL_2,    1024 },       /* 4-way set assoc, 64 byte line size */
-       { 0x79, LVL_2,     128 },       /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x7a, LVL_2,     256 },       /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x7b, LVL_2,     512 },       /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x7c, LVL_2,    1024 },       /* 8-way set assoc, sectored cache, 64 byte line size */
-       { 0x7d, LVL_2,    2048 },       /* 8-way set assoc, 64 byte line size */
-       { 0x7f, LVL_2,     512 },       /* 2-way set assoc, 64 byte line size */
-       { 0x82, LVL_2,     256 },       /* 8-way set assoc, 32 byte line size */
-       { 0x83, LVL_2,     512 },       /* 8-way set assoc, 32 byte line size */
-       { 0x84, LVL_2,    1024 },       /* 8-way set assoc, 32 byte line size */
-       { 0x85, LVL_2,    2048 },       /* 8-way set assoc, 32 byte line size */
-       { 0x86, LVL_2,     512 },       /* 4-way set assoc, 64 byte line size */
-       { 0x87, LVL_2,    1024 },       /* 8-way set assoc, 64 byte line size */
-       { 0xd0, LVL_3,     512 },       /* 4-way set assoc, 64 byte line size */
-       { 0xd1, LVL_3,    1024 },       /* 4-way set assoc, 64 byte line size */
-       { 0xd2, LVL_3,    2048 },       /* 4-way set assoc, 64 byte line size */
-       { 0xd6, LVL_3,    1024 },       /* 8-way set assoc, 64 byte line size */
-       { 0xd7, LVL_3,    2048 },       /* 8-way set assoc, 64 byte line size */
-       { 0xd8, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
-       { 0xdc, LVL_3,    2048 },       /* 12-way set assoc, 64 byte line size */
-       { 0xdd, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
-       { 0xde, LVL_3,    8192 },       /* 12-way set assoc, 64 byte line size */
-       { 0xe2, LVL_3,    2048 },       /* 16-way set assoc, 64 byte line size */
-       { 0xe3, LVL_3,    4096 },       /* 16-way set assoc, 64 byte line size */
-       { 0xe4, LVL_3,    8192 },       /* 16-way set assoc, 64 byte line size */
-       { 0xea, LVL_3,    12288 },      /* 24-way set assoc, 64 byte line size */
-       { 0xeb, LVL_3,    18432 },      /* 24-way set assoc, 64 byte line size */
-       { 0xec, LVL_3,    24576 },      /* 24-way set assoc, 64 byte line size */
+       { 0x78, LVL_2,      MB(1) },    /* 4-way set assoc, 64 byte line size */
+       { 0x79, LVL_2,      128 },      /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x7a, LVL_2,      256 },      /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x7b, LVL_2,      512 },      /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x7c, LVL_2,      MB(1) },    /* 8-way set assoc, sectored cache, 64 byte line size */
+       { 0x7d, LVL_2,      MB(2) },    /* 8-way set assoc, 64 byte line size */
+       { 0x7f, LVL_2,      512 },      /* 2-way set assoc, 64 byte line size */
+       { 0x82, LVL_2,      256 },      /* 8-way set assoc, 32 byte line size */
+       { 0x83, LVL_2,      512 },      /* 8-way set assoc, 32 byte line size */
+       { 0x84, LVL_2,      MB(1) },    /* 8-way set assoc, 32 byte line size */
+       { 0x85, LVL_2,      MB(2) },    /* 8-way set assoc, 32 byte line size */
+       { 0x86, LVL_2,      512 },      /* 4-way set assoc, 64 byte line size */
+       { 0x87, LVL_2,      MB(1) },    /* 8-way set assoc, 64 byte line size */
+       { 0xd0, LVL_3,      512 },      /* 4-way set assoc, 64 byte line size */
+       { 0xd1, LVL_3,      MB(1) },    /* 4-way set assoc, 64 byte line size */
+       { 0xd2, LVL_3,      MB(2) },    /* 4-way set assoc, 64 byte line size */
+       { 0xd6, LVL_3,      MB(1) },    /* 8-way set assoc, 64 byte line size */
+       { 0xd7, LVL_3,      MB(2) },    /* 8-way set assoc, 64 byte line size */
+       { 0xd8, LVL_3,      MB(4) },    /* 12-way set assoc, 64 byte line size */
+       { 0xdc, LVL_3,      MB(2) },    /* 12-way set assoc, 64 byte line size */
+       { 0xdd, LVL_3,      MB(4) },    /* 12-way set assoc, 64 byte line size */
+       { 0xde, LVL_3,      MB(8) },    /* 12-way set assoc, 64 byte line size */
+       { 0xe2, LVL_3,      MB(2) },    /* 16-way set assoc, 64 byte line size */
+       { 0xe3, LVL_3,      MB(4) },    /* 16-way set assoc, 64 byte line size */
+       { 0xe4, LVL_3,      MB(8) },    /* 16-way set assoc, 64 byte line size */
+       { 0xea, LVL_3,      MB(12) },   /* 24-way set assoc, 64 byte line size */
+       { 0xeb, LVL_3,      MB(18) },   /* 24-way set assoc, 64 byte line size */
+       { 0xec, LVL_3,      MB(24) },   /* 24-way set assoc, 64 byte line size */
        { 0x00, 0, 0}
 };
 
@@ -150,7 +153,8 @@ struct _cpuid4_info {
        union _cpuid4_leaf_ebx ebx;
        union _cpuid4_leaf_ecx ecx;
        unsigned long size;
-       unsigned long can_disable;
+       bool can_disable;
+       unsigned int l3_indices;
        DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
 };
 
@@ -160,7 +164,8 @@ struct _cpuid4_info_regs {
        union _cpuid4_leaf_ebx ebx;
        union _cpuid4_leaf_ecx ecx;
        unsigned long size;
-       unsigned long can_disable;
+       bool can_disable;
+       unsigned int l3_indices;
 };
 
 unsigned short                 num_cache_leaves;
@@ -290,6 +295,36 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
                (ebx->split.ways_of_associativity + 1) - 1;
 }
 
+struct _cache_attr {
+       struct attribute attr;
+       ssize_t (*show)(struct _cpuid4_info *, char *);
+       ssize_t (*store)(struct _cpuid4_info *, const char *, size_t count);
+};
+
+#ifdef CONFIG_CPU_SUP_AMD
+static unsigned int __cpuinit amd_calc_l3_indices(void)
+{
+       /*
+        * We're called over smp_call_function_single() and therefore
+        * are on the correct cpu.
+        */
+       int cpu = smp_processor_id();
+       int node = cpu_to_node(cpu);
+       struct pci_dev *dev = node_to_k8_nb_misc(node);
+       unsigned int sc0, sc1, sc2, sc3;
+       u32 val = 0;
+
+       pci_read_config_dword(dev, 0x1C4, &val);
+
+       /* calculate subcache sizes */
+       sc0 = !(val & BIT(0));
+       sc1 = !(val & BIT(4));
+       sc2 = !(val & BIT(8))  + !(val & BIT(9));
+       sc3 = !(val & BIT(12)) + !(val & BIT(13));
+
+       return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1;
+}
+
 static void __cpuinit
 amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
 {
@@ -299,12 +334,103 @@ amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
        if (boot_cpu_data.x86 == 0x11)
                return;
 
-       /* see erratum #382 */
-       if ((boot_cpu_data.x86 == 0x10) && (boot_cpu_data.x86_model < 0x8))
+       /* see errata #382 and #388 */
+       if ((boot_cpu_data.x86 == 0x10) &&
+           ((boot_cpu_data.x86_model < 0x8) ||
+            (boot_cpu_data.x86_mask  < 0x1)))
                return;
 
-       this_leaf->can_disable = 1;
+       this_leaf->can_disable = true;
+       this_leaf->l3_indices  = amd_calc_l3_indices();
+}
+
+static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf,
+                                 unsigned int index)
+{
+       int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
+       int node = amd_get_nb_id(cpu);
+       struct pci_dev *dev = node_to_k8_nb_misc(node);
+       unsigned int reg = 0;
+
+       if (!this_leaf->can_disable)
+               return -EINVAL;
+
+       if (!dev)
+               return -EINVAL;
+
+       pci_read_config_dword(dev, 0x1BC + index * 4, &reg);
+       return sprintf(buf, "0x%08x\n", reg);
+}
+
+#define SHOW_CACHE_DISABLE(index)                                      \
+static ssize_t                                                         \
+show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf)  \
+{                                                                      \
+       return show_cache_disable(this_leaf, buf, index);               \
 }
+SHOW_CACHE_DISABLE(0)
+SHOW_CACHE_DISABLE(1)
+
+static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
+       const char *buf, size_t count, unsigned int index)
+{
+       int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
+       int node = amd_get_nb_id(cpu);
+       struct pci_dev *dev = node_to_k8_nb_misc(node);
+       unsigned long val = 0;
+
+#define SUBCACHE_MASK  (3UL << 20)
+#define SUBCACHE_INDEX 0xfff
+
+       if (!this_leaf->can_disable)
+               return -EINVAL;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       if (!dev)
+               return -EINVAL;
+
+       if (strict_strtoul(buf, 10, &val) < 0)
+               return -EINVAL;
+
+       /* do not allow writes outside of allowed bits */
+       if ((val & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) ||
+           ((val & SUBCACHE_INDEX) > this_leaf->l3_indices))
+               return -EINVAL;
+
+       val |= BIT(30);
+       pci_write_config_dword(dev, 0x1BC + index * 4, val);
+       /*
+        * We need to WBINVD on a core on the node containing the L3 cache which
+        * indices we disable therefore a simple wbinvd() is not sufficient.
+        */
+       wbinvd_on_cpu(cpu);
+       pci_write_config_dword(dev, 0x1BC + index * 4, val | BIT(31));
+       return count;
+}
+
+#define STORE_CACHE_DISABLE(index)                                     \
+static ssize_t                                                         \
+store_cache_disable_##index(struct _cpuid4_info *this_leaf,            \
+                           const char *buf, size_t count)              \
+{                                                                      \
+       return store_cache_disable(this_leaf, buf, count, index);       \
+}
+STORE_CACHE_DISABLE(0)
+STORE_CACHE_DISABLE(1)
+
+static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644,
+               show_cache_disable_0, store_cache_disable_0);
+static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
+               show_cache_disable_1, store_cache_disable_1);
+
+#else  /* CONFIG_CPU_SUP_AMD */
+static void __cpuinit
+amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
+{
+};
+#endif /* CONFIG_CPU_SUP_AMD */
 
 static int
 __cpuinit cpuid4_cache_lookup_regs(int index,
@@ -711,82 +837,6 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf)
 #define to_object(k)   container_of(k, struct _index_kobject, kobj)
 #define to_attr(a)     container_of(a, struct _cache_attr, attr)
 
-static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf,
-                                 unsigned int index)
-{
-       int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
-       int node = cpu_to_node(cpu);
-       struct pci_dev *dev = node_to_k8_nb_misc(node);
-       unsigned int reg = 0;
-
-       if (!this_leaf->can_disable)
-               return -EINVAL;
-
-       if (!dev)
-               return -EINVAL;
-
-       pci_read_config_dword(dev, 0x1BC + index * 4, &reg);
-       return sprintf(buf, "%x\n", reg);
-}
-
-#define SHOW_CACHE_DISABLE(index)                                      \
-static ssize_t                                                         \
-show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf)          \
-{                                                                      \
-       return show_cache_disable(this_leaf, buf, index);               \
-}
-SHOW_CACHE_DISABLE(0)
-SHOW_CACHE_DISABLE(1)
-
-static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
-       const char *buf, size_t count, unsigned int index)
-{
-       int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
-       int node = cpu_to_node(cpu);
-       struct pci_dev *dev = node_to_k8_nb_misc(node);
-       unsigned long val = 0;
-       unsigned int scrubber = 0;
-
-       if (!this_leaf->can_disable)
-               return -EINVAL;
-
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-
-       if (!dev)
-               return -EINVAL;
-
-       if (strict_strtoul(buf, 10, &val) < 0)
-               return -EINVAL;
-
-       val |= 0xc0000000;
-
-       pci_read_config_dword(dev, 0x58, &scrubber);
-       scrubber &= ~0x1f000000;
-       pci_write_config_dword(dev, 0x58, scrubber);
-
-       pci_write_config_dword(dev, 0x1BC + index * 4, val & ~0x40000000);
-       wbinvd();
-       pci_write_config_dword(dev, 0x1BC + index * 4, val);
-       return count;
-}
-
-#define STORE_CACHE_DISABLE(index)                                     \
-static ssize_t                                                         \
-store_cache_disable_##index(struct _cpuid4_info *this_leaf,            \
-                           const char *buf, size_t count)              \
-{                                                                      \
-       return store_cache_disable(this_leaf, buf, count, index);       \
-}
-STORE_CACHE_DISABLE(0)
-STORE_CACHE_DISABLE(1)
-
-struct _cache_attr {
-       struct attribute attr;
-       ssize_t (*show)(struct _cpuid4_info *, char *);
-       ssize_t (*store)(struct _cpuid4_info *, const char *, size_t count);
-};
-
 #define define_one_ro(_name) \
 static struct _cache_attr _name = \
        __ATTR(_name, 0444, show_##_name, NULL)
@@ -801,23 +851,28 @@ define_one_ro(size);
 define_one_ro(shared_cpu_map);
 define_one_ro(shared_cpu_list);
 
-static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644,
-               show_cache_disable_0, store_cache_disable_0);
-static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
-               show_cache_disable_1, store_cache_disable_1);
+#define DEFAULT_SYSFS_CACHE_ATTRS      \
+       &type.attr,                     \
+       &level.attr,                    \
+       &coherency_line_size.attr,      \
+       &physical_line_partition.attr,  \
+       &ways_of_associativity.attr,    \
+       &number_of_sets.attr,           \
+       &size.attr,                     \
+       &shared_cpu_map.attr,           \
+       &shared_cpu_list.attr
 
 static struct attribute *default_attrs[] = {
-       &type.attr,
-       &level.attr,
-       &coherency_line_size.attr,
-       &physical_line_partition.attr,
-       &ways_of_associativity.attr,
-       &number_of_sets.attr,
-       &size.attr,
-       &shared_cpu_map.attr,
-       &shared_cpu_list.attr,
+       DEFAULT_SYSFS_CACHE_ATTRS,
+       NULL
+};
+
+static struct attribute *default_l3_attrs[] = {
+       DEFAULT_SYSFS_CACHE_ATTRS,
+#ifdef CONFIG_CPU_SUP_AMD
        &cache_disable_0.attr,
        &cache_disable_1.attr,
+#endif
        NULL
 };
 
@@ -908,6 +963,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
        unsigned int cpu = sys_dev->id;
        unsigned long i, j;
        struct _index_kobject *this_object;
+       struct _cpuid4_info   *this_leaf;
        int retval;
 
        retval = cpuid4_cache_sysfs_init(cpu);
@@ -926,6 +982,14 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
                this_object = INDEX_KOBJECT_PTR(cpu, i);
                this_object->cpu = cpu;
                this_object->index = i;
+
+               this_leaf = CPUID4_INFO_IDX(cpu, i);
+
+               if (this_leaf->can_disable)
+                       ktype_cache.default_attrs = default_l3_attrs;
+               else
+                       ktype_cache.default_attrs = default_attrs;
+
                retval = kobject_init_and_add(&(this_object->kobj),
                                              &ktype_cache,
                                              per_cpu(ici_cache_kobject, cpu),
index f4361b56f8e92efab75d05b1f361f1416d9aec03..ad9e5ed8118137de9a8a8c3398e5b2adc27c2fe8 100644 (file)
@@ -1,3 +1,3 @@
-obj-y          := main.o if.o generic.o state.o cleanup.o
+obj-y          := main.o if.o generic.o cleanup.o
 obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
 
index 33af14110dfdde4d3af4a01fb4bbdc2c2055d162..92ba9cd31c9a4fa0dd7d0cfbf48bb397b2e9e7bf 100644 (file)
@@ -108,7 +108,7 @@ amd_validate_add_page(unsigned long base, unsigned long size, unsigned int type)
        return 0;
 }
 
-static struct mtrr_ops amd_mtrr_ops = {
+static const struct mtrr_ops amd_mtrr_ops = {
        .vendor            = X86_VENDOR_AMD,
        .set               = amd_set_mtrr,
        .get               = amd_get_mtrr,
index de89f14eff3a5f91f615624a2a82880a7694e6d4..316fe3e60a9764e479d4e49d01346c7921763ee8 100644 (file)
@@ -110,7 +110,7 @@ centaur_validate_add_page(unsigned long base, unsigned long size, unsigned int t
        return 0;
 }
 
-static struct mtrr_ops centaur_mtrr_ops = {
+static const struct mtrr_ops centaur_mtrr_ops = {
        .vendor            = X86_VENDOR_CENTAUR,
        .set               = centaur_set_mcr,
        .get               = centaur_get_mcr,
index 228d982ce09ce524ef84100380e95a7a70f6f6d0..68a3343e57980a4149a00a4f9d609b69b67eba35 100644 (file)
@@ -265,7 +265,7 @@ static void cyrix_set_all(void)
        post_set();
 }
 
-static struct mtrr_ops cyrix_mtrr_ops = {
+static const struct mtrr_ops cyrix_mtrr_ops = {
        .vendor            = X86_VENDOR_CYRIX,
        .set_all           = cyrix_set_all,
        .set               = cyrix_set_arr,
index 55da0c5f68dd9957510281e87718c2c4f3ca6b51..9aa5dc76ff4a156304a3c864776c3665628004e4 100644 (file)
@@ -464,7 +464,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
                tmp |= ~((1<<(hi - 1)) - 1);
 
                if (tmp != mask_lo) {
-                       WARN_ONCE(1, KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
+                       printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n");
                        mask_lo = tmp;
                }
        }
@@ -570,7 +570,7 @@ static unsigned long set_mtrr_state(void)
 
 
 static unsigned long cr4;
-static DEFINE_SPINLOCK(set_atomicity_lock);
+static DEFINE_RAW_SPINLOCK(set_atomicity_lock);
 
 /*
  * Since we are disabling the cache don't allow any interrupts,
@@ -590,7 +590,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
         * changes to the way the kernel boots
         */
 
-       spin_lock(&set_atomicity_lock);
+       raw_spin_lock(&set_atomicity_lock);
 
        /* Enter the no-fill (CD=1, NW=0) cache mode and flush caches. */
        cr0 = read_cr0() | X86_CR0_CD;
@@ -627,7 +627,7 @@ static void post_set(void) __releases(set_atomicity_lock)
        /* Restore value of CR4 */
        if (cpu_has_pge)
                write_cr4(cr4);
-       spin_unlock(&set_atomicity_lock);
+       raw_spin_unlock(&set_atomicity_lock);
 }
 
 static void generic_set_all(void)
@@ -752,7 +752,7 @@ int positive_have_wrcomb(void)
 /*
  * Generic structure...
  */
-struct mtrr_ops generic_mtrr_ops = {
+const struct mtrr_ops generic_mtrr_ops = {
        .use_intel_if           = 1,
        .set_all                = generic_set_all,
        .get                    = generic_get_mtrr,
index 84e83de54575c5a1da65e77feabd3c8b240ac95e..fe4622e8c837ec7be504b84efb52da9ae0ca82ae 100644 (file)
@@ -60,14 +60,14 @@ static DEFINE_MUTEX(mtrr_mutex);
 u64 size_or_mask, size_and_mask;
 static bool mtrr_aps_delayed_init;
 
-static struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM];
+static const struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM];
 
-struct mtrr_ops *mtrr_if;
+const struct mtrr_ops *mtrr_if;
 
 static void set_mtrr(unsigned int reg, unsigned long base,
                     unsigned long size, mtrr_type type);
 
-void set_mtrr_ops(struct mtrr_ops *ops)
+void set_mtrr_ops(const struct mtrr_ops *ops)
 {
        if (ops->vendor && ops->vendor < X86_VENDOR_NUM)
                mtrr_ops[ops->vendor] = ops;
index a501dee9a87a1b07513647c9c6c4d79684b8883b..df5e41f31a27e71cd44aadd35cf43f311b437008 100644 (file)
@@ -32,7 +32,7 @@ extern int generic_get_free_region(unsigned long base, unsigned long size,
 extern int generic_validate_add_page(unsigned long base, unsigned long size,
                                     unsigned int type);
 
-extern struct mtrr_ops generic_mtrr_ops;
+extern const struct mtrr_ops generic_mtrr_ops;
 
 extern int positive_have_wrcomb(void);
 
@@ -53,10 +53,10 @@ void fill_mtrr_var_range(unsigned int index,
                u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
 void get_mtrr_state(void);
 
-extern void set_mtrr_ops(struct mtrr_ops *ops);
+extern void set_mtrr_ops(const struct mtrr_ops *ops);
 
 extern u64 size_or_mask, size_and_mask;
-extern struct mtrr_ops *mtrr_if;
+extern const struct mtrr_ops *mtrr_if;
 
 #define is_cpu(vnd)    (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
 #define use_intel()    (mtrr_if && mtrr_if->use_intel_if == 1)
diff --git a/arch/x86/kernel/cpu/mtrr/state.c b/arch/x86/kernel/cpu/mtrr/state.c
deleted file mode 100644 (file)
index dfc80b4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/mm.h>
-
-#include <asm/processor-cyrix.h>
-#include <asm/processor-flags.h>
-#include <asm/mtrr.h>
-#include <asm/msr.h>
-
-#include "mtrr.h"
-
-/* Put the processor into a state where MTRRs can be safely set */
-void set_mtrr_prepare_save(struct set_mtrr_context *ctxt)
-{
-       unsigned int cr0;
-
-       /* Disable interrupts locally */
-       local_irq_save(ctxt->flags);
-
-       if (use_intel() || is_cpu(CYRIX)) {
-
-               /* Save value of CR4 and clear Page Global Enable (bit 7) */
-               if (cpu_has_pge) {
-                       ctxt->cr4val = read_cr4();
-                       write_cr4(ctxt->cr4val & ~X86_CR4_PGE);
-               }
-
-               /*
-                * Disable and flush caches. Note that wbinvd flushes the TLBs
-                * as a side-effect
-                */
-               cr0 = read_cr0() | X86_CR0_CD;
-               wbinvd();
-               write_cr0(cr0);
-               wbinvd();
-
-               if (use_intel()) {
-                       /* Save MTRR state */
-                       rdmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi);
-               } else {
-                       /*
-                        * Cyrix ARRs -
-                        * everything else were excluded at the top
-                        */
-                       ctxt->ccr3 = getCx86(CX86_CCR3);
-               }
-       }
-}
-
-void set_mtrr_cache_disable(struct set_mtrr_context *ctxt)
-{
-       if (use_intel()) {
-               /* Disable MTRRs, and set the default type to uncached */
-               mtrr_wrmsr(MSR_MTRRdefType, ctxt->deftype_lo & 0xf300UL,
-                     ctxt->deftype_hi);
-       } else {
-               if (is_cpu(CYRIX)) {
-                       /* Cyrix ARRs - everything else were excluded at the top */
-                       setCx86(CX86_CCR3, (ctxt->ccr3 & 0x0f) | 0x10);
-               }
-       }
-}
-
-/* Restore the processor after a set_mtrr_prepare */
-void set_mtrr_done(struct set_mtrr_context *ctxt)
-{
-       if (use_intel() || is_cpu(CYRIX)) {
-
-               /* Flush caches and TLBs */
-               wbinvd();
-
-               /* Restore MTRRdefType */
-               if (use_intel()) {
-                       /* Intel (P6) standard MTRRs */
-                       mtrr_wrmsr(MSR_MTRRdefType, ctxt->deftype_lo,
-                                  ctxt->deftype_hi);
-               } else {
-                       /*
-                        * Cyrix ARRs -
-                        * everything else was excluded at the top
-                        */
-                       setCx86(CX86_CCR3, ctxt->ccr3);
-               }
-
-               /* Enable caches */
-               write_cr0(read_cr0() & 0xbfffffff);
-
-               /* Restore value of CR4 */
-               if (cpu_has_pge)
-                       write_cr4(ctxt->cr4val);
-       }
-       /* Re-enable interrupts locally (if enabled previously) */
-       local_irq_restore(ctxt->flags);
-}
index d616c06e99b4098f9836b28ecd200194bfcd1445..641ccb9dddbc9d2cce6fad3065796b447ec950e9 100644 (file)
@@ -7,6 +7,7 @@
  *  Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter
  *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
  *  Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com>
+ *  Copyright (C) 2009 Google, Inc., Stephane Eranian
  *
  *  For licencing details see kernel-base/COPYING
  */
@@ -22,6 +23,7 @@
 #include <linux/uaccess.h>
 #include <linux/highmem.h>
 #include <linux/cpu.h>
+#include <linux/bitops.h>
 
 #include <asm/apic.h>
 #include <asm/stacktrace.h>
@@ -68,26 +70,59 @@ struct debug_store {
        u64     pebs_event_reset[MAX_PEBS_EVENTS];
 };
 
+struct event_constraint {
+       union {
+               unsigned long   idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
+               u64             idxmsk64[1];
+       };
+       int     code;
+       int     cmask;
+       int     weight;
+};
+
+struct amd_nb {
+       int nb_id;  /* NorthBridge id */
+       int refcnt; /* reference count */
+       struct perf_event *owners[X86_PMC_IDX_MAX];
+       struct event_constraint event_constraints[X86_PMC_IDX_MAX];
+};
+
 struct cpu_hw_events {
-       struct perf_event       *events[X86_PMC_IDX_MAX];
-       unsigned long           used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
+       struct perf_event       *events[X86_PMC_IDX_MAX]; /* in counter order */
        unsigned long           active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
        unsigned long           interrupts;
        int                     enabled;
        struct debug_store      *ds;
-};
 
-struct event_constraint {
-       unsigned long   idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
-       int             code;
+       int                     n_events;
+       int                     n_added;
+       int                     assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
+       u64                     tags[X86_PMC_IDX_MAX];
+       struct perf_event       *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
+       struct amd_nb           *amd_nb;
 };
 
-#define EVENT_CONSTRAINT(c, m) { .code = (c), .idxmsk[0] = (m) }
-#define EVENT_CONSTRAINT_END  { .code = 0, .idxmsk[0] = 0 }
+#define __EVENT_CONSTRAINT(c, n, m, w) {\
+       { .idxmsk64[0] = (n) },         \
+       .code = (c),                    \
+       .cmask = (m),                   \
+       .weight = (w),                  \
+}
+
+#define EVENT_CONSTRAINT(c, n, m)      \
+       __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
+
+#define INTEL_EVENT_CONSTRAINT(c, n)   \
+       EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVTSEL_MASK)
 
-#define for_each_event_constraint(e, c) \
-       for ((e) = (c); (e)->idxmsk[0]; (e)++)
+#define FIXED_EVENT_CONSTRAINT(c, n)   \
+       EVENT_CONSTRAINT(c, n, INTEL_ARCH_FIXED_MASK)
 
+#define EVENT_CONSTRAINT_END           \
+       EVENT_CONSTRAINT(0, 0, 0)
+
+#define for_each_event_constraint(e, c)        \
+       for ((e) = (c); (e)->cmask; (e)++)
 
 /*
  * struct x86_pmu - generic x86 pmu
@@ -114,8 +149,14 @@ struct x86_pmu {
        u64             intel_ctrl;
        void            (*enable_bts)(u64 config);
        void            (*disable_bts)(void);
-       int             (*get_event_idx)(struct cpu_hw_events *cpuc,
-                                        struct hw_perf_event *hwc);
+
+       struct event_constraint *
+                       (*get_event_constraints)(struct cpu_hw_events *cpuc,
+                                                struct perf_event *event);
+
+       void            (*put_event_constraints)(struct cpu_hw_events *cpuc,
+                                                struct perf_event *event);
+       struct event_constraint *event_constraints;
 };
 
 static struct x86_pmu x86_pmu __read_mostly;
@@ -124,111 +165,8 @@ static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
        .enabled = 1,
 };
 
-static const struct event_constraint *event_constraints;
-
-/*
- * Not sure about some of these
- */
-static const u64 p6_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]           = 0x0079,
-  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x0f2e,
-  [PERF_COUNT_HW_CACHE_MISSES]         = 0x012e,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
-  [PERF_COUNT_HW_BUS_CYCLES]           = 0x0062,
-};
-
-static u64 p6_pmu_event_map(int hw_event)
-{
-       return p6_perfmon_event_map[hw_event];
-}
-
-/*
- * Event setting that is specified not to count anything.
- * We use this to effectively disable a counter.
- *
- * L2_RQSTS with 0 MESI unit mask.
- */
-#define P6_NOP_EVENT                   0x0000002EULL
-
-static u64 p6_pmu_raw_event(u64 hw_event)
-{
-#define P6_EVNTSEL_EVENT_MASK          0x000000FFULL
-#define P6_EVNTSEL_UNIT_MASK           0x0000FF00ULL
-#define P6_EVNTSEL_EDGE_MASK           0x00040000ULL
-#define P6_EVNTSEL_INV_MASK            0x00800000ULL
-#define P6_EVNTSEL_REG_MASK            0xFF000000ULL
-
-#define P6_EVNTSEL_MASK                        \
-       (P6_EVNTSEL_EVENT_MASK |        \
-        P6_EVNTSEL_UNIT_MASK  |        \
-        P6_EVNTSEL_EDGE_MASK  |        \
-        P6_EVNTSEL_INV_MASK   |        \
-        P6_EVNTSEL_REG_MASK)
-
-       return hw_event & P6_EVNTSEL_MASK;
-}
-
-static const struct event_constraint intel_p6_event_constraints[] =
-{
-       EVENT_CONSTRAINT(0xc1, 0x1),    /* FLOPS */
-       EVENT_CONSTRAINT(0x10, 0x1),    /* FP_COMP_OPS_EXE */
-       EVENT_CONSTRAINT(0x11, 0x1),    /* FP_ASSIST */
-       EVENT_CONSTRAINT(0x12, 0x2),    /* MUL */
-       EVENT_CONSTRAINT(0x13, 0x2),    /* DIV */
-       EVENT_CONSTRAINT(0x14, 0x1),    /* CYCLES_DIV_BUSY */
-       EVENT_CONSTRAINT_END
-};
-
-/*
- * Intel PerfMon v3. Used on Core2 and later.
- */
-static const u64 intel_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]           = 0x003c,
-  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x4f2e,
-  [PERF_COUNT_HW_CACHE_MISSES]         = 0x412e,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
-  [PERF_COUNT_HW_BUS_CYCLES]           = 0x013c,
-};
-
-static const struct event_constraint intel_core_event_constraints[] =
-{
-       EVENT_CONSTRAINT(0x10, 0x1),    /* FP_COMP_OPS_EXE */
-       EVENT_CONSTRAINT(0x11, 0x2),    /* FP_ASSIST */
-       EVENT_CONSTRAINT(0x12, 0x2),    /* MUL */
-       EVENT_CONSTRAINT(0x13, 0x2),    /* DIV */
-       EVENT_CONSTRAINT(0x14, 0x1),    /* CYCLES_DIV_BUSY */
-       EVENT_CONSTRAINT(0x18, 0x1),    /* IDLE_DURING_DIV */
-       EVENT_CONSTRAINT(0x19, 0x2),    /* DELAYED_BYPASS */
-       EVENT_CONSTRAINT(0xa1, 0x1),    /* RS_UOPS_DISPATCH_CYCLES */
-       EVENT_CONSTRAINT(0xcb, 0x1),    /* MEM_LOAD_RETIRED */
-       EVENT_CONSTRAINT_END
-};
-
-static const struct event_constraint intel_nehalem_event_constraints[] =
-{
-       EVENT_CONSTRAINT(0x40, 0x3),    /* L1D_CACHE_LD */
-       EVENT_CONSTRAINT(0x41, 0x3),    /* L1D_CACHE_ST */
-       EVENT_CONSTRAINT(0x42, 0x3),    /* L1D_CACHE_LOCK */
-       EVENT_CONSTRAINT(0x43, 0x3),    /* L1D_ALL_REF */
-       EVENT_CONSTRAINT(0x4e, 0x3),    /* L1D_PREFETCH */
-       EVENT_CONSTRAINT(0x4c, 0x3),    /* LOAD_HIT_PRE */
-       EVENT_CONSTRAINT(0x51, 0x3),    /* L1D */
-       EVENT_CONSTRAINT(0x52, 0x3),    /* L1D_CACHE_PREFETCH_LOCK_FB_HIT */
-       EVENT_CONSTRAINT(0x53, 0x3),    /* L1D_CACHE_LOCK_FB_HIT */
-       EVENT_CONSTRAINT(0xc5, 0x3),    /* CACHE_LOCK_CYCLES */
-       EVENT_CONSTRAINT_END
-};
-
-static u64 intel_pmu_event_map(int hw_event)
-{
-       return intel_perfmon_event_map[hw_event];
-}
+static int x86_perf_event_set_period(struct perf_event *event,
+                            struct hw_perf_event *hwc, int idx);
 
 /*
  * Generalized hw caching related hw_event table, filled
@@ -245,424 +183,6 @@ static u64 __read_mostly hw_cache_event_ids
                                [PERF_COUNT_HW_CACHE_OP_MAX]
                                [PERF_COUNT_HW_CACHE_RESULT_MAX];
 
-static __initconst u64 nehalem_hw_cache_event_ids
-                               [PERF_COUNT_HW_CACHE_MAX]
-                               [PERF_COUNT_HW_CACHE_OP_MAX]
-                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
-{
- [ C(L1D) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI            */
-               [ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE         */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI            */
-               [ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE         */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS        */
-               [ C(RESULT_MISS)   ] = 0x024e, /* L1D_PREFETCH.MISS            */
-       },
- },
- [ C(L1I ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS                    */
-               [ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                   */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0,
-               [ C(RESULT_MISS)   ] = 0x0,
-       },
- },
- [ C(LL  ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0324, /* L2_RQSTS.LOADS               */
-               [ C(RESULT_MISS)   ] = 0x0224, /* L2_RQSTS.LD_MISS             */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0c24, /* L2_RQSTS.RFOS                */
-               [ C(RESULT_MISS)   ] = 0x0824, /* L2_RQSTS.RFO_MISS            */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x4f2e, /* LLC Reference                */
-               [ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
-       },
- },
- [ C(DTLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI   (alias)  */
-               [ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI   (alias)  */
-               [ C(RESULT_MISS)   ] = 0x010c, /* MEM_STORE_RETIRED.DTLB_MISS  */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0,
-               [ C(RESULT_MISS)   ] = 0x0,
-       },
- },
- [ C(ITLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x01c0, /* INST_RETIRED.ANY_P           */
-               [ C(RESULT_MISS)   ] = 0x20c8, /* ITLB_MISS_RETIRED            */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
- [ C(BPU ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
-               [ C(RESULT_MISS)   ] = 0x03e8, /* BPU_CLEARS.ANY               */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
-};
-
-static __initconst u64 core2_hw_cache_event_ids
-                               [PERF_COUNT_HW_CACHE_MAX]
-                               [PERF_COUNT_HW_CACHE_OP_MAX]
-                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
-{
- [ C(L1D) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI          */
-               [ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE       */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI          */
-               [ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE       */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x104e, /* L1D_PREFETCH.REQUESTS      */
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(L1I ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0080, /* L1I.READS                  */
-               [ C(RESULT_MISS)   ] = 0x0081, /* L1I.MISSES                 */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(LL  ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
-               [ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
-               [ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(DTLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI  (alias) */
-               [ C(RESULT_MISS)   ] = 0x0208, /* DTLB_MISSES.MISS_LD        */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI  (alias) */
-               [ C(RESULT_MISS)   ] = 0x0808, /* DTLB_MISSES.MISS_ST        */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(ITLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
-               [ C(RESULT_MISS)   ] = 0x1282, /* ITLBMISSES                 */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
- [ C(BPU ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
-               [ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
-};
-
-static __initconst u64 atom_hw_cache_event_ids
-                               [PERF_COUNT_HW_CACHE_MAX]
-                               [PERF_COUNT_HW_CACHE_OP_MAX]
-                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
-{
- [ C(L1D) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x2140, /* L1D_CACHE.LD               */
-               [ C(RESULT_MISS)   ] = 0,
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x2240, /* L1D_CACHE.ST               */
-               [ C(RESULT_MISS)   ] = 0,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(L1I ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS                  */
-               [ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                 */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(LL  ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
-               [ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
-               [ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(DTLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x2140, /* L1D_CACHE_LD.MESI  (alias) */
-               [ C(RESULT_MISS)   ] = 0x0508, /* DTLB_MISSES.MISS_LD        */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x2240, /* L1D_CACHE_ST.MESI  (alias) */
-               [ C(RESULT_MISS)   ] = 0x0608, /* DTLB_MISSES.MISS_ST        */
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(ITLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
-               [ C(RESULT_MISS)   ] = 0x0282, /* ITLB.MISSES                */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
- [ C(BPU ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
-               [ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
-};
-
-static u64 intel_pmu_raw_event(u64 hw_event)
-{
-#define CORE_EVNTSEL_EVENT_MASK                0x000000FFULL
-#define CORE_EVNTSEL_UNIT_MASK         0x0000FF00ULL
-#define CORE_EVNTSEL_EDGE_MASK         0x00040000ULL
-#define CORE_EVNTSEL_INV_MASK          0x00800000ULL
-#define CORE_EVNTSEL_REG_MASK          0xFF000000ULL
-
-#define CORE_EVNTSEL_MASK              \
-       (CORE_EVNTSEL_EVENT_MASK |      \
-        CORE_EVNTSEL_UNIT_MASK  |      \
-        CORE_EVNTSEL_EDGE_MASK  |      \
-        CORE_EVNTSEL_INV_MASK  |       \
-        CORE_EVNTSEL_REG_MASK)
-
-       return hw_event & CORE_EVNTSEL_MASK;
-}
-
-static __initconst u64 amd_hw_cache_event_ids
-                               [PERF_COUNT_HW_CACHE_MAX]
-                               [PERF_COUNT_HW_CACHE_OP_MAX]
-                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
-{
- [ C(L1D) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
-               [ C(RESULT_MISS)   ] = 0x0041, /* Data Cache Misses          */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */
-               [ C(RESULT_MISS)   ] = 0,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0267, /* Data Prefetcher :attempts  */
-               [ C(RESULT_MISS)   ] = 0x0167, /* Data Prefetcher :cancelled */
-       },
- },
- [ C(L1I ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
-               [ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0x014B, /* Prefetch Instructions :Load */
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(LL  ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x037D, /* Requests to L2 Cache :IC+DC */
-               [ C(RESULT_MISS)   ] = 0x037E, /* L2 Cache Misses : IC+DC     */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0x017F, /* L2 Fill/Writeback           */
-               [ C(RESULT_MISS)   ] = 0,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(DTLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
-               [ C(RESULT_MISS)   ] = 0x0046, /* L1 DTLB and L2 DLTB Miss   */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = 0,
-               [ C(RESULT_MISS)   ] = 0,
-       },
- },
- [ C(ITLB) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
-               [ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
- [ C(BPU ) ] = {
-       [ C(OP_READ) ] = {
-               [ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
-               [ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */
-       },
-       [ C(OP_WRITE) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
-       [ C(OP_PREFETCH) ] = {
-               [ C(RESULT_ACCESS) ] = -1,
-               [ C(RESULT_MISS)   ] = -1,
-       },
- },
-};
-
-/*
- * AMD Performance Monitor K7 and later.
- */
-static const u64 amd_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]           = 0x0076,
-  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x0080,
-  [PERF_COUNT_HW_CACHE_MISSES]         = 0x0081,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
-};
-
-static u64 amd_pmu_event_map(int hw_event)
-{
-       return amd_perfmon_event_map[hw_event];
-}
-
-static u64 amd_pmu_raw_event(u64 hw_event)
-{
-#define K7_EVNTSEL_EVENT_MASK  0x7000000FFULL
-#define K7_EVNTSEL_UNIT_MASK   0x00000FF00ULL
-#define K7_EVNTSEL_EDGE_MASK   0x000040000ULL
-#define K7_EVNTSEL_INV_MASK    0x000800000ULL
-#define K7_EVNTSEL_REG_MASK    0x0FF000000ULL
-
-#define K7_EVNTSEL_MASK                        \
-       (K7_EVNTSEL_EVENT_MASK |        \
-        K7_EVNTSEL_UNIT_MASK  |        \
-        K7_EVNTSEL_EDGE_MASK  |        \
-        K7_EVNTSEL_INV_MASK   |        \
-        K7_EVNTSEL_REG_MASK)
-
-       return hw_event & K7_EVNTSEL_MASK;
-}
-
 /*
  * Propagate event elapsed time into the generic event.
  * Can only be executed on the CPU where the event is active.
@@ -914,42 +434,6 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event_attr *attr)
        return 0;
 }
 
-static void intel_pmu_enable_bts(u64 config)
-{
-       unsigned long debugctlmsr;
-
-       debugctlmsr = get_debugctlmsr();
-
-       debugctlmsr |= X86_DEBUGCTL_TR;
-       debugctlmsr |= X86_DEBUGCTL_BTS;
-       debugctlmsr |= X86_DEBUGCTL_BTINT;
-
-       if (!(config & ARCH_PERFMON_EVENTSEL_OS))
-               debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS;
-
-       if (!(config & ARCH_PERFMON_EVENTSEL_USR))
-               debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR;
-
-       update_debugctlmsr(debugctlmsr);
-}
-
-static void intel_pmu_disable_bts(void)
-{
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       unsigned long debugctlmsr;
-
-       if (!cpuc->ds)
-               return;
-
-       debugctlmsr = get_debugctlmsr();
-
-       debugctlmsr &=
-               ~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT |
-                 X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR);
-
-       update_debugctlmsr(debugctlmsr);
-}
-
 /*
  * Setup the hardware configuration for a given attr_type
  */
@@ -988,6 +472,8 @@ static int __hw_perf_event_init(struct perf_event *event)
        hwc->config = ARCH_PERFMON_EVENTSEL_INT;
 
        hwc->idx = -1;
+       hwc->last_cpu = -1;
+       hwc->last_tag = ~0ULL;
 
        /*
         * Count user and OS events unless requested not to.
@@ -1056,216 +542,323 @@ static int __hw_perf_event_init(struct perf_event *event)
        return 0;
 }
 
-static void p6_pmu_disable_all(void)
+static void x86_pmu_disable_all(void)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       u64 val;
-
-       if (!cpuc->enabled)
-               return;
+       int idx;
 
-       cpuc->enabled = 0;
-       barrier();
+       for (idx = 0; idx < x86_pmu.num_events; idx++) {
+               u64 val;
 
-       /* p6 only has one enable register */
-       rdmsrl(MSR_P6_EVNTSEL0, val);
-       val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
-       wrmsrl(MSR_P6_EVNTSEL0, val);
+               if (!test_bit(idx, cpuc->active_mask))
+                       continue;
+               rdmsrl(x86_pmu.eventsel + idx, val);
+               if (!(val & ARCH_PERFMON_EVENTSEL0_ENABLE))
+                       continue;
+               val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
+               wrmsrl(x86_pmu.eventsel + idx, val);
+       }
 }
 
-static void intel_pmu_disable_all(void)
+void hw_perf_disable(void)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
+       if (!x86_pmu_initialized())
+               return;
+
        if (!cpuc->enabled)
                return;
 
+       cpuc->n_added = 0;
        cpuc->enabled = 0;
        barrier();
 
-       wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
-
-       if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask))
-               intel_pmu_disable_bts();
+       x86_pmu.disable_all();
 }
 
-static void amd_pmu_disable_all(void)
+static void x86_pmu_enable_all(void)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
        int idx;
 
-       if (!cpuc->enabled)
-               return;
-
-       cpuc->enabled = 0;
-       /*
-        * ensure we write the disable before we start disabling the
-        * events proper, so that amd_pmu_enable_event() does the
-        * right thing.
-        */
-       barrier();
-
        for (idx = 0; idx < x86_pmu.num_events; idx++) {
+               struct perf_event *event = cpuc->events[idx];
                u64 val;
 
                if (!test_bit(idx, cpuc->active_mask))
                        continue;
-               rdmsrl(MSR_K7_EVNTSEL0 + idx, val);
-               if (!(val & ARCH_PERFMON_EVENTSEL0_ENABLE))
-                       continue;
-               val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
-               wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
+
+               val = event->hw.config;
+               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+               wrmsrl(x86_pmu.eventsel + idx, val);
        }
 }
 
-void hw_perf_disable(void)
+static const struct pmu pmu;
+
+static inline int is_x86_event(struct perf_event *event)
 {
-       if (!x86_pmu_initialized())
-               return;
-       return x86_pmu.disable_all();
+       return event->pmu == &pmu;
 }
 
-static void p6_pmu_enable_all(void)
+static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
 {
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       unsigned long val;
+       struct event_constraint *c, *constraints[X86_PMC_IDX_MAX];
+       unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
+       int i, j, w, wmax, num = 0;
+       struct hw_perf_event *hwc;
 
-       if (cpuc->enabled)
-               return;
+       bitmap_zero(used_mask, X86_PMC_IDX_MAX);
 
-       cpuc->enabled = 1;
-       barrier();
+       for (i = 0; i < n; i++) {
+               constraints[i] =
+                 x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
+       }
 
-       /* p6 only has one enable register */
-       rdmsrl(MSR_P6_EVNTSEL0, val);
-       val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-       wrmsrl(MSR_P6_EVNTSEL0, val);
-}
+       /*
+        * fastpath, try to reuse previous register
+        */
+       for (i = 0; i < n; i++) {
+               hwc = &cpuc->event_list[i]->hw;
+               c = constraints[i];
 
-static void intel_pmu_enable_all(void)
-{
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+               /* never assigned */
+               if (hwc->idx == -1)
+                       break;
 
-       if (cpuc->enabled)
-               return;
+               /* constraint still honored */
+               if (!test_bit(hwc->idx, c->idxmsk))
+                       break;
 
-       cpuc->enabled = 1;
-       barrier();
+               /* not already used */
+               if (test_bit(hwc->idx, used_mask))
+                       break;
 
-       wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
+               set_bit(hwc->idx, used_mask);
+               if (assign)
+                       assign[i] = hwc->idx;
+       }
+       if (i == n)
+               goto done;
 
-       if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
-               struct perf_event *event =
-                       cpuc->events[X86_PMC_IDX_FIXED_BTS];
+       /*
+        * begin slow path
+        */
 
-               if (WARN_ON_ONCE(!event))
-                       return;
+       bitmap_zero(used_mask, X86_PMC_IDX_MAX);
 
-               intel_pmu_enable_bts(event->hw.config);
+       /*
+        * weight = number of possible counters
+        *
+        * 1    = most constrained, only works on one counter
+        * wmax = least constrained, works on any counter
+        *
+        * assign events to counters starting with most
+        * constrained events.
+        */
+       wmax = x86_pmu.num_events;
+
+       /*
+        * when fixed event counters are present,
+        * wmax is incremented by 1 to account
+        * for one more choice
+        */
+       if (x86_pmu.num_events_fixed)
+               wmax++;
+
+       for (w = 1, num = n; num && w <= wmax; w++) {
+               /* for each event */
+               for (i = 0; num && i < n; i++) {
+                       c = constraints[i];
+                       hwc = &cpuc->event_list[i]->hw;
+
+                       if (c->weight != w)
+                               continue;
+
+                       for_each_bit(j, c->idxmsk, X86_PMC_IDX_MAX) {
+                               if (!test_bit(j, used_mask))
+                                       break;
+                       }
+
+                       if (j == X86_PMC_IDX_MAX)
+                               break;
+
+                       set_bit(j, used_mask);
+
+                       if (assign)
+                               assign[i] = j;
+                       num--;
+               }
        }
+done:
+       /*
+        * scheduling failed or is just a simulation,
+        * free resources if necessary
+        */
+       if (!assign || num) {
+               for (i = 0; i < n; i++) {
+                       if (x86_pmu.put_event_constraints)
+                               x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]);
+               }
+       }
+       return num ? -ENOSPC : 0;
 }
 
-static void amd_pmu_enable_all(void)
+/*
+ * dogrp: true if must collect siblings events (group)
+ * returns total number of events and error code
+ */
+static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, bool dogrp)
 {
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       int idx;
+       struct perf_event *event;
+       int n, max_count;
 
-       if (cpuc->enabled)
-               return;
+       max_count = x86_pmu.num_events + x86_pmu.num_events_fixed;
 
-       cpuc->enabled = 1;
-       barrier();
+       /* current number of events already accepted */
+       n = cpuc->n_events;
 
-       for (idx = 0; idx < x86_pmu.num_events; idx++) {
-               struct perf_event *event = cpuc->events[idx];
-               u64 val;
+       if (is_x86_event(leader)) {
+               if (n >= max_count)
+                       return -ENOSPC;
+               cpuc->event_list[n] = leader;
+               n++;
+       }
+       if (!dogrp)
+               return n;
 
-               if (!test_bit(idx, cpuc->active_mask))
+       list_for_each_entry(event, &leader->sibling_list, group_entry) {
+               if (!is_x86_event(event) ||
+                   event->state <= PERF_EVENT_STATE_OFF)
                        continue;
 
-               val = event->hw.config;
-               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-               wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
-       }
-}
+               if (n >= max_count)
+                       return -ENOSPC;
 
-void hw_perf_enable(void)
-{
-       if (!x86_pmu_initialized())
-               return;
-       x86_pmu.enable_all();
+               cpuc->event_list[n] = event;
+               n++;
+       }
+       return n;
 }
 
-static inline u64 intel_pmu_get_status(void)
+static inline void x86_assign_hw_event(struct perf_event *event,
+                               struct cpu_hw_events *cpuc, int i)
 {
-       u64 status;
+       struct hw_perf_event *hwc = &event->hw;
 
-       rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
+       hwc->idx = cpuc->assign[i];
+       hwc->last_cpu = smp_processor_id();
+       hwc->last_tag = ++cpuc->tags[i];
 
-       return status;
+       if (hwc->idx == X86_PMC_IDX_FIXED_BTS) {
+               hwc->config_base = 0;
+               hwc->event_base = 0;
+       } else if (hwc->idx >= X86_PMC_IDX_FIXED) {
+               hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
+               /*
+                * We set it so that event_base + idx in wrmsr/rdmsr maps to
+                * MSR_ARCH_PERFMON_FIXED_CTR0 ... CTR2:
+                */
+               hwc->event_base =
+                       MSR_ARCH_PERFMON_FIXED_CTR0 - X86_PMC_IDX_FIXED;
+       } else {
+               hwc->config_base = x86_pmu.eventsel;
+               hwc->event_base  = x86_pmu.perfctr;
+       }
 }
 
-static inline void intel_pmu_ack_status(u64 ack)
+static inline int match_prev_assignment(struct hw_perf_event *hwc,
+                                       struct cpu_hw_events *cpuc,
+                                       int i)
 {
-       wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
+       return hwc->idx == cpuc->assign[i] &&
+               hwc->last_cpu == smp_processor_id() &&
+               hwc->last_tag == cpuc->tags[i];
 }
 
-static inline void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
-{
-       (void)checking_wrmsrl(hwc->config_base + idx,
-                             hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE);
-}
+static void x86_pmu_stop(struct perf_event *event);
 
-static inline void x86_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+void hw_perf_enable(void)
 {
-       (void)checking_wrmsrl(hwc->config_base + idx, hwc->config);
-}
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       struct perf_event *event;
+       struct hw_perf_event *hwc;
+       int i;
 
-static inline void
-intel_pmu_disable_fixed(struct hw_perf_event *hwc, int __idx)
-{
-       int idx = __idx - X86_PMC_IDX_FIXED;
-       u64 ctrl_val, mask;
+       if (!x86_pmu_initialized())
+               return;
+
+       if (cpuc->enabled)
+               return;
 
-       mask = 0xfULL << (idx * 4);
+       if (cpuc->n_added) {
+               /*
+                * apply assignment obtained either from
+                * hw_perf_group_sched_in() or x86_pmu_enable()
+                *
+                * step1: save events moving to new counters
+                * step2: reprogram moved events into new counters
+                */
+               for (i = 0; i < cpuc->n_events; i++) {
 
-       rdmsrl(hwc->config_base, ctrl_val);
-       ctrl_val &= ~mask;
-       (void)checking_wrmsrl(hwc->config_base, ctrl_val);
-}
+                       event = cpuc->event_list[i];
+                       hwc = &event->hw;
 
-static inline void
-p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)
-{
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       u64 val = P6_NOP_EVENT;
+                       /*
+                        * we can avoid reprogramming counter if:
+                        * - assigned same counter as last time
+                        * - running on same CPU as last time
+                        * - no other event has used the counter since
+                        */
+                       if (hwc->idx == -1 ||
+                           match_prev_assignment(hwc, cpuc, i))
+                               continue;
 
-       if (cpuc->enabled)
-               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+                       x86_pmu_stop(event);
 
-       (void)checking_wrmsrl(hwc->config_base + idx, val);
-}
+                       hwc->idx = -1;
+               }
 
-static inline void
-intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
-{
-       if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
-               intel_pmu_disable_bts();
-               return;
-       }
+               for (i = 0; i < cpuc->n_events; i++) {
 
-       if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
-               intel_pmu_disable_fixed(hwc, idx);
-               return;
+                       event = cpuc->event_list[i];
+                       hwc = &event->hw;
+
+                       if (hwc->idx == -1) {
+                               x86_assign_hw_event(event, cpuc, i);
+                               x86_perf_event_set_period(event, hwc, hwc->idx);
+                       }
+                       /*
+                        * need to mark as active because x86_pmu_disable()
+                        * clear active_mask and events[] yet it preserves
+                        * idx
+                        */
+                       set_bit(hwc->idx, cpuc->active_mask);
+                       cpuc->events[hwc->idx] = event;
+
+                       x86_pmu.enable(hwc, hwc->idx);
+                       perf_event_update_userpage(event);
+               }
+               cpuc->n_added = 0;
+               perf_events_lapic_init();
        }
 
-       x86_pmu_disable_event(hwc, idx);
+       cpuc->enabled = 1;
+       barrier();
+
+       x86_pmu.enable_all();
+}
+
+static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+{
+       (void)checking_wrmsrl(hwc->config_base + idx,
+                             hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE);
 }
 
-static inline void
-amd_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+static inline void x86_pmu_disable_event(struct hw_perf_event *hwc, int idx)
 {
-       x86_pmu_disable_event(hwc, idx);
+       (void)checking_wrmsrl(hwc->config_base + idx, hwc->config);
 }
 
 static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
@@ -1326,213 +919,60 @@ x86_perf_event_set_period(struct perf_event *event,
        return ret;
 }
 
-static inline void
-intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx)
-{
-       int idx = __idx - X86_PMC_IDX_FIXED;
-       u64 ctrl_val, bits, mask;
-       int err;
-
-       /*
-        * Enable IRQ generation (0x8),
-        * and enable ring-3 counting (0x2) and ring-0 counting (0x1)
-        * if requested:
-        */
-       bits = 0x8ULL;
-       if (hwc->config & ARCH_PERFMON_EVENTSEL_USR)
-               bits |= 0x2;
-       if (hwc->config & ARCH_PERFMON_EVENTSEL_OS)
-               bits |= 0x1;
-       bits <<= (idx * 4);
-       mask = 0xfULL << (idx * 4);
-
-       rdmsrl(hwc->config_base, ctrl_val);
-       ctrl_val &= ~mask;
-       ctrl_val |= bits;
-       err = checking_wrmsrl(hwc->config_base, ctrl_val);
-}
-
-static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+static void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-       u64 val;
-
-       val = hwc->config;
        if (cpuc->enabled)
-               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-
-       (void)checking_wrmsrl(hwc->config_base + idx, val);
-}
-
-
-static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
-{
-       if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
-               if (!__get_cpu_var(cpu_hw_events).enabled)
-                       return;
-
-               intel_pmu_enable_bts(hwc->config);
-               return;
-       }
-
-       if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
-               intel_pmu_enable_fixed(hwc, idx);
-               return;
-       }
-
-       x86_pmu_enable_event(hwc, idx);
+               __x86_pmu_enable_event(hwc, idx);
 }
 
-static void amd_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+/*
+ * activate a single event
+ *
+ * The event is added to the group of enabled events
+ * but only if it can be scehduled with existing events.
+ *
+ * Called with PMU disabled. If successful and return value 1,
+ * then guaranteed to call perf_enable() and hw_perf_enable()
+ */
+static int x86_pmu_enable(struct perf_event *event)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       struct hw_perf_event *hwc;
+       int assign[X86_PMC_IDX_MAX];
+       int n, n0, ret;
 
-       if (cpuc->enabled)
-               x86_pmu_enable_event(hwc, idx);
-}
-
-static int fixed_mode_idx(struct hw_perf_event *hwc)
-{
-       unsigned int hw_event;
-
-       hw_event = hwc->config & ARCH_PERFMON_EVENT_MASK;
-
-       if (unlikely((hw_event ==
-                     x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
-                    (hwc->sample_period == 1)))
-               return X86_PMC_IDX_FIXED_BTS;
+       hwc = &event->hw;
 
-       if (!x86_pmu.num_events_fixed)
-               return -1;
+       n0 = cpuc->n_events;
+       n = collect_events(cpuc, event, false);
+       if (n < 0)
+               return n;
 
+       ret = x86_schedule_events(cpuc, n, assign);
+       if (ret)
+               return ret;
        /*
-        * fixed counters do not take all possible filters
+        * copy new assignment, now we know it is possible
+        * will be used by hw_perf_enable()
         */
-       if (hwc->config & ARCH_PERFMON_EVENT_FILTER_MASK)
-               return -1;
-
-       if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
-               return X86_PMC_IDX_FIXED_INSTRUCTIONS;
-       if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
-               return X86_PMC_IDX_FIXED_CPU_CYCLES;
-       if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES)))
-               return X86_PMC_IDX_FIXED_BUS_CYCLES;
+       memcpy(cpuc->assign, assign, n*sizeof(int));
 
-       return -1;
-}
-
-/*
- * generic counter allocator: get next free counter
- */
-static int
-gen_get_event_idx(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc)
-{
-       int idx;
-
-       idx = find_first_zero_bit(cpuc->used_mask, x86_pmu.num_events);
-       return idx == x86_pmu.num_events ? -1 : idx;
-}
-
-/*
- * intel-specific counter allocator: check event constraints
- */
-static int
-intel_get_event_idx(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc)
-{
-       const struct event_constraint *event_constraint;
-       int i, code;
-
-       if (!event_constraints)
-               goto skip;
-
-       code = hwc->config & CORE_EVNTSEL_EVENT_MASK;
-
-       for_each_event_constraint(event_constraint, event_constraints) {
-               if (code == event_constraint->code) {
-                       for_each_bit(i, event_constraint->idxmsk, X86_PMC_IDX_MAX) {
-                               if (!test_and_set_bit(i, cpuc->used_mask))
-                                       return i;
-                       }
-                       return -1;
-               }
-       }
-skip:
-       return gen_get_event_idx(cpuc, hwc);
-}
-
-static int
-x86_schedule_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc)
-{
-       int idx;
-
-       idx = fixed_mode_idx(hwc);
-       if (idx == X86_PMC_IDX_FIXED_BTS) {
-               /* BTS is already occupied. */
-               if (test_and_set_bit(idx, cpuc->used_mask))
-                       return -EAGAIN;
-
-               hwc->config_base        = 0;
-               hwc->event_base         = 0;
-               hwc->idx                = idx;
-       } else if (idx >= 0) {
-               /*
-                * Try to get the fixed event, if that is already taken
-                * then try to get a generic event:
-                */
-               if (test_and_set_bit(idx, cpuc->used_mask))
-                       goto try_generic;
-
-               hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
-               /*
-                * We set it so that event_base + idx in wrmsr/rdmsr maps to
-                * MSR_ARCH_PERFMON_FIXED_CTR0 ... CTR2:
-                */
-               hwc->event_base =
-                       MSR_ARCH_PERFMON_FIXED_CTR0 - X86_PMC_IDX_FIXED;
-               hwc->idx = idx;
-       } else {
-               idx = hwc->idx;
-               /* Try to get the previous generic event again */
-               if (idx == -1 || test_and_set_bit(idx, cpuc->used_mask)) {
-try_generic:
-                       idx = x86_pmu.get_event_idx(cpuc, hwc);
-                       if (idx == -1)
-                               return -EAGAIN;
-
-                       set_bit(idx, cpuc->used_mask);
-                       hwc->idx = idx;
-               }
-               hwc->config_base = x86_pmu.eventsel;
-               hwc->event_base  = x86_pmu.perfctr;
-       }
+       cpuc->n_events = n;
+       cpuc->n_added  = n - n0;
 
-       return idx;
+       return 0;
 }
 
-/*
- * Find a PMC slot for the freshly enabled / scheduled in event:
- */
-static int x86_pmu_enable(struct perf_event *event)
+static int x86_pmu_start(struct perf_event *event)
 {
-       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
        struct hw_perf_event *hwc = &event->hw;
-       int idx;
-
-       idx = x86_schedule_event(cpuc, hwc);
-       if (idx < 0)
-               return idx;
-
-       perf_events_lapic_init();
-
-       x86_pmu.disable(hwc, idx);
-
-       cpuc->events[idx] = event;
-       set_bit(idx, cpuc->active_mask);
 
-       x86_perf_event_set_period(event, hwc, idx);
-       x86_pmu.enable(hwc, idx);
+       if (hwc->idx == -1)
+               return -EAGAIN;
 
-       perf_event_update_userpage(event);
+       x86_perf_event_set_period(event, hwc, hwc->idx);
+       x86_pmu.enable(hwc, hwc->idx);
 
        return 0;
 }
@@ -1576,7 +1016,7 @@ void perf_event_print_debug(void)
                pr_info("CPU#%d: overflow:   %016llx\n", cpu, overflow);
                pr_info("CPU#%d: fixed:      %016llx\n", cpu, fixed);
        }
-       pr_info("CPU#%d: used:       %016llx\n", cpu, *(u64 *)cpuc->used_mask);
+       pr_info("CPU#%d: active:       %016llx\n", cpu, *(u64 *)cpuc->active_mask);
 
        for (idx = 0; idx < x86_pmu.num_events; idx++) {
                rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
@@ -1600,67 +1040,7 @@ void perf_event_print_debug(void)
        local_irq_restore(flags);
 }
 
-static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
-{
-       struct debug_store *ds = cpuc->ds;
-       struct bts_record {
-               u64     from;
-               u64     to;
-               u64     flags;
-       };
-       struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
-       struct bts_record *at, *top;
-       struct perf_output_handle handle;
-       struct perf_event_header header;
-       struct perf_sample_data data;
-       struct pt_regs regs;
-
-       if (!event)
-               return;
-
-       if (!ds)
-               return;
-
-       at  = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
-       top = (struct bts_record *)(unsigned long)ds->bts_index;
-
-       if (top <= at)
-               return;
-
-       ds->bts_index = ds->bts_buffer_base;
-
-
-       data.period     = event->hw.last_period;
-       data.addr       = 0;
-       data.raw        = NULL;
-       regs.ip         = 0;
-
-       /*
-        * Prepare a generic sample, i.e. fill in the invariant fields.
-        * We will overwrite the from and to address before we output
-        * the sample.
-        */
-       perf_prepare_sample(&header, &data, event, &regs);
-
-       if (perf_output_begin(&handle, event,
-                             header.size * (top - at), 1, 1))
-               return;
-
-       for (; at < top; at++) {
-               data.ip         = at->from;
-               data.addr       = at->to;
-
-               perf_output_sample(&handle, &header, &data, event);
-       }
-
-       perf_output_end(&handle);
-
-       /* There's new data available. */
-       event->hw.interrupts++;
-       event->pending_kill = POLL_IN;
-}
-
-static void x86_pmu_disable(struct perf_event *event)
+static void x86_pmu_stop(struct perf_event *event)
 {
        struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
        struct hw_perf_event *hwc = &event->hw;
@@ -1673,184 +1053,39 @@ static void x86_pmu_disable(struct perf_event *event)
        clear_bit(idx, cpuc->active_mask);
        x86_pmu.disable(hwc, idx);
 
-       /*
-        * Make sure the cleared pointer becomes visible before we
-        * (potentially) free the event:
-        */
-       barrier();
-
        /*
         * Drain the remaining delta count out of a event
         * that we are disabling:
         */
        x86_perf_event_update(event, hwc, idx);
 
-       /* Drain the remaining BTS records. */
-       if (unlikely(idx == X86_PMC_IDX_FIXED_BTS))
-               intel_pmu_drain_bts_buffer(cpuc);
-
        cpuc->events[idx] = NULL;
-       clear_bit(idx, cpuc->used_mask);
-
-       perf_event_update_userpage(event);
-}
-
-/*
- * Save and restart an expired event. Called by NMI contexts,
- * so it has to be careful about preempting normal event ops:
- */
-static int intel_pmu_save_and_restart(struct perf_event *event)
-{
-       struct hw_perf_event *hwc = &event->hw;
-       int idx = hwc->idx;
-       int ret;
-
-       x86_perf_event_update(event, hwc, idx);
-       ret = x86_perf_event_set_period(event, hwc, idx);
-
-       if (event->state == PERF_EVENT_STATE_ACTIVE)
-               intel_pmu_enable_event(hwc, idx);
-
-       return ret;
-}
-
-static void intel_pmu_reset(void)
-{
-       struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds;
-       unsigned long flags;
-       int idx;
-
-       if (!x86_pmu.num_events)
-               return;
-
-       local_irq_save(flags);
-
-       printk("clearing PMU state on CPU#%d\n", smp_processor_id());
-
-       for (idx = 0; idx < x86_pmu.num_events; idx++) {
-               checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
-               checking_wrmsrl(x86_pmu.perfctr  + idx, 0ull);
-       }
-       for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
-               checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
-       }
-       if (ds)
-               ds->bts_index = ds->bts_buffer_base;
-
-       local_irq_restore(flags);
-}
-
-static int p6_pmu_handle_irq(struct pt_regs *regs)
-{
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       struct perf_event *event;
-       struct hw_perf_event *hwc;
-       int idx, handled = 0;
-       u64 val;
-
-       data.addr = 0;
-       data.raw = NULL;
-
-       cpuc = &__get_cpu_var(cpu_hw_events);
-
-       for (idx = 0; idx < x86_pmu.num_events; idx++) {
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
-
-               event = cpuc->events[idx];
-               hwc = &event->hw;
-
-               val = x86_perf_event_update(event, hwc, idx);
-               if (val & (1ULL << (x86_pmu.event_bits - 1)))
-                       continue;
-
-               /*
-                * event overflow
-                */
-               handled         = 1;
-               data.period     = event->hw.last_period;
-
-               if (!x86_perf_event_set_period(event, hwc, idx))
-                       continue;
-
-               if (perf_event_overflow(event, 1, &data, regs))
-                       p6_pmu_disable_event(hwc, idx);
-       }
-
-       if (handled)
-               inc_irq_stat(apic_perf_irqs);
-
-       return handled;
 }
 
-/*
- * This handler is triggered by the local APIC, so the APIC IRQ handling
- * rules apply:
- */
-static int intel_pmu_handle_irq(struct pt_regs *regs)
+static void x86_pmu_disable(struct perf_event *event)
 {
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       int bit, loops;
-       u64 ack, status;
-
-       data.addr = 0;
-       data.raw = NULL;
-
-       cpuc = &__get_cpu_var(cpu_hw_events);
-
-       perf_disable();
-       intel_pmu_drain_bts_buffer(cpuc);
-       status = intel_pmu_get_status();
-       if (!status) {
-               perf_enable();
-               return 0;
-       }
-
-       loops = 0;
-again:
-       if (++loops > 100) {
-               WARN_ONCE(1, "perfevents: irq loop stuck!\n");
-               perf_event_print_debug();
-               intel_pmu_reset();
-               perf_enable();
-               return 1;
-       }
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       int i;
 
-       inc_irq_stat(apic_perf_irqs);
-       ack = status;
-       for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
-               struct perf_event *event = cpuc->events[bit];
+       x86_pmu_stop(event);
 
-               clear_bit(bit, (unsigned long *) &status);
-               if (!test_bit(bit, cpuc->active_mask))
-                       continue;
+       for (i = 0; i < cpuc->n_events; i++) {
+               if (event == cpuc->event_list[i]) {
 
-               if (!intel_pmu_save_and_restart(event))
-                       continue;
+                       if (x86_pmu.put_event_constraints)
+                               x86_pmu.put_event_constraints(cpuc, event);
 
-               data.period = event->hw.last_period;
+                       while (++i < cpuc->n_events)
+                               cpuc->event_list[i-1] = cpuc->event_list[i];
 
-               if (perf_event_overflow(event, 1, &data, regs))
-                       intel_pmu_disable_event(&event->hw, bit);
+                       --cpuc->n_events;
+                       break;
+               }
        }
-
-       intel_pmu_ack_status(ack);
-
-       /*
-        * Repeat if there is more work to be done:
-        */
-       status = intel_pmu_get_status();
-       if (status)
-               goto again;
-
-       perf_enable();
-
-       return 1;
+       perf_event_update_userpage(event);
 }
 
-static int amd_pmu_handle_irq(struct pt_regs *regs)
+static int x86_pmu_handle_irq(struct pt_regs *regs)
 {
        struct perf_sample_data data;
        struct cpu_hw_events *cpuc;
@@ -1885,7 +1120,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
                        continue;
 
                if (perf_event_overflow(event, 1, &data, regs))
-                       amd_pmu_disable_event(hwc, idx);
+                       x86_pmu.disable(hwc, idx);
        }
 
        if (handled)
@@ -1968,194 +1203,137 @@ static __read_mostly struct notifier_block perf_event_nmi_notifier = {
        .priority               = 1
 };
 
-static __initconst struct x86_pmu p6_pmu = {
-       .name                   = "p6",
-       .handle_irq             = p6_pmu_handle_irq,
-       .disable_all            = p6_pmu_disable_all,
-       .enable_all             = p6_pmu_enable_all,
-       .enable                 = p6_pmu_enable_event,
-       .disable                = p6_pmu_disable_event,
-       .eventsel               = MSR_P6_EVNTSEL0,
-       .perfctr                = MSR_P6_PERFCTR0,
-       .event_map              = p6_pmu_event_map,
-       .raw_event              = p6_pmu_raw_event,
-       .max_events             = ARRAY_SIZE(p6_perfmon_event_map),
-       .apic                   = 1,
-       .max_period             = (1ULL << 31) - 1,
-       .version                = 0,
-       .num_events             = 2,
-       /*
-        * Events have 40 bits implemented. However they are designed such
-        * that bits [32-39] are sign extensions of bit 31. As such the
-        * effective width of a event for P6-like PMU is 32 bits only.
-        *
-        * See IA-32 Intel Architecture Software developer manual Vol 3B
-        */
-       .event_bits             = 32,
-       .event_mask             = (1ULL << 32) - 1,
-       .get_event_idx          = intel_get_event_idx,
-};
+static struct event_constraint unconstrained;
+static struct event_constraint emptyconstraint;
 
-static __initconst struct x86_pmu intel_pmu = {
-       .name                   = "Intel",
-       .handle_irq             = intel_pmu_handle_irq,
-       .disable_all            = intel_pmu_disable_all,
-       .enable_all             = intel_pmu_enable_all,
-       .enable                 = intel_pmu_enable_event,
-       .disable                = intel_pmu_disable_event,
-       .eventsel               = MSR_ARCH_PERFMON_EVENTSEL0,
-       .perfctr                = MSR_ARCH_PERFMON_PERFCTR0,
-       .event_map              = intel_pmu_event_map,
-       .raw_event              = intel_pmu_raw_event,
-       .max_events             = ARRAY_SIZE(intel_perfmon_event_map),
-       .apic                   = 1,
-       /*
-        * Intel PMCs cannot be accessed sanely above 32 bit width,
-        * so we install an artificial 1<<31 period regardless of
-        * the generic event period:
-        */
-       .max_period             = (1ULL << 31) - 1,
-       .enable_bts             = intel_pmu_enable_bts,
-       .disable_bts            = intel_pmu_disable_bts,
-       .get_event_idx          = intel_get_event_idx,
-};
+static struct event_constraint *
+x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+{
+       struct event_constraint *c;
 
-static __initconst struct x86_pmu amd_pmu = {
-       .name                   = "AMD",
-       .handle_irq             = amd_pmu_handle_irq,
-       .disable_all            = amd_pmu_disable_all,
-       .enable_all             = amd_pmu_enable_all,
-       .enable                 = amd_pmu_enable_event,
-       .disable                = amd_pmu_disable_event,
-       .eventsel               = MSR_K7_EVNTSEL0,
-       .perfctr                = MSR_K7_PERFCTR0,
-       .event_map              = amd_pmu_event_map,
-       .raw_event              = amd_pmu_raw_event,
-       .max_events             = ARRAY_SIZE(amd_perfmon_event_map),
-       .num_events             = 4,
-       .event_bits             = 48,
-       .event_mask             = (1ULL << 48) - 1,
-       .apic                   = 1,
-       /* use highest bit to detect overflow */
-       .max_period             = (1ULL << 47) - 1,
-       .get_event_idx          = gen_get_event_idx,
-};
+       if (x86_pmu.event_constraints) {
+               for_each_event_constraint(c, x86_pmu.event_constraints) {
+                       if ((event->hw.config & c->cmask) == c->code)
+                               return c;
+               }
+       }
+
+       return &unconstrained;
+}
 
-static __init int p6_pmu_init(void)
+static int x86_event_sched_in(struct perf_event *event,
+                         struct perf_cpu_context *cpuctx)
 {
-       switch (boot_cpu_data.x86_model) {
-       case 1:
-       case 3:  /* Pentium Pro */
-       case 5:
-       case 6:  /* Pentium II */
-       case 7:
-       case 8:
-       case 11: /* Pentium III */
-               event_constraints = intel_p6_event_constraints;
-               break;
-       case 9:
-       case 13:
-               /* Pentium M */
-               event_constraints = intel_p6_event_constraints;
-               break;
-       default:
-               pr_cont("unsupported p6 CPU model %d ",
-                       boot_cpu_data.x86_model);
-               return -ENODEV;
-       }
+       int ret = 0;
 
-       x86_pmu = p6_pmu;
+       event->state = PERF_EVENT_STATE_ACTIVE;
+       event->oncpu = smp_processor_id();
+       event->tstamp_running += event->ctx->time - event->tstamp_stopped;
 
-       return 0;
+       if (!is_x86_event(event))
+               ret = event->pmu->enable(event);
+
+       if (!ret && !is_software_event(event))
+               cpuctx->active_oncpu++;
+
+       if (!ret && event->attr.exclusive)
+               cpuctx->exclusive = 1;
+
+       return ret;
 }
 
-static __init int intel_pmu_init(void)
+static void x86_event_sched_out(struct perf_event *event,
+                           struct perf_cpu_context *cpuctx)
 {
-       union cpuid10_edx edx;
-       union cpuid10_eax eax;
-       unsigned int unused;
-       unsigned int ebx;
-       int version;
-
-       if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
-               /* check for P6 processor family */
-          if (boot_cpu_data.x86 == 6) {
-               return p6_pmu_init();
-          } else {
-               return -ENODEV;
-          }
-       }
+       event->state = PERF_EVENT_STATE_INACTIVE;
+       event->oncpu = -1;
 
-       /*
-        * Check whether the Architectural PerfMon supports
-        * Branch Misses Retired hw_event or not.
-        */
-       cpuid(10, &eax.full, &ebx, &unused, &edx.full);
-       if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
-               return -ENODEV;
+       if (!is_x86_event(event))
+               event->pmu->disable(event);
 
-       version = eax.split.version_id;
-       if (version < 2)
-               return -ENODEV;
+       event->tstamp_running -= event->ctx->time - event->tstamp_stopped;
 
-       x86_pmu                         = intel_pmu;
-       x86_pmu.version                 = version;
-       x86_pmu.num_events              = eax.split.num_events;
-       x86_pmu.event_bits              = eax.split.bit_width;
-       x86_pmu.event_mask              = (1ULL << eax.split.bit_width) - 1;
+       if (!is_software_event(event))
+               cpuctx->active_oncpu--;
 
-       /*
-        * Quirk: v2 perfmon does not report fixed-purpose events, so
-        * assume at least 3 events:
-        */
-       x86_pmu.num_events_fixed        = max((int)edx.split.num_events_fixed, 3);
+       if (event->attr.exclusive || !cpuctx->active_oncpu)
+               cpuctx->exclusive = 0;
+}
 
+/*
+ * Called to enable a whole group of events.
+ * Returns 1 if the group was enabled, or -EAGAIN if it could not be.
+ * Assumes the caller has disabled interrupts and has
+ * frozen the PMU with hw_perf_save_disable.
+ *
+ * called with PMU disabled. If successful and return value 1,
+ * then guaranteed to call perf_enable() and hw_perf_enable()
+ */
+int hw_perf_group_sched_in(struct perf_event *leader,
+              struct perf_cpu_context *cpuctx,
+              struct perf_event_context *ctx)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       struct perf_event *sub;
+       int assign[X86_PMC_IDX_MAX];
+       int n0, n1, ret;
+
+       /* n0 = total number of events */
+       n0 = collect_events(cpuc, leader, true);
+       if (n0 < 0)
+               return n0;
+
+       ret = x86_schedule_events(cpuc, n0, assign);
+       if (ret)
+               return ret;
+
+       ret = x86_event_sched_in(leader, cpuctx);
+       if (ret)
+               return ret;
+
+       n1 = 1;
+       list_for_each_entry(sub, &leader->sibling_list, group_entry) {
+               if (sub->state > PERF_EVENT_STATE_OFF) {
+                       ret = x86_event_sched_in(sub, cpuctx);
+                       if (ret)
+                               goto undo;
+                       ++n1;
+               }
+       }
        /*
-        * Install the hw-cache-events table:
+        * copy new assignment, now we know it is possible
+        * will be used by hw_perf_enable()
         */
-       switch (boot_cpu_data.x86_model) {
-       case 15: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
-       case 22: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
-       case 23: /* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
-       case 29: /* six-core 45 nm xeon "Dunnington" */
-               memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
-                      sizeof(hw_cache_event_ids));
-
-               pr_cont("Core2 events, ");
-               event_constraints = intel_core_event_constraints;
-               break;
-       default:
-       case 26:
-               memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
-                      sizeof(hw_cache_event_ids));
+       memcpy(cpuc->assign, assign, n0*sizeof(int));
 
-               event_constraints = intel_nehalem_event_constraints;
-               pr_cont("Nehalem/Corei7 events, ");
-               break;
-       case 28:
-               memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
-                      sizeof(hw_cache_event_ids));
+       cpuc->n_events  = n0;
+       cpuc->n_added   = n1;
+       ctx->nr_active += n1;
 
-               pr_cont("Atom events, ");
-               break;
+       /*
+        * 1 means successful and events are active
+        * This is not quite true because we defer
+        * actual activation until hw_perf_enable() but
+        * this way we* ensure caller won't try to enable
+        * individual events
+        */
+       return 1;
+undo:
+       x86_event_sched_out(leader, cpuctx);
+       n0  = 1;
+       list_for_each_entry(sub, &leader->sibling_list, group_entry) {
+               if (sub->state == PERF_EVENT_STATE_ACTIVE) {
+                       x86_event_sched_out(sub, cpuctx);
+                       if (++n0 == n1)
+                               break;
+               }
        }
-       return 0;
+       return ret;
 }
 
-static __init int amd_pmu_init(void)
-{
-       /* Performance-monitoring supported from K7 and later: */
-       if (boot_cpu_data.x86 < 6)
-               return -ENODEV;
-
-       x86_pmu = amd_pmu;
-
-       /* Events are common for all AMDs */
-       memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
-              sizeof(hw_cache_event_ids));
-
-       return 0;
-}
+#include "perf_event_amd.c"
+#include "perf_event_p6.c"
+#include "perf_event_intel.c"
 
 static void __init pmu_check_apic(void)
 {
@@ -2213,6 +1391,10 @@ void __init init_hw_perf_events(void)
        perf_events_lapic_init();
        register_die_notifier(&perf_event_nmi_notifier);
 
+       unconstrained = (struct event_constraint)
+               __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_events) - 1,
+                                  0, x86_pmu.num_events);
+
        pr_info("... version:                %d\n",     x86_pmu.version);
        pr_info("... bit width:              %d\n",     x86_pmu.event_bits);
        pr_info("... generic registers:      %d\n",     x86_pmu.num_events);
@@ -2230,50 +1412,79 @@ static inline void x86_pmu_read(struct perf_event *event)
 static const struct pmu pmu = {
        .enable         = x86_pmu_enable,
        .disable        = x86_pmu_disable,
+       .start          = x86_pmu_start,
+       .stop           = x86_pmu_stop,
        .read           = x86_pmu_read,
        .unthrottle     = x86_pmu_unthrottle,
 };
 
-static int
-validate_event(struct cpu_hw_events *cpuc, struct perf_event *event)
-{
-       struct hw_perf_event fake_event = event->hw;
-
-       if (event->pmu && event->pmu != &pmu)
-               return 0;
-
-       return x86_schedule_event(cpuc, &fake_event) >= 0;
-}
-
+/*
+ * validate a single event group
+ *
+ * validation include:
+ *     - check events are compatible which each other
+ *     - events do not compete for the same counter
+ *     - number of events <= number of counters
+ *
+ * validation ensures the group can be loaded onto the
+ * PMU if it was the only group available.
+ */
 static int validate_group(struct perf_event *event)
 {
-       struct perf_event *sibling, *leader = event->group_leader;
-       struct cpu_hw_events fake_pmu;
+       struct perf_event *leader = event->group_leader;
+       struct cpu_hw_events *fake_cpuc;
+       int ret, n;
 
-       memset(&fake_pmu, 0, sizeof(fake_pmu));
+       ret = -ENOMEM;
+       fake_cpuc = kmalloc(sizeof(*fake_cpuc), GFP_KERNEL | __GFP_ZERO);
+       if (!fake_cpuc)
+               goto out;
+
+       /*
+        * the event is not yet connected with its
+        * siblings therefore we must first collect
+        * existing siblings, then add the new event
+        * before we can simulate the scheduling
+        */
+       ret = -ENOSPC;
+       n = collect_events(fake_cpuc, leader, true);
+       if (n < 0)
+               goto out_free;
 
-       if (!validate_event(&fake_pmu, leader))
-               return -ENOSPC;
+       fake_cpuc->n_events = n;
+       n = collect_events(fake_cpuc, event, false);
+       if (n < 0)
+               goto out_free;
 
-       list_for_each_entry(sibling, &leader->sibling_list, group_entry) {
-               if (!validate_event(&fake_pmu, sibling))
-                       return -ENOSPC;
-       }
+       fake_cpuc->n_events = n;
 
-       if (!validate_event(&fake_pmu, event))
-               return -ENOSPC;
+       ret = x86_schedule_events(fake_cpuc, n, NULL);
 
-       return 0;
+out_free:
+       kfree(fake_cpuc);
+out:
+       return ret;
 }
 
 const struct pmu *hw_perf_event_init(struct perf_event *event)
 {
+       const struct pmu *tmp;
        int err;
 
        err = __hw_perf_event_init(event);
        if (!err) {
+               /*
+                * we temporarily connect event to its pmu
+                * such that validate_group() can classify
+                * it as an x86 event using is_x86_event()
+                */
+               tmp = event->pmu;
+               event->pmu = &pmu;
+
                if (event->group_leader != event)
                        err = validate_group(event);
+
+               event->pmu = tmp;
        }
        if (err) {
                if (event->destroy)
@@ -2297,7 +1508,6 @@ void callchain_store(struct perf_callchain_entry *entry, u64 ip)
 
 static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_irq_entry);
 static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_nmi_entry);
-static DEFINE_PER_CPU(int, in_ignored_frame);
 
 
 static void
@@ -2313,10 +1523,6 @@ static void backtrace_warning(void *data, char *msg)
 
 static int backtrace_stack(void *data, char *name)
 {
-       per_cpu(in_ignored_frame, smp_processor_id()) =
-                       x86_is_stack_id(NMI_STACK, name) ||
-                       x86_is_stack_id(DEBUG_STACK, name);
-
        return 0;
 }
 
@@ -2324,9 +1530,6 @@ static void backtrace_address(void *data, unsigned long addr, int reliable)
 {
        struct perf_callchain_entry *entry = data;
 
-       if (per_cpu(in_ignored_frame, smp_processor_id()))
-               return;
-
        if (reliable)
                callchain_store(entry, addr);
 }
@@ -2433,9 +1636,6 @@ perf_do_callchain(struct pt_regs *regs, struct perf_callchain_entry *entry)
 
        is_user = user_mode(regs);
 
-       if (!current || current->pid == 0)
-               return;
-
        if (is_user && current->state != TASK_RUNNING)
                return;
 
@@ -2465,4 +1665,25 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
 void hw_perf_event_setup_online(int cpu)
 {
        init_debug_store_on_cpu(cpu);
+
+       switch (boot_cpu_data.x86_vendor) {
+       case X86_VENDOR_AMD:
+               amd_pmu_cpu_online(cpu);
+               break;
+       default:
+               return;
+       }
+}
+
+void hw_perf_event_setup_offline(int cpu)
+{
+       init_debug_store_on_cpu(cpu);
+
+       switch (boot_cpu_data.x86_vendor) {
+       case X86_VENDOR_AMD:
+               amd_pmu_cpu_offline(cpu);
+               break;
+       default:
+               return;
+       }
 }
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
new file mode 100644 (file)
index 0000000..8f3dbfd
--- /dev/null
@@ -0,0 +1,416 @@
+#ifdef CONFIG_CPU_SUP_AMD
+
+static DEFINE_RAW_SPINLOCK(amd_nb_lock);
+
+static __initconst u64 amd_hw_cache_event_ids
+                               [PERF_COUNT_HW_CACHE_MAX]
+                               [PERF_COUNT_HW_CACHE_OP_MAX]
+                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
+               [ C(RESULT_MISS)   ] = 0x0041, /* Data Cache Misses          */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0267, /* Data Prefetcher :attempts  */
+               [ C(RESULT_MISS)   ] = 0x0167, /* Data Prefetcher :cancelled */
+       },
+ },
+ [ C(L1I ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
+               [ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x014B, /* Prefetch Instructions :Load */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(LL  ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x037D, /* Requests to L2 Cache :IC+DC */
+               [ C(RESULT_MISS)   ] = 0x037E, /* L2 Cache Misses : IC+DC     */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x017F, /* L2 Fill/Writeback           */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(DTLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
+               [ C(RESULT_MISS)   ] = 0x0046, /* L1 DTLB and L2 DLTB Miss   */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(ITLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
+               [ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+ [ C(BPU ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
+               [ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+};
+
+/*
+ * AMD Performance Monitor K7 and later.
+ */
+static const u64 amd_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]           = 0x0076,
+  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x0080,
+  [PERF_COUNT_HW_CACHE_MISSES]         = 0x0081,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
+};
+
+static u64 amd_pmu_event_map(int hw_event)
+{
+       return amd_perfmon_event_map[hw_event];
+}
+
+static u64 amd_pmu_raw_event(u64 hw_event)
+{
+#define K7_EVNTSEL_EVENT_MASK  0xF000000FFULL
+#define K7_EVNTSEL_UNIT_MASK   0x00000FF00ULL
+#define K7_EVNTSEL_EDGE_MASK   0x000040000ULL
+#define K7_EVNTSEL_INV_MASK    0x000800000ULL
+#define K7_EVNTSEL_REG_MASK    0x0FF000000ULL
+
+#define K7_EVNTSEL_MASK                        \
+       (K7_EVNTSEL_EVENT_MASK |        \
+        K7_EVNTSEL_UNIT_MASK  |        \
+        K7_EVNTSEL_EDGE_MASK  |        \
+        K7_EVNTSEL_INV_MASK   |        \
+        K7_EVNTSEL_REG_MASK)
+
+       return hw_event & K7_EVNTSEL_MASK;
+}
+
+/*
+ * AMD64 events are detected based on their event codes.
+ */
+static inline int amd_is_nb_event(struct hw_perf_event *hwc)
+{
+       return (hwc->config & 0xe0) == 0xe0;
+}
+
+static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
+                                     struct perf_event *event)
+{
+       struct hw_perf_event *hwc = &event->hw;
+       struct amd_nb *nb = cpuc->amd_nb;
+       int i;
+
+       /*
+        * only care about NB events
+        */
+       if (!(nb && amd_is_nb_event(hwc)))
+               return;
+
+       /*
+        * need to scan whole list because event may not have
+        * been assigned during scheduling
+        *
+        * no race condition possible because event can only
+        * be removed on one CPU at a time AND PMU is disabled
+        * when we come here
+        */
+       for (i = 0; i < x86_pmu.num_events; i++) {
+               if (nb->owners[i] == event) {
+                       cmpxchg(nb->owners+i, event, NULL);
+                       break;
+               }
+       }
+}
+
+ /*
+  * AMD64 NorthBridge events need special treatment because
+  * counter access needs to be synchronized across all cores
+  * of a package. Refer to BKDG section 3.12
+  *
+  * NB events are events measuring L3 cache, Hypertransport
+  * traffic. They are identified by an event code >= 0xe00.
+  * They measure events on the NorthBride which is shared
+  * by all cores on a package. NB events are counted on a
+  * shared set of counters. When a NB event is programmed
+  * in a counter, the data actually comes from a shared
+  * counter. Thus, access to those counters needs to be
+  * synchronized.
+  *
+  * We implement the synchronization such that no two cores
+  * can be measuring NB events using the same counters. Thus,
+  * we maintain a per-NB allocation table. The available slot
+  * is propagated using the event_constraint structure.
+  *
+  * We provide only one choice for each NB event based on
+  * the fact that only NB events have restrictions. Consequently,
+  * if a counter is available, there is a guarantee the NB event
+  * will be assigned to it. If no slot is available, an empty
+  * constraint is returned and scheduling will eventually fail
+  * for this event.
+  *
+  * Note that all cores attached the same NB compete for the same
+  * counters to host NB events, this is why we use atomic ops. Some
+  * multi-chip CPUs may have more than one NB.
+  *
+  * Given that resources are allocated (cmpxchg), they must be
+  * eventually freed for others to use. This is accomplished by
+  * calling amd_put_event_constraints().
+  *
+  * Non NB events are not impacted by this restriction.
+  */
+static struct event_constraint *
+amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+{
+       struct hw_perf_event *hwc = &event->hw;
+       struct amd_nb *nb = cpuc->amd_nb;
+       struct perf_event *old = NULL;
+       int max = x86_pmu.num_events;
+       int i, j, k = -1;
+
+       /*
+        * if not NB event or no NB, then no constraints
+        */
+       if (!(nb && amd_is_nb_event(hwc)))
+               return &unconstrained;
+
+       /*
+        * detect if already present, if so reuse
+        *
+        * cannot merge with actual allocation
+        * because of possible holes
+        *
+        * event can already be present yet not assigned (in hwc->idx)
+        * because of successive calls to x86_schedule_events() from
+        * hw_perf_group_sched_in() without hw_perf_enable()
+        */
+       for (i = 0; i < max; i++) {
+               /*
+                * keep track of first free slot
+                */
+               if (k == -1 && !nb->owners[i])
+                       k = i;
+
+               /* already present, reuse */
+               if (nb->owners[i] == event)
+                       goto done;
+       }
+       /*
+        * not present, so grab a new slot
+        * starting either at:
+        */
+       if (hwc->idx != -1) {
+               /* previous assignment */
+               i = hwc->idx;
+       } else if (k != -1) {
+               /* start from free slot found */
+               i = k;
+       } else {
+               /*
+                * event not found, no slot found in
+                * first pass, try again from the
+                * beginning
+                */
+               i = 0;
+       }
+       j = i;
+       do {
+               old = cmpxchg(nb->owners+i, NULL, event);
+               if (!old)
+                       break;
+               if (++i == max)
+                       i = 0;
+       } while (i != j);
+done:
+       if (!old)
+               return &nb->event_constraints[i];
+
+       return &emptyconstraint;
+}
+
+static __initconst struct x86_pmu amd_pmu = {
+       .name                   = "AMD",
+       .handle_irq             = x86_pmu_handle_irq,
+       .disable_all            = x86_pmu_disable_all,
+       .enable_all             = x86_pmu_enable_all,
+       .enable                 = x86_pmu_enable_event,
+       .disable                = x86_pmu_disable_event,
+       .eventsel               = MSR_K7_EVNTSEL0,
+       .perfctr                = MSR_K7_PERFCTR0,
+       .event_map              = amd_pmu_event_map,
+       .raw_event              = amd_pmu_raw_event,
+       .max_events             = ARRAY_SIZE(amd_perfmon_event_map),
+       .num_events             = 4,
+       .event_bits             = 48,
+       .event_mask             = (1ULL << 48) - 1,
+       .apic                   = 1,
+       /* use highest bit to detect overflow */
+       .max_period             = (1ULL << 47) - 1,
+       .get_event_constraints  = amd_get_event_constraints,
+       .put_event_constraints  = amd_put_event_constraints
+};
+
+static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
+{
+       struct amd_nb *nb;
+       int i;
+
+       nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
+       if (!nb)
+               return NULL;
+
+       memset(nb, 0, sizeof(*nb));
+       nb->nb_id = nb_id;
+
+       /*
+        * initialize all possible NB constraints
+        */
+       for (i = 0; i < x86_pmu.num_events; i++) {
+               set_bit(i, nb->event_constraints[i].idxmsk);
+               nb->event_constraints[i].weight = 1;
+       }
+       return nb;
+}
+
+static void amd_pmu_cpu_online(int cpu)
+{
+       struct cpu_hw_events *cpu1, *cpu2;
+       struct amd_nb *nb = NULL;
+       int i, nb_id;
+
+       if (boot_cpu_data.x86_max_cores < 2)
+               return;
+
+       /*
+        * function may be called too early in the
+        * boot process, in which case nb_id is bogus
+        */
+       nb_id = amd_get_nb_id(cpu);
+       if (nb_id == BAD_APICID)
+               return;
+
+       cpu1 = &per_cpu(cpu_hw_events, cpu);
+       cpu1->amd_nb = NULL;
+
+       raw_spin_lock(&amd_nb_lock);
+
+       for_each_online_cpu(i) {
+               cpu2 = &per_cpu(cpu_hw_events, i);
+               nb = cpu2->amd_nb;
+               if (!nb)
+                       continue;
+               if (nb->nb_id == nb_id)
+                       goto found;
+       }
+
+       nb = amd_alloc_nb(cpu, nb_id);
+       if (!nb) {
+               pr_err("perf_events: failed NB allocation for CPU%d\n", cpu);
+               raw_spin_unlock(&amd_nb_lock);
+               return;
+       }
+found:
+       nb->refcnt++;
+       cpu1->amd_nb = nb;
+
+       raw_spin_unlock(&amd_nb_lock);
+}
+
+static void amd_pmu_cpu_offline(int cpu)
+{
+       struct cpu_hw_events *cpuhw;
+
+       if (boot_cpu_data.x86_max_cores < 2)
+               return;
+
+       cpuhw = &per_cpu(cpu_hw_events, cpu);
+
+       raw_spin_lock(&amd_nb_lock);
+
+       if (--cpuhw->amd_nb->refcnt == 0)
+               kfree(cpuhw->amd_nb);
+
+       cpuhw->amd_nb = NULL;
+
+       raw_spin_unlock(&amd_nb_lock);
+}
+
+static __init int amd_pmu_init(void)
+{
+       /* Performance-monitoring supported from K7 and later: */
+       if (boot_cpu_data.x86 < 6)
+               return -ENODEV;
+
+       x86_pmu = amd_pmu;
+
+       /* Events are common for all AMDs */
+       memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
+              sizeof(hw_cache_event_ids));
+
+       /*
+        * explicitly initialize the boot cpu, other cpus will get
+        * the cpu hotplug callbacks from smp_init()
+        */
+       amd_pmu_cpu_online(smp_processor_id());
+       return 0;
+}
+
+#else /* CONFIG_CPU_SUP_AMD */
+
+static int amd_pmu_init(void)
+{
+       return 0;
+}
+
+static void amd_pmu_cpu_online(int cpu)
+{
+}
+
+static void amd_pmu_cpu_offline(int cpu)
+{
+}
+
+#endif
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
new file mode 100644 (file)
index 0000000..cf6590c
--- /dev/null
@@ -0,0 +1,971 @@
+#ifdef CONFIG_CPU_SUP_INTEL
+
+/*
+ * Intel PerfMon v3. Used on Core2 and later.
+ */
+static const u64 intel_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]           = 0x003c,
+  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x4f2e,
+  [PERF_COUNT_HW_CACHE_MISSES]         = 0x412e,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
+  [PERF_COUNT_HW_BUS_CYCLES]           = 0x013c,
+};
+
+static struct event_constraint intel_core_event_constraints[] =
+{
+       INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
+       INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
+       INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
+       INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
+       INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
+       INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FP_COMP_INSTR_RET */
+       EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_core2_event_constraints[] =
+{
+       FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+       FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+       INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
+       INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
+       INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
+       INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
+       INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
+       INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
+       INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
+       INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
+       INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED */
+       EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_nehalem_event_constraints[] =
+{
+       FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+       FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+       INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */
+       INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */
+       INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */
+       INTEL_EVENT_CONSTRAINT(0x43, 0x3), /* L1D_ALL_REF */
+       INTEL_EVENT_CONSTRAINT(0x48, 0x3), /* L1D_PEND_MISS */
+       INTEL_EVENT_CONSTRAINT(0x4e, 0x3), /* L1D_PREFETCH */
+       INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
+       INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
+       EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_westmere_event_constraints[] =
+{
+       FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+       FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+       INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
+       INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
+       INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
+       EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_gen_event_constraints[] =
+{
+       FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+       FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+       EVENT_CONSTRAINT_END
+};
+
+static u64 intel_pmu_event_map(int hw_event)
+{
+       return intel_perfmon_event_map[hw_event];
+}
+
+static __initconst u64 westmere_hw_cache_event_ids
+                               [PERF_COUNT_HW_CACHE_MAX]
+                               [PERF_COUNT_HW_CACHE_OP_MAX]
+                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
+               [ C(RESULT_MISS)   ] = 0x0151, /* L1D.REPL                     */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
+               [ C(RESULT_MISS)   ] = 0x0251, /* L1D.M_REPL                   */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS        */
+               [ C(RESULT_MISS)   ] = 0x024e, /* L1D_PREFETCH.MISS            */
+       },
+ },
+ [ C(L1I ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS                    */
+               [ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                   */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0,
+               [ C(RESULT_MISS)   ] = 0x0,
+       },
+ },
+ [ C(LL  ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0324, /* L2_RQSTS.LOADS               */
+               [ C(RESULT_MISS)   ] = 0x0224, /* L2_RQSTS.LD_MISS             */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0c24, /* L2_RQSTS.RFOS                */
+               [ C(RESULT_MISS)   ] = 0x0824, /* L2_RQSTS.RFO_MISS            */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f2e, /* LLC Reference                */
+               [ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
+       },
+ },
+ [ C(DTLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
+               [ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
+               [ C(RESULT_MISS)   ] = 0x010c, /* MEM_STORE_RETIRED.DTLB_MISS  */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0,
+               [ C(RESULT_MISS)   ] = 0x0,
+       },
+ },
+ [ C(ITLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x01c0, /* INST_RETIRED.ANY_P           */
+               [ C(RESULT_MISS)   ] = 0x0185, /* ITLB_MISSES.ANY              */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+ [ C(BPU ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
+               [ C(RESULT_MISS)   ] = 0x03e8, /* BPU_CLEARS.ANY               */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+};
+
+static __initconst u64 nehalem_hw_cache_event_ids
+                               [PERF_COUNT_HW_CACHE_MAX]
+                               [PERF_COUNT_HW_CACHE_OP_MAX]
+                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI            */
+               [ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE         */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI            */
+               [ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE         */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS        */
+               [ C(RESULT_MISS)   ] = 0x024e, /* L1D_PREFETCH.MISS            */
+       },
+ },
+ [ C(L1I ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS                    */
+               [ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                   */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0,
+               [ C(RESULT_MISS)   ] = 0x0,
+       },
+ },
+ [ C(LL  ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0324, /* L2_RQSTS.LOADS               */
+               [ C(RESULT_MISS)   ] = 0x0224, /* L2_RQSTS.LD_MISS             */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0c24, /* L2_RQSTS.RFOS                */
+               [ C(RESULT_MISS)   ] = 0x0824, /* L2_RQSTS.RFO_MISS            */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f2e, /* LLC Reference                */
+               [ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
+       },
+ },
+ [ C(DTLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI   (alias)  */
+               [ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI   (alias)  */
+               [ C(RESULT_MISS)   ] = 0x010c, /* MEM_STORE_RETIRED.DTLB_MISS  */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0,
+               [ C(RESULT_MISS)   ] = 0x0,
+       },
+ },
+ [ C(ITLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x01c0, /* INST_RETIRED.ANY_P           */
+               [ C(RESULT_MISS)   ] = 0x20c8, /* ITLB_MISS_RETIRED            */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+ [ C(BPU ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
+               [ C(RESULT_MISS)   ] = 0x03e8, /* BPU_CLEARS.ANY               */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+};
+
+static __initconst u64 core2_hw_cache_event_ids
+                               [PERF_COUNT_HW_CACHE_MAX]
+                               [PERF_COUNT_HW_CACHE_OP_MAX]
+                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI          */
+               [ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE       */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI          */
+               [ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE       */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x104e, /* L1D_PREFETCH.REQUESTS      */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(L1I ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0080, /* L1I.READS                  */
+               [ C(RESULT_MISS)   ] = 0x0081, /* L1I.MISSES                 */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(LL  ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
+               [ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
+               [ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(DTLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI  (alias) */
+               [ C(RESULT_MISS)   ] = 0x0208, /* DTLB_MISSES.MISS_LD        */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI  (alias) */
+               [ C(RESULT_MISS)   ] = 0x0808, /* DTLB_MISSES.MISS_ST        */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(ITLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
+               [ C(RESULT_MISS)   ] = 0x1282, /* ITLBMISSES                 */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+ [ C(BPU ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
+               [ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+};
+
+static __initconst u64 atom_hw_cache_event_ids
+                               [PERF_COUNT_HW_CACHE_MAX]
+                               [PERF_COUNT_HW_CACHE_OP_MAX]
+                               [PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x2140, /* L1D_CACHE.LD               */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x2240, /* L1D_CACHE.ST               */
+               [ C(RESULT_MISS)   ] = 0,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(L1I ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS                  */
+               [ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                 */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(LL  ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
+               [ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
+               [ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(DTLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x2140, /* L1D_CACHE_LD.MESI  (alias) */
+               [ C(RESULT_MISS)   ] = 0x0508, /* DTLB_MISSES.MISS_LD        */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = 0x2240, /* L1D_CACHE_ST.MESI  (alias) */
+               [ C(RESULT_MISS)   ] = 0x0608, /* DTLB_MISSES.MISS_ST        */
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = 0,
+               [ C(RESULT_MISS)   ] = 0,
+       },
+ },
+ [ C(ITLB) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
+               [ C(RESULT_MISS)   ] = 0x0282, /* ITLB.MISSES                */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+ [ C(BPU ) ] = {
+       [ C(OP_READ) ] = {
+               [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
+               [ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
+       },
+       [ C(OP_WRITE) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+       [ C(OP_PREFETCH) ] = {
+               [ C(RESULT_ACCESS) ] = -1,
+               [ C(RESULT_MISS)   ] = -1,
+       },
+ },
+};
+
+static u64 intel_pmu_raw_event(u64 hw_event)
+{
+#define CORE_EVNTSEL_EVENT_MASK                0x000000FFULL
+#define CORE_EVNTSEL_UNIT_MASK         0x0000FF00ULL
+#define CORE_EVNTSEL_EDGE_MASK         0x00040000ULL
+#define CORE_EVNTSEL_INV_MASK          0x00800000ULL
+#define CORE_EVNTSEL_REG_MASK          0xFF000000ULL
+
+#define CORE_EVNTSEL_MASK              \
+       (INTEL_ARCH_EVTSEL_MASK |       \
+        INTEL_ARCH_UNIT_MASK   |       \
+        INTEL_ARCH_EDGE_MASK   |       \
+        INTEL_ARCH_INV_MASK    |       \
+        INTEL_ARCH_CNT_MASK)
+
+       return hw_event & CORE_EVNTSEL_MASK;
+}
+
+static void intel_pmu_enable_bts(u64 config)
+{
+       unsigned long debugctlmsr;
+
+       debugctlmsr = get_debugctlmsr();
+
+       debugctlmsr |= X86_DEBUGCTL_TR;
+       debugctlmsr |= X86_DEBUGCTL_BTS;
+       debugctlmsr |= X86_DEBUGCTL_BTINT;
+
+       if (!(config & ARCH_PERFMON_EVENTSEL_OS))
+               debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS;
+
+       if (!(config & ARCH_PERFMON_EVENTSEL_USR))
+               debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR;
+
+       update_debugctlmsr(debugctlmsr);
+}
+
+static void intel_pmu_disable_bts(void)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       unsigned long debugctlmsr;
+
+       if (!cpuc->ds)
+               return;
+
+       debugctlmsr = get_debugctlmsr();
+
+       debugctlmsr &=
+               ~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT |
+                 X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR);
+
+       update_debugctlmsr(debugctlmsr);
+}
+
+static void intel_pmu_disable_all(void)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+       wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
+
+       if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask))
+               intel_pmu_disable_bts();
+}
+
+static void intel_pmu_enable_all(void)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+       wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
+
+       if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
+               struct perf_event *event =
+                       cpuc->events[X86_PMC_IDX_FIXED_BTS];
+
+               if (WARN_ON_ONCE(!event))
+                       return;
+
+               intel_pmu_enable_bts(event->hw.config);
+       }
+}
+
+static inline u64 intel_pmu_get_status(void)
+{
+       u64 status;
+
+       rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
+
+       return status;
+}
+
+static inline void intel_pmu_ack_status(u64 ack)
+{
+       wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
+}
+
+static inline void
+intel_pmu_disable_fixed(struct hw_perf_event *hwc, int __idx)
+{
+       int idx = __idx - X86_PMC_IDX_FIXED;
+       u64 ctrl_val, mask;
+
+       mask = 0xfULL << (idx * 4);
+
+       rdmsrl(hwc->config_base, ctrl_val);
+       ctrl_val &= ~mask;
+       (void)checking_wrmsrl(hwc->config_base, ctrl_val);
+}
+
+static void intel_pmu_drain_bts_buffer(void)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       struct debug_store *ds = cpuc->ds;
+       struct bts_record {
+               u64     from;
+               u64     to;
+               u64     flags;
+       };
+       struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
+       struct bts_record *at, *top;
+       struct perf_output_handle handle;
+       struct perf_event_header header;
+       struct perf_sample_data data;
+       struct pt_regs regs;
+
+       if (!event)
+               return;
+
+       if (!ds)
+               return;
+
+       at  = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
+       top = (struct bts_record *)(unsigned long)ds->bts_index;
+
+       if (top <= at)
+               return;
+
+       ds->bts_index = ds->bts_buffer_base;
+
+
+       data.period     = event->hw.last_period;
+       data.addr       = 0;
+       data.raw        = NULL;
+       regs.ip         = 0;
+
+       /*
+        * Prepare a generic sample, i.e. fill in the invariant fields.
+        * We will overwrite the from and to address before we output
+        * the sample.
+        */
+       perf_prepare_sample(&header, &data, event, &regs);
+
+       if (perf_output_begin(&handle, event,
+                             header.size * (top - at), 1, 1))
+               return;
+
+       for (; at < top; at++) {
+               data.ip         = at->from;
+               data.addr       = at->to;
+
+               perf_output_sample(&handle, &header, &data, event);
+       }
+
+       perf_output_end(&handle);
+
+       /* There's new data available. */
+       event->hw.interrupts++;
+       event->pending_kill = POLL_IN;
+}
+
+static inline void
+intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+{
+       if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
+               intel_pmu_disable_bts();
+               intel_pmu_drain_bts_buffer();
+               return;
+       }
+
+       if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
+               intel_pmu_disable_fixed(hwc, idx);
+               return;
+       }
+
+       x86_pmu_disable_event(hwc, idx);
+}
+
+static inline void
+intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx)
+{
+       int idx = __idx - X86_PMC_IDX_FIXED;
+       u64 ctrl_val, bits, mask;
+       int err;
+
+       /*
+        * Enable IRQ generation (0x8),
+        * and enable ring-3 counting (0x2) and ring-0 counting (0x1)
+        * if requested:
+        */
+       bits = 0x8ULL;
+       if (hwc->config & ARCH_PERFMON_EVENTSEL_USR)
+               bits |= 0x2;
+       if (hwc->config & ARCH_PERFMON_EVENTSEL_OS)
+               bits |= 0x1;
+
+       /*
+        * ANY bit is supported in v3 and up
+        */
+       if (x86_pmu.version > 2 && hwc->config & ARCH_PERFMON_EVENTSEL_ANY)
+               bits |= 0x4;
+
+       bits <<= (idx * 4);
+       mask = 0xfULL << (idx * 4);
+
+       rdmsrl(hwc->config_base, ctrl_val);
+       ctrl_val &= ~mask;
+       ctrl_val |= bits;
+       err = checking_wrmsrl(hwc->config_base, ctrl_val);
+}
+
+static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+{
+       if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
+               if (!__get_cpu_var(cpu_hw_events).enabled)
+                       return;
+
+               intel_pmu_enable_bts(hwc->config);
+               return;
+       }
+
+       if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
+               intel_pmu_enable_fixed(hwc, idx);
+               return;
+       }
+
+       __x86_pmu_enable_event(hwc, idx);
+}
+
+/*
+ * Save and restart an expired event. Called by NMI contexts,
+ * so it has to be careful about preempting normal event ops:
+ */
+static int intel_pmu_save_and_restart(struct perf_event *event)
+{
+       struct hw_perf_event *hwc = &event->hw;
+       int idx = hwc->idx;
+       int ret;
+
+       x86_perf_event_update(event, hwc, idx);
+       ret = x86_perf_event_set_period(event, hwc, idx);
+
+       return ret;
+}
+
+static void intel_pmu_reset(void)
+{
+       struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds;
+       unsigned long flags;
+       int idx;
+
+       if (!x86_pmu.num_events)
+               return;
+
+       local_irq_save(flags);
+
+       printk("clearing PMU state on CPU#%d\n", smp_processor_id());
+
+       for (idx = 0; idx < x86_pmu.num_events; idx++) {
+               checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
+               checking_wrmsrl(x86_pmu.perfctr  + idx, 0ull);
+       }
+       for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
+               checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
+       }
+       if (ds)
+               ds->bts_index = ds->bts_buffer_base;
+
+       local_irq_restore(flags);
+}
+
+/*
+ * This handler is triggered by the local APIC, so the APIC IRQ handling
+ * rules apply:
+ */
+static int intel_pmu_handle_irq(struct pt_regs *regs)
+{
+       struct perf_sample_data data;
+       struct cpu_hw_events *cpuc;
+       int bit, loops;
+       u64 ack, status;
+
+       data.addr = 0;
+       data.raw = NULL;
+
+       cpuc = &__get_cpu_var(cpu_hw_events);
+
+       perf_disable();
+       intel_pmu_drain_bts_buffer();
+       status = intel_pmu_get_status();
+       if (!status) {
+               perf_enable();
+               return 0;
+       }
+
+       loops = 0;
+again:
+       if (++loops > 100) {
+               WARN_ONCE(1, "perfevents: irq loop stuck!\n");
+               perf_event_print_debug();
+               intel_pmu_reset();
+               perf_enable();
+               return 1;
+       }
+
+       inc_irq_stat(apic_perf_irqs);
+       ack = status;
+       for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
+               struct perf_event *event = cpuc->events[bit];
+
+               clear_bit(bit, (unsigned long *) &status);
+               if (!test_bit(bit, cpuc->active_mask))
+                       continue;
+
+               if (!intel_pmu_save_and_restart(event))
+                       continue;
+
+               data.period = event->hw.last_period;
+
+               if (perf_event_overflow(event, 1, &data, regs))
+                       intel_pmu_disable_event(&event->hw, bit);
+       }
+
+       intel_pmu_ack_status(ack);
+
+       /*
+        * Repeat if there is more work to be done:
+        */
+       status = intel_pmu_get_status();
+       if (status)
+               goto again;
+
+       perf_enable();
+
+       return 1;
+}
+
+static struct event_constraint bts_constraint =
+       EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
+
+static struct event_constraint *
+intel_special_constraints(struct perf_event *event)
+{
+       unsigned int hw_event;
+
+       hw_event = event->hw.config & INTEL_ARCH_EVENT_MASK;
+
+       if (unlikely((hw_event ==
+                     x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
+                    (event->hw.sample_period == 1))) {
+
+               return &bts_constraint;
+       }
+       return NULL;
+}
+
+static struct event_constraint *
+intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+{
+       struct event_constraint *c;
+
+       c = intel_special_constraints(event);
+       if (c)
+               return c;
+
+       return x86_get_event_constraints(cpuc, event);
+}
+
+static __initconst struct x86_pmu core_pmu = {
+       .name                   = "core",
+       .handle_irq             = x86_pmu_handle_irq,
+       .disable_all            = x86_pmu_disable_all,
+       .enable_all             = x86_pmu_enable_all,
+       .enable                 = x86_pmu_enable_event,
+       .disable                = x86_pmu_disable_event,
+       .eventsel               = MSR_ARCH_PERFMON_EVENTSEL0,
+       .perfctr                = MSR_ARCH_PERFMON_PERFCTR0,
+       .event_map              = intel_pmu_event_map,
+       .raw_event              = intel_pmu_raw_event,
+       .max_events             = ARRAY_SIZE(intel_perfmon_event_map),
+       .apic                   = 1,
+       /*
+        * Intel PMCs cannot be accessed sanely above 32 bit width,
+        * so we install an artificial 1<<31 period regardless of
+        * the generic event period:
+        */
+       .max_period             = (1ULL << 31) - 1,
+       .get_event_constraints  = intel_get_event_constraints,
+       .event_constraints      = intel_core_event_constraints,
+};
+
+static __initconst struct x86_pmu intel_pmu = {
+       .name                   = "Intel",
+       .handle_irq             = intel_pmu_handle_irq,
+       .disable_all            = intel_pmu_disable_all,
+       .enable_all             = intel_pmu_enable_all,
+       .enable                 = intel_pmu_enable_event,
+       .disable                = intel_pmu_disable_event,
+       .eventsel               = MSR_ARCH_PERFMON_EVENTSEL0,
+       .perfctr                = MSR_ARCH_PERFMON_PERFCTR0,
+       .event_map              = intel_pmu_event_map,
+       .raw_event              = intel_pmu_raw_event,
+       .max_events             = ARRAY_SIZE(intel_perfmon_event_map),
+       .apic                   = 1,
+       /*
+        * Intel PMCs cannot be accessed sanely above 32 bit width,
+        * so we install an artificial 1<<31 period regardless of
+        * the generic event period:
+        */
+       .max_period             = (1ULL << 31) - 1,
+       .enable_bts             = intel_pmu_enable_bts,
+       .disable_bts            = intel_pmu_disable_bts,
+       .get_event_constraints  = intel_get_event_constraints
+};
+
+static __init int intel_pmu_init(void)
+{
+       union cpuid10_edx edx;
+       union cpuid10_eax eax;
+       unsigned int unused;
+       unsigned int ebx;
+       int version;
+
+       if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
+               /* check for P6 processor family */
+          if (boot_cpu_data.x86 == 6) {
+               return p6_pmu_init();
+          } else {
+               return -ENODEV;
+          }
+       }
+
+       /*
+        * Check whether the Architectural PerfMon supports
+        * Branch Misses Retired hw_event or not.
+        */
+       cpuid(10, &eax.full, &ebx, &unused, &edx.full);
+       if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
+               return -ENODEV;
+
+       version = eax.split.version_id;
+       if (version < 2)
+               x86_pmu = core_pmu;
+       else
+               x86_pmu = intel_pmu;
+
+       x86_pmu.version                 = version;
+       x86_pmu.num_events              = eax.split.num_events;
+       x86_pmu.event_bits              = eax.split.bit_width;
+       x86_pmu.event_mask              = (1ULL << eax.split.bit_width) - 1;
+
+       /*
+        * Quirk: v2 perfmon does not report fixed-purpose events, so
+        * assume at least 3 events:
+        */
+       if (version > 1)
+               x86_pmu.num_events_fixed = max((int)edx.split.num_events_fixed, 3);
+
+       /*
+        * Install the hw-cache-events table:
+        */
+       switch (boot_cpu_data.x86_model) {
+       case 14: /* 65 nm core solo/duo, "Yonah" */
+               pr_cont("Core events, ");
+               break;
+
+       case 15: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
+       case 22: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
+       case 23: /* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
+       case 29: /* six-core 45 nm xeon "Dunnington" */
+               memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
+                      sizeof(hw_cache_event_ids));
+
+               x86_pmu.event_constraints = intel_core2_event_constraints;
+               pr_cont("Core2 events, ");
+               break;
+
+       case 26: /* 45 nm nehalem, "Bloomfield" */
+       case 30: /* 45 nm nehalem, "Lynnfield" */
+               memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
+                      sizeof(hw_cache_event_ids));
+
+               x86_pmu.event_constraints = intel_nehalem_event_constraints;
+               pr_cont("Nehalem/Corei7 events, ");
+               break;
+       case 28:
+               memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
+                      sizeof(hw_cache_event_ids));
+
+               x86_pmu.event_constraints = intel_gen_event_constraints;
+               pr_cont("Atom events, ");
+               break;
+
+       case 37: /* 32 nm nehalem, "Clarkdale" */
+       case 44: /* 32 nm nehalem, "Gulftown" */
+               memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
+                      sizeof(hw_cache_event_ids));
+
+               x86_pmu.event_constraints = intel_westmere_event_constraints;
+               pr_cont("Westmere events, ");
+               break;
+       default:
+               /*
+                * default constraints for v2 and up
+                */
+               x86_pmu.event_constraints = intel_gen_event_constraints;
+               pr_cont("generic architected perfmon, ");
+       }
+       return 0;
+}
+
+#else /* CONFIG_CPU_SUP_INTEL */
+
+static int intel_pmu_init(void)
+{
+       return 0;
+}
+
+#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
new file mode 100644 (file)
index 0000000..1ca5ba0
--- /dev/null
@@ -0,0 +1,157 @@
+#ifdef CONFIG_CPU_SUP_INTEL
+
+/*
+ * Not sure about some of these
+ */
+static const u64 p6_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]           = 0x0079,
+  [PERF_COUNT_HW_INSTRUCTIONS]         = 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]     = 0x0f2e,
+  [PERF_COUNT_HW_CACHE_MISSES]         = 0x012e,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]  = 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]                = 0x00c5,
+  [PERF_COUNT_HW_BUS_CYCLES]           = 0x0062,
+};
+
+static u64 p6_pmu_event_map(int hw_event)
+{
+       return p6_perfmon_event_map[hw_event];
+}
+
+/*
+ * Event setting that is specified not to count anything.
+ * We use this to effectively disable a counter.
+ *
+ * L2_RQSTS with 0 MESI unit mask.
+ */
+#define P6_NOP_EVENT                   0x0000002EULL
+
+static u64 p6_pmu_raw_event(u64 hw_event)
+{
+#define P6_EVNTSEL_EVENT_MASK          0x000000FFULL
+#define P6_EVNTSEL_UNIT_MASK           0x0000FF00ULL
+#define P6_EVNTSEL_EDGE_MASK           0x00040000ULL
+#define P6_EVNTSEL_INV_MASK            0x00800000ULL
+#define P6_EVNTSEL_REG_MASK            0xFF000000ULL
+
+#define P6_EVNTSEL_MASK                        \
+       (P6_EVNTSEL_EVENT_MASK |        \
+        P6_EVNTSEL_UNIT_MASK  |        \
+        P6_EVNTSEL_EDGE_MASK  |        \
+        P6_EVNTSEL_INV_MASK   |        \
+        P6_EVNTSEL_REG_MASK)
+
+       return hw_event & P6_EVNTSEL_MASK;
+}
+
+static struct event_constraint p6_event_constraints[] =
+{
+       INTEL_EVENT_CONSTRAINT(0xc1, 0x1),      /* FLOPS */
+       INTEL_EVENT_CONSTRAINT(0x10, 0x1),      /* FP_COMP_OPS_EXE */
+       INTEL_EVENT_CONSTRAINT(0x11, 0x1),      /* FP_ASSIST */
+       INTEL_EVENT_CONSTRAINT(0x12, 0x2),      /* MUL */
+       INTEL_EVENT_CONSTRAINT(0x13, 0x2),      /* DIV */
+       INTEL_EVENT_CONSTRAINT(0x14, 0x1),      /* CYCLES_DIV_BUSY */
+       EVENT_CONSTRAINT_END
+};
+
+static void p6_pmu_disable_all(void)
+{
+       u64 val;
+
+       /* p6 only has one enable register */
+       rdmsrl(MSR_P6_EVNTSEL0, val);
+       val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
+       wrmsrl(MSR_P6_EVNTSEL0, val);
+}
+
+static void p6_pmu_enable_all(void)
+{
+       unsigned long val;
+
+       /* p6 only has one enable register */
+       rdmsrl(MSR_P6_EVNTSEL0, val);
+       val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+       wrmsrl(MSR_P6_EVNTSEL0, val);
+}
+
+static inline void
+p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       u64 val = P6_NOP_EVENT;
+
+       if (cpuc->enabled)
+               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+
+       (void)checking_wrmsrl(hwc->config_base + idx, val);
+}
+
+static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+{
+       struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+       u64 val;
+
+       val = hwc->config;
+       if (cpuc->enabled)
+               val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+
+       (void)checking_wrmsrl(hwc->config_base + idx, val);
+}
+
+static __initconst struct x86_pmu p6_pmu = {
+       .name                   = "p6",
+       .handle_irq             = x86_pmu_handle_irq,
+       .disable_all            = p6_pmu_disable_all,
+       .enable_all             = p6_pmu_enable_all,
+       .enable                 = p6_pmu_enable_event,
+       .disable                = p6_pmu_disable_event,
+       .eventsel               = MSR_P6_EVNTSEL0,
+       .perfctr                = MSR_P6_PERFCTR0,
+       .event_map              = p6_pmu_event_map,
+       .raw_event              = p6_pmu_raw_event,
+       .max_events             = ARRAY_SIZE(p6_perfmon_event_map),
+       .apic                   = 1,
+       .max_period             = (1ULL << 31) - 1,
+       .version                = 0,
+       .num_events             = 2,
+       /*
+        * Events have 40 bits implemented. However they are designed such
+        * that bits [32-39] are sign extensions of bit 31. As such the
+        * effective width of a event for P6-like PMU is 32 bits only.
+        *
+        * See IA-32 Intel Architecture Software developer manual Vol 3B
+        */
+       .event_bits             = 32,
+       .event_mask             = (1ULL << 32) - 1,
+       .get_event_constraints  = x86_get_event_constraints,
+       .event_constraints      = p6_event_constraints,
+};
+
+static __init int p6_pmu_init(void)
+{
+       switch (boot_cpu_data.x86_model) {
+       case 1:
+       case 3:  /* Pentium Pro */
+       case 5:
+       case 6:  /* Pentium II */
+       case 7:
+       case 8:
+       case 11: /* Pentium III */
+       case 9:
+       case 13:
+               /* Pentium M */
+               break;
+       default:
+               pr_cont("unsupported p6 CPU model %d ",
+                       boot_cpu_data.x86_model);
+               return -ENODEV;
+       }
+
+       x86_pmu = p6_pmu;
+
+       return 0;
+}
+
+#endif /* CONFIG_CPU_SUP_INTEL */
index 898df9719afbedacb1a709c192b434e5595dd90a..74f4e85a572703b648c0f5c218a758c694bbce4c 100644 (file)
@@ -115,17 +115,6 @@ int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
 
        return !test_bit(counter, perfctr_nmi_owner);
 }
-
-/* checks the an msr for availability */
-int avail_to_resrv_perfctr_nmi(unsigned int msr)
-{
-       unsigned int counter;
-
-       counter = nmi_perfctr_msr_to_bit(msr);
-       BUG_ON(counter > NMI_MAX_COUNTER_BITS);
-
-       return !test_bit(counter, perfctr_nmi_owner);
-}
 EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit);
 
 int reserve_perfctr_nmi(unsigned int msr)
index cb27fd6136c9bec099b0a944ee59a8425d39d09c..83e5e628de73a7234f90c2f7130e98fa4df4fe4e 100644 (file)
@@ -229,7 +229,7 @@ static void __exit cpuid_exit(void)
        for_each_online_cpu(cpu)
                cpuid_device_destroy(cpu);
        class_destroy(cpuid_class);
-       unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
+       __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
        unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
 }
 
index c56bc2873030d65d35e9c97f7b50e990ad4de2f9..6d817554780adea96603f6f852ee398d62b9e41a 100644 (file)
@@ -123,13 +123,15 @@ print_context_stack_bp(struct thread_info *tinfo,
        while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) {
                unsigned long addr = *ret_addr;
 
-               if (__kernel_text_address(addr)) {
-                       ops->address(data, addr, 1);
-                       frame = frame->next_frame;
-                       ret_addr = &frame->return_address;
-                       print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
-               }
+               if (!__kernel_text_address(addr))
+                       break;
+
+               ops->address(data, addr, 1);
+               frame = frame->next_frame;
+               ret_addr = &frame->return_address;
+               print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
        }
+
        return (unsigned long)frame;
 }
 EXPORT_SYMBOL_GPL(print_context_stack_bp);
index ae775ca47b25c463fb8688cd4e47a92efa6a1a1e..11540a189d9311e6a0fb4c44e685fc82799fdd0e 100644 (file)
 
 #include "dumpstack.h"
 
-/* Just a stub for now */
-int x86_is_stack_id(int id, char *name)
-{
-       return 0;
-}
 
 void dump_trace(struct task_struct *task, struct pt_regs *regs,
                unsigned long *stack, unsigned long bp,
index 0ad9597073f5a53aabb5f3dbbd85ea4cae947d60..dce99abb449617d5c0d2e1d93dc1cf15a98bd7ac 100644 (file)
@@ -33,11 +33,6 @@ static char x86_stack_ids[][8] = {
 #endif
 };
 
-int x86_is_stack_id(int id, char *name)
-{
-       return x86_stack_ids[id - 1] == name;
-}
-
 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
                                         unsigned *usedp, char **idp)
 {
@@ -291,6 +286,7 @@ void show_registers(struct pt_regs *regs)
 
        sp = regs->sp;
        printk("CPU %d ", cpu);
+       print_modules();
        __show_regs(regs, 1);
        printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
                cur->comm, cur->pid, task_thread_info(cur), cur);
index a1a7876cadcbfa2b0fdbfa9d9416ee62c14cd85c..a966b753e4961446863f9e4c114f8315cedff274 100644 (file)
@@ -517,11 +517,19 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
                             int checktype)
 {
        int i;
+       u64 end;
        u64 real_removed_size = 0;
 
        if (size > (ULLONG_MAX - start))
                size = ULLONG_MAX - start;
 
+       end = start + size;
+       printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ",
+                      (unsigned long long) start,
+                      (unsigned long long) end);
+       e820_print_type(old_type);
+       printk(KERN_CONT "\n");
+
        for (i = 0; i < e820.nr_map; i++) {
                struct e820entry *ei = &e820.map[i];
                u64 final_start, final_end;
index cdcfb122f25650ca407b9bdf9b138d46b883284b..c2fa9b8b497e082cd703f2e2e0f9b03319bdd2e6 100644 (file)
@@ -362,7 +362,7 @@ void __init efi_init(void)
                printk(KERN_ERR PFX "Could not map the firmware vendor!\n");
        early_iounmap(tmp, 2);
 
-       printk(KERN_INFO "EFI v%u.%.02u by %s \n",
+       printk(KERN_INFO "EFI v%u.%.02u by %s\n",
               efi.systab->hdr.revision >> 16,
               efi.systab->hdr.revision & 0xffff, vendor);
 
index 30968924543129853b05bcb1aaa34dbcf1439ed2..cd37469b54eeed3fc479d2c931d8d2ed933ea411 100644 (file)
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 
+/*
+ * modifying_code is set to notify NMIs that they need to use
+ * memory barriers when entering or exiting. But we don't want
+ * to burden NMIs with unnecessary memory barriers when code
+ * modification is not being done (which is most of the time).
+ *
+ * A mutex is already held when ftrace_arch_code_modify_prepare
+ * and post_process are called. No locks need to be taken here.
+ *
+ * Stop machine will make sure currently running NMIs are done
+ * and new NMIs will see the updated variable before we need
+ * to worry about NMIs doing memory barriers.
+ */
+static int modifying_code __read_mostly;
+static DEFINE_PER_CPU(int, save_modifying_code);
+
 int ftrace_arch_code_modify_prepare(void)
 {
        set_kernel_text_rw();
+       modifying_code = 1;
        return 0;
 }
 
 int ftrace_arch_code_modify_post_process(void)
 {
+       modifying_code = 0;
        set_kernel_text_ro();
        return 0;
 }
@@ -149,6 +167,11 @@ static void ftrace_mod_code(void)
 
 void ftrace_nmi_enter(void)
 {
+       __get_cpu_var(save_modifying_code) = modifying_code;
+
+       if (!__get_cpu_var(save_modifying_code))
+               return;
+
        if (atomic_inc_return(&nmi_running) & MOD_CODE_WRITE_FLAG) {
                smp_rmb();
                ftrace_mod_code();
@@ -160,6 +183,9 @@ void ftrace_nmi_enter(void)
 
 void ftrace_nmi_exit(void)
 {
+       if (!__get_cpu_var(save_modifying_code))
+               return;
+
        /* Finish all executions before clearing nmi_running */
        smp_mb();
        atomic_dec(&nmi_running);
@@ -484,13 +510,3 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
        }
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-
-extern unsigned long *sys_call_table;
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-       return (unsigned long)(&sys_call_table)[nr];
-}
-#endif
index ba6e658846035a75f17b16e5ee5cf1de82eb337f..ee4fa1bfcb33354b96069b4728dd5cf367e74e12 100644 (file)
@@ -34,6 +34,8 @@
  */
 unsigned long                          hpet_address;
 u8                                     hpet_blockid; /* OS timer block num */
+u8                                     hpet_msi_disable;
+
 #ifdef CONFIG_PCI_MSI
 static unsigned long                   hpet_num_timers;
 #endif
@@ -264,7 +266,7 @@ static void hpet_resume_device(void)
        force_hpet_resume();
 }
 
-static void hpet_resume_counter(void)
+static void hpet_resume_counter(struct clocksource *cs)
 {
        hpet_resume_device();
        hpet_restart_counter();
@@ -596,6 +598,9 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
        unsigned int num_timers_used = 0;
        int i;
 
+       if (hpet_msi_disable)
+               return;
+
        if (boot_cpu_has(X86_FEATURE_ARAT))
                return;
        id = hpet_readl(HPET_ID);
@@ -928,6 +933,9 @@ static __init int hpet_late_init(void)
        hpet_reserve_platform_timers(hpet_readl(HPET_ID));
        hpet_print_config();
 
+       if (hpet_msi_disable)
+               return 0;
+
        if (boot_cpu_has(X86_FEATURE_ARAT))
                return 0;
 
index 05d5fec64a9475855e224012dbb54a9d82b1ee4c..dca2802c666f240019c54a75c5ff5240d5778bb9 100644 (file)
@@ -212,25 +212,6 @@ static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len)
        return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
 }
 
-/*
- * Store a breakpoint's encoded address, length, and type.
- */
-static int arch_store_info(struct perf_event *bp)
-{
-       struct arch_hw_breakpoint *info = counter_arch_bp(bp);
-       /*
-        * For kernel-addresses, either the address or symbol name can be
-        * specified.
-        */
-       if (info->name)
-               info->address = (unsigned long)
-                               kallsyms_lookup_name(info->name);
-       if (info->address)
-               return 0;
-
-       return -EINVAL;
-}
-
 int arch_bp_generic_fields(int x86_len, int x86_type,
                           int *gen_len, int *gen_type)
 {
@@ -362,10 +343,13 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
                return ret;
        }
 
-       ret = arch_store_info(bp);
-
-       if (ret < 0)
-               return ret;
+       /*
+        * For kernel-addresses, either the address or symbol name can be
+        * specified.
+        */
+       if (info->name)
+               info->address = (unsigned long)
+                               kallsyms_lookup_name(info->name);
        /*
         * Check that the low-order bits of the address are appropriate
         * for the alignment implied by len.
@@ -502,8 +486,6 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
                rcu_read_lock();
 
                bp = per_cpu(bp_per_reg[i], cpu);
-               if (bp)
-                       rc = NOTIFY_DONE;
                /*
                 * Reset the 'i'th TRAP bit in dr6 to denote completion of
                 * exception handling
@@ -522,7 +504,13 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
 
                rcu_read_unlock();
        }
-       if (dr6 & (~DR_TRAP_BITS))
+       /*
+        * Further processing in do_debug() is needed for a) user-space
+        * breakpoints (to generate signals) and b) when the system has
+        * taken exception due to multiple causes
+        */
+       if ((current->thread.debugreg6 & DR_TRAP_BITS) ||
+           (dr6 & (~DR_TRAP_BITS)))
                rc = NOTIFY_DONE;
 
        set_debugreg(dr7, 7);
index f2f8540a7f3d0bd88a8ac7b27c9ba460581ba023..c01a2b846d478a94d86ec94416394094f80ccd5e 100644 (file)
@@ -164,6 +164,11 @@ int init_fpu(struct task_struct *tsk)
        return 0;
 }
 
+/*
+ * The xstateregs_active() routine is the same as the fpregs_active() routine,
+ * as the "regset->n" for the xstate regset will be updated based on the feature
+ * capabilites supported by the xsave.
+ */
 int fpregs_active(struct task_struct *target, const struct user_regset *regset)
 {
        return tsk_used_math(target) ? regset->n : 0;
@@ -204,8 +209,6 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
        if (ret)
                return ret;
 
-       set_stopped_child_used_math(target);
-
        ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
                                 &target->thread.xstate->fxsave, 0, -1);
 
@@ -224,6 +227,68 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
        return ret;
 }
 
+int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
+               unsigned int pos, unsigned int count,
+               void *kbuf, void __user *ubuf)
+{
+       int ret;
+
+       if (!cpu_has_xsave)
+               return -ENODEV;
+
+       ret = init_fpu(target);
+       if (ret)
+               return ret;
+
+       /*
+        * Copy the 48bytes defined by the software first into the xstate
+        * memory layout in the thread struct, so that we can copy the entire
+        * xstateregs to the user using one user_regset_copyout().
+        */
+       memcpy(&target->thread.xstate->fxsave.sw_reserved,
+              xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes));
+
+       /*
+        * Copy the xstate memory layout.
+        */
+       ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+                                 &target->thread.xstate->xsave, 0, -1);
+       return ret;
+}
+
+int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
+                 unsigned int pos, unsigned int count,
+                 const void *kbuf, const void __user *ubuf)
+{
+       int ret;
+       struct xsave_hdr_struct *xsave_hdr;
+
+       if (!cpu_has_xsave)
+               return -ENODEV;
+
+       ret = init_fpu(target);
+       if (ret)
+               return ret;
+
+       ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
+                                &target->thread.xstate->xsave, 0, -1);
+
+       /*
+        * mxcsr reserved bits must be masked to zero for security reasons.
+        */
+       target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask;
+
+       xsave_hdr = &target->thread.xstate->xsave.xsave_hdr;
+
+       xsave_hdr->xstate_bv &= pcntxt_mask;
+       /*
+        * These bits must be zero.
+        */
+       xsave_hdr->reserved1[0] = xsave_hdr->reserved1[1] = 0;
+
+       return ret;
+}
+
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
 
 /*
@@ -404,8 +469,6 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
        if (ret)
                return ret;
 
-       set_stopped_child_used_math(target);
-
        if (!HAVE_HWFP)
                return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
 
index dd74fe7273b120643bf2f4a7563295afde009233..bfba6019d762aa6652e58b3b09681a83b2e74525 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/nmi.h>
+#include <linux/hw_breakpoint.h>
 
 #include <asm/debugreg.h>
 #include <asm/apicdef.h>
@@ -204,40 +205,81 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
 
 static struct hw_breakpoint {
        unsigned                enabled;
-       unsigned                type;
-       unsigned                len;
        unsigned long           addr;
+       int                     len;
+       int                     type;
+       struct perf_event       **pev;
 } breakinfo[4];
 
 static void kgdb_correct_hw_break(void)
 {
-       unsigned long dr7;
-       int correctit = 0;
-       int breakbit;
        int breakno;
 
-       get_debugreg(dr7, 7);
        for (breakno = 0; breakno < 4; breakno++) {
-               breakbit = 2 << (breakno << 1);
-               if (!(dr7 & breakbit) && breakinfo[breakno].enabled) {
-                       correctit = 1;
-                       dr7 |= breakbit;
-                       dr7 &= ~(0xf0000 << (breakno << 2));
-                       dr7 |= ((breakinfo[breakno].len << 2) |
-                                breakinfo[breakno].type) <<
-                              ((breakno << 2) + 16);
-                       set_debugreg(breakinfo[breakno].addr, breakno);
-
-               } else {
-                       if ((dr7 & breakbit) && !breakinfo[breakno].enabled) {
-                               correctit = 1;
-                               dr7 &= ~breakbit;
-                               dr7 &= ~(0xf0000 << (breakno << 2));
-                       }
-               }
+               struct perf_event *bp;
+               struct arch_hw_breakpoint *info;
+               int val;
+               int cpu = raw_smp_processor_id();
+               if (!breakinfo[breakno].enabled)
+                       continue;
+               bp = *per_cpu_ptr(breakinfo[breakno].pev, cpu);
+               info = counter_arch_bp(bp);
+               if (bp->attr.disabled != 1)
+                       continue;
+               bp->attr.bp_addr = breakinfo[breakno].addr;
+               bp->attr.bp_len = breakinfo[breakno].len;
+               bp->attr.bp_type = breakinfo[breakno].type;
+               info->address = breakinfo[breakno].addr;
+               info->len = breakinfo[breakno].len;
+               info->type = breakinfo[breakno].type;
+               val = arch_install_hw_breakpoint(bp);
+               if (!val)
+                       bp->attr.disabled = 0;
+       }
+       hw_breakpoint_restore();
+}
+
+static int hw_break_reserve_slot(int breakno)
+{
+       int cpu;
+       int cnt = 0;
+       struct perf_event **pevent;
+
+       for_each_online_cpu(cpu) {
+               cnt++;
+               pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
+               if (dbg_reserve_bp_slot(*pevent))
+                       goto fail;
+       }
+
+       return 0;
+
+fail:
+       for_each_online_cpu(cpu) {
+               cnt--;
+               if (!cnt)
+                       break;
+               pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
+               dbg_release_bp_slot(*pevent);
        }
-       if (correctit)
-               set_debugreg(dr7, 7);
+       return -1;
+}
+
+static int hw_break_release_slot(int breakno)
+{
+       struct perf_event **pevent;
+       int cpu;
+
+       for_each_online_cpu(cpu) {
+               pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
+               if (dbg_release_bp_slot(*pevent))
+                       /*
+                        * The debugger is responisble for handing the retry on
+                        * remove failure.
+                        */
+                       return -1;
+       }
+       return 0;
 }
 
 static int
@@ -251,6 +293,10 @@ kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
        if (i == 4)
                return -1;
 
+       if (hw_break_release_slot(i)) {
+               printk(KERN_ERR "Cannot remove hw breakpoint at %lx\n", addr);
+               return -1;
+       }
        breakinfo[i].enabled = 0;
 
        return 0;
@@ -259,15 +305,23 @@ kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
 static void kgdb_remove_all_hw_break(void)
 {
        int i;
+       int cpu = raw_smp_processor_id();
+       struct perf_event *bp;
 
-       for (i = 0; i < 4; i++)
-               memset(&breakinfo[i], 0, sizeof(struct hw_breakpoint));
+       for (i = 0; i < 4; i++) {
+               if (!breakinfo[i].enabled)
+                       continue;
+               bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
+               if (bp->attr.disabled == 1)
+                       continue;
+               arch_uninstall_hw_breakpoint(bp);
+               bp->attr.disabled = 1;
+       }
 }
 
 static int
 kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
 {
-       unsigned type;
        int i;
 
        for (i = 0; i < 4; i++)
@@ -278,27 +332,42 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
 
        switch (bptype) {
        case BP_HARDWARE_BREAKPOINT:
-               type = 0;
-               len  = 1;
+               len = 1;
+               breakinfo[i].type = X86_BREAKPOINT_EXECUTE;
                break;
        case BP_WRITE_WATCHPOINT:
-               type = 1;
+               breakinfo[i].type = X86_BREAKPOINT_WRITE;
                break;
        case BP_ACCESS_WATCHPOINT:
-               type = 3;
+               breakinfo[i].type = X86_BREAKPOINT_RW;
                break;
        default:
                return -1;
        }
-
-       if (len == 1 || len == 2 || len == 4)
-               breakinfo[i].len  = len - 1;
-       else
+       switch (len) {
+       case 1:
+               breakinfo[i].len = X86_BREAKPOINT_LEN_1;
+               break;
+       case 2:
+               breakinfo[i].len = X86_BREAKPOINT_LEN_2;
+               break;
+       case 4:
+               breakinfo[i].len = X86_BREAKPOINT_LEN_4;
+               break;
+#ifdef CONFIG_X86_64
+       case 8:
+               breakinfo[i].len = X86_BREAKPOINT_LEN_8;
+               break;
+#endif
+       default:
                return -1;
-
-       breakinfo[i].enabled = 1;
+       }
        breakinfo[i].addr = addr;
-       breakinfo[i].type = type;
+       if (hw_break_reserve_slot(i)) {
+               breakinfo[i].addr = 0;
+               return -1;
+       }
+       breakinfo[i].enabled = 1;
 
        return 0;
 }
@@ -313,8 +382,21 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
  */
 void kgdb_disable_hw_debug(struct pt_regs *regs)
 {
+       int i;
+       int cpu = raw_smp_processor_id();
+       struct perf_event *bp;
+
        /* Disable hardware debugging while we are in kgdb: */
        set_debugreg(0UL, 7);
+       for (i = 0; i < 4; i++) {
+               if (!breakinfo[i].enabled)
+                       continue;
+               bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
+               if (bp->attr.disabled == 1)
+                       continue;
+               arch_uninstall_hw_breakpoint(bp);
+               bp->attr.disabled = 1;
+       }
 }
 
 /**
@@ -378,7 +460,6 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                               struct pt_regs *linux_regs)
 {
        unsigned long addr;
-       unsigned long dr6;
        char *ptr;
        int newPC;
 
@@ -404,20 +485,6 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                                   raw_smp_processor_id());
                }
 
-               get_debugreg(dr6, 6);
-               if (!(dr6 & 0x4000)) {
-                       int breakno;
-
-                       for (breakno = 0; breakno < 4; breakno++) {
-                               if (dr6 & (1 << breakno) &&
-                                   breakinfo[breakno].type == 0) {
-                                       /* Set restore flag: */
-                                       linux_regs->flags |= X86_EFLAGS_RF;
-                                       break;
-                               }
-                       }
-               }
-               set_debugreg(0UL, 6);
                kgdb_correct_hw_break();
 
                return 0;
@@ -485,8 +552,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
                break;
 
        case DIE_DEBUG:
-               if (atomic_read(&kgdb_cpu_doing_single_step) ==
-                   raw_smp_processor_id()) {
+               if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
                        if (user_mode(regs))
                                return single_step_cont(regs, args);
                        break;
@@ -539,7 +605,42 @@ static struct notifier_block kgdb_notifier = {
  */
 int kgdb_arch_init(void)
 {
-       return register_die_notifier(&kgdb_notifier);
+       int i, cpu;
+       int ret;
+       struct perf_event_attr attr;
+       struct perf_event **pevent;
+
+       ret = register_die_notifier(&kgdb_notifier);
+       if (ret != 0)
+               return ret;
+       /*
+        * Pre-allocate the hw breakpoint structions in the non-atomic
+        * portion of kgdb because this operation requires mutexs to
+        * complete.
+        */
+       attr.bp_addr = (unsigned long)kgdb_arch_init;
+       attr.type = PERF_TYPE_BREAKPOINT;
+       attr.bp_len = HW_BREAKPOINT_LEN_1;
+       attr.bp_type = HW_BREAKPOINT_W;
+       attr.disabled = 1;
+       for (i = 0; i < 4; i++) {
+               breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL);
+               if (IS_ERR(breakinfo[i].pev)) {
+                       printk(KERN_ERR "kgdb: Could not allocate hw breakpoints\n");
+                       breakinfo[i].pev = NULL;
+                       kgdb_arch_exit();
+                       return -1;
+               }
+               for_each_online_cpu(cpu) {
+                       pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
+                       pevent[0]->hw.sample_period = 1;
+                       if (pevent[0]->destroy != NULL) {
+                               pevent[0]->destroy = NULL;
+                               release_bp_slot(*pevent);
+                       }
+               }
+       }
+       return ret;
 }
 
 /**
@@ -550,6 +651,13 @@ int kgdb_arch_init(void)
  */
 void kgdb_arch_exit(void)
 {
+       int i;
+       for (i = 0; i < 4; i++) {
+               if (breakinfo[i].pev) {
+                       unregister_wide_hw_breakpoint(breakinfo[i].pev);
+                       breakinfo[i].pev = NULL;
+               }
+       }
        unregister_die_notifier(&kgdb_notifier);
 }
 
index 5b8c7505b3bc2438429a330117a36c20dcf16339..5de9f4a9c3fd0e77edc96ed1ed46b055d7a18bdc 100644 (file)
@@ -337,6 +337,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
 
 int __kprobes arch_prepare_kprobe(struct kprobe *p)
 {
+       if (alternatives_text_reserved(p->addr, p->addr))
+               return -EINVAL;
+
        if (!can_probe((unsigned long)p->addr))
                return -EILSEQ;
        /* insn: must be on special executable page on x86. */
@@ -429,7 +432,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
 static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
                                       struct kprobe_ctlblk *kcb)
 {
-#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
+#if !defined(CONFIG_PREEMPT)
        if (p->ainsn.boostable == 1 && !p->post_handler) {
                /* Boost up -- we can execute copied instructions directly */
                reset_current_kprobe();
index 37542b67c57e4299738d609c3e44206be251304e..e1af7c055c7d0c86c7e3a1fe789e597825185892 100644 (file)
@@ -36,9 +36,6 @@ MODULE_LICENSE("GPL v2");
 #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
 #define UCODE_UCODE_TYPE           0x00000001
 
-const struct firmware *firmware;
-static int supported_cpu;
-
 struct equiv_cpu_entry {
        u32     installed_cpu;
        u32     fixed_errata_mask;
@@ -77,12 +74,15 @@ static struct equiv_cpu_entry *equiv_cpu_table;
 
 static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
 {
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
        u32 dummy;
 
-       if (!supported_cpu)
-               return -1;
-
        memset(csig, 0, sizeof(*csig));
+       if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
+               pr_warning("microcode: CPU%d: AMD CPU family 0x%x not "
+                          "supported\n", cpu, c->x86);
+               return -1;
+       }
        rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
        pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev);
        return 0;
@@ -294,10 +294,14 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 static enum ucode_state request_microcode_fw(int cpu, struct device *device)
 {
+       const char *fw_name = "amd-ucode/microcode_amd.bin";
+       const struct firmware *firmware;
        enum ucode_state ret;
 
-       if (firmware == NULL)
+       if (request_firmware(&firmware, fw_name, device)) {
+               printk(KERN_ERR "microcode: failed to load file %s\n", fw_name);
                return UCODE_NFOUND;
+       }
 
        if (*(u32 *)firmware->data != UCODE_MAGIC) {
                pr_err("invalid UCODE_MAGIC (0x%08x)\n",
@@ -307,6 +311,8 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
 
        ret = generic_load_microcode(cpu, firmware->data, firmware->size);
 
+       release_firmware(firmware);
+
        return ret;
 }
 
@@ -325,31 +331,7 @@ static void microcode_fini_cpu_amd(int cpu)
        uci->mc = NULL;
 }
 
-void init_microcode_amd(struct device *device)
-{
-       const char *fw_name = "amd-ucode/microcode_amd.bin";
-       struct cpuinfo_x86 *c = &boot_cpu_data;
-
-       WARN_ON(c->x86_vendor != X86_VENDOR_AMD);
-
-       if (c->x86 < 0x10) {
-               pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
-               return;
-       }
-       supported_cpu = 1;
-
-       if (request_firmware(&firmware, fw_name, device))
-               pr_err("failed to load file %s\n", fw_name);
-}
-
-void fini_microcode_amd(void)
-{
-       release_firmware(firmware);
-}
-
 static struct microcode_ops microcode_amd_ops = {
-       .init                             = init_microcode_amd,
-       .fini                             = fini_microcode_amd,
        .request_microcode_user           = request_microcode_user,
        .request_microcode_fw             = request_microcode_fw,
        .collect_cpu_info                 = collect_cpu_info_amd,
index 0c8632433090d6e90de8dff937f7fcf7719e6e0b..cceb5bc3c3c258c2a6f1957ee152f00c7310d462 100644 (file)
@@ -521,9 +521,6 @@ static int __init microcode_init(void)
                return PTR_ERR(microcode_pdev);
        }
 
-       if (microcode_ops->init)
-               microcode_ops->init(&microcode_pdev->dev);
-
        get_online_cpus();
        mutex_lock(&microcode_mutex);
 
@@ -566,9 +563,6 @@ static void __exit microcode_exit(void)
 
        platform_device_unregister(microcode_pdev);
 
-       if (microcode_ops->fini)
-               microcode_ops->fini();
-
        microcode_ops = NULL;
 
        pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
index ebd193e476ca8812fa81a06e0def726d486d6239..85a343e28937770e383aec0d1320140bc7e0baf8 100644 (file)
@@ -328,7 +328,7 @@ static int apply_microcode(int cpu)
                       cpu_num, mc_intel->hdr.rev);
                return -1;
        }
-       pr_info("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x \n",
+       pr_info("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x\n",
                cpu_num, val[1],
                mc_intel->hdr.date & 0xffff,
                mc_intel->hdr.date >> 24,
index 40b54ceb68b560dc61ec81b5d7222298057bb133..a2c1edd2d3acdaf3dc4dfd9cb9b8abc41c56e2ad 100644 (file)
@@ -359,13 +359,6 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
                x86_init.mpparse.mpc_record(1);
        }
 
-#ifdef CONFIG_X86_BIGSMP
-       generic_bigsmp_probe();
-#endif
-
-       if (apic->setup_apic_routing)
-               apic->setup_apic_routing();
-
        if (!num_processors)
                printk(KERN_ERR "MPTABLE: no processors registered!\n");
        return num_processors;
index 4bd93c9b2b2716d86367c41631ffa1a0c4625a83..206735ac8cbdbaf053e039fb5f6e4fb5c50a5f8a 100644 (file)
@@ -285,7 +285,7 @@ static void __exit msr_exit(void)
        for_each_online_cpu(cpu)
                msr_device_destroy(cpu);
        class_destroy(msr_class);
-       unregister_chrdev(MSR_MAJOR, "cpu/msr");
+       __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
        unregister_hotcpu_notifier(&msr_class_cpu_notifier);
 }
 
index c6ee241c8a980043ff8291cf64c5ae2c84fb5ce5..02d678065d7d1f8a9d43a7c6efd58b5e83c61604 100644 (file)
@@ -92,6 +92,13 @@ void exit_thread(void)
        }
 }
 
+void show_regs(struct pt_regs *regs)
+{
+       show_registers(regs);
+       show_trace(NULL, regs, (unsigned long *)kernel_stack_pointer(regs),
+                  regs->bp);
+}
+
 void show_regs_common(void)
 {
        const char *board, *product;
@@ -115,18 +122,6 @@ void flush_thread(void)
 {
        struct task_struct *tsk = current;
 
-#ifdef CONFIG_X86_64
-       if (test_tsk_thread_flag(tsk, TIF_ABI_PENDING)) {
-               clear_tsk_thread_flag(tsk, TIF_ABI_PENDING);
-               if (test_tsk_thread_flag(tsk, TIF_IA32)) {
-                       clear_tsk_thread_flag(tsk, TIF_IA32);
-               } else {
-                       set_tsk_thread_flag(tsk, TIF_IA32);
-                       current_thread_info()->status |= TS_COMPAT;
-               }
-       }
-#endif
-
        flush_ptrace_hw_breakpoint(tsk);
        memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
        /*
@@ -288,6 +283,8 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
        regs.es = __USER_DS;
        regs.fs = __KERNEL_PERCPU;
        regs.gs = __KERNEL_STACK_CANARY;
+#else
+       regs.ss = __KERNEL_DS;
 #endif
 
        regs.orig_ax = -1;
index 37ad1e046aae81a7ecdcb367078081adfb647065..f6c62667e30c89db95a8f2bc7054a6c12108f0dd 100644 (file)
@@ -174,12 +174,6 @@ void __show_regs(struct pt_regs *regs, int all)
                        d6, d7);
 }
 
-void show_regs(struct pt_regs *regs)
-{
-       show_registers(regs);
-       show_trace(NULL, regs, &regs->sp, regs->bp);
-}
-
 void release_thread(struct task_struct *dead_task)
 {
        BUG_ON(dead_task->mm);
index f9e033150cdf9b78e9f46f118092c51b45c4ffc8..dc9690b4c4cccf5450a8f49c0aec3bbdb1a86f78 100644 (file)
@@ -211,12 +211,6 @@ void __show_regs(struct pt_regs *regs, int all)
        printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
 }
 
-void show_regs(struct pt_regs *regs)
-{
-       show_registers(regs);
-       show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
-}
-
 void release_thread(struct task_struct *dead_task)
 {
        if (dead_task->mm) {
@@ -521,6 +515,18 @@ void set_personality_64bit(void)
        current->personality &= ~READ_IMPLIES_EXEC;
 }
 
+void set_personality_ia32(void)
+{
+       /* inherit personality from parent */
+
+       /* Make sure to be in 32bit mode */
+       set_thread_flag(TIF_IA32);
+       current->personality |= force_personality32;
+
+       /* Prepare the first "return" to user space */
+       current_thread_info()->status |= TS_COMPAT;
+}
+
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long stack;
index 017d937639fef87694eea7cd3cbbf95efb163d37..2d96aab82a4887881e20cbc7336eafb732bace39 100644 (file)
@@ -48,6 +48,7 @@ enum x86_regset {
        REGSET_FP,
        REGSET_XFP,
        REGSET_IOPERM64 = REGSET_XFP,
+       REGSET_XSTATE,
        REGSET_TLS,
        REGSET_IOPERM32,
 };
@@ -140,30 +141,6 @@ static const int arg_offs_table[] = {
 #endif
 };
 
-/**
- * regs_get_argument_nth() - get Nth argument at function call
- * @regs:      pt_regs which contains registers at function entry.
- * @n:         argument number.
- *
- * regs_get_argument_nth() returns @n th argument of a function call.
- * Since usually the kernel stack will be changed right after function entry,
- * you must use this at function entry. If the @n th entry is NOT in the
- * kernel stack or pt_regs, this returns 0.
- */
-unsigned long regs_get_argument_nth(struct pt_regs *regs, unsigned int n)
-{
-       if (n < ARRAY_SIZE(arg_offs_table))
-               return *(unsigned long *)((char *)regs + arg_offs_table[n]);
-       else {
-               /*
-                * The typical case: arg n is on the stack.
-                * (Note: stack[0] = return address, so skip it)
-                */
-               n -= ARRAY_SIZE(arg_offs_table);
-               return regs_get_kernel_stack_nth(regs, 1 + n);
-       }
-}
-
 /*
  * does not yet catch signals sent when the child dies.
  * in exit.c or in signal.c.
@@ -702,7 +679,7 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
        } else if (n == 6) {
                val = thread->debugreg6;
         } else if (n == 7) {
-               val = ptrace_get_dr7(thread->ptrace_bps);
+               val = thread->ptrace_dr7;
        }
        return val;
 }
@@ -778,8 +755,11 @@ int ptrace_set_debugreg(struct task_struct *tsk, int n, unsigned long val)
                        return rc;
        }
        /* All that's left is DR7 */
-       if (n == 7)
+       if (n == 7) {
                rc = ptrace_write_dr7(tsk, val);
+               if (!rc)
+                       thread->ptrace_dr7 = val;
+       }
 
 ret_path:
        return rc;
@@ -1584,7 +1564,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
 
 #ifdef CONFIG_X86_64
 
-static const struct user_regset x86_64_regsets[] = {
+static struct user_regset x86_64_regsets[] __read_mostly = {
        [REGSET_GENERAL] = {
                .core_note_type = NT_PRSTATUS,
                .n = sizeof(struct user_regs_struct) / sizeof(long),
@@ -1597,6 +1577,12 @@ static const struct user_regset x86_64_regsets[] = {
                .size = sizeof(long), .align = sizeof(long),
                .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
        },
+       [REGSET_XSTATE] = {
+               .core_note_type = NT_X86_XSTATE,
+               .size = sizeof(u64), .align = sizeof(u64),
+               .active = xstateregs_active, .get = xstateregs_get,
+               .set = xstateregs_set
+       },
        [REGSET_IOPERM64] = {
                .core_note_type = NT_386_IOPERM,
                .n = IO_BITMAP_LONGS,
@@ -1622,7 +1608,7 @@ static const struct user_regset_view user_x86_64_view = {
 #endif /* CONFIG_X86_64 */
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
-static const struct user_regset x86_32_regsets[] = {
+static struct user_regset x86_32_regsets[] __read_mostly = {
        [REGSET_GENERAL] = {
                .core_note_type = NT_PRSTATUS,
                .n = sizeof(struct user_regs_struct32) / sizeof(u32),
@@ -1641,6 +1627,12 @@ static const struct user_regset x86_32_regsets[] = {
                .size = sizeof(u32), .align = sizeof(u32),
                .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
        },
+       [REGSET_XSTATE] = {
+               .core_note_type = NT_X86_XSTATE,
+               .size = sizeof(u64), .align = sizeof(u64),
+               .active = xstateregs_active, .get = xstateregs_get,
+               .set = xstateregs_set
+       },
        [REGSET_TLS] = {
                .core_note_type = NT_386_TLS,
                .n = GDT_ENTRY_TLS_ENTRIES, .bias = GDT_ENTRY_TLS_MIN,
@@ -1663,6 +1655,23 @@ static const struct user_regset_view user_x86_32_view = {
 };
 #endif
 
+/*
+ * This represents bytes 464..511 in the memory layout exported through
+ * the REGSET_XSTATE interface.
+ */
+u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
+
+void update_regset_xstate_info(unsigned int size, u64 xstate_mask)
+{
+#ifdef CONFIG_X86_64
+       x86_64_regsets[REGSET_XSTATE].n = size / sizeof(u64);
+#endif
+#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
+       x86_32_regsets[REGSET_XSTATE].n = size / sizeof(u64);
+#endif
+       xstate_fx_sw_bytes[USER_XSTATE_XCR0_WORD] = xstate_mask;
+}
+
 const struct user_regset_view *task_user_regset_view(struct task_struct *task)
 {
 #ifdef CONFIG_IA32_EMULATION
index 18093d7498f0d70144c19cbc954a644decda597d..12e9feaa2f7aba947b65ca2fe3611be81321a8f1 100644 (file)
@@ -491,6 +491,19 @@ void force_hpet_resume(void)
                break;
        }
 }
+
+/*
+ * HPET MSI on some boards (ATI SB700/SB800) has side effect on
+ * floppy DMA. Disable HPET MSI on such platforms.
+ */
+static void force_disable_hpet_msi(struct pci_dev *unused)
+{
+       hpet_msi_disable = 1;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
+                        force_disable_hpet_msi);
+
 #endif
 
 #if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
index 1545bc0c98454ebebc070fef0cd62f89be69cb4a..704bddcdf64dd2f53a3bb81a1741388ab57f9bf4 100644 (file)
@@ -203,6 +203,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
                },
        },
+       {       /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G*/
+               .callback = set_bios_reboot,
+               .ident = "Dell OptiPlex 760",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
+                       DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
+               },
+       },
        {       /* Handle problems with rebooting on Dell 2400's */
                .callback = set_bios_reboot,
                .ident = "Dell PowerEdge 2400",
index f7b8b9894b226fd8498ab5f886381f68be2541c2..cb42109a55b430c42b05a072c99eef2c891ed48c 100644 (file)
 unsigned long max_low_pfn_mapped;
 unsigned long max_pfn_mapped;
 
+#ifdef CONFIG_DMI
 RESERVE_BRK(dmi_alloc, 65536);
+#endif
 
 unsigned int boot_cpu_id __read_mostly;
 
@@ -642,23 +644,48 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
                        DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
                },
        },
-       {
        /*
-        * AMI BIOS with low memory corruption was found on Intel DG45ID board.
-        * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
+        * AMI BIOS with low memory corruption was found on Intel DG45ID and
+        * DG45FC boards.
+        * It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
         * match only DMI_BOARD_NAME and see if there is more bad products
         * with this vendor.
         */
+       {
                .callback = dmi_low_memory_corruption,
                .ident = "AMI BIOS",
                .matches = {
                        DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
                },
        },
+       {
+               .callback = dmi_low_memory_corruption,
+               .ident = "AMI BIOS",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
+               },
+       },
 #endif
        {}
 };
 
+static void __init trim_bios_range(void)
+{
+       /*
+        * A special case is the first 4Kb of memory;
+        * This is a BIOS owned area, not kernel ram, but generally
+        * not listed as such in the E820 table.
+        */
+       e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED);
+       /*
+        * special case: Some BIOSen report the PC BIOS
+        * area (640->1Mb) as ram even though it is not.
+        * take them out.
+        */
+       e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+       sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -822,7 +849,7 @@ void __init setup_arch(char **cmdline_p)
        insert_resource(&iomem_resource, &data_resource);
        insert_resource(&iomem_resource, &bss_resource);
 
-
+       trim_bios_range();
 #ifdef CONFIG_X86_32
        if (ppro_with_ram_bug()) {
                e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
index 678d0b8c26f3152c67a833f3e782cb15c9d0a61b..9b4401115ea1813b002b84a4f7f2bb8a8d1a644f 100644 (file)
@@ -320,6 +320,7 @@ notrace static void __cpuinit start_secondary(void *unused)
        unlock_vector_lock();
        ipi_call_unlock();
        per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
+       x86_platform.nmi_init();
 
        /* enable local interrupts */
        local_irq_enable();
@@ -1083,9 +1084,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
        set_cpu_sibling_map(0);
 
        enable_IR_x2apic();
-#ifdef CONFIG_X86_64
        default_setup_apic_routing();
-#endif
 
        if (smp_sanity_check(max_cpus) < 0) {
                printk(KERN_INFO "SMP disabled\n");
index 33399176512a8a2c4c718d53ad76bdea631bd46e..1168e44541887e441e0cb8422cdaf67e86bfe4e5 100644 (file)
@@ -534,6 +534,9 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 
        get_debugreg(dr6, 6);
 
+       /* Filter out all the reserved bits which are preset to 1 */
+       dr6 &= ~DR6_RESERVED;
+
        /* Catch kmemcheck conditions first of all! */
        if ((dr6 & DR_STEP) && kmemcheck_trap(regs))
                return;
index 597683aa5ba0ba3ef800ab39179669ded4e3aa57..208a857c679f99a9dd7e1902f35b8b56d16a0fca 100644 (file)
@@ -740,7 +740,7 @@ static cycle_t __vsyscall_fn vread_tsc(void)
 }
 #endif
 
-static void resume_tsc(void)
+static void resume_tsc(struct clocksource *cs)
 {
        clocksource_tsc.cycle_last = 0;
 }
@@ -806,7 +806,7 @@ static void __init check_system_tsc_reliable(void)
        unsigned long res_low, res_high;
 
        rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
-       /* Geode_LX - the OLPC CPU has a possibly a very reliable TSC */
+       /* Geode_LX - the OLPC CPU has a very reliable TSC */
        if (res_low & RTSC_SUSP)
                tsc_clocksource_reliable = 1;
 #endif
index 36afb98675a4b51fa53b76c72ef2d6cfc4963302..309c70fb77597b62d38a49778e6c63f4f4a0e2d6 100644 (file)
@@ -54,19 +54,19 @@ static int __init sgi_uv_sysfs_init(void)
        if (!sgi_uv_kobj)
                sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
        if (!sgi_uv_kobj) {
-               printk(KERN_WARNING "kobject_create_and_add sgi_uv failed \n");
+               printk(KERN_WARNING "kobject_create_and_add sgi_uv failed\n");
                return -EINVAL;
        }
 
        ret = sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
        if (ret) {
-               printk(KERN_WARNING "sysfs_create_file partition_id failed \n");
+               printk(KERN_WARNING "sysfs_create_file partition_id failed\n");
                return ret;
        }
 
        ret = sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
        if (ret) {
-               printk(KERN_WARNING "sysfs_create_file coherence_id failed \n");
+               printk(KERN_WARNING "sysfs_create_file coherence_id failed\n");
                return ret;
        }
 
index 3c84aa001c118275829783da04a5cdda9557a47d..2b75ef638dbc6f0716d02c58dd23cc8a97acc45a 100644 (file)
@@ -282,10 +282,21 @@ static int uv_rtc_unset_timer(int cpu, int force)
 
 /*
  * Read the RTC.
+ *
+ * Starting with HUB rev 2.0, the UV RTC register is replicated across all
+ * cachelines of it's own page.  This allows faster simultaneous reads
+ * from a given socket.
  */
 static cycle_t uv_read_rtc(struct clocksource *cs)
 {
-       return (cycle_t)uv_read_local_mmr(UVH_RTC);
+       unsigned long offset;
+
+       if (uv_get_min_hub_revision_id() == 1)
+               offset = 0;
+       else
+               offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;
+
+       return (cycle_t)uv_read_local_mmr(UVH_RTC | offset);
 }
 
 /*
index 619f7f88b8cc6aacacc1b828be517b91326dc1ca..693920b22496f13f5e67384168ae6f4a79cc9235 100644 (file)
@@ -26,7 +26,8 @@ EXPORT_SYMBOL(__put_user_2);
 EXPORT_SYMBOL(__put_user_4);
 EXPORT_SYMBOL(__put_user_8);
 
-EXPORT_SYMBOL(copy_user_generic);
+EXPORT_SYMBOL(copy_user_generic_string);
+EXPORT_SYMBOL(copy_user_generic_unrolled);
 EXPORT_SYMBOL(__copy_user_nocache);
 EXPORT_SYMBOL(_copy_from_user);
 EXPORT_SYMBOL(_copy_to_user);
index ccd179dec36e8f82da0b6484e7307dda16a7ed30..ee5746c946283284db77d153354ffa962b028c9f 100644 (file)
@@ -76,10 +76,13 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
        .setup_percpu_clockev           = setup_secondary_APIC_clock,
 };
 
+static void default_nmi_init(void) { };
+
 struct x86_platform_ops x86_platform = {
        .calibrate_tsc                  = native_calibrate_tsc,
        .get_wallclock                  = mach_get_cmos_time,
        .set_wallclock                  = mach_set_rtc_mmss,
        .iommu_shutdown                 = iommu_shutdown_noop,
        .is_untracked_pat_range         = is_ISA_range,
+       .nmi_init                       = default_nmi_init
 };
index c5ee17e8c6d95628809825073d7681db6d842943..782c3a362ec611af114dd73144fe706c9d70fd16 100644 (file)
@@ -337,6 +337,7 @@ void __ref xsave_cntxt_init(void)
        cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx);
        xstate_size = ebx;
 
+       update_regset_xstate_info(xstate_size, pcntxt_mask);
        prepare_fx_sw_frame();
 
        setup_xstate_init();
index 296aba49472ae3cdcf7580bc79d60d83ed48ce3e..15578f180e596bee481f10451ec375b6ceb37f26 100644 (file)
@@ -467,6 +467,9 @@ static int pit_ioport_read(struct kvm_io_device *this,
                return -EOPNOTSUPP;
 
        addr &= KVM_PIT_CHANNEL_MASK;
+       if (addr == 3)
+               return 0;
+
        s = &pit_state->channels[addr];
 
        mutex_lock(&pit_state->lock);
index 3063a0c4858b462a23dd8e2b7d6b81342a203fc1..ba8c045da7820fceea3286b2a60c1378fe28265d 100644 (file)
@@ -373,6 +373,12 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
                if (unlikely(!apic_enabled(apic)))
                        break;
 
+               if (trig_mode) {
+                       apic_debug("level trig mode for vector %d", vector);
+                       apic_set_vector(vector, apic->regs + APIC_TMR);
+               } else
+                       apic_clear_vector(vector, apic->regs + APIC_TMR);
+
                result = !apic_test_and_set_irr(vector, apic);
                trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode,
                                          trig_mode, vector, !result);
@@ -383,11 +389,6 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
                        break;
                }
 
-               if (trig_mode) {
-                       apic_debug("level trig mode for vector %d", vector);
-                       apic_set_vector(vector, apic->regs + APIC_TMR);
-               } else
-                       apic_clear_vector(vector, apic->regs + APIC_TMR);
                kvm_vcpu_kick(vcpu);
                break;
 
index 4c3e5b2314cb1c8ca94ff13909af2061b702466d..89a49fb46a275e6eebcf2609f3870696b3a3945b 100644 (file)
@@ -477,7 +477,7 @@ static int host_mapping_level(struct kvm *kvm, gfn_t gfn)
 
        addr = gfn_to_hva(kvm, gfn);
        if (kvm_is_error_hva(addr))
-               return page_size;
+               return PT_PAGE_TABLE_LEVEL;
 
        down_read(&current->mm->mmap_sem);
        vma = find_vma(current->mm, addr);
@@ -515,11 +515,9 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
        if (host_level == PT_PAGE_TABLE_LEVEL)
                return host_level;
 
-       for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level) {
-
+       for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level)
                if (has_wrprotected_page(vcpu->kvm, large_gfn, level))
                        break;
-       }
 
        return level - 1;
 }
index 58a0f1e8859655154da07037604ebd5fb1872c7f..ede2131a9225eb00530aafb62962e383ab2a7101 100644 (file)
@@ -150,7 +150,9 @@ walk:
                walker->table_gfn[walker->level - 1] = table_gfn;
                walker->pte_gpa[walker->level - 1] = pte_gpa;
 
-               kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte));
+               if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte)))
+                       goto not_present;
+
                trace_kvm_mmu_paging_element(pte, walker->level);
 
                if (!is_present_gpte(pte))
index 6651dbf58675ee7ec8d9e7f3e145dce09953e054..a1e1bc9d412dadca87e4a7be6c7903ab0768a8a8 100644 (file)
@@ -670,7 +670,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
 {
        static int version;
        struct pvclock_wall_clock wc;
-       struct timespec now, sys, boot;
+       struct timespec boot;
 
        if (!wall_clock)
                return;
@@ -685,9 +685,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
         * wall clock specified here.  guest system time equals host
         * system time for us, thus we must fill in host boot time here.
         */
-       now = current_kernel_time();
-       ktime_get_ts(&sys);
-       boot = ns_to_timespec(timespec_to_ns(&now) - timespec_to_ns(&sys));
+       getboottime(&boot);
 
        wc.sec = boot.tv_sec;
        wc.nsec = boot.tv_nsec;
@@ -762,6 +760,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
        local_irq_save(flags);
        kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
        ktime_get_ts(&ts);
+       monotonic_to_bootbased(&ts);
        local_irq_restore(flags);
 
        /* With all the info we got, fill in the values */
@@ -5072,12 +5071,13 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
                                       GFP_KERNEL);
        if (!vcpu->arch.mce_banks) {
                r = -ENOMEM;
-               goto fail_mmu_destroy;
+               goto fail_free_lapic;
        }
        vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
 
        return 0;
-
+fail_free_lapic:
+       kvm_free_lapic(vcpu);
 fail_mmu_destroy:
        kvm_mmu_destroy(vcpu);
 fail_free_pio_data:
@@ -5088,6 +5088,7 @@ fail:
 
 void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 {
+       kfree(vcpu->arch.mce_banks);
        kvm_free_lapic(vcpu);
        down_read(&vcpu->kvm->slots_lock);
        kvm_mmu_destroy(vcpu);
index cffd754f30396f447b9eb8955b8cccbad7420107..419386c24b8205c3a22c993b3da48f448bf96283 100644 (file)
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
 
 clean-files := inat-tables.c
 
-obj-$(CONFIG_SMP) += msr-smp.o
+obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
 
 lib-y := delay.o
 lib-y += thunk_$(BITS).o
@@ -34,9 +34,10 @@ ifneq ($(CONFIG_X86_CMPXCHG64),y)
 endif
         lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
 else
-        obj-y += io_64.o iomap_copy_64.o
+        obj-y += iomap_copy_64.o
         lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
         lib-y += thunk_64.o clear_page_64.o copy_page_64.o
         lib-y += memmove_64.o memset_64.o
         lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
+       lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem_64.o
 endif
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
new file mode 100644 (file)
index 0000000..a3c6688
--- /dev/null
@@ -0,0 +1,19 @@
+#include <linux/smp.h>
+#include <linux/module.h>
+
+static void __wbinvd(void *dummy)
+{
+       wbinvd();
+}
+
+void wbinvd_on_cpu(int cpu)
+{
+       smp_call_function_single(cpu, __wbinvd, NULL, 1);
+}
+EXPORT_SYMBOL(wbinvd_on_cpu);
+
+int wbinvd_on_all_cpus(void)
+{
+       return on_each_cpu(__wbinvd, NULL, 1);
+}
+EXPORT_SYMBOL(wbinvd_on_all_cpus);
index cf889d4e076a1059db5238d00a5757a96c7dcac4..71100c98e337026e39afbb059c520f95edb9a01e 100644 (file)
@@ -90,12 +90,6 @@ ENTRY(_copy_from_user)
        CFI_ENDPROC
 ENDPROC(_copy_from_user)
 
-ENTRY(copy_user_generic)
-       CFI_STARTPROC
-       ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
-       CFI_ENDPROC
-ENDPROC(copy_user_generic)
-
        .section .fixup,"ax"
        /* must zero dest */
 ENTRY(bad_from_user)
diff --git a/arch/x86/lib/io_64.c b/arch/x86/lib/io_64.c
deleted file mode 100644 (file)
index 3f1eb59..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <linux/string.h>
-#include <linux/module.h>
-#include <asm/io.h>
-
-void __memcpy_toio(unsigned long dst, const void *src, unsigned len)
-{
-       __inline_memcpy((void *)dst, src, len);
-}
-EXPORT_SYMBOL(__memcpy_toio);
-
-void __memcpy_fromio(void *dst, unsigned long src, unsigned len)
-{
-       __inline_memcpy(dst, (const void *)src, len);
-}
-EXPORT_SYMBOL(__memcpy_fromio);
-
-void memset_io(volatile void __iomem *a, int b, size_t c)
-{
-       /*
-        * TODO: memset can mangle the IO patterns quite a bit.
-        * perhaps it would be better to use a dumb one:
-        */
-       memset((void *)a, b, c);
-}
-EXPORT_SYMBOL(memset_io);
index ad5441ed1b57fdfffe6822dede52cad626ae2b39..f82e884928af6643854f64df5899c42ab6fee9b2 100644 (file)
 /*
  * memcpy_c() - fast string ops (REP MOVSQ) based variant.
  *
- * Calls to this get patched into the kernel image via the
+ * This gets patched over the unrolled variant (below) via the
  * alternative instructions framework:
  */
-       ALIGN
-memcpy_c:
-       CFI_STARTPROC
+       .section .altinstr_replacement, "ax", @progbits
+.Lmemcpy_c:
        movq %rdi, %rax
 
        movl %edx, %ecx
@@ -35,8 +34,8 @@ memcpy_c:
        movl %edx, %ecx
        rep movsb
        ret
-       CFI_ENDPROC
-ENDPROC(memcpy_c)
+.Lmemcpy_e:
+       .previous
 
 ENTRY(__memcpy)
 ENTRY(memcpy)
@@ -128,16 +127,10 @@ ENDPROC(__memcpy)
         * It is also a lot simpler. Use this when possible:
         */
 
-       .section .altinstr_replacement, "ax"
-1:     .byte 0xeb                              /* jmp <disp8> */
-       .byte (memcpy_c - memcpy) - (2f - 1b)   /* offset */
-2:
-       .previous
-
        .section .altinstructions, "a"
        .align 8
        .quad memcpy
-       .quad 1b
+       .quad .Lmemcpy_c
        .byte X86_FEATURE_REP_GOOD
 
        /*
@@ -145,6 +138,6 @@ ENDPROC(__memcpy)
         * so it is silly to overwrite itself with nops - reboot is the
         * only outcome...
         */
-       .byte 2b - 1b
-       .byte 2b - 1b
+       .byte .Lmemcpy_e - .Lmemcpy_c
+       .byte .Lmemcpy_e - .Lmemcpy_c
        .previous
index 2c5948116bd21731d4a85712fddd00d3943fd728..e88d3b81644a8736bcba56acaef56328c39e77ff 100644 (file)
@@ -12,9 +12,8 @@
  * 
  * rax   original destination
  */    
-       ALIGN
-memset_c:
-       CFI_STARTPROC
+       .section .altinstr_replacement, "ax", @progbits
+.Lmemset_c:
        movq %rdi,%r9
        movl %edx,%r8d
        andl $7,%r8d
@@ -29,8 +28,8 @@ memset_c:
        rep stosb
        movq %r9,%rax
        ret
-       CFI_ENDPROC
-ENDPROC(memset_c)
+.Lmemset_e:
+       .previous
 
 ENTRY(memset)
 ENTRY(__memset)
@@ -118,16 +117,11 @@ ENDPROC(__memset)
 
 #include <asm/cpufeature.h>
 
-       .section .altinstr_replacement,"ax"
-1:     .byte 0xeb                              /* jmp <disp8> */
-       .byte (memset_c - memset) - (2f - 1b)   /* offset */
-2:
-       .previous
        .section .altinstructions,"a"
        .align 8
        .quad memset
-       .quad 1b
+       .quad .Lmemset_c
        .byte X86_FEATURE_REP_GOOD
        .byte .Lfinal - memset
-       .byte 2b - 1b
+       .byte .Lmemset_e - .Lmemset_c
        .previous
diff --git a/arch/x86/lib/rwsem_64.S b/arch/x86/lib/rwsem_64.S
new file mode 100644 (file)
index 0000000..15acecf
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * x86-64 rwsem wrappers
+ *
+ * This interfaces the inline asm code to the slow-path
+ * C routines. We need to save the call-clobbered regs
+ * that the asm does not mark as clobbered, and move the
+ * argument from %rax to %rdi.
+ *
+ * NOTE! We don't need to save %rax, because the functions
+ * will always return the semaphore pointer in %rax (which
+ * is also the input argument to these helpers)
+ *
+ * The following can clobber %rdx because the asm clobbers it:
+ *   call_rwsem_down_write_failed
+ *   call_rwsem_wake
+ * but %rdi, %rsi, %rcx, %r8-r11 always need saving.
+ */
+
+#include <linux/linkage.h>
+#include <asm/rwlock.h>
+#include <asm/alternative-asm.h>
+#include <asm/frame.h>
+#include <asm/dwarf2.h>
+
+#define save_common_regs \
+       pushq %rdi; \
+       pushq %rsi; \
+       pushq %rcx; \
+       pushq %r8; \
+       pushq %r9; \
+       pushq %r10; \
+       pushq %r11
+
+#define restore_common_regs \
+       popq %r11; \
+       popq %r10; \
+       popq %r9; \
+       popq %r8; \
+       popq %rcx; \
+       popq %rsi; \
+       popq %rdi
+
+/* Fix up special calling conventions */
+ENTRY(call_rwsem_down_read_failed)
+       save_common_regs
+       pushq %rdx
+       movq %rax,%rdi
+       call rwsem_down_read_failed
+       popq %rdx
+       restore_common_regs
+       ret
+       ENDPROC(call_rwsem_down_read_failed)
+
+ENTRY(call_rwsem_down_write_failed)
+       save_common_regs
+       movq %rax,%rdi
+       call rwsem_down_write_failed
+       restore_common_regs
+       ret
+       ENDPROC(call_rwsem_down_write_failed)
+
+ENTRY(call_rwsem_wake)
+       decw %dx    /* do nothing if still outstanding active readers */
+       jnz 1f
+       save_common_regs
+       movq %rax,%rdi
+       call rwsem_wake
+       restore_common_regs
+1:     ret
+       ENDPROC(call_rwsem_wake)
+
+/* Fix up special calling conventions */
+ENTRY(call_rwsem_downgrade_wake)
+       save_common_regs
+       pushq %rdx
+       movq %rax,%rdi
+       call rwsem_downgrade_wake
+       popq %rdx
+       restore_common_regs
+       ret
+       ENDPROC(call_rwsem_downgrade_wake)
index 71da1bca13cbb9fde26f59100f1b9b3b30f3a8e5..738e6593799dcce1973d5d082b6c0a732107cbcd 100644 (file)
@@ -18,7 +18,7 @@ static inline pte_t gup_get_pte(pte_t *ptep)
 #else
        /*
         * With get_user_pages_fast, we walk down the pagetables without taking
-        * any locks.  For this we would like to load the pointers atoimcally,
+        * any locks.  For this we would like to load the pointers atomically,
         * but that is not possible (without expensive cmpxchg8b) on PAE.  What
         * we do have is the guarantee that a pte will only either go from not
         * present to present, or present to not present or both -- it will not
index d406c5239019ee0e2e9609c826f1a2ba8564c693..e71c5cbc8f3561f6ce701582377749155af587b8 100644 (file)
@@ -266,16 +266,9 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
        if (!after_bootmem)
                find_early_table_space(end, use_pse, use_gbpages);
 
-#ifdef CONFIG_X86_32
-       for (i = 0; i < nr_range; i++)
-               kernel_physical_mapping_init(mr[i].start, mr[i].end,
-                                            mr[i].page_size_mask);
-       ret = end;
-#else /* CONFIG_X86_64 */
        for (i = 0; i < nr_range; i++)
                ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
                                                   mr[i].page_size_mask);
-#endif
 
 #ifdef CONFIG_X86_32
        early_ioremap_page_table_range_init();
index 9a0c258a86be6b023b59d7880e47e7c38290dfac..2226f2c70ea3ffc090b670c06e7eddbdd8fc84b5 100644 (file)
@@ -241,6 +241,7 @@ kernel_physical_mapping_init(unsigned long start,
                             unsigned long page_size_mask)
 {
        int use_pse = page_size_mask == (1<<PG_LEVEL_2M);
+       unsigned long last_map_addr = end;
        unsigned long start_pfn, end_pfn;
        pgd_t *pgd_base = swapper_pg_dir;
        int pgd_idx, pmd_idx, pte_ofs;
@@ -341,9 +342,10 @@ repeat:
                                        prot = PAGE_KERNEL_EXEC;
 
                                pages_4k++;
-                               if (mapping_iter == 1)
+                               if (mapping_iter == 1) {
                                        set_pte(pte, pfn_pte(pfn, init_prot));
-                               else
+                                       last_map_addr = (pfn << PAGE_SHIFT) + PAGE_SIZE;
+                               } else
                                        set_pte(pte, pfn_pte(pfn, prot));
                        }
                }
@@ -368,7 +370,7 @@ repeat:
                mapping_iter = 2;
                goto repeat;
        }
-       return 0;
+       return last_map_addr;
 }
 
 pte_t *kmap_pte;
index 5198b9bb34ef8eb86da0be3e6962a2456d4f9d64..69ddfbd911357534125bc5bb300776562a747ad8 100644 (file)
@@ -49,6 +49,7 @@
 #include <asm/numa.h>
 #include <asm/cacheflush.h>
 #include <asm/init.h>
+#include <linux/bootmem.h>
 
 static unsigned long dma_reserve __initdata;
 
@@ -615,6 +616,21 @@ void __init paging_init(void)
  * Memory hotplug specific functions
  */
 #ifdef CONFIG_MEMORY_HOTPLUG
+/*
+ * After memory hotplug the variables max_pfn, max_low_pfn and high_memory need
+ * updating.
+ */
+static void  update_end_of_memory_vars(u64 start, u64 size)
+{
+       unsigned long end_pfn = PFN_UP(start + size);
+
+       if (end_pfn > max_pfn) {
+               max_pfn = end_pfn;
+               max_low_pfn = end_pfn;
+               high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
+       }
+}
+
 /*
  * Memory is added always to NORMAL zone. This means you will never get
  * additional DMA/DMA32 memory.
@@ -634,6 +650,9 @@ int arch_add_memory(int nid, u64 start, u64 size)
        ret = __add_pages(nid, zone, start_pfn, nr_pages);
        WARN_ON_ONCE(ret);
 
+       /* update max_pfn, max_low_pfn and high_memory */
+       update_end_of_memory_vars(start, size);
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(arch_add_memory);
index c246d259822d8b5a3d32a35275368a5bcbbf19b8..5eb1ba74a3a933e9c82f18773395a57c0954a3ed 100644 (file)
 
 #include "physaddr.h"
 
-int page_is_ram(unsigned long pagenr)
-{
-       resource_size_t addr, end;
-       int i;
-
-       /*
-        * A special case is the first 4Kb of memory;
-        * This is a BIOS owned area, not kernel ram, but generally
-        * not listed as such in the E820 table.
-        */
-       if (pagenr == 0)
-               return 0;
-
-       /*
-        * Second special case: Some BIOSen report the PC BIOS
-        * area (640->1Mb) as ram even though it is not.
-        */
-       if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
-                   pagenr < (BIOS_END >> PAGE_SHIFT))
-               return 0;
-
-       for (i = 0; i < e820.nr_map; i++) {
-               /*
-                * Not usable memory:
-                */
-               if (e820.map[i].type != E820_RAM)
-                       continue;
-               addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT;
-               end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
-
-
-               if ((pagenr >= addr) && (pagenr < end))
-                       return 1;
-       }
-       return 0;
-}
-
 /*
  * Fix up the linear direct mapping of the kernel to avoid cache attribute
  * conflicts.
@@ -422,6 +385,10 @@ void __init early_ioremap_init(void)
         * The boot-ioremap range spans multiple pmds, for which
         * we are not prepared:
         */
+#define __FIXADDR_TOP (-PAGE_SIZE)
+       BUILD_BUG_ON((__fix_to_virt(FIX_BTMAP_BEGIN) >> PMD_SHIFT)
+                    != (__fix_to_virt(FIX_BTMAP_END) >> PMD_SHIFT));
+#undef __FIXADDR_TOP
        if (pmd != early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))) {
                WARN_ON(1);
                printk(KERN_WARNING "pmd %p != %p\n",
index 8cc183344140cf1503df9efdc87bdad6e9f23bcf..b3b531a4f8e587e3560b2087e9c483b2cb1b0f93 100644 (file)
@@ -337,7 +337,7 @@ bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
        if (!shadow)
                return true;
 
-       status = kmemcheck_shadow_test(shadow, size);
+       status = kmemcheck_shadow_test_all(shadow, size);
 
        return status == KMEMCHECK_SHADOW_INITIALIZED;
 }
index 3f66b82076a3150b03cd1045202eb4facf1c49f4..aec124214d972703812b68e3f9ff9abf8f851cb5 100644 (file)
@@ -125,12 +125,12 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n)
 
 enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size)
 {
+#ifdef CONFIG_KMEMCHECK_PARTIAL_OK
        uint8_t *x;
        unsigned int i;
 
        x = shadow;
 
-#ifdef CONFIG_KMEMCHECK_PARTIAL_OK
        /*
         * Make sure _some_ bytes are initialized. Gcc frequently generates
         * code to access neighboring bytes.
@@ -139,13 +139,25 @@ enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size)
                if (x[i] == KMEMCHECK_SHADOW_INITIALIZED)
                        return x[i];
        }
+
+       return x[0];
 #else
+       return kmemcheck_shadow_test_all(shadow, size);
+#endif
+}
+
+enum kmemcheck_shadow kmemcheck_shadow_test_all(void *shadow, unsigned int size)
+{
+       uint8_t *x;
+       unsigned int i;
+
+       x = shadow;
+
        /* All bytes must be initialized. */
        for (i = 0; i < size; ++i) {
                if (x[i] != KMEMCHECK_SHADOW_INITIALIZED)
                        return x[i];
        }
-#endif
 
        return x[0];
 }
index af46d9ab9d861b6aea6a867ab446b0ec7a54f24a..ff0b2f70fbcb9368e7266a94f9a4698c70496595 100644 (file)
@@ -11,6 +11,8 @@ enum kmemcheck_shadow {
 void *kmemcheck_shadow_lookup(unsigned long address);
 
 enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size);
+enum kmemcheck_shadow kmemcheck_shadow_test_all(void *shadow,
+                                               unsigned int size);
 void kmemcheck_shadow_set(void *shadow, unsigned int size);
 
 #endif
index c0f6198565eb63592a3cbebaf7c8e538e987b157..536fb682336601bce1cd428faac9cc0b1ed1a20b 100644 (file)
@@ -538,14 +538,15 @@ static int
 kmmio_die_notifier(struct notifier_block *nb, unsigned long val, void *args)
 {
        struct die_args *arg = args;
+       unsigned long* dr6_p = (unsigned long *)ERR_PTR(arg->err);
 
-       if (val == DIE_DEBUG && (arg->err & DR_STEP))
-               if (post_kmmio_handler(arg->err, arg->regs) == 1) {
+       if (val == DIE_DEBUG && (*dr6_p & DR_STEP))
+               if (post_kmmio_handler(*dr6_p, arg->regs) == 1) {
                        /*
                         * Reset the BS bit in dr6 (pointed by args->err) to
                         * denote completion of processing
                         */
-                       (*(unsigned long *)ERR_PTR(arg->err)) &= ~DR_STEP;
+                       *dr6_p &= ~DR_STEP;
                        return NOTIFY_STOP;
                }
 
index c8191defc38a36f16ae60245a60f781229169d06..1dab5194fd9df9f6bead4b0e09d154bd2b26e178 100644 (file)
@@ -71,7 +71,7 @@ static int mmap_is_legacy(void)
        if (current->personality & ADDR_COMPAT_LAYOUT)
                return 1;
 
-       if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
+       if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
                return 1;
 
        return sysctl_legacy_va_layout;
@@ -96,7 +96,7 @@ static unsigned long mmap_rnd(void)
 
 static unsigned long mmap_base(void)
 {
-       unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+       unsigned long gap = rlimit(RLIMIT_STACK);
 
        if (gap < MIN_GAP)
                gap = MIN_GAP;
index 83bbc70d11bb7a03754b88b432781fa142dffe9e..3307ea8bd43a3d8a98a9fe49ead8453894f95229 100644 (file)
@@ -427,7 +427,7 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr,
         * Calculate the number of big nodes that can be allocated as a result
         * of consolidating the remainder.
         */
-       big = ((size & ~FAKE_NODE_MIN_HASH_MASK) & nr_nodes) /
+       big = ((size & ~FAKE_NODE_MIN_HASH_MASK) * nr_nodes) /
                FAKE_NODE_MIN_SIZE;
 
        size &= FAKE_NODE_MIN_HASH_MASK;
@@ -502,77 +502,99 @@ static int __init split_nodes_interleave(u64 addr, u64 max_addr,
 }
 
 /*
- * Splits num_nodes nodes up equally starting at node_start.  The return value
- * is the number of nodes split up and addr is adjusted to be at the end of the
- * last node allocated.
+ * Returns the end address of a node so that there is at least `size' amount of
+ * non-reserved memory or `max_addr' is reached.
  */
-static int __init split_nodes_equally(u64 *addr, u64 max_addr, int node_start,
-                                     int num_nodes)
+static u64 __init find_end_of_node(u64 start, u64 max_addr, u64 size)
 {
-       unsigned int big;
-       u64 size;
-       int i;
-
-       if (num_nodes <= 0)
-               return -1;
-       if (num_nodes > MAX_NUMNODES)
-               num_nodes = MAX_NUMNODES;
-       size = (max_addr - *addr - e820_hole_size(*addr, max_addr)) /
-              num_nodes;
-       /*
-        * Calculate the number of big nodes that can be allocated as a result
-        * of consolidating the leftovers.
-        */
-       big = ((size & ~FAKE_NODE_MIN_HASH_MASK) * num_nodes) /
-             FAKE_NODE_MIN_SIZE;
-
-       /* Round down to nearest FAKE_NODE_MIN_SIZE. */
-       size &= FAKE_NODE_MIN_HASH_MASK;
-       if (!size) {
-               printk(KERN_ERR "Not enough memory for each node.  "
-                      "NUMA emulation disabled.\n");
-               return -1;
-       }
-
-       for (i = node_start; i < num_nodes + node_start; i++) {
-               u64 end = *addr + size;
+       u64 end = start + size;
 
-               if (i < big)
-                       end += FAKE_NODE_MIN_SIZE;
-               /*
-                * The final node can have the remaining system RAM.  Other
-                * nodes receive roughly the same amount of available pages.
-                */
-               if (i == num_nodes + node_start - 1)
+       while (end - start - e820_hole_size(start, end) < size) {
+               end += FAKE_NODE_MIN_SIZE;
+               if (end > max_addr) {
                        end = max_addr;
-               else
-                       while (end - *addr - e820_hole_size(*addr, end) <
-                              size) {
-                               end += FAKE_NODE_MIN_SIZE;
-                               if (end > max_addr) {
-                                       end = max_addr;
-                                       break;
-                               }
-                       }
-               if (setup_node_range(i, addr, end - *addr, max_addr) < 0)
                        break;
+               }
        }
-       return i - node_start + 1;
+       return end;
 }
 
 /*
- * Splits the remaining system RAM into chunks of size.  The remaining memory is
- * always assigned to a final node and can be asymmetric.  Returns the number of
- * nodes split.
+ * Sets up fake nodes of `size' interleaved over physical nodes ranging from
+ * `addr' to `max_addr'.  The return value is the number of nodes allocated.
  */
-static int __init split_nodes_by_size(u64 *addr, u64 max_addr, int node_start,
-                                     u64 size)
+static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size)
 {
-       int i = node_start;
-       size = (size << 20) & FAKE_NODE_MIN_HASH_MASK;
-       while (!setup_node_range(i++, addr, size, max_addr))
-               ;
-       return i - node_start;
+       nodemask_t physnode_mask = NODE_MASK_NONE;
+       u64 min_size;
+       int ret = 0;
+       int i;
+
+       if (!size)
+               return -1;
+       /*
+        * The limit on emulated nodes is MAX_NUMNODES, so the size per node is
+        * increased accordingly if the requested size is too small.  This
+        * creates a uniform distribution of node sizes across the entire
+        * machine (but not necessarily over physical nodes).
+        */
+       min_size = (max_addr - addr - e820_hole_size(addr, max_addr)) /
+                                               MAX_NUMNODES;
+       min_size = max(min_size, FAKE_NODE_MIN_SIZE);
+       if ((min_size & FAKE_NODE_MIN_HASH_MASK) < min_size)
+               min_size = (min_size + FAKE_NODE_MIN_SIZE) &
+                                               FAKE_NODE_MIN_HASH_MASK;
+       if (size < min_size) {
+               pr_err("Fake node size %LuMB too small, increasing to %LuMB\n",
+                       size >> 20, min_size >> 20);
+               size = min_size;
+       }
+       size &= FAKE_NODE_MIN_HASH_MASK;
+
+       for (i = 0; i < MAX_NUMNODES; i++)
+               if (physnodes[i].start != physnodes[i].end)
+                       node_set(i, physnode_mask);
+       /*
+        * Fill physical nodes with fake nodes of size until there is no memory
+        * left on any of them.
+        */
+       while (nodes_weight(physnode_mask)) {
+               for_each_node_mask(i, physnode_mask) {
+                       u64 dma32_end = MAX_DMA32_PFN << PAGE_SHIFT;
+                       u64 end;
+
+                       end = find_end_of_node(physnodes[i].start,
+                                               physnodes[i].end, size);
+                       /*
+                        * If there won't be at least FAKE_NODE_MIN_SIZE of
+                        * non-reserved memory in ZONE_DMA32 for the next node,
+                        * this one must extend to the boundary.
+                        */
+                       if (end < dma32_end && dma32_end - end -
+                           e820_hole_size(end, dma32_end) < FAKE_NODE_MIN_SIZE)
+                               end = dma32_end;
+
+                       /*
+                        * If there won't be enough non-reserved memory for the
+                        * next node, this one must extend to the end of the
+                        * physical node.
+                        */
+                       if (physnodes[i].end - end -
+                           e820_hole_size(end, physnodes[i].end) < size)
+                               end = physnodes[i].end;
+
+                       /*
+                        * Setup the fake node that will be allocated as bootmem
+                        * later.  If setup_node_range() returns non-zero, there
+                        * is no more memory available on this physical node.
+                        */
+                       if (setup_node_range(ret++, &physnodes[i].start,
+                                               end - physnodes[i].start,
+                                               physnodes[i].end) < 0)
+                               node_clear(i, physnode_mask);
+               }
+       }
+       return ret;
 }
 
 /*
@@ -582,87 +604,32 @@ static int __init split_nodes_by_size(u64 *addr, u64 max_addr, int node_start,
 static int __init numa_emulation(unsigned long start_pfn,
                        unsigned long last_pfn, int acpi, int k8)
 {
-       u64 size, addr = start_pfn << PAGE_SHIFT;
+       u64 addr = start_pfn << PAGE_SHIFT;
        u64 max_addr = last_pfn << PAGE_SHIFT;
-       int num_nodes = 0, num = 0, coeff_flag, coeff = -1, i;
        int num_phys_nodes;
+       int num_nodes;
+       int i;
 
        num_phys_nodes = setup_physnodes(addr, max_addr, acpi, k8);
        /*
-        * If the numa=fake command-line is just a single number N, split the
-        * system RAM into N fake nodes.
+        * If the numa=fake command-line contains a 'M' or 'G', it represents
+        * the fixed node size.  Otherwise, if it is just a single number N,
+        * split the system RAM into N fake nodes.
         */
-       if (!strchr(cmdline, '*') && !strchr(cmdline, ',')) {
-               long n = simple_strtol(cmdline, NULL, 0);
-
-               num_nodes = split_nodes_interleave(addr, max_addr,
-                                                       num_phys_nodes, n);
-               if (num_nodes < 0)
-                       return num_nodes;
-               goto out;
-       }
+       if (strchr(cmdline, 'M') || strchr(cmdline, 'G')) {
+               u64 size;
 
-       /* Parse the command line. */
-       for (coeff_flag = 0; ; cmdline++) {
-               if (*cmdline && isdigit(*cmdline)) {
-                       num = num * 10 + *cmdline - '0';
-                       continue;
-               }
-               if (*cmdline == '*') {
-                       if (num > 0)
-                               coeff = num;
-                       coeff_flag = 1;
-               }
-               if (!*cmdline || *cmdline == ',') {
-                       if (!coeff_flag)
-                               coeff = 1;
-                       /*
-                        * Round down to the nearest FAKE_NODE_MIN_SIZE.
-                        * Command-line coefficients are in megabytes.
-                        */
-                       size = ((u64)num << 20) & FAKE_NODE_MIN_HASH_MASK;
-                       if (size)
-                               for (i = 0; i < coeff; i++, num_nodes++)
-                                       if (setup_node_range(num_nodes, &addr,
-                                               size, max_addr) < 0)
-                                               goto done;
-                       if (!*cmdline)
-                               break;
-                       coeff_flag = 0;
-                       coeff = -1;
-               }
-               num = 0;
-       }
-done:
-       if (!num_nodes)
-               return -1;
-       /* Fill remainder of system RAM, if appropriate. */
-       if (addr < max_addr) {
-               if (coeff_flag && coeff < 0) {
-                       /* Split remaining nodes into num-sized chunks */
-                       num_nodes += split_nodes_by_size(&addr, max_addr,
-                                                        num_nodes, num);
-                       goto out;
-               }
-               switch (*(cmdline - 1)) {
-               case '*':
-                       /* Split remaining nodes into coeff chunks */
-                       if (coeff <= 0)
-                               break;
-                       num_nodes += split_nodes_equally(&addr, max_addr,
-                                                        num_nodes, coeff);
-                       break;
-               case ',':
-                       /* Do not allocate remaining system RAM */
-                       break;
-               default:
-                       /* Give one final node */
-                       setup_node_range(num_nodes, &addr, max_addr - addr,
-                                        max_addr);
-                       num_nodes++;
-               }
+               size = memparse(cmdline, &cmdline);
+               num_nodes = split_nodes_size_interleave(addr, max_addr, size);
+       } else {
+               unsigned long n;
+
+               n = simple_strtoul(cmdline, NULL, 0);
+               num_nodes = split_nodes_interleave(addr, max_addr, num_phys_nodes, n);
        }
-out:
+
+       if (num_nodes < 0)
+               return num_nodes;
        memnode_shift = compute_hash_shift(nodes, num_nodes, NULL);
        if (memnode_shift < 0) {
                memnode_shift = 0;
index ed34f5e35999449a488be43ced0e580319b373f1..c9ba9deafe83f30daaae9b0e998c3de715671d43 100644 (file)
@@ -6,6 +6,14 @@
 
 #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO
 
+#ifdef CONFIG_HIGHPTE
+#define PGALLOC_USER_GFP __GFP_HIGHMEM
+#else
+#define PGALLOC_USER_GFP 0
+#endif
+
+gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP;
+
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
        return (pte_t *)__get_free_page(PGALLOC_GFP);
@@ -15,16 +23,29 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
        struct page *pte;
 
-#ifdef CONFIG_HIGHPTE
-       pte = alloc_pages(PGALLOC_GFP | __GFP_HIGHMEM, 0);
-#else
-       pte = alloc_pages(PGALLOC_GFP, 0);
-#endif
+       pte = alloc_pages(__userpte_alloc_gfp, 0);
        if (pte)
                pgtable_page_ctor(pte);
        return pte;
 }
 
+static int __init setup_userpte(char *arg)
+{
+       if (!arg)
+               return -EINVAL;
+
+       /*
+        * "userpte=nohigh" disables allocation of user pagetables in
+        * high memory.
+        */
+       if (strcmp(arg, "nohigh") == 0)
+               __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
+       else
+               return -EINVAL;
+       return 0;
+}
+early_param("userpte", setup_userpte);
+
 void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
 {
        pgtable_page_dtor(pte);
index a27124185fc1eca178798d63378e2935688ba656..28c68762648f9e28e02a9bd598c613e9e953fc37 100644 (file)
@@ -229,9 +229,11 @@ update_nodes_add(int node, unsigned long start, unsigned long end)
                        printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
        }
 
-       if (changed)
+       if (changed) {
+               node_set(node, cpu_nodes_parsed);
                printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n",
                                 nd->start, nd->end);
+       }
 }
 
 /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
index 65b58e4b0b8b6950fab3f6d04fd1526c57be92c9..426f3a1a64d3d73efa7a4aaea70cba37a8c5f9d3 100644 (file)
@@ -41,7 +41,7 @@ union smp_flush_state {
        struct {
                struct mm_struct *flush_mm;
                unsigned long flush_va;
-               spinlock_t tlbstate_lock;
+               raw_spinlock_t tlbstate_lock;
                DECLARE_BITMAP(flush_cpumask, NR_CPUS);
        };
        char pad[INTERNODE_CACHE_BYTES];
@@ -181,7 +181,7 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask,
         * num_online_cpus() <= NUM_INVALIDATE_TLB_VECTORS, but it is
         * probably not worth checking this for a cache-hot lock.
         */
-       spin_lock(&f->tlbstate_lock);
+       raw_spin_lock(&f->tlbstate_lock);
 
        f->flush_mm = mm;
        f->flush_va = va;
@@ -199,7 +199,7 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask,
 
        f->flush_mm = NULL;
        f->flush_va = 0;
-       spin_unlock(&f->tlbstate_lock);
+       raw_spin_unlock(&f->tlbstate_lock);
 }
 
 void native_flush_tlb_others(const struct cpumask *cpumask,
@@ -223,7 +223,7 @@ static int __cpuinit init_smp_flush(void)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(flush_state); i++)
-               spin_lock_init(&flush_state[i].tlbstate_lock);
+               raw_spin_lock_init(&flush_state[i].tlbstate_lock);
 
        return 0;
 }
index cb88b1a0bd5f1c2c1a9b34a6e93c33400114f4ef..2c505ee7101488b7032aad6f89d15ddb134457aa 100644 (file)
@@ -159,7 +159,7 @@ static int nmi_setup_mux(void)
 
        for_each_possible_cpu(i) {
                per_cpu(cpu_msrs, i).multiplex =
-                       kmalloc(multiplex_size, GFP_KERNEL);
+                       kzalloc(multiplex_size, GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).multiplex)
                        return 0;
        }
@@ -179,7 +179,6 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
                if (counter_config[i].enabled) {
                        multiplex[i].saved = -(u64)counter_config[i].count;
                } else {
-                       multiplex[i].addr  = 0;
                        multiplex[i].saved = 0;
                }
        }
@@ -189,25 +188,27 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)
 
 static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs)
 {
+       struct op_msr *counters = msrs->counters;
        struct op_msr *multiplex = msrs->multiplex;
        int i;
 
        for (i = 0; i < model->num_counters; ++i) {
                int virt = op_x86_phys_to_virt(i);
-               if (multiplex[virt].addr)
-                       rdmsrl(multiplex[virt].addr, multiplex[virt].saved);
+               if (counters[i].addr)
+                       rdmsrl(counters[i].addr, multiplex[virt].saved);
        }
 }
 
 static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs)
 {
+       struct op_msr *counters = msrs->counters;
        struct op_msr *multiplex = msrs->multiplex;
        int i;
 
        for (i = 0; i < model->num_counters; ++i) {
                int virt = op_x86_phys_to_virt(i);
-               if (multiplex[virt].addr)
-                       wrmsrl(multiplex[virt].addr, multiplex[virt].saved);
+               if (counters[i].addr)
+                       wrmsrl(counters[i].addr, multiplex[virt].saved);
        }
 }
 
@@ -222,7 +223,7 @@ static void nmi_cpu_switch(void *dummy)
 
        /* move to next set */
        si += model->num_counters;
-       if ((si > model->num_virt_counters) || (counter_config[si].count == 0))
+       if ((si >= model->num_virt_counters) || (counter_config[si].count == 0))
                per_cpu(switch_index, cpu) = 0;
        else
                per_cpu(switch_index, cpu) = si;
@@ -303,11 +304,11 @@ static int allocate_msrs(void)
 
        int i;
        for_each_possible_cpu(i) {
-               per_cpu(cpu_msrs, i).counters = kmalloc(counters_size,
+               per_cpu(cpu_msrs, i).counters = kzalloc(counters_size,
                                                        GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).counters)
                        return 0;
-               per_cpu(cpu_msrs, i).controls = kmalloc(controls_size,
+               per_cpu(cpu_msrs, i).controls = kzalloc(controls_size,
                                                        GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).controls)
                        return 0;
@@ -598,6 +599,7 @@ static int __init ppro_init(char **cpu_type)
        case 15: case 23:
                *cpu_type = "i386/core_2";
                break;
+       case 0x2e:
        case 26:
                spec = &op_arch_perfmon_spec;
                *cpu_type = "i386/core_i7";
index 39686c29f03a2d52774dc47cc616544b47e1e426..6a58256dce9f79560a90adf380de6d87344b3490 100644 (file)
@@ -22,6 +22,9 @@
 #include <asm/ptrace.h>
 #include <asm/msr.h>
 #include <asm/nmi.h>
+#include <asm/apic.h>
+#include <asm/processor.h>
+#include <asm/cpufeature.h>
 
 #include "op_x86_model.h"
 #include "op_counter.h"
 
 static unsigned long reset_value[NUM_VIRT_COUNTERS];
 
-#ifdef CONFIG_OPROFILE_IBS
-
 /* IbsFetchCtl bits/masks */
 #define IBS_FETCH_RAND_EN              (1ULL<<57)
 #define IBS_FETCH_VAL                  (1ULL<<49)
 #define IBS_FETCH_ENABLE               (1ULL<<48)
 #define IBS_FETCH_CNT_MASK             0xFFFF0000ULL
 
-/*IbsOpCtl bits */
+/* IbsOpCtl bits */
 #define IBS_OP_CNT_CTL                 (1ULL<<19)
 #define IBS_OP_VAL                     (1ULL<<18)
 #define IBS_OP_ENABLE                  (1ULL<<17)
@@ -59,7 +60,7 @@ static unsigned long reset_value[NUM_VIRT_COUNTERS];
 #define IBS_FETCH_SIZE                 6
 #define IBS_OP_SIZE                    12
 
-static int has_ibs;    /* AMD Family10h and later */
+static u32 ibs_caps;
 
 struct op_ibs_config {
        unsigned long op_enabled;
@@ -71,24 +72,52 @@ struct op_ibs_config {
 };
 
 static struct op_ibs_config ibs_config;
+static u64 ibs_op_ctl;
 
-#endif
+/*
+ * IBS cpuid feature detection
+ */
 
-#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
+#define IBS_CPUID_FEATURES      0x8000001b
+
+/*
+ * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but
+ * bit 0 is used to indicate the existence of IBS.
+ */
+#define IBS_CAPS_AVAIL                 (1LL<<0)
+#define IBS_CAPS_RDWROPCNT             (1LL<<3)
+#define IBS_CAPS_OPCNT                 (1LL<<4)
+
+/*
+ * IBS randomization macros
+ */
+#define IBS_RANDOM_BITS                        12
+#define IBS_RANDOM_MASK                        ((1ULL << IBS_RANDOM_BITS) - 1)
+#define IBS_RANDOM_MAXCNT_OFFSET       (1ULL << (IBS_RANDOM_BITS - 5))
 
-static void op_mux_fill_in_addresses(struct op_msrs * const msrs)
+static u32 get_ibs_caps(void)
 {
-       int i;
+       u32 ibs_caps;
+       unsigned int max_level;
 
-       for (i = 0; i < NUM_VIRT_COUNTERS; i++) {
-               int hw_counter = op_x86_virt_to_phys(i);
-               if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
-                       msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter;
-               else
-                       msrs->multiplex[i].addr = 0;
-       }
+       if (!boot_cpu_has(X86_FEATURE_IBS))
+               return 0;
+
+       /* check IBS cpuid feature flags */
+       max_level = cpuid_eax(0x80000000);
+       if (max_level < IBS_CPUID_FEATURES)
+               return IBS_CAPS_AVAIL;
+
+       ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
+       if (!(ibs_caps & IBS_CAPS_AVAIL))
+               /* cpuid flags not valid */
+               return IBS_CAPS_AVAIL;
+
+       return ibs_caps;
 }
 
+#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
+
 static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
                               struct op_msrs const * const msrs)
 {
@@ -98,7 +127,7 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
        /* enable active counters */
        for (i = 0; i < NUM_COUNTERS; ++i) {
                int virt = op_x86_phys_to_virt(i);
-               if (!counter_config[virt].enabled)
+               if (!reset_value[virt])
                        continue;
                rdmsrl(msrs->controls[i].addr, val);
                val &= model->reserved;
@@ -107,10 +136,6 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
        }
 }
 
-#else
-
-static inline void op_mux_fill_in_addresses(struct op_msrs * const msrs) { }
-
 #endif
 
 /* functions for op_amd_spec */
@@ -122,18 +147,12 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
        for (i = 0; i < NUM_COUNTERS; i++) {
                if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
                        msrs->counters[i].addr = MSR_K7_PERFCTR0 + i;
-               else
-                       msrs->counters[i].addr = 0;
        }
 
        for (i = 0; i < NUM_CONTROLS; i++) {
                if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i))
                        msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i;
-               else
-                       msrs->controls[i].addr = 0;
        }
-
-       op_mux_fill_in_addresses(msrs);
 }
 
 static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
@@ -144,7 +163,8 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
 
        /* setup reset_value */
        for (i = 0; i < NUM_VIRT_COUNTERS; ++i) {
-               if (counter_config[i].enabled)
+               if (counter_config[i].enabled
+                   && msrs->counters[op_x86_virt_to_phys(i)].addr)
                        reset_value[i] = counter_config[i].count;
                else
                        reset_value[i] = 0;
@@ -152,9 +172,18 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
 
        /* clear all counters */
        for (i = 0; i < NUM_CONTROLS; ++i) {
-               if (unlikely(!msrs->controls[i].addr))
+               if (unlikely(!msrs->controls[i].addr)) {
+                       if (counter_config[i].enabled && !smp_processor_id())
+                               /*
+                                * counter is reserved, this is on all
+                                * cpus, so report only for cpu #0
+                                */
+                               op_x86_warn_reserved(i);
                        continue;
+               }
                rdmsrl(msrs->controls[i].addr, val);
+               if (val & ARCH_PERFMON_EVENTSEL0_ENABLE)
+                       op_x86_warn_in_use(i);
                val &= model->reserved;
                wrmsrl(msrs->controls[i].addr, val);
        }
@@ -169,9 +198,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
        /* enable active counters */
        for (i = 0; i < NUM_COUNTERS; ++i) {
                int virt = op_x86_phys_to_virt(i);
-               if (!counter_config[virt].enabled)
-                       continue;
-               if (!msrs->counters[i].addr)
+               if (!reset_value[virt])
                        continue;
 
                /* setup counter registers */
@@ -185,7 +212,60 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
        }
 }
 
-#ifdef CONFIG_OPROFILE_IBS
+/*
+ * 16-bit Linear Feedback Shift Register (LFSR)
+ *
+ *                       16   14   13    11
+ * Feedback polynomial = X  + X  + X  +  X  + 1
+ */
+static unsigned int lfsr_random(void)
+{
+       static unsigned int lfsr_value = 0xF00D;
+       unsigned int bit;
+
+       /* Compute next bit to shift in */
+       bit = ((lfsr_value >> 0) ^
+              (lfsr_value >> 2) ^
+              (lfsr_value >> 3) ^
+              (lfsr_value >> 5)) & 0x0001;
+
+       /* Advance to next register value */
+       lfsr_value = (lfsr_value >> 1) | (bit << 15);
+
+       return lfsr_value;
+}
+
+/*
+ * IBS software randomization
+ *
+ * The IBS periodic op counter is randomized in software. The lower 12
+ * bits of the 20 bit counter are randomized. IbsOpCurCnt is
+ * initialized with a 12 bit random value.
+ */
+static inline u64 op_amd_randomize_ibs_op(u64 val)
+{
+       unsigned int random = lfsr_random();
+
+       if (!(ibs_caps & IBS_CAPS_RDWROPCNT))
+               /*
+                * Work around if the hw can not write to IbsOpCurCnt
+                *
+                * Randomize the lower 8 bits of the 16 bit
+                * IbsOpMaxCnt [15:0] value in the range of -128 to
+                * +127 by adding/subtracting an offset to the
+                * maximum count (IbsOpMaxCnt).
+                *
+                * To avoid over or underflows and protect upper bits
+                * starting at bit 16, the initial value for
+                * IbsOpMaxCnt must fit in the range from 0x0081 to
+                * 0xff80.
+                */
+               val += (s8)(random >> 4);
+       else
+               val |= (u64)(random & IBS_RANDOM_MASK) << 32;
+
+       return val;
+}
 
 static inline void
 op_amd_handle_ibs(struct pt_regs * const regs,
@@ -194,7 +274,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,
        u64 val, ctl;
        struct op_entry entry;
 
-       if (!has_ibs)
+       if (!ibs_caps)
                return;
 
        if (ibs_config.fetch_enabled) {
@@ -236,8 +316,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,
                        oprofile_write_commit(&entry);
 
                        /* reenable the IRQ */
-                       ctl &= ~IBS_OP_VAL & 0xFFFFFFFF;
-                       ctl |= IBS_OP_ENABLE;
+                       ctl = op_amd_randomize_ibs_op(ibs_op_ctl);
                        wrmsrl(MSR_AMD64_IBSOPCTL, ctl);
                }
        }
@@ -246,41 +325,57 @@ op_amd_handle_ibs(struct pt_regs * const regs,
 static inline void op_amd_start_ibs(void)
 {
        u64 val;
-       if (has_ibs && ibs_config.fetch_enabled) {
+
+       if (!ibs_caps)
+               return;
+
+       if (ibs_config.fetch_enabled) {
                val = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
                val |= ibs_config.rand_en ? IBS_FETCH_RAND_EN : 0;
                val |= IBS_FETCH_ENABLE;
                wrmsrl(MSR_AMD64_IBSFETCHCTL, val);
        }
 
-       if (has_ibs && ibs_config.op_enabled) {
-               val = (ibs_config.max_cnt_op >> 4) & 0xFFFF;
-               val |= ibs_config.dispatched_ops ? IBS_OP_CNT_CTL : 0;
-               val |= IBS_OP_ENABLE;
+       if (ibs_config.op_enabled) {
+               ibs_op_ctl = ibs_config.max_cnt_op >> 4;
+               if (!(ibs_caps & IBS_CAPS_RDWROPCNT)) {
+                       /*
+                        * IbsOpCurCnt not supported.  See
+                        * op_amd_randomize_ibs_op() for details.
+                        */
+                       ibs_op_ctl = clamp(ibs_op_ctl, 0x0081ULL, 0xFF80ULL);
+               } else {
+                       /*
+                        * The start value is randomized with a
+                        * positive offset, we need to compensate it
+                        * with the half of the randomized range. Also
+                        * avoid underflows.
+                        */
+                       ibs_op_ctl = min(ibs_op_ctl + IBS_RANDOM_MAXCNT_OFFSET,
+                                        0xFFFFULL);
+               }
+               if (ibs_caps & IBS_CAPS_OPCNT && ibs_config.dispatched_ops)
+                       ibs_op_ctl |= IBS_OP_CNT_CTL;
+               ibs_op_ctl |= IBS_OP_ENABLE;
+               val = op_amd_randomize_ibs_op(ibs_op_ctl);
                wrmsrl(MSR_AMD64_IBSOPCTL, val);
        }
 }
 
 static void op_amd_stop_ibs(void)
 {
-       if (has_ibs && ibs_config.fetch_enabled)
+       if (!ibs_caps)
+               return;
+
+       if (ibs_config.fetch_enabled)
                /* clear max count and enable */
                wrmsrl(MSR_AMD64_IBSFETCHCTL, 0);
 
-       if (has_ibs && ibs_config.op_enabled)
+       if (ibs_config.op_enabled)
                /* clear max count and enable */
                wrmsrl(MSR_AMD64_IBSOPCTL, 0);
 }
 
-#else
-
-static inline void op_amd_handle_ibs(struct pt_regs * const regs,
-                                   struct op_msrs const * const msrs) { }
-static inline void op_amd_start_ibs(void) { }
-static inline void op_amd_stop_ibs(void) { }
-
-#endif
-
 static int op_amd_check_ctrs(struct pt_regs * const regs,
                             struct op_msrs const * const msrs)
 {
@@ -355,8 +450,6 @@ static void op_amd_shutdown(struct op_msrs const * const msrs)
        }
 }
 
-#ifdef CONFIG_OPROFILE_IBS
-
 static u8 ibs_eilvt_off;
 
 static inline void apic_init_ibs_nmi_per_cpu(void *arg)
@@ -405,45 +498,36 @@ static int init_ibs_nmi(void)
                return 1;
        }
 
-#ifdef CONFIG_NUMA
-       /* Sanity check */
-       /* Works only for 64bit with proper numa implementation. */
-       if (nodes != num_possible_nodes()) {
-               printk(KERN_DEBUG "Failed to setup CPU node(s) for IBS, "
-                       "found: %d, expected %d",
-                       nodes, num_possible_nodes());
-               return 1;
-       }
-#endif
        return 0;
 }
 
 /* uninitialize the APIC for the IBS interrupts if needed */
 static void clear_ibs_nmi(void)
 {
-       if (has_ibs)
+       if (ibs_caps)
                on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
 }
 
 /* initialize the APIC for the IBS interrupts if available */
 static void ibs_init(void)
 {
-       has_ibs = boot_cpu_has(X86_FEATURE_IBS);
+       ibs_caps = get_ibs_caps();
 
-       if (!has_ibs)
+       if (!ibs_caps)
                return;
 
        if (init_ibs_nmi()) {
-               has_ibs = 0;
+               ibs_caps = 0;
                return;
        }
 
-       printk(KERN_INFO "oprofile: AMD IBS detected\n");
+       printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n",
+              (unsigned)ibs_caps);
 }
 
 static void ibs_exit(void)
 {
-       if (!has_ibs)
+       if (!ibs_caps)
                return;
 
        clear_ibs_nmi();
@@ -463,7 +547,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
        if (ret)
                return ret;
 
-       if (!has_ibs)
+       if (!ibs_caps)
                return ret;
 
        /* model specific files */
@@ -473,7 +557,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
        ibs_config.fetch_enabled = 0;
        ibs_config.max_cnt_op = 250000;
        ibs_config.op_enabled = 0;
-       ibs_config.dispatched_ops = 1;
+       ibs_config.dispatched_ops = 0;
 
        dir = oprofilefs_mkdir(sb, root, "ibs_fetch");
        oprofilefs_create_ulong(sb, dir, "enable",
@@ -488,8 +572,9 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
                                &ibs_config.op_enabled);
        oprofilefs_create_ulong(sb, dir, "max_count",
                                &ibs_config.max_cnt_op);
-       oprofilefs_create_ulong(sb, dir, "dispatched_ops",
-                               &ibs_config.dispatched_ops);
+       if (ibs_caps & IBS_CAPS_OPCNT)
+               oprofilefs_create_ulong(sb, dir, "dispatched_ops",
+                                       &ibs_config.dispatched_ops);
 
        return 0;
 }
@@ -507,19 +592,6 @@ static void op_amd_exit(void)
        ibs_exit();
 }
 
-#else
-
-/* no IBS support */
-
-static int op_amd_init(struct oprofile_operations *ops)
-{
-       return 0;
-}
-
-static void op_amd_exit(void) {}
-
-#endif /* CONFIG_OPROFILE_IBS */
-
 struct op_x86_model_spec op_amd_spec = {
        .num_counters           = NUM_COUNTERS,
        .num_controls           = NUM_CONTROLS,
index ac6b354becdfe9f5859aa7930cc6b2aedb9f17e2..e6a160a4684a4a9d96914acc161122d6c7f8c208 100644 (file)
@@ -394,12 +394,6 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs)
        setup_num_counters();
        stag = get_stagger();
 
-       /* initialize some registers */
-       for (i = 0; i < num_counters; ++i)
-               msrs->counters[i].addr = 0;
-       for (i = 0; i < num_controls; ++i)
-               msrs->controls[i].addr = 0;
-
        /* the counter & cccr registers we pay attention to */
        for (i = 0; i < num_counters; ++i) {
                addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
index 8eb05878554cf382a0cf482947a8ebf7a93fdeeb..5d1727ba409edf7b1bbe2f28d0b38711cd3625fd 100644 (file)
@@ -37,15 +37,11 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs)
        for (i = 0; i < num_counters; i++) {
                if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i))
                        msrs->counters[i].addr = MSR_P6_PERFCTR0 + i;
-               else
-                       msrs->counters[i].addr = 0;
        }
 
        for (i = 0; i < num_counters; i++) {
                if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i))
                        msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i;
-               else
-                       msrs->controls[i].addr = 0;
        }
 }
 
@@ -57,7 +53,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
        int i;
 
        if (!reset_value) {
-               reset_value = kmalloc(sizeof(reset_value[0]) * num_counters,
+               reset_value = kzalloc(sizeof(reset_value[0]) * num_counters,
                                        GFP_ATOMIC);
                if (!reset_value)
                        return;
@@ -82,9 +78,18 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
 
        /* clear all counters */
        for (i = 0; i < num_counters; ++i) {
-               if (unlikely(!msrs->controls[i].addr))
+               if (unlikely(!msrs->controls[i].addr)) {
+                       if (counter_config[i].enabled && !smp_processor_id())
+                               /*
+                                * counter is reserved, this is on all
+                                * cpus, so report only for cpu #0
+                                */
+                               op_x86_warn_reserved(i);
                        continue;
+               }
                rdmsrl(msrs->controls[i].addr, val);
+               if (val & ARCH_PERFMON_EVENTSEL0_ENABLE)
+                       op_x86_warn_in_use(i);
                val &= model->reserved;
                wrmsrl(msrs->controls[i].addr, val);
        }
index 7b8e75d1608125aa81e7069d781d08bf15052e40..ff82a755edd4ad206b3153374371d84a1d77f43a 100644 (file)
@@ -57,6 +57,26 @@ struct op_x86_model_spec {
 
 struct op_counter_config;
 
+static inline void op_x86_warn_in_use(int counter)
+{
+       /*
+        * The warning indicates an already running counter. If
+        * oprofile doesn't collect data, then try using a different
+        * performance counter on your platform to monitor the desired
+        * event. Delete counter #%d from the desired event by editing
+        * the /usr/share/oprofile/%s/<cpu>/events file. If the event
+        * cannot be monitored by any other counter, contact your
+        * hardware or BIOS vendor.
+        */
+       pr_warning("oprofile: counter #%d on cpu #%d may already be used\n",
+                  counter, smp_processor_id());
+}
+
+static inline void op_x86_warn_reserved(int counter)
+{
+       pr_warning("oprofile: counter #%d is already reserved\n", counter);
+}
+
 extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
                           struct op_counter_config *counter_config);
 extern int op_x86_phys_to_virt(int phys);
index 564b008a51c7abdee986f03c1ccfe3a09894a93a..39fba37f702f40b61eb8d5c61b8716a3b59ee5bb 100644 (file)
@@ -15,7 +15,7 @@ obj-$(CONFIG_X86_NUMAQ)               += numaq_32.o
 
 obj-y                          += common.o early.o
 obj-y                          += amd_bus.o
-obj-$(CONFIG_X86_64)           += bus_numa.o intel_bus.o
+obj-$(CONFIG_X86_64)           += bus_numa.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
index 959e548a7039e81a85cdd0e7eb114a86f91a05c5..5f11ff6f5389bd45c6279b98c347c7754b164a8a 100644 (file)
@@ -15,6 +15,51 @@ struct pci_root_info {
        int busnum;
 };
 
+static bool pci_use_crs = true;
+
+static int __init set_use_crs(const struct dmi_system_id *id)
+{
+       pci_use_crs = true;
+       return 0;
+}
+
+static const struct dmi_system_id pci_use_crs_table[] __initconst = {
+       /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */
+       {
+               .callback = set_use_crs,
+               .ident = "IBM System x3800",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
+               },
+       },
+       {}
+};
+
+void __init pci_acpi_crs_quirks(void)
+{
+       int year;
+
+       if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008)
+               pci_use_crs = false;
+
+       dmi_check_system(pci_use_crs_table);
+
+       /*
+        * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that
+        * takes precedence over anything we figured out above.
+        */
+       if (pci_probe & PCI_ROOT_NO_CRS)
+               pci_use_crs = false;
+       else if (pci_probe & PCI_USE__CRS)
+               pci_use_crs = true;
+
+       printk(KERN_INFO "PCI: %s host bridge windows from ACPI; "
+              "if necessary, use \"pci=%s\" and report a bug\n",
+              pci_use_crs ? "Using" : "Ignoring",
+              pci_use_crs ? "nocrs" : "use_crs");
+}
+
 static acpi_status
 resource_to_addr(struct acpi_resource *resource,
                        struct acpi_resource_address64 *addr)
@@ -45,20 +90,6 @@ count_resource(struct acpi_resource *acpi_res, void *data)
        return AE_OK;
 }
 
-static int
-bus_has_transparent_bridge(struct pci_bus *bus)
-{
-       struct pci_dev *dev;
-
-       list_for_each_entry(dev, &bus->devices, bus_list) {
-               u16 class = dev->class >> 8;
-
-               if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent)
-                       return true;
-       }
-       return false;
-}
-
 static void
 align_resource(struct acpi_device *bridge, struct resource *res)
 {
@@ -92,12 +123,8 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
        acpi_status status;
        unsigned long flags;
        struct resource *root;
-       int max_root_bus_resources = PCI_BUS_NUM_RESOURCES;
        u64 start, end;
 
-       if (bus_has_transparent_bridge(info->bus))
-               max_root_bus_resources -= 3;
-
        status = resource_to_addr(acpi_res, &addr);
        if (!ACPI_SUCCESS(status))
                return AE_OK;
@@ -115,15 +142,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
 
        start = addr.minimum + addr.translation_offset;
        end = start + addr.address_length - 1;
-       if (info->res_num >= max_root_bus_resources) {
-               if (pci_probe & PCI_USE__CRS)
-                       printk(KERN_WARNING "PCI: Failed to allocate "
-                              "0x%lx-0x%lx from %s for %s due to _CRS "
-                              "returning more than %d resource descriptors\n",
-                              (unsigned long) start, (unsigned long) end,
-                              root->name, info->name, max_root_bus_resources);
-               return AE_OK;
-       }
 
        res = &info->res[info->res_num];
        res->name = info->name;
@@ -133,7 +151,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
        res->child = NULL;
        align_resource(info->bridge, res);
 
-       if (!(pci_probe & PCI_USE__CRS)) {
+       if (!pci_use_crs) {
                dev_printk(KERN_DEBUG, &info->bridge->dev,
                           "host bridge window %pR (ignored)\n", res);
                return AE_OK;
@@ -143,7 +161,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
                dev_err(&info->bridge->dev,
                        "can't allocate host bridge window %pR\n", res);
        } else {
-               info->bus->resource[info->res_num] = res;
+               pci_bus_add_resource(info->bus, res, 0);
                info->res_num++;
                if (addr.translation_offset)
                        dev_info(&info->bridge->dev, "host bridge window %pR "
@@ -164,10 +182,8 @@ get_current_resources(struct acpi_device *device, int busnum,
        struct pci_root_info info;
        size_t size;
 
-       if (!(pci_probe & PCI_USE__CRS))
-               dev_info(&device->dev,
-                        "ignoring host bridge windows from ACPI; "
-                        "boot with \"pci=use_crs\" to use them\n");
+       if (pci_use_crs)
+               pci_bus_remove_resources(bus);
 
        info.bridge = device;
        info.bus = bus;
index f939d603adfab4257dca888766584b378c0be5e9..12d54ff3654d2b2623ecc0cdd67cc8c417858e77 100644 (file)
@@ -36,13 +36,14 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
        printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
                        b->number);
 
+       pci_bus_remove_resources(b);
        info = &pci_root_info[i];
        for (j = 0; j < info->res_num; j++) {
                struct resource *res;
                struct resource *root;
 
                res = &info->res[j];
-               b->resource[j] = res;
+               pci_bus_add_resource(b, res, 0);
                if (res->flags & IORESOURCE_IO)
                        root = &ioport_resource;
                else
index adbc23fe82acc4fbcde63a5821838eab4567f0f7..731b64ee8d8411946e6e2011fa74b48df489c1b7 100644 (file)
@@ -2,8 +2,7 @@
 
 /*
  * sub bus (transparent) will use entres from 3 to store extra from
- * root, so need to make sure we have enough slot there, Should we
- * increase PCI_BUS_NUM_RESOURCES?
+ * root, so need to make sure we have enough slot there.
  */
 #define RES_NUM 16
 struct pci_root_info {
index d2552c68e94d9670a7086c2eca1258a453c1a516..3736176acaab6a362f4e97a889af6d07591b6ce3 100644 (file)
@@ -520,6 +520,9 @@ char * __devinit  pcibios_setup(char *str)
        } else if (!strcmp(str, "use_crs")) {
                pci_probe |= PCI_USE__CRS;
                return NULL;
+       } else if (!strcmp(str, "nocrs")) {
+               pci_probe |= PCI_ROOT_NO_CRS;
+               return NULL;
        } else if (!strcmp(str, "earlydump")) {
                pci_early_dump_regs = 1;
                return NULL;
index 5dc9e8c63fcdedb26a096d48efcf2392cd8f8209..5a8fbf8d4caca2e266b47e4247492523583824b7 100644 (file)
@@ -60,22 +60,20 @@ skip_isa_ioresource_align(struct pci_dev *dev) {
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                        resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
+       resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
-
                if (skip_isa_ioresource_align(dev))
-                       return;
-               if (start & 0x300) {
+                       return start;
+               if (start & 0x300)
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
        }
+       return start;
 }
 EXPORT_SYMBOL(pcibios_align_resource);
 
diff --git a/arch/x86/pci/intel_bus.c b/arch/x86/pci/intel_bus.c
deleted file mode 100644 (file)
index f81a2fa..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * to read io range from IOH pci conf, need to do it after mmconfig is there
- */
-
-#include <linux/delay.h>
-#include <linux/dmi.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <asm/pci_x86.h>
-
-#include "bus_numa.h"
-
-static inline void print_ioh_resources(struct pci_root_info *info)
-{
-       int res_num;
-       int busnum;
-       int i;
-
-       printk(KERN_DEBUG "IOH bus: [%02x, %02x]\n",
-                       info->bus_min, info->bus_max);
-       res_num = info->res_num;
-       busnum = info->bus_min;
-       for (i = 0; i < res_num; i++) {
-               struct resource *res;
-
-               res = &info->res[i];
-               printk(KERN_DEBUG "IOH bus: %02x index %x %s: [%llx, %llx]\n",
-                       busnum, i,
-                       (res->flags & IORESOURCE_IO) ? "io port" :
-                                                       "mmio",
-                       res->start, res->end);
-       }
-}
-
-#define IOH_LIO                        0x108
-#define IOH_LMMIOL             0x10c
-#define IOH_LMMIOH             0x110
-#define IOH_LMMIOH_BASEU       0x114
-#define IOH_LMMIOH_LIMITU      0x118
-#define IOH_LCFGBUS            0x11c
-
-static void __devinit pci_root_bus_res(struct pci_dev *dev)
-{
-       u16 word;
-       u32 dword;
-       struct pci_root_info *info;
-       u16 io_base, io_end;
-       u32 mmiol_base, mmiol_end;
-       u64 mmioh_base, mmioh_end;
-       int bus_base, bus_end;
-
-       /* some sys doesn't get mmconf enabled */
-       if (dev->cfg_size < 0x120)
-               return;
-
-       if (pci_root_num >= PCI_ROOT_NR) {
-               printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n");
-               return;
-       }
-
-       info = &pci_root_info[pci_root_num];
-       pci_root_num++;
-
-       pci_read_config_word(dev, IOH_LCFGBUS, &word);
-       bus_base = (word & 0xff);
-       bus_end = (word & 0xff00) >> 8;
-       sprintf(info->name, "PCI Bus #%02x", bus_base);
-       info->bus_min = bus_base;
-       info->bus_max = bus_end;
-
-       pci_read_config_word(dev, IOH_LIO, &word);
-       io_base = (word & 0xf0) << (12 - 4);
-       io_end = (word & 0xf000) | 0xfff;
-       update_res(info, io_base, io_end, IORESOURCE_IO, 0);
-
-       pci_read_config_dword(dev, IOH_LMMIOL, &dword);
-       mmiol_base = (dword & 0xff00) << (24 - 8);
-       mmiol_end = (dword & 0xff000000) | 0xffffff;
-       update_res(info, mmiol_base, mmiol_end, IORESOURCE_MEM, 0);
-
-       pci_read_config_dword(dev, IOH_LMMIOH, &dword);
-       mmioh_base = ((u64)(dword & 0xfc00)) << (26 - 10);
-       mmioh_end = ((u64)(dword & 0xfc000000) | 0x3ffffff);
-       pci_read_config_dword(dev, IOH_LMMIOH_BASEU, &dword);
-       mmioh_base |= ((u64)(dword & 0x7ffff)) << 32;
-       pci_read_config_dword(dev, IOH_LMMIOH_LIMITU, &dword);
-       mmioh_end |= ((u64)(dword & 0x7ffff)) << 32;
-       update_res(info, mmioh_base, mmioh_end, IORESOURCE_MEM, 0);
-
-       print_ioh_resources(info);
-}
-
-/* intel IOH */
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, pci_root_bus_res);
index 0696d506c4ade99b0d43232128a77cea99d65ec8..b02f6d8ac922f171b5b31be1923aa9e358e73bca 100644 (file)
@@ -590,6 +590,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
        case PCI_DEVICE_ID_INTEL_ICH10_1:
        case PCI_DEVICE_ID_INTEL_ICH10_2:
        case PCI_DEVICE_ID_INTEL_ICH10_3:
+       case PCI_DEVICE_ID_INTEL_CPT_LPC1:
+       case PCI_DEVICE_ID_INTEL_CPT_LPC2:
                r->name = "PIIX/ICH";
                r->get = pirq_piix_get;
                r->set = pirq_piix_set;
index b19d1e54201ee95a80d8123e9ba26716811c52fe..8f3f9a50b1e0b4891be7fbba0d62ee16bff6a273 100644 (file)
@@ -303,22 +303,17 @@ static void __init pci_mmcfg_check_end_bus_number(void)
 {
        struct pci_mmcfg_region *cfg, *cfgx;
 
-       /* last one*/
-       cfg = list_entry(pci_mmcfg_list.prev, typeof(*cfg), list);
-       if (cfg)
-               if (cfg->end_bus < cfg->start_bus)
-                       cfg->end_bus = 255;
-
-       if (list_is_singular(&pci_mmcfg_list))
-               return;
-
-       /* don't overlap please */
+       /* Fixup overlaps */
        list_for_each_entry(cfg, &pci_mmcfg_list, list) {
                if (cfg->end_bus < cfg->start_bus)
                        cfg->end_bus = 255;
 
+               /* Don't access the list head ! */
+               if (cfg->list.next == &pci_mmcfg_list)
+                       break;
+
                cfgx = list_entry(cfg->list.next, typeof(*cfg), list);
-               if (cfg != cfgx && cfg->end_bus >= cfgx->start_bus)
+               if (cfg->end_bus >= cfgx->start_bus)
                        cfg->end_bus = cfgx->start_bus - 1;
        }
 }
index 8eb295e116f626293e7219477f280b52b6aa765e..8884a1c1ada63c2150585a681334383d7ee4f0d5 100644 (file)
@@ -8,9 +8,7 @@
 #include <asm/apic.h>
 #include <asm/mpspec.h>
 #include <asm/pci_x86.h>
-
-#define XQUAD_PORTIO_BASE 0xfe400000
-#define XQUAD_PORTIO_QUAD 0x40000  /* 256k per quad. */
+#include <asm/numaq.h>
 
 #define BUS2QUAD(global) (mp_bus_id_to_node[global])
 
@@ -18,8 +16,6 @@
 
 #define QUADLOCAL2BUS(quad,local) (quad_local_to_mp_bus_id[quad][local])
 
-#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
-
 #define PCI_CONF1_MQ_ADDRESS(bus, devfn, reg) \
        (0x80000000 | (BUS2LOCAL(bus) << 16) | (devfn << 8) | (reg & ~3))
 
index bee8d6ac2691769b127439afdf60582b4260563c..13403fc95a962cd46a98674e14db1db194e8cfd7 100644 (file)
@@ -43,7 +43,7 @@ static int x86_64;
 static void usage(void)
 {
        fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
-               " %s [-y|-n] [-v] \n", prog);
+               " %s [-y|-n] [-v]\n", prog);
        fprintf(stderr, "\t-y   64bit mode\n");
        fprintf(stderr, "\t-n   32bit mode\n");
        fprintf(stderr, "\t-v   verbose mode\n");
@@ -69,7 +69,7 @@ static void dump_field(FILE *fp, const char *name, const char *indent,
 
 static void dump_insn(FILE *fp, struct insn *insn)
 {
-       fprintf(fp, "Instruction = { \n");
+       fprintf(fp, "Instruction = {\n");
        dump_field(fp, "prefixes", "\t",        &insn->prefixes);
        dump_field(fp, "rex_prefix", "\t",      &insn->rex_prefix);
        dump_field(fp, "vex_prefix", "\t",      &insn->vex_prefix);
index 2b26dd5930c6e82e87f0e20505ab5954e6213a83..36daccb686420857a2bdbc026f6c73bfd3a46dac 100644 (file)
@@ -1151,9 +1151,13 @@ asmlinkage void __init xen_start_kernel(void)
 
        /* keep using Xen gdt for now; no urgent need to change it */
 
+#ifdef CONFIG_X86_32
        pv_info.kernel_rpl = 1;
        if (xen_feature(XENFEAT_supervisor_mode_kernel))
                pv_info.kernel_rpl = 0;
+#else
+       pv_info.kernel_rpl = 0;
+#endif
 
        /* set the limit of our address space */
        xen_reserve_top();
index b7c073484e016d0ea2749c0cb81b3c2cdfbd2d73..cd102693120372e1345f94b1f5fa90161b7c85d6 100644 (file)
@@ -69,26 +69,25 @@ static int pci_bus_count;
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void
-pcibios_align_resource(void *data, struct resource *res, resource_size_t size,
-                      resource_size_t align)
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
+                      resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
+       resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
-
                if (size > 0x100) {
                        printk(KERN_ERR "PCI: I/O Region %s/%d too large"
                               " (%ld bytes)\n", pci_name(dev),
                               dev->resource - res, size);
                }
 
-               if (start & 0x300) {
+               if (start & 0x300)
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
        }
+
+       return start;
 }
 
 int
index 1fa2654db0a62c1c3f07b92fb8b33eff473d1b41..e7dbbaf5fb3ee58698b1692508b991da8d38accd 100644 (file)
@@ -147,16 +147,16 @@ blkiocg_weight_write(struct cgroup *cgroup, struct cftype *cftype, u64 val)
                return -EINVAL;
 
        blkcg = cgroup_to_blkio_cgroup(cgroup);
+       spin_lock(&blkio_list_lock);
        spin_lock_irq(&blkcg->lock);
        blkcg->weight = (unsigned int)val;
        hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) {
-               spin_lock(&blkio_list_lock);
                list_for_each_entry(blkiop, &blkio_list, list)
                        blkiop->ops.blkio_update_group_weight_fn(blkg,
                                        blkcg->weight);
-               spin_unlock(&blkio_list_lock);
        }
        spin_unlock_irq(&blkcg->lock);
+       spin_unlock(&blkio_list_lock);
        return 0;
 }
 
index 718897e6d37f2293615a858ea880b8e245ad7050..d1a9a0a64f95b5295314bec0ef6c2e96d99775b2 100644 (file)
@@ -1147,7 +1147,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
  */
 static inline bool queue_should_plug(struct request_queue *q)
 {
-       return !(blk_queue_nonrot(q) && blk_queue_queuing(q));
+       return !(blk_queue_nonrot(q) && blk_queue_tagged(q));
 }
 
 static int __make_request(struct request_queue *q, struct bio *bio)
@@ -1859,15 +1859,8 @@ void blk_dequeue_request(struct request *rq)
         * and to it is freed is accounted as io that is in progress at
         * the driver side.
         */
-       if (blk_account_rq(rq)) {
+       if (blk_account_rq(rq))
                q->in_flight[rq_is_sync(rq)]++;
-               /*
-                * Mark this device as supporting hardware queuing, if
-                * we have more IOs in flight than 4.
-                */
-               if (!blk_queue_queuing(q) && queue_in_flight(q) > 4)
-                       set_bit(QUEUE_FLAG_CQ, &q->queue_flags);
-       }
 }
 
 /**
index cbdabb0dd6d773fcc22c2760dffb6e399708d2b8..98e6bf61b0ac8c505aac61ae37cc27b89a49cb55 100644 (file)
@@ -39,8 +39,6 @@ int put_io_context(struct io_context *ioc)
 
        if (atomic_long_dec_and_test(&ioc->refcount)) {
                rcu_read_lock();
-               if (ioc->aic && ioc->aic->dtor)
-                       ioc->aic->dtor(ioc->aic);
                cfq_dtor(ioc);
                rcu_read_unlock();
 
@@ -76,8 +74,6 @@ void exit_io_context(struct task_struct *task)
        task_unlock(task);
 
        if (atomic_dec_and_test(&ioc->nr_tasks)) {
-               if (ioc->aic && ioc->aic->exit)
-                       ioc->aic->exit(ioc->aic);
                cfq_exit(ioc);
 
        }
@@ -97,7 +93,6 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
                ret->ioprio = 0;
                ret->last_waited = jiffies; /* doesn't matter... */
                ret->nr_batch_requests = 0; /* because this is 0 */
-               ret->aic = NULL;
                INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
                INIT_HLIST_HEAD(&ret->cic_list);
                ret->ioc_data = NULL;
index d52d4adc440b29e8d428a9f05d59413d2bb421c9..5eeb9e0d256ea7c9afd9fc72eacdbb46cc11b46a 100644 (file)
@@ -528,7 +528,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                     sector_t offset)
 {
        sector_t alignment;
-       unsigned int top, bottom;
+       unsigned int top, bottom, ret = 0;
 
        t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
        t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
@@ -546,6 +546,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
        t->max_segment_size = min_not_zero(t->max_segment_size,
                                           b->max_segment_size);
 
+       t->misaligned |= b->misaligned;
+
        alignment = queue_limit_alignment_offset(b, offset);
 
        /* Bottom device has different alignment.  Check that it is
@@ -558,8 +560,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                bottom = max(b->physical_block_size, b->io_min) + alignment;
 
                /* Verify that top and bottom intervals line up */
-               if (max(top, bottom) & (min(top, bottom) - 1))
+               if (max(top, bottom) & (min(top, bottom) - 1)) {
                        t->misaligned = 1;
+                       ret = -1;
+               }
        }
 
        t->logical_block_size = max(t->logical_block_size,
@@ -578,18 +582,21 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
        if (t->physical_block_size & (t->logical_block_size - 1)) {
                t->physical_block_size = t->logical_block_size;
                t->misaligned = 1;
+               ret = -1;
        }
 
        /* Minimum I/O a multiple of the physical block size? */
        if (t->io_min & (t->physical_block_size - 1)) {
                t->io_min = t->physical_block_size;
                t->misaligned = 1;
+               ret = -1;
        }
 
        /* Optimal I/O a multiple of the physical block size? */
        if (t->io_opt & (t->physical_block_size - 1)) {
                t->io_opt = 0;
                t->misaligned = 1;
+               ret = -1;
        }
 
        /* Find lowest common alignment_offset */
@@ -597,8 +604,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                & (max(t->physical_block_size, t->io_min) - 1);
 
        /* Verify that new alignment_offset is on a logical block boundary */
-       if (t->alignment_offset & (t->logical_block_size - 1))
+       if (t->alignment_offset & (t->logical_block_size - 1)) {
                t->misaligned = 1;
+               ret = -1;
+       }
 
        /* Discard alignment and granularity */
        if (b->discard_granularity) {
@@ -626,10 +635,32 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                        (t->discard_granularity - 1);
        }
 
-       return t->misaligned ? -1 : 0;
+       return ret;
 }
 EXPORT_SYMBOL(blk_stack_limits);
 
+/**
+ * bdev_stack_limits - adjust queue limits for stacked drivers
+ * @t: the stacking driver limits (top device)
+ * @bdev:  the component block_device (bottom)
+ * @start:  first data sector within component device
+ *
+ * Description:
+ *    Merges queue limits for a top device and a block_device.  Returns
+ *    0 if alignment didn't change.  Returns -1 if adding the bottom
+ *    device caused misalignment.
+ */
+int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
+                     sector_t start)
+{
+       struct request_queue *bq = bdev_get_queue(bdev);
+
+       start += get_start_sect(bdev);
+
+       return blk_stack_limits(t, &bq->limits, start << 9);
+}
+EXPORT_SYMBOL(bdev_stack_limits);
+
 /**
  * disk_stack_limits - adjust queue limits for stacked drivers
  * @disk:  MD/DM gendisk (top)
index 918c7fd9aeb1f9c662606a754ddfafa511193897..023f4e69a3378cab44faefbf6c69823e6ec16b48 100644 (file)
@@ -42,16 +42,13 @@ static const int cfq_hist_divisor = 4;
  */
 #define CFQ_MIN_TT             (2)
 
-/*
- * Allow merged cfqqs to perform this amount of seeky I/O before
- * deciding to break the queues up again.
- */
-#define CFQQ_COOP_TOUT         (HZ)
-
 #define CFQ_SLICE_SCALE                (5)
 #define CFQ_HW_QUEUE_MIN       (5)
 #define CFQ_SERVICE_SHIFT       12
 
+#define CFQQ_SEEK_THR          8 * 1024
+#define CFQQ_SEEKY(cfqq)       ((cfqq)->seek_mean > CFQQ_SEEK_THR)
+
 #define RQ_CIC(rq)             \
        ((struct cfq_io_context *) (rq)->elevator_private)
 #define RQ_CFQQ(rq)            (struct cfq_queue *) ((rq)->elevator_private2)
@@ -137,7 +134,6 @@ struct cfq_queue {
        u64 seek_total;
        sector_t seek_mean;
        sector_t last_request_pos;
-       unsigned long seeky_start;
 
        pid_t pid;
 
@@ -314,6 +310,7 @@ enum cfqq_state_flags {
        CFQ_CFQQ_FLAG_slice_new,        /* no requests dispatched in slice */
        CFQ_CFQQ_FLAG_sync,             /* synchronous queue */
        CFQ_CFQQ_FLAG_coop,             /* cfqq is shared */
+       CFQ_CFQQ_FLAG_split_coop,       /* shared cfqq will be splitted */
        CFQ_CFQQ_FLAG_deep,             /* sync cfqq experienced large depth */
        CFQ_CFQQ_FLAG_wait_busy,        /* Waiting for next request */
 };
@@ -342,6 +339,7 @@ CFQ_CFQQ_FNS(prio_changed);
 CFQ_CFQQ_FNS(slice_new);
 CFQ_CFQQ_FNS(sync);
 CFQ_CFQQ_FNS(coop);
+CFQ_CFQQ_FNS(split_coop);
 CFQ_CFQQ_FNS(deep);
 CFQ_CFQQ_FNS(wait_busy);
 #undef CFQ_CFQQ_FNS
@@ -1565,6 +1563,15 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
        cfq_clear_cfqq_wait_request(cfqq);
        cfq_clear_cfqq_wait_busy(cfqq);
 
+       /*
+        * If this cfqq is shared between multiple processes, check to
+        * make sure that those processes are still issuing I/Os within
+        * the mean seek distance.  If not, it may be time to break the
+        * queues apart again.
+        */
+       if (cfq_cfqq_coop(cfqq) && CFQQ_SEEKY(cfqq))
+               cfq_mark_cfqq_split_coop(cfqq);
+
        /*
         * store what was left of this slice, if the queue idled/timed out
         */
@@ -1663,9 +1670,6 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
                return cfqd->last_position - blk_rq_pos(rq);
 }
 
-#define CFQQ_SEEK_THR          8 * 1024
-#define CFQQ_SEEKY(cfqq)       ((cfqq)->seek_mean > CFQQ_SEEK_THR)
-
 static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
                               struct request *rq, bool for_preempt)
 {
@@ -1803,7 +1807,7 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
         * Otherwise, we do only if they are the last ones
         * in their service tree.
         */
-       return service_tree->count == 1;
+       return service_tree->count == 1 && cfq_cfqq_sync(cfqq);
 }
 
 static void cfq_arm_slice_timer(struct cfq_data *cfqd)
@@ -3000,19 +3004,6 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
        total = cfqq->seek_total + (cfqq->seek_samples/2);
        do_div(total, cfqq->seek_samples);
        cfqq->seek_mean = (sector_t)total;
-
-       /*
-        * If this cfqq is shared between multiple processes, check to
-        * make sure that those processes are still issuing I/Os within
-        * the mean seek distance.  If not, it may be time to break the
-        * queues apart again.
-        */
-       if (cfq_cfqq_coop(cfqq)) {
-               if (CFQQ_SEEKY(cfqq) && !cfqq->seeky_start)
-                       cfqq->seeky_start = jiffies;
-               else if (!CFQQ_SEEKY(cfqq))
-                       cfqq->seeky_start = 0;
-       }
 }
 
 /*
@@ -3076,6 +3067,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
        if (cfq_class_idle(cfqq))
                return true;
 
+       /*
+        * Don't allow a non-RT request to preempt an ongoing RT cfqq timeslice.
+        */
+       if (cfq_class_rt(cfqq) && !cfq_class_rt(new_cfqq))
+               return false;
+
        /*
         * if the new request is sync, but the currently running queue is
         * not, let the sync request have priority.
@@ -3447,14 +3444,6 @@ cfq_merge_cfqqs(struct cfq_data *cfqd, struct cfq_io_context *cic,
        return cic_to_cfqq(cic, 1);
 }
 
-static int should_split_cfqq(struct cfq_queue *cfqq)
-{
-       if (cfqq->seeky_start &&
-           time_after(jiffies, cfqq->seeky_start + CFQQ_COOP_TOUT))
-               return 1;
-       return 0;
-}
-
 /*
  * Returns NULL if a new cfqq should be allocated, or the old cfqq if this
  * was the last process referring to said cfqq.
@@ -3463,9 +3452,9 @@ static struct cfq_queue *
 split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
 {
        if (cfqq_process_refs(cfqq) == 1) {
-               cfqq->seeky_start = 0;
                cfqq->pid = current->pid;
                cfq_clear_cfqq_coop(cfqq);
+               cfq_clear_cfqq_split_coop(cfqq);
                return cfqq;
        }
 
@@ -3504,7 +3493,7 @@ new_queue:
                /*
                 * If the queue was seeky for too long, break it apart.
                 */
-               if (cfq_cfqq_coop(cfqq) && should_split_cfqq(cfqq)) {
+               if (cfq_cfqq_coop(cfqq) && cfq_cfqq_split_coop(cfqq)) {
                        cfq_log_cfqq(cfqd, cfqq, "breaking apart cfqq");
                        cfqq = split_cfqq(cic, cfqq);
                        if (!cfqq)
index b11a4ad7d571fcfa71a69a2ab8e9cfe5a4d82673..d13ba76a169cfbb1de03f6d5b408a18f73bcb8b9 100644 (file)
@@ -867,7 +867,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
 {
        struct gendisk *disk = dev_to_disk(dev);
 
-       return sprintf(buf, "%u\n", queue_discard_alignment(disk->queue));
+       return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
 }
 
 static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
index 81c185a6971fbc3a396d51b5d536fdf34f8d54ed..6a2e295ee2277bc2c88c25c9bbe5a7114940fbb9 100644 (file)
@@ -114,6 +114,16 @@ config CRYPTO_NULL
        help
          These are 'Null' algorithms, used by IPsec, which do nothing.
 
+config CRYPTO_PCRYPT
+       tristate "Parallel crypto engine (EXPERIMENTAL)"
+       depends on SMP && EXPERIMENTAL
+       select PADATA
+       select CRYPTO_MANAGER
+       select CRYPTO_AEAD
+       help
+         This converts an arbitrary crypto algorithm into a parallel
+         algorithm that executes in kernel threads.
+
 config CRYPTO_WORKQUEUE
        tristate
 
index 9e8f61908cb530564891e486a94ca008cc6693b7..d7e6441df7fe97fe46df51e2e6c8d8a37a57efc1 100644 (file)
@@ -56,6 +56,7 @@ obj-$(CONFIG_CRYPTO_XTS) += xts.o
 obj-$(CONFIG_CRYPTO_CTR) += ctr.o
 obj-$(CONFIG_CRYPTO_GCM) += gcm.o
 obj-$(CONFIG_CRYPTO_CCM) += ccm.o
+obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o
 obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
 obj-$(CONFIG_CRYPTO_DES) += des_generic.o
 obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
index f6f08336df5dda1889e1dd46135cef2eb12bb3d7..fe980dae1727a4183035e05002355da9c0514fa3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Asynchronous block chaining cipher operations.
- * 
+ *
  * This is the asynchronous version of blkcipher.c indicating completion
  * via a callback.
  *
@@ -8,7 +8,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
index 0a55da70845e739426dd56a6c2ff704e43a70c0b..6729e8ff68e7346762734538cecda2b8f9909b6d 100644 (file)
@@ -1,13 +1,13 @@
 /*
  * AEAD: Authenticated Encryption with Associated Data
- * 
+ *
  * This file provides API support for AEAD algorithms.
  *
  * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
index e78b7ee44a7453039938fe772e52e2a1768d90ba..a68c73dae15ad3e2a5408c3ddbf6a82885ec3b0e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cryptographic API.
  *
  * AES Cipher Algorithm.
@@ -1127,7 +1127,7 @@ EXPORT_SYMBOL_GPL(crypto_il_tab);
 
 #define star_x(x) (((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b)
 
-#define imix_col(y,x)  do {            \
+#define imix_col(y, x) do {            \
        u       = star_x(x);            \
        v       = star_x(u);            \
        w       = star_x(v);            \
index f149b1c8b76d926183acc6c6f64172777aac0e2c..3e4524e6139bcf3b58e8f44a8de33a96e9333aee 100644 (file)
@@ -230,7 +230,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
        list_add(&alg->cra_list, &crypto_alg_list);
        list_add(&larval->alg.cra_list, &crypto_alg_list);
 
-out:   
+out:
        return larval;
 
 free_larval:
@@ -388,7 +388,7 @@ int crypto_unregister_alg(struct crypto_alg *alg)
 {
        int ret;
        LIST_HEAD(list);
-       
+
        down_write(&crypto_alg_sem);
        ret = crypto_remove_alg(alg, &list);
        up_write(&crypto_alg_sem);
index e42c3a8ba4aa0716c5be85843f54092f7f67fac4..77530d571c961daf18abc05bbc1e8adc4ea195fd 100644 (file)
@@ -469,14 +469,13 @@ static int anubis_setkey(struct crypto_tfm *tfm, const u8 *in_key,
        u32 kappa[ANUBIS_MAX_N];
        u32 inter[ANUBIS_MAX_N];
 
-       switch (key_len)
-       {
+       switch (key_len) {
                case 16: case 20: case 24: case 28:
                case 32: case 36: case 40:
                        break;
                default:
                        *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
-                       return - EINVAL;
+                       return -EINVAL;
        }
 
        ctx->key_len = key_len * 8;
@@ -530,23 +529,24 @@ static int anubis_setkey(struct crypto_tfm *tfm, const u8 *in_key,
                /*
                 * compute kappa^{r+1} from kappa^r:
                 */
-               if (r == R) {
+               if (r == R)
                        break;
-               }
                for (i = 0; i < N; i++) {
                        int j = i;
                        inter[i]  = T0[(kappa[j--] >> 24)       ];
-                       if (j < 0) j = N - 1;
+                       if (j < 0)
+                               j = N - 1;
                        inter[i] ^= T1[(kappa[j--] >> 16) & 0xff];
-                       if (j < 0) j = N - 1;
+                       if (j < 0)
+                               j = N - 1;
                        inter[i] ^= T2[(kappa[j--] >>  8) & 0xff];
-                       if (j < 0) j = N - 1;
+                       if (j < 0)
+                               j = N - 1;
                        inter[i] ^= T3[(kappa[j  ]      ) & 0xff];
                }
                kappa[0] = inter[0] ^ rc[r];
-               for (i = 1; i < N; i++) {
+               for (i = 1; i < N; i++)
                        kappa[i] = inter[i];
-               }
        }
 
        /*
@@ -690,7 +690,7 @@ static struct crypto_alg anubis_alg = {
 static int __init anubis_mod_init(void)
 {
        int ret = 0;
-       
+
        ret = crypto_register_alg(&anubis_alg);
        return ret;
 }
index 798526d9053822640e0747a97c652f1cec402574..033a7147e5ebc4317b3bf082f090e8f2c2c8c115 100644 (file)
@@ -10,7 +10,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -288,11 +288,11 @@ static int crypto_init_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
 
        case CRYPTO_ALG_TYPE_COMPRESS:
                return crypto_init_compress_ops(tfm);
-       
+
        default:
                break;
        }
-       
+
        BUG();
        return -EINVAL;
 }
@@ -315,10 +315,9 @@ static void crypto_exit_ops(struct crypto_tfm *tfm)
        case CRYPTO_ALG_TYPE_COMPRESS:
                crypto_exit_compress_ops(tfm);
                break;
-       
+
        default:
                BUG();
-               
        }
 }
 
@@ -593,12 +592,12 @@ int crypto_has_alg(const char *name, u32 type, u32 mask)
 {
        int ret = 0;
        struct crypto_alg *alg = crypto_alg_mod_lookup(name, type, mask);
-       
+
        if (!IS_ERR(alg)) {
                crypto_mod_put(alg);
                ret = 1;
        }
-       
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_has_alg);
index 4d6f49a5daeb4f75881090abd4c5f556bf5b33c3..18870906ea065a9953e68171e3765c6e4bd4002b 100644 (file)
@@ -194,7 +194,7 @@ static void authenc_verify_ahash_update_done(struct crypto_async_request *areq,
        scatterwalk_map_and_copy(ihash, areq_ctx->sg, areq_ctx->cryptlen,
                                 authsize, 0);
 
-       err = memcmp(ihash, ahreq->result, authsize) ? -EBADMSG: 0;
+       err = memcmp(ihash, ahreq->result, authsize) ? -EBADMSG : 0;
        if (err)
                goto out;
 
@@ -231,7 +231,7 @@ static void authenc_verify_ahash_done(struct crypto_async_request *areq,
        scatterwalk_map_and_copy(ihash, areq_ctx->sg, areq_ctx->cryptlen,
                                 authsize, 0);
 
-       err = memcmp(ihash, ahreq->result, authsize) ? -EBADMSG: 0;
+       err = memcmp(ihash, ahreq->result, authsize) ? -EBADMSG : 0;
        if (err)
                goto out;
 
@@ -464,7 +464,7 @@ static int crypto_authenc_verify(struct aead_request *req,
        ihash = ohash + authsize;
        scatterwalk_map_and_copy(ihash, areq_ctx->sg, areq_ctx->cryptlen,
                                 authsize, 0);
-       return memcmp(ihash, ohash, authsize) ? -EBADMSG: 0;
+       return memcmp(ihash, ohash, authsize) ? -EBADMSG : 0;
 }
 
 static int crypto_authenc_iverify(struct aead_request *req, u8 *iv,
@@ -557,11 +557,11 @@ static int crypto_authenc_init_tfm(struct crypto_tfm *tfm)
 
        ctx->auth = auth;
        ctx->enc = enc;
-       
+
        tfm->crt_aead.reqsize = max_t(unsigned int,
                                crypto_ahash_reqsize(auth) + ctx->reqoff +
                                sizeof(struct authenc_request_ctx) +
-                               sizeof(struct ahash_request), 
+                               sizeof(struct ahash_request),
                                sizeof(struct skcipher_givcrypt_request) +
                                crypto_ablkcipher_reqsize(enc) +
                                crypto_ablkcipher_ivsize(enc));
index 6f5b487319220ebd3bfe9caef96c169e019b7ac2..a67d52ee05800cd5ade61ab0b1fc6d3c8c435b0c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cryptographic API.
  *
  * Blowfish Cipher Algorithm, by Bruce Schneier.
@@ -299,7 +299,7 @@ static const u32 bf_sbox[256 * 4] = {
        0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,
 };
 
-/* 
+/*
  * Round loop unrolling macros, S is a pointer to a S-Box array
  * organized in 4 unsigned longs at a row.
  */
@@ -315,7 +315,7 @@ static const u32 bf_sbox[256 * 4] = {
 
 /*
  * The blowfish encipher, processes 64-bit blocks.
- * NOTE: This function MUSTN'T respect endianess 
+ * NOTE: This function MUSTN'T respect endianess
  */
 static void encrypt_block(struct bf_ctx *bctx, u32 *dst, u32 *src)
 {
@@ -395,7 +395,7 @@ static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
        out_blk[1] = cpu_to_be32(yl);
 }
 
-/* 
+/*
  * Calculates the blowfish S and P boxes for encryption and decryption.
  */
 static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
@@ -417,10 +417,10 @@ static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
 
        /* Actual subkey generation */
        for (j = 0, i = 0; i < 16 + 2; i++) {
-               temp = (((u32 )key[j] << 24) |
-                       ((u32 )key[(j + 1) % keylen] << 16) |
-                       ((u32 )key[(j + 2) % keylen] << 8) |
-                       ((u32 )key[(j + 3) % keylen]));
+               temp = (((u32)key[j] << 24) |
+                       ((u32)key[(j + 1) % keylen] << 16) |
+                       ((u32)key[(j + 2) % keylen] << 8) |
+                       ((u32)key[(j + 3) % keylen]));
 
                P[i] = P[i] ^ temp;
                j = (j + 4) % keylen;
@@ -444,7 +444,7 @@ static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
                        S[count + 1] = data[1];
                }
        }
-       
+
        /* Bruce says not to bother with the weak key check. */
        return 0;
 }
index 964635d163f4767a9ff7a47c271fb1f5bd3a6c59..64cff46ea5e4fcd60bc74c5f7516666d4b4cba66 100644 (file)
 #include <asm/unaligned.h>
 
 static const u32 camellia_sp1110[256] = {
-       0x70707000,0x82828200,0x2c2c2c00,0xececec00,
-       0xb3b3b300,0x27272700,0xc0c0c000,0xe5e5e500,
-       0xe4e4e400,0x85858500,0x57575700,0x35353500,
-       0xeaeaea00,0x0c0c0c00,0xaeaeae00,0x41414100,
-       0x23232300,0xefefef00,0x6b6b6b00,0x93939300,
-       0x45454500,0x19191900,0xa5a5a500,0x21212100,
-       0xededed00,0x0e0e0e00,0x4f4f4f00,0x4e4e4e00,
-       0x1d1d1d00,0x65656500,0x92929200,0xbdbdbd00,
-       0x86868600,0xb8b8b800,0xafafaf00,0x8f8f8f00,
-       0x7c7c7c00,0xebebeb00,0x1f1f1f00,0xcecece00,
-       0x3e3e3e00,0x30303000,0xdcdcdc00,0x5f5f5f00,
-       0x5e5e5e00,0xc5c5c500,0x0b0b0b00,0x1a1a1a00,
-       0xa6a6a600,0xe1e1e100,0x39393900,0xcacaca00,
-       0xd5d5d500,0x47474700,0x5d5d5d00,0x3d3d3d00,
-       0xd9d9d900,0x01010100,0x5a5a5a00,0xd6d6d600,
-       0x51515100,0x56565600,0x6c6c6c00,0x4d4d4d00,
-       0x8b8b8b00,0x0d0d0d00,0x9a9a9a00,0x66666600,
-       0xfbfbfb00,0xcccccc00,0xb0b0b000,0x2d2d2d00,
-       0x74747400,0x12121200,0x2b2b2b00,0x20202000,
-       0xf0f0f000,0xb1b1b100,0x84848400,0x99999900,
-       0xdfdfdf00,0x4c4c4c00,0xcbcbcb00,0xc2c2c200,
-       0x34343400,0x7e7e7e00,0x76767600,0x05050500,
-       0x6d6d6d00,0xb7b7b700,0xa9a9a900,0x31313100,
-       0xd1d1d100,0x17171700,0x04040400,0xd7d7d700,
-       0x14141400,0x58585800,0x3a3a3a00,0x61616100,
-       0xdedede00,0x1b1b1b00,0x11111100,0x1c1c1c00,
-       0x32323200,0x0f0f0f00,0x9c9c9c00,0x16161600,
-       0x53535300,0x18181800,0xf2f2f200,0x22222200,
-       0xfefefe00,0x44444400,0xcfcfcf00,0xb2b2b200,
-       0xc3c3c300,0xb5b5b500,0x7a7a7a00,0x91919100,
-       0x24242400,0x08080800,0xe8e8e800,0xa8a8a800,
-       0x60606000,0xfcfcfc00,0x69696900,0x50505000,
-       0xaaaaaa00,0xd0d0d000,0xa0a0a000,0x7d7d7d00,
-       0xa1a1a100,0x89898900,0x62626200,0x97979700,
-       0x54545400,0x5b5b5b00,0x1e1e1e00,0x95959500,
-       0xe0e0e000,0xffffff00,0x64646400,0xd2d2d200,
-       0x10101000,0xc4c4c400,0x00000000,0x48484800,
-       0xa3a3a300,0xf7f7f700,0x75757500,0xdbdbdb00,
-       0x8a8a8a00,0x03030300,0xe6e6e600,0xdadada00,
-       0x09090900,0x3f3f3f00,0xdddddd00,0x94949400,
-       0x87878700,0x5c5c5c00,0x83838300,0x02020200,
-       0xcdcdcd00,0x4a4a4a00,0x90909000,0x33333300,
-       0x73737300,0x67676700,0xf6f6f600,0xf3f3f300,
-       0x9d9d9d00,0x7f7f7f00,0xbfbfbf00,0xe2e2e200,
-       0x52525200,0x9b9b9b00,0xd8d8d800,0x26262600,
-       0xc8c8c800,0x37373700,0xc6c6c600,0x3b3b3b00,
-       0x81818100,0x96969600,0x6f6f6f00,0x4b4b4b00,
-       0x13131300,0xbebebe00,0x63636300,0x2e2e2e00,
-       0xe9e9e900,0x79797900,0xa7a7a700,0x8c8c8c00,
-       0x9f9f9f00,0x6e6e6e00,0xbcbcbc00,0x8e8e8e00,
-       0x29292900,0xf5f5f500,0xf9f9f900,0xb6b6b600,
-       0x2f2f2f00,0xfdfdfd00,0xb4b4b400,0x59595900,
-       0x78787800,0x98989800,0x06060600,0x6a6a6a00,
-       0xe7e7e700,0x46464600,0x71717100,0xbababa00,
-       0xd4d4d400,0x25252500,0xababab00,0x42424200,
-       0x88888800,0xa2a2a200,0x8d8d8d00,0xfafafa00,
-       0x72727200,0x07070700,0xb9b9b900,0x55555500,
-       0xf8f8f800,0xeeeeee00,0xacacac00,0x0a0a0a00,
-       0x36363600,0x49494900,0x2a2a2a00,0x68686800,
-       0x3c3c3c00,0x38383800,0xf1f1f100,0xa4a4a400,
-       0x40404000,0x28282800,0xd3d3d300,0x7b7b7b00,
-       0xbbbbbb00,0xc9c9c900,0x43434300,0xc1c1c100,
-       0x15151500,0xe3e3e300,0xadadad00,0xf4f4f400,
-       0x77777700,0xc7c7c700,0x80808000,0x9e9e9e00,
+       0x70707000, 0x82828200, 0x2c2c2c00, 0xececec00,
+       0xb3b3b300, 0x27272700, 0xc0c0c000, 0xe5e5e500,
+       0xe4e4e400, 0x85858500, 0x57575700, 0x35353500,
+       0xeaeaea00, 0x0c0c0c00, 0xaeaeae00, 0x41414100,
+       0x23232300, 0xefefef00, 0x6b6b6b00, 0x93939300,
+       0x45454500, 0x19191900, 0xa5a5a500, 0x21212100,
+       0xededed00, 0x0e0e0e00, 0x4f4f4f00, 0x4e4e4e00,
+       0x1d1d1d00, 0x65656500, 0x92929200, 0xbdbdbd00,
+       0x86868600, 0xb8b8b800, 0xafafaf00, 0x8f8f8f00,
+       0x7c7c7c00, 0xebebeb00, 0x1f1f1f00, 0xcecece00,
+       0x3e3e3e00, 0x30303000, 0xdcdcdc00, 0x5f5f5f00,
+       0x5e5e5e00, 0xc5c5c500, 0x0b0b0b00, 0x1a1a1a00,
+       0xa6a6a600, 0xe1e1e100, 0x39393900, 0xcacaca00,
+       0xd5d5d500, 0x47474700, 0x5d5d5d00, 0x3d3d3d00,
+       0xd9d9d900, 0x01010100, 0x5a5a5a00, 0xd6d6d600,
+       0x51515100, 0x56565600, 0x6c6c6c00, 0x4d4d4d00,
+       0x8b8b8b00, 0x0d0d0d00, 0x9a9a9a00, 0x66666600,
+       0xfbfbfb00, 0xcccccc00, 0xb0b0b000, 0x2d2d2d00,
+       0x74747400, 0x12121200, 0x2b2b2b00, 0x20202000,
+       0xf0f0f000, 0xb1b1b100, 0x84848400, 0x99999900,
+       0xdfdfdf00, 0x4c4c4c00, 0xcbcbcb00, 0xc2c2c200,
+       0x34343400, 0x7e7e7e00, 0x76767600, 0x05050500,
+       0x6d6d6d00, 0xb7b7b700, 0xa9a9a900, 0x31313100,
+       0xd1d1d100, 0x17171700, 0x04040400, 0xd7d7d700,
+       0x14141400, 0x58585800, 0x3a3a3a00, 0x61616100,
+       0xdedede00, 0x1b1b1b00, 0x11111100, 0x1c1c1c00,
+       0x32323200, 0x0f0f0f00, 0x9c9c9c00, 0x16161600,
+       0x53535300, 0x18181800, 0xf2f2f200, 0x22222200,
+       0xfefefe00, 0x44444400, 0xcfcfcf00, 0xb2b2b200,
+       0xc3c3c300, 0xb5b5b500, 0x7a7a7a00, 0x91919100,
+       0x24242400, 0x08080800, 0xe8e8e800, 0xa8a8a800,
+       0x60606000, 0xfcfcfc00, 0x69696900, 0x50505000,
+       0xaaaaaa00, 0xd0d0d000, 0xa0a0a000, 0x7d7d7d00,
+       0xa1a1a100, 0x89898900, 0x62626200, 0x97979700,
+       0x54545400, 0x5b5b5b00, 0x1e1e1e00, 0x95959500,
+       0xe0e0e000, 0xffffff00, 0x64646400, 0xd2d2d200,
+       0x10101000, 0xc4c4c400, 0x00000000, 0x48484800,
+       0xa3a3a300, 0xf7f7f700, 0x75757500, 0xdbdbdb00,
+       0x8a8a8a00, 0x03030300, 0xe6e6e600, 0xdadada00,
+       0x09090900, 0x3f3f3f00, 0xdddddd00, 0x94949400,
+       0x87878700, 0x5c5c5c00, 0x83838300, 0x02020200,
+       0xcdcdcd00, 0x4a4a4a00, 0x90909000, 0x33333300,
+       0x73737300, 0x67676700, 0xf6f6f600, 0xf3f3f300,
+       0x9d9d9d00, 0x7f7f7f00, 0xbfbfbf00, 0xe2e2e200,
+       0x52525200, 0x9b9b9b00, 0xd8d8d800, 0x26262600,
+       0xc8c8c800, 0x37373700, 0xc6c6c600, 0x3b3b3b00,
+       0x81818100, 0x96969600, 0x6f6f6f00, 0x4b4b4b00,
+       0x13131300, 0xbebebe00, 0x63636300, 0x2e2e2e00,
+       0xe9e9e900, 0x79797900, 0xa7a7a700, 0x8c8c8c00,
+       0x9f9f9f00, 0x6e6e6e00, 0xbcbcbc00, 0x8e8e8e00,
+       0x29292900, 0xf5f5f500, 0xf9f9f900, 0xb6b6b600,
+       0x2f2f2f00, 0xfdfdfd00, 0xb4b4b400, 0x59595900,
+       0x78787800, 0x98989800, 0x06060600, 0x6a6a6a00,
+       0xe7e7e700, 0x46464600, 0x71717100, 0xbababa00,
+       0xd4d4d400, 0x25252500, 0xababab00, 0x42424200,
+       0x88888800, 0xa2a2a200, 0x8d8d8d00, 0xfafafa00,
+       0x72727200, 0x07070700, 0xb9b9b900, 0x55555500,
+       0xf8f8f800, 0xeeeeee00, 0xacacac00, 0x0a0a0a00,
+       0x36363600, 0x49494900, 0x2a2a2a00, 0x68686800,
+       0x3c3c3c00, 0x38383800, 0xf1f1f100, 0xa4a4a400,
+       0x40404000, 0x28282800, 0xd3d3d300, 0x7b7b7b00,
+       0xbbbbbb00, 0xc9c9c900, 0x43434300, 0xc1c1c100,
+       0x15151500, 0xe3e3e300, 0xadadad00, 0xf4f4f400,
+       0x77777700, 0xc7c7c700, 0x80808000, 0x9e9e9e00,
 };
 
 static const u32 camellia_sp0222[256] = {
-       0x00e0e0e0,0x00050505,0x00585858,0x00d9d9d9,
-       0x00676767,0x004e4e4e,0x00818181,0x00cbcbcb,
-       0x00c9c9c9,0x000b0b0b,0x00aeaeae,0x006a6a6a,
-       0x00d5d5d5,0x00181818,0x005d5d5d,0x00828282,
-       0x00464646,0x00dfdfdf,0x00d6d6d6,0x00272727,
-       0x008a8a8a,0x00323232,0x004b4b4b,0x00424242,
-       0x00dbdbdb,0x001c1c1c,0x009e9e9e,0x009c9c9c,
-       0x003a3a3a,0x00cacaca,0x00252525,0x007b7b7b,
-       0x000d0d0d,0x00717171,0x005f5f5f,0x001f1f1f,
-       0x00f8f8f8,0x00d7d7d7,0x003e3e3e,0x009d9d9d,
-       0x007c7c7c,0x00606060,0x00b9b9b9,0x00bebebe,
-       0x00bcbcbc,0x008b8b8b,0x00161616,0x00343434,
-       0x004d4d4d,0x00c3c3c3,0x00727272,0x00959595,
-       0x00ababab,0x008e8e8e,0x00bababa,0x007a7a7a,
-       0x00b3b3b3,0x00020202,0x00b4b4b4,0x00adadad,
-       0x00a2a2a2,0x00acacac,0x00d8d8d8,0x009a9a9a,
-       0x00171717,0x001a1a1a,0x00353535,0x00cccccc,
-       0x00f7f7f7,0x00999999,0x00616161,0x005a5a5a,
-       0x00e8e8e8,0x00242424,0x00565656,0x00404040,
-       0x00e1e1e1,0x00636363,0x00090909,0x00333333,
-       0x00bfbfbf,0x00989898,0x00979797,0x00858585,
-       0x00686868,0x00fcfcfc,0x00ececec,0x000a0a0a,
-       0x00dadada,0x006f6f6f,0x00535353,0x00626262,
-       0x00a3a3a3,0x002e2e2e,0x00080808,0x00afafaf,
-       0x00282828,0x00b0b0b0,0x00747474,0x00c2c2c2,
-       0x00bdbdbd,0x00363636,0x00222222,0x00383838,
-       0x00646464,0x001e1e1e,0x00393939,0x002c2c2c,
-       0x00a6a6a6,0x00303030,0x00e5e5e5,0x00444444,
-       0x00fdfdfd,0x00888888,0x009f9f9f,0x00656565,
-       0x00878787,0x006b6b6b,0x00f4f4f4,0x00232323,
-       0x00484848,0x00101010,0x00d1d1d1,0x00515151,
-       0x00c0c0c0,0x00f9f9f9,0x00d2d2d2,0x00a0a0a0,
-       0x00555555,0x00a1a1a1,0x00414141,0x00fafafa,
-       0x00434343,0x00131313,0x00c4c4c4,0x002f2f2f,
-       0x00a8a8a8,0x00b6b6b6,0x003c3c3c,0x002b2b2b,
-       0x00c1c1c1,0x00ffffff,0x00c8c8c8,0x00a5a5a5,
-       0x00202020,0x00898989,0x00000000,0x00909090,
-       0x00474747,0x00efefef,0x00eaeaea,0x00b7b7b7,
-       0x00151515,0x00060606,0x00cdcdcd,0x00b5b5b5,
-       0x00121212,0x007e7e7e,0x00bbbbbb,0x00292929,
-       0x000f0f0f,0x00b8b8b8,0x00070707,0x00040404,
-       0x009b9b9b,0x00949494,0x00212121,0x00666666,
-       0x00e6e6e6,0x00cecece,0x00ededed,0x00e7e7e7,
-       0x003b3b3b,0x00fefefe,0x007f7f7f,0x00c5c5c5,
-       0x00a4a4a4,0x00373737,0x00b1b1b1,0x004c4c4c,
-       0x00919191,0x006e6e6e,0x008d8d8d,0x00767676,
-       0x00030303,0x002d2d2d,0x00dedede,0x00969696,
-       0x00262626,0x007d7d7d,0x00c6c6c6,0x005c5c5c,
-       0x00d3d3d3,0x00f2f2f2,0x004f4f4f,0x00191919,
-       0x003f3f3f,0x00dcdcdc,0x00797979,0x001d1d1d,
-       0x00525252,0x00ebebeb,0x00f3f3f3,0x006d6d6d,
-       0x005e5e5e,0x00fbfbfb,0x00696969,0x00b2b2b2,
-       0x00f0f0f0,0x00313131,0x000c0c0c,0x00d4d4d4,
-       0x00cfcfcf,0x008c8c8c,0x00e2e2e2,0x00757575,
-       0x00a9a9a9,0x004a4a4a,0x00575757,0x00848484,
-       0x00111111,0x00454545,0x001b1b1b,0x00f5f5f5,
-       0x00e4e4e4,0x000e0e0e,0x00737373,0x00aaaaaa,
-       0x00f1f1f1,0x00dddddd,0x00595959,0x00141414,
-       0x006c6c6c,0x00929292,0x00545454,0x00d0d0d0,
-       0x00787878,0x00707070,0x00e3e3e3,0x00494949,
-       0x00808080,0x00505050,0x00a7a7a7,0x00f6f6f6,
-       0x00777777,0x00939393,0x00868686,0x00838383,
-       0x002a2a2a,0x00c7c7c7,0x005b5b5b,0x00e9e9e9,
-       0x00eeeeee,0x008f8f8f,0x00010101,0x003d3d3d,
+       0x00e0e0e0, 0x00050505, 0x00585858, 0x00d9d9d9,
+       0x00676767, 0x004e4e4e, 0x00818181, 0x00cbcbcb,
+       0x00c9c9c9, 0x000b0b0b, 0x00aeaeae, 0x006a6a6a,
+       0x00d5d5d5, 0x00181818, 0x005d5d5d, 0x00828282,
+       0x00464646, 0x00dfdfdf, 0x00d6d6d6, 0x00272727,
+       0x008a8a8a, 0x00323232, 0x004b4b4b, 0x00424242,
+       0x00dbdbdb, 0x001c1c1c, 0x009e9e9e, 0x009c9c9c,
+       0x003a3a3a, 0x00cacaca, 0x00252525, 0x007b7b7b,
+       0x000d0d0d, 0x00717171, 0x005f5f5f, 0x001f1f1f,
+       0x00f8f8f8, 0x00d7d7d7, 0x003e3e3e, 0x009d9d9d,
+       0x007c7c7c, 0x00606060, 0x00b9b9b9, 0x00bebebe,
+       0x00bcbcbc, 0x008b8b8b, 0x00161616, 0x00343434,
+       0x004d4d4d, 0x00c3c3c3, 0x00727272, 0x00959595,
+       0x00ababab, 0x008e8e8e, 0x00bababa, 0x007a7a7a,
+       0x00b3b3b3, 0x00020202, 0x00b4b4b4, 0x00adadad,
+       0x00a2a2a2, 0x00acacac, 0x00d8d8d8, 0x009a9a9a,
+       0x00171717, 0x001a1a1a, 0x00353535, 0x00cccccc,
+       0x00f7f7f7, 0x00999999, 0x00616161, 0x005a5a5a,
+       0x00e8e8e8, 0x00242424, 0x00565656, 0x00404040,
+       0x00e1e1e1, 0x00636363, 0x00090909, 0x00333333,
+       0x00bfbfbf, 0x00989898, 0x00979797, 0x00858585,
+       0x00686868, 0x00fcfcfc, 0x00ececec, 0x000a0a0a,
+       0x00dadada, 0x006f6f6f, 0x00535353, 0x00626262,
+       0x00a3a3a3, 0x002e2e2e, 0x00080808, 0x00afafaf,
+       0x00282828, 0x00b0b0b0, 0x00747474, 0x00c2c2c2,
+       0x00bdbdbd, 0x00363636, 0x00222222, 0x00383838,
+       0x00646464, 0x001e1e1e, 0x00393939, 0x002c2c2c,
+       0x00a6a6a6, 0x00303030, 0x00e5e5e5, 0x00444444,
+       0x00fdfdfd, 0x00888888, 0x009f9f9f, 0x00656565,
+       0x00878787, 0x006b6b6b, 0x00f4f4f4, 0x00232323,
+       0x00484848, 0x00101010, 0x00d1d1d1, 0x00515151,
+       0x00c0c0c0, 0x00f9f9f9, 0x00d2d2d2, 0x00a0a0a0,
+       0x00555555, 0x00a1a1a1, 0x00414141, 0x00fafafa,
+       0x00434343, 0x00131313, 0x00c4c4c4, 0x002f2f2f,
+       0x00a8a8a8, 0x00b6b6b6, 0x003c3c3c, 0x002b2b2b,
+       0x00c1c1c1, 0x00ffffff, 0x00c8c8c8, 0x00a5a5a5,
+       0x00202020, 0x00898989, 0x00000000, 0x00909090,
+       0x00474747, 0x00efefef, 0x00eaeaea, 0x00b7b7b7,
+       0x00151515, 0x00060606, 0x00cdcdcd, 0x00b5b5b5,
+       0x00121212, 0x007e7e7e, 0x00bbbbbb, 0x00292929,
+       0x000f0f0f, 0x00b8b8b8, 0x00070707, 0x00040404,
+       0x009b9b9b, 0x00949494, 0x00212121, 0x00666666,
+       0x00e6e6e6, 0x00cecece, 0x00ededed, 0x00e7e7e7,
+       0x003b3b3b, 0x00fefefe, 0x007f7f7f, 0x00c5c5c5,
+       0x00a4a4a4, 0x00373737, 0x00b1b1b1, 0x004c4c4c,
+       0x00919191, 0x006e6e6e, 0x008d8d8d, 0x00767676,
+       0x00030303, 0x002d2d2d, 0x00dedede, 0x00969696,
+       0x00262626, 0x007d7d7d, 0x00c6c6c6, 0x005c5c5c,
+       0x00d3d3d3, 0x00f2f2f2, 0x004f4f4f, 0x00191919,
+       0x003f3f3f, 0x00dcdcdc, 0x00797979, 0x001d1d1d,
+       0x00525252, 0x00ebebeb, 0x00f3f3f3, 0x006d6d6d,
+       0x005e5e5e, 0x00fbfbfb, 0x00696969, 0x00b2b2b2,
+       0x00f0f0f0, 0x00313131, 0x000c0c0c, 0x00d4d4d4,
+       0x00cfcfcf, 0x008c8c8c, 0x00e2e2e2, 0x00757575,
+       0x00a9a9a9, 0x004a4a4a, 0x00575757, 0x00848484,
+       0x00111111, 0x00454545, 0x001b1b1b, 0x00f5f5f5,
+       0x00e4e4e4, 0x000e0e0e, 0x00737373, 0x00aaaaaa,
+       0x00f1f1f1, 0x00dddddd, 0x00595959, 0x00141414,
+       0x006c6c6c, 0x00929292, 0x00545454, 0x00d0d0d0,
+       0x00787878, 0x00707070, 0x00e3e3e3, 0x00494949,
+       0x00808080, 0x00505050, 0x00a7a7a7, 0x00f6f6f6,
+       0x00777777, 0x00939393, 0x00868686, 0x00838383,
+       0x002a2a2a, 0x00c7c7c7, 0x005b5b5b, 0x00e9e9e9,
+       0x00eeeeee, 0x008f8f8f, 0x00010101, 0x003d3d3d,
 };
 
 static const u32 camellia_sp3033[256] = {
-       0x38003838,0x41004141,0x16001616,0x76007676,
-       0xd900d9d9,0x93009393,0x60006060,0xf200f2f2,
-       0x72007272,0xc200c2c2,0xab00abab,0x9a009a9a,
-       0x75007575,0x06000606,0x57005757,0xa000a0a0,
-       0x91009191,0xf700f7f7,0xb500b5b5,0xc900c9c9,
-       0xa200a2a2,0x8c008c8c,0xd200d2d2,0x90009090,
-       0xf600f6f6,0x07000707,0xa700a7a7,0x27002727,
-       0x8e008e8e,0xb200b2b2,0x49004949,0xde00dede,
-       0x43004343,0x5c005c5c,0xd700d7d7,0xc700c7c7,
-       0x3e003e3e,0xf500f5f5,0x8f008f8f,0x67006767,
-       0x1f001f1f,0x18001818,0x6e006e6e,0xaf00afaf,
-       0x2f002f2f,0xe200e2e2,0x85008585,0x0d000d0d,
-       0x53005353,0xf000f0f0,0x9c009c9c,0x65006565,
-       0xea00eaea,0xa300a3a3,0xae00aeae,0x9e009e9e,
-       0xec00ecec,0x80008080,0x2d002d2d,0x6b006b6b,
-       0xa800a8a8,0x2b002b2b,0x36003636,0xa600a6a6,
-       0xc500c5c5,0x86008686,0x4d004d4d,0x33003333,
-       0xfd00fdfd,0x66006666,0x58005858,0x96009696,
-       0x3a003a3a,0x09000909,0x95009595,0x10001010,
-       0x78007878,0xd800d8d8,0x42004242,0xcc00cccc,
-       0xef00efef,0x26002626,0xe500e5e5,0x61006161,
-       0x1a001a1a,0x3f003f3f,0x3b003b3b,0x82008282,
-       0xb600b6b6,0xdb00dbdb,0xd400d4d4,0x98009898,
-       0xe800e8e8,0x8b008b8b,0x02000202,0xeb00ebeb,
-       0x0a000a0a,0x2c002c2c,0x1d001d1d,0xb000b0b0,
-       0x6f006f6f,0x8d008d8d,0x88008888,0x0e000e0e,
-       0x19001919,0x87008787,0x4e004e4e,0x0b000b0b,
-       0xa900a9a9,0x0c000c0c,0x79007979,0x11001111,
-       0x7f007f7f,0x22002222,0xe700e7e7,0x59005959,
-       0xe100e1e1,0xda00dada,0x3d003d3d,0xc800c8c8,
-       0x12001212,0x04000404,0x74007474,0x54005454,
-       0x30003030,0x7e007e7e,0xb400b4b4,0x28002828,
-       0x55005555,0x68006868,0x50005050,0xbe00bebe,
-       0xd000d0d0,0xc400c4c4,0x31003131,0xcb00cbcb,
-       0x2a002a2a,0xad00adad,0x0f000f0f,0xca00caca,
-       0x70007070,0xff00ffff,0x32003232,0x69006969,
-       0x08000808,0x62006262,0x00000000,0x24002424,
-       0xd100d1d1,0xfb00fbfb,0xba00baba,0xed00eded,
-       0x45004545,0x81008181,0x73007373,0x6d006d6d,
-       0x84008484,0x9f009f9f,0xee00eeee,0x4a004a4a,
-       0xc300c3c3,0x2e002e2e,0xc100c1c1,0x01000101,
-       0xe600e6e6,0x25002525,0x48004848,0x99009999,
-       0xb900b9b9,0xb300b3b3,0x7b007b7b,0xf900f9f9,
-       0xce00cece,0xbf00bfbf,0xdf00dfdf,0x71007171,
-       0x29002929,0xcd00cdcd,0x6c006c6c,0x13001313,
-       0x64006464,0x9b009b9b,0x63006363,0x9d009d9d,
-       0xc000c0c0,0x4b004b4b,0xb700b7b7,0xa500a5a5,
-       0x89008989,0x5f005f5f,0xb100b1b1,0x17001717,
-       0xf400f4f4,0xbc00bcbc,0xd300d3d3,0x46004646,
-       0xcf00cfcf,0x37003737,0x5e005e5e,0x47004747,
-       0x94009494,0xfa00fafa,0xfc00fcfc,0x5b005b5b,
-       0x97009797,0xfe00fefe,0x5a005a5a,0xac00acac,
-       0x3c003c3c,0x4c004c4c,0x03000303,0x35003535,
-       0xf300f3f3,0x23002323,0xb800b8b8,0x5d005d5d,
-       0x6a006a6a,0x92009292,0xd500d5d5,0x21002121,
-       0x44004444,0x51005151,0xc600c6c6,0x7d007d7d,
-       0x39003939,0x83008383,0xdc00dcdc,0xaa00aaaa,
-       0x7c007c7c,0x77007777,0x56005656,0x05000505,
-       0x1b001b1b,0xa400a4a4,0x15001515,0x34003434,
-       0x1e001e1e,0x1c001c1c,0xf800f8f8,0x52005252,
-       0x20002020,0x14001414,0xe900e9e9,0xbd00bdbd,
-       0xdd00dddd,0xe400e4e4,0xa100a1a1,0xe000e0e0,
-       0x8a008a8a,0xf100f1f1,0xd600d6d6,0x7a007a7a,
-       0xbb00bbbb,0xe300e3e3,0x40004040,0x4f004f4f,
+       0x38003838, 0x41004141, 0x16001616, 0x76007676,
+       0xd900d9d9, 0x93009393, 0x60006060, 0xf200f2f2,
+       0x72007272, 0xc200c2c2, 0xab00abab, 0x9a009a9a,
+       0x75007575, 0x06000606, 0x57005757, 0xa000a0a0,
+       0x91009191, 0xf700f7f7, 0xb500b5b5, 0xc900c9c9,
+       0xa200a2a2, 0x8c008c8c, 0xd200d2d2, 0x90009090,
+       0xf600f6f6, 0x07000707, 0xa700a7a7, 0x27002727,
+       0x8e008e8e, 0xb200b2b2, 0x49004949, 0xde00dede,
+       0x43004343, 0x5c005c5c, 0xd700d7d7, 0xc700c7c7,
+       0x3e003e3e, 0xf500f5f5, 0x8f008f8f, 0x67006767,
+       0x1f001f1f, 0x18001818, 0x6e006e6e, 0xaf00afaf,
+       0x2f002f2f, 0xe200e2e2, 0x85008585, 0x0d000d0d,
+       0x53005353, 0xf000f0f0, 0x9c009c9c, 0x65006565,
+       0xea00eaea, 0xa300a3a3, 0xae00aeae, 0x9e009e9e,
+       0xec00ecec, 0x80008080, 0x2d002d2d, 0x6b006b6b,
+       0xa800a8a8, 0x2b002b2b, 0x36003636, 0xa600a6a6,
+       0xc500c5c5, 0x86008686, 0x4d004d4d, 0x33003333,
+       0xfd00fdfd, 0x66006666, 0x58005858, 0x96009696,
+       0x3a003a3a, 0x09000909, 0x95009595, 0x10001010,
+       0x78007878, 0xd800d8d8, 0x42004242, 0xcc00cccc,
+       0xef00efef, 0x26002626, 0xe500e5e5, 0x61006161,
+       0x1a001a1a, 0x3f003f3f, 0x3b003b3b, 0x82008282,
+       0xb600b6b6, 0xdb00dbdb, 0xd400d4d4, 0x98009898,
+       0xe800e8e8, 0x8b008b8b, 0x02000202, 0xeb00ebeb,
+       0x0a000a0a, 0x2c002c2c, 0x1d001d1d, 0xb000b0b0,
+       0x6f006f6f, 0x8d008d8d, 0x88008888, 0x0e000e0e,
+       0x19001919, 0x87008787, 0x4e004e4e, 0x0b000b0b,
+       0xa900a9a9, 0x0c000c0c, 0x79007979, 0x11001111,
+       0x7f007f7f, 0x22002222, 0xe700e7e7, 0x59005959,
+       0xe100e1e1, 0xda00dada, 0x3d003d3d, 0xc800c8c8,
+       0x12001212, 0x04000404, 0x74007474, 0x54005454,
+       0x30003030, 0x7e007e7e, 0xb400b4b4, 0x28002828,
+       0x55005555, 0x68006868, 0x50005050, 0xbe00bebe,
+       0xd000d0d0, 0xc400c4c4, 0x31003131, 0xcb00cbcb,
+       0x2a002a2a, 0xad00adad, 0x0f000f0f, 0xca00caca,
+       0x70007070, 0xff00ffff, 0x32003232, 0x69006969,
+       0x08000808, 0x62006262, 0x00000000, 0x24002424,
+       0xd100d1d1, 0xfb00fbfb, 0xba00baba, 0xed00eded,
+       0x45004545, 0x81008181, 0x73007373, 0x6d006d6d,
+       0x84008484, 0x9f009f9f, 0xee00eeee, 0x4a004a4a,
+       0xc300c3c3, 0x2e002e2e, 0xc100c1c1, 0x01000101,
+       0xe600e6e6, 0x25002525, 0x48004848, 0x99009999,
+       0xb900b9b9, 0xb300b3b3, 0x7b007b7b, 0xf900f9f9,
+       0xce00cece, 0xbf00bfbf, 0xdf00dfdf, 0x71007171,
+       0x29002929, 0xcd00cdcd, 0x6c006c6c, 0x13001313,
+       0x64006464, 0x9b009b9b, 0x63006363, 0x9d009d9d,
+       0xc000c0c0, 0x4b004b4b, 0xb700b7b7, 0xa500a5a5,
+       0x89008989, 0x5f005f5f, 0xb100b1b1, 0x17001717,
+       0xf400f4f4, 0xbc00bcbc, 0xd300d3d3, 0x46004646,
+       0xcf00cfcf, 0x37003737, 0x5e005e5e, 0x47004747,
+       0x94009494, 0xfa00fafa, 0xfc00fcfc, 0x5b005b5b,
+       0x97009797, 0xfe00fefe, 0x5a005a5a, 0xac00acac,
+       0x3c003c3c, 0x4c004c4c, 0x03000303, 0x35003535,
+       0xf300f3f3, 0x23002323, 0xb800b8b8, 0x5d005d5d,
+       0x6a006a6a, 0x92009292, 0xd500d5d5, 0x21002121,
+       0x44004444, 0x51005151, 0xc600c6c6, 0x7d007d7d,
+       0x39003939, 0x83008383, 0xdc00dcdc, 0xaa00aaaa,
+       0x7c007c7c, 0x77007777, 0x56005656, 0x05000505,
+       0x1b001b1b, 0xa400a4a4, 0x15001515, 0x34003434,
+       0x1e001e1e, 0x1c001c1c, 0xf800f8f8, 0x52005252,
+       0x20002020, 0x14001414, 0xe900e9e9, 0xbd00bdbd,
+       0xdd00dddd, 0xe400e4e4, 0xa100a1a1, 0xe000e0e0,
+       0x8a008a8a, 0xf100f1f1, 0xd600d6d6, 0x7a007a7a,
+       0xbb00bbbb, 0xe300e3e3, 0x40004040, 0x4f004f4f,
 };
 
 static const u32 camellia_sp4404[256] = {
-       0x70700070,0x2c2c002c,0xb3b300b3,0xc0c000c0,
-       0xe4e400e4,0x57570057,0xeaea00ea,0xaeae00ae,
-       0x23230023,0x6b6b006b,0x45450045,0xa5a500a5,
-       0xeded00ed,0x4f4f004f,0x1d1d001d,0x92920092,
-       0x86860086,0xafaf00af,0x7c7c007c,0x1f1f001f,
-       0x3e3e003e,0xdcdc00dc,0x5e5e005e,0x0b0b000b,
-       0xa6a600a6,0x39390039,0xd5d500d5,0x5d5d005d,
-       0xd9d900d9,0x5a5a005a,0x51510051,0x6c6c006c,
-       0x8b8b008b,0x9a9a009a,0xfbfb00fb,0xb0b000b0,
-       0x74740074,0x2b2b002b,0xf0f000f0,0x84840084,
-       0xdfdf00df,0xcbcb00cb,0x34340034,0x76760076,
-       0x6d6d006d,0xa9a900a9,0xd1d100d1,0x04040004,
-       0x14140014,0x3a3a003a,0xdede00de,0x11110011,
-       0x32320032,0x9c9c009c,0x53530053,0xf2f200f2,
-       0xfefe00fe,0xcfcf00cf,0xc3c300c3,0x7a7a007a,
-       0x24240024,0xe8e800e8,0x60600060,0x69690069,
-       0xaaaa00aa,0xa0a000a0,0xa1a100a1,0x62620062,
-       0x54540054,0x1e1e001e,0xe0e000e0,0x64640064,
-       0x10100010,0x00000000,0xa3a300a3,0x75750075,
-       0x8a8a008a,0xe6e600e6,0x09090009,0xdddd00dd,
-       0x87870087,0x83830083,0xcdcd00cd,0x90900090,
-       0x73730073,0xf6f600f6,0x9d9d009d,0xbfbf00bf,
-       0x52520052,0xd8d800d8,0xc8c800c8,0xc6c600c6,
-       0x81810081,0x6f6f006f,0x13130013,0x63630063,
-       0xe9e900e9,0xa7a700a7,0x9f9f009f,0xbcbc00bc,
-       0x29290029,0xf9f900f9,0x2f2f002f,0xb4b400b4,
-       0x78780078,0x06060006,0xe7e700e7,0x71710071,
-       0xd4d400d4,0xabab00ab,0x88880088,0x8d8d008d,
-       0x72720072,0xb9b900b9,0xf8f800f8,0xacac00ac,
-       0x36360036,0x2a2a002a,0x3c3c003c,0xf1f100f1,
-       0x40400040,0xd3d300d3,0xbbbb00bb,0x43430043,
-       0x15150015,0xadad00ad,0x77770077,0x80800080,
-       0x82820082,0xecec00ec,0x27270027,0xe5e500e5,
-       0x85850085,0x35350035,0x0c0c000c,0x41410041,
-       0xefef00ef,0x93930093,0x19190019,0x21210021,
-       0x0e0e000e,0x4e4e004e,0x65650065,0xbdbd00bd,
-       0xb8b800b8,0x8f8f008f,0xebeb00eb,0xcece00ce,
-       0x30300030,0x5f5f005f,0xc5c500c5,0x1a1a001a,
-       0xe1e100e1,0xcaca00ca,0x47470047,0x3d3d003d,
-       0x01010001,0xd6d600d6,0x56560056,0x4d4d004d,
-       0x0d0d000d,0x66660066,0xcccc00cc,0x2d2d002d,
-       0x12120012,0x20200020,0xb1b100b1,0x99990099,
-       0x4c4c004c,0xc2c200c2,0x7e7e007e,0x05050005,
-       0xb7b700b7,0x31310031,0x17170017,0xd7d700d7,
-       0x58580058,0x61610061,0x1b1b001b,0x1c1c001c,
-       0x0f0f000f,0x16160016,0x18180018,0x22220022,
-       0x44440044,0xb2b200b2,0xb5b500b5,0x91910091,
-       0x08080008,0xa8a800a8,0xfcfc00fc,0x50500050,
-       0xd0d000d0,0x7d7d007d,0x89890089,0x97970097,
-       0x5b5b005b,0x95950095,0xffff00ff,0xd2d200d2,
-       0xc4c400c4,0x48480048,0xf7f700f7,0xdbdb00db,
-       0x03030003,0xdada00da,0x3f3f003f,0x94940094,
-       0x5c5c005c,0x02020002,0x4a4a004a,0x33330033,
-       0x67670067,0xf3f300f3,0x7f7f007f,0xe2e200e2,
-       0x9b9b009b,0x26260026,0x37370037,0x3b3b003b,
-       0x96960096,0x4b4b004b,0xbebe00be,0x2e2e002e,
-       0x79790079,0x8c8c008c,0x6e6e006e,0x8e8e008e,
-       0xf5f500f5,0xb6b600b6,0xfdfd00fd,0x59590059,
-       0x98980098,0x6a6a006a,0x46460046,0xbaba00ba,
-       0x25250025,0x42420042,0xa2a200a2,0xfafa00fa,
-       0x07070007,0x55550055,0xeeee00ee,0x0a0a000a,
-       0x49490049,0x68680068,0x38380038,0xa4a400a4,
-       0x28280028,0x7b7b007b,0xc9c900c9,0xc1c100c1,
-       0xe3e300e3,0xf4f400f4,0xc7c700c7,0x9e9e009e,
+       0x70700070, 0x2c2c002c, 0xb3b300b3, 0xc0c000c0,
+       0xe4e400e4, 0x57570057, 0xeaea00ea, 0xaeae00ae,
+       0x23230023, 0x6b6b006b, 0x45450045, 0xa5a500a5,
+       0xeded00ed, 0x4f4f004f, 0x1d1d001d, 0x92920092,
+       0x86860086, 0xafaf00af, 0x7c7c007c, 0x1f1f001f,
+       0x3e3e003e, 0xdcdc00dc, 0x5e5e005e, 0x0b0b000b,
+       0xa6a600a6, 0x39390039, 0xd5d500d5, 0x5d5d005d,
+       0xd9d900d9, 0x5a5a005a, 0x51510051, 0x6c6c006c,
+       0x8b8b008b, 0x9a9a009a, 0xfbfb00fb, 0xb0b000b0,
+       0x74740074, 0x2b2b002b, 0xf0f000f0, 0x84840084,
+       0xdfdf00df, 0xcbcb00cb, 0x34340034, 0x76760076,
+       0x6d6d006d, 0xa9a900a9, 0xd1d100d1, 0x04040004,
+       0x14140014, 0x3a3a003a, 0xdede00de, 0x11110011,
+       0x32320032, 0x9c9c009c, 0x53530053, 0xf2f200f2,
+       0xfefe00fe, 0xcfcf00cf, 0xc3c300c3, 0x7a7a007a,
+       0x24240024, 0xe8e800e8, 0x60600060, 0x69690069,
+       0xaaaa00aa, 0xa0a000a0, 0xa1a100a1, 0x62620062,
+       0x54540054, 0x1e1e001e, 0xe0e000e0, 0x64640064,
+       0x10100010, 0x00000000, 0xa3a300a3, 0x75750075,
+       0x8a8a008a, 0xe6e600e6, 0x09090009, 0xdddd00dd,
+       0x87870087, 0x83830083, 0xcdcd00cd, 0x90900090,
+       0x73730073, 0xf6f600f6, 0x9d9d009d, 0xbfbf00bf,
+       0x52520052, 0xd8d800d8, 0xc8c800c8, 0xc6c600c6,
+       0x81810081, 0x6f6f006f, 0x13130013, 0x63630063,
+       0xe9e900e9, 0xa7a700a7, 0x9f9f009f, 0xbcbc00bc,
+       0x29290029, 0xf9f900f9, 0x2f2f002f, 0xb4b400b4,
+       0x78780078, 0x06060006, 0xe7e700e7, 0x71710071,
+       0xd4d400d4, 0xabab00ab, 0x88880088, 0x8d8d008d,
+       0x72720072, 0xb9b900b9, 0xf8f800f8, 0xacac00ac,
+       0x36360036, 0x2a2a002a, 0x3c3c003c, 0xf1f100f1,
+       0x40400040, 0xd3d300d3, 0xbbbb00bb, 0x43430043,
+       0x15150015, 0xadad00ad, 0x77770077, 0x80800080,
+       0x82820082, 0xecec00ec, 0x27270027, 0xe5e500e5,
+       0x85850085, 0x35350035, 0x0c0c000c, 0x41410041,
+       0xefef00ef, 0x93930093, 0x19190019, 0x21210021,
+       0x0e0e000e, 0x4e4e004e, 0x65650065, 0xbdbd00bd,
+       0xb8b800b8, 0x8f8f008f, 0xebeb00eb, 0xcece00ce,
+       0x30300030, 0x5f5f005f, 0xc5c500c5, 0x1a1a001a,
+       0xe1e100e1, 0xcaca00ca, 0x47470047, 0x3d3d003d,
+       0x01010001, 0xd6d600d6, 0x56560056, 0x4d4d004d,
+       0x0d0d000d, 0x66660066, 0xcccc00cc, 0x2d2d002d,
+       0x12120012, 0x20200020, 0xb1b100b1, 0x99990099,
+       0x4c4c004c, 0xc2c200c2, 0x7e7e007e, 0x05050005,
+       0xb7b700b7, 0x31310031, 0x17170017, 0xd7d700d7,
+       0x58580058, 0x61610061, 0x1b1b001b, 0x1c1c001c,
+       0x0f0f000f, 0x16160016, 0x18180018, 0x22220022,
+       0x44440044, 0xb2b200b2, 0xb5b500b5, 0x91910091,
+       0x08080008, 0xa8a800a8, 0xfcfc00fc, 0x50500050,
+       0xd0d000d0, 0x7d7d007d, 0x89890089, 0x97970097,
+       0x5b5b005b, 0x95950095, 0xffff00ff, 0xd2d200d2,
+       0xc4c400c4, 0x48480048, 0xf7f700f7, 0xdbdb00db,
+       0x03030003, 0xdada00da, 0x3f3f003f, 0x94940094,
+       0x5c5c005c, 0x02020002, 0x4a4a004a, 0x33330033,
+       0x67670067, 0xf3f300f3, 0x7f7f007f, 0xe2e200e2,
+       0x9b9b009b, 0x26260026, 0x37370037, 0x3b3b003b,
+       0x96960096, 0x4b4b004b, 0xbebe00be, 0x2e2e002e,
+       0x79790079, 0x8c8c008c, 0x6e6e006e, 0x8e8e008e,
+       0xf5f500f5, 0xb6b600b6, 0xfdfd00fd, 0x59590059,
+       0x98980098, 0x6a6a006a, 0x46460046, 0xbaba00ba,
+       0x25250025, 0x42420042, 0xa2a200a2, 0xfafa00fa,
+       0x07070007, 0x55550055, 0xeeee00ee, 0x0a0a000a,
+       0x49490049, 0x68680068, 0x38380038, 0xa4a400a4,
+       0x28280028, 0x7b7b007b, 0xc9c900c9, 0xc1c100c1,
+       0xe3e300e3, 0xf4f400f4, 0xc7c700c7, 0x9e9e009e,
 };
 
 
@@ -344,7 +344,7 @@ static const u32 camellia_sp4404[256] = {
        lr = (lr << bits) + (rl >> (32 - bits));        \
        rl = (rl << bits) + (rr >> (32 - bits));        \
        rr = (rr << bits) + (w0 >> (32 - bits));        \
-    } while(0)
+    } while (0)
 
 #define ROLDQo32(ll, lr, rl, rr, w0, w1, bits)         \
     do {                                               \
@@ -354,7 +354,7 @@ static const u32 camellia_sp4404[256] = {
        lr = (rl << (bits - 32)) + (rr >> (64 - bits)); \
        rl = (rr << (bits - 32)) + (w0 >> (64 - bits)); \
        rr = (w0 << (bits - 32)) + (w1 >> (64 - bits)); \
-    } while(0)
+    } while (0)
 
 #define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)     \
     do {                                                       \
@@ -373,7 +373,7 @@ static const u32 camellia_sp4404[256] = {
        yl ^= yr;                                               \
        yr = ror32(yr, 8);                                      \
        yr ^= yl;                                               \
-    } while(0)
+    } while (0)
 
 #define SUBKEY_L(INDEX) (subkey[(INDEX)*2])
 #define SUBKEY_R(INDEX) (subkey[(INDEX)*2 + 1])
@@ -835,7 +835,7 @@ static void camellia_setup256(const unsigned char *key, u32 *subkey)
 static void camellia_setup192(const unsigned char *key, u32 *subkey)
 {
        unsigned char kk[32];
-       u32 krll, krlr, krrl,krrr;
+       u32 krll, krlr, krrl, krrr;
 
        memcpy(kk, key, 24);
        memcpy((unsigned char *)&krll, key+16, 4);
@@ -865,7 +865,7 @@ static void camellia_setup192(const unsigned char *key, u32 *subkey)
        t1 |= lr;                                                       \
        ll ^= t1;                                                       \
        rr ^= rol32(t3, 1);                                             \
-    } while(0)
+    } while (0)
 
 #define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir)               \
     do {                                                               \
@@ -881,12 +881,12 @@ static void camellia_setup192(const unsigned char *key, u32 *subkey)
        ir ^= il ^ kr;                                                  \
        yl ^= ir;                                                       \
        yr ^= ror32(il, 8) ^ ir;                                                \
-    } while(0)
+    } while (0)
 
 /* max = 24: 128bit encrypt, max = 32: 256bit encrypt */
 static void camellia_do_encrypt(const u32 *subkey, u32 *io, unsigned max)
 {
-       u32 il,ir,t0,t1;               /* temporary variables */
+       u32 il, ir, t0, t1;            /* temporary variables */
 
        /* pre whitening but absorb kw2 */
        io[0] ^= SUBKEY_L(0);
@@ -894,30 +894,30 @@ static void camellia_do_encrypt(const u32 *subkey, u32 *io, unsigned max)
 
        /* main iteration */
 #define ROUNDS(i) do { \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 2),SUBKEY_R(i + 2), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 3),SUBKEY_R(i + 3), \
-                        io[0],io[1],il,ir); \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 4),SUBKEY_R(i + 4), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 5),SUBKEY_R(i + 5), \
-                        io[0],io[1],il,ir); \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 6),SUBKEY_R(i + 6), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 7),SUBKEY_R(i + 7), \
-                        io[0],io[1],il,ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 2), SUBKEY_R(i + 2), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 3), SUBKEY_R(i + 3), \
+                        io[0], io[1], il, ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 4), SUBKEY_R(i + 4), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 5), SUBKEY_R(i + 5), \
+                        io[0], io[1], il, ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 6), SUBKEY_R(i + 6), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 7), SUBKEY_R(i + 7), \
+                        io[0], io[1], il, ir); \
 } while (0)
 #define FLS(i) do { \
-       CAMELLIA_FLS(io[0],io[1],io[2],io[3], \
-                    SUBKEY_L(i + 0),SUBKEY_R(i + 0), \
-                    SUBKEY_L(i + 1),SUBKEY_R(i + 1), \
-                    t0,t1,il,ir); \
+       CAMELLIA_FLS(io[0], io[1], io[2], io[3], \
+                    SUBKEY_L(i + 0), SUBKEY_R(i + 0), \
+                    SUBKEY_L(i + 1), SUBKEY_R(i + 1), \
+                    t0, t1, il, ir); \
 } while (0)
 
        ROUNDS(0);
@@ -941,7 +941,7 @@ static void camellia_do_encrypt(const u32 *subkey, u32 *io, unsigned max)
 
 static void camellia_do_decrypt(const u32 *subkey, u32 *io, unsigned i)
 {
-       u32 il,ir,t0,t1;               /* temporary variables */
+       u32 il, ir, t0, t1;            /* temporary variables */
 
        /* pre whitening but absorb kw2 */
        io[0] ^= SUBKEY_L(i);
@@ -949,30 +949,30 @@ static void camellia_do_decrypt(const u32 *subkey, u32 *io, unsigned i)
 
        /* main iteration */
 #define ROUNDS(i) do { \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 7),SUBKEY_R(i + 7), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 6),SUBKEY_R(i + 6), \
-                        io[0],io[1],il,ir); \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 5),SUBKEY_R(i + 5), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 4),SUBKEY_R(i + 4), \
-                        io[0],io[1],il,ir); \
-       CAMELLIA_ROUNDSM(io[0],io[1], \
-                        SUBKEY_L(i + 3),SUBKEY_R(i + 3), \
-                        io[2],io[3],il,ir); \
-       CAMELLIA_ROUNDSM(io[2],io[3], \
-                        SUBKEY_L(i + 2),SUBKEY_R(i + 2), \
-                        io[0],io[1],il,ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 7), SUBKEY_R(i + 7), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 6), SUBKEY_R(i + 6), \
+                        io[0], io[1], il, ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 5), SUBKEY_R(i + 5), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 4), SUBKEY_R(i + 4), \
+                        io[0], io[1], il, ir); \
+       CAMELLIA_ROUNDSM(io[0], io[1], \
+                        SUBKEY_L(i + 3), SUBKEY_R(i + 3), \
+                        io[2], io[3], il, ir); \
+       CAMELLIA_ROUNDSM(io[2], io[3], \
+                        SUBKEY_L(i + 2), SUBKEY_R(i + 2), \
+                        io[0], io[1], il, ir); \
 } while (0)
 #define FLS(i) do { \
-       CAMELLIA_FLS(io[0],io[1],io[2],io[3], \
-                    SUBKEY_L(i + 1),SUBKEY_R(i + 1), \
-                    SUBKEY_L(i + 0),SUBKEY_R(i + 0), \
-                    t0,t1,il,ir); \
+       CAMELLIA_FLS(io[0], io[1], io[2], io[3], \
+                    SUBKEY_L(i + 1), SUBKEY_R(i + 1), \
+                    SUBKEY_L(i + 0), SUBKEY_R(i + 0), \
+                    t0, t1, il, ir); \
 } while (0)
 
        if (i == 32) {
index 8cbe28fa0e0c5d25a10cf947b4edd4f8f7a33719..a1d2294b50ad705937b33ed9390bab7d0594cedf 100644 (file)
@@ -569,12 +569,12 @@ static const u32 sb8[256] = {
        0xeaee6801, 0x8db2a283, 0xea8bf59e
 };
 
-#define F1(D,m,r)  (  (I = ((m) + (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]) )
-#define F2(D,m,r)  (  (I = ((m) ^ (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]) )
-#define F3(D,m,r)  (  (I = ((m) - (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]) )
+#define F1(D, m, r)  ((I = ((m) + (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]))
+#define F2(D, m, r)  ((I = ((m) ^ (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]))
+#define F3(D, m, r)  ((I = ((m) - (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]))
 
 
 static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
@@ -694,7 +694,7 @@ static void cast5_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
        dst[1] = cpu_to_be32(l);
 }
 
-static void key_schedule(u32 * x, u32 * z, u32 * k)
+static void key_schedule(u32 *x, u32 *z, u32 *k)
 {
 
 #define xi(i)   ((x[(i)/4] >> (8*(3-((i)%4)))) & 0xff)
index 007d02beed67f3f2b197ee4c01bacb20a73fa71d..e0c15a6c7c34d72fd3fa7c1c114197b07b0f7cd4 100644 (file)
@@ -11,7 +11,7 @@
  * under the terms of GNU General Public License as published by the Free
  * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
- * 
+ *
  * 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
@@ -35,12 +35,12 @@ struct cast6_ctx {
        u8 Kr[12][4];
 };
 
-#define F1(D,r,m)  (  (I = ((m) + (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]) )
-#define F2(D,r,m)  (  (I = ((m) ^ (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]) )
-#define F3(D,r,m)  (  (I = ((m) - (D))), (I=rol32(I,(r))),   \
-    (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]) )
+#define F1(D, r, m)  ((I = ((m) + (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]))
+#define F2(D, r, m)  ((I = ((m) ^ (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]))
+#define F3(D, r, m)  ((I = ((m) - (D))), (I = rol32(I, (r))),   \
+    (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]))
 
 static const u32 s1[256] = {
        0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f,
@@ -312,7 +312,7 @@ static const u32 s4[256] = {
 
 static const u32 Tm[24][8] = {
        { 0x5a827999, 0xc95c653a, 0x383650db, 0xa7103c7c, 0x15ea281d,
-               0x84c413be, 0xf39dff5f, 0x6277eb00 } , 
+               0x84c413be, 0xf39dff5f, 0x6277eb00 } ,
        { 0xd151d6a1, 0x402bc242, 0xaf05ade3, 0x1ddf9984, 0x8cb98525,
                0xfb9370c6, 0x6a6d5c67, 0xd9474808 } ,
        { 0x482133a9, 0xb6fb1f4a, 0x25d50aeb, 0x94aef68c, 0x0388e22d,
@@ -369,7 +369,8 @@ static const u8 Tr[4][8] = {
 };
 
 /* forward octave */
-static void W(u32 *key, unsigned int i) {
+static void W(u32 *key, unsigned int i)
+{
        u32 I;
        key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]);
        key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]);
@@ -377,7 +378,7 @@ static void W(u32 *key, unsigned int i) {
        key[3] ^= F1(key[4], Tr[i % 4][3], Tm[i][3]);
        key[2] ^= F2(key[3], Tr[i % 4][4], Tm[i][4]);
        key[1] ^= F3(key[2], Tr[i % 4][5], Tm[i][5]);
-       key[0] ^= F1(key[1], Tr[i % 4][6], Tm[i][6]);   
+       key[0] ^= F1(key[1], Tr[i % 4][6], Tm[i][6]);
        key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]);
 }
 
@@ -393,11 +394,11 @@ static int cast6_setkey(struct crypto_tfm *tfm, const u8 *in_key,
        if (key_len % 4 != 0) {
                *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
                return -EINVAL;
-       }       
+       }
+
+       memset(p_key, 0, 32);
+       memcpy(p_key, in_key, key_len);
 
-       memset (p_key, 0, 32);
-       memcpy (p_key, in_key, key_len);
-       
        key[0] = be32_to_cpu(p_key[0]);         /* A */
        key[1] = be32_to_cpu(p_key[1]);         /* B */
        key[2] = be32_to_cpu(p_key[2]);         /* C */
@@ -406,18 +407,16 @@ static int cast6_setkey(struct crypto_tfm *tfm, const u8 *in_key,
        key[5] = be32_to_cpu(p_key[5]);         /* F */
        key[6] = be32_to_cpu(p_key[6]);         /* G */
        key[7] = be32_to_cpu(p_key[7]);         /* H */
-       
-
 
        for (i = 0; i < 12; i++) {
-               W (key, 2 * i);
-               W (key, 2 * i + 1);
-               
+               W(key, 2 * i);
+               W(key, 2 * i + 1);
+
                c->Kr[i][0] = key[0] & 0x1f;
                c->Kr[i][1] = key[2] & 0x1f;
                c->Kr[i][2] = key[4] & 0x1f;
                c->Kr[i][3] = key[6] & 0x1f;
-               
+
                c->Km[i][0] = key[7];
                c->Km[i][1] = key[5];
                c->Km[i][2] = key[3];
@@ -428,21 +427,23 @@ static int cast6_setkey(struct crypto_tfm *tfm, const u8 *in_key,
 }
 
 /*forward quad round*/
-static void Q (u32 * block, u8 * Kr, u32 * Km) {
+static void Q(u32 *block, u8 *Kr, u32 *Km)
+{
        u32 I;
        block[2] ^= F1(block[3], Kr[0], Km[0]);
        block[1] ^= F2(block[2], Kr[1], Km[1]);
        block[0] ^= F3(block[1], Kr[2], Km[2]);
-       block[3] ^= F1(block[0], Kr[3], Km[3]);         
+       block[3] ^= F1(block[0], Kr[3], Km[3]);
 }
 
 /*reverse quad round*/
-static void QBAR (u32 * block, u8 * Kr, u32 * Km) {
+static void QBAR(u32 *block, u8 *Kr, u32 *Km)
+{
        u32 I;
-        block[3] ^= F1(block[0], Kr[3], Km[3]);
-        block[0] ^= F3(block[1], Kr[2], Km[2]);
-        block[1] ^= F2(block[2], Kr[1], Km[1]);
-        block[2] ^= F1(block[3], Kr[0], Km[0]);
+       block[3] ^= F1(block[0], Kr[3], Km[3]);
+       block[0] ^= F3(block[1], Kr[2], Km[2]);
+       block[1] ^= F2(block[2], Kr[1], Km[1]);
+       block[2] ^= F1(block[3], Kr[0], Km[0]);
 }
 
 static void cast6_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
@@ -451,64 +452,65 @@ static void cast6_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
        const __be32 *src = (const __be32 *)inbuf;
        __be32 *dst = (__be32 *)outbuf;
        u32 block[4];
-       u32 * Km; 
-       u8 * Kr;
+       u32 *Km;
+       u8 *Kr;
 
        block[0] = be32_to_cpu(src[0]);
        block[1] = be32_to_cpu(src[1]);
        block[2] = be32_to_cpu(src[2]);
        block[3] = be32_to_cpu(src[3]);
 
-       Km = c->Km[0]; Kr = c->Kr[0]; Q (block, Kr, Km);
-       Km = c->Km[1]; Kr = c->Kr[1]; Q (block, Kr, Km);
-       Km = c->Km[2]; Kr = c->Kr[2]; Q (block, Kr, Km);
-       Km = c->Km[3]; Kr = c->Kr[3]; Q (block, Kr, Km);
-       Km = c->Km[4]; Kr = c->Kr[4]; Q (block, Kr, Km);
-       Km = c->Km[5]; Kr = c->Kr[5]; Q (block, Kr, Km);
-       Km = c->Km[6]; Kr = c->Kr[6]; QBAR (block, Kr, Km);
-       Km = c->Km[7]; Kr = c->Kr[7]; QBAR (block, Kr, Km);
-       Km = c->Km[8]; Kr = c->Kr[8]; QBAR (block, Kr, Km);
-       Km = c->Km[9]; Kr = c->Kr[9]; QBAR (block, Kr, Km);
-       Km = c->Km[10]; Kr = c->Kr[10]; QBAR (block, Kr, Km);
-       Km = c->Km[11]; Kr = c->Kr[11]; QBAR (block, Kr, Km);
+       Km = c->Km[0]; Kr = c->Kr[0]; Q(block, Kr, Km);
+       Km = c->Km[1]; Kr = c->Kr[1]; Q(block, Kr, Km);
+       Km = c->Km[2]; Kr = c->Kr[2]; Q(block, Kr, Km);
+       Km = c->Km[3]; Kr = c->Kr[3]; Q(block, Kr, Km);
+       Km = c->Km[4]; Kr = c->Kr[4]; Q(block, Kr, Km);
+       Km = c->Km[5]; Kr = c->Kr[5]; Q(block, Kr, Km);
+       Km = c->Km[6]; Kr = c->Kr[6]; QBAR(block, Kr, Km);
+       Km = c->Km[7]; Kr = c->Kr[7]; QBAR(block, Kr, Km);
+       Km = c->Km[8]; Kr = c->Kr[8]; QBAR(block, Kr, Km);
+       Km = c->Km[9]; Kr = c->Kr[9]; QBAR(block, Kr, Km);
+       Km = c->Km[10]; Kr = c->Kr[10]; QBAR(block, Kr, Km);
+       Km = c->Km[11]; Kr = c->Kr[11]; QBAR(block, Kr, Km);
 
        dst[0] = cpu_to_be32(block[0]);
        dst[1] = cpu_to_be32(block[1]);
        dst[2] = cpu_to_be32(block[2]);
        dst[3] = cpu_to_be32(block[3]);
-}      
+}
 
-static void cast6_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) {
-       struct cast6_ctx * c = crypto_tfm_ctx(tfm);
+static void cast6_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
+{
+       struct cast6_ctx *c = crypto_tfm_ctx(tfm);
        const __be32 *src = (const __be32 *)inbuf;
        __be32 *dst = (__be32 *)outbuf;
        u32 block[4];
-       u32 * Km; 
-       u8 * Kr;
+       u32 *Km;
+       u8 *Kr;
 
        block[0] = be32_to_cpu(src[0]);
        block[1] = be32_to_cpu(src[1]);
        block[2] = be32_to_cpu(src[2]);
        block[3] = be32_to_cpu(src[3]);
 
-       Km = c->Km[11]; Kr = c->Kr[11]; Q (block, Kr, Km);
-       Km = c->Km[10]; Kr = c->Kr[10]; Q (block, Kr, Km);
-       Km = c->Km[9]; Kr = c->Kr[9]; Q (block, Kr, Km);
-       Km = c->Km[8]; Kr = c->Kr[8]; Q (block, Kr, Km);
-       Km = c->Km[7]; Kr = c->Kr[7]; Q (block, Kr, Km);
-       Km = c->Km[6]; Kr = c->Kr[6]; Q (block, Kr, Km);
-       Km = c->Km[5]; Kr = c->Kr[5]; QBAR (block, Kr, Km);
-       Km = c->Km[4]; Kr = c->Kr[4]; QBAR (block, Kr, Km);
-       Km = c->Km[3]; Kr = c->Kr[3]; QBAR (block, Kr, Km);
-       Km = c->Km[2]; Kr = c->Kr[2]; QBAR (block, Kr, Km);
-       Km = c->Km[1]; Kr = c->Kr[1]; QBAR (block, Kr, Km);
-       Km = c->Km[0]; Kr = c->Kr[0]; QBAR (block, Kr, Km);
-       
+       Km = c->Km[11]; Kr = c->Kr[11]; Q(block, Kr, Km);
+       Km = c->Km[10]; Kr = c->Kr[10]; Q(block, Kr, Km);
+       Km = c->Km[9]; Kr = c->Kr[9]; Q(block, Kr, Km);
+       Km = c->Km[8]; Kr = c->Kr[8]; Q(block, Kr, Km);
+       Km = c->Km[7]; Kr = c->Kr[7]; Q(block, Kr, Km);
+       Km = c->Km[6]; Kr = c->Kr[6]; Q(block, Kr, Km);
+       Km = c->Km[5]; Kr = c->Kr[5]; QBAR(block, Kr, Km);
+       Km = c->Km[4]; Kr = c->Kr[4]; QBAR(block, Kr, Km);
+       Km = c->Km[3]; Kr = c->Kr[3]; QBAR(block, Kr, Km);
+       Km = c->Km[2]; Kr = c->Kr[2]; QBAR(block, Kr, Km);
+       Km = c->Km[1]; Kr = c->Kr[1]; QBAR(block, Kr, Km);
+       Km = c->Km[0]; Kr = c->Kr[0]; QBAR(block, Kr, Km);
+
        dst[0] = cpu_to_be32(block[0]);
        dst[1] = cpu_to_be32(block[1]);
        dst[2] = cpu_to_be32(block[2]);
        dst[3] = cpu_to_be32(block[3]);
-}      
+}
 
 static struct crypto_alg alg = {
        .cra_name = "cast6",
index 9a1a7316eeacf6f71befe1b149283a4350db0c56..39541e0e537dc6f94bc470344451fdb2ac6b4476 100644 (file)
@@ -8,7 +8,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
index 1ee357085d3a40bfdd8e3013e7fc7b501eb32948..c33f0763a956a2a99302963cdeebd67e64fe8c4d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -39,7 +39,7 @@ int crypto_init_compress_ops(struct crypto_tfm *tfm)
 
        ops->cot_compress = crypto_compress;
        ops->cot_decompress = crypto_decompress;
-       
+
        return 0;
 }
 
index 973bc2cfab2ec00b8571894bc7ceb35541670cad..de9e55c297943cb7c00a407084553a3119dbc902 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cryptographic API.
  *
  * CRC32C chksum
@@ -30,7 +30,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -142,7 +142,7 @@ static u32 crc32c(u32 crc, const u8 *data, unsigned int length)
 }
 
 /*
- * Steps through buffer one byte at at time, calculates reflected 
+ * Steps through buffer one byte at at time, calculates reflected
  * crc using table.
  */
 
index cb71c9122bc0d794f5a531765fbda14a1187bcda..07a8a96d46fc1f2ef373ebb485ebf37287636726 100644 (file)
@@ -1,11 +1,11 @@
-/* 
+/*
  * Cryptographic API.
  *
  * Null algorithms, aka Much Ado About Nothing.
  *
  * These are needed for IPsec, and may be useful in general for
  * testing & debugging.
- * 
+ *
  * The null cipher is compliant with RFC2410.
  *
  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
@@ -163,7 +163,7 @@ MODULE_ALIAS("cipher_null");
 static int __init crypto_null_mod_init(void)
 {
        int ret = 0;
-       
+
        ret = crypto_register_alg(&cipher_null);
        if (ret < 0)
                goto out;
@@ -180,7 +180,7 @@ static int __init crypto_null_mod_init(void)
        if (ret < 0)
                goto out_unregister_digest;
 
-out:   
+out:
        return ret;
 
 out_unregister_digest:
index 9128da44e953ac70d3f0d5b49e39ac2578bf127c..463dc859aa059d6e5f593e6db437e93025974c18 100644 (file)
@@ -1,14 +1,14 @@
-/* 
+/*
  * Cryptographic API.
  *
  * Deflate algorithm (RFC 1951), implemented here primarily for use
  * by IPCOMP (RFC 3173 & RFC 2394).
  *
  * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
- * 
+ *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  * FIXME: deflate transforms will require up to a total of about 436k of kernel
@@ -49,7 +49,7 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
        struct z_stream_s *stream = &ctx->comp_stream;
 
        stream->workspace = vmalloc(zlib_deflate_workspacesize());
-       if (!stream->workspace ) {
+       if (!stream->workspace) {
                ret = -ENOMEM;
                goto out;
        }
@@ -61,7 +61,7 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
                ret = -EINVAL;
                goto out_free;
        }
-out:   
+out:
        return ret;
 out_free:
        vfree(stream->workspace);
@@ -74,7 +74,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
        struct z_stream_s *stream = &ctx->decomp_stream;
 
        stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
-       if (!stream->workspace ) {
+       if (!stream->workspace) {
                ret = -ENOMEM;
                goto out;
        }
@@ -106,7 +106,7 @@ static int deflate_init(struct crypto_tfm *tfm)
 {
        struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
        int ret;
-       
+
        ret = deflate_comp_init(ctx);
        if (ret)
                goto out;
@@ -153,11 +153,11 @@ static int deflate_compress(struct crypto_tfm *tfm, const u8 *src,
 out:
        return ret;
 }
+
 static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src,
                              unsigned int slen, u8 *dst, unsigned int *dlen)
 {
-       
+
        int ret = 0;
        struct deflate_ctx *dctx = crypto_tfm_ctx(tfm);
        struct z_stream_s *stream = &dctx->decomp_stream;
@@ -182,7 +182,7 @@ static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src,
        if (ret == Z_OK && !stream->avail_in && stream->avail_out) {
                u8 zerostuff = 0;
                stream->next_in = &zerostuff;
-               stream->avail_in = 1; 
+               stream->avail_in = 1;
                ret = zlib_inflate(stream, Z_FINISH);
        }
        if (ret != Z_STREAM_END) {
index 5bd3ee345a64d8e60604a32097818a3a3d369a46..249f903cc453b201270bb2db5c33be1856a5d324 100644 (file)
@@ -869,8 +869,7 @@ static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key,
 
        if (unlikely(!((K[0] ^ K[2]) | (K[1] ^ K[3])) ||
                     !((K[2] ^ K[4]) | (K[3] ^ K[5]))) &&
-                    (*flags & CRYPTO_TFM_REQ_WEAK_KEY))
-       {
+                    (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
                *flags |= CRYPTO_TFM_RES_WEAK_KEY;
                return -EINVAL;
        }
index a46838e98a71a18de0b4adcdd46a5f65fa556be6..935cfef4aa8479c54cd6490db8a9b97da9125ab5 100644 (file)
@@ -55,7 +55,7 @@ static int crypto_ecb_crypt(struct blkcipher_desc *desc,
 
                do {
                        fn(crypto_cipher_tfm(tfm), wdst, wsrc);
-       
+
                        wsrc += bsize;
                        wdst += bsize;
                } while ((nbytes -= bsize) >= bsize);
index b82d61f4e26c487c8b9f1a8838621040e25fdd5b..c33107e340b6c3774a1f709f14b889c8c034c19d 100644 (file)
@@ -60,13 +60,13 @@ do {                                                                \
        u32 t = lo & ((1 << n) - 1);                            \
        lo = (lo >> n) | ((hi & ((1 << n) - 1)) << (32 - n));   \
        hi = (hi >> n) | (t << (24-n));                         \
-} while(0)
+} while (0)
 
 /* Rotate right one 64 bit number as a 56 bit number */
 #define ror56_64(k, n)                                         \
 do {                                                           \
        k = (k >> n) | ((k & ((1 << n) - 1)) << (56 - n));      \
-} while(0)
+} while (0)
 
 /*
  * Sboxes for Feistel network derived from
@@ -228,7 +228,7 @@ do {                                                                        \
        union lc4 { __be32 l; u8 c[4]; } u;                             \
        u.l = sched ^ R;                                                \
        L ^= sbox0[u.c[0]] ^ sbox1[u.c[1]] ^ sbox2[u.c[2]] ^ sbox3[u.c[3]]; \
-} while(0)
+} while (0)
 
 /*
  * encryptor
index c6547130624ce73cd4e41088f260f40b391dd940..2f5fbba6576c23c09b2fddce3d08533b16d0186d 100644 (file)
@@ -37,6 +37,19 @@ struct crypto_rfc4106_ctx {
        u8 nonce[4];
 };
 
+struct crypto_rfc4543_ctx {
+       struct crypto_aead *child;
+       u8 nonce[4];
+};
+
+struct crypto_rfc4543_req_ctx {
+       u8 auth_tag[16];
+       struct scatterlist cipher[1];
+       struct scatterlist payload[2];
+       struct scatterlist assoc[2];
+       struct aead_request subreq;
+};
+
 struct crypto_gcm_ghash_ctx {
        unsigned int cryptlen;
        struct scatterlist *src;
@@ -1047,6 +1060,272 @@ static struct crypto_template crypto_rfc4106_tmpl = {
        .module = THIS_MODULE,
 };
 
+static inline struct crypto_rfc4543_req_ctx *crypto_rfc4543_reqctx(
+       struct aead_request *req)
+{
+       unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req));
+
+       return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1);
+}
+
+static int crypto_rfc4543_setkey(struct crypto_aead *parent, const u8 *key,
+                                unsigned int keylen)
+{
+       struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(parent);
+       struct crypto_aead *child = ctx->child;
+       int err;
+
+       if (keylen < 4)
+               return -EINVAL;
+
+       keylen -= 4;
+       memcpy(ctx->nonce, key + keylen, 4);
+
+       crypto_aead_clear_flags(child, CRYPTO_TFM_REQ_MASK);
+       crypto_aead_set_flags(child, crypto_aead_get_flags(parent) &
+                                    CRYPTO_TFM_REQ_MASK);
+       err = crypto_aead_setkey(child, key, keylen);
+       crypto_aead_set_flags(parent, crypto_aead_get_flags(child) &
+                                     CRYPTO_TFM_RES_MASK);
+
+       return err;
+}
+
+static int crypto_rfc4543_setauthsize(struct crypto_aead *parent,
+                                     unsigned int authsize)
+{
+       struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(parent);
+
+       if (authsize != 16)
+               return -EINVAL;
+
+       return crypto_aead_setauthsize(ctx->child, authsize);
+}
+
+/* this is the same as crypto_authenc_chain */
+static void crypto_rfc4543_chain(struct scatterlist *head,
+                                struct scatterlist *sg, int chain)
+{
+       if (chain) {
+               head->length += sg->length;
+               sg = scatterwalk_sg_next(sg);
+       }
+
+       if (sg)
+               scatterwalk_sg_chain(head, 2, sg);
+       else
+               sg_mark_end(head);
+}
+
+static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
+                                                int enc)
+{
+       struct crypto_aead *aead = crypto_aead_reqtfm(req);
+       struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(aead);
+       struct crypto_rfc4543_req_ctx *rctx = crypto_rfc4543_reqctx(req);
+       struct aead_request *subreq = &rctx->subreq;
+       struct scatterlist *dst = req->dst;
+       struct scatterlist *cipher = rctx->cipher;
+       struct scatterlist *payload = rctx->payload;
+       struct scatterlist *assoc = rctx->assoc;
+       unsigned int authsize = crypto_aead_authsize(aead);
+       unsigned int assoclen = req->assoclen;
+       struct page *dstp;
+       u8 *vdst;
+       u8 *iv = PTR_ALIGN((u8 *)(rctx + 1) + crypto_aead_reqsize(ctx->child),
+                          crypto_aead_alignmask(ctx->child) + 1);
+
+       memcpy(iv, ctx->nonce, 4);
+       memcpy(iv + 4, req->iv, 8);
+
+       /* construct cipher/plaintext */
+       if (enc)
+               memset(rctx->auth_tag, 0, authsize);
+       else
+               scatterwalk_map_and_copy(rctx->auth_tag, dst,
+                                        req->cryptlen - authsize,
+                                        authsize, 0);
+
+       sg_init_one(cipher, rctx->auth_tag, authsize);
+
+       /* construct the aad */
+       dstp = sg_page(dst);
+       vdst = PageHighMem(dstp) ? NULL : page_address(dstp) + dst->offset;
+
+       sg_init_table(payload, 2);
+       sg_set_buf(payload, req->iv, 8);
+       crypto_rfc4543_chain(payload, dst, vdst == req->iv + 8);
+       assoclen += 8 + req->cryptlen - (enc ? 0 : authsize);
+
+       sg_init_table(assoc, 2);
+       sg_set_page(assoc, sg_page(req->assoc), req->assoc->length,
+                   req->assoc->offset);
+       crypto_rfc4543_chain(assoc, payload, 0);
+
+       aead_request_set_tfm(subreq, ctx->child);
+       aead_request_set_callback(subreq, req->base.flags, req->base.complete,
+                                 req->base.data);
+       aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv);
+       aead_request_set_assoc(subreq, assoc, assoclen);
+
+       return subreq;
+}
+
+static int crypto_rfc4543_encrypt(struct aead_request *req)
+{
+       struct crypto_aead *aead = crypto_aead_reqtfm(req);
+       struct crypto_rfc4543_req_ctx *rctx = crypto_rfc4543_reqctx(req);
+       struct aead_request *subreq;
+       int err;
+
+       subreq = crypto_rfc4543_crypt(req, 1);
+       err = crypto_aead_encrypt(subreq);
+       if (err)
+               return err;
+
+       scatterwalk_map_and_copy(rctx->auth_tag, req->dst, req->cryptlen,
+                                crypto_aead_authsize(aead), 1);
+
+       return 0;
+}
+
+static int crypto_rfc4543_decrypt(struct aead_request *req)
+{
+       req = crypto_rfc4543_crypt(req, 0);
+
+       return crypto_aead_decrypt(req);
+}
+
+static int crypto_rfc4543_init_tfm(struct crypto_tfm *tfm)
+{
+       struct crypto_instance *inst = (void *)tfm->__crt_alg;
+       struct crypto_aead_spawn *spawn = crypto_instance_ctx(inst);
+       struct crypto_rfc4543_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_aead *aead;
+       unsigned long align;
+
+       aead = crypto_spawn_aead(spawn);
+       if (IS_ERR(aead))
+               return PTR_ERR(aead);
+
+       ctx->child = aead;
+
+       align = crypto_aead_alignmask(aead);
+       align &= ~(crypto_tfm_ctx_alignment() - 1);
+       tfm->crt_aead.reqsize = sizeof(struct crypto_rfc4543_req_ctx) +
+                               ALIGN(crypto_aead_reqsize(aead),
+                                     crypto_tfm_ctx_alignment()) +
+                               align + 16;
+
+       return 0;
+}
+
+static void crypto_rfc4543_exit_tfm(struct crypto_tfm *tfm)
+{
+       struct crypto_rfc4543_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       crypto_free_aead(ctx->child);
+}
+
+static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb)
+{
+       struct crypto_attr_type *algt;
+       struct crypto_instance *inst;
+       struct crypto_aead_spawn *spawn;
+       struct crypto_alg *alg;
+       const char *ccm_name;
+       int err;
+
+       algt = crypto_get_attr_type(tb);
+       err = PTR_ERR(algt);
+       if (IS_ERR(algt))
+               return ERR_PTR(err);
+
+       if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask)
+               return ERR_PTR(-EINVAL);
+
+       ccm_name = crypto_attr_alg_name(tb[1]);
+       err = PTR_ERR(ccm_name);
+       if (IS_ERR(ccm_name))
+               return ERR_PTR(err);
+
+       inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL);
+       if (!inst)
+               return ERR_PTR(-ENOMEM);
+
+       spawn = crypto_instance_ctx(inst);
+       crypto_set_aead_spawn(spawn, inst);
+       err = crypto_grab_aead(spawn, ccm_name, 0,
+                              crypto_requires_sync(algt->type, algt->mask));
+       if (err)
+               goto out_free_inst;
+
+       alg = crypto_aead_spawn_alg(spawn);
+
+       err = -EINVAL;
+
+       /* We only support 16-byte blocks. */
+       if (alg->cra_aead.ivsize != 16)
+               goto out_drop_alg;
+
+       /* Not a stream cipher? */
+       if (alg->cra_blocksize != 1)
+               goto out_drop_alg;
+
+       err = -ENAMETOOLONG;
+       if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME,
+                    "rfc4543(%s)", alg->cra_name) >= CRYPTO_MAX_ALG_NAME ||
+           snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
+                    "rfc4543(%s)", alg->cra_driver_name) >=
+           CRYPTO_MAX_ALG_NAME)
+               goto out_drop_alg;
+
+       inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD;
+       inst->alg.cra_flags |= alg->cra_flags & CRYPTO_ALG_ASYNC;
+       inst->alg.cra_priority = alg->cra_priority;
+       inst->alg.cra_blocksize = 1;
+       inst->alg.cra_alignmask = alg->cra_alignmask;
+       inst->alg.cra_type = &crypto_nivaead_type;
+
+       inst->alg.cra_aead.ivsize = 8;
+       inst->alg.cra_aead.maxauthsize = 16;
+
+       inst->alg.cra_ctxsize = sizeof(struct crypto_rfc4543_ctx);
+
+       inst->alg.cra_init = crypto_rfc4543_init_tfm;
+       inst->alg.cra_exit = crypto_rfc4543_exit_tfm;
+
+       inst->alg.cra_aead.setkey = crypto_rfc4543_setkey;
+       inst->alg.cra_aead.setauthsize = crypto_rfc4543_setauthsize;
+       inst->alg.cra_aead.encrypt = crypto_rfc4543_encrypt;
+       inst->alg.cra_aead.decrypt = crypto_rfc4543_decrypt;
+
+       inst->alg.cra_aead.geniv = "seqiv";
+
+out:
+       return inst;
+
+out_drop_alg:
+       crypto_drop_aead(spawn);
+out_free_inst:
+       kfree(inst);
+       inst = ERR_PTR(err);
+       goto out;
+}
+
+static void crypto_rfc4543_free(struct crypto_instance *inst)
+{
+       crypto_drop_spawn(crypto_instance_ctx(inst));
+       kfree(inst);
+}
+
+static struct crypto_template crypto_rfc4543_tmpl = {
+       .name = "rfc4543",
+       .alloc = crypto_rfc4543_alloc,
+       .free = crypto_rfc4543_free,
+       .module = THIS_MODULE,
+};
+
 static int __init crypto_gcm_module_init(void)
 {
        int err;
@@ -1067,8 +1346,14 @@ static int __init crypto_gcm_module_init(void)
        if (err)
                goto out_undo_gcm;
 
+       err = crypto_register_template(&crypto_rfc4543_tmpl);
+       if (err)
+               goto out_undo_rfc4106;
+
        return 0;
 
+out_undo_rfc4106:
+       crypto_unregister_template(&crypto_rfc4106_tmpl);
 out_undo_gcm:
        crypto_unregister_template(&crypto_gcm_tmpl);
 out_undo_base:
@@ -1081,6 +1366,7 @@ out:
 static void __exit crypto_gcm_module_exit(void)
 {
        kfree(gcm_zeroes);
+       crypto_unregister_template(&crypto_rfc4543_tmpl);
        crypto_unregister_template(&crypto_rfc4106_tmpl);
        crypto_unregister_template(&crypto_gcm_tmpl);
        crypto_unregister_template(&crypto_gcm_base_tmpl);
@@ -1094,3 +1380,4 @@ MODULE_DESCRIPTION("Galois/Counter Mode");
 MODULE_AUTHOR("Mikko Herranen <mh1@iki.fi>");
 MODULE_ALIAS("gcm_base");
 MODULE_ALIAS("rfc4106");
+MODULE_ALIAS("rfc4543");
index 83eb52961750115b6332869a4e19fa7b852d39cb..9fda213a592ef6ccb7e709769f56b1b5f761d447 100644 (file)
  *
  */
 #include <crypto/internal/hash.h>
+#include <crypto/md5.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-#define MD5_DIGEST_SIZE                16
-#define MD5_HMAC_BLOCK_SIZE    64
-#define MD5_BLOCK_WORDS                16
-#define MD5_HASH_WORDS         4
-
 #define F1(x, y, z)    (z ^ (x & (y ^ z)))
 #define F2(x, y, z)    F1(z, x, y)
 #define F3(x, y, z)    (x ^ y ^ z)
 #define MD5STEP(f, w, x, y, z, in, s) \
        (w += f(x, y, z) + in, w = (w<<s | w>>(32-s)) + x)
 
-struct md5_ctx {
-       u32 hash[MD5_HASH_WORDS];
-       u32 block[MD5_BLOCK_WORDS];
-       u64 byte_count;
-};
-
 static void md5_transform(u32 *hash, u32 const *in)
 {
        u32 a, b, c, d;
@@ -141,7 +131,7 @@ static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
        }
 }
 
-static inline void md5_transform_helper(struct md5_ctx *ctx)
+static inline void md5_transform_helper(struct md5_state *ctx)
 {
        le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(u32));
        md5_transform(ctx->hash, ctx->block);
@@ -149,7 +139,7 @@ static inline void md5_transform_helper(struct md5_ctx *ctx)
 
 static int md5_init(struct shash_desc *desc)
 {
-       struct md5_ctx *mctx = shash_desc_ctx(desc);
+       struct md5_state *mctx = shash_desc_ctx(desc);
 
        mctx->hash[0] = 0x67452301;
        mctx->hash[1] = 0xefcdab89;
@@ -162,7 +152,7 @@ static int md5_init(struct shash_desc *desc)
 
 static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
 {
-       struct md5_ctx *mctx = shash_desc_ctx(desc);
+       struct md5_state *mctx = shash_desc_ctx(desc);
        const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
 
        mctx->byte_count += len;
@@ -194,7 +184,7 @@ static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
 
 static int md5_final(struct shash_desc *desc, u8 *out)
 {
-       struct md5_ctx *mctx = shash_desc_ctx(desc);
+       struct md5_state *mctx = shash_desc_ctx(desc);
        const unsigned int offset = mctx->byte_count & 0x3f;
        char *p = (char *)mctx->block + offset;
        int padding = 56 - (offset + 1);
@@ -220,12 +210,30 @@ static int md5_final(struct shash_desc *desc, u8 *out)
        return 0;
 }
 
+static int md5_export(struct shash_desc *desc, void *out)
+{
+       struct md5_state *ctx = shash_desc_ctx(desc);
+
+       memcpy(out, ctx, sizeof(*ctx));
+       return 0;
+}
+
+static int md5_import(struct shash_desc *desc, const void *in)
+{
+       struct md5_state *ctx = shash_desc_ctx(desc);
+
+       memcpy(ctx, in, sizeof(*ctx));
+       return 0;
+}
+
 static struct shash_alg alg = {
        .digestsize     =       MD5_DIGEST_SIZE,
        .init           =       md5_init,
        .update         =       md5_update,
        .final          =       md5_final,
-       .descsize       =       sizeof(struct md5_ctx),
+       .export         =       md5_export,
+       .import         =       md5_import,
+       .descsize       =       sizeof(struct md5_state),
        .base           =       {
                .cra_name       =       "md5",
                .cra_flags      =       CRYPTO_ALG_TYPE_SHASH,
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
new file mode 100644 (file)
index 0000000..8020124
--- /dev/null
@@ -0,0 +1,445 @@
+/*
+ * pcrypt - Parallel crypto wrapper.
+ *
+ * Copyright (C) 2009 secunet Security Networks AG
+ * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <crypto/algapi.h>
+#include <crypto/internal/aead.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <crypto/pcrypt.h>
+
+static struct padata_instance *pcrypt_enc_padata;
+static struct padata_instance *pcrypt_dec_padata;
+static struct workqueue_struct *encwq;
+static struct workqueue_struct *decwq;
+
+struct pcrypt_instance_ctx {
+       struct crypto_spawn spawn;
+       unsigned int tfm_count;
+};
+
+struct pcrypt_aead_ctx {
+       struct crypto_aead *child;
+       unsigned int cb_cpu;
+};
+
+static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
+                             struct padata_instance *pinst)
+{
+       unsigned int cpu_index, cpu, i;
+
+       cpu = *cb_cpu;
+
+       if (cpumask_test_cpu(cpu, cpu_active_mask))
+                       goto out;
+
+       cpu_index = cpu % cpumask_weight(cpu_active_mask);
+
+       cpu = cpumask_first(cpu_active_mask);
+       for (i = 0; i < cpu_index; i++)
+               cpu = cpumask_next(cpu, cpu_active_mask);
+
+       *cb_cpu = cpu;
+
+out:
+       return padata_do_parallel(pinst, padata, cpu);
+}
+
+static int pcrypt_aead_setkey(struct crypto_aead *parent,
+                             const u8 *key, unsigned int keylen)
+{
+       struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(parent);
+
+       return crypto_aead_setkey(ctx->child, key, keylen);
+}
+
+static int pcrypt_aead_setauthsize(struct crypto_aead *parent,
+                                  unsigned int authsize)
+{
+       struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(parent);
+
+       return crypto_aead_setauthsize(ctx->child, authsize);
+}
+
+static void pcrypt_aead_serial(struct padata_priv *padata)
+{
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_request *req = pcrypt_request_ctx(preq);
+
+       aead_request_complete(req->base.data, padata->info);
+}
+
+static void pcrypt_aead_giv_serial(struct padata_priv *padata)
+{
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_givcrypt_request *req = pcrypt_request_ctx(preq);
+
+       aead_request_complete(req->areq.base.data, padata->info);
+}
+
+static void pcrypt_aead_done(struct crypto_async_request *areq, int err)
+{
+       struct aead_request *req = areq->data;
+       struct pcrypt_request *preq = aead_request_ctx(req);
+       struct padata_priv *padata = pcrypt_request_padata(preq);
+
+       padata->info = err;
+       req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
+
+       padata_do_serial(padata);
+}
+
+static void pcrypt_aead_enc(struct padata_priv *padata)
+{
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_request *req = pcrypt_request_ctx(preq);
+
+       padata->info = crypto_aead_encrypt(req);
+
+       if (padata->info == -EINPROGRESS)
+               return;
+
+       padata_do_serial(padata);
+}
+
+static int pcrypt_aead_encrypt(struct aead_request *req)
+{
+       int err;
+       struct pcrypt_request *preq = aead_request_ctx(req);
+       struct aead_request *creq = pcrypt_request_ctx(preq);
+       struct padata_priv *padata = pcrypt_request_padata(preq);
+       struct crypto_aead *aead = crypto_aead_reqtfm(req);
+       struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(aead);
+       u32 flags = aead_request_flags(req);
+
+       memset(padata, 0, sizeof(struct padata_priv));
+
+       padata->parallel = pcrypt_aead_enc;
+       padata->serial = pcrypt_aead_serial;
+
+       aead_request_set_tfm(creq, ctx->child);
+       aead_request_set_callback(creq, flags & ~CRYPTO_TFM_REQ_MAY_SLEEP,
+                                 pcrypt_aead_done, req);
+       aead_request_set_crypt(creq, req->src, req->dst,
+                              req->cryptlen, req->iv);
+       aead_request_set_assoc(creq, req->assoc, req->assoclen);
+
+       err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata);
+       if (err)
+               return err;
+       else
+               err = crypto_aead_encrypt(creq);
+
+       return err;
+}
+
+static void pcrypt_aead_dec(struct padata_priv *padata)
+{
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_request *req = pcrypt_request_ctx(preq);
+
+       padata->info = crypto_aead_decrypt(req);
+
+       if (padata->info == -EINPROGRESS)
+               return;
+
+       padata_do_serial(padata);
+}
+
+static int pcrypt_aead_decrypt(struct aead_request *req)
+{
+       int err;
+       struct pcrypt_request *preq = aead_request_ctx(req);
+       struct aead_request *creq = pcrypt_request_ctx(preq);
+       struct padata_priv *padata = pcrypt_request_padata(preq);
+       struct crypto_aead *aead = crypto_aead_reqtfm(req);
+       struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(aead);
+       u32 flags = aead_request_flags(req);
+
+       memset(padata, 0, sizeof(struct padata_priv));
+
+       padata->parallel = pcrypt_aead_dec;
+       padata->serial = pcrypt_aead_serial;
+
+       aead_request_set_tfm(creq, ctx->child);
+       aead_request_set_callback(creq, flags & ~CRYPTO_TFM_REQ_MAY_SLEEP,
+                                 pcrypt_aead_done, req);
+       aead_request_set_crypt(creq, req->src, req->dst,
+                              req->cryptlen, req->iv);
+       aead_request_set_assoc(creq, req->assoc, req->assoclen);
+
+       err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_dec_padata);
+       if (err)
+               return err;
+       else
+               err = crypto_aead_decrypt(creq);
+
+       return err;
+}
+
+static void pcrypt_aead_givenc(struct padata_priv *padata)
+{
+       struct pcrypt_request *preq = pcrypt_padata_request(padata);
+       struct aead_givcrypt_request *req = pcrypt_request_ctx(preq);
+
+       padata->info = crypto_aead_givencrypt(req);
+
+       if (padata->info == -EINPROGRESS)
+               return;
+
+       padata_do_serial(padata);
+}
+
+static int pcrypt_aead_givencrypt(struct aead_givcrypt_request *req)
+{
+       int err;
+       struct aead_request *areq = &req->areq;
+       struct pcrypt_request *preq = aead_request_ctx(areq);
+       struct aead_givcrypt_request *creq = pcrypt_request_ctx(preq);
+       struct padata_priv *padata = pcrypt_request_padata(preq);
+       struct crypto_aead *aead = aead_givcrypt_reqtfm(req);
+       struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(aead);
+       u32 flags = aead_request_flags(areq);
+
+       memset(padata, 0, sizeof(struct padata_priv));
+
+       padata->parallel = pcrypt_aead_givenc;
+       padata->serial = pcrypt_aead_giv_serial;
+
+       aead_givcrypt_set_tfm(creq, ctx->child);
+       aead_givcrypt_set_callback(creq, flags & ~CRYPTO_TFM_REQ_MAY_SLEEP,
+                                  pcrypt_aead_done, areq);
+       aead_givcrypt_set_crypt(creq, areq->src, areq->dst,
+                               areq->cryptlen, areq->iv);
+       aead_givcrypt_set_assoc(creq, areq->assoc, areq->assoclen);
+       aead_givcrypt_set_giv(creq, req->giv, req->seq);
+
+       err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata);
+       if (err)
+               return err;
+       else
+               err = crypto_aead_givencrypt(creq);
+
+       return err;
+}
+
+static int pcrypt_aead_init_tfm(struct crypto_tfm *tfm)
+{
+       int cpu, cpu_index;
+       struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
+       struct pcrypt_instance_ctx *ictx = crypto_instance_ctx(inst);
+       struct pcrypt_aead_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_aead *cipher;
+
+       ictx->tfm_count++;
+
+       cpu_index = ictx->tfm_count % cpumask_weight(cpu_active_mask);
+
+       ctx->cb_cpu = cpumask_first(cpu_active_mask);
+       for (cpu = 0; cpu < cpu_index; cpu++)
+               ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_active_mask);
+
+       cipher = crypto_spawn_aead(crypto_instance_ctx(inst));
+
+       if (IS_ERR(cipher))
+               return PTR_ERR(cipher);
+
+       ctx->child = cipher;
+       tfm->crt_aead.reqsize = sizeof(struct pcrypt_request)
+               + sizeof(struct aead_givcrypt_request)
+               + crypto_aead_reqsize(cipher);
+
+       return 0;
+}
+
+static void pcrypt_aead_exit_tfm(struct crypto_tfm *tfm)
+{
+       struct pcrypt_aead_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       crypto_free_aead(ctx->child);
+}
+
+static struct crypto_instance *pcrypt_alloc_instance(struct crypto_alg *alg)
+{
+       struct crypto_instance *inst;
+       struct pcrypt_instance_ctx *ctx;
+       int err;
+
+       inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
+       if (!inst) {
+               inst = ERR_PTR(-ENOMEM);
+               goto out;
+       }
+
+       err = -ENAMETOOLONG;
+       if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
+                    "pcrypt(%s)", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME)
+               goto out_free_inst;
+
+       memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME);
+
+       ctx = crypto_instance_ctx(inst);
+       err = crypto_init_spawn(&ctx->spawn, alg, inst,
+                               CRYPTO_ALG_TYPE_MASK);
+       if (err)
+               goto out_free_inst;
+
+       inst->alg.cra_priority = alg->cra_priority + 100;
+       inst->alg.cra_blocksize = alg->cra_blocksize;
+       inst->alg.cra_alignmask = alg->cra_alignmask;
+
+out:
+       return inst;
+
+out_free_inst:
+       kfree(inst);
+       inst = ERR_PTR(err);
+       goto out;
+}
+
+static struct crypto_instance *pcrypt_alloc_aead(struct rtattr **tb)
+{
+       struct crypto_instance *inst;
+       struct crypto_alg *alg;
+       struct crypto_attr_type *algt;
+
+       algt = crypto_get_attr_type(tb);
+
+       alg = crypto_get_attr_alg(tb, algt->type,
+                                 (algt->mask & CRYPTO_ALG_TYPE_MASK));
+       if (IS_ERR(alg))
+               return ERR_CAST(alg);
+
+       inst = pcrypt_alloc_instance(alg);
+       if (IS_ERR(inst))
+               goto out_put_alg;
+
+       inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC;
+       inst->alg.cra_type = &crypto_aead_type;
+
+       inst->alg.cra_aead.ivsize = alg->cra_aead.ivsize;
+       inst->alg.cra_aead.geniv = alg->cra_aead.geniv;
+       inst->alg.cra_aead.maxauthsize = alg->cra_aead.maxauthsize;
+
+       inst->alg.cra_ctxsize = sizeof(struct pcrypt_aead_ctx);
+
+       inst->alg.cra_init = pcrypt_aead_init_tfm;
+       inst->alg.cra_exit = pcrypt_aead_exit_tfm;
+
+       inst->alg.cra_aead.setkey = pcrypt_aead_setkey;
+       inst->alg.cra_aead.setauthsize = pcrypt_aead_setauthsize;
+       inst->alg.cra_aead.encrypt = pcrypt_aead_encrypt;
+       inst->alg.cra_aead.decrypt = pcrypt_aead_decrypt;
+       inst->alg.cra_aead.givencrypt = pcrypt_aead_givencrypt;
+
+out_put_alg:
+       crypto_mod_put(alg);
+       return inst;
+}
+
+static struct crypto_instance *pcrypt_alloc(struct rtattr **tb)
+{
+       struct crypto_attr_type *algt;
+
+       algt = crypto_get_attr_type(tb);
+       if (IS_ERR(algt))
+               return ERR_CAST(algt);
+
+       switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) {
+       case CRYPTO_ALG_TYPE_AEAD:
+               return pcrypt_alloc_aead(tb);
+       }
+
+       return ERR_PTR(-EINVAL);
+}
+
+static void pcrypt_free(struct crypto_instance *inst)
+{
+       struct pcrypt_instance_ctx *ctx = crypto_instance_ctx(inst);
+
+       crypto_drop_spawn(&ctx->spawn);
+       kfree(inst);
+}
+
+static struct crypto_template pcrypt_tmpl = {
+       .name = "pcrypt",
+       .alloc = pcrypt_alloc,
+       .free = pcrypt_free,
+       .module = THIS_MODULE,
+};
+
+static int __init pcrypt_init(void)
+{
+       encwq = create_workqueue("pencrypt");
+       if (!encwq)
+               goto err;
+
+       decwq = create_workqueue("pdecrypt");
+       if (!decwq)
+               goto err_destroy_encwq;
+
+
+       pcrypt_enc_padata = padata_alloc(cpu_possible_mask, encwq);
+       if (!pcrypt_enc_padata)
+               goto err_destroy_decwq;
+
+       pcrypt_dec_padata = padata_alloc(cpu_possible_mask, decwq);
+       if (!pcrypt_dec_padata)
+               goto err_free_padata;
+
+       padata_start(pcrypt_enc_padata);
+       padata_start(pcrypt_dec_padata);
+
+       return crypto_register_template(&pcrypt_tmpl);
+
+err_free_padata:
+       padata_free(pcrypt_enc_padata);
+
+err_destroy_decwq:
+       destroy_workqueue(decwq);
+
+err_destroy_encwq:
+       destroy_workqueue(encwq);
+
+err:
+       return -ENOMEM;
+}
+
+static void __exit pcrypt_exit(void)
+{
+       padata_stop(pcrypt_enc_padata);
+       padata_stop(pcrypt_dec_padata);
+
+       destroy_workqueue(encwq);
+       destroy_workqueue(decwq);
+
+       padata_free(pcrypt_enc_padata);
+       padata_free(pcrypt_dec_padata);
+
+       crypto_unregister_template(&pcrypt_tmpl);
+}
+
+module_init(pcrypt_init);
+module_exit(pcrypt_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>");
+MODULE_DESCRIPTION("Parallel crypto wrapper");
index 7620bfce92f22ff2cedc382c1f5137788bcdd33d..c494d7610be14336262e126434cde7b8b530fae4 100644 (file)
@@ -1477,9 +1477,54 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
        return err;
 }
 
+static int alg_test_null(const struct alg_test_desc *desc,
+                            const char *driver, u32 type, u32 mask)
+{
+       return 0;
+}
+
 /* Please keep this list sorted by algorithm name. */
 static const struct alg_test_desc alg_test_descs[] = {
        {
+               .alg = "__driver-cbc-aes-aesni",
+               .test = alg_test_null,
+               .suite = {
+                       .cipher = {
+                               .enc = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               },
+                               .dec = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               }
+                       }
+               }
+       }, {
+               .alg = "__driver-ecb-aes-aesni",
+               .test = alg_test_null,
+               .suite = {
+                       .cipher = {
+                               .enc = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               },
+                               .dec = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               }
+                       }
+               }
+       }, {
+               .alg = "__ghash-pclmulqdqni",
+               .test = alg_test_null,
+               .suite = {
+                       .hash = {
+                               .vecs = NULL,
+                               .count = 0
+                       }
+               }
+       }, {
                .alg = "ansi_cprng",
                .test = alg_test_cprng,
                .fips_allowed = 1,
@@ -1622,6 +1667,30 @@ static const struct alg_test_desc alg_test_descs[] = {
                                .count = CRC32C_TEST_VECTORS
                        }
                }
+       }, {
+               .alg = "cryptd(__driver-ecb-aes-aesni)",
+               .test = alg_test_null,
+               .suite = {
+                       .cipher = {
+                               .enc = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               },
+                               .dec = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               }
+                       }
+               }
+       }, {
+               .alg = "cryptd(__ghash-pclmulqdqni)",
+               .test = alg_test_null,
+               .suite = {
+                       .hash = {
+                               .vecs = NULL,
+                               .count = 0
+                       }
+               }
        }, {
                .alg = "ctr(aes)",
                .test = alg_test_skcipher,
@@ -1668,6 +1737,21 @@ static const struct alg_test_desc alg_test_descs[] = {
                                }
                        }
                }
+       }, {
+               .alg = "ecb(__aes-aesni)",
+               .test = alg_test_null,
+               .suite = {
+                       .cipher = {
+                               .enc = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               },
+                               .dec = {
+                                       .vecs = NULL,
+                                       .count = 0
+                               }
+                       }
+               }
        }, {
                .alg = "ecb(aes)",
                .test = alg_test_skcipher,
index 97991ac6f5fcb4664881fa5b873cab061ab7fdc7..7e52295f1ecc020d65582eb9d1c867126673a1d6 100644 (file)
@@ -208,7 +208,7 @@ static int power_saving_thread(void *data)
                 * the mechanism only works when all CPUs have RT task running,
                 * as if one CPU hasn't RT task, RT task from other CPUs will
                 * borrow CPU time from this CPU and cause RT task use > 95%
-                * CPU time. To make 'avoid staration' work, takes a nap here.
+                * CPU time. To make 'avoid starvation' work, takes a nap here.
                 */
                if (do_sleep)
                        schedule_timeout_killable(HZ * idle_pct / 100);
@@ -222,14 +222,18 @@ static struct task_struct *ps_tsks[NR_CPUS];
 static unsigned int ps_tsk_num;
 static int create_power_saving_task(void)
 {
+       int rc = -ENOMEM;
+
        ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
                (void *)(unsigned long)ps_tsk_num,
                "power_saving/%d", ps_tsk_num);
-       if (ps_tsks[ps_tsk_num]) {
+       rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0;
+       if (!rc)
                ps_tsk_num++;
-               return 0;
-       }
-       return -EINVAL;
+       else
+               ps_tsks[ps_tsk_num] = NULL;
+
+       return rc;
 }
 
 static void destroy_power_saving_task(void)
@@ -237,6 +241,7 @@ static void destroy_power_saving_task(void)
        if (ps_tsk_num > 0) {
                ps_tsk_num--;
                kthread_stop(ps_tsks[ps_tsk_num]);
+               ps_tsks[ps_tsk_num] = NULL;
        }
 }
 
@@ -253,7 +258,7 @@ static void set_power_saving_task_num(unsigned int num)
        }
 }
 
-static int acpi_pad_idle_cpus(unsigned int num_cpus)
+static void acpi_pad_idle_cpus(unsigned int num_cpus)
 {
        get_online_cpus();
 
@@ -261,7 +266,6 @@ static int acpi_pad_idle_cpus(unsigned int num_cpus)
        set_power_saving_task_num(num_cpus);
 
        put_online_cpus();
-       return 0;
 }
 
 static uint32_t acpi_pad_idle_cpus_num(void)
@@ -369,19 +373,21 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device)
 static int acpi_pad_pur(acpi_handle handle, int *num_cpus)
 {
        struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       acpi_status status;
        union acpi_object *package;
        int rev, num, ret = -EINVAL;
 
-       status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer);
-       if (ACPI_FAILURE(status))
+       if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer)))
+               return -EINVAL;
+
+       if (!buffer.length || !buffer.pointer)
                return -EINVAL;
+
        package = buffer.pointer;
        if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2)
                goto out;
        rev = package->package.elements[0].integer.value;
        num = package->package.elements[1].integer.value;
-       if (rev != 1)
+       if (rev != 1 || num < 0)
                goto out;
        *num_cpus = num;
        ret = 0;
@@ -410,7 +416,7 @@ static void acpi_pad_ost(acpi_handle handle, int stat,
 
 static void acpi_pad_handle_notify(acpi_handle handle)
 {
-       int num_cpus, ret;
+       int num_cpus;
        uint32_t idle_cpus;
 
        mutex_lock(&isolated_cpus_lock);
@@ -418,12 +424,9 @@ static void acpi_pad_handle_notify(acpi_handle handle)
                mutex_unlock(&isolated_cpus_lock);
                return;
        }
-       ret = acpi_pad_idle_cpus(num_cpus);
+       acpi_pad_idle_cpus(num_cpus);
        idle_cpus = acpi_pad_idle_cpus_num();
-       if (!ret)
-               acpi_pad_ost(handle, 0, idle_cpus);
-       else
-               acpi_pad_ost(handle, 1, 0);
+       acpi_pad_ost(handle, 0, idle_cpus);
        mutex_unlock(&isolated_cpus_lock);
 }
 
index 0bba148a2c61fc084d52a58df1b1498b20ef6034..4ced54f7a5d97d0ff0b005bf568b0e2aaf72a188 100644 (file)
@@ -76,12 +76,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
  * evgpe - GPE handling and dispatch
  */
 acpi_status
-acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
-                               u8 type);
+acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info);
 
-acpi_status
-acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
-                  u8 write_to_hardware);
+acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
@@ -121,9 +118,6 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
 
 u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
 
-acpi_status
-acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
-
 acpi_status
 acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
index 81e64f478679be04dafdb1a1786e34e72906c310..13cb80caacdeaa83e4b48f9864f18379b4eedc80 100644 (file)
@@ -426,6 +426,8 @@ struct acpi_gpe_event_info {
        struct acpi_gpe_register_info *register_info;   /* Backpointer to register info */
        u8 flags;               /* Misc info about this GPE */
        u8 gpe_number;          /* This GPE */
+       u8 runtime_count;
+       u8 wakeup_count;
 };
 
 /* Information about a GPE register pair, one per each status/enable pair in an array */
index 64062b1be3eee472be38220e18fa36ecab1917ad..07f6e2ea2ee548f9c5578f13449b4b618aafd7b3 100644 (file)
@@ -287,8 +287,10 @@ struct acpi_object_buffer_field {
 
 struct acpi_object_notify_handler {
        ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node;     /* Parent device */
+       u32 handler_type;
        acpi_notify_handler handler;
        void *context;
+       struct acpi_object_notify_handler *next;
 };
 
 struct acpi_object_addr_handler {
index afacf4416c738941287f944d599dd13011b6caf6..0b453467a5a02f2eebcb0cbbf0ce009f444b7495 100644 (file)
@@ -52,56 +52,11 @@ ACPI_MODULE_NAME("evgpe")
 /* Local prototypes */
 static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ev_set_gpe_type
- *
- * PARAMETERS:  gpe_event_info          - GPE to set
- *              Type                    - New type
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
-{
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE(ev_set_gpe_type);
-
-       /* Validate type and update register enable masks */
-
-       switch (type) {
-       case ACPI_GPE_TYPE_WAKE:
-       case ACPI_GPE_TYPE_RUNTIME:
-       case ACPI_GPE_TYPE_WAKE_RUN:
-               break;
-
-       default:
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
-
-       /* Disable the GPE if currently enabled */
-
-       status = acpi_ev_disable_gpe(gpe_event_info);
-
-       /* Clear the type bits and insert the new Type */
-
-       gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK;
-       gpe_event_info->flags |= type;
-       return_ACPI_STATUS(status);
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_update_gpe_enable_masks
  *
  * PARAMETERS:  gpe_event_info          - GPE to update
- *              Type                    - What to do: ACPI_GPE_DISABLE or
- *                                        ACPI_GPE_ENABLE
  *
  * RETURN:      Status
  *
@@ -110,8 +65,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
  ******************************************************************************/
 
 acpi_status
-acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
-                               u8 type)
+acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
 {
        struct acpi_gpe_register_info *gpe_register_info;
        u8 register_bit;
@@ -127,37 +81,14 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
            (1 <<
             (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
 
-       /* 1) Disable case. Simply clear all enable bits */
-
-       if (type == ACPI_GPE_DISABLE) {
-               ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
-                              register_bit);
-               ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
-               return_ACPI_STATUS(AE_OK);
-       }
-
-       /* 2) Enable case. Set/Clear the appropriate enable bits */
+       ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit);
+       ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
 
-       switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
-       case ACPI_GPE_TYPE_WAKE:
-               ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
-               ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
-               break;
-
-       case ACPI_GPE_TYPE_RUNTIME:
-               ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
-                              register_bit);
+       if (gpe_event_info->runtime_count)
                ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
-               break;
 
-       case ACPI_GPE_TYPE_WAKE_RUN:
+       if (gpe_event_info->wakeup_count)
                ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
-               ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
-               break;
-
-       default:
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
 
        return_ACPI_STATUS(AE_OK);
 }
@@ -167,8 +98,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
  * FUNCTION:    acpi_ev_enable_gpe
  *
  * PARAMETERS:  gpe_event_info          - GPE to enable
- *              write_to_hardware       - Enable now, or just mark data structs
- *                                        (WAKE GPEs should be deferred)
  *
  * RETURN:      Status
  *
@@ -176,9 +105,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
-                  u8 write_to_hardware)
+acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
        acpi_status status;
 
@@ -186,47 +113,20 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
 
        /* Make sure HW enable masks are updated */
 
-       status =
-           acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
-       if (ACPI_FAILURE(status)) {
+       status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
+       if (ACPI_FAILURE(status))
                return_ACPI_STATUS(status);
-       }
 
        /* Mark wake-enabled or HW enable, or both */
 
-       switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
-       case ACPI_GPE_TYPE_WAKE:
-
-               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
-               break;
-
-       case ACPI_GPE_TYPE_WAKE_RUN:
-
-               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
-
-               /*lint -fallthrough */
-
-       case ACPI_GPE_TYPE_RUNTIME:
-
-               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
-
-               if (write_to_hardware) {
-
-                       /* Clear the GPE (of stale events), then enable it */
-
-                       status = acpi_hw_clear_gpe(gpe_event_info);
-                       if (ACPI_FAILURE(status)) {
-                               return_ACPI_STATUS(status);
-                       }
-
-                       /* Enable the requested runtime GPE */
-
-                       status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
-               }
-               break;
+       if (gpe_event_info->runtime_count) {
+               /* Clear the GPE (of stale events), then enable it */
+               status = acpi_hw_clear_gpe(gpe_event_info);
+               if (ACPI_FAILURE(status))
+                       return_ACPI_STATUS(status);
 
-       default:
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               /* Enable the requested runtime GPE */
+               status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
        }
 
        return_ACPI_STATUS(AE_OK);
@@ -252,34 +152,9 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
        /* Make sure HW enable masks are updated */
 
-       status =
-           acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
-       if (ACPI_FAILURE(status)) {
+       status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
+       if (ACPI_FAILURE(status))
                return_ACPI_STATUS(status);
-       }
-
-       /* Clear the appropriate enabled flags for this GPE */
-
-       switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
-       case ACPI_GPE_TYPE_WAKE:
-               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
-               break;
-
-       case ACPI_GPE_TYPE_WAKE_RUN:
-               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
-
-               /* fallthrough */
-
-       case ACPI_GPE_TYPE_RUNTIME:
-
-               /* Disable the requested runtime GPE */
-
-               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
-               break;
-
-       default:
-               break;
-       }
 
        /*
         * Even if we don't know the GPE type, make sure that we always
@@ -521,7 +396,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 
        /* Set the GPE flags for return to enabled state */
 
-       (void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
+       (void)acpi_ev_update_gpe_enable_masks(gpe_event_info);
 
        /*
         * Take a snapshot of the GPE info for this level - we copy the info to
index 247920900187287abbe8bf24f04f9b02725b08cb..3d4c4aca11cdabbd64e20c71ee7f5f15eece87a3 100644 (file)
@@ -258,7 +258,6 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
        u32 gpe_number;
        char name[ACPI_NAME_SIZE + 1];
        u8 type;
-       acpi_status status;
 
        ACPI_FUNCTION_TRACE(ev_save_method_info);
 
@@ -325,26 +324,20 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
 
        /*
         * Now we can add this information to the gpe_event_info block for use
-        * during dispatch of this GPE. Default type is RUNTIME, although this may
-        * change when the _PRW methods are executed later.
+        * during dispatch of this GPE.
         */
        gpe_event_info =
            &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
 
-       gpe_event_info->flags = (u8)
-           (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
+       gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD);
 
        gpe_event_info->dispatch.method_node =
            (struct acpi_namespace_node *)obj_handle;
 
-       /* Update enable mask, but don't enable the HW GPE as of yet */
-
-       status = acpi_ev_enable_gpe(gpe_event_info, FALSE);
-
        ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
                          "Registered GPE method %s as GPE number 0x%.2X\n",
                          name, gpe_number));
-       return_ACPI_STATUS(status);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
@@ -454,20 +447,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
                                                        gpe_block->
                                                        block_base_number];
 
-               /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
-
-               gpe_event_info->flags &=
-                   ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
-
-               status =
-                   acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
-               if (ACPI_FAILURE(status)) {
-                       goto cleanup;
-               }
-
-               status =
-                   acpi_ev_update_gpe_enable_masks(gpe_event_info,
-                                                   ACPI_GPE_DISABLE);
+               gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
        }
 
       cleanup:
@@ -989,7 +969,6 @@ acpi_status
 acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
                             struct acpi_gpe_block_info *gpe_block)
 {
-       acpi_status status;
        struct acpi_gpe_event_info *gpe_event_info;
        struct acpi_gpe_walk_info gpe_info;
        u32 wake_gpe_count;
@@ -1019,42 +998,50 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
                gpe_info.gpe_block = gpe_block;
                gpe_info.gpe_device = gpe_device;
 
-               status =
-                   acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+               acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
                                           ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
                                           acpi_ev_match_prw_and_gpe, NULL,
                                           &gpe_info, NULL);
        }
 
        /*
-        * Enable all GPEs in this block that have these attributes:
-        * 1) are "runtime" or "run/wake" GPEs, and
-        * 2) have a corresponding _Lxx or _Exx method
-        *
-        * Any other GPEs within this block must be enabled via the
-        * acpi_enable_gpe() external interface.
+        * Enable all GPEs that have a corresponding method and aren't
+        * capable of generating wakeups. Any other GPEs within this block
+        * must be enabled via the acpi_enable_gpe() interface.
         */
        wake_gpe_count = 0;
        gpe_enabled_count = 0;
+       if (gpe_device == acpi_gbl_fadt_gpe_device)
+               gpe_device = NULL;
 
        for (i = 0; i < gpe_block->register_count; i++) {
-               for (j = 0; j < 8; j++) {
+               for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
+                       acpi_status status;
+                       acpi_size gpe_index;
+                       int gpe_number;
 
                        /* Get the info block for this particular GPE */
+                       gpe_index = (acpi_size)i * ACPI_GPE_REGISTER_WIDTH + j;
+                       gpe_event_info = &gpe_block->event_info[gpe_index];
 
-                       gpe_event_info = &gpe_block->event_info[((acpi_size) i *
-                                                                ACPI_GPE_REGISTER_WIDTH)
-                                                               + j];
-
-                       if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
-                            ACPI_GPE_DISPATCH_METHOD) &&
-                           (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
-                               gpe_enabled_count++;
-                       }
-
-                       if (gpe_event_info->flags & ACPI_GPE_TYPE_WAKE) {
+                       if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
                                wake_gpe_count++;
+                               if (acpi_gbl_leave_wake_gpes_disabled)
+                                       continue;
                        }
+
+                       if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD))
+                               continue;
+
+                       gpe_number = gpe_index + gpe_block->block_base_number;
+                       status = acpi_enable_gpe(gpe_device, gpe_number,
+                                               ACPI_GPE_TYPE_RUNTIME);
+                       if (ACPI_FAILURE(status))
+                               ACPI_ERROR((AE_INFO,
+                                               "Failed to enable GPE %02X\n",
+                                               gpe_number));
+                       else
+                               gpe_enabled_count++;
                }
        }
 
@@ -1062,15 +1049,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
                          "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
                          wake_gpe_count, gpe_enabled_count));
 
-       /* Enable all valid runtime GPEs found above */
-
-       status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL);
-       if (ACPI_FAILURE(status)) {
-               ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
-                           gpe_block));
-       }
-
-       return_ACPI_STATUS(status);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
index ce224e1eaa895eb9e55946351d2b9413780c647e..8f0fac6c436647a546158b944626d3c526139f14 100644 (file)
@@ -259,9 +259,15 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
 
        handler_obj = notify_info->notify.handler_obj;
        if (handler_obj) {
-               handler_obj->notify.handler(notify_info->notify.node,
-                                           notify_info->notify.value,
-                                           handler_obj->notify.context);
+               struct acpi_object_notify_handler *notifier;
+
+               notifier = &handler_obj->notify;
+               while (notifier) {
+                       notifier->handler(notify_info->notify.node,
+                                         notify_info->notify.value,
+                                         notifier->context);
+                       notifier = notifier->next;
+               }
        }
 
        /* All done with the info object */
index 2fe0809d4eb298162c99171073dcfa0162327b59..474e2cab603d57cef295791eb22c24fe6d4c76f9 100644 (file)
@@ -216,6 +216,72 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
 
 ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_populate_handler_object
+ *
+ * PARAMETERS:  handler_obj        - Handler object to populate
+ *              handler_type       - The type of handler:
+ *                                  ACPI_SYSTEM_NOTIFY: system_handler (00-7f)
+ *                                  ACPI_DEVICE_NOTIFY: driver_handler (80-ff)
+ *                                  ACPI_ALL_NOTIFY:  both system and device
+ *              handler            - Address of the handler
+ *              context            - Value passed to the handler on each GPE
+ *              next               - Address of a handler object to link to
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Populate a handler object.
+ *
+ ******************************************************************************/
+static void
+acpi_populate_handler_object(struct acpi_object_notify_handler *handler_obj,
+                            u32 handler_type,
+                            acpi_notify_handler handler, void *context,
+                            struct acpi_object_notify_handler *next)
+{
+       handler_obj->handler_type = handler_type;
+       handler_obj->handler = handler;
+       handler_obj->context = context;
+       handler_obj->next = next;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_add_handler_object
+ *
+ * PARAMETERS:  parent_obj         - Parent of the new object
+ *              handler            - Address of the handler
+ *              context            - Value passed to the handler on each GPE
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new handler object and populate it.
+ *
+ ******************************************************************************/
+static acpi_status
+acpi_add_handler_object(struct acpi_object_notify_handler *parent_obj,
+                       acpi_notify_handler handler, void *context)
+{
+       struct acpi_object_notify_handler *handler_obj;
+
+       /* The parent must not be a defice notify handler object. */
+       if (parent_obj->handler_type & ACPI_DEVICE_NOTIFY)
+               return AE_BAD_PARAMETER;
+
+       handler_obj = ACPI_ALLOCATE_ZEROED(sizeof(*handler_obj));
+       if (!handler_obj)
+               return AE_NO_MEMORY;
+
+       acpi_populate_handler_object(handler_obj,
+                                       ACPI_SYSTEM_NOTIFY,
+                                       handler, context,
+                                       parent_obj->next);
+       parent_obj->next = handler_obj;
+
+       return AE_OK;
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_install_notify_handler
@@ -316,15 +382,32 @@ acpi_install_notify_handler(acpi_handle device,
                obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
 
-                       /* Object exists - make sure there's no handler */
+                       /* Object exists. */
 
-                       if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-                            obj_desc->common_notify.system_notify) ||
-                           ((handler_type & ACPI_DEVICE_NOTIFY) &&
-                            obj_desc->common_notify.device_notify)) {
+                       /* For a device notify, make sure there's no handler. */
+                       if ((handler_type & ACPI_DEVICE_NOTIFY) &&
+                            obj_desc->common_notify.device_notify) {
                                status = AE_ALREADY_EXISTS;
                                goto unlock_and_exit;
                        }
+
+                       /* System notifies may have more handlers installed. */
+                       notify_obj = obj_desc->common_notify.system_notify;
+
+                       if ((handler_type & ACPI_SYSTEM_NOTIFY) && notify_obj) {
+                               struct acpi_object_notify_handler *parent_obj;
+
+                               if (handler_type & ACPI_DEVICE_NOTIFY) {
+                                       status = AE_ALREADY_EXISTS;
+                                       goto unlock_and_exit;
+                               }
+
+                               parent_obj = &notify_obj->notify;
+                               status = acpi_add_handler_object(parent_obj,
+                                                                handler,
+                                                                context);
+                               goto unlock_and_exit;
+                       }
                } else {
                        /* Create a new object */
 
@@ -356,9 +439,10 @@ acpi_install_notify_handler(acpi_handle device,
                        goto unlock_and_exit;
                }
 
-               notify_obj->notify.node = node;
-               notify_obj->notify.handler = handler;
-               notify_obj->notify.context = context;
+               acpi_populate_handler_object(&notify_obj->notify,
+                                               handler_type,
+                                               handler, context,
+                                               NULL);
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
                        obj_desc->common_notify.system_notify = notify_obj;
@@ -418,6 +502,10 @@ acpi_remove_notify_handler(acpi_handle device,
                goto exit;
        }
 
+
+       /* Make sure all deferred tasks are completed */
+       acpi_os_wait_events_complete(NULL);
+
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
                goto exit;
@@ -445,15 +533,6 @@ acpi_remove_notify_handler(acpi_handle device,
                        goto unlock_and_exit;
                }
 
-               /* Make sure all deferred tasks are completed */
-
-               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-               acpi_os_wait_events_complete(NULL);
-               status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
                        acpi_gbl_system_notify.node = NULL;
                        acpi_gbl_system_notify.handler = NULL;
@@ -488,28 +567,60 @@ acpi_remove_notify_handler(acpi_handle device,
                /* Object exists - make sure there's an existing handler */
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
+                       struct acpi_object_notify_handler *handler_obj;
+                       struct acpi_object_notify_handler *parent_obj;
+
                        notify_obj = obj_desc->common_notify.system_notify;
                        if (!notify_obj) {
                                status = AE_NOT_EXIST;
                                goto unlock_and_exit;
                        }
 
-                       if (notify_obj->notify.handler != handler) {
+                       handler_obj = &notify_obj->notify;
+                       parent_obj = NULL;
+                       while (handler_obj->handler != handler) {
+                               if (handler_obj->next) {
+                                       parent_obj = handler_obj;
+                                       handler_obj = handler_obj->next;
+                               } else {
+                                       break;
+                               }
+                       }
+
+                       if (handler_obj->handler != handler) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
-                       /* Make sure all deferred tasks are completed */
 
-                       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-                       acpi_os_wait_events_complete(NULL);
-                       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-                       if (ACPI_FAILURE(status)) {
-                               goto exit;
+                       /*
+                        * Remove the handler.  There are three possible cases.
+                        * First, we may need to remove a non-embedded object.
+                        * Second, we may need to remove the embedded object's
+                        * handler data, while non-embedded objects exist.
+                        * Finally, we may need to remove the embedded object
+                        * entirely along with its container.
+                        */
+                       if (parent_obj) {
+                               /* Non-embedded object is being removed. */
+                               parent_obj->next = handler_obj->next;
+                               ACPI_FREE(handler_obj);
+                       } else if (notify_obj->notify.next) {
+                               /*
+                                * The handler matches the embedded object, but
+                                * there are more handler objects in the list.
+                                * Replace the embedded object's data with the
+                                * first next object's data and remove that
+                                * object.
+                                */
+                               parent_obj = &notify_obj->notify;
+                               handler_obj = notify_obj->notify.next;
+                               *parent_obj = *handler_obj;
+                               ACPI_FREE(handler_obj);
+                       } else {
+                               /* No more handler objects in the list. */
+                               obj_desc->common_notify.system_notify = NULL;
+                               acpi_ut_remove_reference(notify_obj);
                        }
-
-                       /* Remove the handler */
-                       obj_desc->common_notify.system_notify = NULL;
-                       acpi_ut_remove_reference(notify_obj);
                }
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
@@ -523,14 +634,6 @@ acpi_remove_notify_handler(acpi_handle device,
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
-                       /* Make sure all deferred tasks are completed */
-
-                       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-                       acpi_os_wait_events_complete(NULL);
-                       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-                       if (ACPI_FAILURE(status)) {
-                               goto exit;
-                       }
 
                        /* Remove the handler */
                        obj_desc->common_notify.device_notify = NULL;
@@ -617,13 +720,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        handler->context = context;
        handler->method_node = gpe_event_info->dispatch.method_node;
 
-       /* Disable the GPE before installing the handler */
-
-       status = acpi_ev_disable_gpe(gpe_event_info);
-       if (ACPI_FAILURE(status)) {
-               goto unlock_and_exit;
-       }
-
        /* Install the handler */
 
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
@@ -707,13 +803,6 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
                goto unlock_and_exit;
        }
 
-       /* Disable the GPE before removing the handler */
-
-       status = acpi_ev_disable_gpe(gpe_event_info);
-       if (ACPI_FAILURE(status)) {
-               goto unlock_and_exit;
-       }
-
        /* Make sure all deferred tasks are completed */
 
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
index eed7a38d25f2cfdb2be2c5c712da9f8b4d6df5f8..124c157215bfa712bdc700ab56d55285cb8d37c0 100644 (file)
@@ -201,23 +201,27 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_set_gpe_type
+ * FUNCTION:    acpi_set_gpe
  *
  * PARAMETERS:  gpe_device      - Parent GPE Device
  *              gpe_number      - GPE level within the GPE block
- *              Type            - New GPE type
+ *              action          - Enable or disable
+ *                                Called from ISR or not
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Set the type of an individual GPE
+ * DESCRIPTION: Enable or disable an ACPI event (general purpose)
  *
  ******************************************************************************/
-acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
+acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
 {
        acpi_status status = AE_OK;
+       acpi_cpu_flags flags;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE(acpi_set_gpe_type);
+       ACPI_FUNCTION_TRACE(acpi_set_gpe);
+
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
        /* Ensure that we have a valid GPE number */
 
@@ -227,19 +231,29 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
                goto unlock_and_exit;
        }
 
-       if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
-               return_ACPI_STATUS(AE_OK);
-       }
+       /* Perform the action */
+
+       switch (action) {
+       case ACPI_GPE_ENABLE:
+               status = acpi_ev_enable_gpe(gpe_event_info);
+               break;
 
-       /* Set the new type (will disable GPE if currently enabled) */
+       case ACPI_GPE_DISABLE:
+               status = acpi_ev_disable_gpe(gpe_event_info);
+               break;
 
-       status = acpi_ev_set_gpe_type(gpe_event_info, type);
+       default:
+               ACPI_ERROR((AE_INFO, "Invalid action\n"));
+               status = AE_BAD_PARAMETER;
+               break;
+       }
 
       unlock_and_exit:
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        return_ACPI_STATUS(status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
+ACPI_EXPORT_SYMBOL(acpi_set_gpe)
 
 /*******************************************************************************
  *
@@ -247,15 +261,14 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
  *
  * PARAMETERS:  gpe_device      - Parent GPE Device
  *              gpe_number      - GPE level within the GPE block
- *              Flags           - Just enable, or also wake enable?
- *                                Called from ISR or not
+ *              type            - Purpose the GPE will be used for
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Enable an ACPI event (general purpose)
+ * DESCRIPTION: Take a reference to a GPE and enable it if necessary
  *
  ******************************************************************************/
-acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
+acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
 {
        acpi_status status = AE_OK;
        acpi_cpu_flags flags;
@@ -263,6 +276,9 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
 
        ACPI_FUNCTION_TRACE(acpi_enable_gpe);
 
+       if (type & ~ACPI_GPE_TYPE_WAKE_RUN)
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
        /* Ensure that we have a valid GPE number */
@@ -273,15 +289,32 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
                goto unlock_and_exit;
        }
 
-       /* Perform the enable */
+       if (type & ACPI_GPE_TYPE_RUNTIME) {
+               if (++gpe_event_info->runtime_count == 1) {
+                       status = acpi_ev_enable_gpe(gpe_event_info);
+                       if (ACPI_FAILURE(status))
+                               gpe_event_info->runtime_count--;
+               }
+       }
+
+       if (type & ACPI_GPE_TYPE_WAKE) {
+               if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
+                       status = AE_BAD_PARAMETER;
+                       goto unlock_and_exit;
+               }
 
-       status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
+               /*
+                * Wake-up GPEs are only enabled right prior to putting the
+                * system into a sleep state.
+                */
+               if (++gpe_event_info->wakeup_count == 1)
+                       acpi_ev_update_gpe_enable_masks(gpe_event_info);
+       }
 
-      unlock_and_exit:
+unlock_and_exit:
        acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        return_ACPI_STATUS(status);
 }
-
 ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
 
 /*******************************************************************************
@@ -290,15 +323,14 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
  *
  * PARAMETERS:  gpe_device      - Parent GPE Device
  *              gpe_number      - GPE level within the GPE block
- *              Flags           - Just disable, or also wake disable?
- *                                Called from ISR or not
+ *              type            - Purpose the GPE won't be used for any more
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Disable an ACPI event (general purpose)
+ * DESCRIPTION: Release a reference to a GPE and disable it if necessary
  *
  ******************************************************************************/
-acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
+acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
 {
        acpi_status status = AE_OK;
        acpi_cpu_flags flags;
@@ -306,6 +338,9 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
 
        ACPI_FUNCTION_TRACE(acpi_disable_gpe);
 
+       if (type & ~ACPI_GPE_TYPE_WAKE_RUN)
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        /* Ensure that we have a valid GPE number */
 
@@ -315,13 +350,24 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
                goto unlock_and_exit;
        }
 
-       status = acpi_ev_disable_gpe(gpe_event_info);
+       if ((type & ACPI_GPE_TYPE_RUNTIME) && gpe_event_info->runtime_count) {
+               if (--gpe_event_info->runtime_count == 0)
+                       status = acpi_ev_disable_gpe(gpe_event_info);
+       }
+
+       if ((type & ACPI_GPE_TYPE_WAKE) && gpe_event_info->wakeup_count) {
+               /*
+                * Wake-up GPEs are not enabled after leaving system sleep
+                * states, so we don't need to disable them here.
+                */
+               if (--gpe_event_info->wakeup_count == 0)
+                       acpi_ev_update_gpe_enable_masks(gpe_event_info);
+       }
 
 unlock_and_exit:
        acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        return_ACPI_STATUS(status);
 }
-
 ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
 
 /*******************************************************************************
index cf761b904e4a2821d4cb09977182783c973a442f..a52126e46307832eb86a4cee2dedfebfb482ce17 100644 (file)
@@ -490,9 +490,14 @@ static void acpi_bus_osc_support(void)
 
        capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
        capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */
-#ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR
+#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\
+                       defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
        capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT;
 #endif
+
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
+       capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;
+#endif
        if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
                return;
        if (ACPI_SUCCESS(acpi_run_osc(handle, &context)))
index 8a95e8329df732891b260efe67ad1c1855538be8..f53fbe307c9dba027d9e4dc53867f0579da2f783 100644 (file)
@@ -422,11 +422,10 @@ static int acpi_button_add(struct acpi_device *device)
 
        if (device->wakeup.flags.valid) {
                /* Button's GPE is run-wake GPE */
-               acpi_set_gpe_type(device->wakeup.gpe_device,
-                                 device->wakeup.gpe_number,
-                                 ACPI_GPE_TYPE_WAKE_RUN);
                acpi_enable_gpe(device->wakeup.gpe_device,
-                               device->wakeup.gpe_number);
+                               device->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE_RUN);
+               device->wakeup.run_wake_count++;
                device->wakeup.state.enabled = 1;
        }
 
@@ -446,6 +445,14 @@ static int acpi_button_remove(struct acpi_device *device, int type)
 {
        struct acpi_button *button = acpi_driver_data(device);
 
+       if (device->wakeup.flags.valid) {
+               acpi_disable_gpe(device->wakeup.gpe_device,
+                               device->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE_RUN);
+               device->wakeup.run_wake_count--;
+               device->wakeup.state.enabled = 0;
+       }
+
        acpi_button_remove_fs(device);
        input_unregister_device(button->input);
        kfree(button);
index bbc2c1315c473ca7c7e8ff3770506ba645f16f0f..b2586f57e1f5fc1347757cbf24044acbac922a8d 100644 (file)
@@ -935,6 +935,7 @@ static int dock_add(acpi_handle handle)
        struct platform_device *dd;
 
        id = dock_station_count;
+       memset(&ds, 0, sizeof(ds));
        dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds));
        if (IS_ERR(dd))
                return PTR_ERR(dd);
index fd1801bdee66de41bffe16aec7afc07f4db171d5..27e0b92b2e39c01a1c7cb1e8e9dd305c1bf613b0 100644 (file)
@@ -201,14 +201,13 @@ unlock:
        spin_unlock_irqrestore(&ec->curr_lock, flags);
 }
 
-static void acpi_ec_gpe_query(void *ec_cxt);
+static int acpi_ec_sync_query(struct acpi_ec *ec);
 
-static int ec_check_sci(struct acpi_ec *ec, u8 state)
+static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
 {
        if (state & ACPI_EC_FLAG_SCI) {
                if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
-                       return acpi_os_execute(OSL_EC_BURST_HANDLER,
-                               acpi_ec_gpe_query, ec);
+                       return acpi_ec_sync_query(ec);
        }
        return 0;
 }
@@ -249,11 +248,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
 {
        unsigned long tmp;
        int ret = 0;
-       pr_debug(PREFIX "transaction start\n");
-       /* disable GPE during transaction if storm is detected */
-       if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
-               acpi_disable_gpe(NULL, ec->gpe);
-       }
        if (EC_FLAGS_MSI)
                udelay(ACPI_EC_MSI_UDELAY);
        /* start transaction */
@@ -265,20 +259,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
                clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
        spin_unlock_irqrestore(&ec->curr_lock, tmp);
        ret = ec_poll(ec);
-       pr_debug(PREFIX "transaction end\n");
        spin_lock_irqsave(&ec->curr_lock, tmp);
        ec->curr = NULL;
        spin_unlock_irqrestore(&ec->curr_lock, tmp);
-       if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
-               /* check if we received SCI during transaction */
-               ec_check_sci(ec, acpi_ec_read_status(ec));
-               /* it is safe to enable GPE outside of transaction */
-               acpi_enable_gpe(NULL, ec->gpe);
-       } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
-               pr_info(PREFIX "GPE storm detected, "
-                       "transactions will use polling mode\n");
-               set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
-       }
        return ret;
 }
 
@@ -321,7 +304,34 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
                status = -ETIME;
                goto end;
        }
+       pr_debug(PREFIX "transaction start\n");
+       /* disable GPE during transaction if storm is detected */
+       if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
+               /*
+                * It has to be disabled at the hardware level regardless of the
+                * GPE reference counting, so that it doesn't trigger.
+                */
+               acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
+       }
+
        status = acpi_ec_transaction_unlocked(ec, t);
+
+       /* check if we received SCI during transaction */
+       ec_check_sci_sync(ec, acpi_ec_read_status(ec));
+       if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
+               msleep(1);
+               /*
+                * It is safe to enable the GPE outside of the transaction.  Use
+                * acpi_set_gpe() for that, since we used it to disable the GPE
+                * above.
+                */
+               acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
+       } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
+               pr_info(PREFIX "GPE storm detected, "
+                       "transactions will use polling mode\n");
+               set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
+       }
+       pr_debug(PREFIX "transaction end\n");
 end:
        if (ec->global_lock)
                acpi_release_global_lock(glk);
@@ -443,7 +453,7 @@ int ec_transaction(u8 command,
 
 EXPORT_SYMBOL(ec_transaction);
 
-static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
+static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data)
 {
        int result;
        u8 d;
@@ -452,20 +462,16 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
                                .wlen = 0, .rlen = 1};
        if (!ec || !data)
                return -EINVAL;
-
        /*
         * Query the EC to find out which _Qxx method we need to evaluate.
         * Note that successful completion of the query causes the ACPI_EC_SCI
         * bit to be cleared (and thus clearing the interrupt source).
         */
-
-       result = acpi_ec_transaction(ec, &t);
+       result = acpi_ec_transaction_unlocked(ec, &t);
        if (result)
                return result;
-
        if (!d)
                return -ENODATA;
-
        *data = d;
        return 0;
 }
@@ -509,43 +515,79 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
 
 EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
 
-static void acpi_ec_gpe_query(void *ec_cxt)
+static void acpi_ec_run(void *cxt)
 {
-       struct acpi_ec *ec = ec_cxt;
-       u8 value = 0;
-       struct acpi_ec_query_handler *handler, copy;
-
-       if (!ec || acpi_ec_query(ec, &value))
+       struct acpi_ec_query_handler *handler = cxt;
+       if (!handler)
                return;
-       mutex_lock(&ec->lock);
+       pr_debug(PREFIX "start query execution\n");
+       if (handler->func)
+               handler->func(handler->data);
+       else if (handler->handle)
+               acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
+       pr_debug(PREFIX "stop query execution\n");
+       kfree(handler);
+}
+
+static int acpi_ec_sync_query(struct acpi_ec *ec)
+{
+       u8 value = 0;
+       int status;
+       struct acpi_ec_query_handler *handler, *copy;
+       if ((status = acpi_ec_query_unlocked(ec, &value)))
+               return status;
        list_for_each_entry(handler, &ec->list, node) {
                if (value == handler->query_bit) {
                        /* have custom handler for this bit */
-                       memcpy(&copy, handler, sizeof(copy));
-                       mutex_unlock(&ec->lock);
-                       if (copy.func) {
-                               copy.func(copy.data);
-                       } else if (copy.handle) {
-                               acpi_evaluate_object(copy.handle, NULL, NULL, NULL);
-                       }
-                       return;
+                       copy = kmalloc(sizeof(*handler), GFP_KERNEL);
+                       if (!copy)
+                               return -ENOMEM;
+                       memcpy(copy, handler, sizeof(*copy));
+                       pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value);
+                       return acpi_os_execute((copy->func) ?
+                               OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
+                               acpi_ec_run, copy);
                }
        }
+       return 0;
+}
+
+static void acpi_ec_gpe_query(void *ec_cxt)
+{
+       struct acpi_ec *ec = ec_cxt;
+       if (!ec)
+               return;
+       mutex_lock(&ec->lock);
+       acpi_ec_sync_query(ec);
        mutex_unlock(&ec->lock);
 }
 
+static void acpi_ec_gpe_query(void *ec_cxt);
+
+static int ec_check_sci(struct acpi_ec *ec, u8 state)
+{
+       if (state & ACPI_EC_FLAG_SCI) {
+               if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) {
+                       pr_debug(PREFIX "push gpe query to the queue\n");
+                       return acpi_os_execute(OSL_NOTIFY_HANDLER,
+                               acpi_ec_gpe_query, ec);
+               }
+       }
+       return 0;
+}
+
 static u32 acpi_ec_gpe_handler(void *data)
 {
        struct acpi_ec *ec = data;
-       u8 status;
 
        pr_debug(PREFIX "~~~> interrupt\n");
-       status = acpi_ec_read_status(ec);
 
-       advance_transaction(ec, status);
-       if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0)
+       advance_transaction(ec, acpi_ec_read_status(ec));
+       if (ec_transaction_done(ec) &&
+           (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
                wake_up(&ec->wait);
-       ec_check_sci(ec, status);
+               ec_check_sci(ec, acpi_ec_read_status(ec));
+       }
        return ACPI_INTERRUPT_HANDLED;
 }
 
@@ -754,8 +796,8 @@ static int ec_install_handlers(struct acpi_ec *ec)
                                  &acpi_ec_gpe_handler, ec);
        if (ACPI_FAILURE(status))
                return -ENODEV;
-       acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
-       acpi_enable_gpe(NULL, ec->gpe);
+
+       acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
        status = acpi_install_address_space_handler(ec->handle,
                                                    ACPI_ADR_SPACE_EC,
                                                    &acpi_ec_space_handler,
@@ -772,6 +814,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
                } else {
                        acpi_remove_gpe_handler(NULL, ec->gpe,
                                &acpi_ec_gpe_handler);
+                       acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
                        return -ENODEV;
                }
        }
@@ -782,6 +825,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
+       acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
        if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
                                ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
                pr_err(PREFIX "failed to remove space handler\n");
@@ -1023,16 +1067,16 @@ error:
 static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state)
 {
        struct acpi_ec *ec = acpi_driver_data(device);
-       /* Stop using GPE */
-       acpi_disable_gpe(NULL, ec->gpe);
+       /* Stop using the GPE, but keep it reference counted. */
+       acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
        return 0;
 }
 
 static int acpi_ec_resume(struct acpi_device *device)
 {
        struct acpi_ec *ec = acpi_driver_data(device);
-       /* Enable use of GPE back */
-       acpi_enable_gpe(NULL, ec->gpe);
+       /* Enable the GPE again, but don't reference count it once more. */
+       acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
        return 0;
 }
 
index cb28e0502acc346af5233ebeaa195b723a995713..9c4c962e46e366046921526d50bce2fe60cfd545 100644 (file)
@@ -36,8 +36,6 @@ static inline int acpi_debug_init(void) { return 0; }
 int acpi_power_init(void);
 int acpi_device_sleep_wake(struct acpi_device *dev,
                            int enable, int sleep_state, int dev_state);
-int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
-int acpi_disable_wakeup_device_power(struct acpi_device *dev);
 int acpi_power_get_inferred_state(struct acpi_device *device);
 int acpi_power_transition(struct acpi_device *device, int state);
 extern int acpi_power_nocheck;
index a5a77b78a7237cbbb6e77a707f73a0861426718d..2ef04098cc1d5f4d01942d3e4de79014c4911efe 100644 (file)
@@ -26,7 +26,9 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/pci-acpi.h>
 #include <linux/acpi.h>
+#include <linux/pm_runtime.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
@@ -38,7 +40,13 @@ static int acpi_pci_unbind(struct acpi_device *device)
        struct pci_dev *dev;
 
        dev = acpi_get_pci_dev(device->handle);
-       if (!dev || !dev->subordinate)
+       if (!dev)
+               goto out;
+
+       device_set_run_wake(&dev->dev, false);
+       pci_acpi_remove_pm_notifier(device);
+
+       if (!dev->subordinate)
                goto out;
 
        acpi_pci_irq_del_prt(dev->subordinate);
@@ -62,6 +70,10 @@ static int acpi_pci_bind(struct acpi_device *device)
        if (!dev)
                return 0;
 
+       pci_acpi_add_pm_notifier(device, dev);
+       if (device->wakeup.flags.run_wake)
+               device_set_run_wake(&dev->dev, true);
+
        /*
         * Install the 'bind' function to facilitate callbacks for
         * children of the P2P bridge.
index 394ae89409c2bdee53ddaf0f5045787bba6e3401..04b0f007c9b79e5d5708aeed1529069e85afb45e 100644 (file)
@@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link");
 static int acpi_pci_link_add(struct acpi_device *device);
 static int acpi_pci_link_remove(struct acpi_device *device, int type);
 
-static struct acpi_device_id link_device_ids[] = {
+static const struct acpi_device_id link_device_ids[] = {
        {"PNP0C0F", 0},
        {"", 0},
 };
index 101cce3681d1ea198d1e0575f428cdab2923d46c..d724736d56c8e0f25345d28c50f8b76295f4bfaa 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
 #include <linux/pm.h>
+#include <linux/pm_runtime.h>
 #include <linux/pci.h>
 #include <linux/pci-acpi.h>
 #include <linux/acpi.h>
@@ -46,7 +47,7 @@ static int acpi_pci_root_add(struct acpi_device *device);
 static int acpi_pci_root_remove(struct acpi_device *device, int type);
 static int acpi_pci_root_start(struct acpi_device *device);
 
-static struct acpi_device_id root_device_ids[] = {
+static const struct acpi_device_id root_device_ids[] = {
        {"PNP0A03", 0},
        {"", 0},
 };
@@ -528,6 +529,10 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
        if (flags != base_flags)
                acpi_pci_osc_support(root, flags);
 
+       pci_acpi_add_bus_pm_notifier(device, root->bus);
+       if (device->wakeup.flags.run_wake)
+               device_set_run_wake(root->bus->bridge, true);
+
        return 0;
 
 end:
@@ -549,6 +554,9 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
 {
        struct acpi_pci_root *root = acpi_driver_data(device);
 
+       device_set_run_wake(root->bus->bridge, false);
+       pci_acpi_remove_bus_pm_notifier(device);
+
        kfree(root);
        return 0;
 }
@@ -558,6 +566,7 @@ static int __init acpi_pci_root_init(void)
        if (acpi_pci_disabled)
                return 0;
 
+       pci_acpi_crs_quirks();
        if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
                return -ENODEV;
 
index 22b297916519d5fe6580c986cfe54b522aad5beb..0f30c3c1eea475b7e2c0bb247981903ba6e006b3 100644 (file)
@@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type);
 static int acpi_power_resume(struct acpi_device *device);
 static int acpi_power_open_fs(struct inode *inode, struct file *file);
 
-static struct acpi_device_id power_device_ids[] = {
+static const struct acpi_device_id power_device_ids[] = {
        {ACPI_POWER_HID, 0},
        {"", 0},
 };
index 2ef7030a0c28b7d428de422d6cda082a36ec8723..dc4ffadf81220a2541f68f773514d430491b75b7 100644 (file)
@@ -64,7 +64,7 @@ static int can_cap_in_hardware(void)
        return force_cap_on || cap_in_hardware;
 }
 
-static struct acpi_device_id power_meter_ids[] = {
+static const struct acpi_device_id power_meter_ids[] = {
        {"ACPI000D", 0},
        {"", 0},
 };
@@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource)
 
        kfree(resource->domain_devices);
        kobject_put(resource->holders_dir);
+       resource->num_domain_devices = 0;
 }
 
 static int read_domain_devices(struct acpi_power_meter_resource *resource)
@@ -740,7 +741,6 @@ skip_unsafe_cap:
 
        return res;
 error:
-       remove_domain_devices(resource);
        remove_attrs(resource);
        return res;
 }
index d1676b1754d92d19a2f5b67aa6a5f29b0c2e536f..cc978a8c00b797d6c5e9d4300a857a7fa612d6ea 100644 (file)
@@ -110,6 +110,14 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = {
          DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
          DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
         (void *)2},
+       { set_max_cstate, "Pavilion zv5000", {
+         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+         DMI_MATCH(DMI_PRODUCT_NAME,"Pavilion zv5000 (DS502A#ABA)")},
+        (void *)1},
+       { set_max_cstate, "Asus L8400B", {
+         DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
+         DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")},
+        (void *)1},
        {},
 };
 
@@ -305,6 +313,28 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
        pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency;
        pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency;
 
+       /*
+        * FADT specified C2 latency must be less than or equal to
+        * 100 microseconds.
+        */
+       if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                       "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency));
+               /* invalidate C2 */
+               pr->power.states[ACPI_STATE_C2].address = 0;
+       }
+
+       /*
+        * FADT supplied C3 latency must be less than or equal to
+        * 1000 microseconds.
+        */
+       if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                       "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency));
+               /* invalidate C3 */
+               pr->power.states[ACPI_STATE_C3].address = 0;
+       }
+
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                          "lvl2[0x%08x] lvl3[0x%08x]\n",
                          pr->power.states[ACPI_STATE_C2].address,
@@ -494,33 +524,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
        return status;
 }
 
-static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
-{
-
-       if (!cx->address)
-               return;
-
-       /*
-        * C2 latency must be less than or equal to 100
-        * microseconds.
-        */
-       else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "latency too large [%d]\n", cx->latency));
-               return;
-       }
-
-       /*
-        * Otherwise we've met all of our C2 requirements.
-        * Normalize the C2 latency to expidite policy
-        */
-       cx->valid = 1;
-
-       cx->latency_ticks = cx->latency;
-
-       return;
-}
-
 static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
                                           struct acpi_processor_cx *cx)
 {
@@ -531,16 +534,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
        if (!cx->address)
                return;
 
-       /*
-        * C3 latency must be less than or equal to 1000
-        * microseconds.
-        */
-       else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "latency too large [%d]\n", cx->latency));
-               return;
-       }
-
        /*
         * PIIX4 Erratum #18: We don't support C3 when Type-F (fast)
         * DMA transfers are used by any ISA device to avoid livelock.
@@ -629,7 +622,10 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
                        break;
 
                case ACPI_STATE_C2:
-                       acpi_processor_power_verify_c2(cx);
+                       if (!cx->address)
+                               break;
+                       cx->valid = 1; 
+                       cx->latency_ticks = cx->latency; /* Normalize latency */
                        break;
 
                case ACPI_STATE_C3:
@@ -884,12 +880,14 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
                return(acpi_idle_enter_c1(dev, state));
 
        local_irq_disable();
-       current_thread_info()->status &= ~TS_POLLING;
-       /*
-        * TS_POLLING-cleared state must be visible before we test
-        * NEED_RESCHED:
-        */
-       smp_mb();
+       if (cx->entry_method != ACPI_CSTATE_FFH) {
+               current_thread_info()->status &= ~TS_POLLING;
+               /*
+                * TS_POLLING-cleared state must be visible before we test
+                * NEED_RESCHED:
+                */
+               smp_mb();
+       }
 
        if (unlikely(need_resched())) {
                current_thread_info()->status |= TS_POLLING;
@@ -969,12 +967,14 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
        }
 
        local_irq_disable();
-       current_thread_info()->status &= ~TS_POLLING;
-       /*
-        * TS_POLLING-cleared state must be visible before we test
-        * NEED_RESCHED:
-        */
-       smp_mb();
+       if (cx->entry_method != ACPI_CSTATE_FFH) {
+               current_thread_info()->status &= ~TS_POLLING;
+               /*
+                * TS_POLLING-cleared state must be visible before we test
+                * NEED_RESCHED:
+                */
+               smp_mb();
+       }
 
        if (unlikely(need_resched())) {
                current_thread_info()->status |= TS_POLLING;
index 30e4dc0cdf305fb3df0e0d7bf75830b74be79a76..e306ba9aa34e6bd0c50a4311474e4855453884fb 100644 (file)
@@ -125,6 +125,8 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
        return status;
 }
 
+static int early_pdc_done;
+
 void acpi_processor_set_pdc(acpi_handle handle)
 {
        struct acpi_object_list *obj_list;
@@ -132,6 +134,9 @@ void acpi_processor_set_pdc(acpi_handle handle)
        if (arch_has_acpi_pdc() == false)
                return;
 
+       if (early_pdc_done)
+               return;
+
        obj_list = acpi_processor_alloc_pdc();
        if (!obj_list)
                return;
@@ -144,6 +149,36 @@ void acpi_processor_set_pdc(acpi_handle handle)
 }
 EXPORT_SYMBOL_GPL(acpi_processor_set_pdc);
 
+static int early_pdc_optin;
+static int set_early_pdc_optin(const struct dmi_system_id *id)
+{
+       early_pdc_optin = 1;
+       return 0;
+}
+
+static int param_early_pdc_optin(char *s)
+{
+       early_pdc_optin = 1;
+       return 1;
+}
+__setup("acpi_early_pdc_eval", param_early_pdc_optin);
+
+static struct dmi_system_id __cpuinitdata early_pdc_optin_table[] = {
+       {
+       set_early_pdc_optin, "HP Envy", {
+       DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"),
+       DMI_MATCH(DMI_PRODUCT_NAME, "HP Envy") }, NULL},
+       {
+       set_early_pdc_optin, "HP Pavilion dv6", {
+       DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"),
+       DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6") }, NULL},
+       {
+       set_early_pdc_optin, "HP Pavilion dv7", {
+       DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"),
+       DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7") }, NULL},
+       {},
+};
+
 static acpi_status
 early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
@@ -151,7 +186,7 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
        return AE_OK;
 }
 
-void acpi_early_processor_set_pdc(void)
+void __init acpi_early_processor_set_pdc(void)
 {
        /*
         * Check whether the system is DMI table. If yes, OSPM
@@ -159,7 +194,16 @@ void acpi_early_processor_set_pdc(void)
         */
        dmi_check_system(processor_idle_dmi_table);
 
+       /*
+        * Allow systems to opt-in to early _PDC evaluation.
+        */
+       dmi_check_system(early_pdc_optin_table);
+       if (!early_pdc_optin)
+               return;
+
        acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
                            ACPI_UINT32_MAX,
                            early_init_pdc, NULL, NULL, NULL);
+
+       early_pdc_done = 1;
 }
index 2cabadcc4d8c36806bc886080a6c0cae3d50dd04..a959f6a075083153580902746aabb8f178d425f4 100644 (file)
@@ -413,7 +413,11 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
        if (result)
                goto update_bios;
 
-       return 0;
+       /* We need to call _PPC once when cpufreq starts */
+       if (ignore_ppc != 1)
+               result = acpi_processor_get_platform_limit(pr);
+
+       return result;
 
        /*
         * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that
index 140c5c5b423c6361fabb3535e362eb9c18e71fb3..6deafb4aa0da02c44e3e4c1ded6d46c105a22012 100644 (file)
@@ -443,8 +443,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = {
 #ifdef CONFIG_ACPI_PROCFS
 static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
-
+       struct acpi_processor *pr = seq->private;
 
        if (!pr)
                goto end;
index 52b9db8afc20296ba11ec32ec7a10f5041f653dc..b16ddbf23a9c71115aba72e07959889a0e0958df 100644 (file)
@@ -822,7 +822,10 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
 
 static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
 {
+#if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER)
        struct acpi_battery *battery = &sbs->battery[id];
+#endif
+
 #ifdef CONFIG_ACPI_SYSFS_POWER
        if (battery->bat.dev) {
                if (battery->have_sysfs_alarm)
index d9339806df45d86da6fcf2a3713edb070d8b0c45..fd09229282eaccd8dda3ccde049b417814c3ad29 100644 (file)
@@ -242,7 +242,7 @@ static int smbus_alarm(void *context)
                case ACPI_SBS_CHARGER:
                case ACPI_SBS_MANAGER:
                case ACPI_SBS_BATTERY:
-                       acpi_os_execute(OSL_GPE_HANDLER,
+                       acpi_os_execute(OSL_NOTIFY_HANDLER,
                                        acpi_smbus_callback, hc);
                default:;
        }
index ff9f6226085d04638bc3777e2c06bcba9686e09c..fb7fc24fe72725817ee38e970dc9b90f07998522 100644 (file)
@@ -741,19 +741,40 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device,
        return AE_OK;
 }
 
-static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
+static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
 {
-       acpi_status status = 0;
-       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-       union acpi_object *package = NULL;
-       int psw_error;
-
        struct acpi_device_id button_device_ids[] = {
                {"PNP0C0D", 0},
                {"PNP0C0C", 0},
                {"PNP0C0E", 0},
                {"", 0},
        };
+       acpi_status status;
+       acpi_event_status event_status;
+
+       device->wakeup.run_wake_count = 0;
+       device->wakeup.flags.notifier_present = 0;
+
+       /* Power button, Lid switch always enable wakeup */
+       if (!acpi_match_device_ids(device, button_device_ids)) {
+               device->wakeup.flags.run_wake = 1;
+               device->wakeup.flags.always_enabled = 1;
+               return;
+       }
+
+       status = acpi_get_gpe_status(NULL, device->wakeup.gpe_number,
+                                       ACPI_NOT_ISR, &event_status);
+       if (status == AE_OK)
+               device->wakeup.flags.run_wake =
+                               !!(event_status & ACPI_EVENT_FLAG_HANDLE);
+}
+
+static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
+{
+       acpi_status status = 0;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *package = NULL;
+       int psw_error;
 
        /* _PRW */
        status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
@@ -773,6 +794,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
 
        device->wakeup.flags.valid = 1;
        device->wakeup.prepare_count = 0;
+       acpi_bus_set_run_wake_flags(device);
        /* Call _PSW/_DSW object to disable its ability to wake the sleeping
         * system for the ACPI device with the _PRW object.
         * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW.
@@ -784,10 +806,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                "error in _DSW or _PSW evaluation\n"));
 
-       /* Power button, Lid switch always enable wakeup */
-       if (!acpi_match_device_ids(device, button_device_ids))
-               device->wakeup.flags.run_wake = 1;
-
 end:
        if (ACPI_FAILURE(status))
                device->flags.wake_capable = 0;
@@ -1336,9 +1354,25 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops,
 
        if (child)
                *child = device;
-       return 0;
+
+       if (device)
+               return 0;
+       else
+               return -ENODEV;
 }
 
+/*
+ * acpi_bus_add and acpi_bus_start
+ *
+ * scan a given ACPI tree and (probably recently hot-plugged)
+ * create and add or starts found devices.
+ *
+ * If no devices were found -ENODEV is returned which does not
+ * mean that this is a real error, there just have been no suitable
+ * ACPI objects in the table trunk from which the kernel could create
+ * a device and add/start an appropriate driver.
+ */
+
 int
 acpi_bus_add(struct acpi_device **child,
             struct acpi_device *parent, acpi_handle handle, int type)
@@ -1348,8 +1382,7 @@ acpi_bus_add(struct acpi_device **child,
        memset(&ops, 0, sizeof(ops));
        ops.acpi_op_add = 1;
 
-       acpi_bus_scan(handle, &ops, child);
-       return 0;
+       return acpi_bus_scan(handle, &ops, child);
 }
 EXPORT_SYMBOL(acpi_bus_add);
 
@@ -1357,11 +1390,13 @@ int acpi_bus_start(struct acpi_device *device)
 {
        struct acpi_bus_ops ops;
 
+       if (!device)
+               return -EINVAL;
+
        memset(&ops, 0, sizeof(ops));
        ops.acpi_op_start = 1;
 
-       acpi_bus_scan(device->handle, &ops, NULL);
-       return 0;
+       return acpi_bus_scan(device->handle, &ops, NULL);
 }
 EXPORT_SYMBOL(acpi_bus_start);
 
index 79d33d908b5a1d2dc586a6536107ffea393c467d..3bde594a997986ce5d4056aef075d9cf19e45bff 100644 (file)
@@ -745,9 +745,18 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
                return -ENODEV;
        }
 
-       error = enable ?
-               acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
-               acpi_disable_wakeup_device_power(adev);
+       if (enable) {
+               error = acpi_enable_wakeup_device_power(adev,
+                                               acpi_target_sleep_state);
+               if (!error)
+                       acpi_enable_gpe(adev->wakeup.gpe_device,
+                                       adev->wakeup.gpe_number,
+                                       ACPI_GPE_TYPE_WAKE);
+       } else {
+               acpi_disable_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE);
+               error = acpi_disable_wakeup_device_power(adev);
+       }
        if (!error)
                dev_info(dev, "wake-up capability %s by ACPI\n",
                                enable ? "enabled" : "disabled");
index d11282975f353a277863ea6315a5b31a8447e07d..a206a12da78ab04fc6951a89287a92096689aa18 100644 (file)
@@ -387,10 +387,10 @@ static ssize_t counter_set(struct kobject *kobj,
        if (index < num_gpes) {
                if (!strcmp(buf, "disable\n") &&
                                (status & ACPI_EVENT_FLAG_ENABLED))
-                       result = acpi_disable_gpe(handle, index);
+                       result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE);
                else if (!strcmp(buf, "enable\n") &&
                                !(status & ACPI_EVENT_FLAG_ENABLED))
-                       result = acpi_enable_gpe(handle, index);
+                       result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE);
                else if (!strcmp(buf, "clear\n") &&
                                (status & ACPI_EVENT_FLAG_SET))
                        result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR);
index f336bca7c4503ec1d03d7741ee8185afae942381..8a0ed2800e6359a49f781b41d2afc44cd183225b 100644 (file)
@@ -213,7 +213,7 @@ acpi_table_parse_entries(char *id,
        unsigned long table_end;
        acpi_size tbl_size;
 
-       if (acpi_disabled)
+       if (acpi_disabled && !acpi_ht)
                return -ENODEV;
 
        if (!handler)
@@ -280,7 +280,7 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
        struct acpi_table_header *table = NULL;
        acpi_size tbl_size;
 
-       if (acpi_disabled)
+       if (acpi_disabled && !acpi_ht)
                return -ENODEV;
 
        if (!handler)
index 72e76b4b6538f2da73ca4b9060e3cf12ce1808fc..b765790b32be1841d652d3e834c6013950700efc 100644 (file)
@@ -78,6 +78,13 @@ MODULE_LICENSE("GPL");
 static int brightness_switch_enabled = 1;
 module_param(brightness_switch_enabled, bool, 0644);
 
+/*
+ * By default, we don't allow duplicate ACPI video bus devices
+ * under the same VGA controller
+ */
+static int allow_duplicates;
+module_param(allow_duplicates, bool, 0644);
+
 static int register_count = 0;
 static int acpi_video_bus_add(struct acpi_device *device);
 static int acpi_video_bus_remove(struct acpi_device *device, int type);
@@ -2239,11 +2246,47 @@ static int acpi_video_resume(struct acpi_device *device)
        return AE_OK;
 }
 
+static acpi_status
+acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
+                       void **return_value)
+{
+       struct acpi_device *device = context;
+       struct acpi_device *sibling;
+       int result;
+
+       if (handle == device->handle)
+               return AE_CTRL_TERMINATE;
+
+       result = acpi_bus_get_device(handle, &sibling);
+       if (result)
+               return AE_OK;
+
+       if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME))
+                       return AE_ALREADY_EXISTS;
+
+       return AE_OK;
+}
+
 static int acpi_video_bus_add(struct acpi_device *device)
 {
        struct acpi_video_bus *video;
        struct input_dev *input;
        int error;
+       acpi_status status;
+
+       status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
+                               device->parent->handle, 1,
+                               acpi_video_bus_match, NULL,
+                               device, NULL);
+       if (status == AE_ALREADY_EXISTS) {
+               printk(KERN_WARNING FW_BUG
+                       "Duplicate ACPI video bus devices for the"
+                       " same VGA controller, please try module "
+                       "parameter \"video.allow_duplicates=1\""
+                       "if the current driver doesn't work.\n");
+               if (!allow_duplicates)
+                       return -ENODEV;
+       }
 
        video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
        if (!video)
index e0ee0c036f5a674a882f190a4f8812989bfd276a..4b9d339a6e28875e7eb7eaa942859bc7207d799b 100644 (file)
 ACPI_MODULE_NAME("wakeup_devices")
 
 /**
- * acpi_enable_wakeup_device_prep - prepare wakeup devices
- *     @sleep_state:   ACPI state
- * Enable all wakup devices power if the devices' wakeup level
- * is higher than requested sleep level
+ * acpi_enable_wakeup_device_prep - Prepare wake-up devices.
+ * @sleep_state: ACPI system sleep state.
+ *
+ * Enable all wake-up devices' power, unless the requested system sleep state is
+ * too deep.
  */
-
 void acpi_enable_wakeup_device_prep(u8 sleep_state)
 {
        struct list_head *node, *next;
@@ -36,9 +36,8 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state)
                                                       struct acpi_device,
                                                       wakeup_list);
 
-               if (!dev->wakeup.flags.valid ||
-                   !dev->wakeup.state.enabled ||
-                   (sleep_state > (u32) dev->wakeup.sleep_state))
+               if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
+                   || (sleep_state > (u32) dev->wakeup.sleep_state))
                        continue;
 
                acpi_enable_wakeup_device_power(dev, sleep_state);
@@ -46,9 +45,12 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state)
 }
 
 /**
- * acpi_enable_wakeup_device - enable wakeup devices
- *     @sleep_state:   ACPI state
- * Enable all wakup devices's GPE
+ * acpi_enable_wakeup_device - Enable wake-up device GPEs.
+ * @sleep_state: ACPI system sleep state.
+ *
+ * Enable all wake-up devices' GPEs, with the assumption that
+ * acpi_disable_all_gpes() was executed before, so we don't need to disable any
+ * GPEs here.
  */
 void acpi_enable_wakeup_device(u8 sleep_state)
 {
@@ -65,29 +67,22 @@ void acpi_enable_wakeup_device(u8 sleep_state)
                if (!dev->wakeup.flags.valid)
                        continue;
 
-               /* If users want to disable run-wake GPE,
-                * we only disable it for wake and leave it for runtime
-                */
                if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count)
-                   || sleep_state > (u32) dev->wakeup.sleep_state) {
-                       if (dev->wakeup.flags.run_wake) {
-                               /* set_gpe_type will disable GPE, leave it like that */
-                               acpi_set_gpe_type(dev->wakeup.gpe_device,
-                                                 dev->wakeup.gpe_number,
-                                                 ACPI_GPE_TYPE_RUNTIME);
-                       }
+                   || sleep_state > (u32) dev->wakeup.sleep_state)
                        continue;
-               }
-               if (!dev->wakeup.flags.run_wake)
-                       acpi_enable_gpe(dev->wakeup.gpe_device,
-                                       dev->wakeup.gpe_number);
+
+               /* The wake-up power should have been enabled already. */
+               acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
+                               ACPI_GPE_ENABLE);
        }
 }
 
 /**
- * acpi_disable_wakeup_device - disable devices' wakeup capability
- *     @sleep_state:   ACPI state
- * Disable all wakup devices's GPE and wakeup capability
+ * acpi_disable_wakeup_device - Disable devices' wakeup capability.
+ * @sleep_state: ACPI system sleep state.
+ *
+ * This function only affects devices with wakeup.state.enabled set, which means
+ * that it reverses the changes made by acpi_enable_wakeup_device_prep().
  */
 void acpi_disable_wakeup_device(u8 sleep_state)
 {
@@ -97,30 +92,11 @@ void acpi_disable_wakeup_device(u8 sleep_state)
                struct acpi_device *dev =
                        container_of(node, struct acpi_device, wakeup_list);
 
-               if (!dev->wakeup.flags.valid)
-                       continue;
-
-               if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count)
-                   || sleep_state > (u32) dev->wakeup.sleep_state) {
-                       if (dev->wakeup.flags.run_wake) {
-                               acpi_set_gpe_type(dev->wakeup.gpe_device,
-                                                 dev->wakeup.gpe_number,
-                                                 ACPI_GPE_TYPE_WAKE_RUN);
-                               /* Re-enable it, since set_gpe_type will disable it */
-                               acpi_enable_gpe(dev->wakeup.gpe_device,
-                                               dev->wakeup.gpe_number);
-                       }
+               if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
+                   || (sleep_state > (u32) dev->wakeup.sleep_state))
                        continue;
-               }
 
                acpi_disable_wakeup_device_power(dev);
-               /* Never disable run-wake GPE */
-               if (!dev->wakeup.flags.run_wake) {
-                       acpi_disable_gpe(dev->wakeup.gpe_device,
-                                        dev->wakeup.gpe_number);
-                       acpi_clear_gpe(dev->wakeup.gpe_device,
-                                      dev->wakeup.gpe_number, ACPI_NOT_ISR);
-               }
        }
 }
 
@@ -134,13 +110,11 @@ int __init acpi_wakeup_device_init(void)
                                                       struct acpi_device,
                                                       wakeup_list);
                /* In case user doesn't load button driver */
-               if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled)
+               if (!dev->wakeup.flags.always_enabled ||
+                   dev->wakeup.state.enabled)
                        continue;
-               acpi_set_gpe_type(dev->wakeup.gpe_device,
-                                 dev->wakeup.gpe_number,
-                                 ACPI_GPE_TYPE_WAKE_RUN);
-               acpi_enable_gpe(dev->wakeup.gpe_device,
-                               dev->wakeup.gpe_number);
+               acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE);
                dev->wakeup.state.enabled = 1;
        }
        mutex_unlock(&acpi_device_lock);
index b8bea100a160439516b3ebbf662dfd7f0b690a2d..a6a736a7dbf2ea1bbe09dd5afae1dd37d44ded55 100644 (file)
@@ -2868,6 +2868,21 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
                        },
                        .driver_data = "F.23",  /* cutoff BIOS version */
                },
+               /*
+                * Acer eMachines G725 has the same problem.  BIOS
+                * V1.03 is known to be broken.  V3.04 is known to
+                * work.  Inbetween, there are V1.06, V2.06 and V3.03
+                * that we don't have much idea about.  For now,
+                * blacklist anything older than V3.04.
+                */
+               {
+                       .ident = "G725",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "eMachines"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "eMachines G725"),
+                       },
+                       .driver_data = "V3.04", /* cutoff BIOS version */
+               },
                { }     /* terminate list */
        };
        const struct dmi_system_id *dmi = dmi_first_match(sysids);
@@ -3067,8 +3082,16 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        ahci_save_initial_config(pdev, hpriv);
 
        /* prepare host */
-       if (hpriv->cap & HOST_CAP_NCQ)
-               pi.flags |= ATA_FLAG_NCQ | ATA_FLAG_FPDMA_AA;
+       if (hpriv->cap & HOST_CAP_NCQ) {
+               pi.flags |= ATA_FLAG_NCQ;
+               /* Auto-activate optimization is supposed to be supported on
+                  all AHCI controllers indicating NCQ support, but it seems
+                  to be broken at least on some NVIDIA MCP79 chipsets.
+                  Until we get info on which NVIDIA chipsets don't have this
+                  issue, if any, disable AA on all NVIDIA AHCIs. */
+               if (pdev->vendor != PCI_VENDOR_ID_NVIDIA)
+                       pi.flags |= ATA_FLAG_FPDMA_AA;
+       }
 
        if (hpriv->cap & HOST_CAP_PMP)
                pi.flags |= ATA_FLAG_PMP;
index 0ea97c942ceda3485670021b18b9721802949391..9f6cfac0f2cce6ac50bf8ca2262326cad5c21201 100644 (file)
@@ -2028,8 +2028,9 @@ static void ata_eh_link_autopsy(struct ata_link *link)
                        qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
 
                /* determine whether the command is worth retrying */
-               if (!(qc->err_mask & AC_ERR_INVALID) &&
-                   ((qc->flags & ATA_QCFLAG_IO) || qc->err_mask != AC_ERR_DEV))
+               if (qc->flags & ATA_QCFLAG_IO ||
+                   (!(qc->err_mask & AC_ERR_INVALID) &&
+                    qc->err_mask != AC_ERR_DEV))
                        qc->flags |= ATA_QCFLAG_RETRY;
 
                /* accumulate error info */
index f4ea5a8c325bf5a618450b37ae229f603c30c8de..d096fbcbc771a61a0537e28842d04f1149dcc7a7 100644 (file)
@@ -2875,7 +2875,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
         * write indication (used for PIO/DMA setup), result TF is
         * copied back and we don't whine too much about its failure.
         */
-       tf->flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+       tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
        if (scmd->sc_data_direction == DMA_TO_DEVICE)
                tf->flags |= ATA_TFLAG_WRITE;
 
index 741065c9da6700245a2ddb70f19908e3589f85c1..730ef3c384ca190818857c89ab044006dccfe75d 100644 (file)
@@ -893,6 +893,9 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
                                       do_write);
        }
 
+       if (!do_write)
+               flush_dcache_page(page);
+
        qc->curbytes += qc->sect_size;
        qc->cursg_ofs += qc->sect_size;
 
index 161746deab4baabb00bebdf4fb0991bbdf693f7f..6e2c3b064f53759d9ea0e56cf43783ff0ecd1a39 100644 (file)
@@ -59,6 +59,8 @@ static void class_release(struct kobject *kobj)
        else
                pr_debug("class '%s' does not have a release() function, "
                         "be careful\n", class->name);
+
+       kfree(cp);
 }
 
 static struct sysfs_ops class_sysfs_ops = {
index 090dd4851301a802aed5b588f9dd7b49f8755158..42ae452b36b0c058376286882220ef25aff49c9e 100644 (file)
@@ -354,6 +354,7 @@ int __init devtmpfs_init(void)
 {
        int err;
        struct vfsmount *mnt;
+       char options[] = "mode=0755";
 
        err = register_filesystem(&dev_fs_type);
        if (err) {
@@ -362,7 +363,7 @@ int __init devtmpfs_init(void)
                return err;
        }
 
-       mnt = kern_mount_data(&dev_fs_type, "mode=0755");
+       mnt = kern_mount_data(&dev_fs_type, options);
        if (IS_ERR(mnt)) {
                err = PTR_ERR(mnt);
                printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err);
index d7d77d4a402cf14ca90e1a034aada06c3351bc3b..bd025059711fb2220b985ea05410a82fb41b65c2 100644 (file)
@@ -311,7 +311,7 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL);
 static ssize_t
 print_block_size(struct class *class, char *buf)
 {
-       return sprintf(buf, "%lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
+       return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
 }
 
 static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL);
index a5142bddef412e079c3083dec37ffeb82c163cd5..0e26a6f6fd48193e5c5fd3cec6a20269a4a5ddc9 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/resume-trace.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
+#include <linux/async.h>
 
 #include "../base.h"
 #include "power.h"
@@ -42,6 +43,7 @@
 LIST_HEAD(dpm_list);
 
 static DEFINE_MUTEX(dpm_list_mtx);
+static pm_message_t pm_transition;
 
 /*
  * Set once the preparation of devices for a PM transition has started, reset
@@ -56,6 +58,7 @@ static bool transition_started;
 void device_pm_init(struct device *dev)
 {
        dev->power.status = DPM_ON;
+       init_completion(&dev->power.completion);
        pm_runtime_init(dev);
 }
 
@@ -111,6 +114,7 @@ void device_pm_remove(struct device *dev)
        pr_debug("PM: Removing info for %s:%s\n",
                 dev->bus ? dev->bus->name : "No Bus",
                 kobject_name(&dev->kobj));
+       complete_all(&dev->power.completion);
        mutex_lock(&dpm_list_mtx);
        list_del_init(&dev->power.entry);
        mutex_unlock(&dpm_list_mtx);
@@ -187,6 +191,31 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
        }
 }
 
+/**
+ * dpm_wait - Wait for a PM operation to complete.
+ * @dev: Device to wait for.
+ * @async: If unset, wait only if the device's power.async_suspend flag is set.
+ */
+static void dpm_wait(struct device *dev, bool async)
+{
+       if (!dev)
+               return;
+
+       if (async || (pm_async_enabled && dev->power.async_suspend))
+               wait_for_completion(&dev->power.completion);
+}
+
+static int dpm_wait_fn(struct device *dev, void *async_ptr)
+{
+       dpm_wait(dev, *((bool *)async_ptr));
+       return 0;
+}
+
+static void dpm_wait_for_children(struct device *dev, bool async)
+{
+       device_for_each_child(dev, &async, dpm_wait_fn);
+}
+
 /**
  * pm_op - Execute the PM operation appropriate for given PM event.
  * @dev: Device to handle.
@@ -271,8 +300,9 @@ static int pm_noirq_op(struct device *dev,
        ktime_t calltime, delta, rettime;
 
        if (initcall_debug) {
-               pr_info("calling  %s_i+ @ %i\n",
-                               dev_name(dev), task_pid_nr(current));
+               pr_info("calling  %s+ @ %i, parent: %s\n",
+                               dev_name(dev), task_pid_nr(current),
+                               dev->parent ? dev_name(dev->parent) : "none");
                calltime = ktime_get();
        }
 
@@ -468,16 +498,20 @@ static int legacy_resume(struct device *dev, int (*cb)(struct device *dev))
  * device_resume - Execute "resume" callbacks for given device.
  * @dev: Device to handle.
  * @state: PM transition of the system being carried out.
+ * @async: If true, the device is being resumed asynchronously.
  */
-static int device_resume(struct device *dev, pm_message_t state)
+static int device_resume(struct device *dev, pm_message_t state, bool async)
 {
        int error = 0;
 
        TRACE_DEVICE(dev);
        TRACE_RESUME(0);
 
+       dpm_wait(dev->parent, async);
        down(&dev->sem);
 
+       dev->power.status = DPM_RESUMING;
+
        if (dev->bus) {
                if (dev->bus->pm) {
                        pm_dev_dbg(dev, state, "");
@@ -510,11 +544,29 @@ static int device_resume(struct device *dev, pm_message_t state)
        }
  End:
        up(&dev->sem);
+       complete_all(&dev->power.completion);
 
        TRACE_RESUME(error);
        return error;
 }
 
+static void async_resume(void *data, async_cookie_t cookie)
+{
+       struct device *dev = (struct device *)data;
+       int error;
+
+       error = device_resume(dev, pm_transition, true);
+       if (error)
+               pm_dev_err(dev, pm_transition, " async", error);
+       put_device(dev);
+}
+
+static bool is_async(struct device *dev)
+{
+       return dev->power.async_suspend && pm_async_enabled
+               && !pm_trace_is_enabled();
+}
+
 /**
  * dpm_resume - Execute "resume" callbacks for non-sysdev devices.
  * @state: PM transition of the system being carried out.
@@ -525,21 +577,33 @@ static int device_resume(struct device *dev, pm_message_t state)
 static void dpm_resume(pm_message_t state)
 {
        struct list_head list;
+       struct device *dev;
        ktime_t starttime = ktime_get();
 
        INIT_LIST_HEAD(&list);
        mutex_lock(&dpm_list_mtx);
-       while (!list_empty(&dpm_list)) {
-               struct device *dev = to_device(dpm_list.next);
+       pm_transition = state;
+
+       list_for_each_entry(dev, &dpm_list, power.entry) {
+               if (dev->power.status < DPM_OFF)
+                       continue;
+
+               INIT_COMPLETION(dev->power.completion);
+               if (is_async(dev)) {
+                       get_device(dev);
+                       async_schedule(async_resume, dev);
+               }
+       }
 
+       while (!list_empty(&dpm_list)) {
+               dev = to_device(dpm_list.next);
                get_device(dev);
-               if (dev->power.status >= DPM_OFF) {
+               if (dev->power.status >= DPM_OFF && !is_async(dev)) {
                        int error;
 
-                       dev->power.status = DPM_RESUMING;
                        mutex_unlock(&dpm_list_mtx);
 
-                       error = device_resume(dev, state);
+                       error = device_resume(dev, state, false);
 
                        mutex_lock(&dpm_list_mtx);
                        if (error)
@@ -554,6 +618,7 @@ static void dpm_resume(pm_message_t state)
        }
        list_splice(&list, &dpm_list);
        mutex_unlock(&dpm_list_mtx);
+       async_synchronize_full();
        dpm_show_time(starttime, state, NULL);
 }
 
@@ -731,17 +796,24 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
        return error;
 }
 
+static int async_error;
+
 /**
  * device_suspend - Execute "suspend" callbacks for given device.
  * @dev: Device to handle.
  * @state: PM transition of the system being carried out.
+ * @async: If true, the device is being suspended asynchronously.
  */
-static int device_suspend(struct device *dev, pm_message_t state)
+static int __device_suspend(struct device *dev, pm_message_t state, bool async)
 {
        int error = 0;
 
+       dpm_wait_for_children(dev, async);
        down(&dev->sem);
 
+       if (async_error)
+               goto End;
+
        if (dev->class) {
                if (dev->class->pm) {
                        pm_dev_dbg(dev, state, "class ");
@@ -772,12 +844,44 @@ static int device_suspend(struct device *dev, pm_message_t state)
                        error = legacy_suspend(dev, state, dev->bus->suspend);
                }
        }
+
+       if (!error)
+               dev->power.status = DPM_OFF;
+
  End:
        up(&dev->sem);
+       complete_all(&dev->power.completion);
 
        return error;
 }
 
+static void async_suspend(void *data, async_cookie_t cookie)
+{
+       struct device *dev = (struct device *)data;
+       int error;
+
+       error = __device_suspend(dev, pm_transition, true);
+       if (error) {
+               pm_dev_err(dev, pm_transition, " async", error);
+               async_error = error;
+       }
+
+       put_device(dev);
+}
+
+static int device_suspend(struct device *dev)
+{
+       INIT_COMPLETION(dev->power.completion);
+
+       if (pm_async_enabled && dev->power.async_suspend) {
+               get_device(dev);
+               async_schedule(async_suspend, dev);
+               return 0;
+       }
+
+       return __device_suspend(dev, pm_transition, false);
+}
+
 /**
  * dpm_suspend - Execute "suspend" callbacks for all non-sysdev devices.
  * @state: PM transition of the system being carried out.
@@ -790,13 +894,15 @@ static int dpm_suspend(pm_message_t state)
 
        INIT_LIST_HEAD(&list);
        mutex_lock(&dpm_list_mtx);
+       pm_transition = state;
+       async_error = 0;
        while (!list_empty(&dpm_list)) {
                struct device *dev = to_device(dpm_list.prev);
 
                get_device(dev);
                mutex_unlock(&dpm_list_mtx);
 
-               error = device_suspend(dev, state);
+               error = device_suspend(dev);
 
                mutex_lock(&dpm_list_mtx);
                if (error) {
@@ -804,13 +910,17 @@ static int dpm_suspend(pm_message_t state)
                        put_device(dev);
                        break;
                }
-               dev->power.status = DPM_OFF;
                if (!list_empty(&dev->power.entry))
                        list_move(&dev->power.entry, &list);
                put_device(dev);
+               if (async_error)
+                       break;
        }
        list_splice(&list, dpm_list.prev);
        mutex_unlock(&dpm_list_mtx);
+       async_synchronize_full();
+       if (!error)
+               error = async_error;
        if (!error)
                dpm_show_time(starttime, state, NULL);
        return error;
@@ -936,3 +1046,14 @@ void __suspend_report_result(const char *function, void *fn, int ret)
                printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
 }
 EXPORT_SYMBOL_GPL(__suspend_report_result);
+
+/**
+ * device_pm_wait_for_dev - Wait for suspend/resume of a device to complete.
+ * @dev: Device to wait for.
+ * @subordinate: Device that needs to wait for @dev.
+ */
+void device_pm_wait_for_dev(struct device *subordinate, struct device *dev)
+{
+       dpm_wait(dev, subordinate->power.async_suspend);
+}
+EXPORT_SYMBOL_GPL(device_pm_wait_for_dev);
index b8fa1aa5225a4a7baff8f1b8f83d46d644f82012..c0bd03c83b9cad1dbbb9341aa70f13e85b520760 100644 (file)
@@ -12,10 +12,10 @@ static inline void pm_runtime_remove(struct device *dev) {}
 
 #ifdef CONFIG_PM_SLEEP
 
-/*
- * main.c
- */
+/* kernel/power/main.c */
+extern int pm_async_enabled;
 
+/* drivers/base/power/main.c */
 extern struct list_head dpm_list;      /* The active device list */
 
 static inline struct device *to_device(struct list_head *entry)
index f8b044e8aef7f5e8683c9af1d6ec461d86d197f5..626dd147b75ffce582944d303430197213d61fcf 100644 (file)
@@ -1010,6 +1010,50 @@ void pm_runtime_enable(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(pm_runtime_enable);
 
+/**
+ * pm_runtime_forbid - Block run-time PM of a device.
+ * @dev: Device to handle.
+ *
+ * Increase the device's usage count and clear its power.runtime_auto flag,
+ * so that it cannot be suspended at run time until pm_runtime_allow() is called
+ * for it.
+ */
+void pm_runtime_forbid(struct device *dev)
+{
+       spin_lock_irq(&dev->power.lock);
+       if (!dev->power.runtime_auto)
+               goto out;
+
+       dev->power.runtime_auto = false;
+       atomic_inc(&dev->power.usage_count);
+       __pm_runtime_resume(dev, false);
+
+ out:
+       spin_unlock_irq(&dev->power.lock);
+}
+EXPORT_SYMBOL_GPL(pm_runtime_forbid);
+
+/**
+ * pm_runtime_allow - Unblock run-time PM of a device.
+ * @dev: Device to handle.
+ *
+ * Decrease the device's usage count and set its power.runtime_auto flag.
+ */
+void pm_runtime_allow(struct device *dev)
+{
+       spin_lock_irq(&dev->power.lock);
+       if (dev->power.runtime_auto)
+               goto out;
+
+       dev->power.runtime_auto = true;
+       if (atomic_dec_and_test(&dev->power.usage_count))
+               __pm_runtime_idle(dev);
+
+ out:
+       spin_unlock_irq(&dev->power.lock);
+}
+EXPORT_SYMBOL_GPL(pm_runtime_allow);
+
 /**
  * pm_runtime_init - Initialize run-time PM fields in given device object.
  * @dev: Device object to initialize.
@@ -1028,6 +1072,7 @@ void pm_runtime_init(struct device *dev)
 
        atomic_set(&dev->power.child_count, 0);
        pm_suspend_ignore_children(dev, false);
+       dev->power.runtime_auto = true;
 
        dev->power.request_pending = false;
        dev->power.request = RPM_REQ_NONE;
index 596aeecfdffe4be62c7e6773046e9c23d4dd37bb..86fd9373447e4761fe6b0a8f8c81110b99febc54 100644 (file)
@@ -4,9 +4,25 @@
 
 #include <linux/device.h>
 #include <linux/string.h>
+#include <linux/pm_runtime.h>
 #include "power.h"
 
 /*
+ *     control - Report/change current runtime PM setting of the device
+ *
+ *     Runtime power management of a device can be blocked with the help of
+ *     this attribute.  All devices have one of the following two values for
+ *     the power/control file:
+ *
+ *      + "auto\n" to allow the device to be power managed at run time;
+ *      + "on\n" to prevent the device from being power managed at run time;
+ *
+ *     The default for all devices is "auto", which means that devices may be
+ *     subject to automatic power management, depending on their drivers.
+ *     Changing this attribute to "on" prevents the driver from power managing
+ *     the device at run time.  Doing that while the device is suspended causes
+ *     it to be woken up.
+ *
  *     wakeup - Report/change current wakeup option for device
  *
  *     Some devices support "wakeup" events, which are hardware signals
  *     wakeup events internally (unless they are disabled), keeping
  *     their hardware in low power modes whenever they're unused.  This
  *     saves runtime power, without requiring system-wide sleep states.
+ *
+ *     async - Report/change current async suspend setting for the device
+ *
+ *     Asynchronous suspend and resume of the device during system-wide power
+ *     state transitions can be enabled by writing "enabled" to this file.
+ *     Analogously, if "disabled" is written to this file, the device will be
+ *     suspended and resumed synchronously.
+ *
+ *     All devices have one of the following two values for power/async:
+ *
+ *      + "enabled\n" to permit the asynchronous suspend/resume of the device;
+ *      + "disabled\n" to forbid it;
+ *
+ *     NOTE: It generally is unsafe to permit the asynchronous suspend/resume
+ *     of a device unless it is certain that all of the PM dependencies of the
+ *     device are known to the PM core.  However, for some devices this
+ *     attribute is set to "enabled" by bus type code or device drivers and in
+ *     that cases it should be safe to leave the default value.
  */
 
 static const char enabled[] = "enabled";
 static const char disabled[] = "disabled";
 
+#ifdef CONFIG_PM_RUNTIME
+static const char ctrl_auto[] = "auto";
+static const char ctrl_on[] = "on";
+
+static ssize_t control_show(struct device *dev, struct device_attribute *attr,
+                           char *buf)
+{
+       return sprintf(buf, "%s\n",
+                               dev->power.runtime_auto ? ctrl_auto : ctrl_on);
+}
+
+static ssize_t control_store(struct device * dev, struct device_attribute *attr,
+                            const char * buf, size_t n)
+{
+       char *cp;
+       int len = n;
+
+       cp = memchr(buf, '\n', n);
+       if (cp)
+               len = cp - buf;
+       if (len == sizeof ctrl_auto - 1 && strncmp(buf, ctrl_auto, len) == 0)
+               pm_runtime_allow(dev);
+       else if (len == sizeof ctrl_on - 1 && strncmp(buf, ctrl_on, len) == 0)
+               pm_runtime_forbid(dev);
+       else
+               return -EINVAL;
+       return n;
+}
+
+static DEVICE_ATTR(control, 0644, control_show, control_store);
+#endif
+
 static ssize_t
 wake_show(struct device * dev, struct device_attribute *attr, char * buf)
 {
@@ -77,9 +143,43 @@ wake_store(struct device * dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(wakeup, 0644, wake_show, wake_store);
 
+#ifdef CONFIG_PM_SLEEP_ADVANCED_DEBUG
+static ssize_t async_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       return sprintf(buf, "%s\n",
+                       device_async_suspend_enabled(dev) ? enabled : disabled);
+}
+
+static ssize_t async_store(struct device *dev, struct device_attribute *attr,
+                          const char *buf, size_t n)
+{
+       char *cp;
+       int len = n;
+
+       cp = memchr(buf, '\n', n);
+       if (cp)
+               len = cp - buf;
+       if (len == sizeof enabled - 1 && strncmp(buf, enabled, len) == 0)
+               device_enable_async_suspend(dev);
+       else if (len == sizeof disabled - 1 && strncmp(buf, disabled, len) == 0)
+               device_disable_async_suspend(dev);
+       else
+               return -EINVAL;
+       return n;
+}
+
+static DEVICE_ATTR(async, 0644, async_show, async_store);
+#endif /* CONFIG_PM_SLEEP_ADVANCED_DEBUG */
 
 static struct attribute * power_attrs[] = {
+#ifdef CONFIG_PM_RUNTIME
+       &dev_attr_control.attr,
+#endif
        &dev_attr_wakeup.attr,
+#ifdef CONFIG_PM_SLEEP_ADVANCED_DEBUG
+       &dev_attr_async.attr,
+#endif
        NULL,
 };
 static struct attribute_group pm_attr_group = {
index a5af1d6dda8bc37eb25b5127bffb80c4dfa04406..e35cf59cbfde3b0cef6ce6ddb98c3ae38dc47b7d 100644 (file)
@@ -1470,8 +1470,6 @@ repeat:
 
 void do_fd_request(struct request_queue * q)
 {
-       unsigned long flags;
-
        DPRINT(("do_fd_request for pid %d\n",current->pid));
        while( fdc_busy ) sleep_on( &fdc_wait );
        fdc_busy = 1;
index 873e594860d3571f1cd563791c2d970c506ca348..9291614ac6b7efd70adec484b6117c3de7b0974c 100644 (file)
@@ -337,6 +337,9 @@ static int cciss_seq_show(struct seq_file *seq, void *v)
        if (*pos > h->highest_lun)
                return 0;
 
+       if (drv == NULL) /* it's possible for h->drv[] to have holes. */
+               return 0;
+
        if (drv->heads == 0)
                return 0;
 
index f4acd04ebeefea86d3f68627a52a1bdff866db4c..df0983787390ca1c4b0d0f2c6a99c2c575bbc8d8 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected"
-       depends on !PROC_FS || !INET || !CONNECTOR
+       depends on PROC_FS='n' || INET='n' || CONNECTOR='n'
 
 config BLK_DEV_DRBD
        tristate "DRBD Distributed Replicated Block Device support"
index c9755876343088cb6e0c1ad74f06f8a4cac84f0f..2bf3a6ef3684396071f16ff044db1d5e537ee71b 100644 (file)
@@ -1275,7 +1275,7 @@ struct bm_extent {
 #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32
 #define DRBD_MAX_SECTORS      DRBD_MAX_SECTORS_BM
 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM
-#elif !defined(CONFIG_LBD) && BITS_PER_LONG == 32
+#elif !defined(CONFIG_LBDAF) && BITS_PER_LONG == 32
 #define DRBD_MAX_SECTORS      DRBD_MAX_SECTORS_32
 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32
 #else
@@ -1371,10 +1371,9 @@ extern int is_valid_ar_handle(struct drbd_request *, sector_t);
 extern void drbd_suspend_io(struct drbd_conf *mdev);
 extern void drbd_resume_io(struct drbd_conf *mdev);
 extern char *ppsize(char *buf, unsigned long long size);
-extern sector_t drbd_new_dev_size(struct drbd_conf *,
-               struct drbd_backing_dev *);
+extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int);
 enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 };
-extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *) __must_hold(local);
+extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, int force) __must_hold(local);
 extern void resync_after_online_grow(struct drbd_conf *);
 extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local);
 extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role,
index 9348f33f6242e9088f7094ea836d7b0d19e24f0f..ab871e00ffc5b91702f3adfa6dbf2eeaa4047e24 100644 (file)
@@ -1298,6 +1298,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
                                dev_err(DEV, "Sending state in drbd_io_error() failed\n");
                }
 
+               wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt));
                lc_destroy(mdev->resync);
                mdev->resync = NULL;
                lc_destroy(mdev->act_log);
@@ -2972,7 +2973,6 @@ struct drbd_conf *drbd_new_device(unsigned int minor)
                goto out_no_q;
        mdev->rq_queue = q;
        q->queuedata   = mdev;
-       blk_queue_max_segment_size(q, DRBD_MAX_SEGMENT_SIZE);
 
        disk = alloc_disk(1);
        if (!disk)
@@ -2996,6 +2996,7 @@ struct drbd_conf *drbd_new_device(unsigned int minor)
        q->backing_dev_info.congested_data = mdev;
 
        blk_queue_make_request(q, drbd_make_request_26);
+       blk_queue_max_segment_size(q, DRBD_MAX_SEGMENT_SIZE);
        blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
        blk_queue_merge_bvec(q, drbd_merge_bvec);
        q->queue_lock = &mdev->req_lock; /* needed since we use */
index 4e0726aa53b0cc12ca1759b00f7579035121870c..1292e062066337d40708d4449c560f9af61bb384 100644 (file)
@@ -510,7 +510,7 @@ void drbd_resume_io(struct drbd_conf *mdev)
  * Returns 0 on success, negative return values indicate errors.
  * You should call drbd_md_sync() after calling this function.
  */
-enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_hold(local)
+enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force) __must_hold(local)
 {
        sector_t prev_first_sect, prev_size; /* previous meta location */
        sector_t la_size;
@@ -541,7 +541,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_ho
        /* TODO: should only be some assert here, not (re)init... */
        drbd_md_set_sector_offsets(mdev, mdev->ldev);
 
-       size = drbd_new_dev_size(mdev, mdev->ldev);
+       size = drbd_new_dev_size(mdev, mdev->ldev, force);
 
        if (drbd_get_capacity(mdev->this_bdev) != size ||
            drbd_bm_capacity(mdev) != size) {
@@ -596,7 +596,7 @@ out:
 }
 
 sector_t
-drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
+drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int assume_peer_has_space)
 {
        sector_t p_size = mdev->p_size;   /* partner's disk size. */
        sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */
@@ -606,6 +606,11 @@ drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
 
        m_size = drbd_get_max_capacity(bdev);
 
+       if (mdev->state.conn < C_CONNECTED && assume_peer_has_space) {
+               dev_warn(DEV, "Resize while not connected was forced by the user!\n");
+               p_size = m_size;
+       }
+
        if (p_size && m_size) {
                size = min_t(sector_t, p_size, m_size);
        } else {
@@ -965,7 +970,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
 
        /* Prevent shrinking of consistent devices ! */
        if (drbd_md_test_flag(nbc, MDF_CONSISTENT) &&
-          drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) {
+           drbd_new_dev_size(mdev, nbc, 0) < nbc->md.la_size_sect) {
                dev_warn(DEV, "refusing to truncate a consistent device\n");
                retcode = ERR_DISK_TO_SMALL;
                goto force_diskless_dec;
@@ -1052,7 +1057,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
            !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND))
                set_bit(USE_DEGR_WFC_T, &mdev->flags);
 
-       dd = drbd_determin_dev_size(mdev);
+       dd = drbd_determin_dev_size(mdev, 0);
        if (dd == dev_size_error) {
                retcode = ERR_NOMEM_BITMAP;
                goto force_diskless_dec;
@@ -1271,7 +1276,7 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
                        goto fail;
                }
 
-               if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_SHASH) {
+               if (!drbd_crypto_is_hash(crypto_hash_tfm(tfm))) {
                        retcode = ERR_AUTH_ALG_ND;
                        goto fail;
                }
@@ -1504,7 +1509,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
        }
 
        mdev->ldev->dc.disk_size = (sector_t)rs.resize_size;
-       dd = drbd_determin_dev_size(mdev);
+       dd = drbd_determin_dev_size(mdev, rs.resize_force);
        drbd_md_sync(mdev);
        put_ldev(mdev);
        if (dd == dev_size_error) {
index 259c1351b1528da954d446edc4b984bcea2e2a39..d065c646b35a06fe9fba171864951efbe12e405d 100644 (file)
@@ -878,9 +878,13 @@ retry:
 
        if (mdev->cram_hmac_tfm) {
                /* drbd_request_state(mdev, NS(conn, WFAuth)); */
-               if (!drbd_do_auth(mdev)) {
+               switch (drbd_do_auth(mdev)) {
+               case -1:
                        dev_err(DEV, "Authentication of peer failed\n");
                        return -1;
+               case 0:
+                       dev_err(DEV, "Authentication of peer failed, trying again.\n");
+                       return 0;
                }
        }
 
@@ -1201,10 +1205,11 @@ static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h)
 
        case WO_bdev_flush:
        case WO_drain_io:
-               D_ASSERT(rv == FE_STILL_LIVE);
-               set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags);
-               drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
-               rv = drbd_flush_after_epoch(mdev, mdev->current_epoch);
+               if (rv == FE_STILL_LIVE) {
+                       set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags);
+                       drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
+                       rv = drbd_flush_after_epoch(mdev, mdev->current_epoch);
+               }
                if (rv == FE_RECYCLED)
                        return TRUE;
 
@@ -1219,7 +1224,7 @@ static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h)
        epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
        if (!epoch) {
                dev_warn(DEV, "Allocation of an epoch failed, slowing down\n");
-               issue_flush = !test_and_set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &epoch->flags);
+               issue_flush = !test_and_set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags);
                drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
                if (issue_flush) {
                        rv = drbd_flush_after_epoch(mdev, mdev->current_epoch);
@@ -2865,7 +2870,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h)
 
                /* Never shrink a device with usable data during connect.
                   But allow online shrinking if we are connected. */
-               if (drbd_new_dev_size(mdev, mdev->ldev) <
+               if (drbd_new_dev_size(mdev, mdev->ldev, 0) <
                   drbd_get_capacity(mdev->this_bdev) &&
                   mdev->state.disk >= D_OUTDATED &&
                   mdev->state.conn < C_CONNECTED) {
@@ -2880,7 +2885,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h)
 #undef min_not_zero
 
        if (get_ldev(mdev)) {
-               dd = drbd_determin_dev_size(mdev);
+         dd = drbd_determin_dev_size(mdev, 0);
                put_ldev(mdev);
                if (dd == dev_size_error)
                        return FALSE;
@@ -3830,10 +3835,17 @@ static int drbd_do_auth(struct drbd_conf *mdev)
 {
        dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n");
        dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n");
-       return 0;
+       return -1;
 }
 #else
 #define CHALLENGE_LEN 64
+
+/* Return value:
+       1 - auth succeeded,
+       0 - failed, try again (network error),
+       -1 - auth failed, don't try again.
+*/
+
 static int drbd_do_auth(struct drbd_conf *mdev)
 {
        char my_challenge[CHALLENGE_LEN];  /* 64 Bytes... */
@@ -3854,7 +3866,7 @@ static int drbd_do_auth(struct drbd_conf *mdev)
                                (u8 *)mdev->net_conf->shared_secret, key_len);
        if (rv) {
                dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv);
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3877,14 +3889,14 @@ static int drbd_do_auth(struct drbd_conf *mdev)
 
        if (p.length > CHALLENGE_LEN*2) {
                dev_err(DEV, "expected AuthChallenge payload too big.\n");
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
        peers_ch = kmalloc(p.length, GFP_NOIO);
        if (peers_ch == NULL) {
                dev_err(DEV, "kmalloc of peers_ch failed\n");
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3900,7 +3912,7 @@ static int drbd_do_auth(struct drbd_conf *mdev)
        response = kmalloc(resp_size, GFP_NOIO);
        if (response == NULL) {
                dev_err(DEV, "kmalloc of response failed\n");
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3910,7 +3922,7 @@ static int drbd_do_auth(struct drbd_conf *mdev)
        rv = crypto_hash_digest(&desc, &sg, sg.length, response);
        if (rv) {
                dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv);
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3944,9 +3956,9 @@ static int drbd_do_auth(struct drbd_conf *mdev)
        }
 
        right_response = kmalloc(resp_size, GFP_NOIO);
-       if (response == NULL) {
+       if (right_response == NULL) {
                dev_err(DEV, "kmalloc of right_response failed\n");
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3955,7 +3967,7 @@ static int drbd_do_auth(struct drbd_conf *mdev)
        rv = crypto_hash_digest(&desc, &sg, sg.length, right_response);
        if (rv) {
                dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv);
-               rv = 0;
+               rv = -1;
                goto fail;
        }
 
@@ -3964,6 +3976,8 @@ static int drbd_do_auth(struct drbd_conf *mdev)
        if (rv)
                dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n",
                     resp_size, mdev->net_conf->cram_hmac_alg);
+       else
+               rv = -1;
 
  fail:
        kfree(peers_ch);
index 2ddf03ae034e1aa552d6740ee171c6739f9335bd..68b5957f107cd4c5e675576457c103330458de11 100644 (file)
@@ -322,7 +322,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd)
        pkt_kobj_remove(pd->kobj_stat);
        pkt_kobj_remove(pd->kobj_wqueue);
        if (class_pktcdvd)
-               device_destroy(class_pktcdvd, pd->pkt_dev);
+               device_unregister(pd->dev);
 }
 
 
index 8f569e3df8903d3fc8103c824fa212f5ef058948..821c2833f9cf343407df6b90367567ac6fd99e3a 100644 (file)
@@ -864,7 +864,7 @@ static int __devinit swim_probe(struct platform_device *dev)
        struct swim_priv *swd;
        int ret;
 
-       res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
+       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
        if (!res) {
                ret = -ENODEV;
                goto out;
@@ -942,7 +942,7 @@ static int __devexit swim_remove(struct platform_device *dev)
 
        iounmap(swd->base);
 
-       res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
+       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
        if (res)
                release_mem_region(res->start, resource_size(res));
 
index a8c8b56b275e546e02819d7889801b5545dbafb7..1b3def1e8591d330bc3aa9b4730086b7fc6844c4 100644 (file)
@@ -28,6 +28,9 @@
  * All disk operations are performed by sending messages back and forth to
  * the OS/400 partition.
  */
+
+#define pr_fmt(fmt) "viod: " fmt
+
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/module.h>
@@ -63,9 +66,6 @@ MODULE_LICENSE("GPL");
 
 #define VIOD_VERS              "1.64"
 
-#define VIOD_KERN_WARNING      KERN_WARNING "viod: "
-#define VIOD_KERN_INFO         KERN_INFO "viod: "
-
 enum {
        PARTITION_SHIFT = 3,
        MAX_DISKNO = HVMAXARCHITECTEDVIRTUALDISKS,
@@ -156,7 +156,7 @@ static int viodasd_open(struct block_device *bdev, fmode_t mode)
                        ((u64)DEVICE_NO(d) << 48) | ((u64)flags << 32),
                        0, 0, 0);
        if (hvrc != 0) {
-               printk(VIOD_KERN_WARNING "HV open failed %d\n", (int)hvrc);
+               pr_warning("HV open failed %d\n", (int)hvrc);
                return -EIO;
        }
 
@@ -167,9 +167,8 @@ static int viodasd_open(struct block_device *bdev, fmode_t mode)
                const struct vio_error_entry *err =
                        vio_lookup_rc(viodasd_err_table, we.sub_result);
 
-               printk(VIOD_KERN_WARNING
-                               "bad rc opening disk: %d:0x%04x (%s)\n",
-                               (int)we.rc, we.sub_result, err->msg);
+               pr_warning("bad rc opening disk: %d:0x%04x (%s)\n",
+                          (int)we.rc, we.sub_result, err->msg);
                return -EIO;
        }
 
@@ -195,8 +194,7 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode)
                        ((u64)DEVICE_NO(d) << 48) /* | ((u64)flags << 32) */,
                        0, 0, 0);
        if (hvrc != 0)
-               printk(VIOD_KERN_WARNING "HV close call failed %d\n",
-                               (int)hvrc);
+               pr_warning("HV close call failed %d\n", (int)hvrc);
        return 0;
 }
 
@@ -288,8 +286,7 @@ static int send_request(struct request *req)
                bevent = (struct vioblocklpevent *)
                        vio_get_event_buffer(viomajorsubtype_blockio);
                if (bevent == NULL) {
-                       printk(VIOD_KERN_WARNING
-                              "error allocating disk event buffer\n");
+                       pr_warning("error allocating disk event buffer\n");
                        goto error_ret;
                }
 
@@ -333,9 +330,8 @@ static int send_request(struct request *req)
        }
 
        if (hvrc != HvLpEvent_Rc_Good) {
-               printk(VIOD_KERN_WARNING
-                      "error sending disk event to OS/400 (rc %d)\n",
-                      (int)hvrc);
+               pr_warning("error sending disk event to OS/400 (rc %d)\n",
+                          (int)hvrc);
                goto error_ret;
        }
        spin_unlock_irqrestore(&viodasd_spinlock, flags);
@@ -402,7 +398,7 @@ retry:
                        ((u64)dev_no << 48) | ((u64)flags<< 32),
                        0, 0, 0);
        if (hvrc != 0) {
-               printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc);
+               pr_warning("bad rc on HV open %d\n", (int)hvrc);
                return 0;
        }
 
@@ -416,9 +412,8 @@ retry:
                goto retry;
        }
        if (we.max_disk > (MAX_DISKNO - 1)) {
-               printk_once(VIOD_KERN_INFO
-                       "Only examining the first %d of %d disks connected\n",
-                       MAX_DISKNO, we.max_disk + 1);
+               printk_once(KERN_INFO pr_fmt("Only examining the first %d of %d disks connected\n"),
+                           MAX_DISKNO, we.max_disk + 1);
        }
 
        /* Send the close event to OS/400.  We DON'T expect a response */
@@ -432,17 +427,15 @@ retry:
                        ((u64)dev_no << 48) | ((u64)flags << 32),
                        0, 0, 0);
        if (hvrc != 0) {
-               printk(VIOD_KERN_WARNING
-                      "bad rc sending event to OS/400 %d\n", (int)hvrc);
+               pr_warning("bad rc sending event to OS/400 %d\n", (int)hvrc);
                return 0;
        }
 
        if (d->dev == NULL) {
                /* this is when we reprobe for new disks */
                if (vio_create_viodasd(dev_no) == NULL) {
-                       printk(VIOD_KERN_WARNING
-                               "cannot allocate virtual device for disk %d\n",
-                               dev_no);
+                       pr_warning("cannot allocate virtual device for disk %d\n",
+                                  dev_no);
                        return 0;
                }
                /*
@@ -457,15 +450,13 @@ retry:
        spin_lock_init(&d->q_lock);
        q = blk_init_queue(do_viodasd_request, &d->q_lock);
        if (q == NULL) {
-               printk(VIOD_KERN_WARNING "cannot allocate queue for disk %d\n",
-                               dev_no);
+               pr_warning("cannot allocate queue for disk %d\n", dev_no);
                return 0;
        }
        g = alloc_disk(1 << PARTITION_SHIFT);
        if (g == NULL) {
-               printk(VIOD_KERN_WARNING
-                               "cannot allocate disk structure for disk %d\n",
-                               dev_no);
+               pr_warning("cannot allocate disk structure for disk %d\n",
+                          dev_no);
                blk_cleanup_queue(q);
                return 0;
        }
@@ -489,13 +480,12 @@ retry:
        g->driverfs_dev = d->dev;
        set_capacity(g, d->size >> 9);
 
-       printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) "
-                       "CHS=%d/%d/%d sector size %d%s\n",
-                       dev_no, (unsigned long)(d->size >> 9),
-                       (unsigned long)(d->size >> 20),
-                       (int)d->cylinders, (int)d->tracks,
-                       (int)d->sectors, (int)d->bytes_per_sector,
-                       d->read_only ? " (RO)" : "");
+       pr_info("disk %d: %lu sectors (%lu MB) CHS=%d/%d/%d sector size %d%s\n",
+               dev_no, (unsigned long)(d->size >> 9),
+               (unsigned long)(d->size >> 20),
+               (int)d->cylinders, (int)d->tracks,
+               (int)d->sectors, (int)d->bytes_per_sector,
+               d->read_only ? " (RO)" : "");
 
        /* register us in the global list */
        add_disk(g);
@@ -580,8 +570,8 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent)
        if (error) {
                const struct vio_error_entry *err;
                err = vio_lookup_rc(viodasd_err_table, bevent->sub_result);
-               printk(VIOD_KERN_WARNING "read/write error %d:0x%04x (%s)\n",
-                               event->xRc, bevent->sub_result, err->msg);
+               pr_warning("read/write error %d:0x%04x (%s)\n",
+                          event->xRc, bevent->sub_result, err->msg);
                num_sect = blk_rq_sectors(req);
        }
        qlock = req->q->queue_lock;
@@ -606,8 +596,7 @@ static void handle_block_event(struct HvLpEvent *event)
                return;
        /* First, we should NEVER get an int here...only acks */
        if (hvlpevent_is_int(event)) {
-               printk(VIOD_KERN_WARNING
-                      "Yikes! got an int in viodasd event handler!\n");
+               pr_warning("Yikes! got an int in viodasd event handler!\n");
                if (hvlpevent_need_ack(event)) {
                        event->xRc = HvLpEvent_Rc_InvalidSubtype;
                        HvCallEvent_ackLpEvent(event);
@@ -650,7 +639,7 @@ static void handle_block_event(struct HvLpEvent *event)
                break;
 
        default:
-               printk(VIOD_KERN_WARNING "invalid subtype!");
+               pr_warning("invalid subtype!");
                if (hvlpevent_need_ack(event)) {
                        event->xRc = HvLpEvent_Rc_InvalidSubtype;
                        HvCallEvent_ackLpEvent(event);
@@ -739,29 +728,26 @@ static int __init viodasd_init(void)
                vio_set_hostlp();
 
        if (viopath_hostLp == HvLpIndexInvalid) {
-               printk(VIOD_KERN_WARNING "invalid hosting partition\n");
+               pr_warning("invalid hosting partition\n");
                rc = -EIO;
                goto early_fail;
        }
 
-       printk(VIOD_KERN_INFO "vers " VIOD_VERS ", hosting partition %d\n",
-                       viopath_hostLp);
+       pr_info("vers " VIOD_VERS ", hosting partition %d\n", viopath_hostLp);
 
         /* register the block device */
        rc =  register_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
        if (rc) {
-               printk(VIOD_KERN_WARNING
-                               "Unable to get major number %d for %s\n",
-                               VIODASD_MAJOR, VIOD_GENHD_NAME);
+               pr_warning("Unable to get major number %d for %s\n",
+                          VIODASD_MAJOR, VIOD_GENHD_NAME);
                goto early_fail;
        }
        /* Actually open the path to the hosting partition */
        rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio,
                                VIOMAXREQ + 2);
        if (rc) {
-               printk(VIOD_KERN_WARNING
-                      "error opening path to host partition %d\n",
-                      viopath_hostLp);
+               pr_warning("error opening path to host partition %d\n",
+                          viopath_hostLp);
                goto unregister_blk;
        }
 
@@ -770,7 +756,7 @@ static int __init viodasd_init(void)
 
        rc = vio_register_driver(&viodasd_driver);
        if (rc) {
-               printk(VIOD_KERN_WARNING "vio_register_driver failed\n");
+               pr_warning("vio_register_driver failed\n");
                goto unset_handler;
        }
 
index 51042f0ba7e163e6b3dbbd7c0c2fbd2a498a33aa..7eff828b21170731fd5c02290136a12665b4e9ea 100644 (file)
@@ -243,10 +243,12 @@ static int index_to_minor(int index)
 static int __devinit virtblk_probe(struct virtio_device *vdev)
 {
        struct virtio_blk *vblk;
+       struct request_queue *q;
        int err;
        u64 cap;
-       u32 v;
-       u32 blk_size, sg_elems;
+       u32 v, blk_size, sg_elems, opt_io_size;
+       u16 min_io_size;
+       u8 physical_block_exp, alignment_offset;
 
        if (index_to_minor(index) >= 1 << MINORBITS)
                return -ENOSPC;
@@ -293,13 +295,13 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
                goto out_mempool;
        }
 
-       vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock);
-       if (!vblk->disk->queue) {
+       q = vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock);
+       if (!q) {
                err = -ENOMEM;
                goto out_put_disk;
        }
 
-       vblk->disk->queue->queuedata = vblk;
+       q->queuedata = vblk;
 
        if (index < 26) {
                sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
@@ -323,10 +325,10 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
 
        /* If barriers are supported, tell block layer that queue is ordered */
        if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
-               blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_DRAIN_FLUSH,
+               blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH,
                                  virtblk_prepare_flush);
        else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
-               blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);
+               blk_queue_ordered(q, QUEUE_ORDERED_TAG, NULL);
 
        /* If disk is read-only in the host, the guest should obey */
        if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
@@ -345,14 +347,14 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
        set_capacity(vblk->disk, cap);
 
        /* We can handle whatever the host told us to handle. */
-       blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2);
-       blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2);
+       blk_queue_max_phys_segments(q, vblk->sg_elems-2);
+       blk_queue_max_hw_segments(q, vblk->sg_elems-2);
 
        /* No need to bounce any requests */
-       blk_queue_bounce_limit(vblk->disk->queue, BLK_BOUNCE_ANY);
+       blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
 
        /* No real sector limit. */
-       blk_queue_max_sectors(vblk->disk->queue, -1U);
+       blk_queue_max_sectors(q, -1U);
 
        /* Host can optionally specify maximum segment size and number of
         * segments. */
@@ -360,16 +362,45 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
                                offsetof(struct virtio_blk_config, size_max),
                                &v);
        if (!err)
-               blk_queue_max_segment_size(vblk->disk->queue, v);
+               blk_queue_max_segment_size(q, v);
        else
-               blk_queue_max_segment_size(vblk->disk->queue, -1U);
+               blk_queue_max_segment_size(q, -1U);
 
        /* Host can optionally specify the block size of the device */
        err = virtio_config_val(vdev, VIRTIO_BLK_F_BLK_SIZE,
                                offsetof(struct virtio_blk_config, blk_size),
                                &blk_size);
        if (!err)
-               blk_queue_logical_block_size(vblk->disk->queue, blk_size);
+               blk_queue_logical_block_size(q, blk_size);
+       else
+               blk_size = queue_logical_block_size(q);
+
+       /* Use topology information if available */
+       err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
+                       offsetof(struct virtio_blk_config, physical_block_exp),
+                       &physical_block_exp);
+       if (!err && physical_block_exp)
+               blk_queue_physical_block_size(q,
+                               blk_size * (1 << physical_block_exp));
+
+       err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
+                       offsetof(struct virtio_blk_config, alignment_offset),
+                       &alignment_offset);
+       if (!err && alignment_offset)
+               blk_queue_alignment_offset(q, blk_size * alignment_offset);
+
+       err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
+                       offsetof(struct virtio_blk_config, min_io_size),
+                       &min_io_size);
+       if (!err && min_io_size)
+               blk_queue_io_min(q, blk_size * min_io_size);
+
+       err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
+                       offsetof(struct virtio_blk_config, opt_io_size),
+                       &opt_io_size);
+       if (!err && opt_io_size)
+               blk_queue_io_opt(q, blk_size * opt_io_size);
+
 
        add_disk(vblk->disk);
        return 0;
@@ -412,7 +443,7 @@ static struct virtio_device_id id_table[] = {
 static unsigned int features[] = {
        VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
        VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
-       VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH
+       VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY
 };
 
 /*
index 652367aa6546eccb4fce00d96d2a10f505a2da04..058fbccf2f52bea5264b5a585994b0b7eb777937 100644 (file)
@@ -195,5 +195,16 @@ config BT_MRVL_SDIO
          Say Y here to compile support for Marvell BT-over-SDIO driver
          into the kernel or say M to compile it as module.
 
-endmenu
+config BT_ATH3K
+       tristate "Atheros firmware download driver"
+       depends on BT_HCIBTUSB
+       select FW_LOADER
+       help
+         Bluetooth firmware download driver.
+         This driver loads the firmware into the Atheros Bluetooth
+         chipset.
 
+         Say Y here to compile support for "Atheros firmware download driver"
+         into the kernel or say M to compile it as module (ath3k).
+
+endmenu
index b3f57d2d4eb0e46298ec991010db526237ecf110..7e5aed59812109d70de6cf495f43fb7382e09884 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_BT_HCIBTUART)    += btuart_cs.o
 obj-$(CONFIG_BT_HCIBTUSB)      += btusb.o
 obj-$(CONFIG_BT_HCIBTSDIO)     += btsdio.o
 
+obj-$(CONFIG_BT_ATH3K)         += ath3k.o
 obj-$(CONFIG_BT_MRVL)          += btmrvl.o
 obj-$(CONFIG_BT_MRVL_SDIO)     += btmrvl_sdio.o
 
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
new file mode 100644 (file)
index 0000000..add9485
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2008-2009 Atheros Communications Inc.
+ *
+ *  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
+ *
+ */
+
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/device.h>
+#include <linux/firmware.h>
+#include <linux/usb.h>
+#include <net/bluetooth/bluetooth.h>
+
+#define VERSION "1.0"
+
+
+static struct usb_device_id ath3k_table[] = {
+       /* Atheros AR3011 */
+       { USB_DEVICE(0x0CF3, 0x3000) },
+       { }     /* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE(usb, ath3k_table);
+
+#define USB_REQ_DFU_DNLOAD     1
+#define BULK_SIZE              4096
+
+struct ath3k_data {
+       struct usb_device *udev;
+       u8 *fw_data;
+       u32 fw_size;
+       u32 fw_sent;
+};
+
+static int ath3k_load_firmware(struct ath3k_data *data,
+                               unsigned char *firmware,
+                               int count)
+{
+       u8 *send_buf;
+       int err, pipe, len, size, sent = 0;
+
+       BT_DBG("ath3k %p udev %p", data, data->udev);
+
+       pipe = usb_sndctrlpipe(data->udev, 0);
+
+       if ((usb_control_msg(data->udev, pipe,
+                               USB_REQ_DFU_DNLOAD,
+                               USB_TYPE_VENDOR, 0, 0,
+                               firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
+               BT_ERR("Can't change to loading configuration err");
+               return -EBUSY;
+       }
+       sent += 20;
+       count -= 20;
+
+       send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
+       if (!send_buf) {
+               BT_ERR("Can't allocate memory chunk for firmware");
+               return -ENOMEM;
+       }
+
+       while (count) {
+               size = min_t(uint, count, BULK_SIZE);
+               pipe = usb_sndbulkpipe(data->udev, 0x02);
+               memcpy(send_buf, firmware + sent, size);
+
+               err = usb_bulk_msg(data->udev, pipe, send_buf, size,
+                                       &len, 3000);
+
+               if (err || (len != size)) {
+                       BT_ERR("Error in firmware loading err = %d,"
+                               "len = %d, size = %d", err, len, size);
+                       goto error;
+               }
+
+               sent  += size;
+               count -= size;
+       }
+
+       kfree(send_buf);
+       return 0;
+
+error:
+       kfree(send_buf);
+       return err;
+}
+
+static int ath3k_probe(struct usb_interface *intf,
+                       const struct usb_device_id *id)
+{
+       const struct firmware *firmware;
+       struct usb_device *udev = interface_to_usbdev(intf);
+       struct ath3k_data *data;
+       int size;
+
+       BT_DBG("intf %p id %p", intf, id);
+
+       if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
+               return -ENODEV;
+
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       data->udev = udev;
+
+       if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
+               kfree(data);
+               return -EIO;
+       }
+
+       size = max_t(uint, firmware->size, 4096);
+       data->fw_data = kmalloc(size, GFP_KERNEL);
+       if (!data->fw_data) {
+               release_firmware(firmware);
+               kfree(data);
+               return -ENOMEM;
+       }
+
+       memcpy(data->fw_data, firmware->data, firmware->size);
+       data->fw_size = firmware->size;
+       data->fw_sent = 0;
+       release_firmware(firmware);
+
+       usb_set_intfdata(intf, data);
+       if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) {
+               usb_set_intfdata(intf, NULL);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static void ath3k_disconnect(struct usb_interface *intf)
+{
+       struct ath3k_data *data = usb_get_intfdata(intf);
+
+       BT_DBG("ath3k_disconnect intf %p", intf);
+
+       kfree(data->fw_data);
+       kfree(data);
+}
+
+static struct usb_driver ath3k_driver = {
+       .name           = "ath3k",
+       .probe          = ath3k_probe,
+       .disconnect     = ath3k_disconnect,
+       .id_table       = ath3k_table,
+};
+
+static int __init ath3k_init(void)
+{
+       BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION);
+       return usb_register(&ath3k_driver);
+}
+
+static void __exit ath3k_exit(void)
+{
+       usb_deregister(&ath3k_driver);
+}
+
+module_init(ath3k_init);
+module_exit(ath3k_exit);
+
+MODULE_AUTHOR("Atheros Communications");
+MODULE_DESCRIPTION("Atheros AR30xx firmware driver");
+MODULE_VERSION(VERSION);
+MODULE_LICENSE("GPL");
+MODULE_FIRMWARE("ath3k-1.fw");
index 2acdc605cb4b670beefb8b0bf0ef326ff9c123e5..c2cf81144715b92fee345a2e8ecd8bf09b753131 100644 (file)
@@ -503,7 +503,9 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
        unsigned int iobase;
        unsigned char reg;
 
-       BUG_ON(!info->hdev);
+       if (!info || !info->hdev)
+               /* our irq handler is shared */
+               return IRQ_NONE;
 
        if (!test_bit(CARD_READY, &(info->hw_state)))
                return IRQ_HANDLED;
index d814a2755ccbe756310261698fd41d3740fc2ced..9f5926aaf57f1d02386cc3737abf2dda6c6fa528 100644 (file)
@@ -345,7 +345,9 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
        int iir;
        irqreturn_t r = IRQ_NONE;
 
-       BUG_ON(!info->hdev);
+       if (!info || !info->hdev)
+               /* our irq handler is shared */
+               return IRQ_NONE;
 
        iobase = info->p_dev->io.BasePort1;
 
index f36defa3776482ec291546e454b1676339b9afec..57d965b7f52199775b738c78139672b8598cab09 100644 (file)
@@ -808,6 +808,7 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
 
 exit:
        sdio_release_host(card->func);
+       kfree(tmpbuf);
 
        return ret;
 }
index d339464dc15e7f06602e58c988e74961377447b9..91c52309980427027ca756ec4bf9ea07fbc87022 100644 (file)
@@ -295,7 +295,9 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
        int iir, lsr;
        irqreturn_t r = IRQ_NONE;
 
-       BUG_ON(!info->hdev);
+       if (!info || !info->hdev)
+               /* our irq handler is shared */
+               return IRQ_NONE;
 
        iobase = info->p_dev->io.BasePort1;
 
index 4f02a6f3c980b246c1f9f9843d79e51da7cf2af1..697591941e17de3bfd0bb13573c6d3afa7ec6250 100644 (file)
@@ -299,7 +299,9 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
        int iir, lsr;
        irqreturn_t r = IRQ_NONE;
 
-       BUG_ON(!info->hdev);
+       if (!info || !info->hdev)
+               /* our irq handler is shared */
+               return IRQ_NONE;
 
        iobase = info->p_dev->io.BasePort1;
 
index 31be3ac2e21b36e94f8db37660ff3c92aaa0771f..3141dd3b6e530f6dc264c04ce089609e1fadd164 100644 (file)
@@ -666,10 +666,18 @@ config VIRTIO_CONSOLE
        help
          Virtio console for use with lguest and other hypervisors.
 
+         Also serves as a general-purpose serial device for data
+         transfer between the guest and host.  Character devices at
+         /dev/vportNpn will be created when corresponding ports are
+         found, where N is the device number and n is the port number
+         within that device.  If specified by the host, a sysfs
+         attribute called 'name' will be populated with a name for
+         the port which can be used by udev scripts to create a
+         symlink to the device.
 
 config HVCS
        tristate "IBM Hypervisor Virtual Console Server support"
-       depends on PPC_PSERIES
+       depends on PPC_PSERIES && HVC_CONSOLE
        help
          Partitionable IBM Power5 ppc64 machines allow hosting of
          firmware virtual consoles from one Linux partition by
index 5aa7a586a7ffc2716004ea771f191a6d548efc15..fd50ead59c7957f6063d48f9b438f469df56c33d 100644 (file)
@@ -725,14 +725,10 @@ static struct pci_driver agp_amd64_pci_driver = {
 int __init agp_amd64_init(void)
 {
        int err = 0;
-       static int done = 0;
 
        if (agp_off)
                return -EINVAL;
 
-       if (done++)
-               return agp_bridges_found ? 0 : -ENODEV;
-
        err = pci_register_driver(&agp_amd64_pci_driver);
        if (err < 0)
                return err;
@@ -769,14 +765,27 @@ int __init agp_amd64_init(void)
        return err;
 }
 
+static int __init agp_amd64_mod_init(void)
+{
+#ifndef MODULE
+       if (gart_iommu_aperture)
+               return agp_bridges_found ? 0 : -ENODEV;
+#endif
+       return agp_amd64_init();
+}
+
 static void __exit agp_amd64_cleanup(void)
 {
+#ifndef MODULE
+       if (gart_iommu_aperture)
+               return;
+#endif
        if (aperture_resource)
                release_resource(aperture_resource);
        pci_unregister_driver(&agp_amd64_pci_driver);
 }
 
-module_init(agp_amd64_init);
+module_init(agp_amd64_mod_init);
 module_exit(agp_amd64_cleanup);
 
 MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
index 30c36ac2cd00e068fbb26b2a54f7e3fe96c5b597..8a713f1e965351ef91a2d885485ec5fe4e96c719 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/pagemap.h>
 #include <linux/agp_backend.h>
+#include <asm/smp.h>
 #include "agp.h"
 
 /*
@@ -815,12 +816,6 @@ static void intel_i830_setup_flush(void)
                intel_i830_fini_flush();
 }
 
-static void
-do_wbinvd(void *null)
-{
-       wbinvd();
-}
-
 /* The chipset_flush interface needs to get data that has already been
  * flushed out of the CPU all the way out to main memory, because the GPU
  * doesn't snoop those buffers.
@@ -837,12 +832,10 @@ static void intel_i830_chipset_flush(struct agp_bridge_data *bridge)
 
        memset(pg, 0, 1024);
 
-       if (cpu_has_clflush) {
+       if (cpu_has_clflush)
                clflush_cache_range(pg, 1024);
-       } else {
-               if (on_each_cpu(do_wbinvd, NULL, 1) != 0)
-                       printk(KERN_ERR "Timed out waiting for cache flush.\n");
-       }
+       else if (wbinvd_on_all_cpus() != 0)
+               printk(KERN_ERR "Timed out waiting for cache flush.\n");
 }
 
 /* The intel i830 automatically initializes the agp aperture during POST.
@@ -2460,10 +2453,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
                                &bridge->mode);
        }
 
-       if (bridge->driver->mask_memory == intel_i965_mask_memory)
+       if (bridge->driver->mask_memory == intel_i965_mask_memory) {
                if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
                        dev_err(&intel_private.pcidev->dev,
                                "set gfx device dma mask 36bit failed!\n");
+               else
+                       pci_set_consistent_dma_mask(intel_private.pcidev,
+                                                   DMA_BIT_MASK(36));
+       }
 
        pci_set_drvdata(pdev, bridge);
        return agp_add_bridge(bridge);
index 0afc8b82212e78dd17d7d2b254ec099b5642cfb7..5fe4631e2a6135f1fb2c417246b7e306e980475b 100644 (file)
@@ -84,7 +84,7 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)
        return cnt;
 }
 
-static struct hv_ops hvc_beat_get_put_ops = {
+static const struct hv_ops hvc_beat_get_put_ops = {
        .get_chars = hvc_beat_get_chars,
        .put_chars = hvc_beat_put_chars,
 };
@@ -99,7 +99,7 @@ static int hvc_beat_config(char *p)
 
 static int __init hvc_beat_console_init(void)
 {
-       if (hvc_beat_useit && machine_is_compatible("Beat")) {
+       if (hvc_beat_useit && of_machine_is_compatible("Beat")) {
                hvc_instantiate(0, 0, &hvc_beat_get_put_ops);
        }
        return 0;
index 416d3423150d8d037dce7a459eb8a5fc44a64fc8..4c3b59be286add18bcf32b500ff84d8a4f88c36a 100644 (file)
@@ -125,7 +125,7 @@ static struct hvc_struct *hvc_get_by_index(int index)
  * console interfaces but can still be used as a tty device.  This has to be
  * static because kmalloc will not work during early console init.
  */
-static struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES];
+static const struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES];
 static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
        {[0 ... MAX_NR_HVC_CONSOLES - 1] = -1};
 
@@ -247,7 +247,7 @@ static void destroy_hvc_struct(struct kref *kref)
  * vty adapters do NOT get an hvc_instantiate() callback since they
  * appear after early console init.
  */
-int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops)
+int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
 {
        struct hvc_struct *hp;
 
@@ -748,8 +748,9 @@ static const struct tty_operations hvc_ops = {
        .chars_in_buffer = hvc_chars_in_buffer,
 };
 
-struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data,
-                                       struct hv_ops *ops, int outbuf_size)
+struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
+                            const struct hv_ops *ops,
+                            int outbuf_size)
 {
        struct hvc_struct *hp;
        int i;
index 10950ca706d8d9dfe31ca0012b5415aababb5192..54381eba4e4ae753ae6d7ff9d116ed82b7fbe979 100644 (file)
@@ -55,7 +55,7 @@ struct hvc_struct {
        int outbuf_size;
        int n_outbuf;
        uint32_t vtermno;
-       struct hv_ops *ops;
+       const struct hv_ops *ops;
        int irq_requested;
        int data;
        struct winsize ws;
@@ -76,11 +76,12 @@ struct hv_ops {
 };
 
 /* Register a vterm and a slot index for use as a console (console_init) */
-extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
+extern int hvc_instantiate(uint32_t vtermno, int index,
+                          const struct hv_ops *ops);
 
 /* register a vterm for hvc tty operation (module_init or hotplug add) */
-extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data,
-                               struct hv_ops *ops, int outbuf_size);
+extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
+                                    const struct hv_ops *ops, int outbuf_size);
 /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */
 extern int hvc_remove(struct hvc_struct *hp);
 
index 936d05bf37fa3264ae48ec539f0787d6a1a7c3cc..fd0242676a2a4530a24470f78e8609369ee0873b 100644 (file)
@@ -197,7 +197,7 @@ done:
        return sent;
 }
 
-static struct hv_ops hvc_get_put_ops = {
+static const struct hv_ops hvc_get_put_ops = {
        .get_chars = get_chars,
        .put_chars = put_chars,
        .notifier_add = notifier_add_irq,
index fe62bd0e17b751f55e359addc54ee4569a4f7488..21681a81cc35d6ee5cc5a09ac5d37e8be7ce5e15 100644 (file)
@@ -922,7 +922,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev)
 
 
 /* HVC operations */
-static struct hv_ops hvc_iucv_ops = {
+static const struct hv_ops hvc_iucv_ops = {
        .get_chars = hvc_iucv_get_chars,
        .put_chars = hvc_iucv_put_chars,
        .notifier_add = hvc_iucv_notifier_add,
index 88590d040046decb71f76629c3aa52fd0383817b..61c4a61558d972abebb2ba6fd11d906066169ac6 100644 (file)
@@ -71,7 +71,7 @@ static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count)
        return i;
 }
 
-static struct hv_ops hvc_rtas_get_put_ops = {
+static const struct hv_ops hvc_rtas_get_put_ops = {
        .get_chars = hvc_rtas_read_console,
        .put_chars = hvc_rtas_write_console,
 };
index bd63ba878a560eecf3513dd58989331337c1a7f4..b0957e61a7befc015fb05adf587e32d48626edea 100644 (file)
@@ -58,7 +58,7 @@ static int hvc_udbg_get(uint32_t vtermno, char *buf, int count)
        return i;
 }
 
-static struct hv_ops hvc_udbg_ops = {
+static const struct hv_ops hvc_udbg_ops = {
        .get_chars = hvc_udbg_get,
        .put_chars = hvc_udbg_put,
 };
index 10be343d6ae75127c1aa980c1667fe518bbbb0ab..27370e99c66fa0a371ffec67a6e6d87b35af4477 100644 (file)
@@ -77,7 +77,7 @@ static int filtered_get_chars(uint32_t vtermno, char *buf, int count)
        return got;
 }
 
-static struct hv_ops hvc_get_put_ops = {
+static const struct hv_ops hvc_get_put_ops = {
        .get_chars = filtered_get_chars,
        .put_chars = hvc_put_chars,
        .notifier_add = notifier_add_irq,
index b1a71638c772b8ed5be135408c612130d7b2ec8b..60446f82a3fc2653c905adb3a6f944c1686f0863 100644 (file)
@@ -122,7 +122,7 @@ static int read_console(uint32_t vtermno, char *buf, int len)
        return recv;
 }
 
-static struct hv_ops hvc_ops = {
+static const struct hv_ops hvc_ops = {
        .get_chars = read_console,
        .put_chars = write_console,
        .notifier_add = notifier_add_irq,
index 87060266ef91b9ba765a0c951e268119beddf6f4..6ea1014697d12d78aa45982f378b17e22db0394c 100644 (file)
@@ -186,3 +186,15 @@ config HW_RANDOM_MXC_RNGA
          module will be called mxc-rnga.
 
          If unsure, say Y.
+
+config HW_RANDOM_NOMADIK
+       tristate "ST-Ericsson Nomadik Random Number Generator support"
+       depends on HW_RANDOM && PLAT_NOMADIK
+       ---help---
+         This driver provides kernel-side support for the Random Number
+         Generator hardware found on ST-Ericsson SoCs (8815 and 8500).
+
+         To compile this driver as a module, choose M here: the
+         module will be called nomadik-rng.
+
+         If unsure, say Y.
index 5eeb1303f0d01efeb98d62282fb07c41e233b936..4273308aa1e3f3b4e0b54173aa7ea27b0845e7ee 100644 (file)
@@ -18,3 +18,4 @@ obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
 obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o
 obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
 obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
+obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c
new file mode 100644 (file)
index 0000000..a8b4c40
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Nomadik RNG support
+ *  Copyright 2009 Alessandro Rubini
+ *
+ *  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 <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/amba/bus.h>
+#include <linux/hw_random.h>
+#include <linux/io.h>
+
+static int nmk_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
+{
+       void __iomem *base = (void __iomem *)rng->priv;
+
+       /*
+        * The register is 32 bits and gives 16 random bits (low half).
+        * A subsequent read will delay the core for 400ns, so we just read
+        * once and accept the very unlikely very small delay, even if wait==0.
+        */
+       *(u16 *)data = __raw_readl(base + 8) & 0xffff;
+       return 2;
+}
+
+/* we have at most one RNG per machine, granted */
+static struct hwrng nmk_rng = {
+       .name           = "nomadik",
+       .read           = nmk_rng_read,
+};
+
+static int nmk_rng_probe(struct amba_device *dev, struct amba_id *id)
+{
+       void __iomem *base;
+       int ret;
+
+       ret = amba_request_regions(dev, dev->dev.init_name);
+       if (ret)
+               return ret;
+       ret = -ENOMEM;
+       base = ioremap(dev->res.start, resource_size(&dev->res));
+       if (!base)
+               goto out_release;
+       nmk_rng.priv = (unsigned long)base;
+       ret = hwrng_register(&nmk_rng);
+       if (ret)
+               goto out_unmap;
+       return 0;
+
+out_unmap:
+       iounmap(base);
+out_release:
+       amba_release_regions(dev);
+       return ret;
+}
+
+static int nmk_rng_remove(struct amba_device *dev)
+{
+       void __iomem *base = (void __iomem *)nmk_rng.priv;
+       hwrng_unregister(&nmk_rng);
+       iounmap(base);
+       amba_release_regions(dev);
+       return 0;
+}
+
+static struct amba_id nmk_rng_ids[] = {
+       {
+               .id     = 0x000805e1,
+               .mask   = 0x000fffff, /* top bits are rev and cfg: accept all */
+       },
+       {0, 0},
+};
+
+static struct amba_driver nmk_rng_driver = {
+       .drv = {
+               .owner = THIS_MODULE,
+               .name = "rng",
+               },
+       .probe = nmk_rng_probe,
+       .remove = nmk_rng_remove,
+       .id_table = nmk_rng_ids,
+};
+
+static int __init nmk_rng_init(void)
+{
+       return amba_driver_register(&nmk_rng_driver);
+}
+
+static void __devexit nmk_rng_exit(void)
+{
+       amba_driver_unregister(&nmk_rng_driver);
+}
+
+module_init(nmk_rng_init);
+module_exit(nmk_rng_exit);
+
+MODULE_LICENSE("GPL");
index bdaef8e94021f613f1e8b7692e856d1d055ffd98..64fe0a793efd4640ed7ad2905b15f202290850e5 100644 (file)
@@ -114,7 +114,7 @@ static struct virtio_device_id id_table[] = {
        { 0 },
 };
 
-static struct virtio_driver virtio_rng = {
+static struct virtio_driver virtio_rng_driver = {
        .driver.name =  KBUILD_MODNAME,
        .driver.owner = THIS_MODULE,
        .id_table =     id_table,
@@ -124,12 +124,12 @@ static struct virtio_driver virtio_rng = {
 
 static int __init init(void)
 {
-       return register_virtio_driver(&virtio_rng);
+       return register_virtio_driver(&virtio_rng_driver);
 }
 
 static void __exit fini(void)
 {
-       unregister_virtio_driver(&virtio_rng);
+       unregister_virtio_driver(&virtio_rng_driver);
 }
 module_init(init);
 module_exit(fini);
index be832b6f8279919831df235a11738f7398668722..48788db4e280f89e289a4d9f2e31b8519244b82c 100644 (file)
@@ -395,6 +395,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
        unsigned long p = *ppos;
        ssize_t low_count, read, sz;
        char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
+       int err = 0;
 
        read = 0;
        if (p < (unsigned long) high_memory) {
@@ -441,12 +442,16 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
                        return -ENOMEM;
                while (count > 0) {
                        sz = size_inside_page(p, count);
+                       if (!is_vmalloc_or_module_addr((void *)p)) {
+                               err = -ENXIO;
+                               break;
+                       }
                        sz = vread(kbuf, (char *)p, sz);
                        if (!sz)
                                break;
                        if (copy_to_user(buf, kbuf, sz)) {
-                               free_page((unsigned long)kbuf);
-                               return -EFAULT;
+                               err = -EFAULT;
+                               break;
                        }
                        count -= sz;
                        buf += sz;
@@ -455,8 +460,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
                }
                free_page((unsigned long)kbuf);
        }
-       *ppos = p;
-       return read;
+       *ppos = p;
+       return read ? read : err;
 }
 
 
@@ -520,6 +525,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
        ssize_t wrote = 0;
        ssize_t virtr = 0;
        char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
+       int err = 0;
 
        if (p < (unsigned long) high_memory) {
                unsigned long to_write = min_t(unsigned long, count,
@@ -540,14 +546,16 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
                        unsigned long sz = size_inside_page(p, count);
                        unsigned long n;
 
+                       if (!is_vmalloc_or_module_addr((void *)p)) {
+                               err = -ENXIO;
+                               break;
+                       }
                        n = copy_from_user(kbuf, buf, sz);
                        if (n) {
-                               if (wrote + virtr)
-                                       break;
-                               free_page((unsigned long)kbuf);
-                               return -EFAULT;
+                               err = -EFAULT;
+                               break;
                        }
-                       sz = vwrite(kbuf, (char *)p, sz);
+                       vwrite(kbuf, (char *)p, sz);
                        count -= sz;
                        buf += sz;
                        virtr += sz;
@@ -556,8 +564,8 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
                free_page((unsigned long)kbuf);
        }
 
-       *ppos = p;
-       return virtr + wrote;
+       *ppos = p;
+       return virtr + wrote ? : err;
 }
 #endif
 
index 7d73cd430340c4926343af47c2247d7e8dadceeb..2ad7d37afbd080306d849d8a4558daca888f2e9b 100644 (file)
@@ -1651,10 +1651,10 @@ static void ntty_close(struct tty_struct *tty, struct file *file)
 
        dc->open_ttys--;
        port->count--;
-       tty_port_tty_set(port, NULL);
 
        if (port->count == 0) {
                DBG1("close: %d", nport->token_dl);
+               tty_port_tty_set(port, NULL);
                spin_lock_irqsave(&dc->spin_mutex, flags);
                dc->last_ier &= ~(nport->token_dl);
                writew(dc->last_ier, dc->reg_ier);
index fdbcc9fd6d3143a00810fd664d77379ee083717b..5eb83c3ca20de35be340031015a93495ae19e12b 100644 (file)
@@ -336,14 +336,12 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
 
 static int nvram_open(struct inode *inode, struct file *file)
 {
-       lock_kernel();
        spin_lock(&nvram_state_lock);
 
        if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
            (nvram_open_mode & NVRAM_EXCL) ||
            ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) {
                spin_unlock(&nvram_state_lock);
-               unlock_kernel();
                return -EBUSY;
        }
 
@@ -354,7 +352,6 @@ static int nvram_open(struct inode *inode, struct file *file)
        nvram_open_cnt++;
 
        spin_unlock(&nvram_state_lock);
-       unlock_kernel();
 
        return 0;
 }
index 2db4c0a29b052540ba988e05a5c217804c3d5aed..c9bc896d68afe62a416bf547f5dfc09ba63c0891 100644 (file)
@@ -1047,7 +1047,7 @@ release_io:
 static ssize_t cmm_write(struct file *filp, const char __user *buf,
                         size_t count, loff_t *ppos)
 {
-       struct cm4000_dev *dev = (struct cm4000_dev *) filp->private_data;
+       struct cm4000_dev *dev = filp->private_data;
        unsigned int iobase = dev->p_dev->io.BasePort1;
        unsigned short s;
        unsigned char tmp;
index 8258982b49ec3ab1551416ccd8e558d2f1c5e6df..2849713d22317290451bda8c2e0909d2454d9e13 100644 (file)
@@ -1051,12 +1051,6 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
                                /* like a named pipe */
        }
 
-       /*
-        * If we gave the user some bytes, update the access time.
-        */
-       if (count)
-               file_accessed(file);
-
        return (count ? count : retval);
 }
 
@@ -1107,7 +1101,6 @@ static ssize_t random_write(struct file *file, const char __user *buffer,
                            size_t count, loff_t *ppos)
 {
        size_t ret;
-       struct inode *inode = file->f_path.dentry->d_inode;
 
        ret = write_pool(&blocking_pool, buffer, count);
        if (ret)
@@ -1116,8 +1109,6 @@ static ssize_t random_write(struct file *file, const char __user *buffer,
        if (ret)
                return ret;
 
-       inode->i_mtime = current_fs_time(inode->i_sb);
-       mark_inode_dirty(inode);
        return (ssize_t)count;
 }
 
index ecba4942fc8e313db48152b4818c0ff935a9a870..f58440791e652e2d10b8843ef223d45fdfa7f3db 100644 (file)
 struct tpm_inf_dev {
        int iotype;
 
-       void __iomem *mem_base;         /* MMIO ioremap'd addr */
-       unsigned long map_base;         /* phys MMIO base */
-       unsigned long map_size;         /* MMIO region size */
-       unsigned int index_off;         /* index register offset */
+       void __iomem *mem_base; /* MMIO ioremap'd addr */
+       unsigned long map_base; /* phys MMIO base */
+       unsigned long map_size; /* MMIO region size */
+       unsigned int index_off; /* index register offset */
 
-       unsigned int data_regs;         /* Data registers */
+       unsigned int data_regs; /* Data registers */
        unsigned int data_size;
 
        unsigned int config_port;       /* IO Port config index reg */
@@ -406,14 +406,14 @@ static const struct tpm_vendor_specific tpm_inf = {
        .miscdev = {.fops = &inf_ops,},
 };
 
-static const struct pnp_device_id tpm_pnp_tbl[] = {
+static const struct pnp_device_id tpm_inf_pnp_tbl[] = {
        /* Infineon TPMs */
        {"IFX0101", 0},
        {"IFX0102", 0},
        {"", 0}
 };
 
-MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl);
+MODULE_DEVICE_TABLE(pnp, tpm_inf_pnp_tbl);
 
 static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
                                       const struct pnp_device_id *dev_id)
@@ -430,7 +430,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
        if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
            !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
 
-               tpm_dev.iotype = TPM_INF_IO_PORT;
+               tpm_dev.iotype = TPM_INF_IO_PORT;
 
                tpm_dev.config_port = pnp_port_start(dev, 0);
                tpm_dev.config_size = pnp_port_len(dev, 0);
@@ -459,9 +459,9 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
                        goto err_last;
                }
        } else if (pnp_mem_valid(dev, 0) &&
-                  !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
+                  !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
 
-               tpm_dev.iotype = TPM_INF_IO_MEM;
+               tpm_dev.iotype = TPM_INF_IO_MEM;
 
                tpm_dev.map_base = pnp_mem_start(dev, 0);
                tpm_dev.map_size = pnp_mem_len(dev, 0);
@@ -563,11 +563,11 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
                         "product id 0x%02x%02x"
                         "%s\n",
                         tpm_dev.iotype == TPM_INF_IO_PORT ?
-                               tpm_dev.config_port :
-                               tpm_dev.map_base + tpm_dev.index_off,
+                        tpm_dev.config_port :
+                        tpm_dev.map_base + tpm_dev.index_off,
                         tpm_dev.iotype == TPM_INF_IO_PORT ?
-                               tpm_dev.data_regs :
-                               tpm_dev.map_base + tpm_dev.data_regs,
+                        tpm_dev.data_regs :
+                        tpm_dev.map_base + tpm_dev.data_regs,
                         version[0], version[1],
                         vendorid[0], vendorid[1],
                         productid[0], productid[1], chipname);
@@ -607,20 +607,55 @@ static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev)
                        iounmap(tpm_dev.mem_base);
                        release_mem_region(tpm_dev.map_base, tpm_dev.map_size);
                }
+               tpm_dev_vendor_release(chip);
                tpm_remove_hardware(chip->dev);
        }
 }
 
+static int tpm_inf_pnp_suspend(struct pnp_dev *dev, pm_message_t pm_state)
+{
+       struct tpm_chip *chip = pnp_get_drvdata(dev);
+       int rc;
+       if (chip) {
+               u8 savestate[] = {
+                       0, 193, /* TPM_TAG_RQU_COMMAND */
+                       0, 0, 0, 10,    /* blob length (in bytes) */
+                       0, 0, 0, 152    /* TPM_ORD_SaveState */
+               };
+               dev_info(&dev->dev, "saving TPM state\n");
+               rc = tpm_inf_send(chip, savestate, sizeof(savestate));
+               if (rc < 0) {
+                       dev_err(&dev->dev, "error while saving TPM state\n");
+                       return rc;
+               }
+       }
+       return 0;
+}
+
+static int tpm_inf_pnp_resume(struct pnp_dev *dev)
+{
+       /* Re-configure TPM after suspending */
+       tpm_config_out(ENABLE_REGISTER_PAIR, TPM_INF_ADDR);
+       tpm_config_out(IOLIMH, TPM_INF_ADDR);
+       tpm_config_out((tpm_dev.data_regs >> 8) & 0xff, TPM_INF_DATA);
+       tpm_config_out(IOLIML, TPM_INF_ADDR);
+       tpm_config_out((tpm_dev.data_regs & 0xff), TPM_INF_DATA);
+       /* activate register */
+       tpm_config_out(TPM_DAR, TPM_INF_ADDR);
+       tpm_config_out(0x01, TPM_INF_DATA);
+       tpm_config_out(DISABLE_REGISTER_PAIR, TPM_INF_ADDR);
+       /* disable RESET, LP and IRQC */
+       tpm_data_out(RESET_LP_IRQC_DISABLE, CMD);
+       return tpm_pm_resume(&dev->dev);
+}
+
 static struct pnp_driver tpm_inf_pnp_driver = {
        .name = "tpm_inf_pnp",
-       .driver = {
-               .owner = THIS_MODULE,
-               .suspend = tpm_pm_suspend,
-               .resume = tpm_pm_resume,
-       },
-       .id_table = tpm_pnp_tbl,
+       .id_table = tpm_inf_pnp_tbl,
        .probe = tpm_inf_pnp_probe,
-       .remove = __devexit_p(tpm_inf_pnp_remove),
+       .suspend = tpm_inf_pnp_suspend,
+       .resume = tpm_inf_pnp_resume,
+       .remove = __devexit_p(tpm_inf_pnp_remove)
 };
 
 static int __init init_inf(void)
@@ -638,5 +673,5 @@ module_exit(cleanup_inf);
 
 MODULE_AUTHOR("Marcel Selhorst <m.selhorst@sirrix.com>");
 MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
-MODULE_VERSION("1.9");
+MODULE_VERSION("1.9.2");
 MODULE_LICENSE("GPL");
index f15df40bc318fc90fd9825fab91a10a528e2d617..dcb9083ecde0982dd061720be8e2e324d3bde5ed 100644 (file)
@@ -1951,8 +1951,10 @@ static int tty_fasync(int fd, struct file *filp, int on)
                        pid = task_pid(current);
                        type = PIDTYPE_PID;
                }
+               get_pid(pid);
                spin_unlock_irqrestore(&tty->ctrl_lock, flags);
                retval = __f_setown(filp, pid, type, 0);
+               put_pid(pid);
                if (retval)
                        goto out;
        } else {
index 867b67be9f0ac0db007cb8116d7f7b970ab1ba87..c7072ba14f48130d8f04977232bb38ed8dbe067e 100644 (file)
@@ -89,13 +89,17 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
        switch (cmd) {
        case MMTIMER_GETOFFSET: /* offset of the counter */
                /*
-                * UV RTC register is on its own page
+                * Starting with HUB rev 2.0, the UV RTC register is
+                * replicated across all cachelines of it's own page.
+                * This allows faster simultaneous reads from a given socket.
+                *
+                * The offset returned is in 64 bit units.
                 */
-               if (PAGE_SIZE <= (1 << 16))
-                       ret = ((UV_LOCAL_MMR_BASE | UVH_RTC) & (PAGE_SIZE-1))
-                               / 8;
+               if (uv_get_min_hub_revision_id() == 1)
+                       ret = 0;
                else
-                       ret = -ENOSYS;
+                       ret = ((uv_blade_processor_id() * L1_CACHE_BYTES) %
+                                       PAGE_SIZE) / 8;
                break;
 
        case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
@@ -115,8 +119,8 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
                ret = hweight64(UVH_RTC_REAL_TIME_CLOCK_MASK);
                break;
 
-       case MMTIMER_MMAPAVAIL: /* can we mmap the clock into userspace? */
-               ret = (PAGE_SIZE <= (1 << 16)) ? 1 : 0;
+       case MMTIMER_MMAPAVAIL:
+               ret = 1;
                break;
 
        case MMTIMER_GETCOUNTER:
index a035ae39a3594bad321536817c5943695c3be433..213373b5f17fc61e2112001a23811e82e44bcc63 100644 (file)
@@ -1,18 +1,6 @@
-/*D:300
- * The Guest console driver
- *
- * Writing console drivers is one of the few remaining Dark Arts in Linux.
- * Fortunately for us, the path of virtual consoles has been well-trodden by
- * the PowerPC folks, who wrote "hvc_console.c" to generically support any
- * virtual console.  We use that infrastructure which only requires us to write
- * the basic put_chars and get_chars functions and call the right register
- * functions.
- :*/
-
-/*M:002 The console can be flooded: while the Guest is processing input the
- * Host can send more.  Buffering in the Host could alleviate this, but it is a
- * difficult problem in general. :*/
-/* Copyright (C) 2006, 2007 Rusty Russell, IBM Corporation
+/*
+ * Copyright (C) 2006, 2007, 2009 Rusty Russell, IBM Corporation
+ * Copyright (C) 2009, 2010 Red Hat, Inc.
  *
  * 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
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <linux/cdev.h>
+#include <linux/debugfs.h>
+#include <linux/device.h>
 #include <linux/err.h>
+#include <linux/fs.h>
 #include <linux/init.h>
+#include <linux/list.h>
+#include <linux/poll.h>
+#include <linux/sched.h>
+#include <linux/spinlock.h>
 #include <linux/virtio.h>
 #include <linux/virtio_console.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>
 #include "hvc_console.h"
 
-/*D:340 These represent our input and output console queues, and the virtio
- * operations for them. */
-static struct virtqueue *in_vq, *out_vq;
-static struct virtio_device *vdev;
+/*
+ * This is a global struct for storing common data for all the devices
+ * this driver handles.
+ *
+ * Mainly, it has a linked list for all the consoles in one place so
+ * that callbacks from hvc for get_chars(), put_chars() work properly
+ * across multiple devices and multiple ports per device.
+ */
+struct ports_driver_data {
+       /* Used for registering chardevs */
+       struct class *class;
+
+       /* Used for exporting per-port information to debugfs */
+       struct dentry *debugfs_dir;
+
+       /* Number of devices this driver is handling */
+       unsigned int index;
+
+       /*
+        * This is used to keep track of the number of hvc consoles
+        * spawned by this driver.  This number is given as the first
+        * argument to hvc_alloc().  To correctly map an initial
+        * console spawned via hvc_instantiate to the console being
+        * hooked up via hvc_alloc, we need to pass the same vtermno.
+        *
+        * We also just assume the first console being initialised was
+        * the first one that got used as the initial console.
+        */
+       unsigned int next_vtermno;
+
+       /* All the console devices handled by this driver */
+       struct list_head consoles;
+};
+static struct ports_driver_data pdrvdata;
+
+DEFINE_SPINLOCK(pdrvdata_lock);
+
+/* This struct holds information that's relevant only for console ports */
+struct console {
+       /* We'll place all consoles in a list in the pdrvdata struct */
+       struct list_head list;
+
+       /* The hvc device associated with this console port */
+       struct hvc_struct *hvc;
+
+       /*
+        * This number identifies the number that we used to register
+        * with hvc in hvc_instantiate() and hvc_alloc(); this is the
+        * number passed on by the hvc callbacks to us to
+        * differentiate between the other console ports handled by
+        * this driver
+        */
+       u32 vtermno;
+};
+
+struct port_buffer {
+       char *buf;
+
+       /* size of the buffer in *buf above */
+       size_t size;
+
+       /* used length of the buffer */
+       size_t len;
+       /* offset in the buf from which to consume data */
+       size_t offset;
+};
+
+/*
+ * This is a per-device struct that stores data common to all the
+ * ports for that device (vdev->priv).
+ */
+struct ports_device {
+       /*
+        * Workqueue handlers where we process deferred work after
+        * notification
+        */
+       struct work_struct control_work;
+       struct work_struct config_work;
+
+       struct list_head ports;
+
+       /* To protect the list of ports */
+       spinlock_t ports_lock;
+
+       /* To protect the vq operations for the control channel */
+       spinlock_t cvq_lock;
+
+       /* The current config space is stored here */
+       struct virtio_console_config config;
+
+       /* The virtio device we're associated with */
+       struct virtio_device *vdev;
+
+       /*
+        * A couple of virtqueues for the control channel: one for
+        * guest->host transfers, one for host->guest transfers
+        */
+       struct virtqueue *c_ivq, *c_ovq;
+
+       /* Array of per-port IO virtqueues */
+       struct virtqueue **in_vqs, **out_vqs;
+
+       /* Used for numbering devices for sysfs and debugfs */
+       unsigned int drv_index;
+
+       /* Major number for this device.  Ports will be created as minors. */
+       int chr_major;
+};
+
+/* This struct holds the per-port data */
+struct port {
+       /* Next port in the list, head is in the ports_device */
+       struct list_head list;
+
+       /* Pointer to the parent virtio_console device */
+       struct ports_device *portdev;
+
+       /* The current buffer from which data has to be fed to readers */
+       struct port_buffer *inbuf;
+
+       /*
+        * To protect the operations on the in_vq associated with this
+        * port.  Has to be a spinlock because it can be called from
+        * interrupt context (get_char()).
+        */
+       spinlock_t inbuf_lock;
+
+       /* The IO vqs for this port */
+       struct virtqueue *in_vq, *out_vq;
+
+       /* File in the debugfs directory that exposes this port's information */
+       struct dentry *debugfs_file;
+
+       /*
+        * The entries in this struct will be valid if this port is
+        * hooked up to an hvc console
+        */
+       struct console cons;
+
+       /* Each port associates with a separate char device */
+       struct cdev cdev;
+       struct device *dev;
+
+       /* A waitqueue for poll() or blocking read operations */
+       wait_queue_head_t waitqueue;
+
+       /* The 'name' of the port that we expose via sysfs properties */
+       char *name;
+
+       /* The 'id' to identify the port with the Host */
+       u32 id;
+
+       /* Is the host device open */
+       bool host_connected;
+
+       /* We should allow only one process to open a port */
+       bool guest_connected;
+};
+
+/* This is the very early arch-specified put chars function. */
+static int (*early_put_chars)(u32, const char *, int);
+
+static struct port *find_port_by_vtermno(u32 vtermno)
+{
+       struct port *port;
+       struct console *cons;
+       unsigned long flags;
+
+       spin_lock_irqsave(&pdrvdata_lock, flags);
+       list_for_each_entry(cons, &pdrvdata.consoles, list) {
+               if (cons->vtermno == vtermno) {
+                       port = container_of(cons, struct port, cons);
+                       goto out;
+               }
+       }
+       port = NULL;
+out:
+       spin_unlock_irqrestore(&pdrvdata_lock, flags);
+       return port;
+}
+
+static struct port *find_port_by_id(struct ports_device *portdev, u32 id)
+{
+       struct port *port;
+       unsigned long flags;
+
+       spin_lock_irqsave(&portdev->ports_lock, flags);
+       list_for_each_entry(port, &portdev->ports, list)
+               if (port->id == id)
+                       goto out;
+       port = NULL;
+out:
+       spin_unlock_irqrestore(&portdev->ports_lock, flags);
+
+       return port;
+}
+
+static struct port *find_port_by_vq(struct ports_device *portdev,
+                                   struct virtqueue *vq)
+{
+       struct port *port;
+       unsigned long flags;
+
+       spin_lock_irqsave(&portdev->ports_lock, flags);
+       list_for_each_entry(port, &portdev->ports, list)
+               if (port->in_vq == vq || port->out_vq == vq)
+                       goto out;
+       port = NULL;
+out:
+       spin_unlock_irqrestore(&portdev->ports_lock, flags);
+       return port;
+}
+
+static bool is_console_port(struct port *port)
+{
+       if (port->cons.hvc)
+               return true;
+       return false;
+}
+
+static inline bool use_multiport(struct ports_device *portdev)
+{
+       /*
+        * This condition can be true when put_chars is called from
+        * early_init
+        */
+       if (!portdev->vdev)
+               return 0;
+       return portdev->vdev->features[0] & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+}
 
-/* This is our input buffer, and how much data is left in it. */
-static unsigned int in_len;
-static char *in, *inbuf;
+static void free_buf(struct port_buffer *buf)
+{
+       kfree(buf->buf);
+       kfree(buf);
+}
+
+static struct port_buffer *alloc_buf(size_t buf_size)
+{
+       struct port_buffer *buf;
 
-/* The operations for our console. */
-static struct hv_ops virtio_cons;
+       buf = kmalloc(sizeof(*buf), GFP_KERNEL);
+       if (!buf)
+               goto fail;
+       buf->buf = kzalloc(buf_size, GFP_KERNEL);
+       if (!buf->buf)
+               goto free_buf;
+       buf->len = 0;
+       buf->offset = 0;
+       buf->size = buf_size;
+       return buf;
+
+free_buf:
+       kfree(buf);
+fail:
+       return NULL;
+}
+
+/* Callers should take appropriate locks */
+static void *get_inbuf(struct port *port)
+{
+       struct port_buffer *buf;
+       struct virtqueue *vq;
+       unsigned int len;
 
-/* The hvc device */
-static struct hvc_struct *hvc;
+       vq = port->in_vq;
+       buf = vq->vq_ops->get_buf(vq, &len);
+       if (buf) {
+               buf->len = len;
+               buf->offset = 0;
+       }
+       return buf;
+}
 
-/*D:310 The put_chars() callback is pretty straightforward.
+/*
+ * Create a scatter-gather list representing our input buffer and put
+ * it in the queue.
  *
- * We turn the characters into a scatter-gather list, add it to the output
- * queue and then kick the Host.  Then we sit here waiting for it to finish:
- * inefficient in theory, but in practice implementations will do it
- * immediately (lguest's Launcher does). */
-static int put_chars(u32 vtermno, const char *buf, int count)
+ * Callers should take appropriate locks.
+ */
+static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
 {
        struct scatterlist sg[1];
+       int ret;
+
+       sg_init_one(sg, buf->buf, buf->size);
+
+       ret = vq->vq_ops->add_buf(vq, sg, 0, 1, buf);
+       vq->vq_ops->kick(vq);
+       return ret;
+}
+
+/* Discard any unread data this port has. Callers lockers. */
+static void discard_port_data(struct port *port)
+{
+       struct port_buffer *buf;
+       struct virtqueue *vq;
        unsigned int len;
+       int ret;
 
-       /* This is a convenient routine to initialize a single-elem sg list */
-       sg_init_one(sg, buf, count);
+       vq = port->in_vq;
+       if (port->inbuf)
+               buf = port->inbuf;
+       else
+               buf = vq->vq_ops->get_buf(vq, &len);
 
-       /* add_buf wants a token to identify this buffer: we hand it any
-        * non-NULL pointer, since there's only ever one buffer. */
-       if (out_vq->vq_ops->add_buf(out_vq, sg, 1, 0, (void *)1) >= 0) {
-               /* Tell Host to go! */
-               out_vq->vq_ops->kick(out_vq);
-               /* Chill out until it's done with the buffer. */
-               while (!out_vq->vq_ops->get_buf(out_vq, &len))
-                       cpu_relax();
+       ret = 0;
+       while (buf) {
+               if (add_inbuf(vq, buf) < 0) {
+                       ret++;
+                       free_buf(buf);
+               }
+               buf = vq->vq_ops->get_buf(vq, &len);
        }
+       port->inbuf = NULL;
+       if (ret)
+               dev_warn(port->dev, "Errors adding %d buffers back to vq\n",
+                        ret);
+}
 
-       /* We're expected to return the amount of data we wrote: all of it. */
-       return count;
+static bool port_has_data(struct port *port)
+{
+       unsigned long flags;
+       bool ret;
+
+       spin_lock_irqsave(&port->inbuf_lock, flags);
+       if (port->inbuf) {
+               ret = true;
+               goto out;
+       }
+       port->inbuf = get_inbuf(port);
+       if (port->inbuf) {
+               ret = true;
+               goto out;
+       }
+       ret = false;
+out:
+       spin_unlock_irqrestore(&port->inbuf_lock, flags);
+       return ret;
 }
 
-/* Create a scatter-gather list representing our input buffer and put it in the
- * queue. */
-static void add_inbuf(void)
+static ssize_t send_control_msg(struct port *port, unsigned int event,
+                               unsigned int value)
 {
        struct scatterlist sg[1];
-       sg_init_one(sg, inbuf, PAGE_SIZE);
+       struct virtio_console_control cpkt;
+       struct virtqueue *vq;
+       int len;
+
+       if (!use_multiport(port->portdev))
+               return 0;
+
+       cpkt.id = port->id;
+       cpkt.event = event;
+       cpkt.value = value;
+
+       vq = port->portdev->c_ovq;
 
-       /* We should always be able to add one buffer to an empty queue. */
-       if (in_vq->vq_ops->add_buf(in_vq, sg, 0, 1, inbuf) < 0)
-               BUG();
-       in_vq->vq_ops->kick(in_vq);
+       sg_init_one(sg, &cpkt, sizeof(cpkt));
+       if (vq->vq_ops->add_buf(vq, sg, 1, 0, &cpkt) >= 0) {
+               vq->vq_ops->kick(vq);
+               while (!vq->vq_ops->get_buf(vq, &len))
+                       cpu_relax();
+       }
+       return 0;
 }
 
-/*D:350 get_chars() is the callback from the hvc_console infrastructure when
- * an interrupt is received.
- *
- * Most of the code deals with the fact that the hvc_console() infrastructure
- * only asks us for 16 bytes at a time.  We keep in_offset and in_used fields
- * for partially-filled buffers. */
-static int get_chars(u32 vtermno, char *buf, int count)
+static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count)
 {
-       /* If we don't have an input queue yet, we can't get input. */
-       BUG_ON(!in_vq);
+       struct scatterlist sg[1];
+       struct virtqueue *out_vq;
+       ssize_t ret;
+       unsigned int len;
+
+       out_vq = port->out_vq;
+
+       sg_init_one(sg, in_buf, in_count);
+       ret = out_vq->vq_ops->add_buf(out_vq, sg, 1, 0, in_buf);
+
+       /* Tell Host to go! */
+       out_vq->vq_ops->kick(out_vq);
+
+       if (ret < 0) {
+               len = 0;
+               goto fail;
+       }
+
+       /*
+        * Wait till the host acknowledges it pushed out the data we
+        * sent. Also ensure we return to userspace the number of
+        * bytes that were successfully consumed by the host.
+        */
+       while (!out_vq->vq_ops->get_buf(out_vq, &len))
+               cpu_relax();
+fail:
+       /* We're expected to return the amount of data we wrote */
+       return len;
+}
+
+/*
+ * Give out the data that's requested from the buffer that we have
+ * queued up.
+ */
+static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count,
+                           bool to_user)
+{
+       struct port_buffer *buf;
+       unsigned long flags;
+
+       if (!out_count || !port_has_data(port))
+               return 0;
+
+       buf = port->inbuf;
+       out_count = min(out_count, buf->len - buf->offset);
+
+       if (to_user) {
+               ssize_t ret;
+
+               ret = copy_to_user(out_buf, buf->buf + buf->offset, out_count);
+               if (ret)
+                       return -EFAULT;
+       } else {
+               memcpy(out_buf, buf->buf + buf->offset, out_count);
+       }
+
+       buf->offset += out_count;
+
+       if (buf->offset == buf->len) {
+               /*
+                * We're done using all the data in this buffer.
+                * Re-queue so that the Host can send us more data.
+                */
+               spin_lock_irqsave(&port->inbuf_lock, flags);
+               port->inbuf = NULL;
+
+               if (add_inbuf(port->in_vq, buf) < 0)
+                       dev_warn(port->dev, "failed add_buf\n");
+
+               spin_unlock_irqrestore(&port->inbuf_lock, flags);
+       }
+       /* Return the number of bytes actually copied */
+       return out_count;
+}
 
-       /* No buffer?  Try to get one. */
-       if (!in_len) {
-               in = in_vq->vq_ops->get_buf(in_vq, &in_len);
-               if (!in)
+/* The condition that must be true for polling to end */
+static bool wait_is_over(struct port *port)
+{
+       return port_has_data(port) || !port->host_connected;
+}
+
+static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
+                             size_t count, loff_t *offp)
+{
+       struct port *port;
+       ssize_t ret;
+
+       port = filp->private_data;
+
+       if (!port_has_data(port)) {
+               /*
+                * If nothing's connected on the host just return 0 in
+                * case of list_empty; this tells the userspace app
+                * that there's no connection
+                */
+               if (!port->host_connected)
                        return 0;
+               if (filp->f_flags & O_NONBLOCK)
+                       return -EAGAIN;
+
+               ret = wait_event_interruptible(port->waitqueue,
+                                              wait_is_over(port));
+               if (ret < 0)
+                       return ret;
+       }
+       /*
+        * We could've received a disconnection message while we were
+        * waiting for more data.
+        *
+        * This check is not clubbed in the if() statement above as we
+        * might receive some data as well as the host could get
+        * disconnected after we got woken up from our wait.  So we
+        * really want to give off whatever data we have and only then
+        * check for host_connected.
+        */
+       if (!port_has_data(port) && !port->host_connected)
+               return 0;
+
+       return fill_readbuf(port, ubuf, count, true);
+}
+
+static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
+                              size_t count, loff_t *offp)
+{
+       struct port *port;
+       char *buf;
+       ssize_t ret;
+
+       port = filp->private_data;
+
+       count = min((size_t)(32 * 1024), count);
+
+       buf = kmalloc(count, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       ret = copy_from_user(buf, ubuf, count);
+       if (ret) {
+               ret = -EFAULT;
+               goto free_buf;
        }
 
-       /* You want more than we have to give?  Well, try wanting less! */
-       if (in_len < count)
-               count = in_len;
+       ret = send_buf(port, buf, count);
+free_buf:
+       kfree(buf);
+       return ret;
+}
+
+static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
+{
+       struct port *port;
+       unsigned int ret;
+
+       port = filp->private_data;
+       poll_wait(filp, &port->waitqueue, wait);
+
+       ret = 0;
+       if (port->inbuf)
+               ret |= POLLIN | POLLRDNORM;
+       if (port->host_connected)
+               ret |= POLLOUT;
+       if (!port->host_connected)
+               ret |= POLLHUP;
+
+       return ret;
+}
+
+static int port_fops_release(struct inode *inode, struct file *filp)
+{
+       struct port *port;
+
+       port = filp->private_data;
+
+       /* Notify host of port being closed */
+       send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
+
+       spin_lock_irq(&port->inbuf_lock);
+       port->guest_connected = false;
+
+       discard_port_data(port);
+
+       spin_unlock_irq(&port->inbuf_lock);
+
+       return 0;
+}
+
+static int port_fops_open(struct inode *inode, struct file *filp)
+{
+       struct cdev *cdev = inode->i_cdev;
+       struct port *port;
+
+       port = container_of(cdev, struct port, cdev);
+       filp->private_data = port;
+
+       /*
+        * Don't allow opening of console port devices -- that's done
+        * via /dev/hvc
+        */
+       if (is_console_port(port))
+               return -ENXIO;
+
+       /* Allow only one process to open a particular port at a time */
+       spin_lock_irq(&port->inbuf_lock);
+       if (port->guest_connected) {
+               spin_unlock_irq(&port->inbuf_lock);
+               return -EMFILE;
+       }
 
-       /* Copy across to their buffer and increment offset. */
-       memcpy(buf, in, count);
-       in += count;
-       in_len -= count;
+       port->guest_connected = true;
+       spin_unlock_irq(&port->inbuf_lock);
 
-       /* Finished?  Re-register buffer so Host will use it again. */
-       if (in_len == 0)
-               add_inbuf();
+       /* Notify host of port being opened */
+       send_control_msg(filp->private_data, VIRTIO_CONSOLE_PORT_OPEN, 1);
 
-       return count;
+       return 0;
 }
-/*:*/
 
-/*D:320 Console drivers are initialized very early so boot messages can go out,
- * so we do things slightly differently from the generic virtio initialization
- * of the net and block drivers.
+/*
+ * The file operations that we support: programs in the guest can open
+ * a console device, read from it, write to it, poll for data and
+ * close it.  The devices are at
+ *   /dev/vport<device number>p<port number>
+ */
+static const struct file_operations port_fops = {
+       .owner = THIS_MODULE,
+       .open  = port_fops_open,
+       .read  = port_fops_read,
+       .write = port_fops_write,
+       .poll  = port_fops_poll,
+       .release = port_fops_release,
+};
+
+/*
+ * The put_chars() callback is pretty straightforward.
  *
- * At this stage, the console is output-only.  It's too early to set up a
- * virtqueue, so we let the drivers do some boutique early-output thing. */
-int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
+ * We turn the characters into a scatter-gather list, add it to the
+ * output queue and then kick the Host.  Then we sit here waiting for
+ * it to finish: inefficient in theory, but in practice
+ * implementations will do it immediately (lguest's Launcher does).
+ */
+static int put_chars(u32 vtermno, const char *buf, int count)
 {
-       virtio_cons.put_chars = put_chars;
-       return hvc_instantiate(0, 0, &virtio_cons);
+       struct port *port;
+
+       port = find_port_by_vtermno(vtermno);
+       if (!port)
+               return 0;
+
+       if (unlikely(early_put_chars))
+               return early_put_chars(vtermno, buf, count);
+
+       return send_buf(port, (void *)buf, count);
 }
 
 /*
- * virtio console configuration. This supports:
- * - console resize
+ * get_chars() is the callback from the hvc_console infrastructure
+ * when an interrupt is received.
+ *
+ * We call out to fill_readbuf that gets us the required data from the
+ * buffers that are queued up.
  */
-static void virtcons_apply_config(struct virtio_device *dev)
+static int get_chars(u32 vtermno, char *buf, int count)
 {
+       struct port *port;
+
+       port = find_port_by_vtermno(vtermno);
+       if (!port)
+               return 0;
+
+       /* If we don't have an input queue yet, we can't get input. */
+       BUG_ON(!port->in_vq);
+
+       return fill_readbuf(port, buf, count, false);
+}
+
+static void resize_console(struct port *port)
+{
+       struct virtio_device *vdev;
        struct winsize ws;
 
-       if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) {
-               dev->config->get(dev,
-                                offsetof(struct virtio_console_config, cols),
-                                &ws.ws_col, sizeof(u16));
-               dev->config->get(dev,
-                                offsetof(struct virtio_console_config, rows),
-                                &ws.ws_row, sizeof(u16));
-               hvc_resize(hvc, ws);
+       vdev = port->portdev->vdev;
+       if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
+               vdev->config->get(vdev,
+                                 offsetof(struct virtio_console_config, cols),
+                                 &ws.ws_col, sizeof(u16));
+               vdev->config->get(vdev,
+                                 offsetof(struct virtio_console_config, rows),
+                                 &ws.ws_row, sizeof(u16));
+               hvc_resize(port->cons.hvc, ws);
        }
 }
 
-/*
- * we support only one console, the hvc struct is a global var
- * We set the configuration at this point, since we now have a tty
- */
+/* We set the configuration at this point, since we now have a tty */
 static int notifier_add_vio(struct hvc_struct *hp, int data)
 {
+       struct port *port;
+
+       port = find_port_by_vtermno(hp->vtermno);
+       if (!port)
+               return -EINVAL;
+
        hp->irq_requested = 1;
-       virtcons_apply_config(vdev);
+       resize_console(port);
 
        return 0;
 }
@@ -173,79 +713,797 @@ static void notifier_del_vio(struct hvc_struct *hp, int data)
        hp->irq_requested = 0;
 }
 
-static void hvc_handle_input(struct virtqueue *vq)
+/* The operations for console ports. */
+static const struct hv_ops hv_ops = {
+       .get_chars = get_chars,
+       .put_chars = put_chars,
+       .notifier_add = notifier_add_vio,
+       .notifier_del = notifier_del_vio,
+       .notifier_hangup = notifier_del_vio,
+};
+
+/*
+ * Console drivers are initialized very early so boot messages can go
+ * out, so we do things slightly differently from the generic virtio
+ * initialization of the net and block drivers.
+ *
+ * At this stage, the console is output-only.  It's too early to set
+ * up a virtqueue, so we let the drivers do some boutique early-output
+ * thing.
+ */
+int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
 {
-       if (hvc_poll(hvc))
+       early_put_chars = put_chars;
+       return hvc_instantiate(0, 0, &hv_ops);
+}
+
+int init_port_console(struct port *port)
+{
+       int ret;
+
+       /*
+        * The Host's telling us this port is a console port.  Hook it
+        * up with an hvc console.
+        *
+        * To set up and manage our virtual console, we call
+        * hvc_alloc().
+        *
+        * The first argument of hvc_alloc() is the virtual console
+        * number.  The second argument is the parameter for the
+        * notification mechanism (like irq number).  We currently
+        * leave this as zero, virtqueues have implicit notifications.
+        *
+        * The third argument is a "struct hv_ops" containing the
+        * put_chars() get_chars(), notifier_add() and notifier_del()
+        * pointers.  The final argument is the output buffer size: we
+        * can do any size, so we put PAGE_SIZE here.
+        */
+       port->cons.vtermno = pdrvdata.next_vtermno;
+
+       port->cons.hvc = hvc_alloc(port->cons.vtermno, 0, &hv_ops, PAGE_SIZE);
+       if (IS_ERR(port->cons.hvc)) {
+               ret = PTR_ERR(port->cons.hvc);
+               dev_err(port->dev,
+                       "error %d allocating hvc for port\n", ret);
+               port->cons.hvc = NULL;
+               return ret;
+       }
+       spin_lock_irq(&pdrvdata_lock);
+       pdrvdata.next_vtermno++;
+       list_add_tail(&port->cons.list, &pdrvdata.consoles);
+       spin_unlock_irq(&pdrvdata_lock);
+       port->guest_connected = true;
+
+       /* Notify host of port being opened */
+       send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
+
+       return 0;
+}
+
+static ssize_t show_port_name(struct device *dev,
+                             struct device_attribute *attr, char *buffer)
+{
+       struct port *port;
+
+       port = dev_get_drvdata(dev);
+
+       return sprintf(buffer, "%s\n", port->name);
+}
+
+static DEVICE_ATTR(name, S_IRUGO, show_port_name, NULL);
+
+static struct attribute *port_sysfs_entries[] = {
+       &dev_attr_name.attr,
+       NULL
+};
+
+static struct attribute_group port_attribute_group = {
+       .name = NULL,           /* put in device directory */
+       .attrs = port_sysfs_entries,
+};
+
+static int debugfs_open(struct inode *inode, struct file *filp)
+{
+       filp->private_data = inode->i_private;
+       return 0;
+}
+
+static ssize_t debugfs_read(struct file *filp, char __user *ubuf,
+                           size_t count, loff_t *offp)
+{
+       struct port *port;
+       char *buf;
+       ssize_t ret, out_offset, out_count;
+
+       out_count = 1024;
+       buf = kmalloc(out_count, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       port = filp->private_data;
+       out_offset = 0;
+       out_offset += snprintf(buf + out_offset, out_count,
+                              "name: %s\n", port->name ? port->name : "");
+       out_offset += snprintf(buf + out_offset, out_count - out_offset,
+                              "guest_connected: %d\n", port->guest_connected);
+       out_offset += snprintf(buf + out_offset, out_count - out_offset,
+                              "host_connected: %d\n", port->host_connected);
+       out_offset += snprintf(buf + out_offset, out_count - out_offset,
+                              "is_console: %s\n",
+                              is_console_port(port) ? "yes" : "no");
+       out_offset += snprintf(buf + out_offset, out_count - out_offset,
+                              "console_vtermno: %u\n", port->cons.vtermno);
+
+       ret = simple_read_from_buffer(ubuf, count, offp, buf, out_offset);
+       kfree(buf);
+       return ret;
+}
+
+static const struct file_operations port_debugfs_ops = {
+       .owner = THIS_MODULE,
+       .open  = debugfs_open,
+       .read  = debugfs_read,
+};
+
+/* Remove all port-specific data. */
+static int remove_port(struct port *port)
+{
+       struct port_buffer *buf;
+
+       spin_lock_irq(&port->portdev->ports_lock);
+       list_del(&port->list);
+       spin_unlock_irq(&port->portdev->ports_lock);
+
+       if (is_console_port(port)) {
+               spin_lock_irq(&pdrvdata_lock);
+               list_del(&port->cons.list);
+               spin_unlock_irq(&pdrvdata_lock);
+               hvc_remove(port->cons.hvc);
+       }
+       if (port->guest_connected)
+               send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
+
+       sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
+       device_destroy(pdrvdata.class, port->dev->devt);
+       cdev_del(&port->cdev);
+
+       /* Remove unused data this port might have received. */
+       discard_port_data(port);
+
+       /* Remove buffers we queued up for the Host to send us data in. */
+       while ((buf = port->in_vq->vq_ops->detach_unused_buf(port->in_vq)))
+               free_buf(buf);
+
+       kfree(port->name);
+
+       debugfs_remove(port->debugfs_file);
+
+       kfree(port);
+       return 0;
+}
+
+/* Any private messages that the Host and Guest want to share */
+static void handle_control_message(struct ports_device *portdev,
+                                  struct port_buffer *buf)
+{
+       struct virtio_console_control *cpkt;
+       struct port *port;
+       size_t name_size;
+       int err;
+
+       cpkt = (struct virtio_console_control *)(buf->buf + buf->offset);
+
+       port = find_port_by_id(portdev, cpkt->id);
+       if (!port) {
+               /* No valid header at start of buffer.  Drop it. */
+               dev_dbg(&portdev->vdev->dev,
+                       "Invalid index %u in control packet\n", cpkt->id);
+               return;
+       }
+
+       switch (cpkt->event) {
+       case VIRTIO_CONSOLE_CONSOLE_PORT:
+               if (!cpkt->value)
+                       break;
+               if (is_console_port(port))
+                       break;
+
+               init_port_console(port);
+               /*
+                * Could remove the port here in case init fails - but
+                * have to notify the host first.
+                */
+               break;
+       case VIRTIO_CONSOLE_RESIZE:
+               if (!is_console_port(port))
+                       break;
+               port->cons.hvc->irq_requested = 1;
+               resize_console(port);
+               break;
+       case VIRTIO_CONSOLE_PORT_OPEN:
+               port->host_connected = cpkt->value;
+               wake_up_interruptible(&port->waitqueue);
+               break;
+       case VIRTIO_CONSOLE_PORT_NAME:
+               /*
+                * Skip the size of the header and the cpkt to get the size
+                * of the name that was sent
+                */
+               name_size = buf->len - buf->offset - sizeof(*cpkt) + 1;
+
+               port->name = kmalloc(name_size, GFP_KERNEL);
+               if (!port->name) {
+                       dev_err(port->dev,
+                               "Not enough space to store port name\n");
+                       break;
+               }
+               strncpy(port->name, buf->buf + buf->offset + sizeof(*cpkt),
+                       name_size - 1);
+               port->name[name_size - 1] = 0;
+
+               /*
+                * Since we only have one sysfs attribute, 'name',
+                * create it only if we have a name for the port.
+                */
+               err = sysfs_create_group(&port->dev->kobj,
+                                        &port_attribute_group);
+               if (err)
+                       dev_err(port->dev,
+                               "Error %d creating sysfs device attributes\n",
+                               err);
+
+               break;
+       case VIRTIO_CONSOLE_PORT_REMOVE:
+               /*
+                * Hot unplug the port.  We don't decrement nr_ports
+                * since we don't want to deal with extra complexities
+                * of using the lowest-available port id: We can just
+                * pick up the nr_ports number as the id and not have
+                * userspace send it to us.  This helps us in two
+                * ways:
+                *
+                * - We don't need to have a 'port_id' field in the
+                *   config space when a port is hot-added.  This is a
+                *   good thing as we might queue up multiple hotplug
+                *   requests issued in our workqueue.
+                *
+                * - Another way to deal with this would have been to
+                *   use a bitmap of the active ports and select the
+                *   lowest non-active port from that map.  That
+                *   bloats the already tight config space and we
+                *   would end up artificially limiting the
+                *   max. number of ports to sizeof(bitmap).  Right
+                *   now we can support 2^32 ports (as the port id is
+                *   stored in a u32 type).
+                *
+                */
+               remove_port(port);
+               break;
+       }
+}
+
+static void control_work_handler(struct work_struct *work)
+{
+       struct ports_device *portdev;
+       struct virtqueue *vq;
+       struct port_buffer *buf;
+       unsigned int len;
+
+       portdev = container_of(work, struct ports_device, control_work);
+       vq = portdev->c_ivq;
+
+       spin_lock(&portdev->cvq_lock);
+       while ((buf = vq->vq_ops->get_buf(vq, &len))) {
+               spin_unlock(&portdev->cvq_lock);
+
+               buf->len = len;
+               buf->offset = 0;
+
+               handle_control_message(portdev, buf);
+
+               spin_lock(&portdev->cvq_lock);
+               if (add_inbuf(portdev->c_ivq, buf) < 0) {
+                       dev_warn(&portdev->vdev->dev,
+                                "Error adding buffer to queue\n");
+                       free_buf(buf);
+               }
+       }
+       spin_unlock(&portdev->cvq_lock);
+}
+
+static void in_intr(struct virtqueue *vq)
+{
+       struct port *port;
+       unsigned long flags;
+
+       port = find_port_by_vq(vq->vdev->priv, vq);
+       if (!port)
+               return;
+
+       spin_lock_irqsave(&port->inbuf_lock, flags);
+       if (!port->inbuf)
+               port->inbuf = get_inbuf(port);
+
+       /*
+        * Don't queue up data when port is closed.  This condition
+        * can be reached when a console port is not yet connected (no
+        * tty is spawned) and the host sends out data to console
+        * ports.  For generic serial ports, the host won't
+        * (shouldn't) send data till the guest is connected.
+        */
+       if (!port->guest_connected)
+               discard_port_data(port);
+
+       spin_unlock_irqrestore(&port->inbuf_lock, flags);
+
+       wake_up_interruptible(&port->waitqueue);
+
+       if (is_console_port(port) && hvc_poll(port->cons.hvc))
                hvc_kick();
 }
 
-/*D:370 Once we're further in boot, we get probed like any other virtio device.
- * At this stage we set up the output virtqueue.
- *
- * To set up and manage our virtual console, we call hvc_alloc().  Since we
- * never remove the console device we never need this pointer again.
+static void control_intr(struct virtqueue *vq)
+{
+       struct ports_device *portdev;
+
+       portdev = vq->vdev->priv;
+       schedule_work(&portdev->control_work);
+}
+
+static void config_intr(struct virtio_device *vdev)
+{
+       struct ports_device *portdev;
+
+       portdev = vdev->priv;
+       if (use_multiport(portdev)) {
+               /* Handle port hot-add */
+               schedule_work(&portdev->config_work);
+       }
+       /*
+        * We'll use this way of resizing only for legacy support.
+        * For newer userspace (VIRTIO_CONSOLE_F_MULTPORT+), use
+        * control messages to indicate console size changes so that
+        * it can be done per-port
+        */
+       resize_console(find_port_by_id(portdev, 0));
+}
+
+static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock)
+{
+       struct port_buffer *buf;
+       unsigned int ret;
+       int err;
+
+       ret = 0;
+       do {
+               buf = alloc_buf(PAGE_SIZE);
+               if (!buf)
+                       break;
+
+               spin_lock_irq(lock);
+               err = add_inbuf(vq, buf);
+               if (err < 0) {
+                       spin_unlock_irq(lock);
+                       free_buf(buf);
+                       break;
+               }
+               ret++;
+               spin_unlock_irq(lock);
+       } while (err > 0);
+
+       return ret;
+}
+
+static int add_port(struct ports_device *portdev, u32 id)
+{
+       char debugfs_name[16];
+       struct port *port;
+       struct port_buffer *buf;
+       dev_t devt;
+       int err;
+
+       port = kmalloc(sizeof(*port), GFP_KERNEL);
+       if (!port) {
+               err = -ENOMEM;
+               goto fail;
+       }
+
+       port->portdev = portdev;
+       port->id = id;
+
+       port->name = NULL;
+       port->inbuf = NULL;
+       port->cons.hvc = NULL;
+
+       port->host_connected = port->guest_connected = false;
+
+       port->in_vq = portdev->in_vqs[port->id];
+       port->out_vq = portdev->out_vqs[port->id];
+
+       cdev_init(&port->cdev, &port_fops);
+
+       devt = MKDEV(portdev->chr_major, id);
+       err = cdev_add(&port->cdev, devt, 1);
+       if (err < 0) {
+               dev_err(&port->portdev->vdev->dev,
+                       "Error %d adding cdev for port %u\n", err, id);
+               goto free_port;
+       }
+       port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev,
+                                 devt, port, "vport%up%u",
+                                 port->portdev->drv_index, id);
+       if (IS_ERR(port->dev)) {
+               err = PTR_ERR(port->dev);
+               dev_err(&port->portdev->vdev->dev,
+                       "Error %d creating device for port %u\n",
+                       err, id);
+               goto free_cdev;
+       }
+
+       spin_lock_init(&port->inbuf_lock);
+       init_waitqueue_head(&port->waitqueue);
+
+       /* Fill the in_vq with buffers so the host can send us data. */
+       err = fill_queue(port->in_vq, &port->inbuf_lock);
+       if (!err) {
+               dev_err(port->dev, "Error allocating inbufs\n");
+               err = -ENOMEM;
+               goto free_device;
+       }
+
+       /*
+        * If we're not using multiport support, this has to be a console port
+        */
+       if (!use_multiport(port->portdev)) {
+               err = init_port_console(port);
+               if (err)
+                       goto free_inbufs;
+       }
+
+       spin_lock_irq(&portdev->ports_lock);
+       list_add_tail(&port->list, &port->portdev->ports);
+       spin_unlock_irq(&portdev->ports_lock);
+
+       /*
+        * Tell the Host we're set so that it can send us various
+        * configuration parameters for this port (eg, port name,
+        * caching, whether this is a console port, etc.)
+        */
+       send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
+
+       if (pdrvdata.debugfs_dir) {
+               /*
+                * Finally, create the debugfs file that we can use to
+                * inspect a port's state at any time
+                */
+               sprintf(debugfs_name, "vport%up%u",
+                       port->portdev->drv_index, id);
+               port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
+                                                        pdrvdata.debugfs_dir,
+                                                        port,
+                                                        &port_debugfs_ops);
+       }
+       return 0;
+
+free_inbufs:
+       while ((buf = port->in_vq->vq_ops->detach_unused_buf(port->in_vq)))
+               free_buf(buf);
+free_device:
+       device_destroy(pdrvdata.class, port->dev->devt);
+free_cdev:
+       cdev_del(&port->cdev);
+free_port:
+       kfree(port);
+fail:
+       return err;
+}
+
+/*
+ * The workhandler for config-space updates.
  *
- * Finally we put our input buffer in the input queue, ready to receive. */
-static int __devinit virtcons_probe(struct virtio_device *dev)
+ * This is called when ports are hot-added.
+ */
+static void config_work_handler(struct work_struct *work)
+{
+       struct virtio_console_config virtconconf;
+       struct ports_device *portdev;
+       struct virtio_device *vdev;
+       int err;
+
+       portdev = container_of(work, struct ports_device, config_work);
+
+       vdev = portdev->vdev;
+       vdev->config->get(vdev,
+                         offsetof(struct virtio_console_config, nr_ports),
+                         &virtconconf.nr_ports,
+                         sizeof(virtconconf.nr_ports));
+
+       if (portdev->config.nr_ports == virtconconf.nr_ports) {
+               /*
+                * Port 0 got hot-added.  Since we already did all the
+                * other initialisation for it, just tell the Host
+                * that the port is ready if we find the port.  In
+                * case the port was hot-removed earlier, we call
+                * add_port to add the port.
+                */
+               struct port *port;
+
+               port = find_port_by_id(portdev, 0);
+               if (!port)
+                       add_port(portdev, 0);
+               else
+                       send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
+               return;
+       }
+       if (virtconconf.nr_ports > portdev->config.max_nr_ports) {
+               dev_warn(&vdev->dev,
+                        "More ports specified (%u) than allowed (%u)",
+                        portdev->config.nr_ports + 1,
+                        portdev->config.max_nr_ports);
+               return;
+       }
+       if (virtconconf.nr_ports < portdev->config.nr_ports)
+               return;
+
+       /* Hot-add ports */
+       while (virtconconf.nr_ports - portdev->config.nr_ports) {
+               err = add_port(portdev, portdev->config.nr_ports);
+               if (err)
+                       break;
+               portdev->config.nr_ports++;
+       }
+}
+
+static int init_vqs(struct ports_device *portdev)
 {
-       vq_callback_t *callbacks[] = { hvc_handle_input, NULL};
-       const char *names[] = { "input", "output" };
-       struct virtqueue *vqs[2];
+       vq_callback_t **io_callbacks;
+       char **io_names;
+       struct virtqueue **vqs;
+       u32 i, j, nr_ports, nr_queues;
        int err;
 
-       vdev = dev;
+       nr_ports = portdev->config.max_nr_ports;
+       nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
 
-       /* This is the scratch page we use to receive console input */
-       inbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-       if (!inbuf) {
+       vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
+       if (!vqs) {
                err = -ENOMEM;
                goto fail;
        }
+       io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL);
+       if (!io_callbacks) {
+               err = -ENOMEM;
+               goto free_vqs;
+       }
+       io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL);
+       if (!io_names) {
+               err = -ENOMEM;
+               goto free_callbacks;
+       }
+       portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *),
+                                 GFP_KERNEL);
+       if (!portdev->in_vqs) {
+               err = -ENOMEM;
+               goto free_names;
+       }
+       portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *),
+                                  GFP_KERNEL);
+       if (!portdev->out_vqs) {
+               err = -ENOMEM;
+               goto free_invqs;
+       }
+
+       /*
+        * For backward compat (newer host but older guest), the host
+        * spawns a console port first and also inits the vqs for port
+        * 0 before others.
+        */
+       j = 0;
+       io_callbacks[j] = in_intr;
+       io_callbacks[j + 1] = NULL;
+       io_names[j] = "input";
+       io_names[j + 1] = "output";
+       j += 2;
 
+       if (use_multiport(portdev)) {
+               io_callbacks[j] = control_intr;
+               io_callbacks[j + 1] = NULL;
+               io_names[j] = "control-i";
+               io_names[j + 1] = "control-o";
+
+               for (i = 1; i < nr_ports; i++) {
+                       j += 2;
+                       io_callbacks[j] = in_intr;
+                       io_callbacks[j + 1] = NULL;
+                       io_names[j] = "input";
+                       io_names[j + 1] = "output";
+               }
+       }
        /* Find the queues. */
-       /* FIXME: This is why we want to wean off hvc: we do nothing
-        * when input comes in. */
-       err = vdev->config->find_vqs(vdev, 2, vqs, callbacks, names);
+       err = portdev->vdev->config->find_vqs(portdev->vdev, nr_queues, vqs,
+                                             io_callbacks,
+                                             (const char **)io_names);
        if (err)
+               goto free_outvqs;
+
+       j = 0;
+       portdev->in_vqs[0] = vqs[0];
+       portdev->out_vqs[0] = vqs[1];
+       j += 2;
+       if (use_multiport(portdev)) {
+               portdev->c_ivq = vqs[j];
+               portdev->c_ovq = vqs[j + 1];
+
+               for (i = 1; i < nr_ports; i++) {
+                       j += 2;
+                       portdev->in_vqs[i] = vqs[j];
+                       portdev->out_vqs[i] = vqs[j + 1];
+               }
+       }
+       kfree(io_callbacks);
+       kfree(io_names);
+       kfree(vqs);
+
+       return 0;
+
+free_names:
+       kfree(io_names);
+free_callbacks:
+       kfree(io_callbacks);
+free_outvqs:
+       kfree(portdev->out_vqs);
+free_invqs:
+       kfree(portdev->in_vqs);
+free_vqs:
+       kfree(vqs);
+fail:
+       return err;
+}
+
+static const struct file_operations portdev_fops = {
+       .owner = THIS_MODULE,
+};
+
+/*
+ * Once we're further in boot, we get probed like any other virtio
+ * device.
+ *
+ * If the host also supports multiple console ports, we check the
+ * config space to see how many ports the host has spawned.  We
+ * initialize each port found.
+ */
+static int __devinit virtcons_probe(struct virtio_device *vdev)
+{
+       struct ports_device *portdev;
+       u32 i;
+       int err;
+       bool multiport;
+
+       portdev = kmalloc(sizeof(*portdev), GFP_KERNEL);
+       if (!portdev) {
+               err = -ENOMEM;
+               goto fail;
+       }
+
+       /* Attach this portdev to this virtio_device, and vice-versa. */
+       portdev->vdev = vdev;
+       vdev->priv = portdev;
+
+       spin_lock_irq(&pdrvdata_lock);
+       portdev->drv_index = pdrvdata.index++;
+       spin_unlock_irq(&pdrvdata_lock);
+
+       portdev->chr_major = register_chrdev(0, "virtio-portsdev",
+                                            &portdev_fops);
+       if (portdev->chr_major < 0) {
+               dev_err(&vdev->dev,
+                       "Error %d registering chrdev for device %u\n",
+                       portdev->chr_major, portdev->drv_index);
+               err = portdev->chr_major;
                goto free;
+       }
 
-       in_vq = vqs[0];
-       out_vq = vqs[1];
+       multiport = false;
+       portdev->config.nr_ports = 1;
+       portdev->config.max_nr_ports = 1;
+       if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
+               multiport = true;
+               vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT;
 
-       /* Start using the new console output. */
-       virtio_cons.get_chars = get_chars;
-       virtio_cons.put_chars = put_chars;
-       virtio_cons.notifier_add = notifier_add_vio;
-       virtio_cons.notifier_del = notifier_del_vio;
-       virtio_cons.notifier_hangup = notifier_del_vio;
-
-       /* The first argument of hvc_alloc() is the virtual console number, so
-        * we use zero.  The second argument is the parameter for the
-        * notification mechanism (like irq number). We currently leave this
-        * as zero, virtqueues have implicit notifications.
-        *
-        * The third argument is a "struct hv_ops" containing the put_chars()
-        * get_chars(), notifier_add() and notifier_del() pointers.
-        * The final argument is the output buffer size: we can do any size,
-        * so we put PAGE_SIZE here. */
-       hvc = hvc_alloc(0, 0, &virtio_cons, PAGE_SIZE);
-       if (IS_ERR(hvc)) {
-               err = PTR_ERR(hvc);
-               goto free_vqs;
+               vdev->config->get(vdev, offsetof(struct virtio_console_config,
+                                                nr_ports),
+                                 &portdev->config.nr_ports,
+                                 sizeof(portdev->config.nr_ports));
+               vdev->config->get(vdev, offsetof(struct virtio_console_config,
+                                                max_nr_ports),
+                                 &portdev->config.max_nr_ports,
+                                 sizeof(portdev->config.max_nr_ports));
+               if (portdev->config.nr_ports > portdev->config.max_nr_ports) {
+                       dev_warn(&vdev->dev,
+                                "More ports (%u) specified than allowed (%u). Will init %u ports.",
+                                portdev->config.nr_ports,
+                                portdev->config.max_nr_ports,
+                                portdev->config.max_nr_ports);
+
+                       portdev->config.nr_ports = portdev->config.max_nr_ports;
+               }
+       }
+
+       /* Let the Host know we support multiple ports.*/
+       vdev->config->finalize_features(vdev);
+
+       err = init_vqs(portdev);
+       if (err < 0) {
+               dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
+               goto free_chrdev;
+       }
+
+       spin_lock_init(&portdev->ports_lock);
+       INIT_LIST_HEAD(&portdev->ports);
+
+       if (multiport) {
+               spin_lock_init(&portdev->cvq_lock);
+               INIT_WORK(&portdev->control_work, &control_work_handler);
+               INIT_WORK(&portdev->config_work, &config_work_handler);
+
+               err = fill_queue(portdev->c_ivq, &portdev->cvq_lock);
+               if (!err) {
+                       dev_err(&vdev->dev,
+                               "Error allocating buffers for control queue\n");
+                       err = -ENOMEM;
+                       goto free_vqs;
+               }
        }
 
-       /* Register the input buffer the first time. */
-       add_inbuf();
+       for (i = 0; i < portdev->config.nr_ports; i++)
+               add_port(portdev, i);
+
+       /* Start using the new console output. */
+       early_put_chars = NULL;
        return 0;
 
 free_vqs:
        vdev->config->del_vqs(vdev);
+       kfree(portdev->in_vqs);
+       kfree(portdev->out_vqs);
+free_chrdev:
+       unregister_chrdev(portdev->chr_major, "virtio-portsdev");
 free:
-       kfree(inbuf);
+       kfree(portdev);
 fail:
        return err;
 }
 
+static void virtcons_remove(struct virtio_device *vdev)
+{
+       struct ports_device *portdev;
+       struct port *port, *port2;
+       struct port_buffer *buf;
+       unsigned int len;
+
+       portdev = vdev->priv;
+
+       cancel_work_sync(&portdev->control_work);
+       cancel_work_sync(&portdev->config_work);
+
+       list_for_each_entry_safe(port, port2, &portdev->ports, list)
+               remove_port(port);
+
+       unregister_chrdev(portdev->chr_major, "virtio-portsdev");
+
+       while ((buf = portdev->c_ivq->vq_ops->get_buf(portdev->c_ivq, &len)))
+               free_buf(buf);
+
+       while ((buf = portdev->c_ivq->vq_ops->detach_unused_buf(portdev->c_ivq)))
+               free_buf(buf);
+
+       vdev->config->del_vqs(vdev);
+       kfree(portdev->in_vqs);
+       kfree(portdev->out_vqs);
+
+       kfree(portdev);
+}
+
 static struct virtio_device_id id_table[] = {
        { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID },
        { 0 },
@@ -253,6 +1511,7 @@ static struct virtio_device_id id_table[] = {
 
 static unsigned int features[] = {
        VIRTIO_CONSOLE_F_SIZE,
+       VIRTIO_CONSOLE_F_MULTIPORT,
 };
 
 static struct virtio_driver virtio_console = {
@@ -262,14 +1521,41 @@ static struct virtio_driver virtio_console = {
        .driver.owner = THIS_MODULE,
        .id_table =     id_table,
        .probe =        virtcons_probe,
-       .config_changed = virtcons_apply_config,
+       .remove =       virtcons_remove,
+       .config_changed = config_intr,
 };
 
 static int __init init(void)
 {
+       int err;
+
+       pdrvdata.class = class_create(THIS_MODULE, "virtio-ports");
+       if (IS_ERR(pdrvdata.class)) {
+               err = PTR_ERR(pdrvdata.class);
+               pr_err("Error %d creating virtio-ports class\n", err);
+               return err;
+       }
+
+       pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
+       if (!pdrvdata.debugfs_dir) {
+               pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
+                          PTR_ERR(pdrvdata.debugfs_dir));
+       }
+       INIT_LIST_HEAD(&pdrvdata.consoles);
+
        return register_virtio_driver(&virtio_console);
 }
+
+static void __exit fini(void)
+{
+       unregister_virtio_driver(&virtio_console);
+
+       class_destroy(pdrvdata.class);
+       if (pdrvdata.debugfs_dir)
+               debugfs_remove_recursive(pdrvdata.debugfs_dir);
+}
 module_init(init);
+module_exit(fini);
 
 MODULE_DEVICE_TABLE(virtio, id_table);
 MODULE_DESCRIPTION("Virtio console driver");
index 994e1a58b987c0616b71fa485e7a8ea608959a39..8b24729fec89d2ebbee70dc3011d7fd2de670001 100644 (file)
@@ -136,7 +136,7 @@ static const struct tty_port_operations scc_port_ops = {
  * vme_scc_init() and support functions
  *---------------------------------------------------------------------------*/
 
-static int scc_init_drivers(void)
+static int __init scc_init_drivers(void)
 {
        int error;
 
@@ -172,7 +172,7 @@ static int scc_init_drivers(void)
 /* ports[] array is indexed by line no (i.e. [0] for ttyS0, [1] for ttyS1).
  */
 
-static void scc_init_portstructs(void)
+static void __init scc_init_portstructs(void)
 {
        struct scc_port *port;
        int i;
@@ -195,7 +195,7 @@ static void scc_init_portstructs(void)
 
 
 #ifdef CONFIG_MVME147_SCC
-static int mvme147_scc_init(void)
+static int __init mvme147_scc_init(void)
 {
        struct scc_port *port;
        int error;
@@ -298,7 +298,7 @@ fail:
 
 
 #ifdef CONFIG_MVME162_SCC
-static int mvme162_scc_init(void)
+static int __init mvme162_scc_init(void)
 {
        struct scc_port *port;
        int error;
@@ -404,7 +404,7 @@ fail:
 
 
 #ifdef CONFIG_BVME6000_SCC
-static int bvme6000_scc_init(void)
+static int __init bvme6000_scc_init(void)
 {
        struct scc_port *port;
        int error;
@@ -503,7 +503,7 @@ fail_free_b_rx:
 #endif
 
 
-static int vme_scc_init(void)
+static int __init vme_scc_init(void)
 {
        int res = -ENODEV;
 
index 27d20fac19d153a9fca968fb169dbed9c1490e3f..b314a999aabea67ad637b6ebfde64beef6cb3aaa 100644 (file)
@@ -21,7 +21,7 @@
 
 #define DRV_NAME "cs5535-clockevt"
 
-static int timer_irq = CONFIG_CS5535_MFGPT_DEFAULT_IRQ;
+static int timer_irq;
 module_param_named(irq, timer_irq, int, 0644);
 MODULE_PARM_DESC(irq, "Which IRQ to use for the clock source MFGPT ticks.");
 
index 6b3e0c2f33e2b193838fbecc0dda72aa9f0db5ef..578595c4425d2836cdf283eb44e0e1039e060fa5 100644 (file)
@@ -40,7 +40,6 @@ struct sh_cmt_priv {
        struct platform_device *pdev;
 
        unsigned long flags;
-       unsigned long flags_suspend;
        unsigned long match_value;
        unsigned long next_match_value;
        unsigned long max_match_value;
@@ -432,6 +431,11 @@ static void sh_cmt_clocksource_disable(struct clocksource *cs)
        sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE);
 }
 
+static void sh_cmt_clocksource_resume(struct clocksource *cs)
+{
+       sh_cmt_start(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE);
+}
+
 static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
                                       char *name, unsigned long rating)
 {
@@ -442,6 +446,8 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
        cs->read = sh_cmt_clocksource_read;
        cs->enable = sh_cmt_clocksource_enable;
        cs->disable = sh_cmt_clocksource_disable;
+       cs->suspend = sh_cmt_clocksource_disable;
+       cs->resume = sh_cmt_clocksource_resume;
        cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
        pr_info("sh_cmt: %s used as clock source\n", cs->name);
@@ -603,18 +609,13 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
        p->irqaction.handler = sh_cmt_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
-       ret = setup_irq(irq, &p->irqaction);
-       if (ret) {
-               pr_err("sh_cmt: failed to request irq %d\n", irq);
-               goto err1;
-       }
 
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, cfg->clk);
        if (IS_ERR(p->clk)) {
                pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk);
                ret = PTR_ERR(p->clk);
-               goto err2;
+               goto err1;
        }
 
        if (resource_size(res) == 6) {
@@ -627,14 +628,25 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
                p->clear_bits = ~0xc000;
        }
 
-       return sh_cmt_register(p, cfg->name,
-                              cfg->clockevent_rating,
-                              cfg->clocksource_rating);
- err2:
-       remove_irq(irq, &p->irqaction);
- err1:
+       ret = sh_cmt_register(p, cfg->name,
+                             cfg->clockevent_rating,
+                             cfg->clocksource_rating);
+       if (ret) {
+               pr_err("sh_cmt: registration failed\n");
+               goto err1;
+       }
+
+       ret = setup_irq(irq, &p->irqaction);
+       if (ret) {
+               pr_err("sh_cmt: failed to request irq %d\n", irq);
+               goto err1;
+       }
+
+       return 0;
+
+err1:
        iounmap(p->mapbase);
- err0:
+err0:
        return ret;
 }
 
@@ -668,38 +680,11 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev)
        return -EBUSY; /* cannot unregister clockevent and clocksource */
 }
 
-static int sh_cmt_suspend(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct sh_cmt_priv *p = platform_get_drvdata(pdev);
-
-       /* save flag state and stop CMT channel */
-       p->flags_suspend = p->flags;
-       sh_cmt_stop(p, p->flags);
-       return 0;
-}
-
-static int sh_cmt_resume(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct sh_cmt_priv *p = platform_get_drvdata(pdev);
-
-       /* start CMT channel from saved state */
-       sh_cmt_start(p, p->flags_suspend);
-       return 0;
-}
-
-static struct dev_pm_ops sh_cmt_dev_pm_ops = {
-       .suspend = sh_cmt_suspend,
-       .resume = sh_cmt_resume,
-};
-
 static struct platform_driver sh_cmt_device_driver = {
        .probe          = sh_cmt_probe,
        .remove         = __devexit_p(sh_cmt_remove),
        .driver         = {
                .name   = "sh_cmt",
-               .pm     = &sh_cmt_dev_pm_ops,
        }
 };
 
index 973e714d605147d7e2110eaae48a25b780d32bc7..4c8a759e60cdb56c14cf57002a9672f81100822e 100644 (file)
@@ -221,15 +221,15 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
        ced->cpumask = cpumask_of(0);
        ced->set_mode = sh_mtu2_clock_event_mode;
 
+       pr_info("sh_mtu2: %s used for clock events\n", ced->name);
+       clockevents_register_device(ced);
+
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
                pr_err("sh_mtu2: failed to request irq %d\n",
                       p->irqaction.irq);
                return;
        }
-
-       pr_info("sh_mtu2: %s used for clock events\n", ced->name);
-       clockevents_register_device(ced);
 }
 
 static int sh_mtu2_register(struct sh_mtu2_priv *p, char *name,
index 93c2322feab79e8e119d0b51949ac0b1bc42135d..961f5b5ef6a3584c558c45dbe20a05074fe325b1 100644 (file)
@@ -323,15 +323,15 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p,
        ced->set_next_event = sh_tmu_clock_event_next;
        ced->set_mode = sh_tmu_clock_event_mode;
 
+       pr_info("sh_tmu: %s used for clock events\n", ced->name);
+       clockevents_register_device(ced);
+
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
                pr_err("sh_tmu: failed to request irq %d\n",
                       p->irqaction.irq);
                return;
        }
-
-       pr_info("sh_tmu: %s used for clock events\n", ced->name);
-       clockevents_register_device(ced);
 }
 
 static int sh_tmu_register(struct sh_tmu_priv *p, char *name,
index f06024668f99d2abfd73d560804cf172d9ea19a8..537c29ac4487bea4e4d27313f442ddbbc0f35ddc 100644 (file)
@@ -36,17 +36,6 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
 MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector.");
 
-static u32 cn_idx = CN_IDX_CONNECTOR;
-static u32 cn_val = CN_VAL_CONNECTOR;
-
-module_param(cn_idx, uint, 0);
-module_param(cn_val, uint, 0);
-MODULE_PARM_DESC(cn_idx, "Connector's main device idx.");
-MODULE_PARM_DESC(cn_val, "Connector's main device val.");
-
-static DEFINE_MUTEX(notify_lock);
-static LIST_HEAD(notify_list);
-
 static struct cn_dev cdev;
 
 static int cn_already_initialized;
@@ -209,54 +198,6 @@ static void cn_rx_skb(struct sk_buff *__skb)
        }
 }
 
-/*
- * Notification routing.
- *
- * Gets id and checks if there are notification request for it's idx
- * and val.  If there are such requests notify the listeners with the
- * given notify event.
- *
- */
-static void cn_notify(struct cb_id *id, u32 notify_event)
-{
-       struct cn_ctl_entry *ent;
-
-       mutex_lock(&notify_lock);
-       list_for_each_entry(ent, &notify_list, notify_entry) {
-               int i;
-               struct cn_notify_req *req;
-               struct cn_ctl_msg *ctl = ent->msg;
-               int idx_found, val_found;
-
-               idx_found = val_found = 0;
-
-               req = (struct cn_notify_req *)ctl->data;
-               for (i = 0; i < ctl->idx_notify_num; ++i, ++req) {
-                       if (id->idx >= req->first &&
-                                       id->idx < req->first + req->range) {
-                               idx_found = 1;
-                               break;
-                       }
-               }
-
-               for (i = 0; i < ctl->val_notify_num; ++i, ++req) {
-                       if (id->val >= req->first &&
-                                       id->val < req->first + req->range) {
-                               val_found = 1;
-                               break;
-                       }
-               }
-
-               if (idx_found && val_found) {
-                       struct cn_msg m = { .ack = notify_event, };
-
-                       memcpy(&m.id, id, sizeof(m.id));
-                       cn_netlink_send(&m, ctl->group, GFP_KERNEL);
-               }
-       }
-       mutex_unlock(&notify_lock);
-}
-
 /*
  * Callback add routing - adds callback with given ID and name.
  * If there is registered callback with the same ID it will not be added.
@@ -276,8 +217,6 @@ int cn_add_callback(struct cb_id *id, char *name,
        if (err)
                return err;
 
-       cn_notify(id, 0);
-
        return 0;
 }
 EXPORT_SYMBOL_GPL(cn_add_callback);
@@ -295,111 +234,9 @@ void cn_del_callback(struct cb_id *id)
        struct cn_dev *dev = &cdev;
 
        cn_queue_del_callback(dev->cbdev, id);
-       cn_notify(id, 1);
 }
 EXPORT_SYMBOL_GPL(cn_del_callback);
 
-/*
- * Checks two connector's control messages to be the same.
- * Returns 1 if they are the same or if the first one is corrupted.
- */
-static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
-{
-       int i;
-       struct cn_notify_req *req1, *req2;
-
-       if (m1->idx_notify_num != m2->idx_notify_num)
-               return 0;
-
-       if (m1->val_notify_num != m2->val_notify_num)
-               return 0;
-
-       if (m1->len != m2->len)
-               return 0;
-
-       if ((m1->idx_notify_num + m1->val_notify_num) * sizeof(*req1) !=
-           m1->len)
-               return 1;
-
-       req1 = (struct cn_notify_req *)m1->data;
-       req2 = (struct cn_notify_req *)m2->data;
-
-       for (i = 0; i < m1->idx_notify_num; ++i) {
-               if (req1->first != req2->first || req1->range != req2->range)
-                       return 0;
-               req1++;
-               req2++;
-       }
-
-       for (i = 0; i < m1->val_notify_num; ++i) {
-               if (req1->first != req2->first || req1->range != req2->range)
-                       return 0;
-               req1++;
-               req2++;
-       }
-
-       return 1;
-}
-
-/*
- * Main connector device's callback.
- *
- * Used for notification of a request's processing.
- */
-static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
-{
-       struct cn_ctl_msg *ctl;
-       struct cn_ctl_entry *ent;
-       u32 size;
-
-       if (msg->len < sizeof(*ctl))
-               return;
-
-       ctl = (struct cn_ctl_msg *)msg->data;
-
-       size = (sizeof(*ctl) + ((ctl->idx_notify_num +
-                                ctl->val_notify_num) *
-                               sizeof(struct cn_notify_req)));
-
-       if (msg->len != size)
-               return;
-
-       if (ctl->len + sizeof(*ctl) != msg->len)
-               return;
-
-       /*
-        * Remove notification.
-        */
-       if (ctl->group == 0) {
-               struct cn_ctl_entry *n;
-
-               mutex_lock(&notify_lock);
-               list_for_each_entry_safe(ent, n, &notify_list, notify_entry) {
-                       if (cn_ctl_msg_equals(ent->msg, ctl)) {
-                               list_del(&ent->notify_entry);
-                               kfree(ent);
-                       }
-               }
-               mutex_unlock(&notify_lock);
-
-               return;
-       }
-
-       size += sizeof(*ent);
-
-       ent = kzalloc(size, GFP_KERNEL);
-       if (!ent)
-               return;
-
-       ent->msg = (struct cn_ctl_msg *)(ent + 1);
-
-       memcpy(ent->msg, ctl, size - sizeof(*ent));
-
-       mutex_lock(&notify_lock);
-       list_add(&ent->notify_entry, &notify_list);
-       mutex_unlock(&notify_lock);
-}
-
 static int cn_proc_show(struct seq_file *m, void *v)
 {
        struct cn_queue_dev *dev = cdev.cbdev;
@@ -437,11 +274,8 @@ static const struct file_operations cn_file_ops = {
 static int __devinit cn_init(void)
 {
        struct cn_dev *dev = &cdev;
-       int err;
 
        dev->input = cn_rx_skb;
-       dev->id.idx = cn_idx;
-       dev->id.val = cn_val;
 
        dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,
                                         CN_NETLINK_USERS + 0xf,
@@ -457,14 +291,6 @@ static int __devinit cn_init(void)
 
        cn_already_initialized = 1;
 
-       err = cn_add_callback(&dev->id, "connector", &cn_callback);
-       if (err) {
-               cn_already_initialized = 0;
-               cn_queue_free_dev(dev->cbdev);
-               netlink_kernel_release(dev->nls);
-               return -EINVAL;
-       }
-
        proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
 
        return 0;
@@ -478,7 +304,6 @@ static void __devexit cn_fini(void)
 
        proc_net_remove(&init_net, "connector");
 
-       cn_del_callback(&dev->id);
        cn_queue_free_dev(dev->cbdev);
        netlink_kernel_release(dev->nls);
 }
index 4b34ade2332baaa50bb1ca1af9c45e1a9893d321..bd444dc93cf2ebf55c3e8545be249c6f025b7308 100644 (file)
@@ -554,6 +554,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
                                (dbs_tuners_ins.up_threshold -
                                 dbs_tuners_ins.down_differential);
 
+               if (freq_next < policy->min)
+                       freq_next = policy->min;
+
                if (!dbs_tuners_ins.powersave_bias) {
                        __cpufreq_driver_target(policy, freq_next,
                                        CPUFREQ_RELATION_L);
index 46e899ac924e2104c231adb7ed189c6d807a725e..1c3849f6b7a2e6c65d68245c2af3809befe40325 100644 (file)
@@ -1274,7 +1274,7 @@ static int __exit crypto4xx_remove(struct of_device *ofdev)
        return 0;
 }
 
-static struct of_device_id crypto4xx_match[] = {
+static const struct of_device_id crypto4xx_match[] = {
        { .compatible      = "amcc,ppc4xx-crypto",},
        { },
 };
index 4801162919d9db389ac9acc9b19b8d56c94cf752..c7a5a43ba6919bf133b3fe3ea26be9097f4479fe 100644 (file)
@@ -135,13 +135,13 @@ static int geode_setkey_cip(struct crypto_tfm *tfm, const u8 *key,
        /*
         * The requested key size is not supported by HW, do a fallback
         */
-       op->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
-       op->fallback.blk->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK);
+       op->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
+       op->fallback.cip->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK);
 
        ret = crypto_cipher_setkey(op->fallback.cip, key, len);
        if (ret) {
                tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK;
-               tfm->crt_flags |= (op->fallback.blk->base.crt_flags & CRYPTO_TFM_RES_MASK);
+               tfm->crt_flags |= (op->fallback.cip->base.crt_flags & CRYPTO_TFM_RES_MASK);
        }
        return ret;
 }
@@ -263,7 +263,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
 
        if (IS_ERR(op->fallback.cip)) {
                printk(KERN_ERR "Error allocating fallback algo %s\n", name);
-               return PTR_ERR(op->fallback.blk);
+               return PTR_ERR(op->fallback.cip);
        }
 
        return 0;
index 0af80577dc7bbfd9d80f276765e5afb7d218c067..d3a27e0119bc2ebc907f9c82c10cedae05540a0c 100644 (file)
@@ -57,6 +57,23 @@ static int padlock_sha_update(struct shash_desc *desc,
        return crypto_shash_update(&dctx->fallback, data, length);
 }
 
+static int padlock_sha_export(struct shash_desc *desc, void *out)
+{
+       struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
+
+       return crypto_shash_export(&dctx->fallback, out);
+}
+
+static int padlock_sha_import(struct shash_desc *desc, const void *in)
+{
+       struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
+       struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm);
+
+       dctx->fallback.tfm = ctx->fallback;
+       dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
+       return crypto_shash_import(&dctx->fallback, in);
+}
+
 static inline void padlock_output_block(uint32_t *src,
                        uint32_t *dst, size_t count)
 {
@@ -235,7 +252,10 @@ static struct shash_alg sha1_alg = {
        .update         =       padlock_sha_update,
        .finup          =       padlock_sha1_finup,
        .final          =       padlock_sha1_final,
+       .export         =       padlock_sha_export,
+       .import         =       padlock_sha_import,
        .descsize       =       sizeof(struct padlock_sha_desc),
+       .statesize      =       sizeof(struct sha1_state),
        .base           =       {
                .cra_name               =       "sha1",
                .cra_driver_name        =       "sha1-padlock",
@@ -256,7 +276,10 @@ static struct shash_alg sha256_alg = {
        .update         =       padlock_sha_update,
        .finup          =       padlock_sha256_finup,
        .final          =       padlock_sha256_final,
+       .export         =       padlock_sha_export,
+       .import         =       padlock_sha_import,
        .descsize       =       sizeof(struct padlock_sha_desc),
+       .statesize      =       sizeof(struct sha256_state),
        .base           =       {
                .cra_name               =       "sha256",
                .cra_driver_name        =       "sha256-padlock",
index c47ffe8a73efecbf836aef8f0e2417fd7ec42ee5..fd529d68c5ba5e2494fc44d0ec33eca8741d951e 100644 (file)
@@ -1958,7 +1958,7 @@ err_out:
        return err;
 }
 
-static struct of_device_id talitos_match[] = {
+static const struct of_device_id talitos_match[] = {
        {
                .compatible = "fsl,sec2.0",
        },
index b5f2ee0f8e2c60e8389527e19cc522058b777b52..64a937262a401815179d8ea7e3295b6438ce6110 100644 (file)
@@ -613,8 +613,6 @@ static void dma_tasklet(unsigned long data)
        cohd_fin->pending_irqs--;
        cohc->completed = cohd_fin->desc.cookie;
 
-       BUG_ON(cohc->nbr_active_done && cohd_fin == NULL);
-
        if (cohc->nbr_active_done == 0)
                return;
 
index 6f51a0a7a8bbdbca798f53293516e178ead5f4d2..e7a3230fb7d5fcdcf78a347729653e5ff75feb03 100644 (file)
@@ -826,6 +826,7 @@ void dma_async_device_unregister(struct dma_device *device)
                chan->dev->chan = NULL;
                mutex_unlock(&dma_list_mutex);
                device_unregister(&chan->dev->device);
+               free_percpu(chan->local);
        }
 }
 EXPORT_SYMBOL(dma_async_device_unregister);
index 8b905161fbf443b4d14036e7a425755a76b4ab3e..948d563941c92e682ec7ed923cf829594597d037 100644 (file)
@@ -467,7 +467,7 @@ err_srcs:
 
        if (iterations > 0)
                while (!kthread_should_stop()) {
-                       DECLARE_WAIT_QUEUE_HEAD(wait_dmatest_exit);
+                       DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait_dmatest_exit);
                        interruptible_sleep_on(&wait_dmatest_exit);
                }
 
index 5f7a500e18d02636f1b94650202f6b2614323bb7..5cc37afe2bc14b829156b76c5d3c142960517886 100644 (file)
@@ -249,7 +249,7 @@ int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo)
        if (is_ioat_active(status) || is_ioat_idle(status))
                ioat_suspend(chan);
        while (is_ioat_active(status) || is_ioat_idle(status)) {
-               if (end && time_after(jiffies, end)) {
+               if (tmo && time_after(jiffies, end)) {
                        err = -ETIMEDOUT;
                        break;
                }
index 9a5bc1a7389e61abc82e78aee287934f13c2eef7..e80bae1673fa910f2a774fb455b28f4f61b05075 100644 (file)
@@ -761,12 +761,10 @@ static void ipu_select_buffer(enum ipu_channel channel, int buffer_n)
  * @buffer_n:  buffer number to update.
  *             0 or 1 are the only valid values.
  * @phyaddr:   buffer physical address.
- * @return:    Returns 0 on success or negative error code on failure. This
- *              function will fail if the buffer is set to ready.
  */
 /* Called under spin_lock(_irqsave)(&ichan->lock) */
-static int ipu_update_channel_buffer(struct idmac_channel *ichan,
-                                    int buffer_n, dma_addr_t phyaddr)
+static void ipu_update_channel_buffer(struct idmac_channel *ichan,
+                                     int buffer_n, dma_addr_t phyaddr)
 {
        enum ipu_channel channel = ichan->dma_chan.chan_id;
        uint32_t reg;
@@ -806,8 +804,6 @@ static int ipu_update_channel_buffer(struct idmac_channel *ichan,
        }
 
        spin_unlock_irqrestore(&ipu_data.lock, flags);
-
-       return 0;
 }
 
 /* Called under spin_lock_irqsave(&ichan->lock) */
@@ -816,7 +812,6 @@ static int ipu_submit_buffer(struct idmac_channel *ichan,
 {
        unsigned int chan_id = ichan->dma_chan.chan_id;
        struct device *dev = &ichan->dma_chan.dev->device;
-       int ret;
 
        if (async_tx_test_ack(&desc->txd))
                return -EINTR;
@@ -827,14 +822,7 @@ static int ipu_submit_buffer(struct idmac_channel *ichan,
         * could make it conditional on status >= IPU_CHANNEL_ENABLED, but
         * doing it again shouldn't hurt either.
         */
-       ret = ipu_update_channel_buffer(ichan, buf_idx,
-                                       sg_dma_address(sg));
-
-       if (ret < 0) {
-               dev_err(dev, "Updating sg %p on channel 0x%x buffer %d failed!\n",
-                       sg, chan_id, buf_idx);
-               return ret;
-       }
+       ipu_update_channel_buffer(ichan, buf_idx, sg_dma_address(sg));
 
        ipu_select_buffer(chan_id, buf_idx);
        dev_dbg(dev, "Updated sg %p on channel 0x%x buffer %d\n",
@@ -1379,10 +1367,11 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 
        if (likely(sgnew) &&
            ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
-               callback = desc->txd.callback;
-               callback_param = desc->txd.callback_param;
+               callback = descnew->txd.callback;
+               callback_param = descnew->txd.callback_param;
                spin_unlock(&ichan->lock);
-               callback(callback_param);
+               if (callback)
+                       callback(callback_param);
                spin_lock(&ichan->lock);
        }
 
index d10cc899c460619b072466805c078cb989c496dd..b75ce8b84c46ac2622af1000b3ff6095ffefaf43 100644 (file)
@@ -48,23 +48,20 @@ enum sh_dmae_desc_status {
  */
 #define RS_DEFAULT  (RS_DUAL)
 
+/* A bitmask with bits enough for enum sh_dmae_slave_chan_id */
+static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SHDMA_SLAVE_NUMBER)];
+
 static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all);
 
 #define SH_DMAC_CHAN_BASE(id) (dma_base_addr[id])
 static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg)
 {
-       ctrl_outl(data, (SH_DMAC_CHAN_BASE(sh_dc->id) + reg));
+       ctrl_outl(data, SH_DMAC_CHAN_BASE(sh_dc->id) + reg);
 }
 
 static u32 sh_dmae_readl(struct sh_dmae_chan *sh_dc, u32 reg)
 {
-       return ctrl_inl((SH_DMAC_CHAN_BASE(sh_dc->id) + reg));
-}
-
-static void dmae_init(struct sh_dmae_chan *sh_chan)
-{
-       u32 chcr = RS_DEFAULT; /* default is DUAL mode */
-       sh_dmae_writel(sh_chan, chcr, CHCR);
+       return ctrl_inl(SH_DMAC_CHAN_BASE(sh_dc->id) + reg);
 }
 
 /*
@@ -95,27 +92,30 @@ static int sh_dmae_rst(int id)
        return 0;
 }
 
-static int dmae_is_busy(struct sh_dmae_chan *sh_chan)
+static bool dmae_is_busy(struct sh_dmae_chan *sh_chan)
 {
        u32 chcr = sh_dmae_readl(sh_chan, CHCR);
-       if (chcr & CHCR_DE) {
-               if (!(chcr & CHCR_TE))
-                       return -EBUSY; /* working */
-       }
-       return 0; /* waiting */
+
+       if ((chcr & (CHCR_DE | CHCR_TE)) == CHCR_DE)
+               return true; /* working */
+
+       return false; /* waiting */
 }
 
-static inline unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan)
+static unsigned int ts_shift[] = TS_SHIFT;
+static inline unsigned int calc_xmit_shift(u32 chcr)
 {
-       u32 chcr = sh_dmae_readl(sh_chan, CHCR);
-       return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT];
+       int cnt = ((chcr & CHCR_TS_LOW_MASK) >> CHCR_TS_LOW_SHIFT) |
+               ((chcr & CHCR_TS_HIGH_MASK) >> CHCR_TS_HIGH_SHIFT);
+
+       return ts_shift[cnt];
 }
 
 static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw)
 {
        sh_dmae_writel(sh_chan, hw->sar, SAR);
        sh_dmae_writel(sh_chan, hw->dar, DAR);
-       sh_dmae_writel(sh_chan, hw->tcr >> calc_xmit_shift(sh_chan), TCR);
+       sh_dmae_writel(sh_chan, hw->tcr >> sh_chan->xmit_shift, TCR);
 }
 
 static void dmae_start(struct sh_dmae_chan *sh_chan)
@@ -123,7 +123,7 @@ static void dmae_start(struct sh_dmae_chan *sh_chan)
        u32 chcr = sh_dmae_readl(sh_chan, CHCR);
 
        chcr |= CHCR_DE | CHCR_IE;
-       sh_dmae_writel(sh_chan, chcr, CHCR);
+       sh_dmae_writel(sh_chan, chcr & ~CHCR_TE, CHCR);
 }
 
 static void dmae_halt(struct sh_dmae_chan *sh_chan)
@@ -134,55 +134,50 @@ static void dmae_halt(struct sh_dmae_chan *sh_chan)
        sh_dmae_writel(sh_chan, chcr, CHCR);
 }
 
+static void dmae_init(struct sh_dmae_chan *sh_chan)
+{
+       u32 chcr = RS_DEFAULT; /* default is DUAL mode */
+       sh_chan->xmit_shift = calc_xmit_shift(chcr);
+       sh_dmae_writel(sh_chan, chcr, CHCR);
+}
+
 static int dmae_set_chcr(struct sh_dmae_chan *sh_chan, u32 val)
 {
-       int ret = dmae_is_busy(sh_chan);
        /* When DMA was working, can not set data to CHCR */
-       if (ret)
-               return ret;
+       if (dmae_is_busy(sh_chan))
+               return -EBUSY;
 
+       sh_chan->xmit_shift = calc_xmit_shift(val);
        sh_dmae_writel(sh_chan, val, CHCR);
+
        return 0;
 }
 
-#define DMARS1_ADDR    0x04
-#define DMARS2_ADDR    0x08
-#define DMARS_SHIFT 8
-#define DMARS_CHAN_MSK 0x01
+#define DMARS_SHIFT    8
+#define DMARS_CHAN_MSK 0x01
 static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
 {
        u32 addr;
        int shift = 0;
-       int ret = dmae_is_busy(sh_chan);
-       if (ret)
-               return ret;
+
+       if (dmae_is_busy(sh_chan))
+               return -EBUSY;
 
        if (sh_chan->id & DMARS_CHAN_MSK)
                shift = DMARS_SHIFT;
 
-       switch (sh_chan->id) {
-       /* DMARS0 */
-       case 0:
-       case 1:
-               addr = SH_DMARS_BASE;
-               break;
-       /* DMARS1 */
-       case 2:
-       case 3:
-               addr = (SH_DMARS_BASE + DMARS1_ADDR);
-               break;
-       /* DMARS2 */
-       case 4:
-       case 5:
-               addr = (SH_DMARS_BASE + DMARS2_ADDR);
-               break;
-       default:
+       if (sh_chan->id < 6)
+               /* DMA0RS0 - DMA0RS2 */
+               addr = SH_DMARS_BASE0 + (sh_chan->id / 2) * 4;
+#ifdef SH_DMARS_BASE1
+       else if (sh_chan->id < 12)
+               /* DMA1RS0 - DMA1RS2 */
+               addr = SH_DMARS_BASE1 + ((sh_chan->id - 6) / 2) * 4;
+#endif
+       else
                return -EINVAL;
-       }
 
-       ctrl_outw((val << shift) |
-               (ctrl_inw(addr) & (shift ? 0xFF00 : 0x00FF)),
-               addr);
+       ctrl_outw((val << shift) | (ctrl_inw(addr) & (0xFF00 >> shift)), addr);
 
        return 0;
 }
@@ -250,10 +245,53 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
        return NULL;
 }
 
+static struct sh_dmae_slave_config *sh_dmae_find_slave(
+       struct sh_dmae_chan *sh_chan, enum sh_dmae_slave_chan_id slave_id)
+{
+       struct dma_device *dma_dev = sh_chan->common.device;
+       struct sh_dmae_device *shdev = container_of(dma_dev,
+                                       struct sh_dmae_device, common);
+       struct sh_dmae_pdata *pdata = &shdev->pdata;
+       int i;
+
+       if ((unsigned)slave_id >= SHDMA_SLAVE_NUMBER)
+               return NULL;
+
+       for (i = 0; i < pdata->config_num; i++)
+               if (pdata->config[i].slave_id == slave_id)
+                       return pdata->config + i;
+
+       return NULL;
+}
+
 static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
 {
        struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
        struct sh_desc *desc;
+       struct sh_dmae_slave *param = chan->private;
+
+       /*
+        * This relies on the guarantee from dmaengine that alloc_chan_resources
+        * never runs concurrently with itself or free_chan_resources.
+        */
+       if (param) {
+               struct sh_dmae_slave_config *cfg;
+
+               cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
+               if (!cfg)
+                       return -EINVAL;
+
+               if (test_and_set_bit(param->slave_id, sh_dmae_slave_used))
+                       return -EBUSY;
+
+               param->config = cfg;
+
+               dmae_set_dmars(sh_chan, cfg->mid_rid);
+               dmae_set_chcr(sh_chan, cfg->chcr);
+       } else {
+               if ((sh_dmae_readl(sh_chan, CHCR) & 0x700) != 0x400)
+                       dmae_set_chcr(sh_chan, RS_DEFAULT);
+       }
 
        spin_lock_bh(&sh_chan->desc_lock);
        while (sh_chan->descs_allocated < NR_DESCS_PER_CHANNEL) {
@@ -286,10 +324,18 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
        struct sh_desc *desc, *_desc;
        LIST_HEAD(list);
 
+       dmae_halt(sh_chan);
+
        /* Prepared and not submitted descriptors can still be on the queue */
        if (!list_empty(&sh_chan->ld_queue))
                sh_dmae_chan_ld_cleanup(sh_chan, true);
 
+       if (chan->private) {
+               /* The caller is holding dma_list_mutex */
+               struct sh_dmae_slave *param = chan->private;
+               clear_bit(param->slave_id, sh_dmae_slave_used);
+       }
+
        spin_lock_bh(&sh_chan->desc_lock);
 
        list_splice_init(&sh_chan->ld_free, &list);
@@ -301,23 +347,97 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
                kfree(desc);
 }
 
-static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
-       struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
-       size_t len, unsigned long flags)
+/**
+ * sh_dmae_add_desc - get, set up and return one transfer descriptor
+ * @sh_chan:   DMA channel
+ * @flags:     DMA transfer flags
+ * @dest:      destination DMA address, incremented when direction equals
+ *             DMA_FROM_DEVICE or DMA_BIDIRECTIONAL
+ * @src:       source DMA address, incremented when direction equals
+ *             DMA_TO_DEVICE or DMA_BIDIRECTIONAL
+ * @len:       DMA transfer length
+ * @first:     if NULL, set to the current descriptor and cookie set to -EBUSY
+ * @direction: needed for slave DMA to decide which address to keep constant,
+ *             equals DMA_BIDIRECTIONAL for MEMCPY
+ * Returns 0 or an error
+ * Locks: called with desc_lock held
+ */
+static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
+       unsigned long flags, dma_addr_t *dest, dma_addr_t *src, size_t *len,
+       struct sh_desc **first, enum dma_data_direction direction)
 {
-       struct sh_dmae_chan *sh_chan;
-       struct sh_desc *first = NULL, *prev = NULL, *new;
+       struct sh_desc *new;
        size_t copy_size;
-       LIST_HEAD(tx_list);
-       int chunks = (len + SH_DMA_TCR_MAX) / (SH_DMA_TCR_MAX + 1);
 
-       if (!chan)
+       if (!*len)
                return NULL;
 
-       if (!len)
+       /* Allocate the link descriptor from the free list */
+       new = sh_dmae_get_desc(sh_chan);
+       if (!new) {
+               dev_err(sh_chan->dev, "No free link descriptor available\n");
                return NULL;
+       }
 
-       sh_chan = to_sh_chan(chan);
+       copy_size = min(*len, (size_t)SH_DMA_TCR_MAX + 1);
+
+       new->hw.sar = *src;
+       new->hw.dar = *dest;
+       new->hw.tcr = copy_size;
+
+       if (!*first) {
+               /* First desc */
+               new->async_tx.cookie = -EBUSY;
+               *first = new;
+       } else {
+               /* Other desc - invisible to the user */
+               new->async_tx.cookie = -EINVAL;
+       }
+
+       dev_dbg(sh_chan->dev,
+               "chaining (%u/%u)@%x -> %x with %p, cookie %d, shift %d\n",
+               copy_size, *len, *src, *dest, &new->async_tx,
+               new->async_tx.cookie, sh_chan->xmit_shift);
+
+       new->mark = DESC_PREPARED;
+       new->async_tx.flags = flags;
+       new->direction = direction;
+
+       *len -= copy_size;
+       if (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE)
+               *src += copy_size;
+       if (direction == DMA_BIDIRECTIONAL || direction == DMA_FROM_DEVICE)
+               *dest += copy_size;
+
+       return new;
+}
+
+/*
+ * sh_dmae_prep_sg - prepare transfer descriptors from an SG list
+ *
+ * Common routine for public (MEMCPY) and slave DMA. The MEMCPY case is also
+ * converted to scatter-gather to guarantee consistent locking and a correct
+ * list manipulation. For slave DMA direction carries the usual meaning, and,
+ * logically, the SG list is RAM and the addr variable contains slave address,
+ * e.g., the FIFO I/O register. For MEMCPY direction equals DMA_BIDIRECTIONAL
+ * and the SG list contains only one element and points at the source buffer.
+ */
+static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_chan,
+       struct scatterlist *sgl, unsigned int sg_len, dma_addr_t *addr,
+       enum dma_data_direction direction, unsigned long flags)
+{
+       struct scatterlist *sg;
+       struct sh_desc *first = NULL, *new = NULL /* compiler... */;
+       LIST_HEAD(tx_list);
+       int chunks = 0;
+       int i;
+
+       if (!sg_len)
+               return NULL;
+
+       for_each_sg(sgl, sg, sg_len, i)
+               chunks += (sg_dma_len(sg) + SH_DMA_TCR_MAX) /
+                       (SH_DMA_TCR_MAX + 1);
 
        /* Have to lock the whole loop to protect against concurrent release */
        spin_lock_bh(&sh_chan->desc_lock);
@@ -333,49 +453,32 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
         *      only during this function, then they are immediately spliced
         *      back onto the free list in form of a chain
         */
-       do {
-               /* Allocate the link descriptor from the free list */
-               new = sh_dmae_get_desc(sh_chan);
-               if (!new) {
-                       dev_err(sh_chan->dev,
-                               "No free memory for link descriptor\n");
-                       list_for_each_entry(new, &tx_list, node)
-                               new->mark = DESC_IDLE;
-                       list_splice(&tx_list, &sh_chan->ld_free);
-                       spin_unlock_bh(&sh_chan->desc_lock);
-                       return NULL;
-               }
-
-               copy_size = min(len, (size_t)SH_DMA_TCR_MAX + 1);
-
-               new->hw.sar = dma_src;
-               new->hw.dar = dma_dest;
-               new->hw.tcr = copy_size;
-               if (!first) {
-                       /* First desc */
-                       new->async_tx.cookie = -EBUSY;
-                       first = new;
-               } else {
-                       /* Other desc - invisible to the user */
-                       new->async_tx.cookie = -EINVAL;
-               }
-
-               dev_dbg(sh_chan->dev,
-                       "chaining %u of %u with %p, dst %x, cookie %d\n",
-                       copy_size, len, &new->async_tx, dma_dest,
-                       new->async_tx.cookie);
-
-               new->mark = DESC_PREPARED;
-               new->async_tx.flags = flags;
-               new->chunks = chunks--;
-
-               prev = new;
-               len -= copy_size;
-               dma_src += copy_size;
-               dma_dest += copy_size;
-               /* Insert the link descriptor to the LD ring */
-               list_add_tail(&new->node, &tx_list);
-       } while (len);
+       for_each_sg(sgl, sg, sg_len, i) {
+               dma_addr_t sg_addr = sg_dma_address(sg);
+               size_t len = sg_dma_len(sg);
+
+               if (!len)
+                       goto err_get_desc;
+
+               do {
+                       dev_dbg(sh_chan->dev, "Add SG #%d@%p[%d], dma %llx\n",
+                               i, sg, len, (unsigned long long)sg_addr);
+
+                       if (direction == DMA_FROM_DEVICE)
+                               new = sh_dmae_add_desc(sh_chan, flags,
+                                               &sg_addr, addr, &len, &first,
+                                               direction);
+                       else
+                               new = sh_dmae_add_desc(sh_chan, flags,
+                                               addr, &sg_addr, &len, &first,
+                                               direction);
+                       if (!new)
+                               goto err_get_desc;
+
+                       new->chunks = chunks--;
+                       list_add_tail(&new->node, &tx_list);
+               } while (len);
+       }
 
        if (new != first)
                new->async_tx.cookie = -ENOSPC;
@@ -386,6 +489,77 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
        spin_unlock_bh(&sh_chan->desc_lock);
 
        return &first->async_tx;
+
+err_get_desc:
+       list_for_each_entry(new, &tx_list, node)
+               new->mark = DESC_IDLE;
+       list_splice(&tx_list, &sh_chan->ld_free);
+
+       spin_unlock_bh(&sh_chan->desc_lock);
+
+       return NULL;
+}
+
+static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
+       struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
+       size_t len, unsigned long flags)
+{
+       struct sh_dmae_chan *sh_chan;
+       struct scatterlist sg;
+
+       if (!chan || !len)
+               return NULL;
+
+       chan->private = NULL;
+
+       sh_chan = to_sh_chan(chan);
+
+       sg_init_table(&sg, 1);
+       sg_set_page(&sg, pfn_to_page(PFN_DOWN(dma_src)), len,
+                   offset_in_page(dma_src));
+       sg_dma_address(&sg) = dma_src;
+       sg_dma_len(&sg) = len;
+
+       return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, DMA_BIDIRECTIONAL,
+                              flags);
+}
+
+static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
+       struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
+       enum dma_data_direction direction, unsigned long flags)
+{
+       struct sh_dmae_slave *param;
+       struct sh_dmae_chan *sh_chan;
+
+       if (!chan)
+               return NULL;
+
+       sh_chan = to_sh_chan(chan);
+       param = chan->private;
+
+       /* Someone calling slave DMA on a public channel? */
+       if (!param || !sg_len) {
+               dev_warn(sh_chan->dev, "%s: bad parameter: %p, %d, %d\n",
+                        __func__, param, sg_len, param ? param->slave_id : -1);
+               return NULL;
+       }
+
+       /*
+        * if (param != NULL), this is a successfully requested slave channel,
+        * therefore param->config != NULL too.
+        */
+       return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &param->config->addr,
+                              direction, flags);
+}
+
+static void sh_dmae_terminate_all(struct dma_chan *chan)
+{
+       struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
+
+       if (!chan)
+               return;
+
+       sh_dmae_chan_ld_cleanup(sh_chan, true);
 }
 
 static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
@@ -419,7 +593,11 @@ static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all
                        cookie = tx->cookie;
 
                if (desc->mark == DESC_COMPLETED && desc->chunks == 1) {
-                       BUG_ON(sh_chan->completed_cookie != desc->cookie - 1);
+                       if (sh_chan->completed_cookie != desc->cookie - 1)
+                               dev_dbg(sh_chan->dev,
+                                       "Completing cookie %d, expected %d\n",
+                                       desc->cookie,
+                                       sh_chan->completed_cookie + 1);
                        sh_chan->completed_cookie = desc->cookie;
                }
 
@@ -492,7 +670,7 @@ static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan)
                return;
        }
 
-       /* Find the first un-transfer desciptor */
+       /* Find the first not transferred desciptor */
        list_for_each_entry(sd, &sh_chan->ld_queue, node)
                if (sd->mark == DESC_SUBMITTED) {
                        /* Get the ld start address from ld_queue */
@@ -559,7 +737,7 @@ static irqreturn_t sh_dmae_err(int irq, void *data)
 
        /* IRQ Multi */
        if (shdev->pdata.mode & SHDMA_MIX_IRQ) {
-               int cnt = 0;
+               int __maybe_unused cnt = 0;
                switch (irq) {
 #if defined(DMTE6_IRQ) && defined(DMAE1_IRQ)
                case DMTE6_IRQ:
@@ -596,11 +774,14 @@ static void dmae_do_tasklet(unsigned long data)
        struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data;
        struct sh_desc *desc;
        u32 sar_buf = sh_dmae_readl(sh_chan, SAR);
+       u32 dar_buf = sh_dmae_readl(sh_chan, DAR);
 
        spin_lock(&sh_chan->desc_lock);
        list_for_each_entry(desc, &sh_chan->ld_queue, node) {
-               if ((desc->hw.sar + desc->hw.tcr) == sar_buf &&
-                   desc->mark == DESC_SUBMITTED) {
+               if (desc->mark == DESC_SUBMITTED &&
+                   ((desc->direction == DMA_FROM_DEVICE &&
+                     (desc->hw.dar + desc->hw.tcr) == dar_buf) ||
+                    (desc->hw.sar + desc->hw.tcr) == sar_buf)) {
                        dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",
                                desc->async_tx.cookie, &desc->async_tx,
                                desc->hw.dar);
@@ -673,7 +854,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id)
        }
 
        snprintf(new_sh_chan->dev_id, sizeof(new_sh_chan->dev_id),
-                       "sh-dmae%d", new_sh_chan->id);
+                "sh-dmae%d", new_sh_chan->id);
 
        /* set up channel irq */
        err = request_irq(irq, &sh_dmae_interrupt, irqflags,
@@ -684,11 +865,6 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id)
                goto err_no_irq;
        }
 
-       /* CHCR register control function */
-       new_sh_chan->set_chcr = dmae_set_chcr;
-       /* DMARS register control function */
-       new_sh_chan->set_dmars = dmae_set_dmars;
-
        shdev->chan[id] = new_sh_chan;
        return 0;
 
@@ -759,12 +935,19 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&shdev->common.channels);
 
        dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask);
+       dma_cap_set(DMA_SLAVE, shdev->common.cap_mask);
+
        shdev->common.device_alloc_chan_resources
                = sh_dmae_alloc_chan_resources;
        shdev->common.device_free_chan_resources = sh_dmae_free_chan_resources;
        shdev->common.device_prep_dma_memcpy = sh_dmae_prep_memcpy;
        shdev->common.device_is_tx_complete = sh_dmae_is_complete;
        shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending;
+
+       /* Compulsory for DMA_SLAVE fields */
+       shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg;
+       shdev->common.device_terminate_all = sh_dmae_terminate_all;
+
        shdev->common.dev = &pdev->dev;
        /* Default transfer size of 32 bytes requires 32-byte alignment */
        shdev->common.copy_align = 5;
index 108f1cffb6f5337fc0616858efdae82ec849a0b9..7e227f3c87c456b476d6be798419d9046c6576d3 100644 (file)
@@ -29,6 +29,7 @@ struct sh_desc {
        struct sh_dmae_regs hw;
        struct list_head node;
        struct dma_async_tx_descriptor async_tx;
+       enum dma_data_direction direction;
        dma_cookie_t cookie;
        int chunks;
        int mark;
@@ -45,13 +46,9 @@ struct sh_dmae_chan {
        struct device *dev;             /* Channel device */
        struct tasklet_struct tasklet;  /* Tasklet */
        int descs_allocated;            /* desc count */
+       int xmit_shift;                 /* log_2(bytes_per_xfer) */
        int id;                         /* Raw id of this channel */
        char dev_id[16];                /* unique name per DMAC of channel */
-
-       /* Set chcr */
-       int (*set_chcr)(struct sh_dmae_chan *sh_chan, u32 regs);
-       /* Set DMA resource */
-       int (*set_dmars)(struct sh_dmae_chan *sh_chan, u16 res);
 };
 
 struct sh_dmae_device {
index c5facd951dda965e1c0f217b824289445c9e3165..3391e6739d06ef32fdfcf56a7dcfc7c9d2347f3b 100644 (file)
@@ -197,7 +197,7 @@ static int amd64_get_scrub_rate(struct mem_ctl_info *mci, u32 *bw)
        edac_printk(KERN_DEBUG, EDAC_MC,
                    "pci-read, sdram scrub control value: %d \n", scrubval);
 
-       for (i = 0; ARRAY_SIZE(scrubrates); i++) {
+       for (i = 0; i < ARRAY_SIZE(scrubrates); i++) {
                if (scrubrates[i].scrubval == scrubval) {
                        *bw = scrubrates[i].bandwidth;
                        status = 0;
@@ -2658,10 +2658,11 @@ static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
  * the memory system completely. A command line option allows to force-enable
  * hardware ECC later in amd64_enable_ecc_error_reporting().
  */
-static const char *ecc_warning =
-       "WARNING: ECC is disabled by BIOS. Module will NOT be loaded.\n"
-       " Either Enable ECC in the BIOS, or set 'ecc_enable_override'.\n"
-       " Also, use of the override can cause unknown side effects.\n";
+static const char *ecc_msg =
+       "ECC disabled in the BIOS or no ECC capability, module will not load.\n"
+       " Either enable ECC checking or force module loading by setting "
+       "'ecc_enable_override'.\n"
+       " (Note that use of the override may cause unknown side effects.)\n";
 
 static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
 {
@@ -2673,7 +2674,7 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
 
        ecc_enabled = !!(value & K8_NBCFG_ECC_ENABLE);
        if (!ecc_enabled)
-               amd64_printk(KERN_WARNING, "This node reports that Memory ECC "
+               amd64_printk(KERN_NOTICE, "This node reports that Memory ECC "
                             "is currently disabled, set F3x%x[22] (%s).\n",
                             K8_NBCFG, pci_name(pvt->misc_f3_ctl));
        else
@@ -2681,13 +2682,13 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
 
        nb_mce_en = amd64_nb_mce_bank_enabled_on_node(pvt->mc_node_id);
        if (!nb_mce_en)
-               amd64_printk(KERN_WARNING, "NB MCE bank disabled, set MSR "
+               amd64_printk(KERN_NOTICE, "NB MCE bank disabled, set MSR "
                             "0x%08x[4] on node %d to enable.\n",
                             MSR_IA32_MCG_CTL, pvt->mc_node_id);
 
        if (!ecc_enabled || !nb_mce_en) {
                if (!ecc_enable_override) {
-                       amd64_printk(KERN_WARNING, "%s", ecc_warning);
+                       amd64_printk(KERN_NOTICE, "%s", ecc_msg);
                        return -ENODEV;
                }
                ecc_enable_override = 0;
index 77a9579d716777c70b5dd399a1f40f44cab87e74..adc10a2ac5f63b0e1dbd90ca2ca529e9e2a5b15c 100644 (file)
@@ -577,7 +577,13 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci,
                debugf0("\tUncorrected bits= 0x%x\n", ue_errors);
 
                branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd);
-               channel = branch;
+
+               /*
+                * According with i5000 datasheet, bit 28 has no significance
+                * for errors M4Err-M12Err and M17Err-M21Err, on FERR_NF_FBD
+                */
+               channel = branch & 2;
+
                bank = NREC_BANK(info->nrecmema);
                rank = NREC_RANK(info->nrecmema);
                rdwr = NREC_RDWR(info->nrecmema);
index cf27402af97b9cb0f22ec2677ea1fe811581b929..ecd5928d7110491a71c6158a128f8f50552f9905 100644 (file)
@@ -804,8 +804,8 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)
                end   <<= (24 - PAGE_SHIFT);
                end    |= (1 << (24 - PAGE_SHIFT)) - 1;
 
-               csrow->first_page = start >> PAGE_SHIFT;
-               csrow->last_page = end >> PAGE_SHIFT;
+               csrow->first_page = start;
+               csrow->last_page = end;
                csrow->nr_pages = end + 1 - start;
                csrow->grain = 8;
                csrow->mtype = mtype;
@@ -892,10 +892,6 @@ static int __devinit mpc85xx_mc_err_probe(struct of_device *op,
 
        mpc85xx_init_csrows(mci);
 
-#ifdef CONFIG_EDAC_DEBUG
-       edac_mc_register_mcidev_debug((struct attribute **)debug_attr);
-#endif
-
        /* store the original error disable bits */
        orig_ddr_err_disable =
            in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DISABLE);
index 7083bcc1b9c7c282fe1a56c7a7dba65e1ea9543e..5045156c5313b0c59114850f003f17ef46945c36 100644 (file)
@@ -57,6 +57,8 @@ static LIST_HEAD(descriptor_list);
 static int descriptor_count;
 
 static __be32 tmp_config_rom[256];
+/* ROM header, bus info block, root dir header, capabilities = 7 quadlets */
+static size_t config_rom_length = 1 + 4 + 1 + 1;
 
 #define BIB_CRC(v)             ((v) <<  0)
 #define BIB_CRC_LENGTH(v)      ((v) << 16)
@@ -73,7 +75,7 @@ static __be32 tmp_config_rom[256];
 #define BIB_CMC                        ((1) << 30)
 #define BIB_IMC                        ((1) << 31)
 
-static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom)
+static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
 {
        struct fw_descriptor *desc;
        int i, j, k, length;
@@ -130,23 +132,30 @@ static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom)
        for (i = 0; i < j; i += length + 1)
                length = fw_compute_block_crc(config_rom + i);
 
-       return j;
+       WARN_ON(j != config_rom_length);
 }
 
 static void update_config_roms(void)
 {
        struct fw_card *card;
-       size_t length;
 
        list_for_each_entry (card, &card_list, link) {
-               length = generate_config_rom(card, tmp_config_rom);
-               card->driver->set_config_rom(card, tmp_config_rom, length);
+               generate_config_rom(card, tmp_config_rom);
+               card->driver->set_config_rom(card, tmp_config_rom,
+                                            config_rom_length);
        }
 }
 
+static size_t required_space(struct fw_descriptor *desc)
+{
+       /* descriptor + entry into root dir + optional immediate entry */
+       return desc->length + 1 + (desc->immediate > 0 ? 1 : 0);
+}
+
 int fw_core_add_descriptor(struct fw_descriptor *desc)
 {
        size_t i;
+       int ret;
 
        /*
         * Check descriptor is valid; the length of all blocks in the
@@ -162,15 +171,21 @@ int fw_core_add_descriptor(struct fw_descriptor *desc)
 
        mutex_lock(&card_mutex);
 
-       list_add_tail(&desc->link, &descriptor_list);
-       descriptor_count++;
-       if (desc->immediate > 0)
+       if (config_rom_length + required_space(desc) > 256) {
+               ret = -EBUSY;
+       } else {
+               list_add_tail(&desc->link, &descriptor_list);
+               config_rom_length += required_space(desc);
                descriptor_count++;
-       update_config_roms();
+               if (desc->immediate > 0)
+                       descriptor_count++;
+               update_config_roms();
+               ret = 0;
+       }
 
        mutex_unlock(&card_mutex);
 
-       return 0;
+       return ret;
 }
 EXPORT_SYMBOL(fw_core_add_descriptor);
 
@@ -179,6 +194,7 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc)
        mutex_lock(&card_mutex);
 
        list_del(&desc->link);
+       config_rom_length -= required_space(desc);
        descriptor_count--;
        if (desc->immediate > 0)
                descriptor_count--;
@@ -428,7 +444,6 @@ EXPORT_SYMBOL(fw_card_initialize);
 int fw_card_add(struct fw_card *card,
                u32 max_receive, u32 link_speed, u64 guid)
 {
-       size_t length;
        int ret;
 
        card->max_receive = max_receive;
@@ -437,8 +452,8 @@ int fw_card_add(struct fw_card *card,
 
        mutex_lock(&card_mutex);
 
-       length = generate_config_rom(card, tmp_config_rom);
-       ret = card->driver->enable(card, tmp_config_rom, length);
+       generate_config_rom(card, tmp_config_rom);
+       ret = card->driver->enable(card, tmp_config_rom, config_rom_length);
        if (ret == 0)
                list_add_tail(&card->link, &card_list);
 
index e6d63849e78ee44302e436c26f871e5b3dd3eef7..4eeaed57e2197a0dd5f0cab7cffa4713eaf2ec96 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/preempt.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
+#include <linux/string.h>
 #include <linux/time.h>
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
@@ -595,13 +596,20 @@ static int ioctl_send_request(struct client *client, void *buffer)
                            client->device->max_speed);
 }
 
+static inline bool is_fcp_request(struct fw_request *request)
+{
+       return request == NULL;
+}
+
 static void release_request(struct client *client,
                            struct client_resource *resource)
 {
        struct inbound_transaction_resource *r = container_of(resource,
                        struct inbound_transaction_resource, resource);
 
-       if (r->request)
+       if (is_fcp_request(r->request))
+               kfree(r->data);
+       else
                fw_send_response(client->device->card, r->request,
                                 RCODE_CONFLICT_ERROR);
        kfree(r);
@@ -616,6 +624,7 @@ static void handle_request(struct fw_card *card, struct fw_request *request,
        struct address_handler_resource *handler = callback_data;
        struct inbound_transaction_resource *r;
        struct inbound_transaction_event *e;
+       void *fcp_frame = NULL;
        int ret;
 
        r = kmalloc(sizeof(*r), GFP_ATOMIC);
@@ -627,6 +636,18 @@ static void handle_request(struct fw_card *card, struct fw_request *request,
        r->data    = payload;
        r->length  = length;
 
+       if (is_fcp_request(request)) {
+               /*
+                * FIXME: Let core-transaction.c manage a
+                * single reference-counted copy?
+                */
+               fcp_frame = kmemdup(payload, length, GFP_ATOMIC);
+               if (fcp_frame == NULL)
+                       goto failed;
+
+               r->data = fcp_frame;
+       }
+
        r->resource.release = release_request;
        ret = add_client_resource(handler->client, &r->resource, GFP_ATOMIC);
        if (ret < 0)
@@ -640,13 +661,15 @@ static void handle_request(struct fw_card *card, struct fw_request *request,
        e->request.closure = handler->closure;
 
        queue_event(handler->client, &e->event,
-                   &e->request, sizeof(e->request), payload, length);
+                   &e->request, sizeof(e->request), r->data, length);
        return;
 
  failed:
        kfree(r);
        kfree(e);
-       if (request)
+       kfree(fcp_frame);
+
+       if (!is_fcp_request(request))
                fw_send_response(card, request, RCODE_CONFLICT_ERROR);
 }
 
@@ -717,18 +740,17 @@ static int ioctl_send_response(struct client *client, void *buffer)
 
        r = container_of(resource, struct inbound_transaction_resource,
                         resource);
-       if (r->request) {
-               if (request->length < r->length)
-                       r->length = request->length;
-               if (copy_from_user(r->data, u64_to_uptr(request->data),
-                                  r->length)) {
-                       ret = -EFAULT;
-                       kfree(r->request);
-                       goto out;
-               }
-               fw_send_response(client->device->card, r->request,
-                                request->rcode);
+       if (is_fcp_request(r->request))
+               goto out;
+
+       if (request->length < r->length)
+               r->length = request->length;
+       if (copy_from_user(r->data, u64_to_uptr(request->data), r->length)) {
+               ret = -EFAULT;
+               kfree(r->request);
+               goto out;
        }
+       fw_send_response(client->device->card, r->request, request->rcode);
  out:
        kfree(r);
 
index cbaf420c36c531d4c09d612b62bca003dd86896e..2d3dc7ded0a94d88fd80e8506685e755ce09113e 100644 (file)
@@ -893,20 +893,31 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context,
 
 static struct kmem_cache *fwnet_packet_task_cache;
 
+static void fwnet_free_ptask(struct fwnet_packet_task *ptask)
+{
+       dev_kfree_skb_any(ptask->skb);
+       kmem_cache_free(fwnet_packet_task_cache, ptask);
+}
+
 static int fwnet_send_packet(struct fwnet_packet_task *ptask);
 
 static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask)
 {
-       struct fwnet_device *dev;
+       struct fwnet_device *dev = ptask->dev;
        unsigned long flags;
-
-       dev = ptask->dev;
+       bool free;
 
        spin_lock_irqsave(&dev->lock, flags);
-       list_del(&ptask->pt_link);
-       spin_unlock_irqrestore(&dev->lock, flags);
 
-       ptask->outstanding_pkts--; /* FIXME access inside lock */
+       ptask->outstanding_pkts--;
+
+       /* Check whether we or the networking TX soft-IRQ is last user. */
+       free = (ptask->outstanding_pkts == 0 && !list_empty(&ptask->pt_link));
+
+       if (ptask->outstanding_pkts == 0)
+               list_del(&ptask->pt_link);
+
+       spin_unlock_irqrestore(&dev->lock, flags);
 
        if (ptask->outstanding_pkts > 0) {
                u16 dg_size;
@@ -951,10 +962,10 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask)
                        ptask->max_payload = skb->len + RFC2374_FRAG_HDR_SIZE;
                }
                fwnet_send_packet(ptask);
-       } else {
-               dev_kfree_skb_any(ptask->skb);
-               kmem_cache_free(fwnet_packet_task_cache, ptask);
        }
+
+       if (free)
+               fwnet_free_ptask(ptask);
 }
 
 static void fwnet_write_complete(struct fw_card *card, int rcode,
@@ -977,6 +988,7 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask)
        unsigned tx_len;
        struct rfc2734_header *bufhdr;
        unsigned long flags;
+       bool free;
 
        dev = ptask->dev;
        tx_len = ptask->max_payload;
@@ -1022,12 +1034,16 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask)
                                generation, SCODE_100, 0ULL, ptask->skb->data,
                                tx_len + 8, fwnet_write_complete, ptask);
 
-               /* FIXME race? */
                spin_lock_irqsave(&dev->lock, flags);
-               list_add_tail(&ptask->pt_link, &dev->broadcasted_list);
+
+               /* If the AT tasklet already ran, we may be last user. */
+               free = (ptask->outstanding_pkts == 0 && list_empty(&ptask->pt_link));
+               if (!free)
+                       list_add_tail(&ptask->pt_link, &dev->broadcasted_list);
+
                spin_unlock_irqrestore(&dev->lock, flags);
 
-               return 0;
+               goto out;
        }
 
        fw_send_request(dev->card, &ptask->transaction,
@@ -1035,12 +1051,19 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask)
                        ptask->generation, ptask->speed, ptask->fifo_addr,
                        ptask->skb->data, tx_len, fwnet_write_complete, ptask);
 
-       /* FIXME race? */
        spin_lock_irqsave(&dev->lock, flags);
-       list_add_tail(&ptask->pt_link, &dev->sent_list);
+
+       /* If the AT tasklet already ran, we may be last user. */
+       free = (ptask->outstanding_pkts == 0 && list_empty(&ptask->pt_link));
+       if (!free)
+               list_add_tail(&ptask->pt_link, &dev->sent_list);
+
        spin_unlock_irqrestore(&dev->lock, flags);
 
        dev->netdev->trans_start = jiffies;
+ out:
+       if (free)
+               fwnet_free_ptask(ptask);
 
        return 0;
 }
@@ -1298,6 +1321,8 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
        spin_unlock_irqrestore(&dev->lock, flags);
 
        ptask->max_payload = max_payload;
+       INIT_LIST_HEAD(&ptask->pt_link);
+
        fwnet_send_packet(ptask);
 
        return NETDEV_TX_OK;
index a61571c63c595161f1aceb004a3d99677971b403..43ebf337b131152bb0503372cadd8173535e5e62 100644 (file)
@@ -2101,11 +2101,6 @@ static int ohci_queue_iso_transmit(struct fw_iso_context *base,
        u32 payload_index, payload_end_index, next_page_index;
        int page, end_page, i, length, offset;
 
-       /*
-        * FIXME: Cycle lost behavior should be configurable: lose
-        * packet, retransmit or terminate..
-        */
-
        p = packet;
        payload_index = payload;
 
@@ -2135,6 +2130,14 @@ static int ohci_queue_iso_transmit(struct fw_iso_context *base,
        if (!p->skip) {
                d[0].control   = cpu_to_le16(DESCRIPTOR_KEY_IMMEDIATE);
                d[0].req_count = cpu_to_le16(8);
+               /*
+                * Link the skip address to this descriptor itself.  This causes
+                * a context to skip a cycle whenever lost cycles or FIFO
+                * overruns occur, without dropping the data.  The application
+                * should then decide whether this is an error condition or not.
+                * FIXME:  Make the context's cycle-lost behaviour configurable?
+                */
+               d[0].branch_address = cpu_to_le32(d_bus | z);
 
                header = (__le32 *) &d[1];
                header[0] = cpu_to_le32(IT_HEADER_SY(p->sy) |
@@ -2420,6 +2423,7 @@ static void ohci_pmac_off(struct pci_dev *dev)
 
 #define PCI_VENDOR_ID_AGERE            PCI_VENDOR_ID_ATT
 #define PCI_DEVICE_ID_AGERE_FW643      0x5901
+#define PCI_DEVICE_ID_TI_TSB43AB23     0x8024
 
 static int __devinit pci_probe(struct pci_dev *dev,
                               const struct pci_device_id *ent)
@@ -2488,7 +2492,8 @@ static int __devinit pci_probe(struct pci_dev *dev,
 #if !defined(CONFIG_X86_32)
        /* dual-buffer mode is broken with descriptor addresses above 2G */
        if (dev->vendor == PCI_VENDOR_ID_TI &&
-           dev->device == PCI_DEVICE_ID_TI_TSB43AB22)
+           (dev->device == PCI_DEVICE_ID_TI_TSB43AB22 ||
+            dev->device == PCI_DEVICE_ID_TI_TSB43AB23))
                ohci->use_dualbuffer = false;
 #endif
 
index 051d1ebbd2876b68db9df2209161b13da7e8d7bb..f82bcdae130be1a2b8dfce439bbd2bffc09535cc 100644 (file)
@@ -381,7 +381,7 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
        void *ibft_loc = entry->header;
        char *str = buf;
        char *mac;
-       int val;
+       __be32 val;
 
        if (!nic)
                return 0;
@@ -397,10 +397,8 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
                str += sprintf_ipaddr(str, nic->ip_addr);
                break;
        case ibft_eth_subnet_mask:
-               val = ~((1 << (32-nic->subnet_mask_prefix))-1);
-               str += sprintf(str, NIPQUAD_FMT,
-                              (u8)(val >> 24), (u8)(val >> 16),
-                              (u8)(val >> 8), (u8)(val));
+               val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
+               str += sprintf(str, "%pI4", &val);
                break;
        case ibft_eth_origin:
                str += sprintf(str, "%d\n", nic->origin);
index 96eddd17e050c8aed4fa202360abebb310f7b05c..305c590039634603972d31ed02ab72b49e202938 100644 (file)
@@ -66,6 +66,8 @@ config DRM_RADEON
 
          If M is selected, the module will be called radeon.
 
+source "drivers/gpu/drm/radeon/Kconfig"
+
 config DRM_I810
        tristate "Intel I810"
        depends on DRM && AGP && AGP_INTEL
index a1fce68e3bbe65aded6adf7bb05f3c465b3e5d92..17be051b7aa3109c4aef78b320823da2eecb5fc8 100644 (file)
@@ -113,7 +113,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
 
                if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
                        DRM_ERROR("fail to set dma mask to 0x%Lx\n",
-                                 gart_info->table_mask);
+                                 (unsigned long long)gart_info->table_mask);
                        ret = 1;
                        goto done;
                }
index 077313f0d47fa0e4e201841230432efae304deb0..7d0f00a935faa46c2bc60d15027d2edf1ba29397 100644 (file)
@@ -702,7 +702,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
                if (encoder->crtc != crtc)
                        continue;
 
-               DRM_INFO("%s: set mode %s %x\n", drm_get_encoder_name(encoder),
+               DRM_DEBUG("%s: set mode %s %x\n", drm_get_encoder_name(encoder),
                         mode->name, mode->base.id);
                encoder_funcs = encoder->helper_private;
                encoder_funcs->mode_set(encoder, mode, adjusted_mode);
@@ -1032,7 +1032,8 @@ bool drm_helper_initial_config(struct drm_device *dev)
        /*
         * we shouldn't end up with no modes here.
         */
-       printk(KERN_INFO "No connectors reported conncted with modes\n");
+       if (count == 0)
+               printk(KERN_INFO "No connectors reported connected with modes\n");
 
        drm_setup_crtcs(dev);
 
index defcaf108460b59ac9e5cba023d26e6e7bef6f13..ab6c973304129383ca733eeb2f49b117b55b421a 100644 (file)
@@ -598,6 +598,50 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
        return mode;
 }
 
+/*
+ * EDID is delightfully ambiguous about how interlaced modes are to be
+ * encoded.  Our internal representation is of frame height, but some
+ * HDTV detailed timings are encoded as field height.
+ *
+ * The format list here is from CEA, in frame size.  Technically we
+ * should be checking refresh rate too.  Whatever.
+ */
+static void
+drm_mode_do_interlace_quirk(struct drm_display_mode *mode,
+                           struct detailed_pixel_timing *pt)
+{
+       int i;
+       static const struct {
+               int w, h;
+       } cea_interlaced[] = {
+               { 1920, 1080 },
+               {  720,  480 },
+               { 1440,  480 },
+               { 2880,  480 },
+               {  720,  576 },
+               { 1440,  576 },
+               { 2880,  576 },
+       };
+       static const int n_sizes =
+               sizeof(cea_interlaced)/sizeof(cea_interlaced[0]);
+
+       if (!(pt->misc & DRM_EDID_PT_INTERLACED))
+               return;
+
+       for (i = 0; i < n_sizes; i++) {
+               if ((mode->hdisplay == cea_interlaced[i].w) &&
+                   (mode->vdisplay == cea_interlaced[i].h / 2)) {
+                       mode->vdisplay *= 2;
+                       mode->vsync_start *= 2;
+                       mode->vsync_end *= 2;
+                       mode->vtotal *= 2;
+                       mode->vtotal |= 1;
+               }
+       }
+
+       mode->flags |= DRM_MODE_FLAG_INTERLACE;
+}
+
 /**
  * drm_mode_detailed - create a new mode from an EDID detailed timing section
  * @dev: DRM device (needed to create new mode)
@@ -633,8 +677,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
                return NULL;
        }
        if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) {
-               printk(KERN_WARNING "integrated sync not supported\n");
-               return NULL;
+               printk(KERN_WARNING "composite sync not supported\n");
        }
 
        /* it is incorrect if hsync/vsync width is zero */
@@ -681,8 +724,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
 
        drm_mode_set_name(mode);
 
-       if (pt->misc & DRM_EDID_PT_INTERLACED)
-               mode->flags |= DRM_MODE_FLAG_INTERLACE;
+       drm_mode_do_interlace_quirk(mode, pt);
 
        if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) {
                pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE;
index 1c2b7d44ec05c90bb295e35448b97c3cbda02a6f..0f9e90552dc44098589e8bf20a1154266c25db67 100644 (file)
@@ -389,7 +389,7 @@ int drm_fb_helper_blank(int blank, struct fb_info *info)
                break;
        /* Display: Off; HSync: On, VSync: On */
        case FB_BLANK_NORMAL:
-               drm_fb_helper_off(info, DRM_MODE_DPMS_ON);
+               drm_fb_helper_off(info, DRM_MODE_DPMS_STANDBY);
                break;
        /* Display: Off; HSync: Off, VSync: On */
        case FB_BLANK_HSYNC_SUSPEND:
index e9dbb481c469f4a0071256349bd7a5e7a1239dcd..8bf3770f294e12feb562d046a5de4ed281b9ce45 100644 (file)
@@ -142,19 +142,6 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size)
        if (IS_ERR(obj->filp))
                goto free;
 
-       /* Basically we want to disable the OOM killer and handle ENOMEM
-        * ourselves by sacrificing pages from cached buffers.
-        * XXX shmem_file_[gs]et_gfp_mask()
-        */
-       mapping_set_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping,
-                            GFP_HIGHUSER |
-                            __GFP_COLD |
-                            __GFP_FS |
-                            __GFP_RECLAIMABLE |
-                            __GFP_NORETRY |
-                            __GFP_NOWARN |
-                            __GFP_NOMEMALLOC);
-
        kref_init(&obj->refcount);
        kref_init(&obj->handlecount);
        obj->size = size;
index cdec32977129b98bf00179f01e919dc297fcf333..2ac074c8f5d2e546d40ff53fa3fe54c83547773d 100644 (file)
@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
                                wasted += alignment - tmp;
                }
 
-               if (entry->size >= size + wasted) {
+               if (entry->size >= size + wasted &&
+                   (entry->start + wasted + size) <= end) {
                        if (!best_match)
                                return entry;
                        if (entry->size < best_size) {
index 9c9998c4dcebba0fd4efffabc2da954ac46d2cc7..a894ade030937c506e13322c2687b3c93b30420f 100644 (file)
@@ -290,7 +290,7 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
        list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) {
                obj = obj_priv->obj;
                if (obj->read_domains & I915_GEM_DOMAIN_COMMAND) {
-                   ret = i915_gem_object_get_pages(obj);
+                   ret = i915_gem_object_get_pages(obj, 0);
                    if (ret) {
                            DRM_ERROR("Failed to get pages: %d\n", ret);
                            spin_unlock(&dev_priv->mm.active_list_lock);
index bbe47812e4b6b210479cbeec80c11f194ac71337..2307f98349f7d145aec2a0d57c57a86777a3cbb6 100644 (file)
@@ -134,6 +134,10 @@ static int i915_init_phys_hws(struct drm_device *dev)
 
        memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
 
+       if (IS_I965G(dev))
+               dev_priv->dma_status_page |= (dev_priv->dma_status_page >> 28) &
+                                            0xf0;
+
        I915_WRITE(HWS_PGA, dev_priv->dma_status_page);
        DRM_DEBUG_DRIVER("Enabled hardware status page\n");
        return 0;
@@ -731,8 +735,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
        if (cmdbuf->num_cliprects) {
                cliprects = kcalloc(cmdbuf->num_cliprects,
                                    sizeof(struct drm_clip_rect), GFP_KERNEL);
-               if (cliprects == NULL)
+               if (cliprects == NULL) {
+                       ret = -ENOMEM;
                        goto fail_batch_free;
+               }
 
                ret = copy_from_user(cliprects, cmdbuf->cliprects,
                                     cmdbuf->num_cliprects *
index be631cc3e4dcaacc0c5770b31d8ede561c9927b4..cf4cb3e9a0c22a5a244350db95f8d846b05e3fdb 100644 (file)
@@ -45,6 +45,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
 unsigned int i915_powersave = 1;
 module_param_named(powersave, i915_powersave, int, 0400);
 
+unsigned int i915_lvds_downclock = 0;
+module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
+
 static struct drm_driver driver;
 
 #define INTEL_VGA_DEVICE(id, info) {           \
@@ -117,7 +120,7 @@ const static struct intel_device_info intel_gm45_info = {
 
 const static struct intel_device_info intel_pineview_info = {
        .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1,
-       .has_pipe_cxsr = 1,
+       .need_gfx_hws = 1,
        .has_hotplug = 1,
 };
 
@@ -171,26 +174,20 @@ const static struct pci_device_id pciidlist[] = {
 MODULE_DEVICE_TABLE(pci, pciidlist);
 #endif
 
-static int i915_suspend(struct drm_device *dev, pm_message_t state)
+static int i915_drm_freeze(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
-       if (!dev || !dev_priv) {
-               DRM_ERROR("dev: %p, dev_priv: %p\n", dev, dev_priv);
-               DRM_ERROR("DRM not initialized, aborting suspend.\n");
-               return -ENODEV;
-       }
-
-       if (state.event == PM_EVENT_PRETHAW)
-               return 0;
-
        pci_save_state(dev->pdev);
 
        /* If KMS is active, we do the leavevt stuff here */
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-               if (i915_gem_idle(dev))
+               int error = i915_gem_idle(dev);
+               if (error) {
                        dev_err(&dev->pdev->dev,
-                               "GEM idle failed, resume may fail\n");
+                               "GEM idle failed, resume might fail\n");
+                       return error;
+               }
                drm_irq_uninstall(dev);
        }
 
@@ -198,26 +195,42 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
 
        intel_opregion_free(dev, 1);
 
+       /* Modeset on resume, not lid events */
+       dev_priv->modeset_on_lid = 0;
+
+       return 0;
+}
+
+static int i915_suspend(struct drm_device *dev, pm_message_t state)
+{
+       int error;
+
+       if (!dev || !dev->dev_private) {
+               DRM_ERROR("dev: %p\n", dev);
+               DRM_ERROR("DRM not initialized, aborting suspend.\n");
+               return -ENODEV;
+       }
+
+       if (state.event == PM_EVENT_PRETHAW)
+               return 0;
+
+       error = i915_drm_freeze(dev);
+       if (error)
+               return error;
+
        if (state.event == PM_EVENT_SUSPEND) {
                /* Shut down the device */
                pci_disable_device(dev->pdev);
                pci_set_power_state(dev->pdev, PCI_D3hot);
        }
 
-       /* Modeset on resume, not lid events */
-       dev_priv->modeset_on_lid = 0;
-
        return 0;
 }
 
-static int i915_resume(struct drm_device *dev)
+static int i915_drm_thaw(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       int ret = 0;
-
-       if (pci_enable_device(dev->pdev))
-               return -1;
-       pci_set_master(dev->pdev);
+       int error = 0;
 
        i915_restore_state(dev);
 
@@ -228,21 +241,28 @@ static int i915_resume(struct drm_device *dev)
                mutex_lock(&dev->struct_mutex);
                dev_priv->mm.suspended = 0;
 
-               ret = i915_gem_init_ringbuffer(dev);
-               if (ret != 0)
-                       ret = -1;
+               error = i915_gem_init_ringbuffer(dev);
                mutex_unlock(&dev->struct_mutex);
 
                drm_irq_install(dev);
-       }
-       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+
                /* Resume the modeset for every activated CRTC */
                drm_helper_resume_force_mode(dev);
        }
 
        dev_priv->modeset_on_lid = 0;
 
-       return ret;
+       return error;
+}
+
+static int i915_resume(struct drm_device *dev)
+{
+       if (pci_enable_device(dev->pdev))
+               return -EIO;
+
+       pci_set_master(dev->pdev);
+
+       return i915_drm_thaw(dev);
 }
 
 /**
@@ -383,57 +403,62 @@ i915_pci_remove(struct pci_dev *pdev)
        drm_put_dev(dev);
 }
 
-static int
-i915_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+static int i915_pm_suspend(struct device *dev)
 {
-       struct drm_device *dev = pci_get_drvdata(pdev);
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+       int error;
 
-       return i915_suspend(dev, state);
-}
+       if (!drm_dev || !drm_dev->dev_private) {
+               dev_err(dev, "DRM not initialized, aborting suspend.\n");
+               return -ENODEV;
+       }
 
-static int
-i915_pci_resume(struct pci_dev *pdev)
-{
-       struct drm_device *dev = pci_get_drvdata(pdev);
+       error = i915_drm_freeze(drm_dev);
+       if (error)
+               return error;
 
-       return i915_resume(dev);
-}
+       pci_disable_device(pdev);
+       pci_set_power_state(pdev, PCI_D3hot);
 
-static int
-i915_pm_suspend(struct device *dev)
-{
-       return i915_pci_suspend(to_pci_dev(dev), PMSG_SUSPEND);
+       return 0;
 }
 
-static int
-i915_pm_resume(struct device *dev)
+static int i915_pm_resume(struct device *dev)
 {
-       return i915_pci_resume(to_pci_dev(dev));
-}
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
-static int
-i915_pm_freeze(struct device *dev)
-{
-       return i915_pci_suspend(to_pci_dev(dev), PMSG_FREEZE);
+       return i915_resume(drm_dev);
 }
 
-static int
-i915_pm_thaw(struct device *dev)
+static int i915_pm_freeze(struct device *dev)
 {
-       /* thaw during hibernate, do nothing! */
-       return 0;
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+
+       if (!drm_dev || !drm_dev->dev_private) {
+               dev_err(dev, "DRM not initialized, aborting suspend.\n");
+               return -ENODEV;
+       }
+
+       return i915_drm_freeze(drm_dev);
 }
 
-static int
-i915_pm_poweroff(struct device *dev)
+static int i915_pm_thaw(struct device *dev)
 {
-       return i915_pci_suspend(to_pci_dev(dev), PMSG_HIBERNATE);
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+
+       return i915_drm_thaw(drm_dev);
 }
 
-static int
-i915_pm_restore(struct device *dev)
+static int i915_pm_poweroff(struct device *dev)
 {
-       return i915_pci_resume(to_pci_dev(dev));
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+
+       return i915_drm_freeze(drm_dev);
 }
 
 const struct dev_pm_ops i915_pm_ops = {
@@ -442,7 +467,7 @@ const struct dev_pm_ops i915_pm_ops = {
      .freeze = i915_pm_freeze,
      .thaw = i915_pm_thaw,
      .poweroff = i915_pm_poweroff,
-     .restore = i915_pm_restore,
+     .restore = i915_pm_resume,
 };
 
 static struct vm_operations_struct i915_gem_vm_ops = {
@@ -464,8 +489,11 @@ static struct drm_driver driver = {
        .lastclose = i915_driver_lastclose,
        .preclose = i915_driver_preclose,
        .postclose = i915_driver_postclose,
+
+       /* Used in place of i915_pm_ops for non-DRIVER_MODESET */
        .suspend = i915_suspend,
        .resume = i915_resume,
+
        .device_is_agp = i915_driver_device_is_agp,
        .enable_vblank = i915_enable_vblank,
        .disable_vblank = i915_disable_vblank,
index 29dd676269675edb34efeace6ee605dc600a8e7e..b99b6a841d9506b1782562e825b383ac650aaf9c 100644 (file)
@@ -283,6 +283,7 @@ typedef struct drm_i915_private {
        unsigned int lvds_use_ssc:1;
        unsigned int edp_support:1;
        int lvds_ssc_freq;
+       int edp_bpp;
 
        struct notifier_block lid_notifier;
 
@@ -491,6 +492,15 @@ typedef struct drm_i915_private {
                 */
                struct list_head flushing_list;
 
+               /**
+                * List of objects currently pending a GPU write flush.
+                *
+                * All elements on this list will belong to either the
+                * active_list or flushing_list, last_rendering_seqno can
+                * be used to differentiate between the two elements.
+                */
+               struct list_head gpu_write_list;
+
                /**
                 * LRU list of objects which are not in the ringbuffer and
                 * are ready to unbind, but are still in the GTT.
@@ -591,6 +601,8 @@ struct drm_i915_gem_object {
 
        /** This object's place on the active/flushing/inactive lists */
        struct list_head list;
+       /** This object's place on GPU write list */
+       struct list_head gpu_write_list;
 
        /** This object's place on the fenced object LRU */
        struct list_head fence_list;
@@ -722,6 +734,7 @@ extern struct drm_ioctl_desc i915_ioctls[];
 extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc;
 extern unsigned int i915_powersave;
+extern unsigned int i915_lvds_downclock;
 
 extern void i915_save_display(struct drm_device *dev);
 extern void i915_restore_display(struct drm_device *dev);
@@ -864,12 +877,13 @@ int i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptib
 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
                                      int write);
+int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj);
 int i915_gem_attach_phys_object(struct drm_device *dev,
                                struct drm_gem_object *obj, int id);
 void i915_gem_detach_phys_object(struct drm_device *dev,
                                 struct drm_gem_object *obj);
 void i915_gem_free_all_phys_object(struct drm_device *dev);
-int i915_gem_object_get_pages(struct drm_gem_object *obj);
+int i915_gem_object_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
 void i915_gem_object_put_pages(struct drm_gem_object *obj);
 void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
 void i915_gem_object_flush_write_domain(struct drm_gem_object *obj);
index 2748609f05b386c4c314fa10810276e22e3aa888..ec8a0d7ffa3990ea9f7ded8871f3ff384b2bf24d 100644 (file)
@@ -277,7 +277,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
 
        mutex_lock(&dev->struct_mutex);
 
-       ret = i915_gem_object_get_pages(obj);
+       ret = i915_gem_object_get_pages(obj, 0);
        if (ret != 0)
                goto fail_unlock;
 
@@ -321,40 +321,24 @@ fail_unlock:
        return ret;
 }
 
-static inline gfp_t
-i915_gem_object_get_page_gfp_mask (struct drm_gem_object *obj)
-{
-       return mapping_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping);
-}
-
-static inline void
-i915_gem_object_set_page_gfp_mask (struct drm_gem_object *obj, gfp_t gfp)
-{
-       mapping_set_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping, gfp);
-}
-
 static int
 i915_gem_object_get_pages_or_evict(struct drm_gem_object *obj)
 {
        int ret;
 
-       ret = i915_gem_object_get_pages(obj);
+       ret = i915_gem_object_get_pages(obj, __GFP_NORETRY | __GFP_NOWARN);
 
        /* If we've insufficient memory to map in the pages, attempt
         * to make some space by throwing out some old buffers.
         */
        if (ret == -ENOMEM) {
                struct drm_device *dev = obj->dev;
-               gfp_t gfp;
 
                ret = i915_gem_evict_something(dev, obj->size);
                if (ret)
                        return ret;
 
-               gfp = i915_gem_object_get_page_gfp_mask(obj);
-               i915_gem_object_set_page_gfp_mask(obj, gfp & ~__GFP_NORETRY);
-               ret = i915_gem_object_get_pages(obj);
-               i915_gem_object_set_page_gfp_mask (obj, gfp);
+               ret = i915_gem_object_get_pages(obj, 0);
        }
 
        return ret;
@@ -790,7 +774,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
 
        mutex_lock(&dev->struct_mutex);
 
-       ret = i915_gem_object_get_pages(obj);
+       ret = i915_gem_object_get_pages(obj, 0);
        if (ret != 0)
                goto fail_unlock;
 
@@ -1568,6 +1552,8 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
        else
                list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
 
+       BUG_ON(!list_empty(&obj_priv->gpu_write_list));
+
        obj_priv->last_rendering_seqno = 0;
        if (obj_priv->active) {
                obj_priv->active = 0;
@@ -1638,7 +1624,8 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
                struct drm_i915_gem_object *obj_priv, *next;
 
                list_for_each_entry_safe(obj_priv, next,
-                                        &dev_priv->mm.flushing_list, list) {
+                                        &dev_priv->mm.gpu_write_list,
+                                        gpu_write_list) {
                        struct drm_gem_object *obj = obj_priv->obj;
 
                        if ((obj->write_domain & flush_domains) ==
@@ -1646,6 +1633,7 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
                                uint32_t old_write_domain = obj->write_domain;
 
                                obj->write_domain = 0;
+                               list_del_init(&obj_priv->gpu_write_list);
                                i915_gem_object_move_to_active(obj, seqno);
 
                                trace_i915_gem_object_change_domain(obj,
@@ -2100,8 +2088,8 @@ static int
 i915_gem_evict_everything(struct drm_device *dev)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
-       uint32_t seqno;
        int ret;
+       uint32_t seqno;
        bool lists_empty;
 
        spin_lock(&dev_priv->mm.active_list_lock);
@@ -2123,6 +2111,8 @@ i915_gem_evict_everything(struct drm_device *dev)
        if (ret)
                return ret;
 
+       BUG_ON(!list_empty(&dev_priv->mm.flushing_list));
+
        ret = i915_gem_evict_from_inactive_list(dev);
        if (ret)
                return ret;
@@ -2230,7 +2220,8 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
 }
 
 int
-i915_gem_object_get_pages(struct drm_gem_object *obj)
+i915_gem_object_get_pages(struct drm_gem_object *obj,
+                         gfp_t gfpmask)
 {
        struct drm_i915_gem_object *obj_priv = obj->driver_private;
        int page_count, i;
@@ -2256,7 +2247,10 @@ i915_gem_object_get_pages(struct drm_gem_object *obj)
        inode = obj->filp->f_path.dentry->d_inode;
        mapping = inode->i_mapping;
        for (i = 0; i < page_count; i++) {
-               page = read_mapping_page(mapping, i, NULL);
+               page = read_cache_page_gfp(mapping, i,
+                                          mapping_gfp_mask (mapping) |
+                                          __GFP_COLD |
+                                          gfpmask);
                if (IS_ERR(page)) {
                        ret = PTR_ERR(page);
                        i915_gem_object_put_pages(obj);
@@ -2579,7 +2573,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
        drm_i915_private_t *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj_priv = obj->driver_private;
        struct drm_mm_node *free_space;
-       bool retry_alloc = false;
+       gfp_t gfpmask =  __GFP_NORETRY | __GFP_NOWARN;
        int ret;
 
        if (obj_priv->madv != I915_MADV_WILLNEED) {
@@ -2623,15 +2617,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
        DRM_INFO("Binding object of size %zd at 0x%08x\n",
                 obj->size, obj_priv->gtt_offset);
 #endif
-       if (retry_alloc) {
-               i915_gem_object_set_page_gfp_mask (obj,
-                                                  i915_gem_object_get_page_gfp_mask (obj) & ~__GFP_NORETRY);
-       }
-       ret = i915_gem_object_get_pages(obj);
-       if (retry_alloc) {
-               i915_gem_object_set_page_gfp_mask (obj,
-                                                  i915_gem_object_get_page_gfp_mask (obj) | __GFP_NORETRY);
-       }
+       ret = i915_gem_object_get_pages(obj, gfpmask);
        if (ret) {
                drm_mm_put_block(obj_priv->gtt_space);
                obj_priv->gtt_space = NULL;
@@ -2641,9 +2627,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
                        ret = i915_gem_evict_something(dev, obj->size);
                        if (ret) {
                                /* now try to shrink everyone else */
-                               if (! retry_alloc) {
-                                   retry_alloc = true;
-                                   goto search_free;
+                               if (gfpmask) {
+                                       gfpmask = 0;
+                                       goto search_free;
                                }
 
                                return ret;
@@ -2721,7 +2707,7 @@ i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj)
        old_write_domain = obj->write_domain;
        i915_gem_flush(dev, 0, obj->write_domain);
        seqno = i915_add_request(dev, NULL, obj->write_domain);
-       obj->write_domain = 0;
+       BUG_ON(obj->write_domain);
        i915_gem_object_move_to_active(obj, seqno);
 
        trace_i915_gem_object_change_domain(obj,
@@ -2837,6 +2823,57 @@ i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write)
        return 0;
 }
 
+/*
+ * Prepare buffer for display plane. Use uninterruptible for possible flush
+ * wait, as in modesetting process we're not supposed to be interrupted.
+ */
+int
+i915_gem_object_set_to_display_plane(struct drm_gem_object *obj)
+{
+       struct drm_device *dev = obj->dev;
+       struct drm_i915_gem_object *obj_priv = obj->driver_private;
+       uint32_t old_write_domain, old_read_domains;
+       int ret;
+
+       /* Not valid to be called on unbound objects. */
+       if (obj_priv->gtt_space == NULL)
+               return -EINVAL;
+
+       i915_gem_object_flush_gpu_write_domain(obj);
+
+       /* Wait on any GPU rendering and flushing to occur. */
+       if (obj_priv->active) {
+#if WATCH_BUF
+               DRM_INFO("%s: object %p wait for seqno %08x\n",
+                         __func__, obj, obj_priv->last_rendering_seqno);
+#endif
+               ret = i915_do_wait_request(dev, obj_priv->last_rendering_seqno, 0);
+               if (ret != 0)
+                       return ret;
+       }
+
+       old_write_domain = obj->write_domain;
+       old_read_domains = obj->read_domains;
+
+       obj->read_domains &= I915_GEM_DOMAIN_GTT;
+
+       i915_gem_object_flush_cpu_write_domain(obj);
+
+       /* It should now be out of any other write domains, and we can update
+        * the domain values for our changes.
+        */
+       BUG_ON((obj->write_domain & ~I915_GEM_DOMAIN_GTT) != 0);
+       obj->read_domains |= I915_GEM_DOMAIN_GTT;
+       obj->write_domain = I915_GEM_DOMAIN_GTT;
+       obj_priv->dirty = 1;
+
+       trace_i915_gem_object_change_domain(obj,
+                                           old_read_domains,
+                                           old_write_domain);
+
+       return 0;
+}
+
 /**
  * Moves a single object to the CPU read, and possibly write domain.
  *
@@ -3533,6 +3570,9 @@ i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object2 *exec_list,
        uint32_t reloc_count = 0, i;
        int ret = 0;
 
+       if (relocs == NULL)
+           return 0;
+
        for (i = 0; i < buffer_count; i++) {
                struct drm_i915_gem_relocation_entry __user *user_relocs;
                int unwritten;
@@ -3622,7 +3662,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        struct drm_gem_object *batch_obj;
        struct drm_i915_gem_object *obj_priv;
        struct drm_clip_rect *cliprects = NULL;
-       struct drm_i915_gem_relocation_entry *relocs;
+       struct drm_i915_gem_relocation_entry *relocs = NULL;
        int ret = 0, ret2, i, pinned = 0;
        uint64_t exec_offset;
        uint32_t seqno, flush_domains, reloc_index;
@@ -3648,8 +3688,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        if (args->num_cliprects != 0) {
                cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects),
                                    GFP_KERNEL);
-               if (cliprects == NULL)
+               if (cliprects == NULL) {
+                       ret = -ENOMEM;
                        goto pre_mutex_err;
+               }
 
                ret = copy_from_user(cliprects,
                                     (struct drm_clip_rect __user *)
@@ -3691,6 +3733,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                if (object_list[i] == NULL) {
                        DRM_ERROR("Invalid object handle %d at index %d\n",
                                   exec_list[i].handle, i);
+                       /* prevent error path from reading uninitialized data */
+                       args->buffer_count = i + 1;
                        ret = -EBADF;
                        goto err;
                }
@@ -3699,6 +3743,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                if (obj_priv->in_execbuffer) {
                        DRM_ERROR("Object %p appears more than once in object list\n",
                                   object_list[i]);
+                       /* prevent error path from reading uninitialized data */
+                       args->buffer_count = i + 1;
                        ret = -EBADF;
                        goto err;
                }
@@ -3812,16 +3858,23 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                i915_gem_flush(dev,
                               dev->invalidate_domains,
                               dev->flush_domains);
-               if (dev->flush_domains)
+               if (dev->flush_domains & I915_GEM_GPU_DOMAINS)
                        (void)i915_add_request(dev, file_priv,
                                               dev->flush_domains);
        }
 
        for (i = 0; i < args->buffer_count; i++) {
                struct drm_gem_object *obj = object_list[i];
+               struct drm_i915_gem_object *obj_priv = obj->driver_private;
                uint32_t old_write_domain = obj->write_domain;
 
                obj->write_domain = obj->pending_write_domain;
+               if (obj->write_domain)
+                       list_move_tail(&obj_priv->gpu_write_list,
+                                      &dev_priv->mm.gpu_write_list);
+               else
+                       list_del_init(&obj_priv->gpu_write_list);
+
                trace_i915_gem_object_change_domain(obj,
                                                    obj->read_domains,
                                                    old_write_domain);
@@ -3895,6 +3948,7 @@ err:
 
        mutex_unlock(&dev->struct_mutex);
 
+pre_mutex_err:
        /* Copy the updated relocations out regardless of current error
         * state.  Failure to update the relocs would mean that the next
         * time userland calls execbuf, it would do so with presumed offset
@@ -3909,7 +3963,6 @@ err:
                        ret = ret2;
        }
 
-pre_mutex_err:
        drm_free_large(object_list);
        kfree(cliprects);
 
@@ -4000,8 +4053,6 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
                                  "back to user (%d)\n",
                                  args->buffer_count, ret);
                }
-       } else {
-               DRM_ERROR("i915_gem_do_execbuffer returns %d\n", ret);
        }
 
        drm_free_large(exec_list);
@@ -4334,6 +4385,7 @@ int i915_gem_init_object(struct drm_gem_object *obj)
        obj_priv->obj = obj;
        obj_priv->fence_reg = I915_FENCE_REG_NONE;
        INIT_LIST_HEAD(&obj_priv->list);
+       INIT_LIST_HEAD(&obj_priv->gpu_write_list);
        INIT_LIST_HEAD(&obj_priv->fence_list);
        obj_priv->madv = I915_MADV_WILLNEED;
 
@@ -4785,6 +4837,7 @@ i915_gem_load(struct drm_device *dev)
        spin_lock_init(&dev_priv->mm.active_list_lock);
        INIT_LIST_HEAD(&dev_priv->mm.active_list);
        INIT_LIST_HEAD(&dev_priv->mm.flushing_list);
+       INIT_LIST_HEAD(&dev_priv->mm.gpu_write_list);
        INIT_LIST_HEAD(&dev_priv->mm.inactive_list);
        INIT_LIST_HEAD(&dev_priv->mm.request_list);
        INIT_LIST_HEAD(&dev_priv->mm.fence_list);
@@ -4897,7 +4950,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
        if (!obj_priv->phys_obj)
                return;
 
-       ret = i915_gem_object_get_pages(obj);
+       ret = i915_gem_object_get_pages(obj, 0);
        if (ret)
                goto out;
 
@@ -4955,7 +5008,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
        obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1];
        obj_priv->phys_obj->cur_obj = obj;
 
-       ret = i915_gem_object_get_pages(obj);
+       ret = i915_gem_object_get_pages(obj, 0);
        if (ret) {
                DRM_ERROR("failed to get page list\n");
                goto out;
index 7cd8110051b6e22e26bc487418533c6b9f47d806..a17d6bdfe63e6efe15d329755049e48ec9ee87cc 100644 (file)
@@ -274,7 +274,6 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
        drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
        int ret = IRQ_NONE;
        u32 de_iir, gt_iir, de_ier, pch_iir;
-       u32 new_de_iir, new_gt_iir, new_pch_iir;
        struct drm_i915_master_private *master_priv;
 
        /* disable master interrupt before clearing iir  */
@@ -286,51 +285,58 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
        gt_iir = I915_READ(GTIIR);
        pch_iir = I915_READ(SDEIIR);
 
-       for (;;) {
-               if (de_iir == 0 && gt_iir == 0 && pch_iir == 0)
-                       break;
+       if (de_iir == 0 && gt_iir == 0 && pch_iir == 0)
+               goto done;
 
-               ret = IRQ_HANDLED;
+       ret = IRQ_HANDLED;
 
-               /* should clear PCH hotplug event before clear CPU irq */
-               I915_WRITE(SDEIIR, pch_iir);
-               new_pch_iir = I915_READ(SDEIIR);
+       if (dev->primary->master) {
+               master_priv = dev->primary->master->driver_priv;
+               if (master_priv->sarea_priv)
+                       master_priv->sarea_priv->last_dispatch =
+                               READ_BREADCRUMB(dev_priv);
+       }
 
-               I915_WRITE(DEIIR, de_iir);
-               new_de_iir = I915_READ(DEIIR);
-               I915_WRITE(GTIIR, gt_iir);
-               new_gt_iir = I915_READ(GTIIR);
+       if (gt_iir & GT_USER_INTERRUPT) {
+               u32 seqno = i915_get_gem_seqno(dev);
+               dev_priv->mm.irq_gem_seqno = seqno;
+               trace_i915_gem_request_complete(dev, seqno);
+               DRM_WAKEUP(&dev_priv->irq_queue);
+               dev_priv->hangcheck_count = 0;
+               mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
+       }
 
-               if (dev->primary->master) {
-                       master_priv = dev->primary->master->driver_priv;
-                       if (master_priv->sarea_priv)
-                               master_priv->sarea_priv->last_dispatch =
-                                       READ_BREADCRUMB(dev_priv);
-               }
+       if (de_iir & DE_GSE)
+               ironlake_opregion_gse_intr(dev);
 
-               if (gt_iir & GT_USER_INTERRUPT) {
-                       u32 seqno = i915_get_gem_seqno(dev);
-                       dev_priv->mm.irq_gem_seqno = seqno;
-                       trace_i915_gem_request_complete(dev, seqno);
-                       DRM_WAKEUP(&dev_priv->irq_queue);
-                       dev_priv->hangcheck_count = 0;
-                       mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
-               }
+       if (de_iir & DE_PLANEA_FLIP_DONE) {
+               intel_prepare_page_flip(dev, 0);
+               intel_finish_page_flip(dev, 0);
+       }
 
-               if (de_iir & DE_GSE)
-                       ironlake_opregion_gse_intr(dev);
+       if (de_iir & DE_PLANEB_FLIP_DONE) {
+               intel_prepare_page_flip(dev, 1);
+               intel_finish_page_flip(dev, 1);
+       }
 
-               /* check event from PCH */
-               if ((de_iir & DE_PCH_EVENT) &&
-                       (pch_iir & SDE_HOTPLUG_MASK)) {
-                       queue_work(dev_priv->wq, &dev_priv->hotplug_work);
-               }
+       if (de_iir & DE_PIPEA_VBLANK)
+               drm_handle_vblank(dev, 0);
+
+       if (de_iir & DE_PIPEB_VBLANK)
+               drm_handle_vblank(dev, 1);
 
-               de_iir = new_de_iir;
-               gt_iir = new_gt_iir;
-               pch_iir = new_pch_iir;
+       /* check event from PCH */
+       if ((de_iir & DE_PCH_EVENT) &&
+           (pch_iir & SDE_HOTPLUG_MASK)) {
+               queue_work(dev_priv->wq, &dev_priv->hotplug_work);
        }
 
+       /* should clear PCH hotplug event before clear CPU irq */
+       I915_WRITE(SDEIIR, pch_iir);
+       I915_WRITE(GTIIR, gt_iir);
+       I915_WRITE(DEIIR, de_iir);
+
+done:
        I915_WRITE(DEIER, de_ier);
        (void)I915_READ(DEIER);
 
@@ -854,11 +860,11 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
        if (!(pipeconf & PIPEACONF_ENABLE))
                return -EINVAL;
 
-       if (IS_IRONLAKE(dev))
-               return 0;
-
        spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
-       if (IS_I965G(dev))
+       if (IS_IRONLAKE(dev))
+               ironlake_enable_display_irq(dev_priv, (pipe == 0) ? 
+                                           DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
+       else if (IS_I965G(dev))
                i915_enable_pipestat(dev_priv, pipe,
                                     PIPE_START_VBLANK_INTERRUPT_ENABLE);
        else
@@ -876,13 +882,14 @@ void i915_disable_vblank(struct drm_device *dev, int pipe)
        drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
        unsigned long irqflags;
 
-       if (IS_IRONLAKE(dev))
-               return;
-
        spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
-       i915_disable_pipestat(dev_priv, pipe,
-                             PIPE_VBLANK_INTERRUPT_ENABLE |
-                             PIPE_START_VBLANK_INTERRUPT_ENABLE);
+       if (IS_IRONLAKE(dev))
+               ironlake_disable_display_irq(dev_priv, (pipe == 0) ? 
+                                            DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
+       else
+               i915_disable_pipestat(dev_priv, pipe,
+                                     PIPE_VBLANK_INTERRUPT_ENABLE |
+                                     PIPE_START_VBLANK_INTERRUPT_ENABLE);
        spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
 }
 
@@ -1025,13 +1032,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 {
        drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
        /* enable kind of interrupts always enabled */
-       u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT;
+       u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
+                          DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
        u32 render_mask = GT_USER_INTERRUPT;
        u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
                           SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
 
        dev_priv->irq_mask_reg = ~display_mask;
-       dev_priv->de_irq_enable_reg = display_mask;
+       dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK;
 
        /* should always can generate irq */
        I915_WRITE(DEIIR, I915_READ(DEIIR));
index 149d360d64a33f83cd5e03ef7eca7c76fa0fb67e..ab1bd2d3d3b64a20d2b4362d3f418e6e9eb1e140 100644 (file)
 #define   FBC_CTL_PERIODIC     (1<<30)
 #define   FBC_CTL_INTERVAL_SHIFT (16)
 #define   FBC_CTL_UNCOMPRESSIBLE (1<<14)
+#define   FBC_C3_IDLE          (1<<13)
 #define   FBC_CTL_STRIDE_SHIFT (5)
 #define   FBC_CTL_FENCENO      (1<<0)
 #define FBC_COMMAND            0x0320c
 #define   DSPFW_PLANEB_SHIFT   8
 #define DSPFW2                 0x70038
 #define   DSPFW_CURSORA_MASK   0x00003f00
-#define   DSPFW_CURSORA_SHIFT  16
+#define   DSPFW_CURSORA_SHIFT  8
 #define DSPFW3                 0x7003c
 #define   DSPFW_HPLL_SR_EN     (1<<31)
 #define   DSPFW_CURSOR_SR_SHIFT        24
index f275677475801badaa2be08f7c8abd2c5ed96251..15fbc1b5a83ebe0d3df0afd331b558531a0ac188 100644 (file)
@@ -33,6 +33,8 @@
 #define        SLAVE_ADDR1     0x70
 #define        SLAVE_ADDR2     0x72
 
+static int panel_type;
+
 static void *
 find_section(struct bdb_header *bdb, int section_id)
 {
@@ -128,6 +130,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
        dev_priv->lvds_dither = lvds_options->pixel_dither;
        if (lvds_options->panel_type == 0xff)
                return;
+       panel_type = lvds_options->panel_type;
 
        lvds_lfp_data = find_section(bdb, BDB_LVDS_LFP_DATA);
        if (!lvds_lfp_data)
@@ -197,7 +200,8 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
                memset(temp_mode, 0, sizeof(*temp_mode));
        }
        kfree(temp_mode);
-       if (temp_downclock < panel_fixed_mode->clock) {
+       if (temp_downclock < panel_fixed_mode->clock &&
+           i915_lvds_downclock) {
                dev_priv->lvds_downclock_avail = 1;
                dev_priv->lvds_downclock = temp_downclock;
                DRM_DEBUG_KMS("LVDS downclock is found in VBT. ",
@@ -404,6 +408,34 @@ parse_driver_features(struct drm_i915_private *dev_priv,
                dev_priv->render_reclock_avail = true;
 }
 
+static void
+parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
+{
+       struct bdb_edp *edp;
+
+       edp = find_section(bdb, BDB_EDP);
+       if (!edp) {
+               if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp_support) {
+                       DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported,\
+                                      assume 18bpp panel color depth.\n");
+                       dev_priv->edp_bpp = 18;
+               }
+               return;
+       }
+
+       switch ((edp->color_depth >> (panel_type * 2)) & 3) {
+       case EDP_18BPP:
+               dev_priv->edp_bpp = 18;
+               break;
+       case EDP_24BPP:
+               dev_priv->edp_bpp = 24;
+               break;
+       case EDP_30BPP:
+               dev_priv->edp_bpp = 30;
+               break;
+       }
+}
+
 static void
 parse_device_mapping(struct drm_i915_private *dev_priv,
                       struct bdb_header *bdb)
@@ -521,6 +553,7 @@ intel_init_bios(struct drm_device *dev)
        parse_sdvo_device_mapping(dev_priv, bdb);
        parse_device_mapping(dev_priv, bdb);
        parse_driver_features(dev_priv, bdb);
+       parse_edp(dev_priv, bdb);
 
        pci_unmap_rom(pdev, bios);
 
index 425ac9d7f724792cce3e36f90122f3e644aceca3..4c18514f6f80f469d15a039ef47d37bd0e249ce4 100644 (file)
@@ -98,6 +98,7 @@ struct vbios_data {
 #define BDB_SDVO_LVDS_PNP_IDS   24
 #define BDB_SDVO_LVDS_POWER_SEQ         25
 #define BDB_TV_OPTIONS          26
+#define BDB_EDP                         27
 #define BDB_LVDS_OPTIONS        40
 #define BDB_LVDS_LFP_DATA_PTRS  41
 #define BDB_LVDS_LFP_DATA       42
@@ -426,6 +427,45 @@ struct bdb_driver_features {
        u8 custom_vbt_version;
 } __attribute__((packed));
 
+#define EDP_18BPP      0
+#define EDP_24BPP      1
+#define EDP_30BPP      2
+#define EDP_RATE_1_62  0
+#define EDP_RATE_2_7   1
+#define EDP_LANE_1     0
+#define EDP_LANE_2     1
+#define EDP_LANE_4     3
+#define EDP_PREEMPHASIS_NONE   0
+#define EDP_PREEMPHASIS_3_5dB  1
+#define EDP_PREEMPHASIS_6dB    2
+#define EDP_PREEMPHASIS_9_5dB  3
+#define EDP_VSWING_0_4V                0
+#define EDP_VSWING_0_6V                1
+#define EDP_VSWING_0_8V                2
+#define EDP_VSWING_1_2V                3
+
+struct edp_power_seq {
+       u16 t3;
+       u16 t7;
+       u16 t9;
+       u16 t10;
+       u16 t12;
+} __attribute__ ((packed));
+
+struct edp_link_params {
+       u8 rate:4;
+       u8 lanes:4;
+       u8 preemphasis:4;
+       u8 vswing:4;
+} __attribute__ ((packed));
+
+struct bdb_edp {
+       struct edp_power_seq power_seqs[16];
+       u32 color_depth;
+       u32 sdrrs_msa_timing_delay;
+       struct edp_link_params link_params[16];
+} __attribute__ ((packed));
+
 bool intel_init_bios(struct drm_device *dev);
 
 /*
index ddefc871edfe4806714a07d44444f1e08e5422af..79dd4026586fa55f6072b05bb27a9fce2734099a 100644 (file)
@@ -157,6 +157,9 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
        adpa = I915_READ(PCH_ADPA);
 
        adpa &= ~ADPA_CRT_HOTPLUG_MASK;
+       /* disable HPD first */
+       I915_WRITE(PCH_ADPA, adpa);
+       (void)I915_READ(PCH_ADPA);
 
        adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |
                        ADPA_CRT_HOTPLUG_WARMUP_10MS |
index 002612fae717c0ac7c795698e71068e704ca530d..b27202d23ebc1d9aab4a327eec55d733bd43cae8 100644 (file)
@@ -70,8 +70,6 @@ struct intel_limit {
     intel_p2_t     p2;
     bool (* find_pll)(const intel_limit_t *, struct drm_crtc *,
                      int, int, intel_clock_t *);
-    bool (* find_reduced_pll)(const intel_limit_t *, struct drm_crtc *,
-                             int, int, intel_clock_t *);
 };
 
 #define I8XX_DOT_MIN             25000
@@ -242,41 +240,91 @@ struct intel_limit {
 #define IRONLAKE_DOT_MAX         350000
 #define IRONLAKE_VCO_MIN         1760000
 #define IRONLAKE_VCO_MAX         3510000
-#define IRONLAKE_N_MIN           1
-#define IRONLAKE_N_MAX           5
-#define IRONLAKE_M_MIN           79
-#define IRONLAKE_M_MAX           118
 #define IRONLAKE_M1_MIN          12
-#define IRONLAKE_M1_MAX          23
+#define IRONLAKE_M1_MAX          22
 #define IRONLAKE_M2_MIN          5
 #define IRONLAKE_M2_MAX          9
-#define IRONLAKE_P_SDVO_DAC_MIN  5
-#define IRONLAKE_P_SDVO_DAC_MAX  80
-#define IRONLAKE_P_LVDS_MIN      28
-#define IRONLAKE_P_LVDS_MAX      112
-#define IRONLAKE_P1_MIN          1
-#define IRONLAKE_P1_MAX          8
-#define IRONLAKE_P2_SDVO_DAC_SLOW 10
-#define IRONLAKE_P2_SDVO_DAC_FAST 5
-#define IRONLAKE_P2_LVDS_SLOW    14 /* single channel */
-#define IRONLAKE_P2_LVDS_FAST    7  /* double channel */
 #define IRONLAKE_P2_DOT_LIMIT    225000 /* 225Mhz */
 
-#define IRONLAKE_P_DISPLAY_PORT_MIN    10
-#define IRONLAKE_P_DISPLAY_PORT_MAX    20
-#define IRONLAKE_P2_DISPLAY_PORT_FAST  10
-#define IRONLAKE_P2_DISPLAY_PORT_SLOW  10
-#define IRONLAKE_P2_DISPLAY_PORT_LIMIT 0
-#define IRONLAKE_P1_DISPLAY_PORT_MIN   1
-#define IRONLAKE_P1_DISPLAY_PORT_MAX   2
+/* We have parameter ranges for different type of outputs. */
+
+/* DAC & HDMI Refclk 120Mhz */
+#define IRONLAKE_DAC_N_MIN     1
+#define IRONLAKE_DAC_N_MAX     5
+#define IRONLAKE_DAC_M_MIN     79
+#define IRONLAKE_DAC_M_MAX     127
+#define IRONLAKE_DAC_P_MIN     5
+#define IRONLAKE_DAC_P_MAX     80
+#define IRONLAKE_DAC_P1_MIN    1
+#define IRONLAKE_DAC_P1_MAX    8
+#define IRONLAKE_DAC_P2_SLOW   10
+#define IRONLAKE_DAC_P2_FAST   5
+
+/* LVDS single-channel 120Mhz refclk */
+#define IRONLAKE_LVDS_S_N_MIN  1
+#define IRONLAKE_LVDS_S_N_MAX  3
+#define IRONLAKE_LVDS_S_M_MIN  79
+#define IRONLAKE_LVDS_S_M_MAX  118
+#define IRONLAKE_LVDS_S_P_MIN  28
+#define IRONLAKE_LVDS_S_P_MAX  112
+#define IRONLAKE_LVDS_S_P1_MIN 2
+#define IRONLAKE_LVDS_S_P1_MAX 8
+#define IRONLAKE_LVDS_S_P2_SLOW        14
+#define IRONLAKE_LVDS_S_P2_FAST        14
+
+/* LVDS dual-channel 120Mhz refclk */
+#define IRONLAKE_LVDS_D_N_MIN  1
+#define IRONLAKE_LVDS_D_N_MAX  3
+#define IRONLAKE_LVDS_D_M_MIN  79
+#define IRONLAKE_LVDS_D_M_MAX  127
+#define IRONLAKE_LVDS_D_P_MIN  14
+#define IRONLAKE_LVDS_D_P_MAX  56
+#define IRONLAKE_LVDS_D_P1_MIN 2
+#define IRONLAKE_LVDS_D_P1_MAX 8
+#define IRONLAKE_LVDS_D_P2_SLOW        7
+#define IRONLAKE_LVDS_D_P2_FAST        7
+
+/* LVDS single-channel 100Mhz refclk */
+#define IRONLAKE_LVDS_S_SSC_N_MIN      1
+#define IRONLAKE_LVDS_S_SSC_N_MAX      2
+#define IRONLAKE_LVDS_S_SSC_M_MIN      79
+#define IRONLAKE_LVDS_S_SSC_M_MAX      126
+#define IRONLAKE_LVDS_S_SSC_P_MIN      28
+#define IRONLAKE_LVDS_S_SSC_P_MAX      112
+#define IRONLAKE_LVDS_S_SSC_P1_MIN     2
+#define IRONLAKE_LVDS_S_SSC_P1_MAX     8
+#define IRONLAKE_LVDS_S_SSC_P2_SLOW    14
+#define IRONLAKE_LVDS_S_SSC_P2_FAST    14
+
+/* LVDS dual-channel 100Mhz refclk */
+#define IRONLAKE_LVDS_D_SSC_N_MIN      1
+#define IRONLAKE_LVDS_D_SSC_N_MAX      3
+#define IRONLAKE_LVDS_D_SSC_M_MIN      79
+#define IRONLAKE_LVDS_D_SSC_M_MAX      126
+#define IRONLAKE_LVDS_D_SSC_P_MIN      14
+#define IRONLAKE_LVDS_D_SSC_P_MAX      42
+#define IRONLAKE_LVDS_D_SSC_P1_MIN     2
+#define IRONLAKE_LVDS_D_SSC_P1_MAX     6
+#define IRONLAKE_LVDS_D_SSC_P2_SLOW    7
+#define IRONLAKE_LVDS_D_SSC_P2_FAST    7
+
+/* DisplayPort */
+#define IRONLAKE_DP_N_MIN              1
+#define IRONLAKE_DP_N_MAX              2
+#define IRONLAKE_DP_M_MIN              81
+#define IRONLAKE_DP_M_MAX              90
+#define IRONLAKE_DP_P_MIN              10
+#define IRONLAKE_DP_P_MAX              20
+#define IRONLAKE_DP_P2_FAST            10
+#define IRONLAKE_DP_P2_SLOW            10
+#define IRONLAKE_DP_P2_LIMIT           0
+#define IRONLAKE_DP_P1_MIN             1
+#define IRONLAKE_DP_P1_MAX             2
 
 static bool
 intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
                    int target, int refclk, intel_clock_t *best_clock);
 static bool
-intel_find_best_reduced_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
-                           int target, int refclk, intel_clock_t *best_clock);
-static bool
 intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
                        int target, int refclk, intel_clock_t *best_clock);
 
@@ -299,7 +347,6 @@ static const intel_limit_t intel_limits_i8xx_dvo = {
        .p2  = { .dot_limit = I8XX_P2_SLOW_LIMIT,
                 .p2_slow = I8XX_P2_SLOW,       .p2_fast = I8XX_P2_FAST },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
 
 static const intel_limit_t intel_limits_i8xx_lvds = {
@@ -314,7 +361,6 @@ static const intel_limit_t intel_limits_i8xx_lvds = {
        .p2  = { .dot_limit = I8XX_P2_SLOW_LIMIT,
                 .p2_slow = I8XX_P2_LVDS_SLOW,  .p2_fast = I8XX_P2_LVDS_FAST },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
        
 static const intel_limit_t intel_limits_i9xx_sdvo = {
@@ -329,7 +375,6 @@ static const intel_limit_t intel_limits_i9xx_sdvo = {
        .p2  = { .dot_limit = I9XX_P2_SDVO_DAC_SLOW_LIMIT,
                 .p2_slow = I9XX_P2_SDVO_DAC_SLOW,      .p2_fast = I9XX_P2_SDVO_DAC_FAST },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
 
 static const intel_limit_t intel_limits_i9xx_lvds = {
@@ -347,7 +392,6 @@ static const intel_limit_t intel_limits_i9xx_lvds = {
        .p2  = { .dot_limit = I9XX_P2_LVDS_SLOW_LIMIT,
                 .p2_slow = I9XX_P2_LVDS_SLOW,  .p2_fast = I9XX_P2_LVDS_FAST },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
 
     /* below parameter and function is for G4X Chipset Family*/
@@ -365,7 +409,6 @@ static const intel_limit_t intel_limits_g4x_sdvo = {
                 .p2_fast = G4X_P2_SDVO_FAST
        },
        .find_pll = intel_g4x_find_best_PLL,
-       .find_reduced_pll = intel_g4x_find_best_PLL,
 };
 
 static const intel_limit_t intel_limits_g4x_hdmi = {
@@ -382,7 +425,6 @@ static const intel_limit_t intel_limits_g4x_hdmi = {
                 .p2_fast = G4X_P2_HDMI_DAC_FAST
        },
        .find_pll = intel_g4x_find_best_PLL,
-       .find_reduced_pll = intel_g4x_find_best_PLL,
 };
 
 static const intel_limit_t intel_limits_g4x_single_channel_lvds = {
@@ -407,7 +449,6 @@ static const intel_limit_t intel_limits_g4x_single_channel_lvds = {
                 .p2_fast = G4X_P2_SINGLE_CHANNEL_LVDS_FAST
        },
        .find_pll = intel_g4x_find_best_PLL,
-       .find_reduced_pll = intel_g4x_find_best_PLL,
 };
 
 static const intel_limit_t intel_limits_g4x_dual_channel_lvds = {
@@ -432,7 +473,6 @@ static const intel_limit_t intel_limits_g4x_dual_channel_lvds = {
                 .p2_fast = G4X_P2_DUAL_CHANNEL_LVDS_FAST
        },
        .find_pll = intel_g4x_find_best_PLL,
-       .find_reduced_pll = intel_g4x_find_best_PLL,
 };
 
 static const intel_limit_t intel_limits_g4x_display_port = {
@@ -470,7 +510,6 @@ static const intel_limit_t intel_limits_pineview_sdvo = {
        .p2  = { .dot_limit = I9XX_P2_SDVO_DAC_SLOW_LIMIT,
                 .p2_slow = I9XX_P2_SDVO_DAC_SLOW,      .p2_fast = I9XX_P2_SDVO_DAC_FAST },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
 
 static const intel_limit_t intel_limits_pineview_lvds = {
@@ -486,36 +525,80 @@ static const intel_limit_t intel_limits_pineview_lvds = {
        .p2  = { .dot_limit = I9XX_P2_LVDS_SLOW_LIMIT,
                 .p2_slow = I9XX_P2_LVDS_SLOW,  .p2_fast = I9XX_P2_LVDS_SLOW },
        .find_pll = intel_find_best_PLL,
-       .find_reduced_pll = intel_find_best_reduced_PLL,
 };
 
-static const intel_limit_t intel_limits_ironlake_sdvo = {
+static const intel_limit_t intel_limits_ironlake_dac = {
+       .dot = { .min = IRONLAKE_DOT_MIN,          .max = IRONLAKE_DOT_MAX },
+       .vco = { .min = IRONLAKE_VCO_MIN,          .max = IRONLAKE_VCO_MAX },
+       .n   = { .min = IRONLAKE_DAC_N_MIN,        .max = IRONLAKE_DAC_N_MAX },
+       .m   = { .min = IRONLAKE_DAC_M_MIN,        .max = IRONLAKE_DAC_M_MAX },
+       .m1  = { .min = IRONLAKE_M1_MIN,           .max = IRONLAKE_M1_MAX },
+       .m2  = { .min = IRONLAKE_M2_MIN,           .max = IRONLAKE_M2_MAX },
+       .p   = { .min = IRONLAKE_DAC_P_MIN,        .max = IRONLAKE_DAC_P_MAX },
+       .p1  = { .min = IRONLAKE_DAC_P1_MIN,       .max = IRONLAKE_DAC_P1_MAX },
+       .p2  = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
+                .p2_slow = IRONLAKE_DAC_P2_SLOW,
+                .p2_fast = IRONLAKE_DAC_P2_FAST },
+       .find_pll = intel_g4x_find_best_PLL,
+};
+
+static const intel_limit_t intel_limits_ironlake_single_lvds = {
+       .dot = { .min = IRONLAKE_DOT_MIN,          .max = IRONLAKE_DOT_MAX },
+       .vco = { .min = IRONLAKE_VCO_MIN,          .max = IRONLAKE_VCO_MAX },
+       .n   = { .min = IRONLAKE_LVDS_S_N_MIN,     .max = IRONLAKE_LVDS_S_N_MAX },
+       .m   = { .min = IRONLAKE_LVDS_S_M_MIN,     .max = IRONLAKE_LVDS_S_M_MAX },
+       .m1  = { .min = IRONLAKE_M1_MIN,           .max = IRONLAKE_M1_MAX },
+       .m2  = { .min = IRONLAKE_M2_MIN,           .max = IRONLAKE_M2_MAX },
+       .p   = { .min = IRONLAKE_LVDS_S_P_MIN,     .max = IRONLAKE_LVDS_S_P_MAX },
+       .p1  = { .min = IRONLAKE_LVDS_S_P1_MIN,    .max = IRONLAKE_LVDS_S_P1_MAX },
+       .p2  = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
+                .p2_slow = IRONLAKE_LVDS_S_P2_SLOW,
+                .p2_fast = IRONLAKE_LVDS_S_P2_FAST },
+       .find_pll = intel_g4x_find_best_PLL,
+};
+
+static const intel_limit_t intel_limits_ironlake_dual_lvds = {
+       .dot = { .min = IRONLAKE_DOT_MIN,          .max = IRONLAKE_DOT_MAX },
+       .vco = { .min = IRONLAKE_VCO_MIN,          .max = IRONLAKE_VCO_MAX },
+       .n   = { .min = IRONLAKE_LVDS_D_N_MIN,     .max = IRONLAKE_LVDS_D_N_MAX },
+       .m   = { .min = IRONLAKE_LVDS_D_M_MIN,     .max = IRONLAKE_LVDS_D_M_MAX },
+       .m1  = { .min = IRONLAKE_M1_MIN,           .max = IRONLAKE_M1_MAX },
+       .m2  = { .min = IRONLAKE_M2_MIN,           .max = IRONLAKE_M2_MAX },
+       .p   = { .min = IRONLAKE_LVDS_D_P_MIN,     .max = IRONLAKE_LVDS_D_P_MAX },
+       .p1  = { .min = IRONLAKE_LVDS_D_P1_MIN,    .max = IRONLAKE_LVDS_D_P1_MAX },
+       .p2  = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
+                .p2_slow = IRONLAKE_LVDS_D_P2_SLOW,
+                .p2_fast = IRONLAKE_LVDS_D_P2_FAST },
+       .find_pll = intel_g4x_find_best_PLL,
+};
+
+static const intel_limit_t intel_limits_ironlake_single_lvds_100m = {
        .dot = { .min = IRONLAKE_DOT_MIN,          .max = IRONLAKE_DOT_MAX },
        .vco = { .min = IRONLAKE_VCO_MIN,          .max = IRONLAKE_VCO_MAX },
-       .n   = { .min = IRONLAKE_N_MIN,            .max = IRONLAKE_N_MAX },
-       .m   = { .min = IRONLAKE_M_MIN,            .max = IRONLAKE_M_MAX },
+       .n   = { .min = IRONLAKE_LVDS_S_SSC_N_MIN, .max = IRONLAKE_LVDS_S_SSC_N_MAX },
+       .m   = { .min = IRONLAKE_LVDS_S_SSC_M_MIN, .max = IRONLAKE_LVDS_S_SSC_M_MAX },
        .m1  = { .min = IRONLAKE_M1_MIN,           .max = IRONLAKE_M1_MAX },
        .m2  = { .min = IRONLAKE_M2_MIN,           .max = IRONLAKE_M2_MAX },
-       .p   = { .min = IRONLAKE_P_SDVO_DAC_MIN,   .max = IRONLAKE_P_SDVO_DAC_MAX },
-       .p1  = { .min = IRONLAKE_P1_MIN,           .max = IRONLAKE_P1_MAX },
+       .p   = { .min = IRONLAKE_LVDS_S_SSC_P_MIN, .max = IRONLAKE_LVDS_S_SSC_P_MAX },
+       .p1  = { .min = IRONLAKE_LVDS_S_SSC_P1_MIN,.max = IRONLAKE_LVDS_S_SSC_P1_MAX },
        .p2  = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
-                .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW,
-                .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST },
+                .p2_slow = IRONLAKE_LVDS_S_SSC_P2_SLOW,
+                .p2_fast = IRONLAKE_LVDS_S_SSC_P2_FAST },
        .find_pll = intel_g4x_find_best_PLL,
 };
 
-static const intel_limit_t intel_limits_ironlake_lvds = {
+static const intel_limit_t intel_limits_ironlake_dual_lvds_100m = {
        .dot = { .min = IRONLAKE_DOT_MIN,          .max = IRONLAKE_DOT_MAX },
        .vco = { .min = IRONLAKE_VCO_MIN,          .max = IRONLAKE_VCO_MAX },
-       .n   = { .min = IRONLAKE_N_MIN,            .max = IRONLAKE_N_MAX },
-       .m   = { .min = IRONLAKE_M_MIN,            .max = IRONLAKE_M_MAX },
+       .n   = { .min = IRONLAKE_LVDS_D_SSC_N_MIN, .max = IRONLAKE_LVDS_D_SSC_N_MAX },
+       .m   = { .min = IRONLAKE_LVDS_D_SSC_M_MIN, .max = IRONLAKE_LVDS_D_SSC_M_MAX },
        .m1  = { .min = IRONLAKE_M1_MIN,           .max = IRONLAKE_M1_MAX },
        .m2  = { .min = IRONLAKE_M2_MIN,           .max = IRONLAKE_M2_MAX },
-       .p   = { .min = IRONLAKE_P_LVDS_MIN,       .max = IRONLAKE_P_LVDS_MAX },
-       .p1  = { .min = IRONLAKE_P1_MIN,           .max = IRONLAKE_P1_MAX },
+       .p   = { .min = IRONLAKE_LVDS_D_SSC_P_MIN, .max = IRONLAKE_LVDS_D_SSC_P_MAX },
+       .p1  = { .min = IRONLAKE_LVDS_D_SSC_P1_MIN,.max = IRONLAKE_LVDS_D_SSC_P1_MAX },
        .p2  = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
-                .p2_slow = IRONLAKE_P2_LVDS_SLOW,
-                .p2_fast = IRONLAKE_P2_LVDS_FAST },
+                .p2_slow = IRONLAKE_LVDS_D_SSC_P2_SLOW,
+                .p2_fast = IRONLAKE_LVDS_D_SSC_P2_FAST },
        .find_pll = intel_g4x_find_best_PLL,
 };
 
@@ -524,34 +607,53 @@ static const intel_limit_t intel_limits_ironlake_display_port = {
                  .max = IRONLAKE_DOT_MAX },
         .vco = { .min = IRONLAKE_VCO_MIN,
                  .max = IRONLAKE_VCO_MAX},
-        .n   = { .min = IRONLAKE_N_MIN,
-                 .max = IRONLAKE_N_MAX },
-        .m   = { .min = IRONLAKE_M_MIN,
-                 .max = IRONLAKE_M_MAX },
+        .n   = { .min = IRONLAKE_DP_N_MIN,
+                 .max = IRONLAKE_DP_N_MAX },
+        .m   = { .min = IRONLAKE_DP_M_MIN,
+                 .max = IRONLAKE_DP_M_MAX },
         .m1  = { .min = IRONLAKE_M1_MIN,
                  .max = IRONLAKE_M1_MAX },
         .m2  = { .min = IRONLAKE_M2_MIN,
                  .max = IRONLAKE_M2_MAX },
-        .p   = { .min = IRONLAKE_P_DISPLAY_PORT_MIN,
-                 .max = IRONLAKE_P_DISPLAY_PORT_MAX },
-        .p1  = { .min = IRONLAKE_P1_DISPLAY_PORT_MIN,
-                 .max = IRONLAKE_P1_DISPLAY_PORT_MAX},
-        .p2  = { .dot_limit = IRONLAKE_P2_DISPLAY_PORT_LIMIT,
-                 .p2_slow = IRONLAKE_P2_DISPLAY_PORT_SLOW,
-                 .p2_fast = IRONLAKE_P2_DISPLAY_PORT_FAST },
+        .p   = { .min = IRONLAKE_DP_P_MIN,
+                 .max = IRONLAKE_DP_P_MAX },
+        .p1  = { .min = IRONLAKE_DP_P1_MIN,
+                 .max = IRONLAKE_DP_P1_MAX},
+        .p2  = { .dot_limit = IRONLAKE_DP_P2_LIMIT,
+                 .p2_slow = IRONLAKE_DP_P2_SLOW,
+                 .p2_fast = IRONLAKE_DP_P2_FAST },
         .find_pll = intel_find_pll_ironlake_dp,
 };
 
 static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
        const intel_limit_t *limit;
-       if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
-               limit = &intel_limits_ironlake_lvds;
-       else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
+       int refclk = 120;
+
+       if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
+               if (dev_priv->lvds_use_ssc && dev_priv->lvds_ssc_freq == 100)
+                       refclk = 100;
+
+               if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) ==
+                   LVDS_CLKB_POWER_UP) {
+                       /* LVDS dual channel */
+                       if (refclk == 100)
+                               limit = &intel_limits_ironlake_dual_lvds_100m;
+                       else
+                               limit = &intel_limits_ironlake_dual_lvds;
+               } else {
+                       if (refclk == 100)
+                               limit = &intel_limits_ironlake_single_lvds_100m;
+                       else
+                               limit = &intel_limits_ironlake_single_lvds;
+               }
+       } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
                        HAS_eDP)
                limit = &intel_limits_ironlake_display_port;
        else
-               limit = &intel_limits_ironlake_sdvo;
+               limit = &intel_limits_ironlake_dac;
 
        return limit;
 }
@@ -768,46 +870,6 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
        return (err != target);
 }
 
-
-static bool
-intel_find_best_reduced_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
-                           int target, int refclk, intel_clock_t *best_clock)
-
-{
-       struct drm_device *dev = crtc->dev;
-       intel_clock_t clock;
-       int err = target;
-       bool found = false;
-
-       memcpy(&clock, best_clock, sizeof(intel_clock_t));
-
-       for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
-               for (clock.m2 = limit->m2.min; clock.m2 <= limit->m2.max; clock.m2++) {
-                       /* m1 is always 0 in Pineview */
-                       if (clock.m2 >= clock.m1 && !IS_PINEVIEW(dev))
-                               break;
-                       for (clock.n = limit->n.min; clock.n <= limit->n.max;
-                            clock.n++) {
-                               int this_err;
-
-                               intel_clock(dev, refclk, &clock);
-
-                               if (!intel_PLL_is_valid(crtc, &clock))
-                                       continue;
-
-                               this_err = abs(clock.dot - target);
-                               if (this_err < err) {
-                                       *best_clock = clock;
-                                       err = this_err;
-                                       found = true;
-                               }
-                       }
-               }
-       }
-
-       return found;
-}
-
 static bool
 intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
                        int target, int refclk, intel_clock_t *best_clock)
@@ -969,6 +1031,8 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
 
        /* enable it... */
        fbc_ctl = FBC_CTL_EN | FBC_CTL_PERIODIC;
+       if (IS_I945GM(dev))
+               fbc_ctl |= FBC_C3_IDLE; /* 945 needs special SR handling */
        fbc_ctl |= (dev_priv->cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT;
        fbc_ctl |= (interval & 0x2fff) << FBC_CTL_INTERVAL_SHIFT;
        if (obj_priv->tiling_mode != I915_TILING_NONE)
@@ -1262,7 +1326,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
                return ret;
        }
 
-       ret = i915_gem_object_set_to_gtt_domain(obj, 1);
+       ret = i915_gem_object_set_to_display_plane(obj);
        if (ret != 0) {
                i915_gem_object_unpin(obj);
                mutex_unlock(&dev->struct_mutex);
@@ -1693,6 +1757,7 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
        case DRM_MODE_DPMS_OFF:
                DRM_DEBUG_KMS("crtc %d dpms off\n", pipe);
 
+               drm_vblank_off(dev, pipe);
                /* Disable display plane */
                temp = I915_READ(dspcntr_reg);
                if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
@@ -2574,6 +2639,10 @@ static void g4x_update_wm(struct drm_device *dev,  int planea_clock,
                sr_entries = roundup(sr_entries / cacheline_size, 1);
                DRM_DEBUG("self-refresh entries: %d\n", sr_entries);
                I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
+       } else {
+               /* Turn off self refresh if both pipes are enabled */
+               I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
+                                       & ~FW_BLC_SELF_EN);
        }
 
        DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, SR %d\n",
@@ -2617,6 +2686,10 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
                        srwm = 1;
                srwm &= 0x3f;
                I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
+       } else {
+               /* Turn off self refresh if both pipes are enabled */
+               I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
+                                       & ~FW_BLC_SELF_EN);
        }
 
        DRM_DEBUG_KMS("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR %d\n",
@@ -2685,6 +2758,10 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
                if (srwm < 0)
                        srwm = 1;
                I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN | (srwm & 0x3f));
+       } else {
+               /* Turn off self refresh if both pipes are enabled */
+               I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
+                                       & ~FW_BLC_SELF_EN);
        }
 
        DRM_DEBUG_KMS("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n",
@@ -2910,10 +2987,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
                return -EINVAL;
        }
 
-       if (is_lvds && limit->find_reduced_pll &&
-                       dev_priv->lvds_downclock_avail) {
-               memcpy(&reduced_clock, &clock, sizeof(intel_clock_t));
-               has_reduced_clock = limit->find_reduced_pll(limit, crtc,
+       if (is_lvds && dev_priv->lvds_downclock_avail) {
+               has_reduced_clock = limit->find_pll(limit, crtc,
                                                            dev_priv->lvds_downclock,
                                                            refclk,
                                                            &reduced_clock);
@@ -2981,6 +3056,21 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
                                temp |= PIPE_8BPC;
                        else
                                temp |= PIPE_6BPC;
+               } else if (is_edp) {
+                       switch (dev_priv->edp_bpp/3) {
+                       case 8:
+                               temp |= PIPE_8BPC;
+                               break;
+                       case 10:
+                               temp |= PIPE_10BPC;
+                               break;
+                       case 6:
+                               temp |= PIPE_6BPC;
+                               break;
+                       case 12:
+                               temp |= PIPE_12BPC;
+                               break;
+                       }
                } else
                        temp |= PIPE_8BPC;
                I915_WRITE(pipeconf_reg, temp);
@@ -3991,7 +4081,8 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
 struct intel_unpin_work {
        struct work_struct work;
        struct drm_device *dev;
-       struct drm_gem_object *obj;
+       struct drm_gem_object *old_fb_obj;
+       struct drm_gem_object *pending_flip_obj;
        struct drm_pending_vblank_event *event;
        int pending;
 };
@@ -4002,8 +4093,9 @@ static void intel_unpin_work_fn(struct work_struct *__work)
                container_of(__work, struct intel_unpin_work, work);
 
        mutex_lock(&work->dev->struct_mutex);
-       i915_gem_object_unpin(work->obj);
-       drm_gem_object_unreference(work->obj);
+       i915_gem_object_unpin(work->old_fb_obj);
+       drm_gem_object_unreference(work->pending_flip_obj);
+       drm_gem_object_unreference(work->old_fb_obj);
        mutex_unlock(&work->dev->struct_mutex);
        kfree(work);
 }
@@ -4026,6 +4118,12 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
        spin_lock_irqsave(&dev->event_lock, flags);
        work = intel_crtc->unpin_work;
        if (work == NULL || !work->pending) {
+               if (work && !work->pending) {
+                       obj_priv = work->pending_flip_obj->driver_private;
+                       DRM_DEBUG_DRIVER("flip finish: %p (%d) not pending?\n",
+                                        obj_priv,
+                                        atomic_read(&obj_priv->pending_flip));
+               }
                spin_unlock_irqrestore(&dev->event_lock, flags);
                return;
        }
@@ -4046,8 +4144,11 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
 
        spin_unlock_irqrestore(&dev->event_lock, flags);
 
-       obj_priv = work->obj->driver_private;
-       if (atomic_dec_and_test(&obj_priv->pending_flip))
+       obj_priv = work->pending_flip_obj->driver_private;
+
+       /* Initial scanout buffer will have a 0 pending flip count */
+       if ((atomic_read(&obj_priv->pending_flip) == 0) ||
+           atomic_dec_and_test(&obj_priv->pending_flip))
                DRM_WAKEUP(&dev_priv->pending_flip_queue);
        schedule_work(&work->work);
 }
@@ -4060,8 +4161,11 @@ void intel_prepare_page_flip(struct drm_device *dev, int plane)
        unsigned long flags;
 
        spin_lock_irqsave(&dev->event_lock, flags);
-       if (intel_crtc->unpin_work)
+       if (intel_crtc->unpin_work) {
                intel_crtc->unpin_work->pending = 1;
+       } else {
+               DRM_DEBUG_DRIVER("preparing flip with no unpin work?\n");
+       }
        spin_unlock_irqrestore(&dev->event_lock, flags);
 }
 
@@ -4077,7 +4181,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        struct intel_unpin_work *work;
        unsigned long flags;
-       int ret;
+       int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC;
+       int ret, pipesrc;
        RING_LOCALS;
 
        work = kzalloc(sizeof *work, GFP_KERNEL);
@@ -4089,12 +4194,13 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        work->event = event;
        work->dev = crtc->dev;
        intel_fb = to_intel_framebuffer(crtc->fb);
-       work->obj = intel_fb->obj;
+       work->old_fb_obj = intel_fb->obj;
        INIT_WORK(&work->work, intel_unpin_work_fn);
 
        /* We borrow the event spin lock for protecting unpin_work */
        spin_lock_irqsave(&dev->event_lock, flags);
        if (intel_crtc->unpin_work) {
+               DRM_DEBUG_DRIVER("flip queue: crtc already busy\n");
                spin_unlock_irqrestore(&dev->event_lock, flags);
                kfree(work);
                mutex_unlock(&dev->struct_mutex);
@@ -4108,19 +4214,24 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 
        ret = intel_pin_and_fence_fb_obj(dev, obj);
        if (ret != 0) {
+               DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n",
+                         obj->driver_private);
                kfree(work);
+               intel_crtc->unpin_work = NULL;
                mutex_unlock(&dev->struct_mutex);
                return ret;
        }
 
-       /* Reference the old fb object for the scheduled work. */
-       drm_gem_object_reference(work->obj);
+       /* Reference the objects for the scheduled work. */
+       drm_gem_object_reference(work->old_fb_obj);
+       drm_gem_object_reference(obj);
 
        crtc->fb = fb;
        i915_gem_object_flush_write_domain(obj);
        drm_vblank_get(dev, intel_crtc->pipe);
        obj_priv = obj->driver_private;
        atomic_inc(&obj_priv->pending_flip);
+       work->pending_flip_obj = obj;
 
        BEGIN_LP_RING(4);
        OUT_RING(MI_DISPLAY_FLIP |
@@ -4128,7 +4239,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        OUT_RING(fb->pitch);
        if (IS_I965G(dev)) {
                OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode);
-               OUT_RING((fb->width << 16) | fb->height);
+               pipesrc = I915_READ(pipesrc_reg); 
+               OUT_RING(pipesrc & 0x0fff0fff);
        } else {
                OUT_RING(obj_priv->gtt_offset);
                OUT_RING(MI_NOOP);
index 1349d9fd01c4aaea6ae1a6af1a3ab5f4b09dc718..439506cefc146c92afdece74e8c8a89476904c68 100644 (file)
@@ -125,9 +125,15 @@ intel_dp_link_clock(uint8_t link_bw)
 
 /* I think this is a fiction */
 static int
-intel_dp_link_required(int pixel_clock)
+intel_dp_link_required(struct drm_device *dev,
+                      struct intel_output *intel_output, int pixel_clock)
 {
-       return pixel_clock * 3;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
+       if (IS_eDP(intel_output))
+               return (pixel_clock * dev_priv->edp_bpp) / 8;
+       else
+               return pixel_clock * 3;
 }
 
 static int
@@ -138,7 +144,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
        int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_output));
        int max_lanes = intel_dp_max_lane_count(intel_output);
 
-       if (intel_dp_link_required(mode->clock) > max_link_clock * max_lanes)
+       if (intel_dp_link_required(connector->dev, intel_output, mode->clock)
+                       > max_link_clock * max_lanes)
                return MODE_CLOCK_HIGH;
 
        if (mode->clock < 10000)
@@ -492,7 +499,8 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
                for (clock = 0; clock <= max_clock; clock++) {
                        int link_avail = intel_dp_link_clock(bws[clock]) * lane_count;
 
-                       if (intel_dp_link_required(mode->clock) <= link_avail) {
+                       if (intel_dp_link_required(encoder->dev, intel_output, mode->clock)
+                                       <= link_avail) {
                                dp_priv->link_bw = bws[clock];
                                dp_priv->lane_count = lane_count;
                                adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw);
@@ -1289,53 +1297,7 @@ intel_dp_hot_plug(struct intel_output *intel_output)
        if (dp_priv->dpms_mode == DRM_MODE_DPMS_ON)
                intel_dp_check_link_status(intel_output);
 }
-/*
- * Enumerate the child dev array parsed from VBT to check whether
- * the given DP is present.
- * If it is present, return 1.
- * If it is not present, return false.
- * If no child dev is parsed from VBT, it is assumed that the given
- * DP is present.
- */
-static int dp_is_present_in_vbt(struct drm_device *dev, int dp_reg)
-{
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct child_device_config *p_child;
-       int i, dp_port, ret;
-
-       if (!dev_priv->child_dev_num)
-               return 1;
-
-       dp_port = 0;
-       if (dp_reg == DP_B || dp_reg == PCH_DP_B)
-               dp_port = PORT_IDPB;
-       else if (dp_reg == DP_C || dp_reg == PCH_DP_C)
-               dp_port = PORT_IDPC;
-       else if (dp_reg == DP_D || dp_reg == PCH_DP_D)
-               dp_port = PORT_IDPD;
-
-       ret = 0;
-       for (i = 0; i < dev_priv->child_dev_num; i++) {
-               p_child = dev_priv->child_dev + i;
-               /*
-                * If the device type is not DP, continue.
-                */
-               if (p_child->device_type != DEVICE_TYPE_DP &&
-                       p_child->device_type != DEVICE_TYPE_eDP)
-                       continue;
-               /* Find the eDP port */
-               if (dp_reg == DP_A && p_child->device_type == DEVICE_TYPE_eDP) {
-                       ret = 1;
-                       break;
-               }
-               /* Find the DP port */
-               if (p_child->dvo_port == dp_port) {
-                       ret = 1;
-                       break;
-               }
-       }
-       return ret;
-}
+
 void
 intel_dp_init(struct drm_device *dev, int output_reg)
 {
@@ -1345,10 +1307,6 @@ intel_dp_init(struct drm_device *dev, int output_reg)
        struct intel_dp_priv *dp_priv;
        const char *name = NULL;
 
-       if (!dp_is_present_in_vbt(dev, output_reg)) {
-               DRM_DEBUG_KMS("DP is not present. Ignore it\n");
-               return;
-       }
        intel_output = kcalloc(sizeof(struct intel_output) + 
                               sizeof(struct intel_dp_priv), 1, GFP_KERNEL);
        if (!intel_output)
@@ -1373,11 +1331,10 @@ intel_dp_init(struct drm_device *dev, int output_reg)
        else if (output_reg == DP_D || output_reg == PCH_DP_D)
                intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT);
 
-       if (IS_eDP(intel_output)) {
-               intel_output->crtc_mask = (1 << 1);
+       if (IS_eDP(intel_output))
                intel_output->clone_mask = (1 << INTEL_EDP_CLONE_BIT);
-       } else
-               intel_output->crtc_mask = (1 << 0) | (1 << 1);
+
+       intel_output->crtc_mask = (1 << 0) | (1 << 1);
        connector->interlace_allowed = true;
        connector->doublescan_allowed = 0;
 
index 371d753e362bf425e32dcc188454ee560a2cace7..aaabbcbe590507ca7b56dc382cc09370bd8e449c 100644 (file)
@@ -148,7 +148,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
 
        mutex_lock(&dev->struct_mutex);
 
-       ret = i915_gem_object_pin(fbo, PAGE_SIZE);
+       ret = i915_gem_object_pin(fbo, 64*1024);
        if (ret) {
                DRM_ERROR("failed to pin fb: %d\n", ret);
                goto out_unref;
index 06431941b23314975eb55caad23419c48674e341..0e268deed761e6e6de2fe817f96f9b330e414d0c 100644 (file)
@@ -225,52 +225,6 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
        .destroy = intel_hdmi_enc_destroy,
 };
 
-/*
- * Enumerate the child dev array parsed from VBT to check whether
- * the given HDMI is present.
- * If it is present, return 1.
- * If it is not present, return false.
- * If no child dev is parsed from VBT, it assumes that the given
- * HDMI is present.
- */
-static int hdmi_is_present_in_vbt(struct drm_device *dev, int hdmi_reg)
-{
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct child_device_config *p_child;
-       int i, hdmi_port, ret;
-
-       if (!dev_priv->child_dev_num)
-               return 1;
-
-       if (hdmi_reg == SDVOB)
-               hdmi_port = DVO_B;
-       else if (hdmi_reg == SDVOC)
-               hdmi_port = DVO_C;
-       else if (hdmi_reg == HDMIB)
-               hdmi_port = DVO_B;
-       else if (hdmi_reg == HDMIC)
-               hdmi_port = DVO_C;
-       else if (hdmi_reg == HDMID)
-               hdmi_port = DVO_D;
-       else
-               return 0;
-
-       ret = 0;
-       for (i = 0; i < dev_priv->child_dev_num; i++) {
-               p_child = dev_priv->child_dev + i;
-               /*
-                * If the device type is not HDMI, continue.
-                */
-               if (p_child->device_type != DEVICE_TYPE_HDMI)
-                       continue;
-               /* Find the HDMI port */
-               if (p_child->dvo_port == hdmi_port) {
-                       ret = 1;
-                       break;
-               }
-       }
-       return ret;
-}
 void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -278,10 +232,6 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
        struct intel_output *intel_output;
        struct intel_hdmi_priv *hdmi_priv;
 
-       if (!hdmi_is_present_in_vbt(dev, sdvox_reg)) {
-               DRM_DEBUG_KMS("HDMI is not present. Ignored it \n");
-               return;
-       }
        intel_output = kcalloc(sizeof(struct intel_output) +
                               sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL);
        if (!intel_output)
index f4b4aa242df182c9c2c0b1f314d8e2d217844f23..c2e8a45780d558b44b3e0453d0ec328c9991326b 100644 (file)
@@ -601,6 +601,20 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
 
 /* Some lid devices report incorrect lid status, assume they're connected */
 static const struct dmi_system_id bad_lid_status[] = {
+       {
+               .ident = "Compaq nx9020",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                       DMI_MATCH(DMI_BOARD_NAME, "3084"),
+               },
+       },
+       {
+               .ident = "Samsung SX20S",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
+                       DMI_MATCH(DMI_BOARD_NAME, "SX20S"),
+               },
+       },
        {
                .ident = "Aspire One",
                .matches = {
@@ -608,6 +622,13 @@ static const struct dmi_system_id bad_lid_status[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"),
                },
        },
+       {
+               .ident = "Aspire 1810T",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1810T"),
+               },
+       },
        {
                .ident = "PC-81005",
                .matches = {
@@ -615,6 +636,13 @@ static const struct dmi_system_id bad_lid_status[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"),
                },
        },
+       {
+               .ident = "Clevo M5x0N",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
+                       DMI_MATCH(DMI_BOARD_NAME, "M5x0N"),
+               },
+       },
        { }
 };
 
@@ -629,7 +657,7 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
 {
        enum drm_connector_status status = connector_status_connected;
 
-       if (!acpi_lid_open() && !dmi_check_system(bad_lid_status))
+       if (!dmi_check_system(bad_lid_status) && !acpi_lid_open())
                status = connector_status_disconnected;
 
        return status;
@@ -912,7 +940,8 @@ static void intel_find_lvds_downclock(struct drm_device *dev,
                }
        }
        mutex_unlock(&dev->mode_config.mutex);
-       if (temp_downclock < panel_fixed_mode->clock) {
+       if (temp_downclock < panel_fixed_mode->clock &&
+           i915_lvds_downclock) {
                /* We found the downclock for LVDS. */
                dev_priv->lvds_downclock_avail = 1;
                dev_priv->lvds_downclock = temp_downclock;
index de5144c8c153cc974f36de35b40ebd7f73da31b6..82678d30ab06504ba51840f0d5c773c53f330ae8 100644 (file)
@@ -462,14 +462,63 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
 }
 
 /**
- * Don't check status code from this as it switches the bus back to the
- * SDVO chips which defeats the purpose of doing a bus switch in the first
- * place.
+ * Try to read the response after issuie the DDC switch command. But it
+ * is noted that we must do the action of reading response and issuing DDC
+ * switch command in one I2C transaction. Otherwise when we try to start
+ * another I2C transaction after issuing the DDC bus switch, it will be
+ * switched to the internal SDVO register.
  */
 static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output,
                                              u8 target)
 {
-       intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, &target, 1);
+       struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
+       u8 out_buf[2], cmd_buf[2], ret_value[2], ret;
+       struct i2c_msg msgs[] = {
+               {
+                       .addr = sdvo_priv->slave_addr >> 1,
+                       .flags = 0,
+                       .len = 2,
+                       .buf = out_buf,
+               },
+               /* the following two are to read the response */
+               {
+                       .addr = sdvo_priv->slave_addr >> 1,
+                       .flags = 0,
+                       .len = 1,
+                       .buf = cmd_buf,
+               },
+               {
+                       .addr = sdvo_priv->slave_addr >> 1,
+                       .flags = I2C_M_RD,
+                       .len = 1,
+                       .buf = ret_value,
+               },
+       };
+
+       intel_sdvo_debug_write(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH,
+                                       &target, 1);
+       /* write the DDC switch command argument */
+       intel_sdvo_write_byte(intel_output, SDVO_I2C_ARG_0, target);
+
+       out_buf[0] = SDVO_I2C_OPCODE;
+       out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH;
+       cmd_buf[0] = SDVO_I2C_CMD_STATUS;
+       cmd_buf[1] = 0;
+       ret_value[0] = 0;
+       ret_value[1] = 0;
+
+       ret = i2c_transfer(intel_output->i2c_bus, msgs, 3);
+       if (ret != 3) {
+               /* failure in I2C transfer */
+               DRM_DEBUG_KMS("I2c transfer returned %d\n", ret);
+               return;
+       }
+       if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) {
+               DRM_DEBUG_KMS("DDC switch command returns response %d\n",
+                                       ret_value[0]);
+               return;
+       }
+       return;
 }
 
 static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool target_0, bool target_1)
@@ -1579,6 +1628,32 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
        edid = drm_get_edid(&intel_output->base,
                            intel_output->ddc_bus);
 
+       /* This is only applied to SDVO cards with multiple outputs */
+       if (edid == NULL && intel_sdvo_multifunc_encoder(intel_output)) {
+               uint8_t saved_ddc, temp_ddc;
+               saved_ddc = sdvo_priv->ddc_bus;
+               temp_ddc = sdvo_priv->ddc_bus >> 1;
+               /*
+                * Don't use the 1 as the argument of DDC bus switch to get
+                * the EDID. It is used for SDVO SPD ROM.
+                */
+               while(temp_ddc > 1) {
+                       sdvo_priv->ddc_bus = temp_ddc;
+                       edid = drm_get_edid(&intel_output->base,
+                               intel_output->ddc_bus);
+                       if (edid) {
+                               /*
+                                * When we can get the EDID, maybe it is the
+                                * correct DDC bus. Update it.
+                                */
+                               sdvo_priv->ddc_bus = temp_ddc;
+                               break;
+                       }
+                       temp_ddc >>= 1;
+               }
+               if (edid == NULL)
+                       sdvo_priv->ddc_bus = saved_ddc;
+       }
        /* when there is no edid and no monitor is connected with VGA
         * port, try to use the CRT ddc to read the EDID for DVI-connector
         */
@@ -2270,6 +2345,14 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
                connector->connector_type = DRM_MODE_CONNECTOR_VGA;
                intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
                                        (1 << INTEL_ANALOG_CLONE_BIT);
+       } else if (flags & SDVO_OUTPUT_CVBS0) {
+
+               sdvo_priv->controlled_output = SDVO_OUTPUT_CVBS0;
+               encoder->encoder_type = DRM_MODE_ENCODER_TVDAC;
+               connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO;
+               sdvo_priv->is_tv = true;
+               intel_output->needs_tv_clock = true;
+               intel_output->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT;
        } else if (flags & SDVO_OUTPUT_LVDS0) {
 
                sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0;
index 1d5b9b7b033f25756f052b2143721894443d216a..552ec110b74197c2394058ef4c89b144bc3e3137 100644 (file)
@@ -1840,8 +1840,6 @@ intel_tv_init(struct drm_device *dev)
        drm_connector_attach_property(connector,
                                   dev->mode_config.tv_bottom_margin_property,
                                   tv_priv->margin[TV_MARGIN_BOTTOM]);
-
-       dev_priv->hotplug_supported_mask |= TV_HOTPLUG_INT_STATUS;
 out:
        drm_sysfs_connector_add(connector);
 }
index 1cf488247a16a59a49adac684d640c80ceba62f7..48227e7447539f281ffc79e40ebd05b517d0c1ae 100644 (file)
@@ -90,21 +90,21 @@ int nouveau_hybrid_setup(struct drm_device *dev)
 {
        int result;
 
-       if (nouveau_dsm(dev, NOUVEAU_DSM_ACTIVE, NOUVEAU_DSM_ACTIVE_QUERY,
+       if (nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STATE,
                                                                &result))
                return -ENODEV;
 
        NV_INFO(dev, "_DSM hardware status gave 0x%x\n", result);
 
-       if (result & 0x1) {     /* Stamina mode - disable the external GPU */
+       if (result) { /* Ensure that the external GPU is enabled */
+               nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
+               nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
+                                                                       NULL);
+       } else { /* Stamina mode - disable the external GPU */
                nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
                                                                        NULL);
                nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STAMINA,
                                                                        NULL);
-       } else {                /* Ensure that the external GPU is enabled */
-               nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
-               nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
-                                                                       NULL);
        }
 
        return 0;
index ba143972769f20329322c360763611d6971a1d62..0e9cd1d49130657c4aee725b8b490e75f0b4ba19 100644 (file)
@@ -310,63 +310,22 @@ valid_reg(struct nvbios *bios, uint32_t reg)
        struct drm_device *dev = bios->dev;
 
        /* C51 has misaligned regs on purpose. Marvellous */
-       if (reg & 0x2 || (reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51)) {
-               NV_ERROR(dev, "========== misaligned reg 0x%08X ==========\n",
-                        reg);
-               return 0;
-       }
-       /*
-        * Warn on C51 regs that have not been verified accessible in
-        * mmiotracing
-        */
+       if (reg & 0x2 ||
+           (reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51))
+               NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg);
+
+       /* warn on C51 regs that haven't been verified accessible in tracing */
        if (reg & 0x1 && dev_priv->VBIOS.pub.chip_version == 0x51 &&
            reg != 0x130d && reg != 0x1311 && reg != 0x60081d)
                NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n",
                        reg);
 
-       /* Trust the init scripts on G80 */
-       if (dev_priv->card_type >= NV_50)
-               return 1;
-
-       #define WITHIN(x, y, z) ((x >= y) && (x < y + z))
-       if (WITHIN(reg, NV_PMC_OFFSET, NV_PMC_SIZE))
-               return 1;
-       if (WITHIN(reg, NV_PBUS_OFFSET, NV_PBUS_SIZE))
-               return 1;
-       if (WITHIN(reg, NV_PFIFO_OFFSET, NV_PFIFO_SIZE))
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version >= 0x30 &&
-           (WITHIN(reg, 0x4000, 0x600) || reg == 0x00004600))
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version >= 0x40 &&
-                                               WITHIN(reg, 0xc000, 0x48))
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version >= 0x17 && reg == 0x0000d204)
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version >= 0x40) {
-               if (reg == 0x00011014 || reg == 0x00020328)
-                       return 1;
-               if (WITHIN(reg, 0x88000, NV_PBUS_SIZE)) /* new PBUS */
-                       return 1;
+       if (reg >= (8*1024*1024)) {
+               NV_ERROR(dev, "=== reg 0x%08x out of mapped bounds ===\n", reg);
+               return 0;
        }
-       if (WITHIN(reg, NV_PFB_OFFSET, NV_PFB_SIZE))
-               return 1;
-       if (WITHIN(reg, NV_PEXTDEV_OFFSET, NV_PEXTDEV_SIZE))
-               return 1;
-       if (WITHIN(reg, NV_PCRTC0_OFFSET, NV_PCRTC0_SIZE * 2))
-               return 1;
-       if (WITHIN(reg, NV_PRAMDAC0_OFFSET, NV_PRAMDAC0_SIZE * 2))
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version >= 0x17 && reg == 0x0070fff0)
-               return 1;
-       if (dev_priv->VBIOS.pub.chip_version == 0x51 &&
-                               WITHIN(reg, NV_PRAMIN_OFFSET, NV_PRAMIN_SIZE))
-               return 1;
-       #undef WITHIN
-
-       NV_ERROR(dev, "========== unknown reg 0x%08X ==========\n", reg);
 
-       return 0;
+       return 1;
 }
 
 static bool
@@ -1906,7 +1865,7 @@ init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
 
        struct drm_nouveau_private *dev_priv = bios->dev->dev_private;
 
-       if (dev_priv->card_type >= NV_50)
+       if (dev_priv->card_type >= NV_40)
                return 1;
 
        /*
@@ -3196,16 +3155,25 @@ static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entr
        }
 #ifdef __powerpc__
        /* Powerbook specific quirks */
-       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff) == 0x0329))
-               nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
-       if ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329) {
-               if (script == LVDS_PANEL_ON) {
-                       bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL, bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL) | (1 << 31));
-                       bios_wr32(bios, NV_PCRTC_GPIO_EXT, bios_rd32(bios, NV_PCRTC_GPIO_EXT) | 1);
-               }
-               if (script == LVDS_PANEL_OFF) {
-                       bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL, bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL) & ~(1 << 31));
-                       bios_wr32(bios, NV_PCRTC_GPIO_EXT, bios_rd32(bios, NV_PCRTC_GPIO_EXT) & ~3);
+       if ((dev->pci_device & 0xffff) == 0x0179 ||
+           (dev->pci_device & 0xffff) == 0x0189 ||
+           (dev->pci_device & 0xffff) == 0x0329) {
+               if (script == LVDS_RESET) {
+                       nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
+
+               } else if (script == LVDS_PANEL_ON) {
+                       bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL,
+                                 bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL)
+                                 | (1 << 31));
+                       bios_wr32(bios, NV_PCRTC_GPIO_EXT,
+                                 bios_rd32(bios, NV_PCRTC_GPIO_EXT) | 1);
+
+               } else if (script == LVDS_PANEL_OFF) {
+                       bios_wr32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL,
+                                 bios_rd32(bios, NV_PBUS_DEBUG_DUALHEAD_CTL)
+                                 & ~(1 << 31));
+                       bios_wr32(bios, NV_PCRTC_GPIO_EXT,
+                                 bios_rd32(bios, NV_PCRTC_GPIO_EXT) & ~3);
                }
        }
 #endif
@@ -3797,7 +3765,6 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
         */
 
        struct drm_nouveau_private *dev_priv = dev->dev_private;
-       struct init_exec iexec = {true, false};
        struct nvbios *bios = &dev_priv->VBIOS;
        uint8_t *table = &bios->data[bios->display.script_table_ptr];
        uint8_t *otable = NULL;
@@ -3877,8 +3844,6 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
        }
 
-       bios->display.output = dcbent;
-
        if (pxclk == 0) {
                script = ROM16(otable[6]);
                if (!script) {
@@ -3887,7 +3852,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
 
                NV_TRACE(dev, "0x%04X: parsing output script 0\n", script);
-               parse_init_table(bios, script, &iexec);
+               nouveau_bios_run_init_table(dev, script, dcbent);
        } else
        if (pxclk == -1) {
                script = ROM16(otable[8]);
@@ -3897,7 +3862,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
 
                NV_TRACE(dev, "0x%04X: parsing output script 1\n", script);
-               parse_init_table(bios, script, &iexec);
+               nouveau_bios_run_init_table(dev, script, dcbent);
        } else
        if (pxclk == -2) {
                if (table[4] >= 12)
@@ -3910,7 +3875,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
 
                NV_TRACE(dev, "0x%04X: parsing output script 2\n", script);
-               parse_init_table(bios, script, &iexec);
+               nouveau_bios_run_init_table(dev, script, dcbent);
        } else
        if (pxclk > 0) {
                script = ROM16(otable[table[4] + i*6 + 2]);
@@ -3922,7 +3887,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
 
                NV_TRACE(dev, "0x%04X: parsing clock script 0\n", script);
-               parse_init_table(bios, script, &iexec);
+               nouveau_bios_run_init_table(dev, script, dcbent);
        } else
        if (pxclk < 0) {
                script = ROM16(otable[table[4] + i*6 + 4]);
@@ -3934,7 +3899,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
                }
 
                NV_TRACE(dev, "0x%04X: parsing clock script 1\n", script);
-               parse_init_table(bios, script, &iexec);
+               nouveau_bios_run_init_table(dev, script, dcbent);
        }
 
        return 0;
@@ -5434,52 +5399,49 @@ static bool
 parse_dcb15_entry(struct drm_device *dev, struct parsed_dcb *dcb,
                  uint32_t conn, uint32_t conf, struct dcb_entry *entry)
 {
-       if (conn != 0xf0003f00 && conn != 0xf2247f10 && conn != 0xf2204001 &&
-           conn != 0xf2204301 && conn != 0xf2204311 && conn != 0xf2208001 &&
-           conn != 0xf2244001 && conn != 0xf2244301 && conn != 0xf2244311 &&
-           conn != 0xf4204011 && conn != 0xf4208011 && conn != 0xf4248011 &&
-           conn != 0xf2045ff2 && conn != 0xf2045f14 && conn != 0xf207df14 &&
-           conn != 0xf2205004 && conn != 0xf2209004) {
-               NV_ERROR(dev, "Unknown DCB 1.5 entry, please report\n");
-
-               /* cause output setting to fail for !TV, so message is seen */
-               if ((conn & 0xf) != 0x1)
-                       dcb->entries = 0;
-
-               return false;
-       }
-       /* most of the below is a "best guess" atm */
-       entry->type = conn & 0xf;
-       if (entry->type == 2)
-               /* another way of specifying straps based lvds... */
+       switch (conn & 0x0000000f) {
+       case 0:
+               entry->type = OUTPUT_ANALOG;
+               break;
+       case 1:
+               entry->type = OUTPUT_TV;
+               break;
+       case 2:
+       case 3:
                entry->type = OUTPUT_LVDS;
-       if (entry->type == 4) { /* digital */
-               if (conn & 0x10)
-                       entry->type = OUTPUT_LVDS;
-               else
+               break;
+       case 4:
+               switch ((conn & 0x000000f0) >> 4) {
+               case 0:
                        entry->type = OUTPUT_TMDS;
+                       break;
+               case 1:
+                       entry->type = OUTPUT_LVDS;
+                       break;
+               default:
+                       NV_ERROR(dev, "Unknown DCB subtype 4/%d\n",
+                                (conn & 0x000000f0) >> 4);
+                       return false;
+               }
+               break;
+       default:
+               NV_ERROR(dev, "Unknown DCB type %d\n", conn & 0x0000000f);
+               return false;
        }
-       /* what's in bits 5-13? could be some encoder maker thing, in tv case */
-       entry->i2c_index = (conn >> 14) & 0xf;
-       /* raw heads field is in range 0-1, so move to 1-2 */
-       entry->heads = ((conn >> 18) & 0x7) + 1;
-       entry->location = (conn >> 21) & 0xf;
-       /* unused: entry->bus = (conn >> 25) & 0x7; */
-       /* set or to be same as heads -- hopefully safe enough */
-       entry->or = entry->heads;
+
+       entry->i2c_index = (conn & 0x0003c000) >> 14;
+       entry->heads = ((conn & 0x001c0000) >> 18) + 1;
+       entry->or = entry->heads; /* same as heads, hopefully safe enough */
+       entry->location = (conn & 0x01e00000) >> 21;
+       entry->bus = (conn & 0x0e000000) >> 25;
        entry->duallink_possible = false;
 
        switch (entry->type) {
        case OUTPUT_ANALOG:
                entry->crtconf.maxfreq = (conf & 0xffff) * 10;
                break;
-       case OUTPUT_LVDS:
-               /*
-                * This is probably buried in conn's unknown bits.
-                * This will upset EDID-ful models, if they exist
-                */
-               entry->lvdsconf.use_straps_for_mode = true;
-               entry->lvdsconf.use_power_scripts = true;
+       case OUTPUT_TV:
+               entry->tvconf.has_component_output = false;
                break;
        case OUTPUT_TMDS:
                /*
@@ -5488,8 +5450,12 @@ parse_dcb15_entry(struct drm_device *dev, struct parsed_dcb *dcb,
                 */
                fabricate_vga_output(dcb, entry->i2c_index, entry->heads);
                break;
-       case OUTPUT_TV:
-               entry->tvconf.has_component_output = false;
+       case OUTPUT_LVDS:
+               if ((conn & 0x00003f00) != 0x10)
+                       entry->lvdsconf.use_straps_for_mode = true;
+               entry->lvdsconf.use_power_scripts = true;
+               break;
+       default:
                break;
        }
 
@@ -5564,11 +5530,13 @@ void merge_like_dcb_entries(struct drm_device *dev, struct parsed_dcb *dcb)
        dcb->entries = newentries;
 }
 
-static int parse_dcb_table(struct drm_device *dev, struct nvbios *bios, bool twoHeads)
+static int
+parse_dcb_table(struct drm_device *dev, struct nvbios *bios, bool twoHeads)
 {
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct bios_parsed_dcb *bdcb = &bios->bdcb;
        struct parsed_dcb *dcb;
-       uint16_t dcbptr, i2ctabptr = 0;
+       uint16_t dcbptr = 0, i2ctabptr = 0;
        uint8_t *dcbtable;
        uint8_t headerlen = 0x4, entries = DCB_MAX_NUM_ENTRIES;
        bool configblock = true;
@@ -5579,16 +5547,18 @@ static int parse_dcb_table(struct drm_device *dev, struct nvbios *bios, bool two
        dcb->entries = 0;
 
        /* get the offset from 0x36 */
-       dcbptr = ROM16(bios->data[0x36]);
+       if (dev_priv->card_type > NV_04) {
+               dcbptr = ROM16(bios->data[0x36]);
+               if (dcbptr == 0x0000)
+                       NV_WARN(dev, "No output data (DCB) found in BIOS\n");
+       }
 
+       /* this situation likely means a really old card, pre DCB */
        if (dcbptr == 0x0) {
-               NV_WARN(dev, "No output data (DCB) found in BIOS, "
-                              "assuming a CRT output exists\n");
-               /* this situation likely means a really old card, pre DCB */
+               NV_INFO(dev, "Assuming a CRT output exists\n");
                fabricate_vga_output(dcb, LEGACY_I2C_CRT, 1);
 
-               if (nv04_tv_identify(dev,
-                                    bios->legacy.i2c_indices.tv) >= 0)
+               if (nv04_tv_identify(dev, bios->legacy.i2c_indices.tv) >= 0)
                        fabricate_tv_output(dcb, twoHeads);
 
                return 0;
@@ -5892,9 +5862,11 @@ nouveau_bios_run_init_table(struct drm_device *dev, uint16_t table,
        struct nvbios *bios = &dev_priv->VBIOS;
        struct init_exec iexec = { true, false };
 
+       mutex_lock(&bios->lock);
        bios->display.output = dcbent;
        parse_init_table(bios, table, &iexec);
        bios->display.output = NULL;
+       mutex_unlock(&bios->lock);
 }
 
 static bool NVInitVBIOS(struct drm_device *dev)
@@ -5903,6 +5875,7 @@ static bool NVInitVBIOS(struct drm_device *dev)
        struct nvbios *bios = &dev_priv->VBIOS;
 
        memset(bios, 0, sizeof(struct nvbios));
+       mutex_init(&bios->lock);
        bios->dev = dev;
 
        if (!NVShadowVBIOS(dev, bios->data))
index 058e98c76d8990397328a4c01b87d888aecc9e28..fd94bd6dc2642221c572e698d0dab87402907b7d 100644 (file)
@@ -205,6 +205,8 @@ struct nvbios {
        struct drm_device *dev;
        struct nouveau_bios_info pub;
 
+       struct mutex lock;
+
        uint8_t data[NV_PROM_SIZE];
        unsigned int length;
        bool execute;
index e342a418d434d41b9807ad2dd27683e0d4744084..028719fddf761e94b1f1ae44ef50f5fc860e2813 100644 (file)
@@ -65,8 +65,10 @@ nouveau_bo_fixup_align(struct drm_device *dev,
 
        /*
         * Some of the tile_flags have a periodic structure of N*4096 bytes,
-        * align to to that as well as the page size. Overallocate memory to
-        * avoid corruption of other buffer objects.
+        * align to to that as well as the page size. Align the size to the
+        * appropriate boundaries. This does imply that sizes are rounded up
+        * 3-7 pages, so be aware of this and do not waste memory by allocating
+        * many small buffers.
         */
        if (dev_priv->card_type == NV_50) {
                uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15;
@@ -77,22 +79,20 @@ nouveau_bo_fixup_align(struct drm_device *dev,
                case 0x2800:
                case 0x4800:
                case 0x7a00:
-                       *size = roundup(*size, block_size);
                        if (is_power_of_2(block_size)) {
-                               *size += 3 * block_size;
                                for (i = 1; i < 10; i++) {
                                        *align = 12 * i * block_size;
                                        if (!(*align % 65536))
                                                break;
                                }
                        } else {
-                               *size += 6 * block_size;
                                for (i = 1; i < 10; i++) {
                                        *align = 8 * i * block_size;
                                        if (!(*align % 65536))
                                                break;
                                }
                        }
+                       *size = roundup(*size, *align);
                        break;
                default:
                        break;
@@ -469,6 +469,8 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
 
        ret = ttm_bo_move_accel_cleanup(&nvbo->bo, fence, NULL,
                                        evict, no_wait, new_mem);
+       if (nvbo->channel && nvbo->channel != chan)
+               ret = nouveau_fence_wait(fence, NULL, false, false);
        nouveau_fence_unref((void *)&fence);
        return ret;
 }
index 343d718a9667625e4900f78f2bb757a1ebdd4fd9..2281f99da7fcef31da401ea5d31811e78e93cb93 100644 (file)
@@ -278,12 +278,11 @@ nouveau_channel_free(struct nouveau_channel *chan)
        /* Ensure the channel is no longer active on the GPU */
        pfifo->reassign(dev, false);
 
-       if (pgraph->channel(dev) == chan) {
-               pgraph->fifo_access(dev, false);
+       pgraph->fifo_access(dev, false);
+       if (pgraph->channel(dev) == chan)
                pgraph->unload_context(dev);
-               pgraph->fifo_access(dev, true);
-       }
        pgraph->destroy_context(chan);
+       pgraph->fifo_access(dev, true);
 
        if (pfifo->channel_id(dev) == chan->id) {
                pfifo->disable(dev);
index 5a10deb8bdbdebc54a14dcc4be6abe78dcccfd37..d2f63353ea9715f3be342d369e282beec55d86fb 100644 (file)
  *
  */
 
+#include <acpi/button.h>
+
 #include "drmP.h"
 #include "drm_edid.h"
 #include "drm_crtc_helper.h"
+
 #include "nouveau_reg.h"
 #include "nouveau_drv.h"
 #include "nouveau_encoder.h"
@@ -83,14 +86,17 @@ nouveau_encoder_connector_get(struct nouveau_encoder *encoder)
 static void
 nouveau_connector_destroy(struct drm_connector *drm_connector)
 {
-       struct nouveau_connector *connector = nouveau_connector(drm_connector);
-       struct drm_device *dev = connector->base.dev;
+       struct nouveau_connector *nv_connector =
+               nouveau_connector(drm_connector);
+       struct drm_device *dev;
 
-       NV_DEBUG_KMS(dev, "\n");
-
-       if (!connector)
+       if (!nv_connector)
                return;
 
+       dev = nv_connector->base.dev;
+       NV_DEBUG_KMS(dev, "\n");
+
+       kfree(nv_connector->edid);
        drm_sysfs_connector_remove(drm_connector);
        drm_connector_cleanup(drm_connector);
        kfree(drm_connector);
@@ -233,10 +239,21 @@ nouveau_connector_detect(struct drm_connector *connector)
        if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
                nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
        if (nv_encoder && nv_connector->native_mode) {
+#ifdef CONFIG_ACPI
+               if (!nouveau_ignorelid && !acpi_lid_open())
+                       return connector_status_disconnected;
+#endif
                nouveau_connector_set_encoder(connector, nv_encoder);
                return connector_status_connected;
        }
 
+       /* Cleanup the previous EDID block. */
+       if (nv_connector->edid) {
+               drm_mode_connector_update_edid_property(connector, NULL);
+               kfree(nv_connector->edid);
+               nv_connector->edid = NULL;
+       }
+
        i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
        if (i2c) {
                nouveau_connector_ddc_prepare(connector, &flags);
@@ -247,7 +264,7 @@ nouveau_connector_detect(struct drm_connector *connector)
                if (!nv_connector->edid) {
                        NV_ERROR(dev, "DDC responded, but no EDID for %s\n",
                                 drm_get_connector_name(connector));
-                       return connector_status_disconnected;
+                       goto detect_analog;
                }
 
                if (nv_encoder->dcb->type == OUTPUT_DP &&
@@ -281,6 +298,7 @@ nouveau_connector_detect(struct drm_connector *connector)
                return connector_status_connected;
        }
 
+detect_analog:
        nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
        if (!nv_encoder)
                nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
@@ -687,8 +705,12 @@ nouveau_connector_create_lvds(struct drm_device *dev,
         */
        if (!nv_connector->edid && !nv_connector->native_mode &&
            !dev_priv->VBIOS.pub.fp_no_ddc) {
-               nv_connector->edid =
+               struct edid *edid =
                        (struct edid *)nouveau_bios_embedded_edid(dev);
+               if (edid) {
+                       nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
+                       *(nv_connector->edid) = *edid;
+               }
        }
 
        if (!nv_connector->edid)
index 7afbe8b40d511f39f034d29b62e971ac6eab2a79..50d9e67745af1e7d1c5872f39db736d2c76dfe05 100644 (file)
@@ -126,47 +126,52 @@ OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords)
        chan->dma.cur += nr_dwords;
 }
 
-static inline bool
-READ_GET(struct nouveau_channel *chan, uint32_t *get)
+/* Fetch and adjust GPU GET pointer
+ *
+ * Returns:
+ *  value >= 0, the adjusted GET pointer
+ *  -EINVAL if GET pointer currently outside main push buffer
+ *  -EBUSY if timeout exceeded
+ */
+static inline int
+READ_GET(struct nouveau_channel *chan, uint32_t *prev_get, uint32_t *timeout)
 {
        uint32_t val;
 
        val = nvchan_rd32(chan, chan->user_get);
-       if (val < chan->pushbuf_base ||
-           val > chan->pushbuf_base + (chan->dma.max << 2)) {
-               /* meaningless to dma_wait() except to know whether the
-                * GPU has stalled or not
-                */
-               *get = val;
-               return false;
+
+       /* reset counter as long as GET is still advancing, this is
+        * to avoid misdetecting a GPU lockup if the GPU happens to
+        * just be processing an operation that takes a long time
+        */
+       if (val != *prev_get) {
+               *prev_get = val;
+               *timeout = 0;
+       }
+
+       if ((++*timeout & 0xff) == 0) {
+               DRM_UDELAY(1);
+               if (*timeout > 100000)
+                       return -EBUSY;
        }
 
-       *get = (val - chan->pushbuf_base) >> 2;
-       return true;
+       if (val < chan->pushbuf_base ||
+           val > chan->pushbuf_base + (chan->dma.max << 2))
+               return -EINVAL;
+
+       return (val - chan->pushbuf_base) >> 2;
 }
 
 int
 nouveau_dma_wait(struct nouveau_channel *chan, int size)
 {
-       uint32_t get, prev_get = 0, cnt = 0;
-       bool get_valid;
+       uint32_t prev_get = 0, cnt = 0;
+       int get;
 
        while (chan->dma.free < size) {
-               /* reset counter as long as GET is still advancing, this is
-                * to avoid misdetecting a GPU lockup if the GPU happens to
-                * just be processing an operation that takes a long time
-                */
-               get_valid = READ_GET(chan, &get);
-               if (get != prev_get) {
-                       prev_get = get;
-                       cnt = 0;
-               }
-
-               if ((++cnt & 0xff) == 0) {
-                       DRM_UDELAY(1);
-                       if (cnt > 100000)
-                               return -EBUSY;
-               }
+               get = READ_GET(chan, &prev_get, &cnt);
+               if (unlikely(get == -EBUSY))
+                       return -EBUSY;
 
                /* loop until we have a usable GET pointer.  the value
                 * we read from the GPU may be outside the main ring if
@@ -177,7 +182,7 @@ nouveau_dma_wait(struct nouveau_channel *chan, int size)
                 * from the SKIPS area, so the code below doesn't have to deal
                 * with some fun corner cases.
                 */
-               if (!get_valid || get < NOUVEAU_DMA_SKIPS)
+               if (unlikely(get == -EINVAL) || get < NOUVEAU_DMA_SKIPS)
                        continue;
 
                if (get <= chan->dma.cur) {
@@ -203,6 +208,19 @@ nouveau_dma_wait(struct nouveau_channel *chan, int size)
                         * after processing the currently pending commands.
                         */
                        OUT_RING(chan, chan->pushbuf_base | 0x20000000);
+
+                       /* wait for GET to depart from the skips area.
+                        * prevents writing GET==PUT and causing a race
+                        * condition that causes us to think the GPU is
+                        * idle when it's not.
+                        */
+                       do {
+                               get = READ_GET(chan, &prev_get, &cnt);
+                               if (unlikely(get == -EBUSY))
+                                       return -EBUSY;
+                               if (unlikely(get == -EINVAL))
+                                       continue;
+                       } while (get <= NOUVEAU_DMA_SKIPS);
                        WRITE_PUT(NOUVEAU_DMA_SKIPS);
 
                        /* we're now submitting commands at the start of
index 9e2926c485790f376fce5af52c50cf93922df9f1..f954ad93e81f3f17ca5385591e7dca9ff6547a49 100644 (file)
@@ -490,7 +490,8 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
                if (!nv_wait(NV50_AUXCH_CTRL(index), 0x00010000, 0x00000000)) {
                        NV_ERROR(dev, "expected bit 16 == 0, got 0x%08x\n",
                                 nv_rd32(dev, NV50_AUXCH_CTRL(index)));
-                       return -EBUSY;
+                       ret = -EBUSY;
+                       goto out;
                }
 
                udelay(400);
@@ -502,6 +503,11 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
        }
 
        if (cmd & 1) {
+               if ((stat & NV50_AUXCH_STAT_COUNT) != data_nr) {
+                       ret = -EREMOTEIO;
+                       goto out;
+               }
+
                for (i = 0; i < 4; i++) {
                        data32[i] = nv_rd32(dev, NV50_AUXCH_DATA_IN(index, i));
                        NV_DEBUG_KMS(dev, "rd %d: 0x%08x\n", i, data32[i]);
index 06eb993e08835a247aa8ea669ee41f718f0addd5..da3b93b84502de4721f84193bbcbe1598c2b959b 100644 (file)
@@ -56,7 +56,7 @@ int nouveau_vram_pushbuf;
 module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
 
 MODULE_PARM_DESC(vram_notify, "Force DMA notifiers to be in VRAM");
-int nouveau_vram_notify;
+int nouveau_vram_notify = 1;
 module_param_named(vram_notify, nouveau_vram_notify, int, 0400);
 
 MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (>=GeForce 8)");
@@ -71,6 +71,18 @@ MODULE_PARM_DESC(uscript_tmds, "TMDS output script table ID (>=GeForce 8)");
 int nouveau_uscript_tmds = -1;
 module_param_named(uscript_tmds, nouveau_uscript_tmds, int, 0400);
 
+MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
+int nouveau_ignorelid = 0;
+module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
+
+MODULE_PARM_DESC(noagp, "Disable all acceleration");
+int nouveau_noaccel = 0;
+module_param_named(noaccel, nouveau_noaccel, int, 0400);
+
+MODULE_PARM_DESC(noagp, "Disable fbcon acceleration");
+int nouveau_nofbaccel = 0;
+module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400);
+
 MODULE_PARM_DESC(tv_norm, "Default TV norm.\n"
                 "\t\tSupported: PAL, PAL-M, PAL-N, PAL-Nc, NTSC-M, NTSC-J,\n"
                 "\t\t\thd480i, hd480p, hd576i, hd576p, hd720p, hd1080i.\n"
index 026419fe8791e3cb941874398872ad23ef7ce811..1c15ef37b71cffc9c234f08b0337e50e1af4ff6e 100644 (file)
@@ -509,6 +509,8 @@ struct drm_nouveau_private {
        void __iomem *ramin;
        uint32_t ramin_size;
 
+       struct nouveau_bo *vga_ram;
+
        struct workqueue_struct *wq;
        struct work_struct irq_work;
 
@@ -581,6 +583,7 @@ struct drm_nouveau_private {
        uint64_t vm_end;
        struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR];
        int vm_vram_pt_nr;
+       uint64_t vram_sys_base;
 
        /* the mtrr covering the FB */
        int fb_mtrr;
@@ -675,6 +678,9 @@ extern char *nouveau_tv_norm;
 extern int nouveau_reg_debug;
 extern char *nouveau_vbios;
 extern int nouveau_ctxfw;
+extern int nouveau_ignorelid;
+extern int nouveau_nofbaccel;
+extern int nouveau_noaccel;
 
 /* nouveau_state.c */
 extern void nouveau_preclose(struct drm_device *dev, struct drm_file *);
index 0b05c869e0e7644c787b1abb54252f0351fb1f98..ea879a2efef328c8a452d8403bc93cfbd85cb879 100644 (file)
@@ -107,6 +107,34 @@ static struct fb_ops nouveau_fbcon_ops = {
        .fb_setcmap = drm_fb_helper_setcmap,
 };
 
+static struct fb_ops nv04_fbcon_ops = {
+       .owner = THIS_MODULE,
+       .fb_check_var = drm_fb_helper_check_var,
+       .fb_set_par = drm_fb_helper_set_par,
+       .fb_setcolreg = drm_fb_helper_setcolreg,
+       .fb_fillrect = nv04_fbcon_fillrect,
+       .fb_copyarea = nv04_fbcon_copyarea,
+       .fb_imageblit = nv04_fbcon_imageblit,
+       .fb_sync = nouveau_fbcon_sync,
+       .fb_pan_display = drm_fb_helper_pan_display,
+       .fb_blank = drm_fb_helper_blank,
+       .fb_setcmap = drm_fb_helper_setcmap,
+};
+
+static struct fb_ops nv50_fbcon_ops = {
+       .owner = THIS_MODULE,
+       .fb_check_var = drm_fb_helper_check_var,
+       .fb_set_par = drm_fb_helper_set_par,
+       .fb_setcolreg = drm_fb_helper_setcolreg,
+       .fb_fillrect = nv50_fbcon_fillrect,
+       .fb_copyarea = nv50_fbcon_copyarea,
+       .fb_imageblit = nv50_fbcon_imageblit,
+       .fb_sync = nouveau_fbcon_sync,
+       .fb_pan_display = drm_fb_helper_pan_display,
+       .fb_blank = drm_fb_helper_blank,
+       .fb_setcmap = drm_fb_helper_setcmap,
+};
+
 static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
                                    u16 blue, int regno)
 {
@@ -267,8 +295,12 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width,
        dev_priv->fbdev_info = info;
 
        strcpy(info->fix.id, "nouveaufb");
-       info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
-                     FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT;
+       if (nouveau_nofbaccel)
+               info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_DISABLED;
+       else
+               info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
+                             FBINFO_HWACCEL_FILLRECT |
+                             FBINFO_HWACCEL_IMAGEBLIT;
        info->fbops = &nouveau_fbcon_ops;
        info->fix.smem_start = dev->mode_config.fb_base + nvbo->bo.offset -
                               dev_priv->vm_vram_base;
@@ -316,13 +348,15 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width,
        par->nouveau_fb = nouveau_fb;
        par->dev = dev;
 
-       if (dev_priv->channel) {
+       if (dev_priv->channel && !nouveau_nofbaccel) {
                switch (dev_priv->card_type) {
                case NV_50:
                        nv50_fbcon_accel_init(info);
+                       info->fbops = &nv50_fbcon_ops;
                        break;
                default:
                        nv04_fbcon_accel_init(info);
+                       info->fbops = &nv04_fbcon_ops;
                        break;
                };
        }
index 462e0b87b4bdb55d371ad8a37069fcdbe871d91d..f9c34e1a8c11a258d682b0bbc0f8430bf818492c 100644 (file)
@@ -40,7 +40,13 @@ int nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb);
 void nouveau_fbcon_restore(void);
 void nouveau_fbcon_zfill(struct drm_device *dev);
 
+void nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region);
+void nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
+void nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image);
 int nv04_fbcon_accel_init(struct fb_info *info);
+void nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
+void nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region);
+void nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image);
 int nv50_fbcon_accel_init(struct fb_info *info);
 
 void nouveau_fbcon_gpu_lockup(struct fb_info *info);
index 2009db2426c3a87fa21be873a22001eed25e8c35..70cc30803e3bec1f28d4143faf1fc7754efb7986 100644 (file)
@@ -321,6 +321,7 @@ retry:
                else {
                        NV_ERROR(dev, "invalid valid domains: 0x%08x\n",
                                 b->valid_domains);
+                       list_add_tail(&nvbo->entry, &op->both_list);
                        validate_fini(op, NULL);
                        return -EINVAL;
                }
@@ -466,13 +467,14 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
 static int
 nouveau_gem_pushbuf_reloc_apply(struct nouveau_channel *chan, int nr_bo,
                                struct drm_nouveau_gem_pushbuf_bo *bo,
-                               int nr_relocs, uint64_t ptr_relocs,
-                               int nr_dwords, int first_dword,
+                               unsigned nr_relocs, uint64_t ptr_relocs,
+                               unsigned nr_dwords, unsigned first_dword,
                                uint32_t *pushbuf, bool is_iomem)
 {
        struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
        struct drm_device *dev = chan->dev;
-       int ret = 0, i;
+       int ret = 0;
+       unsigned i;
 
        reloc = u_memcpya(ptr_relocs, nr_relocs, sizeof(*reloc));
        if (IS_ERR(reloc))
@@ -667,6 +669,18 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
        }
        pbbo = nouveau_gem_object(gem);
 
+       if ((req->offset & 3) || req->nr_dwords < 2 ||
+           (unsigned long)req->offset > (unsigned long)pbbo->bo.mem.size ||
+           (unsigned long)req->nr_dwords >
+            ((unsigned long)(pbbo->bo.mem.size - req->offset ) >> 2)) {
+               NV_ERROR(dev, "pb call misaligned or out of bounds: "
+                             "%d + %d * 4 > %ld\n",
+                        req->offset, req->nr_dwords, pbbo->bo.mem.size);
+               ret = -EINVAL;
+               drm_gem_object_unreference(gem);
+               goto out;
+       }
+
        ret = ttm_bo_reserve(&pbbo->bo, false, false, true,
                             chan->fence.sequence);
        if (ret) {
@@ -911,7 +925,9 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
        }
 
        if (req->flags & NOUVEAU_GEM_CPU_PREP_NOBLOCK) {
+               spin_lock(&nvbo->bo.lock);
                ret = ttm_bo_wait(&nvbo->bo, false, false, no_wait);
+               spin_unlock(&nvbo->bo.lock);
        } else {
                ret = ttm_bo_synccpu_write_grab(&nvbo->bo, no_wait);
                if (ret == 0)
index 419f4c2b3b89e529075f1b8afe077ba504b7e20f..c7ebec696747266f0c413a9b92ec368bb832e727 100644 (file)
@@ -97,8 +97,8 @@ nouveau_grctx_prog_load(struct drm_device *dev)
                }
 
                pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL);
-               if (!pgraph->ctxprog) {
-                       NV_ERROR(dev, "OOM copying ctxprog\n");
+               if (!pgraph->ctxvals) {
+                       NV_ERROR(dev, "OOM copying ctxvals\n");
                        release_firmware(fw);
                        nouveau_grctx_fini(dev);
                        return -ENOMEM;
index 919a619ca7fa376c70f0a935df029935203e924d..447f9f69d6b14fd28b5d01de67f0771c9aefa913 100644 (file)
@@ -211,6 +211,20 @@ nouveau_fifo_irq_handler(struct drm_device *dev)
                                                                get + 4);
                }
 
+               if (status & NV_PFIFO_INTR_SEMAPHORE) {
+                       uint32_t sem;
+
+                       status &= ~NV_PFIFO_INTR_SEMAPHORE;
+                       nv_wr32(dev, NV03_PFIFO_INTR_0,
+                               NV_PFIFO_INTR_SEMAPHORE);
+
+                       sem = nv_rd32(dev, NV10_PFIFO_CACHE1_SEMAPHORE);
+                       nv_wr32(dev, NV10_PFIFO_CACHE1_SEMAPHORE, sem | 0x1);
+
+                       nv_wr32(dev, NV03_PFIFO_CACHE1_GET, get + 4);
+                       nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1);
+               }
+
                if (status) {
                        NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n",
                                status, chid);
@@ -483,6 +497,13 @@ nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource)
        if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) {
                if (nouveau_pgraph_intr_swmthd(dev, &trap))
                        unhandled = 1;
+       } else if (nsource & NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION) {
+               uint32_t v = nv_rd32(dev, 0x402000);
+               nv_wr32(dev, 0x402000, v);
+
+               /* dump the error anyway for now: it's useful for
+                  Gallium development */
+               unhandled = 1;
        } else {
                unhandled = 1;
        }
@@ -559,86 +580,99 @@ nouveau_pgraph_irq_handler(struct drm_device *dev)
 static void
 nv50_pgraph_irq_handler(struct drm_device *dev)
 {
-       uint32_t status, nsource;
+       uint32_t status;
 
-       status = nv_rd32(dev, NV03_PGRAPH_INTR);
-       nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE);
+       while ((status = nv_rd32(dev, NV03_PGRAPH_INTR))) {
+               uint32_t nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE);
 
-       if (status & 0x00000001) {
-               nouveau_pgraph_intr_notify(dev, nsource);
-               status &= ~0x00000001;
-               nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001);
-       }
+               if (status & 0x00000001) {
+                       nouveau_pgraph_intr_notify(dev, nsource);
+                       status &= ~0x00000001;
+                       nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001);
+               }
 
-       if (status & 0x00000010) {
-               nouveau_pgraph_intr_error(dev, nsource |
-                                         NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD);
+               if (status & 0x00000010) {
+                       nouveau_pgraph_intr_error(dev, nsource |
+                                       NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD);
 
-               status &= ~0x00000010;
-               nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010);
-       }
+                       status &= ~0x00000010;
+                       nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010);
+               }
 
-       if (status & 0x00001000) {
-               nv_wr32(dev, 0x400500, 0x00000000);
-               nv_wr32(dev, NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH);
-               nv_wr32(dev, NV40_PGRAPH_INTR_EN, nv_rd32(dev,
-                       NV40_PGRAPH_INTR_EN) & ~NV_PGRAPH_INTR_CONTEXT_SWITCH);
-               nv_wr32(dev, 0x400500, 0x00010001);
+               if (status & 0x00001000) {
+                       nv_wr32(dev, 0x400500, 0x00000000);
+                       nv_wr32(dev, NV03_PGRAPH_INTR,
+                               NV_PGRAPH_INTR_CONTEXT_SWITCH);
+                       nv_wr32(dev, NV40_PGRAPH_INTR_EN, nv_rd32(dev,
+                               NV40_PGRAPH_INTR_EN) &
+                               ~NV_PGRAPH_INTR_CONTEXT_SWITCH);
+                       nv_wr32(dev, 0x400500, 0x00010001);
 
-               nv50_graph_context_switch(dev);
+                       nv50_graph_context_switch(dev);
 
-               status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
-       }
+                       status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
+               }
 
-       if (status & 0x00100000) {
-               nouveau_pgraph_intr_error(dev, nsource |
-                                         NV03_PGRAPH_NSOURCE_DATA_ERROR);
+               if (status & 0x00100000) {
+                       nouveau_pgraph_intr_error(dev, nsource |
+                                       NV03_PGRAPH_NSOURCE_DATA_ERROR);
 
-               status &= ~0x00100000;
-               nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000);
-       }
+                       status &= ~0x00100000;
+                       nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000);
+               }
 
-       if (status & 0x00200000) {
-               int r;
-
-               nouveau_pgraph_intr_error(dev, nsource |
-                                         NV03_PGRAPH_NSOURCE_PROTECTION_ERROR);
-
-               NV_ERROR(dev, "magic set 1:\n");
-               for (r = 0x408900; r <= 0x408910; r += 4)
-                       NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r));
-               nv_wr32(dev, 0x408900, nv_rd32(dev, 0x408904) | 0xc0000000);
-               for (r = 0x408e08; r <= 0x408e24; r += 4)
-                       NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r));
-               nv_wr32(dev, 0x408e08, nv_rd32(dev, 0x408e08) | 0xc0000000);
-
-               NV_ERROR(dev, "magic set 2:\n");
-               for (r = 0x409900; r <= 0x409910; r += 4)
-                       NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r));
-               nv_wr32(dev, 0x409900, nv_rd32(dev, 0x409904) | 0xc0000000);
-               for (r = 0x409e08; r <= 0x409e24; r += 4)
-                       NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r));
-               nv_wr32(dev, 0x409e08, nv_rd32(dev, 0x409e08) | 0xc0000000);
-
-               status &= ~0x00200000;
-               nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource);
-               nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000);
-       }
+               if (status & 0x00200000) {
+                       int r;
+
+                       nouveau_pgraph_intr_error(dev, nsource |
+                                       NV03_PGRAPH_NSOURCE_PROTECTION_ERROR);
+
+                       NV_ERROR(dev, "magic set 1:\n");
+                       for (r = 0x408900; r <= 0x408910; r += 4)
+                               NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,
+                                       nv_rd32(dev, r));
+                       nv_wr32(dev, 0x408900,
+                               nv_rd32(dev, 0x408904) | 0xc0000000);
+                       for (r = 0x408e08; r <= 0x408e24; r += 4)
+                               NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,
+                                                       nv_rd32(dev, r));
+                       nv_wr32(dev, 0x408e08,
+                               nv_rd32(dev, 0x408e08) | 0xc0000000);
+
+                       NV_ERROR(dev, "magic set 2:\n");
+                       for (r = 0x409900; r <= 0x409910; r += 4)
+                               NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,
+                                       nv_rd32(dev, r));
+                       nv_wr32(dev, 0x409900,
+                               nv_rd32(dev, 0x409904) | 0xc0000000);
+                       for (r = 0x409e08; r <= 0x409e24; r += 4)
+                               NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,
+                                       nv_rd32(dev, r));
+                       nv_wr32(dev, 0x409e08,
+                               nv_rd32(dev, 0x409e08) | 0xc0000000);
+
+                       status &= ~0x00200000;
+                       nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource);
+                       nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000);
+               }
 
-       if (status) {
-               NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n", status);
-               nv_wr32(dev, NV03_PGRAPH_INTR, status);
-       }
+               if (status) {
+                       NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n",
+                               status);
+                       nv_wr32(dev, NV03_PGRAPH_INTR, status);
+               }
 
-       {
-               const int isb = (1 << 16) | (1 << 0);
+               {
+                       const int isb = (1 << 16) | (1 << 0);
 
-               if ((nv_rd32(dev, 0x400500) & isb) != isb)
-                       nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb);
-               nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31));
+                       if ((nv_rd32(dev, 0x400500) & isb) != isb)
+                               nv_wr32(dev, 0x400500,
+                                       nv_rd32(dev, 0x400500) | isb);
+               }
        }
 
        nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING);
+       nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31));
 }
 
 static void
index fb9bdd6edf1f66a417cd0d209c6b9ab5667c0fec..2dc09dbd817d06d178343bf7280f7187115dd555 100644 (file)
@@ -285,53 +285,50 @@ nv50_mem_vm_bind_linear(struct drm_device *dev, uint64_t virt, uint32_t size,
                        uint32_t flags, uint64_t phys)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
-       struct nouveau_gpuobj **pgt;
-       unsigned psz, pfl, pages;
-
-       if (virt >= dev_priv->vm_gart_base &&
-           (virt + size) < (dev_priv->vm_gart_base + dev_priv->vm_gart_size)) {
-               psz = 12;
-               pgt = &dev_priv->gart_info.sg_ctxdma;
-               pfl = 0x21;
-               virt -= dev_priv->vm_gart_base;
-       } else
-       if (virt >= dev_priv->vm_vram_base &&
-           (virt + size) < (dev_priv->vm_vram_base + dev_priv->vm_vram_size)) {
-               psz = 16;
-               pgt = dev_priv->vm_vram_pt;
-               pfl = 0x01;
-               virt -= dev_priv->vm_vram_base;
-       } else {
-               NV_ERROR(dev, "Invalid address: 0x%16llx-0x%16llx\n",
-                        virt, virt + size - 1);
-               return -EINVAL;
-       }
+       struct nouveau_gpuobj *pgt;
+       unsigned block;
+       int i;
 
-       pages = size >> psz;
+       virt = ((virt - dev_priv->vm_vram_base) >> 16) << 1;
+       size = (size >> 16) << 1;
+
+       phys |= ((uint64_t)flags << 32);
+       phys |= 1;
+       if (dev_priv->vram_sys_base) {
+               phys += dev_priv->vram_sys_base;
+               phys |= 0x30;
+       }
 
        dev_priv->engine.instmem.prepare_access(dev, true);
-       if (flags & 0x80000000) {
-               while (pages--) {
-                       struct nouveau_gpuobj *pt = pgt[virt >> 29];
-                       unsigned pte = ((virt & 0x1fffffffULL) >> psz) << 1;
+       while (size) {
+               unsigned offset_h = upper_32_bits(phys);
+               unsigned offset_l = lower_32_bits(phys);
+               unsigned pte, end;
+
+               for (i = 7; i >= 0; i--) {
+                       block = 1 << (i + 1);
+                       if (size >= block && !(virt & (block - 1)))
+                               break;
+               }
+               offset_l |= (i << 7);
 
-                       nv_wo32(dev, pt, pte++, 0x00000000);
-                       nv_wo32(dev, pt, pte++, 0x00000000);
+               phys += block << 15;
+               size -= block;
 
-                       virt += (1 << psz);
-               }
-       } else {
-               while (pages--) {
-                       struct nouveau_gpuobj *pt = pgt[virt >> 29];
-                       unsigned pte = ((virt & 0x1fffffffULL) >> psz) << 1;
-                       unsigned offset_h = upper_32_bits(phys) & 0xff;
-                       unsigned offset_l = lower_32_bits(phys);
+               while (block) {
+                       pgt = dev_priv->vm_vram_pt[virt >> 14];
+                       pte = virt & 0x3ffe;
 
-                       nv_wo32(dev, pt, pte++, offset_l | pfl);
-                       nv_wo32(dev, pt, pte++, offset_h | flags);
+                       end = pte + block;
+                       if (end > 16384)
+                               end = 16384;
+                       block -= (end - pte);
+                       virt  += (end - pte);
 
-                       phys += (1 << psz);
-                       virt += (1 << psz);
+                       while (pte < end) {
+                               nv_wo32(dev, pgt, pte++, offset_l);
+                               nv_wo32(dev, pgt, pte++, offset_h);
+                       }
                }
        }
        dev_priv->engine.instmem.finish_access(dev);
@@ -356,7 +353,41 @@ nv50_mem_vm_bind_linear(struct drm_device *dev, uint64_t virt, uint32_t size,
 void
 nv50_mem_vm_unbind(struct drm_device *dev, uint64_t virt, uint32_t size)
 {
-       nv50_mem_vm_bind_linear(dev, virt, size, 0x80000000, 0);
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+       struct nouveau_gpuobj *pgt;
+       unsigned pages, pte, end;
+
+       virt -= dev_priv->vm_vram_base;
+       pages = (size >> 16) << 1;
+
+       dev_priv->engine.instmem.prepare_access(dev, true);
+       while (pages) {
+               pgt = dev_priv->vm_vram_pt[virt >> 29];
+               pte = (virt & 0x1ffe0000ULL) >> 15;
+
+               end = pte + pages;
+               if (end > 16384)
+                       end = 16384;
+               pages -= (end - pte);
+               virt  += (end - pte) << 15;
+
+               while (pte < end)
+                       nv_wo32(dev, pgt, pte++, 0);
+       }
+       dev_priv->engine.instmem.finish_access(dev);
+
+       nv_wr32(dev, 0x100c80, 0x00050001);
+       if (!nv_wait(0x100c80, 0x00000001, 0x00000000)) {
+               NV_ERROR(dev, "timeout: (0x100c80 & 1) == 0 (2)\n");
+               NV_ERROR(dev, "0x100c80 = 0x%08x\n", nv_rd32(dev, 0x100c80));
+               return;
+       }
+
+       nv_wr32(dev, 0x100c80, 0x00000001);
+       if (!nv_wait(0x100c80, 0x00000001, 0x00000000)) {
+               NV_ERROR(dev, "timeout: (0x100c80 & 1) == 0 (2)\n");
+               NV_ERROR(dev, "0x100c80 = 0x%08x\n", nv_rd32(dev, 0x100c80));
+       }
 }
 
 /*
@@ -383,9 +414,8 @@ void nouveau_mem_close(struct drm_device *dev)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
 
-       if (dev_priv->ttm.bdev.man[TTM_PL_PRIV0].has_type)
-               ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_PRIV0);
-       ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
+       nouveau_bo_unpin(dev_priv->vga_ram);
+       nouveau_bo_ref(NULL, &dev_priv->vga_ram);
 
        ttm_bo_device_release(&dev_priv->ttm.bdev);
 
@@ -622,6 +652,15 @@ nouveau_mem_init(struct drm_device *dev)
                return ret;
        }
 
+       ret = nouveau_bo_new(dev, NULL, 256*1024, 0, TTM_PL_FLAG_VRAM,
+                            0, 0, true, true, &dev_priv->vga_ram);
+       if (ret == 0)
+               ret = nouveau_bo_pin(dev_priv->vga_ram, TTM_PL_FLAG_VRAM);
+       if (ret) {
+               NV_WARN(dev, "failed to reserve VGA memory\n");
+               nouveau_bo_ref(NULL, &dev_priv->vga_ram);
+       }
+
        /* GART */
 #if !defined(__powerpc__) && !defined(__ia64__)
        if (drm_device_is_agp(dev) && dev->agp) {
@@ -653,6 +692,7 @@ nouveau_mem_init(struct drm_device *dev)
        dev_priv->fb_mtrr = drm_mtrr_add(drm_get_resource_start(dev, 1),
                                         drm_get_resource_len(dev, 1),
                                         DRM_MTRR_WC);
+
        return 0;
 }
 
index 6c66a34b63453bc599c31a1eb8d4103bd307cfc2..d99dc087f9b1b774316b9b4e41407c9fa4c4ffa5 100644 (file)
@@ -34,15 +34,20 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan)
 {
        struct drm_device *dev = chan->dev;
        struct nouveau_bo *ntfy = NULL;
+       uint32_t flags;
        int ret;
 
-       ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, nouveau_vram_notify ?
-                             TTM_PL_FLAG_VRAM : TTM_PL_FLAG_TT,
+       if (nouveau_vram_notify)
+               flags = TTM_PL_FLAG_VRAM;
+       else
+               flags = TTM_PL_FLAG_TT;
+
+       ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags,
                              0, 0x0000, false, true, &ntfy);
        if (ret)
                return ret;
 
-       ret = nouveau_bo_pin(ntfy, TTM_PL_FLAG_VRAM);
+       ret = nouveau_bo_pin(ntfy, flags);
        if (ret)
                goto out_err;
 
@@ -128,6 +133,8 @@ nouveau_notifier_alloc(struct nouveau_channel *chan, uint32_t handle,
                        target = NV_DMA_TARGET_PCI;
                } else {
                        target = NV_DMA_TARGET_AGP;
+                       if (dev_priv->card_type >= NV_50)
+                               offset += dev_priv->vm_gart_base;
                }
        } else {
                NV_ERROR(dev, "Bad DMA target, mem_type %d!\n",
index 6c2cf81716dfc4e4f02aea8fccb4f96d62c176ed..e7c100ba63a16d2d3b45284de22f1073767758de 100644 (file)
@@ -885,11 +885,12 @@ int
 nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class,
                      struct nouveau_gpuobj **gpuobj_ret)
 {
-       struct drm_nouveau_private *dev_priv = chan->dev->dev_private;
+       struct drm_nouveau_private *dev_priv;
        struct nouveau_gpuobj *gpuobj;
 
        if (!chan || !gpuobj_ret || *gpuobj_ret != NULL)
                return -EINVAL;
+       dev_priv = chan->dev->dev_private;
 
        gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL);
        if (!gpuobj)
index 251f1b3b38b927e73a0cef903c913109224d8172..aa9b310e41be0c7d2a26d33a598879fa98e77ba6 100644 (file)
@@ -99,6 +99,7 @@
  * the card will hang early on in the X init process.
  */
 #    define NV_PMC_ENABLE_UNK13                               (1<<13)
+#define NV40_PMC_GRAPH_UNITS                              0x00001540
 #define NV40_PMC_BACKLIGHT                                0x000015f0
 #      define NV40_PMC_BACKLIGHT_MASK                     0x001f0000
 #define NV40_PMC_1700                                      0x00001700
index 4c7f1e403e804633ef086417275e7b48a5f127a2..ed1590577b6c0d73d425be296718b440f756895b 100644 (file)
@@ -54,11 +54,12 @@ static void
 nouveau_sgdma_clear(struct ttm_backend *be)
 {
        struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
-       struct drm_device *dev = nvbe->dev;
-
-       NV_DEBUG(nvbe->dev, "\n");
+       struct drm_device *dev;
 
        if (nvbe && nvbe->pages) {
+               dev = nvbe->dev;
+               NV_DEBUG(dev, "\n");
+
                if (nvbe->bound)
                        be->func->unbind(be);
 
index 09b9a46dfc0ec0337f1ecf60b04585b8fddddff4..a4851af5b05ec535816eeb98973675c6cbb03aa4 100644 (file)
@@ -310,6 +310,14 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
 static unsigned int
 nouveau_vga_set_decode(void *priv, bool state)
 {
+       struct drm_device *dev = priv;
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+
+       if (dev_priv->chipset >= 0x40)
+               nv_wr32(dev, 0x88054, state);
+       else
+               nv_wr32(dev, 0x1854, state);
+
        if (state)
                return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
                       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
@@ -427,15 +435,19 @@ nouveau_card_init(struct drm_device *dev)
        if (ret)
                goto out_timer;
 
-       /* PGRAPH */
-       ret = engine->graph.init(dev);
-       if (ret)
-               goto out_fb;
+       if (nouveau_noaccel)
+               engine->graph.accel_blocked = true;
+       else {
+               /* PGRAPH */
+               ret = engine->graph.init(dev);
+               if (ret)
+                       goto out_fb;
 
-       /* PFIFO */
-       ret = engine->fifo.init(dev);
-       if (ret)
-               goto out_graph;
+               /* PFIFO */
+               ret = engine->fifo.init(dev);
+               if (ret)
+                       goto out_graph;
+       }
 
        /* this call irq_preinstall, register irq handler and
         * call irq_postinstall
@@ -479,9 +491,11 @@ nouveau_card_init(struct drm_device *dev)
 out_irq:
        drm_irq_uninstall(dev);
 out_fifo:
-       engine->fifo.takedown(dev);
+       if (!nouveau_noaccel)
+               engine->fifo.takedown(dev);
 out_graph:
-       engine->graph.takedown(dev);
+       if (!nouveau_noaccel)
+               engine->graph.takedown(dev);
 out_fb:
        engine->fb.takedown(dev);
 out_timer:
@@ -518,13 +532,16 @@ static void nouveau_card_takedown(struct drm_device *dev)
                        dev_priv->channel = NULL;
                }
 
-               engine->fifo.takedown(dev);
-               engine->graph.takedown(dev);
+               if (!nouveau_noaccel) {
+                       engine->fifo.takedown(dev);
+                       engine->graph.takedown(dev);
+               }
                engine->fb.takedown(dev);
                engine->timer.takedown(dev);
                engine->mc.takedown(dev);
 
                mutex_lock(&dev->struct_mutex);
+               ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
                ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
                mutex_unlock(&dev->struct_mutex);
                nouveau_sgdma_takedown(dev);
@@ -816,6 +833,15 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data,
        case NOUVEAU_GETPARAM_VM_VRAM_BASE:
                getparam->value = dev_priv->vm_vram_base;
                break;
+       case NOUVEAU_GETPARAM_GRAPH_UNITS:
+               /* NV40 and NV50 versions are quite different, but register
+                * address is the same. User is supposed to know the card
+                * family anyway... */
+               if (dev_priv->chipset >= 0x40) {
+                       getparam->value = nv_rd32(dev, NV40_PMC_GRAPH_UNITS);
+                       break;
+               }
+               /* FALLTHRU */
        default:
                NV_ERROR(dev, "unknown parameter %lld\n", getparam->param);
                return -EINVAL;
index d0e038d289484d4b0bb01bfaefb081e74abb1e33..1d73b15d70daf52c52e83dcac5a9200f304c288a 100644 (file)
@@ -119,7 +119,7 @@ static enum drm_connector_status nv04_dac_detect(struct drm_encoder *encoder,
                                                 struct drm_connector *connector)
 {
        struct drm_device *dev = encoder->dev;
-       uint8_t saved_seq1, saved_pi, saved_rpc1;
+       uint8_t saved_seq1, saved_pi, saved_rpc1, saved_cr_mode;
        uint8_t saved_palette0[3], saved_palette_mask;
        uint32_t saved_rtest_ctrl, saved_rgen_ctrl;
        int i;
@@ -135,6 +135,9 @@ static enum drm_connector_status nv04_dac_detect(struct drm_encoder *encoder,
                /* only implemented for head A for now */
                NVSetOwner(dev, 0);
 
+       saved_cr_mode = NVReadVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX);
+       NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode | 0x80);
+
        saved_seq1 = NVReadVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX);
        NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1 & ~0x20);
 
@@ -203,6 +206,7 @@ out:
        NVWriteVgaCrtc(dev, 0, NV_CIO_CRE_PIXEL_INDEX, saved_pi);
        NVWriteVgaCrtc(dev, 0, NV_CIO_CRE_RPC1_INDEX, saved_rpc1);
        NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1);
+       NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode);
 
        if (blue == 0x18) {
                NV_INFO(dev, "Load detected on head A\n");
index d910873c13682986ac5280349ee971c6ea3353cc..fd01caabd5c3aee9efbc93bda38b3707adb14a84 100644 (file)
@@ -27,7 +27,7 @@
 #include "nouveau_dma.h"
 #include "nouveau_fbcon.h"
 
-static void
+void
 nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -54,7 +54,7 @@ nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
        FIRE_RING(chan);
 }
 
-static void
+void
 nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -88,7 +88,7 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
        FIRE_RING(chan);
 }
 
-static void
+void
 nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -307,9 +307,6 @@ nv04_fbcon_accel_init(struct fb_info *info)
 
        FIRE_RING(chan);
 
-       info->fbops->fb_fillrect = nv04_fbcon_fillrect;
-       info->fbops->fb_copyarea = nv04_fbcon_copyarea;
-       info->fbops->fb_imageblit = nv04_fbcon_imageblit;
        return 0;
 }
 
index a20c206625a2616f64b6601efa959ee4b9badd77..a3b9563a6f60c4f933cd9caf687da307eaac90ae 100644 (file)
@@ -30,7 +30,7 @@ nv04_instmem_determine_amount(struct drm_device *dev)
                 * of vram.  For now, only reserve a small piece until we know
                 * more about what each chipset requires.
                 */
-               switch (dev_priv->chipset & 0xf0) {
+               switch (dev_priv->chipset) {
                case 0x40:
                case 0x47:
                case 0x49:
index 58b917c3341b247af0fe569d92df1f79d193b568..21ac6e49b6ee52bd4891f7710e94d9356595c546 100644 (file)
@@ -579,6 +579,8 @@ static void nv17_tv_restore(struct drm_encoder *encoder)
                                nouveau_encoder(encoder)->restore.output);
 
        nv17_tv_state_load(dev, &to_tv_enc(encoder)->saved_state);
+
+       nouveau_encoder(encoder)->last_dpms = NV_DPMS_CLEARED;
 }
 
 static int nv17_tv_create_resources(struct drm_encoder *encoder,
index 118d3285fd8c9e95d74d1f8f5ffb0f52ef49a6ee..d1a651e3400cf5273e79dd210486fb96c8e79664 100644 (file)
@@ -298,14 +298,17 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk)
 static void
 nv50_crtc_destroy(struct drm_crtc *crtc)
 {
-       struct drm_device *dev = crtc->dev;
-       struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
-
-       NV_DEBUG_KMS(dev, "\n");
+       struct drm_device *dev;
+       struct nouveau_crtc *nv_crtc;
 
        if (!crtc)
                return;
 
+       dev = crtc->dev;
+       nv_crtc = nouveau_crtc(crtc);
+
+       NV_DEBUG_KMS(dev, "\n");
+
        drm_crtc_cleanup(&nv_crtc->base);
 
        nv50_cursor_fini(nv_crtc);
@@ -432,6 +435,7 @@ nv50_crtc_prepare(struct drm_crtc *crtc)
        struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
        struct drm_device *dev = crtc->dev;
        struct drm_encoder *encoder;
+       uint32_t dac = 0, sor = 0;
 
        NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
 
@@ -439,9 +443,28 @@ nv50_crtc_prepare(struct drm_crtc *crtc)
        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
                struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 
-               if (drm_helper_encoder_in_use(encoder))
+               if (!drm_helper_encoder_in_use(encoder))
                        continue;
 
+               if (nv_encoder->dcb->type == OUTPUT_ANALOG ||
+                   nv_encoder->dcb->type == OUTPUT_TV)
+                       dac |= (1 << nv_encoder->or);
+               else
+                       sor |= (1 << nv_encoder->or);
+       }
+
+       list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+               struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
+
+               if (nv_encoder->dcb->type == OUTPUT_ANALOG ||
+                   nv_encoder->dcb->type == OUTPUT_TV) {
+                       if (dac & (1 << nv_encoder->or))
+                               continue;
+               } else {
+                       if (sor & (1 << nv_encoder->or))
+                               continue;
+               }
+
                nv_encoder->disconnect(nv_encoder);
        }
 
index e4f279ee61cf4b56324b7d0c5e5e8db39949871b..0f57cdf7ccb23dd22ed70d581247f23e14db6596 100644 (file)
@@ -3,7 +3,7 @@
 #include "nouveau_dma.h"
 #include "nouveau_fbcon.h"
 
-static void
+void
 nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -46,7 +46,7 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
        FIRE_RING(chan);
 }
 
-static void
+void
 nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -81,7 +81,7 @@ nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
        FIRE_RING(chan);
 }
 
-static void
+void
 nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
 {
        struct nouveau_fbcon_par *par = info->par;
@@ -262,9 +262,6 @@ nv50_fbcon_accel_init(struct fb_info *info)
        OUT_RING(chan, info->fix.smem_start - dev_priv->fb_phys +
                         dev_priv->vm_vram_base);
 
-       info->fbops->fb_fillrect = nv50_fbcon_fillrect;
-       info->fbops->fb_copyarea = nv50_fbcon_copyarea;
-       info->fbops->fb_imageblit = nv50_fbcon_imageblit;
        return 0;
 }
 
index 39caf167587d130ae4bf6346342818550c653f80..204a79ff10f4e529479bc0136f4209282e085d8c 100644 (file)
@@ -272,7 +272,7 @@ nv50_fifo_create_context(struct nouveau_channel *chan)
                        return ret;
                ramfc = chan->ramfc->gpuobj;
 
-               ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 4096, 256,
+               ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 4096, 1024,
                                             0, &chan->cache);
                if (ret)
                        return ret;
@@ -317,17 +317,20 @@ void
 nv50_fifo_destroy_context(struct nouveau_channel *chan)
 {
        struct drm_device *dev = chan->dev;
+       struct nouveau_gpuobj_ref *ramfc = chan->ramfc;
 
        NV_DEBUG(dev, "ch%d\n", chan->id);
 
-       nouveau_gpuobj_ref_del(dev, &chan->ramfc);
-       nouveau_gpuobj_ref_del(dev, &chan->cache);
-
+       /* This will ensure the channel is seen as disabled. */
+       chan->ramfc = NULL;
        nv50_fifo_channel_disable(dev, chan->id, false);
 
        /* Dummy channel, also used on ch 127 */
        if (chan->id == 0)
                nv50_fifo_channel_disable(dev, 127, false);
+
+       nouveau_gpuobj_ref_del(dev, &ramfc);
+       nouveau_gpuobj_ref_del(dev, &chan->cache);
 }
 
 int
index ca79f32be44c13bcaba47e00f189b8e3067bbf55..6d504801b514823d09575b51e644395933d53122 100644 (file)
@@ -84,7 +84,7 @@ nv50_graph_init_regs__nv(struct drm_device *dev)
        nv_wr32(dev, 0x400804, 0xc0000000);
        nv_wr32(dev, 0x406800, 0xc0000000);
        nv_wr32(dev, 0x400c04, 0xc0000000);
-       nv_wr32(dev, 0x401804, 0xc0000000);
+       nv_wr32(dev, 0x401800, 0xc0000000);
        nv_wr32(dev, 0x405018, 0xc0000000);
        nv_wr32(dev, 0x402000, 0xc0000000);
 
@@ -165,6 +165,12 @@ nv50_graph_channel(struct drm_device *dev)
        uint32_t inst;
        int i;
 
+       /* Be sure we're not in the middle of a context switch or bad things
+        * will happen, such as unloading the wrong pgraph context.
+        */
+       if (!nv_wait(0x400300, 0x00000001, 0x00000000))
+               NV_ERROR(dev, "Ctxprog is still running\n");
+
        inst = nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR);
        if (!(inst & NV50_PGRAPH_CTXCTL_CUR_LOADED))
                return NULL;
@@ -275,19 +281,18 @@ nv50_graph_load_context(struct nouveau_channel *chan)
 int
 nv50_graph_unload_context(struct drm_device *dev)
 {
-       uint32_t inst, fifo = nv_rd32(dev, 0x400500);
+       uint32_t inst;
 
        inst  = nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR);
        if (!(inst & NV50_PGRAPH_CTXCTL_CUR_LOADED))
                return 0;
        inst &= NV50_PGRAPH_CTXCTL_CUR_INSTANCE;
 
-       nv_wr32(dev, 0x400500, fifo & ~1);
+       nouveau_wait_for_idle(dev);
        nv_wr32(dev, 0x400784, inst);
        nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) | 0x20);
        nv_wr32(dev, 0x400304, nv_rd32(dev, 0x400304) | 0x01);
        nouveau_wait_for_idle(dev);
-       nv_wr32(dev, 0x400500, fifo);
 
        nv_wr32(dev, NV50_PGRAPH_CTXCTL_CUR, inst);
        return 0;
index 94400f777e7f9bd1d83eb73890bf23450fb7bfa6..f0dc4e36ef055c7d711eaf1a54a501d41bbce2d2 100644 (file)
@@ -76,6 +76,11 @@ nv50_instmem_init(struct drm_device *dev)
        for (i = 0x1700; i <= 0x1710; i += 4)
                priv->save1700[(i-0x1700)/4] = nv_rd32(dev, i);
 
+       if (dev_priv->chipset == 0xaa || dev_priv->chipset == 0xac)
+               dev_priv->vram_sys_base = nv_rd32(dev, 0x100e10) << 12;
+       else
+               dev_priv->vram_sys_base = 0;
+
        /* Reserve the last MiB of VRAM, we should probably try to avoid
         * setting up the below tables over the top of the VBIOS image at
         * some point.
@@ -172,16 +177,28 @@ nv50_instmem_init(struct drm_device *dev)
         * We map the entire fake channel into the start of the PRAMIN BAR
         */
        ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pt_size, 0x1000,
-                                                       0, &priv->pramin_pt);
+                                    0, &priv->pramin_pt);
        if (ret)
                return ret;
 
-       for (i = 0, v = c_offset; i < pt_size; i += 8, v += 0x1000) {
-               if (v < (c_offset + c_size))
-                       BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, v | 1);
-               else
-                       BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, 0x00000009);
+       v = c_offset | 1;
+       if (dev_priv->vram_sys_base) {
+               v += dev_priv->vram_sys_base;
+               v |= 0x30;
+       }
+
+       i = 0;
+       while (v < dev_priv->vram_sys_base + c_offset + c_size) {
+               BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, v);
+               BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000);
+               v += 0x1000;
+               i += 8;
+       }
+
+       while (i < pt_size) {
+               BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, 0x00000000);
                BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000);
+               i += 8;
        }
 
        BAR0_WI32(chan->vm_pd, 0x00, priv->pramin_pt->instance | 0x63);
@@ -416,7 +433,9 @@ nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nv50_instmem_priv *priv = dev_priv->engine.instmem.priv;
-       uint32_t pte, pte_end, vram;
+       struct nouveau_gpuobj *pramin_pt = priv->pramin_pt->gpuobj;
+       uint32_t pte, pte_end;
+       uint64_t vram;
 
        if (!gpuobj->im_backing || !gpuobj->im_pramin || gpuobj->im_bound)
                return -EINVAL;
@@ -424,20 +443,24 @@ nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
        NV_DEBUG(dev, "st=0x%0llx sz=0x%0llx\n",
                 gpuobj->im_pramin->start, gpuobj->im_pramin->size);
 
-       pte     = (gpuobj->im_pramin->start >> 12) << 3;
-       pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
+       pte     = (gpuobj->im_pramin->start >> 12) << 1;
+       pte_end = ((gpuobj->im_pramin->size >> 12) << 1) + pte;
        vram    = gpuobj->im_backing_start;
 
        NV_DEBUG(dev, "pramin=0x%llx, pte=%d, pte_end=%d\n",
                 gpuobj->im_pramin->start, pte, pte_end);
        NV_DEBUG(dev, "first vram page: 0x%08x\n", gpuobj->im_backing_start);
 
+       vram |= 1;
+       if (dev_priv->vram_sys_base) {
+               vram += dev_priv->vram_sys_base;
+               vram |= 0x30;
+       }
+
        dev_priv->engine.instmem.prepare_access(dev, true);
        while (pte < pte_end) {
-               nv_wo32(dev, priv->pramin_pt->gpuobj, (pte + 0)/4, vram | 1);
-               nv_wo32(dev, priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
-
-               pte += 8;
+               nv_wo32(dev, pramin_pt, pte++, lower_32_bits(vram));
+               nv_wo32(dev, pramin_pt, pte++, upper_32_bits(vram));
                vram += NV50_INSTMEM_PAGE_SIZE;
        }
        dev_priv->engine.instmem.finish_access(dev);
@@ -470,14 +493,13 @@ nv50_instmem_unbind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
        if (gpuobj->im_bound == 0)
                return -EINVAL;
 
-       pte     = (gpuobj->im_pramin->start >> 12) << 3;
-       pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
+       pte     = (gpuobj->im_pramin->start >> 12) << 1;
+       pte_end = ((gpuobj->im_pramin->size >> 12) << 1) + pte;
 
        dev_priv->engine.instmem.prepare_access(dev, true);
        while (pte < pte_end) {
-               nv_wo32(dev, priv->pramin_pt->gpuobj, (pte + 0)/4, 0x00000009);
-               nv_wo32(dev, priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
-               pte += 8;
+               nv_wo32(dev, priv->pramin_pt->gpuobj, pte++, 0x00000000);
+               nv_wo32(dev, priv->pramin_pt->gpuobj, pte++, 0x00000000);
        }
        dev_priv->engine.instmem.finish_access(dev);
 
index e395c16d30f548c29fe848f380019bf8f946ba3b..c2fff543b06f4a1c5269e4fa8e7cfb4b69f475d2 100644 (file)
@@ -90,11 +90,25 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode)
 {
        struct drm_device *dev = encoder->dev;
        struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
+       struct drm_encoder *enc;
        uint32_t val;
        int or = nv_encoder->or;
 
        NV_DEBUG_KMS(dev, "or %d mode %d\n", or, mode);
 
+       nv_encoder->last_dpms = mode;
+       list_for_each_entry(enc, &dev->mode_config.encoder_list, head) {
+               struct nouveau_encoder *nvenc = nouveau_encoder(enc);
+
+               if (nvenc == nv_encoder ||
+                   nvenc->disconnect != nv50_sor_disconnect ||
+                   nvenc->dcb->or != nv_encoder->dcb->or)
+                       continue;
+
+               if (nvenc->last_dpms == DRM_MODE_DPMS_ON)
+                       return;
+       }
+
        /* wait for it to be done */
        if (!nv_wait(NV50_PDISPLAY_SOR_DPMS_CTRL(or),
                     NV50_PDISPLAY_SOR_DPMS_CTRL_PENDING, 0)) {
index 5982321be4d5b9f674cfdbaee221381336afd4b3..1c02d23f6fcca9f9a6030bba9ea309ef98838419 100644 (file)
@@ -1,10 +1,14 @@
 config DRM_RADEON_KMS
-       bool "Enable modesetting on radeon by default"
+       bool "Enable modesetting on radeon by default - NEW DRIVER"
        depends on DRM_RADEON
        help
-         Choose this option if you want kernel modesetting enabled by default,
-         and you have a new enough userspace to support this. Running old
-         userspaces with this enabled will cause pain.
+         Choose this option if you want kernel modesetting enabled by default.
+
+         This is a completely new driver. It's only part of the existing drm
+         for compatibility reasons. It requires an entirely different graphics
+         stack above it and works very differently from the old drm stack.
+         i.e. don't enable this unless you know what you are doing it may
+         cause issues or bugs compared to the previous userspace driver stack.
 
          When kernel modesetting is enabled the IOCTL of radeon/drm
          driver are considered as invalid and an error message is printed
index 388140a7e651d4224abc2bf9ebfe234dd0805299..7f152f66f196394dc7ee1318e64d651d216dfe19 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <asm/unaligned.h>
 
 #define ATOM_DEBUG
 
@@ -212,7 +213,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
        case ATOM_ARG_PS:
                idx = U8(*ptr);
                (*ptr)++;
-               val = le32_to_cpu(ctx->ps[idx]);
+               /* get_unaligned_le32 avoids unaligned accesses from atombios
+                * tables, noticed on a DEC Alpha. */
+               val = get_unaligned_le32((u32 *)&ctx->ps[idx]);
                if (print)
                        DEBUG("PS[0x%02X,0x%04X]", idx, val);
                break;
@@ -246,6 +249,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
                case ATOM_WS_ATTRIBUTES:
                        val = gctx->io_attr;
                        break;
+               case ATOM_WS_REGPTR:
+                       val = gctx->reg_block;
+                       break;
                default:
                        val = ctx->ws[idx];
                }
@@ -385,6 +391,32 @@ static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr)
        return atom_get_src_int(ctx, attr, ptr, NULL, 1);
 }
 
+static uint32_t atom_get_src_direct(atom_exec_context *ctx, uint8_t align, int *ptr)
+{
+       uint32_t val = 0xCDCDCDCD;
+
+       switch (align) {
+       case ATOM_SRC_DWORD:
+               val = U32(*ptr);
+               (*ptr) += 4;
+               break;
+       case ATOM_SRC_WORD0:
+       case ATOM_SRC_WORD8:
+       case ATOM_SRC_WORD16:
+               val = U16(*ptr);
+               (*ptr) += 2;
+               break;
+       case ATOM_SRC_BYTE0:
+       case ATOM_SRC_BYTE8:
+       case ATOM_SRC_BYTE16:
+       case ATOM_SRC_BYTE24:
+               val = U8(*ptr);
+               (*ptr)++;
+               break;
+       }
+       return val;
+}
+
 static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr,
                             int *ptr, uint32_t *saved, int print)
 {
@@ -482,6 +514,9 @@ static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr,
                case ATOM_WS_ATTRIBUTES:
                        gctx->io_attr = val;
                        break;
+               case ATOM_WS_REGPTR:
+                       gctx->reg_block = val;
+                       break;
                default:
                        ctx->ws[idx] = val;
                }
@@ -608,7 +643,7 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)
        uint8_t count = U8((*ptr)++);
        SDEBUG("   count: %d\n", count);
        if (arg == ATOM_UNIT_MICROSEC)
-               schedule_timeout_uninterruptible(usecs_to_jiffies(count));
+               udelay(count);
        else
                schedule_timeout_uninterruptible(msecs_to_jiffies(count));
 }
@@ -677,7 +712,7 @@ static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg)
        SDEBUG("   dst: ");
        dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
        SDEBUG("   src1: ");
-       src1 = atom_get_src(ctx, attr, ptr);
+       src1 = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr);
        SDEBUG("   src2: ");
        src2 = atom_get_src(ctx, attr, ptr);
        dst &= src1;
@@ -809,6 +844,38 @@ static void atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg)
        SDEBUG("   base: 0x%04X\n", ctx->ctx->reg_block);
 }
 
+static void atom_op_shift_left(atom_exec_context *ctx, int *ptr, int arg)
+{
+       uint8_t attr = U8((*ptr)++), shift;
+       uint32_t saved, dst;
+       int dptr = *ptr;
+       attr &= 0x38;
+       attr |= atom_def_dst[attr >> 3] << 6;
+       SDEBUG("   dst: ");
+       dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
+       shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr);
+       SDEBUG("   shift: %d\n", shift);
+       dst <<= shift;
+       SDEBUG("   dst: ");
+       atom_put_dst(ctx, arg, attr, &dptr, dst, saved);
+}
+
+static void atom_op_shift_right(atom_exec_context *ctx, int *ptr, int arg)
+{
+       uint8_t attr = U8((*ptr)++), shift;
+       uint32_t saved, dst;
+       int dptr = *ptr;
+       attr &= 0x38;
+       attr |= atom_def_dst[attr >> 3] << 6;
+       SDEBUG("   dst: ");
+       dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
+       shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr);
+       SDEBUG("   shift: %d\n", shift);
+       dst >>= shift;
+       SDEBUG("   dst: ");
+       atom_put_dst(ctx, arg, attr, &dptr, dst, saved);
+}
+
 static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg)
 {
        uint8_t attr = U8((*ptr)++), shift;
@@ -818,7 +885,7 @@ static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg)
        attr |= atom_def_dst[attr >> 3] << 6;
        SDEBUG("   dst: ");
        dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
-       shift = U8((*ptr)++);
+       shift = atom_get_src(ctx, attr, ptr);
        SDEBUG("   shift: %d\n", shift);
        dst <<= shift;
        SDEBUG("   dst: ");
@@ -834,7 +901,7 @@ static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg)
        attr |= atom_def_dst[attr >> 3] << 6;
        SDEBUG("   dst: ");
        dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
-       shift = U8((*ptr)++);
+       shift = atom_get_src(ctx, attr, ptr);
        SDEBUG("   shift: %d\n", shift);
        dst >>= shift;
        SDEBUG("   dst: ");
@@ -937,18 +1004,18 @@ static struct {
        atom_op_or, ATOM_ARG_FB}, {
        atom_op_or, ATOM_ARG_PLL}, {
        atom_op_or, ATOM_ARG_MC}, {
-       atom_op_shl, ATOM_ARG_REG}, {
-       atom_op_shl, ATOM_ARG_PS}, {
-       atom_op_shl, ATOM_ARG_WS}, {
-       atom_op_shl, ATOM_ARG_FB}, {
-       atom_op_shl, ATOM_ARG_PLL}, {
-       atom_op_shl, ATOM_ARG_MC}, {
-       atom_op_shr, ATOM_ARG_REG}, {
-       atom_op_shr, ATOM_ARG_PS}, {
-       atom_op_shr, ATOM_ARG_WS}, {
-       atom_op_shr, ATOM_ARG_FB}, {
-       atom_op_shr, ATOM_ARG_PLL}, {
-       atom_op_shr, ATOM_ARG_MC}, {
+       atom_op_shift_left, ATOM_ARG_REG}, {
+       atom_op_shift_left, ATOM_ARG_PS}, {
+       atom_op_shift_left, ATOM_ARG_WS}, {
+       atom_op_shift_left, ATOM_ARG_FB}, {
+       atom_op_shift_left, ATOM_ARG_PLL}, {
+       atom_op_shift_left, ATOM_ARG_MC}, {
+       atom_op_shift_right, ATOM_ARG_REG}, {
+       atom_op_shift_right, ATOM_ARG_PS}, {
+       atom_op_shift_right, ATOM_ARG_WS}, {
+       atom_op_shift_right, ATOM_ARG_FB}, {
+       atom_op_shift_right, ATOM_ARG_PLL}, {
+       atom_op_shift_right, ATOM_ARG_MC}, {
        atom_op_mul, ATOM_ARG_REG}, {
        atom_op_mul, ATOM_ARG_PS}, {
        atom_op_mul, ATOM_ARG_WS}, {
@@ -1058,8 +1125,6 @@ static void atom_execute_table_locked(struct atom_context *ctx, int index, uint3
 
        SDEBUG(">> execute %04X (len %d, WS %d, PS %d)\n", base, len, ws, ps);
 
-       /* reset reg block */
-       ctx->reg_block = 0;
        ectx.ctx = ctx;
        ectx.ps_shift = ps / 4;
        ectx.start = base;
@@ -1096,6 +1161,12 @@ static void atom_execute_table_locked(struct atom_context *ctx, int index, uint3
 void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
 {
        mutex_lock(&ctx->mutex);
+       /* reset reg block */
+       ctx->reg_block = 0;
+       /* reset fb window */
+       ctx->fb_base = 0;
+       /* reset io mode */
+       ctx->io_mode = ATOM_IO_MM;
        atom_execute_table_locked(ctx, index, params);
        mutex_unlock(&ctx->mutex);
 }
index 47fd943f6d1422afa6bab7561127450a3285756c..bc73781423a17599fadf9e2bfa1bca556b5504ca 100644 (file)
@@ -91,6 +91,7 @@
 #define ATOM_WS_AND_MASK       0x45
 #define ATOM_WS_FB_WINDOW      0x46
 #define ATOM_WS_ATTRIBUTES     0x47
+#define ATOM_WS_REGPTR         0x48
 
 #define ATOM_IIO_NOP           0
 #define ATOM_IIO_START         1
index 260fcf59f00ca86d61efe9091e0e4fc1d267775a..af464e351fbd95da253435c00b9b3a43c877553c 100644 (file)
@@ -307,7 +307,6 @@ atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
        args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
        args.ucCRTC = radeon_crtc->crtc_id;
 
-       printk("executing set crtc dtd timing\n");
        atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 }
 
@@ -347,7 +346,6 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc,
        args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
        args.ucCRTC = radeon_crtc->crtc_id;
 
-       printk("executing set crtc timing\n");
        atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 }
 
@@ -409,59 +407,57 @@ static void atombios_set_ss(struct drm_crtc *crtc, int enable)
        }
 }
 
-void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
+union adjust_pixel_clock {
+       ADJUST_DISPLAY_PLL_PS_ALLOCATION v1;
+};
+
+static u32 atombios_adjust_pll(struct drm_crtc *crtc,
+                              struct drm_display_mode *mode,
+                              struct radeon_pll *pll)
 {
-       struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
        struct drm_device *dev = crtc->dev;
        struct radeon_device *rdev = dev->dev_private;
        struct drm_encoder *encoder = NULL;
        struct radeon_encoder *radeon_encoder = NULL;
-       uint8_t frev, crev;
-       int index;
-       SET_PIXEL_CLOCK_PS_ALLOCATION args;
-       PIXEL_CLOCK_PARAMETERS *spc1_ptr;
-       PIXEL_CLOCK_PARAMETERS_V2 *spc2_ptr;
-       PIXEL_CLOCK_PARAMETERS_V3 *spc3_ptr;
-       uint32_t pll_clock = mode->clock;
-       uint32_t adjusted_clock;
-       uint32_t ref_div = 0, fb_div = 0, frac_fb_div = 0, post_div = 0;
-       struct radeon_pll *pll;
-       int pll_flags = 0;
+       u32 adjusted_clock = mode->clock;
 
-       memset(&args, 0, sizeof(args));
+       /* reset the pll flags */
+       pll->flags = 0;
 
        if (ASIC_IS_AVIVO(rdev)) {
                if ((rdev->family == CHIP_RS600) ||
                    (rdev->family == CHIP_RS690) ||
                    (rdev->family == CHIP_RS740))
-                       pll_flags |= (RADEON_PLL_USE_FRAC_FB_DIV |
-                                     RADEON_PLL_PREFER_CLOSEST_LOWER);
+                       pll->flags |= (RADEON_PLL_USE_FRAC_FB_DIV |
+                                      RADEON_PLL_PREFER_CLOSEST_LOWER);
 
                if (ASIC_IS_DCE32(rdev) && mode->clock > 200000)        /* range limits??? */
-                       pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
+                       pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
                else
-                       pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
+                       pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
        } else {
-               pll_flags |= RADEON_PLL_LEGACY;
+               pll->flags |= RADEON_PLL_LEGACY;
 
                if (mode->clock > 200000)       /* range limits??? */
-                       pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
+                       pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
                else
-                       pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
+                       pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
 
        }
 
        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
                if (encoder->crtc == crtc) {
-                       if (!ASIC_IS_AVIVO(rdev)) {
-                               if (encoder->encoder_type !=
-                                   DRM_MODE_ENCODER_DAC)
-                                       pll_flags |= RADEON_PLL_NO_ODD_POST_DIV;
-                               if (encoder->encoder_type ==
-                                       DRM_MODE_ENCODER_LVDS)
-                                       pll_flags |= RADEON_PLL_USE_REF_DIV;
-                       }
                        radeon_encoder = to_radeon_encoder(encoder);
+                       if (ASIC_IS_AVIVO(rdev)) {
+                               /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
+                               if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
+                                       adjusted_clock = mode->clock * 2;
+                       } else {
+                               if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)
+                                       pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
+                               if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS)
+                                       pll->flags |= RADEON_PLL_USE_REF_DIV;
+                       }
                        break;
                }
        }
@@ -471,46 +467,101 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
         * special hw requirements.
         */
        if (ASIC_IS_DCE3(rdev)) {
-               ADJUST_DISPLAY_PLL_PS_ALLOCATION adjust_pll_args;
+               union adjust_pixel_clock args;
+               struct radeon_encoder_atom_dig *dig;
+               u8 frev, crev;
+               int index;
 
-               if (!encoder)
-                       return;
-
-               memset(&adjust_pll_args, 0, sizeof(adjust_pll_args));
-               adjust_pll_args.usPixelClock = cpu_to_le16(mode->clock / 10);
-               adjust_pll_args.ucTransmitterID = radeon_encoder->encoder_id;
-               adjust_pll_args.ucEncodeMode = atombios_get_encoder_mode(encoder);
+               if (!radeon_encoder->enc_priv)
+                       return adjusted_clock;
+               dig = radeon_encoder->enc_priv;
 
                index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll);
-               atom_execute_table(rdev->mode_info.atom_context,
-                                  index, (uint32_t *)&adjust_pll_args);
-               adjusted_clock = le16_to_cpu(adjust_pll_args.usPixelClock) * 10;
-       } else {
-               /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
-               if (ASIC_IS_AVIVO(rdev) &&
-                   (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1))
-                       adjusted_clock = mode->clock * 2;
-               else
-                       adjusted_clock = mode->clock;
+               atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,
+                                     &crev);
+
+               memset(&args, 0, sizeof(args));
+
+               switch (frev) {
+               case 1:
+                       switch (crev) {
+                       case 1:
+                       case 2:
+                               args.v1.usPixelClock = cpu_to_le16(mode->clock / 10);
+                               args.v1.ucTransmitterID = radeon_encoder->encoder_id;
+                               args.v1.ucEncodeMode = atombios_get_encoder_mode(encoder);
+
+                               atom_execute_table(rdev->mode_info.atom_context,
+                                                  index, (uint32_t *)&args);
+                               adjusted_clock = le16_to_cpu(args.v1.usPixelClock) * 10;
+                               break;
+                       default:
+                               DRM_ERROR("Unknown table version %d %d\n", frev, crev);
+                               return adjusted_clock;
+                       }
+                       break;
+               default:
+                       DRM_ERROR("Unknown table version %d %d\n", frev, crev);
+                       return adjusted_clock;
+               }
        }
+       return adjusted_clock;
+}
+
+union set_pixel_clock {
+       SET_PIXEL_CLOCK_PS_ALLOCATION base;
+       PIXEL_CLOCK_PARAMETERS v1;
+       PIXEL_CLOCK_PARAMETERS_V2 v2;
+       PIXEL_CLOCK_PARAMETERS_V3 v3;
+};
+
+void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
+{
+       struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+       struct drm_device *dev = crtc->dev;
+       struct radeon_device *rdev = dev->dev_private;
+       struct drm_encoder *encoder = NULL;
+       struct radeon_encoder *radeon_encoder = NULL;
+       u8 frev, crev;
+       int index;
+       union set_pixel_clock args;
+       u32 pll_clock = mode->clock;
+       u32 ref_div = 0, fb_div = 0, frac_fb_div = 0, post_div = 0;
+       struct radeon_pll *pll;
+       u32 adjusted_clock;
+
+       memset(&args, 0, sizeof(args));
+
+       list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+               if (encoder->crtc == crtc) {
+                       radeon_encoder = to_radeon_encoder(encoder);
+                       break;
+               }
+       }
+
+       if (!radeon_encoder)
+               return;
 
        if (radeon_crtc->crtc_id == 0)
                pll = &rdev->clock.p1pll;
        else
                pll = &rdev->clock.p2pll;
 
+       /* adjust pixel clock as needed */
+       adjusted_clock = atombios_adjust_pll(crtc, mode, pll);
+
        if (ASIC_IS_AVIVO(rdev)) {
                if (radeon_new_pll)
                        radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock,
                                                 &fb_div, &frac_fb_div,
-                                                &ref_div, &post_div, pll_flags);
+                                                &ref_div, &post_div);
                else
                        radeon_compute_pll(pll, adjusted_clock, &pll_clock,
                                           &fb_div, &frac_fb_div,
-                                          &ref_div, &post_div, pll_flags);
+                                          &ref_div, &post_div);
        } else
                radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
-                                  &ref_div, &post_div, pll_flags);
+                                  &ref_div, &post_div);
 
        index = GetIndexIntoMasterTable(COMMAND, SetPixelClock);
        atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,
@@ -520,45 +571,38 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
        case 1:
                switch (crev) {
                case 1:
-                       spc1_ptr = (PIXEL_CLOCK_PARAMETERS *) & args.sPCLKInput;
-                       spc1_ptr->usPixelClock = cpu_to_le16(mode->clock / 10);
-                       spc1_ptr->usRefDiv = cpu_to_le16(ref_div);
-                       spc1_ptr->usFbDiv = cpu_to_le16(fb_div);
-                       spc1_ptr->ucFracFbDiv = frac_fb_div;
-                       spc1_ptr->ucPostDiv = post_div;
-                       spc1_ptr->ucPpll =
+                       args.v1.usPixelClock = cpu_to_le16(mode->clock / 10);
+                       args.v1.usRefDiv = cpu_to_le16(ref_div);
+                       args.v1.usFbDiv = cpu_to_le16(fb_div);
+                       args.v1.ucFracFbDiv = frac_fb_div;
+                       args.v1.ucPostDiv = post_div;
+                       args.v1.ucPpll =
                            radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1;
-                       spc1_ptr->ucCRTC = radeon_crtc->crtc_id;
-                       spc1_ptr->ucRefDivSrc = 1;
+                       args.v1.ucCRTC = radeon_crtc->crtc_id;
+                       args.v1.ucRefDivSrc = 1;
                        break;
                case 2:
-                       spc2_ptr =
-                           (PIXEL_CLOCK_PARAMETERS_V2 *) & args.sPCLKInput;
-                       spc2_ptr->usPixelClock = cpu_to_le16(mode->clock / 10);
-                       spc2_ptr->usRefDiv = cpu_to_le16(ref_div);
-                       spc2_ptr->usFbDiv = cpu_to_le16(fb_div);
-                       spc2_ptr->ucFracFbDiv = frac_fb_div;
-                       spc2_ptr->ucPostDiv = post_div;
-                       spc2_ptr->ucPpll =
+                       args.v2.usPixelClock = cpu_to_le16(mode->clock / 10);
+                       args.v2.usRefDiv = cpu_to_le16(ref_div);
+                       args.v2.usFbDiv = cpu_to_le16(fb_div);
+                       args.v2.ucFracFbDiv = frac_fb_div;
+                       args.v2.ucPostDiv = post_div;
+                       args.v2.ucPpll =
                            radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1;
-                       spc2_ptr->ucCRTC = radeon_crtc->crtc_id;
-                       spc2_ptr->ucRefDivSrc = 1;
+                       args.v2.ucCRTC = radeon_crtc->crtc_id;
+                       args.v2.ucRefDivSrc = 1;
                        break;
                case 3:
-                       if (!encoder)
-                               return;
-                       spc3_ptr =
-                           (PIXEL_CLOCK_PARAMETERS_V3 *) & args.sPCLKInput;
-                       spc3_ptr->usPixelClock = cpu_to_le16(mode->clock / 10);
-                       spc3_ptr->usRefDiv = cpu_to_le16(ref_div);
-                       spc3_ptr->usFbDiv = cpu_to_le16(fb_div);
-                       spc3_ptr->ucFracFbDiv = frac_fb_div;
-                       spc3_ptr->ucPostDiv = post_div;
-                       spc3_ptr->ucPpll =
+                       args.v3.usPixelClock = cpu_to_le16(mode->clock / 10);
+                       args.v3.usRefDiv = cpu_to_le16(ref_div);
+                       args.v3.usFbDiv = cpu_to_le16(fb_div);
+                       args.v3.ucFracFbDiv = frac_fb_div;
+                       args.v3.ucPostDiv = post_div;
+                       args.v3.ucPpll =
                            radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1;
-                       spc3_ptr->ucMiscInfo = (radeon_crtc->crtc_id << 2);
-                       spc3_ptr->ucTransmitterId = radeon_encoder->encoder_id;
-                       spc3_ptr->ucEncoderMode =
+                       args.v3.ucMiscInfo = (radeon_crtc->crtc_id << 2);
+                       args.v3.ucTransmitterId = radeon_encoder->encoder_id;
+                       args.v3.ucEncoderMode =
                            atombios_get_encoder_mode(encoder);
                        break;
                default:
@@ -571,12 +615,11 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
                return;
        }
 
-       printk("executing set pll\n");
        atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 }
 
-int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
-                          struct drm_framebuffer *old_fb)
+static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y,
+                              struct drm_framebuffer *old_fb)
 {
        struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
        struct drm_device *dev = crtc->dev;
@@ -706,6 +749,42 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
        return 0;
 }
 
+int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
+                          struct drm_framebuffer *old_fb)
+{
+       struct drm_device *dev = crtc->dev;
+       struct radeon_device *rdev = dev->dev_private;
+
+       if (ASIC_IS_AVIVO(rdev))
+               return avivo_crtc_set_base(crtc, x, y, old_fb);
+       else
+               return radeon_crtc_set_base(crtc, x, y, old_fb);
+}
+
+/* properly set additional regs when using atombios */
+static void radeon_legacy_atom_fixup(struct drm_crtc *crtc)
+{
+       struct drm_device *dev = crtc->dev;
+       struct radeon_device *rdev = dev->dev_private;
+       struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+       u32 disp_merge_cntl;
+
+       switch (radeon_crtc->crtc_id) {
+       case 0:
+               disp_merge_cntl = RREG32(RADEON_DISP_MERGE_CNTL);
+               disp_merge_cntl &= ~RADEON_DISP_RGB_OFFSET_EN;
+               WREG32(RADEON_DISP_MERGE_CNTL, disp_merge_cntl);
+               break;
+       case 1:
+               disp_merge_cntl = RREG32(RADEON_DISP2_MERGE_CNTL);
+               disp_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN;
+               WREG32(RADEON_DISP2_MERGE_CNTL, disp_merge_cntl);
+               WREG32(RADEON_FP_H2_SYNC_STRT_WID,   RREG32(RADEON_CRTC2_H_SYNC_STRT_WID));
+               WREG32(RADEON_FP_V2_SYNC_STRT_WID,   RREG32(RADEON_CRTC2_V_SYNC_STRT_WID));
+               break;
+       }
+}
+
 int atombios_crtc_mode_set(struct drm_crtc *crtc,
                           struct drm_display_mode *mode,
                           struct drm_display_mode *adjusted_mode,
@@ -727,8 +806,8 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc,
        else {
                if (radeon_crtc->crtc_id == 0)
                        atombios_set_crtc_dtd_timing(crtc, adjusted_mode);
-               radeon_crtc_set_base(crtc, x, y, old_fb);
-               radeon_legacy_atom_set_surface(crtc);
+               atombios_crtc_set_base(crtc, x, y, old_fb);
+               radeon_legacy_atom_fixup(crtc);
        }
        atombios_overscan_setup(crtc, mode, adjusted_mode);
        atombios_scaler_setup(crtc);
@@ -746,8 +825,8 @@ static bool atombios_crtc_mode_fixup(struct drm_crtc *crtc,
 
 static void atombios_crtc_prepare(struct drm_crtc *crtc)
 {
-       atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
        atombios_lock_crtc(crtc, 1);
+       atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
 }
 
 static void atombios_crtc_commit(struct drm_crtc *crtc)
index 3eb0ca5b3d73406d84c070e5bf9376dd4a1c5fa9..99915a682d593deb4b4aabaf2cd81fd902bc9103 100644 (file)
@@ -332,11 +332,13 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
        PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION args;
        int index = GetIndexIntoMasterTable(COMMAND, ProcessAuxChannelTransaction);
        unsigned char *base;
+       int retry_count = 0;
 
        memset(&args, 0, sizeof(args));
 
        base = (unsigned char *)rdev->mode_info.atom_context->scratch;
 
+retry:
        memcpy(base, req_bytes, num_bytes);
 
        args.lpAuxRequest = 0;
@@ -347,10 +349,12 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
 
        atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 
-       if (args.ucReplyStatus) {
-               DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x\n",
+       if (args.ucReplyStatus && !args.ucDataOutLen) {
+               if (args.ucReplyStatus == 0x20 && retry_count++ < 10)
+                       goto retry;
+               DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x after %d retries\n",
                          req_bytes[1], req_bytes[0], req_bytes[2], req_bytes[3],
-                         chan->rec.i2c_id, args.ucReplyStatus);
+                         chan->rec.i2c_id, args.ucReplyStatus, retry_count);
                return false;
        }
 
@@ -468,7 +472,7 @@ void radeon_dp_set_link_config(struct drm_connector *connector,
        struct radeon_connector *radeon_connector;
        struct radeon_connector_atom_dig *dig_connector;
 
-       if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) ||
+       if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) &&
            (connector->connector_type != DRM_MODE_CONNECTOR_eDP))
                return;
 
@@ -583,7 +587,7 @@ void dp_link_train(struct drm_encoder *encoder,
        u8 train_set[4];
        int i;
 
-       if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) ||
+       if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) &&
            (connector->connector_type != DRM_MODE_CONNECTOR_eDP))
                return;
 
@@ -596,21 +600,14 @@ void dp_link_train(struct drm_encoder *encoder,
                return;
        dig_connector = radeon_connector->con_priv;
 
-       if (ASIC_IS_DCE32(rdev)) {
-               if (dig->dig_block)
-                       enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER;
-               else
-                       enc_id |= ATOM_DP_CONFIG_DIG1_ENCODER;
-               if (dig_connector->linkb)
-                       enc_id |= ATOM_DP_CONFIG_LINK_B;
-               else
-                       enc_id |= ATOM_DP_CONFIG_LINK_A;
-       } else {
-               if (dig_connector->linkb)
-                       enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER | ATOM_DP_CONFIG_LINK_B;
-               else
-                       enc_id |= ATOM_DP_CONFIG_DIG1_ENCODER | ATOM_DP_CONFIG_LINK_A;
-       }
+       if (dig->dig_encoder)
+               enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER;
+       else
+               enc_id |= ATOM_DP_CONFIG_DIG1_ENCODER;
+       if (dig_connector->linkb)
+               enc_id |= ATOM_DP_CONFIG_LINK_B;
+       else
+               enc_id |= ATOM_DP_CONFIG_LINK_A;
 
        memset(link_configuration, 0, DP_LINK_CONFIGURATION_SIZE);
        if (dig_connector->dp_clock == 270000)
index 8760d66e058a6b60b873fab99f3bdb34efd4f0ea..c0d4650cdb794103a3fa7fe79d0a43c4806713c9 100644 (file)
@@ -354,11 +354,17 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
                return RREG32(RADEON_CRTC2_CRNT_FRAME);
 }
 
+/* Who ever call radeon_fence_emit should call ring_lock and ask
+ * for enough space (today caller are ib schedule and buffer move) */
 void r100_fence_ring_emit(struct radeon_device *rdev,
                          struct radeon_fence *fence)
 {
-       /* Who ever call radeon_fence_emit should call ring_lock and ask
-        * for enough space (today caller are ib schedule and buffer move) */
+       /* We have to make sure that caches are flushed before
+        * CPU might read something from VRAM. */
+       radeon_ring_write(rdev, PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0));
+       radeon_ring_write(rdev, RADEON_RB3D_DC_FLUSH_ALL);
+       radeon_ring_write(rdev, PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0));
+       radeon_ring_write(rdev, RADEON_RB3D_ZC_FLUSH_ALL);
        /* Wait until IDLE & CLEAN */
        radeon_ring_write(rdev, PACKET0(0x1720, 0));
        radeon_ring_write(rdev, (1 << 16) | (1 << 17));
@@ -1504,6 +1510,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
                        DRM_ERROR("PRIM_WALK must be 3 for IMMD draw\n");
                        return -EINVAL;
                }
+               track->vtx_size = r100_get_vtx_size(radeon_get_ib_value(p, idx + 0));
                track->vap_vf_cntl = radeon_get_ib_value(p, idx + 1);
                track->immd_dwords = pkt->count - 1;
                r = r100_cs_track_check(p->rdev, track);
@@ -3368,7 +3375,6 @@ int r100_suspend(struct radeon_device *rdev)
 
 void r100_fini(struct radeon_device *rdev)
 {
-       r100_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -3399,9 +3405,7 @@ int r100_mc_init(struct radeon_device *rdev)
        if (rdev->flags & RADEON_IS_AGP) {
                r = radeon_agp_init(rdev);
                if (r) {
-                       printk(KERN_WARNING "[drm] Disabling AGP\n");
-                       rdev->flags &= ~RADEON_IS_AGP;
-                       rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
+                       radeon_agp_disable(rdev);
                } else {
                        rdev->mc.gtt_location = rdev->mc.agp_base;
                }
@@ -3482,13 +3486,12 @@ int r100_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               r100_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                if (rdev->flags & RADEON_IS_PCI)
                        r100_pci_gart_fini(rdev);
-               radeon_irq_kms_fini(rdev);
                rdev->accel_working = false;
        }
        return 0;
index 20942127c46b216861d2b1d29c7a45e5c549b66c..ff1e0cd608bf11d23981511f017782b4fa383be8 100644 (file)
@@ -371,13 +371,16 @@ int r200_packet0_check(struct radeon_cs_parser *p,
                case 5:
                case 6:
                case 7:
+                       /* 1D/2D */
                        track->textures[i].tex_coord_type = 0;
                        break;
                case 1:
-                       track->textures[i].tex_coord_type = 1;
+                       /* CUBE */
+                       track->textures[i].tex_coord_type = 2;
                        break;
                case 2:
-                       track->textures[i].tex_coord_type = 2;
+                       /* 3D */
+                       track->textures[i].tex_coord_type = 1;
                        break;
                }
                break;
index 0051d11b907c162e011e8ed7795507f4ca0e610f..43b55a030b4d5c35ec86e3b79cb86e01314ee67e 100644 (file)
@@ -506,11 +506,14 @@ void r300_vram_info(struct radeon_device *rdev)
 
        /* DDR for all card after R300 & IGP */
        rdev->mc.vram_is_ddr = true;
+
        tmp = RREG32(RADEON_MEM_CNTL);
-       if (tmp & R300_MEM_NUM_CHANNELS_MASK) {
-               rdev->mc.vram_width = 128;
-       } else {
-               rdev->mc.vram_width = 64;
+       tmp &= R300_MEM_NUM_CHANNELS_MASK;
+       switch (tmp) {
+       case 0: rdev->mc.vram_width = 64; break;
+       case 1: rdev->mc.vram_width = 128; break;
+       case 2: rdev->mc.vram_width = 256; break;
+       default:  rdev->mc.vram_width = 128; break;
        }
 
        r100_vram_init_sizes(rdev);
@@ -1327,7 +1330,6 @@ int r300_suspend(struct radeon_device *rdev)
 
 void r300_fini(struct radeon_device *rdev)
 {
-       r300_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -1418,15 +1420,15 @@ int r300_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               r300_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                if (rdev->flags & RADEON_IS_PCIE)
                        rv370_pcie_gart_fini(rdev);
                if (rdev->flags & RADEON_IS_PCI)
                        r100_pci_gart_fini(rdev);
-               radeon_irq_kms_fini(rdev);
+               radeon_agp_fini(rdev);
                rdev->accel_working = false;
        }
        return 0;
index 053404e71a9d74bc0b293decf78240bc972f9547..d9373246c97f523513ee4a844ea3cb957b497944 100644 (file)
@@ -50,9 +50,7 @@ int r420_mc_init(struct radeon_device *rdev)
        if (rdev->flags & RADEON_IS_AGP) {
                r = radeon_agp_init(rdev);
                if (r) {
-                       printk(KERN_WARNING "[drm] Disabling AGP\n");
-                       rdev->flags &= ~RADEON_IS_AGP;
-                       rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
+                       radeon_agp_disable(rdev);
                } else {
                        rdev->mc.gtt_location = rdev->mc.agp_base;
                }
@@ -391,16 +389,15 @@ int r420_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               r420_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                if (rdev->flags & RADEON_IS_PCIE)
                        rv370_pcie_gart_fini(rdev);
                if (rdev->flags & RADEON_IS_PCI)
                        r100_pci_gart_fini(rdev);
                radeon_agp_fini(rdev);
-               radeon_irq_kms_fini(rdev);
                rdev->accel_working = false;
        }
        return 0;
index 9a189072f2b93e09299ff63b1464d32e260ba657..ddf5731eba0d8f294294a7a3bc4674ce2040a52e 100644 (file)
@@ -294,13 +294,12 @@ int r520_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               rv515_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                rv370_pcie_gart_fini(rdev);
                radeon_agp_fini(rdev);
-               radeon_irq_kms_fini(rdev);
                rdev->accel_working = false;
        }
        return 0;
index c0651991c3e41ab7dd54ef77a464b7ff8cb889c6..2ffcf5a03551e94b5fdbc32d3dca1eeae8c9ba67 100644 (file)
@@ -624,7 +624,6 @@ int r600_mc_init(struct radeon_device *rdev)
        fixed20_12 a;
        u32 tmp;
        int chansize, numchan;
-       int r;
 
        /* Get VRAM informations */
        rdev->mc.vram_is_ddr = true;
@@ -667,9 +666,6 @@ int r600_mc_init(struct radeon_device *rdev)
                rdev->mc.real_vram_size = rdev->mc.aper_size;
 
        if (rdev->flags & RADEON_IS_AGP) {
-               r = radeon_agp_init(rdev);
-               if (r)
-                       return r;
                /* gtt_size is setup by radeon_agp_init */
                rdev->mc.gtt_location = rdev->mc.agp_base;
                tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
@@ -1658,6 +1654,12 @@ void r600_ring_init(struct radeon_device *rdev, unsigned ring_size)
        rdev->cp.align_mask = 16 - 1;
 }
 
+void r600_cp_fini(struct radeon_device *rdev)
+{
+       r600_cp_stop(rdev);
+       radeon_ring_fini(rdev);
+}
+
 
 /*
  * GPU scratch registers helpers function.
@@ -1792,23 +1794,24 @@ void r600_fence_ring_emit(struct radeon_device *rdev,
        radeon_ring_write(rdev, RB_INT_STAT);
 }
 
-int r600_copy_dma(struct radeon_device *rdev,
-                 uint64_t src_offset,
-                 uint64_t dst_offset,
-                 unsigned num_pages,
-                 struct radeon_fence *fence)
-{
-       /* FIXME: implement */
-       return 0;
-}
-
 int r600_copy_blit(struct radeon_device *rdev,
                   uint64_t src_offset, uint64_t dst_offset,
                   unsigned num_pages, struct radeon_fence *fence)
 {
-       r600_blit_prepare_copy(rdev, num_pages * RADEON_GPU_PAGE_SIZE);
+       int r;
+
+       mutex_lock(&rdev->r600_blit.mutex);
+       rdev->r600_blit.vb_ib = NULL;
+       r = r600_blit_prepare_copy(rdev, num_pages * RADEON_GPU_PAGE_SIZE);
+       if (r) {
+               if (rdev->r600_blit.vb_ib)
+                       radeon_ib_free(rdev, &rdev->r600_blit.vb_ib);
+               mutex_unlock(&rdev->r600_blit.mutex);
+               return r;
+       }
        r600_kms_blit_copy(rdev, src_offset, dst_offset, num_pages * RADEON_GPU_PAGE_SIZE);
        r600_blit_done_copy(rdev, fence);
+       mutex_unlock(&rdev->r600_blit.mutex);
        return 0;
 }
 
@@ -1864,26 +1867,25 @@ int r600_startup(struct radeon_device *rdev)
                        return r;
        }
        r600_gpu_init(rdev);
-
-       if (!rdev->r600_blit.shader_obj) {
-               r = r600_blit_init(rdev);
+       r = r600_blit_init(rdev);
+       if (r) {
+               r600_blit_fini(rdev);
+               rdev->asic->copy = NULL;
+               dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
+       }
+       /* pin copy shader into vram */
+       if (rdev->r600_blit.shader_obj) {
+               r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
+               if (unlikely(r != 0))
+                       return r;
+               r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
+                               &rdev->r600_blit.shader_gpu_addr);
+               radeon_bo_unreserve(rdev->r600_blit.shader_obj);
                if (r) {
-                       DRM_ERROR("radeon: failed blitter (%d).\n", r);
+                       dev_err(rdev->dev, "(%d) pin blit object failed\n", r);
                        return r;
                }
        }
-
-       r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
-       if (unlikely(r != 0))
-               return r;
-       r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
-                       &rdev->r600_blit.shader_gpu_addr);
-       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
-       if (r) {
-               dev_err(rdev->dev, "(%d) pin blit object failed\n", r);
-               return r;
-       }
-
        /* Enable IRQ */
        r = r600_irq_init(rdev);
        if (r) {
@@ -1948,6 +1950,13 @@ int r600_resume(struct radeon_device *rdev)
                DRM_ERROR("radeon: failled testing IB (%d).\n", r);
                return r;
        }
+
+       r = r600_audio_init(rdev);
+       if (r) {
+               DRM_ERROR("radeon: audio resume failed\n");
+               return r;
+       }
+
        return r;
 }
 
@@ -1955,17 +1964,21 @@ int r600_suspend(struct radeon_device *rdev)
 {
        int r;
 
+       r600_audio_fini(rdev);
        /* FIXME: we should wait for ring to be empty */
        r600_cp_stop(rdev);
        rdev->cp.ready = false;
+       r600_irq_suspend(rdev);
        r600_wb_disable(rdev);
        r600_pcie_gart_disable(rdev);
        /* unpin shaders bo */
-       r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
-       if (unlikely(r != 0))
-               return r;
-       radeon_bo_unpin(rdev->r600_blit.shader_obj);
-       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
+       if (rdev->r600_blit.shader_obj) {
+               r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
+               if (!r) {
+                       radeon_bo_unpin(rdev->r600_blit.shader_obj);
+                       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
+               }
+       }
        return 0;
 }
 
@@ -2026,6 +2039,11 @@ int r600_init(struct radeon_device *rdev)
        r = radeon_fence_driver_init(rdev);
        if (r)
                return r;
+       if (rdev->flags & RADEON_IS_AGP) {
+               r = radeon_agp_init(rdev);
+               if (r)
+                       radeon_agp_disable(rdev);
+       }
        r = r600_mc_init(rdev);
        if (r)
                return r;
@@ -2051,22 +2069,25 @@ int r600_init(struct radeon_device *rdev)
        rdev->accel_working = true;
        r = r600_startup(rdev);
        if (r) {
-               r600_suspend(rdev);
+               dev_err(rdev->dev, "disabling GPU acceleration\n");
+               r600_cp_fini(rdev);
                r600_wb_fini(rdev);
-               radeon_ring_fini(rdev);
+               r600_irq_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                r600_pcie_gart_fini(rdev);
                rdev->accel_working = false;
        }
        if (rdev->accel_working) {
                r = radeon_ib_pool_init(rdev);
                if (r) {
-                       DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r);
-                       rdev->accel_working = false;
-               }
-               r = r600_ib_test(rdev);
-               if (r) {
-                       DRM_ERROR("radeon: failed testing IB (%d).\n", r);
+                       dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
                        rdev->accel_working = false;
+               } else {
+                       r = r600_ib_test(rdev);
+                       if (r) {
+                               dev_err(rdev->dev, "IB test failed (%d).\n", r);
+                               rdev->accel_working = false;
+                       }
                }
        }
 
@@ -2078,20 +2099,17 @@ int r600_init(struct radeon_device *rdev)
 
 void r600_fini(struct radeon_device *rdev)
 {
-       /* Suspend operations */
-       r600_suspend(rdev);
-
        r600_audio_fini(rdev);
        r600_blit_fini(rdev);
+       r600_cp_fini(rdev);
+       r600_wb_fini(rdev);
        r600_irq_fini(rdev);
        radeon_irq_kms_fini(rdev);
-       radeon_ring_fini(rdev);
-       r600_wb_fini(rdev);
        r600_pcie_gart_fini(rdev);
+       radeon_agp_fini(rdev);
        radeon_gem_fini(rdev);
        radeon_fence_driver_fini(rdev);
        radeon_clocks_fini(rdev);
-       radeon_agp_fini(rdev);
        radeon_bo_fini(rdev);
        radeon_atombios_fini(rdev);
        kfree(rdev->bios);
@@ -2197,14 +2215,14 @@ void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size)
        rb_bufsz = drm_order(ring_size / 4);
        ring_size = (1 << rb_bufsz) * 4;
        rdev->ih.ring_size = ring_size;
-       rdev->ih.align_mask = 4 - 1;
+       rdev->ih.ptr_mask = rdev->ih.ring_size - 1;
+       rdev->ih.rptr = 0;
 }
 
-static int r600_ih_ring_alloc(struct radeon_device *rdev, unsigned ring_size)
+static int r600_ih_ring_alloc(struct radeon_device *rdev)
 {
        int r;
 
-       rdev->ih.ring_size = ring_size;
        /* Allocate ring buffer */
        if (rdev->ih.ring_obj == NULL) {
                r = radeon_bo_create(rdev, NULL, rdev->ih.ring_size,
@@ -2234,9 +2252,6 @@ static int r600_ih_ring_alloc(struct radeon_device *rdev, unsigned ring_size)
                        return r;
                }
        }
-       rdev->ih.ptr_mask = (rdev->cp.ring_size / 4) - 1;
-       rdev->ih.rptr = 0;
-
        return 0;
 }
 
@@ -2386,7 +2401,7 @@ int r600_irq_init(struct radeon_device *rdev)
        u32 interrupt_cntl, ih_cntl, ih_rb_cntl;
 
        /* allocate ring */
-       ret = r600_ih_ring_alloc(rdev, rdev->ih.ring_size);
+       ret = r600_ih_ring_alloc(rdev);
        if (ret)
                return ret;
 
@@ -2449,10 +2464,15 @@ int r600_irq_init(struct radeon_device *rdev)
        return ret;
 }
 
-void r600_irq_fini(struct radeon_device *rdev)
+void r600_irq_suspend(struct radeon_device *rdev)
 {
        r600_disable_interrupts(rdev);
        r600_rlc_stop(rdev);
+}
+
+void r600_irq_fini(struct radeon_device *rdev)
+{
+       r600_irq_suspend(rdev);
        r600_ih_ring_fini(rdev);
 }
 
@@ -2467,8 +2487,12 @@ int r600_irq_set(struct radeon_device *rdev)
                return -EINVAL;
        }
        /* don't enable anything if the ih is disabled */
-       if (!rdev->ih.enabled)
+       if (!rdev->ih.enabled) {
+               r600_disable_interrupts(rdev);
+               /* force the active interrupt state to all disabled */
+               r600_disable_interrupt_state(rdev);
                return 0;
+       }
 
        if (ASIC_IS_DCE3(rdev)) {
                hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN;
@@ -2638,16 +2662,18 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev)
        wptr = RREG32(IH_RB_WPTR);
 
        if (wptr & RB_OVERFLOW) {
-               WARN_ON(1);
-               /* XXX deal with overflow */
-               DRM_ERROR("IH RB overflow\n");
+               /* When a ring buffer overflow happen start parsing interrupt
+                * from the last not overwritten vector (wptr + 16). Hopefully
+                * this should allow us to catchup.
+                */
+               dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n",
+                       wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask);
+               rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask;
                tmp = RREG32(IH_RB_CNTL);
                tmp |= IH_WPTR_OVERFLOW_CLEAR;
                WREG32(IH_RB_CNTL, tmp);
        }
-       wptr = wptr & WPTR_OFFSET_MASK;
-
-       return wptr;
+       return (wptr & rdev->ih.ptr_mask);
 }
 
 /*        r600 IV Ring
@@ -2683,12 +2709,13 @@ int r600_irq_process(struct radeon_device *rdev)
        u32 wptr = r600_get_ih_wptr(rdev);
        u32 rptr = rdev->ih.rptr;
        u32 src_id, src_data;
-       u32 last_entry = rdev->ih.ring_size - 16;
        u32 ring_index, disp_int, disp_int_cont, disp_int_cont2;
        unsigned long flags;
        bool queue_hotplug = false;
 
        DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
+       if (!rdev->ih.enabled)
+               return IRQ_NONE;
 
        spin_lock_irqsave(&rdev->ih.lock, flags);
 
@@ -2729,7 +2756,7 @@ restart_ih:
                                }
                                break;
                        default:
-                               DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data);
+                               DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data);
                                break;
                        }
                        break;
@@ -2749,7 +2776,7 @@ restart_ih:
                                }
                                break;
                        default:
-                               DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data);
+                               DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data);
                                break;
                        }
                        break;
@@ -2798,7 +2825,7 @@ restart_ih:
                                }
                                break;
                        default:
-                               DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data);
+                               DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data);
                                break;
                        }
                        break;
@@ -2812,15 +2839,13 @@ restart_ih:
                        DRM_DEBUG("IH: CP EOP\n");
                        break;
                default:
-                       DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data);
+                       DRM_DEBUG("Unhandled interrupt: %d %d\n", src_id, src_data);
                        break;
                }
 
                /* wptr/rptr are in bytes! */
-               if (rptr == last_entry)
-                       rptr = 0;
-               else
-                       rptr += 16;
+               rptr += 16;
+               rptr &= rdev->ih.ptr_mask;
        }
        /* make sure wptr hasn't changed while processing */
        wptr = r600_get_ih_wptr(rdev);
@@ -2888,3 +2913,18 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
        return 0;
 #endif
 }
+
+/**
+ * r600_ioctl_wait_idle - flush host path cache on wait idle ioctl
+ * rdev: radeon device structure
+ * bo: buffer object struct which userspace is waiting for idle
+ *
+ * Some R6XX/R7XX doesn't seems to take into account HDP flush performed
+ * through ring buffer, this leads to corruption in rendering, see
+ * http://bugzilla.kernel.org/show_bug.cgi?id=15186 to avoid this we
+ * directly perform HDP flush by writing register through MMIO.
+ */
+void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
+{
+       WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
+}
index 99e2c3891a7dea017c681f136b52e15dfda2ec6c..0dcb6904c4ff930bbaaa4bc81e2da930ecdc6af8 100644 (file)
@@ -35,7 +35,7 @@
  */
 static int r600_audio_chipset_supported(struct radeon_device *rdev)
 {
-       return rdev->family >= CHIP_R600
+       return (rdev->family >= CHIP_R600 && rdev->family < CHIP_RV710)
                || rdev->family == CHIP_RS600
                || rdev->family == CHIP_RS690
                || rdev->family == CHIP_RS740;
@@ -261,7 +261,6 @@ void r600_audio_fini(struct radeon_device *rdev)
        if (!r600_audio_chipset_supported(rdev))
                return;
 
-       WREG32_P(R600_AUDIO_ENABLE, 0x0, ~0x81000000);
-
        del_timer(&rdev->audio_timer);
+       WREG32_P(R600_AUDIO_ENABLE, 0x0, ~0x81000000);
 }
index 8787ea89dc6e0437acf493a48ae93d7e75fce8cc..446b765ac72a5338678a15124bdab152693dedc9 100644 (file)
@@ -449,6 +449,7 @@ int r600_blit_init(struct radeon_device *rdev)
        u32 packet2s[16];
        int num_packet2s = 0;
 
+       mutex_init(&rdev->r600_blit.mutex);
        rdev->r600_blit.state_offset = 0;
 
        if (rdev->family >= CHIP_RV770)
@@ -512,14 +513,16 @@ void r600_blit_fini(struct radeon_device *rdev)
 {
        int r;
 
+       if (rdev->r600_blit.shader_obj == NULL)
+               return;
+       /* If we can't reserve the bo, unref should be enough to destroy
+        * it when it becomes idle.
+        */
        r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
-       if (unlikely(r != 0)) {
-               dev_err(rdev->dev, "(%d) can't finish r600 blit\n", r);
-               goto out_unref;
+       if (!r) {
+               radeon_bo_unpin(rdev->r600_blit.shader_obj);
+               radeon_bo_unreserve(rdev->r600_blit.shader_obj);
        }
-       radeon_bo_unpin(rdev->r600_blit.shader_obj);
-       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
-out_unref:
        radeon_bo_unref(&rdev->r600_blit.shader_obj);
 }
 
@@ -540,9 +543,6 @@ int r600_vb_ib_get(struct radeon_device *rdev)
 void r600_vb_ib_put(struct radeon_device *rdev)
 {
        radeon_fence_emit(rdev, rdev->r600_blit.vb_ib->fence);
-       mutex_lock(&rdev->ib_pool.mutex);
-       list_add_tail(&rdev->r600_blit.vb_ib->list, &rdev->ib_pool.scheduled_ibs);
-       mutex_unlock(&rdev->ib_pool.mutex);
        radeon_ib_free(rdev, &rdev->r600_blit.vb_ib);
 }
 
@@ -555,7 +555,8 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
        int dwords_per_loop = 76, num_loops;
 
        r = r600_vb_ib_get(rdev);
-       WARN_ON(r);
+       if (r)
+               return r;
 
        /* set_render_target emits 2 extra dwords on rv6xx */
        if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770)
@@ -581,7 +582,8 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
        ring_size += 5; /* done copy */
        ring_size += 7; /* fence emit for done copy */
        r = radeon_ring_lock(rdev, ring_size);
-       WARN_ON(r);
+       if (r)
+               return r;
 
        set_default_state(rdev); /* 14 */
        set_shaders(rdev); /* 26 */
index 6d5a711c2e91c63818c5a86ca1a6e4e194b418ff..75bcf35a09312437f0df3c77ffb51e2548218aa8 100644 (file)
@@ -1428,9 +1428,12 @@ static void r700_gfx_init(struct drm_device *dev,
 
        gb_tiling_config |= R600_BANK_SWAPS(1);
 
-       backend_map = r700_get_tile_pipe_to_backend_map(dev_priv->r600_max_tile_pipes,
-                                                       dev_priv->r600_max_backends,
-                                                       (0xff << dev_priv->r600_max_backends) & 0xff);
+       if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV740)
+               backend_map = 0x28;
+       else
+               backend_map = r700_get_tile_pipe_to_backend_map(dev_priv->r600_max_tile_pipes,
+                                                               dev_priv->r600_max_backends,
+                                                               (0xff << dev_priv->r600_max_backends) & 0xff);
        gb_tiling_config |= R600_BACKEND_MAP(backend_map);
 
        cc_gc_shader_pipe_config =
index 44060b92d9e6df4e464a9c91dce2f16e2245b4af..e4c45ec16507fce420811d8b498218c00084034a 100644 (file)
@@ -36,6 +36,10 @@ static int r600_cs_packet_next_reloc_nomm(struct radeon_cs_parser *p,
 typedef int (*next_reloc_t)(struct radeon_cs_parser*, struct radeon_cs_reloc**);
 static next_reloc_t r600_cs_packet_next_reloc = &r600_cs_packet_next_reloc_mm;
 
+struct r600_cs_track {
+       u32     cb_color0_base_last;
+};
+
 /**
  * r600_cs_packet_parse() - parse cp packet and point ib index to next packet
  * @parser:    parser structure holding parsing context.
@@ -176,6 +180,28 @@ static int r600_cs_packet_next_reloc_nomm(struct radeon_cs_parser *p,
        return 0;
 }
 
+/**
+ * r600_cs_packet_next_is_pkt3_nop() - test if next packet is packet3 nop for reloc
+ * @parser:            parser structure holding parsing context.
+ *
+ * Check next packet is relocation packet3, do bo validation and compute
+ * GPU offset using the provided start.
+ **/
+static inline int r600_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
+{
+       struct radeon_cs_packet p3reloc;
+       int r;
+
+       r = r600_cs_packet_parse(p, &p3reloc, p->idx);
+       if (r) {
+               return 0;
+       }
+       if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) {
+               return 0;
+       }
+       return 1;
+}
+
 /**
  * r600_cs_packet_next_vline() - parse userspace VLINE packet
  * @parser:            parser structure holding parsing context.
@@ -337,6 +363,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
                                struct radeon_cs_packet *pkt)
 {
        struct radeon_cs_reloc *reloc;
+       struct r600_cs_track *track;
        volatile u32 *ib;
        unsigned idx;
        unsigned i;
@@ -344,6 +371,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
        int r;
        u32 idx_value;
 
+       track = (struct r600_cs_track *)p->track;
        ib = p->ib->ptr;
        idx = pkt->idx + 1;
        idx_value = radeon_get_ib_value(p, idx);
@@ -503,9 +531,60 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
                for (i = 0; i < pkt->count; i++) {
                        reg = start_reg + (4 * i);
                        switch (reg) {
+                       /* This register were added late, there is userspace
+                        * which does provide relocation for those but set
+                        * 0 offset. In order to avoid breaking old userspace
+                        * we detect this and set address to point to last
+                        * CB_COLOR0_BASE, note that if userspace doesn't set
+                        * CB_COLOR0_BASE before this register we will report
+                        * error. Old userspace always set CB_COLOR0_BASE
+                        * before any of this.
+                        */
+                       case R_0280E0_CB_COLOR0_FRAG:
+                       case R_0280E4_CB_COLOR1_FRAG:
+                       case R_0280E8_CB_COLOR2_FRAG:
+                       case R_0280EC_CB_COLOR3_FRAG:
+                       case R_0280F0_CB_COLOR4_FRAG:
+                       case R_0280F4_CB_COLOR5_FRAG:
+                       case R_0280F8_CB_COLOR6_FRAG:
+                       case R_0280FC_CB_COLOR7_FRAG:
+                       case R_0280C0_CB_COLOR0_TILE:
+                       case R_0280C4_CB_COLOR1_TILE:
+                       case R_0280C8_CB_COLOR2_TILE:
+                       case R_0280CC_CB_COLOR3_TILE:
+                       case R_0280D0_CB_COLOR4_TILE:
+                       case R_0280D4_CB_COLOR5_TILE:
+                       case R_0280D8_CB_COLOR6_TILE:
+                       case R_0280DC_CB_COLOR7_TILE:
+                               if (!r600_cs_packet_next_is_pkt3_nop(p)) {
+                                       if (!track->cb_color0_base_last) {
+                                               dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg);
+                                               return -EINVAL;
+                                       }
+                                       ib[idx+1+i] = track->cb_color0_base_last;
+                                       printk_once(KERN_WARNING "radeon: You have old & broken userspace "
+                                               "please consider updating mesa & xf86-video-ati\n");
+                               } else {
+                                       r = r600_cs_packet_next_reloc(p, &reloc);
+                                       if (r) {
+                                               dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg);
+                                               return -EINVAL;
+                                       }
+                                       ib[idx+1+i] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
+                               }
+                               break;
                        case DB_DEPTH_BASE:
                        case DB_HTILE_DATA_BASE:
                        case CB_COLOR0_BASE:
+                               r = r600_cs_packet_next_reloc(p, &reloc);
+                               if (r) {
+                                       DRM_ERROR("bad SET_CONTEXT_REG "
+                                                       "0x%04X\n", reg);
+                                       return -EINVAL;
+                               }
+                               ib[idx+1+i] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
+                               track->cb_color0_base_last = ib[idx+1+i];
+                               break;
                        case CB_COLOR1_BASE:
                        case CB_COLOR2_BASE:
                        case CB_COLOR3_BASE:
@@ -678,8 +757,11 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
 int r600_cs_parse(struct radeon_cs_parser *p)
 {
        struct radeon_cs_packet pkt;
+       struct r600_cs_track *track;
        int r;
 
+       track = kzalloc(sizeof(*track), GFP_KERNEL);
+       p->track = track;
        do {
                r = r600_cs_packet_parse(p, &pkt, p->idx);
                if (r) {
@@ -757,6 +839,7 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
        /* initialize parser */
        memset(&parser, 0, sizeof(struct radeon_cs_parser));
        parser.filp = filp;
+       parser.dev = &dev->pdev->dev;
        parser.rdev = NULL;
        parser.family = family;
        parser.ib = &fake_ib;
index 05894edadab46c81d76d235c415ef7e22df57d9e..30480881aed18e62e5033a3d7c06832b321f2993 100644 (file)
 #define                S_000E60_SOFT_RESET_VMC(x)              (((x) & 1) << 17)
 
 #define R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL          0x5480
+
+#define R_0280E0_CB_COLOR0_FRAG                      0x0280E0
+#define   S_0280E0_BASE_256B(x)                        (((x) & 0xFFFFFFFF) << 0)
+#define   G_0280E0_BASE_256B(x)                        (((x) >> 0) & 0xFFFFFFFF)
+#define   C_0280E0_BASE_256B                           0x00000000
+#define R_0280E4_CB_COLOR1_FRAG                      0x0280E4
+#define R_0280E8_CB_COLOR2_FRAG                      0x0280E8
+#define R_0280EC_CB_COLOR3_FRAG                      0x0280EC
+#define R_0280F0_CB_COLOR4_FRAG                      0x0280F0
+#define R_0280F4_CB_COLOR5_FRAG                      0x0280F4
+#define R_0280F8_CB_COLOR6_FRAG                      0x0280F8
+#define R_0280FC_CB_COLOR7_FRAG                      0x0280FC
+#define R_0280C0_CB_COLOR0_TILE                      0x0280C0
+#define   S_0280C0_BASE_256B(x)                        (((x) & 0xFFFFFFFF) << 0)
+#define   G_0280C0_BASE_256B(x)                        (((x) >> 0) & 0xFFFFFFFF)
+#define   C_0280C0_BASE_256B                           0x00000000
+#define R_0280C4_CB_COLOR1_TILE                      0x0280C4
+#define R_0280C8_CB_COLOR2_TILE                      0x0280C8
+#define R_0280CC_CB_COLOR3_TILE                      0x0280CC
+#define R_0280D0_CB_COLOR4_TILE                      0x0280D0
+#define R_0280D4_CB_COLOR5_TILE                      0x0280D4
+#define R_0280D8_CB_COLOR6_TILE                      0x0280D8
+#define R_0280DC_CB_COLOR7_TILE                      0x0280DC
+
+
 #endif
index eb5f99b9469debb3941cbc2b1aa91c35283cab9c..c0356bb193e57f39ef602ad50c6af607b056c15a 100644 (file)
@@ -96,6 +96,7 @@ extern int radeon_audio;
  * symbol;
  */
 #define RADEON_MAX_USEC_TIMEOUT                100000  /* 100 ms */
+/* RADEON_IB_POOL_SIZE must be a power of 2 */
 #define RADEON_IB_POOL_SIZE            16
 #define RADEON_DEBUGFS_MAX_NUM_FILES   32
 #define RADEONFB_CONN_LIMIT            4
@@ -363,11 +364,12 @@ void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev);
  */
 struct radeon_ib {
        struct list_head        list;
-       unsigned long           idx;
+       unsigned                idx;
        uint64_t                gpu_addr;
        struct radeon_fence     *fence;
-       uint32_t        *ptr;
+       uint32_t                *ptr;
        uint32_t                length_dw;
+       bool                    free;
 };
 
 /*
@@ -377,10 +379,9 @@ struct radeon_ib {
 struct radeon_ib_pool {
        struct mutex            mutex;
        struct radeon_bo        *robj;
-       struct list_head        scheduled_ibs;
        struct radeon_ib        ibs[RADEON_IB_POOL_SIZE];
        bool                    ready;
-       DECLARE_BITMAP(alloc_bm, RADEON_IB_POOL_SIZE);
+       unsigned                head_id;
 };
 
 struct radeon_cp {
@@ -410,13 +411,13 @@ struct r600_ih {
        unsigned                wptr_old;
        unsigned                ring_size;
        uint64_t                gpu_addr;
-       uint32_t                align_mask;
        uint32_t                ptr_mask;
        spinlock_t              lock;
        bool                    enabled;
 };
 
 struct r600_blit {
+       struct mutex            mutex;
        struct radeon_bo        *shader_obj;
        u64 shader_gpu_addr;
        u32 vs_offset, ps_offset;
@@ -465,6 +466,7 @@ struct radeon_cs_chunk {
 };
 
 struct radeon_cs_parser {
+       struct device           *dev;
        struct radeon_device    *rdev;
        struct drm_file         *filp;
        /* chunks */
@@ -660,6 +662,13 @@ struct radeon_asic {
        void (*hpd_fini)(struct radeon_device *rdev);
        bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
        void (*hpd_set_polarity)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
+       /* ioctl hw specific callback. Some hw might want to perform special
+        * operation on specific ioctl. For instance on wait idle some hw
+        * might want to perform and HDP flush through MMIO as it seems that
+        * some R6XX/R7XX hw doesn't take HDP flush into account if programmed
+        * through ring.
+        */
+       void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
 };
 
 /*
@@ -847,7 +856,7 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
 
 static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg)
 {
-       if (reg < 0x10000)
+       if (reg < rdev->rmmio_size)
                return readl(((void __iomem *)rdev->rmmio) + reg);
        else {
                writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
@@ -857,7 +866,7 @@ static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg)
 
 static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
 {
-       if (reg < 0x10000)
+       if (reg < rdev->rmmio_size)
                writel(v, ((void __iomem *)rdev->rmmio) + reg);
        else {
                writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
@@ -1017,6 +1026,8 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
 #define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd))
 
 /* Common functions */
+/* AGP */
+extern void radeon_agp_disable(struct radeon_device *rdev);
 extern int radeon_gart_table_vram_pin(struct radeon_device *rdev);
 extern int radeon_modeset_init(struct radeon_device *rdev);
 extern void radeon_modeset_fini(struct radeon_device *rdev);
@@ -1140,6 +1151,7 @@ extern bool r600_card_posted(struct radeon_device *rdev);
 extern void r600_cp_stop(struct radeon_device *rdev);
 extern void r600_ring_init(struct radeon_device *rdev, unsigned ring_size);
 extern int r600_cp_resume(struct radeon_device *rdev);
+extern void r600_cp_fini(struct radeon_device *rdev);
 extern int r600_count_pipe_bits(uint32_t val);
 extern int r600_gart_clear_page(struct radeon_device *rdev, int i);
 extern int r600_mc_wait_for_idle(struct radeon_device *rdev);
@@ -1160,7 +1172,8 @@ extern int r600_irq_init(struct radeon_device *rdev);
 extern void r600_irq_fini(struct radeon_device *rdev);
 extern void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size);
 extern int r600_irq_set(struct radeon_device *rdev);
-
+extern void r600_irq_suspend(struct radeon_device *rdev);
+/* r600 audio */
 extern int r600_audio_init(struct radeon_device *rdev);
 extern int r600_audio_tmds_index(struct drm_encoder *encoder);
 extern void r600_audio_set_clock(struct drm_encoder *encoder, int clock);
index 220f454ea9fae8b11a04aa813da2f960ef47b352..c0681a5556dc96bc0bbbeec86774c3d23098ad35 100644 (file)
@@ -144,9 +144,19 @@ int radeon_agp_init(struct radeon_device *rdev)
 
        ret = drm_agp_info(rdev->ddev, &info);
        if (ret) {
+               drm_agp_release(rdev->ddev);
                DRM_ERROR("Unable to get AGP info: %d\n", ret);
                return ret;
        }
+
+       if (rdev->ddev->agp->agp_info.aper_size < 32) {
+               drm_agp_release(rdev->ddev);
+               dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
+                       "need at least 32M, disabling AGP\n",
+                       rdev->ddev->agp->agp_info.aper_size);
+               return -EINVAL;
+       }
+
        mode.mode = info.mode;
        agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
        is_v3 = !!(agp_status & RADEON_AGPv3_MODE);
@@ -221,6 +231,7 @@ int radeon_agp_init(struct radeon_device *rdev)
        ret = drm_agp_enable(rdev->ddev, mode);
        if (ret) {
                DRM_ERROR("Unable to enable AGP (mode = 0x%lx)\n", mode.mode);
+               drm_agp_release(rdev->ddev);
                return ret;
        }
 
index f2fbd2e4e9df59479660f26811d04a92b8955b95..05ee1aeac3fdce21cd72f3735c156be2c0ab2198 100644 (file)
@@ -117,6 +117,7 @@ static struct radeon_asic r100_asic = {
        .hpd_fini = &r100_hpd_fini,
        .hpd_sense = &r100_hpd_sense,
        .hpd_set_polarity = &r100_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -176,6 +177,7 @@ static struct radeon_asic r300_asic = {
        .hpd_fini = &r100_hpd_fini,
        .hpd_sense = &r100_hpd_sense,
        .hpd_set_polarity = &r100_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 /*
@@ -219,6 +221,7 @@ static struct radeon_asic r420_asic = {
        .hpd_fini = &r100_hpd_fini,
        .hpd_sense = &r100_hpd_sense,
        .hpd_set_polarity = &r100_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -267,6 +270,7 @@ static struct radeon_asic rs400_asic = {
        .hpd_fini = &r100_hpd_fini,
        .hpd_sense = &r100_hpd_sense,
        .hpd_set_polarity = &r100_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -323,6 +327,7 @@ static struct radeon_asic rs600_asic = {
        .hpd_fini = &rs600_hpd_fini,
        .hpd_sense = &rs600_hpd_sense,
        .hpd_set_polarity = &rs600_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -370,6 +375,7 @@ static struct radeon_asic rs690_asic = {
        .hpd_fini = &rs600_hpd_fini,
        .hpd_sense = &rs600_hpd_sense,
        .hpd_set_polarity = &rs600_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -421,6 +427,7 @@ static struct radeon_asic rv515_asic = {
        .hpd_fini = &rs600_hpd_fini,
        .hpd_sense = &rs600_hpd_sense,
        .hpd_set_polarity = &rs600_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 
@@ -463,6 +470,7 @@ static struct radeon_asic r520_asic = {
        .hpd_fini = &rs600_hpd_fini,
        .hpd_sense = &rs600_hpd_sense,
        .hpd_set_polarity = &rs600_hpd_set_polarity,
+       .ioctl_wait_idle = NULL,
 };
 
 /*
@@ -504,6 +512,7 @@ void r600_hpd_fini(struct radeon_device *rdev);
 bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
 void r600_hpd_set_polarity(struct radeon_device *rdev,
                           enum radeon_hpd_id hpd);
+extern void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo);
 
 static struct radeon_asic r600_asic = {
        .init = &r600_init,
@@ -538,6 +547,7 @@ static struct radeon_asic r600_asic = {
        .hpd_fini = &r600_hpd_fini,
        .hpd_sense = &r600_hpd_sense,
        .hpd_set_polarity = &r600_hpd_set_polarity,
+       .ioctl_wait_idle = r600_ioctl_wait_idle,
 };
 
 /*
@@ -582,6 +592,7 @@ static struct radeon_asic rv770_asic = {
        .hpd_fini = &r600_hpd_fini,
        .hpd_sense = &r600_hpd_sense,
        .hpd_set_polarity = &r600_hpd_set_polarity,
+       .ioctl_wait_idle = r600_ioctl_wait_idle,
 };
 
 #endif
index fa82ca74324e45be7fece1a947ea1ead50a5a77d..4d8831548a5fc6f6b8e6f1522836853cf2e10832 100644 (file)
@@ -206,6 +206,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
                        *connector_type = DRM_MODE_CONNECTOR_DVID;
        }
 
+       /* Asrock RS600 board lists the DVI port as HDMI */
+       if ((dev->pdev->device == 0x7941) &&
+           (dev->pdev->subsystem_vendor == 0x1849) &&
+           (dev->pdev->subsystem_device == 0x7941)) {
+               if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
+                   (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
+                       *connector_type = DRM_MODE_CONNECTOR_DVID;
+       }
+
        /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */
        if ((dev->pdev->device == 0x7941) &&
            (dev->pdev->subsystem_vendor == 0x147b) &&
@@ -287,6 +296,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
                        *connector_type = DRM_MODE_CONNECTOR_DVID;
        }
 
+       /* XFX Pine Group device rv730 reports no VGA DDC lines
+        * even though they are wired up to record 0x93
+        */
+       if ((dev->pdev->device == 0x9498) &&
+           (dev->pdev->subsystem_vendor == 0x1682) &&
+           (dev->pdev->subsystem_device == 0x2452)) {
+               struct radeon_device *rdev = dev->dev_private;
+               *i2c_bus = radeon_lookup_i2c_gpio(rdev, 0x93);
+       }
        return true;
 }
 
index 4ddfd4b5bc5118b616caf464f81c7099eeee3c4c..7932dc4d6b90bde396e258108247402ec90ce8ca 100644 (file)
@@ -65,31 +65,42 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize,
        if (r) {
                goto out_cleanup;
        }
-       start_jiffies = jiffies;
-       for (i = 0; i < n; i++) {
-               r = radeon_fence_create(rdev, &fence);
-               if (r) {
-                       goto out_cleanup;
+
+       /* r100 doesn't have dma engine so skip the test */
+       if (rdev->asic->copy_dma) {
+
+               start_jiffies = jiffies;
+               for (i = 0; i < n; i++) {
+                       r = radeon_fence_create(rdev, &fence);
+                       if (r) {
+                               goto out_cleanup;
+                       }
+
+                       r = radeon_copy_dma(rdev, saddr, daddr,
+                                       size / RADEON_GPU_PAGE_SIZE, fence);
+
+                       if (r) {
+                               goto out_cleanup;
+                       }
+                       r = radeon_fence_wait(fence, false);
+                       if (r) {
+                               goto out_cleanup;
+                       }
+                       radeon_fence_unref(&fence);
                }
-               r = radeon_copy_dma(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, fence);
-               if (r) {
-                       goto out_cleanup;
+               end_jiffies = jiffies;
+               time = end_jiffies - start_jiffies;
+               time = jiffies_to_msecs(time);
+               if (time > 0) {
+                       i = ((n * size) >> 10) / time;
+                       printk(KERN_INFO "radeon: dma %u bo moves of %ukb from"
+                                       " %d to %d in %lums (%ukb/ms %ukb/s %uM/s)\n",
+                                       n, size >> 10,
+                                       sdomain, ddomain, time,
+                                       i, i * 1000, (i * 1000) / 1024);
                }
-               r = radeon_fence_wait(fence, false);
-               if (r) {
-                       goto out_cleanup;
-               }
-               radeon_fence_unref(&fence);
-       }
-       end_jiffies = jiffies;
-       time = end_jiffies - start_jiffies;
-       time = jiffies_to_msecs(time);
-       if (time > 0) {
-               i = ((n * size) >> 10) / time;
-               printk(KERN_INFO "radeon: dma %u bo moves of %ukb from %d to %d"
-                      " in %lums (%ukb/ms %ukb/s %uM/s)\n", n, size >> 10,
-                      sdomain, ddomain, time, i, i * 1000, (i * 1000) / 1024);
        }
+
        start_jiffies = jiffies;
        for (i = 0; i < n; i++) {
                r = radeon_fence_create(rdev, &fence);
index 812f24dbc2a8c58a0cfe566cc0fe81baaab382d8..73c4405bf42f7af190119166a4404d8f6d31075a 100644 (file)
@@ -56,7 +56,7 @@ uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev)
        else if (post_div == 3)
                sclk >>= 2;
        else if (post_div == 4)
-               sclk >>= 4;
+               sclk >>= 3;
 
        return sclk;
 }
@@ -86,7 +86,7 @@ uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev)
        else if (post_div == 3)
                mclk >>= 2;
        else if (post_div == 4)
-               mclk >>= 4;
+               mclk >>= 3;
 
        return mclk;
 }
index 7914455c96ca9024814d152fee0c37439b1129ee..22d476160d5293ec74e38a44e14630eea5922c9b 100644 (file)
@@ -687,6 +687,9 @@ radeon_combios_get_tv_info(struct radeon_device *rdev)
        uint16_t tv_info;
        enum radeon_tv_std tv_std = TV_STD_NTSC;
 
+       if (rdev->bios == NULL)
+               return tv_std;
+
        tv_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE);
        if (tv_info) {
                if (RBIOS8(tv_info + 6) == 'T') {
@@ -968,8 +971,7 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder
                         lvds->native_mode.vdisplay);
 
                lvds->panel_vcc_delay = RBIOS16(lcd_info + 0x2c);
-               if (lvds->panel_vcc_delay > 2000 || lvds->panel_vcc_delay < 0)
-                       lvds->panel_vcc_delay = 2000;
+               lvds->panel_vcc_delay = min_t(u16, lvds->panel_vcc_delay, 2000);
 
                lvds->panel_pwr_delay = RBIOS8(lcd_info + 0x24);
                lvds->panel_digon_delay = RBIOS16(lcd_info + 0x38) & 0xf;
@@ -1277,47 +1279,47 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
        rdev->mode_info.connector_table = radeon_connector_table;
        if (rdev->mode_info.connector_table == CT_NONE) {
 #ifdef CONFIG_PPC_PMAC
-               if (machine_is_compatible("PowerBook3,3")) {
+               if (of_machine_is_compatible("PowerBook3,3")) {
                        /* powerbook with VGA */
                        rdev->mode_info.connector_table = CT_POWERBOOK_VGA;
-               } else if (machine_is_compatible("PowerBook3,4") ||
-                          machine_is_compatible("PowerBook3,5")) {
+               } else if (of_machine_is_compatible("PowerBook3,4") ||
+                          of_machine_is_compatible("PowerBook3,5")) {
                        /* powerbook with internal tmds */
                        rdev->mode_info.connector_table = CT_POWERBOOK_INTERNAL;
-               } else if (machine_is_compatible("PowerBook5,1") ||
-                          machine_is_compatible("PowerBook5,2") ||
-                          machine_is_compatible("PowerBook5,3") ||
-                          machine_is_compatible("PowerBook5,4") ||
-                          machine_is_compatible("PowerBook5,5")) {
+               } else if (of_machine_is_compatible("PowerBook5,1") ||
+                          of_machine_is_compatible("PowerBook5,2") ||
+                          of_machine_is_compatible("PowerBook5,3") ||
+                          of_machine_is_compatible("PowerBook5,4") ||
+                          of_machine_is_compatible("PowerBook5,5")) {
                        /* powerbook with external single link tmds (sil164) */
                        rdev->mode_info.connector_table = CT_POWERBOOK_EXTERNAL;
-               } else if (machine_is_compatible("PowerBook5,6")) {
+               } else if (of_machine_is_compatible("PowerBook5,6")) {
                        /* powerbook with external dual or single link tmds */
                        rdev->mode_info.connector_table = CT_POWERBOOK_EXTERNAL;
-               } else if (machine_is_compatible("PowerBook5,7") ||
-                          machine_is_compatible("PowerBook5,8") ||
-                          machine_is_compatible("PowerBook5,9")) {
+               } else if (of_machine_is_compatible("PowerBook5,7") ||
+                          of_machine_is_compatible("PowerBook5,8") ||
+                          of_machine_is_compatible("PowerBook5,9")) {
                        /* PowerBook6,2 ? */
                        /* powerbook with external dual link tmds (sil1178?) */
                        rdev->mode_info.connector_table = CT_POWERBOOK_EXTERNAL;
-               } else if (machine_is_compatible("PowerBook4,1") ||
-                          machine_is_compatible("PowerBook4,2") ||
-                          machine_is_compatible("PowerBook4,3") ||
-                          machine_is_compatible("PowerBook6,3") ||
-                          machine_is_compatible("PowerBook6,5") ||
-                          machine_is_compatible("PowerBook6,7")) {
+               } else if (of_machine_is_compatible("PowerBook4,1") ||
+                          of_machine_is_compatible("PowerBook4,2") ||
+                          of_machine_is_compatible("PowerBook4,3") ||
+                          of_machine_is_compatible("PowerBook6,3") ||
+                          of_machine_is_compatible("PowerBook6,5") ||
+                          of_machine_is_compatible("PowerBook6,7")) {
                        /* ibook */
                        rdev->mode_info.connector_table = CT_IBOOK;
-               } else if (machine_is_compatible("PowerMac4,4")) {
+               } else if (of_machine_is_compatible("PowerMac4,4")) {
                        /* emac */
                        rdev->mode_info.connector_table = CT_EMAC;
-               } else if (machine_is_compatible("PowerMac10,1")) {
+               } else if (of_machine_is_compatible("PowerMac10,1")) {
                        /* mini with internal tmds */
                        rdev->mode_info.connector_table = CT_MINI_INTERNAL;
-               } else if (machine_is_compatible("PowerMac10,2")) {
+               } else if (of_machine_is_compatible("PowerMac10,2")) {
                        /* mini with external tmds */
                        rdev->mode_info.connector_table = CT_MINI_EXTERNAL;
-               } else if (machine_is_compatible("PowerMac12,1")) {
+               } else if (of_machine_is_compatible("PowerMac12,1")) {
                        /* PowerMac8,1 ? */
                        /* imac g5 isight */
                        rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT;
index 9da10dd5df80e247a03f143c45aaa6ba26781862..65f81942f3994684e829b79bec2a7a7b1d9422b1 100644 (file)
@@ -580,16 +580,18 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect
        struct radeon_connector *radeon_connector = to_radeon_connector(connector);
        struct drm_encoder *encoder;
        struct drm_encoder_helper_funcs *encoder_funcs;
-       bool dret;
+       bool dret = false;
        enum drm_connector_status ret = connector_status_disconnected;
 
        encoder = radeon_best_single_encoder(connector);
        if (!encoder)
                ret = connector_status_disconnected;
 
-       radeon_i2c_do_lock(radeon_connector->ddc_bus, 1);
-       dret = radeon_ddc_probe(radeon_connector);
-       radeon_i2c_do_lock(radeon_connector->ddc_bus, 0);
+       if (radeon_connector->ddc_bus) {
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 1);
+               dret = radeon_ddc_probe(radeon_connector);
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 0);
+       }
        if (dret) {
                if (radeon_connector->edid) {
                        kfree(radeon_connector->edid);
@@ -740,11 +742,13 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect
        struct drm_mode_object *obj;
        int i;
        enum drm_connector_status ret = connector_status_disconnected;
-       bool dret;
+       bool dret = false;
 
-       radeon_i2c_do_lock(radeon_connector->ddc_bus, 1);
-       dret = radeon_ddc_probe(radeon_connector);
-       radeon_i2c_do_lock(radeon_connector->ddc_bus, 0);
+       if (radeon_connector->ddc_bus) {
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 1);
+               dret = radeon_ddc_probe(radeon_connector);
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 0);
+       }
        if (dret) {
                if (radeon_connector->edid) {
                        kfree(radeon_connector->edid);
@@ -776,7 +780,7 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect
                         * connected and the DVI port disconnected.  If the edid doesn't
                         * say HDMI, vice versa.
                         */
-                       if (radeon_connector->shared_ddc && connector_status_connected) {
+                       if (radeon_connector->shared_ddc && (ret == connector_status_connected)) {
                                struct drm_device *dev = connector->dev;
                                struct drm_connector *list_connector;
                                struct radeon_connector *list_radeon_connector;
@@ -900,10 +904,18 @@ static void radeon_dvi_force(struct drm_connector *connector)
 static int radeon_dvi_mode_valid(struct drm_connector *connector,
                                  struct drm_display_mode *mode)
 {
+       struct drm_device *dev = connector->dev;
+       struct radeon_device *rdev = dev->dev_private;
        struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 
        /* XXX check mode bandwidth */
 
+       /* clocks over 135 MHz have heat issues with DVI on RV100 */
+       if (radeon_connector->use_digital &&
+           (rdev->family == CHIP_RV100) &&
+           (mode->clock > 135000))
+               return MODE_CLOCK_HIGH;
+
        if (radeon_connector->use_digital && (mode->clock > 165000)) {
                if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
                    (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
@@ -1048,8 +1060,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        return;
                }
                if (radeon_connector->ddc_bus && i2c_bus->valid) {
-                       if (memcmp(&radeon_connector->ddc_bus->rec, i2c_bus,
-                                   sizeof(struct radeon_i2c_bus_rec)) == 0) {
+                       if (radeon_connector->ddc_bus->rec.i2c_id == i2c_bus->i2c_id) {
                                radeon_connector->shared_ddc = true;
                                shared_ddc = true;
                        }
@@ -1335,7 +1346,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
                                radeon_connector->dac_load_detect = false;
                        drm_connector_attach_property(&radeon_connector->base,
                                                      rdev->mode_info.load_detect_property,
-                                                     1);
+                                                     radeon_connector->dac_load_detect);
                        drm_connector_attach_property(&radeon_connector->base,
                                                      rdev->mode_info.tv_std_property,
                                                      radeon_combios_get_tv_info(rdev));
index 65590a0f1d93f431c2a0a9585caa6e04b68e6e09..e9d085021c1f08d2fb7b0edc40450eb9fa7580a2 100644 (file)
@@ -86,7 +86,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
                                                &p->validated);
                }
        }
-       return radeon_bo_list_validate(&p->validated, p->ib->fence);
+       return radeon_bo_list_validate(&p->validated);
 }
 
 int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
@@ -189,12 +189,10 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
 {
        unsigned i;
 
-       if (error) {
-               radeon_bo_list_unvalidate(&parser->validated,
-                                               parser->ib->fence);
-       } else {
-               radeon_bo_list_unreserve(&parser->validated);
+       if (!error && parser->ib) {
+               radeon_bo_list_fence(&parser->validated, parser->ib->fence);
        }
+       radeon_bo_list_unreserve(&parser->validated);
        for (i = 0; i < parser->nrelocs; i++) {
                if (parser->relocs[i].gobj) {
                        mutex_lock(&parser->rdev->ddev->struct_mutex);
@@ -231,6 +229,7 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
        memset(&parser, 0, sizeof(struct radeon_cs_parser));
        parser.filp = filp;
        parser.rdev = rdev;
+       parser.dev = rdev->dev;
        r = radeon_cs_parser_init(&parser, data);
        if (r) {
                DRM_ERROR("Failed to initialize parser !\n");
index 0c51f8e46613bf1447f86edf59e4dcdc7287ddbb..768b1509fa032b1a90ec9a38bab111672ebfbd4f 100644 (file)
@@ -544,6 +544,7 @@ void radeon_agp_disable(struct radeon_device *rdev)
                rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
                rdev->asic->gart_set_page = &r100_pci_gart_set_page;
        }
+       rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
 }
 
 void radeon_check_arguments(struct radeon_device *rdev)
index 0ec491ead2ffd49a7169449acad83397192e55e2..7e17a362b54baab34cf1b8a41e60a4a5c3c6865b 100644 (file)
@@ -278,7 +278,7 @@ static void radeon_print_display_setup(struct drm_device *dev)
                DRM_INFO("  %s\n", connector_names[connector->connector_type]);
                if (radeon_connector->hpd.hpd != RADEON_HPD_NONE)
                        DRM_INFO("  %s\n", hpd_names[radeon_connector->hpd.hpd]);
-               if (radeon_connector->ddc_bus)
+               if (radeon_connector->ddc_bus) {
                        DRM_INFO("  DDC: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
                                 radeon_connector->ddc_bus->rec.mask_clk_reg,
                                 radeon_connector->ddc_bus->rec.mask_data_reg,
@@ -288,6 +288,15 @@ static void radeon_print_display_setup(struct drm_device *dev)
                                 radeon_connector->ddc_bus->rec.en_data_reg,
                                 radeon_connector->ddc_bus->rec.y_clk_reg,
                                 radeon_connector->ddc_bus->rec.y_data_reg);
+               } else {
+                       if (connector->connector_type == DRM_MODE_CONNECTOR_VGA ||
+                           connector->connector_type == DRM_MODE_CONNECTOR_DVII ||
+                           connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
+                           connector->connector_type == DRM_MODE_CONNECTOR_DVIA ||
+                           connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+                           connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
+                               DRM_INFO("  DDC: no ddc bus - possible BIOS bug - please report to xorg-driver-ati@lists.x.org\n");
+               }
                DRM_INFO("  Encoders:\n");
                list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
                        radeon_encoder = to_radeon_encoder(encoder);
@@ -357,7 +366,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
        if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
            (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
                struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
-               if (dig->dp_i2c_bus)
+               if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
+                    dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus)
                        radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter);
        }
        if (!radeon_connector->ddc_bus)
@@ -410,11 +420,12 @@ void radeon_compute_pll(struct radeon_pll *pll,
                        uint32_t *fb_div_p,
                        uint32_t *frac_fb_div_p,
                        uint32_t *ref_div_p,
-                       uint32_t *post_div_p,
-                       int flags)
+                       uint32_t *post_div_p)
 {
        uint32_t min_ref_div = pll->min_ref_div;
        uint32_t max_ref_div = pll->max_ref_div;
+       uint32_t min_post_div = pll->min_post_div;
+       uint32_t max_post_div = pll->max_post_div;
        uint32_t min_fractional_feed_div = 0;
        uint32_t max_fractional_feed_div = 0;
        uint32_t best_vco = pll->best_vco;
@@ -430,7 +441,7 @@ void radeon_compute_pll(struct radeon_pll *pll,
        DRM_DEBUG("PLL freq %llu %u %u\n", freq, pll->min_ref_div, pll->max_ref_div);
        freq = freq * 1000;
 
-       if (flags & RADEON_PLL_USE_REF_DIV)
+       if (pll->flags & RADEON_PLL_USE_REF_DIV)
                min_ref_div = max_ref_div = pll->reference_div;
        else {
                while (min_ref_div < max_ref_div-1) {
@@ -445,19 +456,22 @@ void radeon_compute_pll(struct radeon_pll *pll,
                }
        }
 
-       if (flags & RADEON_PLL_USE_FRAC_FB_DIV) {
+       if (pll->flags & RADEON_PLL_USE_POST_DIV)
+               min_post_div = max_post_div = pll->post_div;
+
+       if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) {
                min_fractional_feed_div = pll->min_frac_feedback_div;
                max_fractional_feed_div = pll->max_frac_feedback_div;
        }
 
-       for (post_div = pll->min_post_div; post_div <= pll->max_post_div; ++post_div) {
+       for (post_div = min_post_div; post_div <= max_post_div; ++post_div) {
                uint32_t ref_div;
 
-               if ((flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1))
+               if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1))
                        continue;
 
                /* legacy radeons only have a few post_divs */
-               if (flags & RADEON_PLL_LEGACY) {
+               if (pll->flags & RADEON_PLL_LEGACY) {
                        if ((post_div == 5) ||
                            (post_div == 7) ||
                            (post_div == 9) ||
@@ -504,7 +518,7 @@ void radeon_compute_pll(struct radeon_pll *pll,
                                        tmp += (uint64_t)pll->reference_freq * 1000 * frac_feedback_div;
                                        current_freq = radeon_div(tmp, ref_div * post_div);
 
-                                       if (flags & RADEON_PLL_PREFER_CLOSEST_LOWER) {
+                                       if (pll->flags & RADEON_PLL_PREFER_CLOSEST_LOWER) {
                                                error = freq - current_freq;
                                                error = error < 0 ? 0xffffffff : error;
                                        } else
@@ -531,12 +545,12 @@ void radeon_compute_pll(struct radeon_pll *pll,
                                                        best_freq = current_freq;
                                                        best_error = error;
                                                        best_vco_diff = vco_diff;
-                                               } else if (((flags & RADEON_PLL_PREFER_LOW_REF_DIV) && (ref_div < best_ref_div)) ||
-                                                          ((flags & RADEON_PLL_PREFER_HIGH_REF_DIV) && (ref_div > best_ref_div)) ||
-                                                          ((flags & RADEON_PLL_PREFER_LOW_FB_DIV) && (feedback_div < best_feedback_div)) ||
-                                                          ((flags & RADEON_PLL_PREFER_HIGH_FB_DIV) && (feedback_div > best_feedback_div)) ||
-                                                          ((flags & RADEON_PLL_PREFER_LOW_POST_DIV) && (post_div < best_post_div)) ||
-                                                          ((flags & RADEON_PLL_PREFER_HIGH_POST_DIV) && (post_div > best_post_div))) {
+                                               } else if (((pll->flags & RADEON_PLL_PREFER_LOW_REF_DIV) && (ref_div < best_ref_div)) ||
+                                                          ((pll->flags & RADEON_PLL_PREFER_HIGH_REF_DIV) && (ref_div > best_ref_div)) ||
+                                                          ((pll->flags & RADEON_PLL_PREFER_LOW_FB_DIV) && (feedback_div < best_feedback_div)) ||
+                                                          ((pll->flags & RADEON_PLL_PREFER_HIGH_FB_DIV) && (feedback_div > best_feedback_div)) ||
+                                                          ((pll->flags & RADEON_PLL_PREFER_LOW_POST_DIV) && (post_div < best_post_div)) ||
+                                                          ((pll->flags & RADEON_PLL_PREFER_HIGH_POST_DIV) && (post_div > best_post_div))) {
                                                        best_post_div = post_div;
                                                        best_ref_div = ref_div;
                                                        best_feedback_div = feedback_div;
@@ -572,8 +586,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
                              uint32_t *fb_div_p,
                              uint32_t *frac_fb_div_p,
                              uint32_t *ref_div_p,
-                             uint32_t *post_div_p,
-                             int flags)
+                             uint32_t *post_div_p)
 {
        fixed20_12 m, n, frac_n, p, f_vco, f_pclk, best_freq;
        fixed20_12 pll_out_max, pll_out_min;
@@ -667,7 +680,6 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
                radeonfb_remove(dev, fb);
 
        if (radeon_fb->obj) {
-               radeon_gem_object_unpin(radeon_fb->obj);
                mutex_lock(&dev->struct_mutex);
                drm_gem_object_unreference(radeon_fb->obj);
                mutex_unlock(&dev->struct_mutex);
@@ -715,7 +727,11 @@ radeon_user_framebuffer_create(struct drm_device *dev,
        struct drm_gem_object *obj;
 
        obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
-
+       if (obj ==  NULL) {
+               dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, "
+                       "can't create framebuffer\n", mode_cmd->handle);
+               return NULL;
+       }
        return radeon_framebuffer_create(dev, mode_cmd, obj);
 }
 
index e13785282a825bbdbae44bb65fa02e3c93b8173b..c57ad606504dfcb3cee7b66103aac1ab834daec9 100644 (file)
  * 1.29- R500 3D cmd buffer support
  * 1.30- Add support for occlusion queries
  * 1.31- Add support for num Z pipes from GET_PARAM
+ * 1.32- fixes for rv740 setup
  */
 #define DRIVER_MAJOR           1
-#define DRIVER_MINOR           31
+#define DRIVER_MINOR           32
 #define DRIVER_PATCHLEVEL      0
 
 enum radeon_cp_microcode_version {
index 82eb551970b92dff7f201ff4cec70beff286eebb..3c91724457ca3f69bced25185cf8cc14eace9ea1 100644 (file)
@@ -156,6 +156,26 @@ radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t
        return ret;
 }
 
+static inline bool radeon_encoder_is_digital(struct drm_encoder *encoder)
+{
+       struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+       switch (radeon_encoder->encoder_id) {
+       case ENCODER_OBJECT_ID_INTERNAL_LVDS:
+       case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
+       case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
+       case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
+       case ENCODER_OBJECT_ID_INTERNAL_DVO1:
+       case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
+       case ENCODER_OBJECT_ID_INTERNAL_DDI:
+       case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
+       case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
+       case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
+       case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
+               return true;
+       default:
+               return false;
+       }
+}
 void
 radeon_link_encoder_connector(struct drm_device *dev)
 {
@@ -202,7 +222,7 @@ radeon_get_connector_for_encoder(struct drm_encoder *encoder)
 
        list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
                radeon_connector = to_radeon_connector(connector);
-               if (radeon_encoder->devices & radeon_connector->devices)
+               if (radeon_encoder->active_device & radeon_connector->devices)
                        return connector;
        }
        return NULL;
@@ -676,31 +696,11 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action)
 
        memset(&args, 0, sizeof(args));
 
-       if (ASIC_IS_DCE32(rdev)) {
-               if (dig->dig_block)
-                       index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
-               else
-                       index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);
-               num = dig->dig_block + 1;
-       } else {
-               switch (radeon_encoder->encoder_id) {
-               case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
-                       /* XXX doesn't really matter which dig encoder we pick as long as it's
-                        * not already in use
-                        */
-                       if (dig_connector->linkb)
-                               index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
-                       else
-                               index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);
-                       num = 1;
-                       break;
-               case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
-                       /* Only dig2 encoder can drive LVTMA */
-                       index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
-                       num = 2;
-                       break;
-               }
-       }
+       if (dig->dig_encoder)
+               index = GetIndexIntoMasterTable(COMMAND, DIG2EncoderControl);
+       else
+               index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);
+       num = dig->dig_encoder + 1;
 
        atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);
 
@@ -822,7 +822,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
                        args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10);
        }
        if (ASIC_IS_DCE32(rdev)) {
-               if (dig->dig_block)
+               if (dig->dig_encoder == 1)
                        args.v2.acConfig.ucEncoderSel = 1;
                if (dig_connector->linkb)
                        args.v2.acConfig.ucLinkSel = 1;
@@ -849,17 +849,16 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
                                args.v2.acConfig.fCoherentMode = 1;
                }
        } else {
+
                args.v1.ucConfig = ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL;
 
+               if (dig->dig_encoder)
+                       args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER;
+               else
+                       args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER;
+
                switch (radeon_encoder->encoder_id) {
                case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
-                       /* XXX doesn't really matter which dig encoder we pick as long as it's
-                        * not already in use
-                        */
-                       if (dig_connector->linkb)
-                               args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER;
-                       else
-                               args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER;
                        if (rdev->flags & RADEON_IS_IGP) {
                                if (radeon_encoder->pixel_clock > 165000) {
                                        if (dig_connector->igp_lane_info & 0x3)
@@ -878,10 +877,6 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
                                }
                        }
                        break;
-               case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
-                       /* Only dig2 encoder can drive LVTMA */
-                       args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER;
-                       break;
                }
 
                if (radeon_encoder->pixel_clock > 165000)
@@ -1046,6 +1041,7 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
        union crtc_sourc_param args;
        int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source);
        uint8_t frev, crev;
+       struct radeon_encoder_atom_dig *dig;
 
        memset(&args, 0, sizeof(args));
 
@@ -1109,40 +1105,16 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
                        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
-                               if (ASIC_IS_DCE32(rdev)) {
-                                       if (radeon_crtc->crtc_id)
-                                               args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID;
-                                       else
-                                               args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID;
-                               } else {
-                                       struct drm_connector *connector;
-                                       struct radeon_connector *radeon_connector;
-                                       struct radeon_connector_atom_dig *dig_connector;
-
-                                       connector = radeon_get_connector_for_encoder(encoder);
-                                       if (!connector)
-                                               return;
-                                       radeon_connector = to_radeon_connector(connector);
-                                       if (!radeon_connector->con_priv)
-                                               return;
-                                       dig_connector = radeon_connector->con_priv;
-
-                                       /* XXX doesn't really matter which dig encoder we pick as long as it's
-                                        * not already in use
-                                        */
-                                       if (dig_connector->linkb)
-                                               args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID;
-                                       else
-                                               args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID;
-                               }
+                       case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
+                               dig = radeon_encoder->enc_priv;
+                               if (dig->dig_encoder)
+                                       args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID;
+                               else
+                                       args.v2.ucEncoderID = ASIC_INT_DIG1_ENCODER_ID;
                                break;
                        case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
                                args.v2.ucEncoderID = ASIC_INT_DVO_ENCODER_ID;
                                break;
-                       case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
-                               /* Only dig2 encoder can drive LVTMA */
-                               args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID;
-                               break;
                        case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
                                if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
                                        args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
@@ -1202,6 +1174,47 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder,
        }
 }
 
+static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
+{
+       struct drm_device *dev = encoder->dev;
+       struct radeon_device *rdev = dev->dev_private;
+       struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+       struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+       struct drm_encoder *test_encoder;
+       struct radeon_encoder_atom_dig *dig;
+       uint32_t dig_enc_in_use = 0;
+       /* on DCE32 and encoder can driver any block so just crtc id */
+       if (ASIC_IS_DCE32(rdev)) {
+               return radeon_crtc->crtc_id;
+       }
+
+       /* on DCE3 - LVTMA can only be driven by DIGB */
+       list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) {
+               struct radeon_encoder *radeon_test_encoder;
+
+               if (encoder == test_encoder)
+                       continue;
+
+               if (!radeon_encoder_is_digital(test_encoder))
+                       continue;
+
+               radeon_test_encoder = to_radeon_encoder(test_encoder);
+               dig = radeon_test_encoder->enc_priv;
+
+               if (dig->dig_encoder >= 0)
+                       dig_enc_in_use |= (1 << dig->dig_encoder);
+       }
+
+       if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA) {
+               if (dig_enc_in_use & 0x2)
+                       DRM_ERROR("LVDS required digital encoder 2 but it was in use - stealing\n");
+               return 1;
+       }
+       if (!(dig_enc_in_use & 1))
+               return 0;
+       return 1;
+}
+
 static void
 radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
                             struct drm_display_mode *mode,
@@ -1214,12 +1227,9 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
 
        if (radeon_encoder->active_device &
            (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) {
-               if (radeon_encoder->enc_priv) {
-                       struct radeon_encoder_atom_dig *dig;
-
-                       dig = radeon_encoder->enc_priv;
-                       dig->dig_block = radeon_crtc->crtc_id;
-               }
+               struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+               if (dig)
+                       dig->dig_encoder = radeon_atom_pick_dig_encoder(encoder);
        }
        radeon_encoder->pixel_clock = adjusted_mode->clock;
 
@@ -1379,7 +1389,13 @@ static void radeon_atom_encoder_commit(struct drm_encoder *encoder)
 static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
 {
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+       struct radeon_encoder_atom_dig *dig;
        radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+
+       if (radeon_encoder_is_digital(encoder)) {
+               dig = radeon_encoder->enc_priv;
+               dig->dig_encoder = -1;
+       }
        radeon_encoder->active_device = 0;
 }
 
@@ -1436,6 +1452,7 @@ radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder)
 
        /* coherent mode by default */
        dig->coherent_mode = true;
+       dig->dig_encoder = -1;
 
        return dig;
 }
index 3ba213d1b06c28a96d81b3f3fc38d21a4cbd660d..d71e346e9ab5a9faa96d62a96ad35cb84cfce20d 100644 (file)
@@ -248,7 +248,7 @@ int radeonfb_create(struct drm_device *dev,
        if (ret)
                goto out_unref;
 
-       memset_io(fbptr, 0xff, aligned_size);
+       memset_io(fbptr, 0x0, aligned_size);
 
        strcpy(info->fix.id, "radeondrmfb");
 
index 0e1325e1853464d4e46552a2a6cfd523d406e4e6..db8e9a355a01624c32c16bb3ac002b90c97277b3 100644 (file)
@@ -308,6 +308,9 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
        }
        robj = gobj->driver_private;
        r = radeon_bo_wait(robj, NULL, false);
+       /* callback hw specific functions if any */
+       if (robj->rdev->asic->ioctl_wait_idle)
+               robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj);
        mutex_lock(&dev->struct_mutex);
        drm_gem_object_unreference(gobj);
        mutex_unlock(&dev->struct_mutex);
index cc27485a07ad9b681269d6ed3fe2889161338bab..b6d8081e124675842c7614cea33d35f5d8357912 100644 (file)
@@ -339,69 +339,6 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
        }
 }
 
-/* properly set crtc bpp when using atombios */
-void radeon_legacy_atom_set_surface(struct drm_crtc *crtc)
-{
-       struct drm_device *dev = crtc->dev;
-       struct radeon_device *rdev = dev->dev_private;
-       struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
-       int format;
-       uint32_t crtc_gen_cntl;
-       uint32_t disp_merge_cntl;
-       uint32_t crtc_pitch;
-
-       switch (crtc->fb->bits_per_pixel) {
-       case 8:
-               format = 2;
-               break;
-       case 15:      /*  555 */
-               format = 3;
-               break;
-       case 16:      /*  565 */
-               format = 4;
-               break;
-       case 24:      /*  RGB */
-               format = 5;
-               break;
-       case 32:      /* xRGB */
-               format = 6;
-               break;
-       default:
-               return;
-       }
-
-       crtc_pitch  = ((((crtc->fb->pitch / (crtc->fb->bits_per_pixel / 8)) * crtc->fb->bits_per_pixel) +
-                       ((crtc->fb->bits_per_pixel * 8) - 1)) /
-                      (crtc->fb->bits_per_pixel * 8));
-       crtc_pitch |= crtc_pitch << 16;
-
-       WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch);
-
-       switch (radeon_crtc->crtc_id) {
-       case 0:
-               disp_merge_cntl = RREG32(RADEON_DISP_MERGE_CNTL);
-               disp_merge_cntl &= ~RADEON_DISP_RGB_OFFSET_EN;
-               WREG32(RADEON_DISP_MERGE_CNTL, disp_merge_cntl);
-
-               crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL) & 0xfffff0ff;
-               crtc_gen_cntl |= (format << 8);
-               crtc_gen_cntl |= RADEON_CRTC_EXT_DISP_EN;
-               WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl);
-               break;
-       case 1:
-               disp_merge_cntl = RREG32(RADEON_DISP2_MERGE_CNTL);
-               disp_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN;
-               WREG32(RADEON_DISP2_MERGE_CNTL, disp_merge_cntl);
-
-               crtc_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL) & 0xfffff0ff;
-               crtc_gen_cntl |= (format << 8);
-               WREG32(RADEON_CRTC2_GEN_CNTL, crtc_gen_cntl);
-               WREG32(RADEON_FP_H2_SYNC_STRT_WID,   RREG32(RADEON_CRTC2_H_SYNC_STRT_WID));
-               WREG32(RADEON_FP_V2_SYNC_STRT_WID,   RREG32(RADEON_CRTC2_V_SYNC_STRT_WID));
-               break;
-       }
-}
-
 int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
                         struct drm_framebuffer *old_fb)
 {
@@ -755,7 +692,6 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
        uint32_t post_divider = 0;
        uint32_t freq = 0;
        uint8_t pll_gain;
-       int pll_flags = RADEON_PLL_LEGACY;
        bool use_bios_divs = false;
        /* PLL registers */
        uint32_t pll_ref_div = 0;
@@ -789,10 +725,12 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
        else
                pll = &rdev->clock.p1pll;
 
+       pll->flags = RADEON_PLL_LEGACY;
+
        if (mode->clock > 200000) /* range limits??? */
-               pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
+               pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
        else
-               pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
+               pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
 
        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
                if (encoder->crtc == crtc) {
@@ -804,7 +742,7 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
                        }
 
                        if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)
-                               pll_flags |= RADEON_PLL_NO_ODD_POST_DIV;
+                               pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
                        if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) {
                                if (!rdev->is_atom_bios) {
                                        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -819,7 +757,7 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
                                                }
                                        }
                                }
-                               pll_flags |= RADEON_PLL_USE_REF_DIV;
+                               pll->flags |= RADEON_PLL_USE_REF_DIV;
                        }
                }
        }
@@ -829,8 +767,7 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
        if (!use_bios_divs) {
                radeon_compute_pll(pll, mode->clock,
                                   &freq, &feedback_div, &frac_fb_div,
-                                  &reference_div, &post_divider,
-                                  pll_flags);
+                                  &reference_div, &post_divider);
 
                for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
                        if (post_div->divider == post_divider)
index 981508ff70378bb5a9dcea372f97ebdedc22d0a9..38e45e231ef5ae819298c51b9942c03bceda3059 100644 (file)
@@ -46,6 +46,7 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man;
        int panel_pwr_delay = 2000;
+       bool is_mac = false;
        DRM_DEBUG("\n");
 
        if (radeon_encoder->enc_priv) {
@@ -58,6 +59,15 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
                }
        }
 
+       /* macs (and possibly some x86 oem systems?) wire up LVDS strangely
+        * Taken from radeonfb.
+        */
+       if ((rdev->mode_info.connector_table == CT_IBOOK) ||
+           (rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) ||
+           (rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) ||
+           (rdev->mode_info.connector_table == CT_POWERBOOK_VGA))
+               is_mac = true;
+
        switch (mode) {
        case DRM_MODE_DPMS_ON:
                disp_pwr_man = RREG32(RADEON_DISP_PWR_MAN);
@@ -74,6 +84,8 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
 
                lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
                lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN | RADEON_LVDS_DIGON | RADEON_LVDS_BLON);
+               if (is_mac)
+                       lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
                lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS);
                udelay(panel_pwr_delay * 1000);
                WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
@@ -85,7 +97,14 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
                WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
                lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
                lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-               lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+               if (is_mac) {
+                       lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
+                       WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+                       lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
+               } else {
+                       WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
+                       lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
+               }
                udelay(panel_pwr_delay * 1000);
                WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
                WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
index 91cb041cb40dae8df07951808558f359d54f05c7..e81b2aeb6a8fa28338aa1ea6d1b79374ee6a03e6 100644 (file)
@@ -125,16 +125,24 @@ struct radeon_tmds_pll {
 #define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9)
 #define RADEON_PLL_USE_FRAC_FB_DIV      (1 << 10)
 #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11)
+#define RADEON_PLL_USE_POST_DIV         (1 << 12)
 
 struct radeon_pll {
-       uint16_t reference_freq;
-       uint16_t reference_div;
+       /* reference frequency */
+       uint32_t reference_freq;
+
+       /* fixed dividers */
+       uint32_t reference_div;
+       uint32_t post_div;
+
+       /* pll in/out limits */
        uint32_t pll_in_min;
        uint32_t pll_in_max;
        uint32_t pll_out_min;
        uint32_t pll_out_max;
-       uint16_t xclk;
+       uint32_t best_vco;
 
+       /* divider limits */
        uint32_t min_ref_div;
        uint32_t max_ref_div;
        uint32_t min_post_div;
@@ -143,7 +151,12 @@ struct radeon_pll {
        uint32_t max_feedback_div;
        uint32_t min_frac_feedback_div;
        uint32_t max_frac_feedback_div;
-       uint32_t best_vco;
+
+       /* flags for the current clock */
+       uint32_t flags;
+
+       /* pll id */
+       uint32_t id;
 };
 
 struct radeon_i2c_chan {
@@ -286,7 +299,7 @@ struct radeon_atom_ss {
 struct radeon_encoder_atom_dig {
        /* atom dig */
        bool coherent_mode;
-       int dig_block;
+       int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB */
        /* atom lvds */
        uint32_t lvds_misc;
        uint16_t panel_pwr_delay;
@@ -417,8 +430,7 @@ extern void radeon_compute_pll(struct radeon_pll *pll,
                               uint32_t *fb_div_p,
                               uint32_t *frac_fb_div_p,
                               uint32_t *ref_div_p,
-                              uint32_t *post_div_p,
-                              int flags);
+                              uint32_t *post_div_p);
 
 extern void radeon_compute_pll_avivo(struct radeon_pll *pll,
                                     uint64_t freq,
@@ -426,8 +438,7 @@ extern void radeon_compute_pll_avivo(struct radeon_pll *pll,
                                     uint32_t *fb_div_p,
                                     uint32_t *frac_fb_div_p,
                                     uint32_t *ref_div_p,
-                                    uint32_t *post_div_p,
-                                    int flags);
+                                    uint32_t *post_div_p);
 
 extern void radeon_setup_encoder_clones(struct drm_device *dev);
 
@@ -453,7 +464,6 @@ extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
 
 extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
                                 struct drm_framebuffer *old_fb);
-extern void radeon_legacy_atom_set_surface(struct drm_crtc *crtc);
 
 extern int radeon_crtc_cursor_set(struct drm_crtc *crtc,
                                  struct drm_file *file_priv,
index 4e636de877b237b2ca5c53eb15b62d4008a939f6..f1da370928eb7656d5f9fc474fd8cfceb3222ae2 100644 (file)
@@ -220,7 +220,8 @@ int radeon_bo_unpin(struct radeon_bo *bo)
 
 int radeon_bo_evict_vram(struct radeon_device *rdev)
 {
-       if (rdev->flags & RADEON_IS_IGP) {
+       /* late 2.6.33 fix IGP hibernate - we need pm ops to do this correct */
+       if (0 && (rdev->flags & RADEON_IS_IGP)) {
                if (rdev->mc.igp_sideport_enabled == false)
                        /* Useless to evict on IGP chips */
                        return 0;
@@ -305,11 +306,10 @@ void radeon_bo_list_unreserve(struct list_head *head)
        }
 }
 
-int radeon_bo_list_validate(struct list_head *head, void *fence)
+int radeon_bo_list_validate(struct list_head *head)
 {
        struct radeon_bo_list *lobj;
        struct radeon_bo *bo;
-       struct radeon_fence *old_fence = NULL;
        int r;
 
        r = radeon_bo_list_reserve(head);
@@ -333,32 +333,27 @@ int radeon_bo_list_validate(struct list_head *head, void *fence)
                }
                lobj->gpu_offset = radeon_bo_gpu_offset(bo);
                lobj->tiling_flags = bo->tiling_flags;
-               if (fence) {
-                       old_fence = (struct radeon_fence *)bo->tbo.sync_obj;
-                       bo->tbo.sync_obj = radeon_fence_ref(fence);
-                       bo->tbo.sync_obj_arg = NULL;
-               }
-               if (old_fence) {
-                       radeon_fence_unref(&old_fence);
-               }
        }
        return 0;
 }
 
-void radeon_bo_list_unvalidate(struct list_head *head, void *fence)
+void radeon_bo_list_fence(struct list_head *head, void *fence)
 {
        struct radeon_bo_list *lobj;
-       struct radeon_fence *old_fence;
-
-       if (fence)
-               list_for_each_entry(lobj, head, list) {
-                       old_fence = to_radeon_fence(lobj->bo->tbo.sync_obj);
-                       if (old_fence == fence) {
-                               lobj->bo->tbo.sync_obj = NULL;
-                               radeon_fence_unref(&old_fence);
-                       }
+       struct radeon_bo *bo;
+       struct radeon_fence *old_fence = NULL;
+
+       list_for_each_entry(lobj, head, list) {
+               bo = lobj->bo;
+               spin_lock(&bo->tbo.lock);
+               old_fence = (struct radeon_fence *)bo->tbo.sync_obj;
+               bo->tbo.sync_obj = radeon_fence_ref(fence);
+               bo->tbo.sync_obj_arg = NULL;
+               spin_unlock(&bo->tbo.lock);
+               if (old_fence) {
+                       radeon_fence_unref(&old_fence);
                }
-       radeon_bo_list_unreserve(head);
+       }
 }
 
 int radeon_bo_fbdev_mmap(struct radeon_bo *bo,
index a02f18011ad185da2146327adcd9bf32d6b564d6..7ab43de1e244cd66745a9c524edfc208ae625516 100644 (file)
@@ -156,8 +156,8 @@ extern void radeon_bo_list_add_object(struct radeon_bo_list *lobj,
                                struct list_head *head);
 extern int radeon_bo_list_reserve(struct list_head *head);
 extern void radeon_bo_list_unreserve(struct list_head *head);
-extern int radeon_bo_list_validate(struct list_head *head, void *fence);
-extern void radeon_bo_list_unvalidate(struct list_head *head, void *fence);
+extern int radeon_bo_list_validate(struct list_head *head);
+extern void radeon_bo_list_fence(struct list_head *head, void *fence);
 extern int radeon_bo_fbdev_mmap(struct radeon_bo *bo,
                                struct vm_area_struct *vma);
 extern int radeon_bo_set_tiling_flags(struct radeon_bo *bo,
index 4d12b2d17b4d8b6b3d8eeef811209c742e23ec2d..6579eb4c1f287007a3f22179c4593db621d12228 100644 (file)
@@ -41,68 +41,55 @@ int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib)
 {
        struct radeon_fence *fence;
        struct radeon_ib *nib;
-       unsigned long i;
-       int r = 0;
+       int r = 0, i, c;
 
        *ib = NULL;
        r = radeon_fence_create(rdev, &fence);
        if (r) {
-               DRM_ERROR("failed to create fence for new IB\n");
+               dev_err(rdev->dev, "failed to create fence for new IB\n");
                return r;
        }
        mutex_lock(&rdev->ib_pool.mutex);
-       i = find_first_zero_bit(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
-       if (i < RADEON_IB_POOL_SIZE) {
-               set_bit(i, rdev->ib_pool.alloc_bm);
-               rdev->ib_pool.ibs[i].length_dw = 0;
-               *ib = &rdev->ib_pool.ibs[i];
-               mutex_unlock(&rdev->ib_pool.mutex);
-               goto out;
+       for (i = rdev->ib_pool.head_id, c = 0, nib = NULL; c < RADEON_IB_POOL_SIZE; c++, i++) {
+               i &= (RADEON_IB_POOL_SIZE - 1);
+               if (rdev->ib_pool.ibs[i].free) {
+                       nib = &rdev->ib_pool.ibs[i];
+                       break;
+               }
        }
-       if (list_empty(&rdev->ib_pool.scheduled_ibs)) {
-               /* we go do nothings here */
+       if (nib == NULL) {
+               /* This should never happen, it means we allocated all
+                * IB and haven't scheduled one yet, return EBUSY to
+                * userspace hoping that on ioctl recall we get better
+                * luck
+                */
+               dev_err(rdev->dev, "no free indirect buffer !\n");
                mutex_unlock(&rdev->ib_pool.mutex);
-               DRM_ERROR("all IB allocated none scheduled.\n");
-               r = -EINVAL;
-               goto out;
+               radeon_fence_unref(&fence);
+               return -EBUSY;
        }
-       /* get the first ib on the scheduled list */
-       nib = list_entry(rdev->ib_pool.scheduled_ibs.next,
-                        struct radeon_ib, list);
-       if (nib->fence == NULL) {
-               /* we go do nothings here */
+       rdev->ib_pool.head_id = (nib->idx + 1) & (RADEON_IB_POOL_SIZE - 1);
+       nib->free = false;
+       if (nib->fence) {
                mutex_unlock(&rdev->ib_pool.mutex);
-               DRM_ERROR("IB %lu scheduled without a fence.\n", nib->idx);
-               r = -EINVAL;
-               goto out;
-       }
-       mutex_unlock(&rdev->ib_pool.mutex);
-
-       r = radeon_fence_wait(nib->fence, false);
-       if (r) {
-               DRM_ERROR("radeon: IB(%lu:0x%016lX:%u)\n", nib->idx,
-                         (unsigned long)nib->gpu_addr, nib->length_dw);
-               DRM_ERROR("radeon: GPU lockup detected, fail to get a IB\n");
-               goto out;
+               r = radeon_fence_wait(nib->fence, false);
+               if (r) {
+                       dev_err(rdev->dev, "error waiting fence of IB(%u:0x%016lX:%u)\n",
+                               nib->idx, (unsigned long)nib->gpu_addr, nib->length_dw);
+                       mutex_lock(&rdev->ib_pool.mutex);
+                       nib->free = true;
+                       mutex_unlock(&rdev->ib_pool.mutex);
+                       radeon_fence_unref(&fence);
+                       return r;
+               }
+               mutex_lock(&rdev->ib_pool.mutex);
        }
        radeon_fence_unref(&nib->fence);
-
+       nib->fence = fence;
        nib->length_dw = 0;
-
-       /* scheduled list is accessed here */
-       mutex_lock(&rdev->ib_pool.mutex);
-       list_del(&nib->list);
-       INIT_LIST_HEAD(&nib->list);
        mutex_unlock(&rdev->ib_pool.mutex);
-
        *ib = nib;
-out:
-       if (r) {
-               radeon_fence_unref(&fence);
-       } else {
-               (*ib)->fence = fence;
-       }
-       return r;
+       return 0;
 }
 
 void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib)
@@ -113,19 +100,10 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib)
        if (tmp == NULL) {
                return;
        }
-       mutex_lock(&rdev->ib_pool.mutex);
-       if (!list_empty(&tmp->list) && !radeon_fence_signaled(tmp->fence)) {
-               /* IB is scheduled & not signaled don't do anythings */
-               mutex_unlock(&rdev->ib_pool.mutex);
-               return;
-       }
-       list_del(&tmp->list);
-       INIT_LIST_HEAD(&tmp->list);
-       if (tmp->fence)
+       if (!tmp->fence->emited)
                radeon_fence_unref(&tmp->fence);
-
-       tmp->length_dw = 0;
-       clear_bit(tmp->idx, rdev->ib_pool.alloc_bm);
+       mutex_lock(&rdev->ib_pool.mutex);
+       tmp->free = true;
        mutex_unlock(&rdev->ib_pool.mutex);
 }
 
@@ -135,7 +113,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib)
 
        if (!ib->length_dw || !rdev->cp.ready) {
                /* TODO: Nothings in the ib we should report. */
-               DRM_ERROR("radeon: couldn't schedule IB(%lu).\n", ib->idx);
+               DRM_ERROR("radeon: couldn't schedule IB(%u).\n", ib->idx);
                return -EINVAL;
        }
 
@@ -148,7 +126,8 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib)
        radeon_ring_ib_execute(rdev, ib);
        radeon_fence_emit(rdev, ib->fence);
        mutex_lock(&rdev->ib_pool.mutex);
-       list_add_tail(&ib->list, &rdev->ib_pool.scheduled_ibs);
+       /* once scheduled IB is considered free and protected by the fence */
+       ib->free = true;
        mutex_unlock(&rdev->ib_pool.mutex);
        radeon_ring_unlock_commit(rdev);
        return 0;
@@ -164,7 +143,6 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
        if (rdev->ib_pool.robj)
                return 0;
        /* Allocate 1M object buffer */
-       INIT_LIST_HEAD(&rdev->ib_pool.scheduled_ibs);
        r = radeon_bo_create(rdev, NULL,  RADEON_IB_POOL_SIZE*64*1024,
                                true, RADEON_GEM_DOMAIN_GTT,
                                &rdev->ib_pool.robj);
@@ -195,9 +173,9 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
                rdev->ib_pool.ibs[i].ptr = ptr + offset;
                rdev->ib_pool.ibs[i].idx = i;
                rdev->ib_pool.ibs[i].length_dw = 0;
-               INIT_LIST_HEAD(&rdev->ib_pool.ibs[i].list);
+               rdev->ib_pool.ibs[i].free = true;
        }
-       bitmap_zero(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
+       rdev->ib_pool.head_id = 0;
        rdev->ib_pool.ready = true;
        DRM_INFO("radeon: ib pool ready.\n");
        if (radeon_debugfs_ib_init(rdev)) {
@@ -214,7 +192,6 @@ void radeon_ib_pool_fini(struct radeon_device *rdev)
                return;
        }
        mutex_lock(&rdev->ib_pool.mutex);
-       bitmap_zero(rdev->ib_pool.alloc_bm, RADEON_IB_POOL_SIZE);
        if (rdev->ib_pool.robj) {
                r = radeon_bo_reserve(rdev->ib_pool.robj, false);
                if (likely(r == 0)) {
@@ -363,7 +340,7 @@ static int radeon_debugfs_ib_info(struct seq_file *m, void *data)
        if (ib == NULL) {
                return 0;
        }
-       seq_printf(m, "IB %04lu\n", ib->idx);
+       seq_printf(m, "IB %04u\n", ib->idx);
        seq_printf(m, "IB fence %p\n", ib->fence);
        seq_printf(m, "IB size %05u dwords\n", ib->length_dw);
        for (i = 0; i < ib->length_dw; i++) {
index 3b0c07b444a2ee6f03c582f2da64556ed7876f1a..58b5adf974ca8bac6434025e3962443af28c0d3b 100644 (file)
@@ -215,7 +215,10 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo,
        rbo = container_of(bo, struct radeon_bo, tbo);
        switch (bo->mem.mem_type) {
        case TTM_PL_VRAM:
-               radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT);
+               if (rbo->rdev->cp.ready == false)
+                       radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_CPU);
+               else
+                       radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT);
                break;
        case TTM_PL_TT:
        default:
index 6021c8849a169bec6e6ca064a04d761fa639880c..c29ac434ac9c81ae10141613d6d994ce63324d23 100644 (file)
@@ -91,6 +91,8 @@ r200 0x3294
 0x22b8 SE_TCL_TEX_CYL_WRAP_CTL
 0x22c0 SE_TCL_UCP_VERT_BLEND_CNTL
 0x22c4 SE_TCL_POINT_SPRITE_CNTL
+0x22d0 SE_PVS_CNTL
+0x22d4 SE_PVS_CONST_CNTL
 0x2648 RE_POINTSIZE
 0x26c0 RE_TOP_LEFT
 0x26c4 RE_MISC
index 9f5418983e2a5f30af108287aaa18f19d6bc70b3..287fcebfb4e67733ff27aef939380b5b92f3a742 100644 (file)
@@ -223,15 +223,31 @@ int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr)
        return 0;
 }
 
+int rs400_mc_wait_for_idle(struct radeon_device *rdev)
+{
+       unsigned i;
+       uint32_t tmp;
+
+       for (i = 0; i < rdev->usec_timeout; i++) {
+               /* read MC_STATUS */
+               tmp = RREG32(0x0150);
+               if (tmp & (1 << 2)) {
+                       return 0;
+               }
+               DRM_UDELAY(1);
+       }
+       return -1;
+}
+
 void rs400_gpu_init(struct radeon_device *rdev)
 {
        /* FIXME: HDP same place on rs400 ? */
        r100_hdp_reset(rdev);
        /* FIXME: is this correct ? */
        r420_pipes_init(rdev);
-       if (r300_mc_wait_for_idle(rdev)) {
-               printk(KERN_WARNING "Failed to wait MC idle while "
-                      "programming pipes. Bad things might happen.\n");
+       if (rs400_mc_wait_for_idle(rdev)) {
+               printk(KERN_WARNING "rs400: Failed to wait MC idle while "
+                      "programming pipes. Bad things might happen. %08x\n", RREG32(0x150));
        }
 }
 
@@ -370,8 +386,8 @@ void rs400_mc_program(struct radeon_device *rdev)
        r100_mc_stop(rdev, &save);
 
        /* Wait for mc idle */
-       if (r300_mc_wait_for_idle(rdev))
-               dev_warn(rdev->dev, "Wait MC idle timeout before updating MC.\n");
+       if (rs400_mc_wait_for_idle(rdev))
+               dev_warn(rdev->dev, "rs400: Wait MC idle timeout before updating MC.\n");
        WREG32(R_000148_MC_FB_LOCATION,
                S_000148_MC_FB_START(rdev->mc.vram_start >> 16) |
                S_000148_MC_FB_TOP(rdev->mc.vram_end >> 16));
@@ -448,7 +464,6 @@ int rs400_suspend(struct radeon_device *rdev)
 
 void rs400_fini(struct radeon_device *rdev)
 {
-       rs400_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -527,7 +542,6 @@ int rs400_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               rs400_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
index d5255751e7b365b5c987561f9f3bebb74e87a441..c3818562a13eb64f647ec74922605bf673bdf0e6 100644 (file)
@@ -610,7 +610,6 @@ int rs600_suspend(struct radeon_device *rdev)
 
 void rs600_fini(struct radeon_device *rdev)
 {
-       rs600_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -689,7 +688,6 @@ int rs600_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               rs600_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
index cd31da913771d898c3d68946f0f8f3399becf382..06e2771aee5a8443b94e44e80da3c3b7928590b5 100644 (file)
@@ -676,7 +676,6 @@ int rs690_suspend(struct radeon_device *rdev)
 
 void rs690_fini(struct radeon_device *rdev)
 {
-       rs690_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -756,7 +755,6 @@ int rs690_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               rs690_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
index 62756717b0449bdbc3be45ec40f4cd2bc99e1058..0e1e6b8632b86c0e1b6d9665f831f684c11c1dcc 100644 (file)
@@ -537,7 +537,6 @@ void rv515_set_safe_registers(struct radeon_device *rdev)
 
 void rv515_fini(struct radeon_device *rdev)
 {
-       rv515_suspend(rdev);
        r100_cp_fini(rdev);
        r100_wb_fini(rdev);
        r100_ib_fini(rdev);
@@ -615,13 +614,12 @@ int rv515_init(struct radeon_device *rdev)
        if (r) {
                /* Somethings want wront with the accel init stop accel */
                dev_err(rdev->dev, "Disabling GPU acceleration\n");
-               rv515_suspend(rdev);
                r100_cp_fini(rdev);
                r100_wb_fini(rdev);
                r100_ib_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                rv370_pcie_gart_fini(rdev);
                radeon_agp_fini(rdev);
-               radeon_irq_kms_fini(rdev);
                rdev->accel_working = false;
        }
        return 0;
index 59c71245fb91e66d0429dd31cb8da36ef57015b6..03021674d097bac2605debedfff0987bfda7377b 100644 (file)
@@ -549,9 +549,12 @@ static void rv770_gpu_init(struct radeon_device *rdev)
 
        gb_tiling_config |= BANK_SWAPS(1);
 
-       backend_map = r700_get_tile_pipe_to_backend_map(rdev->config.rv770.max_tile_pipes,
-                                                       rdev->config.rv770.max_backends,
-                                                       (0xff << rdev->config.rv770.max_backends) & 0xff);
+       if (rdev->family == CHIP_RV740)
+               backend_map = 0x28;
+       else
+               backend_map = r700_get_tile_pipe_to_backend_map(rdev->config.rv770.max_tile_pipes,
+                                                               rdev->config.rv770.max_backends,
+                                                               (0xff << rdev->config.rv770.max_backends) & 0xff);
        gb_tiling_config |= BACKEND_MAP(backend_map);
 
        cc_gc_shader_pipe_config =
@@ -779,7 +782,6 @@ int rv770_mc_init(struct radeon_device *rdev)
        fixed20_12 a;
        u32 tmp;
        int chansize, numchan;
-       int r;
 
        /* Get VRAM informations */
        rdev->mc.vram_is_ddr = true;
@@ -822,9 +824,6 @@ int rv770_mc_init(struct radeon_device *rdev)
                rdev->mc.real_vram_size = rdev->mc.aper_size;
 
        if (rdev->flags & RADEON_IS_AGP) {
-               r = radeon_agp_init(rdev);
-               if (r)
-                       return r;
                /* gtt_size is setup by radeon_agp_init */
                rdev->mc.gtt_location = rdev->mc.agp_base;
                tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
@@ -891,26 +890,25 @@ static int rv770_startup(struct radeon_device *rdev)
                        return r;
        }
        rv770_gpu_init(rdev);
-
-       if (!rdev->r600_blit.shader_obj) {
-               r = r600_blit_init(rdev);
+       r = r600_blit_init(rdev);
+       if (r) {
+               r600_blit_fini(rdev);
+               rdev->asic->copy = NULL;
+               dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
+       }
+       /* pin copy shader into vram */
+       if (rdev->r600_blit.shader_obj) {
+               r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
+               if (unlikely(r != 0))
+                       return r;
+               r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
+                               &rdev->r600_blit.shader_gpu_addr);
+               radeon_bo_unreserve(rdev->r600_blit.shader_obj);
                if (r) {
-                       DRM_ERROR("radeon: failed blitter (%d).\n", r);
+                       DRM_ERROR("failed to pin blit object %d\n", r);
                        return r;
                }
        }
-
-       r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
-       if (unlikely(r != 0))
-               return r;
-       r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
-                       &rdev->r600_blit.shader_gpu_addr);
-       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
-       if (r) {
-               DRM_ERROR("failed to pin blit object %d\n", r);
-               return r;
-       }
-
        /* Enable IRQ */
        r = r600_irq_init(rdev);
        if (r) {
@@ -972,13 +970,16 @@ int rv770_suspend(struct radeon_device *rdev)
        /* FIXME: we should wait for ring to be empty */
        r700_cp_stop(rdev);
        rdev->cp.ready = false;
+       r600_irq_suspend(rdev);
        r600_wb_disable(rdev);
        rv770_pcie_gart_disable(rdev);
        /* unpin shaders bo */
-       r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
-       if (likely(r == 0)) {
-               radeon_bo_unpin(rdev->r600_blit.shader_obj);
-               radeon_bo_unreserve(rdev->r600_blit.shader_obj);
+       if (rdev->r600_blit.shader_obj) {
+               r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
+               if (likely(r == 0)) {
+                       radeon_bo_unpin(rdev->r600_blit.shader_obj);
+                       radeon_bo_unreserve(rdev->r600_blit.shader_obj);
+               }
        }
        return 0;
 }
@@ -1037,6 +1038,11 @@ int rv770_init(struct radeon_device *rdev)
        r = radeon_fence_driver_init(rdev);
        if (r)
                return r;
+       if (rdev->flags & RADEON_IS_AGP) {
+               r = radeon_agp_init(rdev);
+               if (r)
+                       radeon_agp_disable(rdev);
+       }
        r = rv770_mc_init(rdev);
        if (r)
                return r;
@@ -1062,22 +1068,25 @@ int rv770_init(struct radeon_device *rdev)
        rdev->accel_working = true;
        r = rv770_startup(rdev);
        if (r) {
-               rv770_suspend(rdev);
+               dev_err(rdev->dev, "disabling GPU acceleration\n");
+               r600_cp_fini(rdev);
                r600_wb_fini(rdev);
-               radeon_ring_fini(rdev);
+               r600_irq_fini(rdev);
+               radeon_irq_kms_fini(rdev);
                rv770_pcie_gart_fini(rdev);
                rdev->accel_working = false;
        }
        if (rdev->accel_working) {
                r = radeon_ib_pool_init(rdev);
                if (r) {
-                       DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r);
-                       rdev->accel_working = false;
-               }
-               r = r600_ib_test(rdev);
-               if (r) {
-                       DRM_ERROR("radeon: failed testing IB (%d).\n", r);
+                       dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
                        rdev->accel_working = false;
+               } else {
+                       r = r600_ib_test(rdev);
+                       if (r) {
+                               dev_err(rdev->dev, "IB test failed (%d).\n", r);
+                               rdev->accel_working = false;
+                       }
                }
        }
        return 0;
@@ -1085,13 +1094,11 @@ int rv770_init(struct radeon_device *rdev)
 
 void rv770_fini(struct radeon_device *rdev)
 {
-       rv770_suspend(rdev);
-
        r600_blit_fini(rdev);
+       r600_cp_fini(rdev);
+       r600_wb_fini(rdev);
        r600_irq_fini(rdev);
        radeon_irq_kms_fini(rdev);
-       radeon_ring_fini(rdev);
-       r600_wb_fini(rdev);
        rv770_pcie_gart_fini(rdev);
        radeon_gem_fini(rdev);
        radeon_fence_driver_fini(rdev);
index 2920f9a279e141aa9fd1ccc38cc0bfcb586c5f59..c7320ce4567de25569eb23c6fe352ae9f62a3bf9 100644 (file)
@@ -426,7 +426,8 @@ moved:
                    bdev->man[bo->mem.mem_type].gpu_offset;
                bo->cur_placement = bo->mem.placement;
                spin_unlock(&bo->lock);
-       }
+       } else
+               bo->offset = 0;
 
        return 0;
 
@@ -523,52 +524,44 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
 static int ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)
 {
        struct ttm_bo_global *glob = bdev->glob;
-       struct ttm_buffer_object *entry, *nentry;
-       struct list_head *list, *next;
-       int ret;
+       struct ttm_buffer_object *entry = NULL;
+       int ret = 0;
 
        spin_lock(&glob->lru_lock);
-       list_for_each_safe(list, next, &bdev->ddestroy) {
-               entry = list_entry(list, struct ttm_buffer_object, ddestroy);
-               nentry = NULL;
+       if (list_empty(&bdev->ddestroy))
+               goto out_unlock;
 
-               /*
-                * Protect the next list entry from destruction while we
-                * unlock the lru_lock.
-                */
+       entry = list_first_entry(&bdev->ddestroy,
+               struct ttm_buffer_object, ddestroy);
+       kref_get(&entry->list_kref);
 
-               if (next != &bdev->ddestroy) {
-                       nentry = list_entry(next, struct ttm_buffer_object,
-                                           ddestroy);
+       for (;;) {
+               struct ttm_buffer_object *nentry = NULL;
+
+               if (entry->ddestroy.next != &bdev->ddestroy) {
+                       nentry = list_first_entry(&entry->ddestroy,
+                               struct ttm_buffer_object, ddestroy);
                        kref_get(&nentry->list_kref);
                }
-               kref_get(&entry->list_kref);
 
                spin_unlock(&glob->lru_lock);
                ret = ttm_bo_cleanup_refs(entry, remove_all);
                kref_put(&entry->list_kref, ttm_bo_release_list);
+               entry = nentry;
+
+               if (ret || !entry)
+                       goto out;
 
                spin_lock(&glob->lru_lock);
-               if (nentry) {
-                       bool next_onlist = !list_empty(next);
-                       spin_unlock(&glob->lru_lock);
-                       kref_put(&nentry->list_kref, ttm_bo_release_list);
-                       spin_lock(&glob->lru_lock);
-                       /*
-                        * Someone might have raced us and removed the
-                        * next entry from the list. We don't bother restarting
-                        * list traversal.
-                        */
-
-                       if (!next_onlist)
-                               break;
-               }
-               if (ret)
+               if (list_empty(&entry->ddestroy))
                        break;
        }
-       ret = !list_empty(&bdev->ddestroy);
-       spin_unlock(&glob->lru_lock);
 
+out_unlock:
+       spin_unlock(&glob->lru_lock);
+out:
+       if (entry)
+               kref_put(&entry->list_kref, ttm_bo_release_list);
        return ret;
 }
 
@@ -950,6 +943,14 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
                ttm_flag_masked(&cur_flags, placement->busy_placement[i],
                                ~TTM_PL_MASK_MEMTYPE);
 
+
+               if (mem_type == TTM_PL_SYSTEM) {
+                       mem->mem_type = mem_type;
+                       mem->placement = cur_flags;
+                       mem->mm_node = NULL;
+                       return 0;
+               }
+
                ret = ttm_bo_mem_force_space(bo, mem_type, placement, mem,
                                                interruptible, no_wait);
                if (ret == 0 && mem->mm_node) {
@@ -1019,6 +1020,12 @@ static int ttm_bo_mem_compat(struct ttm_placement *placement,
                             struct ttm_mem_reg *mem)
 {
        int i;
+       struct drm_mm_node *node = mem->mm_node;
+
+       if (node && placement->lpfn != 0 &&
+           (node->start < placement->fpfn ||
+            node->start + node->size > placement->lpfn))
+               return -1;
 
        for (i = 0; i < placement->num_placement; i++) {
                if ((placement->placement[i] & mem->placement &
@@ -1844,6 +1851,9 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
         * anyone tries to access a ttm page.
         */
 
+       if (bo->bdev->driver->swap_notify)
+               bo->bdev->driver->swap_notify(bo);
+
        ret = ttm_tt_swapout(bo->ttm, bo->persistant_swap_storage);
 out:
 
@@ -1864,3 +1874,4 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
        while (ttm_bo_swapout(&bdev->glob->shrink) == 0)
                ;
 }
+EXPORT_SYMBOL(ttm_bo_swapout_all);
index 2ecf7d0c64f63102bc512a80b2a340011bff8eec..5ca37a58a98c80be24beb227cef980f2cdbf7abf 100644 (file)
@@ -53,7 +53,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
 {
        struct ttm_tt *ttm = bo->ttm;
        struct ttm_mem_reg *old_mem = &bo->mem;
-       uint32_t save_flags = old_mem->placement;
        int ret;
 
        if (old_mem->mem_type != TTM_PL_SYSTEM) {
@@ -62,7 +61,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
                ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
                                TTM_PL_MASK_MEM);
                old_mem->mem_type = TTM_PL_SYSTEM;
-               save_flags = old_mem->placement;
        }
 
        ret = ttm_tt_set_placement_caching(ttm, new_mem->placement);
@@ -77,7 +75,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
 
        *old_mem = *new_mem;
        new_mem->mm_node = NULL;
-       ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE);
+
        return 0;
 }
 EXPORT_SYMBOL(ttm_bo_move_ttm);
@@ -219,7 +217,6 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
        void *old_iomap;
        void *new_iomap;
        int ret;
-       uint32_t save_flags = old_mem->placement;
        unsigned long i;
        unsigned long page;
        unsigned long add = 0;
@@ -270,7 +267,6 @@ out2:
 
        *old_mem = *new_mem;
        new_mem->mm_node = NULL;
-       ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE);
 
        if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {
                ttm_tt_unbind(ttm);
@@ -537,7 +533,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
        struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type];
        struct ttm_mem_reg *old_mem = &bo->mem;
        int ret;
-       uint32_t save_flags = old_mem->placement;
        struct ttm_buffer_object *ghost_obj;
        void *tmp_obj = NULL;
 
@@ -598,7 +593,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
 
        *old_mem = *new_mem;
        new_mem->mm_node = NULL;
-       ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE);
+
        return 0;
 }
 EXPORT_SYMBOL(ttm_bo_move_accel_cleanup);
index f619ebcaa4ecf8a14198eab87b907c5b9162ccb8..3d172ef04ee11aceb7276a686f31b1c19daa66e1 100644 (file)
@@ -288,6 +288,7 @@ void ttm_suspend_unlock(struct ttm_lock *lock)
        wake_up_all(&lock->queue);
        spin_unlock(&lock->lock);
 }
+EXPORT_SYMBOL(ttm_suspend_unlock);
 
 static bool __ttm_suspend_lock(struct ttm_lock *lock)
 {
@@ -309,3 +310,4 @@ void ttm_suspend_lock(struct ttm_lock *lock)
 {
        wait_event(lock->queue, __ttm_suspend_lock(lock));
 }
+EXPORT_SYMBOL(ttm_suspend_lock);
index 1099abac824b16ee35931f8631e375bffb1edb35..75e9d6f86ba45429f75f61067805b8abbde7b626 100644 (file)
@@ -109,8 +109,8 @@ struct ttm_ref_object {
        struct drm_hash_item hash;
        struct list_head head;
        struct kref kref;
-       struct ttm_base_object *obj;
        enum ttm_ref_type ref_type;
+       struct ttm_base_object *obj;
        struct ttm_object_file *tfile;
 };
 
index 9c2b1cc5dba5a10b586d4c8b9a6dc6ffeb02a376..3d47a2c12322173fa3621e9cb5886408dcb1c19e 100644 (file)
@@ -196,23 +196,34 @@ EXPORT_SYMBOL(ttm_tt_populate);
 
 #ifdef CONFIG_X86
 static inline int ttm_tt_set_page_caching(struct page *p,
-                                         enum ttm_caching_state c_state)
+                                         enum ttm_caching_state c_old,
+                                         enum ttm_caching_state c_new)
 {
+       int ret = 0;
+
        if (PageHighMem(p))
                return 0;
 
-       switch (c_state) {
-       case tt_cached:
-               return set_pages_wb(p, 1);
-       case tt_wc:
-           return set_memory_wc((unsigned long) page_address(p), 1);
-       default:
-               return set_pages_uc(p, 1);
+       if (c_old != tt_cached) {
+               /* p isn't in the default caching state, set it to
+                * writeback first to free its current memtype. */
+
+               ret = set_pages_wb(p, 1);
+               if (ret)
+                       return ret;
        }
+
+       if (c_new == tt_wc)
+               ret = set_memory_wc((unsigned long) page_address(p), 1);
+       else if (c_new == tt_uncached)
+               ret = set_pages_uc(p, 1);
+
+       return ret;
 }
 #else /* CONFIG_X86 */
 static inline int ttm_tt_set_page_caching(struct page *p,
-                                         enum ttm_caching_state c_state)
+                                         enum ttm_caching_state c_old,
+                                         enum ttm_caching_state c_new)
 {
        return 0;
 }
@@ -245,7 +256,9 @@ static int ttm_tt_set_caching(struct ttm_tt *ttm,
        for (i = 0; i < ttm->num_pages; ++i) {
                cur_page = ttm->pages[i];
                if (likely(cur_page != NULL)) {
-                       ret = ttm_tt_set_page_caching(cur_page, c_state);
+                       ret = ttm_tt_set_page_caching(cur_page,
+                                                     ttm->caching_state,
+                                                     c_state);
                        if (unlikely(ret != 0))
                                goto out_err;
                }
@@ -259,7 +272,7 @@ out_err:
        for (j = 0; j < i; ++j) {
                cur_page = ttm->pages[j];
                if (likely(cur_page != NULL)) {
-                       (void)ttm_tt_set_page_caching(cur_page,
+                       (void)ttm_tt_set_page_caching(cur_page, c_state,
                                                      ttm->caching_state);
                }
        }
index d6f2d2b882e9b074810a919377d734a956a52d78..825ebe3d89d573c384dc3181e56b988e7bfeea55 100644 (file)
@@ -48,6 +48,15 @@ struct ttm_placement vmw_vram_placement = {
        .busy_placement = &vram_placement_flags
 };
 
+struct ttm_placement vmw_vram_sys_placement = {
+       .fpfn = 0,
+       .lpfn = 0,
+       .num_placement = 1,
+       .placement = &vram_placement_flags,
+       .num_busy_placement = 1,
+       .busy_placement = &sys_placement_flags
+};
+
 struct ttm_placement vmw_vram_ne_placement = {
        .fpfn = 0,
        .lpfn = 0,
@@ -172,6 +181,18 @@ static int vmw_verify_access(struct ttm_buffer_object *bo, struct file *filp)
        return 0;
 }
 
+static void vmw_move_notify(struct ttm_buffer_object *bo,
+                    struct ttm_mem_reg *new_mem)
+{
+       if (new_mem->mem_type != TTM_PL_SYSTEM)
+               vmw_dmabuf_gmr_unbind(bo);
+}
+
+static void vmw_swap_notify(struct ttm_buffer_object *bo)
+{
+       vmw_dmabuf_gmr_unbind(bo);
+}
+
 /**
  * FIXME: We're using the old vmware polling method to sync.
  * Do this with fences instead.
@@ -225,5 +246,7 @@ struct ttm_bo_driver vmw_bo_driver = {
        .sync_obj_wait = vmw_sync_obj_wait,
        .sync_obj_flush = vmw_sync_obj_flush,
        .sync_obj_unref = vmw_sync_obj_unref,
-       .sync_obj_ref = vmw_sync_obj_ref
+       .sync_obj_ref = vmw_sync_obj_ref,
+       .move_notify = vmw_move_notify,
+       .swap_notify = vmw_swap_notify
 };
index 1db1ef30be2b2b87fbef3ee08df4f98c345421bb..0c9c0811f42dd03b9c92d0ea154e249b8ed3b397 100644 (file)
@@ -147,6 +147,8 @@ static char *vmw_devname = "vmwgfx";
 
 static int vmw_probe(struct pci_dev *, const struct pci_device_id *);
 static void vmw_master_init(struct vmw_master *);
+static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
+                             void *ptr);
 
 static void vmw_print_capabilities(uint32_t capabilities)
 {
@@ -207,6 +209,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 {
        struct vmw_private *dev_priv;
        int ret;
+       uint32_t svga_id;
 
        dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
        if (unlikely(dev_priv == NULL)) {
@@ -217,6 +220,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 
        dev_priv->dev = dev;
        dev_priv->vmw_chipset = chipset;
+       dev_priv->last_read_sequence = (uint32_t) -100;
        mutex_init(&dev_priv->hw_mutex);
        mutex_init(&dev_priv->cmdbuf_mutex);
        rwlock_init(&dev_priv->resource_lock);
@@ -236,6 +240,16 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
        dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
 
        mutex_lock(&dev_priv->hw_mutex);
+
+       vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
+       svga_id = vmw_read(dev_priv, SVGA_REG_ID);
+       if (svga_id != SVGA_ID_2) {
+               ret = -ENOSYS;
+               DRM_ERROR("Unsuported SVGA ID 0x%x\n", svga_id);
+               mutex_unlock(&dev_priv->hw_mutex);
+               goto out_err0;
+       }
+
        dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES);
 
        if (dev_priv->capabilities & SVGA_CAP_GMR) {
@@ -334,22 +348,24 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
                 */
 
                DRM_INFO("It appears like vesafb is loaded. "
-                        "Ignore above error if any. Entering stealth mode.\n");
+                        "Ignore above error if any.\n");
                ret = pci_request_region(dev->pdev, 2, "vmwgfx stealth probe");
                if (unlikely(ret != 0)) {
                        DRM_ERROR("Failed reserving the SVGA MMIO resource.\n");
                        goto out_no_device;
                }
-               vmw_kms_init(dev_priv);
-               vmw_overlay_init(dev_priv);
-       } else {
-               ret = vmw_request_device(dev_priv);
-               if (unlikely(ret != 0))
-                       goto out_no_device;
-               vmw_kms_init(dev_priv);
-               vmw_overlay_init(dev_priv);
-               vmw_fb_init(dev_priv);
        }
+       ret = vmw_request_device(dev_priv);
+       if (unlikely(ret != 0))
+               goto out_no_device;
+       vmw_kms_init(dev_priv);
+       vmw_overlay_init(dev_priv);
+       vmw_fb_init(dev_priv);
+
+       dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier;
+       register_pm_notifier(&dev_priv->pm_nb);
+
+       DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n");
 
        return 0;
 
@@ -385,17 +401,17 @@ static int vmw_driver_unload(struct drm_device *dev)
 
        DRM_INFO(VMWGFX_DRIVER_NAME " unload.\n");
 
-       if (!dev_priv->stealth) {
-               vmw_fb_close(dev_priv);
-               vmw_kms_close(dev_priv);
-               vmw_overlay_close(dev_priv);
-               vmw_release_device(dev_priv);
-               pci_release_regions(dev->pdev);
-       } else {
-               vmw_kms_close(dev_priv);
-               vmw_overlay_close(dev_priv);
+       unregister_pm_notifier(&dev_priv->pm_nb);
+
+       vmw_fb_close(dev_priv);
+       vmw_kms_close(dev_priv);
+       vmw_overlay_close(dev_priv);
+       vmw_release_device(dev_priv);
+       if (dev_priv->stealth)
                pci_release_region(dev->pdev, 2);
-       }
+       else
+               pci_release_regions(dev->pdev);
+
        if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
                drm_irq_uninstall(dev_priv->dev);
        if (dev->devname == vmw_devname)
@@ -564,11 +580,6 @@ static int vmw_master_set(struct drm_device *dev,
        int ret = 0;
 
        DRM_INFO("Master set.\n");
-       if (dev_priv->stealth) {
-               ret = vmw_request_device(dev_priv);
-               if (unlikely(ret != 0))
-                       return ret;
-       }
 
        if (active) {
                BUG_ON(active != &dev_priv->fbdev_master);
@@ -628,18 +639,11 @@ static void vmw_master_drop(struct drm_device *dev,
 
        ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
 
-       if (dev_priv->stealth) {
-               ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM);
-               if (unlikely(ret != 0))
-                       DRM_ERROR("Unable to clean VRAM on master drop.\n");
-               vmw_release_device(dev_priv);
-       }
        dev_priv->active_master = &dev_priv->fbdev_master;
        ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
        ttm_vt_unlock(&dev_priv->fbdev_master.lock);
 
-       if (!dev_priv->stealth)
-               vmw_fb_on(dev_priv);
+       vmw_fb_on(dev_priv);
 }
 
 
@@ -650,6 +654,57 @@ static void vmw_remove(struct pci_dev *pdev)
        drm_put_dev(dev);
 }
 
+static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
+                             void *ptr)
+{
+       struct vmw_private *dev_priv =
+               container_of(nb, struct vmw_private, pm_nb);
+       struct vmw_master *vmaster = dev_priv->active_master;
+
+       switch (val) {
+       case PM_HIBERNATION_PREPARE:
+       case PM_SUSPEND_PREPARE:
+               ttm_suspend_lock(&vmaster->lock);
+
+               /**
+                * This empties VRAM and unbinds all GMR bindings.
+                * Buffer contents is moved to swappable memory.
+                */
+               ttm_bo_swapout_all(&dev_priv->bdev);
+               break;
+       case PM_POST_HIBERNATION:
+       case PM_POST_SUSPEND:
+               ttm_suspend_unlock(&vmaster->lock);
+               break;
+       case PM_RESTORE_PREPARE:
+               break;
+       case PM_POST_RESTORE:
+               break;
+       default:
+               break;
+       }
+       return 0;
+}
+
+/**
+ * These might not be needed with the virtual SVGA device.
+ */
+
+int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+       pci_save_state(pdev);
+       pci_disable_device(pdev);
+       pci_set_power_state(pdev, PCI_D3hot);
+       return 0;
+}
+
+int vmw_pci_resume(struct pci_dev *pdev)
+{
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       return pci_enable_device(pdev);
+}
+
 static struct drm_driver driver = {
        .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
        DRIVER_MODESET,
@@ -689,7 +744,9 @@ static struct drm_driver driver = {
                       .name = VMWGFX_DRIVER_NAME,
                       .id_table = vmw_pci_id_list,
                       .probe = vmw_probe,
-                      .remove = vmw_remove
+                      .remove = vmw_remove,
+                      .suspend = vmw_pci_suspend,
+                      .resume = vmw_pci_resume
                       },
        .name = VMWGFX_DRIVER_NAME,
        .desc = VMWGFX_DRIVER_DESC,
index e61bd85b6975abe693d2e64cf2de7438c7a6bf50..356dc935ec133f974c2c95e2be5d1146cd07c9a9 100644 (file)
 #include "drmP.h"
 #include "vmwgfx_drm.h"
 #include "drm_hashtab.h"
+#include "linux/suspend.h"
 #include "ttm/ttm_bo_driver.h"
 #include "ttm/ttm_object.h"
 #include "ttm/ttm_lock.h"
 #include "ttm/ttm_execbuf_util.h"
 #include "ttm/ttm_module.h"
 
-#define VMWGFX_DRIVER_DATE "20090724"
-#define VMWGFX_DRIVER_MAJOR 0
-#define VMWGFX_DRIVER_MINOR 1
-#define VMWGFX_DRIVER_PATCHLEVEL 2
+#define VMWGFX_DRIVER_DATE "20100209"
+#define VMWGFX_DRIVER_MAJOR 1
+#define VMWGFX_DRIVER_MINOR 0
+#define VMWGFX_DRIVER_PATCHLEVEL 0
 #define VMWGFX_FILE_PAGE_OFFSET 0x00100000
 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
 #define VMWGFX_MAX_RELOCATIONS 2048
@@ -95,6 +96,8 @@ struct vmw_surface {
        struct drm_vmw_size *sizes;
        uint32_t num_sizes;
 
+       bool scanout;
+
        /* TODO so far just a extra pointer */
        struct vmw_cursor_snooper snooper;
 };
@@ -110,6 +113,7 @@ struct vmw_fifo_state {
        unsigned long static_buffer_size;
        bool using_bounce_buffer;
        uint32_t capabilities;
+       struct mutex fifo_mutex;
        struct rw_semaphore rwsem;
 };
 
@@ -210,7 +214,7 @@ struct vmw_private {
         * Fencing and IRQs.
         */
 
-       uint32_t fence_seq;
+       atomic_t fence_seq;
        wait_queue_head_t fence_queue;
        wait_queue_head_t fifo_queue;
        atomic_t fence_queue_waiters;
@@ -258,6 +262,7 @@ struct vmw_private {
 
        struct vmw_master *active_master;
        struct vmw_master fbdev_master;
+       struct notifier_block pm_nb;
 };
 
 static inline struct vmw_private *vmw_priv(struct drm_device *dev)
@@ -353,6 +358,7 @@ extern int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv,
                                       struct vmw_dma_buffer *bo);
 extern int vmw_dmabuf_from_vram(struct vmw_private *vmw_priv,
                                struct vmw_dma_buffer *bo);
+extern void vmw_dmabuf_gmr_unbind(struct ttm_buffer_object *bo);
 extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
                                  struct drm_file *file_priv);
 extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
@@ -386,6 +392,7 @@ extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
                               uint32_t *sequence);
 extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
 extern int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma);
+extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
 
 /**
  * TTM glue - vmwgfx_ttm_glue.c
@@ -401,6 +408,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
 
 extern struct ttm_placement vmw_vram_placement;
 extern struct ttm_placement vmw_vram_ne_placement;
+extern struct ttm_placement vmw_vram_sys_placement;
 extern struct ttm_placement vmw_sys_placement;
 extern struct ttm_bo_driver vmw_bo_driver;
 extern int vmw_dma_quiescent(struct drm_device *dev);
index 2e92da5674033cd1af7d1e658d8ac5fa9c5d0a0a..0897359b3e4e27550dbe2d767e2ca3a50be49c14 100644 (file)
@@ -182,25 +182,19 @@ static int vmw_cmd_present_check(struct vmw_private *dev_priv,
        return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.sid);
 }
 
-static int vmw_cmd_dma(struct vmw_private *dev_priv,
-                      struct vmw_sw_context *sw_context,
-                      SVGA3dCmdHeader *header)
+static int vmw_translate_guest_ptr(struct vmw_private *dev_priv,
+                                  struct vmw_sw_context *sw_context,
+                                  SVGAGuestPtr *ptr,
+                                  struct vmw_dma_buffer **vmw_bo_p)
 {
-       uint32_t handle;
        struct vmw_dma_buffer *vmw_bo = NULL;
        struct ttm_buffer_object *bo;
-       struct vmw_surface *srf = NULL;
-       struct vmw_dma_cmd {
-               SVGA3dCmdHeader header;
-               SVGA3dCmdSurfaceDMA dma;
-       } *cmd;
+       uint32_t handle = ptr->gmrId;
        struct vmw_relocation *reloc;
-       int ret;
        uint32_t cur_validate_node;
        struct ttm_validate_buffer *val_buf;
+       int ret;
 
-       cmd = container_of(header, struct vmw_dma_cmd, header);
-       handle = cmd->dma.guest.ptr.gmrId;
        ret = vmw_user_dmabuf_lookup(sw_context->tfile, handle, &vmw_bo);
        if (unlikely(ret != 0)) {
                DRM_ERROR("Could not find or use GMR region.\n");
@@ -209,14 +203,14 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
        bo = &vmw_bo->base;
 
        if (unlikely(sw_context->cur_reloc >= VMWGFX_MAX_RELOCATIONS)) {
-               DRM_ERROR("Max number of DMA commands per submission"
+               DRM_ERROR("Max number relocations per submission"
                          " exceeded\n");
                ret = -EINVAL;
                goto out_no_reloc;
        }
 
        reloc = &sw_context->relocs[sw_context->cur_reloc++];
-       reloc->location = &cmd->dma.guest.ptr;
+       reloc->location = ptr;
 
        cur_validate_node = vmw_dmabuf_validate_node(bo, sw_context->cur_val_buf);
        if (unlikely(cur_validate_node >= VMWGFX_MAX_GMRS)) {
@@ -234,7 +228,89 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
                list_add_tail(&val_buf->head, &sw_context->validate_nodes);
                ++sw_context->cur_val_buf;
        }
+       *vmw_bo_p = vmw_bo;
+       return 0;
+
+out_no_reloc:
+       vmw_dmabuf_unreference(&vmw_bo);
+       vmw_bo_p = NULL;
+       return ret;
+}
+
+static int vmw_cmd_end_query(struct vmw_private *dev_priv,
+                            struct vmw_sw_context *sw_context,
+                            SVGA3dCmdHeader *header)
+{
+       struct vmw_dma_buffer *vmw_bo;
+       struct vmw_query_cmd {
+               SVGA3dCmdHeader header;
+               SVGA3dCmdEndQuery q;
+       } *cmd;
+       int ret;
 
+       cmd = container_of(header, struct vmw_query_cmd, header);
+       ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
+       if (unlikely(ret != 0))
+               return ret;
+
+       ret = vmw_translate_guest_ptr(dev_priv, sw_context,
+                                     &cmd->q.guestResult,
+                                     &vmw_bo);
+       if (unlikely(ret != 0))
+               return ret;
+
+       vmw_dmabuf_unreference(&vmw_bo);
+       return 0;
+}
+
+static int vmw_cmd_wait_query(struct vmw_private *dev_priv,
+                             struct vmw_sw_context *sw_context,
+                             SVGA3dCmdHeader *header)
+{
+       struct vmw_dma_buffer *vmw_bo;
+       struct vmw_query_cmd {
+               SVGA3dCmdHeader header;
+               SVGA3dCmdWaitForQuery q;
+       } *cmd;
+       int ret;
+
+       cmd = container_of(header, struct vmw_query_cmd, header);
+       ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
+       if (unlikely(ret != 0))
+               return ret;
+
+       ret = vmw_translate_guest_ptr(dev_priv, sw_context,
+                                     &cmd->q.guestResult,
+                                     &vmw_bo);
+       if (unlikely(ret != 0))
+               return ret;
+
+       vmw_dmabuf_unreference(&vmw_bo);
+       return 0;
+}
+
+
+static int vmw_cmd_dma(struct vmw_private *dev_priv,
+                      struct vmw_sw_context *sw_context,
+                      SVGA3dCmdHeader *header)
+{
+       struct vmw_dma_buffer *vmw_bo = NULL;
+       struct ttm_buffer_object *bo;
+       struct vmw_surface *srf = NULL;
+       struct vmw_dma_cmd {
+               SVGA3dCmdHeader header;
+               SVGA3dCmdSurfaceDMA dma;
+       } *cmd;
+       int ret;
+
+       cmd = container_of(header, struct vmw_dma_cmd, header);
+       ret = vmw_translate_guest_ptr(dev_priv, sw_context,
+                                     &cmd->dma.guest.ptr,
+                                     &vmw_bo);
+       if (unlikely(ret != 0))
+               return ret;
+
+       bo = &vmw_bo->base;
        ret = vmw_user_surface_lookup_handle(dev_priv, sw_context->tfile,
                                             cmd->dma.host.sid, &srf);
        if (ret) {
@@ -379,8 +455,8 @@ static vmw_cmd_func vmw_cmd_funcs[SVGA_3D_CMD_MAX] = {
        VMW_CMD_DEF(SVGA_3D_CMD_DRAW_PRIMITIVES, &vmw_cmd_draw),
        VMW_CMD_DEF(SVGA_3D_CMD_SETSCISSORRECT, &vmw_cmd_cid_check),
        VMW_CMD_DEF(SVGA_3D_CMD_BEGIN_QUERY, &vmw_cmd_cid_check),
-       VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_cid_check),
-       VMW_CMD_DEF(SVGA_3D_CMD_WAIT_FOR_QUERY, &vmw_cmd_cid_check),
+       VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_end_query),
+       VMW_CMD_DEF(SVGA_3D_CMD_WAIT_FOR_QUERY, &vmw_cmd_wait_query),
        VMW_CMD_DEF(SVGA_3D_CMD_PRESENT_READBACK, &vmw_cmd_ok),
        VMW_CMD_DEF(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN,
                    &vmw_cmd_blt_surf_screen_check)
@@ -487,6 +563,21 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
 {
        int ret;
 
+       if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
+               return 0;
+
+       /**
+        * Put BO in VRAM, only if there is space.
+        */
+
+       ret = ttm_bo_validate(bo, &vmw_vram_sys_placement, true, false);
+       if (unlikely(ret == -ERESTARTSYS))
+               return ret;
+
+       /**
+        * Otherwise, set it up as GMR.
+        */
+
        if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
                return 0;
 
@@ -494,6 +585,10 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
        if (likely(ret == 0 || ret == -ERESTARTSYS))
                return ret;
 
+       /**
+        * If that failed, try VRAM again, this time evicting
+        * previous contents.
+        */
 
        ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false);
        return ret;
index 641dde76ada10e7321ce548af1cb5c058f81f2d4..a93367041cdcfa66393a7e043da0bb75d1c08d31 100644 (file)
@@ -559,6 +559,9 @@ int vmw_fb_init(struct vmw_private *vmw_priv)
        info->pixmap.scan_align = 1;
 #endif
 
+       info->aperture_base = vmw_priv->vram_start;
+       info->aperture_size = vmw_priv->vram_size;
+
        /*
         * Dirty & Deferred IO
         */
@@ -649,14 +652,6 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv,
        if (unlikely(ret != 0))
                goto err_unlock;
 
-       if (vmw_bo->gmr_bound) {
-               vmw_gmr_unbind(vmw_priv, vmw_bo->gmr_id);
-               spin_lock(&bo->glob->lru_lock);
-               ida_remove(&vmw_priv->gmr_ida, vmw_bo->gmr_id);
-               spin_unlock(&bo->glob->lru_lock);
-               vmw_bo->gmr_bound = NULL;
-       }
-
        ret = ttm_bo_validate(bo, &ne_placement, false, false);
        ttm_bo_unreserve(bo);
 err_unlock:
index 01feb48af3334af933c871852f1eb3787502731f..39d43a01d846fd9e7bcd6a1206b06143f90a740d 100644 (file)
 #include "drmP.h"
 #include "ttm/ttm_placement.h"
 
+bool vmw_fifo_have_3d(struct vmw_private *dev_priv)
+{
+       __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
+       uint32_t fifo_min, hwversion;
+
+       fifo_min = ioread32(fifo_mem  + SVGA_FIFO_MIN);
+       if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int))
+               return false;
+
+       hwversion = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION);
+       if (hwversion == 0)
+               return false;
+
+       if (hwversion < SVGA3D_HWVERSION_WS65_B1)
+               return false;
+
+       return true;
+}
+
 int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 {
        __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
@@ -55,6 +74,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
        fifo->reserved_size = 0;
        fifo->using_bounce_buffer = false;
 
+       mutex_init(&fifo->fifo_mutex);
        init_rwsem(&fifo->rwsem);
 
        /*
@@ -98,8 +118,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
                 (unsigned int) min,
                 (unsigned int) fifo->capabilities);
 
-       dev_priv->fence_seq = (uint32_t) -100;
-       dev_priv->last_read_sequence = (uint32_t) -100;
+       atomic_set(&dev_priv->fence_seq, dev_priv->last_read_sequence);
        iowrite32(dev_priv->last_read_sequence, fifo_mem + SVGA_FIFO_FENCE);
 
        return vmw_fifo_send_fence(dev_priv, &dummy);
@@ -265,7 +284,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
        uint32_t reserveable = fifo_state->capabilities & SVGA_FIFO_CAP_RESERVE;
        int ret;
 
-       down_write(&fifo_state->rwsem);
+       mutex_lock(&fifo_state->fifo_mutex);
        max = ioread32(fifo_mem + SVGA_FIFO_MAX);
        min = ioread32(fifo_mem + SVGA_FIFO_MIN);
        next_cmd = ioread32(fifo_mem + SVGA_FIFO_NEXT_CMD);
@@ -333,7 +352,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
        }
 out_err:
        fifo_state->reserved_size = 0;
-       up_write(&fifo_state->rwsem);
+       mutex_unlock(&fifo_state->fifo_mutex);
        return NULL;
 }
 
@@ -408,6 +427,7 @@ void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)
 
        }
 
+       down_write(&fifo_state->rwsem);
        if (fifo_state->using_bounce_buffer || reserveable) {
                next_cmd += bytes;
                if (next_cmd >= max)
@@ -419,8 +439,9 @@ void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)
        if (reserveable)
                iowrite32(0, fifo_mem + SVGA_FIFO_RESERVED);
        mb();
-       vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
        up_write(&fifo_state->rwsem);
+       vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
+       mutex_unlock(&fifo_state->fifo_mutex);
 }
 
 int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
@@ -433,9 +454,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
 
        fm = vmw_fifo_reserve(dev_priv, bytes);
        if (unlikely(fm == NULL)) {
-               down_write(&fifo_state->rwsem);
-               *sequence = dev_priv->fence_seq;
-               up_write(&fifo_state->rwsem);
+               *sequence = atomic_read(&dev_priv->fence_seq);
                ret = -ENOMEM;
                (void)vmw_fallback_wait(dev_priv, false, true, *sequence,
                                        false, 3*HZ);
@@ -443,7 +462,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
        }
 
        do {
-               *sequence = dev_priv->fence_seq++;
+               *sequence = atomic_add_return(1, &dev_priv->fence_seq);
        } while (*sequence == 0);
 
        if (!(fifo_state->capabilities & SVGA_FIFO_CAP_FENCE)) {
index 5fa6a4ed238add81c5da2a2e2fb65ab50f4862da..1c7a316454d80ceb9aaeb6c83d6ac6a82f1cae1f 100644 (file)
@@ -43,11 +43,17 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
                param->value = vmw_overlay_num_free_overlays(dev_priv);
                break;
        case DRM_VMW_PARAM_3D:
-               param->value = dev_priv->capabilities & SVGA_CAP_3D ? 1 : 0;
+               param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
                break;
        case DRM_VMW_PARAM_FIFO_OFFSET:
                param->value = dev_priv->mmio_start;
                break;
+       case DRM_VMW_PARAM_HW_CAPS:
+               param->value = dev_priv->capabilities;
+               break;
+       case DRM_VMW_PARAM_FIFO_CAPS:
+               param->value = dev_priv->fifo.capabilities;
+               break;
        default:
                DRM_ERROR("Illegal vmwgfx get param request: %d\n",
                          param->param);
index d40086fc8647abb3f293cd7d9f0baeb31b254db3..4d7cb539386000b50798960f8615d2fc2b25d2ba 100644 (file)
@@ -84,20 +84,13 @@ bool vmw_fence_signaled(struct vmw_private *dev_priv,
            vmw_fifo_idle(dev_priv, sequence))
                return true;
 
-       /**
-        * Below is to signal stale fences that have wrapped.
-        * First, block fence submission.
-        */
-
-       down_read(&fifo_state->rwsem);
-
        /**
         * Then check if the sequence is higher than what we've actually
         * emitted. Then the fence is stale and signaled.
         */
 
-       ret = ((dev_priv->fence_seq - sequence) > VMW_FENCE_WRAP);
-       up_read(&fifo_state->rwsem);
+       ret = ((atomic_read(&dev_priv->fence_seq) - sequence)
+              > VMW_FENCE_WRAP);
 
        return ret;
 }
@@ -127,7 +120,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,
 
        if (fifo_idle)
                down_read(&fifo_state->rwsem);
-       signal_seq = dev_priv->fence_seq;
+       signal_seq = atomic_read(&dev_priv->fence_seq);
        ret = 0;
 
        for (;;) {
index b1af76e371c38ac4179afcae85d0a61810cef348..31f9afed0a63210cb02e9c57daea04b1291bef3d 100644 (file)
@@ -553,9 +553,7 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
        } *cmd;
        int i, increment = 1;
 
-       if (!num_clips ||
-           !(dev_priv->fifo.capabilities &
-             SVGA_FIFO_CAP_SCREEN_OBJECT)) {
+       if (!num_clips) {
                num_clips = 1;
                clips = &norect;
                norect.x1 = norect.y1 = 0;
@@ -574,10 +572,10 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
 
        for (i = 0; i < num_clips; i++, clips += increment) {
                cmd[i].header = cpu_to_le32(SVGA_CMD_UPDATE);
-               cmd[i].body.x = cpu_to_le32(clips[i].x1);
-               cmd[i].body.y = cpu_to_le32(clips[i].y1);
-               cmd[i].body.width = cpu_to_le32(clips[i].x2 - clips[i].x1);
-               cmd[i].body.height = cpu_to_le32(clips[i].y2 - clips[i].y1);
+               cmd[i].body.x = cpu_to_le32(clips->x1);
+               cmd[i].body.y = cpu_to_le32(clips->y1);
+               cmd[i].body.width = cpu_to_le32(clips->x2 - clips->x1);
+               cmd[i].body.height = cpu_to_le32(clips->y2 - clips->y1);
        }
 
        vmw_fifo_commit(dev_priv, sizeof(*cmd) * num_clips);
@@ -709,6 +707,9 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
        if (ret)
                goto try_dmabuf;
 
+       if (!surface->scanout)
+               goto err_not_scanout;
+
        ret = vmw_kms_new_framebuffer_surface(dev_priv, surface, &vfb,
                                              mode_cmd->width, mode_cmd->height);
 
@@ -742,6 +743,13 @@ try_dmabuf:
        }
 
        return &vfb->base;
+
+err_not_scanout:
+       DRM_ERROR("surface not marked as scanout\n");
+       /* vmw_user_surface_lookup takes one ref */
+       vmw_surface_unreference(&surface);
+
+       return NULL;
 }
 
 static int vmw_kms_fb_changed(struct drm_device *dev)
@@ -761,10 +769,10 @@ int vmw_kms_init(struct vmw_private *dev_priv)
 
        drm_mode_config_init(dev);
        dev->mode_config.funcs = &vmw_kms_funcs;
-       dev->mode_config.min_width = 640;
-       dev->mode_config.min_height = 480;
-       dev->mode_config.max_width = 2048;
-       dev->mode_config.max_height = 2048;
+       dev->mode_config.min_width = 1;
+       dev->mode_config.min_height = 1;
+       dev->mode_config.max_width = dev_priv->fb_max_width;
+       dev->mode_config.max_height = dev_priv->fb_max_height;
 
        ret = vmw_kms_init_legacy_display_system(dev_priv);
 
index bb6e6a096d25249004ece1422e9e6358c6a1a5c6..5b6eabeb7f51f6f290885426c2f93422f84d7a04 100644 (file)
@@ -104,7 +104,6 @@ static int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv,
                                  bool pin, bool interruptible)
 {
        struct ttm_buffer_object *bo = &buf->base;
-       struct ttm_bo_global *glob = bo->glob;
        struct ttm_placement *overlay_placement = &vmw_vram_placement;
        int ret;
 
@@ -116,14 +115,6 @@ static int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv,
        if (unlikely(ret != 0))
                goto err;
 
-       if (buf->gmr_bound) {
-               vmw_gmr_unbind(dev_priv, buf->gmr_id);
-               spin_lock(&glob->lru_lock);
-               ida_remove(&dev_priv->gmr_ida, buf->gmr_id);
-               spin_unlock(&glob->lru_lock);
-               buf->gmr_bound = NULL;
-       }
-
        if (pin)
                overlay_placement = &vmw_vram_ne_placement;
 
index c012d5927f650263bea8b63fb004551a61214ea9..f8fbbc67a40675d29418f0cd6ed7f99213c9fb1c 100644 (file)
@@ -574,6 +574,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 
        srf->flags = req->flags;
        srf->format = req->format;
+       srf->scanout = req->scanout;
        memcpy(srf->mip_levels, req->mip_levels, sizeof(srf->mip_levels));
        srf->num_sizes = 0;
        for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
@@ -599,6 +600,26 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
        if (unlikely(ret != 0))
                goto out_err1;
 
+       if (srf->scanout &&
+           srf->num_sizes == 1 &&
+           srf->sizes[0].width == 64 &&
+           srf->sizes[0].height == 64 &&
+           srf->format == SVGA3D_A8R8G8B8) {
+
+               srf->snooper.image = kmalloc(64 * 64 * 4, GFP_KERNEL);
+               /* clear the image */
+               if (srf->snooper.image) {
+                       memset(srf->snooper.image, 0x00, 64 * 64 * 4);
+               } else {
+                       DRM_ERROR("Failed to allocate cursor_image\n");
+                       ret = -ENOMEM;
+                       goto out_err1;
+               }
+       } else {
+               srf->snooper.image = NULL;
+       }
+       srf->snooper.crtc = NULL;
+
        user_srf->base.shareable = false;
        user_srf->base.tfile = NULL;
 
@@ -622,24 +643,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
                return ret;
        }
 
-       if (srf->flags & (1 << 9) &&
-           srf->num_sizes == 1 &&
-           srf->sizes[0].width == 64 &&
-           srf->sizes[0].height == 64 &&
-           srf->format == SVGA3D_A8R8G8B8) {
-
-               srf->snooper.image = kmalloc(64 * 64 * 4, GFP_KERNEL);
-               /* clear the image */
-               if (srf->snooper.image)
-                       memset(srf->snooper.image, 0x00, 64 * 64 * 4);
-               else
-                       DRM_ERROR("Failed to allocate cursor_image\n");
-
-       } else {
-               srf->snooper.image = NULL;
-       }
-       srf->snooper.crtc = NULL;
-
        rep->sid = user_srf->base.hash.key;
        if (rep->sid == SVGA3D_INVALID_ID)
                DRM_ERROR("Created bad Surface ID.\n");
@@ -754,20 +757,29 @@ static size_t vmw_dmabuf_acc_size(struct ttm_bo_global *glob,
        return bo_user_size + page_array_size;
 }
 
-void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo)
+void vmw_dmabuf_gmr_unbind(struct ttm_buffer_object *bo)
 {
        struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo);
        struct ttm_bo_global *glob = bo->glob;
        struct vmw_private *dev_priv =
                container_of(bo->bdev, struct vmw_private, bdev);
 
-       ttm_mem_global_free(glob->mem_glob, bo->acc_size);
        if (vmw_bo->gmr_bound) {
                vmw_gmr_unbind(dev_priv, vmw_bo->gmr_id);
                spin_lock(&glob->lru_lock);
                ida_remove(&dev_priv->gmr_ida, vmw_bo->gmr_id);
                spin_unlock(&glob->lru_lock);
+               vmw_bo->gmr_bound = false;
        }
+}
+
+void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo)
+{
+       struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo);
+       struct ttm_bo_global *glob = bo->glob;
+
+       vmw_dmabuf_gmr_unbind(bo);
+       ttm_mem_global_free(glob->mem_glob, bo->acc_size);
        kfree(vmw_bo);
 }
 
@@ -813,18 +825,10 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv,
 static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo)
 {
        struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo);
-       struct vmw_dma_buffer *vmw_bo = &vmw_user_bo->dma;
        struct ttm_bo_global *glob = bo->glob;
-       struct vmw_private *dev_priv =
-               container_of(bo->bdev, struct vmw_private, bdev);
 
+       vmw_dmabuf_gmr_unbind(bo);
        ttm_mem_global_free(glob->mem_glob, bo->acc_size);
-       if (vmw_bo->gmr_bound) {
-               vmw_gmr_unbind(dev_priv, vmw_bo->gmr_id);
-               spin_lock(&glob->lru_lock);
-               ida_remove(&dev_priv->gmr_ida, vmw_bo->gmr_id);
-               spin_unlock(&glob->lru_lock);
-       }
        kfree(vmw_user_bo);
 }
 
@@ -868,7 +872,7 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
        }
 
        ret = vmw_dmabuf_init(dev_priv, &vmw_user_bo->dma, req->size,
-                             &vmw_vram_placement, true,
+                             &vmw_vram_sys_placement, true,
                              &vmw_user_dmabuf_destroy);
        if (unlikely(ret != 0))
                return ret;
index 790e675b13eb8f4b16e9b7040bd656759473ae93..0920492cea0a4af77d9ea6ec13c937a4f6ae60bc 100644 (file)
@@ -8,3 +8,11 @@ config VGA_ARB
          are accessed at same time they need some kind of coordination. Please
          see Documentation/vgaarbiter.txt for more details. Select this to
          enable VGA arbiter.
+
+config VGA_ARB_MAX_GPUS
+       int "Maximum number of GPUs"
+       default 16
+       depends on VGA_ARB
+       help
+         Reserves space in the kernel to maintain resource locking for
+         multiple GPUS.  The overhead for each GPU is very small.
index 1ac0c93603c903a1d7a39f1efb10530936a2f4e1..8827814d0735fbc7c3ff619b6f608476c82a4172 100644 (file)
@@ -688,7 +688,7 @@ EXPORT_SYMBOL(vga_client_register);
  * the arbiter.
  */
 
-#define MAX_USER_CARDS         16
+#define MAX_USER_CARDS         CONFIG_VGA_ARB_MAX_GPUS
 #define PCI_INVALID_CARD       ((struct pci_dev *)-1UL)
 
 /*
@@ -954,6 +954,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                }
 
        } else if (strncmp(curr_pos, "target ", 7) == 0) {
+               struct pci_bus *pbus;
                unsigned int domain, bus, devfn;
                struct vga_device *vgadev;
 
@@ -961,7 +962,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                remaining -= 7;
                pr_devel("client 0x%p called 'target'\n", priv);
                /* if target is default */
-               if (!strncmp(buf, "default", 7))
+               if (!strncmp(curr_pos, "default", 7))
                        pdev = pci_dev_get(vga_default_device());
                else {
                        if (!vga_pci_str_to_vars(curr_pos, remaining,
@@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                                ret_val = -EPROTO;
                                goto done;
                        }
-
-                       pdev = pci_get_bus_and_slot(bus, devfn);
+                       pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos,
+                               domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+                       pbus = pci_find_bus(domain, bus);
+                       pr_devel("vgaarb: pbus %p\n", pbus);
+                       if (pbus == NULL) {
+                               pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n",
+                                       domain, bus);
+                               ret_val = -ENODEV;
+                               goto done;
+                       }
+                       pdev = pci_get_slot(pbus, devfn);
+                       pr_devel("vgaarb: pdev %p\n", pdev);
                        if (!pdev) {
-                               pr_info("vgaarb: invalid PCI address!\n");
+                               pr_err("vgaarb: invalid PCI address %x:%x\n",
+                                       bus, devfn);
                                ret_val = -ENODEV;
                                goto done;
                        }
                }
 
                vgadev = vgadev_find(pdev);
+               pr_devel("vgaarb: vgadev %p\n", vgadev);
                if (vgadev == NULL) {
-                       pr_info("vgaarb: this pci device is not a vga device\n");
+                       pr_err("vgaarb: this pci device is not a vga device\n");
                        pci_dev_put(pdev);
                        ret_val = -ENODEV;
                        goto done;
@@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                        }
                }
                if (i == MAX_USER_CARDS) {
-                       pr_err("vgaarb: maximum user cards number reached!\n");
+                       pr_err("vgaarb: maximum user cards (%d) number reached!\n",
+                               MAX_USER_CARDS);
                        pci_dev_put(pdev);
                        /* XXX: which value to return? */
                        ret_val =  -ENOMEM;
index 24d90ea246ce95096dd0d74ba3f50b1dcae4b8fc..71d4c0703629a55331aed27e12aa17cd63ffa66c 100644 (file)
@@ -55,6 +55,12 @@ source "drivers/hid/usbhid/Kconfig"
 menu "Special HID drivers"
        depends on HID
 
+config HID_3M_PCT
+       tristate "3M PCT"
+       depends on USB_HID
+       ---help---
+       Support for 3M PCT touch screens.
+
 config HID_A4TECH
        tristate "A4 tech" if EMBEDDED
        depends on USB_HID
@@ -183,6 +189,23 @@ config LOGIRUMBLEPAD2_FF
          Say Y here if you want to enable force feedback support for Logitech
          Rumblepad 2 devices.
 
+config LOGIG940_FF
+       bool "Logitech Flight System G940 force feedback support"
+       depends on HID_LOGITECH
+       select INPUT_FF_MEMLESS
+       help
+         Say Y here if you want to enable force feedback support for Logitech
+         Flight System G940 devices.
+
+config HID_MAGICMOUSE
+       tristate "Apple MagicMouse multi-touch support"
+       depends on BT_HIDP
+       ---help---
+       Support for the Apple Magic Mouse multi-touch.
+
+       Say Y here if you want support for the multi-touch features of the
+       Apple Wireless "Magic" Mouse.
+
 config HID_MICROSOFT
        tristate "Microsoft" if EMBEDDED
        depends on USB_HID
@@ -190,6 +213,12 @@ config HID_MICROSOFT
        ---help---
        Support for Microsoft devices that are not fully compliant with HID standard.
 
+config HID_MOSART
+       tristate "MosArt"
+       depends on USB_HID
+       ---help---
+       Support for MosArt dual-touch panels.
+
 config HID_MONTEREY
        tristate "Monterey" if EMBEDDED
        depends on USB_HID
@@ -198,12 +227,18 @@ config HID_MONTEREY
        Support for Monterey Genius KB29E.
 
 config HID_NTRIG
-       tristate "NTrig" if EMBEDDED
+       tristate "NTrig"
        depends on USB_HID
-       default !EMBEDDED
        ---help---
        Support for N-Trig touch screen.
 
+config HID_ORTEK
+       tristate "Ortek" if EMBEDDED
+       depends on USB_HID
+       default !EMBEDDED
+       ---help---
+       Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.
+
 config HID_PANTHERLORD
        tristate "Pantherlord support" if EMBEDDED
        depends on USB_HID
@@ -227,6 +262,12 @@ config HID_PETALYNX
        ---help---
        Support for Petalynx Maxter remote control.
 
+config HID_QUANTA
+       tristate "Quanta Optical Touch"
+       depends on USB_HID
+       ---help---
+       Support for Quanta Optical Touch dual-touch panels.
+
 config HID_SAMSUNG
        tristate "Samsung" if EMBEDDED
        depends on USB_HID
@@ -241,6 +282,12 @@ config HID_SONY
        ---help---
        Support for Sony PS3 controller.
 
+config HID_STANTUM
+       tristate "Stantum"
+       depends on USB_HID
+       ---help---
+       Support for Stantum multitouch panel.
+
 config HID_SUNPLUS
        tristate "Sunplus" if EMBEDDED
        depends on USB_HID
@@ -305,9 +352,8 @@ config THRUSTMASTER_FF
          Rumble Force or Force Feedback Wheel.
 
 config HID_WACOM
-       tristate "Wacom Bluetooth devices support" if EMBEDDED
+       tristate "Wacom Bluetooth devices support"
        depends on BT_HIDP
-       default !EMBEDDED
        ---help---
        Support for Wacom Graphire Bluetooth tablet.
 
index 0de2dff5542c9c59255f546fa8b2b512d9312c9e..0b2618f092ca525b272bf10242ff4843b68cfce2 100644 (file)
@@ -18,7 +18,11 @@ endif
 ifdef CONFIG_LOGIRUMBLEPAD2_FF
        hid-logitech-objs       += hid-lg2ff.o
 endif
+ifdef CONFIG_LOGIG940_FF
+       hid-logitech-objs       += hid-lg3ff.o
+endif
 
+obj-$(CONFIG_HID_3M_PCT)       += hid-3m-pct.o
 obj-$(CONFIG_HID_A4TECH)       += hid-a4tech.o
 obj-$(CONFIG_HID_APPLE)                += hid-apple.o
 obj-$(CONFIG_HID_BELKIN)       += hid-belkin.o
@@ -31,14 +35,19 @@ obj-$(CONFIG_HID_GYRATION)  += hid-gyration.o
 obj-$(CONFIG_HID_KENSINGTON)   += hid-kensington.o
 obj-$(CONFIG_HID_KYE)          += hid-kye.o
 obj-$(CONFIG_HID_LOGITECH)     += hid-logitech.o
+obj-$(CONFIG_HID_MAGICMOUSE)    += hid-magicmouse.o
 obj-$(CONFIG_HID_MICROSOFT)    += hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)     += hid-monterey.o
+obj-$(CONFIG_HID_MOSART)       += hid-mosart.o
 obj-$(CONFIG_HID_NTRIG)                += hid-ntrig.o
+obj-$(CONFIG_HID_ORTEK)                += hid-ortek.o
+obj-$(CONFIG_HID_QUANTA)       += hid-quanta.o
 obj-$(CONFIG_HID_PANTHERLORD)  += hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)     += hid-petalynx.o
 obj-$(CONFIG_HID_SAMSUNG)      += hid-samsung.o
 obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
 obj-$(CONFIG_HID_SONY)         += hid-sony.o
+obj-$(CONFIG_HID_STANTUM)      += hid-stantum.o
 obj-$(CONFIG_HID_SUNPLUS)      += hid-sunplus.o
 obj-$(CONFIG_HID_GREENASIA)    += hid-gaff.o
 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
new file mode 100644 (file)
index 0000000..2370aef
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+ *  HID driver for 3M PCT multitouch panels
+ *
+ *  Copyright (c) 2009 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("3M PCT multitouch panels");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct mmm_finger {
+       __s32 x, y;
+       __u8 rank;
+       bool touch, valid;
+};
+
+struct mmm_data {
+       struct mmm_finger f[10];
+       __u8 curid, num;
+       bool touch, valid;
+};
+
+static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_BUTTON:
+               return -1;
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               /* we do not want to map these: no input-oriented meaning */
+               case 0x14:
+               case 0x23:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_INRANGE:
+               case HID_DG_CONFIDENCE:
+                       return -1;
+               case HID_DG_TIPSWITCH:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+               }
+               /* let hid-input decide for the others */
+               return 0;
+
+       case 0xff000000:
+               /* we do not want to map these: no input-oriented meaning */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       if (usage->type == EV_KEY || usage->type == EV_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole packet has been received and processed,
+ * so that it can decide what to send to the input layer.
+ */
+static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
+{
+       struct mmm_finger *oldest = 0;
+       bool pressed = false, released = false;
+       int i;
+
+       /*
+        * we need to iterate on all fingers to decide if we have a press
+        * or a release event in our touchscreen emulation.
+        */
+       for (i = 0; i < 10; ++i) {
+               struct mmm_finger *f = &md->f[i];
+               if (!f->valid) {
+                       /* this finger is just placeholder data, ignore */
+               } else if (f->touch) {
+                       /* this finger is on the screen */
+                       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i);
+                       input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
+                       input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
+                       input_mt_sync(input);
+                       /*
+                        * touchscreen emulation: maintain the age rank
+                        * of this finger, decide if we have a press
+                        */
+                       if (f->rank == 0) {
+                               f->rank = ++(md->num);
+                               if (f->rank == 1)
+                                       pressed = true;
+                       }
+                       if (f->rank == 1)
+                               oldest = f;
+               } else {
+                       /* this finger took off the screen */
+                       /* touchscreen emulation: maintain age rank of others */
+                       int j;
+
+                       for (j = 0; j < 10; ++j) {
+                               struct mmm_finger *g = &md->f[j];
+                               if (g->rank > f->rank) {
+                                       g->rank--;
+                                       if (g->rank == 1)
+                                               oldest = g;
+                               }
+                       }
+                       f->rank = 0;
+                       --(md->num);
+                       if (md->num == 0)
+                               released = true;
+               }
+               f->valid = 0;
+       }
+
+       /* touchscreen emulation */
+       if (oldest) {
+               if (pressed)
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+               input_event(input, EV_ABS, ABS_X, oldest->x);
+               input_event(input, EV_ABS, ABS_Y, oldest->y);
+       } else if (released) {
+               input_event(input, EV_KEY, BTN_TOUCH, 0);
+       }
+}
+
+/*
+ * this function is called upon all reports
+ * so that we can accumulate contact point information,
+ * and call input_mt_sync after each point.
+ */
+static int mmm_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct mmm_data *md = hid_get_drvdata(hid);
+       /*
+        * strangely, this function can be called before
+        * field->hidinput is initialized!
+        */
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+               switch (usage->hid) {
+               case HID_DG_TIPSWITCH:
+                       md->touch = value;
+                       break;
+               case HID_DG_CONFIDENCE:
+                       md->valid = value;
+                       break;
+               case HID_DG_CONTACTID:
+                       if (md->valid) {
+                               md->curid = value;
+                               md->f[value].touch = md->touch;
+                               md->f[value].valid = 1;
+                       }
+                       break;
+               case HID_GD_X:
+                       if (md->valid)
+                               md->f[md->curid].x = value;
+                       break;
+               case HID_GD_Y:
+                       if (md->valid)
+                               md->f[md->curid].y = value;
+                       break;
+               case HID_DG_CONTACTCOUNT:
+                       mmm_filter_event(md, input);
+                       break;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+       int ret;
+       struct mmm_data *md;
+
+       md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
+       if (!md) {
+               dev_err(&hdev->dev, "cannot allocate 3M data\n");
+               return -ENOMEM;
+       }
+       hid_set_drvdata(hdev, md);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(md);
+       return ret;
+}
+
+static void mmm_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id mmm_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, mmm_devices);
+
+static const struct hid_usage_id mmm_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver mmm_driver = {
+       .name = "3m-pct",
+       .id_table = mmm_devices,
+       .probe = mmm_probe,
+       .remove = mmm_remove,
+       .input_mapping = mmm_input_mapping,
+       .input_mapped = mmm_input_mapped,
+       .usage_table = mmm_grabbed_usages,
+       .event = mmm_event,
+};
+
+static int __init mmm_init(void)
+{
+       return hid_register_driver(&mmm_driver);
+}
+
+static void __exit mmm_exit(void)
+{
+       hid_unregister_driver(&mmm_driver);
+}
+
+module_init(mmm_init);
+module_exit(mmm_exit);
+MODULE_LICENSE("GPL");
+
index 4b96e7a898cfea7224007a87af7817c3d66528fa..78286b184ace5ebe58850623b5ab670d1c995a64 100644 (file)
@@ -40,6 +40,11 @@ module_param(fnmode, uint, 0644);
 MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
                "[1] = fkeyslast, 2 = fkeysfirst)");
 
+static unsigned int iso_layout = 1;
+module_param(iso_layout, uint, 0644);
+MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. "
+               "(0 = disabled, [1] = enabled)");
+
 struct apple_sc {
        unsigned long quirks;
        unsigned int fn_on;
@@ -199,11 +204,13 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
                }
        }
 
-       if (asc->quirks & APPLE_ISO_KEYBOARD) {
-               trans = apple_find_translation(apple_iso_keyboard, usage->code);
-               if (trans) {
-                       input_event(input, usage->type, trans->to, value);
-                       return 1;
+        if (iso_layout) {
+               if (asc->quirks & APPLE_ISO_KEYBOARD) {
+                       trans = apple_find_translation(apple_iso_keyboard, usage->code);
+                       if (trans) {
+                               input_event(input, usage->type, trans->to, value);
+                               return 1;
+                       }
                }
        }
 
@@ -431,6 +438,13 @@ static const struct hid_device_id apple_devices[] = {
                .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
                .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
+               .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
+               .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
+                       APPLE_ISO_KEYBOARD },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS),
+               .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
index 80792d38d25c103dbaaaab0ea87c2af02f6a4af4..368fbb0c4ca6b161d2acea66d7a10bdf4c6a36f5 100644 (file)
@@ -4,7 +4,7 @@
  *  Copyright (c) 1999 Andreas Gal
  *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
  *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
- *  Copyright (c) 2006-2007 Jiri Kosina
+ *  Copyright (c) 2006-2010 Jiri Kosina
  */
 
 /*
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(hid_debug);
  * Register a new report for a device.
  */
 
-static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id)
+struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id)
 {
        struct hid_report_enum *report_enum = device->report_enum + type;
        struct hid_report *report;
@@ -75,6 +75,7 @@ static struct hid_report *hid_register_report(struct hid_device *device, unsigne
 
        return report;
 }
+EXPORT_SYMBOL_GPL(hid_register_report);
 
 /*
  * Register a new field for this report.
@@ -387,7 +388,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
        __u32 data;
        unsigned n;
 
-       if (item->size == 0) {
+       /* Local delimiter could have value 0, which allows size to be 0 */
+       if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
                dbg_hid("item data expected for local item\n");
                return -1;
        }
@@ -1248,11 +1250,13 @@ EXPORT_SYMBOL_GPL(hid_disconnect);
 
 /* a list of devices for which there is a specialized driver on HID bus */
 static const struct hid_device_id hid_blacklist[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
@@ -1285,6 +1289,9 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
@@ -1321,6 +1328,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
@@ -1334,10 +1342,15 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
        { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
        { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
@@ -1540,8 +1553,9 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) },
        { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
-       { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
+       { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT)},
+       { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)},
+       { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)},
        { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
        { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
@@ -1553,6 +1567,7 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) },
@@ -1657,8 +1672,6 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
index 6abd0369aedba0125f935dc357f292d5e6850017..cd4ece6fdfb967b8fe89227742dd49e13b09df67 100644 (file)
@@ -864,13 +864,13 @@ static const char **names[EV_MAX + 1] = {
        [EV_SND] = sounds,                      [EV_REP] = repeats,
 };
 
-void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f) {
-
+static void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f)
+{
        seq_printf(f, "%s.%s", events[type] ? events[type] : "?",
                names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
 }
 
-void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
+static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
 {
        int i, j, k;
        struct hid_report *report;
index 3839340e293ad91a98d4dbd81e6dd1311bd44a18..72c05f90553c7ec84351a34acf2ff6fc3ca10dbc 100644 (file)
@@ -18,6 +18,9 @@
 #ifndef HID_IDS_H_FILE
 #define HID_IDS_H_FILE
 
+#define USB_VENDOR_ID_3M               0x0596
+#define USB_DEVICE_ID_3M1968           0x0500
+
 #define USB_VENDOR_ID_A4TECH           0x09da
 #define USB_DEVICE_ID_A4TECH_WCP32PU   0x0006
 #define USB_DEVICE_ID_A4TECH_X5_005D   0x000a
@@ -56,6 +59,7 @@
 
 #define USB_VENDOR_ID_APPLE            0x05ac
 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE        0x0304
+#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI      0x020e
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO       0x020f
 #define USB_DEVICE_ID_APPLE_GEYSER_ANSI        0x0214
 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI   0x0236
 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO    0x0237
 #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS    0x0238
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI  0x0239
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO   0x023a
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY   0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY    0x030b
 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL      0x8241
 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
 
-#define USB_VENDOR_ID_ASUS             0x0b05
-#define USB_DEVICE_ID_ASUS_LCM         0x1726
-#define USB_DEVICE_ID_ASUS_LCM2                0x175b
+#define USB_VENDOR_ID_ASUS             0x0486
+#define USB_DEVICE_ID_ASUS_T91MT       0x0185
+
+#define USB_VENDOR_ID_ASUSTEK          0x0b05
+#define USB_DEVICE_ID_ASUSTEK_LCM      0x1726
+#define USB_DEVICE_ID_ASUSTEK_LCM2     0x175b
 
 #define USB_VENDOR_ID_ATEN             0x0557
 #define USB_DEVICE_ID_ATEN_UC100KM     0x2004
 #define USB_VENDOR_ID_ESSENTIAL_REALITY        0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
+#define USB_VENDOR_ID_ETURBOTOUCH      0x22b9
+#define USB_DEVICE_ID_ETURBOTOUCH      0x0006
+
+#define USB_VENDOR_ID_ETT              0x0664
+#define USB_DEVICE_ID_TC5UH            0x0309
+
 #define USB_VENDOR_ID_EZKEY            0x0518
 #define USB_DEVICE_ID_BTC_8193         0x0002
 
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2    0xc219
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D     0xc283
 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO     0xc286
+#define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940      0xc287
 #define USB_DEVICE_ID_LOGITECH_WHEEL   0xc294
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG     0xc293
 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL      0xc295
 #define USB_VENDOR_ID_ONTRAK           0x0a07
 #define USB_DEVICE_ID_ONTRAK_ADU100    0x0064
 
+#define USB_VENDOR_ID_ORTEK            0x05a4
+#define USB_DEVICE_ID_ORTEK_WKB2000    0x2000
+
 #define USB_VENDOR_ID_PANJIT           0x134c
 
 #define USB_VENDOR_ID_PANTHERLORD      0x0810
 #define USB_VENDOR_ID_POWERCOM         0x0d9f
 #define USB_DEVICE_ID_POWERCOM_UPS     0x0002
 
+#define USB_VENDOR_ID_PRODIGE          0x05af
+#define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062
+
 #define USB_VENDOR_ID_SAITEK           0x06a3
 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
 
+#define USB_VENDOR_ID_QUANTA           0x0408
+#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH     0x3000
+#define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN  0x3001
+
 #define USB_VENDOR_ID_SAMSUNG          0x0419
 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE        0x0001
 
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST    0x0034
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST     0x0046
 
+#define USB_VENDOR_ID_STANTUM          0x1f87
+#define USB_DEVICE_ID_MTP              0x0002
+
 #define USB_VENDOR_ID_SUN              0x0430
 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE       0xcdab
 
 #define USB_VENDOR_ID_SUNPLUS          0x04fc
 #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
 
-#define USB_VENDOR_ID_TENX             0x1130
-#define USB_DEVICE_ID_TENX_IBUDDY1     0x0001
-#define USB_DEVICE_ID_TENX_IBUDDY2     0x0002
-
 #define USB_VENDOR_ID_THRUSTMASTER     0x044f
 
+#define USB_VENDOR_ID_TOUCHPACK                0x1bfd
+#define USB_DEVICE_ID_TOUCHPACK_RTS    0x1688
+
 #define USB_VENDOR_ID_TOPMAX           0x0663
 #define USB_DEVICE_ID_TOPMAX_COBRAPAD  0x0103
 
index 5862b0f3b55d1de24413744cde877ca33031212a..79d9edd0bdfa489cd075164d36464a15e6267b92 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (c) 2000-2001 Vojtech Pavlik
- *  Copyright (c) 2006-2007 Jiri Kosina
+ *  Copyright (c) 2006-2010 Jiri Kosina
  *
  *  HID to Linux Input mapping
  */
@@ -193,12 +193,17 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                break;
 
        case HID_UP_BUTTON:
-               code = ((usage->hid - 1) & 0xf);
+               code = ((usage->hid - 1) & HID_USAGE);
 
                switch (field->application) {
                case HID_GD_MOUSE:
                case HID_GD_POINTER:  code += 0x110; break;
-               case HID_GD_JOYSTICK: code += 0x120; break;
+               case HID_GD_JOYSTICK:
+                                     if (code <= 0xf)
+                                             code += BTN_JOYSTICK;
+                                     else
+                                             code += BTN_TRIGGER_HAPPY;
+                                     break;
                case HID_GD_GAMEPAD:  code += 0x130; break;
                default:
                        switch (field->physical) {
@@ -400,6 +405,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                case 0x192: map_key_clear(KEY_CALC);            break;
                case 0x194: map_key_clear(KEY_FILE);            break;
                case 0x196: map_key_clear(KEY_WWW);             break;
+               case 0x199: map_key_clear(KEY_CHAT);            break;
                case 0x19c: map_key_clear(KEY_LOGOFF);          break;
                case 0x19e: map_key_clear(KEY_COFFEE);          break;
                case 0x1a6: map_key_clear(KEY_HELP);            break;
index 9fcd3d017ab3ac012906b296e81e9c78ccb070c5..3677c9037a11036da88292adf0693b6ea1531242 100644 (file)
@@ -34,6 +34,7 @@
 #define LG_FF                  0x200
 #define LG_FF2                 0x400
 #define LG_RDESC_REL_ABS       0x800
+#define LG_FF3                 0x1000
 
 /*
  * Certain Logitech keyboards send in report #3 keys which are far
@@ -266,7 +267,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
                goto err_free;
        }
 
-       if (quirks & (LG_FF | LG_FF2))
+       if (quirks & (LG_FF | LG_FF2 | LG_FF3))
                connect_mask &= ~HID_CONNECT_FF;
 
        ret = hid_hw_start(hdev, connect_mask);
@@ -279,6 +280,8 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
                lgff_init(hdev);
        if (quirks & LG_FF2)
                lg2ff_init(hdev);
+       if (quirks & LG_FF3)
+               lg3ff_init(hdev);
 
        return 0;
 err_free:
@@ -331,6 +334,8 @@ static const struct hid_device_id lg_devices[] = {
                .driver_data = LG_FF },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
                .driver_data = LG_FF2 },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
+               .driver_data = LG_FF3 },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
                .driver_data = LG_RDESC_REL_ABS },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
index bf31592eaf79dc32757296f47191e6e66f1d2477..ce2ac86726245e984829680ba64a77d5bd38a5f2 100644 (file)
@@ -13,4 +13,10 @@ int lg2ff_init(struct hid_device *hdev);
 static inline int lg2ff_init(struct hid_device *hdev) { return -1; }
 #endif
 
+#ifdef CONFIG_LOGIG940_FF
+int lg3ff_init(struct hid_device *hdev);
+#else
+static inline int lg3ff_init(struct hid_device *hdev) { return -1; }
+#endif
+
 #endif
diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c
new file mode 100644 (file)
index 0000000..4002832
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ *  Force feedback support for Logitech Flight System G940
+ *
+ *  Copyright (c) 2009 Gary Stein <LordCnidarian@gmail.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
+ */
+
+
+#include <linux/input.h>
+#include <linux/usb.h>
+#include <linux/hid.h>
+
+#include "usbhid/usbhid.h"
+#include "hid-lg.h"
+
+/*
+ * G940 Theory of Operation (from experimentation)
+ *
+ * There are 63 fields (only 3 of them currently used)
+ * 0 - seems to be command field
+ * 1 - 30 deal with the x axis
+ * 31 -60 deal with the y axis
+ *
+ * Field 1 is x axis constant force
+ * Field 31 is y axis constant force
+ *
+ * other interesting fields 1,2,3,4 on x axis
+ * (same for 31,32,33,34 on y axis)
+ *
+ * 0 0 127 127 makes the joystick autocenter hard
+ *
+ * 127 0 127 127 makes the joystick loose on the right,
+ * but stops all movemnt left
+ *
+ * -127 0 -127 -127 makes the joystick loose on the left,
+ * but stops all movement right
+ *
+ * 0 0 -127 -127 makes the joystick rattle very hard
+ *
+ * I'm sure these are effects that I don't know enough about them
+ */
+
+struct lg3ff_device {
+       struct hid_report *report;
+};
+
+static int hid_lg3ff_play(struct input_dev *dev, void *data,
+                        struct ff_effect *effect)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
+       int x, y;
+
+/*
+ * Maxusage should always be 63 (maximum fields)
+ * likely a better way to ensure this data is clean
+ */
+       memset(report->field[0]->value, 0, sizeof(__s32)*report->field[0]->maxusage);
+
+       switch (effect->type) {
+       case FF_CONSTANT:
+/*
+ * Already clamped in ff_memless
+ * 0 is center (different then other logitech)
+ */
+               x = effect->u.ramp.start_level;
+               y = effect->u.ramp.end_level;
+
+               /* send command byte */
+               report->field[0]->value[0] = 0x51;
+
+/*
+ * Sign backwards from other Force3d pro
+ * which get recast here in two's complement 8 bits
+ */
+               report->field[0]->value[1] = (unsigned char)(-x);
+               report->field[0]->value[31] = (unsigned char)(-y);
+
+               usbhid_submit_report(hid, report, USB_DIR_OUT);
+               break;
+       }
+       return 0;
+}
+static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
+
+/*
+ * Auto Centering probed from device
+ * NOTE: deadman's switch on G940 must be covered
+ * for effects to work
+ */
+       report->field[0]->value[0] = 0x51;
+       report->field[0]->value[1] = 0x00;
+       report->field[0]->value[2] = 0x00;
+       report->field[0]->value[3] = 0x7F;
+       report->field[0]->value[4] = 0x7F;
+       report->field[0]->value[31] = 0x00;
+       report->field[0]->value[32] = 0x00;
+       report->field[0]->value[33] = 0x7F;
+       report->field[0]->value[34] = 0x7F;
+
+       usbhid_submit_report(hid, report, USB_DIR_OUT);
+}
+
+
+static const signed short ff3_joystick_ac[] = {
+       FF_CONSTANT,
+       FF_AUTOCENTER,
+       -1
+};
+
+int lg3ff_init(struct hid_device *hid)
+{
+       struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct input_dev *dev = hidinput->input;
+       struct hid_report *report;
+       struct hid_field *field;
+       const signed short *ff_bits = ff3_joystick_ac;
+       int error;
+       int i;
+
+       /* Find the report to use */
+       if (list_empty(report_list)) {
+               err_hid("No output report found");
+               return -1;
+       }
+
+       /* Check that the report looks ok */
+       report = list_entry(report_list->next, struct hid_report, list);
+       if (!report) {
+               err_hid("NULL output report");
+               return -1;
+       }
+
+       field = report->field[0];
+       if (!field) {
+               err_hid("NULL field");
+               return -1;
+       }
+
+       /* Assume single fixed device G940 */
+       for (i = 0; ff_bits[i] >= 0; i++)
+               set_bit(ff_bits[i], dev->ffbit);
+
+       error = input_ff_create_memless(dev, NULL, hid_lg3ff_play);
+       if (error)
+               return error;
+
+       if (test_bit(FF_AUTOCENTER, dev->ffbit))
+               dev->ff->set_autocenter = hid_lg3ff_set_autocenter;
+
+       dev_info(&hid->dev, "Force feedback for Logitech Flight System G940 by "
+                       "Gary Stein <LordCnidarian@gmail.com>\n");
+       return 0;
+}
+
index 987abebe08296a4f37770e2164e623012d4cac95..61142b76a9b19fe90826dfda870d7717d7f36f4b 100644 (file)
@@ -67,6 +67,7 @@ static const struct dev_type devices[] = {
        { 0x046d, 0xc219, ff_rumble },
        { 0x046d, 0xc283, ff_joystick },
        { 0x046d, 0xc286, ff_joystick_ac },
+       { 0x046d, 0xc287, ff_joystick_ac },
        { 0x046d, 0xc293, ff_joystick },
        { 0x046d, 0xc294, ff_wheel },
        { 0x046d, 0xc295, ff_joystick },
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
new file mode 100644 (file)
index 0000000..4a3a94f
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+ *   Apple "Magic" Wireless Mouse driver
+ *
+ *   Copyright (c) 2010 Michael Poole <mdpoole@troilus.org>
+ */
+
+/*
+ * 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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+
+#include "hid-ids.h"
+
+static bool emulate_3button = true;
+module_param(emulate_3button, bool, 0644);
+MODULE_PARM_DESC(emulate_3button, "Emulate a middle button");
+
+static int middle_button_start = -350;
+static int middle_button_stop = +350;
+
+static bool emulate_scroll_wheel = true;
+module_param(emulate_scroll_wheel, bool, 0644);
+MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel");
+
+static bool report_touches = true;
+module_param(report_touches, bool, 0644);
+MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)");
+
+static bool report_undeciphered;
+module_param(report_undeciphered, bool, 0644);
+MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event");
+
+#define TOUCH_REPORT_ID   0x29
+/* These definitions are not precise, but they're close enough.  (Bits
+ * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem
+ * to be some kind of bit mask -- 0x20 may be a near-field reading,
+ * and 0x40 is actual contact, and 0x10 may be a start/stop or change
+ * indication.)
+ */
+#define TOUCH_STATE_MASK  0xf0
+#define TOUCH_STATE_NONE  0x00
+#define TOUCH_STATE_START 0x30
+#define TOUCH_STATE_DRAG  0x40
+
+/**
+ * struct magicmouse_sc - Tracks Magic Mouse-specific data.
+ * @input: Input device through which we report events.
+ * @quirks: Currently unused.
+ * @last_timestamp: Timestamp from most recent (18-bit) touch report
+ *     (units of milliseconds over short windows, but seems to
+ *     increase faster when there are no touches).
+ * @delta_time: 18-bit difference between the two most recent touch
+ *     reports from the mouse.
+ * @ntouches: Number of touches in most recent touch report.
+ * @scroll_accel: Number of consecutive scroll motions.
+ * @scroll_jiffies: Time of last scroll motion.
+ * @touches: Most recent data for a touch, indexed by tracking ID.
+ * @tracking_ids: Mapping of current touch input data to @touches.
+ */
+struct magicmouse_sc {
+       struct input_dev *input;
+       unsigned long quirks;
+
+       int last_timestamp;
+       int delta_time;
+       int ntouches;
+       int scroll_accel;
+       unsigned long scroll_jiffies;
+
+       struct {
+               short x;
+               short y;
+               short scroll_y;
+               u8 size;
+       } touches[16];
+       int tracking_ids[16];
+};
+
+static int magicmouse_firm_touch(struct magicmouse_sc *msc)
+{
+       int touch = -1;
+       int ii;
+
+       /* If there is only one "firm" touch, set touch to its
+        * tracking ID.
+        */
+       for (ii = 0; ii < msc->ntouches; ii++) {
+               int idx = msc->tracking_ids[ii];
+               if (msc->touches[idx].size < 8) {
+                       /* Ignore this touch. */
+               } else if (touch >= 0) {
+                       touch = -1;
+                       break;
+               } else {
+                       touch = idx;
+               }
+       }
+
+       return touch;
+}
+
+static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state)
+{
+       int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 |
+               test_bit(BTN_RIGHT, msc->input->key) << 1 |
+               test_bit(BTN_MIDDLE, msc->input->key) << 2;
+
+       if (emulate_3button) {
+               int id;
+
+               /* If some button was pressed before, keep it held
+                * down.  Otherwise, if there's exactly one firm
+                * touch, use that to override the mouse's guess.
+                */
+               if (state == 0) {
+                       /* The button was released. */
+               } else if (last_state != 0) {
+                       state = last_state;
+               } else if ((id = magicmouse_firm_touch(msc)) >= 0) {
+                       int x = msc->touches[id].x;
+                       if (x < middle_button_start)
+                               state = 1;
+                       else if (x > middle_button_stop)
+                               state = 2;
+                       else
+                               state = 4;
+               } /* else: we keep the mouse's guess */
+
+               input_report_key(msc->input, BTN_MIDDLE, state & 4);
+       }
+
+       input_report_key(msc->input, BTN_LEFT, state & 1);
+       input_report_key(msc->input, BTN_RIGHT, state & 2);
+
+       if (state != last_state)
+               msc->scroll_accel = 0;
+}
+
+static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata)
+{
+       struct input_dev *input = msc->input;
+       __s32 x_y = tdata[0] << 8 | tdata[1] << 16 | tdata[2] << 24;
+       int misc = tdata[5] | tdata[6] << 8;
+       int id = (misc >> 6) & 15;
+       int x = x_y << 12 >> 20;
+       int y = -(x_y >> 20);
+
+       /* Store tracking ID and other fields. */
+       msc->tracking_ids[raw_id] = id;
+       msc->touches[id].x = x;
+       msc->touches[id].y = y;
+       msc->touches[id].size = misc & 63;
+
+       /* If requested, emulate a scroll wheel by detecting small
+        * vertical touch motions along the middle of the mouse.
+        */
+       if (emulate_scroll_wheel &&
+           middle_button_start < x && x < middle_button_stop) {
+               static const int accel_profile[] = {
+                       256, 228, 192, 160, 128, 96, 64, 32,
+               };
+               unsigned long now = jiffies;
+               int step = msc->touches[id].scroll_y - y;
+
+               /* Reset acceleration after half a second. */
+               if (time_after(now, msc->scroll_jiffies + HZ / 2))
+                       msc->scroll_accel = 0;
+
+               /* Calculate and apply the scroll motion. */
+               switch (tdata[7] & TOUCH_STATE_MASK) {
+               case TOUCH_STATE_START:
+                       msc->touches[id].scroll_y = y;
+                       msc->scroll_accel = min_t(int, msc->scroll_accel + 1,
+                                               ARRAY_SIZE(accel_profile) - 1);
+                       break;
+               case TOUCH_STATE_DRAG:
+                       step = step / accel_profile[msc->scroll_accel];
+                       if (step != 0) {
+                               msc->touches[id].scroll_y = y;
+                               msc->scroll_jiffies = now;
+                               input_report_rel(input, REL_WHEEL, step);
+                       }
+                       break;
+               }
+       }
+
+       /* Generate the input events for this touch. */
+       if (report_touches) {
+               int orientation = (misc >> 10) - 32;
+
+               input_report_abs(input, ABS_MT_TRACKING_ID, id);
+               input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]);
+               input_report_abs(input, ABS_MT_TOUCH_MINOR, tdata[4]);
+               input_report_abs(input, ABS_MT_ORIENTATION, orientation);
+               input_report_abs(input, ABS_MT_POSITION_X, x);
+               input_report_abs(input, ABS_MT_POSITION_Y, y);
+
+               if (report_undeciphered)
+                       input_event(input, EV_MSC, MSC_RAW, tdata[7]);
+
+               input_mt_sync(input);
+       }
+}
+
+static int magicmouse_raw_event(struct hid_device *hdev,
+               struct hid_report *report, u8 *data, int size)
+{
+       struct magicmouse_sc *msc = hid_get_drvdata(hdev);
+       struct input_dev *input = msc->input;
+       int x, y, ts, ii, clicks;
+
+       switch (data[0]) {
+       case 0x10:
+               if (size != 6)
+                       return 0;
+               x = (__s16)(data[2] | data[3] << 8);
+               y = (__s16)(data[4] | data[5] << 8);
+               clicks = data[1];
+               break;
+       case TOUCH_REPORT_ID:
+               /* Expect six bytes of prefix, and N*8 bytes of touch data. */
+               if (size < 6 || ((size - 6) % 8) != 0)
+                       return 0;
+               ts = data[3] >> 6 | data[4] << 2 | data[5] << 10;
+               msc->delta_time = (ts - msc->last_timestamp) & 0x3ffff;
+               msc->last_timestamp = ts;
+               msc->ntouches = (size - 6) / 8;
+               for (ii = 0; ii < msc->ntouches; ii++)
+                       magicmouse_emit_touch(msc, ii, data + ii * 8 + 6);
+               /* When emulating three-button mode, it is important
+                * to have the current touch information before
+                * generating a click event.
+                */
+               x = (signed char)data[1];
+               y = (signed char)data[2];
+               clicks = data[3];
+               break;
+       case 0x20: /* Theoretically battery status (0-100), but I have
+                   * never seen it -- maybe it is only upon request.
+                   */
+       case 0x60: /* Unknown, maybe laser on/off. */
+       case 0x61: /* Laser reflection status change.
+                   * data[1]: 0 = spotted, 1 = lost
+                   */
+       default:
+               return 0;
+       }
+
+       magicmouse_emit_buttons(msc, clicks & 3);
+       input_report_rel(input, REL_X, x);
+       input_report_rel(input, REL_Y, y);
+       input_sync(input);
+       return 1;
+}
+
+static int magicmouse_input_open(struct input_dev *dev)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+
+       return hid->ll_driver->open(hid);
+}
+
+static void magicmouse_input_close(struct input_dev *dev)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+
+       hid->ll_driver->close(hid);
+}
+
+static void magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev)
+{
+       input_set_drvdata(input, hdev);
+       input->event = hdev->ll_driver->hidinput_input_event;
+       input->open = magicmouse_input_open;
+       input->close = magicmouse_input_close;
+
+       input->name = hdev->name;
+       input->phys = hdev->phys;
+       input->uniq = hdev->uniq;
+       input->id.bustype = hdev->bus;
+       input->id.vendor = hdev->vendor;
+       input->id.product = hdev->product;
+       input->id.version = hdev->version;
+       input->dev.parent = hdev->dev.parent;
+
+       __set_bit(EV_KEY, input->evbit);
+       __set_bit(BTN_LEFT, input->keybit);
+       __set_bit(BTN_RIGHT, input->keybit);
+       if (emulate_3button)
+               __set_bit(BTN_MIDDLE, input->keybit);
+       __set_bit(BTN_TOOL_FINGER, input->keybit);
+
+       __set_bit(EV_REL, input->evbit);
+       __set_bit(REL_X, input->relbit);
+       __set_bit(REL_Y, input->relbit);
+       if (emulate_scroll_wheel)
+               __set_bit(REL_WHEEL, input->relbit);
+
+       if (report_touches) {
+               __set_bit(EV_ABS, input->evbit);
+
+               input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0);
+               input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0);
+               input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0);
+               input_set_abs_params(input, ABS_MT_ORIENTATION, -32, 31, 1, 0);
+               input_set_abs_params(input, ABS_MT_POSITION_X, -1100, 1358,
+                               4, 0);
+               /* Note: Touch Y position from the device is inverted relative
+                * to how pointer motion is reported (and relative to how USB
+                * HID recommends the coordinates work).  This driver keeps
+                * the origin at the same position, and just uses the additive
+                * inverse of the reported Y.
+                */
+               input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, 2047,
+                               4, 0);
+       }
+
+       if (report_undeciphered) {
+               __set_bit(EV_MSC, input->evbit);
+               __set_bit(MSC_RAW, input->mscbit);
+       }
+}
+
+static int magicmouse_probe(struct hid_device *hdev,
+       const struct hid_device_id *id)
+{
+       __u8 feature_1[] = { 0xd7, 0x01 };
+       __u8 feature_2[] = { 0xf8, 0x01, 0x32 };
+       struct input_dev *input;
+       struct magicmouse_sc *msc;
+       struct hid_report *report;
+       int ret;
+
+       msc = kzalloc(sizeof(*msc), GFP_KERNEL);
+       if (msc == NULL) {
+               dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n");
+               return -ENOMEM;
+       }
+
+       msc->quirks = id->driver_data;
+       hid_set_drvdata(hdev, msc);
+
+       ret = hid_parse(hdev);
+       if (ret) {
+               dev_err(&hdev->dev, "magicmouse hid parse failed\n");
+               goto err_free;
+       }
+
+       ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+       if (ret) {
+               dev_err(&hdev->dev, "magicmouse hw start failed\n");
+               goto err_free;
+       }
+
+       report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID);
+       if (!report) {
+               dev_err(&hdev->dev, "unable to register touch report\n");
+               ret = -ENOMEM;
+               goto err_stop_hw;
+       }
+       report->size = 6;
+
+       ret = hdev->hid_output_raw_report(hdev, feature_1, sizeof(feature_1),
+                       HID_FEATURE_REPORT);
+       if (ret != sizeof(feature_1)) {
+               dev_err(&hdev->dev, "unable to request touch data (1:%d)\n",
+                               ret);
+               goto err_stop_hw;
+       }
+       ret = hdev->hid_output_raw_report(hdev, feature_2,
+                       sizeof(feature_2), HID_FEATURE_REPORT);
+       if (ret != sizeof(feature_2)) {
+               dev_err(&hdev->dev, "unable to request touch data (2:%d)\n",
+                               ret);
+               goto err_stop_hw;
+       }
+
+       input = input_allocate_device();
+       if (!input) {
+               dev_err(&hdev->dev, "can't alloc input device\n");
+               ret = -ENOMEM;
+               goto err_stop_hw;
+       }
+       magicmouse_setup_input(input, hdev);
+
+       ret = input_register_device(input);
+       if (ret) {
+               dev_err(&hdev->dev, "input device registration failed\n");
+               goto err_input;
+       }
+       msc->input = input;
+
+       return 0;
+err_input:
+       input_free_device(input);
+err_stop_hw:
+       hid_hw_stop(hdev);
+err_free:
+       kfree(msc);
+       return ret;
+}
+
+static void magicmouse_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+}
+
+static const struct hid_device_id magic_mice[] = {
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE),
+               .driver_data = 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, magic_mice);
+
+static struct hid_driver magicmouse_driver = {
+       .name = "magicmouse",
+       .id_table = magic_mice,
+       .probe = magicmouse_probe,
+       .remove = magicmouse_remove,
+       .raw_event = magicmouse_raw_event,
+};
+
+static int __init magicmouse_init(void)
+{
+       int ret;
+
+       ret = hid_register_driver(&magicmouse_driver);
+       if (ret)
+               printk(KERN_ERR "can't register magicmouse driver\n");
+
+       return ret;
+}
+
+static void __exit magicmouse_exit(void)
+{
+       hid_unregister_driver(&magicmouse_driver);
+}
+
+module_init(magicmouse_init);
+module_exit(magicmouse_exit);
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c
new file mode 100644 (file)
index 0000000..c871816
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ *  HID driver for the multitouch panel on the ASUS EeePC T91MT
+ *
+ *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
+ *  Copyright (c) 2010 Teemu Tuominen <teemu.tuominen@cybercom.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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include "usbhid/usbhid.h"
+
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("MosArt dual-touch panel");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct mosart_data {
+       __u16 x, y;
+       __u8 id;
+       bool valid;             /* valid finger data, or just placeholder? */
+       bool first;             /* is this the first finger in this frame? */
+       bool activity_now;      /* at least one active finger in this frame? */
+       bool activity;          /* at least one active finger previously? */
+};
+
+static int mosart_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_TIPPRESSURE:
+               case HID_DG_WIDTH:
+               case HID_DG_HEIGHT:
+                       return -1;
+               case HID_DG_INRANGE:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+
+               }
+               return 0;
+
+       case 0xff000000:
+               /* ignore HID features */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int mosart_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       if (usage->type == EV_KEY || usage->type == EV_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole finger has been parsed,
+ * so that it can decide what to send to the input layer.
+ */
+static void mosart_filter_event(struct mosart_data *td, struct input_dev *input)
+{
+       td->first = !td->first; /* touchscreen emulation */
+
+       if (!td->valid) {
+               /*
+                * touchscreen emulation: if no finger in this frame is valid
+                * and there previously was finger activity, this is a release
+                */ 
+               if (!td->first && !td->activity_now && td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 0);
+                       td->activity = false;
+               }
+               return;
+       }
+
+       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id);
+       input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x);
+       input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y);
+
+       input_mt_sync(input);
+       td->valid = false;
+
+       /* touchscreen emulation: if first active finger in this frame... */
+       if (!td->activity_now) {
+               /* if there was no previous activity, emit touch event */
+               if (!td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+                       td->activity = true;
+               }
+               td->activity_now = true;
+               /* and in any case this is our preferred finger */
+               input_event(input, EV_ABS, ABS_X, td->x);
+               input_event(input, EV_ABS, ABS_Y, td->y);
+       }
+}
+
+
+static int mosart_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct mosart_data *td = hid_get_drvdata(hid);
+
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+                       td->valid = !!value;
+                       break;
+               case HID_GD_X:
+                       td->x = value;
+                       break;
+               case HID_GD_Y:
+                       td->y = value;
+                       mosart_filter_event(td, input);
+                       break;
+               case HID_DG_CONTACTID:
+                       td->id = value;
+                       break;
+               case HID_DG_CONTACTCOUNT:
+                       /* touch emulation: this is the last field in a frame */
+                       td->first = false;
+                       td->activity_now = false;
+                       break;
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+                       /* avoid interference from generic hidinput handling */
+                       break;
+
+               default:
+                       /* fallback to the generic hidinput handling */
+                       return 0;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int mosart_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+       int ret;
+       struct mosart_data *td;
+
+
+       td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL);
+       if (!td) {
+               dev_err(&hdev->dev, "cannot allocate MosArt data\n");
+               return -ENOMEM;
+       }
+       td->valid = false;
+       td->activity = false;
+       td->activity_now = false;
+       td->first = false;
+       hid_set_drvdata(hdev, td);
+
+       /* currently, it's better to have one evdev device only */
+#if 0
+       hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+#endif
+
+       ret = hid_parse(hdev);
+       if (ret == 0)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret == 0) {
+               struct hid_report_enum *re = hdev->report_enum
+                                               + HID_FEATURE_REPORT;
+               struct hid_report *r = re->report_id_hash[7];
+
+               r->field[0]->value[0] = 0x02;
+               usbhid_submit_report(hdev, r, USB_DIR_OUT);
+       } else 
+               kfree(td);
+
+       return ret;
+}
+
+static void mosart_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id mosart_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, mosart_devices);
+
+static const struct hid_usage_id mosart_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver mosart_driver = {
+       .name = "mosart",
+       .id_table = mosart_devices,
+       .probe = mosart_probe,
+       .remove = mosart_remove,
+       .input_mapping = mosart_input_mapping,
+       .input_mapped = mosart_input_mapped,
+       .usage_table = mosart_grabbed_usages,
+       .event = mosart_event,
+};
+
+static int __init mosart_init(void)
+{
+       return hid_register_driver(&mosart_driver);
+}
+
+static void __exit mosart_exit(void)
+{
+       hid_unregister_driver(&mosart_driver);
+}
+
+module_init(mosart_init);
+module_exit(mosart_exit);
+
index 49ce69d7bba754ee37e62ec386ab48385879b52a..3234c729a895f1cf733e59149c07eb5e83fac1b6 100644 (file)
                                        EV_KEY, (c))
 
 struct ntrig_data {
-       __s32 x, y, id, w, h;
-       char reading_a_point, found_contact_id;
-       char pen_active;
-       char finger_active;
-       char inverted;
+       /* Incoming raw values for a single contact */
+       __u16 x, y, w, h;
+       __u16 id;
+       __u8 confidence;
+
+       bool reading_mt;
+       __u8 first_contact_confidence;
+
+       __u8 mt_footer[4];
+       __u8 mt_foot_count;
 };
 
 /*
@@ -42,8 +47,11 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                struct hid_field *field, struct hid_usage *usage,
                unsigned long **bit, int *max)
 {
-       switch (usage->hid & HID_USAGE_PAGE) {
+       /* No special mappings needed for the pen and single touch */
+       if (field->physical)
+               return 0;
 
+       switch (usage->hid & HID_USAGE_PAGE) {
        case HID_UP_GENDESK:
                switch (usage->hid) {
                case HID_GD_X:
@@ -66,18 +74,12 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
        case HID_UP_DIGITIZER:
                switch (usage->hid) {
                /* we do not want to map these for now */
-               case HID_DG_CONTACTID: /* value is useless */
+               case HID_DG_CONTACTID: /* Not trustworthy, squelch for now */
                case HID_DG_INPUTMODE:
                case HID_DG_DEVICEINDEX:
-               case HID_DG_CONTACTCOUNT:
                case HID_DG_CONTACTMAX:
                        return -1;
 
-               /* original mapping by Rafi Rubin */
-               case HID_DG_CONFIDENCE:
-                       nt_map_key_clear(BTN_TOOL_DOUBLETAP);
-                       return 1;
-
                /* width/height mapped on TouchMajor/TouchMinor/Orientation */
                case HID_DG_WIDTH:
                        hid_map_usage(hi, usage, bit, max,
@@ -104,6 +106,10 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
                struct hid_field *field, struct hid_usage *usage,
                unsigned long **bit, int *max)
 {
+       /* No special mappings needed for the pen and single touch */
+       if (field->physical)
+               return 0;
+
        if (usage->type == EV_KEY || usage->type == EV_REL
                        || usage->type == EV_ABS)
                clear_bit(usage->code, *bit);
@@ -123,31 +129,30 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
        struct input_dev *input = field->hidinput->input;
        struct ntrig_data *nd = hid_get_drvdata(hid);
 
+       /* No special handling needed for the pen */
+       if (field->application == HID_DG_PEN)
+               return 0;
+
         if (hid->claimed & HID_CLAIMED_INPUT) {
                switch (usage->hid) {
-
-               case HID_DG_INRANGE:
-                       if (field->application & 0x3)
-                               nd->pen_active = (value != 0);
-                       else
-                               nd->finger_active = (value != 0);
-                       return 0;
-
-               case HID_DG_INVERT:
-                       nd->inverted = value;
-                       return 0;
-
+               case 0xff000001:
+                       /* Tag indicating the start of a multitouch group */
+                       nd->reading_mt = 1;
+                       nd->first_contact_confidence = 0;
+                       break;
+               case HID_DG_CONFIDENCE:
+                       nd->confidence = value;
+                       break;
                case HID_GD_X:
                        nd->x = value;
-                       nd->reading_a_point = 1;
+                       /* Clear the contact footer */
+                       nd->mt_foot_count = 0;
                        break;
                case HID_GD_Y:
                        nd->y = value;
                        break;
                case HID_DG_CONTACTID:
                        nd->id = value;
-                       /* we receive this only when in multitouch mode */
-                       nd->found_contact_id = 1;
                        break;
                case HID_DG_WIDTH:
                        nd->w = value;
@@ -159,35 +164,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
                         * report received in a finger event. We want
                         * to emit a normal (X, Y) position
                         */
-                       if (!nd->found_contact_id) {
-                               if (nd->pen_active && nd->finger_active) {
-                                       input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
-                                       input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
-                               }
+                       if (!nd->reading_mt) {
+                               input_report_key(input, BTN_TOOL_DOUBLETAP,
+                                                (nd->confidence != 0));
                                input_event(input, EV_ABS, ABS_X, nd->x);
                                input_event(input, EV_ABS, ABS_Y, nd->y);
                        }
                        break;
-               case HID_DG_TIPPRESSURE:
-                       /*
-                        * when in single touch mode, this is the last
-                        * report received in a pen event. We want
-                        * to emit a normal (X, Y) position
-                        */
-                       if (! nd->found_contact_id) {
-                               if (nd->pen_active && nd->finger_active) {
-                                       input_report_key(input,
-                                                       nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
-                                                       , 0);
-                                       input_report_key(input,
-                                                       nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
-                                                       , 1);
-                               }
-                               input_event(input, EV_ABS, ABS_X, nd->x);
-                               input_event(input, EV_ABS, ABS_Y, nd->y);
-                               input_event(input, EV_ABS, ABS_PRESSURE, value);
-                       }
-                       break;
                case 0xff000002:
                        /*
                         * we receive this when the device is in multitouch
@@ -195,10 +178,34 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
                         * this usage tells if the contact point is real
                         * or a placeholder
                         */
-                       if (!nd->reading_a_point || value != 1)
+
+                       /* Shouldn't get more than 4 footer packets, so skip */
+                       if (nd->mt_foot_count >= 4)
                                break;
+
+                       nd->mt_footer[nd->mt_foot_count++] = value;
+
+                       /* if the footer isn't complete break */
+                       if (nd->mt_foot_count != 4)
+                               break;
+
+                       /* Pen activity signal, trigger end of touch. */
+                       if (nd->mt_footer[2]) {
+                               nd->confidence = 0;
+                               break;
+                       }
+
+                       /* If the contact was invalid */
+                       if (!(nd->confidence && nd->mt_footer[0])
+                                       || nd->w <= 250
+                                       || nd->h <= 190) {
+                               nd->confidence = 0;
+                               break;
+                       }
+
                        /* emit a normal (X, Y) for the first point only */
                        if (nd->id == 0) {
+                               nd->first_contact_confidence = nd->confidence;
                                input_event(input, EV_ABS, ABS_X, nd->x);
                                input_event(input, EV_ABS, ABS_Y, nd->y);
                        }
@@ -220,8 +227,39 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
                                                ABS_MT_TOUCH_MINOR, nd->w);
                        }
                        input_mt_sync(field->hidinput->input);
-                       nd->reading_a_point = 0;
-                       nd->found_contact_id = 0;
+                       break;
+
+               case HID_DG_CONTACTCOUNT: /* End of a multitouch group */
+                       if (!nd->reading_mt)
+                               break;
+
+                       nd->reading_mt = 0;
+
+                       if (nd->first_contact_confidence) {
+                               switch (value) {
+                               case 0: /* for single touch devices */
+                               case 1:
+                                       input_report_key(input,
+                                                       BTN_TOOL_DOUBLETAP, 1);
+                                       break;
+                               case 2:
+                                       input_report_key(input,
+                                                       BTN_TOOL_TRIPLETAP, 1);
+                                       break;
+                               case 3:
+                               default:
+                                       input_report_key(input,
+                                                       BTN_TOOL_QUADTAP, 1);
+                               }
+                               input_report_key(input, BTN_TOUCH, 1);
+                       } else {
+                               input_report_key(input,
+                                               BTN_TOOL_DOUBLETAP, 0);
+                               input_report_key(input,
+                                               BTN_TOOL_TRIPLETAP, 0);
+                               input_report_key(input,
+                                               BTN_TOOL_QUADTAP, 0);
+                       }
                        break;
 
                default:
@@ -231,8 +269,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
        }
 
        /* we have handled the hidinput part, now remains hiddev */
-        if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
-                hid->hiddev_hid_event(hid, field, usage, value);
+       if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
 
        return 1;
 }
@@ -241,23 +279,67 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
        int ret;
        struct ntrig_data *nd;
+       struct hid_input *hidinput;
+       struct input_dev *input;
+
+       if (id->driver_data)
+               hdev->quirks |= HID_QUIRK_MULTI_INPUT;
 
        nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
        if (!nd) {
                dev_err(&hdev->dev, "cannot allocate N-Trig data\n");
                return -ENOMEM;
        }
-       nd->reading_a_point = 0;
-       nd->found_contact_id = 0;
+
+       nd->reading_mt = 0;
        hid_set_drvdata(hdev, nd);
 
        ret = hid_parse(hdev);
-       if (!ret)
-               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+       if (ret) {
+               dev_err(&hdev->dev, "parse failed\n");
+               goto err_free;
+       }
+
+       ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+       if (ret) {
+               dev_err(&hdev->dev, "hw start failed\n");
+               goto err_free;
+       }
 
-       if (ret)
-               kfree (nd);
 
+       list_for_each_entry(hidinput, &hdev->inputs, list) {
+               input = hidinput->input;
+               switch (hidinput->report->field[0]->application) {
+               case HID_DG_PEN:
+                       input->name = "N-Trig Pen";
+                       break;
+               case HID_DG_TOUCHSCREEN:
+                       __clear_bit(BTN_TOOL_PEN, input->keybit);
+                       /*
+                        * A little something special to enable
+                        * two and three finger taps.
+                        */
+                       __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
+                       __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
+                       __set_bit(BTN_TOOL_QUADTAP, input->keybit);
+                       /*
+                        * The physical touchscreen (single touch)
+                        * input has a value for physical, whereas
+                        * the multitouch only has logical input
+                        * fields.
+                        */
+                       input->name =
+                               (hidinput->report->field[0]
+                                ->physical) ?
+                               "N-Trig Touchscreen" :
+                               "N-Trig MultiTouch";
+                       break;
+               }
+       }
+
+       return 0;
+err_free:
+       kfree(nd);
        return ret;
 }
 
@@ -276,7 +358,7 @@ MODULE_DEVICE_TABLE(hid, ntrig_devices);
 
 static const struct hid_usage_id ntrig_grabbed_usages[] = {
        { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
-       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
 };
 
 static struct hid_driver ntrig_driver = {
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
new file mode 100644 (file)
index 0000000..aa9a960
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  HID driver for Ortek WKB-2000 (wireless keyboard + mouse trackpad).
+ *  Fixes LogicalMaximum error in USB report description, see
+ *  http://bugzilla.kernel.org/show_bug.cgi?id=14787
+ *
+ *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int rsize)
+{
+       if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
+               dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
+                               "report descriptor.\n");
+               rdesc[55] = 0x92;
+       }
+}
+
+static const struct hid_device_id ortek_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, ortek_devices);
+
+static struct hid_driver ortek_driver = {
+       .name = "ortek",
+       .id_table = ortek_devices,
+       .report_fixup = ortek_report_fixup
+};
+
+static int __init ortek_init(void)
+{
+       return hid_register_driver(&ortek_driver);
+}
+
+static void __exit ortek_exit(void)
+{
+       hid_unregister_driver(&ortek_driver);
+}
+
+module_init(ortek_init);
+module_exit(ortek_exit);
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-quanta.c b/drivers/hid/hid-quanta.c
new file mode 100644 (file)
index 0000000..01dd51c
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ *  HID driver for Quanta Optical Touch dual-touch panels
+ *
+ *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("Quanta dual-touch panel");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct quanta_data {
+       __u16 x, y;
+       __u8 id;
+       bool valid;             /* valid finger data, or just placeholder? */
+       bool first;             /* is this the first finger in this frame? */
+       bool activity_now;      /* at least one active finger in this frame? */
+       bool activity;          /* at least one active finger previously? */
+};
+
+static int quanta_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_TIPPRESSURE:
+               case HID_DG_WIDTH:
+               case HID_DG_HEIGHT:
+                       return -1;
+               case HID_DG_INRANGE:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+               }
+               return 0;
+
+       case 0xff000000:
+               /* ignore vendor-specific features */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int quanta_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       if (usage->type == EV_KEY || usage->type == EV_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole finger has been parsed,
+ * so that it can decide what to send to the input layer.
+ */
+static void quanta_filter_event(struct quanta_data *td, struct input_dev *input)
+{
+       
+       td->first = !td->first; /* touchscreen emulation */
+
+       if (!td->valid) {
+               /*
+                * touchscreen emulation: if no finger in this frame is valid
+                * and there previously was finger activity, this is a release
+                */ 
+               if (!td->first && !td->activity_now && td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 0);
+                       td->activity = false;
+               }
+               return;
+       }
+
+       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id);
+       input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x);
+       input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y);
+
+       input_mt_sync(input);
+       td->valid = false;
+
+       /* touchscreen emulation: if first active finger in this frame... */
+       if (!td->activity_now) {
+               /* if there was no previous activity, emit touch event */
+               if (!td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+                       td->activity = true;
+               }
+               td->activity_now = true;
+               /* and in any case this is our preferred finger */
+               input_event(input, EV_ABS, ABS_X, td->x);
+               input_event(input, EV_ABS, ABS_Y, td->y);
+       }
+}
+
+
+static int quanta_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct quanta_data *td = hid_get_drvdata(hid);
+
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+                       td->valid = !!value;
+                       break;
+               case HID_GD_X:
+                       td->x = value;
+                       break;
+               case HID_GD_Y:
+                       td->y = value;
+                       quanta_filter_event(td, input);
+                       break;
+               case HID_DG_CONTACTID:
+                       td->id = value;
+                       break;
+               case HID_DG_CONTACTCOUNT:
+                       /* touch emulation: this is the last field in a frame */
+                       td->first = false;
+                       td->activity_now = false;
+                       break;
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+                       /* avoid interference from generic hidinput handling */
+                       break;
+
+               default:
+                       /* fallback to the generic hidinput handling */
+                       return 0;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int quanta_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+       int ret;
+       struct quanta_data *td;
+
+       td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL);
+       if (!td) {
+               dev_err(&hdev->dev, "cannot allocate Quanta Touch data\n");
+               return -ENOMEM;
+       }
+       td->valid = false;
+       td->activity = false;
+       td->activity_now = false;
+       td->first = false;
+       hid_set_drvdata(hdev, td);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(td);
+
+       return ret;
+}
+
+static void quanta_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id quanta_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
+                       USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
+                       USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, quanta_devices);
+
+static const struct hid_usage_id quanta_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver quanta_driver = {
+       .name = "quanta-touch",
+       .id_table = quanta_devices,
+       .probe = quanta_probe,
+       .remove = quanta_remove,
+       .input_mapping = quanta_input_mapping,
+       .input_mapped = quanta_input_mapped,
+       .usage_table = quanta_grabbed_usages,
+       .event = quanta_event,
+};
+
+static int __init quanta_init(void)
+{
+       return hid_register_driver(&quanta_driver);
+}
+
+static void __exit quanta_exit(void)
+{
+       hid_unregister_driver(&quanta_driver);
+}
+
+module_init(quanta_init);
+module_exit(quanta_exit);
+
index 5b222eed06929806f76b3896a0b23ae471120d25..510dd134059784845d3e978cfb4e2e8abe94743a 100644 (file)
  *
  * 3. 135 byte report descriptor
  * Report #4 has an array field with logical range 0..17 instead of 1..14.
+ *
+ * 4. 171 byte report descriptor
+ * Report #3 has an array field with logical range 0..1 instead of 1..3.
  */
+static inline void samsung_dev_trace(struct hid_device *hdev,
+               unsigned int rsize)
+{
+       dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report "
+                       "descriptor\n", rsize);
+}
+
 static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                unsigned int rsize)
 {
@@ -47,8 +57,7 @@ static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                        rdesc[177] == 0x75 && rdesc[178] == 0x30 &&
                        rdesc[179] == 0x95 && rdesc[180] == 0x01 &&
                        rdesc[182] == 0x40) {
-               dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report "
-                               "descriptor\n", 184);
+               samsung_dev_trace(hdev, 184);
                rdesc[176] = 0xff;
                rdesc[178] = 0x08;
                rdesc[180] = 0x06;
@@ -56,17 +65,21 @@ static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        } else
        if (rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 &&
                        rdesc[194] == 0x25 && rdesc[195] == 0x12) {
-               dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report "
-                               "descriptor\n", 203);
+               samsung_dev_trace(hdev, 203);
                rdesc[193] = 0x1;
                rdesc[195] = 0xf;
        } else
        if (rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 &&
                        rdesc[126] == 0x25 && rdesc[127] == 0x11) {
-               dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report "
-                               "descriptor\n", 135);
+               samsung_dev_trace(hdev, 135);
                rdesc[125] = 0x1;
                rdesc[127] = 0xe;
+       } else
+       if (rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 &&
+                       rdesc[162] == 0x25 && rdesc[163] == 0x01) {
+               samsung_dev_trace(hdev, 171);
+               rdesc[161] = 0x1;
+               rdesc[163] = 0x3;
        }
 }
 
index 4e8450228a24f8e097dd7c7f073815f5873b7c1c..9bf00d77d92b8f7201b910fe39ab374ba1015ae0 100644 (file)
@@ -48,7 +48,7 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  * to "operational".  Without this, the ps3 controller will not report any
  * events.
  */
-static int sony_set_operational(struct hid_device *hdev)
+static int sony_set_operational_usb(struct hid_device *hdev)
 {
        struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
        struct usb_device *dev = interface_to_usbdev(intf);
@@ -73,6 +73,12 @@ static int sony_set_operational(struct hid_device *hdev)
        return ret;
 }
 
+static int sony_set_operational_bt(struct hid_device *hdev)
+{
+       unsigned char buf[] = { 0x53, 0xf4,  0x42, 0x03, 0x00, 0x00 };
+       return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
+}
+
 static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
        int ret;
@@ -81,7 +87,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
        sc = kzalloc(sizeof(*sc), GFP_KERNEL);
        if (sc == NULL) {
-               dev_err(&hdev->dev, "can't alloc apple descriptor\n");
+               dev_err(&hdev->dev, "can't alloc sony descriptor\n");
                return -ENOMEM;
        }
 
@@ -101,7 +107,17 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
                goto err_free;
        }
 
-       ret = sony_set_operational(hdev);
+       switch (hdev->bus) {
+       case BUS_USB:
+               ret = sony_set_operational_usb(hdev);
+               break;
+       case BUS_BLUETOOTH:
+               ret = sony_set_operational_bt(hdev);
+               break;
+       default:
+               ret = 0;
+       }
+
        if (ret < 0)
                goto err_stop;
 
@@ -121,6 +137,7 @@ static void sony_remove(struct hid_device *hdev)
 
 static const struct hid_device_id sony_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
                .driver_data = VAIO_RDESC_CONSTANT },
        { }
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
new file mode 100644 (file)
index 0000000..2e592a0
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ *  HID driver for Stantum multitouch panels
+ *
+ *  Copyright (c) 2009 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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 <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("Stantum HID multitouch panels");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct stantum_data {
+       __s32 x, y, z, w, h;    /* x, y, pressure, width, height */
+       __u16 id;               /* touch id */
+       bool valid;             /* valid finger data, or just placeholder? */
+       bool first;             /* first finger in the HID packet? */
+       bool activity;          /* at least one active finger so far? */
+};
+
+static int stantum_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+               case HID_DG_CONFIDENCE:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+                       return -1;
+
+               case HID_DG_TIPSWITCH:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+
+               case HID_DG_WIDTH:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TOUCH_MAJOR);
+                       return 1;
+               case HID_DG_HEIGHT:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TOUCH_MINOR);
+                       input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
+                                       1, 1, 0, 0);
+                       return 1;
+               case HID_DG_TIPPRESSURE:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_PRESSURE);
+                       return 1;
+
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+
+               }
+               return 0;
+
+       case 0xff000000:
+               /* no input-oriented meaning */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int stantum_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       if (usage->type == EV_KEY || usage->type == EV_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole finger has been parsed,
+ * so that it can decide what to send to the input layer.
+ */
+static void stantum_filter_event(struct stantum_data *sd,
+                                       struct input_dev *input)
+{
+       bool wide;
+
+       if (!sd->valid) {
+               /*
+                * touchscreen emulation: if the first finger is not valid and
+                * there previously was finger activity, this is a release
+                */
+               if (sd->first && sd->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 0);
+                       sd->activity = false;
+               }
+               return;
+       }
+
+       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, sd->id);
+       input_event(input, EV_ABS, ABS_MT_POSITION_X, sd->x);
+       input_event(input, EV_ABS, ABS_MT_POSITION_Y, sd->y);
+
+       wide = (sd->w > sd->h);
+       input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
+       input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, wide ? sd->w : sd->h);
+       input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, wide ? sd->h : sd->w);
+
+       input_event(input, EV_ABS, ABS_MT_PRESSURE, sd->z);
+
+       input_mt_sync(input);
+       sd->valid = false;
+
+       /* touchscreen emulation */
+       if (sd->first) {
+               if (!sd->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+                       sd->activity = true;
+               }
+               input_event(input, EV_ABS, ABS_X, sd->x);
+               input_event(input, EV_ABS, ABS_Y, sd->y);
+       }
+       sd->first = false;
+}
+
+
+static int stantum_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct stantum_data *sd = hid_get_drvdata(hid);
+
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+                       /* this is the last field in a finger */
+                       stantum_filter_event(sd, input);
+                       break;
+               case HID_DG_WIDTH:
+                       sd->w = value;
+                       break;
+               case HID_DG_HEIGHT:
+                       sd->h = value;
+                       break;
+               case HID_GD_X:
+                       sd->x = value;
+                       break;
+               case HID_GD_Y:
+                       sd->y = value;
+                       break;
+               case HID_DG_TIPPRESSURE:
+                       sd->z = value;
+                       break;
+               case HID_DG_CONTACTID:
+                       sd->id = value;
+                       break;
+               case HID_DG_CONFIDENCE:
+                       sd->valid = !!value;
+                       break;
+               case 0xff000002:
+                       /* this comes only before the first finger */
+                       sd->first = true;
+                       break;
+
+               default:
+                       /* ignore the others */
+                       return 1;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int stantum_probe(struct hid_device *hdev,
+                               const struct hid_device_id *id)
+{
+       int ret;
+       struct stantum_data *sd;
+
+       sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL);
+       if (!sd) {
+               dev_err(&hdev->dev, "cannot allocate Stantum data\n");
+               return -ENOMEM;
+       }
+       sd->valid = false;
+       sd->first = false;
+       sd->activity = false;
+       hid_set_drvdata(hdev, sd);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(sd);
+
+       return ret;
+}
+
+static void stantum_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id stantum_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, stantum_devices);
+
+static const struct hid_usage_id stantum_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver stantum_driver = {
+       .name = "stantum",
+       .id_table = stantum_devices,
+       .probe = stantum_probe,
+       .remove = stantum_remove,
+       .input_mapping = stantum_input_mapping,
+       .input_mapped = stantum_input_mapped,
+       .usage_table = stantum_grabbed_usages,
+       .event = stantum_event,
+};
+
+static int __init stantum_init(void)
+{
+       return hid_register_driver(&stantum_driver);
+}
+
+static void __exit stantum_exit(void)
+{
+       hid_unregister_driver(&stantum_driver);
+}
+
+module_init(stantum_init);
+module_exit(stantum_exit);
+
index 7475421722428bac0015bc3335190fbbf931abde..8d3b46f5d14956ea4bf60bde0f067cf8bed22105 100644 (file)
@@ -142,6 +142,7 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
                wdata->butstate = rw;
                input_report_key(input, BTN_0, rw & 0x02);
                input_report_key(input, BTN_1, rw & 0x01);
+               input_report_key(input, BTN_TOOL_FINGER, 0xf0);
                input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
                input_sync(input);
        }
@@ -155,7 +156,9 @@ static int wacom_probe(struct hid_device *hdev,
        struct hid_input *hidinput;
        struct input_dev *input;
        struct wacom_data *wdata;
+       char rep_data[2];
        int ret;
+       int limit;
 
        wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
        if (wdata == NULL) {
@@ -165,6 +168,7 @@ static int wacom_probe(struct hid_device *hdev,
 
        hid_set_drvdata(hdev, wdata);
 
+       /* Parse the HID report now */
        ret = hid_parse(hdev);
        if (ret) {
                dev_err(&hdev->dev, "parse failed\n");
@@ -177,6 +181,31 @@ static int wacom_probe(struct hid_device *hdev,
                goto err_free;
        }
 
+       /*
+        * Note that if the raw queries fail, it's not a hard failure and it
+        * is safe to continue
+        */
+
+       /* Set Wacom mode2 */
+       rep_data[0] = 0x03; rep_data[1] = 0x00;
+       limit = 3;
+       do {
+               ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
+                               HID_FEATURE_REPORT);
+       } while (ret < 0 && limit-- > 0);
+       if (ret < 0)
+               dev_warn(&hdev->dev, "failed to poke device #1, %d\n", ret);
+
+       /* 0x06 - high reporting speed, 0x05 - low speed */
+       rep_data[0] = 0x06; rep_data[1] = 0x00;
+       limit = 3;
+       do {
+               ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
+                               HID_FEATURE_REPORT);
+       } while (ret < 0 && limit-- > 0);
+       if (ret < 0)
+               dev_warn(&hdev->dev, "failed to poke device #2, %d\n", ret);
+
        hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
        input = hidinput->input;
 
@@ -196,6 +225,9 @@ static int wacom_probe(struct hid_device *hdev,
        /* Pad */
        input->evbit[0] |= BIT(EV_MSC);
        input->mscbit[0] |= BIT(MSC_SERIAL);
+       set_bit(BTN_0, input->keybit);
+       set_bit(BTN_1, input->keybit);
+       set_bit(BTN_TOOL_FINGER, input->keybit);
 
        /* Distance, rubber and mouse */
        input->absbit[0] |= BIT(ABS_DISTANCE);
index cdd136942bcaa9e1435b1d2efc5444bf6f3317fc..d04476700b7b4eb792e41d381a61b535e0666f8f 100644 (file)
@@ -134,7 +134,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
                goto out;
        }
 
-       ret = dev->hid_output_raw_report(dev, buf, count);
+       ret = dev->hid_output_raw_report(dev, buf, count, HID_OUTPUT_REPORT);
 out:
        kfree(buf);
        return ret;
index e2997a8d5e1b4b726ac9b62f0d60e2647ae37ce4..56d06cd8075b32f9cc6faec1f1909925f3f79c43 100644 (file)
@@ -5,7 +5,7 @@
  *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
  *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
  *  Copyright (c) 2007-2008 Oliver Neukum
- *  Copyright (c) 2006-2009 Jiri Kosina
+ *  Copyright (c) 2006-2010 Jiri Kosina
  */
 
 /*
@@ -316,6 +316,7 @@ static int hid_submit_out(struct hid_device *hid)
                        err_hid("usb_submit_urb(out) failed");
                        return -1;
                }
+               usbhid->last_out = jiffies;
        } else {
                /*
                 * queue work to wake up the device.
@@ -377,6 +378,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
                        err_hid("usb_submit_urb(ctrl) failed");
                        return -1;
                }
+               usbhid->last_ctrl = jiffies;
        } else {
                /*
                 * queue work to wake up the device.
@@ -512,9 +514,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
                usbhid->out[usbhid->outhead].report = report;
                usbhid->outhead = head;
 
-               if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl))
+               if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) {
                        if (hid_submit_out(hid))
                                clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
+               } else {
+                       /*
+                        * the queue is known to run
+                        * but an earlier request may be stuck
+                        * we may need to time out
+                        * no race because this is called under
+                        * spinlock
+                        */
+                       if (time_after(jiffies, usbhid->last_out + HZ * 5))
+                               usb_unlink_urb(usbhid->urbout);
+               }
                return;
        }
 
@@ -535,9 +548,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
        usbhid->ctrl[usbhid->ctrlhead].dir = dir;
        usbhid->ctrlhead = head;
 
-       if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl))
+       if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) {
                if (hid_submit_ctrl(hid))
                        clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
+       } else {
+               /*
+                * the queue is known to run
+                * but an earlier request may be stuck
+                * we may need to time out
+                * no race because this is called under
+                * spinlock
+                */
+               if (time_after(jiffies, usbhid->last_ctrl + HZ * 5))
+                       usb_unlink_urb(usbhid->urbctrl);
+       }
 }
 
 void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir)
@@ -774,7 +798,8 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
        return 0;
 }
 
-static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count)
+static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count,
+               unsigned char report_type)
 {
        struct usbhid_device *usbhid = hid->driver_data;
        struct usb_device *dev = hid_to_usb_dev(hid);
@@ -785,7 +810,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co
        ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
                HID_REQ_SET_REPORT,
                USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-               ((HID_OUTPUT_REPORT + 1) << 8) | *buf,
+               ((report_type + 1) << 8) | *buf,
                interface->desc.bInterfaceNumber, buf + 1, count - 1,
                USB_CTRL_SET_TIMEOUT);
 
@@ -981,9 +1006,6 @@ static int usbhid_start(struct hid_device *hid)
 
        spin_lock_init(&usbhid->lock);
 
-       usbhid->intf = intf;
-       usbhid->ifnum = interface->desc.bInterfaceNumber;
-
        usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
        if (!usbhid->urbctrl) {
                ret = -ENOMEM;
@@ -1154,6 +1176,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
 
        hid->driver_data = usbhid;
        usbhid->hid = hid;
+       usbhid->intf = intf;
+       usbhid->ifnum = interface->desc.bInterfaceNumber;
 
        ret = hid_add_device(hid);
        if (ret) {
@@ -1342,7 +1366,7 @@ static int hid_reset_resume(struct usb_interface *intf)
 
 #endif /* CONFIG_PM */
 
-static struct usb_device_id hid_usb_ids [] = {
+static const struct usb_device_id hid_usb_ids[] = {
        { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
                .bInterfaceClass = USB_INTERFACE_CLASS_HID },
        { }                                             /* Terminating entry */
index 38773dc2821b3360119afad656aab279046bdaba..7844280897d1940c1a02ac37b95305ad7ad49d39 100644 (file)
@@ -43,8 +43,10 @@ static const struct hid_blacklist {
 
        { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL },
 
+       { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
        { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
+       { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT },
 
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
@@ -57,6 +59,7 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
index 08f505ca2e3db47426a2940fb2876a2e89ba9e14..ec20400c7f2904bf793ac82b37cac65df03ac161 100644 (file)
@@ -80,12 +80,14 @@ struct usbhid_device {
        unsigned char ctrlhead, ctrltail;                               /* Control fifo head & tail */
        char *ctrlbuf;                                                  /* Control buffer */
        dma_addr_t ctrlbuf_dma;                                         /* Control buffer dma */
+       unsigned long last_ctrl;                                                /* record of last output for timeouts */
 
        struct urb *urbout;                                             /* Output URB */
        struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE];              /* Output pipe fifo */
        unsigned char outhead, outtail;                                 /* Output pipe fifo head & tail */
        char *outbuf;                                                   /* Output buffer */
        dma_addr_t outbuf_dma;                                          /* Output buffer dma */
+       unsigned long last_out;                                                 /* record of last output for timeouts */
 
        spinlock_t lock;                                                /* fifo spinlock */
        unsigned long iofl;                                             /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
index a31e77c776aeee3d0f14409710e5439de44f605b..b8156b4893bb51f107b83da463a5906f01641553 100644 (file)
@@ -179,7 +179,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
  *
  * Some, but not all, of these voltages have low/high limits.
  */
-#define ADT7462_VOLT_COUNT     12
+#define ADT7462_VOLT_COUNT     13
 
 #define ADT7462_VENDOR         0x41
 #define ADT7462_DEVICE         0x62
index 1c89d922d6199ad3215a6806eedc647bdc9bf415..fa9708c2d723d27b52eece60e6a2c525ee65246c 100644 (file)
@@ -686,7 +686,6 @@ static ssize_t set_fan1_div(
                data->fan1_div = 4;
                break;
        default:
-               mutex_unlock(&data->update_lock);
                count = -EINVAL;
                goto EXIT;
        }
index 6c9ace1b76f6db6ca810c5cf2c7cb89889da7984..2ad62c339cd2c9cf849dc3a551a8d47548ef2190 100644 (file)
@@ -213,7 +213,7 @@ int __init ams_init(void)
        return -ENODEV;
 }
 
-void ams_exit(void)
+void ams_sensor_detach(void)
 {
        /* Remove input device */
        ams_input_exit();
@@ -221,9 +221,6 @@ void ams_exit(void)
        /* Remove attributes */
        device_remove_file(&ams_info.of_dev->dev, &dev_attr_current);
 
-       /* Shut down implementation */
-       ams_info.exit();
-
        /* Flush interrupt worker
         *
         * We do this after ams_info.exit(), because an interrupt might
@@ -239,6 +236,12 @@ void ams_exit(void)
        pmf_unregister_irq_client(&ams_freefall_client);
 }
 
+static void __exit ams_exit(void)
+{
+       /* Shut down implementation */
+       ams_info.exit();
+}
+
 MODULE_AUTHOR("Stelian Pop, Michael Hanselmann");
 MODULE_DESCRIPTION("Apple Motion Sensor driver");
 MODULE_LICENSE("GPL");
index 2cbf8a6506c7e8fad72736773efa238367bf03f5..abeecd27b484fe2345f3c01dda91b7f74f079cd6 100644 (file)
@@ -238,6 +238,8 @@ static int ams_i2c_probe(struct i2c_client *client,
 static int ams_i2c_remove(struct i2c_client *client)
 {
        if (ams_info.has_device) {
+               ams_sensor_detach();
+
                /* Disable interrupts */
                ams_i2c_set_irq(AMS_IRQ_ALL, 0);
 
index fb18b3d3162bcebfe908fa5c678ccf6893fdb25d..4f61b3ee1b08b4ca0ee65f018becb0ef7128892e 100644 (file)
@@ -133,6 +133,8 @@ static void ams_pmu_get_xyz(s8 *x, s8 *y, s8 *z)
 
 static void ams_pmu_exit(void)
 {
+       ams_sensor_detach();
+
        /* Disable interrupts */
        ams_pmu_set_irq(AMS_IRQ_ALL, 0);
 
index 5ed387b0bd9aa08185e05bd790ac06976a8a7bed..b28d7e27a031727bc7cc83c18d28b9fc15b2160a 100644 (file)
@@ -61,6 +61,7 @@ extern struct ams ams_info;
 
 extern void ams_sensors(s8 *x, s8 *y, s8 *z);
 extern int ams_sensor_attach(void);
+extern void ams_sensor_detach(void);
 
 extern int ams_pmu_init(struct device_node *np);
 extern int ams_i2c_init(struct device_node *np);
index 6811346c1c622672a3fa51ff6bec71b602a84b3c..028284f544e306780860e97b6e5363c94b92056d 100644 (file)
@@ -1329,17 +1329,16 @@ static int atk_add(struct acpi_device *device)
                        &buf, ACPI_TYPE_PACKAGE);
        if (ret != AE_OK) {
                dev_dbg(&device->dev, "atk: method MBIF not found\n");
-               err = -ENODEV;
-               goto out;
-       }
-
-       obj = buf.pointer;
-       if (obj->package.count >= 2 &&
-                       obj->package.elements[1].type == ACPI_TYPE_STRING) {
-               dev_dbg(&device->dev, "board ID = %s\n",
-                               obj->package.elements[1].string.pointer);
+       } else {
+               obj = buf.pointer;
+               if (obj->package.count >= 2) {
+                       union acpi_object *id = &obj->package.elements[1];
+                       if (id->type == ACPI_TYPE_STRING)
+                               dev_dbg(&device->dev, "board ID = %s\n",
+                                       id->string.pointer);
+               }
+               ACPI_FREE(buf.pointer);
        }
-       ACPI_FREE(buf.pointer);
 
        err = atk_probe_if(data);
        if (err) {
index bd0fc67e804b37cc12b690f902312c7c9ee7f639..fa0728232e7179e6afc8b1b529948d13766d297e 100644 (file)
@@ -768,6 +768,7 @@ leave:
 static int watchdog_open(struct inode *inode, struct file *filp)
 {
        struct fschmd_data *pos, *data = NULL;
+       int watchdog_is_open;
 
        /* We get called from drivers/char/misc.c with misc_mtx hold, and we
           call misc_register() from fschmd_probe() with watchdog_data_mutex
@@ -782,10 +783,12 @@ static int watchdog_open(struct inode *inode, struct file *filp)
                }
        }
        /* Note we can never not have found data, so we don't check for this */
-       kref_get(&data->kref);
+       watchdog_is_open = test_and_set_bit(0, &data->watchdog_is_open);
+       if (!watchdog_is_open)
+               kref_get(&data->kref);
        mutex_unlock(&watchdog_data_mutex);
 
-       if (test_and_set_bit(0, &data->watchdog_is_open))
+       if (watchdog_is_open)
                return -EBUSY;
 
        /* Start the watchdog */
index cadcbd90ff3bc4f0c89db6cdd9c9da82becc46f1..72ff2c4e757d5255fd4c90daf72ec6f39c39745b 100644 (file)
@@ -851,17 +851,16 @@ static struct lm78_data *lm78_update_device(struct device *dev)
 static int __init lm78_isa_found(unsigned short address)
 {
        int val, save, found = 0;
-
-       /* We have to request the region in two parts because some
-          boards declare base+4 to base+7 as a PNP device */
-       if (!request_region(address, 4, "lm78")) {
-               pr_debug("lm78: Failed to request low part of region\n");
-               return 0;
-       }
-       if (!request_region(address + 4, 4, "lm78")) {
-               pr_debug("lm78: Failed to request high part of region\n");
-               release_region(address, 4);
-               return 0;
+       int port;
+
+       /* Some boards declare base+0 to base+7 as a PNP device, some base+4
+        * to base+7 and some base+5 to base+6. So we better request each port
+        * individually for the probing phase. */
+       for (port = address; port < address + LM78_EXTENT; port++) {
+               if (!request_region(port, 1, "lm78")) {
+                       pr_debug("lm78: Failed to request port 0x%x\n", port);
+                       goto release;
+               }
        }
 
 #define REALLY_SLOW_IO
@@ -925,8 +924,8 @@ static int __init lm78_isa_found(unsigned short address)
                        val & 0x80 ? "LM79" : "LM78", (int)address);
 
  release:
-       release_region(address + 4, 4);
-       release_region(address, 4);
+       for (port--; port >= address; port--)
+               release_region(port, 1);
        return found;
 }
 
index 9ca97818bd4b57148d9c0ad8c42a231832967377..8fa462f2b570e7c8692d62bbcc5ff5cb8675d781 100644 (file)
@@ -488,7 +488,7 @@ static int __init smsc47m1_find(unsigned short *addr,
 }
 
 /* Restore device to its initial state */
-static void __init smsc47m1_restore(const struct smsc47m1_sio_data *sio_data)
+static void smsc47m1_restore(const struct smsc47m1_sio_data *sio_data)
 {
        if ((sio_data->activate & 0x01) == 0) {
                superio_enter();
index 05f9225b6f944dd7007c752eb9c15786f41c6740..32d4adee73db650fc5ba2b2cc42586b12b642cd3 100644 (file)
@@ -1793,17 +1793,17 @@ static int __init
 w83781d_isa_found(unsigned short address)
 {
        int val, save, found = 0;
-
-       /* We have to request the region in two parts because some
-          boards declare base+4 to base+7 as a PNP device */
-       if (!request_region(address, 4, "w83781d")) {
-               pr_debug("w83781d: Failed to request low part of region\n");
-               return 0;
-       }
-       if (!request_region(address + 4, 4, "w83781d")) {
-               pr_debug("w83781d: Failed to request high part of region\n");
-               release_region(address, 4);
-               return 0;
+       int port;
+
+       /* Some boards declare base+0 to base+7 as a PNP device, some base+4
+        * to base+7 and some base+5 to base+6. So we better request each port
+        * individually for the probing phase. */
+       for (port = address; port < address + W83781D_EXTENT; port++) {
+               if (!request_region(port, 1, "w83781d")) {
+                       pr_debug("w83781d: Failed to request port 0x%x\n",
+                                port);
+                       goto release;
+               }
        }
 
 #define REALLY_SLOW_IO
@@ -1877,8 +1877,8 @@ w83781d_isa_found(unsigned short address)
                        val == 0x30 ? "W83782D" : "W83781D", (int)address);
 
  release:
-       release_region(address + 4, 4);
-       release_region(address, 4);
+       for (port--; port >= address; port--)
+               release_region(port, 1);
        return found;
 }
 
index 5f318ce29770228dfe7c179ee7fc4f79fbb38805..737f05200b1d759344dd7d43550574faa9e6d651 100644 (file)
@@ -564,6 +564,16 @@ config I2C_VERSATILE
          This driver can also be built as a module.  If so, the module
          will be called i2c-versatile.
 
+config I2C_OCTEON
+       tristate "Cavium OCTEON I2C bus support"
+       depends on CPU_CAVIUM_OCTEON
+       help
+         Say yes if you want to support the I2C serial bus on Cavium
+         OCTEON SOC.
+
+         This driver can also be built as a module.  If so, the module
+         will be called i2c-octeon.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_PARPORT
index 302c551977bbd871ccae1f0684814b6bea4b6e10..c2c4ea1908d80ee32f7f330d31fbdd8154dcab33 100644 (file)
@@ -54,6 +54,7 @@ obj-$(CONFIG_I2C_SH_MOBILE)   += i2c-sh_mobile.o
 obj-$(CONFIG_I2C_SIMTEC)       += i2c-simtec.o
 obj-$(CONFIG_I2C_STU300)       += i2c-stu300.o
 obj-$(CONFIG_I2C_VERSATILE)    += i2c-versatile.o
+obj-$(CONFIG_I2C_OCTEON)       += i2c-octeon.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_PARPORT)      += i2c-parport.o
index f70f46582c6c3a8cc4533abbd914dab0a338dc18..4687af40dd50ac44ea182c91a45b749b69747bbc 100644 (file)
@@ -87,9 +87,9 @@ static int ali1563_transaction(struct i2c_adapter * a, int size)
        outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2);
 
        timeout = ALI1563_MAX_TIMEOUT;
-       do
+       do {
                msleep(1);
-       while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
+       while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
 
        dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
                "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
@@ -157,9 +157,9 @@ static int ali1563_block_start(struct i2c_adapter * a)
        outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2);
 
        timeout = ALI1563_MAX_TIMEOUT;
-       do
+       do {
                msleep(1);
-       while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
+       while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
 
        dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, "
                "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
index e3654d683e157bd6accbc486cd864ad8cb12f919..75bf820e7ccb912c4efb027e6f2a638ea9ba7021 100644 (file)
@@ -226,7 +226,6 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
                temp = readb(i2c_imx->base + IMX_I2C_I2CR);
                temp &= ~(I2CR_MSTA | I2CR_MTX);
                writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
-               i2c_imx->stopped = 1;
        }
        if (cpu_is_mx1()) {
                /*
@@ -236,8 +235,10 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
                udelay(i2c_imx->disable_delay);
        }
 
-       if (!i2c_imx->stopped)
+       if (!i2c_imx->stopped) {
                i2c_imx_bus_busy(i2c_imx, 0);
+               i2c_imx->stopped = 1;
+       }
 
        /* Disable I2C controller */
        writeb(0, i2c_imx->base + IMX_I2C_I2CR);
@@ -496,22 +497,23 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
        }
 
        res_size = resource_size(res);
+
+       if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
+               ret = -EBUSY;
+               goto fail0;
+       }
+
        base = ioremap(res->start, res_size);
        if (!base) {
                dev_err(&pdev->dev, "ioremap failed\n");
                ret = -EIO;
-               goto fail0;
+               goto fail1;
        }
 
        i2c_imx = kzalloc(sizeof(struct imx_i2c_struct), GFP_KERNEL);
        if (!i2c_imx) {
                dev_err(&pdev->dev, "can't allocate interface\n");
                ret = -ENOMEM;
-               goto fail1;
-       }
-
-       if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
-               ret = -EBUSY;
                goto fail2;
        }
 
@@ -582,11 +584,11 @@ fail5:
 fail4:
        clk_put(i2c_imx->clk);
 fail3:
-       release_mem_region(i2c_imx->res->start, resource_size(res));
-fail2:
        kfree(i2c_imx);
-fail1:
+fail2:
        iounmap(base);
+fail1:
+       release_mem_region(res->start, resource_size(res));
 fail0:
        if (pdata && pdata->exit)
                pdata->exit(&pdev->dev);
@@ -618,8 +620,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
 
        clk_put(i2c_imx->clk);
 
-       release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
        iounmap(i2c_imx->base);
+       release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
        kfree(i2c_imx);
        return 0;
 }
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
new file mode 100644 (file)
index 0000000..6037550
--- /dev/null
@@ -0,0 +1,651 @@
+/*
+ * (C) Copyright 2009-2010
+ * Nokia Siemens Networks, michael.lawnick.ext@nsn.com
+ *
+ * Portions Copyright (C) 2010 Cavium Networks, Inc.
+ *
+ * This is a driver for the i2c adapter in Cavium Networks' OCTEON processors.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/init.h>
+
+#include <linux/io.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+
+#include <asm/octeon/octeon.h>
+
+#define DRV_NAME "i2c-octeon"
+
+/* The previous out-of-tree version was implicitly version 1.0. */
+#define DRV_VERSION    "2.0"
+
+/* register offsets */
+#define SW_TWSI         0x00
+#define TWSI_INT 0x10
+
+/* Controller command patterns */
+#define SW_TWSI_V               0x8000000000000000ull
+#define SW_TWSI_EOP_TWSI_DATA   0x0C00000100000000ull
+#define SW_TWSI_EOP_TWSI_CTL    0x0C00000200000000ull
+#define SW_TWSI_EOP_TWSI_CLKCTL 0x0C00000300000000ull
+#define SW_TWSI_EOP_TWSI_STAT   0x0C00000300000000ull
+#define SW_TWSI_EOP_TWSI_RST    0x0C00000700000000ull
+#define SW_TWSI_OP_TWSI_CLK     0x0800000000000000ull
+#define SW_TWSI_R               0x0100000000000000ull
+
+/* Controller command and status bits */
+#define TWSI_CTL_CE   0x80
+#define TWSI_CTL_ENAB 0x40
+#define TWSI_CTL_STA  0x20
+#define TWSI_CTL_STP  0x10
+#define TWSI_CTL_IFLG 0x08
+#define TWSI_CTL_AAK  0x04
+
+/* Some status values */
+#define STAT_START      0x08
+#define STAT_RSTART     0x10
+#define STAT_TXADDR_ACK 0x18
+#define STAT_TXDATA_ACK 0x28
+#define STAT_RXADDR_ACK 0x40
+#define STAT_RXDATA_ACK 0x50
+#define STAT_IDLE       0xF8
+
+struct octeon_i2c {
+       wait_queue_head_t queue;
+       struct i2c_adapter adap;
+       int irq;
+       int twsi_freq;
+       int sys_freq;
+       resource_size_t twsi_phys;
+       void __iomem *twsi_base;
+       resource_size_t regsize;
+       struct device *dev;
+};
+
+/**
+ * octeon_i2c_write_sw - write an I2C core register.
+ * @i2c: The struct octeon_i2c.
+ * @eop_reg: Register selector.
+ * @data: Value to be written.
+ *
+ * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
+ */
+static void octeon_i2c_write_sw(struct octeon_i2c *i2c,
+                               u64 eop_reg,
+                               u8 data)
+{
+       u64 tmp;
+
+       __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI);
+       do {
+               tmp = __raw_readq(i2c->twsi_base + SW_TWSI);
+       } while ((tmp & SW_TWSI_V) != 0);
+}
+
+/**
+ * octeon_i2c_read_sw - write an I2C core register.
+ * @i2c: The struct octeon_i2c.
+ * @eop_reg: Register selector.
+ *
+ * Returns the data.
+ *
+ * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
+ */
+static u8 octeon_i2c_read_sw(struct octeon_i2c *i2c, u64 eop_reg)
+{
+       u64 tmp;
+
+       __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI);
+       do {
+               tmp = __raw_readq(i2c->twsi_base + SW_TWSI);
+       } while ((tmp & SW_TWSI_V) != 0);
+
+       return tmp & 0xFF;
+}
+
+/**
+ * octeon_i2c_write_int - write the TWSI_INT register
+ * @i2c: The struct octeon_i2c.
+ * @data: Value to be written.
+ */
+static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data)
+{
+       u64 tmp;
+
+       __raw_writeq(data, i2c->twsi_base + TWSI_INT);
+       tmp = __raw_readq(i2c->twsi_base + TWSI_INT);
+}
+
+/**
+ * octeon_i2c_int_enable - enable the TS interrupt.
+ * @i2c: The struct octeon_i2c.
+ *
+ * The interrupt will be asserted when there is non-STAT_IDLE state in
+ * the SW_TWSI_EOP_TWSI_STAT register.
+ */
+static void octeon_i2c_int_enable(struct octeon_i2c *i2c)
+{
+       octeon_i2c_write_int(i2c, 0x40);
+}
+
+/**
+ * octeon_i2c_int_disable - disable the TS interrupt.
+ * @i2c: The struct octeon_i2c.
+ */
+static void octeon_i2c_int_disable(struct octeon_i2c *i2c)
+{
+       octeon_i2c_write_int(i2c, 0);
+}
+
+/**
+ * octeon_i2c_unblock - unblock the bus.
+ * @i2c: The struct octeon_i2c.
+ *
+ * If there was a reset while a device was driving 0 to bus,
+ * bus is blocked. We toggle it free manually by some clock
+ * cycles and send a stop.
+ */
+static void octeon_i2c_unblock(struct octeon_i2c *i2c)
+{
+       int i;
+
+       dev_dbg(i2c->dev, "%s\n", __func__);
+       for (i = 0; i < 9; i++) {
+               octeon_i2c_write_int(i2c, 0x0);
+               udelay(5);
+               octeon_i2c_write_int(i2c, 0x200);
+               udelay(5);
+       }
+       octeon_i2c_write_int(i2c, 0x300);
+       udelay(5);
+       octeon_i2c_write_int(i2c, 0x100);
+       udelay(5);
+       octeon_i2c_write_int(i2c, 0x0);
+}
+
+/**
+ * octeon_i2c_isr - the interrupt service routine.
+ * @int: The irq, unused.
+ * @dev_id: Our struct octeon_i2c.
+ */
+static irqreturn_t octeon_i2c_isr(int irq, void *dev_id)
+{
+       struct octeon_i2c *i2c = dev_id;
+
+       octeon_i2c_int_disable(i2c);
+       wake_up_interruptible(&i2c->queue);
+
+       return IRQ_HANDLED;
+}
+
+
+static int octeon_i2c_test_iflg(struct octeon_i2c *i2c)
+{
+       return (octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_CTL) & TWSI_CTL_IFLG) != 0;
+}
+
+/**
+ * octeon_i2c_wait - wait for the IFLG to be set.
+ * @i2c: The struct octeon_i2c.
+ *
+ * Returns 0 on success, otherwise a negative errno.
+ */
+static int octeon_i2c_wait(struct octeon_i2c *i2c)
+{
+       int result;
+
+       octeon_i2c_int_enable(i2c);
+
+       result = wait_event_interruptible_timeout(i2c->queue,
+                                                 octeon_i2c_test_iflg(i2c),
+                                                 i2c->adap.timeout);
+
+       octeon_i2c_int_disable(i2c);
+
+       if (result < 0) {
+               dev_dbg(i2c->dev, "%s: wait interrupted\n", __func__);
+               return result;
+       } else if (result == 0) {
+               dev_dbg(i2c->dev, "%s: timeout\n", __func__);
+               result = -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+/**
+ * octeon_i2c_start - send START to the bus.
+ * @i2c: The struct octeon_i2c.
+ *
+ * Returns 0 on success, otherwise a negative errno.
+ */
+static int octeon_i2c_start(struct octeon_i2c *i2c)
+{
+       u8 data;
+       int result;
+
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
+                               TWSI_CTL_ENAB | TWSI_CTL_STA);
+
+       result = octeon_i2c_wait(i2c);
+       if (result) {
+               if (octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT) == STAT_IDLE) {
+                       /*
+                        * Controller refused to send start flag May
+                        * be a client is holding SDA low - let's try
+                        * to free it.
+                        */
+                       octeon_i2c_unblock(i2c);
+                       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
+                                           TWSI_CTL_ENAB | TWSI_CTL_STA);
+
+                       result = octeon_i2c_wait(i2c);
+               }
+               if (result)
+                       return result;
+       }
+
+       data = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
+       if ((data != STAT_START) && (data != STAT_RSTART)) {
+               dev_err(i2c->dev, "%s: bad status (0x%x)\n", __func__, data);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+/**
+ * octeon_i2c_stop - send STOP to the bus.
+ * @i2c: The struct octeon_i2c.
+ *
+ * Returns 0 on success, otherwise a negative errno.
+ */
+static int octeon_i2c_stop(struct octeon_i2c *i2c)
+{
+       u8 data;
+
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
+                           TWSI_CTL_ENAB | TWSI_CTL_STP);
+
+       data = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
+
+       if (data != STAT_IDLE) {
+               dev_err(i2c->dev, "%s: bad status(0x%x)\n", __func__, data);
+               return -EIO;
+       }
+       return 0;
+}
+
+/**
+ * octeon_i2c_write - send data to the bus.
+ * @i2c: The struct octeon_i2c.
+ * @target: Target address.
+ * @data: Pointer to the data to be sent.
+ * @length: Length of the data.
+ *
+ * The address is sent over the bus, then the data.
+ *
+ * Returns 0 on success, otherwise a negative errno.
+ */
+static int octeon_i2c_write(struct octeon_i2c *i2c, int target,
+                           const u8 *data, int length)
+{
+       int i, result;
+       u8 tmp;
+
+       result = octeon_i2c_start(i2c);
+       if (result)
+               return result;
+
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, target << 1);
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
+
+       result = octeon_i2c_wait(i2c);
+       if (result)
+               return result;
+
+       for (i = 0; i < length; i++) {
+               tmp = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
+               if ((tmp != STAT_TXADDR_ACK) && (tmp != STAT_TXDATA_ACK)) {
+                       dev_err(i2c->dev,
+                               "%s: bad status before write (0x%x)\n",
+                               __func__, tmp);
+                       return -EIO;
+               }
+
+               octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, data[i]);
+               octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
+
+               result = octeon_i2c_wait(i2c);
+               if (result)
+                       return result;
+       }
+
+       return 0;
+}
+
+/**
+ * octeon_i2c_read - receive data from the bus.
+ * @i2c: The struct octeon_i2c.
+ * @target: Target address.
+ * @data: Pointer to the location to store the datae .
+ * @length: Length of the data.
+ *
+ * The address is sent over the bus, then the data is read.
+ *
+ * Returns 0 on success, otherwise a negative errno.
+ */
+static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
+                          u8 *data, int length)
+{
+       int i, result;
+       u8 tmp;
+
+       if (length < 1)
+               return -EINVAL;
+
+       result = octeon_i2c_start(i2c);
+       if (result)
+               return result;
+
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, (target<<1) | 1);
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
+
+       result = octeon_i2c_wait(i2c);
+       if (result)
+               return result;
+
+       for (i = 0; i < length; i++) {
+               tmp = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
+               if ((tmp != STAT_RXDATA_ACK) && (tmp != STAT_RXADDR_ACK)) {
+                       dev_err(i2c->dev,
+                               "%s: bad status before read (0x%x)\n",
+                               __func__, tmp);
+                       return -EIO;
+               }
+
+               if (i+1 < length)
+                       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
+                                               TWSI_CTL_ENAB | TWSI_CTL_AAK);
+               else
+                       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
+                                               TWSI_CTL_ENAB);
+
+               result = octeon_i2c_wait(i2c);
+               if (result)
+                       return result;
+
+               data[i] = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_DATA);
+       }
+       return 0;
+}
+
+/**
+ * octeon_i2c_xfer - The driver's master_xfer function.
+ * @adap: Pointer to the i2c_adapter structure.
+ * @msgs: Pointer to the messages to be processed.
+ * @num: Length of the MSGS array.
+ *
+ * Returns the number of messages processed, or a negative errno on
+ * failure.
+ */
+static int octeon_i2c_xfer(struct i2c_adapter *adap,
+                          struct i2c_msg *msgs,
+                          int num)
+{
+       struct i2c_msg *pmsg;
+       int i;
+       int ret = 0;
+       struct octeon_i2c *i2c = i2c_get_adapdata(adap);
+
+       for (i = 0; ret == 0 && i < num; i++) {
+               pmsg = &msgs[i];
+               dev_dbg(i2c->dev,
+                       "Doing %s %d byte(s) to/from 0x%02x - %d of %d messages\n",
+                        pmsg->flags & I2C_M_RD ? "read" : "write",
+                        pmsg->len, pmsg->addr, i + 1, num);
+               if (pmsg->flags & I2C_M_RD)
+                       ret = octeon_i2c_read(i2c, pmsg->addr, pmsg->buf,
+                                               pmsg->len);
+               else
+                       ret = octeon_i2c_write(i2c, pmsg->addr, pmsg->buf,
+                                               pmsg->len);
+       }
+       octeon_i2c_stop(i2c);
+
+       return (ret != 0) ? ret : num;
+}
+
+static u32 octeon_i2c_functionality(struct i2c_adapter *adap)
+{
+       return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+}
+
+static const struct i2c_algorithm octeon_i2c_algo = {
+       .master_xfer = octeon_i2c_xfer,
+       .functionality = octeon_i2c_functionality,
+};
+
+static struct i2c_adapter octeon_i2c_ops = {
+       .owner = THIS_MODULE,
+       .name = "OCTEON adapter",
+       .algo = &octeon_i2c_algo,
+       .timeout = 2,
+};
+
+/**
+ * octeon_i2c_setclock - Calculate and set clock divisors.
+ */
+static int __init octeon_i2c_setclock(struct octeon_i2c *i2c)
+{
+       int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
+       int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
+
+       for (ndiv_idx = 0; ndiv_idx < 8 && delta_hz != 0; ndiv_idx++) {
+               /*
+                * An mdiv value of less than 2 seems to not work well
+                * with ds1337 RTCs, so we constrain it to larger
+                * values.
+                */
+               for (mdiv_idx = 15; mdiv_idx >= 2 && delta_hz != 0; mdiv_idx--) {
+                       /*
+                        * For given ndiv and mdiv values check the
+                        * two closest thp values.
+                        */
+                       tclk = i2c->twsi_freq * (mdiv_idx + 1) * 10;
+                       tclk *= (1 << ndiv_idx);
+                       thp_base = (i2c->sys_freq / (tclk * 2)) - 1;
+                       for (inc = 0; inc <= 1; inc++) {
+                               thp_idx = thp_base + inc;
+                               if (thp_idx < 5 || thp_idx > 0xff)
+                                       continue;
+
+                               foscl = i2c->sys_freq / (2 * (thp_idx + 1));
+                               foscl = foscl / (1 << ndiv_idx);
+                               foscl = foscl / (mdiv_idx + 1) / 10;
+                               diff = abs(foscl - i2c->twsi_freq);
+                               if (diff < delta_hz) {
+                                       delta_hz = diff;
+                                       thp = thp_idx;
+                                       mdiv = mdiv_idx;
+                                       ndiv = ndiv_idx;
+                               }
+                       }
+               }
+       }
+       octeon_i2c_write_sw(i2c, SW_TWSI_OP_TWSI_CLK, thp);
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CLKCTL, (mdiv << 3) | ndiv);
+
+       return 0;
+}
+
+static int __init octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
+{
+       u8 status;
+       int tries;
+
+       /* disable high level controller, enable bus access */
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
+
+       /* reset controller */
+       octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_RST, 0);
+
+       for (tries = 10; tries; tries--) {
+               udelay(1);
+               status = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
+               if (status == STAT_IDLE)
+                       return 0;
+       }
+       dev_err(i2c->dev, "%s: TWSI_RST failed! (0x%x)\n", __func__, status);
+       return -EIO;
+}
+
+static int __devinit octeon_i2c_probe(struct platform_device *pdev)
+{
+       int irq, result = 0;
+       struct octeon_i2c *i2c;
+       struct octeon_i2c_data *i2c_data;
+       struct resource *res_mem;
+
+       /* All adaptors have an irq.  */
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
+       i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
+       if (!i2c) {
+               dev_err(&pdev->dev, "kzalloc failed\n");
+               result = -ENOMEM;
+               goto out;
+       }
+       i2c->dev = &pdev->dev;
+       i2c_data = pdev->dev.platform_data;
+
+       res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+       if (res_mem == NULL) {
+               dev_err(i2c->dev, "found no memory resource\n");
+               result = -ENXIO;
+               goto fail_region;
+       }
+
+       if (i2c_data == NULL) {
+               dev_err(i2c->dev, "no I2C frequency data\n");
+               result = -ENXIO;
+               goto fail_region;
+       }
+
+       i2c->twsi_phys = res_mem->start;
+       i2c->regsize = resource_size(res_mem);
+       i2c->twsi_freq = i2c_data->i2c_freq;
+       i2c->sys_freq = i2c_data->sys_freq;
+
+       if (!request_mem_region(i2c->twsi_phys, i2c->regsize, res_mem->name)) {
+               dev_err(i2c->dev, "request_mem_region failed\n");
+               goto fail_region;
+       }
+       i2c->twsi_base = ioremap(i2c->twsi_phys, i2c->regsize);
+
+       init_waitqueue_head(&i2c->queue);
+
+       i2c->irq = irq;
+
+       result = request_irq(i2c->irq, octeon_i2c_isr, 0, DRV_NAME, i2c);
+       if (result < 0) {
+               dev_err(i2c->dev, "failed to attach interrupt\n");
+               goto fail_irq;
+       }
+
+       result = octeon_i2c_initlowlevel(i2c);
+       if (result) {
+               dev_err(i2c->dev, "init low level failed\n");
+               goto  fail_add;
+       }
+
+       result = octeon_i2c_setclock(i2c);
+       if (result) {
+               dev_err(i2c->dev, "clock init failed\n");
+               goto  fail_add;
+       }
+
+       i2c->adap = octeon_i2c_ops;
+       i2c->adap.dev.parent = &pdev->dev;
+       i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0;
+       i2c_set_adapdata(&i2c->adap, i2c);
+       platform_set_drvdata(pdev, i2c);
+
+       result = i2c_add_numbered_adapter(&i2c->adap);
+       if (result < 0) {
+               dev_err(i2c->dev, "failed to add adapter\n");
+               goto fail_add;
+       }
+
+       dev_info(i2c->dev, "version %s\n", DRV_VERSION);
+
+       return result;
+
+fail_add:
+       platform_set_drvdata(pdev, NULL);
+       free_irq(i2c->irq, i2c);
+fail_irq:
+       iounmap(i2c->twsi_base);
+       release_mem_region(i2c->twsi_phys, i2c->regsize);
+fail_region:
+       kfree(i2c);
+out:
+       return result;
+};
+
+static int __devexit octeon_i2c_remove(struct platform_device *pdev)
+{
+       struct octeon_i2c *i2c = platform_get_drvdata(pdev);
+
+       i2c_del_adapter(&i2c->adap);
+       platform_set_drvdata(pdev, NULL);
+       free_irq(i2c->irq, i2c);
+       iounmap(i2c->twsi_base);
+       release_mem_region(i2c->twsi_phys, i2c->regsize);
+       kfree(i2c);
+       return 0;
+};
+
+static struct platform_driver octeon_i2c_driver = {
+       .probe          = octeon_i2c_probe,
+       .remove         = __devexit_p(octeon_i2c_remove),
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = DRV_NAME,
+       },
+};
+
+static int __init octeon_i2c_init(void)
+{
+       int rv;
+
+       rv = platform_driver_register(&octeon_i2c_driver);
+       return rv;
+}
+
+static void __exit octeon_i2c_exit(void)
+{
+       platform_driver_unregister(&octeon_i2c_driver);
+}
+
+MODULE_AUTHOR("Michael Lawnick <michael.lawnick.ext@nsn.com>");
+MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("platform:" DRV_NAME);
+
+module_init(octeon_i2c_init);
+module_exit(octeon_i2c_exit);
index 0ed68e2ccd228c86ef46c6b0a6c8836901ca52e4..f7346a9bd95f21134fcdfd20508bc3317f75bdbf 100644 (file)
@@ -75,7 +75,7 @@ static int pca_isa_waitforcompletion(void *pd)
        unsigned long timeout;
 
        if (irq > -1) {
-               ret = wait_event_interruptible_timeout(pca_wait,
+               ret = wait_event_timeout(pca_wait,
                                pca_isa_readbyte(pd, I2C_PCA_CON)
                                & I2C_PCA_CON_SI, pca_isa_ops.timeout);
        } else {
@@ -96,7 +96,7 @@ static void pca_isa_resetchip(void *pd)
 }
 
 static irqreturn_t pca_handler(int this_irq, void *dev_id) {
-       wake_up_interruptible(&pca_wait);
+       wake_up(&pca_wait);
        return IRQ_HANDLED;
 }
 
index c4df9d411cd5cdb4226b302021bead43add5256e..5b2213df5ed039dfb008c0cdf3aa6d2019543630 100644 (file)
@@ -84,7 +84,7 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
        unsigned long timeout;
 
        if (i2c->irq) {
-               ret = wait_event_interruptible_timeout(i2c->wait,
+               ret = wait_event_timeout(i2c->wait,
                        i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
                        & I2C_PCA_CON_SI, i2c->adap.timeout);
        } else {
@@ -122,7 +122,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
        if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
                return IRQ_NONE;
 
-       wake_up_interruptible(&i2c->wait);
+       wake_up(&i2c->wait);
 
        return IRQ_HANDLED;
 }
index 1e245e9cad31e17b934401fc509b72d0dee67200..e56e4b6823ca24ac91d63a22f168e99564aac1d2 100644 (file)
@@ -324,12 +324,12 @@ static int piix4_transaction(void)
        else
                msleep(1);
 
-       while ((timeout++ < MAX_TIMEOUT) &&
+       while ((++timeout < MAX_TIMEOUT) &&
               ((temp = inb_p(SMBHSTSTS)) & 0x01))
                msleep(1);
 
        /* If the SMBus is still busy, we give up */
-       if (timeout >= MAX_TIMEOUT) {
+       if (timeout == MAX_TIMEOUT) {
                dev_err(&piix4_adapter.dev, "SMBus Timeout!\n");
                result = -ETIMEDOUT;
        }
index b1c050ff311ddd22beb0034e9d3bab325cedd687..e29b6d5ba8efb401d64e024329d36f8a053470bd 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/module.h>
+#include <linux/types.h>
 
 /* include interfaces to usb layer */
 #include <linux/usb.h>
@@ -31,8 +32,8 @@
 #define CMD_I2C_IO_END         (1<<1)
 
 /* i2c bit delay, default is 10us -> 100kHz */
-static int delay = 10;
-module_param(delay, int, 0);
+static unsigned short delay = 10;
+module_param(delay, ushort, 0);
 MODULE_PARM_DESC(delay, "bit delay in microseconds, "
                 "e.g. 10 for 100kHz (default is 100kHz)");
 
@@ -109,7 +110,7 @@ static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
 
 static u32 usb_func(struct i2c_adapter *adapter)
 {
-       u32 func;
+       __le32 func;
 
        /* get functionality from adapter */
        if (usb_read(adapter, CMD_GET_FUNC, 0, 0, &func, sizeof(func)) !=
@@ -118,7 +119,7 @@ static u32 usb_func(struct i2c_adapter *adapter)
                return 0;
        }
 
-       return func;
+       return le32_to_cpu(func);
 }
 
 /* This is the actual algorithm we define */
@@ -216,8 +217,7 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
                 "i2c-tiny-usb at bus %03d device %03d",
                 dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
 
-       if (usb_write(&dev->adapter, CMD_SET_DELAY,
-                     cpu_to_le16(delay), 0, NULL, 0) != 0) {
+       if (usb_write(&dev->adapter, CMD_SET_DELAY, delay, 0, NULL, 0) != 0) {
                dev_err(&dev->adapter.dev,
                        "failure setting delay to %dus\n", delay);
                retval = -EIO;
index e4b1543015af9cb5eeb44f40a676918c70fb83e8..a84a909e12345bfd98dd268fce94c5453045ec83 100644 (file)
@@ -165,10 +165,10 @@ static int vt596_transaction(u8 size)
        do {
                msleep(1);
                temp = inb_p(SMBHSTSTS);
-       } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
+       } while ((temp & 0x01) && (++timeout < MAX_TIMEOUT));
 
        /* If the SMBus is still busy, we give up */
-       if (timeout >= MAX_TIMEOUT) {
+       if (timeout == MAX_TIMEOUT) {
                result = -ETIMEDOUT;
                dev_err(&vt596_adapter.dev, "SMBus timeout!\n");
        }
index 0ac2f90ab840c8f1863013ba9551a3266247f738..10be7b5fbe97e185d141a23881ea3efd0564a6c7 100644 (file)
@@ -248,7 +248,7 @@ static const struct attribute_group *i2c_dev_attr_groups[] = {
        NULL
 };
 
-const static struct dev_pm_ops i2c_device_pm_ops = {
+static const struct dev_pm_ops i2c_device_pm_ops = {
        .suspend = i2c_device_pm_suspend,
        .resume = i2c_device_pm_resume,
 };
@@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
                                 adap->dev.parent);
 #endif
 
+       /* device name is gone after device_unregister */
+       dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
+
        /* clean up the sysfs representation */
        init_completion(&adap->dev_released);
        device_unregister(&adap->dev);
@@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
        idr_remove(&i2c_adapter_idr, adap->nr);
        mutex_unlock(&core_lock);
 
-       dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
-
        /* Clear the device structure in case this adapter is ever going to be
           added again */
        memset(&adap->dev, 0, sizeof(adap->dev));
index 87cef0c440ad32f625fe7bd55e368b8a427afcf4..349a67bf1a36c84eb2fb322d1c46211128ea3686 100644 (file)
@@ -56,8 +56,8 @@ static inline void auide_insw(unsigned long port, void *addr, u32 count)
        chan_tab_t *ctp;
        au1x_ddma_desc_t *dp;
 
-       if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, 
-                          DDMA_FLAGS_NOIE)) {
+       if (!au1xxx_dbdma_put_dest(ahwif->rx_chan, virt_to_phys(addr),
+                                  count << 1, DDMA_FLAGS_NOIE)) {
                printk(KERN_ERR "%s failed %d\n", __func__, __LINE__);
                return;
        }
@@ -74,8 +74,8 @@ static inline void auide_outsw(unsigned long port, void *addr, u32 count)
        chan_tab_t *ctp;
        au1x_ddma_desc_t *dp;
 
-       if(!put_source_flags(ahwif->tx_chan, (void*)addr,
-                            count << 1, DDMA_FLAGS_NOIE)) {
+       if (!au1xxx_dbdma_put_source(ahwif->tx_chan, virt_to_phys(addr),
+                                    count << 1, DDMA_FLAGS_NOIE)) {
                printk(KERN_ERR "%s failed %d\n", __func__, __LINE__);
                return;
        }
@@ -246,17 +246,14 @@ static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
                                flags = DDMA_FLAGS_NOIE;
 
                        if (iswrite) {
-                               if(!put_source_flags(ahwif->tx_chan, 
-                                                    (void*) sg_virt(sg),
-                                                    tc, flags)) { 
+                               if (!au1xxx_dbdma_put_source(ahwif->tx_chan,
+                                       sg_phys(sg), tc, flags)) {
                                        printk(KERN_ERR "%s failed %d\n", 
                                               __func__, __LINE__);
                                }
-                       } else 
-                       {
-                               if(!put_dest_flags(ahwif->rx_chan, 
-                                                  (void*) sg_virt(sg),
-                                                  tc, flags)) { 
+                       } else  {
+                               if (!au1xxx_dbdma_put_dest(ahwif->rx_chan,
+                                       sg_phys(sg), tc, flags)) {
                                        printk(KERN_ERR "%s failed %d\n", 
                                               __func__, __LINE__);
                                }
index cc9b5940fa97c69214dd1922091fc8de52fa1403..875e34e0b235d93a68b44290fbc7f1417104773c 100644 (file)
@@ -2115,9 +2115,7 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
        if (ret)
                goto err1;
 
-       if (cma_loopback_addr(addr)) {
-               ret = cma_bind_loopback(id_priv);
-       } else if (!cma_zero_addr(addr)) {
+       if (!cma_any_addr(addr)) {
                ret = rdma_translate_ip(addr, &id->route.addr.dev_addr);
                if (ret)
                        goto err1;
index b3684060465eebea3b99a36329c17076fabc958f..100da8542bbaecf5d153a34b4d75bddc8ab61de9 100644 (file)
@@ -346,10 +346,8 @@ static int ipathfs_fill_super(struct super_block *sb, void *data,
        list_for_each_entry_safe(dd, tmp, &ipath_dev_list, ipath_list) {
                spin_unlock_irqrestore(&ipath_devs_lock, flags);
                ret = create_device_files(sb, dd);
-               if (ret) {
-                       deactivate_locked_super(sb);
+               if (ret)
                        goto bail;
-               }
                spin_lock_irqsave(&ipath_devs_lock, flags);
        }
 
index dee6706038aad7ad1519f551bd4d71f02fa6f9c1..258c639571b5058bc9fece65f2de501cc0a25d75 100644 (file)
@@ -59,7 +59,8 @@ static void evdev_pass_event(struct evdev_client *client,
        client->head &= EVDEV_BUFFER_SIZE - 1;
        spin_unlock(&client->buffer_lock);
 
-       kill_fasync(&client->fasync, SIGIO, POLL_IN);
+       if (event->type == EV_SYN)
+               kill_fasync(&client->fasync, SIGIO, POLL_IN);
 }
 
 /*
index aa6713b4a9888e64ed99a92f78e1e1cd2bb9ca56..291d9393d359c8e0e7f82a0d20e4a2cfc0f2e8a6 100644 (file)
@@ -100,6 +100,12 @@ static void input_close_polled_device(struct input_dev *input)
        struct input_polled_dev *dev = input_get_drvdata(input);
 
        cancel_delayed_work_sync(&dev->work);
+       /*
+        * Clean up work struct to remove references to the workqueue.
+        * It may be destroyed by the next call. This causes problems
+        * at next device open-close in case of poll_interval == 0.
+        */
+       INIT_DELAYED_WORK(&dev->work, dev->work.work.func);
        input_polldev_stop_workqueue();
 
        if (dev->close)
index ab060710688fa6064f02dabfca13dc3ef512d43e..86cb2d2196ff9792f18c39646e44983af46fcf61 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/mutex.h>
 #include <linux/rcupdate.h>
 #include <linux/smp_lock.h>
+#include "input-compat.h"
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_DESCRIPTION("Input core");
@@ -45,6 +46,7 @@ static unsigned int input_abs_bypass_init_data[] __initdata = {
        ABS_MT_TOOL_TYPE,
        ABS_MT_BLOB_ID,
        ABS_MT_TRACKING_ID,
+       ABS_MT_PRESSURE,
        0
 };
 static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)];
@@ -764,6 +766,40 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
        return error;
 }
 
+#ifdef CONFIG_COMPAT
+
+static int input_bits_to_string(char *buf, int buf_size,
+                               unsigned long bits, bool skip_empty)
+{
+       int len = 0;
+
+       if (INPUT_COMPAT_TEST) {
+               u32 dword = bits >> 32;
+               if (dword || !skip_empty)
+                       len += snprintf(buf, buf_size, "%x ", dword);
+
+               dword = bits & 0xffffffffUL;
+               if (dword || !skip_empty || len)
+                       len += snprintf(buf + len, max(buf_size - len, 0),
+                                       "%x", dword);
+       } else {
+               if (bits || !skip_empty)
+                       len += snprintf(buf, buf_size, "%lx", bits);
+       }
+
+       return len;
+}
+
+#else /* !CONFIG_COMPAT */
+
+static int input_bits_to_string(char *buf, int buf_size,
+                               unsigned long bits, bool skip_empty)
+{
+       return bits || !skip_empty ?
+               snprintf(buf, buf_size, "%lx", bits) : 0;
+}
+
+#endif
 
 #ifdef CONFIG_PROC_FS
 
@@ -832,14 +868,25 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
                                   unsigned long *bitmap, int max)
 {
        int i;
-
-       for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
-               if (bitmap[i])
-                       break;
+       bool skip_empty = true;
+       char buf[18];
 
        seq_printf(seq, "B: %s=", name);
-       for (; i >= 0; i--)
-               seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : "");
+
+       for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
+               if (input_bits_to_string(buf, sizeof(buf),
+                                        bitmap[i], skip_empty)) {
+                       skip_empty = false;
+                       seq_printf(seq, "%s%s", buf, i > 0 ? " " : "");
+               }
+       }
+
+       /*
+        * If no output was produced print a single 0.
+        */
+       if (skip_empty)
+               seq_puts(seq, "0");
+
        seq_putc(seq, '\n');
 }
 
@@ -1128,14 +1175,23 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
 {
        int i;
        int len = 0;
+       bool skip_empty = true;
+
+       for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
+               len += input_bits_to_string(buf + len, max(buf_size - len, 0),
+                                           bitmap[i], skip_empty);
+               if (len) {
+                       skip_empty = false;
+                       if (i > 0)
+                               len += snprintf(buf + len, max(buf_size - len, 0), " ");
+               }
+       }
 
-       for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
-               if (bitmap[i])
-                       break;
-
-       for (; i >= 0; i--)
-               len += snprintf(buf + len, max(buf_size - len, 0),
-                               "%lx%s", bitmap[i], i > 0 ? " " : "");
+       /*
+        * If no output was produced print a single 0.
+        */
+       if (len == 0)
+               len = snprintf(buf, buf_size, "%d", 0);
 
        if (add_cr)
                len += snprintf(buf + len, max(buf_size - len, 0), "\n");
@@ -1150,7 +1206,8 @@ static ssize_t input_dev_show_cap_##bm(struct device *dev,                \
 {                                                                      \
        struct input_dev *input_dev = to_input_dev(dev);                \
        int len = input_print_bitmap(buf, PAGE_SIZE,                    \
-                                    input_dev->bm##bit, ev##_MAX, 1);  \
+                                    input_dev->bm##bit, ev##_MAX,      \
+                                    true);                             \
        return min_t(int, len, PAGE_SIZE);                              \
 }                                                                      \
 static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL)
@@ -1214,7 +1271,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env,
 
        len = input_print_bitmap(&env->buf[env->buflen - 1],
                                 sizeof(env->buf) - env->buflen,
-                                bitmap, max, 0);
+                                bitmap, max, false);
        if (len >= (sizeof(env->buf) - env->buflen))
                return -ENOMEM;
 
index 67c207f5b1a16cd56e88b140c63bbfdefb8f498b..45ac70eae0aa7d95e5a61118cb45456b20abacea 100644 (file)
@@ -277,7 +277,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
        }
 
 #ifdef RESET_WORKS
-       if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) ||
+       if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) &&
            (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) {
                err = -ENODEV;
                goto fail2;
index 482cb1204e438e8cadc4c488b8e3ede398f998fa..8a28fb7846dc1f16a18a064b6cc631d2ca82afa4 100644 (file)
@@ -446,7 +446,7 @@ static void xpad_irq_in(struct urb *urb)
        }
 
 exit:
-       retval = usb_submit_urb (urb, GFP_ATOMIC);
+       retval = usb_submit_urb(urb, GFP_ATOMIC);
        if (retval)
                err ("%s - usb_submit_urb failed with result %d",
                     __func__, retval);
@@ -571,7 +571,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data,
                xpad->odata[6] = 0x00;
                xpad->odata[7] = 0x00;
                xpad->irq_out->transfer_buffer_length = 8;
-               usb_submit_urb(xpad->irq_out, GFP_KERNEL);
+               usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
        }
 
        return 0;
index 1f5e2ce327d6403e2042cc9179b9fc754e37c089..7b4056292eaf9387b95fe80c147ad6c9a65920e5 100644 (file)
@@ -225,8 +225,10 @@ struct atkbd {
 
        struct delayed_work event_work;
        unsigned long event_jiffies;
-       struct mutex event_mutex;
        unsigned long event_mask;
+
+       /* Serializes reconnect(), attr->set() and event work */
+       struct mutex mutex;
 };
 
 /*
@@ -577,7 +579,7 @@ static void atkbd_event_work(struct work_struct *work)
 {
        struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work);
 
-       mutex_lock(&atkbd->event_mutex);
+       mutex_lock(&atkbd->mutex);
 
        if (!atkbd->enabled) {
                /*
@@ -596,7 +598,7 @@ static void atkbd_event_work(struct work_struct *work)
                        atkbd_set_repeat_rate(atkbd);
        }
 
-       mutex_unlock(&atkbd->event_mutex);
+       mutex_unlock(&atkbd->mutex);
 }
 
 /*
@@ -612,7 +614,7 @@ static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit)
 
        atkbd->event_jiffies = jiffies;
        set_bit(event_bit, &atkbd->event_mask);
-       wmb();
+       mb();
        schedule_delayed_work(&atkbd->event_work, delay);
 }
 
@@ -849,13 +851,20 @@ static void atkbd_disconnect(struct serio *serio)
 {
        struct atkbd *atkbd = serio_get_drvdata(serio);
 
+       sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
+
        atkbd_disable(atkbd);
 
-       /* make sure we don't have a command in flight */
+       input_unregister_device(atkbd->dev);
+
+       /*
+        * Make sure we don't have a command in flight.
+        * Note that since atkbd->enabled is false event work will keep
+        * rescheduling itself until it gets canceled and will not try
+        * accessing freed input device or serio port.
+        */
        cancel_delayed_work_sync(&atkbd->event_work);
 
-       sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
-       input_unregister_device(atkbd->dev);
        serio_close(serio);
        serio_set_drvdata(serio, NULL);
        kfree(atkbd);
@@ -1087,7 +1096,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
        atkbd->dev = dev;
        ps2_init(&atkbd->ps2dev, serio);
        INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work);
-       mutex_init(&atkbd->event_mutex);
+       mutex_init(&atkbd->mutex);
 
        switch (serio->id.type) {
 
@@ -1160,19 +1169,23 @@ static int atkbd_reconnect(struct serio *serio)
 {
        struct atkbd *atkbd = serio_get_drvdata(serio);
        struct serio_driver *drv = serio->drv;
+       int retval = -1;
 
        if (!atkbd || !drv) {
                printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n");
                return -1;
        }
 
+       mutex_lock(&atkbd->mutex);
+
        atkbd_disable(atkbd);
 
        if (atkbd->write) {
                if (atkbd_probe(atkbd))
-                       return -1;
+                       goto out;
+
                if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra))
-                       return -1;
+                       goto out;
 
                atkbd_activate(atkbd);
 
@@ -1190,8 +1203,11 @@ static int atkbd_reconnect(struct serio *serio)
        }
 
        atkbd_enable(atkbd);
+       retval = 0;
 
-       return 0;
+ out:
+       mutex_unlock(&atkbd->mutex);
+       return retval;
 }
 
 static struct serio_device_id atkbd_serio_ids[] = {
@@ -1235,47 +1251,28 @@ static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
                                ssize_t (*handler)(struct atkbd *, char *))
 {
        struct serio *serio = to_serio_port(dev);
-       int retval;
-
-       retval = serio_pin_driver(serio);
-       if (retval)
-               return retval;
-
-       if (serio->drv != &atkbd_drv) {
-               retval = -ENODEV;
-               goto out;
-       }
-
-       retval = handler((struct atkbd *)serio_get_drvdata(serio), buf);
+       struct atkbd *atkbd = serio_get_drvdata(serio);
 
-out:
-       serio_unpin_driver(serio);
-       return retval;
+       return handler(atkbd, buf);
 }
 
 static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count,
                                ssize_t (*handler)(struct atkbd *, const char *, size_t))
 {
        struct serio *serio = to_serio_port(dev);
-       struct atkbd *atkbd;
+       struct atkbd *atkbd = serio_get_drvdata(serio);
        int retval;
 
-       retval = serio_pin_driver(serio);
+       retval = mutex_lock_interruptible(&atkbd->mutex);
        if (retval)
                return retval;
 
-       if (serio->drv != &atkbd_drv) {
-               retval = -ENODEV;
-               goto out;
-       }
-
-       atkbd = serio_get_drvdata(serio);
        atkbd_disable(atkbd);
        retval = handler(atkbd, buf, count);
        atkbd_enable(atkbd);
 
-out:
-       serio_unpin_driver(serio);
+       mutex_unlock(&atkbd->mutex);
+
        return retval;
 }
 
index 6e52d855f637661a5082d429cd686a50ce3b7103..d410d7a52f1d6bd3c60f85564203fb685f76f89b 100644 (file)
@@ -174,6 +174,14 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
        struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
        int error, i;
 
+       if (pdata->device_enable) {
+               error = pdata->device_enable(dev);
+               if (error < 0) {
+                       dev_dbg(dev, "device enable function failed\n");
+                       return error;
+               }
+       }
+
        if (!pdata->keymap) {
                dev_dbg(dev, "no keymap from pdata\n");
                return -EINVAL;
index 33309fe44e20f06acdf3821a56183d5abe0119d9..c8f5a9a3fa140d73218c7e4ce6a162da8287500f 100644 (file)
@@ -768,7 +768,7 @@ wbcir_parse_rc6(struct device *dev, struct wbcir_data *data)
                return;
        }
 
-       dev_info(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
+       dev_dbg(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
                "toggle %u mode %u scan 0x%08X\n",
                address,
                command,
index 0d1d33468b437182559e5163ca668abbc8780036..4f8fe0886b2a0470943eeb94625d375dd452cd1e 100644 (file)
@@ -139,6 +139,7 @@ struct tp_finger {
 /* trackpad finger data size, empirically at least ten fingers */
 #define SIZEOF_FINGER          sizeof(struct tp_finger)
 #define SIZEOF_ALL_FINGERS     (16 * SIZEOF_FINGER)
+#define MAX_FINGER_ORIENTATION 16384
 
 /* device-specific parameters */
 struct bcm5974_param {
@@ -284,6 +285,26 @@ static void setup_events_to_report(struct input_dev *input_dev,
        input_set_abs_params(input_dev, ABS_Y,
                                0, cfg->y.dim, cfg->y.fuzz, 0);
 
+       /* finger touch area */
+       input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
+                            cfg->w.devmin, cfg->w.devmax, 0, 0);
+       input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
+                            cfg->w.devmin, cfg->w.devmax, 0, 0);
+       /* finger approach area */
+       input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR,
+                            cfg->w.devmin, cfg->w.devmax, 0, 0);
+       input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR,
+                            cfg->w.devmin, cfg->w.devmax, 0, 0);
+       /* finger orientation */
+       input_set_abs_params(input_dev, ABS_MT_ORIENTATION,
+                            -MAX_FINGER_ORIENTATION,
+                            MAX_FINGER_ORIENTATION, 0, 0);
+       /* finger position */
+       input_set_abs_params(input_dev, ABS_MT_POSITION_X,
+                            cfg->x.devmin, cfg->x.devmax, 0, 0);
+       input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
+                            cfg->y.devmin, cfg->y.devmax, 0, 0);
+
        __set_bit(EV_KEY, input_dev->evbit);
        __set_bit(BTN_TOUCH, input_dev->keybit);
        __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
@@ -310,13 +331,29 @@ static int report_bt_state(struct bcm5974 *dev, int size)
        return 0;
 }
 
+static void report_finger_data(struct input_dev *input,
+                              const struct bcm5974_config *cfg,
+                              const struct tp_finger *f)
+{
+       input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major));
+       input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor));
+       input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major));
+       input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor));
+       input_report_abs(input, ABS_MT_ORIENTATION,
+                        MAX_FINGER_ORIENTATION - raw2int(f->orientation));
+       input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x));
+       input_report_abs(input, ABS_MT_POSITION_Y,
+                        cfg->y.devmin + cfg->y.devmax - raw2int(f->abs_y));
+       input_mt_sync(input);
+}
+
 /* report trackpad data as logical trackpad state */
 static int report_tp_state(struct bcm5974 *dev, int size)
 {
        const struct bcm5974_config *c = &dev->cfg;
        const struct tp_finger *f;
        struct input_dev *input = dev->input;
-       int raw_p, raw_w, raw_x, raw_y, raw_n;
+       int raw_p, raw_w, raw_x, raw_y, raw_n, i;
        int ptest, origin, ibt = 0, nmin = 0, nmax = 0;
        int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0;
 
@@ -329,6 +366,11 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 
        /* always track the first finger; when detached, start over */
        if (raw_n) {
+
+               /* report raw trackpad data */
+               for (i = 0; i < raw_n; i++)
+                       report_finger_data(input, c, &f[i]);
+
                raw_p = raw2int(f->force_major);
                raw_w = raw2int(f->size_major);
                raw_x = raw2int(f->abs_x);
index 6d7aa10d10f002ae66388b0bf4ec23e58afecc90..7c1d7d420ae3f1ae8ba19952cef65aac1fe99246 100644 (file)
@@ -50,6 +50,12 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"),
                },
        },
+       {
+               /* LifeBook B */
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B Series"),
+               },
+       },
        {
                /* LifeBook B */
                .matches = {
index 401ac6b6edd43cca18b73b1663f731856f4f909b..d8c0c8d6992c92936db326dc28920350b899272d 100644 (file)
@@ -627,8 +627,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
                synaptics_hardware = true;
 
                if (max_proto > PSMOUSE_IMEX) {
-                       if (!set_properties || synaptics_init(psmouse) == 0)
+/*
+ * Try activating protocol, but check if support is enabled first, since
+ * we try detecting Synaptics even when protocol is disabled.
+ */
+                       if (synaptics_supported() &&
+                           (!set_properties || synaptics_init(psmouse) == 0)) {
                                return PSMOUSE_SYNAPTICS;
+                       }
+
 /*
  * Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
  * Unfortunately Logitech/Genius probes confuse some firmware versions so
@@ -683,19 +690,6 @@ static int psmouse_extensions(struct psmouse *psmouse,
                max_proto = PSMOUSE_IMEX;
        }
 
-/*
- * Try Finger Sensing Pad
- */
-       if (max_proto > PSMOUSE_IMEX) {
-               if (fsp_detect(psmouse, set_properties) == 0) {
-                       if (!set_properties || fsp_init(psmouse) == 0)
-                               return PSMOUSE_FSP;
-/*
- * Init failed, try basic relative protocols
- */
-                       max_proto = PSMOUSE_IMEX;
-               }
-       }
 
        if (max_proto > PSMOUSE_IMEX) {
                if (genius_detect(psmouse, set_properties) == 0)
@@ -711,6 +705,21 @@ static int psmouse_extensions(struct psmouse *psmouse,
                        return PSMOUSE_TOUCHKIT_PS2;
        }
 
+/*
+ * Try Finger Sensing Pad. We do it here because its probe upsets
+ * Trackpoint devices (causing TP_READ_ID command to time out).
+ */
+       if (max_proto > PSMOUSE_IMEX) {
+               if (fsp_detect(psmouse, set_properties) == 0) {
+                       if (!set_properties || fsp_init(psmouse) == 0)
+                               return PSMOUSE_FSP;
+/*
+ * Init failed, try basic relative protocols
+ */
+                       max_proto = PSMOUSE_IMEX;
+               }
+       }
+
 /*
  * Reset to defaults in case the device got confused by extended
  * protocol probes. Note that we follow up with full reset because
@@ -1132,7 +1141,14 @@ static void psmouse_cleanup(struct serio *serio)
                psmouse_deactivate(parent);
        }
 
-       psmouse_deactivate(psmouse);
+       psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
+
+       /*
+        * Disable stream mode so cleanup routine can proceed undisturbed.
+        */
+       if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE))
+               printk(KERN_WARNING "psmouse.c: Failed to disable mouse on %s\n",
+                       psmouse->ps2dev.serio->phys);
 
        if (psmouse->cleanup)
                psmouse->cleanup(psmouse);
@@ -1450,24 +1466,10 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *de
        struct serio *serio = to_serio_port(dev);
        struct psmouse_attribute *attr = to_psmouse_attr(devattr);
        struct psmouse *psmouse;
-       int retval;
-
-       retval = serio_pin_driver(serio);
-       if (retval)
-               return retval;
-
-       if (serio->drv != &psmouse_drv) {
-               retval = -ENODEV;
-               goto out;
-       }
 
        psmouse = serio_get_drvdata(serio);
 
-       retval = attr->show(psmouse, attr->data, buf);
-
-out:
-       serio_unpin_driver(serio);
-       return retval;
+       return attr->show(psmouse, attr->data, buf);
 }
 
 ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr,
@@ -1478,18 +1480,9 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
        struct psmouse *psmouse, *parent = NULL;
        int retval;
 
-       retval = serio_pin_driver(serio);
-       if (retval)
-               return retval;
-
-       if (serio->drv != &psmouse_drv) {
-               retval = -ENODEV;
-               goto out_unpin;
-       }
-
        retval = mutex_lock_interruptible(&psmouse_mutex);
        if (retval)
-               goto out_unpin;
+               goto out;
 
        psmouse = serio_get_drvdata(serio);
 
@@ -1519,8 +1512,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
 
  out_unlock:
        mutex_unlock(&psmouse_mutex);
- out_unpin:
-       serio_unpin_driver(serio);
+ out:
        return retval;
 }
 
@@ -1582,9 +1574,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
                }
 
                mutex_unlock(&psmouse_mutex);
-               serio_unpin_driver(serio);
                serio_unregister_child_port(serio);
-               serio_pin_driver_uninterruptible(serio);
                mutex_lock(&psmouse_mutex);
 
                if (serio->drv != &psmouse_drv) {
index 77b9fd0b3fbfc0a4598277cf0813b70b867928f2..81a6b81cb2fe7c194a2250c7cd3366c910290f8f 100644 (file)
@@ -2,7 +2,7 @@
  * Finger Sensing Pad PS/2 mouse driver.
  *
  * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd.
- * Copyright (C) 2005-2009 Tai-hwa Liang, Sentelic Corporation.
+ * Copyright (C) 2005-2010 Tai-hwa Liang, Sentelic Corporation.
  *
  *   This program is free software; you can redistribute it and/or
  *   modify it under the terms of the GNU General Public License
@@ -658,9 +658,9 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
                        if (packet[3] & BIT(1))
                                button_status |= 0x0f;  /* wheel up */
                        if (packet[3] & BIT(2))
-                               button_status |= BIT(5);/* horizontal left */
+                               button_status |= BIT(4);/* horizontal left */
                        if (packet[3] & BIT(3))
-                               button_status |= BIT(4);/* horizontal right */
+                               button_status |= BIT(5);/* horizontal right */
                        /* push back to packet queue */
                        if (button_status != 0)
                                packet[3] = button_status;
index 05689e732191a7a3cd223c7e1bfa93efbca673ec..d3f5243fa093c8ce1152cd17f737250f0002c888 100644 (file)
@@ -743,6 +743,11 @@ int synaptics_init(struct psmouse *psmouse)
        return -1;
 }
 
+bool synaptics_supported(void)
+{
+       return true;
+}
+
 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
 
 void __init synaptics_module_init(void)
@@ -754,5 +759,10 @@ int synaptics_init(struct psmouse *psmouse)
        return -ENOSYS;
 }
 
+bool synaptics_supported(void)
+{
+       return false;
+}
+
 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
 
index 838e7f2c9b304bff595dd1040fcbb7c909d8eaf8..f0f40a331dc8ae7ede590deaddc08a95052d73d0 100644 (file)
@@ -109,5 +109,6 @@ void synaptics_module_init(void);
 int synaptics_detect(struct psmouse *psmouse, bool set_properties);
 int synaptics_init(struct psmouse *psmouse);
 void synaptics_reset(struct psmouse *psmouse);
+bool synaptics_supported(void);
 
 #endif /* _SYNAPTICS_H */
index 64b688daf48a048e2e6efe5b328df058a1d582e2..2a5982e532f81aea8ec28fca40403c2f68150723 100644 (file)
@@ -523,6 +523,13 @@ static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
  * have turned up in 2007 that also need this again.
  */
 static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
+       {
+               /* Acer Aspire 5610 */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
+               },
+       },
        {
                /* Acer Aspire 5630 */
                .matches = {
index d84a36e545f6263c90c4cd698ee1d42bf44125c2..b54aee7cd9e352d6f1bbe7a43ce1a44b0f7e392b 100644 (file)
@@ -1161,9 +1161,17 @@ static int i8042_pm_restore(struct device *dev)
        return 0;
 }
 
+static int i8042_pm_thaw(struct device *dev)
+{
+       i8042_interrupt(0, NULL);
+
+       return 0;
+}
+
 static const struct dev_pm_ops i8042_pm_ops = {
        .suspend        = i8042_pm_reset,
        .resume         = i8042_pm_restore,
+       .thaw           = i8042_pm_thaw,
        .poweroff       = i8042_pm_reset,
        .restore        = i8042_pm_restore,
 };
index c21e6d3a88444e3db67da6829e8e95d96e28ce09..794d070c6900607752f2af1b7641f0cc98ef267f 100644 (file)
@@ -47,6 +47,7 @@
 #include <linux/workqueue.h>
 #include <linux/spi/spi.h>
 #include <linux/i2c.h>
+#include <linux/gpio.h>
 
 #include <linux/spi/ad7879.h>
 
@@ -132,7 +133,9 @@ struct ad7879 {
        struct input_dev        *input;
        struct work_struct      work;
        struct timer_list       timer;
-
+#ifdef CONFIG_GPIOLIB
+       struct gpio_chip        gc;
+#endif
        struct mutex            mutex;
        unsigned                disabled:1;     /* P: mutex */
 
@@ -150,11 +153,9 @@ struct ad7879 {
        u8                      median;
        u16                     x_plate_ohms;
        u16                     pressure_max;
-       u16                     gpio_init;
        u16                     cmd_crtl1;
        u16                     cmd_crtl2;
        u16                     cmd_crtl3;
-       unsigned                gpio:1;
 };
 
 static int ad7879_read(bus_device *, u8);
@@ -237,24 +238,6 @@ static irqreturn_t ad7879_irq(int irq, void *handle)
 
 static void ad7879_setup(struct ad7879 *ts)
 {
-       ts->cmd_crtl3 = AD7879_YPLUS_BIT |
-                       AD7879_XPLUS_BIT |
-                       AD7879_Z2_BIT |
-                       AD7879_Z1_BIT |
-                       AD7879_TEMPMASK_BIT |
-                       AD7879_AUXVBATMASK_BIT |
-                       AD7879_GPIOALERTMASK_BIT;
-
-       ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR |
-                       AD7879_AVG(ts->averaging) |
-                       AD7879_MFS(ts->median) |
-                       AD7879_FCD(ts->first_conversion_delay) |
-                       ts->gpio_init;
-
-       ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 |
-                       AD7879_ACQ(ts->acquisition_time) |
-                       AD7879_TMR(ts->pen_down_acc_interval);
-
        ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2);
        ad7879_write(ts->bus, AD7879_REG_CTRL3, ts->cmd_crtl3);
        ad7879_write(ts->bus, AD7879_REG_CTRL1, ts->cmd_crtl1);
@@ -324,48 +307,132 @@ static ssize_t ad7879_disable_store(struct device *dev,
 
 static DEVICE_ATTR(disable, 0664, ad7879_disable_show, ad7879_disable_store);
 
-static ssize_t ad7879_gpio_show(struct device *dev,
-                                    struct device_attribute *attr, char *buf)
+static struct attribute *ad7879_attributes[] = {
+       &dev_attr_disable.attr,
+       NULL
+};
+
+static const struct attribute_group ad7879_attr_group = {
+       .attrs = ad7879_attributes,
+};
+
+#ifdef CONFIG_GPIOLIB
+static int ad7879_gpio_direction_input(struct gpio_chip *chip,
+                                       unsigned gpio)
 {
-       struct ad7879 *ts = dev_get_drvdata(dev);
+       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       int err;
 
-       return sprintf(buf, "%u\n", ts->gpio);
+       mutex_lock(&ts->mutex);
+       ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIODIR | AD7879_GPIOPOL;
+       err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2);
+       mutex_unlock(&ts->mutex);
+
+       return err;
 }
 
-static ssize_t ad7879_gpio_store(struct device *dev,
-                                    struct device_attribute *attr,
-                                    const char *buf, size_t count)
+static int ad7879_gpio_direction_output(struct gpio_chip *chip,
+                                       unsigned gpio, int level)
 {
-       struct ad7879 *ts = dev_get_drvdata(dev);
-       unsigned long val;
-       int error;
+       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       int err;
 
-       error = strict_strtoul(buf, 10, &val);
-       if (error)
-               return error;
+       mutex_lock(&ts->mutex);
+       ts->cmd_crtl2 &= ~AD7879_GPIODIR;
+       ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIOPOL;
+       if (level)
+               ts->cmd_crtl2 |= AD7879_GPIO_DATA;
+       else
+               ts->cmd_crtl2 &= ~AD7879_GPIO_DATA;
+
+       err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2);
+       mutex_unlock(&ts->mutex);
+
+       return err;
+}
+
+static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
+{
+       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       u16 val;
 
        mutex_lock(&ts->mutex);
-       ts->gpio = !!val;
-       error = ad7879_write(ts->bus, AD7879_REG_CTRL2,
-                          ts->gpio ?
-                               ts->cmd_crtl2 & ~AD7879_GPIO_DATA :
-                               ts->cmd_crtl2 | AD7879_GPIO_DATA);
+       val = ad7879_read(ts->bus, AD7879_REG_CTRL2);
        mutex_unlock(&ts->mutex);
 
-       return error ? : count;
+       return !!(val & AD7879_GPIO_DATA);
 }
 
-static DEVICE_ATTR(gpio, 0664, ad7879_gpio_show, ad7879_gpio_store);
+static void ad7879_gpio_set_value(struct gpio_chip *chip,
+                                 unsigned gpio, int value)
+{
+       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
 
-static struct attribute *ad7879_attributes[] = {
-       &dev_attr_disable.attr,
-       &dev_attr_gpio.attr,
-       NULL
-};
+       mutex_lock(&ts->mutex);
+       if (value)
+               ts->cmd_crtl2 |= AD7879_GPIO_DATA;
+       else
+               ts->cmd_crtl2 &= ~AD7879_GPIO_DATA;
 
-static const struct attribute_group ad7879_attr_group = {
-       .attrs = ad7879_attributes,
-};
+       ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2);
+       mutex_unlock(&ts->mutex);
+}
+
+static int __devinit ad7879_gpio_add(struct device *dev)
+{
+       struct ad7879 *ts = dev_get_drvdata(dev);
+       struct ad7879_platform_data *pdata = dev->platform_data;
+       int ret = 0;
+
+       if (pdata->gpio_export) {
+               ts->gc.direction_input = ad7879_gpio_direction_input;
+               ts->gc.direction_output = ad7879_gpio_direction_output;
+               ts->gc.get = ad7879_gpio_get_value;
+               ts->gc.set = ad7879_gpio_set_value;
+               ts->gc.can_sleep = 1;
+               ts->gc.base = pdata->gpio_base;
+               ts->gc.ngpio = 1;
+               ts->gc.label = "AD7879-GPIO";
+               ts->gc.owner = THIS_MODULE;
+               ts->gc.dev = dev;
+
+               ret = gpiochip_add(&ts->gc);
+               if (ret)
+                       dev_err(dev, "failed to register gpio %d\n",
+                               ts->gc.base);
+       }
+
+       return ret;
+}
+
+/*
+ * We mark ad7879_gpio_remove inline so there is a chance the code
+ * gets discarded when not needed. We can't do __devinit/__devexit
+ * markup since it is used in both probe and remove methods.
+ */
+static inline void ad7879_gpio_remove(struct device *dev)
+{
+       struct ad7879 *ts = dev_get_drvdata(dev);
+       struct ad7879_platform_data *pdata = dev->platform_data;
+       int ret;
+
+       if (pdata->gpio_export) {
+               ret = gpiochip_remove(&ts->gc);
+               if (ret)
+                       dev_err(dev, "failed to remove gpio %d\n",
+                               ts->gc.base);
+       }
+}
+#else
+static inline int ad7879_gpio_add(struct device *dev)
+{
+       return 0;
+}
+
+static inline void ad7879_gpio_remove(struct device *dev)
+{
+}
+#endif
 
 static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts)
 {
@@ -403,12 +470,6 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts)
        ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
        ts->median = pdata->median;
 
-       if (pdata->gpio_output)
-               ts->gpio_init = AD7879_GPIO_EN |
-                               (pdata->gpio_default ? 0 : AD7879_GPIO_DATA);
-       else
-               ts->gpio_init = AD7879_GPIO_EN | AD7879_GPIODIR;
-
        snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&bus->dev));
 
        input_dev->name = "AD7879 Touchscreen";
@@ -446,6 +507,23 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts)
                goto err_free_mem;
        }
 
+       ts->cmd_crtl3 = AD7879_YPLUS_BIT |
+                       AD7879_XPLUS_BIT |
+                       AD7879_Z2_BIT |
+                       AD7879_Z1_BIT |
+                       AD7879_TEMPMASK_BIT |
+                       AD7879_AUXVBATMASK_BIT |
+                       AD7879_GPIOALERTMASK_BIT;
+
+       ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR |
+                       AD7879_AVG(ts->averaging) |
+                       AD7879_MFS(ts->median) |
+                       AD7879_FCD(ts->first_conversion_delay);
+
+       ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 |
+                       AD7879_ACQ(ts->acquisition_time) |
+                       AD7879_TMR(ts->pen_down_acc_interval);
+
        ad7879_setup(ts);
 
        err = request_irq(bus->irq, ad7879_irq,
@@ -460,15 +538,21 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts)
        if (err)
                goto err_free_irq;
 
-       err = input_register_device(input_dev);
+       err = ad7879_gpio_add(&bus->dev);
        if (err)
                goto err_remove_attr;
 
+       err = input_register_device(input_dev);
+       if (err)
+               goto err_remove_gpio;
+
        dev_info(&bus->dev, "Rev.%d touchscreen, irq %d\n",
                 revid >> 8, bus->irq);
 
        return 0;
 
+err_remove_gpio:
+       ad7879_gpio_remove(&bus->dev);
 err_remove_attr:
        sysfs_remove_group(&bus->dev.kobj, &ad7879_attr_group);
 err_free_irq:
@@ -481,6 +565,7 @@ err_free_mem:
 
 static int __devexit ad7879_destroy(bus_device *bus, struct ad7879 *ts)
 {
+       ad7879_gpio_remove(&bus->dev);
        ad7879_disable(ts);
        sysfs_remove_group(&ts->bus->dev.kobj, &ad7879_attr_group);
        free_irq(ts->bus->irq, ts);
index 09a5e7341bd5a7633166dbd8c2a5f17d00cf6da3..5256123a52285c35ed352d980ec7ad4641f941ee 100644 (file)
@@ -618,8 +618,8 @@ static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 #ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
 static int general_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
-       dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1] ;
-       dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3] ;
+       dev->x = (pkt[2] << 8) | pkt[1];
+       dev->y = (pkt[4] << 8) | pkt[3];
        dev->press = pkt[5] & 0xff;
        dev->touch = pkt[0] & 0x01;
 
@@ -809,9 +809,9 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
 #ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
        [DEVTYPE_GENERAL_TOUCH] = {
                .min_xc         = 0x0,
-               .max_xc         = 0x0500,
+               .max_xc         = 0x7fff,
                .min_yc         = 0x0,
-               .max_yc         = 0x0500,
+               .max_yc         = 0x7fff,
                .rept_size      = 7,
                .read_data      = general_touch_read_data,
        },
index 3464ebc4cdbc63af6bb89b53e98cd0b5f72c5b68..452fde9edf860b4133b46dc2c318d49b6016cdb0 100644 (file)
@@ -109,7 +109,7 @@ config HISAX_16_3
 
 config HISAX_TELESPCI
        bool "Teles PCI"
-       depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+       depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
        help
          This enables HiSax support for the Teles PCI.
          See <file:Documentation/isdn/README.HiSax> on how to configure it.
@@ -237,7 +237,7 @@ config HISAX_MIC
 
 config HISAX_NETJET
        bool "NETjet card"
-       depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+       depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
        help
          This enables HiSax support for the NetJet from Traverse
          Technologies.
@@ -248,7 +248,7 @@ config HISAX_NETJET
 
 config HISAX_NETJET_U
        bool "NETspider U card"
-       depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+       depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
        help
          This enables HiSax support for the Netspider U interface ISDN card
          from Traverse Technologies.
@@ -287,7 +287,7 @@ config HISAX_HSTSAPHIR
 
 config HISAX_BKM_A4T
        bool "Telekom A4T card"
-       depends on PCI && PCI_LEGACY
+       depends on PCI
        help
          This enables HiSax support for the Telekom A4T card.
 
@@ -297,7 +297,7 @@ config HISAX_BKM_A4T
 
 config HISAX_SCT_QUADRO
        bool "Scitel Quadro card"
-       depends on PCI && PCI_LEGACY
+       depends on PCI
        help
          This enables HiSax support for the Scitel Quadro card.
 
@@ -316,7 +316,7 @@ config HISAX_GAZEL
 
 config HISAX_HFC_PCI
        bool "HFC PCI-Bus cards"
-       depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+       depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
        help
          This enables HiSax support for the HFC-S PCI 2BDS0 based cards.
 
@@ -325,7 +325,7 @@ config HISAX_HFC_PCI
 
 config HISAX_W6692
        bool "Winbond W6692 based cards"
-       depends on PCI && PCI_LEGACY
+       depends on PCI
        help
          This enables HiSax support for Winbond W6692 based PCI ISDN cards.
 
@@ -341,7 +341,7 @@ config HISAX_HFC_SX
 
 config HISAX_ENTERNOW_PCI
        bool "Formula-n enter:now PCI card"
-       depends on HISAX_NETJET && PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+       depends on HISAX_NETJET && PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
        help
          This enables HiSax support for the Formula-n enter:now PCI
          ISDN card.
@@ -412,7 +412,7 @@ config HISAX_HFC4S8S
 
 config HISAX_FRITZ_PCIPNP
        tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)"
-       depends on PCI && PCI_LEGACY && EXPERIMENTAL
+       depends on PCI && EXPERIMENTAL
        help
          This enables the driver for the AVM Fritz!Card PCI,
          Fritz!Card PCI v2 and Fritz!Card PnP.
index 7cabc5a19492457e96d5de130f63c9ca352202b3..14295a155e716818bd96193bec62e33c484f8178 100644 (file)
@@ -822,7 +822,7 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
 
 #endif /* __ISAPNP__ */
 
-#ifndef CONFIG_PCI_LEGACY
+#ifndef CONFIG_PCI
 
 static int __devinit avm_pci_setup(struct IsdnCardState *cs)
 {
@@ -835,7 +835,7 @@ static struct pci_dev *dev_avm __devinitdata = NULL;
 
 static int __devinit avm_pci_setup(struct IsdnCardState *cs)
 {
-       if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
+       if ((dev_avm = hisax_find_pci_device(PCI_VENDOR_ID_AVM,
                PCI_DEVICE_ID_AVM_A1, dev_avm))) {
 
                if (pci_enable_device(dev_avm))
@@ -864,7 +864,7 @@ static int __devinit avm_pci_setup(struct IsdnCardState *cs)
        return (1);
 }
 
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
 int __devinit
 setup_avm_pcipnp(struct IsdnCard *card)
index 9ca2ee54cc944e1c26665d9ddb76600efa73baee..9f2009c0b69c103711ee0457586df2fd70e87b88 100644 (file)
@@ -340,7 +340,7 @@ setup_bkm_a4t(struct IsdnCard *card)
        } else
                return (0);
 
-       while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
+       while ((dev_a4t = hisax_find_pci_device(PCI_VENDOR_ID_ZORAN,
                PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
                ret = a4t_pci_probe(dev_a4t, cs, &found, &pci_memaddr);
                if (!ret)
index e1ff4717a8a69c75101875764eb2db18ae7ba0b7..e775706c60e3e5979a1f38f0d9d26521b86f6a84 100644 (file)
@@ -301,7 +301,7 @@ setup_sct_quadro(struct IsdnCard *card)
                (sub_vendor_id != PCI_VENDOR_ID_BERKOM)))
                return (0);
        if (cs->subtyp == SCT_1) {
-               while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX,
+               while ((dev_a8 = hisax_find_pci_device(PCI_VENDOR_ID_PLX,
                        PCI_DEVICE_ID_PLX_9050, dev_a8))) {
                        
                        sub_vendor_id = dev_a8->subsystem_vendor;
index 0b0c2e5d806b3b56b419549106332d49e2707ca9..780da9bda915fd153cbc04a9ba4a6f7a1b199647 100644 (file)
@@ -1148,7 +1148,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card)
 
 #endif /* ISAPNP */
 
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
 static struct pci_dev *dev_diva __devinitdata = NULL;
 static struct pci_dev *dev_diva_u __devinitdata = NULL;
 static struct pci_dev *dev_diva201 __devinitdata = NULL;
@@ -1159,21 +1159,21 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
        struct IsdnCardState *cs = card->cs;
 
        cs->subtyp = 0;
-       if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
+       if ((dev_diva = hisax_find_pci_device(PCI_VENDOR_ID_EICON,
                PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
                if (pci_enable_device(dev_diva))
                        return(0);
                cs->subtyp = DIVA_PCI;
                cs->irq = dev_diva->irq;
                cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
-       } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
+       } else if ((dev_diva_u = hisax_find_pci_device(PCI_VENDOR_ID_EICON,
                PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
                if (pci_enable_device(dev_diva_u))
                        return(0);
                cs->subtyp = DIVA_PCI;
                cs->irq = dev_diva_u->irq;
                cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
-       } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
+       } else if ((dev_diva201 = hisax_find_pci_device(PCI_VENDOR_ID_EICON,
                PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
                if (pci_enable_device(dev_diva201))
                        return(0);
@@ -1183,7 +1183,7 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
                        (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
                cs->hw.diva.cfg_reg =
                        (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
-       } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
+       } else if ((dev_diva202 = hisax_find_pci_device(PCI_VENDOR_ID_EICON,
                PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
                if (pci_enable_device(dev_diva202))
                        return(0);
@@ -1229,14 +1229,14 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
        return (1);             /* card found */
 }
 
-#else  /* if !CONFIG_PCI_LEGACY */
+#else  /* if !CONFIG_PCI */
 
 static int __devinit setup_diva_pci(struct IsdnCard *card)
 {
        return (-1);    /* card not found; continue search */
 }
 
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
 int __devinit
 setup_diva(struct IsdnCard *card)
index aa29d1cf16af7031f54365e5f78508e572282c40..23c41fcd864e7cff1c70480cfd265be83aa8c542 100644 (file)
@@ -1025,7 +1025,7 @@ setup_elsa_pcmcia(struct IsdnCard *card)
               cs->irq);
 }
 
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
 static         struct pci_dev *dev_qs1000 __devinitdata = NULL;
 static         struct pci_dev *dev_qs3000 __devinitdata = NULL;
 
@@ -1035,7 +1035,7 @@ setup_elsa_pci(struct IsdnCard *card)
        struct IsdnCardState *cs = card->cs;
 
        cs->subtyp = 0;
-       if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA,
+       if ((dev_qs1000 = hisax_find_pci_device(PCI_VENDOR_ID_ELSA,
                PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) {
                if (pci_enable_device(dev_qs1000))
                        return(0);
@@ -1043,7 +1043,7 @@ setup_elsa_pci(struct IsdnCard *card)
                cs->irq = dev_qs1000->irq;
                cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1);
                cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3);
-       } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA,
+       } else if ((dev_qs3000 = hisax_find_pci_device(PCI_VENDOR_ID_ELSA,
                PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) {
                if (pci_enable_device(dev_qs3000))
                        return(0);
@@ -1093,7 +1093,7 @@ setup_elsa_pci(struct IsdnCard *card)
 {
        return (1);
 }
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
 static int __devinit
 setup_elsa_common(struct IsdnCard *card)
index 39f421ed8de82d199e5856dd262c7f4ee4882036..26264abf1f5864cbe9a2888b94de4cb6f576c5ab 100644 (file)
@@ -406,7 +406,7 @@ setup_enternow_pci(struct IsdnCard *card)
 
        for ( ;; )
        {
-               if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
+               if ((dev_netjet = hisax_find_pci_device(PCI_VENDOR_ID_TIGERJET,
                        PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
                        ret = en_pci_probe(dev_netjet, cs);
                        if (!ret)
index 0ea3b46076800313c0debe79b71be88dca31d939..353982fc1436250daae3b7109a3e72e7fd84f515 100644 (file)
@@ -531,7 +531,7 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
        return (0);
 }
 
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
 static struct pci_dev *dev_tel __devinitdata = NULL;
 
 static int __devinit
@@ -546,7 +546,7 @@ setup_gazelpci(struct IsdnCardState *cs)
        found = 0;
        seekcard = PCI_DEVICE_ID_PLX_R685;
        for (nbseek = 0; nbseek < 4; nbseek++) {
-               if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX,
+               if ((dev_tel = hisax_find_pci_device(PCI_VENDOR_ID_PLX,
                                        seekcard, dev_tel))) {
                        if (pci_enable_device(dev_tel))
                                return 1;
@@ -620,7 +620,7 @@ setup_gazelpci(struct IsdnCardState *cs)
 
        return (0);
 }
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
 int __devinit
 setup_gazel(struct IsdnCard *card)
@@ -640,7 +640,7 @@ setup_gazel(struct IsdnCard *card)
                        return (0);
        } else {
 
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
                if (setup_gazelpci(cs))
                        return (0);
 #else
index 10914731b304986d740f53bc72f0dc98f38fe35c..917cc84065bd0a318875240cc2e3b8290a6c6758 100644 (file)
@@ -1658,7 +1658,7 @@ setup_hfcpci(struct IsdnCard *card)
 
        i = 0;
        while (id_list[i].vendor_id) {
-               tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
+               tmp_hfcpci = hisax_find_pci_device(id_list[i].vendor_id,
                                             id_list[i].device_id,
                                             dev_hfcpci);
                i++;
index 0685c194696928e7293a737aa010df7af217125a..832a87855ffb5900fa22ded56b5586ed907ed886 100644 (file)
@@ -1323,3 +1323,26 @@ void release_tei(struct IsdnCardState *cs);
 char *HiSax_getrev(const char *revision);
 int TeiNew(void);
 void TeiFree(void);
+
+#ifdef CONFIG_PCI
+
+#include <linux/pci.h>
+
+/* adaptation wrapper for old usage
+ * WARNING! This is unfit for use in a PCI hotplug environment,
+ * as the returned PCI device can disappear at any moment in time.
+ * Callers should be converted to use pci_get_device() instead.
+ */
+static inline struct pci_dev *hisax_find_pci_device(unsigned int vendor,
+                                                   unsigned int device,
+                                                   struct pci_dev *from)
+{
+       struct pci_dev *pdev;
+
+       pci_dev_get(from);
+       pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
+       pci_dev_put(pdev);
+       return pdev;
+}
+
+#endif
index ef00633e1d2a482fea9441f39dea12f90940908b..ccaa6e13310f5dfa61419296e755f060179b38ff 100644 (file)
@@ -297,12 +297,12 @@ int __devinit setup_niccy(struct IsdnCard *card)
                        return 0;
                }
        } else {
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
                static struct pci_dev *niccy_dev __devinitdata;
 
                u_int pci_ioaddr;
                cs->subtyp = 0;
-               if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
+               if ((niccy_dev = hisax_find_pci_device(PCI_VENDOR_ID_SATSAGEM,
                                                 PCI_DEVICE_ID_SATSAGEM_NICCY,
                                                 niccy_dev))) {
                        if (pci_enable_device(niccy_dev))
@@ -354,7 +354,7 @@ int __devinit setup_niccy(struct IsdnCard *card)
                printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
                printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
                return 0;
-#endif                         /* CONFIG_PCI_LEGACY */
+#endif                         /* CONFIG_PCI */
        }
        printk(KERN_INFO "HiSax: NICCY %s config irq:%d data:0x%X ale:0x%X\n",
                (cs->subtyp == 1) ? "PnP" : "PCI",
index 8d36ccc87d81104745b3fc3827e0063d935bd39c..2344e7b3344833263ee9c42fe3db93ea3ca660f2 100644 (file)
@@ -276,7 +276,7 @@ setup_netjet_s(struct IsdnCard *card)
 
        for ( ;; )
        {
-               if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
+               if ((dev_netjet = hisax_find_pci_device(PCI_VENDOR_ID_TIGERJET,
                        PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
                        ret = njs_pci_probe(dev_netjet, cs);
                        if (!ret)
index d306c946ffba85a03e906a5362d18b7d258bb4d5..095e974aed801deaa23ef6ddd3b58594df5cfa50 100644 (file)
@@ -240,7 +240,7 @@ setup_netjet_u(struct IsdnCard *card)
 
        for ( ;; )
        {
-               if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
+               if ((dev_netjet = hisax_find_pci_device(PCI_VENDOR_ID_TIGERJET,
                        PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
                        ret = nju_pci_probe(dev_netjet, cs);
                        if (!ret)
index 5569a522e2a13c998f305c730c361d0809a0d8f4..69dfc8d29017f62dde23c9fbd7123b17410bcbec 100644 (file)
@@ -598,7 +598,7 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
 }
 #endif /* __ISAPNP__ */
 
-#ifdef CONFIG_PCI_LEGACY
+#ifdef CONFIG_PCI
 static struct pci_dev *dev_sedl __devinitdata = NULL;
 
 static int __devinit
@@ -607,7 +607,7 @@ setup_sedlbauer_pci(struct IsdnCard *card)
        struct IsdnCardState *cs = card->cs;
        u16 sub_vendor_id, sub_id;
 
-       if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET,
+       if ((dev_sedl = hisax_find_pci_device(PCI_VENDOR_ID_TIGERJET,
                        PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) {
                if (pci_enable_device(dev_sedl))
                        return(0);
@@ -673,7 +673,7 @@ setup_sedlbauer_pci(struct IsdnCard *card)
        return (1);
 }
 
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
 int __devinit
 setup_sedlbauer(struct IsdnCard *card)
index 28b08de4673da9288ac8406c0e7d9976916805c1..b85ceb3746ce02b10d275599804d57d2c097087c 100644 (file)
@@ -300,7 +300,7 @@ setup_telespci(struct IsdnCard *card)
        if (cs->typ != ISDN_CTYPE_TELESPCI)
                return (0);
 
-       if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
+       if ((dev_tel = hisax_find_pci_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
                if (pci_enable_device(dev_tel))
                        return(0);
                cs->irq = dev_tel->irq;
index c4d862c11a605f288aa6fa3b97cb7167132d592a..9d6e864023fe18fd33add31997ed078edbd733a5 100644 (file)
@@ -1007,7 +1007,7 @@ setup_w6692(struct IsdnCard *card)
                return (0);
 
        while (id_list[id_idx].vendor_id) {
-               dev_w6692 = pci_find_device(id_list[id_idx].vendor_id,
+               dev_w6692 = hisax_find_pci_device(id_list[id_idx].vendor_id,
                                            id_list[id_idx].device_id,
                                            dev_w6692);
                if (dev_w6692) {
index 23741cec45e3e43210fdbac7e11c6ecc9c4eb1d5..1c4ee6e77937f596378f88587787052106cd3c58 100644 (file)
@@ -317,13 +317,15 @@ static int __init adb_init(void)
                        break;
                }
        }
-       if ((adb_controller == NULL) || adb_controller->init()) {
-               printk(KERN_WARNING "Warning: no ADB interface detected\n");
+       if (adb_controller != NULL && adb_controller->init &&
+           adb_controller->init())
                adb_controller = NULL;
+       if (adb_controller == NULL) {
+               printk(KERN_WARNING "Warning: no ADB interface detected\n");
        } else {
 #ifdef CONFIG_PPC
-               if (machine_is_compatible("AAPL,PowerBook1998") ||
-                       machine_is_compatible("PowerBook1,1"))
+               if (of_machine_is_compatible("AAPL,PowerBook1998") ||
+                       of_machine_is_compatible("PowerBook1,1"))
                        sleepy_trackpad = 1;
 #endif /* CONFIG_PPC */
 
index 96faa799b82a84784d515f4d0aa77d527ca9ee28..f96feeb6b9ce0da9d22acb9a47697eac4f1e3efb 100644 (file)
@@ -660,7 +660,7 @@ static int smu_platform_probe(struct of_device* dev,
        return 0;
 }
 
-static struct of_device_id smu_platform_match[] =
+static const struct of_device_id smu_platform_match[] =
 {
        {
                .type           = "smu",
index 5ff47ba7f2d052e639f733c6f8cddea3e18b9175..c42eeb43042daa92d9f04e22b2205ce6d1d2a33d 100644 (file)
@@ -90,6 +90,8 @@ static struct task_struct *thread_therm = NULL;
 
 static void write_both_fan_speed(struct thermostat *th, int speed);
 static void write_fan_speed(struct thermostat *th, int speed, int fan);
+static void thermostat_create_files(void);
+static void thermostat_remove_files(void);
 
 static int
 write_reg(struct thermostat* th, int reg, u8 data)
@@ -161,6 +163,8 @@ remove_thermostat(struct i2c_client *client)
        struct thermostat *th = i2c_get_clientdata(client);
        int i;
        
+       thermostat_remove_files();
+
        if (thread_therm != NULL) {
                kthread_stop(thread_therm);
        }
@@ -312,7 +316,7 @@ static void update_fans_speed (struct thermostat *th)
 
                        if (verbose)
                                printk(KERN_DEBUG "adt746x: Setting fans speed to %d "
-                                                "(limit exceeded by %d on %s) \n",
+                                                "(limit exceeded by %d on %s)\n",
                                                new_speed, var,
                                                sensor_location[fan_number+1]);
                        write_both_fan_speed(th, new_speed);
@@ -449,6 +453,8 @@ static int probe_thermostat(struct i2c_client *client,
                return -ENOMEM;
        }
 
+       thermostat_create_files();
+
        return 0;
 }
 
@@ -566,7 +572,6 @@ thermostat_init(void)
        struct device_node* np;
        const u32 *prop;
        int i = 0, offset = 0;
-       int err;
 
        np = of_find_node_by_name(NULL, "fan");
        if (!np)
@@ -633,6 +638,17 @@ thermostat_init(void)
                return -ENODEV;
        }
 
+#ifndef CONFIG_I2C_POWERMAC
+       request_module("i2c-powermac");
+#endif
+
+       return i2c_add_driver(&thermostat_driver);
+}
+
+static void thermostat_create_files(void)
+{
+       int err;
+
        err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature);
        err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature);
        err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit);
@@ -647,16 +663,9 @@ thermostat_init(void)
        if (err)
                printk(KERN_WARNING
                        "Failed to create tempertaure attribute file(s).\n");
-
-#ifndef CONFIG_I2C_POWERMAC
-       request_module("i2c-powermac");
-#endif
-
-       return i2c_add_driver(&thermostat_driver);
 }
 
-static void __exit
-thermostat_exit(void)
+static void thermostat_remove_files(void)
 {
        if (of_dev) {
                device_remove_file(&of_dev->dev, &dev_attr_sensor1_temperature);
@@ -673,9 +682,14 @@ thermostat_exit(void)
                        device_remove_file(&of_dev->dev,
                                           &dev_attr_sensor2_fan_speed);
 
-               of_device_unregister(of_dev);
        }
+}
+
+static void __exit
+thermostat_exit(void)
+{
        i2c_del_driver(&thermostat_driver);
+       of_device_unregister(of_dev);
 }
 
 module_init(thermostat_init);
index ea32c7e5a9af116c49e885b1e015fe9742f24758..5738d8bf2d97e8918330147c8827e551fd2ec317 100644 (file)
@@ -1899,7 +1899,7 @@ static int create_control_loops(void)
         */
        if (rackmac)
                cpu_pid_type = CPU_PID_TYPE_RACKMAC;
-       else if (machine_is_compatible("PowerMac7,3")
+       else if (of_machine_is_compatible("PowerMac7,3")
            && (cpu_count > 1)
            && fcu_fans[CPUA_PUMP_RPM_INDEX].id != FCU_FAN_ABSENT_ID
            && fcu_fans[CPUB_PUMP_RPM_INDEX].id != FCU_FAN_ABSENT_ID) {
@@ -2211,7 +2211,7 @@ static int fcu_of_remove(struct of_device* dev)
        return 0;
 }
 
-static struct of_device_id fcu_match[] = 
+static const struct of_device_id fcu_match[] = 
 {
        {
        .type           = "fcu",
@@ -2234,10 +2234,10 @@ static int __init therm_pm72_init(void)
 {
        struct device_node *np;
 
-       rackmac = machine_is_compatible("RackMac3,1");
+       rackmac = of_machine_is_compatible("RackMac3,1");
 
-       if (!machine_is_compatible("PowerMac7,2") &&
-           !machine_is_compatible("PowerMac7,3") &&
+       if (!of_machine_is_compatible("PowerMac7,2") &&
+           !of_machine_is_compatible("PowerMac7,3") &&
            !rackmac)
                return -ENODEV;
 
index 3fbe41b0ac07f40daba70c2153b6007e806bc60d..7fb8b4da35a7a740c81dbd005e2d05d1f656926d 100644 (file)
@@ -457,7 +457,7 @@ therm_of_remove( struct of_device *dev )
        return 0;
 }
 
-static struct of_device_id therm_of_match[] = {{
+static const struct of_device_id therm_of_match[] = {{
        .name           = "fan",
        .compatible     = "adm1030"
     }, {}
@@ -490,7 +490,7 @@ g4fan_init( void )
        info = of_get_property(np, "thermal-info", NULL);
        of_node_put(np);
 
-       if( !info || !machine_is_compatible("PowerMac3,6") )
+       if( !info || !of_machine_is_compatible("PowerMac3,6") )
                return -ENODEV;
 
        if( info->id != 3 ) {
index 62dd1fdafecf4c92954cf279be538d77aa5c4d27..971bc9582a5fa488c283a686123f14de88fb51b2 100644 (file)
@@ -89,7 +89,6 @@ static int cuda_fully_inited;
 
 #ifdef CONFIG_ADB
 static int cuda_probe(void);
-static int cuda_init(void);
 static int cuda_send_request(struct adb_request *req, int sync);
 static int cuda_adb_autopoll(int devs);
 static int cuda_reset_adb_bus(void);
@@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req,
 
 #ifdef CONFIG_ADB
 struct adb_driver via_cuda_driver = {
-       "CUDA",
-       cuda_probe,
-       cuda_init,
-       cuda_send_request,
-       cuda_adb_autopoll,
-       cuda_poll,
-       cuda_reset_adb_bus
+       .name         = "CUDA",
+       .probe        = cuda_probe,
+       .send_request = cuda_send_request,
+       .autopoll     = cuda_adb_autopoll,
+       .poll         = cuda_poll,
+       .reset_bus    = cuda_reset_adb_bus,
 };
 #endif /* CONFIG_ADB */
 
-#ifdef CONFIG_PPC
+#ifdef CONFIG_MAC
+int __init find_via_cuda(void)
+{
+    struct adb_request req;
+    int err;
+
+    if (macintosh_config->adb_type != MAC_ADB_CUDA)
+       return 0;
+
+    via = via1;
+    cuda_state = idle;
+
+    err = cuda_init_via();
+    if (err) {
+       printk(KERN_ERR "cuda_init_via() failed\n");
+       via = NULL;
+       return 0;
+    }
+
+    /* enable autopoll */
+    cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1);
+    while (!req.complete)
+       cuda_poll();
+
+    return 1;
+}
+#else
 int __init find_via_cuda(void)
 {
     struct adb_request req;
@@ -175,7 +199,7 @@ int __init find_via_cuda(void)
     vias = NULL;
     return 0;
 }
-#endif /* CONFIG_PPC */
+#endif /* !defined CONFIG_MAC */
 
 static int __init via_cuda_start(void)
 {
@@ -184,14 +208,14 @@ static int __init via_cuda_start(void)
 
 #ifdef CONFIG_MAC
     cuda_irq = IRQ_MAC_ADB;
-#else /* CONFIG_MAC */
+#else
     cuda_irq = irq_of_parse_and_map(vias, 0);
     if (cuda_irq == NO_IRQ) {
        printk(KERN_ERR "via-cuda: can't map interrupts for %s\n",
               vias->full_name);
        return -ENODEV;
     }
-#endif /* CONFIG_MAC */
+#endif
 
     if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
        printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq);
@@ -216,28 +240,10 @@ cuda_probe(void)
 #else
     if (macintosh_config->adb_type != MAC_ADB_CUDA)
        return -ENODEV;
-    via = via1;
 #endif
-    return 0;
-}
-
-static int __init
-cuda_init(void)
-{
-#ifdef CONFIG_PPC
     if (via == NULL)
        return -ENODEV;
     return 0;
-#else 
-    int err = cuda_init_via();
-    if (err) {
-       printk(KERN_ERR "cuda_init_via() failed\n");
-       return -ENODEV;
-    }
-    out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from SR */
-
-    return via_cuda_start();
-#endif
 }
 #endif /* CONFIG_ADB */
 
@@ -430,9 +436,11 @@ cuda_poll(void)
     /* cuda_interrupt only takes a normal lock, we disable
      * interrupts here to avoid re-entering and thus deadlocking.
      */
-    disable_irq(cuda_irq);
+    if (cuda_irq)
+       disable_irq(cuda_irq);
     cuda_interrupt(0, NULL);
-    enable_irq(cuda_irq);
+    if (cuda_irq)
+       enable_irq(cuda_irq);
 }
 
 static irqreturn_t
@@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg)
     
     spin_lock(&cuda_lock);
 
-    /* On powermacs, this handler is registered for the VIA IRQ. But it uses
+    /* On powermacs, this handler is registered for the VIA IRQ. But they use
      * just the shift register IRQ -- other VIA interrupt sources are disabled.
      * On m68k macs, the VIA IRQ sources are dispatched individually. Unless
      * we are polling, the shift register IRQ flag has already been cleared.
index a348bb0791d37b764a2e61ffe55bacd57a12e182..4f3c4479c16aa16da18efd22bbc37e12dc39d2c7 100644 (file)
@@ -150,13 +150,13 @@ void __init pmu_backlight_init()
 
        /* Special case for the old PowerBook since I can't test on it */
        autosave =
-               machine_is_compatible("AAPL,3400/2400") ||
-               machine_is_compatible("AAPL,3500");
+               of_machine_is_compatible("AAPL,3400/2400") ||
+               of_machine_is_compatible("AAPL,3500");
 
        if (!autosave &&
            !pmac_has_backlight_type("pmu") &&
-           !machine_is_compatible("AAPL,PowerBook1998") &&
-           !machine_is_compatible("PowerBook1,1"))
+           !of_machine_is_compatible("AAPL,PowerBook1998") &&
+           !of_machine_is_compatible("PowerBook1,1"))
                return;
 
        snprintf(name, sizeof(name), "pmubl");
index db379c3814326db904a17a76b7182ec4266a3a4a..42764849eb787c42fe38315333e0d6bbcd544287 100644 (file)
@@ -463,8 +463,8 @@ static int __init via_pmu_dev_init(void)
 #endif
 
 #ifdef CONFIG_PPC32
-       if (machine_is_compatible("AAPL,3400/2400") ||
-               machine_is_compatible("AAPL,3500")) {
+       if (of_machine_is_compatible("AAPL,3400/2400") ||
+               of_machine_is_compatible("AAPL,3500")) {
                int mb = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
                        NULL, PMAC_MB_INFO_MODEL, 0);
                pmu_battery_count = 1;
@@ -472,8 +472,8 @@ static int __init via_pmu_dev_init(void)
                        pmu_batteries[0].flags |= PMU_BATT_TYPE_COMET;
                else
                        pmu_batteries[0].flags |= PMU_BATT_TYPE_HOOPER;
-       } else if (machine_is_compatible("AAPL,PowerBook1998") ||
-               machine_is_compatible("PowerBook1,1")) {
+       } else if (of_machine_is_compatible("AAPL,PowerBook1998") ||
+               of_machine_is_compatible("PowerBook1,1")) {
                pmu_battery_count = 2;
                pmu_batteries[0].flags |= PMU_BATT_TYPE_SMART;
                pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART;
index 075b4d99e35497c9a8f505af04d1fdf617489680..437f55c5d18d32f02fbd89c6fd220108cfe6e857 100644 (file)
@@ -468,9 +468,9 @@ static int __init windfarm_core_init(void)
        DBG("wf: core loaded\n");
 
        /* Don't register on old machines that use therm_pm72 for now */
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                return -ENODEV;
        platform_device_register(&wf_platform_device);
        return 0;
index 900aade0619871c683b2a29cf45a3638c925a957..1a77a7c97d0e58d3141b667b6ff2b55be0aa3f52 100644 (file)
@@ -76,9 +76,9 @@ static int __init wf_cpufreq_clamp_init(void)
        struct wf_control *clamp;
 
        /* Don't register on old machines that use therm_pm72 for now */
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                return -ENODEV;
 
        clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL);
index ed6426a107738b4dff5a1d639140a7f22b7c9b27..d8257d35afde91c225b49bad6f0cc9885cf3fc69 100644 (file)
@@ -239,9 +239,9 @@ static struct i2c_driver wf_lm75_driver = {
 static int __init wf_lm75_sensor_init(void)
 {
        /* Don't register on old machines that use therm_pm72 for now */
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                return -ENODEV;
        return i2c_add_driver(&wf_lm75_driver);
 }
index a67b349319e9c9be57f19faf3f309ff487e06448..b486eb929fde725fb9e0271d4af46cdc241c2113 100644 (file)
@@ -188,9 +188,9 @@ static struct i2c_driver wf_max6690_driver = {
 static int __init wf_max6690_sensor_init(void)
 {
        /* Don't register on old machines that use therm_pm72 for now */
-       if (machine_is_compatible("PowerMac7,2") ||
-           machine_is_compatible("PowerMac7,3") ||
-           machine_is_compatible("RackMac3,1"))
+       if (of_machine_is_compatible("PowerMac7,2") ||
+           of_machine_is_compatible("PowerMac7,3") ||
+           of_machine_is_compatible("RackMac3,1"))
                return -ENODEV;
        return i2c_add_driver(&wf_max6690_driver);
 }
index 73d695dc9e5059c950c99f8c08a0cd30a2141c39..e0ee80700cde4713430452bffbeb0625a51479db 100644 (file)
@@ -676,7 +676,7 @@ static int __init wf_pm112_init(void)
 {
        struct device_node *cpu;
 
-       if (!machine_is_compatible("PowerMac11,2"))
+       if (!of_machine_is_compatible("PowerMac11,2"))
                return -ENODEV;
 
        /* Count the number of CPU cores */
index 66ec4fb115bb203a3c566cead227e650386b8d4d..947d4afa25ca9abfe199ffea35f2233e944c9498 100644 (file)
@@ -1008,7 +1008,7 @@ static int __init pm121_init(void)
 {
        int rc = -ENODEV;
 
-       if (machine_is_compatible("PowerMac12,1"))
+       if (of_machine_is_compatible("PowerMac12,1"))
                rc = pm121_init_pm();
 
        if (rc == 0) {
index abbe206474f58ce2ff1de53e274d6df7158b92f4..565d5b2adc95918e2d89a2076bc6b6441d70a3da 100644 (file)
@@ -779,8 +779,8 @@ static int __init wf_smu_init(void)
 {
        int rc = -ENODEV;
 
-       if (machine_is_compatible("PowerMac8,1") ||
-           machine_is_compatible("PowerMac8,2"))
+       if (of_machine_is_compatible("PowerMac8,1") ||
+           of_machine_is_compatible("PowerMac8,2"))
                rc = wf_init_pm();
 
        if (rc == 0) {
index 764c525b2117f0ac2420992063ac1efdcb512a21..bea99168ff35c9366d43d0ad460b0989c2f2f225 100644 (file)
@@ -711,7 +711,7 @@ static int __init wf_smu_init(void)
 {
        int rc = -ENODEV;
 
-       if (machine_is_compatible("PowerMac9,1"))
+       if (of_machine_is_compatible("PowerMac9,1"))
                rc = wf_init_pm();
 
        if (rc == 0) {
index 9c567b93f417b05d7ad15cd054c30627d851fb16..3c193504bb8002d9aa8d497976c119967a63700c 100644 (file)
@@ -363,9 +363,9 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps)
         * I yet have to figure out what's up with 8,2 and will have to
         * adjust for later, unless we can 100% trust the SDB partition...
         */
-       if ((machine_is_compatible("PowerMac8,1") ||
-            machine_is_compatible("PowerMac8,2") ||
-            machine_is_compatible("PowerMac9,1")) &&
+       if ((of_machine_is_compatible("PowerMac8,1") ||
+            of_machine_is_compatible("PowerMac8,2") ||
+            of_machine_is_compatible("PowerMac9,1")) &&
            cpuvcp_version >= 2) {
                pow->quadratic = 1;
                DBG("windfarm: CPU Power using quadratic transform\n");
index 54abf9e303b7d66c4f41de1ef1ff17197572d292..f1c8cae70b4ba0c8de108a88ee72ecc26def140a 100644 (file)
@@ -172,11 +172,15 @@ int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type,
 {
        int r = 0;
        size_t dummy = 0;
-       int overhead_size =
-               sizeof(struct dm_ulog_request *) + sizeof(struct cn_msg);
+       int overhead_size = sizeof(struct dm_ulog_request) + sizeof(struct cn_msg);
        struct dm_ulog_request *tfr = prealloced_ulog_tfr;
        struct receiving_pkg pkg;
 
+       /*
+        * Given the space needed to hold the 'struct cn_msg' and
+        * 'struct dm_ulog_request' - do we have enough payload
+        * space remaining?
+        */
        if (data_size > (DM_ULOG_PREALLOCED_SIZE - overhead_size)) {
                DMINFO("Size of tfr exceeds preallocated size");
                return -EINVAL;
@@ -191,7 +195,7 @@ resend:
         */
        mutex_lock(&dm_ulog_lock);
 
-       memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - overhead_size);
+       memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg));
        memcpy(tfr->uuid, uuid, DM_UUID_LEN);
        tfr->luid = luid;
        tfr->seq = dm_ulog_seq++;
index ad779bd13aec43ac6aba859be57a8e94d01a5001..6c1046df81f6f7738cd74eec6a6d5558a8e23f13 100644 (file)
@@ -724,7 +724,7 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
        /*
         * Dispatch io.
         */
-       if (unlikely(ms->log_failure)) {
+       if (unlikely(ms->log_failure) && errors_handled(ms)) {
                spin_lock_irq(&ms->lock);
                bio_list_merge(&ms->failures, &sync);
                spin_unlock_irq(&ms->lock);
index 5f19ceb6fe91f6c214c9103cc4b5b4037de84a9f..168bd38f50060968cf59e3543708701f1f1f575a 100644 (file)
@@ -660,10 +660,9 @@ void dm_rh_recovery_end(struct dm_region *reg, int success)
        spin_lock_irq(&rh->region_lock);
        if (success)
                list_add(&reg->list, &reg->rh->recovered_regions);
-       else {
-               reg->state = DM_RH_NOSYNC;
+       else
                list_add(&reg->list, &reg->rh->failed_recovered_regions);
-       }
+
        spin_unlock_irq(&rh->region_lock);
 
        rh->wakeup_workers(rh->context);
index 7d08879689acc27b6e91f038e53fb1be4deb1b89..c097d8a4823d65f7e3408c9f116c235b19cec735 100644 (file)
@@ -254,7 +254,7 @@ static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw,
         * Issue the synchronous I/O from a different thread
         * to avoid generic_make_request recursion.
         */
-       INIT_WORK(&req.work, do_metadata);
+       INIT_WORK_ON_STACK(&req.work, do_metadata);
        queue_work(ps->metadata_wq, &req.work);
        flush_workqueue(ps->metadata_wq);
 
index e0efc1adcaffa173e2177596579193217f353b8f..bd58703ee8f6b83d2a245328e9f30fa5e47dfcf4 100644 (file)
@@ -110,7 +110,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        stripes = simple_strtoul(argv[0], &end, 10);
-       if (*end) {
+       if (!stripes || *end) {
                ti->error = "Invalid stripe count";
                return -EINVAL;
        }
index f53392df7b97984438e8ec823abccb59d4386ee9..f91b40942e07885a1d2265de3c41e6abf6465fc7 100644 (file)
@@ -79,13 +79,6 @@ static struct sysfs_ops dm_sysfs_ops = {
        .show   = dm_attr_show,
 };
 
-/*
- * The sysfs structure is embedded in md struct, nothing to do here
- */
-static void dm_sysfs_release(struct kobject *kobj)
-{
-}
-
 /*
  * dm kobject is embedded in mapped_device structure
  * no need to define release function here
@@ -93,7 +86,6 @@ static void dm_sysfs_release(struct kobject *kobj)
 static struct kobj_type dm_ktype = {
        .sysfs_ops      = &dm_sysfs_ops,
        .default_attrs  = dm_attrs,
-       .release        = dm_sysfs_release
 };
 
 /*
index be625475cf6df41faa48c9a3b91e841655afb3b2..4b22feb01a0c6ced4d850c2e0feba0226d72292f 100644 (file)
@@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
                return 0;
        }
 
-       if (blk_stack_limits(limits, &q->limits, start << 9) < 0)
-               DMWARN("%s: target device %s is misaligned: "
+       if (bdev_stack_limits(limits, bdev, start) < 0)
+               DMWARN("%s: adding target device %s caused an alignment inconsistency: "
                       "physical_block_size=%u, logical_block_size=%u, "
                       "alignment_offset=%u, start=%llu",
                       dm_device_name(ti->table->md), bdevname(bdev, b),
                       q->limits.physical_block_size,
                       q->limits.logical_block_size,
                       q->limits.alignment_offset,
-                      (unsigned long long) start << 9);
-
+                      (unsigned long long) start << SECTOR_SHIFT);
 
        /*
         * Check if merge fn is supported.
@@ -1026,9 +1025,9 @@ combine_limits:
                 * for the table.
                 */
                if (blk_stack_limits(limits, &ti_limits, 0) < 0)
-                       DMWARN("%s: target device "
+                       DMWARN("%s: adding target device "
                               "(start sect %llu len %llu) "
-                              "is misaligned",
+                              "caused an alignment inconsistency",
                               dm_device_name(table->md),
                               (unsigned long long) ti->begin,
                               (unsigned long long) ti->len);
@@ -1079,15 +1078,6 @@ no_integrity:
 void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
                               struct queue_limits *limits)
 {
-       /*
-        * Each target device in the table has a data area that should normally
-        * be aligned such that the DM device's alignment_offset is 0.
-        * FIXME: Propagate alignment_offsets up the stack and warn of
-        *        sub-optimal or inconsistent settings.
-        */
-       limits->alignment_offset = 0;
-       limits->misaligned = 0;
-
        /*
         * Copy table's limits to the DM device's request_queue
         */
index 3167480b532cd92e64c12831bb3ac4d424f37270..aa4e2aa86d490c5aa1af423d23c176ed69c25302 100644 (file)
@@ -1595,10 +1595,15 @@ static int dm_prep_fn(struct request_queue *q, struct request *rq)
        return BLKPREP_OK;
 }
 
-static void map_request(struct dm_target *ti, struct request *clone,
-                       struct mapped_device *md)
+/*
+ * Returns:
+ * 0  : the request has been processed (not requeued)
+ * !0 : the request has been requeued
+ */
+static int map_request(struct dm_target *ti, struct request *clone,
+                      struct mapped_device *md)
 {
-       int r;
+       int r, requeued = 0;
        struct dm_rq_target_io *tio = clone->end_io_data;
 
        /*
@@ -1625,6 +1630,7 @@ static void map_request(struct dm_target *ti, struct request *clone,
        case DM_MAPIO_REQUEUE:
                /* The target wants to requeue the I/O */
                dm_requeue_unmapped_request(clone);
+               requeued = 1;
                break;
        default:
                if (r > 0) {
@@ -1636,6 +1642,8 @@ static void map_request(struct dm_target *ti, struct request *clone,
                dm_kill_unmapped_request(clone, r);
                break;
        }
+
+       return requeued;
 }
 
 /*
@@ -1677,12 +1685,17 @@ static void dm_request_fn(struct request_queue *q)
                atomic_inc(&md->pending[rq_data_dir(clone)]);
 
                spin_unlock(q->queue_lock);
-               map_request(ti, clone, md);
+               if (map_request(ti, clone, md))
+                       goto requeued;
+
                spin_lock_irq(q->queue_lock);
        }
 
        goto out;
 
+requeued:
+       spin_lock_irq(q->queue_lock);
+
 plug_and_out:
        if (!elv_queue_empty(q))
                /* Some requests still remain, retry later */
index dd3dfe42d5a9d081c590018f1ac6325cfecdaf12..a20a71e5efd3ce0607993a84795e943a1706359d 100644 (file)
@@ -4075,8 +4075,10 @@ static void mddev_delayed_delete(struct work_struct *ws)
 {
        mddev_t *mddev = container_of(ws, mddev_t, del_work);
 
-       if (mddev->private == &md_redundancy_group) {
+       if (mddev->private) {
                sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
+               if (mddev->private != (void*)1)
+                       sysfs_remove_group(&mddev->kobj, mddev->private);
                if (mddev->sysfs_action)
                        sysfs_put(mddev->sysfs_action);
                mddev->sysfs_action = NULL;
@@ -4287,10 +4289,7 @@ static int do_md_run(mddev_t * mddev)
                sysfs_notify_dirent(rdev->sysfs_state);
        }
 
-       md_probe(mddev->unit, NULL, NULL);
        disk = mddev->gendisk;
-       if (!disk)
-               return -ENOMEM;
 
        spin_lock(&pers_lock);
        pers = find_pers(mddev->level, mddev->clevel);
@@ -4530,8 +4529,8 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
                        mddev->queue->unplug_fn = NULL;
                        mddev->queue->backing_dev_info.congested_fn = NULL;
                        module_put(mddev->pers->owner);
-                       if (mddev->pers->sync_request)
-                               mddev->private = &md_redundancy_group;
+                       if (mddev->pers->sync_request && mddev->private == NULL)
+                               mddev->private = (void*)1;
                        mddev->pers = NULL;
                        /* tell userspace to handle 'inactive' */
                        sysfs_notify_dirent(mddev->sysfs_state);
@@ -4578,9 +4577,6 @@ out:
                }
                mddev->bitmap_info.offset = 0;
 
-               /* make sure all md_delayed_delete calls have finished */
-               flush_scheduled_work();
-
                export_array(mddev);
 
                mddev->array_sectors = 0;
index e84204eb12dff9c87daaf8ecbdba4462eda8971f..ceb24afdc147aada31741b10213443375617257f 100644 (file)
@@ -5136,9 +5136,8 @@ static int stop(mddev_t *mddev)
        mddev->thread = NULL;
        mddev->queue->backing_dev_info.congested_fn = NULL;
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
-       sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
        free_conf(conf);
-       mddev->private = NULL;
+       mddev->private = &raid5_attrs_group;
        return 0;
 }
 
@@ -5464,11 +5463,11 @@ static int raid5_start_reshape(mddev_t *mddev)
                    !test_bit(Faulty, &rdev->flags)) {
                        if (raid5_add_disk(mddev, rdev) == 0) {
                                char nm[20];
-                               if (rdev->raid_disk >= conf->previous_raid_disks)
+                               if (rdev->raid_disk >= conf->previous_raid_disks) {
                                        set_bit(In_sync, &rdev->flags);
-                               else
+                                       added_devices++;
+                               } else
                                        rdev->recovery_offset = 0;
-                               added_devices++;
                                sprintf(nm, "rd%d", rdev->raid_disk);
                                if (sysfs_create_link(&mddev->kobj,
                                                      &rdev->kobj, nm))
@@ -5480,9 +5479,12 @@ static int raid5_start_reshape(mddev_t *mddev)
                                break;
                }
 
+       /* When a reshape changes the number of devices, ->degraded
+        * is measured against the large of the pre and post number of
+        * devices.*/
        if (mddev->delta_disks > 0) {
                spin_lock_irqsave(&conf->device_lock, flags);
-               mddev->degraded = (conf->raid_disks - conf->previous_raid_disks)
+               mddev->degraded += (conf->raid_disks - conf->previous_raid_disks)
                        - added_devices;
                spin_unlock_irqrestore(&conf->device_lock, flags);
        }
index df5ddb4bbbf763a222dce2682a556fdd501bf03a..171890e7a41dba9def1458c95c40c8c86ec69c76 100644 (file)
@@ -1,5 +1,5 @@
 ir-common-objs  := ir-functions.o ir-keymaps.o
-ir-core-objs   := ir-keytable.o
+ir-core-objs   := ir-keytable.o ir-sysfs.o
 
 obj-$(CONFIG_IR_CORE) += ir-core.o
 obj-$(CONFIG_VIDEO_IR) += ir-common.o
index 776a136616d6ee7c8c8f878c649291aee339b282..ab06919ad5fc03c68329307ad4e97b9367fbb703 100644 (file)
@@ -52,7 +52,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
 /* -------------------------------------------------------------------------- */
 
 int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
-                  int ir_type)
+                 const u64 ir_type)
 {
        ir->ir_type = ir_type;
 
index 9bbe6b1e9871f48816f598d6318165964fb97592..0efdefe75f3281e5431d6713686a7e4a09800b50 100644 (file)
@@ -3393,3 +3393,102 @@ struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table = {
 };
 EXPORT_SYMBOL_GPL(ir_codes_nec_terratec_cinergy_xs_table);
 
+
+/* Leadtek Winfast TV USB II Deluxe remote
+   Magnus Alm <magnus.alm@gmail.com>
+ */
+static struct ir_scancode ir_codes_winfast_usbii_deluxe[] = {
+       { 0x62, KEY_0},
+       { 0x75, KEY_1},
+       { 0x76, KEY_2},
+       { 0x77, KEY_3},
+       { 0x79, KEY_4},
+       { 0x7a, KEY_5},
+       { 0x7b, KEY_6},
+       { 0x7d, KEY_7},
+       { 0x7e, KEY_8},
+       { 0x7f, KEY_9},
+
+       { 0x38, KEY_CAMERA},            /* SNAPSHOT */
+       { 0x37, KEY_RECORD},            /* RECORD */
+       { 0x35, KEY_TIME},              /* TIMESHIFT */
+
+       { 0x74, KEY_VOLUMEUP},          /* VOLUMEUP */
+       { 0x78, KEY_VOLUMEDOWN},        /* VOLUMEDOWN */
+       { 0x64, KEY_MUTE},              /* MUTE */
+
+       { 0x21, KEY_CHANNEL},           /* SURF */
+       { 0x7c, KEY_CHANNELUP},         /* CHANNELUP */
+       { 0x60, KEY_CHANNELDOWN},       /* CHANNELDOWN */
+       { 0x61, KEY_LAST},              /* LAST CHANNEL (RECALL) */
+
+       { 0x72, KEY_VIDEO},             /* INPUT MODES (TV/FM) */
+
+       { 0x70, KEY_POWER2},            /* TV ON/OFF */
+
+       { 0x39, KEY_CYCLEWINDOWS},      /* MINIMIZE (BOSS) */
+       { 0x3a, KEY_NEW},               /* PIP */
+       { 0x73, KEY_ZOOM},              /* FULLSECREEN */
+
+       { 0x66, KEY_INFO},              /* OSD (DISPLAY) */
+
+       { 0x31, KEY_DOT},               /* '.' */
+       { 0x63, KEY_ENTER},             /* ENTER */
+
+};
+struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table = {
+       .scan = ir_codes_winfast_usbii_deluxe,
+       .size = ARRAY_SIZE(ir_codes_winfast_usbii_deluxe),
+};
+EXPORT_SYMBOL_GPL(ir_codes_winfast_usbii_deluxe_table);
+
+/* Kworld 315U
+ */
+static struct ir_scancode ir_codes_kworld_315u[] = {
+       { 0x6143, KEY_POWER },
+       { 0x6101, KEY_TUNER },          /* source */
+       { 0x610b, KEY_ZOOM },
+       { 0x6103, KEY_POWER2 },         /* shutdown */
+
+       { 0x6104, KEY_1 },
+       { 0x6108, KEY_2 },
+       { 0x6102, KEY_3 },
+       { 0x6109, KEY_CHANNELUP },
+
+       { 0x610f, KEY_4 },
+       { 0x6105, KEY_5 },
+       { 0x6106, KEY_6 },
+       { 0x6107, KEY_CHANNELDOWN },
+
+       { 0x610c, KEY_7 },
+       { 0x610d, KEY_8 },
+       { 0x610a, KEY_9 },
+       { 0x610e, KEY_VOLUMEUP },
+
+       { 0x6110, KEY_LAST },
+       { 0x6111, KEY_0 },
+       { 0x6112, KEY_ENTER },
+       { 0x6113, KEY_VOLUMEDOWN },
+
+       { 0x6114, KEY_RECORD },
+       { 0x6115, KEY_STOP },
+       { 0x6116, KEY_PLAY },
+       { 0x6117, KEY_MUTE },
+
+       { 0x6118, KEY_UP },
+       { 0x6119, KEY_DOWN },
+       { 0x611a, KEY_LEFT },
+       { 0x611b, KEY_RIGHT },
+
+       { 0x611c, KEY_RED },
+       { 0x611d, KEY_GREEN },
+       { 0x611e, KEY_YELLOW },
+       { 0x611f, KEY_BLUE },
+};
+
+struct ir_scancode_table ir_codes_kworld_315u_table = {
+       .scan = ir_codes_kworld_315u,
+       .size = ARRAY_SIZE(ir_codes_kworld_315u),
+       .ir_type = IR_TYPE_NEC,
+};
+EXPORT_SYMBOL_GPL(ir_codes_kworld_315u_table);
index bff7a5356037bc6172cd21e95605572a92ed34b0..0903f539bf685a89027f6fc309a3703f4687a688 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 
-#include <linux/usb/input.h>
+#include <linux/input.h>
 #include <media/ir-common.h>
 
 #define IR_TAB_MIN_SIZE        32
@@ -65,7 +65,7 @@ exit:
  * In order to reduce the quantity of table resizes, it has a minimum
  * table size of IR_TAB_MIN_SIZE.
  */
-int ir_roundup_tablesize(int n_elems)
+static int ir_roundup_tablesize(int n_elems)
 {
        size_t size;
 
@@ -81,7 +81,6 @@ int ir_roundup_tablesize(int n_elems)
 
        return n_elems;
 }
-EXPORT_SYMBOL_GPL(ir_roundup_tablesize);
 
 /**
  * ir_copy_table() - copies a keytable, discarding the unused entries
@@ -89,9 +88,11 @@ EXPORT_SYMBOL_GPL(ir_roundup_tablesize);
  * @origin:    origin table
  *
  * Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED
+ * Also copies table size and table protocol.
+ * NOTE: It shouldn't copy the lock field
  */
 
-int ir_copy_table(struct ir_scancode_table *destin,
+static int ir_copy_table(struct ir_scancode_table *destin,
                 const struct ir_scancode_table *origin)
 {
        int i, j = 0;
@@ -105,12 +106,12 @@ int ir_copy_table(struct ir_scancode_table *destin,
                j++;
        }
        destin->size = j;
+       destin->ir_type = origin->ir_type;
 
        IR_dprintk(1, "Copied %d scancodes to the new keycode table\n", destin->size);
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(ir_copy_table);
 
 /**
  * ir_getkeycode() - get a keycode at the evdev scancode ->keycode table
@@ -184,18 +185,14 @@ static void ir_delete_key(struct ir_scancode_table *rc_tab, int elem)
        int newsize = rc_tab->size - 1;
        int resize = ir_is_resize_needed(rc_tab, newsize);
        struct ir_scancode *oldkeymap = rc_tab->scan;
-       struct ir_scancode *newkeymap;
+       struct ir_scancode *newkeymap = NULL;
 
-       if (resize) {
+       if (resize)
                newkeymap = kzalloc(ir_roundup_tablesize(newsize) *
                                    sizeof(*newkeymap), GFP_ATOMIC);
 
-               /* There's no memory for resize. Keep the old table */
-               if (!newkeymap)
-                       resize = 0;
-       }
-
-       if (!resize) {
+       /* There's no memory for resize. Keep the old table */
+       if (!resize || !newkeymap) {
                newkeymap = oldkeymap;
 
                /* We'll modify the live table. Lock it */
@@ -399,12 +396,14 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
  * @input_dev: the struct input_dev descriptor of the device
  * @rc_tab:    the struct ir_scancode_table table of scancode/keymap
  *
- * This routine is used to initialize the input infrastructure to work with
- * an IR.
- * It should be called before registering the IR device.
+ * This routine is used to initialize the input infrastructure
+ * to work with an IR.
+ * It will register the input/evdev interface for the device and
+ * register the syfs code for IR class
  */
 int ir_input_register(struct input_dev *input_dev,
-                     struct ir_scancode_table *rc_tab)
+                     const struct ir_scancode_table *rc_tab,
+                     const struct ir_dev_props *props)
 {
        struct ir_input_dev *ir_dev;
        struct ir_scancode  *keymap    = rc_tab->scan;
@@ -417,19 +416,22 @@ int ir_input_register(struct input_dev *input_dev,
        if (!ir_dev)
                return -ENOMEM;
 
-       spin_lock_init(&rc_tab->lock);
+       spin_lock_init(&ir_dev->rc_tab.lock);
 
        ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
        ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
                                    sizeof(struct ir_scancode), GFP_KERNEL);
-       if (!ir_dev->rc_tab.scan)
+       if (!ir_dev->rc_tab.scan) {
+               kfree(ir_dev);
                return -ENOMEM;
+       }
 
        IR_dprintk(1, "Allocated space for %d keycode entries (%zd bytes)\n",
                ir_dev->rc_tab.size,
                ir_dev->rc_tab.size * sizeof(ir_dev->rc_tab.scan));
 
        ir_copy_table(&ir_dev->rc_tab, rc_tab);
+       ir_dev->props = props;
 
        /* set the bits for the keys */
        IR_dprintk(1, "key map size: %d\n", rc_tab->size);
@@ -447,16 +449,31 @@ int ir_input_register(struct input_dev *input_dev,
        input_set_drvdata(input_dev, ir_dev);
 
        rc = input_register_device(input_dev);
+       if (rc < 0)
+               goto err;
+
+       rc = ir_register_class(input_dev);
        if (rc < 0) {
-               kfree(rc_tab->scan);
-               kfree(ir_dev);
-               input_set_drvdata(input_dev, NULL);
+               input_unregister_device(input_dev);
+               goto err;
        }
 
+       return 0;
+
+err:
+       kfree(rc_tab->scan);
+       kfree(ir_dev);
+       input_set_drvdata(input_dev, NULL);
        return rc;
 }
 EXPORT_SYMBOL_GPL(ir_input_register);
 
+/**
+ * ir_input_unregister() - unregisters IR and frees resources
+ * @input_dev: the struct input_dev descriptor of the device
+
+ * This routine is used to free memory and de-register interfaces.
+ */
 void ir_input_unregister(struct input_dev *dev)
 {
        struct ir_input_dev *ir_dev = input_get_drvdata(dev);
@@ -472,6 +489,8 @@ void ir_input_unregister(struct input_dev *dev)
        kfree(rc_tab->scan);
        rc_tab->scan = NULL;
 
+       ir_unregister_class(dev);
+
        kfree(ir_dev);
        input_unregister_device(dev);
 }
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
new file mode 100644 (file)
index 0000000..bf5fbcd
--- /dev/null
@@ -0,0 +1,211 @@
+/* ir-register.c - handle IR scancode->keycode tables
+ *
+ * Copyright (C) 2009 by Mauro Carvalho Chehab <mchehab@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 version 2 of the License.
+ *
+ *  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 <linux/input.h>
+#include <linux/device.h>
+#include <media/ir-core.h>
+
+#define IRRCV_NUM_DEVICES      256
+
+/* bit array to represent IR sysfs device number */
+static unsigned long ir_core_dev_number;
+
+/* class for /sys/class/irrcv */
+static struct class *ir_input_class;
+
+/**
+ * show_protocol() - shows the current IR protocol
+ * @d:         the device descriptor
+ * @mattr:     the device attribute struct (unused)
+ * @buf:       a pointer to the output buffer
+ *
+ * This routine is a callback routine for input read the IR protocol type.
+ * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol.
+ * It returns the protocol name, as understood by the driver.
+ */
+static ssize_t show_protocol(struct device *d,
+                            struct device_attribute *mattr, char *buf)
+{
+       char *s;
+       struct ir_input_dev *ir_dev = dev_get_drvdata(d);
+       u64 ir_type = ir_dev->rc_tab.ir_type;
+
+       IR_dprintk(1, "Current protocol is %lld\n", (long long)ir_type);
+
+       /* FIXME: doesn't support multiple protocols at the same time */
+       if (ir_type == IR_TYPE_UNKNOWN)
+               s = "Unknown";
+       else if (ir_type == IR_TYPE_RC5)
+               s = "RC-5";
+       else if (ir_type == IR_TYPE_PD)
+               s = "Pulse/distance";
+       else if (ir_type == IR_TYPE_NEC)
+               s = "NEC";
+       else
+               s = "Other";
+
+       return sprintf(buf, "%s\n", s);
+}
+
+/**
+ * store_protocol() - shows the current IR protocol
+ * @d:         the device descriptor
+ * @mattr:     the device attribute struct (unused)
+ * @buf:       a pointer to the input buffer
+ * @len:       length of the input buffer
+ *
+ * This routine is a callback routine for changing the IR protocol type.
+ * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol.
+ * It changes the IR the protocol name, if the IR type is recognized
+ * by the driver.
+ * If an unknown protocol name is used, returns -EINVAL.
+ */
+static ssize_t store_protocol(struct device *d,
+                             struct device_attribute *mattr,
+                             const char *data,
+                             size_t len)
+{
+       struct ir_input_dev *ir_dev = dev_get_drvdata(d);
+       u64 ir_type = IR_TYPE_UNKNOWN;
+       int rc = -EINVAL;
+       unsigned long flags;
+       char *buf;
+
+       buf = strsep((char **) &data, "\n");
+
+       if (!strcasecmp(buf, "rc-5"))
+               ir_type = IR_TYPE_RC5;
+       else if (!strcasecmp(buf, "pd"))
+               ir_type = IR_TYPE_PD;
+       else if (!strcasecmp(buf, "nec"))
+               ir_type = IR_TYPE_NEC;
+
+       if (ir_type == IR_TYPE_UNKNOWN) {
+               IR_dprintk(1, "Error setting protocol to %lld\n",
+                          (long long)ir_type);
+               return -EINVAL;
+       }
+
+       if (ir_dev->props && ir_dev->props->change_protocol)
+               rc = ir_dev->props->change_protocol(ir_dev->props->priv,
+                                                   ir_type);
+
+       if (rc < 0) {
+               IR_dprintk(1, "Error setting protocol to %lld\n",
+                          (long long)ir_type);
+               return -EINVAL;
+       }
+
+       spin_lock_irqsave(&ir_dev->rc_tab.lock, flags);
+       ir_dev->rc_tab.ir_type = ir_type;
+       spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
+
+       IR_dprintk(1, "Current protocol is %lld\n",
+                  (long long)ir_type);
+
+       return len;
+}
+
+/*
+ * Static device attribute struct with the sysfs attributes for IR's
+ */
+static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
+                  show_protocol, store_protocol);
+
+static struct attribute *ir_dev_attrs[] = {
+       &dev_attr_current_protocol.attr,
+       NULL,
+};
+
+/**
+ * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv?
+ * @input_dev: the struct input_dev descriptor of the device
+ *
+ * This routine is used to register the syfs code for IR class
+ */
+int ir_register_class(struct input_dev *input_dev)
+{
+       int rc;
+       struct kobject *kobj;
+
+       struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
+       int devno = find_first_zero_bit(&ir_core_dev_number,
+                                       IRRCV_NUM_DEVICES);
+
+       if (unlikely(devno < 0))
+               return devno;
+
+       ir_dev->attr.attrs = ir_dev_attrs;
+       ir_dev->class_dev = device_create(ir_input_class, NULL,
+                                         input_dev->dev.devt, ir_dev,
+                                         "irrcv%d", devno);
+       kobj = &ir_dev->class_dev->kobj;
+
+       printk(KERN_WARNING "Creating IR device %s\n", kobject_name(kobj));
+       rc = sysfs_create_group(kobj, &ir_dev->attr);
+       if (unlikely(rc < 0)) {
+               device_destroy(ir_input_class, input_dev->dev.devt);
+               return -ENOMEM;
+       }
+
+       ir_dev->devno = devno;
+       set_bit(devno, &ir_core_dev_number);
+
+       return 0;
+};
+
+/**
+ * ir_unregister_class() - removes the sysfs for sysfs for
+ *                        /sys/class/irrcv/irrcv?
+ * @input_dev: the struct input_dev descriptor of the device
+ *
+ * This routine is used to unregister the syfs code for IR class
+ */
+void ir_unregister_class(struct input_dev *input_dev)
+{
+       struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
+       struct kobject *kobj;
+
+       clear_bit(ir_dev->devno, &ir_core_dev_number);
+
+       kobj = &ir_dev->class_dev->kobj;
+
+       sysfs_remove_group(kobj, &ir_dev->attr);
+       device_destroy(ir_input_class, input_dev->dev.devt);
+
+       kfree(ir_dev->attr.name);
+}
+
+/*
+ * Init/exit code for the module. Basically, creates/removes /sys/class/irrcv
+ */
+
+static int __init ir_core_init(void)
+{
+       ir_input_class = class_create(THIS_MODULE, "irrcv");
+       if (IS_ERR(ir_input_class)) {
+               printk(KERN_ERR "ir_core: unable to register irrcv class\n");
+               return PTR_ERR(ir_input_class);
+       }
+
+       return 0;
+}
+
+static void __exit ir_core_exit(void)
+{
+       class_destroy(ir_input_class);
+}
+
+module_init(ir_core_init);
+module_exit(ir_core_exit);
index 7364b9642d005c0579838c4efdf7c61888767f98..fd8e1f45be369343e2e7973de54fe5f0faef5dad 100644 (file)
@@ -423,14 +423,15 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)
        }
 }
 
+int saa7146_vv_devinit(struct saa7146_dev *dev)
+{
+       return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
+}
+EXPORT_SYMBOL_GPL(saa7146_vv_devinit);
+
 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
 {
        struct saa7146_vv *vv;
-       int err;
-
-       err = v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
-       if (err)
-               return err;
 
        vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
        if (vv == NULL) {
index becbaadb3b7748eb616ec18e997bc767c68e3312..5ed75263340a91c966cdf58f0a4390efeeab3fd8 100644 (file)
@@ -1333,9 +1333,9 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
 
        DEB_CAP(("vbuf:%p\n",vb));
 
-       release_all_pagetables(dev, buf);
-
        saa7146_dma_free(dev,q,buf);
+
+       release_all_pagetables(dev, buf);
 }
 
 static struct videobuf_queue_ops video_qops = {
index c190b0dedee47851ada5e30e25d93031c3a586a3..2833137fa8195bdc41c8337267bcbee81168082a 100644 (file)
@@ -144,7 +144,8 @@ static void set_audio(struct dvb_frontend *fe,
        }
 
        if (params->mode == V4L2_TUNER_RADIO) {
-               priv->tda8290_easy_mode = 0x01;         /* Start with MN values */
+               /* Set TDA8295 to FM radio; Start TDA8290 with MN values */
+               priv->tda8290_easy_mode = (priv->ver & TDA8295) ? 0x80 : 0x01;
                tuner_dbg("setting to radio FM\n");
        } else {
                tuner_dbg("setting tda829x to system %s\n", mode);
@@ -672,16 +673,19 @@ static int tda8290_probe(struct tuner_i2c_props *i2c_props)
 static int tda8295_probe(struct tuner_i2c_props *i2c_props)
 {
 #define TDA8295_ID 0x8a
+#define TDA8295C2_ID 0x8b
        unsigned char tda8295_id[] = { 0x2f, 0x00 };
 
        /* detect tda8295 */
        tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1);
        tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1);
 
-       if (tda8295_id[1] == TDA8295_ID) {
+       if ((tda8295_id[1] & 0xfe) == TDA8295_ID) {
                if (debug)
-                       printk(KERN_DEBUG "%s: tda8295 detected @ %d-%04x\n",
-                              __func__, i2c_adapter_id(i2c_props->adap),
+                       printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n",
+                              __func__, (tda8295_id[1] == TDA8295_ID) ?
+                              "tda8295c1" : "tda8295c2",
+                              i2c_adapter_id(i2c_props->adap),
                               i2c_props->addr);
                return 0;
        }
index 2b876f3988c1f2a256525c7a0313b35466e6549e..d9aaaca620c9661951b9ab87a95e5e1c76767e44 100644 (file)
@@ -1337,6 +1337,22 @@ static struct tuner_params tuner_philips_cu1216l_params[] = {
        },
 };
 
+/* ---------------------- TUNER_SONY_BTF_PXN01Z ------------------------ */
+
+static struct tuner_range tuner_sony_btf_pxn01z_ranges[] = {
+       { 16 * 137.25 /*MHz*/, 0x8e, 0x01, },
+       { 16 * 367.25 /*MHz*/, 0x8e, 0x02, },
+       { 16 * 999.99        , 0x8e, 0x04, },
+};
+
+static struct tuner_params tuner_sony_btf_pxn01z_params[] = {
+       {
+               .type   = TUNER_PARAM_TYPE_NTSC,
+               .ranges = tuner_sony_btf_pxn01z_ranges,
+               .count  = ARRAY_SIZE(tuner_sony_btf_pxn01z_ranges),
+       },
+};
+
 /* --------------------------------------------------------------------- */
 
 struct tunertype tuners[] = {
@@ -1805,6 +1821,11 @@ struct tunertype tuners[] = {
                .name   = "NXP TDA18271",
                /* see tda18271-fe.c for details */
        },
+       [TUNER_SONY_BTF_PXN01Z] = {
+               .name   = "Sony BTF-Pxn01Z",
+               .params = tuner_sony_btf_pxn01z_params,
+               .count  = ARRAY_SIZE(tuner_sony_btf_pxn01z_params),
+       },
 };
 EXPORT_SYMBOL(tuners);
 
index f270e605da8328a728f3c844fbd88d74bcfa0d4d..be51c294b375b5a17a33d8a48e2ab3b4db88e923 100644 (file)
@@ -917,30 +917,68 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
         * that xc2028 will be in a safe state.
         * Maybe this might also be needed for DTV.
         */
-       if (new_mode == T_ANALOG_TV)
+       if (new_mode == T_ANALOG_TV) {
                rc = send_seq(priv, {0x00, 0x00});
 
-       /*
-        * Digital modes require an offset to adjust to the
-        * proper frequency.
-        * Analog modes require offset = 0
-        */
-       if (new_mode == T_DIGITAL_TV) {
-               /* Sets the offset according with firmware */
+               /* Analog modes require offset = 0 */
+       } else {
+               /*
+                * Digital modes require an offset to adjust to the
+                * proper frequency. The offset depends on what
+                * firmware version is used.
+                */
+
+               /*
+                * Adjust to the center frequency. This is calculated by the
+                * formula: offset = 1.25MHz - BW/2
+                * For DTV 7/8, the firmware uses BW = 8000, so it needs a
+                * further adjustment to get the frequency center on VHF
+                */
                if (priv->cur_fw.type & DTV6)
                        offset = 1750000;
                else if (priv->cur_fw.type & DTV7)
                        offset = 2250000;
                else    /* DTV8 or DTV78 */
                        offset = 2750000;
+               if ((priv->cur_fw.type & DTV78) && freq < 470000000)
+                       offset -= 500000;
 
                /*
-                * We must adjust the offset by 500kHz  when
-                * tuning a 7MHz VHF channel with DTV78 firmware
-                * (used in Australia, Italy and Germany)
+                * xc3028 additional "magic"
+                * Depending on the firmware version, it needs some adjustments
+                * to properly centralize the frequency. This seems to be
+                * needed to compensate the SCODE table adjustments made by
+                * newer firmwares
                 */
-               if ((priv->cur_fw.type & DTV78) && freq < 470000000)
-                       offset -= 500000;
+
+#if 1
+               /*
+                * The proper adjustment would be to do it at s-code table.
+                * However, this didn't work, as reported by
+                * Robert Lowery <rglowery@exemail.com.au>
+                */
+
+               if (priv->cur_fw.type & DTV7)
+                       offset += 500000;
+
+#else
+               /*
+                * Still need tests for XC3028L (firmware 3.2 or upper)
+                * So, for now, let's just comment the per-firmware
+                * version of this change. Reports with xc3028l working
+                * with and without the lines bellow are welcome
+                */
+
+               if (priv->firm_version < 0x0302) {
+                       if (priv->cur_fw.type & DTV7)
+                               offset += 500000;
+               } else {
+                       if (priv->cur_fw.type & DTV7)
+                               offset -= 300000;
+                       else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 */
+                               offset += 200000;
+               }
+#endif
        }
 
        div = (freq - offset + DIV / 2) / DIV;
@@ -1097,17 +1135,24 @@ static int xc2028_set_params(struct dvb_frontend *fe,
 
        /* All S-code tables need a 200kHz shift */
        if (priv->ctrl.demod) {
-               demod = priv->ctrl.demod + 200;
+               demod = priv->ctrl.demod;
+
+               /*
+                * Newer firmwares require a 200 kHz offset only for ATSC
+                */
+               if (type == ATSC || priv->firm_version < 0x0302)
+                       demod += 200;
                /*
                 * The DTV7 S-code table needs a 700 kHz shift.
-                * Thanks to Terry Wu <terrywu2009@gmail.com> for reporting this
                 *
                 * DTV7 is only used in Australia.  Germany or Italy may also
                 * use this firmware after initialization, but a tune to a UHF
                 * channel should then cause DTV78 to be used.
+                *
+                * Unfortunately, on real-field tests, the s-code offset
+                * didn't work as expected, as reported by
+                * Robert Lowery <rglowery@exemail.com.au>
                 */
-               if (type & DTV7)
-                       demod += 500;
        }
 
        return generic_set_freq(fe, p->frequency,
index 35d0817126e9fc65a67aa20ca5f2490e30a7dc70..161ccfd471cb3703db631b8e7abd20eb2abc83ae 100644 (file)
@@ -72,6 +72,14 @@ comment "Supported Earthsoft PT1 Adapters"
        depends on DVB_CORE && PCI && I2C
 source "drivers/media/dvb/pt1/Kconfig"
 
+comment "Supported Mantis Adapters"
+       depends on DVB_CORE && PCI && I2C
+       source "drivers/media/dvb/mantis/Kconfig"
+
+comment "Supported nGene Adapters"
+       depends on DVB_CORE && PCI && I2C
+       source "drivers/media/dvb/ngene/Kconfig"
+
 comment "Supported DVB Frontends"
        depends on DVB_CORE
 source "drivers/media/dvb/frontends/Kconfig"
index 16d262ddb45d1bce7b4e2402d896187e053490a8..a1a08758a6f28122439381cf7f19eb5daa028029 100644 (file)
@@ -2,6 +2,19 @@
 # Makefile for the kernel multimedia device drivers.
 #
 
-obj-y        := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/ pt1/
+obj-y        := dvb-core/      \
+               frontends/      \
+               ttpci/          \
+               ttusb-dec/      \
+               ttusb-budget/   \
+               b2c2/           \
+               bt8xx/          \
+               dvb-usb/        \
+               pluto2/         \
+               siano/          \
+               dm1105/         \
+               pt1/            \
+               mantis/         \
+               ngene/
 
 obj-$(CONFIG_DVB_FIREDTV)      += firewire/
index a24c125331f0adbed30e1f9a289661483741f57b..99d62094f90865cf7e502d33bcffaa9f5567d278 100644 (file)
@@ -576,43 +576,30 @@ static struct pci_driver bt878_pci_driver = {
       .remove  = __devexit_p(bt878_remove),
 };
 
-static int bt878_pci_driver_registered;
-
 /*******************************/
 /* Module management functions */
 /*******************************/
 
-static int bt878_init_module(void)
+static int __init bt878_init_module(void)
 {
        bt878_num = 0;
-       bt878_pci_driver_registered = 0;
 
        printk(KERN_INFO "bt878: AUDIO driver version %d.%d.%d loaded\n",
               (BT878_VERSION_CODE >> 16) & 0xff,
               (BT878_VERSION_CODE >> 8) & 0xff,
               BT878_VERSION_CODE & 0xff);
-/*
-       bt878_check_chipset();
-*/
-       /* later we register inside of bt878_find_audio_dma()
-        * because we may want to ignore certain cards */
-       bt878_pci_driver_registered = 1;
+
        return pci_register_driver(&bt878_pci_driver);
 }
 
-static void bt878_cleanup_module(void)
+static void __exit bt878_cleanup_module(void)
 {
-       if (bt878_pci_driver_registered) {
-               bt878_pci_driver_registered = 0;
-               pci_unregister_driver(&bt878_pci_driver);
-       }
-       return;
+       pci_unregister_driver(&bt878_pci_driver);
 }
 
 module_init(bt878_init_module);
 module_exit(bt878_cleanup_module);
 
-//MODULE_AUTHOR("XXX");
 MODULE_LICENSE("GPL");
 
 /*
index 91353a6faf1d253d5cbd13c9fdba5e01b49481d6..8b0cde38984ded9aa6cf73bad9eba48c62842280 100644 (file)
@@ -1352,8 +1352,7 @@ static int dst_get_tuna(struct dst_state *state)
                return retval;
        }
        if ((state->type_flags & DST_TYPE_HAS_VLF) &&
-               !(state->dst_type == DST_TYPE_IS_CABLE) &&
-               !(state->dst_type == DST_TYPE_IS_ATSC)) {
+          !(state->dst_type == DST_TYPE_IS_ATSC)) {
 
                if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) {
                        dprintk(verbose, DST_INFO, 1, "checksum failure ? ");
@@ -1820,8 +1819,13 @@ static struct dvb_frontend_ops dst_dvbc_ops = {
                .frequency_max = 858000000,
                .symbol_rate_min = 1000000,
                .symbol_rate_max = 45000000,
-       /*     . symbol_rate_tolerance  =       ???,*/
-               .caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO
+               .caps = FE_CAN_FEC_AUTO |
+                       FE_CAN_QAM_AUTO |
+                       FE_CAN_QAM_16   |
+                       FE_CAN_QAM_32   |
+                       FE_CAN_QAM_64   |
+                       FE_CAN_QAM_128  |
+                       FE_CAN_QAM_256
        },
 
        .release = dst_release,
index de3eeb0a8d6e2e0f45db95b8a4d9068b3a70f8fb..695239227cb784a0e9011a6f019cef1eb9a638e8 100644 (file)
@@ -8,6 +8,7 @@ config DVB_DM1105
        select DVB_STB6000 if !DVB_FE_CUSTOMISE
        select DVB_CX24116 if !DVB_FE_CUSTOMISE
        select DVB_SI21XX if !DVB_FE_CUSTOMISE
+       select DVB_DS3000 if !DVB_FE_CUSTOMISE
        select VIDEO_IR
        help
          Support for cards based on the SDMC DM1105 PCI chip like
index f0f483ac8b891760d822f7081eae139f0f45bad4..383cca378b8c5bb38e8b5935a013405c0bcac315 100644 (file)
@@ -43,6 +43,7 @@
 #include "si21xx.h"
 #include "cx24116.h"
 #include "z0194a.h"
+#include "ds3000.h"
 
 #define UNSET (-1U)
 
@@ -269,7 +270,7 @@ struct infrared {
        u32                     ir_command;
 };
 
-struct dm1105dvb {
+struct dm1105_dev {
        /* pci */
        struct pci_dev *pdev;
        u8 __iomem *io_mem;
@@ -308,31 +309,47 @@ struct dm1105dvb {
        spinlock_t lock;
 };
 
-#define dm_io_mem(reg) ((unsigned long)(&dm1105dvb->io_mem[reg]))
+#define dm_io_mem(reg) ((unsigned long)(&dev->io_mem[reg]))
+
+#define dm_readb(reg)          inb(dm_io_mem(reg))
+#define dm_writeb(reg, value)  outb((value), (dm_io_mem(reg)))
+
+#define dm_readw(reg)          inw(dm_io_mem(reg))
+#define dm_writew(reg, value)  outw((value), (dm_io_mem(reg)))
+
+#define dm_readl(reg)          inl(dm_io_mem(reg))
+#define dm_writel(reg, value)  outl((value), (dm_io_mem(reg)))
+
+#define dm_andorl(reg, mask, value) \
+       outl((inl(dm_io_mem(reg)) & ~(mask)) |\
+               ((value) & (mask)), (dm_io_mem(reg)))
+
+#define dm_setl(reg, bit)      dm_andorl((reg), (bit), (bit))
+#define dm_clearl(reg, bit)    dm_andorl((reg), (bit), 0)
 
 static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap,
                            struct i2c_msg *msgs, int num)
 {
-       struct dm1105dvb *dm1105dvb ;
+       struct dm1105_dev *dev ;
 
        int addr, rc, i, j, k, len, byte, data;
        u8 status;
 
-       dm1105dvb = i2c_adap->algo_data;
+       dev = i2c_adap->algo_data;
        for (i = 0; i < num; i++) {
-               outb(0x00, dm_io_mem(DM1105_I2CCTR));
+               dm_writeb(DM1105_I2CCTR, 0x00);
                if (msgs[i].flags & I2C_M_RD) {
                        /* read bytes */
                        addr  = msgs[i].addr << 1;
                        addr |= 1;
-                       outb(addr, dm_io_mem(DM1105_I2CDAT));
+                       dm_writeb(DM1105_I2CDAT, addr);
                        for (byte = 0; byte < msgs[i].len; byte++)
-                               outb(0, dm_io_mem(DM1105_I2CDAT + byte + 1));
+                               dm_writeb(DM1105_I2CDAT + byte + 1, 0);
 
-                       outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR));
+                       dm_writeb(DM1105_I2CCTR, 0x81 + msgs[i].len);
                        for (j = 0; j < 55; j++) {
                                mdelay(10);
-                               status = inb(dm_io_mem(DM1105_I2CSTS));
+                               status = dm_readb(DM1105_I2CSTS);
                                if ((status & 0xc0) == 0x40)
                                        break;
                        }
@@ -340,56 +357,54 @@ static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap,
                                return -1;
 
                        for (byte = 0; byte < msgs[i].len; byte++) {
-                               rc = inb(dm_io_mem(DM1105_I2CDAT + byte + 1));
+                               rc = dm_readb(DM1105_I2CDAT + byte + 1);
                                if (rc < 0)
                                        goto err;
                                msgs[i].buf[byte] = rc;
                        }
-               } else {
-                       if ((msgs[i].buf[0] == 0xf7) && (msgs[i].addr == 0x55)) {
-                               /* prepaired for cx24116 firmware */
-                               /* Write in small blocks */
-                               len = msgs[i].len - 1;
-                               k = 1;
-                               do {
-                                       outb(msgs[i].addr << 1, dm_io_mem(DM1105_I2CDAT));
-                                       outb(0xf7, dm_io_mem(DM1105_I2CDAT + 1));
-                                       for (byte = 0; byte < (len > 48 ? 48 : len); byte++) {
-                                               data = msgs[i].buf[k+byte];
-                                               outb(data, dm_io_mem(DM1105_I2CDAT + byte + 2));
-                                       }
-                                       outb(0x82 + (len > 48 ? 48 : len), dm_io_mem(DM1105_I2CCTR));
-                                       for (j = 0; j < 25; j++) {
-                                               mdelay(10);
-                                               status = inb(dm_io_mem(DM1105_I2CSTS));
-                                               if ((status & 0xc0) == 0x40)
-                                                       break;
-                                       }
-
-                                       if (j >= 25)
-                                               return -1;
-
-                                       k += 48;
-                                       len -= 48;
-                               } while (len > 0);
-                       } else {
-                               /* write bytes */
-                               outb(msgs[i].addr<<1, dm_io_mem(DM1105_I2CDAT));
-                               for (byte = 0; byte < msgs[i].len; byte++) {
-                                       data = msgs[i].buf[byte];
-                                       outb(data, dm_io_mem(DM1105_I2CDAT + byte + 1));
+               } else if ((msgs[i].buf[0] == 0xf7) && (msgs[i].addr == 0x55)) {
+                       /* prepaired for cx24116 firmware */
+                       /* Write in small blocks */
+                       len = msgs[i].len - 1;
+                       k = 1;
+                       do {
+                               dm_writeb(DM1105_I2CDAT, msgs[i].addr << 1);
+                               dm_writeb(DM1105_I2CDAT + 1, 0xf7);
+                               for (byte = 0; byte < (len > 48 ? 48 : len); byte++) {
+                                       data = msgs[i].buf[k + byte];
+                                       dm_writeb(DM1105_I2CDAT + byte + 2, data);
                                }
-                               outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR));
+                               dm_writeb(DM1105_I2CCTR, 0x82 + (len > 48 ? 48 : len));
                                for (j = 0; j < 25; j++) {
                                        mdelay(10);
-                                       status = inb(dm_io_mem(DM1105_I2CSTS));
+                                       status = dm_readb(DM1105_I2CSTS);
                                        if ((status & 0xc0) == 0x40)
                                                break;
                                }
 
                                if (j >= 25)
                                        return -1;
+
+                               k += 48;
+                               len -= 48;
+                       } while (len > 0);
+               } else {
+                       /* write bytes */
+                       dm_writeb(DM1105_I2CDAT, msgs[i].addr << 1);
+                       for (byte = 0; byte < msgs[i].len; byte++) {
+                               data = msgs[i].buf[byte];
+                               dm_writeb(DM1105_I2CDAT + byte + 1, data);
                        }
+                       dm_writeb(DM1105_I2CCTR, 0x81 + msgs[i].len);
+                       for (j = 0; j < 25; j++) {
+                               mdelay(10);
+                               status = dm_readb(DM1105_I2CSTS);
+                               if ((status & 0xc0) == 0x40)
+                                       break;
+                       }
+
+                       if (j >= 25)
+                               return -1;
                }
        }
        return num;
@@ -407,22 +422,22 @@ static struct i2c_algorithm dm1105_algo = {
        .functionality = functionality,
 };
 
-static inline struct dm1105dvb *feed_to_dm1105dvb(struct dvb_demux_feed *feed)
+static inline struct dm1105_dev *feed_to_dm1105_dev(struct dvb_demux_feed *feed)
 {
-       return container_of(feed->demux, struct dm1105dvb, demux);
+       return container_of(feed->demux, struct dm1105_dev, demux);
 }
 
-static inline struct dm1105dvb *frontend_to_dm1105dvb(struct dvb_frontend *fe)
+static inline struct dm1105_dev *frontend_to_dm1105_dev(struct dvb_frontend *fe)
 {
-       return container_of(fe->dvb, struct dm1105dvb, dvb_adapter);
+       return container_of(fe->dvb, struct dm1105_dev, dvb_adapter);
 }
 
-static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+static int dm1105_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
 {
-       struct dm1105dvb *dm1105dvb = frontend_to_dm1105dvb(fe);
+       struct dm1105_dev *dev = frontend_to_dm1105_dev(fe);
        u32 lnb_mask, lnb_13v, lnb_18v, lnb_off;
 
-       switch (dm1105dvb->boardnr) {
+       switch (dev->boardnr) {
        case DM1105_BOARD_AXESS_DM05:
                lnb_mask = DM05_LNB_MASK;
                lnb_off = DM05_LNB_OFF;
@@ -438,62 +453,67 @@ static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t volta
                lnb_18v = DM1105_LNB_18V;
        }
 
-       outl(lnb_mask, dm_io_mem(DM1105_GPIOCTR));
+       dm_writel(DM1105_GPIOCTR, lnb_mask);
        if (voltage == SEC_VOLTAGE_18)
-               outl(lnb_18v , dm_io_mem(DM1105_GPIOVAL));
+               dm_writel(DM1105_GPIOVAL, lnb_18v);
        else if (voltage == SEC_VOLTAGE_13)
-               outl(lnb_13v, dm_io_mem(DM1105_GPIOVAL));
+               dm_writel(DM1105_GPIOVAL, lnb_13v);
        else
-               outl(lnb_off, dm_io_mem(DM1105_GPIOVAL));
+               dm_writel(DM1105_GPIOVAL, lnb_off);
 
        return 0;
 }
 
-static void dm1105dvb_set_dma_addr(struct dm1105dvb *dm1105dvb)
+static void dm1105_set_dma_addr(struct dm1105_dev *dev)
 {
-       outl(cpu_to_le32(dm1105dvb->dma_addr), dm_io_mem(DM1105_STADR));
+       dm_writel(DM1105_STADR, cpu_to_le32(dev->dma_addr));
 }
 
-static int __devinit dm1105dvb_dma_map(struct dm1105dvb *dm1105dvb)
+static int __devinit dm1105_dma_map(struct dm1105_dev *dev)
 {
-       dm1105dvb->ts_buf = pci_alloc_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, &dm1105dvb->dma_addr);
+       dev->ts_buf = pci_alloc_consistent(dev->pdev,
+                                       6 * DM1105_DMA_BYTES,
+                                       &dev->dma_addr);
 
-       return !dm1105dvb->ts_buf;
+       return !dev->ts_buf;
 }
 
-static void dm1105dvb_dma_unmap(struct dm1105dvb *dm1105dvb)
+static void dm1105_dma_unmap(struct dm1105_dev *dev)
 {
-       pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr);
+       pci_free_consistent(dev->pdev,
+                       6 * DM1105_DMA_BYTES,
+                       dev->ts_buf,
+                       dev->dma_addr);
 }
 
-static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
+static void dm1105_enable_irqs(struct dm1105_dev *dev)
 {
-       outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK));
-       outb(1, dm_io_mem(DM1105_CR));
+       dm_writeb(DM1105_INTMAK, INTMAK_ALLMASK);
+       dm_writeb(DM1105_CR, 1);
 }
 
-static void dm1105dvb_disable_irqs(struct dm1105dvb *dm1105dvb)
+static void dm1105_disable_irqs(struct dm1105_dev *dev)
 {
-       outb(INTMAK_IRM, dm_io_mem(DM1105_INTMAK));
-       outb(0, dm_io_mem(DM1105_CR));
+       dm_writeb(DM1105_INTMAK, INTMAK_IRM);
+       dm_writeb(DM1105_CR, 0);
 }
 
-static int dm1105dvb_start_feed(struct dvb_demux_feed *f)
+static int dm1105_start_feed(struct dvb_demux_feed *f)
 {
-       struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
+       struct dm1105_dev *dev = feed_to_dm1105_dev(f);
 
-       if (dm1105dvb->full_ts_users++ == 0)
-               dm1105dvb_enable_irqs(dm1105dvb);
+       if (dev->full_ts_users++ == 0)
+               dm1105_enable_irqs(dev);
 
        return 0;
 }
 
-static int dm1105dvb_stop_feed(struct dvb_demux_feed *f)
+static int dm1105_stop_feed(struct dvb_demux_feed *f)
 {
-       struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
+       struct dm1105_dev *dev = feed_to_dm1105_dev(f);
 
-       if (--dm1105dvb->full_ts_users == 0)
-               dm1105dvb_disable_irqs(dm1105dvb);
+       if (--dev->full_ts_users == 0)
+               dm1105_disable_irqs(dev);
 
        return 0;
 }
@@ -517,68 +537,64 @@ static void dm1105_emit_key(struct work_struct *work)
 /* work handler */
 static void dm1105_dmx_buffer(struct work_struct *work)
 {
-       struct dm1105dvb *dm1105dvb =
-                               container_of(work, struct dm1105dvb, work);
+       struct dm1105_dev *dev = container_of(work, struct dm1105_dev, work);
        unsigned int nbpackets;
-       u32 oldwrp = dm1105dvb->wrp;
-       u32 nextwrp = dm1105dvb->nextwrp;
+       u32 oldwrp = dev->wrp;
+       u32 nextwrp = dev->nextwrp;
 
-       if (!((dm1105dvb->ts_buf[oldwrp] == 0x47) &&
-                       (dm1105dvb->ts_buf[oldwrp + 188] == 0x47) &&
-                       (dm1105dvb->ts_buf[oldwrp + 188 * 2] == 0x47))) {
-               dm1105dvb->PacketErrorCount++;
+       if (!((dev->ts_buf[oldwrp] == 0x47) &&
+                       (dev->ts_buf[oldwrp + 188] == 0x47) &&
+                       (dev->ts_buf[oldwrp + 188 * 2] == 0x47))) {
+               dev->PacketErrorCount++;
                /* bad packet found */
-               if ((dm1105dvb->PacketErrorCount >= 2) &&
-                               (dm1105dvb->dmarst == 0)) {
-                       outb(1, dm_io_mem(DM1105_RST));
-                       dm1105dvb->wrp = 0;
-                       dm1105dvb->PacketErrorCount = 0;
-                       dm1105dvb->dmarst = 0;
+               if ((dev->PacketErrorCount >= 2) &&
+                               (dev->dmarst == 0)) {
+                       dm_writeb(DM1105_RST, 1);
+                       dev->wrp = 0;
+                       dev->PacketErrorCount = 0;
+                       dev->dmarst = 0;
                        return;
                }
        }
 
        if (nextwrp < oldwrp) {
-               memcpy(dm1105dvb->ts_buf + dm1105dvb->buffer_size,
-                                               dm1105dvb->ts_buf, nextwrp);
-               nbpackets = ((dm1105dvb->buffer_size - oldwrp) + nextwrp) / 188;
+               memcpy(dev->ts_buf + dev->buffer_size, dev->ts_buf, nextwrp);
+               nbpackets = ((dev->buffer_size - oldwrp) + nextwrp) / 188;
        } else
                nbpackets = (nextwrp - oldwrp) / 188;
 
-       dm1105dvb->wrp = nextwrp;
-       dvb_dmx_swfilter_packets(&dm1105dvb->demux,
-                                       &dm1105dvb->ts_buf[oldwrp], nbpackets);
+       dev->wrp = nextwrp;
+       dvb_dmx_swfilter_packets(&dev->demux, &dev->ts_buf[oldwrp], nbpackets);
 }
 
-static irqreturn_t dm1105dvb_irq(int irq, void *dev_id)
+static irqreturn_t dm1105_irq(int irq, void *dev_id)
 {
-       struct dm1105dvb *dm1105dvb = dev_id;
+       struct dm1105_dev *dev = dev_id;
 
        /* Read-Write INSTS Ack's Interrupt for DM1105 chip 16.03.2008 */
-       unsigned int intsts = inb(dm_io_mem(DM1105_INTSTS));
-       outb(intsts, dm_io_mem(DM1105_INTSTS));
+       unsigned int intsts = dm_readb(DM1105_INTSTS);
+       dm_writeb(DM1105_INTSTS, intsts);
 
        switch (intsts) {
        case INTSTS_TSIRQ:
        case (INTSTS_TSIRQ | INTSTS_IR):
-               dm1105dvb->nextwrp = inl(dm_io_mem(DM1105_WRP)) -
-                                       inl(dm_io_mem(DM1105_STADR));
-               queue_work(dm1105dvb->wq, &dm1105dvb->work);
+               dev->nextwrp = dm_readl(DM1105_WRP) - dm_readl(DM1105_STADR);
+               queue_work(dev->wq, &dev->work);
                break;
        case INTSTS_IR:
-               dm1105dvb->ir.ir_command = inl(dm_io_mem(DM1105_IRCODE));
-               schedule_work(&dm1105dvb->ir.work);
+               dev->ir.ir_command = dm_readl(DM1105_IRCODE);
+               schedule_work(&dev->ir.work);
                break;
        }
 
        return IRQ_HANDLED;
 }
 
-int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
+int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)
 {
        struct input_dev *input_dev;
        struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
-       int ir_type = IR_TYPE_OTHER;
+       u64 ir_type = IR_TYPE_OTHER;
        int err = -ENOMEM;
 
        input_dev = input_allocate_device();
@@ -611,51 +627,51 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
 
        INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
 
-       err = ir_input_register(input_dev, ir_codes);
+       err = ir_input_register(input_dev, ir_codes, NULL);
 
        return err;
 }
 
-void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105)
+void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105)
 {
        ir_input_unregister(dm1105->ir.input_dev);
 }
 
-static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb)
+static int __devinit dm1105_hw_init(struct dm1105_dev *dev)
 {
-       dm1105dvb_disable_irqs(dm1105dvb);
+       dm1105_disable_irqs(dev);
 
-       outb(0, dm_io_mem(DM1105_HOST_CTR));
+       dm_writeb(DM1105_HOST_CTR, 0);
 
        /*DATALEN 188,*/
-       outb(188, dm_io_mem(DM1105_DTALENTH));
+       dm_writeb(DM1105_DTALENTH, 188);
        /*TS_STRT TS_VALP MSBFIRST TS_MODE ALPAS TSPES*/
-       outw(0xc10a, dm_io_mem(DM1105_TSCTR));
+       dm_writew(DM1105_TSCTR, 0xc10a);
 
        /* map DMA and set address */
-       dm1105dvb_dma_map(dm1105dvb);
-       dm1105dvb_set_dma_addr(dm1105dvb);
+       dm1105_dma_map(dev);
+       dm1105_set_dma_addr(dev);
        /* big buffer */
-       outl(5*DM1105_DMA_BYTES, dm_io_mem(DM1105_RLEN));
-       outb(47, dm_io_mem(DM1105_INTCNT));
+       dm_writel(DM1105_RLEN, 5 * DM1105_DMA_BYTES);
+       dm_writeb(DM1105_INTCNT, 47);
 
        /* IR NEC mode enable */
-       outb((DM1105_IR_EN | DM1105_SYS_CHK), dm_io_mem(DM1105_IRCTR));
-       outb(0, dm_io_mem(DM1105_IRMODE));
-       outw(0, dm_io_mem(DM1105_SYSTEMCODE));
+       dm_writeb(DM1105_IRCTR, (DM1105_IR_EN | DM1105_SYS_CHK));
+       dm_writeb(DM1105_IRMODE, 0);
+       dm_writew(DM1105_SYSTEMCODE, 0);
 
        return 0;
 }
 
-static void dm1105dvb_hw_exit(struct dm1105dvb *dm1105dvb)
+static void dm1105_hw_exit(struct dm1105_dev *dev)
 {
-       dm1105dvb_disable_irqs(dm1105dvb);
+       dm1105_disable_irqs(dev);
 
        /* IR disable */
-       outb(0, dm_io_mem(DM1105_IRCTR));
-       outb(INTMAK_NONEMASK, dm_io_mem(DM1105_INTMAK));
+       dm_writeb(DM1105_IRCTR, 0);
+       dm_writeb(DM1105_INTMAK, INTMAK_NONEMASK);
 
-       dm1105dvb_dma_unmap(dm1105dvb);
+       dm1105_dma_unmap(dev);
 }
 
 static struct stv0299_config sharp_z0194a_config = {
@@ -685,70 +701,79 @@ static struct cx24116_config serit_sp2633_config = {
        .demod_address = 0x55,
 };
 
-static int __devinit frontend_init(struct dm1105dvb *dm1105dvb)
+static struct ds3000_config dvbworld_ds3000_config = {
+       .demod_address = 0x68,
+};
+
+static int __devinit frontend_init(struct dm1105_dev *dev)
 {
        int ret;
 
-       switch (dm1105dvb->boardnr) {
+       switch (dev->boardnr) {
        case DM1105_BOARD_DVBWORLD_2004:
-               dm1105dvb->fe = dvb_attach(
+               dev->fe = dvb_attach(
                        cx24116_attach, &serit_sp2633_config,
-                       &dm1105dvb->i2c_adap);
-               if (dm1105dvb->fe)
-                       dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage;
+                       &dev->i2c_adap);
+               if (dev->fe) {
+                       dev->fe->ops.set_voltage = dm1105_set_voltage;
+                       break;
+               }
+
+               dev->fe = dvb_attach(
+                       ds3000_attach, &dvbworld_ds3000_config,
+                       &dev->i2c_adap);
+               if (dev->fe)
+                       dev->fe->ops.set_voltage = dm1105_set_voltage;
 
                break;
        case DM1105_BOARD_DVBWORLD_2002:
        case DM1105_BOARD_AXESS_DM05:
        default:
-               dm1105dvb->fe = dvb_attach(
+               dev->fe = dvb_attach(
                        stv0299_attach, &sharp_z0194a_config,
-                       &dm1105dvb->i2c_adap);
-               if (dm1105dvb->fe) {
-                       dm1105dvb->fe->ops.set_voltage =
-                                                       dm1105dvb_set_voltage;
-                       dvb_attach(dvb_pll_attach, dm1105dvb->fe, 0x60,
-                                       &dm1105dvb->i2c_adap, DVB_PLL_OPERA1);
+                       &dev->i2c_adap);
+               if (dev->fe) {
+                       dev->fe->ops.set_voltage = dm1105_set_voltage;
+                       dvb_attach(dvb_pll_attach, dev->fe, 0x60,
+                                       &dev->i2c_adap, DVB_PLL_OPERA1);
                        break;
                }
 
-               dm1105dvb->fe = dvb_attach(
+               dev->fe = dvb_attach(
                        stv0288_attach, &earda_config,
-                       &dm1105dvb->i2c_adap);
-               if (dm1105dvb->fe) {
-                       dm1105dvb->fe->ops.set_voltage =
-                                               dm1105dvb_set_voltage;
-                       dvb_attach(stb6000_attach, dm1105dvb->fe, 0x61,
-                                       &dm1105dvb->i2c_adap);
+                       &dev->i2c_adap);
+               if (dev->fe) {
+                       dev->fe->ops.set_voltage = dm1105_set_voltage;
+                       dvb_attach(stb6000_attach, dev->fe, 0x61,
+                                       &dev->i2c_adap);
                        break;
                }
 
-               dm1105dvb->fe = dvb_attach(
+               dev->fe = dvb_attach(
                        si21xx_attach, &serit_config,
-                       &dm1105dvb->i2c_adap);
-               if (dm1105dvb->fe)
-                       dm1105dvb->fe->ops.set_voltage =
-                                               dm1105dvb_set_voltage;
+                       &dev->i2c_adap);
+               if (dev->fe)
+                       dev->fe->ops.set_voltage = dm1105_set_voltage;
 
        }
 
-       if (!dm1105dvb->fe) {
-               dev_err(&dm1105dvb->pdev->dev, "could not attach frontend\n");
+       if (!dev->fe) {
+               dev_err(&dev->pdev->dev, "could not attach frontend\n");
                return -ENODEV;
        }
 
-       ret = dvb_register_frontend(&dm1105dvb->dvb_adapter, dm1105dvb->fe);
+       ret = dvb_register_frontend(&dev->dvb_adapter, dev->fe);
        if (ret < 0) {
-               if (dm1105dvb->fe->ops.release)
-                       dm1105dvb->fe->ops.release(dm1105dvb->fe);
-               dm1105dvb->fe = NULL;
+               if (dev->fe->ops.release)
+                       dev->fe->ops.release(dev->fe);
+               dev->fe = NULL;
                return ret;
        }
 
        return 0;
 }
 
-static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac)
+static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac)
 {
        static u8 command[1] = { 0x28 };
 
@@ -766,47 +791,47 @@ static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac)
                },
        };
 
-       dm1105_i2c_xfer(&dm1105dvb->i2c_adap, msg , 2);
-       dev_info(&dm1105dvb->pdev->dev, "MAC %pM\n", mac);
+       dm1105_i2c_xfer(&dev->i2c_adap, msg , 2);
+       dev_info(&dev->pdev->dev, "MAC %pM\n", mac);
 }
 
 static int __devinit dm1105_probe(struct pci_dev *pdev,
                                  const struct pci_device_id *ent)
 {
-       struct dm1105dvb *dm1105dvb;
+       struct dm1105_dev *dev;
        struct dvb_adapter *dvb_adapter;
        struct dvb_demux *dvbdemux;
        struct dmx_demux *dmx;
        int ret = -ENOMEM;
        int i;
 
-       dm1105dvb = kzalloc(sizeof(struct dm1105dvb), GFP_KERNEL);
-       if (!dm1105dvb)
+       dev = kzalloc(sizeof(struct dm1105_dev), GFP_KERNEL);
+       if (!dev)
                return -ENOMEM;
 
        /* board config */
-       dm1105dvb->nr = dm1105_devcount;
-       dm1105dvb->boardnr = UNSET;
-       if (card[dm1105dvb->nr] < ARRAY_SIZE(dm1105_boards))
-               dm1105dvb->boardnr = card[dm1105dvb->nr];
-       for (i = 0; UNSET == dm1105dvb->boardnr &&
+       dev->nr = dm1105_devcount;
+       dev->boardnr = UNSET;
+       if (card[dev->nr] < ARRAY_SIZE(dm1105_boards))
+               dev->boardnr = card[dev->nr];
+       for (i = 0; UNSET == dev->boardnr &&
                                i < ARRAY_SIZE(dm1105_subids); i++)
                if (pdev->subsystem_vendor ==
                        dm1105_subids[i].subvendor &&
                                pdev->subsystem_device ==
                                        dm1105_subids[i].subdevice)
-                       dm1105dvb->boardnr = dm1105_subids[i].card;
+                       dev->boardnr = dm1105_subids[i].card;
 
-       if (UNSET == dm1105dvb->boardnr) {
-               dm1105dvb->boardnr = DM1105_BOARD_UNKNOWN;
+       if (UNSET == dev->boardnr) {
+               dev->boardnr = DM1105_BOARD_UNKNOWN;
                dm1105_card_list(pdev);
        }
 
        dm1105_devcount++;
-       dm1105dvb->pdev = pdev;
-       dm1105dvb->buffer_size = 5 * DM1105_DMA_BYTES;
-       dm1105dvb->PacketErrorCount = 0;
-       dm1105dvb->dmarst = 0;
+       dev->pdev = pdev;
+       dev->buffer_size = 5 * DM1105_DMA_BYTES;
+       dev->PacketErrorCount = 0;
+       dev->dmarst = 0;
 
        ret = pci_enable_device(pdev);
        if (ret < 0)
@@ -822,47 +847,47 @@ static int __devinit dm1105_probe(struct pci_dev *pdev,
        if (ret < 0)
                goto err_pci_disable_device;
 
-       dm1105dvb->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
-       if (!dm1105dvb->io_mem) {
+       dev->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
+       if (!dev->io_mem) {
                ret = -EIO;
                goto err_pci_release_regions;
        }
 
-       spin_lock_init(&dm1105dvb->lock);
-       pci_set_drvdata(pdev, dm1105dvb);
+       spin_lock_init(&dev->lock);
+       pci_set_drvdata(pdev, dev);
 
-       ret = dm1105dvb_hw_init(dm1105dvb);
+       ret = dm1105_hw_init(dev);
        if (ret < 0)
                goto err_pci_iounmap;
 
        /* i2c */
-       i2c_set_adapdata(&dm1105dvb->i2c_adap, dm1105dvb);
-       strcpy(dm1105dvb->i2c_adap.name, DRIVER_NAME);
-       dm1105dvb->i2c_adap.owner = THIS_MODULE;
-       dm1105dvb->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
-       dm1105dvb->i2c_adap.dev.parent = &pdev->dev;
-       dm1105dvb->i2c_adap.algo = &dm1105_algo;
-       dm1105dvb->i2c_adap.algo_data = dm1105dvb;
-       ret = i2c_add_adapter(&dm1105dvb->i2c_adap);
+       i2c_set_adapdata(&dev->i2c_adap, dev);
+       strcpy(dev->i2c_adap.name, DRIVER_NAME);
+       dev->i2c_adap.owner = THIS_MODULE;
+       dev->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
+       dev->i2c_adap.dev.parent = &pdev->dev;
+       dev->i2c_adap.algo = &dm1105_algo;
+       dev->i2c_adap.algo_data = dev;
+       ret = i2c_add_adapter(&dev->i2c_adap);
 
        if (ret < 0)
-               goto err_dm1105dvb_hw_exit;
+               goto err_dm1105_hw_exit;
 
        /* dvb */
-       ret = dvb_register_adapter(&dm1105dvb->dvb_adapter, DRIVER_NAME,
+       ret = dvb_register_adapter(&dev->dvb_adapter, DRIVER_NAME,
                                        THIS_MODULE, &pdev->dev, adapter_nr);
        if (ret < 0)
                goto err_i2c_del_adapter;
 
-       dvb_adapter = &dm1105dvb->dvb_adapter;
+       dvb_adapter = &dev->dvb_adapter;
 
-       dm1105dvb_read_mac(dm1105dvb, dvb_adapter->proposed_mac);
+       dm1105_read_mac(dev, dvb_adapter->proposed_mac);
 
-       dvbdemux = &dm1105dvb->demux;
+       dvbdemux = &dev->demux;
        dvbdemux->filternum = 256;
        dvbdemux->feednum = 256;
-       dvbdemux->start_feed = dm1105dvb_start_feed;
-       dvbdemux->stop_feed = dm1105dvb_stop_feed;
+       dvbdemux->start_feed = dm1105_start_feed;
+       dvbdemux->stop_feed = dm1105_stop_feed;
        dvbdemux->dmx.capabilities = (DMX_TS_FILTERING |
                        DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING);
        ret = dvb_dmx_init(dvbdemux);
@@ -870,113 +895,113 @@ static int __devinit dm1105_probe(struct pci_dev *pdev,
                goto err_dvb_unregister_adapter;
 
        dmx = &dvbdemux->dmx;
-       dm1105dvb->dmxdev.filternum = 256;
-       dm1105dvb->dmxdev.demux = dmx;
-       dm1105dvb->dmxdev.capabilities = 0;
+       dev->dmxdev.filternum = 256;
+       dev->dmxdev.demux = dmx;
+       dev->dmxdev.capabilities = 0;
 
-       ret = dvb_dmxdev_init(&dm1105dvb->dmxdev, dvb_adapter);
+       ret = dvb_dmxdev_init(&dev->dmxdev, dvb_adapter);
        if (ret < 0)
                goto err_dvb_dmx_release;
 
-       dm1105dvb->hw_frontend.source = DMX_FRONTEND_0;
+       dev->hw_frontend.source = DMX_FRONTEND_0;
 
-       ret = dmx->add_frontend(dmx, &dm1105dvb->hw_frontend);
+       ret = dmx->add_frontend(dmx, &dev->hw_frontend);
        if (ret < 0)
                goto err_dvb_dmxdev_release;
 
-       dm1105dvb->mem_frontend.source = DMX_MEMORY_FE;
+       dev->mem_frontend.source = DMX_MEMORY_FE;
 
-       ret = dmx->add_frontend(dmx, &dm1105dvb->mem_frontend);
+       ret = dmx->add_frontend(dmx, &dev->mem_frontend);
        if (ret < 0)
                goto err_remove_hw_frontend;
 
-       ret = dmx->connect_frontend(dmx, &dm1105dvb->hw_frontend);
+       ret = dmx->connect_frontend(dmx, &dev->hw_frontend);
        if (ret < 0)
                goto err_remove_mem_frontend;
 
-       ret = frontend_init(dm1105dvb);
+       ret = frontend_init(dev);
        if (ret < 0)
                goto err_disconnect_frontend;
 
-       dvb_net_init(dvb_adapter, &dm1105dvb->dvbnet, dmx);
-       dm1105_ir_init(dm1105dvb);
+       dvb_net_init(dvb_adapter, &dev->dvbnet, dmx);
+       dm1105_ir_init(dev);
 
-       INIT_WORK(&dm1105dvb->work, dm1105_dmx_buffer);
-       sprintf(dm1105dvb->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num);
-       dm1105dvb->wq = create_singlethread_workqueue(dm1105dvb->wqn);
-       if (!dm1105dvb->wq)
+       INIT_WORK(&dev->work, dm1105_dmx_buffer);
+       sprintf(dev->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num);
+       dev->wq = create_singlethread_workqueue(dev->wqn);
+       if (!dev->wq)
                goto err_dvb_net;
 
-       ret = request_irq(pdev->irq, dm1105dvb_irq, IRQF_SHARED,
-                                               DRIVER_NAME, dm1105dvb);
+       ret = request_irq(pdev->irq, dm1105_irq, IRQF_SHARED,
+                                               DRIVER_NAME, dev);
        if (ret < 0)
                goto err_workqueue;
 
        return 0;
 
 err_workqueue:
-       destroy_workqueue(dm1105dvb->wq);
+       destroy_workqueue(dev->wq);
 err_dvb_net:
-       dvb_net_release(&dm1105dvb->dvbnet);
+       dvb_net_release(&dev->dvbnet);
 err_disconnect_frontend:
        dmx->disconnect_frontend(dmx);
 err_remove_mem_frontend:
-       dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
+       dmx->remove_frontend(dmx, &dev->mem_frontend);
 err_remove_hw_frontend:
-       dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
+       dmx->remove_frontend(dmx, &dev->hw_frontend);
 err_dvb_dmxdev_release:
-       dvb_dmxdev_release(&dm1105dvb->dmxdev);
+       dvb_dmxdev_release(&dev->dmxdev);
 err_dvb_dmx_release:
        dvb_dmx_release(dvbdemux);
 err_dvb_unregister_adapter:
        dvb_unregister_adapter(dvb_adapter);
 err_i2c_del_adapter:
-       i2c_del_adapter(&dm1105dvb->i2c_adap);
-err_dm1105dvb_hw_exit:
-       dm1105dvb_hw_exit(dm1105dvb);
+       i2c_del_adapter(&dev->i2c_adap);
+err_dm1105_hw_exit:
+       dm1105_hw_exit(dev);
 err_pci_iounmap:
-       pci_iounmap(pdev, dm1105dvb->io_mem);
+       pci_iounmap(pdev, dev->io_mem);
 err_pci_release_regions:
        pci_release_regions(pdev);
 err_pci_disable_device:
        pci_disable_device(pdev);
 err_kfree:
        pci_set_drvdata(pdev, NULL);
-       kfree(dm1105dvb);
+       kfree(dev);
        return ret;
 }
 
 static void __devexit dm1105_remove(struct pci_dev *pdev)
 {
-       struct dm1105dvb *dm1105dvb = pci_get_drvdata(pdev);
-       struct dvb_adapter *dvb_adapter = &dm1105dvb->dvb_adapter;
-       struct dvb_demux *dvbdemux = &dm1105dvb->demux;
+       struct dm1105_dev *dev = pci_get_drvdata(pdev);
+       struct dvb_adapter *dvb_adapter = &dev->dvb_adapter;
+       struct dvb_demux *dvbdemux = &dev->demux;
        struct dmx_demux *dmx = &dvbdemux->dmx;
 
-       dm1105_ir_exit(dm1105dvb);
+       dm1105_ir_exit(dev);
        dmx->close(dmx);
-       dvb_net_release(&dm1105dvb->dvbnet);
-       if (dm1105dvb->fe)
-               dvb_unregister_frontend(dm1105dvb->fe);
+       dvb_net_release(&dev->dvbnet);
+       if (dev->fe)
+               dvb_unregister_frontend(dev->fe);
 
        dmx->disconnect_frontend(dmx);
-       dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
-       dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
-       dvb_dmxdev_release(&dm1105dvb->dmxdev);
+       dmx->remove_frontend(dmx, &dev->mem_frontend);
+       dmx->remove_frontend(dmx, &dev->hw_frontend);
+       dvb_dmxdev_release(&dev->dmxdev);
        dvb_dmx_release(dvbdemux);
        dvb_unregister_adapter(dvb_adapter);
-       if (&dm1105dvb->i2c_adap)
-               i2c_del_adapter(&dm1105dvb->i2c_adap);
+       if (&dev->i2c_adap)
+               i2c_del_adapter(&dev->i2c_adap);
 
-       dm1105dvb_hw_exit(dm1105dvb);
+       dm1105_hw_exit(dev);
        synchronize_irq(pdev->irq);
-       free_irq(pdev->irq, dm1105dvb);
-       pci_iounmap(pdev, dm1105dvb->io_mem);
+       free_irq(pdev->irq, dev);
+       pci_iounmap(pdev, dev->io_mem);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
        dm1105_devcount--;
-       kfree(dm1105dvb);
+       kfree(dev);
 }
 
 static struct pci_device_id dm1105_id_table[] __devinitdata = {
index c37790ad92d0b501e470d4c0a6de0a1713fc592a..9ddc57909d492199097bdb184f2184dff7c1fbde 100644 (file)
@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
        dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192);
        dmxdevfilter->type = DMXDEV_TYPE_NONE;
        dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED);
-       INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
        init_timer(&dmxdevfilter->timer);
 
        dvbdev->users++;
@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
        dmxdevfilter->type = DMXDEV_TYPE_PES;
        memcpy(&dmxdevfilter->params, params,
               sizeof(struct dmx_pes_filter_params));
+       INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
 
        dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET);
 
index b78cfb7d1897dcb956508f034cdfffb1e5af3174..67f189b7aa1ffb79706d9bcd8fb10cd250dcd8c9 100644 (file)
@@ -426,16 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
                };
        };
 
-       if (dvb_demux_tscheck) {
-               if (!demux->cnt_storage)
-                       demux->cnt_storage = vmalloc(MAX_PID + 1);
-
-               if (!demux->cnt_storage) {
-                       printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
-                       dvb_demux_tscheck = 0;
-                       goto no_dvb_demux_tscheck;
-               }
-
+       if (demux->cnt_storage) {
                /* check pkt counter */
                if (pid < MAX_PID) {
                        if (buf[1] & 0x80)
@@ -454,7 +445,6 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
                };
                /* end check */
        };
-no_dvb_demux_tscheck:
 
        list_for_each_entry(feed, &demux->feed_list, list_head) {
                if ((feed->pid != pid) && (feed->pid != 0x2000))
@@ -1246,6 +1236,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
        dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed));
        if (!dvbdemux->feed) {
                vfree(dvbdemux->filter);
+               dvbdemux->filter = NULL;
                return -ENOMEM;
        }
        for (i = 0; i < dvbdemux->filternum; i++) {
@@ -1257,6 +1248,13 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
                dvbdemux->feed[i].index = i;
        }
 
+       if (dvb_demux_tscheck) {
+               dvbdemux->cnt_storage = vmalloc(MAX_PID + 1);
+
+               if (!dvbdemux->cnt_storage)
+                       printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
+       }
+
        INIT_LIST_HEAD(&dvbdemux->frontend_list);
 
        for (i = 0; i < DMX_TS_PES_OTHER; i++) {
index 07461222a7f50b43a2bebca01f7d21368081ab7a..55ea260572bf576319fe5a299f5e19341bcf0df1 100644 (file)
@@ -1199,8 +1199,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
 {
        int r = 0;
 
-       dtv_property_dump(tvp);
-
        /* Allow the frontend to validate incoming properties */
        if (fe->ops.get_property)
                r = fe->ops.get_property(fe, tvp);
@@ -1323,6 +1321,8 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
                r = -1;
        }
 
+       dtv_property_dump(tvp);
+
        return r;
 }
 
@@ -1488,7 +1488,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
        struct dvb_frontend_private *fepriv = fe->frontend_priv;
        int err = -EOPNOTSUPP;
 
-       dprintk ("%s\n", __func__);
+       dprintk("%s (%d)\n", __func__, _IOC_NR(cmd));
 
        if (fepriv->exit)
                return -ENODEV;
@@ -1536,8 +1536,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
                if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS))
                        return -EINVAL;
 
-               tvp = (struct dtv_property *) kmalloc(tvps->num *
-                       sizeof(struct dtv_property), GFP_KERNEL);
+               tvp = kmalloc(tvps->num * sizeof(struct dtv_property), GFP_KERNEL);
                if (!tvp) {
                        err = -ENOMEM;
                        goto out;
@@ -1569,8 +1568,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
                if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS))
                        return -EINVAL;
 
-               tvp = (struct dtv_property *) kmalloc(tvps->num *
-                       sizeof(struct dtv_property), GFP_KERNEL);
+               tvp = kmalloc(tvps->num * sizeof(struct dtv_property), GFP_KERNEL);
                if (!tvp) {
                        err = -ENOMEM;
                        goto out;
index 8b8558fcb04280410b8761ed3d36aefbc778c27a..b11533f76195c73c5630f699732c382bd4fc6702 100644 (file)
@@ -504,6 +504,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                                       "bytes left in TS.  Resyncing.\n", ts_remain);
                                priv->ule_sndu_len = 0;
                                priv->need_pusi = 1;
+                               ts += TS_SZ;
                                continue;
                        }
 
index 584bbd194dc8a18ee65b327949bcc7a67dee8c48..a5712cd7c65ff084845cc86599d63f802ac81722 100644 (file)
@@ -89,6 +89,7 @@ void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
        rbuf->pread = rbuf->pwrite;
        rbuf->error = 0;
 }
+EXPORT_SYMBOL(dvb_ringbuffer_flush);
 
 void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf)
 {
index 1b249897c9fbecf6c82fa9017e562d94b5909e46..e5f91f16ffa4ea51ae3f74cf06477eed56186a24 100644 (file)
@@ -112,11 +112,13 @@ config DVB_USB_CXUSB
        select DVB_MT352 if !DVB_FE_CUSTOMISE
        select DVB_ZL10353 if !DVB_FE_CUSTOMISE
        select DVB_DIB7000P if !DVB_FE_CUSTOMISE
-       select DVB_LGS8GL5 if !DVB_FE_CUSTOMISE
        select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE
+       select DVB_ATBM8830 if !DVB_FE_CUSTOMISE
+       select DVB_LGS8GXX if !DVB_FE_CUSTOMISE
        select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE
        select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE
        select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
+       select MEDIA_TUNER_MAX2165 if !MEDIA_TUNER_CUSTOMISE
        help
          Say Y here to support the Conexant USB2.0 hybrid reference design.
          Currently, only DVB and ATSC modes are supported, analog mode
@@ -334,3 +336,11 @@ config DVB_USB_EC168
        select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
        help
          Say Y here to support the E3C EC168 DVB-T USB2.0 receiver.
+
+config DVB_USB_AZ6027
+       tristate "Azurewave DVB-S/S2 USB2.0 AZ6027 support"
+       depends on DVB_USB
+       select DVB_STB0899 if !DVB_FE_CUSTOMISE
+       select DVB_STB6100 if !DVB_FE_CUSTOMISE
+       help
+         Say Y here to support the AZ6027 device
index 72c92cb69a221d9597a1e8c828e4247fb787225e..1a192453b0e77912541828e7b105a866f803e584 100644 (file)
@@ -85,6 +85,9 @@ obj-$(CONFIG_DVB_USB_FRIIO) += dvb-usb-friio.o
 dvb-usb-ec168-objs = ec168.o
 obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o
 
+dvb-usb-az6027-objs = az6027.o
+obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o
+
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
 # due to tuner-xc3028
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
index 8b60a601fb82e270f2cfd397251e921f17952026..d7975383d31b58a7257cc42266afb335af6bf8ef 100644 (file)
@@ -21,6 +21,8 @@
  *
  */
 
+#include <linux/hash.h>
+
 #include "af9015.h"
 #include "af9013.h"
 #include "mt2060.h"
@@ -553,26 +555,45 @@ exit:
        return ret;
 }
 
-/* dump eeprom */
-static int af9015_eeprom_dump(struct dvb_usb_device *d)
+/* hash (and dump) eeprom */
+static int af9015_eeprom_hash(struct usb_device *udev)
 {
-       u8 reg, val;
+       static const unsigned int eeprom_size = 256;
+       unsigned int reg;
+       int ret;
+       u8 val, *eeprom;
+       struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val};
 
-       for (reg = 0; ; reg++) {
-               if (reg % 16 == 0) {
-                       if (reg)
-                               deb_info(KERN_CONT "\n");
-                       deb_info(KERN_DEBUG "%02x:", reg);
-               }
-               if (af9015_read_reg_i2c(d, AF9015_I2C_EEPROM, reg, &val) == 0)
-                       deb_info(KERN_CONT " %02x", val);
-               else
-                       deb_info(KERN_CONT " --");
-               if (reg == 0xff)
-                       break;
+       eeprom = kmalloc(eeprom_size, GFP_KERNEL);
+       if (eeprom == NULL)
+               return -ENOMEM;
+
+       for (reg = 0; reg < eeprom_size; reg++) {
+               req.addr = reg;
+               ret = af9015_rw_udev(udev, &req);
+               if (ret)
+                       goto free;
+               eeprom[reg] = val;
        }
-       deb_info(KERN_CONT "\n");
-       return 0;
+
+       if (dvb_usb_af9015_debug & 0x01)
+               print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, eeprom,
+                               eeprom_size);
+
+       BUG_ON(eeprom_size % 4);
+
+       af9015_config.eeprom_sum = 0;
+       for (reg = 0; reg < eeprom_size / sizeof(u32); reg++) {
+               af9015_config.eeprom_sum *= GOLDEN_RATIO_PRIME_32;
+               af9015_config.eeprom_sum += le32_to_cpu(((u32 *)eeprom)[reg]);
+       }
+
+       deb_info("%s: eeprom sum=%.8x\n", __func__, af9015_config.eeprom_sum);
+
+       ret = 0;
+free:
+       kfree(eeprom);
+       return ret;
 }
 
 static int af9015_download_ir_table(struct dvb_usb_device *d)
@@ -711,12 +732,132 @@ error:
        return ret;
 }
 
+struct af9015_setup {
+       unsigned int id;
+       struct dvb_usb_rc_key *rc_key_map;
+       unsigned int rc_key_map_size;
+       u8 *ir_table;
+       unsigned int ir_table_size;
+};
+
+static const struct af9015_setup *af9015_setup_match(unsigned int id,
+               const struct af9015_setup *table)
+{
+       for (; table->rc_key_map; table++)
+               if (table->id == id)
+                       return table;
+       return NULL;
+}
+
+static const struct af9015_setup af9015_setup_modparam[] = {
+       { AF9015_REMOTE_A_LINK_DTU_M,
+               af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link),
+               af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) },
+       { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
+               af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi),
+               af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) },
+       { AF9015_REMOTE_MYGICTV_U718,
+               af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv),
+               af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) },
+       { AF9015_REMOTE_DIGITTRADE_DVB_T,
+               af9015_rc_keys_digittrade, ARRAY_SIZE(af9015_rc_keys_digittrade),
+               af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) },
+       { AF9015_REMOTE_AVERMEDIA_KS,
+               af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia),
+               af9015_ir_table_avermedia_ks, ARRAY_SIZE(af9015_ir_table_avermedia_ks) },
+       { }
+};
+
+/* don't add new entries here anymore, use hashes instead */
+static const struct af9015_setup af9015_setup_usbids[] = {
+       { USB_VID_LEADTEK,
+               af9015_rc_keys_leadtek, ARRAY_SIZE(af9015_rc_keys_leadtek),
+               af9015_ir_table_leadtek, ARRAY_SIZE(af9015_ir_table_leadtek) },
+       { USB_VID_VISIONPLUS,
+               af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan),
+               af9015_ir_table_twinhan, ARRAY_SIZE(af9015_ir_table_twinhan) },
+       { USB_VID_KWORLD_2, /* TODO: use correct rc keys */
+               af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan),
+               af9015_ir_table_kworld, ARRAY_SIZE(af9015_ir_table_kworld) },
+       { USB_VID_AVERMEDIA,
+               af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia),
+               af9015_ir_table_avermedia, ARRAY_SIZE(af9015_ir_table_avermedia) },
+       { USB_VID_MSI_2,
+               af9015_rc_keys_msi_digivox_iii, ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii),
+               af9015_ir_table_msi_digivox_iii, ARRAY_SIZE(af9015_ir_table_msi_digivox_iii) },
+       { }
+};
+
+static const struct af9015_setup af9015_setup_hashes[] = {
+       { 0xb8feb708,
+               af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi),
+               af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) },
+       { 0xa3703d00,
+               af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link),
+               af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) },
+       { 0x9b7dc64e,
+               af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv),
+               af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) },
+       { }
+};
+
+static void af9015_set_remote_config(struct usb_device *udev,
+               struct dvb_usb_device_properties *props)
+{
+       const struct af9015_setup *table = NULL;
+
+       if (dvb_usb_af9015_remote) {
+               /* load remote defined as module param */
+               table = af9015_setup_match(dvb_usb_af9015_remote,
+                               af9015_setup_modparam);
+       } else {
+               u16 vendor = le16_to_cpu(udev->descriptor.idVendor);
+
+               table = af9015_setup_match(af9015_config.eeprom_sum,
+                               af9015_setup_hashes);
+
+               if (!table && vendor == USB_VID_AFATECH) {
+                       /* Check USB manufacturer and product strings and try
+                          to determine correct remote in case of chip vendor
+                          reference IDs are used.
+                          DO NOT ADD ANYTHING NEW HERE. Use hashes instead.
+                        */
+                       char manufacturer[10];
+                       memset(manufacturer, 0, sizeof(manufacturer));
+                       usb_string(udev, udev->descriptor.iManufacturer,
+                               manufacturer, sizeof(manufacturer));
+                       if (!strcmp("MSI", manufacturer)) {
+                               /* iManufacturer 1 MSI
+                                  iProduct      2 MSI K-VOX */
+                               table = af9015_setup_match(
+                                       AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
+                                       af9015_setup_modparam);
+                       } else if (udev->descriptor.idProduct ==
+                               cpu_to_le16(USB_PID_TREKSTOR_DVBT)) {
+                               table = &(const struct af9015_setup){ 0,
+                                       af9015_rc_keys_trekstor,
+                                       ARRAY_SIZE(af9015_rc_keys_trekstor),
+                                       af9015_ir_table_trekstor,
+                                       ARRAY_SIZE(af9015_ir_table_trekstor)
+                               };
+                       }
+               } else if (!table)
+                       table = af9015_setup_match(vendor, af9015_setup_usbids);
+       }
+
+       if (table) {
+               props->rc_key_map = table->rc_key_map;
+               props->rc_key_map_size = table->rc_key_map_size;
+               af9015_config.ir_table = table->ir_table;
+               af9015_config.ir_table_size = table->ir_table_size;
+       }
+}
+
 static int af9015_read_config(struct usb_device *udev)
 {
        int ret;
        u8 val, i, offset = 0;
        struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val};
-       char manufacturer[10];
 
        /* IR remote controller */
        req.addr = AF9015_EEPROM_IR_MODE;
@@ -728,158 +869,18 @@ static int af9015_read_config(struct usb_device *udev)
        }
        if (ret)
                goto error;
+
+       ret = af9015_eeprom_hash(udev);
+       if (ret)
+               goto error;
+
        deb_info("%s: IR mode:%d\n", __func__, val);
        for (i = 0; i < af9015_properties_count; i++) {
                if (val == AF9015_IR_MODE_DISABLED) {
                        af9015_properties[i].rc_key_map = NULL;
                        af9015_properties[i].rc_key_map_size  = 0;
-               } else if (dvb_usb_af9015_remote) {
-                       /* load remote defined as module param */
-                       switch (dvb_usb_af9015_remote) {
-                       case AF9015_REMOTE_A_LINK_DTU_M:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_a_link;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_a_link);
-                               af9015_config.ir_table = af9015_ir_table_a_link;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_a_link);
-                               break;
-                       case AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_msi;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_msi);
-                               af9015_config.ir_table = af9015_ir_table_msi;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_msi);
-                               break;
-                       case AF9015_REMOTE_MYGICTV_U718:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_mygictv;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_mygictv);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_mygictv;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_mygictv);
-                               break;
-                       case AF9015_REMOTE_DIGITTRADE_DVB_T:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_digittrade;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_digittrade);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_digittrade;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_digittrade);
-                               break;
-                       case AF9015_REMOTE_AVERMEDIA_KS:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_avermedia;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_avermedia);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_avermedia_ks;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_avermedia_ks);
-                               break;
-                       }
-               } else {
-                       switch (le16_to_cpu(udev->descriptor.idVendor)) {
-                       case USB_VID_LEADTEK:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_leadtek;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_leadtek);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_leadtek;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_leadtek);
-                               break;
-                       case USB_VID_VISIONPLUS:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_twinhan;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_twinhan);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_twinhan;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_twinhan);
-                               break;
-                       case USB_VID_KWORLD_2:
-                               /* TODO: use correct rc keys */
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_twinhan;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_twinhan);
-                               af9015_config.ir_table = af9015_ir_table_kworld;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_kworld);
-                               break;
-                       /* Check USB manufacturer and product strings and try
-                          to determine correct remote in case of chip vendor
-                          reference IDs are used. */
-                       case USB_VID_AFATECH:
-                               memset(manufacturer, 0, sizeof(manufacturer));
-                               usb_string(udev, udev->descriptor.iManufacturer,
-                                       manufacturer, sizeof(manufacturer));
-                               if (!strcmp("Geniatech", manufacturer)) {
-                                       /* iManufacturer 1 Geniatech
-                                          iProduct      2 AF9015 */
-                                       af9015_properties[i].rc_key_map =
-                                         af9015_rc_keys_mygictv;
-                                       af9015_properties[i].rc_key_map_size =
-                                         ARRAY_SIZE(af9015_rc_keys_mygictv);
-                                       af9015_config.ir_table =
-                                         af9015_ir_table_mygictv;
-                                       af9015_config.ir_table_size =
-                                         ARRAY_SIZE(af9015_ir_table_mygictv);
-                               } else if (!strcmp("MSI", manufacturer)) {
-                                       /* iManufacturer 1 MSI
-                                          iProduct      2 MSI K-VOX */
-                                       af9015_properties[i].rc_key_map =
-                                         af9015_rc_keys_msi;
-                                       af9015_properties[i].rc_key_map_size =
-                                         ARRAY_SIZE(af9015_rc_keys_msi);
-                                       af9015_config.ir_table =
-                                         af9015_ir_table_msi;
-                                       af9015_config.ir_table_size =
-                                         ARRAY_SIZE(af9015_ir_table_msi);
-                               } else if (udev->descriptor.idProduct ==
-                                       cpu_to_le16(USB_PID_TREKSTOR_DVBT)) {
-                                       af9015_properties[i].rc_key_map =
-                                         af9015_rc_keys_trekstor;
-                                       af9015_properties[i].rc_key_map_size =
-                                         ARRAY_SIZE(af9015_rc_keys_trekstor);
-                                       af9015_config.ir_table =
-                                         af9015_ir_table_trekstor;
-                                       af9015_config.ir_table_size =
-                                         ARRAY_SIZE(af9015_ir_table_trekstor);
-                               }
-                               break;
-                       case USB_VID_AVERMEDIA:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_avermedia;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_avermedia);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_avermedia;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_avermedia);
-                               break;
-                       case USB_VID_MSI_2:
-                               af9015_properties[i].rc_key_map =
-                                 af9015_rc_keys_msi_digivox_iii;
-                               af9015_properties[i].rc_key_map_size =
-                                 ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii);
-                               af9015_config.ir_table =
-                                 af9015_ir_table_msi_digivox_iii;
-                               af9015_config.ir_table_size =
-                                 ARRAY_SIZE(af9015_ir_table_msi_digivox_iii);
-                               break;
-                       }
-               }
+               } else
+                       af9015_set_remote_config(udev, &af9015_properties[i]);
        }
 
        /* TS mode - one or two receivers */
@@ -1001,6 +1002,9 @@ static int af9015_read_config(struct usb_device *udev)
                        af9015_af9013_config[i].gpio[1] = AF9013_GPIO_LO;
                        af9015_af9013_config[i].rf_spec_inv = 1;
                        break;
+               case AF9013_TUNER_TDA18218:
+                       warn("tuner NXP TDA18218 not supported yet");
+                       return -ENODEV;
                default:
                        warn("tuner id:%d not supported, please report!", val);
                        return -ENODEV;
@@ -1125,11 +1129,6 @@ static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap)
 
                deb_info("%s: init I2C\n", __func__);
                ret = af9015_i2c_init(adap->dev);
-
-               /* dump eeprom (debug) */
-               ret = af9015_eeprom_dump(adap->dev);
-               if (ret)
-                       return ret;
        } else {
                /* select I2C adapter */
                i2c_adap = &state->i2c_adap;
@@ -1295,6 +1294,8 @@ static struct usb_device_id af9015_usb_table[] = {
 /* 25 */{USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_399U_2)},
        {USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_KWORLD_PC160_T)},
        {USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_SVEON_STV20)},
+       {USB_DEVICE(USB_VID_KWORLD_2,  USB_PID_TINYTWIN_2)},
+       {USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV2000DS)},
        {0},
 };
 MODULE_DEVICE_TABLE(usb, af9015_usb_table);
@@ -1381,7 +1382,8 @@ static struct dvb_usb_device_properties af9015_properties[] = {
                        },
                        {
                                .name = "DigitalNow TinyTwin DVB-T Receiver",
-                               .cold_ids = {&af9015_usb_table[5], NULL},
+                               .cold_ids = {&af9015_usb_table[5],
+                                            &af9015_usb_table[28], NULL},
                                .warm_ids = {NULL},
                        },
                        {
@@ -1566,7 +1568,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
 
                .i2c_algo = &af9015_i2c_algo,
 
-               .num_device_descs = 6, /* max 9 */
+               .num_device_descs = 7, /* max 9 */
                .devices = {
                        {
                                .name = "AverMedia AVerTV Volar GPS 805 (A805)",
@@ -1600,6 +1602,11 @@ static struct dvb_usb_device_properties af9015_properties[] = {
                                .cold_ids = {&af9015_usb_table[27], NULL},
                                .warm_ids = {NULL},
                        },
+                       {
+                               .name = "Leadtek WinFast DTV2000DS",
+                               .cold_ids = {&af9015_usb_table[29], NULL},
+                               .warm_ids = {NULL},
+                       },
                }
        },
 };
index 931c8515830d65639ceb0f108cce58c2ddaeb194..ef36b1831490e8b02919e7a994f4aa4a8f5dd5ff 100644 (file)
@@ -107,6 +107,7 @@ struct af9015_config {
        u16 mt2060_if1[2];
        u16 firmware_size;
        u16 firmware_checksum;
+       u32 eeprom_sum;
        u8  *ir_table;
        u16 ir_table_size;
 };
diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c
new file mode 100644 (file)
index 0000000..d7290b2
--- /dev/null
@@ -0,0 +1,1151 @@
+/* DVB USB compliant Linux driver for the AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)
+ * receiver.
+ *
+ * Copyright (C) 2009 Adams.Xu <adams.xu@azwave.com.cn>
+ *
+ *     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, version 2.
+ *
+ * see Documentation/dvb/README.dvb-usb for more information
+ */
+#include "az6027.h"
+
+#include "stb0899_drv.h"
+#include "stb0899_reg.h"
+#include "stb0899_cfg.h"
+
+#include "stb6100.h"
+#include "stb6100_cfg.h"
+#include "dvb_ca_en50221.h"
+
+int dvb_usb_az6027_debug;
+module_param_named(debug, dvb_usb_az6027_debug, int, 0644);
+MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+struct az6027_device_state {
+       struct dvb_ca_en50221 ca;
+       struct mutex ca_mutex;
+       u8 power_state;
+};
+
+static const struct stb0899_s1_reg az6027_stb0899_s1_init_1[] = {
+
+       /* 0x0000000b, SYSREG */
+       { STB0899_DEV_ID                , 0x30 },
+       { STB0899_DISCNTRL1             , 0x32 },
+       { STB0899_DISCNTRL2             , 0x80 },
+       { STB0899_DISRX_ST0             , 0x04 },
+       { STB0899_DISRX_ST1             , 0x00 },
+       { STB0899_DISPARITY             , 0x00 },
+       { STB0899_DISFIFO               , 0x00 },
+       { STB0899_DISSTATUS             , 0x20 },
+       { STB0899_DISF22                , 0x99 },
+       { STB0899_DISF22RX              , 0xa8 },
+       /* SYSREG ? */
+       { STB0899_ACRPRESC              , 0x11 },
+       { STB0899_ACRDIV1               , 0x0a },
+       { STB0899_ACRDIV2               , 0x05 },
+       { STB0899_DACR1                 , 0x00 },
+       { STB0899_DACR2                 , 0x00 },
+       { STB0899_OUTCFG                , 0x00 },
+       { STB0899_MODECFG               , 0x00 },
+       { STB0899_IRQSTATUS_3           , 0xfe },
+       { STB0899_IRQSTATUS_2           , 0x03 },
+       { STB0899_IRQSTATUS_1           , 0x7c },
+       { STB0899_IRQSTATUS_0           , 0xf4 },
+       { STB0899_IRQMSK_3              , 0xf3 },
+       { STB0899_IRQMSK_2              , 0xfc },
+       { STB0899_IRQMSK_1              , 0xff },
+       { STB0899_IRQMSK_0              , 0xff },
+       { STB0899_IRQCFG                , 0x00 },
+       { STB0899_I2CCFG                , 0x88 },
+       { STB0899_I2CRPT                , 0x58 },
+       { STB0899_IOPVALUE5             , 0x00 },
+       { STB0899_IOPVALUE4             , 0x33 },
+       { STB0899_IOPVALUE3             , 0x6d },
+       { STB0899_IOPVALUE2             , 0x90 },
+       { STB0899_IOPVALUE1             , 0x60 },
+       { STB0899_IOPVALUE0             , 0x00 },
+       { STB0899_GPIO00CFG             , 0x82 },
+       { STB0899_GPIO01CFG             , 0x82 },
+       { STB0899_GPIO02CFG             , 0x82 },
+       { STB0899_GPIO03CFG             , 0x82 },
+       { STB0899_GPIO04CFG             , 0x82 },
+       { STB0899_GPIO05CFG             , 0x82 },
+       { STB0899_GPIO06CFG             , 0x82 },
+       { STB0899_GPIO07CFG             , 0x82 },
+       { STB0899_GPIO08CFG             , 0x82 },
+       { STB0899_GPIO09CFG             , 0x82 },
+       { STB0899_GPIO10CFG             , 0x82 },
+       { STB0899_GPIO11CFG             , 0x82 },
+       { STB0899_GPIO12CFG             , 0x82 },
+       { STB0899_GPIO13CFG             , 0x82 },
+       { STB0899_GPIO14CFG             , 0x82 },
+       { STB0899_GPIO15CFG             , 0x82 },
+       { STB0899_GPIO16CFG             , 0x82 },
+       { STB0899_GPIO17CFG             , 0x82 },
+       { STB0899_GPIO18CFG             , 0x82 },
+       { STB0899_GPIO19CFG             , 0x82 },
+       { STB0899_GPIO20CFG             , 0x82 },
+       { STB0899_SDATCFG               , 0xb8 },
+       { STB0899_SCLTCFG               , 0xba },
+       { STB0899_AGCRFCFG              , 0x1c }, /* 0x11 */
+       { STB0899_GPIO22                , 0x82 }, /* AGCBB2CFG */
+       { STB0899_GPIO21                , 0x91 }, /* AGCBB1CFG */
+       { STB0899_DIRCLKCFG             , 0x82 },
+       { STB0899_CLKOUT27CFG           , 0x7e },
+       { STB0899_STDBYCFG              , 0x82 },
+       { STB0899_CS0CFG                , 0x82 },
+       { STB0899_CS1CFG                , 0x82 },
+       { STB0899_DISEQCOCFG            , 0x20 },
+       { STB0899_GPIO32CFG             , 0x82 },
+       { STB0899_GPIO33CFG             , 0x82 },
+       { STB0899_GPIO34CFG             , 0x82 },
+       { STB0899_GPIO35CFG             , 0x82 },
+       { STB0899_GPIO36CFG             , 0x82 },
+       { STB0899_GPIO37CFG             , 0x82 },
+       { STB0899_GPIO38CFG             , 0x82 },
+       { STB0899_GPIO39CFG             , 0x82 },
+       { STB0899_NCOARSE               , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */
+       { STB0899_SYNTCTRL              , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */
+       { STB0899_FILTCTRL              , 0x00 },
+       { STB0899_SYSCTRL               , 0x01 },
+       { STB0899_STOPCLK1              , 0x20 },
+       { STB0899_STOPCLK2              , 0x00 },
+       { STB0899_INTBUFSTATUS          , 0x00 },
+       { STB0899_INTBUFCTRL            , 0x0a },
+       { 0xffff                        , 0xff },
+};
+
+static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = {
+       { STB0899_DEMOD                 , 0x00 },
+       { STB0899_RCOMPC                , 0xc9 },
+       { STB0899_AGC1CN                , 0x01 },
+       { STB0899_AGC1REF               , 0x10 },
+       { STB0899_RTC                   , 0x23 },
+       { STB0899_TMGCFG                , 0x4e },
+       { STB0899_AGC2REF               , 0x34 },
+       { STB0899_TLSR                  , 0x84 },
+       { STB0899_CFD                   , 0xf7 },
+       { STB0899_ACLC                  , 0x87 },
+       { STB0899_BCLC                  , 0x94 },
+       { STB0899_EQON                  , 0x41 },
+       { STB0899_LDT                   , 0xf1 },
+       { STB0899_LDT2                  , 0xe3 },
+       { STB0899_EQUALREF              , 0xb4 },
+       { STB0899_TMGRAMP               , 0x10 },
+       { STB0899_TMGTHD                , 0x30 },
+       { STB0899_IDCCOMP               , 0xfd },
+       { STB0899_QDCCOMP               , 0xff },
+       { STB0899_POWERI                , 0x0c },
+       { STB0899_POWERQ                , 0x0f },
+       { STB0899_RCOMP                 , 0x6c },
+       { STB0899_AGCIQIN               , 0x80 },
+       { STB0899_AGC2I1                , 0x06 },
+       { STB0899_AGC2I2                , 0x00 },
+       { STB0899_TLIR                  , 0x30 },
+       { STB0899_RTF                   , 0x7f },
+       { STB0899_DSTATUS               , 0x00 },
+       { STB0899_LDI                   , 0xbc },
+       { STB0899_CFRM                  , 0xea },
+       { STB0899_CFRL                  , 0x31 },
+       { STB0899_NIRM                  , 0x2b },
+       { STB0899_NIRL                  , 0x80 },
+       { STB0899_ISYMB                 , 0x1d },
+       { STB0899_QSYMB                 , 0xa6 },
+       { STB0899_SFRH                  , 0x2f },
+       { STB0899_SFRM                  , 0x68 },
+       { STB0899_SFRL                  , 0x40 },
+       { STB0899_SFRUPH                , 0x2f },
+       { STB0899_SFRUPM                , 0x68 },
+       { STB0899_SFRUPL                , 0x40 },
+       { STB0899_EQUAI1                , 0x02 },
+       { STB0899_EQUAQ1                , 0xff },
+       { STB0899_EQUAI2                , 0x04 },
+       { STB0899_EQUAQ2                , 0x05 },
+       { STB0899_EQUAI3                , 0x02 },
+       { STB0899_EQUAQ3                , 0xfd },
+       { STB0899_EQUAI4                , 0x03 },
+       { STB0899_EQUAQ4                , 0x07 },
+       { STB0899_EQUAI5                , 0x08 },
+       { STB0899_EQUAQ5                , 0xf5 },
+       { STB0899_DSTATUS2              , 0x00 },
+       { STB0899_VSTATUS               , 0x00 },
+       { STB0899_VERROR                , 0x86 },
+       { STB0899_IQSWAP                , 0x2a },
+       { STB0899_ECNT1M                , 0x00 },
+       { STB0899_ECNT1L                , 0x00 },
+       { STB0899_ECNT2M                , 0x00 },
+       { STB0899_ECNT2L                , 0x00 },
+       { STB0899_ECNT3M                , 0x0a },
+       { STB0899_ECNT3L                , 0xad },
+       { STB0899_FECAUTO1              , 0x06 },
+       { STB0899_FECM                  , 0x01 },
+       { STB0899_VTH12                 , 0xb0 },
+       { STB0899_VTH23                 , 0x7a },
+       { STB0899_VTH34                 , 0x58 },
+       { STB0899_VTH56                 , 0x38 },
+       { STB0899_VTH67                 , 0x34 },
+       { STB0899_VTH78                 , 0x24 },
+       { STB0899_PRVIT                 , 0xff },
+       { STB0899_VITSYNC               , 0x19 },
+       { STB0899_RSULC                 , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
+       { STB0899_TSULC                 , 0x42 },
+       { STB0899_RSLLC                 , 0x41 },
+       { STB0899_TSLPL                 , 0x12 },
+       { STB0899_TSCFGH                , 0x0c },
+       { STB0899_TSCFGM                , 0x00 },
+       { STB0899_TSCFGL                , 0x00 },
+       { STB0899_TSOUT                 , 0x69 }, /* 0x0d for CAM */
+       { STB0899_RSSYNCDEL             , 0x00 },
+       { STB0899_TSINHDELH             , 0x02 },
+       { STB0899_TSINHDELM             , 0x00 },
+       { STB0899_TSINHDELL             , 0x00 },
+       { STB0899_TSLLSTKM              , 0x1b },
+       { STB0899_TSLLSTKL              , 0xb3 },
+       { STB0899_TSULSTKM              , 0x00 },
+       { STB0899_TSULSTKL              , 0x00 },
+       { STB0899_PCKLENUL              , 0xbc },
+       { STB0899_PCKLENLL              , 0xcc },
+       { STB0899_RSPCKLEN              , 0xbd },
+       { STB0899_TSSTATUS              , 0x90 },
+       { STB0899_ERRCTRL1              , 0xb6 },
+       { STB0899_ERRCTRL2              , 0x95 },
+       { STB0899_ERRCTRL3              , 0x8d },
+       { STB0899_DMONMSK1              , 0x27 },
+       { STB0899_DMONMSK0              , 0x03 },
+       { STB0899_DEMAPVIT              , 0x5c },
+       { STB0899_PLPARM                , 0x19 },
+       { STB0899_PDELCTRL              , 0x48 },
+       { STB0899_PDELCTRL2             , 0x00 },
+       { STB0899_BBHCTRL1              , 0x00 },
+       { STB0899_BBHCTRL2              , 0x00 },
+       { STB0899_HYSTTHRESH            , 0x77 },
+       { STB0899_MATCSTM               , 0x00 },
+       { STB0899_MATCSTL               , 0x00 },
+       { STB0899_UPLCSTM               , 0x00 },
+       { STB0899_UPLCSTL               , 0x00 },
+       { STB0899_DFLCSTM               , 0x00 },
+       { STB0899_DFLCSTL               , 0x00 },
+       { STB0899_SYNCCST               , 0x00 },
+       { STB0899_SYNCDCSTM             , 0x00 },
+       { STB0899_SYNCDCSTL             , 0x00 },
+       { STB0899_ISI_ENTRY             , 0x00 },
+       { STB0899_ISI_BIT_EN            , 0x00 },
+       { STB0899_MATSTRM               , 0xf0 },
+       { STB0899_MATSTRL               , 0x02 },
+       { STB0899_UPLSTRM               , 0x45 },
+       { STB0899_UPLSTRL               , 0x60 },
+       { STB0899_DFLSTRM               , 0xe3 },
+       { STB0899_DFLSTRL               , 0x00 },
+       { STB0899_SYNCSTR               , 0x47 },
+       { STB0899_SYNCDSTRM             , 0x05 },
+       { STB0899_SYNCDSTRL             , 0x18 },
+       { STB0899_CFGPDELSTATUS1        , 0x19 },
+       { STB0899_CFGPDELSTATUS2        , 0x2b },
+       { STB0899_BBFERRORM             , 0x00 },
+       { STB0899_BBFERRORL             , 0x01 },
+       { STB0899_UPKTERRORM            , 0x00 },
+       { STB0899_UPKTERRORL            , 0x00 },
+       { 0xffff                        , 0xff },
+};
+
+
+
+struct stb0899_config az6027_stb0899_config = {
+       .init_dev               = az6027_stb0899_s1_init_1,
+       .init_s2_demod          = stb0899_s2_init_2,
+       .init_s1_demod          = az6027_stb0899_s1_init_3,
+       .init_s2_fec            = stb0899_s2_init_4,
+       .init_tst               = stb0899_s1_init_5,
+
+       .demod_address          = 0xd0, /* 0x68, 0xd0 >> 1 */
+
+       .xtal_freq              = 27000000,
+       .inversion              = IQ_SWAP_ON, /* 1 */
+
+       .lo_clk                 = 76500000,
+       .hi_clk                 = 99000000,
+
+       .esno_ave               = STB0899_DVBS2_ESNO_AVE,
+       .esno_quant             = STB0899_DVBS2_ESNO_QUANT,
+       .avframes_coarse        = STB0899_DVBS2_AVFRAMES_COARSE,
+       .avframes_fine          = STB0899_DVBS2_AVFRAMES_FINE,
+       .miss_threshold         = STB0899_DVBS2_MISS_THRESHOLD,
+       .uwp_threshold_acq      = STB0899_DVBS2_UWP_THRESHOLD_ACQ,
+       .uwp_threshold_track    = STB0899_DVBS2_UWP_THRESHOLD_TRACK,
+       .uwp_threshold_sof      = STB0899_DVBS2_UWP_THRESHOLD_SOF,
+       .sof_search_timeout     = STB0899_DVBS2_SOF_SEARCH_TIMEOUT,
+
+       .btr_nco_bits           = STB0899_DVBS2_BTR_NCO_BITS,
+       .btr_gain_shift_offset  = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET,
+       .crl_nco_bits           = STB0899_DVBS2_CRL_NCO_BITS,
+       .ldpc_max_iter          = STB0899_DVBS2_LDPC_MAX_ITER,
+
+       .tuner_get_frequency    = stb6100_get_frequency,
+       .tuner_set_frequency    = stb6100_set_frequency,
+       .tuner_set_bandwidth    = stb6100_set_bandwidth,
+       .tuner_get_bandwidth    = stb6100_get_bandwidth,
+       .tuner_set_rfsiggain    = NULL,
+};
+
+struct stb6100_config az6027_stb6100_config = {
+       .tuner_address  = 0xc0,
+       .refclock       = 27000000,
+};
+
+
+/* check for mutex FIXME */
+int az6027_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
+{
+       int ret = -1;
+       if (mutex_lock_interruptible(&d->usb_mutex))
+               return -EAGAIN;
+
+       ret = usb_control_msg(d->udev,
+                             usb_rcvctrlpipe(d->udev, 0),
+                             req,
+                             USB_TYPE_VENDOR | USB_DIR_IN,
+                             value,
+                             index,
+                             b,
+                             blen,
+                             2000);
+
+       if (ret < 0) {
+               warn("usb in operation failed. (%d)", ret);
+               ret = -EIO;
+       } else
+               ret = 0;
+
+       deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index);
+       debug_dump(b, blen, deb_xfer);
+
+       mutex_unlock(&d->usb_mutex);
+       return ret;
+}
+
+static int az6027_usb_out_op(struct dvb_usb_device *d,
+                            u8 req,
+                            u16 value,
+                            u16 index,
+                            u8 *b,
+                            int blen)
+{
+       int ret;
+
+       deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ", req, value, index);
+       debug_dump(b, blen, deb_xfer);
+
+       if (mutex_lock_interruptible(&d->usb_mutex))
+               return -EAGAIN;
+
+       ret = usb_control_msg(d->udev,
+                             usb_sndctrlpipe(d->udev, 0),
+                             req,
+                             USB_TYPE_VENDOR | USB_DIR_OUT,
+                             value,
+                             index,
+                             b,
+                             blen,
+                             2000);
+
+       if (ret != blen) {
+               warn("usb out operation failed. (%d)", ret);
+               mutex_unlock(&d->usb_mutex);
+               return -EIO;
+       } else{
+               mutex_unlock(&d->usb_mutex);
+               return 0;
+       }
+}
+
+static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
+{
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       deb_info("%s %d", __func__, onoff);
+
+       req = 0xBC;
+       value = onoff;
+       index = 0;
+       blen = 0;
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               warn("usb out operation failed. (%d)", ret);
+
+       return ret;
+}
+
+/* keys for the enclosed remote control */
+static struct dvb_usb_rc_key az6027_rc_keys[] = {
+       { 0x01, KEY_1 },
+       { 0x02, KEY_2 },
+};
+
+/* remote control stuff (does not work with my box) */
+static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+{
+       return 0;
+}
+
+/*
+int az6027_power_ctrl(struct dvb_usb_device *d, int onoff)
+{
+       u8 v = onoff;
+       return az6027_usb_out_op(d,0xBC,v,3,NULL,1);
+}
+*/
+
+static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
+                                       int slot,
+                                       int address)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+       u8 b[12];
+
+       if (slot != 0)
+               return -EINVAL;
+
+       mutex_lock(&state->ca_mutex);
+
+       req = 0xC1;
+       value = address;
+       index = 0;
+       blen = 1;
+
+       ret = az6027_usb_in_op(d, req, value, index, b, blen);
+       if (ret < 0) {
+               warn("usb in operation failed. (%d)", ret);
+               ret = -EINVAL;
+       } else {
+               ret = b[0];
+       }
+
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int az6027_ci_write_attribute_mem(struct dvb_ca_en50221 *ca,
+                                        int slot,
+                                        int address,
+                                        u8 value)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret;
+       u8 req;
+       u16 value1;
+       u16 index;
+       int blen;
+
+       deb_info("%s %d", __func__, slot);
+       if (slot != 0)
+               return -EINVAL;
+
+       mutex_lock(&state->ca_mutex);
+       req = 0xC2;
+       value1 = address;
+       index = value;
+       blen = 0;
+
+       ret = az6027_usb_out_op(d, req, value1, index, NULL, blen);
+       if (ret != 0)
+               warn("usb out operation failed. (%d)", ret);
+
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca,
+                                     int slot,
+                                     u8 address)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+       u8 b[12];
+
+       if (slot != 0)
+               return -EINVAL;
+
+       mutex_lock(&state->ca_mutex);
+
+       req = 0xC3;
+       value = address;
+       index = 0;
+       blen = 2;
+
+       ret = az6027_usb_in_op(d, req, value, index, b, blen);
+       if (ret < 0) {
+               warn("usb in operation failed. (%d)", ret);
+               ret = -EINVAL;
+       } else {
+               if (b[0] == 0)
+                       warn("Read CI IO error");
+
+               ret = b[1];
+               deb_info("read cam data = %x from 0x%x", b[1], value);
+       }
+
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int az6027_ci_write_cam_control(struct dvb_ca_en50221 *ca,
+                                      int slot,
+                                      u8 address,
+                                      u8 value)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret;
+       u8 req;
+       u16 value1;
+       u16 index;
+       int blen;
+
+       if (slot != 0)
+               return -EINVAL;
+
+       mutex_lock(&state->ca_mutex);
+       req = 0xC4;
+       value1 = address;
+       index = value;
+       blen = 0;
+
+       ret = az6027_usb_out_op(d, req, value1, index, NULL, blen);
+       if (ret != 0) {
+               warn("usb out operation failed. (%d)", ret);
+               goto failed;
+       }
+
+failed:
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+       u8 b[12];
+
+       req = 0xC8;
+       value = 0;
+       index = 0;
+       blen = 1;
+
+       ret = az6027_usb_in_op(d, req, value, index, b, blen);
+       if (ret < 0) {
+               warn("usb in operation failed. (%d)", ret);
+               ret = -EIO;
+       } else{
+               ret = b[0];
+       }
+       return ret;
+}
+
+static int az6027_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret, i;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       mutex_lock(&state->ca_mutex);
+
+       req = 0xC6;
+       value = 1;
+       index = 0;
+       blen = 0;
+
+       ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
+       if (ret != 0) {
+               warn("usb out operation failed. (%d)", ret);
+               goto failed;
+       }
+
+       msleep(500);
+       req = 0xC6;
+       value = 0;
+       index = 0;
+       blen = 0;
+
+       ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
+       if (ret != 0) {
+               warn("usb out operation failed. (%d)", ret);
+               goto failed;
+       }
+
+       for (i = 0; i < 15; i++) {
+               msleep(100);
+
+               if (CI_CamReady(ca, slot)) {
+                       deb_info("CAM Ready");
+                       break;
+               }
+       }
+       msleep(5000);
+
+failed:
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int az6027_ci_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
+{
+       return 0;
+}
+
+static int az6027_ci_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       deb_info("%s", __func__);
+       mutex_lock(&state->ca_mutex);
+       req = 0xC7;
+       value = 1;
+       index = 0;
+       blen = 0;
+
+       ret = az6027_usb_out_op(d, req, value, index, NULL, blen);
+       if (ret != 0) {
+               warn("usb out operation failed. (%d)", ret);
+               goto failed;
+       }
+
+failed:
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
+{
+       struct dvb_usb_device *d = (struct dvb_usb_device *)ca->data;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+       u8 b[12];
+
+       mutex_lock(&state->ca_mutex);
+
+       req = 0xC5;
+       value = 0;
+       index = 0;
+       blen = 1;
+
+       ret = az6027_usb_in_op(d, req, value, index, b, blen);
+       if (ret < 0) {
+               warn("usb in operation failed. (%d)", ret);
+               ret = -EIO;
+       } else
+               ret = 0;
+
+       if (b[0] == 0) {
+               ret = 0;
+
+       } else if (b[0] == 1) {
+               ret = DVB_CA_EN50221_POLL_CAM_PRESENT |
+                     DVB_CA_EN50221_POLL_CAM_READY;
+       }
+
+       mutex_unlock(&state->ca_mutex);
+       return ret;
+}
+
+
+static void az6027_ci_uninit(struct dvb_usb_device *d)
+{
+       struct az6027_device_state *state;
+
+       deb_info("%s", __func__);
+
+       if (NULL == d)
+               return;
+
+       state = (struct az6027_device_state *)d->priv;
+       if (NULL == state)
+               return;
+
+       if (NULL == state->ca.data)
+               return;
+
+       dvb_ca_en50221_release(&state->ca);
+
+       memset(&state->ca, 0, sizeof(state->ca));
+}
+
+
+static int az6027_ci_init(struct dvb_usb_adapter *a)
+{
+       struct dvb_usb_device *d = a->dev;
+       struct az6027_device_state *state = (struct az6027_device_state *)d->priv;
+       int ret;
+
+       deb_info("%s", __func__);
+
+       mutex_init(&state->ca_mutex);
+
+       state->ca.owner                 = THIS_MODULE;
+       state->ca.read_attribute_mem    = az6027_ci_read_attribute_mem;
+       state->ca.write_attribute_mem   = az6027_ci_write_attribute_mem;
+       state->ca.read_cam_control      = az6027_ci_read_cam_control;
+       state->ca.write_cam_control     = az6027_ci_write_cam_control;
+       state->ca.slot_reset            = az6027_ci_slot_reset;
+       state->ca.slot_shutdown         = az6027_ci_slot_shutdown;
+       state->ca.slot_ts_enable        = az6027_ci_slot_ts_enable;
+       state->ca.poll_slot_status      = az6027_ci_poll_slot_status;
+       state->ca.data                  = d;
+
+       ret = dvb_ca_en50221_init(&a->dvb_adap,
+                                 &state->ca,
+                                 0, /* flags */
+                                 1);/* n_slots */
+       if (ret != 0) {
+               err("Cannot initialize CI: Error %d.", ret);
+               memset(&state->ca, 0, sizeof(state->ca));
+               return ret;
+       }
+
+       deb_info("CI initialized.");
+
+       return 0;
+}
+
+/*
+static int az6027_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
+{
+       az6027_usb_in_op(d, 0xb7, 6, 0, &mac[0], 6);
+       return 0;
+}
+*/
+
+static int az6027_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+{
+
+       u8 buf;
+       int ret;
+       struct dvb_usb_adapter *adap = fe->dvb->priv;
+
+       struct i2c_msg i2c_msg = {
+               .addr   = 0x99,
+               .flags  = 0,
+               .buf    = &buf,
+               .len    = 1
+       };
+
+       /*
+        * 2   --18v
+        * 1   --13v
+        * 0   --off
+        */
+       switch (voltage) {
+       case SEC_VOLTAGE_13:
+               buf = 1;
+               ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
+               break;
+
+       case SEC_VOLTAGE_18:
+               buf = 2;
+               ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
+               break;
+
+       case SEC_VOLTAGE_OFF:
+               buf = 0;
+               ret = i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1);
+               break;
+
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
+
+static int az6027_frontend_poweron(struct dvb_usb_adapter *adap)
+{
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       req = 0xBC;
+       value = 1; /* power on */
+       index = 3;
+       blen = 0;
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               return -EIO;
+
+       return 0;
+}
+static int az6027_frontend_reset(struct dvb_usb_adapter *adap)
+{
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       /* reset demodulator */
+       req = 0xC0;
+       value = 1; /* high */
+       index = 3;
+       blen = 0;
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               return -EIO;
+
+       req = 0xC0;
+       value = 0; /* low */
+       index = 3;
+       blen = 0;
+       msleep_interruptible(200);
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               return -EIO;
+
+       msleep_interruptible(200);
+
+       req = 0xC0;
+       value = 1; /*high */
+       index = 3;
+       blen = 0;
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               return -EIO;
+
+       msleep_interruptible(200);
+       return 0;
+}
+
+static int az6027_frontend_tsbypass(struct dvb_usb_adapter *adap, int onoff)
+{
+       int ret;
+       u8 req;
+       u16 value;
+       u16 index;
+       int blen;
+
+       /* TS passthrough */
+       req = 0xC7;
+       value = onoff;
+       index = 0;
+       blen = 0;
+
+       ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen);
+       if (ret != 0)
+               return -EIO;
+
+       return 0;
+}
+
+static int az6027_frontend_attach(struct dvb_usb_adapter *adap)
+{
+
+       az6027_frontend_poweron(adap);
+       az6027_frontend_reset(adap);
+
+       deb_info("adap = %p, dev = %p\n", adap, adap->dev);
+       adap->fe = stb0899_attach(&az6027_stb0899_config, &adap->dev->i2c_adap);
+
+       if (adap->fe) {
+               deb_info("found STB0899 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb0899_config.demod_address);
+               if (stb6100_attach(adap->fe, &az6027_stb6100_config, &adap->dev->i2c_adap)) {
+                       deb_info("found STB6100 DVB-S/DVB-S2 frontend @0x%02x", az6027_stb6100_config.tuner_address);
+                       adap->fe->ops.set_voltage = az6027_set_voltage;
+                       az6027_ci_init(adap);
+               } else {
+                       adap->fe = NULL;
+               }
+       } else
+               warn("no front-end attached\n");
+
+       az6027_frontend_tsbypass(adap, 0);
+
+       return 0;
+}
+
+static struct dvb_usb_device_properties az6027_properties;
+
+static void az6027_usb_disconnect(struct usb_interface *intf)
+{
+       struct dvb_usb_device *d = usb_get_intfdata(intf);
+       az6027_ci_uninit(d);
+       dvb_usb_device_exit(intf);
+}
+
+
+static int az6027_usb_probe(struct usb_interface *intf,
+                           const struct usb_device_id *id)
+{
+       return dvb_usb_device_init(intf,
+                                  &az6027_properties,
+                                  THIS_MODULE,
+                                  NULL,
+                                  adapter_nr);
+}
+
+/* I2C */
+static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
+{
+       struct dvb_usb_device *d = i2c_get_adapdata(adap);
+       int i = 0, j = 0, len = 0;
+       int ret;
+       u16 index;
+       u16 value;
+       int length;
+       u8 req;
+       u8 data[256];
+
+       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+               return -EAGAIN;
+
+       if (num > 2)
+               warn("more than 2 i2c messages at a time is not handled yet. TODO.");
+
+       for (i = 0; i < num; i++) {
+
+               if (msg[i].addr == 0x99) {
+                       req = 0xBE;
+                       index = 0;
+                       value = msg[i].buf[0] & 0x00ff;
+                       length = 1;
+                       az6027_usb_out_op(d, req, value, index, data, length);
+               }
+
+               if (msg[i].addr == 0xd0) {
+                       /* write/read request */
+                       if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) {
+                               req = 0xB9;
+                               index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
+                               value = msg[i].addr + (msg[i].len << 8);
+                               length = msg[i + 1].len + 6;
+                               ret = az6027_usb_in_op(d, req, value, index, data, length);
+                               len = msg[i + 1].len;
+                               for (j = 0; j < len; j++)
+                                       msg[i + 1].buf[j] = data[j + 5];
+
+                               i++;
+                       } else {
+
+                               if (msg[i].addr == 0xd0) {
+                                       /* demod 16bit addr */
+                                       req = 0xBD;
+                                       index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff));
+                                       value = msg[i].addr + (2 << 8);
+                                       length = msg[i].len - 2;
+                                       len = msg[i].len - 2;
+                                       for (j = 0; j < len; j++)
+                                               data[j] = msg[i].buf[j + 2];
+
+                               }
+                               az6027_usb_out_op(d, req, value, index, data, length);
+                       }
+               }
+
+               if (msg[i].addr == 0xc0) {
+                       if (msg[i].flags & I2C_M_RD) {
+
+                               req = 0xB9;
+                               index = 0x0;
+                               value = msg[i].addr;
+                               length = msg[i].len + 6;
+                               ret = az6027_usb_in_op(d, req, value, index, data, length);
+                               len = msg[i].len;
+                               for (j = 0; j < len; j++)
+                                       msg[i].buf[j] = data[j + 5];
+
+                       } else {
+
+                               req = 0xBD;
+                               index = msg[i].buf[0] & 0x00FF;
+                               value = msg[i].addr + (1 << 8);
+                               length = msg[i].len - 1;
+                               len = msg[i].len - 1;
+
+                               for (j = 0; j < len; j++)
+                                       data[j] = msg[i].buf[j + 1];
+
+                               az6027_usb_out_op(d, req, value, index, data, length);
+                       }
+               }
+       }
+       mutex_unlock(&d->i2c_mutex);
+
+       return i;
+}
+
+
+static u32 az6027_i2c_func(struct i2c_adapter *adapter)
+{
+       return I2C_FUNC_I2C;
+}
+
+static struct i2c_algorithm az6027_i2c_algo = {
+       .master_xfer   = az6027_i2c_xfer,
+       .functionality = az6027_i2c_func,
+};
+
+int az6027_identify_state(struct usb_device *udev,
+                         struct dvb_usb_device_properties *props,
+                         struct dvb_usb_device_description **desc,
+                         int *cold)
+{
+       u8 b[16];
+       s16 ret = usb_control_msg(udev,
+                                 usb_rcvctrlpipe(udev, 0),
+                                 0xb7,
+                                 USB_TYPE_VENDOR | USB_DIR_IN,
+                                 6,
+                                 0,
+                                 b,
+                                 6,
+                                 USB_CTRL_GET_TIMEOUT);
+
+       *cold = ret <= 0;
+
+       deb_info("cold: %d\n", *cold);
+       return 0;
+}
+
+
+static struct usb_device_id az6027_usb_table[] = {
+       { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) },
+       { USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_DVBS2CI) },
+       { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI) },
+       { },
+};
+
+MODULE_DEVICE_TABLE(usb, az6027_usb_table);
+
+static struct dvb_usb_device_properties az6027_properties = {
+       .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+       .usb_ctrl = CYPRESS_FX2,
+       .firmware            = "dvb-usb-az6027-03.fw",
+       .no_reconnect        = 1,
+
+       .size_of_priv     = sizeof(struct az6027_device_state),
+       .identify_state         = az6027_identify_state,
+       .num_adapters = 1,
+       .adapter = {
+               {
+                       .streaming_ctrl   = az6027_streaming_ctrl,
+                       .frontend_attach  = az6027_frontend_attach,
+
+                       /* parameter for the MPEG2-data transfer */
+                       .stream = {
+                               .type = USB_BULK,
+                               .count = 10,
+                               .endpoint = 0x02,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 4096,
+                                       }
+                               }
+                       },
+               }
+       },
+/*
+       .power_ctrl       = az6027_power_ctrl,
+       .read_mac_address = az6027_read_mac_addr,
+ */
+       .rc_key_map       = az6027_rc_keys,
+       .rc_key_map_size  = ARRAY_SIZE(az6027_rc_keys),
+       .rc_interval      = 400,
+       .rc_query         = az6027_rc_query,
+       .i2c_algo         = &az6027_i2c_algo,
+
+       .num_device_descs = 1,
+       .devices = {
+               {
+                       .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
+                       .cold_ids = { &az6027_usb_table[0], NULL },
+                       .warm_ids = { NULL },
+               },
+               { NULL },
+       }
+};
+
+/* usb specific object needed to register this driver with the usb subsystem */
+static struct usb_driver az6027_usb_driver = {
+       .name           = "dvb_usb_az6027",
+       .probe          = az6027_usb_probe,
+       .disconnect     = az6027_usb_disconnect,
+       .id_table       = az6027_usb_table,
+};
+
+/* module stuff */
+static int __init az6027_usb_module_init(void)
+{
+       int result;
+
+       result = usb_register(&az6027_usb_driver);
+       if (result) {
+               err("usb_register failed. (%d)", result);
+               return result;
+       }
+
+       return 0;
+}
+
+static void __exit az6027_usb_module_exit(void)
+{
+       /* deregister this driver from the USB subsystem */
+       usb_deregister(&az6027_usb_driver);
+}
+
+module_init(az6027_usb_module_init);
+module_exit(az6027_usb_module_exit);
+
+MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>");
+MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)");
+MODULE_VERSION("1.0");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/az6027.h b/drivers/media/dvb/dvb-usb/az6027.h
new file mode 100644 (file)
index 0000000..f3afe17
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _DVB_USB_VP6027_H_
+#define _DVB_USB_VP6027_H_
+
+#define DVB_USB_LOG_PREFIX "az6027"
+#include "dvb-usb.h"
+
+
+extern int dvb_usb_az6027_debug;
+#define deb_info(args...) dprintk(dvb_usb_az6027_debug, 0x01, args)
+#define deb_xfer(args...) dprintk(dvb_usb_az6027_debug, 0x02, args)
+#define deb_rc(args...)   dprintk(dvb_usb_az6027_debug, 0x04, args)
+#define deb_fe(args...)   dprintk(dvb_usb_az6027_debug, 0x08, args)
+
+#endif
index 05fb28e9c69e18887b52400219140caaeded92dc..a7b8405c291e472570958ba713b1712223b37c68 100644 (file)
@@ -1184,6 +1184,9 @@ static struct atbm8830_config mygica_d689_atbm8830_cfg = {
        .osc_clk_freq = 30400, /* in kHz */
        .if_freq = 0, /* zero IF */
        .zif_swap_iq = 1,
+       .agc_min = 0x2E,
+       .agc_max = 0x90,
+       .agc_hold_loop = 0,
 };
 
 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
index 495a90577c5f7f1f9d0524b5edf55d141bb77846..83fc24a6c31a6b6b4b7836a028ea0d6a23f1d60b 100644 (file)
@@ -42,7 +42,6 @@ struct dib0700_state {
        u16 mt2060_if1[2];
        u8 rc_toggle;
        u8 rc_counter;
-       u8 rc_func_version;
        u8 is_dib7000pc;
        u8 fw_use_new_i2c_api;
        u8 disable_streaming_master_mode;
index 0d3c9a9a33be4bd1bf74d7a51042592099b315de..4f961d2d1817e776699cebd54554f833ae14a66e 100644 (file)
@@ -471,14 +471,209 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
        return dib0700_ctrl_wr(adap->dev, b, 4);
 }
 
+/* Number of keypresses to ignore before start repeating */
+#define RC_REPEAT_DELAY_V1_20 10
+
+/* This is the structure of the RC response packet starting in firmware 1.20 */
+struct dib0700_rc_response {
+       u8 report_id;
+       u8 data_state;
+       u16 system;
+       u8 data;
+       u8 not_data;
+};
+#define RC_MSG_SIZE_V1_20 6
+
+static void dib0700_rc_urb_completion(struct urb *purb)
+{
+       struct dvb_usb_device *d = purb->context;
+       struct dvb_usb_rc_key *keymap;
+       struct dib0700_state *st;
+       struct dib0700_rc_response poll_reply;
+       u8 *buf;
+       int found = 0;
+       u32 event;
+       int state;
+       int i;
+
+       deb_info("%s()\n", __func__);
+       if (d == NULL)
+               return;
+
+       if (d->rc_input_dev == NULL) {
+               /* This will occur if disable_rc_polling=1 */
+               usb_free_urb(purb);
+               return;
+       }
+
+       keymap = d->props.rc_key_map;
+       st = d->priv;
+       buf = (u8 *)purb->transfer_buffer;
+
+       if (purb->status < 0) {
+               deb_info("discontinuing polling\n");
+               usb_free_urb(purb);
+               return;
+       }
+
+       if (purb->actual_length != RC_MSG_SIZE_V1_20) {
+               deb_info("malformed rc msg size=%d\n", purb->actual_length);
+               goto resubmit;
+       }
+
+       /* Set initial results in case we exit the function early */
+       event = 0;
+       state = REMOTE_NO_KEY_PRESSED;
+
+       deb_data("IR raw %02X %02X %02X %02X %02X %02X (len %d)\n", buf[0],
+                buf[1], buf[2], buf[3], buf[4], buf[5], purb->actual_length);
+
+       switch (dvb_usb_dib0700_ir_proto) {
+       case 0:
+               /* NEC Protocol */
+               poll_reply.report_id  = 0;
+               poll_reply.data_state = 1;
+               poll_reply.system     = buf[2];
+               poll_reply.data       = buf[4];
+               poll_reply.not_data   = buf[5];
+
+               /* NEC protocol sends repeat code as 0 0 0 FF */
+               if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
+                   && (poll_reply.not_data == 0xff)) {
+                       poll_reply.data_state = 2;
+                       break;
+               }
+               break;
+       default:
+               /* RC5 Protocol */
+               poll_reply.report_id  = buf[0];
+               poll_reply.data_state = buf[1];
+               poll_reply.system     = (buf[2] << 8) | buf[3];
+               poll_reply.data       = buf[4];
+               poll_reply.not_data   = buf[5];
+               break;
+       }
+
+       if ((poll_reply.data + poll_reply.not_data) != 0xff) {
+               /* Key failed integrity check */
+               err("key failed integrity check: %04x %02x %02x",
+                   poll_reply.system,
+                   poll_reply.data, poll_reply.not_data);
+               goto resubmit;
+       }
+
+       deb_data("rid=%02x ds=%02x sm=%04x d=%02x nd=%02x\n",
+                poll_reply.report_id, poll_reply.data_state,
+                poll_reply.system, poll_reply.data, poll_reply.not_data);
+
+       /* Find the key in the map */
+       for (i = 0; i < d->props.rc_key_map_size; i++) {
+               if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
+                   rc5_data(&keymap[i]) == poll_reply.data) {
+                       event = keymap[i].event;
+                       found = 1;
+                       break;
+               }
+       }
+
+       if (found == 0) {
+               err("Unknown remote controller key: %04x %02x %02x",
+                   poll_reply.system, poll_reply.data, poll_reply.not_data);
+               d->last_event = 0;
+               goto resubmit;
+       }
+
+       if (poll_reply.data_state == 1) {
+               /* New key hit */
+               st->rc_counter = 0;
+               event = keymap[i].event;
+               state = REMOTE_KEY_PRESSED;
+               d->last_event = keymap[i].event;
+       } else if (poll_reply.data_state == 2) {
+               /* Key repeated */
+               st->rc_counter++;
+
+               /* prevents unwanted double hits */
+               if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
+                       event = d->last_event;
+                       state = REMOTE_KEY_PRESSED;
+                       st->rc_counter = RC_REPEAT_DELAY_V1_20;
+               }
+       } else {
+               err("Unknown data state [%d]", poll_reply.data_state);
+       }
+
+       switch (state) {
+       case REMOTE_NO_KEY_PRESSED:
+               break;
+       case REMOTE_KEY_PRESSED:
+               deb_info("key pressed\n");
+               d->last_event = event;
+       case REMOTE_KEY_REPEAT:
+               deb_info("key repeated\n");
+               input_event(d->rc_input_dev, EV_KEY, event, 1);
+               input_sync(d->rc_input_dev);
+               input_event(d->rc_input_dev, EV_KEY, d->last_event, 0);
+               input_sync(d->rc_input_dev);
+               break;
+       default:
+               break;
+       }
+
+resubmit:
+       /* Clean the buffer before we requeue */
+       memset(purb->transfer_buffer, 0, RC_MSG_SIZE_V1_20);
+
+       /* Requeue URB */
+       usb_submit_urb(purb, GFP_ATOMIC);
+}
+
 int dib0700_rc_setup(struct dvb_usb_device *d)
 {
+       struct dib0700_state *st = d->priv;
        u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
-       int i = dib0700_ctrl_wr(d, rc_setup, 3);
+       struct urb *purb;
+       int ret;
+       int i;
+
+       if (d->props.rc_key_map == NULL)
+               return 0;
+
+       /* Set the IR mode */
+       i = dib0700_ctrl_wr(d, rc_setup, 3);
        if (i<0) {
                err("ir protocol setup failed");
                return -1;
        }
+
+       if (st->fw_version < 0x10200)
+               return 0;
+
+       /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */
+       purb = usb_alloc_urb(0, GFP_KERNEL);
+       if (purb == NULL) {
+               err("rc usb alloc urb failed\n");
+               return -1;
+       }
+
+       purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL);
+       if (purb->transfer_buffer == NULL) {
+               err("rc kzalloc failed\n");
+               usb_free_urb(purb);
+               return -1;
+       }
+
+       purb->status = -EINPROGRESS;
+       usb_fill_bulk_urb(purb, d->udev, usb_rcvbulkpipe(d->udev, 1),
+                         purb->transfer_buffer, RC_MSG_SIZE_V1_20,
+                         dib0700_rc_urb_completion, d);
+
+       ret = usb_submit_urb(purb, GFP_ATOMIC);
+       if (ret != 0) {
+               err("rc submit urb failed\n");
+               return -1;
+       }
+
        return 0;
 }
 
index 44972d01bbd02fddc22b66e84b78dcad712cb21a..34eab05afc6cd08d83d74468f7614b9a5f2a3468 100644 (file)
@@ -472,20 +472,25 @@ static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
 
 /* Number of keypresses to ignore before start repeating */
 #define RC_REPEAT_DELAY 6
-#define RC_REPEAT_DELAY_V1_20 10
 
-
-
-/* Used by firmware versions < 1.20 (deprecated) */
-static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
-                                  int *state)
+static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
        u8 key[4];
        int i;
        struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
        struct dib0700_state *st = d->priv;
+
        *event = 0;
        *state = REMOTE_NO_KEY_PRESSED;
+
+       if (st->fw_version >= 0x10200) {
+               /* For 1.20 firmware , We need to keep the RC polling
+                  callback so we can reuse the input device setup in
+                  dvb-usb-remote.c.  However, the actual work is being done
+                  in the bulk URB completion handler. */
+               return 0;
+       }
+
        i=dib0700_ctrl_rd(d,rc_request,2,key,4);
        if (i<=0) {
                err("RC Query Failed");
@@ -557,149 +562,6 @@ static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
        return 0;
 }
 
-/* This is the structure of the RC response packet starting in firmware 1.20 */
-struct dib0700_rc_response {
-       u8 report_id;
-       u8 data_state;
-       u16 system;
-       u8 data;
-       u8 not_data;
-};
-
-/* This supports the new IR response format for firmware v1.20 */
-static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
-                                 int *state)
-{
-       struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
-       struct dib0700_state *st = d->priv;
-       struct dib0700_rc_response poll_reply;
-       u8 buf[6];
-       int i;
-       int status;
-       int actlen;
-       int found = 0;
-
-       /* Set initial results in case we exit the function early */
-       *event = 0;
-       *state = REMOTE_NO_KEY_PRESSED;
-
-       /* Firmware v1.20 provides RC data via bulk endpoint 1 */
-       status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
-                             sizeof(buf), &actlen, 50);
-       if (status < 0) {
-               /* No data available (meaning no key press) */
-               return 0;
-       }
-
-
-       switch (dvb_usb_dib0700_ir_proto) {
-       case 0:
-               poll_reply.report_id  = 0;
-               poll_reply.data_state = 1;
-               poll_reply.system     = buf[2];
-               poll_reply.data       = buf[4];
-               poll_reply.not_data   = buf[5];
-
-               /* NEC protocol sends repeat code as 0 0 0 FF */
-               if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
-                   && (poll_reply.not_data == 0xff)) {
-                       poll_reply.data_state = 2;
-                       break;
-               }
-               break;
-       default:
-       if (actlen != sizeof(buf)) {
-               /* We didn't get back the 6 byte message we expected */
-               err("Unexpected RC response size [%d]", actlen);
-               return -1;
-       }
-
-       poll_reply.report_id  = buf[0];
-       poll_reply.data_state = buf[1];
-               poll_reply.system     = (buf[2] << 8) | buf[3];
-       poll_reply.data       = buf[4];
-       poll_reply.not_data   = buf[5];
-
-               break;
-       }
-
-       if ((poll_reply.data + poll_reply.not_data) != 0xff) {
-               /* Key failed integrity check */
-               err("key failed integrity check: %04x %02x %02x",
-                   poll_reply.system,
-                   poll_reply.data, poll_reply.not_data);
-               return -1;
-       }
-
-
-       /* Find the key in the map */
-       for (i = 0; i < d->props.rc_key_map_size; i++) {
-               if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
-                       rc5_data(&keymap[i]) == poll_reply.data) {
-                       *event = keymap[i].event;
-                       found = 1;
-                       break;
-               }
-       }
-
-       if (found == 0) {
-               err("Unknown remote controller key: %04x %02x %02x",
-                       poll_reply.system,
-                       poll_reply.data, poll_reply.not_data);
-               d->last_event = 0;
-               return 0;
-       }
-
-       if (poll_reply.data_state == 1) {
-               /* New key hit */
-               st->rc_counter = 0;
-               *event = keymap[i].event;
-               *state = REMOTE_KEY_PRESSED;
-               d->last_event = keymap[i].event;
-       } else if (poll_reply.data_state == 2) {
-               /* Key repeated */
-               st->rc_counter++;
-
-               /* prevents unwanted double hits */
-               if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
-                       *event = d->last_event;
-                       *state = REMOTE_KEY_PRESSED;
-                       st->rc_counter = RC_REPEAT_DELAY_V1_20;
-               }
-       } else {
-               err("Unknown data state [%d]", poll_reply.data_state);
-       }
-
-       return 0;
-}
-
-static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
-{
-       struct dib0700_state *st = d->priv;
-
-       /* Because some people may have improperly named firmware files,
-          let's figure out whether to use the new firmware call or the legacy
-          call based on the firmware version embedded in the file */
-       if (st->rc_func_version == 0) {
-               u32 hwver, romver, ramver, fwtype;
-               int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
-                                             &fwtype);
-               if (ret < 0) {
-                       err("Could not determine version info");
-                       return -1;
-               }
-               if (ramver < 0x10200)
-                       st->rc_func_version = 1;
-               else
-                       st->rc_func_version = 2;
-       }
-
-       if (st->rc_func_version == 2)
-               return dib0700_rc_query_v1_20(d, event, state);
-       else
-               return dib0700_rc_query_legacy(d, event, state);
-}
-
 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
        /* Key codes for the tiny Pinnacle remote*/
        { 0x0700, KEY_MUTE },
index bc3581d58cedb8be3afe98555d8d5e1544ea8406..ae8b57acfe05cb97f4711b21e85fb0d939741ee2 100644 (file)
@@ -64,6 +64,8 @@
 #define USB_VID_HUMAX_COEX                     0x10b9
 #define USB_VID_774                            0x7a69
 #define USB_VID_EVOLUTEPC                      0x1e59
+#define USB_VID_AZUREWAVE                      0x13d3
+#define USB_VID_TECHNISAT                      0x14f7
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD                      0xa333
 #define USB_PID_TWINHAN_VP7021_COLD                    0x3207
 #define USB_PID_TWINHAN_VP7021_WARM                    0x3208
 #define USB_PID_TINYTWIN                               0x3226
+#define USB_PID_TINYTWIN_2                             0xe402
 #define USB_PID_DNTV_TINYUSB2_COLD                     0x3223
 #define USB_PID_DNTV_TINYUSB2_WARM                     0x3224
 #define USB_PID_ULTIMA_TVBOX_COLD                      0x8105
 #define USB_PID_PINNACLE_PCTV71E                       0x022b
 #define USB_PID_PINNACLE_PCTV72E                       0x0236
 #define USB_PID_PINNACLE_PCTV73E                       0x0237
+#define USB_PID_PINNACLE_PCTV310E                      0x3211
 #define USB_PID_PINNACLE_PCTV801E                      0x023a
 #define USB_PID_PINNACLE_PCTV801E_SE                   0x023b
 #define USB_PID_PINNACLE_PCTV73A                       0x0243
 #define USB_PID_DIGIVOX_MINI_SL_WARM                   0xe361
 #define USB_PID_GRANDTEC_DVBT_USB2_COLD                        0x0bc6
 #define USB_PID_GRANDTEC_DVBT_USB2_WARM                        0x0bc7
+#define USB_PID_WINFAST_DTV2000DS                      0x6a04
 #define USB_PID_WINFAST_DTV_DONGLE_COLD                        0x6025
 #define USB_PID_WINFAST_DTV_DONGLE_WARM                        0x6026
 #define USB_PID_WINFAST_DTV_DONGLE_STK7700P            0x6f00
 #define USB_PID_FRIIO_WHITE                            0x0001
 #define USB_PID_TVWAY_PLUS                             0x0002
 #define USB_PID_SVEON_STV20                            0xe39d
-
+#define USB_PID_AZUREWAVE_AZ6027                       0x3275
+#define USB_PID_TERRATEC_DVBS2CI                       0x3275
+#define USB_PID_TECHNISAT_USB2_HDCI                    0x0002
 #endif
index e331db8c77b210125c72f4cb475e4c71c9ca8798..5d91f70d2d2d786fab7e8a9522fed36738782633 100644 (file)
@@ -243,7 +243,7 @@ int dvb_usb_device_init(struct usb_interface *intf,
                d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);
        if (d == NULL) {
                err("no memory for 'struct dvb_usb_device'");
-               return ret;
+               return -ENOMEM;
        }
 
        d->udev = udev;
index 6b5ded9e7d5d744d69a9a37af3faa173e4711715..a03ef7efec9abcba1a11b4a1d332012841b37ba6 100644 (file)
@@ -107,6 +107,7 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
                case REMOTE_KEY_REPEAT:
                        deb_rc("key repeated\n");
                        input_event(d->rc_input_dev, EV_KEY, event, 1);
+                       input_sync(d->rc_input_dev);
                        input_event(d->rc_input_dev, EV_KEY, d->last_event, 0);
                        input_sync(d->rc_input_dev);
                        break;
index 64132c0cf80d1f0fdb2b9ab004502c2b4a97be5d..accc65509b071685f254b0e01a52cc1451481eb2 100644 (file)
@@ -1,6 +1,7 @@
 /* DVB USB framework compliant Linux driver for the
 *      DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
-*      TeVii S600, S630, S650 Cards
+*      TeVii S600, S630, S650,
+*      Prof 1100, 7500 Cards
 * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by)
 *
 *      This program is free software; you can redistribute it and/or modify it
@@ -469,11 +470,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
                                                                int num)
 {
        struct dvb_usb_device *d = i2c_get_adapdata(adap);
+       struct usb_device *udev;
        int ret = 0;
        int len, i, j;
 
        if (!d)
                return -ENODEV;
+       udev = d->udev;
        if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
                return -EAGAIN;
 
@@ -488,8 +491,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
                }
                case (DW2102_VOLTAGE_CTRL): {
                        u8 obuf[2];
+
+                       obuf[0] = 1;
+                       obuf[1] = msg[j].buf[1];/* off-on */
+                       ret = dw210x_op_rw(d->udev, 0x8a, 0, 0,
+                                       obuf, 2, DW210X_WRITE_MSG);
                        obuf[0] = 3;
-                       obuf[1] = msg[j].buf[0];
+                       obuf[1] = msg[j].buf[0];/* 13v-18v */
                        ret = dw210x_op_rw(d->udev, 0x8a, 0, 0,
                                        obuf, 2, DW210X_WRITE_MSG);
                        break;
@@ -527,6 +535,17 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
                                        i += 16;
                                        len -= 16;
                                } while (len > 0);
+                       } else if ((udev->descriptor.idProduct == 0x7500)
+                                       && (j < (num - 1))) {
+                               /* write register addr before read */
+                               u8 obuf[msg[j].len + 2];
+                               obuf[0] = msg[j + 1].len;
+                               obuf[1] = (msg[j].addr << 1);
+                               memcpy(obuf + 2, msg[j].buf, msg[j].len);
+                               ret = dw210x_op_rw(d->udev, 0x92, 0, 0,
+                                               obuf, msg[j].len + 2,
+                                               DW210X_WRITE_MSG);
+                               break;
                        } else {
                                /* write registers */
                                u8 obuf[msg[j].len + 2];
@@ -651,18 +670,25 @@ static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
 
 static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
 {
-       static u8 command_13v[1] = {0x00};
-       static u8 command_18v[1] = {0x01};
-       struct i2c_msg msg[] = {
-               {.addr = DW2102_VOLTAGE_CTRL, .flags = 0,
-                       .buf = command_13v, .len = 1},
+       static u8 command_13v[] = {0x00, 0x01};
+       static u8 command_18v[] = {0x01, 0x01};
+       static u8 command_off[] = {0x00, 0x00};
+       struct i2c_msg msg = {
+               .addr = DW2102_VOLTAGE_CTRL,
+               .flags = 0,
+               .buf = command_off,
+               .len = 2,
        };
 
        struct dvb_usb_adapter *udev_adap =
                (struct dvb_usb_adapter *)(fe->dvb->priv);
        if (voltage == SEC_VOLTAGE_18)
-               msg[0].buf = command_18v;
-       i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1);
+               msg.buf = command_18v;
+       else if (voltage == SEC_VOLTAGE_13)
+               msg.buf = command_13v;
+
+       i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1);
+
        return 0;
 }
 
@@ -735,6 +761,18 @@ static struct stv6110_config dw2104_stv6110_config = {
        .clk_div = 1,
 };
 
+static struct stv0900_config prof_7500_stv0900_config = {
+       .demod_address = 0x6a,
+       .demod_mode = 0,
+       .xtal = 27000000,
+       .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
+       .diseqc_mode = 2,/* 2/3 PWM */
+       .tun1_maddress = 0,/* 0x60 */
+       .tun1_adc = 0,/* 2 Vpp */
+       .path1_mode = 3,
+       .tun1_type = 3,
+};
+
 static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
 {
        struct dvb_tuner_ops *tuner_ops = NULL;
@@ -882,6 +920,19 @@ static int s6x0_frontend_attach(struct dvb_usb_adapter *d)
        return -EIO;
 }
 
+static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
+{
+       d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
+                                       &d->dev->i2c_adap, 0);
+       if (d->fe == NULL)
+               return -EIO;
+       d->fe->ops.set_voltage = dw210x_set_voltage;
+
+       info("Attached STV0900+STB6100A!\n");
+
+       return 0;
+}
+
 static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
 {
        dvb_attach(dvb_pll_attach, adap->fe, 0x60,
@@ -1073,6 +1124,7 @@ static struct usb_device_id dw2102_table[] = {
        {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
        {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
        {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
+       {USB_DEVICE(0x3034, 0x7500)},
        { }
 };
 
@@ -1387,9 +1439,30 @@ static struct dvb_usb_device_properties s6x0_properties = {
        }
 };
 
+struct dvb_usb_device_properties *p7500;
+static struct dvb_usb_device_description d7500 = {
+       "Prof 7500 USB DVB-S2",
+       {&dw2102_table[9], NULL},
+       {NULL},
+};
+
 static int dw2102_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
+
+       p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
+       if (!p7500)
+               return -ENOMEM;
+       /* copy default structure */
+       memcpy(p7500, &s6x0_properties,
+                       sizeof(struct dvb_usb_device_properties));
+       /* fill only different fields */
+       p7500->firmware = "dvb-usb-p7500.fw";
+       p7500->devices[0] = d7500;
+       p7500->rc_key_map = tbs_rc_keys;
+       p7500->rc_key_map_size = ARRAY_SIZE(tbs_rc_keys);
+       p7500->adapter->frontend_attach = prof_7500_frontend_attach;
+
        if (0 == dvb_usb_device_init(intf, &dw2102_properties,
                        THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &dw2104_properties,
@@ -1397,6 +1470,8 @@ static int dw2102_probe(struct usb_interface *intf,
            0 == dvb_usb_device_init(intf, &dw3101_properties,
                        THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &s6x0_properties,
+                       THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, p7500,
                        THIS_MODULE, NULL, adapter_nr))
                return 0;
 
@@ -1431,6 +1506,6 @@ MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
 MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
                                " DVB-C 3101 USB2.0,"
                                " TeVii S600, S630, S650, S660 USB2.0,"
-                               " Prof 1100 USB2.0 devices");
+                               " Prof 1100, 7500 USB2.0 devices");
 MODULE_VERSION("0.1");
 MODULE_LICENSE("GPL");
index ebb7b9fd115b3e1880afd34bbb7782883e681dff..d14bd227b5027b5a0bf0afd4c281e909db12cf38 100644 (file)
@@ -366,7 +366,7 @@ static u8 init_code[][2] = {
        {0x76, 0x0C},
 };
 
-const static int init_code_len = sizeof(init_code) / sizeof(u8[2]);
+static const int init_code_len = sizeof(init_code) / sizeof(u8[2]);
 
 static int jdvbt90502_init(struct dvb_frontend *fe)
 {
index ef9b7bed13ffe84538b3e47f27d1e07bf8ff26bd..737ffa36ac9c67a8390c72afd6adbdc8086f3604 100644 (file)
@@ -16,6 +16,9 @@
 #include "qt1010.h"
 #include "tda1004x.h"
 #include "tda827x.h"
+
+#include <media/tuner.h>
+#include "tuner-simple.h"
 #include <asm/unaligned.h>
 
 /* debug */
@@ -158,11 +161,14 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 
                        case 0x93:
                        case 0x92:
+                       case 0x83: /* pinnacle PCTV310e */
+                       case 0x82:
                                m->rep_count = 0;
                                *state = REMOTE_KEY_PRESSED;
                                goto unlock;
 
                        case 0x91:
+                       case 0x81: /* pinnacle PCTV310e */
                                /* prevent immediate auto-repeat */
                                if (++m->rep_count > 2)
                                        *state = REMOTE_KEY_REPEAT;
@@ -546,6 +552,14 @@ static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
        return 0;
 }
 
+static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
+{
+       dvb_attach(simple_tuner_attach, adap->fe,
+                  &adap->dev->i2c_adap, 0x61,
+                  TUNER_PHILIPS_FMD1216ME_MK3);
+       return 0;
+}
+
 /* device-specific initialization */
 static struct m920x_inits megasky_rc_init [] = {
        { M9206_RC_INIT2, 0xa8 },
@@ -562,6 +576,18 @@ static struct m920x_inits tvwalkertwin_rc_init [] = {
        { } /* terminating entry */
 };
 
+static struct m920x_inits pinnacle310e_init[] = {
+       /* without these the tuner don't work */
+       { 0xff20,         0x9b },
+       { 0xff22,         0x70 },
+
+       /* rc settings */
+       { 0xff50,         0x80 },
+       { M9206_RC_INIT1, 0x00 },
+       { M9206_RC_INIT2, 0xff },
+       { } /* terminating entry */
+};
+
 /* ir keymaps */
 static struct dvb_usb_rc_key megasky_rc_keys [] = {
        { 0x0012, KEY_POWER },
@@ -602,11 +628,68 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
        { 0x001e, KEY_VOLUMEUP },
 };
 
+static struct dvb_usb_rc_key pinnacle310e_rc_keys[] = {
+       { 0x16, KEY_POWER },
+       { 0x17, KEY_FAVORITES },
+       { 0x0f, KEY_TEXT },
+       { 0x48, KEY_MEDIA },            /* preview */
+       { 0x1c, KEY_EPG },
+       { 0x04, KEY_LIST },                     /* record list */
+       { 0x03, KEY_1 },
+       { 0x01, KEY_2 },
+       { 0x06, KEY_3 },
+       { 0x09, KEY_4 },
+       { 0x1d, KEY_5 },
+       { 0x1f, KEY_6 },
+       { 0x0d, KEY_7 },
+       { 0x19, KEY_8 },
+       { 0x1b, KEY_9 },
+       { 0x15, KEY_0 },
+       { 0x0c, KEY_CANCEL },
+       { 0x4a, KEY_CLEAR },
+       { 0x13, KEY_BACK },
+       { 0x00, KEY_TAB },
+       { 0x4b, KEY_UP },
+       { 0x4e, KEY_LEFT },
+       { 0x52, KEY_RIGHT },
+       { 0x51, KEY_DOWN },
+       { 0x4f, KEY_ENTER },            /* could also be KEY_OK */
+       { 0x1e, KEY_VOLUMEUP },
+       { 0x0a, KEY_VOLUMEDOWN },
+       { 0x05, KEY_CHANNELUP },
+       { 0x02, KEY_CHANNELDOWN },
+       { 0x11, KEY_RECORD },
+       { 0x14, KEY_PLAY },
+       { 0x4c, KEY_PAUSE },
+       { 0x1a, KEY_STOP },
+       { 0x40, KEY_REWIND },
+       { 0x12, KEY_FASTFORWARD },
+       { 0x41, KEY_PREVIOUSSONG },     /* Replay */
+       { 0x42, KEY_NEXTSONG },         /* Skip */
+       { 0x54, KEY_CAMERA },           /* Capture */
+/*     { 0x50, KEY_SAP },      */              /* Sap */
+       { 0x47, KEY_CYCLEWINDOWS },     /* Pip */
+       { 0x4d, KEY_SCREEN },           /* FullScreen */
+       { 0x08, KEY_SUBTITLE },
+       { 0x0e, KEY_MUTE },
+/*     { 0x49, KEY_LR },       */              /* L/R */
+       { 0x07, KEY_SLEEP },            /* Hibernate */
+       { 0x08, KEY_MEDIA },            /* A/V */
+       { 0x0e, KEY_MENU },                     /* Recall */
+       { 0x45, KEY_ZOOMIN },
+       { 0x46, KEY_ZOOMOUT },
+       { 0x18, KEY_TV },                       /* Red */
+       { 0x53, KEY_VCR },                      /* Green */
+       { 0x5e, KEY_SAT },                      /* Yellow */
+       { 0x5f, KEY_PLAYER },           /* Blue */
+};
+
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties megasky_properties;
 static struct dvb_usb_device_properties digivox_mini_ii_properties;
 static struct dvb_usb_device_properties tvwalkertwin_properties;
 static struct dvb_usb_device_properties dposh_properties;
+static struct dvb_usb_device_properties pinnacle_pctv310e_properties;
 
 static int m920x_probe(struct usb_interface *intf,
                       const struct usb_device_id *id)
@@ -652,6 +735,13 @@ static int m920x_probe(struct usb_interface *intf,
                        goto found;
                }
 
+               ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties,
+                                         THIS_MODULE, &d, adapter_nr);
+               if (ret == 0) {
+                       rc_init_seq = pinnacle310e_init;
+                       goto found;
+               }
+
                return ret;
        } else {
                /* Another interface on a multi-tuner device */
@@ -682,6 +772,7 @@ static struct usb_device_id m920x_table [] = {
                             USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
                { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
                { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
+               { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) },
                { }             /* Terminating entry */
 };
 MODULE_DEVICE_TABLE (usb, m920x_table);
@@ -895,6 +986,56 @@ static struct dvb_usb_device_properties dposh_properties = {
         }
 };
 
+static struct dvb_usb_device_properties pinnacle_pctv310e_properties = {
+       .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+       .usb_ctrl = DEVICE_SPECIFIC,
+       .download_firmware = NULL,
+
+       .rc_interval      = 100,
+       .rc_key_map       = pinnacle310e_rc_keys,
+       .rc_key_map_size  = ARRAY_SIZE(pinnacle310e_rc_keys),
+       .rc_query         = m920x_rc_query,
+
+       .size_of_priv     = sizeof(struct m920x_state),
+
+       .identify_state   = m920x_identify_state,
+       .num_adapters = 1,
+       .adapter = {{
+               .caps = DVB_USB_ADAP_HAS_PID_FILTER |
+                       DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+
+               .pid_filter_count = 8,
+               .pid_filter       = m920x_pid_filter,
+               .pid_filter_ctrl  = m920x_pid_filter_ctrl,
+
+               .frontend_attach  = m920x_mt352_frontend_attach,
+               .tuner_attach     = m920x_fmd1216me_tuner_attach,
+
+               .stream = {
+                       .type = USB_ISOC,
+                       .count = 5,
+                       .endpoint = 0x84,
+                       .u = {
+                               .isoc = {
+                                       .framesperurb = 128,
+                                       .framesize = 564,
+                                       .interval = 1,
+                               }
+                       }
+               },
+       } },
+       .i2c_algo         = &m920x_i2c_algo,
+
+       .num_device_descs = 1,
+       .devices = {
+               {   "Pinnacle PCTV 310e",
+                       { &m920x_table[6], NULL },
+                       { NULL },
+               }
+       }
+};
+
 static struct usb_driver m920x_driver = {
        .name           = "dvb_usb_m920x",
        .probe          = m920x_probe,
index 37532890accdd9cb16d37f5e7a5f6f9b3804ffdc..3c061518ffc160b8c45ac20c9a95dcbdbd3bf9c6 100644 (file)
@@ -18,7 +18,7 @@
 #define M9206_FW       0x30
 
 #define M9206_MAX_FILTERS 8
-#define M9206_MAX_ADAPTERS 2
+#define M9206_MAX_ADAPTERS 4
 
 /*
 sequences found in logs:
index d4e230941679a880ac154d21d5db31104c4f8275..830557696ae6ff0a39c043833fa16b44e4f0c0a6 100644 (file)
@@ -138,7 +138,7 @@ static int opera1_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
                                        (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0),
                                        msg[i].buf,
                                        msg[i].len
-                                       )!= msg[i].len)) {
+                                       )) != msg[i].len) {
                        break;
                }
                if (dvb_usb_opera1_debug & 0x10)
index 7c5459c27b753b8fa0a62d0a24d506170b1b61d1..c3e0ec2dcfca56641b680162e5420ed976d19e4c 100644 (file)
@@ -90,13 +90,14 @@ static inline struct node_entry *node_of(struct firedtv *fdtv)
        return container_of(fdtv->device, struct unit_directory, device)->ne;
 }
 
-static int node_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
+static int node_lock(struct firedtv *fdtv, u64 addr, void *data)
 {
+       quadlet_t *d = data;
        int ret;
 
-       ret = hpsb_node_lock(node_of(fdtv), addr, EXTCODE_COMPARE_SWAP,
-               (__force quadlet_t *)&data[1], (__force quadlet_t)data[0]);
-       data[0] = data[1];
+       ret = hpsb_node_lock(node_of(fdtv), addr,
+                            EXTCODE_COMPARE_SWAP, &d[1], d[0]);
+       d[0] = d[1];
 
        return ret;
 }
@@ -192,9 +193,13 @@ static int node_probe(struct device *dev)
        int kv_len, err;
        void *kv_str;
 
-       kv_len = (ud->model_name_kv->value.leaf.len - 2) * sizeof(quadlet_t);
-       kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv);
-
+       if (ud->model_name_kv) {
+               kv_len = (ud->model_name_kv->value.leaf.len - 2) * 4;
+               kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv);
+       } else {
+               kv_len = 0;
+               kv_str = NULL;
+       }
        fdtv = fdtv_alloc(dev, &fdtv_1394_backend, kv_str, kv_len);
        if (!fdtv)
                return -ENOMEM;
index 50c42a4b972b1ea7970847202f5bebac20832614..1b31bebc27d6f6ca8a207a2290c5c0a8e3271877 100644 (file)
@@ -74,7 +74,6 @@
 #define EN50221_TAG_CA_INFO            0x9f8031
 
 struct avc_command_frame {
-       int length;
        u8 ctype;
        u8 subunit;
        u8 opcode;
@@ -82,13 +81,27 @@ struct avc_command_frame {
 };
 
 struct avc_response_frame {
-       int length;
        u8 response;
        u8 subunit;
        u8 opcode;
        u8 operand[509];
 };
 
+#define LAST_OPERAND (509 - 1)
+
+static inline void clear_operands(struct avc_command_frame *c, int from, int to)
+{
+       memset(&c->operand[from], 0, to - from + 1);
+}
+
+static void pad_operands(struct avc_command_frame *c, int from)
+{
+       int to = ALIGN(from, 4);
+
+       if (from <= to && to <= LAST_OPERAND)
+               clear_operands(c, from, to);
+}
+
 #define AVC_DEBUG_READ_DESCRIPTOR              0x0001
 #define AVC_DEBUG_DSIT                         0x0002
 #define AVC_DEBUG_DSD                          0x0004
@@ -202,78 +215,65 @@ static void debug_pmt(char *msg, int length)
                       16, 1, msg, length, false);
 }
 
-static int __avc_write(struct firedtv *fdtv,
-               const struct avc_command_frame *c, struct avc_response_frame *r)
+static int avc_write(struct firedtv *fdtv)
 {
        int err, retry;
 
-       if (r)
-               fdtv->avc_reply_received = false;
+       fdtv->avc_reply_received = false;
 
        for (retry = 0; retry < 6; retry++) {
                if (unlikely(avc_debug))
-                       debug_fcp(&c->ctype, c->length);
+                       debug_fcp(fdtv->avc_data, fdtv->avc_data_length);
 
                err = fdtv->backend->write(fdtv, FCP_COMMAND_REGISTER,
-                                          (void *)&c->ctype, c->length);
+                               fdtv->avc_data, fdtv->avc_data_length);
                if (err) {
-                       fdtv->avc_reply_received = true;
                        dev_err(fdtv->device, "FCP command write failed\n");
+
                        return err;
                }
 
-               if (!r)
-                       return 0;
-
                /*
                 * AV/C specs say that answers should be sent within 150 ms.
                 * Time out after 200 ms.
                 */
                if (wait_event_timeout(fdtv->avc_wait,
                                       fdtv->avc_reply_received,
-                                      msecs_to_jiffies(200)) != 0) {
-                       r->length = fdtv->response_length;
-                       memcpy(&r->response, fdtv->response, r->length);
-
+                                      msecs_to_jiffies(200)) != 0)
                        return 0;
-               }
        }
        dev_err(fdtv->device, "FCP response timed out\n");
+
        return -ETIMEDOUT;
 }
 
-static int avc_write(struct firedtv *fdtv,
-               const struct avc_command_frame *c, struct avc_response_frame *r)
+static bool is_register_rc(struct avc_response_frame *r)
 {
-       int ret;
-
-       if (mutex_lock_interruptible(&fdtv->avc_mutex))
-               return -EINTR;
-
-       ret = __avc_write(fdtv, c, r);
-
-       mutex_unlock(&fdtv->avc_mutex);
-       return ret;
+       return r->opcode     == AVC_OPCODE_VENDOR &&
+              r->operand[0] == SFE_VENDOR_DE_COMPANYID_0 &&
+              r->operand[1] == SFE_VENDOR_DE_COMPANYID_1 &&
+              r->operand[2] == SFE_VENDOR_DE_COMPANYID_2 &&
+              r->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL;
 }
 
 int avc_recv(struct firedtv *fdtv, void *data, size_t length)
 {
-       struct avc_response_frame *r =
-                       data - offsetof(struct avc_response_frame, response);
+       struct avc_response_frame *r = data;
 
        if (unlikely(avc_debug))
                debug_fcp(data, length);
 
-       if (length >= 8 &&
-           r->operand[0] == SFE_VENDOR_DE_COMPANYID_0 &&
-           r->operand[1] == SFE_VENDOR_DE_COMPANYID_1 &&
-           r->operand[2] == SFE_VENDOR_DE_COMPANYID_2 &&
-           r->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) {
-               if (r->response == AVC_RESPONSE_CHANGED) {
-                       fdtv_handle_rc(fdtv,
-                           r->operand[4] << 8 | r->operand[5]);
+       if (length >= 8 && is_register_rc(r)) {
+               switch (r->response) {
+               case AVC_RESPONSE_CHANGED:
+                       fdtv_handle_rc(fdtv, r->operand[4] << 8 | r->operand[5]);
                        schedule_work(&fdtv->remote_ctrl_work);
-               } else if (r->response != AVC_RESPONSE_INTERIM) {
+                       break;
+               case AVC_RESPONSE_INTERIM:
+                       if (is_register_rc((void *)fdtv->avc_data))
+                               goto wake;
+                       break;
+               default:
                        dev_info(fdtv->device,
                                 "remote control result = %d\n", r->response);
                }
@@ -285,9 +285,9 @@ int avc_recv(struct firedtv *fdtv, void *data, size_t length)
                return -EIO;
        }
 
-       memcpy(fdtv->response, data, length);
-       fdtv->response_length = length;
-
+       memcpy(fdtv->avc_data, data, length);
+       fdtv->avc_data_length = length;
+wake:
        fdtv->avc_reply_received = true;
        wake_up(&fdtv->avc_wait);
 
@@ -318,10 +318,11 @@ static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
  * tuning command for setting the relative LNB frequency
  * (not supported by the AVC standard)
  */
-static void avc_tuner_tuneqpsk(struct firedtv *fdtv,
-                              struct dvb_frontend_parameters *params,
-                              struct avc_command_frame *c)
+static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
+                             struct dvb_frontend_parameters *params)
 {
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+
        c->opcode = AVC_OPCODE_VENDOR;
 
        c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
@@ -370,16 +371,18 @@ static void avc_tuner_tuneqpsk(struct firedtv *fdtv,
                c->operand[13] = 0x1;
                c->operand[14] = 0xff;
                c->operand[15] = 0xff;
-               c->length = 20;
+
+               return 16;
        } else {
-               c->length = 16;
+               return 13;
        }
 }
 
-static void avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
-                               struct dvb_frontend_parameters *params,
-                               struct avc_command_frame *c)
+static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
+                              struct dvb_frontend_parameters *params)
 {
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+
        c->opcode = AVC_OPCODE_DSD;
 
        c->operand[0] = 0;    /* source plug */
@@ -440,15 +443,14 @@ static void avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
        c->operand[20] = 0x00;
        c->operand[21] = 0x00;
 
-       /* Add PIDs to filter */
-       c->length = ALIGN(22 + add_pid_filter(fdtv, &c->operand[22]) + 3, 4);
+       return 22 + add_pid_filter(fdtv, &c->operand[22]);
 }
 
-static void avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
-                               struct dvb_frontend_parameters *params,
-                               struct avc_command_frame *c)
+static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
+                              struct dvb_frontend_parameters *params)
 {
        struct dvb_ofdm_parameters *ofdm = &params->u.ofdm;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
 
        c->opcode = AVC_OPCODE_DSD;
 
@@ -543,55 +545,58 @@ static void avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
        c->operand[15] = 0x00; /* network_ID[0] */
        c->operand[16] = 0x00; /* network_ID[1] */
 
-       /* Add PIDs to filter */
-       c->length = ALIGN(17 + add_pid_filter(fdtv, &c->operand[17]) + 3, 4);
+       return 17 + add_pid_filter(fdtv, &c->operand[17]);
 }
 
 int avc_tuner_dsd(struct firedtv *fdtv,
                  struct dvb_frontend_parameters *params)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int pos, ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
 
        switch (fdtv->type) {
        case FIREDTV_DVB_S:
-       case FIREDTV_DVB_S2: avc_tuner_tuneqpsk(fdtv, params, c); break;
-       case FIREDTV_DVB_C: avc_tuner_dsd_dvb_c(fdtv, params, c); break;
-       case FIREDTV_DVB_T: avc_tuner_dsd_dvb_t(fdtv, params, c); break;
+       case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break;
+       case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break;
+       case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break;
        default:
                BUG();
        }
+       pad_operands(c, pos);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
-
-       msleep(500);
+       fdtv->avc_data_length = ALIGN(3 + pos, 4);
+       ret = avc_write(fdtv);
 #if 0
-       /* FIXME: */
-       /* u8 *status was an out-parameter of avc_tuner_dsd, unused by caller */
+       /*
+        * FIXME:
+        * u8 *status was an out-parameter of avc_tuner_dsd, unused by caller.
+        * Check for AVC_RESPONSE_ACCEPTED here instead?
+        */
        if (status)
                *status = r->operand[2];
 #endif
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       if (ret == 0)
+               msleep(500);
+
+       return ret;
 }
 
 int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
-       int pos, k;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret, pos, k;
 
        if (pidc > 16 && pidc != 0xff)
                return -EINVAL;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -614,24 +619,27 @@ int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
                        c->operand[pos++] = 0x00; /* tableID */
                        c->operand[pos++] = 0x00; /* filter_length */
                }
+       pad_operands(c, pos);
 
-       c->length = ALIGN(3 + pos, 4);
+       fdtv->avc_data_length = ALIGN(3 + pos, 4);
+       ret = avc_write(fdtv);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code? */
 
-       msleep(50);
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       if (ret == 0)
+               msleep(50);
+
+       return ret;
 }
 
 int avc_tuner_get_ts(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
-       int sl;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret, sl;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -646,26 +654,33 @@ int avc_tuner_get_ts(struct firedtv *fdtv)
        c->operand[4] = 0x00;   /* antenna number */
        c->operand[5] = 0x0;    /* system_specific_search_flags */
        c->operand[6] = sl;     /* system_specific_multiplex selection_length */
-       c->operand[7] = 0x00;   /* valid_flags [0] */
-       c->operand[8] = 0x00;   /* valid_flags [1] */
-       c->operand[7 + sl] = 0x00; /* nr_of_dsit_sel_specs (always 0) */
+       /*
+        * operand[7]: valid_flags[0]
+        * operand[8]: valid_flags[1]
+        * operand[7 + sl]: nr_of_dsit_sel_specs (always 0)
+        */
+       clear_operands(c, 7, 24);
 
-       c->length = fdtv->type == FIREDTV_DVB_T ? 24 : 28;
+       fdtv->avc_data_length = fdtv->type == FIREDTV_DVB_T ? 24 : 28;
+       ret = avc_write(fdtv);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code? */
 
-       msleep(250);
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       if (ret == 0)
+               msleep(250);
+
+       return ret;
 }
 
 int avc_identify_subunit(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -678,31 +693,34 @@ int avc_identify_subunit(struct firedtv *fdtv)
        c->operand[4] = 0x08; /* length lowbyte  */
        c->operand[5] = 0x00; /* offset highbyte */
        c->operand[6] = 0x0d; /* offset lowbyte  */
+       clear_operands(c, 7, 8); /* padding */
 
-       c->length = 12;
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        if ((r->response != AVC_RESPONSE_STABLE &&
             r->response != AVC_RESPONSE_ACCEPTED) ||
            (r->operand[3] << 8) + r->operand[4] != 8) {
                dev_err(fdtv->device, "cannot read subunit identifier\n");
-               return -EINVAL;
+               ret = -EINVAL;
        }
-       return 0;
+out:
+       mutex_unlock(&fdtv->avc_mutex);
+
+       return ret;
 }
 
 #define SIZEOF_ANTENNA_INPUT_INFO 22
 
 int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
-       int length;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int length, ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -710,27 +728,30 @@ int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
 
        c->operand[0] = DESCRIPTOR_TUNER_STATUS;
        c->operand[1] = 0xff;   /* read_result_status */
-       c->operand[2] = 0x00;   /* reserved */
-       c->operand[3] = 0;      /* SIZEOF_ANTENNA_INPUT_INFO >> 8; */
-       c->operand[4] = 0;      /* SIZEOF_ANTENNA_INPUT_INFO & 0xff; */
-       c->operand[5] = 0x00;
-       c->operand[6] = 0x00;
-
-       c->length = 12;
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /*
+        * operand[2]: reserved
+        * operand[3]: SIZEOF_ANTENNA_INPUT_INFO >> 8
+        * operand[4]: SIZEOF_ANTENNA_INPUT_INFO & 0xff
+        */
+       clear_operands(c, 2, 31);
+
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        if (r->response != AVC_RESPONSE_STABLE &&
            r->response != AVC_RESPONSE_ACCEPTED) {
                dev_err(fdtv->device, "cannot read tuner status\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
        }
 
        length = r->operand[9];
        if (r->operand[1] != 0x10 || length != SIZEOF_ANTENNA_INPUT_INFO) {
                dev_err(fdtv->device, "got invalid tuner status\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
        }
 
        stat->active_system             = r->operand[10];
@@ -766,20 +787,21 @@ int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
        stat->ca_dvb_flag               = r->operand[31] >> 3 & 1;
        stat->ca_error_flag             = r->operand[31] >> 2 & 1;
        stat->ca_initialization_status  = r->operand[31] >> 1 & 1;
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
                    char conttone, char nrdiseq,
                    struct dvb_diseqc_master_cmd *diseqcmd)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
-       int i, j, k;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int pos, j, k, ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -789,41 +811,41 @@ int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
        c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
        c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
        c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL;
-
        c->operand[4] = voltage;
        c->operand[5] = nrdiseq;
 
-       i = 6;
-
+       pos = 6;
        for (j = 0; j < nrdiseq; j++) {
-               c->operand[i++] = diseqcmd[j].msg_len;
+               c->operand[pos++] = diseqcmd[j].msg_len;
 
                for (k = 0; k < diseqcmd[j].msg_len; k++)
-                       c->operand[i++] = diseqcmd[j].msg[k];
+                       c->operand[pos++] = diseqcmd[j].msg[k];
        }
+       c->operand[pos++] = burst;
+       c->operand[pos++] = conttone;
+       pad_operands(c, pos);
 
-       c->operand[i++] = burst;
-       c->operand[i++] = conttone;
-
-       c->length = ALIGN(3 + i, 4);
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = ALIGN(3 + pos, 4);
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        if (r->response != AVC_RESPONSE_ACCEPTED) {
                dev_err(fdtv->device, "LNB control failed\n");
-               return -EINVAL;
+               ret = -EINVAL;
        }
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_register_remote_control(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_NOTIFY;
        c->subunit = AVC_SUBUNIT_TYPE_UNIT | 7;
@@ -833,10 +855,16 @@ int avc_register_remote_control(struct firedtv *fdtv)
        c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
        c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
        c->operand[3] = SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL;
+       c->operand[4] = 0; /* padding */
+
+       fdtv->avc_data_length = 8;
+       ret = avc_write(fdtv);
 
-       c->length = 8;
+       /* FIXME: check response code? */
 
-       return avc_write(fdtv, c, NULL);
+       mutex_unlock(&fdtv->avc_mutex);
+
+       return ret;
 }
 
 void avc_remote_ctrl_work(struct work_struct *work)
@@ -851,11 +879,10 @@ void avc_remote_ctrl_work(struct work_struct *work)
 #if 0 /* FIXME: unused */
 int avc_tuner_host2ca(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -867,15 +894,16 @@ int avc_tuner_host2ca(struct firedtv *fdtv)
        c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
-       c->operand[6] = 0; /* more/last */
-       c->operand[7] = 0; /* length */
+       clear_operands(c, 6, 8);
 
-       c->length = 12;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code? */
 
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       return ret;
 }
 #endif
 
@@ -906,12 +934,11 @@ static int get_ca_object_length(struct avc_response_frame *r)
 
 int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
-       int pos;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int pos, ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_STATUS;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -923,11 +950,12 @@ int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
        c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
+       clear_operands(c, 6, LAST_OPERAND);
 
-       c->length = 12;
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        /* FIXME: check response code and validate response data */
 
@@ -939,18 +967,19 @@ int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
        app_info[4] = 0x01;
        memcpy(&app_info[5], &r->operand[pos], 5 + r->operand[pos + 4]);
        *len = app_info[3] + 4;
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
-       int pos;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int pos, ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_STATUS;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -962,11 +991,14 @@ int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
        c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
+       clear_operands(c, 6, LAST_OPERAND);
 
-       c->length = 12;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code and validate response data */
 
        pos = get_ca_object_pos(r);
        app_info[0] = (EN50221_TAG_CA_INFO >> 16) & 0xff;
@@ -976,17 +1008,18 @@ int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
        app_info[4] = r->operand[pos + 0];
        app_info[5] = r->operand[pos + 1];
        *len = app_info[3] + 4;
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_ca_reset(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -1002,19 +1035,20 @@ int avc_ca_reset(struct firedtv *fdtv)
        c->operand[7] = 1; /* length */
        c->operand[8] = 0; /* force hardware reset */
 
-       c->length = 12;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code? */
 
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       return ret;
 }
 
 int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
        int list_management;
        int program_info_length;
        int pmt_cmd_id;
@@ -1022,11 +1056,12 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
        int write_pos;
        int es_info_length;
        int crc32_csum;
+       int ret;
 
        if (unlikely(avc_debug & AVC_DEBUG_APPLICATION_PMT))
                debug_pmt(msg, length);
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_CONTROL;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -1058,7 +1093,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
 
        c->operand[12] = 0x02; /* Table id=2 */
        c->operand[13] = 0x80; /* Section syntax + length */
-       /* c->operand[14] = XXXprogram_info_length + 12; */
+
        c->operand[15] = msg[1]; /* Program number */
        c->operand[16] = msg[2];
        c->operand[17] = 0x01; /* Version number=0 + current/next=1 */
@@ -1106,12 +1141,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
                        write_pos += es_info_length;
                }
        }
-
-       /* CRC */
-       c->operand[write_pos++] = 0x00;
-       c->operand[write_pos++] = 0x00;
-       c->operand[write_pos++] = 0x00;
-       c->operand[write_pos++] = 0x00;
+       write_pos += 4; /* CRC */
 
        c->operand[7] = 0x82;
        c->operand[8] = (write_pos - 10) >> 8;
@@ -1123,28 +1153,31 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
        c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff;
        c->operand[write_pos - 2] = (crc32_csum >>  8) & 0xff;
        c->operand[write_pos - 1] = (crc32_csum >>  0) & 0xff;
+       pad_operands(c, write_pos);
 
-       c->length = ALIGN(3 + write_pos, 4);
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = ALIGN(3 + write_pos, 4);
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        if (r->response != AVC_RESPONSE_ACCEPTED) {
                dev_err(fdtv->device,
                        "CA PMT failed with response 0x%x\n", r->response);
-               return -EFAULT;
+               ret = -EFAULT;
        }
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_STATUS;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -1156,28 +1189,28 @@ int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
        c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_DATE_TIME; /* ca tag */
-       c->operand[6] = 0; /* more/last */
-       c->operand[7] = 0; /* length */
+       clear_operands(c, 6, LAST_OPERAND);
 
-       c->length = 12;
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        /* FIXME: check response code and validate response data */
 
        *interval = r->operand[get_ca_object_pos(r)];
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 int avc_ca_enter_menu(struct firedtv *fdtv)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer; /* FIXME: unused */
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_STATUS;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -1189,24 +1222,25 @@ int avc_ca_enter_menu(struct firedtv *fdtv)
        c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_ENTER_MENU;
-       c->operand[6] = 0; /* more/last */
-       c->operand[7] = 0; /* length */
+       clear_operands(c, 6, 8);
 
-       c->length = 12;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
 
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       /* FIXME: check response code? */
 
-       return 0;
+       mutex_unlock(&fdtv->avc_mutex);
+
+       return ret;
 }
 
 int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
 {
-       char buffer[sizeof(struct avc_command_frame)];
-       struct avc_command_frame *c = (void *)buffer;
-       struct avc_response_frame *r = (void *)buffer;
+       struct avc_command_frame *c = (void *)fdtv->avc_data;
+       struct avc_response_frame *r = (void *)fdtv->avc_data;
+       int ret;
 
-       memset(c, 0, sizeof(*c));
+       mutex_lock(&fdtv->avc_mutex);
 
        c->ctype   = AVC_CTYPE_STATUS;
        c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
@@ -1218,20 +1252,21 @@ int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
        c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST;
        c->operand[4] = 0; /* slot */
        c->operand[5] = SFE_VENDOR_TAG_CA_MMI;
-       c->operand[6] = 0; /* more/last */
-       c->operand[7] = 0; /* length */
+       clear_operands(c, 6, LAST_OPERAND);
 
-       c->length = 12;
-
-       if (avc_write(fdtv, c, r) < 0)
-               return -EIO;
+       fdtv->avc_data_length = 12;
+       ret = avc_write(fdtv);
+       if (ret < 0)
+               goto out;
 
        /* FIXME: check response code and validate response data */
 
        *len = get_ca_object_length(r);
        memcpy(mmi_object, &r->operand[get_ca_object_pos(r)], *len);
+out:
+       mutex_unlock(&fdtv->avc_mutex);
 
-       return 0;
+       return ret;
 }
 
 #define CMP_OUTPUT_PLUG_CONTROL_REG_0  0xfffff0000904ULL
@@ -1240,14 +1275,14 @@ static int cmp_read(struct firedtv *fdtv, u64 addr, __be32 *data)
 {
        int ret;
 
-       if (mutex_lock_interruptible(&fdtv->avc_mutex))
-               return -EINTR;
+       mutex_lock(&fdtv->avc_mutex);
 
        ret = fdtv->backend->read(fdtv, addr, data);
        if (ret < 0)
                dev_err(fdtv->device, "CMP: read I/O error\n");
 
        mutex_unlock(&fdtv->avc_mutex);
+
        return ret;
 }
 
@@ -1255,14 +1290,19 @@ static int cmp_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
 {
        int ret;
 
-       if (mutex_lock_interruptible(&fdtv->avc_mutex))
-               return -EINTR;
+       mutex_lock(&fdtv->avc_mutex);
+
+       /* data[] is stack-allocated and should not be DMA-mapped. */
+       memcpy(fdtv->avc_data, data, 8);
 
-       ret = fdtv->backend->lock(fdtv, addr, data);
+       ret = fdtv->backend->lock(fdtv, addr, fdtv->avc_data);
        if (ret < 0)
                dev_err(fdtv->device, "CMP: lock I/O error\n");
+       else
+               memcpy(data, fdtv->avc_data, 8);
 
        mutex_unlock(&fdtv->avc_mutex);
+
        return ret;
 }
 
index fc9996c13e134f0a7a4d97c8f12022c091ca5d02..079e8c5b047567e40fe104314c417ed7bae676c5 100644 (file)
@@ -277,7 +277,6 @@ struct firedtv *fdtv_alloc(struct device *dev,
 
        mutex_init(&fdtv->avc_mutex);
        init_waitqueue_head(&fdtv->avc_wait);
-       fdtv->avc_reply_received = true;
        mutex_init(&fdtv->demux_mutex);
        INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work);
 
index 6223bf01efe96893db6662bd5e308a8a59af6333..7a3de16fba0698e73bbd79df740efe4fe4e09630 100644 (file)
@@ -41,7 +41,7 @@ static int node_req(struct firedtv *fdtv, u64 addr, void *data, size_t len,
        return rcode != RCODE_COMPLETE ? -EIO : 0;
 }
 
-static int node_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
+static int node_lock(struct firedtv *fdtv, u64 addr, void *data)
 {
        return node_req(fdtv, addr, data, 8, TCODE_LOCK_COMPARE_SWAP);
 }
index 35080dbb3c66d523eba1af277397b0c6c4fe2e8f..78cc28f36914bcf3fde09f2ce7c74328f063a0ae 100644 (file)
@@ -73,7 +73,7 @@ struct input_dev;
 struct firedtv;
 
 struct firedtv_backend {
-       int (*lock)(struct firedtv *fdtv, u64 addr, __be32 data[]);
+       int (*lock)(struct firedtv *fdtv, u64 addr, void *data);
        int (*read)(struct firedtv *fdtv, u64 addr, void *data);
        int (*write)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
        int (*start_iso)(struct firedtv *fdtv);
@@ -114,8 +114,8 @@ struct firedtv {
        unsigned long           channel_active;
        u16                     channel_pid[16];
 
-       size_t                  response_length;
-       u8                      response[512];
+       int                     avc_data_length;
+       u8                      avc_data[512];
 };
 
 /* firedtv-1394.c */
index a3b8b697349b130f161daf1dc747d40c89ffcdb7..cd7f9b7cbffabad65972ca372b03e6830c19b7a4 100644 (file)
@@ -208,6 +208,14 @@ config DVB_DS3000
        help
          A DVB-S/S2 tuner module. Say Y when you want to support this frontend.
 
+config DVB_MB86A16
+       tristate "Fujitsu MB86A16 based"
+       depends on DVB_CORE && I2C
+       default m if DVB_FE_CUSTOMISE
+       help
+         A DVB-S/DSS Direct Conversion reveiver.
+         Say Y when you want to support this frontend.
+
 comment "DVB-T (terrestrial) frontends"
        depends on DVB_CORE
 
@@ -587,6 +595,17 @@ config DVB_ATBM8830
        help
          A DMB-TH tuner module. Say Y when you want to support this frontend.
 
+config DVB_TDA665x
+       tristate "TDA665x tuner"
+       depends on DVB_CORE && I2C
+       default m if DVB_FE_CUSTOMISE
+       help
+         Support for tuner modules based on Philips TDA6650/TDA6651 chips.
+         Say Y when you want to support this chip.
+
+         Currently supported tuners:
+         * Panasonic ENV57H12D5 (ET-50DT)
+
 comment "Tools to develop new frontends"
 
 config DVB_DUMMY_FE
index 47575cc7b699cea3a431b6d1c29093847402a5e8..874e8ada4d1dbec59bc089314213bcf1beadf920 100644 (file)
@@ -64,6 +64,7 @@ obj-$(CONFIG_DVB_TDA10048) += tda10048.o
 obj-$(CONFIG_DVB_TUNER_CX24113) += cx24113.o
 obj-$(CONFIG_DVB_S5H1411) += s5h1411.o
 obj-$(CONFIG_DVB_LGS8GL5) += lgs8gl5.o
+obj-$(CONFIG_DVB_TDA665x) += tda665x.o
 obj-$(CONFIG_DVB_LGS8GXX) += lgs8gxx.o
 obj-$(CONFIG_DVB_ATBM8830) += atbm8830.o
 obj-$(CONFIG_DVB_DUMMY_FE) += dvb_dummy_fe.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_DVB_STV6110x) += stv6110x.o
 obj-$(CONFIG_DVB_ISL6423) += isl6423.o
 obj-$(CONFIG_DVB_EC100) += ec100.o
 obj-$(CONFIG_DVB_DS3000) += ds3000.o
+obj-$(CONFIG_DVB_MB86A16) += mb86a16.o
index 28b90c91c766fee52297f5a4eba0c57c857cefe0..e90fa92b1c1dc963033218f2558abaa2de84155c 100644 (file)
@@ -44,6 +44,7 @@ enum af9013_tuner {
        AF9013_TUNER_MT2060_2   = 147, /* Microtune */
        AF9013_TUNER_TDA18271   = 156, /* NXP */
        AF9013_TUNER_QT1010A    = 162, /* Quantek */
+       AF9013_TUNER_TDA18218   = 179, /* NXP */
 };
 
 /* AF9013/5 GPIOs (mostly guessed)
index 59881a5944eb4a43ed9509728830dfdca187fe6d..43aac2f85c2e5ccd895288d20bbdcfb7c668930a 100644 (file)
@@ -170,6 +170,19 @@ static int is_locked(struct atbm_state *priv, u8 *locked)
        return 0;
 }
 
+static int set_agc_config(struct atbm_state *priv,
+       u8 min, u8 max, u8 hold_loop)
+{
+       /* no effect if both min and max are zero */
+       if (!min && !max)
+           return 0;
+
+       atbm8830_write_reg(priv, REG_AGC_MIN, min);
+       atbm8830_write_reg(priv, REG_AGC_MAX, max);
+       atbm8830_write_reg(priv, REG_AGC_HOLD_LOOP, hold_loop);
+
+       return 0;
+}
 
 static int set_static_channel_mode(struct atbm_state *priv)
 {
@@ -227,6 +240,9 @@ static int atbm8830_init(struct dvb_frontend *fe)
        /*Set IF frequency*/
        set_if_freq(priv, cfg->if_freq);
 
+       /*Set AGC Config*/
+       set_agc_config(priv, cfg->agc_min, cfg->agc_max,
+               cfg->agc_hold_loop);
 
        /*Set static channel mode*/
        set_static_channel_mode(priv);
index 614552709a6faac0b38d98b968ef13497b89c6b2..7eac178f57b2c10093198c653b4e03e332c9e431 100644 (file)
@@ -283,7 +283,7 @@ static int dib0090_sleep(struct dvb_frontend *fe)
        return 0;
 }
 
-extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
+void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
 {
        struct dib0090_state *state = fe->tuner_priv;
        if (fast)
index 6f6fa29d9ea4310877301a520858fe354a13cd8a..2aa97dd6a8afdb71e93b49a1e20b0c6fac32df1c 100644 (file)
@@ -1999,6 +1999,8 @@ static int dib8000_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par
        struct dib8000_state *state = fe->demodulator_priv;
        int time, ret;
 
+       fe->dtv_property_cache.delivery_system = SYS_ISDBT;
+
        dib8000_set_output_mode(state, OUTMODE_HIGH_Z);
 
        if (fe->ops.tuner_ops.set_params)
index d99619ae983ce4ea9528ba273381c950b5a6e5ff..b1ee20799639e5785b045fb595ed57d05d097347 100644 (file)
@@ -100,7 +100,7 @@ static inline int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_
 static inline enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe)
 {
        printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
-    return CT_SHUTDOWN,
+       return CT_SHUTDOWN;
 }
 static inline void dib8000_pwm_agc_reset(struct dvb_frontend *fe)
 {
index e6f3d73db9d33e6cac8fbf34aa969cbf24de530e..980e02f1575e35f6ce56f6c208988b87ba69a47c 100644 (file)
@@ -174,7 +174,7 @@ void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst)
 EXPORT_SYMBOL(dibx000_exit_i2c_master);
 
 
-u32 systime()
+u32 systime(void)
 {
     struct timespec t;
 
index 3051b64aa17c6bd3c8d7b3fbaad1727908d92b26..445fa10680644c9d546d5aa8644947e6b5587573 100644 (file)
@@ -192,8 +192,8 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa
        spi_bias *= qam_tab[p->constellation];
        spi_bias /= p->code_rate_HP + 1;
        spi_bias /= (guard_tab[p->guard_interval] + 32);
-       spi_bias *= 1000ULL;
-       spi_bias /= 1000ULL + ppm/1000;
+       spi_bias *= 1000;
+       spi_bias /= 1000 + ppm/1000;
        spi_bias *= p->code_rate_HP;
 
        val0x04 = (p->transmission_mode << 2) | p->guard_interval;
index 4fa6e52d1fe8a23ee428d9fddc400d6a733d2362..9cb11c9cae53eb4ad097165b9065e589bc5a3325 100644 (file)
@@ -54,13 +54,13 @@ struct lgdt3305_config {
        u16 usref_qam256; /* default: 0x2a80 */
 
        /* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
-       int deny_i2c_rptr:1;
+       unsigned int deny_i2c_rptr:1;
 
        /* spectral inversion - 0:disabled 1:enabled */
-       int spectral_inversion:1;
+       unsigned int spectral_inversion:1;
 
        /* use RF AGC loop - 0:disabled 1:enabled */
-       int rf_agc_loop:1;
+       unsigned int rf_agc_loop:1;
 
        enum lgdt3305_mpeg_mode mpeg_mode;
        enum lgdt3305_tp_clock_edge tpclk_edge;
index b181bf023adab96444fca28092c72a23a2abac41..13437259eeac211d69ef8c0cd8f4c96ce9103998 100644 (file)
@@ -158,7 +158,8 @@ static struct dvb_frontend *lnbx2x_attach(struct dvb_frontend *fe,
        /* override frontend ops */
        fe->ops.set_voltage = lnbp21_set_voltage;
        fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
-       fe->ops.set_tone = lnbp21_set_tone;
+       if (!(override_clear & LNBH24_TEN)) /*22kHz logic controlled by demod*/
+               fe->ops.set_tone = lnbp21_set_tone;
        printk(KERN_INFO "LNBx2x attached on addr=%x\n", lnbp21->i2c_addr);
 
        return fe;
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
new file mode 100644 (file)
index 0000000..d05f750
--- /dev/null
@@ -0,0 +1,1878 @@
+/*
+       Fujitsu MB86A16 DVB-S/DSS DC Receiver driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+
+#include "dvb_frontend.h"
+#include "mb86a16.h"
+#include "mb86a16_priv.h"
+
+unsigned int verbose = 5;
+module_param(verbose, int, 0644);
+
+#define ABS(x)         ((x) < 0 ? (-x) : (x))
+
+struct mb86a16_state {
+       struct i2c_adapter              *i2c_adap;
+       const struct mb86a16_config     *config;
+       struct dvb_frontend             frontend;
+
+       /* tuning parameters */
+       int                             frequency;
+       int                             srate;
+
+       /* Internal stuff */
+       int                             master_clk;
+       int                             deci;
+       int                             csel;
+       int                             rsel;
+};
+
+#define MB86A16_ERROR          0
+#define MB86A16_NOTICE         1
+#define MB86A16_INFO           2
+#define MB86A16_DEBUG          3
+
+#define dprintk(x, y, z, format, arg...) do {                                          \
+       if (z) {                                                                        \
+               if      ((x > MB86A16_ERROR) && (x > y))                                \
+                       printk(KERN_ERR "%s: " format "\n", __func__, ##arg);           \
+               else if ((x > MB86A16_NOTICE) && (x > y))                               \
+                       printk(KERN_NOTICE "%s: " format "\n", __func__, ##arg);        \
+               else if ((x > MB86A16_INFO) && (x > y))                                 \
+                       printk(KERN_INFO "%s: " format "\n", __func__, ##arg);          \
+               else if ((x > MB86A16_DEBUG) && (x > y))                                \
+                       printk(KERN_DEBUG "%s: " format "\n", __func__, ##arg);         \
+       } else {                                                                        \
+               if (x > y)                                                              \
+                       printk(format, ##arg);                                          \
+       }                                                                               \
+} while (0)
+
+#define TRACE_IN       dprintk(verbose, MB86A16_DEBUG, 1, "-->()")
+#define TRACE_OUT      dprintk(verbose, MB86A16_DEBUG, 1, "()-->")
+
+static int mb86a16_write(struct mb86a16_state *state, u8 reg, u8 val)
+{
+       int ret;
+       u8 buf[] = { reg, val };
+
+       struct i2c_msg msg = {
+               .addr = state->config->demod_address,
+               .flags = 0,
+               .buf = buf,
+               .len = 2
+       };
+
+       dprintk(verbose, MB86A16_DEBUG, 1,
+               "writing to [0x%02x],Reg[0x%02x],Data[0x%02x]",
+               state->config->demod_address, buf[0], buf[1]);
+
+       ret = i2c_transfer(state->i2c_adap, &msg, 1);
+
+       return (ret != 1) ? -EREMOTEIO : 0;
+}
+
+static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
+{
+       int ret;
+       u8 b0[] = { reg };
+       u8 b1[] = { 0 };
+
+       struct i2c_msg msg[] = {
+               {
+                       .addr = state->config->demod_address,
+                       .flags = 0,
+                       .buf = b0,
+                       .len = 1
+               }, {
+                       .addr = state->config->demod_address,
+                       .flags = I2C_M_RD,
+                       .buf = b1,
+                       .len = 1
+               }
+       };
+       ret = i2c_transfer(state->i2c_adap, msg, 2);
+       if (ret != 2) {
+               dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%i)",
+                       reg, ret);
+
+               return -EREMOTEIO;
+       }
+       *val = b1[0];
+
+       return ret;
+}
+
+static int CNTM_set(struct mb86a16_state *state,
+                   unsigned char timint1,
+                   unsigned char timint2,
+                   unsigned char cnext)
+{
+       unsigned char val;
+
+       val = (timint1 << 4) | (timint2 << 2) | cnext;
+       if (mb86a16_write(state, MB86A16_CNTMR, val) < 0)
+               goto err;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int smrt_set(struct mb86a16_state *state, int rate)
+{
+       int tmp ;
+       int m ;
+       unsigned char STOFS0, STOFS1;
+
+       m = 1 << state->deci;
+       tmp = (8192 * state->master_clk - 2 * m * rate * 8192 + state->master_clk / 2) / state->master_clk;
+
+       STOFS0 = tmp & 0x0ff;
+       STOFS1 = (tmp & 0xf00) >> 8;
+
+       if (mb86a16_write(state, MB86A16_SRATE1, (state->deci << 2) |
+                                      (state->csel << 1) |
+                                       state->rsel) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_SRATE2, STOFS0) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_SRATE3, STOFS1) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -1;
+}
+
+static int srst(struct mb86a16_state *state)
+{
+       if (mb86a16_write(state, MB86A16_RESET, 0x04) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+
+}
+
+static int afcex_data_set(struct mb86a16_state *state,
+                         unsigned char AFCEX_L,
+                         unsigned char AFCEX_H)
+{
+       if (mb86a16_write(state, MB86A16_AFCEXL, AFCEX_L) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_AFCEXH, AFCEX_H) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+
+       return -1;
+}
+
+static int afcofs_data_set(struct mb86a16_state *state,
+                          unsigned char AFCEX_L,
+                          unsigned char AFCEX_H)
+{
+       if (mb86a16_write(state, 0x58, AFCEX_L) < 0)
+               goto err;
+       if (mb86a16_write(state, 0x59, AFCEX_H) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int stlp_set(struct mb86a16_state *state,
+                   unsigned char STRAS,
+                   unsigned char STRBS)
+{
+       if (mb86a16_write(state, MB86A16_STRFILTCOEF1, (STRBS << 3) | (STRAS)) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int Vi_set(struct mb86a16_state *state, unsigned char ETH, unsigned char VIA)
+{
+       if (mb86a16_write(state, MB86A16_VISET2, 0x04) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_VISET3, 0xf5) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int initial_set(struct mb86a16_state *state)
+{
+       if (stlp_set(state, 5, 7))
+               goto err;
+
+       udelay(100);
+       if (afcex_data_set(state, 0, 0))
+               goto err;
+
+       udelay(100);
+       if (afcofs_data_set(state, 0, 0))
+               goto err;
+
+       udelay(100);
+       if (mb86a16_write(state, MB86A16_CRLFILTCOEF1, 0x16) < 0)
+               goto err;
+       if (mb86a16_write(state, 0x2f, 0x21) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_VIMAG, 0x38) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_FAGCS1, 0x00) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_FAGCS2, 0x1c) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_FAGCS3, 0x20) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_FAGCS4, 0x1e) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_FAGCS5, 0x23) < 0)
+               goto err;
+       if (mb86a16_write(state, 0x54, 0xff) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_TSOUT, 0x00) < 0)
+               goto err;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int S01T_set(struct mb86a16_state *state,
+                   unsigned char s1t,
+                   unsigned s0t)
+{
+       if (mb86a16_write(state, 0x33, (s1t << 3) | s0t) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+
+static int EN_set(struct mb86a16_state *state,
+                 int cren,
+                 int afcen)
+{
+       unsigned char val;
+
+       val = 0x7a | (cren << 7) | (afcen << 2);
+       if (mb86a16_write(state, 0x49, val) < 0)
+               goto err;
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int AFCEXEN_set(struct mb86a16_state *state,
+                      int afcexen,
+                      int smrt)
+{
+       unsigned char AFCA ;
+
+       if (smrt > 18875)
+               AFCA = 4;
+       else if (smrt > 9375)
+               AFCA = 3;
+       else if (smrt > 2250)
+               AFCA = 2;
+       else
+               AFCA = 1;
+
+       if (mb86a16_write(state, 0x2a, 0x02 | (afcexen << 5) | (AFCA << 2)) < 0)
+               goto err;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int DAGC_data_set(struct mb86a16_state *state,
+                        unsigned char DAGCA,
+                        unsigned char DAGCW)
+{
+       if (mb86a16_write(state, 0x2d, (DAGCA << 3) | DAGCW) < 0)
+               goto err;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static void smrt_info_get(struct mb86a16_state *state, int rate)
+{
+       if (rate >= 37501) {
+               state->deci = 0; state->csel = 0; state->rsel = 0;
+       } else if (rate >= 30001) {
+               state->deci = 0; state->csel = 0; state->rsel = 1;
+       } else if (rate >= 26251) {
+               state->deci = 0; state->csel = 1; state->rsel = 0;
+       } else if (rate >= 22501) {
+               state->deci = 0; state->csel = 1; state->rsel = 1;
+       } else if (rate >= 18751) {
+               state->deci = 1; state->csel = 0; state->rsel = 0;
+       } else if (rate >= 15001) {
+               state->deci = 1; state->csel = 0; state->rsel = 1;
+       } else if (rate >= 13126) {
+               state->deci = 1; state->csel = 1; state->rsel = 0;
+       } else if (rate >= 11251) {
+               state->deci = 1; state->csel = 1; state->rsel = 1;
+       } else if (rate >= 9376) {
+               state->deci = 2; state->csel = 0; state->rsel = 0;
+       } else if (rate >= 7501) {
+               state->deci = 2; state->csel = 0; state->rsel = 1;
+       } else if (rate >= 6563) {
+               state->deci = 2; state->csel = 1; state->rsel = 0;
+       } else if (rate >= 5626) {
+               state->deci = 2; state->csel = 1; state->rsel = 1;
+       } else if (rate >= 4688) {
+               state->deci = 3; state->csel = 0; state->rsel = 0;
+       } else if (rate >= 3751) {
+               state->deci = 3; state->csel = 0; state->rsel = 1;
+       } else if (rate >= 3282) {
+               state->deci = 3; state->csel = 1; state->rsel = 0;
+       } else if (rate >= 2814) {
+               state->deci = 3; state->csel = 1; state->rsel = 1;
+       } else if (rate >= 2344) {
+               state->deci = 4; state->csel = 0; state->rsel = 0;
+       } else if (rate >= 1876) {
+               state->deci = 4; state->csel = 0; state->rsel = 1;
+       } else if (rate >= 1641) {
+               state->deci = 4; state->csel = 1; state->rsel = 0;
+       } else if (rate >= 1407) {
+               state->deci = 4; state->csel = 1; state->rsel = 1;
+       } else if (rate >= 1172) {
+               state->deci = 5; state->csel = 0; state->rsel = 0;
+       } else if (rate >=  939) {
+               state->deci = 5; state->csel = 0; state->rsel = 1;
+       } else if (rate >=  821) {
+               state->deci = 5; state->csel = 1; state->rsel = 0;
+       } else {
+               state->deci = 5; state->csel = 1; state->rsel = 1;
+       }
+
+       if (state->csel == 0)
+               state->master_clk = 92000;
+       else
+               state->master_clk = 61333;
+
+}
+
+static int signal_det(struct mb86a16_state *state,
+                     int smrt,
+                     unsigned char *SIG)
+{
+
+       int ret ;
+       int smrtd ;
+       int wait_sym ;
+
+       u32 wait_t;
+       unsigned char S[3] ;
+       int i ;
+
+       if (*SIG > 45) {
+               if (CNTM_set(state, 2, 1, 2) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "CNTM set Error");
+                       return -1;
+               }
+               wait_sym = 40000;
+       } else {
+               if (CNTM_set(state, 3, 1, 2) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "CNTM set Error");
+                       return -1;
+               }
+               wait_sym = 80000;
+       }
+       for (i = 0; i < 3; i++) {
+               if (i == 0)
+                       smrtd = smrt * 98 / 100;
+               else if (i == 1)
+                       smrtd = smrt;
+               else
+                       smrtd = smrt * 102 / 100;
+               smrt_info_get(state, smrtd);
+               smrt_set(state, smrtd);
+               srst(state);
+               wait_t = (wait_sym + 99 * smrtd / 100) / smrtd;
+               if (wait_t == 0)
+                       wait_t = 1;
+               msleep_interruptible(10);
+               if (mb86a16_read(state, 0x37, &(S[i])) != 2) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+                       return -EREMOTEIO;
+               }
+       }
+       if ((S[1] > S[0] * 112 / 100) &&
+           (S[1] > S[2] * 112 / 100)) {
+
+               ret = 1;
+       } else {
+               ret = 0;
+       }
+       *SIG = S[1];
+
+       if (CNTM_set(state, 0, 1, 2) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "CNTM set Error");
+               return -1;
+       }
+
+       return ret;
+}
+
+static int rf_val_set(struct mb86a16_state *state,
+                     int f,
+                     int smrt,
+                     unsigned char R)
+{
+       unsigned char C, F, B;
+       int M;
+       unsigned char rf_val[5];
+       int ack = -1;
+
+       if (smrt > 37750)
+               C = 1;
+       else if (smrt > 18875)
+               C = 2;
+       else if (smrt > 5500)
+               C = 3;
+       else
+               C = 4;
+
+       if (smrt > 30500)
+               F = 3;
+       else if (smrt > 9375)
+               F = 1;
+       else if (smrt > 4625)
+               F = 0;
+       else
+               F = 2;
+
+       if (f < 1060)
+               B = 0;
+       else if (f < 1175)
+               B = 1;
+       else if (f < 1305)
+               B = 2;
+       else if (f < 1435)
+               B = 3;
+       else if (f < 1570)
+               B = 4;
+       else if (f < 1715)
+               B = 5;
+       else if (f < 1845)
+               B = 6;
+       else if (f < 1980)
+               B = 7;
+       else if (f < 2080)
+               B = 8;
+       else
+               B = 9;
+
+       M = f * (1 << R) / 2;
+
+       rf_val[0] = 0x01 | (C << 3) | (F << 1);
+       rf_val[1] = (R << 5) | ((M & 0x1f000) >> 12);
+       rf_val[2] = (M & 0x00ff0) >> 4;
+       rf_val[3] = ((M & 0x0000f) << 4) | B;
+
+       /* Frequency Set */
+       if (mb86a16_write(state, 0x21, rf_val[0]) < 0)
+               ack = 0;
+       if (mb86a16_write(state, 0x22, rf_val[1]) < 0)
+               ack = 0;
+       if (mb86a16_write(state, 0x23, rf_val[2]) < 0)
+               ack = 0;
+       if (mb86a16_write(state, 0x24, rf_val[3]) < 0)
+               ack = 0;
+       if (mb86a16_write(state, 0x25, 0x01) < 0)
+               ack = 0;
+       if (ack == 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "RF Setup - I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+static int afcerr_chk(struct mb86a16_state *state)
+{
+       unsigned char AFCM_L, AFCM_H ;
+       int AFCM ;
+       int afcm, afcerr ;
+
+       if (mb86a16_read(state, 0x0e, &AFCM_L) != 2)
+               goto err;
+       if (mb86a16_read(state, 0x0f, &AFCM_H) != 2)
+               goto err;
+
+       AFCM = (AFCM_H << 8) + AFCM_L;
+
+       if (AFCM > 2048)
+               afcm = AFCM - 4096;
+       else
+               afcm = AFCM;
+       afcerr = afcm * state->master_clk / 8192;
+
+       return afcerr;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int dagcm_val_get(struct mb86a16_state *state)
+{
+       int DAGCM;
+       unsigned char DAGCM_H, DAGCM_L;
+
+       if (mb86a16_read(state, 0x45, &DAGCM_L) != 2)
+               goto err;
+       if (mb86a16_read(state, 0x46, &DAGCM_H) != 2)
+               goto err;
+
+       DAGCM = (DAGCM_H << 8) + DAGCM_L;
+
+       return DAGCM;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int mb86a16_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
+       u8 stat, stat2;
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       *status = 0;
+
+       if (mb86a16_read(state, MB86A16_SIG1, &stat) != 2)
+               goto err;
+       if (mb86a16_read(state, MB86A16_SIG2, &stat2) != 2)
+               goto err;
+       if ((stat > 25) && (stat2 > 25))
+               *status |= FE_HAS_SIGNAL;
+       if ((stat > 45) && (stat2 > 45))
+               *status |= FE_HAS_CARRIER;
+
+       if (mb86a16_read(state, MB86A16_STATUS, &stat) != 2)
+               goto err;
+
+       if (stat & 0x01)
+               *status |= FE_HAS_SYNC;
+       if (stat & 0x01)
+               *status |= FE_HAS_VITERBI;
+
+       if (mb86a16_read(state, MB86A16_FRAMESYNC, &stat) != 2)
+               goto err;
+
+       if ((stat & 0x0f) && (*status & FE_HAS_VITERBI))
+               *status |= FE_HAS_LOCK;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int sync_chk(struct mb86a16_state *state,
+                   unsigned char *VIRM)
+{
+       unsigned char val;
+       int sync;
+
+       if (mb86a16_read(state, 0x0d, &val) != 2)
+               goto err;
+
+       dprintk(verbose, MB86A16_INFO, 1, "Status = %02x,", val);
+       sync = val & 0x01;
+       *VIRM = (val & 0x1c) >> 2;
+
+       return sync;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+
+}
+
+static int freqerr_chk(struct mb86a16_state *state,
+                      int fTP,
+                      int smrt,
+                      int unit)
+{
+       unsigned char CRM, AFCML, AFCMH;
+       unsigned char temp1, temp2, temp3;
+       int crm, afcm, AFCM;
+       int crrerr, afcerr;             /* kHz */
+       int frqerr;                     /* MHz */
+       int afcen, afcexen = 0;
+       int R, M, fOSC, fOSC_OFS;
+
+       if (mb86a16_read(state, 0x43, &CRM) != 2)
+               goto err;
+
+       if (CRM > 127)
+               crm = CRM - 256;
+       else
+               crm = CRM;
+
+       crrerr = smrt * crm / 256;
+       if (mb86a16_read(state, 0x49, &temp1) != 2)
+               goto err;
+
+       afcen = (temp1 & 0x04) >> 2;
+       if (afcen == 0) {
+               if (mb86a16_read(state, 0x2a, &temp1) != 2)
+                       goto err;
+               afcexen = (temp1 & 0x20) >> 5;
+       }
+
+       if (afcen == 1) {
+               if (mb86a16_read(state, 0x0e, &AFCML) != 2)
+                       goto err;
+               if (mb86a16_read(state, 0x0f, &AFCMH) != 2)
+                       goto err;
+       } else if (afcexen == 1) {
+               if (mb86a16_read(state, 0x2b, &AFCML) != 2)
+                       goto err;
+               if (mb86a16_read(state, 0x2c, &AFCMH) != 2)
+                       goto err;
+       }
+       if ((afcen == 1) || (afcexen == 1)) {
+               smrt_info_get(state, smrt);
+               AFCM = ((AFCMH & 0x01) << 8) + AFCML;
+               if (AFCM > 255)
+                       afcm = AFCM - 512;
+               else
+                       afcm = AFCM;
+
+               afcerr = afcm * state->master_clk / 8192;
+       } else
+               afcerr = 0;
+
+       if (mb86a16_read(state, 0x22, &temp1) != 2)
+               goto err;
+       if (mb86a16_read(state, 0x23, &temp2) != 2)
+               goto err;
+       if (mb86a16_read(state, 0x24, &temp3) != 2)
+               goto err;
+
+       R = (temp1 & 0xe0) >> 5;
+       M = ((temp1 & 0x1f) << 12) + (temp2 << 4) + (temp3 >> 4);
+       if (R == 0)
+               fOSC = 2 * M;
+       else
+               fOSC = M;
+
+       fOSC_OFS = fOSC - fTP;
+
+       if (unit == 0) {        /* MHz */
+               if (crrerr + afcerr + fOSC_OFS * 1000 >= 0)
+                       frqerr = (crrerr + afcerr + fOSC_OFS * 1000 + 500) / 1000;
+               else
+                       frqerr = (crrerr + afcerr + fOSC_OFS * 1000 - 500) / 1000;
+       } else {        /* kHz */
+               frqerr = crrerr + afcerr + fOSC_OFS * 1000;
+       }
+
+       return frqerr;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static unsigned char vco_dev_get(struct mb86a16_state *state, int smrt)
+{
+       unsigned char R;
+
+       if (smrt > 9375)
+               R = 0;
+       else
+               R = 1;
+
+       return R;
+}
+
+static void swp_info_get(struct mb86a16_state *state,
+                        int fOSC_start,
+                        int smrt,
+                        int v, int R,
+                        int swp_ofs,
+                        int *fOSC,
+                        int *afcex_freq,
+                        unsigned char *AFCEX_L,
+                        unsigned char *AFCEX_H)
+{
+       int AFCEX ;
+       int crnt_swp_freq ;
+
+       crnt_swp_freq = fOSC_start * 1000 + v * swp_ofs;
+
+       if (R == 0)
+               *fOSC = (crnt_swp_freq + 1000) / 2000 * 2;
+       else
+               *fOSC = (crnt_swp_freq + 500) / 1000;
+
+       if (*fOSC >= crnt_swp_freq)
+               *afcex_freq = *fOSC * 1000 - crnt_swp_freq;
+       else
+               *afcex_freq = crnt_swp_freq - *fOSC * 1000;
+
+       AFCEX = *afcex_freq * 8192 / state->master_clk;
+       *AFCEX_L =  AFCEX & 0x00ff;
+       *AFCEX_H = (AFCEX & 0x0f00) >> 8;
+}
+
+
+static int swp_freq_calcuation(struct mb86a16_state *state, int i, int v, int *V,  int vmax, int vmin,
+                              int SIGMIN, int fOSC, int afcex_freq, int swp_ofs, unsigned char *SIG1)
+{
+       int swp_freq ;
+
+       if ((i % 2 == 1) && (v <= vmax)) {
+               /* positive v (case 1) */
+               if ((v - 1 == vmin)                             &&
+                   (*(V + 30 + v) >= 0)                        &&
+                   (*(V + 30 + v - 1) >= 0)                    &&
+                   (*(V + 30 + v - 1) > *(V + 30 + v))         &&
+                   (*(V + 30 + v - 1) > SIGMIN)) {
+
+                       swp_freq = fOSC * 1000 + afcex_freq - swp_ofs;
+                       *SIG1 = *(V + 30 + v - 1);
+               } else if ((v == vmax)                          &&
+                          (*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v - 1) >= 0)             &&
+                          (*(V + 30 + v) > *(V + 30 + v - 1))  &&
+                          (*(V + 30 + v) > SIGMIN)) {
+                       /* (case 2) */
+                       swp_freq = fOSC * 1000 + afcex_freq;
+                       *SIG1 = *(V + 30 + v);
+               } else if ((*(V + 30 + v) > 0)                  &&
+                          (*(V + 30 + v - 1) > 0)              &&
+                          (*(V + 30 + v - 2) > 0)              &&
+                          (*(V + 30 + v - 3) > 0)              &&
+                          (*(V + 30 + v - 1) > *(V + 30 + v))  &&
+                          (*(V + 30 + v - 2) > *(V + 30 + v - 3)) &&
+                          ((*(V + 30 + v - 1) > SIGMIN)        ||
+                          (*(V + 30 + v - 2) > SIGMIN))) {
+                       /* (case 3) */
+                       if (*(V + 30 + v - 1) >= *(V + 30 + v - 2)) {
+                               swp_freq = fOSC * 1000 + afcex_freq - swp_ofs;
+                               *SIG1 = *(V + 30 + v - 1);
+                       } else {
+                               swp_freq = fOSC * 1000 + afcex_freq - swp_ofs * 2;
+                               *SIG1 = *(V + 30 + v - 2);
+                       }
+               } else if ((v == vmax)                          &&
+                          (*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v - 1) >= 0)             &&
+                          (*(V + 30 + v - 2) >= 0)             &&
+                          (*(V + 30 + v) > *(V + 30 + v - 2))  &&
+                          (*(V + 30 + v - 1) > *(V + 30 + v - 2)) &&
+                          ((*(V + 30 + v) > SIGMIN)            ||
+                          (*(V + 30 + v - 1) > SIGMIN))) {
+                       /* (case 4) */
+                       if (*(V + 30 + v) >= *(V + 30 + v - 1)) {
+                               swp_freq = fOSC * 1000 + afcex_freq;
+                               *SIG1 = *(V + 30 + v);
+                       } else {
+                               swp_freq = fOSC * 1000 + afcex_freq - swp_ofs;
+                               *SIG1 = *(V + 30 + v - 1);
+                       }
+               } else  {
+                       swp_freq = -1 ;
+               }
+       } else if ((i % 2 == 0) && (v >= vmin)) {
+               /* Negative v (case 1) */
+               if ((*(V + 30 + v) > 0)                         &&
+                   (*(V + 30 + v + 1) > 0)                     &&
+                   (*(V + 30 + v + 2) > 0)                     &&
+                   (*(V + 30 + v + 1) > *(V + 30 + v))         &&
+                   (*(V + 30 + v + 1) > *(V + 30 + v + 2))     &&
+                   (*(V + 30 + v + 1) > SIGMIN)) {
+
+                       swp_freq = fOSC * 1000 + afcex_freq + swp_ofs;
+                       *SIG1 = *(V + 30 + v + 1);
+               } else if ((v + 1 == vmax)                      &&
+                          (*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v + 1) >= 0)             &&
+                          (*(V + 30 + v + 1) > *(V + 30 + v))  &&
+                          (*(V + 30 + v + 1) > SIGMIN)) {
+                       /* (case 2) */
+                       swp_freq = fOSC * 1000 + afcex_freq + swp_ofs;
+                       *SIG1 = *(V + 30 + v);
+               } else if ((v == vmin)                          &&
+                          (*(V + 30 + v) > 0)                  &&
+                          (*(V + 30 + v + 1) > 0)              &&
+                          (*(V + 30 + v + 2) > 0)              &&
+                          (*(V + 30 + v) > *(V + 30 + v + 1))  &&
+                          (*(V + 30 + v) > *(V + 30 + v + 2))  &&
+                          (*(V + 30 + v) > SIGMIN)) {
+                       /* (case 3) */
+                       swp_freq = fOSC * 1000 + afcex_freq;
+                       *SIG1 = *(V + 30 + v);
+               } else if ((*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v + 1) >= 0)             &&
+                          (*(V + 30 + v + 2) >= 0)             &&
+                          (*(V + 30 + v + 3) >= 0)             &&
+                          (*(V + 30 + v + 1) > *(V + 30 + v))  &&
+                          (*(V + 30 + v + 2) > *(V + 30 + v + 3)) &&
+                          ((*(V + 30 + v + 1) > SIGMIN)        ||
+                           (*(V + 30 + v + 2) > SIGMIN))) {
+                       /* (case 4) */
+                       if (*(V + 30 + v + 1) >= *(V + 30 + v + 2)) {
+                               swp_freq = fOSC * 1000 + afcex_freq + swp_ofs;
+                               *SIG1 = *(V + 30 + v + 1);
+                       } else {
+                               swp_freq = fOSC * 1000 + afcex_freq + swp_ofs * 2;
+                               *SIG1 = *(V + 30 + v + 2);
+                       }
+               } else if ((*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v + 1) >= 0)             &&
+                          (*(V + 30 + v + 2) >= 0)             &&
+                          (*(V + 30 + v + 3) >= 0)             &&
+                          (*(V + 30 + v) > *(V + 30 + v + 2))  &&
+                          (*(V + 30 + v + 1) > *(V + 30 + v + 2)) &&
+                          (*(V + 30 + v) > *(V + 30 + v + 3))  &&
+                          (*(V + 30 + v + 1) > *(V + 30 + v + 3)) &&
+                          ((*(V + 30 + v) > SIGMIN)            ||
+                           (*(V + 30 + v + 1) > SIGMIN))) {
+                       /* (case 5) */
+                       if (*(V + 30 + v) >= *(V + 30 + v + 1)) {
+                               swp_freq = fOSC * 1000 + afcex_freq;
+                               *SIG1 = *(V + 30 + v);
+                       } else {
+                               swp_freq = fOSC * 1000 + afcex_freq + swp_ofs;
+                               *SIG1 = *(V + 30 + v + 1);
+                       }
+               } else if ((v + 2 == vmin)                      &&
+                          (*(V + 30 + v) >= 0)                 &&
+                          (*(V + 30 + v + 1) >= 0)             &&
+                          (*(V + 30 + v + 2) >= 0)             &&
+                          (*(V + 30 + v + 1) > *(V + 30 + v))  &&
+                          (*(V + 30 + v + 2) > *(V + 30 + v))  &&
+                          ((*(V + 30 + v + 1) > SIGMIN)        ||
+                           (*(V + 30 + v + 2) > SIGMIN))) {
+                       /* (case 6) */
+                       if (*(V + 30 + v + 1) >= *(V + 30 + v + 2)) {
+                               swp_freq = fOSC * 1000 + afcex_freq + swp_ofs;
+                               *SIG1 = *(V + 30 + v + 1);
+                       } else {
+                               swp_freq = fOSC * 1000 + afcex_freq + swp_ofs * 2;
+                               *SIG1 = *(V + 30 + v + 2);
+                       }
+               } else if ((vmax == 0) && (vmin == 0) && (*(V + 30 + v) > SIGMIN)) {
+                       swp_freq = fOSC * 1000;
+                       *SIG1 = *(V + 30 + v);
+               } else
+                       swp_freq = -1;
+       } else
+               swp_freq = -1;
+
+       return swp_freq;
+}
+
+static void swp_info_get2(struct mb86a16_state *state,
+                         int smrt,
+                         int R,
+                         int swp_freq,
+                         int *afcex_freq,
+                         int *fOSC,
+                         unsigned char *AFCEX_L,
+                         unsigned char *AFCEX_H)
+{
+       int AFCEX ;
+
+       if (R == 0)
+               *fOSC = (swp_freq + 1000) / 2000 * 2;
+       else
+               *fOSC = (swp_freq + 500) / 1000;
+
+       if (*fOSC >= swp_freq)
+               *afcex_freq = *fOSC * 1000 - swp_freq;
+       else
+               *afcex_freq = swp_freq - *fOSC * 1000;
+
+       AFCEX = *afcex_freq * 8192 / state->master_clk;
+       *AFCEX_L =  AFCEX & 0x00ff;
+       *AFCEX_H = (AFCEX & 0x0f00) >> 8;
+}
+
+static void afcex_info_get(struct mb86a16_state *state,
+                          int afcex_freq,
+                          unsigned char *AFCEX_L,
+                          unsigned char *AFCEX_H)
+{
+       int AFCEX ;
+
+       AFCEX = afcex_freq * 8192 / state->master_clk;
+       *AFCEX_L =  AFCEX & 0x00ff;
+       *AFCEX_H = (AFCEX & 0x0f00) >> 8;
+}
+
+static int SEQ_set(struct mb86a16_state *state, unsigned char loop)
+{
+       /* SLOCK0 = 0 */
+       if (mb86a16_write(state, 0x32, 0x02 | (loop << 2)) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+static int iq_vt_set(struct mb86a16_state *state, unsigned char IQINV)
+{
+       /* Viterbi Rate, IQ Settings */
+       if (mb86a16_write(state, 0x06, 0xdf | (IQINV << 5)) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+static int FEC_srst(struct mb86a16_state *state)
+{
+       if (mb86a16_write(state, MB86A16_RESET, 0x02) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+static int S2T_set(struct mb86a16_state *state, unsigned char S2T)
+{
+       if (mb86a16_write(state, 0x34, 0x70 | S2T) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+static int S45T_set(struct mb86a16_state *state, unsigned char S4T, unsigned char S5T)
+{
+       if (mb86a16_write(state, 0x35, 0x00 | (S5T << 4) | S4T) < 0) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       return 0;
+}
+
+
+static int mb86a16_set_fe(struct mb86a16_state *state)
+{
+       u8 agcval, cnmval;
+
+       int i, j;
+       int fOSC = 0;
+       int fOSC_start = 0;
+       int wait_t;
+       int fcp;
+       int swp_ofs;
+       int V[60];
+       u8 SIG1MIN;
+
+       unsigned char CREN, AFCEN, AFCEXEN;
+       unsigned char SIG1;
+       unsigned char TIMINT1, TIMINT2, TIMEXT;
+       unsigned char S0T, S1T;
+       unsigned char S2T;
+/*     unsigned char S2T, S3T; */
+       unsigned char S4T, S5T;
+       unsigned char AFCEX_L, AFCEX_H;
+       unsigned char R;
+       unsigned char VIRM;
+       unsigned char ETH, VIA;
+       unsigned char junk;
+
+       int loop;
+       int ftemp;
+       int v, vmax, vmin;
+       int vmax_his, vmin_his;
+       int swp_freq, prev_swp_freq[20];
+       int prev_freq_num;
+       int signal_dupl;
+       int afcex_freq;
+       int signal;
+       int afcerr;
+       int temp_freq, delta_freq;
+       int dagcm[4];
+       int smrt_d;
+/*     int freq_err; */
+       int n;
+       int ret = -1;
+       int sync;
+
+       dprintk(verbose, MB86A16_INFO, 1, "freq=%d Mhz, symbrt=%d Ksps", state->frequency, state->srate);
+
+       fcp = 3000;
+       swp_ofs = state->srate / 4;
+
+       for (i = 0; i < 60; i++)
+               V[i] = -1;
+
+       for (i = 0; i < 20; i++)
+               prev_swp_freq[i] = 0;
+
+       SIG1MIN = 25;
+
+       for (n = 0; ((n < 3) && (ret == -1)); n++) {
+               SEQ_set(state, 0);
+               iq_vt_set(state, 0);
+
+               CREN = 0;
+               AFCEN = 0;
+               AFCEXEN = 1;
+               TIMINT1 = 0;
+               TIMINT2 = 1;
+               TIMEXT = 2;
+               S1T = 0;
+               S0T = 0;
+
+               if (initial_set(state) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "initial set failed");
+                       return -1;
+               }
+               if (DAGC_data_set(state, 3, 2) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "DAGC data set error");
+                       return -1;
+               }
+               if (EN_set(state, CREN, AFCEN) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "EN set error");
+                       return -1; /* (0, 0) */
+               }
+               if (AFCEXEN_set(state, AFCEXEN, state->srate) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "AFCEXEN set error");
+                       return -1; /* (1, smrt) = (1, symbolrate) */
+               }
+               if (CNTM_set(state, TIMINT1, TIMINT2, TIMEXT) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "CNTM set error");
+                       return -1; /* (0, 1, 2) */
+               }
+               if (S01T_set(state, S1T, S0T) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "S01T set error");
+                       return -1; /* (0, 0) */
+               }
+               smrt_info_get(state, state->srate);
+               if (smrt_set(state, state->srate) < 0) {
+                       dprintk(verbose, MB86A16_ERROR, 1, "smrt info get error");
+                       return -1;
+               }
+
+               R = vco_dev_get(state, state->srate);
+               if (R == 1)
+                       fOSC_start = state->frequency;
+
+               else if (R == 0) {
+                       if (state->frequency % 2 == 0) {
+                               fOSC_start = state->frequency;
+                       } else {
+                               fOSC_start = state->frequency + 1;
+                               if (fOSC_start > 2150)
+                                       fOSC_start = state->frequency - 1;
+                       }
+               }
+               loop = 1;
+               ftemp = fOSC_start * 1000;
+               vmax = 0 ;
+               while (loop == 1) {
+                       ftemp = ftemp + swp_ofs;
+                       vmax++;
+
+                       /* Upper bound */
+                       if (ftemp > 2150000) {
+                               loop = 0;
+                               vmax--;
+                       } else {
+                               if ((ftemp == 2150000) ||
+                                   (ftemp - state->frequency * 1000 >= fcp + state->srate / 4))
+                                       loop = 0;
+                       }
+               }
+
+               loop = 1;
+               ftemp = fOSC_start * 1000;
+               vmin = 0 ;
+               while (loop == 1) {
+                       ftemp = ftemp - swp_ofs;
+                       vmin--;
+
+                       /* Lower bound */
+                       if (ftemp < 950000) {
+                               loop = 0;
+                               vmin++;
+                       } else {
+                               if ((ftemp == 950000) ||
+                                   (state->frequency * 1000 - ftemp >= fcp + state->srate / 4))
+                                       loop = 0;
+                       }
+               }
+
+               wait_t = (8000 + state->srate / 2) / state->srate;
+               if (wait_t == 0)
+                       wait_t = 1;
+
+               i = 0;
+               j = 0;
+               prev_freq_num = 0;
+               loop = 1;
+               signal = 0;
+               vmax_his = 0;
+               vmin_his = 0;
+               v = 0;
+
+               while (loop == 1) {
+                       swp_info_get(state, fOSC_start, state->srate,
+                                    v, R, swp_ofs, &fOSC,
+                                    &afcex_freq, &AFCEX_L, &AFCEX_H);
+
+                       udelay(100);
+                       if (rf_val_set(state, fOSC, state->srate, R) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
+                               return -1;
+                       }
+                       udelay(100);
+                       if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "afcex data set error");
+                               return -1;
+                       }
+                       if (srst(state) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "srst error");
+                               return -1;
+                       }
+                       msleep_interruptible(wait_t);
+
+                       if (mb86a16_read(state, 0x37, &SIG1) != 2) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+                               return -1;
+                       }
+                       V[30 + v] = SIG1 ;
+                       swp_freq = swp_freq_calcuation(state, i, v, V, vmax, vmin,
+                                                     SIG1MIN, fOSC, afcex_freq,
+                                                     swp_ofs, &SIG1);  /* changed */
+
+                       signal_dupl = 0;
+                       for (j = 0; j < prev_freq_num; j++) {
+                               if ((ABS(prev_swp_freq[j] - swp_freq)) < (swp_ofs * 3 / 2)) {
+                                       signal_dupl = 1;
+                                       dprintk(verbose, MB86A16_INFO, 1, "Probably Duplicate Signal, j = %d", j);
+                               }
+                       }
+                       if ((signal_dupl == 0) && (swp_freq > 0) && (ABS(swp_freq - state->frequency * 1000) < fcp + state->srate / 6)) {
+                               dprintk(verbose, MB86A16_DEBUG, 1, "------ Signal detect ------ [swp_freq=[%07d, srate=%05d]]", swp_freq, state->srate);
+                               prev_swp_freq[prev_freq_num] = swp_freq;
+                               prev_freq_num++;
+                               swp_info_get2(state, state->srate, R, swp_freq,
+                                             &afcex_freq, &fOSC,
+                                             &AFCEX_L, &AFCEX_H);
+
+                               if (rf_val_set(state, fOSC, state->srate, R) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
+                                       return -1;
+                               }
+                               if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "afcex data set error");
+                                       return -1;
+                               }
+                               signal = signal_det(state, state->srate, &SIG1);
+                               if (signal == 1) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "***** Signal Found *****");
+                                       loop = 0;
+                               } else {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "!!!!! No signal !!!!!, try again...");
+                                       smrt_info_get(state, state->srate);
+                                       if (smrt_set(state, state->srate) < 0) {
+                                               dprintk(verbose, MB86A16_ERROR, 1, "smrt set error");
+                                               return -1;
+                                       }
+                               }
+                       }
+                       if (v > vmax)
+                               vmax_his = 1 ;
+                       if (v < vmin)
+                               vmin_his = 1 ;
+                       i++;
+
+                       if ((i % 2 == 1) && (vmax_his == 1))
+                               i++;
+                       if ((i % 2 == 0) && (vmin_his == 1))
+                               i++;
+
+                       if (i % 2 == 1)
+                               v = (i + 1) / 2;
+                       else
+                               v = -i / 2;
+
+                       if ((vmax_his == 1) && (vmin_his == 1))
+                               loop = 0 ;
+               }
+
+               if (signal == 1) {
+                       dprintk(verbose, MB86A16_INFO, 1, " Start Freq Error Check");
+                       S1T = 7 ;
+                       S0T = 1 ;
+                       CREN = 0 ;
+                       AFCEN = 1 ;
+                       AFCEXEN = 0 ;
+
+                       if (S01T_set(state, S1T, S0T) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "S01T set error");
+                               return -1;
+                       }
+                       smrt_info_get(state, state->srate);
+                       if (smrt_set(state, state->srate) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "smrt set error");
+                               return -1;
+                       }
+                       if (EN_set(state, CREN, AFCEN) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "EN set error");
+                               return -1;
+                       }
+                       if (AFCEXEN_set(state, AFCEXEN, state->srate) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "AFCEXEN set error");
+                               return -1;
+                       }
+                       afcex_info_get(state, afcex_freq, &AFCEX_L, &AFCEX_H);
+                       if (afcofs_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "AFCOFS data set error");
+                               return -1;
+                       }
+                       if (srst(state) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "srst error");
+                               return -1;
+                       }
+                       /* delay 4~200 */
+                       wait_t = 200000 / state->master_clk + 200000 / state->srate;
+                       msleep(wait_t);
+                       afcerr = afcerr_chk(state);
+                       if (afcerr == -1)
+                               return -1;
+
+                       swp_freq = fOSC * 1000 + afcerr ;
+                       AFCEXEN = 1 ;
+                       if (state->srate >= 1500)
+                               smrt_d = state->srate / 3;
+                       else
+                               smrt_d = state->srate / 2;
+                       smrt_info_get(state, smrt_d);
+                       if (smrt_set(state, smrt_d) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "smrt set error");
+                               return -1;
+                       }
+                       if (AFCEXEN_set(state, AFCEXEN, smrt_d) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "AFCEXEN set error");
+                               return -1;
+                       }
+                       R = vco_dev_get(state, smrt_d);
+                       if (DAGC_data_set(state, 2, 0) < 0) {
+                               dprintk(verbose, MB86A16_ERROR, 1, "DAGC data set error");
+                               return -1;
+                       }
+                       for (i = 0; i < 3; i++) {
+                               temp_freq = swp_freq + (i - 1) * state->srate / 8;
+                               swp_info_get2(state, smrt_d, R, temp_freq, &afcex_freq, &fOSC, &AFCEX_L, &AFCEX_H);
+                               if (rf_val_set(state, fOSC, smrt_d, R) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
+                                       return -1;
+                               }
+                               if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "afcex data set error");
+                                       return -1;
+                               }
+                               wait_t = 200000 / state->master_clk + 40000 / smrt_d;
+                               msleep(wait_t);
+                               dagcm[i] = dagcm_val_get(state);
+                       }
+                       if ((dagcm[0] > dagcm[1]) &&
+                           (dagcm[0] > dagcm[2]) &&
+                           (dagcm[0] - dagcm[1] > 2 * (dagcm[2] - dagcm[1]))) {
+
+                               temp_freq = swp_freq - 2 * state->srate / 8;
+                               swp_info_get2(state, smrt_d, R, temp_freq, &afcex_freq, &fOSC, &AFCEX_L, &AFCEX_H);
+                               if (rf_val_set(state, fOSC, smrt_d, R) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
+                                       return -1;
+                               }
+                               if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "afcex data set");
+                                       return -1;
+                               }
+                               wait_t = 200000 / state->master_clk + 40000 / smrt_d;
+                               msleep(wait_t);
+                               dagcm[3] = dagcm_val_get(state);
+                               if (dagcm[3] > dagcm[1])
+                                       delta_freq = (dagcm[2] - dagcm[0] + dagcm[1] - dagcm[3]) * state->srate / 300;
+                               else
+                                       delta_freq = 0;
+                       } else if ((dagcm[2] > dagcm[1]) &&
+                                  (dagcm[2] > dagcm[0]) &&
+                                  (dagcm[2] - dagcm[1] > 2 * (dagcm[0] - dagcm[1]))) {
+
+                               temp_freq = swp_freq + 2 * state->srate / 8;
+                               swp_info_get2(state, smrt_d, R, temp_freq, &afcex_freq, &fOSC, &AFCEX_L, &AFCEX_H);
+                               if (rf_val_set(state, fOSC, smrt_d, R) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "rf val set");
+                                       return -1;
+                               }
+                               if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "afcex data set");
+                                       return -1;
+                               }
+                               wait_t = 200000 / state->master_clk + 40000 / smrt_d;
+                               msleep(wait_t);
+                               dagcm[3] = dagcm_val_get(state);
+                               if (dagcm[3] > dagcm[1])
+                                       delta_freq = (dagcm[2] - dagcm[0] + dagcm[3] - dagcm[1]) * state->srate / 300;
+                               else
+                                       delta_freq = 0 ;
+
+                       } else {
+                               delta_freq = 0 ;
+                       }
+                       dprintk(verbose, MB86A16_INFO, 1, "SWEEP Frequency = %d", swp_freq);
+                       swp_freq += delta_freq;
+                       dprintk(verbose, MB86A16_INFO, 1, "Adjusting .., DELTA Freq = %d, SWEEP Freq=%d", delta_freq, swp_freq);
+                       if (ABS(state->frequency * 1000 - swp_freq) > 3800) {
+                               dprintk(verbose, MB86A16_INFO, 1, "NO  --  SIGNAL !");
+                       } else {
+
+                               S1T = 0;
+                               S0T = 3;
+                               CREN = 1;
+                               AFCEN = 0;
+                               AFCEXEN = 1;
+
+                               if (S01T_set(state, S1T, S0T) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "S01T set error");
+                                       return -1;
+                               }
+                               if (DAGC_data_set(state, 0, 0) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "DAGC data set error");
+                                       return -1;
+                               }
+                               R = vco_dev_get(state, state->srate);
+                               smrt_info_get(state, state->srate);
+                               if (smrt_set(state, state->srate) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "smrt set error");
+                                       return -1;
+                               }
+                               if (EN_set(state, CREN, AFCEN) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "EN set error");
+                                       return -1;
+                               }
+                               if (AFCEXEN_set(state, AFCEXEN, state->srate) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "AFCEXEN set error");
+                                       return -1;
+                               }
+                               swp_info_get2(state, state->srate, R, swp_freq, &afcex_freq, &fOSC, &AFCEX_L, &AFCEX_H);
+                               if (rf_val_set(state, fOSC, state->srate, R) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
+                                       return -1;
+                               }
+                               if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "afcex data set error");
+                                       return -1;
+                               }
+                               if (srst(state) < 0) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "srst error");
+                                       return -1;
+                               }
+                               wait_t = 7 + (10000 + state->srate / 2) / state->srate;
+                               if (wait_t == 0)
+                                       wait_t = 1;
+                               msleep_interruptible(wait_t);
+                               if (mb86a16_read(state, 0x37, &SIG1) != 2) {
+                                       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+                                       return -EREMOTEIO;
+                               }
+
+                               if (SIG1 > 110) {
+                                       S2T = 4; S4T = 1; S5T = 6; ETH = 4; VIA = 6;
+                                       wait_t = 7 + (917504 + state->srate / 2) / state->srate;
+                               } else if (SIG1 > 105) {
+                                       S2T = 4; S4T = 2; S5T = 8; ETH = 7; VIA = 2;
+                                       wait_t = 7 + (1048576 + state->srate / 2) / state->srate;
+                               } else if (SIG1 > 85) {
+                                       S2T = 5; S4T = 2; S5T = 8; ETH = 7; VIA = 2;
+                                       wait_t = 7 + (1310720 + state->srate / 2) / state->srate;
+                               } else if (SIG1 > 65) {
+                                       S2T = 6; S4T = 2; S5T = 8; ETH = 7; VIA = 2;
+                                       wait_t = 7 + (1572864 + state->srate / 2) / state->srate;
+                               } else {
+                                       S2T = 7; S4T = 2; S5T = 8; ETH = 7; VIA = 2;
+                                       wait_t = 7 + (2097152 + state->srate / 2) / state->srate;
+                               }
+                               wait_t *= 2; /* FOS */
+                               S2T_set(state, S2T);
+                               S45T_set(state, S4T, S5T);
+                               Vi_set(state, ETH, VIA);
+                               srst(state);
+                               msleep_interruptible(wait_t);
+                               sync = sync_chk(state, &VIRM);
+                               dprintk(verbose, MB86A16_INFO, 1, "-------- Viterbi=[%d] SYNC=[%d] ---------", VIRM, sync);
+                               if (VIRM) {
+                                       if (VIRM == 4) {
+                                               /* 5/6 */
+                                               if (SIG1 > 110)
+                                                       wait_t = (786432 + state->srate / 2) / state->srate;
+                                               else
+                                                       wait_t = (1572864 + state->srate / 2) / state->srate;
+                                               if (state->srate < 5000)
+                                                       /* FIXME ! , should be a long wait ! */
+                                                       msleep_interruptible(wait_t);
+                                               else
+                                                       msleep_interruptible(wait_t);
+
+                                               if (sync_chk(state, &junk) == 0) {
+                                                       iq_vt_set(state, 1);
+                                                       FEC_srst(state);
+                                               }
+                                       }
+                                       /* 1/2, 2/3, 3/4, 7/8 */
+                                       if (SIG1 > 110)
+                                               wait_t = (786432 + state->srate / 2) / state->srate;
+                                       else
+                                               wait_t = (1572864 + state->srate / 2) / state->srate;
+                                       msleep_interruptible(wait_t);
+                                       SEQ_set(state, 1);
+                               } else {
+                                       dprintk(verbose, MB86A16_INFO, 1, "NO  -- SYNC");
+                                       SEQ_set(state, 1);
+                                       ret = -1;
+                               }
+                       }
+               } else {
+                       dprintk(verbose, MB86A16_INFO, 1, "NO  -- SIGNAL");
+                       ret = -1;
+               }
+
+               sync = sync_chk(state, &junk);
+               if (sync) {
+                       dprintk(verbose, MB86A16_INFO, 1, "******* SYNC *******");
+                       freqerr_chk(state, state->frequency, state->srate, 1);
+                       ret = 0;
+                       break;
+               }
+       }
+
+       mb86a16_read(state, 0x15, &agcval);
+       mb86a16_read(state, 0x26, &cnmval);
+       dprintk(verbose, MB86A16_INFO, 1, "AGC = %02x CNM = %02x", agcval, cnmval);
+
+       return ret;
+}
+
+static int mb86a16_send_diseqc_msg(struct dvb_frontend *fe,
+                                  struct dvb_diseqc_master_cmd *cmd)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+       int i;
+       u8 regs;
+
+       if (mb86a16_write(state, MB86A16_DCC1, MB86A16_DCC1_DISTA) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_DCCOUT, 0x00) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_TONEOUT2, 0x04) < 0)
+               goto err;
+
+       regs = 0x18;
+
+       if (cmd->msg_len > 5 || cmd->msg_len < 4)
+               return -EINVAL;
+
+       for (i = 0; i < cmd->msg_len; i++) {
+               if (mb86a16_write(state, regs, cmd->msg[i]) < 0)
+                       goto err;
+
+               regs++;
+       }
+       i += 0x90;
+
+       msleep_interruptible(10);
+
+       if (mb86a16_write(state, MB86A16_DCC1, i) < 0)
+               goto err;
+       if (mb86a16_write(state, MB86A16_DCCOUT, MB86A16_DCCOUT_DISEN) < 0)
+               goto err;
+
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int mb86a16_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t burst)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       switch (burst) {
+       case SEC_MINI_A:
+               if (mb86a16_write(state, MB86A16_DCC1, MB86A16_DCC1_DISTA |
+                                                      MB86A16_DCC1_TBEN  |
+                                                      MB86A16_DCC1_TBO) < 0)
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCCOUT, MB86A16_DCCOUT_DISEN) < 0)
+                       goto err;
+               break;
+       case SEC_MINI_B:
+               if (mb86a16_write(state, MB86A16_DCC1, MB86A16_DCC1_DISTA |
+                                                      MB86A16_DCC1_TBEN) < 0)
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCCOUT, MB86A16_DCCOUT_DISEN) < 0)
+                       goto err;
+               break;
+       }
+
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int mb86a16_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       switch (tone) {
+       case SEC_TONE_ON:
+               if (mb86a16_write(state, MB86A16_TONEOUT2, 0x00) < 0)
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCC1, MB86A16_DCC1_DISTA |
+                                                      MB86A16_DCC1_CTOE) < 0)
+
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCCOUT, MB86A16_DCCOUT_DISEN) < 0)
+                       goto err;
+               break;
+       case SEC_TONE_OFF:
+               if (mb86a16_write(state, MB86A16_TONEOUT2, 0x04) < 0)
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCC1, MB86A16_DCC1_DISTA) < 0)
+                       goto err;
+               if (mb86a16_write(state, MB86A16_DCCOUT, 0x00) < 0)
+                       goto err;
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static enum dvbfe_search mb86a16_search(struct dvb_frontend *fe,
+                                       struct dvb_frontend_parameters *p)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       state->frequency = p->frequency / 1000;
+       state->srate = p->u.qpsk.symbol_rate / 1000;
+
+       if (!mb86a16_set_fe(state)) {
+               dprintk(verbose, MB86A16_ERROR, 1, "Succesfully acquired LOCK");
+               return DVBFE_ALGO_SEARCH_SUCCESS;
+       }
+
+       dprintk(verbose, MB86A16_ERROR, 1, "Lock acquisition failed!");
+       return DVBFE_ALGO_SEARCH_FAILED;
+}
+
+static void mb86a16_release(struct dvb_frontend *fe)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+       kfree(state);
+}
+
+static int mb86a16_init(struct dvb_frontend *fe)
+{
+       return 0;
+}
+
+static int mb86a16_sleep(struct dvb_frontend *fe)
+{
+       return 0;
+}
+
+static int mb86a16_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
+       u8 ber_mon, ber_tab, ber_lsb, ber_mid, ber_msb, ber_tim, ber_rst;
+       u32 timer;
+
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       *ber = 0;
+       if (mb86a16_read(state, MB86A16_BERMON, &ber_mon) != 2)
+               goto err;
+       if (mb86a16_read(state, MB86A16_BERTAB, &ber_tab) != 2)
+               goto err;
+       if (mb86a16_read(state, MB86A16_BERLSB, &ber_lsb) != 2)
+               goto err;
+       if (mb86a16_read(state, MB86A16_BERMID, &ber_mid) != 2)
+               goto err;
+       if (mb86a16_read(state, MB86A16_BERMSB, &ber_msb) != 2)
+               goto err;
+       /* BER monitor invalid when BER_EN = 0  */
+       if (ber_mon & 0x04) {
+               /* coarse, fast calculation     */
+               *ber = ber_tab & 0x1f;
+               dprintk(verbose, MB86A16_DEBUG, 1, "BER coarse=[0x%02x]", *ber);
+               if (ber_mon & 0x01) {
+                       /*
+                        * BER_SEL = 1, The monitored BER is the estimated
+                        * value with a Reed-Solomon decoder error amount at
+                        * the deinterleaver output.
+                        * monitored BER is expressed as a 20 bit output in total
+                        */
+                       ber_rst = ber_mon >> 3;
+                       *ber = (((ber_msb << 8) | ber_mid) << 8) | ber_lsb;
+                       if (ber_rst == 0)
+                               timer =  12500000;
+                       if (ber_rst == 1)
+                               timer =  25000000;
+                       if (ber_rst == 2)
+                               timer =  50000000;
+                       if (ber_rst == 3)
+                               timer = 100000000;
+
+                       *ber /= timer;
+                       dprintk(verbose, MB86A16_DEBUG, 1, "BER fine=[0x%02x]", *ber);
+               } else {
+                       /*
+                        * BER_SEL = 0, The monitored BER is the estimated
+                        * value with a Viterbi decoder error amount at the
+                        * QPSK demodulator output.
+                        * monitored BER is expressed as a 24 bit output in total
+                        */
+                       ber_tim = ber_mon >> 1;
+                       *ber = (((ber_msb << 8) | ber_mid) << 8) | ber_lsb;
+                       if (ber_tim == 0)
+                               timer = 16;
+                       if (ber_tim == 1)
+                               timer = 24;
+
+                       *ber /= 2 ^ timer;
+                       dprintk(verbose, MB86A16_DEBUG, 1, "BER fine=[0x%02x]", *ber);
+               }
+       }
+       return 0;
+err:
+       dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+       return -EREMOTEIO;
+}
+
+static int mb86a16_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
+{
+       u8 agcm = 0;
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       *strength = 0;
+       if (mb86a16_read(state, MB86A16_AGCM, &agcm) != 2) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       *strength = ((0xff - agcm) * 100) / 256;
+       dprintk(verbose, MB86A16_DEBUG, 1, "Signal strength=[%d %%]", (u8) *strength);
+       *strength = (0xffff - 0xff) + agcm;
+
+       return 0;
+}
+
+struct cnr {
+       u8 cn_reg;
+       u8 cn_val;
+};
+
+static const struct cnr cnr_tab[] = {
+       {  35,  2 },
+       {  40,  3 },
+       {  50,  4 },
+       {  60,  5 },
+       {  70,  6 },
+       {  80,  7 },
+       {  92,  8 },
+       { 103,  9 },
+       { 115, 10 },
+       { 138, 12 },
+       { 162, 15 },
+       { 180, 18 },
+       { 185, 19 },
+       { 189, 20 },
+       { 195, 22 },
+       { 199, 24 },
+       { 201, 25 },
+       { 202, 26 },
+       { 203, 27 },
+       { 205, 28 },
+       { 208, 30 }
+};
+
+static int mb86a16_read_snr(struct dvb_frontend *fe, u16 *snr)
+{
+       struct mb86a16_state *state = fe->demodulator_priv;
+       int i = 0;
+       int low_tide = 2, high_tide = 30, q_level;
+       u8  cn;
+
+       *snr = 0;
+       if (mb86a16_read(state, 0x26, &cn) != 2) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(cnr_tab); i++) {
+               if (cn < cnr_tab[i].cn_reg) {
+                       *snr = cnr_tab[i].cn_val;
+                       break;
+               }
+       }
+       q_level = (*snr * 100) / (high_tide - low_tide);
+       dprintk(verbose, MB86A16_ERROR, 1, "SNR (Quality) = [%d dB], Level=%d %%", *snr, q_level);
+       *snr = (0xffff - 0xff) + *snr;
+
+       return 0;
+}
+
+static int mb86a16_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
+{
+       u8 dist;
+       struct mb86a16_state *state = fe->demodulator_priv;
+
+       if (mb86a16_read(state, MB86A16_DISTMON, &dist) != 2) {
+               dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+               return -EREMOTEIO;
+       }
+       *ucblocks = dist;
+
+       return 0;
+}
+
+static enum dvbfe_algo mb86a16_frontend_algo(struct dvb_frontend *fe)
+{
+       return DVBFE_ALGO_CUSTOM;
+}
+
+static struct dvb_frontend_ops mb86a16_ops = {
+       .info = {
+               .name                   = "Fujitsu MB86A16 DVB-S",
+               .type                   = FE_QPSK,
+               .frequency_min          = 950000,
+               .frequency_max          = 2150000,
+               .frequency_stepsize     = 3000,
+               .frequency_tolerance    = 0,
+               .symbol_rate_min        = 1000000,
+               .symbol_rate_max        = 45000000,
+               .symbol_rate_tolerance  = 500,
+               .caps                   = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 |
+                                         FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 |
+                                         FE_CAN_FEC_7_8 | FE_CAN_QPSK    |
+                                         FE_CAN_FEC_AUTO
+       },
+       .release                        = mb86a16_release,
+
+       .get_frontend_algo              = mb86a16_frontend_algo,
+       .search                         = mb86a16_search,
+       .read_status                    = mb86a16_read_status,
+       .init                           = mb86a16_init,
+       .sleep                          = mb86a16_sleep,
+       .read_status                    = mb86a16_read_status,
+
+       .read_ber                       = mb86a16_read_ber,
+       .read_signal_strength           = mb86a16_read_signal_strength,
+       .read_snr                       = mb86a16_read_snr,
+       .read_ucblocks                  = mb86a16_read_ucblocks,
+
+       .diseqc_send_master_cmd         = mb86a16_send_diseqc_msg,
+       .diseqc_send_burst              = mb86a16_send_diseqc_burst,
+       .set_tone                       = mb86a16_set_tone,
+};
+
+struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config,
+                                   struct i2c_adapter *i2c_adap)
+{
+       u8 dev_id = 0;
+       struct mb86a16_state *state = NULL;
+
+       state = kmalloc(sizeof(struct mb86a16_state), GFP_KERNEL);
+       if (state == NULL)
+               goto error;
+
+       state->config = config;
+       state->i2c_adap = i2c_adap;
+
+       mb86a16_read(state, 0x7f, &dev_id);
+       if (dev_id != 0xfe)
+               goto error;
+
+       memcpy(&state->frontend.ops, &mb86a16_ops, sizeof(struct dvb_frontend_ops));
+       state->frontend.demodulator_priv = state;
+       state->frontend.ops.set_voltage = state->config->set_voltage;
+
+       return &state->frontend;
+error:
+       kfree(state);
+       return NULL;
+}
+EXPORT_SYMBOL(mb86a16_attach);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Manu Abraham");
diff --git a/drivers/media/dvb/frontends/mb86a16.h b/drivers/media/dvb/frontends/mb86a16.h
new file mode 100644 (file)
index 0000000..6ea8c37
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+       Fujitsu MB86A16 DVB-S/DSS DC Receiver driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MB86A16_H
+#define __MB86A16_H
+
+#include <linux/dvb/frontend.h>
+#include "dvb_frontend.h"
+
+
+struct mb86a16_config {
+       u8 demod_address;
+
+       int (*set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+};
+
+
+
+#if defined(CONFIG_DVB_MB86A16) || (defined(CONFIG_DVB_MB86A16_MODULE) && defined(MODULE))
+
+extern struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config,
+                                          struct i2c_adapter *i2c_adap);
+
+#else
+
+static inline struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config,
+                                          struct i2c_adapter *i2c_adap)
+{
+       printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+       return NULL;
+}
+
+#endif /* CONFIG_DVB_MB86A16 */
+
+#endif /* __MB86A16_H */
diff --git a/drivers/media/dvb/frontends/mb86a16_priv.h b/drivers/media/dvb/frontends/mb86a16_priv.h
new file mode 100644 (file)
index 0000000..360a35a
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+       Fujitsu MB86A16 DVB-S/DSS DC Receiver driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MB86A16_PRIV_H
+#define __MB86A16_PRIV_H
+
+#define MB86A16_TSOUT          0x00
+#define MB86A16_TSOUT_HIZSEL   (0x01 << 5)
+#define MB86A16_TSOUT_HIZCNTI  (0x01 << 4)
+#define MB86A16_TSOUT_MODE     (0x01 << 3)
+#define MB86A16_TSOUT_ORDER    (0x01 << 2)
+#define MB86A16_TSOUT_ERROR    (0x01 << 1)
+#define Mb86A16_TSOUT_EDGE     (0x01 << 0)
+
+#define MB86A16_FEC            0x01
+#define MB86A16_FEC_FSYNC      (0x01 << 5)
+#define MB86A16_FEC_PCKB8      (0x01 << 4)
+#define MB86A16_FEC_DVDS       (0x01 << 3)
+#define MB86A16_FEC_EREN       (0x01 << 2)
+#define Mb86A16_FEC_RSEN       (0x01 << 1)
+#define MB86A16_FEC_DIEN       (0x01 << 0)
+
+#define MB86A16_AGC            0x02
+#define MB86A16_AGC_AGMD       (0x01 << 6)
+#define MB86A16_AGC_AGCW       (0x0f << 2)
+#define MB86A16_AGC_AGCP       (0x01 << 1)
+#define MB86A16_AGC_AGCR       (0x01 << 0)
+
+#define MB86A16_SRATE1         0x03
+#define MB86A16_SRATE1_DECI    (0x07 << 2)
+#define MB86A16_SRATE1_CSEL    (0x01 << 1)
+#define MB86A16_SRATE1_RSEL    (0x01 << 0)
+
+#define MB86A16_SRATE2         0x04
+#define MB86A16_SRATE2_STOFSL  (0xff << 0)
+
+#define MB86A16_SRATE3         0x05
+#define MB86A16_SRATE2_STOFSH  (0xff << 0)
+
+#define MB86A16_VITERBI                0x06
+#define MB86A16_FRAMESYNC      0x07
+#define MB86A16_CRLFILTCOEF1   0x08
+#define MB86A16_CRLFILTCOEF2   0x09
+#define MB86A16_STRFILTCOEF1   0x0a
+#define MB86A16_STRFILTCOEF2   0x0b
+#define MB86A16_RESET          0x0c
+#define MB86A16_STATUS         0x0d
+#define MB86A16_AFCML          0x0e
+#define MB86A16_AFCMH          0x0f
+#define MB86A16_BERMON         0x10
+#define MB86A16_BERTAB         0x11
+#define MB86A16_BERLSB         0x12
+#define MB86A16_BERMID         0x13
+#define MB86A16_BERMSB         0x14
+#define MB86A16_AGCM           0x15
+
+#define MB86A16_DCC1           0x16
+#define MB86A16_DCC1_DISTA     (0x01 << 7)
+#define MB86A16_DCC1_PRTY      (0x01 << 6)
+#define MB86A16_DCC1_CTOE      (0x01 << 5)
+#define MB86A16_DCC1_TBEN      (0x01 << 4)
+#define MB86A16_DCC1_TBO       (0x01 << 3)
+#define MB86A16_DCC1_NUM       (0x07 << 0)
+
+#define MB86A16_DCC2           0x17
+#define MB86A16_DCC2_DCBST     (0x01 << 0)
+
+#define MB86A16_DCC3           0x18
+#define MB86A16_DCC3_CODE0     (0xff << 0)
+
+#define MB86A16_DCC4           0x19
+#define MB86A16_DCC4_CODE1     (0xff << 0)
+
+#define MB86A16_DCC5           0x1a
+#define MB86A16_DCC5_CODE2     (0xff << 0)
+
+#define MB86A16_DCC6           0x1b
+#define MB86A16_DCC6_CODE3     (0xff << 0)
+
+#define MB86A16_DCC7           0x1c
+#define MB86A16_DCC7_CODE4     (0xff << 0)
+
+#define MB86A16_DCC8           0x1d
+#define MB86A16_DCC8_CODE5     (0xff << 0)
+
+#define MB86A16_DCCOUT         0x1e
+#define MB86A16_DCCOUT_DISEN   (0x01 << 0)
+
+#define MB86A16_TONEOUT1       0x1f
+#define MB86A16_TONE_TDIVL     (0xff << 0)
+
+#define MB86A16_TONEOUT2       0x20
+#define MB86A16_TONE_TMD       (0x03 << 2)
+#define MB86A16_TONE_TDIVH     (0x03 << 0)
+
+#define MB86A16_FREQ1          0x21
+#define MB86A16_FREQ2          0x22
+#define MB86A16_FREQ3          0x23
+#define MB86A16_FREQ4          0x24
+#define MB86A16_FREQSET                0x25
+#define MB86A16_CNM            0x26
+#define MB86A16_PORT0          0x27
+#define MB86A16_PORT1          0x28
+#define MB86A16_DRCFILT                0x29
+#define MB86A16_AFC            0x2a
+#define MB86A16_AFCEXL         0x2b
+#define MB86A16_AFCEXH         0x2c
+#define MB86A16_DAGC           0x2d
+#define MB86A16_SEQMODE                0x32
+#define MB86A16_S0S1T          0x33
+#define MB86A16_S2S3T          0x34
+#define MB86A16_S4S5T          0x35
+#define MB86A16_CNTMR          0x36
+#define MB86A16_SIG1           0x37
+#define MB86A16_SIG2           0x38
+#define MB86A16_VIMAG          0x39
+#define MB86A16_VISET1         0x3a
+#define MB86A16_VISET2         0x3b
+#define MB86A16_VISET3         0x3c
+#define MB86A16_FAGCS1         0x3d
+#define MB86A16_FAGCS2         0x3e
+#define MB86A16_FAGCS3         0x3f
+#define MB86A16_FAGCS4         0x40
+#define MB86A16_FAGCS5         0x41
+#define MB86A16_FAGCS6         0x42
+#define MB86A16_CRM            0x43
+#define MB86A16_STRM           0x44
+#define MB86A16_DAGCML         0x45
+#define MB86A16_DAGCMH         0x46
+#define MB86A16_QPSKTST                0x49
+#define MB86A16_DISTMON                0x52
+#define MB86A16_VERSION                0x7f
+
+#endif /* __MB86A16_PRIV_H */
index 9552a22ccffb23b215897979fd51f45a2d8dc07a..d21a327db62996bed8ed3808761ba6776fbb378d 100644 (file)
@@ -97,8 +97,6 @@
 #define        LNB_SUPPLY_CTRL_REG_4           0xce
 #define        LNB_SUPPLY_STATUS_REG           0xcf
 
-#define FALSE  0
-#define TRUE   1
 #define FAIL   -1
 #define PASS   0
 
@@ -718,7 +716,7 @@ static int si21xx_set_frontend(struct dvb_frontend *fe,
        int fine_tune_freq;
        unsigned char sample_rate = 0;
        /* boolean */
-       unsigned int inband_interferer_ind;
+       bool inband_interferer_ind;
 
        /* INTERMEDIATE VALUES */
        int icoarse_tune_freq; /* MHz */
@@ -728,15 +726,8 @@ static int si21xx_set_frontend(struct dvb_frontend *fe,
        unsigned int x1;
        unsigned int x2;
        int i;
-       unsigned int inband_interferer_div2[ALLOWABLE_FS_COUNT] = {
-                       FALSE, FALSE, FALSE, FALSE, FALSE,
-                       FALSE, FALSE, FALSE, FALSE, FALSE
-       };
-       unsigned int inband_interferer_div4[ALLOWABLE_FS_COUNT] = {
-                       FALSE, FALSE, FALSE, FALSE, FALSE,
-                       FALSE, FALSE, FALSE, FALSE, FALSE
-       };
-
+       bool inband_interferer_div2[ALLOWABLE_FS_COUNT];
+       bool inband_interferer_div4[ALLOWABLE_FS_COUNT];
        int status;
 
        /* allowable sample rates for ADC in MHz */
@@ -762,7 +753,7 @@ static int si21xx_set_frontend(struct dvb_frontend *fe,
        }
 
        for (i = 0; i < ALLOWABLE_FS_COUNT; ++i)
-               inband_interferer_div2[i] = inband_interferer_div4[i] = FALSE;
+               inband_interferer_div2[i] = inband_interferer_div4[i] = false;
 
        if_limit_high = -700000;
        if_limit_low = -100000;
@@ -798,7 +789,7 @@ static int si21xx_set_frontend(struct dvb_frontend *fe,
 
                if (((band_low < x1) && (x1 < band_high)) ||
                                        ((band_low < x2) && (x2 < band_high)))
-                                       inband_interferer_div4[i] = TRUE;
+                                       inband_interferer_div4[i] = true;
 
        }
 
@@ -811,25 +802,28 @@ static int si21xx_set_frontend(struct dvb_frontend *fe,
 
                if (((band_low < x1) && (x1 < band_high)) ||
                                        ((band_low < x2) && (x2 < band_high)))
-                                       inband_interferer_div2[i] = TRUE;
+                                       inband_interferer_div2[i] = true;
        }
 
-       inband_interferer_ind = TRUE;
-       for (i = 0; i < ALLOWABLE_FS_COUNT; ++i)
-               inband_interferer_ind &= inband_interferer_div2[i] |
-                                               inband_interferer_div4[i];
+       inband_interferer_ind = true;
+       for (i = 0; i < ALLOWABLE_FS_COUNT; ++i) {
+               if (inband_interferer_div2[i] || inband_interferer_div4[i]) {
+                       inband_interferer_ind = false;
+                       break;
+               }
+       }
 
        if (inband_interferer_ind) {
                for (i = 0; i < ALLOWABLE_FS_COUNT; ++i) {
-                       if (inband_interferer_div2[i] == FALSE) {
+                       if (!inband_interferer_div2[i]) {
                                sample_rate = (u8) afs[i];
                                break;
                        }
                }
        } else {
                for (i = 0; i < ALLOWABLE_FS_COUNT; ++i) {
-                       if ((inband_interferer_div2[i] |
-                                       inband_interferer_div4[i]) == FALSE) {
+                       if ((inband_interferer_div2[i] ||
+                            !inband_interferer_div4[i])) {
                                sample_rate = (u8) afs[i];
                                break;
                        }
index 29c3fa85c2276de6971d44340f8cd8f61d6f68b0..e3e35d1ce8384270837e1b77ebe27de09f4d4d92 100644 (file)
@@ -49,6 +49,8 @@ struct stv0900_config {
        u8 tun2_maddress;
        u8 tun1_adc;/* 1 for stv6110, 2 for stb6100 */
        u8 tun2_adc;
+       u8 tun1_type;/* for now 3 for stb6100 auto, else - software */
+       u8 tun2_type;
        /* Set device param to start dma */
        int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
 };
index 8762c86044a5a4fb310d4b5d2e845aaeb0aa3218..01f8f1f802fdadefc5e50ac8603e1ff97f3c9eac 100644 (file)
@@ -177,7 +177,7 @@ u8 stv0900_read_reg(struct stv0900_internal *intp, u16 reg)
        return buf;
 }
 
-void extract_mask_pos(u32 label, u8 *mask, u8 *pos)
+static void extract_mask_pos(u32 label, u8 *mask, u8 *pos)
 {
        u8 position = 0, i = 0;
 
@@ -218,7 +218,7 @@ u8 stv0900_get_bits(struct stv0900_internal *intp, u32 label)
        return val;
 }
 
-enum fe_stv0900_error stv0900_initialize(struct stv0900_internal *intp)
+static enum fe_stv0900_error stv0900_initialize(struct stv0900_internal *intp)
 {
        s32 i;
 
@@ -282,7 +282,7 @@ enum fe_stv0900_error stv0900_initialize(struct stv0900_internal *intp)
        return STV0900_NO_ERROR;
 }
 
-u32 stv0900_get_mclk_freq(struct stv0900_internal *intp, u32 ext_clk)
+static u32 stv0900_get_mclk_freq(struct stv0900_internal *intp, u32 ext_clk)
 {
        u32 mclk = 90000000, div = 0, ad_div = 0;
 
@@ -296,7 +296,7 @@ u32 stv0900_get_mclk_freq(struct stv0900_internal *intp, u32 ext_clk)
        return mclk;
 }
 
-enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32 mclk)
+static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32 mclk)
 {
        u32 m_div, clk_sel;
 
@@ -334,7 +334,7 @@ enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32 mclk)
        return STV0900_NO_ERROR;
 }
 
-u32 stv0900_get_err_count(struct stv0900_internal *intp, int cntr,
+static u32 stv0900_get_err_count(struct stv0900_internal *intp, int cntr,
                                        enum fe_stv0900_demod_num demod)
 {
        u32 lsb, msb, hsb, err_val;
@@ -567,6 +567,46 @@ void stv0900_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
        }
 }
 
+u32 stv0900_get_freq_auto(struct stv0900_internal *intp, int demod)
+{
+       u32 freq, round;
+       /*      Formulat :
+       Tuner_Frequency(MHz)    = Regs / 64
+       Tuner_granularity(MHz)  = Regs / 2048
+       real_Tuner_Frequency    = Tuner_Frequency(MHz) - Tuner_granularity(MHz)
+       */
+       freq = (stv0900_get_bits(intp, TUN_RFFREQ2) << 10) +
+               (stv0900_get_bits(intp, TUN_RFFREQ1) << 2) +
+               stv0900_get_bits(intp, TUN_RFFREQ0);
+
+       freq = (freq * 1000) / 64;
+
+       round = (stv0900_get_bits(intp, TUN_RFRESTE1) >> 2) +
+               stv0900_get_bits(intp, TUN_RFRESTE0);
+
+       round = (round * 1000) / 2048;
+
+       return freq + round;
+}
+
+void stv0900_set_tuner_auto(struct stv0900_internal *intp, u32 Frequency,
+                                               u32 Bandwidth, int demod)
+{
+       u32 tunerFrequency;
+       /* Formulat:
+       Tuner_frequency_reg= Frequency(MHz)*64
+       */
+       tunerFrequency = (Frequency * 64) / 1000;
+
+       stv0900_write_bits(intp, TUN_RFFREQ2, (tunerFrequency >> 10));
+       stv0900_write_bits(intp, TUN_RFFREQ1, (tunerFrequency >> 2) & 0xff);
+       stv0900_write_bits(intp, TUN_RFFREQ0, (tunerFrequency & 0x03));
+       /* Low Pass Filter = BW /2 (MHz)*/
+       stv0900_write_bits(intp, TUN_BW, Bandwidth / 2000000);
+       /* Tuner Write trig */
+       stv0900_write_reg(intp, TNRLD, 1);
+}
+
 static s32 stv0900_get_rf_level(struct stv0900_internal *intp,
                                const struct stv0900_table *lookup,
                                enum fe_stv0900_demod_num demod)
@@ -1329,7 +1369,6 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
        enum fe_stv0900_error error = STV0900_NO_ERROR;
        enum fe_stv0900_error demodError = STV0900_NO_ERROR;
        struct stv0900_internal *intp = NULL;
-
        int selosci, i;
 
        struct stv0900_inode *temp_int = find_inode(state->i2c_adap,
@@ -1345,7 +1384,14 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
        } else {
                state->internal = kmalloc(sizeof(struct stv0900_internal),
                                                                GFP_KERNEL);
+               if (state->internal == NULL)
+                       return STV0900_INVALID_HANDLE;
                temp_int = append_internal(state->internal);
+               if (temp_int == NULL) {
+                       kfree(state->internal);
+                       state->internal = NULL;
+                       return STV0900_INVALID_HANDLE;
+               }
                state->internal->dmds_used = 1;
                state->internal->i2c_adap = state->i2c_adap;
                state->internal->i2c_addr = state->config->demod_address;
@@ -1371,11 +1417,6 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
                return error;
        }
 
-       if (state->internal == NULL) {
-               error = STV0900_INVALID_HANDLE;
-               return error;
-       }
-
        intp = state->internal;
 
        intp->demod_mode = p_init->demod_mode;
@@ -1404,6 +1445,27 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
                stv0900_write_bits(intp, F0900_P1_RST_HWARE, 0);
        }
 
+       intp->tuner_type[0] = p_init->tuner1_type;
+       intp->tuner_type[1] = p_init->tuner2_type;
+       /* tuner init */
+       switch (p_init->tuner1_type) {
+       case 3: /*FE_AUTO_STB6100:*/
+               stv0900_write_reg(intp, R0900_P1_TNRCFG, 0x3c);
+               stv0900_write_reg(intp, R0900_P1_TNRCFG2, 0x86);
+               stv0900_write_reg(intp, R0900_P1_TNRCFG3, 0x18);
+               stv0900_write_reg(intp, R0900_P1_TNRXTAL, 27); /* 27MHz */
+               stv0900_write_reg(intp, R0900_P1_TNRSTEPS, 0x05);
+               stv0900_write_reg(intp, R0900_P1_TNRGAIN, 0x17);
+               stv0900_write_reg(intp, R0900_P1_TNRADJ, 0x1f);
+               stv0900_write_reg(intp, R0900_P1_TNRCTL2, 0x0);
+               stv0900_write_bits(intp, F0900_P1_TUN_TYPE, 3);
+               break;
+       /* case FE_SW_TUNER: */
+       default:
+               stv0900_write_bits(intp, F0900_P1_TUN_TYPE, 6);
+               break;
+       }
+
        stv0900_write_bits(intp, F0900_P1_TUN_MADDRESS, p_init->tun1_maddress);
        switch (p_init->tuner1_adc) {
        case 1:
@@ -1413,6 +1475,27 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
                break;
        }
 
+       stv0900_write_reg(intp, R0900_P1_TNRLD, 1); /* hw tuner */
+
+       /* tuner init */
+       switch (p_init->tuner2_type) {
+       case 3: /*FE_AUTO_STB6100:*/
+               stv0900_write_reg(intp, R0900_P2_TNRCFG, 0x3c);
+               stv0900_write_reg(intp, R0900_P2_TNRCFG2, 0x86);
+               stv0900_write_reg(intp, R0900_P2_TNRCFG3, 0x18);
+               stv0900_write_reg(intp, R0900_P2_TNRXTAL, 27); /* 27MHz */
+               stv0900_write_reg(intp, R0900_P2_TNRSTEPS, 0x05);
+               stv0900_write_reg(intp, R0900_P2_TNRGAIN, 0x17);
+               stv0900_write_reg(intp, R0900_P2_TNRADJ, 0x1f);
+               stv0900_write_reg(intp, R0900_P2_TNRCTL2, 0x0);
+               stv0900_write_bits(intp, F0900_P2_TUN_TYPE, 3);
+               break;
+       /* case FE_SW_TUNER: */
+       default:
+               stv0900_write_bits(intp, F0900_P2_TUN_TYPE, 6);
+               break;
+       }
+
        stv0900_write_bits(intp, F0900_P2_TUN_MADDRESS, p_init->tun2_maddress);
        switch (p_init->tuner2_adc) {
        case 1:
@@ -1422,6 +1505,8 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe,
                break;
        }
 
+       stv0900_write_reg(intp, R0900_P2_TNRLD, 1); /* hw tuner */
+
        stv0900_write_bits(intp, F0900_P1_TUN_IQSWAP, p_init->tun1_iq_inv);
        stv0900_write_bits(intp, F0900_P2_TUN_IQSWAP, p_init->tun2_iq_inv);
        stv0900_set_mclk(intp, 135000000);
@@ -1824,10 +1909,12 @@ struct dvb_frontend *stv0900_attach(const struct stv0900_config *config,
                init_params.tun1_maddress       = config->tun1_maddress;
                init_params.tun1_iq_inv         = STV0900_IQ_NORMAL;
                init_params.tuner1_adc          = config->tun1_adc;
+               init_params.tuner1_type         = config->tun1_type;
                init_params.path2_ts_clock      = config->path2_mode;
                init_params.ts_config           = config->ts_config_regs;
                init_params.tun2_maddress       = config->tun2_maddress;
                init_params.tuner2_adc          = config->tun2_adc;
+               init_params.tuner2_type         = config->tun2_type;
                init_params.tun2_iq_inv         = STV0900_IQ_SWAPPED;
 
                err_stv0900 = stv0900_init_internal(&state->frontend,
index d8ba8a984abe5f956df1b71f5865cfb8992bb764..b62b0f0a4fef9f2625a6fe8cfaa4f7173d71bf7d 100644 (file)
@@ -247,6 +247,7 @@ struct stv0900_init_params{
 
        u8      tun1_maddress;
        int     tuner1_adc;
+       int     tuner1_type;
 
        /* IQ from the tuner1 to the demod */
        enum stv0900_iq_inversion       tun1_iq_inv;
@@ -254,6 +255,7 @@ struct stv0900_init_params{
 
        u8      tun2_maddress;
        int     tuner2_adc;
+       int     tuner2_type;
 
        /* IQ from the tuner2 to the demod */
        enum stv0900_iq_inversion       tun2_iq_inv;
@@ -309,6 +311,8 @@ struct stv0900_internal{
        s32     bw[2];
        s32     symbol_rate[2];
        s32     srch_range[2];
+       /* for software/auto tuner */
+       int     tuner_type[2];
 
        /* algorithm for search Blind, Cold or Warm*/
        enum fe_stv0900_search_algo     srch_algo[2];
@@ -394,4 +398,11 @@ extern enum
 fe_stv0900_tracking_standard stv0900_get_standard(struct dvb_frontend *fe,
                                enum fe_stv0900_demod_num demod);
 
+extern u32
+stv0900_get_freq_auto(struct stv0900_internal *intp, int demod);
+
+extern void
+stv0900_set_tuner_auto(struct stv0900_internal *intp, u32 Frequency,
+                                               u32 Bandwidth, int demod);
+
 #endif
index 7b8edf192e9713cf49bcb8751813cb3a85209830..731afe93a8235af87521253f7b43052ff47044d6 100644 (file)
@@ -3174,17 +3174,21 @@ extern s32 shiftx(s32 x, int demod, s32 shift);
 #define R0900_P1_TNRRF1 0xf4e9
 #define TNRRF1 REGx(R0900_P1_TNRRF1)
 #define F0900_P1_TUN_RFFREQ2 0xf4e900ff
+#define TUN_RFFREQ2 FLDx(F0900_P1_TUN_RFFREQ2)
 
 /*P1_TNRRF0*/
 #define R0900_P1_TNRRF0 0xf4ea
 #define TNRRF0 REGx(R0900_P1_TNRRF0)
 #define F0900_P1_TUN_RFFREQ1 0xf4ea00ff
+#define TUN_RFFREQ1 FLDx(F0900_P1_TUN_RFFREQ1)
 
 /*P1_TNRBW*/
 #define R0900_P1_TNRBW 0xf4eb
 #define TNRBW REGx(R0900_P1_TNRBW)
 #define F0900_P1_TUN_RFFREQ0 0xf4eb00c0
+#define TUN_RFFREQ0 FLDx(F0900_P1_TUN_RFFREQ0)
 #define F0900_P1_TUN_BW 0xf4eb003f
+#define TUN_BW FLDx(F0900_P1_TUN_BW)
 
 /*P1_TNRADJ*/
 #define R0900_P1_TNRADJ 0xf4ec
@@ -3234,11 +3238,13 @@ extern s32 shiftx(s32 x, int demod, s32 shift);
 #define F0900_P1_TUN_I2CLOCKED 0xf4f60010
 #define F0900_P1_TUN_PROGDONE 0xf4f6000c
 #define F0900_P1_TUN_RFRESTE1 0xf4f60003
+#define TUN_RFRESTE1 FLDx(F0900_P1_TUN_RFRESTE1)
 
 /*P1_TNRRESTE*/
 #define R0900_P1_TNRRESTE 0xf4f7
 #define TNRRESTE REGx(R0900_P1_TNRRESTE)
 #define F0900_P1_TUN_RFRESTE0 0xf4f700ff
+#define TUN_RFRESTE0 FLDx(F0900_P1_TUN_RFRESTE0)
 
 /*P1_SMAPCOEF7*/
 #define R0900_P1_SMAPCOEF7 0xf500
index b8da87fa637f0b9aff1660cdacaf995046153d85..ba0709b2d4333a3d9811ceecb63e2142f11e361e 100644 (file)
@@ -193,7 +193,7 @@ static int stv0900_search_carr_sw_loop(struct stv0900_internal *intp,
        return lock;
 }
 
-int stv0900_sw_algo(struct stv0900_internal *intp,
+static int stv0900_sw_algo(struct stv0900_internal *intp,
                                enum fe_stv0900_demod_num demod)
 {
        int     lock = FALSE,
@@ -606,7 +606,12 @@ static int stv0900_get_demod_cold_lock(struct dvb_frontend *fe,
                        tuner_freq -= (current_step * currier_step);
 
                if (intp->chip_id <= 0x20) {
-                       stv0900_set_tuner(fe, tuner_freq, intp->bw[d]);
+                       if (intp->tuner_type[d] == 3)
+                               stv0900_set_tuner_auto(intp, tuner_freq,
+                                               intp->bw[d], demod);
+                       else
+                               stv0900_set_tuner(fe, tuner_freq, intp->bw[d]);
+
                        stv0900_write_reg(intp, DMDISTATE, 0x1c);
                        stv0900_write_reg(intp, CFRINIT1, 0);
                        stv0900_write_reg(intp, CFRINIT0, 0);
@@ -790,7 +795,7 @@ static enum fe_stv0900_fec stv0900_get_vit_fec(struct stv0900_internal *intp,
        return prate;
 }
 
-void stv0900_set_dvbs1_track_car_loop(struct stv0900_internal *intp,
+static void stv0900_set_dvbs1_track_car_loop(struct stv0900_internal *intp,
                                        enum fe_stv0900_demod_num demod,
                                        u32 srate)
 {
@@ -976,8 +981,16 @@ static void stv0900_track_optimization(struct dvb_frontend *fe)
                                        intp->rolloff) + 10000000;
 
                if ((intp->chip_id >= 0x20) || (blind_tun_sw == 1)) {
-                       if (intp->srch_algo[demod] != STV0900_WARM_START)
-                               stv0900_set_bandwidth(fe, intp->bw[demod]);
+                       if (intp->srch_algo[demod] != STV0900_WARM_START) {
+                               if (intp->tuner_type[demod] == 3)
+                                       stv0900_set_tuner_auto(intp,
+                                                       intp->freq[demod],
+                                                       intp->bw[demod],
+                                                       demod);
+                               else
+                                       stv0900_set_bandwidth(fe,
+                                                       intp->bw[demod]);
+                       }
                }
 
                if ((intp->srch_algo[demod] == STV0900_BLIND_SEARCH) ||
@@ -1202,7 +1215,11 @@ fe_stv0900_signal_type stv0900_get_signal_params(struct dvb_frontend *fe)
        }
 
        result->standard = stv0900_get_standard(fe, d);
-       result->frequency = stv0900_get_tuner_freq(fe);
+       if (intp->tuner_type[demod] == 3)
+               result->frequency = stv0900_get_freq_auto(intp, d);
+       else
+               result->frequency = stv0900_get_tuner_freq(fe);
+
        offsetFreq = stv0900_get_carr_freq(intp, intp->mclk, d) / 1000;
        result->frequency += offsetFreq;
        result->symbol_rate = stv0900_get_symbol_rate(intp, intp->mclk, d);
@@ -1213,6 +1230,9 @@ fe_stv0900_signal_type stv0900_get_signal_params(struct dvb_frontend *fe)
        result->pilot = stv0900_get_bits(intp, DEMOD_TYPE) & 0x01;
        result->frame_len = ((u32)stv0900_get_bits(intp, DEMOD_TYPE)) >> 1;
        result->rolloff = stv0900_get_bits(intp, ROLLOFF_STATUS);
+
+       dprintk("%s: modcode=0x%x \n", __func__, result->modcode);
+
        switch (result->standard) {
        case STV0900_DVBS2_STANDARD:
                result->spectrum = stv0900_get_bits(intp, SPECINV_DEMOD);
@@ -1239,7 +1259,11 @@ fe_stv0900_signal_type stv0900_get_signal_params(struct dvb_frontend *fe)
        if ((intp->srch_algo[d] == STV0900_BLIND_SEARCH) ||
                                (intp->symbol_rate[d] < 10000000)) {
                offsetFreq = result->frequency - intp->freq[d];
-               intp->freq[d] = stv0900_get_tuner_freq(fe);
+               if (intp->tuner_type[demod] == 3)
+                       intp->freq[d] = stv0900_get_freq_auto(intp, d);
+               else
+                       intp->freq[d] = stv0900_get_tuner_freq(fe);
+
                if (ABS(offsetFreq) <= ((intp->srch_range[d] / 2000) + 500))
                        range = STV0900_RANGEOK;
                else if (ABS(offsetFreq) <=
@@ -1481,7 +1505,12 @@ static u32 stv0900_search_srate_coarse(struct dvb_frontend *fe)
                        else
                                tuner_freq -= (current_step * currier_step);
 
-                       stv0900_set_tuner(fe, tuner_freq, intp->bw[demod]);
+                       if (intp->tuner_type[demod] == 3)
+                               stv0900_set_tuner_auto(intp, tuner_freq,
+                                               intp->bw[demod], demod);
+                       else
+                               stv0900_set_tuner(fe, tuner_freq,
+                                               intp->bw[demod]);
                }
        }
 
@@ -1608,7 +1637,8 @@ static int stv0900_blind_search_algo(struct dvb_frontend *fe)
 
        agc2_int = stv0900_blind_check_agc2_min_level(intp, demod);
 
-       if (agc2_int > STV0900_BLIND_SEARCH_AGC2_TH)
+       dprintk("%s agc2_int=%d agc2_th=%d \n", __func__, agc2_int, agc2_th);
+       if (agc2_int > agc2_th)
                return FALSE;
 
        if (intp->chip_id == 0x10)
@@ -1875,7 +1905,11 @@ enum fe_stv0900_signal_type stv0900_algo(struct dvb_frontend *fe)
 
        }
 
-       stv0900_set_tuner(fe, intp->freq[demod], intp->bw[demod]);
+       if (intp->tuner_type[demod] == 3)
+               stv0900_set_tuner_auto(intp, intp->freq[demod],
+                               intp->bw[demod], demod);
+       else
+               stv0900_set_tuner(fe, intp->freq[demod], intp->bw[demod]);
 
        agc1_power = MAKEWORD(stv0900_get_bits(intp, AGCIQ_VALUE1),
                                stv0900_get_bits(intp, AGCIQ_VALUE0));
index 1573466a5c740aa544b4a68e863722f1791f1892..c52c3357dc54dc71900f332c8e5c91e4b1f50cd5 100644 (file)
 static unsigned int verbose;
 module_param(verbose, int, 0644);
 
-struct mutex demod_lock;
+/* internal params node */
+struct stv090x_dev {
+       /* pointer for internal params, one for each pair of demods */
+       struct stv090x_internal         *internal;
+       struct stv090x_dev              *next_dev;
+};
+
+/* first internal params */
+static struct stv090x_dev *stv090x_first_dev;
+
+/* find chip by i2c adapter and i2c address */
+static struct stv090x_dev *find_dev(struct i2c_adapter *i2c_adap,
+                                       u8 i2c_addr)
+{
+       struct stv090x_dev *temp_dev = stv090x_first_dev;
+
+       /*
+        Search of the last stv0900 chip or
+        find it by i2c adapter and i2c address */
+       while ((temp_dev != NULL) &&
+               ((temp_dev->internal->i2c_adap != i2c_adap) ||
+               (temp_dev->internal->i2c_addr != i2c_addr))) {
+
+               temp_dev = temp_dev->next_dev;
+       }
+
+       return temp_dev;
+}
+
+/* deallocating chip */
+static void remove_dev(struct stv090x_internal *internal)
+{
+       struct stv090x_dev *prev_dev = stv090x_first_dev;
+       struct stv090x_dev *del_dev = find_dev(internal->i2c_adap,
+                                               internal->i2c_addr);
+
+       if (del_dev != NULL) {
+               if (del_dev == stv090x_first_dev) {
+                       stv090x_first_dev = del_dev->next_dev;
+               } else {
+                       while (prev_dev->next_dev != del_dev)
+                               prev_dev = prev_dev->next_dev;
+
+                       prev_dev->next_dev = del_dev->next_dev;
+               }
+
+               kfree(del_dev);
+       }
+}
+
+/* allocating new chip */
+static struct stv090x_dev *append_internal(struct stv090x_internal *internal)
+{
+       struct stv090x_dev *new_dev;
+       struct stv090x_dev *temp_dev;
+
+       new_dev = kmalloc(sizeof(struct stv090x_dev), GFP_KERNEL);
+       if (new_dev != NULL) {
+               new_dev->internal = internal;
+               new_dev->next_dev = NULL;
+
+               /* append to list */
+               if (stv090x_first_dev == NULL) {
+                       stv090x_first_dev = new_dev;
+               } else {
+                       temp_dev = stv090x_first_dev;
+                       while (temp_dev->next_dev != NULL)
+                               temp_dev = temp_dev->next_dev;
+
+                       temp_dev->next_dev = new_dev;
+               }
+       }
+
+       return new_dev;
+}
+
 
 /* DVBS1 and DSS C/N Lookup table */
 static const struct stv090x_tab stv090x_s1cn_tab[] = {
@@ -683,6 +758,9 @@ static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
        struct stv090x_state *state = fe->demodulator_priv;
        u32 reg;
 
+       if (enable)
+               mutex_lock(&state->internal->tuner_lock);
+
        reg = STV090x_READ_DEMOD(state, I2CRPT);
        if (enable) {
                dprintk(FE_DEBUG, 1, "Enable Gate");
@@ -696,9 +774,14 @@ static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
                if ((STV090x_WRITE_DEMOD(state, I2CRPT, reg)) < 0)
                        goto err;
        }
+
+       if (!enable)
+               mutex_unlock(&state->internal->tuner_lock);
+
        return 0;
 err:
        dprintk(FE_ERROR, 1, "I/O error");
+       mutex_unlock(&state->internal->tuner_lock);
        return -1;
 }
 
@@ -755,13 +838,13 @@ static int stv090x_set_srate(struct stv090x_state *state, u32 srate)
 
        if (srate > 60000000) {
                sym  = (srate << 4); /* SR * 2^16 / master_clk */
-               sym /= (state->mclk >> 12);
+               sym /= (state->internal->mclk >> 12);
        } else if (srate > 6000000) {
                sym  = (srate << 6);
-               sym /= (state->mclk >> 10);
+               sym /= (state->internal->mclk >> 10);
        } else {
                sym  = (srate << 9);
-               sym /= (state->mclk >> 7);
+               sym /= (state->internal->mclk >> 7);
        }
 
        if (STV090x_WRITE_DEMOD(state, SFRINIT1, (sym >> 8) & 0x7f) < 0) /* MSB */
@@ -782,13 +865,13 @@ static int stv090x_set_max_srate(struct stv090x_state *state, u32 clk, u32 srate
        srate = 105 * (srate / 100);
        if (srate > 60000000) {
                sym  = (srate << 4); /* SR * 2^16 / master_clk */
-               sym /= (state->mclk >> 12);
+               sym /= (state->internal->mclk >> 12);
        } else if (srate > 6000000) {
                sym  = (srate << 6);
-               sym /= (state->mclk >> 10);
+               sym /= (state->internal->mclk >> 10);
        } else {
                sym  = (srate << 9);
-               sym /= (state->mclk >> 7);
+               sym /= (state->internal->mclk >> 7);
        }
 
        if (sym < 0x7fff) {
@@ -816,13 +899,13 @@ static int stv090x_set_min_srate(struct stv090x_state *state, u32 clk, u32 srate
        srate = 95 * (srate / 100);
        if (srate > 60000000) {
                sym  = (srate << 4); /* SR * 2^16 / master_clk */
-               sym /= (state->mclk >> 12);
+               sym /= (state->internal->mclk >> 12);
        } else if (srate > 6000000) {
                sym  = (srate << 6);
-               sym /= (state->mclk >> 10);
+               sym /= (state->internal->mclk >> 10);
        } else {
                sym  = (srate << 9);
-               sym /= (state->mclk >> 7);
+               sym /= (state->internal->mclk >> 7);
        }
 
        if (STV090x_WRITE_DEMOD(state, SFRLOW1, ((sym >> 8) & 0x7f)) < 0) /* MSB */
@@ -1103,21 +1186,21 @@ static int stv090x_vitclk_ctl(struct stv090x_state *state, int enable)
 
        switch (state->demod) {
        case STV090x_DEMODULATOR_0:
-               mutex_lock(&demod_lock);
+               mutex_lock(&state->internal->demod_lock);
                reg = stv090x_read_reg(state, STV090x_STOPCLK2);
                STV090x_SETFIELD(reg, STOP_CLKVIT1_FIELD, enable);
                if (stv090x_write_reg(state, STV090x_STOPCLK2, reg) < 0)
                        goto err;
-               mutex_unlock(&demod_lock);
+               mutex_unlock(&state->internal->demod_lock);
                break;
 
        case STV090x_DEMODULATOR_1:
-               mutex_lock(&demod_lock);
+               mutex_lock(&state->internal->demod_lock);
                reg = stv090x_read_reg(state, STV090x_STOPCLK2);
                STV090x_SETFIELD(reg, STOP_CLKVIT2_FIELD, enable);
                if (stv090x_write_reg(state, STV090x_STOPCLK2, reg) < 0)
                        goto err;
-               mutex_unlock(&demod_lock);
+               mutex_unlock(&state->internal->demod_lock);
                break;
 
        default:
@@ -1126,14 +1209,14 @@ static int stv090x_vitclk_ctl(struct stv090x_state *state, int enable)
        }
        return 0;
 err:
-       mutex_unlock(&demod_lock);
+       mutex_unlock(&state->internal->demod_lock);
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
 }
 
 static int stv090x_dvbs_track_crl(struct stv090x_state *state)
 {
-       if (state->dev_ver >= 0x30) {
+       if (state->internal->dev_ver >= 0x30) {
                /* Set ACLC BCLC optimised value vs SR */
                if (state->srate >= 15000000) {
                        if (STV090x_WRITE_DEMOD(state, ACLC, 0x2b) < 0)
@@ -1215,7 +1298,7 @@ static int stv090x_delivery_search(struct stv090x_state *state)
                if (STV090x_WRITE_DEMOD(state, BCLC, 0x09) < 0)
                        goto err;
 
-               if (state->dev_ver <= 0x20) {
+               if (state->internal->dev_ver <= 0x20) {
                        /* enable S2 carrier loop */
                        if (STV090x_WRITE_DEMOD(state, CAR2CFG, 0x26) < 0)
                                goto err;
@@ -1246,6 +1329,10 @@ static int stv090x_delivery_search(struct stv090x_state *state)
        default:
                /* enable DVB-S2 and DVB-S2 in Auto MODE */
                reg = STV090x_READ_DEMOD(state, DMDCFGMD);
+               STV090x_SETFIELD_Px(reg, DVBS1_ENABLE_FIELD, 0);
+               STV090x_SETFIELD_Px(reg, DVBS2_ENABLE_FIELD, 0);
+               if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
+                       goto err;
                STV090x_SETFIELD_Px(reg, DVBS1_ENABLE_FIELD, 1);
                STV090x_SETFIELD_Px(reg, DVBS2_ENABLE_FIELD, 1);
                if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
@@ -1257,7 +1344,7 @@ static int stv090x_delivery_search(struct stv090x_state *state)
                if (stv090x_dvbs_track_crl(state) < 0)
                        goto err;
 
-               if (state->dev_ver <= 0x20) {
+               if (state->internal->dev_ver <= 0x20) {
                        /* enable S2 carrier loop */
                        if (STV090x_WRITE_DEMOD(state, CAR2CFG, 0x26) < 0)
                                goto err;
@@ -1304,7 +1391,7 @@ static int stv090x_start_search(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, DMDISTATE, reg) < 0)
                goto err;
 
-       if (state->dev_ver <= 0x20) {
+       if (state->internal->dev_ver <= 0x20) {
                if (state->srate <= 5000000) {
                        if (STV090x_WRITE_DEMOD(state, CARCFG, 0x44) < 0)
                                goto err;
@@ -1348,7 +1435,7 @@ static int stv090x_start_search(struct stv090x_state *state)
                         * CFR max = +1MHz
                         */
                        freq_abs  = 1000 << 16;
-                       freq_abs /= (state->mclk / 1000);
+                       freq_abs /= (state->internal->mclk / 1000);
                        freq      = (s16) freq_abs;
                } else {
                        /* COLD Start
@@ -1358,7 +1445,7 @@ static int stv090x_start_search(struct stv090x_state *state)
                         */
                        freq_abs  = (state->search_range / 2000) + 600;
                        freq_abs  = freq_abs << 16;
-                       freq_abs /= (state->mclk / 1000);
+                       freq_abs /= (state->internal->mclk / 1000);
                        freq      = (s16) freq_abs;
                }
 
@@ -1381,7 +1468,7 @@ static int stv090x_start_search(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, CFRINIT0, 0) < 0)
                goto err;
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                if (STV090x_WRITE_DEMOD(state, EQUALCFG, 0x41) < 0)
                        goto err;
                if (STV090x_WRITE_DEMOD(state, FFECFG, 0x41) < 0)
@@ -1418,10 +1505,10 @@ static int stv090x_start_search(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, RTC, 0x88) < 0)
                goto err;
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                /*Frequency offset detector setting*/
                if (state->srate < 2000000) {
-                       if (state->dev_ver <= 0x20) {
+                       if (state->internal->dev_ver <= 0x20) {
                                /* Cut 2 */
                                if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x39) < 0)
                                        goto err;
@@ -1512,7 +1599,7 @@ static int stv090x_get_agc2_min_level(struct stv090x_state *state)
                steps = 1;
 
        dir = 1;
-       freq_step = (1000000 * 256) / (state->mclk / 256);
+       freq_step = (1000000 * 256) / (state->internal->mclk / 256);
        freq_init = 0;
 
        for (i = 0; i < steps; i++) {
@@ -1583,7 +1670,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
        u32 srate_coarse = 0, agc2 = 0, car_step = 1200, reg;
        u32 agc2th;
 
-       if (state->dev_ver >= 0x30)
+       if (state->internal->dev_ver >= 0x30)
                agc2th = 0x2e00;
        else
                agc2th = 0x1f00;
@@ -1619,13 +1706,13 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, AGC2REF, 0x50) < 0)
                goto err;
 
-       if (state->dev_ver >= 0x30) {
+       if (state->internal->dev_ver >= 0x30) {
                if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x99) < 0)
                        goto err;
                if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x98) < 0)
                        goto err;
 
-       } else if (state->dev_ver >= 0x20) {
+       } else if (state->internal->dev_ver >= 0x20) {
                if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x6a) < 0)
                        goto err;
                if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x95) < 0)
@@ -1677,7 +1764,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
                                STV090x_READ_DEMOD(state, AGC2I0);
                }
                agc2 /= 10;
-               srate_coarse = stv090x_get_srate(state, state->mclk);
+               srate_coarse = stv090x_get_srate(state, state->internal->mclk);
                cur_step++;
                dir *= -1;
                if ((tmg_cpt >= 5) && (agc2 < agc2th) &&
@@ -1695,12 +1782,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
 
                        if (state->config->tuner_set_frequency) {
                                if (state->config->tuner_set_frequency(fe, freq) < 0)
-                                       goto err;
+                                       goto err_gateoff;
                        }
 
                        if (state->config->tuner_set_bandwidth) {
                                if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
-                                       goto err;
+                                       goto err_gateoff;
                        }
 
                        if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -1713,7 +1800,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
 
                        if (state->config->tuner_get_status) {
                                if (state->config->tuner_get_status(fe, &reg) < 0)
-                                       goto err;
+                                       goto err_gateoff;
                        }
 
                        if (reg)
@@ -1729,9 +1816,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
        if (!tmg_lock)
                srate_coarse = 0;
        else
-               srate_coarse = stv090x_get_srate(state, state->mclk);
+               srate_coarse = stv090x_get_srate(state, state->internal->mclk);
 
        return srate_coarse;
+
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -1741,7 +1831,7 @@ static u32 stv090x_srate_srch_fine(struct stv090x_state *state)
 {
        u32 srate_coarse, freq_coarse, sym, reg;
 
-       srate_coarse = stv090x_get_srate(state, state->mclk);
+       srate_coarse = stv090x_get_srate(state, state->internal->mclk);
        freq_coarse  = STV090x_READ_DEMOD(state, CFR2) << 8;
        freq_coarse |= STV090x_READ_DEMOD(state, CFR1);
        sym = 13 * (srate_coarse / 10); /* SFRUP = SFR + 30% */
@@ -1767,10 +1857,10 @@ static u32 stv090x_srate_srch_fine(struct stv090x_state *state)
                if (STV090x_WRITE_DEMOD(state, AGC2REF, 0x38) < 0)
                        goto err;
 
-               if (state->dev_ver >= 0x30) {
+               if (state->internal->dev_ver >= 0x30) {
                        if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x79) < 0)
                                goto err;
-               } else if (state->dev_ver >= 0x20) {
+               } else if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x49) < 0)
                                goto err;
                }
@@ -1778,20 +1868,20 @@ static u32 stv090x_srate_srch_fine(struct stv090x_state *state)
                if (srate_coarse > 3000000) {
                        sym  = 13 * (srate_coarse / 10); /* SFRUP = SFR + 30% */
                        sym  = (sym / 1000) * 65536;
-                       sym /= (state->mclk / 1000);
+                       sym /= (state->internal->mclk / 1000);
                        if (STV090x_WRITE_DEMOD(state, SFRUP1, (sym >> 8) & 0x7f) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRUP0, sym & 0xff) < 0)
                                goto err;
                        sym  = 10 * (srate_coarse / 13); /* SFRLOW = SFR - 30% */
                        sym  = (sym / 1000) * 65536;
-                       sym /= (state->mclk / 1000);
+                       sym /= (state->internal->mclk / 1000);
                        if (STV090x_WRITE_DEMOD(state, SFRLOW1, (sym >> 8) & 0x7f) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRLOW0, sym & 0xff) < 0)
                                goto err;
                        sym  = (srate_coarse / 1000) * 65536;
-                       sym /= (state->mclk / 1000);
+                       sym /= (state->internal->mclk / 1000);
                        if (STV090x_WRITE_DEMOD(state, SFRINIT1, (sym >> 8) & 0xff) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRINIT0, sym & 0xff) < 0)
@@ -1799,20 +1889,20 @@ static u32 stv090x_srate_srch_fine(struct stv090x_state *state)
                } else {
                        sym  = 13 * (srate_coarse / 10); /* SFRUP = SFR + 30% */
                        sym  = (sym / 100) * 65536;
-                       sym /= (state->mclk / 100);
+                       sym /= (state->internal->mclk / 100);
                        if (STV090x_WRITE_DEMOD(state, SFRUP1, (sym >> 8) & 0x7f) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRUP0, sym & 0xff) < 0)
                                goto err;
                        sym  = 10 * (srate_coarse / 14); /* SFRLOW = SFR - 30% */
                        sym  = (sym / 100) * 65536;
-                       sym /= (state->mclk / 100);
+                       sym /= (state->internal->mclk / 100);
                        if (STV090x_WRITE_DEMOD(state, SFRLOW1, (sym >> 8) & 0x7f) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRLOW0, sym & 0xff) < 0)
                                goto err;
                        sym  = (srate_coarse / 100) * 65536;
-                       sym /= (state->mclk / 100);
+                       sym /= (state->internal->mclk / 100);
                        if (STV090x_WRITE_DEMOD(state, SFRINIT1, (sym >> 8) & 0xff) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, SFRINIT0, sym & 0xff) < 0)
@@ -1874,18 +1964,19 @@ static int stv090x_blind_search(struct stv090x_state *state)
        u32 agc2, reg, srate_coarse;
        s32 cpt_fail, agc2_ovflw, i;
        u8 k_ref, k_max, k_min;
-       int coarse_fail, lock;
+       int coarse_fail = 0;
+       int lock;
 
        k_max = 110;
        k_min = 10;
 
        agc2 = stv090x_get_agc2_min_level(state);
 
-       if (agc2 > STV090x_SEARCH_AGC2_TH(state->dev_ver)) {
+       if (agc2 > STV090x_SEARCH_AGC2_TH(state->internal->dev_ver)) {
                lock = 0;
        } else {
 
-               if (state->dev_ver <= 0x20) {
+               if (state->internal->dev_ver <= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, CARCFG, 0xc4) < 0)
                                goto err;
                } else {
@@ -1897,7 +1988,7 @@ static int stv090x_blind_search(struct stv090x_state *state)
                if (STV090x_WRITE_DEMOD(state, RTCS2, 0x44) < 0)
                        goto err;
 
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, EQUALCFG, 0x41) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, FFECFG, 0x41) < 0)
@@ -1956,7 +2047,7 @@ static int stv090x_chk_tmg(struct stv090x_state *state)
        u32 reg;
        s32 tmg_cpt = 0, i;
        u8 freq, tmg_thh, tmg_thl;
-       int tmg_lock;
+       int tmg_lock = 0;
 
        freq = STV090x_READ_DEMOD(state, CARFREQ);
        tmg_thh = STV090x_READ_DEMOD(state, TMGTHRISE);
@@ -2080,12 +2171,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
 
                                        if (state->config->tuner_set_frequency) {
                                                if (state->config->tuner_set_frequency(fe, freq) < 0)
-                                                       goto err;
+                                                       goto err_gateoff;
                                        }
 
                                        if (state->config->tuner_set_bandwidth) {
                                                if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
-                                                       goto err;
+                                                       goto err_gateoff;
                                        }
 
                                        if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2098,7 +2189,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
 
                                        if (state->config->tuner_get_status) {
                                                if (state->config->tuner_get_status(fe, &reg) < 0)
-                                                       goto err;
+                                                       goto err_gateoff;
                                        }
 
                                        if (reg)
@@ -2129,6 +2220,8 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
 
        return lock;
 
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -2142,13 +2235,13 @@ static int stv090x_get_loop_params(struct stv090x_state *state, s32 *freq_inc, s
        car_max = state->search_range / 1000;
        car_max += car_max / 10;
        car_max  = 65536 * (car_max / 2);
-       car_max /= (state->mclk / 1000);
+       car_max /= (state->internal->mclk / 1000);
 
        if (car_max > 0x4000)
                car_max = 0x4000 ; /* maxcarrier should be<= +-1/4 Mclk */
 
        inc  = srate;
-       inc /= state->mclk / 1000;
+       inc /= state->internal->mclk / 1000;
        inc *= 256;
        inc *= 256;
        inc /= 1000;
@@ -2209,7 +2302,7 @@ static int stv090x_chk_signal(struct stv090x_state *state)
 
        car_max += (car_max / 10); /* 10% margin */
        car_max  = (65536 * car_max / 2);
-       car_max /= state->mclk / 1000;
+       car_max /= state->internal->mclk / 1000;
 
        if (car_max > 0x4000)
                car_max = 0x4000;
@@ -2234,7 +2327,7 @@ static int stv090x_search_car_loop(struct stv090x_state *state, s32 inc, s32 tim
        car_max  = state->search_range / 1000;
        car_max += (car_max / 10);
        car_max  = (65536 * car_max / 2);
-       car_max /= (state->mclk / 1000);
+       car_max /= (state->internal->mclk / 1000);
        if (car_max > 0x4000)
                car_max = 0x4000;
 
@@ -2304,7 +2397,7 @@ static int stv090x_sw_algo(struct stv090x_state *state)
        case STV090x_SEARCH_DVBS1:
        case STV090x_SEARCH_DSS:
                /* accelerate the frequency detector */
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x3B) < 0)
                                goto err;
                }
@@ -2315,7 +2408,7 @@ static int stv090x_sw_algo(struct stv090x_state *state)
                break;
 
        case STV090x_SEARCH_DVBS2:
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x79) < 0)
                                goto err;
                }
@@ -2328,7 +2421,7 @@ static int stv090x_sw_algo(struct stv090x_state *state)
        case STV090x_SEARCH_AUTO:
        default:
                /* accelerate the frequency detector */
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x3b) < 0)
                                goto err;
                        if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x79) < 0)
@@ -2350,7 +2443,7 @@ static int stv090x_sw_algo(struct stv090x_state *state)
                /*run the SW search 2 times maximum*/
                if (lock || no_signal || (trials == 2)) {
                        /*Check if the demod is not losing lock in DVBS2*/
-                       if (state->dev_ver >= 0x20) {
+                       if (state->internal->dev_ver >= 0x20) {
                                if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x49) < 0)
                                        goto err;
                                if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x9e) < 0)
@@ -2372,7 +2465,7 @@ static int stv090x_sw_algo(struct stv090x_state *state)
                                        /*FALSE lock, The demod is loosing lock */
                                        lock = 0;
                                        if (trials < 2) {
-                                               if (state->dev_ver >= 0x20) {
+                                               if (state->internal->dev_ver >= 0x20) {
                                                        if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x79) < 0)
                                                                goto err;
                                                }
@@ -2422,11 +2515,11 @@ static s32 stv090x_get_car_freq(struct stv090x_state *state, u32 mclk)
        derot |= STV090x_READ_DEMOD(state, CFR0);
 
        derot = comp2(derot, 24);
-       int_1 = state->mclk >> 12;
+       int_1 = mclk >> 12;
        int_2 = derot >> 12;
 
        /* carrier_frequency = MasterClock * Reg / 2^24 */
-       tmp_1 = state->mclk % 0x1000;
+       tmp_1 = mclk % 0x1000;
        tmp_2 = derot % 0x1000;
 
        derot = (int_1 * int_2) +
@@ -2502,13 +2595,13 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
 
        if (state->config->tuner_get_frequency) {
                if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
-                       goto err;
+                       goto err_gateoff;
        }
 
        if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
                goto err;
 
-       offst_freq = stv090x_get_car_freq(state, state->mclk) / 1000;
+       offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000;
        state->frequency += offst_freq;
 
        if (stv090x_get_viterbi(state) < 0)
@@ -2530,7 +2623,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
 
                if (state->config->tuner_get_frequency) {
                        if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
-                               goto err;
+                               goto err_gateoff;
                }
 
                if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2550,6 +2643,9 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
        }
 
        return STV090x_OUTOFRANGE;
+
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -2579,7 +2675,7 @@ static u8 stv090x_optimize_carloop(struct stv090x_state *state, enum stv090x_mod
        s32 i;
        struct stv090x_long_frame_crloop *car_loop, *car_loop_qpsk_low, *car_loop_apsk_low;
 
-       if (state->dev_ver == 0x20) {
+       if (state->internal->dev_ver == 0x20) {
                car_loop                = stv090x_s2_crl_cut20;
                car_loop_qpsk_low       = stv090x_s2_lowqpsk_crl_cut20;
                car_loop_apsk_low       = stv090x_s2_apsk_crl_cut20;
@@ -2700,7 +2796,7 @@ static u8 stv090x_optimize_carloop_short(struct stv090x_state *state)
                break;
        }
 
-       if (state->dev_ver >= 0x30) {
+       if (state->internal->dev_ver >= 0x30) {
                /* Cut 3.0 and up */
                short_crl = stv090x_s2_short_crl_cut30;
        } else {
@@ -2732,7 +2828,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
        s32 srate, pilots, aclc, f_1, f_0, i = 0, blind_tune = 0;
        u32 reg;
 
-       srate  = stv090x_get_srate(state, state->mclk);
+       srate  = stv090x_get_srate(state, state->internal->mclk);
        srate += stv090x_get_tmgoffst(state, srate);
 
        switch (state->delsys) {
@@ -2751,7 +2847,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
                if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0)
                        goto err;
 
-               if (state->dev_ver >= 0x30) {
+               if (state->internal->dev_ver >= 0x30) {
                        if (stv090x_get_viterbi(state) < 0)
                                goto err;
 
@@ -2868,7 +2964,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
                        goto err;
        }
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                if ((state->search_mode == STV090x_SEARCH_DVBS1)        ||
                    (state->search_mode == STV090x_SEARCH_DSS)          ||
                    (state->search_mode == STV090x_SEARCH_AUTO)) {
@@ -2890,7 +2986,8 @@ static int stv090x_optimize_track(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, SFRLOW1, 0x80) < 0)
                goto err;
 
-       if ((state->dev_ver >= 0x20) || (blind_tune == 1) || (state->srate < 10000000)) {
+       if ((state->internal->dev_ver >= 0x20) || (blind_tune == 1) ||
+           (state->srate < 10000000)) {
                /* update initial carrier freq with the found freq offset */
                if (STV090x_WRITE_DEMOD(state, CFRINIT1, f_1) < 0)
                        goto err;
@@ -2898,7 +2995,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
                        goto err;
                state->tuner_bw = stv090x_car_width(srate, state->rolloff) + 10000000;
 
-               if ((state->dev_ver >= 0x20) || (blind_tune == 1)) {
+               if ((state->internal->dev_ver >= 0x20) || (blind_tune == 1)) {
 
                        if (state->algo != STV090x_WARM_SEARCH) {
 
@@ -2907,7 +3004,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
 
                                if (state->config->tuner_set_bandwidth) {
                                        if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
-                                               goto err;
+                                               goto err_gateoff;
                                }
 
                                if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2950,7 +3047,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
 
        }
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x49) < 0)
                        goto err;
        }
@@ -2959,6 +3056,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
                stv090x_set_vit_thtracq(state);
 
        return 0;
+
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -3026,7 +3126,7 @@ static int stv090x_set_s2rolloff(struct stv090x_state *state)
 {
        u32 reg;
 
-       if (state->dev_ver <= 0x20) {
+       if (state->internal->dev_ver <= 0x20) {
                /* rolloff to auto mode if DVBS2 */
                reg = STV090x_READ_DEMOD(state, DEMOD);
                STV090x_SETFIELD_Px(reg, MANUAL_SXROLLOFF_FIELD, 0x00);
@@ -3062,7 +3162,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
        if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x5c) < 0) /* Demod stop */
                goto err;
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                if (state->srate > 5000000) {
                        if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x9e) < 0)
                                goto err;
@@ -3102,7 +3202,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
                if (STV090x_WRITE_DEMOD(state, AGC2REF, 0x38) < 0)
                        goto err;
 
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        if (STV090x_WRITE_DEMOD(state, KREFTMG, 0x5a) < 0)
                                goto err;
                        if (state->algo == STV090x_COLD_SEARCH)
@@ -3120,9 +3220,11 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
                if (stv090x_set_srate(state, state->srate) < 0)
                        goto err;
 
-               if (stv090x_set_max_srate(state, state->mclk, state->srate) < 0)
+               if (stv090x_set_max_srate(state, state->internal->mclk,
+                                         state->srate) < 0)
                        goto err;
-               if (stv090x_set_min_srate(state, state->mclk, state->srate) < 0)
+               if (stv090x_set_min_srate(state, state->internal->mclk,
+                                         state->srate) < 0)
                        goto err;
 
                if (state->srate >= 10000000)
@@ -3136,18 +3238,21 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
                goto err;
 
        if (state->config->tuner_set_bbgain) {
-               if (state->config->tuner_set_bbgain(fe, 10) < 0) /* 10dB */
-                       goto err;
+               reg = state->config->tuner_bbgain;
+               if (reg == 0)
+                       reg = 10; /* default: 10dB */
+               if (state->config->tuner_set_bbgain(fe, reg) < 0)
+                       goto err_gateoff;
        }
 
        if (state->config->tuner_set_frequency) {
                if (state->config->tuner_set_frequency(fe, state->frequency) < 0)
-                       goto err;
+                       goto err_gateoff;
        }
 
        if (state->config->tuner_set_bandwidth) {
                if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
-                       goto err;
+                       goto err_gateoff;
        }
 
        if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -3155,21 +3260,21 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
 
        msleep(50);
 
-       if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
-               goto err;
-
        if (state->config->tuner_get_status) {
+               if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
+                       goto err;
                if (state->config->tuner_get_status(fe, &reg) < 0)
+                       goto err_gateoff;
+               if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
                        goto err;
-       }
 
-       if (reg)
-               dprintk(FE_DEBUG, 1, "Tuner phase locked");
-       else
-               dprintk(FE_DEBUG, 1, "Tuner unlocked");
-
-       if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
-               goto err;
+               if (reg)
+                       dprintk(FE_DEBUG, 1, "Tuner phase locked");
+               else {
+                       dprintk(FE_DEBUG, 1, "Tuner unlocked");
+                       return STV090x_NOCARRIER;
+               }
+       }
 
        msleep(10);
        agc1_power = MAKEWORD16(STV090x_READ_DEMOD(state, AGCIQIN1),
@@ -3194,7 +3299,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
                reg = STV090x_READ_DEMOD(state, DEMOD);
                STV090x_SETFIELD_Px(reg, SPECINV_CONTROL_FIELD, state->inversion);
 
-               if (state->dev_ver <= 0x20) {
+               if (state->internal->dev_ver <= 0x20) {
                        /* rolloff to auto mode if DVBS2 */
                        STV090x_SETFIELD_Px(reg, MANUAL_SXROLLOFF_FIELD, 1);
                } else {
@@ -3238,7 +3343,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
        if ((lock) && (signal_state == STV090x_RANGEOK)) { /* signal within Range */
                stv090x_optimize_track(state);
 
-               if (state->dev_ver >= 0x20) {
+               if (state->internal->dev_ver >= 0x20) {
                        /* >= Cut 2.0 :release TS reset after
                         * demod lock and optimized Tracking
                         */
@@ -3293,6 +3398,8 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
        }
        return signal_state;
 
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -3303,6 +3410,9 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe, struct dvb_fron
        struct stv090x_state *state = fe->demodulator_priv;
        struct dtv_frontend_properties *props = &fe->dtv_property_cache;
 
+       if (p->frequency == 0)
+               return DVBFE_ALGO_SEARCH_INVALID;
+
        state->delsys = props->delivery_system;
        state->frequency = p->frequency;
        state->srate = p->u.qpsk.symbol_rate;
@@ -3353,7 +3463,8 @@ static int stv090x_read_status(struct dvb_frontend *fe, enum fe_status *status)
                        if (STV090x_GETFIELD_Px(reg, PKTDELIN_LOCK_FIELD)) {
                                reg = STV090x_READ_DEMOD(state, TSSTATUS);
                                if (STV090x_GETFIELD_Px(reg, TSFIFO_LINEOK_FIELD)) {
-                                       *status = FE_HAS_CARRIER |
+                                       *status = FE_HAS_SIGNAL |
+                                                 FE_HAS_CARRIER |
                                                  FE_HAS_VITERBI |
                                                  FE_HAS_SYNC |
                                                  FE_HAS_LOCK;
@@ -3370,7 +3481,11 @@ static int stv090x_read_status(struct dvb_frontend *fe, enum fe_status *status)
                        if (STV090x_GETFIELD_Px(reg, LOCKEDVIT_FIELD)) {
                                reg = STV090x_READ_DEMOD(state, TSSTATUS);
                                if (STV090x_GETFIELD_Px(reg, TSFIFO_LINEOK_FIELD)) {
-                                       *status = FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
+                                       *status = FE_HAS_SIGNAL |
+                                                 FE_HAS_CARRIER |
+                                                 FE_HAS_VITERBI |
+                                                 FE_HAS_SYNC |
+                                                 FE_HAS_LOCK;
                                }
                        }
                }
@@ -3770,6 +3885,15 @@ static void stv090x_release(struct dvb_frontend *fe)
 {
        struct stv090x_state *state = fe->demodulator_priv;
 
+       state->internal->num_used--;
+       if (state->internal->num_used <= 0) {
+
+               dprintk(FE_ERROR, 1, "Actually removing");
+
+               remove_dev(state->internal);
+               kfree(state->internal);
+       }
+
        kfree(state);
 }
 
@@ -3901,10 +4025,10 @@ static int stv090x_set_mclk(struct stv090x_state *state, u32 mclk, u32 clk)
        if (stv090x_write_reg(state, STV090x_NCOARSE, reg) < 0)
                goto err;
 
-       state->mclk = stv090x_get_mclk(state);
+       state->internal->mclk = stv090x_get_mclk(state);
 
        /*Set the DiseqC frequency to 22KHz */
-       div = state->mclk / 704000;
+       div = state->internal->mclk / 704000;
        if (STV090x_WRITE_DEMOD(state, F22TX, div) < 0)
                goto err;
        if (STV090x_WRITE_DEMOD(state, F22RX, div) < 0)
@@ -3920,7 +4044,7 @@ static int stv090x_set_tspath(struct stv090x_state *state)
 {
        u32 reg;
 
-       if (state->dev_ver >= 0x20) {
+       if (state->internal->dev_ver >= 0x20) {
                switch (state->config->ts1_mode) {
                case STV090x_TSMODE_PARALLEL_PUNCTURED:
                case STV090x_TSMODE_DVBCI:
@@ -4092,6 +4216,71 @@ static int stv090x_set_tspath(struct stv090x_state *state)
        default:
                break;
        }
+
+       if (state->config->ts1_clk > 0) {
+               u32 speed;
+
+               switch (state->config->ts1_mode) {
+               case STV090x_TSMODE_PARALLEL_PUNCTURED:
+               case STV090x_TSMODE_DVBCI:
+               default:
+                       speed = state->internal->mclk /
+                               (state->config->ts1_clk / 4);
+                       if (speed < 0x08)
+                               speed = 0x08;
+                       if (speed > 0xFF)
+                               speed = 0xFF;
+                       break;
+               case STV090x_TSMODE_SERIAL_PUNCTURED:
+               case STV090x_TSMODE_SERIAL_CONTINUOUS:
+                       speed = state->internal->mclk /
+                               (state->config->ts1_clk / 32);
+                       if (speed < 0x20)
+                               speed = 0x20;
+                       if (speed > 0xFF)
+                               speed = 0xFF;
+                       break;
+               }
+               reg = stv090x_read_reg(state, STV090x_P1_TSCFGM);
+               STV090x_SETFIELD_Px(reg, TSFIFO_MANSPEED_FIELD, 3);
+               if (stv090x_write_reg(state, STV090x_P1_TSCFGM, reg) < 0)
+                       goto err;
+               if (stv090x_write_reg(state, STV090x_P1_TSSPEED, speed) < 0)
+                       goto err;
+       }
+
+       if (state->config->ts2_clk > 0) {
+               u32 speed;
+
+               switch (state->config->ts2_mode) {
+               case STV090x_TSMODE_PARALLEL_PUNCTURED:
+               case STV090x_TSMODE_DVBCI:
+               default:
+                       speed = state->internal->mclk /
+                               (state->config->ts2_clk / 4);
+                       if (speed < 0x08)
+                               speed = 0x08;
+                       if (speed > 0xFF)
+                               speed = 0xFF;
+                       break;
+               case STV090x_TSMODE_SERIAL_PUNCTURED:
+               case STV090x_TSMODE_SERIAL_CONTINUOUS:
+                       speed = state->internal->mclk /
+                               (state->config->ts2_clk / 32);
+                       if (speed < 0x20)
+                               speed = 0x20;
+                       if (speed > 0xFF)
+                               speed = 0xFF;
+                       break;
+               }
+               reg = stv090x_read_reg(state, STV090x_P2_TSCFGM);
+               STV090x_SETFIELD_Px(reg, TSFIFO_MANSPEED_FIELD, 3);
+               if (stv090x_write_reg(state, STV090x_P2_TSCFGM, reg) < 0)
+                       goto err;
+               if (stv090x_write_reg(state, STV090x_P2_TSSPEED, speed) < 0)
+                       goto err;
+       }
+
        reg = stv090x_read_reg(state, STV090x_P2_TSCFGH);
        STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 0x01);
        if (stv090x_write_reg(state, STV090x_P2_TSCFGH, reg) < 0)
@@ -4120,6 +4309,15 @@ static int stv090x_init(struct dvb_frontend *fe)
        const struct stv090x_config *config = state->config;
        u32 reg;
 
+       if (state->internal->mclk == 0) {
+               stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */
+               msleep(5);
+               if (stv090x_write_reg(state, STV090x_SYNTCTRL,
+                                     0x20 | config->clk_mode) < 0)
+                       goto err;
+               stv090x_get_mclk(state);
+       }
+
        if (stv090x_wakeup(fe) < 0) {
                dprintk(FE_ERROR, 1, "Error waking device");
                goto err;
@@ -4142,12 +4340,12 @@ static int stv090x_init(struct dvb_frontend *fe)
 
        if (config->tuner_set_mode) {
                if (config->tuner_set_mode(fe, TUNER_WAKE) < 0)
-                       goto err;
+                       goto err_gateoff;
        }
 
        if (config->tuner_init) {
                if (config->tuner_init(fe) < 0)
-                       goto err;
+                       goto err_gateoff;
        }
 
        if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -4157,6 +4355,9 @@ static int stv090x_init(struct dvb_frontend *fe)
                goto err;
 
        return 0;
+
+err_gateoff:
+       stv090x_i2c_gate_ctrl(fe, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
@@ -4188,16 +4389,26 @@ static int stv090x_setup(struct dvb_frontend *fe)
        }
 
        /* STV090x init */
-       if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x5c) < 0) /* Stop Demod */
+
+       /* Stop Demod */
+       if (stv090x_write_reg(state, STV090x_P1_DMDISTATE, 0x5c) < 0)
+               goto err;
+       if (stv090x_write_reg(state, STV090x_P2_DMDISTATE, 0x5c) < 0)
                goto err;
 
        msleep(5);
 
-       if (STV090x_WRITE_DEMOD(state, TNRCFG, 0x6c) < 0) /* check register ! (No Tuner Mode) */
+       /* Set No Tuner Mode */
+       if (stv090x_write_reg(state, STV090x_P1_TNRCFG, 0x6c) < 0)
+               goto err;
+       if (stv090x_write_reg(state, STV090x_P2_TNRCFG, 0x6c) < 0)
                goto err;
 
+       /* I2C repeater OFF */
        STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level);
-       if (STV090x_WRITE_DEMOD(state, I2CRPT, reg) < 0) /* repeater OFF */
+       if (stv090x_write_reg(state, STV090x_P1_I2CRPT, reg) < 0)
+               goto err;
+       if (stv090x_write_reg(state, STV090x_P2_I2CRPT, reg) < 0)
                goto err;
 
        if (stv090x_write_reg(state, STV090x_NCOARSE, 0x13) < 0) /* set PLL divider */
@@ -4216,8 +4427,8 @@ static int stv090x_setup(struct dvb_frontend *fe)
                        goto err;
        }
 
-       state->dev_ver = stv090x_read_reg(state, STV090x_MID);
-       if (state->dev_ver >= 0x20) {
+       state->internal->dev_ver = stv090x_read_reg(state, STV090x_MID);
+       if (state->internal->dev_ver >= 0x20) {
                if (stv090x_write_reg(state, STV090x_TSGENERAL, 0x0c) < 0)
                        goto err;
 
@@ -4228,27 +4439,35 @@ static int stv090x_setup(struct dvb_frontend *fe)
                                goto err;
                }
 
-       } else if (state->dev_ver < 0x20) {
+       } else if (state->internal->dev_ver < 0x20) {
                dprintk(FE_ERROR, 1, "ERROR: Unsupported Cut: 0x%02x!",
-                       state->dev_ver);
+                       state->internal->dev_ver);
 
                goto err;
-       } else if (state->dev_ver > 0x30) {
+       } else if (state->internal->dev_ver > 0x30) {
                /* we shouldn't bail out from here */
                dprintk(FE_ERROR, 1, "INFO: Cut: 0x%02x probably incomplete support!",
-                       state->dev_ver);
+                       state->internal->dev_ver);
        }
 
-       if (stv090x_write_reg(state, STV090x_TSTRES0, 0x80) < 0)
+       /* ADC1 range */
+       reg = stv090x_read_reg(state, STV090x_TSTTNR1);
+       STV090x_SETFIELD(reg, ADC1_INMODE_FIELD,
+               (config->adc1_range == STV090x_ADC_1Vpp) ? 0 : 1);
+       if (stv090x_write_reg(state, STV090x_TSTTNR1, reg) < 0)
                goto err;
-       if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0)
+
+       /* ADC2 range */
+       reg = stv090x_read_reg(state, STV090x_TSTTNR3);
+       STV090x_SETFIELD(reg, ADC2_INMODE_FIELD,
+               (config->adc2_range == STV090x_ADC_1Vpp) ? 0 : 1);
+       if (stv090x_write_reg(state, STV090x_TSTTNR3, reg) < 0)
                goto err;
 
-       stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */
-       msleep(5);
-       if (stv090x_write_reg(state, STV090x_SYNTCTRL, 0x20 | config->clk_mode) < 0)
+       if (stv090x_write_reg(state, STV090x_TSTRES0, 0x80) < 0)
+               goto err;
+       if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0)
                goto err;
-       stv090x_get_mclk(state);
 
        return 0;
 err:
@@ -4299,6 +4518,7 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
                                    enum stv090x_demodulator demod)
 {
        struct stv090x_state *state = NULL;
+       struct stv090x_dev *temp_int;
 
        state = kzalloc(sizeof (struct stv090x_state), GFP_KERNEL);
        if (state == NULL)
@@ -4314,8 +4534,32 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
        state->device                           = config->device;
        state->rolloff                          = STV090x_RO_35; /* default */
 
-       if (state->demod == STV090x_DEMODULATOR_0)
-               mutex_init(&demod_lock);
+       temp_int = find_dev(state->i2c,
+                               state->config->address);
+
+       if ((temp_int != NULL) && (state->demod_mode == STV090x_DUAL)) {
+               state->internal = temp_int->internal;
+               state->internal->num_used++;
+               dprintk(FE_INFO, 1, "Found Internal Structure!");
+               dprintk(FE_ERROR, 1, "Attaching %s demodulator(%d) Cut=0x%02x",
+                       state->device == STV0900 ? "STV0900" : "STV0903",
+                       demod,
+                       state->internal->dev_ver);
+               return &state->frontend;
+       } else {
+               state->internal = kmalloc(sizeof(struct stv090x_internal),
+                                         GFP_KERNEL);
+               temp_int = append_internal(state->internal);
+               state->internal->num_used = 1;
+               state->internal->mclk = 0;
+               state->internal->dev_ver = 0;
+               state->internal->i2c_adap = state->i2c;
+               state->internal->i2c_addr = state->config->address;
+               dprintk(FE_INFO, 1, "Create New Internal Structure!");
+       }
+
+       mutex_init(&state->internal->demod_lock);
+       mutex_init(&state->internal->tuner_lock);
 
        if (stv090x_sleep(&state->frontend) < 0) {
                dprintk(FE_ERROR, 1, "Error putting device to sleep");
@@ -4331,10 +4575,10 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
                goto error;
        }
 
-       dprintk(FE_ERROR, 1, "Attaching %s demodulator(%d) Cut=0x%02x\n",
+       dprintk(FE_ERROR, 1, "Attaching %s demodulator(%d) Cut=0x%02x",
               state->device == STV0900 ? "STV0900" : "STV0903",
               demod,
-              state->dev_ver);
+              state->internal->dev_ver);
 
        return &state->frontend;
 
index b133807663eabd28114c85c730a2c8a3a12a2f5f..30f01a6902ac118b4b0ec0d7fb83b0d5a411dd73 100644 (file)
@@ -60,6 +60,11 @@ enum stv090x_i2crpt {
        STV090x_RPTLEVEL_2      = 7,
 };
 
+enum stv090x_adc_range {
+       STV090x_ADC_2Vpp        = 0,
+       STV090x_ADC_1Vpp        = 1
+};
+
 struct stv090x_config {
        enum stv090x_device     device;
        enum stv090x_mode       demod_mode;
@@ -68,13 +73,17 @@ struct stv090x_config {
        u32 xtal; /* default: 8000000 */
        u8 address; /* default: 0x68 */
 
-       u32 ref_clk; /* default: 16000000 FIXME to tuner config */
-
        u8 ts1_mode;
        u8 ts2_mode;
+       u32 ts1_clk;
+       u32 ts2_clk;
 
        enum stv090x_i2crpt     repeater_level;
 
+       u8                      tuner_bbgain; /* default: 10db */
+       enum stv090x_adc_range  adc1_range; /* default: 2Vpp */
+       enum stv090x_adc_range  adc2_range; /* default: 2Vpp */
+
        bool diseqc_envelope_mode;
 
        int (*tuner_init) (struct dvb_frontend *fe);
index 5921a8d6c89f0f6b92d3288c622d5694360aaa5c..5b780c80d4967a6609a4610590c5fe00eb229456 100644 (file)
@@ -230,11 +230,23 @@ struct stv090x_tab {
        s32 read;
 };
 
+struct stv090x_internal {
+       struct i2c_adapter      *i2c_adap;
+       u8                      i2c_addr;
+
+       struct mutex            demod_lock; /* Lock access to shared register */
+       struct mutex            tuner_lock; /* Lock access to tuners */
+       s32                     mclk; /* Masterclock Divider factor */
+       u32                     dev_ver;
+
+       int                     num_used;
+};
+
 struct stv090x_state {
        enum stv090x_device             device;
        enum stv090x_demodulator        demod;
        enum stv090x_mode               demod_mode;
-       u32                             dev_ver;
+       struct stv090x_internal         *internal;
 
        struct i2c_adapter              *i2c;
        const struct stv090x_config     *config;
@@ -256,11 +268,8 @@ struct stv090x_state {
        u32                             frequency;
        u32                             srate;
 
-       s32                             mclk; /* Masterclock Divider factor */
        s32                             tuner_bw;
 
-       u32                             tuner_refclk;
-
        s32                             search_range;
 
        s32                             DemodTimeout;
index bcfcb652464cc0e722d8ee7b8344867a4a0b64c4..f931ed07e92d6083b088db293e43931f69cbe4b8 100644 (file)
@@ -35,8 +35,6 @@ static unsigned int verbose;
 module_param(verbose, int, 0644);
 MODULE_PARM_DESC(verbose, "Set Verbosity level");
 
-static u8 stv6110x_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
-
 static int stv6110x_read_reg(struct stv6110x_state *stv6110x, u8 reg, u8 *data)
 {
        int ret;
@@ -58,12 +56,23 @@ static int stv6110x_read_reg(struct stv6110x_state *stv6110x, u8 reg, u8 *data)
        return 0;
 }
 
-static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
+static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 data[], int len)
 {
        int ret;
        const struct stv6110x_config *config = stv6110x->config;
-       u8 buf[] = { reg, data };
-       struct i2c_msg msg = { .addr = config->addr, .flags = 0, . buf = buf, .len = 2 };
+       u8 buf[len + 1];
+       struct i2c_msg msg = {
+               .addr = config->addr,
+               .flags = 0,
+               .buf = buf,
+               .len = len + 1
+       };
+
+       if (start + len > 8)
+               return -EINVAL;
+
+       buf[0] = start;
+       memcpy(&buf[1], data, len);
 
        ret = i2c_transfer(stv6110x->i2c, &msg, 1);
        if (ret != 1) {
@@ -74,18 +83,21 @@ static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
        return 0;
 }
 
+static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
+{
+       return stv6110x_write_regs(stv6110x, reg, &data, 1);
+}
+
 static int stv6110x_init(struct dvb_frontend *fe)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
        int ret;
-       u8 i;
 
-       for (i = 0; i < ARRAY_SIZE(stv6110x_regs); i++) {
-               ret = stv6110x_write_reg(stv6110x, i, stv6110x_regs[i]);
-               if (ret < 0) {
-                       dprintk(FE_ERROR, 1, "Initialization failed");
-                       return -1;
-               }
+       ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs,
+                                 ARRAY_SIZE(stv6110x->regs));
+       if (ret < 0) {
+               dprintk(FE_ERROR, 1, "Initialization failed");
+               return -1;
        }
 
        return 0;
@@ -98,23 +110,23 @@ static int stv6110x_set_frequency(struct dvb_frontend *fe, u32 frequency)
        s32 pVal, pCalc, rDivOpt = 0, pCalcOpt = 1000;
        u8 i;
 
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_K, (REFCLOCK_MHz - 16));
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_K, (REFCLOCK_MHz - 16));
 
        if (frequency <= 1023000) {
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_DIV4SEL, 1);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_PRESC32_ON, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_DIV4SEL, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_PRESC32_ON, 0);
                pVal = 40;
        } else if (frequency <= 1300000) {
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_DIV4SEL, 1);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_PRESC32_ON, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_DIV4SEL, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_PRESC32_ON, 1);
                pVal = 40;
        } else if (frequency <= 2046000) {
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_DIV4SEL, 0);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_PRESC32_ON, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_DIV4SEL, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_PRESC32_ON, 0);
                pVal = 20;
        } else {
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_DIV4SEL, 0);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_PRESC32_ON, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_DIV4SEL, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_PRESC32_ON, 1);
                pVal = 20;
        }
 
@@ -130,21 +142,21 @@ static int stv6110x_set_frequency(struct dvb_frontend *fe, u32 frequency)
        divider = (frequency * R_DIV(rDivOpt) * pVal) / REFCLOCK_kHz;
        divider = (divider + 5) / 10;
 
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_R_DIV, rDivOpt);
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG1], TNG1_N_DIV_11_8, MSB(divider));
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_TNG0], TNG0_N_DIV_7_0, LSB(divider));
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_R_DIV, rDivOpt);
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG1], TNG1_N_DIV_11_8, MSB(divider));
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_TNG0], TNG0_N_DIV_7_0, LSB(divider));
 
        /* VCO Auto calibration */
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_STAT1], STAT1_CALVCO_STRT, 1);
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_STAT1], STAT1_CALVCO_STRT, 1);
 
-       stv6110x_write_reg(stv6110x, STV6110x_CTRL1, stv6110x_regs[STV6110x_CTRL1]);
-       stv6110x_write_reg(stv6110x, STV6110x_TNG1, stv6110x_regs[STV6110x_TNG1]);
-       stv6110x_write_reg(stv6110x, STV6110x_TNG0, stv6110x_regs[STV6110x_TNG0]);
-       stv6110x_write_reg(stv6110x, STV6110x_STAT1, stv6110x_regs[STV6110x_STAT1]);
+       stv6110x_write_reg(stv6110x, STV6110x_CTRL1, stv6110x->regs[STV6110x_CTRL1]);
+       stv6110x_write_reg(stv6110x, STV6110x_TNG1, stv6110x->regs[STV6110x_TNG1]);
+       stv6110x_write_reg(stv6110x, STV6110x_TNG0, stv6110x->regs[STV6110x_TNG0]);
+       stv6110x_write_reg(stv6110x, STV6110x_STAT1, stv6110x->regs[STV6110x_STAT1]);
 
        for (i = 0; i < TRIALS; i++) {
-               stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x_regs[STV6110x_STAT1]);
-               if (!STV6110x_GETFIELD(STAT1_CALVCO_STRT, stv6110x_regs[STV6110x_STAT1]))
+               stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x->regs[STV6110x_STAT1]);
+               if (!STV6110x_GETFIELD(STAT1_CALVCO_STRT, stv6110x->regs[STV6110x_STAT1]))
                                break;
                msleep(1);
        }
@@ -156,14 +168,14 @@ static int stv6110x_get_frequency(struct dvb_frontend *fe, u32 *frequency)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
 
-       stv6110x_read_reg(stv6110x, STV6110x_TNG1, &stv6110x_regs[STV6110x_TNG1]);
-       stv6110x_read_reg(stv6110x, STV6110x_TNG0, &stv6110x_regs[STV6110x_TNG0]);
+       stv6110x_read_reg(stv6110x, STV6110x_TNG1, &stv6110x->regs[STV6110x_TNG1]);
+       stv6110x_read_reg(stv6110x, STV6110x_TNG0, &stv6110x->regs[STV6110x_TNG0]);
 
-       *frequency = (MAKEWORD16(STV6110x_GETFIELD(TNG1_N_DIV_11_8, stv6110x_regs[STV6110x_TNG1]),
-                                STV6110x_GETFIELD(TNG0_N_DIV_7_0, stv6110x_regs[STV6110x_TNG0]))) * REFCLOCK_kHz;
+       *frequency = (MAKEWORD16(STV6110x_GETFIELD(TNG1_N_DIV_11_8, stv6110x->regs[STV6110x_TNG1]),
+                                STV6110x_GETFIELD(TNG0_N_DIV_7_0, stv6110x->regs[STV6110x_TNG0]))) * REFCLOCK_kHz;
 
-       *frequency /= (1 << (STV6110x_GETFIELD(TNG1_R_DIV, stv6110x_regs[STV6110x_TNG1]) +
-                            STV6110x_GETFIELD(TNG1_DIV4SEL, stv6110x_regs[STV6110x_TNG1])));
+       *frequency /= (1 << (STV6110x_GETFIELD(TNG1_R_DIV, stv6110x->regs[STV6110x_TNG1]) +
+                            STV6110x_GETFIELD(TNG1_DIV4SEL, stv6110x->regs[STV6110x_TNG1])));
 
        *frequency >>= 2;
 
@@ -179,27 +191,27 @@ static int stv6110x_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
        halfbw = bandwidth >> 1;
 
        if (halfbw > 36000000)
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL3], CTRL3_CF, 31); /* LPF */
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL3], CTRL3_CF, 31); /* LPF */
        else if (halfbw < 5000000)
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL3], CTRL3_CF, 0); /* LPF */
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL3], CTRL3_CF, 0); /* LPF */
        else
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL3], CTRL3_CF, ((halfbw / 1000000) - 5)); /* LPF */
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL3], CTRL3_CF, ((halfbw / 1000000) - 5)); /* LPF */
 
 
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL3], CTRL3_RCCLK_OFF, 0x0); /* cal. clk activated */
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_STAT1], STAT1_CALRC_STRT, 0x1); /* LPF auto cal */
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL3], CTRL3_RCCLK_OFF, 0x0); /* cal. clk activated */
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_STAT1], STAT1_CALRC_STRT, 0x1); /* LPF auto cal */
 
-       stv6110x_write_reg(stv6110x, STV6110x_CTRL3, stv6110x_regs[STV6110x_CTRL3]);
-       stv6110x_write_reg(stv6110x, STV6110x_STAT1, stv6110x_regs[STV6110x_STAT1]);
+       stv6110x_write_reg(stv6110x, STV6110x_CTRL3, stv6110x->regs[STV6110x_CTRL3]);
+       stv6110x_write_reg(stv6110x, STV6110x_STAT1, stv6110x->regs[STV6110x_STAT1]);
 
        for (i = 0; i < TRIALS; i++) {
-               stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x_regs[STV6110x_STAT1]);
-               if (!STV6110x_GETFIELD(STAT1_CALRC_STRT, stv6110x_regs[STV6110x_STAT1]))
+               stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x->regs[STV6110x_STAT1]);
+               if (!STV6110x_GETFIELD(STAT1_CALRC_STRT, stv6110x->regs[STV6110x_STAT1]))
                        break;
                msleep(1);
        }
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL3], CTRL3_RCCLK_OFF, 0x1); /* cal. done */
-       stv6110x_write_reg(stv6110x, STV6110x_CTRL3, stv6110x_regs[STV6110x_CTRL3]);
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL3], CTRL3_RCCLK_OFF, 0x1); /* cal. done */
+       stv6110x_write_reg(stv6110x, STV6110x_CTRL3, stv6110x->regs[STV6110x_CTRL3]);
 
        return 0;
 }
@@ -208,8 +220,8 @@ static int stv6110x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
 
-       stv6110x_read_reg(stv6110x, STV6110x_CTRL3, &stv6110x_regs[STV6110x_CTRL3]);
-       *bandwidth = (STV6110x_GETFIELD(CTRL3_CF, stv6110x_regs[STV6110x_CTRL3]) + 5) * 2000000;
+       stv6110x_read_reg(stv6110x, STV6110x_CTRL3, &stv6110x->regs[STV6110x_CTRL3]);
+       *bandwidth = (STV6110x_GETFIELD(CTRL3_CF, stv6110x->regs[STV6110x_CTRL3]) + 5) * 2000000;
 
        return 0;
 }
@@ -222,20 +234,20 @@ static int stv6110x_set_refclock(struct dvb_frontend *fe, u32 refclock)
        switch (refclock) {
        default:
        case 1:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL2], CTRL2_CO_DIV, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 0);
                break;
        case 2:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL2], CTRL2_CO_DIV, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 1);
                break;
        case 4:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL2], CTRL2_CO_DIV, 2);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 2);
                break;
        case 8:
        case 0:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL2], CTRL2_CO_DIV, 3);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 3);
                break;
        }
-       stv6110x_write_reg(stv6110x, STV6110x_CTRL2, stv6110x_regs[STV6110x_CTRL2]);
+       stv6110x_write_reg(stv6110x, STV6110x_CTRL2, stv6110x->regs[STV6110x_CTRL2]);
 
        return 0;
 }
@@ -244,8 +256,8 @@ static int stv6110x_get_bbgain(struct dvb_frontend *fe, u32 *gain)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
 
-       stv6110x_read_reg(stv6110x, STV6110x_CTRL2, &stv6110x_regs[STV6110x_CTRL2]);
-       *gain = 2 * STV6110x_GETFIELD(CTRL2_BBGAIN, stv6110x_regs[STV6110x_CTRL2]);
+       stv6110x_read_reg(stv6110x, STV6110x_CTRL2, &stv6110x->regs[STV6110x_CTRL2]);
+       *gain = 2 * STV6110x_GETFIELD(CTRL2_BBGAIN, stv6110x->regs[STV6110x_CTRL2]);
 
        return 0;
 }
@@ -254,8 +266,8 @@ static int stv6110x_set_bbgain(struct dvb_frontend *fe, u32 gain)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
 
-       STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL2], CTRL2_BBGAIN, gain / 2);
-       stv6110x_write_reg(stv6110x, STV6110x_CTRL2, stv6110x_regs[STV6110x_CTRL2]);
+       STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_BBGAIN, gain / 2);
+       stv6110x_write_reg(stv6110x, STV6110x_CTRL2, stv6110x->regs[STV6110x_CTRL2]);
 
        return 0;
 }
@@ -267,19 +279,19 @@ static int stv6110x_set_mode(struct dvb_frontend *fe, enum tuner_mode mode)
 
        switch (mode) {
        case TUNER_SLEEP:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_SYN, 0);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_RX, 0);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_LPT, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_SYN, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_RX, 0);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_LPT, 0);
                break;
 
        case TUNER_WAKE:
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_SYN, 1);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_RX, 1);
-               STV6110x_SETFIELD(stv6110x_regs[STV6110x_CTRL1], CTRL1_LPT, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_SYN, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_RX, 1);
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL1], CTRL1_LPT, 1);
                break;
        }
 
-       ret = stv6110x_write_reg(stv6110x, STV6110x_CTRL1, stv6110x_regs[STV6110x_CTRL1]);
+       ret = stv6110x_write_reg(stv6110x, STV6110x_CTRL1, stv6110x->regs[STV6110x_CTRL1]);
        if (ret < 0) {
                dprintk(FE_ERROR, 1, "I/O Error");
                return -EIO;
@@ -297,9 +309,9 @@ static int stv6110x_get_status(struct dvb_frontend *fe, u32 *status)
 {
        struct stv6110x_state *stv6110x = fe->tuner_priv;
 
-       stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x_regs[STV6110x_STAT1]);
+       stv6110x_read_reg(stv6110x, STV6110x_STAT1, &stv6110x->regs[STV6110x_STAT1]);
 
-       if (STV6110x_GETFIELD(STAT1_LOCK, stv6110x_regs[STV6110x_STAT1]))
+       if (STV6110x_GETFIELD(STAT1_LOCK, stv6110x->regs[STV6110x_STAT1]))
                *status = TUNER_PHASELOCKED;
        else
                *status = 0;
@@ -349,6 +361,8 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
                                        struct i2c_adapter *i2c)
 {
        struct stv6110x_state *stv6110x;
+       u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
+       int ret;
 
        stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL);
        if (stv6110x == NULL)
@@ -357,6 +371,44 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
        stv6110x->i2c           = i2c;
        stv6110x->config        = config;
        stv6110x->devctl        = &stv6110x_ctl;
+       memcpy(stv6110x->regs, default_regs, 8);
+
+       /* setup divider */
+       switch (stv6110x->config->clk_div) {
+       default:
+       case 1:
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 0);
+               break;
+       case 2:
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 1);
+               break;
+       case 4:
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 2);
+               break;
+       case 8:
+       case 0:
+               STV6110x_SETFIELD(stv6110x->regs[STV6110x_CTRL2], CTRL2_CO_DIV, 3);
+               break;
+       }
+
+       if (fe->ops.i2c_gate_ctrl) {
+               ret = fe->ops.i2c_gate_ctrl(fe, 1);
+               if (ret < 0)
+                       goto error;
+       }
+
+       ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs,
+                                 ARRAY_SIZE(stv6110x->regs));
+       if (ret < 0) {
+               dprintk(FE_ERROR, 1, "Initialization failed");
+               goto error;
+       }
+
+       if (fe->ops.i2c_gate_ctrl) {
+               ret = fe->ops.i2c_gate_ctrl(fe, 0);
+               if (ret < 0)
+                       goto error;
+       }
 
        fe->tuner_priv          = stv6110x;
        fe->ops.tuner_ops       = stv6110x_ops;
index a38257080e0194d2ae9ecbe36d6f33929dbd90b2..2429ae6d78470a59c2a52d246d9b57a5427e8aa7 100644 (file)
@@ -26,6 +26,7 @@
 struct stv6110x_config {
        u8      addr;
        u32     refclk;
+       u8      clk_div; /* divisor value for the output clock */
 };
 
 enum tuner_mode {
index 7260da633d49ff8bd31e59ee33b6cb8e022a95cf..0ec936a660a765801a60791f095981e27943946d 100644 (file)
@@ -68,6 +68,7 @@
 struct stv6110x_state {
        struct i2c_adapter              *i2c;
        const struct stv6110x_config    *config;
+       u8                              regs[8];
 
        struct stv6110x_devctl          *devctl;
 };
index 6c1dbf9288d8b34d652bdf4b3465f3d46d0d4b1e..6ca533ea0f0ec047258a568335b7fa17e3762b96 100644 (file)
@@ -426,6 +426,10 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
        id = tda10021_readreg(state, 0x1a);
        if ((id & 0xf0) != 0x70) goto error;
 
+       /* Don't claim TDA10023 */
+       if (id == 0x7d)
+               goto error;
+
        printk("TDA10021: i2c-addr = 0x%02x, id = 0x%02x\n",
               state->config->demod_address, id);
 
diff --git a/drivers/media/dvb/frontends/tda665x.c b/drivers/media/dvb/frontends/tda665x.c
new file mode 100644 (file)
index 0000000..c44fefe
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+       TDA665x tuner driver
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include "dvb_frontend.h"
+#include "tda665x.h"
+
+struct tda665x_state {
+       struct dvb_frontend             *fe;
+       struct i2c_adapter              *i2c;
+       const struct tda665x_config     *config;
+
+       u32 frequency;
+       u32 bandwidth;
+};
+
+static int tda665x_read(struct tda665x_state *state, u8 *buf)
+{
+       const struct tda665x_config *config = state->config;
+       int err = 0;
+       struct i2c_msg msg = { .addr = config->addr, .flags = I2C_M_RD, .buf = buf, .len = 2 };
+
+       err = i2c_transfer(state->i2c, &msg, 1);
+       if (err != 1)
+               goto exit;
+
+       return err;
+exit:
+       printk(KERN_ERR "%s: I/O Error err=<%d>\n", __func__, err);
+       return err;
+}
+
+static int tda665x_write(struct tda665x_state *state, u8 *buf, u8 length)
+{
+       const struct tda665x_config *config = state->config;
+       int err = 0;
+       struct i2c_msg msg = { .addr = config->addr, .flags = 0, .buf = buf, .len = length };
+
+       err = i2c_transfer(state->i2c, &msg, 1);
+       if (err != 1)
+               goto exit;
+
+       return err;
+exit:
+       printk(KERN_ERR "%s: I/O Error err=<%d>\n", __func__, err);
+       return err;
+}
+
+static int tda665x_get_state(struct dvb_frontend *fe,
+                            enum tuner_param param,
+                            struct tuner_state *tstate)
+{
+       struct tda665x_state *state = fe->tuner_priv;
+       int err = 0;
+
+       switch (param) {
+       case DVBFE_TUNER_FREQUENCY:
+               tstate->frequency = state->frequency;
+               break;
+       case DVBFE_TUNER_BANDWIDTH:
+               break;
+       default:
+               printk(KERN_ERR "%s: Unknown parameter (param=%d)\n", __func__, param);
+               err = -EINVAL;
+               break;
+       }
+
+       return err;
+}
+
+static int tda665x_get_status(struct dvb_frontend *fe, u32 *status)
+{
+       struct tda665x_state *state = fe->tuner_priv;
+       u8 result = 0;
+       int err = 0;
+
+       *status = 0;
+
+       err = tda665x_read(state, &result);
+       if (err < 0)
+               goto exit;
+
+       if ((result >> 6) & 0x01) {
+               printk(KERN_DEBUG "%s: Tuner Phase Locked\n", __func__);
+               *status = 1;
+       }
+
+       return err;
+exit:
+       printk(KERN_ERR "%s: I/O Error\n", __func__);
+       return err;
+}
+
+static int tda665x_set_state(struct dvb_frontend *fe,
+                            enum tuner_param param,
+                            struct tuner_state *tstate)
+{
+       struct tda665x_state *state = fe->tuner_priv;
+       const struct tda665x_config *config = state->config;
+       u32 frequency, status = 0;
+       u8 buf[4];
+       int err = 0;
+
+       if (param & DVBFE_TUNER_FREQUENCY) {
+
+               frequency = tstate->frequency;
+               if ((frequency < config->frequency_max) || (frequency > config->frequency_min)) {
+                       printk(KERN_ERR "%s: Frequency beyond limits, frequency=%d\n", __func__, frequency);
+                       return -EINVAL;
+               }
+
+               frequency += config->frequency_offst;
+               frequency *= config->ref_multiplier;
+               frequency += config->ref_divider >> 1;
+               frequency /= config->ref_divider;
+
+               buf[0] = (u8) ((frequency & 0x7f00) >> 8);
+               buf[1] = (u8) (frequency & 0x00ff) >> 0;
+               buf[2] = 0x80 | 0x40 | 0x02;
+               buf[3] = 0x00;
+
+               /* restore frequency */
+               frequency = tstate->frequency;
+
+               if (frequency < 153000000) {
+                       /* VHF-L */
+                       buf[3] |= 0x01; /* fc, Low Band, 47 - 153 MHz */
+                       if (frequency < 68000000)
+                               buf[3] |= 0x40; /* 83uA */
+                       if (frequency < 1040000000)
+                               buf[3] |= 0x60; /* 122uA */
+                       if (frequency < 1250000000)
+                               buf[3] |= 0x80; /* 163uA */
+                       else
+                               buf[3] |= 0xa0; /* 254uA */
+               } else if (frequency < 438000000) {
+                       /* VHF-H */
+                       buf[3] |= 0x02; /* fc, Mid Band, 153 - 438 MHz */
+                       if (frequency < 230000000)
+                               buf[3] |= 0x40;
+                       if (frequency < 300000000)
+                               buf[3] |= 0x60;
+                       else
+                               buf[3] |= 0x80;
+               } else {
+                       /* UHF */
+                       buf[3] |= 0x04; /* fc, High Band, 438 - 862 MHz */
+                       if (frequency < 470000000)
+                               buf[3] |= 0x60;
+                       if (frequency < 526000000)
+                               buf[3] |= 0x80;
+                       else
+                               buf[3] |= 0xa0;
+               }
+
+               /* Set params */
+               err = tda665x_write(state, buf, 5);
+               if (err < 0)
+                       goto exit;
+
+               /* sleep for some time */
+               printk(KERN_DEBUG "%s: Waiting to Phase LOCK\n", __func__);
+               msleep(20);
+               /* check status */
+               err = tda665x_get_status(fe, &status);
+               if (err < 0)
+                       goto exit;
+
+               if (status == 1) {
+                       printk(KERN_DEBUG "%s: Tuner Phase locked: status=%d\n", __func__, status);
+                       state->frequency = frequency; /* cache successful state */
+               } else {
+                       printk(KERN_ERR "%s: No Phase lock: status=%d\n", __func__, status);
+               }
+       } else {
+               printk(KERN_ERR "%s: Unknown parameter (param=%d)\n", __func__, param);
+               return -EINVAL;
+       }
+
+       return 0;
+exit:
+       printk(KERN_ERR "%s: I/O Error\n", __func__);
+       return err;
+}
+
+static int tda665x_release(struct dvb_frontend *fe)
+{
+       struct tda665x_state *state = fe->tuner_priv;
+
+       fe->tuner_priv = NULL;
+       kfree(state);
+       return 0;
+}
+
+static struct dvb_tuner_ops tda665x_ops = {
+
+       .set_state      = tda665x_set_state,
+       .get_state      = tda665x_get_state,
+       .get_status     = tda665x_get_status,
+       .release        = tda665x_release
+};
+
+struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+                                   const struct tda665x_config *config,
+                                   struct i2c_adapter *i2c)
+{
+       struct tda665x_state *state = NULL;
+       struct dvb_tuner_info *info;
+
+       state = kzalloc(sizeof(struct tda665x_state), GFP_KERNEL);
+       if (state == NULL)
+               goto exit;
+
+       state->config           = config;
+       state->i2c              = i2c;
+       state->fe               = fe;
+       fe->tuner_priv          = state;
+       fe->ops.tuner_ops       = tda665x_ops;
+       info                     = &fe->ops.tuner_ops.info;
+
+       memcpy(info->name, config->name, sizeof(config->name));
+       info->frequency_min     = config->frequency_min;
+       info->frequency_max     = config->frequency_max;
+       info->frequency_step    = config->frequency_offst;
+
+       printk(KERN_DEBUG "%s: Attaching TDA665x (%s) tuner\n", __func__, info->name);
+
+       return fe;
+
+exit:
+       kfree(state);
+       return NULL;
+}
+EXPORT_SYMBOL(tda665x_attach);
+
+MODULE_DESCRIPTION("TDA665x driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/tda665x.h b/drivers/media/dvb/frontends/tda665x.h
new file mode 100644 (file)
index 0000000..ec7927a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+       TDA665x tuner driver
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __TDA665x_H
+#define __TDA665x_H
+
+struct tda665x_config {
+       char name[128];
+
+       u8      addr;
+       u32     frequency_min;
+       u32     frequency_max;
+       u32     frequency_offst;
+       u32     ref_multiplier;
+       u32     ref_divider;
+};
+
+#if defined(CONFIG_DVB_TDA665x) || (defined(CONFIG_DVB_TDA665x_MODULE) && defined(MODULE))
+
+extern struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+                                          const struct tda665x_config *config,
+                                          struct i2c_adapter *i2c);
+
+#else
+
+static inline struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+                                                 const struct tda665x_config *config,
+                                                 struct i2c_adapter *i2c)
+{
+       printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+       return NULL;
+}
+
+#endif /* CONFIG_DVB_TDA665x */
+
+#endif /* __TDA665x_H */
index 320c3c36d8b2495663a233d0c167fa9c5dee51a0..614afcec05f119c6cea50540d551503a19dbedbc 100644 (file)
@@ -39,7 +39,7 @@ static int tda8261_read(struct tda8261_state *state, u8 *buf)
 {
        const struct tda8261_config *config = state->config;
        int err = 0;
-       struct i2c_msg msg = { .addr    = config->addr, .flags = I2C_M_RD,.buf = buf,  .len = 2 };
+       struct i2c_msg msg = { .addr    = config->addr, .flags = I2C_M_RD,.buf = buf,  .len = 1 };
 
        if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1)
                printk("%s: read error, err=%d\n", __func__, err);
index 4e814ff22b23c5f5847b949b8918579bce61bdf0..34c5de491d2b416287c1ccdfa05e24a9744be76d 100644 (file)
@@ -411,7 +411,7 @@ static int zl10036_init_regs(struct zl10036_state *state)
        state->bf = 0xff;
 
        if (!state->config->rf_loop_enable)
-               zl10036_init_tab[1][2] |= 0x01;
+               zl10036_init_tab[1][0] |= 0x01;
 
        deb_info("%s\n", __func__);
 
index 11b29cb883e63ccf0c64d0a5dcd527b2b5caba10..c085e58a94bfe7d64b876a3421d244eb392b473d 100644 (file)
@@ -287,7 +287,6 @@ struct dvb_frontend *zl10039_attach(struct dvb_frontend *fe,
                break;
        default:
                dprintk("Chip ID=%x does not match a known type\n", state->id);
-               break;
                goto error;
        }
 
diff --git a/drivers/media/dvb/mantis/Kconfig b/drivers/media/dvb/mantis/Kconfig
new file mode 100644 (file)
index 0000000..f7b72a3
--- /dev/null
@@ -0,0 +1,32 @@
+config MANTIS_CORE
+       tristate "Mantis/Hopper PCI bridge based devices"
+       depends on PCI && I2C && INPUT
+
+       help
+         Support for PCI cards based on the Mantis and Hopper PCi bridge.
+
+         Say Y if you own such a device and want to use it.
+
+config DVB_MANTIS
+       tristate "MANTIS based cards"
+       depends on MANTIS_CORE && DVB_CORE && PCI && I2C
+       select DVB_MB86A16
+       select DVB_ZL10353
+       select DVB_STV0299
+       select DVB_PLL
+       help
+         Support for PCI cards based on the Mantis PCI bridge.
+         Say Y when you have a Mantis based DVB card and want to use it.
+
+         If unsure say N.
+
+config DVB_HOPPER
+       tristate "HOPPER based cards"
+       depends on MANTIS_CORE && DVB_CORE && PCI && I2C
+       select DVB_ZL10353
+       select DVB_PLL
+       help
+         Support for PCI cards based on the Hopper  PCI bridge.
+         Say Y when you have a Hopper based DVB card and want to use it.
+
+         If unsure say N
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
new file mode 100644 (file)
index 0000000..98dc5cd
--- /dev/null
@@ -0,0 +1,28 @@
+mantis_core-objs :=    mantis_ioc.o    \
+                       mantis_uart.o   \
+                       mantis_dma.o    \
+                       mantis_pci.o    \
+                       mantis_i2c.o    \
+                       mantis_dvb.o    \
+                       mantis_evm.o    \
+                       mantis_hif.o    \
+                       mantis_ca.o     \
+                       mantis_pcmcia.o \
+                       mantis_input.o
+
+mantis-objs    :=      mantis_cards.o  \
+                       mantis_vp1033.o \
+                       mantis_vp1034.o \
+                       mantis_vp1041.o \
+                       mantis_vp2033.o \
+                       mantis_vp2040.o \
+                       mantis_vp3030.o
+
+hopper-objs    :=      hopper_cards.o  \
+                       hopper_vp3028.o
+
+obj-$(CONFIG_MANTIS_CORE)      += mantis_core.o
+obj-$(CONFIG_DVB_MANTIS)       += mantis.o
+obj-$(CONFIG_DVB_HOPPER)       += hopper.o
+
+EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
diff --git a/drivers/media/dvb/mantis/hopper_cards.c b/drivers/media/dvb/mantis/hopper_cards.c
new file mode 100644 (file)
index 0000000..d073c61
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+       Hopper PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <asm/irq.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "hopper_vp3028.h"
+#include "mantis_dma.h"
+#include "mantis_dvb.h"
+#include "mantis_uart.h"
+#include "mantis_ioc.h"
+#include "mantis_pci.h"
+#include "mantis_i2c.h"
+#include "mantis_reg.h"
+
+static unsigned int verbose;
+module_param(verbose, int, 0644);
+MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
+
+#define DRIVER_NAME    "Hopper"
+
+static char *label[10] = {
+       "DMA",
+       "IRQ-0",
+       "IRQ-1",
+       "OCERR",
+       "PABRT",
+       "RIPRR",
+       "PPERR",
+       "FTRGT",
+       "RISCI",
+       "RACK"
+};
+
+static int devs;
+
+static irqreturn_t hopper_irq_handler(int irq, void *dev_id)
+{
+       u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
+       u32 rst_stat = 0, rst_mask = 0;
+
+       struct mantis_pci *mantis;
+       struct mantis_ca *ca;
+
+       mantis = (struct mantis_pci *) dev_id;
+       if (unlikely(mantis == NULL)) {
+               dprintk(MANTIS_ERROR, 1, "Mantis == NULL");
+               return IRQ_NONE;
+       }
+       ca = mantis->mantis_ca;
+
+       stat = mmread(MANTIS_INT_STAT);
+       mask = mmread(MANTIS_INT_MASK);
+       mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
+       if (!(stat & mask))
+               return IRQ_NONE;
+
+       rst_mask  = MANTIS_GPIF_WRACK  |
+                   MANTIS_GPIF_OTHERR |
+                   MANTIS_SBUF_WSTO   |
+                   MANTIS_GPIF_EXTIRQ;
+
+       rst_stat  = mmread(MANTIS_GPIF_STATUS);
+       rst_stat &= rst_mask;
+       mmwrite(rst_stat, MANTIS_GPIF_STATUS);
+
+       mantis->mantis_int_stat = stat;
+       mantis->mantis_int_mask = mask;
+       dprintk(MANTIS_DEBUG, 0, "\n-- Stat=<%02x> Mask=<%02x> --", stat, mask);
+       if (stat & MANTIS_INT_RISCEN) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[0]);
+       }
+       if (stat & MANTIS_INT_IRQ0) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[1]);
+               mantis->gpif_status = rst_stat;
+               wake_up(&ca->hif_write_wq);
+               schedule_work(&ca->hif_evm_work);
+       }
+       if (stat & MANTIS_INT_IRQ1) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]);
+               schedule_work(&mantis->uart_work);
+       }
+       if (stat & MANTIS_INT_OCERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[3]);
+       }
+       if (stat & MANTIS_INT_PABORT) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[4]);
+       }
+       if (stat & MANTIS_INT_RIPERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[5]);
+       }
+       if (stat & MANTIS_INT_PPERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[6]);
+       }
+       if (stat & MANTIS_INT_FTRGT) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[7]);
+       }
+       if (stat & MANTIS_INT_RISCI) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]);
+               mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+               tasklet_schedule(&mantis->tasklet);
+       }
+       if (stat & MANTIS_INT_I2CDONE) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[9]);
+               wake_up(&mantis->i2c_wq);
+       }
+       mmwrite(stat, MANTIS_INT_STAT);
+       stat &= ~(MANTIS_INT_RISCEN   | MANTIS_INT_I2CDONE |
+                 MANTIS_INT_I2CRACK  | MANTIS_INT_PCMCIA7 |
+                 MANTIS_INT_PCMCIA6  | MANTIS_INT_PCMCIA5 |
+                 MANTIS_INT_PCMCIA4  | MANTIS_INT_PCMCIA3 |
+                 MANTIS_INT_PCMCIA2  | MANTIS_INT_PCMCIA1 |
+                 MANTIS_INT_PCMCIA0  | MANTIS_INT_IRQ1    |
+                 MANTIS_INT_IRQ0     | MANTIS_INT_OCERR   |
+                 MANTIS_INT_PABORT   | MANTIS_INT_RIPERR  |
+                 MANTIS_INT_PPERR    | MANTIS_INT_FTRGT   |
+                 MANTIS_INT_RISCI);
+
+       if (stat)
+               dprintk(MANTIS_DEBUG, 0, "<Unknown> Stat=<%02x> Mask=<%02x>", stat, mask);
+
+       dprintk(MANTIS_DEBUG, 0, "\n");
+       return IRQ_HANDLED;
+}
+
+static int __devinit hopper_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
+{
+       struct mantis_pci *mantis;
+       struct mantis_hwconfig *config;
+       int err = 0;
+
+       mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+       if (mantis == NULL) {
+               printk(KERN_ERR "%s ERROR: Out of memory\n", __func__);
+               err = -ENOMEM;
+               goto fail0;
+       }
+
+       mantis->num             = devs;
+       mantis->verbose         = verbose;
+       mantis->pdev            = pdev;
+       config                  = (struct mantis_hwconfig *) pci_id->driver_data;
+       config->irq_handler     = &hopper_irq_handler;
+       mantis->hwconfig        = config;
+
+       err = mantis_pci_init(mantis);
+       if (err) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err);
+               goto fail1;
+       }
+
+       err = mantis_stream_control(mantis, STREAM_TO_HIF);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err);
+               goto fail1;
+       }
+
+       err = mantis_i2c_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err);
+               goto fail2;
+       }
+
+       err = mantis_get_mac(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err);
+               goto fail2;
+       }
+
+       err = mantis_dma_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err);
+               goto fail3;
+       }
+
+       err = mantis_dvb_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
+               goto fail4;
+       }
+       devs++;
+
+       return err;
+
+fail4:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err);
+       mantis_dma_exit(mantis);
+
+fail3:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err);
+       mantis_i2c_exit(mantis);
+
+fail2:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err);
+       mantis_pci_exit(mantis);
+
+fail1:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err);
+       kfree(mantis);
+
+fail0:
+       return err;
+}
+
+static void __devexit hopper_pci_remove(struct pci_dev *pdev)
+{
+       struct mantis_pci *mantis = pci_get_drvdata(pdev);
+
+       if (mantis) {
+               mantis_dvb_exit(mantis);
+               mantis_dma_exit(mantis);
+               mantis_i2c_exit(mantis);
+               mantis_pci_exit(mantis);
+               kfree(mantis);
+       }
+       return;
+
+}
+
+static struct pci_device_id hopper_pci_table[] = {
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3028_DVB_T, &vp3028_config),
+       { }
+};
+
+static struct pci_driver hopper_pci_driver = {
+       .name           = DRIVER_NAME,
+       .id_table       = hopper_pci_table,
+       .probe          = hopper_pci_probe,
+       .remove         = hopper_pci_remove,
+};
+
+static int __devinit hopper_init(void)
+{
+       return pci_register_driver(&hopper_pci_driver);
+}
+
+static void __devexit hopper_exit(void)
+{
+       return pci_unregister_driver(&hopper_pci_driver);
+}
+
+module_init(hopper_init);
+module_exit(hopper_exit);
+
+MODULE_DESCRIPTION("HOPPER driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/mantis/hopper_vp3028.c b/drivers/media/dvb/mantis/hopper_vp3028.c
new file mode 100644 (file)
index 0000000..96674c7
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+       Hopper VP-3028 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "zl10353.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "hopper_vp3028.h"
+
+struct zl10353_config hopper_vp3028_config = {
+       .demod_address  = 0x0f,
+};
+
+#define MANTIS_MODEL_NAME      "VP-3028"
+#define MANTIS_DEV_TYPE                "DVB-T"
+
+static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter     = &mantis->adapter;
+       struct mantis_hwconfig *config  = mantis->hwconfig;
+       int err = 0;
+
+       gpio_set_bits(mantis, config->reset, 0);
+       msleep(100);
+       err = mantis_frontend_power(mantis, POWER_ON);
+       msleep(100);
+       gpio_set_bits(mantis, config->reset, 1);
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               msleep(250);
+               dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+               fe = zl10353_attach(&hopper_vp3028_config, adapter);
+
+               if (!fe)
+                       return -1;
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+       dprintk(MANTIS_ERROR, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp3028_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_188,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp3028_frontend_init,
+       .power          = GPIF_A00,
+       .reset          = GPIF_A03,
+};
diff --git a/drivers/media/dvb/mantis/hopper_vp3028.h b/drivers/media/dvb/mantis/hopper_vp3028.h
new file mode 100644 (file)
index 0000000..5723949
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Hopper VP-3028 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP3028_H
+#define __MANTIS_VP3028_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_3028_DVB_T   0x0028
+
+extern struct mantis_hwconfig vp3028_config;
+
+#endif /* __MANTIS_VP3028_H */
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
new file mode 100644 (file)
index 0000000..403ce04
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_link.h"
+#include "mantis_hif.h"
+#include "mantis_reg.h"
+
+#include "mantis_ca.h"
+
+static int mantis_ca_read_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Read", slot);
+
+       if (slot != 0)
+               return -EINVAL;
+
+       return mantis_hif_read_mem(ca, addr);
+}
+
+static int mantis_ca_write_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr, u8 data)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Write", slot);
+
+       if (slot != 0)
+               return -EINVAL;
+
+       return mantis_hif_write_mem(ca, addr, data);
+}
+
+static int mantis_ca_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Read", slot);
+
+       if (slot != 0)
+               return -EINVAL;
+
+       return mantis_hif_read_iom(ca, addr);
+}
+
+static int mantis_ca_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr, u8 data)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Write", slot);
+
+       if (slot != 0)
+               return -EINVAL;
+
+       return mantis_hif_write_iom(ca, addr, data);
+}
+
+static int mantis_ca_slot_reset(struct dvb_ca_en50221 *en50221, int slot)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot RESET", slot);
+       udelay(500); /* Wait.. */
+       mmwrite(0xda, MANTIS_PCMCIA_RESET); /* Leading edge assert */
+       udelay(500);
+       mmwrite(0x00, MANTIS_PCMCIA_RESET); /* Trailing edge deassert */
+       msleep(1000);
+       dvb_ca_en50221_camready_irq(&ca->en50221, 0);
+
+       return 0;
+}
+
+static int mantis_ca_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot);
+
+       return 0;
+}
+
+static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot);
+/*     mantis_set_direction(mantis, 1); */ /* Enable TS through CAM */
+
+       return 0;
+}
+
+static int mantis_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open)
+{
+       struct mantis_ca *ca = en50221->data;
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Slot(%d): Poll Slot status", slot);
+
+       if (ca->slot_state == MODULE_INSERTED) {
+               dprintk(MANTIS_DEBUG, 1, "CA Module present and ready");
+               return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY;
+       } else {
+               dprintk(MANTIS_DEBUG, 1, "CA Module not present or not ready");
+       }
+
+       return 0;
+}
+
+int mantis_ca_init(struct mantis_pci *mantis)
+{
+       struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter;
+       struct mantis_ca *ca;
+       int ca_flags = 0, result;
+
+       dprintk(MANTIS_DEBUG, 1, "Initializing Mantis CA");
+       ca = kzalloc(sizeof(struct mantis_ca), GFP_KERNEL);
+       if (!ca) {
+               dprintk(MANTIS_ERROR, 1, "Out of memory!, exiting ..");
+               result = -ENOMEM;
+               goto err;
+       }
+
+       ca->ca_priv             = mantis;
+       mantis->mantis_ca       = ca;
+       ca_flags                = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE;
+       /* register CA interface */
+       ca->en50221.owner               = THIS_MODULE;
+       ca->en50221.read_attribute_mem  = mantis_ca_read_attr_mem;
+       ca->en50221.write_attribute_mem = mantis_ca_write_attr_mem;
+       ca->en50221.read_cam_control    = mantis_ca_read_cam_ctl;
+       ca->en50221.write_cam_control   = mantis_ca_write_cam_ctl;
+       ca->en50221.slot_reset          = mantis_ca_slot_reset;
+       ca->en50221.slot_shutdown       = mantis_ca_slot_shutdown;
+       ca->en50221.slot_ts_enable      = mantis_ts_control;
+       ca->en50221.poll_slot_status    = mantis_slot_status;
+       ca->en50221.data                = ca;
+
+       mutex_init(&ca->ca_lock);
+
+       init_waitqueue_head(&ca->hif_data_wq);
+       init_waitqueue_head(&ca->hif_opdone_wq);
+       init_waitqueue_head(&ca->hif_write_wq);
+
+       dprintk(MANTIS_ERROR, 1, "Registering EN50221 device");
+       result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1);
+       if (result != 0) {
+               dprintk(MANTIS_ERROR, 1, "EN50221: Initialization failed <%d>", result);
+               goto err;
+       }
+       dprintk(MANTIS_ERROR, 1, "Registered EN50221 device");
+       mantis_evmgr_init(ca);
+       return 0;
+err:
+       kfree(ca);
+       return result;
+}
+EXPORT_SYMBOL_GPL(mantis_ca_init);
+
+void mantis_ca_exit(struct mantis_pci *mantis)
+{
+       struct mantis_ca *ca = mantis->mantis_ca;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis CA exit");
+
+       mantis_evmgr_exit(ca);
+       dprintk(MANTIS_ERROR, 1, "Unregistering EN50221 device");
+       if (ca)
+               dvb_ca_en50221_release(&ca->en50221);
+
+       kfree(ca);
+}
+EXPORT_SYMBOL_GPL(mantis_ca_exit);
diff --git a/drivers/media/dvb/mantis/mantis_ca.h b/drivers/media/dvb/mantis/mantis_ca.h
new file mode 100644 (file)
index 0000000..dc63e55
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_CA_H
+#define __MANTIS_CA_H
+
+extern int mantis_ca_init(struct mantis_pci *mantis);
+extern void mantis_ca_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_CA_H */
diff --git a/drivers/media/dvb/mantis/mantis_cards.c b/drivers/media/dvb/mantis/mantis_cards.c
new file mode 100644 (file)
index 0000000..16f1708
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <asm/irq.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+
+#include "mantis_vp1033.h"
+#include "mantis_vp1034.h"
+#include "mantis_vp1041.h"
+#include "mantis_vp2033.h"
+#include "mantis_vp2040.h"
+#include "mantis_vp3030.h"
+
+#include "mantis_dma.h"
+#include "mantis_ca.h"
+#include "mantis_dvb.h"
+#include "mantis_uart.h"
+#include "mantis_ioc.h"
+#include "mantis_pci.h"
+#include "mantis_i2c.h"
+#include "mantis_reg.h"
+
+static unsigned int verbose;
+module_param(verbose, int, 0644);
+MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
+
+static int devs;
+
+#define DRIVER_NAME    "Mantis"
+
+static char *label[10] = {
+       "DMA",
+       "IRQ-0",
+       "IRQ-1",
+       "OCERR",
+       "PABRT",
+       "RIPRR",
+       "PPERR",
+       "FTRGT",
+       "RISCI",
+       "RACK"
+};
+
+static irqreturn_t mantis_irq_handler(int irq, void *dev_id)
+{
+       u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
+       u32 rst_stat = 0, rst_mask = 0;
+
+       struct mantis_pci *mantis;
+       struct mantis_ca *ca;
+
+       mantis = (struct mantis_pci *) dev_id;
+       if (unlikely(mantis == NULL)) {
+               dprintk(MANTIS_ERROR, 1, "Mantis == NULL");
+               return IRQ_NONE;
+       }
+       ca = mantis->mantis_ca;
+
+       stat = mmread(MANTIS_INT_STAT);
+       mask = mmread(MANTIS_INT_MASK);
+       mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
+       if (!(stat & mask))
+               return IRQ_NONE;
+
+       rst_mask  = MANTIS_GPIF_WRACK  |
+                   MANTIS_GPIF_OTHERR |
+                   MANTIS_SBUF_WSTO   |
+                   MANTIS_GPIF_EXTIRQ;
+
+       rst_stat  = mmread(MANTIS_GPIF_STATUS);
+       rst_stat &= rst_mask;
+       mmwrite(rst_stat, MANTIS_GPIF_STATUS);
+
+       mantis->mantis_int_stat = stat;
+       mantis->mantis_int_mask = mask;
+       dprintk(MANTIS_DEBUG, 0, "\n-- Stat=<%02x> Mask=<%02x> --", stat, mask);
+       if (stat & MANTIS_INT_RISCEN) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[0]);
+       }
+       if (stat & MANTIS_INT_IRQ0) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[1]);
+               mantis->gpif_status = rst_stat;
+               wake_up(&ca->hif_write_wq);
+               schedule_work(&ca->hif_evm_work);
+       }
+       if (stat & MANTIS_INT_IRQ1) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]);
+               schedule_work(&mantis->uart_work);
+       }
+       if (stat & MANTIS_INT_OCERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[3]);
+       }
+       if (stat & MANTIS_INT_PABORT) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[4]);
+       }
+       if (stat & MANTIS_INT_RIPERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[5]);
+       }
+       if (stat & MANTIS_INT_PPERR) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[6]);
+       }
+       if (stat & MANTIS_INT_FTRGT) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[7]);
+       }
+       if (stat & MANTIS_INT_RISCI) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]);
+               mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+               tasklet_schedule(&mantis->tasklet);
+       }
+       if (stat & MANTIS_INT_I2CDONE) {
+               dprintk(MANTIS_DEBUG, 0, "<%s>", label[9]);
+               wake_up(&mantis->i2c_wq);
+       }
+       mmwrite(stat, MANTIS_INT_STAT);
+       stat &= ~(MANTIS_INT_RISCEN   | MANTIS_INT_I2CDONE |
+                 MANTIS_INT_I2CRACK  | MANTIS_INT_PCMCIA7 |
+                 MANTIS_INT_PCMCIA6  | MANTIS_INT_PCMCIA5 |
+                 MANTIS_INT_PCMCIA4  | MANTIS_INT_PCMCIA3 |
+                 MANTIS_INT_PCMCIA2  | MANTIS_INT_PCMCIA1 |
+                 MANTIS_INT_PCMCIA0  | MANTIS_INT_IRQ1    |
+                 MANTIS_INT_IRQ0     | MANTIS_INT_OCERR   |
+                 MANTIS_INT_PABORT   | MANTIS_INT_RIPERR  |
+                 MANTIS_INT_PPERR    | MANTIS_INT_FTRGT   |
+                 MANTIS_INT_RISCI);
+
+       if (stat)
+               dprintk(MANTIS_DEBUG, 0, "<Unknown> Stat=<%02x> Mask=<%02x>", stat, mask);
+
+       dprintk(MANTIS_DEBUG, 0, "\n");
+       return IRQ_HANDLED;
+}
+
+static int __devinit mantis_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
+{
+       struct mantis_pci *mantis;
+       struct mantis_hwconfig *config;
+       int err = 0;
+
+       mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+       if (mantis == NULL) {
+               printk(KERN_ERR "%s ERROR: Out of memory\n", __func__);
+               err = -ENOMEM;
+               goto fail0;
+       }
+
+       mantis->num             = devs;
+       mantis->verbose         = verbose;
+       mantis->pdev            = pdev;
+       config                  = (struct mantis_hwconfig *) pci_id->driver_data;
+       config->irq_handler     = &mantis_irq_handler;
+       mantis->hwconfig        = config;
+
+       err = mantis_pci_init(mantis);
+       if (err) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err);
+               goto fail1;
+       }
+
+       err = mantis_stream_control(mantis, STREAM_TO_HIF);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err);
+               goto fail1;
+       }
+
+       err = mantis_i2c_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err);
+               goto fail2;
+       }
+
+       err = mantis_get_mac(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err);
+               goto fail2;
+       }
+
+       err = mantis_dma_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err);
+               goto fail3;
+       }
+
+       err = mantis_dvb_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
+               goto fail4;
+       }
+       err = mantis_uart_init(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART initialization failed <%d>", err);
+               goto fail6;
+       }
+
+       devs++;
+
+       return err;
+
+
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART exit! <%d>", err);
+       mantis_uart_exit(mantis);
+
+fail6:
+fail4:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err);
+       mantis_dma_exit(mantis);
+
+fail3:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err);
+       mantis_i2c_exit(mantis);
+
+fail2:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err);
+       mantis_pci_exit(mantis);
+
+fail1:
+       dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err);
+       kfree(mantis);
+
+fail0:
+       return err;
+}
+
+static void __devexit mantis_pci_remove(struct pci_dev *pdev)
+{
+       struct mantis_pci *mantis = pci_get_drvdata(pdev);
+
+       if (mantis) {
+
+               mantis_uart_exit(mantis);
+               mantis_dvb_exit(mantis);
+               mantis_dma_exit(mantis);
+               mantis_i2c_exit(mantis);
+               mantis_pci_exit(mantis);
+               kfree(mantis);
+       }
+       return;
+}
+
+static struct pci_device_id mantis_pci_table[] = {
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1033_DVB_S, &vp1033_config),
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1034_DVB_S, &vp1034_config),
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1041_DVB_S2, &vp1041_config),
+       MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_10, &vp1041_config),
+       MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_20, &vp1041_config),
+       MAKE_ENTRY(TERRATEC, CINERGY_S2_PCI_HD, &vp1041_config),
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config),
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config),
+       MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config),
+       MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2033_config),
+       MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config),
+       { }
+};
+
+static struct pci_driver mantis_pci_driver = {
+       .name           = DRIVER_NAME,
+       .id_table       = mantis_pci_table,
+       .probe          = mantis_pci_probe,
+       .remove         = mantis_pci_remove,
+};
+
+static int __devinit mantis_init(void)
+{
+       return pci_register_driver(&mantis_pci_driver);
+}
+
+static void __devexit mantis_exit(void)
+{
+       return pci_unregister_driver(&mantis_pci_driver);
+}
+
+module_init(mantis_init);
+module_exit(mantis_exit);
+
+MODULE_DESCRIPTION("MANTIS driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
new file mode 100644 (file)
index 0000000..d0b645a
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_COMMON_H
+#define __MANTIS_COMMON_H
+
+#include <linux/mutex.h>
+#include <linux/workqueue.h>
+
+#include "mantis_uart.h"
+
+#include "mantis_link.h"
+
+#define MANTIS_ERROR           0
+#define MANTIS_NOTICE          1
+#define MANTIS_INFO            2
+#define MANTIS_DEBUG           3
+#define MANTIS_TMG             9
+
+#define dprintk(y, z, format, arg...) do {                                                             \
+       if (z) {                                                                                        \
+               if      ((mantis->verbose > MANTIS_ERROR) && (mantis->verbose > y))                     \
+                       printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);      \
+               else if ((mantis->verbose > MANTIS_NOTICE) && (mantis->verbose > y))                    \
+                       printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);   \
+               else if ((mantis->verbose > MANTIS_INFO) && (mantis->verbose > y))                      \
+                       printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);     \
+               else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y))                     \
+                       printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);    \
+               else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y))                       \
+                       printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg);    \
+       } else {                                                                                        \
+               if (mantis->verbose > y)                                                                \
+                       printk(format , ##arg);                                                         \
+       }                                                                                               \
+} while(0)
+
+#define mwrite(dat, addr)      writel((dat), addr)
+#define mread(addr)            readl(addr)
+
+#define mmwrite(dat, addr)     mwrite((dat), (mantis->mmio + (addr)))
+#define mmread(addr)           mread(mantis->mmio + (addr))
+
+#define MANTIS_TS_188          0
+#define MANTIS_TS_204          1
+
+#define TWINHAN_TECHNOLOGIES   0x1822
+#define MANTIS                 0x4e35
+
+#define TECHNISAT              0x1ae4
+#define TERRATEC               0x153b
+
+#define MAKE_ENTRY(__subven, __subdev, __configptr) {                  \
+               .vendor         = TWINHAN_TECHNOLOGIES,                 \
+               .device         = MANTIS,                               \
+               .subvendor      = (__subven),                           \
+               .subdevice      = (__subdev),                           \
+               .driver_data    = (unsigned long) (__configptr)         \
+}
+
+enum mantis_i2c_mode {
+       MANTIS_PAGE_MODE = 0,
+       MANTIS_BYTE_MODE,
+};
+
+struct mantis_pci;
+
+struct mantis_hwconfig {
+       char                    *model_name;
+       char                    *dev_type;
+       u32                     ts_size;
+
+       enum mantis_baud        baud_rate;
+       enum mantis_parity      parity;
+       u32                     bytes;
+
+       irqreturn_t (*irq_handler)(int irq, void *dev_id);
+       int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe);
+
+       u8                      power;
+       u8                      reset;
+
+       enum mantis_i2c_mode    i2c_mode;
+};
+
+struct mantis_pci {
+       unsigned int            verbose;
+
+       /*      PCI stuff               */
+       u16                     vendor_id;
+       u16                     device_id;
+       u16                     subsystem_vendor;
+       u16                     subsystem_device;
+
+       u8                      latency;
+
+       struct pci_dev          *pdev;
+
+       unsigned long           mantis_addr;
+       void __iomem            *mmio;
+
+       u8                      irq;
+       u8                      revision;
+
+       unsigned int            num;
+
+       /*      RISC Core               */
+       u32                     finished_block;
+       u32                     last_block;
+       u32                     line_bytes;
+       u32                     line_count;
+       u32                     risc_pos;
+       u8                      *buf_cpu;
+       dma_addr_t              buf_dma;
+       u32                     *risc_cpu;
+       dma_addr_t              risc_dma;
+
+       struct tasklet_struct   tasklet;
+
+       struct i2c_adapter      adapter;
+       int                     i2c_rc;
+       wait_queue_head_t       i2c_wq;
+       struct mutex            i2c_lock;
+
+       /*      DVB stuff               */
+       struct dvb_adapter      dvb_adapter;
+       struct dvb_frontend     *fe;
+       struct dvb_demux        demux;
+       struct dmxdev           dmxdev;
+       struct dmx_frontend     fe_hw;
+       struct dmx_frontend     fe_mem;
+       struct dvb_net          dvbnet;
+
+       u8                      feeds;
+
+       struct mantis_hwconfig  *hwconfig;
+
+       u32                     mantis_int_stat;
+       u32                     mantis_int_mask;
+
+       /*      board specific          */
+       u8                      mac_address[8];
+       u32                     sub_vendor_id;
+       u32                     sub_device_id;
+
+        /*     A12 A13 A14             */
+       u32                     gpio_status;
+
+       u32                     gpif_status;
+
+       struct mantis_ca        *mantis_ca;
+
+       wait_queue_head_t       uart_wq;
+       struct work_struct      uart_work;
+       spinlock_t              uart_lock;
+
+       struct input_dev        *rc;
+};
+
+#define MANTIS_HIF_STATUS      (mantis->gpio_status)
+
+#endif /* __MANTIS_COMMON_H */
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
new file mode 100644 (file)
index 0000000..8113b23
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "mantis_common.h"
+#include "mantis_core.h"
+#include "mantis_vp1033.h"
+#include "mantis_vp1034.h"
+#include "mantis_vp1041.h"
+#include "mantis_vp2033.h"
+#include "mantis_vp2040.h"
+#include "mantis_vp3030.h"
+
+static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
+{
+       int err;
+       struct i2c_msg msg[] = {
+               {
+                       .addr = 0x50,
+                       .flags = 0,
+                       .buf = data,
+                       .len = 1
+               }, {
+                       .addr = 0x50,
+                       .flags = I2C_M_RD,
+                       .buf = data,
+                       .len = length
+               },
+       };
+
+       err = i2c_transfer(&mantis->adapter, msg, 2);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1,
+                       "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >",
+                       err, data[0], data[1]);
+
+               return err;
+       }
+
+       return 0;
+}
+
+static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
+{
+       int err;
+
+       struct i2c_msg msg = {
+               .addr = 0x50,
+               .flags = 0,
+               .buf = data,
+               .len = length
+       };
+
+       err = i2c_transfer(&mantis->adapter, &msg, 1);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1,
+                       "ERROR: i2c write: < err=%i length=0x%02x d0=0x%02x, d1=0x%02x >",
+                       err, length, data[0], data[1]);
+
+               return err;
+       }
+
+       return 0;
+}
+
+static int get_mac_address(struct mantis_pci *mantis)
+{
+       int err;
+
+       mantis->mac_address[0] = 0x08;
+       err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
+
+               return err;
+       }
+       dprintk(verbose, MANTIS_ERROR, 0,
+               "    MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
+               mantis->mac_address[0], mantis->mac_address[1],
+               mantis->mac_address[2], mantis->mac_address[3],
+               mantis->mac_address[4], mantis->mac_address[5]);
+
+       return 0;
+}
+
+#define MANTIS_MODEL_UNKNOWN   "UNKNOWN"
+#define MANTIS_DEV_UNKNOWN     "UNKNOWN"
+
+struct mantis_hwconfig unknown_device = {
+       .model_name     = MANTIS_MODEL_UNKNOWN,
+       .dev_type       = MANTIS_DEV_UNKNOWN,
+};
+
+static void mantis_load_config(struct mantis_pci *mantis)
+{
+       switch (mantis->subsystem_device) {
+       case MANTIS_VP_1033_DVB_S:      /* VP-1033 */
+               mantis->hwconfig = &vp1033_mantis_config;
+               break;
+       case MANTIS_VP_1034_DVB_S:      /* VP-1034 */
+               mantis->hwconfig = &vp1034_mantis_config;
+               break;
+       case MANTIS_VP_1041_DVB_S2:     /* VP-1041 */
+       case TECHNISAT_SKYSTAR_HD2:
+               mantis->hwconfig = &vp1041_mantis_config;
+               break;
+       case MANTIS_VP_2033_DVB_C:      /* VP-2033 */
+               mantis->hwconfig = &vp2033_mantis_config;
+               break;
+       case MANTIS_VP_2040_DVB_C:      /* VP-2040 */
+       case TERRATEC_CINERGY_C_PCI:    /* VP-2040 clone */
+       case TECHNISAT_CABLESTAR_HD2:
+               mantis->hwconfig = &vp2040_mantis_config;
+               break;
+       case MANTIS_VP_3030_DVB_T:      /* VP-3030 */
+               mantis->hwconfig = &vp3030_mantis_config;
+               break;
+       default:
+               mantis->hwconfig = &unknown_device;
+               break;
+       }
+}
+
+int mantis_core_init(struct mantis_pci *mantis)
+{
+       int err = 0;
+
+       mantis_load_config(mantis);
+       dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
+               mantis->hwconfig->model_name, mantis->hwconfig->dev_type,
+               mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn));
+       dprintk(verbose, MANTIS_ERROR, 0, "    Mantis Rev %d [%04x:%04x], ",
+               mantis->revision,
+               mantis->subsystem_vendor, mantis->subsystem_device);
+       dprintk(verbose, MANTIS_ERROR, 0,
+               "irq: %d, latency: %d\n    memory: 0x%lx, mmio: 0x%p\n",
+               mantis->pdev->irq, mantis->latency,
+               mantis->mantis_addr, mantis->mantis_mmio);
+
+       err = mantis_i2c_init(mantis);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed");
+               return err;
+       }
+       err = get_mac_address(mantis);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed");
+               return err;
+       }
+       err = mantis_dma_init(mantis);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed");
+               return err;
+       }
+       err = mantis_dvb_init(mantis);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB init failed");
+               return err;
+       }
+       err = mantis_uart_init(mantis);
+       if (err < 0) {
+               dprintk(verbose, MANTIS_DEBUG, 1, "Mantis UART init failed");
+               return err;
+       }
+
+       return 0;
+}
+
+int mantis_core_exit(struct mantis_pci *mantis)
+{
+       mantis_dma_stop(mantis);
+       dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
+
+       mantis_uart_exit(mantis);
+       dprintk(verbose, MANTIS_ERROR, 1, "UART exit failed");
+
+       if (mantis_dma_exit(mantis) < 0)
+               dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed");
+       if (mantis_dvb_exit(mantis) < 0)
+               dprintk(verbose, MANTIS_ERROR, 1, "DVB exit failed");
+       if (mantis_i2c_exit(mantis) < 0)
+               dprintk(verbose, MANTIS_ERROR, 1, "I2C adapter delete.. failed");
+
+       return 0;
+}
+
+/* Turn the given bit on or off. */
+void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
+{
+       u32 cur;
+
+       cur = mmread(MANTIS_GPIF_ADDR);
+       if (value)
+               mantis->gpio_status = cur | (1 << bitpos);
+       else
+               mantis->gpio_status = cur & (~(1 << bitpos));
+
+       mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR);
+       mmwrite(0x00, MANTIS_GPIF_DOUT);
+       udelay(100);
+}
+
+/* direction = 0 , no CI passthrough ; 1 , CI passthrough */
+void mantis_set_direction(struct mantis_pci *mantis, int direction)
+{
+       u32 reg;
+
+       reg = mmread(0x28);
+       dprintk(verbose, MANTIS_DEBUG, 1, "TS direction setup");
+       if (direction == 0x01) {
+               /* to CI */
+               reg |= 0x04;
+               mmwrite(reg, 0x28);
+               reg &= 0xff - 0x04;
+               mmwrite(reg, 0x28);
+       } else {
+               reg &= 0xff - 0x04;
+               mmwrite(reg, 0x28);
+               reg |= 0x04;
+               mmwrite(reg, 0x28);
+       }
+}
diff --git a/drivers/media/dvb/mantis/mantis_core.h b/drivers/media/dvb/mantis/mantis_core.h
new file mode 100644 (file)
index 0000000..833ee42
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_CORE_H
+#define __MANTIS_CORE_H
+
+#include "mantis_common.h"
+
+
+#define FE_TYPE_SAT    0
+#define FE_TYPE_CAB    1
+#define FE_TYPE_TER    2
+
+#define FE_TYPE_TS204  0
+#define FE_TYPE_TS188  1
+
+
+struct vendorname {
+       u8  *sub_vendor_name;
+       u32 sub_vendor_id;
+};
+
+struct devicetype {
+       u8  *sub_device_name;
+       u32 sub_device_id;
+       u8  device_type;
+       u32 type_flags;
+};
+
+
+extern int mantis_dma_init(struct mantis_pci *mantis);
+extern int mantis_dma_exit(struct mantis_pci *mantis);
+extern void mantis_dma_start(struct mantis_pci *mantis);
+extern void mantis_dma_stop(struct mantis_pci *mantis);
+extern int mantis_i2c_init(struct mantis_pci *mantis);
+extern int mantis_i2c_exit(struct mantis_pci *mantis);
+extern int mantis_core_init(struct mantis_pci *mantis);
+extern int mantis_core_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_CORE_H */
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
new file mode 100644 (file)
index 0000000..46202a4
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+#include <asm/page.h>
+#include <linux/vmalloc.h>
+#include <linux/pci.h>
+
+#include <asm/irq.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_dma.h"
+
+#define RISC_WRITE             (0x01 << 28)
+#define RISC_JUMP              (0x07 << 28)
+#define RISC_IRQ               (0x01 << 24)
+
+#define RISC_STATUS(status)    ((((~status) & 0x0f) << 20) | ((status & 0x0f) << 16))
+#define RISC_FLUSH()           (mantis->risc_pos = 0)
+#define RISC_INSTR(opcode)     (mantis->risc_cpu[mantis->risc_pos++] = cpu_to_le32(opcode))
+
+#define MANTIS_BUF_SIZE                (64 * 1024)
+#define MANTIS_BLOCK_BYTES     (MANTIS_BUF_SIZE >> 4)
+#define MANTIS_BLOCK_COUNT     (1 << 4)
+#define MANTIS_RISC_SIZE       PAGE_SIZE
+
+int mantis_dma_exit(struct mantis_pci *mantis)
+{
+       if (mantis->buf_cpu) {
+               dprintk(MANTIS_ERROR, 1,
+                       "DMA=0x%lx cpu=0x%p size=%d",
+                       (unsigned long) mantis->buf_dma,
+                        mantis->buf_cpu,
+                        MANTIS_BUF_SIZE);
+
+               pci_free_consistent(mantis->pdev, MANTIS_BUF_SIZE,
+                                   mantis->buf_cpu, mantis->buf_dma);
+
+               mantis->buf_cpu = NULL;
+       }
+       if (mantis->risc_cpu) {
+               dprintk(MANTIS_ERROR, 1,
+                       "RISC=0x%lx cpu=0x%p size=%lx",
+                       (unsigned long) mantis->risc_dma,
+                       mantis->risc_cpu,
+                       MANTIS_RISC_SIZE);
+
+               pci_free_consistent(mantis->pdev, MANTIS_RISC_SIZE,
+                                   mantis->risc_cpu, mantis->risc_dma);
+
+               mantis->risc_cpu = NULL;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_dma_exit);
+
+static inline int mantis_alloc_buffers(struct mantis_pci *mantis)
+{
+       if (!mantis->buf_cpu) {
+               mantis->buf_cpu = pci_alloc_consistent(mantis->pdev,
+                                                      MANTIS_BUF_SIZE,
+                                                      &mantis->buf_dma);
+               if (!mantis->buf_cpu) {
+                       dprintk(MANTIS_ERROR, 1,
+                               "DMA buffer allocation failed");
+
+                       goto err;
+               }
+               dprintk(MANTIS_ERROR, 1,
+                       "DMA=0x%lx cpu=0x%p size=%d",
+                       (unsigned long) mantis->buf_dma,
+                       mantis->buf_cpu, MANTIS_BUF_SIZE);
+       }
+       if (!mantis->risc_cpu) {
+               mantis->risc_cpu = pci_alloc_consistent(mantis->pdev,
+                                                       MANTIS_RISC_SIZE,
+                                                       &mantis->risc_dma);
+
+               if (!mantis->risc_cpu) {
+                       dprintk(MANTIS_ERROR, 1,
+                               "RISC program allocation failed");
+
+                       mantis_dma_exit(mantis);
+
+                       goto err;
+               }
+               dprintk(MANTIS_ERROR, 1,
+                       "RISC=0x%lx cpu=0x%p size=%lx",
+                       (unsigned long) mantis->risc_dma,
+                       mantis->risc_cpu, MANTIS_RISC_SIZE);
+       }
+
+       return 0;
+err:
+       dprintk(MANTIS_ERROR, 1, "Out of memory (?) .....");
+       return -ENOMEM;
+}
+
+static inline int mantis_calc_lines(struct mantis_pci *mantis)
+{
+       mantis->line_bytes = MANTIS_BLOCK_BYTES;
+       mantis->line_count = MANTIS_BLOCK_COUNT;
+
+       while (mantis->line_bytes > 4095) {
+               mantis->line_bytes >>= 1;
+               mantis->line_count <<= 1;
+       }
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis RISC block bytes=[%d], line bytes=[%d], line count=[%d]",
+               MANTIS_BLOCK_BYTES, mantis->line_bytes, mantis->line_count);
+
+       if (mantis->line_count > 255) {
+               dprintk(MANTIS_ERROR, 1, "Buffer size error");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+int mantis_dma_init(struct mantis_pci *mantis)
+{
+       int err = 0;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis DMA init");
+       if (mantis_alloc_buffers(mantis) < 0) {
+               dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer");
+
+               /* Stop RISC Engine */
+               mmwrite(0, MANTIS_DMA_CTL);
+
+               goto err;
+       }
+       err = mantis_calc_lines(mantis);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "Mantis calc lines failed");
+
+               goto err;
+       }
+
+       return 0;
+err:
+       return err;
+}
+EXPORT_SYMBOL_GPL(mantis_dma_init);
+
+static inline void mantis_risc_program(struct mantis_pci *mantis)
+{
+       u32 buf_pos = 0;
+       u32 line;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis create RISC program");
+       RISC_FLUSH();
+
+       dprintk(MANTIS_DEBUG, 1, "risc len lines %u, bytes per line %u",
+               mantis->line_count, mantis->line_bytes);
+
+       for (line = 0; line < mantis->line_count; line++) {
+               dprintk(MANTIS_DEBUG, 1, "RISC PROG line=[%d]", line);
+               if (!(buf_pos % MANTIS_BLOCK_BYTES)) {
+                       RISC_INSTR(RISC_WRITE   |
+                                  RISC_IRQ     |
+                                  RISC_STATUS(((buf_pos / MANTIS_BLOCK_BYTES) +
+                                  (MANTIS_BLOCK_COUNT - 1)) %
+                                   MANTIS_BLOCK_COUNT) |
+                                   mantis->line_bytes);
+               } else {
+                       RISC_INSTR(RISC_WRITE   | mantis->line_bytes);
+               }
+               RISC_INSTR(mantis->buf_dma + buf_pos);
+               buf_pos += mantis->line_bytes;
+       }
+       RISC_INSTR(RISC_JUMP);
+       RISC_INSTR(mantis->risc_dma);
+}
+
+void mantis_dma_start(struct mantis_pci *mantis)
+{
+       dprintk(MANTIS_DEBUG, 1, "Mantis Start DMA engine");
+
+       mantis_risc_program(mantis);
+       mmwrite(mantis->risc_dma, MANTIS_RISC_START);
+       mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
+
+       mmwrite(0, MANTIS_DMA_CTL);
+       mantis->last_block = mantis->finished_block = 0;
+
+       mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_RISCI, MANTIS_INT_MASK);
+
+       mmwrite(MANTIS_FIFO_EN | MANTIS_DCAP_EN
+                              | MANTIS_RISC_EN, MANTIS_DMA_CTL);
+
+}
+
+void mantis_dma_stop(struct mantis_pci *mantis)
+{
+       u32 stat = 0, mask = 0;
+
+       stat = mmread(MANTIS_INT_STAT);
+       mask = mmread(MANTIS_INT_MASK);
+       dprintk(MANTIS_DEBUG, 1, "Mantis Stop DMA engine");
+
+       mmwrite((mmread(MANTIS_GPIF_ADDR) & (~(MANTIS_GPIF_HIFRDWRN))), MANTIS_GPIF_ADDR);
+
+       mmwrite((mmread(MANTIS_DMA_CTL) & ~(MANTIS_FIFO_EN |
+                                           MANTIS_DCAP_EN |
+                                           MANTIS_RISC_EN)), MANTIS_DMA_CTL);
+
+       mmwrite(mmread(MANTIS_INT_STAT), MANTIS_INT_STAT);
+
+       mmwrite(mmread(MANTIS_INT_MASK) & ~(MANTIS_INT_RISCI |
+                                           MANTIS_INT_RISCEN), MANTIS_INT_MASK);
+}
+
+
+void mantis_dma_xfer(unsigned long data)
+{
+       struct mantis_pci *mantis = (struct mantis_pci *) data;
+       struct mantis_hwconfig *config = mantis->hwconfig;
+
+       while (mantis->last_block != mantis->finished_block) {
+               dprintk(MANTIS_DEBUG, 1, "last block=[%d] finished block=[%d]",
+                       mantis->last_block, mantis->finished_block);
+
+               (config->ts_size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)
+               (&mantis->demux, &mantis->buf_cpu[mantis->last_block * MANTIS_BLOCK_BYTES], MANTIS_BLOCK_BYTES);
+               mantis->last_block = (mantis->last_block + 1) % MANTIS_BLOCK_COUNT;
+       }
+}
diff --git a/drivers/media/dvb/mantis/mantis_dma.h b/drivers/media/dvb/mantis/mantis_dma.h
new file mode 100644 (file)
index 0000000..6be00fa
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_DMA_H
+#define __MANTIS_DMA_H
+
+extern int mantis_dma_init(struct mantis_pci *mantis);
+extern int mantis_dma_exit(struct mantis_pci *mantis);
+extern void mantis_dma_start(struct mantis_pci *mantis);
+extern void mantis_dma_stop(struct mantis_pci *mantis);
+extern void mantis_dma_xfer(unsigned long data);
+
+#endif /* __MANTIS_DMA_H */
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
new file mode 100644 (file)
index 0000000..99d82ee
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+       Mantis PCI bridge driver
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/pci.h>
+#include <linux/i2c.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_dma.h"
+#include "mantis_ca.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+int mantis_frontend_power(struct mantis_pci *mantis, enum mantis_power power)
+{
+       struct mantis_hwconfig *config = mantis->hwconfig;
+
+       switch (power) {
+       case POWER_ON:
+               dprintk(MANTIS_DEBUG, 1, "Power ON");
+               gpio_set_bits(mantis, config->power, POWER_ON);
+               msleep(100);
+               gpio_set_bits(mantis, config->power, POWER_ON);
+               msleep(100);
+               break;
+
+       case POWER_OFF:
+               dprintk(MANTIS_DEBUG, 1, "Power OFF");
+               gpio_set_bits(mantis, config->power, POWER_OFF);
+               msleep(100);
+               break;
+
+       default:
+               dprintk(MANTIS_DEBUG, 1, "Unknown state <%02x>", power);
+               return -1;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_frontend_power);
+
+void mantis_frontend_soft_reset(struct mantis_pci *mantis)
+{
+       struct mantis_hwconfig *config = mantis->hwconfig;
+
+       dprintk(MANTIS_DEBUG, 1, "Frontend RESET");
+       gpio_set_bits(mantis, config->reset, 0);
+       msleep(100);
+       gpio_set_bits(mantis, config->reset, 0);
+       msleep(100);
+       gpio_set_bits(mantis, config->reset, 1);
+       msleep(100);
+       gpio_set_bits(mantis, config->reset, 1);
+       msleep(100);
+
+       return;
+}
+EXPORT_SYMBOL_GPL(mantis_frontend_soft_reset);
+
+static int mantis_frontend_shutdown(struct mantis_pci *mantis)
+{
+       int err;
+
+       mantis_frontend_soft_reset(mantis);
+       err = mantis_frontend_power(mantis, POWER_OFF);
+       if (err != 0) {
+               dprintk(MANTIS_ERROR, 1, "Frontend POWER OFF failed! <%d>", err);
+               return 1;
+       }
+
+       return 0;
+}
+
+static int mantis_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+       struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
+       struct mantis_pci *mantis = dvbdmx->priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis DVB Start feed");
+       if (!dvbdmx->dmx.frontend) {
+               dprintk(MANTIS_DEBUG, 1, "no frontend ?");
+               return -EINVAL;
+       }
+
+       mantis->feeds++;
+       dprintk(MANTIS_DEBUG, 1, "mantis start feed, feeds=%d", mantis->feeds);
+
+       if (mantis->feeds == 1)  {
+               dprintk(MANTIS_DEBUG, 1, "mantis start feed & dma");
+               mantis_dma_start(mantis);
+       }
+
+       return mantis->feeds;
+}
+
+static int mantis_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+       struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
+       struct mantis_pci *mantis = dvbdmx->priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis DVB Stop feed");
+       if (!dvbdmx->dmx.frontend) {
+               dprintk(MANTIS_DEBUG, 1, "no frontend ?");
+               return -EINVAL;
+       }
+
+       mantis->feeds--;
+       if (mantis->feeds == 0) {
+               dprintk(MANTIS_DEBUG, 1, "mantis stop feed and dma");
+               mantis_dma_stop(mantis);
+       }
+
+       return 0;
+}
+
+int __devinit mantis_dvb_init(struct mantis_pci *mantis)
+{
+       struct mantis_hwconfig *config = mantis->hwconfig;
+       int result = -1;
+
+       dprintk(MANTIS_DEBUG, 1, "dvb_register_adapter");
+
+       result = dvb_register_adapter(&mantis->dvb_adapter,
+                                     "Mantis DVB adapter",
+                                     THIS_MODULE,
+                                     &mantis->pdev->dev,
+                                     adapter_nr);
+
+       if (result < 0) {
+
+               dprintk(MANTIS_ERROR, 1, "Error registering adapter");
+               return -ENODEV;
+       }
+
+       mantis->dvb_adapter.priv        = mantis;
+       mantis->demux.dmx.capabilities  = DMX_TS_FILTERING      |
+                                        DMX_SECTION_FILTERING  |
+                                        DMX_MEMORY_BASED_FILTERING;
+
+       mantis->demux.priv              = mantis;
+       mantis->demux.filternum         = 256;
+       mantis->demux.feednum           = 256;
+       mantis->demux.start_feed        = mantis_dvb_start_feed;
+       mantis->demux.stop_feed         = mantis_dvb_stop_feed;
+       mantis->demux.write_to_decoder  = NULL;
+
+       dprintk(MANTIS_DEBUG, 1, "dvb_dmx_init");
+       result = dvb_dmx_init(&mantis->demux);
+       if (result < 0) {
+               dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result);
+
+               goto err0;
+       }
+
+       mantis->dmxdev.filternum        = 256;
+       mantis->dmxdev.demux            = &mantis->demux.dmx;
+       mantis->dmxdev.capabilities     = 0;
+       dprintk(MANTIS_DEBUG, 1, "dvb_dmxdev_init");
+
+       result = dvb_dmxdev_init(&mantis->dmxdev, &mantis->dvb_adapter);
+       if (result < 0) {
+
+               dprintk(MANTIS_ERROR, 1, "dvb_dmxdev_init failed, ERROR=%d", result);
+               goto err1;
+       }
+
+       mantis->fe_hw.source            = DMX_FRONTEND_0;
+       result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+       if (result < 0) {
+
+               dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result);
+               goto err2;
+       }
+
+       mantis->fe_mem.source           = DMX_MEMORY_FE;
+       result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, &mantis->fe_mem);
+       if (result < 0) {
+               dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result);
+               goto err3;
+       }
+
+       result = mantis->demux.dmx.connect_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+       if (result < 0) {
+               dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result);
+               goto err4;
+       }
+
+       dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx);
+       tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis);
+       if (mantis->hwconfig) {
+               result = config->frontend_init(mantis, mantis->fe);
+               if (result < 0) {
+                       dprintk(MANTIS_ERROR, 1, "!!! NO Frontends found !!!");
+                       goto err5;
+               } else {
+                       if (mantis->fe == NULL) {
+                               dprintk(MANTIS_ERROR, 1, "FE <NULL>");
+                               goto err5;
+                       }
+
+                       if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) {
+                               dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed");
+
+                               if (mantis->fe->ops.release)
+                                       mantis->fe->ops.release(mantis->fe);
+
+                               mantis->fe = NULL;
+                               goto err5;
+                       }
+               }
+       }
+
+       return 0;
+
+       /* Error conditions ..  */
+err5:
+       tasklet_kill(&mantis->tasklet);
+       dvb_net_release(&mantis->dvbnet);
+       dvb_unregister_frontend(mantis->fe);
+       dvb_frontend_detach(mantis->fe);
+err4:
+       mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem);
+
+err3:
+       mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+
+err2:
+       dvb_dmxdev_release(&mantis->dmxdev);
+
+err1:
+       dvb_dmx_release(&mantis->demux);
+
+err0:
+       dvb_unregister_adapter(&mantis->dvb_adapter);
+
+       return result;
+}
+EXPORT_SYMBOL_GPL(mantis_dvb_init);
+
+int __devexit mantis_dvb_exit(struct mantis_pci *mantis)
+{
+       int err;
+
+       if (mantis->fe) {
+               /* mantis_ca_exit(mantis); */
+               err = mantis_frontend_shutdown(mantis);
+               if (err != 0)
+                       dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err);
+               dvb_unregister_frontend(mantis->fe);
+               dvb_frontend_detach(mantis->fe);
+       }
+
+       tasklet_kill(&mantis->tasklet);
+       dvb_net_release(&mantis->dvbnet);
+
+       mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem);
+       mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+
+       dvb_dmxdev_release(&mantis->dmxdev);
+       dvb_dmx_release(&mantis->demux);
+
+       dprintk(MANTIS_DEBUG, 1, "dvb_unregister_adapter");
+       dvb_unregister_adapter(&mantis->dvb_adapter);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_dvb_exit);
diff --git a/drivers/media/dvb/mantis/mantis_dvb.h b/drivers/media/dvb/mantis/mantis_dvb.h
new file mode 100644 (file)
index 0000000..464199d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_DVB_H
+#define __MANTIS_DVB_H
+
+enum mantis_power {
+       POWER_OFF       = 0,
+       POWER_ON        = 1
+};
+
+extern int mantis_frontend_power(struct mantis_pci *mantis, enum mantis_power power);
+extern void mantis_frontend_soft_reset(struct mantis_pci *mantis);
+
+extern int mantis_dvb_init(struct mantis_pci *mantis);
+extern int mantis_dvb_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_DVB_H */
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
new file mode 100644 (file)
index 0000000..a7b369a
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_link.h"
+#include "mantis_hif.h"
+#include "mantis_reg.h"
+
+static void mantis_hifevm_work(struct work_struct *work)
+{
+       struct mantis_ca *ca = container_of(work, struct mantis_ca, hif_evm_work);
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       u32 gpif_stat, gpif_mask;
+
+       gpif_stat = mmread(MANTIS_GPIF_STATUS);
+       gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
+
+       if (gpif_stat & MANTIS_GPIF_DETSTAT) {
+               if (gpif_stat & MANTIS_CARD_PLUGIN) {
+                       dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
+                       mmwrite(0xdada0000, MANTIS_CARD_RESET);
+                       mantis_event_cam_plugin(ca);
+                       dvb_ca_en50221_camchange_irq(&ca->en50221,
+                                                    0,
+                                                    DVB_CA_EN50221_CAMCHANGE_INSERTED);
+               }
+       } else {
+               if (gpif_stat & MANTIS_CARD_PLUGOUT) {
+                       dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
+                       mmwrite(0xdada0000, MANTIS_CARD_RESET);
+                       mantis_event_cam_unplug(ca);
+                       dvb_ca_en50221_camchange_irq(&ca->en50221,
+                                                    0,
+                                                    DVB_CA_EN50221_CAMCHANGE_REMOVED);
+               }
+       }
+
+       if (mantis->gpif_status & MANTIS_GPIF_EXTIRQ)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
+
+       if (mantis->gpif_status & MANTIS_SBUF_WSTO)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
+
+       if (mantis->gpif_status & MANTIS_GPIF_OTHERR)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
+
+       if (gpif_stat & MANTIS_SBUF_OVFLW)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
+
+       if (gpif_stat & MANTIS_GPIF_BRRDY)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
+
+       if (gpif_stat & MANTIS_GPIF_INTSTAT)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
+
+       if (gpif_stat & MANTIS_SBUF_EMPTY)
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
+
+       if (gpif_stat & MANTIS_SBUF_OPDONE) {
+               dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
+               ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
+               ca->hif_event = MANTIS_SBUF_OPDONE;
+               wake_up(&ca->hif_opdone_wq);
+       }
+}
+
+int mantis_evmgr_init(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
+       INIT_WORK(&ca->hif_evm_work, mantis_hifevm_work);
+       mantis_pcmcia_init(ca);
+       schedule_work(&ca->hif_evm_work);
+       mantis_hif_init(ca);
+       return 0;
+}
+
+void mantis_evmgr_exit(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       dprintk(MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
+       flush_scheduled_work();
+       mantis_hif_exit(ca);
+       mantis_pcmcia_exit(ca);
+}
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
new file mode 100644 (file)
index 0000000..5772ebb
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+
+#include "mantis_hif.h"
+#include "mantis_link.h" /* temporary due to physical layer stuff */
+
+#include "mantis_reg.h"
+
+
+static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       int rc = 0;
+
+       if (wait_event_timeout(ca->hif_opdone_wq,
+                              ca->hif_event & MANTIS_SBUF_OPDONE,
+                              msecs_to_jiffies(500)) == -ERESTARTSYS) {
+
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num);
+               rc = -EREMOTEIO;
+       }
+       dprintk(MANTIS_DEBUG, 1, "Smart Buffer Operation complete");
+       ca->hif_event &= ~MANTIS_SBUF_OPDONE;
+       return rc;
+}
+
+static int mantis_hif_write_wait(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 opdone = 0, timeout = 0;
+       int rc = 0;
+
+       if (wait_event_timeout(ca->hif_write_wq,
+                              mantis->gpif_status & MANTIS_GPIF_WRACK,
+                              msecs_to_jiffies(500)) == -ERESTARTSYS) {
+
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num);
+               rc = -EREMOTEIO;
+       }
+       dprintk(MANTIS_DEBUG, 1, "Write Acknowledged");
+       mantis->gpif_status &= ~MANTIS_GPIF_WRACK;
+       while (!opdone) {
+               opdone = (mmread(MANTIS_GPIF_STATUS) & MANTIS_SBUF_OPDONE);
+               udelay(500);
+               timeout++;
+               if (timeout > 100) {
+                       dprintk(MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num);
+                       rc = -ETIMEDOUT;
+                       break;
+               }
+       }
+       dprintk(MANTIS_DEBUG, 1, "HIF Write success");
+       return rc;
+}
+
+
+int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 hif_addr = 0, data, count = 4;
+
+       dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num);
+       mutex_lock(&ca->ca_lock);
+       hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+       hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
+       hif_addr |=  MANTIS_HIF_STATUS;
+       hif_addr |=  addr;
+
+       mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
+       mmwrite(count, MANTIS_GPIF_BRBYTES);
+       udelay(20);
+       mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
+
+       if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
+               mutex_unlock(&ca->ca_lock);
+               return -EREMOTEIO;
+       }
+       data = mmread(MANTIS_GPIF_DIN);
+       mutex_unlock(&ca->ca_lock);
+       dprintk(MANTIS_DEBUG, 1, "Mem Read: 0x%02x", data);
+       return (data >> 24) & 0xff;
+}
+
+int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
+{
+       struct mantis_slot *slot = ca->slot;
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 hif_addr = 0;
+
+       dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Write", mantis->num);
+       mutex_lock(&ca->ca_lock);
+       hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
+       hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+       hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
+       hif_addr |=  MANTIS_HIF_STATUS;
+       hif_addr |=  addr;
+
+       mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
+       mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+       mmwrite(data, MANTIS_GPIF_DOUT);
+
+       if (mantis_hif_write_wait(ca) != 0) {
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+               mutex_unlock(&ca->ca_lock);
+               return -EREMOTEIO;
+       }
+       dprintk(MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr);
+       mutex_unlock(&ca->ca_lock);
+
+       return 0;
+}
+
+int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 data, hif_addr = 0;
+
+       dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num);
+       mutex_lock(&ca->ca_lock);
+       hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+       hif_addr |=  MANTIS_GPIF_PCMCIAIOM;
+       hif_addr |=  MANTIS_HIF_STATUS;
+       hif_addr |=  addr;
+
+       mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
+       mmwrite(1, MANTIS_GPIF_BRBYTES);
+       udelay(20);
+       mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
+
+       if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+               mutex_unlock(&ca->ca_lock);
+               return -EREMOTEIO;
+       }
+       data = mmread(MANTIS_GPIF_DIN);
+       dprintk(MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data);
+       udelay(50);
+       mutex_unlock(&ca->ca_lock);
+
+       return (u8) data;
+}
+
+int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 hif_addr = 0;
+
+       dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Write", mantis->num);
+       mutex_lock(&ca->ca_lock);
+       hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+       hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
+       hif_addr |=  MANTIS_GPIF_PCMCIAIOM;
+       hif_addr |=  MANTIS_HIF_STATUS;
+       hif_addr |=  addr;
+
+       mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+       mmwrite(data, MANTIS_GPIF_DOUT);
+
+       if (mantis_hif_write_wait(ca) != 0) {
+               dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+               mutex_unlock(&ca->ca_lock);
+               return -EREMOTEIO;
+       }
+       dprintk(MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr);
+       mutex_unlock(&ca->ca_lock);
+       udelay(50);
+
+       return 0;
+}
+
+int mantis_hif_init(struct mantis_ca *ca)
+{
+       struct mantis_slot *slot = ca->slot;
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 irqcfg;
+
+       slot[0].slave_cfg = 0x70773028;
+       dprintk(MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
+
+       mutex_lock(&ca->ca_lock);
+       irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+       irqcfg = MANTIS_MASK_BRRDY      |
+                MANTIS_MASK_WRACK      |
+                MANTIS_MASK_EXTIRQ     |
+                MANTIS_MASK_WSTO       |
+                MANTIS_MASK_OTHERR     |
+                MANTIS_MASK_OVFLW;
+
+       mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+       mutex_unlock(&ca->ca_lock);
+
+       return 0;
+}
+
+void mantis_hif_exit(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+       u32 irqcfg;
+
+       dprintk(MANTIS_ERROR, 1, "Adapter(%d) Exiting Mantis Host Interface", mantis->num);
+       mutex_lock(&ca->ca_lock);
+       irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+       irqcfg &= ~MANTIS_MASK_BRRDY;
+       mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+       mutex_unlock(&ca->ca_lock);
+}
diff --git a/drivers/media/dvb/mantis/mantis_hif.h b/drivers/media/dvb/mantis/mantis_hif.h
new file mode 100644 (file)
index 0000000..9094f9e
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_HIF_H
+#define __MANTIS_HIF_H
+
+#define MANTIS_HIF_MEMRD               1
+#define MANTIS_HIF_MEMWR               2
+#define MANTIS_HIF_IOMRD               3
+#define MANTIS_HIF_IOMWR               4
+
+#endif /* __MANTIS_HIF_H */
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
new file mode 100644 (file)
index 0000000..7870bcf
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <asm/io.h>
+#include <linux/ioport.h>
+#include <linux/pci.h>
+#include <linux/i2c.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_i2c.h"
+
+#define TRIALS                 10000
+
+static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
+{
+       u32 rxd, i, stat, trials;
+
+       dprintk(MANTIS_INFO, 0, "        %s:  Address=[0x%02x] <R>[ ",
+               __func__, msg->addr);
+
+       for (i = 0; i < msg->len; i++) {
+               rxd = (msg->addr << 25) | (1 << 24)
+                                       | MANTIS_I2C_RATE_3
+                                       | MANTIS_I2C_STOP
+                                       | MANTIS_I2C_PGMODE;
+
+               if (i == (msg->len - 1))
+                       rxd &= ~MANTIS_I2C_STOP;
+
+               mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
+               mmwrite(rxd, MANTIS_I2CDATA_CTL);
+
+               /* wait for xfer completion */
+               for (trials = 0; trials < TRIALS; trials++) {
+                       stat = mmread(MANTIS_INT_STAT);
+                       if (stat & MANTIS_INT_I2CDONE)
+                               break;
+               }
+
+               dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+               /* wait for xfer completion */
+               for (trials = 0; trials < TRIALS; trials++) {
+                       stat = mmread(MANTIS_INT_STAT);
+                       if (stat & MANTIS_INT_I2CRACK)
+                               break;
+               }
+
+               dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
+
+               rxd = mmread(MANTIS_I2CDATA_CTL);
+               msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
+               dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
+       }
+       dprintk(MANTIS_INFO, 0, "]\n");
+
+       return 0;
+}
+
+static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg)
+{
+       int i;
+       u32 txd = 0, stat, trials;
+
+       dprintk(MANTIS_INFO, 0, "        %s: Address=[0x%02x] <W>[ ",
+               __func__, msg->addr);
+
+       for (i = 0; i < msg->len; i++) {
+               dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
+               txd = (msg->addr << 25) | (msg->buf[i] << 8)
+                                       | MANTIS_I2C_RATE_3
+                                       | MANTIS_I2C_STOP
+                                       | MANTIS_I2C_PGMODE;
+
+               if (i == (msg->len - 1))
+                       txd &= ~MANTIS_I2C_STOP;
+
+               mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
+               mmwrite(txd, MANTIS_I2CDATA_CTL);
+
+               /* wait for xfer completion */
+               for (trials = 0; trials < TRIALS; trials++) {
+                       stat = mmread(MANTIS_INT_STAT);
+                       if (stat & MANTIS_INT_I2CDONE)
+                               break;
+               }
+
+               dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+               /* wait for xfer completion */
+               for (trials = 0; trials < TRIALS; trials++) {
+                       stat = mmread(MANTIS_INT_STAT);
+                       if (stat & MANTIS_INT_I2CRACK)
+                               break;
+               }
+
+               dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
+       }
+       dprintk(MANTIS_INFO, 0, "]\n");
+
+       return 0;
+}
+
+static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
+{
+       int ret = 0, i = 0, trials;
+       u32 stat, data, txd;
+       struct mantis_pci *mantis;
+       struct mantis_hwconfig *config;
+
+       mantis = i2c_get_adapdata(adapter);
+       BUG_ON(!mantis);
+       config = mantis->hwconfig;
+       BUG_ON(!config);
+
+       dprintk(MANTIS_DEBUG, 1, "Messages:%d", num);
+       mutex_lock(&mantis->i2c_lock);
+
+       while (i < num) {
+               /* Byte MODE */
+               if ((config->i2c_mode & MANTIS_BYTE_MODE) &&
+                   ((i + 1) < num)                     &&
+                   (msgs[i].len < 2)                   &&
+                   (msgs[i + 1].len < 2)               &&
+                   (msgs[i + 1].flags & I2C_M_RD)) {
+
+                       dprintk(MANTIS_DEBUG, 0, "        Byte MODE:\n");
+
+                       /* Read operation */
+                       txd = msgs[i].addr << 25 | (0x1 << 24)
+                                                | (msgs[i].buf[0] << 16)
+                                                | MANTIS_I2C_RATE_3;
+
+                       mmwrite(txd, MANTIS_I2CDATA_CTL);
+                       /* wait for xfer completion */
+                       for (trials = 0; trials < TRIALS; trials++) {
+                               stat = mmread(MANTIS_INT_STAT);
+                               if (stat & MANTIS_INT_I2CDONE)
+                                       break;
+                       }
+
+                       /* check for xfer completion */
+                       if (stat & MANTIS_INT_I2CDONE) {
+                               /* check xfer was acknowledged */
+                               if (stat & MANTIS_INT_I2CRACK) {
+                                       data = mmread(MANTIS_I2CDATA_CTL);
+                                       msgs[i + 1].buf[0] = (data >> 8) & 0xff;
+                                       dprintk(MANTIS_DEBUG, 0, "        Byte <%d> RXD=0x%02x  [%02x]\n", 0x0, data, msgs[i + 1].buf[0]);
+                               } else {
+                                       /* I/O error */
+                                       dprintk(MANTIS_ERROR, 1, "        I/O error, LINE:%d", __LINE__);
+                                       ret = -EIO;
+                                       break;
+                               }
+                       } else {
+                               /* I/O error */
+                               dprintk(MANTIS_ERROR, 1, "        I/O error, LINE:%d", __LINE__);
+                               ret = -EIO;
+                               break;
+                       }
+                       i += 2; /* Write/Read operation in one go */
+               }
+
+               if (i < num) {
+                       if (msgs[i].flags & I2C_M_RD)
+                               ret = mantis_i2c_read(mantis, &msgs[i]);
+                       else
+                               ret = mantis_i2c_write(mantis, &msgs[i]);
+
+                       i++;
+                       if (ret < 0)
+                               goto bail_out;
+               }
+
+       }
+
+       mutex_unlock(&mantis->i2c_lock);
+
+       return num;
+
+bail_out:
+       mutex_unlock(&mantis->i2c_lock);
+       return ret;
+}
+
+static u32 mantis_i2c_func(struct i2c_adapter *adapter)
+{
+       return I2C_FUNC_SMBUS_EMUL;
+}
+
+static struct i2c_algorithm mantis_algo = {
+       .master_xfer            = mantis_i2c_xfer,
+       .functionality          = mantis_i2c_func,
+};
+
+int __devinit mantis_i2c_init(struct mantis_pci *mantis)
+{
+       u32 intstat, intmask;
+       struct i2c_adapter *i2c_adapter = &mantis->adapter;
+       struct pci_dev *pdev            = mantis->pdev;
+
+       init_waitqueue_head(&mantis->i2c_wq);
+       mutex_init(&mantis->i2c_lock);
+       strncpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name));
+       i2c_set_adapdata(i2c_adapter, mantis);
+
+       i2c_adapter->owner      = THIS_MODULE;
+       i2c_adapter->class      = I2C_CLASS_TV_DIGITAL;
+       i2c_adapter->algo       = &mantis_algo;
+       i2c_adapter->algo_data  = NULL;
+       i2c_adapter->timeout    = 500;
+       i2c_adapter->retries    = 3;
+       i2c_adapter->dev.parent = &pdev->dev;
+
+       mantis->i2c_rc          = i2c_add_adapter(i2c_adapter);
+       if (mantis->i2c_rc < 0)
+               return mantis->i2c_rc;
+
+       dprintk(MANTIS_DEBUG, 1, "Initializing I2C ..");
+
+       intstat = mmread(MANTIS_INT_STAT);
+       intmask = mmread(MANTIS_INT_MASK);
+       mmwrite(intstat, MANTIS_INT_STAT);
+       dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt");
+       intmask = mmread(MANTIS_INT_MASK);
+       mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_i2c_init);
+
+int mantis_i2c_exit(struct mantis_pci *mantis)
+{
+       u32 intmask;
+
+       dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt");
+       intmask = mmread(MANTIS_INT_MASK);
+       mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK);
+
+       dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter");
+       return i2c_del_adapter(&mantis->adapter);
+}
+EXPORT_SYMBOL_GPL(mantis_i2c_exit);
diff --git a/drivers/media/dvb/mantis/mantis_i2c.h b/drivers/media/dvb/mantis/mantis_i2c.h
new file mode 100644 (file)
index 0000000..1342df2
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_I2C_H
+#define __MANTIS_I2C_H
+
+#define I2C_STOP               (1 <<  0)
+#define I2C_READ               (1 <<  1)
+
+extern int mantis_i2c_init(struct mantis_pci *mantis);
+extern int mantis_i2c_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_I2C_H */
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c
new file mode 100644 (file)
index 0000000..4675a3b
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/input.h>
+#include <media/ir-common.h>
+#include <linux/pci.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_uart.h"
+
+static struct ir_scancode mantis_ir_table[] = {
+       { 0x29, KEY_POWER       },
+       { 0x28, KEY_FAVORITES   },
+       { 0x30, KEY_TEXT        },
+       { 0x17, KEY_INFO        }, /* Preview */
+       { 0x23, KEY_EPG         },
+       { 0x3b, KEY_F22         }, /* Record List */
+       { 0x3c, KEY_1           },
+       { 0x3e, KEY_2           },
+       { 0x39, KEY_3           },
+       { 0x36, KEY_4           },
+       { 0x22, KEY_5           },
+       { 0x20, KEY_6           },
+       { 0x32, KEY_7           },
+       { 0x26, KEY_8           },
+       { 0x24, KEY_9           },
+       { 0x2a, KEY_0           },
+
+       { 0x33, KEY_CANCEL      },
+       { 0x2c, KEY_BACK        },
+       { 0x15, KEY_CLEAR       },
+       { 0x3f, KEY_TAB         },
+       { 0x10, KEY_ENTER       },
+       { 0x14, KEY_UP          },
+       { 0x0d, KEY_RIGHT       },
+       { 0x0e, KEY_DOWN        },
+       { 0x11, KEY_LEFT        },
+
+       { 0x21, KEY_VOLUMEUP    },
+       { 0x35, KEY_VOLUMEDOWN  },
+       { 0x3d, KEY_CHANNELDOWN },
+       { 0x3a, KEY_CHANNELUP   },
+       { 0x2e, KEY_RECORD      },
+       { 0x2b, KEY_PLAY        },
+       { 0x13, KEY_PAUSE       },
+       { 0x25, KEY_STOP        },
+
+       { 0x1f, KEY_REWIND      },
+       { 0x2d, KEY_FASTFORWARD },
+       { 0x1e, KEY_PREVIOUS    }, /* Replay |< */
+       { 0x1d, KEY_NEXT        }, /* Skip   >| */
+
+       { 0x0b, KEY_CAMERA      }, /* Capture */
+       { 0x0f, KEY_LANGUAGE    }, /* SAP */
+       { 0x18, KEY_MODE        }, /* PIP */
+       { 0x12, KEY_ZOOM        }, /* Full screen */
+       { 0x1c, KEY_SUBTITLE    },
+       { 0x2f, KEY_MUTE        },
+       { 0x16, KEY_F20         }, /* L/R */
+       { 0x38, KEY_F21         }, /* Hibernate */
+
+       { 0x37, KEY_SWITCHVIDEOMODE }, /* A/V */
+       { 0x31, KEY_AGAIN       }, /* Recall */
+       { 0x1a, KEY_KPPLUS      }, /* Zoom+ */
+       { 0x19, KEY_KPMINUS     }, /* Zoom- */
+       { 0x27, KEY_RED         },
+       { 0x0C, KEY_GREEN       },
+       { 0x01, KEY_YELLOW      },
+       { 0x00, KEY_BLUE        },
+};
+
+struct ir_scancode_table ir_mantis = {
+       .scan = mantis_ir_table,
+       .size = ARRAY_SIZE(mantis_ir_table),
+};
+EXPORT_SYMBOL_GPL(ir_mantis);
+
+int mantis_input_init(struct mantis_pci *mantis)
+{
+       struct input_dev *rc;
+       struct ir_input_state rc_state;
+       char name[80], dev[80];
+       int err;
+
+       rc = input_allocate_device();
+       if (!rc) {
+               dprintk(MANTIS_ERROR, 1, "Input device allocate failed");
+               return -ENOMEM;
+       }
+
+       sprintf(name, "Mantis %s IR receiver", mantis->hwconfig->model_name);
+       sprintf(dev, "pci-%s/ir0", pci_name(mantis->pdev));
+
+       rc->name = name;
+       rc->phys = dev;
+
+       ir_input_init(rc, &rc_state, IR_TYPE_OTHER);
+
+       rc->id.bustype  = BUS_PCI;
+       rc->id.vendor   = mantis->vendor_id;
+       rc->id.product  = mantis->device_id;
+       rc->id.version  = 1;
+       rc->dev         = mantis->pdev->dev;
+
+       err = ir_input_register(rc, &ir_mantis, NULL);
+       if (err) {
+               dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
+               input_free_device(rc);
+               return -ENODEV;
+       }
+
+       mantis->rc = rc;
+
+       return 0;
+}
+
+int mantis_exit(struct mantis_pci *mantis)
+{
+       struct input_dev *rc = mantis->rc;
+
+       ir_input_unregister(rc);
+
+       return 0;
+}
diff --git a/drivers/media/dvb/mantis/mantis_ioc.c b/drivers/media/dvb/mantis/mantis_ioc.c
new file mode 100644 (file)
index 0000000..de148de
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+#include <linux/i2c.h>
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_ioc.h"
+
+static int read_eeprom_bytes(struct mantis_pci *mantis, u8 reg, u8 *data, u8 length)
+{
+       struct i2c_adapter *adapter = &mantis->adapter;
+       int err;
+       u8 buf = reg;
+
+       struct i2c_msg msg[] = {
+               { .addr = 0x50, .flags = 0, .buf = &buf, .len = 1 },
+               { .addr = 0x50, .flags = I2C_M_RD, .buf = data, .len = length },
+       };
+
+       err = i2c_transfer(adapter, msg, 2);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >",
+                       err, data[0], data[1]);
+
+               return err;
+       }
+
+       return 0;
+}
+int mantis_get_mac(struct mantis_pci *mantis)
+{
+       int err;
+       u8 mac_addr[6] = {0};
+
+       err = read_eeprom_bytes(mantis, 0x08, mac_addr, 6);
+       if (err < 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Mantis EEPROM read error <%d>", err);
+
+               return err;
+       }
+
+       dprintk(MANTIS_ERROR, 0,
+               "    MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
+               mac_addr[0],
+               mac_addr[1],
+               mac_addr[2],
+               mac_addr[3],
+               mac_addr[4],
+               mac_addr[5]);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_get_mac);
+
+/* Turn the given bit on or off. */
+void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
+{
+       u32 cur;
+
+       dprintk(MANTIS_DEBUG, 1, "Set Bit <%d> to <%d>", bitpos, value);
+       cur = mmread(MANTIS_GPIF_ADDR);
+       if (value)
+               mantis->gpio_status = cur | (1 << bitpos);
+       else
+               mantis->gpio_status = cur & (~(1 << bitpos));
+
+       dprintk(MANTIS_DEBUG, 1, "GPIO Value <%02x>", mantis->gpio_status);
+       mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR);
+       mmwrite(0x00, MANTIS_GPIF_DOUT);
+}
+EXPORT_SYMBOL_GPL(gpio_set_bits);
+
+int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl)
+{
+       u32 reg;
+
+       reg = mmread(MANTIS_CONTROL);
+       switch (stream_ctl) {
+       case STREAM_TO_HIF:
+               dprintk(MANTIS_DEBUG, 1, "Set stream to HIF");
+               reg &= 0xff - MANTIS_BYPASS;
+               mmwrite(reg, MANTIS_CONTROL);
+               reg |= MANTIS_BYPASS;
+               mmwrite(reg, MANTIS_CONTROL);
+               break;
+
+       case STREAM_TO_CAM:
+               dprintk(MANTIS_DEBUG, 1, "Set stream to CAM");
+               reg |= MANTIS_BYPASS;
+               mmwrite(reg, MANTIS_CONTROL);
+               reg &= 0xff - MANTIS_BYPASS;
+               mmwrite(reg, MANTIS_CONTROL);
+               break;
+       default:
+               dprintk(MANTIS_ERROR, 1, "Unknown MODE <%02x>", stream_ctl);
+               return -1;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_stream_control);
diff --git a/drivers/media/dvb/mantis/mantis_ioc.h b/drivers/media/dvb/mantis/mantis_ioc.h
new file mode 100644 (file)
index 0000000..188fe5a
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_IOC_H
+#define __MANTIS_IOC_H
+
+#define GPIF_A00               0x00
+#define GPIF_A01               0x01
+#define GPIF_A02               0x02
+#define GPIF_A03               0x03
+#define GPIF_A04               0x04
+#define GPIF_A05               0x05
+#define GPIF_A06               0x06
+#define GPIF_A07               0x07
+#define GPIF_A08               0x08
+#define GPIF_A09               0x09
+#define GPIF_A10               0x0a
+#define GPIF_A11               0x0b
+
+#define GPIF_A12               0x0c
+#define GPIF_A13               0x0d
+#define GPIF_A14               0x0e
+
+enum mantis_stream_control {
+       STREAM_TO_HIF = 0,
+       STREAM_TO_CAM
+};
+
+extern int mantis_get_mac(struct mantis_pci *mantis);
+extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
+
+extern int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl);
+
+#endif /* __MANTIS_IOC_H */
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
new file mode 100644 (file)
index 0000000..2a81477
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_LINK_H
+#define __MANTIS_LINK_H
+
+#include <linux/mutex.h>
+#include <linux/workqueue.h>
+#include "dvb_ca_en50221.h"
+
+enum mantis_sbuf_status {
+       MANTIS_SBUF_DATA_AVAIL          = 1,
+       MANTIS_SBUF_DATA_EMPTY          = 2,
+       MANTIS_SBUF_DATA_OVFLW          = 3
+};
+
+struct mantis_slot {
+       u32                             timeout;
+       u32                             slave_cfg;
+       u32                             bar;
+};
+
+/* Physical layer */
+enum mantis_slot_state {
+       MODULE_INSERTED                 = 3,
+       MODULE_XTRACTED                 = 4
+};
+
+struct mantis_ca {
+       struct mantis_slot              slot[4];
+
+       struct work_struct              hif_evm_work;
+
+       u32                             hif_event;
+       wait_queue_head_t               hif_opdone_wq;
+       wait_queue_head_t               hif_brrdyw_wq;
+       wait_queue_head_t               hif_data_wq;
+       wait_queue_head_t               hif_write_wq; /* HIF Write op */
+
+       enum mantis_sbuf_status         sbuf_status;
+
+       enum mantis_slot_state          slot_state;
+
+       void                            *ca_priv;
+
+       struct dvb_ca_en50221           en50221;
+       struct mutex                    ca_lock;
+};
+
+/* CA */
+extern void mantis_event_cam_plugin(struct mantis_ca *ca);
+extern void mantis_event_cam_unplug(struct mantis_ca *ca);
+extern int mantis_pcmcia_init(struct mantis_ca *ca);
+extern void mantis_pcmcia_exit(struct mantis_ca *ca);
+extern int mantis_evmgr_init(struct mantis_ca *ca);
+extern void mantis_evmgr_exit(struct mantis_ca *ca);
+
+/* HIF */
+extern int mantis_hif_init(struct mantis_ca *ca);
+extern void mantis_hif_exit(struct mantis_ca *ca);
+extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
+extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
+extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr);
+extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data);
+
+#endif /* __MANTIS_LINK_H */
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
new file mode 100644 (file)
index 0000000..59feeb8
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <linux/kmod.h>
+#include <linux/vmalloc.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/pci.h>
+
+#include <asm/irq.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_pci.h"
+
+#define DRIVER_NAME            "Mantis Core"
+
+int __devinit mantis_pci_init(struct mantis_pci *mantis)
+{
+       u8 revision, latency;
+       struct mantis_hwconfig *config  = mantis->hwconfig;
+       struct pci_dev *pdev            = mantis->pdev;
+       int err, ret = 0;
+
+       dprintk(MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
+               config->model_name,
+               config->dev_type,
+               mantis->pdev->bus->number,
+               PCI_SLOT(mantis->pdev->devfn),
+               PCI_FUNC(mantis->pdev->devfn));
+
+       err = pci_enable_device(pdev);
+       if (err != 0) {
+               ret = -ENODEV;
+               dprintk(MANTIS_ERROR, 1, "ERROR: PCI enable failed <%i>", err);
+               goto fail0;
+       }
+
+       err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+       if (err != 0) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: Unable to obtain 32 bit DMA <%i>", err);
+               ret = -ENOMEM;
+               goto fail1;
+       }
+
+       pci_set_master(pdev);
+
+       if (!request_mem_region(pci_resource_start(pdev, 0),
+                               pci_resource_len(pdev, 0),
+                               DRIVER_NAME)) {
+
+               dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 Request failed !");
+               ret = -ENODEV;
+               goto fail1;
+       }
+
+       mantis->mmio = ioremap(pci_resource_start(pdev, 0),
+                              pci_resource_len(pdev, 0));
+
+       if (!mantis->mmio) {
+               dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 remap failed !");
+               ret = -ENODEV;
+               goto fail2;
+       }
+
+       pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
+       pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
+       mantis->latency = latency;
+       mantis->revision = revision;
+
+       dprintk(MANTIS_ERROR, 0, "    Mantis Rev %d [%04x:%04x], ",
+               mantis->revision,
+               mantis->pdev->subsystem_vendor,
+               mantis->pdev->subsystem_device);
+
+       dprintk(MANTIS_ERROR, 0,
+               "irq: %d, latency: %d\n    memory: 0x%lx, mmio: 0x%p\n",
+               mantis->pdev->irq,
+               mantis->latency,
+               mantis->mantis_addr,
+               mantis->mmio);
+
+       err = request_irq(pdev->irq,
+                         config->irq_handler,
+                         IRQF_SHARED,
+                         DRIVER_NAME,
+                         mantis);
+
+       if (err != 0) {
+
+               dprintk(MANTIS_ERROR, 1, "ERROR: IRQ registration failed ! <%d>", err);
+               ret = -ENODEV;
+               goto fail3;
+       }
+
+       pci_set_drvdata(pdev, mantis);
+       return ret;
+
+       /* Error conditions */
+fail3:
+       dprintk(MANTIS_ERROR, 1, "ERROR: <%d> I/O unmap", ret);
+       if (mantis->mmio)
+               iounmap(mantis->mmio);
+
+fail2:
+       dprintk(MANTIS_ERROR, 1, "ERROR: <%d> releasing regions", ret);
+       release_mem_region(pci_resource_start(pdev, 0),
+                          pci_resource_len(pdev, 0));
+
+fail1:
+       dprintk(MANTIS_ERROR, 1, "ERROR: <%d> disabling device", ret);
+       pci_disable_device(pdev);
+
+fail0:
+       dprintk(MANTIS_ERROR, 1, "ERROR: <%d> exiting", ret);
+       pci_set_drvdata(pdev, NULL);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(mantis_pci_init);
+
+void mantis_pci_exit(struct mantis_pci *mantis)
+{
+       struct pci_dev *pdev = mantis->pdev;
+
+       dprintk(MANTIS_NOTICE, 1, " mem: 0x%p", mantis->mmio);
+       free_irq(pdev->irq, mantis);
+       if (mantis->mmio) {
+               iounmap(mantis->mmio);
+               release_mem_region(pci_resource_start(pdev, 0),
+                                  pci_resource_len(pdev, 0));
+       }
+
+       pci_disable_device(pdev);
+       pci_set_drvdata(pdev, NULL);
+}
+EXPORT_SYMBOL_GPL(mantis_pci_exit);
+
+MODULE_DESCRIPTION("Mantis PCI DTV bridge driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/mantis/mantis_pci.h b/drivers/media/dvb/mantis/mantis_pci.h
new file mode 100644 (file)
index 0000000..65f0045
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_PCI_H
+#define __MANTIS_PCI_H
+
+extern int mantis_pci_init(struct mantis_pci *mantis);
+extern void mantis_pci_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_PCI_H */
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
new file mode 100644 (file)
index 0000000..5cb545b
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_link.h" /* temporary due to physical layer stuff */
+#include "mantis_reg.h"
+
+/*
+ * If Slot state is already PLUG_IN event and we are called
+ * again, definitely it is jitter alone
+ */
+void mantis_event_cam_plugin(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       u32 gpif_irqcfg;
+
+       if (ca->slot_state == MODULE_XTRACTED) {
+               dprintk(MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
+               udelay(50);
+               mmwrite(0xda000000, MANTIS_CARD_RESET);
+               gpif_irqcfg  = mmread(MANTIS_GPIF_IRQCFG);
+               gpif_irqcfg |= MANTIS_MASK_PLUGOUT;
+               gpif_irqcfg &= ~MANTIS_MASK_PLUGIN;
+               mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
+               udelay(500);
+               ca->slot_state = MODULE_INSERTED;
+       }
+       udelay(100);
+}
+
+/*
+ * If Slot state is already UN_PLUG event and we are called
+ * again, definitely it is jitter alone
+ */
+void mantis_event_cam_unplug(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       u32 gpif_irqcfg;
+
+       if (ca->slot_state == MODULE_INSERTED) {
+               dprintk(MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
+               udelay(50);
+               mmwrite(0x00da0000, MANTIS_CARD_RESET);
+               gpif_irqcfg  = mmread(MANTIS_GPIF_IRQCFG);
+               gpif_irqcfg |= MANTIS_MASK_PLUGIN;
+               gpif_irqcfg &= ~MANTIS_MASK_PLUGOUT;
+               mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
+               udelay(500);
+               ca->slot_state = MODULE_XTRACTED;
+       }
+       udelay(100);
+}
+
+int mantis_pcmcia_init(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       u32 gpif_stat, card_stat;
+
+       mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ0, MANTIS_INT_MASK);
+       gpif_stat = mmread(MANTIS_GPIF_STATUS);
+       card_stat = mmread(MANTIS_GPIF_IRQCFG);
+
+       if (gpif_stat & MANTIS_GPIF_DETSTAT) {
+               dprintk(MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
+               mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
+               ca->slot_state = MODULE_INSERTED;
+               dvb_ca_en50221_camchange_irq(&ca->en50221,
+                                            0,
+                                            DVB_CA_EN50221_CAMCHANGE_INSERTED);
+       } else {
+               dprintk(MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
+               mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
+               ca->slot_state = MODULE_XTRACTED;
+               dvb_ca_en50221_camchange_irq(&ca->en50221,
+                                            0,
+                                            DVB_CA_EN50221_CAMCHANGE_REMOVED);
+       }
+
+       return 0;
+}
+
+void mantis_pcmcia_exit(struct mantis_ca *ca)
+{
+       struct mantis_pci *mantis = ca->ca_priv;
+
+       mmwrite(mmread(MANTIS_GPIF_STATUS) & (~MANTIS_CARD_PLUGOUT | ~MANTIS_CARD_PLUGIN), MANTIS_GPIF_STATUS);
+       mmwrite(mmread(MANTIS_INT_MASK) & ~MANTIS_INT_IRQ0, MANTIS_INT_MASK);
+}
diff --git a/drivers/media/dvb/mantis/mantis_reg.h b/drivers/media/dvb/mantis/mantis_reg.h
new file mode 100644 (file)
index 0000000..7761f9d
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_REG_H
+#define __MANTIS_REG_H
+
+/* Interrupts */
+#define MANTIS_INT_STAT                        0x00
+#define MANTIS_INT_MASK                        0x04
+
+#define MANTIS_INT_RISCSTAT            (0x0f << 28)
+#define MANTIS_INT_RISCEN              (0x01 << 27)
+#define MANTIS_INT_I2CRACK             (0x01 << 26)
+
+/* #define MANTIS_INT_GPIF                     (0xff << 12) */
+
+#define MANTIS_INT_PCMCIA7             (0x01 << 19)
+#define MANTIS_INT_PCMCIA6             (0x01 << 18)
+#define MANTIS_INT_PCMCIA5             (0x01 << 17)
+#define MANTIS_INT_PCMCIA4             (0x01 << 16)
+#define MANTIS_INT_PCMCIA3             (0x01 << 15)
+#define MANTIS_INT_PCMCIA2             (0x01 << 14)
+#define MANTIS_INT_PCMCIA1             (0x01 << 13)
+#define MANTIS_INT_PCMCIA0             (0x01 << 12)
+#define MANTIS_INT_IRQ1                        (0x01 << 11)
+#define MANTIS_INT_IRQ0                        (0x01 << 10)
+#define MANTIS_INT_OCERR               (0x01 <<  8)
+#define MANTIS_INT_PABORT              (0x01 <<  7)
+#define MANTIS_INT_RIPERR              (0x01 <<  6)
+#define MANTIS_INT_PPERR               (0x01 <<  5)
+#define MANTIS_INT_FTRGT               (0x01 <<  3)
+#define MANTIS_INT_RISCI               (0x01 <<  1)
+#define MANTIS_INT_I2CDONE             (0x01 <<  0)
+
+/* DMA */
+#define MANTIS_DMA_CTL                 0x08
+#define MANTIS_GPIF_RD                 (0xff << 24)
+#define MANTIS_GPIF_WR                 (0xff << 16)
+#define MANTIS_CPU_DO                  (0x01 << 10)
+#define MANTIS_DRV_DO                  (0x01 <<  9)
+#define        MANTIS_I2C_RD                   (0x01 <<  7)
+#define MANTIS_I2C_WR                  (0x01 <<  6)
+#define MANTIS_DCAP_MODE               (0x01 <<  5)
+#define MANTIS_FIFO_TP_4               (0x00 <<  3)
+#define MANTIS_FIFO_TP_8               (0x01 <<  3)
+#define MANTIS_FIFO_TP_16              (0x02 <<  3)
+#define MANTIS_FIFO_EN                 (0x01 <<  2)
+#define MANTIS_DCAP_EN                 (0x01 <<  1)
+#define MANTIS_RISC_EN                 (0x01 <<  0)
+
+/* DEBUG */
+#define MANTIS_DEBUGREG                        0x0c
+#define MANTIS_DATINV                  (0x0e <<  7)
+#define MANTIS_TOP_DEBUGSEL            (0x07 <<  4)
+#define MANTIS_PCMCIA_DEBUGSEL         (0x0f <<  0)
+
+#define MANTIS_RISC_START              0x10
+#define MANTIS_RISC_PC                 0x14
+
+/* I2C */
+#define MANTIS_I2CDATA_CTL             0x18
+#define MANTIS_I2C_RATE_1              (0x00 <<  6)
+#define MANTIS_I2C_RATE_2              (0x01 <<  6)
+#define MANTIS_I2C_RATE_3              (0x02 <<  6)
+#define MANTIS_I2C_RATE_4              (0x03 <<  6)
+#define MANTIS_I2C_STOP                        (0x01 <<  5)
+#define MANTIS_I2C_PGMODE              (0x01 <<  3)
+
+/* DATA */
+#define MANTIS_CMD_DATA_R1             0x20
+#define MANTIS_CMD_DATA_3              (0xff << 24)
+#define MANTIS_CMD_DATA_2              (0xff << 16)
+#define MANTIS_CMD_DATA_1              (0xff <<  8)
+#define MANTIS_CMD_DATA_0              (0xff <<  0)
+
+#define MANTIS_CMD_DATA_R2             0x24
+#define MANTIS_CMD_DATA_7              (0xff << 24)
+#define MANTIS_CMD_DATA_6              (0xff << 16)
+#define MANTIS_CMD_DATA_5              (0xff <<  8)
+#define MANTIS_CMD_DATA_4              (0xff <<  0)
+
+#define MANTIS_CONTROL                 0x28
+#define MANTIS_DET                     (0x01 <<  7)
+#define MANTIS_DAT_CF_EN               (0x01 <<  6)
+#define MANTIS_ACS                     (0x03 <<  4)
+#define MANTIS_VCCEN                   (0x01 <<  3)
+#define MANTIS_BYPASS                  (0x01 <<  2)
+#define MANTIS_MRST                    (0x01 <<  1)
+#define MANTIS_CRST_INT                        (0x01 <<  0)
+
+#define MANTIS_GPIF_CFGSLA             0x84
+#define MANTIS_GPIF_WAITSMPL           (0x07 << 28)
+#define MANTIS_GPIF_BYTEADDRSUB                (0x01 << 25)
+#define MANTIS_GPIF_WAITPOL            (0x01 << 24)
+#define MANTIS_GPIF_NCDELAY            (0x07 << 20)
+#define MANTIS_GPIF_RW2CSDELAY         (0x07 << 16)
+#define MANTIS_GPIF_SLFTIMEDMODE       (0x01 << 15)
+#define MANTIS_GPIF_SLFTIMEDDELY       (0x7f <<  8)
+#define MANTIS_GPIF_DEVTYPE            (0x07 <<  4)
+#define MANTIS_GPIF_BIGENDIAN          (0x01 <<  3)
+#define MANTIS_GPIF_FETCHCMD           (0x03 <<  1)
+#define MANTIS_GPIF_HWORDDEV           (0x01 <<  0)
+
+#define MANTIS_GPIF_WSTOPER            0x90
+#define MANTIS_GPIF_WSTOPERWREN3       (0x01 << 31)
+#define MANTIS_GPIF_PARBOOTN           (0x01 << 29)
+#define MANTIS_GPIF_WSTOPERSLID3       (0x1f << 24)
+#define MANTIS_GPIF_WSTOPERWREN2       (0x01 << 23)
+#define MANTIS_GPIF_WSTOPERSLID2       (0x1f << 16)
+#define MANTIS_GPIF_WSTOPERWREN1       (0x01 << 15)
+#define MANTIS_GPIF_WSTOPERSLID1       (0x1f <<  8)
+#define MANTIS_GPIF_WSTOPERWREN0       (0x01 <<  7)
+#define MANTIS_GPIF_WSTOPERSLID0       (0x1f <<  0)
+
+#define MANTIS_GPIF_CS2RW              0x94
+#define MANTIS_GPIF_CS2RWWREN3         (0x01 << 31)
+#define MANTIS_GPIF_CS2RWDELY3         (0x3f << 24)
+#define MANTIS_GPIF_CS2RWWREN2         (0x01 << 23)
+#define MANTIS_GPIF_CS2RWDELY2         (0x3f << 16)
+#define MANTIS_GPIF_CS2RWWREN1         (0x01 << 15)
+#define MANTIS_GPIF_CS2RWDELY1         (0x3f <<  8)
+#define MANTIS_GPIF_CS2RWWREN0         (0x01 <<  7)
+#define MANTIS_GPIF_CS2RWDELY0         (0x3f <<  0)
+
+#define MANTIS_GPIF_IRQCFG             0x98
+#define MANTIS_GPIF_IRQPOL             (0x01 <<  8)
+#define MANTIS_MASK_WRACK              (0x01 <<  7)
+#define MANTIS_MASK_BRRDY              (0x01 <<  6)
+#define MANTIS_MASK_OVFLW              (0x01 <<  5)
+#define MANTIS_MASK_OTHERR             (0x01 <<  4)
+#define MANTIS_MASK_WSTO               (0x01 <<  3)
+#define MANTIS_MASK_EXTIRQ             (0x01 <<  2)
+#define MANTIS_MASK_PLUGIN             (0x01 <<  1)
+#define MANTIS_MASK_PLUGOUT            (0x01 <<  0)
+
+#define MANTIS_GPIF_STATUS             0x9c
+#define MANTIS_SBUF_KILLOP             (0x01 << 15)
+#define MANTIS_SBUF_OPDONE             (0x01 << 14)
+#define MANTIS_SBUF_EMPTY              (0x01 << 13)
+#define MANTIS_GPIF_DETSTAT            (0x01 <<  9)
+#define MANTIS_GPIF_INTSTAT            (0x01 <<  8)
+#define MANTIS_GPIF_WRACK              (0x01 <<  7)
+#define MANTIS_GPIF_BRRDY              (0x01 <<  6)
+#define MANTIS_SBUF_OVFLW              (0x01 <<  5)
+#define MANTIS_GPIF_OTHERR             (0x01 <<  4)
+#define MANTIS_SBUF_WSTO               (0x01 <<  3)
+#define MANTIS_GPIF_EXTIRQ             (0x01 <<  2)
+#define MANTIS_CARD_PLUGIN             (0x01 <<  1)
+#define MANTIS_CARD_PLUGOUT            (0x01 <<  0)
+
+#define MANTIS_GPIF_BRADDR             0xa0
+#define MANTIS_GPIF_PCMCIAREG          (0x01           << 27)
+#define MANTIS_GPIF_PCMCIAIOM          (0x01           << 26)
+#define MANTIS_GPIF_BR_ADDR            (0xfffffff      <<  0)
+
+#define MANTIS_GPIF_BRBYTES            0xa4
+#define MANTIS_GPIF_BRCNT              (0xfff          <<  0)
+
+#define MANTIS_PCMCIA_RESET            0xa8
+#define MANTIS_PCMCIA_RSTVAL           (0xff << 0)
+
+#define MANTIS_CARD_RESET              0xac
+
+#define MANTIS_GPIF_ADDR               0xb0
+#define MANTIS_GPIF_HIFRDWRN           (0x01           << 31)
+#define MANTIS_GPIF_PCMCIAREG          (0x01           << 27)
+#define MANTIS_GPIF_PCMCIAIOM          (0x01           << 26)
+#define MANTIS_GPIF_HIFADDR            (0xfffffff      <<  0)
+
+#define MANTIS_GPIF_DOUT               0xb4
+#define MANTIS_GPIF_HIFDOUT            (0xfffffff      <<  0)
+
+#define MANTIS_GPIF_DIN                        0xb8
+#define MANTIS_GPIF_HIFDIN             (0xfffffff      <<  0)
+
+#define MANTIS_GPIF_SPARE              0xbc
+#define MANTIS_GPIF_LOGICRD            (0xffff         << 16)
+#define MANTIS_GPIF_LOGICRW            (0xffff         <<  0)
+
+#endif /* __MANTIS_REG_H */
diff --git a/drivers/media/dvb/mantis/mantis_uart.c b/drivers/media/dvb/mantis/mantis_uart.c
new file mode 100644 (file)
index 0000000..7d2f239
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_reg.h"
+#include "mantis_uart.h"
+
+struct mantis_uart_params {
+       enum mantis_baud        baud_rate;
+       enum mantis_parity      parity;
+};
+
+static struct {
+       char string[7];
+} rates[5] = {
+       { "9600" },
+       { "19200" },
+       { "38400" },
+       { "57600" },
+       { "115200" }
+};
+
+static struct {
+       char string[5];
+} parity[3] = {
+       { "NONE" },
+       { "ODD" },
+       { "EVEN" }
+};
+
+#define UART_MAX_BUF                   16
+
+int mantis_uart_read(struct mantis_pci *mantis, u8 *data)
+{
+       struct mantis_hwconfig *config = mantis->hwconfig;
+       u32 stat = 0, i;
+
+       /* get data */
+       for (i = 0; i < (config->bytes + 1); i++) {
+
+               stat = mmread(MANTIS_UART_STAT);
+
+               if (stat & MANTIS_UART_RXFIFO_FULL) {
+                       dprintk(MANTIS_ERROR, 1, "RX Fifo FULL");
+               }
+               data[i] = mmread(MANTIS_UART_RXD) & 0x3f;
+
+               dprintk(MANTIS_DEBUG, 1, "Reading ... <%02x>", data[i] & 0x3f);
+
+               if (data[i] & (1 << 7)) {
+                       dprintk(MANTIS_ERROR, 1, "UART framing error");
+                       return -EINVAL;
+               }
+               if (data[i] & (1 << 6)) {
+                       dprintk(MANTIS_ERROR, 1, "UART parity error");
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+static void mantis_uart_work(struct work_struct *work)
+{
+       struct mantis_pci *mantis = container_of(work, struct mantis_pci, uart_work);
+       struct mantis_hwconfig *config = mantis->hwconfig;
+       u8 buf[16];
+       int i;
+
+       mantis_uart_read(mantis, buf);
+
+       for (i = 0; i < (config->bytes + 1); i++)
+               dprintk(MANTIS_INFO, 1, "UART BUF:%d <%02x> ", i, buf[i]);
+
+       dprintk(MANTIS_DEBUG, 0, "\n");
+}
+
+static int mantis_uart_setup(struct mantis_pci *mantis,
+                            struct mantis_uart_params *params)
+{
+       u32 reg;
+
+       mmwrite((mmread(MANTIS_UART_CTL) | (params->parity & 0x3)), MANTIS_UART_CTL);
+
+       reg = mmread(MANTIS_UART_BAUD);
+
+       switch (params->baud_rate) {
+       case MANTIS_BAUD_9600:
+               reg |= 0xd8;
+               break;
+       case MANTIS_BAUD_19200:
+               reg |= 0x6c;
+               break;
+       case MANTIS_BAUD_38400:
+               reg |= 0x36;
+               break;
+       case MANTIS_BAUD_57600:
+               reg |= 0x23;
+               break;
+       case MANTIS_BAUD_115200:
+               reg |= 0x11;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       mmwrite(reg, MANTIS_UART_BAUD);
+
+       return 0;
+}
+
+int mantis_uart_init(struct mantis_pci *mantis)
+{
+       struct mantis_hwconfig *config = mantis->hwconfig;
+       struct mantis_uart_params params;
+
+       /* default parity: */
+       params.baud_rate = config->baud_rate;
+       params.parity = config->parity;
+       dprintk(MANTIS_INFO, 1, "Initializing UART @ %sbps parity:%s",
+               rates[params.baud_rate].string,
+               parity[params.parity].string);
+
+       init_waitqueue_head(&mantis->uart_wq);
+       spin_lock_init(&mantis->uart_lock);
+
+       INIT_WORK(&mantis->uart_work, mantis_uart_work);
+
+       /* disable interrupt */
+       mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL);
+
+       mantis_uart_setup(mantis, &params);
+
+       /* default 1 byte */
+       mmwrite((mmread(MANTIS_UART_BAUD) | (config->bytes << 8)), MANTIS_UART_BAUD);
+
+       /* flush buffer */
+       mmwrite((mmread(MANTIS_UART_CTL) | MANTIS_UART_RXFLUSH), MANTIS_UART_CTL);
+
+       /* enable interrupt */
+       mmwrite(mmread(MANTIS_INT_MASK) | 0x800, MANTIS_INT_MASK);
+       mmwrite(mmread(MANTIS_UART_CTL) | MANTIS_UART_RXINT, MANTIS_UART_CTL);
+
+       schedule_work(&mantis->uart_work);
+       dprintk(MANTIS_DEBUG, 1, "UART succesfully initialized");
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mantis_uart_init);
+
+void mantis_uart_exit(struct mantis_pci *mantis)
+{
+       /* disable interrupt */
+       mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL);
+}
+EXPORT_SYMBOL_GPL(mantis_uart_exit);
diff --git a/drivers/media/dvb/mantis/mantis_uart.h b/drivers/media/dvb/mantis/mantis_uart.h
new file mode 100644 (file)
index 0000000..ffb62a0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+       Mantis PCI bridge driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_UART_H
+#define __MANTIS_UART_H
+
+#define MANTIS_UART_CTL                        0xe0
+#define MANTIS_UART_RXINT              (1 << 4)
+#define MANTIS_UART_RXFLUSH            (1 << 2)
+
+#define MANTIS_UART_RXD                        0xe8
+#define MANTIS_UART_BAUD               0xec
+
+#define MANTIS_UART_STAT               0xf0
+#define MANTIS_UART_RXFIFO_DATA                (1 << 7)
+#define MANTIS_UART_RXFIFO_EMPTY       (1 << 6)
+#define MANTIS_UART_RXFIFO_FULL                (1 << 3)
+#define MANTIS_UART_FRAME_ERR          (1 << 2)
+#define MANTIS_UART_PARITY_ERR         (1 << 1)
+#define MANTIS_UART_RXTHRESH_INT       (1 << 0)
+
+enum mantis_baud {
+       MANTIS_BAUD_9600        = 0,
+       MANTIS_BAUD_19200,
+       MANTIS_BAUD_38400,
+       MANTIS_BAUD_57600,
+       MANTIS_BAUD_115200
+};
+
+enum mantis_parity {
+       MANTIS_PARITY_NONE      = 0,
+       MANTIS_PARITY_EVEN,
+       MANTIS_PARITY_ODD,
+};
+
+struct mantis_pci;
+
+extern int mantis_uart_init(struct mantis_pci *mantis);
+extern void mantis_uart_exit(struct mantis_pci *mantis);
+
+#endif /* __MANTIS_UART_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
new file mode 100644 (file)
index 0000000..4a723bd
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+       Mantis VP-1033 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "stv0299.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp1033.h"
+#include "mantis_reg.h"
+
+u8 lgtdqcs001f_inittab[] = {
+       0x01, 0x15,
+       0x02, 0x00,
+       0x03, 0x00,
+       0x04, 0x2a,
+       0x05, 0x85,
+       0x06, 0x02,
+       0x07, 0x00,
+       0x08, 0x00,
+       0x0c, 0x01,
+       0x0d, 0x81,
+       0x0e, 0x44,
+       0x0f, 0x94,
+       0x10, 0x3c,
+       0x11, 0x84,
+       0x12, 0xb9,
+       0x13, 0xb5,
+       0x14, 0x4f,
+       0x15, 0xc9,
+       0x16, 0x80,
+       0x17, 0x36,
+       0x18, 0xfb,
+       0x19, 0xcf,
+       0x1a, 0xbc,
+       0x1c, 0x2b,
+       0x1d, 0x27,
+       0x1e, 0x00,
+       0x1f, 0x0b,
+       0x20, 0xa1,
+       0x21, 0x60,
+       0x22, 0x00,
+       0x23, 0x00,
+       0x28, 0x00,
+       0x29, 0x28,
+       0x2a, 0x14,
+       0x2b, 0x0f,
+       0x2c, 0x09,
+       0x2d, 0x05,
+       0x31, 0x1f,
+       0x32, 0x19,
+       0x33, 0xfc,
+       0x34, 0x13,
+       0xff, 0xff,
+};
+
+#define MANTIS_MODEL_NAME      "VP-1033"
+#define MANTIS_DEV_TYPE                "DVB-S/DSS"
+
+int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
+                         struct dvb_frontend_parameters *params)
+{
+       struct mantis_pci *mantis       = fe->dvb->priv;
+       struct i2c_adapter *adapter     = &mantis->adapter;
+
+       u8 buf[4];
+       u32 div;
+
+
+       struct i2c_msg msg = {.addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf)};
+
+       div = params->frequency / 250;
+
+       buf[0] = (div >> 8) & 0x7f;
+       buf[1] =  div & 0xff;
+       buf[2] =  0x83;
+       buf[3] =  0xc0;
+
+       if (params->frequency < 1531000)
+               buf[3] |= 0x04;
+       else
+               buf[3] &= ~0x04;
+       if (i2c_transfer(adapter, &msg, 1) < 0) {
+               dprintk(MANTIS_ERROR, 1, "Write: I2C Transfer failed");
+               return -EIO;
+       }
+       msleep_interruptible(100);
+
+       return 0;
+}
+
+int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe,
+                               u32 srate, u32 ratio)
+{
+       u8 aclk = 0;
+       u8 bclk = 0;
+
+       if (srate < 1500000) {
+               aclk = 0xb7;
+               bclk = 0x47;
+       } else if (srate < 3000000) {
+               aclk = 0xb7;
+               bclk = 0x4b;
+       } else if (srate < 7000000) {
+               aclk = 0xb7;
+               bclk = 0x4f;
+       } else if (srate < 14000000) {
+               aclk = 0xb7;
+               bclk = 0x53;
+       } else if (srate < 30000000) {
+               aclk = 0xb6;
+               bclk = 0x53;
+       } else if (srate < 45000000) {
+               aclk = 0xb4;
+               bclk = 0x51;
+       }
+       stv0299_writereg(fe, 0x13, aclk);
+       stv0299_writereg(fe, 0x14, bclk);
+
+       stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
+       stv0299_writereg(fe, 0x20, (ratio >>  8) & 0xff);
+       stv0299_writereg(fe, 0x21,  ratio & 0xf0);
+
+       return 0;
+}
+
+struct stv0299_config lgtdqcs001f_config = {
+       .demod_address          = 0x68,
+       .inittab                = lgtdqcs001f_inittab,
+       .mclk                   = 88000000UL,
+       .invert                 = 0,
+       .skip_reinit            = 0,
+       .volt13_op0_op1         = STV0299_VOLT13_OP0,
+       .min_delay_ms           = 100,
+       .set_symbol_rate        = lgtdqcs001f_set_symbol_rate,
+};
+
+static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter     = &mantis->adapter;
+
+       int err = 0;
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               mantis_frontend_soft_reset(mantis);
+               msleep(250);
+
+               dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
+               fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+
+               if (fe) {
+                       fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
+                       dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
+                               lgtdqcs001f_config.demod_address);
+
+                       dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
+               } else {
+                       return -1;
+               }
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+       mantis->fe = fe;
+       dprintk(MANTIS_ERROR, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp1033_config = {
+       .model_name             = MANTIS_MODEL_NAME,
+       .dev_type               = MANTIS_DEV_TYPE,
+       .ts_size                = MANTIS_TS_204,
+
+       .baud_rate              = MANTIS_BAUD_9600,
+       .parity                 = MANTIS_PARITY_NONE,
+       .bytes                  = 0,
+
+       .frontend_init          = vp1033_frontend_init,
+       .power                  = GPIF_A12,
+       .reset                  = GPIF_A13,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.h b/drivers/media/dvb/mantis/mantis_vp1033.h
new file mode 100644 (file)
index 0000000..7daaa1b
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Mantis VP-1033 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP1033_H
+#define __MANTIS_VP1033_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_1033_DVB_S   0x0016
+
+extern struct mantis_hwconfig vp1033_config;
+
+#endif /* __MANTIS_VP1033_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
new file mode 100644 (file)
index 0000000..8e6ae55
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+       Mantis VP-1034 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mb86a16.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp1034.h"
+#include "mantis_reg.h"
+
+struct mb86a16_config vp1034_mb86a16_config = {
+       .demod_address  = 0x08,
+       .set_voltage    = vp1034_set_voltage,
+};
+
+#define MANTIS_MODEL_NAME      "VP-1034"
+#define MANTIS_DEV_TYPE                "DVB-S/DSS"
+
+int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+{
+       struct mantis_pci *mantis = fe->dvb->priv;
+
+       switch (voltage) {
+       case SEC_VOLTAGE_13:
+               dprintk(MANTIS_ERROR, 1, "Polarization=[13V]");
+               gpio_set_bits(mantis, 13, 1);
+               gpio_set_bits(mantis, 14, 0);
+               break;
+       case SEC_VOLTAGE_18:
+               dprintk(MANTIS_ERROR, 1, "Polarization=[18V]");
+               gpio_set_bits(mantis, 13, 1);
+               gpio_set_bits(mantis, 14, 1);
+               break;
+       case SEC_VOLTAGE_OFF:
+               dprintk(MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
+               break;
+       default:
+               dprintk(MANTIS_ERROR, 1, "Invalid = (%d)", (u32) voltage);
+               return -EINVAL;
+       }
+       mmwrite(0x00, MANTIS_GPIF_DOUT);
+
+       return 0;
+}
+
+static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter     = &mantis->adapter;
+
+       int err = 0;
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               mantis_frontend_soft_reset(mantis);
+               msleep(250);
+
+               dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
+               fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
+               if (fe) {
+                       dprintk(MANTIS_ERROR, 1,
+                       "found MB86A16 DVB-S/DSS frontend @0x%02x",
+                       vp1034_mb86a16_config.demod_address);
+
+               } else {
+                       return -1;
+               }
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+       mantis->fe = fe;
+       dprintk(MANTIS_ERROR, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp1034_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_204,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp1034_frontend_init,
+       .power          = GPIF_A12,
+       .reset          = GPIF_A13,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.h b/drivers/media/dvb/mantis/mantis_vp1034.h
new file mode 100644 (file)
index 0000000..323f38e
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+       Mantis VP-1034 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP1034_H
+#define __MANTIS_VP1034_H
+
+#include "dvb_frontend.h"
+#include "mantis_common.h"
+
+
+#define MANTIS_VP_1034_DVB_S   0x0014
+
+extern struct mantis_hwconfig vp1034_config;
+extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
+
+#endif /* __MANTIS_VP1034_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
new file mode 100644 (file)
index 0000000..515346d
--- /dev/null
@@ -0,0 +1,358 @@
+/*
+       Mantis VP-1041 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp1041.h"
+#include "stb0899_reg.h"
+#include "stb0899_drv.h"
+#include "stb0899_cfg.h"
+#include "stb6100_cfg.h"
+#include "stb6100.h"
+#include "lnbp21.h"
+
+#define MANTIS_MODEL_NAME      "VP-1041"
+#define MANTIS_DEV_TYPE                "DSS/DVB-S/DVB-S2"
+
+static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = {
+
+       /* 0x0000000b, *//* SYSREG */
+       { STB0899_DEV_ID                , 0x30 },
+       { STB0899_DISCNTRL1             , 0x32 },
+       { STB0899_DISCNTRL2             , 0x80 },
+       { STB0899_DISRX_ST0             , 0x04 },
+       { STB0899_DISRX_ST1             , 0x00 },
+       { STB0899_DISPARITY             , 0x00 },
+       { STB0899_DISFIFO               , 0x00 },
+       { STB0899_DISSTATUS             , 0x20 },
+       { STB0899_DISF22                , 0x99 },
+       { STB0899_DISF22RX              , 0xa8 },
+       /* SYSREG ? */
+       { STB0899_ACRPRESC              , 0x11 },
+       { STB0899_ACRDIV1               , 0x0a },
+       { STB0899_ACRDIV2               , 0x05 },
+       { STB0899_DACR1                 , 0x00 },
+       { STB0899_DACR2                 , 0x00 },
+       { STB0899_OUTCFG                , 0x00 },
+       { STB0899_MODECFG               , 0x00 },
+       { STB0899_IRQSTATUS_3           , 0xfe },
+       { STB0899_IRQSTATUS_2           , 0x03 },
+       { STB0899_IRQSTATUS_1           , 0x7c },
+       { STB0899_IRQSTATUS_0           , 0xf4 },
+       { STB0899_IRQMSK_3              , 0xf3 },
+       { STB0899_IRQMSK_2              , 0xfc },
+       { STB0899_IRQMSK_1              , 0xff },
+       { STB0899_IRQMSK_0              , 0xff },
+       { STB0899_IRQCFG                , 0x00 },
+       { STB0899_I2CCFG                , 0x88 },
+       { STB0899_I2CRPT                , 0x58 },
+       { STB0899_IOPVALUE5             , 0x00 },
+       { STB0899_IOPVALUE4             , 0x33 },
+       { STB0899_IOPVALUE3             , 0x6d },
+       { STB0899_IOPVALUE2             , 0x90 },
+       { STB0899_IOPVALUE1             , 0x60 },
+       { STB0899_IOPVALUE0             , 0x00 },
+       { STB0899_GPIO00CFG             , 0x82 },
+       { STB0899_GPIO01CFG             , 0x82 },
+       { STB0899_GPIO02CFG             , 0x82 },
+       { STB0899_GPIO03CFG             , 0x82 },
+       { STB0899_GPIO04CFG             , 0x82 },
+       { STB0899_GPIO05CFG             , 0x82 },
+       { STB0899_GPIO06CFG             , 0x82 },
+       { STB0899_GPIO07CFG             , 0x82 },
+       { STB0899_GPIO08CFG             , 0x82 },
+       { STB0899_GPIO09CFG             , 0x82 },
+       { STB0899_GPIO10CFG             , 0x82 },
+       { STB0899_GPIO11CFG             , 0x82 },
+       { STB0899_GPIO12CFG             , 0x82 },
+       { STB0899_GPIO13CFG             , 0x82 },
+       { STB0899_GPIO14CFG             , 0x82 },
+       { STB0899_GPIO15CFG             , 0x82 },
+       { STB0899_GPIO16CFG             , 0x82 },
+       { STB0899_GPIO17CFG             , 0x82 },
+       { STB0899_GPIO18CFG             , 0x82 },
+       { STB0899_GPIO19CFG             , 0x82 },
+       { STB0899_GPIO20CFG             , 0x82 },
+       { STB0899_SDATCFG               , 0xb8 },
+       { STB0899_SCLTCFG               , 0xba },
+       { STB0899_AGCRFCFG              , 0x1c }, /* 0x11 */
+       { STB0899_GPIO22                , 0x82 }, /* AGCBB2CFG */
+       { STB0899_GPIO21                , 0x91 }, /* AGCBB1CFG */
+       { STB0899_DIRCLKCFG             , 0x82 },
+       { STB0899_CLKOUT27CFG           , 0x7e },
+       { STB0899_STDBYCFG              , 0x82 },
+       { STB0899_CS0CFG                , 0x82 },
+       { STB0899_CS1CFG                , 0x82 },
+       { STB0899_DISEQCOCFG            , 0x20 },
+       { STB0899_GPIO32CFG             , 0x82 },
+       { STB0899_GPIO33CFG             , 0x82 },
+       { STB0899_GPIO34CFG             , 0x82 },
+       { STB0899_GPIO35CFG             , 0x82 },
+       { STB0899_GPIO36CFG             , 0x82 },
+       { STB0899_GPIO37CFG             , 0x82 },
+       { STB0899_GPIO38CFG             , 0x82 },
+       { STB0899_GPIO39CFG             , 0x82 },
+       { STB0899_NCOARSE               , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */
+       { STB0899_SYNTCTRL              , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */
+       { STB0899_FILTCTRL              , 0x00 },
+       { STB0899_SYSCTRL               , 0x01 },
+       { STB0899_STOPCLK1              , 0x20 },
+       { STB0899_STOPCLK2              , 0x00 },
+       { STB0899_INTBUFSTATUS          , 0x00 },
+       { STB0899_INTBUFCTRL            , 0x0a },
+       { 0xffff                        , 0xff },
+};
+
+static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = {
+       { STB0899_DEMOD                 , 0x00 },
+       { STB0899_RCOMPC                , 0xc9 },
+       { STB0899_AGC1CN                , 0x01 },
+       { STB0899_AGC1REF               , 0x10 },
+       { STB0899_RTC                   , 0x23 },
+       { STB0899_TMGCFG                , 0x4e },
+       { STB0899_AGC2REF               , 0x34 },
+       { STB0899_TLSR                  , 0x84 },
+       { STB0899_CFD                   , 0xf7 },
+       { STB0899_ACLC                  , 0x87 },
+       { STB0899_BCLC                  , 0x94 },
+       { STB0899_EQON                  , 0x41 },
+       { STB0899_LDT                   , 0xf1 },
+       { STB0899_LDT2                  , 0xe3 },
+       { STB0899_EQUALREF              , 0xb4 },
+       { STB0899_TMGRAMP               , 0x10 },
+       { STB0899_TMGTHD                , 0x30 },
+       { STB0899_IDCCOMP               , 0xfd },
+       { STB0899_QDCCOMP               , 0xff },
+       { STB0899_POWERI                , 0x0c },
+       { STB0899_POWERQ                , 0x0f },
+       { STB0899_RCOMP                 , 0x6c },
+       { STB0899_AGCIQIN               , 0x80 },
+       { STB0899_AGC2I1                , 0x06 },
+       { STB0899_AGC2I2                , 0x00 },
+       { STB0899_TLIR                  , 0x30 },
+       { STB0899_RTF                   , 0x7f },
+       { STB0899_DSTATUS               , 0x00 },
+       { STB0899_LDI                   , 0xbc },
+       { STB0899_CFRM                  , 0xea },
+       { STB0899_CFRL                  , 0x31 },
+       { STB0899_NIRM                  , 0x2b },
+       { STB0899_NIRL                  , 0x80 },
+       { STB0899_ISYMB                 , 0x1d },
+       { STB0899_QSYMB                 , 0xa6 },
+       { STB0899_SFRH                  , 0x2f },
+       { STB0899_SFRM                  , 0x68 },
+       { STB0899_SFRL                  , 0x40 },
+       { STB0899_SFRUPH                , 0x2f },
+       { STB0899_SFRUPM                , 0x68 },
+       { STB0899_SFRUPL                , 0x40 },
+       { STB0899_EQUAI1                , 0x02 },
+       { STB0899_EQUAQ1                , 0xff },
+       { STB0899_EQUAI2                , 0x04 },
+       { STB0899_EQUAQ2                , 0x05 },
+       { STB0899_EQUAI3                , 0x02 },
+       { STB0899_EQUAQ3                , 0xfd },
+       { STB0899_EQUAI4                , 0x03 },
+       { STB0899_EQUAQ4                , 0x07 },
+       { STB0899_EQUAI5                , 0x08 },
+       { STB0899_EQUAQ5                , 0xf5 },
+       { STB0899_DSTATUS2              , 0x00 },
+       { STB0899_VSTATUS               , 0x00 },
+       { STB0899_VERROR                , 0x86 },
+       { STB0899_IQSWAP                , 0x2a },
+       { STB0899_ECNT1M                , 0x00 },
+       { STB0899_ECNT1L                , 0x00 },
+       { STB0899_ECNT2M                , 0x00 },
+       { STB0899_ECNT2L                , 0x00 },
+       { STB0899_ECNT3M                , 0x0a },
+       { STB0899_ECNT3L                , 0xad },
+       { STB0899_FECAUTO1              , 0x06 },
+       { STB0899_FECM                  , 0x01 },
+       { STB0899_VTH12                 , 0xb0 },
+       { STB0899_VTH23                 , 0x7a },
+       { STB0899_VTH34                 , 0x58 },
+       { STB0899_VTH56                 , 0x38 },
+       { STB0899_VTH67                 , 0x34 },
+       { STB0899_VTH78                 , 0x24 },
+       { STB0899_PRVIT                 , 0xff },
+       { STB0899_VITSYNC               , 0x19 },
+       { STB0899_RSULC                 , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
+       { STB0899_TSULC                 , 0x42 },
+       { STB0899_RSLLC                 , 0x41 },
+       { STB0899_TSLPL                 , 0x12 },
+       { STB0899_TSCFGH                , 0x0c },
+       { STB0899_TSCFGM                , 0x00 },
+       { STB0899_TSCFGL                , 0x00 },
+       { STB0899_TSOUT                 , 0x69 }, /* 0x0d for CAM */
+       { STB0899_RSSYNCDEL             , 0x00 },
+       { STB0899_TSINHDELH             , 0x02 },
+       { STB0899_TSINHDELM             , 0x00 },
+       { STB0899_TSINHDELL             , 0x00 },
+       { STB0899_TSLLSTKM              , 0x1b },
+       { STB0899_TSLLSTKL              , 0xb3 },
+       { STB0899_TSULSTKM              , 0x00 },
+       { STB0899_TSULSTKL              , 0x00 },
+       { STB0899_PCKLENUL              , 0xbc },
+       { STB0899_PCKLENLL              , 0xcc },
+       { STB0899_RSPCKLEN              , 0xbd },
+       { STB0899_TSSTATUS              , 0x90 },
+       { STB0899_ERRCTRL1              , 0xb6 },
+       { STB0899_ERRCTRL2              , 0x95 },
+       { STB0899_ERRCTRL3              , 0x8d },
+       { STB0899_DMONMSK1              , 0x27 },
+       { STB0899_DMONMSK0              , 0x03 },
+       { STB0899_DEMAPVIT              , 0x5c },
+       { STB0899_PLPARM                , 0x19 },
+       { STB0899_PDELCTRL              , 0x48 },
+       { STB0899_PDELCTRL2             , 0x00 },
+       { STB0899_BBHCTRL1              , 0x00 },
+       { STB0899_BBHCTRL2              , 0x00 },
+       { STB0899_HYSTTHRESH            , 0x77 },
+       { STB0899_MATCSTM               , 0x00 },
+       { STB0899_MATCSTL               , 0x00 },
+       { STB0899_UPLCSTM               , 0x00 },
+       { STB0899_UPLCSTL               , 0x00 },
+       { STB0899_DFLCSTM               , 0x00 },
+       { STB0899_DFLCSTL               , 0x00 },
+       { STB0899_SYNCCST               , 0x00 },
+       { STB0899_SYNCDCSTM             , 0x00 },
+       { STB0899_SYNCDCSTL             , 0x00 },
+       { STB0899_ISI_ENTRY             , 0x00 },
+       { STB0899_ISI_BIT_EN            , 0x00 },
+       { STB0899_MATSTRM               , 0xf0 },
+       { STB0899_MATSTRL               , 0x02 },
+       { STB0899_UPLSTRM               , 0x45 },
+       { STB0899_UPLSTRL               , 0x60 },
+       { STB0899_DFLSTRM               , 0xe3 },
+       { STB0899_DFLSTRL               , 0x00 },
+       { STB0899_SYNCSTR               , 0x47 },
+       { STB0899_SYNCDSTRM             , 0x05 },
+       { STB0899_SYNCDSTRL             , 0x18 },
+       { STB0899_CFGPDELSTATUS1        , 0x19 },
+       { STB0899_CFGPDELSTATUS2        , 0x2b },
+       { STB0899_BBFERRORM             , 0x00 },
+       { STB0899_BBFERRORL             , 0x01 },
+       { STB0899_UPKTERRORM            , 0x00 },
+       { STB0899_UPKTERRORL            , 0x00 },
+       { 0xffff                        , 0xff },
+};
+
+struct stb0899_config vp1041_stb0899_config = {
+       .init_dev               = vp1041_stb0899_s1_init_1,
+       .init_s2_demod          = stb0899_s2_init_2,
+       .init_s1_demod          = vp1041_stb0899_s1_init_3,
+       .init_s2_fec            = stb0899_s2_init_4,
+       .init_tst               = stb0899_s1_init_5,
+
+       .demod_address          = 0x68, /*  0xd0 >> 1 */
+
+       .xtal_freq              = 27000000,
+       .inversion              = IQ_SWAP_ON, /* 1 */
+
+       .lo_clk                 = 76500000,
+       .hi_clk                 = 99000000,
+
+       .esno_ave               = STB0899_DVBS2_ESNO_AVE,
+       .esno_quant             = STB0899_DVBS2_ESNO_QUANT,
+       .avframes_coarse        = STB0899_DVBS2_AVFRAMES_COARSE,
+       .avframes_fine          = STB0899_DVBS2_AVFRAMES_FINE,
+       .miss_threshold         = STB0899_DVBS2_MISS_THRESHOLD,
+       .uwp_threshold_acq      = STB0899_DVBS2_UWP_THRESHOLD_ACQ,
+       .uwp_threshold_track    = STB0899_DVBS2_UWP_THRESHOLD_TRACK,
+       .uwp_threshold_sof      = STB0899_DVBS2_UWP_THRESHOLD_SOF,
+       .sof_search_timeout     = STB0899_DVBS2_SOF_SEARCH_TIMEOUT,
+
+       .btr_nco_bits           = STB0899_DVBS2_BTR_NCO_BITS,
+       .btr_gain_shift_offset  = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET,
+       .crl_nco_bits           = STB0899_DVBS2_CRL_NCO_BITS,
+       .ldpc_max_iter          = STB0899_DVBS2_LDPC_MAX_ITER,
+
+       .tuner_get_frequency    = stb6100_get_frequency,
+       .tuner_set_frequency    = stb6100_set_frequency,
+       .tuner_set_bandwidth    = stb6100_set_bandwidth,
+       .tuner_get_bandwidth    = stb6100_get_bandwidth,
+       .tuner_set_rfsiggain    = NULL,
+};
+
+struct stb6100_config vp1041_stb6100_config = {
+       .tuner_address  = 0x60,
+       .refclock       = 27000000,
+};
+
+static int vp1041_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter     = &mantis->adapter;
+
+       int err = 0;
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               mantis_frontend_soft_reset(mantis);
+               msleep(250);
+               mantis->fe = stb0899_attach(&vp1041_stb0899_config, adapter);
+               if (mantis->fe) {
+                       dprintk(MANTIS_ERROR, 1,
+                               "found STB0899 DVB-S/DVB-S2 frontend @0x%02x",
+                               vp1041_stb0899_config.demod_address);
+
+                       if (stb6100_attach(mantis->fe, &vp1041_stb6100_config, adapter)) {
+                               if (!lnbp21_attach(mantis->fe, adapter, 0, 0))
+                                       dprintk(MANTIS_ERROR, 1, "No LNBP21 found!");
+                       }
+               } else {
+                       return -EREMOTEIO;
+               }
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+
+
+       dprintk(MANTIS_ERROR, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp1041_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_188,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp1041_frontend_init,
+       .power          = GPIF_A12,
+       .reset          = GPIF_A13,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.h b/drivers/media/dvb/mantis/mantis_vp1041.h
new file mode 100644 (file)
index 0000000..1ae5b3d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+       Mantis VP-1041 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP1041_H
+#define __MANTIS_VP1041_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_1041_DVB_S2  0x0031
+#define SKYSTAR_HD2_10         0x0001
+#define SKYSTAR_HD2_20         0x0003
+#define CINERGY_S2_PCI_HD      0x1179
+
+extern struct mantis_hwconfig vp1041_config;
+
+#endif /* __MANTIS_VP1041_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
new file mode 100644 (file)
index 0000000..10ce817
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+       Mantis VP-2033 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "tda1002x.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp2033.h"
+
+#define MANTIS_MODEL_NAME      "VP-2033"
+#define MANTIS_DEV_TYPE                "DVB-C"
+
+struct tda1002x_config vp2033_tda1002x_cu1216_config = {
+       .demod_address = 0x18 >> 1,
+       .invert = 1,
+};
+
+struct tda10023_config vp2033_tda10023_cu1216_config = {
+       .demod_address = 0x18 >> 1,
+       .invert = 1,
+};
+
+static u8 read_pwm(struct mantis_pci *mantis)
+{
+       struct i2c_adapter *adapter = &mantis->adapter;
+
+       u8 b = 0xff;
+       u8 pwm;
+       struct i2c_msg msg[] = {
+               {.addr = 0x50, .flags = 0, .buf = &b, .len = 1},
+               {.addr = 0x50, .flags = I2C_M_RD, .buf = &pwm, .len = 1}
+       };
+
+       if ((i2c_transfer(adapter, msg, 2) != 2)
+           || (pwm == 0xff))
+               pwm = 0x48;
+
+       return pwm;
+}
+
+static int tda1002x_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+       struct mantis_pci *mantis = fe->dvb->priv;
+       struct i2c_adapter *adapter = &mantis->adapter;
+
+       u8 buf[6];
+       struct i2c_msg msg = {.addr = 0x60, .flags = 0, .buf = buf, .len = sizeof(buf)};
+       int i;
+
+#define CU1216_IF 36125000
+#define TUNER_MUL 62500
+
+       u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
+
+       buf[0] = (div >> 8) & 0x7f;
+       buf[1] = div & 0xff;
+       buf[2] = 0xce;
+       buf[3] = (params->frequency < 150000000 ? 0x01 :
+                 params->frequency < 445000000 ? 0x02 : 0x04);
+       buf[4] = 0xde;
+       buf[5] = 0x20;
+
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       if (i2c_transfer(adapter, &msg, 1) != 1)
+               return -EIO;
+
+       /* wait for the pll lock */
+       msg.flags = I2C_M_RD;
+       msg.len = 1;
+       for (i = 0; i < 20; i++) {
+               if (fe->ops.i2c_gate_ctrl)
+                       fe->ops.i2c_gate_ctrl(fe, 1);
+
+               if (i2c_transfer(adapter, &msg, 1) == 1 && (buf[0] & 0x40))
+                       break;
+
+               msleep(10);
+       }
+
+       /* switch the charge pump to the lower current */
+       msg.flags = 0;
+       msg.len = 2;
+       msg.buf = &buf[2];
+       buf[2] &= ~0x40;
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       if (i2c_transfer(adapter, &msg, 1) != 1)
+               return -EIO;
+
+       return 0;
+}
+
+static int vp2033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter = &mantis->adapter;
+
+       int err = 0;
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               mantis_frontend_soft_reset(mantis);
+               msleep(250);
+
+               dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+               fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
+                                    adapter,
+                                    read_pwm(mantis));
+
+               if (fe) {
+                       dprintk(MANTIS_ERROR, 1,
+                               "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
+                               vp2033_tda1002x_cu1216_config.demod_address);
+               } else {
+                       fe = tda10023_attach(&vp2033_tda10023_cu1216_config,
+                                            adapter,
+                                            read_pwm(mantis));
+
+                       if (fe) {
+                               dprintk(MANTIS_ERROR, 1,
+                                       "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+                                       vp2033_tda1002x_cu1216_config.demod_address);
+                       }
+               }
+
+               if (fe) {
+                       fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+                       dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+               } else {
+                       return -1;
+               }
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+
+       mantis->fe = fe;
+       dprintk(MANTIS_DEBUG, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp2033_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_204,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp2033_frontend_init,
+       .power          = GPIF_A12,
+       .reset          = GPIF_A13,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
new file mode 100644 (file)
index 0000000..c55242b
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Mantis VP-2033 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP2033_H
+#define __MANTIS_VP2033_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_2033_DVB_C   0x0008
+
+extern struct mantis_hwconfig vp2033_config;
+
+#endif /* __MANTIS_VP2033_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c
new file mode 100644 (file)
index 0000000..a7ca233
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+       Mantis VP-2040 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "tda1002x.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp2040.h"
+
+#define MANTIS_MODEL_NAME      "VP-2040"
+#define MANTIS_DEV_TYPE                "DVB-C"
+
+struct tda1002x_config vp2040_tda1002x_cu1216_config = {
+       .demod_address  = 0x18 >> 1,
+       .invert         = 1,
+};
+
+struct tda10023_config vp2040_tda10023_cu1216_config = {
+       .demod_address  = 0x18 >> 1,
+       .invert         = 1,
+};
+
+static int tda1002x_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+       struct mantis_pci *mantis       = fe->dvb->priv;
+       struct i2c_adapter *adapter     = &mantis->adapter;
+
+       u8 buf[6];
+       struct i2c_msg msg = {.addr = 0x60, .flags = 0, .buf = buf, .len = sizeof(buf)};
+       int i;
+
+#define CU1216_IF 36125000
+#define TUNER_MUL 62500
+
+       u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
+
+       buf[0] = (div >> 8) & 0x7f;
+       buf[1] = div & 0xff;
+       buf[2] = 0xce;
+       buf[3] = (params->frequency < 150000000 ? 0x01 :
+                 params->frequency < 445000000 ? 0x02 : 0x04);
+       buf[4] = 0xde;
+       buf[5] = 0x20;
+
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       if (i2c_transfer(adapter, &msg, 1) != 1)
+               return -EIO;
+
+       /* wait for the pll lock */
+       msg.flags = I2C_M_RD;
+       msg.len = 1;
+       for (i = 0; i < 20; i++) {
+               if (fe->ops.i2c_gate_ctrl)
+                       fe->ops.i2c_gate_ctrl(fe, 1);
+
+               if (i2c_transfer(adapter, &msg, 1) == 1 && (buf[0] & 0x40))
+                       break;
+
+               msleep(10);
+       }
+
+       /* switch the charge pump to the lower current */
+       msg.flags = 0;
+       msg.len = 2;
+       msg.buf = &buf[2];
+       buf[2] &= ~0x40;
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       if (i2c_transfer(adapter, &msg, 1) != 1)
+               return -EIO;
+
+       return 0;
+}
+
+static u8 read_pwm(struct mantis_pci *mantis)
+{
+       struct i2c_adapter *adapter = &mantis->adapter;
+
+       u8 b = 0xff;
+       u8 pwm;
+       struct i2c_msg msg[] = {
+               {.addr = 0x50, .flags = 0, .buf = &b, .len = 1},
+               {.addr = 0x50, .flags = I2C_M_RD, .buf = &pwm, .len = 1}
+       };
+
+       if ((i2c_transfer(adapter, msg, 2) != 2)
+           || (pwm == 0xff))
+               pwm = 0x48;
+
+       return pwm;
+}
+
+static int vp2040_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter = &mantis->adapter;
+
+       int err = 0;
+
+       err = mantis_frontend_power(mantis, POWER_ON);
+       if (err == 0) {
+               mantis_frontend_soft_reset(mantis);
+               msleep(250);
+
+               dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+               fe = tda10021_attach(&vp2040_tda1002x_cu1216_config,
+                                    adapter,
+                                    read_pwm(mantis));
+
+               if (fe) {
+                       dprintk(MANTIS_ERROR, 1,
+                               "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
+                               vp2040_tda1002x_cu1216_config.demod_address);
+               } else {
+                       fe = tda10023_attach(&vp2040_tda10023_cu1216_config,
+                                            adapter,
+                                            read_pwm(mantis));
+
+                       if (fe) {
+                               dprintk(MANTIS_ERROR, 1,
+                                       "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+                                       vp2040_tda1002x_cu1216_config.demod_address);
+                       }
+               }
+
+               if (fe) {
+                       fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+                       dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+               } else {
+                       return -1;
+               }
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+       }
+       mantis->fe = fe;
+       dprintk(MANTIS_DEBUG, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp2040_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_204,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp2040_frontend_init,
+       .power          = GPIF_A12,
+       .reset          = GPIF_A13,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.h b/drivers/media/dvb/mantis/mantis_vp2040.h
new file mode 100644 (file)
index 0000000..d125e21
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+       Mantis VP-2040 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP2040_H
+#define __MANTIS_VP2040_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_2040_DVB_C   0x0043
+#define CINERGY_C              0x1178
+#define CABLESTAR_HD2          0x0002
+
+extern struct mantis_hwconfig vp2040_config;
+
+#endif /* __MANTIS_VP2040_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp3028.c b/drivers/media/dvb/mantis/mantis_vp3028.c
new file mode 100644 (file)
index 0000000..4155c83
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+       Mantis VP-3028 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "mantis_common.h"
+#include "mantis_vp3028.h"
+
+struct zl10353_config mantis_vp3028_config = {
+       .demod_address  = 0x0f,
+};
+
+#define MANTIS_MODEL_NAME      "VP-3028"
+#define MANTIS_DEV_TYPE                "DVB-T"
+
+struct mantis_hwconfig vp3028_mantis_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_188,
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp3028.h b/drivers/media/dvb/mantis/mantis_vp3028.h
new file mode 100644 (file)
index 0000000..b07be6a
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+       Mantis VP-3028 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP3028_H
+#define __MANTIS_VP3028_H
+
+#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "zl10353.h"
+
+#define MANTIS_VP_3028_DVB_T   0x0028
+
+extern struct zl10353_config mantis_vp3028_config;
+extern struct mantis_hwconfig vp3028_mantis_config;
+
+#endif /* __MANTIS_VP3028_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
new file mode 100644 (file)
index 0000000..1f43342
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+       Mantis VP-3030 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_net.h"
+
+#include "zl10353.h"
+#include "tda665x.h"
+#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
+#include "mantis_vp3030.h"
+
+struct zl10353_config mantis_vp3030_config = {
+       .demod_address          = 0x0f,
+};
+
+struct tda665x_config env57h12d5_config = {
+       .name                   = "ENV57H12D5 (ET-50DT)",
+       .addr                   = 0x60,
+       .frequency_min          =  47000000,
+       .frequency_max          = 862000000,
+       .frequency_offst        =   3616667,
+       .ref_multiplier         = 6, /* 1/6 MHz */
+       .ref_divider            = 100000, /* 1/6 MHz */
+};
+
+#define MANTIS_MODEL_NAME      "VP-3030"
+#define MANTIS_DEV_TYPE                "DVB-T"
+
+
+static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
+{
+       struct i2c_adapter *adapter     = &mantis->adapter;
+       struct mantis_hwconfig *config  = mantis->hwconfig;
+       int err = 0;
+
+       gpio_set_bits(mantis, config->reset, 0);
+       msleep(100);
+       err = mantis_frontend_power(mantis, POWER_ON);
+       msleep(100);
+       gpio_set_bits(mantis, config->reset, 1);
+
+       if (err == 0) {
+               msleep(250);
+               dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+               fe = zl10353_attach(&mantis_vp3030_config, adapter);
+
+               if (!fe)
+                       return -1;
+
+               tda665x_attach(fe, &env57h12d5_config, adapter);
+       } else {
+               dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+                       adapter->name,
+                       err);
+
+               return -EIO;
+
+       }
+       mantis->fe = fe;
+       dprintk(MANTIS_ERROR, 1, "Done!");
+
+       return 0;
+}
+
+struct mantis_hwconfig vp3030_config = {
+       .model_name     = MANTIS_MODEL_NAME,
+       .dev_type       = MANTIS_DEV_TYPE,
+       .ts_size        = MANTIS_TS_188,
+
+       .baud_rate      = MANTIS_BAUD_9600,
+       .parity         = MANTIS_PARITY_NONE,
+       .bytes          = 0,
+
+       .frontend_init  = vp3030_frontend_init,
+       .power          = GPIF_A12,
+       .reset          = GPIF_A13,
+
+       .i2c_mode       = MANTIS_BYTE_MODE
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.h b/drivers/media/dvb/mantis/mantis_vp3030.h
new file mode 100644 (file)
index 0000000..5f12c42
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+       Mantis VP-3030 driver
+
+       Copyright (C) Manu Abraham (abraham.manu@gmail.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __MANTIS_VP3030_H
+#define __MANTIS_VP3030_H
+
+#include "mantis_common.h"
+
+#define MANTIS_VP_3030_DVB_T   0x0024
+
+extern struct mantis_hwconfig vp3030_config;
+
+#endif /* __MANTIS_VP3030_H */
diff --git a/drivers/media/dvb/ngene/Kconfig b/drivers/media/dvb/ngene/Kconfig
new file mode 100644 (file)
index 0000000..3ec8e6f
--- /dev/null
@@ -0,0 +1,9 @@
+config DVB_NGENE
+       tristate "Micronas nGene support"
+       depends on DVB_CORE && PCI && I2C
+       select DVB_LNBP21 if !DVB_FE_CUSTOMISE
+       select DVB_STV6110x if !DVB_FE_CUSTOMISE
+       select DVB_STV090x if !DVB_FE_CUSTOMISE
+       ---help---
+         Support for Micronas PCI express cards with nGene bridge.
+
diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile
new file mode 100644 (file)
index 0000000..40435ca
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# Makefile for the nGene device driver
+#
+
+ngene-objs := ngene-core.o
+
+obj-$(CONFIG_DVB_NGENE) += ngene.o
+
+EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
+EXTRA_CFLAGS += -Idrivers/media/dvb/frontends/
+
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c
new file mode 100644 (file)
index 0000000..0150dfe
--- /dev/null
@@ -0,0 +1,2024 @@
+/*
+ * ngene.c: nGene PCIe bridge driver
+ *
+ * Copyright (C) 2005-2007 Micronas
+ *
+ * Copyright (C) 2008-2009 Ralph Metzler <rjkm@metzlerbros.de>
+ *                         Modifications for new nGene firmware,
+ *                         support for EEPROM-copying,
+ *                         support for new dual DVB-S2 card prototype
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 only, as published by the Free Software Foundation.
+ *
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <linux/io.h>
+#include <asm/div64.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/smp_lock.h>
+#include <linux/timer.h>
+#include <linux/version.h>
+#include <linux/byteorder/generic.h>
+#include <linux/firmware.h>
+#include <linux/vmalloc.h>
+
+#include "ngene.h"
+
+#include "stv6110x.h"
+#include "stv090x.h"
+#include "lnbh24.h"
+
+static int one_adapter = 1;
+module_param(one_adapter, int, 0444);
+MODULE_PARM_DESC(one_adapter, "Use only one adapter.");
+
+
+static int debug;
+module_param(debug, int, 0444);
+MODULE_PARM_DESC(debug, "Print debugging information.");
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+#define COMMAND_TIMEOUT_WORKAROUND
+
+#define dprintk        if (debug) printk
+
+#define DEVICE_NAME "ngene"
+
+#define ngwriteb(dat, adr)         writeb((dat), (char *)(dev->iomem + (adr)))
+#define ngwritel(dat, adr)         writel((dat), (char *)(dev->iomem + (adr)))
+#define ngwriteb(dat, adr)         writeb((dat), (char *)(dev->iomem + (adr)))
+#define ngreadl(adr)               readl(dev->iomem + (adr))
+#define ngreadb(adr)               readb(dev->iomem + (adr))
+#define ngcpyto(adr, src, count)   memcpy_toio((char *) \
+                                  (dev->iomem + (adr)), (src), (count))
+#define ngcpyfrom(dst, adr, count) memcpy_fromio((dst), (char *) \
+                                  (dev->iomem + (adr)), (count))
+
+/****************************************************************************/
+/* nGene interrupt handler **************************************************/
+/****************************************************************************/
+
+static void event_tasklet(unsigned long data)
+{
+       struct ngene *dev = (struct ngene *)data;
+
+       while (dev->EventQueueReadIndex != dev->EventQueueWriteIndex) {
+               struct EVENT_BUFFER Event =
+                       dev->EventQueue[dev->EventQueueReadIndex];
+               dev->EventQueueReadIndex =
+                       (dev->EventQueueReadIndex + 1) & (EVENT_QUEUE_SIZE - 1);
+
+               if ((Event.UARTStatus & 0x01) && (dev->TxEventNotify))
+                       dev->TxEventNotify(dev, Event.TimeStamp);
+               if ((Event.UARTStatus & 0x02) && (dev->RxEventNotify))
+                       dev->RxEventNotify(dev, Event.TimeStamp,
+                                          Event.RXCharacter);
+       }
+}
+
+static void demux_tasklet(unsigned long data)
+{
+       struct ngene_channel *chan = (struct ngene_channel *)data;
+       struct SBufferHeader *Cur = chan->nextBuffer;
+
+       spin_lock_irq(&chan->state_lock);
+
+       while (Cur->ngeneBuffer.SR.Flags & 0x80) {
+               if (chan->mode & NGENE_IO_TSOUT) {
+                       u32 Flags = chan->DataFormatFlags;
+                       if (Cur->ngeneBuffer.SR.Flags & 0x20)
+                               Flags |= BEF_OVERFLOW;
+                       if (chan->pBufferExchange) {
+                               if (!chan->pBufferExchange(chan,
+                                                          Cur->Buffer1,
+                                                          chan->Capture1Length,
+                                                          Cur->ngeneBuffer.SR.
+                                                          Clock, Flags)) {
+                                       /*
+                                          We didn't get data
+                                          Clear in service flag to make sure we
+                                          get called on next interrupt again.
+                                          leave fill/empty (0x80) flag alone
+                                          to avoid hardware running out of
+                                          buffers during startup, we hold only
+                                          in run state ( the source may be late
+                                          delivering data )
+                                       */
+
+                                       if (chan->HWState == HWSTATE_RUN) {
+                                               Cur->ngeneBuffer.SR.Flags &=
+                                                       ~0x40;
+                                               break;
+                                               /* Stop proccessing stream */
+                                       }
+                               } else {
+                                       /* We got a valid buffer,
+                                          so switch to run state */
+                                       chan->HWState = HWSTATE_RUN;
+                               }
+                       } else {
+                               printk(KERN_ERR DEVICE_NAME ": OOPS\n");
+                               if (chan->HWState == HWSTATE_RUN) {
+                                       Cur->ngeneBuffer.SR.Flags &= ~0x40;
+                                       break;  /* Stop proccessing stream */
+                               }
+                       }
+                       if (chan->AudioDTOUpdated) {
+                               printk(KERN_INFO DEVICE_NAME
+                                      ": Update AudioDTO = %d\n",
+                                      chan->AudioDTOValue);
+                               Cur->ngeneBuffer.SR.DTOUpdate =
+                                       chan->AudioDTOValue;
+                               chan->AudioDTOUpdated = 0;
+                       }
+               } else {
+                       if (chan->HWState == HWSTATE_RUN) {
+                               u32 Flags = 0;
+                               if (Cur->ngeneBuffer.SR.Flags & 0x01)
+                                       Flags |= BEF_EVEN_FIELD;
+                               if (Cur->ngeneBuffer.SR.Flags & 0x20)
+                                       Flags |= BEF_OVERFLOW;
+                               if (chan->pBufferExchange)
+                                       chan->pBufferExchange(chan,
+                                                             Cur->Buffer1,
+                                                             chan->
+                                                             Capture1Length,
+                                                             Cur->ngeneBuffer.
+                                                             SR.Clock, Flags);
+                               if (chan->pBufferExchange2)
+                                       chan->pBufferExchange2(chan,
+                                                              Cur->Buffer2,
+                                                              chan->
+                                                              Capture2Length,
+                                                              Cur->ngeneBuffer.
+                                                              SR.Clock, Flags);
+                       } else if (chan->HWState != HWSTATE_STOP)
+                               chan->HWState = HWSTATE_RUN;
+               }
+               Cur->ngeneBuffer.SR.Flags = 0x00;
+               Cur = Cur->Next;
+       }
+       chan->nextBuffer = Cur;
+
+       spin_unlock_irq(&chan->state_lock);
+}
+
+static irqreturn_t irq_handler(int irq, void *dev_id)
+{
+       struct ngene *dev = (struct ngene *)dev_id;
+       u32 icounts = 0;
+       irqreturn_t rc = IRQ_NONE;
+       u32 i = MAX_STREAM;
+       u8 *tmpCmdDoneByte;
+
+       if (dev->BootFirmware) {
+               icounts = ngreadl(NGENE_INT_COUNTS);
+               if (icounts != dev->icounts) {
+                       ngwritel(0, FORCE_NMI);
+                       dev->cmd_done = 1;
+                       wake_up(&dev->cmd_wq);
+                       dev->icounts = icounts;
+                       rc = IRQ_HANDLED;
+               }
+               return rc;
+       }
+
+       ngwritel(0, FORCE_NMI);
+
+       spin_lock(&dev->cmd_lock);
+       tmpCmdDoneByte = dev->CmdDoneByte;
+       if (tmpCmdDoneByte &&
+           (*tmpCmdDoneByte ||
+           (dev->ngenetohost[0] == 1 && dev->ngenetohost[1] != 0))) {
+               dev->CmdDoneByte = NULL;
+               dev->cmd_done = 1;
+               wake_up(&dev->cmd_wq);
+               rc = IRQ_HANDLED;
+       }
+       spin_unlock(&dev->cmd_lock);
+
+       if (dev->EventBuffer->EventStatus & 0x80) {
+               u8 nextWriteIndex =
+                       (dev->EventQueueWriteIndex + 1) &
+                       (EVENT_QUEUE_SIZE - 1);
+               if (nextWriteIndex != dev->EventQueueReadIndex) {
+                       dev->EventQueue[dev->EventQueueWriteIndex] =
+                               *(dev->EventBuffer);
+                       dev->EventQueueWriteIndex = nextWriteIndex;
+               } else {
+                       printk(KERN_ERR DEVICE_NAME ": event overflow\n");
+                       dev->EventQueueOverflowCount += 1;
+                       dev->EventQueueOverflowFlag = 1;
+               }
+               dev->EventBuffer->EventStatus &= ~0x80;
+               tasklet_schedule(&dev->event_tasklet);
+               rc = IRQ_HANDLED;
+       }
+
+       while (i > 0) {
+               i--;
+               spin_lock(&dev->channel[i].state_lock);
+               /* if (dev->channel[i].State>=KSSTATE_RUN) { */
+               if (dev->channel[i].nextBuffer) {
+                       if ((dev->channel[i].nextBuffer->
+                            ngeneBuffer.SR.Flags & 0xC0) == 0x80) {
+                               dev->channel[i].nextBuffer->
+                                       ngeneBuffer.SR.Flags |= 0x40;
+                               tasklet_schedule(
+                                       &dev->channel[i].demux_tasklet);
+                               rc = IRQ_HANDLED;
+                       }
+               }
+               spin_unlock(&dev->channel[i].state_lock);
+       }
+
+       /* Request might have been processed by a previous call. */
+       return IRQ_HANDLED;
+}
+
+/****************************************************************************/
+/* nGene command interface **************************************************/
+/****************************************************************************/
+
+static void dump_command_io(struct ngene *dev)
+{
+       u8 buf[8], *b;
+
+       ngcpyfrom(buf, HOST_TO_NGENE, 8);
+       printk(KERN_ERR "host_to_ngene (%04x): %02x %02x %02x %02x %02x %02x %02x %02x\n",
+               HOST_TO_NGENE, buf[0], buf[1], buf[2], buf[3],
+               buf[4], buf[5], buf[6], buf[7]);
+
+       ngcpyfrom(buf, NGENE_TO_HOST, 8);
+       printk(KERN_ERR "ngene_to_host (%04x): %02x %02x %02x %02x %02x %02x %02x %02x\n",
+               NGENE_TO_HOST, buf[0], buf[1], buf[2], buf[3],
+               buf[4], buf[5], buf[6], buf[7]);
+
+       b = dev->hosttongene;
+       printk(KERN_ERR "dev->hosttongene (%p): %02x %02x %02x %02x %02x %02x %02x %02x\n",
+               b, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
+
+       b = dev->ngenetohost;
+       printk(KERN_ERR "dev->ngenetohost (%p): %02x %02x %02x %02x %02x %02x %02x %02x\n",
+               b, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
+}
+
+static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com)
+{
+       int ret;
+       u8 *tmpCmdDoneByte;
+
+       dev->cmd_done = 0;
+
+       if (com->cmd.hdr.Opcode == CMD_FWLOAD_PREPARE) {
+               dev->BootFirmware = 1;
+               dev->icounts = ngreadl(NGENE_INT_COUNTS);
+               ngwritel(0, NGENE_COMMAND);
+               ngwritel(0, NGENE_COMMAND_HI);
+               ngwritel(0, NGENE_STATUS);
+               ngwritel(0, NGENE_STATUS_HI);
+               ngwritel(0, NGENE_EVENT);
+               ngwritel(0, NGENE_EVENT_HI);
+       } else if (com->cmd.hdr.Opcode == CMD_FWLOAD_FINISH) {
+               u64 fwio = dev->PAFWInterfaceBuffer;
+
+               ngwritel(fwio & 0xffffffff, NGENE_COMMAND);
+               ngwritel(fwio >> 32, NGENE_COMMAND_HI);
+               ngwritel((fwio + 256) & 0xffffffff, NGENE_STATUS);
+               ngwritel((fwio + 256) >> 32, NGENE_STATUS_HI);
+               ngwritel((fwio + 512) & 0xffffffff, NGENE_EVENT);
+               ngwritel((fwio + 512) >> 32, NGENE_EVENT_HI);
+       }
+
+       memcpy(dev->FWInterfaceBuffer, com->cmd.raw8, com->in_len + 2);
+
+       if (dev->BootFirmware)
+               ngcpyto(HOST_TO_NGENE, com->cmd.raw8, com->in_len + 2);
+
+       spin_lock_irq(&dev->cmd_lock);
+       tmpCmdDoneByte = dev->ngenetohost + com->out_len;
+       if (!com->out_len)
+               tmpCmdDoneByte++;
+       *tmpCmdDoneByte = 0;
+       dev->ngenetohost[0] = 0;
+       dev->ngenetohost[1] = 0;
+       dev->CmdDoneByte = tmpCmdDoneByte;
+       spin_unlock_irq(&dev->cmd_lock);
+
+       /* Notify 8051. */
+       ngwritel(1, FORCE_INT);
+
+       ret = wait_event_timeout(dev->cmd_wq, dev->cmd_done == 1, 2 * HZ);
+       if (!ret) {
+               /*ngwritel(0, FORCE_NMI);*/
+
+               printk(KERN_ERR DEVICE_NAME
+                      ": Command timeout cmd=%02x prev=%02x\n",
+                      com->cmd.hdr.Opcode, dev->prev_cmd);
+               dump_command_io(dev);
+               return -1;
+       }
+       if (com->cmd.hdr.Opcode == CMD_FWLOAD_FINISH)
+               dev->BootFirmware = 0;
+
+       dev->prev_cmd = com->cmd.hdr.Opcode;
+
+       if (!com->out_len)
+               return 0;
+
+       memcpy(com->cmd.raw8, dev->ngenetohost, com->out_len);
+
+       return 0;
+}
+
+static int ngene_command(struct ngene *dev, struct ngene_command *com)
+{
+       int result;
+
+       down(&dev->cmd_mutex);
+       result = ngene_command_mutex(dev, com);
+       up(&dev->cmd_mutex);
+       return result;
+}
+
+
+static int ngene_command_i2c_read(struct ngene *dev, u8 adr,
+                          u8 *out, u8 outlen, u8 *in, u8 inlen, int flag)
+{
+       struct ngene_command com;
+
+       com.cmd.hdr.Opcode = CMD_I2C_READ;
+       com.cmd.hdr.Length = outlen + 3;
+       com.cmd.I2CRead.Device = adr << 1;
+       memcpy(com.cmd.I2CRead.Data, out, outlen);
+       com.cmd.I2CRead.Data[outlen] = inlen;
+       com.cmd.I2CRead.Data[outlen + 1] = 0;
+       com.in_len = outlen + 3;
+       com.out_len = inlen + 1;
+
+       if (ngene_command(dev, &com) < 0)
+               return -EIO;
+
+       if ((com.cmd.raw8[0] >> 1) != adr)
+               return -EIO;
+
+       if (flag)
+               memcpy(in, com.cmd.raw8, inlen + 1);
+       else
+               memcpy(in, com.cmd.raw8 + 1, inlen);
+       return 0;
+}
+
+static int ngene_command_i2c_write(struct ngene *dev, u8 adr,
+                                  u8 *out, u8 outlen)
+{
+       struct ngene_command com;
+
+
+       com.cmd.hdr.Opcode = CMD_I2C_WRITE;
+       com.cmd.hdr.Length = outlen + 1;
+       com.cmd.I2CRead.Device = adr << 1;
+       memcpy(com.cmd.I2CRead.Data, out, outlen);
+       com.in_len = outlen + 1;
+       com.out_len = 1;
+
+       if (ngene_command(dev, &com) < 0)
+               return -EIO;
+
+       if (com.cmd.raw8[0] == 1)
+               return -EIO;
+
+       return 0;
+}
+
+static int ngene_command_load_firmware(struct ngene *dev,
+                                      u8 *ngene_fw, u32 size)
+{
+#define FIRSTCHUNK (1024)
+       u32 cleft;
+       struct ngene_command com;
+
+       com.cmd.hdr.Opcode = CMD_FWLOAD_PREPARE;
+       com.cmd.hdr.Length = 0;
+       com.in_len = 0;
+       com.out_len = 0;
+
+       ngene_command(dev, &com);
+
+       cleft = (size + 3) & ~3;
+       if (cleft > FIRSTCHUNK) {
+               ngcpyto(PROGRAM_SRAM + FIRSTCHUNK, ngene_fw + FIRSTCHUNK,
+                       cleft - FIRSTCHUNK);
+               cleft = FIRSTCHUNK;
+       }
+       ngcpyto(DATA_FIFO_AREA, ngene_fw, cleft);
+
+       memset(&com, 0, sizeof(struct ngene_command));
+       com.cmd.hdr.Opcode = CMD_FWLOAD_FINISH;
+       com.cmd.hdr.Length = 4;
+       com.cmd.FWLoadFinish.Address = DATA_FIFO_AREA;
+       com.cmd.FWLoadFinish.Length = (unsigned short)cleft;
+       com.in_len = 4;
+       com.out_len = 0;
+
+       return ngene_command(dev, &com);
+}
+
+
+static int ngene_command_config_buf(struct ngene *dev, u8 config)
+{
+       struct ngene_command com;
+
+       com.cmd.hdr.Opcode = CMD_CONFIGURE_BUFFER;
+       com.cmd.hdr.Length = 1;
+       com.cmd.ConfigureBuffers.config = config;
+       com.in_len = 1;
+       com.out_len = 0;
+
+       if (ngene_command(dev, &com) < 0)
+               return -EIO;
+       return 0;
+}
+
+static int ngene_command_config_free_buf(struct ngene *dev, u8 *config)
+{
+       struct ngene_command com;
+
+       com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER;
+       com.cmd.hdr.Length = 6;
+       memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
+       com.in_len = 6;
+       com.out_len = 0;
+
+       if (ngene_command(dev, &com) < 0)
+               return -EIO;
+
+       return 0;
+}
+
+static int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level)
+{
+       struct ngene_command com;
+
+       com.cmd.hdr.Opcode = CMD_SET_GPIO_PIN;
+       com.cmd.hdr.Length = 1;
+       com.cmd.SetGpioPin.select = select | (level << 7);
+       com.in_len = 1;
+       com.out_len = 0;
+
+       return ngene_command(dev, &com);
+}
+
+
+/*
+ 02000640 is sample on rising edge.
+ 02000740 is sample on falling edge.
+ 02000040 is ignore "valid" signal
+
+ 0: FD_CTL1 Bit 7,6 must be 0,1
+    7   disable(fw controlled)
+    6   0-AUX,1-TS
+    5   0-par,1-ser
+    4   0-lsb/1-msb
+    3,2 reserved
+    1,0 0-no sync, 1-use ext. start, 2-use 0x47, 3-both
+ 1: FD_CTL2 has 3-valid must be hi, 2-use valid, 1-edge
+ 2: FD_STA is read-only. 0-sync
+ 3: FD_INSYNC is number of 47s to trigger "in sync".
+ 4: FD_OUTSYNC is number of 47s to trigger "out of sync".
+ 5: FD_MAXBYTE1 is low-order of bytes per packet.
+ 6: FD_MAXBYTE2 is high-order of bytes per packet.
+ 7: Top byte is unused.
+*/
+
+/****************************************************************************/
+
+static u8 TSFeatureDecoderSetup[8 * 4] = {
+       0x42, 0x00, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00,
+       0x40, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXH */
+       0x71, 0x07, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXHser */
+       0x72, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* S2ser */
+};
+
+/* Set NGENE I2S Config to 16 bit packed */
+static u8 I2SConfiguration[] = {
+       0x00, 0x10, 0x00, 0x00,
+       0x80, 0x10, 0x00, 0x00,
+};
+
+static u8 SPDIFConfiguration[10] = {
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/* Set NGENE I2S Config to transport stream compatible mode */
+
+static u8 TS_I2SConfiguration[4] = { 0x3E, 0x1A, 0x00, 0x00 }; /*3e 18 00 00 ?*/
+
+static u8 TS_I2SOutConfiguration[4] = { 0x80, 0x20, 0x00, 0x00 };
+
+static u8 ITUDecoderSetup[4][16] = {
+       {0x1c, 0x13, 0x01, 0x68, 0x3d, 0x90, 0x14, 0x20,  /* SDTV */
+        0x00, 0x00, 0x01, 0xb0, 0x9c, 0x00, 0x00, 0x00},
+       {0x9c, 0x03, 0x23, 0xC0, 0x60, 0x0E, 0x13, 0x00,
+        0x00, 0x00, 0x00, 0x01, 0xB0, 0x00, 0x00, 0x00},
+       {0x9f, 0x00, 0x23, 0xC0, 0x60, 0x0F, 0x13, 0x00,  /* HDTV 1080i50 */
+        0x00, 0x00, 0x00, 0x01, 0xB0, 0x00, 0x00, 0x00},
+       {0x9c, 0x01, 0x23, 0xC0, 0x60, 0x0E, 0x13, 0x00,  /* HDTV 1080i60 */
+        0x00, 0x00, 0x00, 0x01, 0xB0, 0x00, 0x00, 0x00},
+};
+
+/*
+ * 50 48 60 gleich
+ * 27p50 9f 00 22 80 42 69 18 ...
+ * 27p60 93 00 22 80 82 69 1c ...
+ */
+
+/* Maxbyte to 1144 (for raw data) */
+static u8 ITUFeatureDecoderSetup[8] = {
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x04, 0x00
+};
+
+static void FillTSBuffer(void *Buffer, int Length, u32 Flags)
+{
+       u32 *ptr = Buffer;
+
+       memset(Buffer, 0xff, Length);
+       while (Length > 0) {
+               if (Flags & DF_SWAP32)
+                       *ptr = 0x471FFF10;
+               else
+                       *ptr = 0x10FF1F47;
+               ptr += (188 / 4);
+               Length -= 188;
+       }
+}
+
+
+static void flush_buffers(struct ngene_channel *chan)
+{
+       u8 val;
+
+       do {
+               msleep(1);
+               spin_lock_irq(&chan->state_lock);
+               val = chan->nextBuffer->ngeneBuffer.SR.Flags & 0x80;
+               spin_unlock_irq(&chan->state_lock);
+       } while (val);
+}
+
+static void clear_buffers(struct ngene_channel *chan)
+{
+       struct SBufferHeader *Cur = chan->nextBuffer;
+
+       do {
+               memset(&Cur->ngeneBuffer.SR, 0, sizeof(Cur->ngeneBuffer.SR));
+               if (chan->mode & NGENE_IO_TSOUT)
+                       FillTSBuffer(Cur->Buffer1,
+                                    chan->Capture1Length,
+                                    chan->DataFormatFlags);
+               Cur = Cur->Next;
+       } while (Cur != chan->nextBuffer);
+
+       if (chan->mode & NGENE_IO_TSOUT) {
+               chan->nextBuffer->ngeneBuffer.SR.DTOUpdate =
+                       chan->AudioDTOValue;
+               chan->AudioDTOUpdated = 0;
+
+               Cur = chan->TSIdleBuffer.Head;
+
+               do {
+                       memset(&Cur->ngeneBuffer.SR, 0,
+                              sizeof(Cur->ngeneBuffer.SR));
+                       FillTSBuffer(Cur->Buffer1,
+                                    chan->Capture1Length,
+                                    chan->DataFormatFlags);
+                       Cur = Cur->Next;
+               } while (Cur != chan->TSIdleBuffer.Head);
+       }
+}
+
+static int ngene_command_stream_control(struct ngene *dev, u8 stream,
+                                       u8 control, u8 mode, u8 flags)
+{
+       struct ngene_channel *chan = &dev->channel[stream];
+       struct ngene_command com;
+       u16 BsUVI = ((stream & 1) ? 0x9400 : 0x9300);
+       u16 BsSDI = ((stream & 1) ? 0x9600 : 0x9500);
+       u16 BsSPI = ((stream & 1) ? 0x9800 : 0x9700);
+       u16 BsSDO = 0x9B00;
+
+       /* down(&dev->stream_mutex); */
+       while (down_trylock(&dev->stream_mutex)) {
+               printk(KERN_INFO DEVICE_NAME ": SC locked\n");
+               msleep(1);
+       }
+       memset(&com, 0, sizeof(com));
+       com.cmd.hdr.Opcode = CMD_CONTROL;
+       com.cmd.hdr.Length = sizeof(struct FW_STREAM_CONTROL) - 2;
+       com.cmd.StreamControl.Stream = stream | (control ? 8 : 0);
+       if (chan->mode & NGENE_IO_TSOUT)
+               com.cmd.StreamControl.Stream |= 0x07;
+       com.cmd.StreamControl.Control = control |
+               (flags & SFLAG_ORDER_LUMA_CHROMA);
+       com.cmd.StreamControl.Mode = mode;
+       com.in_len = sizeof(struct FW_STREAM_CONTROL);
+       com.out_len = 0;
+
+       dprintk(KERN_INFO DEVICE_NAME
+               ": Stream=%02x, Control=%02x, Mode=%02x\n",
+               com.cmd.StreamControl.Stream, com.cmd.StreamControl.Control,
+               com.cmd.StreamControl.Mode);
+
+       chan->Mode = mode;
+
+       if (!(control & 0x80)) {
+               spin_lock_irq(&chan->state_lock);
+               if (chan->State == KSSTATE_RUN) {
+                       chan->State = KSSTATE_ACQUIRE;
+                       chan->HWState = HWSTATE_STOP;
+                       spin_unlock_irq(&chan->state_lock);
+                       if (ngene_command(dev, &com) < 0) {
+                               up(&dev->stream_mutex);
+                               return -1;
+                       }
+                       /* clear_buffers(chan); */
+                       flush_buffers(chan);
+                       up(&dev->stream_mutex);
+                       return 0;
+               }
+               spin_unlock_irq(&chan->state_lock);
+               up(&dev->stream_mutex);
+               return 0;
+       }
+
+       if (mode & SMODE_AUDIO_CAPTURE) {
+               com.cmd.StreamControl.CaptureBlockCount =
+                       chan->Capture1Length / AUDIO_BLOCK_SIZE;
+               com.cmd.StreamControl.Buffer_Address = chan->RingBuffer.PAHead;
+       } else if (mode & SMODE_TRANSPORT_STREAM) {
+               com.cmd.StreamControl.CaptureBlockCount =
+                       chan->Capture1Length / TS_BLOCK_SIZE;
+               com.cmd.StreamControl.MaxLinesPerField =
+                       chan->Capture1Length / TS_BLOCK_SIZE;
+               com.cmd.StreamControl.Buffer_Address =
+                       chan->TSRingBuffer.PAHead;
+               if (chan->mode & NGENE_IO_TSOUT) {
+                       com.cmd.StreamControl.BytesPerVBILine =
+                               chan->Capture1Length / TS_BLOCK_SIZE;
+                       com.cmd.StreamControl.Stream |= 0x07;
+               }
+       } else {
+               com.cmd.StreamControl.BytesPerVideoLine = chan->nBytesPerLine;
+               com.cmd.StreamControl.MaxLinesPerField = chan->nLines;
+               com.cmd.StreamControl.MinLinesPerField = 100;
+               com.cmd.StreamControl.Buffer_Address = chan->RingBuffer.PAHead;
+
+               if (mode & SMODE_VBI_CAPTURE) {
+                       com.cmd.StreamControl.MaxVBILinesPerField =
+                               chan->nVBILines;
+                       com.cmd.StreamControl.MinVBILinesPerField = 0;
+                       com.cmd.StreamControl.BytesPerVBILine =
+                               chan->nBytesPerVBILine;
+               }
+               if (flags & SFLAG_COLORBAR)
+                       com.cmd.StreamControl.Stream |= 0x04;
+       }
+
+       spin_lock_irq(&chan->state_lock);
+       if (mode & SMODE_AUDIO_CAPTURE) {
+               chan->nextBuffer = chan->RingBuffer.Head;
+               if (mode & SMODE_AUDIO_SPDIF) {
+                       com.cmd.StreamControl.SetupDataLen =
+                               sizeof(SPDIFConfiguration);
+                       com.cmd.StreamControl.SetupDataAddr = BsSPI;
+                       memcpy(com.cmd.StreamControl.SetupData,
+                              SPDIFConfiguration, sizeof(SPDIFConfiguration));
+               } else {
+                       com.cmd.StreamControl.SetupDataLen = 4;
+                       com.cmd.StreamControl.SetupDataAddr = BsSDI;
+                       memcpy(com.cmd.StreamControl.SetupData,
+                              I2SConfiguration +
+                              4 * dev->card_info->i2s[stream], 4);
+               }
+       } else if (mode & SMODE_TRANSPORT_STREAM) {
+               chan->nextBuffer = chan->TSRingBuffer.Head;
+               if (stream >= STREAM_AUDIOIN1) {
+                       if (chan->mode & NGENE_IO_TSOUT) {
+                               com.cmd.StreamControl.SetupDataLen =
+                                       sizeof(TS_I2SOutConfiguration);
+                               com.cmd.StreamControl.SetupDataAddr = BsSDO;
+                               memcpy(com.cmd.StreamControl.SetupData,
+                                      TS_I2SOutConfiguration,
+                                      sizeof(TS_I2SOutConfiguration));
+                       } else {
+                               com.cmd.StreamControl.SetupDataLen =
+                                       sizeof(TS_I2SConfiguration);
+                               com.cmd.StreamControl.SetupDataAddr = BsSDI;
+                               memcpy(com.cmd.StreamControl.SetupData,
+                                      TS_I2SConfiguration,
+                                      sizeof(TS_I2SConfiguration));
+                       }
+               } else {
+                       com.cmd.StreamControl.SetupDataLen = 8;
+                       com.cmd.StreamControl.SetupDataAddr = BsUVI + 0x10;
+                       memcpy(com.cmd.StreamControl.SetupData,
+                              TSFeatureDecoderSetup +
+                              8 * dev->card_info->tsf[stream], 8);
+               }
+       } else {
+               chan->nextBuffer = chan->RingBuffer.Head;
+               com.cmd.StreamControl.SetupDataLen =
+                       16 + sizeof(ITUFeatureDecoderSetup);
+               com.cmd.StreamControl.SetupDataAddr = BsUVI;
+               memcpy(com.cmd.StreamControl.SetupData,
+                      ITUDecoderSetup[chan->itumode], 16);
+               memcpy(com.cmd.StreamControl.SetupData + 16,
+                      ITUFeatureDecoderSetup, sizeof(ITUFeatureDecoderSetup));
+       }
+       clear_buffers(chan);
+       chan->State = KSSTATE_RUN;
+       if (mode & SMODE_TRANSPORT_STREAM)
+               chan->HWState = HWSTATE_RUN;
+       else
+               chan->HWState = HWSTATE_STARTUP;
+       spin_unlock_irq(&chan->state_lock);
+
+       if (ngene_command(dev, &com) < 0) {
+               up(&dev->stream_mutex);
+               return -1;
+       }
+       up(&dev->stream_mutex);
+       return 0;
+}
+
+
+/****************************************************************************/
+/* I2C **********************************************************************/
+/****************************************************************************/
+
+static void ngene_i2c_set_bus(struct ngene *dev, int bus)
+{
+       if (!(dev->card_info->i2c_access & 2))
+               return;
+       if (dev->i2c_current_bus == bus)
+               return;
+
+       switch (bus) {
+       case 0:
+               ngene_command_gpio_set(dev, 3, 0);
+               ngene_command_gpio_set(dev, 2, 1);
+               break;
+
+       case 1:
+               ngene_command_gpio_set(dev, 2, 0);
+               ngene_command_gpio_set(dev, 3, 1);
+               break;
+       }
+       dev->i2c_current_bus = bus;
+}
+
+static int ngene_i2c_master_xfer(struct i2c_adapter *adapter,
+                                struct i2c_msg msg[], int num)
+{
+       struct ngene_channel *chan =
+               (struct ngene_channel *)i2c_get_adapdata(adapter);
+       struct ngene *dev = chan->dev;
+
+       down(&dev->i2c_switch_mutex);
+       ngene_i2c_set_bus(dev, chan->number);
+
+       if (num == 2 && msg[1].flags & I2C_M_RD && !(msg[0].flags & I2C_M_RD))
+               if (!ngene_command_i2c_read(dev, msg[0].addr,
+                                           msg[0].buf, msg[0].len,
+                                           msg[1].buf, msg[1].len, 0))
+                       goto done;
+
+       if (num == 1 && !(msg[0].flags & I2C_M_RD))
+               if (!ngene_command_i2c_write(dev, msg[0].addr,
+                                            msg[0].buf, msg[0].len))
+                       goto done;
+       if (num == 1 && (msg[0].flags & I2C_M_RD))
+               if (!ngene_command_i2c_read(dev, msg[0].addr, 0, 0,
+                                           msg[0].buf, msg[0].len, 0))
+                       goto done;
+
+       up(&dev->i2c_switch_mutex);
+       return -EIO;
+
+done:
+       up(&dev->i2c_switch_mutex);
+       return num;
+}
+
+
+static u32 ngene_i2c_functionality(struct i2c_adapter *adap)
+{
+       return I2C_FUNC_SMBUS_EMUL;
+}
+
+static struct i2c_algorithm ngene_i2c_algo = {
+       .master_xfer = ngene_i2c_master_xfer,
+       .functionality = ngene_i2c_functionality,
+};
+
+static int ngene_i2c_init(struct ngene *dev, int dev_nr)
+{
+       struct i2c_adapter *adap = &(dev->channel[dev_nr].i2c_adapter);
+
+       i2c_set_adapdata(adap, &(dev->channel[dev_nr]));
+       adap->class = I2C_CLASS_TV_DIGITAL | I2C_CLASS_TV_ANALOG;
+
+       strcpy(adap->name, "nGene");
+
+       adap->algo = &ngene_i2c_algo;
+       adap->algo_data = (void *)&(dev->channel[dev_nr]);
+       adap->dev.parent = &dev->pci_dev->dev;
+
+       return i2c_add_adapter(adap);
+}
+
+
+/****************************************************************************/
+/* DVB functions and API interface ******************************************/
+/****************************************************************************/
+
+static void swap_buffer(u32 *p, u32 len)
+{
+       while (len) {
+               *p = swab32(*p);
+               p++;
+               len -= 4;
+       }
+}
+
+
+static void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
+{
+       struct ngene_channel *chan = priv;
+
+
+#ifdef COMMAND_TIMEOUT_WORKAROUND
+       if (chan->users > 0)
+#endif
+               dvb_dmx_swfilter(&chan->demux, buf, len);
+       return 0;
+}
+
+u8 fill_ts[188] = { 0x47, 0x1f, 0xff, 0x10 };
+
+static void *tsout_exchange(void *priv, void *buf, u32 len,
+                           u32 clock, u32 flags)
+{
+       struct ngene_channel *chan = priv;
+       struct ngene *dev = chan->dev;
+       u32 alen;
+
+       alen = dvb_ringbuffer_avail(&dev->tsout_rbuf);
+       alen -= alen % 188;
+
+       if (alen < len)
+               FillTSBuffer(buf + alen, len - alen, flags);
+       else
+               alen = len;
+       dvb_ringbuffer_read(&dev->tsout_rbuf, buf, alen);
+       if (flags & DF_SWAP32)
+               swap_buffer((u32 *)buf, alen);
+       wake_up_interruptible(&dev->tsout_rbuf.queue);
+       return buf;
+}
+
+
+static void set_transfer(struct ngene_channel *chan, int state)
+{
+       u8 control = 0, mode = 0, flags = 0;
+       struct ngene *dev = chan->dev;
+       int ret;
+
+       /*
+       printk(KERN_INFO DEVICE_NAME ": st %d\n", state);
+       msleep(100);
+       */
+
+       if (state) {
+               if (chan->running) {
+                       printk(KERN_INFO DEVICE_NAME ": already running\n");
+                       return;
+               }
+       } else {
+               if (!chan->running) {
+                       printk(KERN_INFO DEVICE_NAME ": already stopped\n");
+                       return;
+               }
+       }
+
+       if (dev->card_info->switch_ctrl)
+               dev->card_info->switch_ctrl(chan, 1, state ^ 1);
+
+       if (state) {
+               spin_lock_irq(&chan->state_lock);
+
+               /* printk(KERN_INFO DEVICE_NAME ": lock=%08x\n",
+                         ngreadl(0x9310)); */
+               dvb_ringbuffer_flush(&dev->tsout_rbuf);
+               control = 0x80;
+               if (chan->mode & (NGENE_IO_TSIN | NGENE_IO_TSOUT)) {
+                       chan->Capture1Length = 512 * 188;
+                       mode = SMODE_TRANSPORT_STREAM;
+               }
+               if (chan->mode & NGENE_IO_TSOUT) {
+                       chan->pBufferExchange = tsout_exchange;
+                       /* 0x66666666 = 50MHz *2^33 /250MHz */
+                       chan->AudioDTOValue = 0x66666666;
+                       /* set_dto(chan, 38810700+1000); */
+                       /* set_dto(chan, 19392658); */
+               }
+               if (chan->mode & NGENE_IO_TSIN)
+                       chan->pBufferExchange = tsin_exchange;
+               /* ngwritel(0, 0x9310); */
+               spin_unlock_irq(&chan->state_lock);
+       } else
+               ;/* printk(KERN_INFO DEVICE_NAME ": lock=%08x\n",
+                          ngreadl(0x9310)); */
+
+       ret = ngene_command_stream_control(dev, chan->number,
+                                          control, mode, flags);
+       if (!ret)
+               chan->running = state;
+       else
+               printk(KERN_ERR DEVICE_NAME ": set_transfer %d failed\n",
+                      state);
+       if (!state) {
+               spin_lock_irq(&chan->state_lock);
+               chan->pBufferExchange = 0;
+               dvb_ringbuffer_flush(&dev->tsout_rbuf);
+               spin_unlock_irq(&chan->state_lock);
+       }
+}
+
+static int ngene_start_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+       struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
+       struct ngene_channel *chan = dvbdmx->priv;
+
+       if (chan->users == 0) {
+#ifdef COMMAND_TIMEOUT_WORKAROUND
+               if (!chan->running)
+#endif
+                       set_transfer(chan, 1);
+               /* msleep(10); */
+       }
+
+       return ++chan->users;
+}
+
+static int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+       struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
+       struct ngene_channel *chan = dvbdmx->priv;
+
+       if (--chan->users)
+               return chan->users;
+
+#ifndef COMMAND_TIMEOUT_WORKAROUND
+       set_transfer(chan, 0);
+#endif
+
+       return 0;
+}
+
+
+
+static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id,
+                                  int (*start_feed)(struct dvb_demux_feed *),
+                                  int (*stop_feed)(struct dvb_demux_feed *),
+                                  void *priv)
+{
+       dvbdemux->priv = priv;
+
+       dvbdemux->filternum = 256;
+       dvbdemux->feednum = 256;
+       dvbdemux->start_feed = start_feed;
+       dvbdemux->stop_feed = stop_feed;
+       dvbdemux->write_to_decoder = 0;
+       dvbdemux->dmx.capabilities = (DMX_TS_FILTERING |
+                                     DMX_SECTION_FILTERING |
+                                     DMX_MEMORY_BASED_FILTERING);
+       return dvb_dmx_init(dvbdemux);
+}
+
+static int my_dvb_dmxdev_ts_card_init(struct dmxdev *dmxdev,
+                                     struct dvb_demux *dvbdemux,
+                                     struct dmx_frontend *hw_frontend,
+                                     struct dmx_frontend *mem_frontend,
+                                     struct dvb_adapter *dvb_adapter)
+{
+       int ret;
+
+       dmxdev->filternum = 256;
+       dmxdev->demux = &dvbdemux->dmx;
+       dmxdev->capabilities = 0;
+       ret = dvb_dmxdev_init(dmxdev, dvb_adapter);
+       if (ret < 0)
+               return ret;
+
+       hw_frontend->source = DMX_FRONTEND_0;
+       dvbdemux->dmx.add_frontend(&dvbdemux->dmx, hw_frontend);
+       mem_frontend->source = DMX_MEMORY_FE;
+       dvbdemux->dmx.add_frontend(&dvbdemux->dmx, mem_frontend);
+       return dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, hw_frontend);
+}
+
+
+/****************************************************************************/
+/* nGene hardware init and release functions ********************************/
+/****************************************************************************/
+
+static void free_ringbuffer(struct ngene *dev, struct SRingBufferDescriptor *rb)
+{
+       struct SBufferHeader *Cur = rb->Head;
+       u32 j;
+
+       if (!Cur)
+               return;
+
+       for (j = 0; j < rb->NumBuffers; j++, Cur = Cur->Next) {
+               if (Cur->Buffer1)
+                       pci_free_consistent(dev->pci_dev,
+                                           rb->Buffer1Length,
+                                           Cur->Buffer1,
+                                           Cur->scList1->Address);
+
+               if (Cur->Buffer2)
+                       pci_free_consistent(dev->pci_dev,
+                                           rb->Buffer2Length,
+                                           Cur->Buffer2,
+                                           Cur->scList2->Address);
+       }
+
+       if (rb->SCListMem)
+               pci_free_consistent(dev->pci_dev, rb->SCListMemSize,
+                                   rb->SCListMem, rb->PASCListMem);
+
+       pci_free_consistent(dev->pci_dev, rb->MemSize, rb->Head, rb->PAHead);
+}
+
+static void free_idlebuffer(struct ngene *dev,
+                    struct SRingBufferDescriptor *rb,
+                    struct SRingBufferDescriptor *tb)
+{
+       int j;
+       struct SBufferHeader *Cur = tb->Head;
+
+       if (!rb->Head)
+               return;
+       free_ringbuffer(dev, rb);
+       for (j = 0; j < tb->NumBuffers; j++, Cur = Cur->Next) {
+               Cur->Buffer2 = 0;
+               Cur->scList2 = 0;
+               Cur->ngeneBuffer.Address_of_first_entry_2 = 0;
+               Cur->ngeneBuffer.Number_of_entries_2 = 0;
+       }
+}
+
+static void free_common_buffers(struct ngene *dev)
+{
+       u32 i;
+       struct ngene_channel *chan;
+
+       for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) {
+               chan = &dev->channel[i];
+               free_idlebuffer(dev, &chan->TSIdleBuffer, &chan->TSRingBuffer);
+               free_ringbuffer(dev, &chan->RingBuffer);
+               free_ringbuffer(dev, &chan->TSRingBuffer);
+       }
+
+       if (dev->OverflowBuffer)
+               pci_free_consistent(dev->pci_dev,
+                                   OVERFLOW_BUFFER_SIZE,
+                                   dev->OverflowBuffer, dev->PAOverflowBuffer);
+
+       if (dev->FWInterfaceBuffer)
+               pci_free_consistent(dev->pci_dev,
+                                   4096,
+                                   dev->FWInterfaceBuffer,
+                                   dev->PAFWInterfaceBuffer);
+}
+
+/****************************************************************************/
+/* Ring buffer handling *****************************************************/
+/****************************************************************************/
+
+static int create_ring_buffer(struct pci_dev *pci_dev,
+                      struct SRingBufferDescriptor *descr, u32 NumBuffers)
+{
+       dma_addr_t tmp;
+       struct SBufferHeader *Head;
+       u32 i;
+       u32 MemSize = SIZEOF_SBufferHeader * NumBuffers;
+       u64 PARingBufferHead;
+       u64 PARingBufferCur;
+       u64 PARingBufferNext;
+       struct SBufferHeader *Cur, *Next;
+
+       descr->Head = 0;
+       descr->MemSize = 0;
+       descr->PAHead = 0;
+       descr->NumBuffers = 0;
+
+       if (MemSize < 4096)
+               MemSize = 4096;
+
+       Head = pci_alloc_consistent(pci_dev, MemSize, &tmp);
+       PARingBufferHead = tmp;
+
+       if (!Head)
+               return -ENOMEM;
+
+       memset(Head, 0, MemSize);
+
+       PARingBufferCur = PARingBufferHead;
+       Cur = Head;
+
+       for (i = 0; i < NumBuffers - 1; i++) {
+               Next = (struct SBufferHeader *)
+                       (((u8 *) Cur) + SIZEOF_SBufferHeader);
+               PARingBufferNext = PARingBufferCur + SIZEOF_SBufferHeader;
+               Cur->Next = Next;
+               Cur->ngeneBuffer.Next = PARingBufferNext;
+               Cur = Next;
+               PARingBufferCur = PARingBufferNext;
+       }
+       /* Last Buffer points back to first one */
+       Cur->Next = Head;
+       Cur->ngeneBuffer.Next = PARingBufferHead;
+
+       descr->Head       = Head;
+       descr->MemSize    = MemSize;
+       descr->PAHead     = PARingBufferHead;
+       descr->NumBuffers = NumBuffers;
+
+       return 0;
+}
+
+static int AllocateRingBuffers(struct pci_dev *pci_dev,
+                              dma_addr_t of,
+                              struct SRingBufferDescriptor *pRingBuffer,
+                              u32 Buffer1Length, u32 Buffer2Length)
+{
+       dma_addr_t tmp;
+       u32 i, j;
+       int status = 0;
+       u32 SCListMemSize = pRingBuffer->NumBuffers
+               * ((Buffer2Length != 0) ? (NUM_SCATTER_GATHER_ENTRIES * 2) :
+                   NUM_SCATTER_GATHER_ENTRIES)
+               * sizeof(struct HW_SCATTER_GATHER_ELEMENT);
+
+       u64 PASCListMem;
+       struct HW_SCATTER_GATHER_ELEMENT *SCListEntry;
+       u64 PASCListEntry;
+       struct SBufferHeader *Cur;
+       void *SCListMem;
+
+       if (SCListMemSize < 4096)
+               SCListMemSize = 4096;
+
+       SCListMem = pci_alloc_consistent(pci_dev, SCListMemSize, &tmp);
+
+       PASCListMem = tmp;
+       if (SCListMem == NULL)
+               return -ENOMEM;
+
+       memset(SCListMem, 0, SCListMemSize);
+
+       pRingBuffer->SCListMem = SCListMem;
+       pRingBuffer->PASCListMem = PASCListMem;
+       pRingBuffer->SCListMemSize = SCListMemSize;
+       pRingBuffer->Buffer1Length = Buffer1Length;
+       pRingBuffer->Buffer2Length = Buffer2Length;
+
+       SCListEntry = SCListMem;
+       PASCListEntry = PASCListMem;
+       Cur = pRingBuffer->Head;
+
+       for (i = 0; i < pRingBuffer->NumBuffers; i += 1, Cur = Cur->Next) {
+               u64 PABuffer;
+
+               void *Buffer = pci_alloc_consistent(pci_dev, Buffer1Length,
+                                                   &tmp);
+               PABuffer = tmp;
+
+               if (Buffer == NULL)
+                       return -ENOMEM;
+
+               Cur->Buffer1 = Buffer;
+
+               SCListEntry->Address = PABuffer;
+               SCListEntry->Length  = Buffer1Length;
+
+               Cur->scList1 = SCListEntry;
+               Cur->ngeneBuffer.Address_of_first_entry_1 = PASCListEntry;
+               Cur->ngeneBuffer.Number_of_entries_1 =
+                       NUM_SCATTER_GATHER_ENTRIES;
+
+               SCListEntry += 1;
+               PASCListEntry += sizeof(struct HW_SCATTER_GATHER_ELEMENT);
+
+#if NUM_SCATTER_GATHER_ENTRIES > 1
+               for (j = 0; j < NUM_SCATTER_GATHER_ENTRIES - 1; j += 1) {
+                       SCListEntry->Address = of;
+                       SCListEntry->Length = OVERFLOW_BUFFER_SIZE;
+                       SCListEntry += 1;
+                       PASCListEntry +=
+                               sizeof(struct HW_SCATTER_GATHER_ELEMENT);
+               }
+#endif
+
+               if (!Buffer2Length)
+                       continue;
+
+               Buffer = pci_alloc_consistent(pci_dev, Buffer2Length, &tmp);
+               PABuffer = tmp;
+
+               if (Buffer == NULL)
+                       return -ENOMEM;
+
+               Cur->Buffer2 = Buffer;
+
+               SCListEntry->Address = PABuffer;
+               SCListEntry->Length  = Buffer2Length;
+
+               Cur->scList2 = SCListEntry;
+               Cur->ngeneBuffer.Address_of_first_entry_2 = PASCListEntry;
+               Cur->ngeneBuffer.Number_of_entries_2 =
+                       NUM_SCATTER_GATHER_ENTRIES;
+
+               SCListEntry   += 1;
+               PASCListEntry += sizeof(struct HW_SCATTER_GATHER_ELEMENT);
+
+#if NUM_SCATTER_GATHER_ENTRIES > 1
+               for (j = 0; j < NUM_SCATTER_GATHER_ENTRIES - 1; j++) {
+                       SCListEntry->Address = of;
+                       SCListEntry->Length = OVERFLOW_BUFFER_SIZE;
+                       SCListEntry += 1;
+                       PASCListEntry +=
+                               sizeof(struct HW_SCATTER_GATHER_ELEMENT);
+               }
+#endif
+
+       }
+
+       return status;
+}
+
+static int FillTSIdleBuffer(struct SRingBufferDescriptor *pIdleBuffer,
+                           struct SRingBufferDescriptor *pRingBuffer)
+{
+       int status = 0;
+
+       /* Copy pointer to scatter gather list in TSRingbuffer
+          structure for buffer 2
+          Load number of buffer
+       */
+       u32 n = pRingBuffer->NumBuffers;
+
+       /* Point to first buffer entry */
+       struct SBufferHeader *Cur = pRingBuffer->Head;
+       int i;
+       /* Loop thru all buffer and set Buffer 2 pointers to TSIdlebuffer */
+       for (i = 0; i < n; i++) {
+               Cur->Buffer2 = pIdleBuffer->Head->Buffer1;
+               Cur->scList2 = pIdleBuffer->Head->scList1;
+               Cur->ngeneBuffer.Address_of_first_entry_2 =
+                       pIdleBuffer->Head->ngeneBuffer.
+                       Address_of_first_entry_1;
+               Cur->ngeneBuffer.Number_of_entries_2 =
+                       pIdleBuffer->Head->ngeneBuffer.Number_of_entries_1;
+               Cur = Cur->Next;
+       }
+       return status;
+}
+
+static u32 RingBufferSizes[MAX_STREAM] = {
+       RING_SIZE_VIDEO,
+       RING_SIZE_VIDEO,
+       RING_SIZE_AUDIO,
+       RING_SIZE_AUDIO,
+       RING_SIZE_AUDIO,
+};
+
+static u32 Buffer1Sizes[MAX_STREAM] = {
+       MAX_VIDEO_BUFFER_SIZE,
+       MAX_VIDEO_BUFFER_SIZE,
+       MAX_AUDIO_BUFFER_SIZE,
+       MAX_AUDIO_BUFFER_SIZE,
+       MAX_AUDIO_BUFFER_SIZE
+};
+
+static u32 Buffer2Sizes[MAX_STREAM] = {
+       MAX_VBI_BUFFER_SIZE,
+       MAX_VBI_BUFFER_SIZE,
+       0,
+       0,
+       0
+};
+
+
+static int AllocCommonBuffers(struct ngene *dev)
+{
+       int status = 0, i;
+
+       dev->FWInterfaceBuffer = pci_alloc_consistent(dev->pci_dev, 4096,
+                                                    &dev->PAFWInterfaceBuffer);
+       if (!dev->FWInterfaceBuffer)
+               return -ENOMEM;
+       dev->hosttongene = dev->FWInterfaceBuffer;
+       dev->ngenetohost = dev->FWInterfaceBuffer + 256;
+       dev->EventBuffer = dev->FWInterfaceBuffer + 512;
+
+       dev->OverflowBuffer = pci_alloc_consistent(dev->pci_dev,
+                                                  OVERFLOW_BUFFER_SIZE,
+                                                  &dev->PAOverflowBuffer);
+       if (!dev->OverflowBuffer)
+               return -ENOMEM;
+       memset(dev->OverflowBuffer, 0, OVERFLOW_BUFFER_SIZE);
+
+       for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) {
+               int type = dev->card_info->io_type[i];
+
+               dev->channel[i].State = KSSTATE_STOP;
+
+               if (type & (NGENE_IO_TV | NGENE_IO_HDTV | NGENE_IO_AIN)) {
+                       status = create_ring_buffer(dev->pci_dev,
+                                                   &dev->channel[i].RingBuffer,
+                                                   RingBufferSizes[i]);
+                       if (status < 0)
+                               break;
+
+                       if (type & (NGENE_IO_TV | NGENE_IO_AIN)) {
+                               status = AllocateRingBuffers(dev->pci_dev,
+                                                            dev->
+                                                            PAOverflowBuffer,
+                                                            &dev->channel[i].
+                                                            RingBuffer,
+                                                            Buffer1Sizes[i],
+                                                            Buffer2Sizes[i]);
+                               if (status < 0)
+                                       break;
+                       } else if (type & NGENE_IO_HDTV) {
+                               status = AllocateRingBuffers(dev->pci_dev,
+                                                            dev->
+                                                            PAOverflowBuffer,
+                                                            &dev->channel[i].
+                                                            RingBuffer,
+                                                          MAX_HDTV_BUFFER_SIZE,
+                                                            0);
+                               if (status < 0)
+                                       break;
+                       }
+               }
+
+               if (type & (NGENE_IO_TSIN | NGENE_IO_TSOUT)) {
+
+                       status = create_ring_buffer(dev->pci_dev,
+                                                   &dev->channel[i].
+                                                   TSRingBuffer, RING_SIZE_TS);
+                       if (status < 0)
+                               break;
+
+                       status = AllocateRingBuffers(dev->pci_dev,
+                                                    dev->PAOverflowBuffer,
+                                                    &dev->channel[i].
+                                                    TSRingBuffer,
+                                                    MAX_TS_BUFFER_SIZE, 0);
+                       if (status)
+                               break;
+               }
+
+               if (type & NGENE_IO_TSOUT) {
+                       status = create_ring_buffer(dev->pci_dev,
+                                                   &dev->channel[i].
+                                                   TSIdleBuffer, 1);
+                       if (status < 0)
+                               break;
+                       status = AllocateRingBuffers(dev->pci_dev,
+                                                    dev->PAOverflowBuffer,
+                                                    &dev->channel[i].
+                                                    TSIdleBuffer,
+                                                    MAX_TS_BUFFER_SIZE, 0);
+                       if (status)
+                               break;
+                       FillTSIdleBuffer(&dev->channel[i].TSIdleBuffer,
+                                        &dev->channel[i].TSRingBuffer);
+               }
+       }
+       return status;
+}
+
+static void ngene_release_buffers(struct ngene *dev)
+{
+       if (dev->iomem)
+               iounmap(dev->iomem);
+       free_common_buffers(dev);
+       vfree(dev->tsout_buf);
+       vfree(dev->ain_buf);
+       vfree(dev->vin_buf);
+       vfree(dev);
+}
+
+static int ngene_get_buffers(struct ngene *dev)
+{
+       if (AllocCommonBuffers(dev))
+               return -ENOMEM;
+       if (dev->card_info->io_type[4] & NGENE_IO_TSOUT) {
+               dev->tsout_buf = vmalloc(TSOUT_BUF_SIZE);
+               if (!dev->tsout_buf)
+                       return -ENOMEM;
+               dvb_ringbuffer_init(&dev->tsout_rbuf,
+                                   dev->tsout_buf, TSOUT_BUF_SIZE);
+       }
+       if (dev->card_info->io_type[2] & NGENE_IO_AIN) {
+               dev->ain_buf = vmalloc(AIN_BUF_SIZE);
+               if (!dev->ain_buf)
+                       return -ENOMEM;
+               dvb_ringbuffer_init(&dev->ain_rbuf, dev->ain_buf, AIN_BUF_SIZE);
+       }
+       if (dev->card_info->io_type[0] & NGENE_IO_HDTV) {
+               dev->vin_buf = vmalloc(VIN_BUF_SIZE);
+               if (!dev->vin_buf)
+                       return -ENOMEM;
+               dvb_ringbuffer_init(&dev->vin_rbuf, dev->vin_buf, VIN_BUF_SIZE);
+       }
+       dev->iomem = ioremap(pci_resource_start(dev->pci_dev, 0),
+                            pci_resource_len(dev->pci_dev, 0));
+       if (!dev->iomem)
+               return -ENOMEM;
+
+       return 0;
+}
+
+static void ngene_init(struct ngene *dev)
+{
+       int i;
+
+       tasklet_init(&dev->event_tasklet, event_tasklet, (unsigned long)dev);
+
+       memset_io(dev->iomem + 0xc000, 0x00, 0x220);
+       memset_io(dev->iomem + 0xc400, 0x00, 0x100);
+
+       for (i = 0; i < MAX_STREAM; i++) {
+               dev->channel[i].dev = dev;
+               dev->channel[i].number = i;
+       }
+
+       dev->fw_interface_version = 0;
+
+       ngwritel(0, NGENE_INT_ENABLE);
+
+       dev->icounts = ngreadl(NGENE_INT_COUNTS);
+
+       dev->device_version = ngreadl(DEV_VER) & 0x0f;
+       printk(KERN_INFO DEVICE_NAME ": Device version %d\n",
+              dev->device_version);
+}
+
+static int ngene_load_firm(struct ngene *dev)
+{
+       u32 size;
+       const struct firmware *fw = NULL;
+       u8 *ngene_fw;
+       char *fw_name;
+       int err, version;
+
+       version = dev->card_info->fw_version;
+
+       switch (version) {
+       default:
+       case 15:
+               version = 15;
+               size = 23466;
+               fw_name = "ngene_15.fw";
+               break;
+       case 16:
+               size = 23498;
+               fw_name = "ngene_16.fw";
+               break;
+       case 17:
+               size = 24446;
+               fw_name = "ngene_17.fw";
+               break;
+       }
+
+       if (request_firmware(&fw, fw_name, &dev->pci_dev->dev) < 0) {
+               printk(KERN_ERR DEVICE_NAME
+                       ": Could not load firmware file %s.\n", fw_name);
+               printk(KERN_INFO DEVICE_NAME
+                       ": Copy %s to your hotplug directory!\n", fw_name);
+               return -1;
+       }
+       if (size != fw->size) {
+               printk(KERN_ERR DEVICE_NAME
+                       ": Firmware %s has invalid size!", fw_name);
+               err = -1;
+       } else {
+               printk(KERN_INFO DEVICE_NAME
+                       ": Loading firmware file %s.\n", fw_name);
+               ngene_fw = (u8 *) fw->data;
+               err = ngene_command_load_firmware(dev, ngene_fw, size);
+       }
+
+       release_firmware(fw);
+
+       return err;
+}
+
+static void ngene_stop(struct ngene *dev)
+{
+       down(&dev->cmd_mutex);
+       i2c_del_adapter(&(dev->channel[0].i2c_adapter));
+       i2c_del_adapter(&(dev->channel[1].i2c_adapter));
+       ngwritel(0, NGENE_INT_ENABLE);
+       ngwritel(0, NGENE_COMMAND);
+       ngwritel(0, NGENE_COMMAND_HI);
+       ngwritel(0, NGENE_STATUS);
+       ngwritel(0, NGENE_STATUS_HI);
+       ngwritel(0, NGENE_EVENT);
+       ngwritel(0, NGENE_EVENT_HI);
+       free_irq(dev->pci_dev->irq, dev);
+}
+
+static int ngene_start(struct ngene *dev)
+{
+       int stat;
+       int i;
+
+       pci_set_master(dev->pci_dev);
+       ngene_init(dev);
+
+       stat = request_irq(dev->pci_dev->irq, irq_handler,
+                          IRQF_SHARED, "nGene",
+                          (void *)dev);
+       if (stat < 0)
+               return stat;
+
+       init_waitqueue_head(&dev->cmd_wq);
+       init_waitqueue_head(&dev->tx_wq);
+       init_waitqueue_head(&dev->rx_wq);
+       sema_init(&dev->cmd_mutex, 1);
+       sema_init(&dev->stream_mutex, 1);
+       sema_init(&dev->pll_mutex, 1);
+       sema_init(&dev->i2c_switch_mutex, 1);
+       spin_lock_init(&dev->cmd_lock);
+       for (i = 0; i < MAX_STREAM; i++)
+               spin_lock_init(&dev->channel[i].state_lock);
+       ngwritel(1, TIMESTAMPS);
+
+       ngwritel(1, NGENE_INT_ENABLE);
+
+       stat = ngene_load_firm(dev);
+       if (stat < 0)
+               goto fail;
+
+       stat = ngene_i2c_init(dev, 0);
+       if (stat < 0)
+               goto fail;
+
+       stat = ngene_i2c_init(dev, 1);
+       if (stat < 0)
+               goto fail;
+
+       if (dev->card_info->fw_version == 17) {
+               u8 tsin4_config[6] = {
+                       3072 / 64, 3072 / 64, 0, 3072 / 64, 3072 / 64, 0};
+               u8 default_config[6] = {
+                       4096 / 64, 4096 / 64, 0, 2048 / 64, 2048 / 64, 0};
+               u8 *bconf = default_config;
+
+               if (dev->card_info->io_type[3] == NGENE_IO_TSIN)
+                       bconf = tsin4_config;
+               dprintk(KERN_DEBUG DEVICE_NAME ": FW 17 buffer config\n");
+               stat = ngene_command_config_free_buf(dev, bconf);
+       } else {
+               int bconf = BUFFER_CONFIG_4422;
+               if (dev->card_info->io_type[3] == NGENE_IO_TSIN)
+                       bconf = BUFFER_CONFIG_3333;
+               stat = ngene_command_config_buf(dev, bconf);
+       }
+       return stat;
+fail:
+       ngwritel(0, NGENE_INT_ENABLE);
+       free_irq(dev->pci_dev->irq, dev);
+       return stat;
+}
+
+
+
+/****************************************************************************/
+/* Switch control (I2C gates, etc.) *****************************************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/* Demod/tuner attachment ***************************************************/
+/****************************************************************************/
+
+static int tuner_attach_stv6110(struct ngene_channel *chan)
+{
+       struct stv090x_config *feconf = (struct stv090x_config *)
+               chan->dev->card_info->fe_config[chan->number];
+       struct stv6110x_config *tunerconf = (struct stv6110x_config *)
+               chan->dev->card_info->tuner_config[chan->number];
+       struct stv6110x_devctl *ctl;
+
+       ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf,
+                        &chan->i2c_adapter);
+       if (ctl == NULL) {
+               printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n");
+               return -ENODEV;
+       }
+
+       feconf->tuner_init          = ctl->tuner_init;
+       feconf->tuner_set_mode      = ctl->tuner_set_mode;
+       feconf->tuner_set_frequency = ctl->tuner_set_frequency;
+       feconf->tuner_get_frequency = ctl->tuner_get_frequency;
+       feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth;
+       feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth;
+       feconf->tuner_set_bbgain    = ctl->tuner_set_bbgain;
+       feconf->tuner_get_bbgain    = ctl->tuner_get_bbgain;
+       feconf->tuner_set_refclk    = ctl->tuner_set_refclk;
+       feconf->tuner_get_status    = ctl->tuner_get_status;
+
+       return 0;
+}
+
+
+static int demod_attach_stv0900(struct ngene_channel *chan)
+{
+       struct stv090x_config *feconf = (struct stv090x_config *)
+               chan->dev->card_info->fe_config[chan->number];
+
+       chan->fe = dvb_attach(stv090x_attach,
+                       feconf,
+                       &chan->i2c_adapter,
+                       chan->number == 0 ? STV090x_DEMODULATOR_0 :
+                                           STV090x_DEMODULATOR_1);
+       if (chan->fe == NULL) {
+               printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n");
+               return -ENODEV;
+       }
+
+       if (!dvb_attach(lnbh24_attach, chan->fe, &chan->i2c_adapter, 0,
+                       0, chan->dev->card_info->lnb[chan->number])) {
+               printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n");
+               dvb_frontend_detach(chan->fe);
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+static void release_channel(struct ngene_channel *chan)
+{
+       struct dvb_demux *dvbdemux = &chan->demux;
+       struct ngene *dev = chan->dev;
+       struct ngene_info *ni = dev->card_info;
+       int io = ni->io_type[chan->number];
+
+#ifdef COMMAND_TIMEOUT_WORKAROUND
+       if (chan->running)
+               set_transfer(chan, 0);
+#endif
+
+       tasklet_kill(&chan->demux_tasklet);
+
+       if (io & (NGENE_IO_TSIN | NGENE_IO_TSOUT)) {
+               if (chan->fe) {
+                       dvb_unregister_frontend(chan->fe);
+                       dvb_frontend_detach(chan->fe);
+                       chan->fe = 0;
+               }
+               dvbdemux->dmx.close(&dvbdemux->dmx);
+               dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
+                                             &chan->hw_frontend);
+               dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
+                                             &chan->mem_frontend);
+               dvb_dmxdev_release(&chan->dmxdev);
+               dvb_dmx_release(&chan->demux);
+
+               if (chan->number == 0 || !one_adapter)
+                       dvb_unregister_adapter(&dev->adapter[chan->number]);
+       }
+}
+
+static int init_channel(struct ngene_channel *chan)
+{
+       int ret = 0, nr = chan->number;
+       struct dvb_adapter *adapter = NULL;
+       struct dvb_demux *dvbdemux = &chan->demux;
+       struct ngene *dev = chan->dev;
+       struct ngene_info *ni = dev->card_info;
+       int io = ni->io_type[nr];
+
+       tasklet_init(&chan->demux_tasklet, demux_tasklet, (unsigned long)chan);
+       chan->users = 0;
+       chan->type = io;
+       chan->mode = chan->type;        /* for now only one mode */
+
+       if (io & (NGENE_IO_TSIN | NGENE_IO_TSOUT)) {
+               if (nr >= STREAM_AUDIOIN1)
+                       chan->DataFormatFlags = DF_SWAP32;
+               if (nr == 0 || !one_adapter) {
+                       adapter = &dev->adapter[nr];
+                       ret = dvb_register_adapter(adapter, "nGene",
+                                                  THIS_MODULE,
+                                                  &chan->dev->pci_dev->dev,
+                                                  adapter_nr);
+                       if (ret < 0)
+                               return ret;
+               } else {
+                       adapter = &dev->adapter[0];
+               }
+
+               ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux",
+                                             ngene_start_feed,
+                                             ngene_stop_feed, chan);
+               ret = my_dvb_dmxdev_ts_card_init(&chan->dmxdev, &chan->demux,
+                                                &chan->hw_frontend,
+                                                &chan->mem_frontend, adapter);
+       }
+
+       if (io & NGENE_IO_TSIN) {
+               chan->fe = NULL;
+               if (ni->demod_attach[nr])
+                       ni->demod_attach[nr](chan);
+               if (chan->fe) {
+                       if (dvb_register_frontend(adapter, chan->fe) < 0) {
+                               if (chan->fe->ops.release)
+                                       chan->fe->ops.release(chan->fe);
+                               chan->fe = NULL;
+                       }
+               }
+               if (chan->fe && ni->tuner_attach[nr])
+                       if (ni->tuner_attach[nr] (chan) < 0) {
+                               printk(KERN_ERR DEVICE_NAME
+                                      ": Tuner attach failed on channel %d!\n",
+                                      nr);
+                       }
+       }
+       return ret;
+}
+
+static int init_channels(struct ngene *dev)
+{
+       int i, j;
+
+       for (i = 0; i < MAX_STREAM; i++) {
+               if (init_channel(&dev->channel[i]) < 0) {
+                       for (j = i - 1; j >= 0; j--)
+                               release_channel(&dev->channel[j]);
+                       return -1;
+               }
+       }
+       return 0;
+}
+
+/****************************************************************************/
+/* device probe/remove calls ************************************************/
+/****************************************************************************/
+
+static void __devexit ngene_remove(struct pci_dev *pdev)
+{
+       struct ngene *dev = (struct ngene *)pci_get_drvdata(pdev);
+       int i;
+
+       tasklet_kill(&dev->event_tasklet);
+       for (i = MAX_STREAM - 1; i >= 0; i--)
+               release_channel(&dev->channel[i]);
+       ngene_stop(dev);
+       ngene_release_buffers(dev);
+       pci_set_drvdata(pdev, 0);
+       pci_disable_device(pdev);
+}
+
+static int __devinit ngene_probe(struct pci_dev *pci_dev,
+                                const struct pci_device_id *id)
+{
+       struct ngene *dev;
+       int stat = 0;
+
+       if (pci_enable_device(pci_dev) < 0)
+               return -ENODEV;
+
+       dev = vmalloc(sizeof(struct ngene));
+       if (dev == NULL) {
+               stat = -ENOMEM;
+               goto fail0;
+       }
+       memset(dev, 0, sizeof(struct ngene));
+
+       dev->pci_dev = pci_dev;
+       dev->card_info = (struct ngene_info *)id->driver_data;
+       printk(KERN_INFO DEVICE_NAME ": Found %s\n", dev->card_info->name);
+
+       pci_set_drvdata(pci_dev, dev);
+
+       /* Alloc buffers and start nGene */
+       stat = ngene_get_buffers(dev);
+       if (stat < 0)
+               goto fail1;
+       stat = ngene_start(dev);
+       if (stat < 0)
+               goto fail1;
+
+       dev->i2c_current_bus = -1;
+
+       /* Register DVB adapters and devices for both channels */
+       if (init_channels(dev) < 0)
+               goto fail2;
+
+       return 0;
+
+fail2:
+       ngene_stop(dev);
+fail1:
+       ngene_release_buffers(dev);
+fail0:
+       pci_disable_device(pci_dev);
+       pci_set_drvdata(pci_dev, 0);
+       return stat;
+}
+
+/****************************************************************************/
+/* Card configs *************************************************************/
+/****************************************************************************/
+
+static struct stv090x_config fe_cineS2 = {
+       .device         = STV0900,
+       .demod_mode     = STV090x_DUAL,
+       .clk_mode       = STV090x_CLK_EXT,
+
+       .xtal           = 27000000,
+       .address        = 0x68,
+
+       .ts1_mode       = STV090x_TSMODE_SERIAL_PUNCTURED,
+       .ts2_mode       = STV090x_TSMODE_SERIAL_PUNCTURED,
+
+       .repeater_level = STV090x_RPTLEVEL_16,
+
+       .adc1_range     = STV090x_ADC_1Vpp,
+       .adc2_range     = STV090x_ADC_1Vpp,
+
+       .diseqc_envelope_mode = true,
+};
+
+static struct stv6110x_config tuner_cineS2_0 = {
+       .addr   = 0x60,
+       .refclk = 27000000,
+       .clk_div = 1,
+};
+
+static struct stv6110x_config tuner_cineS2_1 = {
+       .addr   = 0x63,
+       .refclk = 27000000,
+       .clk_div = 1,
+};
+
+static struct ngene_info ngene_info_cineS2 = {
+       .type           = NGENE_SIDEWINDER,
+       .name           = "Linux4Media cineS2 DVB-S2 Twin Tuner",
+       .io_type        = {NGENE_IO_TSIN, NGENE_IO_TSIN},
+       .demod_attach   = {demod_attach_stv0900, demod_attach_stv0900},
+       .tuner_attach   = {tuner_attach_stv6110, tuner_attach_stv6110},
+       .fe_config      = {&fe_cineS2, &fe_cineS2},
+       .tuner_config   = {&tuner_cineS2_0, &tuner_cineS2_1},
+       .lnb            = {0x0b, 0x08},
+       .tsf            = {3, 3},
+       .fw_version     = 15,
+};
+
+static struct ngene_info ngene_info_satixs2 = {
+       .type           = NGENE_SIDEWINDER,
+       .name           = "Mystique SaTiX-S2 Dual",
+       .io_type        = {NGENE_IO_TSIN, NGENE_IO_TSIN},
+       .demod_attach   = {demod_attach_stv0900, demod_attach_stv0900},
+       .tuner_attach   = {tuner_attach_stv6110, tuner_attach_stv6110},
+       .fe_config      = {&fe_cineS2, &fe_cineS2},
+       .tuner_config   = {&tuner_cineS2_0, &tuner_cineS2_1},
+       .lnb            = {0x0b, 0x08},
+       .tsf            = {3, 3},
+       .fw_version     = 15,
+};
+
+/****************************************************************************/
+
+
+
+/****************************************************************************/
+/* PCI Subsystem ID *********************************************************/
+/****************************************************************************/
+
+#define NGENE_ID(_subvend, _subdev, _driverdata) { \
+       .vendor = NGENE_VID, .device = NGENE_PID, \
+       .subvendor = _subvend, .subdevice = _subdev, \
+       .driver_data = (unsigned long) &_driverdata }
+
+/****************************************************************************/
+
+static const struct pci_device_id ngene_id_tbl[] __devinitdata = {
+       NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
+       NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
+       NGENE_ID(0x18c3, 0xdb01, ngene_info_satixs2),
+       {0}
+};
+MODULE_DEVICE_TABLE(pci, ngene_id_tbl);
+
+/****************************************************************************/
+/* Init/Exit ****************************************************************/
+/****************************************************************************/
+
+static pci_ers_result_t ngene_error_detected(struct pci_dev *dev,
+                                            enum pci_channel_state state)
+{
+       printk(KERN_ERR DEVICE_NAME ": PCI error\n");
+       if (state == pci_channel_io_perm_failure)
+               return PCI_ERS_RESULT_DISCONNECT;
+       if (state == pci_channel_io_frozen)
+               return PCI_ERS_RESULT_NEED_RESET;
+       return PCI_ERS_RESULT_CAN_RECOVER;
+}
+
+static pci_ers_result_t ngene_link_reset(struct pci_dev *dev)
+{
+       printk(KERN_INFO DEVICE_NAME ": link reset\n");
+       return 0;
+}
+
+static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev)
+{
+       printk(KERN_INFO DEVICE_NAME ": slot reset\n");
+       return 0;
+}
+
+static void ngene_resume(struct pci_dev *dev)
+{
+       printk(KERN_INFO DEVICE_NAME ": resume\n");
+}
+
+static struct pci_error_handlers ngene_errors = {
+       .error_detected = ngene_error_detected,
+       .link_reset = ngene_link_reset,
+       .slot_reset = ngene_slot_reset,
+       .resume = ngene_resume,
+};
+
+static struct pci_driver ngene_pci_driver = {
+       .name        = "ngene",
+       .id_table    = ngene_id_tbl,
+       .probe       = ngene_probe,
+       .remove      = __devexit_p(ngene_remove),
+       .err_handler = &ngene_errors,
+};
+
+static __init int module_init_ngene(void)
+{
+       printk(KERN_INFO
+              "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n");
+       return pci_register_driver(&ngene_pci_driver);
+}
+
+static __exit void module_exit_ngene(void)
+{
+       pci_unregister_driver(&ngene_pci_driver);
+}
+
+module_init(module_init_ngene);
+module_exit(module_exit_ngene);
+
+MODULE_DESCRIPTION("nGene");
+MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h
new file mode 100644 (file)
index 0000000..a7eb298
--- /dev/null
@@ -0,0 +1,859 @@
+/*
+ * ngene.h: nGene PCIe bridge driver
+ *
+ * Copyright (C) 2005-2007 Micronas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 only, as published by the Free Software Foundation.
+ *
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef _NGENE_H_
+#define _NGENE_H_
+
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <asm/dma.h>
+#include <linux/scatterlist.h>
+
+#include <linux/dvb/frontend.h>
+
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+#include "dvb_ringbuffer.h"
+
+#define NGENE_VID       0x18c3
+#define NGENE_PID       0x0720
+
+#ifndef VIDEO_CAP_VC1
+#define VIDEO_CAP_AVC   128
+#define VIDEO_CAP_H264  128
+#define VIDEO_CAP_VC1   256
+#define VIDEO_CAP_WMV9  256
+#define VIDEO_CAP_MPEG4 512
+#endif
+
+enum STREAM {
+       STREAM_VIDEOIN1 = 0,        /* ITU656 or TS Input */
+       STREAM_VIDEOIN2,
+       STREAM_AUDIOIN1,            /* I2S or SPI Input */
+       STREAM_AUDIOIN2,
+       STREAM_AUDIOOUT,
+       MAX_STREAM
+};
+
+enum SMODE_BITS {
+       SMODE_AUDIO_SPDIF = 0x20,
+       SMODE_AVSYNC = 0x10,
+       SMODE_TRANSPORT_STREAM = 0x08,
+       SMODE_AUDIO_CAPTURE = 0x04,
+       SMODE_VBI_CAPTURE = 0x02,
+       SMODE_VIDEO_CAPTURE = 0x01
+};
+
+enum STREAM_FLAG_BITS {
+       SFLAG_CHROMA_FORMAT_2COMP  = 0x01, /* Chroma Format : 2's complement */
+       SFLAG_CHROMA_FORMAT_OFFSET = 0x00, /* Chroma Format : Binary offset */
+       SFLAG_ORDER_LUMA_CHROMA    = 0x02, /* Byte order: Y,Cb,Y,Cr */
+       SFLAG_ORDER_CHROMA_LUMA    = 0x00, /* Byte order: Cb,Y,Cr,Y */
+       SFLAG_COLORBAR             = 0x04, /* Select colorbar */
+};
+
+#define PROGRAM_ROM     0x0000
+#define PROGRAM_SRAM    0x1000
+#define PERIPHERALS0    0x8000
+#define PERIPHERALS1    0x9000
+#define SHARED_BUFFER   0xC000
+
+#define HOST_TO_NGENE    (SHARED_BUFFER+0x0000)
+#define NGENE_TO_HOST    (SHARED_BUFFER+0x0100)
+#define NGENE_COMMAND    (SHARED_BUFFER+0x0200)
+#define NGENE_COMMAND_HI (SHARED_BUFFER+0x0204)
+#define NGENE_STATUS     (SHARED_BUFFER+0x0208)
+#define NGENE_STATUS_HI  (SHARED_BUFFER+0x020C)
+#define NGENE_EVENT      (SHARED_BUFFER+0x0210)
+#define NGENE_EVENT_HI   (SHARED_BUFFER+0x0214)
+#define VARIABLES        (SHARED_BUFFER+0x0210)
+
+#define NGENE_INT_COUNTS       (SHARED_BUFFER+0x0260)
+#define NGENE_INT_ENABLE       (SHARED_BUFFER+0x0264)
+#define NGENE_VBI_LINE_COUNT   (SHARED_BUFFER+0x0268)
+
+#define BUFFER_GP_XMIT  (SHARED_BUFFER+0x0800)
+#define BUFFER_GP_RECV  (SHARED_BUFFER+0x0900)
+#define EEPROM_AREA     (SHARED_BUFFER+0x0A00)
+
+#define SG_V_IN_1       (SHARED_BUFFER+0x0A80)
+#define SG_VBI_1        (SHARED_BUFFER+0x0B00)
+#define SG_A_IN_1       (SHARED_BUFFER+0x0B80)
+#define SG_V_IN_2       (SHARED_BUFFER+0x0C00)
+#define SG_VBI_2        (SHARED_BUFFER+0x0C80)
+#define SG_A_IN_2       (SHARED_BUFFER+0x0D00)
+#define SG_V_OUT        (SHARED_BUFFER+0x0D80)
+#define SG_A_OUT2       (SHARED_BUFFER+0x0E00)
+
+#define DATA_A_IN_1     (SHARED_BUFFER+0x0E80)
+#define DATA_A_IN_2     (SHARED_BUFFER+0x0F00)
+#define DATA_A_OUT      (SHARED_BUFFER+0x0F80)
+#define DATA_V_IN_1     (SHARED_BUFFER+0x1000)
+#define DATA_V_IN_2     (SHARED_BUFFER+0x2000)
+#define DATA_V_OUT      (SHARED_BUFFER+0x3000)
+
+#define DATA_FIFO_AREA  (SHARED_BUFFER+0x1000)
+
+#define TIMESTAMPS      0xA000
+#define SCRATCHPAD      0xA080
+#define FORCE_INT       0xA088
+#define FORCE_NMI       0xA090
+#define INT_STATUS      0xA0A0
+
+#define DEV_VER         0x9004
+
+#define FW_DEBUG_DEFAULT (PROGRAM_SRAM+0x00FF)
+
+struct SG_ADDR {
+       u64 start;
+       u64 curr;
+       u16 curr_ptr;
+       u16 elements;
+       u32 pad[3];
+} __attribute__ ((__packed__));
+
+struct SHARED_MEMORY {
+       /* C000 */
+       u32 HostToNgene[64];
+
+       /* C100 */
+       u32 NgeneToHost[64];
+
+       /* C200 */
+       u64 NgeneCommand;
+       u64 NgeneStatus;
+       u64 NgeneEvent;
+
+       /* C210 */
+       u8 pad1[0xc260 - 0xc218];
+
+       /* C260 */
+       u32 IntCounts;
+       u32 IntEnable;
+
+       /* C268 */
+       u8 pad2[0xd000 - 0xc268];
+
+} __attribute__ ((__packed__));
+
+struct BUFFER_STREAM_RESULTS {
+       u32 Clock;           /* Stream time in 100ns units */
+       u16 RemainingLines;  /* Remaining lines in this field.
+                               0 for complete field */
+       u8  FieldCount;      /* Video field number */
+       u8  Flags;           /* Bit 7 = Done, Bit 6 = seen, Bit 5 = overflow,
+                               Bit 0 = FieldID */
+       u16 BlockCount;      /* Audio block count (unused) */
+       u8  Reserved[2];
+       u32 DTOUpdate;
+} __attribute__ ((__packed__));
+
+struct HW_SCATTER_GATHER_ELEMENT {
+       u64 Address;
+       u32 Length;
+       u32 Reserved;
+} __attribute__ ((__packed__));
+
+struct BUFFER_HEADER {
+       u64    Next;
+       struct BUFFER_STREAM_RESULTS SR;
+
+       u32    Number_of_entries_1;
+       u32    Reserved5;
+       u64    Address_of_first_entry_1;
+
+       u32    Number_of_entries_2;
+       u32    Reserved7;
+       u64    Address_of_first_entry_2;
+} __attribute__ ((__packed__));
+
+struct EVENT_BUFFER {
+       u32    TimeStamp;
+       u8     GPIOStatus;
+       u8     UARTStatus;
+       u8     RXCharacter;
+       u8     EventStatus;
+       u32    Reserved[2];
+} __attribute__ ((__packed__));
+
+/* Firmware commands. */
+
+enum OPCODES {
+       CMD_NOP = 0,
+       CMD_FWLOAD_PREPARE  = 0x01,
+       CMD_FWLOAD_FINISH   = 0x02,
+       CMD_I2C_READ        = 0x03,
+       CMD_I2C_WRITE       = 0x04,
+
+       CMD_I2C_WRITE_NOSTOP = 0x05,
+       CMD_I2C_CONTINUE_WRITE = 0x06,
+       CMD_I2C_CONTINUE_WRITE_NOSTOP = 0x07,
+
+       CMD_DEBUG_OUTPUT    = 0x09,
+
+       CMD_CONTROL         = 0x10,
+       CMD_CONFIGURE_BUFFER = 0x11,
+       CMD_CONFIGURE_FREE_BUFFER = 0x12,
+
+       CMD_SPI_READ        = 0x13,
+       CMD_SPI_WRITE       = 0x14,
+
+       CMD_MEM_READ        = 0x20,
+       CMD_MEM_WRITE       = 0x21,
+       CMD_SFR_READ        = 0x22,
+       CMD_SFR_WRITE       = 0x23,
+       CMD_IRAM_READ       = 0x24,
+       CMD_IRAM_WRITE      = 0x25,
+       CMD_SET_GPIO_PIN    = 0x26,
+       CMD_SET_GPIO_INT    = 0x27,
+       CMD_CONFIGURE_UART  = 0x28,
+       CMD_WRITE_UART      = 0x29,
+       MAX_CMD
+};
+
+enum RESPONSES {
+       OK = 0,
+       ERROR = 1
+};
+
+struct FW_HEADER {
+       u8 Opcode;
+       u8 Length;
+} __attribute__ ((__packed__));
+
+struct FW_I2C_WRITE {
+       struct FW_HEADER hdr;
+       u8 Device;
+       u8 Data[250];
+} __attribute__ ((__packed__));
+
+struct FW_I2C_CONTINUE_WRITE {
+       struct FW_HEADER hdr;
+       u8 Data[250];
+} __attribute__ ((__packed__));
+
+struct FW_I2C_READ {
+       struct FW_HEADER hdr;
+       u8 Device;
+       u8 Data[252];    /* followed by two bytes of read data count */
+} __attribute__ ((__packed__));
+
+struct FW_SPI_WRITE {
+       struct FW_HEADER hdr;
+       u8 ModeSelect;
+       u8 Data[250];
+} __attribute__ ((__packed__));
+
+struct FW_SPI_READ {
+       struct FW_HEADER hdr;
+       u8 ModeSelect;
+       u8 Data[252];    /* followed by two bytes of read data count */
+} __attribute__ ((__packed__));
+
+struct FW_FWLOAD_PREPARE {
+       struct FW_HEADER hdr;
+} __attribute__ ((__packed__));
+
+struct FW_FWLOAD_FINISH {
+       struct FW_HEADER hdr;
+       u16 Address;     /* address of final block */
+       u16 Length;
+} __attribute__ ((__packed__));
+
+/*
+ * Meaning of FW_STREAM_CONTROL::Mode bits:
+ *  Bit 7: Loopback PEXin to PEXout using TVOut channel
+ *  Bit 6: AVLOOP
+ *  Bit 5: Audio select; 0=I2S, 1=SPDIF
+ *  Bit 4: AVSYNC
+ *  Bit 3: Enable transport stream
+ *  Bit 2: Enable audio capture
+ *  Bit 1: Enable ITU-Video VBI capture
+ *  Bit 0: Enable ITU-Video capture
+ *
+ * Meaning of FW_STREAM_CONTROL::Control bits (see UVI1_CTL)
+ *  Bit 7: continuous capture
+ *  Bit 6: capture one field
+ *  Bit 5: capture one frame
+ *  Bit 4: unused
+ *  Bit 3: starting field; 0=odd, 1=even
+ *  Bit 2: sample size; 0=8-bit, 1=10-bit
+ *  Bit 1: data format; 0=UYVY, 1=YUY2
+ *  Bit 0: resets buffer pointers
+*/
+
+enum FSC_MODE_BITS {
+       SMODE_LOOPBACK          = 0x80,
+       SMODE_AVLOOP            = 0x40,
+       _SMODE_AUDIO_SPDIF      = 0x20,
+       _SMODE_AVSYNC           = 0x10,
+       _SMODE_TRANSPORT_STREAM = 0x08,
+       _SMODE_AUDIO_CAPTURE    = 0x04,
+       _SMODE_VBI_CAPTURE      = 0x02,
+       _SMODE_VIDEO_CAPTURE    = 0x01
+};
+
+
+/* Meaning of FW_STREAM_CONTROL::Stream bits:
+ * Bit 3: Audio sample count:  0 = relative, 1 = absolute
+ * Bit 2: color bar select; 1=color bars, 0=CV3 decoder
+ * Bits 1-0: stream select, UVI1, UVI2, TVOUT
+ */
+
+struct FW_STREAM_CONTROL {
+       struct FW_HEADER hdr;
+       u8     Stream;             /* Stream number (UVI1, UVI2, TVOUT) */
+       u8     Control;            /* Value written to UVI1_CTL */
+       u8     Mode;               /* Controls clock source */
+       u8     SetupDataLen;       /* Length of setup data, MSB=1 write
+                                     backwards */
+       u16    CaptureBlockCount;  /* Blocks (a 256 Bytes) to capture per buffer
+                                     for TS and Audio */
+       u64    Buffer_Address;     /* Address of first buffer header */
+       u16    BytesPerVideoLine;
+       u16    MaxLinesPerField;
+       u16    MinLinesPerField;
+       u16    Reserved_1;
+       u16    BytesPerVBILine;
+       u16    MaxVBILinesPerField;
+       u16    MinVBILinesPerField;
+       u16    SetupDataAddr;      /* ngene relative address of setup data */
+       u8     SetupData[32];      /* setup data */
+} __attribute__((__packed__));
+
+#define AUDIO_BLOCK_SIZE    256
+#define TS_BLOCK_SIZE       256
+
+struct FW_MEM_READ {
+       struct FW_HEADER hdr;
+       u16   address;
+} __attribute__ ((__packed__));
+
+struct FW_MEM_WRITE {
+       struct FW_HEADER hdr;
+       u16   address;
+       u8    data;
+} __attribute__ ((__packed__));
+
+struct FW_SFR_IRAM_READ {
+       struct FW_HEADER hdr;
+       u8    address;
+} __attribute__ ((__packed__));
+
+struct FW_SFR_IRAM_WRITE {
+       struct FW_HEADER hdr;
+       u8    address;
+       u8    data;
+} __attribute__ ((__packed__));
+
+struct FW_SET_GPIO_PIN {
+       struct FW_HEADER hdr;
+       u8    select;
+} __attribute__ ((__packed__));
+
+struct FW_SET_GPIO_INT {
+       struct FW_HEADER hdr;
+       u8    select;
+} __attribute__ ((__packed__));
+
+struct FW_SET_DEBUGMODE {
+       struct FW_HEADER hdr;
+       u8   debug_flags;
+} __attribute__ ((__packed__));
+
+struct FW_CONFIGURE_BUFFERS {
+       struct FW_HEADER hdr;
+       u8   config;
+} __attribute__ ((__packed__));
+
+enum _BUFFER_CONFIGS {
+       /* 4k UVI1, 4k UVI2, 2k AUD1, 2k AUD2  (standard usage) */
+       BUFFER_CONFIG_4422 = 0,
+       /* 3k UVI1, 3k UVI2, 3k AUD1, 3k AUD2  (4x TS input usage) */
+       BUFFER_CONFIG_3333 = 1,
+       /* 8k UVI1, 0k UVI2, 2k AUD1, 2k I2SOut  (HDTV decoder usage) */
+       BUFFER_CONFIG_8022 = 2,
+       BUFFER_CONFIG_FW17 = 255, /* Use new FW 17 command */
+};
+
+struct FW_CONFIGURE_FREE_BUFFERS {
+       struct FW_HEADER hdr;
+       u8   UVI1_BufferLength;
+       u8   UVI2_BufferLength;
+       u8   TVO_BufferLength;
+       u8   AUD1_BufferLength;
+       u8   AUD2_BufferLength;
+       u8   TVA_BufferLength;
+} __attribute__ ((__packed__));
+
+struct FW_CONFIGURE_UART {
+       struct FW_HEADER hdr;
+       u8 UartControl;
+} __attribute__ ((__packed__));
+
+enum _UART_CONFIG {
+       _UART_BAUDRATE_19200 = 0,
+       _UART_BAUDRATE_9600  = 1,
+       _UART_BAUDRATE_4800  = 2,
+       _UART_BAUDRATE_2400  = 3,
+       _UART_RX_ENABLE      = 0x40,
+       _UART_TX_ENABLE      = 0x80,
+};
+
+struct FW_WRITE_UART {
+       struct FW_HEADER hdr;
+       u8 Data[252];
+} __attribute__ ((__packed__));
+
+
+struct ngene_command {
+       u32 in_len;
+       u32 out_len;
+       union {
+               u32                              raw[64];
+               u8                               raw8[256];
+               struct FW_HEADER                 hdr;
+               struct FW_I2C_WRITE              I2CWrite;
+               struct FW_I2C_CONTINUE_WRITE     I2CContinueWrite;
+               struct FW_I2C_READ               I2CRead;
+               struct FW_STREAM_CONTROL         StreamControl;
+               struct FW_FWLOAD_PREPARE         FWLoadPrepare;
+               struct FW_FWLOAD_FINISH          FWLoadFinish;
+               struct FW_MEM_READ               MemoryRead;
+               struct FW_MEM_WRITE              MemoryWrite;
+               struct FW_SFR_IRAM_READ          SfrIramRead;
+               struct FW_SFR_IRAM_WRITE         SfrIramWrite;
+               struct FW_SPI_WRITE              SPIWrite;
+               struct FW_SPI_READ               SPIRead;
+               struct FW_SET_GPIO_PIN           SetGpioPin;
+               struct FW_SET_GPIO_INT           SetGpioInt;
+               struct FW_SET_DEBUGMODE          SetDebugMode;
+               struct FW_CONFIGURE_BUFFERS      ConfigureBuffers;
+               struct FW_CONFIGURE_FREE_BUFFERS ConfigureFreeBuffers;
+               struct FW_CONFIGURE_UART         ConfigureUart;
+               struct FW_WRITE_UART             WriteUart;
+       } cmd;
+} __attribute__ ((__packed__));
+
+#define NGENE_INTERFACE_VERSION 0x103
+#define MAX_VIDEO_BUFFER_SIZE   (417792) /* 288*1440 rounded up to next page */
+#define MAX_AUDIO_BUFFER_SIZE     (8192) /* Gives room for about 23msec@48KHz */
+#define MAX_VBI_BUFFER_SIZE      (28672) /* 1144*18 rounded up to next page */
+#define MAX_TS_BUFFER_SIZE       (98304) /* 512*188 rounded up to next page */
+#define MAX_HDTV_BUFFER_SIZE   (2080768) /* 541*1920*2 rounded up to next page
+                                           Max: (1920x1080i60) */
+
+#define OVERFLOW_BUFFER_SIZE    (8192)
+
+#define RING_SIZE_VIDEO     4
+#define RING_SIZE_AUDIO     8
+#define RING_SIZE_TS        8
+
+#define NUM_SCATTER_GATHER_ENTRIES  8
+
+#define MAX_DMA_LENGTH (((MAX_VIDEO_BUFFER_SIZE + MAX_VBI_BUFFER_SIZE) * \
+                       RING_SIZE_VIDEO * 2) + \
+                       (MAX_AUDIO_BUFFER_SIZE * RING_SIZE_AUDIO * 2) + \
+                       (MAX_TS_BUFFER_SIZE * RING_SIZE_TS * 4) + \
+                       (RING_SIZE_VIDEO * PAGE_SIZE * 2) + \
+                       (RING_SIZE_AUDIO * PAGE_SIZE * 2) + \
+                       (RING_SIZE_TS    * PAGE_SIZE * 4) + \
+                        8 * PAGE_SIZE + OVERFLOW_BUFFER_SIZE + PAGE_SIZE)
+
+#define EVENT_QUEUE_SIZE    16
+
+/* Gathers the current state of a single channel. */
+
+struct SBufferHeader {
+       struct BUFFER_HEADER   ngeneBuffer; /* Physical descriptor */
+       struct SBufferHeader  *Next;
+       void                  *Buffer1;
+       struct HW_SCATTER_GATHER_ELEMENT *scList1;
+       void                  *Buffer2;
+       struct HW_SCATTER_GATHER_ELEMENT *scList2;
+};
+
+/* Sizeof SBufferHeader aligned to next 64 Bit boundary (hw restriction) */
+#define SIZEOF_SBufferHeader ((sizeof(struct SBufferHeader) + 63) & ~63)
+
+enum HWSTATE {
+       HWSTATE_STOP,
+       HWSTATE_STARTUP,
+       HWSTATE_RUN,
+       HWSTATE_PAUSE,
+};
+
+enum KSSTATE {
+       KSSTATE_STOP,
+       KSSTATE_ACQUIRE,
+       KSSTATE_PAUSE,
+       KSSTATE_RUN,
+};
+
+struct SRingBufferDescriptor {
+       struct SBufferHeader *Head; /* Points to first buffer in ring buffer
+                                      structure*/
+       u64   PAHead;         /* Physical address of first buffer */
+       u32   MemSize;        /* Memory size of allocated ring buffers
+                                (needed for freeing) */
+       u32   NumBuffers;     /* Number of buffers in the ring */
+       u32   Buffer1Length;  /* Allocated length of Buffer 1 */
+       u32   Buffer2Length;  /* Allocated length of Buffer 2 */
+       void *SCListMem;      /* Memory to hold scatter gather lists for this
+                                ring */
+       u64   PASCListMem;    /* Physical address  .. */
+       u32   SCListMemSize;  /* Size of this memory */
+};
+
+enum STREAMMODEFLAGS {
+       StreamMode_NONE   = 0, /* Stream not used */
+       StreamMode_ANALOG = 1, /* Analog: Stream 0,1 = Video, 2,3 = Audio */
+       StreamMode_TSIN   = 2, /* Transport stream input (all) */
+       StreamMode_HDTV   = 4, /* HDTV: Maximum 1920x1080p30,1920x1080i60
+                                 (only stream 0) */
+       StreamMode_TSOUT  = 8, /* Transport stream output (only stream 3) */
+};
+
+
+enum BufferExchangeFlags {
+       BEF_EVEN_FIELD   = 0x00000001,
+       BEF_CONTINUATION = 0x00000002,
+       BEF_MORE_DATA    = 0x00000004,
+       BEF_OVERFLOW     = 0x00000008,
+       DF_SWAP32        = 0x00010000,
+};
+
+typedef void *(IBufferExchange)(void *, void *, u32, u32, u32);
+
+struct MICI_STREAMINFO {
+       IBufferExchange    *pExchange;
+       IBufferExchange    *pExchangeVBI;     /* Secondary (VBI, ancillary) */
+       u8  Stream;
+       u8  Flags;
+       u8  Mode;
+       u8  Reserved;
+       u16 nLinesVideo;
+       u16 nBytesPerLineVideo;
+       u16 nLinesVBI;
+       u16 nBytesPerLineVBI;
+       u32 CaptureLength;    /* Used for audio and transport stream */
+};
+
+/****************************************************************************/
+/* STRUCTS ******************************************************************/
+/****************************************************************************/
+
+/* sound hardware definition */
+#define MIXER_ADDR_TVTUNER      0
+#define MIXER_ADDR_LAST         0
+
+struct ngene_channel;
+
+/*struct sound chip*/
+
+struct mychip {
+       struct ngene_channel *chan;
+       struct snd_card *card;
+       struct pci_dev *pci;
+       struct snd_pcm_substream *substream;
+       struct snd_pcm *pcm;
+       unsigned long port;
+       int irq;
+       spinlock_t mixer_lock;
+       spinlock_t lock;
+       int mixer_volume[MIXER_ADDR_LAST + 1][2];
+       int capture_source[MIXER_ADDR_LAST + 1][2];
+};
+
+#ifdef NGENE_V4L
+struct ngene_overlay {
+       int                    tvnorm;
+       struct v4l2_rect       w;
+       enum v4l2_field        field;
+       struct v4l2_clip       *clips;
+       int                    nclips;
+       int                    setup_ok;
+};
+
+struct ngene_tvnorm {
+       int   v4l2_id;
+       char  *name;
+       u16   swidth, sheight; /* scaled standard width, height */
+       int   tuner_norm;
+       int   soundstd;
+};
+
+struct ngene_vopen {
+       struct ngene_channel      *ch;
+       enum v4l2_priority         prio;
+       int                        width;
+       int                        height;
+       int                        depth;
+       struct videobuf_queue      vbuf_q;
+       struct videobuf_queue      vbi;
+       int                        fourcc;
+       int                        picxcount;
+       int                        resources;
+       enum v4l2_buf_type         type;
+       const struct ngene_format *fmt;
+
+       const struct ngene_format *ovfmt;
+       struct ngene_overlay       ov;
+};
+#endif
+
+struct ngene_channel {
+       struct device         device;
+       struct i2c_adapter    i2c_adapter;
+
+       struct ngene         *dev;
+       int                   number;
+       int                   type;
+       int                   mode;
+
+       struct dvb_frontend  *fe;
+       struct dmxdev         dmxdev;
+       struct dvb_demux      demux;
+       struct dmx_frontend   hw_frontend;
+       struct dmx_frontend   mem_frontend;
+       int                   users;
+       struct video_device  *v4l_dev;
+       struct tasklet_struct demux_tasklet;
+
+       struct SBufferHeader *nextBuffer;
+       enum KSSTATE          State;
+       enum HWSTATE          HWState;
+       u8                    Stream;
+       u8                    Flags;
+       u8                    Mode;
+       IBufferExchange      *pBufferExchange;
+       IBufferExchange      *pBufferExchange2;
+
+       spinlock_t            state_lock;
+       u16                   nLines;
+       u16                   nBytesPerLine;
+       u16                   nVBILines;
+       u16                   nBytesPerVBILine;
+       u16                   itumode;
+       u32                   Capture1Length;
+       u32                   Capture2Length;
+       struct SRingBufferDescriptor RingBuffer;
+       struct SRingBufferDescriptor TSRingBuffer;
+       struct SRingBufferDescriptor TSIdleBuffer;
+
+       u32                   DataFormatFlags;
+
+       int                   AudioDTOUpdated;
+       u32                   AudioDTOValue;
+
+       int (*set_tone)(struct dvb_frontend *, fe_sec_tone_mode_t);
+       u8 lnbh;
+
+       /* stuff from analog driver */
+
+       int minor;
+       struct mychip        *mychip;
+       struct snd_card      *soundcard;
+       u8                   *evenbuffer;
+       u8                    dma_on;
+       int                   soundstreamon;
+       int                   audiomute;
+       int                   soundbuffisallocated;
+       int                   sndbuffflag;
+       int                   tun_rdy;
+       int                   dec_rdy;
+       int                   tun_dec_rdy;
+       int                   lastbufferflag;
+
+       struct ngene_tvnorm  *tvnorms;
+       int                   tvnorm_num;
+       int                   tvnorm;
+
+#ifdef NGENE_V4L
+       int                   videousers;
+       struct v4l2_prio_state prio;
+       struct ngene_vopen    init;
+       int                   resources;
+       struct v4l2_framebuffer fbuf;
+       struct ngene_buffer  *screen;     /* overlay             */
+       struct list_head      capture;    /* video capture queue */
+       spinlock_t s_lock;
+       struct semaphore reslock;
+#endif
+
+       int running;
+};
+
+struct ngene;
+
+typedef void (rx_cb_t)(struct ngene *, u32, u8);
+typedef void (tx_cb_t)(struct ngene *, u32);
+
+struct ngene {
+       int                   nr;
+       struct pci_dev       *pci_dev;
+       unsigned char        *iomem;
+
+       /*struct i2c_adapter  i2c_adapter;*/
+
+       u32                   device_version;
+       u32                   fw_interface_version;
+       u32                   icounts;
+
+       u8                   *CmdDoneByte;
+       int                   BootFirmware;
+       void                 *OverflowBuffer;
+       dma_addr_t            PAOverflowBuffer;
+       void                 *FWInterfaceBuffer;
+       dma_addr_t            PAFWInterfaceBuffer;
+       u8                   *ngenetohost;
+       u8                   *hosttongene;
+
+       struct EVENT_BUFFER   EventQueue[EVENT_QUEUE_SIZE];
+       int                   EventQueueOverflowCount;
+       int                   EventQueueOverflowFlag;
+       struct tasklet_struct event_tasklet;
+       struct EVENT_BUFFER  *EventBuffer;
+       int                   EventQueueWriteIndex;
+       int                   EventQueueReadIndex;
+
+       wait_queue_head_t     cmd_wq;
+       int                   cmd_done;
+       struct semaphore      cmd_mutex;
+       struct semaphore      stream_mutex;
+       struct semaphore      pll_mutex;
+       struct semaphore      i2c_switch_mutex;
+       int                   i2c_current_channel;
+       int                   i2c_current_bus;
+       spinlock_t            cmd_lock;
+
+       struct dvb_adapter    adapter[MAX_STREAM];
+       struct ngene_channel  channel[MAX_STREAM];
+
+       struct ngene_info    *card_info;
+
+       tx_cb_t              *TxEventNotify;
+       rx_cb_t              *RxEventNotify;
+       int                   tx_busy;
+       wait_queue_head_t     tx_wq;
+       wait_queue_head_t     rx_wq;
+#define UART_RBUF_LEN 4096
+       u8                    uart_rbuf[UART_RBUF_LEN];
+       int                   uart_rp, uart_wp;
+
+       u8                   *tsout_buf;
+#define TSOUT_BUF_SIZE (512*188*8)
+       struct dvb_ringbuffer tsout_rbuf;
+
+       u8                   *ain_buf;
+#define AIN_BUF_SIZE (128*1024)
+       struct dvb_ringbuffer ain_rbuf;
+
+
+       u8                   *vin_buf;
+#define VIN_BUF_SIZE (4*1920*1080)
+       struct dvb_ringbuffer vin_rbuf;
+
+       unsigned long         exp_val;
+       int prev_cmd;
+};
+
+struct ngene_info {
+       int   type;
+#define NGENE_APP        0
+#define NGENE_TERRATEC   1
+#define NGENE_SIDEWINDER 2
+#define NGENE_RACER      3
+#define NGENE_VIPER      4
+#define NGENE_PYTHON     5
+#define NGENE_VBOX_V1   6
+#define NGENE_VBOX_V2   7
+
+       int   fw_version;
+       char *name;
+
+       int   io_type[MAX_STREAM];
+#define NGENE_IO_NONE    0
+#define NGENE_IO_TV      1
+#define NGENE_IO_HDTV    2
+#define NGENE_IO_TSIN    4
+#define NGENE_IO_TSOUT   8
+#define NGENE_IO_AIN     16
+
+       void *fe_config[4];
+       void *tuner_config[4];
+
+       int (*demod_attach[4])(struct ngene_channel *);
+       int (*tuner_attach[4])(struct ngene_channel *);
+
+       u8    avf[4];
+       u8    msp[4];
+       u8    demoda[4];
+       u8    lnb[4];
+       int   i2c_access;
+       u8    ntsc;
+       u8    tsf[4];
+       u8    i2s[4];
+
+       int (*gate_ctrl)(struct dvb_frontend *, int);
+       int (*switch_ctrl)(struct ngene_channel *, int, int);
+};
+
+#ifdef NGENE_V4L
+struct ngene_format{
+       char *name;
+       int   fourcc;          /* video4linux 2      */
+       int   btformat;        /* BT848_COLOR_FMT_*  */
+       int   format;
+       int   btswap;          /* BT848_COLOR_CTL_*  */
+       int   depth;           /* bit/pixel          */
+       int   flags;
+       int   hshift, vshift;  /* for planar modes   */
+       int   palette;
+};
+
+#define RESOURCE_OVERLAY       1
+#define RESOURCE_VIDEO         2
+#define RESOURCE_VBI           4
+
+struct ngene_buffer {
+       /* common v4l buffer stuff -- must be first */
+       struct videobuf_buffer     vb;
+
+       /* ngene specific */
+       const struct ngene_format *fmt;
+       int                        tvnorm;
+       int                        btformat;
+       int                        btswap;
+};
+#endif
+
+
+#endif
+
+/*  LocalWords:  Endif
+ */
index 1067b22eb0c66992567124baac7f6c1fe43f1bd4..cff77e2eb55704ad3a7e7ca53c8c0dbbd186a91f 100644 (file)
@@ -62,6 +62,7 @@ static struct sms_board sms_boards[] = {
        [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
                .name   = "Hauppauge WinTV MiniStick",
                .type   = SMS_NOVA_B0,
+               .fw[DEVICE_MODE_ISDBT_BDA] = "sms1xxx-hcw-55xxx-isdbt-02.fw",
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
                .board_cfg.leds_power = 26,
                .board_cfg.led0 = 27,
index ca758bcb48c95ee00d8a23cd4e047f37e98d08f4..4bfd3451b5682ca5a49a9f6b8fdea2726f554d63 100644 (file)
@@ -1459,8 +1459,10 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum,
        if (!(coredev->device_flags & SMS_DEVICE_FAMILY2)) {
                pMsg->xMsgHeader.msgType = MSG_SMS_GPIO_CONFIG_REQ;
                if (GetGpioPinParams(PinNum, &TranslatedPinNum, &GroupNum,
-                               &groupCfg) != 0)
-                       return -EINVAL;
+                               &groupCfg) != 0) {
+                       rc = -EINVAL;
+                       goto free;
+               }
 
                pMsg->msgData[1] = TranslatedPinNum;
                pMsg->msgData[2] = GroupNum;
@@ -1490,6 +1492,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum,
                else
                        sms_err("smscore_gpio_configure error");
        }
+free:
        kfree(buffer);
 
        return rc;
index eec18aaf551281e8691f0d6c7943402039417bc7..8ecadecaa9d0d9aa7de49612a4e7c0845162a4c2 100644 (file)
@@ -212,6 +212,8 @@ struct smscore_device_t {
 #define MSG_SMS_DAB_CHANNEL                            607
 #define MSG_SMS_GET_PID_FILTER_LIST_REQ                        608
 #define MSG_SMS_GET_PID_FILTER_LIST_RES                        609
+#define MSG_SMS_GET_STATISTICS_RES                     616
+#define MSG_SMS_GET_STATISTICS_REQ                     615
 #define MSG_SMS_HO_PER_SLICES_IND                      630
 #define MSG_SMS_SET_ANTENNA_CONFIG_REQ                 651
 #define MSG_SMS_SET_ANTENNA_CONFIG_RES                 652
@@ -339,7 +341,7 @@ struct SmsFirmware_ST {
 
 /* Statistics information returned as response for
  * SmsHostApiGetStatistics_Req */
-struct SMSHOSTLIB_STATISTICS_S {
+struct SMSHOSTLIB_STATISTICS_ST {
        u32 Reserved;           /* Reserved */
 
        /* Common parameters */
@@ -424,6 +426,79 @@ struct SMSHOSTLIB_STATISTICS_S {
        u32 ReservedFields[10]; /* Reserved */
 };
 
+struct SmsMsgStatisticsInfo_ST {
+       u32 RequestResult;
+
+       struct SMSHOSTLIB_STATISTICS_ST Stat;
+
+       /* Split the calc of the SNR in DAB */
+       u32 Signal; /* dB */
+       u32 Noise; /* dB */
+
+};
+
+struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST {
+       /* Per-layer information */
+       u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
+                      * 255 means layer does not exist */
+       u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET,
+                           * 255 means layer does not exist */
+       u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
+       u32 BERErrorCount; /* Post Viterbi Error Bits Count */
+       u32 BERBitCount; /* Post Viterbi Total Bits Count */
+       u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
+       u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
+       u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
+       u32 TotalTSPackets; /* Total number of transport-stream packets */
+       u32 TILdepthI; /* Time interleaver depth I parameter,
+                       * 255 means layer does not exist */
+       u32 NumberOfSegments; /* Number of segments in layer A,
+                              * 255 means layer does not exist */
+       u32 TMCCErrors; /* TMCC errors */
+};
+
+struct SMSHOSTLIB_STATISTICS_ISDBT_ST {
+       u32 StatisticsType; /* Enumerator identifying the type of the
+                               * structure.  Values are the same as
+                               * SMSHOSTLIB_DEVICE_MODES_E
+                               *
+                               * This field MUST always be first in any
+                               * statistics structure */
+
+       u32 FullSize; /* Total size of the structure returned by the modem.
+                      * If the size requested by the host is smaller than
+                      * FullSize, the struct will be truncated */
+
+       /* Common parameters */
+       u32 IsRfLocked; /* 0 - not locked, 1 - locked */
+       u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
+       u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
+
+       /* Reception quality */
+       s32  SNR; /* dB */
+       s32  RSSI; /* dBm */
+       s32  InBandPwr; /* In band power in dBM */
+       s32  CarrierOffset; /* Carrier Offset in Hz */
+
+       /* Transmission parameters */
+       u32 Frequency; /* Frequency in Hz */
+       u32 Bandwidth; /* Bandwidth in MHz */
+       u32 TransmissionMode; /* ISDB-T transmission mode */
+       u32 ModemState; /* 0 - Acquisition, 1 - Locked */
+       u32 GuardInterval; /* Guard Interval, 1 divided by value */
+       u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
+       u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */
+       u32 NumOfLayers; /* Number of ISDB-T layers in the network */
+
+       /* Per-layer information */
+       /* Layers A, B and C */
+       struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST   LayerInfo[3];
+       /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */
+
+       /* Interface information */
+       u32 SmsToHostTxErrors; /* Total number of transmission errors. */
+};
+
 struct PID_STATISTICS_DATA_S {
        struct PID_BURST_S {
                u32 size;
index 68bf9fbd8fed91094cd641c245ebaf2d467761ce..5f3939821ca3eef3c786678cc91b9ef5ca326382 100644 (file)
@@ -116,6 +116,118 @@ static void sms_board_dvb3_event(struct smsdvb_client_t *client,
        }
 }
 
+
+static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionData,
+                                  struct SMSHOSTLIB_STATISTICS_ST *p)
+{
+       if (sms_dbg & 2) {
+               printk(KERN_DEBUG "Reserved = %d", p->Reserved);
+               printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked);
+               printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked);
+               printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn);
+               printk(KERN_DEBUG "SNR = %d", p->SNR);
+               printk(KERN_DEBUG "BER = %d", p->BER);
+               printk(KERN_DEBUG "FIB_CRC = %d", p->FIB_CRC);
+               printk(KERN_DEBUG "TS_PER = %d", p->TS_PER);
+               printk(KERN_DEBUG "MFER = %d", p->MFER);
+               printk(KERN_DEBUG "RSSI = %d", p->RSSI);
+               printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr);
+               printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset);
+               printk(KERN_DEBUG "Frequency = %d", p->Frequency);
+               printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth);
+               printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode);
+               printk(KERN_DEBUG "ModemState = %d", p->ModemState);
+               printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval);
+               printk(KERN_DEBUG "CodeRate = %d", p->CodeRate);
+               printk(KERN_DEBUG "LPCodeRate = %d", p->LPCodeRate);
+               printk(KERN_DEBUG "Hierarchy = %d", p->Hierarchy);
+               printk(KERN_DEBUG "Constellation = %d", p->Constellation);
+               printk(KERN_DEBUG "BurstSize = %d", p->BurstSize);
+               printk(KERN_DEBUG "BurstDuration = %d", p->BurstDuration);
+               printk(KERN_DEBUG "BurstCycleTime = %d", p->BurstCycleTime);
+               printk(KERN_DEBUG "CalculatedBurstCycleTime = %d", p->CalculatedBurstCycleTime);
+               printk(KERN_DEBUG "NumOfRows = %d", p->NumOfRows);
+               printk(KERN_DEBUG "NumOfPaddCols = %d", p->NumOfPaddCols);
+               printk(KERN_DEBUG "NumOfPunctCols = %d", p->NumOfPunctCols);
+               printk(KERN_DEBUG "ErrorTSPackets = %d", p->ErrorTSPackets);
+               printk(KERN_DEBUG "TotalTSPackets = %d", p->TotalTSPackets);
+               printk(KERN_DEBUG "NumOfValidMpeTlbs = %d", p->NumOfValidMpeTlbs);
+               printk(KERN_DEBUG "NumOfInvalidMpeTlbs = %d", p->NumOfInvalidMpeTlbs);
+               printk(KERN_DEBUG "NumOfCorrectedMpeTlbs = %d", p->NumOfCorrectedMpeTlbs);
+               printk(KERN_DEBUG "BERErrorCount = %d", p->BERErrorCount);
+               printk(KERN_DEBUG "BERBitCount = %d", p->BERBitCount);
+               printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors);
+               printk(KERN_DEBUG "PreBER = %d", p->PreBER);
+               printk(KERN_DEBUG "CellId = %d", p->CellId);
+               printk(KERN_DEBUG "DvbhSrvIndHP = %d", p->DvbhSrvIndHP);
+               printk(KERN_DEBUG "DvbhSrvIndLP = %d", p->DvbhSrvIndLP);
+               printk(KERN_DEBUG "NumMPEReceived = %d", p->NumMPEReceived);
+       }
+
+       pReceptionData->IsDemodLocked = p->IsDemodLocked;
+
+       pReceptionData->SNR = p->SNR;
+       pReceptionData->BER = p->BER;
+       pReceptionData->BERErrorCount = p->BERErrorCount;
+       pReceptionData->InBandPwr = p->InBandPwr;
+       pReceptionData->ErrorTSPackets = p->ErrorTSPackets;
+};
+
+
+static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_S *pReceptionData,
+                                   struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p)
+{
+       int i;
+
+       if (sms_dbg & 2) {
+               printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked);
+               printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked);
+               printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn);
+               printk(KERN_DEBUG "SNR = %d", p->SNR);
+               printk(KERN_DEBUG "RSSI = %d", p->RSSI);
+               printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr);
+               printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset);
+               printk(KERN_DEBUG "Frequency = %d", p->Frequency);
+               printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth);
+               printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode);
+               printk(KERN_DEBUG "ModemState = %d", p->ModemState);
+               printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval);
+               printk(KERN_DEBUG "SystemType = %d", p->SystemType);
+               printk(KERN_DEBUG "PartialReception = %d", p->PartialReception);
+               printk(KERN_DEBUG "NumOfLayers = %d", p->NumOfLayers);
+               printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors);
+
+               for (i = 0; i < 3; i++) {
+                       printk(KERN_DEBUG "%d: CodeRate = %d", i, p->LayerInfo[i].CodeRate);
+                       printk(KERN_DEBUG "%d: Constellation = %d", i, p->LayerInfo[i].Constellation);
+                       printk(KERN_DEBUG "%d: BER = %d", i, p->LayerInfo[i].BER);
+                       printk(KERN_DEBUG "%d: BERErrorCount = %d", i, p->LayerInfo[i].BERErrorCount);
+                       printk(KERN_DEBUG "%d: BERBitCount = %d", i, p->LayerInfo[i].BERBitCount);
+                       printk(KERN_DEBUG "%d: PreBER = %d", i, p->LayerInfo[i].PreBER);
+                       printk(KERN_DEBUG "%d: TS_PER = %d", i, p->LayerInfo[i].TS_PER);
+                       printk(KERN_DEBUG "%d: ErrorTSPackets = %d", i, p->LayerInfo[i].ErrorTSPackets);
+                       printk(KERN_DEBUG "%d: TotalTSPackets = %d", i, p->LayerInfo[i].TotalTSPackets);
+                       printk(KERN_DEBUG "%d: TILdepthI = %d", i, p->LayerInfo[i].TILdepthI);
+                       printk(KERN_DEBUG "%d: NumberOfSegments = %d", i, p->LayerInfo[i].NumberOfSegments);
+                       printk(KERN_DEBUG "%d: TMCCErrors = %d", i, p->LayerInfo[i].TMCCErrors);
+               }
+       }
+
+       pReceptionData->IsDemodLocked = p->IsDemodLocked;
+
+       pReceptionData->SNR = p->SNR;
+       pReceptionData->InBandPwr = p->InBandPwr;
+
+       pReceptionData->ErrorTSPackets = 0;
+       pReceptionData->BER = 0;
+       pReceptionData->BERErrorCount = 0;
+       for (i = 0; i < 3; i++) {
+               pReceptionData->BER += p->LayerInfo[i].BER;
+               pReceptionData->BERErrorCount += p->LayerInfo[i].BERErrorCount;
+               pReceptionData->ErrorTSPackets += p->LayerInfo[i].ErrorTSPackets;
+       }
+}
+
 static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
 {
        struct smsdvb_client_t *client = (struct smsdvb_client_t *) context;
@@ -134,6 +246,7 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
                break;
 
        case MSG_SMS_RF_TUNE_RES:
+       case MSG_SMS_ISDBT_TUNE_RES:
                complete(&client->tune_done);
                break;
 
@@ -217,6 +330,40 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
                is_status_update = true;
                break;
        }
+       case MSG_SMS_GET_STATISTICS_RES: {
+               union {
+                       struct SMSHOSTLIB_STATISTICS_ISDBT_ST  isdbt;
+                       struct SmsMsgStatisticsInfo_ST         dvb;
+               } *p = (void *) (phdr + 1);
+               struct RECEPTION_STATISTICS_S *pReceptionData =
+                               &client->sms_stat_dvb.ReceptionData;
+
+               sms_info("MSG_SMS_GET_STATISTICS_RES");
+
+               is_status_update = true;
+
+               switch (smscore_get_device_mode(client->coredev)) {
+               case DEVICE_MODE_ISDBT:
+               case DEVICE_MODE_ISDBT_BDA:
+                       smsdvb_update_isdbt_stats(pReceptionData, &p->isdbt);
+                       break;
+               default:
+                       smsdvb_update_dvb_stats(pReceptionData, &p->dvb.Stat);
+               }
+               if (!pReceptionData->IsDemodLocked) {
+                       pReceptionData->SNR = 0;
+                       pReceptionData->BER = 0;
+                       pReceptionData->BERErrorCount = 0;
+                       pReceptionData->InBandPwr = 0;
+                       pReceptionData->ErrorTSPackets = 0;
+               }
+
+               complete(&client->tune_done);
+               break;
+       }
+       default:
+               sms_info("Unhandled message %d", phdr->msgType);
+
        }
        smscore_putbuffer(client->coredev, cb);
 
@@ -233,10 +380,10 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
                                                DVB3_EVENT_UNC_ERR);
 
                } else {
-                       /*client->fe_status =
-                               (phdr->msgType == MSG_SMS_NO_SIGNAL_IND) ?
-                               0 : FE_HAS_SIGNAL;*/
-                       client->fe_status = 0;
+                       if (client->sms_stat_dvb.ReceptionData.IsRfLocked)
+                               client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
+                       else
+                               client->fe_status = 0;
                        sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK);
                }
        }
@@ -325,6 +472,20 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
                                                0 : -ETIME;
 }
 
+static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
+{
+       int rc;
+       struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ,
+                                   DVBT_BDA_CONTROL_MSG_ID,
+                                   HIF_TASK,
+                                   sizeof(struct SmsMsgHdr_ST), 0 };
+
+       rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
+                                         &client->tune_done);
+
+       return rc;
+}
+
 static inline int led_feedback(struct smsdvb_client_t *client)
 {
        if (client->fe_status & FE_HAS_LOCK)
@@ -337,33 +498,43 @@ static inline int led_feedback(struct smsdvb_client_t *client)
 
 static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
 {
+       int rc;
        struct smsdvb_client_t *client;
        client = container_of(fe, struct smsdvb_client_t, frontend);
 
+       rc = smsdvb_send_statistics_request(client);
+
        *stat = client->fe_status;
 
        led_feedback(client);
 
-       return 0;
+       return rc;
 }
 
 static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
 {
+       int rc;
        struct smsdvb_client_t *client;
        client = container_of(fe, struct smsdvb_client_t, frontend);
 
+       rc = smsdvb_send_statistics_request(client);
+
        *ber = client->sms_stat_dvb.ReceptionData.BER;
 
        led_feedback(client);
 
-       return 0;
+       return rc;
 }
 
 static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
 {
+       int rc;
+
        struct smsdvb_client_t *client;
        client = container_of(fe, struct smsdvb_client_t, frontend);
 
+       rc = smsdvb_send_statistics_request(client);
+
        if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95)
                *strength = 0;
                else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29)
@@ -375,31 +546,37 @@ static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
 
        led_feedback(client);
 
-       return 0;
+       return rc;
 }
 
 static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
 {
+       int rc;
        struct smsdvb_client_t *client;
        client = container_of(fe, struct smsdvb_client_t, frontend);
 
+       rc = smsdvb_send_statistics_request(client);
+
        *snr = client->sms_stat_dvb.ReceptionData.SNR;
 
        led_feedback(client);
 
-       return 0;
+       return rc;
 }
 
 static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
 {
+       int rc;
        struct smsdvb_client_t *client;
        client = container_of(fe, struct smsdvb_client_t, frontend);
 
+       rc = smsdvb_send_statistics_request(client);
+
        *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets;
 
        led_feedback(client);
 
-       return 0;
+       return rc;
 }
 
 static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
@@ -413,9 +590,10 @@ static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
        return 0;
 }
 
-static int smsdvb_set_frontend(struct dvb_frontend *fe,
-                              struct dvb_frontend_parameters *fep)
+static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe,
+                                   struct dvb_frontend_parameters *p)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        struct smsdvb_client_t *client =
                container_of(fe, struct smsdvb_client_t, frontend);
 
@@ -429,24 +607,33 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
        client->fe_status = FE_HAS_SIGNAL;
        client->event_fe_state = -1;
        client->event_unc_state = -1;
+       fe->dtv_property_cache.delivery_system = SYS_DVBT;
 
        Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
        Msg.Msg.msgDstId = HIF_TASK;
        Msg.Msg.msgFlags = 0;
        Msg.Msg.msgType = MSG_SMS_RF_TUNE_REQ;
        Msg.Msg.msgLength = sizeof(Msg);
-       Msg.Data[0] = fep->frequency;
+       Msg.Data[0] = c->frequency;
        Msg.Data[2] = 12000000;
 
-       sms_debug("freq %d band %d",
-                 fep->frequency, fep->u.ofdm.bandwidth);
+       sms_info("%s: freq %d band %d", __func__, c->frequency,
+                c->bandwidth_hz);
 
-       switch (fep->u.ofdm.bandwidth) {
-       case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break;
-       case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break;
-       case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break;
-       case BANDWIDTH_AUTO: return -EOPNOTSUPP;
-       default: return -EINVAL;
+       switch (c->bandwidth_hz / 1000000) {
+       case 8:
+               Msg.Data[1] = BW_8_MHZ;
+               break;
+       case 7:
+               Msg.Data[1] = BW_7_MHZ;
+               break;
+       case 6:
+               Msg.Data[1] = BW_6_MHZ;
+               break;
+       case 0:
+               return -EOPNOTSUPP;
+       default:
+               return -EINVAL;
        }
        /* Disable LNA, if any. An error is returned if no LNA is present */
        ret = sms_board_lna_control(client->coredev, 0);
@@ -470,6 +657,90 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
                                           &client->tune_done);
 }
 
+static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe,
+                                    struct dvb_frontend_parameters *p)
+{
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+       struct smsdvb_client_t *client =
+               container_of(fe, struct smsdvb_client_t, frontend);
+
+       struct {
+               struct SmsMsgHdr_ST     Msg;
+               u32             Data[4];
+       } Msg;
+
+       fe->dtv_property_cache.delivery_system = SYS_ISDBT;
+
+       Msg.Msg.msgSrcId  = DVBT_BDA_CONTROL_MSG_ID;
+       Msg.Msg.msgDstId  = HIF_TASK;
+       Msg.Msg.msgFlags  = 0;
+       Msg.Msg.msgType   = MSG_SMS_ISDBT_TUNE_REQ;
+       Msg.Msg.msgLength = sizeof(Msg);
+
+       if (c->isdbt_sb_segment_idx == -1)
+               c->isdbt_sb_segment_idx = 0;
+
+       switch (c->isdbt_sb_segment_count) {
+       case 3:
+               Msg.Data[1] = BW_ISDBT_3SEG;
+               break;
+       case 1:
+               Msg.Data[1] = BW_ISDBT_1SEG;
+               break;
+       case 0: /* AUTO */
+               switch (c->bandwidth_hz / 1000000) {
+               case 8:
+               case 7:
+                       c->isdbt_sb_segment_count = 3;
+                       Msg.Data[1] = BW_ISDBT_3SEG;
+                       break;
+               case 6:
+                       c->isdbt_sb_segment_count = 1;
+                       Msg.Data[1] = BW_ISDBT_1SEG;
+                       break;
+               default: /* Assumes 6 MHZ bw */
+                       c->isdbt_sb_segment_count = 1;
+                       c->bandwidth_hz = 6000;
+                       Msg.Data[1] = BW_ISDBT_1SEG;
+                       break;
+               }
+               break;
+       default:
+               sms_info("Segment count %d not supported", c->isdbt_sb_segment_count);
+               return -EINVAL;
+       }
+
+       Msg.Data[0] = c->frequency;
+       Msg.Data[2] = 12000000;
+       Msg.Data[3] = c->isdbt_sb_segment_idx;
+
+       sms_info("%s: freq %d segwidth %d segindex %d\n", __func__,
+                c->frequency, c->isdbt_sb_segment_count,
+                c->isdbt_sb_segment_idx);
+
+       return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
+                                          &client->tune_done);
+}
+
+static int smsdvb_set_frontend(struct dvb_frontend *fe,
+                              struct dvb_frontend_parameters *fep)
+{
+       struct smsdvb_client_t *client =
+               container_of(fe, struct smsdvb_client_t, frontend);
+       struct smscore_device_t *coredev = client->coredev;
+
+       switch (smscore_get_device_mode(coredev)) {
+       case DEVICE_MODE_DVBT:
+       case DEVICE_MODE_DVBT_BDA:
+               return smsdvb_dvbt_set_frontend(fe, fep);
+       case DEVICE_MODE_ISDBT:
+       case DEVICE_MODE_ISDBT_BDA:
+               return smsdvb_isdbt_set_frontend(fe, fep);
+       default:
+               return -EINVAL;
+       }
+}
+
 static int smsdvb_get_frontend(struct dvb_frontend *fe,
                               struct dvb_frontend_parameters *fep)
 {
@@ -557,13 +828,6 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
        /* device removal handled by onremove callback */
        if (!arrival)
                return 0;
-
-       if (smscore_get_device_mode(coredev) != DEVICE_MODE_DVBT_BDA) {
-               sms_err("SMS Device mode is not set for "
-                       "DVB operation.");
-               return 0;
-       }
-
        client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL);
        if (!client) {
                sms_err("kmalloc() failed");
index e3d776feeaca1d05bfe4e05374dbd1fec63097a9..a56eac76e0f0c95738d4faa3a00896b584296795 100644 (file)
@@ -85,9 +85,9 @@ static struct keyboard_layout_map_t keyboard_layout_maps[] = {
                { } /* Terminating entry */
 };
 
-u32 ir_pos;
-u32    ir_word;
-u32 ir_toggle;
+static u32 ir_pos;
+static u32 ir_word;
+static u32 ir_toggle;
 
 #define RC5_PUSH_BIT(dst, bit, pos)    \
        { dst <<= 1; dst |= bit; pos++; }
index 23a1c6380d3f22964ef98ead022c3b3442901536..b070e88d8c6b3b7e14ae83dad807f2d33b259b1f 100644 (file)
@@ -268,8 +268,8 @@ int av7110_check_ir_config(struct av7110 *av7110, int force)
 
 
 /* /proc/av7110_ir interface */
-static int av7110_ir_write_proc(struct file *file, const char __user *buffer,
-                               unsigned long count, void *data)
+static ssize_t av7110_ir_proc_write(struct file *file, const char __user *buffer,
+                                   size_t count, loff_t *pos)
 {
        char *page;
        u32 ir_config;
@@ -309,6 +309,10 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer,
        return count;
 }
 
+static const struct file_operations av7110_ir_proc_fops = {
+       .owner          = THIS_MODULE,
+       .write          = av7110_ir_proc_write,
+};
 
 /* interrupt handler */
 static void ir_handler(struct av7110 *av7110, u32 ircom)
@@ -368,11 +372,9 @@ int __devinit av7110_ir_init(struct av7110 *av7110)
        input_dev->timer.data = (unsigned long) &av7110->ir;
 
        if (av_cnt == 1) {
-               e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL);
-               if (e) {
-                       e->write_proc = av7110_ir_write_proc;
+               e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
+               if (e)
                        e->size = 4 + 256 * sizeof(u16);
-               }
        }
 
        tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
index 9782e05937338fca46d65c1be4a54a95f9a3428c..49c2a817a06f76a4d7eb10ef7a84a0b4e91e05dd 100644 (file)
@@ -254,7 +254,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
        budget_ci->ir.timer_keyup.function = msp430_ir_keyup;
        budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir;
        budget_ci->ir.last_raw = 0xffff; /* An impossible value */
-       error = ir_input_register(input_dev, ir_codes);
+       error = ir_input_register(input_dev, ir_codes, NULL);
        if (error) {
                printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
                return error;
index e48380c48990165955a9dadeb80d90a758aa6e46..9fdf26cc6998054952c47290ed47fd457c408930 100644 (file)
@@ -433,9 +433,8 @@ static struct stv090x_config tt1600_stv090x_config = {
        .demod_mode             = STV090x_SINGLE,
        .clk_mode               = STV090x_CLK_EXT,
 
-       .xtal                   = 27000000,
+       .xtal                   = 13500000,
        .address                = 0x68,
-       .ref_clk                = 27000000,
 
        .ts1_mode               = STV090x_TSMODE_DVBCI,
        .ts2_mode               = STV090x_TSMODE_SERIAL_CONTINUOUS,
@@ -457,6 +456,7 @@ static struct stv090x_config tt1600_stv090x_config = {
 static struct stv6110x_config tt1600_stv6110x_config = {
        .addr                   = 0x60,
        .refclk                 = 27000000,
+       .clk_div                = 2,
 };
 
 static struct isl6423_config tt1600_isl6423_config = {
index 3f40f375981bfa38946ebb8de1201dc6158cfdea..83567b898d09758e9610e82ad2113f01768227f1 100644 (file)
@@ -417,6 +417,18 @@ config RADIO_TEA5764_XTAL
          Say Y here if TEA5764 have a 32768 Hz crystal in circuit, say N
          here if TEA5764 reference frequency is connected in FREQIN.
 
+config RADIO_SAA7706H
+       tristate "SAA7706H Car Radio DSP"
+       depends on I2C && VIDEO_V4L2
+       ---help---
+         Say Y here if you want to use the SAA7706H Car radio Digital
+         Signal Processor, found for instance on the Russellville development
+         board. On the russellville the device is connected to internal
+         timberdale I2C bus.
+
+         To compile this driver as a module, choose M here: the
+         module will be called SAA7706H.
+
 config RADIO_TEF6862
        tristate "TEF6862 Car Radio Enhanced Selectivity Tuner"
        depends on I2C && VIDEO_V4L2
@@ -429,4 +441,15 @@ config RADIO_TEF6862
          To compile this driver as a module, choose M here: the
          module will be called TEF6862.
 
+config RADIO_TIMBERDALE
+       tristate "Enable the Timberdale radio driver"
+       depends on MFD_TIMBERDALE && VIDEO_V4L2
+       depends on I2C  # for RADIO_SAA7706H
+       select RADIO_TEF6862
+       select RADIO_SAA7706H
+       ---help---
+         This is a kind of umbrella driver for the Radio Tuner and DSP
+         found behind the Timberdale FPGA on the Russellville board.
+         Enabling this driver will automatically select the DSP and tuner.
+
 endif # RADIO_ADAPTERS
index 01922ada6914f53931ddffbc89fb662348518109..f615583b4837c6e71650a3f3a058e32154e19d83 100644 (file)
@@ -23,6 +23,8 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
 obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o
+obj-$(CONFIG_RADIO_SAA7706H) += saa7706h.o
 obj-$(CONFIG_RADIO_TEF6862) += tef6862.o
+obj-$(CONFIG_RADIO_TIMBERDALE) += radio-timb.o
 
 EXTRA_CFLAGS += -Isound
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c
new file mode 100644 (file)
index 0000000..0de457f
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * radio-timb.c Timberdale FPGA Radio driver
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/version.h>
+#include <linux/io.h>
+#include <media/v4l2-ioctl.h>
+#include <media/v4l2-device.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <media/timb_radio.h>
+
+#define DRIVER_NAME "timb-radio"
+
+struct timbradio {
+       struct timb_radio_platform_data pdata;
+       struct v4l2_subdev      *sd_tuner;
+       struct v4l2_subdev      *sd_dsp;
+       struct video_device     video_dev;
+       struct v4l2_device      v4l2_dev;
+};
+
+
+static int timbradio_vidioc_querycap(struct file *file, void  *priv,
+       struct v4l2_capability *v)
+{
+       strlcpy(v->driver, DRIVER_NAME, sizeof(v->driver));
+       strlcpy(v->card, "Timberdale Radio", sizeof(v->card));
+       snprintf(v->bus_info, sizeof(v->bus_info), "platform:"DRIVER_NAME);
+       v->version = KERNEL_VERSION(0, 0, 1);
+       v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
+       return 0;
+}
+
+static int timbradio_vidioc_g_tuner(struct file *file, void *priv,
+       struct v4l2_tuner *v)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_tuner, tuner, g_tuner, v);
+}
+
+static int timbradio_vidioc_s_tuner(struct file *file, void *priv,
+       struct v4l2_tuner *v)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_tuner, tuner, s_tuner, v);
+}
+
+static int timbradio_vidioc_g_input(struct file *filp, void *priv,
+       unsigned int *i)
+{
+       *i = 0;
+       return 0;
+}
+
+static int timbradio_vidioc_s_input(struct file *filp, void *priv,
+       unsigned int i)
+{
+       return i ? -EINVAL : 0;
+}
+
+static int timbradio_vidioc_g_audio(struct file *file, void *priv,
+       struct v4l2_audio *a)
+{
+       a->index = 0;
+       strlcpy(a->name, "Radio", sizeof(a->name));
+       a->capability = V4L2_AUDCAP_STEREO;
+       return 0;
+}
+
+static int timbradio_vidioc_s_audio(struct file *file, void *priv,
+       struct v4l2_audio *a)
+{
+       return a->index ? -EINVAL : 0;
+}
+
+static int timbradio_vidioc_s_frequency(struct file *file, void *priv,
+       struct v4l2_frequency *f)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_tuner, tuner, s_frequency, f);
+}
+
+static int timbradio_vidioc_g_frequency(struct file *file, void *priv,
+       struct v4l2_frequency *f)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_tuner, tuner, g_frequency, f);
+}
+
+static int timbradio_vidioc_queryctrl(struct file *file, void *priv,
+       struct v4l2_queryctrl *qc)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_dsp, core, queryctrl, qc);
+}
+
+static int timbradio_vidioc_g_ctrl(struct file *file, void *priv,
+       struct v4l2_control *ctrl)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_dsp, core, g_ctrl, ctrl);
+}
+
+static int timbradio_vidioc_s_ctrl(struct file *file, void *priv,
+       struct v4l2_control *ctrl)
+{
+       struct timbradio *tr = video_drvdata(file);
+       return v4l2_subdev_call(tr->sd_dsp, core, s_ctrl, ctrl);
+}
+
+static const struct v4l2_ioctl_ops timbradio_ioctl_ops = {
+       .vidioc_querycap        = timbradio_vidioc_querycap,
+       .vidioc_g_tuner         = timbradio_vidioc_g_tuner,
+       .vidioc_s_tuner         = timbradio_vidioc_s_tuner,
+       .vidioc_g_frequency     = timbradio_vidioc_g_frequency,
+       .vidioc_s_frequency     = timbradio_vidioc_s_frequency,
+       .vidioc_g_input         = timbradio_vidioc_g_input,
+       .vidioc_s_input         = timbradio_vidioc_s_input,
+       .vidioc_g_audio         = timbradio_vidioc_g_audio,
+       .vidioc_s_audio         = timbradio_vidioc_s_audio,
+       .vidioc_queryctrl       = timbradio_vidioc_queryctrl,
+       .vidioc_g_ctrl          = timbradio_vidioc_g_ctrl,
+       .vidioc_s_ctrl          = timbradio_vidioc_s_ctrl
+};
+
+static const struct v4l2_file_operations timbradio_fops = {
+       .owner          = THIS_MODULE,
+       .ioctl          = video_ioctl2,
+};
+
+static int __devinit timbradio_probe(struct platform_device *pdev)
+{
+       struct timb_radio_platform_data *pdata = pdev->dev.platform_data;
+       struct timbradio *tr;
+       int err;
+
+       if (!pdata) {
+               dev_err(&pdev->dev, "Platform data missing\n");
+               err = -EINVAL;
+               goto err;
+       }
+
+       tr = kzalloc(sizeof(*tr), GFP_KERNEL);
+       if (!tr) {
+               err = -ENOMEM;
+               goto err;
+       }
+
+       tr->pdata = *pdata;
+
+       strlcpy(tr->video_dev.name, "Timberdale Radio",
+               sizeof(tr->video_dev.name));
+       tr->video_dev.fops = &timbradio_fops;
+       tr->video_dev.ioctl_ops = &timbradio_ioctl_ops;
+       tr->video_dev.release = video_device_release_empty;
+       tr->video_dev.minor = -1;
+
+       strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name));
+       err = v4l2_device_register(NULL, &tr->v4l2_dev);
+       if (err)
+               goto err_v4l2_dev;
+
+       tr->video_dev.v4l2_dev = &tr->v4l2_dev;
+
+       err = video_register_device(&tr->video_dev, VFL_TYPE_RADIO, -1);
+       if (err) {
+               dev_err(&pdev->dev, "Error reg video\n");
+               goto err_video_req;
+       }
+
+       video_set_drvdata(&tr->video_dev, tr);
+
+       platform_set_drvdata(pdev, tr);
+       return 0;
+
+err_video_req:
+       video_device_release_empty(&tr->video_dev);
+       v4l2_device_unregister(&tr->v4l2_dev);
+err_v4l2_dev:
+       kfree(tr);
+err:
+       dev_err(&pdev->dev, "Failed to register: %d\n", err);
+
+       return err;
+}
+
+static int __devexit timbradio_remove(struct platform_device *pdev)
+{
+       struct timbradio *tr = platform_get_drvdata(pdev);
+
+       video_unregister_device(&tr->video_dev);
+       video_device_release_empty(&tr->video_dev);
+
+       v4l2_device_unregister(&tr->v4l2_dev);
+
+       kfree(tr);
+
+       return 0;
+}
+
+static struct platform_driver timbradio_platform_driver = {
+       .driver = {
+               .name   = DRIVER_NAME,
+               .owner  = THIS_MODULE,
+       },
+       .probe          = timbradio_probe,
+       .remove         = timbradio_remove,
+};
+
+/*--------------------------------------------------------------------------*/
+
+static int __init timbradio_init(void)
+{
+       return platform_driver_register(&timbradio_platform_driver);
+}
+
+static void __exit timbradio_exit(void)
+{
+       platform_driver_unregister(&timbradio_platform_driver);
+}
+
+module_init(timbradio_init);
+module_exit(timbradio_exit);
+
+MODULE_DESCRIPTION("Timberdale Radio driver");
+MODULE_AUTHOR("Mocean Laboratories <info@mocean-labs.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:"DRIVER_NAME);
diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
new file mode 100644 (file)
index 0000000..5db5528
--- /dev/null
@@ -0,0 +1,451 @@
+/*
+ * saa7706.c Philips SAA7706H Car Radio DSP driver
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-chip-ident.h>
+
+#define DRIVER_NAME "saa7706h"
+
+/* the I2C memory map looks like this
+
+       $1C00 - $FFFF Not Used
+       $2200 - $3FFF Reserved YRAM (DSP2) space
+       $2000 - $21FF YRAM (DSP2)
+       $1FF0 - $1FFF Hardware Registers
+       $1280 - $1FEF Reserved XRAM (DSP2) space
+       $1000 - $127F XRAM (DSP2)
+       $0FFF        DSP CONTROL
+       $0A00 - $0FFE Reserved
+       $0980 - $09FF Reserved YRAM (DSP1) space
+       $0800 - $097F YRAM (DSP1)
+       $0200 - $07FF Not Used
+       $0180 - $01FF Reserved XRAM (DSP1) space
+       $0000 - $017F XRAM (DSP1)
+*/
+
+#define SAA7706H_REG_CTRL              0x0fff
+#define SAA7706H_CTRL_BYP_PLL          0x0001
+#define SAA7706H_CTRL_PLL_DIV_MASK     0x003e
+#define SAA7706H_CTRL_PLL3_62975MHZ    0x003e
+#define SAA7706H_CTRL_DSP_TURBO                0x0040
+#define SAA7706H_CTRL_PC_RESET_DSP1    0x0080
+#define SAA7706H_CTRL_PC_RESET_DSP2    0x0100
+#define SAA7706H_CTRL_DSP1_ROM_EN_MASK 0x0600
+#define SAA7706H_CTRL_DSP1_FUNC_PROM   0x0000
+#define SAA7706H_CTRL_DSP2_ROM_EN_MASK 0x1800
+#define SAA7706H_CTRL_DSP2_FUNC_PROM   0x0000
+#define SAA7706H_CTRL_DIG_SIL_INTERPOL 0x8000
+
+#define SAA7706H_REG_EVALUATION                        0x1ff0
+#define SAA7706H_EVAL_DISABLE_CHARGE_PUMP      0x000001
+#define SAA7706H_EVAL_DCS_CLOCK                        0x000002
+#define SAA7706H_EVAL_GNDRC1_ENABLE            0x000004
+#define SAA7706H_EVAL_GNDRC2_ENABLE            0x000008
+
+#define SAA7706H_REG_CL_GEN1                   0x1ff3
+#define SAA7706H_CL_GEN1_MIN_LOOPGAIN_MASK     0x00000f
+#define SAA7706H_CL_GEN1_LOOPGAIN_MASK         0x0000f0
+#define SAA7706H_CL_GEN1_COARSE_RATION         0xffff00
+
+#define SAA7706H_REG_CL_GEN2                   0x1ff4
+#define SAA7706H_CL_GEN2_WSEDGE_FALLING                0x000001
+#define SAA7706H_CL_GEN2_STOP_VCO              0x000002
+#define SAA7706H_CL_GEN2_FRERUN                        0x000004
+#define SAA7706H_CL_GEN2_ADAPTIVE              0x000008
+#define SAA7706H_CL_GEN2_FINE_RATIO_MASK       0x0ffff0
+
+#define SAA7706H_REG_CL_GEN4           0x1ff6
+#define SAA7706H_CL_GEN4_BYPASS_PLL1   0x001000
+#define SAA7706H_CL_GEN4_PLL1_DIV_MASK 0x03e000
+#define SAA7706H_CL_GEN4_DSP1_TURBO    0x040000
+
+#define SAA7706H_REG_SEL       0x1ff7
+#define SAA7706H_SEL_DSP2_SRCA_MASK    0x000007
+#define SAA7706H_SEL_DSP2_FMTA_MASK    0x000031
+#define SAA7706H_SEL_DSP2_SRCB_MASK    0x0001c0
+#define SAA7706H_SEL_DSP2_FMTB_MASK    0x000e00
+#define SAA7706H_SEL_DSP1_SRC_MASK     0x003000
+#define SAA7706H_SEL_DSP1_FMT_MASK     0x01c003
+#define SAA7706H_SEL_SPDIF2            0x020000
+#define SAA7706H_SEL_HOST_IO_FMT_MASK  0x1c0000
+#define SAA7706H_SEL_EN_HOST_IO                0x200000
+
+#define SAA7706H_REG_IAC               0x1ff8
+#define SAA7706H_REG_CLK_SET           0x1ff9
+#define SAA7706H_REG_CLK_COEFF         0x1ffa
+#define SAA7706H_REG_INPUT_SENS                0x1ffb
+#define SAA7706H_INPUT_SENS_RDS_VOL_MASK       0x0003f
+#define SAA7706H_INPUT_SENS_FM_VOL_MASK                0x00fc0
+#define SAA7706H_INPUT_SENS_FM_MPX             0x01000
+#define SAA7706H_INPUT_SENS_OFF_FILTER_A_EN    0x02000
+#define SAA7706H_INPUT_SENS_OFF_FILTER_B_EN    0x04000
+#define SAA7706H_REG_PHONE_NAV_AUDIO   0x1ffc
+#define SAA7706H_REG_IO_CONF_DSP2      0x1ffd
+#define SAA7706H_REG_STATUS_DSP2       0x1ffe
+#define SAA7706H_REG_PC_DSP2           0x1fff
+
+#define SAA7706H_DSP1_MOD0     0x0800
+#define SAA7706H_DSP1_ROM_VER  0x097f
+#define SAA7706H_DSP2_MPTR0    0x1000
+
+#define SAA7706H_DSP1_MODPNTR  0x0000
+
+#define SAA7706H_DSP2_XMEM_CONTLLCW    0x113e
+#define SAA7706H_DSP2_XMEM_BUSAMP      0x114a
+#define SAA7706H_DSP2_XMEM_FDACPNTR    0x11f9
+#define SAA7706H_DSP2_XMEM_IIS1PNTR    0x11fb
+
+#define SAA7706H_DSP2_YMEM_PVGA                0x212a
+#define SAA7706H_DSP2_YMEM_PVAT1       0x212b
+#define SAA7706H_DSP2_YMEM_PVAT                0x212c
+#define SAA7706H_DSP2_YMEM_ROM_VER     0x21ff
+
+#define SUPPORTED_DSP1_ROM_VER         0x667
+
+struct saa7706h_state {
+       struct v4l2_subdev sd;
+       unsigned muted;
+};
+
+static inline struct saa7706h_state *to_state(struct v4l2_subdev *sd)
+{
+       return container_of(sd, struct saa7706h_state, sd);
+}
+
+static int saa7706h_i2c_send(struct i2c_client *client, const u8 *data, int len)
+{
+       int err = i2c_master_send(client, data, len);
+       if (err == len)
+               return 0;
+       return err > 0 ? -EIO : err;
+}
+
+static int saa7706h_i2c_transfer(struct i2c_client *client,
+       struct i2c_msg *msgs, int num)
+{
+       int err = i2c_transfer(client->adapter, msgs, num);
+       if (err == num)
+               return 0;
+       return err > 0 ? -EIO : err;
+}
+
+static int saa7706h_set_reg24(struct v4l2_subdev *sd, u16 reg, u32 val)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 buf[5];
+       int pos = 0;
+
+       buf[pos++] = reg >> 8;
+       buf[pos++] = reg;
+       buf[pos++] = val >> 16;
+       buf[pos++] = val >> 8;
+       buf[pos++] = val;
+
+       return saa7706h_i2c_send(client, buf, pos);
+}
+
+static int saa7706h_set_reg24_err(struct v4l2_subdev *sd, u16 reg, u32 val,
+       int *err)
+{
+       return *err ? *err : saa7706h_set_reg24(sd, reg, val);
+}
+
+static int saa7706h_set_reg16(struct v4l2_subdev *sd, u16 reg, u16 val)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 buf[4];
+       int pos = 0;
+
+       buf[pos++] = reg >> 8;
+       buf[pos++] = reg;
+       buf[pos++] = val >> 8;
+       buf[pos++] = val;
+
+       return saa7706h_i2c_send(client, buf, pos);
+}
+
+static int saa7706h_set_reg16_err(struct v4l2_subdev *sd, u16 reg, u16 val,
+       int *err)
+{
+       return *err ? *err : saa7706h_set_reg16(sd, reg, val);
+}
+
+static int saa7706h_get_reg16(struct v4l2_subdev *sd, u16 reg)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 buf[2];
+       int err;
+       u8 regaddr[] = {reg >> 8, reg};
+       struct i2c_msg msg[] = { {client->addr, 0, sizeof(regaddr), regaddr},
+                               {client->addr, I2C_M_RD, sizeof(buf), buf} };
+
+       err = saa7706h_i2c_transfer(client, msg, ARRAY_SIZE(msg));
+       if (err)
+               return err;
+
+       return buf[0] << 8 | buf[1];
+}
+
+static int saa7706h_unmute(struct v4l2_subdev *sd)
+{
+       struct saa7706h_state *state = to_state(sd);
+       int err = 0;
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_REG_CTRL,
+               SAA7706H_CTRL_PLL3_62975MHZ | SAA7706H_CTRL_PC_RESET_DSP1 |
+               SAA7706H_CTRL_PC_RESET_DSP2, &err);
+
+       /* newer versions of the chip requires a small sleep after reset */
+       msleep(1);
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_REG_CTRL,
+               SAA7706H_CTRL_PLL3_62975MHZ, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_EVALUATION, 0, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN1, 0x040022, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN2,
+               SAA7706H_CL_GEN2_WSEDGE_FALLING, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN4, 0x024080, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_SEL, 0x200080, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_IAC, 0xf4caed, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CLK_SET, 0x124334, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CLK_COEFF, 0x004a1a,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_INPUT_SENS, 0x0071c7,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_PHONE_NAV_AUDIO,
+               0x0e22ff, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_IO_CONF_DSP2, 0x001ff8,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_STATUS_DSP2, 0x080003,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_REG_PC_DSP2, 0x000004, &err);
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_DSP1_MOD0, 0x0c6c, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_MPTR0, 0x000b4b, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP1_MODPNTR, 0x000600, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP1_MODPNTR, 0x0000c0, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x000819,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x00085a,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_BUSAMP, 0x7fffff,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_FDACPNTR, 0x2000cb,
+               &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_IIS1PNTR, 0x2000cb,
+               &err);
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVGA, 0x0f80, &err);
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVAT1, 0x0800,
+               &err);
+
+       err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVAT, 0x0800, &err);
+
+       err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x000905,
+               &err);
+       if (!err)
+               state->muted = 0;
+       return err;
+}
+
+static int saa7706h_mute(struct v4l2_subdev *sd)
+{
+       struct saa7706h_state *state = to_state(sd);
+       int err;
+
+       err = saa7706h_set_reg16(sd, SAA7706H_REG_CTRL,
+               SAA7706H_CTRL_PLL3_62975MHZ | SAA7706H_CTRL_PC_RESET_DSP1 |
+               SAA7706H_CTRL_PC_RESET_DSP2);
+       if (!err)
+               state->muted = 1;
+       return err;
+}
+
+static int saa7706h_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
+{
+       switch (qc->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
+       }
+       return -EINVAL;
+}
+
+static int saa7706h_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
+{
+       struct saa7706h_state *state = to_state(sd);
+
+       switch (ctrl->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               ctrl->value = state->muted;
+               return 0;
+       }
+       return -EINVAL;
+}
+
+static int saa7706h_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
+{
+       switch (ctrl->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               if (ctrl->value)
+                       return saa7706h_mute(sd);
+               return saa7706h_unmute(sd);
+       }
+       return -EINVAL;
+}
+
+static int saa7706h_g_chip_ident(struct v4l2_subdev *sd,
+       struct v4l2_dbg_chip_ident *chip)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+       return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_SAA7706H, 0);
+}
+
+static const struct v4l2_subdev_core_ops saa7706h_core_ops = {
+       .g_chip_ident = saa7706h_g_chip_ident,
+       .queryctrl = saa7706h_queryctrl,
+       .g_ctrl = saa7706h_g_ctrl,
+       .s_ctrl = saa7706h_s_ctrl,
+};
+
+static const struct v4l2_subdev_ops saa7706h_ops = {
+       .core = &saa7706h_core_ops,
+};
+
+/*
+ * Generic i2c probe
+ * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
+ */
+
+static int __devinit saa7706h_probe(struct i2c_client *client,
+                       const struct i2c_device_id *id)
+{
+       struct saa7706h_state *state;
+       struct v4l2_subdev *sd;
+       int err;
+
+       /* Check if the adapter supports the needed features */
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+               return -EIO;
+
+       v4l_info(client, "chip found @ 0x%02x (%s)\n",
+                       client->addr << 1, client->adapter->name);
+
+       state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL);
+       if (state == NULL)
+               return -ENOMEM;
+       sd = &state->sd;
+       v4l2_i2c_subdev_init(sd, client, &saa7706h_ops);
+
+       /* check the rom versions */
+       err = saa7706h_get_reg16(sd, SAA7706H_DSP1_ROM_VER);
+       if (err < 0)
+               goto err;
+       if (err != SUPPORTED_DSP1_ROM_VER)
+               v4l2_warn(sd, "Unknown DSP1 ROM code version: 0x%x\n", err);
+
+       state->muted = 1;
+
+       /* startup in a muted state */
+       err = saa7706h_mute(sd);
+       if (err)
+               goto err;
+
+       return 0;
+
+err:
+       v4l2_device_unregister_subdev(sd);
+       kfree(to_state(sd));
+
+       printk(KERN_ERR DRIVER_NAME ": Failed to probe: %d\n", err);
+
+       return err;
+}
+
+static int __devexit saa7706h_remove(struct i2c_client *client)
+{
+       struct v4l2_subdev *sd = i2c_get_clientdata(client);
+
+       saa7706h_mute(sd);
+       v4l2_device_unregister_subdev(sd);
+       kfree(to_state(sd));
+       return 0;
+}
+
+static const struct i2c_device_id saa7706h_id[] = {
+       {DRIVER_NAME, 0},
+       {},
+};
+
+MODULE_DEVICE_TABLE(i2c, saa7706h_id);
+
+static struct i2c_driver saa7706h_driver = {
+       .driver = {
+               .owner  = THIS_MODULE,
+               .name   = DRIVER_NAME,
+       },
+       .probe          = saa7706h_probe,
+       .remove         = saa7706h_remove,
+       .id_table       = saa7706h_id,
+};
+
+static __init int saa7706h_init(void)
+{
+       return i2c_add_driver(&saa7706h_driver);
+}
+
+static __exit void saa7706h_exit(void)
+{
+       i2c_del_driver(&saa7706h_driver);
+}
+
+module_init(saa7706h_init);
+module_exit(saa7706h_exit);
+
+MODULE_DESCRIPTION("SAA7706H Car Radio DSP driver");
+MODULE_AUTHOR("Mocean Laboratories");
+MODULE_LICENSE("GPL v2");
index 4da0f150c6e28288cf7ab130f8ffcb4ce669984e..47075fc71f112a8e7be6b6dfac8133a1ad9ab490 100644 (file)
@@ -724,7 +724,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
                tuner->audmode = V4L2_TUNER_MODE_MONO;
 
        /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */
-       /* measured in units of db쨉V in 1 db increments (max at ~75 db쨉V) */
+       /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */
        tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI);
        /* the ideal factor is 0xffff/75 = 873,8 */
        tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10);
index a96e1b9dd646485431a3ed278b46080a9c3b8bb7..6f60841828dace59eda8b836475dc70a9b35e6c7 100644 (file)
@@ -590,8 +590,9 @@ int si470x_fops_release(struct file *file)
                        video_unregister_device(radio->videodev);
                        kfree(radio->int_in_buffer);
                        kfree(radio->buffer);
+                       mutex_unlock(&radio->disconnect_lock);
                        kfree(radio);
-                       goto unlock;
+                       goto done;
                }
 
                /* cancel read processes */
@@ -601,7 +602,6 @@ int si470x_fops_release(struct file *file)
                retval = si470x_stop(radio);
                usb_autopm_put_interface(radio->intf);
        }
-unlock:
        mutex_unlock(&radio->disconnect_lock);
 done:
        return retval;
@@ -842,9 +842,11 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
                kfree(radio->int_in_buffer);
                video_unregister_device(radio->videodev);
                kfree(radio->buffer);
+               mutex_unlock(&radio->disconnect_lock);
                kfree(radio);
+       } else {
+               mutex_unlock(&radio->disconnect_lock);
        }
-       mutex_unlock(&radio->disconnect_lock);
 }
 
 
index 2f83be766d9f5d5e44b7821274571d256796669b..f8fc8654693dde77814735e4deba5ed92991a109 100644 (file)
@@ -388,6 +388,15 @@ config VIDEO_TVP5150
          To compile this driver as a module, choose M here: the
          module will be called tvp5150.
 
+config VIDEO_TVP7002
+       tristate "Texas Instruments TVP7002 video decoder"
+       depends on VIDEO_V4L2 && I2C
+       ---help---
+         Support for the Texas Instruments TVP7002 video decoder.
+
+         To compile this driver as a module, choose M here: the
+         module will be called tvp7002.
+
 config VIDEO_VPX3220
        tristate "vpx3220a, vpx3216b & vpx3214c video decoders"
        depends on VIDEO_V4L2 && I2C
@@ -548,7 +557,6 @@ config VIDEO_VPSS_SYSTEM
        depends on ARCH_DAVINCI
        help
          Support for vpss system module for video driver
-       default y
 
 config VIDEO_VPFE_CAPTURE
        tristate "VPFE Video Capture Driver"
@@ -592,6 +600,19 @@ config VIDEO_DM355_CCDC
           To compile this driver as a module, choose M here: the
           module will be called vpfe.
 
+config VIDEO_ISIF
+       tristate "ISIF HW module"
+       depends on ARCH_DAVINCI_DM365 && VIDEO_VPFE_CAPTURE
+       select VIDEO_VPSS_SYSTEM
+       default y
+       help
+          Enables ISIF hw module. This is the hardware module for
+          configuring ISIF in VPFE to capture Raw Bayer RGB data  from
+          a image sensor or YUV data from a YUV source.
+
+          To compile this driver as a module, choose M here: the
+          module will be called vpfe.
+
 source "drivers/media/video/bt8xx/Kconfig"
 
 config VIDEO_PMS
@@ -638,9 +659,14 @@ config VIDEO_W9966
          information.
 
 config VIDEO_CPIA
-       tristate "CPiA Video For Linux"
+       tristate "CPiA Video For Linux (DEPRECATED)"
        depends on VIDEO_V4L1
+       default n
        ---help---
+         This driver is DEPRECATED please use the gspca cpia1 module
+         instead. Note that you need atleast version 0.6.4 of libv4l for
+         the cpia1 gspca module.
+
          This is the video4linux driver for cameras based on Vision's CPiA
          (Colour Processor Interface ASIC), such as the Creative Labs Video
          Blaster Webcam II. If you have one of these cameras, say Y here
@@ -944,6 +970,8 @@ source "drivers/media/video/hdpvr/Kconfig"
 
 source "drivers/media/video/em28xx/Kconfig"
 
+source "drivers/media/video/tlg2300/Kconfig"
+
 source "drivers/media/video/cx231xx/Kconfig"
 
 source "drivers/media/video/usbvision/Kconfig"
@@ -955,6 +983,7 @@ source "drivers/media/video/et61x251/Kconfig"
 config VIDEO_OVCAMCHIP
        tristate "OmniVision Camera Chip support (DEPRECATED)"
        depends on I2C && VIDEO_V4L1
+       default n
        ---help---
          This driver is DEPRECATED please use the gspca ov519 module
          instead. Note that for the ov511 / ov518 support of the gspca module
@@ -971,6 +1000,7 @@ config VIDEO_OVCAMCHIP
 config USB_W9968CF
        tristate "USB W996[87]CF JPEG Dual Mode Camera support (DEPRECATED)"
        depends on VIDEO_V4L1 && I2C && VIDEO_OVCAMCHIP
+       default n
        ---help---
          This driver is DEPRECATED please use the gspca ov519 module
          instead. Note that for the w9968cf support of the gspca module
@@ -992,6 +1022,7 @@ config USB_W9968CF
 config USB_OV511
        tristate "USB OV511 Camera support (DEPRECATED)"
        depends on VIDEO_V4L1
+       default n
        ---help---
          This driver is DEPRECATED please use the gspca ov519 module
          instead. Note that for the ov511 / ov518 support of the gspca module
@@ -1020,6 +1051,7 @@ source "drivers/media/video/sn9c102/Kconfig"
 config USB_STV680
        tristate "USB STV680 (Pencam) Camera support (DEPRECATED)"
        depends on VIDEO_V4L1
+       default n
        ---help---
          This driver is DEPRECATED please use the gspca stv0680 module
          instead. Note that for the gspca stv0680 module you need
index 2af68ee841225813409c233af39bc46f4d315d76..b88b6174a3313dc0b4982f8e19055a3556ae952c 100644 (file)
@@ -56,6 +56,7 @@ obj-$(CONFIG_VIDEO_THS7303) += ths7303.o
 obj-$(CONFIG_VIDEO_VINO) += indycam.o
 obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
 obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
+obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o
 obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
 obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
 obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
@@ -99,6 +100,7 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o
 obj-$(CONFIG_VIDEO_SAA7134) += saa7134/
 obj-$(CONFIG_VIDEO_CX88) += cx88/
 obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
+obj-$(CONFIG_VIDEO_TLG2300) += tlg2300/
 obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
 obj-$(CONFIG_VIDEO_USBVISION) += usbvision/
 obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/
index 5bb0f9e7158371d353860eac61964804d94fd92e..547e1a93c421d004f78b0adc091eb098bcece593 100644 (file)
@@ -254,7 +254,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
                v4l2_err(sd, "no notify found!\n");
 
        if (std & V4L2_STD_NTSC) {
-               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL);
                bt819_setbit(decoder, 0x01, 0, 1);
                bt819_setbit(decoder, 0x01, 1, 0);
                bt819_setbit(decoder, 0x01, 5, 0);
@@ -263,7 +263,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
                /* bt819_setbit(decoder, 0x1a,  5, 1); */
                timing = &timing_data[1];
        } else if (std & V4L2_STD_PAL) {
-               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL);
                bt819_setbit(decoder, 0x01, 0, 1);
                bt819_setbit(decoder, 0x01, 1, 1);
                bt819_setbit(decoder, 0x01, 5, 1);
@@ -288,7 +288,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
        bt819_write(decoder, 0x08, (timing->hscale >> 8) & 0xff);
        bt819_write(decoder, 0x09, timing->hscale & 0xff);
        decoder->norm = std;
-       v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0);
+       v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, NULL);
        return 0;
 }
 
@@ -306,7 +306,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd,
                v4l2_err(sd, "no notify found!\n");
 
        if (decoder->input != input) {
-               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL);
                decoder->input = input;
                /* select mode */
                if (decoder->input == 0) {
@@ -316,7 +316,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd,
                        bt819_setbit(decoder, 0x0b, 6, 1);
                        bt819_setbit(decoder, 0x1a, 1, 0);
                }
-               v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0);
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, NULL);
        }
        return 0;
 }
index 3182a406bdd1ad11ae7f3ba41bd44fa543dd764a..cb46e8fa8aaa3b9ce2d64a4d565a47a098950674 100644 (file)
@@ -81,6 +81,7 @@ static int video_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
 static int radio_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
 static int vbi_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
 static int debug_latency;
+static int disable_ir;
 
 static unsigned int fdsr;
 
@@ -107,6 +108,7 @@ module_param(bttv_gpio,         int, 0644);
 module_param(bttv_debug,        int, 0644);
 module_param(irq_debug,         int, 0644);
 module_param(debug_latency,     int, 0644);
+module_param(disable_ir,        int, 0444);
 
 module_param(fdsr,              int, 0444);
 module_param(gbuffers,          int, 0444);
@@ -139,6 +141,7 @@ MODULE_PARM_DESC(bttv_verbose,"verbose startup messages, default is 1 (yes)");
 MODULE_PARM_DESC(bttv_gpio,"log gpio changes, default is 0 (no)");
 MODULE_PARM_DESC(bttv_debug,"debug messages, default is 0 (no)");
 MODULE_PARM_DESC(irq_debug,"irq handler debug messages, default is 0 (no)");
+MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
 MODULE_PARM_DESC(gbuffers,"number of capture buffers. range 2-32, default 8");
 MODULE_PARM_DESC(gbufsize,"size of the capture buffers, default is 0x208000");
 MODULE_PARM_DESC(reset_crop,"reset cropping parameters at open(), default "
@@ -4461,7 +4464,10 @@ static int __devinit bttv_probe(struct pci_dev *dev,
                request_modules(btv);
        }
 
-       bttv_input_init(btv);
+       if (!disable_ir) {
+               init_bttv_i2c_ir(btv);
+               bttv_input_init(btv);
+       }
 
        /* everything is fine */
        bttv_num++;
index 63aa31a041e848846998515f1b1dc825ebc62c5a..407fa61e4cdab12269358063b562157b1c6c0a31 100644 (file)
@@ -388,7 +388,12 @@ int __devinit init_bttv_i2c(struct bttv *btv)
        if (0 == btv->i2c_rc && i2c_scan)
                do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
 
-       /* Instantiate the IR receiver device, if present */
+       return btv->i2c_rc;
+}
+
+/* Instantiate the I2C IR receiver device, if present */
+void __devinit init_bttv_i2c_ir(struct bttv *btv)
+{
        if (0 == btv->i2c_rc) {
                struct i2c_board_info info;
                /* The external IR receiver is at i2c address 0x34 (0x35 for
@@ -408,7 +413,6 @@ int __devinit init_bttv_i2c(struct bttv *btv)
                strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
                i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
        }
-       return btv->i2c_rc;
 }
 
 int __devexit fini_bttv_i2c(struct bttv *btv)
index 277a092e1214df0b4b80fc9ddf4ff0655ed32367..b320dbd635aab0844b69ad2c2a99ed0e5b8b52b7 100644 (file)
@@ -247,7 +247,7 @@ int bttv_input_init(struct bttv *btv)
        struct card_ir *ir;
        struct ir_scancode_table *ir_codes = NULL;
        struct input_dev *input_dev;
-       int ir_type = IR_TYPE_OTHER;
+       u64 ir_type = IR_TYPE_OTHER;
        int err = -ENOMEM;
 
        if (!btv->has_remote)
@@ -389,7 +389,7 @@ int bttv_input_init(struct bttv *btv)
        bttv_ir_start(btv, ir);
 
        /* all done */
-       err = ir_input_register(btv->remote->dev, ir_codes);
+       err = ir_input_register(btv->remote->dev, ir_codes, NULL);
        if (err)
                goto err_out_stop;
 
index a1d0e9c9f2866ea3a11b24f4357ac31547899b4b..6cccc2a17eee074f121fee7aabbb581223df1905 100644 (file)
@@ -279,6 +279,7 @@ extern unsigned int bttv_debug;
 extern unsigned int bttv_gpio;
 extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
 extern int init_bttv_i2c(struct bttv *btv);
+extern void init_bttv_i2c_ir(struct bttv *btv);
 extern int fini_bttv_i2c(struct bttv *btv);
 
 #define bttv_printk if (bttv_verbose) printk
index 7bb9c1ec7819fc7b6d83076b98fb8eae41ede5f8..cbbf7e80d2cf856b5de2aed6ab6ca4d14b8d76f9 100644 (file)
@@ -1907,7 +1907,6 @@ static int cafe_pci_probe(struct pci_dev *pdev,
                goto out_free;
 
        mutex_init(&cam->s_mutex);
-       mutex_lock(&cam->s_mutex);
        spin_lock_init(&cam->dev_lock);
        cam->state = S_NOTREADY;
        cafe_set_config_needed(cam, 1);
@@ -1947,7 +1946,6 @@ static int cafe_pci_probe(struct pci_dev *pdev,
         * because the sensor could attach in this call chain, leading to
         * unsightly deadlocks.
         */
-       mutex_unlock(&cam->s_mutex);  /* attach can deadlock */
        ret = cafe_smbus_setup(cam);
        if (ret)
                goto out_freeirq;
@@ -1973,7 +1971,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
        cam->vdev.v4l2_dev = &cam->v4l2_dev;
        ret = video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1);
        if (ret)
-               goto out_smbus;
+               goto out_unlock;
        video_set_drvdata(&cam->vdev, cam);
 
        /*
@@ -1988,6 +1986,8 @@ static int cafe_pci_probe(struct pci_dev *pdev,
        mutex_unlock(&cam->s_mutex);
        return 0;
 
+out_unlock:
+       mutex_unlock(&cam->s_mutex);
 out_smbus:
        cafe_smbus_shutdown(cam);
 out_freeirq:
index 551ddf216a4bb21d51b9c6425a992946594d0e0f..933ae4c8cb9a6467b63f2d576e2b008b86c95ae8 100644 (file)
@@ -3737,9 +3737,6 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
        if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE)
                return -EINVAL;
 
-       if (!cam || !cam->ops)
-               return -ENODEV;
-
        /* make this _really_ smp-safe */
        if (mutex_lock_interruptible(&cam->busy_lock))
                return -EINTR;
index e8a50a611ebc38b7050b2f84c820c323c521a862..baf7e91ee0f5a6ffd07c8b0c75e5337a038ccec1 100644 (file)
@@ -19,3 +19,14 @@ config VIDEO_CX18
 
          To compile this driver as a module, choose M here: the
          module will be called cx18.
+
+config VIDEO_CX18_ALSA
+       tristate "Conexant 23418 DMA audio support"
+       depends on VIDEO_CX18 && SND && EXPERIMENTAL
+       select SND_PCM
+       ---help---
+         This is a video4linux driver for direct (DMA) audio on
+         Conexant 23418 based TV cards using ALSA.
+
+         To compile this driver as a module, choose M here: the
+         module will be called cx18-alsa.
index f7bf0edf93f9dbf9beceac7fddf5f2a07f79dbf7..2fadd9ded34062097c777739da66d6c23610bdfa 100644 (file)
@@ -3,8 +3,10 @@ cx18-objs    := cx18-driver.o cx18-cards.o cx18-i2c.o cx18-firmware.o cx18-gpio.
        cx18-mailbox.o cx18-vbi.o cx18-audio.o cx18-video.o cx18-irq.o \
        cx18-av-core.o cx18-av-audio.o cx18-av-firmware.o cx18-av-vbi.o cx18-scb.o \
        cx18-dvb.o cx18-io.o
+cx18-alsa-objs := cx18-alsa-main.o cx18-alsa-pcm.o
 
 obj-$(CONFIG_VIDEO_CX18) += cx18.o
+obj-$(CONFIG_VIDEO_CX18_ALSA) += cx18-alsa.o
 
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
 EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c
new file mode 100644 (file)
index 0000000..eb41d7e
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *  Copyright (C) 2009  Devin Heitmueller <dheitmueller@kernellabs.com>
+ *
+ *  Portions of this work were sponsored by ONELAN Limited.
+ *
+ *  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
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/spinlock.h>
+
+#include <media/v4l2-device.h>
+
+#include <sound/core.h>
+#include <sound/initval.h>
+
+#include "cx18-driver.h"
+#include "cx18-version.h"
+#include "cx18-alsa.h"
+#include "cx18-alsa-mixer.h"
+#include "cx18-alsa-pcm.h"
+
+int cx18_alsa_debug;
+
+#define CX18_DEBUG_ALSA_INFO(fmt, arg...) \
+       do { \
+               if (cx18_alsa_debug & 2) \
+                       printk(KERN_INFO "%s: " fmt, "cx18-alsa", ## arg); \
+       } while (0);
+
+module_param_named(debug, cx18_alsa_debug, int, 0644);
+MODULE_PARM_DESC(debug,
+                "Debug level (bitmask). Default: 0\n"
+                "\t\t\t  1/0x0001: warning\n"
+                "\t\t\t  2/0x0002: info\n");
+
+MODULE_AUTHOR("Andy Walls");
+MODULE_DESCRIPTION("CX23418 ALSA Interface");
+MODULE_SUPPORTED_DEVICE("CX23418 MPEG2 encoder");
+MODULE_LICENSE("GPL");
+
+MODULE_VERSION(CX18_VERSION);
+
+static inline
+struct snd_cx18_card *to_snd_cx18_card(struct v4l2_device *v4l2_dev)
+{
+       return to_cx18(v4l2_dev)->alsa;
+}
+
+static inline
+struct snd_cx18_card *p_to_snd_cx18_card(struct v4l2_device **v4l2_dev)
+{
+       return container_of(v4l2_dev, struct snd_cx18_card, v4l2_dev);
+}
+
+static void snd_cx18_card_free(struct snd_cx18_card *cxsc)
+{
+       if (cxsc == NULL)
+               return;
+
+       if (cxsc->v4l2_dev != NULL)
+               to_cx18(cxsc->v4l2_dev)->alsa = NULL;
+
+       /* FIXME - take any other stopping actions needed */
+
+       kfree(cxsc);
+}
+
+static void snd_cx18_card_private_free(struct snd_card *sc)
+{
+       if (sc == NULL)
+               return;
+       snd_cx18_card_free(sc->private_data);
+       sc->private_data = NULL;
+       sc->private_free = NULL;
+}
+
+static int snd_cx18_card_create(struct v4l2_device *v4l2_dev,
+                                      struct snd_card *sc,
+                                      struct snd_cx18_card **cxsc)
+{
+       *cxsc = kzalloc(sizeof(struct snd_cx18_card), GFP_KERNEL);
+       if (*cxsc == NULL)
+               return -ENOMEM;
+
+       (*cxsc)->v4l2_dev = v4l2_dev;
+       (*cxsc)->sc = sc;
+
+       sc->private_data = *cxsc;
+       sc->private_free = snd_cx18_card_private_free;
+
+       return 0;
+}
+
+static int snd_cx18_card_set_names(struct snd_cx18_card *cxsc)
+{
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+       struct snd_card *sc = cxsc->sc;
+
+       /* sc->driver is used by alsa-lib's configurator: simple, unique */
+       strlcpy(sc->driver, "CX23418", sizeof(sc->driver));
+
+       /* sc->shortname is a symlink in /proc/asound: CX18-M -> cardN */
+       snprintf(sc->shortname,  sizeof(sc->shortname), "CX18-%d",
+                cx->instance);
+
+       /* sc->longname is read from /proc/asound/cards */
+       snprintf(sc->longname, sizeof(sc->longname),
+                "CX23418 #%d %s TV/FM Radio/Line-In Capture",
+                cx->instance, cx->card_name);
+
+       return 0;
+}
+
+static int snd_cx18_init(struct v4l2_device *v4l2_dev)
+{
+       struct cx18 *cx = to_cx18(v4l2_dev);
+       struct snd_card *sc = NULL;
+       struct snd_cx18_card *cxsc;
+       int ret;
+
+       /* Numbrs steps from "Writing an ALSA Driver" by Takashi Iwai */
+
+       /* (1) Check and increment the device index */
+       /* This is a no-op for us.  We'll use the cx->instance */
+
+       /* (2) Create a card instance */
+       ret = snd_card_create(SNDRV_DEFAULT_IDX1, /* use first available id */
+                             SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
+                             THIS_MODULE, 0, &sc);
+       if (ret) {
+               CX18_ALSA_ERR("%s: snd_card_create() failed with err %d\n",
+                             __func__, ret);
+               goto err_exit;
+       }
+
+       /* (3) Create a main component */
+       ret = snd_cx18_card_create(v4l2_dev, sc, &cxsc);
+       if (ret) {
+               CX18_ALSA_ERR("%s: snd_cx18_card_create() failed with err %d\n",
+                             __func__, ret);
+               goto err_exit_free;
+       }
+
+       /* (4) Set the driver ID and name strings */
+       snd_cx18_card_set_names(cxsc);
+
+
+       ret = snd_cx18_pcm_create(cxsc);
+       if (ret) {
+               CX18_ALSA_ERR("%s: snd_cx18_pcm_create() failed with err %d\n",
+                             __func__, ret);
+               goto err_exit_free;
+       }
+       /* FIXME - proc files */
+
+       /* (7) Set the driver data and return 0 */
+       /* We do this out of normal order for PCI drivers to avoid races */
+       cx->alsa = cxsc;
+
+       /* (6) Register the card instance */
+       ret = snd_card_register(sc);
+       if (ret) {
+               cx->alsa = NULL;
+               CX18_ALSA_ERR("%s: snd_card_register() failed with err %d\n",
+                             __func__, ret);
+               goto err_exit_free;
+       }
+
+       return 0;
+
+err_exit_free:
+       if (sc != NULL)
+               snd_card_free(sc);
+err_exit:
+       return ret;
+}
+
+int cx18_alsa_load(struct cx18 *cx)
+{
+       struct v4l2_device *v4l2_dev = &cx->v4l2_dev;
+       struct cx18_stream *s;
+
+       if (v4l2_dev == NULL) {
+               printk(KERN_ERR "cx18-alsa: %s: struct v4l2_device * is NULL\n",
+                      __func__);
+               return 0;
+       }
+
+       cx = to_cx18(v4l2_dev);
+       if (cx == NULL) {
+               printk(KERN_ERR "cx18-alsa cx is NULL\n");
+               return 0;
+       }
+
+       s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];
+       if (s->video_dev == NULL) {
+               CX18_DEBUG_ALSA_INFO("%s: PCM stream for card is disabled - "
+                                    "skipping\n", __func__);
+               return 0;
+       }
+
+       if (cx->alsa != NULL) {
+               CX18_ALSA_ERR("%s: struct snd_cx18_card * already exists\n",
+                             __func__);
+               return 0;
+       }
+
+       if (snd_cx18_init(v4l2_dev)) {
+               CX18_ALSA_ERR("%s: failed to create struct snd_cx18_card\n",
+                             __func__);
+       } else {
+               CX18_DEBUG_ALSA_INFO("%s: created cx18 ALSA interface instance "
+                                    "\n", __func__);
+       }
+       return 0;
+}
+
+static int __init cx18_alsa_init(void)
+{
+       printk(KERN_INFO "cx18-alsa: module loading...\n");
+       cx18_ext_init = &cx18_alsa_load;
+       return 0;
+}
+
+static void __exit snd_cx18_exit(struct snd_cx18_card *cxsc)
+{
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+
+       /* FIXME - pointer checks & shutdown cxsc */
+
+       snd_card_free(cxsc->sc);
+       cx->alsa = NULL;
+}
+
+static int __exit cx18_alsa_exit_callback(struct device *dev, void *data)
+{
+       struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
+       struct snd_cx18_card *cxsc;
+
+       if (v4l2_dev == NULL) {
+               printk(KERN_ERR "cx18-alsa: %s: struct v4l2_device * is NULL\n",
+                      __func__);
+               return 0;
+       }
+
+       cxsc = to_snd_cx18_card(v4l2_dev);
+       if (cxsc == NULL) {
+               CX18_ALSA_WARN("%s: struct snd_cx18_card * is NULL\n",
+                              __func__);
+               return 0;
+       }
+
+       snd_cx18_exit(cxsc);
+       return 0;
+}
+
+static void __exit cx18_alsa_exit(void)
+{
+       struct device_driver *drv;
+       int ret;
+
+       printk(KERN_INFO "cx18-alsa: module unloading...\n");
+
+       drv = driver_find("cx18", &pci_bus_type);
+       ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback);
+       put_driver(drv);
+
+       cx18_ext_init = NULL;
+       printk(KERN_INFO "cx18-alsa: module unload complete\n");
+}
+
+module_init(cx18_alsa_init);
+module_exit(cx18_alsa_exit);
diff --git a/drivers/media/video/cx18/cx18-alsa-mixer.c b/drivers/media/video/cx18/cx18-alsa-mixer.c
new file mode 100644 (file)
index 0000000..ef21114
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ *  ALSA mixer controls for the
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *
+ *  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
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/spinlock.h>
+#include <linux/videodev2.h>
+
+#include <media/v4l2-device.h>
+
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/tlv.h>
+
+#include "cx18-alsa.h"
+#include "cx18-driver.h"
+
+/*
+ * Note the cx18-av-core volume scale is funny, due to the alignment of the
+ * scale with another chip's range:
+ *
+ * v4l2_control value  /512    indicated dB    actual dB       reg 0x8d4
+ * 0x0000 - 0x01ff       0     -119            -96             228
+ * 0x0200 - 0x02ff       1     -118            -96             228
+ * ...
+ * 0x2c00 - 0x2dff      22      -97            -96             228
+ * 0x2e00 - 0x2fff      23      -96            -96             228
+ * 0x3000 - 0x31ff      24      -95            -95             226
+ * ...
+ * 0xee00 - 0xefff     119        0              0              36
+ * ...
+ * 0xfe00 - 0xffff     127       +8             +8              20
+ */
+static inline int dB_to_cx18_av_vol(int dB)
+{
+       if (dB < -96)
+               dB = -96;
+       else if (dB > 8)
+               dB = 8;
+       return (dB + 119) << 9;
+}
+
+static inline int cx18_av_vol_to_dB(int v)
+{
+       if (v < (23 << 9))
+               v = (23 << 9);
+       else if (v > (127 << 9))
+               v = (127 << 9);
+       return (v >> 9) - 119;
+}
+
+static int snd_cx18_mixer_tv_vol_info(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_info *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = 1;
+       /* We're already translating values, just keep this control in dB */
+       uinfo->value.integer.min  = -96;
+       uinfo->value.integer.max  =   8;
+       uinfo->value.integer.step =   1;
+       return 0;
+}
+
+static int snd_cx18_mixer_tv_vol_get(struct snd_kcontrol *kctl,
+                                    struct snd_ctl_elem_value *uctl)
+{
+       struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+       struct v4l2_control vctrl;
+       int ret;
+
+       vctrl.id = V4L2_CID_AUDIO_VOLUME;
+       vctrl.value = dB_to_cx18_av_vol(uctl->value.integer.value[0]);
+
+       snd_cx18_lock(cxsc);
+       ret = v4l2_subdev_call(cx->sd_av, core, g_ctrl, &vctrl);
+       snd_cx18_unlock(cxsc);
+
+       if (!ret)
+               uctl->value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
+       return ret;
+}
+
+static int snd_cx18_mixer_tv_vol_put(struct snd_kcontrol *kctl,
+                                    struct snd_ctl_elem_value *uctl)
+{
+       struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+       struct v4l2_control vctrl;
+       int ret;
+
+       vctrl.id = V4L2_CID_AUDIO_VOLUME;
+       vctrl.value = dB_to_cx18_av_vol(uctl->value.integer.value[0]);
+
+       snd_cx18_lock(cxsc);
+
+       /* Fetch current state */
+       ret = v4l2_subdev_call(cx->sd_av, core, g_ctrl, &vctrl);
+
+       if (ret ||
+           (cx18_av_vol_to_dB(vctrl.value) != uctl->value.integer.value[0])) {
+
+               /* Set, if needed */
+               vctrl.value = dB_to_cx18_av_vol(uctl->value.integer.value[0]);
+               ret = v4l2_subdev_call(cx->sd_av, core, s_ctrl, &vctrl);
+               if (!ret)
+                       ret = 1; /* Indicate control was changed w/o error */
+       }
+       snd_cx18_unlock(cxsc);
+
+       return ret;
+}
+
+
+/* This is a bit of overkill, the slider is already in dB internally */
+static DECLARE_TLV_DB_SCALE(snd_cx18_mixer_tv_vol_db_scale, -9600, 100, 0);
+
+static struct snd_kcontrol_new snd_cx18_mixer_tv_vol __initdata = {
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name = "Analog TV Capture Volume",
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+       .info = snd_cx18_mixer_tv_volume_info,
+       .get = snd_cx18_mixer_tv_volume_get,
+       .put = snd_cx18_mixer_tv_volume_put,
+       .tlv.p = snd_cx18_mixer_tv_vol_db_scale
+};
+
+/* FIXME - add mute switch and balance, bass, treble sliders:
+       V4L2_CID_AUDIO_MUTE
+
+       V4L2_CID_AUDIO_BALANCE
+
+       V4L2_CID_AUDIO_BASS
+       V4L2_CID_AUDIO_TREBLE
+*/
+
+/* FIXME - add stereo, lang1, lang2, mono menu */
+/* FIXME - add CS5345 I2S volume for HVR-1600 */
+
+int __init snd_cx18_mixer_create(struct snd_cx18_card *cxsc)
+{
+       struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;
+       struct snd_card *sc = cxsc->sc;
+       int ret;
+
+       strlcpy(sc->mixername, "CX23418 Mixer", sizeof(sc->mixername));
+
+       ret = snd_ctl_add(sc, snd_ctl_new1(snd_cx18_mixer_tv_vol, cxsc));
+       if (ret) {
+               CX18_ALSA_WARN("%s: failed to add %s control, err %d\n",
+                               __func__, snd_cx18_mixer_tv_vol.name, ret);
+       }
+       return ret;
+}
diff --git a/drivers/media/video/cx18/cx18-alsa-mixer.h b/drivers/media/video/cx18/cx18-alsa-mixer.h
new file mode 100644 (file)
index 0000000..2d418db
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ *  ALSA mixer controls for the
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *
+ *  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
+ */
+
+int __init snd_cx18_mixer_create(struct snd_cx18_card *cxsc);
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c
new file mode 100644 (file)
index 0000000..2bd312d
--- /dev/null
@@ -0,0 +1,354 @@
+/*
+ *  ALSA PCM device for the
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *  Copyright (C) 2009  Devin Heitmueller <dheitmueller@kernellabs.com>
+ *
+ *  Portions of this work were sponsored by ONELAN Limited.
+ *
+ *  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
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/vmalloc.h>
+
+#include <media/v4l2-device.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+
+#include "cx18-driver.h"
+#include "cx18-queue.h"
+#include "cx18-streams.h"
+#include "cx18-fileops.h"
+#include "cx18-alsa.h"
+
+static unsigned int pcm_debug;
+module_param(pcm_debug, int, 0644);
+MODULE_PARM_DESC(pcm_debug, "enable debug messages for pcm");
+
+#define dprintk(fmt, arg...) do {                                      \
+           if (pcm_debug)                                              \
+               printk(KERN_INFO "cx18-alsa-pcm %s: " fmt,              \
+                                 __func__, ##arg);                     \
+       } while (0)
+
+static struct snd_pcm_hardware snd_cx18_hw_capture = {
+       .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
+               SNDRV_PCM_INFO_MMAP           |
+               SNDRV_PCM_INFO_INTERLEAVED    |
+               SNDRV_PCM_INFO_MMAP_VALID,
+
+       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+
+       .rates = SNDRV_PCM_RATE_48000,
+
+       .rate_min = 48000,
+       .rate_max = 48000,
+       .channels_min = 2,
+       .channels_max = 2,
+       .buffer_bytes_max = 62720 * 8,  /* just about the value in usbaudio.c */
+       .period_bytes_min = 64,         /* 12544/2, */
+       .period_bytes_max = 12544,
+       .periods_min = 2,
+       .periods_max = 98,              /* 12544, */
+};
+
+void cx18_alsa_announce_pcm_data(struct snd_cx18_card *cxsc, u8 *pcm_data,
+                                size_t num_bytes)
+{
+       struct snd_pcm_substream *substream;
+       struct snd_pcm_runtime *runtime;
+       unsigned int oldptr;
+       unsigned int stride;
+       int period_elapsed = 0;
+       int length;
+
+       dprintk("cx18 alsa announce ptr=%p data=%p num_bytes=%zd\n", cxsc,
+               pcm_data, num_bytes);
+
+       substream = cxsc->capture_pcm_substream;
+       if (substream == NULL) {
+               dprintk("substream was NULL\n");
+               return;
+       }
+
+       runtime = substream->runtime;
+       if (runtime == NULL) {
+               dprintk("runtime was NULL\n");
+               return;
+       }
+
+       stride = runtime->frame_bits >> 3;
+       if (stride == 0) {
+               dprintk("stride is zero\n");
+               return;
+       }
+
+       length = num_bytes / stride;
+       if (length == 0) {
+               dprintk("%s: length was zero\n", __func__);
+               return;
+       }
+
+       if (runtime->dma_area == NULL) {
+               dprintk("dma area was NULL - ignoring\n");
+               return;
+       }
+
+       oldptr = cxsc->hwptr_done_capture;
+       if (oldptr + length >= runtime->buffer_size) {
+               unsigned int cnt =
+                       runtime->buffer_size - oldptr;
+               memcpy(runtime->dma_area + oldptr * stride, pcm_data,
+                      cnt * stride);
+               memcpy(runtime->dma_area, pcm_data + cnt * stride,
+                      length * stride - cnt * stride);
+       } else {
+               memcpy(runtime->dma_area + oldptr * stride, pcm_data,
+                      length * stride);
+       }
+       snd_pcm_stream_lock(substream);
+
+       cxsc->hwptr_done_capture += length;
+       if (cxsc->hwptr_done_capture >=
+           runtime->buffer_size)
+               cxsc->hwptr_done_capture -=
+                       runtime->buffer_size;
+
+       cxsc->capture_transfer_done += length;
+       if (cxsc->capture_transfer_done >=
+           runtime->period_size) {
+               cxsc->capture_transfer_done -=
+                       runtime->period_size;
+               period_elapsed = 1;
+       }
+
+       snd_pcm_stream_unlock(substream);
+
+       if (period_elapsed)
+               snd_pcm_period_elapsed(substream);
+}
+
+static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
+{
+       struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;
+       struct cx18 *cx = to_cx18(v4l2_dev);
+       struct cx18_stream *s;
+       struct cx18_open_id item;
+       int ret;
+
+       /* Instruct the cx18 to start sending packets */
+       snd_cx18_lock(cxsc);
+       s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];
+
+       item.cx = cx;
+       item.type = s->type;
+       item.open_id = cx->open_id++;
+
+       /* See if the stream is available */
+       if (cx18_claim_stream(&item, item.type)) {
+               /* No, it's already in use */
+               snd_cx18_unlock(cxsc);
+               return -EBUSY;
+       }
+
+       if (test_bit(CX18_F_S_STREAMOFF, &s->s_flags) ||
+           test_and_set_bit(CX18_F_S_STREAMING, &s->s_flags)) {
+               /* We're already streaming.  No additional action required */
+               snd_cx18_unlock(cxsc);
+               return 0;
+       }
+
+
+       runtime->hw = snd_cx18_hw_capture;
+       snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
+       cxsc->capture_pcm_substream = substream;
+       runtime->private_data = cx;
+
+       cx->pcm_announce_callback = cx18_alsa_announce_pcm_data;
+
+       /* Not currently streaming, so start it up */
+       set_bit(CX18_F_S_STREAMING, &s->s_flags);
+       ret = cx18_start_v4l2_encode_stream(s);
+       snd_cx18_unlock(cxsc);
+
+       return 0;
+}
+
+static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream)
+{
+       struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+       struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;
+       struct cx18 *cx = to_cx18(v4l2_dev);
+       struct cx18_stream *s;
+       int ret;
+
+       /* Instruct the cx18 to stop sending packets */
+       snd_cx18_lock(cxsc);
+       s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];
+       ret = cx18_stop_v4l2_encode_stream(s, 0);
+       clear_bit(CX18_F_S_STREAMING, &s->s_flags);
+
+       cx18_release_stream(s);
+
+       cx->pcm_announce_callback = NULL;
+       snd_cx18_unlock(cxsc);
+
+       return 0;
+}
+
+static int snd_cx18_pcm_ioctl(struct snd_pcm_substream *substream,
+                    unsigned int cmd, void *arg)
+{
+       return snd_pcm_lib_ioctl(substream, cmd, arg);
+}
+
+
+static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs,
+                                       size_t size)
+{
+       struct snd_pcm_runtime *runtime = subs->runtime;
+
+       dprintk("Allocating vbuffer\n");
+       if (runtime->dma_area) {
+               if (runtime->dma_bytes > size)
+                       return 0;
+
+               vfree(runtime->dma_area);
+       }
+       runtime->dma_area = vmalloc(size);
+       if (!runtime->dma_area)
+               return -ENOMEM;
+
+       runtime->dma_bytes = size;
+
+       return 0;
+}
+
+static int snd_cx18_pcm_hw_params(struct snd_pcm_substream *substream,
+                        struct snd_pcm_hw_params *params)
+{
+       int ret;
+
+       dprintk("%s called\n", __func__);
+
+       ret = snd_pcm_alloc_vmalloc_buffer(substream,
+                                          params_buffer_bytes(params));
+       return 0;
+}
+
+static int snd_cx18_pcm_hw_free(struct snd_pcm_substream *substream)
+{
+       struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+       unsigned long flags;
+
+       spin_lock_irqsave(&cxsc->slock, flags);
+       if (substream->runtime->dma_area) {
+               dprintk("freeing pcm capture region\n");
+               vfree(substream->runtime->dma_area);
+               substream->runtime->dma_area = NULL;
+       }
+       spin_unlock_irqrestore(&cxsc->slock, flags);
+
+       return 0;
+}
+
+static int snd_cx18_pcm_prepare(struct snd_pcm_substream *substream)
+{
+       struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+
+       cxsc->hwptr_done_capture = 0;
+       cxsc->capture_transfer_done = 0;
+
+       return 0;
+}
+
+static int snd_cx18_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+       return 0;
+}
+
+static
+snd_pcm_uframes_t snd_cx18_pcm_pointer(struct snd_pcm_substream *substream)
+{
+       unsigned long flags;
+       snd_pcm_uframes_t hwptr_done;
+       struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream);
+
+       spin_lock_irqsave(&cxsc->slock, flags);
+       hwptr_done = cxsc->hwptr_done_capture;
+       spin_unlock_irqrestore(&cxsc->slock, flags);
+
+       return hwptr_done;
+}
+
+static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
+                                            unsigned long offset)
+{
+       void *pageptr = subs->runtime->dma_area + offset;
+
+       return vmalloc_to_page(pageptr);
+}
+
+static struct snd_pcm_ops snd_cx18_pcm_capture_ops = {
+       .open           = snd_cx18_pcm_capture_open,
+       .close          = snd_cx18_pcm_capture_close,
+       .ioctl          = snd_cx18_pcm_ioctl,
+       .hw_params      = snd_cx18_pcm_hw_params,
+       .hw_free        = snd_cx18_pcm_hw_free,
+       .prepare        = snd_cx18_pcm_prepare,
+       .trigger        = snd_cx18_pcm_trigger,
+       .pointer        = snd_cx18_pcm_pointer,
+       .page           = snd_pcm_get_vmalloc_page,
+};
+
+int snd_cx18_pcm_create(struct snd_cx18_card *cxsc)
+{
+       struct snd_pcm *sp;
+       struct snd_card *sc = cxsc->sc;
+       struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;
+       struct cx18 *cx = to_cx18(v4l2_dev);
+       int ret;
+
+       ret = snd_pcm_new(sc, "CX23418 PCM",
+                         0, /* PCM device 0, the only one for this card */
+                         0, /* 0 playback substreams */
+                         1, /* 1 capture substream */
+                         &sp);
+       if (ret) {
+               CX18_ALSA_ERR("%s: snd_cx18_pcm_create() failed with err %d\n",
+                             __func__, ret);
+               goto err_exit;
+       }
+
+       spin_lock_init(&cxsc->slock);
+
+       snd_pcm_set_ops(sp, SNDRV_PCM_STREAM_CAPTURE,
+                       &snd_cx18_pcm_capture_ops);
+       sp->info_flags = 0;
+       sp->private_data = cxsc;
+       strlcpy(sp->name, cx->card_name, sizeof(sp->name));
+
+       return 0;
+
+err_exit:
+       return ret;
+}
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.h b/drivers/media/video/cx18/cx18-alsa-pcm.h
new file mode 100644 (file)
index 0000000..325662c
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  ALSA PCM device for the
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *
+ *  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
+ */
+
+int __init snd_cx18_pcm_create(struct snd_cx18_card *cxsc);
+
+/* Used by cx18-mailbox to announce the PCM data to the module */
+void cx18_alsa_announce_pcm_data(struct snd_cx18_card *card, u8 *pcm_data,
+                                size_t num_bytes);
diff --git a/drivers/media/video/cx18/cx18-alsa.h b/drivers/media/video/cx18/cx18-alsa.h
new file mode 100644 (file)
index 0000000..88a1cde
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ *  ALSA interface to cx18 PCM capture streams
+ *
+ *  Copyright (C) 2009  Andy Walls <awalls@radix.net>
+ *
+ *  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
+ */
+
+struct snd_card;
+
+struct snd_cx18_card {
+       struct v4l2_device *v4l2_dev;
+       struct snd_card *sc;
+       unsigned int capture_transfer_done;
+       unsigned int hwptr_done_capture;
+       struct snd_pcm_substream *capture_pcm_substream;
+       spinlock_t slock;
+};
+
+extern int cx18_alsa_debug;
+
+/*
+ * File operations that manipulate the encoder or video or audio subdevices
+ * need to be serialized.  Use the same lock we use for v4l2 file ops.
+ */
+static inline void snd_cx18_lock(struct snd_cx18_card *cxsc)
+{
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+       mutex_lock(&cx->serialize_lock);
+}
+
+static inline void snd_cx18_unlock(struct snd_cx18_card *cxsc)
+{
+       struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
+       mutex_unlock(&cx->serialize_lock);
+}
+
+#define CX18_ALSA_DBGFLG_WARN  (1 << 0)
+#define CX18_ALSA_DBGFLG_WARN  (1 << 0)
+#define CX18_ALSA_DBGFLG_INFO  (1 << 1)
+
+#define CX18_ALSA_DEBUG(x, type, fmt, args...) \
+       do { \
+               if ((x) & cx18_alsa_debug) \
+                       printk(KERN_INFO "%s-alsa: " type ": " fmt, \
+                               v4l2_dev->name , ## args); \
+       } while (0)
+
+#define CX18_ALSA_DEBUG_WARN(fmt, args...) \
+       CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_WARN, "warning", fmt , ## args)
+
+#define CX18_ALSA_DEBUG_INFO(fmt, args...) \
+       CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_INFO, "info", fmt , ## args)
+
+#define CX18_ALSA_ERR(fmt, args...) \
+       printk(KERN_ERR "%s-alsa: " fmt, v4l2_dev->name , ## args)
+
+#define CX18_ALSA_WARN(fmt, args...) \
+       printk(KERN_WARNING "%s-alsa: " fmt, v4l2_dev->name , ## args)
+
+#define CX18_ALSA_INFO(fmt, args...) \
+       printk(KERN_INFO "%s-alsa: " fmt, v4l2_dev->name , ## args)
index f11e47a58286ae1b87901f60f6033d7e6a70878f..f808fb6fc1c12c1e4bc9cb320e881dfa66fba0c2 100644 (file)
@@ -393,7 +393,7 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = {
        .gpio_init.direction = 0x7,
        .gpio_audio_input = { .mask   = 0x7,
                              .tuner  = 0x6, .linein = 0x2, .radio  = 0x2 },
-       .xceive_pin = 15,
+       .xceive_pin = 1,
        .pci_list = cx18_pci_leadtek_pvr2100,
        .i2c = &cx18_i2c_std,
 };
index 7f65a47f12e1b51c6e28a7213b26c7305ce1907c..c95a86ba33b01b5201799ffb18e1f866c32bf28b 100644 (file)
    setting this to 1 you ensure that radio0 is now also radio1. */
 int cx18_first_minor;
 
+/* Callback for registering extensions */
+int (*cx18_ext_init)(struct cx18 *);
+EXPORT_SYMBOL(cx18_ext_init);
+
 /* add your revision and whatnot here */
 static struct pci_device_id cx18_pci_tbl[] __devinitdata = {
        {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418,
@@ -91,7 +95,7 @@ static int enc_pcm_bufsize = CX18_DEFAULT_ENC_PCM_BUFSIZE;
 
 static int enc_ts_bufs = -1;
 static int enc_mpg_bufs = -1;
-static int enc_idx_bufs = -1;
+static int enc_idx_bufs = CX18_MAX_FW_MDLS_PER_STREAM;
 static int enc_yuv_bufs = -1;
 static int enc_vbi_bufs = -1;
 static int enc_pcm_bufs = -1;
@@ -196,14 +200,17 @@ MODULE_PARM_DESC(enc_mpg_bufs,
                 "Number of encoder MPG buffers\n"
                 "\t\t\tDefault is computed from other enc_mpg_* parameters");
 MODULE_PARM_DESC(enc_idx_buffers,
-                "Encoder IDX buffer memory (MB). (enc_idx_bufs can override)\n"
-                "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_IDX_BUFFERS));
+                "(Deprecated) Encoder IDX buffer memory (MB)\n"
+                "\t\t\tIgnored, except 0 disables IDX buffer allocations\n"
+                "\t\t\tDefault: 1 [Enabled]");
 MODULE_PARM_DESC(enc_idx_bufsize,
                 "Size of an encoder IDX buffer (kB)\n"
-                "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_IDX_BUFSIZE));
+                "\t\t\tAllowed values are multiples of 1.5 kB rounded up\n"
+                "\t\t\t(multiples of size required for 64 index entries)\n"
+                "\t\t\tDefault: 2");
 MODULE_PARM_DESC(enc_idx_bufs,
                 "Number of encoder IDX buffers\n"
-                "\t\t\tDefault is computed from other enc_idx_* parameters");
+                "\t\t\tDefault: " __stringify(CX18_MAX_FW_MDLS_PER_STREAM));
 MODULE_PARM_DESC(enc_yuv_buffers,
                 "Encoder YUV buffer memory (MB). (enc_yuv_bufs can override)\n"
                 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFFERS));
@@ -231,7 +238,8 @@ MODULE_PARM_DESC(enc_pcm_bufs,
                 "Number of encoder PCM buffers\n"
                 "\t\t\tDefault is computed from other enc_pcm_* parameters");
 
-MODULE_PARM_DESC(cx18_first_minor, "Set device node number assigned to first card");
+MODULE_PARM_DESC(cx18_first_minor,
+                "Set device node number assigned to first card");
 
 MODULE_AUTHOR("Hans Verkuil");
 MODULE_DESCRIPTION("CX23418 driver");
@@ -240,6 +248,28 @@ MODULE_LICENSE("GPL");
 
 MODULE_VERSION(CX18_VERSION);
 
+#if defined(CONFIG_MODULES) && defined(MODULE)
+static void request_module_async(struct work_struct *work)
+{
+       struct cx18 *dev = container_of(work, struct cx18, request_module_wk);
+
+       /* Make sure cx18-alsa module is loaded */
+       request_module("cx18-alsa");
+
+       /* Initialize cx18-alsa for this instance of the cx18 device */
+       if (cx18_ext_init != NULL)
+               cx18_ext_init(dev);
+}
+
+static void request_modules(struct cx18 *dev)
+{
+       INIT_WORK(&dev->request_module_wk, request_module_async);
+       schedule_work(&dev->request_module_wk);
+}
+#else
+#define request_modules(dev)
+#endif /* CONFIG_MODULES */
+
 /* Generic utility functions */
 int cx18_msleep_timeout(unsigned int msecs, int intr)
 {
@@ -501,7 +531,12 @@ static void cx18_process_options(struct cx18 *cx)
                /*
                 * YUV is a special case where the stream_buf_size needs to be
                 * an integral multiple of 33.75 kB (storage for 32 screens
-                * lines to maintain alignment in case of lost buffers
+                * lines to maintain alignment in case of lost buffers).
+                *
+                * IDX is a special case where the stream_buf_size should be
+                * an integral multiple of 1.5 kB (storage for 64 index entries
+                * to maintain alignment in case of lost buffers).
+                *
                 */
                if (i == CX18_ENC_STREAM_TYPE_YUV) {
                        cx->stream_buf_size[i] *= 1024;
@@ -511,15 +546,24 @@ static void cx18_process_options(struct cx18 *cx)
                        if (cx->stream_buf_size[i] < CX18_UNIT_ENC_YUV_BUFSIZE)
                                cx->stream_buf_size[i] =
                                                CX18_UNIT_ENC_YUV_BUFSIZE;
+               } else if (i == CX18_ENC_STREAM_TYPE_IDX) {
+                       cx->stream_buf_size[i] *= 1024;
+                       cx->stream_buf_size[i] -=
+                          (cx->stream_buf_size[i] % CX18_UNIT_ENC_IDX_BUFSIZE);
+
+                       if (cx->stream_buf_size[i] < CX18_UNIT_ENC_IDX_BUFSIZE)
+                               cx->stream_buf_size[i] =
+                                               CX18_UNIT_ENC_IDX_BUFSIZE;
                }
                /*
-                * YUV is a special case where the stream_buf_size is
+                * YUV and IDX are special cases where the stream_buf_size is
                 * now in bytes.
                 * VBI is a special case where the stream_buf_size is fixed
                 * and already in bytes
                 */
                if (i == CX18_ENC_STREAM_TYPE_VBI ||
-                   i == CX18_ENC_STREAM_TYPE_YUV) {
+                   i == CX18_ENC_STREAM_TYPE_YUV ||
+                   i == CX18_ENC_STREAM_TYPE_IDX) {
                        if (cx->stream_buffers[i] < 0) {
                                cx->stream_buffers[i] =
                                        cx->options.megabytes[i] * 1024 * 1024
@@ -1032,6 +1076,10 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
        }
 
        CX18_INFO("Initialized card: %s\n", cx->card_name);
+
+       /* Load cx18 submodules (cx18-alsa) */
+       request_modules(cx);
+
        return 0;
 
 free_streams:
@@ -1220,6 +1268,7 @@ static void cx18_remove(struct pci_dev *pci_dev)
        kfree(cx);
 }
 
+
 /* define a pci_driver for card detection */
 static struct pci_driver cx18_pci_driver = {
       .name =     "cx18",
@@ -1230,7 +1279,8 @@ static struct pci_driver cx18_pci_driver = {
 
 static int __init module_start(void)
 {
-       printk(KERN_INFO "cx18:  Start initialization, version %s\n", CX18_VERSION);
+       printk(KERN_INFO "cx18:  Start initialization, version %s\n",
+              CX18_VERSION);
 
        /* Validate parameters */
        if (cx18_first_minor < 0 || cx18_first_minor >= CX18_MAX_CARDS) {
index e3f7911a7385bf1c72385b57c7a3fff008debdd5..23ad6d548dc52c51b45e6cd5ace9371e57f13c2d 100644 (file)
 #define CX18_625_LINE_ENC_YUV_BUFSIZE  (CX18_UNIT_ENC_YUV_BUFSIZE * 576/32)
 #define CX18_525_LINE_ENC_YUV_BUFSIZE  (CX18_UNIT_ENC_YUV_BUFSIZE * 480/32)
 
+/* IDX buffer size should be a multiple of the index entry size from the chip */
+struct cx18_enc_idx_entry {
+       __le32 length;
+       __le32 offset_low;
+       __le32 offset_high;
+       __le32 flags;
+       __le32 pts_low;
+       __le32 pts_high;
+} __attribute__ ((packed));
+#define CX18_UNIT_ENC_IDX_BUFSIZE \
+       (sizeof(struct cx18_enc_idx_entry) * V4L2_ENC_IDX_ENTRIES)
+
 /* DMA buffer, default size in kB allocated */
 #define CX18_DEFAULT_ENC_TS_BUFSIZE   32
 #define CX18_DEFAULT_ENC_MPG_BUFSIZE  32
-#define CX18_DEFAULT_ENC_IDX_BUFSIZE  32
+#define CX18_DEFAULT_ENC_IDX_BUFSIZE  (CX18_UNIT_ENC_IDX_BUFSIZE * 1 / 1024 + 1)
 #define CX18_DEFAULT_ENC_YUV_BUFSIZE  (CX18_UNIT_ENC_YUV_BUFSIZE * 3 / 1024 + 1)
 #define CX18_DEFAULT_ENC_PCM_BUFSIZE   4
 
 #define CX18_WARN_DEV(dev, fmt, args...)     v4l2_warn(dev, fmt , ## args)
 #define CX18_INFO_DEV(dev, fmt, args...)     v4l2_info(dev, fmt , ## args)
 
-/* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */
-#define MPEG_FRAME_TYPE_IFRAME 1
-#define MPEG_FRAME_TYPE_IFRAME_PFRAME 3
-#define MPEG_FRAME_TYPE_ALL 7
-
-#define CX18_MAX_PGM_INDEX (400)
-
 extern int cx18_debug;
 
-
 struct cx18_options {
        int megabytes[CX18_MAX_STREAMS]; /* Size in megabytes of each stream */
        int cardtype;           /* force card type on load */
@@ -276,6 +280,18 @@ struct cx18_options {
 #define CX18_SLICED_TYPE_WSS_625        (5)
 #define CX18_SLICED_TYPE_VPS            (7)
 
+/**
+ * list_entry_is_past_end - check if a previous loop cursor is off list end
+ * @pos:       the type * previously used as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Check if the entry's list_head is the head of the list, thus it's not a
+ * real entry but was the loop cursor that walked past the end
+ */
+#define list_entry_is_past_end(pos, head, member) \
+       (&pos->member == (head))
+
 struct cx18_buffer {
        struct list_head list;
        dma_addr_t dma_handle;
@@ -558,6 +574,10 @@ struct cx18 {
        int stream_buffers[CX18_MAX_STREAMS]; /* # of buffers for each stream */
        int stream_buf_size[CX18_MAX_STREAMS]; /* Stream buffer size */
        struct cx18_stream streams[CX18_MAX_STREAMS];   /* Stream data */
+       struct snd_cx18_card *alsa; /* ALSA interface for PCM capture stream */
+       void (*pcm_announce_callback)(struct snd_cx18_card *card, u8 *pcm_data,
+                                     size_t num_bytes);
+
        unsigned long i_flags;  /* global cx18 flags */
        atomic_t ana_capturing; /* count number of active analog capture streams */
        atomic_t tot_capturing; /* total count number of active capture streams */
@@ -575,12 +595,6 @@ struct cx18 {
 
        struct vbi_info vbi;
 
-       u32 pgm_info_offset;
-       u32 pgm_info_num;
-       u32 pgm_info_write_idx;
-       u32 pgm_info_read_idx;
-       struct v4l2_enc_idx_entry pgm_info[CX18_MAX_PGM_INDEX];
-
        u64 mpg_data_received;
        u64 vbi_data_inserted;
 
@@ -623,6 +637,9 @@ struct cx18 {
        u32 active_input;
        v4l2_std_id std;
        v4l2_std_id tuner_std;  /* The norm of the tuner (fixed) */
+
+       /* Used for cx18-alsa module loading */
+       struct work_struct request_module_wk;
 };
 
 static inline struct cx18 *to_cx18(struct v4l2_device *v4l2_dev)
@@ -630,6 +647,9 @@ static inline struct cx18 *to_cx18(struct v4l2_device *v4l2_dev)
        return container_of(v4l2_dev, struct cx18, v4l2_dev);
 }
 
+/* cx18 extensions to be loaded */
+extern int (*cx18_ext_init)(struct cx18 *);
+
 /* Globals */
 extern int cx18_first_minor;
 
index 71ad2d1b4c2c297159dc7bd2802f5d007084b15e..0ae2c2e1eab540127317b404979a30217e0cc483 100644 (file)
@@ -213,10 +213,14 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
 {
        struct dvb_demux *demux = feed->demux;
        struct cx18_stream *stream = (struct cx18_stream *) demux->priv;
-       struct cx18 *cx = stream->cx;
+       struct cx18 *cx;
        int ret;
        u32 v;
 
+       if (!stream)
+               return -EINVAL;
+
+       cx = stream->cx;
        CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n",
                        feed->pid, feed->index);
 
@@ -253,12 +257,10 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
        if (!demux->dmx.frontend)
                return -EINVAL;
 
-       if (!stream)
-               return -EINVAL;
-
        mutex_lock(&stream->dvb.feedlock);
        if (stream->dvb.feeding++ == 0) {
                CX18_DEBUG_INFO("Starting Transport DMA\n");
+               mutex_lock(&cx->serialize_lock);
                set_bit(CX18_F_S_STREAMING, &stream->s_flags);
                ret = cx18_start_v4l2_encode_stream(stream);
                if (ret < 0) {
@@ -267,6 +269,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
                        if (stream->dvb.feeding == 0)
                                clear_bit(CX18_F_S_STREAMING, &stream->s_flags);
                }
+               mutex_unlock(&cx->serialize_lock);
        } else
                ret = 0;
        mutex_unlock(&stream->dvb.feedlock);
@@ -279,17 +282,20 @@ static int cx18_dvb_stop_feed(struct dvb_demux_feed *feed)
 {
        struct dvb_demux *demux = feed->demux;
        struct cx18_stream *stream = (struct cx18_stream *)demux->priv;
-       struct cx18 *cx = stream->cx;
+       struct cx18 *cx;
        int ret = -EINVAL;
 
-       CX18_DEBUG_INFO("Stop feed: pid = 0x%x index = %d\n",
-                       feed->pid, feed->index);
-
        if (stream) {
+               cx = stream->cx;
+               CX18_DEBUG_INFO("Stop feed: pid = 0x%x index = %d\n",
+                               feed->pid, feed->index);
+
                mutex_lock(&stream->dvb.feedlock);
                if (--stream->dvb.feeding == 0) {
                        CX18_DEBUG_INFO("Stopping Transport DMA\n");
+                       mutex_lock(&cx->serialize_lock);
                        ret = cx18_stop_v4l2_encode_stream(stream, 0);
+                       mutex_unlock(&cx->serialize_lock);
                } else
                        ret = 0;
                mutex_unlock(&stream->dvb.feedlock);
index c0885c69fd89d12250c8dff19e8e3157114bc6b1..863ce77582391d953a0edde0375f344fdf07c8ab 100644 (file)
 
 /* This function tries to claim the stream for a specific file descriptor.
    If no one else is using this stream then the stream is claimed and
-   associated VBI streams are also automatically claimed.
+   associated VBI and IDX streams are also automatically claimed.
    Possible error returns: -EBUSY if someone else has claimed
    the stream or 0 on success. */
-static int cx18_claim_stream(struct cx18_open_id *id, int type)
+int cx18_claim_stream(struct cx18_open_id *id, int type)
 {
        struct cx18 *cx = id->cx;
        struct cx18_stream *s = &cx->streams[type];
-       struct cx18_stream *s_vbi;
-       int vbi_type;
+       struct cx18_stream *s_assoc;
+
+       /* Nothing should ever try to directly claim the IDX stream */
+       if (type == CX18_ENC_STREAM_TYPE_IDX) {
+               CX18_WARN("MPEG Index stream cannot be claimed "
+                         "directly, but something tried.\n");
+               return -EINVAL;
+       }
 
        if (test_and_set_bit(CX18_F_S_CLAIMED, &s->s_flags)) {
                /* someone already claimed this stream */
@@ -67,32 +73,47 @@ static int cx18_claim_stream(struct cx18_open_id *id, int type)
        }
        s->id = id->open_id;
 
-       /* CX18_ENC_STREAM_TYPE_MPG needs to claim CX18_ENC_STREAM_TYPE_VBI
-          (provided VBI insertion is on and sliced VBI is selected), for all
-          other streams we're done */
-       if (type == CX18_ENC_STREAM_TYPE_MPG &&
-           cx->vbi.insert_mpeg && !cx18_raw_vbi(cx)) {
-               vbi_type = CX18_ENC_STREAM_TYPE_VBI;
-       } else {
+       /*
+        * CX18_ENC_STREAM_TYPE_MPG needs to claim:
+        * CX18_ENC_STREAM_TYPE_VBI, if VBI insertion is on for sliced VBI, or
+        * CX18_ENC_STREAM_TYPE_IDX, if VBI insertion is off for sliced VBI
+        * (We don't yet fix up MPEG Index entries for our inserted packets).
+        *
+        * For all other streams we're done.
+        */
+       if (type != CX18_ENC_STREAM_TYPE_MPG)
                return 0;
-       }
-       s_vbi = &cx->streams[vbi_type];
 
-       set_bit(CX18_F_S_CLAIMED, &s_vbi->s_flags);
+       s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+       if (cx->vbi.insert_mpeg && !cx18_raw_vbi(cx))
+               s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
+       else if (!cx18_stream_enabled(s_assoc))
+               return 0;
+
+       set_bit(CX18_F_S_CLAIMED, &s_assoc->s_flags);
 
        /* mark that it is used internally */
-       set_bit(CX18_F_S_INTERNAL_USE, &s_vbi->s_flags);
+       set_bit(CX18_F_S_INTERNAL_USE, &s_assoc->s_flags);
        return 0;
 }
+EXPORT_SYMBOL(cx18_claim_stream);
 
 /* This function releases a previously claimed stream. It will take into
    account associated VBI streams. */
-static void cx18_release_stream(struct cx18_stream *s)
+void cx18_release_stream(struct cx18_stream *s)
 {
        struct cx18 *cx = s->cx;
-       struct cx18_stream *s_vbi;
+       struct cx18_stream *s_assoc;
 
        s->id = -1;
+       if (s->type == CX18_ENC_STREAM_TYPE_IDX) {
+               /*
+                * The IDX stream is only used internally, and can
+                * only be indirectly unclaimed by unclaiming the MPG stream.
+                */
+               return;
+       }
+
        if (s->type == CX18_ENC_STREAM_TYPE_VBI &&
                test_bit(CX18_F_S_INTERNAL_USE, &s->s_flags)) {
                /* this stream is still in use internally */
@@ -105,25 +126,36 @@ static void cx18_release_stream(struct cx18_stream *s)
 
        cx18_flush_queues(s);
 
-       /* CX18_ENC_STREAM_TYPE_MPG needs to release CX18_ENC_STREAM_TYPE_VBI,
-          for all other streams we're done */
-       if (s->type == CX18_ENC_STREAM_TYPE_MPG)
-               s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
-       else
+       /*
+        * CX18_ENC_STREAM_TYPE_MPG needs to release the
+        * CX18_ENC_STREAM_TYPE_VBI and/or CX18_ENC_STREAM_TYPE_IDX streams.
+        *
+        * For all other streams we're done.
+        */
+       if (s->type != CX18_ENC_STREAM_TYPE_MPG)
                return;
 
-       /* clear internal use flag */
-       if (!test_and_clear_bit(CX18_F_S_INTERNAL_USE, &s_vbi->s_flags)) {
-               /* was already cleared */
-               return;
+       /* Unclaim the associated MPEG Index stream */
+       s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+       if (test_and_clear_bit(CX18_F_S_INTERNAL_USE, &s_assoc->s_flags)) {
+               clear_bit(CX18_F_S_CLAIMED, &s_assoc->s_flags);
+               cx18_flush_queues(s_assoc);
        }
-       if (s_vbi->id != -1) {
-               /* VBI stream still claimed by a file descriptor */
-               return;
+
+       /* Unclaim the associated VBI stream */
+       s_assoc = &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
+       if (test_and_clear_bit(CX18_F_S_INTERNAL_USE, &s_assoc->s_flags)) {
+               if (s_assoc->id == -1) {
+                       /*
+                        * The VBI stream is not still claimed by a file
+                        * descriptor, so completely unclaim it.
+                        */
+                       clear_bit(CX18_F_S_CLAIMED, &s_assoc->s_flags);
+                       cx18_flush_queues(s_assoc);
+               }
        }
-       clear_bit(CX18_F_S_CLAIMED, &s_vbi->s_flags);
-       cx18_flush_queues(s_vbi);
 }
+EXPORT_SYMBOL(cx18_release_stream);
 
 static void cx18_dualwatch(struct cx18 *cx)
 {
@@ -177,9 +209,7 @@ static struct cx18_mdl *cx18_get_mdl(struct cx18_stream *s, int non_block,
        *err = 0;
        while (1) {
                if (s->type == CX18_ENC_STREAM_TYPE_MPG) {
-                       /* Process pending program info updates and pending
-                          VBI data */
-
+                       /* Process pending program updates and VBI data */
                        if (time_after(jiffies, cx->dualwatch_jiffies + msecs_to_jiffies(1000))) {
                                cx->dualwatch_jiffies = jiffies;
                                cx18_dualwatch(cx);
@@ -362,18 +392,6 @@ static size_t cx18_copy_buf_to_user(struct cx18_stream *s,
        return len;
 }
 
-/**
- * list_entry_is_past_end - check if a previous loop cursor is off list end
- * @pos:       the type * previously used as a loop cursor.
- * @head:      the head for your list.
- * @member:    the name of the list_struct within the struct.
- *
- * Check if the entry's list_head is the head of the list, thus it's not a
- * real entry but was the loop cursor that walked past the end
- */
-#define list_entry_is_past_end(pos, head, member) \
-       (&pos->member == (head))
-
 static size_t cx18_copy_mdl_to_user(struct cx18_stream *s,
                struct cx18_mdl *mdl, char __user *ubuf, size_t ucount)
 {
@@ -498,6 +516,7 @@ int cx18_start_capture(struct cx18_open_id *id)
        struct cx18 *cx = id->cx;
        struct cx18_stream *s = &cx->streams[id->type];
        struct cx18_stream *s_vbi;
+       struct cx18_stream *s_idx;
 
        if (s->type == CX18_ENC_STREAM_TYPE_RAD) {
                /* you cannot read from these stream types. */
@@ -516,25 +535,33 @@ int cx18_start_capture(struct cx18_open_id *id)
                return 0;
        }
 
-       /* Start VBI capture if required */
+       /* Start associated VBI or IDX stream capture if required */
        s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
-       if (s->type == CX18_ENC_STREAM_TYPE_MPG &&
-           test_bit(CX18_F_S_INTERNAL_USE, &s_vbi->s_flags) &&
-           !test_and_set_bit(CX18_F_S_STREAMING, &s_vbi->s_flags)) {
-               /* Note: the CX18_ENC_STREAM_TYPE_VBI is claimed
-                  automatically when the MPG stream is claimed.
-                  We only need to start the VBI capturing. */
-               if (cx18_start_v4l2_encode_stream(s_vbi)) {
-                       CX18_DEBUG_WARN("VBI capture start failed\n");
-
-                       /* Failure, clean up and return an error */
-                       clear_bit(CX18_F_S_STREAMING, &s_vbi->s_flags);
-                       clear_bit(CX18_F_S_STREAMING, &s->s_flags);
-                       /* also releases the associated VBI stream */
-                       cx18_release_stream(s);
-                       return -EIO;
+       s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+       if (s->type == CX18_ENC_STREAM_TYPE_MPG) {
+               /*
+                * The VBI and IDX streams should have been claimed
+                * automatically, if for internal use, when the MPG stream was
+                * claimed.  We only need to start these streams capturing.
+                */
+               if (test_bit(CX18_F_S_INTERNAL_USE, &s_idx->s_flags) &&
+                   !test_and_set_bit(CX18_F_S_STREAMING, &s_idx->s_flags)) {
+                       if (cx18_start_v4l2_encode_stream(s_idx)) {
+                               CX18_DEBUG_WARN("IDX capture start failed\n");
+                               clear_bit(CX18_F_S_STREAMING, &s_idx->s_flags);
+                               goto start_failed;
+                       }
+                       CX18_DEBUG_INFO("IDX capture started\n");
+               }
+               if (test_bit(CX18_F_S_INTERNAL_USE, &s_vbi->s_flags) &&
+                   !test_and_set_bit(CX18_F_S_STREAMING, &s_vbi->s_flags)) {
+                       if (cx18_start_v4l2_encode_stream(s_vbi)) {
+                               CX18_DEBUG_WARN("VBI capture start failed\n");
+                               clear_bit(CX18_F_S_STREAMING, &s_vbi->s_flags);
+                               goto start_failed;
+                       }
+                       CX18_DEBUG_INFO("VBI insertion started\n");
                }
-               CX18_DEBUG_INFO("VBI insertion started\n");
        }
 
        /* Tell the card to start capturing */
@@ -547,19 +574,29 @@ int cx18_start_capture(struct cx18_open_id *id)
                return 0;
        }
 
-       /* failure, clean up */
+start_failed:
        CX18_DEBUG_WARN("Failed to start capturing for stream %s\n", s->name);
 
-       /* Note: the CX18_ENC_STREAM_TYPE_VBI is released
-          automatically when the MPG stream is released.
-          We only need to stop the VBI capturing. */
-       if (s->type == CX18_ENC_STREAM_TYPE_MPG &&
-           test_bit(CX18_F_S_STREAMING, &s_vbi->s_flags)) {
-               cx18_stop_v4l2_encode_stream(s_vbi, 0);
-               clear_bit(CX18_F_S_STREAMING, &s_vbi->s_flags);
+       /*
+        * The associated VBI and IDX streams for internal use are released
+        * automatically when the MPG stream is released.  We only need to stop
+        * the associated stream.
+        */
+       if (s->type == CX18_ENC_STREAM_TYPE_MPG) {
+               /* Stop the IDX stream which is always for internal use */
+               if (test_bit(CX18_F_S_STREAMING, &s_idx->s_flags)) {
+                       cx18_stop_v4l2_encode_stream(s_idx, 0);
+                       clear_bit(CX18_F_S_STREAMING, &s_idx->s_flags);
+               }
+               /* Stop the VBI stream, if only running for internal use */
+               if (test_bit(CX18_F_S_STREAMING, &s_vbi->s_flags) &&
+                   !test_bit(CX18_F_S_APPL_IO, &s_vbi->s_flags)) {
+                       cx18_stop_v4l2_encode_stream(s_vbi, 0);
+                       clear_bit(CX18_F_S_STREAMING, &s_vbi->s_flags);
+               }
        }
        clear_bit(CX18_F_S_STREAMING, &s->s_flags);
-       cx18_release_stream(s);
+       cx18_release_stream(s); /* Also releases associated streams */
        return -EIO;
 }
 
@@ -618,6 +655,8 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end)
 {
        struct cx18 *cx = id->cx;
        struct cx18_stream *s = &cx->streams[id->type];
+       struct cx18_stream *s_vbi = &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
+       struct cx18_stream *s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
 
        CX18_DEBUG_IOCTL("close() of %s\n", s->name);
 
@@ -625,17 +664,19 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end)
 
        /* Stop capturing */
        if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) {
-               struct cx18_stream *s_vbi =
-                       &cx->streams[CX18_ENC_STREAM_TYPE_VBI];
-
                CX18_DEBUG_INFO("close stopping capture\n");
-               /* Special case: a running VBI capture for VBI insertion
-                  in the mpeg stream. Need to stop that too. */
-               if (id->type == CX18_ENC_STREAM_TYPE_MPG &&
-                   test_bit(CX18_F_S_STREAMING, &s_vbi->s_flags) &&
-                   !test_bit(CX18_F_S_APPL_IO, &s_vbi->s_flags)) {
-                       CX18_DEBUG_INFO("close stopping embedded VBI capture\n");
-                       cx18_stop_v4l2_encode_stream(s_vbi, 0);
+               if (id->type == CX18_ENC_STREAM_TYPE_MPG) {
+                       /* Stop internal use associated VBI and IDX streams */
+                       if (test_bit(CX18_F_S_STREAMING, &s_vbi->s_flags) &&
+                           !test_bit(CX18_F_S_APPL_IO, &s_vbi->s_flags)) {
+                               CX18_DEBUG_INFO("close stopping embedded VBI "
+                                               "capture\n");
+                               cx18_stop_v4l2_encode_stream(s_vbi, 0);
+                       }
+                       if (test_bit(CX18_F_S_STREAMING, &s_idx->s_flags)) {
+                               CX18_DEBUG_INFO("close stopping IDX capture\n");
+                               cx18_stop_v4l2_encode_stream(s_idx, 0);
+                       }
                }
                if (id->type == CX18_ENC_STREAM_TYPE_VBI &&
                    test_bit(CX18_F_S_INTERNAL_USE, &s->s_flags))
index 92e2d5dab936e15897b1652e1ab6737b368dd21d..5c8fcb884f0ad793b9da01c6016c556edc7662c6 100644 (file)
@@ -34,3 +34,6 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
 void cx18_mute(struct cx18 *cx);
 void cx18_unmute(struct cx18 *cx);
 
+/* Shared with cx18-alsa module */
+int cx18_claim_stream(struct cx18_open_id *id, int type);
+void cx18_release_stream(struct cx18_stream *s);
index 3e4fc192fdec42c5124c0ea7d81921d4597e4412..b81dd0ea8eb9f3299ff09e397c095a92da2525bc 100644 (file)
@@ -775,10 +775,143 @@ static int cx18_g_sliced_vbi_cap(struct file *file, void *fh,
        return 0;
 }
 
+static int _cx18_process_idx_data(struct cx18_buffer *buf,
+                                 struct v4l2_enc_idx *idx)
+{
+       int consumed, remaining;
+       struct v4l2_enc_idx_entry *e_idx;
+       struct cx18_enc_idx_entry *e_buf;
+
+       /* Frame type lookup: 1=I, 2=P, 4=B */
+       const int mapping[8] = {
+               -1, V4L2_ENC_IDX_FRAME_I, V4L2_ENC_IDX_FRAME_P,
+               -1, V4L2_ENC_IDX_FRAME_B, -1, -1, -1
+       };
+
+       /*
+        * Assumption here is that a buf holds an integral number of
+        * struct cx18_enc_idx_entry objects and is properly aligned.
+        * This is enforced by the module options on IDX buffer sizes.
+        */
+       remaining = buf->bytesused - buf->readpos;
+       consumed = 0;
+       e_idx = &idx->entry[idx->entries];
+       e_buf = (struct cx18_enc_idx_entry *) &buf->buf[buf->readpos];
+
+       while (remaining >= sizeof(struct cx18_enc_idx_entry) &&
+              idx->entries < V4L2_ENC_IDX_ENTRIES) {
+
+               e_idx->offset = (((u64) le32_to_cpu(e_buf->offset_high)) << 32)
+                               | le32_to_cpu(e_buf->offset_low);
+
+               e_idx->pts = (((u64) (le32_to_cpu(e_buf->pts_high) & 1)) << 32)
+                            | le32_to_cpu(e_buf->pts_low);
+
+               e_idx->length = le32_to_cpu(e_buf->length);
+
+               e_idx->flags = mapping[le32_to_cpu(e_buf->flags) & 0x7];
+
+               e_idx->reserved[0] = 0;
+               e_idx->reserved[1] = 0;
+
+               idx->entries++;
+               e_idx = &idx->entry[idx->entries];
+               e_buf++;
+
+               remaining -= sizeof(struct cx18_enc_idx_entry);
+               consumed += sizeof(struct cx18_enc_idx_entry);
+       }
+
+       /* Swallow any partial entries at the end, if there are any */
+       if (remaining > 0 && remaining < sizeof(struct cx18_enc_idx_entry))
+               consumed += remaining;
+
+       buf->readpos += consumed;
+       return consumed;
+}
+
+static int cx18_process_idx_data(struct cx18_stream *s, struct cx18_mdl *mdl,
+                                struct v4l2_enc_idx *idx)
+{
+       if (s->type != CX18_ENC_STREAM_TYPE_IDX)
+               return -EINVAL;
+
+       if (mdl->curr_buf == NULL)
+               mdl->curr_buf = list_first_entry(&mdl->buf_list,
+                                                struct cx18_buffer, list);
+
+       if (list_entry_is_past_end(mdl->curr_buf, &mdl->buf_list, list)) {
+               /*
+                * For some reason we've exhausted the buffers, but the MDL
+                * object still said some data was unread.
+                * Fix that and bail out.
+                */
+               mdl->readpos = mdl->bytesused;
+               return 0;
+       }
+
+       list_for_each_entry_from(mdl->curr_buf, &mdl->buf_list, list) {
+
+               /* Skip any empty buffers in the MDL */
+               if (mdl->curr_buf->readpos >= mdl->curr_buf->bytesused)
+                       continue;
+
+               mdl->readpos += _cx18_process_idx_data(mdl->curr_buf, idx);
+
+               /* exit when MDL drained or request satisfied */
+               if (idx->entries >= V4L2_ENC_IDX_ENTRIES ||
+                   mdl->curr_buf->readpos < mdl->curr_buf->bytesused ||
+                   mdl->readpos >= mdl->bytesused)
+                       break;
+       }
+       return 0;
+}
+
 static int cx18_g_enc_index(struct file *file, void *fh,
                                struct v4l2_enc_idx *idx)
 {
-       return -EINVAL;
+       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+       s32 tmp;
+       struct cx18_mdl *mdl;
+
+       if (!cx18_stream_enabled(s)) /* Module options inhibited IDX stream */
+               return -EINVAL;
+
+       /* Compute the best case number of entries we can buffer */
+       tmp = s->buffers -
+                         s->bufs_per_mdl * CX18_ENC_STREAM_TYPE_IDX_FW_MDL_MIN;
+       if (tmp <= 0)
+               tmp = 1;
+       tmp = tmp * s->buf_size / sizeof(struct cx18_enc_idx_entry);
+
+       /* Fill out the header of the return structure */
+       idx->entries = 0;
+       idx->entries_cap = tmp;
+       memset(idx->reserved, 0, sizeof(idx->reserved));
+
+       /* Pull IDX MDLs and buffers from q_full and populate the entries */
+       do {
+               mdl = cx18_dequeue(s, &s->q_full);
+               if (mdl == NULL) /* No more IDX data right now */
+                       break;
+
+               /* Extract the Index entry data from the MDL and buffers */
+               cx18_process_idx_data(s, mdl, idx);
+               if (mdl->readpos < mdl->bytesused) {
+                       /* We finished with data remaining, push the MDL back */
+                       cx18_push(s, mdl, &s->q_full);
+                       break;
+               }
+
+               /* We drained this MDL, schedule it to go to the firmware */
+               cx18_enqueue(s, mdl, &s->q_free);
+
+       } while (idx->entries < V4L2_ENC_IDX_ENTRIES);
+
+       /* Tell the work handler to send free IDX MDLs to the firmware */
+       cx18_stream_load_fw_queue(s);
+       return 0;
 }
 
 static int cx18_encoder_cmd(struct file *file, void *fh,
index f231dd09c720aa52f46458bc3913e62ea23ad016..6dcce297752f57f0f1aae616ee5fb7c1debc4da4 100644 (file)
@@ -29,6 +29,7 @@
 #include "cx18-mailbox.h"
 #include "cx18-queue.h"
 #include "cx18-streams.h"
+#include "cx18-alsa-pcm.h" /* FIXME make configurable */
 
 static const char *rpu_str[] = { "APU", "CPU", "EPU", "HPU" };
 
@@ -157,6 +158,34 @@ static void cx18_mdl_send_to_dvb(struct cx18_stream *s, struct cx18_mdl *mdl)
        }
 }
 
+
+static void cx18_mdl_send_to_alsa(struct cx18 *cx, struct cx18_stream *s,
+                                 struct cx18_mdl *mdl)
+{
+       struct cx18_buffer *buf;
+
+       if (mdl->bytesused == 0)
+               return;
+
+       /* We ignore mdl and buf readpos accounting here - it doesn't matter */
+
+       /* The likely case */
+       if (list_is_singular(&mdl->buf_list)) {
+               buf = list_first_entry(&mdl->buf_list, struct cx18_buffer,
+                                      list);
+               if (buf->bytesused)
+                       cx->pcm_announce_callback(cx->alsa, buf->buf,
+                                                 buf->bytesused);
+               return;
+       }
+
+       list_for_each_entry(buf, &mdl->buf_list, list) {
+               if (buf->bytesused == 0)
+                       break;
+               cx->pcm_announce_callback(cx->alsa, buf->buf, buf->bytesused);
+       }
+}
+
 static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order)
 {
        u32 handle, mdl_ack_count, id;
@@ -223,11 +252,21 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order)
                CX18_DEBUG_HI_DMA("%s recv bytesused = %d\n",
                                  s->name, mdl->bytesused);
 
-               if (s->type != CX18_ENC_STREAM_TYPE_TS)
-                       cx18_enqueue(s, mdl, &s->q_full);
-               else {
+               if (s->type == CX18_ENC_STREAM_TYPE_TS) {
                        cx18_mdl_send_to_dvb(s, mdl);
                        cx18_enqueue(s, mdl, &s->q_free);
+               } else if (s->type == CX18_ENC_STREAM_TYPE_PCM) {
+                       /* Pass the data to cx18-alsa */
+                       if (cx->pcm_announce_callback != NULL) {
+                               cx18_mdl_send_to_alsa(cx, s, mdl);
+                               cx18_enqueue(s, mdl, &s->q_free);
+                       } else {
+                               cx18_enqueue(s, mdl, &s->q_full);
+                       }
+               } else {
+                       cx18_enqueue(s, mdl, &s->q_full);
+                       if (s->type == CX18_ENC_STREAM_TYPE_IDX)
+                               cx18_stream_rotate_idx_mdls(cx);
                }
        }
        /* Put as many MDLs as possible back into fw use */
index 63304823cef528e6752be09571a2624395d6cc48..aefc8c8cf3c16f513a897faacf6e4022e1c40ff5 100644 (file)
@@ -419,6 +419,9 @@ void cx18_stream_free(struct cx18_stream *s)
 {
        struct cx18_mdl *mdl;
        struct cx18_buffer *buf;
+       struct cx18 *cx = s->cx;
+
+       CX18_DEBUG_INFO("Deallocating buffers for %s stream\n", s->name);
 
        /* move all buffers to buf_pool and all MDLs to q_idle */
        cx18_unload_queues(s);
index 987a9308d938523dab6914ddc647bd3ee4364b3b..054450f65a6086a9bab6da825d72ab2329f7a6f5 100644 (file)
@@ -319,11 +319,27 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
 
        /* Teardown all streams */
        for (type = 0; type < CX18_MAX_STREAMS; type++) {
-               if (cx->streams[type].dvb.enabled) {
-                       cx18_dvb_unregister(&cx->streams[type]);
-                       cx->streams[type].dvb.enabled = false;
+
+               /* No struct video_device, but can have buffers allocated */
+               if (type == CX18_ENC_STREAM_TYPE_TS) {
+                       if (cx->streams[type].dvb.enabled) {
+                               cx18_dvb_unregister(&cx->streams[type]);
+                               cx->streams[type].dvb.enabled = false;
+                               cx18_stream_free(&cx->streams[type]);
+                       }
+                       continue;
+               }
+
+               /* No struct video_device, but can have buffers allocated */
+               if (type == CX18_ENC_STREAM_TYPE_IDX) {
+                       if (cx->stream_buffers[type] != 0) {
+                               cx->stream_buffers[type] = 0;
+                               cx18_stream_free(&cx->streams[type]);
+                       }
+                       continue;
                }
 
+               /* If struct video_device exists, can have buffers allocated */
                vdev = cx->streams[type].video_dev;
 
                cx->streams[type].video_dev = NULL;
@@ -447,6 +463,32 @@ static void cx18_vbi_setup(struct cx18_stream *s)
        cx18_api(cx, CX18_CPU_SET_RAW_VBI_PARAM, 6, data);
 }
 
+void cx18_stream_rotate_idx_mdls(struct cx18 *cx)
+{
+       struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+       struct cx18_mdl *mdl;
+
+       if (!cx18_stream_enabled(s))
+               return;
+
+       /* Return if the firmware is not running low on MDLs */
+       if ((atomic_read(&s->q_free.depth) + atomic_read(&s->q_busy.depth)) >=
+                                           CX18_ENC_STREAM_TYPE_IDX_FW_MDL_MIN)
+               return;
+
+       /* Return if there are no MDLs to rotate back to the firmware */
+       if (atomic_read(&s->q_full.depth) < 2)
+               return;
+
+       /*
+        * Take the oldest IDX MDL still holding data, and discard its index
+        * entries by scheduling the MDL to go back to the firmware
+        */
+       mdl = cx18_dequeue(s, &s->q_full);
+       if (mdl != NULL)
+               cx18_enqueue(s, mdl, &s->q_free);
+}
+
 static
 struct cx18_queue *_cx18_stream_put_mdl_fw(struct cx18_stream *s,
                                           struct cx18_mdl *mdl)
@@ -546,8 +588,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
        struct cx18 *cx = s->cx;
        int captype = 0;
        struct cx18_api_func_private priv;
+       struct cx18_stream *s_idx;
 
-       if (s->video_dev == NULL && s->dvb.enabled == 0)
+       if (!cx18_stream_enabled(s))
                return -EINVAL;
 
        CX18_DEBUG_INFO("Start encoder stream %s\n", s->name);
@@ -561,6 +604,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
                cx->search_pack_header = 0;
                break;
 
+       case CX18_ENC_STREAM_TYPE_IDX:
+               captype = CAPTURE_CHANNEL_TYPE_INDEX;
+               break;
        case CX18_ENC_STREAM_TYPE_TS:
                captype = CAPTURE_CHANNEL_TYPE_TS;
                break;
@@ -635,11 +681,13 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
                        cx18_vbi_setup(s);
 
                /*
-                * assign program index info.
-                * Mask 7: select I/P/B, Num_req: 400 max
-                * FIXME - currently we have this hardcoded as disabled
+                * Select to receive I, P, and B frame index entries, if the
+                * index stream is enabled.  Otherwise disable index entry
+                * generation.
                 */
-               cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 1, 0);
+               s_idx = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
+               cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 2,
+                                s->handle, cx18_stream_enabled(s_idx) ? 7 : 0);
 
                /* Call out to the common CX2341x API setup for user controls */
                priv.cx = cx;
@@ -697,6 +745,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
        atomic_inc(&cx->tot_capturing);
        return 0;
 }
+EXPORT_SYMBOL(cx18_start_v4l2_encode_stream);
 
 void cx18_stop_all_captures(struct cx18 *cx)
 {
@@ -705,7 +754,7 @@ void cx18_stop_all_captures(struct cx18 *cx)
        for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) {
                struct cx18_stream *s = &cx->streams[i];
 
-               if (s->video_dev == NULL && s->dvb.enabled == 0)
+               if (!cx18_stream_enabled(s))
                        continue;
                if (test_bit(CX18_F_S_STREAMING, &s->s_flags))
                        cx18_stop_v4l2_encode_stream(s, 0);
@@ -717,7 +766,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
        struct cx18 *cx = s->cx;
        unsigned long then;
 
-       if (s->video_dev == NULL && s->dvb.enabled == 0)
+       if (!cx18_stream_enabled(s))
                return -EINVAL;
 
        /* This function assumes that you are allowed to stop the capture
@@ -762,6 +811,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
 
        return 0;
 }
+EXPORT_SYMBOL(cx18_stop_v4l2_encode_stream);
 
 u32 cx18_find_handle(struct cx18 *cx)
 {
@@ -789,7 +839,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
                s = &cx->streams[i];
                if (s->handle != handle)
                        continue;
-               if (s->video_dev || s->dvb.enabled)
+               if (cx18_stream_enabled(s))
                        return s;
        }
        return NULL;
index 4a01db5e5a352ca582f7243c3fce9723b7da448b..0bff0fa2976370f77dc677673bb93529bcbba647 100644 (file)
@@ -28,6 +28,16 @@ int cx18_streams_setup(struct cx18 *cx);
 int cx18_streams_register(struct cx18 *cx);
 void cx18_streams_cleanup(struct cx18 *cx, int unregister);
 
+#define CX18_ENC_STREAM_TYPE_IDX_FW_MDL_MIN (3)
+void cx18_stream_rotate_idx_mdls(struct cx18 *cx);
+
+static inline bool cx18_stream_enabled(struct cx18_stream *s)
+{
+       return s->video_dev || s->dvb.enabled ||
+              (s->type == CX18_ENC_STREAM_TYPE_IDX &&
+               s->cx->stream_buffers[CX18_ENC_STREAM_TYPE_IDX] != 0);
+}
+
 /* Related to submission of mdls to firmware */
 static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
 {
index 9c0b5bb1b019dbd621140d6817a777185d5cfef7..3e1aec4bcfde13f12c35182ec7d454137fa142b4 100644 (file)
@@ -24,7 +24,7 @@
 
 #define CX18_DRIVER_NAME "cx18"
 #define CX18_DRIVER_VERSION_MAJOR 1
-#define CX18_DRIVER_VERSION_MINOR 3
+#define CX18_DRIVER_VERSION_MINOR 4
 #define CX18_DRIVER_VERSION_PATCHLEVEL 0
 
 #define CX18_VERSION __stringify(CX18_DRIVER_VERSION_MAJOR) "." __stringify(CX18_DRIVER_VERSION_MINOR) "." __stringify(CX18_DRIVER_VERSION_PATCHLEVEL)
index 868806effdcf2517a8c3a1a3dd49d224758a3c98..2c00980acfcbc89dba5f709c94b7e6253c98d2c4 100644 (file)
 #define CX18_CPU_SET_MEDIAN_CORING             (CPU_CMD_MASK_CAPTURE | 0x000E)
 
 /* Description: This command set the picture type mask for index file
-   IN[0] -     0 = disable index file output
+   IN[0] - Task handle (ignored by firmware)
+   IN[1] -     0 = disable index file output
                        1 = output I picture
                        2 = P picture
                        4 = B picture
index c5082a4e8ced122339d8003eb236b45598f4a32b..64e025e2bdf1a477b255bd2a0cfcda719568e5da 100644 (file)
@@ -464,9 +464,9 @@ static int dvb_init(struct cx231xx *dev)
                /* define general-purpose callback pointer */
                dvb->frontend->callback = cx231xx_tuner_callback;
 
-               if (dvb_attach(xc5000_attach, dev->dvb->frontend,
+               if (!dvb_attach(xc5000_attach, dev->dvb->frontend,
                               &dev->i2c_bus[1].i2c_adap,
-                              &cnxt_rde250_tunerconfig) < 0) {
+                              &cnxt_rde250_tunerconfig)) {
                        result = -EINVAL;
                        goto out_free;
                }
@@ -486,9 +486,9 @@ static int dvb_init(struct cx231xx *dev)
                /* define general-purpose callback pointer */
                dvb->frontend->callback = cx231xx_tuner_callback;
 
-               if (dvb_attach(xc5000_attach, dev->dvb->frontend,
+               if (!dvb_attach(xc5000_attach, dev->dvb->frontend,
                               &dev->i2c_bus[1].i2c_adap,
-                              &cnxt_rde250_tunerconfig) < 0) {
+                              &cnxt_rde250_tunerconfig)) {
                        result = -EINVAL;
                        goto out_free;
                }
index 15826f98b68826818ff401921853dad33356c6a8..c5771db3bfce8d6269113f3c1eb5f4cab2e1ffc6 100644 (file)
@@ -216,7 +216,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
        cx231xx_ir_start(ir);
 
        /* all done */
-       err = ir_input_register(ir->input, dev->board.ir_codes);
+       err = ir_input_register(ir->input, dev->board.ir_codes, NULL);
        if (err)
                goto err_out_stop;
 
index 88c0d2481118f4364ee575cc7d57b1bf577b76e9..2ab97ad7b6fb6d26f32fef3dcf3b614666a2a291 100644 (file)
@@ -681,7 +681,7 @@ static char *cmd_to_str(int cmd)
        case CX2341X_ENC_SET_VIDEO_ID:
                return  "SET_VIDEO_ID";
        case CX2341X_ENC_SET_PCR_ID:
-               return  "SET_PCR_PID";
+               return  "SET_PCR_ID";
        case CX2341X_ENC_SET_FRAME_RATE:
                return  "SET_FRAME_RATE";
        case CX2341X_ENC_SET_FRAME_SIZE:
@@ -693,7 +693,7 @@ static char *cmd_to_str(int cmd)
        case CX2341X_ENC_SET_ASPECT_RATIO:
                return  "SET_ASPECT_RATIO";
        case CX2341X_ENC_SET_DNR_FILTER_MODE:
-               return  "SET_DNR_FILTER_PROPS";
+               return  "SET_DNR_FILTER_MODE";
        case CX2341X_ENC_SET_DNR_FILTER_PROPS:
                return  "SET_DNR_FILTER_PROPS";
        case CX2341X_ENC_SET_CORING_LEVELS:
index 1ec48169277d95e4097697af89a82bda6a099ba1..d639186f645d66bdd3434a6da4bce2cd41be8288 100644 (file)
@@ -274,6 +274,31 @@ struct cx23885_board cx23885_boards[] = {
                .portb          = CX23885_MPEG_DVB,
                .portc          = CX23885_MPEG_DVB,
        },
+       [CX23885_BOARD_LEADTEK_WINFAST_PXTV1200] = {
+               .name           = "LEADTEK WinFast PxTV1200",
+               .porta          = CX23885_ANALOG_VIDEO,
+               .tuner_type     = TUNER_XC2028,
+               .tuner_addr     = 0x61,
+               .input          = {{
+                       .type   = CX23885_VMUX_TELEVISION,
+                       .vmux   = CX25840_VIN2_CH1 |
+                                 CX25840_VIN5_CH2 |
+                                 CX25840_NONE0_CH3,
+               }, {
+                       .type   = CX23885_VMUX_COMPOSITE1,
+                       .vmux   = CX25840_COMPOSITE1,
+               }, {
+                       .type   = CX23885_VMUX_SVIDEO,
+                       .vmux   = CX25840_SVIDEO_LUMA3 |
+                                 CX25840_SVIDEO_CHROMA4,
+               }, {
+                       .type   = CX23885_VMUX_COMPONENT,
+                       .vmux   = CX25840_VIN7_CH1 |
+                                 CX25840_VIN6_CH2 |
+                                 CX25840_VIN8_CH3 |
+                                 CX25840_COMPONENT_ON,
+               } },
+       },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -417,6 +442,10 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x14f1,
                .subdevice = 0x8578,
                .card      = CX23885_BOARD_MYGICA_X8558PRO,
+       }, {
+               .subvendor = 0x107d,
+               .subdevice = 0x6f22,
+               .card      = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
        },
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -617,6 +646,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
        case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
        case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
        case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
+       case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
                /* Tuner Reset Command */
                bitmask = 0x04;
                break;
@@ -769,6 +799,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
        case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
        case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
+       case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
                /* GPIO-2  xc3028 tuner reset */
 
                /* The following GPIO's are on the internal AVCore (cx25840) */
@@ -1076,6 +1107,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_MYGICA_X8506:
        case CX23885_BOARD_MAGICPRO_PROHDTVE2:
        case CX23885_BOARD_HAUPPAUGE_HVR1290:
+       case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
                dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
                                &dev->i2c_bus[2].i2c_adap,
                                "cx25840", "cx25840", 0x88 >> 1, NULL);
index e45d2df0813809cd64a96aedc692cf13ea116952..939079d7bbb9c1dc91819c4fe9dbffd2efb5b8e4 100644 (file)
@@ -542,6 +542,9 @@ static struct atbm8830_config mygica_x8558pro_atbm8830_cfg1 = {
        .osc_clk_freq = 30400, /* in kHz */
        .if_freq = 0, /* zero IF */
        .zif_swap_iq = 1,
+       .agc_min = 0x2E,
+       .agc_max = 0xFF,
+       .agc_hold_loop = 0,
 };
 
 static struct max2165_config mygic_x8558pro_max2165_cfg1 = {
@@ -558,6 +561,9 @@ static struct atbm8830_config mygica_x8558pro_atbm8830_cfg2 = {
        .osc_clk_freq = 30400, /* in kHz */
        .if_freq = 0, /* zero IF */
        .zif_swap_iq = 1,
+       .agc_min = 0x2E,
+       .agc_max = 0xFF,
+       .agc_hold_loop = 0,
 };
 
 static struct max2165_config mygic_x8558pro_max2165_cfg2 = {
@@ -994,15 +1000,8 @@ static int dvb_register(struct cx23885_tsport *port)
                netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo);
                memcpy(port->frontends.adapter.proposed_mac,
                                cinfo.port[port->nr - 1].mac, 6);
-               printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC="
-                       "%02X:%02X:%02X:%02X:%02X:%02X\n",
-                       port->nr,
-                       port->frontends.adapter.proposed_mac[0],
-                       port->frontends.adapter.proposed_mac[1],
-                       port->frontends.adapter.proposed_mac[2],
-                       port->frontends.adapter.proposed_mac[3],
-                       port->frontends.adapter.proposed_mac[4],
-                       port->frontends.adapter.proposed_mac[5]);
+               printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC=%pM\n",
+                       port->nr, port->frontends.adapter.proposed_mac);
 
                netup_ci_init(port);
                break;
index 768eec92ccf9685fc9e1e835819348bde61cabe0..9c6620f86dcae8531649001b731718d3a19ecf50 100644 (file)
@@ -397,7 +397,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
        dev->ir_input = ir;
        cx23885_input_ir_start(dev);
 
-       ret = ir_input_register(ir->dev, ir_codes);
+       ret = ir_input_register(ir->dev, ir_codes, NULL);
        if (ret)
                goto err_out_stop;
 
index 8934d61cf66038f2deb8e4d3022f2dfe313c9268..2d3ac8b83dc31aa34f19009d5345090361a066d7 100644 (file)
@@ -36,6 +36,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include "cx23885-ioctl.h"
+#include "tuner-xc2028.h"
 
 MODULE_DESCRIPTION("v4l2 driver module for cx23885 based TV cards");
 MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>");
@@ -1505,6 +1506,18 @@ int cx23885_video_register(struct cx23885_dev *dev)
                        tun_setup.tuner_callback = cx23885_tuner_callback;
 
                        v4l2_subdev_call(sd, tuner, s_type_addr, &tun_setup);
+
+                       if (dev->board == CX23885_BOARD_LEADTEK_WINFAST_PXTV1200) {
+                               struct xc2028_ctrl ctrl = {
+                                       .fname = XC2028_DEFAULT_FIRMWARE,
+                                       .max_len = 64
+                               };
+                               struct v4l2_priv_tun_config cfg = {
+                                       .tuner = dev->tuner_type,
+                                       .priv = &ctrl
+                               };
+                               v4l2_subdev_call(sd, tuner, s_config, &cfg);
+                       }
                }
        }
 
index 08b3f6b136a08c70a593f710fdef53374beecd74..0e3a98d243c5529179dd78dbbb543160def4fec4 100644 (file)
@@ -81,6 +81,7 @@
 #define CX23885_BOARD_COMPRO_VIDEOMATE_E800    25
 #define CX23885_BOARD_HAUPPAUGE_HVR1290        26
 #define CX23885_BOARD_MYGICA_X8558PRO          27
+#define CX23885_BOARD_LEADTEK_WINFAST_PXTV1200 28
 
 #define GPIO_0 0x00000001
 #define GPIO_1 0x00000002
index 385ecd58f1c06a70820fe35df0c5ed92d31f9caf..f2461cd3de5ada3cb212c0f5b1d2ed9b36361b31 100644 (file)
@@ -734,10 +734,8 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
                v4l_dbg(1, cx25840_debug, client, "vid_input 0x%x\n",
                        vid_input);
                reg = vid_input & 0xff;
-               if ((vid_input & CX25840_SVIDEO_ON) == CX25840_SVIDEO_ON)
-                       is_composite = 0;
-               else if ((vid_input & CX25840_COMPONENT_ON) == 0)
-                       is_composite = 1;
+               is_composite = !is_component &&
+                       ((vid_input & CX25840_SVIDEO_ON) != CX25840_SVIDEO_ON);
 
                v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n",
                        reg, is_composite);
@@ -1347,30 +1345,59 @@ static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 }
 #endif
 
+static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct cx25840_state *state = to_state(sd);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 v;
+
+       if (is_cx2583x(state) || is_cx2388x(state) || is_cx231xx(state))
+               return 0;
+
+       v4l_dbg(1, cx25840_debug, client, "%s audio output\n",
+                       enable ? "enable" : "disable");
+
+       if (enable) {
+               v = cx25840_read(client, 0x115) | 0x80;
+               cx25840_write(client, 0x115, v);
+               v = cx25840_read(client, 0x116) | 0x03;
+               cx25840_write(client, 0x116, v);
+       } else {
+               v = cx25840_read(client, 0x115) & ~(0x80);
+               cx25840_write(client, 0x115, v);
+               v = cx25840_read(client, 0x116) & ~(0x03);
+               cx25840_write(client, 0x116, v);
+       }
+       return 0;
+}
+
 static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
 {
        struct cx25840_state *state = to_state(sd);
        struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 v;
 
-       v4l_dbg(1, cx25840_debug, client, "%s output\n",
+       v4l_dbg(1, cx25840_debug, client, "%s video output\n",
                        enable ? "enable" : "disable");
        if (enable) {
                if (is_cx2388x(state) || is_cx231xx(state)) {
-                       u8 v = (cx25840_read(client, 0x421) | 0x0b);
+                       v = cx25840_read(client, 0x421) | 0x0b;
                        cx25840_write(client, 0x421, v);
                } else {
-                       cx25840_write(client, 0x115,
-                                       is_cx2583x(state) ? 0x0c : 0x8c);
-                       cx25840_write(client, 0x116,
-                                       is_cx2583x(state) ? 0x04 : 0x07);
+                       v = cx25840_read(client, 0x115) | 0x0c;
+                       cx25840_write(client, 0x115, v);
+                       v = cx25840_read(client, 0x116) | 0x04;
+                       cx25840_write(client, 0x116, v);
                }
        } else {
                if (is_cx2388x(state) || is_cx231xx(state)) {
-                       u8 v = cx25840_read(client, 0x421) & ~(0x0b);
+                       v = cx25840_read(client, 0x421) & ~(0x0b);
                        cx25840_write(client, 0x421, v);
                } else {
-                       cx25840_write(client, 0x115, 0x00);
-                       cx25840_write(client, 0x116, 0x00);
+                       v = cx25840_read(client, 0x115) & ~(0x0c);
+                       cx25840_write(client, 0x115, v);
+                       v = cx25840_read(client, 0x116) & ~(0x04);
+                       cx25840_write(client, 0x116, v);
                }
        }
        return 0;
@@ -1601,6 +1628,7 @@ static const struct v4l2_subdev_tuner_ops cx25840_tuner_ops = {
 static const struct v4l2_subdev_audio_ops cx25840_audio_ops = {
        .s_clock_freq = cx25840_s_clock_freq,
        .s_routing = cx25840_s_audio_routing,
+       .s_stream = cx25840_s_audio_stream,
 };
 
 static const struct v4l2_subdev_video_ops cx25840_video_ops = {
index 5a67445dd6ed900f465f3fb2334a2c5346e5f419..64b350df78e3ab2c1efc7ead7bbe08c6b3183d49 100644 (file)
@@ -583,16 +583,18 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
 {
        snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
        struct cx88_core *core=chip->core;
-       int v, b;
+       int left, right, v, b;
        int changed = 0;
        u32 old;
 
-       b = value->value.integer.value[1] - value->value.integer.value[0];
+       left = value->value.integer.value[0] & 0x3f;
+       right = value->value.integer.value[1] & 0x3f;
+       b = right - left;
        if (b < 0) {
-           v = 0x3f - value->value.integer.value[0];
+           v = 0x3f - left;
            b = (-b) | 0x40;
        } else {
-           v = 0x3f - value->value.integer.value[1];
+           v = 0x3f - right;
        }
        /* Do we really know this will always be called with IRQs on? */
        spin_lock_irq(&chip->reg_lock);
index d844f2aaa01d1597c34da2fa17d8251177420796..eaf0ee7de832ecb599e4c95ff31955a15b6fadc6 100644 (file)
@@ -1466,6 +1466,18 @@ static const struct cx88_board cx88_boards[] = {
                        .audioroute = 8,
                },
        },
+       [CX88_BOARD_SAMSUNG_SMT_7020] = {
+               .name           = "Samsung SMT 7020 DVB-S",
+               .tuner_type     = TUNER_ABSENT,
+               .radio_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .input          = { {
+                       .type   = CX88_VMUX_DVB,
+                       .vmux   = 0,
+               } },
+               .mpeg           = CX88_MPEG_DVB,
+       },
        [CX88_BOARD_ADSTECH_PTV_390] = {
                .name           = "ADS Tech Instant Video PCI",
                .tuner_type     = TUNER_ABSENT,
@@ -2355,6 +2367,14 @@ static const struct cx88_subid cx88_subids[] = {
                .subvendor = 0x0070,
                .subdevice = 0x1404,
                .card      = CX88_BOARD_HAUPPAUGE_HVR3000,
+       }, {
+               .subvendor = 0x18ac,
+               .subdevice = 0xdc00,
+               .card      = CX88_BOARD_SAMSUNG_SMT_7020,
+       }, {
+               .subvendor = 0x18ac,
+               .subdevice = 0xdccd,
+               .card      = CX88_BOARD_SAMSUNG_SMT_7020,
        },{
                .subvendor = 0x1461,
                .subdevice = 0xc111, /* AverMedia M150-D */
@@ -2633,6 +2653,9 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
        case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
                /* known */
                break;
+       case CX88_BOARD_SAMSUNG_SMT_7020:
+               cx_set(MO_GP0_IO, 0x008989FF);
+               break;
        default:
                warn_printk(core, "warning: unknown hauppauge model #%d\n",
                            tv.model);
index b14296923250871f8d8234cf5ec4e3c25242fab2..94ab862f02190bf19936773db0205af3041a38fc 100644 (file)
@@ -674,6 +674,194 @@ static int cx8802_alloc_frontends(struct cx8802_dev *dev)
        return 0;
 }
 
+
+
+static u8 samsung_smt_7020_inittab[] = {
+            0x01, 0x15,
+            0x02, 0x00,
+            0x03, 0x00,
+            0x04, 0x7D,
+            0x05, 0x0F,
+            0x06, 0x02,
+            0x07, 0x00,
+            0x08, 0x60,
+
+            0x0A, 0xC2,
+            0x0B, 0x00,
+            0x0C, 0x01,
+            0x0D, 0x81,
+            0x0E, 0x44,
+            0x0F, 0x09,
+            0x10, 0x3C,
+            0x11, 0x84,
+            0x12, 0xDA,
+            0x13, 0x99,
+            0x14, 0x8D,
+            0x15, 0xCE,
+            0x16, 0xE8,
+            0x17, 0x43,
+            0x18, 0x1C,
+            0x19, 0x1B,
+            0x1A, 0x1D,
+
+            0x1C, 0x12,
+            0x1D, 0x00,
+            0x1E, 0x00,
+            0x1F, 0x00,
+            0x20, 0x00,
+            0x21, 0x00,
+            0x22, 0x00,
+            0x23, 0x00,
+
+            0x28, 0x02,
+            0x29, 0x28,
+            0x2A, 0x14,
+            0x2B, 0x0F,
+            0x2C, 0x09,
+            0x2D, 0x05,
+
+            0x31, 0x1F,
+            0x32, 0x19,
+            0x33, 0xFC,
+            0x34, 0x13,
+            0xff, 0xff,
+};
+
+
+static int samsung_smt_7020_tuner_set_params(struct dvb_frontend *fe,
+       struct dvb_frontend_parameters *params)
+{
+       struct cx8802_dev *dev = fe->dvb->priv;
+       u8 buf[4];
+       u32 div;
+       struct i2c_msg msg = {
+               .addr = 0x61,
+               .flags = 0,
+               .buf = buf,
+               .len = sizeof(buf) };
+
+       div = params->frequency / 125;
+
+       buf[0] = (div >> 8) & 0x7f;
+       buf[1] = div & 0xff;
+       buf[2] = 0x84;  /* 0xC4 */
+       buf[3] = 0x00;
+
+       if (params->frequency < 1500000)
+               buf[3] |= 0x10;
+
+       if (fe->ops.i2c_gate_ctrl)
+               fe->ops.i2c_gate_ctrl(fe, 1);
+
+       if (i2c_transfer(&dev->core->i2c_adap, &msg, 1) != 1)
+               return -EIO;
+
+       return 0;
+}
+
+static int samsung_smt_7020_set_tone(struct dvb_frontend *fe,
+       fe_sec_tone_mode_t tone)
+{
+       struct cx8802_dev *dev = fe->dvb->priv;
+       struct cx88_core *core = dev->core;
+
+       cx_set(MO_GP0_IO, 0x0800);
+
+       switch (tone) {
+       case SEC_TONE_ON:
+               cx_set(MO_GP0_IO, 0x08);
+               break;
+       case SEC_TONE_OFF:
+               cx_clear(MO_GP0_IO, 0x08);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int samsung_smt_7020_set_voltage(struct dvb_frontend *fe,
+       fe_sec_voltage_t voltage)
+{
+       struct cx8802_dev *dev = fe->dvb->priv;
+       struct cx88_core *core = dev->core;
+
+       u8 data;
+       struct i2c_msg msg = {
+               .addr = 8,
+               .flags = 0,
+               .buf = &data,
+               .len = sizeof(data) };
+
+       cx_set(MO_GP0_IO, 0x8000);
+
+       switch (voltage) {
+       case SEC_VOLTAGE_OFF:
+               break;
+       case SEC_VOLTAGE_13:
+               data = ISL6421_EN1 | ISL6421_LLC1;
+               cx_clear(MO_GP0_IO, 0x80);
+               break;
+       case SEC_VOLTAGE_18:
+               data = ISL6421_EN1 | ISL6421_LLC1 | ISL6421_VSEL1;
+               cx_clear(MO_GP0_IO, 0x80);
+               break;
+       default:
+               return -EINVAL;
+       };
+
+       return (i2c_transfer(&dev->core->i2c_adap, &msg, 1) == 1) ? 0 : -EIO;
+}
+
+static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe,
+       u32 srate, u32 ratio)
+{
+       u8 aclk = 0;
+       u8 bclk = 0;
+
+       if (srate < 1500000) {
+               aclk = 0xb7;
+               bclk = 0x47;
+       } else if (srate < 3000000) {
+               aclk = 0xb7;
+               bclk = 0x4b;
+       } else if (srate < 7000000) {
+               aclk = 0xb7;
+               bclk = 0x4f;
+       } else if (srate < 14000000) {
+               aclk = 0xb7;
+               bclk = 0x53;
+       } else if (srate < 30000000) {
+               aclk = 0xb6;
+               bclk = 0x53;
+       } else if (srate < 45000000) {
+               aclk = 0xb4;
+               bclk = 0x51;
+       }
+
+       stv0299_writereg(fe, 0x13, aclk);
+       stv0299_writereg(fe, 0x14, bclk);
+       stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
+       stv0299_writereg(fe, 0x20, (ratio >>  8) & 0xff);
+       stv0299_writereg(fe, 0x21, ratio & 0xf0);
+
+       return 0;
+}
+
+
+static struct stv0299_config samsung_stv0299_config = {
+       .demod_address = 0x68,
+       .inittab = samsung_smt_7020_inittab,
+       .mclk = 88000000UL,
+       .invert = 0,
+       .skip_reinit = 0,
+       .lock_output = STV0299_LOCKOUTPUT_LK,
+       .volt13_op0_op1 = STV0299_VOLT13_OP1,
+       .min_delay_ms = 100,
+       .set_symbol_rate = samsung_smt_7020_stv0299_set_symbol_rate,
+};
+
 static int dvb_register(struct cx8802_dev *dev)
 {
        struct cx88_core *core = dev->core;
@@ -1203,6 +1391,32 @@ static int dvb_register(struct cx8802_dev *dev)
                }
                break;
                }
+       case CX88_BOARD_SAMSUNG_SMT_7020:
+               dev->ts_gen_cntrl = 0x08;
+
+               cx_set(MO_GP0_IO, 0x0101);
+
+               cx_clear(MO_GP0_IO, 0x01);
+               mdelay(100);
+               cx_set(MO_GP0_IO, 0x01);
+               mdelay(200);
+
+               fe0->dvb.frontend = dvb_attach(stv0299_attach,
+                                       &samsung_stv0299_config,
+                                       &dev->core->i2c_adap);
+               if (fe0->dvb.frontend) {
+                       fe0->dvb.frontend->ops.tuner_ops.set_params =
+                               samsung_smt_7020_tuner_set_params;
+                       fe0->dvb.frontend->tuner_priv =
+                               &dev->core->i2c_adap;
+                       fe0->dvb.frontend->ops.set_voltage =
+                               samsung_smt_7020_set_voltage;
+                       fe0->dvb.frontend->ops.set_tone =
+                               samsung_smt_7020_set_tone;
+               }
+
+               break;
+
        default:
                printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
                       core->name);
index f9fda18b410c6b21a89f043ea7b6712016396e4d..de180d4d5a2139c3a7c430e484724421df4e305d 100644 (file)
@@ -192,7 +192,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
        struct cx88_IR *ir;
        struct input_dev *input_dev;
        struct ir_scancode_table *ir_codes = NULL;
-       int ir_type = IR_TYPE_OTHER;
+       u64 ir_type = IR_TYPE_OTHER;
        int err = -ENOMEM;
 
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
@@ -383,7 +383,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
        cx88_ir_start(core, ir);
 
        /* all done */
-       err = ir_input_register(ir->input, ir_codes);
+       err = ir_input_register(ir->input, ir_codes, NULL);
        if (err)
                goto err_out_stop;
 
index bb51048934119c7d32a456b5ae035b8697463ef5..338af77f7f01f2df2ff8dc9c4f9efb214e616365 100644 (file)
@@ -110,6 +110,9 @@ static int cx8802_start_dma(struct cx8802_dev    *dev,
                case CX88_BOARD_PCHDTV_HD5500:
                        cx_write(TS_SOP_STAT, 1<<13);
                        break;
+               case CX88_BOARD_SAMSUNG_SMT_7020:
+                       cx_write(TS_SOP_STAT, 0x00);
+                       break;
                case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
                case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
                        cx_write(MO_PINMUX_IO, 0x88); /* Enable MPEG parallel IO and video signal pins */
index b1499bf604eafff2fbfa8a102959fd94e0206fa9..48b6c04fb497e5d028037c0d38d6bf8d2a9962e5 100644 (file)
@@ -239,6 +239,7 @@ extern struct sram_channel cx88_sram_channels[];
 #define CX88_BOARD_WINFAST_DTV1800H        81
 #define CX88_BOARD_WINFAST_DTV2000H_J      82
 #define CX88_BOARD_PROF_7301               83
+#define CX88_BOARD_SAMSUNG_SMT_7020        84
 
 enum cx88_itype {
        CX88_VMUX_COMPOSITE1 = 1,
index ee43876adb065bde22517eecf6f0968140b7906d..9b413a35e048e3e96790a98b810a4cb41d282ddd 100644 (file)
@@ -913,6 +913,8 @@ static void __exit dabusb_cleanup (void)
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
+MODULE_FIRMWARE("dabusb/firmware.fw");
+MODULE_FIRMWARE("dabusb/bitstream.bin");
 
 module_param(buffers, int, 0);
 MODULE_PARM_DESC (buffers, "Number of buffers (default=256)");
index 1a8b8f3f182e816bcd6c925e0fe2ecd53c131dca..a37955745aaa45fbe7778c67e729f53f49316b7f 100644 (file)
@@ -15,3 +15,4 @@ obj-$(CONFIG_VIDEO_VPSS_SYSTEM) += vpss.o
 obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o
 obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o
 obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o
+obj-$(CONFIG_VIDEO_ISIF) += isif.o
index 314390016370230316d6ac6e09ba67b006fc9c9e..c29ac88ffd787760cc8c1ccee74308afcee9559b 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
 #include <linux/videodev2.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
 #include <media/davinci/dm355_ccdc.h>
 #include <media/davinci/vpss.h>
+
 #include "dm355_ccdc_regs.h"
 #include "ccdc_hw_device.h"
 
@@ -46,67 +50,75 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("CCDC Driver for DM355");
 MODULE_AUTHOR("Texas Instruments");
 
-static struct device *dev;
-
-/* Object for CCDC raw mode */
-static struct ccdc_params_raw ccdc_hw_params_raw = {
-       .pix_fmt = CCDC_PIXFMT_RAW,
-       .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
-       .win = CCDC_WIN_VGA,
-       .fid_pol = VPFE_PINPOL_POSITIVE,
-       .vd_pol = VPFE_PINPOL_POSITIVE,
-       .hd_pol = VPFE_PINPOL_POSITIVE,
-       .gain = {
-               .r_ye = 256,
-               .gb_g = 256,
-               .gr_cy = 256,
-               .b_mg = 256
-       },
-       .config_params = {
-               .datasft = 2,
-               .data_sz = CCDC_DATA_10BITS,
-               .mfilt1 = CCDC_NO_MEDIAN_FILTER1,
-               .mfilt2 = CCDC_NO_MEDIAN_FILTER2,
-               .alaw = {
-                       .gama_wd = 2,
+static struct ccdc_oper_config {
+       struct device *dev;
+       /* CCDC interface type */
+       enum vpfe_hw_if_type if_type;
+       /* Raw Bayer configuration */
+       struct ccdc_params_raw bayer;
+       /* YCbCr configuration */
+       struct ccdc_params_ycbcr ycbcr;
+       /* Master clock */
+       struct clk *mclk;
+       /* slave clock */
+       struct clk *sclk;
+       /* ccdc base address */
+       void __iomem *base_addr;
+} ccdc_cfg = {
+       /* Raw configurations */
+       .bayer = {
+               .pix_fmt = CCDC_PIXFMT_RAW,
+               .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
+               .win = CCDC_WIN_VGA,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .gain = {
+                       .r_ye = 256,
+                       .gb_g = 256,
+                       .gr_cy = 256,
+                       .b_mg = 256
                },
-               .blk_clamp = {
-                       .sample_pixel = 1,
-                       .dc_sub = 25
-               },
-               .col_pat_field0 = {
-                       .olop = CCDC_GREEN_BLUE,
-                       .olep = CCDC_BLUE,
-                       .elop = CCDC_RED,
-                       .elep = CCDC_GREEN_RED
-               },
-               .col_pat_field1 = {
-                       .olop = CCDC_GREEN_BLUE,
-                       .olep = CCDC_BLUE,
-                       .elop = CCDC_RED,
-                       .elep = CCDC_GREEN_RED
+               .config_params = {
+                       .datasft = 2,
+                       .mfilt1 = CCDC_NO_MEDIAN_FILTER1,
+                       .mfilt2 = CCDC_NO_MEDIAN_FILTER2,
+                       .alaw = {
+                               .gama_wd = 2,
+                       },
+                       .blk_clamp = {
+                               .sample_pixel = 1,
+                               .dc_sub = 25
+                       },
+                       .col_pat_field0 = {
+                               .olop = CCDC_GREEN_BLUE,
+                               .olep = CCDC_BLUE,
+                               .elop = CCDC_RED,
+                               .elep = CCDC_GREEN_RED
+                       },
+                       .col_pat_field1 = {
+                               .olop = CCDC_GREEN_BLUE,
+                               .olep = CCDC_BLUE,
+                               .elop = CCDC_RED,
+                               .elep = CCDC_GREEN_RED
+                       },
                },
        },
+       /* YCbCr configuration */
+       .ycbcr = {
+               .win = CCDC_WIN_PAL,
+               .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
+               .frm_fmt = CCDC_FRMFMT_INTERLACED,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .bt656_enable = 1,
+               .pix_order = CCDC_PIXORDER_CBYCRY,
+               .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
+       },
 };
 
 
-/* Object for CCDC ycbcr mode */
-static struct ccdc_params_ycbcr ccdc_hw_params_ycbcr = {
-       .win = CCDC_WIN_PAL,
-       .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
-       .frm_fmt = CCDC_FRMFMT_INTERLACED,
-       .fid_pol = VPFE_PINPOL_POSITIVE,
-       .vd_pol = VPFE_PINPOL_POSITIVE,
-       .hd_pol = VPFE_PINPOL_POSITIVE,
-       .bt656_enable = 1,
-       .pix_order = CCDC_PIXORDER_CBYCRY,
-       .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
-};
-
-static enum vpfe_hw_if_type ccdc_if_type;
-static void *__iomem ccdc_base_addr;
-static int ccdc_addr_size;
-
 /* Raw Bayer formats */
 static u32 ccdc_raw_bayer_pix_formats[] =
                {V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SBGGR16};
@@ -118,18 +130,12 @@ static u32 ccdc_raw_yuv_pix_formats[] =
 /* register access routines */
 static inline u32 regr(u32 offset)
 {
-       return __raw_readl(ccdc_base_addr + offset);
+       return __raw_readl(ccdc_cfg.base_addr + offset);
 }
 
 static inline void regw(u32 val, u32 offset)
 {
-       __raw_writel(val, ccdc_base_addr + offset);
-}
-
-static void ccdc_set_ccdc_base(void *addr, int size)
-{
-       ccdc_base_addr = addr;
-       ccdc_addr_size = size;
+       __raw_writel(val, ccdc_cfg.base_addr + offset);
 }
 
 static void ccdc_enable(int en)
@@ -153,12 +159,12 @@ static void ccdc_enable_output_to_sdram(int en)
 static void ccdc_config_gain_offset(void)
 {
        /* configure gain */
-       regw(ccdc_hw_params_raw.gain.r_ye, RYEGAIN);
-       regw(ccdc_hw_params_raw.gain.gr_cy, GRCYGAIN);
-       regw(ccdc_hw_params_raw.gain.gb_g, GBGGAIN);
-       regw(ccdc_hw_params_raw.gain.b_mg, BMGGAIN);
+       regw(ccdc_cfg.bayer.gain.r_ye, RYEGAIN);
+       regw(ccdc_cfg.bayer.gain.gr_cy, GRCYGAIN);
+       regw(ccdc_cfg.bayer.gain.gb_g, GBGGAIN);
+       regw(ccdc_cfg.bayer.gain.b_mg, BMGGAIN);
        /* configure offset */
-       regw(ccdc_hw_params_raw.ccdc_offset, OFFSET);
+       regw(ccdc_cfg.bayer.ccdc_offset, OFFSET);
 }
 
 /*
@@ -169,7 +175,7 @@ static int ccdc_restore_defaults(void)
 {
        int i;
 
-       dev_dbg(dev, "\nstarting ccdc_restore_defaults...");
+       dev_dbg(ccdc_cfg.dev, "\nstarting ccdc_restore_defaults...");
        /* set all registers to zero */
        for (i = 0; i <= CCDC_REG_LAST; i += 4)
                regw(0, i);
@@ -180,30 +186,29 @@ static int ccdc_restore_defaults(void)
        regw(CULH_DEFAULT, CULH);
        regw(CULV_DEFAULT, CULV);
        /* Set default Gain and Offset */
-       ccdc_hw_params_raw.gain.r_ye = GAIN_DEFAULT;
-       ccdc_hw_params_raw.gain.gb_g = GAIN_DEFAULT;
-       ccdc_hw_params_raw.gain.gr_cy = GAIN_DEFAULT;
-       ccdc_hw_params_raw.gain.b_mg = GAIN_DEFAULT;
+       ccdc_cfg.bayer.gain.r_ye = GAIN_DEFAULT;
+       ccdc_cfg.bayer.gain.gb_g = GAIN_DEFAULT;
+       ccdc_cfg.bayer.gain.gr_cy = GAIN_DEFAULT;
+       ccdc_cfg.bayer.gain.b_mg = GAIN_DEFAULT;
        ccdc_config_gain_offset();
        regw(OUTCLIP_DEFAULT, OUTCLIP);
        regw(LSCCFG2_DEFAULT, LSCCFG2);
        /* select ccdc input */
        if (vpss_select_ccdc_source(VPSS_CCDCIN)) {
-               dev_dbg(dev, "\ncouldn't select ccdc input source");
+               dev_dbg(ccdc_cfg.dev, "\ncouldn't select ccdc input source");
                return -EFAULT;
        }
        /* select ccdc clock */
        if (vpss_enable_clock(VPSS_CCDC_CLOCK, 1) < 0) {
-               dev_dbg(dev, "\ncouldn't enable ccdc clock");
+               dev_dbg(ccdc_cfg.dev, "\ncouldn't enable ccdc clock");
                return -EFAULT;
        }
-       dev_dbg(dev, "\nEnd of ccdc_restore_defaults...");
+       dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_restore_defaults...");
        return 0;
 }
 
 static int ccdc_open(struct device *device)
 {
-       dev = device;
        return ccdc_restore_defaults();
 }
 
@@ -226,7 +231,7 @@ static void ccdc_setwin(struct v4l2_rect *image_win,
        int vert_start, vert_nr_lines;
        int mid_img = 0;
 
-       dev_dbg(dev, "\nStarting ccdc_setwin...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_setwin...");
 
        /*
         * ppc - per pixel count. indicates how many pixels per cell
@@ -260,45 +265,46 @@ static void ccdc_setwin(struct v4l2_rect *image_win,
        regw(vert_start & CCDC_START_VER_ONE_MASK, SLV0);
        regw(vert_start & CCDC_START_VER_TWO_MASK, SLV1);
        regw(vert_nr_lines & CCDC_NUM_LINES_VER, NLV);
-       dev_dbg(dev, "\nEnd of ccdc_setwin...");
+       dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_setwin...");
 }
 
 static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
 {
        if (ccdcparam->datasft < CCDC_DATA_NO_SHIFT ||
            ccdcparam->datasft > CCDC_DATA_SHIFT_6BIT) {
-               dev_dbg(dev, "Invalid value of data shift\n");
+               dev_dbg(ccdc_cfg.dev, "Invalid value of data shift\n");
                return -EINVAL;
        }
 
        if (ccdcparam->mfilt1 < CCDC_NO_MEDIAN_FILTER1 ||
            ccdcparam->mfilt1 > CCDC_MEDIAN_FILTER1) {
-               dev_dbg(dev, "Invalid value of median filter1\n");
+               dev_dbg(ccdc_cfg.dev, "Invalid value of median filter1\n");
                return -EINVAL;
        }
 
        if (ccdcparam->mfilt2 < CCDC_NO_MEDIAN_FILTER2 ||
            ccdcparam->mfilt2 > CCDC_MEDIAN_FILTER2) {
-               dev_dbg(dev, "Invalid value of median filter2\n");
+               dev_dbg(ccdc_cfg.dev, "Invalid value of median filter2\n");
                return -EINVAL;
        }
 
        if ((ccdcparam->med_filt_thres < 0) ||
           (ccdcparam->med_filt_thres > CCDC_MED_FILT_THRESH)) {
-               dev_dbg(dev, "Invalid value of median filter threshold\n");
+               dev_dbg(ccdc_cfg.dev,
+                       "Invalid value of median filter thresold\n");
                return -EINVAL;
        }
 
        if (ccdcparam->data_sz < CCDC_DATA_16BITS ||
            ccdcparam->data_sz > CCDC_DATA_8BITS) {
-               dev_dbg(dev, "Invalid value of data size\n");
+               dev_dbg(ccdc_cfg.dev, "Invalid value of data size\n");
                return -EINVAL;
        }
 
        if (ccdcparam->alaw.enable) {
                if (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_13_4 ||
                    ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) {
-                       dev_dbg(dev, "Invalid value of ALAW\n");
+                       dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n");
                        return -EINVAL;
                }
        }
@@ -306,12 +312,14 @@ static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
        if (ccdcparam->blk_clamp.b_clamp_enable) {
                if (ccdcparam->blk_clamp.sample_pixel < CCDC_SAMPLE_1PIXELS ||
                    ccdcparam->blk_clamp.sample_pixel > CCDC_SAMPLE_16PIXELS) {
-                       dev_dbg(dev, "Invalid value of sample pixel\n");
+                       dev_dbg(ccdc_cfg.dev,
+                               "Invalid value of sample pixel\n");
                        return -EINVAL;
                }
                if (ccdcparam->blk_clamp.sample_ln < CCDC_SAMPLE_1LINES ||
                    ccdcparam->blk_clamp.sample_ln > CCDC_SAMPLE_16LINES) {
-                       dev_dbg(dev, "Invalid value of sample lines\n");
+                       dev_dbg(ccdc_cfg.dev,
+                               "Invalid value of sample lines\n");
                        return -EINVAL;
                }
        }
@@ -325,18 +333,18 @@ static int ccdc_set_params(void __user *params)
        int x;
 
        /* only raw module parameters can be set through the IOCTL */
-       if (ccdc_if_type != VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type != VPFE_RAW_BAYER)
                return -EINVAL;
 
        x = copy_from_user(&ccdc_raw_params, params, sizeof(ccdc_raw_params));
        if (x) {
-               dev_dbg(dev, "ccdc_set_params: error in copying ccdc"
+               dev_dbg(ccdc_cfg.dev, "ccdc_set_params: error in copying ccdc"
                        "params, %d\n", x);
                return -EFAULT;
        }
 
        if (!validate_ccdc_param(&ccdc_raw_params)) {
-               memcpy(&ccdc_hw_params_raw.config_params,
+               memcpy(&ccdc_cfg.bayer.config_params,
                        &ccdc_raw_params,
                        sizeof(ccdc_raw_params));
                return 0;
@@ -347,11 +355,11 @@ static int ccdc_set_params(void __user *params)
 /* This function will configure CCDC for YCbCr video capture */
 static void ccdc_config_ycbcr(void)
 {
-       struct ccdc_params_ycbcr *params = &ccdc_hw_params_ycbcr;
+       struct ccdc_params_ycbcr *params = &ccdc_cfg.ycbcr;
        u32 temp;
 
        /* first set the CCDC power on defaults values in all registers */
-       dev_dbg(dev, "\nStarting ccdc_config_ycbcr...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_config_ycbcr...");
        ccdc_restore_defaults();
 
        /* configure pixel format & video frame format */
@@ -403,7 +411,7 @@ static void ccdc_config_ycbcr(void)
                regw(CCDC_SDOFST_FIELD_INTERLEAVED, SDOFST);
        }
 
-       dev_dbg(dev, "\nEnd of ccdc_config_ycbcr...\n");
+       dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_config_ycbcr...\n");
 }
 
 /*
@@ -483,7 +491,7 @@ int ccdc_write_dfc_entry(int index, struct ccdc_vertical_dft *dfc)
         */
 
        if (count) {
-               dev_err(dev, "defect table write timeout !!!\n");
+               dev_err(ccdc_cfg.dev, "defect table write timeout !!!\n");
                return -1;
        }
        return 0;
@@ -605,12 +613,12 @@ static void ccdc_config_color_patterns(struct ccdc_col_pat *pat0,
 /* This function will configure CCDC for Raw mode image capture */
 static int ccdc_config_raw(void)
 {
-       struct ccdc_params_raw *params = &ccdc_hw_params_raw;
+       struct ccdc_params_raw *params = &ccdc_cfg.bayer;
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                                       &ccdc_cfg.bayer.config_params;
        unsigned int val;
 
-       dev_dbg(dev, "\nStarting ccdc_config_raw...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_config_raw...");
 
        /* restore power on defaults to register */
        ccdc_restore_defaults();
@@ -659,7 +667,7 @@ static int ccdc_config_raw(void)
        val |= (config_params->datasft & CCDC_DATASFT_MASK) <<
                CCDC_DATASFT_SHIFT;
        regw(val , MODESET);
-       dev_dbg(dev, "\nWriting 0x%x to MODESET...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to MODESET...\n", val);
 
        /* Configure the Median Filter threshold */
        regw((config_params->med_filt_thres) & CCDC_MED_FILT_THRESH, MEDFILT);
@@ -681,7 +689,7 @@ static int ccdc_config_raw(void)
                (config_params->mfilt2 << CCDC_MFILT2_SHIFT));
 
        regw(val, GAMMAWD);
-       dev_dbg(dev, "\nWriting 0x%x to GAMMAWD...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to GAMMAWD...\n", val);
 
        /* configure video window */
        ccdc_setwin(&params->win, params->frm_fmt, 1);
@@ -706,7 +714,7 @@ static int ccdc_config_raw(void)
        /* Configure the Gain  & offset control */
        ccdc_config_gain_offset();
 
-       dev_dbg(dev, "\nWriting %x to COLPTN...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting %x to COLPTN...\n", val);
 
        /* Configure DATAOFST  register */
        val = (config_params->data_offset.horz_offset & CCDC_DATAOFST_MASK) <<
@@ -726,7 +734,7 @@ static int ccdc_config_raw(void)
                        CCDC_HSIZE_VAL_MASK;
 
                /* adjust to multiple of 32 */
-               dev_dbg(dev, "\nWriting 0x%x to HSIZE...\n",
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to HSIZE...\n",
                       (((params->win.width) + 31) >> 5) &
                        CCDC_HSIZE_VAL_MASK);
        } else {
@@ -734,7 +742,7 @@ static int ccdc_config_raw(void)
                val |= (((params->win.width * 2) + 31) >> 5) &
                        CCDC_HSIZE_VAL_MASK;
 
-               dev_dbg(dev, "\nWriting 0x%x to HSIZE...\n",
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to HSIZE...\n",
                       (((params->win.width * 2) + 31) >> 5) &
                        CCDC_HSIZE_VAL_MASK);
        }
@@ -745,34 +753,34 @@ static int ccdc_config_raw(void)
                if (params->image_invert_enable) {
                        /* For interlace inverse mode */
                        regw(CCDC_SDOFST_INTERLACE_INVERSE, SDOFST);
-                       dev_dbg(dev, "\nWriting %x to SDOFST...\n",
+                       dev_dbg(ccdc_cfg.dev, "\nWriting %x to SDOFST...\n",
                                CCDC_SDOFST_INTERLACE_INVERSE);
                } else {
                        /* For interlace non inverse mode */
                        regw(CCDC_SDOFST_INTERLACE_NORMAL, SDOFST);
-                       dev_dbg(dev, "\nWriting %x to SDOFST...\n",
+                       dev_dbg(ccdc_cfg.dev, "\nWriting %x to SDOFST...\n",
                                CCDC_SDOFST_INTERLACE_NORMAL);
                }
        } else if (params->frm_fmt == CCDC_FRMFMT_PROGRESSIVE) {
                if (params->image_invert_enable) {
                        /* For progessive inverse mode */
                        regw(CCDC_SDOFST_PROGRESSIVE_INVERSE, SDOFST);
-                       dev_dbg(dev, "\nWriting %x to SDOFST...\n",
+                       dev_dbg(ccdc_cfg.dev, "\nWriting %x to SDOFST...\n",
                                CCDC_SDOFST_PROGRESSIVE_INVERSE);
                } else {
                        /* For progessive non inverse mode */
                        regw(CCDC_SDOFST_PROGRESSIVE_NORMAL, SDOFST);
-                       dev_dbg(dev, "\nWriting %x to SDOFST...\n",
+                       dev_dbg(ccdc_cfg.dev, "\nWriting %x to SDOFST...\n",
                                CCDC_SDOFST_PROGRESSIVE_NORMAL);
                }
        }
-       dev_dbg(dev, "\nend of ccdc_config_raw...");
+       dev_dbg(ccdc_cfg.dev, "\nend of ccdc_config_raw...");
        return 0;
 }
 
 static int ccdc_configure(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
                return ccdc_config_raw();
        else
                ccdc_config_ycbcr();
@@ -781,23 +789,23 @@ static int ccdc_configure(void)
 
 static int ccdc_set_buftype(enum ccdc_buftype buf_type)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.buf_type = buf_type;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.buf_type = buf_type;
        else
-               ccdc_hw_params_ycbcr.buf_type = buf_type;
+               ccdc_cfg.ycbcr.buf_type = buf_type;
        return 0;
 }
 static enum ccdc_buftype ccdc_get_buftype(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               return ccdc_hw_params_raw.buf_type;
-       return ccdc_hw_params_ycbcr.buf_type;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               return ccdc_cfg.bayer.buf_type;
+       return ccdc_cfg.ycbcr.buf_type;
 }
 
 static int ccdc_enum_pix(u32 *pix, int i)
 {
        int ret = -EINVAL;
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
                if (i < ARRAY_SIZE(ccdc_raw_bayer_pix_formats)) {
                        *pix = ccdc_raw_bayer_pix_formats[i];
                        ret = 0;
@@ -813,20 +821,19 @@ static int ccdc_enum_pix(u32 *pix, int i)
 
 static int ccdc_set_pixel_format(u32 pixfmt)
 {
-       struct ccdc_a_law *alaw =
-               &ccdc_hw_params_raw.config_params.alaw;
+       struct ccdc_a_law *alaw = &ccdc_cfg.bayer.config_params.alaw;
 
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
-               ccdc_hw_params_raw.pix_fmt = CCDC_PIXFMT_RAW;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
+               ccdc_cfg.bayer.pix_fmt = CCDC_PIXFMT_RAW;
                if (pixfmt == V4L2_PIX_FMT_SBGGR8)
                        alaw->enable = 1;
                else if (pixfmt != V4L2_PIX_FMT_SBGGR16)
                        return -EINVAL;
        } else {
                if (pixfmt == V4L2_PIX_FMT_YUYV)
-                       ccdc_hw_params_ycbcr.pix_order = CCDC_PIXORDER_YCBYCR;
+                       ccdc_cfg.ycbcr.pix_order = CCDC_PIXORDER_YCBYCR;
                else if (pixfmt == V4L2_PIX_FMT_UYVY)
-                       ccdc_hw_params_ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
+                       ccdc_cfg.ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
                else
                        return -EINVAL;
        }
@@ -834,17 +841,16 @@ static int ccdc_set_pixel_format(u32 pixfmt)
 }
 static u32 ccdc_get_pixel_format(void)
 {
-       struct ccdc_a_law *alaw =
-               &ccdc_hw_params_raw.config_params.alaw;
+       struct ccdc_a_law *alaw = &ccdc_cfg.bayer.config_params.alaw;
        u32 pixfmt;
 
-       if (ccdc_if_type == VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
                if (alaw->enable)
                        pixfmt = V4L2_PIX_FMT_SBGGR8;
                else
                        pixfmt = V4L2_PIX_FMT_SBGGR16;
        else {
-               if (ccdc_hw_params_ycbcr.pix_order == CCDC_PIXORDER_YCBYCR)
+               if (ccdc_cfg.ycbcr.pix_order == CCDC_PIXORDER_YCBYCR)
                        pixfmt = V4L2_PIX_FMT_YUYV;
                else
                        pixfmt = V4L2_PIX_FMT_UYVY;
@@ -853,53 +859,53 @@ static u32 ccdc_get_pixel_format(void)
 }
 static int ccdc_set_image_window(struct v4l2_rect *win)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.win = *win;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.win = *win;
        else
-               ccdc_hw_params_ycbcr.win = *win;
+               ccdc_cfg.ycbcr.win = *win;
        return 0;
 }
 
 static void ccdc_get_image_window(struct v4l2_rect *win)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               *win = ccdc_hw_params_raw.win;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               *win = ccdc_cfg.bayer.win;
        else
-               *win = ccdc_hw_params_ycbcr.win;
+               *win = ccdc_cfg.ycbcr.win;
 }
 
 static unsigned int ccdc_get_line_length(void)
 {
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                               &ccdc_cfg.bayer.config_params;
        unsigned int len;
 
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
                if ((config_params->alaw.enable) ||
                    (config_params->data_sz == CCDC_DATA_8BITS))
-                       len = ccdc_hw_params_raw.win.width;
+                       len = ccdc_cfg.bayer.win.width;
                else
-                       len = ccdc_hw_params_raw.win.width * 2;
+                       len = ccdc_cfg.bayer.win.width * 2;
        } else
-               len = ccdc_hw_params_ycbcr.win.width * 2;
+               len = ccdc_cfg.ycbcr.win.width * 2;
        return ALIGN(len, 32);
 }
 
 static int ccdc_set_frame_format(enum ccdc_frmfmt frm_fmt)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.frm_fmt = frm_fmt;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.frm_fmt = frm_fmt;
        else
-               ccdc_hw_params_ycbcr.frm_fmt = frm_fmt;
+               ccdc_cfg.ycbcr.frm_fmt = frm_fmt;
        return 0;
 }
 
 static enum ccdc_frmfmt ccdc_get_frame_format(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               return ccdc_hw_params_raw.frm_fmt;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               return ccdc_cfg.bayer.frm_fmt;
        else
-               return ccdc_hw_params_ycbcr.frm_fmt;
+               return ccdc_cfg.ycbcr.frm_fmt;
 }
 
 static int ccdc_getfid(void)
@@ -916,14 +922,14 @@ static inline void ccdc_setfbaddr(unsigned long addr)
 
 static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params)
 {
-       ccdc_if_type = params->if_type;
+       ccdc_cfg.if_type = params->if_type;
 
        switch (params->if_type) {
        case VPFE_BT656:
        case VPFE_YCBCR_SYNC_16:
        case VPFE_YCBCR_SYNC_8:
-               ccdc_hw_params_ycbcr.vd_pol = params->vdpol;
-               ccdc_hw_params_ycbcr.hd_pol = params->hdpol;
+               ccdc_cfg.ycbcr.vd_pol = params->vdpol;
+               ccdc_cfg.ycbcr.hd_pol = params->hdpol;
                break;
        default:
                /* TODO add support for raw bayer here */
@@ -938,7 +944,6 @@ static struct ccdc_hw_device ccdc_hw_dev = {
        .hw_ops = {
                .open = ccdc_open,
                .close = ccdc_close,
-               .set_ccdc_base = ccdc_set_ccdc_base,
                .enable = ccdc_enable,
                .enable_out_to_sdram = ccdc_enable_output_to_sdram,
                .set_hw_if_params = ccdc_set_hw_if_params,
@@ -959,19 +964,118 @@ static struct ccdc_hw_device ccdc_hw_dev = {
        },
 };
 
-static int __init dm355_ccdc_init(void)
+static int __init dm355_ccdc_probe(struct platform_device *pdev)
 {
-       printk(KERN_NOTICE "dm355_ccdc_init\n");
-       if (vpfe_register_ccdc_device(&ccdc_hw_dev) < 0)
-               return -1;
-       printk(KERN_NOTICE "%s is registered with vpfe.\n",
-               ccdc_hw_dev.name);
+       void (*setup_pinmux)(void);
+       struct resource *res;
+       int status = 0;
+
+       /*
+        * first try to register with vpfe. If not correct platform, then we
+        * don't have to iomap
+        */
+       status = vpfe_register_ccdc_device(&ccdc_hw_dev);
+       if (status < 0)
+               return status;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res) {
+               status = -ENODEV;
+               goto fail_nores;
+       }
+
+       res = request_mem_region(res->start, resource_size(res), res->name);
+       if (!res) {
+               status = -EBUSY;
+               goto fail_nores;
+       }
+
+       ccdc_cfg.base_addr = ioremap_nocache(res->start, resource_size(res));
+       if (!ccdc_cfg.base_addr) {
+               status = -ENOMEM;
+               goto fail_nomem;
+       }
+
+       /* Get and enable Master clock */
+       ccdc_cfg.mclk = clk_get(&pdev->dev, "master");
+       if (IS_ERR(ccdc_cfg.mclk)) {
+               status = PTR_ERR(ccdc_cfg.mclk);
+               goto fail_nomap;
+       }
+       if (clk_enable(ccdc_cfg.mclk)) {
+               status = -ENODEV;
+               goto fail_mclk;
+       }
+
+       /* Get and enable Slave clock */
+       ccdc_cfg.sclk = clk_get(&pdev->dev, "slave");
+       if (IS_ERR(ccdc_cfg.sclk)) {
+               status = PTR_ERR(ccdc_cfg.sclk);
+               goto fail_mclk;
+       }
+       if (clk_enable(ccdc_cfg.sclk)) {
+               status = -ENODEV;
+               goto fail_sclk;
+       }
+
+       /* Platform data holds setup_pinmux function ptr */
+       if (NULL == pdev->dev.platform_data) {
+               status = -ENODEV;
+               goto fail_sclk;
+       }
+       setup_pinmux = pdev->dev.platform_data;
+       /*
+        * setup Mux configuration for ccdc which may be different for
+        * different SoCs using this CCDC
+        */
+       setup_pinmux();
+       ccdc_cfg.dev = &pdev->dev;
+       printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name);
        return 0;
+fail_sclk:
+       clk_put(ccdc_cfg.sclk);
+fail_mclk:
+       clk_put(ccdc_cfg.mclk);
+fail_nomap:
+       iounmap(ccdc_cfg.base_addr);
+fail_nomem:
+       release_mem_region(res->start, resource_size(res));
+fail_nores:
+       vpfe_unregister_ccdc_device(&ccdc_hw_dev);
+       return status;
 }
 
-static void __exit dm355_ccdc_exit(void)
+static int dm355_ccdc_remove(struct platform_device *pdev)
 {
+       struct resource *res;
+
+       clk_put(ccdc_cfg.mclk);
+       clk_put(ccdc_cfg.sclk);
+       iounmap(ccdc_cfg.base_addr);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res)
+               release_mem_region(res->start, resource_size(res));
        vpfe_unregister_ccdc_device(&ccdc_hw_dev);
+       return 0;
+}
+
+static struct platform_driver dm355_ccdc_driver = {
+       .driver = {
+               .name   = "dm355_ccdc",
+               .owner = THIS_MODULE,
+       },
+       .remove = __devexit_p(dm355_ccdc_remove),
+       .probe = dm355_ccdc_probe,
+};
+
+static int __init dm355_ccdc_init(void)
+{
+       return platform_driver_register(&dm355_ccdc_driver);
+}
+
+static void __exit dm355_ccdc_exit(void)
+{
+       platform_driver_unregister(&dm355_ccdc_driver);
 }
 
 module_init(dm355_ccdc_init);
index d5fa193f32d24371b1d273bb7d156149ede86b22..0c394cade22a5919173c0ea9b0e612d480f2022b 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
 #include <linux/videodev2.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
 #include <media/davinci/dm644x_ccdc.h>
 #include <media/davinci/vpss.h>
+
 #include "dm644x_ccdc_regs.h"
 #include "ccdc_hw_device.h"
 
@@ -46,32 +50,44 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("CCDC Driver for DM6446");
 MODULE_AUTHOR("Texas Instruments");
 
-static struct device *dev;
-
-/* Object for CCDC raw mode */
-static struct ccdc_params_raw ccdc_hw_params_raw = {
-       .pix_fmt = CCDC_PIXFMT_RAW,
-       .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
-       .win = CCDC_WIN_VGA,
-       .fid_pol = VPFE_PINPOL_POSITIVE,
-       .vd_pol = VPFE_PINPOL_POSITIVE,
-       .hd_pol = VPFE_PINPOL_POSITIVE,
-       .config_params = {
-               .data_sz = CCDC_DATA_10BITS,
+static struct ccdc_oper_config {
+       struct device *dev;
+       /* CCDC interface type */
+       enum vpfe_hw_if_type if_type;
+       /* Raw Bayer configuration */
+       struct ccdc_params_raw bayer;
+       /* YCbCr configuration */
+       struct ccdc_params_ycbcr ycbcr;
+       /* Master clock */
+       struct clk *mclk;
+       /* slave clock */
+       struct clk *sclk;
+       /* ccdc base address */
+       void __iomem *base_addr;
+} ccdc_cfg = {
+       /* Raw configurations */
+       .bayer = {
+               .pix_fmt = CCDC_PIXFMT_RAW,
+               .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
+               .win = CCDC_WIN_VGA,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .config_params = {
+                       .data_sz = CCDC_DATA_10BITS,
+               },
+       },
+       .ycbcr = {
+               .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
+               .frm_fmt = CCDC_FRMFMT_INTERLACED,
+               .win = CCDC_WIN_PAL,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .bt656_enable = 1,
+               .pix_order = CCDC_PIXORDER_CBYCRY,
+               .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
        },
-};
-
-/* Object for CCDC ycbcr mode */
-static struct ccdc_params_ycbcr ccdc_hw_params_ycbcr = {
-       .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
-       .frm_fmt = CCDC_FRMFMT_INTERLACED,
-       .win = CCDC_WIN_PAL,
-       .fid_pol = VPFE_PINPOL_POSITIVE,
-       .vd_pol = VPFE_PINPOL_POSITIVE,
-       .hd_pol = VPFE_PINPOL_POSITIVE,
-       .bt656_enable = 1,
-       .pix_order = CCDC_PIXORDER_CBYCRY,
-       .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
 };
 
 #define CCDC_MAX_RAW_YUV_FORMATS       2
@@ -84,25 +100,15 @@ static u32 ccdc_raw_bayer_pix_formats[] =
 static u32 ccdc_raw_yuv_pix_formats[] =
        {V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV};
 
-static void *__iomem ccdc_base_addr;
-static int ccdc_addr_size;
-static enum vpfe_hw_if_type ccdc_if_type;
-
 /* register access routines */
 static inline u32 regr(u32 offset)
 {
-       return __raw_readl(ccdc_base_addr + offset);
+       return __raw_readl(ccdc_cfg.base_addr + offset);
 }
 
 static inline void regw(u32 val, u32 offset)
 {
-       __raw_writel(val, ccdc_base_addr + offset);
-}
-
-static void ccdc_set_ccdc_base(void *addr, int size)
-{
-       ccdc_base_addr = addr;
-       ccdc_addr_size = size;
+       __raw_writel(val, ccdc_cfg.base_addr + offset);
 }
 
 static void ccdc_enable(int flag)
@@ -132,7 +138,7 @@ void ccdc_setwin(struct v4l2_rect *image_win,
        int vert_start, vert_nr_lines;
        int val = 0, mid_img = 0;
 
-       dev_dbg(dev, "\nStarting ccdc_setwin...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_setwin...");
        /*
         * ppc - per pixel count. indicates how many pixels per cell
         * output to SDRAM. example, for ycbcr, it is one y and one c, so 2.
@@ -171,7 +177,7 @@ void ccdc_setwin(struct v4l2_rect *image_win,
        regw((vert_start << CCDC_VERT_START_SLV0_SHIFT) | vert_start,
             CCDC_VERT_START);
        regw(vert_nr_lines, CCDC_VERT_LINES);
-       dev_dbg(dev, "\nEnd of ccdc_setwin...");
+       dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_setwin...");
 }
 
 static void ccdc_readregs(void)
@@ -179,39 +185,39 @@ static void ccdc_readregs(void)
        unsigned int val = 0;
 
        val = regr(CCDC_ALAW);
-       dev_notice(dev, "\nReading 0x%x to ALAW...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to ALAW...\n", val);
        val = regr(CCDC_CLAMP);
-       dev_notice(dev, "\nReading 0x%x to CLAMP...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to CLAMP...\n", val);
        val = regr(CCDC_DCSUB);
-       dev_notice(dev, "\nReading 0x%x to DCSUB...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to DCSUB...\n", val);
        val = regr(CCDC_BLKCMP);
-       dev_notice(dev, "\nReading 0x%x to BLKCMP...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to BLKCMP...\n", val);
        val = regr(CCDC_FPC_ADDR);
-       dev_notice(dev, "\nReading 0x%x to FPC_ADDR...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to FPC_ADDR...\n", val);
        val = regr(CCDC_FPC);
-       dev_notice(dev, "\nReading 0x%x to FPC...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to FPC...\n", val);
        val = regr(CCDC_FMTCFG);
-       dev_notice(dev, "\nReading 0x%x to FMTCFG...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to FMTCFG...\n", val);
        val = regr(CCDC_COLPTN);
-       dev_notice(dev, "\nReading 0x%x to COLPTN...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to COLPTN...\n", val);
        val = regr(CCDC_FMT_HORZ);
-       dev_notice(dev, "\nReading 0x%x to FMT_HORZ...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to FMT_HORZ...\n", val);
        val = regr(CCDC_FMT_VERT);
-       dev_notice(dev, "\nReading 0x%x to FMT_VERT...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to FMT_VERT...\n", val);
        val = regr(CCDC_HSIZE_OFF);
-       dev_notice(dev, "\nReading 0x%x to HSIZE_OFF...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to HSIZE_OFF...\n", val);
        val = regr(CCDC_SDOFST);
-       dev_notice(dev, "\nReading 0x%x to SDOFST...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to SDOFST...\n", val);
        val = regr(CCDC_VP_OUT);
-       dev_notice(dev, "\nReading 0x%x to VP_OUT...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VP_OUT...\n", val);
        val = regr(CCDC_SYN_MODE);
-       dev_notice(dev, "\nReading 0x%x to SYN_MODE...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to SYN_MODE...\n", val);
        val = regr(CCDC_HORZ_INFO);
-       dev_notice(dev, "\nReading 0x%x to HORZ_INFO...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to HORZ_INFO...\n", val);
        val = regr(CCDC_VERT_START);
-       dev_notice(dev, "\nReading 0x%x to VERT_START...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VERT_START...\n", val);
        val = regr(CCDC_VERT_LINES);
-       dev_notice(dev, "\nReading 0x%x to VERT_LINES...\n", val);
+       dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VERT_LINES...\n", val);
 }
 
 static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
@@ -220,7 +226,7 @@ static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
                if ((ccdcparam->alaw.gama_wd > CCDC_GAMMA_BITS_09_0) ||
                    (ccdcparam->alaw.gama_wd < CCDC_GAMMA_BITS_15_6) ||
                    (ccdcparam->alaw.gama_wd < ccdcparam->data_sz)) {
-                       dev_dbg(dev, "\nInvalid data line select");
+                       dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
                        return -1;
                }
        }
@@ -230,7 +236,7 @@ static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
 static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
 {
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                               &ccdc_cfg.bayer.config_params;
        unsigned int *fpc_virtaddr = NULL;
        unsigned int *fpc_physaddr = NULL;
 
@@ -266,7 +272,7 @@ static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
                                                         FP_NUM_BYTES));
 
                if (fpc_virtaddr == NULL) {
-                       dev_dbg(dev,
+                       dev_dbg(ccdc_cfg.dev,
                                "\nUnable to allocate memory for FPC");
                        return -EFAULT;
                }
@@ -279,7 +285,7 @@ static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
        if (copy_from_user(fpc_virtaddr,
                        (void __user *)raw_params->fault_pxl.fpc_table_addr,
                        config_params->fault_pxl.fp_num * FP_NUM_BYTES)) {
-               dev_dbg(dev, "\n copy_from_user failed");
+               dev_dbg(ccdc_cfg.dev, "\n copy_from_user failed");
                return -EFAULT;
        }
        config_params->fault_pxl.fpc_table_addr = (unsigned int)fpc_physaddr;
@@ -289,7 +295,7 @@ static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
 static int ccdc_close(struct device *dev)
 {
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                               &ccdc_cfg.bayer.config_params;
        unsigned int *fpc_physaddr = NULL, *fpc_virtaddr = NULL;
 
        fpc_physaddr = (unsigned int *)config_params->fault_pxl.fpc_table_addr;
@@ -323,9 +329,8 @@ static void ccdc_restore_defaults(void)
 
 static int ccdc_open(struct device *device)
 {
-       dev = device;
        ccdc_restore_defaults();
-       if (ccdc_if_type == VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
                ccdc_enable_vport(1);
        return 0;
 }
@@ -341,12 +346,12 @@ static int ccdc_set_params(void __user *params)
        struct ccdc_config_params_raw ccdc_raw_params;
        int x;
 
-       if (ccdc_if_type != VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type != VPFE_RAW_BAYER)
                return -EINVAL;
 
        x = copy_from_user(&ccdc_raw_params, params, sizeof(ccdc_raw_params));
        if (x) {
-               dev_dbg(dev, "ccdc_set_params: error in copying"
+               dev_dbg(ccdc_cfg.dev, "ccdc_set_params: error in copying"
                           "ccdc params, %d\n", x);
                return -EFAULT;
        }
@@ -364,10 +369,10 @@ static int ccdc_set_params(void __user *params)
  */
 void ccdc_config_ycbcr(void)
 {
-       struct ccdc_params_ycbcr *params = &ccdc_hw_params_ycbcr;
+       struct ccdc_params_ycbcr *params = &ccdc_cfg.ycbcr;
        u32 syn_mode;
 
-       dev_dbg(dev, "\nStarting ccdc_config_ycbcr...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_config_ycbcr...");
        /*
         * first restore the CCDC registers to default values
         * This is important since we assume default values to be set in
@@ -428,7 +433,7 @@ void ccdc_config_ycbcr(void)
                regw(CCDC_SDOFST_FIELD_INTERLEAVED, CCDC_SDOFST);
 
        ccdc_sbl_reset();
-       dev_dbg(dev, "\nEnd of ccdc_config_ycbcr...\n");
+       dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_config_ycbcr...\n");
        ccdc_readregs();
 }
 
@@ -440,9 +445,9 @@ static void ccdc_config_black_clamp(struct ccdc_black_clamp *bclamp)
                /* configure DCSub */
                val = (bclamp->dc_sub) & CCDC_BLK_DC_SUB_MASK;
                regw(val, CCDC_DCSUB);
-               dev_dbg(dev, "\nWriting 0x%x to DCSUB...\n", val);
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to DCSUB...\n", val);
                regw(CCDC_CLAMP_DEFAULT_VAL, CCDC_CLAMP);
-               dev_dbg(dev, "\nWriting 0x0000 to CLAMP...\n");
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x0000 to CLAMP...\n");
                return;
        }
        /*
@@ -457,10 +462,10 @@ static void ccdc_config_black_clamp(struct ccdc_black_clamp *bclamp)
               ((bclamp->sample_pixel & CCDC_BLK_SAMPLE_LN_MASK) <<
                CCDC_BLK_SAMPLE_LN_SHIFT) | CCDC_BLK_CLAMP_ENABLE);
        regw(val, CCDC_CLAMP);
-       dev_dbg(dev, "\nWriting 0x%x to CLAMP...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to CLAMP...\n", val);
        /* If Black clamping is enable then make dcsub 0 */
        regw(CCDC_DCSUB_DEFAULT_VAL, CCDC_DCSUB);
-       dev_dbg(dev, "\nWriting 0x00000000 to DCSUB...\n");
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x00000000 to DCSUB...\n");
 }
 
 static void ccdc_config_black_compense(struct ccdc_black_compensation *bcomp)
@@ -490,17 +495,17 @@ static void ccdc_config_fpc(struct ccdc_fault_pixel *fpc)
 
        /* Configure Fault pixel if needed */
        regw(fpc->fpc_table_addr, CCDC_FPC_ADDR);
-       dev_dbg(dev, "\nWriting 0x%x to FPC_ADDR...\n",
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FPC_ADDR...\n",
                       (fpc->fpc_table_addr));
        /* Write the FPC params with FPC disable */
        val = fpc->fp_num & CCDC_FPC_FPC_NUM_MASK;
        regw(val, CCDC_FPC);
 
-       dev_dbg(dev, "\nWriting 0x%x to FPC...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FPC...\n", val);
        /* read the FPC register */
        val = regr(CCDC_FPC) | CCDC_FPC_ENABLE;
        regw(val, CCDC_FPC);
-       dev_dbg(dev, "\nWriting 0x%x to FPC...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FPC...\n", val);
 }
 
 /*
@@ -509,13 +514,13 @@ static void ccdc_config_fpc(struct ccdc_fault_pixel *fpc)
  */
 void ccdc_config_raw(void)
 {
-       struct ccdc_params_raw *params = &ccdc_hw_params_raw;
+       struct ccdc_params_raw *params = &ccdc_cfg.bayer;
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                               &ccdc_cfg.bayer.config_params;
        unsigned int syn_mode = 0;
        unsigned int val;
 
-       dev_dbg(dev, "\nStarting ccdc_config_raw...");
+       dev_dbg(ccdc_cfg.dev, "\nStarting ccdc_config_raw...");
 
        /*      Reset CCDC */
        ccdc_restore_defaults();
@@ -545,7 +550,7 @@ void ccdc_config_raw(void)
                val = ((config_params->alaw.gama_wd &
                      CCDC_ALAW_GAMA_WD_MASK) | CCDC_ALAW_ENABLE);
                regw(val, CCDC_ALAW);
-               dev_dbg(dev, "\nWriting 0x%x to ALAW...\n", val);
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to ALAW...\n", val);
        }
 
        /* Configure video window */
@@ -582,11 +587,11 @@ void ccdc_config_raw(void)
        /* Write value in FMTCFG */
        regw(val, CCDC_FMTCFG);
 
-       dev_dbg(dev, "\nWriting 0x%x to FMTCFG...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FMTCFG...\n", val);
        /* Configure the color pattern according to mt9t001 sensor */
        regw(CCDC_COLPTN_VAL, CCDC_COLPTN);
 
-       dev_dbg(dev, "\nWriting 0xBB11BB11 to COLPTN...\n");
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0xBB11BB11 to COLPTN...\n");
        /*
         * Configure Data formatter(Video port) pixel selection
         * (FMT_HORZ, FMT_VERT)
@@ -596,7 +601,7 @@ void ccdc_config_raw(void)
              (params->win.width & CCDC_FMT_HORZ_FMTLNH_MASK);
        regw(val, CCDC_FMT_HORZ);
 
-       dev_dbg(dev, "\nWriting 0x%x to FMT_HORZ...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FMT_HORZ...\n", val);
        val = (params->win.top & CCDC_FMT_VERT_FMTSLV_MASK)
            << CCDC_FMT_VERT_FMTSLV_SHIFT;
        if (params->frm_fmt == CCDC_FRMFMT_PROGRESSIVE)
@@ -604,13 +609,13 @@ void ccdc_config_raw(void)
        else
                val |= (params->win.height >> 1) & CCDC_FMT_VERT_FMTLNV_MASK;
 
-       dev_dbg(dev, "\nparams->win.height  0x%x ...\n",
+       dev_dbg(ccdc_cfg.dev, "\nparams->win.height  0x%x ...\n",
               params->win.height);
        regw(val, CCDC_FMT_VERT);
 
-       dev_dbg(dev, "\nWriting 0x%x to FMT_VERT...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FMT_VERT...\n", val);
 
-       dev_dbg(dev, "\nbelow regw(val, FMT_VERT)...");
+       dev_dbg(ccdc_cfg.dev, "\nbelow regw(val, FMT_VERT)...");
 
        /*
         * Configure Horizontal offset register. If pack 8 is enabled then
@@ -631,17 +636,17 @@ void ccdc_config_raw(void)
                if (params->image_invert_enable) {
                        /* For intelace inverse mode */
                        regw(CCDC_INTERLACED_IMAGE_INVERT, CCDC_SDOFST);
-                       dev_dbg(dev, "\nWriting 0x4B6D to SDOFST...\n");
+                       dev_dbg(ccdc_cfg.dev, "\nWriting 0x4B6D to SDOFST..\n");
                }
 
                else {
                        /* For intelace non inverse mode */
                        regw(CCDC_INTERLACED_NO_IMAGE_INVERT, CCDC_SDOFST);
-                       dev_dbg(dev, "\nWriting 0x0249 to SDOFST...\n");
+                       dev_dbg(ccdc_cfg.dev, "\nWriting 0x0249 to SDOFST..\n");
                }
        } else if (params->frm_fmt == CCDC_FRMFMT_PROGRESSIVE) {
                regw(CCDC_PROGRESSIVE_NO_IMAGE_INVERT, CCDC_SDOFST);
-               dev_dbg(dev, "\nWriting 0x0000 to SDOFST...\n");
+               dev_dbg(ccdc_cfg.dev, "\nWriting 0x0000 to SDOFST...\n");
        }
 
        /*
@@ -662,18 +667,18 @@ void ccdc_config_raw(void)
        val |= (params->win.left) & CCDC_VP_OUT_HORZ_ST_MASK;
        regw(val, CCDC_VP_OUT);
 
-       dev_dbg(dev, "\nWriting 0x%x to VP_OUT...\n", val);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to VP_OUT...\n", val);
        regw(syn_mode, CCDC_SYN_MODE);
-       dev_dbg(dev, "\nWriting 0x%x to SYN_MODE...\n", syn_mode);
+       dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to SYN_MODE...\n", syn_mode);
 
        ccdc_sbl_reset();
-       dev_dbg(dev, "\nend of ccdc_config_raw...");
+       dev_dbg(ccdc_cfg.dev, "\nend of ccdc_config_raw...");
        ccdc_readregs();
 }
 
 static int ccdc_configure(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
                ccdc_config_raw();
        else
                ccdc_config_ycbcr();
@@ -682,24 +687,24 @@ static int ccdc_configure(void)
 
 static int ccdc_set_buftype(enum ccdc_buftype buf_type)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.buf_type = buf_type;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.buf_type = buf_type;
        else
-               ccdc_hw_params_ycbcr.buf_type = buf_type;
+               ccdc_cfg.ycbcr.buf_type = buf_type;
        return 0;
 }
 
 static enum ccdc_buftype ccdc_get_buftype(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               return ccdc_hw_params_raw.buf_type;
-       return ccdc_hw_params_ycbcr.buf_type;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               return ccdc_cfg.bayer.buf_type;
+       return ccdc_cfg.ycbcr.buf_type;
 }
 
 static int ccdc_enum_pix(u32 *pix, int i)
 {
        int ret = -EINVAL;
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
                if (i < ARRAY_SIZE(ccdc_raw_bayer_pix_formats)) {
                        *pix = ccdc_raw_bayer_pix_formats[i];
                        ret = 0;
@@ -715,17 +720,17 @@ static int ccdc_enum_pix(u32 *pix, int i)
 
 static int ccdc_set_pixel_format(u32 pixfmt)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
-               ccdc_hw_params_raw.pix_fmt = CCDC_PIXFMT_RAW;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
+               ccdc_cfg.bayer.pix_fmt = CCDC_PIXFMT_RAW;
                if (pixfmt == V4L2_PIX_FMT_SBGGR8)
-                       ccdc_hw_params_raw.config_params.alaw.enable = 1;
+                       ccdc_cfg.bayer.config_params.alaw.enable = 1;
                else if (pixfmt != V4L2_PIX_FMT_SBGGR16)
                        return -EINVAL;
        } else {
                if (pixfmt == V4L2_PIX_FMT_YUYV)
-                       ccdc_hw_params_ycbcr.pix_order = CCDC_PIXORDER_YCBYCR;
+                       ccdc_cfg.ycbcr.pix_order = CCDC_PIXORDER_YCBYCR;
                else if (pixfmt == V4L2_PIX_FMT_UYVY)
-                       ccdc_hw_params_ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
+                       ccdc_cfg.ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
                else
                        return -EINVAL;
        }
@@ -734,17 +739,16 @@ static int ccdc_set_pixel_format(u32 pixfmt)
 
 static u32 ccdc_get_pixel_format(void)
 {
-       struct ccdc_a_law *alaw =
-               &ccdc_hw_params_raw.config_params.alaw;
+       struct ccdc_a_law *alaw = &ccdc_cfg.bayer.config_params.alaw;
        u32 pixfmt;
 
-       if (ccdc_if_type == VPFE_RAW_BAYER)
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
                if (alaw->enable)
                        pixfmt = V4L2_PIX_FMT_SBGGR8;
                else
                        pixfmt = V4L2_PIX_FMT_SBGGR16;
        else {
-               if (ccdc_hw_params_ycbcr.pix_order == CCDC_PIXORDER_YCBYCR)
+               if (ccdc_cfg.ycbcr.pix_order == CCDC_PIXORDER_YCBYCR)
                        pixfmt = V4L2_PIX_FMT_YUYV;
                else
                        pixfmt = V4L2_PIX_FMT_UYVY;
@@ -754,53 +758,53 @@ static u32 ccdc_get_pixel_format(void)
 
 static int ccdc_set_image_window(struct v4l2_rect *win)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.win = *win;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.win = *win;
        else
-               ccdc_hw_params_ycbcr.win = *win;
+               ccdc_cfg.ycbcr.win = *win;
        return 0;
 }
 
 static void ccdc_get_image_window(struct v4l2_rect *win)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               *win = ccdc_hw_params_raw.win;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               *win = ccdc_cfg.bayer.win;
        else
-               *win = ccdc_hw_params_ycbcr.win;
+               *win = ccdc_cfg.ycbcr.win;
 }
 
 static unsigned int ccdc_get_line_length(void)
 {
        struct ccdc_config_params_raw *config_params =
-               &ccdc_hw_params_raw.config_params;
+                               &ccdc_cfg.bayer.config_params;
        unsigned int len;
 
-       if (ccdc_if_type == VPFE_RAW_BAYER) {
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER) {
                if ((config_params->alaw.enable) ||
                    (config_params->data_sz == CCDC_DATA_8BITS))
-                       len = ccdc_hw_params_raw.win.width;
+                       len = ccdc_cfg.bayer.win.width;
                else
-                       len = ccdc_hw_params_raw.win.width * 2;
+                       len = ccdc_cfg.bayer.win.width * 2;
        } else
-               len = ccdc_hw_params_ycbcr.win.width * 2;
+               len = ccdc_cfg.ycbcr.win.width * 2;
        return ALIGN(len, 32);
 }
 
 static int ccdc_set_frame_format(enum ccdc_frmfmt frm_fmt)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               ccdc_hw_params_raw.frm_fmt = frm_fmt;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               ccdc_cfg.bayer.frm_fmt = frm_fmt;
        else
-               ccdc_hw_params_ycbcr.frm_fmt = frm_fmt;
+               ccdc_cfg.ycbcr.frm_fmt = frm_fmt;
        return 0;
 }
 
 static enum ccdc_frmfmt ccdc_get_frame_format(void)
 {
-       if (ccdc_if_type == VPFE_RAW_BAYER)
-               return ccdc_hw_params_raw.frm_fmt;
+       if (ccdc_cfg.if_type == VPFE_RAW_BAYER)
+               return ccdc_cfg.bayer.frm_fmt;
        else
-               return ccdc_hw_params_ycbcr.frm_fmt;
+               return ccdc_cfg.ycbcr.frm_fmt;
 }
 
 static int ccdc_getfid(void)
@@ -816,14 +820,14 @@ static inline void ccdc_setfbaddr(unsigned long addr)
 
 static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params)
 {
-       ccdc_if_type = params->if_type;
+       ccdc_cfg.if_type = params->if_type;
 
        switch (params->if_type) {
        case VPFE_BT656:
        case VPFE_YCBCR_SYNC_16:
        case VPFE_YCBCR_SYNC_8:
-               ccdc_hw_params_ycbcr.vd_pol = params->vdpol;
-               ccdc_hw_params_ycbcr.hd_pol = params->hdpol;
+               ccdc_cfg.ycbcr.vd_pol = params->vdpol;
+               ccdc_cfg.ycbcr.hd_pol = params->hdpol;
                break;
        default:
                /* TODO add support for raw bayer here */
@@ -838,7 +842,6 @@ static struct ccdc_hw_device ccdc_hw_dev = {
        .hw_ops = {
                .open = ccdc_open,
                .close = ccdc_close,
-               .set_ccdc_base = ccdc_set_ccdc_base,
                .reset = ccdc_sbl_reset,
                .enable = ccdc_enable,
                .set_hw_if_params = ccdc_set_hw_if_params,
@@ -859,19 +862,105 @@ static struct ccdc_hw_device ccdc_hw_dev = {
        },
 };
 
-static int __init dm644x_ccdc_init(void)
+static int __init dm644x_ccdc_probe(struct platform_device *pdev)
 {
-       printk(KERN_NOTICE "dm644x_ccdc_init\n");
-       if (vpfe_register_ccdc_device(&ccdc_hw_dev) < 0)
-               return -1;
-       printk(KERN_NOTICE "%s is registered with vpfe.\n",
-               ccdc_hw_dev.name);
+       struct resource *res;
+       int status = 0;
+
+       /*
+        * first try to register with vpfe. If not correct platform, then we
+        * don't have to iomap
+        */
+       status = vpfe_register_ccdc_device(&ccdc_hw_dev);
+       if (status < 0)
+               return status;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res) {
+               status = -ENODEV;
+               goto fail_nores;
+       }
+
+       res = request_mem_region(res->start, resource_size(res), res->name);
+       if (!res) {
+               status = -EBUSY;
+               goto fail_nores;
+       }
+
+       ccdc_cfg.base_addr = ioremap_nocache(res->start, resource_size(res));
+       if (!ccdc_cfg.base_addr) {
+               status = -ENOMEM;
+               goto fail_nomem;
+       }
+
+       /* Get and enable Master clock */
+       ccdc_cfg.mclk = clk_get(&pdev->dev, "master");
+       if (IS_ERR(ccdc_cfg.mclk)) {
+               status = PTR_ERR(ccdc_cfg.mclk);
+               goto fail_nomap;
+       }
+       if (clk_enable(ccdc_cfg.mclk)) {
+               status = -ENODEV;
+               goto fail_mclk;
+       }
+
+       /* Get and enable Slave clock */
+       ccdc_cfg.sclk = clk_get(&pdev->dev, "slave");
+       if (IS_ERR(ccdc_cfg.sclk)) {
+               status = PTR_ERR(ccdc_cfg.sclk);
+               goto fail_mclk;
+       }
+       if (clk_enable(ccdc_cfg.sclk)) {
+               status = -ENODEV;
+               goto fail_sclk;
+       }
+       ccdc_cfg.dev = &pdev->dev;
+       printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name);
        return 0;
+fail_sclk:
+       clk_put(ccdc_cfg.sclk);
+fail_mclk:
+       clk_put(ccdc_cfg.mclk);
+fail_nomap:
+       iounmap(ccdc_cfg.base_addr);
+fail_nomem:
+       release_mem_region(res->start, resource_size(res));
+fail_nores:
+       vpfe_unregister_ccdc_device(&ccdc_hw_dev);
+       return status;
 }
 
-static void __exit dm644x_ccdc_exit(void)
+static int dm644x_ccdc_remove(struct platform_device *pdev)
 {
+       struct resource *res;
+
+       clk_put(ccdc_cfg.mclk);
+       clk_put(ccdc_cfg.sclk);
+       iounmap(ccdc_cfg.base_addr);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res)
+               release_mem_region(res->start, resource_size(res));
        vpfe_unregister_ccdc_device(&ccdc_hw_dev);
+       return 0;
+}
+
+static struct platform_driver dm644x_ccdc_driver = {
+       .driver = {
+               .name   = "dm644x_ccdc",
+               .owner = THIS_MODULE,
+       },
+       .remove = __devexit_p(dm644x_ccdc_remove),
+       .probe = dm644x_ccdc_probe,
+};
+
+static int __init dm644x_ccdc_init(void)
+{
+       return platform_driver_register(&dm644x_ccdc_driver);
+}
+
+static void __exit dm644x_ccdc_exit(void)
+{
+       platform_driver_unregister(&dm644x_ccdc_driver);
 }
 
 module_init(dm644x_ccdc_init);
diff --git a/drivers/media/video/davinci/isif.c b/drivers/media/video/davinci/isif.c
new file mode 100644 (file)
index 0000000..29c29c6
--- /dev/null
@@ -0,0 +1,1172 @@
+/*
+ * Copyright (C) 2008-2009 Texas Instruments Inc
+ *
+ * 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
+ *
+ * Image Sensor Interface (ISIF) driver
+ *
+ * This driver is for configuring the ISIF IP available on DM365 or any other
+ * TI SoCs. This is used for capturing yuv or bayer video or image data
+ * from a decoder or sensor. This IP is similar to the CCDC IP on DM355
+ * and DM6446, but with enhanced or additional ip blocks. The driver
+ * configures the ISIF upon commands from the vpfe bridge driver through
+ * ccdc_hw_device interface.
+ *
+ * TODO: 1) Raw bayer parameter settings and bayer capture
+ *      2) Add support for control ioctl
+ */
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+#include <linux/videodev2.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+#include <mach/mux.h>
+
+#include <media/davinci/isif.h>
+#include <media/davinci/vpss.h>
+
+#include "isif_regs.h"
+#include "ccdc_hw_device.h"
+
+/* Defaults for module configuration parameters */
+static struct isif_config_params_raw isif_config_defaults = {
+       .linearize = {
+               .en = 0,
+               .corr_shft = ISIF_NO_SHIFT,
+               .scale_fact = {1, 0},
+       },
+       .df_csc = {
+               .df_or_csc = 0,
+               .csc = {
+                       .en = 0,
+               },
+       },
+       .dfc = {
+               .en = 0,
+       },
+       .bclamp = {
+               .en = 0,
+       },
+       .gain_offset = {
+               .gain = {
+                       .r_ye = {1, 0},
+                       .gr_cy = {1, 0},
+                       .gb_g = {1, 0},
+                       .b_mg = {1, 0},
+               },
+       },
+       .culling = {
+               .hcpat_odd = 0xff,
+               .hcpat_even = 0xff,
+               .vcpat = 0xff,
+       },
+       .compress = {
+               .alg = ISIF_ALAW,
+       },
+};
+
+/* ISIF operation configuration */
+static struct isif_oper_config {
+       struct device *dev;
+       enum vpfe_hw_if_type if_type;
+       struct isif_ycbcr_config ycbcr;
+       struct isif_params_raw bayer;
+       enum isif_data_pack data_pack;
+       /* Master clock */
+       struct clk *mclk;
+       /* ISIF base address */
+       void __iomem *base_addr;
+       /* ISIF Linear Table 0 */
+       void __iomem *linear_tbl0_addr;
+       /* ISIF Linear Table 1 */
+       void __iomem *linear_tbl1_addr;
+} isif_cfg = {
+       .ycbcr = {
+               .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
+               .frm_fmt = CCDC_FRMFMT_INTERLACED,
+               .win = ISIF_WIN_NTSC,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .pix_order = CCDC_PIXORDER_CBYCRY,
+               .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED,
+       },
+       .bayer = {
+               .pix_fmt = CCDC_PIXFMT_RAW,
+               .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
+               .win = ISIF_WIN_VGA,
+               .fid_pol = VPFE_PINPOL_POSITIVE,
+               .vd_pol = VPFE_PINPOL_POSITIVE,
+               .hd_pol = VPFE_PINPOL_POSITIVE,
+               .gain = {
+                       .r_ye = {1, 0},
+                       .gr_cy = {1, 0},
+                       .gb_g = {1, 0},
+                       .b_mg = {1, 0},
+               },
+               .cfa_pat = ISIF_CFA_PAT_MOSAIC,
+               .data_msb = ISIF_BIT_MSB_11,
+               .config_params = {
+                       .data_shift = ISIF_NO_SHIFT,
+                       .col_pat_field0 = {
+                               .olop = ISIF_GREEN_BLUE,
+                               .olep = ISIF_BLUE,
+                               .elop = ISIF_RED,
+                               .elep = ISIF_GREEN_RED,
+                       },
+                       .col_pat_field1 = {
+                               .olop = ISIF_GREEN_BLUE,
+                               .olep = ISIF_BLUE,
+                               .elop = ISIF_RED,
+                               .elep = ISIF_GREEN_RED,
+                       },
+                       .test_pat_gen = 0,
+               },
+       },
+       .data_pack = ISIF_DATA_PACK8,
+};
+
+/* Raw Bayer formats */
+static const u32 isif_raw_bayer_pix_formats[] = {
+       V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SBGGR16};
+
+/* Raw YUV formats */
+static const u32 isif_raw_yuv_pix_formats[] = {
+       V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV};
+
+/* register access routines */
+static inline u32 regr(u32 offset)
+{
+       return __raw_readl(isif_cfg.base_addr + offset);
+}
+
+static inline void regw(u32 val, u32 offset)
+{
+       __raw_writel(val, isif_cfg.base_addr + offset);
+}
+
+/* reg_modify() - read, modify and write register */
+static inline u32 reg_modify(u32 mask, u32 val, u32 offset)
+{
+       u32 new_val = (regr(offset) & ~mask) | (val & mask);
+
+       regw(new_val, offset);
+       return new_val;
+}
+
+static inline void regw_lin_tbl(u32 val, u32 offset, int i)
+{
+       if (!i)
+               __raw_writel(val, isif_cfg.linear_tbl0_addr + offset);
+       else
+               __raw_writel(val, isif_cfg.linear_tbl1_addr + offset);
+}
+
+static void isif_disable_all_modules(void)
+{
+       /* disable BC */
+       regw(0, CLAMPCFG);
+       /* disable vdfc */
+       regw(0, DFCCTL);
+       /* disable CSC */
+       regw(0, CSCCTL);
+       /* disable linearization */
+       regw(0, LINCFG0);
+       /* disable other modules here as they are supported */
+}
+
+static void isif_enable(int en)
+{
+       if (!en) {
+               /* Before disable isif, disable all ISIF modules */
+               isif_disable_all_modules();
+               /*
+                * wait for next VD. Assume lowest scan rate is 12 Hz. So
+                * 100 msec delay is good enough
+                */
+               msleep(100);
+       }
+       reg_modify(ISIF_SYNCEN_VDHDEN_MASK, en, SYNCEN);
+}
+
+static void isif_enable_output_to_sdram(int en)
+{
+       reg_modify(ISIF_SYNCEN_WEN_MASK, en << ISIF_SYNCEN_WEN_SHIFT, SYNCEN);
+}
+
+static void isif_config_culling(struct isif_cul *cul)
+{
+       u32 val;
+
+       /* Horizontal pattern */
+       val = (cul->hcpat_even << CULL_PAT_EVEN_LINE_SHIFT) | cul->hcpat_odd;
+       regw(val, CULH);
+
+       /* vertical pattern */
+       regw(cul->vcpat, CULV);
+
+       /* LPF */
+       reg_modify(ISIF_LPF_MASK << ISIF_LPF_SHIFT,
+                 cul->en_lpf << ISIF_LPF_SHIFT, MODESET);
+}
+
+static void isif_config_gain_offset(void)
+{
+       struct isif_gain_offsets_adj *gain_off_p =
+               &isif_cfg.bayer.config_params.gain_offset;
+       u32 val;
+
+       val = (!!gain_off_p->gain_sdram_en << GAIN_SDRAM_EN_SHIFT) |
+             (!!gain_off_p->gain_ipipe_en << GAIN_IPIPE_EN_SHIFT) |
+             (!!gain_off_p->gain_h3a_en << GAIN_H3A_EN_SHIFT) |
+             (!!gain_off_p->offset_sdram_en << OFST_SDRAM_EN_SHIFT) |
+             (!!gain_off_p->offset_ipipe_en << OFST_IPIPE_EN_SHIFT) |
+             (!!gain_off_p->offset_h3a_en << OFST_H3A_EN_SHIFT);
+
+       reg_modify(GAIN_OFFSET_EN_MASK, val, CGAMMAWD);
+
+       val = (gain_off_p->gain.r_ye.integer << GAIN_INTEGER_SHIFT) |
+              gain_off_p->gain.r_ye.decimal;
+       regw(val, CRGAIN);
+
+       val = (gain_off_p->gain.gr_cy.integer << GAIN_INTEGER_SHIFT) |
+              gain_off_p->gain.gr_cy.decimal;
+       regw(val, CGRGAIN);
+
+       val = (gain_off_p->gain.gb_g.integer << GAIN_INTEGER_SHIFT) |
+              gain_off_p->gain.gb_g.decimal;
+       regw(val, CGBGAIN);
+
+       val = (gain_off_p->gain.b_mg.integer << GAIN_INTEGER_SHIFT) |
+              gain_off_p->gain.b_mg.decimal;
+       regw(val, CBGAIN);
+
+       regw(gain_off_p->offset, COFSTA);
+}
+
+static void isif_restore_defaults(void)
+{
+       enum vpss_ccdc_source_sel source = VPSS_CCDCIN;
+
+       dev_dbg(isif_cfg.dev, "\nstarting isif_restore_defaults...");
+       isif_cfg.bayer.config_params = isif_config_defaults;
+       /* Enable clock to ISIF, IPIPEIF and BL */
+       vpss_enable_clock(VPSS_CCDC_CLOCK, 1);
+       vpss_enable_clock(VPSS_IPIPEIF_CLOCK, 1);
+       vpss_enable_clock(VPSS_BL_CLOCK, 1);
+       /* Set default offset and gain */
+       isif_config_gain_offset();
+       vpss_select_ccdc_source(source);
+       dev_dbg(isif_cfg.dev, "\nEnd of isif_restore_defaults...");
+}
+
+static int isif_open(struct device *device)
+{
+       isif_restore_defaults();
+       return 0;
+}
+
+/* This function will configure the window size to be capture in ISIF reg */
+static void isif_setwin(struct v4l2_rect *image_win,
+                       enum ccdc_frmfmt frm_fmt, int ppc)
+{
+       int horz_start, horz_nr_pixels;
+       int vert_start, vert_nr_lines;
+       int mid_img = 0;
+
+       dev_dbg(isif_cfg.dev, "\nStarting isif_setwin...");
+       /*
+        * ppc - per pixel count. indicates how many pixels per cell
+        * output to SDRAM. example, for ycbcr, it is one y and one c, so 2.
+        * raw capture this is 1
+        */
+       horz_start = image_win->left << (ppc - 1);
+       horz_nr_pixels = ((image_win->width) << (ppc - 1)) - 1;
+
+       /* Writing the horizontal info into the registers */
+       regw(horz_start & START_PX_HOR_MASK, SPH);
+       regw(horz_nr_pixels & NUM_PX_HOR_MASK, LNH);
+       vert_start = image_win->top;
+
+       if (frm_fmt == CCDC_FRMFMT_INTERLACED) {
+               vert_nr_lines = (image_win->height >> 1) - 1;
+               vert_start >>= 1;
+               /* To account for VD since line 0 doesn't have any data */
+               vert_start += 1;
+       } else {
+               /* To account for VD since line 0 doesn't have any data */
+               vert_start += 1;
+               vert_nr_lines = image_win->height - 1;
+               /* configure VDINT0 and VDINT1 */
+               mid_img = vert_start + (image_win->height / 2);
+               regw(mid_img, VDINT1);
+       }
+
+       regw(0, VDINT0);
+       regw(vert_start & START_VER_ONE_MASK, SLV0);
+       regw(vert_start & START_VER_TWO_MASK, SLV1);
+       regw(vert_nr_lines & NUM_LINES_VER, LNV);
+}
+
+static void isif_config_bclamp(struct isif_black_clamp *bc)
+{
+       u32 val;
+
+       /*
+        * DC Offset is always added to image data irrespective of bc enable
+        * status
+        */
+       regw(bc->dc_offset, CLDCOFST);
+
+       if (bc->en) {
+               val = bc->bc_mode_color << ISIF_BC_MODE_COLOR_SHIFT;
+
+               /* Enable BC and horizontal clamp caculation paramaters */
+               val = val | 1 | (bc->horz.mode << ISIF_HORZ_BC_MODE_SHIFT);
+
+               regw(val, CLAMPCFG);
+
+               if (bc->horz.mode != ISIF_HORZ_BC_DISABLE) {
+                       /*
+                        * Window count for calculation
+                        * Base window selection
+                        * pixel limit
+                        * Horizontal size of window
+                        * vertical size of the window
+                        * Horizontal start position of the window
+                        * Vertical start position of the window
+                        */
+                       val = bc->horz.win_count_calc |
+                             ((!!bc->horz.base_win_sel_calc) <<
+                               ISIF_HORZ_BC_WIN_SEL_SHIFT) |
+                             ((!!bc->horz.clamp_pix_limit) <<
+                               ISIF_HORZ_BC_PIX_LIMIT_SHIFT) |
+                             (bc->horz.win_h_sz_calc <<
+                               ISIF_HORZ_BC_WIN_H_SIZE_SHIFT) |
+                             (bc->horz.win_v_sz_calc <<
+                               ISIF_HORZ_BC_WIN_V_SIZE_SHIFT);
+                       regw(val, CLHWIN0);
+
+                       regw(bc->horz.win_start_h_calc, CLHWIN1);
+                       regw(bc->horz.win_start_v_calc, CLHWIN2);
+               }
+
+               /* vertical clamp caculation paramaters */
+
+               /* Reset clamp value sel for previous line */
+               val |=
+               (bc->vert.reset_val_sel << ISIF_VERT_BC_RST_VAL_SEL_SHIFT) |
+               (bc->vert.line_ave_coef << ISIF_VERT_BC_LINE_AVE_COEF_SHIFT);
+               regw(val, CLVWIN0);
+
+               /* Optical Black horizontal start position */
+               regw(bc->vert.ob_start_h, CLVWIN1);
+               /* Optical Black vertical start position */
+               regw(bc->vert.ob_start_v, CLVWIN2);
+               /* Optical Black vertical size for calculation */
+               regw(bc->vert.ob_v_sz_calc, CLVWIN3);
+               /* Vertical start position for BC subtraction */
+               regw(bc->vert_start_sub, CLSV);
+       }
+}
+
+static void isif_config_linearization(struct isif_linearize *linearize)
+{
+       u32 val, i;
+
+       if (!linearize->en) {
+               regw(0, LINCFG0);
+               return;
+       }
+
+       /* shift value for correction & enable linearization (set lsb) */
+       val = (linearize->corr_shft << ISIF_LIN_CORRSFT_SHIFT) | 1;
+       regw(val, LINCFG0);
+
+       /* Scale factor */
+       val = ((!!linearize->scale_fact.integer) <<
+              ISIF_LIN_SCALE_FACT_INTEG_SHIFT) |
+              linearize->scale_fact.decimal;
+       regw(val, LINCFG1);
+
+       for (i = 0; i < ISIF_LINEAR_TAB_SIZE; i++) {
+               if (i % 2)
+                       regw_lin_tbl(linearize->table[i], ((i >> 1) << 2), 1);
+               else
+                       regw_lin_tbl(linearize->table[i], ((i >> 1) << 2), 0);
+       }
+}
+
+static int isif_config_dfc(struct isif_dfc *vdfc)
+{
+       /* initialize retries to loop for max ~ 250 usec */
+       u32 val, count, retries = loops_per_jiffy / (4000/HZ);
+       int i;
+
+       if (!vdfc->en)
+               return 0;
+
+       /* Correction mode */
+       val = (vdfc->corr_mode << ISIF_VDFC_CORR_MOD_SHIFT);
+
+       /* Correct whole line or partial */
+       if (vdfc->corr_whole_line)
+               val |= 1 << ISIF_VDFC_CORR_WHOLE_LN_SHIFT;
+
+       /* level shift value */
+       val |= vdfc->def_level_shift << ISIF_VDFC_LEVEL_SHFT_SHIFT;
+
+       regw(val, DFCCTL);
+
+       /* Defect saturation level */
+       regw(vdfc->def_sat_level, VDFSATLV);
+
+       regw(vdfc->table[0].pos_vert, DFCMEM0);
+       regw(vdfc->table[0].pos_horz, DFCMEM1);
+       if (vdfc->corr_mode == ISIF_VDFC_NORMAL ||
+           vdfc->corr_mode == ISIF_VDFC_HORZ_INTERPOL_IF_SAT) {
+               regw(vdfc->table[0].level_at_pos, DFCMEM2);
+               regw(vdfc->table[0].level_up_pixels, DFCMEM3);
+               regw(vdfc->table[0].level_low_pixels, DFCMEM4);
+       }
+
+       /* set DFCMARST and set DFCMWR */
+       val = regr(DFCMEMCTL) | (1 << ISIF_DFCMEMCTL_DFCMARST_SHIFT) | 1;
+       regw(val, DFCMEMCTL);
+
+       count = retries;
+       while (count && (regr(DFCMEMCTL) & 0x1))
+               count--;
+
+       if (!count) {
+               dev_dbg(isif_cfg.dev, "defect table write timeout !!!\n");
+               return -1;
+       }
+
+       for (i = 1; i < vdfc->num_vdefects; i++) {
+               regw(vdfc->table[i].pos_vert, DFCMEM0);
+               regw(vdfc->table[i].pos_horz, DFCMEM1);
+               if (vdfc->corr_mode == ISIF_VDFC_NORMAL ||
+                   vdfc->corr_mode == ISIF_VDFC_HORZ_INTERPOL_IF_SAT) {
+                       regw(vdfc->table[i].level_at_pos, DFCMEM2);
+                       regw(vdfc->table[i].level_up_pixels, DFCMEM3);
+                       regw(vdfc->table[i].level_low_pixels, DFCMEM4);
+               }
+               val = regr(DFCMEMCTL);
+               /* clear DFCMARST and set DFCMWR */
+               val &= ~BIT(ISIF_DFCMEMCTL_DFCMARST_SHIFT);
+               val |= 1;
+               regw(val, DFCMEMCTL);
+
+               count = retries;
+               while (count && (regr(DFCMEMCTL) & 0x1))
+                       count--;
+
+               if (!count) {
+                       dev_err(isif_cfg.dev,
+                               "defect table write timeout !!!\n");
+                       return -1;
+               }
+       }
+       if (vdfc->num_vdefects < ISIF_VDFC_TABLE_SIZE) {
+               /* Extra cycle needed */
+               regw(0, DFCMEM0);
+               regw(0x1FFF, DFCMEM1);
+               regw(1, DFCMEMCTL);
+       }
+
+       /* enable VDFC */
+       reg_modify((1 << ISIF_VDFC_EN_SHIFT), (1 << ISIF_VDFC_EN_SHIFT),
+                  DFCCTL);
+       return 0;
+}
+
+static void isif_config_csc(struct isif_df_csc *df_csc)
+{
+       u32 val1 = 0, val2 = 0, i;
+
+       if (!df_csc->csc.en) {
+               regw(0, CSCCTL);
+               return;
+       }
+       for (i = 0; i < ISIF_CSC_NUM_COEFF; i++) {
+               if ((i % 2) == 0) {
+                       /* CSCM - LSB */
+                       val1 = (df_csc->csc.coeff[i].integer <<
+                               ISIF_CSC_COEF_INTEG_SHIFT) |
+                               df_csc->csc.coeff[i].decimal;
+               } else {
+
+                       /* CSCM - MSB */
+                       val2 = (df_csc->csc.coeff[i].integer <<
+                               ISIF_CSC_COEF_INTEG_SHIFT) |
+                               df_csc->csc.coeff[i].decimal;
+                       val2 <<= ISIF_CSCM_MSB_SHIFT;
+                       val2 |= val1;
+                       regw(val2, (CSCM0 + ((i - 1) << 1)));
+               }
+       }
+
+       /* program the active area */
+       regw(df_csc->start_pix, FMTSPH);
+       /*
+        * one extra pixel as required for CSC. Actually number of
+        * pixel - 1 should be configured in this register. So we
+        * need to subtract 1 before writing to FMTSPH, but we will
+        * not do this since csc requires one extra pixel
+        */
+       regw(df_csc->num_pixels, FMTLNH);
+       regw(df_csc->start_line, FMTSLV);
+       /*
+        * one extra line as required for CSC. See reason documented for
+        * num_pixels
+        */
+       regw(df_csc->num_lines, FMTLNV);
+
+       /* Enable CSC */
+       regw(1, CSCCTL);
+}
+
+static int isif_config_raw(void)
+{
+       struct isif_params_raw *params = &isif_cfg.bayer;
+       struct isif_config_params_raw *module_params =
+               &isif_cfg.bayer.config_params;
+       struct vpss_pg_frame_size frame_size;
+       struct vpss_sync_pol sync;
+       u32 val;
+
+       dev_dbg(isif_cfg.dev, "\nStarting isif_config_raw..\n");
+
+       /*
+        * Configure CCDCFG register:-
+        * Set CCD Not to swap input since input is RAW data
+        * Set FID detection function to Latch at V-Sync
+        * Set WENLOG - isif valid area
+        * Set TRGSEL
+        * Set EXTRG
+        * Packed to 8 or 16 bits
+        */
+
+       val = ISIF_YCINSWP_RAW | ISIF_CCDCFG_FIDMD_LATCH_VSYNC |
+               ISIF_CCDCFG_WENLOG_AND | ISIF_CCDCFG_TRGSEL_WEN |
+               ISIF_CCDCFG_EXTRG_DISABLE | isif_cfg.data_pack;
+
+       dev_dbg(isif_cfg.dev, "Writing 0x%x to ...CCDCFG \n", val);
+       regw(val, CCDCFG);
+
+       /*
+        * Configure the vertical sync polarity(MODESET.VDPOL)
+        * Configure the horizontal sync polarity (MODESET.HDPOL)
+        * Configure frame id polarity (MODESET.FLDPOL)
+        * Configure data polarity
+        * Configure External WEN Selection
+        * Configure frame format(progressive or interlace)
+        * Configure pixel format (Input mode)
+        * Configure the data shift
+        */
+
+       val = ISIF_VDHDOUT_INPUT | (params->vd_pol << ISIF_VD_POL_SHIFT) |
+               (params->hd_pol << ISIF_HD_POL_SHIFT) |
+               (params->fid_pol << ISIF_FID_POL_SHIFT) |
+               (ISIF_DATAPOL_NORMAL << ISIF_DATAPOL_SHIFT) |
+               (ISIF_EXWEN_DISABLE << ISIF_EXWEN_SHIFT) |
+               (params->frm_fmt << ISIF_FRM_FMT_SHIFT) |
+               (params->pix_fmt << ISIF_INPUT_SHIFT) |
+               (params->config_params.data_shift << ISIF_DATASFT_SHIFT);
+
+       regw(val, MODESET);
+       dev_dbg(isif_cfg.dev, "Writing 0x%x to MODESET...\n", val);
+
+       /*
+        * Configure GAMMAWD register
+        * CFA pattern setting
+        */
+       val = params->cfa_pat << ISIF_GAMMAWD_CFA_SHIFT;
+
+       /* Gamma msb */
+       if (module_params->compress.alg == ISIF_ALAW)
+               val |= ISIF_ALAW_ENABLE;
+
+       val |= (params->data_msb << ISIF_ALAW_GAMA_WD_SHIFT);
+       regw(val, CGAMMAWD);
+
+       /* Configure DPCM compression settings */
+       if (module_params->compress.alg == ISIF_DPCM) {
+               val =  BIT(ISIF_DPCM_EN_SHIFT) |
+                      (module_params->compress.pred <<
+                      ISIF_DPCM_PREDICTOR_SHIFT);
+       }
+
+       regw(val, MISC);
+
+       /* Configure Gain & Offset */
+       isif_config_gain_offset();
+
+       /* Configure Color pattern */
+       val = (params->config_params.col_pat_field0.olop) |
+             (params->config_params.col_pat_field0.olep << 2) |
+             (params->config_params.col_pat_field0.elop << 4) |
+             (params->config_params.col_pat_field0.elep << 6) |
+             (params->config_params.col_pat_field1.olop << 8) |
+             (params->config_params.col_pat_field1.olep << 10) |
+             (params->config_params.col_pat_field1.elop << 12) |
+             (params->config_params.col_pat_field1.elep << 14);
+       regw(val, CCOLP);
+       dev_dbg(isif_cfg.dev, "Writing %x to CCOLP ...\n", val);
+
+       /* Configure HSIZE register  */
+       val = (!!params->horz_flip_en) << ISIF_HSIZE_FLIP_SHIFT;
+
+       /* calculate line offset in 32 bytes based on pack value */
+       if (isif_cfg.data_pack == ISIF_PACK_8BIT)
+               val |= ((params->win.width + 31) >> 5);
+       else if (isif_cfg.data_pack == ISIF_PACK_12BIT)
+               val |= (((params->win.width +
+                      (params->win.width >> 2)) + 31) >> 5);
+       else
+               val |= (((params->win.width * 2) + 31) >> 5);
+       regw(val, HSIZE);
+
+       /* Configure SDOFST register  */
+       if (params->frm_fmt == CCDC_FRMFMT_INTERLACED) {
+               if (params->image_invert_en) {
+                       /* For interlace inverse mode */
+                       regw(0x4B6D, SDOFST);
+                       dev_dbg(isif_cfg.dev, "Writing 0x4B6D to SDOFST...\n");
+               } else {
+                       /* For interlace non inverse mode */
+                       regw(0x0B6D, SDOFST);
+                       dev_dbg(isif_cfg.dev, "Writing 0x0B6D to SDOFST...\n");
+               }
+       } else if (params->frm_fmt == CCDC_FRMFMT_PROGRESSIVE) {
+               if (params->image_invert_en) {
+                       /* For progressive inverse mode */
+                       regw(0x4000, SDOFST);
+                       dev_dbg(isif_cfg.dev, "Writing 0x4000 to SDOFST...\n");
+               } else {
+                       /* For progressive non inverse mode */
+                       regw(0x0000, SDOFST);
+                       dev_dbg(isif_cfg.dev, "Writing 0x0000 to SDOFST...\n");
+               }
+       }
+
+       /* Configure video window */
+       isif_setwin(&params->win, params->frm_fmt, 1);
+
+       /* Configure Black Clamp */
+       isif_config_bclamp(&module_params->bclamp);
+
+       /* Configure Vertical Defection Pixel Correction */
+       if (isif_config_dfc(&module_params->dfc) < 0)
+               return -EFAULT;
+
+       if (!module_params->df_csc.df_or_csc)
+               /* Configure Color Space Conversion */
+               isif_config_csc(&module_params->df_csc);
+
+       isif_config_linearization(&module_params->linearize);
+
+       /* Configure Culling */
+       isif_config_culling(&module_params->culling);
+
+       /* Configure horizontal and vertical offsets(DFC,LSC,Gain) */
+       regw(module_params->horz_offset, DATAHOFST);
+       regw(module_params->vert_offset, DATAVOFST);
+
+       /* Setup test pattern if enabled */
+       if (params->config_params.test_pat_gen) {
+               /* Use the HD/VD pol settings from user */
+               sync.ccdpg_hdpol = params->hd_pol;
+               sync.ccdpg_vdpol = params->vd_pol;
+               dm365_vpss_set_sync_pol(sync);
+               frame_size.hlpfr = isif_cfg.bayer.win.width;
+               frame_size.pplen = isif_cfg.bayer.win.height;
+               dm365_vpss_set_pg_frame_size(frame_size);
+               vpss_select_ccdc_source(VPSS_PGLPBK);
+       }
+
+       dev_dbg(isif_cfg.dev, "\nEnd of isif_config_ycbcr...\n");
+       return 0;
+}
+
+static int isif_set_buftype(enum ccdc_buftype buf_type)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               isif_cfg.bayer.buf_type = buf_type;
+       else
+               isif_cfg.ycbcr.buf_type = buf_type;
+
+       return 0;
+
+}
+static enum ccdc_buftype isif_get_buftype(void)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               return isif_cfg.bayer.buf_type;
+
+       return isif_cfg.ycbcr.buf_type;
+}
+
+static int isif_enum_pix(u32 *pix, int i)
+{
+       int ret = -EINVAL;
+
+       if (isif_cfg.if_type == VPFE_RAW_BAYER) {
+               if (i < ARRAY_SIZE(isif_raw_bayer_pix_formats)) {
+                       *pix = isif_raw_bayer_pix_formats[i];
+                       ret = 0;
+               }
+       } else {
+               if (i < ARRAY_SIZE(isif_raw_yuv_pix_formats)) {
+                       *pix = isif_raw_yuv_pix_formats[i];
+                       ret = 0;
+               }
+       }
+
+       return ret;
+}
+
+static int isif_set_pixel_format(unsigned int pixfmt)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER) {
+               if (pixfmt == V4L2_PIX_FMT_SBGGR8) {
+                       if ((isif_cfg.bayer.config_params.compress.alg !=
+                            ISIF_ALAW) &&
+                           (isif_cfg.bayer.config_params.compress.alg !=
+                            ISIF_DPCM)) {
+                               dev_dbg(isif_cfg.dev,
+                                       "Either configure A-Law or DPCM\n");
+                               return -EINVAL;
+                       }
+                       isif_cfg.data_pack = ISIF_PACK_8BIT;
+               } else if (pixfmt == V4L2_PIX_FMT_SBGGR16) {
+                       isif_cfg.bayer.config_params.compress.alg =
+                                       ISIF_NO_COMPRESSION;
+                       isif_cfg.data_pack = ISIF_PACK_16BIT;
+               } else
+                       return -EINVAL;
+               isif_cfg.bayer.pix_fmt = CCDC_PIXFMT_RAW;
+       } else {
+               if (pixfmt == V4L2_PIX_FMT_YUYV)
+                       isif_cfg.ycbcr.pix_order = CCDC_PIXORDER_YCBYCR;
+               else if (pixfmt == V4L2_PIX_FMT_UYVY)
+                       isif_cfg.ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
+               else
+                       return -EINVAL;
+               isif_cfg.data_pack = ISIF_PACK_8BIT;
+       }
+       return 0;
+}
+
+static u32 isif_get_pixel_format(void)
+{
+       u32 pixfmt;
+
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               if (isif_cfg.bayer.config_params.compress.alg == ISIF_ALAW ||
+                   isif_cfg.bayer.config_params.compress.alg == ISIF_DPCM)
+                       pixfmt = V4L2_PIX_FMT_SBGGR8;
+               else
+                       pixfmt = V4L2_PIX_FMT_SBGGR16;
+       else {
+               if (isif_cfg.ycbcr.pix_order == CCDC_PIXORDER_YCBYCR)
+                       pixfmt = V4L2_PIX_FMT_YUYV;
+               else
+                       pixfmt = V4L2_PIX_FMT_UYVY;
+       }
+       return pixfmt;
+}
+
+static int isif_set_image_window(struct v4l2_rect *win)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER) {
+               isif_cfg.bayer.win.top = win->top;
+               isif_cfg.bayer.win.left = win->left;
+               isif_cfg.bayer.win.width = win->width;
+               isif_cfg.bayer.win.height = win->height;
+       } else {
+               isif_cfg.ycbcr.win.top = win->top;
+               isif_cfg.ycbcr.win.left = win->left;
+               isif_cfg.ycbcr.win.width = win->width;
+               isif_cfg.ycbcr.win.height = win->height;
+       }
+       return 0;
+}
+
+static void isif_get_image_window(struct v4l2_rect *win)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               *win = isif_cfg.bayer.win;
+       else
+               *win = isif_cfg.ycbcr.win;
+}
+
+static unsigned int isif_get_line_length(void)
+{
+       unsigned int len;
+
+       if (isif_cfg.if_type == VPFE_RAW_BAYER) {
+               if (isif_cfg.data_pack == ISIF_PACK_8BIT)
+                       len = ((isif_cfg.bayer.win.width));
+               else if (isif_cfg.data_pack == ISIF_PACK_12BIT)
+                       len = (((isif_cfg.bayer.win.width * 2) +
+                                (isif_cfg.bayer.win.width >> 2)));
+               else
+                       len = (((isif_cfg.bayer.win.width * 2)));
+       } else
+               len = (((isif_cfg.ycbcr.win.width * 2)));
+       return ALIGN(len, 32);
+}
+
+static int isif_set_frame_format(enum ccdc_frmfmt frm_fmt)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               isif_cfg.bayer.frm_fmt = frm_fmt;
+       else
+               isif_cfg.ycbcr.frm_fmt = frm_fmt;
+       return 0;
+}
+static enum ccdc_frmfmt isif_get_frame_format(void)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               return isif_cfg.bayer.frm_fmt;
+       return isif_cfg.ycbcr.frm_fmt;
+}
+
+static int isif_getfid(void)
+{
+       return (regr(MODESET) >> 15) & 0x1;
+}
+
+/* misc operations */
+static void isif_setfbaddr(unsigned long addr)
+{
+       regw((addr >> 21) & 0x07ff, CADU);
+       regw((addr >> 5) & 0x0ffff, CADL);
+}
+
+static int isif_set_hw_if_params(struct vpfe_hw_if_param *params)
+{
+       isif_cfg.if_type = params->if_type;
+
+       switch (params->if_type) {
+       case VPFE_BT656:
+       case VPFE_BT656_10BIT:
+       case VPFE_YCBCR_SYNC_8:
+               isif_cfg.ycbcr.pix_fmt = CCDC_PIXFMT_YCBCR_8BIT;
+               isif_cfg.ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
+               break;
+       case VPFE_BT1120:
+       case VPFE_YCBCR_SYNC_16:
+               isif_cfg.ycbcr.pix_fmt = CCDC_PIXFMT_YCBCR_16BIT;
+               isif_cfg.ycbcr.pix_order = CCDC_PIXORDER_CBYCRY;
+               break;
+       case VPFE_RAW_BAYER:
+               isif_cfg.bayer.pix_fmt = CCDC_PIXFMT_RAW;
+               break;
+       default:
+               dev_dbg(isif_cfg.dev, "Invalid interface type\n");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* This function will configure ISIF for YCbCr parameters. */
+static int isif_config_ycbcr(void)
+{
+       struct isif_ycbcr_config *params = &isif_cfg.ycbcr;
+       struct vpss_pg_frame_size frame_size;
+       u32 modeset = 0, ccdcfg = 0;
+       struct vpss_sync_pol sync;
+
+       dev_dbg(isif_cfg.dev, "\nStarting isif_config_ycbcr...");
+
+       /* configure pixel format or input mode */
+       modeset = modeset | (params->pix_fmt << ISIF_INPUT_SHIFT) |
+                 (params->frm_fmt << ISIF_FRM_FMT_SHIFT) |
+                 (params->fid_pol << ISIF_FID_POL_SHIFT) |
+                 (params->hd_pol << ISIF_HD_POL_SHIFT) |
+                 (params->vd_pol << ISIF_VD_POL_SHIFT);
+
+       /* pack the data to 8-bit ISIFCFG */
+       switch (isif_cfg.if_type) {
+       case VPFE_BT656:
+               if (params->pix_fmt != CCDC_PIXFMT_YCBCR_8BIT) {
+                       dev_dbg(isif_cfg.dev, "Invalid pix_fmt(input mode)\n");
+                       return -EINVAL;
+               }
+               modeset |= (VPFE_PINPOL_NEGATIVE << ISIF_VD_POL_SHIFT);
+               regw(3, REC656IF);
+               ccdcfg = ccdcfg | ISIF_DATA_PACK8 | ISIF_YCINSWP_YCBCR;
+               break;
+       case VPFE_BT656_10BIT:
+               if (params->pix_fmt != CCDC_PIXFMT_YCBCR_8BIT) {
+                       dev_dbg(isif_cfg.dev, "Invalid pix_fmt(input mode)\n");
+                       return -EINVAL;
+               }
+               /* setup BT.656, embedded sync  */
+               regw(3, REC656IF);
+               /* enable 10 bit mode in ccdcfg */
+               ccdcfg = ccdcfg | ISIF_DATA_PACK8 | ISIF_YCINSWP_YCBCR |
+                       ISIF_BW656_ENABLE;
+               break;
+       case VPFE_BT1120:
+               if (params->pix_fmt != CCDC_PIXFMT_YCBCR_16BIT) {
+                       dev_dbg(isif_cfg.dev, "Invalid pix_fmt(input mode)\n");
+                       return -EINVAL;
+               }
+               regw(3, REC656IF);
+               break;
+
+       case VPFE_YCBCR_SYNC_8:
+               ccdcfg |= ISIF_DATA_PACK8;
+               ccdcfg |= ISIF_YCINSWP_YCBCR;
+               if (params->pix_fmt != CCDC_PIXFMT_YCBCR_8BIT) {
+                       dev_dbg(isif_cfg.dev, "Invalid pix_fmt(input mode)\n");
+                       return -EINVAL;
+               }
+               break;
+       case VPFE_YCBCR_SYNC_16:
+               if (params->pix_fmt != CCDC_PIXFMT_YCBCR_16BIT) {
+                       dev_dbg(isif_cfg.dev, "Invalid pix_fmt(input mode)\n");
+                       return -EINVAL;
+               }
+               break;
+       default:
+               /* should never come here */
+               dev_dbg(isif_cfg.dev, "Invalid interface type\n");
+               return -EINVAL;
+       }
+
+       regw(modeset, MODESET);
+
+       /* Set up pix order */
+       ccdcfg |= params->pix_order << ISIF_PIX_ORDER_SHIFT;
+
+       regw(ccdcfg, CCDCFG);
+
+       /* configure video window */
+       if ((isif_cfg.if_type == VPFE_BT1120) ||
+           (isif_cfg.if_type == VPFE_YCBCR_SYNC_16))
+               isif_setwin(&params->win, params->frm_fmt, 1);
+       else
+               isif_setwin(&params->win, params->frm_fmt, 2);
+
+       /*
+        * configure the horizontal line offset
+        * this is done by rounding up width to a multiple of 16 pixels
+        * and multiply by two to account for y:cb:cr 4:2:2 data
+        */
+       regw(((((params->win.width * 2) + 31) & 0xffffffe0) >> 5), HSIZE);
+
+       /* configure the memory line offset */
+       if ((params->frm_fmt == CCDC_FRMFMT_INTERLACED) &&
+           (params->buf_type == CCDC_BUFTYPE_FLD_INTERLEAVED))
+               /* two fields are interleaved in memory */
+               regw(0x00000249, SDOFST);
+
+       /* Setup test pattern if enabled */
+       if (isif_cfg.bayer.config_params.test_pat_gen) {
+               sync.ccdpg_hdpol = params->hd_pol;
+               sync.ccdpg_vdpol = params->vd_pol;
+               dm365_vpss_set_sync_pol(sync);
+               dm365_vpss_set_pg_frame_size(frame_size);
+       }
+       return 0;
+}
+
+static int isif_configure(void)
+{
+       if (isif_cfg.if_type == VPFE_RAW_BAYER)
+               return isif_config_raw();
+       return isif_config_ycbcr();
+}
+
+static int isif_close(struct device *device)
+{
+       /* copy defaults to module params */
+       isif_cfg.bayer.config_params = isif_config_defaults;
+       return 0;
+}
+
+static struct ccdc_hw_device isif_hw_dev = {
+       .name = "ISIF",
+       .owner = THIS_MODULE,
+       .hw_ops = {
+               .open = isif_open,
+               .close = isif_close,
+               .enable = isif_enable,
+               .enable_out_to_sdram = isif_enable_output_to_sdram,
+               .set_hw_if_params = isif_set_hw_if_params,
+               .configure = isif_configure,
+               .set_buftype = isif_set_buftype,
+               .get_buftype = isif_get_buftype,
+               .enum_pix = isif_enum_pix,
+               .set_pixel_format = isif_set_pixel_format,
+               .get_pixel_format = isif_get_pixel_format,
+               .set_frame_format = isif_set_frame_format,
+               .get_frame_format = isif_get_frame_format,
+               .set_image_window = isif_set_image_window,
+               .get_image_window = isif_get_image_window,
+               .get_line_length = isif_get_line_length,
+               .setfbaddr = isif_setfbaddr,
+               .getfid = isif_getfid,
+       },
+};
+
+static int __init isif_probe(struct platform_device *pdev)
+{
+       void (*setup_pinmux)(void);
+       struct resource *res;
+       void *__iomem addr;
+       int status = 0, i;
+
+       /*
+        * first try to register with vpfe. If not correct platform, then we
+        * don't have to iomap
+        */
+       status = vpfe_register_ccdc_device(&isif_hw_dev);
+       if (status < 0)
+               return status;
+
+       /* Get and enable Master clock */
+       isif_cfg.mclk = clk_get(&pdev->dev, "master");
+       if (IS_ERR(isif_cfg.mclk)) {
+               status = PTR_ERR(isif_cfg.mclk);
+               goto fail_mclk;
+       }
+       if (clk_enable(isif_cfg.mclk)) {
+               status = -ENODEV;
+               goto fail_mclk;
+       }
+
+       /* Platform data holds setup_pinmux function ptr */
+       if (NULL == pdev->dev.platform_data) {
+               status = -ENODEV;
+               goto fail_mclk;
+       }
+       setup_pinmux = pdev->dev.platform_data;
+       /*
+        * setup Mux configuration for ccdc which may be different for
+        * different SoCs using this CCDC
+        */
+       setup_pinmux();
+
+       i = 0;
+       /* Get the ISIF base address, linearization table0 and table1 addr. */
+       while (i < 3) {
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               if (!res) {
+                       status = -ENODEV;
+                       goto fail_nobase_res;
+               }
+               res = request_mem_region(res->start, resource_size(res),
+                                        res->name);
+               if (!res) {
+                       status = -EBUSY;
+                       goto fail_nobase_res;
+               }
+               addr = ioremap_nocache(res->start, resource_size(res));
+               if (!addr) {
+                       status = -ENOMEM;
+                       goto fail_base_iomap;
+               }
+               switch (i) {
+               case 0:
+                       /* ISIF base address */
+                       isif_cfg.base_addr = addr;
+                       break;
+               case 1:
+                       /* ISIF linear tbl0 address */
+                       isif_cfg.linear_tbl0_addr = addr;
+                       break;
+               default:
+                       /* ISIF linear tbl0 address */
+                       isif_cfg.linear_tbl1_addr = addr;
+                       break;
+               }
+               i++;
+       }
+       isif_cfg.dev = &pdev->dev;
+
+       printk(KERN_NOTICE "%s is registered with vpfe.\n",
+               isif_hw_dev.name);
+       return 0;
+fail_base_iomap:
+       release_mem_region(res->start, resource_size(res));
+       i--;
+fail_nobase_res:
+       if (isif_cfg.base_addr)
+               iounmap(isif_cfg.base_addr);
+       if (isif_cfg.linear_tbl0_addr)
+               iounmap(isif_cfg.linear_tbl0_addr);
+
+       while (i >= 0) {
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               release_mem_region(res->start, resource_size(res));
+               i--;
+       }
+fail_mclk:
+       clk_put(isif_cfg.mclk);
+       vpfe_unregister_ccdc_device(&isif_hw_dev);
+       return status;
+}
+
+static int isif_remove(struct platform_device *pdev)
+{
+       struct resource *res;
+       int i = 0;
+
+       iounmap(isif_cfg.base_addr);
+       iounmap(isif_cfg.linear_tbl0_addr);
+       iounmap(isif_cfg.linear_tbl1_addr);
+       while (i < 3) {
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               if (res)
+                       release_mem_region(res->start, resource_size(res));
+               i++;
+       }
+       vpfe_unregister_ccdc_device(&isif_hw_dev);
+       return 0;
+}
+
+static struct platform_driver isif_driver = {
+       .driver = {
+               .name   = "isif",
+               .owner = THIS_MODULE,
+       },
+       .remove = __devexit_p(isif_remove),
+       .probe = isif_probe,
+};
+
+static int __init isif_init(void)
+{
+       return platform_driver_register(&isif_driver);
+}
+
+static void isif_exit(void)
+{
+       platform_driver_unregister(&isif_driver);
+}
+
+module_init(isif_init);
+module_exit(isif_exit);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/davinci/isif_regs.h b/drivers/media/video/davinci/isif_regs.h
new file mode 100644 (file)
index 0000000..f7b8893
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2008-2009 Texas Instruments Inc
+ *
+ * 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
+ */
+#ifndef _ISIF_REGS_H
+#define _ISIF_REGS_H
+
+/* ISIF registers relative offsets */
+#define SYNCEN                                 0x00
+#define MODESET                                        0x04
+#define HDW                                    0x08
+#define VDW                                    0x0c
+#define PPLN                                   0x10
+#define LPFR                                   0x14
+#define SPH                                    0x18
+#define LNH                                    0x1c
+#define SLV0                                   0x20
+#define SLV1                                   0x24
+#define LNV                                    0x28
+#define CULH                                   0x2c
+#define CULV                                   0x30
+#define HSIZE                                  0x34
+#define SDOFST                                 0x38
+#define CADU                                   0x3c
+#define CADL                                   0x40
+#define LINCFG0                                        0x44
+#define LINCFG1                                        0x48
+#define CCOLP                                  0x4c
+#define CRGAIN                                         0x50
+#define CGRGAIN                                        0x54
+#define CGBGAIN                                        0x58
+#define CBGAIN                                 0x5c
+#define COFSTA                                 0x60
+#define FLSHCFG0                               0x64
+#define FLSHCFG1                               0x68
+#define FLSHCFG2                               0x6c
+#define VDINT0                                 0x70
+#define VDINT1                                 0x74
+#define VDINT2                                 0x78
+#define MISC                                   0x7c
+#define CGAMMAWD                               0x80
+#define REC656IF                               0x84
+#define CCDCFG                                 0x88
+/*****************************************************
+* Defect Correction registers
+*****************************************************/
+#define DFCCTL                                 0x8c
+#define VDFSATLV                               0x90
+#define DFCMEMCTL                              0x94
+#define DFCMEM0                                        0x98
+#define DFCMEM1                                        0x9c
+#define DFCMEM2                                        0xa0
+#define DFCMEM3                                        0xa4
+#define DFCMEM4                                        0xa8
+/****************************************************
+* Black Clamp registers
+****************************************************/
+#define CLAMPCFG                               0xac
+#define CLDCOFST                               0xb0
+#define CLSV                                   0xb4
+#define CLHWIN0                                        0xb8
+#define CLHWIN1                                        0xbc
+#define CLHWIN2                                        0xc0
+#define CLVRV                                  0xc4
+#define CLVWIN0                                        0xc8
+#define CLVWIN1                                        0xcc
+#define CLVWIN2                                        0xd0
+#define CLVWIN3                                        0xd4
+/****************************************************
+* Lense Shading Correction
+****************************************************/
+#define DATAHOFST                              0xd8
+#define DATAVOFST                              0xdc
+#define LSCHVAL                                        0xe0
+#define LSCVVAL                                        0xe4
+#define TWODLSCCFG                             0xe8
+#define TWODLSCOFST                            0xec
+#define TWODLSCINI                             0xf0
+#define TWODLSCGRBU                            0xf4
+#define TWODLSCGRBL                            0xf8
+#define TWODLSCGROF                            0xfc
+#define TWODLSCORBU                            0x100
+#define TWODLSCORBL                            0x104
+#define TWODLSCOROF                            0x108
+#define TWODLSCIRQEN                           0x10c
+#define TWODLSCIRQST                           0x110
+/****************************************************
+* Data formatter
+****************************************************/
+#define FMTCFG                                 0x114
+#define FMTPLEN                                        0x118
+#define FMTSPH                                 0x11c
+#define FMTLNH                                 0x120
+#define FMTSLV                                 0x124
+#define FMTLNV                                 0x128
+#define FMTRLEN                                        0x12c
+#define FMTHCNT                                        0x130
+#define FMTAPTR_BASE                           0x134
+/* Below macro for addresses FMTAPTR0 - FMTAPTR15 */
+#define FMTAPTR(i)                     (FMTAPTR_BASE + (i * 4))
+#define FMTPGMVF0                              0x174
+#define FMTPGMVF1                              0x178
+#define FMTPGMAPU0                             0x17c
+#define FMTPGMAPU1                             0x180
+#define FMTPGMAPS0                             0x184
+#define FMTPGMAPS1                             0x188
+#define FMTPGMAPS2                             0x18c
+#define FMTPGMAPS3                             0x190
+#define FMTPGMAPS4                             0x194
+#define FMTPGMAPS5                             0x198
+#define FMTPGMAPS6                             0x19c
+#define FMTPGMAPS7                             0x1a0
+/************************************************
+* Color Space Converter
+************************************************/
+#define CSCCTL                                 0x1a4
+#define CSCM0                                  0x1a8
+#define CSCM1                                  0x1ac
+#define CSCM2                                  0x1b0
+#define CSCM3                                  0x1b4
+#define CSCM4                                  0x1b8
+#define CSCM5                                  0x1bc
+#define CSCM6                                  0x1c0
+#define CSCM7                                  0x1c4
+#define OBWIN0                                 0x1c8
+#define OBWIN1                                 0x1cc
+#define OBWIN2                                 0x1d0
+#define OBWIN3                                 0x1d4
+#define OBVAL0                                 0x1d8
+#define OBVAL1                                 0x1dc
+#define OBVAL2                                 0x1e0
+#define OBVAL3                                 0x1e4
+#define OBVAL4                                 0x1e8
+#define OBVAL5                                 0x1ec
+#define OBVAL6                                 0x1f0
+#define OBVAL7                                 0x1f4
+#define CLKCTL                                 0x1f8
+
+/* Masks & Shifts below */
+#define START_PX_HOR_MASK                      0x7FFF
+#define NUM_PX_HOR_MASK                                0x7FFF
+#define START_VER_ONE_MASK                     0x7FFF
+#define START_VER_TWO_MASK                     0x7FFF
+#define NUM_LINES_VER                          0x7FFF
+
+/* gain - offset masks */
+#define GAIN_INTEGER_SHIFT                     9
+#define OFFSET_MASK                            0xFFF
+#define GAIN_SDRAM_EN_SHIFT                    12
+#define GAIN_IPIPE_EN_SHIFT                    13
+#define GAIN_H3A_EN_SHIFT                      14
+#define OFST_SDRAM_EN_SHIFT                    8
+#define OFST_IPIPE_EN_SHIFT                    9
+#define OFST_H3A_EN_SHIFT                      10
+#define GAIN_OFFSET_EN_MASK                    0x7700
+
+/* Culling */
+#define CULL_PAT_EVEN_LINE_SHIFT               8
+
+/* CCDCFG register */
+#define ISIF_YCINSWP_RAW                       (0x00 << 4)
+#define ISIF_YCINSWP_YCBCR                     (0x01 << 4)
+#define ISIF_CCDCFG_FIDMD_LATCH_VSYNC          (0x00 << 6)
+#define ISIF_CCDCFG_WENLOG_AND                 (0x00 << 8)
+#define ISIF_CCDCFG_TRGSEL_WEN                 (0x00 << 9)
+#define ISIF_CCDCFG_EXTRG_DISABLE              (0x00 << 10)
+#define ISIF_LATCH_ON_VSYNC_DISABLE            (0x01 << 15)
+#define ISIF_LATCH_ON_VSYNC_ENABLE             (0x00 << 15)
+#define ISIF_DATA_PACK_MASK                    3
+#define ISIF_DATA_PACK16                       0
+#define ISIF_DATA_PACK12                       1
+#define ISIF_DATA_PACK8                                2
+#define ISIF_PIX_ORDER_SHIFT                   11
+#define ISIF_BW656_ENABLE                      (0x01 << 5)
+
+/* MODESET registers */
+#define ISIF_VDHDOUT_INPUT                     (0x00 << 0)
+#define ISIF_INPUT_SHIFT                       12
+#define ISIF_RAW_INPUT_MODE                    0
+#define ISIF_FID_POL_SHIFT                     4
+#define ISIF_HD_POL_SHIFT                      3
+#define ISIF_VD_POL_SHIFT                      2
+#define ISIF_DATAPOL_NORMAL                    0
+#define ISIF_DATAPOL_SHIFT                     6
+#define ISIF_EXWEN_DISABLE                     0
+#define ISIF_EXWEN_SHIFT                       5
+#define ISIF_FRM_FMT_SHIFT                     7
+#define ISIF_DATASFT_SHIFT                     8
+#define ISIF_LPF_SHIFT                         14
+#define ISIF_LPF_MASK                          1
+
+/* GAMMAWD registers */
+#define ISIF_ALAW_GAMA_WD_MASK                 0xF
+#define ISIF_ALAW_GAMA_WD_SHIFT                        1
+#define ISIF_ALAW_ENABLE                       1
+#define ISIF_GAMMAWD_CFA_SHIFT                 5
+
+/* HSIZE registers */
+#define ISIF_HSIZE_FLIP_MASK                   1
+#define ISIF_HSIZE_FLIP_SHIFT                  12
+
+/* MISC registers */
+#define ISIF_DPCM_EN_SHIFT                     12
+#define ISIF_DPCM_PREDICTOR_SHIFT              13
+
+/* Black clamp related */
+#define ISIF_BC_MODE_COLOR_SHIFT               4
+#define ISIF_HORZ_BC_MODE_SHIFT                        1
+#define ISIF_HORZ_BC_WIN_SEL_SHIFT             5
+#define ISIF_HORZ_BC_PIX_LIMIT_SHIFT           6
+#define ISIF_HORZ_BC_WIN_H_SIZE_SHIFT          8
+#define ISIF_HORZ_BC_WIN_V_SIZE_SHIFT          12
+#define        ISIF_VERT_BC_RST_VAL_SEL_SHIFT          4
+#define ISIF_VERT_BC_LINE_AVE_COEF_SHIFT       8
+
+/* VDFC registers */
+#define ISIF_VDFC_EN_SHIFT                     4
+#define ISIF_VDFC_CORR_MOD_SHIFT               5
+#define ISIF_VDFC_CORR_WHOLE_LN_SHIFT          7
+#define ISIF_VDFC_LEVEL_SHFT_SHIFT             8
+#define ISIF_VDFC_POS_MASK                     0x1FFF
+#define ISIF_DFCMEMCTL_DFCMARST_SHIFT          2
+
+/* CSC registers */
+#define ISIF_CSC_COEF_INTEG_MASK               7
+#define ISIF_CSC_COEF_DECIMAL_MASK             0x1f
+#define ISIF_CSC_COEF_INTEG_SHIFT              5
+#define ISIF_CSCM_MSB_SHIFT                    8
+#define ISIF_DF_CSC_SPH_MASK                   0x1FFF
+#define ISIF_DF_CSC_LNH_MASK                   0x1FFF
+#define ISIF_DF_CSC_SLV_MASK                   0x1FFF
+#define ISIF_DF_CSC_LNV_MASK                   0x1FFF
+#define ISIF_DF_NUMLINES                       0x7FFF
+#define ISIF_DF_NUMPIX                         0x1FFF
+
+/* Offsets for LSC/DFC/Gain */
+#define ISIF_DATA_H_OFFSET_MASK                        0x1FFF
+#define ISIF_DATA_V_OFFSET_MASK                        0x1FFF
+
+/* Linearization */
+#define ISIF_LIN_CORRSFT_SHIFT                 4
+#define ISIF_LIN_SCALE_FACT_INTEG_SHIFT                10
+
+
+/* Pattern registers */
+#define ISIF_PG_EN                             (1 << 3)
+#define ISIF_SEL_PG_SRC                                (3 << 4)
+#define ISIF_PG_VD_POL_SHIFT                   0
+#define ISIF_PG_HD_POL_SHIFT                   1
+
+/*random other junk*/
+#define ISIF_SYNCEN_VDHDEN_MASK                        (1 << 0)
+#define ISIF_SYNCEN_WEN_MASK                   (1 << 1)
+#define ISIF_SYNCEN_WEN_SHIFT                  1
+
+#endif
index de22bc9faf21274e8c6aacbf942ce41376181fa9..885cd54499cf6952abbae826e7526ca5ac186673 100644 (file)
@@ -107,9 +107,6 @@ struct ccdc_config {
        int vpfe_probed;
        /* name of ccdc device */
        char name[32];
-       /* for storing mem maps for CCDC */
-       int ccdc_addr_size;
-       void *__iomem ccdc_addr;
 };
 
 /* data structures */
@@ -229,7 +226,6 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
        BUG_ON(!dev->hw_ops.set_image_window);
        BUG_ON(!dev->hw_ops.get_image_window);
        BUG_ON(!dev->hw_ops.get_line_length);
-       BUG_ON(!dev->hw_ops.setfbaddr);
        BUG_ON(!dev->hw_ops.getfid);
 
        mutex_lock(&ccdc_lock);
@@ -240,25 +236,23 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
                 * walk through it during vpfe probe
                 */
                printk(KERN_ERR "vpfe capture not initialized\n");
-               ret = -1;
+               ret = -EFAULT;
                goto unlock;
        }
 
        if (strcmp(dev->name, ccdc_cfg->name)) {
                /* ignore this ccdc */
-               ret = -1;
+               ret = -EINVAL;
                goto unlock;
        }
 
        if (ccdc_dev) {
                printk(KERN_ERR "ccdc already registered\n");
-               ret = -1;
+               ret = -EINVAL;
                goto unlock;
        }
 
        ccdc_dev = dev;
-       dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr,
-                                 ccdc_cfg->ccdc_addr_size);
 unlock:
        mutex_unlock(&ccdc_lock);
        return ret;
@@ -1786,61 +1780,6 @@ static struct vpfe_device *vpfe_initialize(void)
        return vpfe_dev;
 }
 
-static void vpfe_disable_clock(struct vpfe_device *vpfe_dev)
-{
-       struct vpfe_config *vpfe_cfg = vpfe_dev->cfg;
-
-       clk_disable(vpfe_cfg->vpssclk);
-       clk_put(vpfe_cfg->vpssclk);
-       clk_disable(vpfe_cfg->slaveclk);
-       clk_put(vpfe_cfg->slaveclk);
-       v4l2_info(vpfe_dev->pdev->driver,
-                "vpfe vpss master & slave clocks disabled\n");
-}
-
-static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
-{
-       struct vpfe_config *vpfe_cfg = vpfe_dev->cfg;
-       int ret = -ENOENT;
-
-       vpfe_cfg->vpssclk = clk_get(vpfe_dev->pdev, "vpss_master");
-       if (NULL == vpfe_cfg->vpssclk) {
-               v4l2_err(vpfe_dev->pdev->driver, "No clock defined for"
-                        "vpss_master\n");
-               return ret;
-       }
-
-       if (clk_enable(vpfe_cfg->vpssclk)) {
-               v4l2_err(vpfe_dev->pdev->driver,
-                       "vpfe vpss master clock not enabled\n");
-               goto out;
-       }
-       v4l2_info(vpfe_dev->pdev->driver,
-                "vpfe vpss master clock enabled\n");
-
-       vpfe_cfg->slaveclk = clk_get(vpfe_dev->pdev, "vpss_slave");
-       if (NULL == vpfe_cfg->slaveclk) {
-               v4l2_err(vpfe_dev->pdev->driver,
-                       "No clock defined for vpss slave\n");
-               goto out;
-       }
-
-       if (clk_enable(vpfe_cfg->slaveclk)) {
-               v4l2_err(vpfe_dev->pdev->driver,
-                        "vpfe vpss slave clock not enabled\n");
-               goto out;
-       }
-       v4l2_info(vpfe_dev->pdev->driver, "vpfe vpss slave clock enabled\n");
-       return 0;
-out:
-       if (vpfe_cfg->vpssclk)
-               clk_put(vpfe_cfg->vpssclk);
-       if (vpfe_cfg->slaveclk)
-               clk_put(vpfe_cfg->slaveclk);
-
-       return -1;
-}
-
 /*
  * vpfe_probe : This function creates device entries by register
  * itself to the V4L2 driver and initializes fields of each
@@ -1870,7 +1809,7 @@ static __init int vpfe_probe(struct platform_device *pdev)
 
        if (NULL == pdev->dev.platform_data) {
                v4l2_err(pdev->dev.driver, "Unable to get vpfe config\n");
-               ret = -ENOENT;
+               ret = -ENODEV;
                goto probe_free_dev_mem;
        }
 
@@ -1884,18 +1823,13 @@ static __init int vpfe_probe(struct platform_device *pdev)
                goto probe_free_dev_mem;
        }
 
-       /* enable vpss clocks */
-       ret = vpfe_enable_clock(vpfe_dev);
-       if (ret)
-               goto probe_free_dev_mem;
-
        mutex_lock(&ccdc_lock);
        /* Allocate memory for ccdc configuration */
        ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL);
        if (NULL == ccdc_cfg) {
                v4l2_err(pdev->dev.driver,
                         "Memory allocation failed for ccdc_cfg\n");
-               goto probe_disable_clock;
+               goto probe_free_dev_mem;
        }
 
        strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
@@ -1904,61 +1838,34 @@ static __init int vpfe_probe(struct platform_device *pdev)
        if (!res1) {
                v4l2_err(pdev->dev.driver,
                         "Unable to get interrupt for VINT0\n");
-               ret = -ENOENT;
-               goto probe_disable_clock;
+               ret = -ENODEV;
+               goto probe_free_ccdc_cfg_mem;
        }
        vpfe_dev->ccdc_irq0 = res1->start;
 
        /* Get VINT1 irq resource */
-       res1 = platform_get_resource(pdev,
-                               IORESOURCE_IRQ, 1);
+       res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
        if (!res1) {
                v4l2_err(pdev->dev.driver,
                         "Unable to get interrupt for VINT1\n");
-               ret = -ENOENT;
-               goto probe_disable_clock;
+               ret = -ENODEV;
+               goto probe_free_ccdc_cfg_mem;
        }
        vpfe_dev->ccdc_irq1 = res1->start;
 
-       /* Get address base of CCDC */
-       res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res1) {
-               v4l2_err(pdev->dev.driver,
-                       "Unable to get register address map\n");
-               ret = -ENOENT;
-               goto probe_disable_clock;
-       }
-
-       ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
-       if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size,
-                               pdev->dev.driver->name)) {
-               v4l2_err(pdev->dev.driver,
-                       "Failed request_mem_region for ccdc base\n");
-               ret = -ENXIO;
-               goto probe_disable_clock;
-       }
-       ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start,
-                                            ccdc_cfg->ccdc_addr_size);
-       if (!ccdc_cfg->ccdc_addr) {
-               v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc addr\n");
-               ret = -ENXIO;
-               goto probe_out_release_mem1;
-       }
-
        ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, IRQF_DISABLED,
                          "vpfe_capture0", vpfe_dev);
 
        if (0 != ret) {
                v4l2_err(pdev->dev.driver, "Unable to request interrupt\n");
-               goto probe_out_unmap1;
+               goto probe_free_ccdc_cfg_mem;
        }
 
        /* Allocate memory for video device */
        vfd = video_device_alloc();
        if (NULL == vfd) {
                ret = -ENOMEM;
-               v4l2_err(pdev->dev.driver,
-                       "Unable to alloc video device\n");
+               v4l2_err(pdev->dev.driver, "Unable to alloc video device\n");
                goto probe_out_release_irq;
        }
 
@@ -2073,12 +1980,7 @@ probe_out_video_release:
                video_device_release(vpfe_dev->video_dev);
 probe_out_release_irq:
        free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
-probe_out_unmap1:
-       iounmap(ccdc_cfg->ccdc_addr);
-probe_out_release_mem1:
-       release_mem_region(res1->start, res1->end - res1->start + 1);
-probe_disable_clock:
-       vpfe_disable_clock(vpfe_dev);
+probe_free_ccdc_cfg_mem:
        mutex_unlock(&ccdc_lock);
        kfree(ccdc_cfg);
 probe_free_dev_mem:
@@ -2092,7 +1994,6 @@ probe_free_dev_mem:
 static int __devexit vpfe_remove(struct platform_device *pdev)
 {
        struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
-       struct resource *res;
 
        v4l2_info(pdev->dev.driver, "vpfe_remove\n");
 
@@ -2100,12 +2001,6 @@ static int __devexit vpfe_remove(struct platform_device *pdev)
        kfree(vpfe_dev->sd);
        v4l2_device_unregister(&vpfe_dev->v4l2_dev);
        video_unregister_device(vpfe_dev->video_dev);
-       mutex_lock(&ccdc_lock);
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       release_mem_region(res->start, res->end - res->start + 1);
-       iounmap(ccdc_cfg->ccdc_addr);
-       mutex_unlock(&ccdc_lock);
-       vpfe_disable_clock(vpfe_dev);
        kfree(vpfe_dev);
        kfree(ccdc_cfg);
        return 0;
index 7ee72ecd3d81baea218dec5b41ab963f9978b3c4..7918680917d029afe7c3f4e8346d4553ab063017 100644 (file)
@@ -15,7 +15,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * common vpss driver for all video drivers.
+ * common vpss system module platform driver for all video drivers.
  */
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -35,12 +35,52 @@ MODULE_AUTHOR("Texas Instruments");
 /* DM644x defines */
 #define DM644X_SBL_PCR_VPSS            (4)
 
+#define DM355_VPSSBL_INTSEL            0x10
+#define DM355_VPSSBL_EVTSEL            0x14
 /* vpss BL register offsets */
 #define DM355_VPSSBL_CCDCMUX           0x1c
 /* vpss CLK register offsets */
 #define DM355_VPSSCLK_CLKCTRL          0x04
 /* masks and shifts */
 #define VPSS_HSSISEL_SHIFT             4
+/*
+ * VDINT0 - vpss_int0, VDINT1 - vpss_int1, H3A - vpss_int4,
+ * IPIPE_INT1_SDR - vpss_int5
+ */
+#define DM355_VPSSBL_INTSEL_DEFAULT    0xff83ff10
+/* VENCINT - vpss_int8 */
+#define DM355_VPSSBL_EVTSEL_DEFAULT    0x4
+
+#define DM365_ISP5_PCCR                0x04
+#define DM365_ISP5_INTSEL1             0x10
+#define DM365_ISP5_INTSEL2             0x14
+#define DM365_ISP5_INTSEL3             0x18
+#define DM365_ISP5_CCDCMUX             0x20
+#define DM365_ISP5_PG_FRAME_SIZE       0x28
+#define DM365_VPBE_CLK_CTRL            0x00
+/*
+ * vpss interrupts. VDINT0 - vpss_int0, VDINT1 - vpss_int1,
+ * AF - vpss_int3
+ */
+#define DM365_ISP5_INTSEL1_DEFAULT     0x0b1f0100
+/* AEW - vpss_int6, RSZ_INT_DMA - vpss_int5 */
+#define DM365_ISP5_INTSEL2_DEFAULT     0x1f0a0f1f
+/* VENC - vpss_int8 */
+#define DM365_ISP5_INTSEL3_DEFAULT     0x00000015
+
+/* masks and shifts for DM365*/
+#define DM365_CCDC_PG_VD_POL_SHIFT     0
+#define DM365_CCDC_PG_HD_POL_SHIFT     1
+
+#define CCD_SRC_SEL_MASK               (BIT_MASK(5) | BIT_MASK(4))
+#define CCD_SRC_SEL_SHIFT              4
+
+/* Different SoC platforms supported by this driver */
+enum vpss_platform_type {
+       DM644X,
+       DM355,
+       DM365,
+};
 
 /*
  * vpss operations. Depends on platform. Not all functions are available
@@ -59,13 +99,9 @@ struct vpss_hw_ops {
 
 /* vpss configuration */
 struct vpss_oper_config {
-       __iomem void *vpss_bl_regs_base;
-       __iomem void *vpss_regs_base;
-       struct resource         *r1;
-       resource_size_t         len1;
-       struct resource         *r2;
-       resource_size_t         len2;
-       char vpss_name[32];
+       __iomem void *vpss_regs_base0;
+       __iomem void *vpss_regs_base1;
+       enum vpss_platform_type platform;
        spinlock_t vpss_lock;
        struct vpss_hw_ops hw_ops;
 };
@@ -75,22 +111,46 @@ static struct vpss_oper_config oper_cfg;
 /* register access routines */
 static inline u32 bl_regr(u32 offset)
 {
-       return __raw_readl(oper_cfg.vpss_bl_regs_base + offset);
+       return __raw_readl(oper_cfg.vpss_regs_base0 + offset);
 }
 
 static inline void bl_regw(u32 val, u32 offset)
 {
-       __raw_writel(val, oper_cfg.vpss_bl_regs_base + offset);
+       __raw_writel(val, oper_cfg.vpss_regs_base0 + offset);
 }
 
 static inline u32 vpss_regr(u32 offset)
 {
-       return __raw_readl(oper_cfg.vpss_regs_base + offset);
+       return __raw_readl(oper_cfg.vpss_regs_base1 + offset);
 }
 
 static inline void vpss_regw(u32 val, u32 offset)
 {
-       __raw_writel(val, oper_cfg.vpss_regs_base + offset);
+       __raw_writel(val, oper_cfg.vpss_regs_base1 + offset);
+}
+
+/* For DM365 only */
+static inline u32 isp5_read(u32 offset)
+{
+       return __raw_readl(oper_cfg.vpss_regs_base0 + offset);
+}
+
+/* For DM365 only */
+static inline void isp5_write(u32 val, u32 offset)
+{
+       __raw_writel(val, oper_cfg.vpss_regs_base0 + offset);
+}
+
+static void dm365_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
+{
+       u32 temp = isp5_read(DM365_ISP5_CCDCMUX) & ~CCD_SRC_SEL_MASK;
+
+       /* if we are using pattern generator, enable it */
+       if (src_sel == VPSS_PGLPBK || src_sel == VPSS_CCDCPG)
+               temp |= 0x08;
+
+       temp |= (src_sel << CCD_SRC_SEL_SHIFT);
+       isp5_write(temp, DM365_ISP5_CCDCMUX);
 }
 
 static void dm355_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
@@ -101,9 +161,9 @@ static void dm355_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
 int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
 {
        if (!oper_cfg.hw_ops.select_ccdc_source)
-               return -1;
+               return -EINVAL;
 
-       dm355_select_ccdc_source(src_sel);
+       oper_cfg.hw_ops.select_ccdc_source(src_sel);
        return 0;
 }
 EXPORT_SYMBOL(vpss_select_ccdc_source);
@@ -114,7 +174,7 @@ static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
 
        if (wbl_sel < VPSS_PCR_AEW_WBL_0 ||
            wbl_sel > VPSS_PCR_CCDC_WBL_O)
-               return -1;
+               return -EINVAL;
 
        /* writing a 0 clear the overflow */
        mask = ~(mask << wbl_sel);
@@ -126,7 +186,7 @@ static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
 {
        if (!oper_cfg.hw_ops.clear_wbl_overflow)
-               return -1;
+               return -EINVAL;
 
        return oper_cfg.hw_ops.clear_wbl_overflow(wbl_sel);
 }
@@ -166,7 +226,7 @@ static int dm355_enable_clock(enum vpss_clock_sel clock_sel, int en)
        default:
                printk(KERN_ERR "dm355_enable_clock:"
                                " Invalid selector: %d\n", clock_sel);
-               return -1;
+               return -EINVAL;
        }
 
        spin_lock_irqsave(&oper_cfg.vpss_lock, flags);
@@ -181,100 +241,221 @@ static int dm355_enable_clock(enum vpss_clock_sel clock_sel, int en)
        return 0;
 }
 
+static int dm365_enable_clock(enum vpss_clock_sel clock_sel, int en)
+{
+       unsigned long flags;
+       u32 utemp, mask = 0x1, shift = 0, offset = DM365_ISP5_PCCR;
+       u32 (*read)(u32 offset) = isp5_read;
+       void(*write)(u32 val, u32 offset) = isp5_write;
+
+       switch (clock_sel) {
+       case VPSS_BL_CLOCK:
+               break;
+       case VPSS_CCDC_CLOCK:
+               shift = 1;
+               break;
+       case VPSS_H3A_CLOCK:
+               shift = 2;
+               break;
+       case VPSS_RSZ_CLOCK:
+               shift = 3;
+               break;
+       case VPSS_IPIPE_CLOCK:
+               shift = 4;
+               break;
+       case VPSS_IPIPEIF_CLOCK:
+               shift = 5;
+               break;
+       case VPSS_PCLK_INTERNAL:
+               shift = 6;
+               break;
+       case VPSS_PSYNC_CLOCK_SEL:
+               shift = 7;
+               break;
+       case VPSS_VPBE_CLOCK:
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       case VPSS_VENC_CLOCK_SEL:
+               shift = 2;
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       case VPSS_LDC_CLOCK:
+               shift = 3;
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       case VPSS_FDIF_CLOCK:
+               shift = 4;
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       case VPSS_OSD_CLOCK_SEL:
+               shift = 6;
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       case VPSS_LDC_CLOCK_SEL:
+               shift = 7;
+               read = vpss_regr;
+               write = vpss_regw;
+               offset = DM365_VPBE_CLK_CTRL;
+               break;
+       default:
+               printk(KERN_ERR "dm365_enable_clock: Invalid selector: %d\n",
+                      clock_sel);
+               return -1;
+       }
+
+       spin_lock_irqsave(&oper_cfg.vpss_lock, flags);
+       utemp = read(offset);
+       if (!en) {
+               mask = ~mask;
+               utemp &= (mask << shift);
+       } else
+               utemp |= (mask << shift);
+
+       write(utemp, offset);
+       spin_unlock_irqrestore(&oper_cfg.vpss_lock, flags);
+
+       return 0;
+}
+
 int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en)
 {
        if (!oper_cfg.hw_ops.enable_clock)
-               return -1;
+               return -EINVAL;
 
        return oper_cfg.hw_ops.enable_clock(clock_sel, en);
 }
 EXPORT_SYMBOL(vpss_enable_clock);
 
+void dm365_vpss_set_sync_pol(struct vpss_sync_pol sync)
+{
+       int val = 0;
+       val = isp5_read(DM365_ISP5_CCDCMUX);
+
+       val |= (sync.ccdpg_hdpol << DM365_CCDC_PG_HD_POL_SHIFT);
+       val |= (sync.ccdpg_vdpol << DM365_CCDC_PG_VD_POL_SHIFT);
+
+       isp5_write(val, DM365_ISP5_CCDCMUX);
+}
+EXPORT_SYMBOL(dm365_vpss_set_sync_pol);
+
+void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
+{
+       int current_reg = ((frame_size.hlpfr >> 1) - 1) << 16;
+
+       current_reg |= (frame_size.pplen - 1);
+       isp5_write(current_reg, DM365_ISP5_PG_FRAME_SIZE);
+}
+EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size);
+
 static int __init vpss_probe(struct platform_device *pdev)
 {
-       int status, dm355 = 0;
+       struct resource         *r1, *r2;
+       char *platform_name;
+       int status;
 
        if (!pdev->dev.platform_data) {
                dev_err(&pdev->dev, "no platform data\n");
                return -ENOENT;
        }
-       strcpy(oper_cfg.vpss_name, pdev->dev.platform_data);
 
-       if (!strcmp(oper_cfg.vpss_name, "dm355_vpss"))
-               dm355 = 1;
-       else if (strcmp(oper_cfg.vpss_name, "dm644x_vpss")) {
+       platform_name = pdev->dev.platform_data;
+       if (!strcmp(platform_name, "dm355_vpss"))
+               oper_cfg.platform = DM355;
+       else if (!strcmp(platform_name, "dm365_vpss"))
+               oper_cfg.platform = DM365;
+       else if (!strcmp(platform_name, "dm644x_vpss"))
+               oper_cfg.platform = DM644X;
+       else {
                dev_err(&pdev->dev, "vpss driver not supported on"
                        " this platform\n");
                return -ENODEV;
        }
 
-       dev_info(&pdev->dev, "%s vpss probed\n", oper_cfg.vpss_name);
-       oper_cfg.r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!oper_cfg.r1)
+       dev_info(&pdev->dev, "%s vpss probed\n", platform_name);
+       r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!r1)
                return -ENOENT;
 
-       oper_cfg.len1 = oper_cfg.r1->end - oper_cfg.r1->start + 1;
-
-       oper_cfg.r1 = request_mem_region(oper_cfg.r1->start, oper_cfg.len1,
-                                        oper_cfg.r1->name);
-       if (!oper_cfg.r1)
+       r1 = request_mem_region(r1->start, resource_size(r1), r1->name);
+       if (!r1)
                return -EBUSY;
 
-       oper_cfg.vpss_bl_regs_base = ioremap(oper_cfg.r1->start, oper_cfg.len1);
-       if (!oper_cfg.vpss_bl_regs_base) {
+       oper_cfg.vpss_regs_base0 = ioremap(r1->start, resource_size(r1));
+       if (!oper_cfg.vpss_regs_base0) {
                status = -EBUSY;
                goto fail1;
        }
 
-       if (dm355) {
-               oper_cfg.r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-               if (!oper_cfg.r2) {
+       if (oper_cfg.platform == DM355 || oper_cfg.platform == DM365) {
+               r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+               if (!r2) {
                        status = -ENOENT;
                        goto fail2;
                }
-               oper_cfg.len2 = oper_cfg.r2->end - oper_cfg.r2->start + 1;
-               oper_cfg.r2 = request_mem_region(oper_cfg.r2->start,
-                                                oper_cfg.len2,
-                                                oper_cfg.r2->name);
-               if (!oper_cfg.r2) {
+               r2 = request_mem_region(r2->start, resource_size(r2), r2->name);
+               if (!r2) {
                        status = -EBUSY;
                        goto fail2;
                }
 
-               oper_cfg.vpss_regs_base = ioremap(oper_cfg.r2->start,
-                                                 oper_cfg.len2);
-               if (!oper_cfg.vpss_regs_base) {
+               oper_cfg.vpss_regs_base1 = ioremap(r2->start,
+                                                  resource_size(r2));
+               if (!oper_cfg.vpss_regs_base1) {
                        status = -EBUSY;
                        goto fail3;
                }
        }
 
-       if (dm355) {
+       if (oper_cfg.platform == DM355) {
                oper_cfg.hw_ops.enable_clock = dm355_enable_clock;
                oper_cfg.hw_ops.select_ccdc_source = dm355_select_ccdc_source;
+               /* Setup vpss interrupts */
+               bl_regw(DM355_VPSSBL_INTSEL_DEFAULT, DM355_VPSSBL_INTSEL);
+               bl_regw(DM355_VPSSBL_EVTSEL_DEFAULT, DM355_VPSSBL_EVTSEL);
+       } else if (oper_cfg.platform == DM365) {
+               oper_cfg.hw_ops.enable_clock = dm365_enable_clock;
+               oper_cfg.hw_ops.select_ccdc_source = dm365_select_ccdc_source;
+               /* Setup vpss interrupts */
+               isp5_write(DM365_ISP5_INTSEL1_DEFAULT, DM365_ISP5_INTSEL1);
+               isp5_write(DM365_ISP5_INTSEL2_DEFAULT, DM365_ISP5_INTSEL2);
+               isp5_write(DM365_ISP5_INTSEL3_DEFAULT, DM365_ISP5_INTSEL3);
        } else
                oper_cfg.hw_ops.clear_wbl_overflow = dm644x_clear_wbl_overflow;
 
        spin_lock_init(&oper_cfg.vpss_lock);
-       dev_info(&pdev->dev, "%s vpss probe success\n", oper_cfg.vpss_name);
+       dev_info(&pdev->dev, "%s vpss probe success\n", platform_name);
        return 0;
 
 fail3:
-       release_mem_region(oper_cfg.r2->start, oper_cfg.len2);
+       release_mem_region(r2->start, resource_size(r2));
 fail2:
-       iounmap(oper_cfg.vpss_bl_regs_base);
+       iounmap(oper_cfg.vpss_regs_base0);
 fail1:
-       release_mem_region(oper_cfg.r1->start, oper_cfg.len1);
+       release_mem_region(r1->start, resource_size(r1));
        return status;
 }
 
 static int __devexit vpss_remove(struct platform_device *pdev)
 {
-       iounmap(oper_cfg.vpss_bl_regs_base);
-       release_mem_region(oper_cfg.r1->start, oper_cfg.len1);
-       if (!strcmp(oper_cfg.vpss_name, "dm355_vpss")) {
-               iounmap(oper_cfg.vpss_regs_base);
-               release_mem_region(oper_cfg.r2->start, oper_cfg.len2);
+       struct resource         *res;
+
+       iounmap(oper_cfg.vpss_regs_base0);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(res->start, resource_size(res));
+       if (oper_cfg.platform == DM355 || oper_cfg.platform == DM365) {
+               iounmap(oper_cfg.vpss_regs_base1);
+               res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+               release_mem_region(res->start, resource_size(res));
        }
        return 0;
 }
index 25100001ffff838b090794b59cc9df22eb04d7ec..ecbcefb08739db90ea57f60db7ebff0b237579e3 100644 (file)
@@ -232,6 +232,12 @@ static struct em28xx_reg_seq vc211a_enable[] = {
        {       -1,             -1,     -1,             -1},
 };
 
+static struct em28xx_reg_seq dikom_dk300_digital[] = {
+       {EM28XX_R08_GPIO,       0x6e,   ~EM_GPIO_4,     10},
+       {EM2880_R04_GPO,        0x08,   0xff,           10},
+       { -1,                   -1,     -1,             -1},
+};
+
 
 /*
  *  Board definitions
@@ -461,21 +467,30 @@ struct em28xx_board em28xx_boards[] = {
                .name         = "Leadtek Winfast USB II Deluxe",
                .valid        = EM28XX_BOARD_NOT_VALIDATED,
                .tuner_type   = TUNER_PHILIPS_FM1216ME_MK3,
-               .tda9887_conf = TDA9887_PRESENT,
+               .has_ir_i2c   = 1,
+               .tvaudio_addr = 0x58,
+               .tda9887_conf = TDA9887_PRESENT |
+                               TDA9887_PORT2_ACTIVE |
+                               TDA9887_QSS,
                .decoder      = EM28XX_SAA711X,
+               .adecoder     = EM28XX_TVAUDIO,
                .input        = { {
                        .type     = EM28XX_VMUX_TELEVISION,
-                       .vmux     = SAA7115_COMPOSITE2,
-                       .amux     = EM28XX_AMUX_VIDEO,
+                       .vmux     = SAA7115_COMPOSITE4,
+                       .amux     = EM28XX_AMUX_AUX,
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
-                       .vmux     = SAA7115_COMPOSITE0,
+                       .vmux     = SAA7115_COMPOSITE5,
                        .amux     = EM28XX_AMUX_LINE_IN,
                }, {
                        .type     = EM28XX_VMUX_SVIDEO,
-                       .vmux     = SAA7115_COMPOSITE0,
+                       .vmux     = SAA7115_SVIDEO3,
                        .amux     = EM28XX_AMUX_LINE_IN,
                } },
+                       .radio    = {
+                       .type     = EM28XX_RADIO,
+                       .amux     = EM28XX_AMUX_AUX,
+                       }
        },
        [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
                .name         = "Videology 20K14XUSB USB2.0",
@@ -730,11 +745,12 @@ struct em28xx_board em28xx_boards[] = {
 
        [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
                .name         = "Terratec Hybrid XS Secam",
-               .valid        = EM28XX_BOARD_NOT_VALIDATED,
                .has_msp34xx  = 1,
                .tuner_type   = TUNER_XC2028,
                .tuner_gpio   = default_tuner_gpio,
                .decoder      = EM28XX_TVP5150,
+               .has_dvb      = 1,
+               .dvb_gpio     = default_digital,
                .input        = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
@@ -1265,6 +1281,7 @@ struct em28xx_board em28xx_boards[] = {
                .decoder        = EM28XX_SAA711X,
                .has_dvb        = 1,
                .dvb_gpio       = em2882_kworld_315u_digital,
+               .ir_codes       = &ir_codes_kworld_315u_table,
                .xclk           = EM28XX_XCLK_FREQUENCY_12MHZ,
                .i2c_speed      = EM28XX_I2C_CLK_WAIT_ENABLE,
                /* Analog mode - still not ready */
@@ -1431,6 +1448,21 @@ struct em28xx_board em28xx_boards[] = {
                        .gpio     = hauppauge_wintv_hvr_900_analog,
                } },
        },
+       [EM2882_BOARD_DIKOM_DK300] = {
+               .name         = "Dikom DK300",
+               .tuner_type   = TUNER_XC2028,
+               .tuner_gpio   = default_tuner_gpio,
+               .decoder      = EM28XX_TVP5150,
+               .mts_firmware = 1,
+               .has_dvb      = 1,
+               .dvb_gpio     = dikom_dk300_digital,
+               .input        = { {
+                       .type     = EM28XX_VMUX_TELEVISION,
+                       .vmux     = TVP5150_COMPOSITE0,
+                       .amux     = EM28XX_AMUX_VIDEO,
+                       .gpio     = default_analog,
+               } },
+       },
        [EM2883_BOARD_KWORLD_HYBRID_330U] = {
                .name         = "Kworld PlusTV HD Hybrid 330",
                .tuner_type   = TUNER_XC2028,
@@ -1751,6 +1783,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
        {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
        {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
        {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
+       {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2103,6 +2136,7 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
                ctl->demod = XC3028_FE_DEFAULT;
                break;
        case EM2883_BOARD_KWORLD_HYBRID_330U:
+       case EM2882_BOARD_DIKOM_DK300:
                ctl->demod = XC3028_FE_CHINA;
                ctl->fname = XC2028_DEFAULT_FIRMWARE;
                break;
@@ -2259,9 +2293,12 @@ static int em28xx_hint_board(struct em28xx *dev)
 /* ----------------------------------------------------------------------- */
 void em28xx_register_i2c_ir(struct em28xx *dev)
 {
+       /* Leadtek winfast tv USBII deluxe can find a non working IR-device */
+       /* at address 0x18, so if that address is needed for another board in */
+       /* the future, please put it after 0x1f. */
        struct i2c_board_info info;
        const unsigned short addr_list[] = {
-                0x30, 0x47, I2C_CLIENT_END
+                0x1f, 0x30, 0x47, I2C_CLIENT_END
        };
 
        if (disable_ir)
@@ -2288,6 +2325,10 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
                dev->init_data.ir_codes = &ir_codes_rc5_hauppauge_new_table;
                dev->init_data.get_key = em28xx_get_key_em_haup;
                dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
+       case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
+               dev->init_data.ir_codes = &ir_codes_winfast_usbii_deluxe_table;;
+               dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
+               dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
                break;
        }
 
@@ -2381,6 +2422,31 @@ void em28xx_card_setup(struct em28xx *dev)
                em28xx_gpio_set(dev, dev->board.tuner_gpio);
                em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
                break;
+
+/*
+                * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
+                *
+                * This occurs because they share identical USB vendor and
+                * product IDs.
+                *
+                * What we do here is look up the EEPROM hash of the Dikom
+                * and if it is found then we decide that we do not have
+                * a Kworld and reset the device to the Dikom instead.
+                *
+                * This solution is only valid if they do not share eeprom
+                * hash identities which has not been determined as yet.
+                */
+       case EM2882_BOARD_KWORLD_VS_DVBT:
+               if (!em28xx_hint_board(dev))
+                       em28xx_set_model(dev);
+
+               /* In cases where we had to use a board hint, the call to
+                  em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
+                  so make the call now so the analog GPIOs are set properly
+                  before probing the i2c bus. */
+               em28xx_gpio_set(dev, dev->board.tuner_gpio);
+               em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
+               break;
        }
 
 #if defined(CONFIG_MODULES) && defined(MODULE)
index b311d4514bdf0e78b270d45d014aeec55c071aca..5a37eccbd7d681001e509539060bea638e16e77d 100644 (file)
@@ -691,9 +691,15 @@ int em28xx_set_outfmt(struct em28xx *dev)
        if (em28xx_vbi_supported(dev) == 1) {
                vinctrl |= EM28XX_VINCTRL_VBI_RAW;
                em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00);
-               em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09);
-               em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, 0xb4);
-               em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, 0x0c);
+               em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, dev->vbi_width/4);
+               em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, dev->vbi_height);
+               if (dev->norm & V4L2_STD_525_60) {
+                       /* NTSC */
+                       em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09);
+               } else if (dev->norm & V4L2_STD_625_50) {
+                       /* PAL */
+                       em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x07);
+               }
        }
 
        return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, vinctrl);
@@ -760,6 +766,13 @@ int em28xx_resolution_set(struct em28xx *dev)
        width = norm_maxw(dev);
        height = norm_maxh(dev);
 
+       /* Properly setup VBI */
+       dev->vbi_width = 720;
+       if (dev->norm & V4L2_STD_525_60)
+               dev->vbi_height = 12;
+       else
+               dev->vbi_height = 18;
+
        if (!dev->progressive)
                height >>= norm_maxh(dev);
 
index cc0505eb900f9b379ee68026cdcafef25ec8bfba..1b96356b3ab270c2e195c520b3d455c16092a24d 100644 (file)
@@ -502,7 +502,9 @@ static int dvb_init(struct em28xx *dev)
                }
                break;
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
+       case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
        case EM2881_BOARD_PINNACLE_HYBRID_PRO:
+       case EM2882_BOARD_DIKOM_DK300:
                dvb->frontend = dvb_attach(zl10353_attach,
                                           &em28xx_zl10353_xc3028_no_i2c_gate,
                                           &dev->i2c_adap);
@@ -606,6 +608,7 @@ static int dvb_fini(struct em28xx *dev)
 
        if (dev->dvb) {
                unregister_dvb(dev->dvb);
+               kfree(dev->dvb);
                dev->dvb = NULL;
        }
 
index af0d935c29be2c52b98397a58501a4dc19feb169..1fb754e208752fa93ec4995740a72dc12abe099e 100644 (file)
@@ -75,6 +75,10 @@ struct em28xx_IR {
        unsigned int repeat_interval;
 
        int  (*get_key)(struct em28xx_IR *, struct em28xx_ir_poll_result *);
+
+       /* IR device properties */
+
+       struct ir_dev_props props;
 };
 
 /**********************************************************
@@ -180,6 +184,36 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
        return 1;
 }
 
+int em28xx_get_key_winfast_usbii_deluxe(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+       unsigned char subaddr, keydetect, key;
+
+       struct i2c_msg msg[] = { { .addr = ir->c->addr, .flags = 0, .buf = &subaddr, .len = 1},
+
+                               { .addr = ir->c->addr, .flags = I2C_M_RD, .buf = &keydetect, .len = 1} };
+
+       subaddr = 0x10;
+       if (2 != i2c_transfer(ir->c->adapter, msg, 2)) {
+               i2cdprintk("read error\n");
+               return -EIO;
+       }
+       if (keydetect == 0x00)
+               return 0;
+
+       subaddr = 0x00;
+       msg[1].buf = &key;
+       if (2 != i2c_transfer(ir->c->adapter, msg, 2)) {
+               i2cdprintk("read error\n");
+       return -EIO;
+       }
+       if (key == 0x00)
+               return 0;
+
+       *ir_key = key;
+       *ir_raw = key;
+       return 1;
+}
+
 /**********************************************************
  Poll based get keycode functions
  **********************************************************/
@@ -336,35 +370,28 @@ static void em28xx_ir_stop(struct em28xx_IR *ir)
        cancel_delayed_work_sync(&ir->work);
 }
 
-int em28xx_ir_init(struct em28xx *dev)
+int em28xx_ir_change_protocol(void *priv, u64 ir_type)
 {
-       struct em28xx_IR *ir;
-       struct input_dev *input_dev;
-       u8 ir_config;
-       int err = -ENOMEM;
-
-       if (dev->board.ir_codes == NULL) {
-               /* No remote control support */
-               return 0;
-       }
-
-       ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-       input_dev = input_allocate_device();
-       if (!ir || !input_dev)
-               goto err_out_free;
-
-       ir->input = input_dev;
-       ir_config = EM2874_IR_RC5;
+       int rc = 0;
+       struct em28xx_IR *ir = priv;
+       struct em28xx *dev = ir->dev;
+       u8 ir_config = EM2874_IR_RC5;
 
        /* Adjust xclk based o IR table for RC5/NEC tables */
-       if (dev->board.ir_codes->ir_type == IR_TYPE_RC5) {
+
+       dev->board.ir_codes->ir_type = IR_TYPE_OTHER;
+       if (ir_type == IR_TYPE_RC5) {
                dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE;
                ir->full_code = 1;
-       } else  if (dev->board.ir_codes->ir_type == IR_TYPE_NEC) {
+       } else if (ir_type == IR_TYPE_NEC) {
                dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE;
                ir_config = EM2874_IR_NEC;
                ir->full_code = 1;
-       }
+       } else
+               rc = -EINVAL;
+
+       dev->board.ir_codes->ir_type = ir_type;
+
        em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk,
                              EM28XX_XCLK_IR_RC5_MODE);
 
@@ -380,9 +407,42 @@ int em28xx_ir_init(struct em28xx *dev)
                break;
        default:
                printk("Unrecognized em28xx chip id: IR not supported\n");
-               goto err_out_free;
+               rc = -EINVAL;
+       }
+
+       return rc;
+}
+
+int em28xx_ir_init(struct em28xx *dev)
+{
+       struct em28xx_IR *ir;
+       struct input_dev *input_dev;
+       int err = -ENOMEM;
+
+       if (dev->board.ir_codes == NULL) {
+               /* No remote control support */
+               return 0;
        }
 
+       ir = kzalloc(sizeof(*ir), GFP_KERNEL);
+       input_dev = input_allocate_device();
+       if (!ir || !input_dev)
+               goto err_out_free;
+
+       /* record handles to ourself */
+       ir->dev = dev;
+       dev->ir = ir;
+
+       ir->input = input_dev;
+
+       /*
+        * em2874 supports more protocols. For now, let's just announce
+        * the two protocols that were already tested
+        */
+       ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC;
+       ir->props.priv = ir;
+       ir->props.change_protocol = em28xx_ir_change_protocol;
+
        /* This is how often we ask the chip for IR information */
        ir->polling = 100; /* ms */
 
@@ -393,6 +453,8 @@ int em28xx_ir_init(struct em28xx *dev)
        usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
        strlcat(ir->phys, "/input0", sizeof(ir->phys));
 
+       /* Set IR protocol */
+       em28xx_ir_change_protocol(ir, dev->board.ir_codes->ir_type);
        err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
        if (err < 0)
                goto err_out_free;
@@ -405,14 +467,13 @@ int em28xx_ir_init(struct em28xx *dev)
        input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
 
        input_dev->dev.parent = &dev->udev->dev;
-       /* record handles to ourself */
-       ir->dev = dev;
-       dev->ir = ir;
+
 
        em28xx_ir_start(ir);
 
        /* all done */
-       err = ir_input_register(ir->input, dev->board.ir_codes);
+       err = ir_input_register(ir->input, dev->board.ir_codes,
+                               &ir->props);
        if (err)
                goto err_out_stop;
 
index 058ac87639ce9a178f8ec5b8b52cf55ece1fca5e..91e90559642b6fb62da927f1511baa85ecc6e2d4 100644 (file)
 /* em2874 IR config register (0x50) */
 #define EM2874_IR_NEC           0x00
 #define EM2874_IR_RC5           0x04
-#define EM2874_IR_RC5_MODE_0    0x08
-#define EM2874_IR_RC5_MODE_6A   0x0b
+#define EM2874_IR_RC6_MODE_0    0x08
+#define EM2874_IR_RC6_MODE_6A   0x0b
 
 /* em2874 Transport Stream Enable Register (0x5f) */
 #define EM2874_TS1_CAPTURE_ENABLE (1 << 0)
index 94943e5a15290b86932eea13150123b50fcfc756..c7dce39823d89ef9e88438074c5353a6597f853c 100644 (file)
@@ -71,7 +71,11 @@ free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
 static int
 vbi_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
 {
-       *size = 720 * 12 * 2;
+       struct em28xx_fh     *fh  = q->priv_data;
+       struct em28xx        *dev = fh->dev;
+
+       *size = dev->vbi_width * dev->vbi_height * 2;
+
        if (0 == *count)
                *count = vbibufs;
        if (*count < 2)
@@ -85,19 +89,18 @@ static int
 vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
            enum v4l2_field field)
 {
+       struct em28xx_fh     *fh  = q->priv_data;
+       struct em28xx        *dev = fh->dev;
        struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb);
        int                  rc = 0;
-       unsigned int size;
-
-       size = 720 * 12 * 2;
 
-       buf->vb.size = size;
+       buf->vb.size = dev->vbi_width * dev->vbi_height * 2;
 
        if (0 != buf->vb.baddr  &&  buf->vb.bsize < buf->vb.size)
                return -EINVAL;
 
-       buf->vb.width  = 720;
-       buf->vb.height = 12;
+       buf->vb.width  = dev->vbi_width;
+       buf->vb.height = dev->vbi_height;
        buf->vb.field  = field;
 
        if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
index 849b18c94037d69974ae59f6368f137440f3faa1..ac2bd935927e713e19e0ee67ef861f0154e33a86 100644 (file)
@@ -282,7 +282,7 @@ static void em28xx_copy_vbi(struct em28xx *dev,
 {
        void *startwrite, *startread;
        int  offset;
-       int bytesperline = 720;
+       int bytesperline = dev->vbi_width;
 
        if (dev == NULL) {
                em28xx_isocdbg("dev is null\n");
@@ -323,8 +323,8 @@ static void em28xx_copy_vbi(struct em28xx *dev,
 
        /* Make sure the bottom field populates the second half of the frame */
        if (buf->top_field == 0) {
-               startwrite += bytesperline * 0x0c;
-               offset += bytesperline * 0x0c;
+               startwrite += bytesperline * dev->vbi_height;
+               offset += bytesperline * dev->vbi_height;
        }
 
        memcpy(startwrite, startread, len);
@@ -578,8 +578,7 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
                        dev->cur_field = p[2];
                }
 
-               /* FIXME: get rid of hard-coded value */
-               vbi_size = 720 * 0x0c;
+               vbi_size = dev->vbi_width * dev->vbi_height;
 
                if (dev->capture_type == 0) {
                        if (dev->vbi_read >= vbi_size) {
@@ -1850,18 +1849,27 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
 static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
                                struct v4l2_format *format)
 {
-       format->fmt.vbi.samples_per_line = 720;
+       struct em28xx_fh      *fh  = priv;
+       struct em28xx         *dev = fh->dev;
+
+       format->fmt.vbi.samples_per_line = dev->vbi_width;
        format->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
        format->fmt.vbi.offset = 0;
        format->fmt.vbi.flags = 0;
+       format->fmt.vbi.sampling_rate = 6750000 * 4 / 2;
+       format->fmt.vbi.count[0] = dev->vbi_height;
+       format->fmt.vbi.count[1] = dev->vbi_height;
 
        /* Varies by video standard (NTSC, PAL, etc.) */
-       /* FIXME: hard-coded for NTSC support */
-       format->fmt.vbi.sampling_rate = 6750000 * 4 / 2; /* FIXME: ??? */
-       format->fmt.vbi.count[0] = 12;
-       format->fmt.vbi.count[1] = 12;
-       format->fmt.vbi.start[0] = 10;
-       format->fmt.vbi.start[1] = 273;
+       if (dev->norm & V4L2_STD_525_60) {
+               /* NTSC */
+               format->fmt.vbi.start[0] = 10;
+               format->fmt.vbi.start[1] = 273;
+       } else if (dev->norm & V4L2_STD_625_50) {
+               /* PAL */
+               format->fmt.vbi.start[0] = 6;
+               format->fmt.vbi.start[1] = 318;
+       }
 
        return 0;
 }
@@ -1869,18 +1877,27 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
 static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv,
                                struct v4l2_format *format)
 {
-       format->fmt.vbi.samples_per_line = 720;
+       struct em28xx_fh      *fh  = priv;
+       struct em28xx         *dev = fh->dev;
+
+       format->fmt.vbi.samples_per_line = dev->vbi_width;
        format->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
        format->fmt.vbi.offset = 0;
        format->fmt.vbi.flags = 0;
+       format->fmt.vbi.sampling_rate = 6750000 * 4 / 2;
+       format->fmt.vbi.count[0] = dev->vbi_height;
+       format->fmt.vbi.count[1] = dev->vbi_height;
 
        /* Varies by video standard (NTSC, PAL, etc.) */
-       /* FIXME: hard-coded for NTSC support */
-       format->fmt.vbi.sampling_rate = 6750000 * 4 / 2; /* FIXME: ??? */
-       format->fmt.vbi.count[0] = 12;
-       format->fmt.vbi.count[1] = 12;
-       format->fmt.vbi.start[0] = 10;
-       format->fmt.vbi.start[1] = 273;
+       if (dev->norm & V4L2_STD_525_60) {
+               /* NTSC */
+               format->fmt.vbi.start[0] = 10;
+               format->fmt.vbi.start[1] = 273;
+       } else if (dev->norm & V4L2_STD_625_50) {
+               /* PAL */
+               format->fmt.vbi.start[0] = 6;
+               format->fmt.vbi.start[1] = 318;
+       }
 
        return 0;
 }
@@ -1922,7 +1939,8 @@ static int vidioc_querybuf(struct file *file, void *priv,
                   At a minimum, it causes a crash in zvbi since it does
                   a memcpy based on the source buffer length */
                int result = videobuf_querybuf(&fh->vb_vbiq, b);
-               b->length = 17280;
+               b->length = dev->vbi_width * dev->vbi_height * 2;
+
                return result;
        }
 }
index 80d9b4fa1b971adad8ad63233c65355e3c7ba05b..ba6fe5daff8420adc2825f4310064f75f0a179f4 100644 (file)
 #define EM2861_BOARD_GADMEI_UTV330PLUS           72
 #define EM2870_BOARD_REDDO_DVB_C_USB_BOX          73
 #define EM2800_BOARD_VC211A                      74
+#define EM2882_BOARD_DIKOM_DK300                 75
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
@@ -552,7 +553,8 @@ struct em28xx {
        int capture_type;
        int vbi_read;
        unsigned char cur_field;
-
+       unsigned int vbi_width;
+       unsigned int vbi_height; /* lines per field */
 
        struct work_struct         request_module_wk;
 
@@ -693,6 +695,8 @@ int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
 int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
 int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
                                     u32 *ir_raw);
+int em28xx_get_key_winfast_usbii_deluxe(struct IR_i2c *ir, u32 *ir_key,
+                                    u32 *ir_raw);
 void em28xx_register_snapshot_button(struct em28xx *dev);
 void em28xx_deregister_snapshot_button(struct em28xx *dev);
 
index dcc1a033544001b44e476614fce6799eb1121317..87981b078fe64d40d29ccfaca3a625e23331ce55 100644 (file)
@@ -1,7 +1,11 @@
 config USB_ET61X251
-       tristate "USB ET61X[12]51 PC Camera Controller support"
+       tristate "USB ET61X[12]51 PC Camera Controller support (DEPRECATED)"
        depends on VIDEO_V4L2
+       default n
        ---help---
+         This driver is DEPRECATED please use the gspca zc3xx module
+         instead.
+
          Say Y here if you want support for cameras based on Etoms ET61X151
          or ET61X251 PC Camera Controllers.
 
index 609d65b0b10d4b226533a06a7718434ab23c2814..e0060c1f0544c9b08b12b0f32deb45f29044a1c4 100644 (file)
@@ -21,6 +21,15 @@ source "drivers/media/video/gspca/m5602/Kconfig"
 source "drivers/media/video/gspca/stv06xx/Kconfig"
 source "drivers/media/video/gspca/gl860/Kconfig"
 
+config USB_GSPCA_BENQ
+       tristate "Benq USB Camera Driver"
+       depends on VIDEO_V4L2 && USB_GSPCA
+       help
+         Say Y here if you want support for the Benq DC E300 camera.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gspca_benq.
+
 config USB_GSPCA_CONEX
        tristate "Conexant Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
@@ -30,6 +39,17 @@ config USB_GSPCA_CONEX
          To compile this driver as a module, choose M here: the
          module will be called gspca_conex.
 
+config USB_GSPCA_CPIA1
+       tristate "cpia CPiA (version 1) Camera Driver"
+       depends on VIDEO_V4L2 && USB_GSPCA
+       help
+         Say Y here if you want support for USB cameras based on the cpia
+         CPiA chip. Note that you need atleast version 0.6.4 of libv4l for
+         applications to understand the videoformat generated by this driver.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gspca_cpia1.
+
 config USB_GSPCA_ETOMS
        tristate "Etoms USB Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
@@ -86,15 +106,25 @@ config USB_GSPCA_OV519
          module will be called gspca_ov519.
 
 config USB_GSPCA_OV534
-       tristate "OV534 USB Camera Driver"
+       tristate "OV534 OV772x USB Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
        help
-         Say Y here if you want support for cameras based on the OV534 chip.
-         (e.g. Sony Playstation EYE)
+         Say Y here if you want support for cameras based on the OV534 chip
+         and sensor OV772x (e.g. Sony Playstation EYE)
 
          To compile this driver as a module, choose M here: the
          module will be called gspca_ov534.
 
+config USB_GSPCA_OV534_9
+       tristate "OV534 OV965x USB Camera Driver"
+       depends on VIDEO_V4L2 && USB_GSPCA
+       help
+         Say Y here if you want support for cameras based on the OV534 chip
+         and sensor OV965x (e.g. Hercules Dualpix)
+
+         To compile this driver as a module, choose M here: the
+         module will be called gspca_ov534_9.
+
 config USB_GSPCA_PAC207
        tristate "Pixart PAC207 USB Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
@@ -122,6 +152,16 @@ config USB_GSPCA_PAC7311
          To compile this driver as a module, choose M here: the
          module will be called gspca_pac7311.
 
+config USB_GSPCA_SN9C2028
+       tristate "SONIX Dual-Mode USB Camera Driver"
+       depends on VIDEO_V4L2 && USB_GSPCA
+       help
+         Say Y here if you want streaming support for Sonix SN9C2028 cameras.
+         These are supported as stillcams in libgphoto2/camlibs/sonix.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gspca_sn9c2028.
+
 config USB_GSPCA_SN9C20X
        tristate "SN9C20X USB Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
index ff2c7279d82e66fe086a0ccf84430e53822596b2..6e4cf1ce01c9f5044a1500cb01decdc66c87d6f0 100644 (file)
@@ -1,5 +1,7 @@
 obj-$(CONFIG_USB_GSPCA)          += gspca_main.o
+obj-$(CONFIG_USB_GSPCA_BENQ)     += gspca_benq.o
 obj-$(CONFIG_USB_GSPCA_CONEX)    += gspca_conex.o
+obj-$(CONFIG_USB_GSPCA_CPIA1)    += gspca_cpia1.o
 obj-$(CONFIG_USB_GSPCA_ETOMS)    += gspca_etoms.o
 obj-$(CONFIG_USB_GSPCA_FINEPIX)  += gspca_finepix.o
 obj-$(CONFIG_USB_GSPCA_JEILINJ)  += gspca_jeilinj.o
@@ -7,9 +9,11 @@ obj-$(CONFIG_USB_GSPCA_MARS)     += gspca_mars.o
 obj-$(CONFIG_USB_GSPCA_MR97310A) += gspca_mr97310a.o
 obj-$(CONFIG_USB_GSPCA_OV519)    += gspca_ov519.o
 obj-$(CONFIG_USB_GSPCA_OV534)    += gspca_ov534.o
+obj-$(CONFIG_USB_GSPCA_OV534_9)  += gspca_ov534_9.o
 obj-$(CONFIG_USB_GSPCA_PAC207)   += gspca_pac207.o
 obj-$(CONFIG_USB_GSPCA_PAC7302)  += gspca_pac7302.o
 obj-$(CONFIG_USB_GSPCA_PAC7311)  += gspca_pac7311.o
+obj-$(CONFIG_USB_GSPCA_SN9C2028) += gspca_sn9c2028.o
 obj-$(CONFIG_USB_GSPCA_SN9C20X)  += gspca_sn9c20x.o
 obj-$(CONFIG_USB_GSPCA_SONIXB)   += gspca_sonixb.o
 obj-$(CONFIG_USB_GSPCA_SONIXJ)   += gspca_sonixj.o
@@ -30,7 +34,9 @@ obj-$(CONFIG_USB_GSPCA_VC032X)   += gspca_vc032x.o
 obj-$(CONFIG_USB_GSPCA_ZC3XX)    += gspca_zc3xx.o
 
 gspca_main-objs     := gspca.o
+gspca_benq-objs     := benq.o
 gspca_conex-objs    := conex.o
+gspca_cpia1-objs    := cpia1.o
 gspca_etoms-objs    := etoms.o
 gspca_finepix-objs  := finepix.o
 gspca_jeilinj-objs  := jeilinj.o
@@ -38,9 +44,11 @@ gspca_mars-objs     := mars.o
 gspca_mr97310a-objs := mr97310a.o
 gspca_ov519-objs    := ov519.o
 gspca_ov534-objs    := ov534.o
+gspca_ov534_9-objs  := ov534_9.o
 gspca_pac207-objs   := pac207.o
 gspca_pac7302-objs  := pac7302.o
 gspca_pac7311-objs  := pac7311.o
+gspca_sn9c2028-objs := sn9c2028.o
 gspca_sn9c20x-objs  := sn9c20x.o
 gspca_sonixb-objs   := sonixb.o
 gspca_sonixj-objs   := sonixj.o
diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c
new file mode 100644 (file)
index 0000000..43ac4af
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * Benq DC E300 subdriver
+ *
+ * Copyright (C) 2009 Jean-Francois Moine (http://moinejf.free.fr)
+ *
+ * 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
+ * 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
+ */
+
+#define MODULE_NAME "benq"
+
+#include "gspca.h"
+
+MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
+MODULE_DESCRIPTION("Benq DC E300 USB Camera Driver");
+MODULE_LICENSE("GPL");
+
+/* specific webcam descriptor */
+struct sd {
+       struct gspca_dev gspca_dev;     /* !! must be the first item */
+};
+
+/* V4L2 controls supported by the driver */
+static const struct ctrl sd_ctrls[] = {
+};
+
+static const struct v4l2_pix_format vga_mode[] = {
+       {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 320,
+               .sizeimage = 320 * 240 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+};
+
+static void sd_isoc_irq(struct urb *urb);
+
+/* -- write a register -- */
+static void reg_w(struct gspca_dev *gspca_dev,
+                       u16 value, u16 index)
+{
+       struct usb_device *dev = gspca_dev->dev;
+       int ret;
+
+       if (gspca_dev->usb_err < 0)
+               return;
+       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+                       0x02,
+                       USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                       value,
+                       index,
+                       NULL,
+                       0,
+                       500);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "reg_w err %d", ret);
+               gspca_dev->usb_err = ret;
+       }
+}
+
+/* this function is called at probe time */
+static int sd_config(struct gspca_dev *gspca_dev,
+                       const struct usb_device_id *id)
+{
+       gspca_dev->cam.cam_mode = vga_mode;
+       gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
+       gspca_dev->cam.no_urb_create = 1;
+       gspca_dev->cam.reverse_alts = 1;
+       return 0;
+}
+
+/* this function is called at probe and resume time */
+static int sd_init(struct gspca_dev *gspca_dev)
+{
+       return 0;
+}
+
+static int sd_isoc_init(struct gspca_dev *gspca_dev)
+{
+       int ret;
+
+       ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface,
+               gspca_dev->nbalt - 1);
+       if (ret < 0) {
+               err("usb_set_interface failed");
+               return ret;
+       }
+/*     reg_w(gspca_dev, 0x0003, 0x0002); */
+       return 0;
+}
+
+/* -- start the camera -- */
+static int sd_start(struct gspca_dev *gspca_dev)
+{
+       struct urb *urb;
+       int i, n;
+
+       /* create 4 URBs - 2 on endpoint 0x83 and 2 on 0x082 */
+#if MAX_NURBS < 4
+#error "Not enough URBs in the gspca table"
+#endif
+#define SD_PKT_SZ 64
+#define SD_NPKT 32
+       for (n = 0; n < 4; n++) {
+               urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL);
+               if (!urb) {
+                       err("usb_alloc_urb failed");
+                       return -ENOMEM;
+               }
+               gspca_dev->urb[n] = urb;
+               urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
+                                               SD_PKT_SZ * SD_NPKT,
+                                               GFP_KERNEL,
+                                               &urb->transfer_dma);
+
+               if (urb->transfer_buffer == NULL) {
+                       err("usb_buffer_alloc failed");
+                       return -ENOMEM;
+               }
+               urb->dev = gspca_dev->dev;
+               urb->context = gspca_dev;
+               urb->transfer_buffer_length = SD_PKT_SZ * SD_NPKT;
+               urb->pipe = usb_rcvisocpipe(gspca_dev->dev,
+                                       n & 1 ? 0x82 : 0x83);
+               urb->transfer_flags = URB_ISO_ASAP
+                                       | URB_NO_TRANSFER_DMA_MAP;
+               urb->interval = 1;
+               urb->complete = sd_isoc_irq;
+               urb->number_of_packets = SD_NPKT;
+               for (i = 0; i < SD_NPKT; i++) {
+                       urb->iso_frame_desc[i].length = SD_PKT_SZ;
+                       urb->iso_frame_desc[i].offset = SD_PKT_SZ * i;
+               }
+       }
+
+       return gspca_dev->usb_err;
+}
+
+static void sd_stopN(struct gspca_dev *gspca_dev)
+{
+       reg_w(gspca_dev, 0x003c, 0x0003);
+       reg_w(gspca_dev, 0x003c, 0x0004);
+       reg_w(gspca_dev, 0x003c, 0x0005);
+       reg_w(gspca_dev, 0x003c, 0x0006);
+       reg_w(gspca_dev, 0x003c, 0x0007);
+       usb_set_interface(gspca_dev->dev, gspca_dev->iface, gspca_dev->nbalt - 1);
+}
+
+static void sd_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* isoc packet */
+                       int len)                /* iso packet length */
+{
+       /* unused */
+}
+
+/* reception of an URB */
+static void sd_isoc_irq(struct urb *urb)
+{
+       struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
+       struct urb *urb0;
+       u8 *data;
+       int i, st;
+
+       PDEBUG(D_PACK, "sd isoc irq");
+       if (!gspca_dev->streaming)
+               return;
+       if (urb->status != 0) {
+               if (urb->status == -ESHUTDOWN)
+                       return;         /* disconnection */
+#ifdef CONFIG_PM
+               if (gspca_dev->frozen)
+                       return;
+#endif
+               PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status);
+               return;
+       }
+
+       /* if this is a control URN (ep 0x83), wait */
+       if (urb == gspca_dev->urb[0] || urb == gspca_dev->urb[2])
+               return;
+
+       /* scan both received URBs */
+       if (urb == gspca_dev->urb[1])
+               urb0 = gspca_dev->urb[0];
+       else
+               urb0 = gspca_dev->urb[2];
+       for (i = 0; i < urb->number_of_packets; i++) {
+
+               /* check the packet status and length */
+               if (urb0->iso_frame_desc[i].actual_length != SD_PKT_SZ
+                   || urb->iso_frame_desc[i].actual_length != SD_PKT_SZ) {
+                       PDEBUG(D_ERR, "ISOC bad lengths %d / %d",
+                               urb0->iso_frame_desc[i].actual_length,
+                               urb->iso_frame_desc[i].actual_length);
+                       gspca_dev->last_packet_type = DISCARD_PACKET;
+                       continue;
+               }
+               st = urb0->iso_frame_desc[i].status;
+               if (st == 0)
+                       st = urb->iso_frame_desc[i].status;
+               if (st) {
+                       PDEBUG(D_ERR,
+                               "ISOC data error: [%d] status=%d",
+                               i, st);
+                       gspca_dev->last_packet_type = DISCARD_PACKET;
+                       continue;
+               }
+
+               /*
+                * The images are received in URBs of different endpoints
+                * (0x83 and 0x82).
+                * Image pieces in URBs of ep 0x83 are continuated in URBs of
+                * ep 0x82 of the same index.
+                * The packets in the URBs of endpoint 0x83 start with:
+                *      - 80 ba/bb 00 00 = start of image followed by 'ff d8'
+                *      - 04 ba/bb oo oo = image piece
+                *              where 'oo oo' is the image offset
+                                               (not cheked)
+                *      - (other -> bad frame)
+                * The images are JPEG encoded with full header and
+                * normal ff escape.
+                * The end of image ('ff d9') may occur in any URB.
+                * (not cheked)
+                */
+               data = (u8 *) urb0->transfer_buffer
+                                       + urb0->iso_frame_desc[i].offset;
+               if (data[0] == 0x80 && (data[1] & 0xfe) == 0xba) {
+
+                       /* new image */
+                       gspca_frame_add(gspca_dev, LAST_PACKET,
+                                       NULL, 0);
+                       gspca_frame_add(gspca_dev, FIRST_PACKET,
+                                       data + 4, SD_PKT_SZ - 4);
+               } else if (data[0] == 0x04 && (data[1] & 0xfe) == 0xba) {
+                       gspca_frame_add(gspca_dev, INTER_PACKET,
+                                       data + 4, SD_PKT_SZ - 4);
+               } else {
+                       gspca_dev->last_packet_type = DISCARD_PACKET;
+                       continue;
+               }
+               data = (u8 *) urb->transfer_buffer
+                                       + urb->iso_frame_desc[i].offset;
+                       gspca_frame_add(gspca_dev, INTER_PACKET,
+                                       data, SD_PKT_SZ);
+       }
+
+       /* resubmit the URBs */
+       st = usb_submit_urb(urb0, GFP_ATOMIC);
+       if (st < 0)
+               PDEBUG(D_ERR|D_PACK, "usb_submit_urb(0) ret %d", st);
+       st = usb_submit_urb(urb, GFP_ATOMIC);
+       if (st < 0)
+               PDEBUG(D_ERR|D_PACK, "usb_submit_urb() ret %d", st);
+}
+
+/* sub-driver description */
+static const struct sd_desc sd_desc = {
+       .name = MODULE_NAME,
+       .ctrls = sd_ctrls,
+       .nctrls = ARRAY_SIZE(sd_ctrls),
+       .config = sd_config,
+       .init = sd_init,
+       .isoc_init = sd_isoc_init,
+       .start = sd_start,
+       .stopN = sd_stopN,
+       .pkt_scan = sd_pkt_scan,
+};
+
+/* -- module initialisation -- */
+static const __devinitdata struct usb_device_id device_table[] = {
+       {USB_DEVICE(0x04a5, 0x3035)},
+       {}
+};
+MODULE_DEVICE_TABLE(usb, device_table);
+
+/* -- device connect -- */
+static int sd_probe(struct usb_interface *intf,
+                       const struct usb_device_id *id)
+{
+       return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
+                               THIS_MODULE);
+}
+
+static struct usb_driver sd_driver = {
+       .name = MODULE_NAME,
+       .id_table = device_table,
+       .probe = sd_probe,
+       .disconnect = gspca_disconnect,
+#ifdef CONFIG_PM
+       .suspend = gspca_suspend,
+       .resume = gspca_resume,
+#endif
+};
+
+/* -- module insert / remove -- */
+static int __init sd_mod_init(void)
+{
+       int ret;
+
+       ret = usb_register(&sd_driver);
+       if (ret < 0)
+               return ret;
+       info("registered");
+       return 0;
+}
+static void __exit sd_mod_exit(void)
+{
+       usb_deregister(&sd_driver);
+       info("deregistered");
+}
+
+module_init(sd_mod_init);
+module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/coarse_expo_autogain.h b/drivers/media/video/gspca/coarse_expo_autogain.h
new file mode 100644 (file)
index 0000000..1cb9d94
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Auto gain algorithm for camera's with a coarse exposure control
+ *
+ * Copyright (C) 2010 Hans de Goede <hdegoede@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.
+ *
+ * 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
+ */
+
+/* Autogain + exposure algorithm for cameras with a coarse exposure control
+   (usually this means we can only control the clockdiv to change exposure)
+   As changing the clockdiv so that the fps drops from 30 to 15 fps for
+   example, will lead to a huge exposure change (it effectively doubles),
+   this algorithm normally tries to only adjust the gain (between 40 and
+   80 %) and if that does not help, only then changes exposure. This leads
+   to a much more stable image then using the knee algorithm which at
+   certain points of the knee graph will only try to adjust exposure,
+   which leads to oscilating as one exposure step is huge.
+
+   Note this assumes that the sd struct for the cam in question has
+   exp_too_high_cnt and exp_too_high_cnt int members for use by this function.
+
+   Returns 0 if no changes were made, 1 if the gain and or exposure settings
+   where changed. */
+static int gspca_coarse_grained_expo_autogain(struct gspca_dev *gspca_dev,
+       int avg_lum, int desired_avg_lum, int deadzone)
+{
+       int i, steps, gain, orig_gain, exposure, orig_exposure;
+       int gain_low, gain_high;
+       const struct ctrl *gain_ctrl = NULL;
+       const struct ctrl *exposure_ctrl = NULL;
+       struct sd *sd = (struct sd *) gspca_dev;
+       int retval = 0;
+
+       for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) {
+               if (gspca_dev->ctrl_dis & (1 << i))
+                       continue;
+               if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_GAIN)
+                       gain_ctrl = &gspca_dev->sd_desc->ctrls[i];
+               if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_EXPOSURE)
+                       exposure_ctrl = &gspca_dev->sd_desc->ctrls[i];
+       }
+       if (!gain_ctrl || !exposure_ctrl) {
+               PDEBUG(D_ERR, "Error: gspca_coarse_grained_expo_autogain "
+                       "called on cam without gain or exposure");
+               return 0;
+       }
+
+       if (gain_ctrl->get(gspca_dev, &gain) ||
+           exposure_ctrl->get(gspca_dev, &exposure))
+               return 0;
+
+       orig_gain = gain;
+       orig_exposure = exposure;
+       gain_low =
+               (gain_ctrl->qctrl.maximum - gain_ctrl->qctrl.minimum) / 5 * 2;
+       gain_low += gain_ctrl->qctrl.minimum;
+       gain_high =
+               (gain_ctrl->qctrl.maximum - gain_ctrl->qctrl.minimum) / 5 * 4;
+       gain_high += gain_ctrl->qctrl.minimum;
+
+       /* If we are of a multiple of deadzone, do multiple steps to reach the
+          desired lumination fast (with the risc of a slight overshoot) */
+       steps = (desired_avg_lum - avg_lum) / deadzone;
+
+       PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d",
+               avg_lum, desired_avg_lum, steps);
+
+       if ((gain + steps) > gain_high &&
+           sd->exposure < exposure_ctrl->qctrl.maximum) {
+               gain = gain_high;
+               sd->exp_too_low_cnt++;
+       } else if ((gain + steps) < gain_low &&
+                  sd->exposure > exposure_ctrl->qctrl.minimum) {
+               gain = gain_low;
+               sd->exp_too_high_cnt++;
+       } else {
+               gain += steps;
+               if (gain > gain_ctrl->qctrl.maximum)
+                       gain = gain_ctrl->qctrl.maximum;
+               else if (gain < gain_ctrl->qctrl.minimum)
+                       gain = gain_ctrl->qctrl.minimum;
+               sd->exp_too_high_cnt = 0;
+               sd->exp_too_low_cnt = 0;
+       }
+
+       if (sd->exp_too_high_cnt > 3) {
+               exposure--;
+               sd->exp_too_high_cnt = 0;
+       } else if (sd->exp_too_low_cnt > 3) {
+               exposure++;
+               sd->exp_too_low_cnt = 0;
+       }
+
+       if (gain != orig_gain) {
+               gain_ctrl->set(gspca_dev, gain);
+               retval = 1;
+       }
+       if (exposure != orig_exposure) {
+               exposure_ctrl->set(gspca_dev, exposure);
+               retval = 1;
+       }
+
+       return retval;
+}
index c98b5d69c43809e8f04f9f7161be0f445aa26efd..19fe6b24c9a34062b8d85c8f56216d323df86ad2 100644 (file)
@@ -52,7 +52,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -1032,7 +1032,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c
new file mode 100644 (file)
index 0000000..82945ed
--- /dev/null
@@ -0,0 +1,2022 @@
+/*
+ * cpia CPiA (1) gspca driver
+ *
+ * Copyright (C) 2010 Hans de Goede <hdgoede@redhat.com>
+ *
+ * This module is adapted from the in kernel v4l1 cpia driver which is :
+ *
+ * (C) Copyright 1999-2000 Peter Pregler
+ * (C) Copyright 1999-2000 Scott J. Bertin
+ * (C) Copyright 1999-2000 Johannes Erdfelt <johannes@erdfelt.com>
+ * (C) Copyright 2000 STMicroelectronics
+ *
+ * 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
+ *
+ */
+
+#define MODULE_NAME "cpia1"
+
+#include "gspca.h"
+
+MODULE_AUTHOR("Hans de Goede <hdgoede@redhat.com>");
+MODULE_DESCRIPTION("Vision CPiA");
+MODULE_LICENSE("GPL");
+
+/* constant value's */
+#define MAGIC_0                0x19
+#define MAGIC_1                0x68
+#define DATA_IN                0xC0
+#define DATA_OUT       0x40
+#define VIDEOSIZE_QCIF 0       /* 176x144 */
+#define VIDEOSIZE_CIF  1       /* 352x288 */
+#define SUBSAMPLE_420  0
+#define SUBSAMPLE_422  1
+#define YUVORDER_YUYV  0
+#define YUVORDER_UYVY  1
+#define NOT_COMPRESSED 0
+#define COMPRESSED     1
+#define NO_DECIMATION  0
+#define DECIMATION_ENAB        1
+#define EOI            0xff    /* End Of Image */
+#define EOL            0xfd    /* End Of Line */
+#define FRAME_HEADER_SIZE      64
+
+/* Image grab modes */
+#define CPIA_GRAB_SINGLE       0
+#define CPIA_GRAB_CONTINEOUS   1
+
+/* Compression parameters */
+#define CPIA_COMPRESSION_NONE  0
+#define CPIA_COMPRESSION_AUTO  1
+#define CPIA_COMPRESSION_MANUAL        2
+#define CPIA_COMPRESSION_TARGET_QUALITY         0
+#define CPIA_COMPRESSION_TARGET_FRAMERATE       1
+
+/* Return offsets for GetCameraState */
+#define SYSTEMSTATE    0
+#define GRABSTATE      1
+#define STREAMSTATE    2
+#define FATALERROR     3
+#define CMDERROR       4
+#define DEBUGFLAGS     5
+#define VPSTATUS       6
+#define ERRORCODE      7
+
+/* SystemState */
+#define UNINITIALISED_STATE    0
+#define PASS_THROUGH_STATE     1
+#define LO_POWER_STATE         2
+#define HI_POWER_STATE         3
+#define WARM_BOOT_STATE                4
+
+/* GrabState */
+#define GRAB_IDLE              0
+#define GRAB_ACTIVE            1
+#define GRAB_DONE              2
+
+/* StreamState */
+#define STREAM_NOT_READY       0
+#define STREAM_READY           1
+#define STREAM_OPEN            2
+#define STREAM_PAUSED          3
+#define STREAM_FINISHED                4
+
+/* Fatal Error, CmdError, and DebugFlags */
+#define CPIA_FLAG        1
+#define SYSTEM_FLAG      2
+#define INT_CTRL_FLAG    4
+#define PROCESS_FLAG     8
+#define COM_FLAG        16
+#define VP_CTRL_FLAG    32
+#define CAPTURE_FLAG    64
+#define DEBUG_FLAG     128
+
+/* VPStatus */
+#define VP_STATE_OK                    0x00
+
+#define VP_STATE_FAILED_VIDEOINIT      0x01
+#define VP_STATE_FAILED_AECACBINIT     0x02
+#define VP_STATE_AEC_MAX               0x04
+#define VP_STATE_ACB_BMAX              0x08
+
+#define VP_STATE_ACB_RMIN              0x10
+#define VP_STATE_ACB_GMIN              0x20
+#define VP_STATE_ACB_RMAX              0x40
+#define VP_STATE_ACB_GMAX              0x80
+
+/* default (minimum) compensation values */
+#define COMP_RED        220
+#define COMP_GREEN1     214
+#define COMP_GREEN2     COMP_GREEN1
+#define COMP_BLUE       230
+
+/* exposure status */
+#define EXPOSURE_VERY_LIGHT 0
+#define EXPOSURE_LIGHT      1
+#define EXPOSURE_NORMAL     2
+#define EXPOSURE_DARK       3
+#define EXPOSURE_VERY_DARK  4
+
+#define CPIA_MODULE_CPIA                       (0 << 5)
+#define CPIA_MODULE_SYSTEM                     (1 << 5)
+#define CPIA_MODULE_VP_CTRL                    (5 << 5)
+#define CPIA_MODULE_CAPTURE                    (6 << 5)
+#define CPIA_MODULE_DEBUG                      (7 << 5)
+
+#define INPUT (DATA_IN << 8)
+#define OUTPUT (DATA_OUT << 8)
+
+#define CPIA_COMMAND_GetCPIAVersion    (INPUT | CPIA_MODULE_CPIA | 1)
+#define CPIA_COMMAND_GetPnPID          (INPUT | CPIA_MODULE_CPIA | 2)
+#define CPIA_COMMAND_GetCameraStatus   (INPUT | CPIA_MODULE_CPIA | 3)
+#define CPIA_COMMAND_GotoHiPower       (OUTPUT | CPIA_MODULE_CPIA | 4)
+#define CPIA_COMMAND_GotoLoPower       (OUTPUT | CPIA_MODULE_CPIA | 5)
+#define CPIA_COMMAND_GotoSuspend       (OUTPUT | CPIA_MODULE_CPIA | 7)
+#define CPIA_COMMAND_GotoPassThrough   (OUTPUT | CPIA_MODULE_CPIA | 8)
+#define CPIA_COMMAND_ModifyCameraStatus        (OUTPUT | CPIA_MODULE_CPIA | 10)
+
+#define CPIA_COMMAND_ReadVCRegs                (INPUT | CPIA_MODULE_SYSTEM | 1)
+#define CPIA_COMMAND_WriteVCReg                (OUTPUT | CPIA_MODULE_SYSTEM | 2)
+#define CPIA_COMMAND_ReadMCPorts       (INPUT | CPIA_MODULE_SYSTEM | 3)
+#define CPIA_COMMAND_WriteMCPort       (OUTPUT | CPIA_MODULE_SYSTEM | 4)
+#define CPIA_COMMAND_SetBaudRate       (OUTPUT | CPIA_MODULE_SYSTEM | 5)
+#define CPIA_COMMAND_SetECPTiming      (OUTPUT | CPIA_MODULE_SYSTEM | 6)
+#define CPIA_COMMAND_ReadIDATA         (INPUT | CPIA_MODULE_SYSTEM | 7)
+#define CPIA_COMMAND_WriteIDATA                (OUTPUT | CPIA_MODULE_SYSTEM | 8)
+#define CPIA_COMMAND_GenericCall       (OUTPUT | CPIA_MODULE_SYSTEM | 9)
+#define CPIA_COMMAND_I2CStart          (OUTPUT | CPIA_MODULE_SYSTEM | 10)
+#define CPIA_COMMAND_I2CStop           (OUTPUT | CPIA_MODULE_SYSTEM | 11)
+#define CPIA_COMMAND_I2CWrite          (OUTPUT | CPIA_MODULE_SYSTEM | 12)
+#define CPIA_COMMAND_I2CRead           (INPUT | CPIA_MODULE_SYSTEM | 13)
+
+#define CPIA_COMMAND_GetVPVersion      (INPUT | CPIA_MODULE_VP_CTRL | 1)
+#define CPIA_COMMAND_ResetFrameCounter (INPUT | CPIA_MODULE_VP_CTRL | 2)
+#define CPIA_COMMAND_SetColourParams   (OUTPUT | CPIA_MODULE_VP_CTRL | 3)
+#define CPIA_COMMAND_SetExposure       (OUTPUT | CPIA_MODULE_VP_CTRL | 4)
+#define CPIA_COMMAND_SetColourBalance  (OUTPUT | CPIA_MODULE_VP_CTRL | 6)
+#define CPIA_COMMAND_SetSensorFPS      (OUTPUT | CPIA_MODULE_VP_CTRL | 7)
+#define CPIA_COMMAND_SetVPDefaults     (OUTPUT | CPIA_MODULE_VP_CTRL | 8)
+#define CPIA_COMMAND_SetApcor          (OUTPUT | CPIA_MODULE_VP_CTRL | 9)
+#define CPIA_COMMAND_SetFlickerCtrl    (OUTPUT | CPIA_MODULE_VP_CTRL | 10)
+#define CPIA_COMMAND_SetVLOffset       (OUTPUT | CPIA_MODULE_VP_CTRL | 11)
+#define CPIA_COMMAND_GetColourParams   (INPUT | CPIA_MODULE_VP_CTRL | 16)
+#define CPIA_COMMAND_GetColourBalance  (INPUT | CPIA_MODULE_VP_CTRL | 17)
+#define CPIA_COMMAND_GetExposure       (INPUT | CPIA_MODULE_VP_CTRL | 18)
+#define CPIA_COMMAND_SetSensorMatrix   (OUTPUT | CPIA_MODULE_VP_CTRL | 19)
+#define CPIA_COMMAND_ColourBars                (OUTPUT | CPIA_MODULE_VP_CTRL | 25)
+#define CPIA_COMMAND_ReadVPRegs                (INPUT | CPIA_MODULE_VP_CTRL | 30)
+#define CPIA_COMMAND_WriteVPReg                (OUTPUT | CPIA_MODULE_VP_CTRL | 31)
+
+#define CPIA_COMMAND_GrabFrame         (OUTPUT | CPIA_MODULE_CAPTURE | 1)
+#define CPIA_COMMAND_UploadFrame       (OUTPUT | CPIA_MODULE_CAPTURE | 2)
+#define CPIA_COMMAND_SetGrabMode       (OUTPUT | CPIA_MODULE_CAPTURE | 3)
+#define CPIA_COMMAND_InitStreamCap     (OUTPUT | CPIA_MODULE_CAPTURE | 4)
+#define CPIA_COMMAND_FiniStreamCap     (OUTPUT | CPIA_MODULE_CAPTURE | 5)
+#define CPIA_COMMAND_StartStreamCap    (OUTPUT | CPIA_MODULE_CAPTURE | 6)
+#define CPIA_COMMAND_EndStreamCap      (OUTPUT | CPIA_MODULE_CAPTURE | 7)
+#define CPIA_COMMAND_SetFormat         (OUTPUT | CPIA_MODULE_CAPTURE | 8)
+#define CPIA_COMMAND_SetROI            (OUTPUT | CPIA_MODULE_CAPTURE | 9)
+#define CPIA_COMMAND_SetCompression    (OUTPUT | CPIA_MODULE_CAPTURE | 10)
+#define CPIA_COMMAND_SetCompressionTarget (OUTPUT | CPIA_MODULE_CAPTURE | 11)
+#define CPIA_COMMAND_SetYUVThresh      (OUTPUT | CPIA_MODULE_CAPTURE | 12)
+#define CPIA_COMMAND_SetCompressionParams (OUTPUT | CPIA_MODULE_CAPTURE | 13)
+#define CPIA_COMMAND_DiscardFrame      (OUTPUT | CPIA_MODULE_CAPTURE | 14)
+#define CPIA_COMMAND_GrabReset         (OUTPUT | CPIA_MODULE_CAPTURE | 15)
+
+#define CPIA_COMMAND_OutputRS232       (OUTPUT | CPIA_MODULE_DEBUG | 1)
+#define CPIA_COMMAND_AbortProcess      (OUTPUT | CPIA_MODULE_DEBUG | 4)
+#define CPIA_COMMAND_SetDramPage       (OUTPUT | CPIA_MODULE_DEBUG | 5)
+#define CPIA_COMMAND_StartDramUpload   (OUTPUT | CPIA_MODULE_DEBUG | 6)
+#define CPIA_COMMAND_StartDummyDtream  (OUTPUT | CPIA_MODULE_DEBUG | 8)
+#define CPIA_COMMAND_AbortStream       (OUTPUT | CPIA_MODULE_DEBUG | 9)
+#define CPIA_COMMAND_DownloadDRAM      (OUTPUT | CPIA_MODULE_DEBUG | 10)
+#define CPIA_COMMAND_Null              (OUTPUT | CPIA_MODULE_DEBUG | 11)
+
+#define ROUND_UP_EXP_FOR_FLICKER 15
+
+/* Constants for automatic frame rate adjustment */
+#define MAX_EXP       302
+#define MAX_EXP_102   255
+#define LOW_EXP       140
+#define VERY_LOW_EXP   70
+#define TC             94
+#define        EXP_ACC_DARK   50
+#define        EXP_ACC_LIGHT  90
+#define HIGH_COMP_102 160
+#define MAX_COMP      239
+#define DARK_TIME       3
+#define LIGHT_TIME      3
+
+#define FIRMWARE_VERSION(x, y) (sd->params.version.firmwareVersion == (x) && \
+                               sd->params.version.firmwareRevision == (y))
+
+/* Developer's Guide Table 5 p 3-34
+ * indexed by [mains][sensorFps.baserate][sensorFps.divisor]*/
+static u8 flicker_jumps[2][2][4] =
+{ { { 76, 38, 19, 9 }, { 92, 46, 23, 11 } },
+  { { 64, 32, 16, 8 }, { 76, 38, 19, 9} }
+};
+
+struct cam_params {
+       struct {
+               u8 firmwareVersion;
+               u8 firmwareRevision;
+               u8 vcVersion;
+               u8 vcRevision;
+       } version;
+       struct {
+               u16 vendor;
+               u16 product;
+               u16 deviceRevision;
+       } pnpID;
+       struct {
+               u8 vpVersion;
+               u8 vpRevision;
+               u16 cameraHeadID;
+       } vpVersion;
+       struct {
+               u8 systemState;
+               u8 grabState;
+               u8 streamState;
+               u8 fatalError;
+               u8 cmdError;
+               u8 debugFlags;
+               u8 vpStatus;
+               u8 errorCode;
+       } status;
+       struct {
+               u8 brightness;
+               u8 contrast;
+               u8 saturation;
+       } colourParams;
+       struct {
+               u8 gainMode;
+               u8 expMode;
+               u8 compMode;
+               u8 centreWeight;
+               u8 gain;
+               u8 fineExp;
+               u8 coarseExpLo;
+               u8 coarseExpHi;
+               u8 redComp;
+               u8 green1Comp;
+               u8 green2Comp;
+               u8 blueComp;
+       } exposure;
+       struct {
+               u8 balanceMode;
+               u8 redGain;
+               u8 greenGain;
+               u8 blueGain;
+       } colourBalance;
+       struct {
+               u8 divisor;
+               u8 baserate;
+       } sensorFps;
+       struct {
+               u8 gain1;
+               u8 gain2;
+               u8 gain4;
+               u8 gain8;
+       } apcor;
+       struct {
+               u8 disabled;
+               u8 flickerMode;
+               u8 coarseJump;
+               u8 allowableOverExposure;
+       } flickerControl;
+       struct {
+               u8 gain1;
+               u8 gain2;
+               u8 gain4;
+               u8 gain8;
+       } vlOffset;
+       struct {
+               u8 mode;
+               u8 decimation;
+       } compression;
+       struct {
+               u8 frTargeting;
+               u8 targetFR;
+               u8 targetQ;
+       } compressionTarget;
+       struct {
+               u8 yThreshold;
+               u8 uvThreshold;
+       } yuvThreshold;
+       struct {
+               u8 hysteresis;
+               u8 threshMax;
+               u8 smallStep;
+               u8 largeStep;
+               u8 decimationHysteresis;
+               u8 frDiffStepThresh;
+               u8 qDiffStepThresh;
+               u8 decimationThreshMod;
+       } compressionParams;
+       struct {
+               u8 videoSize;           /* CIF/QCIF */
+               u8 subSample;
+               u8 yuvOrder;
+       } format;
+       struct {                        /* Intel QX3 specific data */
+               u8 qx3_detected;        /* a QX3 is present */
+               u8 toplight;            /* top light lit , R/W */
+               u8 bottomlight;         /* bottom light lit, R/W */
+               u8 button;              /* snapshot button pressed (R/O) */
+               u8 cradled;             /* microscope is in cradle (R/O) */
+       } qx3;
+       struct {
+               u8 colStart;            /* skip first 8*colStart pixels */
+               u8 colEnd;              /* finish at 8*colEnd pixels */
+               u8 rowStart;            /* skip first 4*rowStart lines */
+               u8 rowEnd;              /* finish at 4*rowEnd lines */
+       } roi;
+       u8 ecpTiming;
+       u8 streamStartLine;
+};
+
+/* specific webcam descriptor */
+struct sd {
+       struct gspca_dev gspca_dev;             /* !! must be the first item */
+       struct cam_params params;               /* camera settings */
+
+       atomic_t cam_exposure;
+       atomic_t fps;
+       int exposure_count;
+       u8 exposure_status;
+       u8 mainsFreq;                           /* 0 = 50hz, 1 = 60hz */
+       u8 first_frame;
+       u8 freq;
+};
+
+/* V4L2 controls supported by the driver */
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcomptarget(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getcomptarget(struct gspca_dev *gspca_dev, __s32 *val);
+
+static struct ctrl sd_ctrls[] = {
+       {
+           {
+               .id      = V4L2_CID_BRIGHTNESS,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Brightness",
+               .minimum = 0,
+               .maximum = 100,
+               .step = 1,
+#define BRIGHTNESS_DEF 50
+               .default_value = BRIGHTNESS_DEF,
+               .flags = 0,
+           },
+           .set = sd_setbrightness,
+           .get = sd_getbrightness,
+       },
+       {
+           {
+               .id      = V4L2_CID_CONTRAST,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Contrast",
+               .minimum = 0,
+               .maximum = 96,
+               .step    = 8,
+#define CONTRAST_DEF 48
+               .default_value = CONTRAST_DEF,
+           },
+           .set = sd_setcontrast,
+           .get = sd_getcontrast,
+       },
+       {
+           {
+               .id      = V4L2_CID_SATURATION,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Saturation",
+               .minimum = 0,
+               .maximum = 100,
+               .step    = 1,
+#define SATURATION_DEF 50
+               .default_value = SATURATION_DEF,
+           },
+           .set = sd_setsaturation,
+           .get = sd_getsaturation,
+       },
+       {
+               {
+                       .id      = V4L2_CID_POWER_LINE_FREQUENCY,
+                       .type    = V4L2_CTRL_TYPE_MENU,
+                       .name    = "Light frequency filter",
+                       .minimum = 0,
+                       .maximum = 2,   /* 0: 0, 1: 50Hz, 2:60Hz */
+                       .step    = 1,
+#define FREQ_DEF 1
+                       .default_value = FREQ_DEF,
+               },
+               .set = sd_setfreq,
+               .get = sd_getfreq,
+       },
+       {
+               {
+#define V4L2_CID_COMP_TARGET V4L2_CID_PRIVATE_BASE
+                       .id      = V4L2_CID_COMP_TARGET,
+                       .type    = V4L2_CTRL_TYPE_MENU,
+                       .name    = "Compression Target",
+                       .minimum = 0,
+                       .maximum = 1,
+                       .step    = 1,
+#define COMP_TARGET_DEF CPIA_COMPRESSION_TARGET_QUALITY
+                       .default_value = COMP_TARGET_DEF,
+               },
+               .set = sd_setcomptarget,
+               .get = sd_getcomptarget,
+       },
+};
+
+static const struct v4l2_pix_format mode[] = {
+       {160, 120, V4L2_PIX_FMT_CPIA1, V4L2_FIELD_NONE,
+               /* The sizeimage is trial and error, as with low framerates
+                  the camera will pad out usb frames, making the image
+                  data larger then strictly necessary */
+               .bytesperline = 160,
+               .sizeimage = 65536,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 3},
+       {176, 144, V4L2_PIX_FMT_CPIA1, V4L2_FIELD_NONE,
+               .bytesperline = 172,
+               .sizeimage = 65536,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 2},
+       {320, 240, V4L2_PIX_FMT_CPIA1, V4L2_FIELD_NONE,
+               .bytesperline = 320,
+               .sizeimage = 262144,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 1},
+       {352, 288, V4L2_PIX_FMT_CPIA1, V4L2_FIELD_NONE,
+               .bytesperline = 352,
+               .sizeimage = 262144,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 0},
+};
+
+/**********************************************************************
+ *
+ * General functions
+ *
+ **********************************************************************/
+
+static int cpia_usb_transferCmd(struct gspca_dev *gspca_dev, u8 *command)
+{
+       u8 requesttype;
+       unsigned int pipe;
+       int ret, databytes = command[6] | (command[7] << 8);
+       /* Sometimes we see spurious EPIPE errors */
+       int retries = 3;
+
+       if (command[0] == DATA_IN) {
+               pipe = usb_rcvctrlpipe(gspca_dev->dev, 0);
+               requesttype = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+       } else if (command[0] == DATA_OUT) {
+               pipe = usb_sndctrlpipe(gspca_dev->dev, 0);
+               requesttype = USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+       } else {
+               PDEBUG(D_ERR, "Unexpected first byte of command: %x",
+                      command[0]);
+               return -EINVAL;
+       }
+
+retry:
+       ret = usb_control_msg(gspca_dev->dev, pipe,
+                             command[1],
+                             requesttype,
+                             command[2] | (command[3] << 8),
+                             command[4] | (command[5] << 8),
+                             gspca_dev->usb_buf, databytes, 1000);
+
+       if (ret < 0)
+               PDEBUG(D_ERR, "usb_control_msg %02x, error %d", command[1],
+                      ret);
+
+       if (ret == -EPIPE && retries > 0) {
+               retries--;
+               goto retry;
+       }
+
+       return (ret < 0) ? ret : 0;
+}
+
+/* send an arbitrary command to the camera */
+static int do_command(struct gspca_dev *gspca_dev, u16 command,
+                     u8 a, u8 b, u8 c, u8 d)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret, datasize;
+       u8 cmd[8];
+
+       switch (command) {
+       case CPIA_COMMAND_GetCPIAVersion:
+       case CPIA_COMMAND_GetPnPID:
+       case CPIA_COMMAND_GetCameraStatus:
+       case CPIA_COMMAND_GetVPVersion:
+       case CPIA_COMMAND_GetColourParams:
+       case CPIA_COMMAND_GetColourBalance:
+       case CPIA_COMMAND_GetExposure:
+               datasize = 8;
+               break;
+       case CPIA_COMMAND_ReadMCPorts:
+       case CPIA_COMMAND_ReadVCRegs:
+               datasize = 4;
+               break;
+       default:
+               datasize = 0;
+               break;
+       }
+
+       cmd[0] = command >> 8;
+       cmd[1] = command & 0xff;
+       cmd[2] = a;
+       cmd[3] = b;
+       cmd[4] = c;
+       cmd[5] = d;
+       cmd[6] = datasize;
+       cmd[7] = 0;
+
+       ret = cpia_usb_transferCmd(gspca_dev, cmd);
+       if (ret)
+               return ret;
+
+       switch (command) {
+       case CPIA_COMMAND_GetCPIAVersion:
+               sd->params.version.firmwareVersion = gspca_dev->usb_buf[0];
+               sd->params.version.firmwareRevision = gspca_dev->usb_buf[1];
+               sd->params.version.vcVersion = gspca_dev->usb_buf[2];
+               sd->params.version.vcRevision = gspca_dev->usb_buf[3];
+               break;
+       case CPIA_COMMAND_GetPnPID:
+               sd->params.pnpID.vendor =
+                       gspca_dev->usb_buf[0] | (gspca_dev->usb_buf[1] << 8);
+               sd->params.pnpID.product =
+                       gspca_dev->usb_buf[2] | (gspca_dev->usb_buf[3] << 8);
+               sd->params.pnpID.deviceRevision =
+                       gspca_dev->usb_buf[4] | (gspca_dev->usb_buf[5] << 8);
+               break;
+       case CPIA_COMMAND_GetCameraStatus:
+               sd->params.status.systemState = gspca_dev->usb_buf[0];
+               sd->params.status.grabState = gspca_dev->usb_buf[1];
+               sd->params.status.streamState = gspca_dev->usb_buf[2];
+               sd->params.status.fatalError = gspca_dev->usb_buf[3];
+               sd->params.status.cmdError = gspca_dev->usb_buf[4];
+               sd->params.status.debugFlags = gspca_dev->usb_buf[5];
+               sd->params.status.vpStatus = gspca_dev->usb_buf[6];
+               sd->params.status.errorCode = gspca_dev->usb_buf[7];
+               break;
+       case CPIA_COMMAND_GetVPVersion:
+               sd->params.vpVersion.vpVersion = gspca_dev->usb_buf[0];
+               sd->params.vpVersion.vpRevision = gspca_dev->usb_buf[1];
+               sd->params.vpVersion.cameraHeadID =
+                       gspca_dev->usb_buf[2] | (gspca_dev->usb_buf[3] << 8);
+               break;
+       case CPIA_COMMAND_GetColourParams:
+               sd->params.colourParams.brightness = gspca_dev->usb_buf[0];
+               sd->params.colourParams.contrast = gspca_dev->usb_buf[1];
+               sd->params.colourParams.saturation = gspca_dev->usb_buf[2];
+               break;
+       case CPIA_COMMAND_GetColourBalance:
+               sd->params.colourBalance.redGain = gspca_dev->usb_buf[0];
+               sd->params.colourBalance.greenGain = gspca_dev->usb_buf[1];
+               sd->params.colourBalance.blueGain = gspca_dev->usb_buf[2];
+               break;
+       case CPIA_COMMAND_GetExposure:
+               sd->params.exposure.gain = gspca_dev->usb_buf[0];
+               sd->params.exposure.fineExp = gspca_dev->usb_buf[1];
+               sd->params.exposure.coarseExpLo = gspca_dev->usb_buf[2];
+               sd->params.exposure.coarseExpHi = gspca_dev->usb_buf[3];
+               sd->params.exposure.redComp = gspca_dev->usb_buf[4];
+               sd->params.exposure.green1Comp = gspca_dev->usb_buf[5];
+               sd->params.exposure.green2Comp = gspca_dev->usb_buf[6];
+               sd->params.exposure.blueComp = gspca_dev->usb_buf[7];
+               break;
+
+       case CPIA_COMMAND_ReadMCPorts:
+               if (!sd->params.qx3.qx3_detected)
+                       break;
+               /* test button press */
+               sd->params.qx3.button = ((gspca_dev->usb_buf[1] & 0x02) == 0);
+               if (sd->params.qx3.button) {
+                       /* button pressed - unlock the latch */
+                       do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
+                                  3, 0xDF, 0xDF, 0);
+                       do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
+                                  3, 0xFF, 0xFF, 0);
+               }
+
+               /* test whether microscope is cradled */
+               sd->params.qx3.cradled = ((gspca_dev->usb_buf[2] & 0x40) == 0);
+               break;
+       }
+
+       return 0;
+}
+
+/* send a command to the camera with an additional data transaction */
+static int do_command_extended(struct gspca_dev *gspca_dev, u16 command,
+                              u8 a, u8 b, u8 c, u8 d,
+                              u8 e, u8 f, u8 g, u8 h,
+                              u8 i, u8 j, u8 k, u8 l)
+{
+       u8 cmd[8];
+
+       cmd[0] = command >> 8;
+       cmd[1] = command & 0xff;
+       cmd[2] = a;
+       cmd[3] = b;
+       cmd[4] = c;
+       cmd[5] = d;
+       cmd[6] = 8;
+       cmd[7] = 0;
+       gspca_dev->usb_buf[0] = e;
+       gspca_dev->usb_buf[1] = f;
+       gspca_dev->usb_buf[2] = g;
+       gspca_dev->usb_buf[3] = h;
+       gspca_dev->usb_buf[4] = i;
+       gspca_dev->usb_buf[5] = j;
+       gspca_dev->usb_buf[6] = k;
+       gspca_dev->usb_buf[7] = l;
+
+       return cpia_usb_transferCmd(gspca_dev, cmd);
+}
+
+/*  find_over_exposure
+ *  Finds a suitable value of OverExposure for use with SetFlickerCtrl
+ *  Some calculation is required because this value changes with the brightness
+ *  set with SetColourParameters
+ *
+ *  Parameters: Brightness - last brightness value set with SetColourParameters
+ *
+ *  Returns: OverExposure value to use with SetFlickerCtrl
+ */
+#define FLICKER_MAX_EXPOSURE                    250
+#define FLICKER_ALLOWABLE_OVER_EXPOSURE         146
+#define FLICKER_BRIGHTNESS_CONSTANT             59
+static int find_over_exposure(int brightness)
+{
+       int MaxAllowableOverExposure, OverExposure;
+
+       MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness -
+                                  FLICKER_BRIGHTNESS_CONSTANT;
+
+       if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE)
+               OverExposure = MaxAllowableOverExposure;
+       else
+               OverExposure = FLICKER_ALLOWABLE_OVER_EXPOSURE;
+
+       return OverExposure;
+}
+#undef FLICKER_MAX_EXPOSURE
+#undef FLICKER_ALLOWABLE_OVER_EXPOSURE
+#undef FLICKER_BRIGHTNESS_CONSTANT
+
+/* initialise cam_data structure  */
+static void reset_camera_params(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       struct cam_params *params = &sd->params;
+
+       /* The following parameter values are the defaults from
+        * "Software Developer's Guide for CPiA Cameras".  Any changes
+        * to the defaults are noted in comments. */
+       params->colourParams.brightness = BRIGHTNESS_DEF;
+       params->colourParams.contrast = CONTRAST_DEF;
+       params->colourParams.saturation = SATURATION_DEF;
+       params->exposure.gainMode = 4;
+       params->exposure.expMode = 2;           /* AEC */
+       params->exposure.compMode = 1;
+       params->exposure.centreWeight = 1;
+       params->exposure.gain = 0;
+       params->exposure.fineExp = 0;
+       params->exposure.coarseExpLo = 185;
+       params->exposure.coarseExpHi = 0;
+       params->exposure.redComp = COMP_RED;
+       params->exposure.green1Comp = COMP_GREEN1;
+       params->exposure.green2Comp = COMP_GREEN2;
+       params->exposure.blueComp = COMP_BLUE;
+       params->colourBalance.balanceMode = 2;  /* ACB */
+       params->colourBalance.redGain = 32;
+       params->colourBalance.greenGain = 6;
+       params->colourBalance.blueGain = 92;
+       params->apcor.gain1 = 0x18;
+       params->apcor.gain2 = 0x16;
+       params->apcor.gain4 = 0x24;
+       params->apcor.gain8 = 0x34;
+       params->flickerControl.flickerMode = 0;
+       params->flickerControl.disabled = 1;
+
+       params->flickerControl.coarseJump =
+               flicker_jumps[sd->mainsFreq]
+                            [params->sensorFps.baserate]
+                            [params->sensorFps.divisor];
+       params->flickerControl.allowableOverExposure =
+               find_over_exposure(params->colourParams.brightness);
+       params->vlOffset.gain1 = 20;
+       params->vlOffset.gain2 = 24;
+       params->vlOffset.gain4 = 26;
+       params->vlOffset.gain8 = 26;
+       params->compressionParams.hysteresis = 3;
+       params->compressionParams.threshMax = 11;
+       params->compressionParams.smallStep = 1;
+       params->compressionParams.largeStep = 3;
+       params->compressionParams.decimationHysteresis = 2;
+       params->compressionParams.frDiffStepThresh = 5;
+       params->compressionParams.qDiffStepThresh = 3;
+       params->compressionParams.decimationThreshMod = 2;
+       /* End of default values from Software Developer's Guide */
+
+       /* Set Sensor FPS to 15fps. This seems better than 30fps
+        * for indoor lighting. */
+       params->sensorFps.divisor = 1;
+       params->sensorFps.baserate = 1;
+
+       params->yuvThreshold.yThreshold = 6; /* From windows driver */
+       params->yuvThreshold.uvThreshold = 6; /* From windows driver */
+
+       params->format.subSample = SUBSAMPLE_420;
+       params->format.yuvOrder = YUVORDER_YUYV;
+
+       params->compression.mode = CPIA_COMPRESSION_AUTO;
+       params->compression.decimation = NO_DECIMATION;
+
+       params->compressionTarget.frTargeting = COMP_TARGET_DEF;
+       params->compressionTarget.targetFR = 15; /* From windows driver */
+       params->compressionTarget.targetQ = 5; /* From windows driver */
+
+       params->qx3.qx3_detected = 0;
+       params->qx3.toplight = 0;
+       params->qx3.bottomlight = 0;
+       params->qx3.button = 0;
+       params->qx3.cradled = 0;
+}
+
+static void printstatus(struct cam_params *params)
+{
+       PDEBUG(D_PROBE, "status: %02x %02x %02x %02x %02x %02x %02x %02x",
+              params->status.systemState, params->status.grabState,
+              params->status.streamState, params->status.fatalError,
+              params->status.cmdError, params->status.debugFlags,
+              params->status.vpStatus, params->status.errorCode);
+}
+
+static int goto_low_power(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       ret = do_command(gspca_dev, CPIA_COMMAND_GotoLoPower, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       if (sd->params.status.systemState != LO_POWER_STATE) {
+               if (sd->params.status.systemState != WARM_BOOT_STATE) {
+                       PDEBUG(D_ERR,
+                              "unexpected state after lo power cmd: %02x",
+                              sd->params.status.systemState);
+                       printstatus(&sd->params);
+               }
+               return -EIO;
+       }
+
+       PDEBUG(D_CONF, "camera now in LOW power state");
+       return 0;
+}
+
+static int goto_high_power(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       ret = do_command(gspca_dev, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       msleep_interruptible(40);       /* windows driver does it too */
+
+       if (signal_pending(current))
+               return -EINTR;
+
+       do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       if (sd->params.status.systemState != HI_POWER_STATE) {
+               PDEBUG(D_ERR, "unexpected state after hi power cmd: %02x",
+                              sd->params.status.systemState);
+               printstatus(&sd->params);
+               return -EIO;
+       }
+
+       PDEBUG(D_CONF, "camera now in HIGH power state");
+       return 0;
+}
+
+static int get_version_information(struct gspca_dev *gspca_dev)
+{
+       int ret;
+
+       /* GetCPIAVersion */
+       ret = do_command(gspca_dev, CPIA_COMMAND_GetCPIAVersion, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       /* GetPnPID */
+       return do_command(gspca_dev, CPIA_COMMAND_GetPnPID, 0, 0, 0, 0);
+}
+
+static int save_camera_state(struct gspca_dev *gspca_dev)
+{
+       int ret;
+
+       ret = do_command(gspca_dev, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       return do_command(gspca_dev, CPIA_COMMAND_GetExposure, 0, 0, 0, 0);
+}
+
+int command_setformat(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       ret = do_command(gspca_dev, CPIA_COMMAND_SetFormat,
+                        sd->params.format.videoSize,
+                        sd->params.format.subSample,
+                        sd->params.format.yuvOrder, 0);
+       if (ret)
+               return ret;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetROI,
+                         sd->params.roi.colStart, sd->params.roi.colEnd,
+                         sd->params.roi.rowStart, sd->params.roi.rowEnd);
+}
+
+int command_setcolourparams(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       return do_command(gspca_dev, CPIA_COMMAND_SetColourParams,
+                         sd->params.colourParams.brightness,
+                         sd->params.colourParams.contrast,
+                         sd->params.colourParams.saturation, 0);
+}
+
+int command_setapcor(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       return do_command(gspca_dev, CPIA_COMMAND_SetApcor,
+                         sd->params.apcor.gain1,
+                         sd->params.apcor.gain2,
+                         sd->params.apcor.gain4,
+                         sd->params.apcor.gain8);
+}
+
+int command_setvloffset(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       return do_command(gspca_dev, CPIA_COMMAND_SetVLOffset,
+                         sd->params.vlOffset.gain1,
+                         sd->params.vlOffset.gain2,
+                         sd->params.vlOffset.gain4,
+                         sd->params.vlOffset.gain8);
+}
+
+int command_setexposure(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       ret = do_command_extended(gspca_dev, CPIA_COMMAND_SetExposure,
+                                 sd->params.exposure.gainMode,
+                                 1,
+                                 sd->params.exposure.compMode,
+                                 sd->params.exposure.centreWeight,
+                                 sd->params.exposure.gain,
+                                 sd->params.exposure.fineExp,
+                                 sd->params.exposure.coarseExpLo,
+                                 sd->params.exposure.coarseExpHi,
+                                 sd->params.exposure.redComp,
+                                 sd->params.exposure.green1Comp,
+                                 sd->params.exposure.green2Comp,
+                                 sd->params.exposure.blueComp);
+       if (ret)
+               return ret;
+
+       if (sd->params.exposure.expMode != 1) {
+               ret = do_command_extended(gspca_dev, CPIA_COMMAND_SetExposure,
+                                         0,
+                                         sd->params.exposure.expMode,
+                                         0, 0,
+                                         sd->params.exposure.gain,
+                                         sd->params.exposure.fineExp,
+                                         sd->params.exposure.coarseExpLo,
+                                         sd->params.exposure.coarseExpHi,
+                                         0, 0, 0, 0);
+       }
+
+       return ret;
+}
+
+int command_setcolourbalance(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->params.colourBalance.balanceMode == 1) {
+               int ret;
+
+               ret = do_command(gspca_dev, CPIA_COMMAND_SetColourBalance,
+                                1,
+                                sd->params.colourBalance.redGain,
+                                sd->params.colourBalance.greenGain,
+                                sd->params.colourBalance.blueGain);
+               if (ret)
+                       return ret;
+
+               return do_command(gspca_dev, CPIA_COMMAND_SetColourBalance,
+                                 3, 0, 0, 0);
+       }
+       if (sd->params.colourBalance.balanceMode == 2) {
+               return do_command(gspca_dev, CPIA_COMMAND_SetColourBalance,
+                                 2, 0, 0, 0);
+       }
+       if (sd->params.colourBalance.balanceMode == 3) {
+               return do_command(gspca_dev, CPIA_COMMAND_SetColourBalance,
+                                 3, 0, 0, 0);
+       }
+
+       return -EINVAL;
+}
+
+int command_setcompressiontarget(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetCompressionTarget,
+                         sd->params.compressionTarget.frTargeting,
+                         sd->params.compressionTarget.targetFR,
+                         sd->params.compressionTarget.targetQ, 0);
+}
+
+int command_setyuvtresh(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetYUVThresh,
+                         sd->params.yuvThreshold.yThreshold,
+                         sd->params.yuvThreshold.uvThreshold, 0, 0);
+}
+
+int command_setcompressionparams(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command_extended(gspca_dev,
+                           CPIA_COMMAND_SetCompressionParams,
+                           0, 0, 0, 0,
+                           sd->params.compressionParams.hysteresis,
+                           sd->params.compressionParams.threshMax,
+                           sd->params.compressionParams.smallStep,
+                           sd->params.compressionParams.largeStep,
+                           sd->params.compressionParams.decimationHysteresis,
+                           sd->params.compressionParams.frDiffStepThresh,
+                           sd->params.compressionParams.qDiffStepThresh,
+                           sd->params.compressionParams.decimationThreshMod);
+}
+
+int command_setcompression(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetCompression,
+                         sd->params.compression.mode,
+                         sd->params.compression.decimation, 0, 0);
+}
+
+int command_setsensorfps(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetSensorFPS,
+                         sd->params.sensorFps.divisor,
+                         sd->params.sensorFps.baserate, 0, 0);
+}
+
+int command_setflickerctrl(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetFlickerCtrl,
+                         sd->params.flickerControl.flickerMode,
+                         sd->params.flickerControl.coarseJump,
+                         sd->params.flickerControl.allowableOverExposure,
+                         0);
+}
+
+int command_setecptiming(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_SetECPTiming,
+                         sd->params.ecpTiming, 0, 0, 0);
+}
+
+int command_pause(struct gspca_dev *gspca_dev)
+{
+       return do_command(gspca_dev, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0);
+}
+
+int command_resume(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       return do_command(gspca_dev, CPIA_COMMAND_InitStreamCap,
+                         0, sd->params.streamStartLine, 0, 0);
+}
+
+int command_setlights(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret, p1, p2;
+
+       if (!sd->params.qx3.qx3_detected)
+               return 0;
+
+       p1 = (sd->params.qx3.bottomlight == 0) << 1;
+       p2 = (sd->params.qx3.toplight == 0) << 3;
+
+       ret = do_command(gspca_dev, CPIA_COMMAND_WriteVCReg,
+                        0x90, 0x8F, 0x50, 0);
+       if (ret)
+               return ret;
+
+       return do_command(gspca_dev, CPIA_COMMAND_WriteMCPort, 2, 0,
+                         p1 | p2 | 0xE0, 0);
+}
+
+static int set_flicker(struct gspca_dev *gspca_dev, int on, int apply)
+{
+       /* Everything in here is from the Windows driver */
+/* define for compgain calculation */
+#if 0
+#define COMPGAIN(base, curexp, newexp) \
+    (u8) ((((float) base - 128.0) * ((float) curexp / (float) newexp)) + 128.5)
+#define EXP_FROM_COMP(basecomp, curcomp, curexp) \
+    (u16)((float)curexp * (float)(u8)(curcomp + 128) / \
+    (float)(u8)(basecomp - 128))
+#else
+  /* equivalent functions without floating point math */
+#define COMPGAIN(base, curexp, newexp) \
+    (u8)(128 + (((u32)(2*(base-128)*curexp + newexp)) / (2 * newexp)))
+#define EXP_FROM_COMP(basecomp, curcomp, curexp) \
+    (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128)))
+#endif
+
+       struct sd *sd = (struct sd *) gspca_dev;
+       int currentexp = sd->params.exposure.coarseExpLo +
+                        sd->params.exposure.coarseExpHi * 256;
+       int ret, startexp;
+
+       if (on) {
+               int cj = sd->params.flickerControl.coarseJump;
+               sd->params.flickerControl.flickerMode = 1;
+               sd->params.flickerControl.disabled = 0;
+               if (sd->params.exposure.expMode != 2) {
+                       sd->params.exposure.expMode = 2;
+                       sd->exposure_status = EXPOSURE_NORMAL;
+               }
+               currentexp = currentexp << sd->params.exposure.gain;
+               sd->params.exposure.gain = 0;
+               /* round down current exposure to nearest value */
+               startexp = (currentexp + ROUND_UP_EXP_FOR_FLICKER) / cj;
+               if (startexp < 1)
+                       startexp = 1;
+               startexp = (startexp * cj) - 1;
+               if (FIRMWARE_VERSION(1, 2))
+                       while (startexp > MAX_EXP_102)
+                               startexp -= cj;
+               else
+                       while (startexp > MAX_EXP)
+                               startexp -= cj;
+               sd->params.exposure.coarseExpLo = startexp & 0xff;
+               sd->params.exposure.coarseExpHi = startexp >> 8;
+               if (currentexp > startexp) {
+                       if (currentexp > (2 * startexp))
+                               currentexp = 2 * startexp;
+                       sd->params.exposure.redComp =
+                               COMPGAIN(COMP_RED, currentexp, startexp);
+                       sd->params.exposure.green1Comp =
+                               COMPGAIN(COMP_GREEN1, currentexp, startexp);
+                       sd->params.exposure.green2Comp =
+                               COMPGAIN(COMP_GREEN2, currentexp, startexp);
+                       sd->params.exposure.blueComp =
+                               COMPGAIN(COMP_BLUE, currentexp, startexp);
+               } else {
+                       sd->params.exposure.redComp = COMP_RED;
+                       sd->params.exposure.green1Comp = COMP_GREEN1;
+                       sd->params.exposure.green2Comp = COMP_GREEN2;
+                       sd->params.exposure.blueComp = COMP_BLUE;
+               }
+               if (FIRMWARE_VERSION(1, 2))
+                       sd->params.exposure.compMode = 0;
+               else
+                       sd->params.exposure.compMode = 1;
+
+               sd->params.apcor.gain1 = 0x18;
+               sd->params.apcor.gain2 = 0x18;
+               sd->params.apcor.gain4 = 0x16;
+               sd->params.apcor.gain8 = 0x14;
+       } else {
+               sd->params.flickerControl.flickerMode = 0;
+               sd->params.flickerControl.disabled = 1;
+               /* Average equivalent coarse for each comp channel */
+               startexp = EXP_FROM_COMP(COMP_RED,
+                               sd->params.exposure.redComp, currentexp);
+               startexp += EXP_FROM_COMP(COMP_GREEN1,
+                               sd->params.exposure.green1Comp, currentexp);
+               startexp += EXP_FROM_COMP(COMP_GREEN2,
+                               sd->params.exposure.green2Comp, currentexp);
+               startexp += EXP_FROM_COMP(COMP_BLUE,
+                               sd->params.exposure.blueComp, currentexp);
+               startexp = startexp >> 2;
+               while (startexp > MAX_EXP && sd->params.exposure.gain <
+                      sd->params.exposure.gainMode - 1) {
+                       startexp = startexp >> 1;
+                       ++sd->params.exposure.gain;
+               }
+               if (FIRMWARE_VERSION(1, 2) && startexp > MAX_EXP_102)
+                       startexp = MAX_EXP_102;
+               if (startexp > MAX_EXP)
+                       startexp = MAX_EXP;
+               sd->params.exposure.coarseExpLo = startexp & 0xff;
+               sd->params.exposure.coarseExpHi = startexp >> 8;
+               sd->params.exposure.redComp = COMP_RED;
+               sd->params.exposure.green1Comp = COMP_GREEN1;
+               sd->params.exposure.green2Comp = COMP_GREEN2;
+               sd->params.exposure.blueComp = COMP_BLUE;
+               sd->params.exposure.compMode = 1;
+               sd->params.apcor.gain1 = 0x18;
+               sd->params.apcor.gain2 = 0x16;
+               sd->params.apcor.gain4 = 0x24;
+               sd->params.apcor.gain8 = 0x34;
+       }
+       sd->params.vlOffset.gain1 = 20;
+       sd->params.vlOffset.gain2 = 24;
+       sd->params.vlOffset.gain4 = 26;
+       sd->params.vlOffset.gain8 = 26;
+
+       if (apply) {
+               ret = command_setexposure(gspca_dev);
+               if (ret)
+                       return ret;
+
+               ret = command_setapcor(gspca_dev);
+               if (ret)
+                       return ret;
+
+               ret = command_setvloffset(gspca_dev);
+               if (ret)
+                       return ret;
+
+               ret = command_setflickerctrl(gspca_dev);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+#undef EXP_FROM_COMP
+#undef COMPGAIN
+}
+
+/* monitor the exposure and adjust the sensor frame rate if needed */
+static void monitor_exposure(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 exp_acc, bcomp, gain, coarseL, cmd[8];
+       int ret, light_exp, dark_exp, very_dark_exp;
+       int old_exposure, new_exposure, framerate;
+       int setfps = 0, setexp = 0, setflicker = 0;
+
+       /* get necessary stats and register settings from camera */
+       /* do_command can't handle this, so do it ourselves */
+       cmd[0] = CPIA_COMMAND_ReadVPRegs >> 8;
+       cmd[1] = CPIA_COMMAND_ReadVPRegs & 0xff;
+       cmd[2] = 30;
+       cmd[3] = 4;
+       cmd[4] = 9;
+       cmd[5] = 8;
+       cmd[6] = 8;
+       cmd[7] = 0;
+       ret = cpia_usb_transferCmd(gspca_dev, cmd);
+       if (ret) {
+               PDEBUG(D_ERR, "ReadVPRegs(30,4,9,8) - failed: %d", ret);
+               return;
+       }
+       exp_acc = gspca_dev->usb_buf[0];
+       bcomp = gspca_dev->usb_buf[1];
+       gain = gspca_dev->usb_buf[2];
+       coarseL = gspca_dev->usb_buf[3];
+
+       light_exp = sd->params.colourParams.brightness +
+                   TC - 50 + EXP_ACC_LIGHT;
+       if (light_exp > 255)
+               light_exp = 255;
+       dark_exp = sd->params.colourParams.brightness +
+                  TC - 50 - EXP_ACC_DARK;
+       if (dark_exp < 0)
+               dark_exp = 0;
+       very_dark_exp = dark_exp / 2;
+
+       old_exposure = sd->params.exposure.coarseExpHi * 256 +
+                      sd->params.exposure.coarseExpLo;
+
+       if (!sd->params.flickerControl.disabled) {
+               /* Flicker control on */
+               int max_comp = FIRMWARE_VERSION(1, 2) ? MAX_COMP :
+                                                       HIGH_COMP_102;
+               bcomp += 128;   /* decode */
+               if (bcomp >= max_comp && exp_acc < dark_exp) {
+                       /* dark */
+                       if (exp_acc < very_dark_exp) {
+                               /* very dark */
+                               if (sd->exposure_status == EXPOSURE_VERY_DARK)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status =
+                                               EXPOSURE_VERY_DARK;
+                                       sd->exposure_count = 1;
+                               }
+                       } else {
+                               /* just dark */
+                               if (sd->exposure_status == EXPOSURE_DARK)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status = EXPOSURE_DARK;
+                                       sd->exposure_count = 1;
+                               }
+                       }
+               } else if (old_exposure <= LOW_EXP || exp_acc > light_exp) {
+                       /* light */
+                       if (old_exposure <= VERY_LOW_EXP) {
+                               /* very light */
+                               if (sd->exposure_status == EXPOSURE_VERY_LIGHT)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status =
+                                               EXPOSURE_VERY_LIGHT;
+                                       sd->exposure_count = 1;
+                               }
+                       } else {
+                               /* just light */
+                               if (sd->exposure_status == EXPOSURE_LIGHT)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status = EXPOSURE_LIGHT;
+                                       sd->exposure_count = 1;
+                               }
+                       }
+               } else {
+                       /* not dark or light */
+                       sd->exposure_status = EXPOSURE_NORMAL;
+               }
+       } else {
+               /* Flicker control off */
+               if (old_exposure >= MAX_EXP && exp_acc < dark_exp) {
+                       /* dark */
+                       if (exp_acc < very_dark_exp) {
+                               /* very dark */
+                               if (sd->exposure_status == EXPOSURE_VERY_DARK)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status =
+                                               EXPOSURE_VERY_DARK;
+                                       sd->exposure_count = 1;
+                               }
+                       } else {
+                               /* just dark */
+                               if (sd->exposure_status == EXPOSURE_DARK)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status = EXPOSURE_DARK;
+                                       sd->exposure_count = 1;
+                               }
+                       }
+               } else if (old_exposure <= LOW_EXP || exp_acc > light_exp) {
+                       /* light */
+                       if (old_exposure <= VERY_LOW_EXP) {
+                               /* very light */
+                               if (sd->exposure_status == EXPOSURE_VERY_LIGHT)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status =
+                                               EXPOSURE_VERY_LIGHT;
+                                       sd->exposure_count = 1;
+                               }
+                       } else {
+                               /* just light */
+                               if (sd->exposure_status == EXPOSURE_LIGHT)
+                                       ++sd->exposure_count;
+                               else {
+                                       sd->exposure_status = EXPOSURE_LIGHT;
+                                       sd->exposure_count = 1;
+                               }
+                       }
+               } else {
+                       /* not dark or light */
+                       sd->exposure_status = EXPOSURE_NORMAL;
+               }
+       }
+
+       framerate = atomic_read(&sd->fps);
+       if (framerate > 30 || framerate < 1)
+               framerate = 1;
+
+       if (!sd->params.flickerControl.disabled) {
+               /* Flicker control on */
+               if ((sd->exposure_status == EXPOSURE_VERY_DARK ||
+                    sd->exposure_status == EXPOSURE_DARK) &&
+                   sd->exposure_count >= DARK_TIME * framerate &&
+                   sd->params.sensorFps.divisor < 3) {
+
+                       /* dark for too long */
+                       ++sd->params.sensorFps.divisor;
+                       setfps = 1;
+
+                       sd->params.flickerControl.coarseJump =
+                               flicker_jumps[sd->mainsFreq]
+                                            [sd->params.sensorFps.baserate]
+                                            [sd->params.sensorFps.divisor];
+                       setflicker = 1;
+
+                       new_exposure = sd->params.flickerControl.coarseJump-1;
+                       while (new_exposure < old_exposure / 2)
+                               new_exposure +=
+                                       sd->params.flickerControl.coarseJump;
+                       sd->params.exposure.coarseExpLo = new_exposure & 0xff;
+                       sd->params.exposure.coarseExpHi = new_exposure >> 8;
+                       setexp = 1;
+                       sd->exposure_status = EXPOSURE_NORMAL;
+                       PDEBUG(D_CONF, "Automatically decreasing sensor_fps");
+
+               } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT ||
+                           sd->exposure_status == EXPOSURE_LIGHT) &&
+                          sd->exposure_count >= LIGHT_TIME * framerate &&
+                          sd->params.sensorFps.divisor > 0) {
+
+                       /* light for too long */
+                       int max_exp = FIRMWARE_VERSION(1, 2) ? MAX_EXP_102 :
+                                                              MAX_EXP;
+                       --sd->params.sensorFps.divisor;
+                       setfps = 1;
+
+                       sd->params.flickerControl.coarseJump =
+                               flicker_jumps[sd->mainsFreq]
+                                            [sd->params.sensorFps.baserate]
+                                            [sd->params.sensorFps.divisor];
+                       setflicker = 1;
+
+                       new_exposure = sd->params.flickerControl.coarseJump-1;
+                       while (new_exposure < 2 * old_exposure &&
+                              new_exposure +
+                              sd->params.flickerControl.coarseJump < max_exp)
+                               new_exposure +=
+                                       sd->params.flickerControl.coarseJump;
+                       sd->params.exposure.coarseExpLo = new_exposure & 0xff;
+                       sd->params.exposure.coarseExpHi = new_exposure >> 8;
+                       setexp = 1;
+                       sd->exposure_status = EXPOSURE_NORMAL;
+                       PDEBUG(D_CONF, "Automatically increasing sensor_fps");
+               }
+       } else {
+               /* Flicker control off */
+               if ((sd->exposure_status == EXPOSURE_VERY_DARK ||
+                    sd->exposure_status == EXPOSURE_DARK) &&
+                   sd->exposure_count >= DARK_TIME * framerate &&
+                   sd->params.sensorFps.divisor < 3) {
+
+                       /* dark for too long */
+                       ++sd->params.sensorFps.divisor;
+                       setfps = 1;
+
+                       if (sd->params.exposure.gain > 0) {
+                               --sd->params.exposure.gain;
+                               setexp = 1;
+                       }
+                       sd->exposure_status = EXPOSURE_NORMAL;
+                       PDEBUG(D_CONF, "Automatically decreasing sensor_fps");
+
+               } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT ||
+                           sd->exposure_status == EXPOSURE_LIGHT) &&
+                          sd->exposure_count >= LIGHT_TIME * framerate &&
+                          sd->params.sensorFps.divisor > 0) {
+
+                       /* light for too long */
+                       --sd->params.sensorFps.divisor;
+                       setfps = 1;
+
+                       if (sd->params.exposure.gain <
+                           sd->params.exposure.gainMode - 1) {
+                               ++sd->params.exposure.gain;
+                               setexp = 1;
+                       }
+                       sd->exposure_status = EXPOSURE_NORMAL;
+                       PDEBUG(D_CONF, "Automatically increasing sensor_fps");
+               }
+       }
+
+       if (setexp)
+               command_setexposure(gspca_dev);
+
+       if (setfps)
+               command_setsensorfps(gspca_dev);
+
+       if (setflicker)
+               command_setflickerctrl(gspca_dev);
+}
+
+/*-----------------------------------------------------------------*/
+/* if flicker is switched off, this function switches it back on.It checks,
+   however, that conditions are suitable before restarting it.
+   This should only be called for firmware version 1.2.
+
+   It also adjust the colour balance when an exposure step is detected - as
+   long as flicker is running
+*/
+static void restart_flicker(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int cam_exposure, old_exp;
+
+       if (!FIRMWARE_VERSION(1, 2))
+               return;
+
+       cam_exposure = atomic_read(&sd->cam_exposure);
+
+       if (sd->params.flickerControl.flickerMode == 0 ||
+           cam_exposure == 0)
+               return;
+
+       old_exp = sd->params.exposure.coarseExpLo +
+                 sd->params.exposure.coarseExpHi*256;
+       /*
+         see how far away camera exposure is from a valid
+         flicker exposure value
+       */
+       cam_exposure %= sd->params.flickerControl.coarseJump;
+       if (!sd->params.flickerControl.disabled &&
+           cam_exposure <= sd->params.flickerControl.coarseJump - 3) {
+               /* Flicker control auto-disabled */
+               sd->params.flickerControl.disabled = 1;
+       }
+
+       if (sd->params.flickerControl.disabled &&
+           old_exp > sd->params.flickerControl.coarseJump +
+                     ROUND_UP_EXP_FOR_FLICKER) {
+               /* exposure is now high enough to switch
+                  flicker control back on */
+               set_flicker(gspca_dev, 1, 1);
+       }
+}
+
+/* this function is called at probe time */
+static int sd_config(struct gspca_dev *gspca_dev,
+                       const struct usb_device_id *id)
+{
+       struct cam *cam;
+
+       reset_camera_params(gspca_dev);
+
+       PDEBUG(D_PROBE, "cpia CPiA camera detected (vid/pid 0x%04X:0x%04X)",
+              id->idVendor, id->idProduct);
+
+       cam = &gspca_dev->cam;
+       cam->cam_mode = mode;
+       cam->nmodes = ARRAY_SIZE(mode);
+
+       sd_setfreq(gspca_dev, FREQ_DEF);
+
+       return 0;
+}
+
+/* -- start the camera -- */
+static int sd_start(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int priv, ret;
+
+       /* Start the camera in low power mode */
+       if (goto_low_power(gspca_dev)) {
+               if (sd->params.status.systemState != WARM_BOOT_STATE) {
+                       PDEBUG(D_ERR, "unexpected systemstate: %02x",
+                              sd->params.status.systemState);
+                       printstatus(&sd->params);
+                       return -ENODEV;
+               }
+
+               /* FIXME: this is just dirty trial and error */
+               ret = goto_high_power(gspca_dev);
+               if (ret)
+                       return ret;
+
+               ret = do_command(gspca_dev, CPIA_COMMAND_DiscardFrame,
+                                0, 0, 0, 0);
+               if (ret)
+                       return ret;
+
+               ret = goto_low_power(gspca_dev);
+               if (ret)
+                       return ret;
+       }
+
+       /* procedure described in developer's guide p3-28 */
+
+       /* Check the firmware version. */
+       sd->params.version.firmwareVersion = 0;
+       get_version_information(gspca_dev);
+       if (sd->params.version.firmwareVersion != 1) {
+               PDEBUG(D_ERR, "only firmware version 1 is supported (got: %d)",
+                      sd->params.version.firmwareVersion);
+               return -ENODEV;
+       }
+
+       /* A bug in firmware 1-02 limits gainMode to 2 */
+       if (sd->params.version.firmwareRevision <= 2 &&
+           sd->params.exposure.gainMode > 2) {
+               sd->params.exposure.gainMode = 2;
+       }
+
+       /* set QX3 detected flag */
+       sd->params.qx3.qx3_detected = (sd->params.pnpID.vendor == 0x0813 &&
+                                      sd->params.pnpID.product == 0x0001);
+
+       /* The fatal error checking should be done after
+        * the camera powers up (developer's guide p 3-38) */
+
+       /* Set streamState before transition to high power to avoid bug
+        * in firmware 1-02 */
+       ret = do_command(gspca_dev, CPIA_COMMAND_ModifyCameraStatus,
+                        STREAMSTATE, 0, STREAM_NOT_READY, 0);
+       if (ret)
+               return ret;
+
+       /* GotoHiPower */
+       ret = goto_high_power(gspca_dev);
+       if (ret)
+               return ret;
+
+       /* Check the camera status */
+       ret = do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       if (sd->params.status.fatalError) {
+               PDEBUG(D_ERR, "fatal_error: %04x, vp_status: %04x",
+                      sd->params.status.fatalError,
+                      sd->params.status.vpStatus);
+               return -EIO;
+       }
+
+       /* VPVersion can't be retrieved before the camera is in HiPower,
+        * so get it here instead of in get_version_information. */
+       ret = do_command(gspca_dev, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0);
+       if (ret)
+               return ret;
+
+       /* Determine video mode settings */
+       sd->params.streamStartLine = 120;
+
+       priv = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
+       if (priv & 0x01) { /* crop */
+               sd->params.roi.colStart = 2;
+               sd->params.roi.rowStart = 6;
+       } else {
+               sd->params.roi.colStart = 0;
+               sd->params.roi.rowStart = 0;
+       }
+
+       if (priv & 0x02) { /* quarter */
+               sd->params.format.videoSize = VIDEOSIZE_QCIF;
+               sd->params.roi.colStart /= 2;
+               sd->params.roi.rowStart /= 2;
+               sd->params.streamStartLine /= 2;
+       } else
+               sd->params.format.videoSize = VIDEOSIZE_CIF;
+
+       sd->params.roi.colEnd = sd->params.roi.colStart +
+                               (gspca_dev->width >> 3);
+       sd->params.roi.rowEnd = sd->params.roi.rowStart +
+                               (gspca_dev->height >> 2);
+
+       /* And now set the camera to a known state */
+       ret = do_command(gspca_dev, CPIA_COMMAND_SetGrabMode,
+                        CPIA_GRAB_CONTINEOUS, 0, 0, 0);
+       if (ret)
+               return ret;
+       /* We start with compression disabled, as we need one uncompressed
+          frame to handle later compressed frames */
+       ret = do_command(gspca_dev, CPIA_COMMAND_SetCompression,
+                        CPIA_COMPRESSION_NONE,
+                        NO_DECIMATION, 0, 0);
+       if (ret)
+               return ret;
+       ret = command_setcompressiontarget(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setcolourparams(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setformat(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setyuvtresh(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setecptiming(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setcompressionparams(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setexposure(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setcolourbalance(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setsensorfps(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setapcor(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setflickerctrl(gspca_dev);
+       if (ret)
+               return ret;
+       ret = command_setvloffset(gspca_dev);
+       if (ret)
+               return ret;
+
+       /* Start stream */
+       ret = command_resume(gspca_dev);
+       if (ret)
+               return ret;
+
+       /* Wait 6 frames before turning compression on for the sensor to get
+          all settings and AEC/ACB to settle */
+       sd->first_frame = 6;
+       sd->exposure_status = EXPOSURE_NORMAL;
+       sd->exposure_count = 0;
+       atomic_set(&sd->cam_exposure, 0);
+       atomic_set(&sd->fps, 0);
+
+       return 0;
+}
+
+static void sd_stopN(struct gspca_dev *gspca_dev)
+{
+       command_pause(gspca_dev);
+
+       /* save camera state for later open (developers guide ch 3.5.3) */
+       save_camera_state(gspca_dev);
+
+       /* GotoLoPower */
+       goto_low_power(gspca_dev);
+
+       /* Update the camera status */
+       do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
+}
+
+/* this function is called at probe and resume time */
+static int sd_init(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       /* Start / Stop the camera to make sure we are talking to
+          a supported camera, and to get some information from it
+          to print. */
+       ret = sd_start(gspca_dev);
+       if (ret)
+               return ret;
+
+       sd_stopN(gspca_dev);
+
+       PDEBUG(D_PROBE, "CPIA Version:             %d.%02d (%d.%d)",
+                       sd->params.version.firmwareVersion,
+                       sd->params.version.firmwareRevision,
+                       sd->params.version.vcVersion,
+                       sd->params.version.vcRevision);
+       PDEBUG(D_PROBE, "CPIA PnP-ID:              %04x:%04x:%04x",
+                       sd->params.pnpID.vendor, sd->params.pnpID.product,
+                       sd->params.pnpID.deviceRevision);
+       PDEBUG(D_PROBE, "VP-Version:               %d.%d %04x",
+                       sd->params.vpVersion.vpVersion,
+                       sd->params.vpVersion.vpRevision,
+                       sd->params.vpVersion.cameraHeadID);
+
+       return 0;
+}
+
+static void sd_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,
+                       int len)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       /* Check for SOF */
+       if (len >= 64 &&
+           data[0] == MAGIC_0 && data[1] == MAGIC_1 &&
+           data[16] == sd->params.format.videoSize &&
+           data[17] == sd->params.format.subSample &&
+           data[18] == sd->params.format.yuvOrder &&
+           data[24] == sd->params.roi.colStart &&
+           data[25] == sd->params.roi.colEnd &&
+           data[26] == sd->params.roi.rowStart &&
+           data[27] == sd->params.roi.rowEnd) {
+               struct gspca_frame *frame = gspca_get_i_frame(gspca_dev);
+
+               atomic_set(&sd->cam_exposure, data[39] * 2);
+               atomic_set(&sd->fps, data[41]);
+
+               if (frame == NULL) {
+                       gspca_dev->last_packet_type = DISCARD_PACKET;
+                       return;
+               }
+
+               /* Check for proper EOF for last frame */
+               if ((frame->data_end - frame->data) > 4 &&
+                   frame->data_end[-4] == 0xff &&
+                   frame->data_end[-3] == 0xff &&
+                   frame->data_end[-2] == 0xff &&
+                   frame->data_end[-1] == 0xff)
+                       gspca_frame_add(gspca_dev, LAST_PACKET,
+                                               NULL, 0);
+
+               gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
+               return;
+       }
+
+       gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
+}
+
+static void sd_dq_callback(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       /* Set the normal compression settings once we have captured a
+          few uncompressed frames (and AEC has hopefully settled) */
+       if (sd->first_frame) {
+               sd->first_frame--;
+               if (sd->first_frame == 0)
+                       command_setcompression(gspca_dev);
+       }
+
+       /* Switch flicker control back on if it got turned off */
+       restart_flicker(gspca_dev);
+
+       /* If AEC is enabled, monitor the exposure and
+          adjust the sensor frame rate if needed */
+       if (sd->params.exposure.expMode == 2)
+               monitor_exposure(gspca_dev);
+
+       /* Update our knowledge of the camera state */
+       do_command(gspca_dev, CPIA_COMMAND_GetExposure, 0, 0, 0, 0);
+       if (sd->params.qx3.qx3_detected)
+               do_command(gspca_dev, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0);
+}
+
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int ret;
+
+       sd->params.colourParams.brightness = val;
+       sd->params.flickerControl.allowableOverExposure =
+               find_over_exposure(sd->params.colourParams.brightness);
+       if (gspca_dev->streaming) {
+               ret = command_setcolourparams(gspca_dev);
+               if (ret)
+                       return ret;
+               return command_setflickerctrl(gspca_dev);
+       }
+       return 0;
+}
+
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->params.colourParams.brightness;
+       return 0;
+}
+
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->params.colourParams.contrast = val;
+       if (gspca_dev->streaming)
+               return command_setcolourparams(gspca_dev);
+
+       return 0;
+}
+
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->params.colourParams.contrast;
+       return 0;
+}
+
+static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->params.colourParams.saturation = val;
+       if (gspca_dev->streaming)
+               return command_setcolourparams(gspca_dev);
+
+       return 0;
+}
+
+static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->params.colourParams.saturation;
+       return 0;
+}
+
+static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int on;
+
+       switch (val) {
+       case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
+               on = 0;
+               break;
+       case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
+               on = 1;
+               sd->mainsFreq = 0;
+               break;
+       case 2:         /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
+               on = 1;
+               sd->mainsFreq = 1;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       sd->freq = val;
+       sd->params.flickerControl.coarseJump =
+               flicker_jumps[sd->mainsFreq]
+                            [sd->params.sensorFps.baserate]
+                            [sd->params.sensorFps.divisor];
+
+       return set_flicker(gspca_dev, on, gspca_dev->streaming);
+}
+
+static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->freq;
+       return 0;
+}
+
+static int sd_setcomptarget(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->params.compressionTarget.frTargeting = val;
+       if (gspca_dev->streaming)
+               return command_setcompressiontarget(gspca_dev);
+
+       return 0;
+}
+
+static int sd_getcomptarget(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->params.compressionTarget.frTargeting;
+       return 0;
+}
+
+static int sd_querymenu(struct gspca_dev *gspca_dev,
+                       struct v4l2_querymenu *menu)
+{
+       switch (menu->id) {
+       case V4L2_CID_POWER_LINE_FREQUENCY:
+               switch (menu->index) {
+               case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
+                       strcpy((char *) menu->name, "NoFliker");
+                       return 0;
+               case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
+                       strcpy((char *) menu->name, "50 Hz");
+                       return 0;
+               case 2:         /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
+                       strcpy((char *) menu->name, "60 Hz");
+                       return 0;
+               }
+               break;
+       case V4L2_CID_COMP_TARGET:
+               switch (menu->index) {
+               case CPIA_COMPRESSION_TARGET_QUALITY:
+                       strcpy((char *) menu->name, "Quality");
+                       return 0;
+               case CPIA_COMPRESSION_TARGET_FRAMERATE:
+                       strcpy((char *) menu->name, "Framerate");
+                       return 0;
+               }
+               break;
+       }
+       return -EINVAL;
+}
+
+/* sub-driver description */
+static const struct sd_desc sd_desc = {
+       .name = MODULE_NAME,
+       .ctrls = sd_ctrls,
+       .nctrls = ARRAY_SIZE(sd_ctrls),
+       .config = sd_config,
+       .init = sd_init,
+       .start = sd_start,
+       .stopN = sd_stopN,
+       .dq_callback = sd_dq_callback,
+       .pkt_scan = sd_pkt_scan,
+       .querymenu = sd_querymenu,
+};
+
+/* -- module initialisation -- */
+static const __devinitdata struct usb_device_id device_table[] = {
+       {USB_DEVICE(0x0553, 0x0002)},
+       {USB_DEVICE(0x0813, 0x0001)},
+       {}
+};
+MODULE_DEVICE_TABLE(usb, device_table);
+
+/* -- device connect -- */
+static int sd_probe(struct usb_interface *intf,
+                       const struct usb_device_id *id)
+{
+       return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
+                               THIS_MODULE);
+}
+
+static struct usb_driver sd_driver = {
+       .name = MODULE_NAME,
+       .id_table = device_table,
+       .probe = sd_probe,
+       .disconnect = gspca_disconnect,
+#ifdef CONFIG_PM
+       .suspend = gspca_suspend,
+       .resume = gspca_resume,
+#endif
+};
+
+/* -- module insert / remove -- */
+static int __init sd_mod_init(void)
+{
+       int ret;
+       ret = usb_register(&sd_driver);
+       if (ret < 0)
+               return ret;
+       PDEBUG(D_PROBE, "registered");
+       return 0;
+}
+static void __exit sd_mod_exit(void)
+{
+       usb_deregister(&sd_driver);
+       PDEBUG(D_PROBE, "deregistered");
+}
+
+module_init(sd_mod_init);
+module_exit(sd_mod_exit);
index fdf4c0ec5e7af6c93adf25cf684fd59efe478320..ecd4d743d2bc15d82f867d6c8ca1a98589690525 100644 (file)
@@ -52,7 +52,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
         {
          .id = V4L2_CID_BRIGHTNESS,
@@ -851,7 +851,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
index 4878c8f66543dc26ac88d7179f642dcabc7d3453..9e42476c0eafdc55ca04eb0423d4a9f2fb6a9283 100644 (file)
@@ -161,7 +161,7 @@ static int gl860_build_control_table(struct gspca_dev *gspca_dev)
 
 /*==================== sud-driver structure initialisation =================*/
 
-static struct sd_desc sd_desc_mi1320 = {
+static const struct sd_desc sd_desc_mi1320 = {
        .name        = MODULE_NAME,
        .ctrls       = sd_ctrls_mi1320,
        .nctrls      = GL860_NCTRLS,
@@ -174,7 +174,7 @@ static struct sd_desc sd_desc_mi1320 = {
        .dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_mi2020 = {
+static const struct sd_desc sd_desc_mi2020 = {
        .name        = MODULE_NAME,
        .ctrls       = sd_ctrls_mi2020,
        .nctrls      = GL860_NCTRLS,
@@ -187,7 +187,7 @@ static struct sd_desc sd_desc_mi2020 = {
        .dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_mi2020b = {
+static const struct sd_desc sd_desc_mi2020b = {
        .name        = MODULE_NAME,
        .ctrls       = sd_ctrls_mi2020b,
        .nctrls      = GL860_NCTRLS,
@@ -200,7 +200,7 @@ static struct sd_desc sd_desc_mi2020b = {
        .dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_ov2640 = {
+static const struct sd_desc sd_desc_ov2640 = {
        .name        = MODULE_NAME,
        .ctrls       = sd_ctrls_ov2640,
        .nctrls      = GL860_NCTRLS,
@@ -213,7 +213,7 @@ static struct sd_desc sd_desc_ov2640 = {
        .dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_ov9655 = {
+static const struct sd_desc sd_desc_ov9655 = {
        .name        = MODULE_NAME,
        .ctrls       = sd_ctrls_ov9655,
        .nctrls      = GL860_NCTRLS,
index e930a67d526b2f2a04e94da7c46ac5c3624c78a2..222af479150b4baa2fea9444eeeb40010b95c20b 100644 (file)
@@ -3,6 +3,9 @@
  *
  * Copyright (C) 2008-2009 Jean-Francois Moine (http://moinejf.free.fr)
  *
+ * Camera button input handling by Márton Németh
+ * Copyright (C) 2009-2010 Márton Németh <nm127@freemail.hu>
+ *
  * 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
 
 #include "gspca.h"
 
+#ifdef CONFIG_INPUT
+#include <linux/input.h>
+#include <linux/usb/input.h>
+#endif
+
 /* global values */
 #define DEF_NURBS 3            /* default number of URBs */
 #if DEF_NURBS > MAX_NURBS
@@ -47,7 +55,7 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
 MODULE_DESCRIPTION("GSPCA USB Camera Driver");
 MODULE_LICENSE("GPL");
 
-#define DRIVER_VERSION_NUMBER  KERNEL_VERSION(2, 8, 0)
+#define DRIVER_VERSION_NUMBER  KERNEL_VERSION(2, 9, 0)
 
 #ifdef GSPCA_DEBUG
 int gspca_debug = D_ERR | D_PROBE;
@@ -104,15 +112,185 @@ static const struct vm_operations_struct gspca_vm_ops = {
        .close          = gspca_vm_close,
 };
 
+/*
+ * Input and interrupt endpoint handling functions
+ */
+#ifdef CONFIG_INPUT
+static void int_irq(struct urb *urb)
+{
+       struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
+       int ret;
+
+       ret = urb->status;
+       switch (ret) {
+       case 0:
+               if (gspca_dev->sd_desc->int_pkt_scan(gspca_dev,
+                   urb->transfer_buffer, urb->actual_length) < 0) {
+                       PDEBUG(D_ERR, "Unknown packet received");
+               }
+               break;
+
+       case -ENOENT:
+       case -ECONNRESET:
+       case -ENODEV:
+       case -ESHUTDOWN:
+               /* Stop is requested either by software or hardware is gone,
+                * keep the ret value non-zero and don't resubmit later.
+                */
+               break;
+
+       default:
+               PDEBUG(D_ERR, "URB error %i, resubmitting", urb->status);
+               urb->status = 0;
+               ret = 0;
+       }
+
+       if (ret == 0) {
+               ret = usb_submit_urb(urb, GFP_ATOMIC);
+               if (ret < 0)
+                       PDEBUG(D_ERR, "Resubmit URB failed with error %i", ret);
+       }
+}
+
+static int gspca_input_connect(struct gspca_dev *dev)
+{
+       struct input_dev *input_dev;
+       int err = 0;
+
+       dev->input_dev = NULL;
+       if (dev->sd_desc->int_pkt_scan || dev->sd_desc->other_input)  {
+               input_dev = input_allocate_device();
+               if (!input_dev)
+                       return -ENOMEM;
+
+               usb_make_path(dev->dev, dev->phys, sizeof(dev->phys));
+               strlcat(dev->phys, "/input0", sizeof(dev->phys));
+
+               input_dev->name = dev->sd_desc->name;
+               input_dev->phys = dev->phys;
+
+               usb_to_input_id(dev->dev, &input_dev->id);
+
+               input_dev->evbit[0] = BIT_MASK(EV_KEY);
+               input_dev->keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA);
+               input_dev->dev.parent = &dev->dev->dev;
+
+               err = input_register_device(input_dev);
+               if (err) {
+                       PDEBUG(D_ERR, "Input device registration failed "
+                               "with error %i", err);
+                       input_dev->dev.parent = NULL;
+                       input_free_device(input_dev);
+               } else {
+                       dev->input_dev = input_dev;
+               }
+       }
+
+       return err;
+}
+
+static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev,
+                         struct usb_endpoint_descriptor *ep)
+{
+       unsigned int buffer_len;
+       int interval;
+       struct urb *urb;
+       struct usb_device *dev;
+       void *buffer = NULL;
+       int ret = -EINVAL;
+
+       buffer_len = ep->wMaxPacketSize;
+       interval = ep->bInterval;
+       PDEBUG(D_PROBE, "found int in endpoint: 0x%x, "
+               "buffer_len=%u, interval=%u",
+               ep->bEndpointAddress, buffer_len, interval);
+
+       dev = gspca_dev->dev;
+
+       urb = usb_alloc_urb(0, GFP_KERNEL);
+       if (!urb) {
+               ret = -ENOMEM;
+               goto error;
+       }
+
+       buffer = usb_buffer_alloc(dev, ep->wMaxPacketSize,
+                               GFP_KERNEL, &urb->transfer_dma);
+       if (!buffer) {
+               ret = -ENOMEM;
+               goto error_buffer;
+       }
+       usb_fill_int_urb(urb, dev,
+               usb_rcvintpipe(dev, ep->bEndpointAddress),
+               buffer, buffer_len,
+               int_irq, (void *)gspca_dev, interval);
+       gspca_dev->int_urb = urb;
+       ret = usb_submit_urb(urb, GFP_KERNEL);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "submit URB failed with error %i", ret);
+               goto error_submit;
+       }
+       return ret;
+
+error_submit:
+       usb_buffer_free(dev,
+                       urb->transfer_buffer_length,
+                       urb->transfer_buffer,
+                       urb->transfer_dma);
+error_buffer:
+       usb_free_urb(urb);
+error:
+       return ret;
+}
+
+static void gspca_input_create_urb(struct gspca_dev *gspca_dev)
+{
+       struct usb_interface *intf;
+       struct usb_host_interface *intf_desc;
+       struct usb_endpoint_descriptor *ep;
+       int i;
+
+       if (gspca_dev->sd_desc->int_pkt_scan)  {
+               intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface);
+               intf_desc = intf->cur_altsetting;
+               for (i = 0; i < intf_desc->desc.bNumEndpoints; i++) {
+                       ep = &intf_desc->endpoint[i].desc;
+                       if (usb_endpoint_dir_in(ep) &&
+                           usb_endpoint_xfer_int(ep)) {
+
+                               alloc_and_submit_int_urb(gspca_dev, ep);
+                               break;
+                       }
+               }
+       }
+}
+
+static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev)
+{
+       struct urb *urb;
+
+       urb = gspca_dev->int_urb;
+       if (urb) {
+               gspca_dev->int_urb = NULL;
+               usb_kill_urb(urb);
+               usb_buffer_free(gspca_dev->dev,
+                               urb->transfer_buffer_length,
+                               urb->transfer_buffer,
+                               urb->transfer_dma);
+               usb_free_urb(urb);
+       }
+}
+#else
+#define gspca_input_connect(gspca_dev)         0
+#define gspca_input_create_urb(gspca_dev)
+#define gspca_input_destroy_urb(gspca_dev)
+#endif
+
 /* get the current input frame buffer */
 struct gspca_frame *gspca_get_i_frame(struct gspca_dev *gspca_dev)
 {
        struct gspca_frame *frame;
-       int i;
 
-       i = gspca_dev->fr_i;
-       i = gspca_dev->fr_queue[i];
-       frame = &gspca_dev->frame[i];
+       frame = gspca_dev->cur_frame;
        if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
                                != V4L2_BUF_FLAG_QUEUED)
                return NULL;
@@ -486,11 +664,13 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
                        i, ep->desc.bEndpointAddress);
        gspca_dev->alt = i;             /* memorize the current alt setting */
        if (gspca_dev->nbalt > 1) {
+               gspca_input_destroy_urb(gspca_dev);
                ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, i);
                if (ret < 0) {
                        err("set alt %d err %d", i, ret);
-                       return NULL;
+                       ep = NULL;
                }
+               gspca_input_create_urb(gspca_dev);
        }
        return ep;
 }
@@ -534,26 +714,22 @@ static int create_urbs(struct gspca_dev *gspca_dev,
                        nurbs = 1;
        }
 
-       gspca_dev->nurbs = nurbs;
        for (n = 0; n < nurbs; n++) {
                urb = usb_alloc_urb(npkt, GFP_KERNEL);
                if (!urb) {
                        err("usb_alloc_urb failed");
-                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
+               gspca_dev->urb[n] = urb;
                urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
                                                bsize,
                                                GFP_KERNEL,
                                                &urb->transfer_dma);
 
                if (urb->transfer_buffer == NULL) {
-                       usb_free_urb(urb);
-                       err("usb_buffer_urb failed");
-                       destroy_urbs(gspca_dev);
+                       err("usb_buffer_alloc failed");
                        return -ENOMEM;
                }
-               gspca_dev->urb[n] = urb;
                urb->dev = gspca_dev->dev;
                urb->context = gspca_dev;
                urb->transfer_buffer_length = bsize;
@@ -585,6 +761,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 static int gspca_init_transfer(struct gspca_dev *gspca_dev)
 {
        struct usb_host_endpoint *ep;
+       struct urb *urb;
        int n, ret;
 
        if (mutex_lock_interruptible(&gspca_dev->usb_lock))
@@ -595,6 +772,8 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
                goto out;
        }
 
+       gspca_dev->usb_err = 0;
+
        /* set the higher alternate setting and
         * loop until urb submit succeeds */
        if (gspca_dev->cam.reverse_alts)
@@ -613,10 +792,15 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
                goto out;
        }
        for (;;) {
-               PDEBUG(D_STREAM, "init transfer alt %d", gspca_dev->alt);
-               ret = create_urbs(gspca_dev, ep);
-               if (ret < 0)
-                       goto out;
+               if (!gspca_dev->cam.no_urb_create) {
+                       PDEBUG(D_STREAM, "init transfer alt %d",
+                               gspca_dev->alt);
+                       ret = create_urbs(gspca_dev, ep);
+                       if (ret < 0) {
+                               destroy_urbs(gspca_dev);
+                               goto out;
+                       }
+               }
 
                /* clear the bulk endpoint */
                if (gspca_dev->cam.bulk)
@@ -636,8 +820,11 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
                        break;
 
                /* submit the URBs */
-               for (n = 0; n < gspca_dev->nurbs; n++) {
-                       ret = usb_submit_urb(gspca_dev->urb[n], GFP_KERNEL);
+               for (n = 0; n < MAX_NURBS; n++) {
+                       urb = gspca_dev->urb[n];
+                       if (urb == NULL)
+                               break;
+                       ret = usb_submit_urb(urb, GFP_KERNEL);
                        if (ret < 0)
                                break;
                }
@@ -694,7 +881,9 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev)
                if (gspca_dev->sd_desc->stopN)
                        gspca_dev->sd_desc->stopN(gspca_dev);
                destroy_urbs(gspca_dev);
+               gspca_input_destroy_urb(gspca_dev);
                gspca_set_alt0(gspca_dev);
+               gspca_input_create_urb(gspca_dev);
        }
 
        /* always call stop0 to free the subdriver's resources */
@@ -1815,6 +2004,8 @@ static int vidioc_qbuf(struct file *file, void *priv,
        /* put the buffer in the 'queued' queue */
        i = gspca_dev->fr_q;
        gspca_dev->fr_queue[i] = index;
+       if (gspca_dev->fr_i == i)
+               gspca_dev->cur_frame = frame;
        gspca_dev->fr_q = (i + 1) % gspca_dev->nframes;
        PDEBUG(D_FRAM, "qbuf q:%d i:%d o:%d",
                gspca_dev->fr_q,
@@ -2058,11 +2249,12 @@ int gspca_dev_probe(struct usb_interface *intf,
                PDEBUG(D_ERR, "Too many config");
                return -ENODEV;
        }
+
+       /* the USB video interface must be the first one */
        interface = &intf->cur_altsetting->desc;
-       if (interface->bInterfaceNumber > 0) {
-               PDEBUG(D_ERR, "intf != 0");
+       if (dev->config->desc.bNumInterfaces != 1 &&
+           interface->bInterfaceNumber != 0)
                return -ENODEV;
-       }
 
        /* create the device */
        if (dev_size < sizeof *gspca_dev)
@@ -2094,6 +2286,10 @@ int gspca_dev_probe(struct usb_interface *intf,
                goto out;
        gspca_set_default_mode(gspca_dev);
 
+       ret = gspca_input_connect(gspca_dev);
+       if (ret)
+               goto out;
+
        mutex_init(&gspca_dev->usb_lock);
        mutex_init(&gspca_dev->read_lock);
        mutex_init(&gspca_dev->queue_lock);
@@ -2114,8 +2310,15 @@ int gspca_dev_probe(struct usb_interface *intf,
 
        usb_set_intfdata(intf, gspca_dev);
        PDEBUG(D_PROBE, "%s created", video_device_node_name(&gspca_dev->vdev));
+
+       gspca_input_create_urb(gspca_dev);
+
        return 0;
 out:
+#ifdef CONFIG_INPUT
+       if (gspca_dev->input_dev)
+               input_unregister_device(gspca_dev->input_dev);
+#endif
        kfree(gspca_dev->usb_buf);
        kfree(gspca_dev);
        return ret;
@@ -2131,6 +2334,9 @@ EXPORT_SYMBOL(gspca_dev_probe);
 void gspca_disconnect(struct usb_interface *intf)
 {
        struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
+#ifdef CONFIG_INPUT
+       struct input_dev *input_dev;
+#endif
 
        PDEBUG(D_PROBE, "%s disconnect",
                video_device_node_name(&gspca_dev->vdev));
@@ -2142,6 +2348,15 @@ void gspca_disconnect(struct usb_interface *intf)
                wake_up_interruptible(&gspca_dev->wq);
        }
 
+#ifdef CONFIG_INPUT
+       gspca_input_destroy_urb(gspca_dev);
+       input_dev = gspca_dev->input_dev;
+       if (input_dev) {
+               gspca_dev->input_dev = NULL;
+               input_unregister_device(input_dev);
+       }
+#endif
+
        /* the device is freed at exit of this function */
        gspca_dev->dev = NULL;
        mutex_unlock(&gspca_dev->usb_lock);
@@ -2167,6 +2382,7 @@ int gspca_suspend(struct usb_interface *intf, pm_message_t message)
        if (gspca_dev->sd_desc->stopN)
                gspca_dev->sd_desc->stopN(gspca_dev);
        destroy_urbs(gspca_dev);
+       gspca_input_destroy_urb(gspca_dev);
        gspca_set_alt0(gspca_dev);
        if (gspca_dev->sd_desc->stop0)
                gspca_dev->sd_desc->stop0(gspca_dev);
@@ -2180,6 +2396,7 @@ int gspca_resume(struct usb_interface *intf)
 
        gspca_dev->frozen = 0;
        gspca_dev->sd_desc->init(gspca_dev);
+       gspca_input_create_urb(gspca_dev);
        if (gspca_dev->streaming)
                return gspca_init_transfer(gspca_dev);
        return 0;
@@ -2203,6 +2420,8 @@ int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum,
        int retval = 0;
 
        for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) {
+               if (gspca_dev->ctrl_dis & (1 << i))
+                       continue;
                if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_GAIN)
                        gain_ctrl = &gspca_dev->sd_desc->ctrls[i];
                if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_EXPOSURE)
index 59c7941da99977a0980b81419ad23185cb632c62..02c696a22be005fb4df1eeb4c052b735c9bb3aa5 100644 (file)
@@ -48,26 +48,27 @@ extern int gspca_debug;
 
 /* used to list framerates supported by a camera mode (resolution) */
 struct framerates {
-       int *rates;
+       const u8 *rates;
        int nrates;
 };
 
 /* device information - set at probe time */
 struct cam {
-       int bulk_size;          /* buffer size when image transfer by bulk */
        const struct v4l2_pix_format *cam_mode; /* size nmodes */
-       char nmodes;
        const struct framerates *mode_framerates; /* must have size nmode,
                                                   * just like cam_mode */
-       __u8 bulk_nurbs;        /* number of URBs in bulk mode
+       u32 bulk_size;          /* buffer size when image transfer by bulk */
+       u32 input_flags;        /* value for ENUM_INPUT status flags */
+       u8 nmodes;              /* size of cam_mode */
+       u8 no_urb_create;       /* don't create transfer URBs */
+       u8 bulk_nurbs;          /* number of URBs in bulk mode
                                 * - cannot be > MAX_NURBS
                                 * - when 0 and bulk_size != 0 means
                                 *   1 URB and submit done by subdriver */
        u8 bulk;                /* image transfer by 0:isoc / 1:bulk */
        u8 npkt;                /* number of packets in an ISOC message
                                 * 0 is the default value: 32 packets */
-       u32 input_flags;        /* value for ENUM_INPUT status flags */
-       char reverse_alts;      /* Alt settings are in high to low order */
+       u8 reverse_alts;        /* Alt settings are in high to low order */
 };
 
 struct gspca_dev;
@@ -90,6 +91,9 @@ typedef int (*cam_qmnu_op) (struct gspca_dev *,
 typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev,
                                u8 *data,
                                int len);
+typedef int (*cam_int_pkt_op) (struct gspca_dev *gspca_dev,
+                               u8 *data,
+                               int len);
 
 struct ctrl {
        struct v4l2_queryctrl qctrl;
@@ -125,6 +129,12 @@ struct sd_desc {
        cam_reg_op get_register;
 #endif
        cam_ident_op get_chip_ident;
+#ifdef CONFIG_INPUT
+       cam_int_pkt_op int_pkt_scan;
+       /* other_input makes the gspca core create gspca_dev->input even when
+          int_pkt_scan is NULL, for cams with non interrupt driven buttons */
+       u8 other_input;
+#endif
 };
 
 /* packet types when moving from iso buf to frame buf */
@@ -147,6 +157,10 @@ struct gspca_dev {
        struct module *module;          /* subdriver handling the device */
        struct usb_device *dev;
        struct file *capt_file;         /* file doing video capture */
+#ifdef CONFIG_INPUT
+       struct input_dev *input_dev;
+       char phys[64];                  /* physical device path */
+#endif
 
        struct cam cam;                         /* device information */
        const struct sd_desc *sd_desc;          /* subdriver description */
@@ -156,6 +170,9 @@ struct gspca_dev {
 #define USB_BUF_SZ 64
        __u8 *usb_buf;                          /* buffer for USB exchanges */
        struct urb *urb[MAX_NURBS];
+#ifdef CONFIG_INPUT
+       struct urb *int_urb;
+#endif
 
        __u8 *frbuf;                            /* buffer for nframes */
        struct gspca_frame frame[GSPCA_MAX_FRAMES];
@@ -187,7 +204,6 @@ struct gspca_dev {
        char users;                     /* number of opens */
        char present;                   /* device connected */
        char nbufread;                  /* number of buffers for read() */
-       char nurbs;                     /* number of allocated URBs */
        char memory;                    /* memory type (V4L2_MEMORY_xxx) */
        __u8 iface;                     /* USB interface number */
        __u8 alt;                       /* USB alternate setting */
index 8d071dff6944bf01d178180764f70cf166e17b5b..c0722fa646066304f124035a2b7505b43d25ec84 100644 (file)
@@ -48,7 +48,7 @@ static struct v4l2_pix_format mt9m111_modes[] = {
        }
 };
 
-const static struct ctrl mt9m111_ctrls[] = {
+static const struct ctrl mt9m111_ctrls[] = {
 #define VFLIP_IDX 0
        {
                {
@@ -171,7 +171,7 @@ int mt9m111_probe(struct sd *sd)
                return -ENODEV;
        }
 
-       info("Probing for a mt9m111 sensor");
+       PDEBUG(D_PROBE, "Probing for a mt9m111 sensor");
 
        /* Do the preinit */
        for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) {
index 2a28b74cb3f9ad5313778483d0318685882f7285..62c1cbf066666dda9efcff261a813e78a3f9d8e8 100644 (file)
@@ -33,7 +33,7 @@ static int ov7660_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
 static int ov7660_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
 static int ov7660_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
 
-const static struct ctrl ov7660_ctrls[] = {
+static const struct ctrl ov7660_ctrls[] = {
 #define GAIN_IDX 1
        {
                {
index f5588ebe667cae16cbe3b6dc595aa9696d4c81c6..4d9dcf29da2e4ef24e9cb6826ffa024f60420e7f 100644 (file)
@@ -94,7 +94,7 @@ int ov7660_start(struct sd *sd);
 int ov7660_stop(struct sd *sd);
 void ov7660_disconnect(struct sd *sd);
 
-const static struct m5602_sensor ov7660 = {
+static const struct m5602_sensor ov7660 = {
        .name = "ov7660",
        .i2c_slave_id = 0x42,
        .i2c_regW = 1,
index 923cdd5f7a6b227d0cad2acbdc3b584acb53c328..069ba0044f8b2b182a9a42a683beef95cbf4e432 100644 (file)
@@ -307,7 +307,7 @@ int ov9650_probe(struct sd *sd)
                return -ENODEV;
        }
 
-       info("Probing for an ov9650 sensor");
+       PDEBUG(D_PROBE, "Probing for an ov9650 sensor");
 
        /* Run the pre-init before probing the sensor */
        for (i = 0; i < ARRAY_SIZE(preinit_ov9650) && !err; i++) {
index 8d74d8065b7977cb126d3fb23922830b317671f9..925b87d66f400f4532a9c866c71566b444db88d0 100644 (file)
@@ -205,7 +205,7 @@ int po1030_probe(struct sd *sd)
                return -ENODEV;
        }
 
-       info("Probing for a po1030 sensor");
+       PDEBUG(D_PROBE, "Probing for a po1030 sensor");
 
        /* Run the pre-init to actually probe the unit */
        for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
index aa2f3c7e2cb5467c3cb68879c4b4d7006427b804..da0a38c78708b6b7e78cd2923ab43f72c069c59a 100644 (file)
@@ -47,6 +47,12 @@ static
                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
                        DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xa 2528")
                }
+       }, {
+               .ident = "Fujitsu-Siemens Amilo Xi 2428",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 2428")
+               }
        }, {
                .ident = "Fujitsu-Siemens Amilo Xi 2528",
                .matches = {
@@ -242,7 +248,7 @@ int s5k4aa_probe(struct sd *sd)
                return -ENODEV;
        }
 
-       info("Probing for a s5k4aa sensor");
+       PDEBUG(D_PROBE, "Probing for a s5k4aa sensor");
 
        /* Preinit the sensor */
        for (i = 0; i < ARRAY_SIZE(preinit_s5k4aa) && !err; i++) {
index 6b89f33a4ce015c0b6e0b9c9f69872dba1fd77e2..fbd91545497a8e6b36d36ecae38898664c8e4d34 100644 (file)
@@ -143,7 +143,7 @@ int s5k83a_probe(struct sd *sd)
                return -ENODEV;
        }
 
-       info("Probing for a s5k83a sensor");
+       PDEBUG(D_PROBE, "Probing for a s5k83a sensor");
 
        /* Preinit the sensor */
        for (i = 0; i < ARRAY_SIZE(preinit_s5k83a) && !err; i++) {
index 9cf8d68c71bf9fa6ffa6438ca99d35fa4e59db58..3d9229e22b25cf2598f6f326750d66f9309e9695 100644 (file)
@@ -54,7 +54,7 @@ static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
index 9154870e07d29569b045c1813411fa6177ca8134..33744e724eaa8b41251bff7d0a4bd512b0de97a3 100644 (file)
 #define MR97310A_GAIN_MAX              31
 #define MR97310A_GAIN_DEFAULT          25
 
+#define MR97310A_CONTRAST_MIN          0
+#define MR97310A_CONTRAST_MAX          31
+#define MR97310A_CONTRAST_DEFAULT      23
+
+#define MR97310A_CS_GAIN_MIN           0
+#define MR97310A_CS_GAIN_MAX           0x7ff
+#define MR97310A_CS_GAIN_DEFAULT       0x110
+
 #define MR97310A_MIN_CLOCKDIV_MIN      3
 #define MR97310A_MIN_CLOCKDIV_MAX      8
 #define MR97310A_MIN_CLOCKDIV_DEFAULT  3
@@ -82,7 +90,8 @@ struct sd {
 
        int brightness;
        u16 exposure;
-       u8 gain;
+       u32 gain;
+       u8 contrast;
        u8 min_clockdiv;
 };
 
@@ -98,6 +107,8 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setmin_clockdiv(struct gspca_dev *gspca_dev, __s32 val);
@@ -105,11 +116,13 @@ static int sd_getmin_clockdiv(struct gspca_dev *gspca_dev, __s32 *val);
 static void setbrightness(struct gspca_dev *gspca_dev);
 static void setexposure(struct gspca_dev *gspca_dev);
 static void setgain(struct gspca_dev *gspca_dev);
+static void setcontrast(struct gspca_dev *gspca_dev);
 
 /* V4L2 controls supported by the driver */
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 /* Separate brightness control description for Argus QuickClix as it has
-   different limits from the other mr97310a cameras */
+ * different limits from the other mr97310a cameras, and separate gain
+ * control for Sakar CyberPix camera. */
        {
 #define NORM_BRIGHTNESS_IDX 0
                {
@@ -171,7 +184,37 @@ static struct ctrl sd_ctrls[] = {
                .get = sd_getgain,
        },
        {
-#define MIN_CLOCKDIV_IDX 4
+#define SAKAR_CS_GAIN_IDX 4
+               {
+                       .id = V4L2_CID_GAIN,
+                       .type = V4L2_CTRL_TYPE_INTEGER,
+                       .name = "Gain",
+                       .minimum = MR97310A_CS_GAIN_MIN,
+                       .maximum = MR97310A_CS_GAIN_MAX,
+                       .step = 1,
+                       .default_value = MR97310A_CS_GAIN_DEFAULT,
+                       .flags = 0,
+               },
+               .set = sd_setgain,
+               .get = sd_getgain,
+       },
+       {
+#define CONTRAST_IDX 5
+               {
+                       .id = V4L2_CID_CONTRAST,
+                       .type = V4L2_CTRL_TYPE_INTEGER,
+                       .name = "Contrast",
+                       .minimum = MR97310A_CONTRAST_MIN,
+                       .maximum = MR97310A_CONTRAST_MAX,
+                       .step = 1,
+                       .default_value = MR97310A_CONTRAST_DEFAULT,
+                       .flags = 0,
+               },
+               .set = sd_setcontrast,
+               .get = sd_getcontrast,
+       },
+       {
+#define MIN_CLOCKDIV_IDX 6
                {
                        .id = V4L2_CID_PRIVATE_BASE,
                        .type = V4L2_CTRL_TYPE_INTEGER,
@@ -327,7 +370,6 @@ static int zero_the_pointer(struct gspca_dev *gspca_dev)
        if (err_code < 0)
                return err_code;
 
-       err_code = mr_write(gspca_dev, 1);
        data[0] = 0x19;
        data[1] = 0x51;
        err_code = mr_write(gspca_dev, 2);
@@ -437,6 +479,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
+       int gain_default = MR97310A_GAIN_DEFAULT;
        int err_code;
 
        cam = &gspca_dev->cam;
@@ -460,12 +503,14 @@ static int sd_config(struct gspca_dev *gspca_dev,
        if (err_code < 0)
                return err_code;
 
+       /* Now, the query for sensor type. */
+       err_code = cam_get_response16(gspca_dev, 0x07, 1);
+       if (err_code < 0)
+               return err_code;
+
        if (id->idProduct == 0x0110 || id->idProduct == 0x010e) {
                sd->cam_type = CAM_TYPE_CIF;
                cam->nmodes--;
-               err_code = cam_get_response16(gspca_dev, 0x06, 1);
-               if (err_code < 0)
-                       return err_code;
                /*
                 * All but one of the known CIF cameras share the same USB ID,
                 * but two different init routines are in use, and the control
@@ -473,12 +518,12 @@ static int sd_config(struct gspca_dev *gspca_dev,
                 * of the two known varieties is connected!
                 *
                 * A list of known CIF cameras follows. They all report either
-                * 0002 for type 0 or 0003 for type 1.
+                * 0200 for type 0 or 0300 for type 1.
                 * If you have another to report, please do
                 *
                 * Name         sd->sensor_type         reported by
                 *
-                * Sakar Spy-shot       0               T. Kilgore
+                * Sakar 56379 Spy-shot 0               T. Kilgore
                 * Innovage             0               T. Kilgore
                 * Vivitar Mini         0               H. De Goede
                 * Vivitar Mini         0               E. Rodriguez
@@ -487,7 +532,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                 * Philips dig. keych.  1               T. Kilgore
                 * Trust Spyc@m 100     1               A. Jacobs
                 */
-               switch (gspca_dev->usb_buf[1]) {
+               switch (gspca_dev->usb_buf[0]) {
                case 2:
                        sd->sensor_type = 0;
                        break;
@@ -504,20 +549,19 @@ static int sd_config(struct gspca_dev *gspca_dev,
        } else {
                sd->cam_type = CAM_TYPE_VGA;
 
-               err_code = cam_get_response16(gspca_dev, 0x07, 1);
-               if (err_code < 0)
-                       return err_code;
-
                /*
-                * Here is a table of the responses to the previous command
-                * from the known MR97310A VGA cameras.
+                * Here is a table of the responses to the query for sensor
+                * type, from the known MR97310A VGA cameras. Six different
+                * cameras of which five share the same USB ID.
                 *
                 * Name                 gspca_dev->usb_buf[]    sd->sensor_type
                 *                              sd->do_lcd_stop
                 * Aiptek Pencam VGA+   0300            0               1
-                * ION digital          0350            0               1
+                * ION digital          0300            0               1
                 * Argus DC-1620        0450            1               0
                 * Argus QuickClix      0420            1               1
+                * Sakar 77379 Digital  0350            0               1
+                * Sakar 1638x CyberPix 0120            0               2
                 *
                 * Based upon these results, we assume default settings
                 * and then correct as necessary, as follows.
@@ -527,10 +571,12 @@ static int sd_config(struct gspca_dev *gspca_dev,
                sd->sensor_type = 1;
                sd->do_lcd_stop = 0;
                sd->adj_colors = 0;
-               if ((gspca_dev->usb_buf[0] != 0x03) &&
+               if (gspca_dev->usb_buf[0] == 0x01) {
+                       sd->sensor_type = 2;
+               } else if ((gspca_dev->usb_buf[0] != 0x03) &&
                                        (gspca_dev->usb_buf[0] != 0x04)) {
                        PDEBUG(D_ERR, "Unknown VGA Sensor id Byte 0: %02x",
-                                       gspca_dev->usb_buf[1]);
+                                       gspca_dev->usb_buf[0]);
                        PDEBUG(D_ERR, "Defaults assumed, may not work");
                        PDEBUG(D_ERR, "Please report this");
                }
@@ -560,7 +606,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d",
                       sd->sensor_type);
        }
-       /* Stop streaming as we've started it to probe the sensor type. */
+       /* Stop streaming as we've started it only to probe the sensor type. */
        sd_stopN(gspca_dev);
 
        if (force_sensor_type != -1) {
@@ -574,9 +620,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
                /* No brightness for sensor_type 0 */
                if (sd->sensor_type == 0)
                        gspca_dev->ctrl_dis = (1 << NORM_BRIGHTNESS_IDX) |
-                                             (1 << ARGUS_QC_BRIGHTNESS_IDX);
+                                             (1 << ARGUS_QC_BRIGHTNESS_IDX) |
+                                             (1 << CONTRAST_IDX) |
+                                             (1 << SAKAR_CS_GAIN_IDX);
                else
                        gspca_dev->ctrl_dis = (1 << ARGUS_QC_BRIGHTNESS_IDX) |
+                                             (1 << CONTRAST_IDX) |
+                                             (1 << SAKAR_CS_GAIN_IDX) |
                                              (1 << MIN_CLOCKDIV_IDX);
        } else {
                /* All controls need to be disabled if VGA sensor_type is 0 */
@@ -585,17 +635,30 @@ static int sd_config(struct gspca_dev *gspca_dev,
                                              (1 << ARGUS_QC_BRIGHTNESS_IDX) |
                                              (1 << EXPOSURE_IDX) |
                                              (1 << GAIN_IDX) |
+                                             (1 << CONTRAST_IDX) |
+                                             (1 << SAKAR_CS_GAIN_IDX) |
                                              (1 << MIN_CLOCKDIV_IDX);
-               else if (sd->do_lcd_stop)
+               else if (sd->sensor_type == 2) {
+                       gspca_dev->ctrl_dis = (1 << NORM_BRIGHTNESS_IDX) |
+                                             (1 << ARGUS_QC_BRIGHTNESS_IDX) |
+                                             (1 << GAIN_IDX) |
+                                             (1 << MIN_CLOCKDIV_IDX);
+                       gain_default = MR97310A_CS_GAIN_DEFAULT;
+               } else if (sd->do_lcd_stop)
                        /* Argus QuickClix has different brightness limits */
-                       gspca_dev->ctrl_dis = (1 << NORM_BRIGHTNESS_IDX);
+                       gspca_dev->ctrl_dis = (1 << NORM_BRIGHTNESS_IDX) |
+                                             (1 << CONTRAST_IDX) |
+                                             (1 << SAKAR_CS_GAIN_IDX);
                else
-                       gspca_dev->ctrl_dis = (1 << ARGUS_QC_BRIGHTNESS_IDX);
+                       gspca_dev->ctrl_dis = (1 << ARGUS_QC_BRIGHTNESS_IDX) |
+                                             (1 << CONTRAST_IDX) |
+                                             (1 << SAKAR_CS_GAIN_IDX);
        }
 
        sd->brightness = MR97310A_BRIGHTNESS_DEFAULT;
        sd->exposure = MR97310A_EXPOSURE_DEFAULT;
-       sd->gain = MR97310A_GAIN_DEFAULT;
+       sd->gain = gain_default;
+       sd->contrast = MR97310A_CONTRAST_DEFAULT;
        sd->min_clockdiv = MR97310A_MIN_CLOCKDIV_DEFAULT;
 
        return 0;
@@ -697,6 +760,12 @@ static int start_cif_cam(struct gspca_dev *gspca_dev)
                        {0x13, 0x00, {0x01}, 1},
                        {0, 0, {0}, 0}
                };
+               /* Without this command the cam won't work with USB-UHCI */
+               gspca_dev->usb_buf[0] = 0x0a;
+               gspca_dev->usb_buf[1] = 0x00;
+               err_code = mr_write(gspca_dev, 2);
+               if (err_code < 0)
+                       return err_code;
                err_code = sensor_write_regs(gspca_dev, cif_sensor1_init_data,
                                         ARRAY_SIZE(cif_sensor1_init_data));
        }
@@ -717,6 +786,10 @@ static int start_vga_cam(struct gspca_dev *gspca_dev)
                data[5]  = 0x00;
                data[10] = 0x91;
        }
+       if (sd->sensor_type == 2) {
+               data[5]  = 0x00;
+               data[10] = 0x18;
+       }
 
        switch (gspca_dev->width) {
        case 160:
@@ -731,6 +804,10 @@ static int start_vga_cam(struct gspca_dev *gspca_dev)
                data[4] = 0x78;  /* reg 3, V size/4 */
                data[6] = 0x04;  /* reg 5, H start */
                data[8] = 0x03;  /* reg 7, V start */
+               if (sd->sensor_type == 2) {
+                       data[6] = 2;
+                       data[8] = 1;
+               }
                if (sd->do_lcd_stop)
                        data[8] = 0x04;  /* Bayer tile shifted */
                break;
@@ -753,7 +830,6 @@ static int start_vga_cam(struct gspca_dev *gspca_dev)
                return err_code;
 
        if (!sd->sensor_type) {
-               /* The only known sensor_type 0 cam is the Argus DC-1620 */
                const struct sensor_w_data vga_sensor0_init_data[] = {
                        {0x01, 0x00, {0x0c, 0x00, 0x04}, 3},
                        {0x14, 0x00, {0x01, 0xe4, 0x02, 0x84}, 4},
@@ -764,7 +840,7 @@ static int start_vga_cam(struct gspca_dev *gspca_dev)
                };
                err_code = sensor_write_regs(gspca_dev, vga_sensor0_init_data,
                                         ARRAY_SIZE(vga_sensor0_init_data));
-       } else {        /* sd->sensor_type = 1 */
+       } else if (sd->sensor_type == 1) {
                const struct sensor_w_data color_adj[] = {
                        {0x02, 0x00, {0x06, 0x59, 0x0c, 0x16, 0x00,
                                /* adjusted blue, green, red gain correct
@@ -802,6 +878,48 @@ static int start_vga_cam(struct gspca_dev *gspca_dev)
 
                err_code = sensor_write_regs(gspca_dev, vga_sensor1_init_data,
                                         ARRAY_SIZE(vga_sensor1_init_data));
+       } else {        /* sensor type == 2 */
+               const struct sensor_w_data vga_sensor2_init_data[] = {
+
+                       {0x01, 0x00, {0x48}, 1},
+                       {0x02, 0x00, {0x22}, 1},
+                       /* Reg 3 msb and 4 is lsb of the exposure setting*/
+                       {0x05, 0x00, {0x10}, 1},
+                       {0x06, 0x00, {0x00}, 1},
+                       {0x07, 0x00, {0x00}, 1},
+                       {0x08, 0x00, {0x00}, 1},
+                       {0x09, 0x00, {0x00}, 1},
+                       /* The following are used in the gain control
+                        * which is BTW completely borked in the OEM driver
+                        * The values for each color go from 0 to 0x7ff
+                        *{0x0a, 0x00, {0x01}, 1},  green1 gain msb
+                        *{0x0b, 0x00, {0x10}, 1},  green1 gain lsb
+                        *{0x0c, 0x00, {0x01}, 1},  red gain msb
+                        *{0x0d, 0x00, {0x10}, 1},  red gain lsb
+                        *{0x0e, 0x00, {0x01}, 1},  blue gain msb
+                        *{0x0f, 0x00, {0x10}, 1},  blue gain lsb
+                        *{0x10, 0x00, {0x01}, 1}, green2 gain msb
+                        *{0x11, 0x00, {0x10}, 1}, green2 gain lsb
+                        */
+                       {0x12, 0x00, {0x00}, 1},
+                       {0x13, 0x00, {0x04}, 1}, /* weird effect on colors */
+                       {0x14, 0x00, {0x00}, 1},
+                       {0x15, 0x00, {0x06}, 1},
+                       {0x16, 0x00, {0x01}, 1},
+                       {0x17, 0x00, {0xe2}, 1}, /* vertical alignment */
+                       {0x18, 0x00, {0x02}, 1},
+                       {0x19, 0x00, {0x82}, 1}, /* don't mess with */
+                       {0x1a, 0x00, {0x00}, 1},
+                       {0x1b, 0x00, {0x20}, 1},
+                       /* {0x1c, 0x00, {0x17}, 1}, contrast control */
+                       {0x1d, 0x00, {0x80}, 1}, /* moving causes a mess */
+                       {0x1e, 0x00, {0x08}, 1}, /* moving jams the camera */
+                       {0x1f, 0x00, {0x0c}, 1},
+                       {0x20, 0x00, {0x00}, 1},
+                       {0, 0, {0}, 0}
+               };
+               err_code = sensor_write_regs(gspca_dev, vga_sensor2_init_data,
+                                        ARRAY_SIZE(vga_sensor2_init_data));
        }
        return err_code;
 }
@@ -834,6 +952,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                return err_code;
 
        setbrightness(gspca_dev);
+       setcontrast(gspca_dev);
        setexposure(gspca_dev);
        setgain(gspca_dev);
 
@@ -893,7 +1012,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
 static void setexposure(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int exposure;
+       int exposure = MR97310A_EXPOSURE_DEFAULT;
        u8 buf[2];
 
        if (gspca_dev->ctrl_dis & (1 << EXPOSURE_IDX))
@@ -905,6 +1024,11 @@ static void setexposure(struct gspca_dev *gspca_dev)
                exposure = (sd->exposure * 9267) / 10000 + 300;
                sensor_write1(gspca_dev, 3, exposure >> 4);
                sensor_write1(gspca_dev, 4, exposure & 0x0f);
+       } else if (sd->sensor_type == 2) {
+               exposure = sd->exposure;
+               exposure >>= 3;
+               sensor_write1(gspca_dev, 3, exposure >> 8);
+               sensor_write1(gspca_dev, 4, exposure & 0xff);
        } else {
                /* We have both a clock divider and an exposure register.
                   We first calculate the clock divider, as that determines
@@ -943,17 +1067,34 @@ static void setexposure(struct gspca_dev *gspca_dev)
 static void setgain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
+       u8 gainreg;
 
-       if (gspca_dev->ctrl_dis & (1 << GAIN_IDX))
+       if ((gspca_dev->ctrl_dis & (1 << GAIN_IDX)) &&
+           (gspca_dev->ctrl_dis & (1 << SAKAR_CS_GAIN_IDX)))
                return;
 
-       if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1) {
+       if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1)
                sensor_write1(gspca_dev, 0x0e, sd->gain);
-       } else {
+       else if (sd->cam_type == CAM_TYPE_VGA && sd->sensor_type == 2)
+               for (gainreg = 0x0a; gainreg < 0x11; gainreg += 2) {
+                       sensor_write1(gspca_dev, gainreg, sd->gain >> 8);
+                       sensor_write1(gspca_dev, gainreg + 1, sd->gain & 0xff);
+               }
+       else
                sensor_write1(gspca_dev, 0x10, sd->gain);
-       }
 }
 
+static void setcontrast(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (gspca_dev->ctrl_dis & (1 << CONTRAST_IDX))
+               return;
+
+       sensor_write1(gspca_dev, 0x1c, sd->contrast);
+}
+
+
 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -1008,6 +1149,25 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->contrast = val;
+       if (gspca_dev->streaming)
+               setcontrast(gspca_dev);
+       return 0;
+}
+
+
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->contrast;
+       return 0;
+}
+
 static int sd_setmin_clockdiv(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
index b4f965731244ed65ba2a8038a18b0b870290debc..bc4ced6c013b1733f8b8e1ed49981ab9b035e023 100644 (file)
@@ -38,6 +38,7 @@
  */
 #define MODULE_NAME "ov519"
 
+#include <linux/input.h>
 #include "gspca.h"
 
 MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
@@ -70,6 +71,9 @@ struct sd {
        char invert_led;
 #define BRIDGE_INVERT_LED      8
 
+       char snapshot_pressed;
+       char snapshot_needs_reset;
+
        /* Determined by sensor type */
        __u8 sif;
 
@@ -99,10 +103,12 @@ struct sd {
 #define SEN_OV66308AF 5
 #define SEN_OV7610 6
 #define SEN_OV7620 7
-#define SEN_OV7640 8
-#define SEN_OV7670 9
-#define SEN_OV76BE 10
-#define SEN_OV8610 11
+#define SEN_OV7620AE 8
+#define SEN_OV7640 9
+#define SEN_OV7648 10
+#define SEN_OV7670 11
+#define SEN_OV76BE 12
+#define SEN_OV8610 13
 
        u8 sensor_addr;
        int sensor_width;
@@ -139,6 +145,7 @@ static void setautobrightness(struct sd *sd);
 static void setfreq(struct sd *sd);
 
 static const struct ctrl sd_ctrls[] = {
+#define BRIGHTNESS_IDX 0
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -153,6 +160,7 @@ static const struct ctrl sd_ctrls[] = {
            .set = sd_setbrightness,
            .get = sd_getbrightness,
        },
+#define CONTRAST_IDX 1
        {
            {
                .id      = V4L2_CID_CONTRAST,
@@ -167,6 +175,7 @@ static const struct ctrl sd_ctrls[] = {
            .set = sd_setcontrast,
            .get = sd_getcontrast,
        },
+#define COLOR_IDX 2
        {
            {
                .id      = V4L2_CID_SATURATION,
@@ -2554,7 +2563,7 @@ static int ov7xx0_configure(struct sd *sd)
                /* I don't know what's different about the 76BE yet. */
                if (i2c_r(sd, 0x15) & 1) {
                        PDEBUG(D_PROBE, "Sensor is an OV7620AE");
-                       sd->sensor = SEN_OV7620;
+                       sd->sensor = SEN_OV7620AE;
                } else {
                        PDEBUG(D_PROBE, "Sensor is an OV76BE");
                        sd->sensor = SEN_OV76BE;
@@ -2588,7 +2597,7 @@ static int ov7xx0_configure(struct sd *sd)
                                break;
                        case 0x48:
                                PDEBUG(D_PROBE, "Sensor is an OV7648");
-                               sd->sensor = SEN_OV7640; /* FIXME */
+                               sd->sensor = SEN_OV7648;
                                break;
                        default:
                                PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low);
@@ -2680,6 +2689,36 @@ static void ov51x_led_control(struct sd *sd, int on)
        }
 }
 
+static void sd_reset_snapshot(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (!sd->snapshot_needs_reset)
+               return;
+
+       /* Note it is important that we clear sd->snapshot_needs_reset,
+          before actually clearing the snapshot state in the bridge
+          otherwise we might race with the pkt_scan interrupt handler */
+       sd->snapshot_needs_reset = 0;
+
+       switch (sd->bridge) {
+       case BRIDGE_OV511:
+       case BRIDGE_OV511PLUS:
+               reg_w(sd, R51x_SYS_SNAP, 0x02);
+               reg_w(sd, R51x_SYS_SNAP, 0x00);
+               break;
+       case BRIDGE_OV518:
+       case BRIDGE_OV518PLUS:
+               reg_w(sd, R51x_SYS_SNAP, 0x02); /* Reset */
+               reg_w(sd, R51x_SYS_SNAP, 0x01); /* Enable */
+               break;
+       case BRIDGE_OV519:
+               reg_w(sd, R51x_SYS_RESET, 0x40);
+               reg_w(sd, R51x_SYS_RESET, 0x00);
+               break;
+       }
+}
+
 static int ov51x_upload_quan_tables(struct sd *sd)
 {
        const unsigned char yQuanTable511[] = {
@@ -3115,7 +3154,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
                                      (1 << OV7670_FREQ_IDX);
        }
        sd->quality = QUALITY_DEF;
-       if (sd->sensor == SEN_OV7640 || sd->sensor == SEN_OV7670)
+       if (sd->sensor == SEN_OV7640 ||
+           sd->sensor == SEN_OV7648)
+               gspca_dev->ctrl_dis |= (1 << AUTOBRIGHT_IDX) |
+                                      (1 << CONTRAST_IDX);
+       if (sd->sensor == SEN_OV7670)
                gspca_dev->ctrl_dis |= 1 << AUTOBRIGHT_IDX;
        /* OV8610 Frequency filter control should work but needs testing */
        if (sd->sensor == SEN_OV8610)
@@ -3169,10 +3212,12 @@ static int sd_init(struct gspca_dev *gspca_dev)
                        return -EIO;
                break;
        case SEN_OV7620:
+       case SEN_OV7620AE:
                if (write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620)))
                        return -EIO;
                break;
        case SEN_OV7640:
+       case SEN_OV7648:
                if (write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640)))
                        return -EIO;
                break;
@@ -3246,7 +3291,9 @@ static int ov511_mode_init_regs(struct sd *sd)
        /* Note once the FIXME's in mode_init_ov_sensor_regs() are fixed
           for more sensors we need to do this for them too */
        case SEN_OV7620:
+       case SEN_OV7620AE:
        case SEN_OV7640:
+       case SEN_OV7648:
        case SEN_OV76BE:
                if (sd->gspca_dev.width == 320)
                        interlaced = 1;
@@ -3377,7 +3424,7 @@ static int ov518_mode_init_regs(struct sd *sd)
 
        if (sd->bridge == BRIDGE_OV518PLUS) {
                switch (sd->sensor) {
-               case SEN_OV7620:
+               case SEN_OV7620AE:
                        if (sd->gspca_dev.width == 320) {
                                reg_w(sd, 0x20, 0x00);
                                reg_w(sd, 0x21, 0x19);
@@ -3386,6 +3433,10 @@ static int ov518_mode_init_regs(struct sd *sd)
                                reg_w(sd, 0x21, 0x1f);
                        }
                        break;
+               case SEN_OV7620:
+                       reg_w(sd, 0x20, 0x00);
+                       reg_w(sd, 0x21, 0x19);
+                       break;
                default:
                        reg_w(sd, 0x21, 0x19);
                }
@@ -3488,7 +3539,8 @@ static int ov519_mode_init_regs(struct sd *sd)
                if (write_regvals(sd, mode_init_519,
                                  ARRAY_SIZE(mode_init_519)))
                        return -EIO;
-               if (sd->sensor == SEN_OV7640) {
+               if (sd->sensor == SEN_OV7640 ||
+                   sd->sensor == SEN_OV7648) {
                        /* Select 8-bit input mode */
                        reg_w_mask(sd, OV519_R20_DFR, 0x10, 0x10);
                }
@@ -3503,6 +3555,9 @@ static int ov519_mode_init_regs(struct sd *sd)
        if (sd->sensor == SEN_OV7670 &&
            sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv)
                reg_w(sd, OV519_R12_X_OFFSETL, 0x04);
+       else if (sd->sensor == SEN_OV7648 &&
+           sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv)
+               reg_w(sd, OV519_R12_X_OFFSETL, 0x01);
        else
                reg_w(sd, OV519_R12_X_OFFSETL, 0x00);
        reg_w(sd, OV519_R13_X_OFFSETH,  0x00);
@@ -3520,6 +3575,7 @@ static int ov519_mode_init_regs(struct sd *sd)
        sd->clockdiv = 0;
        switch (sd->sensor) {
        case SEN_OV7640:
+       case SEN_OV7648:
                switch (sd->frame_rate) {
                default:
 /*             case 30: */
@@ -3649,6 +3705,7 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
                i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */
                break;
        case SEN_OV7620:
+       case SEN_OV7620AE:
        case SEN_OV76BE:
                i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
                i2c_w_mask(sd, 0x28, qvga ? 0x00 : 0x20, 0x20);
@@ -3663,13 +3720,16 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
                        i2c_w(sd, 0x35, qvga ? 0x1e : 0x9e);
                break;
        case SEN_OV7640:
+       case SEN_OV7648:
                i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
                i2c_w_mask(sd, 0x28, qvga ? 0x00 : 0x20, 0x20);
-/*             i2c_w(sd, 0x24, qvga ? 0x20 : 0x3a); */
-/*             i2c_w(sd, 0x25, qvga ? 0x30 : 0x60); */
-/*             i2c_w_mask(sd, 0x2d, qvga ? 0x40 : 0x00, 0x40); */
-/*             i2c_w_mask(sd, 0x67, qvga ? 0xf0 : 0x90, 0xf0); */
-/*             i2c_w_mask(sd, 0x74, qvga ? 0x20 : 0x00, 0x20); */
+               /* Setting this undocumented bit in qvga mode removes a very
+                  annoying vertical shaking of the image */
+               i2c_w_mask(sd, 0x2d, qvga ? 0x40 : 0x00, 0x40);
+               /* Unknown */
+               i2c_w_mask(sd, 0x67, qvga ? 0xf0 : 0x90, 0xf0);
+               /* Allow higher automatic gain (to allow higher framerates) */
+               i2c_w_mask(sd, 0x74, qvga ? 0x20 : 0x00, 0x20);
                i2c_w_mask(sd, 0x12, 0x04, 0x04); /* AWB: 1 */
                break;
        case SEN_OV7670:
@@ -3795,11 +3855,13 @@ static int set_ov_sensor_window(struct sd *sd)
                }
                break;
        case SEN_OV7620:
+       case SEN_OV7620AE:
                hwsbase = 0x2f;         /* From 7620.SET (spec is wrong) */
                hwebase = 0x2f;
                vwsbase = vwebase = 0x05;
                break;
        case SEN_OV7640:
+       case SEN_OV7648:
                hwsbase = 0x1a;
                hwebase = 0x1a;
                vwsbase = vwebase = 0x03;
@@ -3893,6 +3955,12 @@ static int sd_start(struct gspca_dev *gspca_dev)
        setautobrightness(sd);
        setfreq(sd);
 
+       /* Force clear snapshot state in case the snapshot button was
+          pressed while we weren't streaming */
+       sd->snapshot_needs_reset = 1;
+       sd_reset_snapshot(gspca_dev);
+       sd->snapshot_pressed = 0;
+
        ret = ov51x_restart(sd);
        if (ret < 0)
                goto out;
@@ -3919,6 +3987,34 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
                w9968cf_stop0(sd);
 }
 
+static void ov51x_handle_button(struct gspca_dev *gspca_dev, u8 state)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->snapshot_pressed != state) {
+#ifdef CONFIG_INPUT
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
+               input_sync(gspca_dev->input_dev);
+#endif
+               if (state)
+                       sd->snapshot_needs_reset = 1;
+
+               sd->snapshot_pressed = state;
+       } else {
+               /* On the ov511 / ov519 we need to reset the button state
+                  multiple times, as resetting does not work as long as the
+                  button stays pressed */
+               switch (sd->bridge) {
+               case BRIDGE_OV511:
+               case BRIDGE_OV511PLUS:
+               case BRIDGE_OV519:
+                       if (state)
+                               sd->snapshot_needs_reset = 1;
+                       break;
+               }
+       }
+}
+
 static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *in,                 /* isoc packet */
                        int len)                /* iso packet length */
@@ -3940,6 +4036,7 @@ static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
         */
        if (!(in[0] | in[1] | in[2] | in[3] | in[4] | in[5] | in[6] | in[7]) &&
            (in[8] & 0x08)) {
+               ov51x_handle_button(gspca_dev, (in[8] >> 2) & 1);
                if (in[8] & 0x80) {
                        /* Frame end */
                        if ((in[9] + 1) * 8 != gspca_dev->width ||
@@ -3977,6 +4074,7 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev,
        /* A false positive here is likely, until OVT gives me
         * the definitive SOF/EOF format */
        if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) {
+               ov51x_handle_button(gspca_dev, (data[6] >> 1) & 1);
                gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
                gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
                sd->packet_nr = 0;
@@ -4024,6 +4122,9 @@ static void ov519_pkt_scan(struct gspca_dev *gspca_dev,
        if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) {
                switch (data[3]) {
                case 0x50:              /* start of frame */
+                       /* Don't check the button state here, as the state
+                          usually (always ?) changes at EOF and checking it
+                          here leads to unnecessary snapshot state resets. */
 #define HDRSZ 16
                        data += HDRSZ;
                        len -= HDRSZ;
@@ -4035,6 +4136,7 @@ static void ov519_pkt_scan(struct gspca_dev *gspca_dev,
                                gspca_dev->last_packet_type = DISCARD_PACKET;
                        return;
                case 0x51:              /* end of frame */
+                       ov51x_handle_button(gspca_dev, data[11] & 1);
                        if (data[9] != 0)
                                gspca_dev->last_packet_type = DISCARD_PACKET;
                        gspca_frame_add(gspca_dev, LAST_PACKET,
@@ -4103,9 +4205,11 @@ static void setbrightness(struct gspca_dev *gspca_dev)
        case SEN_OV6630:
        case SEN_OV66308AF:
        case SEN_OV7640:
+       case SEN_OV7648:
                i2c_w(sd, OV7610_REG_BRT, val);
                break;
        case SEN_OV7620:
+       case SEN_OV7620AE:
                /* 7620 doesn't like manual changes when in auto mode */
                if (!sd->autobrightness)
                        i2c_w(sd, OV7610_REG_BRT, val);
@@ -4142,7 +4246,8 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                i2c_w(sd, 0x64, ctab[val >> 5]);
                break;
            }
-       case SEN_OV7620: {
+       case SEN_OV7620:
+       case SEN_OV7620AE: {
                static const __u8 ctab[] = {
                        0x01, 0x05, 0x09, 0x11, 0x15, 0x35, 0x37, 0x57,
                        0x5b, 0xa5, 0xa7, 0xc7, 0xc9, 0xcf, 0xef, 0xff
@@ -4152,10 +4257,6 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                i2c_w(sd, 0x64, ctab[val >> 4]);
                break;
            }
-       case SEN_OV7640:
-               /* Use gain control instead. */
-               i2c_w(sd, OV7610_REG_GAIN, val >> 2);
-               break;
        case SEN_OV7670:
                /* check that this isn't just the same as ov7610 */
                i2c_w(sd, OV7670_REG_CONTRAS, val >> 1);
@@ -4179,6 +4280,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
                i2c_w(sd, OV7610_REG_SAT, val);
                break;
        case SEN_OV7620:
+       case SEN_OV7620AE:
                /* Use UV gamma control instead. Bits 0 & 7 are reserved. */
 /*             rc = ov_i2c_write(sd->dev, 0x62, (val >> 9) & 0x7e);
                if (rc < 0)
@@ -4186,6 +4288,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
                i2c_w(sd, OV7610_REG_SAT, val);
                break;
        case SEN_OV7640:
+       case SEN_OV7648:
                i2c_w(sd, OV7610_REG_SAT, val & 0xf0);
                break;
        case SEN_OV7670:
@@ -4198,7 +4301,8 @@ static void setcolors(struct gspca_dev *gspca_dev)
 
 static void setautobrightness(struct sd *sd)
 {
-       if (sd->sensor == SEN_OV7640 || sd->sensor == SEN_OV7670 ||
+       if (sd->sensor == SEN_OV7640 || sd->sensor == SEN_OV7648 ||
+           sd->sensor == SEN_OV7670 ||
            sd->sensor == SEN_OV2610 || sd->sensor == SEN_OV3610)
                return;
 
@@ -4475,9 +4579,13 @@ static const struct sd_desc sd_desc = {
        .stopN = sd_stopN,
        .stop0 = sd_stop0,
        .pkt_scan = sd_pkt_scan,
+       .dq_callback = sd_reset_snapshot,
        .querymenu = sd_querymenu,
        .get_jcomp = sd_get_jcomp,
        .set_jcomp = sd_set_jcomp,
+#ifdef CONFIG_INPUT
+       .other_input = 1,
+#endif
 };
 
 /* -- module initialisation -- */
@@ -4494,7 +4602,8 @@ static const __devinitdata struct usb_device_id device_table[] = {
         .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
        {USB_DEVICE(0x045e, 0x028c), .driver_info = BRIDGE_OV519 },
        {USB_DEVICE(0x054c, 0x0154), .driver_info = BRIDGE_OV519 },
-       {USB_DEVICE(0x054c, 0x0155), .driver_info = BRIDGE_OV519 },
+       {USB_DEVICE(0x054c, 0x0155),
+        .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
        {USB_DEVICE(0x05a9, 0x0511), .driver_info = BRIDGE_OV511 },
        {USB_DEVICE(0x05a9, 0x0518), .driver_info = BRIDGE_OV518 },
        {USB_DEVICE(0x05a9, 0x0519), .driver_info = BRIDGE_OV519 },
index 4dbb882c83dcb2c6cb3ebda9536d79a4d908b490..957e05e2d08fbbf3944beec9c2fd76cc18d88808 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ov534 gspca driver
+ * ov534-ov772x gspca driver
  *
  * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it>
  * Copyright (C) 2008 Jim Paris <jim@jtan.com>
@@ -68,12 +68,7 @@ struct sd {
        s8 sharpness;
        u8 hflip;
        u8 vflip;
-       u8 satur;
-       u8 lightfreq;
 
-       u8 sensor;
-#define SENSOR_OV772X 0
-#define SENSOR_OV965X 1
 };
 
 /* V4L2 controls supported by the driver */
@@ -101,12 +96,8 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
-static int sd_setsatur(struct gspca_dev *gspca_dev, __s32 val);
-static int sd_getsatur(struct gspca_dev *gspca_dev, __s32 *val);
-static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
-static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls_ov772x[] = {
+static const struct ctrl sd_ctrls[] = {
     {                                                  /* 0 */
        {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -115,8 +106,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-#define BRIGHTNESS_77_DEF 20
-               .default_value = BRIGHTNESS_77_DEF,
+#define BRIGHTNESS_DEF 20
+               .default_value = BRIGHTNESS_DEF,
        },
        .set = sd_setbrightness,
        .get = sd_getbrightness,
@@ -129,8 +120,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-#define CONTRAST_77_DEF 37
-               .default_value = CONTRAST_77_DEF,
+#define CONTRAST_DEF 37
+               .default_value = CONTRAST_DEF,
        },
        .set = sd_setcontrast,
        .get = sd_getcontrast,
@@ -157,8 +148,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
            .minimum = 0,
            .maximum = 255,
            .step    = 1,
-#define EXPO_77_DEF 120
-           .default_value = EXPO_77_DEF,
+#define EXPO_DEF 120
+           .default_value = EXPO_DEF,
        },
        .set = sd_setexposure,
        .get = sd_getexposure,
@@ -213,13 +204,13 @@ static struct ctrl sd_ctrls_ov772x[] = {
            .minimum = 0,
            .maximum = 1,
            .step    = 1,
-#define AUTOGAIN_77_DEF 0
-           .default_value = AUTOGAIN_77_DEF,
+#define AUTOGAIN_DEF 0
+           .default_value = AUTOGAIN_DEF,
        },
        .set = sd_setautogain,
        .get = sd_getautogain,
     },
-#define AWB_77_IDX 8
+#define AWB_IDX 8
     {                                                  /* 8 */
        {
                .id      = V4L2_CID_AUTO_WHITE_BALANCE,
@@ -242,8 +233,8 @@ static struct ctrl sd_ctrls_ov772x[] = {
            .minimum = 0,
            .maximum = 63,
            .step    = 1,
-#define SHARPNESS_77_DEF 0
-           .default_value = SHARPNESS_77_DEF,
+#define SHARPNESS_DEF 0
+           .default_value = SHARPNESS_DEF,
        },
        .set = sd_setsharpness,
        .get = sd_getsharpness,
@@ -277,107 +268,6 @@ static struct ctrl sd_ctrls_ov772x[] = {
        .get = sd_getvflip,
     },
 };
-static struct ctrl sd_ctrls_ov965x[] = {
-    {                                                  /* 0 */
-       {
-               .id      = V4L2_CID_BRIGHTNESS,
-               .type    = V4L2_CTRL_TYPE_INTEGER,
-               .name    = "Brightness",
-               .minimum = 0,
-               .maximum = 15,
-               .step    = 1,
-#define BRIGHTNESS_96_DEF 7
-               .default_value = BRIGHTNESS_96_DEF,
-       },
-       .set = sd_setbrightness,
-       .get = sd_getbrightness,
-    },
-    {                                                  /* 1 */
-       {
-               .id      = V4L2_CID_CONTRAST,
-               .type    = V4L2_CTRL_TYPE_INTEGER,
-               .name    = "Contrast",
-               .minimum = 0,
-               .maximum = 15,
-               .step    = 1,
-#define CONTRAST_96_DEF 3
-               .default_value = CONTRAST_96_DEF,
-       },
-       .set = sd_setcontrast,
-       .get = sd_getcontrast,
-    },
-    {                                                  /* 2 */
-       {
-           .id      = V4L2_CID_AUTOGAIN,
-           .type    = V4L2_CTRL_TYPE_BOOLEAN,
-           .name    = "Autogain",
-           .minimum = 0,
-           .maximum = 1,
-           .step    = 1,
-#define AUTOGAIN_96_DEF 1
-           .default_value = AUTOGAIN_96_DEF,
-       },
-       .set = sd_setautogain,
-       .get = sd_getautogain,
-    },
-#define EXPO_96_IDX 3
-    {                                                  /* 3 */
-       {
-           .id      = V4L2_CID_EXPOSURE,
-           .type    = V4L2_CTRL_TYPE_INTEGER,
-           .name    = "Exposure",
-           .minimum = 0,
-           .maximum = 3,
-           .step    = 1,
-#define EXPO_96_DEF 0
-           .default_value = EXPO_96_DEF,
-       },
-       .set = sd_setexposure,
-       .get = sd_getexposure,
-    },
-    {                                                  /* 4 */
-       {
-           .id      = V4L2_CID_SHARPNESS,
-           .type    = V4L2_CTRL_TYPE_INTEGER,
-           .name    = "Sharpness",
-           .minimum = -1,              /* -1 = auto */
-           .maximum = 4,
-           .step    = 1,
-#define SHARPNESS_96_DEF -1
-           .default_value = SHARPNESS_96_DEF,
-       },
-       .set = sd_setsharpness,
-       .get = sd_getsharpness,
-    },
-    {                                                  /* 5 */
-       {
-               .id      = V4L2_CID_SATURATION,
-               .type    = V4L2_CTRL_TYPE_INTEGER,
-               .name    = "Saturation",
-               .minimum = 0,
-               .maximum = 4,
-               .step    = 1,
-#define SATUR_DEF 2
-               .default_value = SATUR_DEF,
-       },
-       .set = sd_setsatur,
-       .get = sd_getsatur,
-    },
-    {
-       {
-               .id      = V4L2_CID_POWER_LINE_FREQUENCY,
-               .type    = V4L2_CTRL_TYPE_MENU,
-               .name    = "Light frequency filter",
-               .minimum = 0,
-               .maximum = 2,   /* 0: 0, 1: 50Hz, 2:60Hz */
-               .step    = 1,
-#define FREQ_DEF 0
-               .default_value = FREQ_DEF,
-       },
-       .set = sd_setfreq,
-       .get = sd_getfreq,
-    },
-};
 
 static const struct v4l2_pix_format ov772x_mode[] = {
        {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
@@ -392,35 +282,21 @@ static const struct v4l2_pix_format ov772x_mode[] = {
         .priv = 0},
 };
 
-static const struct v4l2_pix_format ov965x_mode[] = {
-       {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
-        .bytesperline = 320,
-        .sizeimage = 320 * 240 * 3 / 8 + 590,
-        .colorspace = V4L2_COLORSPACE_JPEG,
-        .priv = 4},
-       {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
-        .bytesperline = 640,
-        .sizeimage = 640 * 480 * 3 / 8 + 590,
-        .colorspace = V4L2_COLORSPACE_JPEG,
-        .priv = 3},
-       {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
-        .bytesperline = 800,
-        .sizeimage = 800 * 600 * 3 / 8 + 590,
-        .colorspace = V4L2_COLORSPACE_JPEG,
-        .priv = 2},
-       {1024, 768, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
-        .bytesperline = 1024,
-        .sizeimage = 1024 * 768 * 3 / 8 + 590,
-        .colorspace = V4L2_COLORSPACE_JPEG,
-        .priv = 1},
-       {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
-        .bytesperline = 1280,
-        .sizeimage = 1280 * 1024 * 3 / 8 + 590,
-        .colorspace = V4L2_COLORSPACE_JPEG,
-        .priv = 0},
+static const u8 qvga_rates[] = {125, 100, 75, 60, 50, 40, 30};
+static const u8 vga_rates[] = {60, 50, 40, 30, 15};
+
+static const struct framerates ov772x_framerates[] = {
+       { /* 320x240 */
+               .rates = qvga_rates,
+               .nrates = ARRAY_SIZE(qvga_rates),
+       },
+       { /* 640x480 */
+               .rates = vga_rates,
+               .nrates = ARRAY_SIZE(vga_rates),
+       },
 };
 
-static const u8 bridge_init_ov772x[][2] = {
+static const u8 bridge_init[][2] = {
        { 0xc2, 0x0c },
        { 0x88, 0xf8 },
        { 0xc3, 0x69 },
@@ -478,7 +354,7 @@ static const u8 bridge_init_ov772x[][2] = {
        { 0xc1, 0x3c },
        { 0xc2, 0x0c },
 };
-static const u8 sensor_init_ov772x[][2] = {
+static const u8 sensor_init[][2] = {
        { 0x12, 0x80 },
        { 0x11, 0x01 },
 /*fixme: better have a delay?*/
@@ -571,7 +447,7 @@ static const u8 sensor_init_ov772x[][2] = {
        { 0x8e, 0x00 },         /* De-noise threshold */
        { 0x0c, 0xd0 }
 };
-static const u8 bridge_start_ov772x_vga[][2] = {
+static const u8 bridge_start_vga[][2] = {
        {0x1c, 0x00},
        {0x1d, 0x40},
        {0x1d, 0x02},
@@ -582,7 +458,7 @@ static const u8 bridge_start_ov772x_vga[][2] = {
        {0xc0, 0x50},
        {0xc1, 0x3c},
 };
-static const u8 sensor_start_ov772x_vga[][2] = {
+static const u8 sensor_start_vga[][2] = {
        {0x12, 0x00},
        {0x17, 0x26},
        {0x18, 0xa0},
@@ -592,7 +468,7 @@ static const u8 sensor_start_ov772x_vga[][2] = {
        {0x2c, 0xf0},
        {0x65, 0x20},
 };
-static const u8 bridge_start_ov772x_qvga[][2] = {
+static const u8 bridge_start_qvga[][2] = {
        {0x1c, 0x00},
        {0x1d, 0x40},
        {0x1d, 0x02},
@@ -603,7 +479,7 @@ static const u8 bridge_start_ov772x_qvga[][2] = {
        {0xc0, 0x28},
        {0xc1, 0x1e},
 };
-static const u8 sensor_start_ov772x_qvga[][2] = {
+static const u8 sensor_start_qvga[][2] = {
        {0x12, 0x40},
        {0x17, 0x3f},
        {0x18, 0x50},
@@ -614,571 +490,6 @@ static const u8 sensor_start_ov772x_qvga[][2] = {
        {0x65, 0x2f},
 };
 
-static const u8 bridge_init_ov965x[][2] = {
-       {0x88, 0xf8},
-       {0x89, 0xff},
-       {0x76, 0x03},
-       {0x92, 0x03},
-       {0x95, 0x10},
-       {0xe2, 0x00},
-       {0xe7, 0x3e},
-       {0x8d, 0x1c},
-       {0x8e, 0x00},
-       {0x8f, 0x00},
-       {0x1f, 0x00},
-       {0xc3, 0xf9},
-       {0x89, 0xff},
-       {0x88, 0xf8},
-       {0x76, 0x03},
-       {0x92, 0x01},
-       {0x93, 0x18},
-       {0x1c, 0x0a},
-       {0x1d, 0x48},
-       {0xc0, 0x50},
-       {0xc1, 0x3c},
-       {0x34, 0x05},
-       {0xc2, 0x0c},
-       {0xc3, 0xf9},
-       {0x34, 0x05},
-       {0xe7, 0x2e},
-       {0x31, 0xf9},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0x25, 0x42},
-       {0x94, 0x11},
-};
-
-static const u8 sensor_init_ov965x[][2] = {
-       {0x12, 0x80},   /* com7 - SSCB reset */
-       {0x00, 0x00},   /* gain */
-       {0x01, 0x80},   /* blue */
-       {0x02, 0x80},   /* red */
-       {0x03, 0x1b},   /* vref */
-       {0x04, 0x03},   /* com1 - exposure low bits */
-       {0x0b, 0x57},   /* ver */
-       {0x0e, 0x61},   /* com5 */
-       {0x0f, 0x42},   /* com6 */
-       {0x11, 0x00},   /* clkrc */
-       {0x12, 0x02},   /* com7 - 15fps VGA YUYV */
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x14, 0x28},   /* com9 */
-       {0x16, 0x24},   /* reg16 */
-       {0x17, 0x1d},   /* hstart*/
-       {0x18, 0xbd},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x81},   /* vstop*/
-       {0x1e, 0x04},   /* mvfp */
-       {0x24, 0x3c},   /* aew */
-       {0x25, 0x36},   /* aeb */
-       {0x26, 0x71},   /* vpt */
-       {0x27, 0x08},   /* bbias */
-       {0x28, 0x08},   /* gbbias */
-       {0x29, 0x15},   /* gr com */
-       {0x2a, 0x00},   /* exhch */
-       {0x2b, 0x00},   /* exhcl */
-       {0x2c, 0x08},   /* rbias */
-       {0x32, 0xff},   /* href */
-       {0x33, 0x00},   /* chlf */
-       {0x34, 0x3f},   /* aref1 */
-       {0x35, 0x00},   /* aref2 */
-       {0x36, 0xf8},   /* aref3 */
-       {0x38, 0x72},   /* adc2 */
-       {0x39, 0x57},   /* aref4 */
-       {0x3a, 0x80},   /* tslb - yuyv */
-       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
-       {0x3d, 0x99},   /* com13 */
-       {0x3f, 0xc1},   /* edge */
-       {0x40, 0xc0},   /* com15 */
-       {0x41, 0x40},   /* com16 */
-       {0x42, 0xc0},   /* com17 */
-       {0x43, 0x0a},   /* rsvd */
-       {0x44, 0xf0},
-       {0x45, 0x46},
-       {0x46, 0x62},
-       {0x47, 0x2a},
-       {0x48, 0x3c},
-       {0x4a, 0xfc},
-       {0x4b, 0xfc},
-       {0x4c, 0x7f},
-       {0x4d, 0x7f},
-       {0x4e, 0x7f},
-       {0x4f, 0x98},   /* matrix */
-       {0x50, 0x98},
-       {0x51, 0x00},
-       {0x52, 0x28},
-       {0x53, 0x70},
-       {0x54, 0x98},
-       {0x58, 0x1a},   /* matrix coef sign */
-       {0x59, 0x85},   /* AWB control */
-       {0x5a, 0xa9},
-       {0x5b, 0x64},
-       {0x5c, 0x84},
-       {0x5d, 0x53},
-       {0x5e, 0x0e},
-       {0x5f, 0xf0},   /* AWB blue limit */
-       {0x60, 0xf0},   /* AWB red limit */
-       {0x61, 0xf0},   /* AWB green limit */
-       {0x62, 0x00},   /* lcc1 */
-       {0x63, 0x00},   /* lcc2 */
-       {0x64, 0x02},   /* lcc3 */
-       {0x65, 0x16},   /* lcc4 */
-       {0x66, 0x01},   /* lcc5 */
-       {0x69, 0x02},   /* hv */
-       {0x6b, 0x5a},   /* dbvl */
-       {0x6c, 0x04},
-       {0x6d, 0x55},
-       {0x6e, 0x00},
-       {0x6f, 0x9d},
-       {0x70, 0x21},   /* dnsth */
-       {0x71, 0x78},
-       {0x72, 0x00},   /* poidx */
-       {0x73, 0x01},   /* pckdv */
-       {0x74, 0x3a},   /* xindx */
-       {0x75, 0x35},   /* yindx */
-       {0x76, 0x01},
-       {0x77, 0x02},
-       {0x7a, 0x12},   /* gamma curve */
-       {0x7b, 0x08},
-       {0x7c, 0x16},
-       {0x7d, 0x30},
-       {0x7e, 0x5e},
-       {0x7f, 0x72},
-       {0x80, 0x82},
-       {0x81, 0x8e},
-       {0x82, 0x9a},
-       {0x83, 0xa4},
-       {0x84, 0xac},
-       {0x85, 0xb8},
-       {0x86, 0xc3},
-       {0x87, 0xd6},
-       {0x88, 0xe6},
-       {0x89, 0xf2},
-       {0x8a, 0x03},
-       {0x8c, 0x89},   /* com19 */
-       {0x14, 0x28},   /* com9 */
-       {0x90, 0x7d},
-       {0x91, 0x7b},
-       {0x9d, 0x03},   /* lcc6 */
-       {0x9e, 0x04},   /* lcc7 */
-       {0x9f, 0x7a},
-       {0xa0, 0x79},
-       {0xa1, 0x40},   /* aechm */
-       {0xa4, 0x50},   /* com21 */
-       {0xa5, 0x68},   /* com26 */
-       {0xa6, 0x4a},   /* AWB green */
-       {0xa8, 0xc1},   /* refa8 */
-       {0xa9, 0xef},   /* refa9 */
-       {0xaa, 0x92},
-       {0xab, 0x04},
-       {0xac, 0x80},   /* black level control */
-       {0xad, 0x80},
-       {0xae, 0x80},
-       {0xaf, 0x80},
-       {0xb2, 0xf2},
-       {0xb3, 0x20},
-       {0xb4, 0x20},   /* ctrlb4 */
-       {0xb5, 0x00},
-       {0xb6, 0xaf},
-       {0xbb, 0xae},
-       {0xbc, 0x7f},   /* ADC channel offsets */
-       {0xdb, 0x7f},
-       {0xbe, 0x7f},
-       {0xbf, 0x7f},
-       {0xc0, 0xe2},
-       {0xc1, 0xc0},
-       {0xc2, 0x01},
-       {0xc3, 0x4e},
-       {0xc6, 0x85},
-       {0xc7, 0x80},   /* com24 */
-       {0xc9, 0xe0},
-       {0xca, 0xe8},
-       {0xcb, 0xf0},
-       {0xcc, 0xd8},
-       {0xcd, 0xf1},
-       {0x4f, 0x98},   /* matrix */
-       {0x50, 0x98},
-       {0x51, 0x00},
-       {0x52, 0x28},
-       {0x53, 0x70},
-       {0x54, 0x98},
-       {0x58, 0x1a},
-       {0xff, 0x41},   /* read 41, write ff 00 */
-       {0x41, 0x40},   /* com16 */
-
-       {0xc5, 0x03},   /* 60 Hz banding filter */
-       {0x6a, 0x02},   /* 50 Hz banding filter */
-
-       {0x12, 0x62},   /* com7 - 30fps VGA YUV */
-       {0x36, 0xfa},   /* aref3 */
-       {0x69, 0x0a},   /* hv */
-       {0x8c, 0x89},   /* com22 */
-       {0x14, 0x28},   /* com9 */
-       {0x3e, 0x0c},
-       {0x41, 0x40},   /* com16 */
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x3a},
-       {0x75, 0x35},
-       {0x76, 0x01},
-       {0xc7, 0x80},
-       {0x03, 0x12},   /* vref */
-       {0x17, 0x16},   /* hstart */
-       {0x18, 0x02},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x3d},   /* vstop */
-       {0x32, 0xff},   /* href */
-       {0xc0, 0xaa},
-};
-
-static const u8 bridge_init_ov965x_2[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0x50},
-       {0xc1, 0x3c},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-
-       {0xc2, 0x0c},
-       {0xc3, 0xf9},
-       {0xda, 0x01},
-       {0x50, 0x00},
-       {0x51, 0xa0},
-       {0x52, 0x3c},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x57, 0x00},
-       {0x5c, 0x00},
-       {0x5a, 0xa0},
-       {0x5b, 0x78},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0x94, 0x11},
-};
-
-static const u8 sensor_init_ov965x_2[][2] = {
-       {0x3b, 0xc4},
-       {0x1e, 0x04},   /* mvfp */
-       {0x13, 0xe0},   /* com8 */
-       {0x00, 0x00},   /* gain */
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x11, 0x03},   /* clkrc */
-       {0x6b, 0x5a},   /* dblv */
-       {0x6a, 0x05},
-       {0xc5, 0x07},
-       {0xa2, 0x4b},
-       {0xa3, 0x3e},
-       {0x2d, 0x00},
-       {0xff, 0x42},   /* read 42, write ff 00 */
-       {0x42, 0xc0},   /* com17 */
-       {0x2d, 0x00},
-       {0xff, 0x42},   /* read 42, write ff 00 */
-       {0x42, 0xc1},   /* com17 */
-/* sharpness */
-       {0x3f, 0x01},
-       {0xff, 0x42},   /* read 42, write ff 00 */
-       {0x42, 0xc1},   /* com17 */
-/* saturation */
-       {0x4f, 0x98},   /* matrix */
-       {0x50, 0x98},
-       {0x51, 0x00},
-       {0x52, 0x28},
-       {0x53, 0x70},
-       {0x54, 0x98},
-       {0x58, 0x1a},
-       {0xff, 0x41},   /* read 41, write ff 00 */
-       {0x41, 0x40},   /* com16 */
-/* contrast */
-       {0x56, 0x40},
-/* brightness */
-       {0x55, 0x8f},
-/* expo */
-       {0x10, 0x25},   /* aech - exposure high bits */
-       {0xff, 0x13},   /* read 13, write ff 00 */
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-};
-
-static const u8 sensor_start_ov965x_1_vga[][2] = {     /* same for qvga */
-       {0x12, 0x62},   /* com7 - 30fps VGA YUV */
-       {0x36, 0xfa},   /* aref3 */
-       {0x69, 0x0a},   /* hv */
-       {0x8c, 0x89},   /* com22 */
-       {0x14, 0x28},   /* com9 */
-       {0x3e, 0x0c},   /* com14 */
-       {0x41, 0x40},   /* com16 */
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x3a},
-       {0x75, 0x35},
-       {0x76, 0x01},
-       {0xc7, 0x80},   /* com24 */
-       {0x03, 0x12},   /* vref */
-       {0x17, 0x16},   /* hstart */
-       {0x18, 0x02},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x3d},   /* vstop */
-       {0x32, 0xff},   /* href */
-       {0xc0, 0xaa},
-};
-
-static const u8 sensor_start_ov965x_1_svga[][2] = {
-       {0x12, 0x02},   /* com7 - YUYV - VGA 15 full resolution */
-       {0x36, 0xf8},   /* aref3 */
-       {0x69, 0x02},   /* hv */
-       {0x8c, 0x0d},   /* com22 */
-       {0x3e, 0x0c},   /* com14 */
-       {0x41, 0x40},   /* com16 */
-       {0x72, 0x00},
-       {0x73, 0x01},
-       {0x74, 0x3a},
-       {0x75, 0x35},
-       {0x76, 0x01},
-       {0xc7, 0x80},   /* com24 */
-       {0x03, 0x1b},   /* vref */
-       {0x17, 0x1d},   /* hstart */
-       {0x18, 0xbd},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x81},   /* vstop */
-       {0x32, 0xff},   /* href */
-       {0xc0, 0xe2},
-};
-
-static const u8 sensor_start_ov965x_1_xga[][2] = {
-       {0x12, 0x02},   /* com7 */
-       {0x36, 0xf8},   /* aref3 */
-       {0x69, 0x02},   /* hv */
-       {0x8c, 0x89},   /* com22 */
-       {0x14, 0x28},   /* com9 */
-       {0x3e, 0x0c},   /* com14 */
-       {0x41, 0x40},   /* com16 */
-       {0x72, 0x00},
-       {0x73, 0x01},
-       {0x74, 0x3a},
-       {0x75, 0x35},
-       {0x76, 0x01},
-       {0xc7, 0x80},   /* com24 */
-       {0x03, 0x1b},   /* vref */
-       {0x17, 0x1d},   /* hstart */
-       {0x18, 0xbd},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x81},   /* vstop */
-       {0x32, 0xff},   /* href */
-       {0xc0, 0xe2},
-};
-
-static const u8 sensor_start_ov965x_1_sxga[][2] = {
-       {0x12, 0x02},   /* com7 */
-       {0x36, 0xf8},   /* aref3 */
-       {0x69, 0x02},   /* hv */
-       {0x8c, 0x89},   /* com22 */
-       {0x14, 0x28},   /* com9 */
-       {0x3e, 0x0c},   /* com14 */
-       {0x41, 0x40},   /* com16 */
-       {0x72, 0x00},
-       {0x73, 0x01},
-       {0x74, 0x3a},
-       {0x75, 0x35},
-       {0x76, 0x01},
-       {0xc7, 0x80},   /* com24 */
-       {0x03, 0x1b},   /* vref */
-       {0x17, 0x1d},   /* hstart */
-       {0x18, 0x02},   /* hstop */
-       {0x19, 0x01},   /* vstrt */
-       {0x1a, 0x81},   /* vstop */
-       {0x32, 0xff},   /* href */
-       {0xc0, 0xe2},
-};
-
-static const u8 bridge_start_ov965x_qvga[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0x50},
-       {0xc1, 0x3c},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-
-       {0xc2, 0x4c},
-       {0xc3, 0xf9},
-       {0xda, 0x00},
-       {0x50, 0x00},
-       {0x51, 0xa0},
-       {0x52, 0x78},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x57, 0x00},
-       {0x5c, 0x00},
-       {0x5a, 0x50},
-       {0x5b, 0x3c},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0x94, 0x11},
-};
-
-static const u8 bridge_start_ov965x_vga[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0x50},
-       {0xc1, 0x3c},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-       {0xc2, 0x0c},
-       {0xc3, 0xf9},
-       {0xda, 0x01},
-       {0x50, 0x00},
-       {0x51, 0xa0},
-       {0x52, 0x3c},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x57, 0x00},
-       {0x5c, 0x00},
-       {0x5a, 0xa0},
-       {0x5b, 0x78},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0x94, 0x11},
-};
-
-static const u8 bridge_start_ov965x_svga[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0xa0},
-       {0xc1, 0x80},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-       {0xc2, 0x4c},
-       {0xc3, 0xf9},
-       {0x50, 0x00},
-       {0x51, 0x40},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x88},
-       {0x57, 0x00},
-       {0x5c, 0x00},
-       {0x5a, 0xc8},
-       {0x5b, 0x96},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0xda, 0x00},
-       {0x94, 0x11},
-};
-
-static const u8 bridge_start_ov965x_xga[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0xa0},
-       {0xc1, 0x80},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-       {0xc2, 0x4c},
-       {0xc3, 0xf9},
-       {0x50, 0x00},
-       {0x51, 0x40},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x88},
-       {0x57, 0x00},
-       {0x5c, 0x01},
-       {0x5a, 0x00},
-       {0x5b, 0xc0},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0xda, 0x01},
-       {0x94, 0x11},
-};
-
-static const u8 bridge_start_ov965x_sxga[][2] = {
-       {0x94, 0xaa},
-       {0xf1, 0x60},
-       {0xe5, 0x04},
-       {0xc0, 0xa0},
-       {0xc1, 0x80},
-       {0x8c, 0x00},
-       {0x8d, 0x1c},
-       {0x34, 0x05},
-       {0xc2, 0x0c},
-       {0xc3, 0xf9},
-       {0xda, 0x00},
-       {0x35, 0x02},
-       {0xd9, 0x10},
-       {0x94, 0x11},
-};
-
-static const u8 sensor_start_ov965x_2_qvga[][2] = {
-       {0x3b, 0xe4},   /* com11 - night mode 1/4 frame rate */
-       {0x1e, 0x04},   /* mvfp */
-       {0x13, 0xe0},   /* com8 */
-       {0x00, 0x00},
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x11, 0x01},   /* clkrc */
-       {0x6b, 0x5a},   /* dblv */
-       {0x6a, 0x02},   /* 50 Hz banding filter */
-       {0xc5, 0x03},   /* 60 Hz banding filter */
-       {0xa2, 0x96},   /* bd50 */
-       {0xa3, 0x7d},   /* bd60 */
-
-       {0xff, 0x13},   /* read 13, write ff 00 */
-       {0x13, 0xe7},
-       {0x3a, 0x80},   /* tslb - yuyv */
-};
-
-static const u8 sensor_start_ov965x_2_vga[][2] = {
-       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
-       {0x1e, 0x04},   /* mvfp */
-       {0x13, 0xe0},   /* com8 */
-       {0x00, 0x00},
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x11, 0x03},   /* clkrc */
-       {0x6b, 0x5a},   /* dblv */
-       {0x6a, 0x05},   /* 50 Hz banding filter */
-       {0xc5, 0x07},   /* 60 Hz banding filter */
-       {0xa2, 0x4b},   /* bd50 */
-       {0xa3, 0x3e},   /* bd60 */
-
-       {0x2d, 0x00},   /* advfl */
-};
-
-static const u8 sensor_start_ov965x_2_svga[][2] = {    /* same for xga */
-       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
-       {0x1e, 0x04},   /* mvfp */
-       {0x13, 0xe0},   /* com8 */
-       {0x00, 0x00},
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x11, 0x01},   /* clkrc */
-       {0x6b, 0x5a},   /* dblv */
-       {0x6a, 0x0c},   /* 50 Hz banding filter */
-       {0xc5, 0x0f},   /* 60 Hz banding filter */
-       {0xa2, 0x4e},   /* bd50 */
-       {0xa3, 0x41},   /* bd60 */
-};
-
-static const u8 sensor_start_ov965x_2_sxga[][2] = {
-       {0x13, 0xe0},   /* com8 */
-       {0x00, 0x00},
-       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
-       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
-       {0x1e, 0x04},   /* mvfp */
-       {0x11, 0x01},   /* clkrc */
-       {0x6b, 0x5a},   /* dblv */
-       {0x6a, 0x0c},   /* 50 Hz banding filter */
-       {0xc5, 0x0f},   /* 60 Hz banding filter */
-       {0xa2, 0x4e},   /* bd50 */
-       {0xa3, 0x41},   /* bd60 */
-};
-
 static void ov534_reg_write(struct gspca_dev *gspca_dev, u16 reg, u8 val)
 {
        struct usb_device *udev = gspca_dev->dev;
@@ -1360,14 +671,14 @@ static void set_frame_rate(struct gspca_dev *gspca_dev)
        PDEBUG(D_PROBE, "frame_rate: %d", r->fps);
 }
 
-static void setbrightness_77(struct gspca_dev *gspca_dev)
+static void setbrightness(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
        sccb_reg_write(gspca_dev, 0x9B, sd->brightness);
 }
 
-static void setcontrast_77(struct gspca_dev *gspca_dev)
+static void setcontrast(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
@@ -1401,7 +712,7 @@ static void setgain(struct gspca_dev *gspca_dev)
        sccb_reg_write(gspca_dev, 0x00, val);
 }
 
-static void setexposure_77(struct gspca_dev *gspca_dev)
+static void setexposure(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        u8 val;
@@ -1432,7 +743,7 @@ static void sethue(struct gspca_dev *gspca_dev)
        sccb_reg_write(gspca_dev, 0x01, sd->hue);
 }
 
-static void setautogain_77(struct gspca_dev *gspca_dev)
+static void setautogain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
@@ -1457,7 +768,7 @@ static void setawb(struct gspca_dev *gspca_dev)
                sccb_reg_write(gspca_dev, 0x63, 0xaa);  /* AWB off */
 }
 
-static void setsharpness_77(struct gspca_dev *gspca_dev)
+static void setsharpness(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        u8 val;
@@ -1491,132 +802,6 @@ static void setvflip(struct gspca_dev *gspca_dev)
                                sccb_reg_read(gspca_dev, 0x0c) & 0x7f);
 }
 
-/* ov965x specific controls */
-static void setbrightness_96(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val;
-
-       val = sd->brightness;
-       if (val < 8)
-               val = 15 - val;         /* f .. 8 */
-       else
-               val = val - 8;          /* 0 .. 7 */
-       sccb_reg_write(gspca_dev, 0x55, /* brtn - brightness adjustment */
-                       0x0f | (val << 4));
-}
-
-static void setcontrast_96(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       sccb_reg_write(gspca_dev, 0x56, /* cnst1 - contrast 1 ctrl coeff */
-                       sd->contrast << 4);
-}
-
-static void setexposure_96(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val;
-       static const u8 expo[4] = {0x00, 0x25, 0x38, 0x5e};
-
-       sccb_reg_write(gspca_dev, 0x10,                 /* aec[9:2] */
-                       expo[sd->exposure]);
-       val = sccb_reg_read(gspca_dev, 0x13);           /* com8 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       sccb_reg_write(gspca_dev, 0x13, val);
-       val = sccb_reg_read(gspca_dev, 0xa1);           /* aech */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       sccb_reg_write(gspca_dev, 0xa1, val & 0xe0);    /* aec[15:10] = 0 */
-}
-
-static void setsharpness_96(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val;
-
-       val = sd->sharpness;
-       if (val < 0) {                          /* auto */
-               val = sccb_reg_read(gspca_dev, 0x42);   /* com17 */
-               sccb_reg_write(gspca_dev, 0xff, 0x00);
-               sccb_reg_write(gspca_dev, 0x42, val | 0x40);
-                               /* Edge enhancement strength auto adjust */
-               return;
-       }
-       if (val != 0)
-               val = 1 << (val - 1);
-       sccb_reg_write(gspca_dev, 0x3f, /* edge - edge enhance. factor */
-                       val);
-       val = sccb_reg_read(gspca_dev, 0x42);           /* com17 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       sccb_reg_write(gspca_dev, 0x42, val & 0xbf);
-}
-
-static void setautogain_96(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val;
-
-/*fixme: should adjust agc/awb/aec by different controls */
-       val = sd->autogain;
-       val = sccb_reg_read(gspca_dev, 0x13);           /* com8 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       if (sd->autogain)
-               val |= 0x05;            /* agc & aec */
-       else
-               val &= 0xfa;
-       sccb_reg_write(gspca_dev, 0x13, val);
-}
-
-static void setsatur(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val1, val2, val3;
-       static const u8 matrix[5][2] = {
-               {0x14, 0x38},
-               {0x1e, 0x54},
-               {0x28, 0x70},
-               {0x32, 0x8c},
-               {0x48, 0x90}
-       };
-
-       val1 = matrix[sd->satur][0];
-       val2 = matrix[sd->satur][1];
-       val3 = val1 + val2;
-       sccb_reg_write(gspca_dev, 0x4f, val3);  /* matrix coeff */
-       sccb_reg_write(gspca_dev, 0x50, val3);
-       sccb_reg_write(gspca_dev, 0x51, 0x00);
-       sccb_reg_write(gspca_dev, 0x52, val1);
-       sccb_reg_write(gspca_dev, 0x53, val2);
-       sccb_reg_write(gspca_dev, 0x54, val3);
-       sccb_reg_write(gspca_dev, 0x58, 0x1a);  /* mtxs - coeff signs */
-       val1 = sccb_reg_read(gspca_dev, 0x41);  /* com16 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       sccb_reg_write(gspca_dev, 0x41, val1);
-}
-
-static void setfreq(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       u8 val;
-
-       val = sccb_reg_read(gspca_dev, 0x13);           /* com8 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       if (sd->lightfreq == 0) {
-               sccb_reg_write(gspca_dev, 0x13, val & 0xdf);
-               return;
-       }
-       sccb_reg_write(gspca_dev, 0x13, val | 0x20);
-
-       val = sccb_reg_read(gspca_dev, 0x42);           /* com17 */
-       sccb_reg_write(gspca_dev, 0xff, 0x00);
-       if (sd->lightfreq == 1)
-               val |= 0x01;
-       else
-               val &= 0xfe;
-       sccb_reg_write(gspca_dev, 0x42, val);
-}
-
 /* this function is called at probe time */
 static int sd_config(struct gspca_dev *gspca_dev,
                     const struct usb_device_id *id)
@@ -1624,77 +809,50 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
 
-       sd->sensor = id->driver_info;
-
        cam = &gspca_dev->cam;
 
-       if (sd->sensor == SENSOR_OV772X) {
-               cam->cam_mode = ov772x_mode;
-               cam->nmodes = ARRAY_SIZE(ov772x_mode);
+       cam->cam_mode = ov772x_mode;
+       cam->nmodes = ARRAY_SIZE(ov772x_mode);
+       cam->mode_framerates = ov772x_framerates;
 
-               cam->bulk = 1;
-               cam->bulk_size = 16384;
-               cam->bulk_nurbs = 2;
-       } else {                /* ov965x */
-               cam->cam_mode = ov965x_mode;
-               cam->nmodes = ARRAY_SIZE(ov965x_mode);
-       }
+       cam->bulk = 1;
+       cam->bulk_size = 16384;
+       cam->bulk_nurbs = 2;
 
        sd->frame_rate = 30;
 
-       if (sd->sensor == SENSOR_OV772X) {
-               sd->brightness = BRIGHTNESS_77_DEF;
-               sd->contrast = CONTRAST_77_DEF;
-               sd->gain = GAIN_DEF;
-               sd->exposure = EXPO_77_DEF;
-               sd->redblc = RED_BALANCE_DEF;
-               sd->blueblc = BLUE_BALANCE_DEF;
-               sd->hue = HUE_DEF;
-#if AUTOGAIN_77_DEF != 0
-               sd->autogain = AUTOGAIN_77_DEF;
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+       sd->gain = GAIN_DEF;
+       sd->exposure = EXPO_DEF;
+       sd->redblc = RED_BALANCE_DEF;
+       sd->blueblc = BLUE_BALANCE_DEF;
+       sd->hue = HUE_DEF;
+#if AUTOGAIN_DEF != 0
+       sd->autogain = AUTOGAIN_DEF;
 #else
-               gspca_dev->ctrl_inac |= (1 << AWB_77_IDX);
+       gspca_dev->ctrl_inac |= (1 << AWB_IDX);
 #endif
 #if AWB_DEF != 0
-               sd->awb = AWB_DEF
+       sd->awb = AWB_DEF
 #endif
-#if SHARPNESS_77_DEF != 0
-               sd->sharpness = SHARPNESS_77_DEF;
+#if SHARPNESS_DEF != 0
+       sd->sharpness = SHARPNESS_DEF;
 #endif
 #if HFLIP_DEF != 0
-               sd->hflip = HFLIP_DEF;
+       sd->hflip = HFLIP_DEF;
 #endif
 #if VFLIP_DEF != 0
-               sd->vflip = VFLIP_DEF;
-#endif
-       } else {
-               sd->brightness = BRIGHTNESS_96_DEF;
-               sd->contrast = CONTRAST_96_DEF;
-#if AUTOGAIN_96_DEF != 0
-               sd->autogain = AUTOGAIN_96_DEF;
-               gspca_dev->ctrl_inac |= (1 << EXPO_96_IDX);
+       sd->vflip = VFLIP_DEF;
 #endif
-#if EXPO_96_DEF != 0
-               sd->exposure = EXPO_96_DEF;
-#endif
-#if SHARPNESS_96_DEF != 0
-               sd->sharpness = SHARPNESS_96_DEF;
-#endif
-               sd->satur = SATUR_DEF;
-               sd->lightfreq = FREQ_DEF;
-       }
+
        return 0;
 }
 
 /* this function is called at probe and resume time */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
-       struct sd *sd = (struct sd *) gspca_dev;
        u16 sensor_id;
-       static const u8 sensor_addr[2] = {
-               0x42,                   /* 0 SENSOR_OV772X */
-               0x60,                   /* 1 SENSOR_OV965X */
-       };
 
        /* reset bridge */
        ov534_reg_write(gspca_dev, 0xe7, 0x3a);
@@ -1702,8 +860,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
        msleep(100);
 
        /* initialize the sensor address */
-       ov534_reg_write(gspca_dev, OV534_REG_ADDRESS,
-                               sensor_addr[sd->sensor]);
+       ov534_reg_write(gspca_dev, OV534_REG_ADDRESS, 0x42);
 
        /* reset sensor */
        sccb_reg_write(gspca_dev, 0x12, 0x80);
@@ -1717,64 +874,46 @@ static int sd_init(struct gspca_dev *gspca_dev)
        PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id);
 
        /* initialize */
-       switch (sd->sensor) {
-       case SENSOR_OV772X:
-               reg_w_array(gspca_dev, bridge_init_ov772x,
-                               ARRAY_SIZE(bridge_init_ov772x));
-               ov534_set_led(gspca_dev, 1);
-               sccb_w_array(gspca_dev, sensor_init_ov772x,
-                               ARRAY_SIZE(sensor_init_ov772x));
-               ov534_reg_write(gspca_dev, 0xe0, 0x09);
-               ov534_set_led(gspca_dev, 0);
-               set_frame_rate(gspca_dev);
-               break;
-       default:
-/*     case SENSOR_OV965X: */
-               reg_w_array(gspca_dev, bridge_init_ov965x,
-                               ARRAY_SIZE(bridge_init_ov965x));
-               sccb_w_array(gspca_dev, sensor_init_ov965x,
-                               ARRAY_SIZE(sensor_init_ov965x));
-               reg_w_array(gspca_dev, bridge_init_ov965x_2,
-                               ARRAY_SIZE(bridge_init_ov965x_2));
-               sccb_w_array(gspca_dev, sensor_init_ov965x_2,
-                               ARRAY_SIZE(sensor_init_ov965x_2));
-               ov534_reg_write(gspca_dev, 0xe0, 0x00);
-               ov534_reg_write(gspca_dev, 0xe0, 0x01);
-               ov534_set_led(gspca_dev, 0);
-               ov534_reg_write(gspca_dev, 0xe0, 0x00);
-       }
+       reg_w_array(gspca_dev, bridge_init,
+                       ARRAY_SIZE(bridge_init));
+       ov534_set_led(gspca_dev, 1);
+       sccb_w_array(gspca_dev, sensor_init,
+                       ARRAY_SIZE(sensor_init));
+       ov534_reg_write(gspca_dev, 0xe0, 0x09);
+       ov534_set_led(gspca_dev, 0);
+       set_frame_rate(gspca_dev);
 
        return 0;
 }
 
-static int sd_start_ov772x(struct gspca_dev *gspca_dev)
+static int sd_start(struct gspca_dev *gspca_dev)
 {
        int mode;
 
        mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
        if (mode != 0) {        /* 320x240 */
-               reg_w_array(gspca_dev, bridge_start_ov772x_qvga,
-                               ARRAY_SIZE(bridge_start_ov772x_qvga));
-               sccb_w_array(gspca_dev, sensor_start_ov772x_qvga,
-                               ARRAY_SIZE(sensor_start_ov772x_qvga));
+               reg_w_array(gspca_dev, bridge_start_qvga,
+                               ARRAY_SIZE(bridge_start_qvga));
+               sccb_w_array(gspca_dev, sensor_start_qvga,
+                               ARRAY_SIZE(sensor_start_qvga));
        } else {                /* 640x480 */
-               reg_w_array(gspca_dev, bridge_start_ov772x_vga,
-                               ARRAY_SIZE(bridge_start_ov772x_vga));
-               sccb_w_array(gspca_dev, sensor_start_ov772x_vga,
-                               ARRAY_SIZE(sensor_start_ov772x_vga));
+               reg_w_array(gspca_dev, bridge_start_vga,
+                               ARRAY_SIZE(bridge_start_vga));
+               sccb_w_array(gspca_dev, sensor_start_vga,
+                               ARRAY_SIZE(sensor_start_vga));
        }
        set_frame_rate(gspca_dev);
 
-       setautogain_77(gspca_dev);
+       setautogain(gspca_dev);
        setawb(gspca_dev);
        setgain(gspca_dev);
        setredblc(gspca_dev);
        setblueblc(gspca_dev);
        sethue(gspca_dev);
-       setexposure_77(gspca_dev);
-       setbrightness_77(gspca_dev);
-       setcontrast_77(gspca_dev);
-       setsharpness_77(gspca_dev);
+       setexposure(gspca_dev);
+       setbrightness(gspca_dev);
+       setcontrast(gspca_dev);
+       setsharpness(gspca_dev);
        setvflip(gspca_dev);
        sethflip(gspca_dev);
 
@@ -1783,81 +922,12 @@ static int sd_start_ov772x(struct gspca_dev *gspca_dev)
        return 0;
 }
 
-static int sd_start_ov965x(struct gspca_dev *gspca_dev)
-{
-       int mode;
-
-       mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
-       switch (mode) {
-       default:
-/*     case 4:                  * 320x240 */
-               sccb_w_array(gspca_dev, sensor_start_ov965x_1_vga,
-                               ARRAY_SIZE(sensor_start_ov965x_1_vga));
-               reg_w_array(gspca_dev, bridge_start_ov965x_qvga,
-                               ARRAY_SIZE(bridge_start_ov965x_qvga));
-               sccb_w_array(gspca_dev, sensor_start_ov965x_2_qvga,
-                               ARRAY_SIZE(sensor_start_ov965x_2_qvga));
-               break;
-       case 3:                 /* 640x480 */
-               sccb_w_array(gspca_dev, sensor_start_ov965x_1_vga,
-                               ARRAY_SIZE(sensor_start_ov965x_1_vga));
-               reg_w_array(gspca_dev, bridge_start_ov965x_vga,
-                               ARRAY_SIZE(bridge_start_ov965x_vga));
-               sccb_w_array(gspca_dev, sensor_start_ov965x_2_vga,
-                               ARRAY_SIZE(sensor_start_ov965x_2_vga));
-               break;
-       case 2:                 /* 800x600 */
-               sccb_w_array(gspca_dev, sensor_start_ov965x_1_svga,
-                               ARRAY_SIZE(sensor_start_ov965x_1_svga));
-               reg_w_array(gspca_dev, bridge_start_ov965x_svga,
-                               ARRAY_SIZE(bridge_start_ov965x_svga));
-               sccb_w_array(gspca_dev, sensor_start_ov965x_2_svga,
-                               ARRAY_SIZE(sensor_start_ov965x_2_svga));
-               break;
-       case 1:                 /* 1024x768 */
-               sccb_w_array(gspca_dev, sensor_start_ov965x_1_xga,
-                               ARRAY_SIZE(sensor_start_ov965x_1_xga));
-               reg_w_array(gspca_dev, bridge_start_ov965x_xga,
-                               ARRAY_SIZE(bridge_start_ov965x_xga));
-               sccb_w_array(gspca_dev, sensor_start_ov965x_2_svga,
-                               ARRAY_SIZE(sensor_start_ov965x_2_svga));
-               break;
-       case 0:                 /* 1280x1024 */
-               sccb_w_array(gspca_dev, sensor_start_ov965x_1_sxga,
-                               ARRAY_SIZE(sensor_start_ov965x_1_sxga));
-               reg_w_array(gspca_dev, bridge_start_ov965x_sxga,
-                               ARRAY_SIZE(bridge_start_ov965x_sxga));
-               sccb_w_array(gspca_dev, sensor_start_ov965x_2_sxga,
-                               ARRAY_SIZE(sensor_start_ov965x_2_sxga));
-               break;
-       }
-       setfreq(gspca_dev);
-       setautogain_96(gspca_dev);
-       setbrightness_96(gspca_dev);
-       setcontrast_96(gspca_dev);
-       setexposure_96(gspca_dev);
-       setsharpness_96(gspca_dev);
-       setsatur(gspca_dev);
-
-       ov534_reg_write(gspca_dev, 0xe0, 0x00);
-       ov534_reg_write(gspca_dev, 0xe0, 0x00);
-       ov534_set_led(gspca_dev, 1);
-       return 0;
-}
-
-static void sd_stopN_ov772x(struct gspca_dev *gspca_dev)
+static void sd_stopN(struct gspca_dev *gspca_dev)
 {
        ov534_reg_write(gspca_dev, 0xe0, 0x09);
        ov534_set_led(gspca_dev, 0);
 }
 
-static void sd_stopN_ov965x(struct gspca_dev *gspca_dev)
-{
-       ov534_reg_write(gspca_dev, 0xe0, 0x01);
-       ov534_set_led(gspca_dev, 0);
-       ov534_reg_write(gspca_dev, 0xe0, 0x00);
-}
-
 /* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */
 #define UVC_STREAM_EOH (1 << 7)
 #define UVC_STREAM_ERR (1 << 6)
@@ -1875,11 +945,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        __u32 this_pts;
        u16 this_fid;
        int remaining_len = len;
-       int payload_len;
 
-       payload_len = gspca_dev->cam.bulk ? 2048 : 2040;
        do {
-               len = min(remaining_len, payload_len);
+               len = min(remaining_len, 2048);
 
                /* Payloads are prefixed with a UVC-style header.  We
                   consider a frame to start when the FID toggles, or the PTS
@@ -1918,7 +986,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                                        data + 12, len - 12);
                /* If this packet is marked as EOF, end the frame */
                } else if (data[1] & UVC_STREAM_EOF) {
+                       struct gspca_frame *frame;
+
                        sd->last_pts = 0;
+                       frame = gspca_get_i_frame(gspca_dev);
+                       if (frame == NULL)
+                               goto discard;
+                       if (frame->data_end - frame->data + (len - 12) !=
+                           gspca_dev->width * gspca_dev->height * 2) {
+                               PDEBUG(D_PACK, "wrong sized frame");
+                               goto discard;
+                       }
                        gspca_frame_add(gspca_dev, LAST_PACKET,
                                        data + 12, len - 12);
                } else {
@@ -1965,12 +1043,8 @@ static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->exposure = val;
-       if (gspca_dev->streaming) {
-               if (sd->sensor == SENSOR_OV772X)
-                       setexposure_77(gspca_dev);
-               else
-                       setexposure_96(gspca_dev);
-       }
+       if (gspca_dev->streaming)
+               setexposure(gspca_dev);
        return 0;
 }
 
@@ -1987,12 +1061,8 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->brightness = val;
-       if (gspca_dev->streaming) {
-               if (sd->sensor == SENSOR_OV772X)
-                       setbrightness_77(gspca_dev);
-               else
-                       setbrightness_96(gspca_dev);
-       }
+       if (gspca_dev->streaming)
+               setbrightness(gspca_dev);
        return 0;
 }
 
@@ -2009,12 +1079,8 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->contrast = val;
-       if (gspca_dev->streaming) {
-               if (sd->sensor == SENSOR_OV772X)
-                       setcontrast_77(gspca_dev);
-               else
-                       setcontrast_96(gspca_dev);
-       }
+       if (gspca_dev->streaming)
+               setcontrast(gspca_dev);
        return 0;
 }
 
@@ -2026,41 +1092,6 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
-static int sd_setsatur(struct gspca_dev *gspca_dev, __s32 val)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       sd->satur = val;
-       if (gspca_dev->streaming)
-               setsatur(gspca_dev);
-       return 0;
-}
-
-static int sd_getsatur(struct gspca_dev *gspca_dev, __s32 *val)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       *val = sd->satur;
-       return 0;
-}
-static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       sd->lightfreq = val;
-       if (gspca_dev->streaming)
-               setfreq(gspca_dev);
-       return 0;
-}
-
-static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       *val = sd->lightfreq;
-       return 0;
-}
-
 static int sd_setredblc(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -2122,22 +1153,14 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        sd->autogain = val;
 
        if (gspca_dev->streaming) {
-               if (sd->sensor == SENSOR_OV772X) {
-
-                       /* the auto white balance control works only
-                        * when auto gain is set */
-                       if (val)
-                               gspca_dev->ctrl_inac &= ~(1 << AWB_77_IDX);
-                       else
-                               gspca_dev->ctrl_inac |= (1 << AWB_77_IDX);
-                       setautogain_77(gspca_dev);
-               } else {
-                       if (val)
-                               gspca_dev->ctrl_inac |= (1 << EXPO_96_IDX);
-                       else
-                               gspca_dev->ctrl_inac &= ~(1 << EXPO_96_IDX);
-                       setautogain_96(gspca_dev);
-               }
+
+               /* the auto white balance control works only
+                * when auto gain is set */
+               if (val)
+                       gspca_dev->ctrl_inac &= ~(1 << AWB_IDX);
+               else
+                       gspca_dev->ctrl_inac |= (1 << AWB_IDX);
+               setautogain(gspca_dev);
        }
        return 0;
 }
@@ -2173,12 +1196,8 @@ static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->sharpness = val;
-       if (gspca_dev->streaming) {
-               if (sd->sensor == SENSOR_OV772X)
-                       setsharpness_77(gspca_dev);
-               else
-                       setsharpness_96(gspca_dev);
-       }
+       if (gspca_dev->streaming)
+               setsharpness(gspca_dev);
        return 0;
 }
 
@@ -2257,7 +1276,7 @@ static int sd_set_streamparm(struct gspca_dev *gspca_dev,
 
        /* Set requested framerate */
        sd->frame_rate = tpf->denominator / tpf->numerator;
-       if (gspca_dev->streaming && sd->sensor == SENSOR_OV772X)
+       if (gspca_dev->streaming)
                set_frame_rate(gspca_dev);
 
        /* Return the actual framerate */
@@ -2267,57 +1286,23 @@ static int sd_set_streamparm(struct gspca_dev *gspca_dev,
        return 0;
 }
 
-static int sd_querymenu(struct gspca_dev *gspca_dev,
-                       struct v4l2_querymenu *menu)
-{
-       switch (menu->id) {
-       case V4L2_CID_POWER_LINE_FREQUENCY:
-               switch (menu->index) {
-               case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
-                       strcpy((char *) menu->name, "NoFliker");
-                       return 0;
-               case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
-                       strcpy((char *) menu->name, "50 Hz");
-                       return 0;
-               case 2:         /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
-                       strcpy((char *) menu->name, "60 Hz");
-                       return 0;
-               }
-               break;
-       }
-       return -EINVAL;
-}
-
 /* sub-driver description */
-static const struct sd_desc sd_desc_ov772x = {
+static const struct sd_desc sd_desc = {
        .name     = MODULE_NAME,
-       .ctrls    = sd_ctrls_ov772x,
-       .nctrls   = ARRAY_SIZE(sd_ctrls_ov772x),
+       .ctrls    = sd_ctrls,
+       .nctrls   = ARRAY_SIZE(sd_ctrls),
        .config   = sd_config,
        .init     = sd_init,
-       .start    = sd_start_ov772x,
-       .stopN    = sd_stopN_ov772x,
+       .start    = sd_start,
+       .stopN    = sd_stopN,
        .pkt_scan = sd_pkt_scan,
        .get_streamparm = sd_get_streamparm,
        .set_streamparm = sd_set_streamparm,
 };
 
-static const struct sd_desc sd_desc_ov965x = {
-       .name     = MODULE_NAME,
-       .ctrls    = sd_ctrls_ov965x,
-       .nctrls   = ARRAY_SIZE(sd_ctrls_ov965x),
-       .config   = sd_config,
-       .init     = sd_init,
-       .start    = sd_start_ov965x,
-       .stopN    = sd_stopN_ov965x,
-       .pkt_scan = sd_pkt_scan,
-       .querymenu = sd_querymenu,
-};
-
 /* -- module initialisation -- */
 static const __devinitdata struct usb_device_id device_table[] = {
-       {USB_DEVICE(0x06f8, 0x3003), .driver_info = SENSOR_OV965X},
-       {USB_DEVICE(0x1415, 0x2000), .driver_info = SENSOR_OV772X},
+       {USB_DEVICE(0x1415, 0x2000)},
        {}
 };
 
@@ -2326,11 +1311,7 @@ MODULE_DEVICE_TABLE(usb, device_table);
 /* -- device connect -- */
 static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id)
 {
-       return gspca_dev_probe(intf, id,
-                               id->driver_info == SENSOR_OV772X
-                                       ? &sd_desc_ov772x
-                                       : &sd_desc_ov965x,
-                               sizeof(struct sd),
+       return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
                                THIS_MODULE);
 }
 
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c
new file mode 100644 (file)
index 0000000..bbe5a03
--- /dev/null
@@ -0,0 +1,1477 @@
+/*
+ * ov534-ov965x gspca driver
+ *
+ * Copyright (C) 2009-2010 Jean-Francois Moine http://moinejf.free.fr
+ * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it>
+ * Copyright (C) 2008 Jim Paris <jim@jtan.com>
+ *
+ * Based on a prototype written by Mark Ferrell <majortrips@gmail.com>
+ * USB protocol reverse engineered by Jim Paris <jim@jtan.com>
+ * https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/
+ *
+ * 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
+ * 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
+ */
+
+#define MODULE_NAME "ov534_9"
+
+#include "gspca.h"
+
+#define OV534_REG_ADDRESS      0xf1    /* sensor address */
+#define OV534_REG_SUBADDR      0xf2
+#define OV534_REG_WRITE                0xf3
+#define OV534_REG_READ         0xf4
+#define OV534_REG_OPERATION    0xf5
+#define OV534_REG_STATUS       0xf6
+
+#define OV534_OP_WRITE_3       0x37
+#define OV534_OP_WRITE_2       0x33
+#define OV534_OP_READ_2                0xf9
+
+#define CTRL_TIMEOUT 500
+
+MODULE_AUTHOR("Jean-Francois Moine <moinejf@free.fr>");
+MODULE_DESCRIPTION("GSPCA/OV534_9 USB Camera Driver");
+MODULE_LICENSE("GPL");
+
+/* specific webcam descriptor */
+struct sd {
+       struct gspca_dev gspca_dev;     /* !! must be the first item */
+       __u32 last_pts;
+       u8 last_fid;
+
+       u8 brightness;
+       u8 contrast;
+       u8 autogain;
+       u8 exposure;
+       s8 sharpness;
+       u8 satur;
+       u8 freq;
+};
+
+/* V4L2 controls supported by the driver */
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setsatur(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getsatur(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
+
+static const struct ctrl sd_ctrls[] = {
+    {                                                  /* 0 */
+       {
+               .id      = V4L2_CID_BRIGHTNESS,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Brightness",
+               .minimum = 0,
+               .maximum = 15,
+               .step    = 1,
+#define BRIGHTNESS_DEF 7
+               .default_value = BRIGHTNESS_DEF,
+       },
+       .set = sd_setbrightness,
+       .get = sd_getbrightness,
+    },
+    {                                                  /* 1 */
+       {
+               .id      = V4L2_CID_CONTRAST,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Contrast",
+               .minimum = 0,
+               .maximum = 15,
+               .step    = 1,
+#define CONTRAST_DEF 3
+               .default_value = CONTRAST_DEF,
+       },
+       .set = sd_setcontrast,
+       .get = sd_getcontrast,
+    },
+    {                                                  /* 2 */
+       {
+               .id      = V4L2_CID_AUTOGAIN,
+               .type    = V4L2_CTRL_TYPE_BOOLEAN,
+               .name    = "Autogain",
+               .minimum = 0,
+               .maximum = 1,
+               .step    = 1,
+#define AUTOGAIN_DEF 1
+               .default_value = AUTOGAIN_DEF,
+       },
+       .set = sd_setautogain,
+       .get = sd_getautogain,
+    },
+#define EXPO_IDX 3
+    {                                                  /* 3 */
+       {
+               .id      = V4L2_CID_EXPOSURE,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Exposure",
+               .minimum = 0,
+               .maximum = 3,
+               .step    = 1,
+#define EXPO_DEF 0
+               .default_value = EXPO_DEF,
+       },
+       .set = sd_setexposure,
+       .get = sd_getexposure,
+    },
+    {                                                  /* 4 */
+       {
+               .id      = V4L2_CID_SHARPNESS,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Sharpness",
+               .minimum = -1,          /* -1 = auto */
+               .maximum = 4,
+               .step    = 1,
+#define SHARPNESS_DEF -1
+               .default_value = SHARPNESS_DEF,
+       },
+       .set = sd_setsharpness,
+       .get = sd_getsharpness,
+    },
+    {                                                  /* 5 */
+       {
+               .id      = V4L2_CID_SATURATION,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Saturation",
+               .minimum = 0,
+               .maximum = 4,
+               .step    = 1,
+#define SATUR_DEF 2
+               .default_value = SATUR_DEF,
+       },
+       .set = sd_setsatur,
+       .get = sd_getsatur,
+    },
+    {
+       {
+               .id      = V4L2_CID_POWER_LINE_FREQUENCY,
+               .type    = V4L2_CTRL_TYPE_MENU,
+               .name    = "Light frequency filter",
+               .minimum = 0,
+               .maximum = 2,   /* 0: 0, 1: 50Hz, 2:60Hz */
+               .step    = 1,
+#define FREQ_DEF 0
+               .default_value = FREQ_DEF,
+       },
+       .set = sd_setfreq,
+       .get = sd_getfreq,
+    },
+};
+
+static const struct v4l2_pix_format ov965x_mode[] = {
+#define QVGA_MODE 0
+       {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 320,
+               .sizeimage = 320 * 240 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+#define VGA_MODE 1
+       {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 640,
+               .sizeimage = 640 * 480 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+#define SVGA_MODE 2
+       {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 800,
+               .sizeimage = 800 * 600 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+#define XGA_MODE 3
+       {1024, 768, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 1024,
+               .sizeimage = 1024 * 768 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+#define SXGA_MODE 4
+       {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 1280,
+               .sizeimage = 1280 * 1024 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG},
+};
+
+static const u8 bridge_init[][2] = {
+       {0x88, 0xf8},
+       {0x89, 0xff},
+       {0x76, 0x03},
+       {0x92, 0x03},
+       {0x95, 0x10},
+       {0xe2, 0x00},
+       {0xe7, 0x3e},
+       {0x8d, 0x1c},
+       {0x8e, 0x00},
+       {0x8f, 0x00},
+       {0x1f, 0x00},
+       {0xc3, 0xf9},
+       {0x89, 0xff},
+       {0x88, 0xf8},
+       {0x76, 0x03},
+       {0x92, 0x01},
+       {0x93, 0x18},
+       {0x1c, 0x0a},
+       {0x1d, 0x48},
+       {0xc0, 0x50},
+       {0xc1, 0x3c},
+       {0x34, 0x05},
+       {0xc2, 0x0c},
+       {0xc3, 0xf9},
+       {0x34, 0x05},
+       {0xe7, 0x2e},
+       {0x31, 0xf9},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0x25, 0x42},
+       {0x94, 0x11},
+};
+
+static const u8 sensor_init[][2] = {
+       {0x12, 0x80},   /* com7 - SSCB reset */
+       {0x00, 0x00},   /* gain */
+       {0x01, 0x80},   /* blue */
+       {0x02, 0x80},   /* red */
+       {0x03, 0x1b},   /* vref */
+       {0x04, 0x03},   /* com1 - exposure low bits */
+       {0x0b, 0x57},   /* ver */
+       {0x0e, 0x61},   /* com5 */
+       {0x0f, 0x42},   /* com6 */
+       {0x11, 0x00},   /* clkrc */
+       {0x12, 0x02},   /* com7 - 15fps VGA YUYV */
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x14, 0x28},   /* com9 */
+       {0x16, 0x24},   /* reg16 */
+       {0x17, 0x1d},   /* hstart*/
+       {0x18, 0xbd},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x81},   /* vstop*/
+       {0x1e, 0x04},   /* mvfp */
+       {0x24, 0x3c},   /* aew */
+       {0x25, 0x36},   /* aeb */
+       {0x26, 0x71},   /* vpt */
+       {0x27, 0x08},   /* bbias */
+       {0x28, 0x08},   /* gbbias */
+       {0x29, 0x15},   /* gr com */
+       {0x2a, 0x00},   /* exhch */
+       {0x2b, 0x00},   /* exhcl */
+       {0x2c, 0x08},   /* rbias */
+       {0x32, 0xff},   /* href */
+       {0x33, 0x00},   /* chlf */
+       {0x34, 0x3f},   /* aref1 */
+       {0x35, 0x00},   /* aref2 */
+       {0x36, 0xf8},   /* aref3 */
+       {0x38, 0x72},   /* adc2 */
+       {0x39, 0x57},   /* aref4 */
+       {0x3a, 0x80},   /* tslb - yuyv */
+       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
+       {0x3d, 0x99},   /* com13 */
+       {0x3f, 0xc1},   /* edge */
+       {0x40, 0xc0},   /* com15 */
+       {0x41, 0x40},   /* com16 */
+       {0x42, 0xc0},   /* com17 */
+       {0x43, 0x0a},   /* rsvd */
+       {0x44, 0xf0},
+       {0x45, 0x46},
+       {0x46, 0x62},
+       {0x47, 0x2a},
+       {0x48, 0x3c},
+       {0x4a, 0xfc},
+       {0x4b, 0xfc},
+       {0x4c, 0x7f},
+       {0x4d, 0x7f},
+       {0x4e, 0x7f},
+       {0x4f, 0x98},   /* matrix */
+       {0x50, 0x98},
+       {0x51, 0x00},
+       {0x52, 0x28},
+       {0x53, 0x70},
+       {0x54, 0x98},
+       {0x58, 0x1a},   /* matrix coef sign */
+       {0x59, 0x85},   /* AWB control */
+       {0x5a, 0xa9},
+       {0x5b, 0x64},
+       {0x5c, 0x84},
+       {0x5d, 0x53},
+       {0x5e, 0x0e},
+       {0x5f, 0xf0},   /* AWB blue limit */
+       {0x60, 0xf0},   /* AWB red limit */
+       {0x61, 0xf0},   /* AWB green limit */
+       {0x62, 0x00},   /* lcc1 */
+       {0x63, 0x00},   /* lcc2 */
+       {0x64, 0x02},   /* lcc3 */
+       {0x65, 0x16},   /* lcc4 */
+       {0x66, 0x01},   /* lcc5 */
+       {0x69, 0x02},   /* hv */
+       {0x6b, 0x5a},   /* dbvl */
+       {0x6c, 0x04},
+       {0x6d, 0x55},
+       {0x6e, 0x00},
+       {0x6f, 0x9d},
+       {0x70, 0x21},   /* dnsth */
+       {0x71, 0x78},
+       {0x72, 0x00},   /* poidx */
+       {0x73, 0x01},   /* pckdv */
+       {0x74, 0x3a},   /* xindx */
+       {0x75, 0x35},   /* yindx */
+       {0x76, 0x01},
+       {0x77, 0x02},
+       {0x7a, 0x12},   /* gamma curve */
+       {0x7b, 0x08},
+       {0x7c, 0x16},
+       {0x7d, 0x30},
+       {0x7e, 0x5e},
+       {0x7f, 0x72},
+       {0x80, 0x82},
+       {0x81, 0x8e},
+       {0x82, 0x9a},
+       {0x83, 0xa4},
+       {0x84, 0xac},
+       {0x85, 0xb8},
+       {0x86, 0xc3},
+       {0x87, 0xd6},
+       {0x88, 0xe6},
+       {0x89, 0xf2},
+       {0x8a, 0x03},
+       {0x8c, 0x89},   /* com19 */
+       {0x14, 0x28},   /* com9 */
+       {0x90, 0x7d},
+       {0x91, 0x7b},
+       {0x9d, 0x03},   /* lcc6 */
+       {0x9e, 0x04},   /* lcc7 */
+       {0x9f, 0x7a},
+       {0xa0, 0x79},
+       {0xa1, 0x40},   /* aechm */
+       {0xa4, 0x50},   /* com21 */
+       {0xa5, 0x68},   /* com26 */
+       {0xa6, 0x4a},   /* AWB green */
+       {0xa8, 0xc1},   /* refa8 */
+       {0xa9, 0xef},   /* refa9 */
+       {0xaa, 0x92},
+       {0xab, 0x04},
+       {0xac, 0x80},   /* black level control */
+       {0xad, 0x80},
+       {0xae, 0x80},
+       {0xaf, 0x80},
+       {0xb2, 0xf2},
+       {0xb3, 0x20},
+       {0xb4, 0x20},   /* ctrlb4 */
+       {0xb5, 0x00},
+       {0xb6, 0xaf},
+       {0xbb, 0xae},
+       {0xbc, 0x7f},   /* ADC channel offsets */
+       {0xdb, 0x7f},
+       {0xbe, 0x7f},
+       {0xbf, 0x7f},
+       {0xc0, 0xe2},
+       {0xc1, 0xc0},
+       {0xc2, 0x01},
+       {0xc3, 0x4e},
+       {0xc6, 0x85},
+       {0xc7, 0x80},   /* com24 */
+       {0xc9, 0xe0},
+       {0xca, 0xe8},
+       {0xcb, 0xf0},
+       {0xcc, 0xd8},
+       {0xcd, 0xf1},
+       {0x4f, 0x98},   /* matrix */
+       {0x50, 0x98},
+       {0x51, 0x00},
+       {0x52, 0x28},
+       {0x53, 0x70},
+       {0x54, 0x98},
+       {0x58, 0x1a},
+       {0xff, 0x41},   /* read 41, write ff 00 */
+       {0x41, 0x40},   /* com16 */
+
+       {0xc5, 0x03},   /* 60 Hz banding filter */
+       {0x6a, 0x02},   /* 50 Hz banding filter */
+
+       {0x12, 0x62},   /* com7 - 30fps VGA YUV */
+       {0x36, 0xfa},   /* aref3 */
+       {0x69, 0x0a},   /* hv */
+       {0x8c, 0x89},   /* com22 */
+       {0x14, 0x28},   /* com9 */
+       {0x3e, 0x0c},
+       {0x41, 0x40},   /* com16 */
+       {0x72, 0x00},
+       {0x73, 0x00},
+       {0x74, 0x3a},
+       {0x75, 0x35},
+       {0x76, 0x01},
+       {0xc7, 0x80},
+       {0x03, 0x12},   /* vref */
+       {0x17, 0x16},   /* hstart */
+       {0x18, 0x02},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x3d},   /* vstop */
+       {0x32, 0xff},   /* href */
+       {0xc0, 0xaa},
+};
+
+static const u8 bridge_init_2[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0x50},
+       {0xc1, 0x3c},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+
+       {0xc2, 0x0c},
+       {0xc3, 0xf9},
+       {0xda, 0x01},
+       {0x50, 0x00},
+       {0x51, 0xa0},
+       {0x52, 0x3c},
+       {0x53, 0x00},
+       {0x54, 0x00},
+       {0x55, 0x00},
+       {0x57, 0x00},
+       {0x5c, 0x00},
+       {0x5a, 0xa0},
+       {0x5b, 0x78},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0x94, 0x11},
+};
+
+static const u8 sensor_init_2[][2] = {
+       {0x3b, 0xc4},
+       {0x1e, 0x04},   /* mvfp */
+       {0x13, 0xe0},   /* com8 */
+       {0x00, 0x00},   /* gain */
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x11, 0x03},   /* clkrc */
+       {0x6b, 0x5a},   /* dblv */
+       {0x6a, 0x05},
+       {0xc5, 0x07},
+       {0xa2, 0x4b},
+       {0xa3, 0x3e},
+       {0x2d, 0x00},
+       {0xff, 0x42},   /* read 42, write ff 00 */
+       {0x42, 0xc0},   /* com17 */
+       {0x2d, 0x00},
+       {0xff, 0x42},   /* read 42, write ff 00 */
+       {0x42, 0xc1},   /* com17 */
+/* sharpness */
+       {0x3f, 0x01},
+       {0xff, 0x42},   /* read 42, write ff 00 */
+       {0x42, 0xc1},   /* com17 */
+/* saturation */
+       {0x4f, 0x98},   /* matrix */
+       {0x50, 0x98},
+       {0x51, 0x00},
+       {0x52, 0x28},
+       {0x53, 0x70},
+       {0x54, 0x98},
+       {0x58, 0x1a},
+       {0xff, 0x41},   /* read 41, write ff 00 */
+       {0x41, 0x40},   /* com16 */
+/* contrast */
+       {0x56, 0x40},
+/* brightness */
+       {0x55, 0x8f},
+/* expo */
+       {0x10, 0x25},   /* aech - exposure high bits */
+       {0xff, 0x13},   /* read 13, write ff 00 */
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+};
+
+static const u8 sensor_start_1_vga[][2] = {    /* same for qvga */
+       {0x12, 0x62},   /* com7 - 30fps VGA YUV */
+       {0x36, 0xfa},   /* aref3 */
+       {0x69, 0x0a},   /* hv */
+       {0x8c, 0x89},   /* com22 */
+       {0x14, 0x28},   /* com9 */
+       {0x3e, 0x0c},   /* com14 */
+       {0x41, 0x40},   /* com16 */
+       {0x72, 0x00},
+       {0x73, 0x00},
+       {0x74, 0x3a},
+       {0x75, 0x35},
+       {0x76, 0x01},
+       {0xc7, 0x80},   /* com24 */
+       {0x03, 0x12},   /* vref */
+       {0x17, 0x16},   /* hstart */
+       {0x18, 0x02},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x3d},   /* vstop */
+       {0x32, 0xff},   /* href */
+       {0xc0, 0xaa},
+};
+
+static const u8 sensor_start_1_svga[][2] = {
+       {0x12, 0x02},   /* com7 - YUYV - VGA 15 full resolution */
+       {0x36, 0xf8},   /* aref3 */
+       {0x69, 0x02},   /* hv */
+       {0x8c, 0x0d},   /* com22 */
+       {0x3e, 0x0c},   /* com14 */
+       {0x41, 0x40},   /* com16 */
+       {0x72, 0x00},
+       {0x73, 0x01},
+       {0x74, 0x3a},
+       {0x75, 0x35},
+       {0x76, 0x01},
+       {0xc7, 0x80},   /* com24 */
+       {0x03, 0x1b},   /* vref */
+       {0x17, 0x1d},   /* hstart */
+       {0x18, 0xbd},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x81},   /* vstop */
+       {0x32, 0xff},   /* href */
+       {0xc0, 0xe2},
+};
+
+static const u8 sensor_start_1_xga[][2] = {
+       {0x12, 0x02},   /* com7 */
+       {0x36, 0xf8},   /* aref3 */
+       {0x69, 0x02},   /* hv */
+       {0x8c, 0x89},   /* com22 */
+       {0x14, 0x28},   /* com9 */
+       {0x3e, 0x0c},   /* com14 */
+       {0x41, 0x40},   /* com16 */
+       {0x72, 0x00},
+       {0x73, 0x01},
+       {0x74, 0x3a},
+       {0x75, 0x35},
+       {0x76, 0x01},
+       {0xc7, 0x80},   /* com24 */
+       {0x03, 0x1b},   /* vref */
+       {0x17, 0x1d},   /* hstart */
+       {0x18, 0xbd},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x81},   /* vstop */
+       {0x32, 0xff},   /* href */
+       {0xc0, 0xe2},
+};
+
+static const u8 sensor_start_1_sxga[][2] = {
+       {0x12, 0x02},   /* com7 */
+       {0x36, 0xf8},   /* aref3 */
+       {0x69, 0x02},   /* hv */
+       {0x8c, 0x89},   /* com22 */
+       {0x14, 0x28},   /* com9 */
+       {0x3e, 0x0c},   /* com14 */
+       {0x41, 0x40},   /* com16 */
+       {0x72, 0x00},
+       {0x73, 0x01},
+       {0x74, 0x3a},
+       {0x75, 0x35},
+       {0x76, 0x01},
+       {0xc7, 0x80},   /* com24 */
+       {0x03, 0x1b},   /* vref */
+       {0x17, 0x1d},   /* hstart */
+       {0x18, 0x02},   /* hstop */
+       {0x19, 0x01},   /* vstrt */
+       {0x1a, 0x81},   /* vstop */
+       {0x32, 0xff},   /* href */
+       {0xc0, 0xe2},
+};
+
+static const u8 bridge_start_qvga[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0x50},
+       {0xc1, 0x3c},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+
+       {0xc2, 0x4c},
+       {0xc3, 0xf9},
+       {0xda, 0x00},
+       {0x50, 0x00},
+       {0x51, 0xa0},
+       {0x52, 0x78},
+       {0x53, 0x00},
+       {0x54, 0x00},
+       {0x55, 0x00},
+       {0x57, 0x00},
+       {0x5c, 0x00},
+       {0x5a, 0x50},
+       {0x5b, 0x3c},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0x94, 0x11},
+};
+
+static const u8 bridge_start_vga[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0x50},
+       {0xc1, 0x3c},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+       {0xc2, 0x0c},
+       {0xc3, 0xf9},
+       {0xda, 0x01},
+       {0x50, 0x00},
+       {0x51, 0xa0},
+       {0x52, 0x3c},
+       {0x53, 0x00},
+       {0x54, 0x00},
+       {0x55, 0x00},
+       {0x57, 0x00},
+       {0x5c, 0x00},
+       {0x5a, 0xa0},
+       {0x5b, 0x78},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0x94, 0x11},
+};
+
+static const u8 bridge_start_svga[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0xa0},
+       {0xc1, 0x80},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+       {0xc2, 0x4c},
+       {0xc3, 0xf9},
+       {0x50, 0x00},
+       {0x51, 0x40},
+       {0x52, 0x00},
+       {0x53, 0x00},
+       {0x54, 0x00},
+       {0x55, 0x88},
+       {0x57, 0x00},
+       {0x5c, 0x00},
+       {0x5a, 0xc8},
+       {0x5b, 0x96},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0xda, 0x00},
+       {0x94, 0x11},
+};
+
+static const u8 bridge_start_xga[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0xa0},
+       {0xc1, 0x80},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+       {0xc2, 0x4c},
+       {0xc3, 0xf9},
+       {0x50, 0x00},
+       {0x51, 0x40},
+       {0x52, 0x00},
+       {0x53, 0x00},
+       {0x54, 0x00},
+       {0x55, 0x88},
+       {0x57, 0x00},
+       {0x5c, 0x01},
+       {0x5a, 0x00},
+       {0x5b, 0xc0},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0xda, 0x01},
+       {0x94, 0x11},
+};
+
+static const u8 bridge_start_sxga[][2] = {
+       {0x94, 0xaa},
+       {0xf1, 0x60},
+       {0xe5, 0x04},
+       {0xc0, 0xa0},
+       {0xc1, 0x80},
+       {0x8c, 0x00},
+       {0x8d, 0x1c},
+       {0x34, 0x05},
+       {0xc2, 0x0c},
+       {0xc3, 0xf9},
+       {0xda, 0x00},
+       {0x35, 0x02},
+       {0xd9, 0x10},
+       {0x94, 0x11},
+};
+
+static const u8 sensor_start_2_qvga[][2] = {
+       {0x3b, 0xe4},   /* com11 - night mode 1/4 frame rate */
+       {0x1e, 0x04},   /* mvfp */
+       {0x13, 0xe0},   /* com8 */
+       {0x00, 0x00},
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x11, 0x01},   /* clkrc */
+       {0x6b, 0x5a},   /* dblv */
+       {0x6a, 0x02},   /* 50 Hz banding filter */
+       {0xc5, 0x03},   /* 60 Hz banding filter */
+       {0xa2, 0x96},   /* bd50 */
+       {0xa3, 0x7d},   /* bd60 */
+
+       {0xff, 0x13},   /* read 13, write ff 00 */
+       {0x13, 0xe7},
+       {0x3a, 0x80},   /* tslb - yuyv */
+};
+
+static const u8 sensor_start_2_vga[][2] = {
+       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
+       {0x1e, 0x04},   /* mvfp */
+       {0x13, 0xe0},   /* com8 */
+       {0x00, 0x00},
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x11, 0x03},   /* clkrc */
+       {0x6b, 0x5a},   /* dblv */
+       {0x6a, 0x05},   /* 50 Hz banding filter */
+       {0xc5, 0x07},   /* 60 Hz banding filter */
+       {0xa2, 0x4b},   /* bd50 */
+       {0xa3, 0x3e},   /* bd60 */
+
+       {0x2d, 0x00},   /* advfl */
+};
+
+static const u8 sensor_start_2_svga[][2] = {   /* same for xga */
+       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
+       {0x1e, 0x04},   /* mvfp */
+       {0x13, 0xe0},   /* com8 */
+       {0x00, 0x00},
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x11, 0x01},   /* clkrc */
+       {0x6b, 0x5a},   /* dblv */
+       {0x6a, 0x0c},   /* 50 Hz banding filter */
+       {0xc5, 0x0f},   /* 60 Hz banding filter */
+       {0xa2, 0x4e},   /* bd50 */
+       {0xa3, 0x41},   /* bd60 */
+};
+
+static const u8 sensor_start_2_sxga[][2] = {
+       {0x13, 0xe0},   /* com8 */
+       {0x00, 0x00},
+       {0x13, 0xe7},   /* com8 - everything (AGC, AWB and AEC) */
+       {0x3b, 0xc4},   /* com11 - night mode 1/4 frame rate */
+       {0x1e, 0x04},   /* mvfp */
+       {0x11, 0x01},   /* clkrc */
+       {0x6b, 0x5a},   /* dblv */
+       {0x6a, 0x0c},   /* 50 Hz banding filter */
+       {0xc5, 0x0f},   /* 60 Hz banding filter */
+       {0xa2, 0x4e},   /* bd50 */
+       {0xa3, 0x41},   /* bd60 */
+};
+
+static void reg_w_i(struct gspca_dev *gspca_dev, u16 reg, u8 val)
+{
+       struct usb_device *udev = gspca_dev->dev;
+       int ret;
+
+       if (gspca_dev->usb_err < 0)
+               return;
+       gspca_dev->usb_buf[0] = val;
+       ret = usb_control_msg(udev,
+                             usb_sndctrlpipe(udev, 0),
+                             0x01,
+                             USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                             0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "reg_w failed %d", ret);
+               gspca_dev->usb_err = ret;
+       }
+}
+
+static void reg_w(struct gspca_dev *gspca_dev, u16 reg, u8 val)
+{
+       PDEBUG(D_USBO, "reg_w [%04x] = %02x", reg, val);
+       reg_w_i(gspca_dev, reg, val);
+}
+
+static u8 reg_r(struct gspca_dev *gspca_dev, u16 reg)
+{
+       struct usb_device *udev = gspca_dev->dev;
+       int ret;
+
+       if (gspca_dev->usb_err < 0)
+               return 0;
+       ret = usb_control_msg(udev,
+                             usb_rcvctrlpipe(udev, 0),
+                             0x01,
+                             USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                             0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
+       PDEBUG(D_USBI, "reg_r [%04x] -> %02x", reg, gspca_dev->usb_buf[0]);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "reg_r err %d", ret);
+               gspca_dev->usb_err = ret;
+       }
+       return gspca_dev->usb_buf[0];
+}
+
+static int sccb_check_status(struct gspca_dev *gspca_dev)
+{
+       u8 data;
+       int i;
+
+       for (i = 0; i < 5; i++) {
+               data = reg_r(gspca_dev, OV534_REG_STATUS);
+
+               switch (data) {
+               case 0x00:
+                       return 1;
+               case 0x04:
+                       return 0;
+               case 0x03:
+                       break;
+               default:
+                       PDEBUG(D_USBI|D_USBO,
+                               "sccb status 0x%02x, attempt %d/5",
+                               data, i + 1);
+               }
+       }
+       return 0;
+}
+
+static void sccb_write(struct gspca_dev *gspca_dev, u8 reg, u8 val)
+{
+       PDEBUG(D_USBO, "sccb_write [%02x] = %02x", reg, val);
+       reg_w_i(gspca_dev, OV534_REG_SUBADDR, reg);
+       reg_w_i(gspca_dev, OV534_REG_WRITE, val);
+       reg_w_i(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3);
+
+       if (!sccb_check_status(gspca_dev))
+               PDEBUG(D_ERR, "sccb_write failed");
+}
+
+static u8 sccb_read(struct gspca_dev *gspca_dev, u16 reg)
+{
+       reg_w(gspca_dev, OV534_REG_SUBADDR, reg);
+       reg_w(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_2);
+       if (!sccb_check_status(gspca_dev))
+               PDEBUG(D_ERR, "sccb_read failed 1");
+
+       reg_w(gspca_dev, OV534_REG_OPERATION, OV534_OP_READ_2);
+       if (!sccb_check_status(gspca_dev))
+               PDEBUG(D_ERR, "sccb_read failed 2");
+
+       return reg_r(gspca_dev, OV534_REG_READ);
+}
+
+/* output a bridge sequence (reg - val) */
+static void reg_w_array(struct gspca_dev *gspca_dev,
+                       const u8 (*data)[2], int len)
+{
+       while (--len >= 0) {
+               reg_w(gspca_dev, (*data)[0], (*data)[1]);
+               data++;
+       }
+}
+
+/* output a sensor sequence (reg - val) */
+static void sccb_w_array(struct gspca_dev *gspca_dev,
+                       const u8 (*data)[2], int len)
+{
+       while (--len >= 0) {
+               if ((*data)[0] != 0xff) {
+                       sccb_write(gspca_dev, (*data)[0], (*data)[1]);
+               } else {
+                       sccb_read(gspca_dev, (*data)[1]);
+                       sccb_write(gspca_dev, 0xff, 0x00);
+               }
+               data++;
+       }
+}
+
+/* Two bits control LED: 0x21 bit 7 and 0x23 bit 7.
+ * (direction and output)? */
+static void set_led(struct gspca_dev *gspca_dev, int status)
+{
+       u8 data;
+
+       PDEBUG(D_CONF, "led status: %d", status);
+
+       data = reg_r(gspca_dev, 0x21);
+       data |= 0x80;
+       reg_w(gspca_dev, 0x21, data);
+
+       data = reg_r(gspca_dev, 0x23);
+       if (status)
+               data |= 0x80;
+       else
+               data &= ~0x80;
+
+       reg_w(gspca_dev, 0x23, data);
+
+       if (!status) {
+               data = reg_r(gspca_dev, 0x21);
+               data &= ~0x80;
+               reg_w(gspca_dev, 0x21, data);
+       }
+}
+
+static void setbrightness(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 val;
+
+       val = sd->brightness;
+       if (val < 8)
+               val = 15 - val;         /* f .. 8 */
+       else
+               val = val - 8;          /* 0 .. 7 */
+       sccb_write(gspca_dev, 0x55,     /* brtn - brightness adjustment */
+                       0x0f | (val << 4));
+}
+
+static void setcontrast(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sccb_write(gspca_dev, 0x56,     /* cnst1 - contrast 1 ctrl coeff */
+                       sd->contrast << 4);
+}
+
+static void setautogain(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 val;
+
+/*fixme: should adjust agc/awb/aec by different controls */
+       val = sd->autogain;
+       val = sccb_read(gspca_dev, 0x13);               /* com8 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       if (sd->autogain)
+               val |= 0x05;            /* agc & aec */
+       else
+               val &= 0xfa;
+       sccb_write(gspca_dev, 0x13, val);
+}
+
+static void setexposure(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 val;
+       static const u8 expo[4] = {0x00, 0x25, 0x38, 0x5e};
+
+       sccb_write(gspca_dev, 0x10,                     /* aec[9:2] */
+                       expo[sd->exposure]);
+
+       val = sccb_read(gspca_dev, 0x13);               /* com8 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       sccb_write(gspca_dev, 0x13, val);
+
+       val = sccb_read(gspca_dev, 0xa1);               /* aech */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       sccb_write(gspca_dev, 0xa1, val & 0xe0);        /* aec[15:10] = 0 */
+}
+
+static void setsharpness(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       s8 val;
+
+       val = sd->sharpness;
+       if (val < 0) {                          /* auto */
+               val = sccb_read(gspca_dev, 0x42);       /* com17 */
+               sccb_write(gspca_dev, 0xff, 0x00);
+               sccb_write(gspca_dev, 0x42, val | 0x40);
+                               /* Edge enhancement strength auto adjust */
+               return;
+       }
+       if (val != 0)
+               val = 1 << (val - 1);
+       sccb_write(gspca_dev, 0x3f,     /* edge - edge enhance. factor */
+                       val);
+       val = sccb_read(gspca_dev, 0x42);               /* com17 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       sccb_write(gspca_dev, 0x42, val & 0xbf);
+}
+
+static void setsatur(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 val1, val2, val3;
+       static const u8 matrix[5][2] = {
+               {0x14, 0x38},
+               {0x1e, 0x54},
+               {0x28, 0x70},
+               {0x32, 0x8c},
+               {0x48, 0x90}
+       };
+
+       val1 = matrix[sd->satur][0];
+       val2 = matrix[sd->satur][1];
+       val3 = val1 + val2;
+       sccb_write(gspca_dev, 0x4f, val3);      /* matrix coeff */
+       sccb_write(gspca_dev, 0x50, val3);
+       sccb_write(gspca_dev, 0x51, 0x00);
+       sccb_write(gspca_dev, 0x52, val1);
+       sccb_write(gspca_dev, 0x53, val2);
+       sccb_write(gspca_dev, 0x54, val3);
+       sccb_write(gspca_dev, 0x58, 0x1a);      /* mtxs - coeff signs */
+
+       val1 = sccb_read(gspca_dev, 0x41);      /* com16 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       sccb_write(gspca_dev, 0x41, val1);
+}
+
+static void setfreq(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 val;
+
+       val = sccb_read(gspca_dev, 0x13);               /* com8 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       if (sd->freq == 0) {
+               sccb_write(gspca_dev, 0x13, val & 0xdf);
+               return;
+       }
+       sccb_write(gspca_dev, 0x13, val | 0x20);
+
+       val = sccb_read(gspca_dev, 0x42);               /* com17 */
+       sccb_write(gspca_dev, 0xff, 0x00);
+       if (sd->freq == 1)
+               val |= 0x01;
+       else
+               val &= 0xfe;
+       sccb_write(gspca_dev, 0x42, val);
+}
+
+/* this function is called at probe time */
+static int sd_config(struct gspca_dev *gspca_dev,
+                    const struct usb_device_id *id)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       struct cam *cam;
+
+       cam = &gspca_dev->cam;
+
+       cam->cam_mode = ov965x_mode;
+       cam->nmodes = ARRAY_SIZE(ov965x_mode);
+
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+#if AUTOGAIN_DEF != 0
+       sd->autogain = AUTOGAIN_DEF;
+       gspca_dev->ctrl_inac |= (1 << EXPO_IDX);
+#endif
+#if EXPO_DEF != 0
+       sd->exposure = EXPO_DEF;
+#endif
+#if SHARPNESS_DEF != 0
+       sd->sharpness = SHARPNESS_DEF;
+#endif
+       sd->satur = SATUR_DEF;
+       sd->freq = FREQ_DEF;
+
+       return 0;
+}
+
+/* this function is called at probe and resume time */
+static int sd_init(struct gspca_dev *gspca_dev)
+{
+       u16 sensor_id;
+
+       /* reset bridge */
+       reg_w(gspca_dev, 0xe7, 0x3a);
+       reg_w(gspca_dev, 0xe0, 0x08);
+       msleep(100);
+
+       /* initialize the sensor address */
+       reg_w(gspca_dev, OV534_REG_ADDRESS, 0x60);
+
+       /* reset sensor */
+       sccb_write(gspca_dev, 0x12, 0x80);
+       msleep(10);
+
+       /* probe the sensor */
+       sccb_read(gspca_dev, 0x0a);
+       sensor_id = sccb_read(gspca_dev, 0x0a) << 8;
+       sccb_read(gspca_dev, 0x0b);
+       sensor_id |= sccb_read(gspca_dev, 0x0b);
+       PDEBUG(D_PROBE, "Sensor ID: %04x", sensor_id);
+
+       /* initialize */
+       reg_w_array(gspca_dev, bridge_init,
+                       ARRAY_SIZE(bridge_init));
+       sccb_w_array(gspca_dev, sensor_init,
+                       ARRAY_SIZE(sensor_init));
+       reg_w_array(gspca_dev, bridge_init_2,
+                       ARRAY_SIZE(bridge_init_2));
+       sccb_w_array(gspca_dev, sensor_init_2,
+                       ARRAY_SIZE(sensor_init_2));
+       reg_w(gspca_dev, 0xe0, 0x00);
+       reg_w(gspca_dev, 0xe0, 0x01);
+       set_led(gspca_dev, 0);
+       reg_w(gspca_dev, 0xe0, 0x00);
+
+       return gspca_dev->usb_err;
+}
+
+static int sd_start(struct gspca_dev *gspca_dev)
+{
+       switch (gspca_dev->curr_mode) {
+       case QVGA_MODE:                 /* 320x240 */
+               sccb_w_array(gspca_dev, sensor_start_1_vga,
+                               ARRAY_SIZE(sensor_start_1_vga));
+               reg_w_array(gspca_dev, bridge_start_qvga,
+                               ARRAY_SIZE(bridge_start_qvga));
+               sccb_w_array(gspca_dev, sensor_start_2_qvga,
+                               ARRAY_SIZE(sensor_start_2_qvga));
+               break;
+       case VGA_MODE:                  /* 640x480 */
+               sccb_w_array(gspca_dev, sensor_start_1_vga,
+                               ARRAY_SIZE(sensor_start_1_vga));
+               reg_w_array(gspca_dev, bridge_start_vga,
+                               ARRAY_SIZE(bridge_start_vga));
+               sccb_w_array(gspca_dev, sensor_start_2_vga,
+                               ARRAY_SIZE(sensor_start_2_vga));
+               break;
+       case SVGA_MODE:                 /* 800x600 */
+               sccb_w_array(gspca_dev, sensor_start_1_svga,
+                               ARRAY_SIZE(sensor_start_1_svga));
+               reg_w_array(gspca_dev, bridge_start_svga,
+                               ARRAY_SIZE(bridge_start_svga));
+               sccb_w_array(gspca_dev, sensor_start_2_svga,
+                               ARRAY_SIZE(sensor_start_2_svga));
+               break;
+       case XGA_MODE:                  /* 1024x768 */
+               sccb_w_array(gspca_dev, sensor_start_1_xga,
+                               ARRAY_SIZE(sensor_start_1_xga));
+               reg_w_array(gspca_dev, bridge_start_xga,
+                               ARRAY_SIZE(bridge_start_xga));
+               sccb_w_array(gspca_dev, sensor_start_2_svga,
+                               ARRAY_SIZE(sensor_start_2_svga));
+               break;
+       default:
+/*     case SXGA_MODE:                  * 1280x1024 */
+               sccb_w_array(gspca_dev, sensor_start_1_sxga,
+                               ARRAY_SIZE(sensor_start_1_sxga));
+               reg_w_array(gspca_dev, bridge_start_sxga,
+                               ARRAY_SIZE(bridge_start_sxga));
+               sccb_w_array(gspca_dev, sensor_start_2_sxga,
+                               ARRAY_SIZE(sensor_start_2_sxga));
+               break;
+       }
+       setfreq(gspca_dev);
+       setautogain(gspca_dev);
+       setbrightness(gspca_dev);
+       setcontrast(gspca_dev);
+       setexposure(gspca_dev);
+       setsharpness(gspca_dev);
+       setsatur(gspca_dev);
+
+       reg_w(gspca_dev, 0xe0, 0x00);
+       reg_w(gspca_dev, 0xe0, 0x00);
+       set_led(gspca_dev, 1);
+       return gspca_dev->usb_err;
+}
+
+static void sd_stopN(struct gspca_dev *gspca_dev)
+{
+       reg_w(gspca_dev, 0xe0, 0x01);
+       set_led(gspca_dev, 0);
+       reg_w(gspca_dev, 0xe0, 0x00);
+}
+
+/* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */
+#define UVC_STREAM_EOH (1 << 7)
+#define UVC_STREAM_ERR (1 << 6)
+#define UVC_STREAM_STI (1 << 5)
+#define UVC_STREAM_RES (1 << 4)
+#define UVC_STREAM_SCR (1 << 3)
+#define UVC_STREAM_PTS (1 << 2)
+#define UVC_STREAM_EOF (1 << 1)
+#define UVC_STREAM_FID (1 << 0)
+
+static void sd_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data, int len)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       __u32 this_pts;
+       u8 this_fid;
+       int remaining_len = len;
+
+       do {
+               len = min(remaining_len, 2040);
+
+               /* Payloads are prefixed with a UVC-style header.  We
+                  consider a frame to start when the FID toggles, or the PTS
+                  changes.  A frame ends when EOF is set, and we've received
+                  the correct number of bytes. */
+
+               /* Verify UVC header.  Header length is always 12 */
+               if (data[0] != 12 || len < 12) {
+                       PDEBUG(D_PACK, "bad header");
+                       goto discard;
+               }
+
+               /* Check errors */
+               if (data[1] & UVC_STREAM_ERR) {
+                       PDEBUG(D_PACK, "payload error");
+                       goto discard;
+               }
+
+               /* Extract PTS and FID */
+               if (!(data[1] & UVC_STREAM_PTS)) {
+                       PDEBUG(D_PACK, "PTS not present");
+                       goto discard;
+               }
+               this_pts = (data[5] << 24) | (data[4] << 16)
+                                               | (data[3] << 8) | data[2];
+               this_fid = data[1] & UVC_STREAM_FID;
+
+               /* If PTS or FID has changed, start a new frame. */
+               if (this_pts != sd->last_pts || this_fid != sd->last_fid) {
+                       if (gspca_dev->last_packet_type == INTER_PACKET)
+                               gspca_frame_add(gspca_dev, LAST_PACKET,
+                                               NULL, 0);
+                       sd->last_pts = this_pts;
+                       sd->last_fid = this_fid;
+                       gspca_frame_add(gspca_dev, FIRST_PACKET,
+                                       data + 12, len - 12);
+               /* If this packet is marked as EOF, end the frame */
+               } else if (data[1] & UVC_STREAM_EOF) {
+                       sd->last_pts = 0;
+                       gspca_frame_add(gspca_dev, LAST_PACKET,
+                                       data + 12, len - 12);
+               } else {
+
+                       /* Add the data from this payload */
+                       gspca_frame_add(gspca_dev, INTER_PACKET,
+                                       data + 12, len - 12);
+               }
+
+               /* Done this payload */
+               goto scan_next;
+
+discard:
+               /* Discard data until a new frame starts. */
+               gspca_dev->last_packet_type = DISCARD_PACKET;
+
+scan_next:
+               remaining_len -= len;
+               data += len;
+       } while (remaining_len > 0);
+}
+
+/* controls */
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->brightness = val;
+       if (gspca_dev->streaming)
+               setbrightness(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->brightness;
+       return 0;
+}
+
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->contrast = val;
+       if (gspca_dev->streaming)
+               setcontrast(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->contrast;
+       return 0;
+}
+
+static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->autogain = val;
+
+       if (gspca_dev->streaming) {
+               if (val)
+                       gspca_dev->ctrl_inac |= (1 << EXPO_IDX);
+               else
+                       gspca_dev->ctrl_inac &= ~(1 << EXPO_IDX);
+               setautogain(gspca_dev);
+       }
+       return gspca_dev->usb_err;
+}
+
+static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->autogain;
+       return 0;
+}
+
+static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->exposure = val;
+       if (gspca_dev->streaming)
+               setexposure(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->exposure;
+       return 0;
+}
+
+static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->sharpness = val;
+       if (gspca_dev->streaming)
+               setsharpness(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->sharpness;
+       return 0;
+}
+
+static int sd_setsatur(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->satur = val;
+       if (gspca_dev->streaming)
+               setsatur(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getsatur(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->satur;
+       return 0;
+}
+static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->freq = val;
+       if (gspca_dev->streaming)
+               setfreq(gspca_dev);
+       return gspca_dev->usb_err;
+}
+
+static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->freq;
+       return 0;
+}
+
+static int sd_querymenu(struct gspca_dev *gspca_dev,
+                       struct v4l2_querymenu *menu)
+{
+       switch (menu->id) {
+       case V4L2_CID_POWER_LINE_FREQUENCY:
+               switch (menu->index) {
+               case 0:         /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
+                       strcpy((char *) menu->name, "NoFliker");
+                       return 0;
+               case 1:         /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
+                       strcpy((char *) menu->name, "50 Hz");
+                       return 0;
+               case 2:         /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
+                       strcpy((char *) menu->name, "60 Hz");
+                       return 0;
+               }
+               break;
+       }
+       return -EINVAL;
+}
+
+/* sub-driver description */
+static const struct sd_desc sd_desc = {
+       .name     = MODULE_NAME,
+       .ctrls    = sd_ctrls,
+       .nctrls   = ARRAY_SIZE(sd_ctrls),
+       .config   = sd_config,
+       .init     = sd_init,
+       .start    = sd_start,
+       .stopN    = sd_stopN,
+       .pkt_scan = sd_pkt_scan,
+       .querymenu = sd_querymenu,
+};
+
+/* -- module initialisation -- */
+static const __devinitdata struct usb_device_id device_table[] = {
+       {USB_DEVICE(0x06f8, 0x3003)},
+       {}
+};
+
+MODULE_DEVICE_TABLE(usb, device_table);
+
+/* -- device connect -- */
+static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+       return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
+                               THIS_MODULE);
+}
+
+static struct usb_driver sd_driver = {
+       .name       = MODULE_NAME,
+       .id_table   = device_table,
+       .probe      = sd_probe,
+       .disconnect = gspca_disconnect,
+#ifdef CONFIG_PM
+       .suspend    = gspca_suspend,
+       .resume     = gspca_resume,
+#endif
+};
+
+/* -- module insert / remove -- */
+static int __init sd_mod_init(void)
+{
+       int ret;
+
+       ret = usb_register(&sd_driver);
+       if (ret < 0)
+               return ret;
+       PDEBUG(D_PROBE, "registered");
+       return 0;
+}
+
+static void __exit sd_mod_exit(void)
+{
+       usb_deregister(&sd_driver);
+       PDEBUG(D_PROBE, "deregistered");
+}
+
+module_init(sd_mod_init);
+module_exit(sd_mod_exit);
index 4706a823add0baa395a324acc207bfcdac2b9f6e..0c87c3490b1e9e22d1e91cc701dc09438b133378 100644 (file)
@@ -25,6 +25,7 @@
 
 #define MODULE_NAME "pac207"
 
+#include <linux/input.h>
 #include "gspca.h"
 
 MODULE_AUTHOR("Hans de Goede <hdgoede@redhat.com>");
@@ -77,7 +78,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define SD_BRIGHTNESS 0
        {
            {
@@ -495,6 +496,25 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrput packet length */
+{
+       int ret = -EINVAL;
+
+       if (len == 2 && data[0] == 0x5a && data[1] == 0x5a) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+               input_sync(gspca_dev->input_dev);
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+               input_sync(gspca_dev->input_dev);
+               ret = 0;
+       }
+
+       return ret;
+}
+#endif
+
 /* sub-driver description */
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
@@ -506,6 +526,9 @@ static const struct sd_desc sd_desc = {
        .stopN = sd_stopN,
        .dq_callback = pac207_do_auto_gain,
        .pkt_scan = sd_pkt_scan,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* -- module initialisation -- */
index de0b66c4b56e708f8e4059007b201466bd5fa529..2a68220d1adabff8fc6ae7ccb273016d172f4eb0 100644 (file)
@@ -4,7 +4,9 @@
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
  *
- * Separated from Pixart PAC7311 library by Márton Németh <nm127@freemail.hu>
+ * Separated from Pixart PAC7311 library by Márton Németh
+ * Camera button input handling by Márton Németh <nm127@freemail.hu>
+ * Copyright (C) 2009-2010 Márton Németh <nm127@freemail.hu>
  *
  * 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
  */
 
 /* Some documentation about various registers as determined by trial and error.
-   When the register addresses differ between the 7202 and the 7311 the 2
-   different addresses are written as 7302addr/7311addr, when one of the 2
-   addresses is a - sign that register description is not valid for the
-   matching IC.
 
    Register page 1:
 
    Address     Description
-   -/0x08      Unknown compressor related, must always be 8 except when not
-               in 640x480 resolution and page 4 reg 2 <= 3 then set it to 9 !
-   -/0x1b      Auto white balance related, bit 0 is AWB enable (inverted)
-               bits 345 seem to toggle per color gains on/off (inverted)
    0x78                Global control, bit 6 controls the LED (inverted)
-   -/0x80      JPEG compression ratio ? Best not touched
 
-   Register page 3/4:
+   Register page 3:
 
    Address     Description
-   0x02                Clock divider 2-63, fps =~ 60 / val. Must be a multiple of 3 on
+   0x02                Clock divider 3-63, fps = 90 / val. Must be a multiple of 3 on
                the 7302, so one of 3, 6, 9, ..., except when between 6 and 12?
-   -/0x0f      Master gain 1-245, low value = high gain
-   0x10/-      Master gain 0-31
-   -/0x10      Another gain 0-15, limited influence (1-2x gain I guess)
+   0x03                Variable framerate ctrl reg2==3: 0 -> ~30 fps, 255 -> ~22fps
+   0x04                Another var framerate ctrl reg2==3, reg3==0: 0 -> ~30 fps,
+               63 -> ~27 fps, the 2 msb's must always be 1 !!
+   0x05                Another var framerate ctrl reg2==3, reg3==0, reg4==0xc0:
+               1 -> ~30 fps, 2 -> ~20 fps
+   0x0e                Exposure bits 0-7, 0-448, 0 = use full frame time
+   0x0f                Exposure bit 8, 0-448, 448 = no exposure at all
+   0x10                Master gain 0-31
    0x21                Bitfield: 0-1 unused, 2-3 vflip/hflip, 4-5 unknown, 6-7 unused
-   -/0x27      Seems to toggle various gains on / off, Setting bit 7 seems to
-               completely disable the analog amplification block. Set to 0x68
-               for max gain, 0x14 for minimal gain.
 
    The registers are accessed in the following functions:
 
@@ -68,6 +63,7 @@
 
 #define MODULE_NAME "pac7302"
 
+#include <linux/input.h>
 #include <media/v4l2-chip-ident.h>
 #include "gspca.h"
 
@@ -86,8 +82,8 @@ struct sd {
        unsigned char red_balance;
        unsigned char blue_balance;
        unsigned char gain;
-       unsigned char exposure;
        unsigned char autogain;
+       unsigned short exposure;
        __u8 hflip;
        __u8 vflip;
        u8 flags;
@@ -124,8 +120,7 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
-/* This control is pac7302 only */
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -141,7 +136,6 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setbrightness,
            .get = sd_getbrightness,
        },
-/* This control is for both the 7302 and the 7311 */
        {
            {
                .id      = V4L2_CID_CONTRAST,
@@ -157,7 +151,6 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setcontrast,
            .get = sd_getcontrast,
        },
-/* This control is pac7302 only */
        {
            {
                .id      = V4L2_CID_SATURATION,
@@ -215,7 +208,6 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setbluebalance,
            .get = sd_getbluebalance,
        },
-/* All controls below are for both the 7302 and the 7311 */
        {
            {
                .id      = V4L2_CID_GAIN,
@@ -238,11 +230,10 @@ static struct ctrl sd_ctrls[] = {
                .type    = V4L2_CTRL_TYPE_INTEGER,
                .name    = "Exposure",
                .minimum = 0,
-#define EXPOSURE_MAX 255
-               .maximum = EXPOSURE_MAX,
+               .maximum = 1023,
                .step    = 1,
-#define EXPOSURE_DEF  16 /*  32 ms / 30 fps */
-#define EXPOSURE_KNEE 50 /* 100 ms / 10 fps */
+#define EXPOSURE_DEF  66  /*  33 ms / 30 fps */
+#define EXPOSURE_KNEE 133 /*  66 ms / 15 fps */
                .default_value = EXPOSURE_DEF,
            },
            .set = sd_setexposure,
@@ -301,7 +292,6 @@ static const struct v4l2_pix_format vga_mode[] = {
 };
 
 #define LOAD_PAGE3             255
-#define LOAD_PAGE4             254
 #define END_OF_SEQUENCE                0
 
 /* pac 7302 */
@@ -379,7 +369,7 @@ static const __u8 start_7302[] = {
 #define SKIP           0xaa
 /* page 3 - the value SKIP says skip the index - see reg_w_page() */
 static const __u8 page3_7302[] = {
-       0x90, 0x40, 0x03, 0x50, 0xc2, 0x01, 0x14, 0x16,
+       0x90, 0x40, 0x03, 0x00, 0xc0, 0x01, 0x14, 0x16,
        0x14, 0x12, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00,
        0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x47, 0x01, 0xb3, 0x01, 0x00,
@@ -388,7 +378,7 @@ static const __u8 page3_7302[] = {
        0xa4, 0xb8, 0xe0, 0x2a, 0xf6, 0x00, 0x00, 0x00,
        0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0xfc, 0x00, 0xf2, 0x1f, 0x04, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0xc0, 0xc0, 0x10, 0x00, 0x00,
+       SKIP, 0x00, 0x00, 0xc0, 0xc0, 0x10, 0x00, 0x00,
        0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x40, 0xff, 0x03, 0x19, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -401,12 +391,14 @@ static const __u8 page3_7302[] = {
        0x00
 };
 
-static int reg_w_buf(struct gspca_dev *gspca_dev,
+static void reg_w_buf(struct gspca_dev *gspca_dev,
                  __u8 index,
                  const char *buffer, int len)
 {
        int ret;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        memcpy(gspca_dev->usb_buf, buffer, len);
        ret = usb_control_msg(gspca_dev->dev,
                        usb_sndctrlpipe(gspca_dev->dev, 0),
@@ -415,20 +407,23 @@ static int reg_w_buf(struct gspca_dev *gspca_dev,
                        0,              /* value */
                        index, gspca_dev->usb_buf, len,
                        500);
-       if (ret < 0)
+       if (ret < 0) {
                PDEBUG(D_ERR, "reg_w_buf(): "
                "Failed to write registers to index 0x%x, error %i",
                index, ret);
-       return ret;
+               gspca_dev->usb_err = ret;
+       }
 }
 
 
-static int reg_w(struct gspca_dev *gspca_dev,
+static void reg_w(struct gspca_dev *gspca_dev,
                  __u8 index,
                  __u8 value)
 {
        int ret;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        gspca_dev->usb_buf[0] = value;
        ret = usb_control_msg(gspca_dev->dev,
                        usb_sndctrlpipe(gspca_dev->dev, 0),
@@ -436,32 +431,32 @@ static int reg_w(struct gspca_dev *gspca_dev,
                        USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                        0, index, gspca_dev->usb_buf, 1,
                        500);
-       if (ret < 0)
+       if (ret < 0) {
                PDEBUG(D_ERR, "reg_w(): "
                "Failed to write register to index 0x%x, value 0x%x, error %i",
                index, value, ret);
-       return ret;
+               gspca_dev->usb_err = ret;
+       }
 }
 
-static int reg_w_seq(struct gspca_dev *gspca_dev,
+static void reg_w_seq(struct gspca_dev *gspca_dev,
                const __u8 *seq, int len)
 {
-       int ret = 0;
        while (--len >= 0) {
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, seq[0], seq[1]);
+               reg_w(gspca_dev, seq[0], seq[1]);
                seq += 2;
        }
-       return ret;
 }
 
 /* load the beginning of a page */
-static int reg_w_page(struct gspca_dev *gspca_dev,
+static void reg_w_page(struct gspca_dev *gspca_dev,
                        const __u8 *page, int len)
 {
        int index;
        int ret = 0;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        for (index = 0; index < len; index++) {
                if (page[index] == SKIP)                /* skip this index */
                        continue;
@@ -477,56 +472,47 @@ static int reg_w_page(struct gspca_dev *gspca_dev,
                        "Failed to write register to index 0x%x, "
                        "value 0x%x, error %i",
                        index, page[index], ret);
+                       gspca_dev->usb_err = ret;
                        break;
                }
        }
-       return ret;
 }
 
 /* output a variable sequence */
-static int reg_w_var(struct gspca_dev *gspca_dev,
+static void reg_w_var(struct gspca_dev *gspca_dev,
                        const __u8 *seq,
-                       const __u8 *page3, unsigned int page3_len,
-                       const __u8 *page4, unsigned int page4_len)
+                       const __u8 *page3, unsigned int page3_len)
 {
        int index, len;
-       int ret = 0;
 
        for (;;) {
                index = *seq++;
                len = *seq++;
                switch (len) {
                case END_OF_SEQUENCE:
-                       return ret;
-               case LOAD_PAGE4:
-                       ret = reg_w_page(gspca_dev, page4, page4_len);
-                       break;
+                       return;
                case LOAD_PAGE3:
-                       ret = reg_w_page(gspca_dev, page3, page3_len);
+                       reg_w_page(gspca_dev, page3, page3_len);
                        break;
                default:
                        if (len > USB_BUF_SZ) {
                                PDEBUG(D_ERR|D_STREAM,
                                        "Incorrect variable sequence");
-                               return -EINVAL;
+                               return;
                        }
                        while (len > 0) {
                                if (len < 8) {
-                                       ret = reg_w_buf(gspca_dev,
+                                       reg_w_buf(gspca_dev,
                                                index, seq, len);
-                                       if (ret < 0)
-                                               return ret;
                                        seq += len;
                                        break;
                                }
-                               ret = reg_w_buf(gspca_dev, index, seq, 8);
+                               reg_w_buf(gspca_dev, index, seq, 8);
                                seq += 8;
                                index += 8;
                                len -= 8;
                        }
                }
-               if (ret < 0)
-                       return ret;
        }
        /* not reached */
 }
@@ -560,11 +546,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
 }
 
 /* This function is used by pac7302 only */
-static int setbrightcont(struct gspca_dev *gspca_dev)
+static void setbrightcont(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int i, v;
-       int ret;
        static const __u8 max[10] =
                {0x29, 0x33, 0x42, 0x5a, 0x6e, 0x80, 0x9f, 0xbb,
                 0xd4, 0xec};
@@ -572,7 +557,7 @@ static int setbrightcont(struct gspca_dev *gspca_dev)
                {0x35, 0x33, 0x33, 0x2f, 0x2a, 0x25, 0x1e, 0x17,
                 0x11, 0x0b};
 
-       ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
+       reg_w(gspca_dev, 0xff, 0x00);           /* page 0 */
        for (i = 0; i < 10; i++) {
                v = max[i];
                v += (sd->brightness - BRIGHTNESS_MAX)
@@ -582,136 +567,121 @@ static int setbrightcont(struct gspca_dev *gspca_dev)
                        v = 0;
                else if (v > 0xff)
                        v = 0xff;
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0xa2 + i, v);
+               reg_w(gspca_dev, 0xa2 + i, v);
        }
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xdc, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0xdc, 0x01);
 }
 
 /* This function is used by pac7302 only */
-static int setcolors(struct gspca_dev *gspca_dev)
+static void setcolors(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int i, v;
-       int ret;
        static const int a[9] =
                {217, -212, 0, -101, 170, -67, -38, -315, 355};
        static const int b[9] =
                {19, 106, 0, 19, 106, 1, 19, 106, 1};
 
-       ret = reg_w(gspca_dev, 0xff, 0x03);     /* page 3 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
+       reg_w(gspca_dev, 0xff, 0x03);                   /* page 3 */
+       reg_w(gspca_dev, 0x11, 0x01);
+       reg_w(gspca_dev, 0xff, 0x00);                   /* page 0 */
        for (i = 0; i < 9; i++) {
                v = a[i] * sd->colors / COLOR_MAX + b[i];
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x0f + 2 * i, (v >> 8) & 0x07);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x0f + 2 * i + 1, v);
+               reg_w(gspca_dev, 0x0f + 2 * i, (v >> 8) & 0x07);
+               reg_w(gspca_dev, 0x0f + 2 * i + 1, v);
        }
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xdc, 0x01);
+       reg_w(gspca_dev, 0xdc, 0x01);
        PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors);
-       return ret;
 }
 
-static int setwhitebalance(struct gspca_dev *gspca_dev)
+static void setwhitebalance(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xc6, sd->white_balance);
+       reg_w(gspca_dev, 0xff, 0x00);           /* page 0 */
+       reg_w(gspca_dev, 0xc6, sd->white_balance);
 
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xdc, 0x01);
+       reg_w(gspca_dev, 0xdc, 0x01);
        PDEBUG(D_CONF|D_STREAM, "white_balance: %i", sd->white_balance);
-       return ret;
 }
 
-static int setredbalance(struct gspca_dev *gspca_dev)
+static void setredbalance(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xc5, sd->red_balance);
+       reg_w(gspca_dev, 0xff, 0x00);           /* page 0 */
+       reg_w(gspca_dev, 0xc5, sd->red_balance);
 
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xdc, 0x01);
+       reg_w(gspca_dev, 0xdc, 0x01);
        PDEBUG(D_CONF|D_STREAM, "red_balance: %i", sd->red_balance);
-       return ret;
 }
 
-static int setbluebalance(struct gspca_dev *gspca_dev)
+static void setbluebalance(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xc7, sd->blue_balance);
+       reg_w(gspca_dev, 0xff, 0x00);                   /* page 0 */
+       reg_w(gspca_dev, 0xc7, sd->blue_balance);
 
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xdc, 0x01);
+       reg_w(gspca_dev, 0xdc, 0x01);
        PDEBUG(D_CONF|D_STREAM, "blue_balance: %i", sd->blue_balance);
-       return ret;
 }
 
-static int setgain(struct gspca_dev *gspca_dev)
+static void setgain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = reg_w(gspca_dev, 0xff, 0x03);             /* page 3 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x10, sd->gain >> 3);
+       reg_w(gspca_dev, 0xff, 0x03);                   /* page 3 */
+       reg_w(gspca_dev, 0x10, sd->gain >> 3);
 
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
-static int setexposure(struct gspca_dev *gspca_dev)
+static void setexposure(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
-       __u8 reg;
-
-       /* register 2 of frame 3/4 contains the clock divider configuring the
-          no fps according to the formula: 60 / reg. sd->exposure is the
-          desired exposure time in ms. */
-       reg = 120 * sd->exposure / 1000;
-       if (reg < 2)
-               reg = 2;
-       else if (reg > 63)
-               reg = 63;
-
-       /* On the pac7302 reg2 MUST be a multiple of 3, so round it to
-          the nearest multiple of 3, except when between 6 and 12? */
-       if (reg < 6 || reg > 12)
-               reg = ((reg + 1) / 3) * 3;
-       ret = reg_w(gspca_dev, 0xff, 0x03);             /* page 3 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x02, reg);
+       __u8 clockdiv;
+       __u16 exposure;
+
+       /* register 2 of frame 3 contains the clock divider configuring the
+          no fps according to the formula: 90 / reg. sd->exposure is the
+          desired exposure time in 0.5 ms. */
+       clockdiv = (90 * sd->exposure + 1999) / 2000;
+
+       /* Note clockdiv = 3 also works, but when running at 30 fps, depending
+          on the scene being recorded, the camera switches to another
+          quantization table for certain JPEG blocks, and we don't know how
+          to decompress these blocks. So we cap the framerate at 15 fps */
+       if (clockdiv < 6)
+               clockdiv = 6;
+       else if (clockdiv > 63)
+               clockdiv = 63;
+
+       /* reg2 MUST be a multiple of 3, except when between 6 and 12?
+          Always round up, otherwise we cannot get the desired frametime
+          using the partial frame time exposure control */
+       if (clockdiv < 6 || clockdiv > 12)
+               clockdiv = ((clockdiv + 2) / 3) * 3;
+
+       /* frame exposure time in ms = 1000 * clockdiv / 90    ->
+       exposure = (sd->exposure / 2) * 448 / (1000 * clockdiv / 90) */
+       exposure = (sd->exposure * 45 * 448) / (1000 * clockdiv);
+       /* 0 = use full frametime, 448 = no exposure, reverse it */
+       exposure = 448 - exposure;
+
+       reg_w(gspca_dev, 0xff, 0x03);                   /* page 3 */
+       reg_w(gspca_dev, 0x02, clockdiv);
+       reg_w(gspca_dev, 0x0e, exposure & 0xff);
+       reg_w(gspca_dev, 0x0f, exposure >> 8);
 
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
-static int sethvflip(struct gspca_dev *gspca_dev)
+static void sethvflip(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
        u8 data, hflip, vflip;
 
        hflip = sd->hflip;
@@ -721,48 +691,37 @@ static int sethvflip(struct gspca_dev *gspca_dev)
        if (sd->flags & FL_VFLIP)
                vflip = !vflip;
 
-       ret = reg_w(gspca_dev, 0xff, 0x03);             /* page 3 */
+       reg_w(gspca_dev, 0xff, 0x03);                   /* page 3 */
        data = (hflip ? 0x08 : 0x00) | (vflip ? 0x04 : 0x00);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x21, data);
+       reg_w(gspca_dev, 0x21, data);
+
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
 /* this function is called at probe and resume time for pac7302 */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
-       return reg_w_seq(gspca_dev, init_7302, sizeof(init_7302)/2);
+       reg_w_seq(gspca_dev, init_7302, sizeof(init_7302)/2);
+       return gspca_dev->usb_err;
 }
 
 static int sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret = 0;
 
        sd->sof_read = 0;
 
-       ret = reg_w_var(gspca_dev, start_7302,
-               page3_7302, sizeof(page3_7302),
-               NULL, 0);
-       if (0 <= ret)
-               ret = setbrightcont(gspca_dev);
-       if (0 <= ret)
-               ret = setcolors(gspca_dev);
-       if (0 <= ret)
-               ret = setwhitebalance(gspca_dev);
-       if (0 <= ret)
-               ret = setredbalance(gspca_dev);
-       if (0 <= ret)
-               ret = setbluebalance(gspca_dev);
-       if (0 <= ret)
-               ret = setgain(gspca_dev);
-       if (0 <= ret)
-               ret = setexposure(gspca_dev);
-       if (0 <= ret)
-               ret = sethvflip(gspca_dev);
+       reg_w_var(gspca_dev, start_7302,
+               page3_7302, sizeof(page3_7302));
+       setbrightcont(gspca_dev);
+       setcolors(gspca_dev);
+       setwhitebalance(gspca_dev);
+       setredbalance(gspca_dev);
+       setbluebalance(gspca_dev);
+       setgain(gspca_dev);
+       setexposure(gspca_dev);
+       sethvflip(gspca_dev);
 
        /* only resolution 640x480 is supported for pac7302 */
 
@@ -771,34 +730,27 @@ static int sd_start(struct gspca_dev *gspca_dev)
        atomic_set(&sd->avg_lum, -1);
 
        /* start stream */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xff, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x01);
+       reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0x78, 0x01);
 
-       return ret;
+       return gspca_dev->usb_err;
 }
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-       int ret;
 
        /* stop stream */
-       ret = reg_w(gspca_dev, 0xff, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x00);
+       reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0x78, 0x00);
 }
 
 /* called on streamoff with alt 0 and on disconnect for pac7302 */
 static void sd_stop0(struct gspca_dev *gspca_dev)
 {
-       int ret;
-
        if (!gspca_dev->present)
                return;
-       ret = reg_w(gspca_dev, 0xff, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x40);
+       reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0x78, 0x40);
 }
 
 /* Include pac common sof detection functions */
@@ -808,22 +760,13 @@ static void do_autogain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int avg_lum = atomic_read(&sd->avg_lum);
-       int desired_lum, deadzone;
+       int desired_lum;
+       const int deadzone = 30;
 
        if (avg_lum == -1)
                return;
 
-       desired_lum = 270 + sd->brightness * 4;
-       /* Hack hack, with the 7202 the first exposure step is
-          pretty large, so if we're about to make the first
-          exposure increase make the deadzone large to avoid
-          oscilating */
-       if (desired_lum > avg_lum && sd->gain == GAIN_DEF &&
-                       sd->exposure > EXPOSURE_DEF &&
-                       sd->exposure < 42)
-               deadzone = 90;
-       else
-               deadzone = 30;
+       desired_lum = 270 + sd->brightness;
 
        if (sd->autogain_ignore_frames > 0)
                sd->autogain_ignore_frames--;
@@ -947,7 +890,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
        sd->brightness = val;
        if (gspca_dev->streaming)
                setbrightcont(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
@@ -966,7 +909,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
        if (gspca_dev->streaming) {
                setbrightcont(gspca_dev);
        }
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
@@ -984,7 +927,7 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
        sd->colors = val;
        if (gspca_dev->streaming)
                setcolors(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
@@ -998,14 +941,11 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
 static int sd_setwhitebalance(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret = 0;
 
        sd->white_balance = val;
        if (gspca_dev->streaming)
-               ret = setwhitebalance(gspca_dev);
-       if (0 <= ret)
-               ret = 0;
-       return ret;
+               setwhitebalance(gspca_dev);
+       return gspca_dev->usb_err;
 }
 
 static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1019,14 +959,11 @@ static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
 static int sd_setredbalance(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret = 0;
 
        sd->red_balance = val;
        if (gspca_dev->streaming)
-               ret = setredbalance(gspca_dev);
-       if (0 <= ret)
-               ret = 0;
-       return ret;
+               setredbalance(gspca_dev);
+       return gspca_dev->usb_err;
 }
 
 static int sd_getredbalance(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1040,14 +977,11 @@ static int sd_getredbalance(struct gspca_dev *gspca_dev, __s32 *val)
 static int sd_setbluebalance(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret = 0;
 
        sd->blue_balance = val;
        if (gspca_dev->streaming)
-               ret = setbluebalance(gspca_dev);
-       if (0 <= ret)
-               ret = 0;
-       return ret;
+               setbluebalance(gspca_dev);
+       return gspca_dev->usb_err;
 }
 
 static int sd_getbluebalance(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1065,7 +999,7 @@ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val)
        sd->gain = val;
        if (gspca_dev->streaming)
                setgain(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1083,7 +1017,7 @@ static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val)
        sd->exposure = val;
        if (gspca_dev->streaming)
                setexposure(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1114,7 +1048,7 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
                }
        }
 
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1132,7 +1066,7 @@ static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
        sd->hflip = val;
        if (gspca_dev->streaming)
                sethvflip(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1150,7 +1084,7 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
        sd->vflip = val;
        if (gspca_dev->streaming)
                sethvflip(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
@@ -1165,7 +1099,6 @@ static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
 static int sd_dbg_s_register(struct gspca_dev *gspca_dev,
                        struct v4l2_dbg_register *reg)
 {
-       int ret = -EINVAL;
        __u8 index;
        __u8 value;
 
@@ -1185,14 +1118,12 @@ static int sd_dbg_s_register(struct gspca_dev *gspca_dev,
                /* Note that there shall be no access to other page
                   by any other function between the page swith and
                   the actual register write */
-               ret = reg_w(gspca_dev, 0xff, 0x00);     /* page 0 */
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, index, value);
+               reg_w(gspca_dev, 0xff, 0x00);           /* page 0 */
+               reg_w(gspca_dev, index, value);
 
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0xdc, 0x01);
+               reg_w(gspca_dev, 0xdc, 0x01);
        }
-       return ret;
+       return gspca_dev->usb_err;
 }
 
 static int sd_chip_ident(struct gspca_dev *gspca_dev,
@@ -1210,8 +1141,39 @@ static int sd_chip_ident(struct gspca_dev *gspca_dev,
 }
 #endif
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrput packet length */
+{
+       int ret = -EINVAL;
+       u8 data0, data1;
+
+       if (len == 2) {
+               data0 = data[0];
+               data1 = data[1];
+               if ((data0 == 0x00 && data1 == 0x11) ||
+                   (data0 == 0x22 && data1 == 0x33) ||
+                   (data0 == 0x44 && data1 == 0x55) ||
+                   (data0 == 0x66 && data1 == 0x77) ||
+                   (data0 == 0x88 && data1 == 0x99) ||
+                   (data0 == 0xaa && data1 == 0xbb) ||
+                   (data0 == 0xcc && data1 == 0xdd) ||
+                   (data0 == 0xee && data1 == 0xff)) {
+                       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+                       input_sync(gspca_dev->input_dev);
+                       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+                       input_sync(gspca_dev->input_dev);
+                       ret = 0;
+               }
+       }
+
+       return ret;
+}
+#endif
+
 /* sub-driver description for pac7302 */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1226,6 +1188,9 @@ static struct sd_desc sd_desc = {
        .set_register = sd_dbg_s_register,
        .get_chip_ident = sd_chip_ident,
 #endif
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* -- module initialisation -- */
index 42cfcdfd8f4f114649d1e15be5582b52a082a15d..44fed9686729340777e9425b1ad5e10e56204651 100644 (file)
@@ -51,6 +51,7 @@
 
 #define MODULE_NAME "pac7311"
 
+#include <linux/input.h>
 #include "gspca.h"
 
 MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
@@ -88,7 +89,7 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 /* This control is for both the 7302 and the 7311 */
        {
            {
@@ -200,7 +201,6 @@ static const struct v4l2_pix_format vga_mode[] = {
                .priv = 0},
 };
 
-#define LOAD_PAGE3             255
 #define LOAD_PAGE4             254
 #define END_OF_SEQUENCE                0
 
@@ -259,12 +259,14 @@ static const __u8 page4_7311[] = {
        0x23, 0x28, 0x04, 0x11, 0x00, 0x00
 };
 
-static int reg_w_buf(struct gspca_dev *gspca_dev,
+static void reg_w_buf(struct gspca_dev *gspca_dev,
                  __u8 index,
                  const char *buffer, int len)
 {
        int ret;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        memcpy(gspca_dev->usb_buf, buffer, len);
        ret = usb_control_msg(gspca_dev->dev,
                        usb_sndctrlpipe(gspca_dev->dev, 0),
@@ -273,20 +275,23 @@ static int reg_w_buf(struct gspca_dev *gspca_dev,
                        0,              /* value */
                        index, gspca_dev->usb_buf, len,
                        500);
-       if (ret < 0)
+       if (ret < 0) {
                PDEBUG(D_ERR, "reg_w_buf(): "
                "Failed to write registers to index 0x%x, error %i",
                index, ret);
-       return ret;
+               gspca_dev->usb_err = ret;
+       }
 }
 
 
-static int reg_w(struct gspca_dev *gspca_dev,
+static void reg_w(struct gspca_dev *gspca_dev,
                  __u8 index,
                  __u8 value)
 {
        int ret;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        gspca_dev->usb_buf[0] = value;
        ret = usb_control_msg(gspca_dev->dev,
                        usb_sndctrlpipe(gspca_dev->dev, 0),
@@ -294,32 +299,32 @@ static int reg_w(struct gspca_dev *gspca_dev,
                        USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                        0, index, gspca_dev->usb_buf, 1,
                        500);
-       if (ret < 0)
+       if (ret < 0) {
                PDEBUG(D_ERR, "reg_w(): "
                "Failed to write register to index 0x%x, value 0x%x, error %i",
                index, value, ret);
-       return ret;
+               gspca_dev->usb_err = ret;
+       }
 }
 
-static int reg_w_seq(struct gspca_dev *gspca_dev,
+static void reg_w_seq(struct gspca_dev *gspca_dev,
                const __u8 *seq, int len)
 {
-       int ret = 0;
        while (--len >= 0) {
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, seq[0], seq[1]);
+               reg_w(gspca_dev, seq[0], seq[1]);
                seq += 2;
        }
-       return ret;
 }
 
 /* load the beginning of a page */
-static int reg_w_page(struct gspca_dev *gspca_dev,
+static void reg_w_page(struct gspca_dev *gspca_dev,
                        const __u8 *page, int len)
 {
        int index;
        int ret = 0;
 
+       if (gspca_dev->usb_err < 0)
+               return;
        for (index = 0; index < len; index++) {
                if (page[index] == SKIP)                /* skip this index */
                        continue;
@@ -335,56 +340,47 @@ static int reg_w_page(struct gspca_dev *gspca_dev,
                        "Failed to write register to index 0x%x, "
                        "value 0x%x, error %i",
                        index, page[index], ret);
+                       gspca_dev->usb_err = ret;
                        break;
                }
        }
-       return ret;
 }
 
 /* output a variable sequence */
-static int reg_w_var(struct gspca_dev *gspca_dev,
+static void reg_w_var(struct gspca_dev *gspca_dev,
                        const __u8 *seq,
-                       const __u8 *page3, unsigned int page3_len,
                        const __u8 *page4, unsigned int page4_len)
 {
        int index, len;
-       int ret = 0;
 
        for (;;) {
                index = *seq++;
                len = *seq++;
                switch (len) {
                case END_OF_SEQUENCE:
-                       return ret;
+                       return;
                case LOAD_PAGE4:
-                       ret = reg_w_page(gspca_dev, page4, page4_len);
-                       break;
-               case LOAD_PAGE3:
-                       ret = reg_w_page(gspca_dev, page3, page3_len);
+                       reg_w_page(gspca_dev, page4, page4_len);
                        break;
                default:
                        if (len > USB_BUF_SZ) {
                                PDEBUG(D_ERR|D_STREAM,
                                        "Incorrect variable sequence");
-                               return -EINVAL;
+                               return;
                        }
                        while (len > 0) {
                                if (len < 8) {
-                                       ret = reg_w_buf(gspca_dev,
+                                       reg_w_buf(gspca_dev,
                                                index, seq, len);
-                                       if (ret < 0)
-                                               return ret;
                                        seq += len;
                                        break;
                                }
-                               ret = reg_w_buf(gspca_dev, index, seq, 8);
+                               reg_w_buf(gspca_dev, index, seq, 8);
                                seq += 8;
                                index += 8;
                                len -= 8;
                        }
                }
-               if (ret < 0)
-                       return ret;
        }
        /* not reached */
 }
@@ -412,46 +408,36 @@ static int sd_config(struct gspca_dev *gspca_dev,
 }
 
 /* This function is used by pac7311 only */
-static int setcontrast(struct gspca_dev *gspca_dev)
+static void setcontrast(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = reg_w(gspca_dev, 0xff, 0x04);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x10, sd->contrast >> 4);
+       reg_w(gspca_dev, 0xff, 0x04);
+       reg_w(gspca_dev, 0x10, sd->contrast >> 4);
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
-static int setgain(struct gspca_dev *gspca_dev)
+static void setgain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int gain = GAIN_MAX - sd->gain;
-       int ret;
 
        if (gain < 1)
                gain = 1;
        else if (gain > 245)
                gain = 245;
-       ret = reg_w(gspca_dev, 0xff, 0x04);             /* page 4 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x0e, 0x00);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x0f, gain);
+       reg_w(gspca_dev, 0xff, 0x04);                   /* page 4 */
+       reg_w(gspca_dev, 0x0e, 0x00);
+       reg_w(gspca_dev, 0x0f, gain);
 
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
-static int setexposure(struct gspca_dev *gspca_dev)
+static void setexposure(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
        __u8 reg;
 
        /* register 2 of frame 3/4 contains the clock divider configuring the
@@ -463,94 +449,72 @@ static int setexposure(struct gspca_dev *gspca_dev)
        else if (reg > 63)
                reg = 63;
 
-       ret = reg_w(gspca_dev, 0xff, 0x04);             /* page 4 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x02, reg);
+       reg_w(gspca_dev, 0xff, 0x04);                   /* page 4 */
+       reg_w(gspca_dev, 0x02, reg);
+
        /* Page 1 register 8 must always be 0x08 except when not in
           640x480 mode and Page3/4 reg 2 <= 3 then it must be 9 */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0xff, 0x01);
        if (gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv &&
                        reg <= 3) {
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x08, 0x09);
+               reg_w(gspca_dev, 0x08, 0x09);
        } else {
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x08, 0x08);
+               reg_w(gspca_dev, 0x08, 0x08);
        }
 
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
-static int sethvflip(struct gspca_dev *gspca_dev)
+static void sethvflip(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
        __u8 data;
 
-       ret = reg_w(gspca_dev, 0xff, 0x04);             /* page 4 */
+       reg_w(gspca_dev, 0xff, 0x04);                   /* page 4 */
        data = (sd->hflip ? 0x04 : 0x00) | (sd->vflip ? 0x08 : 0x00);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x21, data);
+       reg_w(gspca_dev, 0x21, data);
+
        /* load registers to sensor (Bit 0, auto clear) */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x11, 0x01);
-       return ret;
+       reg_w(gspca_dev, 0x11, 0x01);
 }
 
 /* this function is called at probe and resume time for pac7311 */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
-       return reg_w_seq(gspca_dev, init_7311, sizeof(init_7311)/2);
+       reg_w_seq(gspca_dev, init_7311, sizeof(init_7311)/2);
+       return gspca_dev->usb_err;
 }
 
 static int sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
        sd->sof_read = 0;
 
-       ret = reg_w_var(gspca_dev, start_7311,
-               NULL, 0,
+       reg_w_var(gspca_dev, start_7311,
                page4_7311, sizeof(page4_7311));
-       if (0 <= ret)
-               ret = setcontrast(gspca_dev);
-       if (0 <= ret)
-               ret = setgain(gspca_dev);
-       if (0 <= ret)
-               ret = setexposure(gspca_dev);
-       if (0 <= ret)
-               ret = sethvflip(gspca_dev);
+       setcontrast(gspca_dev);
+       setgain(gspca_dev);
+       setexposure(gspca_dev);
+       sethvflip(gspca_dev);
 
        /* set correct resolution */
        switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
        case 2:                                 /* 160x120 pac7311 */
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0xff, 0x01);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x17, 0x20);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x87, 0x10);
+               reg_w(gspca_dev, 0xff, 0x01);
+               reg_w(gspca_dev, 0x17, 0x20);
+               reg_w(gspca_dev, 0x87, 0x10);
                break;
        case 1:                                 /* 320x240 pac7311 */
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0xff, 0x01);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x17, 0x30);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x87, 0x11);
+               reg_w(gspca_dev, 0xff, 0x01);
+               reg_w(gspca_dev, 0x17, 0x30);
+               reg_w(gspca_dev, 0x87, 0x11);
                break;
        case 0:                                 /* 640x480 */
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0xff, 0x01);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x17, 0x00);
-               if (0 <= ret)
-                       ret = reg_w(gspca_dev, 0x87, 0x12);
+               reg_w(gspca_dev, 0xff, 0x01);
+               reg_w(gspca_dev, 0x17, 0x00);
+               reg_w(gspca_dev, 0x87, 0x12);
                break;
        }
 
@@ -559,37 +523,24 @@ static int sd_start(struct gspca_dev *gspca_dev)
        atomic_set(&sd->avg_lum, -1);
 
        /* start stream */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xff, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x05);
+       reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0x78, 0x05);
 
-       return ret;
+       return gspca_dev->usb_err;
 }
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-       int ret;
-
-       ret = reg_w(gspca_dev, 0xff, 0x04);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x27, 0x80);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x28, 0xca);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x29, 0x53);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x2a, 0x0e);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0xff, 0x01);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x3e, 0x20);
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
-       if (0 <= ret)
-               ret = reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
+       reg_w(gspca_dev, 0xff, 0x04);
+       reg_w(gspca_dev, 0x27, 0x80);
+       reg_w(gspca_dev, 0x28, 0xca);
+       reg_w(gspca_dev, 0x29, 0x53);
+       reg_w(gspca_dev, 0x2a, 0x0e);
+       reg_w(gspca_dev, 0xff, 0x01);
+       reg_w(gspca_dev, 0x3e, 0x20);
+       reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
+       reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
+       reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */
 }
 
 /* called on streamoff with alt 0 and on disconnect for 7311 */
@@ -734,7 +685,7 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
        if (gspca_dev->streaming) {
                setcontrast(gspca_dev);
        }
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
@@ -752,7 +703,7 @@ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val)
        sd->gain = val;
        if (gspca_dev->streaming)
                setgain(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val)
@@ -770,7 +721,7 @@ static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val)
        sd->exposure = val;
        if (gspca_dev->streaming)
                setexposure(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val)
@@ -801,7 +752,7 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
                }
        }
 
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
@@ -819,7 +770,7 @@ static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
        sd->hflip = val;
        if (gspca_dev->streaming)
                sethvflip(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
@@ -837,7 +788,7 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
        sd->vflip = val;
        if (gspca_dev->streaming)
                sethvflip(gspca_dev);
-       return 0;
+       return gspca_dev->usb_err;
 }
 
 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
@@ -848,8 +799,39 @@ static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrupt packet length */
+{
+       int ret = -EINVAL;
+       u8 data0, data1;
+
+       if (len == 2) {
+               data0 = data[0];
+               data1 = data[1];
+               if ((data0 == 0x00 && data1 == 0x11) ||
+                   (data0 == 0x22 && data1 == 0x33) ||
+                   (data0 == 0x44 && data1 == 0x55) ||
+                   (data0 == 0x66 && data1 == 0x77) ||
+                   (data0 == 0x88 && data1 == 0x99) ||
+                   (data0 == 0xaa && data1 == 0xbb) ||
+                   (data0 == 0xcc && data1 == 0xdd) ||
+                   (data0 == 0xee && data1 == 0xff)) {
+                       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+                       input_sync(gspca_dev->input_dev);
+                       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+                       input_sync(gspca_dev->input_dev);
+                       ret = 0;
+               }
+       }
+
+       return ret;
+}
+#endif
+
 /* sub-driver description for pac7311 */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
@@ -860,6 +842,9 @@ static struct sd_desc sd_desc = {
        .stop0 = sd_stop0,
        .pkt_scan = sd_pkt_scan,
        .dq_callback = do_autogain,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* -- module initialisation -- */
index 20f67d9b8c06ed9eefa9fd4cf5089fb8502a7108..8462a7c1a338496365b3e26c1783f178d4885b98 100644 (file)
  */
 
 /* We calculate the autogain at the end of the transfer of a frame, at this
-   moment a frame with the old settings is being transmitted, and a frame is
-   being captured with the old settings. So if we adjust the autogain we must
-   ignore atleast the 2 next frames for the new settings to come into effect
-   before doing any other adjustments */
-#define PAC_AUTOGAIN_IGNORE_FRAMES     3
+   moment a frame with the old settings is being captured and transmitted. So
+   if we adjust the gain or exposure we must ignore atleast the next frame for
+   the new settings to come into effect before doing any other adjustments. */
+#define PAC_AUTOGAIN_IGNORE_FRAMES     2
 
 static const unsigned char pac_sof_marker[5] =
                { 0xff, 0xff, 0x00, 0xff, 0x96 };
diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c
new file mode 100644 (file)
index 0000000..dda5fd4
--- /dev/null
@@ -0,0 +1,757 @@
+/*
+ * SN9C2028 library
+ *
+ * Copyright (C) 2009 Theodore Kilgore <kilgota@auburn.edu>
+ *
+ * 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
+ * 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
+ */
+
+#define MODULE_NAME "sn9c2028"
+
+#include "gspca.h"
+
+MODULE_AUTHOR("Theodore Kilgore");
+MODULE_DESCRIPTION("Sonix SN9C2028 USB Camera Driver");
+MODULE_LICENSE("GPL");
+
+/* specific webcam descriptor */
+struct sd {
+       struct gspca_dev gspca_dev;  /* !! must be the first item */
+       u8 sof_read;
+       u16 model;
+};
+
+struct init_command {
+       unsigned char instruction[6];
+       unsigned char to_read; /* length to read. 0 means no reply requested */
+};
+
+/* V4L2 controls supported by the driver */
+static struct ctrl sd_ctrls[] = {
+};
+
+/* How to change the resolution of any of the VGA cams is unknown */
+static const struct v4l2_pix_format vga_mode[] = {
+       {640, 480, V4L2_PIX_FMT_SN9C2028, V4L2_FIELD_NONE,
+               .bytesperline = 640,
+               .sizeimage = 640 * 480 * 3 / 4,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 0},
+};
+
+/* No way to change the resolution of the CIF cams is known */
+static const struct v4l2_pix_format cif_mode[] = {
+       {352, 288, V4L2_PIX_FMT_SN9C2028, V4L2_FIELD_NONE,
+               .bytesperline = 352,
+               .sizeimage = 352 * 288 * 3 / 4,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 0},
+};
+
+/* the bytes to write are in gspca_dev->usb_buf */
+static int sn9c2028_command(struct gspca_dev *gspca_dev, u8 *command)
+{
+       int rc;
+
+       PDEBUG(D_USBO, "sending command %02x%02x%02x%02x%02x%02x", command[0],
+              command[1], command[2], command[3], command[4], command[5]);
+
+       memcpy(gspca_dev->usb_buf, command, 6);
+       rc = usb_control_msg(gspca_dev->dev,
+                       usb_sndctrlpipe(gspca_dev->dev, 0),
+                       USB_REQ_GET_CONFIGURATION,
+                       USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+                       2, 0, gspca_dev->usb_buf, 6, 500);
+       if (rc < 0) {
+               PDEBUG(D_ERR, "command write [%02x] error %d",
+                               gspca_dev->usb_buf[0], rc);
+               return rc;
+       }
+
+       return 0;
+}
+
+static int sn9c2028_read1(struct gspca_dev *gspca_dev)
+{
+       int rc;
+
+       rc = usb_control_msg(gspca_dev->dev,
+                       usb_rcvctrlpipe(gspca_dev->dev, 0),
+                       USB_REQ_GET_STATUS,
+                       USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+                       1, 0, gspca_dev->usb_buf, 1, 500);
+       if (rc != 1) {
+               PDEBUG(D_ERR, "read1 error %d", rc);
+               return (rc < 0) ? rc : -EIO;
+       }
+       PDEBUG(D_USBI, "read1 response %02x", gspca_dev->usb_buf[0]);
+       return gspca_dev->usb_buf[0];
+}
+
+static int sn9c2028_read4(struct gspca_dev *gspca_dev, u8 *reading)
+{
+       int rc;
+       rc = usb_control_msg(gspca_dev->dev,
+                       usb_rcvctrlpipe(gspca_dev->dev, 0),
+                       USB_REQ_GET_STATUS,
+                       USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+                       4, 0, gspca_dev->usb_buf, 4, 500);
+       if (rc != 4) {
+               PDEBUG(D_ERR, "read4 error %d", rc);
+               return (rc < 0) ? rc : -EIO;
+       }
+       memcpy(reading, gspca_dev->usb_buf, 4);
+       PDEBUG(D_USBI, "read4 response %02x%02x%02x%02x", reading[0],
+              reading[1], reading[2], reading[3]);
+       return rc;
+}
+
+static int sn9c2028_long_command(struct gspca_dev *gspca_dev, u8 *command)
+{
+       int i, status;
+       __u8 reading[4];
+
+       status = sn9c2028_command(gspca_dev, command);
+       if (status < 0)
+               return status;
+
+       status = -1;
+       for (i = 0; i < 256 && status < 2; i++)
+               status = sn9c2028_read1(gspca_dev);
+       if (status != 2) {
+               PDEBUG(D_ERR, "long command status read error %d", status);
+               return (status < 0) ? status : -EIO;
+       }
+
+       memset(reading, 0, 4);
+       status = sn9c2028_read4(gspca_dev, reading);
+       if (status < 0)
+               return status;
+
+       /* in general, the first byte of the response is the first byte of
+        * the command, or'ed with 8 */
+       status = sn9c2028_read1(gspca_dev);
+       if (status < 0)
+               return status;
+
+       return 0;
+}
+
+static int sn9c2028_short_command(struct gspca_dev *gspca_dev, u8 *command)
+{
+       int err_code;
+
+       err_code = sn9c2028_command(gspca_dev, command);
+       if (err_code < 0)
+               return err_code;
+
+       err_code = sn9c2028_read1(gspca_dev);
+       if (err_code < 0)
+               return err_code;
+
+       return 0;
+}
+
+/* this function is called at probe time */
+static int sd_config(struct gspca_dev *gspca_dev,
+                    const struct usb_device_id *id)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       struct cam *cam = &gspca_dev->cam;
+
+       PDEBUG(D_PROBE, "SN9C2028 camera detected (vid/pid 0x%04X:0x%04X)",
+              id->idVendor, id->idProduct);
+
+       sd->model = id->idProduct;
+
+       switch (sd->model) {
+       case 0x7005:
+               PDEBUG(D_PROBE, "Genius Smart 300 camera");
+               break;
+       case 0x8000:
+               PDEBUG(D_PROBE, "DC31VC");
+               break;
+       case 0x8001:
+               PDEBUG(D_PROBE, "Spy camera");
+               break;
+       case 0x8003:
+               PDEBUG(D_PROBE, "CIF camera");
+               break;
+       case 0x8008:
+               PDEBUG(D_PROBE, "Mini-Shotz ms-350 camera");
+               break;
+       case 0x800a:
+               PDEBUG(D_PROBE, "Vivitar 3350b type camera");
+               cam->input_flags = V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP;
+               break;
+       }
+
+       switch (sd->model) {
+       case 0x8000:
+       case 0x8001:
+       case 0x8003:
+               cam->cam_mode = cif_mode;
+               cam->nmodes = ARRAY_SIZE(cif_mode);
+               break;
+       default:
+               cam->cam_mode = vga_mode;
+               cam->nmodes = ARRAY_SIZE(vga_mode);
+       }
+       return 0;
+}
+
+/* this function is called at probe and resume time */
+static int sd_init(struct gspca_dev *gspca_dev)
+{
+       int status = -1;
+
+       sn9c2028_read1(gspca_dev);
+       sn9c2028_read1(gspca_dev);
+       status = sn9c2028_read1(gspca_dev);
+
+       return (status < 0) ? status : 0;
+}
+
+static int run_start_commands(struct gspca_dev *gspca_dev,
+                             struct init_command *cam_commands, int n)
+{
+       int i, err_code = -1;
+
+       for (i = 0; i < n; i++) {
+               switch (cam_commands[i].to_read) {
+               case 4:
+                       err_code = sn9c2028_long_command(gspca_dev,
+                                       cam_commands[i].instruction);
+                       break;
+               case 1:
+                       err_code = sn9c2028_short_command(gspca_dev,
+                                       cam_commands[i].instruction);
+                       break;
+               case 0:
+                       err_code = sn9c2028_command(gspca_dev,
+                                       cam_commands[i].instruction);
+                       break;
+               }
+               if (err_code < 0)
+                       return err_code;
+       }
+       return 0;
+}
+
+static int start_spy_cam(struct gspca_dev *gspca_dev)
+{
+       struct init_command spy_start_commands[] = {
+               {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x22, 0x01, 0x04, 0x00, 0x00}, 4},
+               {{0x13, 0x23, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4}, /* width  352 */
+               {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4}, /* height 288 */
+               /* {{0x13, 0x27, 0x01, 0x28, 0x00, 0x00}, 4}, */
+               {{0x13, 0x27, 0x01, 0x68, 0x00, 0x00}, 4},
+               {{0x13, 0x28, 0x01, 0x09, 0x00, 0x00}, 4}, /* red gain ?*/
+               /* {{0x13, 0x28, 0x01, 0x00, 0x00, 0x00}, 4}, */
+               {{0x13, 0x29, 0x01, 0x00, 0x00, 0x00}, 4},
+               /* {{0x13, 0x29, 0x01, 0x0c, 0x00, 0x00}, 4}, */
+               {{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4},
+               /* {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4}, */
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4},
+               /* {{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4}, */
+               {{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4},
+               {{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4},
+               {{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x02, 0x06, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x03, 0x13, 0x00, 0x00, 0x00}, 4}, /*don't mess with*/
+               /*{{0x11, 0x04, 0x06, 0x00, 0x00, 0x00}, 4}, observed */
+               {{0x11, 0x04, 0x00, 0x00, 0x00, 0x00}, 4}, /* brighter */
+               /*{{0x11, 0x05, 0x65, 0x00, 0x00, 0x00}, 4}, observed */
+               {{0x11, 0x05, 0x00, 0x00, 0x00, 0x00}, 4}, /* brighter */
+               {{0x11, 0x06, 0xb1, 0x00, 0x00, 0x00}, 4}, /* observed */
+               {{0x11, 0x07, 0x00, 0x00, 0x00, 0x00}, 4},
+               /*{{0x11, 0x08, 0x06, 0x00, 0x00, 0x00}, 4}, observed */
+               {{0x11, 0x08, 0x0b, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x09, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0a, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0b, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0c, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0d, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0e, 0x04, 0x00, 0x00, 0x00}, 4},
+               /* {{0x11, 0x0f, 0x00, 0x00, 0x00, 0x00}, 4}, */
+               /* brightness or gain. 0 is default. 4 is good
+                * indoors at night with incandescent lighting */
+               {{0x11, 0x0f, 0x04, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x10, 0x06, 0x00, 0x00, 0x00}, 4}, /*hstart or hoffs*/
+               {{0x11, 0x11, 0x06, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x14, 0x02, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x13, 0x01, 0x00, 0x00, 0x00}, 4},
+               /* {{0x1b, 0x02, 0x06, 0x00, 0x00, 0x00}, 1}, observed */
+               {{0x1b, 0x02, 0x11, 0x00, 0x00, 0x00}, 1}, /* brighter */
+               /* {{0x1b, 0x13, 0x01, 0x00, 0x00, 0x00}, 1}, observed */
+               {{0x1b, 0x13, 0x11, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 1}, /* compresses */
+               /* Camera should start to capture now. */
+       };
+
+       return run_start_commands(gspca_dev, spy_start_commands,
+                                 ARRAY_SIZE(spy_start_commands));
+}
+
+static int start_cif_cam(struct gspca_dev *gspca_dev)
+{
+       struct init_command cif_start_commands[] = {
+               {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               /* The entire sequence below seems redundant */
+               /* {{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x22, 0x01, 0x06, 0x00, 0x00}, 4},
+               {{0x13, 0x23, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4}, width?
+               {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4}, height?
+               {{0x13, 0x27, 0x01, 0x68, 0x00, 0x00}, 4}, subsample?
+               {{0x13, 0x28, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x29, 0x01, 0x20, 0x00, 0x00}, 4},
+               {{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
+               {{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4},
+               {{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4},*/
+               {{0x1b, 0x21, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x17, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x19, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x02, 0x06, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x03, 0x5a, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x04, 0x27, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x05, 0x01, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x12, 0x14, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x13, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x14, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x15, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x16, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x77, 0xa2, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x06, 0x0f, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x07, 0x14, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x08, 0x0f, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x09, 0x10, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x0f, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x12, 0x07, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x10, 0x1f, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x11, 0x01, 0x00, 0x00, 0x00}, 1},
+               {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 1}, /* width/8 */
+               {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 1}, /* height/8 */
+               /* {{0x13, 0x27, 0x01, 0x68, 0x00, 0x00}, 4}, subsample?
+                * {{0x13, 0x28, 0x01, 0x1e, 0x00, 0x00}, 4}, does nothing
+                * {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4}, */
+               /* {{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4},
+                * causes subsampling
+                * but not a change in the resolution setting! */
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x01, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x08, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x06, 0x00, 0x00}, 4},
+               {{0x13, 0x28, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x1b, 0x04, 0x6d, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x05, 0x03, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x36, 0x06, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x0e, 0x01, 0x00, 0x00, 0x00}, 1},
+               {{0x12, 0x27, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x1b, 0x0f, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x36, 0x05, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x10, 0x0f, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x02, 0x06, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x11, 0x01, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 1},/* use compression */
+               /* Camera should start to capture now. */
+       };
+
+       return run_start_commands(gspca_dev, cif_start_commands,
+                                 ARRAY_SIZE(cif_start_commands));
+}
+
+static int start_ms350_cam(struct gspca_dev *gspca_dev)
+{
+       struct init_command ms350_start_commands[] = {
+               {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x16, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x22, 0x01, 0x04, 0x00, 0x00}, 4},
+               {{0x13, 0x23, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4},
+               {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4},
+               {{0x13, 0x27, 0x01, 0x28, 0x00, 0x00}, 4},
+               {{0x13, 0x28, 0x01, 0x09, 0x00, 0x00}, 4},
+               {{0x13, 0x29, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
+               {{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4},
+               {{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x00, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x01, 0x70, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x02, 0x05, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x03, 0x5d, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x04, 0x07, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x05, 0x25, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x06, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x07, 0x09, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x08, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x09, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0b, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0c, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0d, 0x0c, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0e, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x0f, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x11, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x13, 0x63, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x15, 0x70, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x18, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x11, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4}, /* width  */
+               {{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4}, /* height */
+               {{0x13, 0x28, 0x01, 0x09, 0x00, 0x00}, 4}, /* vstart? */
+               {{0x13, 0x27, 0x01, 0x28, 0x00, 0x00}, 4},
+               {{0x13, 0x29, 0x01, 0x40, 0x00, 0x00}, 4}, /* hstart? */
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
+               {{0x1b, 0x02, 0x05, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x11, 0x01, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x18, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x02, 0x0a, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x11, 0x01, 0x00, 0x00, 0x00}, 0},
+               /* Camera should start to capture now. */
+       };
+
+       return run_start_commands(gspca_dev, ms350_start_commands,
+                                 ARRAY_SIZE(ms350_start_commands));
+}
+
+static int start_genius_cam(struct gspca_dev *gspca_dev)
+{
+       struct init_command genius_start_commands[] = {
+               {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x16, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4},
+               {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4},
+               /* "preliminary" width and height settings */
+               {{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4},
+               {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
+               {{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4},
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4},
+               {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x11, 0x64, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x13, 0x91, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x15, 0x20, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x16, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x17, 0x60, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x25, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x26, 0x02, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x27, 0x88, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x30, 0x38, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x31, 0x2a, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x32, 0x2a, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x33, 0x2a, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x34, 0x02, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x5b, 0x0a, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4}, /* real width */
+               {{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4}, /* real height */
+               {{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4},
+               {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
+               {{0x13, 0x29, 0x01, 0x62, 0x00, 0x00}, 4},
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
+               {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x21, 0x2a, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x23, 0x28, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x11, 0x04, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x13, 0x03, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x15, 0xe0, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x16, 0x02, 0x00, 0x00, 0x00}, 4},
+               {{0x11, 0x17, 0x80, 0x00, 0x00, 0x00}, 4},
+               {{0x1c, 0x20, 0x00, 0x2a, 0x00, 0x00}, 1},
+               {{0x1c, 0x20, 0x00, 0x2a, 0x00, 0x00}, 1},
+               {{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 0}
+               /* Camera should start to capture now. */
+       };
+
+       return run_start_commands(gspca_dev, genius_start_commands,
+                                 ARRAY_SIZE(genius_start_commands));
+}
+
+static int start_vivitar_cam(struct gspca_dev *gspca_dev)
+{
+       struct init_command vivitar_start_commands[] = {
+               {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x22, 0x01, 0x01, 0x00, 0x00}, 4},
+               {{0x13, 0x23, 0x01, 0x01, 0x00, 0x00}, 4},
+               {{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4},
+               {{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4},
+               {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
+               {{0x13, 0x28, 0x01, 0x0a, 0x00, 0x00}, 4},
+               /*
+                * Above is changed from OEM 0x0b. Fixes Bayer tiling.
+                * Presumably gives a vertical shift of one row.
+                */
+               {{0x13, 0x29, 0x01, 0x20, 0x00, 0x00}, 4},
+               /* Above seems to do horizontal shift. */
+               {{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
+               {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
+               {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
+               {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
+               /* Above three commands seem to relate to brightness. */
+               {{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4},
+               {{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x1b, 0x12, 0x80, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x01, 0x77, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x02, 0x3a, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x12, 0x78, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x13, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x14, 0x80, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x15, 0x34, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x1b, 0x04, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x20, 0x44, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x23, 0xee, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x26, 0xa0, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x27, 0x9a, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x28, 0xa0, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x29, 0x30, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x2a, 0x80, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x2b, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x2f, 0x3d, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x30, 0x24, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x32, 0x86, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x60, 0xa9, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x61, 0x42, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x65, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x69, 0x38, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x6f, 0x88, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x70, 0x0b, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x71, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x74, 0x21, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x75, 0x86, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x76, 0x00, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x7d, 0xf3, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x17, 0x1c, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x18, 0xc0, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x19, 0x05, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x1a, 0xf6, 0x00, 0x00, 0x00}, 1},
+               /* {{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4},
+               {{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4},
+               {{0x13, 0x28, 0x01, 0x0b, 0x00, 0x00}, 4}, */
+               {{0x20, 0x36, 0x06, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x10, 0x26, 0x00, 0x00, 0x00}, 1},
+               {{0x12, 0x27, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x1b, 0x76, 0x03, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x36, 0x05, 0x00, 0x00, 0x00}, 1},
+               {{0x1b, 0x00, 0x3f, 0x00, 0x00, 0x00}, 1},
+               /* Above is brightness; OEM driver setting is 0x10 */
+               {{0x12, 0x27, 0x01, 0x00, 0x00, 0x00}, 4},
+               {{0x20, 0x29, 0x30, 0x00, 0x00, 0x00}, 1},
+               {{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 1}
+       };
+
+       return run_start_commands(gspca_dev, vivitar_start_commands,
+                                 ARRAY_SIZE(vivitar_start_commands));
+}
+
+static int sd_start(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int err_code;
+
+       sd->sof_read = 0;
+
+       switch (sd->model) {
+       case 0x7005:
+               err_code = start_genius_cam(gspca_dev);
+               break;
+       case 0x8001:
+               err_code = start_spy_cam(gspca_dev);
+               break;
+       case 0x8003:
+               err_code = start_cif_cam(gspca_dev);
+               break;
+       case 0x8008:
+               err_code = start_ms350_cam(gspca_dev);
+               break;
+       case 0x800a:
+               err_code = start_vivitar_cam(gspca_dev);
+               break;
+       default:
+               PDEBUG(D_ERR, "Starting unknown camera, please report this");
+               return -ENXIO;
+       }
+
+       return err_code;
+}
+
+static void sd_stopN(struct gspca_dev *gspca_dev)
+{
+       int result;
+       __u8 data[6];
+
+       result = sn9c2028_read1(gspca_dev);
+       if (result < 0)
+               PDEBUG(D_ERR, "Camera Stop read failed");
+
+       memset(data, 0, 6);
+       data[0] = 0x14;
+       result = sn9c2028_command(gspca_dev, data);
+       if (result < 0)
+               PDEBUG(D_ERR, "Camera Stop command failed");
+}
+
+/* Include sn9c2028 sof detection functions */
+#include "sn9c2028.h"
+
+static void sd_pkt_scan(struct gspca_dev *gspca_dev,
+                       __u8 *data,                     /* isoc packet */
+                       int len)                        /* iso packet length */
+{
+       unsigned char *sof;
+
+       sof = sn9c2028_find_sof(gspca_dev, data, len);
+       if (sof) {
+               int n;
+
+               /* finish decoding current frame */
+               n = sof - data;
+               if (n > sizeof sn9c2028_sof_marker)
+                       n -= sizeof sn9c2028_sof_marker;
+               else
+                       n = 0;
+               gspca_frame_add(gspca_dev, LAST_PACKET, data, n);
+               /* Start next frame. */
+               gspca_frame_add(gspca_dev, FIRST_PACKET,
+                       sn9c2028_sof_marker, sizeof sn9c2028_sof_marker);
+               len -= sof - data;
+               data = sof;
+       }
+       gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
+}
+
+/* sub-driver description */
+static const struct sd_desc sd_desc = {
+       .name = MODULE_NAME,
+       .ctrls = sd_ctrls,
+       .nctrls = ARRAY_SIZE(sd_ctrls),
+       .config = sd_config,
+       .init = sd_init,
+       .start = sd_start,
+       .stopN = sd_stopN,
+       .pkt_scan = sd_pkt_scan,
+};
+
+/* -- module initialisation -- */
+static const __devinitdata struct usb_device_id device_table[] = {
+       {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */
+       /* The Genius Smart is untested. I can't find an owner ! */
+       /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */
+       {USB_DEVICE(0x0c45, 0x8001)}, /* Wild Planet digital spy cam */
+       {USB_DEVICE(0x0c45, 0x8003)}, /* Several small CIF cameras */
+       /* {USB_DEVICE(0x0c45, 0x8006)}, Unknown VGA camera */
+       {USB_DEVICE(0x0c45, 0x8008)}, /* Mini-Shotz ms-350 */
+       {USB_DEVICE(0x0c45, 0x800a)}, /* Vivicam 3350B */
+       {}
+};
+MODULE_DEVICE_TABLE(usb, device_table);
+
+/* -- device connect -- */
+static int sd_probe(struct usb_interface *intf,
+                       const struct usb_device_id *id)
+{
+       return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
+                              THIS_MODULE);
+}
+
+static struct usb_driver sd_driver = {
+       .name = MODULE_NAME,
+       .id_table = device_table,
+       .probe = sd_probe,
+       .disconnect = gspca_disconnect,
+#ifdef CONFIG_PM
+       .suspend = gspca_suspend,
+       .resume = gspca_resume,
+#endif
+};
+
+/* -- module insert / remove -- */
+static int __init sd_mod_init(void)
+{
+       int ret;
+
+       ret = usb_register(&sd_driver);
+       if (ret < 0)
+               return ret;
+       PDEBUG(D_PROBE, "registered");
+       return 0;
+}
+
+static void __exit sd_mod_exit(void)
+{
+       usb_deregister(&sd_driver);
+       PDEBUG(D_PROBE, "deregistered");
+}
+
+module_init(sd_mod_init);
+module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sn9c2028.h b/drivers/media/video/gspca/sn9c2028.h
new file mode 100644 (file)
index 0000000..8fd1d3e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * SN9C2028 common functions
+ *
+ * Copyright (C) 2009 Theodore Kilgore <kilgota@auburn,edu>
+ *
+ * Based closely upon the file gspca/pac_common.h
+ *
+ * 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
+ *
+ */
+
+static const unsigned char sn9c2028_sof_marker[5] =
+       { 0xff, 0xff, 0x00, 0xc4, 0xc4 };
+
+static unsigned char *sn9c2028_find_sof(struct gspca_dev *gspca_dev,
+                                       unsigned char *m, int len)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int i;
+
+       /* Search for the SOF marker (fixed part) in the header */
+       for (i = 0; i < len; i++) {
+               if (m[i] == sn9c2028_sof_marker[sd->sof_read]) {
+                       sd->sof_read++;
+                       if (sd->sof_read == sizeof(sn9c2028_sof_marker)) {
+                               PDEBUG(D_FRAM,
+                                       "SOF found, bytes to analyze: %u."
+                                       " Frame starts at byte #%u",
+                                       len, i + 1);
+                               sd->sof_read = 0;
+                               return m + i + 1;
+                       }
+               } else {
+                       sd->sof_read = 0;
+               }
+       }
+
+       return NULL;
+}
index 4cff8035614f881445a0770e92310cdaed21bc78..4a1bc08f82b9a85719a007912165a3cd25648f65 100644 (file)
@@ -129,7 +129,7 @@ static int sd_getexposure(struct gspca_dev *gspca_dev, s32 *val);
 static int sd_setautoexposure(struct gspca_dev *gspca_dev, s32 val);
 static int sd_getautoexposure(struct gspca_dev *gspca_dev, s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
 #define BRIGHTNESS_IDX 0
            {
@@ -1506,36 +1506,36 @@ static int set_cmatrix(struct gspca_dev *gspca_dev)
        struct sd *sd = (struct sd *) gspca_dev;
        s32 hue_coord, hue_index = 180 + sd->hue;
        u8 cmatrix[21];
-       memset(cmatrix, 0, 21);
 
+       memset(cmatrix, 0, sizeof cmatrix);
        cmatrix[2] = (sd->contrast * 0x25 / 0x100) + 0x26;
        cmatrix[0] = 0x13 + (cmatrix[2] - 0x26) * 0x13 / 0x25;
        cmatrix[4] = 0x07 + (cmatrix[2] - 0x26) * 0x07 / 0x25;
        cmatrix[18] = sd->brightness - 0x80;
 
        hue_coord = (hsv_red_x[hue_index] * sd->saturation) >> 8;
-       cmatrix[6] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[7] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[6] = hue_coord;
+       cmatrix[7] = (hue_coord >> 8) & 0x0f;
 
        hue_coord = (hsv_red_y[hue_index] * sd->saturation) >> 8;
-       cmatrix[8] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[9] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[8] = hue_coord;
+       cmatrix[9] = (hue_coord >> 8) & 0x0f;
 
        hue_coord = (hsv_green_x[hue_index] * sd->saturation) >> 8;
-       cmatrix[10] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[11] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[10] = hue_coord;
+       cmatrix[11] = (hue_coord >> 8) & 0x0f;
 
        hue_coord = (hsv_green_y[hue_index] * sd->saturation) >> 8;
-       cmatrix[12] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[13] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[12] = hue_coord;
+       cmatrix[13] = (hue_coord >> 8) & 0x0f;
 
        hue_coord = (hsv_blue_x[hue_index] * sd->saturation) >> 8;
-       cmatrix[14] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[15] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[14] = hue_coord;
+       cmatrix[15] = (hue_coord >> 8) & 0x0f;
 
        hue_coord = (hsv_blue_y[hue_index] * sd->saturation) >> 8;
-       cmatrix[16] = (unsigned char)(hue_coord & 0xff);
-       cmatrix[17] = (unsigned char)((hue_coord >> 8) & 0x0f);
+       cmatrix[16] = hue_coord;
+       cmatrix[17] = (hue_coord >> 8) & 0x0f;
 
        return reg_w(gspca_dev, 0x10e1, cmatrix, 21);
 }
@@ -2015,6 +2015,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        default:
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
+               break;
        }
 
        sd->old_step = 0;
@@ -2319,7 +2320,7 @@ static void do_autogain(struct gspca_dev *gspca_dev, u16 avg_lum)
                }
        }
        if (avg_lum > MAX_AVG_LUM) {
-               if (sd->gain - 1 >= 0) {
+               if (sd->gain > 0) {
                        sd->gain--;
                        set_gain(gspca_dev);
                }
@@ -2347,7 +2348,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int avg_lum;
-       static unsigned char frame_header[] =
+       static u8 frame_header[] =
                {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96};
        if (len == 64 && memcmp(data, frame_header, 6) == 0) {
                avg_lum = ((data[35] >> 2) & 3) |
index ddff2b5ee5c2534462ce390ccbf18ad4ffe80c8e..785eeb4c20144573416c44f8b970198e74730ba6 100644 (file)
@@ -42,6 +42,7 @@ Reg   Use
 
 #define MODULE_NAME "sonixb"
 
+#include <linux/input.h>
 #include "gspca.h"
 
 MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -53,9 +54,11 @@ struct sd {
        struct gspca_dev gspca_dev;     /* !! must be the first item */
        atomic_t avg_lum;
        int prev_avg_lum;
+       int exp_too_low_cnt;
+       int exp_too_high_cnt;
 
+       unsigned short exposure;
        unsigned char gain;
-       unsigned char exposure;
        unsigned char brightness;
        unsigned char autogain;
        unsigned char autogain_ignore_frames;
@@ -73,8 +76,9 @@ struct sd {
 #define SENSOR_OV7630 2
 #define SENSOR_PAS106 3
 #define SENSOR_PAS202 4
-#define SENSOR_TAS5110 5
-#define SENSOR_TAS5130CXX 6
+#define SENSOR_TAS5110C 5
+#define SENSOR_TAS5110D 6
+#define SENSOR_TAS5130CXX 7
        __u8 reg11;
 };
 
@@ -95,13 +99,15 @@ struct sensor_data {
 /* sensor_data flags */
 #define F_GAIN 0x01            /* has gain */
 #define F_SIF  0x02            /* sif or vga */
+#define F_COARSE_EXPO 0x04     /* exposure control is coarse */
 
 /* priv field of struct v4l2_pix_format flags (do not use low nibble!) */
 #define MODE_RAW 0x10          /* raw bayer mode */
 #define MODE_REDUCED_SIF 0x20  /* vga mode (320x240 / 160x120) on sif cam */
 
 /* ctrl_dis helper macros */
-#define NO_EXPO ((1 << EXPOSURE_IDX) | (1 << AUTOGAIN_IDX))
+#define NO_EXPO ((1 << EXPOSURE_IDX) | (1 << COARSE_EXPOSURE_IDX) | \
+                (1 << AUTOGAIN_IDX))
 #define NO_FREQ (1 << FREQ_IDX)
 #define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX)
 
@@ -127,11 +133,10 @@ struct sensor_data {
 }
 
 /* We calculate the autogain at the end of the transfer of a frame, at this
-   moment a frame with the old settings is being transmitted, and a frame is
-   being captured with the old settings. So if we adjust the autogain we must
-   ignore atleast the 2 next frames for the new settings to come into effect
-   before doing any other adjustments */
-#define AUTOGAIN_IGNORE_FRAMES 3
+   moment a frame with the old settings is being captured and transmitted. So
+   if we adjust the gain or exposure we must ignore atleast the next frame for
+   the new settings to come into effect before doing any other adjustments. */
+#define AUTOGAIN_IGNORE_FRAMES 1
 
 /* V4L2 controls supported by the driver */
 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
@@ -145,7 +150,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define BRIGHTNESS_IDX 0
        {
            {
@@ -171,7 +176,7 @@ static struct ctrl sd_ctrls[] = {
                .maximum = 255,
                .step    = 1,
 #define GAIN_DEF 127
-#define GAIN_KNEE 200
+#define GAIN_KNEE 230
                .default_value = GAIN_DEF,
            },
            .set = sd_setgain,
@@ -183,10 +188,10 @@ static struct ctrl sd_ctrls[] = {
                        .id = V4L2_CID_EXPOSURE,
                        .type = V4L2_CTRL_TYPE_INTEGER,
                        .name = "Exposure",
-#define EXPOSURE_DEF  16 /*  32 ms / 30 fps */
-#define EXPOSURE_KNEE 50 /* 100 ms / 10 fps */
+#define EXPOSURE_DEF  66 /*  33 ms / 30 fps (except on PASXXX) */
+#define EXPOSURE_KNEE 200 /* 100 ms / 10 fps (except on PASXXX) */
                        .minimum = 0,
-                       .maximum = 255,
+                       .maximum = 1023,
                        .step = 1,
                        .default_value = EXPOSURE_DEF,
                        .flags = 0,
@@ -194,7 +199,23 @@ static struct ctrl sd_ctrls[] = {
                .set = sd_setexposure,
                .get = sd_getexposure,
        },
-#define AUTOGAIN_IDX 3
+#define COARSE_EXPOSURE_IDX 3
+       {
+               {
+                       .id = V4L2_CID_EXPOSURE,
+                       .type = V4L2_CTRL_TYPE_INTEGER,
+                       .name = "Exposure",
+#define COARSE_EXPOSURE_DEF  2 /* 30 fps */
+                       .minimum = 2,
+                       .maximum = 15,
+                       .step = 1,
+                       .default_value = COARSE_EXPOSURE_DEF,
+                       .flags = 0,
+               },
+               .set = sd_setexposure,
+               .get = sd_getexposure,
+       },
+#define AUTOGAIN_IDX 4
        {
                {
                        .id = V4L2_CID_AUTOGAIN,
@@ -210,7 +231,7 @@ static struct ctrl sd_ctrls[] = {
                .set = sd_setautogain,
                .get = sd_getautogain,
        },
-#define FREQ_IDX 4
+#define FREQ_IDX 5
        {
                {
                        .id      = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -219,7 +240,7 @@ static struct ctrl sd_ctrls[] = {
                        .minimum = 0,
                        .maximum = 2,   /* 0: 0, 1: 50Hz, 2:60Hz */
                        .step    = 1,
-#define FREQ_DEF 1
+#define FREQ_DEF 0
                        .default_value = FREQ_DEF,
                },
                .set = sd_setfreq,
@@ -345,7 +366,7 @@ static const __u8 initOv7630[] = {
 };
 static const __u8 initOv7630_3[] = {
        0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */
-       0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */
+       0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
        0x00, 0x02, 0x01, 0x0a,                         /* r11 .. r14 */
        0x28, 0x1e,                     /* H & V sizes     r15 .. r16 */
        0x68, 0x8f, MCK_INIT1,                          /* r17 .. r19 */
@@ -387,6 +408,30 @@ static const __u8 initPas106[] = {
        0x18, 0x10, 0x02, 0x02, 0x09, 0x07
 };
 /* compression 0x86 mckinit1 0x2b */
+
+/* "Known" PAS106B registers:
+  0x02 clock divider
+  0x03 Variable framerate bits 4-11
+  0x04 Var framerate bits 0-3, one must leave the 4 msb's at 0 !!
+       The variable framerate control must never be set lower then 300,
+       which sets the framerate at 90 / reg02, otherwise vsync is lost.
+  0x05 Shutter Time Line Offset, this can be used as an exposure control:
+       0 = use full frame time, 255 = no exposure at all
+       Note this may never be larger then "var-framerate control" / 2 - 2.
+       When var-framerate control is < 514, no exposure is reached at the max
+       allowed value for the framerate control value, rather then at 255.
+  0x06 Shutter Time Pixel Offset, like reg05 this influences exposure, but
+       only a very little bit, leave at 0xcd
+  0x07 offset sign bit (bit0 1 > negative offset)
+  0x08 offset
+  0x09 Blue Gain
+  0x0a Green1 Gain
+  0x0b Green2 Gain
+  0x0c Red Gain
+  0x0e Global gain
+  0x13 Write 1 to commit settings to sensor
+*/
+
 static const __u8 pas106_sensor_init[][8] = {
        /* Pixel Clock Divider 6 */
        { 0xa1, 0x40, 0x02, 0x04, 0x00, 0x00, 0x00, 0x14 },
@@ -433,37 +478,55 @@ static const __u8 initPas202[] = {
        0x44, 0x44, 0x21, 0x30, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00,
        0x00, 0x00,
        0x00, 0x00, 0x00, 0x06, 0x03, 0x0a,
-       0x28, 0x1e, 0x28, 0x89, 0x20,
+       0x28, 0x1e, 0x20, 0x89, 0x20,
        0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c
 };
+
+/* "Known" PAS202BCB registers:
+  0x02 clock divider
+  0x04 Variable framerate bits 6-11 (*)
+  0x05 Var framerate  bits 0-5, one must leave the 2 msb's at 0 !!
+  0x07 Blue Gain
+  0x08 Green Gain
+  0x09 Red Gain
+  0x0b offset sign bit (bit0 1 > negative offset)
+  0x0c offset
+  0x0e Unknown image is slightly brighter when bit 0 is 0, if reg0f is 0 too,
+       leave at 1 otherwise we get a jump in our exposure control
+  0x0f Exposure 0-255, 0 = use full frame time, 255 = no exposure at all
+  0x10 Master gain 0 - 31
+  0x11 write 1 to apply changes
+  (*) The variable framerate control must never be set lower then 500
+      which sets the framerate at 30 / reg02, otherwise vsync is lost.
+*/
 static const __u8 pas202_sensor_init[][8] = {
-       {0xa0, 0x40, 0x02, 0x03, 0x00, 0x00, 0x00, 0x10},
+       /* Set the clock divider to 4 -> 30 / 4 = 7.5 fps, we would like
+          to set it lower, but for some reason the bridge starts missing
+          vsync's then */
+       {0xa0, 0x40, 0x02, 0x04, 0x00, 0x00, 0x00, 0x10},
        {0xd0, 0x40, 0x04, 0x07, 0x34, 0x00, 0x09, 0x10},
        {0xd0, 0x40, 0x08, 0x01, 0x00, 0x00, 0x01, 0x10},
-       {0xd0, 0x40, 0x0C, 0x00, 0x0C, 0x00, 0x32, 0x10},
+       {0xd0, 0x40, 0x0C, 0x00, 0x0C, 0x01, 0x32, 0x10},
        {0xd0, 0x40, 0x10, 0x00, 0x01, 0x00, 0x63, 0x10},
        {0xa0, 0x40, 0x15, 0x70, 0x01, 0x00, 0x63, 0x10},
        {0xa0, 0x40, 0x18, 0x00, 0x01, 0x00, 0x63, 0x10},
        {0xa0, 0x40, 0x11, 0x01, 0x01, 0x00, 0x63, 0x10},
        {0xa0, 0x40, 0x03, 0x56, 0x01, 0x00, 0x63, 0x10},
        {0xa0, 0x40, 0x11, 0x01, 0x01, 0x00, 0x63, 0x10},
-       {0xb0, 0x40, 0x04, 0x07, 0x2a, 0x00, 0x63, 0x10},
-       {0xb0, 0x40, 0x0e, 0x00, 0x3d, 0x00, 0x63, 0x10},
-
-       {0xa0, 0x40, 0x11, 0x01, 0x3d, 0x00, 0x63, 0x16},
-       {0xa0, 0x40, 0x10, 0x08, 0x3d, 0x00, 0x63, 0x15},
-       {0xa0, 0x40, 0x02, 0x04, 0x3d, 0x00, 0x63, 0x16},
-       {0xa0, 0x40, 0x11, 0x01, 0x3d, 0x00, 0x63, 0x16},
-       {0xb0, 0x40, 0x0e, 0x00, 0x31, 0x00, 0x63, 0x16},
-       {0xa0, 0x40, 0x11, 0x01, 0x31, 0x00, 0x63, 0x16},
-       {0xa0, 0x40, 0x10, 0x0e, 0x31, 0x00, 0x63, 0x15},
-       {0xa0, 0x40, 0x11, 0x01, 0x31, 0x00, 0x63, 0x16},
 };
 
-static const __u8 initTas5110[] = {
+static const __u8 initTas5110c[] = {
        0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
        0x00, 0x00,
-       0x00, 0x01, 0x00, 0x45, 0x09, 0x0a,
+       0x00, 0x00, 0x00, 0x45, 0x09, 0x0a,
+       0x16, 0x12, 0x60, 0x86, 0x2b,
+       0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
+};
+/* Same as above, except a different hstart */
+static const __u8 initTas5110d[] = {
+       0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
+       0x00, 0x00,
+       0x00, 0x00, 0x00, 0x41, 0x09, 0x0a,
        0x16, 0x12, 0x60, 0x86, 0x2b,
        0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
 };
@@ -476,7 +539,7 @@ static const __u8 tas5110_sensor_init[][8] = {
 static const __u8 initTas5130[] = {
        0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
        0x00, 0x00,
-       0x00, 0x01, 0x00, 0x68, 0x0c, 0x0a,
+       0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a,
        0x28, 0x1e, 0x60, COMP, MCK_INIT,
        0x18, 0x10, 0x04, 0x03, 0x11, 0x0c
 };
@@ -493,12 +556,14 @@ SENS(initHv7131, NULL, hv7131_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ, 0),
 SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60),
 SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3,
        F_GAIN, 0, 0x21),
-SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_SIF, NO_EXPO|NO_FREQ,
+SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_GAIN|F_SIF, NO_FREQ,
        0),
-SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, 0,
-       NO_EXPO|NO_FREQ, 0),
-SENS(initTas5110, NULL, tas5110_sensor_init, NULL, NULL, F_GAIN|F_SIF,
-       NO_BRIGHTNESS|NO_FREQ, 0),
+SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, F_GAIN,
+       NO_FREQ, 0),
+SENS(initTas5110c, NULL, tas5110_sensor_init, NULL, NULL,
+       F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0),
+SENS(initTas5110d, NULL, tas5110_sensor_init, NULL, NULL,
+       F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0),
 SENS(initTas5130, NULL, tas5130_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ,
        0),
 };
@@ -587,42 +652,28 @@ static void setbrightness(struct gspca_dev *gspca_dev)
                        goto err;
                break;
            }
-       case SENSOR_PAS106: {
-               __u8 i2c1[] =
-                       {0xa1, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14};
-
-               i2c1[3] = sd->brightness >> 3;
-               i2c1[2] = 0x0e;
-               if (i2c_w(gspca_dev, i2c1) < 0)
-                       goto err;
-               i2c1[3] = 0x01;
-               i2c1[2] = 0x13;
-               if (i2c_w(gspca_dev, i2c1) < 0)
-                       goto err;
-               break;
-           }
+       case SENSOR_PAS106:
        case SENSOR_PAS202: {
-               /* __u8 i2cpexpo1[] =
-                       {0xb0, 0x40, 0x04, 0x07, 0x2a, 0x00, 0x63, 0x16}; */
-               __u8 i2cpexpo[] =
-                       {0xb0, 0x40, 0x0e, 0x01, 0xab, 0x00, 0x63, 0x16};
-               __u8 i2cp202[] =
-                       {0xa0, 0x40, 0x10, 0x0e, 0x31, 0x00, 0x63, 0x15};
-               static __u8 i2cpdoit[] =
-                       {0xa0, 0x40, 0x11, 0x01, 0x31, 0x00, 0x63, 0x16};
-
-               /* change reg 0x10 */
-               i2cpexpo[4] = 0xff - sd->brightness;
-/*             if(i2c_w(gspca_dev,i2cpexpo1) < 0)
-                       goto err; */
-/*             if(i2c_w(gspca_dev,i2cpdoit) < 0)
-                       goto err; */
-               if (i2c_w(gspca_dev, i2cpexpo) < 0)
-                       goto err;
-               if (i2c_w(gspca_dev, i2cpdoit) < 0)
-                       goto err;
-               i2cp202[3] = sd->brightness >> 3;
-               if (i2c_w(gspca_dev, i2cp202) < 0)
+               __u8 i2cpbright[] =
+                       {0xb0, 0x40, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x16};
+               __u8 i2cpdoit[] =
+                       {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
+
+               /* PAS106 uses reg 7 and 8 instead of b and c */
+               if (sd->sensor == SENSOR_PAS106) {
+                       i2cpbright[2] = 7;
+                       i2cpdoit[2] = 0x13;
+               }
+
+               if (sd->brightness < 127) {
+                       /* change reg 0x0b, signreg */
+                       i2cpbright[3] = 0x01;
+                       /* set reg 0x0c, offset */
+                       i2cpbright[4] = 127 - sd->brightness;
+               } else
+                       i2cpbright[4] = sd->brightness - 127;
+
+               if (i2c_w(gspca_dev, i2cpbright) < 0)
                        goto err;
                if (i2c_w(gspca_dev, i2cpdoit) < 0)
                        goto err;
@@ -652,7 +703,8 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
 
        switch (sd->sensor) {
 
-       case SENSOR_TAS5110: {
+       case SENSOR_TAS5110C:
+       case SENSOR_TAS5110D: {
                __u8 i2c[] =
                        {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
 
@@ -674,6 +726,37 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
                        goto err;
                break;
            }
+       case SENSOR_PAS106:
+       case SENSOR_PAS202: {
+               __u8 i2cpgain[] =
+                       {0xa0, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x15};
+               __u8 i2cpcolorgain[] =
+                       {0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x15};
+               __u8 i2cpdoit[] =
+                       {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
+
+               /* PAS106 uses different regs (and has split green gains) */
+               if (sd->sensor == SENSOR_PAS106) {
+                       i2cpgain[2] = 0x0e;
+                       i2cpcolorgain[0] = 0xd0;
+                       i2cpcolorgain[2] = 0x09;
+                       i2cpdoit[2] = 0x13;
+               }
+
+               i2cpgain[3] = sd->gain >> 3;
+               i2cpcolorgain[3] = sd->gain >> 4;
+               i2cpcolorgain[4] = sd->gain >> 4;
+               i2cpcolorgain[5] = sd->gain >> 4;
+               i2cpcolorgain[6] = sd->gain >> 4;
+
+               if (i2c_w(gspca_dev, i2cpgain) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpcolorgain) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpdoit) < 0)
+                       goto err;
+               break;
+           }
        }
        return;
 err:
@@ -684,19 +767,21 @@ static void setgain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        __u8 gain;
-       __u8 rgb_value;
+       __u8 buf[2] = { 0, 0 };
+
+       if (sensor_data[sd->sensor].flags & F_GAIN) {
+               /* Use the sensor gain to do the actual gain */
+               setsensorgain(gspca_dev);
+               return;
+       }
 
        gain = sd->gain >> 4;
 
        /* red and blue gain */
-       rgb_value = gain << 4 | gain;
-       reg_w(gspca_dev, 0x10, &rgb_value, 1);
+       buf[0] = gain << 4 | gain;
        /* green gain */
-       rgb_value = gain;
-       reg_w(gspca_dev, 0x11, &rgb_value, 1);
-
-       if (sensor_data[sd->sensor].flags & F_GAIN)
-               setsensorgain(gspca_dev);
+       buf[1] = gain;
+       reg_w(gspca_dev, 0x10, buf, 2);
 }
 
 static void setexposure(struct gspca_dev *gspca_dev)
@@ -704,17 +789,12 @@ static void setexposure(struct gspca_dev *gspca_dev)
        struct sd *sd = (struct sd *) gspca_dev;
 
        switch (sd->sensor) {
-       case SENSOR_TAS5110: {
-               __u8 reg;
-
+       case SENSOR_TAS5110C:
+       case SENSOR_TAS5110D: {
                /* register 19's high nibble contains the sn9c10x clock divider
                   The high nibble configures the no fps according to the
                   formula: 60 / high_nibble. With a maximum of 30 fps */
-               reg = 120 * sd->exposure / 1000;
-               if (reg < 2)
-                       reg = 2;
-               else if (reg > 15)
-                       reg = 15;
+               __u8 reg = sd->exposure;
                reg = (reg << 4) | 0x0b;
                reg_w(gspca_dev, 0x19, &reg, 1);
                break;
@@ -750,20 +830,21 @@ static void setexposure(struct gspca_dev *gspca_dev)
                } else
                        reg10_max = 0x41;
 
-               reg11 = (60 * sd->exposure + 999) / 1000;
+               reg11 = (15 * sd->exposure + 999) / 1000;
                if (reg11 < 1)
                        reg11 = 1;
                else if (reg11 > 16)
                        reg11 = 16;
 
-               /* In 640x480, if the reg11 has less than 3, the image is
-                  unstable (not enough bandwidth). */
-               if (gspca_dev->width == 640 && reg11 < 3)
-                       reg11 = 3;
+               /* In 640x480, if the reg11 has less than 4, the image is
+                  unstable (the bridge goes into a higher compression mode
+                  which we have not reverse engineered yet). */
+               if (gspca_dev->width == 640 && reg11 < 4)
+                       reg11 = 4;
 
                /* frame exposure time in ms = 1000 * reg11 / 30    ->
-               reg10 = sd->exposure * 2 * reg10_max / (1000 * reg11 / 30) */
-               reg10 = (sd->exposure * 60 * reg10_max) / (1000 * reg11);
+               reg10 = (sd->exposure / 2) * reg10_max / (1000 * reg11 / 30) */
+               reg10 = (sd->exposure * 15 * reg10_max) / (1000 * reg11);
 
                /* Don't allow this to get below 10 when using autogain, the
                   steps become very large (relatively) when below 10 causing
@@ -786,10 +867,85 @@ static void setexposure(struct gspca_dev *gspca_dev)
                if (i2c_w(gspca_dev, i2c) == 0)
                        sd->reg11 = reg11;
                else
-                       PDEBUG(D_ERR, "i2c error exposure");
+                       goto err;
+               break;
+           }
+       case SENSOR_PAS202: {
+               __u8 i2cpframerate[] =
+                       {0xb0, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x16};
+               __u8 i2cpexpo[] =
+                       {0xa0, 0x40, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x16};
+               const __u8 i2cpdoit[] =
+                       {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
+               int framerate_ctrl;
+
+               /* The exposure knee for the autogain algorithm is 200
+                  (100 ms / 10 fps on other sensors), for values below this
+                  use the control for setting the partial frame expose time,
+                  above that use variable framerate. This way we run at max
+                  framerate (640x480@7.5 fps, 320x240@10fps) until the knee
+                  is reached. Using the variable framerate control above 200
+                  is better then playing around with both clockdiv + partial
+                  frame exposure times (like we are doing with the ov chips),
+                  as that sometimes leads to jumps in the exposure control,
+                  which are bad for auto exposure. */
+               if (sd->exposure < 200) {
+                       i2cpexpo[3] = 255 - (sd->exposure * 255) / 200;
+                       framerate_ctrl = 500;
+               } else {
+                       /* The PAS202's exposure control goes from 0 - 4095,
+                          but anything below 500 causes vsync issues, so scale
+                          our 200-1023 to 500-4095 */
+                       framerate_ctrl = (sd->exposure - 200) * 1000 / 229 +
+                                        500;
+               }
+
+               i2cpframerate[3] = framerate_ctrl >> 6;
+               i2cpframerate[4] = framerate_ctrl & 0x3f;
+               if (i2c_w(gspca_dev, i2cpframerate) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpexpo) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpdoit) < 0)
+                       goto err;
+               break;
+           }
+       case SENSOR_PAS106: {
+               __u8 i2cpframerate[] =
+                       {0xb1, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x14};
+               __u8 i2cpexpo[] =
+                       {0xa1, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x14};
+               const __u8 i2cpdoit[] =
+                       {0xa1, 0x40, 0x13, 0x01, 0x00, 0x00, 0x00, 0x14};
+               int framerate_ctrl;
+
+               /* For values below 150 use partial frame exposure, above
+                  that use framerate ctrl */
+               if (sd->exposure < 150) {
+                       i2cpexpo[3] = 150 - sd->exposure;
+                       framerate_ctrl = 300;
+               } else {
+                       /* The PAS106's exposure control goes from 0 - 4095,
+                          but anything below 300 causes vsync issues, so scale
+                          our 150-1023 to 300-4095 */
+                       framerate_ctrl = (sd->exposure - 150) * 1000 / 230 +
+                                        300;
+               }
+
+               i2cpframerate[3] = framerate_ctrl >> 4;
+               i2cpframerate[4] = framerate_ctrl & 0x0f;
+               if (i2c_w(gspca_dev, i2cpframerate) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpexpo) < 0)
+                       goto err;
+               if (i2c_w(gspca_dev, i2cpdoit) < 0)
+                       goto err;
                break;
            }
        }
+       return;
+err:
+       PDEBUG(D_ERR, "i2c error exposure");
 }
 
 static void setfreq(struct gspca_dev *gspca_dev)
@@ -823,30 +979,43 @@ static void setfreq(struct gspca_dev *gspca_dev)
        }
 }
 
+#include "coarse_expo_autogain.h"
+
 static void do_autogain(struct gspca_dev *gspca_dev)
 {
-       int deadzone, desired_avg_lum;
+       int deadzone, desired_avg_lum, result;
        struct sd *sd = (struct sd *) gspca_dev;
        int avg_lum = atomic_read(&sd->avg_lum);
 
-       if (avg_lum == -1)
+       if (avg_lum == -1 || !sd->autogain)
                return;
 
+       if (sd->autogain_ignore_frames > 0) {
+               sd->autogain_ignore_frames--;
+               return;
+       }
+
        /* SIF / VGA sensors have a different autoexposure area and thus
           different avg_lum values for the same picture brightness */
        if (sensor_data[sd->sensor].flags & F_SIF) {
-               deadzone = 1000;
-               desired_avg_lum = 7000;
+               deadzone = 500;
+               /* SIF sensors tend to overexpose, so keep this small */
+               desired_avg_lum = 5000;
        } else {
-               deadzone = 3000;
-               desired_avg_lum = 23000;
+               deadzone = 1500;
+               desired_avg_lum = 18000;
        }
 
-       if (sd->autogain_ignore_frames > 0)
-               sd->autogain_ignore_frames--;
-       else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum,
-                       sd->brightness * desired_avg_lum / 127,
-                       deadzone, GAIN_KNEE, EXPOSURE_KNEE)) {
+       if (sensor_data[sd->sensor].flags & F_COARSE_EXPO)
+               result = gspca_coarse_grained_expo_autogain(gspca_dev, avg_lum,
+                               sd->brightness * desired_avg_lum / 127,
+                               deadzone);
+       else
+               result = gspca_auto_gain_n_exposure(gspca_dev, avg_lum,
+                               sd->brightness * desired_avg_lum / 127,
+                               deadzone, GAIN_KNEE, EXPOSURE_KNEE);
+
+       if (result) {
                PDEBUG(D_FRAM, "autogain: gain changed: gain: %d expo: %d",
                        (int)sd->gain, (int)sd->exposure);
                sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES;
@@ -881,7 +1050,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        sd->brightness = BRIGHTNESS_DEF;
        sd->gain = GAIN_DEF;
-       sd->exposure = EXPOSURE_DEF;
+       if (sensor_data[sd->sensor].flags & F_COARSE_EXPO) {
+               sd->exposure = COARSE_EXPOSURE_DEF;
+               gspca_dev->ctrl_dis |= (1 << EXPOSURE_IDX);
+       } else {
+               sd->exposure = EXPOSURE_DEF;
+               gspca_dev->ctrl_dis |= (1 << COARSE_EXPOSURE_IDX);
+       }
        if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX))
                sd->autogain = 0; /* Disable do_autogain callback */
        else
@@ -917,9 +1092,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
        reg12_19[6] = sn9c10x[0x18 - 1] | (mode << 4);
        /* Special cases where reg 17 and or 19 value depends on mode */
        switch (sd->sensor) {
-       case SENSOR_PAS202:
-               reg12_19[5] = mode ? 0x24 : 0x20;
-               break;
        case SENSOR_TAS5130CXX:
                /* probably not mode specific at all most likely the upper
                   nibble of 0x19 is exposure (clock divider) just as with
@@ -955,6 +1127,16 @@ static int sd_start(struct gspca_dev *gspca_dev)
                        sensor_data[sd->sensor].sensor_bridge_init_size[
                                sd->bridge]);
 
+       /* Mode specific sensor setup */
+       switch (sd->sensor) {
+       case SENSOR_PAS202: {
+               const __u8 i2cpclockdiv[] =
+                       {0xa0, 0x40, 0x02, 0x03, 0x00, 0x00, 0x00, 0x10};
+               /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */
+               if (mode)
+                       i2c_w(gspca_dev, i2cpclockdiv);
+           }
+       }
        /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */
        reg_w(gspca_dev, 0x15, &reg12_19[3], 2);
        /* compression register */
@@ -985,6 +1167,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
        sd->frames_to_drop = 0;
        sd->autogain_ignore_frames = 0;
+       sd->exp_too_high_cnt = 0;
+       sd->exp_too_low_cnt = 0;
        atomic_set(&sd->avg_lum, -1);
        return 0;
 }
@@ -1143,11 +1327,14 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->autogain = val;
+       sd->exp_too_high_cnt = 0;
+       sd->exp_too_low_cnt = 0;
+
        /* when switching to autogain set defaults to make sure
           we are on a valid point of the autogain gain /
           exposure knee graph, and give this change time to
           take effect before doing autogain. */
-       if (sd->autogain) {
+       if (sd->autogain && !(sensor_data[sd->sensor].flags & F_COARSE_EXPO)) {
                sd->exposure = EXPOSURE_DEF;
                sd->gain = GAIN_DEF;
                if (gspca_dev->streaming) {
@@ -1207,6 +1394,25 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
        return -EINVAL;
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrupt packet length */
+{
+       int ret = -EINVAL;
+
+       if (len == 1 && data[0] == 1) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+               input_sync(gspca_dev->input_dev);
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+               input_sync(gspca_dev->input_dev);
+               ret = 0;
+       }
+
+       return ret;
+}
+#endif
+
 /* sub-driver description */
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
@@ -1219,6 +1425,9 @@ static const struct sd_desc sd_desc = {
        .pkt_scan = sd_pkt_scan,
        .querymenu = sd_querymenu,
        .dq_callback = do_autogain,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* -- module initialisation -- */
@@ -1227,21 +1436,21 @@ static const struct sd_desc sd_desc = {
 
 
 static const struct usb_device_id device_table[] __devinitconst = {
-       {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110, 102)}, /* TAS5110C1B */
-       {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110, 101)}, /* TAS5110C1B */
+       {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */
+       {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */
 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
-       {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110, 101)}, /* TAS5110D */
+       {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */
+#endif
        {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)},
        {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)},
-#endif
        {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)},
 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
        {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)},
        {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)},
        {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)},
+#endif
        {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)},
        {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)},
-#endif
        {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)},
        {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)},
 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
index 0bd36a00dd2a02f9db58c149b9c0418ce2ebf40d..83d5773d4629efda315fd96899541aa5f00f1155 100644 (file)
@@ -21,6 +21,7 @@
 
 #define MODULE_NAME "sonixj"
 
+#include <linux/input.h>
 #include "gspca.h"
 #include "jpeg.h"
 
@@ -45,6 +46,7 @@ struct sd {
        u8 red;
        u8 gamma;
        u8 vflip;                       /* ov7630/ov7648 only */
+       u8 sharpness;
        u8 infrared;                    /* mt9v111 only */
        u8 freq;                        /* ov76xx only */
        u8 quality;                     /* image quality */
@@ -64,16 +66,17 @@ struct sd {
 #define BRIDGE_SN9C110 2
 #define BRIDGE_SN9C120 3
        u8 sensor;                      /* Type of image sensor chip */
-#define SENSOR_HV7131R 0
-#define SENSOR_MI0360 1
-#define SENSOR_MO4000 2
-#define SENSOR_MT9V111 3
-#define SENSOR_OM6802 4
-#define SENSOR_OV7630 5
-#define SENSOR_OV7648 6
-#define SENSOR_OV7660 7
-#define SENSOR_PO1030 8
-#define SENSOR_SP80708 9
+#define SENSOR_ADCM1700 0
+#define SENSOR_HV7131R 1
+#define SENSOR_MI0360 2
+#define SENSOR_MO4000 3
+#define SENSOR_MT9V111 4
+#define SENSOR_OM6802 5
+#define SENSOR_OV7630 6
+#define SENSOR_OV7648 7
+#define SENSOR_OV7660 8
+#define SENSOR_PO1030 9
+#define SENSOR_SP80708 10
        u8 i2c_addr;
 
        u8 *jpeg_hdr;
@@ -96,12 +99,14 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setinfrared(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define BRIGHTNESS_IDX 0
        {
            {
@@ -225,8 +230,23 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setvflip,
            .get = sd_getvflip,
        },
+#define SHARPNESS_IDX 8
+       {
+           {
+               .id      = V4L2_CID_SHARPNESS,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Sharpness",
+               .minimum = 0,
+               .maximum = 255,
+               .step    = 1,
+#define SHARPNESS_DEF 90
+               .default_value = SHARPNESS_DEF,
+           },
+           .set = sd_setsharpness,
+           .get = sd_getsharpness,
+       },
 /* mt9v111 only */
-#define INFRARED_IDX 8
+#define INFRARED_IDX 9
        {
            {
                .id      = V4L2_CID_INFRARED,
@@ -242,7 +262,7 @@ static struct ctrl sd_ctrls[] = {
            .get = sd_getinfrared,
        },
 /* ov7630/ov7648/ov7660 only */
-#define FREQ_IDX 9
+#define FREQ_IDX 10
        {
            {
                .id      = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -261,28 +281,37 @@ static struct ctrl sd_ctrls[] = {
 
 /* table of the disabled controls */
 static __u32 ctrl_dis[] = {
+       (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX) |
+                       (1 << AUTOGAIN_IDX),    /* SENSOR_ADCM1700 0 */
+       (1 << INFRARED_IDX) | (1 << FREQ_IDX),
+                                               /* SENSOR_HV7131R 1 */
        (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX),
-                                               /* SENSOR_HV7131R 0 */
+                                               /* SENSOR_MI0360 2 */
        (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX),
-                                               /* SENSOR_MI0360 1 */
-       (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX),
-                                               /* SENSOR_MO4000 2 */
+                                               /* SENSOR_MO4000 3 */
        (1 << VFLIP_IDX) | (1 << FREQ_IDX),
-                                               /* SENSOR_MT9V111 3 */
+                                               /* SENSOR_MT9V111 4 */
        (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX),
-                                               /* SENSOR_OM6802 4 */
+                                               /* SENSOR_OM6802 5 */
        (1 << INFRARED_IDX),
-                                               /* SENSOR_OV7630 5 */
+                                               /* SENSOR_OV7630 6 */
        (1 << INFRARED_IDX),
-                                               /* SENSOR_OV7648 6 */
+                                               /* SENSOR_OV7648 7 */
        (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX),
-                                               /* SENSOR_OV7660 7 */
+                                               /* SENSOR_OV7660 8 */
        (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) |
-                             (1 << FREQ_IDX),  /* SENSOR_PO1030 8 */
+                             (1 << FREQ_IDX),  /* SENSOR_PO1030 9 */
        (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) |
-                             (1 << FREQ_IDX),  /* SENSOR_SP80708 9 */
+                             (1 << FREQ_IDX),  /* SENSOR_SP80708 10 */
 };
 
+static const struct v4l2_pix_format cif_mode[] = {
+       {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 352,
+               .sizeimage = 352 * 288 * 4 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG,
+               .priv = 0},
+};
 static const struct v4l2_pix_format vga_mode[] = {
        {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
                .bytesperline = 160,
@@ -302,6 +331,17 @@ static const struct v4l2_pix_format vga_mode[] = {
                .priv = 0},
 };
 
+static const u8 sn_adcm1700[0x1c] = {
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x00,   0x43,   0x60,   0x00,   0x1a,   0x00,   0x00,   0x00,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0x80,   0x51,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,   0x00,   0x05,   0x01,   0x05,   0x16,   0x12,   0x42,
+/*     reg18   reg19   reg1a   reg1b */
+       0x06,   0x00,   0x00,   0x00
+};
+
 /*Data from sn9c102p+hv7131r */
 static const u8 sn_hv7131[0x1c] = {
 /*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
@@ -415,6 +455,7 @@ static const u8 sn_sp80708[0x1c] = {
 
 /* sequence specific to the sensors - !! index = SENSOR_xxx */
 static const u8 *sn_tb[] = {
+       sn_adcm1700,
        sn_hv7131,
        sn_mi0360,
        sn_mo4000,
@@ -432,6 +473,11 @@ static const u8 gamma_def[17] = {
        0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
        0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
 };
+/* gamma for sensor ADCM1700 */
+static const u8 gamma_spec_0[17] = {
+       0x0f, 0x39, 0x5a, 0x74, 0x86, 0x95, 0xa6, 0xb4,
+       0xbd, 0xc4, 0xcc, 0xd4, 0xd5, 0xde, 0xe4, 0xed, 0xf5
+};
 /* gamma for sensors HV7131R and MT9V111 */
 static const u8 gamma_spec_1[17] = {
        0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d,
@@ -450,6 +496,42 @@ static const u8 reg84[] = {
        0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f,     /* VR VG VB */
        0x00, 0x00, 0x00                        /* YUV offsets */
 };
+static const u8 adcm1700_sensor_init[][8] = {
+       {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10},       /* reset */
+       {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10},
+       {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10},
+       {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+       {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10},
+       {}
+};
+static const u8 adcm1700_sensor_param1[][8] = {
+       {0xb0, 0x51, 0x26, 0xf9, 0x01, 0x00, 0x00, 0x10},       /* exposure? */
+       {0xd0, 0x51, 0x1e, 0x8e, 0x8e, 0x8e, 0x8e, 0x10},
+
+       {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10},
+       {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x32, 0x00, 0x72, 0x00, 0x00, 0x10},
+       {0xd0, 0x51, 0x1e, 0xbe, 0xd7, 0xe8, 0xbe, 0x10},       /* exposure? */
+
+       {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10},
+       {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
+       {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10},
+       {}
+};
 static const u8 hv7131r_sensor_init[][8] = {
        {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10},
        {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10},
@@ -986,17 +1068,18 @@ static const u8 sp80708_sensor_param1[][8] = {
        {}
 };
 
-static const u8 (*sensor_init[10])[8] = {
-       hv7131r_sensor_init,    /* HV7131R 0 */
-       mi0360_sensor_init,     /* MI0360 1 */
-       mo4000_sensor_init,     /* MO4000 2 */
-       mt9v111_sensor_init,    /* MT9V111 3 */
-       om6802_sensor_init,     /* OM6802 4 */
-       ov7630_sensor_init,     /* OV7630 5 */
-       ov7648_sensor_init,     /* OV7648 6 */
-       ov7660_sensor_init,     /* OV7660 7 */
-       po1030_sensor_init,     /* PO1030 8 */
-       sp80708_sensor_init,    /* SP80708 9 */
+static const u8 (*sensor_init[11])[8] = {
+       adcm1700_sensor_init,   /* ADCM1700 0 */
+       hv7131r_sensor_init,    /* HV7131R 1 */
+       mi0360_sensor_init,     /* MI0360 2 */
+       mo4000_sensor_init,     /* MO4000 3 */
+       mt9v111_sensor_init,    /* MT9V111 4 */
+       om6802_sensor_init,     /* OM6802 5 */
+       ov7630_sensor_init,     /* OV7630 6 */
+       ov7648_sensor_init,     /* OV7648 7 */
+       ov7660_sensor_init,     /* OV7660 8 */
+       po1030_sensor_init,     /* PO1030 9 */
+       sp80708_sensor_init,    /* SP80708 10 */
 };
 
 /* read <len> bytes to gspca_dev->usb_buf */
@@ -1064,6 +1147,7 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
 
        PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val);
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
        case SENSOR_OM6802:             /* i2c command = a0 (100 kHz) */
                gspca_dev->usb_buf[0] = 0x80 | (2 << 4);
                break;
@@ -1110,6 +1194,7 @@ static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len)
        u8 mode[8];
 
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
        case SENSOR_OM6802:             /* i2c command = 90 (100 kHz) */
                mode[0] = 0x80 | 0x10;
                break;
@@ -1260,7 +1345,8 @@ static void bridge_init(struct gspca_dev *gspca_dev,
                {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
        static const u8 regd4[] = {0x60, 0x00, 0x00};
 
-       reg_w1(gspca_dev, 0xf1, 0x00);
+       /* sensor clock already enabled in sd_init */
+       /* reg_w1(gspca_dev, 0xf1, 0x00); */
        reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
 
        /* configure gpio */
@@ -1284,6 +1370,12 @@ static void bridge_init(struct gspca_dev *gspca_dev,
        reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
 
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+               reg_w1(gspca_dev, 0x01, 0x43);
+               reg_w1(gspca_dev, 0x17, 0x62);
+               reg_w1(gspca_dev, 0x01, 0x42);
+               reg_w1(gspca_dev, 0x01, 0x42);
+               break;
        case SENSOR_MT9V111:
                reg_w1(gspca_dev, 0x01, 0x61);
                reg_w1(gspca_dev, 0x17, 0x61);
@@ -1357,14 +1449,19 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
 
-       cam = &gspca_dev->cam;
-       cam->cam_mode = vga_mode;
-       cam->nmodes = ARRAY_SIZE(vga_mode);
-       cam->npkt = 24;                 /* 24 packets per ISOC message */
-
        sd->bridge = id->driver_info >> 16;
        sd->sensor = id->driver_info;
 
+       cam = &gspca_dev->cam;
+       if (sd->sensor == SENSOR_ADCM1700) {
+               cam->cam_mode = cif_mode;
+               cam->nmodes = ARRAY_SIZE(cif_mode);
+       } else {
+               cam->cam_mode = vga_mode;
+               cam->nmodes = ARRAY_SIZE(vga_mode);
+       }
+       cam->npkt = 24;                 /* 24 packets per ISOC message */
+
        sd->brightness = BRIGHTNESS_DEF;
        sd->contrast = CONTRAST_DEF;
        sd->colors = COLOR_DEF;
@@ -1374,6 +1471,14 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->autogain = AUTOGAIN_DEF;
        sd->ag_cnt = -1;
        sd->vflip = VFLIP_DEF;
+       switch (sd->sensor) {
+       case SENSOR_OM6802:
+               sd->sharpness = 0x10;
+               break;
+       default:
+               sd->sharpness = SHARPNESS_DEF;
+               break;
+       }
        sd->infrared = INFRARED_DEF;
        sd->freq = FREQ_DEF;
        sd->quality = QUALITY_DEF;
@@ -1433,7 +1538,9 @@ static int sd_init(struct gspca_dev *gspca_dev)
                break;
        }
 
-       reg_w1(gspca_dev, 0xf1, 0x01);
+       /* Note we do not disable the sensor clock here (power saving mode),
+          as that also disables the button on the cam. */
+       reg_w1(gspca_dev, 0xf1, 0x00);
 
        /* set the i2c address */
        sn9c1xx = sn_tb[sd->sensor];
@@ -1543,6 +1650,10 @@ static void setbrightness(struct gspca_dev *gspca_dev)
 
        k2 = ((int) sd->brightness - 0x8000) >> 10;
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+               if (k2 > 0x1f)
+                       k2 = 0;         /* only positive Y offset */
+               break;
        case SENSOR_HV7131R:
                expo = sd->brightness << 4;
                if (expo > 0x002dc6c0)
@@ -1625,6 +1736,9 @@ static void setgamma(struct gspca_dev *gspca_dev)
        };
 
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+               gamma_base = gamma_spec_0;
+               break;
        case SENSOR_HV7131R:
        case SENSOR_MT9V111:
                gamma_base = gamma_spec_1;
@@ -1670,23 +1784,39 @@ static void setautogain(struct gspca_dev *gspca_dev)
                sd->ag_cnt = -1;
 }
 
-/* ov7630/ov7648 only */
+/* hv7131r/ov7630/ov7648 only */
 static void setvflip(struct sd *sd)
 {
        u8 comn;
 
        if (sd->gspca_dev.ctrl_dis & (1 << VFLIP_IDX))
                return;
-       if (sd->sensor == SENSOR_OV7630) {
+       switch (sd->sensor) {
+       case SENSOR_HV7131R:
+               comn = 0x18;                    /* clkdiv = 1, ablcen = 1 */
+               if (sd->vflip)
+                       comn |= 0x01;
+               i2c_w1(&sd->gspca_dev, 0x01, comn);     /* sctra */
+               break;
+       case SENSOR_OV7630:
                comn = 0x02;
                if (!sd->vflip)
                        comn |= 0x80;
-       } else {
+               i2c_w1(&sd->gspca_dev, 0x75, comn);
+               break;
+       default:
+/*     case SENSOR_OV7648: */
                comn = 0x06;
                if (sd->vflip)
                        comn |= 0x80;
+               i2c_w1(&sd->gspca_dev, 0x75, comn);
+               break;
        }
-       i2c_w1(&sd->gspca_dev, 0x75, comn);
+}
+
+static void setsharpness(struct sd *sd)
+{
+       reg_w1(&sd->gspca_dev, 0x99, sd->sharpness);
 }
 
 static void setinfrared(struct sd *sd)
@@ -1804,6 +1934,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
        int mode;
        static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
        static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
+       static const u8 CA_adcm1700[] =
+                               { 0x14, 0xec, 0x0a, 0xf6 };
        static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };      /* MI0360 */
        static const u8 CE_ov76xx[] =
                                { 0x32, 0xdd, 0x32, 0xdd };
@@ -1824,6 +1956,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
        i2c_w_seq(gspca_dev, sensor_init[sd->sensor]);
 
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+               reg2 = 0x60;
+               break;
        case SENSOR_OM6802:
                reg2 = 0x71;
                break;
@@ -1842,17 +1977,28 @@ static int sd_start(struct gspca_dev *gspca_dev)
        reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
        reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]);
        reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
-       reg_w1(gspca_dev, 0xd2, 0x6a);          /* DC29 */
-       reg_w1(gspca_dev, 0xd3, 0x50);
+       if (sd->sensor == SENSOR_ADCM1700) {
+               reg_w1(gspca_dev, 0xd2, 0x3a);  /* AE_H_SIZE = 116 */
+               reg_w1(gspca_dev, 0xd3, 0x30);  /* AE_V_SIZE = 96 */
+       } else {
+               reg_w1(gspca_dev, 0xd2, 0x6a);  /* AE_H_SIZE = 212 */
+               reg_w1(gspca_dev, 0xd3, 0x50);  /* AE_V_SIZE = 160 */
+       }
        reg_w1(gspca_dev, 0xc6, 0x00);
        reg_w1(gspca_dev, 0xc7, 0x00);
-       reg_w1(gspca_dev, 0xc8, 0x50);
-       reg_w1(gspca_dev, 0xc9, 0x3c);
+       if (sd->sensor == SENSOR_ADCM1700) {
+               reg_w1(gspca_dev, 0xc8, 0x2c);  /* AW_H_STOP = 352 */
+               reg_w1(gspca_dev, 0xc9, 0x24);  /* AW_V_STOP = 288 */
+       } else {
+               reg_w1(gspca_dev, 0xc8, 0x50);  /* AW_H_STOP = 640 */
+               reg_w1(gspca_dev, 0xc9, 0x3c);  /* AW_V_STOP = 480 */
+       }
        reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
        switch (sd->sensor) {
        case SENSOR_MT9V111:
                reg17 = 0xe0;
                break;
+       case SENSOR_ADCM1700:
        case SENSOR_OV7630:
                reg17 = 0xe2;
                break;
@@ -1870,44 +2016,39 @@ static int sd_start(struct gspca_dev *gspca_dev)
                break;
        }
        reg_w1(gspca_dev, 0x17, reg17);
-/* set reg1 was here */
-       reg_w1(gspca_dev, 0x05, sn9c1xx[5]);    /* red */
-       reg_w1(gspca_dev, 0x07, sn9c1xx[7]);    /* green */
-       reg_w1(gspca_dev, 0x06, sn9c1xx[6]);    /* blue */
+
+       reg_w1(gspca_dev, 0x05, 0x00);          /* red */
+       reg_w1(gspca_dev, 0x07, 0x00);          /* green */
+       reg_w1(gspca_dev, 0x06, 0x00);          /* blue */
        reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
 
        setgamma(gspca_dev);
 
+/*fixme: 8 times with all zeroes and 1 or 2 times with normal values */
        for (i = 0; i < 8; i++)
                reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+       case SENSOR_OV7660:
+       case SENSOR_SP80708:
+               reg_w1(gspca_dev, 0x9a, 0x05);
+               break;
        case SENSOR_MT9V111:
                reg_w1(gspca_dev, 0x9a, 0x07);
-               reg_w1(gspca_dev, 0x99, 0x59);
-               break;
-       case SENSOR_OM6802:
-               reg_w1(gspca_dev, 0x9a, 0x08);
-               reg_w1(gspca_dev, 0x99, 0x10);
                break;
        case SENSOR_OV7648:
                reg_w1(gspca_dev, 0x9a, 0x0a);
-               reg_w1(gspca_dev, 0x99, 0x60);
-               break;
-       case SENSOR_OV7660:
-       case SENSOR_SP80708:
-               reg_w1(gspca_dev, 0x9a, 0x05);
-               reg_w1(gspca_dev, 0x99, 0x59);
                break;
        default:
                reg_w1(gspca_dev, 0x9a, 0x08);
-               reg_w1(gspca_dev, 0x99, 0x59);
                break;
        }
+       setsharpness(sd);
 
        reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
-       reg_w1(gspca_dev, 0x05, sn9c1xx[5]);    /* red */
-       reg_w1(gspca_dev, 0x07, sn9c1xx[7]);    /* green */
-       reg_w1(gspca_dev, 0x06, sn9c1xx[6]);    /* blue */
+       reg_w1(gspca_dev, 0x05, 0x20);          /* red */
+       reg_w1(gspca_dev, 0x07, 0x20);          /* green */
+       reg_w1(gspca_dev, 0x06, 0x20);          /* blue */
 
        init = NULL;
        mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
@@ -1917,6 +2058,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
                reg1 = 0x06;    /* 640x480: clk 24Mhz, video trf enable */
        reg17 = 0x61;           /* 0x:20: enable sensor clock */
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
+               init = adcm1700_sensor_param1;
+               reg1 = 0x46;
+               reg17 = 0xe2;
+               break;
        case SENSOR_MO4000:
                if (mode) {
 /*                     reg1 = 0x46;     * 320 clk 48Mhz 60fp/s */
@@ -1940,7 +2086,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
                reg17 = 0x64;           /* 640 MCKSIZE */
                break;
        case SENSOR_OV7630:
-               setvflip(sd);
                reg17 = 0xe2;
                reg1 = 0x44;
                break;
@@ -1986,8 +2131,12 @@ static int sd_start(struct gspca_dev *gspca_dev)
        }
 
        reg_w(gspca_dev, 0xc0, C0, 6);
-       reg_w(gspca_dev, 0xca, CA, 4);
+       if (sd->sensor == SENSOR_ADCM1700)
+               reg_w(gspca_dev, 0xca, CA_adcm1700, 4);
+       else
+               reg_w(gspca_dev, 0xca, CA, 4);
        switch (sd->sensor) {
+       case SENSOR_ADCM1700:
        case SENSOR_OV7630:
        case SENSOR_OV7648:
        case SENSOR_OV7660:
@@ -2008,11 +2157,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        reg_w1(gspca_dev, 0x17, reg17);
        reg_w1(gspca_dev, 0x01, reg1);
 
-       switch (sd->sensor) {
-       case SENSOR_OV7630:
-               setvflip(sd);
-               break;
-       }
+       setvflip(sd);
        setbrightness(gspca_dev);
        setcontrast(gspca_dev);
        setautogain(gspca_dev);
@@ -2056,7 +2201,8 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
        reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]);
        reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
        reg_w1(gspca_dev, 0x01, data);
-       reg_w1(gspca_dev, 0xf1, 0x00);
+       /* Don't disable sensor clock as that disables the button on the cam */
+       /* reg_w1(gspca_dev, 0xf1, 0x01); */
 }
 
 static void sd_stop0(struct gspca_dev *gspca_dev)
@@ -2288,6 +2434,24 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
+static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->sharpness = val;
+       if (gspca_dev->streaming)
+               setsharpness(sd);
+       return 0;
+}
+
+static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->sharpness;
+       return 0;
+}
+
 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -2391,6 +2555,25 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
        return -EINVAL;
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrupt packet length */
+{
+       int ret = -EINVAL;
+
+       if (len == 1 && data[0] == 1) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+               input_sync(gspca_dev->input_dev);
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+               input_sync(gspca_dev->input_dev);
+               ret = 0;
+       }
+
+       return ret;
+}
+#endif
+
 /* sub-driver description */
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
@@ -2406,6 +2589,9 @@ static const struct sd_desc sd_desc = {
        .get_jcomp = sd_get_jcomp,
        .set_jcomp = sd_set_jcomp,
        .querymenu = sd_querymenu,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* -- module initialisation -- */
@@ -2472,6 +2658,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
 /*     {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)},      *sn9c120b*/
        {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)},     /*sn9c120b*/
        {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)},      /*sn9c120b*/
+       {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)},    /*sn9c120b*/
        {}
 };
 MODULE_DEVICE_TABLE(usb, device_table);
index fe46868a87f2e71bf7c6ace69b0745fdbd655ae8..b866c73c97db17d738cf1a6be61f71dbab06e3d3 100644 (file)
@@ -68,7 +68,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -1047,7 +1047,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
index 6761a3048a98a5c50fb6fe0fb4c0b0382ba24514..c99333933e325c34cc79a68925099e0f9a378da1 100644 (file)
@@ -59,7 +59,7 @@ static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define MY_BRIGHTNESS 0
        {
            {
index 0f9232ff1281577c3dd4c7b57122f7ab2c4daf95..c576eed73abed02dbc5c3db6fb9679ff9aa2fc94 100644 (file)
@@ -42,7 +42,7 @@ struct sd {
 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
index 39257e4e074ffa14131c0518cbef09736477e29d..89fec4c500afb45a1c53debf35f6cd38763d1710 100644 (file)
@@ -51,7 +51,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define SD_BRIGHTNESS 0
        {
            {
@@ -673,7 +673,7 @@ static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val)
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
        .nctrls = ARRAY_SIZE(sd_ctrls),
index 4d8e6cf75d5558bb44dbf6b5a472492312f83966..15b2eef8a3f64258a65a105393f1eadbf03e5419 100644 (file)
@@ -45,7 +45,7 @@ struct sd {
 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
index 58c2f0039af1f65198230dcd1ba5dd6c4c068a9c..dc7f2b0fbc793035724302b80e104178b0dfc34e 100644 (file)
@@ -922,7 +922,7 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val)
 }
 
 /* control tables */
-static struct ctrl sd_ctrls_12a[] = {
+static const struct ctrl sd_ctrls_12a[] = {
        {
            {
                .id = V4L2_CID_HUE,
@@ -964,7 +964,7 @@ static struct ctrl sd_ctrls_12a[] = {
        },
 };
 
-static struct ctrl sd_ctrls_72a[] = {
+static const struct ctrl sd_ctrls_72a[] = {
        {
            {
                .id = V4L2_CID_HUE,
index d70b156872d6fd80e30c356557d473c19a7ff1ac..e646620529920d3656e17301777c16d79870bbe6 100644 (file)
@@ -47,6 +47,7 @@ MODULE_LICENSE("GPL");
 
 /* Commands. These go in the "value" slot. */
 #define SQ905C_CLEAR   0xa0            /* clear everything */
+#define SQ905C_GET_ID  0x14f4          /* Read version number */
 #define SQ905C_CAPTURE_LOW 0xa040      /* Starts capture at 160x120 */
 #define SQ905C_CAPTURE_MED 0x1440      /* Starts capture at 320x240 */
 #define SQ905C_CAPTURE_HI 0x2840       /* Starts capture at 320x240 */
@@ -101,6 +102,26 @@ static int sq905c_command(struct gspca_dev *gspca_dev, u16 command, u16 index)
        return 0;
 }
 
+static int sq905c_read(struct gspca_dev *gspca_dev, u16 command, u16 index,
+                      int size)
+{
+       int ret;
+
+       ret = usb_control_msg(gspca_dev->dev,
+                             usb_rcvctrlpipe(gspca_dev->dev, 0),
+                             USB_REQ_SYNCH_FRAME,              /* request */
+                             USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                             command, index, gspca_dev->usb_buf, size,
+                             SQ905C_CMD_TIMEOUT);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "%s: usb_control_msg failed (%d)",
+                      __func__, ret);
+               return ret;
+       }
+
+       return 0;
+}
+
 /* This function is called as a workqueue function and runs whenever the camera
  * is streaming data. Because it is a workqueue function it is allowed to sleep
  * so we can use synchronous USB calls. To avoid possible collisions with other
@@ -183,13 +204,34 @@ static int sd_config(struct gspca_dev *gspca_dev,
 {
        struct cam *cam = &gspca_dev->cam;
        struct sd *dev = (struct sd *) gspca_dev;
+       int ret;
 
        PDEBUG(D_PROBE,
                "SQ9050 camera detected"
                " (vid/pid 0x%04X:0x%04X)", id->idVendor, id->idProduct);
+
+       ret = sq905c_command(gspca_dev, SQ905C_GET_ID, 0);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "Get version command failed");
+               return ret;
+       }
+
+       ret = sq905c_read(gspca_dev, 0xf5, 0, 20);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "Reading version command failed");
+               return ret;
+       }
+       /* Note we leave out the usb id and the manufacturing date */
+       PDEBUG(D_PROBE,
+              "SQ9050 ID string: %02x - %02x %02x %02x %02x %02x %02x",
+               gspca_dev->usb_buf[3],
+               gspca_dev->usb_buf[14], gspca_dev->usb_buf[15],
+               gspca_dev->usb_buf[16], gspca_dev->usb_buf[17],
+               gspca_dev->usb_buf[18], gspca_dev->usb_buf[19]);
+
        cam->cam_mode = sq905c_mode;
        cam->nmodes = 2;
-       if (id->idProduct == 0x9050)
+       if (gspca_dev->usb_buf[15] == 0)
                cam->nmodes = 1;
        /* We don't use the buffer gspca allocates so make it small. */
        cam->bulk_size = 32;
@@ -258,6 +300,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
 static const __devinitdata struct usb_device_id device_table[] = {
        {USB_DEVICE(0x2770, 0x905c)},
        {USB_DEVICE(0x2770, 0x9050)},
+       {USB_DEVICE(0x2770, 0x9052)},
        {USB_DEVICE(0x2770, 0x913d)},
        {}
 };
index 2e2935532d99bb3b072caf954f757cdfe47c2e2e..0fb534210a2c7f4bfe25ba3ca3737df7314feae1 100644 (file)
@@ -53,7 +53,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
index 2a69d7ccb50dd07434c75cdbc3cf30860a4655a9..e50dd7693f74ea6bc8b013b50ed05d1f134bc160 100644 (file)
@@ -45,7 +45,7 @@ struct sd {
 };
 
 /* V4L2 controls supported by the driver */
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 };
 
 static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val,
@@ -53,24 +53,28 @@ static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val,
 {
        int ret = -1;
        u8 req_type = 0;
+       unsigned int pipe = 0;
 
        switch (set) {
        case 0: /*  0xc1  */
                req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
+               pipe = usb_rcvctrlpipe(gspca_dev->dev, 0);
                break;
        case 1: /*  0x41  */
                req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
+               pipe = usb_sndctrlpipe(gspca_dev->dev, 0);
                break;
        case 2: /*  0x80  */
                req_type = USB_DIR_IN | USB_RECIP_DEVICE;
+               pipe = usb_rcvctrlpipe(gspca_dev->dev, 0);
                break;
        case 3: /*  0x40  */
                req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+               pipe = usb_sndctrlpipe(gspca_dev->dev, 0);
                break;
        }
 
-       ret = usb_control_msg(gspca_dev->dev,
-                             usb_rcvctrlpipe(gspca_dev->dev, 0),
+       ret = usb_control_msg(gspca_dev->dev, pipe,
                              req, req_type,
                              val, 0, gspca_dev->usb_buf, size, 500);
 
@@ -138,6 +142,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam = &gspca_dev->cam;
 
+       /* Give the camera some time to settle, otherwise initalization will
+          fail on hotplug, and yes it really needs a full second. */
+       msleep(1000);
+
        /* ping camera to be sure STV0680 is present */
        if (stv_sndctrl(gspca_dev, 0, 0x88, 0x5678, 0x02) != 0x02 ||
            gspca_dev->usb_buf[0] != 0x56 || gspca_dev->usb_buf[1] != 0x78) {
@@ -169,6 +177,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
                PDEBUG(D_PROBE, "Camera supports CIF mode");
        if (gspca_dev->usb_buf[7] & 0x02)
                PDEBUG(D_PROBE, "Camera supports VGA mode");
+       if (gspca_dev->usb_buf[7] & 0x04)
+               PDEBUG(D_PROBE, "Camera supports QCIF mode");
        if (gspca_dev->usb_buf[7] & 0x08)
                PDEBUG(D_PROBE, "Camera supports QVGA mode");
 
index 5d0241bb161182c97be03c49220326bbcf4e2552..af73da34c83fb61f01b4cd46f9bee1384bf6002a 100644 (file)
@@ -27,6 +27,7 @@
  * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
  */
 
+#include <linux/input.h>
 #include "stv06xx_sensor.h"
 
 MODULE_AUTHOR("Erik Andrén");
@@ -219,6 +220,7 @@ static void stv06xx_dump_bridge(struct sd *sd)
                info("Read 0x%x from address 0x%x", data, i);
        }
 
+       info("Testing stv06xx bridge registers for writability");
        for (i = 0x1400; i < 0x160f; i++) {
                stv06xx_read_bridge(sd, i, &data);
                buf = data;
@@ -229,7 +231,7 @@ static void stv06xx_dump_bridge(struct sd *sd)
                        info("Register 0x%x is read/write", i);
                else if (data != buf)
                        info("Register 0x%x is read/write,"
-                            "but only partially", i);
+                            " but only partially", i);
                else
                        info("Register 0x%x is read-only", i);
 
@@ -426,6 +428,29 @@ frame_data:
        }
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrupt packet length */
+{
+       int ret = -EINVAL;
+
+       if (len == 1 && data[0] == 0x80) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+               input_sync(gspca_dev->input_dev);
+               ret = 0;
+       }
+
+       if (len == 1 && data[0] == 0x88) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+               input_sync(gspca_dev->input_dev);
+               ret = 0;
+       }
+
+       return ret;
+}
+#endif
+
 static int stv06xx_config(struct gspca_dev *gspca_dev,
                          const struct usb_device_id *id);
 
@@ -436,7 +461,10 @@ static const struct sd_desc sd_desc = {
        .init = stv06xx_init,
        .start = stv06xx_start,
        .stopN = stv06xx_stopN,
-       .pkt_scan = stv06xx_pkt_scan
+       .pkt_scan = stv06xx_pkt_scan,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 /* This function is called at probe time */
index 487d40555343f7581148c4656829f282d88bff0b..96c61926d3728f99b11723197458dcf2814ff16d 100644 (file)
@@ -228,6 +228,7 @@ static const struct stv_init stv_bridge_init[] = {
        /* This reg is written twice. Some kind of reset? */
        {NULL,  0x1620, 0x80},
        {NULL,  0x1620, 0x00},
+       {NULL,  0x1443, 0x00},
        {NULL,  0x1423, 0x04},
        {x1500, 0x1500, ARRAY_SIZE(x1500)},
        {x1536, 0x1536, ARRAY_SIZE(x1536)},
index 716df6b15fc5a199105c8afa3584cb1eed29cbc1..0c786e00ebcf39e758bb60f29f73f82f826fadc4 100644 (file)
@@ -67,7 +67,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -267,142 +267,6 @@ static const struct cmd spca504A_clicksmart420_open_data[] = {
        {0x06, 0x0000, 0x0000},
        {0x00, 0x0004, 0x2880},
        {0x00, 0x0001, 0x2881},
-/* look like setting a qTable */
-       {0x00, 0x0006, 0x2800},
-       {0x00, 0x0004, 0x2801},
-       {0x00, 0x0004, 0x2802},
-       {0x00, 0x0006, 0x2803},
-       {0x00, 0x000a, 0x2804},
-       {0x00, 0x0010, 0x2805},
-       {0x00, 0x0014, 0x2806},
-       {0x00, 0x0018, 0x2807},
-       {0x00, 0x0005, 0x2808},
-       {0x00, 0x0005, 0x2809},
-       {0x00, 0x0006, 0x280a},
-       {0x00, 0x0008, 0x280b},
-       {0x00, 0x000a, 0x280c},
-       {0x00, 0x0017, 0x280d},
-       {0x00, 0x0018, 0x280e},
-       {0x00, 0x0016, 0x280f},
-
-       {0x00, 0x0006, 0x2810},
-       {0x00, 0x0005, 0x2811},
-       {0x00, 0x0006, 0x2812},
-       {0x00, 0x000a, 0x2813},
-       {0x00, 0x0010, 0x2814},
-       {0x00, 0x0017, 0x2815},
-       {0x00, 0x001c, 0x2816},
-       {0x00, 0x0016, 0x2817},
-       {0x00, 0x0006, 0x2818},
-       {0x00, 0x0007, 0x2819},
-       {0x00, 0x0009, 0x281a},
-       {0x00, 0x000c, 0x281b},
-       {0x00, 0x0014, 0x281c},
-       {0x00, 0x0023, 0x281d},
-       {0x00, 0x0020, 0x281e},
-       {0x00, 0x0019, 0x281f},
-
-       {0x00, 0x0007, 0x2820},
-       {0x00, 0x0009, 0x2821},
-       {0x00, 0x000f, 0x2822},
-       {0x00, 0x0016, 0x2823},
-       {0x00, 0x001b, 0x2824},
-       {0x00, 0x002c, 0x2825},
-       {0x00, 0x0029, 0x2826},
-       {0x00, 0x001f, 0x2827},
-       {0x00, 0x000a, 0x2828},
-       {0x00, 0x000e, 0x2829},
-       {0x00, 0x0016, 0x282a},
-       {0x00, 0x001a, 0x282b},
-       {0x00, 0x0020, 0x282c},
-       {0x00, 0x002a, 0x282d},
-       {0x00, 0x002d, 0x282e},
-       {0x00, 0x0025, 0x282f},
-
-       {0x00, 0x0014, 0x2830},
-       {0x00, 0x001a, 0x2831},
-       {0x00, 0x001f, 0x2832},
-       {0x00, 0x0023, 0x2833},
-       {0x00, 0x0029, 0x2834},
-       {0x00, 0x0030, 0x2835},
-       {0x00, 0x0030, 0x2836},
-       {0x00, 0x0028, 0x2837},
-       {0x00, 0x001d, 0x2838},
-       {0x00, 0x0025, 0x2839},
-       {0x00, 0x0026, 0x283a},
-       {0x00, 0x0027, 0x283b},
-       {0x00, 0x002d, 0x283c},
-       {0x00, 0x0028, 0x283d},
-       {0x00, 0x0029, 0x283e},
-       {0x00, 0x0028, 0x283f},
-
-       {0x00, 0x0007, 0x2840},
-       {0x00, 0x0007, 0x2841},
-       {0x00, 0x000a, 0x2842},
-       {0x00, 0x0013, 0x2843},
-       {0x00, 0x0028, 0x2844},
-       {0x00, 0x0028, 0x2845},
-       {0x00, 0x0028, 0x2846},
-       {0x00, 0x0028, 0x2847},
-       {0x00, 0x0007, 0x2848},
-       {0x00, 0x0008, 0x2849},
-       {0x00, 0x000a, 0x284a},
-       {0x00, 0x001a, 0x284b},
-       {0x00, 0x0028, 0x284c},
-       {0x00, 0x0028, 0x284d},
-       {0x00, 0x0028, 0x284e},
-       {0x00, 0x0028, 0x284f},
-
-       {0x00, 0x000a, 0x2850},
-       {0x00, 0x000a, 0x2851},
-       {0x00, 0x0016, 0x2852},
-       {0x00, 0x0028, 0x2853},
-       {0x00, 0x0028, 0x2854},
-       {0x00, 0x0028, 0x2855},
-       {0x00, 0x0028, 0x2856},
-       {0x00, 0x0028, 0x2857},
-       {0x00, 0x0013, 0x2858},
-       {0x00, 0x001a, 0x2859},
-       {0x00, 0x0028, 0x285a},
-       {0x00, 0x0028, 0x285b},
-       {0x00, 0x0028, 0x285c},
-       {0x00, 0x0028, 0x285d},
-       {0x00, 0x0028, 0x285e},
-       {0x00, 0x0028, 0x285f},
-
-       {0x00, 0x0028, 0x2860},
-       {0x00, 0x0028, 0x2861},
-       {0x00, 0x0028, 0x2862},
-       {0x00, 0x0028, 0x2863},
-       {0x00, 0x0028, 0x2864},
-       {0x00, 0x0028, 0x2865},
-       {0x00, 0x0028, 0x2866},
-       {0x00, 0x0028, 0x2867},
-       {0x00, 0x0028, 0x2868},
-       {0x00, 0x0028, 0x2869},
-       {0x00, 0x0028, 0x286a},
-       {0x00, 0x0028, 0x286b},
-       {0x00, 0x0028, 0x286c},
-       {0x00, 0x0028, 0x286d},
-       {0x00, 0x0028, 0x286e},
-       {0x00, 0x0028, 0x286f},
-
-       {0x00, 0x0028, 0x2870},
-       {0x00, 0x0028, 0x2871},
-       {0x00, 0x0028, 0x2872},
-       {0x00, 0x0028, 0x2873},
-       {0x00, 0x0028, 0x2874},
-       {0x00, 0x0028, 0x2875},
-       {0x00, 0x0028, 0x2876},
-       {0x00, 0x0028, 0x2877},
-       {0x00, 0x0028, 0x2878},
-       {0x00, 0x0028, 0x2879},
-       {0x00, 0x0028, 0x287a},
-       {0x00, 0x0028, 0x287b},
-       {0x00, 0x0028, 0x287c},
-       {0x00, 0x0028, 0x287d},
-       {0x00, 0x0028, 0x287e},
-       {0x00, 0x0028, 0x287f},
 
        {0xa0, 0x0000, 0x0503},
 };
@@ -622,6 +486,20 @@ static void spca504_acknowledged_command(struct gspca_dev *gspca_dev,
        PDEBUG(D_FRAM, "after wait 0x%04x", notdone);
 }
 
+static void spca504_read_info(struct gspca_dev *gspca_dev)
+{
+       int i;
+       u8 info[6];
+
+       for (i = 0; i < 6; i++)
+               info[i] = reg_r_1(gspca_dev, i);
+       PDEBUG(D_STREAM,
+               "Read info: %d %d %d %d %d %d."
+               " Should be 1,0,2,2,0,0",
+               info[0], info[1], info[2],
+               info[3], info[4], info[5]);
+}
+
 static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev,
                        u8 req,
                        u16 idx, u16 val, u16 endcode, u8 count)
@@ -709,7 +587,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
                spca504B_PollingDataReady(gspca_dev);
 
                /* Init the cam width height with some values get on init ? */
-               reg_w_riv(gspca_dev, 0x31, 0, 0x04);
+               reg_w_riv(gspca_dev, 0x31, 0x0004, 0x00);
                spca504B_WaitCmdStatus(gspca_dev);
                spca504B_PollingDataReady(gspca_dev);
                break;
@@ -807,14 +685,14 @@ static void init_ctl_reg(struct gspca_dev *gspca_dev)
        default:
 /*     case BRIDGE_SPCA533: */
 /*     case BRIDGE_SPCA504B: */
-               reg_w_riv(gspca_dev, 0, 0x00, 0x21ad);  /* hue */
-               reg_w_riv(gspca_dev, 0, 0x01, 0x21ac);  /* sat/hue */
-               reg_w_riv(gspca_dev, 0, 0x00, 0x21a3);  /* gamma */
+               reg_w_riv(gspca_dev, 0, 0x21ad, 0x00);  /* hue */
+               reg_w_riv(gspca_dev, 0, 0x21ac, 0x01);  /* sat/hue */
+               reg_w_riv(gspca_dev, 0, 0x21a3, 0x00);  /* gamma */
                break;
        case BRIDGE_SPCA536:
-               reg_w_riv(gspca_dev, 0, 0x40, 0x20f5);
-               reg_w_riv(gspca_dev, 0, 0x01, 0x20f4);
-               reg_w_riv(gspca_dev, 0, 0x00, 0x2089);
+               reg_w_riv(gspca_dev, 0, 0x20f5, 0x40);
+               reg_w_riv(gspca_dev, 0, 0x20f4, 0x01);
+               reg_w_riv(gspca_dev, 0, 0x2089, 0x00);
                break;
        }
        if (pollreg)
@@ -881,17 +759,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
 static int sd_init(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int i;
-       u8 info[6];
 
        switch (sd->bridge) {
        case BRIDGE_SPCA504B:
                reg_w_riv(gspca_dev, 0x1d, 0x00, 0);
-               reg_w_riv(gspca_dev, 0, 0x01, 0x2306);
-               reg_w_riv(gspca_dev, 0, 0x00, 0x0d04);
-               reg_w_riv(gspca_dev, 0, 0x00, 0x2000);
-               reg_w_riv(gspca_dev, 0, 0x13, 0x2301);
-               reg_w_riv(gspca_dev, 0, 0x00, 0x2306);
+               reg_w_riv(gspca_dev, 0x00, 0x2306, 0x01);
+               reg_w_riv(gspca_dev, 0x00, 0x0d04, 0x00);
+               reg_w_riv(gspca_dev, 0x00, 0x2000, 0x00);
+               reg_w_riv(gspca_dev, 0x00, 0x2301, 0x13);
+               reg_w_riv(gspca_dev, 0x00, 0x2306, 0x00);
                /* fall thru */
        case BRIDGE_SPCA533:
                spca504B_PollingDataReady(gspca_dev);
@@ -924,15 +800,8 @@ static int sd_init(struct gspca_dev *gspca_dev)
 /*     case BRIDGE_SPCA504: */
                PDEBUG(D_STREAM, "Opening SPCA504");
                if (sd->subtype == AiptekMiniPenCam13) {
-                       /*****************************/
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
-                       /* spca504a aiptek */
+                       spca504_read_info(gspca_dev);
+
                        /* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
                        spca504A_acknowledged_command(gspca_dev, 0x24,
                                                        8, 3, 0x9e, 1);
@@ -971,8 +840,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int enable;
-       int i;
-       u8 info[6];
 
        /* create the JPEG header */
        sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
@@ -1000,7 +867,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                        spca504B_WaitCmdStatus(gspca_dev);
                        break;
                default:
-                       reg_w_riv(gspca_dev, 0x31, 0, 0x04);
+                       reg_w_riv(gspca_dev, 0x31, 0x0004, 0x00);
                        spca504B_WaitCmdStatus(gspca_dev);
                        spca504B_PollingDataReady(gspca_dev);
                        break;
@@ -1008,14 +875,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
                break;
        case BRIDGE_SPCA504:
                if (sd->subtype == AiptekMiniPenCam13) {
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
-                       /* spca504a aiptek */
+                       spca504_read_info(gspca_dev);
+
                        /* Set AE AWB Banding Type 3-> 50Hz 2-> 60Hz */
                        spca504A_acknowledged_command(gspca_dev, 0x24,
                                                        8, 3, 0x9e, 1);
@@ -1026,13 +887,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                                                        0, 0, 0x9d, 1);
                } else {
                        spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
-                       for (i = 0; i < 6; i++)
-                               info[i] = reg_r_1(gspca_dev, i);
-                       PDEBUG(D_STREAM,
-                               "Read info: %d %d %d %d %d %d."
-                               " Should be 1,0,2,2,0,0",
-                               info[0], info[1], info[2],
-                               info[3], info[4], info[5]);
+                       spca504_read_info(gspca_dev);
                        spca504_acknowledged_command(gspca_dev, 0x24, 8, 3);
                        spca504_acknowledged_command(gspca_dev, 0x24, 0, 0);
                }
@@ -1336,6 +1191,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
        {USB_DEVICE(0x04fc, 0x5330), BS(SPCA533, 0)},
        {USB_DEVICE(0x04fc, 0x5360), BS(SPCA536, 0)},
        {USB_DEVICE(0x04fc, 0xffff), BS(SPCA504B, 0)},
+       {USB_DEVICE(0x052b, 0x1507), BS(SPCA533, MegapixV4)},
        {USB_DEVICE(0x052b, 0x1513), BS(SPCA533, MegapixV4)},
        {USB_DEVICE(0x052b, 0x1803), BS(SPCA533, MegaImageVI)},
        {USB_DEVICE(0x0546, 0x3155), BS(SPCA533, 0)},
index 55ef6a7444279b3dda95ade85334c6f598667858..668a7536af90707686b3c12f761af86657b41507 100644 (file)
@@ -52,6 +52,7 @@ struct sd {
 #define SENSOR_OM6802 0
 #define SENSOR_OTHER 1
 #define SENSOR_TAS5130A 2
+#define SENSOR_LT168G 3     /* must verify if this is the actual model */
 };
 
 /* V4L2 controls supported by the driver */
@@ -78,7 +79,7 @@ static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_querymenu(struct gspca_dev *gspca_dev,
                        struct v4l2_querymenu *menu);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
         {
          .id = V4L2_CID_BRIGHTNESS,
@@ -306,6 +307,17 @@ static const u8 n4_tas5130a[] = {
        0xbe, 0x36, 0xbf, 0xff, 0xc2, 0x88, 0xc5, 0xc8,
        0xc6, 0xda
 };
+static const u8 n4_lt168g[] = {
+       0x66, 0x01, 0x7f, 0x00, 0x80, 0x7c, 0x81, 0x28,
+       0x83, 0x44, 0x84, 0x20, 0x86, 0x20, 0x8a, 0x70,
+       0x8b, 0x58, 0x8c, 0x88, 0x8d, 0xa0, 0x8e, 0xb3,
+       0x8f, 0x24, 0xa1, 0xb0, 0xa2, 0x38, 0xa5, 0x20,
+       0xa6, 0x4a, 0xa8, 0xe8, 0xaf, 0x38, 0xb0, 0x68,
+       0xb1, 0x44, 0xb2, 0x88, 0xbb, 0x86, 0xbd, 0x40,
+       0xbe, 0x26, 0xc1, 0x05, 0xc2, 0x88, 0xc5, 0xc0,
+       0xda, 0x8e, 0xdb, 0xca, 0xdc, 0xa8, 0xdd, 0x8c,
+       0xde, 0x44, 0xdf, 0x0c, 0xe9, 0x80
+};
 
 static const struct additional_sensor_data sensor_data[] = {
     {                          /* 0: OM6802 */
@@ -380,6 +392,23 @@ static const struct additional_sensor_data sensor_data[] = {
        .stream =
                {0x0b, 0x04, 0x0a, 0x40},
     },
+    {                          /* 3: LT168G */
+       .n3 = {0x61, 0xc2, 0x65, 0x68, 0x60, 0x00},
+       .n4 = n4_lt168g,
+       .n4sz = sizeof n4_lt168g,
+       .reg80 = 0x7c,
+       .reg8e = 0xb3,
+       .nset8 = {0xa8, 0xf0, 0xc6, 0xba, 0xc0, 0x00},
+       .data1 = {0xc0, 0x38, 0x08, 0x10, 0xc0, 0x30, 0x10, 0x40,
+                0xb0, 0xf4},
+       .data2 = {0x40, 0x80, 0xc0, 0x50, 0xa0, 0xf0, 0x53, 0xa6,
+                0xff},
+       .data3 = {0x40, 0x80, 0xc0, 0x50, 0xa0, 0xf0, 0x53, 0xa6,
+                0xff},
+       .data4 = {0x66, 0x41, 0xa8, 0xf0},
+       .data5 = {0x0c, 0x03, 0xab, 0x4b, 0x81, 0x2b},
+       .stream = {0x0b, 0x04, 0x0a, 0x28},
+    },
 };
 
 #define MAX_EFFECTS 7
@@ -716,6 +745,10 @@ static int sd_init(struct gspca_dev *gspca_dev)
                PDEBUG(D_PROBE, "sensor tas5130a");
                sd->sensor = SENSOR_TAS5130A;
                break;
+       case 0x0802:
+               PDEBUG(D_PROBE, "sensor lt168g");
+               sd->sensor = SENSOR_LT168G;
+               break;
        case 0x0803:
                PDEBUG(D_PROBE, "sensor 'other'");
                sd->sensor = SENSOR_OTHER;
@@ -758,6 +791,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
        reg_w_buf(gspca_dev, sensor->n3, sizeof sensor->n3);
        reg_w_buf(gspca_dev, sensor->n4, sensor->n4sz);
 
+       if (sd->sensor == SENSOR_LT168G) {
+               test_byte = reg_r(gspca_dev, 0x80);
+               PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", 0x80,
+                      test_byte);
+               reg_w(gspca_dev, 0x6c80);
+       }
+
        reg_w_ixbuf(gspca_dev, 0xd0, sensor->data1, sizeof sensor->data1);
        reg_w_ixbuf(gspca_dev, 0xc7, sensor->data2, sizeof sensor->data2);
        reg_w_ixbuf(gspca_dev, 0xe0, sensor->data3, sizeof sensor->data3);
@@ -782,6 +822,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
        reg_w_buf(gspca_dev, sensor->nset8, sizeof sensor->nset8);
        reg_w_buf(gspca_dev, sensor->stream, sizeof sensor->stream);
 
+       if (sd->sensor == SENSOR_LT168G) {
+               test_byte = reg_r(gspca_dev, 0x80);
+               PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", 0x80,
+                      test_byte);
+               reg_w(gspca_dev, 0x6c80);
+       }
+
        reg_w_ixbuf(gspca_dev, 0xd0, sensor->data1, sizeof sensor->data1);
        reg_w_ixbuf(gspca_dev, 0xc7, sensor->data2, sizeof sensor->data2);
        reg_w_ixbuf(gspca_dev, 0xe0, sensor->data3, sizeof sensor->data3);
@@ -888,6 +935,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
        case SENSOR_OM6802:
                om6802_sensor_init(gspca_dev);
                break;
+       case SENSOR_LT168G:
+               break;
        case SENSOR_OTHER:
                break;
        default:
index b74a3b6489c77a87087bcd6b22513df536eead79..c7b6eb1e04d56b2b58fa4217e762b8f3dc50881c 100644 (file)
@@ -39,7 +39,7 @@ struct sd {
 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
        {
         {
          .id = V4L2_CID_BRIGHTNESS,
index c090efcd80454e605e3935cbd3ef2231300e5dee..4989f9afb46e24b2de64290d7ac2adf7a5835461 100644 (file)
@@ -32,10 +32,13 @@ MODULE_LICENSE("GPL");
 struct sd {
        struct gspca_dev gspca_dev;     /* !! must be the first item */
 
+       u8 brightness;
+       u8 contrast;
+       u8 colors;
        u8 hflip;
        u8 vflip;
        u8 lightfreq;
-       u8 sharpness;
+       s8 sharpness;
 
        u8 image_offset;
 
@@ -52,6 +55,7 @@ struct sd {
 #define SENSOR_OV7670 6
 #define SENSOR_PO1200 7
 #define SENSOR_PO3130NC 8
+#define SENSOR_POxxxx 9
        u8 flags;
 #define FL_SAMSUNG 0x01                /* SamsungQ1 (2 sensors) */
 #define FL_HFLIP 0x02          /* mirrored by default */
@@ -59,6 +63,12 @@ struct sd {
 };
 
 /* V4L2 controls supported by the driver */
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
+static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
+static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
@@ -68,9 +78,54 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
+#define BRIGHTNESS_IDX 0
+       {
+           {
+               .id      = V4L2_CID_BRIGHTNESS,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Brightness",
+               .minimum = 0,
+               .maximum = 255,
+               .step    = 1,
+#define BRIGHTNESS_DEF 128
+               .default_value = BRIGHTNESS_DEF,
+           },
+           .set = sd_setbrightness,
+           .get = sd_getbrightness,
+       },
+#define CONTRAST_IDX 1
+       {
+           {
+               .id      = V4L2_CID_CONTRAST,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Contrast",
+               .minimum = 0,
+               .maximum = 255,
+               .step    = 1,
+#define CONTRAST_DEF 127
+               .default_value = CONTRAST_DEF,
+           },
+           .set = sd_setcontrast,
+           .get = sd_getcontrast,
+       },
+#define COLORS_IDX 2
+       {
+           {
+               .id      = V4L2_CID_SATURATION,
+               .type    = V4L2_CTRL_TYPE_INTEGER,
+               .name    = "Saturation",
+               .minimum = 1,
+               .maximum = 127,
+               .step    = 1,
+#define COLOR_DEF 63
+               .default_value = COLOR_DEF,
+           },
+           .set = sd_setcolors,
+           .get = sd_getcolors,
+       },
 /* next 2 controls work with some sensors only */
-#define HFLIP_IDX 0
+#define HFLIP_IDX 3
        {
            {
                .id      = V4L2_CID_HFLIP,
@@ -85,7 +140,7 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_sethflip,
            .get = sd_gethflip,
        },
-#define VFLIP_IDX 1
+#define VFLIP_IDX 4
        {
            {
                .id      = V4L2_CID_VFLIP,
@@ -100,7 +155,7 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setvflip,
            .get = sd_getvflip,
        },
-#define LIGHTFREQ_IDX 2
+#define LIGHTFREQ_IDX 5
        {
            {
                .id      = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -115,17 +170,16 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setfreq,
            .get = sd_getfreq,
        },
-/* po1200 only */
-#define SHARPNESS_IDX 3
+#define SHARPNESS_IDX 6
        {
         {
          .id = V4L2_CID_SHARPNESS,
          .type = V4L2_CTRL_TYPE_INTEGER,
          .name = "Sharpness",
-         .minimum = 0,
+         .minimum = -1,
          .maximum = 2,
          .step = 1,
-#define SHARPNESS_DEF 1
+#define SHARPNESS_DEF -1
          .default_value = SHARPNESS_DEF,
          },
         .set = sd_setsharpness,
@@ -133,6 +187,42 @@ static struct ctrl sd_ctrls[] = {
         },
 };
 
+/* table of the disabled controls */
+static u32 ctrl_dis[] = {
+/* SENSOR_HV7131R 0 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
+               | (1 << SHARPNESS_IDX),
+/* SENSOR_MI0360 1 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
+               | (1 << SHARPNESS_IDX),
+/* SENSOR_MI1310_SOC 2 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX),
+/* SENSOR_MI1320 3 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX),
+/* SENSOR_MI1320_SOC 4 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX),
+/* SENSOR_OV7660 5 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX),
+/* SENSOR_OV7670 6 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << SHARPNESS_IDX),
+/* SENSOR_PO1200 7 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << LIGHTFREQ_IDX),
+/* SENSOR_PO3130NC 8 */
+       (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX)
+               | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX)
+               | (1 << SHARPNESS_IDX),
+/* SENSOR_POxxxx 9 */
+       (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX),
+};
+
 static const struct v4l2_pix_format vc0321_mode[] = {
        {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE,
                .bytesperline = 320,
@@ -215,7 +305,7 @@ static const u8 mi0360_initVGA_JPG[][4] = {
        {0xb3, 0x15, 0x00, 0xcc},
        {0xb3, 0x16, 0x02, 0xcc},
        {0xb3, 0x17, 0x7f, 0xcc},
-       {0xb3, 0x35, 0xdd, 0xcc},
+       {0xb3, 0x35, 0xdd, 0xcc},       /* i2c add: 5d */
        {0xb3, 0x34, 0x02, 0xcc},
        {0xb3, 0x00, 0x25, 0xcc},
        {0xbc, 0x00, 0x71, 0xcc},
@@ -435,7 +525,7 @@ static const u8 mi1310_socinitVGA_JPG[][4] = {
        {0xb3, 0x08, 0x01, 0xcc},
        {0xb3, 0x09, 0x0c, 0xcc},
        {0xb3, 0x34, 0x02, 0xcc},
-       {0xb3, 0x35, 0xdd, 0xcc},
+       {0xb3, 0x35, 0xdd, 0xcc},       /* i2c add: 5d */
        {0xb3, 0x02, 0x00, 0xcc},
        {0xb3, 0x03, 0x0a, 0xcc},
        {0xb3, 0x04, 0x05, 0xcc},
@@ -860,7 +950,8 @@ static const u8 mi1320_initVGA_data[][4] = {
        {0xb0, 0x16, 0x03, 0xcc},       {0xb3, 0x05, 0x00, 0xcc},
        {0xb3, 0x06, 0x00, 0xcc},       {0xb3, 0x08, 0x01, 0xcc},
        {0xb3, 0x09, 0x0c, 0xcc},       {0xb3, 0x34, 0x02, 0xcc},
-       {0xb3, 0x35, 0xc8, 0xcc},       {0xb3, 0x02, 0x00, 0xcc},
+       {0xb3, 0x35, 0xc8, 0xcc},       /* i2c add: 48 */
+       {0xb3, 0x02, 0x00, 0xcc},
        {0xb3, 0x03, 0x0a, 0xcc},       {0xb3, 0x04, 0x05, 0xcc},
        {0xb3, 0x20, 0x00, 0xcc},       {0xb3, 0x21, 0x00, 0xcc},
        {0xb3, 0x22, 0x03, 0xcc},       {0xb3, 0x23, 0xc0, 0xcc},
@@ -901,7 +992,8 @@ static const u8 mi1320_initVGA_data[][4] = {
        {0xc3, 0x01, 0x03, 0xbb},       {0xc4, 0x00, 0x04, 0xbb},
        {0xf0, 0x00, 0x00, 0xbb},       {0x05, 0x01, 0x13, 0xbb},
        {0x06, 0x00, 0x11, 0xbb},       {0x07, 0x00, 0x85, 0xbb},
-       {0x08, 0x00, 0x27, 0xbb},       {0x20, 0x01, 0x03, 0xbb},
+       {0x08, 0x00, 0x27, 0xbb},
+       {0x20, 0x01, 0x00, 0xbb},       /* h/v flips - was 03 */
        {0x21, 0x80, 0x00, 0xbb},       {0x22, 0x0d, 0x0f, 0xbb},
        {0x24, 0x80, 0x00, 0xbb},       {0x59, 0x00, 0xff, 0xbb},
        {0xf0, 0x00, 0x02, 0xbb},       {0x39, 0x03, 0x0d, 0xbb},
@@ -1012,7 +1104,7 @@ static const u8 mi1320_soc_InitVGA[][4] = {
        {0xb3, 0x08, 0x01, 0xcc},
        {0xb3, 0x09, 0x0c, 0xcc},
        {0xb3, 0x34, 0x02, 0xcc},
-       {0xb3, 0x35, 0xc8, 0xcc},
+       {0xb3, 0x35, 0xc8, 0xcc},       /* i2c add: 48 */
        {0xb3, 0x02, 0x00, 0xcc},
        {0xb3, 0x03, 0x0a, 0xcc},
        {0xb3, 0x04, 0x05, 0xcc},
@@ -1359,7 +1451,8 @@ static const u8 po3130_initVGA_data[][4] = {
        {0xb3, 0x23, 0xe8, 0xcc},       {0xb8, 0x08, 0xe8, 0xcc},
        {0xb3, 0x14, 0x00, 0xcc},       {0xb3, 0x15, 0x00, 0xcc},
        {0xb3, 0x16, 0x02, 0xcc},       {0xb3, 0x17, 0x7f, 0xcc},
-       {0xb3, 0x34, 0x01, 0xcc},       {0xb3, 0x35, 0xf6, 0xcc},
+       {0xb3, 0x34, 0x01, 0xcc},
+       {0xb3, 0x35, 0xf6, 0xcc},       /* i2c add: 76 */
        {0xb3, 0x00, 0x27, 0xcc},       {0xbc, 0x00, 0x71, 0xcc},
        {0xb8, 0x00, 0x21, 0xcc},       {0xb8, 0x27, 0x20, 0xcc},
        {0xb8, 0x01, 0x79, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
@@ -1561,7 +1654,7 @@ static const u8 hv7131r_initVGA_data[][4] = {
        {0xb3, 0x16, 0x02, 0xcc},
        {0xb3, 0x17, 0x7f, 0xcc},
        {0xb3, 0x34, 0x01, 0xcc},
-       {0xb3, 0x35, 0x91, 0xcc},
+       {0xb3, 0x35, 0x91, 0xcc},       /* i2c add: 11 */
        {0xb3, 0x00, 0x27, 0xcc},
        {0xbc, 0x00, 0x73, 0xcc},
        {0xb8, 0x00, 0x23, 0xcc},
@@ -1747,7 +1840,8 @@ static const u8 ov7660_initVGA_data[][4] = {
        {0xb3, 0x23, 0xe0, 0xcc},       {0xb3, 0x1d, 0x01, 0xcc},
        {0xb3, 0x1f, 0x02, 0xcc},
        {0xb3, 0x34, 0x01, 0xcc},
-       {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x00, 0x26, 0xcc},
+       {0xb3, 0x35, 0xa1, 0xcc},       /* i2c add: 21 */
+       {0xb3, 0x00, 0x26, 0xcc},
        {0xb8, 0x00, 0x33, 0xcc}, /* 13 */
        {0xb8, 0x01, 0x7d, 0xcc},
        {0xbc, 0x00, 0x73, 0xcc},       {0xb8, 0x81, 0x09, 0xcc},
@@ -1883,7 +1977,8 @@ static const u8 ov7670_initVGA_JPG[][4] = {
        {0x00, 0x00, 0x10, 0xdd},
        {0xb0, 0x04, 0x02, 0xcc},       {0x00, 0x00, 0x10, 0xdd},
        {0xb3, 0x00, 0x66, 0xcc},       {0xb3, 0x00, 0x67, 0xcc},
-       {0xb3, 0x35, 0xa1, 0xcc},       {0xb3, 0x34, 0x01, 0xcc},
+       {0xb3, 0x35, 0xa1, 0xcc},       /* i2c add: 21 */
+       {0xb3, 0x34, 0x01, 0xcc},
        {0xb3, 0x05, 0x01, 0xcc},       {0xb3, 0x06, 0x01, 0xcc},
        {0xb3, 0x08, 0x01, 0xcc},       {0xb3, 0x09, 0x0c, 0xcc},
        {0xb3, 0x02, 0x02, 0xcc},       {0xb3, 0x03, 0x1f, 0xcc},
@@ -2181,7 +2276,7 @@ static const u8 po1200_initVGA_data[][4] = {
        {0xb0, 0x54, 0x13, 0xcc},
        {0xb3, 0x00, 0x67, 0xcc},
        {0xb3, 0x34, 0x01, 0xcc},
-       {0xb3, 0x35, 0xdc, 0xcc},
+       {0xb3, 0x35, 0xdc, 0xcc},       /* i2c add: 5c */
        {0x00, 0x03, 0x00, 0xaa},
        {0x00, 0x12, 0x05, 0xaa},
        {0x00, 0x13, 0x02, 0xaa},
@@ -2408,6 +2503,251 @@ static const u8 po1200_initVGA_data[][4] = {
        {0x00, 0xb6, 0x39, 0xaa},
        {0x00, 0xb7, 0x24, 0xaa},
 /*write 89 0400 1415*/
+       {}
+};
+
+static const u8 poxxxx_init_common[][4] = {
+       {0xb3, 0x00, 0x04, 0xcc},
+       {0x00, 0x00, 0x10, 0xdd},
+       {0xb3, 0x00, 0x64, 0xcc},
+       {0x00, 0x00, 0x10, 0xdd},
+       {0xb3, 0x00, 0x65, 0xcc},
+       {0x00, 0x00, 0x10, 0xdd},
+       {0xb3, 0x00, 0x67, 0xcc},
+       {0xb0, 0x03, 0x09, 0xcc},
+       {0xb3, 0x05, 0x00, 0xcc},
+       {0xb3, 0x06, 0x00, 0xcc},
+       {0xb3, 0x5c, 0x01, 0xcc},
+       {0xb3, 0x08, 0x01, 0xcc},
+       {0xb3, 0x09, 0x0c, 0xcc},
+       {0xb3, 0x34, 0x01, 0xcc},
+       {0xb3, 0x35, 0xf6, 0xcc},       /* i2c add: 76 */
+       {0xb3, 0x02, 0xb0, 0xcc},
+       {0xb3, 0x03, 0x18, 0xcc},
+       {0xb3, 0x04, 0x15, 0xcc},
+       {0xb3, 0x20, 0x00, 0xcc},
+       {0xb3, 0x21, 0x00, 0xcc},
+       {0xb3, 0x22, 0x04, 0xcc},
+       {0xb3, 0x23, 0x00, 0xcc},
+       {0xb3, 0x14, 0x00, 0xcc},
+       {0xb3, 0x15, 0x00, 0xcc},
+       {0xb3, 0x16, 0x04, 0xcc},
+       {0xb3, 0x17, 0xff, 0xcc},
+       {0xb3, 0x2c, 0x03, 0xcc},
+       {0xb3, 0x2d, 0x56, 0xcc},
+       {0xb3, 0x2e, 0x02, 0xcc},
+       {0xb3, 0x2f, 0x0a, 0xcc},
+       {0xb3, 0x40, 0x00, 0xcc},
+       {0xb3, 0x41, 0x34, 0xcc},
+       {0xb3, 0x42, 0x01, 0xcc},
+       {0xb3, 0x43, 0xe0, 0xcc},
+       {0xbc, 0x00, 0x71, 0xcc},
+       {0xbc, 0x01, 0x01, 0xcc},
+       {0xb3, 0x01, 0x41, 0xcc},
+       {0xb3, 0x4d, 0x00, 0xcc},
+       {0x00, 0x0b, 0x2a, 0xaa},
+       {0x00, 0x0e, 0x03, 0xaa},
+       {0x00, 0x0f, 0xea, 0xaa},
+       {0x00, 0x12, 0x08, 0xaa},
+       {0x00, 0x1e, 0x06, 0xaa},
+       {0x00, 0x21, 0x00, 0xaa},
+       {0x00, 0x31, 0x1f, 0xaa},
+       {0x00, 0x33, 0x38, 0xaa},
+       {0x00, 0x36, 0xc0, 0xaa},
+       {0x00, 0x37, 0xc8, 0xaa},
+       {0x00, 0x3b, 0x36, 0xaa},
+       {0x00, 0x4b, 0xfe, 0xaa},
+       {0x00, 0x4d, 0x2e, 0xaa},
+       {0x00, 0x51, 0x1c, 0xaa},
+       {0x00, 0x52, 0x01, 0xaa},
+       {0x00, 0x55, 0x0a, 0xaa},
+       {0x00, 0x56, 0x0a, 0xaa},
+       {0x00, 0x57, 0x07, 0xaa},
+       {0x00, 0x58, 0x07, 0xaa},
+       {0x00, 0x59, 0x04, 0xaa},
+       {0x00, 0x70, 0x68, 0xaa},
+       {0x00, 0x71, 0x04, 0xaa},
+       {0x00, 0x72, 0x10, 0xaa},
+       {0x00, 0x80, 0x71, 0xaa},
+       {0x00, 0x81, 0x08, 0xaa},
+       {0x00, 0x82, 0x00, 0xaa},
+       {0x00, 0x83, 0x55, 0xaa},
+       {0x00, 0x84, 0x06, 0xaa},
+       {0x00, 0x85, 0x06, 0xaa},
+       {0x00, 0x8b, 0x25, 0xaa},
+       {0x00, 0x8c, 0x00, 0xaa},
+       {0x00, 0x8d, 0x86, 0xaa},
+       {0x00, 0x8e, 0x82, 0xaa},
+       {0x00, 0x8f, 0x2d, 0xaa},
+       {0x00, 0x90, 0x8b, 0xaa},
+       {0x00, 0x91, 0x81, 0xaa},
+       {0x00, 0x92, 0x81, 0xaa},
+       {0x00, 0x93, 0x23, 0xaa},
+       {0x00, 0xa3, 0x2a, 0xaa},
+       {0x00, 0xa4, 0x03, 0xaa},
+       {0x00, 0xa5, 0xea, 0xaa},
+       {0x00, 0xb0, 0x68, 0xaa},
+       {0x00, 0xbc, 0x04, 0xaa},
+       {0x00, 0xbe, 0x3b, 0xaa},
+       {0x00, 0x4e, 0x40, 0xaa},
+       {0x00, 0x06, 0x04, 0xaa},
+       {0x00, 0x07, 0x03, 0xaa},
+       {0x00, 0xcd, 0x18, 0xaa},
+       {0x00, 0x28, 0x03, 0xaa},
+       {0x00, 0x29, 0xef, 0xaa},
+/* reinit on alt 2 (qvga) or alt7 (vga) */
+       {0xb3, 0x05, 0x00, 0xcc},
+       {0xb3, 0x06, 0x00, 0xcc},
+       {0xb8, 0x00, 0x01, 0xcc},
+
+       {0x00, 0x1d, 0x85, 0xaa},
+       {0x00, 0x1e, 0xc6, 0xaa},
+       {0x00, 0x00, 0x40, 0xdd},
+       {0x00, 0x1d, 0x05, 0xaa},
+
+       {0x00, 0xd6, 0x22, 0xaa},       /* gamma 0 */
+       {0x00, 0x73, 0x00, 0xaa},
+       {0x00, 0x74, 0x0a, 0xaa},
+       {0x00, 0x75, 0x16, 0xaa},
+       {0x00, 0x76, 0x25, 0xaa},
+       {0x00, 0x77, 0x34, 0xaa},
+       {0x00, 0x78, 0x49, 0xaa},
+       {0x00, 0x79, 0x5a, 0xaa},
+       {0x00, 0x7a, 0x7f, 0xaa},
+       {0x00, 0x7b, 0x9b, 0xaa},
+       {0x00, 0x7c, 0xba, 0xaa},
+       {0x00, 0x7d, 0xd4, 0xaa},
+       {0x00, 0x7e, 0xea, 0xaa},
+
+       {0x00, 0xd6, 0x62, 0xaa},       /* gamma 1 */
+       {0x00, 0x73, 0x00, 0xaa},
+       {0x00, 0x74, 0x0a, 0xaa},
+       {0x00, 0x75, 0x16, 0xaa},
+       {0x00, 0x76, 0x25, 0xaa},
+       {0x00, 0x77, 0x34, 0xaa},
+       {0x00, 0x78, 0x49, 0xaa},
+       {0x00, 0x79, 0x5a, 0xaa},
+       {0x00, 0x7a, 0x7f, 0xaa},
+       {0x00, 0x7b, 0x9b, 0xaa},
+       {0x00, 0x7c, 0xba, 0xaa},
+       {0x00, 0x7d, 0xd4, 0xaa},
+       {0x00, 0x7e, 0xea, 0xaa},
+
+       {0x00, 0xd6, 0xa2, 0xaa},       /* gamma 2 */
+       {0x00, 0x73, 0x00, 0xaa},
+       {0x00, 0x74, 0x0a, 0xaa},
+       {0x00, 0x75, 0x16, 0xaa},
+       {0x00, 0x76, 0x25, 0xaa},
+       {0x00, 0x77, 0x34, 0xaa},
+       {0x00, 0x78, 0x49, 0xaa},
+       {0x00, 0x79, 0x5a, 0xaa},
+       {0x00, 0x7a, 0x7f, 0xaa},
+       {0x00, 0x7b, 0x9b, 0xaa},
+       {0x00, 0x7c, 0xba, 0xaa},
+       {0x00, 0x7d, 0xd4, 0xaa},
+       {0x00, 0x7e, 0xea, 0xaa},
+
+       {0x00, 0xaa, 0xff, 0xaa},       /* back light comp */
+       {0x00, 0xc4, 0x03, 0xaa},
+       {0x00, 0xc5, 0x19, 0xaa},
+       {0x00, 0xc6, 0x03, 0xaa},
+       {0x00, 0xc7, 0x91, 0xaa},
+       {0x00, 0xc8, 0x01, 0xaa},
+       {0x00, 0xc9, 0xdd, 0xaa},
+       {0x00, 0xca, 0x02, 0xaa},
+       {0x00, 0xcb, 0x37, 0xaa},
+
+/* read d1 */
+       {0x00, 0xd1, 0x3c, 0xaa},
+       {0x00, 0xb8, 0x28, 0xaa},
+       {0x00, 0xb9, 0x1e, 0xaa},
+       {0x00, 0xb6, 0x14, 0xaa},
+       {0x00, 0xb7, 0x0f, 0xaa},
+       {0x00, 0x5c, 0x10, 0xaa},
+       {0x00, 0x5d, 0x18, 0xaa},
+       {0x00, 0x5e, 0x24, 0xaa},
+       {0x00, 0x5f, 0x24, 0xaa},
+       {0x00, 0x86, 0x1a, 0xaa},
+       {0x00, 0x60, 0x00, 0xaa},
+       {0x00, 0x61, 0x1b, 0xaa},
+       {0x00, 0x62, 0x30, 0xaa},
+       {0x00, 0x63, 0x40, 0xaa},
+       {0x00, 0x87, 0x1a, 0xaa},
+       {0x00, 0x64, 0x00, 0xaa},
+       {0x00, 0x65, 0x08, 0xaa},
+       {0x00, 0x66, 0x10, 0xaa},
+       {0x00, 0x67, 0x20, 0xaa},
+       {0x00, 0x88, 0x10, 0xaa},
+       {0x00, 0x68, 0x00, 0xaa},
+       {0x00, 0x69, 0x08, 0xaa},
+       {0x00, 0x6a, 0x0f, 0xaa},
+       {0x00, 0x6b, 0x0f, 0xaa},
+       {0x00, 0x89, 0x07, 0xaa},
+       {0x00, 0xd5, 0x4c, 0xaa},
+       {0x00, 0x0a, 0x00, 0xaa},
+       {0x00, 0x0b, 0x2a, 0xaa},
+       {0x00, 0x0e, 0x03, 0xaa},
+       {0x00, 0x0f, 0xea, 0xaa},
+       {0x00, 0xa2, 0x00, 0xaa},
+       {0x00, 0xa3, 0x2a, 0xaa},
+       {0x00, 0xa4, 0x03, 0xaa},
+       {0x00, 0xa5, 0xea, 0xaa},
+       {}
+};
+static const u8 poxxxx_initVGA[][4] = {
+       {0x00, 0x20, 0x11, 0xaa},
+       {0x00, 0x33, 0x38, 0xaa},
+       {0x00, 0xbb, 0x0d, 0xaa},
+       {0xb3, 0x22, 0x01, 0xcc},
+       {0xb3, 0x23, 0xe0, 0xcc},
+       {0xb3, 0x16, 0x02, 0xcc},
+       {0xb3, 0x17, 0x7f, 0xcc},
+       {0xb3, 0x02, 0xb0, 0xcc},
+       {0xb3, 0x06, 0x00, 0xcc},
+       {0xb3, 0x5c, 0x01, 0xcc},
+       {0x00, 0x04, 0x06, 0xaa},
+       {0x00, 0x05, 0x3f, 0xaa},
+       {0x00, 0x04, 0x00, 0xdd},       /* delay 1s */
+       {}
+};
+static const u8 poxxxx_initQVGA[][4] = {
+       {0x00, 0x20, 0x33, 0xaa},
+       {0x00, 0x33, 0x38, 0xaa},
+       {0x00, 0xbb, 0x0d, 0xaa},
+       {0xb3, 0x22, 0x00, 0xcc},
+       {0xb3, 0x23, 0xf0, 0xcc},
+       {0xb3, 0x16, 0x01, 0xcc},
+       {0xb3, 0x17, 0x3f, 0xcc},
+       {0xb3, 0x02, 0xb0, 0xcc},
+       {0xb3, 0x06, 0x01, 0xcc},
+       {0xb3, 0x5c, 0x00, 0xcc},
+       {0x00, 0x04, 0x06, 0xaa},
+       {0x00, 0x05, 0x3f, 0xaa},
+       {0x00, 0x04, 0x00, 0xdd},       /* delay 1s */
+       {}
+};
+static const u8 poxxxx_init_end_1[][4] = {
+       {0x00, 0x47, 0x25, 0xaa},
+       {0x00, 0x48, 0x80, 0xaa},
+       {0x00, 0x49, 0x1f, 0xaa},
+       {0x00, 0x4a, 0x40, 0xaa},
+       {0x00, 0x44, 0x40, 0xaa},
+       {0x00, 0xab, 0x4a, 0xaa},
+       {0x00, 0xb1, 0x00, 0xaa},
+       {0x00, 0xb2, 0x04, 0xaa},
+       {0x00, 0xb3, 0x08, 0xaa},
+       {0x00, 0xb4, 0x0b, 0xaa},
+       {0x00, 0xb5, 0x0d, 0xaa},
+       {0x00, 0x59, 0x7e, 0xaa},       /* sharpness */
+       {0x00, 0x16, 0x00, 0xaa},       /* white balance */
+       {0x00, 0x18, 0x00, 0xaa},
+       {}
+};
+static const u8 poxxxx_init_end_2[][4] = {
+       {0x00, 0x1d, 0x85, 0xaa},
+       {0x00, 0x1e, 0x06, 0xaa},
+       {0x00, 0x1d, 0x05, 0xaa},
+       {}
 };
 
 struct sensor_info {
@@ -2420,33 +2760,89 @@ struct sensor_info {
        u8 op;
 };
 
-static const struct sensor_info sensor_info_data[] = {
-/*      sensorId,         I2cAdd,      IdAdd,  VpId,  m1,    m2,  op */
+/* probe values */
+static const struct sensor_info vc0321_probe_data[] = {
+/*      sensorId,         I2cAdd,      IdAdd,  VpId,  m1,    m2,  op */
+/* 0 OV9640 */
        {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
+/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
        {-1,                0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
-/* (tested in vc032x_probe_sensor) */
-/*     {-1,                0x80 | 0x20, 0x83, 0x0000, 0x24, 0x25, 0x01}, */
-       {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
+/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
+       {-1,                0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 3 MI1310 */
+       {-1,                0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 4 MI360 - tested in vc032x_probe_sensor */
+/*     {SENSOR_MI0360,     0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
+/* 5 7131R */
+       {SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
+/* 6 OV7649 */
+       {-1,                0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
+/* 7 PAS302BCW */
+       {-1,                0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
+/* 8 OV7660 */
+       {SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
+/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
+/*     {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
+/* 10 PO1030KC */
+       {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 11 MI1310_SOC */
        {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
-/* (tested in vc032x_probe_sensor) */
+/* 12 OV9650 */
+       {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
+/* 13 S5K532 */
+       {-1,                0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
+/* 14 MI360_SOC - ??? */
+/* 15 PO1200N */
+       {SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
+/* 16 PO3030K */
+       {-1,                0x80 | 0x18, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 17 PO2030 */
+       {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* ?? */
+       {-1,                0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
+       {SENSOR_MI1320,     0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
+};
+static const struct sensor_info vc0323_probe_data[] = {
+/*      sensorId,         I2cAdd,      IdAdd,  VpId,  m1,    m2,  op */
+/* 0 OV9640 */
+       {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
+/* 1 ICM108T (may respond on IdAdd == 0x83 - tested in vc032x_probe_sensor) */
+       {-1,                0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
+/* 2 PO2130 (may detect PO3130NC - tested in vc032x_probe_sensor)*/
+       {-1,                0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 3 MI1310 */
+       {-1,                0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* 4 MI360 - tested in vc032x_probe_sensor */
 /*     {SENSOR_MI0360,     0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
+/* 5 7131R */
        {SENSOR_HV7131R,    0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
+/* 6 OV7649 */
        {-1,                0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
+/* 7 PAS302BCW */
        {-1,                0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
+/* 8 OV7660 */
        {SENSOR_OV7660,     0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
-/*     {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
+/* 9 PO3130NC - (tested in vc032x_probe_sensor) */
+/*     {SENSOR_PO3130NC,   0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, */
+/* 10 PO1030KC */
        {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
-/*     {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
-/*     {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, */
+/* 11 MI1310_SOC */
+       {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
+/* 12 OV9650 */
+       {-1,                0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
+/* 13 S5K532 */
        {-1,                0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
+/* 14 MI360_SOC - ??? */
+/* 15 PO1200N */
        {SENSOR_PO1200,     0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
+/* 16 ?? */
        {-1,                0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
+/* 17 PO2030 */
        {-1,                0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
+/* ?? */
        {-1,                0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
        {SENSOR_MI1320_SOC, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x67, 0x01},
-/*fixme: previously detected?*/
-       {SENSOR_MI1320,     0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
-/*fixme: not in the ms-win probe - may be found before?*/
+/*fixme: not in the ms-win probe - may be found before? */
        {SENSOR_OV7670,     0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
 };
 
@@ -2520,7 +2916,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
-       int i;
+       int i, n;
        u16 value;
        const struct sensor_info *ptsensor_info;
 
@@ -2531,9 +2927,16 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
        }
 
        reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
-       PDEBUG(D_PROBE, "check sensor header %02x", gspca_dev->usb_buf[0]);
-       for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) {
-               ptsensor_info = &sensor_info_data[i];
+       PDEBUG(D_PROBE, "vc032%d check sensor header %02x",
+               sd->bridge == BRIDGE_VC0321 ? 1 : 3, gspca_dev->usb_buf[0]);
+       if (sd->bridge == BRIDGE_VC0321) {
+               ptsensor_info = vc0321_probe_data;
+               n = ARRAY_SIZE(vc0321_probe_data);
+       } else {
+               ptsensor_info = vc0323_probe_data;
+               n = ARRAY_SIZE(vc0323_probe_data);
+       }
+       for (i = 0; i < n; i++) {
                reg_w(dev, 0xa0, 0x02, 0xb334);
                reg_w(dev, 0xa0, ptsensor_info->m1, 0xb300);
                reg_w(dev, 0xa0, ptsensor_info->m2, 0xb300);
@@ -2551,13 +2954,15 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
                                return ptsensor_info->sensorId;
 
                        switch (value) {
+                       case 0x3130:
+                               return SENSOR_PO3130NC;
                        case 0x7673:
                                return SENSOR_OV7670;
                        case 0x8243:
                                return SENSOR_MI0360;
                        }
-/*fixme: should return here*/
                }
+               ptsensor_info++;
        }
        return -1;
 }
@@ -2619,7 +3024,7 @@ static void usb_exchange(struct gspca_dev *gspca_dev,
                        i2c_write(gspca_dev, data[i][0], &data[i][1], 2);
                        break;
                case 0xdd:
-                       msleep(data[i][2] + 10);
+                       msleep(data[i][1] * 256 + data[i][2] + 10);
                        break;
                }
                i++;
@@ -2646,12 +3051,17 @@ static int sd_config(struct gspca_dev *gspca_dev,
                64,             /* OV7670 6 */
                128,            /* PO1200 7 */
                128,            /* PO3130NC 8 */
+               128,            /* POxxxx 9 */
        };
 
        cam = &gspca_dev->cam;
        sd->bridge = id->driver_info >> 8;
        sd->flags = id->driver_info & 0xff;
-       sensor = vc032x_probe_sensor(gspca_dev);
+       if (id->idVendor == 0x046d &&
+           (id->idProduct == 0x0892 || id->idProduct == 0x0896))
+               sensor = SENSOR_POxxxx;
+       else
+               sensor = vc032x_probe_sensor(gspca_dev);
        switch (sensor) {
        case -1:
                PDEBUG(D_PROBE, "Unknown sensor...");
@@ -2684,6 +3094,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
        case SENSOR_PO3130NC:
                PDEBUG(D_PROBE, "Find Sensor PO3130NC");
                break;
+       case SENSOR_POxxxx:
+               PDEBUG(D_PROBE, "Sensor POxxxx");
+               break;
        }
        sd->sensor = sensor;
 
@@ -2712,28 +3125,19 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
        cam->npkt = npkt[sd->sensor];
 
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+       sd->colors = COLOR_DEF;
        sd->hflip = HFLIP_DEF;
        sd->vflip = VFLIP_DEF;
-       if (sd->sensor == SENSOR_OV7670)
-               sd->flags |= FL_HFLIP | FL_VFLIP;
        sd->lightfreq = FREQ_DEF;
-       if (sd->sensor != SENSOR_OV7670)
-               gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX);
-       switch (sd->sensor) {
-       case SENSOR_MI1310_SOC:
-       case SENSOR_MI1320_SOC:
-       case SENSOR_OV7660:
-       case SENSOR_OV7670:
-       case SENSOR_PO1200:
-               break;
-       default:
-               gspca_dev->ctrl_dis = (1 << HFLIP_IDX)
-                                       | (1 << VFLIP_IDX);
-               break;
-       }
-
        sd->sharpness = SHARPNESS_DEF;
 
+       gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
+
+       if (sd->sensor == SENSOR_OV7670)
+               sd->flags |= FL_HFLIP | FL_VFLIP;
+
        if (sd->bridge == BRIDGE_VC0321) {
                reg_r(gspca_dev, 0x8a, 0, 3);
                reg_w(dev, 0x87, 0x00, 0x0f0f);
@@ -2747,10 +3151,55 @@ static int sd_config(struct gspca_dev *gspca_dev,
 /* this function is called at probe and resume time */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->sensor == SENSOR_POxxxx) {
+               reg_r(gspca_dev, 0xa1, 0xb300, 1);
+               if (gspca_dev->usb_buf[0] != 0) {
+                       reg_w(gspca_dev->dev, 0xa0, 0x26, 0xb300);
+                       reg_w(gspca_dev->dev, 0xa0, 0x04, 0xb300);
+                       reg_w(gspca_dev->dev, 0xa0, 0x00, 0xb300);
+               }
+       }
        return 0;
 }
 
-/* some sensors only */
+static void setbrightness(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 data;
+
+       if (gspca_dev->ctrl_dis & (1 << BRIGHTNESS_IDX))
+               return;
+       data = sd->brightness;
+       if (data >= 0x80)
+               data &= 0x7f;
+       else
+               data = 0xff ^ data;
+       i2c_write(gspca_dev, 0x98, &data, 1);
+}
+
+static void setcontrast(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (gspca_dev->ctrl_dis & (1 << CONTRAST_IDX))
+               return;
+       i2c_write(gspca_dev, 0x99, &sd->contrast, 1);
+}
+
+static void setcolors(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       u8 data;
+
+       if (gspca_dev->ctrl_dis & (1 << COLORS_IDX))
+               return;
+       data = sd->colors - (sd->colors >> 3) - 1;
+       i2c_write(gspca_dev, 0x94, &data, 1);
+       i2c_write(gspca_dev, 0x95, &sd->colors, 1);
+}
+
 static void sethvflip(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -2764,6 +3213,7 @@ static void sethvflip(struct gspca_dev *gspca_dev)
                vflip = !vflip;
        switch (sd->sensor) {
        case SENSOR_MI1310_SOC:
+       case SENSOR_MI1320:
        case SENSOR_MI1320_SOC:
                data[0] = data[1] = 0;          /* select page 0 */
                i2c_write(gspca_dev, 0xf0, data, 2);
@@ -2801,18 +3251,29 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
        usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
 }
 
-/* po1200 only */
 static void setsharpness(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        u8 data;
 
-       if (sd->sensor != SENSOR_PO1200)
-               return;
-       data = 0;
-       i2c_write(gspca_dev, 0x03, &data, 1);
-       data = 0xb5 + sd->sharpness * 3;
-       i2c_write(gspca_dev, 0x61, &data, 1);
+       switch (sd->sensor) {
+       case SENSOR_PO1200:
+               data = 0;
+               i2c_write(gspca_dev, 0x03, &data, 1);
+               if (sd->sharpness < 0)
+                       data = 0x6a;
+               else
+                       data = 0xb5 + sd->sharpness * 3;
+               i2c_write(gspca_dev, 0x61, &data, 1);
+               break;
+       case SENSOR_POxxxx:
+               if (sd->sharpness < 0)
+                       data = 0x7e;    /* def = max */
+               else
+                       data = 0x60 + sd->sharpness * 0x0f;
+               i2c_write(gspca_dev, 0x59, &data, 1);
+               break;
+       }
 }
 
 static int sd_start(struct gspca_dev *gspca_dev)
@@ -2922,12 +3383,27 @@ static int sd_start(struct gspca_dev *gspca_dev)
                usb_exchange(gspca_dev, init);
                init = po3130_rundata;
                break;
-       default:
-/*     case SENSOR_PO1200: */
+       case SENSOR_PO1200:
                GammaT = po1200_gamma;
                MatrixT = po1200_matrix;
                init = po1200_initVGA_data;
                break;
+       default:
+/*     case SENSOR_POxxxx: */
+               usb_exchange(gspca_dev, poxxxx_init_common);
+               if (mode)
+                       init = poxxxx_initQVGA;
+               else
+                       init = poxxxx_initVGA;
+               usb_exchange(gspca_dev, init);
+               reg_r(gspca_dev, 0x8c, 0x0000, 3);
+               reg_w(gspca_dev->dev, 0xa0,
+                               gspca_dev->usb_buf[2] & 1 ? 0 : 1,
+                               0xb35c);
+               msleep(300);
+/*fixme: i2c read 04 and 05*/
+               init = poxxxx_init_end_1;
+               break;
        }
        usb_exchange(gspca_dev, init);
        if (GammaT && MatrixT) {
@@ -2936,7 +3412,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
                put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
                put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
 
-               /* set the led on 0x0892 0x0896 */
                switch (sd->sensor) {
                case SENSOR_PO1200:
                case SENSOR_HV7131R:
@@ -2945,16 +3420,22 @@ static int sd_start(struct gspca_dev *gspca_dev)
                case SENSOR_MI1310_SOC:
                        reg_w(gspca_dev->dev, 0x89, 0x058c, 0x0000);
                        break;
-               default:
-                       if (!(sd->flags & FL_SAMSUNG))
-                               reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
-                       break;
                }
                msleep(100);
                setsharpness(gspca_dev);
                sethvflip(gspca_dev);
                setlightfreq(gspca_dev);
        }
+       if (sd->sensor == SENSOR_POxxxx) {
+               setcolors(gspca_dev);
+               setbrightness(gspca_dev);
+               setcontrast(gspca_dev);
+
+               /* led on */
+               msleep(80);
+               reg_w(gspca_dev->dev, 0x89, 0xffff, 0xfdff);
+               usb_exchange(gspca_dev, poxxxx_init_end_2);
+       }
        return 0;
 }
 
@@ -2963,10 +3444,17 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
        struct usb_device *dev = gspca_dev->dev;
        struct sd *sd = (struct sd *) gspca_dev;
 
-       if (sd->sensor == SENSOR_MI1310_SOC)
+       switch (sd->sensor) {
+       case SENSOR_MI1310_SOC:
                reg_w(dev, 0x89, 0x058c, 0x00ff);
-       else if (!(sd->flags & FL_SAMSUNG))
-               reg_w(dev, 0x89, 0xffff, 0xffff);
+               break;
+       case SENSOR_POxxxx:
+               return;
+       default:
+               if (!(sd->flags & FL_SAMSUNG))
+                       reg_w(dev, 0x89, 0xffff, 0xffff);
+               break;
+       }
        reg_w(dev, 0xa0, 0x01, 0xb301);
        reg_w(dev, 0xa0, 0x09, 0xb003);
 }
@@ -2984,6 +3472,12 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
                reg_w(dev, 0x89, 0x058c, 0x00ff);
        else if (!(sd->flags & FL_SAMSUNG))
                reg_w(dev, 0x89, 0xffff, 0xffff);
+
+       if (sd->sensor == SENSOR_POxxxx) {
+               reg_w(dev, 0xa0, 0x26, 0xb300);
+               reg_w(dev, 0xa0, 0x04, 0xb300);
+               reg_w(dev, 0xa0, 0x00, 0xb300);
+       }
 }
 
 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
@@ -3009,6 +3503,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                int l;
 
                frame = gspca_get_i_frame(gspca_dev);
+               if (frame == NULL) {
+                       gspca_dev->last_packet_type = DISCARD_PACKET;
+                       return;
+               }
                l = frame->data_end - frame->data;
                if (len > frame->v4l2_buf.length - l)
                        len = frame->v4l2_buf.length - l;
@@ -3016,6 +3514,60 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
 }
 
+static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->brightness = val;
+       if (gspca_dev->streaming)
+               setbrightness(gspca_dev);
+       return 0;
+}
+
+static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->brightness;
+       return 0;
+}
+
+static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->contrast = val;
+       if (gspca_dev->streaming)
+               setcontrast(gspca_dev);
+       return 0;
+}
+
+static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->contrast;
+       return 0;
+}
+
+static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->colors = val;
+       if (gspca_dev->streaming)
+               setcolors(gspca_dev);
+       return 0;
+}
+
+static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->colors;
+       return 0;
+}
+
 static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
 {
        struct sd *sd = (struct sd *) gspca_dev;
index 1a800fc1c00e6e77bfe515e9dba3b20e919d7581..50986da3d912038d28c875d9820bea1d0d87d787 100644 (file)
@@ -1,9 +1,8 @@
 /*
- *     Z-Star/Vimicro zc301/zc302p/vc30x library
- *     Copyright (C) 2004 2005 2006 Michel Xhaard
- *             mxhaard@magic.fr
+ * Z-Star/Vimicro zc301/zc302p/vc30x library
  *
- * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
+ * Copyright (C) 2009-2010 Jean-Francois Moine <http://moinejf.free.fr>
+ * Copyright (C) 2004 2005 2006 Michel Xhaard mxhaard@magic.fr
  *
  * 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
 
 #define MODULE_NAME "zc3xx"
 
+#include <linux/input.h>
 #include "gspca.h"
 #include "jpeg.h"
 
-MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
+MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, "
                "Serge A. Suchkov <Serge.A.S@tochka.ru>");
 MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver");
 MODULE_LICENSE("GPL");
@@ -39,18 +39,18 @@ static int force_sensor = -1;
 struct sd {
        struct gspca_dev gspca_dev;     /* !! must be the first item */
 
-       __u8 brightness;
-       __u8 contrast;
-       __u8 gamma;
-       __u8 autogain;
-       __u8 lightfreq;
-       __u8 sharpness;
+       u8 brightness;
+       u8 contrast;
+       u8 gamma;
+       u8 autogain;
+       u8 lightfreq;
+       u8 sharpness;
        u8 quality;                     /* image quality */
 #define QUALITY_MIN 40
 #define QUALITY_MAX 60
 #define QUALITY_DEF 50
 
-       signed char sensor;             /* Type of image sensor chip */
+       u8 sensor;              /* Type of image sensor chip */
 /* !! values used in different tables */
 #define SENSOR_ADCM2700 0
 #define SENSOR_CS2102 1
@@ -92,9 +92,8 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
 static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
 static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
 
-static struct ctrl sd_ctrls[] = {
+static const struct ctrl sd_ctrls[] = {
 #define BRIGHTNESS_IDX 0
-#define SD_BRIGHTNESS 0
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -103,26 +102,26 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-               .default_value = 128,
+#define BRIGHTNESS_DEF 128
+               .default_value = BRIGHTNESS_DEF,
            },
            .set = sd_setbrightness,
            .get = sd_getbrightness,
        },
-#define SD_CONTRAST 1
        {
            {
                .id      = V4L2_CID_CONTRAST,
                .type    = V4L2_CTRL_TYPE_INTEGER,
                .name    = "Contrast",
                .minimum = 0,
-               .maximum = 256,
+               .maximum = 255,
                .step    = 1,
-               .default_value = 128,
+#define CONTRAST_DEF 128
+               .default_value = CONTRAST_DEF,
            },
            .set = sd_setcontrast,
            .get = sd_getcontrast,
        },
-#define SD_GAMMA 2
        {
            {
                .id      = V4L2_CID_GAMMA,
@@ -136,7 +135,6 @@ static struct ctrl sd_ctrls[] = {
            .set = sd_setgamma,
            .get = sd_getgamma,
        },
-#define SD_AUTOGAIN 3
        {
            {
                .id      = V4L2_CID_AUTOGAIN,
@@ -145,13 +143,13 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 1,
                .step    = 1,
-               .default_value = 1,
+#define AUTOGAIN_DEF 1
+               .default_value = AUTOGAIN_DEF,
            },
            .set = sd_setautogain,
            .get = sd_getautogain,
        },
 #define LIGHTFREQ_IDX 4
-#define SD_FREQ 4
        {
            {
                .id      = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -160,12 +158,12 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 2,   /* 0: 0, 1: 50Hz, 2:60Hz */
                .step    = 1,
-               .default_value = 1,
+#define FREQ_DEF 0
+               .default_value = FREQ_DEF,
            },
            .set = sd_setfreq,
            .get = sd_getfreq,
        },
-#define SD_SHARPNESS 5
        {
            {
                .id      = V4L2_CID_SHARPNESS,
@@ -174,7 +172,8 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 3,
                .step    = 1,
-               .default_value = 2,
+#define SHARPNESS_DEF 2
+               .default_value = SHARPNESS_DEF,
            },
            .set = sd_setsharpness,
            .get = sd_getsharpness,
@@ -194,6 +193,19 @@ static const struct v4l2_pix_format vga_mode[] = {
                .priv = 0},
 };
 
+static const struct v4l2_pix_format broken_vga_mode[] = {
+       {320, 232, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 320,
+               .sizeimage = 320 * 232 * 4 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG,
+               .priv = 1},
+       {640, 472, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+               .bytesperline = 640,
+               .sizeimage = 640 * 472 * 3 / 8 + 590,
+               .colorspace = V4L2_COLORSPACE_JPEG,
+               .priv = 0},
+};
+
 static const struct v4l2_pix_format sif_mode[] = {
        {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
                .bytesperline = 176,
@@ -209,9 +221,9 @@ static const struct v4l2_pix_format sif_mode[] = {
 
 /* usb exchanges */
 struct usb_action {
-       __u8    req;
-       __u8    val;
-       __u16   idx;
+       u8      req;
+       u8      val;
+       u16     idx;
 };
 
 static const struct usb_action adcm2700_Initial[] = {
@@ -421,7 +433,7 @@ static const struct usb_action adcm2700_NoFliker[] = {
        {0xaa, 0xfe, 0x0010},                           /* 00,fe,10,aa */
        {}
 };
-static const struct usb_action cs2102_Initial[] = {    /* 320x240 */
+static const struct usb_action cs2102_InitialScale[] = {       /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
@@ -473,7 +485,7 @@ static const struct usb_action cs2102_Initial[] = { /* 320x240 */
        {}
 };
 
-static const struct usb_action cs2102_InitialScale[] = {       /* 640x480 */
+static const struct usb_action cs2102_Initial[] = {    /* 640x480 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
@@ -524,7 +536,7 @@ static const struct usb_action cs2102_InitialScale[] = {    /* 640x480 */
        {0xa0, 0x00, 0x01ad},
        {}
 };
-static const struct usb_action cs2102_50HZ[] = {
+static const struct usb_action cs2102_50HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0001},
        {0xaa, 0x24, 0x005f},
@@ -546,7 +558,7 @@ static const struct usb_action cs2102_50HZ[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
        {}
 };
-static const struct usb_action cs2102_50HZScale[] = {
+static const struct usb_action cs2102_50HZ[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0000},
        {0xaa, 0x24, 0x00af},
@@ -568,7 +580,7 @@ static const struct usb_action cs2102_50HZScale[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
        {}
 };
-static const struct usb_action cs2102_60HZ[] = {
+static const struct usb_action cs2102_60HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0001},
        {0xaa, 0x24, 0x0055},
@@ -590,7 +602,7 @@ static const struct usb_action cs2102_60HZ[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
        {}
 };
-static const struct usb_action cs2102_60HZScale[] = {
+static const struct usb_action cs2102_60HZ[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0000},
        {0xaa, 0x24, 0x00aa},
@@ -612,7 +624,7 @@ static const struct usb_action cs2102_60HZScale[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
        {}
 };
-static const struct usb_action cs2102_NoFliker[] = {
+static const struct usb_action cs2102_NoFlikerScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0001},
        {0xaa, 0x24, 0x005f},
@@ -634,7 +646,7 @@ static const struct usb_action cs2102_NoFliker[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3},
        {}
 };
-static const struct usb_action cs2102_NoFlikerScale[] = {
+static const struct usb_action cs2102_NoFliker[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
        {0xaa, 0x23, 0x0000},
        {0xaa, 0x24, 0x00af},
@@ -658,7 +670,7 @@ static const struct usb_action cs2102_NoFlikerScale[] = {
 };
 
 /* CS2102_KOCOM */
-static const struct usb_action cs2102K_Initial[] = {
+static const struct usb_action cs2102K_InitialScale[] = {
        {0xa0, 0x11, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
        {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT},
@@ -917,7 +929,7 @@ static const struct usb_action cs2102K_Initial[] = {
        {}
 };
 
-static const struct usb_action cs2102K_InitialScale[] = {
+static const struct usb_action cs2102K_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
@@ -1495,7 +1507,7 @@ static const struct usb_action gc0305_NoFliker[] = {
        {}
 };
 
-static const struct usb_action hdcs2020xb_Initial[] = {
+static const struct usb_action hdcs2020b_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x11, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},  /* qtable 0x05 */
@@ -1627,7 +1639,7 @@ static const struct usb_action hdcs2020xb_Initial[] = {
        {0xa0, 0x40, ZC3XX_R118_BGAIN},
        {}
 };
-static const struct usb_action hdcs2020xb_InitialScale[] = {
+static const struct usb_action hdcs2020b_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
@@ -1819,7 +1831,7 @@ static const struct usb_action hdcs2020b_NoFliker[] = {
        {}
 };
 
-static const struct usb_action hv7131bxx_Initial[] = {         /* 320x240 */
+static const struct usb_action hv7131b_InitialScale[] = {      /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
@@ -1866,7 +1878,7 @@ static const struct usb_action hv7131bxx_Initial[] = {            /* 320x240 */
        {}
 };
 
-static const struct usb_action hv7131bxx_InitialScale[] = {    /* 640x480*/
+static const struct usb_action hv7131b_Initial[] = {   /* 640x480*/
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT},
@@ -2063,7 +2075,7 @@ static const struct usb_action hv7131b_NoFlikerScale[] = { /* 320x240 */
        {}
 };
 
-static const struct usb_action hv7131cxx_Initial[] = {
+static const struct usb_action hv7131r_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},
@@ -2157,7 +2169,7 @@ static const struct usb_action hv7131cxx_Initial[] = {
        {}
 };
 
-static const struct usb_action hv7131cxx_InitialScale[] = {
+static const struct usb_action hv7131r_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
 
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},   /* diff */
@@ -2259,7 +2271,7 @@ static const struct usb_action hv7131cxx_InitialScale[] = {
        {}
 };
 
-static const struct usb_action icm105axx_Initial[] = {
+static const struct usb_action icm105a_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
@@ -2436,7 +2448,7 @@ static const struct usb_action icm105axx_Initial[] = {
        {}
 };
 
-static const struct usb_action icm105axx_InitialScale[] = {
+static const struct usb_action icm105a_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
@@ -2615,7 +2627,7 @@ static const struct usb_action icm105axx_InitialScale[] = {
        {0xa0, 0x40, ZC3XX_R118_BGAIN},
        {}
 };
-static const struct usb_action icm105a_50HZ[] = {
+static const struct usb_action icm105a_50HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */
@@ -2646,7 +2658,7 @@ static const struct usb_action icm105a_50HZ[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
        {}
 };
-static const struct usb_action icm105a_50HZScale[] = {
+static const struct usb_action icm105a_50HZ[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */
@@ -2679,7 +2691,7 @@ static const struct usb_action icm105a_50HZScale[] = {
        {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */
        {}
 };
-static const struct usb_action icm105a_60HZ[] = {
+static const struct usb_action icm105a_60HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -2710,7 +2722,7 @@ static const struct usb_action icm105a_60HZ[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
        {}
 };
-static const struct usb_action icm105a_60HZScale[] = {
+static const struct usb_action icm105a_60HZ[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */
@@ -2743,7 +2755,7 @@ static const struct usb_action icm105a_60HZScale[] = {
        {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */
        {}
 };
-static const struct usb_action icm105a_NoFliker[] = {
+static const struct usb_action icm105a_NoFlikerScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -2774,7 +2786,7 @@ static const struct usb_action icm105a_NoFliker[] = {
        {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */
        {}
 };
-static const struct usb_action icm105a_NoFlikerScale[] = {
+static const struct usb_action icm105a_NoFliker[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
        {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
        {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -2808,7 +2820,7 @@ static const struct usb_action icm105a_NoFlikerScale[] = {
        {}
 };
 
-static const struct usb_action MC501CB_InitialScale[] = {
+static const struct usb_action mc501cb_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 00,02,00,cc */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
@@ -2928,7 +2940,7 @@ static const struct usb_action MC501CB_InitialScale[] = {
        {}
 };
 
-static const struct usb_action MC501CB_Initial[] = {    /* 320x240 */
+static const struct usb_action mc501cb_InitialScale[] = {       /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
@@ -3047,7 +3059,7 @@ static const struct usb_action MC501CB_Initial[] = {       /* 320x240 */
        {}
 };
 
-static const struct usb_action MC501CB_50HZ[] = {
+static const struct usb_action mc501cb_50HZScale[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
@@ -3064,7 +3076,7 @@ static const struct usb_action MC501CB_50HZ[] = {
        {}
 };
 
-static const struct usb_action MC501CB_50HZScale[] = {
+static const struct usb_action mc501cb_50HZ[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */
@@ -3081,7 +3093,7 @@ static const struct usb_action MC501CB_50HZScale[] = {
        {}
 };
 
-static const struct usb_action MC501CB_60HZ[] = {
+static const struct usb_action mc501cb_60HZScale[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
@@ -3098,7 +3110,7 @@ static const struct usb_action MC501CB_60HZ[] = {
        {}
 };
 
-static const struct usb_action MC501CB_60HZScale[] = {
+static const struct usb_action mc501cb_60HZ[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
@@ -3115,7 +3127,7 @@ static const struct usb_action MC501CB_60HZScale[] = {
        {}
 };
 
-static const struct usb_action MC501CB_NoFliker[] = {
+static const struct usb_action mc501cb_NoFlikerScale[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
@@ -3132,7 +3144,7 @@ static const struct usb_action MC501CB_NoFliker[] = {
        {}
 };
 
-static const struct usb_action MC501CB_NoFlikerScale[] = {
+static const struct usb_action mc501cb_NoFliker[] = {
        {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
        {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
        {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
@@ -3144,8 +3156,8 @@ static const struct usb_action MC501CB_NoFlikerScale[] = {
        {}
 };
 
-/* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */
-static const struct usb_action OV7620_mode0[] = {
+/* from zs211.inf */
+static const struct usb_action ov7620_Initial[] = {    /* 640x480 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, /* 00,02,40,cc */
        {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */
@@ -3214,9 +3226,7 @@ static const struct usb_action OV7620_mode0[] = {
        {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,50,cc */
        {}
 };
-
-/* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */
-static const struct usb_action OV7620_mode1[] = {
+static const struct usb_action ov7620_InitialScale[] = {       /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x50, ZC3XX_R002_CLOCKSELECT},   /* 00,02,50,cc */
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},  /* 00,08,00,cc */
@@ -3287,9 +3297,7 @@ static const struct usb_action OV7620_mode1[] = {
        {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN},   /* 01,a8,50,cc */
        {}
 };
-
-/* from zs211.inf - HKR,%OV7620%\AE,50HZ */
-static const struct usb_action OV7620_50HZ[] = {
+static const struct usb_action ov7620_50HZ[] = {
        {0xaa, 0x13, 0x00a3},   /* 00,13,a3,aa */
        {0xdd, 0x00, 0x0100},   /* 00,01,00,dd */
        {0xaa, 0x2b, 0x0096},   /* 00,2b,96,aa */
@@ -3307,9 +3315,7 @@ static const struct usb_action OV7620_50HZ[] = {
                                                         if mode0 (640x480) */
        {}
 };
-
-/* from zs211.inf - HKR,%OV7620%\AE,60HZ */
-static const struct usb_action OV7620_60HZ[] = {
+static const struct usb_action ov7620_60HZ[] = {
        {0xaa, 0x13, 0x00a3},                   /* 00,13,a3,aa */
                                                /* (bug in zs211.inf) */
        {0xdd, 0x00, 0x0100},                   /* 00,01,00,dd */
@@ -3331,9 +3337,7 @@ static const struct usb_action OV7620_60HZ[] = {
        {0xa1, 0x01, 0x0037},           */
        {}
 };
-
-/* from zs211.inf - HKR,%OV7620%\AE,NoFliker */
-static const struct usb_action OV7620_NoFliker[] = {
+static const struct usb_action ov7620_NoFliker[] = {
        {0xaa, 0x13, 0x00a3},                   /* 00,13,a3,aa */
                                                /* (bug in zs211.inf) */
        {0xdd, 0x00, 0x0100},                   /* 00,01,00,dd */
@@ -3354,7 +3358,7 @@ static const struct usb_action OV7620_NoFliker[] = {
        {}
 };
 
-static const struct usb_action ov7630c_Initial[] = {
+static const struct usb_action ov7630c_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
@@ -3511,7 +3515,7 @@ static const struct usb_action ov7630c_Initial[] = {
        {}
 };
 
-static const struct usb_action ov7630c_InitialScale[] = {
+static const struct usb_action ov7630c_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
@@ -3682,7 +3686,7 @@ static const struct usb_action pas106b_Initial_com[] = {
        {}
 };
 
-static const struct usb_action pas106b_Initial[] = {   /* 176x144 */
+static const struct usb_action pas106b_InitialScale[] = {      /* 176x144 */
 /* JPEG control */
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
 /* Sream and Sensor specific */
@@ -3800,7 +3804,7 @@ static const struct usb_action pas106b_Initial[] = {      /* 176x144 */
        {}
 };
 
-static const struct usb_action pas106b_InitialScale[] = {      /* 352x288 */
+static const struct usb_action pas106b_Initial[] = {   /* 352x288 */
 /* JPEG control */
        {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
 /* Sream and Sensor specific */
@@ -3972,10 +3976,10 @@ static const struct usb_action pas106b_NoFliker[] = {
        {}
 };
 
-/* from usbvm31b.inf */
+/* from lvWIMv.inf 046d:08a2/:08aa 2007/06/03 */
 static const struct usb_action pas202b_Initial[] = {   /* 640x480 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},         /* 00,00,01,cc */
-       {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING},          /* 00,08,00,cc */
+       {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
        {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT},      /* 00,10,0e,cc */
        {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT},           /* 00,02,00,cc */
        {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},        /* 00,03,02,cc */
@@ -4000,7 +4004,7 @@ static const struct usb_action pas202b_Initial[] = {      /* 640x480 */
        {0xaa, 0x09, 0x0006},                           /* 00,09,06,aa */
        {0xaa, 0x0a, 0x0001},                           /* 00,0a,01,aa */
        {0xaa, 0x0b, 0x0001},                           /* 00,0b,01,aa */
-       {0xaa, 0x0c, 0x0008},                           /* 00,0c,08,aa */
+       {0xaa, 0x0c, 0x0006},
        {0xaa, 0x0d, 0x0000},                           /* 00,0d,00,aa */
        {0xaa, 0x10, 0x0000},                           /* 00,10,00,aa */
        {0xaa, 0x12, 0x0005},                           /* 00,12,05,aa */
@@ -4019,13 +4023,13 @@ static const struct usb_action pas202b_Initial[] = {    /* 640x480 */
 };
 static const struct usb_action pas202b_InitialScale[] = {      /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},         /* 00,00,01,cc */
-       {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING},          /* 00,08,00,cc */
+       {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
        {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT},      /* 00,10,0e,cc */
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT},           /* 00,02,10,cc */
        {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH},        /* 00,03,02,cc */
        {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW},         /* 00,04,80,cc */
        {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},       /* 00,05,01,cc */
-       {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW},        /* 00,06,d0,cc */
+       {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW},
        {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},       /* 00,01,01,cc */
        {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},      /* 00,12,03,cc */
        {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},      /* 00,12,01,cc */
@@ -4035,7 +4039,7 @@ static const struct usb_action pas202b_InitialScale[] = { /* 320x240 */
        {0xa0, 0x08, ZC3XX_R11A_FIRSTYLOW},             /* 01,1a,08,cc */
        {0xa0, 0x02, ZC3XX_R11C_FIRSTXLOW},             /* 01,1c,02,cc */
        {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH},         /* 00,9b,01,cc */
-       {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW},          /* 00,9c,d8,cc */
+       {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW},
        {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH},          /* 00,9d,02,cc */
        {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW},           /* 00,9e,88,cc */
        {0xaa, 0x02, 0x0002},                           /* 00,02,02,aa */
@@ -4044,7 +4048,7 @@ static const struct usb_action pas202b_InitialScale[] = { /* 320x240 */
        {0xaa, 0x09, 0x0006},                           /* 00,09,06,aa */
        {0xaa, 0x0a, 0x0001},                           /* 00,0a,01,aa */
        {0xaa, 0x0b, 0x0001},                           /* 00,0b,01,aa */
-       {0xaa, 0x0c, 0x0008},                           /* 00,0c,08,aa */
+       {0xaa, 0x0c, 0x0006},
        {0xaa, 0x0d, 0x0000},                           /* 00,0d,00,aa */
        {0xaa, 0x10, 0x0000},                           /* 00,10,00,aa */
        {0xaa, 0x12, 0x0005},                           /* 00,12,05,aa */
@@ -4059,6 +4063,8 @@ static const struct usb_action pas202b_InitialScale[] = { /* 320x240 */
        {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},        /* 02,50,08,cc */
        {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},          /* 03,01,08,cc */
        {0xa0, 0x70, ZC3XX_R18D_YTARGET},               /* 01,8d,70,cc */
+       {0xa0, 0xff, ZC3XX_R097_WINYSTARTHIGH},
+       {0xa0, 0xfe, ZC3XX_R098_WINYSTARTLOW},
        {}
 };
 static const struct usb_action pas202b_50HZ[] = {
@@ -4066,22 +4072,22 @@ static const struct usb_action pas202b_50HZ[] = {
        {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},            /* 00,87,20,cc */
        {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},            /* 00,88,21,cc */
        {0xaa, 0x20, 0x0002},                           /* 00,20,02,aa */
-       {0xaa, 0x21, 0x0068},                           /* 00,21,68,aa */
+       {0xaa, 0x21, 0x001b},
        {0xaa, 0x03, 0x0044},                           /* 00,03,44,aa */
-       {0xaa, 0x04, 0x0009},                           /* 00,04,09,aa */
-       {0xaa, 0x05, 0x0028},                           /* 00,05,28,aa */
+       {0xaa, 0x04, 0x0008},
+       {0xaa, 0x05, 0x001b},
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
-       {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,14,cc */
+       {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
        {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,24,cc */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,07,cc */
-       {0xa0, 0xd2, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,d2,cc */
+       {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x1b, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
        {0xa0, 0x4d, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,4d,cc */
-       {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
-       {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
+       {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
+       {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
        {0xa0, 0x44, ZC3XX_R01D_HSYNC_0},               /* 00,1d,44,cc */
        {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1},               /* 00,1e,6f,cc */
        {0xa0, 0xad, ZC3XX_R01F_HSYNC_2},               /* 00,1f,ad,cc */
@@ -4094,23 +4100,23 @@ static const struct usb_action pas202b_50HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},         /* 00,19,00,cc */
        {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},            /* 00,87,20,cc */
        {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},            /* 00,88,21,cc */
-       {0xaa, 0x20, 0x0002},                           /* 00,20,02,aa */
-       {0xaa, 0x21, 0x006c},                           /* 00,21,6c,aa */
+       {0xaa, 0x20, 0x0004},
+       {0xaa, 0x21, 0x003d},
        {0xaa, 0x03, 0x0041},                           /* 00,03,41,aa */
-       {0xaa, 0x04, 0x0009},                           /* 00,04,09,aa */
-       {0xaa, 0x05, 0x002c},                           /* 00,05,2c,aa */
+       {0xaa, 0x04, 0x0010},
+       {0xaa, 0x05, 0x003d},
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
-       {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,14,cc */
+       {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
        {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,24,cc */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x0f, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,0f,cc */
-       {0xa0, 0xbe, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,be,cc */
+       {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x3d, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
        {0xa0, 0x9b, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,9b,cc */
-       {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
-       {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
+       {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
+       {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
        {0xa0, 0x41, ZC3XX_R01D_HSYNC_0},               /* 00,1d,41,cc */
        {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1},               /* 00,1e,6f,cc */
        {0xa0, 0xad, ZC3XX_R01F_HSYNC_2},               /* 00,1f,ad,cc */
@@ -4130,16 +4136,16 @@ static const struct usb_action pas202b_60HZ[] = {
        {0xaa, 0x05, 0x0000},                           /* 00,05,00,aa */
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
-       {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,14,cc */
+       {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
        {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,24,cc */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,07,cc */
-       {0xa0, 0xc0, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,c0,cc */
+       {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x00, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
        {0xa0, 0x40, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,40,cc */
-       {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
-       {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
+       {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
+       {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
        {0xa0, 0x45, ZC3XX_R01D_HSYNC_0},               /* 00,1d,45,cc */
        {0xa0, 0x8e, ZC3XX_R01E_HSYNC_1},               /* 00,1e,8e,cc */
        {0xa0, 0xc1, ZC3XX_R01F_HSYNC_2},               /* 00,1f,c1,cc */
@@ -4152,23 +4158,23 @@ static const struct usb_action pas202b_60HZScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},         /* 00,19,00,cc */
        {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},            /* 00,87,20,cc */
        {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},            /* 00,88,21,cc */
-       {0xaa, 0x20, 0x0002},                           /* 00,20,02,aa */
-       {0xaa, 0x21, 0x0004},                           /* 00,21,04,aa */
+       {0xaa, 0x20, 0x0004},
+       {0xaa, 0x21, 0x0008},
        {0xaa, 0x03, 0x0042},                           /* 00,03,42,aa */
-       {0xaa, 0x04, 0x0008},                           /* 00,04,08,aa */
-       {0xaa, 0x05, 0x0004},                           /* 00,05,04,aa */
+       {0xaa, 0x04, 0x0010},
+       {0xaa, 0x05, 0x0008},
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
-       {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,14,cc */
+       {0xa0, 0x1c, ZC3XX_R1A9_DIGITALLIMITDIFF},
        {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,24,cc */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x0f, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,0f,cc */
-       {0xa0, 0x9f, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,9f,cc */
+       {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x08, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
        {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,81,cc */
-       {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
-       {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
+       {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE},
+       {0xa0, 0x1b, ZC3XX_R18F_AEUNFREEZE},
        {0xa0, 0x42, ZC3XX_R01D_HSYNC_0},               /* 00,1d,42,cc */
        {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1},               /* 00,1e,6f,cc */
        {0xa0, 0xaf, ZC3XX_R01F_HSYNC_2},               /* 00,1f,af,cc */
@@ -4182,22 +4188,22 @@ static const struct usb_action pas202b_NoFliker[] = {
        {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},            /* 00,87,20,cc */
        {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},            /* 00,88,21,cc */
        {0xaa, 0x20, 0x0002},                           /* 00,20,02,aa */
-       {0xaa, 0x21, 0x0020},                           /* 00,21,20,aa */
+       {0xaa, 0x21, 0x0006},
        {0xaa, 0x03, 0x0040},                           /* 00,03,40,aa */
        {0xaa, 0x04, 0x0008},                           /* 00,04,08,aa */
-       {0xaa, 0x05, 0x0020},                           /* 00,05,20,aa */
+       {0xaa, 0x05, 0x0006},
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,07,cc */
-       {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,f0,cc */
+       {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x06, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
-       {0xa0, 0x02, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,02,cc */
+       {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW},
        {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
        {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
        {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,00,cc */
-       {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,00,cc */
+       {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
        {0xa0, 0x40, ZC3XX_R01D_HSYNC_0},               /* 00,1d,40,cc */
        {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},               /* 00,1e,60,cc */
        {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},               /* 00,1f,90,cc */
@@ -4210,23 +4216,23 @@ static const struct usb_action pas202b_NoFlikerScale[] = {
        {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},         /* 00,19,00,cc */
        {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID},            /* 00,87,20,cc */
        {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW},            /* 00,88,21,cc */
-       {0xaa, 0x20, 0x0002},                           /* 00,20,02,aa */
-       {0xaa, 0x21, 0x0010},                           /* 00,21,10,aa */
+       {0xaa, 0x20, 0x0004},
+       {0xaa, 0x21, 0x000c},
        {0xaa, 0x03, 0x0040},                           /* 00,03,40,aa */
-       {0xaa, 0x04, 0x0008},                           /* 00,04,08,aa */
-       {0xaa, 0x05, 0x0010},                           /* 00,05,10,aa */
+       {0xaa, 0x04, 0x0010},
+       {0xaa, 0x05, 0x000c},
        {0xaa, 0x0e, 0x0001},                           /* 00,0e,01,aa */
        {0xaa, 0x0f, 0x0000},                           /* 00,0f,00,aa */
        {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},     /* 01,90,00,cc */
-       {0xa0, 0x0f, ZC3XX_R191_EXPOSURELIMITMID},      /* 01,91,0f,cc */
-       {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW},      /* 01,92,f0,cc */
+       {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID},
+       {0xa0, 0x0c, ZC3XX_R192_EXPOSURELIMITLOW},
        {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},       /* 01,95,00,cc */
        {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},        /* 01,96,00,cc */
        {0xa0, 0x02, ZC3XX_R197_ANTIFLICKERLOW},        /* 01,97,02,cc */
        {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},              /* 01,8c,10,cc */
        {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},            /* 01,8f,20,cc */
        {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF},      /* 01,a9,00,cc */
-       {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP},       /* 01,aa,00,cc */
+       {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP},
        {0xa0, 0x40, ZC3XX_R01D_HSYNC_0},               /* 00,1d,40,cc */
        {0xa0, 0x60, ZC3XX_R01E_HSYNC_1},               /* 00,1e,60,cc */
        {0xa0, 0x90, ZC3XX_R01F_HSYNC_2},               /* 00,1f,90,cc */
@@ -4713,8 +4719,8 @@ static const struct usb_action pb0330_NoFlikerScale[] = {
        {}
 };
 
-/* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */
-static const struct usb_action PO2030_mode0[] = {
+/* from oem9.inf */
+static const struct usb_action po2030_Initial[] = {    /* 640x480 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT},   /* 00,02,04,cc */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
@@ -4790,8 +4796,8 @@ static const struct usb_action PO2030_mode0[] = {
        {}
 };
 
-/* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */
-static const struct usb_action PO2030_mode1[] = {
+/* from oem9.inf */
+static const struct usb_action po2030_InitialScale[] = {       /* 320x240 */
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */
        {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */
@@ -4867,7 +4873,7 @@ static const struct usb_action PO2030_mode1[] = {
        {}
 };
 
-static const struct usb_action PO2030_50HZ[] = {
+static const struct usb_action po2030_50HZ[] = {
        {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
        {0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */
        {0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */
@@ -4889,7 +4895,7 @@ static const struct usb_action PO2030_50HZ[] = {
        {}
 };
 
-static const struct usb_action PO2030_60HZ[] = {
+static const struct usb_action po2030_60HZ[] = {
        {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
        {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
        {0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */
@@ -4912,7 +4918,7 @@ static const struct usb_action PO2030_60HZ[] = {
        {}
 };
 
-static const struct usb_action PO2030_NoFliker[] = {
+static const struct usb_action po2030_NoFliker[] = {
        {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */
        {0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */
        {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
@@ -4924,7 +4930,7 @@ static const struct usb_action PO2030_NoFliker[] = {
 };
 
 /* TEST */
-static const struct usb_action tas5130CK_Initial[] = {
+static const struct usb_action tas5130cK_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x01, 0x003b},
        {0xa0, 0x0e, 0x003a},
@@ -5127,7 +5133,7 @@ static const struct usb_action tas5130CK_Initial[] = {
        {}
 };
 
-static const struct usb_action tas5130CK_InitialScale[] = {
+static const struct usb_action tas5130cK_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},
        {0xa0, 0x01, 0x003b},
        {0xa0, 0x0e, 0x003a},
@@ -5560,7 +5566,7 @@ static const struct usb_action tas5130cxx_NoFlikerScale[] = {
        {}
 };
 
-static const struct usb_action tas5130c_vf0250_Initial[] = {
+static const struct usb_action tas5130c_vf0250_InitialScale[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},         /* 00,00,01,cc, */
        {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING},          /* 00,08,02,cc, */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},      /* 00,10,01,cc, */
@@ -5627,7 +5633,7 @@ static const struct usb_action tas5130c_vf0250_Initial[] = {
        {}
 };
 
-static const struct usb_action tas5130c_vf0250_InitialScale[] = {
+static const struct usb_action tas5130c_vf0250_Initial[] = {
        {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL},         /* 00,00,01,cc, */
        {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING},          /* 00,08,02,cc, */
        {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT},      /* 00,10,01,cc, */
@@ -5692,8 +5698,7 @@ static const struct usb_action tas5130c_vf0250_InitialScale[] = {
        {0xa0, 0x65, ZC3XX_R118_BGAIN},         /* 01,18,65,cc */
        {}
 };
-/* "50HZ" light frequency banding filter */
-static const struct usb_action tas5130c_vf0250_50HZ[] = {
+static const struct usb_action tas5130c_vf0250_50HZScale[] = {
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0001},           /* 00,83,01,aa */
        {0xaa, 0x84, 0x00aa},           /* 00,84,aa,aa */
@@ -5717,8 +5722,7 @@ static const struct usb_action tas5130c_vf0250_50HZ[] = {
        {}
 };
 
-/* "50HZScale" light frequency banding filter */
-static const struct usb_action tas5130c_vf0250_50HZScale[] = {
+static const struct usb_action tas5130c_vf0250_50HZ[] = {
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0003},           /* 00,83,03,aa */
        {0xaa, 0x84, 0x0054},           /* 00,84,54,aa */
@@ -5742,8 +5746,7 @@ static const struct usb_action tas5130c_vf0250_50HZScale[] = {
        {}
 };
 
-/* "60HZ" light frequency banding filter */
-static const struct usb_action tas5130c_vf0250_60HZ[] = {
+static const struct usb_action tas5130c_vf0250_60HZScale[] = {
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0001},           /* 00,83,01,aa */
        {0xaa, 0x84, 0x0062},           /* 00,84,62,aa */
@@ -5767,8 +5770,7 @@ static const struct usb_action tas5130c_vf0250_60HZ[] = {
        {}
 };
 
-/* "60HZScale" light frequency banding ilter */
-static const struct usb_action tas5130c_vf0250_60HZScale[] = {
+static const struct usb_action tas5130c_vf0250_60HZ[] = {
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0002},           /* 00,83,02,aa */
        {0xaa, 0x84, 0x00c4},           /* 00,84,c4,aa */
@@ -5792,8 +5794,7 @@ static const struct usb_action tas5130c_vf0250_60HZScale[] = {
        {}
 };
 
-/* "NoFliker" light frequency banding flter */
-static const struct usb_action tas5130c_vf0250_NoFliker[] = {
+static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
        {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE},         /* 01,00,0c,cc, */
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0000},           /* 00,83,00,aa */
@@ -5815,8 +5816,7 @@ static const struct usb_action tas5130c_vf0250_NoFliker[] = {
        {}
 };
 
-/* "NoFlikerScale" light frequency banding filter */
-static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
+static const struct usb_action tas5130c_vf0250_NoFliker[] = {
        {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE},         /* 01,00,0c,cc, */
        {0xaa, 0x82, 0x0000},           /* 00,82,00,aa */
        {0xaa, 0x83, 0x0000},           /* 00,83,00,aa */
@@ -5839,7 +5839,7 @@ static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
 };
 
 static u8 reg_r_i(struct gspca_dev *gspca_dev,
-               __u16 index)
+               u16 index)
 {
        usb_control_msg(gspca_dev->dev,
                        usb_rcvctrlpipe(gspca_dev->dev, 0),
@@ -5852,7 +5852,7 @@ static u8 reg_r_i(struct gspca_dev *gspca_dev,
 }
 
 static u8 reg_r(struct gspca_dev *gspca_dev,
-               __u16 index)
+               u16 index)
 {
        u8 ret;
 
@@ -5862,8 +5862,8 @@ static u8 reg_r(struct gspca_dev *gspca_dev,
 }
 
 static void reg_w_i(struct usb_device *dev,
-                       __u8 value,
-                       __u16 index)
+                       u8 value,
+                       u16 index)
 {
        usb_control_msg(dev,
                        usb_sndctrlpipe(dev, 0),
@@ -5874,18 +5874,18 @@ static void reg_w_i(struct usb_device *dev,
 }
 
 static void reg_w(struct usb_device *dev,
-                       __u8 value,
-                       __u16 index)
+                       u8 value,
+                       u16 index)
 {
        PDEBUG(D_USBO, "reg w [%04x] = %02x", index, value);
        reg_w_i(dev, value, index);
 }
 
-static __u16 i2c_read(struct gspca_dev *gspca_dev,
-                       __u8 reg)
+static u16 i2c_read(struct gspca_dev *gspca_dev,
+                       u8 reg)
 {
-       __u8 retbyte;
-       __u16 retval;
+       u8 retbyte;
+       u16 retval;
 
        reg_w_i(gspca_dev->dev, reg, 0x0092);
        reg_w_i(gspca_dev->dev, 0x02, 0x0090);          /* <- read command */
@@ -5900,12 +5900,12 @@ static __u16 i2c_read(struct gspca_dev *gspca_dev,
        return retval;
 }
 
-static __u8 i2c_write(struct gspca_dev *gspca_dev,
-                       __u8 reg,
-                       __u8 valL,
-                       __u8 valH)
+static u8 i2c_write(struct gspca_dev *gspca_dev,
+                       u8 reg,
+                       u8 valL,
+                       u8 valH)
 {
-       __u8 retbyte;
+       u8 retbyte;
 
        reg_w_i(gspca_dev->dev, reg, 0x92);
        reg_w_i(gspca_dev->dev, valL, 0x93);
@@ -5957,24 +5957,24 @@ static void setmatrix(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int i;
-       const __u8 *matrix;
+       const u8 *matrix;
        static const u8 adcm2700_matrix[9] =
 /*             {0x66, 0xed, 0xed, 0xed, 0x66, 0xed, 0xed, 0xed, 0x66}; */
 /*ms-win*/
                {0x74, 0xed, 0xed, 0xed, 0x74, 0xed, 0xed, 0xed, 0x74};
-       static const __u8 gc0305_matrix[9] =
+       static const u8 gc0305_matrix[9] =
                {0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50};
-       static const __u8 ov7620_matrix[9] =
+       static const u8 ov7620_matrix[9] =
                {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
-       static const __u8 pas202b_matrix[9] =
+       static const u8 pas202b_matrix[9] =
                {0x4c, 0xf5, 0xff, 0xf9, 0x51, 0xf5, 0xfb, 0xed, 0x5f};
-       static const __u8 po2030_matrix[9] =
+       static const u8 po2030_matrix[9] =
                {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
        static const u8 tas5130c_matrix[9] =
                {0x68, 0xec, 0xec, 0xec, 0x68, 0xec, 0xec, 0xec, 0x68};
-       static const __u8 vf0250_matrix[9] =
+       static const u8 vf0250_matrix[9] =
                {0x7b, 0xea, 0xea, 0xea, 0x7b, 0xea, 0xea, 0xea, 0x7b};
-       static const __u8 *matrix_tb[SENSOR_MAX] = {
+       static const u8 *matrix_tb[SENSOR_MAX] = {
                adcm2700_matrix, /* SENSOR_ADCM2700 0 */
                ov7620_matrix,  /* SENSOR_CS2102 1 */
                NULL,           /* SENSOR_CS2102K 2 */
@@ -6006,11 +6006,12 @@ static void setmatrix(struct gspca_dev *gspca_dev)
 static void setbrightness(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       __u8 brightness;
+       u8 brightness;
 
        switch (sd->sensor) {
        case SENSOR_GC0305:
        case SENSOR_OV7620:
+       case SENSOR_PAS202B:
        case SENSOR_PO2030:
                return;
        }
@@ -6034,7 +6035,7 @@ static void setsharpness(struct gspca_dev *gspca_dev)
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
        int sharpness;
-       static const __u8 sharpness_tb[][2] = {
+       static const u8 sharpness_tb[][2] = {
                {0x02, 0x03},
                {0x04, 0x07},
                {0x08, 0x0f},
@@ -6053,118 +6054,69 @@ static void setcontrast(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
-       const __u8 *Tgamma, *Tgradient;
-       int g, i, k;
-       static const __u8 kgamma_tb[16] =       /* delta for contrast */
+       const u8 *Tgamma;
+       int g, i, k, adj, gp;
+       u8 gr[16];
+       static const u8 delta_tb[16] =          /* delta for contrast */
                {0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08,
                 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
-       static const __u8 kgrad_tb[16] =
-               {0x1b, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
-                0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04};
-       static const __u8 Tgamma_1[16] =
+       static const u8 gamma_tb[6][16] = {
                {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
-                0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff};
-       static const __u8 Tgradient_1[16] =
-               {0x00, 0x01, 0x05, 0x0b, 0x10, 0x15, 0x18, 0x1a,
-                0x1a, 0x18, 0x16, 0x14, 0x12, 0x0f, 0x0d, 0x06};
-       static const __u8 Tgamma_2[16] =
+                0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff},
                {0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c,
-                0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff};
-       static const __u8 Tgradient_2[16] =
-               {0x05, 0x0f, 0x16, 0x1a, 0x19, 0x19, 0x17, 0x15,
-                0x12, 0x10, 0x0e, 0x0b, 0x09, 0x08, 0x06, 0x03};
-       static const __u8 Tgamma_3[16] =
+                0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff},
                {0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac,
-                0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff};
-       static const __u8 Tgradient_3[16] =
-               {0x0c, 0x16, 0x1b, 0x1c, 0x19, 0x18, 0x15, 0x12,
-                0x10, 0x0d, 0x0b, 0x09, 0x08, 0x06, 0x05, 0x03};
-       static const __u8 Tgamma_4[16] =
+                0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff},
                {0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
-                0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff};
-       static const __u8 Tgradient_4[16] =
-               {0x26, 0x22, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0d,
-                0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02};
-       static const __u8 Tgamma_5[16] =
+                0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff},
                {0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2,
-                0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff};
-       static const __u8 Tgradient_5[16] =
-               {0x37, 0x26, 0x20, 0x1a, 0x14, 0x10, 0x0e, 0x0b,
-                0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x02};
-       static const __u8 Tgamma_6[16] =                /* ?? was gamma 5 */
+                0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff},
                {0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3,
-                0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff};
-       static const __u8 Tgradient_6[16] =
-               {0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e,
-                0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01};
-       static const __u8 *gamma_tb[] = {
-               NULL, Tgamma_1, Tgamma_2,
-               Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6
+                0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff},
        };
-       static const __u8 *gradient_tb[] = {
-               NULL, Tgradient_1, Tgradient_2,
-               Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
-       };
-#ifdef GSPCA_DEBUG
-       __u8 v[16];
-#endif
 
-       Tgamma = gamma_tb[sd->gamma];
-       Tgradient = gradient_tb[sd->gamma];
+       Tgamma = gamma_tb[sd->gamma - 1];
 
-       k = (sd->contrast - 128)                /* -128 / 128 */
-                       * Tgamma[0];
-       PDEBUG(D_CONF, "gamma:%d contrast:%d gamma coeff: %d/128",
-               sd->gamma, sd->contrast, k);
+       k = ((int) sd->contrast - 128);         /* -128 / 128 */
+       adj = 0;
+       gp = 0;
        for (i = 0; i < 16; i++) {
-               g = Tgamma[i] + kgamma_tb[i] * k / 128;
+               g = Tgamma[i] - delta_tb[i] * k / 128 - adj / 2;
                if (g > 0xff)
                        g = 0xff;
                else if (g <= 0)
                        g = 1;
                reg_w(dev, g, 0x0120 + i);      /* gamma */
-#ifdef GSPCA_DEBUG
-               if (gspca_debug & D_CONF)
-                       v[i] = g;
-#endif
-       }
-       PDEBUG(D_CONF, "tb: %02x %02x %02x %02x %02x %02x %02x %02x",
-               v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
-       PDEBUG(D_CONF, "    %02x %02x %02x %02x %02x %02x %02x %02x",
-               v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]);
-       for (i = 0; i < 16; i++) {
-               g = Tgradient[i] - kgrad_tb[i] * k / 128;
-               if (g > 0xff)
-                       g = 0xff;
-               else if (g <= 0) {
-                       if (i != 15)
-                               g = 0;
+               if (k > 0)
+                       adj--;
+               else
+                       adj++;
+
+               if (i != 0) {
+                       if (gp == 0)
+                               gr[i - 1] = 0;
                        else
-                               g = 1;
+                               gr[i - 1] = g - gp;
                }
-               reg_w(dev, g, 0x0130 + i);      /* gradient */
-#ifdef GSPCA_DEBUG
-               if (gspca_debug & D_CONF)
-                       v[i] = g;
-#endif
+               gp = g;
        }
-       PDEBUG(D_CONF, "    %02x %02x %02x %02x %02x %02x %02x %02x",
-               v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
-       PDEBUG(D_CONF, "    %02x %02x %02x %02x %02x %02x %02x %02x",
-               v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]);
+       gr[15] = gr[14] / 2;
+       for (i = 0; i < 16; i++)
+               reg_w(dev, gr[i], 0x0130 + i);  /* gradient */
 }
 
 static void setquality(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
-       __u8 frxt;
+       u8 frxt;
 
        switch (sd->sensor) {
        case SENSOR_ADCM2700:
        case SENSOR_GC0305:
        case SENSOR_HV7131B:
        case SENSOR_OV7620:
+       case SENSOR_PAS202B:
        case SENSOR_PO2030:
                return;
        }
@@ -6218,9 +6170,9 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                 hdcs2020b_50HZ, hdcs2020b_50HZ,
                 hdcs2020b_60HZ, hdcs2020b_60HZ},
 /* SENSOR_HV7131B 5 */
-               {hv7131b_NoFlikerScale, hv7131b_NoFliker,
-                hv7131b_50HZScale, hv7131b_50HZ,
-                hv7131b_60HZScale, hv7131b_60HZ},
+               {hv7131b_NoFliker, hv7131b_NoFlikerScale,
+                hv7131b_50HZ, hv7131b_50HZScale,
+                hv7131b_60HZ, hv7131b_60HZScale},
 /* SENSOR_HV7131C 6 */
                {NULL, NULL,
                 NULL, NULL,
@@ -6230,17 +6182,17 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                 icm105a_50HZ, icm105a_50HZScale,
                 icm105a_60HZ, icm105a_60HZScale},
 /* SENSOR_MC501CB 8 */
-               {MC501CB_NoFliker, MC501CB_NoFlikerScale,
-                MC501CB_50HZ, MC501CB_50HZScale,
-                MC501CB_60HZ, MC501CB_60HZScale},
+               {mc501cb_NoFliker, mc501cb_NoFlikerScale,
+                mc501cb_50HZ, mc501cb_50HZScale,
+                mc501cb_60HZ, mc501cb_60HZScale},
 /* SENSOR_MI0360SOC 9 */
-               {mi360soc_AENoFlikerScale, mi360soc_AENoFliker,
-                mi360soc_AE50HZScale, mi360soc_AE50HZ,
-                mi360soc_AE60HZScale, mi360soc_AE60HZ},
+               {mi360soc_AENoFliker, mi360soc_AENoFlikerScale,
+                mi360soc_AE50HZ, mi360soc_AE50HZScale,
+                mi360soc_AE60HZ, mi360soc_AE60HZScale},
 /* SENSOR_OV7620 10 */
-               {OV7620_NoFliker, OV7620_NoFliker,
-                OV7620_50HZ, OV7620_50HZ,
-                OV7620_60HZ, OV7620_60HZ},
+               {ov7620_NoFliker, ov7620_NoFliker,
+                ov7620_50HZ, ov7620_50HZ,
+                ov7620_60HZ, ov7620_60HZ},
 /* SENSOR_OV7630C 11 */
                {NULL, NULL,
                 NULL, NULL,
@@ -6258,17 +6210,17 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                 pb0330_50HZScale, pb0330_50HZ,
                 pb0330_60HZScale, pb0330_60HZ},
 /* SENSOR_PO2030 15 */
-               {PO2030_NoFliker, PO2030_NoFliker,
-                PO2030_50HZ, PO2030_50HZ,
-                PO2030_60HZ, PO2030_60HZ},
+               {po2030_NoFliker, po2030_NoFliker,
+                po2030_50HZ, po2030_50HZ,
+                po2030_60HZ, po2030_60HZ},
 /* SENSOR_TAS5130CK 16 */
-               {tas5130cxx_NoFlikerScale, tas5130cxx_NoFliker,
-                tas5130cxx_50HZScale, tas5130cxx_50HZ,
-                tas5130cxx_60HZScale, tas5130cxx_60HZ},
+               {tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale,
+                tas5130cxx_50HZ, tas5130cxx_50HZScale,
+                tas5130cxx_60HZ, tas5130cxx_60HZScale},
 /* SENSOR_TAS5130CXX 17 */
-               {tas5130cxx_NoFlikerScale, tas5130cxx_NoFliker,
-                tas5130cxx_50HZScale, tas5130cxx_50HZ,
-                tas5130cxx_60HZScale, tas5130cxx_60HZ},
+               {tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale,
+                tas5130cxx_50HZ, tas5130cxx_50HZScale,
+                tas5130cxx_60HZ, tas5130cxx_60HZScale},
 /* SENSOR_TAS5130C_VF0250 18 */
                {tas5130c_vf0250_NoFliker, tas5130c_vf0250_NoFlikerScale,
                 tas5130c_vf0250_50HZ, tas5130c_vf0250_50HZScale,
@@ -6277,9 +6229,9 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
 
        i = sd->lightfreq * 2;
        mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
-       if (!mode)
-               i++;                    /* 640x480 */
-       zc3_freq = freq_tb[(int) sd->sensor][i];
+       if (mode)
+               i++;                    /* 320x240 */
+       zc3_freq = freq_tb[sd->sensor][i];
        if (zc3_freq != NULL) {
                usb_exchange(gspca_dev, zc3_freq);
                switch (sd->sensor) {
@@ -6297,6 +6249,9 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                                        reg_w(gspca_dev->dev, 0x44, 0x0002);
                        }
                        break;
+               case SENSOR_PAS202B:
+                       reg_w(gspca_dev->dev, 0x00, 0x01a7);
+                       break;
                }
        }
        return 0;
@@ -6305,7 +6260,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
 static void setautogain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       __u8 autoval;
+       u8 autoval;
 
        if (sd->autogain)
                autoval = 0x42;
@@ -6333,6 +6288,12 @@ static void send_unknown(struct usb_device *dev, int sensor)
                reg_w(dev, 0x02, 0x003b);
                reg_w(dev, 0x00, 0x0038);
                break;
+       case SENSOR_PAS202B:
+               reg_w(dev, 0x03, 0x003b);
+               reg_w(dev, 0x0c, 0x003a);
+               reg_w(dev, 0x0b, 0x0039);
+               reg_w(dev, 0x0b, 0x0038);
+               break;
        }
 }
 
@@ -6349,7 +6310,7 @@ static void start_2wr_probe(struct usb_device *dev, int sensor)
 
 static int sif_probe(struct gspca_dev *gspca_dev)
 {
-       __u16 checkword;
+       u16 checkword;
 
        start_2wr_probe(gspca_dev->dev, 0x0f);          /* PAS106 */
        reg_w(gspca_dev->dev, 0x08, 0x008d);
@@ -6392,6 +6353,7 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
        }
 
        start_2wr_probe(dev, 0x08);             /* HDCS2020 */
+       i2c_write(gspca_dev, 0x1c, 0x00, 0x00);
        i2c_write(gspca_dev, 0x15, 0xaa, 0x00);
        retword = i2c_read(gspca_dev, 0x15);
        if (retword != 0)
@@ -6420,8 +6382,10 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
        i2c_write(gspca_dev, 0x03, 0xaa, 0x00);
        msleep(50);
        retword = i2c_read(gspca_dev, 0x03);
-       if (retword != 0)
+       if (retword != 0) {
+               send_unknown(dev, SENSOR_PAS202B);
                return 0x0e;                    /* PAS202BCB */
+       }
 
        start_2wr_probe(dev, 0x02);             /* TAS5130C */
        i2c_write(gspca_dev, 0x01, 0xaa, 0x00);
@@ -6457,8 +6421,8 @@ ov_check:
 }
 
 struct sensor_by_chipset_revision {
-       __u16 revision;
-       __u8 internal_sensor_id;
+       u16 revision;
+       u8 internal_sensor_id;
 };
 static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
        {0xc000, 0x12},         /* TAS5130C */
@@ -6467,6 +6431,7 @@ static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
        {0x8001, 0x13},
        {0x8000, 0x14},         /* CS2102K */
        {0x8400, 0x15},         /* TAS5130K */
+       {0xe400, 0x15},
 };
 
 static int vga_3wr_probe(struct gspca_dev *gspca_dev)
@@ -6474,7 +6439,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
        int i;
-       __u8 retbyte;
+       u8 retbyte;
        u16 retword;
 
 /*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/
@@ -6622,8 +6587,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
        int sensor;
-       int vga = 1;            /* 1: vga, 0: sif */
-       static const __u8 gamma[SENSOR_MAX] = {
+       static const u8 gamma[SENSOR_MAX] = {
                4,      /* SENSOR_ADCM2700 0 */
                4,      /* SENSOR_CS2102 1 */
                5,      /* SENSOR_CS2102K 2 */
@@ -6644,9 +6608,30 @@ static int sd_config(struct gspca_dev *gspca_dev,
                3,      /* SENSOR_TAS5130CXX 17 */
                3,      /* SENSOR_TAS5130C_VF0250 18 */
        };
+       static const u8 mode_tb[SENSOR_MAX] = {
+               2,      /* SENSOR_ADCM2700 0 */
+               1,      /* SENSOR_CS2102 1 */
+               1,      /* SENSOR_CS2102K 2 */
+               1,      /* SENSOR_GC0305 3 */
+               1,      /* SENSOR_HDCS2020b 4 */
+               1,      /* SENSOR_HV7131B 5 */
+               1,      /* SENSOR_HV7131C 6 */
+               1,      /* SENSOR_ICM105A 7 */
+               2,      /* SENSOR_MC501CB 8 */
+               1,      /* SENSOR_MI0360SOC 9 */
+               2,      /* SENSOR_OV7620 10 */
+               1,      /* SENSOR_OV7630C 11 */
+               0,      /* SENSOR_PAS106 12 */
+               1,      /* SENSOR_PAS202B 13 */
+               1,      /* SENSOR_PB0330 14 */
+               1,      /* SENSOR_PO2030 15 */
+               1,      /* SENSOR_TAS5130CK 16 */
+               1,      /* SENSOR_TAS5130CXX 17 */
+               1,      /* SENSOR_TAS5130C_VF0250 18 */
+       };
 
        /* define some sensors from the vendor/product */
-       sd->sharpness = 2;
+       sd->sharpness = SHARPNESS_DEF;
        sd->sensor = id->driver_info;
        sensor = zcxx_probeSensor(gspca_dev);
        if (sensor >= 0)
@@ -6671,8 +6656,21 @@ static int sd_config(struct gspca_dev *gspca_dev,
                        }
                        break;
                case 0:
-                       PDEBUG(D_PROBE, "Find Sensor HV7131B");
-                       sd->sensor = SENSOR_HV7131B;
+                       /* check the sensor type */
+                       sensor = i2c_read(gspca_dev, 0x00);
+                       PDEBUG(D_PROBE, "Sensor hv7131 type %d", sensor);
+                       switch (sensor) {
+                       case 0:                 /* hv7131b */
+                       case 1:                 /* hv7131e */
+                               PDEBUG(D_PROBE, "Find Sensor HV7131B");
+                               sd->sensor = SENSOR_HV7131B;
+                               break;
+                       default:
+/*                     case 2:                  * hv7131r */
+                               PDEBUG(D_PROBE, "Find Sensor HV7131R(c)");
+                               sd->sensor = SENSOR_HV7131C;
+                               break;
+                       }
                        break;
                case 0x02:
                        PDEBUG(D_PROBE, "Sensor TAS5130C");
@@ -6699,12 +6697,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
                case 0x0e:
                        PDEBUG(D_PROBE, "Find Sensor PAS202B");
                        sd->sensor = SENSOR_PAS202B;
-                       sd->sharpness = 1;
+/*                     sd->sharpness = 1; */
                        break;
                case 0x0f:
                        PDEBUG(D_PROBE, "Find Sensor PAS106");
                        sd->sensor = SENSOR_PAS106;
-                       vga = 0;                /* SIF */
                        break;
                case 0x10:
                case 0x12:
@@ -6770,31 +6767,38 @@ static int sd_config(struct gspca_dev *gspca_dev,
        if (sensor < 0x20) {
                if (sensor == -1 || sensor == 0x10 || sensor == 0x12)
                        reg_w(gspca_dev->dev, 0x02, 0x0010);
-               else
-                       reg_w(gspca_dev->dev, sensor & 0x0f, 0x0010);
                reg_r(gspca_dev, 0x0010);
        }
 
        cam = &gspca_dev->cam;
 /*fixme:test*/
        gspca_dev->nbalt--;
-       if (vga) {
-               cam->cam_mode = vga_mode;
-               cam->nmodes = ARRAY_SIZE(vga_mode);
-       } else {
+       switch (mode_tb[sd->sensor]) {
+       case 0:
                cam->cam_mode = sif_mode;
                cam->nmodes = ARRAY_SIZE(sif_mode);
+               break;
+       case 1:
+               cam->cam_mode = vga_mode;
+               cam->nmodes = ARRAY_SIZE(vga_mode);
+               break;
+       default:
+/*     case 2: */
+               cam->cam_mode = broken_vga_mode;
+               cam->nmodes = ARRAY_SIZE(broken_vga_mode);
+               break;
        }
-       sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
-       sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
-       sd->gamma = gamma[(int) sd->sensor];
-       sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
-       sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value;
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+       sd->gamma = gamma[sd->sensor];
+       sd->autogain = AUTOGAIN_DEF;
+       sd->lightfreq = FREQ_DEF;
        sd->quality = QUALITY_DEF;
 
        switch (sd->sensor) {
        case SENSOR_GC0305:
        case SENSOR_OV7620:
+       case SENSOR_PAS202B:
        case SENSOR_PO2030:
                gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX);
                break;
@@ -6805,14 +6809,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
                break;
        }
 
-       /* switch the led off */
-       reg_w(gspca_dev->dev, 0x01, 0x0000);
        return 0;
 }
 
 /* this function is called at probe and resume time */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
+       /* switch off the led */
        reg_w(gspca_dev->dev, 0x01, 0x0000);
        return 0;
 }
@@ -6821,28 +6824,27 @@ static int sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        struct usb_device *dev = gspca_dev->dev;
-       const struct usb_action *zc3_init;
        int mode;
        static const struct usb_action *init_tb[SENSOR_MAX][2] = {
                {adcm2700_Initial, adcm2700_InitialScale},      /* 0 */
-               {cs2102_InitialScale, cs2102_Initial},          /* 1 */
-               {cs2102K_InitialScale, cs2102K_Initial},        /* 2 */
+               {cs2102_Initial, cs2102_InitialScale},          /* 1 */
+               {cs2102K_Initial, cs2102K_InitialScale},        /* 2 */
                {gc0305_Initial, gc0305_InitialScale},          /* 3 */
-               {hdcs2020xb_InitialScale, hdcs2020xb_Initial},  /* 4 */
-               {hv7131bxx_InitialScale, hv7131bxx_Initial},    /* 5 */
-               {hv7131cxx_InitialScale, hv7131cxx_Initial},    /* 6 */
-               {icm105axx_InitialScale, icm105axx_Initial},    /* 7 */
-               {MC501CB_InitialScale, MC501CB_Initial},        /* 8 */
+               {hdcs2020b_Initial, hdcs2020b_InitialScale},    /* 4 */
+               {hv7131b_Initial, hv7131b_InitialScale},        /* 5 */
+               {hv7131r_Initial, hv7131r_InitialScale},        /* 6 */
+               {icm105a_Initial, icm105a_InitialScale},        /* 7 */
+               {mc501cb_Initial, mc501cb_InitialScale},        /* 8 */
                {mi0360soc_Initial, mi0360soc_InitialScale},    /* 9 */
-               {OV7620_mode0, OV7620_mode1},                   /* 10 */
-               {ov7630c_InitialScale, ov7630c_Initial},        /* 11 */
-               {pas106b_InitialScale, pas106b_Initial},        /* 12 */
+               {ov7620_Initial, ov7620_InitialScale},          /* 10 */
+               {ov7630c_Initial, ov7630c_InitialScale},        /* 11 */
+               {pas106b_Initial, pas106b_InitialScale},        /* 12 */
                {pas202b_Initial, pas202b_InitialScale},        /* 13 */
                {pb0330_Initial, pb0330_InitialScale},          /* 14 */
-               {PO2030_mode0, PO2030_mode1},                   /* 15 */
-               {tas5130CK_InitialScale, tas5130CK_Initial},    /* 16 */
+               {po2030_Initial, po2030_InitialScale},          /* 15 */
+               {tas5130cK_Initial, tas5130cK_InitialScale},    /* 16 */
                {tas5130cxx_Initial, tas5130cxx_InitialScale},  /* 17 */
-               {tas5130c_vf0250_InitialScale, tas5130c_vf0250_Initial},
+               {tas5130c_vf0250_Initial, tas5130c_vf0250_InitialScale},
                                                                /* 18 */
        };
 
@@ -6854,8 +6856,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                        0x21);          /* JPEG 422 */
        jpeg_set_qual(sd->jpeg_hdr, sd->quality);
 
-       mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
-       zc3_init = init_tb[(int) sd->sensor][mode];
+       mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
        switch (sd->sensor) {
        case SENSOR_HV7131C:
                zcxx_probeSensor(gspca_dev);
@@ -6864,7 +6865,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
                usb_exchange(gspca_dev, pas106b_Initial_com);
                break;
        }
-       usb_exchange(gspca_dev, zc3_init);
+       usb_exchange(gspca_dev, init_tb[sd->sensor][mode]);
 
        switch (sd->sensor) {
        case SENSOR_ADCM2700:
@@ -6883,6 +6884,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
                reg_w(dev, 0x02, 0x003b);
                reg_w(dev, 0x00, 0x0038);
                break;
+       case SENSOR_PAS202B:
+               reg_w(dev, 0x03, 0x003b);
+               reg_w(dev, 0x0c, 0x003a);
+               reg_w(dev, 0x0b, 0x0039);
+               break;
        }
 
        setmatrix(gspca_dev);
@@ -6961,13 +6967,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
        switch (sd->sensor) {
        case SENSOR_PO2030:
                msleep(50);
-               reg_r(gspca_dev, 0x0008);
-               reg_r(gspca_dev, 0x0007);
-               /*fall thru*/
-       case SENSOR_PAS202B:
                reg_w(dev, 0x00, 0x0007);       /* (from win traces) */
                reg_w(dev, 0x02, ZC3XX_R008_CLOCKSETTING);
                break;
+       case SENSOR_PAS202B:
+               reg_w(dev, 0x32, 0x0007);       /* (from win traces) */
+               reg_w(dev, 0x02, ZC3XX_R008_CLOCKSETTING);
+               break;
        }
        return 0;
 }
@@ -7165,6 +7171,22 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
        return 0;
 }
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+                       u8 *data,               /* interrupt packet data */
+                       int len)                /* interrput packet length */
+{
+       if (len == 8 && data[4] == 1) {
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
+               input_sync(gspca_dev->input_dev);
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
+               input_sync(gspca_dev->input_dev);
+       }
+
+       return 0;
+}
+#endif
+
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
@@ -7177,6 +7199,9 @@ static const struct sd_desc sd_desc = {
        .querymenu = sd_querymenu,
        .get_jcomp = sd_get_jcomp,
        .set_jcomp = sd_set_jcomp,
+#ifdef CONFIG_INPUT
+       .int_pkt_scan = sd_int_pkt_scan,
+#endif
 };
 
 static const __devinitdata struct usb_device_id device_table[] = {
index 51f393d03a46eef58873b7278fe8241ebd45b49d..2fc9865fd4864da357767869fc0fbffd8569025f 100644 (file)
@@ -39,12 +39,12 @@ int hdpvr_debug;
 module_param(hdpvr_debug, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hdpvr_debug, "enable debugging output");
 
-uint default_video_input = HDPVR_VIDEO_INPUTS;
+static uint default_video_input = HDPVR_VIDEO_INPUTS;
 module_param(default_video_input, uint, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(default_video_input, "default video input: 0=Component / "
                 "1=S-Video / 2=Composite");
 
-uint default_audio_input = HDPVR_AUDIO_INPUTS;
+static uint default_audio_input = HDPVR_AUDIO_INPUTS;
 module_param(default_audio_input, uint, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(default_audio_input, "default audio input: 0=RCA back / "
                 "1=RCA front / 2=S/PDIF");
@@ -59,6 +59,7 @@ static struct usb_device_id hdpvr_table[] = {
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID) },
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID1) },
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID2) },
+       { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID3) },
        { }                                     /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, hdpvr_table);
index fdd782039e9de4d266ac6abeade64045858256d4..196f82de48f032c20b9141d320985fc3ac05181d 100644 (file)
@@ -302,7 +302,8 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
 /* function expects dev->io_mutex to be hold by caller */
 static int hdpvr_stop_streaming(struct hdpvr_device *dev)
 {
-       uint actual_length, c = 0;
+       int actual_length;
+       uint c = 0;
        u8 *buf;
 
        if (dev->status == STATUS_IDLE)
@@ -572,7 +573,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
        struct hdpvr_device *dev = video_drvdata(file);
 
        strcpy(cap->driver, "hdpvr");
-       strcpy(cap->card, "Haupauge HD PVR");
+       strcpy(cap->card, "Hauppauge HD PVR");
        usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
        cap->version = HDPVR_VERSION;
        cap->capabilities =     V4L2_CAP_VIDEO_CAPTURE |
index 1edd8759121ee0e103d2a2cdc06858917fd55733..49ae25d83d10a32afe636929784f75c3efd4ccf9 100644 (file)
@@ -30,6 +30,7 @@
 #define HD_PVR_PRODUCT_ID      0x4900
 #define HD_PVR_PRODUCT_ID1     0x4901
 #define HD_PVR_PRODUCT_ID2     0x4902
+#define HD_PVR_PRODUCT_ID3     0x4982
 
 #define UNSET    (-1U)
 
index 60d992ee2589b71253ec40c4aed73a6f9e95321d..e620a3a92f254691ff2db5de8c8e93728bc1d246 100644 (file)
@@ -352,9 +352,13 @@ static struct saa7146_ext_vv vv_data;
 static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
 {
        struct hexium *hexium = (struct hexium *) dev->ext_priv;
+       int ret;
 
        DEB_EE((".\n"));
 
+       ret = saa7146_vv_devinit(dev);
+       if (ret)
+               return ret;
        hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
        if (NULL == hexium) {
                printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
@@ -400,9 +404,10 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
        vv_data.ops.vidioc_enum_input = vidioc_enum_input;
        vv_data.ops.vidioc_g_input = vidioc_g_input;
        vv_data.ops.vidioc_s_input = vidioc_s_input;
-       if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER)) {
+       ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
+       if (ret < 0) {
                printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n");
-               return -1;
+               return ret;
        }
 
        printk("hexium_gemini: found 'hexium gemini' frame grabber-%d.\n", hexium_num);
index 938a1f8f880a0a2ca4471d3e2fc81ca722fad09e..fe596a1c12a81a7a71b15559dfd6747f7ae993ce 100644 (file)
@@ -216,6 +216,10 @@ static int hexium_probe(struct saa7146_dev *dev)
                return -EFAULT;
        }
 
+       err = saa7146_vv_devinit(dev);
+       if (err)
+               return err;
+
        hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
        if (NULL == hexium) {
                printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
index b86e35386ceea525a9217a13539fca5045bd185e..da18d698e7f2b10ea61983b0ca57acafa0386d57 100644 (file)
@@ -299,7 +299,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
        struct ir_scancode_table *ir_codes = NULL;
        const char *name = NULL;
-       int ir_type = 0;
+       u64 ir_type = 0;
        struct IR_i2c *ir;
        struct input_dev *input_dev;
        struct i2c_adapter *adap = client->adapter;
@@ -331,6 +331,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
                ir_codes    = &ir_codes_pv951_table;
                break;
        case 0x18:
+       case 0x1f:
        case 0x1a:
                name        = "Hauppauge";
                ir->get_key = get_key_haup;
@@ -446,7 +447,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
        input_dev->name       = ir->name;
        input_dev->phys       = ir->phys;
 
-       err = ir_input_register(ir->input, ir->ir_codes);
+       err = ir_input_register(ir->input, ir->ir_codes, NULL);
        if (err)
                goto err_out_free;
 
index 79d0fe4990d661b07c6b13011150bfa3270d8ccb..ca1fd3227a9332486d01610d7ff4c8508f1a5aaf 100644 (file)
@@ -1210,6 +1210,53 @@ static const struct ivtv_card ivtv_card_buffalo = {
        .i2c = &ivtv_i2c_std,
 };
 
+/* ------------------------------------------------------------------------- */
+/* Sony Kikyou */
+
+static const struct ivtv_card_pci_info ivtv_pci_kikyou[] = {
+       { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_SONY, 0x813d },
+       { 0, 0, 0 }
+};
+
+static const struct ivtv_card ivtv_card_kikyou = {
+       .type = IVTV_CARD_KIKYOU,
+       .name = "Sony VAIO Giga Pocket (ENX Kikyou)",
+       .v4l2_capabilities = IVTV_CAP_ENCODER,
+       .hw_video = IVTV_HW_SAA7115,
+       .hw_audio = IVTV_HW_GPIO,
+       .hw_audio_ctrl = IVTV_HW_GPIO,
+       .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER,
+       .video_inputs = {
+       { IVTV_CARD_INPUT_VID_TUNER,  0, IVTV_SAA71XX_COMPOSITE1 },
+       { IVTV_CARD_INPUT_COMPOSITE1, 1, IVTV_SAA71XX_COMPOSITE1 },
+       { IVTV_CARD_INPUT_SVIDEO1,    1, IVTV_SAA71XX_SVIDEO1 },
+       },
+       .audio_inputs = {
+            { IVTV_CARD_INPUT_AUD_TUNER,  IVTV_GPIO_TUNER },
+            { IVTV_CARD_INPUT_LINE_IN1,   IVTV_GPIO_LINE_IN },
+            { IVTV_CARD_INPUT_LINE_IN2,   IVTV_GPIO_LINE_IN },
+       },
+       .gpio_init = { .direction = 0x03e1, .initial_value = 0x0320 },
+       .gpio_audio_input = { .mask   = 0x0060,
+                             .tuner  = 0x0020,
+                             .linein = 0x0000,
+                             .radio  = 0x0060 },
+       .gpio_audio_mute  = { .mask = 0x0000,
+                             .mute = 0x0000 }, /* 0x200? Disable for now. */
+       .gpio_audio_mode  = { .mask   = 0x0080,
+                             .mono   = 0x0000,
+                             .stereo = 0x0000, /* SAP */
+                             .lang1  = 0x0080,
+                             .lang2  = 0x0000,
+                             .both   = 0x0080 },
+       .tuners = {
+            { .std = V4L2_STD_ALL, .tuner = TUNER_SONY_BTF_PXN01Z },
+       },
+       .pci_list = ivtv_pci_kikyou,
+       .i2c = &ivtv_i2c_std,
+};
+
+
 static const struct ivtv_card *ivtv_card_list[] = {
        &ivtv_card_pvr250,
        &ivtv_card_pvr350,
@@ -1238,6 +1285,7 @@ static const struct ivtv_card *ivtv_card_list[] = {
        &ivtv_card_aver_m104,
        &ivtv_card_buffalo,
        &ivtv_card_aver_ultra1500mce,
+       &ivtv_card_kikyou,
 
        /* Variations of standard cards but with the same PCI IDs.
           These cards must come last in this list. */
index 6148827ec8854d0662977d45f50832d3f8374da9..78eca992e1fd7d2e3d51870aa68fd1550d96239d 100644 (file)
@@ -51,7 +51,8 @@
 #define IVTV_CARD_AVER_M104          24 /* AverMedia M104 miniPCI card */
 #define IVTV_CARD_BUFFALO_MV5L       25 /* Buffalo PC-MV5L/PCI card */
 #define IVTV_CARD_AVER_ULTRA1500MCE  26 /* AVerMedia UltraTV 1500 MCE */
-#define IVTV_CARD_LAST                      26
+#define IVTV_CARD_KIKYOU             27 /* Sony VAIO Giga Pocket (ENX Kikyou) */
+#define IVTV_CARD_LAST                      27
 
 /* Variants of existing cards but with the same PCI IDs. The driver
    detects these based on other device information.
@@ -86,6 +87,7 @@
 #define IVTV_PCI_ID_MELCO              0x1154
 #define IVTV_PCI_ID_GOTVIEW1           0xffac
 #define IVTV_PCI_ID_GOTVIEW2           0xffad
+#define IVTV_PCI_ID_SONY               0x104d
 
 /* hardware flags, no gaps allowed */
 #define IVTV_HW_CX25840                        (1 << 0)
index 347c3344f56d4143975c2e6445227d9ee5fbec6c..9a250548be4d2edec3f912a911289c92bd517320 100644 (file)
@@ -193,6 +193,7 @@ MODULE_PARM_DESC(cardtype,
                 "\t\t\t25 = AverMedia M104 (not yet working)\n"
                 "\t\t\t26 = Buffalo PC-MV5L/PCI\n"
                 "\t\t\t27 = AVerMedia UltraTV 1500 MCE\n"
+                "\t\t\t28 = Sony VAIO Giga Pocket (ENX Kikyou)\n"
                 "\t\t\t 0 = Autodetect (default)\n"
                 "\t\t\t-1 = Ignore this card\n\t\t");
 MODULE_PARM_DESC(pal, "Set PAL standard: BGH, DK, I, M, N, Nc, 60");
index c1b7ec475c27cc1813c2a89dd42a8a807e6c04c4..a71e8ba306b0c97626865243bb09c316bea0a496 100644 (file)
@@ -258,7 +258,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv)
                IVTV_ERR("ivtv_init_mpeg_decoder failed to start playback\n");
                return;
        }
-       ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, data);
+       ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 2, data);
        mem_offset = itv->dec_mem + data[1];
 
        if ((readbytes = load_fw_direct(IVTV_DECODE_INIT_MPEG_FILENAME,
index cd9db0bf33bf078946d08307a2414b901c9c1cde..12d36ca91d53fcd49147975b02dde01a2ece5ea9 100644 (file)
@@ -562,7 +562,7 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv)
        u32 data[CX2341X_MBOX_MAX_DATA];
        struct ivtv_stream *s;
 
-       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data);
+       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data);
        IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d (%d)\n", data[0], data[1], itv->cur_dma_stream);
 
        del_timer(&itv->dma_timer);
@@ -638,7 +638,7 @@ static void ivtv_irq_dma_err(struct ivtv *itv)
        u32 data[CX2341X_MBOX_MAX_DATA];
 
        del_timer(&itv->dma_timer);
-       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data);
+       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data);
        IVTV_DEBUG_WARN("DMA ERROR %08x %08x %08x %d\n", data[0], data[1],
                                read_reg(IVTV_REG_DMASTATUS), itv->cur_dma_stream);
        write_reg(read_reg(IVTV_REG_DMASTATUS) & 3, IVTV_REG_DMASTATUS);
@@ -669,7 +669,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv)
        struct ivtv_stream *s;
 
        /* Get DMA destination and size arguments from card */
-       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, data);
+       ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, 7, data);
        IVTV_DEBUG_HI_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]);
 
        if (data[0] > 2 || data[1] == 0 || data[2] == 0) {
@@ -713,9 +713,9 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv)
        struct ivtv_stream *s;
 
        /* YUV or MPG */
-       ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, data);
 
        if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags)) {
+               ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 2, data);
                itv->dma_data_req_size =
                                 1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31);
                itv->dma_data_req_offset = data[1];
@@ -724,6 +724,7 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv)
                s = &itv->streams[IVTV_DEC_STREAM_TYPE_YUV];
        }
        else {
+               ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 3, data);
                itv->dma_data_req_size = min_t(u32, data[2], 0x10000);
                itv->dma_data_req_offset = data[1];
                s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
@@ -940,9 +941,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
                                ivtv_dma_enc_start(s);
                        break;
                }
-               if (i == IVTV_MAX_STREAMS && test_and_clear_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags)) {
+
+               if (i == IVTV_MAX_STREAMS &&
+                   test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags))
                        ivtv_udma_start(itv);
-               }
        }
 
        if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) {
index 1b5c0ac09a8552cb0c71db7a31fed5cb2a4124ef..84577f6f41a24dd8f35956d041d2f0487f09af1e 100644 (file)
@@ -369,10 +369,11 @@ int ivtv_vapi(struct ivtv *itv, int cmd, int args, ...)
 }
 
 /* This one is for stuff that can't sleep.. irq handlers, etc.. */
-void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb, u32 data[])
+void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb,
+                      int argc, u32 data[])
 {
+       volatile u32 __iomem *p = mbdata->mbox[mb].data;
        int i;
-
-       for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++)
-               data[i] = readl(&mbdata->mbox[mb].data[i]);
+       for (i = 0; i < argc; i++, p++)
+               data[i] = readl(p);
 }
index 6ef12091e3f3b010904d0901135a913195c06ae6..8247662c928ed916e4e8f2e015f4651e55f1d1a3 100644 (file)
@@ -24,7 +24,8 @@
 #define IVTV_MBOX_DMA_END         8
 #define IVTV_MBOX_DMA             9
 
-void ivtv_api_get_data(struct ivtv_mailbox_data *mbox, int mb, u32 data[]);
+void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb,
+                      int argc, u32 data[]);
 int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]);
 int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...);
 int ivtv_vapi(struct ivtv *itv, int cmd, int args, ...);
index e12c6022373e38afaaf0ad3b559f3184b67456f9..1f9387f6ca240d39c03ea805369b8c6e74c7e753 100644 (file)
@@ -577,10 +577,14 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s)
                clear_bit(IVTV_F_I_EOS, &itv->i_flags);
 
                /* Initialize Digitizer for Capture */
+               /* Avoid tinny audio problem - ensure audio clocks are going */
+               v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1);
+               /* Avoid unpredictable PCI bus hang - disable video clocks */
                v4l2_subdev_call(itv->sd_video, video, s_stream, 0);
-               ivtv_msleep_timeout(300, 1);
+               ivtv_msleep_timeout(150, 1);
                ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);
                v4l2_subdev_call(itv->sd_video, video, s_stream, 1);
+               ivtv_msleep_timeout(150, 1);
        }
 
        /* begin_capture */
index d07ad6c39024774c11cb41c14f451d57b52c6f6d..1daf1dd65bf764d080db02f390ff9cc709c7c6c0 100644 (file)
@@ -213,6 +213,7 @@ void ivtv_udma_start(struct ivtv *itv)
        write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER);
        set_bit(IVTV_F_I_DMA, &itv->i_flags);
        set_bit(IVTV_F_I_UDMA, &itv->i_flags);
+       clear_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags);
 }
 
 void ivtv_udma_prepare(struct ivtv *itv)
index fc4dd6045720a0bcabafa3f91b14b7e5366ec461..7438f8d775ba7fa09fb32f9ad2f0a8934606afb5 100644 (file)
@@ -514,7 +514,7 @@ static int mt9t112_init_pll(const struct i2c_client *client)
        /* poll to verify out of standby. Must Poll this bit */
        for (i = 0; i < 100; i++) {
                mt9t112_reg_read(data, client, 0x0018);
-               if (0x4000 & data)
+               if (!(0x4000 & data))
                        break;
 
                mdelay(10);
index 91df7ec91fb67d06496cc9b0de41bdf1ee15a2c6..1a34d2993e946488e0bad10eae26e3124bcfff78 100644 (file)
@@ -257,19 +257,18 @@ static int mt9v022_set_bus_param(struct soc_camera_device *icd,
 static unsigned long mt9v022_query_bus_param(struct soc_camera_device *icd)
 {
        struct soc_camera_link *icl = to_soc_camera_link(icd);
-       unsigned int width_flag;
+       unsigned int flags = SOCAM_MASTER | SOCAM_SLAVE |
+               SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING |
+               SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW |
+               SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |
+               SOCAM_DATA_ACTIVE_HIGH;
 
        if (icl->query_bus_param)
-               width_flag = icl->query_bus_param(icl) &
-                       SOCAM_DATAWIDTH_MASK;
+               flags |= icl->query_bus_param(icl) & SOCAM_DATAWIDTH_MASK;
        else
-               width_flag = SOCAM_DATAWIDTH_10;
+               flags |= SOCAM_DATAWIDTH_10;
 
-       return SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING |
-               SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW |
-               SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |
-               SOCAM_DATA_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_SLAVE |
-               width_flag;
+       return soc_camera_apply_sensor_flags(icl, flags);
 }
 
 static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
index 2ba14fb5b0311f0f86a42b2148b3fe30e0e7805e..c167cc3de4928cee1f0a28b1dbade61320d1bcf7 100644 (file)
@@ -718,7 +718,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
-       if (!res || !irq) {
+       if (!res || (int)irq <= 0) {
                err = -ENODEV;
                goto exit;
        }
index c1fc6dc776f5804f985107f9490a11c1dbe44136..9f01f14e4aa2e5d21fa353666e7a45220909fc9a 100644 (file)
@@ -169,7 +169,11 @@ static struct saa7146_extension extension;
 static int mxb_probe(struct saa7146_dev *dev)
 {
        struct mxb *mxb = NULL;
+       int err;
 
+       err = saa7146_vv_devinit(dev);
+       if (err)
+               return err;
        mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
        if (mxb == NULL) {
                DEB_D(("not enough kernel memory.\n"));
@@ -294,7 +298,7 @@ static int mxb_init_done(struct saa7146_dev* dev)
        /* select tuner-output on saa7111a */
        i = 0;
        saa7111a_call(mxb, video, s_routing, SAA7115_COMPOSITE0,
-               SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS, 0);
+               SAA7111_FMT_CCIR, 0);
 
        /* select a tuner type */
        tun_setup.mode_mask = T_ANALOG_TV;
@@ -518,8 +522,8 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
                return err;
 
        /* switch video in saa7111a */
-       if (saa7111a_call(mxb, video, s_routing, i, 0, 0))
-               printk(KERN_ERR "VIDIOC_S_INPUT: could not address saa7111a #1.\n");
+       if (saa7111a_call(mxb, video, s_routing, i, SAA7111_FMT_CCIR, 0))
+               printk(KERN_ERR "VIDIOC_S_INPUT: could not address saa7111a.\n");
 
        /* switch the audio-source only if necessary */
        if (0 == mxb->cur_mute)
index 3a45e945a528c6fdf63b3c4c72626493f6ab5a4b..7f8ece30c77ba790cb38c314783544a0de0e162d 100644 (file)
@@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = {
        },
 };
 
-
 /*
  * general function
  */
@@ -634,7 +633,12 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
        struct soc_camera_link *icl = to_soc_camera_link(icd);
        unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER |
                SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH |
-               SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth;
+               SOCAM_DATA_ACTIVE_HIGH;
+
+       if (priv->info->flags & OV772X_FLAG_8BIT)
+               flags |= SOCAM_DATAWIDTH_8;
+       else
+               flags |= SOCAM_DATAWIDTH_10;
 
        return soc_camera_apply_sensor_flags(icl, flags);
 }
@@ -1039,15 +1043,6 @@ static int ov772x_video_probe(struct soc_camera_device *icd,
            to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
                return -ENODEV;
 
-       /*
-        * ov772x only use 8 or 10 bit bus width
-        */
-       if (SOCAM_DATAWIDTH_10 != priv->info->buswidth &&
-           SOCAM_DATAWIDTH_8  != priv->info->buswidth) {
-               dev_err(&client->dev, "bus width error\n");
-               return -ENODEV;
-       }
-
        /*
         * check and show product ID and manufacturer ID
         */
@@ -1130,7 +1125,6 @@ static int ov772x_probe(struct i2c_client *client,
                        const struct i2c_device_id *did)
 {
        struct ov772x_priv        *priv;
-       struct ov772x_camera_info *info;
        struct soc_camera_device  *icd = client->dev.platform_data;
        struct i2c_adapter        *adapter = to_i2c_adapter(client->dev.parent);
        struct soc_camera_link    *icl;
@@ -1145,8 +1139,6 @@ static int ov772x_probe(struct i2c_client *client,
        if (!icl || !icl->priv)
                return -EINVAL;
 
-       info = icl->priv;
-
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
                dev_err(&adapter->dev,
                        "I2C-Adapter doesn't support "
@@ -1158,7 +1150,7 @@ static int ov772x_probe(struct i2c_client *client,
        if (!priv)
                return -ENOMEM;
 
-       priv->info = info;
+       priv->info = icl->priv;
 
        v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
 
index de5485f506b1bff6d9019bc759f00001c229ad87..cb4057bb07a0f1d473978bfcffa0a20721a880bf 100644 (file)
@@ -233,8 +233,9 @@ struct pvr2_hdw {
        int state_encoder_waitok;     /* Encoder pre-wait done */
        int state_encoder_runok;      /* Encoder has run for >= .25 sec */
        int state_decoder_run;        /* Decoder is running */
+       int state_decoder_ready;      /* Decoder is stabilized & streamable */
        int state_usbstream_run;      /* FX2 is streaming */
-       int state_decoder_quiescent;  /* Decoder idle for > 50msec */
+       int state_decoder_quiescent;  /* Decoder idle for minimal interval */
        int state_pipeline_config;    /* Pipeline is configured */
        int state_pipeline_req;       /* Somebody wants to stream */
        int state_pipeline_pause;     /* Pipeline must be paused */
@@ -255,9 +256,16 @@ struct pvr2_hdw {
        void (*state_func)(void *);
        void *state_data;
 
-       /* Timer for measuring decoder settling time */
+       /* Timer for measuring required decoder settling time before we're
+          allowed to fire it up again. */
        struct timer_list quiescent_timer;
 
+       /* Timer for measuring decoder stabilization time, which is the
+          amount of time we need to let the decoder run before we can
+          trust its output (otherwise the encoder might see garbage and
+          then fail to start correctly). */
+       struct timer_list decoder_stabilization_timer;
+
        /* Timer for measuring encoder pre-wait time */
        struct timer_list encoder_wait_timer;
 
index 1bbdab08fe0e67ee765a0dd847b3837fc4e8b0ef..712b300f723f04d46ae2cea4e86db09ff457c8c4 100644 (file)
    before we are allowed to start it running. */
 #define TIME_MSEC_DECODER_WAIT 50
 
+/* This defines a minimum interval that the decoder must be allowed to run
+   before we can safely begin using its streaming output. */
+#define TIME_MSEC_DECODER_STABILIZATION_WAIT 300
+
 /* This defines a minimum interval that the encoder must remain quiet
-   before we are allowed to configure it.  I had this originally set to
-   50msec, but Martin Dauskardt <martin.dauskardt@gmx.de> reports that
-   things work better when it's set to 100msec. */
-#define TIME_MSEC_ENCODER_WAIT 100
+   before we are allowed to configure it. */
+#define TIME_MSEC_ENCODER_WAIT 50
 
 /* This defines the minimum interval that the encoder must successfully run
    before we consider that the encoder has run at least once since its
@@ -334,6 +336,7 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw);
 static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
 static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
 static void pvr2_hdw_quiescent_timeout(unsigned long);
+static void pvr2_hdw_decoder_stabilization_timeout(unsigned long);
 static void pvr2_hdw_encoder_wait_timeout(unsigned long);
 static void pvr2_hdw_encoder_run_timeout(unsigned long);
 static int pvr2_issue_simple_cmd(struct pvr2_hdw *,u32);
@@ -1705,6 +1708,7 @@ static int pvr2_decoder_enable(struct pvr2_hdw *hdw,int enablefl)
        pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 stream=%s",
                   (enablefl ? "on" : "off"));
        v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_stream, enablefl);
+       v4l2_device_call_all(&hdw->v4l2_dev, 0, audio, s_stream, enablefl);
        if (hdw->decoder_client_id) {
                /* We get here if the encoder has been noticed.  Otherwise
                   we'll issue a warning to the user (which should
@@ -2461,6 +2465,11 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
        hdw->quiescent_timer.data = (unsigned long)hdw;
        hdw->quiescent_timer.function = pvr2_hdw_quiescent_timeout;
 
+       init_timer(&hdw->decoder_stabilization_timer);
+       hdw->decoder_stabilization_timer.data = (unsigned long)hdw;
+       hdw->decoder_stabilization_timer.function =
+               pvr2_hdw_decoder_stabilization_timeout;
+
        init_timer(&hdw->encoder_wait_timer);
        hdw->encoder_wait_timer.data = (unsigned long)hdw;
        hdw->encoder_wait_timer.function = pvr2_hdw_encoder_wait_timeout;
@@ -2674,6 +2683,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
  fail:
        if (hdw) {
                del_timer_sync(&hdw->quiescent_timer);
+               del_timer_sync(&hdw->decoder_stabilization_timer);
                del_timer_sync(&hdw->encoder_run_timer);
                del_timer_sync(&hdw->encoder_wait_timer);
                if (hdw->workqueue) {
@@ -2741,6 +2751,7 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
                hdw->workqueue = NULL;
        }
        del_timer_sync(&hdw->quiescent_timer);
+       del_timer_sync(&hdw->decoder_stabilization_timer);
        del_timer_sync(&hdw->encoder_run_timer);
        del_timer_sync(&hdw->encoder_wait_timer);
        if (hdw->fw_buffer) {
@@ -4452,7 +4463,7 @@ static int state_check_enable_encoder_run(struct pvr2_hdw *hdw)
 
        switch (hdw->pathway_state) {
        case PVR2_PATHWAY_ANALOG:
-               if (hdw->state_decoder_run) {
+               if (hdw->state_decoder_run && hdw->state_decoder_ready) {
                        /* In analog mode, if the decoder is running, then
                           run the encoder. */
                        return !0;
@@ -4519,6 +4530,17 @@ static void pvr2_hdw_quiescent_timeout(unsigned long data)
 }
 
 
+/* Timeout function for decoder stabilization timer. */
+static void pvr2_hdw_decoder_stabilization_timeout(unsigned long data)
+{
+       struct pvr2_hdw *hdw = (struct pvr2_hdw *)data;
+       hdw->state_decoder_ready = !0;
+       trace_stbit("state_decoder_ready", hdw->state_decoder_ready);
+       hdw->state_stale = !0;
+       queue_work(hdw->workqueue, &hdw->workpoll);
+}
+
+
 /* Timeout function for encoder wait timer. */
 static void pvr2_hdw_encoder_wait_timeout(unsigned long data)
 {
@@ -4557,8 +4579,13 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw)
                }
                hdw->state_decoder_quiescent = 0;
                hdw->state_decoder_run = 0;
-               /* paranoia - solve race if timer just completed */
+               /* paranoia - solve race if timer(s) just completed */
                del_timer_sync(&hdw->quiescent_timer);
+               /* Kill the stabilization timer, in case we're killing the
+                  encoder before the previous stabilization interval has
+                  been properly timed. */
+               del_timer_sync(&hdw->decoder_stabilization_timer);
+               hdw->state_decoder_ready = 0;
        } else {
                if (!hdw->state_decoder_quiescent) {
                        if (!timer_pending(&hdw->quiescent_timer)) {
@@ -4596,10 +4623,21 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw)
                if (hdw->flag_decoder_missed) return 0;
                if (pvr2_decoder_enable(hdw,!0) < 0) return 0;
                hdw->state_decoder_quiescent = 0;
+               hdw->state_decoder_ready = 0;
                hdw->state_decoder_run = !0;
+               if (hdw->decoder_client_id == PVR2_CLIENT_ID_SAA7115) {
+                       hdw->decoder_stabilization_timer.expires =
+                               jiffies +
+                               (HZ * TIME_MSEC_DECODER_STABILIZATION_WAIT /
+                                1000);
+                       add_timer(&hdw->decoder_stabilization_timer);
+               } else {
+                       hdw->state_decoder_ready = !0;
+               }
        }
        trace_stbit("state_decoder_quiescent",hdw->state_decoder_quiescent);
        trace_stbit("state_decoder_run",hdw->state_decoder_run);
+       trace_stbit("state_decoder_ready", hdw->state_decoder_ready);
        return !0;
 }
 
@@ -4797,7 +4835,8 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which,
                        buf,acnt,
                        "worker:%s%s%s%s%s%s%s",
                        (hdw->state_decoder_run ?
-                        " <decode:run>" :
+                        (hdw->state_decoder_ready ?
+                         "<decode:run>" : " <decode:start>") :
                         (hdw->state_decoder_quiescent ?
                          "" : " <decode:stop>")),
                        (hdw->state_decoder_quiescent ?
index 56e70eae20c12e87f14e5dd5c4cdcafdd7e53e42..51d3009ab57f34f912dfdb6e9b8e07345b455898 100644 (file)
@@ -306,6 +306,7 @@ struct pvr2_hdw_debug_info {
        int state_encoder_ok;
        int state_encoder_run;
        int state_decoder_run;
+       int state_decoder_ready;
        int state_usbstream_run;
        int state_decoder_quiescent;
        int state_pipeline_config;
index 50b415e07edaba9280516850d8856a487cc29d44..f7f7e04cf4853e02a5c0cd11d051433e6387f1a5 100644 (file)
@@ -753,7 +753,7 @@ int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value)
                buf[0] = 0xff; /* fixed */
 
        ret = send_control_msg(pdev,
-               SET_LUM_CTL, SHUTTER_MODE_FORMATTER, &buf, sizeof(buf));
+               SET_LUM_CTL, SHUTTER_MODE_FORMATTER, &buf, 1);
 
        if (!mode && ret >= 0) {
                if (value < 0)
index 294f860ce2b068f13ba502fc17c1b6b05b9b6dfc..322ac4eecf0ae0cf39b82e33baaa2ef5294a6fe4 100644 (file)
@@ -898,18 +898,8 @@ static void recalculate_fifo_timeout(struct pxa_camera_dev *pcdev,
 
 static void pxa_camera_activate(struct pxa_camera_dev *pcdev)
 {
-       struct pxacamera_platform_data *pdata = pcdev->pdata;
-       struct device *dev = pcdev->soc_host.v4l2_dev.dev;
        u32 cicr4 = 0;
 
-       dev_dbg(dev, "Registered platform device at %p data %p\n",
-               pcdev, pdata);
-
-       if (pdata && pdata->init) {
-               dev_dbg(dev, "%s: Init gpios\n", __func__);
-               pdata->init(dev);
-       }
-
        /* disable all interrupts */
        __raw_writel(0x3ff, pcdev->base + CICR0);
 
index 7e42989ce0e47b8155260c3705ecb58cb21f6604..9277194cd8213d667071d14e56e7cc2664f75dfb 100644 (file)
@@ -165,7 +165,7 @@ struct rj54n1_reg_val {
        u8 val;
 };
 
-const static struct rj54n1_reg_val bank_4[] = {
+static const struct rj54n1_reg_val bank_4[] = {
        {0x417, 0},
        {0x42c, 0},
        {0x42d, 0xf0},
@@ -186,7 +186,7 @@ const static struct rj54n1_reg_val bank_4[] = {
        {0x4fe, 2},
 };
 
-const static struct rj54n1_reg_val bank_5[] = {
+static const struct rj54n1_reg_val bank_5[] = {
        {0x514, 0},
        {0x516, 0},
        {0x518, 0},
@@ -207,7 +207,7 @@ const static struct rj54n1_reg_val bank_5[] = {
        {0x5fe, 2},
 };
 
-const static struct rj54n1_reg_val bank_7[] = {
+static const struct rj54n1_reg_val bank_7[] = {
        {0x70a, 0},
        {0x714, 0xff},
        {0x715, 0xff},
@@ -215,7 +215,7 @@ const static struct rj54n1_reg_val bank_7[] = {
        {0x7FE, 2},
 };
 
-const static struct rj54n1_reg_val bank_8[] = {
+static const struct rj54n1_reg_val bank_8[] = {
        {0x800, 0x00},
        {0x801, 0x01},
        {0x802, 0x61},
@@ -403,12 +403,12 @@ const static struct rj54n1_reg_val bank_8[] = {
        {0x8FE, 2},
 };
 
-const static struct rj54n1_reg_val bank_10[] = {
+static const struct rj54n1_reg_val bank_10[] = {
        {0x10bf, 0x69}
 };
 
 /* Clock dividers - these are default register values, divider = register + 1 */
-const static struct rj54n1_clock_div clk_div = {
+static const struct rj54n1_clock_div clk_div = {
        .ratio_tg       = 3 /* default: 5 */,
        .ratio_t        = 4 /* default: 1 */,
        .ratio_r        = 4 /* default: 0 */,
@@ -563,7 +563,7 @@ static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
        struct i2c_client *client = sd->priv;
        struct rj54n1 *rj54n1 = to_rj54n1(client);
        struct v4l2_rect *rect = &a->c;
-       unsigned int dummy, output_w, output_h,
+       unsigned int dummy = 0, output_w, output_h,
                input_w = rect->width, input_h = rect->height;
        int ret;
 
index 44873a016c2c750eeaa75de9121af5eb622fdb44..c0a7f8a369f4746b93dc19b501d41f8bae897c0d 100644 (file)
@@ -104,6 +104,10 @@ static int saa711x_has_reg(const int id, const u8 reg)
        if (id == V4L2_IDENT_SAA7111)
                return reg < 0x20 && reg != 0x01 && reg != 0x0f &&
                       (reg < 0x13 || reg > 0x19) && reg != 0x1d && reg != 0x1e;
+       if (id == V4L2_IDENT_SAA7111A)
+               return reg < 0x20 && reg != 0x01 && reg != 0x0f &&
+                      reg != 0x14 && reg != 0x18 && reg != 0x19 &&
+                      reg != 0x1d && reg != 0x1e;
 
        /* common for saa7113/4/5/8 */
        if (unlikely((reg >= 0x3b && reg <= 0x3f) || reg == 0x5c || reg == 0x5f ||
@@ -954,8 +958,7 @@ static void saa711x_set_v4lstd(struct v4l2_subdev *sd, v4l2_std_id std)
        011 NTSC N (3.58MHz)            PAL M (3.58MHz)
        100 reserved                    NTSC-Japan (3.58MHz)
        */
-       if (state->ident == V4L2_IDENT_SAA7111 ||
-           state->ident == V4L2_IDENT_SAA7113) {
+       if (state->ident <= V4L2_IDENT_SAA7113) {
                u8 reg = saa711x_read(sd, R_0E_CHROMA_CNTL_1) & 0x8f;
 
                if (std == V4L2_STD_PAL_M) {
@@ -1232,22 +1235,19 @@ static int saa711x_s_routing(struct v4l2_subdev *sd,
                             u32 input, u32 output, u32 config)
 {
        struct saa711x_state *state = to_state(sd);
-       u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0;
+       u8 mask = (state->ident <= V4L2_IDENT_SAA7111A) ? 0xf8 : 0xf0;
 
        v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n",
                input, output);
 
        /* saa7111/3 does not have these inputs */
-       if ((state->ident == V4L2_IDENT_SAA7113 ||
-            state->ident == V4L2_IDENT_SAA7111) &&
+       if (state->ident <= V4L2_IDENT_SAA7113 &&
            (input == SAA7115_COMPOSITE4 ||
             input == SAA7115_COMPOSITE5)) {
                return -EINVAL;
        }
        if (input > SAA7115_SVIDEO3)
                return -EINVAL;
-       if (output > SAA7115_IPORT_ON)
-               return -EINVAL;
        if (state->input == input && state->output == output)
                return 0;
        v4l2_dbg(1, debug, sd, "now setting %s input %s output\n",
@@ -1256,7 +1256,7 @@ static int saa711x_s_routing(struct v4l2_subdev *sd,
        state->input = input;
 
        /* saa7111 has slightly different input numbering */
-       if (state->ident == V4L2_IDENT_SAA7111) {
+       if (state->ident <= V4L2_IDENT_SAA7111A) {
                if (input >= SAA7115_COMPOSITE4)
                        input -= 2;
                /* saa7111 specific */
@@ -1292,7 +1292,7 @@ static int saa711x_s_gpio(struct v4l2_subdev *sd, u32 val)
 {
        struct saa711x_state *state = to_state(sd);
 
-       if (state->ident != V4L2_IDENT_SAA7111)
+       if (state->ident > V4L2_IDENT_SAA7111A)
                return -EINVAL;
        saa711x_write(sd, 0x11, (saa711x_read(sd, 0x11) & 0x7f) |
                (val ? 0x80 : 0));
@@ -1596,6 +1596,10 @@ static int saa711x_probe(struct i2c_client *client,
        switch (chip_id) {
        case '1':
                state->ident = V4L2_IDENT_SAA7111;
+               if (saa711x_read(sd, R_00_CHIP_VERSION) & 0xf0) {
+                       v4l_info(client, "saa7111a variant found\n");
+                       state->ident = V4L2_IDENT_SAA7111A;
+               }
                break;
        case '3':
                state->ident = V4L2_IDENT_SAA7113;
@@ -1612,7 +1616,7 @@ static int saa711x_probe(struct i2c_client *client,
        default:
                state->ident = V4L2_IDENT_SAA7111;
                v4l2_info(sd, "WARNING: Chip is not known - Falling back to saa7111\n");
-
+               break;
        }
 
        state->audclk_freq = 48000;
@@ -1623,6 +1627,7 @@ static int saa711x_probe(struct i2c_client *client,
        state->crystal_freq = SAA7115_FREQ_24_576_MHZ;
        switch (state->ident) {
        case V4L2_IDENT_SAA7111:
+       case V4L2_IDENT_SAA7111A:
                saa711x_writeregs(sd, saa7111_init);
                break;
        case V4L2_IDENT_SAA7113:
@@ -1632,7 +1637,7 @@ static int saa711x_probe(struct i2c_client *client,
                state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
                saa711x_writeregs(sd, saa7115_init_auto_input);
        }
-       if (state->ident != V4L2_IDENT_SAA7111)
+       if (state->ident > V4L2_IDENT_SAA7111A)
                saa711x_writeregs(sd, saa7115_init_misc);
        saa711x_set_v4lstd(sd, V4L2_STD_NTSC);
 
index 2fe7a701b954a700044ee890096b65691e904f6a..250ef84cf5cab8a11e39513637bca27ac6c60346 100644 (file)
@@ -181,7 +181,7 @@ static const struct i2c_reg_value saa7127_init_config_common[] = {
 #define SAA7127_60HZ_DAC_CONTROL 0x15
 static const struct i2c_reg_value saa7127_init_config_60hz[] = {
        { SAA7127_REG_BURST_START,                      0x19 },
-       /* BURST_END is also used as a chip ID in saa7127_detect_client */
+       /* BURST_END is also used as a chip ID in saa7127_probe */
        { SAA7127_REG_BURST_END,                        0x1d },
        { SAA7127_REG_CHROMA_PHASE,                     0xa3 },
        { SAA7127_REG_GAINU,                            0x98 },
@@ -200,10 +200,10 @@ static const struct i2c_reg_value saa7127_init_config_60hz[] = {
        { 0, 0 }
 };
 
-#define SAA7127_50HZ_DAC_CONTROL 0x02
-static struct i2c_reg_value saa7127_init_config_50hz[] = {
+#define SAA7127_50HZ_PAL_DAC_CONTROL 0x02
+static struct i2c_reg_value saa7127_init_config_50hz_pal[] = {
        { SAA7127_REG_BURST_START,                      0x21 },
-       /* BURST_END is also used as a chip ID in saa7127_detect_client */
+       /* BURST_END is also used as a chip ID in saa7127_probe */
        { SAA7127_REG_BURST_END,                        0x1d },
        { SAA7127_REG_CHROMA_PHASE,                     0x3f },
        { SAA7127_REG_GAINU,                            0x7d },
@@ -222,6 +222,28 @@ static struct i2c_reg_value saa7127_init_config_50hz[] = {
        { 0, 0 }
 };
 
+#define SAA7127_50HZ_SECAM_DAC_CONTROL 0x08
+static struct i2c_reg_value saa7127_init_config_50hz_secam[] = {
+       { SAA7127_REG_BURST_START,                      0x21 },
+       /* BURST_END is also used as a chip ID in saa7127_probe */
+       { SAA7127_REG_BURST_END,                        0x1d },
+       { SAA7127_REG_CHROMA_PHASE,                     0x3f },
+       { SAA7127_REG_GAINU,                            0x6a },
+       { SAA7127_REG_GAINV,                            0x81 },
+       { SAA7127_REG_BLACK_LEVEL,                      0x33 },
+       { SAA7127_REG_BLANKING_LEVEL,                   0x35 },
+       { SAA7127_REG_VBI_BLANKING,                     0x35 },
+       { SAA7127_REG_DAC_CONTROL,                      0x08 },
+       { SAA7127_REG_BURST_AMP,                        0x2f },
+       { SAA7127_REG_SUBC3,                            0xb2 },
+       { SAA7127_REG_SUBC2,                            0x3b },
+       { SAA7127_REG_SUBC1,                            0xa3 },
+       { SAA7127_REG_SUBC0,                            0x28 },
+       { SAA7127_REG_MULTI,                            0x90 },
+       { SAA7127_REG_CLOSED_CAPTION,                   0x00 },
+       { 0, 0 }
+};
+
 /*
  **********************************************************************
  *
@@ -463,10 +485,21 @@ static int saa7127_set_std(struct v4l2_subdev *sd, v4l2_std_id std)
                v4l2_dbg(1, debug, sd, "Selecting 60 Hz video Standard\n");
                inittab = saa7127_init_config_60hz;
                state->reg_61 = SAA7127_60HZ_DAC_CONTROL;
+
+       } else if (state->ident == V4L2_IDENT_SAA7129 &&
+                  (std & V4L2_STD_SECAM) &&
+                  !(std & (V4L2_STD_625_50 & ~V4L2_STD_SECAM))) {
+
+               /* If and only if SECAM, with a SAA712[89] */
+               v4l2_dbg(1, debug, sd,
+                        "Selecting 50 Hz SECAM video Standard\n");
+               inittab = saa7127_init_config_50hz_secam;
+               state->reg_61 = SAA7127_50HZ_SECAM_DAC_CONTROL;
+
        } else {
-               v4l2_dbg(1, debug, sd, "Selecting 50 Hz video Standard\n");
-               inittab = saa7127_init_config_50hz;
-               state->reg_61 = SAA7127_50HZ_DAC_CONTROL;
+               v4l2_dbg(1, debug, sd, "Selecting 50 Hz PAL video Standard\n");
+               inittab = saa7127_init_config_50hz_pal;
+               state->reg_61 = SAA7127_50HZ_PAL_DAC_CONTROL;
        }
 
        /* Write Table */
index 03f572708b85ef6bd658bef30dea586ed23e11ac..297833fb3b4acaabd65b17b14040b274779a7f94 100644 (file)
@@ -4160,7 +4160,7 @@ struct saa7134_board saa7134_boards[] = {
                        .amux = LINE2,
                },
        },
-       [SAA7134_BOARD_BEHOLD_505RDS] = {
+       [SAA7134_BOARD_BEHOLD_505RDS_MK5] = {
                /*       Beholder Intl. Ltd. 2008      */
                /*Dmitry Belimov <d.belimov@gmail.com> */
                .name           = "Beholder BeholdTV 505 RDS",
@@ -5320,6 +5320,41 @@ struct saa7134_board saa7134_boards[] = {
                        .vmux = 8,
                } },
        },
+       [SAA7134_BOARD_BEHOLD_505RDS_MK3] = {
+               /*       Beholder Intl. Ltd. 2008      */
+               /*Dmitry Belimov <d.belimov@gmail.com> */
+               .name           = "Beholder BeholdTV 505 RDS",
+               .audio_clock    = 0x00200000,
+               .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
+               .radio_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .rds_addr       = 0x10,
+               .tda9887_conf   = TDA9887_PRESENT,
+               .gpiomask       = 0x00008000,
+               .inputs         = {{
+                       .name = name_tv,
+                       .vmux = 3,
+                       .amux = LINE2,
+                       .tv   = 1,
+               }, {
+                       .name = name_comp1,
+                       .vmux = 1,
+                       .amux = LINE1,
+               }, {
+                       .name = name_svideo,
+                       .vmux = 8,
+                       .amux = LINE1,
+               } },
+               .mute = {
+                       .name = name_mute,
+                       .amux = LINE1,
+               },
+               .radio = {
+                       .name = name_radio,
+                       .amux = LINE2,
+               },
+       },
 
 };
 
@@ -6235,7 +6270,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
                .device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
                .subvendor    = 0x0000,
                .subdevice    = 0x505B,
-               .driver_data  = SAA7134_BOARD_BEHOLD_505RDS,
+               .driver_data  = SAA7134_BOARD_BEHOLD_505RDS_MK5,
+       }, {
+               .vendor       = PCI_VENDOR_ID_PHILIPS,
+               .device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
+               .subvendor    = 0x0000,
+               .subdevice    = 0x5051,
+               .driver_data  = SAA7134_BOARD_BEHOLD_505RDS_MK3,
        },{
                .vendor       = PCI_VENDOR_ID_PHILIPS,
                .device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
@@ -6792,7 +6833,8 @@ int saa7134_board_init1(struct saa7134_dev *dev)
        case SAA7134_BOARD_BEHOLD_407FM:
        case SAA7134_BOARD_BEHOLD_409:
        case SAA7134_BOARD_BEHOLD_505FM:
-       case SAA7134_BOARD_BEHOLD_505RDS:
+       case SAA7134_BOARD_BEHOLD_505RDS_MK5:
+       case SAA7134_BOARD_BEHOLD_505RDS_MK3:
        case SAA7134_BOARD_BEHOLD_507_9FM:
        case SAA7134_BOARD_BEHOLD_507RDS_MK3:
        case SAA7134_BOARD_BEHOLD_507RDS_MK5:
@@ -6953,8 +6995,8 @@ int saa7134_board_init1(struct saa7134_dev *dev)
                break;
        case SAA7134_BOARD_VIDEOMATE_S350:
                dev->has_remote = SAA7134_REMOTE_GPIO;
-               saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00008000, 0x00008000);
-               saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
+               saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x0000C000, 0x0000C000);
+               saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0000C000, 0x0000C000);
                break;
        }
        return 0;
index 9f85e917f9f39da8565954f6c38eb45021d30bad..a7ad7810fddcc96454abcc1f806c7d289cd2cb79 100644 (file)
@@ -420,19 +420,6 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)
                ctrl |= SAA7134_MAIN_CTRL_TE5;
                irq  |= SAA7134_IRQ1_INTE_RA2_1 |
                        SAA7134_IRQ1_INTE_RA2_0;
-
-               /* dma: setup channel 5 (= TS) */
-
-               saa_writeb(SAA7134_TS_DMA0, (dev->ts.nr_packets - 1) & 0xff);
-               saa_writeb(SAA7134_TS_DMA1,
-                       ((dev->ts.nr_packets - 1) >> 8) & 0xff);
-               /* TSNOPIT=0, TSCOLAP=0 */
-               saa_writeb(SAA7134_TS_DMA2,
-                       (((dev->ts.nr_packets - 1) >> 16) & 0x3f) | 0x00);
-               saa_writel(SAA7134_RS_PITCH(5), TS_PACKET_SIZE);
-               saa_writel(SAA7134_RS_CONTROL(5), SAA7134_RS_CONTROL_BURST_16 |
-                                                 SAA7134_RS_CONTROL_ME |
-                                                 (dev->ts.pt_ts.dma >> 12));
        }
 
        /* set task conditions + field handling */
index 7dfecfc6017cab0db7d0bea4c979e783fc4ec13d..ee5bff02a92cb098a669c2f8204e24da90659bf5 100644 (file)
@@ -93,9 +93,9 @@ static int ts_open(struct file *file)
        dprintk("open dev=%s\n", video_device_node_name(vdev));
        err = -EBUSY;
        if (!mutex_trylock(&dev->empress_tsq.vb_lock))
-               goto done;
+               return err;
        if (atomic_read(&dev->empress_users))
-               goto done_up;
+               goto done;
 
        /* Unmute audio */
        saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
@@ -105,10 +105,8 @@ static int ts_open(struct file *file)
        file->private_data = dev;
        err = 0;
 
-done_up:
-       mutex_unlock(&dev->empress_tsq.vb_lock);
 done:
-       unlock_kernel();
+       mutex_unlock(&dev->empress_tsq.vb_lock);
        return err;
 }
 
index f8e985989ca0a7a7bae70ed8d17a952335827126..9499000f66b6bc8a6e640cfd57ae9d7492a9e821 100644 (file)
@@ -460,7 +460,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
        int polling      = 0;
        int rc5_gpio     = 0;
        int nec_gpio     = 0;
-       int ir_type      = IR_TYPE_OTHER;
+       u64 ir_type = IR_TYPE_OTHER;
        int err;
 
        if (dev->has_remote != SAA7134_REMOTE_GPIO)
@@ -568,7 +568,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)
        case SAA7134_BOARD_BEHOLD_407FM:
        case SAA7134_BOARD_BEHOLD_409:
        case SAA7134_BOARD_BEHOLD_505FM:
-       case SAA7134_BOARD_BEHOLD_505RDS:
+       case SAA7134_BOARD_BEHOLD_505RDS_MK5:
+       case SAA7134_BOARD_BEHOLD_505RDS_MK3:
        case SAA7134_BOARD_BEHOLD_507_9FM:
        case SAA7134_BOARD_BEHOLD_507RDS_MK3:
        case SAA7134_BOARD_BEHOLD_507RDS_MK5:
@@ -728,7 +729,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
        dev->remote = ir;
        saa7134_ir_start(dev, ir);
 
-       err = ir_input_register(ir->dev, ir_codes);
+       err = ir_input_register(ir->dev, ir_codes, NULL);
        if (err)
                goto err_out_stop;
 
index 03488ba4c99c07f66a15e989414b700054ae1281..b9817d74943fa014b9f4861c58e002dec19dcd43 100644 (file)
@@ -250,6 +250,19 @@ int saa7134_ts_start(struct saa7134_dev *dev)
 
        BUG_ON(dev->ts_started);
 
+       /* dma: setup channel 5 (= TS) */
+       saa_writeb(SAA7134_TS_DMA0, (dev->ts.nr_packets - 1) & 0xff);
+       saa_writeb(SAA7134_TS_DMA1,
+               ((dev->ts.nr_packets - 1) >> 8) & 0xff);
+       /* TSNOPIT=0, TSCOLAP=0 */
+       saa_writeb(SAA7134_TS_DMA2,
+               (((dev->ts.nr_packets - 1) >> 16) & 0x3f) | 0x00);
+       saa_writel(SAA7134_RS_PITCH(5), TS_PACKET_SIZE);
+       saa_writel(SAA7134_RS_CONTROL(5), SAA7134_RS_CONTROL_BURST_16 |
+                                         SAA7134_RS_CONTROL_ME |
+                                         (dev->ts.pt_ts.dma >> 12));
+
+       /* reset hardware TS buffers */
        saa_writeb(SAA7134_TS_SERIAL1, 0x00);
        saa_writeb(SAA7134_TS_SERIAL1, 0x03);
        saa_writeb(SAA7134_TS_SERIAL1, 0x00);
index cb732640ac4ad829770b8c40b3761a4c140338bb..31138d3e51bb5907d20398d20c27de8d93fda50c 100644 (file)
@@ -205,7 +205,7 @@ static struct saa7134_format formats[] = {
 
 #define NORM_525_60                    \
                .h_start       = 0,     \
-               .h_stop        = 703,   \
+               .h_stop        = 719,   \
                .video_v_start = 23,    \
                .video_v_stop  = 262,   \
                .vbi_v_start_0 = 10,    \
index 53b7e0b8a2fbd8c70b9f8aa9524f974779d49379..bf130967ed17175baf20ddebde77f9d705537922 100644 (file)
@@ -282,7 +282,7 @@ struct saa7134_format {
 #define SAA7134_BOARD_HAUPPAUGE_HVR1120   156
 #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157
 #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158
-#define SAA7134_BOARD_BEHOLD_505RDS         159
+#define SAA7134_BOARD_BEHOLD_505RDS_MK5     159
 #define SAA7134_BOARD_BEHOLD_507RDS_MK3     160
 #define SAA7134_BOARD_BEHOLD_507RDS_MK5     161
 #define SAA7134_BOARD_BEHOLD_607FM_MK5      162
@@ -299,6 +299,7 @@ struct saa7134_format {
 #define SAA7134_BOARD_ZOLID_HYBRID_PCI         173
 #define SAA7134_BOARD_ASUS_EUROPA_HYBRID       174
 #define SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S 175
+#define SAA7134_BOARD_BEHOLD_505RDS_MK3     176
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8
index 6f094a96ac810afbfbad67667b50bcd70cdca7d9..1d487c1503408decf21a9f407ceff3d6fbc048e9 100644 (file)
@@ -523,7 +523,7 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 addr, u32 datalen,
        }
 
        reglen = saa7164_i2caddr_to_reglen(bus, addr);
-       if (unitid < 0) {
+       if (reglen < 0) {
                printk(KERN_ERR
                        "%s() error, cannot translate regaddr to reglen\n",
                        __func__);
index d69363f0d8c9932b21f02ada8f865899b115f336..fb88c63188f3c02ab7b8930938a0168fbc79a332 100644 (file)
@@ -1748,6 +1748,22 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
                                       icd);
 }
 
+static int sh_mobile_ceu_get_parm(struct soc_camera_device *icd,
+                                 struct v4l2_streamparm *parm)
+{
+       struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+
+       return v4l2_subdev_call(sd, video, g_parm, parm);
+}
+
+static int sh_mobile_ceu_set_parm(struct soc_camera_device *icd,
+                                 struct v4l2_streamparm *parm)
+{
+       struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+
+       return v4l2_subdev_call(sd, video, s_parm, parm);
+}
+
 static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd,
                                  struct v4l2_control *ctrl)
 {
@@ -1808,6 +1824,8 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
        .try_fmt        = sh_mobile_ceu_try_fmt,
        .set_ctrl       = sh_mobile_ceu_set_ctrl,
        .get_ctrl       = sh_mobile_ceu_get_ctrl,
+       .set_parm       = sh_mobile_ceu_set_parm,
+       .get_parm       = sh_mobile_ceu_get_parm,
        .reqbufs        = sh_mobile_ceu_reqbufs,
        .poll           = sh_mobile_ceu_poll,
        .querycap       = sh_mobile_ceu_querycap,
@@ -1827,7 +1845,7 @@ static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
-       if (!res || !irq) {
+       if (!res || (int)irq <= 0) {
                dev_err(&pdev->dev, "Not enough CEU platform resources.\n");
                err = -ENODEV;
                goto exit;
index f71f272776dedca9d945ad7b6d4fe760d53767bc..6ebaf2940d06b3af7b9392360d144cd03e27236b 100644 (file)
@@ -1,7 +1,10 @@
 config USB_SN9C102
-       tristate "USB SN9C1xx PC Camera Controller support"
+       tristate "USB SN9C1xx PC Camera Controller support (DEPRECATED)"
        depends on VIDEO_V4L2
        ---help---
+         This driver is DEPRECATED please use the gspca sonixb and
+         sonixj modules instead.
+
          Say Y here if you want support for cameras based on SONiX SN9C101,
          SN9C102, SN9C103, SN9C105 and SN9C120 PC Camera Controllers.
 
index 36ee43a9ee95a4b400383183ac2ac1159ed1e933..cc40d6ba9f2248eba537dd9358c2c621484b10ac 100644 (file)
@@ -45,20 +45,24 @@ static const struct usb_device_id sn9c102_id_table[] = {
        { SN9C102_USB_DEVICE(0x0c45, 0x6005, BRIDGE_SN9C102), },
 #endif
        { SN9C102_USB_DEVICE(0x0c45, 0x6007, BRIDGE_SN9C102), },
+#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE
        { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), },
 /*     { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */
+#endif
        { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), },
+#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE
        { SN9C102_USB_DEVICE(0x0c45, 0x6028, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), },
+#endif
        { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), },
 #if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE
        { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), },
-#endif
 /*     { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */
+#endif
        { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), },
        { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), },
        /* SN9C103 */
index 6b3fbcca7747bf43205d121adeb02c7af4ef66b5..80f6bfa2632bcb7e5fd140147c10d83e32bd8524 100644 (file)
@@ -781,6 +781,32 @@ static int soc_camera_s_crop(struct file *file, void *fh,
        return ret;
 }
 
+static int soc_camera_g_parm(struct file *file, void *fh,
+                            struct v4l2_streamparm *a)
+{
+       struct soc_camera_file *icf = file->private_data;
+       struct soc_camera_device *icd = icf->icd;
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+
+       if (ici->ops->get_parm)
+               return ici->ops->get_parm(icd, a);
+
+       return -ENOIOCTLCMD;
+}
+
+static int soc_camera_s_parm(struct file *file, void *fh,
+                            struct v4l2_streamparm *a)
+{
+       struct soc_camera_file *icf = file->private_data;
+       struct soc_camera_device *icd = icf->icd;
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+
+       if (ici->ops->set_parm)
+               return ici->ops->set_parm(icd, a);
+
+       return -ENOIOCTLCMD;
+}
+
 static int soc_camera_g_chip_ident(struct file *file, void *fh,
                                   struct v4l2_dbg_chip_ident *id)
 {
@@ -846,10 +872,8 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd,
        struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
        struct i2c_adapter *adap = i2c_get_adapter(icl->i2c_adapter_id);
        struct v4l2_subdev *subdev;
-       int ret;
 
        if (!adap) {
-               ret = -ENODEV;
                dev_err(&icd->dev, "Cannot get I2C adapter #%d. No driver?\n",
                        icl->i2c_adapter_id);
                goto ei2cga;
@@ -859,10 +883,8 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd,
 
        subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap,
                                icl->module_name, icl->board_info, NULL);
-       if (!subdev) {
-               ret = -ENOMEM;
+       if (!subdev)
                goto ei2cnd;
-       }
 
        client = subdev->priv;
 
@@ -873,7 +895,7 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd,
 ei2cnd:
        i2c_put_adapter(adap);
 ei2cga:
-       return ret;
+       return -ENODEV;
 }
 
 static void soc_camera_free_i2c(struct soc_camera_device *icd)
@@ -1260,6 +1282,8 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
        .vidioc_cropcap          = soc_camera_cropcap,
        .vidioc_g_crop           = soc_camera_g_crop,
        .vidioc_s_crop           = soc_camera_s_crop,
+       .vidioc_g_parm           = soc_camera_g_parm,
+       .vidioc_s_parm           = soc_camera_s_parm,
        .vidioc_g_chip_ident     = soc_camera_g_chip_ident,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
        .vidioc_g_register       = soc_camera_g_register,
index f8d5c87dc2aafff0854006d4dbea5d3dcadd218a..8b63b6545e7657827a054505ffd5d109b2c830a2 100644 (file)
@@ -24,91 +24,106 @@ static const struct soc_mbus_pixelfmt mbus_fmt[] = {
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(YVYU8_2X8_LE)] = {
+       },
+       [MBUS_IDX(YVYU8_2X8_LE)] = {
                .fourcc                 = V4L2_PIX_FMT_YVYU,
                .name                   = "YVYU",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(YUYV8_2X8_BE)] = {
+       },
+       [MBUS_IDX(YUYV8_2X8_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_UYVY,
                .name                   = "UYVY",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(YVYU8_2X8_BE)] = {
+       },
+       [MBUS_IDX(YVYU8_2X8_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_VYUY,
                .name                   = "VYUY",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(RGB555_2X8_PADHI_LE)] = {
+       },
+       [MBUS_IDX(RGB555_2X8_PADHI_LE)] = {
                .fourcc                 = V4L2_PIX_FMT_RGB555,
                .name                   = "RGB555",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(RGB555_2X8_PADHI_BE)] = {
+       },
+       [MBUS_IDX(RGB555_2X8_PADHI_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_RGB555X,
                .name                   = "RGB555X",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(RGB565_2X8_LE)] = {
+       },
+       [MBUS_IDX(RGB565_2X8_LE)] = {
                .fourcc                 = V4L2_PIX_FMT_RGB565,
                .name                   = "RGB565",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(RGB565_2X8_BE)] = {
+       },
+       [MBUS_IDX(RGB565_2X8_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_RGB565X,
                .name                   = "RGB565X",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(SBGGR8_1X8)] = {
+       },
+       [MBUS_IDX(SBGGR8_1X8)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR8,
                .name                   = "Bayer 8 BGGR",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_NONE,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(SBGGR10_1X10)] = {
+       },
+       [MBUS_IDX(SBGGR10_1X10)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR10,
                .name                   = "Bayer 10 BGGR",
                .bits_per_sample        = 10,
                .packing                = SOC_MBUS_PACKING_EXTEND16,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(GREY8_1X8)] = {
+       },
+       [MBUS_IDX(GREY8_1X8)] = {
                .fourcc                 = V4L2_PIX_FMT_GREY,
                .name                   = "Grey",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_NONE,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(Y10_1X10)] = {
+       },
+       [MBUS_IDX(Y10_1X10)] = {
                .fourcc                 = V4L2_PIX_FMT_Y10,
                .name                   = "Grey 10bit",
                .bits_per_sample        = 10,
                .packing                = SOC_MBUS_PACKING_EXTEND16,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(SBGGR10_2X8_PADHI_LE)] = {
+       },
+       [MBUS_IDX(SBGGR10_2X8_PADHI_LE)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR10,
                .name                   = "Bayer 10 BGGR",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(SBGGR10_2X8_PADLO_LE)] = {
+       },
+       [MBUS_IDX(SBGGR10_2X8_PADLO_LE)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR10,
                .name                   = "Bayer 10 BGGR",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADLO,
                .order                  = SOC_MBUS_ORDER_LE,
-       }, [MBUS_IDX(SBGGR10_2X8_PADHI_BE)] = {
+       },
+       [MBUS_IDX(SBGGR10_2X8_PADHI_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR10,
                .name                   = "Bayer 10 BGGR",
                .bits_per_sample        = 8,
                .packing                = SOC_MBUS_PACKING_2X8_PADHI,
                .order                  = SOC_MBUS_ORDER_BE,
-       }, [MBUS_IDX(SBGGR10_2X8_PADLO_BE)] = {
+       },
+       [MBUS_IDX(SBGGR10_2X8_PADLO_BE)] = {
                .fourcc                 = V4L2_PIX_FMT_SBGGR10,
                .name                   = "Bayer 10 BGGR",
                .bits_per_sample        = 8,
@@ -134,7 +149,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line);
 const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
        enum v4l2_mbus_pixelcode code)
 {
-       if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt))
+       if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) ||
+           code <= V4L2_MBUS_FMT_FIXED)
                return NULL;
        return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1;
 }
diff --git a/drivers/media/video/tlg2300/Kconfig b/drivers/media/video/tlg2300/Kconfig
new file mode 100644 (file)
index 0000000..2c29ec6
--- /dev/null
@@ -0,0 +1,16 @@
+config VIDEO_TLG2300
+       tristate "Telegent TLG2300 USB video capture support"
+       depends on VIDEO_DEV && I2C && INPUT && SND && DVB_CORE
+       select VIDEO_TUNER
+       select VIDEO_TVEEPROM
+       select VIDEO_IR
+       select VIDEOBUF_VMALLOC
+       select SND_PCM
+       select VIDEOBUF_DVB
+
+       ---help---
+         This is a video4linux driver for Telegent tlg2300 based TV cards.
+         The driver supports V4L2, DVB-T and radio.
+
+         To compile this driver as a module, choose M here: the
+         module will be called poseidon
diff --git a/drivers/media/video/tlg2300/Makefile b/drivers/media/video/tlg2300/Makefile
new file mode 100644 (file)
index 0000000..81bb7fd
--- /dev/null
@@ -0,0 +1,9 @@
+poseidon-objs := pd-video.o pd-alsa.o pd-dvb.o pd-radio.o pd-main.o
+
+obj-$(CONFIG_VIDEO_TLG2300) += poseidon.o
+
+EXTRA_CFLAGS += -Idrivers/media/video
+EXTRA_CFLAGS += -Idrivers/media/common/tuners
+EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
+EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
+
diff --git a/drivers/media/video/tlg2300/pd-alsa.c b/drivers/media/video/tlg2300/pd-alsa.c
new file mode 100644 (file)
index 0000000..6f42621
--- /dev/null
@@ -0,0 +1,332 @@
+#include <linux/kernel.h>
+#include <linux/usb.h>
+#include <linux/init.h>
+#include <linux/sound.h>
+#include <linux/spinlock.h>
+#include <linux/soundcard.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/info.h>
+#include <sound/initval.h>
+#include <sound/control.h>
+#include <media/v4l2-common.h>
+#include "pd-common.h"
+#include "vendorcmds.h"
+
+static void complete_handler_audio(struct urb *urb);
+#define AUDIO_EP       (0x83)
+#define AUDIO_BUF_SIZE (512)
+#define PERIOD_SIZE    (1024 * 8)
+#define PERIOD_MIN     (4)
+#define PERIOD_MAX     PERIOD_MIN
+
+static struct snd_pcm_hardware snd_pd_hw_capture = {
+       .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
+               SNDRV_PCM_INFO_MMAP           |
+               SNDRV_PCM_INFO_INTERLEAVED |
+               SNDRV_PCM_INFO_MMAP_VALID,
+
+       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+       .rates = SNDRV_PCM_RATE_48000,
+
+       .rate_min = 48000,
+       .rate_max = 48000,
+       .channels_min = 2,
+       .channels_max = 2,
+       .buffer_bytes_max = PERIOD_SIZE * PERIOD_MIN,
+       .period_bytes_min = PERIOD_SIZE,
+       .period_bytes_max = PERIOD_SIZE,
+       .periods_min = PERIOD_MIN,
+       .periods_max = PERIOD_MAX,
+       /*
+       .buffer_bytes_max = 62720 * 8,
+       .period_bytes_min = 64,
+       .period_bytes_max = 12544,
+       .periods_min = 2,
+       .periods_max = 98
+       */
+};
+
+static int snd_pd_capture_open(struct snd_pcm_substream *substream)
+{
+       struct poseidon *p = snd_pcm_substream_chip(substream);
+       struct poseidon_audio *pa = &p->audio;
+       struct snd_pcm_runtime *runtime = substream->runtime;
+
+       if (!p)
+               return -ENODEV;
+       pa->users++;
+       pa->card_close          = 0;
+       pa->capture_pcm_substream       = substream;
+       runtime->private_data           = p;
+
+       runtime->hw = snd_pd_hw_capture;
+       snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
+       usb_autopm_get_interface(p->interface);
+       kref_get(&p->kref);
+       return 0;
+}
+
+static int snd_pd_pcm_close(struct snd_pcm_substream *substream)
+{
+       struct poseidon *p = snd_pcm_substream_chip(substream);
+       struct poseidon_audio *pa = &p->audio;
+
+       pa->users--;
+       pa->card_close          = 1;
+       usb_autopm_put_interface(p->interface);
+       kref_put(&p->kref, poseidon_delete);
+       return 0;
+}
+
+static int snd_pd_hw_capture_params(struct snd_pcm_substream *substream,
+                                       struct snd_pcm_hw_params *hw_params)
+{
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       unsigned int size;
+
+       size = params_buffer_bytes(hw_params);
+       if (runtime->dma_area) {
+               if (runtime->dma_bytes > size)
+                       return 0;
+               vfree(runtime->dma_area);
+       }
+       runtime->dma_area = vmalloc(size);
+       if (!runtime->dma_area)
+               return -ENOMEM;
+       else
+               runtime->dma_bytes = size;
+       return 0;
+}
+
+static int audio_buf_free(struct poseidon *p)
+{
+       struct poseidon_audio *pa = &p->audio;
+       int i;
+
+       for (i = 0; i < AUDIO_BUFS; i++)
+               if (pa->urb_array[i])
+                       usb_kill_urb(pa->urb_array[i]);
+       free_all_urb_generic(pa->urb_array, AUDIO_BUFS);
+       logpm();
+       return 0;
+}
+
+static int snd_pd_hw_capture_free(struct snd_pcm_substream *substream)
+{
+       struct poseidon *p = snd_pcm_substream_chip(substream);
+
+       logpm();
+       audio_buf_free(p);
+       return 0;
+}
+
+static int snd_pd_prepare(struct snd_pcm_substream *substream)
+{
+       return 0;
+}
+
+#define AUDIO_TRAILER_SIZE     (16)
+static inline void handle_audio_data(struct urb *urb, int *period_elapsed)
+{
+       struct poseidon_audio *pa = urb->context;
+       struct snd_pcm_runtime *runtime = pa->capture_pcm_substream->runtime;
+
+       int stride      = runtime->frame_bits >> 3;
+       int len         = urb->actual_length / stride;
+       unsigned char *cp       = urb->transfer_buffer;
+       unsigned int oldptr     = pa->rcv_position;
+
+       if (urb->actual_length == AUDIO_BUF_SIZE - 4)
+               len -= (AUDIO_TRAILER_SIZE / stride);
+
+       /* do the copy */
+       if (oldptr + len >= runtime->buffer_size) {
+               unsigned int cnt = runtime->buffer_size - oldptr;
+
+               memcpy(runtime->dma_area + oldptr * stride, cp, cnt * stride);
+               memcpy(runtime->dma_area, (cp + cnt * stride),
+                                       (len * stride - cnt * stride));
+       } else
+               memcpy(runtime->dma_area + oldptr * stride, cp, len * stride);
+
+       /* update the statas */
+       snd_pcm_stream_lock(pa->capture_pcm_substream);
+       pa->rcv_position        += len;
+       if (pa->rcv_position >= runtime->buffer_size)
+               pa->rcv_position -= runtime->buffer_size;
+
+       pa->copied_position += (len);
+       if (pa->copied_position >= runtime->period_size) {
+               pa->copied_position -= runtime->period_size;
+               *period_elapsed = 1;
+       }
+       snd_pcm_stream_unlock(pa->capture_pcm_substream);
+}
+
+static void complete_handler_audio(struct urb *urb)
+{
+       struct poseidon_audio *pa = urb->context;
+       struct snd_pcm_substream *substream = pa->capture_pcm_substream;
+       int    period_elapsed = 0;
+       int    ret;
+
+       if (1 == pa->card_close || pa->capture_stream != STREAM_ON)
+               return;
+
+       if (urb->status != 0) {
+               /*if (urb->status == -ESHUTDOWN)*/
+                       return;
+       }
+
+       if (substream) {
+               if (urb->actual_length) {
+                       handle_audio_data(urb, &period_elapsed);
+                       if (period_elapsed)
+                               snd_pcm_period_elapsed(substream);
+               }
+       }
+
+       ret = usb_submit_urb(urb, GFP_ATOMIC);
+       if (ret < 0)
+               log("audio urb failed (errcod = %i)", ret);
+       return;
+}
+
+static int fire_audio_urb(struct poseidon *p)
+{
+       int i, ret = 0;
+       struct poseidon_audio *pa = &p->audio;
+
+       alloc_bulk_urbs_generic(pa->urb_array, AUDIO_BUFS,
+                       p->udev, AUDIO_EP,
+                       AUDIO_BUF_SIZE, GFP_ATOMIC,
+                       complete_handler_audio, pa);
+
+       for (i = 0; i < AUDIO_BUFS; i++) {
+               ret = usb_submit_urb(pa->urb_array[i], GFP_KERNEL);
+               if (ret)
+                       log("urb err : %d", ret);
+       }
+       log();
+       return ret;
+}
+
+static int snd_pd_capture_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+       struct poseidon *p = snd_pcm_substream_chip(substream);
+       struct poseidon_audio *pa = &p->audio;
+
+       if (debug_mode)
+               log("cmd %d, audio stat : %d\n", cmd, pa->capture_stream);
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_RESUME:
+       case SNDRV_PCM_TRIGGER_START:
+               if (pa->capture_stream == STREAM_ON)
+                       return 0;
+
+               pa->rcv_position = pa->copied_position = 0;
+               pa->capture_stream = STREAM_ON;
+
+               if (in_hibernation(p))
+                       return 0;
+               fire_audio_urb(p);
+               return 0;
+
+       case SNDRV_PCM_TRIGGER_SUSPEND:
+               pa->capture_stream = STREAM_SUSPEND;
+               return 0;
+       case SNDRV_PCM_TRIGGER_STOP:
+               pa->capture_stream = STREAM_OFF;
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}
+
+static snd_pcm_uframes_t
+snd_pd_capture_pointer(struct snd_pcm_substream *substream)
+{
+       struct poseidon *p = snd_pcm_substream_chip(substream);
+       struct poseidon_audio *pa = &p->audio;
+       return pa->rcv_position;
+}
+
+static struct page *snd_pcm_pd_get_page(struct snd_pcm_substream *subs,
+                                            unsigned long offset)
+{
+       void *pageptr = subs->runtime->dma_area + offset;
+       return vmalloc_to_page(pageptr);
+}
+
+static struct snd_pcm_ops pcm_capture_ops = {
+       .open      = snd_pd_capture_open,
+       .close     = snd_pd_pcm_close,
+       .ioctl     = snd_pcm_lib_ioctl,
+       .hw_params = snd_pd_hw_capture_params,
+       .hw_free   = snd_pd_hw_capture_free,
+       .prepare   = snd_pd_prepare,
+       .trigger   = snd_pd_capture_trigger,
+       .pointer   = snd_pd_capture_pointer,
+       .page      = snd_pcm_pd_get_page,
+};
+
+#ifdef CONFIG_PM
+int pm_alsa_suspend(struct poseidon *p)
+{
+       logpm(p);
+       audio_buf_free(p);
+       return 0;
+}
+
+int pm_alsa_resume(struct poseidon *p)
+{
+       logpm(p);
+       fire_audio_urb(p);
+       return 0;
+}
+#endif
+
+int poseidon_audio_init(struct poseidon *p)
+{
+       struct poseidon_audio *pa = &p->audio;
+       struct snd_card *card;
+       struct snd_pcm *pcm;
+       int ret;
+
+       ret = snd_card_create(-1, "Telegent", THIS_MODULE, 0, &card);
+       if (ret != 0)
+               return ret;
+
+       ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm);
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);
+       pcm->info_flags   = 0;
+       pcm->private_data = p;
+       strcpy(pcm->name, "poseidon audio capture");
+
+       strcpy(card->driver, "ALSA driver");
+       strcpy(card->shortname, "poseidon Audio");
+       strcpy(card->longname, "poseidon ALSA Audio");
+
+       if (snd_card_register(card)) {
+               snd_card_free(card);
+               return -ENOMEM;
+       }
+       pa->card = card;
+       return 0;
+}
+
+int poseidon_audio_free(struct poseidon *p)
+{
+       struct poseidon_audio *pa = &p->audio;
+
+       if (pa->card)
+               snd_card_free(pa->card);
+       return 0;
+}
diff --git a/drivers/media/video/tlg2300/pd-common.h b/drivers/media/video/tlg2300/pd-common.h
new file mode 100644 (file)
index 0000000..46066bd
--- /dev/null
@@ -0,0 +1,282 @@
+#ifndef PD_COMMON_H
+#define PD_COMMON_H
+
+#include <linux/version.h>
+#include <linux/fs.h>
+#include <linux/wait.h>
+#include <linux/list.h>
+#include <linux/videodev2.h>
+#include <linux/semaphore.h>
+#include <linux/usb.h>
+#include <linux/poll.h>
+#include <media/videobuf-vmalloc.h>
+#include <media/v4l2-device.h>
+
+#include "dvb_frontend.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dmxdev.h"
+
+#define SBUF_NUM       8
+#define MAX_BUFFER_NUM 6
+#define PK_PER_URB     32
+#define ISO_PKT_SIZE   3072
+
+#define POSEIDON_STATE_NONE            (0x0000)
+#define POSEIDON_STATE_ANALOG          (0x0001)
+#define POSEIDON_STATE_FM              (0x0002)
+#define POSEIDON_STATE_DVBT            (0x0004)
+#define POSEIDON_STATE_VBI             (0x0008)
+#define POSEIDON_STATE_DISCONNECT      (0x0080)
+
+#define PM_SUSPEND_DELAY       3
+
+#define V4L_PAL_VBI_LINES      18
+#define V4L_NTSC_VBI_LINES     12
+#define V4L_PAL_VBI_FRAMESIZE  (V4L_PAL_VBI_LINES * 1440 * 2)
+#define V4L_NTSC_VBI_FRAMESIZE (V4L_NTSC_VBI_LINES * 1440 * 2)
+
+#define TUNER_FREQ_MIN         (45000000)
+#define TUNER_FREQ_MAX         (862000000)
+
+struct vbi_data {
+       struct video_device     *v_dev;
+       struct video_data       *video;
+       struct front_face       *front;
+
+       unsigned int            copied;
+       unsigned int            vbi_size; /* the whole size of two fields */
+       int                     users;
+};
+
+/*
+ * This is the running context of the video, it is useful for
+ * resume()
+ */
+struct running_context {
+       u32             freq;           /* VIDIOC_S_FREQUENCY */
+       int             audio_idx;      /* VIDIOC_S_TUNER    */
+       v4l2_std_id     tvnormid;       /* VIDIOC_S_STD     */
+       int             sig_index;      /* VIDIOC_S_INPUT  */
+       struct v4l2_pix_format pix;     /* VIDIOC_S_FMT   */
+};
+
+struct video_data {
+       /* v4l2 video device */
+       struct video_device     *v_dev;
+
+       /* the working context */
+       struct running_context  context;
+
+       /* for data copy */
+       int             field_count;
+
+       char            *dst;
+       int             lines_copied;
+       int             prev_left;
+
+       int             lines_per_field;
+       int             lines_size;
+
+       /* for communication */
+       u8                      endpoint_addr;
+       struct urb              *urb_array[SBUF_NUM];
+       struct vbi_data         *vbi;
+       struct poseidon         *pd;
+       struct front_face       *front;
+
+       int                     is_streaming;
+       int                     users;
+
+       /* for bubble handler */
+       struct work_struct      bubble_work;
+};
+
+enum pcm_stream_state {
+       STREAM_OFF,
+       STREAM_ON,
+       STREAM_SUSPEND,
+};
+
+#define AUDIO_BUFS (3)
+#define CAPTURE_STREAM_EN 1
+struct poseidon_audio {
+       struct urb              *urb_array[AUDIO_BUFS];
+       unsigned int            copied_position;
+       struct snd_pcm_substream   *capture_pcm_substream;
+
+       unsigned int            rcv_position;
+       struct  snd_card        *card;
+       int                     card_close;
+
+       int                     users;
+       int                     pm_state;
+       enum pcm_stream_state   capture_stream;
+};
+
+struct radio_data {
+       __u32           fm_freq;
+       int             users;
+       unsigned int    is_radio_streaming;
+       int             pre_emphasis;
+       struct video_device *fm_dev;
+};
+
+#define DVB_SBUF_NUM           4
+#define DVB_URB_BUF_SIZE       0x2000
+struct pd_dvb_adapter {
+       struct dvb_adapter      dvb_adap;
+       struct dvb_frontend     dvb_fe;
+       struct dmxdev           dmxdev;
+       struct dvb_demux        demux;
+
+       atomic_t                users;
+       atomic_t                active_feed;
+
+       /* data transfer */
+       s32                     is_streaming;
+       struct urb              *urb_array[DVB_SBUF_NUM];
+       struct poseidon         *pd_device;
+       u8                      ep_addr;
+       u8                      reserved[3];
+
+       /* data for power resume*/
+       struct dvb_frontend_parameters fe_param;
+
+       /* for channel scanning */
+       int             prev_freq;
+       int             bandwidth;
+       unsigned long   last_jiffies;
+};
+
+struct front_face {
+       /* use this field to distinguish VIDEO and VBI */
+       enum v4l2_buf_type      type;
+
+       /* for host */
+       struct videobuf_queue   q;
+
+       /* the bridge for host and device */
+       struct videobuf_buffer  *curr_frame;
+
+       /* for device */
+       spinlock_t              queue_lock;
+       struct list_head        active;
+       struct poseidon         *pd;
+};
+
+struct poseidon {
+       struct list_head        device_list;
+
+       struct mutex            lock;
+       struct kref             kref;
+
+       /* for V4L2 */
+       struct v4l2_device      v4l2_dev;
+
+       /* hardware info */
+       struct usb_device       *udev;
+       struct usb_interface    *interface;
+       int                     cur_transfer_mode;
+
+       struct video_data       video_data;     /* video */
+       struct vbi_data         vbi_data;       /* vbi   */
+       struct poseidon_audio   audio;          /* audio (alsa) */
+       struct radio_data       radio_data;     /* FM    */
+       struct pd_dvb_adapter   dvb_data;       /* DVB   */
+
+       u32                     state;
+       struct file             *file_for_stream; /* the active stream*/
+
+#ifdef CONFIG_PM
+       int (*pm_suspend)(struct poseidon *);
+       int (*pm_resume)(struct poseidon *);
+       pm_message_t            msg;
+
+       struct work_struct      pm_work;
+       u8                      portnum;
+#endif
+};
+
+struct poseidon_format {
+       char    *name;
+       int     fourcc;          /* video4linux 2         */
+       int     depth;           /* bit/pixel             */
+       int     flags;
+};
+
+struct poseidon_tvnorm {
+       v4l2_std_id     v4l2_id;
+       char            name[12];
+       u32             tlg_tvnorm;
+};
+
+/* video */
+int pd_video_init(struct poseidon *);
+void pd_video_exit(struct poseidon *);
+int stop_all_video_stream(struct poseidon *);
+
+/* alsa audio */
+int poseidon_audio_init(struct poseidon *);
+int poseidon_audio_free(struct poseidon *);
+#ifdef CONFIG_PM
+int pm_alsa_suspend(struct poseidon *);
+int pm_alsa_resume(struct poseidon *);
+#endif
+
+/* dvb */
+int pd_dvb_usb_device_init(struct poseidon *);
+void pd_dvb_usb_device_exit(struct poseidon *);
+void pd_dvb_usb_device_cleanup(struct poseidon *);
+int pd_dvb_get_adapter_num(struct pd_dvb_adapter *);
+void dvb_stop_streaming(struct pd_dvb_adapter *);
+
+/* FM */
+int poseidon_fm_init(struct poseidon *);
+int poseidon_fm_exit(struct poseidon *);
+struct video_device *vdev_init(struct poseidon *, struct video_device *);
+
+/* vendor command ops */
+int send_set_req(struct poseidon*, u8, s32, s32*);
+int send_get_req(struct poseidon*, u8, s32, void*, s32*, s32);
+s32 set_tuner_mode(struct poseidon*, unsigned char);
+
+/* bulk urb alloc/free */
+int alloc_bulk_urbs_generic(struct urb **urb_array, int num,
+                       struct usb_device *udev, u8 ep_addr,
+                       int buf_size, gfp_t gfp_flags,
+                       usb_complete_t complete_fn, void *context);
+void free_all_urb_generic(struct urb **urb_array, int num);
+
+/* misc */
+void poseidon_delete(struct kref *kref);
+void destroy_video_device(struct video_device **v_dev);
+extern int debug_mode;
+void set_debug_mode(struct video_device *vfd, int debug_mode);
+
+#ifdef CONFIG_PM
+#define in_hibernation(pd) (pd->msg.event == PM_EVENT_FREEZE)
+#else
+#define in_hibernation(pd) (0)
+#endif
+#define get_pm_count(p) (atomic_read(&(p)->interface->pm_usage_cnt))
+
+#define log(a, ...) printk(KERN_DEBUG "\t[ %s : %.3d ] "a"\n", \
+                               __func__, __LINE__,  ## __VA_ARGS__)
+
+/* for power management */
+#define logpm(pd) do {\
+                       if (debug_mode & 0x10)\
+                               log();\
+               } while (0)
+
+#define logs(f) do { \
+                       if ((debug_mode & 0x4) && \
+                               (f)->type == V4L2_BUF_TYPE_VBI_CAPTURE) \
+                                       log("type : VBI");\
+                                                               \
+                       if ((debug_mode & 0x8) && \
+                               (f)->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) \
+                                       log("type : VIDEO");\
+               } while (0)
+#endif
diff --git a/drivers/media/video/tlg2300/pd-dvb.c b/drivers/media/video/tlg2300/pd-dvb.c
new file mode 100644 (file)
index 0000000..4133aee
--- /dev/null
@@ -0,0 +1,593 @@
+#include "pd-common.h"
+#include <linux/kernel.h>
+#include <linux/usb.h>
+#include <linux/dvb/dmx.h>
+#include <linux/delay.h>
+
+#include "vendorcmds.h"
+#include <linux/sched.h>
+#include <asm/atomic.h>
+
+static void dvb_urb_cleanup(struct pd_dvb_adapter *pd_dvb);
+
+static int dvb_bandwidth[][2] = {
+       { TLG_BW_8, BANDWIDTH_8_MHZ },
+       { TLG_BW_7, BANDWIDTH_7_MHZ },
+       { TLG_BW_6, BANDWIDTH_6_MHZ }
+};
+static int dvb_bandwidth_length = ARRAY_SIZE(dvb_bandwidth);
+
+static s32 dvb_start_streaming(struct pd_dvb_adapter *pd_dvb);
+static int poseidon_check_mode_dvbt(struct poseidon *pd)
+{
+       s32 ret = 0, cmd_status = 0;
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/4);
+
+       ret = usb_set_interface(pd->udev, 0, BULK_ALTERNATE_IFACE);
+       if (ret != 0)
+               return ret;
+
+       ret = set_tuner_mode(pd, TLG_MODE_CAPS_DVB_T);
+       if (ret)
+               return ret;
+
+       /* signal source */
+       ret = send_set_req(pd, SGNL_SRC_SEL, TLG_SIG_SRC_ANTENNA, &cmd_status);
+       if (ret|cmd_status)
+               return ret;
+
+       return 0;
+}
+
+/* acquire :
+ *     1 == open
+ *     0 == release
+ */
+static int poseidon_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       struct pd_dvb_adapter *pd_dvb;
+       int ret = 0;
+
+       if (!pd)
+               return -ENODEV;
+
+       pd_dvb = container_of(fe, struct pd_dvb_adapter, dvb_fe);
+       if (acquire) {
+               mutex_lock(&pd->lock);
+               if (pd->state & POSEIDON_STATE_DISCONNECT) {
+                       ret = -ENODEV;
+                       goto open_out;
+               }
+
+               if (pd->state && !(pd->state & POSEIDON_STATE_DVBT)) {
+                       ret = -EBUSY;
+                       goto open_out;
+               }
+
+               usb_autopm_get_interface(pd->interface);
+               if (0 == pd->state) {
+                       ret = poseidon_check_mode_dvbt(pd);
+                       if (ret < 0) {
+                               usb_autopm_put_interface(pd->interface);
+                               goto open_out;
+                       }
+                       pd->state |= POSEIDON_STATE_DVBT;
+                       pd_dvb->bandwidth = 0;
+                       pd_dvb->prev_freq = 0;
+               }
+               atomic_inc(&pd_dvb->users);
+               kref_get(&pd->kref);
+open_out:
+               mutex_unlock(&pd->lock);
+       } else {
+               dvb_stop_streaming(pd_dvb);
+
+               if (atomic_dec_and_test(&pd_dvb->users)) {
+                       mutex_lock(&pd->lock);
+                       pd->state &= ~POSEIDON_STATE_DVBT;
+                       mutex_unlock(&pd->lock);
+               }
+               kref_put(&pd->kref, poseidon_delete);
+               usb_autopm_put_interface(pd->interface);
+       }
+       return ret;
+}
+
+static void poseidon_fe_release(struct dvb_frontend *fe)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+
+#ifdef CONFIG_PM
+       pd->pm_suspend = NULL;
+       pd->pm_resume  = NULL;
+#endif
+}
+
+static s32 poseidon_fe_sleep(struct dvb_frontend *fe)
+{
+       return 0;
+}
+
+/*
+ * return true if we can satisfy the conditions, else return false.
+ */
+static bool check_scan_ok(__u32 freq, int bandwidth,
+                       struct pd_dvb_adapter *adapter)
+{
+       if (bandwidth < 0)
+               return false;
+
+       if (adapter->prev_freq == freq
+               && adapter->bandwidth == bandwidth) {
+               long nl = jiffies - adapter->last_jiffies;
+               unsigned int msec ;
+
+               msec = jiffies_to_msecs(abs(nl));
+               return msec > 15000 ? true : false;
+       }
+       return true;
+}
+
+/*
+ * Check if the firmware delays too long for an invalid frequency.
+ */
+static int fw_delay_overflow(struct pd_dvb_adapter *adapter)
+{
+       long nl = jiffies - adapter->last_jiffies;
+       unsigned int msec ;
+
+       msec = jiffies_to_msecs(abs(nl));
+       return msec > 800 ? true : false;
+}
+
+static int poseidon_set_fe(struct dvb_frontend *fe,
+                       struct dvb_frontend_parameters *fep)
+{
+       s32 ret = 0, cmd_status = 0;
+       s32 i, bandwidth = -1;
+       struct poseidon *pd = fe->demodulator_priv;
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+       if (in_hibernation(pd))
+               return -EBUSY;
+
+       mutex_lock(&pd->lock);
+       for (i = 0; i < dvb_bandwidth_length; i++)
+               if (fep->u.ofdm.bandwidth == dvb_bandwidth[i][1])
+                       bandwidth = dvb_bandwidth[i][0];
+
+       if (check_scan_ok(fep->frequency, bandwidth, pd_dvb)) {
+               ret = send_set_req(pd, TUNE_FREQ_SELECT,
+                                       fep->frequency / 1000, &cmd_status);
+               if (ret | cmd_status) {
+                       log("error line");
+                       goto front_out;
+               }
+
+               ret = send_set_req(pd, DVBT_BANDW_SEL,
+                                               bandwidth, &cmd_status);
+               if (ret | cmd_status) {
+                       log("error line");
+                       goto front_out;
+               }
+
+               ret = send_set_req(pd, TAKE_REQUEST, 0, &cmd_status);
+               if (ret | cmd_status) {
+                       log("error line");
+                       goto front_out;
+               }
+
+               /* save the context for future */
+               memcpy(&pd_dvb->fe_param, fep, sizeof(*fep));
+               pd_dvb->bandwidth = bandwidth;
+               pd_dvb->prev_freq = fep->frequency;
+               pd_dvb->last_jiffies = jiffies;
+       }
+front_out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+#ifdef CONFIG_PM
+static int pm_dvb_suspend(struct poseidon *pd)
+{
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+       dvb_stop_streaming(pd_dvb);
+       dvb_urb_cleanup(pd_dvb);
+       msleep(500);
+       return 0;
+}
+
+static int pm_dvb_resume(struct poseidon *pd)
+{
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+       poseidon_check_mode_dvbt(pd);
+       msleep(300);
+       poseidon_set_fe(&pd_dvb->dvb_fe, &pd_dvb->fe_param);
+
+       dvb_start_streaming(pd_dvb);
+       return 0;
+}
+#endif
+
+static s32 poseidon_fe_init(struct dvb_frontend *fe)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+#ifdef CONFIG_PM
+       pd->pm_suspend = pm_dvb_suspend;
+       pd->pm_resume  = pm_dvb_resume;
+#endif
+       memset(&pd_dvb->fe_param, 0,
+                       sizeof(struct dvb_frontend_parameters));
+       return 0;
+}
+
+static int poseidon_get_fe(struct dvb_frontend *fe,
+                       struct dvb_frontend_parameters *fep)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+       memcpy(fep, &pd_dvb->fe_param, sizeof(*fep));
+       return 0;
+}
+
+static int poseidon_fe_get_tune_settings(struct dvb_frontend *fe,
+                               struct dvb_frontend_tune_settings *tune)
+{
+       tune->min_delay_ms = 1000;
+       return 0;
+}
+
+static int poseidon_read_status(struct dvb_frontend *fe, fe_status_t *stat)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       s32 ret = -1, cmd_status;
+       struct tuner_dtv_sig_stat_s status = {};
+
+       if (in_hibernation(pd))
+               return -EBUSY;
+       mutex_lock(&pd->lock);
+
+       ret = send_get_req(pd, TUNER_STATUS, TLG_MODE_DVB_T,
+                               &status, &cmd_status, sizeof(status));
+       if (ret | cmd_status) {
+               log("get tuner status error");
+               goto out;
+       }
+
+       if (debug_mode)
+               log("P : %d, L %d, LB :%d", status.sig_present,
+                       status.sig_locked, status.sig_lock_busy);
+
+       if (status.sig_lock_busy) {
+               goto out;
+       } else if (status.sig_present || status.sig_locked) {
+               *stat |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER
+                               | FE_HAS_SYNC | FE_HAS_VITERBI;
+       } else {
+               if (fw_delay_overflow(&pd->dvb_data))
+                       *stat |= FE_TIMEDOUT;
+       }
+out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static int poseidon_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       struct tuner_ber_rate_s tlg_ber = {};
+       s32 ret = -1, cmd_status;
+
+       mutex_lock(&pd->lock);
+       ret = send_get_req(pd, TUNER_BER_RATE, 0,
+                               &tlg_ber, &cmd_status, sizeof(tlg_ber));
+       if (ret | cmd_status)
+               goto out;
+       *ber = tlg_ber.ber_rate;
+out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static s32 poseidon_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
+{
+       struct poseidon *pd = fe->demodulator_priv;
+       struct tuner_dtv_sig_stat_s status = {};
+       s32 ret = 0, cmd_status;
+
+       mutex_lock(&pd->lock);
+       ret = send_get_req(pd, TUNER_STATUS, TLG_MODE_DVB_T,
+                               &status, &cmd_status, sizeof(status));
+       if (ret | cmd_status)
+               goto out;
+       if ((status.sig_present || status.sig_locked) && !status.sig_strength)
+               *strength = 0xFFFF;
+       else
+               *strength = status.sig_strength;
+out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static int poseidon_read_snr(struct dvb_frontend *fe, u16 *snr)
+{
+       return 0;
+}
+
+static int poseidon_read_unc_blocks(struct dvb_frontend *fe, u32 *unc)
+{
+       *unc = 0;
+       return 0;
+}
+
+static struct dvb_frontend_ops poseidon_frontend_ops = {
+       .info = {
+               .name           = "Poseidon DVB-T",
+               .type           = FE_OFDM,
+               .frequency_min  = 174000000,
+               .frequency_max  = 862000000,
+               .frequency_stepsize       = 62500,/* FIXME */
+               .caps = FE_CAN_INVERSION_AUTO |
+                       FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
+                       FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
+                       FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 |
+                       FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO |
+                       FE_CAN_GUARD_INTERVAL_AUTO |
+                       FE_CAN_RECOVER |
+                       FE_CAN_HIERARCHY_AUTO,
+       },
+
+       .release = poseidon_fe_release,
+
+       .init = poseidon_fe_init,
+       .sleep = poseidon_fe_sleep,
+
+       .set_frontend = poseidon_set_fe,
+       .get_frontend = poseidon_get_fe,
+       .get_tune_settings = poseidon_fe_get_tune_settings,
+
+       .read_status    = poseidon_read_status,
+       .read_ber       = poseidon_read_ber,
+       .read_signal_strength = poseidon_read_signal_strength,
+       .read_snr       = poseidon_read_snr,
+       .read_ucblocks  = poseidon_read_unc_blocks,
+
+       .ts_bus_ctrl = poseidon_ts_bus_ctrl,
+};
+
+static void dvb_urb_irq(struct urb *urb)
+{
+       struct pd_dvb_adapter *pd_dvb = urb->context;
+       int len = urb->transfer_buffer_length;
+       struct dvb_demux *demux = &pd_dvb->demux;
+       s32 ret;
+
+       if (!pd_dvb->is_streaming || urb->status) {
+               if (urb->status == -EPROTO)
+                       goto resend;
+               return;
+       }
+
+       if (urb->actual_length == len)
+               dvb_dmx_swfilter(demux, urb->transfer_buffer, len);
+       else if (urb->actual_length == len - 4) {
+               int offset;
+               u8 *buf = urb->transfer_buffer;
+
+               /*
+                * The packet size is 512,
+                * last packet contains 456 bytes tsp data
+                */
+               for (offset = 456; offset < len; offset += 512) {
+                       if (!strncmp(buf + offset, "DVHS", 4)) {
+                               dvb_dmx_swfilter(demux, buf, offset);
+                               if (len > offset + 52 + 4) {
+                                       /*16 bytes trailer + 36 bytes padding */
+                                       buf += offset + 52;
+                                       len -= offset + 52 + 4;
+                                       dvb_dmx_swfilter(demux, buf, len);
+                               }
+                               break;
+                       }
+               }
+       }
+
+resend:
+       ret = usb_submit_urb(urb, GFP_ATOMIC);
+       if (ret)
+               log(" usb_submit_urb failed: error %d", ret);
+}
+
+static int dvb_urb_init(struct pd_dvb_adapter *pd_dvb)
+{
+       if (pd_dvb->urb_array[0])
+               return 0;
+
+       alloc_bulk_urbs_generic(pd_dvb->urb_array, DVB_SBUF_NUM,
+                       pd_dvb->pd_device->udev, pd_dvb->ep_addr,
+                       DVB_URB_BUF_SIZE, GFP_KERNEL,
+                       dvb_urb_irq, pd_dvb);
+       return 0;
+}
+
+static void dvb_urb_cleanup(struct pd_dvb_adapter *pd_dvb)
+{
+       free_all_urb_generic(pd_dvb->urb_array, DVB_SBUF_NUM);
+}
+
+static s32 dvb_start_streaming(struct pd_dvb_adapter *pd_dvb)
+{
+       struct poseidon *pd = pd_dvb->pd_device;
+       int ret = 0;
+
+       if (pd->state & POSEIDON_STATE_DISCONNECT)
+               return -ENODEV;
+
+       mutex_lock(&pd->lock);
+       if (!pd_dvb->is_streaming) {
+               s32 i, cmd_status = 0;
+               /*
+                * Once upon a time, there was a difficult bug lying here.
+                * ret = send_set_req(pd, TAKE_REQUEST, 0, &cmd_status);
+                */
+
+               ret = send_set_req(pd, PLAY_SERVICE, 1, &cmd_status);
+               if (ret | cmd_status)
+                       goto out;
+
+               ret = dvb_urb_init(pd_dvb);
+               if (ret < 0)
+                       goto out;
+
+               pd_dvb->is_streaming = 1;
+               for (i = 0; i < DVB_SBUF_NUM; i++) {
+                       ret = usb_submit_urb(pd_dvb->urb_array[i],
+                                                      GFP_KERNEL);
+                       if (ret) {
+                               log(" submit urb error %d", ret);
+                               goto out;
+                       }
+               }
+       }
+out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+void dvb_stop_streaming(struct pd_dvb_adapter *pd_dvb)
+{
+       struct poseidon *pd = pd_dvb->pd_device;
+
+       mutex_lock(&pd->lock);
+       if (pd_dvb->is_streaming) {
+               s32 i, ret, cmd_status = 0;
+
+               pd_dvb->is_streaming = 0;
+
+               for (i = 0; i < DVB_SBUF_NUM; i++)
+                       if (pd_dvb->urb_array[i])
+                               usb_kill_urb(pd_dvb->urb_array[i]);
+
+               ret = send_set_req(pd, PLAY_SERVICE, TLG_TUNE_PLAY_SVC_STOP,
+                                       &cmd_status);
+               if (ret | cmd_status)
+                       log("error");
+       }
+       mutex_unlock(&pd->lock);
+}
+
+static int pd_start_feed(struct dvb_demux_feed *feed)
+{
+       struct pd_dvb_adapter *pd_dvb = feed->demux->priv;
+       int ret = 0;
+
+       if (!pd_dvb)
+               return -1;
+       if (atomic_inc_return(&pd_dvb->active_feed) == 1)
+               ret = dvb_start_streaming(pd_dvb);
+       return ret;
+}
+
+static int pd_stop_feed(struct dvb_demux_feed *feed)
+{
+       struct pd_dvb_adapter *pd_dvb = feed->demux->priv;
+
+       if (!pd_dvb)
+               return -1;
+       if (atomic_dec_and_test(&pd_dvb->active_feed))
+               dvb_stop_streaming(pd_dvb);
+       return 0;
+}
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+int pd_dvb_usb_device_init(struct poseidon *pd)
+{
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+       struct dvb_demux *dvbdemux;
+       int ret = 0;
+
+       pd_dvb->ep_addr = 0x82;
+       atomic_set(&pd_dvb->users, 0);
+       atomic_set(&pd_dvb->active_feed, 0);
+       pd_dvb->pd_device = pd;
+
+       ret = dvb_register_adapter(&pd_dvb->dvb_adap,
+                               "Poseidon dvbt adapter",
+                               THIS_MODULE,
+                               NULL /* for hibernation correctly*/,
+                               adapter_nr);
+       if (ret < 0)
+               goto error1;
+
+       /* register frontend */
+       pd_dvb->dvb_fe.demodulator_priv = pd;
+       memcpy(&pd_dvb->dvb_fe.ops, &poseidon_frontend_ops,
+                       sizeof(struct dvb_frontend_ops));
+       ret = dvb_register_frontend(&pd_dvb->dvb_adap, &pd_dvb->dvb_fe);
+       if (ret < 0)
+               goto error2;
+
+       /* register demux device */
+       dvbdemux = &pd_dvb->demux;
+       dvbdemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
+       dvbdemux->priv = pd_dvb;
+       dvbdemux->feednum = dvbdemux->filternum = 64;
+       dvbdemux->start_feed = pd_start_feed;
+       dvbdemux->stop_feed = pd_stop_feed;
+       dvbdemux->write_to_decoder = NULL;
+
+       ret = dvb_dmx_init(dvbdemux);
+       if (ret < 0)
+               goto error3;
+
+       pd_dvb->dmxdev.filternum = pd_dvb->demux.filternum;
+       pd_dvb->dmxdev.demux = &pd_dvb->demux.dmx;
+       pd_dvb->dmxdev.capabilities = 0;
+
+       ret = dvb_dmxdev_init(&pd_dvb->dmxdev, &pd_dvb->dvb_adap);
+       if (ret < 0)
+               goto error3;
+       return 0;
+
+error3:
+       dvb_unregister_frontend(&pd_dvb->dvb_fe);
+error2:
+       dvb_unregister_adapter(&pd_dvb->dvb_adap);
+error1:
+       return ret;
+}
+
+void pd_dvb_usb_device_exit(struct poseidon *pd)
+{
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+       while (atomic_read(&pd_dvb->users) != 0
+               || atomic_read(&pd_dvb->active_feed) != 0) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ);
+       }
+       dvb_dmxdev_release(&pd_dvb->dmxdev);
+       dvb_unregister_frontend(&pd_dvb->dvb_fe);
+       dvb_unregister_adapter(&pd_dvb->dvb_adap);
+       pd_dvb_usb_device_cleanup(pd);
+}
+
+void pd_dvb_usb_device_cleanup(struct poseidon *pd)
+{
+       struct pd_dvb_adapter *pd_dvb = &pd->dvb_data;
+
+       dvb_urb_cleanup(pd_dvb);
+}
+
+int pd_dvb_get_adapter_num(struct pd_dvb_adapter *pd_dvb)
+{
+       return pd_dvb->dvb_adap.num;
+}
diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c
new file mode 100644 (file)
index 0000000..2cf0ebf
--- /dev/null
@@ -0,0 +1,539 @@
+/*
+ * device driver for Telegent tlg2300 based TV cards
+ *
+ * Author :
+ *     Kang Yong       <kangyong@telegent.com>
+ *     Zhang Xiaobing  <xbzhang@telegent.com>
+ *     Huang Shijie    <zyziii@telegent.com> or <shijie8@gmail.com>
+ *
+ *     (c) 2009 Telegent Systems
+ *     (c) 2010 Telegent Systems
+ *
+ *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kref.h>
+#include <linux/suspend.h>
+#include <linux/usb/quirks.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/firmware.h>
+#include <linux/smp_lock.h>
+
+#include "vendorcmds.h"
+#include "pd-common.h"
+
+#define VENDOR_ID      0x1B24
+#define PRODUCT_ID     0x4001
+static struct usb_device_id id_table[] = {
+       { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, PRODUCT_ID, 255, 1, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, PRODUCT_ID, 255, 1, 1) },
+       { },
+};
+MODULE_DEVICE_TABLE(usb, id_table);
+
+int debug_mode;
+module_param(debug_mode, int, 0644);
+MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose");
+
+const char *firmware_name = "tlg2300_firmware.bin";
+struct usb_driver poseidon_driver;
+static LIST_HEAD(pd_device_list);
+
+/*
+ * send set request to USB firmware.
+ */
+s32 send_set_req(struct poseidon *pd, u8 cmdid, s32 param, s32 *cmd_status)
+{
+       s32 ret;
+       s8  data[32] = {};
+       u16 lower_16, upper_16;
+
+       if (pd->state & POSEIDON_STATE_DISCONNECT)
+               return -ENODEV;
+
+       mdelay(30);
+
+       if (param == 0) {
+               upper_16 = lower_16 = 0;
+       } else {
+               /* send 32 bit param as  two 16 bit param,little endian */
+               lower_16 = (unsigned short)(param & 0xffff);
+               upper_16 = (unsigned short)((param >> 16) & 0xffff);
+       }
+       ret = usb_control_msg(pd->udev,
+                        usb_rcvctrlpipe(pd->udev, 0),
+                        REQ_SET_CMD | cmdid,
+                        USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                        lower_16,
+                        upper_16,
+                        &data,
+                        sizeof(*cmd_status),
+                        USB_CTRL_GET_TIMEOUT);
+
+       if (!ret) {
+               return -ENXIO;
+       } else {
+               /*  1st 4 bytes into cmd_status   */
+               memcpy((char *)cmd_status, &(data[0]), sizeof(*cmd_status));
+       }
+       return 0;
+}
+
+/*
+ * send get request to Poseidon firmware.
+ */
+s32 send_get_req(struct poseidon *pd, u8 cmdid, s32 param,
+                       void *buf, s32 *cmd_status, s32 datalen)
+{
+       s32 ret;
+       s8 data[128] = {};
+       u16 lower_16, upper_16;
+
+       if (pd->state & POSEIDON_STATE_DISCONNECT)
+               return -ENODEV;
+
+       mdelay(30);
+       if (param == 0) {
+               upper_16 = lower_16 = 0;
+       } else {
+               /*send 32 bit param as two 16 bit param, little endian */
+               lower_16 = (unsigned short)(param & 0xffff);
+               upper_16 = (unsigned short)((param >> 16) & 0xffff);
+       }
+       ret = usb_control_msg(pd->udev,
+                        usb_rcvctrlpipe(pd->udev, 0),
+                        REQ_GET_CMD | cmdid,
+                        USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                        lower_16,
+                        upper_16,
+                        &data,
+                        (datalen + sizeof(*cmd_status)),
+                        USB_CTRL_GET_TIMEOUT);
+
+       if (ret < 0) {
+               return -ENXIO;
+       } else {
+               /* 1st 4 bytes into cmd_status, remaining data into cmd_data */
+               memcpy((char *)cmd_status, &data[0], sizeof(*cmd_status));
+               memcpy((char *)buf, &data[sizeof(*cmd_status)], datalen);
+       }
+       return 0;
+}
+
+static int pm_notifier_block(struct notifier_block *nb,
+                               unsigned long event, void *dummy)
+{
+       struct poseidon *pd = NULL;
+       struct list_head *node, *next;
+
+       switch (event) {
+       case PM_POST_HIBERNATION:
+               list_for_each_safe(node, next, &pd_device_list) {
+                       struct usb_device *udev;
+                       struct usb_interface *iface;
+                       int rc = 0;
+
+                       pd = container_of(node, struct poseidon, device_list);
+                       udev = pd->udev;
+                       iface = pd->interface;
+
+                       /* It will cause the system to reload the firmware */
+                       rc = usb_lock_device_for_reset(udev, iface);
+                       if (rc >= 0) {
+                               usb_reset_device(udev);
+                               usb_unlock_device(udev);
+                       }
+               }
+               break;
+       default:
+               break;
+       }
+       log("event :%ld\n", event);
+       return 0;
+}
+
+static struct notifier_block pm_notifer = {
+       .notifier_call = pm_notifier_block,
+};
+
+int set_tuner_mode(struct poseidon *pd, unsigned char mode)
+{
+       s32 ret, cmd_status;
+
+       if (pd->state & POSEIDON_STATE_DISCONNECT)
+               return -ENODEV;
+
+       ret = send_set_req(pd, TUNE_MODE_SELECT, mode, &cmd_status);
+       if (ret || cmd_status)
+               return -ENXIO;
+       return 0;
+}
+
+void poseidon_delete(struct kref *kref)
+{
+       struct poseidon *pd = container_of(kref, struct poseidon, kref);
+
+       if (!pd)
+               return;
+       list_del_init(&pd->device_list);
+
+       pd_dvb_usb_device_cleanup(pd);
+       /* clean_audio_data(&pd->audio_data);*/
+
+       if (pd->udev) {
+               usb_put_dev(pd->udev);
+               pd->udev = NULL;
+       }
+       if (pd->interface) {
+               usb_put_intf(pd->interface);
+               pd->interface = NULL;
+       }
+       kfree(pd);
+       log();
+}
+
+static int firmware_download(struct usb_device *udev)
+{
+       int ret = 0, actual_length;
+       const struct firmware *fw = NULL;
+       void *fwbuf = NULL;
+       size_t fwlength = 0, offset;
+       size_t max_packet_size;
+
+       ret = request_firmware(&fw, firmware_name, &udev->dev);
+       if (ret) {
+               log("download err : %d", ret);
+               return ret;
+       }
+
+       fwlength = fw->size;
+
+       fwbuf = kzalloc(fwlength, GFP_KERNEL);
+       if (!fwbuf) {
+               ret = -ENOMEM;
+               goto out;
+       }
+       memcpy(fwbuf, fw->data, fwlength);
+
+       max_packet_size = udev->ep_out[0x1]->desc.wMaxPacketSize;
+       log("\t\t download size : %d", (int)max_packet_size);
+
+       for (offset = 0; offset < fwlength; offset += max_packet_size) {
+               actual_length = 0;
+               ret = usb_bulk_msg(udev,
+                               usb_sndbulkpipe(udev, 0x01), /* ep 1 */
+                               fwbuf + offset,
+                               min(max_packet_size, fwlength - offset),
+                               &actual_length,
+                               HZ * 10);
+               if (ret)
+                       break;
+       }
+       kfree(fwbuf);
+out:
+       release_firmware(fw);
+       return ret;
+}
+
+static inline struct poseidon *get_pd(struct usb_interface *intf)
+{
+       return usb_get_intfdata(intf);
+}
+
+#ifdef CONFIG_PM
+/* one-to-one map : poseidon{} <----> usb_device{}'s port */
+static inline void set_map_flags(struct poseidon *pd, struct usb_device *udev)
+{
+       pd->portnum = udev->portnum;
+}
+
+static inline int get_autopm_ref(struct poseidon *pd)
+{
+       return  pd->video_data.users + pd->vbi_data.users + pd->audio.users
+               + atomic_read(&pd->dvb_data.users) + pd->radio_data.users;
+}
+
+/* fixup something for poseidon */
+static inline struct poseidon *fixup(struct poseidon *pd)
+{
+       int count;
+
+       /* old udev and interface have gone, so put back reference . */
+       count = get_autopm_ref(pd);
+       log("count : %d, ref count : %d", count, get_pm_count(pd));
+       while (count--)
+               usb_autopm_put_interface(pd->interface);
+       /*usb_autopm_set_interface(pd->interface); */
+
+       usb_put_dev(pd->udev);
+       usb_put_intf(pd->interface);
+       log("event : %d\n", pd->msg.event);
+       return pd;
+}
+
+static struct poseidon *find_old_poseidon(struct usb_device *udev)
+{
+       struct poseidon *pd;
+
+       list_for_each_entry(pd, &pd_device_list, device_list) {
+               if (pd->portnum == udev->portnum && in_hibernation(pd))
+                       return fixup(pd);
+       }
+       return NULL;
+}
+
+/* Is the card working now ? */
+static inline int is_working(struct poseidon *pd)
+{
+       return get_pm_count(pd) > 0;
+}
+
+static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)
+{
+       struct poseidon *pd = get_pd(intf);
+
+       if (!pd)
+               return 0;
+       if (!is_working(pd)) {
+               if (get_pm_count(pd) <= 0 && !in_hibernation(pd)) {
+                       pd->msg.event = PM_EVENT_AUTO_SUSPEND;
+                       pd->pm_resume = NULL; /*  a good guard */
+                       printk(KERN_DEBUG "\n\t+ TLG2300 auto suspend +\n\n");
+               }
+               return 0;
+       }
+       pd->msg = msg; /* save it here */
+       logpm(pd);
+       return pd->pm_suspend ? pd->pm_suspend(pd) : 0;
+}
+
+static int poseidon_resume(struct usb_interface *intf)
+{
+       struct poseidon *pd = get_pd(intf);
+
+       if (!pd)
+               return 0;
+       printk(KERN_DEBUG "\n\t ++ TLG2300 resume ++\n\n");
+
+       if (!is_working(pd)) {
+               if (PM_EVENT_AUTO_SUSPEND == pd->msg.event)
+                       pd->msg = PMSG_ON;
+               return 0;
+       }
+       if (in_hibernation(pd)) {
+               logpm(pd);
+               return 0;
+       }
+       logpm(pd);
+       return pd->pm_resume ? pd->pm_resume(pd) : 0;
+}
+
+static void hibernation_resume(struct work_struct *w)
+{
+       struct poseidon *pd = container_of(w, struct poseidon, pm_work);
+       int count;
+
+       pd->msg.event = 0; /* clear it here */
+       pd->state &= ~POSEIDON_STATE_DISCONNECT;
+
+       /* set the new interface's reference */
+       count = get_autopm_ref(pd);
+       while (count--)
+               usb_autopm_get_interface(pd->interface);
+
+       /* resume the context */
+       logpm(pd);
+       if (pd->pm_resume)
+               pd->pm_resume(pd);
+}
+#else /* CONFIG_PM is not enabled: */
+static inline struct poseidon *find_old_poseidon(struct usb_device *udev)
+{
+       return NULL;
+}
+
+static inline void set_map_flags(struct poseidon *pd, struct usb_device *udev)
+{
+}
+#endif
+
+static bool check_firmware(struct usb_device *udev, int *down_firmware)
+{
+       void *buf;
+       int ret;
+       struct cmd_firmware_vers_s *cmd_firm;
+
+       buf = kzalloc(sizeof(*cmd_firm) + sizeof(u32), GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+       ret = usb_control_msg(udev,
+                        usb_rcvctrlpipe(udev, 0),
+                        REQ_GET_CMD | GET_FW_ID,
+                        USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                        0,
+                        0,
+                        buf,
+                        sizeof(*cmd_firm) + sizeof(u32),
+                        USB_CTRL_GET_TIMEOUT);
+       kfree(buf);
+
+       if (ret < 0) {
+               *down_firmware = 1;
+               return firmware_download(udev);
+       }
+       return ret;
+}
+
+static int poseidon_probe(struct usb_interface *interface,
+                               const struct usb_device_id *id)
+{
+       struct usb_device *udev = interface_to_usbdev(interface);
+       struct poseidon *pd = NULL;
+       int ret = 0;
+       int new_one = 0;
+
+       /* download firmware */
+       check_firmware(udev, &ret);
+       if (ret)
+               return 0;
+
+       /* Do I recovery from the hibernate ? */
+       pd = find_old_poseidon(udev);
+       if (!pd) {
+               pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+               if (!pd)
+                       return -ENOMEM;
+               kref_init(&pd->kref);
+               set_map_flags(pd, udev);
+               new_one = 1;
+       }
+
+       pd->udev        = usb_get_dev(udev);
+       pd->interface   = usb_get_intf(interface);
+       usb_set_intfdata(interface, pd);
+
+       if (new_one) {
+               struct device *dev = &interface->dev;
+
+               logpm(pd);
+               mutex_init(&pd->lock);
+
+               /* register v4l2 device */
+               snprintf(pd->v4l2_dev.name, sizeof(pd->v4l2_dev.name), "%s %s",
+                       dev->driver->name, dev_name(dev));
+               ret = v4l2_device_register(NULL, &pd->v4l2_dev);
+
+               /* register devices in directory /dev */
+               ret = pd_video_init(pd);
+               poseidon_audio_init(pd);
+               poseidon_fm_init(pd);
+               pd_dvb_usb_device_init(pd);
+
+               INIT_LIST_HEAD(&pd->device_list);
+               list_add_tail(&pd->device_list, &pd_device_list);
+       }
+
+       device_init_wakeup(&udev->dev, 1);
+#ifdef CONFIG_PM
+       pd->udev->autosuspend_disabled = 0;
+       pd->udev->autosuspend_delay = HZ * PM_SUSPEND_DELAY;
+
+       if (in_hibernation(pd)) {
+               INIT_WORK(&pd->pm_work, hibernation_resume);
+               schedule_work(&pd->pm_work);
+       }
+#endif
+       return 0;
+}
+
+static void poseidon_disconnect(struct usb_interface *interface)
+{
+       struct poseidon *pd = get_pd(interface);
+
+       if (!pd)
+               return;
+       logpm(pd);
+       if (in_hibernation(pd))
+               return;
+
+       mutex_lock(&pd->lock);
+       pd->state |= POSEIDON_STATE_DISCONNECT;
+       mutex_unlock(&pd->lock);
+
+       /* stop urb transferring */
+       stop_all_video_stream(pd);
+       dvb_stop_streaming(&pd->dvb_data);
+
+       /*unregister v4l2 device */
+       v4l2_device_unregister(&pd->v4l2_dev);
+
+       lock_kernel();
+       {
+               pd_dvb_usb_device_exit(pd);
+               poseidon_fm_exit(pd);
+
+               poseidon_audio_free(pd);
+               pd_video_exit(pd);
+       }
+       unlock_kernel();
+
+       usb_set_intfdata(interface, NULL);
+       kref_put(&pd->kref, poseidon_delete);
+}
+
+struct usb_driver poseidon_driver = {
+       .name           = "poseidon",
+       .probe          = poseidon_probe,
+       .disconnect     = poseidon_disconnect,
+       .id_table       = id_table,
+#ifdef CONFIG_PM
+       .suspend        = poseidon_suspend,
+       .resume         = poseidon_resume,
+#endif
+       .supports_autosuspend = 1,
+};
+
+static int __init poseidon_init(void)
+{
+       int ret;
+
+       ret = usb_register(&poseidon_driver);
+       if (ret)
+               return ret;
+       register_pm_notifier(&pm_notifer);
+       return ret;
+}
+
+static void __exit poseidon_exit(void)
+{
+       log();
+       unregister_pm_notifier(&pm_notifer);
+       usb_deregister(&poseidon_driver);
+}
+
+module_init(poseidon_init);
+module_exit(poseidon_exit);
+
+MODULE_AUTHOR("Telegent Systems");
+MODULE_DESCRIPTION("For tlg2300-based USB device ");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/tlg2300/pd-radio.c b/drivers/media/video/tlg2300/pd-radio.c
new file mode 100644 (file)
index 0000000..755766b
--- /dev/null
@@ -0,0 +1,420 @@
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/bitmap.h>
+#include <linux/usb.h>
+#include <linux/i2c.h>
+#include <media/v4l2-dev.h>
+#include <linux/version.h>
+#include <linux/mm.h>
+#include <linux/mutex.h>
+#include <media/v4l2-ioctl.h>
+#include <linux/sched.h>
+
+#include "pd-common.h"
+#include "vendorcmds.h"
+
+static int set_frequency(struct poseidon *p, __u32 frequency);
+static int poseidon_fm_close(struct file *filp);
+static int poseidon_fm_open(struct file *filp);
+
+#define TUNER_FREQ_MIN_FM 76000000
+#define TUNER_FREQ_MAX_FM 108000000
+
+#define MAX_PREEMPHASIS (V4L2_PREEMPHASIS_75_uS + 1)
+static int preemphasis[MAX_PREEMPHASIS] = {
+       TLG_TUNE_ASTD_NONE,   /* V4L2_PREEMPHASIS_DISABLED */
+       TLG_TUNE_ASTD_FM_EUR, /* V4L2_PREEMPHASIS_50_uS    */
+       TLG_TUNE_ASTD_FM_US,  /* V4L2_PREEMPHASIS_75_uS    */
+};
+
+static int poseidon_check_mode_radio(struct poseidon *p)
+{
+       int ret;
+       u32 status;
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/2);
+       ret = usb_set_interface(p->udev, 0, BULK_ALTERNATE_IFACE);
+       if (ret < 0)
+               goto out;
+
+       ret = set_tuner_mode(p, TLG_MODE_FM_RADIO);
+       if (ret != 0)
+               goto out;
+
+       ret = send_set_req(p, SGNL_SRC_SEL, TLG_SIG_SRC_ANTENNA, &status);
+       ret = send_set_req(p, TUNER_AUD_ANA_STD,
+                               p->radio_data.pre_emphasis, &status);
+       ret |= send_set_req(p, TUNER_AUD_MODE,
+                               TLG_TUNE_TVAUDIO_MODE_STEREO, &status);
+       ret |= send_set_req(p, AUDIO_SAMPLE_RATE_SEL,
+                               ATV_AUDIO_RATE_48K, &status);
+       ret |= send_set_req(p, TUNE_FREQ_SELECT, TUNER_FREQ_MIN_FM, &status);
+out:
+       return ret;
+}
+
+#ifdef CONFIG_PM
+static int pm_fm_suspend(struct poseidon *p)
+{
+       logpm(p);
+       pm_alsa_suspend(p);
+       usb_set_interface(p->udev, 0, 0);
+       msleep(300);
+       return 0;
+}
+
+static int pm_fm_resume(struct poseidon *p)
+{
+       logpm(p);
+       poseidon_check_mode_radio(p);
+       set_frequency(p, p->radio_data.fm_freq);
+       pm_alsa_resume(p);
+       return 0;
+}
+#endif
+
+static int poseidon_fm_open(struct file *filp)
+{
+       struct video_device *vfd = video_devdata(filp);
+       struct poseidon *p = video_get_drvdata(vfd);
+       int ret = 0;
+
+       if (!p)
+               return -1;
+
+       mutex_lock(&p->lock);
+       if (p->state & POSEIDON_STATE_DISCONNECT) {
+               ret = -ENODEV;
+               goto out;
+       }
+
+       if (p->state && !(p->state & POSEIDON_STATE_FM)) {
+               ret = -EBUSY;
+               goto out;
+       }
+
+       usb_autopm_get_interface(p->interface);
+       if (0 == p->state) {
+               /* default pre-emphasis */
+               if (p->radio_data.pre_emphasis == 0)
+                       p->radio_data.pre_emphasis = TLG_TUNE_ASTD_FM_EUR;
+               set_debug_mode(vfd, debug_mode);
+
+               ret = poseidon_check_mode_radio(p);
+               if (ret < 0) {
+                       usb_autopm_put_interface(p->interface);
+                       goto out;
+               }
+               p->state |= POSEIDON_STATE_FM;
+       }
+       p->radio_data.users++;
+       kref_get(&p->kref);
+       filp->private_data = p;
+out:
+       mutex_unlock(&p->lock);
+       return ret;
+}
+
+static int poseidon_fm_close(struct file *filp)
+{
+       struct poseidon *p = filp->private_data;
+       struct radio_data *fm = &p->radio_data;
+       uint32_t status;
+
+       mutex_lock(&p->lock);
+       fm->users--;
+       if (0 == fm->users)
+               p->state &= ~POSEIDON_STATE_FM;
+
+       if (fm->is_radio_streaming && filp == p->file_for_stream) {
+               fm->is_radio_streaming = 0;
+               send_set_req(p, PLAY_SERVICE, TLG_TUNE_PLAY_SVC_STOP, &status);
+       }
+       usb_autopm_put_interface(p->interface);
+       mutex_unlock(&p->lock);
+
+       kref_put(&p->kref, poseidon_delete);
+       filp->private_data = NULL;
+       return 0;
+}
+
+static int vidioc_querycap(struct file *file, void *priv,
+                       struct v4l2_capability *v)
+{
+       struct poseidon *p = file->private_data;
+
+       strlcpy(v->driver, "tele-radio", sizeof(v->driver));
+       strlcpy(v->card, "Telegent Poseidon", sizeof(v->card));
+       usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info));
+       v->version = KERNEL_VERSION(0, 0, 1);
+       v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
+       return 0;
+}
+
+static const struct v4l2_file_operations poseidon_fm_fops = {
+       .owner         = THIS_MODULE,
+       .open          = poseidon_fm_open,
+       .release       = poseidon_fm_close,
+       .ioctl         = video_ioctl2,
+};
+
+int tlg_fm_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *vt)
+{
+       struct tuner_fm_sig_stat_s fm_stat = {};
+       int ret, status, count = 5;
+       struct poseidon *p = file->private_data;
+
+       if (vt->index != 0)
+               return -EINVAL;
+
+       vt->type        = V4L2_TUNER_RADIO;
+       vt->capability  = V4L2_TUNER_CAP_STEREO;
+       vt->rangelow    = TUNER_FREQ_MIN_FM / 62500;
+       vt->rangehigh   = TUNER_FREQ_MAX_FM / 62500;
+       vt->rxsubchans  = V4L2_TUNER_SUB_STEREO;
+       vt->audmode     = V4L2_TUNER_MODE_STEREO;
+       vt->signal      = 0;
+       vt->afc         = 0;
+
+       mutex_lock(&p->lock);
+       ret = send_get_req(p, TUNER_STATUS, TLG_MODE_FM_RADIO,
+                             &fm_stat, &status, sizeof(fm_stat));
+
+       while (fm_stat.sig_lock_busy && count-- && !ret) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ);
+
+               ret = send_get_req(p, TUNER_STATUS, TLG_MODE_FM_RADIO,
+                                 &fm_stat, &status, sizeof(fm_stat));
+       }
+       mutex_unlock(&p->lock);
+
+       if (ret || status) {
+               vt->signal = 0;
+       } else if ((fm_stat.sig_present || fm_stat.sig_locked)
+                       && fm_stat.sig_strength == 0) {
+               vt->signal = 0xffff;
+       } else
+               vt->signal = (fm_stat.sig_strength * 255 / 10) << 8;
+
+       return 0;
+}
+
+int fm_get_freq(struct file *file, void *priv, struct v4l2_frequency *argp)
+{
+       struct poseidon *p = file->private_data;
+
+       argp->frequency = p->radio_data.fm_freq;
+       return 0;
+}
+
+static int set_frequency(struct poseidon *p, __u32 frequency)
+{
+       __u32 freq ;
+       int ret, status;
+
+       mutex_lock(&p->lock);
+
+       ret = send_set_req(p, TUNER_AUD_ANA_STD,
+                               p->radio_data.pre_emphasis, &status);
+
+       freq =  (frequency * 125) * 500 / 1000;/* kHZ */
+       if (freq < TUNER_FREQ_MIN_FM/1000 || freq > TUNER_FREQ_MAX_FM/1000) {
+               ret = -EINVAL;
+               goto error;
+       }
+
+       ret = send_set_req(p, TUNE_FREQ_SELECT, freq, &status);
+       if (ret < 0)
+               goto error ;
+       ret = send_set_req(p, TAKE_REQUEST, 0, &status);
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/4);
+       if (!p->radio_data.is_radio_streaming) {
+               ret = send_set_req(p, TAKE_REQUEST, 0, &status);
+               ret = send_set_req(p, PLAY_SERVICE,
+                               TLG_TUNE_PLAY_SVC_START, &status);
+               p->radio_data.is_radio_streaming = 1;
+       }
+       p->radio_data.fm_freq = frequency;
+error:
+       mutex_unlock(&p->lock);
+       return ret;
+}
+
+int fm_set_freq(struct file *file, void *priv, struct v4l2_frequency *argp)
+{
+       struct poseidon *p = file->private_data;
+
+       p->file_for_stream  = file;
+#ifdef CONFIG_PM
+       p->pm_suspend = pm_fm_suspend;
+       p->pm_resume  = pm_fm_resume;
+#endif
+       return set_frequency(p, argp->frequency);
+}
+
+int tlg_fm_vidioc_g_ctrl(struct file *file, void *priv,
+               struct v4l2_control *arg)
+{
+       return 0;
+}
+
+int tlg_fm_vidioc_g_exts_ctrl(struct file *file, void *fh,
+                               struct v4l2_ext_controls *ctrls)
+{
+       struct poseidon *p = file->private_data;
+       int i;
+
+       if (ctrls->ctrl_class != V4L2_CTRL_CLASS_FM_TX)
+               return -EINVAL;
+
+       for (i = 0; i < ctrls->count; i++) {
+               struct v4l2_ext_control *ctrl = ctrls->controls + i;
+
+               if (ctrl->id != V4L2_CID_TUNE_PREEMPHASIS)
+                       continue;
+
+               if (i < MAX_PREEMPHASIS)
+                       ctrl->value = p->radio_data.pre_emphasis;
+       }
+       return 0;
+}
+
+int tlg_fm_vidioc_s_exts_ctrl(struct file *file, void *fh,
+                       struct v4l2_ext_controls *ctrls)
+{
+       int i;
+
+       if (ctrls->ctrl_class != V4L2_CTRL_CLASS_FM_TX)
+               return -EINVAL;
+
+       for (i = 0; i < ctrls->count; i++) {
+               struct v4l2_ext_control *ctrl = ctrls->controls + i;
+
+               if (ctrl->id != V4L2_CID_TUNE_PREEMPHASIS)
+                       continue;
+
+               if (ctrl->value >= 0 && ctrl->value < MAX_PREEMPHASIS) {
+                       struct poseidon *p = file->private_data;
+                       int pre_emphasis = preemphasis[ctrl->value];
+                       u32 status;
+
+                       send_set_req(p, TUNER_AUD_ANA_STD,
+                                               pre_emphasis, &status);
+                       p->radio_data.pre_emphasis = pre_emphasis;
+               }
+       }
+       return 0;
+}
+
+int tlg_fm_vidioc_s_ctrl(struct file *file, void *priv,
+               struct v4l2_control *ctrl)
+{
+       return 0;
+}
+
+int tlg_fm_vidioc_queryctrl(struct file *file, void *priv,
+               struct v4l2_queryctrl *ctrl)
+{
+       if (!(ctrl->id & V4L2_CTRL_FLAG_NEXT_CTRL))
+               return -EINVAL;
+
+       ctrl->id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
+       if (ctrl->id != V4L2_CID_TUNE_PREEMPHASIS) {
+               /* return the next supported control */
+               ctrl->id = V4L2_CID_TUNE_PREEMPHASIS;
+               v4l2_ctrl_query_fill(ctrl, V4L2_PREEMPHASIS_DISABLED,
+                                       V4L2_PREEMPHASIS_75_uS, 1,
+                                       V4L2_PREEMPHASIS_50_uS);
+               ctrl->flags = V4L2_CTRL_FLAG_UPDATE;
+               return 0;
+       }
+       return -EINVAL;
+}
+
+int tlg_fm_vidioc_querymenu(struct file *file, void *fh,
+                               struct v4l2_querymenu *qmenu)
+{
+       return v4l2_ctrl_query_menu(qmenu, NULL, NULL);
+}
+
+static int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *vt)
+{
+       return vt->index > 0 ? -EINVAL : 0;
+}
+static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *va)
+{
+       return (va->index != 0) ? -EINVAL : 0;
+}
+
+static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
+{
+       a->index    = 0;
+       a->mode    = 0;
+       a->capability = V4L2_AUDCAP_STEREO;
+       strcpy(a->name, "Radio");
+       return 0;
+}
+
+static int vidioc_s_input(struct file *filp, void *priv, u32 i)
+{
+       return (i != 0) ? -EINVAL : 0;
+}
+
+static int vidioc_g_input(struct file *filp, void *priv, u32 *i)
+{
+       return (*i != 0) ? -EINVAL : 0;
+}
+
+static const struct v4l2_ioctl_ops poseidon_fm_ioctl_ops = {
+       .vidioc_querycap    = vidioc_querycap,
+       .vidioc_g_audio     = vidioc_g_audio,
+       .vidioc_s_audio     = vidioc_s_audio,
+       .vidioc_g_input     = vidioc_g_input,
+       .vidioc_s_input     = vidioc_s_input,
+       .vidioc_queryctrl   = tlg_fm_vidioc_queryctrl,
+       .vidioc_querymenu   = tlg_fm_vidioc_querymenu,
+       .vidioc_g_ctrl      = tlg_fm_vidioc_g_ctrl,
+       .vidioc_s_ctrl      = tlg_fm_vidioc_s_ctrl,
+       .vidioc_s_ext_ctrls = tlg_fm_vidioc_s_exts_ctrl,
+       .vidioc_g_ext_ctrls = tlg_fm_vidioc_g_exts_ctrl,
+       .vidioc_s_tuner     = vidioc_s_tuner,
+       .vidioc_g_tuner     = tlg_fm_vidioc_g_tuner,
+       .vidioc_g_frequency = fm_get_freq,
+       .vidioc_s_frequency = fm_set_freq,
+};
+
+static struct video_device poseidon_fm_template = {
+       .name       = "Telegent-Radio",
+       .fops       = &poseidon_fm_fops,
+       .minor      = -1,
+       .release    = video_device_release,
+       .ioctl_ops  = &poseidon_fm_ioctl_ops,
+};
+
+int poseidon_fm_init(struct poseidon *p)
+{
+       struct video_device *fm_dev;
+
+       fm_dev = vdev_init(p, &poseidon_fm_template);
+       if (fm_dev == NULL)
+               return -1;
+
+       if (video_register_device(fm_dev, VFL_TYPE_RADIO, -1) < 0) {
+               video_device_release(fm_dev);
+               return -1;
+       }
+       p->radio_data.fm_dev = fm_dev;
+       return 0;
+}
+
+int poseidon_fm_exit(struct poseidon *p)
+{
+       destroy_video_device(&p->radio_data.fm_dev);
+       return 0;
+}
diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c
new file mode 100644 (file)
index 0000000..becfba6
--- /dev/null
@@ -0,0 +1,1667 @@
+#include <linux/fs.h>
+#include <linux/vmalloc.h>
+#include <linux/videodev2.h>
+#include <linux/usb.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+
+#include <media/v4l2-ioctl.h>
+#include <media/v4l2-dev.h>
+
+#include "pd-common.h"
+#include "vendorcmds.h"
+
+static int pm_video_suspend(struct poseidon *pd);
+static int pm_video_resume(struct poseidon *pd);
+static void iso_bubble_handler(struct work_struct *w);
+
+int usb_transfer_mode;
+module_param(usb_transfer_mode, int, 0644);
+MODULE_PARM_DESC(usb_transfer_mode, "0 = Bulk, 1 = Isochronous");
+
+static const struct poseidon_format poseidon_formats[] = {
+       { "YUV 422", V4L2_PIX_FMT_YUYV, 16, 0},
+       { "RGB565", V4L2_PIX_FMT_RGB565, 16, 0},
+};
+
+static const struct poseidon_tvnorm poseidon_tvnorms[] = {
+       { V4L2_STD_PAL_D, "PAL-D",  TLG_TUNE_VSTD_PAL_D },
+       { V4L2_STD_PAL_B, "PAL-B",  TLG_TUNE_VSTD_PAL_B },
+       { V4L2_STD_PAL_G, "PAL-G",  TLG_TUNE_VSTD_PAL_G },
+       { V4L2_STD_PAL_H, "PAL-H",  TLG_TUNE_VSTD_PAL_H },
+       { V4L2_STD_PAL_I, "PAL-I",  TLG_TUNE_VSTD_PAL_I },
+       { V4L2_STD_PAL_M, "PAL-M",  TLG_TUNE_VSTD_PAL_M },
+       { V4L2_STD_PAL_N, "PAL-N",  TLG_TUNE_VSTD_PAL_N_COMBO },
+       { V4L2_STD_PAL_Nc, "PAL-Nc", TLG_TUNE_VSTD_PAL_N_COMBO },
+       { V4L2_STD_NTSC_M, "NTSC-M", TLG_TUNE_VSTD_NTSC_M },
+       { V4L2_STD_NTSC_M_JP, "NTSC-JP", TLG_TUNE_VSTD_NTSC_M_J },
+       { V4L2_STD_SECAM_B, "SECAM-B", TLG_TUNE_VSTD_SECAM_B },
+       { V4L2_STD_SECAM_D, "SECAM-D", TLG_TUNE_VSTD_SECAM_D },
+       { V4L2_STD_SECAM_G, "SECAM-G", TLG_TUNE_VSTD_SECAM_G },
+       { V4L2_STD_SECAM_H, "SECAM-H", TLG_TUNE_VSTD_SECAM_H },
+       { V4L2_STD_SECAM_K, "SECAM-K", TLG_TUNE_VSTD_SECAM_K },
+       { V4L2_STD_SECAM_K1, "SECAM-K1", TLG_TUNE_VSTD_SECAM_K1 },
+       { V4L2_STD_SECAM_L, "SECAM-L", TLG_TUNE_VSTD_SECAM_L },
+       { V4L2_STD_SECAM_LC, "SECAM-LC", TLG_TUNE_VSTD_SECAM_L1 },
+};
+static const unsigned int POSEIDON_TVNORMS = ARRAY_SIZE(poseidon_tvnorms);
+
+struct pd_audio_mode {
+       u32 tlg_audio_mode;
+       u32 v4l2_audio_sub;
+       u32 v4l2_audio_mode;
+};
+
+static const struct pd_audio_mode pd_audio_modes[] = {
+       { TLG_TUNE_TVAUDIO_MODE_MONO, V4L2_TUNER_SUB_MONO,
+               V4L2_TUNER_MODE_MONO },
+       { TLG_TUNE_TVAUDIO_MODE_STEREO, V4L2_TUNER_SUB_STEREO,
+               V4L2_TUNER_MODE_STEREO },
+       { TLG_TUNE_TVAUDIO_MODE_LANG_A, V4L2_TUNER_SUB_LANG1,
+               V4L2_TUNER_MODE_LANG1 },
+       { TLG_TUNE_TVAUDIO_MODE_LANG_B, V4L2_TUNER_SUB_LANG2,
+               V4L2_TUNER_MODE_LANG2 },
+       { TLG_TUNE_TVAUDIO_MODE_LANG_C, V4L2_TUNER_SUB_LANG1,
+               V4L2_TUNER_MODE_LANG1_LANG2 }
+};
+static const unsigned int POSEIDON_AUDIOMODS = ARRAY_SIZE(pd_audio_modes);
+
+struct pd_input {
+       char *name;
+       uint32_t tlg_src;
+};
+
+static const struct pd_input pd_inputs[] = {
+       { "TV Antenna", TLG_SIG_SRC_ANTENNA },
+       { "TV Cable", TLG_SIG_SRC_CABLE },
+       { "TV SVideo", TLG_SIG_SRC_SVIDEO },
+       { "TV Composite", TLG_SIG_SRC_COMPOSITE }
+};
+static const unsigned int POSEIDON_INPUTS = ARRAY_SIZE(pd_inputs);
+
+struct poseidon_control {
+       struct v4l2_queryctrl v4l2_ctrl;
+       enum cmd_custom_param_id vc_id;
+};
+
+static struct poseidon_control controls[] = {
+       {
+               { V4L2_CID_BRIGHTNESS, V4L2_CTRL_TYPE_INTEGER,
+                       "brightness", 0, 10000, 1, 100, 0, },
+               CUST_PARM_ID_BRIGHTNESS_CTRL
+       }, {
+               { V4L2_CID_CONTRAST, V4L2_CTRL_TYPE_INTEGER,
+                       "contrast", 0, 10000, 1, 100, 0, },
+               CUST_PARM_ID_CONTRAST_CTRL,
+       }, {
+               { V4L2_CID_HUE, V4L2_CTRL_TYPE_INTEGER,
+                       "hue", 0, 10000, 1, 100, 0, },
+               CUST_PARM_ID_HUE_CTRL,
+       }, {
+               { V4L2_CID_SATURATION, V4L2_CTRL_TYPE_INTEGER,
+                       "saturation", 0, 10000, 1, 100, 0, },
+               CUST_PARM_ID_SATURATION_CTRL,
+       },
+};
+
+struct video_std_to_audio_std {
+       v4l2_std_id     video_std;
+       int             audio_std;
+};
+
+static const struct video_std_to_audio_std video_to_audio_map[] = {
+       /* country : { 27, 32, 33, 34, 36, 44, 45, 46, 47, 48, 64,
+                       65, 86, 351, 352, 353, 354, 358, 372, 852, 972 } */
+       { (V4L2_STD_PAL_I | V4L2_STD_PAL_B | V4L2_STD_PAL_D |
+               V4L2_STD_SECAM_L | V4L2_STD_SECAM_D), TLG_TUNE_ASTD_NICAM },
+
+       /* country : { 1, 52, 54, 55, 886 } */
+       {V4L2_STD_NTSC_M | V4L2_STD_PAL_N | V4L2_STD_PAL_M, TLG_TUNE_ASTD_BTSC},
+
+       /* country : { 81 } */
+       { V4L2_STD_NTSC_M_JP, TLG_TUNE_ASTD_EIAJ },
+
+       /* other country : TLG_TUNE_ASTD_A2 */
+};
+static const unsigned int map_size = ARRAY_SIZE(video_to_audio_map);
+
+static int get_audio_std(v4l2_std_id v4l2_std)
+{
+       int i = 0;
+
+       for (; i < map_size; i++) {
+               if (v4l2_std & video_to_audio_map[i].video_std)
+                       return video_to_audio_map[i].audio_std;
+       }
+       return TLG_TUNE_ASTD_A2;
+}
+
+static int vidioc_querycap(struct file *file, void *fh,
+                       struct v4l2_capability *cap)
+{
+       struct front_face *front = fh;
+       struct poseidon *p = front->pd;
+
+       logs(front);
+
+       strcpy(cap->driver, "tele-video");
+       strcpy(cap->card, "Telegent Poseidon");
+       usb_make_path(p->udev, cap->bus_info, sizeof(cap->bus_info));
+       cap->version = KERNEL_VERSION(0, 0, 1);
+       cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
+                               V4L2_CAP_AUDIO | V4L2_CAP_STREAMING |
+                               V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE;
+       return 0;
+}
+
+/*====================================================================*/
+static void init_copy(struct video_data *video, bool index)
+{
+       struct front_face *front = video->front;
+
+       video->field_count      = index;
+       video->lines_copied     = 0;
+       video->prev_left        = 0 ;
+       video->dst              = (char *)videobuf_to_vmalloc(front->curr_frame)
+                                       + index * video->lines_size;
+       video->vbi->copied      = 0; /* set it here */
+}
+
+static bool get_frame(struct front_face *front, int *need_init)
+{
+       struct videobuf_buffer *vb = front->curr_frame;
+
+       if (vb)
+               return true;
+
+       spin_lock(&front->queue_lock);
+       if (!list_empty(&front->active)) {
+               vb = list_entry(front->active.next,
+                              struct videobuf_buffer, queue);
+               if (need_init)
+                       *need_init = 1;
+               front->curr_frame = vb;
+               list_del_init(&vb->queue);
+       }
+       spin_unlock(&front->queue_lock);
+
+       return !!vb;
+}
+
+/* check if the video's buffer is ready */
+static bool get_video_frame(struct front_face *front, struct video_data *video)
+{
+       int need_init = 0;
+       bool ret = true;
+
+       ret = get_frame(front, &need_init);
+       if (ret && need_init)
+               init_copy(video, 0);
+       return ret;
+}
+
+static void submit_frame(struct front_face *front)
+{
+       struct videobuf_buffer *vb = front->curr_frame;
+
+       if (vb == NULL)
+               return;
+
+       front->curr_frame       = NULL;
+       vb->state               = VIDEOBUF_DONE;
+       vb->field_count++;
+       do_gettimeofday(&vb->ts);
+
+       wake_up(&vb->done);
+}
+
+/*
+ * A frame is composed of two fields. If we receive all the two fields,
+ * call the  submit_frame() to submit the whole frame to applications.
+ */
+static void end_field(struct video_data *video)
+{
+       /* logs(video->front); */
+       if (1 == video->field_count)
+               submit_frame(video->front);
+       else
+               init_copy(video, 1);
+}
+
+static void copy_video_data(struct video_data *video, char *src,
+                               unsigned int count)
+{
+#define copy_data(len)  \
+       do { \
+               if (++video->lines_copied > video->lines_per_field) \
+                       goto overflow; \
+               memcpy(video->dst, src, len);\
+               video->dst += len + video->lines_size; \
+               src += len; \
+               count -= len; \
+        } while (0)
+
+       while (count && count >= video->lines_size) {
+               if (video->prev_left) {
+                       copy_data(video->prev_left);
+                       video->prev_left = 0;
+                       continue;
+               }
+               copy_data(video->lines_size);
+       }
+       if (count && count < video->lines_size) {
+               memcpy(video->dst, src, count);
+
+               video->prev_left = video->lines_size - count;
+               video->dst += count;
+       }
+       return;
+
+overflow:
+       end_field(video);
+}
+
+static void check_trailer(struct video_data *video, char *src, int count)
+{
+       struct vbi_data *vbi = video->vbi;
+       int offset; /* trailer's offset */
+       char *buf;
+
+       offset = (video->context.pix.sizeimage / 2 + vbi->vbi_size / 2)
+               - (vbi->copied + video->lines_size * video->lines_copied);
+       if (video->prev_left)
+               offset -= (video->lines_size - video->prev_left);
+
+       if (offset > count || offset <= 0)
+               goto short_package;
+
+       buf = src + offset;
+
+       /* trailer : (VFHS) + U32 + U32 + field_num */
+       if (!strncmp(buf, "VFHS", 4)) {
+               int field_num = *((u32 *)(buf + 12));
+
+               if ((field_num & 1) ^ video->field_count) {
+                       init_copy(video, video->field_count);
+                       return;
+               }
+               copy_video_data(video, src, offset);
+       }
+short_package:
+       end_field(video);
+}
+
+/* ==========  Check this more carefully! =========== */
+static inline void copy_vbi_data(struct vbi_data *vbi,
+                               char *src, unsigned int count)
+{
+       struct front_face *front = vbi->front;
+
+       if (front && get_frame(front, NULL)) {
+               char *buf = videobuf_to_vmalloc(front->curr_frame);
+
+               if (vbi->video->field_count)
+                       buf += (vbi->vbi_size / 2);
+               memcpy(buf + vbi->copied, src, count);
+       }
+       vbi->copied += count;
+}
+
+/*
+ * Copy the normal data (VBI or VIDEO) without the trailer.
+ * VBI is not interlaced, while VIDEO is interlaced.
+ */
+static inline void copy_vbi_video_data(struct video_data *video,
+                               char *src, unsigned int count)
+{
+       struct vbi_data *vbi = video->vbi;
+       unsigned int vbi_delta = (vbi->vbi_size / 2) - vbi->copied;
+
+       if (vbi_delta >= count) {
+               copy_vbi_data(vbi, src, count);
+       } else {
+               if (vbi_delta) {
+                       copy_vbi_data(vbi, src, vbi_delta);
+
+                       /* we receive the two fields of the VBI*/
+                       if (vbi->front && video->field_count)
+                               submit_frame(vbi->front);
+               }
+               copy_video_data(video, src + vbi_delta, count - vbi_delta);
+       }
+}
+
+static void urb_complete_bulk(struct urb *urb)
+{
+       struct front_face *front = urb->context;
+       struct video_data *video = &front->pd->video_data;
+       char *src = (char *)urb->transfer_buffer;
+       int count = urb->actual_length;
+       int ret = 0;
+
+       if (!video->is_streaming || urb->status) {
+               if (urb->status == -EPROTO)
+                       goto resend_it;
+               return;
+       }
+       if (!get_video_frame(front, video))
+               goto resend_it;
+
+       if (count == urb->transfer_buffer_length)
+               copy_vbi_video_data(video, src, count);
+       else
+               check_trailer(video, src, count);
+
+resend_it:
+       ret = usb_submit_urb(urb, GFP_ATOMIC);
+       if (ret)
+               log(" submit failed: error %d", ret);
+}
+
+/************************* for ISO *********************/
+#define GET_SUCCESS            (0)
+#define GET_TRAILER            (1)
+#define GET_TOO_MUCH_BUBBLE    (2)
+#define GET_NONE               (3)
+static int get_chunk(int start, struct urb *urb,
+                       int *head, int *tail, int *bubble_err)
+{
+       struct usb_iso_packet_descriptor *pkt = NULL;
+       int ret = GET_SUCCESS;
+
+       for (*head = *tail = -1; start < urb->number_of_packets; start++) {
+               pkt = &urb->iso_frame_desc[start];
+
+               /* handle the bubble of the Hub */
+               if (-EOVERFLOW == pkt->status) {
+                       if (++*bubble_err > urb->number_of_packets / 3)
+                               return GET_TOO_MUCH_BUBBLE;
+                       continue;
+               }
+
+               /* This is the gap */
+               if (pkt->status || pkt->actual_length <= 0
+                               || pkt->actual_length > ISO_PKT_SIZE) {
+                       if (*head != -1)
+                               break;
+                       continue;
+               }
+
+               /* a good isochronous packet */
+               if (pkt->actual_length == ISO_PKT_SIZE) {
+                       if (*head == -1)
+                               *head = start;
+                       *tail = start;
+                       continue;
+               }
+
+               /* trailer is here */
+               if (pkt->actual_length < ISO_PKT_SIZE) {
+                       if (*head == -1) {
+                               *head = start;
+                               *tail = start;
+                               return GET_TRAILER;
+                       }
+                       break;
+               }
+       }
+
+       if (*head == -1 && *tail == -1)
+               ret = GET_NONE;
+       return ret;
+}
+
+/*
+ * |__|------|___|-----|_______|
+ *       ^          ^
+ *       |          |
+ *      gap        gap
+ */
+static void urb_complete_iso(struct urb *urb)
+{
+       struct front_face *front = urb->context;
+       struct video_data *video = &front->pd->video_data;
+       int bubble_err = 0, head = 0, tail = 0;
+       char *src = (char *)urb->transfer_buffer;
+       int ret = 0;
+
+       if (!video->is_streaming)
+               return;
+
+       do {
+               if (!get_video_frame(front, video))
+                       goto out;
+
+               switch (get_chunk(head, urb, &head, &tail, &bubble_err)) {
+               case GET_SUCCESS:
+                       copy_vbi_video_data(video, src + (head * ISO_PKT_SIZE),
+                                       (tail - head + 1) * ISO_PKT_SIZE);
+                       break;
+               case GET_TRAILER:
+                       check_trailer(video, src + (head * ISO_PKT_SIZE),
+                                       ISO_PKT_SIZE);
+                       break;
+               case GET_NONE:
+                       goto out;
+               case GET_TOO_MUCH_BUBBLE:
+                       log("\t We got too much bubble");
+                       schedule_work(&video->bubble_work);
+                       return;
+               }
+       } while (head = tail + 1, head < urb->number_of_packets);
+
+out:
+       ret = usb_submit_urb(urb, GFP_ATOMIC);
+       if (ret)
+               log("usb_submit_urb err : %d", ret);
+}
+/*============================= [  end  ] =====================*/
+
+static int prepare_iso_urb(struct video_data *video)
+{
+       struct usb_device *udev = video->pd->udev;
+       int i;
+
+       if (video->urb_array[0])
+               return 0;
+
+       for (i = 0; i < SBUF_NUM; i++) {
+               struct urb *urb;
+               void *mem;
+               int j;
+
+               urb = usb_alloc_urb(PK_PER_URB, GFP_KERNEL);
+               if (urb == NULL)
+                       goto out;
+
+               video->urb_array[i] = urb;
+               mem = usb_buffer_alloc(udev,
+                                       ISO_PKT_SIZE * PK_PER_URB,
+                                       GFP_KERNEL,
+                                       &urb->transfer_dma);
+
+               urb->complete   = urb_complete_iso;     /* handler */
+               urb->dev        = udev;
+               urb->context    = video->front;
+               urb->pipe       = usb_rcvisocpipe(udev,
+                                               video->endpoint_addr);
+               urb->interval   = 1;
+               urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
+               urb->number_of_packets  = PK_PER_URB;
+               urb->transfer_buffer    = mem;
+               urb->transfer_buffer_length = PK_PER_URB * ISO_PKT_SIZE;
+
+               for (j = 0; j < PK_PER_URB; j++) {
+                       urb->iso_frame_desc[j].offset = ISO_PKT_SIZE * j;
+                       urb->iso_frame_desc[j].length = ISO_PKT_SIZE;
+               }
+       }
+       return 0;
+out:
+       for (; i > 0; i--)
+               ;
+       return -ENOMEM;
+}
+
+/* return the succeeded number of the allocation */
+int alloc_bulk_urbs_generic(struct urb **urb_array, int num,
+                       struct usb_device *udev, u8 ep_addr,
+                       int buf_size, gfp_t gfp_flags,
+                       usb_complete_t complete_fn, void *context)
+{
+       struct urb *urb;
+       void *mem;
+       int i;
+
+       for (i = 0; i < num; i++) {
+               urb = usb_alloc_urb(0, gfp_flags);
+               if (urb == NULL)
+                       return i;
+
+               mem = usb_buffer_alloc(udev, buf_size, gfp_flags,
+                                       &urb->transfer_dma);
+               if (mem == NULL)
+                       return i;
+
+               usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, ep_addr),
+                               mem, buf_size, complete_fn, context);
+               urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+               urb_array[i] = urb;
+       }
+       return i;
+}
+
+void free_all_urb_generic(struct urb **urb_array, int num)
+{
+       int i;
+       struct urb *urb;
+
+       for (i = 0; i < num; i++) {
+               urb = urb_array[i];
+               if (urb) {
+                       usb_buffer_free(urb->dev,
+                                       urb->transfer_buffer_length,
+                                       urb->transfer_buffer,
+                                       urb->transfer_dma);
+                       usb_free_urb(urb);
+                       urb_array[i] = NULL;
+               }
+       }
+}
+
+static int prepare_bulk_urb(struct video_data *video)
+{
+       if (video->urb_array[0])
+               return 0;
+
+       alloc_bulk_urbs_generic(video->urb_array, SBUF_NUM,
+                       video->pd->udev, video->endpoint_addr,
+                       0x2000, GFP_KERNEL,
+                       urb_complete_bulk, video->front);
+       return 0;
+}
+
+/* free the URBs */
+static void free_all_urb(struct video_data *video)
+{
+       free_all_urb_generic(video->urb_array, SBUF_NUM);
+}
+
+static void pd_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
+{
+       videobuf_vmalloc_free(vb);
+       vb->state = VIDEOBUF_NEEDS_INIT;
+}
+
+static void pd_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
+{
+       struct front_face *front = q->priv_data;
+       vb->state = VIDEOBUF_QUEUED;
+       list_add_tail(&vb->queue, &front->active);
+}
+
+static int pd_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
+                          enum v4l2_field field)
+{
+       struct front_face *front = q->priv_data;
+       int rc;
+
+       switch (front->type) {
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+               if (VIDEOBUF_NEEDS_INIT == vb->state) {
+                       struct v4l2_pix_format *pix;
+
+                       pix = &front->pd->video_data.context.pix;
+                       vb->size        = pix->sizeimage; /* real frame size */
+                       vb->width       = pix->width;
+                       vb->height      = pix->height;
+                       rc = videobuf_iolock(q, vb, NULL);
+                       if (rc < 0)
+                               return rc;
+               }
+               break;
+       case V4L2_BUF_TYPE_VBI_CAPTURE:
+               if (VIDEOBUF_NEEDS_INIT == vb->state) {
+                       vb->size        = front->pd->vbi_data.vbi_size;
+                       rc = videobuf_iolock(q, vb, NULL);
+                       if (rc < 0)
+                               return rc;
+               }
+               break;
+       default:
+               return -EINVAL;
+       }
+       vb->field = field;
+       vb->state = VIDEOBUF_PREPARED;
+       return 0;
+}
+
+int fire_all_urb(struct video_data *video)
+{
+       int i, ret;
+
+       video->is_streaming = 1;
+
+       for (i = 0; i < SBUF_NUM; i++) {
+               ret = usb_submit_urb(video->urb_array[i], GFP_KERNEL);
+               if (ret)
+                       log("(%d) failed: error %d", i, ret);
+       }
+       return ret;
+}
+
+static int start_video_stream(struct poseidon *pd)
+{
+       struct video_data *video = &pd->video_data;
+       s32 cmd_status;
+
+       send_set_req(pd, TAKE_REQUEST, 0, &cmd_status);
+       send_set_req(pd, PLAY_SERVICE, TLG_TUNE_PLAY_SVC_START, &cmd_status);
+
+       if (pd->cur_transfer_mode) {
+               prepare_iso_urb(video);
+               INIT_WORK(&video->bubble_work, iso_bubble_handler);
+       } else {
+               /* The bulk mode does not need a bubble handler */
+               prepare_bulk_urb(video);
+       }
+       fire_all_urb(video);
+       return 0;
+}
+
+static int pd_buf_setup(struct videobuf_queue *q, unsigned int *count,
+                      unsigned int *size)
+{
+       struct front_face *front = q->priv_data;
+       struct poseidon *pd     = front->pd;
+
+       switch (front->type) {
+       default:
+               return -EINVAL;
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
+               struct video_data *video = &pd->video_data;
+               struct v4l2_pix_format *pix = &video->context.pix;
+
+               *size = PAGE_ALIGN(pix->sizeimage);/* page aligned frame size */
+               if (*count < 4)
+                       *count = 4;
+               if (1) {
+                       /* same in different altersetting */
+                       video->endpoint_addr    = 0x82;
+                       video->vbi              = &pd->vbi_data;
+                       video->vbi->video       = video;
+                       video->pd               = pd;
+                       video->lines_per_field  = pix->height / 2;
+                       video->lines_size       = pix->width * 2;
+                       video->front            = front;
+               }
+               return start_video_stream(pd);
+       }
+
+       case V4L2_BUF_TYPE_VBI_CAPTURE: {
+               struct vbi_data *vbi = &pd->vbi_data;
+
+               *size = PAGE_ALIGN(vbi->vbi_size);
+               log("size : %d", *size);
+               if (*count == 0)
+                       *count = 4;
+       }
+               break;
+       }
+       return 0;
+}
+
+static struct videobuf_queue_ops pd_video_qops = {
+       .buf_setup      = pd_buf_setup,
+       .buf_prepare    = pd_buf_prepare,
+       .buf_queue      = pd_buf_queue,
+       .buf_release    = pd_buf_release,
+};
+
+static int vidioc_enum_fmt(struct file *file, void *fh,
+                               struct v4l2_fmtdesc *f)
+{
+       if (ARRAY_SIZE(poseidon_formats) <= f->index)
+               return -EINVAL;
+       f->type         = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       f->flags        = 0;
+       f->pixelformat  = poseidon_formats[f->index].fourcc;
+       strcpy(f->description, poseidon_formats[f->index].name);
+       return 0;
+}
+
+static int vidioc_g_fmt(struct file *file, void *fh, struct v4l2_format *f)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+
+       logs(front);
+       f->fmt.pix = pd->video_data.context.pix;
+       return 0;
+}
+
+static int vidioc_try_fmt(struct file *file, void *fh,
+               struct v4l2_format *f)
+{
+       return 0;
+}
+
+/*
+ * VLC calls VIDIOC_S_STD before VIDIOC_S_FMT, while
+ * Mplayer calls them in the reverse order.
+ */
+static int pd_vidioc_s_fmt(struct poseidon *pd, struct v4l2_pix_format *pix)
+{
+       struct video_data *video        = &pd->video_data;
+       struct running_context *context = &video->context;
+       struct v4l2_pix_format *pix_def = &context->pix;
+       s32 ret = 0, cmd_status = 0, vid_resol;
+
+       /* set the pixel format to firmware */
+       if (pix->pixelformat == V4L2_PIX_FMT_RGB565) {
+               vid_resol = TLG_TUNER_VID_FORMAT_RGB_565;
+       } else {
+               pix->pixelformat = V4L2_PIX_FMT_YUYV;
+               vid_resol = TLG_TUNER_VID_FORMAT_YUV;
+       }
+       ret = send_set_req(pd, VIDEO_STREAM_FMT_SEL,
+                               vid_resol, &cmd_status);
+
+       /* set the resolution to firmware */
+       vid_resol = TLG_TUNE_VID_RES_720;
+       switch (pix->width) {
+       case 704:
+               vid_resol = TLG_TUNE_VID_RES_704;
+               break;
+       default:
+               pix->width = 720;
+       case 720:
+               break;
+       }
+       ret |= send_set_req(pd, VIDEO_ROSOLU_SEL,
+                               vid_resol, &cmd_status);
+       if (ret || cmd_status) {
+               mutex_unlock(&pd->lock);
+               return -EBUSY;
+       }
+
+       pix_def->pixelformat = pix->pixelformat; /* save it */
+       pix->height = (context->tvnormid & V4L2_STD_525_60) ?  480 : 576;
+
+       /* Compare with the default setting */
+       if ((pix_def->width != pix->width)
+               || (pix_def->height != pix->height)) {
+               pix_def->width          = pix->width;
+               pix_def->height         = pix->height;
+               pix_def->bytesperline   = pix->width * 2;
+               pix_def->sizeimage      = pix->width * pix->height * 2;
+       }
+       *pix = *pix_def;
+
+       return 0;
+}
+
+static int vidioc_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
+{
+       struct front_face *front        = fh;
+       struct poseidon *pd             = front->pd;
+
+       logs(front);
+       /* stop VBI here */
+       if (V4L2_BUF_TYPE_VIDEO_CAPTURE != f->type)
+               return -EINVAL;
+
+       mutex_lock(&pd->lock);
+       if (pd->file_for_stream == NULL)
+               pd->file_for_stream = file;
+       else if (file != pd->file_for_stream) {
+               mutex_unlock(&pd->lock);
+               return -EINVAL;
+       }
+
+       pd_vidioc_s_fmt(pd, &f->fmt.pix);
+       mutex_unlock(&pd->lock);
+       return 0;
+}
+
+static int vidioc_g_fmt_vbi(struct file *file, void *fh,
+                              struct v4l2_format *v4l2_f)
+{
+       struct front_face *front        = fh;
+       struct poseidon *pd             = front->pd;
+       struct v4l2_vbi_format *vbi_fmt = &v4l2_f->fmt.vbi;
+
+       vbi_fmt->samples_per_line       = 720 * 2;
+       vbi_fmt->sampling_rate          = 6750000 * 4;
+       vbi_fmt->sample_format          = V4L2_PIX_FMT_GREY;
+       vbi_fmt->offset                 = 64 * 4;  /*FIXME: why offset */
+       if (pd->video_data.context.tvnormid & V4L2_STD_525_60) {
+               vbi_fmt->start[0] = 10;
+               vbi_fmt->start[1] = 264;
+               vbi_fmt->count[0] = V4L_NTSC_VBI_LINES;
+               vbi_fmt->count[1] = V4L_NTSC_VBI_LINES;
+       } else {
+               vbi_fmt->start[0] = 6;
+               vbi_fmt->start[1] = 314;
+               vbi_fmt->count[0] = V4L_PAL_VBI_LINES;
+               vbi_fmt->count[1] = V4L_PAL_VBI_LINES;
+       }
+       vbi_fmt->flags = V4L2_VBI_UNSYNC;
+       logs(front);
+       return 0;
+}
+
+static int set_std(struct poseidon *pd, v4l2_std_id *norm)
+{
+       struct video_data *video = &pd->video_data;
+       struct vbi_data *vbi    = &pd->vbi_data;
+       struct running_context *context;
+       struct v4l2_pix_format *pix;
+       s32 i, ret = 0, cmd_status, param;
+       int height;
+
+       for (i = 0; i < POSEIDON_TVNORMS; i++) {
+               if (*norm & poseidon_tvnorms[i].v4l2_id) {
+                       param = poseidon_tvnorms[i].tlg_tvnorm;
+                       log("name : %s", poseidon_tvnorms[i].name);
+                       goto found;
+               }
+       }
+       return -EINVAL;
+found:
+       mutex_lock(&pd->lock);
+       ret = send_set_req(pd, VIDEO_STD_SEL, param, &cmd_status);
+       if (ret || cmd_status)
+               goto out;
+
+       /* Set vbi size and check the height of the frame */
+       context = &video->context;
+       context->tvnormid = poseidon_tvnorms[i].v4l2_id;
+       if (context->tvnormid & V4L2_STD_525_60) {
+               vbi->vbi_size = V4L_NTSC_VBI_FRAMESIZE;
+               height = 480;
+       } else {
+               vbi->vbi_size = V4L_PAL_VBI_FRAMESIZE;
+               height = 576;
+       }
+
+       pix = &context->pix;
+       if (pix->height != height) {
+               pix->height     = height;
+               pix->sizeimage  = pix->width * pix->height * 2;
+       }
+
+out:
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+       struct front_face *front = fh;
+       logs(front);
+       return set_std(front->pd, norm);
+}
+
+static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *in)
+{
+       struct front_face *front = fh;
+
+       if (in->index < 0 || in->index >= POSEIDON_INPUTS)
+               return -EINVAL;
+       strcpy(in->name, pd_inputs[in->index].name);
+       in->type  = V4L2_INPUT_TYPE_TUNER;
+
+       /*
+        * the audio input index mixed with this video input,
+        * Poseidon only have one audio/video, set to "0"
+        */
+       in->audioset    = 0;
+       in->tuner       = 0;
+       in->std         = V4L2_STD_ALL;
+       in->status      = 0;
+       logs(front);
+       return 0;
+}
+
+static int vidioc_g_input(struct file *file, void *fh, unsigned int *i)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+       struct running_context *context = &pd->video_data.context;
+
+       logs(front);
+       *i = context->sig_index;
+       return 0;
+}
+
+/* We can support several inputs */
+static int vidioc_s_input(struct file *file, void *fh, unsigned int i)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+       s32 ret, cmd_status;
+
+       if (i < 0 || i >= POSEIDON_INPUTS)
+               return -EINVAL;
+       ret = send_set_req(pd, SGNL_SRC_SEL,
+                       pd_inputs[i].tlg_src, &cmd_status);
+       if (ret)
+               return ret;
+
+       pd->video_data.context.sig_index = i;
+       return 0;
+}
+
+static struct poseidon_control *check_control_id(__u32 id)
+{
+       struct poseidon_control *control = &controls[0];
+       int array_size = ARRAY_SIZE(controls);
+
+       for (; control < &controls[array_size]; control++)
+               if (control->v4l2_ctrl.id  == id)
+                       return control;
+       return NULL;
+}
+
+static int vidioc_queryctrl(struct file *file, void *fh,
+                       struct v4l2_queryctrl *a)
+{
+       struct poseidon_control *control = NULL;
+
+       control = check_control_id(a->id);
+       if (!control)
+               return -EINVAL;
+
+       *a = control->v4l2_ctrl;
+       return 0;
+}
+
+static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *ctrl)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+       struct poseidon_control *control = NULL;
+       struct tuner_custom_parameter_s tuner_param;
+       s32 ret = 0, cmd_status;
+
+       control = check_control_id(ctrl->id);
+       if (!control)
+               return -EINVAL;
+
+       mutex_lock(&pd->lock);
+       ret = send_get_req(pd, TUNER_CUSTOM_PARAMETER, control->vc_id,
+                       &tuner_param, &cmd_status, sizeof(tuner_param));
+       mutex_unlock(&pd->lock);
+
+       if (ret || cmd_status)
+               return -1;
+
+       ctrl->value = tuner_param.param_value;
+       return 0;
+}
+
+static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *a)
+{
+       struct tuner_custom_parameter_s param = {0};
+       struct poseidon_control *control = NULL;
+       struct front_face *front        = fh;
+       struct poseidon *pd             = front->pd;
+       s32 ret = 0, cmd_status, params;
+
+       control = check_control_id(a->id);
+       if (!control)
+               return -EINVAL;
+
+       param.param_value = a->value;
+       param.param_id  = control->vc_id;
+       params = *(s32 *)&param; /* temp code */
+
+       mutex_lock(&pd->lock);
+       ret = send_set_req(pd, TUNER_CUSTOM_PARAMETER, params, &cmd_status);
+       ret = send_set_req(pd, TAKE_REQUEST, 0, &cmd_status);
+       mutex_unlock(&pd->lock);
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/4);
+       return ret;
+}
+
+/* Audio ioctls */
+static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+       if (0 != a->index)
+               return -EINVAL;
+       a->capability = V4L2_AUDCAP_STEREO;
+       strcpy(a->name, "USB audio in");
+       /*Poseidon have no AVL function.*/
+       a->mode = 0;
+       return 0;
+}
+
+int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+       a->index = 0;
+       a->capability = V4L2_AUDCAP_STEREO;
+       strcpy(a->name, "USB audio in");
+       a->mode = 0;
+       return 0;
+}
+
+int vidioc_s_audio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+       return (0 == a->index) ? 0 : -EINVAL;
+}
+
+/* Tuner ioctls */
+static int vidioc_g_tuner(struct file *file, void *fh, struct v4l2_tuner *tuner)
+{
+       struct front_face *front        = fh;
+       struct poseidon *pd             = front->pd;
+       struct tuner_atv_sig_stat_s atv_stat;
+       s32 count = 5, ret, cmd_status;
+       int index;
+
+       if (0 != tuner->index)
+               return -EINVAL;
+
+       mutex_lock(&pd->lock);
+       ret = send_get_req(pd, TUNER_STATUS, TLG_MODE_ANALOG_TV,
+                               &atv_stat, &cmd_status, sizeof(atv_stat));
+
+       while (atv_stat.sig_lock_busy && count-- && !ret) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ);
+
+               ret = send_get_req(pd, TUNER_STATUS, TLG_MODE_ANALOG_TV,
+                               &atv_stat, &cmd_status, sizeof(atv_stat));
+       }
+       mutex_unlock(&pd->lock);
+
+       if (debug_mode)
+               log("P:%d,S:%d", atv_stat.sig_present, atv_stat.sig_strength);
+
+       if (ret || cmd_status)
+               tuner->signal = 0;
+       else if (atv_stat.sig_present && !atv_stat.sig_strength)
+               tuner->signal = 0xFFFF;
+       else
+               tuner->signal = (atv_stat.sig_strength * 255 / 10) << 8;
+
+       strcpy(tuner->name, "Telegent Systems");
+       tuner->type = V4L2_TUNER_ANALOG_TV;
+       tuner->rangelow = TUNER_FREQ_MIN / 62500;
+       tuner->rangehigh = TUNER_FREQ_MAX / 62500;
+       tuner->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO |
+                               V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
+       index = pd->video_data.context.audio_idx;
+       tuner->rxsubchans = pd_audio_modes[index].v4l2_audio_sub;
+       tuner->audmode = pd_audio_modes[index].v4l2_audio_mode;
+       tuner->afc = 0;
+       logs(front);
+       return 0;
+}
+
+static int pd_vidioc_s_tuner(struct poseidon *pd, int index)
+{
+       s32 ret = 0, cmd_status, param, audiomode;
+
+       mutex_lock(&pd->lock);
+       param = pd_audio_modes[index].tlg_audio_mode;
+       ret = send_set_req(pd, TUNER_AUD_MODE, param, &cmd_status);
+       audiomode = get_audio_std(pd->video_data.context.tvnormid);
+       ret |= send_set_req(pd, TUNER_AUD_ANA_STD, audiomode,
+                               &cmd_status);
+       if (!ret)
+               pd->video_data.context.audio_idx = index;
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static int vidioc_s_tuner(struct file *file, void *fh, struct v4l2_tuner *a)
+{
+       struct front_face *front        = fh;
+       struct poseidon *pd             = front->pd;
+       int index;
+
+       if (0 != a->index)
+               return -EINVAL;
+       logs(front);
+       for (index = 0; index < POSEIDON_AUDIOMODS; index++)
+               if (a->audmode == pd_audio_modes[index].v4l2_audio_mode)
+                       return pd_vidioc_s_tuner(pd, index);
+       return -EINVAL;
+}
+
+static int vidioc_g_frequency(struct file *file, void *fh,
+                       struct v4l2_frequency *freq)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+       struct running_context *context = &pd->video_data.context;
+
+       if (0 != freq->tuner)
+               return -EINVAL;
+       freq->frequency = context->freq;
+       freq->type = V4L2_TUNER_ANALOG_TV;
+       return 0;
+}
+
+static int set_frequency(struct poseidon *pd, __u32 frequency)
+{
+       s32 ret = 0, param, cmd_status;
+       struct running_context *context = &pd->video_data.context;
+
+       param = frequency * 62500 / 1000;
+       if (param < TUNER_FREQ_MIN/1000 || param > TUNER_FREQ_MAX / 1000)
+               return -EINVAL;
+
+       mutex_lock(&pd->lock);
+       ret = send_set_req(pd, TUNE_FREQ_SELECT, param, &cmd_status);
+       ret = send_set_req(pd, TAKE_REQUEST, 0, &cmd_status);
+
+       msleep(250); /* wait for a while until the hardware is ready. */
+       context->freq = frequency;
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static int vidioc_s_frequency(struct file *file, void *fh,
+                               struct v4l2_frequency *freq)
+{
+       struct front_face *front = fh;
+       struct poseidon *pd = front->pd;
+
+       logs(front);
+#ifdef CONFIG_PM
+       pd->pm_suspend = pm_video_suspend;
+       pd->pm_resume = pm_video_resume;
+#endif
+       return set_frequency(pd, freq->frequency);
+}
+
+static int vidioc_reqbufs(struct file *file, void *fh,
+                               struct v4l2_requestbuffers *b)
+{
+       struct front_face *front = file->private_data;
+       logs(front);
+       return videobuf_reqbufs(&front->q, b);
+}
+
+static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct front_face *front = file->private_data;
+       logs(front);
+       return videobuf_querybuf(&front->q, b);
+}
+
+static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct front_face *front = file->private_data;
+       return videobuf_qbuf(&front->q, b);
+}
+
+static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct front_face *front = file->private_data;
+       return videobuf_dqbuf(&front->q, b, file->f_flags & O_NONBLOCK);
+}
+
+/* Just stop the URBs, do not free the URBs */
+int usb_transfer_stop(struct video_data *video)
+{
+       if (video->is_streaming) {
+               int i;
+               s32 cmd_status;
+               struct poseidon *pd = video->pd;
+
+               video->is_streaming = 0;
+               for (i = 0; i < SBUF_NUM; ++i) {
+                       if (video->urb_array[i])
+                               usb_kill_urb(video->urb_array[i]);
+               }
+
+               send_set_req(pd, PLAY_SERVICE, TLG_TUNE_PLAY_SVC_STOP,
+                              &cmd_status);
+       }
+       return 0;
+}
+
+int stop_all_video_stream(struct poseidon *pd)
+{
+       struct video_data *video = &pd->video_data;
+       struct vbi_data *vbi    = &pd->vbi_data;
+
+       mutex_lock(&pd->lock);
+       if (video->is_streaming) {
+               struct front_face *front = video->front;
+
+               /* stop the URBs */
+               usb_transfer_stop(video);
+               free_all_urb(video);
+
+               /* stop the host side of VIDEO */
+               videobuf_stop(&front->q);
+               videobuf_mmap_free(&front->q);
+
+               /* stop the host side of VBI */
+               front = vbi->front;
+               if (front) {
+                       videobuf_stop(&front->q);
+                       videobuf_mmap_free(&front->q);
+               }
+       }
+       mutex_unlock(&pd->lock);
+       return 0;
+}
+
+/*
+ * The bubbles can seriously damage the video's quality,
+ * though it occurs in very rare situation.
+ */
+static void iso_bubble_handler(struct work_struct *w)
+{
+       struct video_data *video;
+       struct poseidon *pd;
+
+       video = container_of(w, struct video_data, bubble_work);
+       pd = video->pd;
+
+       mutex_lock(&pd->lock);
+       usb_transfer_stop(video);
+       msleep(500);
+       start_video_stream(pd);
+       mutex_unlock(&pd->lock);
+}
+
+
+static int vidioc_streamon(struct file *file, void *fh,
+                               enum v4l2_buf_type type)
+{
+       struct front_face *front = fh;
+
+       logs(front);
+       if (unlikely(type != front->type))
+               return -EINVAL;
+       return videobuf_streamon(&front->q);
+}
+
+static int vidioc_streamoff(struct file *file, void *fh,
+                               enum v4l2_buf_type type)
+{
+       struct front_face *front = file->private_data;
+
+       logs(front);
+       if (unlikely(type != front->type))
+               return -EINVAL;
+       return videobuf_streamoff(&front->q);
+}
+
+/* Set the firmware's default values : need altersetting */
+static int pd_video_checkmode(struct poseidon *pd)
+{
+       s32 ret = 0, cmd_status, audiomode;
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/2);
+
+       /* choose the altersetting */
+       ret = usb_set_interface(pd->udev, 0,
+                                       (pd->cur_transfer_mode ?
+                                        ISO_3K_BULK_ALTERNATE_IFACE :
+                                        BULK_ALTERNATE_IFACE));
+       if (ret < 0)
+               goto error;
+
+       /* set default parameters for PAL-D , with the VBI enabled*/
+       ret = set_tuner_mode(pd, TLG_MODE_ANALOG_TV);
+       ret |= send_set_req(pd, SGNL_SRC_SEL,
+                               TLG_SIG_SRC_ANTENNA, &cmd_status);
+       ret |= send_set_req(pd, VIDEO_STD_SEL,
+                               TLG_TUNE_VSTD_PAL_D, &cmd_status);
+       ret |= send_set_req(pd, VIDEO_STREAM_FMT_SEL,
+                               TLG_TUNER_VID_FORMAT_YUV, &cmd_status);
+       ret |= send_set_req(pd, VIDEO_ROSOLU_SEL,
+                               TLG_TUNE_VID_RES_720, &cmd_status);
+       ret |= send_set_req(pd, TUNE_FREQ_SELECT, TUNER_FREQ_MIN, &cmd_status);
+       ret |= send_set_req(pd, VBI_DATA_SEL, 1, &cmd_status);/* enable vbi */
+
+       /* set the audio */
+       audiomode = get_audio_std(pd->video_data.context.tvnormid);
+       ret |= send_set_req(pd, TUNER_AUD_ANA_STD, audiomode, &cmd_status);
+       ret |= send_set_req(pd, TUNER_AUD_MODE,
+                               TLG_TUNE_TVAUDIO_MODE_STEREO, &cmd_status);
+       ret |= send_set_req(pd, AUDIO_SAMPLE_RATE_SEL,
+                               ATV_AUDIO_RATE_48K, &cmd_status);
+error:
+       return ret;
+}
+
+#ifdef CONFIG_PM
+static int pm_video_suspend(struct poseidon *pd)
+{
+       /* stop audio */
+       pm_alsa_suspend(pd);
+
+       /* stop and free all the URBs */
+       usb_transfer_stop(&pd->video_data);
+       free_all_urb(&pd->video_data);
+
+       /* reset the interface */
+       usb_set_interface(pd->udev, 0, 0);
+       msleep(300);
+       return 0;
+}
+
+static int restore_v4l2_context(struct poseidon *pd,
+                               struct running_context *context)
+{
+       struct front_face *front = pd->video_data.front;
+
+       pd_video_checkmode(pd);
+
+       set_std(pd, &context->tvnormid);
+       vidioc_s_input(NULL, front, context->sig_index);
+       pd_vidioc_s_tuner(pd, context->audio_idx);
+       pd_vidioc_s_fmt(pd, &context->pix);
+       set_frequency(pd, context->freq);
+       return 0;
+}
+
+static int pm_video_resume(struct poseidon *pd)
+{
+       struct video_data *video = &pd->video_data;
+
+       /* resume the video */
+       /* [1] restore the origin V4L2 parameters */
+       restore_v4l2_context(pd, &video->context);
+
+       /* [2] initiate video copy variables */
+       if (video->front->curr_frame)
+               init_copy(video, 0);
+
+       /* [3] fire urbs        */
+       start_video_stream(pd);
+
+       /* resume the audio */
+       pm_alsa_resume(pd);
+       return 0;
+}
+#endif
+
+void set_debug_mode(struct video_device *vfd, int debug_mode)
+{
+       vfd->debug = 0;
+       if (debug_mode & 0x1)
+               vfd->debug = V4L2_DEBUG_IOCTL;
+       if (debug_mode & 0x2)
+               vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
+}
+
+static void init_video_context(struct running_context *context)
+{
+       context->sig_index      = 0;
+       context->audio_idx      = 1; /* stereo */
+       context->tvnormid       = V4L2_STD_PAL_D;
+       context->pix = (struct v4l2_pix_format) {
+                               .width          = 720,
+                               .height         = 576,
+                               .pixelformat    = V4L2_PIX_FMT_YUYV,
+                               .field          = V4L2_FIELD_INTERLACED,
+                               .bytesperline   = 720 * 2,
+                               .sizeimage      = 720 * 576 * 2,
+                               .colorspace     = V4L2_COLORSPACE_SMPTE170M,
+                               .priv           = 0
+                       };
+}
+
+static int pd_video_open(struct file *file)
+{
+       struct video_device *vfd = video_devdata(file);
+       struct poseidon *pd = video_get_drvdata(vfd);
+       struct front_face *front = NULL;
+       int ret = -ENOMEM;
+
+       mutex_lock(&pd->lock);
+       usb_autopm_get_interface(pd->interface);
+
+       if (vfd->vfl_type == VFL_TYPE_GRABBER
+               && !(pd->state & POSEIDON_STATE_ANALOG)) {
+               front = kzalloc(sizeof(struct front_face), GFP_KERNEL);
+               if (!front)
+                       goto out;
+
+               pd->cur_transfer_mode   = usb_transfer_mode;/* bulk or iso */
+               init_video_context(&pd->video_data.context);
+
+               ret = pd_video_checkmode(pd);
+               if (ret < 0) {
+                       kfree(front);
+                       ret = -1;
+                       goto out;
+               }
+
+               pd->state               |= POSEIDON_STATE_ANALOG;
+               front->type             = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+               pd->video_data.users++;
+               set_debug_mode(vfd, debug_mode);
+
+               videobuf_queue_vmalloc_init(&front->q, &pd_video_qops,
+                               NULL, &front->queue_lock,
+                               V4L2_BUF_TYPE_VIDEO_CAPTURE,
+                               V4L2_FIELD_INTERLACED,/* video is interlacd */
+                               sizeof(struct videobuf_buffer),/*it's enough*/
+                               front);
+       } else if (vfd->vfl_type == VFL_TYPE_VBI
+               && !(pd->state & POSEIDON_STATE_VBI)) {
+               front = kzalloc(sizeof(struct front_face), GFP_KERNEL);
+               if (!front)
+                       goto out;
+
+               pd->state       |= POSEIDON_STATE_VBI;
+               front->type     = V4L2_BUF_TYPE_VBI_CAPTURE;
+               pd->vbi_data.front = front;
+               pd->vbi_data.users++;
+
+               videobuf_queue_vmalloc_init(&front->q, &pd_video_qops,
+                               NULL, &front->queue_lock,
+                               V4L2_BUF_TYPE_VBI_CAPTURE,
+                               V4L2_FIELD_NONE, /* vbi is NONE mode */
+                               sizeof(struct videobuf_buffer),
+                               front);
+       } else {
+               /* maybe add FM support here */
+               log("other ");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       front->pd               = pd;
+       front->curr_frame       = NULL;
+       INIT_LIST_HEAD(&front->active);
+       spin_lock_init(&front->queue_lock);
+
+       file->private_data      = front;
+       kref_get(&pd->kref);
+
+       mutex_unlock(&pd->lock);
+       return 0;
+out:
+       usb_autopm_put_interface(pd->interface);
+       mutex_unlock(&pd->lock);
+       return ret;
+}
+
+static int pd_video_release(struct file *file)
+{
+       struct front_face *front = file->private_data;
+       struct poseidon *pd = front->pd;
+       s32 cmd_status = 0;
+
+       logs(front);
+       mutex_lock(&pd->lock);
+
+       if (front->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+               pd->state &= ~POSEIDON_STATE_ANALOG;
+
+               /* stop the device, and free the URBs */
+               usb_transfer_stop(&pd->video_data);
+               free_all_urb(&pd->video_data);
+
+               /* stop the firmware */
+               send_set_req(pd, PLAY_SERVICE, TLG_TUNE_PLAY_SVC_STOP,
+                              &cmd_status);
+
+               pd->file_for_stream = NULL;
+               pd->video_data.users--;
+       } else if (front->type  == V4L2_BUF_TYPE_VBI_CAPTURE) {
+               pd->state &= ~POSEIDON_STATE_VBI;
+               pd->vbi_data.front = NULL;
+               pd->vbi_data.users--;
+       }
+       videobuf_stop(&front->q);
+       videobuf_mmap_free(&front->q);
+
+       usb_autopm_put_interface(pd->interface);
+       mutex_unlock(&pd->lock);
+
+       kfree(front);
+       file->private_data = NULL;
+       kref_put(&pd->kref, poseidon_delete);
+       return 0;
+}
+
+static int pd_video_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       struct front_face *front = file->private_data;
+       return  videobuf_mmap_mapper(&front->q, vma);
+}
+
+unsigned int pd_video_poll(struct file *file, poll_table *table)
+{
+       struct front_face *front = file->private_data;
+       return videobuf_poll_stream(file, &front->q, table);
+}
+
+ssize_t pd_video_read(struct file *file, char __user *buffer,
+                       size_t count, loff_t *ppos)
+{
+       struct front_face *front = file->private_data;
+       return videobuf_read_stream(&front->q, buffer, count, ppos,
+                               0, file->f_flags & O_NONBLOCK);
+}
+
+/* This struct works for both VIDEO and VBI */
+static const struct v4l2_file_operations pd_video_fops = {
+       .owner          = THIS_MODULE,
+       .open           = pd_video_open,
+       .release        = pd_video_release,
+       .read           = pd_video_read,
+       .poll           = pd_video_poll,
+       .mmap           = pd_video_mmap,
+       .ioctl          = video_ioctl2, /* maybe changed in future */
+};
+
+static const struct v4l2_ioctl_ops pd_video_ioctl_ops = {
+       .vidioc_querycap        = vidioc_querycap,
+
+       /* Video format */
+       .vidioc_g_fmt_vid_cap   = vidioc_g_fmt,
+       .vidioc_enum_fmt_vid_cap        = vidioc_enum_fmt,
+       .vidioc_s_fmt_vid_cap   = vidioc_s_fmt,
+       .vidioc_g_fmt_vbi_cap   = vidioc_g_fmt_vbi, /* VBI */
+       .vidioc_try_fmt_vid_cap = vidioc_try_fmt,
+
+       /* Input */
+       .vidioc_g_input         = vidioc_g_input,
+       .vidioc_s_input         = vidioc_s_input,
+       .vidioc_enum_input      = vidioc_enum_input,
+
+       /* Audio ioctls */
+       .vidioc_enumaudio       = vidioc_enumaudio,
+       .vidioc_g_audio         = vidioc_g_audio,
+       .vidioc_s_audio         = vidioc_s_audio,
+
+       /* Tuner ioctls */
+       .vidioc_g_tuner         = vidioc_g_tuner,
+       .vidioc_s_tuner         = vidioc_s_tuner,
+       .vidioc_s_std           = vidioc_s_std,
+       .vidioc_g_frequency     = vidioc_g_frequency,
+       .vidioc_s_frequency     = vidioc_s_frequency,
+
+       /* Buffer handlers */
+       .vidioc_reqbufs         = vidioc_reqbufs,
+       .vidioc_querybuf        = vidioc_querybuf,
+       .vidioc_qbuf            = vidioc_qbuf,
+       .vidioc_dqbuf           = vidioc_dqbuf,
+
+       /* Stream on/off */
+       .vidioc_streamon        = vidioc_streamon,
+       .vidioc_streamoff       = vidioc_streamoff,
+
+       /* Control handling */
+       .vidioc_queryctrl       = vidioc_queryctrl,
+       .vidioc_g_ctrl          = vidioc_g_ctrl,
+       .vidioc_s_ctrl          = vidioc_s_ctrl,
+};
+
+static struct video_device pd_video_template = {
+       .name = "Telegent-Video",
+       .fops = &pd_video_fops,
+       .minor = -1,
+       .release = video_device_release,
+       .tvnorms = V4L2_STD_ALL,
+       .ioctl_ops = &pd_video_ioctl_ops,
+};
+
+struct video_device *vdev_init(struct poseidon *pd, struct video_device *tmp)
+{
+       struct video_device *vfd;
+
+       vfd = video_device_alloc();
+       if (vfd == NULL)
+               return NULL;
+       *vfd            = *tmp;
+       vfd->minor      = -1;
+       vfd->v4l2_dev   = &pd->v4l2_dev;
+       /*vfd->parent   = &(pd->udev->dev); */
+       vfd->release    = video_device_release;
+       video_set_drvdata(vfd, pd);
+       return vfd;
+}
+
+void destroy_video_device(struct video_device **v_dev)
+{
+       struct video_device *dev = *v_dev;
+
+       if (dev == NULL)
+               return;
+
+       if (video_is_registered(dev))
+               video_unregister_device(dev);
+       else
+               video_device_release(dev);
+       *v_dev = NULL;
+}
+
+void pd_video_exit(struct poseidon *pd)
+{
+       struct video_data *video = &pd->video_data;
+       struct vbi_data *vbi = &pd->vbi_data;
+
+       destroy_video_device(&video->v_dev);
+       destroy_video_device(&vbi->v_dev);
+       log();
+}
+
+int pd_video_init(struct poseidon *pd)
+{
+       struct video_data *video = &pd->video_data;
+       struct vbi_data *vbi    = &pd->vbi_data;
+       int ret = -ENOMEM;
+
+       video->v_dev = vdev_init(pd, &pd_video_template);
+       if (video->v_dev == NULL)
+               goto out;
+
+       ret = video_register_device(video->v_dev, VFL_TYPE_GRABBER, -1);
+       if (ret != 0)
+               goto out;
+
+       /* VBI uses the same template as video */
+       vbi->v_dev = vdev_init(pd, &pd_video_template);
+       if (vbi->v_dev == NULL) {
+               ret = -ENOMEM;
+               goto out;
+       }
+       ret = video_register_device(vbi->v_dev, VFL_TYPE_VBI, -1);
+       if (ret != 0)
+               goto out;
+       log("register VIDEO/VBI devices");
+       return 0;
+out:
+       log("VIDEO/VBI devices register failed, : %d", ret);
+       pd_video_exit(pd);
+       return ret;
+}
+
diff --git a/drivers/media/video/tlg2300/vendorcmds.h b/drivers/media/video/tlg2300/vendorcmds.h
new file mode 100644 (file)
index 0000000..ba6f4ae
--- /dev/null
@@ -0,0 +1,243 @@
+#ifndef VENDOR_CMD_H_
+#define VENDOR_CMD_H_
+
+#define BULK_ALTERNATE_IFACE           (2)
+#define ISO_3K_BULK_ALTERNATE_IFACE     (1)
+#define REQ_SET_CMD                    (0X00)
+#define REQ_GET_CMD                    (0X80)
+
+enum tlg__analog_audio_standard {
+       TLG_TUNE_ASTD_NONE      = 0x00000000,
+       TLG_TUNE_ASTD_A2        = 0x00000001,
+       TLG_TUNE_ASTD_NICAM     = 0x00000002,
+       TLG_TUNE_ASTD_EIAJ      = 0x00000004,
+       TLG_TUNE_ASTD_BTSC      = 0x00000008,
+       TLG_TUNE_ASTD_FM_US     = 0x00000010,
+       TLG_TUNE_ASTD_FM_EUR    = 0x00000020,
+       TLG_TUNE_ASTD_ALL       = 0x0000003f
+};
+
+/*
+ * identifiers for Custom Parameter messages.
+ * @typedef cmd_custom_param_id_t
+ */
+enum cmd_custom_param_id {
+       CUST_PARM_ID_NONE               = 0x00,
+       CUST_PARM_ID_BRIGHTNESS_CTRL    = 0x01,
+       CUST_PARM_ID_CONTRAST_CTRL      = 0x02,
+       CUST_PARM_ID_HUE_CTRL           = 0x03,
+       CUST_PARM_ID_SATURATION_CTRL      = 0x04,
+       CUST_PARM_ID_AUDIO_SNR_THRESHOLD  = 0x10,
+       CUST_PARM_ID_AUDIO_AGC_THRESHOLD  = 0x11,
+       CUST_PARM_ID_MAX
+};
+
+struct  tuner_custom_parameter_s {
+       uint16_t        param_id;        /*  Parameter identifier  */
+       uint16_t        param_value;     /*  Parameter value       */
+};
+
+struct  tuner_ber_rate_s {
+       uint32_t        ber_rate;  /*  BER sample rate in seconds   */
+};
+
+struct tuner_atv_sig_stat_s {
+       uint32_t        sig_present;
+       uint32_t        sig_locked;
+       uint32_t        sig_lock_busy;
+       uint32_t        sig_strength;      /*  milliDb    */
+       uint32_t        tv_audio_chan;    /*  mono/stereo/sap*/
+       uint32_t        mvision_stat;      /*  macrovision status */
+};
+
+struct tuner_dtv_sig_stat_s {
+       uint32_t sig_present;   /*  Boolean*/
+       uint32_t sig_locked;    /*  Boolean */
+       uint32_t sig_lock_busy; /*  Boolean     (Can this time-out?) */
+       uint32_t sig_strength;  /*  milliDb*/
+};
+
+struct tuner_fm_sig_stat_s {
+       uint32_t sig_present;   /* Boolean*/
+       uint32_t sig_locked;     /* Boolean */
+       uint32_t sig_lock_busy;  /* Boolean */
+       uint32_t sig_stereo_mono;/* TBD*/
+       uint32_t sig_strength;   /* milliDb*/
+};
+
+enum _tag_tlg_tune_srv_cmd {
+       TLG_TUNE_PLAY_SVC_START = 1,
+       TLG_TUNE_PLAY_SVC_STOP
+};
+
+enum  _tag_tune_atv_audio_mode_caps {
+       TLG_TUNE_TVAUDIO_MODE_MONO      = 0x00000001,
+       TLG_TUNE_TVAUDIO_MODE_STEREO    = 0x00000002,
+       TLG_TUNE_TVAUDIO_MODE_LANG_A    = 0x00000010,/* Primary language*/
+       TLG_TUNE_TVAUDIO_MODE_LANG_B    = 0x00000020,/* 2nd avail language*/
+       TLG_TUNE_TVAUDIO_MODE_LANG_C    = 0x00000040
+};
+
+
+enum   _tag_tuner_atv_audio_rates {
+       ATV_AUDIO_RATE_NONE     = 0x00,/* Audio not supported*/
+       ATV_AUDIO_RATE_32K      = 0x01,/* Audio rate = 32 KHz*/
+       ATV_AUDIO_RATE_48K      = 0x02, /* Audio rate = 48 KHz*/
+       ATV_AUDIO_RATE_31_25K   = 0x04 /* Audio rate = 31.25KHz */
+};
+
+enum  _tag_tune_atv_vid_res_caps {
+       TLG_TUNE_VID_RES_NONE   = 0x00000000,
+       TLG_TUNE_VID_RES_720    = 0x00000001,
+       TLG_TUNE_VID_RES_704    = 0x00000002,
+       TLG_TUNE_VID_RES_360    = 0x00000004
+};
+
+enum _tag_tuner_analog_video_format {
+       TLG_TUNER_VID_FORMAT_YUV        = 0x00000001,
+       TLG_TUNER_VID_FORMAT_YCRCB      = 0x00000002,
+       TLG_TUNER_VID_FORMAT_RGB_565    = 0x00000004,
+};
+
+enum  tlg_ext_audio_support {
+       TLG_EXT_AUDIO_NONE      = 0x00,/*  No external audio input supported */
+       TLG_EXT_AUDIO_LR        = 0x01/*  LR external audio inputs supported*/
+};
+
+enum {
+       TLG_MODE_NONE                   = 0x00, /* No Mode specified*/
+       TLG_MODE_ANALOG_TV              = 0x01, /* Analog Television mode*/
+       TLG_MODE_ANALOG_TV_UNCOMP       = 0x01, /* Analog Television mode*/
+       TLG_MODE_ANALOG_TV_COMP         = 0x02, /* Analog TV mode (compressed)*/
+       TLG_MODE_FM_RADIO               = 0x04, /* FM Radio mode*/
+       TLG_MODE_DVB_T                  = 0x08, /* Digital TV (DVB-T)*/
+};
+
+enum  tlg_signal_sources_t {
+       TLG_SIG_SRC_NONE        = 0x00,/* Signal source not specified */
+       TLG_SIG_SRC_ANTENNA     = 0x01,/* Signal src is: Antenna */
+       TLG_SIG_SRC_CABLE       = 0x02,/* Signal src is: Coax Cable*/
+       TLG_SIG_SRC_SVIDEO      = 0x04,/* Signal src is: S_VIDEO   */
+       TLG_SIG_SRC_COMPOSITE   = 0x08 /* Signal src is: Composite Video */
+};
+
+enum tuner_analog_video_standard {
+       TLG_TUNE_VSTD_NONE      = 0x00000000,
+       TLG_TUNE_VSTD_NTSC_M    = 0x00000001,
+       TLG_TUNE_VSTD_NTSC_M_J  = 0x00000002,/* Japan   */
+       TLG_TUNE_VSTD_PAL_B     = 0x00000010,
+       TLG_TUNE_VSTD_PAL_D     = 0x00000020,
+       TLG_TUNE_VSTD_PAL_G     = 0x00000040,
+       TLG_TUNE_VSTD_PAL_H     = 0x00000080,
+       TLG_TUNE_VSTD_PAL_I     = 0x00000100,
+       TLG_TUNE_VSTD_PAL_M     = 0x00000200,
+       TLG_TUNE_VSTD_PAL_N     = 0x00000400,
+       TLG_TUNE_VSTD_SECAM_B   = 0x00001000,
+       TLG_TUNE_VSTD_SECAM_D   = 0x00002000,
+       TLG_TUNE_VSTD_SECAM_G   = 0x00004000,
+       TLG_TUNE_VSTD_SECAM_H   = 0x00008000,
+       TLG_TUNE_VSTD_SECAM_K   = 0x00010000,
+       TLG_TUNE_VSTD_SECAM_K1  = 0x00020000,
+       TLG_TUNE_VSTD_SECAM_L   = 0x00040000,
+       TLG_TUNE_VSTD_SECAM_L1  = 0x00080000,
+       TLG_TUNE_VSTD_PAL_N_COMBO = 0x00100000
+};
+
+enum tlg_mode_caps {
+       TLG_MODE_CAPS_NONE              = 0x00,  /*  No Mode specified  */
+       TLG_MODE_CAPS_ANALOG_TV_UNCOMP  = 0x01,  /*  Analog TV mode     */
+       TLG_MODE_CAPS_ANALOG_TV_COMP    = 0x02,  /*  Analog TV (compressed)*/
+       TLG_MODE_CAPS_FM_RADIO          = 0x04,  /*  FM Radio mode      */
+       TLG_MODE_CAPS_DVB_T             = 0x08,  /*  Digital TV (DVB-T) */
+};
+
+enum poseidon_vendor_cmds {
+       LAST_CMD_STAT           = 0x00,
+       GET_CHIP_ID             = 0x01,
+       GET_FW_ID               = 0x02,
+       PRODUCT_CAPS            = 0x03,
+
+       TUNE_MODE_CAP_ATV       = 0x10,
+       TUNE_MODE_CAP_ATVCOMP   = 0X10,
+       TUNE_MODE_CAP_DVBT      = 0x10,
+       TUNE_MODE_CAP_FM        = 0x10,
+       TUNE_MODE_SELECT        = 0x11,
+       TUNE_FREQ_SELECT        = 0x12,
+       SGNL_SRC_SEL            = 0x13,
+
+       VIDEO_STD_SEL           = 0x14,
+       VIDEO_STREAM_FMT_SEL    = 0x15,
+       VIDEO_ROSOLU_AVAIL      = 0x16,
+       VIDEO_ROSOLU_SEL        = 0x17,
+       VIDEO_CONT_PROTECT      = 0x20,
+
+       VCR_TIMING_MODSEL       = 0x21,
+       EXT_AUDIO_CAP           = 0x22,
+       EXT_AUDIO_SEL           = 0x23,
+       TEST_PATTERN_SEL        = 0x24,
+       VBI_DATA_SEL            = 0x25,
+       AUDIO_SAMPLE_RATE_CAP   = 0x28,
+       AUDIO_SAMPLE_RATE_SEL   = 0x29,
+       TUNER_AUD_MODE          = 0x2a,
+       TUNER_AUD_MODE_AVAIL    = 0x2b,
+       TUNER_AUD_ANA_STD       = 0x2c,
+       TUNER_CUSTOM_PARAMETER  = 0x2f,
+
+       DVBT_TUNE_MODE_SEL      = 0x30,
+       DVBT_BANDW_CAP          = 0x31,
+       DVBT_BANDW_SEL          = 0x32,
+       DVBT_GUARD_INTERV_CAP   = 0x33,
+       DVBT_GUARD_INTERV_SEL   = 0x34,
+       DVBT_MODULATION_CAP     = 0x35,
+       DVBT_MODULATION_SEL     = 0x36,
+       DVBT_INNER_FEC_RATE_CAP = 0x37,
+       DVBT_INNER_FEC_RATE_SEL = 0x38,
+       DVBT_TRANS_MODE_CAP     = 0x39,
+       DVBT_TRANS_MODE_SEL     = 0x3a,
+       DVBT_SEARCH_RANG        = 0x3c,
+
+       TUNER_SETUP_ANALOG      = 0x40,
+       TUNER_SETUP_DIGITAL     = 0x41,
+       TUNER_SETUP_FM_RADIO    = 0x42,
+       TAKE_REQUEST            = 0x43, /* Take effect of the command */
+       PLAY_SERVICE            = 0x44, /* Play start or Play stop */
+       TUNER_STATUS            = 0x45,
+       TUNE_PROP_DVBT          = 0x46,
+       ERR_RATE_STATS          = 0x47,
+       TUNER_BER_RATE          = 0x48,
+
+       SCAN_CAPS               = 0x50,
+       SCAN_SETUP              = 0x51,
+       SCAN_SERVICE            = 0x52,
+       SCAN_STATS              = 0x53,
+
+       PID_SET                 = 0x58,
+       PID_UNSET               = 0x59,
+       PID_LIST                = 0x5a,
+
+       IRD_CAP                 = 0x60,
+       IRD_MODE_SEL            = 0x61,
+       IRD_SETUP               = 0x62,
+
+       PTM_MODE_CAP            = 0x70,
+       PTM_MODE_SEL            = 0x71,
+       PTM_SERVICE             = 0x72,
+       TUNER_REG_SCRIPT        = 0x73,
+       CMD_CHIP_RST            = 0x74,
+};
+
+enum tlg_bw {
+       TLG_BW_5 = 5,
+       TLG_BW_6 = 6,
+       TLG_BW_7 = 7,
+       TLG_BW_8 = 8,
+       TLG_BW_12 = 12,
+       TLG_BW_15 = 15
+};
+
+struct cmd_firmware_vers_s {
+       uint8_t  fw_rev_major;
+       uint8_t  fw_rev_minor;
+       uint16_t fw_patch;
+};
+#endif /* VENDOR_CMD_H_ */
index 5b3eaa16afd2261f1253b702b81dad9362604f6c..c4dab6cfd9487dd2dd5c6c841eb7a852dff2b49f 100644 (file)
@@ -1078,6 +1078,7 @@ static int tuner_probe(struct i2c_client *client,
 
                                goto register_client;
                        }
+                       kfree(t);
                        return -ENODEV;
                case 0x42:
                case 0x43:
index d533ea57e7b10e89529bfa2029fb58056a1791b4..0a877497b93f614dd67e3acbf58ca677af9cd2f9 100644 (file)
@@ -680,10 +680,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
        tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n",
                tvee->model, tvee->rev_str, tvee->serial_number);
        if (tvee->has_MAC_address == 1)
-               tveeprom_info("MAC address is %02X-%02X-%02X-%02X-%02X-%02X\n",
-                       tvee->MAC_address[0], tvee->MAC_address[1],
-                       tvee->MAC_address[2], tvee->MAC_address[3],
-                       tvee->MAC_address[4], tvee->MAC_address[5]);
+               tveeprom_info("MAC address is %pM\n", tvee->MAC_address);
        tveeprom_info("tuner model is %s (idx %d, type %d)\n",
                t_name1, tuner1, tvee->tuner_type);
        tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c
new file mode 100644 (file)
index 0000000..5a878bc
--- /dev/null
@@ -0,0 +1,1187 @@
+/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
+ * Digitizer with Horizontal PLL registers
+ *
+ * Copyright (C) 2009 Texas Instruments Inc
+ * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
+ *
+ * This code is partially based upon the TVP5150 driver
+ * written by Mauro Carvalho Chehab (mchehab@infradead.org),
+ * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
+ * and the TVP7002 driver in the TI LSP 2.10.00.14. Revisions by
+ * Muralidharan Karicheri and Snehaprabha Narnakaje (TI).
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/videodev2.h>
+#include <media/tvp7002.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-chip-ident.h>
+#include <media/v4l2-common.h>
+#include "tvp7002_reg.h"
+
+MODULE_DESCRIPTION("TI TVP7002 Video and Graphics Digitizer driver");
+MODULE_AUTHOR("Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>");
+MODULE_LICENSE("GPL");
+
+/* Module Name */
+#define TVP7002_MODULE_NAME    "tvp7002"
+
+/* I2C retry attempts */
+#define I2C_RETRY_COUNT                (5)
+
+/* End of registers */
+#define TVP7002_EOR            0x5c
+
+/* Read write definition for registers */
+#define TVP7002_READ           0
+#define TVP7002_WRITE          1
+#define TVP7002_RESERVED       2
+
+/* Interlaced vs progressive mask and shift */
+#define TVP7002_IP_SHIFT       5
+#define TVP7002_INPR_MASK      (0x01 << TVP7002_IP_SHIFT)
+
+/* Shift for CPL and LPF registers */
+#define TVP7002_CL_SHIFT       8
+#define TVP7002_CL_MASK                0x0f
+
+/* Debug functions */
+static int debug;
+module_param(debug, bool, 0644);
+MODULE_PARM_DESC(debug, "Debug level (0-2)");
+
+/* Structure for register values */
+struct i2c_reg_value {
+       u8 reg;
+       u8 value;
+       u8 type;
+};
+
+/*
+ * Register default values (according to tvp7002 datasheet)
+ * In the case of read-only registers, the value (0xff) is
+ * never written. R/W functionality is controlled by the
+ * writable bit in the register struct definition.
+ */
+static const struct i2c_reg_value tvp7002_init_default[] = {
+       { TVP7002_CHIP_REV, 0xff, TVP7002_READ },
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x67, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x80, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HSYNC_OUT_W, 0x60, TVP7002_WRITE },
+       { TVP7002_B_FINE_GAIN, 0x00, TVP7002_WRITE },
+       { TVP7002_G_FINE_GAIN, 0x00, TVP7002_WRITE },
+       { TVP7002_R_FINE_GAIN, 0x00, TVP7002_WRITE },
+       { TVP7002_B_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
+       { TVP7002_G_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
+       { TVP7002_R_FINE_OFF_MSBS, 0x80, TVP7002_WRITE },
+       { TVP7002_SYNC_CTL_1, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_AND_CLAMP_CTL, 0x2e, TVP7002_WRITE },
+       { TVP7002_SYNC_ON_G_THRS, 0x5d, TVP7002_WRITE },
+       { TVP7002_SYNC_SEPARATOR_THRS, 0x47, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_SYNC_DETECT_STAT, 0xff, TVP7002_READ },
+       { TVP7002_OUT_FORMATTER, 0x47, TVP7002_WRITE },
+       { TVP7002_MISC_CTL_1, 0x01, TVP7002_WRITE },
+       { TVP7002_MISC_CTL_2, 0x00, TVP7002_WRITE },
+       { TVP7002_MISC_CTL_3, 0x01, TVP7002_WRITE },
+       { TVP7002_IN_MUX_SEL_1, 0x00, TVP7002_WRITE },
+       { TVP7002_IN_MUX_SEL_2, 0x67, TVP7002_WRITE },
+       { TVP7002_B_AND_G_COARSE_GAIN, 0x77, TVP7002_WRITE },
+       { TVP7002_R_COARSE_GAIN, 0x07, TVP7002_WRITE },
+       { TVP7002_FINE_OFF_LSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_B_COARSE_OFF, 0x10, TVP7002_WRITE },
+       { TVP7002_G_COARSE_OFF, 0x10, TVP7002_WRITE },
+       { TVP7002_R_COARSE_OFF, 0x10, TVP7002_WRITE },
+       { TVP7002_HSOUT_OUT_START, 0x08, TVP7002_WRITE },
+       { TVP7002_MISC_CTL_4, 0x00, TVP7002_WRITE },
+       { TVP7002_B_DGTL_ALC_OUT_LSBS, 0xff, TVP7002_READ },
+       { TVP7002_G_DGTL_ALC_OUT_LSBS, 0xff, TVP7002_READ },
+       { TVP7002_R_DGTL_ALC_OUT_LSBS, 0xff, TVP7002_READ },
+       { TVP7002_AUTO_LVL_CTL_ENABLE, 0x80, TVP7002_WRITE },
+       { TVP7002_DGTL_ALC_OUT_MSBS, 0xff, TVP7002_READ },
+       { TVP7002_AUTO_LVL_CTL_FILTER, 0x53, TVP7002_WRITE },
+       { 0x29, 0x08, TVP7002_RESERVED },
+       { TVP7002_FINE_CLAMP_CTL, 0x07, TVP7002_WRITE },
+       /* PWR_CTL is controlled only by the probe and reset functions */
+       { TVP7002_PWR_CTL, 0x00, TVP7002_RESERVED },
+       { TVP7002_ADC_SETUP, 0x50, TVP7002_WRITE },
+       { TVP7002_COARSE_CLAMP_CTL, 0x00, TVP7002_WRITE },
+       { TVP7002_SOG_CLAMP, 0x80, TVP7002_WRITE },
+       { TVP7002_RGB_COARSE_CLAMP_CTL, 0x00, TVP7002_WRITE },
+       { TVP7002_SOG_COARSE_CLAMP_CTL, 0x04, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { 0x32, 0x18, TVP7002_RESERVED },
+       { 0x33, 0x60, TVP7002_RESERVED },
+       { TVP7002_MVIS_STRIPPER_W, 0xff, TVP7002_RESERVED },
+       { TVP7002_VSYNC_ALGN, 0x10, TVP7002_WRITE },
+       { TVP7002_SYNC_BYPASS, 0x00, TVP7002_WRITE },
+       { TVP7002_L_FRAME_STAT_LSBS, 0xff, TVP7002_READ },
+       { TVP7002_L_FRAME_STAT_MSBS, 0xff, TVP7002_READ },
+       { TVP7002_CLK_L_STAT_LSBS, 0xff, TVP7002_READ },
+       { TVP7002_CLK_L_STAT_MSBS, 0xff, TVP7002_READ },
+       { TVP7002_HSYNC_W, 0xff, TVP7002_READ },
+       { TVP7002_VSYNC_W, 0xff, TVP7002_READ },
+       { TVP7002_L_LENGTH_TOL, 0x03, TVP7002_WRITE },
+       { 0x3e, 0x60, TVP7002_RESERVED },
+       { TVP7002_VIDEO_BWTH_CTL, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x2c, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x2c, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x05, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x1e, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x00, TVP7002_WRITE },
+       { TVP7002_FBIT_F_0_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_FBIT_F_1_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_YUV_Y_G_COEF_LSBS, 0xe3, TVP7002_WRITE },
+       { TVP7002_YUV_Y_G_COEF_MSBS, 0x16, TVP7002_WRITE },
+       { TVP7002_YUV_Y_B_COEF_LSBS, 0x4f, TVP7002_WRITE },
+       { TVP7002_YUV_Y_B_COEF_MSBS, 0x02, TVP7002_WRITE },
+       { TVP7002_YUV_Y_R_COEF_LSBS, 0xce, TVP7002_WRITE },
+       { TVP7002_YUV_Y_R_COEF_MSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_YUV_U_G_COEF_LSBS, 0xab, TVP7002_WRITE },
+       { TVP7002_YUV_U_G_COEF_MSBS, 0xf3, TVP7002_WRITE },
+       { TVP7002_YUV_U_B_COEF_LSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_YUV_U_B_COEF_MSBS, 0x10, TVP7002_WRITE },
+       { TVP7002_YUV_U_R_COEF_LSBS, 0x55, TVP7002_WRITE },
+       { TVP7002_YUV_U_R_COEF_MSBS, 0xfc, TVP7002_WRITE },
+       { TVP7002_YUV_V_G_COEF_LSBS, 0x78, TVP7002_WRITE },
+       { TVP7002_YUV_V_G_COEF_MSBS, 0xf1, TVP7002_WRITE },
+       { TVP7002_YUV_V_B_COEF_LSBS, 0x88, TVP7002_WRITE },
+       { TVP7002_YUV_V_B_COEF_MSBS, 0xfe, TVP7002_WRITE },
+       { TVP7002_YUV_V_R_COEF_LSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_YUV_V_R_COEF_MSBS, 0x10, TVP7002_WRITE },
+       /* This signals end of register values */
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 480P */
+static const struct i2c_reg_value tvp7002_parms_480P[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x35, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x0a, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0x02, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x14, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x91, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x0B, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x03, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x01, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x13, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x13, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x18, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x06, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x10, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x03, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x03, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 576P */
+static const struct i2c_reg_value tvp7002_parms_576P[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x36, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0x18, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x14, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x9B, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x0F, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x2D, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x00, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x18, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x06, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x10, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x03, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x03, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 1080I60 */
+static const struct i2c_reg_value tvp7002_parms_1080I60[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x89, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x08, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0x98, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x14, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x8a, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x08, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x16, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x17, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x01, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 1080P60 */
+static const struct i2c_reg_value tvp7002_parms_1080P60[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x89, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x08, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0xE0, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x14, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x8a, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x08, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x16, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x17, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x01, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 1080I50 */
+static const struct i2c_reg_value tvp7002_parms_1080I50[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0xa5, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x00, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0x98, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x14, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x8a, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x08, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x02, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x16, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x17, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x01, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 720P60 */
+static const struct i2c_reg_value tvp7002_parms_720P60[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x67, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x02, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0xa0, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x16, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x47, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x4B, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x05, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x2D, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x00, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Register parameters for 720P50 */
+static const struct i2c_reg_value tvp7002_parms_720P50[] = {
+       { TVP7002_HPLL_FDBK_DIV_MSBS, 0x7b, TVP7002_WRITE },
+       { TVP7002_HPLL_FDBK_DIV_LSBS, 0x0c, TVP7002_WRITE },
+       { TVP7002_HPLL_CRTL, 0x98, TVP7002_WRITE },
+       { TVP7002_HPLL_PHASE_SEL, 0x16, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_LSBS, 0x47, TVP7002_WRITE },
+       { TVP7002_AVID_START_PIXEL_MSBS, 0x01, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_LSBS, 0x4B, TVP7002_WRITE },
+       { TVP7002_AVID_STOP_PIXEL_MSBS, 0x06, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_START_L_OFF, 0x05, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_START_L_OFF, 0x00, TVP7002_WRITE },
+       { TVP7002_VBLK_F_0_DURATION, 0x2D, TVP7002_WRITE },
+       { TVP7002_VBLK_F_1_DURATION, 0x00, TVP7002_WRITE },
+       { TVP7002_ALC_PLACEMENT, 0x5a, TVP7002_WRITE },
+       { TVP7002_CLAMP_START, 0x32, TVP7002_WRITE },
+       { TVP7002_CLAMP_W, 0x20, TVP7002_WRITE },
+       { TVP7002_HPLL_PRE_COAST, 0x01, TVP7002_WRITE },
+       { TVP7002_HPLL_POST_COAST, 0x00, TVP7002_WRITE },
+       { TVP7002_EOR, 0xff, TVP7002_RESERVED }
+};
+
+/* Struct list for available formats */
+static const struct v4l2_fmtdesc tvp7002_fmt_list[] = {
+       {
+        .index = 0,
+        .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+        .flags = 0,
+        .description = "8-bit UYVY 4:2:2 Format",
+        .pixelformat = V4L2_PIX_FMT_UYVY,
+       },
+};
+
+#define NUM_FORMATS            ARRAY_SIZE(tvp7002_fmt_list)
+
+/* Preset definition for handling device operation */
+struct tvp7002_preset_definition {
+       u32 preset;
+       const struct i2c_reg_value *p_settings;
+       enum v4l2_colorspace color_space;
+       enum v4l2_field scanmode;
+       u16 progressive;
+       u16 lines_per_frame;
+       u16 cpl_min;
+       u16 cpl_max;
+};
+
+/* Struct list for digital video presets */
+static const struct tvp7002_preset_definition tvp7002_presets[] = {
+       {
+               V4L2_DV_720P60,
+               tvp7002_parms_720P60,
+               V4L2_COLORSPACE_REC709,
+               V4L2_FIELD_NONE,
+               1,
+               0x2EE,
+               135,
+               153
+       },
+       {
+               V4L2_DV_1080I60,
+               tvp7002_parms_1080I60,
+               V4L2_COLORSPACE_REC709,
+               V4L2_FIELD_INTERLACED,
+               0,
+               0x465,
+               181,
+               205
+       },
+       {
+               V4L2_DV_1080I50,
+               tvp7002_parms_1080I50,
+               V4L2_COLORSPACE_REC709,
+               V4L2_FIELD_INTERLACED,
+               0,
+               0x465,
+               217,
+               245
+       },
+       {
+               V4L2_DV_720P50,
+               tvp7002_parms_720P50,
+               V4L2_COLORSPACE_REC709,
+               V4L2_FIELD_NONE,
+               1,
+               0x2EE,
+               163,
+               183
+       },
+       {
+               V4L2_DV_1080P60,
+               tvp7002_parms_1080P60,
+               V4L2_COLORSPACE_REC709,
+               V4L2_FIELD_NONE,
+               1,
+               0x465,
+               90,
+               102
+       },
+       {
+               V4L2_DV_480P59_94,
+               tvp7002_parms_480P,
+               V4L2_COLORSPACE_SMPTE170M,
+               V4L2_FIELD_NONE,
+               1,
+               0x20D,
+               0xffff,
+               0xffff
+       },
+       {
+               V4L2_DV_576P50,
+               tvp7002_parms_576P,
+               V4L2_COLORSPACE_SMPTE170M,
+               V4L2_FIELD_NONE,
+               1,
+               0x271,
+               0xffff,
+               0xffff
+       }
+};
+
+#define NUM_PRESETS    ARRAY_SIZE(tvp7002_presets)
+
+/* Device definition */
+struct tvp7002 {
+       struct v4l2_subdev sd;
+       const struct tvp7002_config *pdata;
+
+       int ver;
+       int streaming;
+
+       struct v4l2_pix_format pix;
+       const struct tvp7002_preset_definition *current_preset;
+       u8 gain;
+};
+
+/*
+ * to_tvp7002 - Obtain device handler TVP7002
+ * @sd: ptr to v4l2_subdev struct
+ *
+ * Returns device handler tvp7002.
+ */
+static inline struct tvp7002 *to_tvp7002(struct v4l2_subdev *sd)
+{
+       return container_of(sd, struct tvp7002, sd);
+}
+
+/*
+ * tvp7002_read - Read a value from a register in an TVP7002
+ * @sd: ptr to v4l2_subdev struct
+ * @reg: TVP7002 register address
+ * @dst: pointer to 8-bit destination
+ *
+ * Returns value read if successful, or non-zero (-1) otherwise.
+ */
+static int tvp7002_read(struct v4l2_subdev *sd, u8 addr, u8 *dst)
+{
+       struct i2c_client *c = v4l2_get_subdevdata(sd);
+       int retry;
+       int error;
+
+       for (retry = 0; retry < I2C_RETRY_COUNT; retry++) {
+               error = i2c_smbus_read_byte_data(c, addr);
+
+               if (error >= 0) {
+                       *dst = (u8)error;
+                       return 0;
+               }
+
+               msleep_interruptible(10);
+       }
+       v4l2_err(sd, "TVP7002 read error %d\n", error);
+       return error;
+}
+
+/*
+ * tvp7002_read_err() - Read a register value with error code
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @reg: destination register
+ * @val: value to be read
+ * @error: pointer to error value
+ *
+ * Read a value in a register and save error value in pointer.
+ * Also update the register table if successful
+ */
+static inline void tvp7002_read_err(struct v4l2_subdev *sd, u8 reg,
+                                                       u8 *dst, int *err)
+{
+       if (!*err)
+               *err = tvp7002_read(sd, reg, dst);
+}
+
+/*
+ * tvp7002_write() - Write a value to a register in TVP7002
+ * @sd: ptr to v4l2_subdev struct
+ * @addr: TVP7002 register address
+ * @value: value to be written to the register
+ *
+ * Write a value to a register in an TVP7002 decoder device.
+ * Returns zero if successful, or non-zero otherwise.
+ */
+static int tvp7002_write(struct v4l2_subdev *sd, u8 addr, u8 value)
+{
+       struct i2c_client *c;
+       int retry;
+       int error;
+
+       c = v4l2_get_subdevdata(sd);
+
+       for (retry = 0; retry < I2C_RETRY_COUNT; retry++) {
+               error = i2c_smbus_write_byte_data(c, addr, value);
+
+               if (error >= 0)
+                       return 0;
+
+               v4l2_warn(sd, "Write: retry ... %d\n", retry);
+               msleep_interruptible(10);
+       }
+       v4l2_err(sd, "TVP7002 write error %d\n", error);
+       return error;
+}
+
+/*
+ * tvp7002_write_err() - Write a register value with error code
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @reg: destination register
+ * @val: value to be written
+ * @error: pointer to error value
+ *
+ * Write a value in a register and save error value in pointer.
+ * Also update the register table if successful
+ */
+static inline void tvp7002_write_err(struct v4l2_subdev *sd, u8 reg,
+                                                       u8 val, int *err)
+{
+       if (!*err)
+               *err = tvp7002_write(sd, reg, val);
+}
+
+/*
+ * tvp7002_g_chip_ident() - Get chip identification number
+ * @sd: ptr to v4l2_subdev struct
+ * @chip: ptr to v4l2_dbg_chip_ident struct
+ *
+ * Obtains the chip's identification number.
+ * Returns zero or -EINVAL if read operation fails.
+ */
+static int tvp7002_g_chip_ident(struct v4l2_subdev *sd,
+                                       struct v4l2_dbg_chip_ident *chip)
+{
+       u8 rev;
+       int error;
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+       error = tvp7002_read(sd, TVP7002_CHIP_REV, &rev);
+
+       if (error < 0)
+               return error;
+
+       return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_TVP7002, rev);
+}
+
+/*
+ * tvp7002_write_inittab() - Write initialization values
+ * @sd: ptr to v4l2_subdev struct
+ * @regs: ptr to i2c_reg_value struct
+ *
+ * Write initialization values.
+ * Returns zero or -EINVAL if read operation fails.
+ */
+static int tvp7002_write_inittab(struct v4l2_subdev *sd,
+                                       const struct i2c_reg_value *regs)
+{
+       int error = 0;
+
+       /* Initialize the first (defined) registers */
+       while (TVP7002_EOR != regs->reg) {
+               if (TVP7002_WRITE == regs->type)
+                       tvp7002_write_err(sd, regs->reg, regs->value, &error);
+               regs++;
+       }
+
+       return error;
+}
+
+/*
+ * tvp7002_s_dv_preset() - Set digital video preset
+ * @sd: ptr to v4l2_subdev struct
+ * @std: ptr to v4l2_dv_preset struct
+ *
+ * Set the digital video preset for a TVP7002 decoder device.
+ * Returns zero when successful or -EINVAL if register access fails.
+ */
+static int tvp7002_s_dv_preset(struct v4l2_subdev *sd,
+                                       struct v4l2_dv_preset *dv_preset)
+{
+       struct tvp7002 *device = to_tvp7002(sd);
+       u32 preset;
+       int i;
+
+       for (i = 0; i < NUM_PRESETS; i++) {
+               preset = tvp7002_presets[i].preset;
+               if (preset == dv_preset->preset) {
+                       device->current_preset = &tvp7002_presets[i];
+                       return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings);
+               }
+       }
+
+       return -EINVAL;
+}
+
+/*
+ * tvp7002_g_ctrl() - Get a control
+ * @sd: ptr to v4l2_subdev struct
+ * @ctrl: ptr to v4l2_control struct
+ *
+ * Get a control for a TVP7002 decoder device.
+ * Returns zero when successful or -EINVAL if register access fails.
+ */
+static int tvp7002_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
+{
+       struct tvp7002 *device = to_tvp7002(sd);
+
+       switch (ctrl->id) {
+       case V4L2_CID_GAIN:
+               ctrl->value = device->gain;
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}
+
+/*
+ * tvp7002_s_ctrl() - Set a control
+ * @sd: ptr to v4l2_subdev struct
+ * @ctrl: ptr to v4l2_control struct
+ *
+ * Set a control in TVP7002 decoder device.
+ * Returns zero when successful or -EINVAL if register access fails.
+ */
+static int tvp7002_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
+{
+       struct tvp7002 *device = to_tvp7002(sd);
+       int error = 0;
+
+       switch (ctrl->id) {
+       case V4L2_CID_GAIN:
+               tvp7002_write_err(sd, TVP7002_R_FINE_GAIN,
+                                               ctrl->value & 0xff, &error);
+               tvp7002_write_err(sd, TVP7002_G_FINE_GAIN,
+                                               ctrl->value & 0xff, &error);
+               tvp7002_write_err(sd, TVP7002_B_FINE_GAIN,
+                                               ctrl->value & 0xff, &error);
+
+               if (error < 0)
+                       return error;
+
+               /* Set only after knowing there is no error */
+               device->gain = ctrl->value & 0xff;
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}
+
+/*
+ * tvp7002_queryctrl() - Query a control
+ * @sd: ptr to v4l2_subdev struct
+ * @ctrl: ptr to v4l2_queryctrl struct
+ *
+ * Query a control of a TVP7002 decoder device.
+ * Returns zero when successful or -EINVAL if register read fails.
+ */
+static int tvp7002_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
+{
+       switch (qc->id) {
+       case V4L2_CID_GAIN:
+               /*
+                * Gain is supported [0-255, default=0, step=1]
+                */
+               return v4l2_ctrl_query_fill(qc, 0, 255, 1, 0);
+       default:
+               return -EINVAL;
+       }
+}
+
+/*
+ * tvp7002_try_fmt_cap() - V4L2 decoder interface handler for try_fmt
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure
+ *
+ * Implement the VIDIOC_TRY_FMT ioctl for the CAPTURE buffer type. This
+ * ioctl is used to negotiate the image capture size and pixel format
+ * without actually making it take effect.
+ */
+static int tvp7002_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f)
+{
+       struct tvp7002 *device = to_tvp7002(sd);
+       struct v4l2_dv_enum_preset e_preset;
+       struct v4l2_pix_format *pix;
+       int error = 0;
+
+       pix = &f->fmt.pix;
+
+       /* Calculate height and width based on current standard */
+       error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset);
+       if (error)
+               return -EINVAL;
+
+       pix->width = e_preset.width;
+       pix->height = e_preset.height;
+       pix->pixelformat = V4L2_PIX_FMT_UYVY;
+       pix->field = device->current_preset->scanmode;
+       pix->bytesperline = pix->width * 2;
+       pix->sizeimage = pix->bytesperline * pix->height;
+       pix->colorspace = device->current_preset->color_space;
+       pix->priv = 0;
+
+       v4l2_dbg(1, debug, sd, "Try FMT: pixelformat - %s, bytesperline - %d"
+                       "Width - %d, Height - %d", "8-bit UYVY 4:2:2 Format",
+                       pix->bytesperline, pix->width, pix->height);
+       return error;
+}
+
+/*
+ * tvp7002_s_fmt() - V4L2 decoder interface handler for s_fmt
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure
+ *
+ * If the requested format is supported, configures the HW to use that
+ * format, returns error code if format not supported or HW can't be
+ * correctly configured.
+ */
+static int tvp7002_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
+{
+       struct tvp7002 *decoder = to_tvp7002(sd);
+       int rval;
+
+       rval = tvp7002_try_fmt_cap(sd, f);
+       if (!rval)
+               decoder->pix = f->fmt.pix;
+       return rval;
+}
+
+/*
+ * tvp7002_g_fmt() - V4L2 decoder interface handler for tvp7002_g_fmt
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @f: pointer to standard V4L2 v4l2_format structure
+ *
+ * Returns the decoder's current pixel format in the v4l2_format
+ * parameter.
+ */
+static int tvp7002_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
+{
+       struct tvp7002 *decoder = to_tvp7002(sd);
+
+       f->fmt.pix = decoder->pix;
+
+       v4l2_dbg(1, debug, sd, "Current FMT: bytesperline - %d"
+                       "Width - %d, Height - %d",
+                       decoder->pix.bytesperline,
+                       decoder->pix.width, decoder->pix.height);
+       return 0;
+}
+
+/*
+ * tvp7002_query_dv_preset() - query DV preset
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @std_id: standard V4L2 v4l2_dv_preset
+ *
+ * Returns the current DV preset by TVP7002. If no active input is
+ * detected, returns -EINVAL
+ */
+static int tvp7002_query_dv_preset(struct v4l2_subdev *sd,
+                                               struct v4l2_dv_preset *qpreset)
+{
+       const struct tvp7002_preset_definition *presets = tvp7002_presets;
+       struct v4l2_dv_enum_preset e_preset;
+       struct tvp7002 *device;
+       u8 progressive;
+       u32 lpfr;
+       u32 cpln;
+       int error = 0;
+       u8 lpf_lsb;
+       u8 lpf_msb;
+       u8 cpl_lsb;
+       u8 cpl_msb;
+       int index;
+
+       device = to_tvp7002(sd);
+
+       /* Read standards from device registers */
+       tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error);
+       tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_MSBS, &lpf_msb, &error);
+
+       if (error < 0)
+               return error;
+
+       tvp7002_read_err(sd, TVP7002_CLK_L_STAT_LSBS, &cpl_lsb, &error);
+       tvp7002_read_err(sd, TVP7002_CLK_L_STAT_MSBS, &cpl_msb, &error);
+
+       if (error < 0)
+               return error;
+
+       /* Get lines per frame, clocks per line and interlaced/progresive */
+       lpfr = lpf_lsb | ((TVP7002_CL_MASK & lpf_msb) << TVP7002_CL_SHIFT);
+       cpln = cpl_lsb | ((TVP7002_CL_MASK & cpl_msb) << TVP7002_CL_SHIFT);
+       progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT;
+
+       /* Do checking of video modes */
+       for (index = 0; index < NUM_PRESETS; index++, presets++)
+               if (lpfr  == presets->lines_per_frame &&
+                       progressive == presets->progressive) {
+                       if (presets->cpl_min == 0xffff)
+                               break;
+                       if (cpln >= presets->cpl_min && cpln <= presets->cpl_max)
+                               break;
+               }
+
+       if (index == NUM_PRESETS) {
+               v4l2_err(sd, "querystd error, lpf = %x, cpl = %x\n",
+                                                               lpfr, cpln);
+               return -EINVAL;
+       }
+
+       if (v4l_fill_dv_preset_info(presets->preset, &e_preset))
+               return -EINVAL;
+
+       /* Set values in found preset */
+       qpreset->preset = presets->preset;
+
+       /* Update lines per frame and clocks per line info */
+       v4l2_dbg(1, debug, sd, "Current preset: %d %d",
+                                       e_preset.width, e_preset.height);
+       return 0;
+}
+
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+/*
+ * tvp7002_g_register() - Get the value of a register
+ * @sd: ptr to v4l2_subdev struct
+ * @vreg: ptr to v4l2_dbg_register struct
+ *
+ * Get the value of a TVP7002 decoder device register.
+ * Returns zero when successful, -EINVAL if register read fails or
+ * access to I2C client fails, -EPERM if the call is not allowed
+ * by diabled CAP_SYS_ADMIN.
+ */
+static int tvp7002_g_register(struct v4l2_subdev *sd,
+                                               struct v4l2_dbg_register *reg)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       u8 val;
+       int ret;
+
+       if (!v4l2_chip_match_i2c_client(client, &reg->match))
+               return -EINVAL;
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       ret = tvp7002_read(sd, reg->reg & 0xff, &val);
+       reg->val = val;
+       return ret;
+}
+
+/*
+ * tvp7002_s_register() - set a control
+ * @sd: ptr to v4l2_subdev struct
+ * @ctrl: ptr to v4l2_control struct
+ *
+ * Get the value of a TVP7002 decoder device register.
+ * Returns zero when successful, -EINVAL if register read fails or
+ * -EPERM if call not allowed.
+ */
+static int tvp7002_s_register(struct v4l2_subdev *sd,
+                                               struct v4l2_dbg_register *reg)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+       if (!v4l2_chip_match_i2c_client(client, &reg->match))
+               return -EINVAL;
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff);
+}
+#endif
+
+/*
+ * tvp7002_enum_fmt() - Enum supported formats
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @enable: pointer to format struct
+ *
+ * Enumerate supported formats.
+ */
+
+static int tvp7002_enum_fmt(struct v4l2_subdev *sd,
+                                               struct v4l2_fmtdesc *fmtdesc)
+{
+       /* Check requested format index is within range */
+       if (fmtdesc->index < 0 || fmtdesc->index >= NUM_FORMATS)
+               return -EINVAL;
+       *fmtdesc = tvp7002_fmt_list[fmtdesc->index];
+
+       return 0;
+}
+
+/*
+ * tvp7002_s_stream() - V4L2 decoder i/f handler for s_stream
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @enable: streaming enable or disable
+ *
+ * Sets streaming to enable or disable, if possible.
+ */
+static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct tvp7002 *device = to_tvp7002(sd);
+       int error = 0;
+
+       if (device->streaming == enable)
+               return 0;
+
+       if (enable) {
+               /* Set output state on (low impedance means stream on) */
+               error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x00);
+               device->streaming = enable;
+       } else {
+               /* Set output state off (high impedance means stream off) */
+               error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x03);
+               if (error)
+                       v4l2_dbg(1, debug, sd, "Unable to stop streaming\n");
+
+               device->streaming = enable;
+       }
+
+       return error;
+}
+
+/*
+ * tvp7002_log_status() - Print information about register settings
+ * @sd: ptr to v4l2_subdev struct
+ *
+ * Log register values of a TVP7002 decoder device.
+ * Returns zero or -EINVAL if read operation fails.
+ */
+static int tvp7002_log_status(struct v4l2_subdev *sd)
+{
+       const struct tvp7002_preset_definition *presets = tvp7002_presets;
+       struct tvp7002 *device = to_tvp7002(sd);
+       struct v4l2_dv_enum_preset e_preset;
+       struct v4l2_dv_preset detected;
+       int i;
+
+       detected.preset = V4L2_DV_INVALID;
+       /* Find my current standard*/
+       tvp7002_query_dv_preset(sd, &detected);
+
+       /* Print standard related code values */
+       for (i = 0; i < NUM_PRESETS; i++, presets++)
+               if (presets->preset == detected.preset)
+                       break;
+
+       if (v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset))
+               return -EINVAL;
+
+       v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name);
+       v4l2_info(sd, "   Pixels per line: %u\n", e_preset.width);
+       v4l2_info(sd, "   Lines per frame: %u\n\n", e_preset.height);
+       if (i == NUM_PRESETS) {
+               v4l2_info(sd, "Detected DV Preset: None\n");
+       } else {
+               if (v4l_fill_dv_preset_info(presets->preset, &e_preset))
+                       return -EINVAL;
+               v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name);
+               v4l2_info(sd, "  Pixels per line: %u\n", e_preset.width);
+               v4l2_info(sd, "  Lines per frame: %u\n\n", e_preset.height);
+       }
+       v4l2_info(sd, "Streaming enabled: %s\n",
+                                       device->streaming ? "yes" : "no");
+
+       /* Print the current value of the gain control */
+       v4l2_info(sd, "Gain: %u\n", device->gain);
+
+       return 0;
+}
+
+/* V4L2 core operation handlers */
+static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
+       .g_chip_ident = tvp7002_g_chip_ident,
+       .log_status = tvp7002_log_status,
+       .g_ctrl = tvp7002_g_ctrl,
+       .s_ctrl = tvp7002_s_ctrl,
+       .queryctrl = tvp7002_queryctrl,
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+       .g_register = tvp7002_g_register,
+       .s_register = tvp7002_s_register,
+#endif
+};
+
+/* Specific video subsystem operation handlers */
+static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
+       .s_dv_preset = tvp7002_s_dv_preset,
+       .query_dv_preset = tvp7002_query_dv_preset,
+       .s_stream = tvp7002_s_stream,
+       .g_fmt = tvp7002_g_fmt,
+       .s_fmt = tvp7002_s_fmt,
+       .enum_fmt = tvp7002_enum_fmt,
+};
+
+/* V4L2 top level operation handlers */
+static const struct v4l2_subdev_ops tvp7002_ops = {
+       .core = &tvp7002_core_ops,
+       .video = &tvp7002_video_ops,
+};
+
+static struct tvp7002 tvp7002_dev = {
+       .streaming = 0,
+
+       .pix = {
+               .width = 1280,
+               .height = 720,
+               .pixelformat = V4L2_PIX_FMT_UYVY,
+               .field = V4L2_FIELD_NONE,
+               .bytesperline = 1280 * 2,
+               .sizeimage = 1280 * 2 * 720,
+               .colorspace = V4L2_COLORSPACE_REC709,
+               },
+
+       .current_preset = tvp7002_presets,
+       .gain = 0,
+};
+
+/*
+ * tvp7002_probe - Probe a TVP7002 device
+ * @sd: ptr to v4l2_subdev struct
+ * @ctrl: ptr to i2c_device_id struct
+ *
+ * Initialize the TVP7002 device
+ * Returns zero when successful, -EINVAL if register read fails or
+ * -EIO if i2c access is not available.
+ */
+static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
+{
+       struct v4l2_subdev *sd;
+       struct tvp7002 *device;
+       struct v4l2_dv_preset preset;
+       int polarity_a;
+       int polarity_b;
+       u8 revision;
+
+       int error;
+
+       /* Check if the adapter supports the needed features */
+       if (!i2c_check_functionality(c->adapter,
+               I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
+               return -EIO;
+
+       if (!c->dev.platform_data) {
+               v4l_err(c, "No platform data!!\n");
+               return -ENODEV;
+       }
+
+       device = kmalloc(sizeof(struct tvp7002), GFP_KERNEL);
+
+       if (!device)
+               return -ENOMEM;
+
+       *device = tvp7002_dev;
+       sd = &device->sd;
+       device->pdata = c->dev.platform_data;
+
+       /* Tell v4l2 the device is ready */
+       v4l2_i2c_subdev_init(sd, c, &tvp7002_ops);
+       v4l_info(c, "tvp7002 found @ 0x%02x (%s)\n",
+                                       c->addr, c->adapter->name);
+
+       error = tvp7002_read(sd, TVP7002_CHIP_REV, &revision);
+       if (error < 0)
+               goto found_error;
+
+       /* Get revision number */
+       v4l2_info(sd, "Rev. %02x detected.\n", revision);
+       if (revision != 0x02)
+               v4l2_info(sd, "Unknown revision detected.\n");
+
+       /* Initializes TVP7002 to its default values */
+       error = tvp7002_write_inittab(sd, tvp7002_init_default);
+
+       if (error < 0)
+               goto found_error;
+
+       /* Set polarity information after registers have been set */
+       polarity_a = 0x20 | device->pdata->hs_polarity << 5
+                       | device->pdata->vs_polarity << 2;
+       error = tvp7002_write(sd, TVP7002_SYNC_CTL_1, polarity_a);
+       if (error < 0)
+               goto found_error;
+
+       polarity_b = 0x01  | device->pdata->fid_polarity << 2
+                       | device->pdata->sog_polarity << 1
+                       | device->pdata->clk_polarity;
+       error = tvp7002_write(sd, TVP7002_MISC_CTL_3, polarity_b);
+       if (error < 0)
+               goto found_error;
+
+       /* Set registers according to default video mode */
+       preset.preset = device->current_preset->preset;
+       error = tvp7002_s_dv_preset(sd, &preset);
+
+found_error:
+       if (error < 0)
+               kfree(device);
+
+       return error;
+}
+
+/*
+ * tvp7002_remove - Remove TVP7002 device support
+ * @c: ptr to i2c_client struct
+ *
+ * Reset the TVP7002 device
+ * Returns zero.
+ */
+static int tvp7002_remove(struct i2c_client *c)
+{
+       struct v4l2_subdev *sd = i2c_get_clientdata(c);
+       struct tvp7002 *device = to_tvp7002(sd);
+
+       v4l2_dbg(1, debug, sd, "Removing tvp7002 adapter"
+                               "on address 0x%x\n", c->addr);
+
+       v4l2_device_unregister_subdev(sd);
+       kfree(device);
+       return 0;
+}
+
+/* I2C Device ID table */
+static const struct i2c_device_id tvp7002_id[] = {
+       { "tvp7002", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, tvp7002_id);
+
+/* I2C driver data */
+static struct i2c_driver tvp7002_driver = {
+       .driver = {
+               .owner = THIS_MODULE,
+               .name = TVP7002_MODULE_NAME,
+       },
+       .probe = tvp7002_probe,
+       .remove = tvp7002_remove,
+       .id_table = tvp7002_id,
+};
+
+/*
+ * tvp7002_init - Initialize driver via I2C interface
+ *
+ * Register the TVP7002 driver.
+ * Return 0 on success or error code on failure.
+ */
+static int __init tvp7002_init(void)
+{
+       return i2c_add_driver(&tvp7002_driver);
+}
+
+/*
+ * tvp7002_exit - Remove driver via I2C interface
+ *
+ * Unregister the TVP7002 driver.
+ * Returns nothing.
+ */
+static void __exit tvp7002_exit(void)
+{
+       i2c_del_driver(&tvp7002_driver);
+}
+
+module_init(tvp7002_init);
+module_exit(tvp7002_exit);
diff --git a/drivers/media/video/tvp7002_reg.h b/drivers/media/video/tvp7002_reg.h
new file mode 100644 (file)
index 0000000..0e34ca9
--- /dev/null
@@ -0,0 +1,150 @@
+/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
+ * Digitizer with Horizontal PLL registers
+ *
+ * Copyright (C) 2009 Texas Instruments Inc
+ * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
+ *
+ * This code is partially based upon the TVP5150 driver
+ * written by Mauro Carvalho Chehab (mchehab@infradead.org),
+ * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
+ * and the TVP7002 driver in the TI LSP 2.10.00.14
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Naming conventions
+ * ------------------
+ *
+ * FDBK:  Feedback
+ * DIV:   Divider
+ * CTL:   Control
+ * SEL:   Select
+ * IN:    Input
+ * OUT:   Output
+ * R:     Red
+ * G:     Green
+ * B:     Blue
+ * OFF:   Offset
+ * THRS:  Threshold
+ * DGTL:  Digital
+ * LVL:   Level
+ * PWR:   Power
+ * MVIS:  Macrovision
+ * W:     Width
+ * H:     Height
+ * ALGN:  Alignment
+ * CLK:   Clocks
+ * TOL:   Tolerance
+ * BWTH:  Bandwidth
+ * COEF:  Coefficient
+ * STAT:  Status
+ * AUTO:  Automatic
+ * FLD:   Field
+ * L:    Line
+ */
+
+#define TVP7002_CHIP_REV               0x00
+#define TVP7002_HPLL_FDBK_DIV_MSBS     0x01
+#define TVP7002_HPLL_FDBK_DIV_LSBS     0x02
+#define TVP7002_HPLL_CRTL              0x03
+#define TVP7002_HPLL_PHASE_SEL         0x04
+#define TVP7002_CLAMP_START            0x05
+#define TVP7002_CLAMP_W                        0x06
+#define TVP7002_HSYNC_OUT_W            0x07
+#define TVP7002_B_FINE_GAIN            0x08
+#define TVP7002_G_FINE_GAIN            0x09
+#define TVP7002_R_FINE_GAIN            0x0a
+#define TVP7002_B_FINE_OFF_MSBS                0x0b
+#define TVP7002_G_FINE_OFF_MSBS         0x0c
+#define TVP7002_R_FINE_OFF_MSBS         0x0d
+#define TVP7002_SYNC_CTL_1             0x0e
+#define TVP7002_HPLL_AND_CLAMP_CTL     0x0f
+#define TVP7002_SYNC_ON_G_THRS         0x10
+#define TVP7002_SYNC_SEPARATOR_THRS    0x11
+#define TVP7002_HPLL_PRE_COAST         0x12
+#define TVP7002_HPLL_POST_COAST                0x13
+#define TVP7002_SYNC_DETECT_STAT       0x14
+#define TVP7002_OUT_FORMATTER          0x15
+#define TVP7002_MISC_CTL_1             0x16
+#define TVP7002_MISC_CTL_2              0x17
+#define TVP7002_MISC_CTL_3              0x18
+#define TVP7002_IN_MUX_SEL_1           0x19
+#define TVP7002_IN_MUX_SEL_2            0x1a
+#define TVP7002_B_AND_G_COARSE_GAIN    0x1b
+#define TVP7002_R_COARSE_GAIN          0x1c
+#define TVP7002_FINE_OFF_LSBS          0x1d
+#define TVP7002_B_COARSE_OFF           0x1e
+#define TVP7002_G_COARSE_OFF            0x1f
+#define TVP7002_R_COARSE_OFF            0x20
+#define TVP7002_HSOUT_OUT_START                0x21
+#define TVP7002_MISC_CTL_4             0x22
+#define TVP7002_B_DGTL_ALC_OUT_LSBS    0x23
+#define TVP7002_G_DGTL_ALC_OUT_LSBS     0x24
+#define TVP7002_R_DGTL_ALC_OUT_LSBS     0x25
+#define TVP7002_AUTO_LVL_CTL_ENABLE    0x26
+#define TVP7002_DGTL_ALC_OUT_MSBS      0x27
+#define TVP7002_AUTO_LVL_CTL_FILTER    0x28
+/* Reserved 0x29*/
+#define TVP7002_FINE_CLAMP_CTL         0x2a
+#define TVP7002_PWR_CTL                        0x2b
+#define TVP7002_ADC_SETUP              0x2c
+#define TVP7002_COARSE_CLAMP_CTL       0x2d
+#define TVP7002_SOG_CLAMP              0x2e
+#define TVP7002_RGB_COARSE_CLAMP_CTL   0x2f
+#define TVP7002_SOG_COARSE_CLAMP_CTL   0x30
+#define TVP7002_ALC_PLACEMENT          0x31
+/* Reserved 0x32 */
+/* Reserved 0x33 */
+#define TVP7002_MVIS_STRIPPER_W                0x34
+#define TVP7002_VSYNC_ALGN             0x35
+#define TVP7002_SYNC_BYPASS            0x36
+#define TVP7002_L_FRAME_STAT_LSBS      0x37
+#define TVP7002_L_FRAME_STAT_MSBS      0x38
+#define TVP7002_CLK_L_STAT_LSBS                0x39
+#define TVP7002_CLK_L_STAT_MSBS        0x3a
+#define TVP7002_HSYNC_W                        0x3b
+#define TVP7002_VSYNC_W                 0x3c
+#define TVP7002_L_LENGTH_TOL           0x3d
+/* Reserved 0x3e */
+#define TVP7002_VIDEO_BWTH_CTL         0x3f
+#define TVP7002_AVID_START_PIXEL_LSBS  0x40
+#define TVP7002_AVID_START_PIXEL_MSBS   0x41
+#define TVP7002_AVID_STOP_PIXEL_LSBS   0x42
+#define TVP7002_AVID_STOP_PIXEL_MSBS    0x43
+#define TVP7002_VBLK_F_0_START_L_OFF   0x44
+#define TVP7002_VBLK_F_1_START_L_OFF    0x45
+#define TVP7002_VBLK_F_0_DURATION      0x46
+#define TVP7002_VBLK_F_1_DURATION       0x47
+#define TVP7002_FBIT_F_0_START_L_OFF   0x48
+#define TVP7002_FBIT_F_1_START_L_OFF    0x49
+#define TVP7002_YUV_Y_G_COEF_LSBS      0x4a
+#define TVP7002_YUV_Y_G_COEF_MSBS       0x4b
+#define TVP7002_YUV_Y_B_COEF_LSBS       0x4c
+#define TVP7002_YUV_Y_B_COEF_MSBS       0x4d
+#define TVP7002_YUV_Y_R_COEF_LSBS       0x4e
+#define TVP7002_YUV_Y_R_COEF_MSBS       0x4f
+#define TVP7002_YUV_U_G_COEF_LSBS       0x50
+#define TVP7002_YUV_U_G_COEF_MSBS       0x51
+#define TVP7002_YUV_U_B_COEF_LSBS       0x52
+#define TVP7002_YUV_U_B_COEF_MSBS       0x53
+#define TVP7002_YUV_U_R_COEF_LSBS       0x54
+#define TVP7002_YUV_U_R_COEF_MSBS       0x55
+#define TVP7002_YUV_V_G_COEF_LSBS       0x56
+#define TVP7002_YUV_V_G_COEF_MSBS       0x57
+#define TVP7002_YUV_V_B_COEF_LSBS       0x58
+#define TVP7002_YUV_V_B_COEF_MSBS       0x59
+#define TVP7002_YUV_V_R_COEF_LSBS       0x5a
+#define TVP7002_YUV_V_R_COEF_MSBS       0x5b
+
index 5b801a6e1eea49fd947729d30e70366d3b4c61fb..76be733eabfd4d3f7b4bc474219a6f0a9c8fb5ea 100644 (file)
@@ -233,10 +233,10 @@ struct tw9910_hsync_ctrl {
 };
 
 struct tw9910_priv {
-       struct v4l2_subdev                subdev;
-       struct tw9910_video_info       *info;
-       const struct tw9910_scale_ctrl *scale;
-       u32                             revision;
+       struct v4l2_subdev              subdev;
+       struct tw9910_video_info        *info;
+       const struct tw9910_scale_ctrl  *scale;
+       u32                             revision;
 };
 
 static const struct tw9910_scale_ctrl tw9910_ntsc_scales[] = {
index 1054546db9080a7445e74b2d3ef23f790fc5372c..7c17ec63c5da1a3bc1f6902e48ded0b64e235ab6 100644 (file)
@@ -1487,7 +1487,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
                usbvision->vbi = usbvision_vdev_init(usbvision,
                                                     &usbvision_vbi_template,
                                                     "USBVision VBI");
-               if (usbvision->vdev == NULL) {
+               if (usbvision->vbi == NULL) {
                        goto err_exit;
                }
                if (video_register_device(usbvision->vbi,
index 0469d7a876a8987e3cd6421a4120eb01e31641f8..3b2e7800d56f9a2f134abcbe29670d7b53b3a189 100644 (file)
 
 #include "uvcvideo.h"
 
-#define UVC_CTRL_NDATA         2
 #define UVC_CTRL_DATA_CURRENT  0
 #define UVC_CTRL_DATA_BACKUP   1
+#define UVC_CTRL_DATA_MIN      2
+#define UVC_CTRL_DATA_MAX      3
+#define UVC_CTRL_DATA_RES      4
+#define UVC_CTRL_DATA_DEF      5
+#define UVC_CTRL_DATA_LAST     6
 
 /* ------------------------------------------------------------------------
  * Controls
@@ -755,6 +759,49 @@ struct uvc_control *uvc_find_control(struct uvc_video_chain *chain,
        return ctrl;
 }
 
+static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,
+       struct uvc_control *ctrl)
+{
+       int ret;
+
+       if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
+               ret = uvc_query_ctrl(chain->dev, UVC_GET_DEF, ctrl->entity->id,
+                                    chain->dev->intfnum, ctrl->info->selector,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_DEF),
+                                    ctrl->info->size);
+               if (ret < 0)
+                       return ret;
+       }
+
+       if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
+               ret = uvc_query_ctrl(chain->dev, UVC_GET_MIN, ctrl->entity->id,
+                                    chain->dev->intfnum, ctrl->info->selector,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MIN),
+                                    ctrl->info->size);
+               if (ret < 0)
+                       return ret;
+       }
+       if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
+               ret = uvc_query_ctrl(chain->dev, UVC_GET_MAX, ctrl->entity->id,
+                                    chain->dev->intfnum, ctrl->info->selector,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MAX),
+                                    ctrl->info->size);
+               if (ret < 0)
+                       return ret;
+       }
+       if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
+               ret = uvc_query_ctrl(chain->dev, UVC_GET_RES, ctrl->entity->id,
+                                    chain->dev->intfnum, ctrl->info->selector,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES),
+                                    ctrl->info->size);
+               if (ret < 0)
+                       return ret;
+       }
+
+       ctrl->cached = 1;
+       return 0;
+}
+
 int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
        struct v4l2_queryctrl *v4l2_ctrl)
 {
@@ -762,17 +809,12 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
        struct uvc_control_mapping *mapping;
        struct uvc_menu_info *menu;
        unsigned int i;
-       __u8 *data;
        int ret;
 
        ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
        if (ctrl == NULL)
                return -EINVAL;
 
-       data = kmalloc(ctrl->info->size, GFP_KERNEL);
-       if (data == NULL)
-               return -ENOMEM;
-
        memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl);
        v4l2_ctrl->id = mapping->id;
        v4l2_ctrl->type = mapping->v4l2_type;
@@ -782,14 +824,15 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
        if (!(ctrl->info->flags & UVC_CONTROL_SET_CUR))
                v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
-       if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
-               ret = uvc_query_ctrl(chain->dev, UVC_GET_DEF, ctrl->entity->id,
-                                    chain->dev->intfnum, ctrl->info->selector,
-                                    data, ctrl->info->size);
+       if (!ctrl->cached) {
+               ret = uvc_ctrl_populate_cache(chain, ctrl);
                if (ret < 0)
-                       goto out;
-               v4l2_ctrl->default_value =
-                       mapping->get(mapping, UVC_GET_DEF, data);
+                       return ret;
+       }
+
+       if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
+               v4l2_ctrl->default_value = mapping->get(mapping, UVC_GET_DEF,
+                               uvc_ctrl_data(ctrl, UVC_CTRL_DATA_DEF));
        }
 
        switch (mapping->v4l2_type) {
@@ -806,56 +849,37 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
                        }
                }
 
-               ret = 0;
-               goto out;
+               return 0;
 
        case V4L2_CTRL_TYPE_BOOLEAN:
                v4l2_ctrl->minimum = 0;
                v4l2_ctrl->maximum = 1;
                v4l2_ctrl->step = 1;
-               ret = 0;
-               goto out;
+               return 0;
 
        case V4L2_CTRL_TYPE_BUTTON:
                v4l2_ctrl->minimum = 0;
                v4l2_ctrl->maximum = 0;
                v4l2_ctrl->step = 0;
-               ret = 0;
-               goto out;
+               return 0;
 
        default:
                break;
        }
 
-       if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
-               ret = uvc_query_ctrl(chain->dev, UVC_GET_MIN, ctrl->entity->id,
-                                    chain->dev->intfnum, ctrl->info->selector,
-                                    data, ctrl->info->size);
-               if (ret < 0)
-                       goto out;
-               v4l2_ctrl->minimum = mapping->get(mapping, UVC_GET_MIN, data);
-       }
-       if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
-               ret = uvc_query_ctrl(chain->dev, UVC_GET_MAX, ctrl->entity->id,
-                                    chain->dev->intfnum, ctrl->info->selector,
-                                    data, ctrl->info->size);
-               if (ret < 0)
-                       goto out;
-               v4l2_ctrl->maximum = mapping->get(mapping, UVC_GET_MAX, data);
-       }
-       if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
-               ret = uvc_query_ctrl(chain->dev, UVC_GET_RES, ctrl->entity->id,
-                                    chain->dev->intfnum, ctrl->info->selector,
-                                    data, ctrl->info->size);
-               if (ret < 0)
-                       goto out;
-               v4l2_ctrl->step = mapping->get(mapping, UVC_GET_RES, data);
-       }
+       if (ctrl->info->flags & UVC_CONTROL_GET_MIN)
+               v4l2_ctrl->minimum = mapping->get(mapping, UVC_GET_MIN,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MIN));
 
-       ret = 0;
-out:
-       kfree(data);
-       return ret;
+       if (ctrl->info->flags & UVC_CONTROL_GET_MAX)
+               v4l2_ctrl->maximum = mapping->get(mapping, UVC_GET_MAX,
+                                    uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MAX));
+
+       if (ctrl->info->flags & UVC_CONTROL_GET_RES)
+               v4l2_ctrl->step = mapping->get(mapping, UVC_GET_RES,
+                                 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
+
+       return 0;
 }
 
 
@@ -997,19 +1021,57 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
 {
        struct uvc_control *ctrl;
        struct uvc_control_mapping *mapping;
-       s32 value = xctrl->value;
+       s32 value;
+       u32 step;
+       s32 min;
+       s32 max;
        int ret;
 
        ctrl = uvc_find_control(chain, xctrl->id, &mapping);
        if (ctrl == NULL || (ctrl->info->flags & UVC_CONTROL_SET_CUR) == 0)
                return -EINVAL;
 
-       if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
-               if (value < 0 || value >= mapping->menu_count)
-                       return -EINVAL;
-               value = mapping->menu_info[value].value;
+       /* Clamp out of range values. */
+       switch (mapping->v4l2_type) {
+       case V4L2_CTRL_TYPE_INTEGER:
+               if (!ctrl->cached) {
+                       ret = uvc_ctrl_populate_cache(chain, ctrl);
+                       if (ret < 0)
+                               return ret;
+               }
+
+               min = mapping->get(mapping, UVC_GET_MIN,
+                                  uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MIN));
+               max = mapping->get(mapping, UVC_GET_MAX,
+                                  uvc_ctrl_data(ctrl, UVC_CTRL_DATA_MAX));
+               step = mapping->get(mapping, UVC_GET_RES,
+                                   uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
+
+               xctrl->value = min + (xctrl->value - min + step/2) / step * step;
+               xctrl->value = clamp(xctrl->value, min, max);
+               value = xctrl->value;
+               break;
+
+       case V4L2_CTRL_TYPE_BOOLEAN:
+               xctrl->value = clamp(xctrl->value, 0, 1);
+               value = xctrl->value;
+               break;
+
+       case V4L2_CTRL_TYPE_MENU:
+               if (xctrl->value < 0 || xctrl->value >= mapping->menu_count)
+                       return -ERANGE;
+               value = mapping->menu_info[xctrl->value].value;
+               break;
+
+       default:
+               value = xctrl->value;
+               break;
        }
 
+       /* If the mapping doesn't span the whole UVC control, the current value
+        * needs to be loaded from the device to perform the read-modify-write
+        * operation.
+        */
        if (!ctrl->loaded && (ctrl->info->size * 8) != mapping->size) {
                if ((ctrl->info->flags & UVC_CONTROL_GET_CUR) == 0) {
                        memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
@@ -1027,6 +1089,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
                ctrl->loaded = 1;
        }
 
+       /* Backup the current value in case we need to rollback later. */
        if (!ctrl->dirty) {
                memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
                       uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
@@ -1080,10 +1143,8 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
        }
 
        if (!found) {
-               uvc_trace(UVC_TRACE_CONTROL,
-                       "Control " UVC_GUID_FORMAT "/%u not found.\n",
-                       UVC_GUID_ARGS(entity->extension.guidExtensionCode),
-                       xctrl->selector);
+               uvc_trace(UVC_TRACE_CONTROL, "Control %pUl/%u not found.\n",
+                       entity->extension.guidExtensionCode, xctrl->selector);
                return -EINVAL;
        }
 
@@ -1159,9 +1220,9 @@ int uvc_ctrl_resume_device(struct uvc_device *dev)
                            (ctrl->info->flags & UVC_CONTROL_RESTORE) == 0)
                                continue;
 
-                       printk(KERN_INFO "restoring control " UVC_GUID_FORMAT
-                               "/%u/%u\n", UVC_GUID_ARGS(ctrl->info->entity),
-                               ctrl->info->index, ctrl->info->selector);
+                       printk(KERN_INFO "restoring control %pUl/%u/%u\n",
+                               ctrl->info->entity, ctrl->info->index,
+                               ctrl->info->selector);
                        ctrl->dirty = 1;
                }
 
@@ -1215,47 +1276,43 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
                ret = uvc_query_ctrl(dev, UVC_GET_LEN, ctrl->entity->id,
                        dev->intfnum, info->selector, (__u8 *)&size, 2);
                if (ret < 0) {
-                       uvc_trace(UVC_TRACE_CONTROL, "GET_LEN failed on "
-                               "control " UVC_GUID_FORMAT "/%u (%d).\n",
-                               UVC_GUID_ARGS(info->entity), info->selector,
-                               ret);
+                       uvc_trace(UVC_TRACE_CONTROL,
+                               "GET_LEN failed on control %pUl/%u (%d).\n",
+                               info->entity, info->selector, ret);
                        return;
                }
 
                if (info->size != le16_to_cpu(size)) {
-                       uvc_trace(UVC_TRACE_CONTROL, "Control " UVC_GUID_FORMAT
-                               "/%u size doesn't match user supplied "
-                               "value.\n", UVC_GUID_ARGS(info->entity),
-                               info->selector);
+                       uvc_trace(UVC_TRACE_CONTROL, "Control %pUl/%u size "
+                               "doesn't match user supplied value.\n",
+                               info->entity, info->selector);
                        return;
                }
 
                ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id,
                        dev->intfnum, info->selector, &inf, 1);
                if (ret < 0) {
-                       uvc_trace(UVC_TRACE_CONTROL, "GET_INFO failed on "
-                               "control " UVC_GUID_FORMAT "/%u (%d).\n",
-                               UVC_GUID_ARGS(info->entity), info->selector,
-                               ret);
+                       uvc_trace(UVC_TRACE_CONTROL,
+                               "GET_INFO failed on control %pUl/%u (%d).\n",
+                               info->entity, info->selector, ret);
                        return;
                }
 
                flags = info->flags;
                if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) ||
                    ((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) {
-                       uvc_trace(UVC_TRACE_CONTROL, "Control "
-                               UVC_GUID_FORMAT "/%u flags don't match "
-                               "supported operations.\n",
-                               UVC_GUID_ARGS(info->entity), info->selector);
+                       uvc_trace(UVC_TRACE_CONTROL, "Control %pUl/%u flags "
+                               "don't match supported operations.\n",
+                               info->entity, info->selector);
                        return;
                }
        }
 
        ctrl->info = info;
-       ctrl->data = kmalloc(ctrl->info->size * UVC_CTRL_NDATA, GFP_KERNEL);
-       uvc_trace(UVC_TRACE_CONTROL, "Added control " UVC_GUID_FORMAT "/%u "
-               "to device %s entity %u\n", UVC_GUID_ARGS(ctrl->info->entity),
-               ctrl->info->selector, dev->udev->devpath, entity->id);
+       ctrl->data = kmalloc(ctrl->info->size * UVC_CTRL_DATA_LAST, GFP_KERNEL);
+       uvc_trace(UVC_TRACE_CONTROL, "Added control %pUl/%u to device %s "
+               "entity %u\n", ctrl->info->entity, ctrl->info->selector,
+               dev->udev->devpath, entity->id);
 }
 
 /*
@@ -1281,17 +1338,16 @@ int uvc_ctrl_add_info(struct uvc_control_info *info)
                        continue;
 
                if (ctrl->selector == info->selector) {
-                       uvc_trace(UVC_TRACE_CONTROL, "Control "
-                               UVC_GUID_FORMAT "/%u is already defined.\n",
-                               UVC_GUID_ARGS(info->entity), info->selector);
+                       uvc_trace(UVC_TRACE_CONTROL,
+                               "Control %pUl/%u is already defined.\n",
+                               info->entity, info->selector);
                        ret = -EEXIST;
                        goto end;
                }
                if (ctrl->index == info->index) {
-                       uvc_trace(UVC_TRACE_CONTROL, "Control "
-                               UVC_GUID_FORMAT "/%u would overwrite index "
-                               "%d.\n", UVC_GUID_ARGS(info->entity),
-                               info->selector, info->index);
+                       uvc_trace(UVC_TRACE_CONTROL,
+                               "Control %pUl/%u would overwrite index %d.\n",
+                               info->entity, info->selector, info->index);
                        ret = -EEXIST;
                        goto end;
                }
@@ -1332,10 +1388,9 @@ int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping)
                        continue;
 
                if (info->size * 8 < mapping->size + mapping->offset) {
-                       uvc_trace(UVC_TRACE_CONTROL, "Mapping '%s' would "
-                               "overflow control " UVC_GUID_FORMAT "/%u\n",
-                               mapping->name, UVC_GUID_ARGS(info->entity),
-                               info->selector);
+                       uvc_trace(UVC_TRACE_CONTROL,
+                               "Mapping '%s' would overflow control %pUl/%u\n",
+                               mapping->name, info->entity, info->selector);
                        ret = -EOVERFLOW;
                        goto end;
                }
@@ -1354,9 +1409,9 @@ int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping)
 
                mapping->ctrl = info;
                list_add_tail(&mapping->list, &info->mappings);
-               uvc_trace(UVC_TRACE_CONTROL, "Adding mapping %s to control "
-                       UVC_GUID_FORMAT "/%u.\n", mapping->name,
-                       UVC_GUID_ARGS(info->entity), info->selector);
+               uvc_trace(UVC_TRACE_CONTROL,
+                       "Adding mapping %s to control %pUl/%u.\n",
+                       mapping->name, info->entity, info->selector);
 
                ret = 0;
                break;
@@ -1378,6 +1433,7 @@ uvc_ctrl_prune_entity(struct uvc_device *dev, struct uvc_entity *entity)
                struct usb_device_id id;
                u8 index;
        } blacklist[] = {
+               { { USB_DEVICE(0x13d3, 0x509b) }, 9 }, /* Gain */
                { { USB_DEVICE(0x1c4f, 0x3000) }, 6 }, /* WB Temperature */
                { { USB_DEVICE(0x5986, 0x0241) }, 2 }, /* Hue */
        };
@@ -1393,7 +1449,7 @@ uvc_ctrl_prune_entity(struct uvc_device *dev, struct uvc_entity *entity)
        size = entity->processing.bControlSize;
 
        for (i = 0; i < ARRAY_SIZE(blacklist); ++i) {
-               if (!usb_match_id(dev->intf, &blacklist[i].id))
+               if (!usb_match_one_id(dev->intf, &blacklist[i].id))
                        continue;
 
                if (blacklist[i].index >= 8 * size ||
index 391cccca7ffcb6f31bb7dca1a13521d1391b2299..a814820a3f6ee8fceb812645274dd88210369d7e 100644 (file)
@@ -43,8 +43,9 @@
 #define DRIVER_VERSION         "v0.1.0"
 #endif
 
+unsigned int uvc_clock_param = CLOCK_MONOTONIC;
 unsigned int uvc_no_drop_param;
-static unsigned int uvc_quirks_param;
+static unsigned int uvc_quirks_param = -1;
 unsigned int uvc_trace_param;
 unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
 
@@ -58,6 +59,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_YUY2,
                .fcc            = V4L2_PIX_FMT_YUYV,
        },
+       {
+               .name           = "YUV 4:2:2 (YUYV)",
+               .guid           = UVC_GUID_FORMAT_YUY2_ISIGHT,
+               .fcc            = V4L2_PIX_FMT_YUYV,
+       },
        {
                .name           = "YUV 4:2:0 (NV12)",
                .guid           = UVC_GUID_FORMAT_NV12,
@@ -309,11 +315,10 @@ static int uvc_parse_format(struct uvc_device *dev,
                                sizeof format->name);
                        format->fcc = fmtdesc->fcc;
                } else {
-                       uvc_printk(KERN_INFO, "Unknown video format "
-                               UVC_GUID_FORMAT "\n",
-                               UVC_GUID_ARGS(&buffer[5]));
-                       snprintf(format->name, sizeof format->name,
-                               UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5]));
+                       uvc_printk(KERN_INFO, "Unknown video format %pUl\n",
+                               &buffer[5]);
+                       snprintf(format->name, sizeof(format->name), "%pUl\n",
+                               &buffer[5]);
                        format->fcc = 0;
                }
 
@@ -1750,7 +1755,8 @@ static int uvc_probe(struct usb_interface *intf,
        dev->udev = usb_get_dev(udev);
        dev->intf = usb_get_intf(intf);
        dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
-       dev->quirks = id->driver_info | uvc_quirks_param;
+       dev->quirks = (uvc_quirks_param == -1)
+                   ? id->driver_info : uvc_quirks_param;
 
        if (udev->product != NULL)
                strlcpy(dev->name, udev->product, sizeof dev->name);
@@ -1773,9 +1779,9 @@ static int uvc_probe(struct usb_interface *intf,
                le16_to_cpu(udev->descriptor.idVendor),
                le16_to_cpu(udev->descriptor.idProduct));
 
-       if (uvc_quirks_param != 0) {
-               uvc_printk(KERN_INFO, "Forcing device quirks 0x%x by module "
-                       "parameter for testing purpose.\n", uvc_quirks_param);
+       if (dev->quirks != id->driver_info) {
+               uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module "
+                       "parameter for testing purpose.\n", dev->quirks);
                uvc_printk(KERN_INFO, "Please report required quirks to the "
                        "linux-uvc-devel mailing list.\n");
        }
@@ -1891,6 +1897,45 @@ static int uvc_reset_resume(struct usb_interface *intf)
        return __uvc_resume(intf, 1);
 }
 
+/* ------------------------------------------------------------------------
+ * Module parameters
+ */
+
+static int uvc_clock_param_get(char *buffer, struct kernel_param *kp)
+{
+       if (uvc_clock_param == CLOCK_MONOTONIC)
+               return sprintf(buffer, "CLOCK_MONOTONIC");
+       else
+               return sprintf(buffer, "CLOCK_REALTIME");
+}
+
+static int uvc_clock_param_set(const char *val, struct kernel_param *kp)
+{
+       if (strncasecmp(val, "clock_", strlen("clock_")) == 0)
+               val += strlen("clock_");
+
+       if (strcasecmp(val, "monotonic") == 0)
+               uvc_clock_param = CLOCK_MONOTONIC;
+       else if (strcasecmp(val, "realtime") == 0)
+               uvc_clock_param = CLOCK_REALTIME;
+       else
+               return -EINVAL;
+
+       return 0;
+}
+
+module_param_call(clock, uvc_clock_param_set, uvc_clock_param_get,
+                 &uvc_clock_param, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(clock, "Video buffers timestamp clock");
+module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames");
+module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(quirks, "Forced device quirks");
+module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(trace, "Trace level bitmask");
+module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
+
 /* ------------------------------------------------------------------------
  * Driver initialization and cleanup
  */
@@ -2197,15 +2242,6 @@ static void __exit uvc_cleanup(void)
 module_init(uvc_init);
 module_exit(uvc_cleanup);
 
-module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames");
-module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(quirks, "Forced device quirks");
-module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(trace, "Trace level bitmask");
-module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
-
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index f854698c40618a4a5225209f1060933f1aafb430..4a925a31b0e0cb5bcaebe6d654dc2eabebd27482 100644 (file)
@@ -59,9 +59,9 @@
  *    returns immediately.
  *
  *    When the buffer is full, the completion handler removes it from the irq
- *    queue, marks it as ready (UVC_BUF_STATE_DONE) and wakes its wait queue.
+ *    queue, marks it as done (UVC_BUF_STATE_DONE) and wakes its wait queue.
  *    At that point, any process waiting on the buffer will be woken up. If a
- *    process tries to dequeue a buffer after it has been marked ready, the
+ *    process tries to dequeue a buffer after it has been marked done, the
  *    dequeing will succeed immediately.
  *
  * 2. Buffers are queued, user is waiting on a buffer and the device gets
@@ -201,6 +201,7 @@ static void __uvc_query_buffer(struct uvc_buffer *buf,
                break;
        case UVC_BUF_STATE_QUEUED:
        case UVC_BUF_STATE_ACTIVE:
+       case UVC_BUF_STATE_READY:
                v4l2_buf->flags |= V4L2_BUF_FLAG_QUEUED;
                break;
        case UVC_BUF_STATE_IDLE:
@@ -295,13 +296,15 @@ static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking)
 {
        if (nonblocking) {
                return (buf->state != UVC_BUF_STATE_QUEUED &&
-                       buf->state != UVC_BUF_STATE_ACTIVE)
+                       buf->state != UVC_BUF_STATE_ACTIVE &&
+                       buf->state != UVC_BUF_STATE_READY)
                        ? 0 : -EAGAIN;
        }
 
        return wait_event_interruptible(buf->wait,
                buf->state != UVC_BUF_STATE_QUEUED &&
-               buf->state != UVC_BUF_STATE_ACTIVE);
+               buf->state != UVC_BUF_STATE_ACTIVE &&
+               buf->state != UVC_BUF_STATE_READY);
 }
 
 /*
@@ -348,6 +351,7 @@ int uvc_dequeue_buffer(struct uvc_video_queue *queue,
        case UVC_BUF_STATE_IDLE:
        case UVC_BUF_STATE_QUEUED:
        case UVC_BUF_STATE_ACTIVE:
+       case UVC_BUF_STATE_READY:
        default:
                uvc_trace(UVC_TRACE_CAPTURE, "[E] Invalid buffer state %u "
                        "(driver bug?).\n", buf->state);
@@ -489,6 +493,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
 
        spin_lock_irqsave(&queue->irqlock, flags);
        list_del(&buf->queue);
+       buf->state = UVC_BUF_STATE_DONE;
        if (!list_empty(&queue->irqqueue))
                nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
                                           queue);
@@ -497,7 +502,6 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
        spin_unlock_irqrestore(&queue->irqlock, flags);
 
        buf->buf.sequence = queue->sequence++;
-       do_gettimeofday(&buf->buf.timestamp);
 
        wake_up(&buf->wait);
        return nextbuf;
index 23239a4adefe092d0ed1a2e026499215613595d5..43152aa522271763ca831edf15671bb6efac3b59 100644 (file)
@@ -539,7 +539,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
                xctrl.id = ctrl->id;
                xctrl.value = ctrl->value;
 
-               uvc_ctrl_begin(chain);
+               ret = uvc_ctrl_begin(chain);
                if (ret < 0)
                        return ret;
 
@@ -549,6 +549,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
                        return ret;
                }
                ret = uvc_ctrl_commit(chain);
+               if (ret == 0)
+                       ctrl->value = xctrl.value;
                break;
        }
 
index 9a9802830d41ea1676f456e335c2e53e8e6fb4cc..6b0666be370fdb6e6cc23398f2939b5865fa828d 100644 (file)
@@ -410,6 +410,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
         * when the EOF bit is set to force synchronisation on the next packet.
         */
        if (buf->state != UVC_BUF_STATE_ACTIVE) {
+               struct timespec ts;
+
                if (fid == stream->last_fid) {
                        uvc_trace(UVC_TRACE_FRAME, "Dropping payload (out of "
                                "sync).\n");
@@ -419,6 +421,14 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
                        return -ENODATA;
                }
 
+               if (uvc_clock_param == CLOCK_MONOTONIC)
+                       ktime_get_ts(&ts);
+               else
+                       ktime_get_real_ts(&ts);
+
+               buf->buf.timestamp.tv_sec = ts.tv_sec;
+               buf->buf.timestamp.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
+
                /* TODO: Handle PTS and SCR. */
                buf->state = UVC_BUF_STATE_ACTIVE;
        }
@@ -441,7 +451,7 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
        if (fid != stream->last_fid && buf->buf.bytesused != 0) {
                uvc_trace(UVC_TRACE_FRAME, "Frame complete (FID bit "
                                "toggled).\n");
-               buf->state = UVC_BUF_STATE_DONE;
+               buf->state = UVC_BUF_STATE_READY;
                return -EAGAIN;
        }
 
@@ -470,7 +480,7 @@ static void uvc_video_decode_data(struct uvc_streaming *stream,
        /* Complete the current frame if the buffer size was exceeded. */
        if (len > maxlen) {
                uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
-               buf->state = UVC_BUF_STATE_DONE;
+               buf->state = UVC_BUF_STATE_READY;
        }
 }
 
@@ -482,7 +492,7 @@ static void uvc_video_decode_end(struct uvc_streaming *stream,
                uvc_trace(UVC_TRACE_FRAME, "Frame complete (EOF found).\n");
                if (data[0] == len)
                        uvc_trace(UVC_TRACE_FRAME, "EOF in empty payload.\n");
-               buf->state = UVC_BUF_STATE_DONE;
+               buf->state = UVC_BUF_STATE_READY;
                if (stream->dev->quirks & UVC_QUIRK_STREAM_NO_FID)
                        stream->last_fid ^= UVC_STREAM_FID;
        }
@@ -568,8 +578,7 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream,
                uvc_video_decode_end(stream, buf, mem,
                        urb->iso_frame_desc[i].actual_length);
 
-               if (buf->state == UVC_BUF_STATE_DONE ||
-                   buf->state == UVC_BUF_STATE_ERROR)
+               if (buf->state == UVC_BUF_STATE_READY)
                        buf = uvc_queue_next_buffer(&stream->queue, buf);
        }
 }
@@ -627,8 +636,7 @@ static void uvc_video_decode_bulk(struct urb *urb, struct uvc_streaming *stream,
                if (!stream->bulk.skip_payload && buf != NULL) {
                        uvc_video_decode_end(stream, buf, stream->bulk.header,
                                stream->bulk.payload_size);
-                       if (buf->state == UVC_BUF_STATE_DONE ||
-                           buf->state == UVC_BUF_STATE_ERROR)
+                       if (buf->state == UVC_BUF_STATE_READY)
                                buf = uvc_queue_next_buffer(&stream->queue,
                                                            buf);
                }
@@ -669,7 +677,7 @@ static void uvc_video_encode_bulk(struct urb *urb, struct uvc_streaming *stream,
            stream->bulk.payload_size == stream->bulk.max_payload_size) {
                if (buf->buf.bytesused == stream->queue.buf_used) {
                        stream->queue.buf_used = 0;
-                       buf->state = UVC_BUF_STATE_DONE;
+                       buf->state = UVC_BUF_STATE_READY;
                        uvc_queue_next_buffer(&stream->queue, buf);
                        stream->last_fid ^= UVC_STREAM_FID;
                }
@@ -924,10 +932,8 @@ static int uvc_init_video_bulk(struct uvc_streaming *stream,
 static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
 {
        struct usb_interface *intf = stream->intf;
-       struct usb_host_interface *alts;
-       struct usb_host_endpoint *ep = NULL;
-       int intfnum = stream->intfnum;
-       unsigned int bandwidth, psize, i;
+       struct usb_host_endpoint *ep;
+       unsigned int i;
        int ret;
 
        stream->last_fid = -1;
@@ -936,6 +942,12 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
        stream->bulk.payload_size = 0;
 
        if (intf->num_altsetting > 1) {
+               struct usb_host_endpoint *best_ep = NULL;
+               unsigned int best_psize = 3 * 1024;
+               unsigned int bandwidth;
+               unsigned int uninitialized_var(altsetting);
+               int intfnum = stream->intfnum;
+
                /* Isochronous endpoint, select the alternate setting. */
                bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
 
@@ -949,6 +961,9 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
                }
 
                for (i = 0; i < intf->num_altsetting; ++i) {
+                       struct usb_host_interface *alts;
+                       unsigned int psize;
+
                        alts = &intf->altsetting[i];
                        ep = uvc_find_endpoint(alts,
                                stream->header.bEndpointAddress);
@@ -958,21 +973,27 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
                        /* Check if the bandwidth is high enough. */
                        psize = le16_to_cpu(ep->desc.wMaxPacketSize);
                        psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
-                       if (psize >= bandwidth)
-                               break;
+                       if (psize >= bandwidth && psize <= best_psize) {
+                               altsetting = i;
+                               best_psize = psize;
+                               best_ep = ep;
+                       }
                }
 
-               if (i >= intf->num_altsetting) {
+               if (best_ep == NULL) {
                        uvc_trace(UVC_TRACE_VIDEO, "No fast enough alt setting "
                                "for requested bandwidth.\n");
                        return -EIO;
                }
 
-               ret = usb_set_interface(stream->dev->udev, intfnum, i);
+               uvc_trace(UVC_TRACE_VIDEO, "Selecting alternate setting %u "
+                       "(%u B/frame bandwidth).\n", altsetting, best_psize);
+
+               ret = usb_set_interface(stream->dev->udev, intfnum, altsetting);
                if (ret < 0)
                        return ret;
 
-               ret = uvc_init_video_isoc(stream, ep, gfp_flags);
+               ret = uvc_init_video_isoc(stream, best_ep, gfp_flags);
        } else {
                /* Bulk endpoint, proceed to URB initialization. */
                ep = uvc_find_endpoint(&intf->altsetting[0],
index 7ec9a04ced5055f0dde006788aa1437be7f6dedd..2bba059259e6ce9b5465490345c3e9f1dc9f0317 100644 (file)
@@ -113,6 +113,9 @@ struct uvc_xu_control {
 #define UVC_GUID_FORMAT_YUY2 \
        { 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_YUY2_ISIGHT \
+       { 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_NV12 \
        { 'N',  'V',  '1',  '2', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
@@ -149,7 +152,7 @@ struct uvc_xu_control {
 #define UVC_MAX_STATUS_SIZE    16
 
 #define UVC_CTRL_CONTROL_TIMEOUT       300
-#define UVC_CTRL_STREAMING_TIMEOUT     3000
+#define UVC_CTRL_STREAMING_TIMEOUT     5000
 
 /* Devices quirks */
 #define UVC_QUIRK_STATUS_INTERVAL      0x00000001
@@ -242,7 +245,8 @@ struct uvc_control {
                           uvc_control_info. */
        __u8 dirty : 1,
             loaded : 1,
-            modified : 1;
+            modified : 1,
+            cached : 1;
 
        __u8 *data;
 };
@@ -365,8 +369,9 @@ enum uvc_buffer_state {
        UVC_BUF_STATE_IDLE      = 0,
        UVC_BUF_STATE_QUEUED    = 1,
        UVC_BUF_STATE_ACTIVE    = 2,
-       UVC_BUF_STATE_DONE      = 3,
-       UVC_BUF_STATE_ERROR     = 4,
+       UVC_BUF_STATE_READY     = 3,
+       UVC_BUF_STATE_DONE      = 4,
+       UVC_BUF_STATE_ERROR     = 5,
 };
 
 struct uvc_buffer {
@@ -532,6 +537,7 @@ struct uvc_driver {
 #define UVC_WARN_MINMAX                0
 #define UVC_WARN_PROBE_DEF     1
 
+extern unsigned int uvc_clock_param;
 extern unsigned int uvc_no_drop_param;
 extern unsigned int uvc_trace_param;
 extern unsigned int uvc_timeout_param;
@@ -551,16 +557,6 @@ extern unsigned int uvc_timeout_param;
 #define uvc_printk(level, msg...) \
        printk(level "uvcvideo: " msg)
 
-#define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" \
-                       "%02x%02x%02x%02x%02x%02x"
-#define UVC_GUID_ARGS(guid) \
-       (guid)[3],  (guid)[2],  (guid)[1],  (guid)[0], \
-       (guid)[5],  (guid)[4], \
-       (guid)[7],  (guid)[6], \
-       (guid)[8],  (guid)[9], \
-       (guid)[10], (guid)[11], (guid)[12], \
-       (guid)[13], (guid)[14], (guid)[15]
-
 /* --------------------------------------------------------------------------
  * Internal functions.
  */
index c4150bd263371484abdb0f094319b1bff5649428..f77f84bfe714be85b4c372cb010a1a37f4213de9 100644 (file)
@@ -288,7 +288,7 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
 
 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
 {
-       if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
+       if (copy_to_user(&up->w, &kp->w, sizeof(kp->w)) ||
                put_user(kp->field, &up->field) ||
                put_user(kp->chromakey, &up->chromakey) ||
                put_user(kp->clipcount, &up->clipcount))
@@ -475,6 +475,9 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
                        return -EFAULT;
        switch (kp->memory) {
        case V4L2_MEMORY_MMAP:
+               if (get_user(kp->length, &up->length) ||
+                       get_user(kp->m.offset, &up->m.offset))
+                       return -EFAULT;
                break;
        case V4L2_MEMORY_USERPTR:
                {
index fa78555b118bddc20948836e3d4fae5bd5a7e91a..fcd045e7a1c1e2ea90ca0ead71766e3e55e7a5b7 100644 (file)
@@ -418,6 +418,8 @@ static void *__videobuf_alloc(size_t size)
        struct videobuf_buffer *vb;
 
        vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
+       if (!vb)
+               return vb;
 
        mem = vb->priv = ((char *)vb)+size;
        mem->magic=MAGIC_SG_MEM;
index d6e6a28fb6b896e349f9396422d5ba67328528ab..136e09383c061ae5a630e6e56b46dc69ad68892c 100644 (file)
@@ -138,6 +138,8 @@ static void *__videobuf_alloc(size_t size)
        struct videobuf_buffer *vb;
 
        vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
+       if (!vb)
+               return vb;
 
        mem = vb->priv = ((char *)vb)+size;
        mem->magic=MAGIC_VMAL_MEM;
index 37632a0649667c8102eabe2567f1fb882d2b7abd..cdbe70385c12aff749d18f955674b0e4274be2a0 100644 (file)
@@ -1371,7 +1371,7 @@ static int __init vivi_create_instance(int inst)
        /* Now that everything is fine, let's add it to device list */
        list_add_tail(&dev->vivi_devlist, &vivi_devlist);
 
-       if (video_nr >= 0)
+       if (video_nr != -1)
                video_nr++;
 
        dev->vfd = vfd;
index edb00293cd590f125fd1eda40e551066be11bac0..a7e610e0be9eae736dba56d66874a54baffc53b9 100644 (file)
@@ -1,7 +1,11 @@
 config USB_ZC0301
-       tristate "USB ZC0301[P] Image Processor and Control Chip support"
+       tristate "USB ZC0301[P] webcam support (DEPRECATED)"
        depends on VIDEO_V4L2
+       default n
        ---help---
+         This driver is DEPRECATED please use the gspca zc3xx module
+         instead.
+
          Say Y here if you want support for cameras based on the ZC0301 or
          ZC0301P Image Processors and Control Chips.
 
index f6c2fb4fc3b4d54ae56fbf30dc56763fee1474f2..e6ad4b205611d41844c05e690cb0ebfd0abb4ad7 100644 (file)
@@ -1196,7 +1196,8 @@ zoran_reap_stat_com (struct zoran *zr)
 static void zoran_restart(struct zoran *zr)
 {
        /* Now the stat_comm buffer is ready for restart */
-       int status = 0, mode;
+       unsigned int status = 0;
+       int mode;
 
        if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
                decoder_call(zr, video, g_input_status, &status);
@@ -1228,7 +1229,7 @@ error_handler (struct zoran *zr,
               u32           astat,
               u32           stat)
 {
-       int i, j;
+       int i;
 
        /* This is JPEG error handling part */
        if (zr->codec_mode != BUZ_MODE_MOTION_COMPRESS &&
@@ -1279,6 +1280,7 @@ error_handler (struct zoran *zr,
        /* Report error */
        if (zr36067_debug > 1 && zr->num_errors <= 8) {
                long frame;
+               int j;
 
                frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
                printk(KERN_ERR
index 2ddffed019eee90d5d501c382c062f149241ff82..ec41303544e561e78817cbbf432dfeb3fe18aabb 100644 (file)
@@ -324,7 +324,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh)
                /* Allocate fragment table for this buffer */
 
                mem = (void *)get_zeroed_page(GFP_KERNEL);
-               if (mem == 0) {
+               if (!mem) {
                        dprintk(1,
                                KERN_ERR
                                "%s: %s - get_zeroed_page (frag_tab) failed for buffer %d\n",
@@ -1444,7 +1444,7 @@ zoran_set_norm (struct zoran *zr,
        }
 
        if (norm == V4L2_STD_ALL) {
-               int status = 0;
+               unsigned int status = 0;
                v4l2_std_id std = 0;
 
                decoder_call(zr, video, querystd, &std);
index f0eae83e3d89950b33dda05bf644e0f396932978..3d4bac2529021e08de42675c8431647a14e85f45 100644 (file)
@@ -78,6 +78,7 @@
 #define METHOD0 0
 #define METHOD1 1
 #define METHOD2 2
+#define METHOD3 3
 
 
 /* Module parameters */
@@ -114,7 +115,7 @@ static struct usb_device_id device_table[] = {
        {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 },
        {USB_DEVICE(0x0a17, 0x004e), .driver_info = METHOD2 },
        {USB_DEVICE(0x041e, 0x405d), .driver_info = METHOD2 },
-       {USB_DEVICE(0x08ca, 0x2102), .driver_info = METHOD2 },
+       {USB_DEVICE(0x08ca, 0x2102), .driver_info = METHOD3 },
        {USB_DEVICE(0x06d6, 0x003d), .driver_info = METHOD0 },
        {}                      /* Terminating entry */
 };
@@ -302,7 +303,7 @@ static message m2[] = {
 };
 
 /* init table */
-static message *init[3] = { m0, m1, m2 };
+static message *init[4] = { m0, m1, m2, m2 };
 
 
 /* JPEG static data in header (Huffman table, etc) */
@@ -967,6 +968,22 @@ static int zr364xx_vidioc_s_fmt_vid_cap(struct file *file, void *priv,
        m0d1[0] = mode;
        m1[2].value = 0xf000 + mode;
        m2[1].value = 0xf000 + mode;
+
+       /* special case for METHOD3, the modes are different */
+       if (cam->method == METHOD3) {
+               switch (mode) {
+               case 1:
+                       m2[1].value = 0xf000 + 4;
+                       break;
+               case 2:
+                       m2[1].value = 0xf000 + 0;
+                       break;
+               default:
+                       m2[1].value = 0xf000 + 1;
+                       break;
+               }
+       }
+
        header2[437] = cam->height / 256;
        header2[438] = cam->height % 256;
        header2[439] = cam->width / 256;
@@ -1582,6 +1599,22 @@ static int zr364xx_probe(struct usb_interface *intf,
        m0d1[0] = mode;
        m1[2].value = 0xf000 + mode;
        m2[1].value = 0xf000 + mode;
+
+       /* special case for METHOD3, the modes are different */
+       if (cam->method == METHOD3) {
+               switch (mode) {
+               case 1:
+                       m2[1].value = 0xf000 + 4;
+                       break;
+               case 2:
+                       m2[1].value = 0xf000 + 0;
+                       break;
+               default:
+                       m2[1].value = 0xf000 + 1;
+                       break;
+               }
+       }
+
        header2[437] = cam->height / 256;
        header2[438] = cam->height % 256;
        header2[439] = cam->width / 256;
index 85bc6a685e36297291e6e677ee818094f7c7020b..5382b5a44affe0a4a4a6551c34c7af17d06ce0c5 100644 (file)
@@ -126,8 +126,6 @@ static int mfcounter = 0;
  *  Public data...
  */
 
-static struct proc_dir_entry *mpt_proc_root_dir;
-
 #define WHOINIT_UNKNOWN                0xAA
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -146,6 +144,9 @@ static MPT_EVHANDLER                 MptEvHandlers[MPT_MAX_PROTOCOL_DRIVERS];
 static MPT_RESETHANDLER                 MptResetHandlers[MPT_MAX_PROTOCOL_DRIVERS];
 static struct mpt_pci_driver   *MptDeviceDriverHandlers[MPT_MAX_PROTOCOL_DRIVERS];
 
+#ifdef CONFIG_PROC_FS
+static struct proc_dir_entry   *mpt_proc_root_dir;
+#endif
 
 /*
  *  Driver Callback Index's
@@ -4330,6 +4331,8 @@ initChainBuffers(MPT_ADAPTER *ioc)
 
        if (ioc->bus_type == SPI)
                num_chain *= MPT_SCSI_CAN_QUEUE;
+       else if (ioc->bus_type == SAS)
+               num_chain *= MPT_SAS_CAN_QUEUE;
        else
                num_chain *= MPT_FC_CAN_QUEUE;
 
index b4948671eb922531877956ca1e4370229a5937d4..9718c8f2e959adb0e338de005b40acef6062d9b2 100644 (file)
@@ -76,8 +76,8 @@
 #define COPYRIGHT      "Copyright (c) 1999-2008 " MODULEAUTHOR
 #endif
 
-#define MPT_LINUX_VERSION_COMMON       "3.04.13"
-#define MPT_LINUX_PACKAGE_NAME         "@(#)mptlinux-3.04.13"
+#define MPT_LINUX_VERSION_COMMON       "3.04.14"
+#define MPT_LINUX_PACKAGE_NAME         "@(#)mptlinux-3.04.14"
 #define WHAT_MAGIC_STRING              "@" "(" "#" ")"
 
 #define show_mptmod_ver(s,ver)  \
index 352acd05c46b93c417596025ebf12be3b423dc01..caa8f568a41c20586612fb601eb6bf6e8b7d6d4d 100644 (file)
@@ -360,8 +360,8 @@ static int mptctl_bus_reset(MPT_ADAPTER *ioc, u8 function)
        u16              iocstatus;
 
        /* bus reset is only good for SCSI IO, RAID PASSTHRU */
-       if (!(function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) ||
-           (function == MPI_FUNCTION_SCSI_IO_REQUEST)) {
+       if (!(function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH ||
+               function == MPI_FUNCTION_SCSI_IO_REQUEST)) {
                dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
                        "TaskMgmt, not SCSI_IO!!\n", ioc->name));
                return -EPERM;
index ebf6ae024da427c9dfe21d1dea70366063a02ec5..612ab3c51a6b7c9e31ff2eaacd460fa87e09a916 100644 (file)
@@ -195,29 +195,34 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
        unsigned long           flags;
        int                     ready;
        MPT_ADAPTER             *ioc;
+       int                     loops = 40;     /* seconds */
 
        hd = shost_priv(SCpnt->device->host);
        ioc = hd->ioc;
        spin_lock_irqsave(shost->host_lock, flags);
-       while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
+       while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY
+        || (loops > 0 && ioc->active == 0)) {
                spin_unlock_irqrestore(shost->host_lock, flags);
                dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
                        "mptfc_block_error_handler.%d: %d:%d, port status is "
-                       "DID_IMM_RETRY, deferring %s recovery.\n",
+                       "%x, active flag %d, deferring %s recovery.\n",
                        ioc->name, ioc->sh->host_no,
-                       SCpnt->device->id, SCpnt->device->lun, caller));
+                       SCpnt->device->id, SCpnt->device->lun,
+                       ready, ioc->active, caller));
                msleep(1000);
                spin_lock_irqsave(shost->host_lock, flags);
+               loops --;
        }
        spin_unlock_irqrestore(shost->host_lock, flags);
 
-       if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
+       if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata
+        || ioc->active == 0) {
                dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
                        "%s.%d: %d:%d, failing recovery, "
-                       "port state %d, vdevice %p.\n", caller,
+                       "port state %x, active %d, vdevice %p.\n", caller,
                        ioc->name, ioc->sh->host_no,
                        SCpnt->device->id, SCpnt->device->lun, ready,
-                       SCpnt->device->hostdata));
+                       ioc->active, SCpnt->device->hostdata));
                return FAILED;
        }
        dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
index 83873e3d0ce73b8d2c729b1851060ba7500c5843..c20bbe45da82d4811d57618cb1144fa8af44f662 100644 (file)
@@ -1075,6 +1075,19 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
        return 0;
 }
 
+static void
+mptsas_block_io_sdev(struct scsi_device *sdev, void *data)
+{
+       scsi_device_set_state(sdev, SDEV_BLOCK);
+}
+
+static void
+mptsas_block_io_starget(struct scsi_target *starget)
+{
+       if (starget)
+               starget_for_each_device(starget, NULL, mptsas_block_io_sdev);
+}
+
 /**
  * mptsas_target_reset_queue
  *
@@ -1098,10 +1111,11 @@ mptsas_target_reset_queue(MPT_ADAPTER *ioc,
        id = sas_event_data->TargetID;
        channel = sas_event_data->Bus;
 
-       if (!(vtarget = mptsas_find_vtarget(ioc, channel, id)))
-               return;
-
-       vtarget->deleted = 1; /* block IO */
+       vtarget = mptsas_find_vtarget(ioc, channel, id);
+       if (vtarget) {
+               mptsas_block_io_starget(vtarget->starget);
+               vtarget->deleted = 1; /* block IO */
+       }
 
        target_reset_list = kzalloc(sizeof(struct mptsas_target_reset_event),
            GFP_ATOMIC);
@@ -1868,7 +1882,8 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        if (ioc->sas_discovery_quiesce_io)
                return SCSI_MLQUEUE_HOST_BUSY;
 
-//     scsi_print_command(SCpnt);
+       if (ioc->debug_level & MPT_DEBUG_SCSI)
+               scsi_print_command(SCpnt);
 
        return mptscsih_qcmd(SCpnt,done);
 }
@@ -2686,6 +2701,187 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
        return error;
 }
 
+struct rep_manu_request{
+       u8 smp_frame_type;
+       u8 function;
+       u8 reserved;
+       u8 request_length;
+};
+
+struct rep_manu_reply{
+       u8 smp_frame_type; /* 0x41 */
+       u8 function; /* 0x01 */
+       u8 function_result;
+       u8 response_length;
+       u16 expander_change_count;
+       u8 reserved0[2];
+       u8 sas_format:1;
+       u8 reserved1:7;
+       u8 reserved2[3];
+       u8 vendor_id[SAS_EXPANDER_VENDOR_ID_LEN];
+       u8 product_id[SAS_EXPANDER_PRODUCT_ID_LEN];
+       u8 product_rev[SAS_EXPANDER_PRODUCT_REV_LEN];
+       u8 component_vendor_id[SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN];
+       u16 component_id;
+       u8 component_revision_id;
+       u8 reserved3;
+       u8 vendor_specific[8];
+};
+
+/**
+  * mptsas_exp_repmanufacture_info -
+  * @ioc: per adapter object
+  * @sas_address: expander sas address
+  * @edev: the sas_expander_device object
+  *
+  * Fills in the sas_expander_device object when SMP port is created.
+  *
+  * Returns 0 for success, non-zero for failure.
+  */
+static int
+mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
+       u64 sas_address, struct sas_expander_device *edev)
+{
+       MPT_FRAME_HDR *mf;
+       SmpPassthroughRequest_t *smpreq;
+       SmpPassthroughReply_t *smprep;
+       struct rep_manu_reply *manufacture_reply;
+       struct rep_manu_request *manufacture_request;
+       int ret;
+       int flagsLength;
+       unsigned long timeleft;
+       char *psge;
+       unsigned long flags;
+       void *data_out = NULL;
+       dma_addr_t data_out_dma = 0;
+       u32 sz;
+
+       spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
+       if (ioc->ioc_reset_in_progress) {
+               spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
+               printk(MYIOC_s_INFO_FMT "%s: host reset in progress!\n",
+                       __func__, ioc->name);
+               return -EFAULT;
+       }
+       spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
+
+       ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
+       if (ret)
+               goto out;
+
+       mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
+       if (!mf) {
+               ret = -ENOMEM;
+               goto out_unlock;
+       }
+
+       smpreq = (SmpPassthroughRequest_t *)mf;
+       memset(smpreq, 0, sizeof(*smpreq));
+
+       sz = sizeof(struct rep_manu_request) + sizeof(struct rep_manu_reply);
+
+       data_out = pci_alloc_consistent(ioc->pcidev, sz, &data_out_dma);
+       if (!data_out) {
+               printk(KERN_ERR "Memory allocation failure at %s:%d/%s()!\n",
+                       __FILE__, __LINE__, __func__);
+               ret = -ENOMEM;
+               goto put_mf;
+       }
+
+       manufacture_request = data_out;
+       manufacture_request->smp_frame_type = 0x40;
+       manufacture_request->function = 1;
+       manufacture_request->reserved = 0;
+       manufacture_request->request_length = 0;
+
+       smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH;
+       smpreq->PhysicalPort = 0xFF;
+       *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address);
+       smpreq->RequestDataLength = sizeof(struct rep_manu_request);
+
+       psge = (char *)
+               (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4));
+
+       flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
+               MPI_SGE_FLAGS_SYSTEM_ADDRESS |
+               MPI_SGE_FLAGS_HOST_TO_IOC |
+               MPI_SGE_FLAGS_END_OF_BUFFER;
+       flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
+       flagsLength |= sizeof(struct rep_manu_request);
+
+       ioc->add_sge(psge, flagsLength, data_out_dma);
+       psge += ioc->SGE_size;
+
+       flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
+               MPI_SGE_FLAGS_SYSTEM_ADDRESS |
+               MPI_SGE_FLAGS_IOC_TO_HOST |
+               MPI_SGE_FLAGS_END_OF_BUFFER;
+       flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
+       flagsLength |= sizeof(struct rep_manu_reply);
+       ioc->add_sge(psge, flagsLength, data_out_dma +
+       sizeof(struct rep_manu_request));
+
+       INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
+       mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
+
+       timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
+       if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
+               ret = -ETIME;
+               mpt_free_msg_frame(ioc, mf);
+               mf = NULL;
+               if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
+                       goto out_free;
+               if (!timeleft)
+                       mpt_HardResetHandler(ioc, CAN_SLEEP);
+               goto out_free;
+       }
+
+       mf = NULL;
+
+       if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
+               u8 *tmp;
+
+       smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
+       if (le16_to_cpu(smprep->ResponseDataLength) !=
+               sizeof(struct rep_manu_reply))
+                       goto out_free;
+
+       manufacture_reply = data_out + sizeof(struct rep_manu_request);
+       strncpy(edev->vendor_id, manufacture_reply->vendor_id,
+               SAS_EXPANDER_VENDOR_ID_LEN);
+       strncpy(edev->product_id, manufacture_reply->product_id,
+               SAS_EXPANDER_PRODUCT_ID_LEN);
+       strncpy(edev->product_rev, manufacture_reply->product_rev,
+               SAS_EXPANDER_PRODUCT_REV_LEN);
+       edev->level = manufacture_reply->sas_format;
+       if (manufacture_reply->sas_format) {
+               strncpy(edev->component_vendor_id,
+                       manufacture_reply->component_vendor_id,
+                               SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN);
+               tmp = (u8 *)&manufacture_reply->component_id;
+               edev->component_id = tmp[0] << 8 | tmp[1];
+               edev->component_revision_id =
+                       manufacture_reply->component_revision_id;
+               }
+       } else {
+               printk(MYIOC_s_ERR_FMT
+                       "%s: smp passthru reply failed to be returned\n",
+                       ioc->name, __func__);
+               ret = -ENXIO;
+       }
+out_free:
+       if (data_out_dma)
+               pci_free_consistent(ioc->pcidev, sz, data_out, data_out_dma);
+put_mf:
+       if (mf)
+               mpt_free_msg_frame(ioc, mf);
+out_unlock:
+       CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
+       mutex_unlock(&ioc->sas_mgmt.mutex);
+out:
+       return ret;
+ }
+
 static void
 mptsas_parse_device_info(struct sas_identify *identify,
                struct mptsas_devinfo *device_info)
@@ -2967,6 +3163,11 @@ static int mptsas_probe_one_phy(struct device *dev,
                        goto out;
                }
                mptsas_set_rphy(ioc, phy_info, rphy);
+               if (identify.device_type == SAS_EDGE_EXPANDER_DEVICE ||
+                       identify.device_type == SAS_FANOUT_EXPANDER_DEVICE)
+                               mptsas_exp_repmanufacture_info(ioc,
+                                       identify.sas_address,
+                                       rphy_to_expander_device(rphy));
        }
 
  out:
index 57752751712bb087127f8ab8ccbe1a38252d8bc5..4a7d1afcb666aabda50adb4f6122a91a9c824713 100644 (file)
@@ -1438,9 +1438,14 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
            && (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)
            && (SCpnt->device->tagged_supported)) {
                scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ;
-       } else {
+               if (SCpnt->request && SCpnt->request->ioprio) {
+                       if (((SCpnt->request->ioprio & 0x7) == 1) ||
+                               !(SCpnt->request->ioprio & 0x7))
+                               scsictl |= MPI_SCSIIO_CONTROL_HEADOFQ;
+               }
+       } else
                scsictl = scsidir | MPI_SCSIIO_CONTROL_UNTAGGED;
-       }
+
 
        /* Use the above information to set up the message frame
         */
@@ -1796,7 +1801,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
                dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: "
                   "Command not in the active list! (sc=%p)\n", ioc->name,
                   SCpnt));
-               retval = 0;
+               retval = SUCCESS;
                goto out;
        }
 
index 87829789243e87ded4653aa8b41da634060a670d..413576a2f313347c745f85ded7e3820a1ad55813 100644 (file)
@@ -348,6 +348,16 @@ config AB4500_CORE
          read/write functions for the devices to get access to this chip.
          This chip embeds various other multimedia funtionalities as well.
 
+config MFD_TIMBERDALE
+       tristate "Support for the Timberdale FPGA"
+       select MFD_CORE
+       depends on PCI && GPIOLIB
+       ---help---
+       This is the core driver for the timberdale FPGA. This device is a
+       multifunction device which exposes numerous platform devices.
+
+       The timberdale FPGA can be found on the Intel Atom development board
+       for in-vehicle infontainment, called Russellville.
 endmenu
 
 menu "Multimedia Capabilities Port drivers"
index ca2f2c4ff05e70e2ac207516f4a215df3401136a..78295d6a75f7fe78f5453a9b89a6e3f2457367e3 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 obj-$(CONFIG_MFD_SM501)                += sm501.o
-obj-$(CONFIG_MFD_ASIC3)                += asic3.o
+obj-$(CONFIG_MFD_ASIC3)                += asic3.o tmio_core.o
 obj-$(CONFIG_MFD_SH_MOBILE_SDHI)               += sh_mobile_sdhi.o
 
 obj-$(CONFIG_HTC_EGPIO)                += htc-egpio.o
@@ -11,9 +11,9 @@ obj-$(CONFIG_HTC_PASIC3)      += htc-pasic3.o
 
 obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
 
-obj-$(CONFIG_MFD_T7L66XB)      += t7l66xb.o
-obj-$(CONFIG_MFD_TC6387XB)     += tc6387xb.o
-obj-$(CONFIG_MFD_TC6393XB)     += tc6393xb.o
+obj-$(CONFIG_MFD_T7L66XB)      += t7l66xb.o tmio_core.o
+obj-$(CONFIG_MFD_TC6387XB)     += tc6387xb.o tmio_core.o
+obj-$(CONFIG_MFD_TC6393XB)     += tc6393xb.o tmio_core.o
 
 obj-$(CONFIG_MFD_WM8400)       += wm8400-core.o
 wm831x-objs                    := wm831x-core.o wm831x-irq.o wm831x-otp.o
@@ -54,5 +54,6 @@ obj-$(CONFIG_PCF50633_GPIO)   += pcf50633-gpio.o
 obj-$(CONFIG_AB3100_CORE)      += ab3100-core.o
 obj-$(CONFIG_AB3100_OTP)       += ab3100-otp.o
 obj-$(CONFIG_AB4500_CORE)      += ab4500-core.o
+obj-$(CONFIG_MFD_TIMBERDALE)    += timberdale.o
 obj-$(CONFIG_MFD_88PM8607)     += 88pm8607.o
-obj-$(CONFIG_PMIC_ADP5520)     += adp5520.o
\ No newline at end of file
+obj-$(CONFIG_PMIC_ADP5520)     += adp5520.o
index e22128c3e9a8a426825337eb5f2aadb5945f6ad2..95c1e6bd1729d84c3e176f3990a95655628f6c17 100644 (file)
@@ -80,6 +80,7 @@ struct asic3 {
        u16 irq_bothedge[4];
        struct gpio_chip gpio;
        struct device *dev;
+       void __iomem *tmio_cnf;
 
        struct asic3_clk clocks[ARRAY_SIZE(asic3_clk_init)];
 };
@@ -685,8 +686,24 @@ static struct mfd_cell asic3_cell_ds1wm = {
        .resources     = ds1wm_resources,
 };
 
+static void asic3_mmc_pwr(struct platform_device *pdev, int state)
+{
+       struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
+
+       tmio_core_mmc_pwr(asic->tmio_cnf, 1 - asic->bus_shift, state);
+}
+
+static void asic3_mmc_clk_div(struct platform_device *pdev, int state)
+{
+       struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
+
+       tmio_core_mmc_clk_div(asic->tmio_cnf, 1 - asic->bus_shift, state);
+}
+
 static struct tmio_mmc_data asic3_mmc_data = {
-       .hclk = 24576000,
+       .hclk           = 24576000,
+       .set_pwr        = asic3_mmc_pwr,
+       .set_clk_div    = asic3_mmc_clk_div,
 };
 
 static struct resource asic3_mmc_resources[] = {
@@ -695,11 +712,6 @@ static struct resource asic3_mmc_resources[] = {
                .end   = ASIC3_SD_CTRL_BASE + 0x3ff,
                .flags = IORESOURCE_MEM,
        },
-       {
-               .start = ASIC3_SD_CONFIG_BASE,
-               .end   = ASIC3_SD_CONFIG_BASE + 0x1ff,
-               .flags = IORESOURCE_MEM,
-       },
        {
                .start = 0,
                .end   = 0,
@@ -743,6 +755,10 @@ static int asic3_mmc_enable(struct platform_device *pdev)
        asic3_set_register(asic, ASIC3_OFFSET(SDHWCTRL, SDCONF),
                           ASIC3_SDHWCTRL_SDPWR, 1);
 
+       /* ASIC3_SD_CTRL_BASE assumes 32-bit addressing, TMIO is 16-bit */
+       tmio_core_mmc_enable(asic->tmio_cnf, 1 - asic->bus_shift,
+                            ASIC3_SD_CTRL_BASE >> 1);
+
        return 0;
 }
 
@@ -797,10 +813,15 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
        asic3_cell_ds1wm.data_size = sizeof(asic3_cell_ds1wm);
 
        /* MMC */
+       asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
+                                mem_sdio->start, 0x400 >> asic->bus_shift);
+       if (!asic->tmio_cnf) {
+               ret = -ENOMEM;
+               dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
+               goto out;
+       }
        asic3_mmc_resources[0].start >>= asic->bus_shift;
        asic3_mmc_resources[0].end   >>= asic->bus_shift;
-       asic3_mmc_resources[1].start >>= asic->bus_shift;
-       asic3_mmc_resources[1].end   >>= asic->bus_shift;
 
        asic3_cell_mmc.platform_data = &asic3_cell_mmc;
        asic3_cell_mmc.data_size = sizeof(asic3_cell_mmc);
@@ -820,7 +841,10 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
 
 static void asic3_mfd_remove(struct platform_device *pdev)
 {
+       struct asic3 *asic = platform_get_drvdata(pdev);
+
        mfd_remove_devices(&pdev->dev);
+       iounmap(asic->tmio_cnf);
 }
 
 /* Core */
index a1ade2324ea903bccfab8a35f75fecaa9428f59e..735c8a4d164f0d503bcb5ddc5c2323dc3b6eae0d 100644 (file)
@@ -619,6 +619,8 @@ err_revision:
        }
        /* This should go away (END) */
 
+       mc13783_unlock(mc13783);
+
        if (pdata->flags & MC13783_USE_ADC)
                mc13783_add_subdevice(mc13783, "mc13783-adc");
 
@@ -641,8 +643,6 @@ err_revision:
        if (pdata->flags & MC13783_USE_TOUCHSCREEN)
                mc13783_add_subdevice(mc13783, "mc13783-ts");
 
-       mc13783_unlock(mc13783);
-
        return 0;
 }
 
index 0a255c1f1ce7b60a3633b487ecaa18797eda43aa..bcf4687d4af5686132c5a155027b595588cf8390 100644 (file)
@@ -38,6 +38,19 @@ enum {
        T7L66XB_CELL_MMC,
 };
 
+static const struct resource t7l66xb_mmc_resources[] = {
+       {
+               .start = 0x800,
+               .end    = 0x9ff,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = IRQ_T7L66XB_MMC,
+               .end    = IRQ_T7L66XB_MMC,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
 #define SCR_REVID      0x08            /* b Revision ID        */
 #define SCR_IMR                0x42            /* b Interrupt Mask     */
 #define SCR_DEV_CTL    0xe0            /* b Device control     */
@@ -83,6 +96,9 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
 
        spin_unlock_irqrestore(&t7l66xb->lock, flags);
 
+       tmio_core_mmc_enable(t7l66xb->scr + 0x200, 0,
+               t7l66xb_mmc_resources[0].start & 0xfffe);
+
        return 0;
 }
 
@@ -106,28 +122,28 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
        return 0;
 }
 
+static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_pwr(t7l66xb->scr + 0x200, 0, state);
+}
+
+static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, 0, state);
+}
+
 /*--------------------------------------------------------------------------*/
 
 static struct tmio_mmc_data t7166xb_mmc_data = {
        .hclk = 24000000,
-};
-
-static const struct resource t7l66xb_mmc_resources[] = {
-       {
-               .start = 0x800,
-               .end    = 0x9ff,
-               .flags = IORESOURCE_MEM,
-       },
-       {
-               .start = 0x200,
-               .end    = 0x2ff,
-               .flags = IORESOURCE_MEM,
-       },
-       {
-               .start = IRQ_T7L66XB_MMC,
-               .end    = IRQ_T7L66XB_MMC,
-               .flags = IORESOURCE_IRQ,
-       },
+       .set_pwr = t7l66xb_mmc_pwr,
+       .set_clk_div = t7l66xb_mmc_clk_div,
 };
 
 static const struct resource t7l66xb_nand_resources[] = {
@@ -282,6 +298,9 @@ static int t7l66xb_resume(struct platform_device *dev)
        if (pdata && pdata->resume)
                pdata->resume(dev);
 
+       tmio_core_mmc_enable(t7l66xb->scr + 0x200, 0,
+               t7l66xb_mmc_resources[0].start & 0xfffe);
+
        return 0;
 }
 #else
index 3280ab33f88ab20944e0ec15018236d73f207f5e..5c7f04343d5c3be1d8ce446d1b2d206df4044915 100644 (file)
@@ -22,28 +22,52 @@ enum {
        TC6387XB_CELL_MMC,
 };
 
+struct tc6387xb {
+       void __iomem *scr;
+       struct clk *clk32k;
+       struct resource rscr;
+};
+
+static struct resource tc6387xb_mmc_resources[] = {
+       {
+               .start = 0x800,
+               .end   = 0x9ff,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = 0,
+               .end   = 0,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+/*--------------------------------------------------------------------------*/
+
 #ifdef CONFIG_PM
 static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state)
 {
-       struct clk *clk32k = platform_get_drvdata(dev);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
        struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
 
        if (pdata && pdata->suspend)
                pdata->suspend(dev);
-       clk_disable(clk32k);
+       clk_disable(tc6387xb->clk32k);
 
        return 0;
 }
 
 static int tc6387xb_resume(struct platform_device *dev)
 {
-       struct clk *clk32k = platform_get_drvdata(dev);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
        struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
 
-       clk_enable(clk32k);
+       clk_enable(tc6387xb->clk32k);
        if (pdata && pdata->resume)
                pdata->resume(dev);
 
+       tmio_core_mmc_resume(tc6387xb->scr + 0x200, 0,
+               tc6387xb_mmc_resources[0].start & 0xfffe);
+
        return 0;
 }
 #else
@@ -53,12 +77,32 @@ static int tc6387xb_resume(struct platform_device *dev)
 
 /*--------------------------------------------------------------------------*/
 
+static void tc6387xb_mmc_pwr(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_pwr(tc6387xb->scr + 0x200, 0, state);
+}
+
+static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_clk_div(tc6387xb->scr + 0x200, 0, state);
+}
+
+
 static int tc6387xb_mmc_enable(struct platform_device *mmc)
 {
        struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-       struct clk *clk32k = platform_get_drvdata(dev);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-       clk_enable(clk32k);
+       clk_enable(tc6387xb->clk32k);
+
+       tmio_core_mmc_enable(tc6387xb->scr + 0x200, 0,
+               tc6387xb_mmc_resources[0].start & 0xfffe);
 
        return 0;
 }
@@ -66,36 +110,20 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
 static int tc6387xb_mmc_disable(struct platform_device *mmc)
 {
        struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-       struct clk *clk32k = platform_get_drvdata(dev);
+       struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-       clk_disable(clk32k);
+       clk_disable(tc6387xb->clk32k);
 
        return 0;
 }
 
-/*--------------------------------------------------------------------------*/
-
 static struct tmio_mmc_data tc6387xb_mmc_data = {
        .hclk = 24000000,
+       .set_pwr = tc6387xb_mmc_pwr,
+       .set_clk_div = tc6387xb_mmc_clk_div,
 };
 
-static struct resource tc6387xb_mmc_resources[] = {
-       {
-               .start = 0x800,
-               .end   = 0x9ff,
-               .flags = IORESOURCE_MEM,
-       },
-       {
-               .start = 0x200,
-               .end   = 0x2ff,
-               .flags = IORESOURCE_MEM,
-       },
-       {
-               .start = 0,
-               .end   = 0,
-               .flags = IORESOURCE_IRQ,
-       },
-};
+/*--------------------------------------------------------------------------*/
 
 static struct mfd_cell tc6387xb_cells[] = {
        [TC6387XB_CELL_MMC] = {
@@ -111,8 +139,9 @@ static struct mfd_cell tc6387xb_cells[] = {
 static int tc6387xb_probe(struct platform_device *dev)
 {
        struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
-       struct resource *iomem;
+       struct resource *iomem, *rscr;
        struct clk *clk32k;
+       struct tc6387xb *tc6387xb;
        int irq, ret;
 
        iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
@@ -120,18 +149,40 @@ static int tc6387xb_probe(struct platform_device *dev)
                return -EINVAL;
        }
 
+       tc6387xb = kzalloc(sizeof *tc6387xb, GFP_KERNEL);
+       if (!tc6387xb)
+               return -ENOMEM;
+
        ret  = platform_get_irq(dev, 0);
        if (ret >= 0)
                irq = ret;
        else
-               goto err_resource;
+               goto err_no_irq;
 
        clk32k = clk_get(&dev->dev, "CLK_CK32K");
        if (IS_ERR(clk32k)) {
                ret = PTR_ERR(clk32k);
+               goto err_no_clk;
+       }
+
+       rscr = &tc6387xb->rscr;
+       rscr->name = "tc6387xb-core";
+       rscr->start = iomem->start;
+       rscr->end = iomem->start + 0xff;
+       rscr->flags = IORESOURCE_MEM;
+
+       ret = request_resource(iomem, rscr);
+       if (ret)
                goto err_resource;
+
+       tc6387xb->scr = ioremap(rscr->start, rscr->end - rscr->start + 1);
+       if (!tc6387xb->scr) {
+               ret = -ENOMEM;
+               goto err_ioremap;
        }
-       platform_set_drvdata(dev, clk32k);
+
+       tc6387xb->clk32k = clk32k;
+       platform_set_drvdata(dev, tc6387xb);
 
        if (pdata && pdata->enable)
                pdata->enable(dev);
@@ -149,8 +200,13 @@ static int tc6387xb_probe(struct platform_device *dev)
        if (!ret)
                return 0;
 
-       clk_put(clk32k);
+err_ioremap:
+       release_resource(&tc6387xb->rscr);
 err_resource:
+       clk_put(clk32k);
+err_no_clk:
+err_no_irq:
+       kfree(tc6387xb);
        return ret;
 }
 
@@ -195,3 +251,4 @@ MODULE_DESCRIPTION("Toshiba TC6387XB core driver");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Ian Molton");
 MODULE_ALIAS("platform:tc6387xb");
+
index 1429a7341a9a976481b2ba11ad29258ba2cc6ac2..4bc5a08a2b09e8421548aaa5a0a99ecfa70370eb 100644 (file)
@@ -136,10 +136,6 @@ static int tc6393xb_nand_enable(struct platform_device *nand)
        return 0;
 }
 
-static struct tmio_mmc_data tc6393xb_mmc_data = {
-       .hclk = 24000000,
-};
-
 static struct resource __devinitdata tc6393xb_nand_resources[] = {
        {
                .start  = 0x1000,
@@ -164,11 +160,6 @@ static struct resource __devinitdata tc6393xb_mmc_resources[] = {
                .end    = 0x9ff,
                .flags  = IORESOURCE_MEM,
        },
-       {
-               .start  = 0x200,
-               .end    = 0x2ff,
-               .flags  = IORESOURCE_MEM,
-       },
        {
                .start  = IRQ_TC6393_MMC,
                .end    = IRQ_TC6393_MMC,
@@ -346,6 +337,50 @@ int tc6393xb_lcd_mode(struct platform_device *fb,
 }
 EXPORT_SYMBOL(tc6393xb_lcd_mode);
 
+static int tc6393xb_mmc_enable(struct platform_device *mmc)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0,
+               tc6393xb_mmc_resources[0].start & 0xfffe);
+
+       return 0;
+}
+
+static int tc6393xb_mmc_resume(struct platform_device *mmc)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0,
+               tc6393xb_mmc_resources[0].start & 0xfffe);
+
+       return 0;
+}
+
+static void tc6393xb_mmc_pwr(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state);
+}
+
+static void tc6393xb_mmc_clk_div(struct platform_device *mmc, int state)
+{
+       struct platform_device *dev = to_platform_device(mmc->dev.parent);
+       struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+
+       tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state);
+}
+
+static struct tmio_mmc_data tc6393xb_mmc_data = {
+       .hclk = 24000000,
+       .set_pwr = tc6393xb_mmc_pwr,
+       .set_clk_div = tc6393xb_mmc_clk_div,
+};
+
 static struct mfd_cell __devinitdata tc6393xb_cells[] = {
        [TC6393XB_CELL_NAND] = {
                .name = "tmio-nand",
@@ -355,6 +390,8 @@ static struct mfd_cell __devinitdata tc6393xb_cells[] = {
        },
        [TC6393XB_CELL_MMC] = {
                .name = "tmio-mmc",
+               .enable = tc6393xb_mmc_enable,
+               .resume = tc6393xb_mmc_resume,
                .driver_data = &tc6393xb_mmc_data,
                .num_resources = ARRAY_SIZE(tc6393xb_mmc_resources),
                .resources = tc6393xb_mmc_resources,
@@ -836,3 +873,4 @@ MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov and Dirk Opfer");
 MODULE_DESCRIPTION("tc6393xb Toshiba Mobile IO Controller");
 MODULE_ALIAS("platform:tc6393xb");
+
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
new file mode 100644 (file)
index 0000000..1ed44d2
--- /dev/null
@@ -0,0 +1,727 @@
+/*
+ * timberdale.c timberdale FPGA MFD driver
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Supports:
+ * Timberdale FPGA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/msi.h>
+#include <linux/mfd/core.h>
+
+#include <linux/timb_gpio.h>
+
+#include <linux/i2c.h>
+#include <linux/i2c-ocores.h>
+#include <linux/i2c/tsc2007.h>
+
+#include <linux/spi/spi.h>
+#include <linux/spi/xilinx_spi.h>
+#include <linux/spi/max7301.h>
+#include <linux/spi/mc33880.h>
+
+#include <media/timb_radio.h>
+
+#include "timberdale.h"
+
+#define DRIVER_NAME "timberdale"
+
+struct timberdale_device {
+       resource_size_t         ctl_mapbase;
+       unsigned char __iomem   *ctl_membase;
+       struct {
+               u32 major;
+               u32 minor;
+               u32 config;
+       } fw;
+};
+
+/*--------------------------------------------------------------------------*/
+
+static struct tsc2007_platform_data timberdale_tsc2007_platform_data = {
+       .model = 2003,
+       .x_plate_ohms = 100
+};
+
+static struct i2c_board_info timberdale_i2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("tsc2007", 0x48),
+               .platform_data = &timberdale_tsc2007_platform_data,
+               .irq = IRQ_TIMBERDALE_TSC_INT
+       },
+};
+
+static __devinitdata struct ocores_i2c_platform_data
+timberdale_ocores_platform_data = {
+       .regstep = 4,
+       .clock_khz = 62500,
+       .devices = timberdale_i2c_board_info,
+       .num_devices = ARRAY_SIZE(timberdale_i2c_board_info)
+};
+
+const static __devinitconst struct resource timberdale_ocores_resources[] = {
+       {
+               .start  = OCORESOFFSET,
+               .end    = OCORESEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_I2C,
+               .end    = IRQ_TIMBERDALE_I2C,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const struct max7301_platform_data timberdale_max7301_platform_data = {
+       .base = 200
+};
+
+const struct mc33880_platform_data timberdale_mc33880_platform_data = {
+       .base = 100
+};
+
+static struct spi_board_info timberdale_spi_16bit_board_info[] = {
+       {
+               .modalias = "max7301",
+               .max_speed_hz = 26000,
+               .chip_select = 2,
+               .mode = SPI_MODE_0,
+               .platform_data = &timberdale_max7301_platform_data
+       },
+};
+
+static struct spi_board_info timberdale_spi_8bit_board_info[] = {
+       {
+               .modalias = "mc33880",
+               .max_speed_hz = 4000,
+               .chip_select = 1,
+               .mode = SPI_MODE_1,
+               .platform_data = &timberdale_mc33880_platform_data
+       },
+};
+
+static __devinitdata struct xspi_platform_data timberdale_xspi_platform_data = {
+       .num_chipselect = 3,
+       .little_endian = true,
+       /* bits per word and devices will be filled in runtime depending
+        * on the HW config
+        */
+};
+
+const static __devinitconst struct resource timberdale_spi_resources[] = {
+       {
+               .start  = SPIOFFSET,
+               .end    = SPIEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_SPI,
+               .end    = IRQ_TIMBERDALE_SPI,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const static __devinitconst struct resource timberdale_eth_resources[] = {
+       {
+               .start  = ETHOFFSET,
+               .end    = ETHEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_ETHSW_IF,
+               .end    = IRQ_TIMBERDALE_ETHSW_IF,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static __devinitdata struct timbgpio_platform_data
+       timberdale_gpio_platform_data = {
+       .gpio_base = 0,
+       .nr_pins = GPIO_NR_PINS,
+       .irq_base = 200,
+};
+
+const static __devinitconst struct resource timberdale_gpio_resources[] = {
+       {
+               .start  = GPIOOFFSET,
+               .end    = GPIOEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_GPIO,
+               .end    = IRQ_TIMBERDALE_GPIO,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const static __devinitconst struct resource timberdale_mlogicore_resources[] = {
+       {
+               .start  = MLCOREOFFSET,
+               .end    = MLCOREEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_MLCORE,
+               .end    = IRQ_TIMBERDALE_MLCORE,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_MLCORE_BUF,
+               .end    = IRQ_TIMBERDALE_MLCORE_BUF,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const static __devinitconst struct resource timberdale_uart_resources[] = {
+       {
+               .start  = UARTOFFSET,
+               .end    = UARTEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_UART,
+               .end    = IRQ_TIMBERDALE_UART,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const static __devinitconst struct resource timberdale_uartlite_resources[] = {
+       {
+               .start  = UARTLITEOFFSET,
+               .end    = UARTLITEEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_UARTLITE,
+               .end    = IRQ_TIMBERDALE_UARTLITE,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+const static __devinitconst struct resource timberdale_radio_resources[] = {
+       {
+               .start  = RDSOFFSET,
+               .end    = RDSEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_RDS,
+               .end    = IRQ_TIMBERDALE_RDS,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static __devinitdata struct i2c_board_info timberdale_tef6868_i2c_board_info = {
+       I2C_BOARD_INFO("tef6862", 0x60)
+};
+
+static __devinitdata struct i2c_board_info timberdale_saa7706_i2c_board_info = {
+       I2C_BOARD_INFO("saa7706h", 0x1C)
+};
+
+static __devinitdata struct timb_radio_platform_data
+       timberdale_radio_platform_data = {
+       .i2c_adapter = 0,
+       .tuner = {
+               .module_name = "tef6862",
+               .info = &timberdale_tef6868_i2c_board_info
+       },
+       .dsp = {
+               .module_name = "saa7706h",
+               .info = &timberdale_saa7706_i2c_board_info
+       }
+};
+
+const static __devinitconst struct resource timberdale_dma_resources[] = {
+       {
+               .start  = DMAOFFSET,
+               .end    = DMAEND,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_DMA,
+               .end    = IRQ_TIMBERDALE_DMA,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg0[] = {
+       {
+               .name = "timb-uart",
+               .num_resources = ARRAY_SIZE(timberdale_uart_resources),
+               .resources = timberdale_uart_resources,
+       },
+       {
+               .name = "timb-gpio",
+               .num_resources = ARRAY_SIZE(timberdale_gpio_resources),
+               .resources = timberdale_gpio_resources,
+               .platform_data = &timberdale_gpio_platform_data,
+               .data_size = sizeof(timberdale_gpio_platform_data),
+       },
+       {
+               .name = "timb-radio",
+               .num_resources = ARRAY_SIZE(timberdale_radio_resources),
+               .resources = timberdale_radio_resources,
+               .platform_data = &timberdale_radio_platform_data,
+               .data_size = sizeof(timberdale_radio_platform_data),
+       },
+       {
+               .name = "xilinx_spi",
+               .num_resources = ARRAY_SIZE(timberdale_spi_resources),
+               .resources = timberdale_spi_resources,
+               .platform_data = &timberdale_xspi_platform_data,
+               .data_size = sizeof(timberdale_xspi_platform_data),
+       },
+       {
+               .name = "ks8842",
+               .num_resources = ARRAY_SIZE(timberdale_eth_resources),
+               .resources = timberdale_eth_resources,
+       },
+       {
+               .name = "timb-dma",
+               .num_resources = ARRAY_SIZE(timberdale_dma_resources),
+               .resources = timberdale_dma_resources,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg1[] = {
+       {
+               .name = "timb-uart",
+               .num_resources = ARRAY_SIZE(timberdale_uart_resources),
+               .resources = timberdale_uart_resources,
+       },
+       {
+               .name = "uartlite",
+               .num_resources = ARRAY_SIZE(timberdale_uartlite_resources),
+               .resources = timberdale_uartlite_resources,
+       },
+       {
+               .name = "timb-gpio",
+               .num_resources = ARRAY_SIZE(timberdale_gpio_resources),
+               .resources = timberdale_gpio_resources,
+               .platform_data = &timberdale_gpio_platform_data,
+               .data_size = sizeof(timberdale_gpio_platform_data),
+       },
+       {
+               .name = "timb-mlogicore",
+               .num_resources = ARRAY_SIZE(timberdale_mlogicore_resources),
+               .resources = timberdale_mlogicore_resources,
+       },
+       {
+               .name = "timb-radio",
+               .num_resources = ARRAY_SIZE(timberdale_radio_resources),
+               .resources = timberdale_radio_resources,
+               .platform_data = &timberdale_radio_platform_data,
+               .data_size = sizeof(timberdale_radio_platform_data),
+       },
+       {
+               .name = "xilinx_spi",
+               .num_resources = ARRAY_SIZE(timberdale_spi_resources),
+               .resources = timberdale_spi_resources,
+               .platform_data = &timberdale_xspi_platform_data,
+               .data_size = sizeof(timberdale_xspi_platform_data),
+       },
+       {
+               .name = "ks8842",
+               .num_resources = ARRAY_SIZE(timberdale_eth_resources),
+               .resources = timberdale_eth_resources,
+       },
+       {
+               .name = "timb-dma",
+               .num_resources = ARRAY_SIZE(timberdale_dma_resources),
+               .resources = timberdale_dma_resources,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg2[] = {
+       {
+               .name = "timb-uart",
+               .num_resources = ARRAY_SIZE(timberdale_uart_resources),
+               .resources = timberdale_uart_resources,
+       },
+       {
+               .name = "timb-gpio",
+               .num_resources = ARRAY_SIZE(timberdale_gpio_resources),
+               .resources = timberdale_gpio_resources,
+               .platform_data = &timberdale_gpio_platform_data,
+               .data_size = sizeof(timberdale_gpio_platform_data),
+       },
+       {
+               .name = "timb-radio",
+               .num_resources = ARRAY_SIZE(timberdale_radio_resources),
+               .resources = timberdale_radio_resources,
+               .platform_data = &timberdale_radio_platform_data,
+               .data_size = sizeof(timberdale_radio_platform_data),
+       },
+       {
+               .name = "xilinx_spi",
+               .num_resources = ARRAY_SIZE(timberdale_spi_resources),
+               .resources = timberdale_spi_resources,
+               .platform_data = &timberdale_xspi_platform_data,
+               .data_size = sizeof(timberdale_xspi_platform_data),
+       },
+       {
+               .name = "timb-dma",
+               .num_resources = ARRAY_SIZE(timberdale_dma_resources),
+               .resources = timberdale_dma_resources,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar0_cfg3[] = {
+       {
+               .name = "timb-uart",
+               .num_resources = ARRAY_SIZE(timberdale_uart_resources),
+               .resources = timberdale_uart_resources,
+       },
+       {
+               .name = "ocores-i2c",
+               .num_resources = ARRAY_SIZE(timberdale_ocores_resources),
+               .resources = timberdale_ocores_resources,
+               .platform_data = &timberdale_ocores_platform_data,
+               .data_size = sizeof(timberdale_ocores_platform_data),
+       },
+       {
+               .name = "timb-gpio",
+               .num_resources = ARRAY_SIZE(timberdale_gpio_resources),
+               .resources = timberdale_gpio_resources,
+               .platform_data = &timberdale_gpio_platform_data,
+               .data_size = sizeof(timberdale_gpio_platform_data),
+       },
+       {
+               .name = "timb-radio",
+               .num_resources = ARRAY_SIZE(timberdale_radio_resources),
+               .resources = timberdale_radio_resources,
+               .platform_data = &timberdale_radio_platform_data,
+               .data_size = sizeof(timberdale_radio_platform_data),
+       },
+       {
+               .name = "xilinx_spi",
+               .num_resources = ARRAY_SIZE(timberdale_spi_resources),
+               .resources = timberdale_spi_resources,
+               .platform_data = &timberdale_xspi_platform_data,
+               .data_size = sizeof(timberdale_xspi_platform_data),
+       },
+       {
+               .name = "ks8842",
+               .num_resources = ARRAY_SIZE(timberdale_eth_resources),
+               .resources = timberdale_eth_resources,
+       },
+       {
+               .name = "timb-dma",
+               .num_resources = ARRAY_SIZE(timberdale_dma_resources),
+               .resources = timberdale_dma_resources,
+       },
+};
+
+static const __devinitconst struct resource timberdale_sdhc_resources[] = {
+       /* located in bar 1 and bar 2 */
+       {
+               .start  = SDHC0OFFSET,
+               .end    = SDHC0END,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = IRQ_TIMBERDALE_SDHC,
+               .end    = IRQ_TIMBERDALE_SDHC,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar1[] = {
+       {
+               .name = "sdhci",
+               .num_resources = ARRAY_SIZE(timberdale_sdhc_resources),
+               .resources = timberdale_sdhc_resources,
+       },
+};
+
+static __devinitdata struct mfd_cell timberdale_cells_bar2[] = {
+       {
+               .name = "sdhci",
+               .num_resources = ARRAY_SIZE(timberdale_sdhc_resources),
+               .resources = timberdale_sdhc_resources,
+       },
+};
+
+static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
+       char *buf)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct timberdale_device *priv = pci_get_drvdata(pdev);
+
+       return sprintf(buf, "%d.%d.%d\n", priv->fw.major, priv->fw.minor,
+               priv->fw.config);
+}
+
+static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
+
+/*--------------------------------------------------------------------------*/
+
+static int __devinit timb_probe(struct pci_dev *dev,
+       const struct pci_device_id *id)
+{
+       struct timberdale_device *priv;
+       int err, i;
+       resource_size_t mapbase;
+       struct msix_entry *msix_entries = NULL;
+       u8 ip_setup;
+
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       pci_set_drvdata(dev, priv);
+
+       err = pci_enable_device(dev);
+       if (err)
+               goto err_enable;
+
+       mapbase = pci_resource_start(dev, 0);
+       if (!mapbase) {
+               dev_err(&dev->dev, "No resource\n");
+               goto err_start;
+       }
+
+       /* create a resource for the PCI master register */
+       priv->ctl_mapbase = mapbase + CHIPCTLOFFSET;
+       if (!request_mem_region(priv->ctl_mapbase, CHIPCTLSIZE, "timb-ctl")) {
+               dev_err(&dev->dev, "Failed to request ctl mem\n");
+               goto err_request;
+       }
+
+       priv->ctl_membase = ioremap(priv->ctl_mapbase, CHIPCTLSIZE);
+       if (!priv->ctl_membase) {
+               dev_err(&dev->dev, "ioremap failed for ctl mem\n");
+               goto err_ioremap;
+       }
+
+       /* read the HW config */
+       priv->fw.major = ioread32(priv->ctl_membase + TIMB_REV_MAJOR);
+       priv->fw.minor = ioread32(priv->ctl_membase + TIMB_REV_MINOR);
+       priv->fw.config = ioread32(priv->ctl_membase + TIMB_HW_CONFIG);
+
+       if (priv->fw.major > TIMB_SUPPORTED_MAJOR) {
+               dev_err(&dev->dev, "The driver supports an older "
+                       "version of the FPGA, please update the driver to "
+                       "support %d.%d\n", priv->fw.major, priv->fw.minor);
+               goto err_ioremap;
+       }
+       if (priv->fw.major < TIMB_SUPPORTED_MAJOR ||
+               priv->fw.minor < TIMB_REQUIRED_MINOR) {
+               dev_err(&dev->dev, "The FPGA image is too old (%d.%d), "
+                       "please upgrade the FPGA to at least: %d.%d\n",
+                       priv->fw.major, priv->fw.minor,
+                       TIMB_SUPPORTED_MAJOR, TIMB_REQUIRED_MINOR);
+               goto err_ioremap;
+       }
+
+       msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries),
+               GFP_KERNEL);
+       if (!msix_entries)
+               goto err_ioremap;
+
+       for (i = 0; i < TIMBERDALE_NR_IRQS; i++)
+               msix_entries[i].entry = i;
+
+       err = pci_enable_msix(dev, msix_entries, TIMBERDALE_NR_IRQS);
+       if (err) {
+               dev_err(&dev->dev,
+                       "MSI-X init failed: %d, expected entries: %d\n",
+                       err, TIMBERDALE_NR_IRQS);
+               goto err_msix;
+       }
+
+       err = device_create_file(&dev->dev, &dev_attr_fw_ver);
+       if (err)
+               goto err_create_file;
+
+       /* Reset all FPGA PLB peripherals */
+       iowrite32(0x1, priv->ctl_membase + TIMB_SW_RST);
+
+       /* update IRQ offsets in I2C board info */
+       for (i = 0; i < ARRAY_SIZE(timberdale_i2c_board_info); i++)
+               timberdale_i2c_board_info[i].irq =
+                       msix_entries[timberdale_i2c_board_info[i].irq].vector;
+
+       /* Update the SPI configuration depending on the HW (8 or 16 bit) */
+       if (priv->fw.config & TIMB_HW_CONFIG_SPI_8BIT) {
+               timberdale_xspi_platform_data.bits_per_word = 8;
+               timberdale_xspi_platform_data.devices =
+                       timberdale_spi_8bit_board_info;
+               timberdale_xspi_platform_data.num_devices =
+                       ARRAY_SIZE(timberdale_spi_8bit_board_info);
+       } else {
+               timberdale_xspi_platform_data.bits_per_word = 16;
+               timberdale_xspi_platform_data.devices =
+                       timberdale_spi_16bit_board_info;
+               timberdale_xspi_platform_data.num_devices =
+                       ARRAY_SIZE(timberdale_spi_16bit_board_info);
+       }
+
+       ip_setup = priv->fw.config & TIMB_HW_VER_MASK;
+       switch (ip_setup) {
+       case TIMB_HW_VER0:
+               err = mfd_add_devices(&dev->dev, -1,
+                       timberdale_cells_bar0_cfg0,
+                       ARRAY_SIZE(timberdale_cells_bar0_cfg0),
+                       &dev->resource[0], msix_entries[0].vector);
+               break;
+       case TIMB_HW_VER1:
+               err = mfd_add_devices(&dev->dev, -1,
+                       timberdale_cells_bar0_cfg1,
+                       ARRAY_SIZE(timberdale_cells_bar0_cfg1),
+                       &dev->resource[0], msix_entries[0].vector);
+               break;
+       case TIMB_HW_VER2:
+               err = mfd_add_devices(&dev->dev, -1,
+                       timberdale_cells_bar0_cfg2,
+                       ARRAY_SIZE(timberdale_cells_bar0_cfg2),
+                       &dev->resource[0], msix_entries[0].vector);
+               break;
+       case TIMB_HW_VER3:
+               err = mfd_add_devices(&dev->dev, -1,
+                       timberdale_cells_bar0_cfg3,
+                       ARRAY_SIZE(timberdale_cells_bar0_cfg3),
+                       &dev->resource[0], msix_entries[0].vector);
+               break;
+       default:
+               dev_err(&dev->dev, "Uknown IP setup: %d.%d.%d\n",
+                       priv->fw.major, priv->fw.minor, ip_setup);
+               err = -ENODEV;
+               goto err_mfd;
+               break;
+       }
+
+       if (err) {
+               dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err);
+               goto err_mfd;
+       }
+
+       err = mfd_add_devices(&dev->dev, 0,
+               timberdale_cells_bar1, ARRAY_SIZE(timberdale_cells_bar1),
+               &dev->resource[1], msix_entries[0].vector);
+       if (err) {
+               dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err);
+               goto err_mfd2;
+       }
+
+       /* only version 0 and 3 have the iNand routed to SDHCI */
+       if (((priv->fw.config & TIMB_HW_VER_MASK) == TIMB_HW_VER0) ||
+               ((priv->fw.config & TIMB_HW_VER_MASK) == TIMB_HW_VER3)) {
+               err = mfd_add_devices(&dev->dev, 1, timberdale_cells_bar2,
+                       ARRAY_SIZE(timberdale_cells_bar2),
+                       &dev->resource[2], msix_entries[0].vector);
+               if (err) {
+                       dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err);
+                       goto err_mfd2;
+               }
+       }
+
+       kfree(msix_entries);
+
+       dev_info(&dev->dev,
+               "Found Timberdale Card. Rev: %d.%d, HW config: 0x%02x\n",
+               priv->fw.major, priv->fw.minor, priv->fw.config);
+
+       return 0;
+
+err_mfd2:
+       mfd_remove_devices(&dev->dev);
+err_mfd:
+       device_remove_file(&dev->dev, &dev_attr_fw_ver);
+err_create_file:
+       pci_disable_msix(dev);
+err_msix:
+       iounmap(priv->ctl_membase);
+err_ioremap:
+       release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE);
+err_request:
+       pci_set_drvdata(dev, NULL);
+err_start:
+       pci_disable_device(dev);
+err_enable:
+       kfree(msix_entries);
+       kfree(priv);
+       pci_set_drvdata(dev, NULL);
+       return -ENODEV;
+}
+
+static void __devexit timb_remove(struct pci_dev *dev)
+{
+       struct timberdale_device *priv = pci_get_drvdata(dev);
+
+       mfd_remove_devices(&dev->dev);
+
+       device_remove_file(&dev->dev, &dev_attr_fw_ver);
+
+       iounmap(priv->ctl_membase);
+       release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE);
+
+       pci_disable_msix(dev);
+       pci_disable_device(dev);
+       pci_set_drvdata(dev, NULL);
+       kfree(priv);
+}
+
+static struct pci_device_id timberdale_pci_tbl[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_TIMB, PCI_DEVICE_ID_TIMB) },
+       { 0 }
+};
+MODULE_DEVICE_TABLE(pci, timberdale_pci_tbl);
+
+static struct pci_driver timberdale_pci_driver = {
+       .name = DRIVER_NAME,
+       .id_table = timberdale_pci_tbl,
+       .probe = timb_probe,
+       .remove = __devexit_p(timb_remove),
+};
+
+static int __init timberdale_init(void)
+{
+       int err;
+
+       err = pci_register_driver(&timberdale_pci_driver);
+       if (err < 0) {
+               printk(KERN_ERR
+                       "Failed to register PCI driver for %s device.\n",
+                       timberdale_pci_driver.name);
+               return -ENODEV;
+       }
+
+       printk(KERN_INFO "Driver for %s has been successfully registered.\n",
+               timberdale_pci_driver.name);
+
+       return 0;
+}
+
+static void __exit timberdale_exit(void)
+{
+       pci_unregister_driver(&timberdale_pci_driver);
+
+       printk(KERN_INFO "Driver for %s has been successfully unregistered.\n",
+               timberdale_pci_driver.name);
+}
+
+module_init(timberdale_init);
+module_exit(timberdale_exit);
+
+MODULE_AUTHOR("Mocean Laboratories <info@mocean-labs.com>");
+MODULE_VERSION(DRV_VERSION);
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/timberdale.h b/drivers/mfd/timberdale.h
new file mode 100644 (file)
index 0000000..8d27ffa
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * timberdale.h timberdale FPGA MFD driver defines
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Supports:
+ * Timberdale FPGA
+ */
+
+#ifndef MFD_TIMBERDALE_H
+#define MFD_TIMBERDALE_H
+
+#define DRV_VERSION            "0.1"
+
+/* This driver only support versions >= 3.8 and < 4.0  */
+#define TIMB_SUPPORTED_MAJOR   3
+
+/* This driver only support minor >= 8 */
+#define TIMB_REQUIRED_MINOR    8
+
+/* Registers of the control area */
+#define TIMB_REV_MAJOR 0x00
+#define TIMB_REV_MINOR 0x04
+#define TIMB_HW_CONFIG 0x08
+#define TIMB_SW_RST    0x40
+
+/* bits in the TIMB_HW_CONFIG register */
+#define TIMB_HW_CONFIG_SPI_8BIT        0x80
+
+#define TIMB_HW_VER_MASK       0x0f
+#define TIMB_HW_VER0           0x00
+#define TIMB_HW_VER1           0x01
+#define TIMB_HW_VER2           0x02
+#define TIMB_HW_VER3           0x03
+
+#define OCORESOFFSET   0x0
+#define OCORESEND      0x1f
+
+#define SPIOFFSET      0x80
+#define SPIEND         0xff
+
+#define UARTLITEOFFSET 0x100
+#define UARTLITEEND    0x10f
+
+#define RDSOFFSET      0x180
+#define RDSEND         0x183
+
+#define ETHOFFSET      0x300
+#define ETHEND         0x3ff
+
+#define GPIOOFFSET     0x400
+#define GPIOEND                0x7ff
+
+#define CHIPCTLOFFSET  0x800
+#define CHIPCTLEND     0x8ff
+#define CHIPCTLSIZE    (CHIPCTLEND - CHIPCTLOFFSET)
+
+#define INTCOFFSET     0xc00
+#define INTCEND                0xfff
+#define INTCSIZE       (INTCEND - INTCOFFSET)
+
+#define MOSTOFFSET     0x1000
+#define MOSTEND                0x13ff
+
+#define UARTOFFSET     0x1400
+#define UARTEND                0x17ff
+
+#define XIICOFFSET     0x1800
+#define XIICEND                0x19ff
+
+#define I2SOFFSET      0x1C00
+#define I2SEND         0x1fff
+
+#define LOGIWOFFSET    0x30000
+#define LOGIWEND       0x37fff
+
+#define MLCOREOFFSET   0x40000
+#define MLCOREEND      0x43fff
+
+#define DMAOFFSET      0x01000000
+#define DMAEND         0x013fffff
+
+/* SDHC0 is placed in PCI bar 1 */
+#define SDHC0OFFSET    0x00
+#define SDHC0END       0xff
+
+/* SDHC1 is placed in PCI bar 2 */
+#define SDHC1OFFSET    0x00
+#define SDHC1END       0xff
+
+#define PCI_VENDOR_ID_TIMB     0x10ee
+#define PCI_DEVICE_ID_TIMB     0xa123
+
+#define IRQ_TIMBERDALE_INIC            0
+#define IRQ_TIMBERDALE_MLB             1
+#define IRQ_TIMBERDALE_GPIO            2
+#define IRQ_TIMBERDALE_I2C             3
+#define IRQ_TIMBERDALE_UART            4
+#define IRQ_TIMBERDALE_DMA             5
+#define IRQ_TIMBERDALE_I2S             6
+#define IRQ_TIMBERDALE_TSC_INT         7
+#define IRQ_TIMBERDALE_SDHC            8
+#define IRQ_TIMBERDALE_ADV7180         9
+#define IRQ_TIMBERDALE_ETHSW_IF                10
+#define IRQ_TIMBERDALE_SPI             11
+#define IRQ_TIMBERDALE_UARTLITE                12
+#define IRQ_TIMBERDALE_MLCORE          13
+#define IRQ_TIMBERDALE_MLCORE_BUF      14
+#define IRQ_TIMBERDALE_RDS             15
+#define TIMBERDALE_NR_IRQS             16
+
+#define GPIO_PIN_ASCB          8
+#define GPIO_PIN_INIC_RST      14
+#define GPIO_PIN_BT_RST                15
+#define GPIO_NR_PINS           16
+
+#endif
diff --git a/drivers/mfd/tmio_core.c b/drivers/mfd/tmio_core.c
new file mode 100644 (file)
index 0000000..eddc19a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright(c) 2009 Ian Molton <spyro@f2s.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mfd/tmio.h>
+
+int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base)
+{
+       /* Enable the MMC/SD Control registers */
+       sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
+       sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
+
+       /* Disable SD power during suspend */
+       sd_config_write8(cnf, shift, CNF_PWR_CTL_3, 0x01);
+
+       /* The below is required but why? FIXME */
+       sd_config_write8(cnf, shift, CNF_STOP_CLK_CTL, 0x1f);
+
+       /* Power down SD bus */
+       sd_config_write8(cnf, shift, CNF_PWR_CTL_2, 0x00);
+
+       return 0;
+}
+EXPORT_SYMBOL(tmio_core_mmc_enable);
+
+int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base)
+{
+
+       /* Enable the MMC/SD Control registers */
+       sd_config_write16(cnf, shift, CNF_CMD, SDCREN);
+       sd_config_write32(cnf, shift, CNF_CTL_BASE, base & 0xfffe);
+
+       return 0;
+}
+EXPORT_SYMBOL(tmio_core_mmc_resume);
+
+void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state)
+{
+       sd_config_write8(cnf, shift, CNF_PWR_CTL_2, state ? 0x02 : 0x00);
+}
+EXPORT_SYMBOL(tmio_core_mmc_pwr);
+
+void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state)
+{
+       sd_config_write8(cnf, shift, CNF_SD_CLK_MODE, state ? 1 : 0);
+}
+EXPORT_SYMBOL(tmio_core_mmc_clk_div);
+
index 8485a70180605d0eea68cb1b1d98872541846c5c..9a970bd6877587f9a40f01736280dd262c7ea32f 100644 (file)
@@ -134,8 +134,7 @@ static inline int is_reg_locked(struct wm8350 *wm8350, u8 reg)
            wm8350->reg_cache[WM8350_SECURITY] == WM8350_UNLOCK_KEY)
                return 0;
 
-       if ((reg == WM8350_GPIO_CONFIGURATION_I_O) ||
-           (reg >= WM8350_GPIO_FUNCTION_SELECT_1 &&
+       if ((reg >= WM8350_GPIO_FUNCTION_SELECT_1 &&
             reg <= WM8350_GPIO_FUNCTION_SELECT_4) ||
            (reg >= WM8350_BATTERY_CHARGER_CONTROL_1 &&
             reg <= WM8350_BATTERY_CHARGER_CONTROL_3))
index c8df547c474703b45d4285cd063bd68ab4c5e636..9025f29e2707403e5986ff2ee29a0f51f57eb811 100644 (file)
@@ -434,7 +434,7 @@ int wm8350_register_irq(struct wm8350 *wm8350, int irq,
                        irq_handler_t handler, unsigned long flags,
                        const char *name, void *data)
 {
-       if (irq < 0 || irq > WM8350_NUM_IRQ || !handler)
+       if (irq < 0 || irq >= WM8350_NUM_IRQ || !handler)
                return -EINVAL;
 
        if (wm8350->irq[irq].handler)
@@ -453,7 +453,7 @@ EXPORT_SYMBOL_GPL(wm8350_register_irq);
 
 int wm8350_free_irq(struct wm8350 *wm8350, int irq)
 {
-       if (irq < 0 || irq > WM8350_NUM_IRQ)
+       if (irq < 0 || irq >= WM8350_NUM_IRQ)
                return -EINVAL;
 
        wm8350_mask_irq(wm8350, irq);
index b9f1e84897cc14fc2cbfa1e12adff95b4b93bb2e..e7f8027165e697b3f2a1ef3926f2ce0b3e2153f1 100644 (file)
@@ -74,6 +74,9 @@ static void mmc_test_prepare_mrq(struct mmc_test_card *test,
        }
 
        mrq->cmd->arg = dev_addr;
+       if (!mmc_card_blockaddr(test->card))
+               mrq->cmd->arg <<= 9;
+
        mrq->cmd->flags = MMC_RSP_R1 | MMC_CMD_ADTC;
 
        if (blocks == 1)
@@ -190,7 +193,7 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
        }
 
        for (i = 0;i < BUFFER_SIZE / 512;i++) {
-               ret = mmc_test_buffer_transfer(test, test->buffer, i * 512, 512, 1);
+               ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
                if (ret)
                        return ret;
        }
@@ -219,7 +222,7 @@ static int mmc_test_cleanup(struct mmc_test_card *test)
        memset(test->buffer, 0, 512);
 
        for (i = 0;i < BUFFER_SIZE / 512;i++) {
-               ret = mmc_test_buffer_transfer(test, test->buffer, i * 512, 512, 1);
+               ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
                if (ret)
                        return ret;
        }
@@ -426,7 +429,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
                for (i = 0;i < sectors;i++) {
                        ret = mmc_test_buffer_transfer(test,
                                test->buffer + i * 512,
-                               dev_addr + i * 512, 512, 0);
+                               dev_addr + i, 512, 0);
                        if (ret)
                                return ret;
                }
index d3f55615c0990e46176a0afd49ed0c55977833ef..57b21198828fbd18ad8ac980b667b7e9dc41b2a6 100644 (file)
@@ -650,11 +650,11 @@ static int au1xmmc_prepare_data(struct au1xmmc_host *host,
                                flags = DDMA_FLAGS_IE;
 
                        if (host->flags & HOST_F_XMIT) {
-                               ret = au1xxx_dbdma_put_source_flags(channel,
-                                       (void *)sg_virt(sg), len, flags);
+                               ret = au1xxx_dbdma_put_source(channel,
+                                       sg_phys(sg), len, flags);
                        } else {
-                               ret = au1xxx_dbdma_put_dest_flags(channel,
-                                       (void *)sg_virt(sg), len, flags);
+                               ret = au1xxx_dbdma_put_dest(channel,
+                                       sg_phys(sg), len, flags);
                        }
 
                        if (!ret)
@@ -1017,6 +1017,10 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev)
        } else
                mmc->caps |= MMC_CAP_NEEDS_POLL;
 
+       /* platform may not be able to use all advertised caps */
+       if (host->platdata)
+               mmc->caps &= ~(host->platdata->mask_host_caps);
+
        tasklet_init(&host->data_task, au1xmmc_tasklet_data,
                        (unsigned long)host);
 
index 7cccc852374772d4d2479e4eb9f681a5bdb74bb5..e22c3fa3516a733d51ab87b83eaf6c728f81a896 100644 (file)
@@ -46,7 +46,9 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
                clk |= 0x100;
        }
 
-       sd_config_write8(host, CNF_SD_CLK_MODE, clk >> 22);
+       if (host->set_clk_div)
+               host->set_clk_div(host->pdev, (clk>>22) & 1);
+
        sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff);
 }
 
@@ -427,12 +429,13 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        /* Power sequence - OFF -> ON -> UP */
        switch (ios->power_mode) {
        case MMC_POWER_OFF: /* power down SD bus */
-               sd_config_write8(host, CNF_PWR_CTL_2, 0x00);
+               if (host->set_pwr)
+                       host->set_pwr(host->pdev, 0);
                tmio_mmc_clk_stop(host);
                break;
        case MMC_POWER_ON: /* power up SD bus */
-
-               sd_config_write8(host, CNF_PWR_CTL_2, 0x02);
+               if (host->set_pwr)
+                       host->set_pwr(host->pdev, 1);
                break;
        case MMC_POWER_UP: /* start bus clock */
                tmio_mmc_clk_start(host);
@@ -485,21 +488,15 @@ static int tmio_mmc_resume(struct platform_device *dev)
 {
        struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
        struct mmc_host *mmc = platform_get_drvdata(dev);
-       struct tmio_mmc_host *host = mmc_priv(mmc);
        int ret = 0;
 
        /* Tell the MFD core we are ready to be enabled */
-       if (cell->enable) {
-               ret = cell->enable(dev);
+       if (cell->resume) {
+               ret = cell->resume(dev);
                if (ret)
                        goto out;
        }
 
-       /* Enable the MMC/SD Control registers */
-       sd_config_write16(host, CNF_CMD, SDCREN);
-       sd_config_write32(host, CNF_CTL_BASE,
-               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
-
        mmc_resume_host(mmc);
 
 out:
@@ -514,17 +511,16 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
 {
        struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data;
        struct tmio_mmc_data *pdata;
-       struct resource *res_ctl, *res_cnf;
+       struct resource *res_ctl;
        struct tmio_mmc_host *host;
        struct mmc_host *mmc;
        int ret = -EINVAL;
 
-       if (dev->num_resources != 3)
+       if (dev->num_resources != 2)
                goto out;
 
        res_ctl = platform_get_resource(dev, IORESOURCE_MEM, 0);
-       res_cnf = platform_get_resource(dev, IORESOURCE_MEM, 1);
-       if (!res_ctl || !res_cnf)
+       if (!res_ctl)
                goto out;
 
        pdata = cell->driver_data;
@@ -539,8 +535,12 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
 
        host = mmc_priv(mmc);
        host->mmc = mmc;
+       host->pdev = dev;
        platform_set_drvdata(dev, mmc);
 
+       host->set_pwr = pdata->set_pwr;
+       host->set_clk_div = pdata->set_clk_div;
+
        /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
        host->bus_shift = resource_size(res_ctl) >> 10;
 
@@ -548,10 +548,6 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
        if (!host->ctl)
                goto host_free;
 
-       host->cnf = ioremap(res_cnf->start, resource_size(res_cnf));
-       if (!host->cnf)
-               goto unmap_ctl;
-
        mmc->ops = &tmio_mmc_ops;
        mmc->caps = MMC_CAP_4_BIT_DATA;
        mmc->f_max = pdata->hclk;
@@ -562,23 +558,9 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
        if (cell->enable) {
                ret = cell->enable(dev);
                if (ret)
-                       goto unmap_cnf;
+                       goto unmap_ctl;
        }
 
-       /* Enable the MMC/SD Control registers */
-       sd_config_write16(host, CNF_CMD, SDCREN);
-       sd_config_write32(host, CNF_CTL_BASE,
-               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
-
-       /* Disable SD power during suspend */
-       sd_config_write8(host, CNF_PWR_CTL_3, 0x01);
-
-       /* The below is required but why? FIXME */
-       sd_config_write8(host, CNF_STOP_CLK_CTL, 0x1f);
-
-       /* Power down SD bus*/
-       sd_config_write8(host, CNF_PWR_CTL_2, 0x00);
-
        tmio_mmc_clk_stop(host);
        reset(host);
 
@@ -586,14 +568,14 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
        if (ret >= 0)
                host->irq = ret;
        else
-               goto unmap_cnf;
+               goto unmap_ctl;
 
        disable_mmc_irqs(host, TMIO_MASK_ALL);
 
        ret = request_irq(host->irq, tmio_mmc_irq, IRQF_DISABLED |
                IRQF_TRIGGER_FALLING, dev_name(&dev->dev), host);
        if (ret)
-               goto unmap_cnf;
+               goto unmap_ctl;
 
        mmc_add_host(mmc);
 
@@ -605,8 +587,6 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
 
        return 0;
 
-unmap_cnf:
-       iounmap(host->cnf);
 unmap_ctl:
        iounmap(host->ctl);
 host_free:
@@ -626,7 +606,6 @@ static int __devexit tmio_mmc_remove(struct platform_device *dev)
                mmc_remove_host(mmc);
                free_irq(host->irq, host);
                iounmap(host->ctl);
-               iounmap(host->cnf);
                mmc_free_host(mmc);
        }
 
index 9fa9985949743be7920eccb0a1627036ea8dcc37..692dc23363b9f7718c6f3ff9bb42033fd8251867 100644 (file)
 
 #include <linux/highmem.h>
 
-#define CNF_CMD     0x04
-#define CNF_CTL_BASE   0x10
-#define CNF_INT_PIN  0x3d
-#define CNF_STOP_CLK_CTL 0x40
-#define CNF_GCLK_CTL 0x41
-#define CNF_SD_CLK_MODE 0x42
-#define CNF_PIN_STATUS 0x44
-#define CNF_PWR_CTL_1 0x48
-#define CNF_PWR_CTL_2 0x49
-#define CNF_PWR_CTL_3 0x4a
-#define CNF_CARD_DETECT_MODE 0x4c
-#define CNF_SD_SLOT 0x50
-#define CNF_EXT_GCLK_CTL_1 0xf0
-#define CNF_EXT_GCLK_CTL_2 0xf1
-#define CNF_EXT_GCLK_CTL_3 0xf9
-#define CNF_SD_LED_EN_1 0xfa
-#define CNF_SD_LED_EN_2 0xfe
-
-#define   SDCREN 0x2   /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/
-
 #define CTL_SD_CMD 0x00
 #define CTL_ARG_REG 0x04
 #define CTL_STOP_INTERNAL_ACTION 0x08
 
 
 struct tmio_mmc_host {
-       void __iomem *cnf;
        void __iomem *ctl;
        unsigned long bus_shift;
        struct mmc_command      *cmd;
@@ -119,10 +98,16 @@ struct tmio_mmc_host {
        struct mmc_host         *mmc;
        int                     irq;
 
+       /* Callbacks for clock / power control */
+       void (*set_pwr)(struct platform_device *host, int state);
+       void (*set_clk_div)(struct platform_device *host, int state);
+
        /* pio related stuff */
        struct scatterlist      *sg_ptr;
        unsigned int            sg_len;
        unsigned int            sg_off;
+
+       struct platform_device *pdev;
 };
 
 #include <linux/io.h>
@@ -163,25 +148,6 @@ static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr,
        writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
 }
 
-static inline void sd_config_write8(struct tmio_mmc_host *host, int addr,
-               u8 val)
-{
-       writeb(val, host->cnf + (addr << host->bus_shift));
-}
-
-static inline void sd_config_write16(struct tmio_mmc_host *host, int addr,
-               u16 val)
-{
-       writew(val, host->cnf + (addr << host->bus_shift));
-}
-
-static inline void sd_config_write32(struct tmio_mmc_host *host, int addr,
-               u32 val)
-{
-       writew(val, host->cnf + (addr << host->bus_shift));
-       writew(val >> 16, host->cnf + ((addr + 2) << host->bus_shift));
-}
-
 #include <linux/scatterlist.h>
 #include <linux/blkdev.h>
 
index 4c364d44ad59e34f4fdc02c89a2551b016bb4c23..2bb03a8b9ef10c84e39b1067fb91f8fdb3de910c 100644 (file)
@@ -251,12 +251,6 @@ config MTD_NETtel
        help
          Support for flash chips on NETtel/SecureEdge/SnapGear boards.
 
-config MTD_ALCHEMY
-       tristate "AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support"
-       depends on SOC_AU1X00 && MTD_PARTITIONS && MTD_CFI
-       help
-         Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
-
 config MTD_DILNETPC
        tristate "CFI Flash device mapped on DIL/Net PC"
        depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN
@@ -549,4 +543,21 @@ config MTD_VMU
          To build this as a module select M here, the module will be called
          vmu-flash.
 
+config MTD_PISMO
+       tristate "MTD discovery driver for PISMO modules"
+       depends on I2C
+       depends on ARCH_VERSATILE
+       help
+         This driver allows for discovery of PISMO modules - see
+         <http://www.pismoworld.org/>.  These are small modules containing
+         up to five memory devices (eg, SRAM, flash, DOC) described by an
+         I2C EEPROM.
+
+         This driver does not create any MTD maps itself; instead it
+         creates MTD physmap and MTD SRAM platform devices.  If you
+         enable this option, you should consider enabling MTD_PHYSMAP
+         and/or MTD_PLATRAM according to the devices on your module.
+
+         When built as a module, it will be called pismo.ko
+
 endmenu
index ce315214ff2ba4a4bbec44b46ef9a25b6afabdc2..a44919f3f3d2d2381aafb669fb0b38058f7aee86 100644 (file)
@@ -40,7 +40,6 @@ obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
 obj-$(CONFIG_MTD_DBOX2)                += dbox2-flash.o
 obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
 obj-$(CONFIG_MTD_PCI)          += pci.o
-obj-$(CONFIG_MTD_ALCHEMY)       += alchemy-flash.o
 obj-$(CONFIG_MTD_AUTCPU12)     += autcpu12-nvram.o
 obj-$(CONFIG_MTD_EDB7312)      += edb7312.o
 obj-$(CONFIG_MTD_IMPA7)                += impa7.o
diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c
deleted file mode 100644 (file)
index 845ad4f..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Flash memory access on AMD Alchemy evaluation boards
- *
- * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/io.h>
-
-#ifdef CONFIG_MIPS_PB1000
-#define BOARD_MAP_NAME "Pb1000 Flash"
-#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_PB1500
-#define BOARD_MAP_NAME "Pb1500 Flash"
-#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_PB1100
-#define BOARD_MAP_NAME "Pb1100 Flash"
-#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_PB1550
-#define BOARD_MAP_NAME "Pb1550 Flash"
-#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_PB1200
-#define BOARD_MAP_NAME "Pb1200 Flash"
-#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
-#define BOARD_FLASH_WIDTH 2 /* 16-bits */
-#endif
-
-#ifdef CONFIG_MIPS_DB1000
-#define BOARD_MAP_NAME "Db1000 Flash"
-#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_DB1500
-#define BOARD_MAP_NAME "Db1500 Flash"
-#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_DB1100
-#define BOARD_MAP_NAME "Db1100 Flash"
-#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_DB1550
-#define BOARD_MAP_NAME "Db1550 Flash"
-#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#endif
-
-#ifdef CONFIG_MIPS_DB1200
-#define BOARD_MAP_NAME "Db1200 Flash"
-#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
-#define BOARD_FLASH_WIDTH 2 /* 16-bits */
-#endif
-
-#ifdef CONFIG_MIPS_BOSPORUS
-#define BOARD_MAP_NAME "Bosporus Flash"
-#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
-#define BOARD_FLASH_WIDTH 2 /* 16-bits */
-#endif
-
-#ifdef CONFIG_MIPS_MIRAGE
-#define BOARD_MAP_NAME "Mirage Flash"
-#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
-#define BOARD_FLASH_WIDTH 4 /* 32-bits */
-#define USE_LOCAL_ACCESSORS /* why? */
-#endif
-
-static struct map_info alchemy_map = {
-       .name = BOARD_MAP_NAME,
-};
-
-static struct mtd_partition alchemy_partitions[] = {
-        {
-                .name = "User FS",
-                .size = BOARD_FLASH_SIZE - 0x00400000,
-                .offset = 0x0000000
-        },{
-                .name = "YAMON",
-                .size = 0x0100000,
-               .offset = MTDPART_OFS_APPEND,
-                .mask_flags = MTD_WRITEABLE
-        },{
-                .name = "raw kernel",
-               .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
-               .offset = MTDPART_OFS_APPEND,
-        }
-};
-
-static struct mtd_info *mymtd;
-
-static int __init alchemy_mtd_init(void)
-{
-       struct mtd_partition *parts;
-       int nb_parts = 0;
-       unsigned long window_addr;
-       unsigned long window_size;
-
-       /* Default flash buswidth */
-       alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
-
-       window_addr = 0x20000000 - BOARD_FLASH_SIZE;
-       window_size = BOARD_FLASH_SIZE;
-
-       /*
-        * Static partition definition selection
-        */
-       parts = alchemy_partitions;
-       nb_parts = ARRAY_SIZE(alchemy_partitions);
-       alchemy_map.size = window_size;
-
-       /*
-        * Now let's probe for the actual flash.  Do it here since
-        * specific machine settings might have been set above.
-        */
-       printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
-                       alchemy_map.bankwidth*8);
-       alchemy_map.virt = ioremap(window_addr, window_size);
-       mymtd = do_map_probe("cfi_probe", &alchemy_map);
-       if (!mymtd) {
-               iounmap(alchemy_map.virt);
-               return -ENXIO;
-       }
-       mymtd->owner = THIS_MODULE;
-
-       add_mtd_partitions(mymtd, parts, nb_parts);
-       return 0;
-}
-
-static void __exit alchemy_mtd_cleanup(void)
-{
-       if (mymtd) {
-               del_mtd_partitions(mymtd);
-               map_destroy(mymtd);
-               iounmap(alchemy_map.virt);
-       }
-}
-
-module_init(alchemy_mtd_init);
-module_exit(alchemy_mtd_cleanup);
-
-MODULE_AUTHOR("Embedded Alley Solutions, Inc");
-MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
new file mode 100644 (file)
index 0000000..c48cad2
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+ * PISMO memory driver - http://www.pismoworld.org/
+ *
+ * For ARM Realview and Versatile platforms
+ *
+ * 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.
+ */
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
+#include <linux/mtd/physmap.h>
+#include <linux/mtd/plat-ram.h>
+#include <linux/mtd/pismo.h>
+
+#define PISMO_NUM_CS   5
+
+struct pismo_cs_block {
+       u8      type;
+       u8      width;
+       __le16  access;
+       __le32  size;
+       u32     reserved[2];
+       char    device[32];
+} __packed;
+
+struct pismo_eeprom {
+       struct pismo_cs_block cs[PISMO_NUM_CS];
+       char    board[15];
+       u8      sum;
+} __packed;
+
+struct pismo_mem {
+       phys_addr_t base;
+       u32     size;
+       u16     access;
+       u8      width;
+       u8      type;
+};
+
+struct pismo_data {
+       struct i2c_client       *client;
+       void                    (*vpp)(void *, int);
+       void                    *vpp_data;
+       struct platform_device  *dev[PISMO_NUM_CS];
+};
+
+/* FIXME: set_vpp could do with a better calling convention */
+static struct pismo_data *vpp_pismo;
+static DEFINE_MUTEX(pismo_mutex);
+
+static int pismo_setvpp_probe_fix(struct pismo_data *pismo)
+{
+       mutex_lock(&pismo_mutex);
+       if (vpp_pismo) {
+               mutex_unlock(&pismo_mutex);
+               kfree(pismo);
+               return -EBUSY;
+       }
+       vpp_pismo = pismo;
+       mutex_unlock(&pismo_mutex);
+       return 0;
+}
+
+static void pismo_setvpp_remove_fix(struct pismo_data *pismo)
+{
+       mutex_lock(&pismo_mutex);
+       if (vpp_pismo == pismo)
+               vpp_pismo = NULL;
+       mutex_unlock(&pismo_mutex);
+}
+
+static void pismo_set_vpp(struct map_info *map, int on)
+{
+       struct pismo_data *pismo = vpp_pismo;
+
+       pismo->vpp(pismo->vpp_data, on);
+}
+/* end of hack */
+
+
+static unsigned int __devinit pismo_width_to_bytes(unsigned int width)
+{
+       width &= 15;
+       if (width > 2)
+               return 0;
+       return 1 << width;
+}
+
+static int __devinit pismo_eeprom_read(struct i2c_client *client, void *buf,
+       u8 addr, size_t size)
+{
+       int ret;
+       struct i2c_msg msg[] = {
+               {
+                       .addr = client->addr,
+                       .len = sizeof(addr),
+                       .buf = &addr,
+               }, {
+                       .addr = client->addr,
+                       .flags = I2C_M_RD,
+                       .len = size,
+                       .buf = buf,
+               },
+       };
+
+       ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
+
+       return ret == ARRAY_SIZE(msg) ? size : -EIO;
+}
+
+static int __devinit pismo_add_device(struct pismo_data *pismo, int i,
+       struct pismo_mem *region, const char *name, void *pdata, size_t psize)
+{
+       struct platform_device *dev;
+       struct resource res = { };
+       phys_addr_t base = region.base;
+       int ret;
+
+       if (base == ~0)
+               return -ENXIO;
+
+       res.start = base;
+       res.end = base + region->size - 1;
+       res.flags = IORESOURCE_MEM;
+
+       dev = platform_device_alloc(name, i);
+       if (!dev)
+               return -ENOMEM;
+       dev->dev.parent = &pismo->client->dev;
+
+       do {
+               ret = platform_device_add_resources(dev, &res, 1);
+               if (ret)
+                       break;
+
+               ret = platform_device_add_data(dev, pdata, psize);
+               if (ret)
+                       break;
+
+               ret = platform_device_add(dev);
+               if (ret)
+                       break;
+
+               pismo->dev[i] = dev;
+               return 0;
+       } while (0);
+
+       platform_device_put(dev);
+       return ret;
+}
+
+static int __devinit pismo_add_nor(struct pismo_data *pismo, int i,
+       struct pismo_mem *region)
+{
+       struct physmap_flash_data data = {
+               .width = region->width,
+       };
+
+       if (pismo->vpp)
+               data.set_vpp = pismo_set_vpp;
+
+       return pismo_add_device(pismo, i, region, "physmap-flash",
+               &data, sizeof(data));
+}
+
+static int __devinit pismo_add_sram(struct pismo_data *pismo, int i,
+       struct pismo_mem *region)
+{
+       struct platdata_mtd_ram data = {
+               .bankwidth = region->width,
+       };
+
+       return pismo_add_device(pismo, i, region, "mtd-ram",
+               &data, sizeof(data));
+}
+
+static void __devinit pismo_add_one(struct pismo_data *pismo, int i,
+       const struct pismo_cs_block *cs, phys_addr_t base)
+{
+       struct device *dev = &pismo->client->dev;
+       struct pismo_mem region;
+
+       region.base = base;
+       region.type = cs->type;
+       region.width = pismo_width_to_bytes(cs->width);
+       region.access = le16_to_cpu(cs->access);
+       region.size = le32_to_cpu(cs->size);
+
+       if (region.width == 0) {
+               dev_err(dev, "cs%u: bad width: %02x, ignoring\n", i, cs->width);
+               return;
+       }
+
+       /*
+        * FIXME: may need to the platforms memory controller here, but at
+        * the moment we assume that it has already been correctly setup.
+        * The memory controller can also tell us the base address as well.
+        */
+
+       dev_info(dev, "cs%u: %.32s: type %02x access %u00ps size %uK\n",
+               i, cs->device, region.type, region.access, region.size / 1024);
+
+       switch (region.type) {
+       case 0:
+               break;
+       case 1:
+               /* static DOC */
+               break;
+       case 2:
+               /* static NOR */
+               pismo_add_nor(pismo, i, &region);
+               break;
+       case 3:
+               /* static RAM */
+               pismo_add_sram(pismo, i, &region);
+               break;
+       }
+}
+
+static int __devexit pismo_remove(struct i2c_client *client)
+{
+       struct pismo_data *pismo = i2c_get_clientdata(client);
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(pismo->dev); i++)
+               platform_device_unregister(pismo->dev[i]);
+
+       /* FIXME: set_vpp needs saner arguments */
+       pismo_setvpp_remove_fix(pismo);
+
+       kfree(pismo);
+
+       return 0;
+}
+
+static int __devinit pismo_probe(struct i2c_client *client,
+                                const struct i2c_device_id *id)
+{
+       struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+       struct pismo_pdata *pdata = client->dev.platform_data;
+       struct pismo_eeprom eeprom;
+       struct pismo_data *pismo;
+       int ret, i;
+
+       if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
+               dev_err(&client->dev, "functionality mismatch\n");
+               return -EIO;
+       }
+
+       pismo = kzalloc(sizeof(*pismo), GFP_KERNEL);
+       if (!pismo)
+               return -ENOMEM;
+
+       /* FIXME: set_vpp needs saner arguments */
+       ret = pismo_setvpp_probe_fix(pismo);
+       if (ret)
+               return ret;
+
+       pismo->client = client;
+       if (pdata) {
+               pismo->vpp = pdata->set_vpp;
+               pismo->vpp_data = pdata->vpp_data;
+       }
+       i2c_set_clientdata(client, pismo);
+
+       ret = pismo_eeprom_read(client, &eeprom, 0, sizeof(eeprom));
+       if (ret < 0) {
+               dev_err(&client->dev, "error reading EEPROM: %d\n", ret);
+               return ret;
+       }
+
+       dev_info(&client->dev, "%.15s board found\n", eeprom.board);
+
+       for (i = 0; i < ARRAY_SIZE(eeprom.cs); i++)
+               if (eeprom.cs[i].type != 0xff)
+                       pismo_add_one(pismo, i, &eeprom.cs[i],
+                                     pdata->cs_addrs[i]);
+
+       return 0;
+}
+
+static const struct i2c_device_id pismo_id[] = {
+       { "pismo" },
+       { },
+};
+MODULE_DEVICE_TABLE(i2c, pismo_id);
+
+static struct i2c_driver pismo_driver = {
+       .driver = {
+               .name   = "pismo",
+               .owner  = THIS_MODULE,
+       },
+       .probe          = pismo_probe,
+       .remove         = __devexit_p(pismo_remove),
+       .id_table       = pismo_id,
+};
+
+static int __init pismo_init(void)
+{
+       BUILD_BUG_ON(sizeof(struct pismo_cs_block) != 48);
+       BUILD_BUG_ON(sizeof(struct pismo_eeprom) != 256);
+
+       return i2c_add_driver(&pismo_driver);
+}
+module_init(pismo_init);
+
+static void __exit pismo_exit(void)
+{
+       i2c_del_driver(&pismo_driver);
+}
+module_exit(pismo_exit);
+
+MODULE_AUTHOR("Russell King <linux@arm.linux.org.uk>");
+MODULE_DESCRIPTION("PISMO memory driver");
+MODULE_LICENSE("GPL");
index a714ec482761fbba566379e31b6b8b3a147c5d78..92e12df0917f38ef59a4943fe7aa0dedbb46ecee 100644 (file)
@@ -322,7 +322,7 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper,
        memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
 
        /* Panics must be written immediately */
-       if (reason == KMSG_DUMP_PANIC) {
+       if (reason != KMSG_DUMP_OOPS) {
                if (!cxt->mtd->panic_write)
                        printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
                else
index 677cd53f18c3416c489a11b3934c42b16c14a49a..bb6465604235cda354d566c21dcfbbb24a70c80b 100644 (file)
@@ -457,10 +457,10 @@ config MTD_NAND_NOMADIK
 
 config MTD_NAND_SH_FLCTL
        tristate "Support for NAND on Renesas SuperH FLCTL"
-       depends on MTD_NAND && SUPERH && CPU_SUBTYPE_SH7723
+       depends on MTD_NAND && SUPERH
        help
          Several Renesas SuperH CPU has FLCTL. This option enables support
-         for NAND Flash using FLCTL. This driver support SH7723.
+         for NAND Flash using FLCTL.
 
 config MTD_NAND_DAVINCI
         tristate "Support NAND on DaVinci SoC"
index 92c334ff450885a8d06179ac14a4276c3805b933..43d46e424040c2bc25e6e48481c9d902d14d912e 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/io.h>
 
 #include <asm/mach-au1x00/au1xxx.h>
+#include <asm/mach-db1x00/bcsr.h>
 
 /*
  * MTD structure for NAND controller
@@ -475,7 +476,8 @@ static int __init au1xxx_nand_init(void)
        /* set gpio206 high */
        au_writel(au_readl(GPIO2_DIR) & ~(1 << 6), GPIO2_DIR);
 
-       boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | ((bcsr->status >> 6) & 0x1);
+       boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | ((bcsr_read(BCSR_STATUS) >> 6) & 0x1);
+
        switch (boot_swapboot) {
        case 0:
        case 2:
index 02bef21f2e4b987099a8f1f8d856c7364cbf9a58..1842df8bdd934fcec9955f445984af556ebf13bb 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * SuperH FLCTL nand controller
  *
- * Copyright Â© 2008 Renesas Solutions Corp.
- * Copyright Â© 2008 Atom Create Engineering Co., Ltd.
+ * Copyright (c) 2008 Renesas Solutions Corp.
+ * Copyright (c) 2008 Atom Create Engineering Co., Ltd.
  *
- * Based on fsl_elbc_nand.c, Copyright Â© 2006-2007 Freescale Semiconductor
+ * Based on fsl_elbc_nand.c, Copyright (c) 2006-2007 Freescale Semiconductor
  *
  * 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
@@ -75,6 +75,11 @@ static void start_translation(struct sh_flctl *flctl)
        writeb(TRSTRT, FLTRCR(flctl));
 }
 
+static void timeout_error(struct sh_flctl *flctl, const char *str)
+{
+       dev_err(&flctl->pdev->dev, "Timeout occured in %s\n", str);
+}
+
 static void wait_completion(struct sh_flctl *flctl)
 {
        uint32_t timeout = LOOP_TIMEOUT_MAX;
@@ -87,7 +92,7 @@ static void wait_completion(struct sh_flctl *flctl)
                udelay(1);
        }
 
-       printk(KERN_ERR "wait_completion(): Timeout occured \n");
+       timeout_error(flctl, __func__);
        writeb(0x0, FLTRCR(flctl));
 }
 
@@ -100,6 +105,8 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr)
                addr = page_addr;       /* ERASE1 */
        } else if (page_addr != -1) {
                /* SEQIN, READ0, etc.. */
+               if (flctl->chip.options & NAND_BUSWIDTH_16)
+                       column >>= 1;
                if (flctl->page_size) {
                        addr = column & 0x0FFF;
                        addr |= (page_addr & 0xff) << 16;
@@ -132,7 +139,7 @@ static void wait_rfifo_ready(struct sh_flctl *flctl)
                        return;
                udelay(1);
        }
-       printk(KERN_ERR "wait_rfifo_ready(): Timeout occured \n");
+       timeout_error(flctl, __func__);
 }
 
 static void wait_wfifo_ready(struct sh_flctl *flctl)
@@ -146,7 +153,7 @@ static void wait_wfifo_ready(struct sh_flctl *flctl)
                        return;
                udelay(1);
        }
-       printk(KERN_ERR "wait_wfifo_ready(): Timeout occured \n");
+       timeout_error(flctl, __func__);
 }
 
 static int wait_recfifo_ready(struct sh_flctl *flctl, int sector_number)
@@ -198,7 +205,7 @@ static int wait_recfifo_ready(struct sh_flctl *flctl, int sector_number)
                writel(0, FL4ECCCR(flctl));
        }
 
-       printk(KERN_ERR "wait_recfifo_ready(): Timeout occured \n");
+       timeout_error(flctl, __func__);
        return 1;       /* timeout */
 }
 
@@ -214,7 +221,7 @@ static void wait_wecfifo_ready(struct sh_flctl *flctl)
                        return;
                udelay(1);
        }
-       printk(KERN_ERR "wait_wecfifo_ready(): Timeout occured \n");
+       timeout_error(flctl, __func__);
 }
 
 static void read_datareg(struct sh_flctl *flctl, int offset)
@@ -275,7 +282,7 @@ static void write_fiforeg(struct sh_flctl *flctl, int rlen, int offset)
 static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_val)
 {
        struct sh_flctl *flctl = mtd_to_flctl(mtd);
-       uint32_t flcmncr_val = readl(FLCMNCR(flctl));
+       uint32_t flcmncr_val = readl(FLCMNCR(flctl)) & ~SEL_16BIT;
        uint32_t flcmdcr_val, addr_len_bytes = 0;
 
        /* Set SNAND bit if page size is 2048byte */
@@ -297,6 +304,8 @@ static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_va
        case NAND_CMD_READOOB:
                addr_len_bytes = flctl->rw_ADRCNT;
                flcmdcr_val |= CDSRC_E;
+               if (flctl->chip.options & NAND_BUSWIDTH_16)
+                       flcmncr_val |= SEL_16BIT;
                break;
        case NAND_CMD_SEQIN:
                /* This case is that cmd is READ0 or READ1 or READ00 */
@@ -305,6 +314,8 @@ static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_va
        case NAND_CMD_PAGEPROG:
                addr_len_bytes = flctl->rw_ADRCNT;
                flcmdcr_val |= DOCMD2_E | CDSRC_E | SELRW;
+               if (flctl->chip.options & NAND_BUSWIDTH_16)
+                       flcmncr_val |= SEL_16BIT;
                break;
        case NAND_CMD_READID:
                flcmncr_val &= ~SNAND_E;
@@ -523,6 +534,8 @@ static void flctl_cmdfunc(struct mtd_info *mtd, unsigned int command,
                set_addr(mtd, 0, page_addr);
 
                flctl->read_bytes = mtd->writesize + mtd->oobsize;
+               if (flctl->chip.options & NAND_BUSWIDTH_16)
+                       column >>= 1;
                flctl->index += column;
                goto read_normal_exit;
 
@@ -686,6 +699,18 @@ static uint8_t flctl_read_byte(struct mtd_info *mtd)
        return data;
 }
 
+static uint16_t flctl_read_word(struct mtd_info *mtd)
+{
+       struct sh_flctl *flctl = mtd_to_flctl(mtd);
+       int index = flctl->index;
+       uint16_t data;
+       uint16_t *buf = (uint16_t *)&flctl->done_buff[index];
+
+       data = *buf;
+       flctl->index += 2;
+       return data;
+}
+
 static void flctl_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 {
        int i;
@@ -769,38 +794,36 @@ static int flctl_chip_init_tail(struct mtd_info *mtd)
        return 0;
 }
 
-static int __init flctl_probe(struct platform_device *pdev)
+static int __devinit flctl_probe(struct platform_device *pdev)
 {
        struct resource *res;
        struct sh_flctl *flctl;
        struct mtd_info *flctl_mtd;
        struct nand_chip *nand;
        struct sh_flctl_platform_data *pdata;
-       int ret;
+       int ret = -ENXIO;
 
        pdata = pdev->dev.platform_data;
        if (pdata == NULL) {
-               printk(KERN_ERR "sh_flctl platform_data not found.\n");
-               return -ENODEV;
+               dev_err(&pdev->dev, "no platform data defined\n");
+               return -EINVAL;
        }
 
        flctl = kzalloc(sizeof(struct sh_flctl), GFP_KERNEL);
        if (!flctl) {
-               printk(KERN_ERR "Unable to allocate NAND MTD dev structure.\n");
+               dev_err(&pdev->dev, "failed to allocate driver data\n");
                return -ENOMEM;
        }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res) {
-               printk(KERN_ERR "%s: resource not found.\n", __func__);
-               ret = -ENODEV;
+               dev_err(&pdev->dev, "failed to get I/O memory\n");
                goto err;
        }
 
-       flctl->reg = ioremap(res->start, res->end - res->start + 1);
+       flctl->reg = ioremap(res->start, resource_size(res));
        if (flctl->reg == NULL) {
-               printk(KERN_ERR "%s: ioremap error.\n", __func__);
-               ret = -ENOMEM;
+               dev_err(&pdev->dev, "failed to remap I/O memory\n");
                goto err;
        }
 
@@ -808,6 +831,7 @@ static int __init flctl_probe(struct platform_device *pdev)
        flctl_mtd = &flctl->mtd;
        nand = &flctl->chip;
        flctl_mtd->priv = nand;
+       flctl->pdev = pdev;
        flctl->hwecc = pdata->has_hwecc;
 
        flctl_register_init(flctl, pdata->flcmncr_val);
@@ -825,6 +849,11 @@ static int __init flctl_probe(struct platform_device *pdev)
        nand->select_chip = flctl_select_chip;
        nand->cmdfunc = flctl_cmdfunc;
 
+       if (pdata->flcmncr_val & SEL_16BIT) {
+               nand->options |= NAND_BUSWIDTH_16;
+               nand->read_word = flctl_read_word;
+       }
+
        ret = nand_scan_ident(flctl_mtd, 1);
        if (ret)
                goto err;
@@ -846,7 +875,7 @@ err:
        return ret;
 }
 
-static int __exit flctl_remove(struct platform_device *pdev)
+static int __devexit flctl_remove(struct platform_device *pdev)
 {
        struct sh_flctl *flctl = platform_get_drvdata(pdev);
 
index 79fc4530987b0fe49fda701d567569e7c44b9d85..25c5dd03a8373c93a692578ffb1a0724dcd2b33e 100644 (file)
@@ -147,6 +147,10 @@ static int scan_for_bad_eraseblocks(void)
        }
        memset(bbt, 0 , ebcnt);
 
+       /* NOR flash does not implement block_isbad */
+       if (mtd->block_isbad == NULL)
+               return 0;
+
        printk(PRINT_PREF "scanning for bad eraseblocks\n");
        for (i = 0; i < ebcnt; ++i) {
                bbt[i] = is_block_bad(i) ? 1 : 0;
@@ -184,7 +188,7 @@ static int __init mtd_readtest_init(void)
        tmp = mtd->size;
        do_div(tmp, mtd->erasesize);
        ebcnt = tmp;
-       pgcnt = mtd->erasesize / mtd->writesize;
+       pgcnt = mtd->erasesize / pgsize;
 
        printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
               "page size %u, count of eraseblocks %u, pages per "
index 141363a7e805f91976a2bc9db8030674baece709..7fbb51d4eabec7897811265d0fba5ee0e2ee1369 100644 (file)
@@ -301,6 +301,10 @@ static int scan_for_bad_eraseblocks(void)
        }
        memset(bbt, 0 , ebcnt);
 
+       /* NOR flash does not implement block_isbad */
+       if (mtd->block_isbad == NULL)
+               goto out;
+
        printk(PRINT_PREF "scanning for bad eraseblocks\n");
        for (i = 0; i < ebcnt; ++i) {
                bbt[i] = is_block_bad(i) ? 1 : 0;
@@ -309,6 +313,7 @@ static int scan_for_bad_eraseblocks(void)
                cond_resched();
        }
        printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad);
+out:
        goodebcnt = ebcnt - bad;
        return 0;
 }
@@ -340,7 +345,7 @@ static int __init mtd_speedtest_init(void)
        tmp = mtd->size;
        do_div(tmp, mtd->erasesize);
        ebcnt = tmp;
-       pgcnt = mtd->erasesize / mtd->writesize;
+       pgcnt = mtd->erasesize / pgsize;
 
        printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
               "page size %u, count of eraseblocks %u, pages per "
index 63920476b57a24c7e61563303eb3abb773b73fdf..a99d3cd737d82caf30ffcce266bebdd56fa9e0f5 100644 (file)
@@ -227,6 +227,10 @@ static int scan_for_bad_eraseblocks(void)
        }
        memset(bbt, 0 , ebcnt);
 
+       /* NOR flash does not implement block_isbad */
+       if (mtd->block_isbad == NULL)
+               return 0;
+
        printk(PRINT_PREF "scanning for bad eraseblocks\n");
        for (i = 0; i < ebcnt; ++i) {
                bbt[i] = is_block_bad(i) ? 1 : 0;
@@ -265,7 +269,7 @@ static int __init mtd_stresstest_init(void)
        tmp = mtd->size;
        do_div(tmp, mtd->erasesize);
        ebcnt = tmp;
-       pgcnt = mtd->erasesize / mtd->writesize;
+       pgcnt = mtd->erasesize / pgsize;
 
        printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
               "page size %u, count of eraseblocks %u, pages per "
index f237ddbb271307f8252c3582506b1f32b4c13f98..111ea41c4ecd7aa956be1f21c26d775dc68270e4 100644 (file)
@@ -853,7 +853,6 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
                        break;
                }
 
-               req.name[req.name_len] = '\0';
                err = verify_mkvol_req(ubi, &req);
                if (err)
                        break;
index 277786ebaa2cc39ff7b1e669cbc4b2927014803c..1361574e2b00157bb2ab98fcc1be6254b1e002f9 100644 (file)
@@ -291,8 +291,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
  */
 struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
 {
-       int error, ubi_num, vol_id;
-       struct ubi_volume_desc *ret;
+       int error, ubi_num, vol_id, mod;
        struct inode *inode;
        struct path path;
 
@@ -306,16 +305,16 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
                return ERR_PTR(error);
 
        inode = path.dentry->d_inode;
+       mod = inode->i_mode;
        ubi_num = ubi_major2num(imajor(inode));
        vol_id = iminor(inode) - 1;
+       path_put(&path);
 
+       if (!S_ISCHR(mod))
+               return ERR_PTR(-EINVAL);
        if (vol_id >= 0 && ubi_num >= 0)
-               ret = ubi_open_volume(ubi_num, vol_id, mode);
-       else
-               ret = ERR_PTR(-ENODEV);
-
-       path_put(&path);
-       return ret;
+               return ubi_open_volume(ubi_num, vol_id, mode);
+       return ERR_PTR(-ENODEV);
 }
 EXPORT_SYMBOL_GPL(ubi_open_volume_path);
 
index c1d7b880c7953969a282969637b69f052a8454ed..425bf5a3edd4778b0dc2e3bcc6a47f0f5e1cca18 100644 (file)
@@ -155,6 +155,7 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
                if (err)
                        return err;
                vol->updating = 0;
+               return 0;
        }
 
        vol->upd_buf = vmalloc(ubi->leb_size);
index 1afc61e7455dbfc1f4e78dceb4d0991e630e86b6..40044028d6824e217a6e5f5cbe9e1ea232a291f8 100644 (file)
@@ -566,6 +566,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
                vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
                vol->alignment = be32_to_cpu(vtbl[i].alignment);
                vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
+               vol->upd_marker = vtbl[i].upd_marker;
                vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
                                        UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
                vol->name_len = be16_to_cpu(vtbl[i].name_len);
index 6bac04603a88eed1b8eb7776639ace7a35c068d9..6e5a68ecde0919a5af3f6e208ac8441295518aad 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/delay.h>
 #include <linux/crc32.h>
 #include <linux/phy.h>
+#include <linux/platform_device.h>
 
 #include <asm/cpu.h>
 #include <asm/mipsregs.h>
@@ -63,6 +64,7 @@
 #include <asm/processor.h>
 
 #include <au1000.h>
+#include <au1xxx_eth.h>
 #include <prom.h>
 
 #include "au1000_eth.h"
@@ -112,15 +114,15 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
  *
  * PHY detection algorithm
  *
- * If AU1XXX_PHY_STATIC_CONFIG is undefined, the PHY setup is
+ * If phy_static_config is undefined, the PHY setup is
  * autodetected:
  *
  * mii_probe() first searches the current MAC's MII bus for a PHY,
- * selecting the first (or last, if AU1XXX_PHY_SEARCH_HIGHEST_ADDR is
+ * selecting the first (or last, if phy_search_highest_addr is
  * defined) PHY address not already claimed by another netdev.
  *
  * If nothing was found that way when searching for the 2nd ethernet
- * controller's PHY and AU1XXX_PHY1_SEARCH_ON_MAC0 is defined, then
+ * controller's PHY and phy1_search_mac0 is defined, then
  * the first MII bus is searched as well for an unclaimed PHY; this is
  * needed in case of a dual-PHY accessible only through the MAC0's MII
  * bus.
@@ -129,9 +131,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
  * controller is not registered to the network subsystem.
  */
 
-/* autodetection defaults */
-#undef  AU1XXX_PHY_SEARCH_HIGHEST_ADDR
-#define AU1XXX_PHY1_SEARCH_ON_MAC0
+/* autodetection defaults: phy1_search_mac0 */
 
 /* static PHY setup
  *
@@ -148,29 +148,6 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
  * specific irq-map
  */
 
-#if defined(CONFIG_MIPS_BOSPORUS)
-/*
- * Micrel/Kendin 5 port switch attached to MAC0,
- * MAC0 is associated with PHY address 5 (== WAN port)
- * MAC1 is not associated with any PHY, since it's connected directly
- * to the switch.
- * no interrupts are used
- */
-# define AU1XXX_PHY_STATIC_CONFIG
-
-# define AU1XXX_PHY0_ADDR  5
-# define AU1XXX_PHY0_BUSID 0
-#  undef AU1XXX_PHY0_IRQ
-
-#  undef AU1XXX_PHY1_ADDR
-#  undef AU1XXX_PHY1_BUSID
-#  undef AU1XXX_PHY1_IRQ
-#endif
-
-#if defined(AU1XXX_PHY0_BUSID) && (AU1XXX_PHY0_BUSID > 0)
-# error MAC0-associated PHY attached 2nd MACs MII bus not supported yet
-#endif
-
 static void enable_mac(struct net_device *dev, int force_reset)
 {
        unsigned long flags;
@@ -390,67 +367,55 @@ static int mii_probe (struct net_device *dev)
        struct au1000_private *const aup = netdev_priv(dev);
        struct phy_device *phydev = NULL;
 
-#if defined(AU1XXX_PHY_STATIC_CONFIG)
-       BUG_ON(aup->mac_id < 0 || aup->mac_id > 1);
+       if (aup->phy_static_config) {
+               BUG_ON(aup->mac_id < 0 || aup->mac_id > 1);
 
-       if(aup->mac_id == 0) { /* get PHY0 */
-# if defined(AU1XXX_PHY0_ADDR)
-               phydev = au_macs[AU1XXX_PHY0_BUSID]->mii_bus->phy_map[AU1XXX_PHY0_ADDR];
-# else
-               printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
-                       dev->name);
-               return 0;
-# endif /* defined(AU1XXX_PHY0_ADDR) */
-       } else if (aup->mac_id == 1) { /* get PHY1 */
-# if defined(AU1XXX_PHY1_ADDR)
-               phydev = au_macs[AU1XXX_PHY1_BUSID]->mii_bus->phy_map[AU1XXX_PHY1_ADDR];
-# else
-               printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
-                       dev->name);
+               if (aup->phy_addr)
+                       phydev = aup->mii_bus->phy_map[aup->phy_addr];
+               else
+                       printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n",
+                               dev->name);
                return 0;
-# endif /* defined(AU1XXX_PHY1_ADDR) */
-       }
-
-#else /* defined(AU1XXX_PHY_STATIC_CONFIG) */
-       int phy_addr;
-
-       /* find the first (lowest address) PHY on the current MAC's MII bus */
-       for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
-               if (aup->mii_bus->phy_map[phy_addr]) {
-                       phydev = aup->mii_bus->phy_map[phy_addr];
-# if !defined(AU1XXX_PHY_SEARCH_HIGHEST_ADDR)
-                       break; /* break out with first one found */
-# endif
-               }
+       } else {
+               int phy_addr;
+
+               /* find the first (lowest address) PHY on the current MAC's MII bus */
+               for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
+                       if (aup->mii_bus->phy_map[phy_addr]) {
+                               phydev = aup->mii_bus->phy_map[phy_addr];
+                               if (!aup->phy_search_highest_addr)
+                                       break; /* break out with first one found */
+                       }
 
-# if defined(AU1XXX_PHY1_SEARCH_ON_MAC0)
-       /* try harder to find a PHY */
-       if (!phydev && (aup->mac_id == 1)) {
-               /* no PHY found, maybe we have a dual PHY? */
-               printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, "
-                       "let's see if it's attached to MAC0...\n");
+               if (aup->phy1_search_mac0) {
+                       /* try harder to find a PHY */
+                       if (!phydev && (aup->mac_id == 1)) {
+                               /* no PHY found, maybe we have a dual PHY? */
+                               printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, "
+                                       "let's see if it's attached to MAC0...\n");
 
-               BUG_ON(!au_macs[0]);
+                               /* find the first (lowest address) non-attached PHY on
+                                * the MAC0 MII bus */
+                               for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
+                                       struct phy_device *const tmp_phydev =
+                                                       aup->mii_bus->phy_map[phy_addr];
 
-               /* find the first (lowest address) non-attached PHY on
-                * the MAC0 MII bus */
-               for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
-                       struct phy_device *const tmp_phydev =
-                               au_macs[0]->mii_bus->phy_map[phy_addr];
+                                       if (aup->mac_id == 1)
+                                               break;
 
-                       if (!tmp_phydev)
-                               continue; /* no PHY here... */
+                                       if (!tmp_phydev)
+                                               continue; /* no PHY here... */
 
-                       if (tmp_phydev->attached_dev)
-                               continue; /* already claimed by MAC0 */
+                                       if (tmp_phydev->attached_dev)
+                                               continue; /* already claimed by MAC0 */
 
-                       phydev = tmp_phydev;
-                       break; /* found it */
+                                       phydev = tmp_phydev;
+                                       break; /* found it */
+                               }
+                       }
                }
        }
-# endif /* defined(AU1XXX_PHY1_SEARCH_OTHER_BUS) */
 
-#endif /* defined(AU1XXX_PHY_STATIC_CONFIG) */
        if (!phydev) {
                printk (KERN_ERR DRV_NAME ":%s: no PHY found\n", dev->name);
                return -1;
@@ -578,31 +543,6 @@ setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
        }
 }
 
-static struct {
-       u32 base_addr;
-       u32 macen_addr;
-       int irq;
-       struct net_device *dev;
-} iflist[2] = {
-#ifdef CONFIG_SOC_AU1000
-       {AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT},
-       {AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT}
-#endif
-#ifdef CONFIG_SOC_AU1100
-       {AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT}
-#endif
-#ifdef CONFIG_SOC_AU1500
-       {AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT},
-       {AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT}
-#endif
-#ifdef CONFIG_SOC_AU1550
-       {AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT},
-       {AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT}
-#endif
-};
-
-static int num_ifs;
-
 /*
  * ethtool operations
  */
@@ -711,7 +651,6 @@ static int au1000_init(struct net_device *dev)
 
 static inline void update_rx_stats(struct net_device *dev, u32 status)
 {
-       struct au1000_private *aup = netdev_priv(dev);
        struct net_device_stats *ps = &dev->stats;
 
        ps->rx_packets++;
@@ -969,7 +908,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
        }
 
        pDB = aup->tx_db_inuse[aup->tx_head];
-       skb_copy_from_linear_data(skb, pDB->vaddr, skb->len);
+       skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
        if (skb->len < ETH_ZLEN) {
                for (i=skb->len; i<ETH_ZLEN; i++) {
                        ((char *)pDB->vaddr)[i] = 0;
@@ -1058,53 +997,59 @@ static const struct net_device_ops au1000_netdev_ops = {
        .ndo_change_mtu         = eth_change_mtu,
 };
 
-static struct net_device * au1000_probe(int port_num)
+static int __devinit au1000_probe(struct platform_device *pdev)
 {
        static unsigned version_printed = 0;
        struct au1000_private *aup = NULL;
+       struct au1000_eth_platform_data *pd;
        struct net_device *dev = NULL;
        db_dest_t *pDB, *pDBfree;
+       int irq, i, err = 0;
+       struct resource *base, *macen;
        char ethaddr[6];
-       int irq, i, err;
-       u32 base, macen;
 
-       if (port_num >= NUM_ETH_INTERFACES)
-               return NULL;
+       base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!base) {
+               printk(KERN_ERR DRV_NAME ": failed to retrieve base register\n");
+               err = -ENODEV;
+               goto out;
+       }
 
-       base  = CPHYSADDR(iflist[port_num].base_addr );
-       macen = CPHYSADDR(iflist[port_num].macen_addr);
-       irq = iflist[port_num].irq;
+       macen = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       if (!macen) {
+               printk(KERN_ERR DRV_NAME ": failed to retrieve MAC Enable register\n");
+               err = -ENODEV;
+               goto out;
+       }
 
-       if (!request_mem_region( base, MAC_IOSIZE, "Au1x00 ENET") ||
-           !request_mem_region(macen, 4, "Au1x00 ENET"))
-               return NULL;
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               printk(KERN_ERR DRV_NAME ": failed to retrieve IRQ\n");
+               err = -ENODEV;
+               goto out;
+       }
 
-       if (version_printed++ == 0)
-               printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
+       if (!request_mem_region(base->start, resource_size(base), pdev->name)) {
+               printk(KERN_ERR DRV_NAME ": failed to request memory region for base registers\n");
+               err = -ENXIO;
+               goto out;
+       }
+
+       if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) {
+               printk(KERN_ERR DRV_NAME ": failed to request memory region for MAC enable register\n");
+               err = -ENXIO;
+               goto err_request;
+       }
 
        dev = alloc_etherdev(sizeof(struct au1000_private));
        if (!dev) {
                printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME);
-               return NULL;
+               err = -ENOMEM;
+               goto err_alloc;
        }
 
-       dev->base_addr = base;
-       dev->irq = irq;
-       dev->netdev_ops = &au1000_netdev_ops;
-       SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
-       dev->watchdog_timeo = ETH_TX_TIMEOUT;
-
-       err = register_netdev(dev);
-       if (err != 0) {
-               printk(KERN_ERR "%s: Cannot register net device, error %d\n",
-                               DRV_NAME, err);
-               free_netdev(dev);
-               return NULL;
-       }
-
-       printk("%s: Au1xx0 Ethernet found at 0x%x, irq %d\n",
-               dev->name, base, irq);
-
+       SET_NETDEV_DEV(dev, &pdev->dev);
+       platform_set_drvdata(pdev, dev);
        aup = netdev_priv(dev);
 
        spin_lock_init(&aup->lock);
@@ -1115,21 +1060,29 @@ static struct net_device * au1000_probe(int port_num)
                                                (NUM_TX_BUFFS + NUM_RX_BUFFS),
                                                &aup->dma_addr, 0);
        if (!aup->vaddr) {
-               free_netdev(dev);
-               release_mem_region( base, MAC_IOSIZE);
-               release_mem_region(macen, 4);
-               return NULL;
+               printk(KERN_ERR DRV_NAME ": failed to allocate data buffers\n");
+               err = -ENOMEM;
+               goto err_vaddr;
        }
 
        /* aup->mac is the base address of the MAC's registers */
-       aup->mac = (volatile mac_reg_t *)iflist[port_num].base_addr;
+       aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base));
+       if (!aup->mac) {
+               printk(KERN_ERR DRV_NAME ": failed to ioremap MAC registers\n");
+               err = -ENXIO;
+               goto err_remap1;
+       }
 
-       /* Setup some variables for quick register address access */
-       aup->enable = (volatile u32 *)iflist[port_num].macen_addr;
-       aup->mac_id = port_num;
-       au_macs[port_num] = aup;
+        /* Setup some variables for quick register address access */
+       aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen));
+       if (!aup->enable) {
+               printk(KERN_ERR DRV_NAME ": failed to ioremap MAC enable register\n");
+               err = -ENXIO;
+               goto err_remap2;
+       }
+       aup->mac_id = pdev->id;
 
-       if (port_num == 0) {
+       if (pdev->id == 0) {
                if (prom_get_ethernet_addr(ethaddr) == 0)
                        memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
                else {
@@ -1139,7 +1092,7 @@ static struct net_device * au1000_probe(int port_num)
                }
 
                setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
-       } else if (port_num == 1)
+       } else if (pdev->id == 1)
                setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
 
        /*
@@ -1147,14 +1100,37 @@ static struct net_device * au1000_probe(int port_num)
         * to match those that are printed on their stickers
         */
        memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
-       dev->dev_addr[5] += port_num;
+       dev->dev_addr[5] += pdev->id;
 
        *aup->enable = 0;
        aup->mac_enabled = 0;
 
+       pd = pdev->dev.platform_data;
+       if (!pd) {
+               printk(KERN_INFO DRV_NAME ": no platform_data passed, PHY search on MAC0\n");
+               aup->phy1_search_mac0 = 1;
+       } else {
+               aup->phy_static_config = pd->phy_static_config;
+               aup->phy_search_highest_addr = pd->phy_search_highest_addr;
+               aup->phy1_search_mac0 = pd->phy1_search_mac0;
+               aup->phy_addr = pd->phy_addr;
+               aup->phy_busid = pd->phy_busid;
+               aup->phy_irq = pd->phy_irq;
+       }
+
+       if (aup->phy_busid && aup->phy_busid > 0) {
+               printk(KERN_ERR DRV_NAME ": MAC0-associated PHY attached 2nd MACs MII"
+                               "bus not supported yet\n");
+               err = -ENODEV;
+               goto err_mdiobus_alloc;
+       }
+
        aup->mii_bus = mdiobus_alloc();
-       if (aup->mii_bus == NULL)
-               goto err_out;
+       if (aup->mii_bus == NULL) {
+               printk(KERN_ERR DRV_NAME ": failed to allocate mdiobus structure\n");
+               err = -ENOMEM;
+               goto err_mdiobus_alloc;
+       }
 
        aup->mii_bus->priv = dev;
        aup->mii_bus->read = au1000_mdiobus_read;
@@ -1168,23 +1144,19 @@ static struct net_device * au1000_probe(int port_num)
 
        for(i = 0; i < PHY_MAX_ADDR; ++i)
                aup->mii_bus->irq[i] = PHY_POLL;
-
        /* if known, set corresponding PHY IRQs */
-#if defined(AU1XXX_PHY_STATIC_CONFIG)
-# if defined(AU1XXX_PHY0_IRQ)
-       if (AU1XXX_PHY0_BUSID == aup->mac_id)
-               aup->mii_bus->irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ;
-# endif
-# if defined(AU1XXX_PHY1_IRQ)
-       if (AU1XXX_PHY1_BUSID == aup->mac_id)
-               aup->mii_bus->irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ;
-# endif
-#endif
-       mdiobus_register(aup->mii_bus);
+       if (aup->phy_static_config)
+               if (aup->phy_irq && aup->phy_busid == aup->mac_id)
+                       aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq;
+
+       err = mdiobus_register(aup->mii_bus);
+       if (err) {
+               printk(KERN_ERR DRV_NAME " failed to register MDIO bus\n");
+               goto err_mdiobus_reg;
+       }
 
-       if (mii_probe(dev) != 0) {
+       if (mii_probe(dev) != 0)
                goto err_out;
-       }
 
        pDBfree = NULL;
        /* setup the data buffer descriptors and attach a buffer to each one */
@@ -1216,19 +1188,35 @@ static struct net_device * au1000_probe(int port_num)
                aup->tx_db_inuse[i] = pDB;
        }
 
+       dev->base_addr = base->start;
+       dev->irq = irq;
+       dev->netdev_ops = &au1000_netdev_ops;
+       SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
+       dev->watchdog_timeo = ETH_TX_TIMEOUT;
+
        /*
         * The boot code uses the ethernet controller, so reset it to start
         * fresh.  au1000_init() expects that the device is in reset state.
         */
        reset_mac(dev);
 
-       return dev;
+       err = register_netdev(dev);
+       if (err) {
+               printk(KERN_ERR DRV_NAME "%s: Cannot register net device, aborting.\n",
+                                       dev->name);
+               goto err_out;
+       }
+
+       printk("%s: Au1xx0 Ethernet found at 0x%lx, irq %d\n",
+                       dev->name, (unsigned long)base->start, irq);
+       if (version_printed++ == 0)
+               printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
+
+       return 0;
 
 err_out:
-       if (aup->mii_bus != NULL) {
+       if (aup->mii_bus != NULL)
                mdiobus_unregister(aup->mii_bus);
-               mdiobus_free(aup->mii_bus);
-       }
 
        /* here we should have a valid dev plus aup-> register addresses
         * so we can reset the mac properly.*/
@@ -1242,67 +1230,84 @@ err_out:
                if (aup->tx_db_inuse[i])
                        ReleaseDB(aup, aup->tx_db_inuse[i]);
        }
+err_mdiobus_reg:
+       mdiobus_free(aup->mii_bus);
+err_mdiobus_alloc:
+       iounmap(aup->enable);
+err_remap2:
+       iounmap(aup->mac);
+err_remap1:
        dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
                             (void *)aup->vaddr, aup->dma_addr);
-       unregister_netdev(dev);
+err_vaddr:
        free_netdev(dev);
-       release_mem_region( base, MAC_IOSIZE);
-       release_mem_region(macen, 4);
-       return NULL;
+err_alloc:
+       release_mem_region(macen->start, resource_size(macen));
+err_request:
+       release_mem_region(base->start, resource_size(base));
+out:
+       return err;
 }
 
-/*
- * Setup the base address and interrupt of the Au1xxx ethernet macs
- * based on cpu type and whether the interface is enabled in sys_pinfunc
- * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
- */
-static int __init au1000_init_module(void)
+static int __devexit au1000_remove(struct platform_device *pdev)
 {
-       int ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4);
-       struct net_device *dev;
-       int i, found_one = 0;
+       struct net_device *dev = platform_get_drvdata(pdev);
+       struct au1000_private *aup = netdev_priv(dev);
+       int i;
+       struct resource *base, *macen;
 
-       num_ifs = NUM_ETH_INTERFACES - ni;
+       platform_set_drvdata(pdev, NULL);
+
+       unregister_netdev(dev);
+       mdiobus_unregister(aup->mii_bus);
+       mdiobus_free(aup->mii_bus);
+
+       for (i = 0; i < NUM_RX_DMA; i++)
+               if (aup->rx_db_inuse[i])
+                       ReleaseDB(aup, aup->rx_db_inuse[i]);
+
+       for (i = 0; i < NUM_TX_DMA; i++)
+               if (aup->tx_db_inuse[i])
+                       ReleaseDB(aup, aup->tx_db_inuse[i]);
+
+       dma_free_noncoherent(NULL, MAX_BUF_SIZE *
+                       (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                       (void *)aup->vaddr, aup->dma_addr);
+
+       iounmap(aup->mac);
+       iounmap(aup->enable);
+
+       base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(base->start, resource_size(base));
+
+       macen = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       release_mem_region(macen->start, resource_size(macen));
+
+       free_netdev(dev);
 
-       for(i = 0; i < num_ifs; i++) {
-               dev = au1000_probe(i);
-               iflist[i].dev = dev;
-               if (dev)
-                       found_one++;
-       }
-       if (!found_one)
-               return -ENODEV;
        return 0;
 }
 
-static void __exit au1000_cleanup_module(void)
+static struct platform_driver au1000_eth_driver = {
+       .probe  = au1000_probe,
+       .remove = __devexit_p(au1000_remove),
+       .driver = {
+               .name   = "au1000-eth",
+               .owner  = THIS_MODULE,
+       },
+};
+MODULE_ALIAS("platform:au1000-eth");
+
+
+static int __init au1000_init_module(void)
+{
+       return platform_driver_register(&au1000_eth_driver);
+}
+
+static void __exit au1000_exit_module(void)
 {
-       int i, j;
-       struct net_device *dev;
-       struct au1000_private *aup;
-
-       for (i = 0; i < num_ifs; i++) {
-               dev = iflist[i].dev;
-               if (dev) {
-                       aup = netdev_priv(dev);
-                       unregister_netdev(dev);
-                       mdiobus_unregister(aup->mii_bus);
-                       mdiobus_free(aup->mii_bus);
-                       for (j = 0; j < NUM_RX_DMA; j++)
-                               if (aup->rx_db_inuse[j])
-                                       ReleaseDB(aup, aup->rx_db_inuse[j]);
-                       for (j = 0; j < NUM_TX_DMA; j++)
-                               if (aup->tx_db_inuse[j])
-                                       ReleaseDB(aup, aup->tx_db_inuse[j]);
-                       dma_free_noncoherent(NULL, MAX_BUF_SIZE *
-                                            (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                                            (void *)aup->vaddr, aup->dma_addr);
-                       release_mem_region(dev->base_addr, MAC_IOSIZE);
-                       release_mem_region(CPHYSADDR(iflist[i].macen_addr), 4);
-                       free_netdev(dev);
-               }
-       }
+       platform_driver_unregister(&au1000_eth_driver);
 }
 
 module_init(au1000_init_module);
-module_exit(au1000_cleanup_module);
+module_exit(au1000_exit_module);
index 824ecd5ff3a8af8e7144d8c241cd5cd341dc623c..f9d29a29b8fdfba046675e2b26e4742fb4527843 100644 (file)
@@ -108,6 +108,15 @@ struct au1000_private {
        struct phy_device *phy_dev;
        struct mii_bus *mii_bus;
 
+       /* PHY configuration */
+       int phy_static_config;
+       int phy_search_highest_addr;
+       int phy1_search_mac0;
+
+       int phy_addr;
+       int phy_busid;
+       int phy_irq;
+
        /* These variables are just for quick access to certain regs addresses. */
        volatile mac_reg_t *mac;  /* mac registers                      */
        volatile u32 *enable;     /* address of MAC Enable Register     */
index 62d9c9cc5671d6a7ae4bd7de66806c018e599629..1dd4403247ca02d972fdd0f9e2a3651c862a5ce7 100644 (file)
@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev)
                size = (res->end - res->start) + 1;
 
                ax->mem2 = request_mem_region(res->start, size, pdev->name);
-               if (ax->mem == NULL) {
+               if (ax->mem2 == NULL) {
                        dev_err(&pdev->dev, "cannot reserve registers\n");
                        ret = -ENXIO;
                        goto exit_mem1;
index 9fd8e5ecd5d75dcd81cf30827fd2257ba50d1284..5bc74590c73e66a95eeadf924a47e329d16abc6b 100644 (file)
@@ -276,8 +276,13 @@ struct be_adapter {
        int link_speed;
        u8 port_type;
        u8 transceiver;
+       u8 generation;          /* BladeEngine ASIC generation */
 };
 
+/* BladeEngine Generation numbers */
+#define BE_GEN2 2
+#define BE_GEN3 3
+
 extern const struct ethtool_ops be_ethtool_ops;
 
 #define drvr_stats(adapter)            (&adapter->stats.drvr_stats)
index 102ade13416526066e3639519beaf4f497bc8830..006cb2efcd2250691df59c94350252b4eee4b926 100644 (file)
@@ -286,7 +286,7 @@ static void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
                                MCC_WRB_SGE_CNT_SHIFT;
        wrb->payload_length = payload_len;
        wrb->tag0 = opcode;
-       be_dws_cpu_to_le(wrb, 20);
+       be_dws_cpu_to_le(wrb, 8);
 }
 
 /* Don't touch the hdr after it's prepared */
@@ -296,6 +296,7 @@ static void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
        req_hdr->opcode = opcode;
        req_hdr->subsystem = subsystem;
        req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr));
+       req_hdr->version = 0;
 }
 
 static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages,
index c002b8391b4dc18c24e0a6e4b48a8e39ff9549b1..13b33c841083ae9e446fa35cd4a2cd8e777a1c85 100644 (file)
@@ -164,7 +164,8 @@ struct be_cmd_req_hdr {
        u8 domain;              /* dword 0 */
        u32 timeout;            /* dword 1 */
        u32 request_length;     /* dword 2 */
-       u32 rsvd;               /* dword 3 */
+       u8 version;             /* dword 3 */
+       u8 rsvd[3];             /* dword 3 */
 };
 
 #define RESP_HDR_INFO_OPCODE_SHIFT     0       /* bits 0 - 7 */
index 3a1f7902c16df0b51ad3be1803e92b3d2b23bb6c..626b76c0ebc75bd676e591845b4c9259cfa67c8d 100644 (file)
@@ -910,7 +910,7 @@ static inline struct page *be_alloc_pages(u32 size)
 static void be_post_rx_frags(struct be_adapter *adapter)
 {
        struct be_rx_page_info *page_info_tbl = adapter->rx_obj.page_info_tbl;
-       struct be_rx_page_info *page_info = NULL;
+       struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL;
        struct be_queue_info *rxq = &adapter->rx_obj.q;
        struct page *pagep = NULL;
        struct be_eth_rx_d *rxd;
@@ -941,7 +941,6 @@ static void be_post_rx_frags(struct be_adapter *adapter)
                rxd = queue_head_node(rxq);
                rxd->fragpa_lo = cpu_to_le32(frag_dmaaddr & 0xFFFFFFFF);
                rxd->fragpa_hi = cpu_to_le32(upper_32_bits(frag_dmaaddr));
-               queue_head_inc(rxq);
 
                /* Any space left in the current big page for another frag? */
                if ((page_offset + rx_frag_size + rx_frag_size) >
@@ -949,10 +948,13 @@ static void be_post_rx_frags(struct be_adapter *adapter)
                        pagep = NULL;
                        page_info->last_page_user = true;
                }
+
+               prev_page_info = page_info;
+               queue_head_inc(rxq);
                page_info = &page_info_tbl[rxq->head];
        }
        if (pagep)
-               page_info->last_page_user = true;
+               prev_page_info->last_page_user = true;
 
        if (posted) {
                atomic_add(posted, &rxq->used);
@@ -1348,7 +1350,7 @@ static irqreturn_t be_intx(int irq, void *dev)
        int isr;
 
        isr = ioread32(adapter->csr + CEV_ISR0_OFFSET +
-                       be_pci_func(adapter) * CEV_ISR_SIZE);
+               (adapter->tx_eq.q.id/ 8) * CEV_ISR_SIZE);
        if (!isr)
                return IRQ_NONE;
 
@@ -2049,6 +2051,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter)
 static int be_map_pci_bars(struct be_adapter *adapter)
 {
        u8 __iomem *addr;
+       int pcicfg_reg;
 
        addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2),
                        pci_resource_len(adapter->pdev, 2));
@@ -2062,8 +2065,13 @@ static int be_map_pci_bars(struct be_adapter *adapter)
                goto pci_map_err;
        adapter->db = addr;
 
-       addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1),
-                       pci_resource_len(adapter->pdev, 1));
+       if (adapter->generation == BE_GEN2)
+               pcicfg_reg = 1;
+       else
+               pcicfg_reg = 0;
+
+       addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg),
+                       pci_resource_len(adapter->pdev, pcicfg_reg));
        if (addr == NULL)
                goto pci_map_err;
        adapter->pcicfg = addr;
@@ -2160,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter)
        cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
        if (cmd->va == NULL)
                return -1;
+       memset(cmd->va, 0, cmd->size);
        return 0;
 }
 
@@ -2238,6 +2247,20 @@ static int __devinit be_probe(struct pci_dev *pdev,
                goto rel_reg;
        }
        adapter = netdev_priv(netdev);
+
+       switch (pdev->device) {
+       case BE_DEVICE_ID1:
+       case OC_DEVICE_ID1:
+               adapter->generation = BE_GEN2;
+               break;
+       case BE_DEVICE_ID2:
+       case OC_DEVICE_ID2:
+               adapter->generation = BE_GEN3;
+               break;
+       default:
+               adapter->generation = 0;
+       }
+
        adapter->pdev = pdev;
        pci_set_drvdata(pdev, adapter);
        adapter->netdev = netdev;
index 8ffea3990d07dc83e3b773659974dc2b60e7815c..0b23bc4f56c62029fc7fd0178f673a2cea85d148 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/dma.h>
 #include <linux/dma-mapping.h>
 
+#include <asm/dpmc.h>
 #include <asm/blackfin.h>
 #include <asm/cacheflush.h>
 #include <asm/portmux.h>
@@ -386,8 +387,8 @@ static int mii_probe(struct net_device *dev)
        u32 sclk, mdc_div;
 
        /* Enable PHY output early */
-       if (!(bfin_read_VR_CTL() & PHYCLKOE))
-               bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);
+       if (!(bfin_read_VR_CTL() & CLKBUFOE))
+               bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
 
        sclk = get_sclk();
        mdc_div = ((sclk / MDC_CLK) / 2) - 1;
index 3f0071cfe56b3a06c6f53e4ca29503393a4c5d94..efa0e41bf3ec2e141dbf36f72187db8aa41975b9 100644 (file)
@@ -3639,7 +3639,7 @@ static int bond_open(struct net_device *bond_dev)
                 */
                if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) {
                        /* something went wrong - fail the open operation */
-                       return -1;
+                       return -ENOMEM;
                }
 
                INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor);
index 8d0be26f94e3b61229721d7e8d95529d929549f7..bf2072e54200a61887eddae673fc7a63dbf4ba9c 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/phy_fixed.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
+#include <linux/clk.h>
 #include <asm/gpio.h>
 #include <asm/atomic.h>
 
@@ -294,9 +295,16 @@ static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
 
 static int cpmac_mdio_reset(struct mii_bus *bus)
 {
+       struct clk *cpmac_clk;
+
+       cpmac_clk = clk_get(&bus->dev, "cpmac");
+       if (IS_ERR(cpmac_clk)) {
+               printk(KERN_ERR "unable to get cpmac clock\n");
+               return -1;
+       }
        ar7_device_reset(AR7_RESET_BIT_MDIO);
        cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
-                   MDIOC_CLKDIV(ar7_cpmac_freq() / 2200000 - 1));
+                   MDIOC_CLKDIV(clk_get_rate(cpmac_clk) / 2200000 - 1));
        return 0;
 }
 
index bdbd14727e4b232987632fb19f114510e6068837..318a018ca7c58dda1b75cef9de3d8165995ebd12 100644 (file)
@@ -2079,6 +2079,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
                         struct sge_fl *fl, int len, int complete)
 {
        struct rx_sw_desc *sd = &fl->sdesc[fl->cidx];
+       struct port_info *pi = netdev_priv(qs->netdev);
        struct sk_buff *skb = NULL;
        struct cpl_rx_pkt *cpl;
        struct skb_frag_struct *rx_frag;
@@ -2116,11 +2117,18 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
 
        if (!nr_frags) {
                offset = 2 + sizeof(struct cpl_rx_pkt);
-               qs->lro_va = sd->pg_chunk.va + 2;
-       }
-       len -= offset;
+               cpl = qs->lro_va = sd->pg_chunk.va + 2;
 
-       prefetch(qs->lro_va);
+               if ((pi->rx_offload & T3_RX_CSUM) &&
+                    cpl->csum_valid && cpl->csum == htons(0xffff)) {
+                       skb->ip_summed = CHECKSUM_UNNECESSARY;
+                       qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
+               } else
+                       skb->ip_summed = CHECKSUM_NONE;
+       } else
+               cpl = qs->lro_va;
+
+       len -= offset;
 
        rx_frag += nr_frags;
        rx_frag->page = sd->pg_chunk.page;
@@ -2136,12 +2144,8 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
                return;
 
        skb_record_rx_queue(skb, qs - &adap->sge.qs[0]);
-       skb->ip_summed = CHECKSUM_UNNECESSARY;
-       cpl = qs->lro_va;
 
        if (unlikely(cpl->vlan_valid)) {
-               struct net_device *dev = qs->netdev;
-               struct port_info *pi = netdev_priv(dev);
                struct vlan_group *grp = pi->vlan_grp;
 
                if (likely(grp != NULL)) {
index 2a567df3ea7160d71857654ae3efb697e9988013..e8932db7ee77ef42aa4c2ed349e641addc7c0ddd 100644 (file)
@@ -326,6 +326,8 @@ struct e1000_adapter {
        /* for ioport free */
        int bars;
        int need_ioport;
+
+       bool discarding;
 };
 
 enum e1000_state_t {
index 7e855f9bbd97a06186c74b2cccb04828af1c2c91..765543663a4f29ada5fef9fe31032a476d306dda 100644 (file)
@@ -1698,18 +1698,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
        rctl &= ~E1000_RCTL_SZ_4096;
        rctl |= E1000_RCTL_BSEX;
        switch (adapter->rx_buffer_len) {
-               case E1000_RXBUFFER_256:
-                       rctl |= E1000_RCTL_SZ_256;
-                       rctl &= ~E1000_RCTL_BSEX;
-                       break;
-               case E1000_RXBUFFER_512:
-                       rctl |= E1000_RCTL_SZ_512;
-                       rctl &= ~E1000_RCTL_BSEX;
-                       break;
-               case E1000_RXBUFFER_1024:
-                       rctl |= E1000_RCTL_SZ_1024;
-                       rctl &= ~E1000_RCTL_BSEX;
-                       break;
                case E1000_RXBUFFER_2048:
                default:
                        rctl |= E1000_RCTL_SZ_2048;
@@ -2802,13 +2790,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
 dma_error:
        dev_err(&pdev->dev, "TX DMA map failed\n");
        buffer_info->dma = 0;
-       count--;
-
-       while (count >= 0) {
+       if (count)
                count--;
-               i--;
-               if (i < 0)
+
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                buffer_info = &tx_ring->buffer_info[i];
                e1000_unmap_and_free_tx_resource(adapter, buffer_info);
        }
@@ -3176,13 +3164,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
         *  however with the new *_jumbo_rx* routines, jumbo receives will use
         *  fragmented skbs */
 
-       if (max_frame <= E1000_RXBUFFER_256)
-               adapter->rx_buffer_len = E1000_RXBUFFER_256;
-       else if (max_frame <= E1000_RXBUFFER_512)
-               adapter->rx_buffer_len = E1000_RXBUFFER_512;
-       else if (max_frame <= E1000_RXBUFFER_1024)
-               adapter->rx_buffer_len = E1000_RXBUFFER_1024;
-       else if (max_frame <= E1000_RXBUFFER_2048)
+       if (max_frame <= E1000_RXBUFFER_2048)
                adapter->rx_buffer_len = E1000_RXBUFFER_2048;
        else
 #if (PAGE_SIZE >= E1000_RXBUFFER_16384)
@@ -3850,13 +3832,22 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 
                length = le16_to_cpu(rx_desc->length);
                /* !EOP means multiple descriptors were used to store a single
-                * packet, also make sure the frame isn't just CRC only */
-               if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) {
+                * packet, if thats the case we need to toss it.  In fact, we
+                * to toss every packet with the EOP bit clear and the next
+                * frame that _does_ have the EOP bit set, as it is by
+                * definition only a frame fragment
+                */
+               if (unlikely(!(status & E1000_RXD_STAT_EOP)))
+                       adapter->discarding = true;
+
+               if (adapter->discarding) {
                        /* All receives must fit into a single buffer */
                        E1000_DBG("%s: Receive packet consumed multiple"
                                  " buffers\n", netdev->name);
                        /* recycle */
                        buffer_info->skb = skb;
+                       if (status & E1000_RXD_STAT_EOP)
+                               adapter->discarding = false;
                        goto next_desc;
                }
 
@@ -4015,11 +4006,21 @@ check_page:
                        }
                }
 
-               if (!buffer_info->dma)
+               if (!buffer_info->dma) {
                        buffer_info->dma = pci_map_page(pdev,
                                                        buffer_info->page, 0,
                                                        buffer_info->length,
                                                        PCI_DMA_FROMDEVICE);
+                       if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
+                               put_page(buffer_info->page);
+                               dev_kfree_skb(skb);
+                               buffer_info->page = NULL;
+                               buffer_info->skb = NULL;
+                               buffer_info->dma = 0;
+                               adapter->alloc_rx_buff_failed++;
+                               break; /* while !buffer_info->skb */
+                       }
+               }
 
                rx_desc = E1000_RX_DESC(*rx_ring, i);
                rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -4110,6 +4111,13 @@ map_skb:
                                                  skb->data,
                                                  buffer_info->length,
                                                  PCI_DMA_FROMDEVICE);
+               if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
+                       dev_kfree_skb(skb);
+                       buffer_info->skb = NULL;
+                       buffer_info->dma = 0;
+                       adapter->alloc_rx_buff_failed++;
+                       break; /* while !buffer_info->skb */
+               }
 
                /*
                 * XXX if it was allocated cleanly it will never map to a
index cebbd9079d5382ac736d02db5dc1184c4a40b447..d236efaf74781d68fd41c34d591c066ee063909b 100644 (file)
@@ -421,6 +421,7 @@ struct e1000_info {
 /* CRC Stripping defines */
 #define FLAG2_CRC_STRIPPING               (1 << 0)
 #define FLAG2_HAS_PHY_WAKEUP              (1 << 1)
+#define FLAG2_IS_DISCARDING               (1 << 2)
 
 #define E1000_RX_DESC_PS(R, i)     \
        (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
@@ -582,7 +583,6 @@ extern s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
 extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
 extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
                                          u16 data);
-extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
 extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw);
 extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw);
 extern s32 e1000_check_polarity_82577(struct e1000_hw *hw);
index ad08cf3f40c0ba830c350585b39dd8dae75df4fa..8b6ecd127889e6d19ed155c725dcd4f594d73666 100644 (file)
 #define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
 #define E1000_NVM_K1_ENABLE 0x1  /* NVM Enable K1 bit */
 
+/* KMRN Mode Control */
+#define HV_KMRN_MODE_CTRL      PHY_REG(769, 16)
+#define HV_KMRN_MDIO_SLOW      0x0400
+
 /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
 /* Offset 04h HSFSTS */
 union ich8_hws_flash_status {
@@ -219,6 +223,7 @@ static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
 static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw);
 static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
 static s32  e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
+static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
 
 static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
 {
@@ -270,7 +275,21 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
        phy->autoneg_mask             = AUTONEG_ADVERTISE_SPEED_DEFAULT;
 
        phy->id = e1000_phy_unknown;
-       e1000e_get_phy_id(hw);
+       ret_val = e1000e_get_phy_id(hw);
+       if (ret_val)
+               goto out;
+       if ((phy->id == 0) || (phy->id == PHY_REVISION_MASK)) {
+               /*
+                * In case the PHY needs to be in mdio slow mode (eg. 82577),
+                * set slow mode and try to get the PHY id again.
+                */
+               ret_val = e1000_set_mdio_slow_mode_hv(hw);
+               if (ret_val)
+                       goto out;
+               ret_val = e1000e_get_phy_id(hw);
+               if (ret_val)
+                       goto out;
+       }
        phy->type = e1000e_get_phy_type_from_id(phy->id);
 
        switch (phy->type) {
@@ -292,6 +311,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
                break;
        }
 
+out:
        return ret_val;
 }
 
@@ -1075,6 +1095,26 @@ out:
 }
 
 
+/**
+ *  e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
+ *  @hw:   pointer to the HW structure
+ **/
+static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw)
+{
+       s32 ret_val;
+       u16 data;
+
+       ret_val = e1e_rphy(hw, HV_KMRN_MODE_CTRL, &data);
+       if (ret_val)
+               return ret_val;
+
+       data |= HV_KMRN_MDIO_SLOW;
+
+       ret_val = e1e_wphy(hw, HV_KMRN_MODE_CTRL, data);
+
+       return ret_val;
+}
+
 /**
  *  e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
  *  done after every PHY reset.
@@ -1082,10 +1122,18 @@ out:
 static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
 {
        s32 ret_val = 0;
+       u16 phy_data;
 
        if (hw->mac.type != e1000_pchlan)
                return ret_val;
 
+       /* Set MDIO slow mode before any other MDIO access */
+       if (hw->phy.type == e1000_phy_82577) {
+               ret_val = e1000_set_mdio_slow_mode_hv(hw);
+               if (ret_val)
+                       goto out;
+       }
+
        if (((hw->phy.type == e1000_phy_82577) &&
             ((hw->phy.revision == 1) || (hw->phy.revision == 2))) ||
            ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) {
@@ -1118,16 +1166,32 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
 
        hw->phy.addr = 1;
        ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
+       hw->phy.ops.release(hw);
        if (ret_val)
                goto out;
-       hw->phy.ops.release(hw);
 
        /*
         * Configure the K1 Si workaround during phy reset assuming there is
         * link so that it disables K1 if link is in 1Gbps.
         */
        ret_val = e1000_k1_gig_workaround_hv(hw, true);
+       if (ret_val)
+               goto out;
 
+       /* Workaround for link disconnects on a busy hub in half duplex */
+       ret_val = hw->phy.ops.acquire(hw);
+       if (ret_val)
+               goto out;
+       ret_val = hw->phy.ops.read_reg_locked(hw,
+                                             PHY_REG(BM_PORT_CTRL_PAGE, 17),
+                                             &phy_data);
+       if (ret_val)
+               goto release;
+       ret_val = hw->phy.ops.write_reg_locked(hw,
+                                              PHY_REG(BM_PORT_CTRL_PAGE, 17),
+                                              phy_data & 0x00FF);
+release:
+       hw->phy.ops.release(hw);
 out:
        return ret_val;
 }
@@ -1184,6 +1248,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
        /* Allow time for h/w to get to a quiescent state after reset */
        mdelay(10);
 
+       /* Perform any necessary post-reset workarounds */
        if (hw->mac.type == e1000_pchlan) {
                ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
                if (ret_val)
@@ -2484,6 +2549,10 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        if (!ret_val)
                e1000_release_swflag_ich8lan(hw);
 
+       /* Perform any necessary post-reset workarounds */
+       if (hw->mac.type == e1000_pchlan)
+               ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
+
        if (ctrl & E1000_CTRL_PHY_RST)
                ret_val = hw->phy.ops.get_cfg_done(hw);
 
@@ -2528,9 +2597,6 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        kab |= E1000_KABGTXD_BGSQLBIAS;
        ew32(KABGTXD, kab);
 
-       if (hw->mac.type == e1000_pchlan)
-               ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
-
 out:
        return ret_val;
 }
index c45965a256b6d33d6e4c11a4cece11a9d7b7f47c..57f149b75fbe9d07f4b5e05e3e14c919d4987461 100644 (file)
@@ -450,13 +450,23 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 
                length = le16_to_cpu(rx_desc->length);
 
-               /* !EOP means multiple descriptors were used to store a single
-                * packet, also make sure the frame isn't just CRC only */
-               if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) {
+               /*
+                * !EOP means multiple descriptors were used to store a single
+                * packet, if that's the case we need to toss it.  In fact, we
+                * need to toss every packet with the EOP bit clear and the
+                * next frame that _does_ have the EOP bit set, as it is by
+                * definition only a frame fragment
+                */
+               if (unlikely(!(status & E1000_RXD_STAT_EOP)))
+                       adapter->flags2 |= FLAG2_IS_DISCARDING;
+
+               if (adapter->flags2 & FLAG2_IS_DISCARDING) {
                        /* All receives must fit into a single buffer */
                        e_dbg("Receive packet consumed multiple buffers\n");
                        /* recycle */
                        buffer_info->skb = skb;
+                       if (status & E1000_RXD_STAT_EOP)
+                               adapter->flags2 &= ~FLAG2_IS_DISCARDING;
                        goto next_desc;
                }
 
@@ -745,10 +755,16 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                                 PCI_DMA_FROMDEVICE);
                buffer_info->dma = 0;
 
-               if (!(staterr & E1000_RXD_STAT_EOP)) {
+               /* see !EOP comment in other rx routine */
+               if (!(staterr & E1000_RXD_STAT_EOP))
+                       adapter->flags2 |= FLAG2_IS_DISCARDING;
+
+               if (adapter->flags2 & FLAG2_IS_DISCARDING) {
                        e_dbg("Packet Split buffers didn't pick up the full "
                              "packet\n");
                        dev_kfree_skb_irq(skb);
+                       if (staterr & E1000_RXD_STAT_EOP)
+                               adapter->flags2 &= ~FLAG2_IS_DISCARDING;
                        goto next_desc;
                }
 
@@ -1118,6 +1134,7 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
 
        rx_ring->next_to_clean = 0;
        rx_ring->next_to_use = 0;
+       adapter->flags2 &= ~FLAG2_IS_DISCARDING;
 
        writel(0, adapter->hw.hw_addr + rx_ring->head);
        writel(0, adapter->hw.hw_addr + rx_ring->tail);
@@ -2333,18 +2350,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
        rctl &= ~E1000_RCTL_SZ_4096;
        rctl |= E1000_RCTL_BSEX;
        switch (adapter->rx_buffer_len) {
-       case 256:
-               rctl |= E1000_RCTL_SZ_256;
-               rctl &= ~E1000_RCTL_BSEX;
-               break;
-       case 512:
-               rctl |= E1000_RCTL_SZ_512;
-               rctl &= ~E1000_RCTL_BSEX;
-               break;
-       case 1024:
-               rctl |= E1000_RCTL_SZ_1024;
-               rctl &= ~E1000_RCTL_BSEX;
-               break;
        case 2048:
        default:
                rctl |= E1000_RCTL_SZ_2048;
@@ -3781,7 +3786,7 @@ static int e1000_tso(struct e1000_adapter *adapter,
                                                         0, IPPROTO_TCP, 0);
                cmd_length = E1000_TXD_CMD_IP;
                ipcse = skb_transport_offset(skb) - 1;
-       } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
+       } else if (skb_is_gso_v6(skb)) {
                ipv6_hdr(skb)->payload_len = 0;
                tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                                                       &ipv6_hdr(skb)->daddr,
@@ -3962,13 +3967,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
 dma_error:
        dev_err(&pdev->dev, "TX DMA map failed\n");
        buffer_info->dma = 0;
-       count--;
-
-       while (count >= 0) {
+       if (count)
                count--;
-               i--;
-               if (i < 0)
+
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                buffer_info = &tx_ring->buffer_info[i];
                e1000_put_txbuf(adapter, buffer_info);;
        }
@@ -4317,13 +4322,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
         * fragmented skbs
         */
 
-       if (max_frame <= 256)
-               adapter->rx_buffer_len = 256;
-       else if (max_frame <= 512)
-               adapter->rx_buffer_len = 512;
-       else if (max_frame <= 1024)
-               adapter->rx_buffer_len = 1024;
-       else if (max_frame <= 2048)
+       if (max_frame <= 2048)
                adapter->rx_buffer_len = 2048;
        else
                adapter->rx_buffer_len = 4096;
index 55a2c0acfee7817eca83df4e4cfde336afb23c73..7f3ceb9dad6a3c1d7982cde8996ab8e4e7501cf8 100644 (file)
@@ -152,32 +152,9 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw)
                if (phy->id != 0 && phy->id != PHY_REVISION_MASK)
                        goto out;
 
-               /*
-                * If the PHY ID is still unknown, we may have an 82577
-                * without link.  We will try again after setting Slow MDIC
-                * mode. No harm in trying again in this case since the PHY
-                * ID is unknown at this point anyway.
-                */
-               ret_val = phy->ops.acquire(hw);
-               if (ret_val)
-                       goto out;
-               ret_val = e1000_set_mdio_slow_mode_hv(hw, true);
-               if (ret_val)
-                       goto out;
-               phy->ops.release(hw);
-
                retry_count++;
        }
 out:
-       /* Revert to MDIO fast mode, if applicable */
-       if (retry_count) {
-               ret_val = phy->ops.acquire(hw);
-               if (ret_val)
-                       return ret_val;
-               ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
-               phy->ops.release(hw);
-       }
-
        return ret_val;
 }
 
@@ -2790,38 +2767,6 @@ static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
        return 0;
 }
 
-/**
- *  e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
- *  @hw:   pointer to the HW structure
- *  @slow: true for slow mode, false for normal mode
- *
- *  Assumes semaphore already acquired.
- **/
-s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow)
-{
-       s32 ret_val = 0;
-       u16 data = 0;
-
-       /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */
-       hw->phy.addr = 1;
-       ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
-                                        (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT));
-       if (ret_val)
-               goto out;
-
-       ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1,
-                                          (0x2180 | (slow << 10)));
-       if (ret_val)
-               goto out;
-
-       /* dummy read when reverting to fast mode - throw away result */
-       if (!slow)
-               ret_val = e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data);
-
-out:
-       return ret_val;
-}
-
 /**
  *  __e1000_read_phy_reg_hv -  Read HV PHY register
  *  @hw: pointer to the HW structure
@@ -2839,7 +2784,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
        s32 ret_val;
        u16 page = BM_PHY_REG_PAGE(offset);
        u16 reg = BM_PHY_REG_NUM(offset);
-       bool in_slow_mode = false;
 
        if (!locked) {
                ret_val = hw->phy.ops.acquire(hw);
@@ -2847,16 +2791,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
                        return ret_val;
        }
 
-       /* Workaround failure in MDIO access while cable is disconnected */
-       if ((hw->phy.type == e1000_phy_82577) &&
-           !(er32(STATUS) & E1000_STATUS_LU)) {
-               ret_val = e1000_set_mdio_slow_mode_hv(hw, true);
-               if (ret_val)
-                       goto out;
-
-               in_slow_mode = true;
-       }
-
        /* Page 800 works differently than the rest so it has its own func */
        if (page == BM_WUC_PAGE) {
                ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset,
@@ -2893,10 +2827,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
        ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
                                          data);
 out:
-       /* Revert to MDIO fast mode, if applicable */
-       if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
-               ret_val |= e1000_set_mdio_slow_mode_hv(hw, false);
-
        if (!locked)
                hw->phy.ops.release(hw);
 
@@ -2948,7 +2878,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
        s32 ret_val;
        u16 page = BM_PHY_REG_PAGE(offset);
        u16 reg = BM_PHY_REG_NUM(offset);
-       bool in_slow_mode = false;
 
        if (!locked) {
                ret_val = hw->phy.ops.acquire(hw);
@@ -2956,16 +2885,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
                        return ret_val;
        }
 
-       /* Workaround failure in MDIO access while cable is disconnected */
-       if ((hw->phy.type == e1000_phy_82577) &&
-           !(er32(STATUS) & E1000_STATUS_LU)) {
-               ret_val = e1000_set_mdio_slow_mode_hv(hw, true);
-               if (ret_val)
-                       goto out;
-
-               in_slow_mode = true;
-       }
-
        /* Page 800 works differently than the rest so it has its own func */
        if (page == BM_WUC_PAGE) {
                ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset,
@@ -3019,10 +2938,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
                                          data);
 
 out:
-       /* Revert to MDIO fast mode, if applicable */
-       if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
-               ret_val |= e1000_set_mdio_slow_mode_hv(hw, false);
-
        if (!locked)
                hw->phy.ops.release(hw);
 
index 933c64ff24657d362a2d3e34cb1c525c04826bb6..c881347cb26dfc1117dee51506e0e1104593a4b1 100644 (file)
@@ -421,6 +421,8 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
                        msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
                if (tx_queue > IGB_N0_QUEUE)
                        msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue;
+               if (!adapter->msix_entries && msix_vector == 0)
+                       msixbm |= E1000_EIMS_OTHER;
                array_wr32(E1000_MSIXBM(0), msix_vector, msixbm);
                q_vector->eims_value = msixbm;
                break;
@@ -877,7 +879,6 @@ static int igb_request_irq(struct igb_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
        struct pci_dev *pdev = adapter->pdev;
-       struct e1000_hw *hw = &adapter->hw;
        int err = 0;
 
        if (adapter->msix_entries) {
@@ -909,20 +910,7 @@ static int igb_request_irq(struct igb_adapter *adapter)
                igb_setup_all_tx_resources(adapter);
                igb_setup_all_rx_resources(adapter);
        } else {
-               switch (hw->mac.type) {
-               case e1000_82575:
-                       wr32(E1000_MSIXBM(0),
-                            (E1000_EICR_RX_QUEUE0 |
-                             E1000_EICR_TX_QUEUE0 |
-                             E1000_EIMS_OTHER));
-                       break;
-               case e1000_82580:
-               case e1000_82576:
-                       wr32(E1000_IVAR0, E1000_IVAR_VALID);
-                       break;
-               default:
-                       break;
-               }
+               igb_assign_vector(adapter->q_vector[0], 0);
        }
 
        if (adapter->flags & IGB_FLAG_HAS_MSI) {
@@ -1140,6 +1128,8 @@ int igb_up(struct igb_adapter *adapter)
        }
        if (adapter->msix_entries)
                igb_configure_msix(adapter);
+       else
+               igb_assign_vector(adapter->q_vector[0], 0);
 
        /* Clear any pending interrupts. */
        rd32(E1000_ICR);
@@ -3422,7 +3412,7 @@ static inline int igb_tso_adv(struct igb_ring *tx_ring,
                                                         iph->daddr, 0,
                                                         IPPROTO_TCP,
                                                         0);
-       } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
+       } else if (skb_is_gso_v6(skb)) {
                ipv6_hdr(skb)->payload_len = 0;
                tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                                                       &ipv6_hdr(skb)->daddr,
@@ -3584,6 +3574,7 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb,
        for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
                struct skb_frag_struct *frag;
 
+               count++;
                i++;
                if (i == tx_ring->count)
                        i = 0;
@@ -3605,7 +3596,6 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb,
                if (pci_dma_mapping_error(pdev, buffer_info->dma))
                        goto dma_error;
 
-               count++;
        }
 
        tx_ring->buffer_info[i].skb = skb;
index 0dbd0320023acf47ff36f2b97fe434b567cfc414..2aa71a766c35ae8d5ee9d75f6b21f04c6e82235c 100644 (file)
@@ -1963,7 +1963,7 @@ static int igbvf_tso(struct igbvf_adapter *adapter,
                                                         iph->daddr, 0,
                                                         IPPROTO_TCP,
                                                         0);
-       } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
+       } else if (skb_is_gso_v6(skb)) {
                ipv6_hdr(skb)->payload_len = 0;
                tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                                                       &ipv6_hdr(skb)->daddr,
@@ -2117,6 +2117,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
        /* set time_stamp *before* dma to help avoid a possible race */
        buffer_info->time_stamp = jiffies;
        buffer_info->next_to_watch = i;
+       buffer_info->mapped_as_page = false;
        buffer_info->dma = pci_map_single(pdev, skb->data, len,
                                          PCI_DMA_TODEVICE);
        if (pci_dma_mapping_error(pdev, buffer_info->dma))
@@ -2126,6 +2127,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
        for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
                struct skb_frag_struct *frag;
 
+               count++;
                i++;
                if (i == tx_ring->count)
                        i = 0;
@@ -2146,7 +2148,6 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
                                                PCI_DMA_TODEVICE);
                if (pci_dma_mapping_error(pdev, buffer_info->dma))
                        goto dma_error;
-               count++;
        }
 
        tx_ring->buffer_info[i].skb = skb;
@@ -2163,14 +2164,14 @@ dma_error:
        buffer_info->length = 0;
        buffer_info->next_to_watch = 0;
        buffer_info->mapped_as_page = false;
-       count--;
+       if (count)
+               count--;
 
        /* clear timestamp and dma mappings for remaining portion of packet */
-       while (count >= 0) {
-               count--;
-               i--;
-               if (i < 0)
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                buffer_info = &tx_ring->buffer_info[i];
                igbvf_put_txbuf(adapter, buffer_info);
        }
index 9b2eebdbb25b016ff26cb916bfcbda00b9afa003..b5cbd39d068558b6ee5c7ac544e1350889427751 100644 (file)
@@ -36,6 +36,7 @@
 #include <asm/pb1000.h>
 #elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
 #include <asm/db1x00.h>
+#include <asm/mach-db1x00/bcsr.h>
 #else 
 #error au1k_ir: unsupported board
 #endif
@@ -66,10 +67,6 @@ static char version[] __devinitdata =
 
 #define RUN_AT(x) (jiffies + (x))
 
-#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
-static BCSR * const bcsr = (BCSR *)0xAE000000;
-#endif
-
 static DEFINE_SPINLOCK(ir_lock);
 
 /*
@@ -282,9 +279,8 @@ static int au1k_irda_net_init(struct net_device *dev)
 
 #if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
        /* power on */
-       bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
-       bcsr->resets |= BCSR_RESETS_IRDA_MODE_FULL;
-       au_sync();
+       bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
+                             BCSR_RESETS_IRDA_MODE_FULL);
 #endif
 
        return 0;
@@ -720,14 +716,14 @@ au1k_irda_set_speed(struct net_device *dev, int speed)
 
        if (speed == 4000000) {
 #if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
-               bcsr->resets |= BCSR_RESETS_FIR_SEL;
+               bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_FIR_SEL);
 #else /* Pb1000 and Pb1100 */
                writel(1<<13, CPLD_AUX1);
 #endif
        }
        else {
 #if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100)
-               bcsr->resets &= ~BCSR_RESETS_FIR_SEL;
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_FIR_SEL, 0);
 #else /* Pb1000 and Pb1100 */
                writel(readl(CPLD_AUX1) & ~(1<<13), CPLD_AUX1);
 #endif
index bcd0f01d5feba7ae8cfa6330cecdd62c03579c50..593d1a4f217c0fccbf439156825f2556316c624d 100644 (file)
@@ -1363,13 +1363,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
 dma_error:
        dev_err(&pdev->dev, "TX DMA map failed\n");
        buffer_info->dma = 0;
-       count--;
-
-       while (count >= 0) {
+       if (count)
                count--;
-               i--;
-               if (i < 0)
+
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                buffer_info = &tx_ring->buffer_info[i];
                ixgb_unmap_and_free_tx_resource(adapter, buffer_info);
        }
index 21b41f42b61cf1237bc25e88c06444b52c5f7649..bfef0ebcba9ab343b36e4a7493cb36f42467b11c 100644 (file)
@@ -1,7 +1,7 @@
 ################################################################################
 #
 # Intel 10 Gigabit PCI Express Linux driver
-# Copyright(c) 1999 - 2009 Intel Corporation.
+# Copyright(c) 1999 - 2010 Intel Corporation.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms and conditions of the GNU General Public License,
index 8da8eb53508456e09885554ca4e73266aaa00c7a..303e7bd39b672fe4dbceff62ea91e96782e4211b 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 204177d78cecfc1479ae867d0e40709ec2297ec1..35a06b47587bd2bf57a376bf4f95ee65a7c93c0e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -357,12 +357,34 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
        u32 fctrl_reg;
        u32 rmcs_reg;
        u32 reg;
+       u32 link_speed = 0;
+       bool link_up;
 
 #ifdef CONFIG_DCB
        if (hw->fc.requested_mode == ixgbe_fc_pfc)
                goto out;
 
 #endif /* CONFIG_DCB */
+       /*
+        * On 82598 having Rx FC on causes resets while doing 1G
+        * so if it's on turn it off once we know link_speed. For
+        * more details see 82598 Specification update.
+        */
+       hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
+       if (link_up && link_speed == IXGBE_LINK_SPEED_1GB_FULL) {
+               switch (hw->fc.requested_mode) {
+               case ixgbe_fc_full:
+                       hw->fc.requested_mode = ixgbe_fc_tx_pause;
+                       break;
+               case ixgbe_fc_rx_pause:
+                       hw->fc.requested_mode = ixgbe_fc_none;
+                       break;
+               default:
+                       /* no change */
+                       break;
+               }
+       }
+
        /* Negotiate the fc mode to use */
        ret_val = ixgbe_fc_autoneg(hw);
        if (ret_val)
index 538340527aa6cb6514f8813d2e81cc1a07c7ac36..b49bd6b9feb724f7c5b93c69647d86e69a9a8ab0 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 688b8ca5da322ab782857e77f5c5b4fcd53c759b..21f158f79dd01b10110866f1b1b0f2e80d236e36 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 27f3214bed2e763f2691f1db5f26daf21947e7f5..dfff0ffaa502df9737e126caba7ff31f30935fa7 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index a1562287342fb13009deee7463c18c87f590574d..9aea4f04bbd2bcaaf4af62f7ed592bb62fdfbe5f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 64a9fa15c059643f79db6b35aed1dd93455e0553..5caafd4afbc314ffe929d9d8083844db1753e85f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index f30263898ebca85cc9613d32a311e916ce33a6f8..f0e9279d4669b261364997693a8547581665d75e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index ebbe53c352a7a3f6ab172bf19e520f5efb60b5d7..cc728fa092e293c3e2cb642c6b075af097e96ee3 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index ec8a252636d3b082af8428bc1bc9fab8c48c6ef6..4f7a26ab411e06ae0ecc19c5df963ed02dba0f35 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 9e5e2827e4afdf956e877d5dc6a326783175abd0..0f3f791e1e1d061258972e91651b344c4f380fbc 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 3c7a79a7d7c6707414d612d6c53df6dfb49d6a91..dd4883f642be0c8d411ba631d92b80de499f12d4 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -223,7 +223,7 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id,
 
        if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] !=
            adapter->dcb_cfg.bw_percentage[0][bwg_id]) {
-               adapter->dcb_set_bitmap |= BIT_PG_RX;
+               adapter->dcb_set_bitmap |= BIT_PG_TX;
                adapter->dcb_set_bitmap |= BIT_RESETLINK;
        }
 }
@@ -341,6 +341,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
        if (!adapter->dcb_set_bitmap)
                return DCB_NO_HW_CHG;
 
+       ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
+                                adapter->ring_feature[RING_F_DCB].indices);
+
+       if (ret)
+               return DCB_NO_HW_CHG;
+
        /*
         * Only take down the adapter if the configuration change
         * requires a reset.
@@ -359,14 +365,6 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
                }
        }
 
-       ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
-                                adapter->ring_feature[RING_F_DCB].indices);
-       if (ret) {
-               if (adapter->dcb_set_bitmap & BIT_RESETLINK)
-                       clear_bit(__IXGBE_RESETTING, &adapter->state);
-               return DCB_NO_HW_CHG;
-       }
-
        if (adapter->dcb_cfg.pfc_mode_enable) {
                if ((adapter->hw.mac.type != ixgbe_mac_82598EB) &&
                        (adapter->hw.fc.current_mode != ixgbe_fc_pfc))
index 0bd49d3b9f6566285dcd83c00193a0eba5fa9819..d77961fc75f90c8eda86139f6885b5384fe47f56 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index da32a108a7b4fcf0fc5506a3459975dbac35f7f9..e9a20c88c155f8cfc97b568dd49e2a7f2b30fa57 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index de8ff53187daf28724885794c63103423180f3ad..abf4b2b3f2520f35117403061895cf9e968fc003 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 2ad754c864cf9b9bc6616cb2009ac388e5df71dd..951b73cf5ca2b2f9dd53e4bcd6c8509740a659b0 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -52,7 +52,7 @@ static const char ixgbe_driver_string[] =
 
 #define DRV_VERSION "2.0.44-k2"
 const char ixgbe_driver_version[] = DRV_VERSION;
-static char ixgbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation.";
+static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation.";
 
 static const struct ixgbe_info *ixgbe_info_tbl[] = {
        [board_82598] = &ixgbe_82598_info,
@@ -4928,7 +4928,7 @@ static int ixgbe_tso(struct ixgbe_adapter *adapter,
                                                                 iph->daddr, 0,
                                                                 IPPROTO_TCP,
                                                                 0);
-               } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
+               } else if (skb_is_gso_v6(skb)) {
                        ipv6_hdr(skb)->payload_len = 0;
                        tcp_hdr(skb)->check =
                            ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
@@ -5167,19 +5167,19 @@ dma_error:
        tx_buffer_info->dma = 0;
        tx_buffer_info->time_stamp = 0;
        tx_buffer_info->next_to_watch = 0;
-       count--;
+       if (count)
+               count--;
 
        /* clear timestamp and dma mappings for remaining portion of packet */
-       while (count >= 0) {
-               count--;
-               i--;
-               if (i < 0)
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                tx_buffer_info = &tx_ring->tx_buffer_info[i];
                ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info);
        }
 
-       return count;
+       return 0;
 }
 
 static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
@@ -5329,8 +5329,11 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
        struct ixgbe_adapter *adapter = netdev_priv(dev);
        int txq = smp_processor_id();
 
-       if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
+       if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
+               while (unlikely(txq >= dev->real_num_tx_queues))
+                       txq -= dev->real_num_tx_queues;
                return txq;
+       }
 
 #ifdef IXGBE_FCOE
        if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
@@ -5576,6 +5579,10 @@ static void ixgbe_netpoll(struct net_device *netdev)
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        int i;
 
+       /* if interface is down do nothing */
+       if (test_bit(__IXGBE_DOWN, &adapter->state))
+               return;
+
        adapter->flags |= IXGBE_FLAG_IN_NETPOLL;
        if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
                int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
@@ -5756,6 +5763,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        if (err)
                goto err_sw_init;
 
+       /* Make it possible the adapter to be woken up via WOL */
+       if (adapter->hw.mac.type == ixgbe_mac_82599EB)
+               IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
+
        /*
         * If there is a fan on this device and it has failed log the
         * failure.
index 9ecad17522c33285fd7b8755cd1eaa3d4d6015bc..1c1efd3869565162ecc9f11b320a9543a5f67e59 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 9b700f5bf1ed5e5859b7a90f11bf9c5dc9966b2f..9cf5f3b4cc5dc38227f2ca4733547cab575e1758 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 84650c6ebe038bcfbebf872b1c56c4804ec50680..9eafddfa1b97f82810e735ef40f4c8c3d9d46f62 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index c146304d8d6ca6398b22a3bef00e10416719fe79..c0ceebccaa49ce38b75df1c9c30a67ec56c4b7b0 100644 (file)
@@ -854,8 +854,8 @@ static void ks_update_link_status(struct net_device *netdev, struct ks_net *ks)
 
 static irqreturn_t ks_irq(int irq, void *pw)
 {
-       struct ks_net *ks = pw;
-       struct net_device *netdev = ks->netdev;
+       struct net_device *netdev = pw;
+       struct ks_net *ks = netdev_priv(netdev);
        u16 status;
 
        /*this should be the first in IRQ handler */
index d9fbad386389718a393437437336d6763644cc7c..43aea91e33699ace0a407bcd018f64a728b492ab 100644 (file)
@@ -206,7 +206,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
                mp->port_aaui = port_aaui;
        else {
                /* Apple Network Server uses the AAUI port */
-               if (machine_is_compatible("AAPL,ShinerESB"))
+               if (of_machine_is_compatible("AAPL,ShinerESB"))
                        mp->port_aaui = 1;
                else {
 #ifdef CONFIG_MACE_AAUI_PORT
index 44f3c2896f2086cf92510b42761cb4b9b08a2eee..79408c37787503aeb0228b6ed09ec9aa2845adb5 100644 (file)
@@ -39,7 +39,6 @@
 #include "mace.h"
 
 static char mac_mace_string[] = "macmace";
-static struct platform_device *mac_mace_device;
 
 #define N_TX_BUFF_ORDER        0
 #define N_TX_RING      (1 << N_TX_BUFF_ORDER)
@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
+MODULE_ALIAS("platform:macmace");
 
 static int __devexit mac_mace_device_remove (struct platform_device *pdev)
 {
@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = {
        .probe  = mace_probe,
        .remove = __devexit_p(mac_mace_device_remove),
        .driver = {
-               .name = mac_mace_string,
+               .name   = mac_mace_string,
+               .owner  = THIS_MODULE,
        },
 };
 
 static int __init mac_mace_init_module(void)
 {
-       int err;
-
        if (!MACH_IS_MAC)
                return -ENODEV;
 
-       if ((err = platform_driver_register(&mac_mace_driver))) {
-               printk(KERN_ERR "Driver registration failed\n");
-               return err;
-       }
-
-       mac_mace_device = platform_device_alloc(mac_mace_string, 0);
-       if (!mac_mace_device)
-               goto out_unregister;
-
-       if (platform_device_add(mac_mace_device)) {
-               platform_device_put(mac_mace_device);
-               mac_mace_device = NULL;
-       }
-
-       return 0;
-
-out_unregister:
-       platform_driver_unregister(&mac_mace_driver);
-
-       return -ENOMEM;
+       return platform_driver_register(&mac_mace_driver);
 }
 
 static void __exit mac_mace_cleanup_module(void)
 {
        platform_driver_unregister(&mac_mace_driver);
-
-       if (mac_mace_device) {
-               platform_device_unregister(mac_mace_device);
-               mac_mace_device = NULL;
-       }
 }
 
 module_init(mac_mace_init_module);
index 875d361fb79d2063dab239284767eb67607c2429..24109c288108109575fdba9d7e0b8cff3c917d9c 100644 (file)
@@ -62,7 +62,6 @@
 #include <asm/mac_via.h>
 
 static char mac_sonic_string[] = "macsonic";
-static struct platform_device *mac_sonic_device;
 
 #include "sonic.h"
 
@@ -607,6 +606,7 @@ out:
 MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
 module_param(sonic_debug, int, 0);
 MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
+MODULE_ALIAS("platform:macsonic");
 
 #include "sonic.c"
 
@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = {
        .probe  = mac_sonic_probe,
        .remove = __devexit_p(mac_sonic_device_remove),
        .driver = {
-               .name = mac_sonic_string,
+               .name   = mac_sonic_string,
+               .owner  = THIS_MODULE,
        },
 };
 
 static int __init mac_sonic_init_module(void)
 {
-       int err;
-
-       if ((err = platform_driver_register(&mac_sonic_driver))) {
-               printk(KERN_ERR "Driver registration failed\n");
-               return err;
-       }
-
-       mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
-       if (!mac_sonic_device)
-               goto out_unregister;
-
-       if (platform_device_add(mac_sonic_device)) {
-               platform_device_put(mac_sonic_device);
-               mac_sonic_device = NULL;
-       }
-
-       return 0;
-
-out_unregister:
-       platform_driver_unregister(&mac_sonic_driver);
-
-       return -ENOMEM;
+       return platform_driver_register(&mac_sonic_driver);
 }
 
 static void __exit mac_sonic_cleanup_module(void)
 {
        platform_driver_unregister(&mac_sonic_driver);
-
-       if (mac_sonic_device) {
-               platform_device_unregister(mac_sonic_device);
-               mac_sonic_device = NULL;
-       }
 }
 
 module_init(mac_sonic_init_module);
index 9f9d6081959b6f64ebfebba1384ec353f175ed64..24279e6e55f5046711a938cfeab782624d11718b 100644 (file)
@@ -1941,7 +1941,7 @@ static void netxen_tx_timeout_task(struct work_struct *work)
                netif_wake_queue(adapter->netdev);
 
                clear_bit(__NX_RESETTING, &adapter->state);
-
+               return;
        } else {
                clear_bit(__NX_RESETTING, &adapter->state);
                if (!netxen_nic_reset_context(adapter)) {
@@ -2240,7 +2240,9 @@ netxen_detach_work(struct work_struct *work)
 
        netxen_nic_down(adapter, netdev);
 
+       rtnl_lock();
        netxen_nic_detach(adapter);
+       rtnl_unlock();
 
        status = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1);
 
index 813aca3fc433eed9d3411091e182e9f95c2602ca..7b17404d085805ec1cccdd631d21b596fe56f622 100644 (file)
@@ -717,6 +717,7 @@ static struct pcmcia_device_id fmvj18x_ids[] = {
        PCMCIA_PFC_DEVICE_PROD_ID12(0, "NEC", "PK-UG-J001" ,0x18df0ba0 ,0x831b1064),
        PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0d0a),
        PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a),
+       PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01),
        PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05),
        PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101),
        PCMCIA_DEVICE_NULL,
index 6dd486d2977ba47c5ea72d98c2ea2d3378ebd435..aa57cfd1e3fbbccb51ce5a868b7c628a1b5b2e4e 100644 (file)
@@ -453,8 +453,7 @@ static int mhz_mfc_config(struct pcmcia_device *link)
 
     link->conf.Attributes |= CONF_ENABLE_SPKR;
     link->conf.Status = CCSR_AUDIO_ENA;
-    link->irq.Attributes =
-       IRQ_TYPE_DYNAMIC_SHARING;
+    link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
     link->io.IOAddrLines = 16;
     link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
     link->io.NumPorts2 = 8;
@@ -652,8 +651,7 @@ static int osi_config(struct pcmcia_device *link)
 
     link->conf.Attributes |= CONF_ENABLE_SPKR;
     link->conf.Status = CCSR_AUDIO_ENA;
-    link->irq.Attributes =
-       IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
+    link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
     link->io.NumPorts1 = 64;
     link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
     link->io.NumPorts2 = 8;
index b0e9f9c517211fbe9257a13f34e511fbbde15885..0295097d6c4435c7fb720e6fe580bd637be33173 100644 (file)
@@ -410,7 +410,6 @@ EXPORT_SYMBOL(phy_start_aneg);
 
 
 static void phy_change(struct work_struct *work);
-static void phy_state_machine(struct work_struct *work);
 
 /**
  * phy_start_machine - start PHY state machine tracking
@@ -430,7 +429,6 @@ void phy_start_machine(struct phy_device *phydev,
 {
        phydev->adjust_state = handler;
 
-       INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine);
        schedule_delayed_work(&phydev->state_queue, HZ);
 }
 
@@ -761,7 +759,7 @@ EXPORT_SYMBOL(phy_start);
  * phy_state_machine - Handle the state machine
  * @work: work_struct that describes the work to be done
  */
-static void phy_state_machine(struct work_struct *work)
+void phy_state_machine(struct work_struct *work)
 {
        struct delayed_work *dwork = to_delayed_work(work);
        struct phy_device *phydev =
index 8212b2b93422efe4cf5efaf2f30c68761171a08c..adbc0fded1305ecad1e44c22cd0fbb6f037d99b6 100644 (file)
@@ -177,6 +177,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
        dev->state = PHY_DOWN;
 
        mutex_init(&dev->lock);
+       INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine);
 
        return dev;
 }
index 707b391afa02e434fb33ac180ac661d358fb7438..894a7c84faeff851d2de5ca2a6112fe3107a7bd5 100644 (file)
@@ -4119,7 +4119,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
        err = pcie_set_readrq(pdev, 4096);
        if (err) {
                dev_err(&pdev->dev, "Set readrq failed.\n");
-               goto err_out;
+               goto err_out1;
        }
 
        err = pci_request_regions(pdev, DRV_NAME);
@@ -4140,7 +4140,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
 
        if (err) {
                dev_err(&pdev->dev, "No usable DMA configuration.\n");
-               goto err_out;
+               goto err_out2;
        }
 
        /* Set PCIe reset type for EEH to fundamental. */
@@ -4152,7 +4152,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
        if (!qdev->reg_base) {
                dev_err(&pdev->dev, "Register mapping failed.\n");
                err = -ENOMEM;
-               goto err_out;
+               goto err_out2;
        }
 
        qdev->doorbell_area_size = pci_resource_len(pdev, 3);
@@ -4162,14 +4162,14 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
        if (!qdev->doorbell_area) {
                dev_err(&pdev->dev, "Doorbell register mapping failed.\n");
                err = -ENOMEM;
-               goto err_out;
+               goto err_out2;
        }
 
        err = ql_get_board_info(qdev);
        if (err) {
                dev_err(&pdev->dev, "Register access failed.\n");
                err = -EIO;
-               goto err_out;
+               goto err_out2;
        }
        qdev->msg_enable = netif_msg_init(debug, default_msg);
        spin_lock_init(&qdev->hw_lock);
@@ -4179,7 +4179,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
        err = qdev->nic_ops->get_flash(qdev);
        if (err) {
                dev_err(&pdev->dev, "Invalid FLASH.\n");
-               goto err_out;
+               goto err_out2;
        }
 
        memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
@@ -4212,8 +4212,9 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
                         DRV_NAME, DRV_VERSION);
        }
        return 0;
-err_out:
+err_out2:
        ql_release_all(pdev);
+err_out1:
        pci_disable_device(pdev);
        return err;
 }
index cc4218667cbad22db8ac13c6e83729caec0dbebf..3c4836d0898f310403f9d44e714793a127514df0 100644 (file)
@@ -3421,7 +3421,7 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
                                break;
                        }
                } else {
-                       if (!(val64 & busy_bit)) {
+                       if (val64 & busy_bit) {
                                ret = SUCCESS;
                                break;
                        }
index 103e8b0e2a0d67e6682cb827e010a7e8f260e025..46997e177ee3661fb6c1d0d57338d6b0268af4ee 100644 (file)
@@ -2284,6 +2284,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
  fail2:
        efx_fini_struct(efx);
  fail1:
+       WARN_ON(rc > 0);
        EFX_LOG(efx, "initialisation failed. rc=%d\n", rc);
        free_netdev(net_dev);
        return rc;
index bf0b96af5334d80eafe634e38b65938259d23446..5712fddd72f2ea839985c3a4cd5f3a05729dc0c1 100644 (file)
 #define FALCON_BOARD_SFN4111T 0x51
 #define FALCON_BOARD_SFN4112F 0x52
 
+/* Board temperature is about 15°C above ambient when air flow is
+ * limited. */
+#define FALCON_BOARD_TEMP_BIAS 15
+
+/* SFC4000 datasheet says: 'The maximum permitted junction temperature
+ * is 125°C; the thermal design of the environment for the SFC4000
+ * should aim to keep this well below 100°C.' */
+#define FALCON_JUNC_TEMP_MAX   90
+
 /*****************************************************************************
  * Support for LM87 sensor chip used on several boards
  */
@@ -548,16 +557,16 @@ fail_hwmon:
 static u8 sfe4002_lm87_channel = 0x03; /* use AIN not FAN inputs */
 
 static const u8 sfe4002_lm87_regs[] = {
-       LM87_IN_LIMITS(0, 0x83, 0x91),          /* 2.5V:  1.8V +/- 5% */
-       LM87_IN_LIMITS(1, 0x51, 0x5a),          /* Vccp1: 1.2V +/- 5% */
-       LM87_IN_LIMITS(2, 0xb6, 0xca),          /* 3.3V:  3.3V +/- 5% */
-       LM87_IN_LIMITS(3, 0xb0, 0xc9),          /* 5V:    4.6-5.2V */
-       LM87_IN_LIMITS(4, 0xb0, 0xe0),          /* 12V:   11-14V */
-       LM87_IN_LIMITS(5, 0x44, 0x4b),          /* Vccp2: 1.0V +/- 5% */
-       LM87_AIN_LIMITS(0, 0xa0, 0xb2),         /* AIN1:  1.66V +/- 5% */
-       LM87_AIN_LIMITS(1, 0x91, 0xa1),         /* AIN2:  1.5V +/- 5% */
-       LM87_TEMP_INT_LIMITS(10, 60),           /* board */
-       LM87_TEMP_EXT1_LIMITS(10, 70),          /* Falcon */
+       LM87_IN_LIMITS(0, 0x7c, 0x99),          /* 2.5V:  1.8V +/- 10% */
+       LM87_IN_LIMITS(1, 0x4c, 0x5e),          /* Vccp1: 1.2V +/- 10% */
+       LM87_IN_LIMITS(2, 0xac, 0xd4),          /* 3.3V:  3.3V +/- 10% */
+       LM87_IN_LIMITS(3, 0xac, 0xd4),          /* 5V:    5.0V +/- 10% */
+       LM87_IN_LIMITS(4, 0xac, 0xe0),          /* 12V:   10.8-14V */
+       LM87_IN_LIMITS(5, 0x3f, 0x4f),          /* Vccp2: 1.0V +/- 10% */
+       LM87_AIN_LIMITS(0, 0x98, 0xbb),         /* AIN1:  1.66V +/- 10% */
+       LM87_AIN_LIMITS(1, 0x8a, 0xa9),         /* AIN2:  1.5V +/- 10% */
+       LM87_TEMP_INT_LIMITS(0, 80 + FALCON_BOARD_TEMP_BIAS),
+       LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX),
        0
 };
 
@@ -619,14 +628,14 @@ static int sfe4002_init(struct efx_nic *efx)
 static u8 sfn4112f_lm87_channel = 0x03; /* use AIN not FAN inputs */
 
 static const u8 sfn4112f_lm87_regs[] = {
-       LM87_IN_LIMITS(0, 0x83, 0x91),          /* 2.5V:  1.8V +/- 5% */
-       LM87_IN_LIMITS(1, 0x51, 0x5a),          /* Vccp1: 1.2V +/- 5% */
-       LM87_IN_LIMITS(2, 0xb6, 0xca),          /* 3.3V:  3.3V +/- 5% */
-       LM87_IN_LIMITS(4, 0xb0, 0xe0),          /* 12V:   11-14V */
-       LM87_IN_LIMITS(5, 0x44, 0x4b),          /* Vccp2: 1.0V +/- 5% */
-       LM87_AIN_LIMITS(1, 0x91, 0xa1),         /* AIN2:  1.5V +/- 5% */
-       LM87_TEMP_INT_LIMITS(10, 60),           /* board */
-       LM87_TEMP_EXT1_LIMITS(10, 70),          /* Falcon */
+       LM87_IN_LIMITS(0, 0x7c, 0x99),          /* 2.5V:  1.8V +/- 10% */
+       LM87_IN_LIMITS(1, 0x4c, 0x5e),          /* Vccp1: 1.2V +/- 10% */
+       LM87_IN_LIMITS(2, 0xac, 0xd4),          /* 3.3V:  3.3V +/- 10% */
+       LM87_IN_LIMITS(4, 0xac, 0xe0),          /* 12V:   10.8-14V */
+       LM87_IN_LIMITS(5, 0x3f, 0x4f),          /* Vccp2: 1.0V +/- 10% */
+       LM87_AIN_LIMITS(1, 0x8a, 0xa9),         /* AIN2:  1.5V +/- 10% */
+       LM87_TEMP_INT_LIMITS(0, 60 + FALCON_BOARD_TEMP_BIAS),
+       LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX),
        0
 };
 
index 683353b904c7b1d603b23d87e78c18807e99f64a..f66b3da6ddffbecc236a7d2e6a83506bb0b71a34 100644 (file)
@@ -127,7 +127,7 @@ static int efx_mcdi_poll(struct efx_nic *efx)
        efx_dword_t reg;
 
        /* Check for a reboot atomically with respect to efx_mcdi_copyout() */
-       rc = efx_mcdi_poll_reboot(efx);
+       rc = -efx_mcdi_poll_reboot(efx);
        if (rc)
                goto out;
 
@@ -142,8 +142,9 @@ static int efx_mcdi_poll(struct efx_nic *efx)
                if (spins != 0) {
                        --spins;
                        udelay(1);
-               } else
-                       schedule();
+               } else {
+                       schedule_timeout_uninterruptible(1);
+               }
 
                time = get_seconds();
 
@@ -803,7 +804,7 @@ int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
                        loff_t offset, u8 *buffer, size_t length)
 {
        u8 inbuf[MC_CMD_NVRAM_READ_IN_LEN];
-       u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(length)];
+       u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(EFX_MCDI_NVRAM_LEN_MAX)];
        size_t outlen;
        int rc;
 
@@ -827,7 +828,7 @@ fail:
 int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
                           loff_t offset, const u8 *buffer, size_t length)
 {
-       u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(length)];
+       u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(EFX_MCDI_NVRAM_LEN_MAX)];
        int rc;
 
        MCDI_SET_DWORD(inbuf, NVRAM_WRITE_IN_TYPE, type);
@@ -837,7 +838,8 @@ int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
 
        BUILD_BUG_ON(MC_CMD_NVRAM_WRITE_OUT_LEN != 0);
 
-       rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, sizeof(inbuf),
+       rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf,
+                         ALIGN(MC_CMD_NVRAM_WRITE_IN_LEN(length), 4),
                          NULL, 0, NULL);
        if (rc)
                goto fail;
index de916728c2e38d0bb308a7f6a6950118c7481cc0..10ce98f4c0fb40d3d466986d53c0a8f0228ca870 100644 (file)
@@ -111,6 +111,7 @@ extern int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
 extern int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
                                loff_t offset, const u8 *buffer,
                                size_t length);
+#define EFX_MCDI_NVRAM_LEN_MAX 128
 extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type,
                                loff_t offset, size_t length);
 extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx,
index 2a85360a46f0e892aa11b0641e5445da0989285c..73e71f42062483b4fcb4df9dc0cb90c4bce09b3d 100644 (file)
 #define MC_CMD_MAC_RX_LANES01_DISP_ERR 57
 #define MC_CMD_MAC_RX_LANES23_DISP_ERR 58
 #define MC_CMD_MAC_RX_MATCH_FAULT 59
+#define MC_CMD_GMAC_DMABUF_START 64
+#define MC_CMD_GMAC_DMABUF_END   95
 /* Insert new members here. */
-#define MC_CMD_MAC_GENERATION_END 60
+#define MC_CMD_MAC_GENERATION_END 96
 #define MC_CMD_MAC_NSTATS (MC_CMD_MAC_GENERATION_END+1)
 
 /* MC_CMD_MAC_STATS:
index 3a464529a46bd64c6e8548b6c6ac6dab29976576..407bbaddfea6e88a95fcd5a869f6715aae4511a5 100644 (file)
@@ -23,7 +23,6 @@
 #include "mcdi_pcol.h"
 
 #define EFX_SPI_VERIFY_BUF_LEN 16
-#define EFX_MCDI_CHUNK_LEN 128
 
 struct efx_mtd_partition {
        struct mtd_info mtd;
@@ -428,7 +427,7 @@ static int siena_mtd_read(struct mtd_info *mtd, loff_t start,
        int rc = 0;
 
        while (offset < end) {
-               chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN);
+               chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX);
                rc = efx_mcdi_nvram_read(efx, part->mcdi.nvram_type, offset,
                                         buffer, chunk);
                if (rc)
@@ -491,7 +490,7 @@ static int siena_mtd_write(struct mtd_info *mtd, loff_t start,
        }
 
        while (offset < end) {
-               chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN);
+               chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX);
                rc = efx_mcdi_nvram_write(efx, part->mcdi.nvram_type, offset,
                                          buffer, chunk);
                if (rc)
index ff8f0a417fa3effb8b508cb7ac2681447da7247a..67eec7a6e48716e000bd6485837471196dd90359 100644 (file)
@@ -318,15 +318,9 @@ static int qt202x_reset_phy(struct efx_nic *efx)
        /* Wait 250ms for the PHY to complete bootup */
        msleep(250);
 
-       /* Check that all the MMDs we expect are present and responding. We
-        * expect faults on some if the link is down, but not on the PHY XS */
-       rc = efx_mdio_check_mmds(efx, QT202X_REQUIRED_DEVS, MDIO_DEVS_PHYXS);
-       if (rc < 0)
-               goto fail;
-
        falcon_board(efx)->type->init_phy(efx);
 
-       return rc;
+       return 0;
 
  fail:
        EFX_ERR(efx, "PHY reset timed out\n");
index af3933579790f8aacc4302f193729552efea4fb2..250c8827b842e57d169dad1a73f8dcf387527c52 100644 (file)
@@ -79,10 +79,14 @@ struct efx_loopback_state {
 static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests)
 {
        int rc = 0;
-       int devad = __ffs(efx->mdio.mmds);
+       int devad;
        u16 physid1, physid2;
 
-       if (efx->phy_type == PHY_TYPE_NONE)
+       if (efx->mdio.mode_support & MDIO_SUPPORTS_C45)
+               devad = __ffs(efx->mdio.mmds);
+       else if (efx->mdio.mode_support & MDIO_SUPPORTS_C22)
+               devad = MDIO_DEVAD_NONE;
+       else
                return 0;
 
        mutex_lock(&efx->mac_lock);
index 37f486b65f630300b6d65ab6b839de7bbcb43112..67249c3c9f5046a471f1790745b2b0ccc83fb0c9 100644 (file)
@@ -644,6 +644,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port)
 {
        u32 reg1;
 
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
        reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
        reg1 &= ~phy_power[port];
 
@@ -651,6 +652,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port)
                reg1 |= coma_mode[port];
 
        sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
        sky2_pci_read32(hw, PCI_DEV_REG1);
 
        if (hw->chip_id == CHIP_ID_YUKON_FE)
@@ -707,9 +709,11 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
                gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN);
        }
 
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
        reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
        reg1 |= phy_power[port];                /* set PHY to PowerDown/COMA Mode */
        sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 }
 
 /* Force a renegotiation */
@@ -1021,11 +1025,8 @@ static void sky2_prefetch_init(struct sky2_hw *hw, u32 qaddr,
 static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2, u16 *slot)
 {
        struct sky2_tx_le *le = sky2->tx_le + *slot;
-       struct tx_ring_info *re = sky2->tx_ring + *slot;
 
        *slot = RING_NEXT(*slot, sky2->tx_ring_size);
-       re->flags = 0;
-       re->skb = NULL;
        le->ctrl = 0;
        return le;
 }
@@ -1618,8 +1619,7 @@ static unsigned tx_le_req(const struct sk_buff *skb)
        return count;
 }
 
-static void sky2_tx_unmap(struct pci_dev *pdev,
-                         const struct tx_ring_info *re)
+static void sky2_tx_unmap(struct pci_dev *pdev, struct tx_ring_info *re)
 {
        if (re->flags & TX_MAP_SINGLE)
                pci_unmap_single(pdev, pci_unmap_addr(re, mapaddr),
@@ -1629,6 +1629,7 @@ static void sky2_tx_unmap(struct pci_dev *pdev,
                pci_unmap_page(pdev, pci_unmap_addr(re, mapaddr),
                               pci_unmap_len(re, maplen),
                               PCI_DMA_TODEVICE);
+       re->flags = 0;
 }
 
 /*
@@ -1835,6 +1836,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
                        dev->stats.tx_packets++;
                        dev->stats.tx_bytes += skb->len;
 
+                       re->skb = NULL;
                        dev_kfree_skb_any(skb);
 
                        sky2->tx_next = RING_NEXT(idx, sky2->tx_ring_size);
@@ -2149,7 +2151,9 @@ static void sky2_qlink_intr(struct sky2_hw *hw)
 
        /* reset PHY Link Detect */
        phy = sky2_pci_read16(hw, PSM_CONFIG_REG4);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
        sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 
        sky2_link_up(sky2);
 }
@@ -2640,6 +2644,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
        if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
                u16 pci_err;
 
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
                pci_err = sky2_pci_read16(hw, PCI_STATUS);
                if (net_ratelimit())
                        dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
@@ -2647,12 +2652,14 @@ static void sky2_hw_intr(struct sky2_hw *hw)
 
                sky2_pci_write16(hw, PCI_STATUS,
                                      pci_err | PCI_STATUS_ERROR_BITS);
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
        }
 
        if (status & Y2_IS_PCI_EXP) {
                /* PCI-Express uncorrectable Error occurred */
                u32 err;
 
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
                err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
                sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
                             0xfffffffful);
@@ -2660,6 +2667,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
                        dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
 
                sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
        }
 
        if (status & Y2_HWE_L1_MASK)
@@ -3038,6 +3046,7 @@ static void sky2_reset(struct sky2_hw *hw)
        }
 
        sky2_power_on(hw);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 
        for (i = 0; i < hw->ports; i++) {
                sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
@@ -3074,6 +3083,7 @@ static void sky2_reset(struct sky2_hw *hw)
                reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE;
 
                /* reset PHY Link Detect */
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
                sky2_pci_write16(hw, PSM_CONFIG_REG4,
                                 reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT);
                sky2_pci_write16(hw, PSM_CONFIG_REG4, reg);
@@ -3091,6 +3101,7 @@ static void sky2_reset(struct sky2_hw *hw)
                        /* restore the PCIe Link Control register */
                        sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg);
                }
+               sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 
                /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */
                sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16));
@@ -3228,6 +3239,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw)
        return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0;
 }
 
+static void sky2_hw_set_wol(struct sky2_hw *hw)
+{
+       int wol = 0;
+       int i;
+
+       for (i = 0; i < hw->ports; i++) {
+               struct net_device *dev = hw->dev[i];
+               struct sky2_port *sky2 = netdev_priv(dev);
+
+               if (sky2->wol)
+                       wol = 1;
+       }
+
+       if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
+           hw->chip_id == CHIP_ID_YUKON_EX ||
+           hw->chip_id == CHIP_ID_YUKON_FE_P)
+               sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
+
+       device_set_wakeup_enable(&hw->pdev->dev, wol);
+}
+
 static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        const struct sky2_port *sky2 = netdev_priv(dev);
@@ -3247,13 +3279,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 
        sky2->wol = wol->wolopts;
 
-       if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
-           hw->chip_id == CHIP_ID_YUKON_EX ||
-           hw->chip_id == CHIP_ID_YUKON_FE_P)
-               sky2_write32(hw, B0_CTST, sky2->wol
-                            ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
-
-       device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);
+       sky2_hw_set_wol(hw);
 
        if (!netif_running(dev))
                sky2_wol_init(sky2);
index 95db60adde4171b5b4f20953b06747c00b946ba2..f9521136a869bde8e313072c26f5979e2f84277a 100644 (file)
@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev)
        if (retval) {
                printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
                       FIRMWARE_RX);
-               return retval;
+               goto out_init;
        }
        if (fw_rx->size % 4) {
                printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
@@ -1108,6 +1108,9 @@ out_tx:
        release_firmware(fw_tx);
 out_rx:
        release_firmware(fw_rx);
+out_init:
+       if (retval)
+               netdev_close(dev);
        return retval;
 }
 
index 75a669d48e5ebc4be3d79b84ee09ff7a50d85845..d71c1976072e7bcbda5739748a9d92bf67b44d17 100644 (file)
@@ -1437,7 +1437,6 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status, int limit)
                /* Transmit complete. */
                lp->lstats.tx_ints++;
                tc35815_txdone(dev);
-               netif_wake_queue(dev);
                if (ret < 0)
                        ret = 0;
        }
index 3a74d21685982f3e82b159d9ae1fa8940c2dce47..7f82b0238e08d3e2cc64892b4d317b58c2103270 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
  * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com)
  * Copyright (C) 2004 Sun Microsystems Inc.
- * Copyright (C) 2005-2009 Broadcom Corporation.
+ * Copyright (C) 2005-2010 Broadcom Corporation.
  *
  * Firmware is:
  *     Derived from proprietary unpublished source code,
@@ -68,8 +68,8 @@
 
 #define DRV_MODULE_NAME                "tg3"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "3.105"
-#define DRV_MODULE_RELDATE     "December 2, 2009"
+#define DRV_MODULE_VERSION     "3.106"
+#define DRV_MODULE_RELDATE     "January 12, 2010"
 
 #define TG3_DEF_MAC_MODE       0
 #define TG3_DEF_RX_MODE                0
@@ -1037,7 +1037,11 @@ static void tg3_mdio_start(struct tg3 *tp)
                else
                        tp->phy_addr = 1;
 
-               is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
+               if (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0)
+                       is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
+               else
+                       is_serdes = tr32(TG3_CPMU_PHY_STRAP) &
+                                   TG3_CPMU_PHY_STRAP_IS_SERDES;
                if (is_serdes)
                        tp->phy_addr += 7;
        } else
@@ -4693,8 +4697,9 @@ next_pkt:
                (*post_ptr)++;
 
                if (unlikely(rx_std_posted >= tp->rx_std_max_post)) {
-                       u32 idx = *post_ptr % TG3_RX_RING_SIZE;
-                       tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, idx);
+                       tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE;
+                       tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG,
+                                    tpr->rx_std_prod_idx);
                        work_mask &= ~RXD_OPAQUE_RING_STD;
                        rx_std_posted = 0;
                }
@@ -7742,7 +7747,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
             ((u64) tpr->rx_std_mapping >> 32));
        tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
             ((u64) tpr->rx_std_mapping & 0xffffffff));
-       if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS))
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717)
                tw32(RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR,
                     NIC_SRAM_RX_BUFFER_DESC);
 
@@ -12122,7 +12127,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 
                tp->phy_id = eeprom_phy_id;
                if (eeprom_phy_serdes) {
-                       if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
+                       if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) ||
+                           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
                                tp->tg3_flags2 |= TG3_FLG2_MII_SERDES;
                        else
                                tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES;
@@ -13384,6 +13390,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        if (err)
                return err;
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
+           (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0 ||
+                (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
+               return -ENOTSUPP;
+
        /* Initialize data/descriptor byte/word swapping. */
        val = tr32(GRC_MODE);
        val &= GRC_MODE_HOST_STACKUP;
index cd30889650f8774c2cab1273584888ee0b0e6ae4..8a167912902b6e13449a18343b21ebf9939a91d8 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
  * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com)
  * Copyright (C) 2004 Sun Microsystems Inc.
+ * Copyright (C) 2007-2010 Broadcom Corporation.
  */
 
 #ifndef _T3_H
 #define  CPMU_MUTEX_REQ_DRIVER          0x00001000
 #define TG3_CPMU_MUTEX_GNT             0x00003660
 #define  CPMU_MUTEX_GNT_DRIVER          0x00001000
+#define TG3_CPMU_PHY_STRAP             0x00003664
+#define TG3_CPMU_PHY_STRAP_IS_SERDES    0x00000020
 /* 0x3664 --> 0x3800 unused */
 
 /* Mbuf cluster free registers */
index 595777dcadb1dfbd565b496374c65b5360a96a81..20696b5d60a5cd48385aa7241c90d80f0d408f96 100644 (file)
@@ -249,6 +249,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
        { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
        { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
        { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */
+       { 0x1414, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Microsoft MN-120 */
        { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
        { } /* terminate list */
 };
index 96bdc0b43889463976ad91d2cbb6d44400ad4ff5..eb8fe7e16c6cdd27319ec1e3a024328bd0d4c99b 100644 (file)
@@ -3279,13 +3279,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
                /* Handle the transmitted buffer and release */
                /* the BD to be used with the current frame  */
 
-               if (bd == ugeth->txBd[txQ]) /* queue empty? */
+               skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
+               if (!skb)
                        break;
 
                dev->stats.tx_packets++;
 
-               skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
-
                if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN &&
                             skb_recycle_check(skb,
                                    ugeth->ug_info->uf_info.max_rx_buf_length +
index 21e183a83b994dd07569a3a925623cccbc785669..5f3b9eaeb04fbc76ea1a721931d331ebe6e4ccd1 100644 (file)
@@ -419,7 +419,7 @@ static int cdc_manage_power(struct usbnet *dev, int on)
 
 static const struct driver_info        cdc_info = {
        .description =  "CDC Ethernet Device",
-       .flags =        FLAG_ETHER | FLAG_LINK_INTR,
+       .flags =        FLAG_ETHER,
        // .check_connect = cdc_check_connect,
        .bind =         cdc_bind,
        .unbind =       usbnet_cdc_unbind,
@@ -583,6 +583,11 @@ static const struct usb_device_id  products [] = {
        USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
        .driver_info = (unsigned long) &mbm_info,
+}, {
+       /* Ericsson C3607w ver 2 */
+       USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
+                       USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
+       .driver_info = (unsigned long) &mbm_info,
 }, {
        /* Toshiba F3507g */
        USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
index c93f58f5c6f2f14be1bbc51ad9133dd15a989f5f..317aa34b21cf6b21c42c81c33f0bb014eeb9948f 100644 (file)
@@ -1877,13 +1877,12 @@ static void velocity_error(struct velocity_info *vptr, int status)
 /**
  *     tx_srv          -       transmit interrupt service
  *     @vptr; Velocity
- *     @status:
  *
  *     Scan the queues looking for transmitted packets that
  *     we can complete and clean up. Update any statistics as
  *     necessary/
  */
-static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
+static int velocity_tx_srv(struct velocity_info *vptr)
 {
        struct tx_desc *td;
        int qnum;
@@ -2090,14 +2089,12 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
 /**
  *     velocity_rx_srv         -       service RX interrupt
  *     @vptr: velocity
- *     @status: adapter status (unused)
  *
  *     Walk the receive ring of the velocity adapter and remove
  *     any received packets from the receive queue. Hand the ring
  *     slots back to the adapter for reuse.
  */
-static int velocity_rx_srv(struct velocity_info *vptr, int status,
-               int budget_left)
+static int velocity_rx_srv(struct velocity_info *vptr, int budget_left)
 {
        struct net_device_stats *stats = &vptr->dev->stats;
        int rd_curr = vptr->rx.curr;
@@ -2151,32 +2148,24 @@ static int velocity_poll(struct napi_struct *napi, int budget)
        struct velocity_info *vptr = container_of(napi,
                        struct velocity_info, napi);
        unsigned int rx_done;
-       u32 isr_status;
-
-       spin_lock(&vptr->lock);
-       isr_status = mac_read_isr(vptr->mac_regs);
-
-       /* Ack the interrupt */
-       mac_write_isr(vptr->mac_regs, isr_status);
-       if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
-               velocity_error(vptr, isr_status);
+       unsigned long flags;
 
+       spin_lock_irqsave(&vptr->lock, flags);
        /*
         * Do rx and tx twice for performance (taken from the VIA
         * out-of-tree driver).
         */
-       rx_done = velocity_rx_srv(vptr, isr_status, budget / 2);
-       velocity_tx_srv(vptr, isr_status);
-       rx_done += velocity_rx_srv(vptr, isr_status, budget - rx_done);
-       velocity_tx_srv(vptr, isr_status);
-
-       spin_unlock(&vptr->lock);
+       rx_done = velocity_rx_srv(vptr, budget / 2);
+       velocity_tx_srv(vptr);
+       rx_done += velocity_rx_srv(vptr, budget - rx_done);
+       velocity_tx_srv(vptr);
 
        /* If budget not fully consumed, exit the polling mode */
        if (rx_done < budget) {
                napi_complete(napi);
                mac_enable_int(vptr->mac_regs);
        }
+       spin_unlock_irqrestore(&vptr->lock, flags);
 
        return rx_done;
 }
@@ -2206,10 +2195,17 @@ static irqreturn_t velocity_intr(int irq, void *dev_instance)
                return IRQ_NONE;
        }
 
+       /* Ack the interrupt */
+       mac_write_isr(vptr->mac_regs, isr_status);
+
        if (likely(napi_schedule_prep(&vptr->napi))) {
                mac_disable_int(vptr->mac_regs);
                __napi_schedule(&vptr->napi);
        }
+
+       if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
+               velocity_error(vptr, isr_status);
+
        spin_unlock(&vptr->lock);
 
        return IRQ_HANDLED;
@@ -3100,7 +3096,7 @@ static int velocity_resume(struct pci_dev *pdev)
        velocity_init_registers(vptr, VELOCITY_INIT_WOL);
        mac_disable_int(vptr->mac_regs);
 
-       velocity_tx_srv(vptr, 0);
+       velocity_tx_srv(vptr);
 
        for (i = 0; i < vptr->tx.numq; i++) {
                if (vptr->tx.used[i])
@@ -3344,6 +3340,7 @@ static int velocity_set_coalesce(struct net_device *dev,
 {
        struct velocity_info *vptr = netdev_priv(dev);
        int max_us = 0x3f * 64;
+       unsigned long flags;
 
        /* 6 bits of  */
        if (ecmd->tx_coalesce_usecs > max_us)
@@ -3365,6 +3362,7 @@ static int velocity_set_coalesce(struct net_device *dev,
                        ecmd->tx_coalesce_usecs);
 
        /* Setup the interrupt suppression and queue timers */
+       spin_lock_irqsave(&vptr->lock, flags);
        mac_disable_int(vptr->mac_regs);
        setup_adaptive_interrupts(vptr);
        setup_queue_timers(vptr);
@@ -3372,6 +3370,7 @@ static int velocity_set_coalesce(struct net_device *dev,
        mac_write_int_mask(vptr->int_mask, vptr->mac_regs);
        mac_clear_isr(vptr->mac_regs);
        mac_enable_int(vptr->mac_regs);
+       spin_unlock_irqrestore(&vptr->lock, flags);
 
        return 0;
 }
index c708ecc3cb2ebaf2e3e5760da53de43cf765d9c9..9ead30bd00c4227522aabc600e8032c02765d82f 100644 (file)
@@ -395,8 +395,7 @@ static void refill_work(struct work_struct *work)
 
        vi = container_of(work, struct virtnet_info, refill.work);
        napi_disable(&vi->napi);
-       try_fill_recv(vi, GFP_KERNEL);
-       still_empty = (vi->num == 0);
+       still_empty = !try_fill_recv(vi, GFP_KERNEL);
        napi_enable(&vi->napi);
 
        /* In theory, this can happen: if we don't get any buffers in
index 5cc0f279417e097796db04a8b61150d355a1fc99..2d7c96d7e865957df251046a7ba5193e94a0c423 100644 (file)
@@ -151,6 +151,7 @@ enum {
 
        /* Device IDs */
        USB_DEVICE_ID_I6050 = 0x0186,
+       USB_DEVICE_ID_I6050_2 = 0x0188,
 };
 
 
@@ -234,6 +235,7 @@ struct i2400mu {
        u8 rx_size_auto_shrink;
 
        struct dentry *debugfs_dentry;
+       unsigned i6050:1;       /* 1 if this is a 6050 based SKU */
 };
 
 
index 3b48681f8a0d50c8db077e8fccd93021a4239f1c..98f4f8c5fb68c8fa1a971cf9bcca9711f36a82ad 100644 (file)
@@ -478,7 +478,16 @@ int i2400mu_probe(struct usb_interface *iface,
        i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack;
        i2400m->bus_bm_mac_addr_impaired = 0;
 
-       if (id->idProduct == USB_DEVICE_ID_I6050) {
+       switch (id->idProduct) {
+       case USB_DEVICE_ID_I6050:
+       case USB_DEVICE_ID_I6050_2:
+               i2400mu->i6050 = 1;
+               break;
+       default:
+               break;
+       }
+
+       if (i2400mu->i6050) {
                i2400m->bus_fw_names = i2400mu_bus_fw_names_6050;
                i2400mu->endpoint_cfg.bulk_out = 0;
                i2400mu->endpoint_cfg.notification = 3;
@@ -719,6 +728,7 @@ int i2400mu_post_reset(struct usb_interface *iface)
 static
 struct usb_device_id i2400mu_id_table[] = {
        { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
+       { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) },
        { USB_DEVICE(0x8086, 0x0181) },
        { USB_DEVICE(0x8086, 0x1403) },
        { USB_DEVICE(0x8086, 0x1405) },
index 5d1c8677f180f2723aa0e986ce6774a353a80477..6a3f4da7fb489a57963c342d31c110a971fed179 100644 (file)
@@ -97,7 +97,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        int ret;
        u16 val;
-       u32 cksum, offset;
+       u32 cksum, offset, eep_max = AR5K_EEPROM_INFO_MAX;
 
        /*
         * Read values from EEPROM and store them in the capability structure
@@ -116,12 +116,38 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
         * Validate the checksum of the EEPROM date. There are some
         * devices with invalid EEPROMs.
         */
-       for (cksum = 0, offset = 0; offset < AR5K_EEPROM_INFO_MAX; offset++) {
+       AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_UPPER, val);
+       if (val) {
+               eep_max = (val & AR5K_EEPROM_SIZE_UPPER_MASK) <<
+                          AR5K_EEPROM_SIZE_ENDLOC_SHIFT;
+               AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_LOWER, val);
+               eep_max = (eep_max | val) - AR5K_EEPROM_INFO_BASE;
+
+               /*
+                * Fail safe check to prevent stupid loops due
+                * to busted EEPROMs. XXX: This value is likely too
+                * big still, waiting on a better value.
+                */
+               if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) {
+                       ATH5K_ERR(ah->ah_sc, "Invalid max custom EEPROM size: "
+                                 "%d (0x%04x) max expected: %d (0x%04x)\n",
+                                 eep_max, eep_max,
+                                 3 * AR5K_EEPROM_INFO_MAX,
+                                 3 * AR5K_EEPROM_INFO_MAX);
+                       return -EIO;
+               }
+       }
+
+       for (cksum = 0, offset = 0; offset < eep_max; offset++) {
                AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val);
                cksum ^= val;
        }
        if (cksum != AR5K_EEPROM_INFO_CKSUM) {
-               ATH5K_ERR(ah->ah_sc, "Invalid EEPROM checksum 0x%04x\n", cksum);
+               ATH5K_ERR(ah->ah_sc, "Invalid EEPROM "
+                         "checksum: 0x%04x eep_max: 0x%04x (%s)\n",
+                         cksum, eep_max,
+                         eep_max == AR5K_EEPROM_INFO_MAX ?
+                               "default size" : "custom size");
                return -EIO;
        }
 
index 0123f3521a0b5600726382b407e1548ac90c365f..473a483bb9c3d6daa08052b1972d1d2aa1867f2b 100644 (file)
 #define AR5K_EEPROM_RFKILL_POLARITY_S  1
 
 #define AR5K_EEPROM_REG_DOMAIN         0x00bf  /* EEPROM regdom */
+
+/* FLASH(EEPROM) Defines for AR531X chips */
+#define AR5K_EEPROM_SIZE_LOWER         0x1b /* size info -- lower */
+#define AR5K_EEPROM_SIZE_UPPER         0x1c /* size info -- upper */
+#define AR5K_EEPROM_SIZE_UPPER_MASK    0xfff0
+#define AR5K_EEPROM_SIZE_UPPER_SHIFT   4
+#define AR5K_EEPROM_SIZE_ENDLOC_SHIFT  12
+
 #define AR5K_EEPROM_CHECKSUM           0x00c0  /* EEPROM checksum */
 #define AR5K_EEPROM_INFO_BASE          0x00c0  /* EEPROM header */
 #define AR5K_EEPROM_INFO_MAX           (0x400 - AR5K_EEPROM_INFO_BASE)
index 03a1106ad7252926cf6c7a88f2e18d229cc1842e..5774cea23a3b12c2faf0784b956ae075692f6c6a 100644 (file)
@@ -25,7 +25,7 @@ config ATH9K
 
 config ATH9K_DEBUGFS
        bool "Atheros ath9k debugging"
-       depends on ATH9K
+       depends on ATH9K && DEBUG_FS
        ---help---
          Say Y, if you need access to ath9k's statistics for
          interrupts, rate control, etc.
index e2cef2ff5d8f2c1ba37068ea8e0a2d52e1c8d3d8..1597a42731edc58c55e3a6a37b69953f57f2623e 100644 (file)
@@ -33,11 +33,11 @@ struct ath_node;
 
 /* Macro to expand scalars to 64-bit objects */
 
-#define        ito64(x) (sizeof(x) == 8) ?                     \
+#define        ito64(x) (sizeof(x) == 1) ?                     \
        (((unsigned long long int)(x)) & (0xff)) :      \
-       (sizeof(x) == 16) ?                             \
+       (sizeof(x) == 2) ?                              \
        (((unsigned long long int)(x)) & 0xffff) :      \
-       ((sizeof(x) == 32) ?                            \
+       ((sizeof(x) == 4) ?                             \
         (((unsigned long long int)(x)) & 0xffffffff) : \
         (unsigned long long int)(x))
 
index 2ec61f08cfdbb073ea02adc1a1947ddf66336793..ae371448b5a0cad6b093b06d64ce3da3bc5e67c7 100644 (file)
@@ -855,12 +855,11 @@ static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
        }
 }
 
-static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah)
+static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah)
 {
        u32 i, j;
 
-       if ((ah->hw_version.devid == AR9280_DEVID_PCI) &&
-           test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) {
+       if (ah->hw_version.devid == AR9280_DEVID_PCI) {
 
                /* EEPROM Fixup */
                for (i = 0; i < ah->iniModes.ia_rows; i++) {
@@ -980,7 +979,7 @@ int ath9k_hw_init(struct ath_hw *ah)
        if (r)
                return r;
 
-       ath9k_hw_init_11a_eeprom_fix(ah);
+       ath9k_hw_init_eeprom_fix(ah);
 
        r = ath9k_hw_init_macaddr(ah);
        if (r) {
index 996eb90263ccba96363b17076504bdccfe8863db..643bea35686fe302f582078226bc3d1e3e531c9a 100644 (file)
@@ -2655,10 +2655,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
            (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
                ath9k_ps_wakeup(sc);
                ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
-               ath_beacon_return(sc, avp);
                ath9k_ps_restore(sc);
        }
 
+       ath_beacon_return(sc, avp);
        sc->sc_flags &= ~SC_OP_BEACONS;
 
        for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
index fa12b9060b0bbc1f0d5ae375501abdb9c2d31a0b..29bf33692f71be2427de03c21ae0d547ebdb844e 100644 (file)
@@ -1615,7 +1615,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
                bf->bf_frmlen -= padsize;
        }
 
-       if (conf_is_ht(&hw->conf) && !is_pae(skb))
+       if (conf_is_ht(&hw->conf))
                bf->bf_state.bf_type |= BUF_HT;
 
        bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq);
@@ -1701,7 +1701,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
                        goto tx_done;
                }
 
-               if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
+               if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) {
                        /*
                         * Try aggregation if it's a unicast data frame
                         * and the destination is HT capable.
index fe3bf949199780bea902d3ad3cad122311c5612f..c484cc25389255f7609a55cdff7b414adeb805fe 100644 (file)
 #define B43_MMIO_TSF_2                 0x636   /* core rev < 3 only */
 #define B43_MMIO_TSF_3                 0x638   /* core rev < 3 only */
 #define B43_MMIO_RNG                   0x65A
+#define B43_MMIO_IFSSLOT               0x684   /* Interframe slot time */
 #define B43_MMIO_IFSCTL                        0x688 /* Interframe space control */
 #define  B43_MMIO_IFSCTL_USE_EDCF      0x0004
 #define B43_MMIO_POWERUP_DELAY         0x6A8
index 4c41cfe44f261494eceaa4080d85d7889344b42c..490fb45d1d053ebbd9c2dd21f5571cbf953eb934 100644 (file)
@@ -628,10 +628,17 @@ static void b43_upload_card_macaddress(struct b43_wldev *dev)
 static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time)
 {
        /* slot_time is in usec. */
-       if (dev->phy.type != B43_PHYTYPE_G)
+       /* This test used to exit for all but a G PHY. */
+       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
                return;
-       b43_write16(dev, 0x684, 510 + slot_time);
-       b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
+       b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time);
+       /* Shared memory location 0x0010 is the slot time and should be
+        * set to slot_time; however, this register is initially 0 and changing
+        * the value adversely affects the transmit rate for BCM4311
+        * devices. Until this behavior is unterstood, delete this step
+        *
+        * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
+        */
 }
 
 static void b43_short_slot_timing_enable(struct b43_wldev *dev)
index 484c5fdf7c2a511143ed569ec11833f7d45d7424..31462813bac0c798bf0749fe35d3265edbdf85f1 100644 (file)
@@ -1961,7 +1961,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
        struct ieee80211_tx_info *info;
        struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
        u32  status = le32_to_cpu(tx_resp->u.status);
-       int tid = MAX_TID_COUNT;
+       int uninitialized_var(tid);
        int sta_id;
        int freed;
        u8 *qc = NULL;
@@ -2008,7 +2008,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                        IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn "
                                           "%d index %d\n", scd_ssn , index);
                        freed = iwl_tx_queue_reclaim(priv, txq_id, index);
-                       priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
+                       iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
                        if (priv->mac80211_registered &&
                            (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
index 33a5866538e7dbbbc0c7b0a13085075a59939fba..cffaae772d513169a356c3aa28e76a692c2b656d 100644 (file)
@@ -1125,7 +1125,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
                                        scd_ssn , index, txq_id, txq->swq_id);
 
                        freed = iwl_tx_queue_reclaim(priv, txq_id, index);
-                       priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
+                       iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
                        if (priv->mac80211_registered &&
                            (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
@@ -1153,16 +1153,14 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
                                   tx_resp->failure_frame);
 
                freed = iwl_tx_queue_reclaim(priv, txq_id, index);
-               if (ieee80211_is_data_qos(tx_resp->frame_ctrl))
-                       priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
+               iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
                if (priv->mac80211_registered &&
                    (iwl_queue_space(&txq->q) > txq->q.low_mark))
                        iwl_wake_queue(priv, txq_id);
        }
 
-       if (ieee80211_is_data_qos(tx_resp->frame_ctrl))
-               iwl_txq_check_empty(priv, sta_id, tid, txq_id);
+       iwl_txq_check_empty(priv, sta_id, tid, txq_id);
 
        if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
                IWL_ERR(priv, "TODO:  Implement Tx ABORT REQUIRED!!!\n");
@@ -1598,6 +1596,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED,
 };
@@ -1622,6 +1621,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 };
 
@@ -1667,6 +1667,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED,
 };
@@ -1691,6 +1692,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED,
 };
@@ -1715,6 +1717,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED,
 };
index 574d366587022fdd101f7826221a1d15900d9782..f36f804804fc2d0a54f3a3e260324738e776bbef 100644 (file)
@@ -2344,6 +2344,21 @@ static void iwl_ht_conf(struct iwl_priv *priv,
        IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
+static inline void iwl_set_no_assoc(struct iwl_priv *priv)
+{
+       priv->assoc_id = 0;
+       iwl_led_disassociate(priv);
+       /*
+        * inform the ucode that there is no longer an
+        * association and that no more packets should be
+        * sent
+        */
+       priv->staging_rxon.filter_flags &=
+               ~RXON_FILTER_ASSOC_MSK;
+       priv->staging_rxon.assoc_id = 0;
+       iwlcore_commit_rxon(priv);
+}
+
 #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
 void iwl_bss_info_changed(struct ieee80211_hw *hw,
                          struct ieee80211_vif *vif,
@@ -2475,20 +2490,8 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
                                        IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
                        if (!iwl_is_rfkill(priv))
                                priv->cfg->ops->lib->post_associate(priv);
-               } else {
-                       priv->assoc_id = 0;
-                       iwl_led_disassociate(priv);
-
-                       /*
-                        * inform the ucode that there is no longer an
-                        * association and that no more packets should be
-                        * send
-                        */
-                       priv->staging_rxon.filter_flags &=
-                               ~RXON_FILTER_ASSOC_MSK;
-                       priv->staging_rxon.assoc_id = 0;
-                       iwlcore_commit_rxon(priv);
-               }
+               } else
+                       iwl_set_no_assoc(priv);
        }
 
        if (changes && iwl_is_associated(priv) && priv->assoc_id) {
@@ -2503,12 +2506,14 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
                }
        }
 
-       if ((changes & BSS_CHANGED_BEACON_ENABLED) &&
-           vif->bss_conf.enable_beacon) {
-               memcpy(priv->staging_rxon.bssid_addr,
-                      bss_conf->bssid, ETH_ALEN);
-               memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN);
-               iwlcore_config_ap(priv);
+       if (changes & BSS_CHANGED_BEACON_ENABLED) {
+               if (vif->bss_conf.enable_beacon) {
+                       memcpy(priv->staging_rxon.bssid_addr,
+                              bss_conf->bssid, ETH_ALEN);
+                       memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN);
+                       iwlcore_config_ap(priv);
+               } else
+                       iwl_set_no_assoc(priv);
        }
 
        mutex_unlock(&priv->mutex);
@@ -2740,6 +2745,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
                        priv->staging_rxon.flags = 0;
 
                iwl_set_rxon_channel(priv, conf->channel);
+               iwl_set_rxon_ht(priv, ht_conf);
 
                iwl_set_flags_for_band(priv, conf->channel->band);
                spin_unlock_irqrestore(&priv->lock, flags);
index 27ca859e7453c250ca70aea6d64ce9820ae6f98d..b69e972671b2c156b208d3615b7370a55e79c252 100644 (file)
@@ -446,6 +446,8 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
 int iwl_hw_tx_queue_init(struct iwl_priv *priv,
                         struct iwl_tx_queue *txq);
 int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq);
+void iwl_free_tfds_in_queue(struct iwl_priv *priv,
+                           int sta_id, int tid, int freed);
 int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
                      int slots_num, u32 txq_id);
 void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id);
index 165d1f6e2dd9304046895b437fd65e0d2f88e580..3822cf53e36850003b1c636a20bbde21d2846e43 100644 (file)
@@ -711,7 +711,7 @@ extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
 extern int iwl_queue_space(const struct iwl_queue *q);
 static inline int iwl_queue_used(const struct iwl_queue *q, int i)
 {
-       return q->write_ptr > q->read_ptr ?
+       return q->write_ptr >= q->read_ptr ?
                (i >= q->read_ptr && i < q->write_ptr) :
                !(i < q->read_ptr && i >= q->write_ptr);
 }
index e7d88d1da15d9d5e2c49d11f7b07d1d4ed1f6363..83cc4e500a96516ec3c0d4c3b65d60e54ca97a27 100644 (file)
@@ -1,3 +1,29 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ *****************************************************************************/
+
 #include <linux/module.h>
 
 /* sparse doesn't like tracepoint macros */
index 21361968ab7e86ce1ed14bd4d8bc917b5df4213c..d9c7363b1bbb0ec4d0f7e971c49eb7f625c40e5d 100644 (file)
@@ -1,3 +1,29 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ *****************************************************************************/
+
 #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
 #define __IWLWIFI_DEVICE_TRACE
 
index 6f36b6e79f5e3db56d72fdcbcab1da493ae41e8a..2dbce85404aa00b03f6cb217b145fcbe8661da5e 100644 (file)
@@ -928,7 +928,10 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
        if (ieee80211_is_mgmt(fc) ||
            ieee80211_has_protected(fc) ||
            ieee80211_has_morefrags(fc) ||
-           le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)
+           le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG ||
+           (ieee80211_is_data_qos(fc) &&
+            *ieee80211_get_qos_ctl(hdr) &
+            IEEE80211_QOS_CONTROL_A_MSDU_PRESENT))
                ret = skb_linearize(skb);
        else
                ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ?
index cde09a890b73f281fc65bf62e14a9dde8ab7bb61..90fbdb25399e14ed32d831cefeac0571ea74f44e 100644 (file)
@@ -297,7 +297,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap, u8 flags,
 }
 EXPORT_SYMBOL(iwl_add_station);
 
-static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
+static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const u8 *addr)
 {
        unsigned long flags;
        u8 sta_id = iwl_find_station(priv, addr);
@@ -324,7 +324,7 @@ static void iwl_remove_sta_callback(struct iwl_priv *priv,
 {
        struct iwl_rem_sta_cmd *rm_sta =
                        (struct iwl_rem_sta_cmd *)cmd->cmd.payload;
-       const char *addr = rm_sta->addr;
+       const u8 *addr = rm_sta->addr;
 
        if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
                IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
index 87ce2bd292c7810630cd382239a15283f82add76..8f407156285768cc992d1f28d1a92d467a97c4a2 100644 (file)
@@ -120,6 +120,20 @@ int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 EXPORT_SYMBOL(iwl_txq_update_write_ptr);
 
 
+void iwl_free_tfds_in_queue(struct iwl_priv *priv,
+                           int sta_id, int tid, int freed)
+{
+       if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
+               priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
+       else {
+               IWL_ERR(priv, "free more than tfds_in_queue (%u:%d)\n",
+                       priv->stations[sta_id].tid[tid].tfds_in_queue,
+                       freed);
+               priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
+       }
+}
+EXPORT_SYMBOL(iwl_free_tfds_in_queue);
+
 /**
  * iwl_tx_queue_free - Deallocate DMA queue.
  * @txq: Transmit queue to deallocate.
@@ -1131,6 +1145,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
        struct iwl_queue *q = &txq->q;
        struct iwl_tx_info *tx_info;
        int nfreed = 0;
+       struct ieee80211_hdr *hdr;
 
        if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
                IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
@@ -1145,13 +1160,16 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
 
                tx_info = &txq->txb[txq->q.read_ptr];
                iwl_tx_status(priv, tx_info->skb[0]);
+
+               hdr = (struct ieee80211_hdr *)tx_info->skb[0]->data;
+               if (hdr && ieee80211_is_data_qos(hdr->frame_control))
+                       nfreed++;
                tx_info->skb[0] = NULL;
 
                if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
                        priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq);
 
                priv->cfg->ops->lib->txq_free_tfd(priv, txq);
-               nfreed++;
        }
        return nfreed;
 }
@@ -1559,7 +1577,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
        if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
                /* calculate mac80211 ampdu sw queue to wake */
                int freed = iwl_tx_queue_reclaim(priv, scd_flow, index);
-               priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
+               iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
                if ((iwl_queue_space(&txq->q) > txq->q.low_mark) &&
                    priv->mac80211_registered &&
index 777584d76a8800f1c4750ea24a3fa4df360835f3..1e41ad0fcad5c8cd5989dcadf0fa1345e6634dc5 100644 (file)
@@ -973,6 +973,10 @@ int iwm_send_pmkid_update(struct iwm_priv *iwm,
 
        memset(&update, 0, sizeof(struct iwm_umac_pmkid_update));
 
+       update.hdr.oid = UMAC_WIFI_IF_CMD_PMKID_UPDATE;
+       update.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_pmkid_update) -
+                                         sizeof(struct iwm_umac_wifi_if));
+
        update.command = cpu_to_le32(command);
        if (pmksa->bssid)
                memcpy(&update.bssid, pmksa->bssid, ETH_ALEN);
index 06af0552cd7522c521a0a138065c26fb246435d7..3dfd9f0e90035ba3043268cc1a53110454e20621 100644 (file)
@@ -463,6 +463,7 @@ struct iwm_umac_cmd_stop_resume_tx {
 #define IWM_CMD_PMKID_FLUSH 3
 
 struct iwm_umac_pmkid_update {
+       struct iwm_umac_wifi_if hdr;
        __le32 command;
        u8 bssid[ETH_ALEN];
        __le16 reserved;
index 6d6ed7485175a6f2d8f8d05793767e08c6f91c69..f727b4a83196bca7b15bf349a44ab1ad243f20a5 100644 (file)
@@ -794,7 +794,7 @@ static int iwm_mlme_update_bss_table(struct iwm_priv *iwm, u8 *buf,
        }
 
        bss->bss = kzalloc(bss_len, GFP_KERNEL);
-       if (!bss) {
+       if (!bss->bss) {
                kfree(bss);
                IWM_ERR(iwm, "Couldn't allocate bss\n");
                return -ENOMEM;
index 59d49159cf2acc1b7c0497d20a642cf762290393..59f92105b0c24880980af6339f6589f469eefa52 100644 (file)
@@ -3157,8 +3157,10 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw,
        /* Clear unsupported feature flags */
        *total_flags &= FIF_ALLMULTI | FIF_BCN_PRBRESP_PROMISC;
 
-       if (mwl8k_fw_lock(hw))
+       if (mwl8k_fw_lock(hw)) {
+               kfree(cmd);
                return;
+       }
 
        if (priv->sniffer_enabled) {
                mwl8k_enable_sniffer(hw, 0);
index a15962a19b2a4b4741400a367a3d3cd4ffdb0681..a72f7c2577de93222b50395fac0249ccdd3d33de 100644 (file)
@@ -197,6 +197,14 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
                        i %= ring_limit;
                        continue;
                }
+
+               if (unlikely(len > priv->common.rx_mtu)) {
+                       if (net_ratelimit())
+                               dev_err(&priv->pdev->dev, "rx'd frame size "
+                                       "exceeds length threshold.\n");
+
+                       len = priv->common.rx_mtu;
+               }
                skb_put(skb, len);
 
                if (p54_rx(dev, skb)) {
index 27bf887f1453ccc175e253c237abdc5516120965..9deae41cb784ef342b64652363232e76acab4bc6 100644 (file)
@@ -340,7 +340,7 @@ static int rt2800_blink_set(struct led_classdev *led_cdev,
        rt2x00_set_field32(&reg, LED_CFG_OFF_PERIOD, *delay_off);
        rt2x00_set_field32(&reg, LED_CFG_SLOW_BLINK_PERIOD, 3);
        rt2x00_set_field32(&reg, LED_CFG_R_LED_MODE, 3);
-       rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE, 12);
+       rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE, 3);
        rt2x00_set_field32(&reg, LED_CFG_Y_LED_MODE, 3);
        rt2x00_set_field32(&reg, LED_CFG_LED_POLAR, 1);
        rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
index 4d841c07c9705e611c4c84c6168d6a283034ec7b..dcfc8c25d1a787491b749ba0b3ca5f770066b981 100644 (file)
 #define ALIGN_SIZE(__skb, __header) \
        (  ((unsigned long)((__skb)->data + (__header))) & 3 )
 
+/*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE      4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE      8 /* Both header & payload need alignment */
+
 /*
  * Standard timing and size defines.
  * These values should follow the ieee80211 specifications.
index 06c43ca39bf8549470331707fb432e807679c0e6..265e66dba552c2e3d0188b6baad46c0a32a4d6fb 100644 (file)
@@ -686,7 +686,17 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize extra TX headroom required.
         */
-       rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+       rt2x00dev->hw->extra_tx_headroom =
+               max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
+                     rt2x00dev->ops->extra_tx_headroom);
+
+       /*
+        * Take TX headroom required for alignment into account.
+        */
+       if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+               rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
+       else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+               rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
 
        /*
         * Register HW.
index 239afc7a9c0bd180f267e961641ebb2d611c3d94..9915a09141ef294ea94bf70d1afea8ac2ae9c5cc 100644 (file)
@@ -104,7 +104,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
         * is also mapped to the DMA so it can be used for transfering
         * additional descriptor information to the hardware.
         */
-       skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
+       skb_push(skb, rt2x00dev->ops->extra_tx_headroom);
 
        skbdesc->skb_dma =
            dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
@@ -112,7 +112,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
        /*
         * Restore data pointer to original location again.
         */
-       skb_pull(skb, rt2x00dev->hw->extra_tx_headroom);
+       skb_pull(skb, rt2x00dev->ops->extra_tx_headroom);
 
        skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
 }
@@ -134,7 +134,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
                 * by the driver, but it was actually mapped to DMA.
                 */
                dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma,
-                                skb->len + rt2x00dev->hw->extra_tx_headroom,
+                                skb->len + rt2x00dev->ops->extra_tx_headroom,
                                 DMA_TO_DEVICE);
                skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
        }
index bc5726dd5fe49f5fc7582f4a94d6bce4402de7af..7ba3052b0708aef88e7b8d32caaf6634b1c709b0 100644 (file)
@@ -65,6 +65,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
        /* Sitecom */
        {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
        {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
+       {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B},
        /* Sphairon Access Systems GmbH */
        {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
        /* Dick Smith Electronics */
index 8ebf5c33955d791551dd20ac107fca41f75c2b97..f14deb0c8514171809b877fdb167e95cd623c23d 100644 (file)
@@ -987,12 +987,13 @@ static void zd_op_configure_filter(struct ieee80211_hw *hw,
        changed_flags &= SUPPORTED_FIF_FLAGS;
        *new_flags &= SUPPORTED_FIF_FLAGS;
 
-       /* changed_flags is always populated but this driver
-        * doesn't support all FIF flags so its possible we don't
-        * need to do anything */
-       if (!changed_flags)
-               return;
-
+       /*
+        * If multicast parameter (as returned by zd_op_prepare_multicast)
+        * has changed, no bit in changed_flags is set. To handle this
+        * situation, we do not return if changed_flags is 0. If we do so,
+        * we will have some issue with IPv6 which uses multicast for link
+        * layer address resolution.
+        */
        if (*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI))
                zd_mc_add_all(&hash);
 
index ac19ecd19cfe07cb9e42d3bdb8f39e0fa226a7e0..72d3e437e1905f674548099f6d9bf22dcb8d1bff 100644 (file)
@@ -62,6 +62,7 @@ static struct usb_device_id usb_ids[] = {
        { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 },
        /* ZD1211B */
        { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
+       { USB_DEVICE(0x0409, 0x0248), .driver_info = DEVICE_ZD1211B },
        { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
        { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B },
        { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B },
index d2fa27c5c1b28e444748214e363bb3c462a43f0e..7cecc8fea9bd799ffd37e7361c7636cbe3bd69f1 100644 (file)
@@ -1,3 +1,11 @@
+config OF_FLATTREE
+       bool
+       depends on OF
+
+config OF_DYNAMIC
+       def_bool y
+       depends on OF && PPC_OF
+
 config OF_DEVICE
        def_bool y
        depends on OF && (SPARC || PPC_OF || MICROBLAZE)
index bdfb5f5d4b06d46d6e05ff2e219cf712328945ef..f232cc98ce00904e9b655c0fd51b6dd5fa3028d4 100644 (file)
@@ -1,4 +1,5 @@
 obj-y = base.o
+obj-$(CONFIG_OF_FLATTREE) += fdt.o
 obj-$(CONFIG_OF_DEVICE) += device.o platform.o
 obj-$(CONFIG_OF_GPIO)   += gpio.o
 obj-$(CONFIG_OF_I2C)   += of_i2c.o
index e6627b2320f16a89a56d30e9a7e00b6c2c80130a..cb96888d142785c4f9ea82f19e1de26ffcd448c7 100644 (file)
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/spinlock.h>
+#include <linux/proc_fs.h>
 
 struct device_node *allnodes;
+struct device_node *of_chosen;
 
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
@@ -37,7 +39,7 @@ int of_n_addr_cells(struct device_node *np)
                        np = np->parent;
                ip = of_get_property(np, "#address-cells", NULL);
                if (ip)
-                       return *ip;
+                       return be32_to_cpup(ip);
        } while (np->parent);
        /* No #address-cells property for the root node */
        return OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
@@ -53,13 +55,88 @@ int of_n_size_cells(struct device_node *np)
                        np = np->parent;
                ip = of_get_property(np, "#size-cells", NULL);
                if (ip)
-                       return *ip;
+                       return be32_to_cpup(ip);
        } while (np->parent);
        /* No #size-cells property for the root node */
        return OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
+/**
+ *     of_node_get - Increment refcount of a node
+ *     @node:  Node to inc refcount, NULL is supported to
+ *             simplify writing of callers
+ *
+ *     Returns node.
+ */
+struct device_node *of_node_get(struct device_node *node)
+{
+       if (node)
+               kref_get(&node->kref);
+       return node;
+}
+EXPORT_SYMBOL(of_node_get);
+
+static inline struct device_node *kref_to_device_node(struct kref *kref)
+{
+       return container_of(kref, struct device_node, kref);
+}
+
+/**
+ *     of_node_release - release a dynamically allocated node
+ *     @kref:  kref element of the node to be released
+ *
+ *     In of_node_put() this function is passed to kref_put()
+ *     as the destructor.
+ */
+static void of_node_release(struct kref *kref)
+{
+       struct device_node *node = kref_to_device_node(kref);
+       struct property *prop = node->properties;
+
+       /* We should never be releasing nodes that haven't been detached. */
+       if (!of_node_check_flag(node, OF_DETACHED)) {
+               pr_err("ERROR: Bad of_node_put() on %s\n", node->full_name);
+               dump_stack();
+               kref_init(&node->kref);
+               return;
+       }
+
+       if (!of_node_check_flag(node, OF_DYNAMIC))
+               return;
+
+       while (prop) {
+               struct property *next = prop->next;
+               kfree(prop->name);
+               kfree(prop->value);
+               kfree(prop);
+               prop = next;
+
+               if (!prop) {
+                       prop = node->deadprops;
+                       node->deadprops = NULL;
+               }
+       }
+       kfree(node->full_name);
+       kfree(node->data);
+       kfree(node);
+}
+
+/**
+ *     of_node_put - Decrement refcount of a node
+ *     @node:  Node to dec refcount, NULL is supported to
+ *             simplify writing of callers
+ *
+ */
+void of_node_put(struct device_node *node)
+{
+       if (node)
+               kref_put(&node->kref, of_node_release);
+}
+EXPORT_SYMBOL(of_node_put);
+#endif /* !CONFIG_SPARC */
+
 struct property *of_find_property(const struct device_node *np,
                                  const char *name,
                                  int *lenp)
@@ -143,6 +220,27 @@ int of_device_is_compatible(const struct device_node *device,
 }
 EXPORT_SYMBOL(of_device_is_compatible);
 
+/**
+ * of_machine_is_compatible - Test root of device tree for a given compatible value
+ * @compat: compatible string to look for in root node's compatible property.
+ *
+ * Returns true if the root node has the given value in its
+ * compatible property.
+ */
+int of_machine_is_compatible(const char *compat)
+{
+       struct device_node *root;
+       int rc = 0;
+
+       root = of_find_node_by_path("/");
+       if (root) {
+               rc = of_device_is_compatible(root, compat);
+               of_node_put(root);
+       }
+       return rc;
+}
+EXPORT_SYMBOL(of_machine_is_compatible);
+
 /**
  *  of_device_is_available - check if a device is available for use
  *
@@ -518,6 +616,27 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
 }
 EXPORT_SYMBOL_GPL(of_modalias_node);
 
+/**
+ * of_find_node_by_phandle - Find a node given a phandle
+ * @handle:    phandle of the node to find
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_phandle(phandle handle)
+{
+       struct device_node *np;
+
+       read_lock(&devtree_lock);
+       for (np = allnodes; np; np = np->allnext)
+               if (np->phandle == handle)
+                       break;
+       of_node_get(np);
+       read_unlock(&devtree_lock);
+       return np;
+}
+EXPORT_SYMBOL(of_find_node_by_phandle);
+
 /**
  * of_parse_phandle - Resolve a phandle property to a device_node pointer
  * @np: Pointer to device node holding phandle property
@@ -578,8 +697,8 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
                                const void **out_args)
 {
        int ret = -EINVAL;
-       const u32 *list;
-       const u32 *list_end;
+       const __be32 *list;
+       const __be32 *list_end;
        int size;
        int cur_index = 0;
        struct device_node *node = NULL;
@@ -593,7 +712,7 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
        list_end = list + size / sizeof(*list);
 
        while (list < list_end) {
-               const u32 *cells;
+               const __be32 *cells;
                const phandle *phandle;
 
                phandle = list++;
@@ -617,7 +736,7 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
                        goto err1;
                }
 
-               list += *cells;
+               list += be32_to_cpup(cells);
                if (list > list_end) {
                        pr_debug("%s: insufficient arguments length\n",
                                 np->full_name);
@@ -658,3 +777,190 @@ err0:
        return ret;
 }
 EXPORT_SYMBOL(of_parse_phandles_with_args);
+
+/**
+ * prom_add_property - Add a property to a node
+ */
+int prom_add_property(struct device_node *np, struct property *prop)
+{
+       struct property **next;
+       unsigned long flags;
+
+       prop->next = NULL;
+       write_lock_irqsave(&devtree_lock, flags);
+       next = &np->properties;
+       while (*next) {
+               if (strcmp(prop->name, (*next)->name) == 0) {
+                       /* duplicate ! don't insert it */
+                       write_unlock_irqrestore(&devtree_lock, flags);
+                       return -1;
+               }
+               next = &(*next)->next;
+       }
+       *next = prop;
+       write_unlock_irqrestore(&devtree_lock, flags);
+
+#ifdef CONFIG_PROC_DEVICETREE
+       /* try to add to proc as well if it was initialized */
+       if (np->pde)
+               proc_device_tree_add_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+       return 0;
+}
+
+/**
+ * prom_remove_property - Remove a property from a node.
+ *
+ * Note that we don't actually remove it, since we have given out
+ * who-knows-how-many pointers to the data using get-property.
+ * Instead we just move the property to the "dead properties"
+ * list, so it won't be found any more.
+ */
+int prom_remove_property(struct device_node *np, struct property *prop)
+{
+       struct property **next;
+       unsigned long flags;
+       int found = 0;
+
+       write_lock_irqsave(&devtree_lock, flags);
+       next = &np->properties;
+       while (*next) {
+               if (*next == prop) {
+                       /* found the node */
+                       *next = prop->next;
+                       prop->next = np->deadprops;
+                       np->deadprops = prop;
+                       found = 1;
+                       break;
+               }
+               next = &(*next)->next;
+       }
+       write_unlock_irqrestore(&devtree_lock, flags);
+
+       if (!found)
+               return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+       /* try to remove the proc node as well */
+       if (np->pde)
+               proc_device_tree_remove_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+       return 0;
+}
+
+/*
+ * prom_update_property - Update a property in a node.
+ *
+ * Note that we don't actually remove it, since we have given out
+ * who-knows-how-many pointers to the data using get-property.
+ * Instead we just move the property to the "dead properties" list,
+ * and add the new property to the property list
+ */
+int prom_update_property(struct device_node *np,
+                        struct property *newprop,
+                        struct property *oldprop)
+{
+       struct property **next;
+       unsigned long flags;
+       int found = 0;
+
+       write_lock_irqsave(&devtree_lock, flags);
+       next = &np->properties;
+       while (*next) {
+               if (*next == oldprop) {
+                       /* found the node */
+                       newprop->next = oldprop->next;
+                       *next = newprop;
+                       oldprop->next = np->deadprops;
+                       np->deadprops = oldprop;
+                       found = 1;
+                       break;
+               }
+               next = &(*next)->next;
+       }
+       write_unlock_irqrestore(&devtree_lock, flags);
+
+       if (!found)
+               return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+       /* try to add to proc as well if it was initialized */
+       if (np->pde)
+               proc_device_tree_update_prop(np->pde, newprop, oldprop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+       return 0;
+}
+
+#if defined(CONFIG_OF_DYNAMIC)
+/*
+ * Support for dynamic device trees.
+ *
+ * On some platforms, the device tree can be manipulated at runtime.
+ * The routines in this section support adding, removing and changing
+ * device tree nodes.
+ */
+
+/**
+ * of_attach_node - Plug a device node into the tree and global list.
+ */
+void of_attach_node(struct device_node *np)
+{
+       unsigned long flags;
+
+       write_lock_irqsave(&devtree_lock, flags);
+       np->sibling = np->parent->child;
+       np->allnext = allnodes;
+       np->parent->child = np;
+       allnodes = np;
+       write_unlock_irqrestore(&devtree_lock, flags);
+}
+
+/**
+ * of_detach_node - "Unplug" a node from the device tree.
+ *
+ * The caller must hold a reference to the node.  The memory associated with
+ * the node is not freed until its refcount goes to zero.
+ */
+void of_detach_node(struct device_node *np)
+{
+       struct device_node *parent;
+       unsigned long flags;
+
+       write_lock_irqsave(&devtree_lock, flags);
+
+       parent = np->parent;
+       if (!parent)
+               goto out_unlock;
+
+       if (allnodes == np)
+               allnodes = np->allnext;
+       else {
+               struct device_node *prev;
+               for (prev = allnodes;
+                    prev->allnext != np;
+                    prev = prev->allnext)
+                       ;
+               prev->allnext = np->allnext;
+       }
+
+       if (parent->child == np)
+               parent->child = np->sibling;
+       else {
+               struct device_node *prevsib;
+               for (prevsib = np->parent->child;
+                    prevsib->sibling != np;
+                    prevsib = prevsib->sibling)
+                       ;
+               prevsib->sibling = np->sibling;
+       }
+
+       of_node_set_flag(np, OF_DETACHED);
+
+out_unlock:
+       write_unlock_irqrestore(&devtree_lock, flags);
+}
+#endif /* defined(CONFIG_OF_DYNAMIC) */
+
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
new file mode 100644 (file)
index 0000000..406757a
--- /dev/null
@@ -0,0 +1,590 @@
+/*
+ * Functions for working with the Flattened Device Tree data format
+ *
+ * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
+ * benh@kernel.crashing.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/initrd.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+
+#ifdef CONFIG_PPC
+#include <asm/machdep.h>
+#endif /* CONFIG_PPC */
+
+#include <asm/page.h>
+
+int __initdata dt_root_addr_cells;
+int __initdata dt_root_size_cells;
+
+struct boot_param_header *initial_boot_params;
+
+char *find_flat_dt_string(u32 offset)
+{
+       return ((char *)initial_boot_params) +
+               be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
+}
+
+/**
+ * of_scan_flat_dt - scan flattened tree blob and call callback on each.
+ * @it: callback function
+ * @data: context data pointer
+ *
+ * This function is used to scan the flattened device-tree, it is
+ * used to extract the memory information at boot before we can
+ * unflatten the tree
+ */
+int __init of_scan_flat_dt(int (*it)(unsigned long node,
+                                    const char *uname, int depth,
+                                    void *data),
+                          void *data)
+{
+       unsigned long p = ((unsigned long)initial_boot_params) +
+               be32_to_cpu(initial_boot_params->off_dt_struct);
+       int rc = 0;
+       int depth = -1;
+
+       do {
+               u32 tag = be32_to_cpup((__be32 *)p);
+               char *pathp;
+
+               p += 4;
+               if (tag == OF_DT_END_NODE) {
+                       depth--;
+                       continue;
+               }
+               if (tag == OF_DT_NOP)
+                       continue;
+               if (tag == OF_DT_END)
+                       break;
+               if (tag == OF_DT_PROP) {
+                       u32 sz = be32_to_cpup((__be32 *)p);
+                       p += 8;
+                       if (be32_to_cpu(initial_boot_params->version) < 0x10)
+                               p = _ALIGN(p, sz >= 8 ? 8 : 4);
+                       p += sz;
+                       p = _ALIGN(p, 4);
+                       continue;
+               }
+               if (tag != OF_DT_BEGIN_NODE) {
+                       pr_err("Invalid tag %x in flat device tree!\n", tag);
+                       return -EINVAL;
+               }
+               depth++;
+               pathp = (char *)p;
+               p = _ALIGN(p + strlen(pathp) + 1, 4);
+               if ((*pathp) == '/') {
+                       char *lp, *np;
+                       for (lp = NULL, np = pathp; *np; np++)
+                               if ((*np) == '/')
+                                       lp = np+1;
+                       if (lp != NULL)
+                               pathp = lp;
+               }
+               rc = it(p, pathp, depth, data);
+               if (rc != 0)
+                       break;
+       } while (1);
+
+       return rc;
+}
+
+/**
+ * of_get_flat_dt_root - find the root node in the flat blob
+ */
+unsigned long __init of_get_flat_dt_root(void)
+{
+       unsigned long p = ((unsigned long)initial_boot_params) +
+               be32_to_cpu(initial_boot_params->off_dt_struct);
+
+       while (be32_to_cpup((__be32 *)p) == OF_DT_NOP)
+               p += 4;
+       BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE);
+       p += 4;
+       return _ALIGN(p + strlen((char *)p) + 1, 4);
+}
+
+/**
+ * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
+ *
+ * This function can be used within scan_flattened_dt callback to get
+ * access to properties
+ */
+void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
+                                unsigned long *size)
+{
+       unsigned long p = node;
+
+       do {
+               u32 tag = be32_to_cpup((__be32 *)p);
+               u32 sz, noff;
+               const char *nstr;
+
+               p += 4;
+               if (tag == OF_DT_NOP)
+                       continue;
+               if (tag != OF_DT_PROP)
+                       return NULL;
+
+               sz = be32_to_cpup((__be32 *)p);
+               noff = be32_to_cpup((__be32 *)(p + 4));
+               p += 8;
+               if (be32_to_cpu(initial_boot_params->version) < 0x10)
+                       p = _ALIGN(p, sz >= 8 ? 8 : 4);
+
+               nstr = find_flat_dt_string(noff);
+               if (nstr == NULL) {
+                       pr_warning("Can't find property index name !\n");
+                       return NULL;
+               }
+               if (strcmp(name, nstr) == 0) {
+                       if (size)
+                               *size = sz;
+                       return (void *)p;
+               }
+               p += sz;
+               p = _ALIGN(p, 4);
+       } while (1);
+}
+
+/**
+ * of_flat_dt_is_compatible - Return true if given node has compat in compatible list
+ * @node: node to test
+ * @compat: compatible string to compare with compatible list.
+ */
+int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+{
+       const char *cp;
+       unsigned long cplen, l;
+
+       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+       if (cp == NULL)
+               return 0;
+       while (cplen > 0) {
+               if (strncasecmp(cp, compat, strlen(compat)) == 0)
+                       return 1;
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       return 0;
+}
+
+static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+                                      unsigned long align)
+{
+       void *res;
+
+       *mem = _ALIGN(*mem, align);
+       res = (void *)*mem;
+       *mem += size;
+
+       return res;
+}
+
+/**
+ * unflatten_dt_node - Alloc and populate a device_node from the flat tree
+ * @p: pointer to node in flat tree
+ * @dad: Parent struct device_node
+ * @allnextpp: pointer to ->allnext from last allocated device_node
+ * @fpsize: Size of the node path up at the current depth.
+ */
+unsigned long __init unflatten_dt_node(unsigned long mem,
+                                       unsigned long *p,
+                                       struct device_node *dad,
+                                       struct device_node ***allnextpp,
+                                       unsigned long fpsize)
+{
+       struct device_node *np;
+       struct property *pp, **prev_pp = NULL;
+       char *pathp;
+       u32 tag;
+       unsigned int l, allocl;
+       int has_name = 0;
+       int new_format = 0;
+
+       tag = be32_to_cpup((__be32 *)(*p));
+       if (tag != OF_DT_BEGIN_NODE) {
+               pr_err("Weird tag at start of node: %x\n", tag);
+               return mem;
+       }
+       *p += 4;
+       pathp = (char *)*p;
+       l = allocl = strlen(pathp) + 1;
+       *p = _ALIGN(*p + l, 4);
+
+       /* version 0x10 has a more compact unit name here instead of the full
+        * path. we accumulate the full path size using "fpsize", we'll rebuild
+        * it later. We detect this because the first character of the name is
+        * not '/'.
+        */
+       if ((*pathp) != '/') {
+               new_format = 1;
+               if (fpsize == 0) {
+                       /* root node: special case. fpsize accounts for path
+                        * plus terminating zero. root node only has '/', so
+                        * fpsize should be 2, but we want to avoid the first
+                        * level nodes to have two '/' so we use fpsize 1 here
+                        */
+                       fpsize = 1;
+                       allocl = 2;
+               } else {
+                       /* account for '/' and path size minus terminal 0
+                        * already in 'l'
+                        */
+                       fpsize += l;
+                       allocl = fpsize;
+               }
+       }
+
+       np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
+                               __alignof__(struct device_node));
+       if (allnextpp) {
+               memset(np, 0, sizeof(*np));
+               np->full_name = ((char *)np) + sizeof(struct device_node);
+               if (new_format) {
+                       char *fn = np->full_name;
+                       /* rebuild full path for new format */
+                       if (dad && dad->parent) {
+                               strcpy(fn, dad->full_name);
+#ifdef DEBUG
+                               if ((strlen(fn) + l + 1) != allocl) {
+                                       pr_debug("%s: p: %d, l: %d, a: %d\n",
+                                               pathp, (int)strlen(fn),
+                                               l, allocl);
+                               }
+#endif
+                               fn += strlen(fn);
+                       }
+                       *(fn++) = '/';
+                       memcpy(fn, pathp, l);
+               } else
+                       memcpy(np->full_name, pathp, l);
+               prev_pp = &np->properties;
+               **allnextpp = np;
+               *allnextpp = &np->allnext;
+               if (dad != NULL) {
+                       np->parent = dad;
+                       /* we temporarily use the next field as `last_child'*/
+                       if (dad->next == NULL)
+                               dad->child = np;
+                       else
+                               dad->next->sibling = np;
+                       dad->next = np;
+               }
+               kref_init(&np->kref);
+       }
+       while (1) {
+               u32 sz, noff;
+               char *pname;
+
+               tag = be32_to_cpup((__be32 *)(*p));
+               if (tag == OF_DT_NOP) {
+                       *p += 4;
+                       continue;
+               }
+               if (tag != OF_DT_PROP)
+                       break;
+               *p += 4;
+               sz = be32_to_cpup((__be32 *)(*p));
+               noff = be32_to_cpup((__be32 *)((*p) + 4));
+               *p += 8;
+               if (be32_to_cpu(initial_boot_params->version) < 0x10)
+                       *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
+
+               pname = find_flat_dt_string(noff);
+               if (pname == NULL) {
+                       pr_info("Can't find property name in list !\n");
+                       break;
+               }
+               if (strcmp(pname, "name") == 0)
+                       has_name = 1;
+               l = strlen(pname) + 1;
+               pp = unflatten_dt_alloc(&mem, sizeof(struct property),
+                                       __alignof__(struct property));
+               if (allnextpp) {
+                       /* We accept flattened tree phandles either in
+                        * ePAPR-style "phandle" properties, or the
+                        * legacy "linux,phandle" properties.  If both
+                        * appear and have different values, things
+                        * will get weird.  Don't do that. */
+                       if ((strcmp(pname, "phandle") == 0) ||
+                           (strcmp(pname, "linux,phandle") == 0)) {
+                               if (np->phandle == 0)
+                                       np->phandle = *((u32 *)*p);
+                       }
+                       /* And we process the "ibm,phandle" property
+                        * used in pSeries dynamic device tree
+                        * stuff */
+                       if (strcmp(pname, "ibm,phandle") == 0)
+                               np->phandle = *((u32 *)*p);
+                       pp->name = pname;
+                       pp->length = sz;
+                       pp->value = (void *)*p;
+                       *prev_pp = pp;
+                       prev_pp = &pp->next;
+               }
+               *p = _ALIGN((*p) + sz, 4);
+       }
+       /* with version 0x10 we may not have the name property, recreate
+        * it here from the unit name if absent
+        */
+       if (!has_name) {
+               char *p1 = pathp, *ps = pathp, *pa = NULL;
+               int sz;
+
+               while (*p1) {
+                       if ((*p1) == '@')
+                               pa = p1;
+                       if ((*p1) == '/')
+                               ps = p1 + 1;
+                       p1++;
+               }
+               if (pa < ps)
+                       pa = p1;
+               sz = (pa - ps) + 1;
+               pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
+                                       __alignof__(struct property));
+               if (allnextpp) {
+                       pp->name = "name";
+                       pp->length = sz;
+                       pp->value = pp + 1;
+                       *prev_pp = pp;
+                       prev_pp = &pp->next;
+                       memcpy(pp->value, ps, sz - 1);
+                       ((char *)pp->value)[sz - 1] = 0;
+                       pr_debug("fixed up name for %s -> %s\n", pathp,
+                               (char *)pp->value);
+               }
+       }
+       if (allnextpp) {
+               *prev_pp = NULL;
+               np->name = of_get_property(np, "name", NULL);
+               np->type = of_get_property(np, "device_type", NULL);
+
+               if (!np->name)
+                       np->name = "<NULL>";
+               if (!np->type)
+                       np->type = "<NULL>";
+       }
+       while (tag == OF_DT_BEGIN_NODE) {
+               mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+               tag = be32_to_cpup((__be32 *)(*p));
+       }
+       if (tag != OF_DT_END_NODE) {
+               pr_err("Weird tag at end of node: %x\n", tag);
+               return mem;
+       }
+       *p += 4;
+       return mem;
+}
+
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+       unsigned long start, end, len;
+       __be32 *prop;
+
+       pr_debug("Looking for initrd properties... ");
+
+       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+       if (!prop)
+               return;
+       start = of_read_ulong(prop, len/4);
+
+       prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+       if (!prop)
+               return;
+       end = of_read_ulong(prop, len/4);
+
+       early_init_dt_setup_initrd_arch(start, end);
+       pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n", start, end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+/**
+ * early_init_dt_scan_root - fetch the top level address and size cells
+ */
+int __init early_init_dt_scan_root(unsigned long node, const char *uname,
+                                  int depth, void *data)
+{
+       __be32 *prop;
+
+       if (depth != 0)
+               return 0;
+
+       dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
+       dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
+
+       prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+       if (prop)
+               dt_root_size_cells = be32_to_cpup(prop);
+       pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
+
+       prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+       if (prop)
+               dt_root_addr_cells = be32_to_cpup(prop);
+       pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
+
+       /* break now */
+       return 1;
+}
+
+u64 __init dt_mem_next_cell(int s, __be32 **cellp)
+{
+       __be32 *p = *cellp;
+
+       *cellp = p + s;
+       return of_read_number(p, s);
+}
+
+/**
+ * early_init_dt_scan_memory - Look for an parse memory nodes
+ */
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+                                    int depth, void *data)
+{
+       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+       __be32 *reg, *endp;
+       unsigned long l;
+
+       /* We are scanning "memory" nodes only */
+       if (type == NULL) {
+               /*
+                * The longtrail doesn't have a device_type on the
+                * /memory node, so look for the node called /memory@0.
+                */
+               if (depth != 1 || strcmp(uname, "memory@0") != 0)
+                       return 0;
+       } else if (strcmp(type, "memory") != 0)
+               return 0;
+
+       reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+       if (reg == NULL)
+               reg = of_get_flat_dt_prop(node, "reg", &l);
+       if (reg == NULL)
+               return 0;
+
+       endp = reg + (l / sizeof(__be32));
+
+       pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
+           uname, l, reg[0], reg[1], reg[2], reg[3]);
+
+       while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
+               u64 base, size;
+
+               base = dt_mem_next_cell(dt_root_addr_cells, &reg);
+               size = dt_mem_next_cell(dt_root_size_cells, &reg);
+
+               if (size == 0)
+                       continue;
+               pr_debug(" - %llx ,  %llx\n", (unsigned long long)base,
+                   (unsigned long long)size);
+
+               early_init_dt_add_memory_arch(base, size);
+       }
+
+       return 0;
+}
+
+int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
+                                    int depth, void *data)
+{
+       unsigned long l;
+       char *p;
+
+       pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+       if (depth != 1 ||
+           (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
+               return 0;
+
+       early_init_dt_check_for_initrd(node);
+
+       /* Retreive command line */
+       p = of_get_flat_dt_prop(node, "bootargs", &l);
+       if (p != NULL && l > 0)
+               strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+#ifndef CONFIG_CMDLINE_FORCE
+       if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
+#endif
+               strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+       early_init_dt_scan_chosen_arch(node);
+
+       pr_debug("Command line is: %s\n", cmd_line);
+
+       /* break now */
+       return 1;
+}
+
+/**
+ * unflatten_device_tree - create tree of device_nodes from flat blob
+ *
+ * unflattens the device-tree passed by the firmware, creating the
+ * tree of struct device_node. It also fills the "name" and "type"
+ * pointers of the nodes so the normal device-tree walking functions
+ * can be used.
+ */
+void __init unflatten_device_tree(void)
+{
+       unsigned long start, mem, size;
+       struct device_node **allnextp = &allnodes;
+
+       pr_debug(" -> unflatten_device_tree()\n");
+
+       /* First pass, scan for size */
+       start = ((unsigned long)initial_boot_params) +
+               be32_to_cpu(initial_boot_params->off_dt_struct);
+       size = unflatten_dt_node(0, &start, NULL, NULL, 0);
+       size = (size | 3) + 1;
+
+       pr_debug("  size is %lx, allocating...\n", size);
+
+       /* Allocate memory for the expanded device tree */
+       mem = early_init_dt_alloc_memory_arch(size + 4,
+                       __alignof__(struct device_node));
+       mem = (unsigned long) __va(mem);
+
+       ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
+
+       pr_debug("  unflattening %lx...\n", mem);
+
+       /* Second pass, do actual unflattening */
+       start = ((unsigned long)initial_boot_params) +
+               be32_to_cpu(initial_boot_params->off_dt_struct);
+       unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
+       if (be32_to_cpup((__be32 *)start) != OF_DT_END)
+               pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
+       if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
+               pr_warning("End of tree marker overwritten: %08x\n",
+                          be32_to_cpu(((__be32 *)mem)[size / 4]));
+       *allnextp = NULL;
+
+       /* Get pointer to OF "/chosen" node for use everywhere */
+       of_chosen = of_find_node_by_path("/chosen");
+       if (of_chosen == NULL)
+               of_chosen = of_find_node_by_path("/chosen@0");
+
+       pr_debug(" <- unflatten_device_tree()\n");
+}
index 6eea601a92043b69f3c95c86aa06ae077327c03a..24c3606217f86a5db00bbf36547ba90d0489e2b2 100644 (file)
@@ -36,7 +36,7 @@ int of_get_gpio_flags(struct device_node *np, int index,
        struct of_gpio_chip *of_gc = NULL;
        int size;
        const void *gpio_spec;
-       const u32 *gpio_cells;
+       const __be32 *gpio_cells;
 
        ret = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index,
                                          &gc, &gpio_spec);
@@ -55,7 +55,7 @@ int of_get_gpio_flags(struct device_node *np, int index,
 
        gpio_cells = of_get_property(gc, "#gpio-cells", &size);
        if (!gpio_cells || size != sizeof(*gpio_cells) ||
-                       *gpio_cells != of_gc->gpio_cells) {
+                       be32_to_cpup(gpio_cells) != of_gc->gpio_cells) {
                pr_debug("%s: wrong #gpio-cells for %s\n",
                         np->full_name, gc->full_name);
                ret = -EINVAL;
@@ -127,7 +127,8 @@ EXPORT_SYMBOL(of_gpio_count);
 int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np,
                         const void *gpio_spec, enum of_gpio_flags *flags)
 {
-       const u32 *gpio = gpio_spec;
+       const __be32 *gpio = gpio_spec;
+       const u32 n = be32_to_cpup(gpio);
 
        /*
         * We're discouraging gpio_cells < 2, since that way you'll have to
@@ -140,13 +141,13 @@ int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np,
                return -EINVAL;
        }
 
-       if (*gpio > of_gc->gc.ngpio)
+       if (n > of_gc->gc.ngpio)
                return -EINVAL;
 
        if (flags)
-               *flags = gpio[1];
+               *flags = be32_to_cpu(gpio[1]);
 
-       return *gpio;
+       return n;
 }
 EXPORT_SYMBOL(of_gpio_simple_xlate);
 
index fa65a2b2ae2e44737edb5d4e19daf767e331bd9c..a3a708e590d00eabbd2ce62105d2bd4c06bbd922 100644 (file)
@@ -25,7 +25,7 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
        for_each_child_of_node(adap_node, node) {
                struct i2c_board_info info = {};
                struct dev_archdata dev_ad = {};
-               const u32 *addr;
+               const __be32 *addr;
                int len;
 
                if (of_modalias_node(node, info.type, sizeof(info.type)) < 0)
@@ -40,7 +40,7 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
 
                info.irq = irq_of_parse_and_map(node, 0);
 
-               info.addr = *addr;
+               info.addr = be32_to_cpup(addr);
 
                dev_archdata_set_node(&dev_ad, node);
                info.archdata = &dev_ad;
index 4b22ba568b19919a1cb81c0164ba248bd90bd17d..18ecae4a4375d461957b04ee8171f1e5e1434b8c 100644 (file)
@@ -51,7 +51,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 
        /* Loop over the child nodes and register a phy_device for each one */
        for_each_child_of_node(np, child) {
-               const u32 *addr;
+               const __be32 *addr;
                int len;
 
                /* A PHY must have a reg property in the range [0-31] */
@@ -68,7 +68,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
                                mdio->irq[*addr] = PHY_POLL;
                }
 
-               phy = get_phy_device(mdio, *addr);
+               phy = get_phy_device(mdio, be32_to_cpup(addr));
                if (!phy) {
                        dev_err(&mdio->dev, "error probing PHY at address %i\n",
                                *addr);
@@ -160,7 +160,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
        struct device_node *net_np;
        char bus_id[MII_BUS_ID_SIZE + 3];
        struct phy_device *phy;
-       const u32 *phy_id;
+       const __be32 *phy_id;
        int sz;
 
        if (!dev->dev.parent)
@@ -174,7 +174,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
        if (!phy_id || sz < sizeof(*phy_id))
                return NULL;
 
-       sprintf(bus_id, PHY_ID_FMT, "0", phy_id[0]);
+       sprintf(bus_id, PHY_ID_FMT, "0", be32_to_cpu(phy_id[0]));
 
        phy = phy_connect(dev, bus_id, hndlr, 0, iface);
        return IS_ERR(phy) ? NULL : phy;
index bed0ed6dcdc1329259c58a72e2b697bfbd72e091..f65f48b9844885c9708596c73aa4f7eeefba1904 100644 (file)
@@ -23,7 +23,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
 {
        struct spi_device *spi;
        struct device_node *nc;
-       const u32 *prop;
+       const __be32 *prop;
        int rc;
        int len;
 
@@ -54,7 +54,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
                        spi_dev_put(spi);
                        continue;
                }
-               spi->chip_select = *prop;
+               spi->chip_select = be32_to_cpup(prop);
 
                /* Mode (clock phase/polarity/etc.) */
                if (of_find_property(nc, "spi-cpha", NULL))
@@ -72,7 +72,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
                        spi_dev_put(spi);
                        continue;
                }
-               spi->max_speed_hz = *prop;
+               spi->max_speed_hz = be32_to_cpup(prop);
 
                /* IRQ */
                spi->irq = irq_of_parse_and_map(nc, 0);
index b1ecefa2a23dac481b77c06e1090a4ef40daa171..7858a117e80b04aab04bd112ed383a66d2e40a40 100644 (file)
@@ -21,17 +21,6 @@ config PCI_MSI
 
           If you don't know what to do here, say N.
 
-config PCI_LEGACY
-       bool "Enable deprecated pci_find_* API"
-       depends on PCI
-       default y
-       help
-         Say Y here if you want to include support for the deprecated
-         pci_find_device() API.  Most drivers have been converted over
-         to using the proper hotplug APIs, so this option serves to
-         include/exclude only a few drivers that are still using this
-         API.
-
 config PCI_DEBUG
        bool "PCI Debugging"
        depends on PCI && DEBUG_KERNEL
index 4df48d58eaa6372109bbcd2ca4c7cd04aaa25a6e..8674c1ebe979955165f5a5e64e4cccbb1af85d50 100644 (file)
@@ -2,14 +2,13 @@
 # Makefile for the PCI bus specific drivers.
 #
 
-obj-y          += access.o bus.o probe.o remove.o pci.o quirks.o \
+obj-y          += access.o bus.o probe.o remove.o pci.o \
                        pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
                        irq.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_SYSFS) += slot.o
 
-obj-$(CONFIG_PCI_LEGACY) += legacy.o
-CFLAGS_legacy.o += -Wno-deprecated-declarations
+obj-$(CONFIG_PCI_QUIRKS) += quirks.o
 
 # Build PCI Express stuff if needed
 obj-$(CONFIG_PCIEPORTBUS) += pcie/
index cef28a79103f06e9178b9c86419c641cad3b74af..712250f5874a88f0acd238429cd6237139a986f9 100644 (file)
 
 #include "pci.h"
 
+void pci_bus_add_resource(struct pci_bus *bus, struct resource *res,
+                         unsigned int flags)
+{
+       struct pci_bus_resource *bus_res;
+
+       bus_res = kzalloc(sizeof(struct pci_bus_resource), GFP_KERNEL);
+       if (!bus_res) {
+               dev_err(&bus->dev, "can't add %pR resource\n", res);
+               return;
+       }
+
+       bus_res->res = res;
+       bus_res->flags = flags;
+       list_add_tail(&bus_res->list, &bus->resources);
+}
+
+struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n)
+{
+       struct pci_bus_resource *bus_res;
+
+       if (n < PCI_BRIDGE_RESOURCE_NUM)
+               return bus->resource[n];
+
+       n -= PCI_BRIDGE_RESOURCE_NUM;
+       list_for_each_entry(bus_res, &bus->resources, list) {
+               if (n-- == 0)
+                       return bus_res->res;
+       }
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(pci_bus_resource_n);
+
+void pci_bus_remove_resources(struct pci_bus *bus)
+{
+       struct pci_bus_resource *bus_res, *tmp;
+       int i;
+
+       for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
+               bus->resource[i] = 0;
+
+       list_for_each_entry_safe(bus_res, tmp, &bus->resources, list) {
+               list_del(&bus_res->list);
+               kfree(bus_res);
+       }
+}
+
 /**
  * pci_bus_alloc_resource - allocate a resource from a parent bus
  * @bus: PCI bus
@@ -36,11 +82,14 @@ int
 pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
                resource_size_t size, resource_size_t align,
                resource_size_t min, unsigned int type_mask,
-               void (*alignf)(void *, struct resource *, resource_size_t,
-                               resource_size_t),
+               resource_size_t (*alignf)(void *,
+                                         const struct resource *,
+                                         resource_size_t,
+                                         resource_size_t),
                void *alignf_data)
 {
        int i, ret = -ENOMEM;
+       struct resource *r;
        resource_size_t max = -1;
 
        type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
@@ -49,8 +98,7 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
        if (!(res->flags & IORESOURCE_MEM_64))
                max = PCIBIOS_MAX_MEM_32;
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               struct resource *r = bus->resource[i];
+       pci_bus_for_each_resource(bus, r, i) {
                if (!r)
                        continue;
 
index 4dd7114964ac6c85bd3db59e5382241f77c3eeb0..efa9f2de51c1ff532a040037c851c425bf974153 100644 (file)
@@ -332,8 +332,6 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
        slot->hotplug_slot->info->attention_status = 0;
        slot->hotplug_slot->info->latch_status = acpiphp_get_latch_status(slot->acpi_slot);
        slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot);
-       slot->hotplug_slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
-       slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
 
        acpiphp_slot->slot = slot;
        snprintf(name, SLOT_NAME_SIZE, "%llu", slot->acpi_slot->sun);
index 8e952fdab7642a83aaedfefeba108826127e8807..cb2fd01eddaed6fa23b679ecadf86d15171e8518 100644 (file)
@@ -720,12 +720,6 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
                        -ret_val);
                goto acpiphp_bus_add_out;
        }
-       /*
-        * try to start anyway.  We could have failed to add
-        * simply because this bus had previously been added
-        * on another add.  Don't bother with the return value
-        * we just keep going.
-        */
        ret_val = acpi_bus_start(device);
 
 acpiphp_bus_add_out:
index 148fb463b81ccc522ad76be7b48b75b369d89390..fb3f84661bdc93c890d63111567216d505ed877b 100644 (file)
@@ -162,6 +162,7 @@ static int __init cpcihp_generic_init(void)
        dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0));
        if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
                err("Invalid bridge device %s", bridge);
+               pci_dev_put(dev);
                return -EINVAL;
        }
        bus = dev->subordinate;
index 9c6a9fd2681229911dd206882df207aeccb5b3d9..d8ffc73668013fe3356ca6b4ea3c35c99ad95c32 100644 (file)
@@ -310,8 +310,6 @@ struct controller {
        u8 first_slot;
        u8 add_support;
        u8 push_flag;
-       enum pci_bus_speed speed;
-       enum pci_bus_speed speed_capability;
        u8 push_button;                 /* 0 = no pushbutton, 1 = pushbutton present */
        u8 slot_switch_type;            /* 0 = no switch, 1 = switch present */
        u8 defeature_PHP;               /* 0 = PHP not supported, 1 = PHP supported */
index 075b4f4b6e0d88ab17cc642bb294c96032187624..f184d1d2ecbebfc9b7f1d27371d8b12af77610f1 100644 (file)
@@ -583,30 +583,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
        return 0;
 }
 
-static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-       struct slot *slot = hotplug_slot->private;
-       struct controller *ctrl = slot->ctrl;
-
-       dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
-
-       *value = ctrl->speed_capability;
-
-       return 0;
-}
-
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-       struct slot *slot = hotplug_slot->private;
-       struct controller *ctrl = slot->ctrl;
-
-       dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
-
-       *value = ctrl->speed;
-
-       return 0;
-}
-
 static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
        .set_attention_status = set_attention_status,
        .enable_slot =          process_SI,
@@ -616,8 +592,6 @@ static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = {
        .get_attention_status = get_attention_status,
        .get_latch_status =     get_latch_status,
        .get_adapter_status =   get_adapter_status,
-       .get_max_bus_speed =    get_max_bus_speed,
-       .get_cur_bus_speed =    get_cur_bus_speed,
 };
 
 #define SLOT_NAME_SIZE 10
@@ -629,6 +603,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
        struct slot *slot;
        struct hotplug_slot *hotplug_slot;
        struct hotplug_slot_info *hotplug_slot_info;
+       struct pci_bus *bus = ctrl->pci_bus;
        u8 number_of_slots;
        u8 slot_device;
        u8 slot_number;
@@ -694,7 +669,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
                        slot->capabilities |= PCISLOT_64_BIT_SUPPORTED;
                if (is_slot66mhz(slot))
                        slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED;
-               if (ctrl->speed == PCI_SPEED_66MHz)
+               if (bus->cur_bus_speed == PCI_SPEED_66MHz)
                        slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
 
                ctrl_slot =
@@ -844,6 +819,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        u32 rc;
        struct controller *ctrl;
        struct pci_func *func;
+       struct pci_bus *bus;
        int err;
 
        err = pci_enable_device(pdev);
@@ -852,6 +828,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        pci_name(pdev), err);
                return err;
        }
+       bus = pdev->subordinate;
 
        /* Need to read VID early b/c it's used to differentiate CPQ and INTC
         * discovery
@@ -929,22 +906,22 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        pci_read_config_byte(pdev, 0x41, &bus_cap);
                        if (bus_cap & 0x80) {
                                dbg("bus max supports 133MHz PCI-X\n");
-                               ctrl->speed_capability = PCI_SPEED_133MHz_PCIX;
+                               bus->max_bus_speed = PCI_SPEED_133MHz_PCIX;
                                break;
                        }
                        if (bus_cap & 0x40) {
                                dbg("bus max supports 100MHz PCI-X\n");
-                               ctrl->speed_capability = PCI_SPEED_100MHz_PCIX;
+                               bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
                                break;
                        }
                        if (bus_cap & 20) {
                                dbg("bus max supports 66MHz PCI-X\n");
-                               ctrl->speed_capability = PCI_SPEED_66MHz_PCIX;
+                               bus->max_bus_speed = PCI_SPEED_66MHz_PCIX;
                                break;
                        }
                        if (bus_cap & 10) {
                                dbg("bus max supports 66MHz PCI\n");
-                               ctrl->speed_capability = PCI_SPEED_66MHz;
+                               bus->max_bus_speed = PCI_SPEED_66MHz;
                                break;
                        }
 
@@ -955,7 +932,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                case PCI_SUB_HPC_ID:
                        /* Original 6500/7000 implementation */
                        ctrl->slot_switch_type = 1;
-                       ctrl->speed_capability = PCI_SPEED_33MHz;
+                       bus->max_bus_speed = PCI_SPEED_33MHz;
                        ctrl->push_button = 0;
                        ctrl->pci_config_space = 1;
                        ctrl->defeature_PHP = 1;
@@ -966,7 +943,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        /* First Pushbutton implementation */
                        ctrl->push_flag = 1;
                        ctrl->slot_switch_type = 1;
-                       ctrl->speed_capability = PCI_SPEED_33MHz;
+                       bus->max_bus_speed = PCI_SPEED_33MHz;
                        ctrl->push_button = 1;
                        ctrl->pci_config_space = 1;
                        ctrl->defeature_PHP = 1;
@@ -976,7 +953,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                case PCI_SUB_HPC_ID_INTC:
                        /* Third party (6500/7000) */
                        ctrl->slot_switch_type = 1;
-                       ctrl->speed_capability = PCI_SPEED_33MHz;
+                       bus->max_bus_speed = PCI_SPEED_33MHz;
                        ctrl->push_button = 0;
                        ctrl->pci_config_space = 1;
                        ctrl->defeature_PHP = 1;
@@ -987,7 +964,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        /* First 66 Mhz implementation */
                        ctrl->push_flag = 1;
                        ctrl->slot_switch_type = 1;
-                       ctrl->speed_capability = PCI_SPEED_66MHz;
+                       bus->max_bus_speed = PCI_SPEED_66MHz;
                        ctrl->push_button = 1;
                        ctrl->pci_config_space = 1;
                        ctrl->defeature_PHP = 1;
@@ -998,7 +975,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        /* First PCI-X implementation, 100MHz */
                        ctrl->push_flag = 1;
                        ctrl->slot_switch_type = 1;
-                       ctrl->speed_capability = PCI_SPEED_100MHz_PCIX;
+                       bus->max_bus_speed = PCI_SPEED_100MHz_PCIX;
                        ctrl->push_button = 1;
                        ctrl->pci_config_space = 1;
                        ctrl->defeature_PHP = 1;
@@ -1015,9 +992,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        case PCI_VENDOR_ID_INTEL:
                /* Check for speed capability (0=33, 1=66) */
                if (subsystem_deviceid & 0x0001)
-                       ctrl->speed_capability = PCI_SPEED_66MHz;
+                       bus->max_bus_speed = PCI_SPEED_66MHz;
                else
-                       ctrl->speed_capability = PCI_SPEED_33MHz;
+                       bus->max_bus_speed = PCI_SPEED_33MHz;
 
                /* Check for push button */
                if (subsystem_deviceid & 0x0002)
@@ -1079,7 +1056,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                                        pdev->bus->number);
 
        dbg("Hotplug controller capabilities:\n");
-       dbg("    speed_capability       %d\n", ctrl->speed_capability);
+       dbg("    speed_capability       %d\n", bus->max_bus_speed);
        dbg("    slot_switch_type       %s\n", ctrl->slot_switch_type ?
                                        "switch present" : "no switch");
        dbg("    defeature_PHP          %s\n", ctrl->defeature_PHP ?
@@ -1142,7 +1119,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        /* Check for 66Mhz operation */
-       ctrl->speed = get_controller_speed(ctrl);
+       bus->cur_bus_speed = get_controller_speed(ctrl);
 
 
        /********************************************************
index 0ff689afa757bb1aa21df038623c4a63c41364f7..e43908d9b5dfedaa822195409ad548301fbc4e8a 100644 (file)
@@ -1130,12 +1130,13 @@ static int is_bridge(struct pci_func * func)
 static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
 {
        struct slot *slot;
+       struct pci_bus *bus = ctrl->pci_bus;
        u8 reg;
        u8 slot_power = readb(ctrl->hpc_reg + SLOT_POWER);
        u16 reg16;
        u32 leds = readl(ctrl->hpc_reg + LED_CONTROL);
 
-       if (ctrl->speed == adapter_speed)
+       if (bus->cur_bus_speed == adapter_speed)
                return 0;
 
        /* We don't allow freq/mode changes if we find another adapter running
@@ -1152,7 +1153,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
                 * lower speed/mode, we allow the new adapter to function at
                 * this rate if supported
                 */
-               if (ctrl->speed < adapter_speed)
+               if (bus->cur_bus_speed < adapter_speed)
                        return 0;
 
                return 1;
@@ -1161,20 +1162,20 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
        /* If the controller doesn't support freq/mode changes and the
         * controller is running at a higher mode, we bail
         */
-       if ((ctrl->speed > adapter_speed) && (!ctrl->pcix_speed_capability))
+       if ((bus->cur_bus_speed > adapter_speed) && (!ctrl->pcix_speed_capability))
                return 1;
 
        /* But we allow the adapter to run at a lower rate if possible */
-       if ((ctrl->speed < adapter_speed) && (!ctrl->pcix_speed_capability))
+       if ((bus->cur_bus_speed < adapter_speed) && (!ctrl->pcix_speed_capability))
                return 0;
 
        /* We try to set the max speed supported by both the adapter and
         * controller
         */
-       if (ctrl->speed_capability < adapter_speed) {
-               if (ctrl->speed == ctrl->speed_capability)
+       if (bus->max_bus_speed < adapter_speed) {
+               if (bus->cur_bus_speed == bus->max_bus_speed)
                        return 0;
-               adapter_speed = ctrl->speed_capability;
+               adapter_speed = bus->max_bus_speed;
        }
 
        writel(0x0L, ctrl->hpc_reg + LED_CONTROL);
@@ -1229,8 +1230,8 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
        pci_write_config_byte(ctrl->pci_dev, 0x43, reg);
 
        /* Only if mode change...*/
-       if (((ctrl->speed == PCI_SPEED_66MHz) && (adapter_speed == PCI_SPEED_66MHz_PCIX)) ||
-               ((ctrl->speed == PCI_SPEED_66MHz_PCIX) && (adapter_speed == PCI_SPEED_66MHz))) 
+       if (((bus->cur_bus_speed == PCI_SPEED_66MHz) && (adapter_speed == PCI_SPEED_66MHz_PCIX)) ||
+               ((bus->cur_bus_speed == PCI_SPEED_66MHz_PCIX) && (adapter_speed == PCI_SPEED_66MHz))) 
                        set_SOGO(ctrl);
 
        wait_for_ctrl_irq(ctrl);
@@ -1243,7 +1244,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
        set_SOGO(ctrl);
        wait_for_ctrl_irq(ctrl);
 
-       ctrl->speed = adapter_speed;
+       bus->cur_bus_speed = adapter_speed;
        slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
 
        info("Successfully changed frequency/mode for adapter in slot %d\n",
@@ -1269,6 +1270,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
  */
 static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
 {
+       struct pci_bus *bus = ctrl->pci_bus;
        u8 hp_slot;
        u8 temp_byte;
        u8 adapter_speed;
@@ -1309,7 +1311,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
                wait_for_ctrl_irq (ctrl);
 
                adapter_speed = get_adapter_speed(ctrl, hp_slot);
-               if (ctrl->speed != adapter_speed)
+               if (bus->cur_bus_speed != adapter_speed)
                        if (set_controller_speed(ctrl, adapter_speed, hp_slot))
                                rc = WRONG_BUS_FREQUENCY;
 
@@ -1426,6 +1428,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
        u32 temp_register = 0xFFFFFFFF;
        u32 rc = 0;
        struct pci_func *new_slot = NULL;
+       struct pci_bus *bus = ctrl->pci_bus;
        struct slot *p_slot;
        struct resource_lists res_lists;
 
@@ -1456,7 +1459,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
        wait_for_ctrl_irq (ctrl);
 
        adapter_speed = get_adapter_speed(ctrl, hp_slot);
-       if (ctrl->speed != adapter_speed)
+       if (bus->cur_bus_speed != adapter_speed)
                if (set_controller_speed(ctrl, adapter_speed, hp_slot))
                        rc = WRONG_BUS_FREQUENCY;
 
index 7485ffda950c013505ff252889647db13e2ca345..d934dd4fa87320a6f6e8e1ac278047bc0dbcd572 100644 (file)
@@ -395,89 +395,40 @@ static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 * value)
        return rc;
 }
 
-static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static int get_max_bus_speed(struct slot *slot)
 {
-       int rc = -ENODEV;
-       struct slot *pslot;
+       int rc;
        u8 mode = 0;
+       enum pci_bus_speed speed;
+       struct pci_bus *bus = slot->hotplug_slot->pci_slot->bus;
 
-       debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__,
-               hotplug_slot, value);
+       debug("%s - Entry slot[%p]\n", __func__, slot);
 
        ibmphp_lock_operations();
-
-       if (hotplug_slot) {
-               pslot = hotplug_slot->private;
-               if (pslot) {
-                       rc = 0;
-                       mode = pslot->supported_bus_mode;
-                       *value = pslot->supported_speed; 
-                       switch (*value) {
-                       case BUS_SPEED_33:
-                               break;
-                       case BUS_SPEED_66:
-                               if (mode == BUS_MODE_PCIX) 
-                                       *value += 0x01;
-                               break;
-                       case BUS_SPEED_100:
-                       case BUS_SPEED_133:
-                               *value = pslot->supported_speed + 0x01;
-                               break;
-                       default:
-                               /* Note (will need to change): there would be soon 256, 512 also */
-                               rc = -ENODEV;
-                       }
-               }
-       }
-
+       mode = slot->supported_bus_mode;
+       speed = slot->supported_speed; 
        ibmphp_unlock_operations();
-       debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value);
-       return rc;
-}
 
-static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-       int rc = -ENODEV;
-       struct slot *pslot;
-       u8 mode = 0;
-
-       debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__,
-               hotplug_slot, value);
-
-       ibmphp_lock_operations();
-
-       if (hotplug_slot) {
-               pslot = hotplug_slot->private;
-               if (pslot) {
-                       rc = get_cur_bus_info(&pslot);
-                       if (!rc) {
-                               mode = pslot->bus_on->current_bus_mode;
-                               *value = pslot->bus_on->current_speed;
-                               switch (*value) {
-                               case BUS_SPEED_33:
-                                       break;
-                               case BUS_SPEED_66:
-                                       if (mode == BUS_MODE_PCIX) 
-                                               *value += 0x01;
-                                       else if (mode == BUS_MODE_PCI)
-                                               ;
-                                       else
-                                               *value = PCI_SPEED_UNKNOWN;
-                                       break;
-                               case BUS_SPEED_100:
-                               case BUS_SPEED_133:
-                                       *value += 0x01;
-                                       break;
-                               default:
-                                       /* Note of change: there would also be 256, 512 soon */
-                                       rc = -ENODEV;
-                               }
-                       }
-               }
+       switch (speed) {
+       case BUS_SPEED_33:
+               break;
+       case BUS_SPEED_66:
+               if (mode == BUS_MODE_PCIX) 
+                       speed += 0x01;
+               break;
+       case BUS_SPEED_100:
+       case BUS_SPEED_133:
+               speed += 0x01;
+               break;
+       default:
+               /* Note (will need to change): there would be soon 256, 512 also */
+               rc = -ENODEV;
        }
 
-       ibmphp_unlock_operations();
-       debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value);
+       if (!rc)
+               bus->max_bus_speed = speed;
+
+       debug("%s - Exit rc[%d] speed[%x]\n", __func__, rc, speed);
        return rc;
 }
 
@@ -572,6 +523,7 @@ static int __init init_ops(void)
                if (slot_cur->bus_on->current_speed == 0xFF) 
                        if (get_cur_bus_info(&slot_cur)) 
                                return -1;
+               get_max_bus_speed(slot_cur);
 
                if (slot_cur->ctrl->options == 0xFF)
                        if (get_hpc_options(slot_cur, &slot_cur->ctrl->options))
@@ -655,6 +607,7 @@ static int validate(struct slot *slot_cur, int opn)
 int ibmphp_update_slot_info(struct slot *slot_cur)
 {
        struct hotplug_slot_info *info;
+       struct pci_bus *bus = slot_cur->hotplug_slot->pci_slot->bus;
        int rc;
        u8 bus_speed;
        u8 mode;
@@ -700,8 +653,7 @@ int ibmphp_update_slot_info(struct slot *slot_cur)
                        bus_speed = PCI_SPEED_UNKNOWN;
        }
 
-       info->cur_bus_speed = bus_speed;
-       info->max_bus_speed = slot_cur->hotplug_slot->info->max_bus_speed;
+       bus->cur_bus_speed = bus_speed;
        // To do: bus_names 
        
        rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info);
@@ -1326,8 +1278,6 @@ struct hotplug_slot_ops ibmphp_hotplug_slot_ops = {
        .get_attention_status =         get_attention_status,
        .get_latch_status =             get_latch_status,
        .get_adapter_status =           get_adapter_present,
-       .get_max_bus_speed =            get_max_bus_speed,
-       .get_cur_bus_speed =            get_cur_bus_speed,
 /*     .get_max_adapter_speed =        get_max_adapter_speed,
        .get_bus_name_status =          get_bus_name,
 */
index c1abac8ab5c326847ca8cca0c2eb33b1fcae4e1e..5becbdee4027019a5c584df5ff5fb3cc99b04cc3 100644 (file)
@@ -245,7 +245,7 @@ static void __init print_ebda_hpc (void)
 
 int __init ibmphp_access_ebda (void)
 {
-       u8 format, num_ctlrs, rio_complete, hs_complete;
+       u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz;
        u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base;
        int rc = 0;
 
@@ -260,7 +260,16 @@ int __init ibmphp_access_ebda (void)
        iounmap (io_mem);
        debug ("returned ebda segment: %x\n", ebda_seg);
        
-       io_mem = ioremap(ebda_seg<<4, 1024);
+       io_mem = ioremap(ebda_seg<<4, 1);
+       if (!io_mem)
+               return -ENOMEM;
+       ebda_sz = readb(io_mem);
+       iounmap(io_mem);
+       debug("ebda size: %d(KiB)\n", ebda_sz);
+       if (ebda_sz == 0)
+               return -ENOMEM;
+
+       io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024));
        if (!io_mem )
                return -ENOMEM;
        next_offset = 0x180;
index c7084f0eca5aaf29678933e7a16cb286ff6b0a3a..1aaf3f32d3cdb39588819cf80cd54141efc05c4f 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/sched.h>
+#include <linux/semaphore.h>
 #include <linux/kthread.h>
 #include "ibmphp.h"
 
index 38183a534b653c6965ffa875c5b699b02f1d58ab..728b119f71ad4dbaadfe65ce51ce1e7b1271bf99 100644 (file)
@@ -64,32 +64,6 @@ static int debug;
 static LIST_HEAD(pci_hotplug_slot_list);
 static DEFINE_MUTEX(pci_hp_mutex);
 
-/* these strings match up with the values in pci_bus_speed */
-static char *pci_bus_speed_strings[] = {
-       "33 MHz PCI",           /* 0x00 */
-       "66 MHz PCI",           /* 0x01 */
-       "66 MHz PCI-X",         /* 0x02 */
-       "100 MHz PCI-X",        /* 0x03 */
-       "133 MHz PCI-X",        /* 0x04 */
-       NULL,                   /* 0x05 */
-       NULL,                   /* 0x06 */
-       NULL,                   /* 0x07 */
-       NULL,                   /* 0x08 */
-       "66 MHz PCI-X 266",     /* 0x09 */
-       "100 MHz PCI-X 266",    /* 0x0a */
-       "133 MHz PCI-X 266",    /* 0x0b */
-       NULL,                   /* 0x0c */
-       NULL,                   /* 0x0d */
-       NULL,                   /* 0x0e */
-       NULL,                   /* 0x0f */
-       NULL,                   /* 0x10 */
-       "66 MHz PCI-X 533",     /* 0x11 */
-       "100 MHz PCI-X 533",    /* 0x12 */
-       "133 MHz PCI-X 533",    /* 0x13 */
-       "2.5 GT/s PCIe",        /* 0x14 */
-       "5.0 GT/s PCIe",        /* 0x15 */
-};
-
 #ifdef CONFIG_HOTPLUG_PCI_CPCI
 extern int cpci_hotplug_init(int debug);
 extern void cpci_hotplug_exit(void);
@@ -118,8 +92,6 @@ GET_STATUS(power_status, u8)
 GET_STATUS(attention_status, u8)
 GET_STATUS(latch_status, u8)
 GET_STATUS(adapter_status, u8)
-GET_STATUS(max_bus_speed, enum pci_bus_speed)
-GET_STATUS(cur_bus_speed, enum pci_bus_speed)
 
 static ssize_t power_read_file(struct pci_slot *slot, char *buf)
 {
@@ -263,60 +235,6 @@ static struct pci_slot_attribute hotplug_slot_attr_presence = {
        .show = presence_read_file,
 };
 
-static char *unknown_speed = "Unknown bus speed";
-
-static ssize_t max_bus_speed_read_file(struct pci_slot *slot, char *buf)
-{
-       char *speed_string;
-       int retval;
-       enum pci_bus_speed value;
-       
-       retval = get_max_bus_speed(slot->hotplug, &value);
-       if (retval)
-               goto exit;
-
-       if (value == PCI_SPEED_UNKNOWN)
-               speed_string = unknown_speed;
-       else
-               speed_string = pci_bus_speed_strings[value];
-       
-       retval = sprintf (buf, "%s\n", speed_string);
-
-exit:
-       return retval;
-}
-
-static struct pci_slot_attribute hotplug_slot_attr_max_bus_speed = {
-       .attr = {.name = "max_bus_speed", .mode = S_IFREG | S_IRUGO},
-       .show = max_bus_speed_read_file,
-};
-
-static ssize_t cur_bus_speed_read_file(struct pci_slot *slot, char *buf)
-{
-       char *speed_string;
-       int retval;
-       enum pci_bus_speed value;
-
-       retval = get_cur_bus_speed(slot->hotplug, &value);
-       if (retval)
-               goto exit;
-
-       if (value == PCI_SPEED_UNKNOWN)
-               speed_string = unknown_speed;
-       else
-               speed_string = pci_bus_speed_strings[value];
-       
-       retval = sprintf (buf, "%s\n", speed_string);
-
-exit:
-       return retval;
-}
-
-static struct pci_slot_attribute hotplug_slot_attr_cur_bus_speed = {
-       .attr = {.name = "cur_bus_speed", .mode = S_IFREG | S_IRUGO},
-       .show = cur_bus_speed_read_file,
-};
-
 static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf,
                size_t count)
 {
@@ -391,26 +309,6 @@ static bool has_adapter_file(struct pci_slot *pci_slot)
        return false;
 }
 
-static bool has_max_bus_speed_file(struct pci_slot *pci_slot)
-{
-       struct hotplug_slot *slot = pci_slot->hotplug;
-       if ((!slot) || (!slot->ops))
-               return false;
-       if (slot->ops->get_max_bus_speed)
-               return true;
-       return false;
-}
-
-static bool has_cur_bus_speed_file(struct pci_slot *pci_slot)
-{
-       struct hotplug_slot *slot = pci_slot->hotplug;
-       if ((!slot) || (!slot->ops))
-               return false;
-       if (slot->ops->get_cur_bus_speed)
-               return true;
-       return false;
-}
-
 static bool has_test_file(struct pci_slot *pci_slot)
 {
        struct hotplug_slot *slot = pci_slot->hotplug;
@@ -456,20 +354,6 @@ static int fs_add_slot(struct pci_slot *slot)
                        goto exit_adapter;
        }
 
-       if (has_max_bus_speed_file(slot)) {
-               retval = sysfs_create_file(&slot->kobj,
-                                       &hotplug_slot_attr_max_bus_speed.attr);
-               if (retval)
-                       goto exit_max_speed;
-       }
-
-       if (has_cur_bus_speed_file(slot)) {
-               retval = sysfs_create_file(&slot->kobj,
-                                       &hotplug_slot_attr_cur_bus_speed.attr);
-               if (retval)
-                       goto exit_cur_speed;
-       }
-
        if (has_test_file(slot)) {
                retval = sysfs_create_file(&slot->kobj,
                                           &hotplug_slot_attr_test.attr);
@@ -480,14 +364,6 @@ static int fs_add_slot(struct pci_slot *slot)
        goto exit;
 
 exit_test:
-       if (has_cur_bus_speed_file(slot))
-               sysfs_remove_file(&slot->kobj,
-                                 &hotplug_slot_attr_cur_bus_speed.attr);
-exit_cur_speed:
-       if (has_max_bus_speed_file(slot))
-               sysfs_remove_file(&slot->kobj,
-                                 &hotplug_slot_attr_max_bus_speed.attr);
-exit_max_speed:
        if (has_adapter_file(slot))
                sysfs_remove_file(&slot->kobj,
                                  &hotplug_slot_attr_presence.attr);
@@ -523,14 +399,6 @@ static void fs_remove_slot(struct pci_slot *slot)
                sysfs_remove_file(&slot->kobj,
                                  &hotplug_slot_attr_presence.attr);
 
-       if (has_max_bus_speed_file(slot))
-               sysfs_remove_file(&slot->kobj,
-                                 &hotplug_slot_attr_max_bus_speed.attr);
-
-       if (has_cur_bus_speed_file(slot))
-               sysfs_remove_file(&slot->kobj,
-                                 &hotplug_slot_attr_cur_bus_speed.attr);
-
        if (has_test_file(slot))
                sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr);
 
index 5674b2075bdc305699388f4e1528f6f951d4fe7b..920f820edf8798dd4c75103d7969eb4061a8d8a5 100644 (file)
@@ -69,8 +69,6 @@ static int get_power_status   (struct hotplug_slot *slot, u8 *value);
 static int get_attention_status        (struct hotplug_slot *slot, u8 *value);
 static int get_latch_status    (struct hotplug_slot *slot, u8 *value);
 static int get_adapter_status  (struct hotplug_slot *slot, u8 *value);
-static int get_max_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
-static int get_cur_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
 
 /**
  * release_slot - free up the memory used by a slot
@@ -113,8 +111,6 @@ static int init_slot(struct controller *ctrl)
        ops->disable_slot = disable_slot;
        ops->get_power_status = get_power_status;
        ops->get_adapter_status = get_adapter_status;
-       ops->get_max_bus_speed = get_max_bus_speed;
-       ops->get_cur_bus_speed = get_cur_bus_speed;
        if (MRL_SENS(ctrl))
                ops->get_latch_status = get_latch_status;
        if (ATTN_LED(ctrl)) {
@@ -227,27 +223,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
        return pciehp_get_adapter_status(slot, value);
 }
 
-static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
-                               enum pci_bus_speed *value)
-{
-       struct slot *slot = hotplug_slot->private;
-
-       ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
-                __func__, slot_name(slot));
-
-       return pciehp_get_max_link_speed(slot, value);
-}
-
-static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-       struct slot *slot = hotplug_slot->private;
-
-       ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
-                __func__, slot_name(slot));
-
-       return pciehp_get_cur_link_speed(slot, value);
-}
-
 static int pciehp_probe(struct pcie_device *dev)
 {
        int rc;
index d6ac1b261dd9d8b9a94185c93006b9739ea04305..9a7f247e8ac155e164158da9fe13fe8b8a640b2c 100644 (file)
@@ -341,6 +341,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
                p_slot->state = POWERON_STATE;
                break;
        default:
+               kfree(info);
                goto out;
        }
        queue_work(pciehp_wq, &info->work);
index 10040d58c8efaa6ec17b71bb52f419f40d2ccb90..40b48f569b1e3daf9c6de0330f4f4f9f2fab4317 100644 (file)
@@ -492,6 +492,7 @@ int pciehp_power_on_slot(struct slot * slot)
        u16 slot_cmd;
        u16 cmd_mask;
        u16 slot_status;
+       u16 lnk_status;
        int retval = 0;
 
        /* Clear sticky power-fault bit from previous power failures */
@@ -523,6 +524,14 @@ int pciehp_power_on_slot(struct slot * slot)
        ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
                 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
 
+       retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
+       if (retval) {
+               ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
+                               __func__);
+               return retval;
+       }
+       pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
+
        return retval;
 }
 
@@ -610,37 +619,6 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value)
-{
-       struct controller *ctrl = slot->ctrl;
-       enum pcie_link_speed lnk_speed;
-       u32     lnk_cap;
-       int retval = 0;
-
-       retval = pciehp_readl(ctrl, PCI_EXP_LNKCAP, &lnk_cap);
-       if (retval) {
-               ctrl_err(ctrl, "%s: Cannot read LNKCAP register\n", __func__);
-               return retval;
-       }
-
-       switch (lnk_cap & 0x000F) {
-       case 1:
-               lnk_speed = PCIE_2_5GB;
-               break;
-       case 2:
-               lnk_speed = PCIE_5_0GB;
-               break;
-       default:
-               lnk_speed = PCIE_LNK_SPEED_UNKNOWN;
-               break;
-       }
-
-       *value = lnk_speed;
-       ctrl_dbg(ctrl, "Max link speed = %d\n", lnk_speed);
-
-       return retval;
-}
-
 int pciehp_get_max_lnk_width(struct slot *slot,
                                 enum pcie_link_width *value)
 {
@@ -691,38 +669,6 @@ int pciehp_get_max_lnk_width(struct slot *slot,
        return retval;
 }
 
-int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value)
-{
-       struct controller *ctrl = slot->ctrl;
-       enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN;
-       int retval = 0;
-       u16 lnk_status;
-
-       retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
-       if (retval) {
-               ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n",
-                        __func__);
-               return retval;
-       }
-
-       switch (lnk_status & PCI_EXP_LNKSTA_CLS) {
-       case 1:
-               lnk_speed = PCIE_2_5GB;
-               break;
-       case 2:
-               lnk_speed = PCIE_5_0GB;
-               break;
-       default:
-               lnk_speed = PCIE_LNK_SPEED_UNKNOWN;
-               break;
-       }
-
-       *value = lnk_speed;
-       ctrl_dbg(ctrl, "Current link speed = %d\n", lnk_speed);
-
-       return retval;
-}
-
 int pciehp_get_cur_lnk_width(struct slot *slot,
                                 enum pcie_link_width *value)
 {
index 21733108addefe3aefc208dd646ae91340903883..0a16444c14c9d46d80ad391d5759cc27e0ab19f9 100644 (file)
@@ -53,17 +53,15 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev)
                busnr = pci_scan_bridge(parent, dev, busnr, pass);
        if (!dev->subordinate)
                return -1;
-       pci_bus_size_bridges(dev->subordinate);
-       pci_bus_assign_resources(parent);
-       pci_enable_bridges(parent);
-       pci_bus_add_devices(parent);
+
        return 0;
 }
 
 int pciehp_configure_device(struct slot *p_slot)
 {
        struct pci_dev *dev;
-       struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
+       struct pci_dev *bridge = p_slot->ctrl->pcie->port;
+       struct pci_bus *parent = bridge->subordinate;
        int num, fn;
        struct controller *ctrl = p_slot->ctrl;
 
@@ -96,12 +94,25 @@ int pciehp_configure_device(struct slot *p_slot)
                                (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) {
                        pciehp_add_bridge(dev);
                }
+               pci_dev_put(dev);
+       }
+
+       pci_assign_unassigned_bridge_resources(bridge);
+
+       for (fn = 0; fn < 8; fn++) {
+               dev = pci_get_slot(parent, PCI_DEVFN(0, fn));
+               if (!dev)
+                       continue;
+               if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
+                       pci_dev_put(dev);
+                       continue;
+               }
                pci_configure_slot(dev);
                pci_dev_put(dev);
        }
 
-       pci_bus_assign_resources(parent);
        pci_bus_add_devices(parent);
+
        return 0;
 }
 
index c159223389ec47664a3c57fb51e8bb580f66e96a..dcaae725fd791185278805bf2b5af343f2ccb290 100644 (file)
@@ -130,10 +130,9 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
        return 0;
 }
 
-static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static enum pci_bus_speed get_max_bus_speed(struct slot *slot)
 {
-       struct slot *slot = (struct slot *)hotplug_slot->private;
-
+       enum pci_bus_speed speed;
        switch (slot->type) {
        case 1:
        case 2:
@@ -141,30 +140,30 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
        case 4:
        case 5:
        case 6:
-               *value = PCI_SPEED_33MHz;       /* speed for case 1-6 */
+               speed = PCI_SPEED_33MHz;        /* speed for case 1-6 */
                break;
        case 7:
        case 8:
-               *value = PCI_SPEED_66MHz;
+               speed = PCI_SPEED_66MHz;
                break;
        case 11:
        case 14:
-               *value = PCI_SPEED_66MHz_PCIX;
+               speed = PCI_SPEED_66MHz_PCIX;
                break;
        case 12:
        case 15:
-               *value = PCI_SPEED_100MHz_PCIX;
+               speed = PCI_SPEED_100MHz_PCIX;
                break;
        case 13:
        case 16:
-               *value = PCI_SPEED_133MHz_PCIX;
+               speed = PCI_SPEED_133MHz_PCIX;
                break;
        default:
-               *value = PCI_SPEED_UNKNOWN;
+               speed = PCI_SPEED_UNKNOWN;
                break;
-
        }
-       return 0;
+
+       return speed;
 }
 
 static int get_children_props(struct device_node *dn, const int **drc_indexes,
@@ -408,6 +407,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
                slot->state = NOT_VALID;
                return -EINVAL;
        }
+
+       slot->bus->max_bus_speed = get_max_bus_speed(slot);
        return 0;
 }
 
@@ -429,7 +430,6 @@ struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
        .get_power_status = get_power_status,
        .get_attention_status = get_attention_status,
        .get_adapter_status = get_adapter_status,
-       .get_max_bus_speed = get_max_bus_speed,
 };
 
 module_init(rpaphp_init);
index 8e210cd76e55c34c617ccabd4c6b752acbd45401..d2627e1c3ac1ba716f42d4f098686cdabee9d7c2 100644 (file)
@@ -333,8 +333,6 @@ struct hpc_ops {
        int (*set_attention_status)(struct slot *slot, u8 status);
        int (*get_latch_status)(struct slot *slot, u8 *status);
        int (*get_adapter_status)(struct slot *slot, u8 *status);
-       int (*get_max_bus_speed)(struct slot *slot, enum pci_bus_speed *speed);
-       int (*get_cur_bus_speed)(struct slot *slot, enum pci_bus_speed *speed);
        int (*get_adapter_speed)(struct slot *slot, enum pci_bus_speed *speed);
        int (*get_mode1_ECC_cap)(struct slot *slot, u8 *mode);
        int (*get_prog_int)(struct slot *slot, u8 *prog_int);
index 8a520a3d0f59c4be93bc5d5f08e56abb246810d8..a5062297f4886e255c6c9f006b1bc729460f84c6 100644 (file)
@@ -65,8 +65,6 @@ static int get_power_status   (struct hotplug_slot *slot, u8 *value);
 static int get_attention_status        (struct hotplug_slot *slot, u8 *value);
 static int get_latch_status    (struct hotplug_slot *slot, u8 *value);
 static int get_adapter_status  (struct hotplug_slot *slot, u8 *value);
-static int get_max_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
-static int get_cur_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
 
 static struct hotplug_slot_ops shpchp_hotplug_slot_ops = {
        .set_attention_status = set_attention_status,
@@ -76,8 +74,6 @@ static struct hotplug_slot_ops shpchp_hotplug_slot_ops = {
        .get_attention_status = get_attention_status,
        .get_latch_status =     get_latch_status,
        .get_adapter_status =   get_adapter_status,
-       .get_max_bus_speed =    get_max_bus_speed,
-       .get_cur_bus_speed =    get_cur_bus_speed,
 };
 
 /**
@@ -279,37 +275,6 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
        return 0;
 }
 
-static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
-                               enum pci_bus_speed *value)
-{
-       struct slot *slot = get_slot(hotplug_slot);
-       int retval;
-
-       ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
-                __func__, slot_name(slot));
-
-       retval = slot->hpc_ops->get_max_bus_speed(slot, value);
-       if (retval < 0)
-               *value = PCI_SPEED_UNKNOWN;
-
-       return 0;
-}
-
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-       struct slot *slot = get_slot(hotplug_slot);
-       int retval;
-
-       ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
-                __func__, slot_name(slot));
-
-       retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
-       if (retval < 0)
-               *value = PCI_SPEED_UNKNOWN;
-
-       return 0;
-}
-
 static int is_shpc_capable(struct pci_dev *dev)
 {
        if ((dev->vendor == PCI_VENDOR_ID_AMD) || (dev->device ==
index b8ab2796e66af83d42dc3f2112f7bd3ca6a651bf..3bba0c0888ff180100d1d8ee1c2e58cbcf5dda73 100644 (file)
@@ -285,17 +285,8 @@ static int board_added(struct slot *p_slot)
                return WRONG_BUS_FREQUENCY;
        }
 
-       rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp);
-       if (rc) {
-               ctrl_err(ctrl, "Can't get bus operation speed\n");
-               return WRONG_BUS_FREQUENCY;
-       }
-
-       rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp);
-       if (rc) {
-               ctrl_err(ctrl, "Can't get max bus operation speed\n");
-               msp = bsp;
-       }
+       bsp = ctrl->pci_dev->bus->cur_bus_speed;
+       msp = ctrl->pci_dev->bus->max_bus_speed;
 
        /* Check if there are other slots or devices on the same bus */
        if (!list_empty(&ctrl->pci_dev->subordinate->devices))
@@ -462,6 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
                p_slot->state = POWERON_STATE;
                break;
        default:
+               kfree(info);
                goto out;
        }
        queue_work(shpchp_wq, &info->work);
index 86dc398477692d61a46eed4828c142de6ea2aeaa..5f5e8d2e35529a2ca9ec92be86eda94f28b4e86f 100644 (file)
@@ -660,6 +660,75 @@ static int hpc_slot_disable(struct slot * slot)
        return retval;
 }
 
+static int shpc_get_cur_bus_speed(struct controller *ctrl)
+{
+       int retval = 0;
+       struct pci_bus *bus = ctrl->pci_dev->subordinate;
+       enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
+       u16 sec_bus_reg = shpc_readw(ctrl, SEC_BUS_CONFIG);
+       u8 pi = shpc_readb(ctrl, PROG_INTERFACE);
+       u8 speed_mode = (pi == 2) ? (sec_bus_reg & 0xF) : (sec_bus_reg & 0x7);
+
+       if ((pi == 1) && (speed_mode > 4)) {
+               retval = -ENODEV;
+               goto out;
+       }
+
+       switch (speed_mode) {
+       case 0x0:
+               bus_speed = PCI_SPEED_33MHz;
+               break;
+       case 0x1:
+               bus_speed = PCI_SPEED_66MHz;
+               break;
+       case 0x2:
+               bus_speed = PCI_SPEED_66MHz_PCIX;
+               break;
+       case 0x3:
+               bus_speed = PCI_SPEED_100MHz_PCIX;
+               break;
+       case 0x4:
+               bus_speed = PCI_SPEED_133MHz_PCIX;
+               break;
+       case 0x5:
+               bus_speed = PCI_SPEED_66MHz_PCIX_ECC;
+               break;
+       case 0x6:
+               bus_speed = PCI_SPEED_100MHz_PCIX_ECC;
+               break;
+       case 0x7:
+               bus_speed = PCI_SPEED_133MHz_PCIX_ECC;
+               break;
+       case 0x8:
+               bus_speed = PCI_SPEED_66MHz_PCIX_266;
+               break;
+       case 0x9:
+               bus_speed = PCI_SPEED_100MHz_PCIX_266;
+               break;
+       case 0xa:
+               bus_speed = PCI_SPEED_133MHz_PCIX_266;
+               break;
+       case 0xb:
+               bus_speed = PCI_SPEED_66MHz_PCIX_533;
+               break;
+       case 0xc:
+               bus_speed = PCI_SPEED_100MHz_PCIX_533;
+               break;
+       case 0xd:
+               bus_speed = PCI_SPEED_133MHz_PCIX_533;
+               break;
+       default:
+               retval = -ENODEV;
+               break;
+       }
+
+ out:
+       bus->cur_bus_speed = bus_speed;
+       dbg("Current bus speed = %d\n", bus_speed);
+       return retval;
+}
+
+
 static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
 {
        int retval;
@@ -720,6 +789,8 @@ static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
        retval = shpc_write_cmd(slot, 0, cmd);
        if (retval)
                ctrl_err(ctrl, "%s: Write command failed!\n", __func__);
+       else
+               shpc_get_cur_bus_speed(ctrl);
 
        return retval;
 }
@@ -803,10 +874,10 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
+static int shpc_get_max_bus_speed(struct controller *ctrl)
 {
        int retval = 0;
-       struct controller *ctrl = slot->ctrl;
+       struct pci_bus *bus = ctrl->pci_dev->subordinate;
        enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
        u8 pi = shpc_readb(ctrl, PROG_INTERFACE);
        u32 slot_avail1 = shpc_readl(ctrl, SLOT_AVAIL1);
@@ -842,79 +913,12 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
                        retval = -ENODEV;
        }
 
-       *value = bus_speed;
+       bus->max_bus_speed = bus_speed;
        ctrl_dbg(ctrl, "Max bus speed = %d\n", bus_speed);
 
        return retval;
 }
 
-static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value)
-{
-       int retval = 0;
-       struct controller *ctrl = slot->ctrl;
-       enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
-       u16 sec_bus_reg = shpc_readw(ctrl, SEC_BUS_CONFIG);
-       u8 pi = shpc_readb(ctrl, PROG_INTERFACE);
-       u8 speed_mode = (pi == 2) ? (sec_bus_reg & 0xF) : (sec_bus_reg & 0x7);
-
-       if ((pi == 1) && (speed_mode > 4)) {
-               *value = PCI_SPEED_UNKNOWN;
-               return -ENODEV;
-       }
-
-       switch (speed_mode) {
-       case 0x0:
-               *value = PCI_SPEED_33MHz;
-               break;
-       case 0x1:
-               *value = PCI_SPEED_66MHz;
-               break;
-       case 0x2:
-               *value = PCI_SPEED_66MHz_PCIX;
-               break;
-       case 0x3:
-               *value = PCI_SPEED_100MHz_PCIX;
-               break;
-       case 0x4:
-               *value = PCI_SPEED_133MHz_PCIX;
-               break;
-       case 0x5:
-               *value = PCI_SPEED_66MHz_PCIX_ECC;
-               break;
-       case 0x6:
-               *value = PCI_SPEED_100MHz_PCIX_ECC;
-               break;
-       case 0x7:
-               *value = PCI_SPEED_133MHz_PCIX_ECC;
-               break;
-       case 0x8:
-               *value = PCI_SPEED_66MHz_PCIX_266;
-               break;
-       case 0x9:
-               *value = PCI_SPEED_100MHz_PCIX_266;
-               break;
-       case 0xa:
-               *value = PCI_SPEED_133MHz_PCIX_266;
-               break;
-       case 0xb:
-               *value = PCI_SPEED_66MHz_PCIX_533;
-               break;
-       case 0xc:
-               *value = PCI_SPEED_100MHz_PCIX_533;
-               break;
-       case 0xd:
-               *value = PCI_SPEED_133MHz_PCIX_533;
-               break;
-       default:
-               *value = PCI_SPEED_UNKNOWN;
-               retval = -ENODEV;
-               break;
-       }
-
-       ctrl_dbg(ctrl, "Current bus speed = %d\n", bus_speed);
-       return retval;
-}
-
 static struct hpc_ops shpchp_hpc_ops = {
        .power_on_slot                  = hpc_power_on_slot,
        .slot_enable                    = hpc_slot_enable,
@@ -926,8 +930,6 @@ static struct hpc_ops shpchp_hpc_ops = {
        .get_latch_status               = hpc_get_latch_status,
        .get_adapter_status             = hpc_get_adapter_status,
 
-       .get_max_bus_speed              = hpc_get_max_bus_speed,
-       .get_cur_bus_speed              = hpc_get_cur_bus_speed,
        .get_adapter_speed              = hpc_get_adapter_speed,
        .get_mode1_ECC_cap              = hpc_get_mode1_ECC_cap,
        .get_prog_int                   = hpc_get_prog_int,
@@ -1086,6 +1088,9 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
        }
        ctrl_dbg(ctrl, "HPC at %s irq=%x\n", pci_name(pdev), pdev->irq);
 
+       shpc_get_max_bus_speed(ctrl);
+       shpc_get_cur_bus_speed(ctrl);
+
        /*
         * If this is the first controller to be initialized,
         * initialize the shpchpd work queue
index 29fa9d26adae28b0e49e0a39e16796439f1c4b4f..071b7dc0094b5eeab56f32ef2c2a13d357334a27 100644 (file)
@@ -47,8 +47,7 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha
        bus = pdev->subordinate;
 
        out += sprintf(buf, "Free resources: memory\n");
-       for (index = 0; index < PCI_BUS_NUM_RESOURCES; index++) {
-               res = bus->resource[index];
+       pci_bus_for_each_resource(bus, res, index) {
                if (res && (res->flags & IORESOURCE_MEM) &&
                                !(res->flags & IORESOURCE_PREFETCH)) {
                        out += sprintf(out, "start = %8.8llx, "
@@ -58,8 +57,7 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha
                }
        }
        out += sprintf(out, "Free resources: prefetchable memory\n");
-       for (index = 0; index < PCI_BUS_NUM_RESOURCES; index++) {
-               res = bus->resource[index];
+       pci_bus_for_each_resource(bus, res, index) {
                if (res && (res->flags & IORESOURCE_MEM) &&
                               (res->flags & IORESOURCE_PREFETCH)) {
                        out += sprintf(out, "start = %8.8llx, "
@@ -69,8 +67,7 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha
                }
        }
        out += sprintf(out, "Free resources: IO\n");
-       for (index = 0; index < PCI_BUS_NUM_RESOURCES; index++) {
-               res = bus->resource[index];
+       pci_bus_for_each_resource(bus, res, index) {
                if (res && (res->flags & IORESOURCE_IO)) {
                        out += sprintf(out, "start = %8.8llx, "
                                        "length = %8.8llx\n",
diff --git a/drivers/pci/legacy.c b/drivers/pci/legacy.c
deleted file mode 100644 (file)
index 871f65c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include "pci.h"
-
-/**
- * pci_find_device - begin or continue searching for a PCI device by vendor/device id
- * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
- * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
- * @from: Previous PCI device found in search, or %NULL for new search.
- *
- * Iterates through the list of known PCI devices.  If a PCI device is found
- * with a matching @vendor and @device, a pointer to its device structure is
- * returned.  Otherwise, %NULL is returned.
- * A new search is initiated by passing %NULL as the @from argument.
- * Otherwise if @from is not %NULL, searches continue from next device
- * on the global list.
- *
- * NOTE: Do not use this function any more; use pci_get_device() instead, as
- * the PCI device returned by this function can disappear at any moment in
- * time.
- */
-struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
-                               struct pci_dev *from)
-{
-       struct pci_dev *pdev;
-
-       pci_dev_get(from);
-       pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
-       pci_dev_put(pdev);
-       return pdev;
-}
-EXPORT_SYMBOL(pci_find_device);
index 7e2829538a4cfc5bf03131971930d4463ded11cf..c0c73913833df3f401499ac2ec6f867ce388404f 100644 (file)
 #include <acpi/acpi_bus.h>
 
 #include <linux/pci-acpi.h>
+#include <linux/pm_runtime.h>
 #include "pci.h"
 
+static DEFINE_MUTEX(pci_acpi_pm_notify_mtx);
+
+/**
+ * pci_acpi_wake_bus - Wake-up notification handler for root buses.
+ * @handle: ACPI handle of a device the notification is for.
+ * @event: Type of the signaled event.
+ * @context: PCI root bus to wake up devices on.
+ */
+static void pci_acpi_wake_bus(acpi_handle handle, u32 event, void *context)
+{
+       struct pci_bus *pci_bus = context;
+
+       if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_bus)
+               pci_pme_wakeup_bus(pci_bus);
+}
+
+/**
+ * pci_acpi_wake_dev - Wake-up notification handler for PCI devices.
+ * @handle: ACPI handle of a device the notification is for.
+ * @event: Type of the signaled event.
+ * @context: PCI device object to wake up.
+ */
+static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
+{
+       struct pci_dev *pci_dev = context;
+
+       if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_dev) {
+               pci_check_pme_status(pci_dev);
+               pm_runtime_resume(&pci_dev->dev);
+               if (pci_dev->subordinate)
+                       pci_pme_wakeup_bus(pci_dev->subordinate);
+       }
+}
+
+/**
+ * add_pm_notifier - Register PM notifier for given ACPI device.
+ * @dev: ACPI device to add the notifier for.
+ * @context: PCI device or bus to check for PME status if an event is signaled.
+ *
+ * NOTE: @dev need not be a run-wake or wake-up device to be a valid source of
+ * PM wake-up events.  For example, wake-up events may be generated for bridges
+ * if one of the devices below the bridge is signaling PME, even if the bridge
+ * itself doesn't have a wake-up GPE associated with it.
+ */
+static acpi_status add_pm_notifier(struct acpi_device *dev,
+                                  acpi_notify_handler handler,
+                                  void *context)
+{
+       acpi_status status = AE_ALREADY_EXISTS;
+
+       mutex_lock(&pci_acpi_pm_notify_mtx);
+
+       if (dev->wakeup.flags.notifier_present)
+               goto out;
+
+       status = acpi_install_notify_handler(dev->handle,
+                                            ACPI_SYSTEM_NOTIFY,
+                                            handler, context);
+       if (ACPI_FAILURE(status))
+               goto out;
+
+       dev->wakeup.flags.notifier_present = true;
+
+ out:
+       mutex_unlock(&pci_acpi_pm_notify_mtx);
+       return status;
+}
+
+/**
+ * remove_pm_notifier - Unregister PM notifier from given ACPI device.
+ * @dev: ACPI device to remove the notifier from.
+ */
+static acpi_status remove_pm_notifier(struct acpi_device *dev,
+                                     acpi_notify_handler handler)
+{
+       acpi_status status = AE_BAD_PARAMETER;
+
+       mutex_lock(&pci_acpi_pm_notify_mtx);
+
+       if (!dev->wakeup.flags.notifier_present)
+               goto out;
+
+       status = acpi_remove_notify_handler(dev->handle,
+                                           ACPI_SYSTEM_NOTIFY,
+                                           handler);
+       if (ACPI_FAILURE(status))
+               goto out;
+
+       dev->wakeup.flags.notifier_present = false;
+
+ out:
+       mutex_unlock(&pci_acpi_pm_notify_mtx);
+       return status;
+}
+
+/**
+ * pci_acpi_add_bus_pm_notifier - Register PM notifier for given PCI bus.
+ * @dev: ACPI device to add the notifier for.
+ * @pci_bus: PCI bus to walk checking for PME status if an event is signaled.
+ */
+acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev,
+                                        struct pci_bus *pci_bus)
+{
+       return add_pm_notifier(dev, pci_acpi_wake_bus, pci_bus);
+}
+
+/**
+ * pci_acpi_remove_bus_pm_notifier - Unregister PCI bus PM notifier.
+ * @dev: ACPI device to remove the notifier from.
+ */
+acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
+{
+       return remove_pm_notifier(dev, pci_acpi_wake_bus);
+}
+
+/**
+ * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device.
+ * @dev: ACPI device to add the notifier for.
+ * @pci_dev: PCI device to check for the PME status if an event is signaled.
+ */
+acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
+                                    struct pci_dev *pci_dev)
+{
+       return add_pm_notifier(dev, pci_acpi_wake_dev, pci_dev);
+}
+
+/**
+ * pci_acpi_remove_pm_notifier - Unregister PCI device PM notifier.
+ * @dev: ACPI device to remove the notifier from.
+ */
+acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
+{
+       return remove_pm_notifier(dev, pci_acpi_wake_dev);
+}
+
 /*
  * _SxD returns the D-state with the highest power
  * (lowest D-state number) supported in the S-state "x".
@@ -131,12 +267,87 @@ static int acpi_pci_sleep_wake(struct pci_dev *dev, bool enable)
        return 0;
 }
 
+/**
+ * acpi_dev_run_wake - Enable/disable wake-up for given device.
+ * @phys_dev: Device to enable/disable the platform to wake-up the system for.
+ * @enable: Whether enable or disable the wake-up functionality.
+ *
+ * Find the ACPI device object corresponding to @pci_dev and try to
+ * enable/disable the GPE associated with it.
+ */
+static int acpi_dev_run_wake(struct device *phys_dev, bool enable)
+{
+       struct acpi_device *dev;
+       acpi_handle handle;
+       int error = -ENODEV;
+
+       if (!device_run_wake(phys_dev))
+               return -EINVAL;
+
+       handle = DEVICE_ACPI_HANDLE(phys_dev);
+       if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev))) {
+               dev_dbg(phys_dev, "ACPI handle has no context in %s!\n",
+                       __func__);
+               return -ENODEV;
+       }
+
+       if (enable) {
+               if (!dev->wakeup.run_wake_count++) {
+                       acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
+                       acpi_enable_gpe(dev->wakeup.gpe_device,
+                                       dev->wakeup.gpe_number,
+                                       ACPI_GPE_TYPE_RUNTIME);
+               }
+       } else if (dev->wakeup.run_wake_count > 0) {
+               if (!--dev->wakeup.run_wake_count) {
+                       acpi_disable_gpe(dev->wakeup.gpe_device,
+                                        dev->wakeup.gpe_number,
+                                        ACPI_GPE_TYPE_RUNTIME);
+                       acpi_disable_wakeup_device_power(dev);
+               }
+       } else {
+               error = -EALREADY;
+       }
+
+       return error;
+}
+
+static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable)
+{
+       while (bus->parent) {
+               struct pci_dev *bridge = bus->self;
+
+               if (bridge->pme_interrupt)
+                       return;
+               if (!acpi_dev_run_wake(&bridge->dev, enable))
+                       return;
+               bus = bus->parent;
+       }
+
+       /* We have reached the root bus. */
+       if (bus->bridge)
+               acpi_dev_run_wake(bus->bridge, enable);
+}
+
+static int acpi_pci_run_wake(struct pci_dev *dev, bool enable)
+{
+       if (dev->pme_interrupt)
+               return 0;
+
+       if (!acpi_dev_run_wake(&dev->dev, enable))
+               return 0;
+
+       acpi_pci_propagate_run_wake(dev->bus, enable);
+       return 0;
+}
+
 static struct pci_platform_pm_ops acpi_pci_platform_pm = {
        .is_manageable = acpi_pci_power_manageable,
        .set_state = acpi_pci_set_power_state,
        .choose_state = acpi_pci_choose_state,
        .can_wakeup = acpi_pci_can_wakeup,
        .sleep_wake = acpi_pci_sleep_wake,
+       .run_wake = acpi_pci_run_wake,
 };
 
 /* ACPI bus type */
index e5d47be3c6d78eb66b252b25aeae8210a9141c9e..f9a0aec3abcf68c1594ee99d082dcab4a6560ff8 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/cpu.h>
+#include <linux/pm_runtime.h>
 #include "pci.h"
 
 struct pci_dynid {
@@ -404,6 +405,35 @@ static void pci_device_shutdown(struct device *dev)
        pci_msix_shutdown(pci_dev);
 }
 
+#ifdef CONFIG_PM_OPS
+
+/* Auxiliary functions used for system resume and run-time resume. */
+
+/**
+ * pci_restore_standard_config - restore standard config registers of PCI device
+ * @pci_dev: PCI device to handle
+ */
+static int pci_restore_standard_config(struct pci_dev *pci_dev)
+{
+       pci_update_current_state(pci_dev, PCI_UNKNOWN);
+
+       if (pci_dev->current_state != PCI_D0) {
+               int error = pci_set_power_state(pci_dev, PCI_D0);
+               if (error)
+                       return error;
+       }
+
+       return pci_restore_state(pci_dev);
+}
+
+static void pci_pm_default_resume_early(struct pci_dev *pci_dev)
+{
+       pci_restore_standard_config(pci_dev);
+       pci_fixup_device(pci_fixup_resume_early, pci_dev);
+}
+
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 
 /*
@@ -520,29 +550,6 @@ static int pci_legacy_resume(struct device *dev)
 
 /* Auxiliary functions used by the new power management framework */
 
-/**
- * pci_restore_standard_config - restore standard config registers of PCI device
- * @pci_dev: PCI device to handle
- */
-static int pci_restore_standard_config(struct pci_dev *pci_dev)
-{
-       pci_update_current_state(pci_dev, PCI_UNKNOWN);
-
-       if (pci_dev->current_state != PCI_D0) {
-               int error = pci_set_power_state(pci_dev, PCI_D0);
-               if (error)
-                       return error;
-       }
-
-       return pci_restore_state(pci_dev);
-}
-
-static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
-{
-       pci_restore_standard_config(pci_dev);
-       pci_fixup_device(pci_fixup_resume_early, pci_dev);
-}
-
 static void pci_pm_default_resume(struct pci_dev *pci_dev)
 {
        pci_fixup_device(pci_fixup_resume, pci_dev);
@@ -581,6 +588,17 @@ static int pci_pm_prepare(struct device *dev)
        struct device_driver *drv = dev->driver;
        int error = 0;
 
+       /*
+        * PCI devices suspended at run time need to be resumed at this
+        * point, because in general it is necessary to reconfigure them for
+        * system suspend.  Namely, if the device is supposed to wake up the
+        * system from the sleep state, we may need to reconfigure it for this
+        * purpose.  In turn, if the device is not supposed to wake up the
+        * system from the sleep state, we'll have to prevent it from signaling
+        * wake-up.
+        */
+       pm_runtime_resume(dev);
+
        if (drv && drv->pm && drv->pm->prepare)
                error = drv->pm->prepare(dev);
 
@@ -595,6 +613,13 @@ static void pci_pm_complete(struct device *dev)
                drv->pm->complete(dev);
 }
 
+#else /* !CONFIG_PM_SLEEP */
+
+#define pci_pm_prepare NULL
+#define pci_pm_complete        NULL
+
+#endif /* !CONFIG_PM_SLEEP */
+
 #ifdef CONFIG_SUSPEND
 
 static int pci_pm_suspend(struct device *dev)
@@ -681,7 +706,7 @@ static int pci_pm_resume_noirq(struct device *dev)
        struct device_driver *drv = dev->driver;
        int error = 0;
 
-       pci_pm_default_resume_noirq(pci_dev);
+       pci_pm_default_resume_early(pci_dev);
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume_early(dev);
@@ -879,7 +904,7 @@ static int pci_pm_restore_noirq(struct device *dev)
        struct device_driver *drv = dev->driver;
        int error = 0;
 
-       pci_pm_default_resume_noirq(pci_dev);
+       pci_pm_default_resume_early(pci_dev);
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume_early(dev);
@@ -931,6 +956,84 @@ static int pci_pm_restore(struct device *dev)
 
 #endif /* !CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_RUNTIME
+
+static int pci_pm_runtime_suspend(struct device *dev)
+{
+       struct pci_dev *pci_dev = to_pci_dev(dev);
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+       pci_power_t prev = pci_dev->current_state;
+       int error;
+
+       if (!pm || !pm->runtime_suspend)
+               return -ENOSYS;
+
+       error = pm->runtime_suspend(dev);
+       suspend_report_result(pm->runtime_suspend, error);
+       if (error)
+               return error;
+
+       pci_fixup_device(pci_fixup_suspend, pci_dev);
+
+       if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
+           && pci_dev->current_state != PCI_UNKNOWN) {
+               WARN_ONCE(pci_dev->current_state != prev,
+                       "PCI PM: State of device not saved by %pF\n",
+                       pm->runtime_suspend);
+               return 0;
+       }
+
+       if (!pci_dev->state_saved)
+               pci_save_state(pci_dev);
+
+       pci_finish_runtime_suspend(pci_dev);
+
+       return 0;
+}
+
+static int pci_pm_runtime_resume(struct device *dev)
+{
+       struct pci_dev *pci_dev = to_pci_dev(dev);
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+       if (!pm || !pm->runtime_resume)
+               return -ENOSYS;
+
+       pci_pm_default_resume_early(pci_dev);
+       __pci_enable_wake(pci_dev, PCI_D0, true, false);
+       pci_fixup_device(pci_fixup_resume, pci_dev);
+
+       return pm->runtime_resume(dev);
+}
+
+static int pci_pm_runtime_idle(struct device *dev)
+{
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+       if (!pm)
+               return -ENOSYS;
+
+       if (pm->runtime_idle) {
+               int ret = pm->runtime_idle(dev);
+               if (ret)
+                       return ret;
+       }
+
+       pm_runtime_suspend(dev);
+
+       return 0;
+}
+
+#else /* !CONFIG_PM_RUNTIME */
+
+#define pci_pm_runtime_suspend NULL
+#define pci_pm_runtime_resume  NULL
+#define pci_pm_runtime_idle    NULL
+
+#endif /* !CONFIG_PM_RUNTIME */
+
+#ifdef CONFIG_PM_OPS
+
 const struct dev_pm_ops pci_dev_pm_ops = {
        .prepare = pci_pm_prepare,
        .complete = pci_pm_complete,
@@ -946,15 +1049,18 @@ const struct dev_pm_ops pci_dev_pm_ops = {
        .thaw_noirq = pci_pm_thaw_noirq,
        .poweroff_noirq = pci_pm_poweroff_noirq,
        .restore_noirq = pci_pm_restore_noirq,
+       .runtime_suspend = pci_pm_runtime_suspend,
+       .runtime_resume = pci_pm_runtime_resume,
+       .runtime_idle = pci_pm_runtime_idle,
 };
 
 #define PCI_PM_OPS_PTR (&pci_dev_pm_ops)
 
-#else /* !CONFIG_PM_SLEEP */
+#else /* !COMFIG_PM_OPS */
 
 #define PCI_PM_OPS_PTR NULL
 
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !COMFIG_PM_OPS */
 
 /**
  * __pci_register_driver - register a new pci driver
index 315fea47e7843956772514a25a64afae736cd38e..5b548aee9cbc43f30a0e0bb0d850ceed3d606e08 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/pci-aspm.h>
 #include <linux/pm_wakeup.h>
 #include <linux/interrupt.h>
-#include <asm/dma.h>   /* isa_dma_bridge_buggy */
 #include <linux/device.h>
+#include <linux/pm_runtime.h>
 #include <asm/setup.h>
 #include "pci.h"
 
@@ -29,6 +29,12 @@ const char *pci_power_names[] = {
 };
 EXPORT_SYMBOL_GPL(pci_power_names);
 
+int isa_dma_bridge_buggy;
+EXPORT_SYMBOL(isa_dma_bridge_buggy);
+
+int pci_pci_problems;
+EXPORT_SYMBOL(pci_pci_problems);
+
 unsigned int pci_pm_d3_delay;
 
 static void pci_dev_d3_sleep(struct pci_dev *dev)
@@ -380,10 +386,9 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
 {
        const struct pci_bus *bus = dev->bus;
        int i;
-       struct resource *best = NULL;
+       struct resource *best = NULL, *r;
 
-       for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               struct resource *r = bus->resource[i];
+       pci_bus_for_each_resource(bus, r, i) {
                if (!r)
                        continue;
                if (res->start && !(res->start >= r->start && res->end <= r->end))
@@ -457,6 +462,12 @@ static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable)
                        pci_platform_pm->sleep_wake(dev, enable) : -ENODEV;
 }
 
+static inline int platform_pci_run_wake(struct pci_dev *dev, bool enable)
+{
+       return pci_platform_pm ?
+                       pci_platform_pm->run_wake(dev, enable) : -ENODEV;
+}
+
 /**
  * pci_raw_set_power_state - Use PCI PM registers to set the power state of
  *                           given PCI device
@@ -1189,6 +1200,66 @@ int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
        return pcibios_set_pcie_reset_state(dev, state);
 }
 
+/**
+ * pci_check_pme_status - Check if given device has generated PME.
+ * @dev: Device to check.
+ *
+ * Check the PME status of the device and if set, clear it and clear PME enable
+ * (if set).  Return 'true' if PME status and PME enable were both set or
+ * 'false' otherwise.
+ */
+bool pci_check_pme_status(struct pci_dev *dev)
+{
+       int pmcsr_pos;
+       u16 pmcsr;
+       bool ret = false;
+
+       if (!dev->pm_cap)
+               return false;
+
+       pmcsr_pos = dev->pm_cap + PCI_PM_CTRL;
+       pci_read_config_word(dev, pmcsr_pos, &pmcsr);
+       if (!(pmcsr & PCI_PM_CTRL_PME_STATUS))
+               return false;
+
+       /* Clear PME status. */
+       pmcsr |= PCI_PM_CTRL_PME_STATUS;
+       if (pmcsr & PCI_PM_CTRL_PME_ENABLE) {
+               /* Disable PME to avoid interrupt flood. */
+               pmcsr &= ~PCI_PM_CTRL_PME_ENABLE;
+               ret = true;
+       }
+
+       pci_write_config_word(dev, pmcsr_pos, pmcsr);
+
+       return ret;
+}
+
+/**
+ * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set.
+ * @dev: Device to handle.
+ * @ign: Ignored.
+ *
+ * Check if @dev has generated PME and queue a resume request for it in that
+ * case.
+ */
+static int pci_pme_wakeup(struct pci_dev *dev, void *ign)
+{
+       if (pci_check_pme_status(dev))
+               pm_request_resume(&dev->dev);
+       return 0;
+}
+
+/**
+ * pci_pme_wakeup_bus - Walk given bus and wake up devices on it, if necessary.
+ * @bus: Top bus of the subtree to walk.
+ */
+void pci_pme_wakeup_bus(struct pci_bus *bus)
+{
+       if (bus)
+               pci_walk_bus(bus, pci_pme_wakeup, NULL);
+}
+
 /**
  * pci_pme_capable - check the capability of PCI device to generate PME#
  * @dev: PCI device to handle.
@@ -1230,9 +1301,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
 }
 
 /**
- * pci_enable_wake - enable PCI device as wakeup event source
+ * __pci_enable_wake - enable PCI device as wakeup event source
  * @dev: PCI device affected
  * @state: PCI state from which device will issue wakeup events
+ * @runtime: True if the events are to be generated at run time
  * @enable: True to enable event generation; false to disable
  *
  * This enables the device as a wakeup event source, or disables it.
@@ -1248,11 +1320,12 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
  * Error code depending on the platform is returned if both the platform and
  * the native mechanism fail to enable the generation of wake-up events
  */
-int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
+int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
+                     bool runtime, bool enable)
 {
        int ret = 0;
 
-       if (enable && !device_may_wakeup(&dev->dev))
+       if (enable && !runtime && !device_may_wakeup(&dev->dev))
                return -EINVAL;
 
        /* Don't do the same thing twice in a row for one device. */
@@ -1272,19 +1345,24 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
                        pci_pme_active(dev, true);
                else
                        ret = 1;
-               error = platform_pci_sleep_wake(dev, true);
+               error = runtime ? platform_pci_run_wake(dev, true) :
+                                       platform_pci_sleep_wake(dev, true);
                if (ret)
                        ret = error;
                if (!ret)
                        dev->wakeup_prepared = true;
        } else {
-               platform_pci_sleep_wake(dev, false);
+               if (runtime)
+                       platform_pci_run_wake(dev, false);
+               else
+                       platform_pci_sleep_wake(dev, false);
                pci_pme_active(dev, false);
                dev->wakeup_prepared = false;
        }
 
        return ret;
 }
+EXPORT_SYMBOL(__pci_enable_wake);
 
 /**
  * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold
@@ -1393,6 +1471,66 @@ int pci_back_from_sleep(struct pci_dev *dev)
        return pci_set_power_state(dev, PCI_D0);
 }
 
+/**
+ * pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend.
+ * @dev: PCI device being suspended.
+ *
+ * Prepare @dev to generate wake-up events at run time and put it into a low
+ * power state.
+ */
+int pci_finish_runtime_suspend(struct pci_dev *dev)
+{
+       pci_power_t target_state = pci_target_state(dev);
+       int error;
+
+       if (target_state == PCI_POWER_ERROR)
+               return -EIO;
+
+       __pci_enable_wake(dev, target_state, true, pci_dev_run_wake(dev));
+
+       error = pci_set_power_state(dev, target_state);
+
+       if (error)
+               __pci_enable_wake(dev, target_state, true, false);
+
+       return error;
+}
+
+/**
+ * pci_dev_run_wake - Check if device can generate run-time wake-up events.
+ * @dev: Device to check.
+ *
+ * Return true if the device itself is cabable of generating wake-up events
+ * (through the platform or using the native PCIe PME) or if the device supports
+ * PME and one of its upstream bridges can generate wake-up events.
+ */
+bool pci_dev_run_wake(struct pci_dev *dev)
+{
+       struct pci_bus *bus = dev->bus;
+
+       if (device_run_wake(&dev->dev))
+               return true;
+
+       if (!dev->pme_support)
+               return false;
+
+       while (bus->parent) {
+               struct pci_dev *bridge = bus->self;
+
+               if (device_run_wake(&bridge->dev))
+                       return true;
+
+               bus = bus->parent;
+       }
+
+       /* We have reached the root bus. */
+       if (bus->bridge)
+               return device_run_wake(bus->bridge);
+
+       return false;
+}
+EXPORT_SYMBOL_GPL(pci_dev_run_wake);
+
 /**
  * pci_pm_init - Initialize PM functions of given PCI device
  * @dev: PCI device to handle.
@@ -1402,6 +1540,7 @@ void pci_pm_init(struct pci_dev *dev)
        int pm;
        u16 pmc;
 
+       device_enable_async_suspend(&dev->dev);
        dev->wakeup_prepared = false;
        dev->pm_cap = 0;
 
@@ -2615,6 +2754,23 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type)
        return 0;
 }
 
+/* Some architectures require additional programming to enable VGA */
+static arch_set_vga_state_t arch_set_vga_state;
+
+void __init pci_register_set_vga_state(arch_set_vga_state_t func)
+{
+       arch_set_vga_state = func;      /* NULL disables */
+}
+
+static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
+                     unsigned int command_bits, bool change_bridge)
+{
+       if (arch_set_vga_state)
+               return arch_set_vga_state(dev, decode, command_bits,
+                                               change_bridge);
+       return 0;
+}
+
 /**
  * pci_set_vga_state - set VGA decode state on device and parents if requested
  * @dev: the PCI device
@@ -2628,9 +2784,15 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
        struct pci_bus *bus;
        struct pci_dev *bridge;
        u16 cmd;
+       int rc;
 
        WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY));
 
+       /* ARCH specific VGA enables */
+       rc = pci_set_vga_state_arch(dev, decode, command_bits, change_bridge);
+       if (rc)
+               return rc;
+
        pci_read_config_word(dev, PCI_COMMAND, &cmd);
        if (decode == true)
                cmd |= command_bits;
@@ -2845,6 +3007,7 @@ EXPORT_SYMBOL(pcim_pin_device);
 EXPORT_SYMBOL(pci_disable_device);
 EXPORT_SYMBOL(pci_find_capability);
 EXPORT_SYMBOL(pci_bus_find_capability);
+EXPORT_SYMBOL(pci_register_set_vga_state);
 EXPORT_SYMBOL(pci_release_regions);
 EXPORT_SYMBOL(pci_request_regions);
 EXPORT_SYMBOL(pci_request_regions_exclusive);
@@ -2871,10 +3034,8 @@ EXPORT_SYMBOL(pci_save_state);
 EXPORT_SYMBOL(pci_restore_state);
 EXPORT_SYMBOL(pci_pme_capable);
 EXPORT_SYMBOL(pci_pme_active);
-EXPORT_SYMBOL(pci_enable_wake);
 EXPORT_SYMBOL(pci_wake_from_d3);
 EXPORT_SYMBOL(pci_target_state);
 EXPORT_SYMBOL(pci_prepare_to_sleep);
 EXPORT_SYMBOL(pci_back_from_sleep);
 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
-
index fbd0e3adbca3cf58c9995a5f46cf41a51f4d4df5..4eb10f48d2704af3c66b6dda9298a8347d614351 100644 (file)
@@ -35,6 +35,10 @@ int pci_probe_reset_function(struct pci_dev *dev);
  *
  * @sleep_wake: enables/disables the system wake up capability of given device
  *
+ * @run_wake: enables/disables the platform to generate run-time wake-up events
+ *             for given device (the device's wake-up capability has to be
+ *             enabled by @sleep_wake for this feature to work)
+ *
  * If given platform is generally capable of power managing PCI devices, all of
  * these callbacks are mandatory.
  */
@@ -44,11 +48,16 @@ struct pci_platform_pm_ops {
        pci_power_t (*choose_state)(struct pci_dev *dev);
        bool (*can_wakeup)(struct pci_dev *dev);
        int (*sleep_wake)(struct pci_dev *dev, bool enable);
+       int (*run_wake)(struct pci_dev *dev, bool enable);
 };
 
 extern int pci_set_platform_pm(struct pci_platform_pm_ops *ops);
 extern void pci_update_current_state(struct pci_dev *dev, pci_power_t state);
 extern void pci_disable_enabled_device(struct pci_dev *dev);
+extern bool pci_check_pme_status(struct pci_dev *dev);
+extern int pci_finish_runtime_suspend(struct pci_dev *dev);
+extern int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
+extern void pci_pme_wakeup_bus(struct pci_bus *bus);
 extern void pci_pm_init(struct pci_dev *dev);
 extern void platform_pci_wakeup_init(struct pci_dev *dev);
 extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
@@ -319,6 +328,13 @@ struct pci_dev_reset_methods {
        int (*reset)(struct pci_dev *dev, int probe);
 };
 
+#ifdef CONFIG_PCI_QUIRKS
 extern int pci_dev_specific_reset(struct pci_dev *dev, int probe);
+#else
+static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)
+{
+       return -ENOTTY;
+}
+#endif
 
 #endif /* DRIVERS_PCI_H */
index 5a0c6ad53f8ee0f8b8ce9ee978394b850b895c59..b8b494b3e0d058c0a1f42e51c81ee15e24ed82cb 100644 (file)
@@ -46,3 +46,7 @@ config PCIEASPM_DEBUG
        help
          This enables PCI Express ASPM debug support. It will add per-device
          interface to control ASPM.
+
+config PCIE_PME
+       def_bool y
+       depends on PCIEPORTBUS && PM_RUNTIME && EXPERIMENTAL && ACPI
index 11f6bb1eae24b5816f37181fdbf6021add41099a..ea654545e7c468c876e7d7b2a7eb637d53c168b9 100644 (file)
@@ -11,3 +11,5 @@ obj-$(CONFIG_PCIEPORTBUS)     += pcieportdrv.o
 
 # Build PCI Express AER if needed
 obj-$(CONFIG_PCIEAER)          += aer/
+
+obj-$(CONFIG_PCIE_PME) += pme/
index 8c30a9544d61f07176fbf69a59b84c2afabf9e8a..223052b735634c697739ca37396d10154c93c72c 100644 (file)
@@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj)
        unsigned long flags;
        unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
        int pos_cap_err, rp_pos_cap_err;
-       u32 sever, mask;
+       u32 sever, cor_mask, uncor_mask;
        int ret = 0;
 
        dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn);
@@ -339,6 +339,9 @@ static int aer_inject(struct aer_error_inj *einj)
                goto out_put;
        }
        pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_SEVER, &sever);
+       pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &cor_mask);
+       pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK,
+                             &uncor_mask);
 
        rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
        if (!rp_pos_cap_err) {
@@ -374,17 +377,14 @@ static int aer_inject(struct aer_error_inj *einj)
        err->header_log2 = einj->header_log2;
        err->header_log3 = einj->header_log3;
 
-       pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
-       if (einj->cor_status && !(einj->cor_status & ~mask)) {
+       if (einj->cor_status && !(einj->cor_status & ~cor_mask)) {
                ret = -EINVAL;
                printk(KERN_WARNING "The correctable error(s) is masked "
                                "by device\n");
                spin_unlock_irqrestore(&inject_lock, flags);
                goto out_put;
        }
-
-       pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
-       if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
+       if (einj->uncor_status && !(einj->uncor_status & ~uncor_mask)) {
                ret = -EINVAL;
                printk(KERN_WARNING "The uncorrectable error(s) is masked "
                                "by device\n");
diff --git a/drivers/pci/pcie/pme/Makefile b/drivers/pci/pcie/pme/Makefile
new file mode 100644 (file)
index 0000000..8b92380
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# Makefile for PCI-Express Root Port PME signaling driver
+#
+
+obj-$(CONFIG_PCIE_PME) += pmedriver.o
+
+pmedriver-objs := pcie_pme.o
+pmedriver-$(CONFIG_ACPI) += pcie_pme_acpi.o
diff --git a/drivers/pci/pcie/pme/pcie_pme.c b/drivers/pci/pcie/pme/pcie_pme.c
new file mode 100644 (file)
index 0000000..7b3cbff
--- /dev/null
@@ -0,0 +1,505 @@
+/*
+ * PCIe Native PME support
+ *
+ * Copyright (C) 2007 - 2009 Intel Corp
+ * Copyright (C) 2007 - 2009 Shaohua Li <shaohua.li@intel.com>
+ * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License V2.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/pcieport_if.h>
+#include <linux/acpi.h>
+#include <linux/pci-acpi.h>
+#include <linux/pm_runtime.h>
+
+#include "../../pci.h"
+#include "pcie_pme.h"
+
+#define PCI_EXP_RTSTA_PME      0x10000 /* PME status */
+#define PCI_EXP_RTSTA_PENDING  0x20000 /* PME pending */
+
+/*
+ * If set, this switch will prevent the PCIe root port PME service driver from
+ * being registered.  Consequently, the interrupt-based PCIe PME signaling will
+ * not be used by any PCIe root ports in that case.
+ */
+static bool pcie_pme_disabled;
+
+/*
+ * The PCI Express Base Specification 2.0, Section 6.1.8, states the following:
+ * "In order to maintain compatibility with non-PCI Express-aware system
+ * software, system power management logic must be configured by firmware to use
+ * the legacy mechanism of signaling PME by default.  PCI Express-aware system
+ * software must notify the firmware prior to enabling native, interrupt-based
+ * PME signaling."  However, if the platform doesn't provide us with a suitable
+ * notification mechanism or the notification fails, it is not clear whether or
+ * not we are supposed to use the interrupt-based PCIe PME signaling.  The
+ * switch below can be used to indicate the desired behaviour.  When set, it
+ * will make the kernel use the interrupt-based PCIe PME signaling regardless of
+ * the platform notification status, although the kernel will attempt to notify
+ * the platform anyway.  When unset, it will prevent the kernel from using the
+ * the interrupt-based PCIe PME signaling if the platform notification fails,
+ * which is the default.
+ */
+static bool pcie_pme_force_enable;
+
+/*
+ * If this switch is set, MSI will not be used for PCIe PME signaling.  This
+ * causes the PCIe port driver to use INTx interrupts only, but it turns out
+ * that using MSI for PCIe PME signaling doesn't play well with PCIe PME-based
+ * wake-up from system sleep states.
+ */
+bool pcie_pme_msi_disabled;
+
+static int __init pcie_pme_setup(char *str)
+{
+       if (!strcmp(str, "off"))
+               pcie_pme_disabled = true;
+       else if (!strcmp(str, "force"))
+               pcie_pme_force_enable = true;
+       else if (!strcmp(str, "nomsi"))
+               pcie_pme_msi_disabled = true;
+       return 1;
+}
+__setup("pcie_pme=", pcie_pme_setup);
+
+/**
+ * pcie_pme_platform_setup - Ensure that the kernel controls the PCIe PME.
+ * @srv: PCIe PME root port service to use for carrying out the check.
+ *
+ * Notify the platform that the native PCIe PME is going to be used and return
+ * 'true' if the control of the PCIe PME registers has been acquired from the
+ * platform.
+ */
+static bool pcie_pme_platform_setup(struct pcie_device *srv)
+{
+       if (!pcie_pme_platform_notify(srv))
+               return true;
+       return pcie_pme_force_enable;
+}
+
+struct pcie_pme_service_data {
+       spinlock_t lock;
+       struct pcie_device *srv;
+       struct work_struct work;
+       bool noirq; /* Don't enable the PME interrupt used by this service. */
+};
+
+/**
+ * pcie_pme_interrupt_enable - Enable/disable PCIe PME interrupt generation.
+ * @dev: PCIe root port or event collector.
+ * @enable: Enable or disable the interrupt.
+ */
+static void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable)
+{
+       int rtctl_pos;
+       u16 rtctl;
+
+       rtctl_pos = pci_pcie_cap(dev) + PCI_EXP_RTCTL;
+
+       pci_read_config_word(dev, rtctl_pos, &rtctl);
+       if (enable)
+               rtctl |= PCI_EXP_RTCTL_PMEIE;
+       else
+               rtctl &= ~PCI_EXP_RTCTL_PMEIE;
+       pci_write_config_word(dev, rtctl_pos, rtctl);
+}
+
+/**
+ * pcie_pme_clear_status - Clear root port PME interrupt status.
+ * @dev: PCIe root port or event collector.
+ */
+static void pcie_pme_clear_status(struct pci_dev *dev)
+{
+       int rtsta_pos;
+       u32 rtsta;
+
+       rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA;
+
+       pci_read_config_dword(dev, rtsta_pos, &rtsta);
+       rtsta |= PCI_EXP_RTSTA_PME;
+       pci_write_config_dword(dev, rtsta_pos, rtsta);
+}
+
+/**
+ * pcie_pme_walk_bus - Scan a PCI bus for devices asserting PME#.
+ * @bus: PCI bus to scan.
+ *
+ * Scan given PCI bus and all buses under it for devices asserting PME#.
+ */
+static bool pcie_pme_walk_bus(struct pci_bus *bus)
+{
+       struct pci_dev *dev;
+       bool ret = false;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               /* Skip PCIe devices in case we started from a root port. */
+               if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) {
+                       pm_request_resume(&dev->dev);
+                       ret = true;
+               }
+
+               if (dev->subordinate && pcie_pme_walk_bus(dev->subordinate))
+                       ret = true;
+       }
+
+       return ret;
+}
+
+/**
+ * pcie_pme_from_pci_bridge - Check if PCIe-PCI bridge generated a PME.
+ * @bus: Secondary bus of the bridge.
+ * @devfn: Device/function number to check.
+ *
+ * PME from PCI devices under a PCIe-PCI bridge may be converted to an in-band
+ * PCIe PME message.  In such that case the bridge should use the Requester ID
+ * of device/function number 0 on its secondary bus.
+ */
+static bool pcie_pme_from_pci_bridge(struct pci_bus *bus, u8 devfn)
+{
+       struct pci_dev *dev;
+       bool found = false;
+
+       if (devfn)
+               return false;
+
+       dev = pci_dev_get(bus->self);
+       if (!dev)
+               return false;
+
+       if (pci_is_pcie(dev) && dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) {
+               down_read(&pci_bus_sem);
+               if (pcie_pme_walk_bus(bus))
+                       found = true;
+               up_read(&pci_bus_sem);
+       }
+
+       pci_dev_put(dev);
+       return found;
+}
+
+/**
+ * pcie_pme_handle_request - Find device that generated PME and handle it.
+ * @port: Root port or event collector that generated the PME interrupt.
+ * @req_id: PCIe Requester ID of the device that generated the PME.
+ */
+static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id)
+{
+       u8 busnr = req_id >> 8, devfn = req_id & 0xff;
+       struct pci_bus *bus;
+       struct pci_dev *dev;
+       bool found = false;
+
+       /* First, check if the PME is from the root port itself. */
+       if (port->devfn == devfn && port->bus->number == busnr) {
+               if (pci_check_pme_status(port)) {
+                       pm_request_resume(&port->dev);
+                       found = true;
+               } else {
+                       /*
+                        * Apparently, the root port generated the PME on behalf
+                        * of a non-PCIe device downstream.  If this is done by
+                        * a root port, the Requester ID field in its status
+                        * register may contain either the root port's, or the
+                        * source device's information (PCI Express Base
+                        * Specification, Rev. 2.0, Section 6.1.9).
+                        */
+                       down_read(&pci_bus_sem);
+                       found = pcie_pme_walk_bus(port->subordinate);
+                       up_read(&pci_bus_sem);
+               }
+               goto out;
+       }
+
+       /* Second, find the bus the source device is on. */
+       bus = pci_find_bus(pci_domain_nr(port->bus), busnr);
+       if (!bus)
+               goto out;
+
+       /* Next, check if the PME is from a PCIe-PCI bridge. */
+       found = pcie_pme_from_pci_bridge(bus, devfn);
+       if (found)
+               goto out;
+
+       /* Finally, try to find the PME source on the bus. */
+       down_read(&pci_bus_sem);
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               pci_dev_get(dev);
+               if (dev->devfn == devfn) {
+                       found = true;
+                       break;
+               }
+               pci_dev_put(dev);
+       }
+       up_read(&pci_bus_sem);
+
+       if (found) {
+               /* The device is there, but we have to check its PME status. */
+               found = pci_check_pme_status(dev);
+               if (found)
+                       pm_request_resume(&dev->dev);
+               pci_dev_put(dev);
+       } else if (devfn) {
+               /*
+                * The device is not there, but we can still try to recover by
+                * assuming that the PME was reported by a PCIe-PCI bridge that
+                * used devfn different from zero.
+                */
+               dev_dbg(&port->dev, "PME interrupt generated for "
+                       "non-existent device %02x:%02x.%d\n",
+                       busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
+               found = pcie_pme_from_pci_bridge(bus, 0);
+       }
+
+ out:
+       if (!found)
+               dev_dbg(&port->dev, "Spurious native PME interrupt!\n");
+}
+
+/**
+ * pcie_pme_work_fn - Work handler for PCIe PME interrupt.
+ * @work: Work structure giving access to service data.
+ */
+static void pcie_pme_work_fn(struct work_struct *work)
+{
+       struct pcie_pme_service_data *data =
+                       container_of(work, struct pcie_pme_service_data, work);
+       struct pci_dev *port = data->srv->port;
+       int rtsta_pos;
+       u32 rtsta;
+
+       rtsta_pos = pci_pcie_cap(port) + PCI_EXP_RTSTA;
+
+       spin_lock_irq(&data->lock);
+
+       for (;;) {
+               if (data->noirq)
+                       break;
+
+               pci_read_config_dword(port, rtsta_pos, &rtsta);
+               if (rtsta & PCI_EXP_RTSTA_PME) {
+                       /*
+                        * Clear PME status of the port.  If there are other
+                        * pending PMEs, the status will be set again.
+                        */
+                       pcie_pme_clear_status(port);
+
+                       spin_unlock_irq(&data->lock);
+                       pcie_pme_handle_request(port, rtsta & 0xffff);
+                       spin_lock_irq(&data->lock);
+
+                       continue;
+               }
+
+               /* No need to loop if there are no more PMEs pending. */
+               if (!(rtsta & PCI_EXP_RTSTA_PENDING))
+                       break;
+
+               spin_unlock_irq(&data->lock);
+               cpu_relax();
+               spin_lock_irq(&data->lock);
+       }
+
+       if (!data->noirq)
+               pcie_pme_interrupt_enable(port, true);
+
+       spin_unlock_irq(&data->lock);
+}
+
+/**
+ * pcie_pme_irq - Interrupt handler for PCIe root port PME interrupt.
+ * @irq: Interrupt vector.
+ * @context: Interrupt context pointer.
+ */
+static irqreturn_t pcie_pme_irq(int irq, void *context)
+{
+       struct pci_dev *port;
+       struct pcie_pme_service_data *data;
+       int rtsta_pos;
+       u32 rtsta;
+       unsigned long flags;
+
+       port = ((struct pcie_device *)context)->port;
+       data = get_service_data((struct pcie_device *)context);
+
+       rtsta_pos = pci_pcie_cap(port) + PCI_EXP_RTSTA;
+
+       spin_lock_irqsave(&data->lock, flags);
+       pci_read_config_dword(port, rtsta_pos, &rtsta);
+
+       if (!(rtsta & PCI_EXP_RTSTA_PME)) {
+               spin_unlock_irqrestore(&data->lock, flags);
+               return IRQ_NONE;
+       }
+
+       pcie_pme_interrupt_enable(port, false);
+       spin_unlock_irqrestore(&data->lock, flags);
+
+       /* We don't use pm_wq, because it's freezable. */
+       schedule_work(&data->work);
+
+       return IRQ_HANDLED;
+}
+
+/**
+ * pcie_pme_set_native - Set the PME interrupt flag for given device.
+ * @dev: PCI device to handle.
+ * @ign: Ignored.
+ */
+static int pcie_pme_set_native(struct pci_dev *dev, void *ign)
+{
+       dev_info(&dev->dev, "Signaling PME through PCIe PME interrupt\n");
+
+       device_set_run_wake(&dev->dev, true);
+       dev->pme_interrupt = true;
+       return 0;
+}
+
+/**
+ * pcie_pme_mark_devices - Set the PME interrupt flag for devices below a port.
+ * @port: PCIe root port or event collector to handle.
+ *
+ * For each device below given root port, including the port itself (or for each
+ * root complex integrated endpoint if @port is a root complex event collector)
+ * set the flag indicating that it can signal run-time wake-up events via PCIe
+ * PME interrupts.
+ */
+static void pcie_pme_mark_devices(struct pci_dev *port)
+{
+       pcie_pme_set_native(port, NULL);
+       if (port->subordinate) {
+               pci_walk_bus(port->subordinate, pcie_pme_set_native, NULL);
+       } else {
+               struct pci_bus *bus = port->bus;
+               struct pci_dev *dev;
+
+               /* Check if this is a root port event collector. */
+               if (port->pcie_type != PCI_EXP_TYPE_RC_EC || !bus)
+                       return;
+
+               down_read(&pci_bus_sem);
+               list_for_each_entry(dev, &bus->devices, bus_list)
+                       if (pci_is_pcie(dev)
+                           && dev->pcie_type == PCI_EXP_TYPE_RC_END)
+                               pcie_pme_set_native(dev, NULL);
+               up_read(&pci_bus_sem);
+       }
+}
+
+/**
+ * pcie_pme_probe - Initialize PCIe PME service for given root port.
+ * @srv: PCIe service to initialize.
+ */
+static int pcie_pme_probe(struct pcie_device *srv)
+{
+       struct pci_dev *port;
+       struct pcie_pme_service_data *data;
+       int ret;
+
+       if (!pcie_pme_platform_setup(srv))
+               return -EACCES;
+
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       spin_lock_init(&data->lock);
+       INIT_WORK(&data->work, pcie_pme_work_fn);
+       data->srv = srv;
+       set_service_data(srv, data);
+
+       port = srv->port;
+       pcie_pme_interrupt_enable(port, false);
+       pcie_pme_clear_status(port);
+
+       ret = request_irq(srv->irq, pcie_pme_irq, IRQF_SHARED, "PCIe PME", srv);
+       if (ret) {
+               kfree(data);
+       } else {
+               pcie_pme_mark_devices(port);
+               pcie_pme_interrupt_enable(port, true);
+       }
+
+       return ret;
+}
+
+/**
+ * pcie_pme_suspend - Suspend PCIe PME service device.
+ * @srv: PCIe service device to suspend.
+ */
+static int pcie_pme_suspend(struct pcie_device *srv)
+{
+       struct pcie_pme_service_data *data = get_service_data(srv);
+       struct pci_dev *port = srv->port;
+
+       spin_lock_irq(&data->lock);
+       pcie_pme_interrupt_enable(port, false);
+       pcie_pme_clear_status(port);
+       data->noirq = true;
+       spin_unlock_irq(&data->lock);
+
+       synchronize_irq(srv->irq);
+
+       return 0;
+}
+
+/**
+ * pcie_pme_resume - Resume PCIe PME service device.
+ * @srv - PCIe service device to resume.
+ */
+static int pcie_pme_resume(struct pcie_device *srv)
+{
+       struct pcie_pme_service_data *data = get_service_data(srv);
+       struct pci_dev *port = srv->port;
+
+       spin_lock_irq(&data->lock);
+       data->noirq = false;
+       pcie_pme_clear_status(port);
+       pcie_pme_interrupt_enable(port, true);
+       spin_unlock_irq(&data->lock);
+
+       return 0;
+}
+
+/**
+ * pcie_pme_remove - Prepare PCIe PME service device for removal.
+ * @srv - PCIe service device to resume.
+ */
+static void pcie_pme_remove(struct pcie_device *srv)
+{
+       pcie_pme_suspend(srv);
+       free_irq(srv->irq, srv);
+       kfree(get_service_data(srv));
+}
+
+static struct pcie_port_service_driver pcie_pme_driver = {
+       .name           = "pcie_pme",
+       .port_type      = PCI_EXP_TYPE_ROOT_PORT,
+       .service        = PCIE_PORT_SERVICE_PME,
+
+       .probe          = pcie_pme_probe,
+       .suspend        = pcie_pme_suspend,
+       .resume         = pcie_pme_resume,
+       .remove         = pcie_pme_remove,
+};
+
+/**
+ * pcie_pme_service_init - Register the PCIe PME service driver.
+ */
+static int __init pcie_pme_service_init(void)
+{
+       return pcie_pme_disabled ?
+               -ENODEV : pcie_port_service_register(&pcie_pme_driver);
+}
+
+module_init(pcie_pme_service_init);
diff --git a/drivers/pci/pcie/pme/pcie_pme.h b/drivers/pci/pcie/pme/pcie_pme.h
new file mode 100644 (file)
index 0000000..b30d2b7
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * drivers/pci/pcie/pme/pcie_pme.h
+ *
+ * PCI Express Root Port PME signaling support
+ *
+ * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
+ */
+
+#ifndef _PCIE_PME_H_
+#define _PCIE_PME_H_
+
+struct pcie_device;
+
+#ifdef CONFIG_ACPI
+extern int pcie_pme_acpi_setup(struct pcie_device *srv);
+
+static inline int pcie_pme_platform_notify(struct pcie_device *srv)
+{
+       return pcie_pme_acpi_setup(srv);
+}
+#else /* !CONFIG_ACPI */
+static inline int pcie_pme_platform_notify(struct pcie_device *srv)
+{
+       return 0;
+}
+#endif /* !CONFIG_ACPI */
+
+#endif
diff --git a/drivers/pci/pcie/pme/pcie_pme_acpi.c b/drivers/pci/pcie/pme/pcie_pme_acpi.c
new file mode 100644 (file)
index 0000000..83ab228
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * PCIe Native PME support, ACPI-related part
+ *
+ * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License V2.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/acpi.h>
+#include <linux/pci-acpi.h>
+#include <linux/pcieport_if.h>
+
+/**
+ * pcie_pme_acpi_setup - Request the ACPI BIOS to release control over PCIe PME.
+ * @srv - PCIe PME service for a root port or event collector.
+ *
+ * Invoked when the PCIe bus type loads PCIe PME service driver.  To avoid
+ * conflict with the BIOS PCIe support requires the BIOS to yield PCIe PME
+ * control to the kernel.
+ */
+int pcie_pme_acpi_setup(struct pcie_device *srv)
+{
+       acpi_status status = AE_NOT_FOUND;
+       struct pci_dev *port = srv->port;
+       acpi_handle handle;
+       int error = 0;
+
+       if (acpi_pci_disabled)
+               return -ENOSYS;
+
+       dev_info(&port->dev, "Requesting control of PCIe PME from ACPI BIOS\n");
+
+       handle = acpi_find_root_bridge_handle(port);
+       if (!handle)
+               return -EINVAL;
+
+       status = acpi_pci_osc_control_set(handle,
+                       OSC_PCI_EXPRESS_PME_CONTROL |
+                       OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
+       if (ACPI_FAILURE(status)) {
+               dev_info(&port->dev,
+                       "Failed to receive control of PCIe PME service: %s\n",
+                       (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
+                       "no _OSC support" : "ACPI _OSC failed");
+               error = -ENODEV;
+       }
+
+       return error;
+}
index aaeb9d21cba5eab65b02aa1696a177e29def6d63..813a5c3427b69261d0d54d5c531ffc9f9973ce64 100644 (file)
@@ -30,4 +30,21 @@ extern void pcie_port_device_remove(struct pci_dev *dev);
 extern int __must_check pcie_port_bus_register(void);
 extern void pcie_port_bus_unregister(void);
 
+#ifdef CONFIG_PCIE_PME
+extern bool pcie_pme_msi_disabled;
+
+static inline void pcie_pme_disable_msi(void)
+{
+       pcie_pme_msi_disabled = true;
+}
+
+static inline bool pcie_pme_no_msi(void)
+{
+       return pcie_pme_msi_disabled;
+}
+#else /* !CONFIG_PCIE_PME */
+static inline void pcie_pme_disable_msi(void) {}
+static inline bool pcie_pme_no_msi(void) { return false; }
+#endif /* !CONFIG_PCIE_PME */
+
 #endif /* _PORTDRV_H_ */
index b174188ac1212e4f128190c9a8ee78c3b1ef9962..e73effbe402c55e82be4d8a821b3d39e64f96bac 100644 (file)
@@ -186,16 +186,24 @@ static int pcie_port_enable_msix(struct pci_dev *dev, int *vectors, int mask)
  */
 static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask)
 {
-       int i, irq;
+       int i, irq = -1;
+
+       /* We have to use INTx if MSI cannot be used for PCIe PME. */
+       if ((mask & PCIE_PORT_SERVICE_PME) && pcie_pme_no_msi()) {
+               if (dev->pin)
+                       irq = dev->irq;
+               goto no_msi;
+       }
 
        /* Try to use MSI-X if supported */
        if (!pcie_port_enable_msix(dev, irqs, mask))
                return 0;
+
        /* We're not going to use MSI-X, so try MSI and fall back to INTx */
-       irq = -1;
        if (!pci_enable_msi(dev) || dev->pin)
                irq = dev->irq;
 
+ no_msi:
        for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++)
                irqs[i] = irq;
        irqs[PCIE_PORT_SERVICE_VC_SHIFT] = -1;
@@ -277,6 +285,7 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
                     pci_name(pdev),
                     get_descriptor_id(pdev->pcie_type, service));
        device->parent = &pdev->dev;
+       device_enable_async_suspend(device);
 
        retval = device_register(device);
        if (retval)
index 13c8972886e6e788cf47916507376e5138c1c195..127e8f169d9c2409baa283ca48582e56cbde31fc 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/pcieport_if.h>
 #include <linux/aer.h>
+#include <linux/dmi.h>
 
 #include "portdrv.h"
 #include "aer/aerdrv.h"
@@ -273,10 +274,36 @@ static struct pci_driver pcie_portdriver = {
        .driver.pm      = PCIE_PORTDRV_PM_OPS,
 };
 
+static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d)
+{
+       pr_notice("%s detected: will not use MSI for PCIe PME signaling\n",
+                       d->ident);
+       pcie_pme_disable_msi();
+       return 0;
+}
+
+static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = {
+       /*
+        * Boxes that should not use MSI for PCIe PME signaling.
+        */
+       {
+        .callback = dmi_pcie_pme_disable_msi,
+        .ident = "MSI Wind U-100",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR,
+                               "MICRO-STAR INTERNATIONAL CO., LTD"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "U-100"),
+                    },
+        },
+        {}
+};
+
 static int __init pcie_portdrv_init(void)
 {
        int retval;
 
+       dmi_check_system(pcie_portdrv_dmi_table);
+
        retval = pcie_port_bus_register();
        if (retval) {
                printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval);
index 98ffb2de22e90a3a17984bc75480237178d882b8..2a943090a3b7838b3a8fcb86a9caa89dfe611133 100644 (file)
@@ -89,6 +89,7 @@ static void release_pcibus_dev(struct device *dev)
 
        if (pci_bus->bridge)
                put_device(pci_bus->bridge);
+       pci_bus_remove_resources(pci_bus);
        kfree(pci_bus);
 }
 
@@ -281,26 +282,12 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
        }
 }
 
-void __devinit pci_read_bridge_bases(struct pci_bus *child)
+static void __devinit pci_read_bridge_io(struct pci_bus *child)
 {
        struct pci_dev *dev = child->self;
        u8 io_base_lo, io_limit_lo;
-       u16 mem_base_lo, mem_limit_lo;
        unsigned long base, limit;
        struct resource *res;
-       int i;
-
-       if (pci_is_root_bus(child))     /* It's a host bus, nothing to read */
-               return;
-
-       dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n",
-                child->secondary, child->subordinate,
-                dev->transparent ? " (subtractive decode)": "");
-
-       if (dev->transparent) {
-               for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
-                       child->resource[i] = child->parent->resource[i - 3];
-       }
 
        res = child->resource[0];
        pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo);
@@ -316,26 +303,50 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                limit |= (io_limit_hi << 16);
        }
 
-       if (base <= limit) {
+       if (base && base <= limit) {
                res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
                if (!res->start)
                        res->start = base;
                if (!res->end)
                        res->end = limit + 0xfff;
                dev_printk(KERN_DEBUG, &dev->dev, "  bridge window %pR\n", res);
+       } else {
+               dev_printk(KERN_DEBUG, &dev->dev,
+                        "  bridge window [io  %04lx - %04lx] reg reading\n",
+                                base, limit);
        }
+}
+
+static void __devinit pci_read_bridge_mmio(struct pci_bus *child)
+{
+       struct pci_dev *dev = child->self;
+       u16 mem_base_lo, mem_limit_lo;
+       unsigned long base, limit;
+       struct resource *res;
 
        res = child->resource[1];
        pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo);
        pci_read_config_word(dev, PCI_MEMORY_LIMIT, &mem_limit_lo);
        base = (mem_base_lo & PCI_MEMORY_RANGE_MASK) << 16;
        limit = (mem_limit_lo & PCI_MEMORY_RANGE_MASK) << 16;
-       if (base <= limit) {
+       if (base && base <= limit) {
                res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
                res->start = base;
                res->end = limit + 0xfffff;
                dev_printk(KERN_DEBUG, &dev->dev, "  bridge window %pR\n", res);
+       } else {
+               dev_printk(KERN_DEBUG, &dev->dev,
+                       "  bridge window [mem 0x%08lx - 0x%08lx] reg reading\n",
+                                        base, limit + 0xfffff);
        }
+}
+
+static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child)
+{
+       struct pci_dev *dev = child->self;
+       u16 mem_base_lo, mem_limit_lo;
+       unsigned long base, limit;
+       struct resource *res;
 
        res = child->resource[2];
        pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
@@ -366,7 +377,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
 #endif
                }
        }
-       if (base <= limit) {
+       if (base && base <= limit) {
                res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) |
                                         IORESOURCE_MEM | IORESOURCE_PREFETCH;
                if (res->flags & PCI_PREF_RANGE_TYPE_64)
@@ -374,6 +385,44 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                res->start = base;
                res->end = limit + 0xfffff;
                dev_printk(KERN_DEBUG, &dev->dev, "  bridge window %pR\n", res);
+       } else {
+               dev_printk(KERN_DEBUG, &dev->dev,
+                    "  bridge window [mem 0x%08lx - %08lx pref] reg reading\n",
+                                        base, limit + 0xfffff);
+       }
+}
+
+void __devinit pci_read_bridge_bases(struct pci_bus *child)
+{
+       struct pci_dev *dev = child->self;
+       struct resource *res;
+       int i;
+
+       if (pci_is_root_bus(child))     /* It's a host bus, nothing to read */
+               return;
+
+       dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n",
+                child->secondary, child->subordinate,
+                dev->transparent ? " (subtractive decode)" : "");
+
+       pci_bus_remove_resources(child);
+       for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
+               child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
+
+       pci_read_bridge_io(child);
+       pci_read_bridge_mmio(child);
+       pci_read_bridge_mmio_pref(child);
+
+       if (dev->transparent) {
+               pci_bus_for_each_resource(child->parent, res, i) {
+                       if (res) {
+                               pci_bus_add_resource(child, res,
+                                                    PCI_SUBTRACTIVE_DECODE);
+                               dev_printk(KERN_DEBUG, &dev->dev,
+                                          "  bridge window %pR (subtractive decode)\n",
+                                          res);
+                       }
+               }
        }
 }
 
@@ -387,10 +436,147 @@ static struct pci_bus * pci_alloc_bus(void)
                INIT_LIST_HEAD(&b->children);
                INIT_LIST_HEAD(&b->devices);
                INIT_LIST_HEAD(&b->slots);
+               INIT_LIST_HEAD(&b->resources);
+               b->max_bus_speed = PCI_SPEED_UNKNOWN;
+               b->cur_bus_speed = PCI_SPEED_UNKNOWN;
        }
        return b;
 }
 
+static unsigned char pcix_bus_speed[] = {
+       PCI_SPEED_UNKNOWN,              /* 0 */
+       PCI_SPEED_66MHz_PCIX,           /* 1 */
+       PCI_SPEED_100MHz_PCIX,          /* 2 */
+       PCI_SPEED_133MHz_PCIX,          /* 3 */
+       PCI_SPEED_UNKNOWN,              /* 4 */
+       PCI_SPEED_66MHz_PCIX_ECC,       /* 5 */
+       PCI_SPEED_100MHz_PCIX_ECC,      /* 6 */
+       PCI_SPEED_133MHz_PCIX_ECC,      /* 7 */
+       PCI_SPEED_UNKNOWN,              /* 8 */
+       PCI_SPEED_66MHz_PCIX_266,       /* 9 */
+       PCI_SPEED_100MHz_PCIX_266,      /* A */
+       PCI_SPEED_133MHz_PCIX_266,      /* B */
+       PCI_SPEED_UNKNOWN,              /* C */
+       PCI_SPEED_66MHz_PCIX_533,       /* D */
+       PCI_SPEED_100MHz_PCIX_533,      /* E */
+       PCI_SPEED_133MHz_PCIX_533       /* F */
+};
+
+static unsigned char pcie_link_speed[] = {
+       PCI_SPEED_UNKNOWN,              /* 0 */
+       PCIE_SPEED_2_5GT,               /* 1 */
+       PCIE_SPEED_5_0GT,               /* 2 */
+       PCIE_SPEED_8_0GT,               /* 3 */
+       PCI_SPEED_UNKNOWN,              /* 4 */
+       PCI_SPEED_UNKNOWN,              /* 5 */
+       PCI_SPEED_UNKNOWN,              /* 6 */
+       PCI_SPEED_UNKNOWN,              /* 7 */
+       PCI_SPEED_UNKNOWN,              /* 8 */
+       PCI_SPEED_UNKNOWN,              /* 9 */
+       PCI_SPEED_UNKNOWN,              /* A */
+       PCI_SPEED_UNKNOWN,              /* B */
+       PCI_SPEED_UNKNOWN,              /* C */
+       PCI_SPEED_UNKNOWN,              /* D */
+       PCI_SPEED_UNKNOWN,              /* E */
+       PCI_SPEED_UNKNOWN               /* F */
+};
+
+void pcie_update_link_speed(struct pci_bus *bus, u16 linksta)
+{
+       bus->cur_bus_speed = pcie_link_speed[linksta & 0xf];
+}
+EXPORT_SYMBOL_GPL(pcie_update_link_speed);
+
+static unsigned char agp_speeds[] = {
+       AGP_UNKNOWN,
+       AGP_1X,
+       AGP_2X,
+       AGP_4X,
+       AGP_8X
+};
+
+static enum pci_bus_speed agp_speed(int agp3, int agpstat)
+{
+       int index = 0;
+
+       if (agpstat & 4)
+               index = 3;
+       else if (agpstat & 2)
+               index = 2;
+       else if (agpstat & 1)
+               index = 1;
+       else
+               goto out;
+       
+       if (agp3) {
+               index += 2;
+               if (index == 5)
+                       index = 0;
+       }
+
+ out:
+       return agp_speeds[index];
+}
+
+
+static void pci_set_bus_speed(struct pci_bus *bus)
+{
+       struct pci_dev *bridge = bus->self;
+       int pos;
+
+       pos = pci_find_capability(bridge, PCI_CAP_ID_AGP);
+       if (!pos)
+               pos = pci_find_capability(bridge, PCI_CAP_ID_AGP3);
+       if (pos) {
+               u32 agpstat, agpcmd;
+
+               pci_read_config_dword(bridge, pos + PCI_AGP_STATUS, &agpstat);
+               bus->max_bus_speed = agp_speed(agpstat & 8, agpstat & 7);
+
+               pci_read_config_dword(bridge, pos + PCI_AGP_COMMAND, &agpcmd);
+               bus->cur_bus_speed = agp_speed(agpstat & 8, agpcmd & 7);
+       }
+
+       pos = pci_find_capability(bridge, PCI_CAP_ID_PCIX);
+       if (pos) {
+               u16 status;
+               enum pci_bus_speed max;
+               pci_read_config_word(bridge, pos + 2, &status);
+
+               if (status & 0x8000) {
+                       max = PCI_SPEED_133MHz_PCIX_533;
+               } else if (status & 0x4000) {
+                       max = PCI_SPEED_133MHz_PCIX_266;
+               } else if (status & 0x0002) {
+                       if (((status >> 12) & 0x3) == 2) {
+                               max = PCI_SPEED_133MHz_PCIX_ECC;
+                       } else {
+                               max = PCI_SPEED_133MHz_PCIX;
+                       }
+               } else {
+                       max = PCI_SPEED_66MHz_PCIX;
+               }
+
+               bus->max_bus_speed = max;
+               bus->cur_bus_speed = pcix_bus_speed[(status >> 6) & 0xf];
+
+               return;
+       }
+
+       pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
+       if (pos) {
+               u32 linkcap;
+               u16 linksta;
+
+               pci_read_config_dword(bridge, pos + PCI_EXP_LNKCAP, &linkcap);
+               bus->max_bus_speed = pcie_link_speed[linkcap & 0xf];
+
+               pci_read_config_word(bridge, pos + PCI_EXP_LNKSTA, &linksta);
+               pcie_update_link_speed(bus, linksta);
+       }
+}
+
+
 static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
                                           struct pci_dev *bridge, int busnr)
 {
@@ -430,6 +616,8 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
        child->self = bridge;
        child->bridge = get_device(&bridge->dev);
 
+       pci_set_bus_speed(child);
+
        /* Set up default resource pointers and names.. */
        for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
                child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i];
@@ -681,7 +869,7 @@ static void pci_read_irq(struct pci_dev *dev)
        dev->irq = irq;
 }
 
-static void set_pcie_port_type(struct pci_dev *pdev)
+void set_pcie_port_type(struct pci_dev *pdev)
 {
        int pos;
        u16 reg16;
@@ -695,7 +883,7 @@ static void set_pcie_port_type(struct pci_dev *pdev)
        pdev->pcie_type = (reg16 & PCI_EXP_FLAGS_TYPE) >> 4;
 }
 
-static void set_pcie_hotplug_bridge(struct pci_dev *pdev)
+void set_pcie_hotplug_bridge(struct pci_dev *pdev)
 {
        int pos;
        u16 reg16;
@@ -1081,6 +1269,45 @@ struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
 }
 EXPORT_SYMBOL(pci_scan_single_device);
 
+static unsigned next_ari_fn(struct pci_dev *dev, unsigned fn)
+{
+       u16 cap;
+       unsigned pos, next_fn;
+
+       if (!dev)
+               return 0;
+
+       pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
+       if (!pos)
+               return 0;
+       pci_read_config_word(dev, pos + 4, &cap);
+       next_fn = cap >> 8;
+       if (next_fn <= fn)
+               return 0;
+       return next_fn;
+}
+
+static unsigned next_trad_fn(struct pci_dev *dev, unsigned fn)
+{
+       return (fn + 1) % 8;
+}
+
+static unsigned no_next_fn(struct pci_dev *dev, unsigned fn)
+{
+       return 0;
+}
+
+static int only_one_child(struct pci_bus *bus)
+{
+       struct pci_dev *parent = bus->self;
+       if (!parent || !pci_is_pcie(parent))
+               return 0;
+       if (parent->pcie_type == PCI_EXP_TYPE_ROOT_PORT ||
+           parent->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)
+               return 1;
+       return 0;
+}
+
 /**
  * pci_scan_slot - scan a PCI slot on a bus for devices.
  * @bus: PCI bus to scan
@@ -1094,21 +1321,30 @@ EXPORT_SYMBOL(pci_scan_single_device);
  */
 int pci_scan_slot(struct pci_bus *bus, int devfn)
 {
-       int fn, nr = 0;
+       unsigned fn, nr = 0;
        struct pci_dev *dev;
+       unsigned (*next_fn)(struct pci_dev *, unsigned) = no_next_fn;
+
+       if (only_one_child(bus) && (devfn > 0))
+               return 0; /* Already scanned the entire slot */
 
        dev = pci_scan_single_device(bus, devfn);
-       if (dev && !dev->is_added)      /* new device? */
+       if (!dev)
+               return 0;
+       if (!dev->is_added)
                nr++;
 
-       if (dev && dev->multifunction) {
-               for (fn = 1; fn < 8; fn++) {
-                       dev = pci_scan_single_device(bus, devfn + fn);
-                       if (dev) {
-                               if (!dev->is_added)
-                                       nr++;
-                               dev->multifunction = 1;
-                       }
+       if (pci_ari_enabled(bus))
+               next_fn = next_ari_fn;
+       else if (dev->multifunction)
+               next_fn = next_trad_fn;
+
+       for (fn = next_fn(dev, 0); fn > 0; fn = next_fn(dev, fn)) {
+               dev = pci_scan_single_device(bus, devfn + fn);
+               if (dev) {
+                       if (!dev->is_added)
+                               nr++;
+                       dev->multifunction = 1;
                }
        }
 
@@ -1200,6 +1436,7 @@ struct pci_bus * pci_create_bus(struct device *parent,
        if (error)
                goto dev_reg_err;
        b->bridge = get_device(dev);
+       device_enable_async_suspend(b->bridge);
 
        if (!parent)
                set_dev_node(b->bridge, pcibus_to_node(b));
index c74694345b6ea6321fe643c2720c86812220f363..790eb69a4aa94692c0ae4c571465fdb87a264edb 100644 (file)
 #include <linux/dmi.h>
 #include <linux/pci-aspm.h>
 #include <linux/ioport.h>
+#include <asm/dma.h>   /* isa_dma_bridge_buggy */
 #include "pci.h"
 
-int isa_dma_bridge_buggy;
-EXPORT_SYMBOL(isa_dma_bridge_buggy);
-int pci_pci_problems;
-EXPORT_SYMBOL(pci_pci_problems);
-
-#ifdef CONFIG_PCI_QUIRKS
 /*
  * This quirk function disables memory decoding and releases memory resources
  * of the device specified by kernel's boot parameter 'pci=resource_alignment='.
@@ -338,6 +333,23 @@ static void __devinit quirk_s3_64M(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,     PCI_DEVICE_ID_S3_868,           quirk_s3_64M);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,     PCI_DEVICE_ID_S3_968,           quirk_s3_64M);
 
+/*
+ * Some CS5536 BIOSes (for example, the Soekris NET5501 board w/ comBIOS
+ * ver. 1.33  20070103) don't set the correct ISA PCI region header info.
+ * BAR0 should be 8 bytes; instead, it may be set to something like 8k
+ * (which conflicts w/ BAR1's memory range).
+ */
+static void __devinit quirk_cs5536_vsa(struct pci_dev *dev)
+{
+       if (pci_resource_len(dev, 0) != 8) {
+               struct resource *res = &dev->resource[0];
+               res->end = res->start + 8 - 1;
+               dev_info(&dev->dev, "CS5536 ISA bridge bug detected "
+                               "(incorrect header); workaround applied.\n");
+       }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa);
+
 static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
        unsigned size, int nr, const char *name)
 {
@@ -2595,6 +2607,7 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
        }
        pci_do_fixups(dev, start, end);
 }
+EXPORT_SYMBOL(pci_fixup_device);
 
 static int __init pci_apply_final_quirks(void)
 {
@@ -2706,9 +2719,3 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
 
        return -ENOTTY;
 }
-
-#else
-void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
-int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; }
-#endif
-EXPORT_SYMBOL(pci_fixup_device);
index c48cd377b3f56451731ed72d6953caaea349f8bd..4fe36d2e104930cc99cc7014b27614277d75c9f8 100644 (file)
 #include <linux/slab.h>
 #include "pci.h"
 
-static void pbus_assign_resources_sorted(const struct pci_bus *bus)
-{
-       struct pci_dev *dev;
+struct resource_list_x {
+       struct resource_list_x *next;
        struct resource *res;
-       struct resource_list head, *list, *tmp;
-       int idx;
+       struct pci_dev *dev;
+       resource_size_t start;
+       resource_size_t end;
+       unsigned long flags;
+};
 
-       head.next = NULL;
-       list_for_each_entry(dev, &bus->devices, bus_list) {
-               u16 class = dev->class >> 8;
+static void add_to_failed_list(struct resource_list_x *head,
+                                struct pci_dev *dev, struct resource *res)
+{
+       struct resource_list_x *list = head;
+       struct resource_list_x *ln = list->next;
+       struct resource_list_x *tmp;
 
-               /* Don't touch classless devices or host bridges or ioapics.  */
-               if (class == PCI_CLASS_NOT_DEFINED ||
-                   class == PCI_CLASS_BRIDGE_HOST)
-                       continue;
+       tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
+       if (!tmp) {
+               pr_warning("add_to_failed_list: kmalloc() failed!\n");
+               return;
+       }
 
-               /* Don't touch ioapic devices already enabled by firmware */
-               if (class == PCI_CLASS_SYSTEM_PIC) {
-                       u16 command;
-                       pci_read_config_word(dev, PCI_COMMAND, &command);
-                       if (command & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))
-                               continue;
-               }
+       tmp->next = ln;
+       tmp->res = res;
+       tmp->dev = dev;
+       tmp->start = res->start;
+       tmp->end = res->end;
+       tmp->flags = res->flags;
+       list->next = tmp;
+}
+
+static void free_failed_list(struct resource_list_x *head)
+{
+       struct resource_list_x *list, *tmp;
 
-               pdev_sort_resources(dev, &head);
+       for (list = head->next; list;) {
+               tmp = list;
+               list = list->next;
+               kfree(tmp);
        }
 
-       for (list = head.next; list;) {
+       head->next = NULL;
+}
+
+static void __dev_sort_resources(struct pci_dev *dev,
+                                struct resource_list *head)
+{
+       u16 class = dev->class >> 8;
+
+       /* Don't touch classless devices or host bridges or ioapics.  */
+       if (class == PCI_CLASS_NOT_DEFINED || class == PCI_CLASS_BRIDGE_HOST)
+               return;
+
+       /* Don't touch ioapic devices already enabled by firmware */
+       if (class == PCI_CLASS_SYSTEM_PIC) {
+               u16 command;
+               pci_read_config_word(dev, PCI_COMMAND, &command);
+               if (command & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))
+                       return;
+       }
+
+       pdev_sort_resources(dev, head);
+}
+
+static void __assign_resources_sorted(struct resource_list *head,
+                                struct resource_list_x *fail_head)
+{
+       struct resource *res;
+       struct resource_list *list, *tmp;
+       int idx;
+
+       for (list = head->next; list;) {
                res = list->res;
                idx = res - &list->dev->resource[0];
+
                if (pci_assign_resource(list->dev, idx)) {
+                       if (fail_head && !pci_is_root_bus(list->dev->bus)) {
+                               /*
+                                * if the failed res is for ROM BAR, and it will
+                                * be enabled later, don't add it to the list
+                                */
+                               if (!((idx == PCI_ROM_RESOURCE) &&
+                                     (!(res->flags & IORESOURCE_ROM_ENABLE))))
+                                       add_to_failed_list(fail_head, list->dev, res);
+                       }
                        res->start = 0;
                        res->end = 0;
                        res->flags = 0;
@@ -68,6 +122,30 @@ static void pbus_assign_resources_sorted(const struct pci_bus *bus)
        }
 }
 
+static void pdev_assign_resources_sorted(struct pci_dev *dev,
+                                struct resource_list_x *fail_head)
+{
+       struct resource_list head;
+
+       head.next = NULL;
+       __dev_sort_resources(dev, &head);
+       __assign_resources_sorted(&head, fail_head);
+
+}
+
+static void pbus_assign_resources_sorted(const struct pci_bus *bus,
+                                        struct resource_list_x *fail_head)
+{
+       struct pci_dev *dev;
+       struct resource_list head;
+
+       head.next = NULL;
+       list_for_each_entry(dev, &bus->devices, bus_list)
+               __dev_sort_resources(dev, &head);
+
+       __assign_resources_sorted(&head, fail_head);
+}
+
 void pci_setup_cardbus(struct pci_bus *bus)
 {
        struct pci_dev *bridge = bus->self;
@@ -134,18 +212,12 @@ EXPORT_SYMBOL(pci_setup_cardbus);
    config space writes, so it's quite possible that an I/O window of
    the bridge will have some undesirable address (e.g. 0) after the
    first write. Ditto 64-bit prefetchable MMIO.  */
-static void pci_setup_bridge(struct pci_bus *bus)
+static void pci_setup_bridge_io(struct pci_bus *bus)
 {
        struct pci_dev *bridge = bus->self;
        struct resource *res;
        struct pci_bus_region region;
-       u32 l, bu, lu, io_upper16;
-
-       if (pci_is_enabled(bridge))
-               return;
-
-       dev_info(&bridge->dev, "PCI bridge to [bus %02x-%02x]\n",
-                bus->secondary, bus->subordinate);
+       u32 l, io_upper16;
 
        /* Set up the top and bottom of the PCI I/O segment for this bus. */
        res = bus->resource[0];
@@ -158,8 +230,7 @@ static void pci_setup_bridge(struct pci_bus *bus)
                /* Set up upper 16 bits of I/O base/limit. */
                io_upper16 = (region.end & 0xffff0000) | (region.start >> 16);
                dev_info(&bridge->dev, "  bridge window %pR\n", res);
-       }
-       else {
+       } else {
                /* Clear upper 16 bits of I/O base/limit. */
                io_upper16 = 0;
                l = 0x00f0;
@@ -171,21 +242,35 @@ static void pci_setup_bridge(struct pci_bus *bus)
        pci_write_config_dword(bridge, PCI_IO_BASE, l);
        /* Update upper 16 bits of I/O base/limit. */
        pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, io_upper16);
+}
+
+static void pci_setup_bridge_mmio(struct pci_bus *bus)
+{
+       struct pci_dev *bridge = bus->self;
+       struct resource *res;
+       struct pci_bus_region region;
+       u32 l;
 
-       /* Set up the top and bottom of the PCI Memory segment
-          for this bus. */
+       /* Set up the top and bottom of the PCI Memory segment for this bus. */
        res = bus->resource[1];
        pcibios_resource_to_bus(bridge, &region, res);
        if (res->flags & IORESOURCE_MEM) {
                l = (region.start >> 16) & 0xfff0;
                l |= region.end & 0xfff00000;
                dev_info(&bridge->dev, "  bridge window %pR\n", res);
-       }
-       else {
+       } else {
                l = 0x0000fff0;
                dev_info(&bridge->dev, "  bridge window [mem disabled]\n");
        }
        pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
+}
+
+static void pci_setup_bridge_mmio_pref(struct pci_bus *bus)
+{
+       struct pci_dev *bridge = bus->self;
+       struct resource *res;
+       struct pci_bus_region region;
+       u32 l, bu, lu;
 
        /* Clear out the upper 32 bits of PREF limit.
           If PCI_PREF_BASE_UPPER32 was non-zero, this temporarily
@@ -204,8 +289,7 @@ static void pci_setup_bridge(struct pci_bus *bus)
                        lu = upper_32_bits(region.end);
                }
                dev_info(&bridge->dev, "  bridge window %pR\n", res);
-       }
-       else {
+       } else {
                l = 0x0000fff0;
                dev_info(&bridge->dev, "  bridge window [mem pref disabled]\n");
        }
@@ -214,10 +298,35 @@ static void pci_setup_bridge(struct pci_bus *bus)
        /* Set the upper 32 bits of PREF base & limit. */
        pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, bu);
        pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, lu);
+}
+
+static void __pci_setup_bridge(struct pci_bus *bus, unsigned long type)
+{
+       struct pci_dev *bridge = bus->self;
+
+       dev_info(&bridge->dev, "PCI bridge to [bus %02x-%02x]\n",
+                bus->secondary, bus->subordinate);
+
+       if (type & IORESOURCE_IO)
+               pci_setup_bridge_io(bus);
+
+       if (type & IORESOURCE_MEM)
+               pci_setup_bridge_mmio(bus);
+
+       if (type & IORESOURCE_PREFETCH)
+               pci_setup_bridge_mmio_pref(bus);
 
        pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
 }
 
+static void pci_setup_bridge(struct pci_bus *bus)
+{
+       unsigned long type = IORESOURCE_IO | IORESOURCE_MEM |
+                                 IORESOURCE_PREFETCH;
+
+       __pci_setup_bridge(bus, type);
+}
+
 /* Check whether the bridge supports optional I/O and
    prefetchable memory ranges. If not, the respective
    base/limit registers must be read-only and read as 0. */
@@ -253,8 +362,11 @@ static void pci_bridge_check_ranges(struct pci_bus *bus)
        }
        if (pmem) {
                b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
-               if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64)
+               if ((pmem & PCI_PREF_RANGE_TYPE_MASK) ==
+                   PCI_PREF_RANGE_TYPE_64) {
                        b_res[2].flags |= IORESOURCE_MEM_64;
+                       b_res[2].flags |= PCI_PREF_RANGE_TYPE_64;
+               }
        }
 
        /* double check if bridge does support 64 bit pref */
@@ -283,8 +395,7 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon
        unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
                                  IORESOURCE_PREFETCH;
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               r = bus->resource[i];
+       pci_bus_for_each_resource(bus, r, i) {
                if (r == &ioport_resource || r == &iomem_resource)
                        continue;
                if (r && (r->flags & type_mask) == type && !r->parent)
@@ -301,7 +412,7 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size)
 {
        struct pci_dev *dev;
        struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO);
-       unsigned long size = 0, size1 = 0;
+       unsigned long size = 0, size1 = 0, old_size;
 
        if (!b_res)
                return;
@@ -326,12 +437,17 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size)
        }
        if (size < min_size)
                size = min_size;
+       old_size = resource_size(b_res);
+       if (old_size == 1)
+               old_size = 0;
 /* To be fixed in 2.5: we should have sort of HAVE_ISA
    flag in the struct pci_bus. */
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
        size = (size & 0xff) + ((size & ~0xffUL) << 2);
 #endif
        size = ALIGN(size + size1, 4096);
+       if (size < old_size)
+               size = old_size;
        if (!size) {
                if (b_res->start || b_res->end)
                        dev_info(&bus->self->dev, "disabling bridge window "
@@ -352,7 +468,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
                         unsigned long type, resource_size_t min_size)
 {
        struct pci_dev *dev;
-       resource_size_t min_align, align, size;
+       resource_size_t min_align, align, size, old_size;
        resource_size_t aligns[12];     /* Alignments from 1Mb to 2Gb */
        int order, max_order;
        struct resource *b_res = find_free_bus_resource(bus, type);
@@ -402,6 +518,11 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
        }
        if (size < min_size)
                size = min_size;
+       old_size = resource_size(b_res);
+       if (old_size == 1)
+               old_size = 0;
+       if (size < old_size)
+               size = old_size;
 
        align = 0;
        min_align = 0;
@@ -538,23 +659,25 @@ void __ref pci_bus_size_bridges(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pci_bus_size_bridges);
 
-void __ref pci_bus_assign_resources(const struct pci_bus *bus)
+static void __ref __pci_bus_assign_resources(const struct pci_bus *bus,
+                                        struct resource_list_x *fail_head)
 {
        struct pci_bus *b;
        struct pci_dev *dev;
 
-       pbus_assign_resources_sorted(bus);
+       pbus_assign_resources_sorted(bus, fail_head);
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
                b = dev->subordinate;
                if (!b)
                        continue;
 
-               pci_bus_assign_resources(b);
+               __pci_bus_assign_resources(b, fail_head);
 
                switch (dev->class >> 8) {
                case PCI_CLASS_BRIDGE_PCI:
-                       pci_setup_bridge(b);
+                       if (!pci_is_enabled(dev))
+                               pci_setup_bridge(b);
                        break;
 
                case PCI_CLASS_BRIDGE_CARDBUS:
@@ -568,15 +691,130 @@ void __ref pci_bus_assign_resources(const struct pci_bus *bus)
                }
        }
 }
+
+void __ref pci_bus_assign_resources(const struct pci_bus *bus)
+{
+       __pci_bus_assign_resources(bus, NULL);
+}
 EXPORT_SYMBOL(pci_bus_assign_resources);
 
+static void __ref __pci_bridge_assign_resources(const struct pci_dev *bridge,
+                                        struct resource_list_x *fail_head)
+{
+       struct pci_bus *b;
+
+       pdev_assign_resources_sorted((struct pci_dev *)bridge, fail_head);
+
+       b = bridge->subordinate;
+       if (!b)
+               return;
+
+       __pci_bus_assign_resources(b, fail_head);
+
+       switch (bridge->class >> 8) {
+       case PCI_CLASS_BRIDGE_PCI:
+               pci_setup_bridge(b);
+               break;
+
+       case PCI_CLASS_BRIDGE_CARDBUS:
+               pci_setup_cardbus(b);
+               break;
+
+       default:
+               dev_info(&bridge->dev, "not setting up bridge for bus "
+                        "%04x:%02x\n", pci_domain_nr(b), b->number);
+               break;
+       }
+}
+static void pci_bridge_release_resources(struct pci_bus *bus,
+                                         unsigned long type)
+{
+       int idx;
+       bool changed = false;
+       struct pci_dev *dev;
+       struct resource *r;
+       unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
+                                 IORESOURCE_PREFETCH;
+
+       dev = bus->self;
+       for (idx = PCI_BRIDGE_RESOURCES; idx <= PCI_BRIDGE_RESOURCE_END;
+            idx++) {
+               r = &dev->resource[idx];
+               if ((r->flags & type_mask) != type)
+                       continue;
+               if (!r->parent)
+                       continue;
+               /*
+                * if there are children under that, we should release them
+                *  all
+                */
+               release_child_resources(r);
+               if (!release_resource(r)) {
+                       dev_printk(KERN_DEBUG, &dev->dev,
+                                "resource %d %pR released\n", idx, r);
+                       /* keep the old size */
+                       r->end = resource_size(r) - 1;
+                       r->start = 0;
+                       r->flags = 0;
+                       changed = true;
+               }
+       }
+
+       if (changed) {
+               /* avoiding touch the one without PREF */
+               if (type & IORESOURCE_PREFETCH)
+                       type = IORESOURCE_PREFETCH;
+               __pci_setup_bridge(bus, type);
+       }
+}
+
+enum release_type {
+       leaf_only,
+       whole_subtree,
+};
+/*
+ * try to release pci bridge resources that is from leaf bridge,
+ * so we can allocate big new one later
+ */
+static void __ref pci_bus_release_bridge_resources(struct pci_bus *bus,
+                                                  unsigned long type,
+                                                  enum release_type rel_type)
+{
+       struct pci_dev *dev;
+       bool is_leaf_bridge = true;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               struct pci_bus *b = dev->subordinate;
+               if (!b)
+                       continue;
+
+               is_leaf_bridge = false;
+
+               if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
+                       continue;
+
+               if (rel_type == whole_subtree)
+                       pci_bus_release_bridge_resources(b, type,
+                                                whole_subtree);
+       }
+
+       if (pci_is_root_bus(bus))
+               return;
+
+       if ((bus->self->class >> 8) != PCI_CLASS_BRIDGE_PCI)
+               return;
+
+       if ((rel_type == whole_subtree) || is_leaf_bridge)
+               pci_bridge_release_resources(bus, type);
+}
+
 static void pci_bus_dump_res(struct pci_bus *bus)
 {
-        int i;
+       struct resource *res;
+       int i;
 
-        for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-                struct resource *res = bus->resource[i];
-                if (!res || !res->end)
+       pci_bus_for_each_resource(bus, res, i) {
+               if (!res || !res->end || !res->flags)
                         continue;
 
                dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res);
@@ -600,11 +838,65 @@ static void pci_bus_dump_resources(struct pci_bus *bus)
        }
 }
 
+static int __init pci_bus_get_depth(struct pci_bus *bus)
+{
+       int depth = 0;
+       struct pci_dev *dev;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               int ret;
+               struct pci_bus *b = dev->subordinate;
+               if (!b)
+                       continue;
+
+               ret = pci_bus_get_depth(b);
+               if (ret + 1 > depth)
+                       depth = ret + 1;
+       }
+
+       return depth;
+}
+static int __init pci_get_max_depth(void)
+{
+       int depth = 0;
+       struct pci_bus *bus;
+
+       list_for_each_entry(bus, &pci_root_buses, node) {
+               int ret;
+
+               ret = pci_bus_get_depth(bus);
+               if (ret > depth)
+                       depth = ret;
+       }
+
+       return depth;
+}
+
+/*
+ * first try will not touch pci bridge res
+ * second  and later try will clear small leaf bridge res
+ * will stop till to the max  deepth if can not find good one
+ */
 void __init
 pci_assign_unassigned_resources(void)
 {
        struct pci_bus *bus;
+       int tried_times = 0;
+       enum release_type rel_type = leaf_only;
+       struct resource_list_x head, *list;
+       unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
+                                 IORESOURCE_PREFETCH;
+       unsigned long failed_type;
+       int max_depth = pci_get_max_depth();
+       int pci_try_num;
+
+       head.next = NULL;
+
+       pci_try_num = max_depth + 1;
+       printk(KERN_DEBUG "PCI: max bus depth: %d pci_try_num: %d\n",
+                max_depth, pci_try_num);
 
+again:
        /* Depth first, calculate sizes and alignments of all
           subordinate buses. */
        list_for_each_entry(bus, &pci_root_buses, node) {
@@ -612,12 +904,130 @@ pci_assign_unassigned_resources(void)
        }
        /* Depth last, allocate resources and update the hardware. */
        list_for_each_entry(bus, &pci_root_buses, node) {
-               pci_bus_assign_resources(bus);
-               pci_enable_bridges(bus);
+               __pci_bus_assign_resources(bus, &head);
        }
+       tried_times++;
+
+       /* any device complain? */
+       if (!head.next)
+               goto enable_and_dump;
+       failed_type = 0;
+       for (list = head.next; list;) {
+               failed_type |= list->flags;
+               list = list->next;
+       }
+       /*
+        * io port are tight, don't try extra
+        * or if reach the limit, don't want to try more
+        */
+       failed_type &= type_mask;
+       if ((failed_type == IORESOURCE_IO) || (tried_times >= pci_try_num)) {
+               free_failed_list(&head);
+               goto enable_and_dump;
+       }
+
+       printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
+                        tried_times + 1);
+
+       /* third times and later will not check if it is leaf */
+       if ((tried_times + 1) > 2)
+               rel_type = whole_subtree;
+
+       /*
+        * Try to release leaf bridge's resources that doesn't fit resource of
+        * child device under that bridge
+        */
+       for (list = head.next; list;) {
+               bus = list->dev->bus;
+               pci_bus_release_bridge_resources(bus, list->flags & type_mask,
+                                                 rel_type);
+               list = list->next;
+       }
+       /* restore size and flags */
+       for (list = head.next; list;) {
+               struct resource *res = list->res;
+
+               res->start = list->start;
+               res->end = list->end;
+               res->flags = list->flags;
+               if (list->dev->subordinate)
+                       res->flags = 0;
+
+               list = list->next;
+       }
+       free_failed_list(&head);
+
+       goto again;
+
+enable_and_dump:
+       /* Depth last, update the hardware. */
+       list_for_each_entry(bus, &pci_root_buses, node)
+               pci_enable_bridges(bus);
 
        /* dump the resource on buses */
        list_for_each_entry(bus, &pci_root_buses, node) {
                pci_bus_dump_resources(bus);
        }
 }
+
+void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
+{
+       struct pci_bus *parent = bridge->subordinate;
+       int tried_times = 0;
+       struct resource_list_x head, *list;
+       int retval;
+       unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
+                                 IORESOURCE_PREFETCH;
+
+       head.next = NULL;
+
+again:
+       pci_bus_size_bridges(parent);
+       __pci_bridge_assign_resources(bridge, &head);
+       retval = pci_reenable_device(bridge);
+       pci_set_master(bridge);
+       pci_enable_bridges(parent);
+
+       tried_times++;
+
+       if (!head.next)
+               return;
+
+       if (tried_times >= 2) {
+               /* still fail, don't need to try more */
+               free_failed_list(&head);
+               return;
+       }
+
+       printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
+                        tried_times + 1);
+
+       /*
+        * Try to release leaf bridge's resources that doesn't fit resource of
+        * child device under that bridge
+        */
+       for (list = head.next; list;) {
+               struct pci_bus *bus = list->dev->bus;
+               unsigned long flags = list->flags;
+
+               pci_bus_release_bridge_resources(bus, flags & type_mask,
+                                                whole_subtree);
+               list = list->next;
+       }
+       /* restore size and flags */
+       for (list = head.next; list;) {
+               struct resource *res = list->res;
+
+               res->start = list->start;
+               res->end = list->end;
+               res->flags = list->flags;
+               if (list->dev->subordinate)
+                       res->flags = 0;
+
+               list = list->next;
+       }
+       free_failed_list(&head);
+
+       goto again;
+}
+EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources);
index 8c02b6c53bdbd483ce6161bc92ba83f0352bae51..49c9e6c9779a1e5ef1209cdfc2b45821799d9c06 100644 (file)
@@ -47,6 +47,55 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf)
                                slot->number);
 }
 
+/* these strings match up with the values in pci_bus_speed */
+static char *pci_bus_speed_strings[] = {
+       "33 MHz PCI",           /* 0x00 */
+       "66 MHz PCI",           /* 0x01 */
+       "66 MHz PCI-X",         /* 0x02 */
+       "100 MHz PCI-X",        /* 0x03 */
+       "133 MHz PCI-X",        /* 0x04 */
+       NULL,                   /* 0x05 */
+       NULL,                   /* 0x06 */
+       NULL,                   /* 0x07 */
+       NULL,                   /* 0x08 */
+       "66 MHz PCI-X 266",     /* 0x09 */
+       "100 MHz PCI-X 266",    /* 0x0a */
+       "133 MHz PCI-X 266",    /* 0x0b */
+       "Unknown AGP",          /* 0x0c */
+       "1x AGP",               /* 0x0d */
+       "2x AGP",               /* 0x0e */
+       "4x AGP",               /* 0x0f */
+       "8x AGP",               /* 0x10 */
+       "66 MHz PCI-X 533",     /* 0x11 */
+       "100 MHz PCI-X 533",    /* 0x12 */
+       "133 MHz PCI-X 533",    /* 0x13 */
+       "2.5 GT/s PCIe",        /* 0x14 */
+       "5.0 GT/s PCIe",        /* 0x15 */
+       "8.0 GT/s PCIe",        /* 0x16 */
+};
+
+static ssize_t bus_speed_read(enum pci_bus_speed speed, char *buf)
+{
+       const char *speed_string;
+
+       if (speed < ARRAY_SIZE(pci_bus_speed_strings))
+               speed_string = pci_bus_speed_strings[speed];
+       else
+               speed_string = "Unknown";
+
+       return sprintf(buf, "%s\n", speed_string);
+}
+
+static ssize_t max_speed_read_file(struct pci_slot *slot, char *buf)
+{
+       return bus_speed_read(slot->bus->max_bus_speed, buf);
+}
+
+static ssize_t cur_speed_read_file(struct pci_slot *slot, char *buf)
+{
+       return bus_speed_read(slot->bus->cur_bus_speed, buf);
+}
+
 static void pci_slot_release(struct kobject *kobj)
 {
        struct pci_dev *dev;
@@ -66,9 +115,15 @@ static void pci_slot_release(struct kobject *kobj)
 
 static struct pci_slot_attribute pci_slot_attr_address =
        __ATTR(address, (S_IFREG | S_IRUGO), address_read_file, NULL);
+static struct pci_slot_attribute pci_slot_attr_max_speed =
+       __ATTR(max_bus_speed, (S_IFREG | S_IRUGO), max_speed_read_file, NULL);
+static struct pci_slot_attribute pci_slot_attr_cur_speed =
+       __ATTR(cur_bus_speed, (S_IFREG | S_IRUGO), cur_speed_read_file, NULL);
 
 static struct attribute *pci_slot_default_attrs[] = {
        &pci_slot_attr_address.attr,
+       &pci_slot_attr_max_speed.attr,
+       &pci_slot_attr_cur_speed.attr,
        NULL,
 };
 
index 9f3adbd9f7005e02b6886f5915f42faaee89994f..0a6601c76809bb90c041742c5f8ba437f9be6814 100644 (file)
@@ -84,7 +84,7 @@ config YENTA
        tristate "CardBus yenta-compatible bridge support"
        depends on PCI
        select CARDBUS if !EMBEDDED
-       select PCCARD_NONSTATIC
+       select PCCARD_NONSTATIC if PCMCIA != n
        ---help---
          This option enables support for CardBus host bridges.  Virtually
          all modern PCMCIA bridges are CardBus compatible.  A "bridge" is
@@ -161,9 +161,8 @@ config TCIC
 
 config PCMCIA_M8XX
        tristate "MPC8xx PCMCIA support"
-       depends on PCMCIA && PPC && 8xx
-       select PCCARD_IODYN
-       select PCCARD_NONSTATIC
+       depends on PCCARD && PPC && 8xx
+       select PCCARD_IODYN if PCMCIA != n
        help
          Say Y here to include support for PowerPC 8xx series PCMCIA
          controller.
@@ -174,6 +173,27 @@ config PCMCIA_AU1X00
        tristate "Au1x00 pcmcia support"
        depends on SOC_AU1X00 && PCMCIA
 
+config PCMCIA_ALCHEMY_DEVBOARD
+       tristate "Alchemy Db/Pb1xxx PCMCIA socket services"
+       depends on SOC_AU1X00 && PCMCIA
+       select 64BIT_PHYS_ADDR
+       help
+         Enable this driver of you want PCMCIA support on your Alchemy
+         Db1000, Db/Pb1100, Db/Pb1500, Db/Pb1550, Db/Pb1200 board.
+         NOT suitable for the PB1000!
+
+         This driver is also available as a module called db1xxx_ss.ko
+
+config PCMCIA_XXS1500
+       tristate "MyCable XXS1500 PCMCIA socket support"
+       depends on PCMCIA && MIPS_XXS1500
+       select 64BIT_PHYS_ADDR
+       help
+         Support for the PCMCIA/CF socket interface on MyCable XXS1500
+         systems.
+
+         This driver is also available as a module called xxs1500_ss.ko
+
 config PCMCIA_BCM63XX
        tristate "bcm63xx pcmcia support"
        depends on BCM63XX && PCMCIA
@@ -238,14 +258,12 @@ config PCMCIA_PROBE
 config M32R_PCC
        bool "M32R PCMCIA I/F"
        depends on M32R && CHIP_M32700 && PCMCIA
-       select PCCARD_NONSTATIC
        help
          Say Y here to use the M32R PCMCIA controller.
 
 config M32R_CFC
        bool "M32R CF I/F Controller"
        depends on M32R && (PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_MAPPI3 || PLAT_OPSPUT)
-       select PCCARD_NONSTATIC
        help
          Say Y here to use the M32R CompactFlash controller.
 
index 83ff802de5446944d895f9c796d0544275c97533..381b031d9d7539ad3bc10d4a9091069a689e82e3 100644 (file)
@@ -2,11 +2,11 @@
 # Makefile for the kernel pcmcia subsystem (c/o David Hinds)
 #
 
-pcmcia_core-y                                  += cs.o cistpl.o rsrc_mgr.o socket_sysfs.o
+pcmcia_core-y                                  += cs.o rsrc_mgr.o socket_sysfs.o
 pcmcia_core-$(CONFIG_CARDBUS)                  += cardbus.o
 obj-$(CONFIG_PCCARD)                           += pcmcia_core.o
 
-pcmcia-y                                       += ds.o pcmcia_resource.o
+pcmcia-y                                       += ds.o pcmcia_resource.o cistpl.o
 pcmcia-$(CONFIG_PCMCIA_IOCTL)                  += pcmcia_ioctl.o
 obj-$(CONFIG_PCMCIA)                           += pcmcia.o
 
@@ -35,18 +35,10 @@ obj-$(CONFIG_OMAP_CF)                               += omap_cf.o
 obj-$(CONFIG_BFIN_CFPCMCIA)                    += bfin_cf_pcmcia.o
 obj-$(CONFIG_AT91_CF)                          += at91_cf.o
 obj-$(CONFIG_ELECTRA_CF)                       += electra_cf.o
+obj-$(CONFIG_PCMCIA_ALCHEMY_DEVBOARD)          += db1xxx_ss.o
 
 au1x00_ss-y                                    += au1000_generic.o
 au1x00_ss-$(CONFIG_MIPS_PB1000)                        += au1000_pb1x00.o
-au1x00_ss-$(CONFIG_MIPS_PB1100)                        += au1000_pb1x00.o
-au1x00_ss-$(CONFIG_MIPS_PB1200)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_PB1500)                        += au1000_pb1x00.o
-au1x00_ss-$(CONFIG_MIPS_DB1000)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_DB1100)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_DB1200)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_DB1500)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_DB1550)                        += au1000_db1x00.o
-au1x00_ss-$(CONFIG_MIPS_XXS1500)               += au1000_xxs1500.o
 
 sa1111_cs-y                                    += sa1111_generic.o
 sa1111_cs-$(CONFIG_ASSABET_NEPONSET)           += sa1100_neponset.o
@@ -76,3 +68,5 @@ pxa2xx-obj-$(CONFIG_MACH_E740)                        += pxa2xx_e740.o
 pxa2xx-obj-$(CONFIG_MACH_STARGATE2)            += pxa2xx_stargate2.o
 
 obj-$(CONFIG_PCMCIA_PXA2XX)                    += pxa2xx_base.o $(pxa2xx-obj-y)
+
+obj-$(CONFIG_PCMCIA_XXS1500)                   += xxs1500_ss.o
index e1dccedc5960e30fd68c3e43e983090966d92833..5d228071ec69b938fb860ef51470c3adc3ea8025 100644 (file)
@@ -52,8 +52,6 @@ struct at91_cf_socket {
        unsigned long           phys_baseaddr;
 };
 
-#define        SZ_2K                   (2 * SZ_1K)
-
 static inline int at91_cf_present(struct at91_cf_socket *cf)
 {
        return !gpio_get_value(cf->board->det_pin);
diff --git a/drivers/pcmcia/au1000_db1x00.c b/drivers/pcmcia/au1000_db1x00.c
deleted file mode 100644 (file)
index c78d77f..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- *
- * Alchemy Semi Db1x00 boards specific pcmcia routines.
- *
- * Copyright 2002 MontaVista Software Inc.
- * Author: MontaVista Software, Inc.
- *             ppopov@mvista.com or source@mvista.com
- *
- * Copyright 2004 Pete Popov, updated the driver to 2.6.
- * Followed the sa11xx API and largely copied many of the hardware
- * independent functions.
- *
- * ########################################################################
- *
- *  This program is free software; you can distribute it and/or modify it
- *  under the terms of the GNU General Public License (Version 2) as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope 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.
- *
- * ########################################################################
- *
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/device.h>
-#include <linux/init.h>
-
-#include <asm/irq.h>
-#include <asm/signal.h>
-#include <asm/mach-au1x00/au1000.h>
-
-#if defined(CONFIG_MIPS_DB1200)
-       #include <db1200.h>
-#elif defined(CONFIG_MIPS_PB1200)
-       #include <pb1200.h>
-#else
-       #include <asm/mach-db1x00/db1x00.h>
-       static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-#endif
-
-#include "au1000_generic.h"
-
-#if 0
-#define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args)
-#else
-#define debug(x,args...)
-#endif
-
-
-struct au1000_pcmcia_socket au1000_pcmcia_socket[PCMCIA_NUM_SOCKS];
-extern int au1x00_pcmcia_socket_probe(struct device *, struct pcmcia_low_level *, int, int);
-
-static int db1x00_pcmcia_hw_init(struct au1000_pcmcia_socket *skt)
-{
-#ifdef CONFIG_MIPS_DB1550
-       skt->irq = skt->nr ? AU1000_GPIO_5 : AU1000_GPIO_3;
-#elif defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
-       skt->irq = skt->nr ? BOARD_PC1_INT : BOARD_PC0_INT;
-#else
-       skt->irq = skt->nr ? AU1000_GPIO_5 : AU1000_GPIO_2;
-#endif
-       return 0;
-}
-
-static void db1x00_pcmcia_shutdown(struct au1000_pcmcia_socket *skt)
-{
-       bcsr->pcmcia = 0; /* turn off power */
-       au_sync_delay(2);
-}
-
-static void
-db1x00_pcmcia_socket_state(struct au1000_pcmcia_socket *skt, struct pcmcia_state *state)
-{
-       u32 inserted;
-       unsigned char vs;
-
-       state->ready = 0;
-       state->vs_Xv = 0;
-       state->vs_3v = 0;
-       state->detect = 0;
-
-       switch (skt->nr) {
-       case 0:
-               vs = bcsr->status & 0x3;
-#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
-               inserted = BOARD_CARD_INSERTED(0);
-#else
-               inserted = !(bcsr->status & (1<<4));
-#endif
-               break;
-       case 1:
-               vs = (bcsr->status & 0xC)>>2;
-#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
-               inserted = BOARD_CARD_INSERTED(1);
-#else
-               inserted = !(bcsr->status & (1<<5));
-#endif
-               break;
-       default:/* should never happen */
-               return;
-       }
-
-       if (inserted)
-               debug("db1x00 socket %d: inserted %d, vs %d pcmcia %x\n",
-                               skt->nr, inserted, vs, bcsr->pcmcia);
-
-       if (inserted) {
-               switch (vs) {
-                       case 0:
-                       case 2:
-                               state->vs_3v=1;
-                               break;
-                       case 3: /* 5V */
-                               break;
-                       default:
-                               /* return without setting 'detect' */
-                               printk(KERN_ERR "db1x00 bad VS (%d)\n",
-                                               vs);
-               }
-               state->detect = 1;
-               state->ready = 1;
-       }
-       else {
-               /* if the card was previously inserted and then ejected,
-                * we should turn off power to it
-                */
-               if ((skt->nr == 0) && (bcsr->pcmcia & BCSR_PCMCIA_PC0RST)) {
-                       bcsr->pcmcia &= ~(BCSR_PCMCIA_PC0RST |
-                                       BCSR_PCMCIA_PC0DRVEN |
-                                       BCSR_PCMCIA_PC0VPP |
-                                       BCSR_PCMCIA_PC0VCC);
-                       au_sync_delay(10);
-               }
-               else if ((skt->nr == 1) && bcsr->pcmcia & BCSR_PCMCIA_PC1RST) {
-                       bcsr->pcmcia &= ~(BCSR_PCMCIA_PC1RST |
-                                       BCSR_PCMCIA_PC1DRVEN |
-                                       BCSR_PCMCIA_PC1VPP |
-                                       BCSR_PCMCIA_PC1VCC);
-                       au_sync_delay(10);
-               }
-       }
-
-       state->bvd1=1;
-       state->bvd2=1;
-       state->wrprot=0;
-}
-
-static int
-db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_state_t *state)
-{
-       u16 pwr;
-       int sock = skt->nr;
-
-       debug("config_skt %d Vcc %dV Vpp %dV, reset %d\n",
-                       sock, state->Vcc, state->Vpp,
-                       state->flags & SS_RESET);
-
-       /* pcmcia reg was set to zero at init time. Be careful when
-        * initializing a socket not to wipe out the settings of the
-        * other socket.
-        */
-       pwr = bcsr->pcmcia;
-       pwr &= ~(0xf << sock*8); /* clear voltage settings */
-
-       state->Vpp = 0;
-       switch(state->Vcc){
-               case 0:  /* Vcc 0 */
-                       pwr |= SET_VCC_VPP(0,0,sock);
-                       break;
-               case 50: /* Vcc 5V */
-                       switch(state->Vpp) {
-                               case 0:
-                                       pwr |= SET_VCC_VPP(2,0,sock);
-                                       break;
-                               case 50:
-                                       pwr |= SET_VCC_VPP(2,1,sock);
-                                       break;
-                               case 12:
-                                       pwr |= SET_VCC_VPP(2,2,sock);
-                                       break;
-                               case 33:
-                               default:
-                                       pwr |= SET_VCC_VPP(0,0,sock);
-                                       printk("%s: bad Vcc/Vpp (%d:%d)\n",
-                                                       __func__,
-                                                       state->Vcc,
-                                                       state->Vpp);
-                                       break;
-                       }
-                       break;
-               case 33: /* Vcc 3.3V */
-                       switch(state->Vpp) {
-                               case 0:
-                                       pwr |= SET_VCC_VPP(1,0,sock);
-                                       break;
-                               case 12:
-                                       pwr |= SET_VCC_VPP(1,2,sock);
-                                       break;
-                               case 33:
-                                       pwr |= SET_VCC_VPP(1,1,sock);
-                                       break;
-                               case 50:
-                               default:
-                                       pwr |= SET_VCC_VPP(0,0,sock);
-                                       printk("%s: bad Vcc/Vpp (%d:%d)\n",
-                                                       __func__,
-                                                       state->Vcc,
-                                                       state->Vpp);
-                                       break;
-                       }
-                       break;
-               default: /* what's this ? */
-                       pwr |= SET_VCC_VPP(0,0,sock);
-                       printk(KERN_ERR "%s: bad Vcc %d\n",
-                                       __func__, state->Vcc);
-                       break;
-       }
-
-       bcsr->pcmcia = pwr;
-       au_sync_delay(300);
-
-       if (sock == 0) {
-               if (!(state->flags & SS_RESET)) {
-                       pwr |= BCSR_PCMCIA_PC0DRVEN;
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(300);
-                       pwr |= BCSR_PCMCIA_PC0RST;
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(100);
-               }
-               else {
-                       pwr &= ~(BCSR_PCMCIA_PC0RST | BCSR_PCMCIA_PC0DRVEN);
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(100);
-               }
-       }
-       else {
-               if (!(state->flags & SS_RESET)) {
-                       pwr |= BCSR_PCMCIA_PC1DRVEN;
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(300);
-                       pwr |= BCSR_PCMCIA_PC1RST;
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(100);
-               }
-               else {
-                       pwr &= ~(BCSR_PCMCIA_PC1RST | BCSR_PCMCIA_PC1DRVEN);
-                       bcsr->pcmcia = pwr;
-                       au_sync_delay(100);
-               }
-       }
-       return 0;
-}
-
-/*
- * Enable card status IRQs on (re-)initialisation.  This can
- * be called at initialisation, power management event, or
- * pcmcia event.
- */
-void db1x00_socket_init(struct au1000_pcmcia_socket *skt)
-{
-       /* nothing to do for now */
-}
-
-/*
- * Disable card status IRQs and PCMCIA bus on suspend.
- */
-void db1x00_socket_suspend(struct au1000_pcmcia_socket *skt)
-{
-       /* nothing to do for now */
-}
-
-struct pcmcia_low_level db1x00_pcmcia_ops = {
-       .owner                  = THIS_MODULE,
-
-       .hw_init                = db1x00_pcmcia_hw_init,
-       .hw_shutdown            = db1x00_pcmcia_shutdown,
-
-       .socket_state           = db1x00_pcmcia_socket_state,
-       .configure_socket       = db1x00_pcmcia_configure_socket,
-
-       .socket_init            = db1x00_socket_init,
-       .socket_suspend         = db1x00_socket_suspend
-};
-
-int au1x_board_init(struct device *dev)
-{
-       int ret = -ENODEV;
-       bcsr->pcmcia = 0; /* turn off power, if it's not already off */
-       au_sync_delay(2);
-       ret = au1x00_pcmcia_socket_probe(dev, &db1x00_pcmcia_ops, 0, 2);
-       return ret;
-}
index 02088704ac2ca8fcac8115a6ca211227b899f982..171c8a654887a65dcb91663e1173d48242923653 100644 (file)
@@ -405,18 +405,16 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
                        skt->virt_io = (void *)
                                (ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) -
                                (u32)mips_io_port_base);
-                       skt->phys_attr = AU1X_SOCK0_PSEUDO_PHYS_ATTR;
-                       skt->phys_mem = AU1X_SOCK0_PSEUDO_PHYS_MEM;
+                       skt->phys_attr = AU1X_SOCK0_PHYS_ATTR;
+                       skt->phys_mem = AU1X_SOCK0_PHYS_MEM;
                }
-#ifndef CONFIG_MIPS_XXS1500
                else  {
                        skt->virt_io = (void *)
                                (ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) -
                                (u32)mips_io_port_base);
-                       skt->phys_attr = AU1X_SOCK1_PSEUDO_PHYS_ATTR;
-                       skt->phys_mem = AU1X_SOCK1_PSEUDO_PHYS_MEM;
+                       skt->phys_attr = AU1X_SOCK1_PHYS_ATTR;
+                       skt->phys_mem = AU1X_SOCK1_PHYS_MEM;
                }
-#endif
                pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io;
                ret = ops->hw_init(skt);
 
index 13a4fbc587116e076e34ccd981deaa36d9ac4e3f..a324d329dea65e55a6183eed448aa68a29b52ac3 100644 (file)
 #define AU1X_SOCK0_IO        0xF00000000ULL
 #define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL
 #define AU1X_SOCK0_PHYS_MEM  0xF80000000ULL
-/* pseudo 32 bit phys addresses, which get fixed up to the
- * real 36 bit address in fixup_bigphys_addr() */
-#define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000
-#define AU1X_SOCK0_PSEUDO_PHYS_MEM  0xF8000000
 
 /* pcmcia socket 1 needs external glue logic so the memory map
  * differs from board to board.
  */
-#if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || \
-    defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || \
-    defined(CONFIG_MIPS_PB1200)
+#if defined(CONFIG_MIPS_PB1000)
 #define AU1X_SOCK1_IO        0xF08000000ULL
 #define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL
 #define AU1X_SOCK1_PHYS_MEM  0xF88000000ULL
-#define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000
-#define AU1X_SOCK1_PSEUDO_PHYS_MEM  0xF8800000
-#elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
-      defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || \
-      defined(CONFIG_MIPS_DB1200)
-#define AU1X_SOCK1_IO        0xF04000000ULL
-#define AU1X_SOCK1_PHYS_ATTR 0xF44000000ULL
-#define AU1X_SOCK1_PHYS_MEM  0xF84000000ULL
-#define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4400000
-#define AU1X_SOCK1_PSEUDO_PHYS_MEM  0xF8400000
 #endif
 
 struct pcmcia_state {
index b1984ed72d1d78ef6f0a673ab5dd797c5c76f6cb..5a979cb8f3e66a54fc7e1ea98548e92f9018b43d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * Alchemy Semi Pb1x00 boards specific pcmcia routines.
+ * Alchemy Semi Pb1000 boards specific pcmcia routines.
  *
  * Copyright 2002 MontaVista Software Inc.
  * Author: MontaVista Software, Inc.
 
 #define debug(fmt, arg...) do { } while (0)
 
-#ifdef CONFIG_MIPS_PB1000
 #include <asm/pb1000.h>
 #define PCMCIA_IRQ AU1000_GPIO_15
-#elif defined (CONFIG_MIPS_PB1500)
-#include <asm/pb1500.h>
-#define PCMCIA_IRQ AU1500_GPIO_203
-#elif defined (CONFIG_MIPS_PB1100)
-#include <asm/pb1100.h>
-#define PCMCIA_IRQ AU1000_GPIO_11
-#endif
 
 static int pb1x00_pcmcia_init(struct pcmcia_init *init)
 {
-#ifdef CONFIG_MIPS_PB1000
        u16 pcr;
        pcr = PCR_SLOT_0_RST | PCR_SLOT_1_RST;
 
@@ -74,21 +65,10 @@ static int pb1x00_pcmcia_init(struct pcmcia_init *init)
        au_sync_delay(20);
          
        return PCMCIA_NUM_SOCKS;
-
-#else /* fixme -- take care of the Pb1500 at some point */
-
-       u16 pcr;
-       pcr = au_readw(PCMCIA_BOARD_REG) & ~0xf; /* turn off power */
-       pcr &= ~(PC_DEASSERT_RST | PC_DRV_EN);
-       au_writew(pcr, PCMCIA_BOARD_REG);
-       au_sync_delay(500);
-       return PCMCIA_NUM_SOCKS;
-#endif
 }
 
 static int pb1x00_pcmcia_shutdown(void)
 {
-#ifdef CONFIG_MIPS_PB1000
        u16 pcr;
        pcr = PCR_SLOT_0_RST | PCR_SLOT_1_RST;
        pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ,0);
@@ -96,14 +76,6 @@ static int pb1x00_pcmcia_shutdown(void)
        au_writel(pcr, PB1000_PCR);
        au_sync_delay(20);
        return 0;
-#else
-       u16 pcr;
-       pcr = au_readw(PCMCIA_BOARD_REG) & ~0xf; /* turn off power */
-       pcr &= ~(PC_DEASSERT_RST | PC_DRV_EN);
-       au_writew(pcr, PCMCIA_BOARD_REG);
-       au_sync_delay(2);
-       return 0;
-#endif
 }
 
 static int 
@@ -112,21 +84,11 @@ pb1x00_pcmcia_socket_state(unsigned sock, struct pcmcia_state *state)
        u32 inserted0, inserted1;
        u16 vs0, vs1;
 
-#ifdef CONFIG_MIPS_PB1000
        vs0 = vs1 = (u16)au_readl(PB1000_ACR1);
        inserted0 = !(vs0 & (ACR1_SLOT_0_CD1 | ACR1_SLOT_0_CD2));
        inserted1 = !(vs1 & (ACR1_SLOT_1_CD1 | ACR1_SLOT_1_CD2));
        vs0 = (vs0 >> 4) & 0x3;
        vs1 = (vs1 >> 12) & 0x3;
-#else
-       vs0 = (au_readw(BOARD_STATUS_REG) >> 4) & 0x3;
-#ifdef CONFIG_MIPS_PB1500
-       inserted0 = !((au_readl(GPIO2_PINSTATE) >> 1) & 0x1); /* gpio 201 */
-#else /* Pb1100 */
-       inserted0 = !((au_readl(SYS_PINSTATERD) >> 9) & 0x1); /* gpio 9 */
-#endif
-       inserted1 = 0;
-#endif
 
        state->ready = 0;
        state->vs_Xv = 0;
@@ -203,7 +165,6 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
 
        if(configure->sock > PCMCIA_MAX_SOCK) return -1;
 
-#ifdef CONFIG_MIPS_PB1000
        pcr = au_readl(PB1000_PCR);
 
        if (configure->sock == 0) {
@@ -323,84 +284,6 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
        au_writel(pcr, PB1000_PCR);
        au_sync_delay(300);
 
-#else
-
-       pcr = au_readw(PCMCIA_BOARD_REG) & ~0xf;
-
-       debug("Vcc %dV Vpp %dV, pcr %x, reset %d\n", 
-                       configure->vcc, configure->vpp, pcr, configure->reset);
-
-
-       switch(configure->vcc){
-               case 0:  /* Vcc 0 */
-                       pcr |= SET_VCC_VPP(0,0);
-                       break;
-               case 50: /* Vcc 5V */
-                       switch(configure->vpp) {
-                               case 0:
-                                       pcr |= SET_VCC_VPP(2,0);
-                                       break;
-                               case 50:
-                                       pcr |= SET_VCC_VPP(2,1);
-                                       break;
-                               case 12:
-                                       pcr |= SET_VCC_VPP(2,2);
-                                       break;
-                               case 33:
-                               default:
-                                       pcr |= SET_VCC_VPP(0,0);
-                                       printk("%s: bad Vcc/Vpp (%d:%d)\n", 
-                                                       __func__,
-                                                       configure->vcc, 
-                                                       configure->vpp);
-                                       break;
-                       }
-                       break;
-               case 33: /* Vcc 3.3V */
-                       switch(configure->vpp) {
-                               case 0:
-                                       pcr |= SET_VCC_VPP(1,0);
-                                       break;
-                               case 12:
-                                       pcr |= SET_VCC_VPP(1,2);
-                                       break;
-                               case 33:
-                                       pcr |= SET_VCC_VPP(1,1);
-                                       break;
-                               case 50:
-                               default:
-                                       pcr |= SET_VCC_VPP(0,0);
-                                       printk("%s: bad Vcc/Vpp (%d:%d)\n", 
-                                                       __func__,
-                                                       configure->vcc, 
-                                                       configure->vpp);
-                                       break;
-                       }
-                       break;
-               default: /* what's this ? */
-                       pcr |= SET_VCC_VPP(0,0);
-                       printk(KERN_ERR "%s: bad Vcc %d\n", 
-                                       __func__, configure->vcc);
-                       break;
-       }
-
-       au_writew(pcr, PCMCIA_BOARD_REG);
-       au_sync_delay(300);
-
-       if (!configure->reset) {
-               pcr |= PC_DRV_EN;
-               au_writew(pcr, PCMCIA_BOARD_REG);
-               au_sync_delay(100);
-               pcr |= PC_DEASSERT_RST;
-               au_writew(pcr, PCMCIA_BOARD_REG);
-               au_sync_delay(100);
-       }
-       else {
-               pcr &= ~(PC_DEASSERT_RST | PC_DRV_EN);
-               au_writew(pcr, PCMCIA_BOARD_REG);
-               au_sync_delay(100);
-       }
-#endif
        return 0;
 }
 
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c
deleted file mode 100644 (file)
index b43d47b..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *
- * MyCable board specific pcmcia routines.
- *
- * Copyright 2003 MontaVista Software Inc.
- * Author: Pete Popov, MontaVista Software, Inc.
- *             ppopov@mvista.com or source@mvista.com
- *
- * ########################################################################
- *
- *  This program is free software; you can distribute it and/or modify it
- *  under the terms of the GNU General Public License (Version 2) as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope 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.
- *
- * ########################################################################
- *
- *
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/proc_fs.h>
-#include <linux/types.h>
-
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/ss.h>
-#include <pcmcia/cistpl.h>
-#include <pcmcia/bus_ops.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/system.h>
-
-#include <asm/au1000.h>
-#include <asm/au1000_pcmcia.h>
-
-#define PCMCIA_MAX_SOCK                0
-#define PCMCIA_NUM_SOCKS       (PCMCIA_MAX_SOCK + 1)
-#define PCMCIA_IRQ             AU1000_GPIO_4
-
-#if 0
-#define DEBUG(x, args...)      printk(__func__ ": " x, ##args)
-#else
-#define DEBUG(x,args...)
-#endif
-
-static int xxs1500_pcmcia_init(struct pcmcia_init *init)
-{
-       return PCMCIA_NUM_SOCKS;
-}
-
-static int xxs1500_pcmcia_shutdown(void)
-{
-       /* turn off power */
-       au_writel(au_readl(GPIO2_PINSTATE) | (1<<14)|(1<<30),
-                       GPIO2_OUTPUT);
-       au_sync_delay(100);
-
-       /* assert reset */
-       au_writel(au_readl(GPIO2_PINSTATE) | (1<<4)|(1<<20),
-                       GPIO2_OUTPUT);
-       au_sync_delay(100);
-       return 0;
-}
-
-
-static int
-xxs1500_pcmcia_socket_state(unsigned sock, struct pcmcia_state *state)
-{
-       u32 inserted; u32 vs;
-       unsigned long gpio, gpio2;
-
-       if(sock > PCMCIA_MAX_SOCK) return -1;
-
-       gpio = au_readl(SYS_PINSTATERD);
-       gpio2 = au_readl(GPIO2_PINSTATE);
-
-       vs = gpio2 & ((1<<8) | (1<<9));
-       inserted = (!(gpio & 0x1) && !(gpio & 0x2));
-
-       state->ready = 0;
-       state->vs_Xv = 0;
-       state->vs_3v = 0;
-       state->detect = 0;
-
-       if (inserted) {
-               switch (vs) {
-                       case 0:
-                       case 1:
-                       case 2:
-                               state->vs_3v=1;
-                               break;
-                       case 3: /* 5V */
-                       default:
-                               /* return without setting 'detect' */
-                               printk(KERN_ERR "au1x00_cs: unsupported VS\n",
-                                               vs);
-                               return;
-               }
-               state->detect = 1;
-       }
-
-       if (state->detect) {
-               state->ready = 1;
-       }
-
-       state->bvd1= gpio2 & (1<<10);
-       state->bvd2 = gpio2 & (1<<11);
-       state->wrprot=0;
-       return 1;
-}
-
-
-static int xxs1500_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
-{
-
-       if(info->sock > PCMCIA_MAX_SOCK) return -1;
-       info->irq = PCMCIA_IRQ;
-       return 0;
-}
-
-
-static int
-xxs1500_pcmcia_configure_socket(const struct pcmcia_configure *configure)
-{
-
-       if(configure->sock > PCMCIA_MAX_SOCK) return -1;
-
-       DEBUG("Vcc %dV Vpp %dV, reset %d\n",
-                       configure->vcc, configure->vpp, configure->reset);
-
-       switch(configure->vcc){
-               case 33: /* Vcc 3.3V */
-                       /* turn on power */
-                       DEBUG("turn on power\n");
-                       au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<14))|(1<<30),
-                                       GPIO2_OUTPUT);
-                       au_sync_delay(100);
-                       break;
-               case 50: /* Vcc 5V */
-               default: /* what's this ? */
-                       printk(KERN_ERR "au1x00_cs: unsupported VCC\n");
-               case 0:  /* Vcc 0 */
-                       /* turn off power */
-                       au_sync_delay(100);
-                       au_writel(au_readl(GPIO2_PINSTATE) | (1<<14)|(1<<30),
-                                       GPIO2_OUTPUT);
-                       break;
-       }
-
-       if (!configure->reset) {
-               DEBUG("deassert reset\n");
-               au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<4))|(1<<20),
-                               GPIO2_OUTPUT);
-               au_sync_delay(100);
-               au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<5))|(1<<21),
-                               GPIO2_OUTPUT);
-       }
-       else {
-               DEBUG("assert reset\n");
-               au_writel(au_readl(GPIO2_PINSTATE) | (1<<4)|(1<<20),
-                               GPIO2_OUTPUT);
-       }
-       au_sync_delay(100);
-       return 0;
-}
-
-struct pcmcia_low_level xxs1500_pcmcia_ops = {
-       xxs1500_pcmcia_init,
-       xxs1500_pcmcia_shutdown,
-       xxs1500_pcmcia_socket_state,
-       xxs1500_pcmcia_get_irq_info,
-       xxs1500_pcmcia_configure_socket
-};
index 300b368605c92c43b2b2e2e7a324cc5645489ee4..2482ce7ac6dcb3f9845eeebe664ab30defeb76b8 100644 (file)
@@ -205,7 +205,7 @@ static int __devinit bfin_cf_probe(struct platform_device *pdev)
        dev_info(&pdev->dev, "Blackfin CompactFlash/PCMCIA Socket Driver\n");
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq)
+       if (irq <= 0)
                return -EINVAL;
 
        cd_pfx = platform_get_irq(pdev, 1);     /*Card Detect GPIO PIN */
index d99f846451a3ecbba1d2608c6bd828696c9c15a7..ac0686efbf759de211fe1e78bb6ae5f58d2f0fca 100644 (file)
  */
 
 
-#include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/pci.h>
-#include <linux/ioport.h>
-#include <linux/io.h>
-#include <asm/irq.h>
 
-#include <pcmcia/cs_types.h>
 #include <pcmcia/ss.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/cistpl.h>
-#include "cs_internal.h"
-
-/*====================================================================*/
-
-/* Offsets in the Expansion ROM Image Header */
-#define ROM_SIGNATURE          0x0000  /* 2 bytes */
-#define ROM_DATA_PTR           0x0018  /* 2 bytes */
-
-/* Offsets in the CardBus PC Card Data Structure */
-#define PCDATA_SIGNATURE       0x0000  /* 4 bytes */
-#define PCDATA_VPD_PTR         0x0008  /* 2 bytes */
-#define PCDATA_LENGTH          0x000a  /* 2 bytes */
-#define PCDATA_REVISION                0x000c
-#define PCDATA_IMAGE_SZ                0x0010  /* 2 bytes */
-#define PCDATA_ROM_LEVEL       0x0012  /* 2 bytes */
-#define PCDATA_CODE_TYPE       0x0014
-#define PCDATA_INDICATOR       0x0015
-
-/*=====================================================================
-
-    Expansion ROM's have a special layout, and pointers specify an
-    image number and an offset within that image.  xlate_rom_addr()
-    converts an image/offset address to an absolute offset from the
-    ROM's base address.
-
-=====================================================================*/
-
-static u_int xlate_rom_addr(void __iomem *b, u_int addr)
-{
-       u_int img = 0, ofs = 0, sz;
-       u_short data;
-       while ((readb(b) == 0x55) && (readb(b + 1) == 0xaa)) {
-               if (img == (addr >> 28))
-                       return (addr & 0x0fffffff) + ofs;
-               data = readb(b + ROM_DATA_PTR) + (readb(b + ROM_DATA_PTR + 1) << 8);
-               sz = 512 * (readb(b + data + PCDATA_IMAGE_SZ) +
-                           (readb(b + data + PCDATA_IMAGE_SZ + 1) << 8));
-               if ((sz == 0) || (readb(b + data + PCDATA_INDICATOR) & 0x80))
-                       break;
-               b += sz;
-               ofs += sz;
-               img++;
-       }
-       return 0;
-}
-
-/*=====================================================================
-
-    These are similar to setup_cis_mem and release_cis_mem for 16-bit
-    cards.  The "result" that is used externally is the cb_cis_virt
-    pointer in the struct pcmcia_socket structure.
-
-=====================================================================*/
-
-static void cb_release_cis_mem(struct pcmcia_socket *s)
-{
-       if (s->cb_cis_virt) {
-               dev_dbg(&s->dev, "cb_release_cis_mem()\n");
-               iounmap(s->cb_cis_virt);
-               s->cb_cis_virt = NULL;
-               s->cb_cis_res = NULL;
-       }
-}
-
-static int cb_setup_cis_mem(struct pcmcia_socket *s, struct resource *res)
-{
-       unsigned int start, size;
-
-       if (res == s->cb_cis_res)
-               return 0;
-
-       if (s->cb_cis_res)
-               cb_release_cis_mem(s);
-
-       start = res->start;
-       size = res->end - start + 1;
-       s->cb_cis_virt = ioremap(start, size);
-
-       if (!s->cb_cis_virt)
-               return -1;
-
-       s->cb_cis_res = res;
-
-       return 0;
-}
-
-/*=====================================================================
-
-    This is used by the CIS processing code to read CIS information
-    from a CardBus device.
-
-=====================================================================*/
-
-int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len,
-               void *ptr)
-{
-       struct pci_dev *dev;
-       struct resource *res;
-
-       dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len);
 
-       dev = pci_get_slot(s->cb_dev->subordinate, 0);
-       if (!dev)
-               goto fail;
-
-       /* Config space? */
-       if (space == 0) {
-               if (addr + len > 0x100)
-                       goto failput;
-               for (; len; addr++, ptr++, len--)
-                       pci_read_config_byte(dev, addr, ptr);
-               return 0;
-       }
-
-       res = dev->resource + space - 1;
-
-       pci_dev_put(dev);
-
-       if (!res->flags)
-               goto fail;
-
-       if (cb_setup_cis_mem(s, res) != 0)
-               goto fail;
-
-       if (space == 7) {
-               addr = xlate_rom_addr(s->cb_cis_virt, addr);
-               if (addr == 0)
-                       goto fail;
-       }
-
-       if (addr + len > res->end - res->start)
-               goto fail;
-
-       memcpy_fromio(ptr, s->cb_cis_virt + addr, len);
-       return 0;
-
-failput:
-       pci_dev_put(dev);
-fail:
-       memset(ptr, 0xff, len);
-       return -1;
-}
-
-/*=====================================================================
-
-    cb_alloc() and cb_free() allocate and free the kernel data
-    structures for a Cardbus device, and handle the lowest level PCI
-    device setup issues.
-
-=====================================================================*/
 
 static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
 {
@@ -215,6 +57,13 @@ static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
        }
 }
 
+/**
+ * cb_alloc() - add CardBus device
+ * @s:         the pcmcia_socket where the CardBus device is located
+ *
+ * cb_alloc() allocates the kernel data structures for a Cardbus device
+ * and handles the lowest level PCI device setup issues.
+ */
 int __ref cb_alloc(struct pcmcia_socket *s)
 {
        struct pci_bus *bus = s->cb_dev->subordinate;
@@ -249,12 +98,16 @@ int __ref cb_alloc(struct pcmcia_socket *s)
        return 0;
 }
 
+/**
+ * cb_free() - remove CardBus device
+ * @s:         the pcmcia_socket where the CardBus device was located
+ *
+ * cb_free() handles the lowest level PCI device cleanup.
+ */
 void cb_free(struct pcmcia_socket *s)
 {
        struct pci_dev *bridge = s->cb_dev;
 
-       cb_release_cis_mem(s);
-
        if (bridge)
                pci_remove_behind_bridge(bridge);
 }
index 25b1cd219e374202b6d4f8f3fd84e849204daaa3..2f3622dd4b69b7f5d652ccb56a3e28168b2b4b23 100644 (file)
@@ -64,6 +64,7 @@ module_param(cis_width, int, 0444);
 
 void release_cis_mem(struct pcmcia_socket *s)
 {
+    mutex_lock(&s->ops_mutex);
     if (s->cis_mem.flags & MAP_ACTIVE) {
        s->cis_mem.flags &= ~MAP_ACTIVE;
        s->ops->set_mem_map(s, &s->cis_mem);
@@ -75,13 +76,15 @@ void release_cis_mem(struct pcmcia_socket *s)
        iounmap(s->cis_virt);
        s->cis_virt = NULL;
     }
+    mutex_unlock(&s->ops_mutex);
 }
-EXPORT_SYMBOL(release_cis_mem);
 
 /*
  * Map the card memory at "card_offset" into virtual space.
  * If flags & MAP_ATTRIB, map the attribute space, otherwise
  * map the memory space.
+ *
+ * Must be called with ops_mutex held.
  */
 static void __iomem *
 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
@@ -140,6 +143,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
 
     dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
 
+    mutex_lock(&s->ops_mutex);
     if (attr & IS_INDIRECT) {
        /* Indirect accesses use a bunch of special registers at fixed
           locations in common memory */
@@ -151,7 +155,9 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
 
        sys = set_cis_map(s, 0, MAP_ACTIVE | ((cis_width) ? MAP_16BIT : 0));
        if (!sys) {
+           dev_dbg(&s->dev, "could not map memory\n");
            memset(ptr, 0xff, len);
+           mutex_unlock(&s->ops_mutex);
            return -1;
        }
 
@@ -165,6 +171,9 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
     } else {
        u_int inc = 1, card_offset, flags;
 
+       if (addr > CISTPL_MAX_CIS_SIZE)
+               dev_dbg(&s->dev, "attempt to read CIS mem at addr %#x", addr);
+
        flags = MAP_ACTIVE | ((cis_width) ? MAP_16BIT : 0);
        if (attr) {
            flags |= MAP_ATTRIB;
@@ -176,7 +185,9 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
        while (len) {
            sys = set_cis_map(s, card_offset, flags);
            if (!sys) {
+               dev_dbg(&s->dev, "could not map memory\n");
                memset(ptr, 0xff, len);
+               mutex_unlock(&s->ops_mutex);
                return -1;
            }
            end = sys + s->map_size;
@@ -190,12 +201,12 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
            addr = 0;
        }
     }
+    mutex_unlock(&s->ops_mutex);
     dev_dbg(&s->dev, "  %#2.2x %#2.2x %#2.2x %#2.2x ...\n",
          *(u_char *)(ptr+0), *(u_char *)(ptr+1),
          *(u_char *)(ptr+2), *(u_char *)(ptr+3));
     return 0;
 }
-EXPORT_SYMBOL(pcmcia_read_cis_mem);
 
 
 void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
@@ -206,6 +217,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
 
     dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len);
 
+    mutex_lock(&s->ops_mutex);
     if (attr & IS_INDIRECT) {
        /* Indirect accesses use a bunch of special registers at fixed
           locations in common memory */
@@ -216,8 +228,11 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
        }
 
        sys = set_cis_map(s, 0, MAP_ACTIVE | ((cis_width) ? MAP_16BIT : 0));
-       if (!sys)
+       if (!sys) {
+               dev_dbg(&s->dev, "could not map memory\n");
+               mutex_unlock(&s->ops_mutex);
                return; /* FIXME: Error */
+       }
 
        writeb(flags, sys+CISREG_ICTRL0);
        writeb(addr & 0xff, sys+CISREG_IADDR0);
@@ -239,8 +254,11 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
        card_offset = addr & ~(s->map_size-1);
        while (len) {
            sys = set_cis_map(s, card_offset, flags);
-           if (!sys)
+           if (!sys) {
+               dev_dbg(&s->dev, "could not map memory\n");
+               mutex_unlock(&s->ops_mutex);
                return; /* FIXME: error */
+           }
 
            end = sys + s->map_size;
            sys = sys + (addr & (s->map_size-1));
@@ -253,8 +271,8 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
            addr = 0;
        }
     }
+    mutex_unlock(&s->ops_mutex);
 }
-EXPORT_SYMBOL(pcmcia_write_cis_mem);
 
 
 /*======================================================================
@@ -265,32 +283,36 @@ EXPORT_SYMBOL(pcmcia_write_cis_mem);
 
 ======================================================================*/
 
-static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
-                          size_t len, void *ptr)
+static int read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
+                       size_t len, void *ptr)
 {
-    struct cis_cache_entry *cis;
-    int ret;
+       struct cis_cache_entry *cis;
+       int ret = 0;
 
-    if (s->fake_cis) {
-       if (s->fake_cis_len >= addr+len)
-           memcpy(ptr, s->fake_cis+addr, len);
-       else
-           memset(ptr, 0xff, len);
-       return;
-    }
+       if (s->state & SOCKET_CARDBUS)
+               return -EINVAL;
 
-    list_for_each_entry(cis, &s->cis_cache, node) {
-       if (cis->addr == addr && cis->len == len && cis->attr == attr) {
-           memcpy(ptr, cis->cache, len);
-           return;
+       mutex_lock(&s->ops_mutex);
+       if (s->fake_cis) {
+               if (s->fake_cis_len >= addr+len)
+                       memcpy(ptr, s->fake_cis+addr, len);
+               else {
+                       memset(ptr, 0xff, len);
+                       ret = -EINVAL;
+               }
+               mutex_unlock(&s->ops_mutex);
+               return ret;
        }
-    }
 
-#ifdef CONFIG_CARDBUS
-    if (s->state & SOCKET_CARDBUS)
-       ret = read_cb_mem(s, attr, addr, len, ptr);
-    else
-#endif
+       list_for_each_entry(cis, &s->cis_cache, node) {
+               if (cis->addr == addr && cis->len == len && cis->attr == attr) {
+                       memcpy(ptr, cis->cache, len);
+                       mutex_unlock(&s->ops_mutex);
+                       return 0;
+               }
+       }
+       mutex_unlock(&s->ops_mutex);
+
        ret = pcmcia_read_cis_mem(s, attr, addr, len, ptr);
 
        if (ret == 0) {
@@ -301,9 +323,12 @@ static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
                        cis->len = len;
                        cis->attr = attr;
                        memcpy(cis->cache, ptr, len);
+                       mutex_lock(&s->ops_mutex);
                        list_add(&cis->node, &s->cis_cache);
+                       mutex_unlock(&s->ops_mutex);
                }
        }
+       return ret;
 }
 
 static void
@@ -311,32 +336,35 @@ remove_cis_cache(struct pcmcia_socket *s, int attr, u_int addr, u_int len)
 {
        struct cis_cache_entry *cis;
 
+       mutex_lock(&s->ops_mutex);
        list_for_each_entry(cis, &s->cis_cache, node)
                if (cis->addr == addr && cis->len == len && cis->attr == attr) {
                        list_del(&cis->node);
                        kfree(cis);
                        break;
                }
+       mutex_unlock(&s->ops_mutex);
 }
 
+/**
+ * destroy_cis_cache() - destroy the CIS cache
+ * @s:         pcmcia_socket for which CIS cache shall be destroyed
+ *
+ * This destroys the CIS cache but keeps any fake CIS alive. Must be
+ * called with ops_mutex held.
+ */
+
 void destroy_cis_cache(struct pcmcia_socket *s)
 {
        struct list_head *l, *n;
+       struct cis_cache_entry *cis;
 
        list_for_each_safe(l, n, &s->cis_cache) {
-               struct cis_cache_entry *cis = list_entry(l, struct cis_cache_entry, node);
-
+               cis = list_entry(l, struct cis_cache_entry, node);
                list_del(&cis->node);
                kfree(cis);
        }
-
-       /*
-        * If there was a fake CIS, destroy that as well.
-        */
-       kfree(s->fake_cis);
-       s->fake_cis = NULL;
 }
-EXPORT_SYMBOL(destroy_cis_cache);
 
 /*======================================================================
 
@@ -349,6 +377,10 @@ int verify_cis_cache(struct pcmcia_socket *s)
 {
        struct cis_cache_entry *cis;
        char *buf;
+       int ret;
+
+       if (s->state & SOCKET_CARDBUS)
+               return -EINVAL;
 
        buf = kmalloc(256, GFP_KERNEL);
        if (buf == NULL) {
@@ -361,14 +393,9 @@ int verify_cis_cache(struct pcmcia_socket *s)
 
                if (len > 256)
                        len = 256;
-#ifdef CONFIG_CARDBUS
-               if (s->state & SOCKET_CARDBUS)
-                       read_cb_mem(s, cis->attr, cis->addr, len, buf);
-               else
-#endif
-                       pcmcia_read_cis_mem(s, cis->attr, cis->addr, len, buf);
 
-               if (memcmp(buf, cis->cache, len) != 0) {
+               ret = pcmcia_read_cis_mem(s, cis->attr, cis->addr, len, buf);
+               if (ret || memcmp(buf, cis->cache, len) != 0) {
                        kfree(buf);
                        return -1;
                }
@@ -391,17 +418,20 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
                dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
                return -EINVAL;
        }
+       mutex_lock(&s->ops_mutex);
        kfree(s->fake_cis);
        s->fake_cis = kmalloc(len, GFP_KERNEL);
        if (s->fake_cis == NULL) {
                dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
+               mutex_unlock(&s->ops_mutex);
                return -ENOMEM;
        }
        s->fake_cis_len = len;
        memcpy(s->fake_cis, data, len);
+       dev_info(&s->dev, "Using replacement CIS\n");
+       mutex_unlock(&s->ops_mutex);
        return 0;
 }
-EXPORT_SYMBOL(pcmcia_replace_cis);
 
 /*======================================================================
 
@@ -425,25 +455,16 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple
 {
     if (!s)
        return -EINVAL;
-    if (!(s->state & SOCKET_PRESENT))
+
+    if (!(s->state & SOCKET_PRESENT) || (s->state & SOCKET_CARDBUS))
        return -ENODEV;
     tuple->TupleLink = tuple->Flags = 0;
-#ifdef CONFIG_CARDBUS
-    if (s->state & SOCKET_CARDBUS) {
-       struct pci_dev *dev = s->cb_dev;
-       u_int ptr;
-       pci_bus_read_config_dword(dev->subordinate, 0, PCI_CARDBUS_CIS, &ptr);
-       tuple->CISOffset = ptr & ~7;
-       SPACE(tuple->Flags) = (ptr & 7);
-    } else
-#endif
-    {
-       /* Assume presence of a LONGLINK_C to address 0 */
-       tuple->CISOffset = tuple->LinkOffset = 0;
-       SPACE(tuple->Flags) = HAS_LINK(tuple->Flags) = 1;
-    }
-    if (!(s->state & SOCKET_CARDBUS) && (s->functions > 1) &&
-       !(tuple->Attributes & TUPLE_RETURN_COMMON)) {
+
+    /* Assume presence of a LONGLINK_C to address 0 */
+    tuple->CISOffset = tuple->LinkOffset = 0;
+    SPACE(tuple->Flags) = HAS_LINK(tuple->Flags) = 1;
+
+    if ((s->functions > 1) && !(tuple->Attributes & TUPLE_RETURN_COMMON)) {
        cisdata_t req = tuple->DesiredTuple;
        tuple->DesiredTuple = CISTPL_LONGLINK_MFC;
        if (pccard_get_next_tuple(s, function, tuple) == 0) {
@@ -456,17 +477,19 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple
     }
     return pccard_get_next_tuple(s, function, tuple);
 }
-EXPORT_SYMBOL(pccard_get_first_tuple);
 
 static int follow_link(struct pcmcia_socket *s, tuple_t *tuple)
 {
     u_char link[5];
     u_int ofs;
+    int ret;
 
     if (MFC_FN(tuple->Flags)) {
        /* Get indirect link from the MFC tuple */
-       read_cis_cache(s, LINK_SPACE(tuple->Flags),
+       ret = read_cis_cache(s, LINK_SPACE(tuple->Flags),
                       tuple->LinkOffset, 5, link);
+       if (ret)
+               return -1;
        ofs = get_unaligned_le32(link + 1);
        SPACE(tuple->Flags) = (link[0] == CISTPL_MFC_ATTR);
        /* Move to the next indirect link */
@@ -479,10 +502,12 @@ static int follow_link(struct pcmcia_socket *s, tuple_t *tuple)
     } else {
        return -1;
     }
-    if (!(s->state & SOCKET_CARDBUS) && SPACE(tuple->Flags)) {
+    if (SPACE(tuple->Flags)) {
        /* This is ugly, but a common CIS error is to code the long
           link offset incorrectly, so we check the right spot... */
-       read_cis_cache(s, SPACE(tuple->Flags), ofs, 5, link);
+       ret = read_cis_cache(s, SPACE(tuple->Flags), ofs, 5, link);
+       if (ret)
+               return -1;
        if ((link[0] == CISTPL_LINKTARGET) && (link[1] >= 3) &&
            (strncmp(link+2, "CIS", 3) == 0))
            return ofs;
@@ -490,7 +515,9 @@ static int follow_link(struct pcmcia_socket *s, tuple_t *tuple)
        /* Then, we try the wrong spot... */
        ofs = ofs >> 1;
     }
-    read_cis_cache(s, SPACE(tuple->Flags), ofs, 5, link);
+    ret = read_cis_cache(s, SPACE(tuple->Flags), ofs, 5, link);
+    if (ret)
+           return -1;
     if ((link[0] == CISTPL_LINKTARGET) && (link[1] >= 3) &&
        (strncmp(link+2, "CIS", 3) == 0))
        return ofs;
@@ -502,10 +529,11 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
 {
     u_char link[2], tmp;
     int ofs, i, attr;
+    int ret;
 
     if (!s)
        return -EINVAL;
-    if (!(s->state & SOCKET_PRESENT))
+    if (!(s->state & SOCKET_PRESENT) || (s->state & SOCKET_CARDBUS))
        return -ENODEV;
 
     link[1] = tuple->TupleLink;
@@ -516,7 +544,9 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
        if (link[1] == 0xff) {
            link[0] = CISTPL_END;
        } else {
-           read_cis_cache(s, attr, ofs, 2, link);
+           ret = read_cis_cache(s, attr, ofs, 2, link);
+           if (ret)
+                   return -1;
            if (link[0] == CISTPL_NULL) {
                ofs++; continue;
            }
@@ -528,7 +558,9 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
            if (ofs < 0)
                return -ENOSPC;
            attr = SPACE(tuple->Flags);
-           read_cis_cache(s, attr, ofs, 2, link);
+           ret = read_cis_cache(s, attr, ofs, 2, link);
+           if (ret)
+                   return -1;
        }
 
        /* Is this a link tuple?  Make a note of it */
@@ -542,12 +574,16 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
            case CISTPL_LONGLINK_A:
                HAS_LINK(tuple->Flags) = 1;
                LINK_SPACE(tuple->Flags) = attr | IS_ATTR;
-               read_cis_cache(s, attr, ofs+2, 4, &tuple->LinkOffset);
+               ret = read_cis_cache(s, attr, ofs+2, 4, &tuple->LinkOffset);
+               if (ret)
+                       return -1;
                break;
            case CISTPL_LONGLINK_C:
                HAS_LINK(tuple->Flags) = 1;
                LINK_SPACE(tuple->Flags) = attr & ~IS_ATTR;
-               read_cis_cache(s, attr, ofs+2, 4, &tuple->LinkOffset);
+               ret = read_cis_cache(s, attr, ofs+2, 4, &tuple->LinkOffset);
+               if (ret)
+                       return -1;
                break;
            case CISTPL_INDIRECT:
                HAS_LINK(tuple->Flags) = 1;
@@ -559,7 +595,9 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
                LINK_SPACE(tuple->Flags) = attr;
                if (function == BIND_FN_ALL) {
                    /* Follow all the MFC links */
-                   read_cis_cache(s, attr, ofs+2, 1, &tmp);
+                   ret = read_cis_cache(s, attr, ofs+2, 1, &tmp);
+                   if (ret)
+                           return -1;
                    MFC_FN(tuple->Flags) = tmp;
                } else {
                    /* Follow exactly one of the links */
@@ -592,7 +630,6 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
     tuple->CISOffset = ofs + 2;
     return 0;
 }
-EXPORT_SYMBOL(pccard_get_next_tuple);
 
 /*====================================================================*/
 
@@ -601,6 +638,7 @@ EXPORT_SYMBOL(pccard_get_next_tuple);
 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple)
 {
     u_int len;
+    int ret;
 
     if (!s)
        return -EINVAL;
@@ -611,12 +649,13 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple)
     tuple->TupleDataLen = tuple->TupleLink;
     if (len == 0)
        return 0;
-    read_cis_cache(s, SPACE(tuple->Flags),
+    ret = read_cis_cache(s, SPACE(tuple->Flags),
                   tuple->CISOffset + tuple->TupleOffset,
                   _MIN(len, tuple->TupleDataMax), tuple->TupleData);
+    if (ret)
+           return -1;
     return 0;
 }
-EXPORT_SYMBOL(pccard_get_tuple_data);
 
 
 /*======================================================================
@@ -1190,119 +1229,6 @@ static int parse_cftable_entry(tuple_t *tuple,
 
 /*====================================================================*/
 
-#ifdef CONFIG_CARDBUS
-
-static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar)
-{
-    u_char *p;
-    if (tuple->TupleDataLen < 6)
-       return -EINVAL;
-    p = (u_char *)tuple->TupleData;
-    bar->attr = *p;
-    p += 2;
-    bar->size = get_unaligned_le32(p);
-    return 0;
-}
-
-static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config)
-{
-    u_char *p;
-
-    p = (u_char *)tuple->TupleData;
-    if ((*p != 3) || (tuple->TupleDataLen < 6))
-       return -EINVAL;
-    config->last_idx = *(++p);
-    p++;
-    config->base = get_unaligned_le32(p);
-    config->subtuples = tuple->TupleDataLen - 6;
-    return 0;
-}
-
-static int parse_cftable_entry_cb(tuple_t *tuple,
-                                 cistpl_cftable_entry_cb_t *entry)
-{
-    u_char *p, *q, features;
-
-    p = tuple->TupleData;
-    q = p + tuple->TupleDataLen;
-    entry->index = *p & 0x3f;
-    entry->flags = 0;
-    if (*p & 0x40)
-       entry->flags |= CISTPL_CFTABLE_DEFAULT;
-
-    /* Process optional features */
-    if (++p == q)
-           return -EINVAL;
-    features = *p; p++;
-
-    /* Power options */
-    if ((features & 3) > 0) {
-       p = parse_power(p, q, &entry->vcc);
-       if (p == NULL)
-               return -EINVAL;
-    } else
-       entry->vcc.present = 0;
-    if ((features & 3) > 1) {
-       p = parse_power(p, q, &entry->vpp1);
-       if (p == NULL)
-               return -EINVAL;
-    } else
-       entry->vpp1.present = 0;
-    if ((features & 3) > 2) {
-       p = parse_power(p, q, &entry->vpp2);
-       if (p == NULL)
-               return -EINVAL;
-    } else
-       entry->vpp2.present = 0;
-
-    /* I/O window options */
-    if (features & 0x08) {
-       if (p == q)
-               return -EINVAL;
-       entry->io = *p; p++;
-    } else
-       entry->io = 0;
-
-    /* Interrupt options */
-    if (features & 0x10) {
-       p = parse_irq(p, q, &entry->irq);
-       if (p == NULL)
-               return -EINVAL;
-    } else
-       entry->irq.IRQInfo1 = 0;
-
-    if (features & 0x20) {
-       if (p == q)
-               return -EINVAL;
-       entry->mem = *p; p++;
-    } else
-       entry->mem = 0;
-
-    /* Misc features */
-    if (features & 0x80) {
-       if (p == q)
-               return -EINVAL;
-       entry->flags |= (*p << 8);
-       if (*p & 0x80) {
-           if (++p == q)
-                   return -EINVAL;
-           entry->flags |= (*p << 16);
-       }
-       while (*p & 0x80)
-           if (++p == q)
-                   return -EINVAL;
-       p++;
-    }
-
-    entry->subtuples = q-p;
-
-    return 0;
-}
-
-#endif
-
-/*====================================================================*/
-
 static int parse_device_geo(tuple_t *tuple, cistpl_device_geo_t *geo)
 {
     u_char *p, *q;
@@ -1404,17 +1330,6 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse)
     case CISTPL_DEVICE_A:
        ret = parse_device(tuple, &parse->device);
        break;
-#ifdef CONFIG_CARDBUS
-    case CISTPL_BAR:
-       ret = parse_bar(tuple, &parse->bar);
-       break;
-    case CISTPL_CONFIG_CB:
-       ret = parse_config_cb(tuple, &parse->config);
-       break;
-    case CISTPL_CFTABLE_ENTRY_CB:
-       ret = parse_cftable_entry_cb(tuple, &parse->cftable_entry_cb);
-       break;
-#endif
     case CISTPL_CHECKSUM:
        ret = parse_checksum(tuple, &parse->checksum);
        break;
@@ -1513,7 +1428,6 @@ done:
     kfree(buf);
     return ret;
 }
-EXPORT_SYMBOL(pccard_read_tuple);
 
 
 /**
@@ -1573,84 +1487,238 @@ next_entry:
        kfree(buf);
        return ret;
 }
-EXPORT_SYMBOL(pccard_loop_tuple);
 
 
-/*======================================================================
-
-    This tries to determine if a card has a sensible CIS.  It returns
-    the number of tuples in the CIS, or 0 if the CIS looks bad.  The
-    checks include making sure several critical tuples are present and
-    valid; seeing if the total number of tuples is reasonable; and
-    looking for tuples that use reserved codes.
-
-======================================================================*/
-
+/**
+ * pccard_validate_cis() - check whether card has a sensible CIS
+ * @s:         the struct pcmcia_socket we are to check
+ * @info:      returns the number of tuples in the (valid) CIS, or 0
+ *
+ * This tries to determine if a card has a sensible CIS.  In @info, it
+ * returns the number of tuples in the CIS, or 0 if the CIS looks bad. The
+ * checks include making sure several critical tuples are present and
+ * valid; seeing if the total number of tuples is reasonable; and
+ * looking for tuples that use reserved codes.
+ *
+ * The function returns 0 on success.
+ */
 int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
 {
-    tuple_t *tuple;
-    cisparse_t *p;
-    unsigned int count = 0;
-    int ret, reserved, dev_ok = 0, ident_ok = 0;
+       tuple_t *tuple;
+       cisparse_t *p;
+       unsigned int count = 0;
+       int ret, reserved, dev_ok = 0, ident_ok = 0;
 
-    if (!s)
-       return -EINVAL;
+       if (!s)
+               return -EINVAL;
 
-    tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
-    if (tuple == NULL) {
-           dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n");
-           return -ENOMEM;
-    }
-    p = kmalloc(sizeof(*p), GFP_KERNEL);
-    if (p == NULL) {
-           kfree(tuple);
-           dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n");
-           return -ENOMEM;
-    }
+       /* We do not want to validate the CIS cache... */
+       mutex_lock(&s->ops_mutex);
+       destroy_cis_cache(s);
+       mutex_unlock(&s->ops_mutex);
 
-    count = reserved = 0;
-    tuple->DesiredTuple = RETURN_FIRST_TUPLE;
-    tuple->Attributes = TUPLE_RETURN_COMMON;
-    ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple);
-    if (ret != 0)
-       goto done;
-
-    /* First tuple should be DEVICE; we should really have either that
-       or a CFTABLE_ENTRY of some sort */
-    if ((tuple->TupleCode == CISTPL_DEVICE) ||
-       (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) ||
-       (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0))
-       dev_ok++;
-
-    /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2
-       tuple, for card identification.  Certain old D-Link and Linksys
-       cards have only a broken VERS_2 tuple; hence the bogus test. */
-    if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) ||
-       (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) ||
-       (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC))
-       ident_ok++;
-
-    if (!dev_ok && !ident_ok)
-       goto done;
-
-    for (count = 1; count < MAX_TUPLES; count++) {
-       ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple);
+       tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
+       if (tuple == NULL) {
+               dev_warn(&s->dev, "no memory to validate CIS\n");
+               return -ENOMEM;
+       }
+       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       if (p == NULL) {
+               kfree(tuple);
+               dev_warn(&s->dev, "no memory to validate CIS\n");
+               return -ENOMEM;
+       }
+
+       count = reserved = 0;
+       tuple->DesiredTuple = RETURN_FIRST_TUPLE;
+       tuple->Attributes = TUPLE_RETURN_COMMON;
+       ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple);
        if (ret != 0)
-               break;
-       if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
-           ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) ||
-           ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
-           reserved++;
-    }
-    if ((count == MAX_TUPLES) || (reserved > 5) ||
-       ((!dev_ok || !ident_ok) && (count > 10)))
-       count = 0;
+               goto done;
+
+       /* First tuple should be DEVICE; we should really have either that
+          or a CFTABLE_ENTRY of some sort */
+       if ((tuple->TupleCode == CISTPL_DEVICE) ||
+           (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p)) ||
+           (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p)))
+               dev_ok++;
+
+       /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2
+          tuple, for card identification.  Certain old D-Link and Linksys
+          cards have only a broken VERS_2 tuple; hence the bogus test. */
+       if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) ||
+           (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) ||
+           (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC))
+               ident_ok++;
+
+       if (!dev_ok && !ident_ok)
+               goto done;
+
+       for (count = 1; count < MAX_TUPLES; count++) {
+               ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple);
+               if (ret != 0)
+                       break;
+               if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
+                   ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) ||
+                   ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
+                       reserved++;
+       }
+       if ((count == MAX_TUPLES) || (reserved > 5) ||
+               ((!dev_ok || !ident_ok) && (count > 10)))
+               count = 0;
+
+       ret = 0;
 
 done:
-    if (info)
-           *info = count;
-    kfree(tuple);
-    kfree(p);
-    return 0;
+       /* invalidate CIS cache on failure */
+       if (!dev_ok || !ident_ok || !count) {
+               mutex_lock(&s->ops_mutex);
+               destroy_cis_cache(s);
+               mutex_unlock(&s->ops_mutex);
+               ret = -EIO;
+       }
+
+       if (info)
+               *info = count;
+       kfree(tuple);
+       kfree(p);
+       return ret;
 }
-EXPORT_SYMBOL(pccard_validate_cis);
+
+
+#define to_socket(_dev) container_of(_dev, struct pcmcia_socket, dev)
+
+static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf,
+                                 loff_t off, size_t count)
+{
+       tuple_t tuple;
+       int status, i;
+       loff_t pointer = 0;
+       ssize_t ret = 0;
+       u_char *tuplebuffer;
+       u_char *tempbuffer;
+
+       tuplebuffer = kmalloc(sizeof(u_char) * 256, GFP_KERNEL);
+       if (!tuplebuffer)
+               return -ENOMEM;
+
+       tempbuffer = kmalloc(sizeof(u_char) * 258, GFP_KERNEL);
+       if (!tempbuffer) {
+               ret = -ENOMEM;
+               goto free_tuple;
+       }
+
+       memset(&tuple, 0, sizeof(tuple_t));
+
+       tuple.Attributes = TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON;
+       tuple.DesiredTuple = RETURN_FIRST_TUPLE;
+       tuple.TupleOffset = 0;
+
+       status = pccard_get_first_tuple(s, BIND_FN_ALL, &tuple);
+       while (!status) {
+               tuple.TupleData = tuplebuffer;
+               tuple.TupleDataMax = 255;
+               memset(tuplebuffer, 0, sizeof(u_char) * 255);
+
+               status = pccard_get_tuple_data(s, &tuple);
+               if (status)
+                       break;
+
+               if (off < (pointer + 2 + tuple.TupleDataLen)) {
+                       tempbuffer[0] = tuple.TupleCode & 0xff;
+                       tempbuffer[1] = tuple.TupleLink & 0xff;
+                       for (i = 0; i < tuple.TupleDataLen; i++)
+                               tempbuffer[i + 2] = tuplebuffer[i] & 0xff;
+
+                       for (i = 0; i < (2 + tuple.TupleDataLen); i++) {
+                               if (((i + pointer) >= off) &&
+                                   (i + pointer) < (off + count)) {
+                                       buf[ret] = tempbuffer[i];
+                                       ret++;
+                               }
+                       }
+               }
+
+               pointer += 2 + tuple.TupleDataLen;
+
+               if (pointer >= (off + count))
+                       break;
+
+               if (tuple.TupleCode == CISTPL_END)
+                       break;
+               status = pccard_get_next_tuple(s, BIND_FN_ALL, &tuple);
+       }
+
+       kfree(tempbuffer);
+ free_tuple:
+       kfree(tuplebuffer);
+
+       return ret;
+}
+
+
+static ssize_t pccard_show_cis(struct kobject *kobj,
+                              struct bin_attribute *bin_attr,
+                              char *buf, loff_t off, size_t count)
+{
+       unsigned int size = 0x200;
+
+       if (off >= size)
+               count = 0;
+       else {
+               struct pcmcia_socket *s;
+               unsigned int chains;
+
+               if (off + count > size)
+                       count = size - off;
+
+               s = to_socket(container_of(kobj, struct device, kobj));
+
+               if (!(s->state & SOCKET_PRESENT))
+                       return -ENODEV;
+               if (pccard_validate_cis(s, &chains))
+                       return -EIO;
+               if (!chains)
+                       return -ENODATA;
+
+               count = pccard_extract_cis(s, buf, off, count);
+       }
+
+       return count;
+}
+
+
+static ssize_t pccard_store_cis(struct kobject *kobj,
+                               struct bin_attribute *bin_attr,
+                               char *buf, loff_t off, size_t count)
+{
+       struct pcmcia_socket *s;
+       int error;
+
+       s = to_socket(container_of(kobj, struct device, kobj));
+
+       if (off)
+               return -EINVAL;
+
+       if (count >= CISTPL_MAX_CIS_SIZE)
+               return -EINVAL;
+
+       if (!(s->state & SOCKET_PRESENT))
+               return -ENODEV;
+
+       error = pcmcia_replace_cis(s, buf, count);
+       if (error)
+               return -EIO;
+
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY);
+
+       return count;
+}
+
+
+struct bin_attribute pccard_cis_attr = {
+       .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
+       .size = 0x200,
+       .read = pccard_show_cis,
+       .write = pccard_store_cis,
+};
index 6d6f82b38a68c9ffaf341504a3dbdbac882a5496..e679e708db630e3c8a93a7f6d87ded908a2c397e 100644 (file)
@@ -140,19 +140,13 @@ struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
        struct device *dev = get_device(&skt->dev);
        if (!dev)
                return NULL;
-       skt = dev_get_drvdata(dev);
-       if (!try_module_get(skt->owner)) {
-               put_device(&skt->dev);
-               return NULL;
-       }
-       return skt;
+       return dev_get_drvdata(dev);
 }
 EXPORT_SYMBOL(pcmcia_get_socket);
 
 
 void pcmcia_put_socket(struct pcmcia_socket *skt)
 {
-       module_put(skt->owner);
        put_device(&skt->dev);
 }
 EXPORT_SYMBOL(pcmcia_put_socket);
@@ -181,8 +175,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 
        dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops);
 
-       spin_lock_init(&socket->lock);
-
        /* try to obtain a socket number [yes, it gets ugly if we
         * register more than 2^sizeof(unsigned int) pcmcia
         * sockets... but the socket number is deprecated
@@ -228,10 +220,13 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
        init_completion(&socket->socket_released);
        init_completion(&socket->thread_done);
        mutex_init(&socket->skt_mutex);
+       mutex_init(&socket->ops_mutex);
        spin_lock_init(&socket->thread_lock);
 
        if (socket->resource_ops->init) {
+               mutex_lock(&socket->ops_mutex);
                ret = socket->resource_ops->init(socket);
+               mutex_unlock(&socket->ops_mutex);
                if (ret)
                        goto err;
        }
@@ -283,15 +278,17 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
        if (socket->thread)
                kthread_stop(socket->thread);
 
-       release_cis_mem(socket);
-
        /* remove from our own list */
        down_write(&pcmcia_socket_list_rwsem);
        list_del(&socket->socket_list);
        up_write(&pcmcia_socket_list_rwsem);
 
        /* wait for sysfs to drop all references */
-       release_resource_db(socket);
+       if (socket->resource_ops->exit) {
+               mutex_lock(&socket->ops_mutex);
+               socket->resource_ops->exit(socket);
+               mutex_unlock(&socket->ops_mutex);
+       }
        wait_for_completion(&socket->socket_released);
 } /* pcmcia_unregister_socket */
 EXPORT_SYMBOL(pcmcia_unregister_socket);
@@ -328,7 +325,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
 {
        int ret;
 
-       if (s->state & SOCKET_CARDBUS)
+       if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL))
                return 0;
 
        dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
@@ -346,13 +343,6 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
        return ret;
 }
 
-static void socket_remove_drivers(struct pcmcia_socket *skt)
-{
-       dev_dbg(&skt->dev, "remove_drivers\n");
-
-       send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
-}
-
 static int socket_reset(struct pcmcia_socket *skt)
 {
        int status, i;
@@ -395,7 +385,9 @@ static void socket_shutdown(struct pcmcia_socket *s)
 
        dev_dbg(&s->dev, "shutdown\n");
 
-       socket_remove_drivers(s);
+       send_event(s, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
+
+       mutex_lock(&s->ops_mutex);
        s->state &= SOCKET_INUSE | SOCKET_PRESENT;
        msleep(shutdown_delay * 10);
        s->state &= SOCKET_INUSE;
@@ -406,11 +398,21 @@ static void socket_shutdown(struct pcmcia_socket *s)
        s->ops->set_socket(s, &s->socket);
        s->irq.AssignedIRQ = s->irq.Config = 0;
        s->lock_count = 0;
-       destroy_cis_cache(s);
+       kfree(s->fake_cis);
+       s->fake_cis = NULL;
+       s->functions = 0;
+
+       /* From here on we can be sure that only we (that is, the
+        * pccardd thread) accesses this socket, and all (16-bit)
+        * PCMCIA interactions are gone. Therefore, release
+        * ops_mutex so that we don't get a sysfs-related lockdep
+        * warning.
+        */
+       mutex_unlock(&s->ops_mutex);
+
 #ifdef CONFIG_CARDBUS
        cb_free(s);
 #endif
-       s->functions = 0;
 
        /* give socket some time to power down */
        msleep(100);
@@ -421,7 +423,7 @@ static void socket_shutdown(struct pcmcia_socket *s)
                           "*** DANGER *** unable to remove socket power\n");
        }
 
-       cs_socket_put(s);
+       s->state &= ~SOCKET_INUSE;
 }
 
 static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
@@ -460,7 +462,8 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
                        return -EINVAL;
                }
                skt->state |= SOCKET_CARDBUS;
-       }
+       } else
+               skt->state &= ~SOCKET_CARDBUS;
 
        /*
         * Decode the card voltage requirements, and apply power to the card.
@@ -509,8 +512,12 @@ static int socket_insert(struct pcmcia_socket *skt)
 
        dev_dbg(&skt->dev, "insert\n");
 
-       if (!cs_socket_get(skt))
-               return -ENODEV;
+       mutex_lock(&skt->ops_mutex);
+       if (skt->state & SOCKET_INUSE) {
+               mutex_unlock(&skt->ops_mutex);
+               return -EINVAL;
+       }
+       skt->state |= SOCKET_INUSE;
 
        ret = socket_setup(skt, setup_delay);
        if (ret == 0) {
@@ -528,9 +535,11 @@ static int socket_insert(struct pcmcia_socket *skt)
                }
 #endif
                dev_dbg(&skt->dev, "insert done\n");
+               mutex_unlock(&skt->ops_mutex);
 
                send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
        } else {
+               mutex_unlock(&skt->ops_mutex);
                socket_shutdown(skt);
        }
 
@@ -542,58 +551,66 @@ static int socket_suspend(struct pcmcia_socket *skt)
        if (skt->state & SOCKET_SUSPEND)
                return -EBUSY;
 
+       mutex_lock(&skt->ops_mutex);
+       skt->suspended_state = skt->state;
+
        send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
        skt->socket = dead_socket;
        skt->ops->set_socket(skt, &skt->socket);
        if (skt->ops->suspend)
                skt->ops->suspend(skt);
        skt->state |= SOCKET_SUSPEND;
-
+       mutex_unlock(&skt->ops_mutex);
        return 0;
 }
 
 static int socket_early_resume(struct pcmcia_socket *skt)
 {
+       mutex_lock(&skt->ops_mutex);
        skt->socket = dead_socket;
        skt->ops->init(skt);
        skt->ops->set_socket(skt, &skt->socket);
        if (skt->state & SOCKET_PRESENT)
                skt->resume_status = socket_setup(skt, resume_delay);
+       mutex_unlock(&skt->ops_mutex);
        return 0;
 }
 
 static int socket_late_resume(struct pcmcia_socket *skt)
 {
-       if (!(skt->state & SOCKET_PRESENT)) {
-               skt->state &= ~SOCKET_SUSPEND;
+       mutex_lock(&skt->ops_mutex);
+       skt->state &= ~SOCKET_SUSPEND;
+       mutex_unlock(&skt->ops_mutex);
+
+       if (!(skt->state & SOCKET_PRESENT))
                return socket_insert(skt);
+
+       if (skt->resume_status) {
+               socket_shutdown(skt);
+               return 0;
        }
 
-       if (skt->resume_status == 0) {
-               /*
-                * FIXME: need a better check here for cardbus cards.
-                */
-               if (verify_cis_cache(skt) != 0) {
-                       dev_dbg(&skt->dev, "cis mismatch - different card\n");
-                       socket_remove_drivers(skt);
-                       destroy_cis_cache(skt);
-                       /*
-                        * Workaround: give DS time to schedule removal.
-                        * Remove me once the 100ms delay is eliminated
-                        * in ds.c
-                        */
-                       msleep(200);
-                       send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
-               } else {
-                       dev_dbg(&skt->dev, "cis matches cache\n");
-                       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
-               }
-       } else {
+       if (skt->suspended_state != skt->state) {
+               dev_dbg(&skt->dev,
+                       "suspend state 0x%x != resume state 0x%x\n",
+                       skt->suspended_state, skt->state);
+
                socket_shutdown(skt);
+               return socket_insert(skt);
        }
 
-       skt->state &= ~SOCKET_SUSPEND;
+#ifdef CONFIG_CARDBUS
+       if (skt->state & SOCKET_CARDBUS) {
+               /* We can't be sure the CardBus card is the same
+                * as the one previously inserted. Therefore, remove
+                * and re-add... */
+               cb_free(skt);
+               cb_alloc(skt);
+               return 0;
+       }
+#endif
 
+       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
        return 0;
 }
 
@@ -672,20 +689,26 @@ static int pccardd(void *__skt)
 
        complete(&skt->thread_done);
 
+       /* wait for userspace to catch up */
+       msleep(250);
+
        set_freezable();
        for (;;) {
                unsigned long flags;
                unsigned int events;
+               unsigned int sysfs_events;
 
                set_current_state(TASK_INTERRUPTIBLE);
 
                spin_lock_irqsave(&skt->thread_lock, flags);
                events = skt->thread_events;
                skt->thread_events = 0;
+               sysfs_events = skt->sysfs_events;
+               skt->sysfs_events = 0;
                spin_unlock_irqrestore(&skt->thread_lock, flags);
 
+               mutex_lock(&skt->skt_mutex);
                if (events) {
-                       mutex_lock(&skt->skt_mutex);
                        if (events & SS_DETECT)
                                socket_detect_change(skt);
                        if (events & SS_BATDEAD)
@@ -694,10 +717,39 @@ static int pccardd(void *__skt)
                                send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);
                        if (events & SS_READY)
                                send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);
-                       mutex_unlock(&skt->skt_mutex);
-                       continue;
                }
 
+               if (sysfs_events) {
+                       if (sysfs_events & PCMCIA_UEVENT_EJECT)
+                               socket_remove(skt);
+                       if (sysfs_events & PCMCIA_UEVENT_INSERT)
+                               socket_insert(skt);
+                       if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
+                               !(skt->state & SOCKET_CARDBUS)) {
+                               ret = socket_resume(skt);
+                               if (!ret && skt->callback)
+                                       skt->callback->resume(skt);
+                       }
+                       if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
+                               !(skt->state & SOCKET_CARDBUS)) {
+                               if (skt->callback)
+                                       ret = skt->callback->suspend(skt);
+                               else
+                                       ret = 0;
+                               if (!ret)
+                                       socket_suspend(skt);
+                       }
+                       if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
+                               !(skt->state & SOCKET_CARDBUS)) {
+                               if (!ret && skt->callback)
+                                       skt->callback->requery(skt);
+                       }
+               }
+               mutex_unlock(&skt->skt_mutex);
+
+               if (events || sysfs_events)
+                       continue;
+
                if (kthread_should_stop())
                        break;
 
@@ -707,6 +759,13 @@ static int pccardd(void *__skt)
        /* make sure we are running before we exit */
        set_current_state(TASK_RUNNING);
 
+       /* shut down socket, if a device is still present */
+       if (skt->state & SOCKET_PRESENT) {
+               mutex_lock(&skt->skt_mutex);
+               socket_remove(skt);
+               mutex_unlock(&skt->skt_mutex);
+       }
+
        /* remove from the device core */
        pccard_sysfs_remove_socket(&skt->dev);
        device_unregister(&skt->dev);
@@ -732,6 +791,31 @@ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
 } /* pcmcia_parse_events */
 EXPORT_SYMBOL(pcmcia_parse_events);
 
+/**
+ * pcmcia_parse_uevents() - tell pccardd to issue manual commands
+ * @s:         the PCMCIA socket we wan't to command
+ * @events:    events to pass to pccardd
+ *
+ * userspace-issued insert, eject, suspend and resume commands must be
+ * handled by pccardd to avoid any sysfs-related deadlocks. Valid events
+ * are PCMCIA_UEVENT_EJECT (for eject), PCMCIA_UEVENT__INSERT (for insert),
+ * PCMCIA_UEVENT_RESUME (for resume), PCMCIA_UEVENT_SUSPEND (for suspend)
+ * and PCMCIA_UEVENT_REQUERY (for re-querying the PCMCIA card).
+ */
+void pcmcia_parse_uevents(struct pcmcia_socket *s, u_int events)
+{
+       unsigned long flags;
+       dev_dbg(&s->dev, "parse_uevents: events %08x\n", events);
+       if (s->thread) {
+               spin_lock_irqsave(&s->thread_lock, flags);
+               s->sysfs_events |= events;
+               spin_unlock_irqrestore(&s->thread_lock, flags);
+
+               wake_up_process(s->thread);
+       }
+}
+EXPORT_SYMBOL(pcmcia_parse_uevents);
+
 
 /* register pcmcia_callback */
 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
@@ -796,7 +880,10 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
                        send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW);
                        if (skt->callback)
                                skt->callback->suspend(skt);
-                       if (socket_reset(skt) == 0) {
+                       mutex_lock(&skt->ops_mutex);
+                       ret = socket_reset(skt);
+                       mutex_unlock(&skt->ops_mutex);
+                       if (ret == 0) {
                                send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW);
                                if (skt->callback)
                                        skt->callback->resume(skt);
@@ -812,121 +899,6 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
 EXPORT_SYMBOL(pcmcia_reset_card);
 
 
-/* These shut down or wake up a socket.  They are sort of user
- * initiated versions of the APM suspend and resume actions.
- */
-int pcmcia_suspend_card(struct pcmcia_socket *skt)
-{
-       int ret;
-
-       dev_dbg(&skt->dev, "suspending socket\n");
-
-       mutex_lock(&skt->skt_mutex);
-       do {
-               if (!(skt->state & SOCKET_PRESENT)) {
-                       ret = -ENODEV;
-                       break;
-               }
-               if (skt->state & SOCKET_CARDBUS) {
-                       ret = -EPERM;
-                       break;
-               }
-               if (skt->callback) {
-                       ret = skt->callback->suspend(skt);
-                       if (ret)
-                               break;
-               }
-               ret = socket_suspend(skt);
-       } while (0);
-       mutex_unlock(&skt->skt_mutex);
-
-       return ret;
-} /* suspend_card */
-EXPORT_SYMBOL(pcmcia_suspend_card);
-
-
-int pcmcia_resume_card(struct pcmcia_socket *skt)
-{
-       int ret;
-
-       dev_dbg(&skt->dev, "waking up socket\n");
-
-       mutex_lock(&skt->skt_mutex);
-       do {
-               if (!(skt->state & SOCKET_PRESENT)) {
-                       ret = -ENODEV;
-                       break;
-               }
-               if (skt->state & SOCKET_CARDBUS) {
-                       ret = -EPERM;
-                       break;
-               }
-               ret = socket_resume(skt);
-               if (!ret && skt->callback)
-                       skt->callback->resume(skt);
-       } while (0);
-       mutex_unlock(&skt->skt_mutex);
-
-       return ret;
-} /* resume_card */
-EXPORT_SYMBOL(pcmcia_resume_card);
-
-
-/* These handle user requests to eject or insert a card. */
-int pcmcia_eject_card(struct pcmcia_socket *skt)
-{
-       int ret;
-
-       dev_dbg(&skt->dev, "user eject request\n");
-
-       mutex_lock(&skt->skt_mutex);
-       do {
-               if (!(skt->state & SOCKET_PRESENT)) {
-                       ret = -ENODEV;
-                       break;
-               }
-
-               ret = send_event(skt, CS_EVENT_EJECTION_REQUEST, CS_EVENT_PRI_LOW);
-               if (ret != 0) {
-                       ret = -EINVAL;
-                       break;
-               }
-
-               socket_remove(skt);
-               ret = 0;
-       } while (0);
-       mutex_unlock(&skt->skt_mutex);
-
-       return ret;
-} /* eject_card */
-EXPORT_SYMBOL(pcmcia_eject_card);
-
-
-int pcmcia_insert_card(struct pcmcia_socket *skt)
-{
-       int ret;
-
-       dev_dbg(&skt->dev, "user insert request\n");
-
-       mutex_lock(&skt->skt_mutex);
-       do {
-               if (skt->state & SOCKET_PRESENT) {
-                       ret = -EBUSY;
-                       break;
-               }
-               if (socket_insert(skt) == -ENODEV) {
-                       ret = -ENODEV;
-                       break;
-               }
-               ret = 0;
-       } while (0);
-       mutex_unlock(&skt->skt_mutex);
-
-       return ret;
-} /* insert_card */
-EXPORT_SYMBOL(pcmcia_insert_card);
-
-
 static int pcmcia_socket_uevent(struct device *dev,
                                struct kobj_uevent_env *env)
 {
index 3bc02d53a3a30ae91bd61a6bd3bd2554958c93b9..f95864c2191e1b058eded1b6aebc8ca660779f0a 100644 (file)
@@ -87,37 +87,11 @@ struct pccard_resource_ops {
 #define SOCKET_CARDBUS         0x8000
 #define SOCKET_CARDBUS_CONFIG  0x10000
 
-static inline int cs_socket_get(struct pcmcia_socket *skt)
-{
-       int ret;
-
-       WARN_ON(skt->state & SOCKET_INUSE);
-
-       ret = try_module_get(skt->owner);
-       if (ret)
-               skt->state |= SOCKET_INUSE;
-       return ret;
-}
-
-static inline void cs_socket_put(struct pcmcia_socket *skt)
-{
-       if (skt->state & SOCKET_INUSE) {
-               skt->state &= ~SOCKET_INUSE;
-               module_put(skt->owner);
-       }
-}
-
 
 /*
  * Stuff internal to module "pcmcia_core":
  */
 
-/* cistpl.c */
-int verify_cis_cache(struct pcmcia_socket *s);
-
-/* rsrc_mgr.c */
-void release_resource_db(struct pcmcia_socket *s);
-
 /* socket_sysfs.c */
 extern int pccard_sysfs_add_socket(struct device *dev);
 extern void pccard_sysfs_remove_socket(struct device *dev);
@@ -125,8 +99,6 @@ extern void pccard_sysfs_remove_socket(struct device *dev);
 /* cardbus.c */
 int cb_alloc(struct pcmcia_socket *s);
 void cb_free(struct pcmcia_socket *s);
-int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len,
-               void *ptr);
 
 
 
@@ -138,7 +110,8 @@ struct pcmcia_callback{
        struct module   *owner;
        int             (*event) (struct pcmcia_socket *s,
                                  event_t event, int priority);
-       void            (*requery) (struct pcmcia_socket *s, int new_cis);
+       void            (*requery) (struct pcmcia_socket *s);
+       int             (*validate) (struct pcmcia_socket *s, unsigned int *i);
        int             (*suspend) (struct pcmcia_socket *s);
        int             (*resume) (struct pcmcia_socket *s);
 };
@@ -151,16 +124,35 @@ extern struct class pcmcia_socket_class;
 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
 struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
 
-int pcmcia_suspend_card(struct pcmcia_socket *skt);
-int pcmcia_resume_card(struct pcmcia_socket *skt);
-
-int pcmcia_eject_card(struct pcmcia_socket *skt);
-int pcmcia_insert_card(struct pcmcia_socket *skt);
+void pcmcia_parse_uevents(struct pcmcia_socket *socket, unsigned int events);
+#define PCMCIA_UEVENT_EJECT    0x0001
+#define PCMCIA_UEVENT_INSERT   0x0002
+#define PCMCIA_UEVENT_SUSPEND  0x0004
+#define PCMCIA_UEVENT_RESUME   0x0008
+#define PCMCIA_UEVENT_REQUERY  0x0010
 
 struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt);
 void pcmcia_put_socket(struct pcmcia_socket *skt);
 
+/*
+ * Stuff internal to module "pcmcia".
+ */
+/* ds.c */
+extern struct bus_type pcmcia_bus_type;
+
+/* pcmcia_resource.c */
+extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
+extern int pcmcia_validate_mem(struct pcmcia_socket *s);
+extern struct resource *pcmcia_find_mem_region(u_long base,
+                                              u_long num,
+                                              u_long align,
+                                              int low,
+                                              struct pcmcia_socket *s);
+
+
 /* cistpl.c */
+extern struct bin_attribute pccard_cis_attr;
+
 int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr,
                        u_int addr, u_int len, void *ptr);
 void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr,
@@ -172,8 +164,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
 int pcmcia_replace_cis(struct pcmcia_socket *s,
                       const u8 *data, const size_t len);
 int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
+int verify_cis_cache(struct pcmcia_socket *s);
 
-/* loop over CIS entries */
 int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
                      cisdata_t code, cisparse_t *parse, void *priv_data,
                      int (*loop_tuple) (tuple_t *tuple,
@@ -189,35 +181,8 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
 
 
-/* rsrc_mgr.c */
-int pcmcia_validate_mem(struct pcmcia_socket *s);
-struct resource *pcmcia_find_io_region(unsigned long base,
-                                      int num,
-                                      unsigned long align,
-                                      struct pcmcia_socket *s);
-int pcmcia_adjust_io_region(struct resource *res,
-                           unsigned long r_start,
-                           unsigned long r_end,
-                           struct pcmcia_socket *s);
-struct resource *pcmcia_find_mem_region(u_long base,
-                                       u_long num,
-                                       u_long align,
-                                       int low,
-                                       struct pcmcia_socket *s);
-
-/*
- * Stuff internal to module "pcmcia".
- */
-/* ds.c */
-extern struct bus_type pcmcia_bus_type;
-
-/* pcmcia_resource.c */
-extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
-
 #ifdef CONFIG_PCMCIA_IOCTL
 /* ds.c */
-extern spinlock_t pcmcia_dev_list_lock;
-
 extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev);
 extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
 
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
new file mode 100644 (file)
index 0000000..3889cf0
--- /dev/null
@@ -0,0 +1,623 @@
+/*
+ * PCMCIA socket code for the Alchemy Db1xxx/Pb1xxx boards.
+ *
+ * Copyright (c) 2009 Manuel Lauss <manuel.lauss@gmail.com>
+ *
+ */
+
+/* This is a fairly generic PCMCIA socket driver suitable for the
+ * following Alchemy Development boards:
+ *  Db1000, Db/Pb1500, Db/Pb1100, Db/Pb1550, Db/Pb1200.
+ *
+ * The Db1000 is used as a reference:  Per-socket card-, carddetect- and
+ *  statuschange IRQs connected to SoC GPIOs, control and status register
+ *  bits arranged in per-socket groups in an external PLD.  All boards
+ *  listed here use this layout, including bit positions and meanings.
+ *  Of course there are exceptions in later boards:
+ *
+ *     - Pb1100/Pb1500:  single socket only; voltage key bits VS are
+ *                       at STATUS[5:4] (instead of STATUS[1:0]).
+ *     - Au1200-based:   additional card-eject irqs, irqs not gpios!
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
+#include <linux/platform_device.h>
+#include <linux/resource.h>
+#include <linux/spinlock.h>
+
+#include <pcmcia/cs_types.h>
+#include <pcmcia/ss.h>
+
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#define MEM_MAP_SIZE   0x400000
+#define IO_MAP_SIZE    0x1000
+
+struct db1x_pcmcia_sock {
+       struct pcmcia_socket    socket;
+       int             nr;             /* socket number */
+       void            *virt_io;
+
+       /* the "pseudo" addresses of the PCMCIA space. */
+       phys_addr_t     phys_io;
+       phys_addr_t     phys_attr;
+       phys_addr_t     phys_mem;
+
+       /* previous flags for set_socket() */
+       unsigned int old_flags;
+
+       /* interrupt sources: linux irq numbers! */
+       int     insert_irq;     /* default carddetect irq */
+       int     stschg_irq;     /* card-status-change irq */
+       int     card_irq;       /* card irq */
+       int     eject_irq;      /* db1200/pb1200 have these */
+
+#define BOARD_TYPE_DEFAULT     0       /* most boards */
+#define BOARD_TYPE_DB1200      1       /* IRQs aren't gpios */
+#define BOARD_TYPE_PB1100      2       /* VS bits slightly different */
+       int     board_type;
+};
+
+#define to_db1x_socket(x) container_of(x, struct db1x_pcmcia_sock, socket)
+
+/* DB/PB1200: check CPLD SIGSTATUS register bit 10/12 */
+static int db1200_card_inserted(struct db1x_pcmcia_sock *sock)
+{
+       unsigned short sigstat;
+
+       sigstat = bcsr_read(BCSR_SIGSTAT);
+       return sigstat & 1 << (8 + 2 * sock->nr);
+}
+
+/* carddetect gpio: low-active */
+static int db1000_card_inserted(struct db1x_pcmcia_sock *sock)
+{
+       return !gpio_get_value(irq_to_gpio(sock->insert_irq));
+}
+
+static int db1x_card_inserted(struct db1x_pcmcia_sock *sock)
+{
+       switch (sock->board_type) {
+       case BOARD_TYPE_DB1200:
+               return db1200_card_inserted(sock);
+       default:
+               return db1000_card_inserted(sock);
+       }
+}
+
+/* STSCHG tends to bounce heavily when cards are inserted/ejected.
+ * To avoid this, the interrupt is normally disabled and only enabled
+ * after reset to a card has been de-asserted.
+ */
+static inline void set_stschg(struct db1x_pcmcia_sock *sock, int en)
+{
+       if (sock->stschg_irq != -1) {
+               if (en)
+                       enable_irq(sock->stschg_irq);
+               else
+                       disable_irq(sock->stschg_irq);
+       }
+}
+
+static irqreturn_t db1000_pcmcia_cdirq(int irq, void *data)
+{
+       struct db1x_pcmcia_sock *sock = data;
+
+       pcmcia_parse_events(&sock->socket, SS_DETECT);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t db1000_pcmcia_stschgirq(int irq, void *data)
+{
+       struct db1x_pcmcia_sock *sock = data;
+
+       pcmcia_parse_events(&sock->socket, SS_STSCHG);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t db1200_pcmcia_cdirq(int irq, void *data)
+{
+       struct db1x_pcmcia_sock *sock = data;
+
+       /* Db/Pb1200 have separate per-socket insertion and ejection
+        * interrupts which stay asserted as long as the card is
+        * inserted/missing.  The one which caused us to be called
+        * needs to be disabled and the other one enabled.
+        */
+       if (irq == sock->insert_irq) {
+               disable_irq_nosync(sock->insert_irq);
+               enable_irq(sock->eject_irq);
+       } else {
+               disable_irq_nosync(sock->eject_irq);
+               enable_irq(sock->insert_irq);
+       }
+
+       pcmcia_parse_events(&sock->socket, SS_DETECT);
+
+       return IRQ_HANDLED;
+}
+
+static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock)
+{
+       int ret;
+       unsigned long flags;
+
+       if (sock->stschg_irq != -1) {
+               ret = request_irq(sock->stschg_irq, db1000_pcmcia_stschgirq,
+                                 0, "pcmcia_stschg", sock);
+               if (ret)
+                       return ret;
+       }
+
+       /* Db/Pb1200 have separate per-socket insertion and ejection
+        * interrupts, which should show edge behaviour but don't.
+        * So interrupts are disabled until both insertion and
+        * ejection handler have been registered and the currently
+        * active one disabled.
+        */
+       if (sock->board_type == BOARD_TYPE_DB1200) {
+               local_irq_save(flags);
+
+               ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq,
+                                 IRQF_DISABLED, "pcmcia_insert", sock);
+               if (ret)
+                       goto out1;
+
+               ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq,
+                                 IRQF_DISABLED, "pcmcia_eject", sock);
+               if (ret) {
+                       free_irq(sock->insert_irq, sock);
+                       local_irq_restore(flags);
+                       goto out1;
+               }
+
+               /* disable the currently active one */
+               if (db1200_card_inserted(sock))
+                       disable_irq_nosync(sock->insert_irq);
+               else
+                       disable_irq_nosync(sock->eject_irq);
+
+               local_irq_restore(flags);
+       } else {
+               /* all other (older) Db1x00 boards use a GPIO to show
+                * card detection status:  use both-edge triggers.
+                */
+               set_irq_type(sock->insert_irq, IRQ_TYPE_EDGE_BOTH);
+               ret = request_irq(sock->insert_irq, db1000_pcmcia_cdirq,
+                                 0, "pcmcia_carddetect", sock);
+
+               if (ret)
+                       goto out1;
+       }
+
+       return 0;       /* all done */
+
+out1:
+       if (sock->stschg_irq != -1)
+               free_irq(sock->stschg_irq, sock);
+
+       return ret;
+}
+
+static void db1x_pcmcia_free_irqs(struct db1x_pcmcia_sock *sock)
+{
+       if (sock->stschg_irq != -1)
+               free_irq(sock->stschg_irq, sock);
+
+       free_irq(sock->insert_irq, sock);
+       if (sock->eject_irq != -1)
+               free_irq(sock->eject_irq, sock);
+}
+
+/*
+ * configure a PCMCIA socket on the Db1x00 series of boards (and
+ * compatibles).
+ *
+ * 2 external registers are involved:
+ *   pcmcia_status (offset 0x04): bits [0:1/2:3]: read card voltage id
+ *   pcmcia_control(offset 0x10):
+ *     bits[0:1] set vcc for card
+ *     bits[2:3] set vpp for card
+ *     bit 4:  enable data buffers
+ *     bit 7:  reset# for card
+ *     add 8 for second socket.
+ */
+static int db1x_pcmcia_configure(struct pcmcia_socket *skt,
+                                struct socket_state_t *state)
+{
+       struct db1x_pcmcia_sock *sock = to_db1x_socket(skt);
+       unsigned short cr_clr, cr_set;
+       unsigned int changed;
+       int v, p, ret;
+
+       /* card voltage setup */
+       cr_clr = (0xf << (sock->nr * 8)); /* clear voltage settings */
+       cr_set = 0;
+       v = p = ret = 0;
+
+       switch (state->Vcc) {
+       case 50:
+               ++v;
+       case 33:
+               ++v;
+       case 0:
+               break;
+       default:
+               printk(KERN_INFO "pcmcia%d unsupported Vcc %d\n",
+                       sock->nr, state->Vcc);
+       }
+
+       switch (state->Vpp) {
+       case 12:
+               ++p;
+       case 33:
+       case 50:
+               ++p;
+       case 0:
+               break;
+       default:
+               printk(KERN_INFO "pcmcia%d unsupported Vpp %d\n",
+                       sock->nr, state->Vpp);
+       }
+
+       /* sanity check: Vpp must be 0, 12, or Vcc */
+       if (((state->Vcc == 33) && (state->Vpp == 50)) ||
+           ((state->Vcc == 50) && (state->Vpp == 33))) {
+               printk(KERN_INFO "pcmcia%d bad Vcc/Vpp combo (%d %d)\n",
+                       sock->nr, state->Vcc, state->Vpp);
+               v = p = 0;
+               ret = -EINVAL;
+       }
+
+       /* create new voltage code */
+       cr_set |= ((v << 2) | p) << (sock->nr * 8);
+
+       changed = state->flags ^ sock->old_flags;
+
+       if (changed & SS_RESET) {
+               if (state->flags & SS_RESET) {
+                       set_stschg(sock, 0);
+                       /* assert reset, disable io buffers */
+                       cr_clr |= (1 << (7 + (sock->nr * 8)));
+                       cr_clr |= (1 << (4 + (sock->nr * 8)));
+               } else {
+                       /* de-assert reset, enable io buffers */
+                       cr_set |= 1 << (7 + (sock->nr * 8));
+                       cr_set |= 1 << (4 + (sock->nr * 8));
+               }
+       }
+
+       /* update PCMCIA configuration */
+       bcsr_mod(BCSR_PCMCIA, cr_clr, cr_set);
+
+       sock->old_flags = state->flags;
+
+       /* reset was taken away: give card time to initialize properly */
+       if ((changed & SS_RESET) && !(state->flags & SS_RESET)) {
+               msleep(500);
+               set_stschg(sock, 1);
+       }
+
+       return ret;
+}
+
+/* VCC bits at [3:2]/[11:10] */
+#define GET_VCC(cr, socknr)            \
+       ((((cr) >> 2) >> ((socknr) * 8)) & 3)
+
+/* VS bits at [0:1]/[3:2] */
+#define GET_VS(sr, socknr)             \
+       (((sr) >> (2 * (socknr))) & 3)
+
+/* reset bits at [7]/[15] */
+#define GET_RESET(cr, socknr)          \
+       ((cr) & (1 << (7 + (8 * (socknr)))))
+
+static int db1x_pcmcia_get_status(struct pcmcia_socket *skt,
+                                 unsigned int *value)
+{
+       struct db1x_pcmcia_sock *sock = to_db1x_socket(skt);
+       unsigned short cr, sr;
+       unsigned int status;
+
+       status = db1x_card_inserted(sock) ? SS_DETECT : 0;
+
+       cr = bcsr_read(BCSR_PCMCIA);
+       sr = bcsr_read(BCSR_STATUS);
+
+       /* PB1100/PB1500: voltage key bits are at [5:4] */
+       if (sock->board_type == BOARD_TYPE_PB1100)
+               sr >>= 4;
+
+       /* determine card type */
+       switch (GET_VS(sr, sock->nr)) {
+       case 0:
+       case 2:
+               status |= SS_3VCARD;    /* 3V card */
+       case 3:
+               break;                  /* 5V card: set nothing */
+       default:
+               status |= SS_XVCARD;    /* treated as unsupported in core */
+       }
+
+       /* if Vcc is not zero, we have applied power to a card */
+       status |= GET_VCC(cr, sock->nr) ? SS_POWERON : 0;
+
+       /* reset de-asserted? then we're ready */
+       status |= (GET_RESET(cr, sock->nr)) ? SS_READY : SS_RESET;
+
+       *value = status;
+
+       return 0;
+}
+
+static int db1x_pcmcia_sock_init(struct pcmcia_socket *skt)
+{
+       return 0;
+}
+
+static int db1x_pcmcia_sock_suspend(struct pcmcia_socket *skt)
+{
+       return 0;
+}
+
+static int au1x00_pcmcia_set_io_map(struct pcmcia_socket *skt,
+                                   struct pccard_io_map *map)
+{
+       struct db1x_pcmcia_sock *sock = to_db1x_socket(skt);
+
+       map->start = (u32)sock->virt_io;
+       map->stop = map->start + IO_MAP_SIZE;
+
+       return 0;
+}
+
+static int au1x00_pcmcia_set_mem_map(struct pcmcia_socket *skt,
+                                    struct pccard_mem_map *map)
+{
+       struct db1x_pcmcia_sock *sock = to_db1x_socket(skt);
+
+       if (map->flags & MAP_ATTRIB)
+               map->static_start = sock->phys_attr + map->card_start;
+       else
+               map->static_start = sock->phys_mem + map->card_start;
+
+       return 0;
+}
+
+static struct pccard_operations db1x_pcmcia_operations = {
+       .init                   = db1x_pcmcia_sock_init,
+       .suspend                = db1x_pcmcia_sock_suspend,
+       .get_status             = db1x_pcmcia_get_status,
+       .set_socket             = db1x_pcmcia_configure,
+       .set_io_map             = au1x00_pcmcia_set_io_map,
+       .set_mem_map            = au1x00_pcmcia_set_mem_map,
+};
+
+static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev)
+{
+       struct db1x_pcmcia_sock *sock;
+       struct resource *r;
+       int ret, bid;
+
+       sock = kzalloc(sizeof(struct db1x_pcmcia_sock), GFP_KERNEL);
+       if (!sock)
+               return -ENOMEM;
+
+       sock->nr = pdev->id;
+
+       bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
+       switch (bid) {
+       case BCSR_WHOAMI_PB1500:
+       case BCSR_WHOAMI_PB1500R2:
+       case BCSR_WHOAMI_PB1100:
+               sock->board_type = BOARD_TYPE_PB1100;
+               break;
+       case BCSR_WHOAMI_DB1000 ... BCSR_WHOAMI_PB1550_SDR:
+               sock->board_type = BOARD_TYPE_DEFAULT;
+               break;
+       case BCSR_WHOAMI_PB1200 ... BCSR_WHOAMI_DB1200:
+               sock->board_type = BOARD_TYPE_DB1200;
+               break;
+       default:
+               printk(KERN_INFO "db1xxx-ss: unknown board %d!\n", bid);
+               ret = -ENODEV;
+               goto out0;
+       };
+
+       /*
+        * gather resources necessary and optional nice-to-haves to
+        * operate a socket:
+        * This includes IRQs for Carddetection/ejection, the card
+        *  itself and optional status change detection.
+        * Also, the memory areas covered by a socket.  For these
+        *  we require the 32bit "pseudo" addresses (see the au1000.h
+        *  header for more information).
+        */
+
+       /* card: irq assigned to the card itself. */
+       r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "card");
+       sock->card_irq = r ? r->start : 0;
+
+       /* insert: irq which triggers on card insertion/ejection */
+       r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "insert");
+       sock->insert_irq = r ? r->start : -1;
+
+       /* stschg: irq which trigger on card status change (optional) */
+       r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "stschg");
+       sock->stschg_irq = r ? r->start : -1;
+
+       /* eject: irq which triggers on ejection (DB1200/PB1200 only) */
+       r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "eject");
+       sock->eject_irq = r ? r->start : -1;
+
+       ret = -ENODEV;
+
+       /*
+        * pseudo-attr:  The 32bit address of the PCMCIA attribute space
+        * for this socket (usually the 36bit address shifted 4 to the
+        * right).
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-attr");
+       if (!r) {
+               printk(KERN_ERR "pcmcia%d has no 'pseudo-attr' resource!\n",
+                       sock->nr);
+               goto out0;
+       }
+       sock->phys_attr = r->start;
+
+       /*
+        * pseudo-mem:  The 32bit address of the PCMCIA memory space for
+        * this socket (usually the 36bit address shifted 4 to the right)
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-mem");
+       if (!r) {
+               printk(KERN_ERR "pcmcia%d has no 'pseudo-mem' resource!\n",
+                       sock->nr);
+               goto out0;
+       }
+       sock->phys_mem = r->start;
+
+       /*
+        * pseudo-io:  The 32bit address of the PCMCIA IO space for this
+        * socket (usually the 36bit address shifted 4 to the right).
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-io");
+       if (!r) {
+               printk(KERN_ERR "pcmcia%d has no 'pseudo-io' resource!\n",
+                       sock->nr);
+               goto out0;
+       }
+       sock->phys_io = r->start;
+
+       /*
+        * PCMCIA client drivers use the inb/outb macros to access
+        * the IO registers.  Since mips_io_port_base is added
+        * to the access address of the mips implementation of
+        * inb/outb, we need to subtract it here because we want
+        * to access the I/O or MEM address directly, without
+        * going through this "mips_io_port_base" mechanism.
+        */
+       sock->virt_io = (void *)(ioremap(sock->phys_io, IO_MAP_SIZE) -
+                                mips_io_port_base);
+
+       if (!sock->virt_io) {
+               printk(KERN_ERR "pcmcia%d: cannot remap IO area\n",
+                       sock->nr);
+               ret = -ENOMEM;
+               goto out0;
+       }
+
+       sock->socket.ops        = &db1x_pcmcia_operations;
+       sock->socket.owner      = THIS_MODULE;
+       sock->socket.pci_irq    = sock->card_irq;
+       sock->socket.features   = SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
+       sock->socket.map_size   = MEM_MAP_SIZE;
+       sock->socket.io_offset  = (unsigned long)sock->virt_io;
+       sock->socket.dev.parent = &pdev->dev;
+       sock->socket.resource_ops = &pccard_static_ops;
+
+       platform_set_drvdata(pdev, sock);
+
+       ret = db1x_pcmcia_setup_irqs(sock);
+       if (ret) {
+               printk(KERN_ERR "pcmcia%d cannot setup interrupts\n",
+                       sock->nr);
+               goto out1;
+       }
+
+       set_stschg(sock, 0);
+
+       ret = pcmcia_register_socket(&sock->socket);
+       if (ret) {
+               printk(KERN_ERR "pcmcia%d failed to register\n", sock->nr);
+               goto out2;
+       }
+
+       printk(KERN_INFO "Alchemy Db/Pb1xxx pcmcia%d @ io/attr/mem %09llx"
+               "(%p) %09llx %09llx  card/insert/stschg/eject irqs @ %d "
+               "%d %d %d\n", sock->nr, sock->phys_io, sock->virt_io,
+               sock->phys_attr, sock->phys_mem, sock->card_irq,
+               sock->insert_irq, sock->stschg_irq, sock->eject_irq);
+
+       return 0;
+
+out2:
+       db1x_pcmcia_free_irqs(sock);
+out1:
+       iounmap((void *)(sock->virt_io + (u32)mips_io_port_base));
+out0:
+       kfree(sock);
+       return ret;
+}
+
+static int __devexit db1x_pcmcia_socket_remove(struct platform_device *pdev)
+{
+       struct db1x_pcmcia_sock *sock = platform_get_drvdata(pdev);
+
+       db1x_pcmcia_free_irqs(sock);
+       pcmcia_unregister_socket(&sock->socket);
+       iounmap((void *)(sock->virt_io + (u32)mips_io_port_base));
+       kfree(sock);
+
+       return 0;
+}
+
+#ifdef CONFIG_PM
+static int db1x_pcmcia_suspend(struct device *dev)
+{
+       return pcmcia_socket_dev_suspend(dev);
+}
+
+static int db1x_pcmcia_resume(struct device *dev)
+{
+       return pcmcia_socket_dev_resume(dev);
+}
+
+static struct dev_pm_ops db1x_pcmcia_pmops = {
+       .resume         = db1x_pcmcia_resume,
+       .suspend        = db1x_pcmcia_suspend,
+       .thaw           = db1x_pcmcia_resume,
+       .freeze         = db1x_pcmcia_suspend,
+};
+
+#define DB1XXX_SS_PMOPS &db1x_pcmcia_pmops
+
+#else
+
+#define DB1XXX_SS_PMOPS NULL
+
+#endif
+
+static struct platform_driver db1x_pcmcia_socket_driver = {
+       .driver = {
+               .name   = "db1xxx_pcmcia",
+               .owner  = THIS_MODULE,
+               .pm     = DB1XXX_SS_PMOPS
+       },
+       .probe          = db1x_pcmcia_socket_probe,
+       .remove         = __devexit_p(db1x_pcmcia_socket_remove),
+};
+
+int __init db1x_pcmcia_socket_load(void)
+{
+       return platform_driver_register(&db1x_pcmcia_socket_driver);
+}
+
+void  __exit db1x_pcmcia_socket_unload(void)
+{
+       platform_driver_unregister(&db1x_pcmcia_socket_driver);
+}
+
+module_init(db1x_pcmcia_socket_load);
+module_exit(db1x_pcmcia_socket_unload);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("PCMCIA Socket Services for Alchemy Db/Pb1x00 boards");
+MODULE_AUTHOR("Manuel Lauss");
index 1a4a3c49cc15c71fe9db9ab07f61fd4cdff194ad..0f98be4450b7a0e01a31e90542011bf46f47a4b2 100644 (file)
@@ -42,8 +42,6 @@ MODULE_DESCRIPTION("PCMCIA Driver Services");
 MODULE_LICENSE("GPL");
 
 
-spinlock_t pcmcia_dev_list_lock;
-
 /*====================================================================*/
 
 static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
@@ -126,9 +124,9 @@ pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
        dynid->id.device_no = device_no;
        memcpy(dynid->id.prod_id_hash, prod_id_hash, sizeof(__u32) * 4);
 
-       spin_lock(&pdrv->dynids.lock);
+       mutex_lock(&pdrv->dynids.lock);
        list_add_tail(&dynid->node, &pdrv->dynids.list);
-       spin_unlock(&pdrv->dynids.lock);
+       mutex_unlock(&pdrv->dynids.lock);
 
        if (get_driver(&pdrv->drv)) {
                retval = driver_attach(&pdrv->drv);
@@ -146,12 +144,12 @@ pcmcia_free_dynids(struct pcmcia_driver *drv)
 {
        struct pcmcia_dynid *dynid, *n;
 
-       spin_lock(&drv->dynids.lock);
+       mutex_lock(&drv->dynids.lock);
        list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) {
                list_del(&dynid->node);
                kfree(dynid);
        }
-       spin_unlock(&drv->dynids.lock);
+       mutex_unlock(&drv->dynids.lock);
 }
 
 static int
@@ -182,7 +180,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
        /* initialize common fields */
        driver->drv.bus = &pcmcia_bus_type;
        driver->drv.owner = driver->owner;
-       spin_lock_init(&driver->dynids.lock);
+       mutex_init(&driver->dynids.lock);
        INIT_LIST_HEAD(&driver->dynids.list);
 
        pr_debug("registering driver %s\n", driver->drv.name);
@@ -239,30 +237,21 @@ static void pcmcia_release_function(struct kref *ref)
 static void pcmcia_release_dev(struct device *dev)
 {
        struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
+       int i;
        dev_dbg(dev, "releasing device\n");
        pcmcia_put_socket(p_dev->socket);
+       for (i = 0; i < 4; i++)
+               kfree(p_dev->prod_id[i]);
        kfree(p_dev->devname);
        kref_put(&p_dev->function_config->ref, pcmcia_release_function);
        kfree(p_dev);
 }
 
-static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
-{
-       if (!s->pcmcia_state.device_add_pending) {
-               dev_dbg(&s->dev, "scheduling to add %s secondary"
-                      " device to %d\n", mfc ? "mfc" : "pfc", s->sock);
-               s->pcmcia_state.device_add_pending = 1;
-               s->pcmcia_state.mfc_pfc = mfc;
-               schedule_work(&s->device_add);
-       }
-       return;
-}
 
 static int pcmcia_device_probe(struct device *dev)
 {
        struct pcmcia_device *p_dev;
        struct pcmcia_driver *p_drv;
-       struct pcmcia_device_id *did;
        struct pcmcia_socket *s;
        cistpl_config_t cis_config;
        int ret = 0;
@@ -275,18 +264,6 @@ static int pcmcia_device_probe(struct device *dev)
        p_drv = to_pcmcia_drv(dev->driver);
        s = p_dev->socket;
 
-       /* The PCMCIA code passes the match data in via dev_set_drvdata(dev)
-        * which is an ugly hack. Once the driver probe is called it may
-        * and often will overwrite the match data so we must save it first
-        *
-        * handle pseudo multifunction devices:
-        * there are at most two pseudo multifunction devices.
-        * if we're matching against the first, schedule a
-        * call which will then check whether there are two
-        * pseudo devices, and if not, add the second one.
-        */
-       did = dev_get_drvdata(&p_dev->dev);
-
        dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name);
 
        if ((!p_drv->probe) || (!p_dev->function_config) ||
@@ -315,9 +292,11 @@ static int pcmcia_device_probe(struct device *dev)
                goto put_module;
        }
 
-       if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
+       mutex_lock(&s->ops_mutex);
+       if ((s->pcmcia_state.has_pfc) &&
            (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
-               pcmcia_add_device_later(p_dev->socket, 0);
+               pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY);
+       mutex_unlock(&s->ops_mutex);
 
 put_module:
        if (ret)
@@ -336,26 +315,27 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
 {
        struct pcmcia_device    *p_dev;
        struct pcmcia_device    *tmp;
-       unsigned long           flags;
 
        dev_dbg(leftover ? &leftover->dev : &s->dev,
                   "pcmcia_card_remove(%d) %s\n", s->sock,
                   leftover ? leftover->devname : "");
 
+       mutex_lock(&s->ops_mutex);
        if (!leftover)
                s->device_count = 0;
        else
                s->device_count = 1;
+       mutex_unlock(&s->ops_mutex);
 
        /* unregister all pcmcia_devices registered with this socket, except leftover */
        list_for_each_entry_safe(p_dev, tmp, &s->devices_list, socket_device_list) {
                if (p_dev == leftover)
                        continue;
 
-               spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+               mutex_lock(&s->ops_mutex);
                list_del(&p_dev->socket_device_list);
                p_dev->_removed = 1;
-               spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+               mutex_unlock(&s->ops_mutex);
 
                dev_dbg(&p_dev->dev, "unregistering device\n");
                device_unregister(&p_dev->dev);
@@ -368,7 +348,6 @@ static int pcmcia_device_remove(struct device *dev)
 {
        struct pcmcia_device *p_dev;
        struct pcmcia_driver *p_drv;
-       struct pcmcia_device_id *did;
        int i;
 
        p_dev = to_pcmcia_dev(dev);
@@ -380,9 +359,8 @@ static int pcmcia_device_remove(struct device *dev)
         * pseudo multi-function card, we need to unbind
         * all devices
         */
-       did = dev_get_drvdata(&p_dev->dev);
-       if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
-           (p_dev->socket->device_count != 0) &&
+       if ((p_dev->socket->pcmcia_state.has_pfc) &&
+           (p_dev->socket->device_count > 0) &&
            (p_dev->device_no == 0))
                pcmcia_card_remove(p_dev->socket, p_dev);
 
@@ -431,16 +409,20 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
 
        if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL,
                               CISTPL_MANFID, &manf_id)) {
+               mutex_lock(&p_dev->socket->ops_mutex);
                p_dev->manf_id = manf_id.manf;
                p_dev->card_id = manf_id.card;
                p_dev->has_manf_id = 1;
                p_dev->has_card_id = 1;
+               mutex_unlock(&p_dev->socket->ops_mutex);
        }
 
        if (!pccard_read_tuple(p_dev->socket, p_dev->func,
                               CISTPL_FUNCID, &func_id)) {
+               mutex_lock(&p_dev->socket->ops_mutex);
                p_dev->func_id = func_id.func;
                p_dev->has_func_id = 1;
+               mutex_unlock(&p_dev->socket->ops_mutex);
        } else {
                /* rule of thumb: cards with no FUNCID, but with
                 * common memory device geometry information, are
@@ -457,17 +439,21 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
                        dev_dbg(&p_dev->dev,
                                   "mem device geometry probably means "
                                   "FUNCID_MEMORY\n");
+                       mutex_lock(&p_dev->socket->ops_mutex);
                        p_dev->func_id = CISTPL_FUNCID_MEMORY;
                        p_dev->has_func_id = 1;
+                       mutex_unlock(&p_dev->socket->ops_mutex);
                }
                kfree(devgeo);
        }
 
        if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_VERS_1,
                               vers1)) {
+               mutex_lock(&p_dev->socket->ops_mutex);
                for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) {
                        char *tmp;
                        unsigned int length;
+                       char *new;
 
                        tmp = vers1->str + vers1->ofs[i];
 
@@ -475,14 +461,17 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
                        if ((length < 2) || (length > 255))
                                continue;
 
-                       p_dev->prod_id[i] = kmalloc(sizeof(char) * length,
-                                                   GFP_KERNEL);
-                       if (!p_dev->prod_id[i])
+                       new = kmalloc(sizeof(char) * length, GFP_KERNEL);
+                       if (!new)
                                continue;
 
-                       p_dev->prod_id[i] = strncpy(p_dev->prod_id[i],
-                                                   tmp, length);
+                       new = strncpy(new, tmp, length);
+
+                       tmp = p_dev->prod_id[i];
+                       p_dev->prod_id[i] = new;
+                       kfree(tmp);
                }
+               mutex_unlock(&p_dev->socket->ops_mutex);
        }
 
        kfree(vers1);
@@ -502,7 +491,7 @@ static DEFINE_MUTEX(device_add_lock);
 struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function)
 {
        struct pcmcia_device *p_dev, *tmp_dev;
-       unsigned long flags;
+       int i;
 
        s = pcmcia_get_socket(s);
        if (!s)
@@ -512,16 +501,19 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
 
        pr_debug("adding device to %d, function %d\n", s->sock, function);
 
-       /* max of 4 devices per card */
-       if (s->device_count == 4)
-               goto err_put;
-
        p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL);
        if (!p_dev)
                goto err_put;
 
-       p_dev->socket = s;
+       mutex_lock(&s->ops_mutex);
        p_dev->device_no = (s->device_count++);
+       mutex_unlock(&s->ops_mutex);
+
+       /* max of 2 devices per card */
+       if (p_dev->device_no >= 2)
+               goto err_free;
+
+       p_dev->socket = s;
        p_dev->func   = function;
 
        p_dev->dev.bus = &pcmcia_bus_type;
@@ -538,7 +530,7 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
                goto err_free;
        dev_dbg(&p_dev->dev, "devname is %s\n", p_dev->devname);
 
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
 
        /*
         * p_dev->function_config must be the same for all card functions.
@@ -556,7 +548,7 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
        /* Add to the list in pcmcia_bus_socket */
        list_add(&p_dev->socket_device_list, &s->devices_list);
 
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
 
        if (!p_dev->function_config) {
                dev_dbg(&p_dev->dev, "creating config_t\n");
@@ -581,14 +573,19 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
        return p_dev;
 
  err_unreg:
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
        list_del(&p_dev->socket_device_list);
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
 
  err_free:
+       mutex_lock(&s->ops_mutex);
+       s->device_count--;
+       mutex_unlock(&s->ops_mutex);
+
+       for (i = 0; i < 4; i++)
+               kfree(p_dev->prod_id[i]);
        kfree(p_dev->devname);
        kfree(p_dev);
-       s->device_count--;
  err_put:
        mutex_unlock(&device_add_lock);
        pcmcia_put_socket(s);
@@ -601,19 +598,23 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
 {
        cistpl_longlink_mfc_t mfc;
        unsigned int no_funcs, i, no_chains;
-       int ret = 0;
+       int ret = -EAGAIN;
 
+       mutex_lock(&s->ops_mutex);
        if (!(s->resource_setup_done)) {
                dev_dbg(&s->dev,
                           "no resources available, delaying card_add\n");
+               mutex_unlock(&s->ops_mutex);
                return -EAGAIN; /* try again, but later... */
        }
 
        if (pcmcia_validate_mem(s)) {
                dev_dbg(&s->dev, "validating mem resources failed, "
                       "delaying card_add\n");
+               mutex_unlock(&s->ops_mutex);
                return -EAGAIN; /* try again, but later... */
        }
+       mutex_unlock(&s->ops_mutex);
 
        ret = pccard_validate_cis(s, &no_chains);
        if (ret || !no_chains) {
@@ -634,17 +635,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
 }
 
 
-static void pcmcia_delayed_add_device(struct work_struct *work)
-{
-       struct pcmcia_socket *s =
-               container_of(work, struct pcmcia_socket, device_add);
-       dev_dbg(&s->dev, "adding additional device to %d\n", s->sock);
-       pcmcia_device_add(s, s->pcmcia_state.mfc_pfc);
-       s->pcmcia_state.device_add_pending = 0;
-       s->pcmcia_state.mfc_pfc = 0;
-}
-
-static int pcmcia_requery(struct device *dev, void * _data)
+static int pcmcia_requery_callback(struct device *dev, void * _data)
 {
        struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
        if (!p_dev->dev.driver) {
@@ -655,45 +646,67 @@ static int pcmcia_requery(struct device *dev, void * _data)
        return 0;
 }
 
-static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
-{
-       int no_devices = 0;
-       int ret = 0;
-       unsigned long flags;
 
-       /* must be called with skt_mutex held */
-       dev_dbg(&skt->dev, "re-scanning socket %d\n", skt->sock);
+static void pcmcia_requery(struct pcmcia_socket *s)
+{
+       int present, has_pfc;
 
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
-       if (list_empty(&skt->devices_list))
-               no_devices = 1;
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
+       present = s->pcmcia_state.present;
+       mutex_unlock(&s->ops_mutex);
 
-       /* If this is because of a CIS override, start over */
-       if (new_cis && !no_devices)
-               pcmcia_card_remove(skt, NULL);
+       if (!present)
+               return;
 
-       /* if no devices were added for this socket yet because of
-        * missing resource information or other trouble, we need to
-        * do this now. */
-       if (no_devices || new_cis) {
-               ret = pcmcia_card_add(skt);
-               if (ret)
-                       return;
+       if (s->functions == 0) {
+               pcmcia_card_add(s);
+               return;
        }
 
        /* some device information might have changed because of a CIS
         * update or because we can finally read it correctly... so
         * determine it again, overwriting old values if necessary. */
-       bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery);
+       bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery_callback);
+
+       /* if the CIS changed, we need to check whether the number of
+        * functions changed. */
+       if (s->fake_cis) {
+               int old_funcs, new_funcs;
+               cistpl_longlink_mfc_t mfc;
+
+               /* does this cis override add or remove functions? */
+               old_funcs = s->functions;
+
+               if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC,
+                                       &mfc))
+                       new_funcs = mfc.nfn;
+               else
+                       new_funcs = 1;
+               if (old_funcs > new_funcs) {
+                       pcmcia_card_remove(s, NULL);
+                       pcmcia_card_add(s);
+               } else if (new_funcs > old_funcs) {
+                       s->functions = new_funcs;
+                       pcmcia_device_add(s, 1);
+               }
+       }
+
+       /* If the PCMCIA device consists of two pseudo devices,
+        * call pcmcia_device_add() -- which will fail if both
+        * devices are already registered. */
+       mutex_lock(&s->ops_mutex);
+       has_pfc = s->pcmcia_state.has_pfc;
+       mutex_unlock(&s->ops_mutex);
+       if (has_pfc)
+               pcmcia_device_add(s, 0);
 
        /* we re-scan all devices, not just the ones connected to this
         * socket. This does not matter, though. */
-       ret = bus_rescan_devices(&pcmcia_bus_type);
-       if (ret)
-               printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n");
+       if (bus_rescan_devices(&pcmcia_bus_type))
+               dev_warn(&s->dev, "rescanning the bus failed\n");
 }
 
+
 #ifdef CONFIG_PCMCIA_LOAD_CIS
 
 /**
@@ -710,9 +723,6 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
        struct pcmcia_socket *s = dev->socket;
        const struct firmware *fw;
        int ret = -ENOMEM;
-       int no_funcs;
-       int old_funcs;
-       cistpl_longlink_mfc_t mfc;
 
        if (!filename)
                return -EINVAL;
@@ -739,19 +749,8 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
                /* update information */
                pcmcia_device_query(dev);
 
-               /* does this cis override add or remove functions? */
-               old_funcs = s->functions;
-
-               if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc))
-                       no_funcs = mfc.nfn;
-               else
-                       no_funcs = 1;
-               s->functions = no_funcs;
-
-               if (old_funcs > no_funcs)
-                       pcmcia_card_remove(s, dev);
-               else if (no_funcs > old_funcs)
-                       pcmcia_add_device_later(s, 1);
+               /* requery (as number of functions might have changed) */
+               pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY);
        }
  release:
        release_firmware(fw);
@@ -818,9 +817,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
        if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
                if (dev->device_no != did->device_no)
                        return 0;
+               mutex_lock(&dev->socket->ops_mutex);
+               dev->socket->pcmcia_state.has_pfc = 1;
+               mutex_unlock(&dev->socket->ops_mutex);
        }
 
        if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) {
+               int ret;
+
                if ((!dev->has_func_id) || (dev->func_id != did->func_id))
                        return 0;
 
@@ -835,10 +839,15 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
                 * after it has re-checked that there is no possible module
                 * with a prod_id/manf_id/card_id match.
                 */
-               dev_dbg(&dev->dev,
-                       "skipping FUNC_ID match until userspace interaction\n");
-               if (!dev->allow_func_id_match)
+               mutex_lock(&dev->socket->ops_mutex);
+               ret = dev->allow_func_id_match;
+               mutex_unlock(&dev->socket->ops_mutex);
+
+               if (!ret) {
+                       dev_dbg(&dev->dev,
+                               "skipping FUNC_ID match until userspace ACK\n");
                        return 0;
+               }
        }
 
        if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
@@ -859,8 +868,6 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
                        return 0;
        }
 
-       dev_set_drvdata(&dev->dev, did);
-
        return 1;
 }
 
@@ -873,16 +880,16 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
        struct pcmcia_dynid *dynid;
 
        /* match dynamic devices first */
-       spin_lock(&p_drv->dynids.lock);
+       mutex_lock(&p_drv->dynids.lock);
        list_for_each_entry(dynid, &p_drv->dynids.list, node) {
                dev_dbg(dev, "trying to match to %s\n", drv->name);
                if (pcmcia_devmatch(p_dev, &dynid->id)) {
                        dev_dbg(dev, "matched to %s\n", drv->name);
-                       spin_unlock(&p_drv->dynids.lock);
+                       mutex_unlock(&p_drv->dynids.lock);
                        return 1;
                }
        }
-       spin_unlock(&p_drv->dynids.lock);
+       mutex_unlock(&p_drv->dynids.lock);
 
 #ifdef CONFIG_PCMCIA_IOCTL
        /* matching by cardmgr */
@@ -970,13 +977,14 @@ static int runtime_suspend(struct device *dev)
        return rc;
 }
 
-static void runtime_resume(struct device *dev)
+static int runtime_resume(struct device *dev)
 {
        int rc;
 
        down(&dev->sem);
        rc = pcmcia_dev_resume(dev);
        up(&dev->sem);
+       return rc;
 }
 
 /************************ per-device sysfs output ***************************/
@@ -1027,7 +1035,7 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute
        if ((!p_dev->suspended) && !strncmp(buf, "off", 3))
                ret = runtime_suspend(dev);
        else if (p_dev->suspended && !strncmp(buf, "on", 2))
-               runtime_resume(dev);
+               ret = runtime_resume(dev);
 
        return ret ? ret : count;
 }
@@ -1059,19 +1067,14 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
-       int ret;
 
        if (!count)
                return -EINVAL;
 
-       mutex_lock(&p_dev->socket->skt_mutex);
+       mutex_lock(&p_dev->socket->ops_mutex);
        p_dev->allow_func_id_match = 1;
-       mutex_unlock(&p_dev->socket->skt_mutex);
-
-       ret = bus_rescan_devices(&pcmcia_bus_type);
-       if (ret)
-               printk(KERN_INFO "pcmcia: bus_rescan_devices failed after "
-                      "allowing func_id matches\n");
+       mutex_unlock(&p_dev->socket->ops_mutex);
+       pcmcia_parse_uevents(p_dev->socket, PCMCIA_UEVENT_REQUERY);
 
        return count;
 }
@@ -1099,8 +1102,13 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
        struct pcmcia_driver *p_drv = NULL;
        int ret = 0;
 
-       if (p_dev->suspended)
+       mutex_lock(&p_dev->socket->ops_mutex);
+       if (p_dev->suspended) {
+               mutex_unlock(&p_dev->socket->ops_mutex);
                return 0;
+       }
+       p_dev->suspended = 1;
+       mutex_unlock(&p_dev->socket->ops_mutex);
 
        dev_dbg(dev, "suspending\n");
 
@@ -1117,6 +1125,9 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
                                   "pcmcia: device %s (driver %s) did "
                                   "not want to go to sleep (%d)\n",
                                   p_dev->devname, p_drv->drv.name, ret);
+                       mutex_lock(&p_dev->socket->ops_mutex);
+                       p_dev->suspended = 0;
+                       mutex_unlock(&p_dev->socket->ops_mutex);
                        goto out;
                }
        }
@@ -1127,8 +1138,6 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
        }
 
  out:
-       if (!ret)
-               p_dev->suspended = 1;
        return ret;
 }
 
@@ -1139,8 +1148,13 @@ static int pcmcia_dev_resume(struct device *dev)
        struct pcmcia_driver *p_drv = NULL;
        int ret = 0;
 
-       if (!p_dev->suspended)
+       mutex_lock(&p_dev->socket->ops_mutex);
+       if (!p_dev->suspended) {
+               mutex_unlock(&p_dev->socket->ops_mutex);
                return 0;
+       }
+       p_dev->suspended = 0;
+       mutex_unlock(&p_dev->socket->ops_mutex);
 
        dev_dbg(dev, "resuming\n");
 
@@ -1161,8 +1175,6 @@ static int pcmcia_dev_resume(struct device *dev)
                ret = p_drv->resume(p_dev);
 
  out:
-       if (!ret)
-               p_dev->suspended = 0;
        return ret;
 }
 
@@ -1237,13 +1249,22 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
 
        switch (event) {
        case CS_EVENT_CARD_REMOVAL:
+               mutex_lock(&s->ops_mutex);
                s->pcmcia_state.present = 0;
+               mutex_unlock(&s->ops_mutex);
                pcmcia_card_remove(skt, NULL);
                handle_event(skt, event);
+               mutex_lock(&s->ops_mutex);
+               destroy_cis_cache(s);
+               mutex_unlock(&s->ops_mutex);
                break;
 
        case CS_EVENT_CARD_INSERTION:
+               mutex_lock(&s->ops_mutex);
+               s->pcmcia_state.has_pfc = 0;
                s->pcmcia_state.present = 1;
+               destroy_cis_cache(s); /* to be on the safe side... */
+               mutex_unlock(&s->ops_mutex);
                pcmcia_card_add(skt);
                handle_event(skt, event);
                break;
@@ -1251,8 +1272,24 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
        case CS_EVENT_EJECTION_REQUEST:
                break;
 
-       case CS_EVENT_PM_SUSPEND:
        case CS_EVENT_PM_RESUME:
+               if (verify_cis_cache(skt) != 0) {
+                       dev_dbg(&skt->dev, "cis mismatch - different card\n");
+                       /* first, remove the card */
+                       ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
+                       mutex_lock(&s->ops_mutex);
+                       destroy_cis_cache(skt);
+                       kfree(skt->fake_cis);
+                       skt->fake_cis = NULL;
+                       mutex_unlock(&s->ops_mutex);
+                       /* now, add the new card */
+                       ds_event(skt, CS_EVENT_CARD_INSERTION,
+                                CS_EVENT_PRI_LOW);
+               }
+               handle_event(skt, event);
+               break;
+
+       case CS_EVENT_PM_SUSPEND:
        case CS_EVENT_RESET_PHYSICAL:
        case CS_EVENT_CARD_RESET:
        default:
@@ -1275,9 +1312,13 @@ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev)
        if (!p_dev)
                return NULL;
 
+       mutex_lock(&p_dev->socket->ops_mutex);
        if (!p_dev->socket->pcmcia_state.present)
                goto out;
 
+       if (p_dev->socket->pcmcia_state.dead)
+               goto out;
+
        if (p_dev->_removed)
                goto out;
 
@@ -1286,6 +1327,7 @@ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev)
 
        ret = p_dev;
  out:
+       mutex_unlock(&p_dev->socket->ops_mutex);
        pcmcia_put_dev(p_dev);
        return ret;
 }
@@ -1295,7 +1337,8 @@ EXPORT_SYMBOL(pcmcia_dev_present);
 static struct pcmcia_callback pcmcia_bus_callback = {
        .owner = THIS_MODULE,
        .event = ds_event,
-       .requery = pcmcia_bus_rescan,
+       .requery = pcmcia_requery,
+       .validate = pccard_validate_cis,
        .suspend = pcmcia_bus_suspend,
        .resume = pcmcia_bus_resume,
 };
@@ -1313,17 +1356,17 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
                return -ENODEV;
        }
 
-       /*
-        * Ugly. But we want to wait for the socket threads to have started up.
-        * We really should let the drivers themselves drive some of this..
-        */
-       msleep(250);
+       ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
+       if (ret) {
+               dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
+               pcmcia_put_socket(socket);
+               return ret;
+       }
 
 #ifdef CONFIG_PCMCIA_IOCTL
        init_waitqueue_head(&socket->queue);
 #endif
        INIT_LIST_HEAD(&socket->devices_list);
-       INIT_WORK(&socket->device_add, pcmcia_delayed_add_device);
        memset(&socket->pcmcia_state, 0, sizeof(u8));
        socket->device_count = 0;
 
@@ -1345,14 +1388,20 @@ static void pcmcia_bus_remove_socket(struct device *dev,
        if (!socket)
                return;
 
+       mutex_lock(&socket->ops_mutex);
        socket->pcmcia_state.dead = 1;
+       mutex_unlock(&socket->ops_mutex);
+
        pccard_register_pcmcia(socket, NULL);
 
        /* unregister any unbound devices */
        mutex_lock(&socket->skt_mutex);
        pcmcia_card_remove(socket, NULL);
+       release_cis_mem(socket);
        mutex_unlock(&socket->skt_mutex);
 
+       sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr);
+
        pcmcia_put_socket(socket);
 
        return;
@@ -1383,8 +1432,6 @@ static int __init init_pcmcia_bus(void)
 {
        int ret;
 
-       spin_lock_init(&pcmcia_dev_list_lock);
-
        ret = bus_register(&pcmcia_bus_type);
        if (ret < 0) {
                printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret);
index d187ba4c5e0e3b19cabb2a316a9f0a8184379697..89cfddca089a7fea87e2e92dcdcb91aaf14adcae 100644 (file)
@@ -347,7 +347,7 @@ static int __devexit electra_cf_remove(struct of_device *ofdev)
        return 0;
 }
 
-static struct of_device_id electra_cf_match[] = {
+static const struct of_device_id electra_cf_match[] = {
        {
                .compatible   = "electra-cf",
        },
index 622860c689d9d3c095ebb7ab9f7111f3f17f603c..849ef1b5d687c7683244cb32d89cd29663144dde 100644 (file)
@@ -77,8 +77,8 @@
 #define I365_VPP2_5V   0x04    /* Vpp2 = 5.0v */
 #define I365_VPP2_12V  0x08    /* Vpp2 = 12.0v */
 #define I365_VPP1_MASK 0x03    /* Mask for turning off Vpp1 */
-#define I365_VPP1_5V   0x01    /* Vpp2 = 5.0v */
-#define I365_VPP1_12V  0x02    /* Vpp2 = 12.0v */
+#define I365_VPP1_5V   0x01    /* Vpp1 = 5.0v */
+#define I365_VPP1_12V  0x02    /* Vpp1 = 12.0v */
 
 /* Flags for I365_INTCTL */
 #define I365_RING_ENA  0x80
index 26a621c9e2fcb08c7608494f8494c31978552c04..0ece2cd4a85ea9640bd408fe0dc55ebe65a5692e 100644 (file)
@@ -764,7 +764,7 @@ static int __init init_m32r_pcc(void)
        for (i = 0 ; i < pcc_sockets ; i++) {
                socket[i].socket.dev.parent = &pcc_device.dev;
                socket[i].socket.ops = &pcc_operations;
-               socket[i].socket.resource_ops = &pccard_nonstatic_ops;
+               socket[i].socket.resource_ops = &pccard_static_ops;
                socket[i].socket.owner = THIS_MODULE;
                socket[i].number = i;
                ret = pcmcia_register_socket(&socket[i].socket);
index 7f79c4e169ae982175b48899333f686b32397365..61c2159181288e5442381696b1eb60e2eaed8994 100644 (file)
@@ -1233,7 +1233,7 @@ static int __init m8xx_probe(struct of_device *ofdev,
                socket[i].socket.io_offset = 0;
                socket[i].socket.pci_irq = pcmcia_schlvl;
                socket[i].socket.ops = &m8xx_services;
-               socket[i].socket.resource_ops = &pccard_nonstatic_ops;
+               socket[i].socket.resource_ops = &pccard_iodyn_ops;
                socket[i].socket.cb_dev = NULL;
                socket[i].socket.dev.parent = &ofdev->dev;
                socket[i].pcmcia = pcmcia;
@@ -1303,7 +1303,7 @@ static int m8xx_resume(struct platform_device *pdev)
 #define m8xx_resume NULL
 #endif
 
-static struct of_device_id m8xx_pcmcia_match[] = {
+static const struct of_device_id m8xx_pcmcia_match[] = {
        {
         .type = "pcmcia",
         .compatible = "fsl,pq-pcmcia",
index 624442fc0d35ceb7d609be947fb2c7dda2e20d5d..e74bebac26950b2c9d5869c310f835ef99662b64 100644 (file)
@@ -116,13 +116,12 @@ static int o2micro_override(struct yenta_socket *socket)
         * from Eric Still, 02Micro.
         */
        u8 a, b;
+       bool use_speedup;
 
        if (PCI_FUNC(socket->dev->devfn) == 0) {
                a = config_readb(socket, O2_RESERVED1);
                b = config_readb(socket, O2_RESERVED2);
-
-               dev_printk(KERN_INFO, &socket->dev->dev,
-                          "O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
+               dev_dbg(&socket->dev->dev, "O2: 0x94/0xD4: %02x/%02x\n", a, b);
 
                switch (socket->dev->device) {
                /*
@@ -135,23 +134,37 @@ static int o2micro_override(struct yenta_socket *socket)
                case PCI_DEVICE_ID_O2_6812:
                case PCI_DEVICE_ID_O2_6832:
                case PCI_DEVICE_ID_O2_6836:
-               case PCI_DEVICE_ID_O2_6933:
-                       dev_printk(KERN_INFO, &socket->dev->dev,
-                                  "Yenta O2: old bridge, disabling read "
-                                  "prefetch/write burst\n");
-                       config_writeb(socket, O2_RESERVED1,
-                                     a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
-                       config_writeb(socket, O2_RESERVED2,
-                                     b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
+               case PCI_DEVICE_ID_O2_6933:
+                       use_speedup = false;
                        break;
-
                default:
-                       dev_printk(KERN_INFO , &socket->dev->dev,
-                                  "O2: enabling read prefetch/write burst\n");
+                       use_speedup = true;
+                       break;
+               }
+
+               /* the user may override our decision */
+               if (strcasecmp(o2_speedup, "on") == 0)
+                       use_speedup = true;
+               else if (strcasecmp(o2_speedup, "off") == 0)
+                       use_speedup = false;
+               else if (strcasecmp(o2_speedup, "default") != 0)
+                       dev_warn(&socket->dev->dev,
+                               "O2: Unknown parameter, using 'default'");
+
+               if (use_speedup) {
+                       dev_info(&socket->dev->dev,
+                               "O2: enabling read prefetch/write burst\n");
+                       config_writeb(socket, O2_RESERVED1,
+                                     a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                       config_writeb(socket, O2_RESERVED2,
+                                     b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+               } else {
+                       dev_info(&socket->dev->dev,
+                               "O2: disabling read prefetch/write burst\n");
                        config_writeb(socket, O2_RESERVED1,
-                                     a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                                     a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
                        config_writeb(socket, O2_RESERVED2,
-                                     b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                                     b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
                }
        }
 
index 663781d201295b6ec93f59fc62ea39b143380de9..3ef991552398095ddc9de8b7f2505be88108437f 100644 (file)
@@ -71,8 +71,6 @@ struct omap_cf_socket {
 
 #define        POLL_INTERVAL           (2 * HZ)
 
-#define        SZ_2K                   (2 * SZ_1K)
-
 /*--------------------------------------------------------------------------*/
 
 static int omap_cf_ss_init(struct pcmcia_socket *s)
index f73fd5beaa372f05ddd64a8621b6c1786e64c366..13a7132cf6885577bbb096e24e87dd32d3fee754 100644 (file)
@@ -62,16 +62,15 @@ static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s,
                                                unsigned int function)
 {
        struct pcmcia_device *p_dev = NULL;
-       unsigned long flags;
 
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
        list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
                if (p_dev->func == function) {
-                       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+                       mutex_unlock(&s->ops_mutex);
                        return pcmcia_get_dev(p_dev);
                }
        }
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
        return NULL;
 }
 
@@ -169,7 +168,6 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
 {
        struct pcmcia_socket *s;
        int ret = -ENOSYS;
-       unsigned long flags;
 
        down_read(&pcmcia_socket_list_rwsem);
        list_for_each_entry(s, &pcmcia_socket_list, socket_list) {
@@ -182,14 +180,13 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
 
                        /* you can't use the old interface if the new
                         * one was used before */
-                       spin_lock_irqsave(&s->lock, flags);
+                       mutex_lock(&s->ops_mutex);
                        if ((s->resource_setup_new) &&
                            !(s->resource_setup_old)) {
-                               spin_unlock_irqrestore(&s->lock, flags);
+                               mutex_unlock(&s->ops_mutex);
                                continue;
                        } else if (!(s->resource_setup_old))
                                s->resource_setup_old = 1;
-                       spin_unlock_irqrestore(&s->lock, flags);
 
                        switch (adj->Resource) {
                        case RES_MEMORY_RANGE:
@@ -208,10 +205,9 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
                                 * last call to adjust_resource_info, we
                                 * always need to assume this is the latest
                                 * one... */
-                               spin_lock_irqsave(&s->lock, flags);
                                s->resource_setup_done = 1;
-                               spin_unlock_irqrestore(&s->lock, flags);
                        }
+                       mutex_unlock(&s->ops_mutex);
                }
        }
        up_read(&pcmcia_socket_list_rwsem);
@@ -470,7 +466,6 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
        struct pcmcia_driver *p_drv;
        struct pcmcia_device *p_dev;
        int ret = 0;
-       unsigned long flags;
 
        s = pcmcia_get_socket(s);
        if (!s)
@@ -490,7 +485,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
                goto err_put_driver;
        }
 
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
        list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
                if (p_dev->func == bind_info->function) {
                        if ((p_dev->dev.driver == &p_drv->drv)) {
@@ -499,7 +494,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
                                         * registered, and it was registered
                                         * by userspace before, we need to
                                         * return the "instance". */
-                                       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+                                       mutex_unlock(&s->ops_mutex);
                                        bind_info->instance = p_dev;
                                        ret = -EBUSY;
                                        goto err_put_module;
@@ -507,7 +502,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
                                        /* the correct driver managed to bind
                                         * itself magically to the correct
                                         * device. */
-                                       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+                                       mutex_unlock(&s->ops_mutex);
                                        p_dev->cardmgr = p_drv;
                                        ret = 0;
                                        goto err_put_module;
@@ -516,12 +511,12 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
                                /* there's already a device available where
                                 * no device has been bound to yet. So we don't
                                 * need to register a device! */
-                               spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+                               mutex_unlock(&s->ops_mutex);
                                goto rescan;
                        }
                }
        }
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
 
        p_dev = pcmcia_device_add(s, bind_info->function);
        if (!p_dev) {
@@ -578,7 +573,6 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
        dev_node_t *node;
        struct pcmcia_device *p_dev;
        struct pcmcia_driver *p_drv;
-       unsigned long flags;
        int ret = 0;
 
 #ifdef CONFIG_CARDBUS
@@ -617,7 +611,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
        }
 #endif
 
-       spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
+       mutex_lock(&s->ops_mutex);
        list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
                if (p_dev->func == bind_info->function) {
                        p_dev = pcmcia_get_dev(p_dev);
@@ -626,11 +620,11 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
                        goto found;
                }
        }
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
        return -ENODEV;
 
  found:
-       spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+       mutex_unlock(&s->ops_mutex);
 
        p_drv = to_pcmcia_drv(p_dev->dev.driver);
        if (p_drv && !p_dev->_locked) {
@@ -931,16 +925,16 @@ static int ds_ioctl(struct inode *inode, struct file *file,
        ret = pccard_validate_cis(s, &buf->cisinfo.Chains);
        break;
     case DS_SUSPEND_CARD:
-       ret = pcmcia_suspend_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_SUSPEND);
        break;
     case DS_RESUME_CARD:
-       ret = pcmcia_resume_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_RESUME);
        break;
     case DS_EJECT_CARD:
-       err = pcmcia_eject_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_EJECT);
        break;
     case DS_INSERT_CARD:
-       err = pcmcia_insert_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_INSERT);
        break;
     case DS_ACCESS_CONFIGURATION_REGISTER:
        if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) {
index d5db95644b64f69cc5dc61fc47f11a7abc21bc71..b2df04199a2197b353ab074cd3a682f65cb7dfa7 100644 (file)
@@ -43,6 +43,39 @@ module_param(io_speed, int, 0444);
 static u8 pcmcia_used_irq[NR_IRQS];
 #endif
 
+static int pcmcia_adjust_io_region(struct resource *res, unsigned long start,
+                                  unsigned long end, struct pcmcia_socket *s)
+{
+       if (s->resource_ops->adjust_io_region)
+               return s->resource_ops->adjust_io_region(res, start, end, s);
+       return -ENOMEM;
+}
+
+static struct resource *pcmcia_find_io_region(unsigned long base, int num,
+                                             unsigned long align,
+                                             struct pcmcia_socket *s)
+{
+       if (s->resource_ops->find_io)
+               return s->resource_ops->find_io(base, num, align, s);
+       return NULL;
+}
+
+int pcmcia_validate_mem(struct pcmcia_socket *s)
+{
+       if (s->resource_ops->validate_mem)
+               return s->resource_ops->validate_mem(s);
+       /* if there is no callback, we can assume that everything is OK */
+       return 0;
+}
+
+struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
+                                int low, struct pcmcia_socket *s)
+{
+       if (s->resource_ops->find_mem)
+               return s->resource_ops->find_mem(base, num, align, low, s);
+       return NULL;
+}
+
 
 /** alloc_io_space
  *
@@ -158,14 +191,18 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
                return -EINVAL;
 
        s = p_dev->socket;
+
+       mutex_lock(&s->ops_mutex);
        c = p_dev->function_config;
 
        if (!(c->state & CONFIG_LOCKED)) {
                dev_dbg(&s->dev, "Configuration isnt't locked\n");
+               mutex_unlock(&s->ops_mutex);
                return -EACCES;
        }
 
        addr = (c->ConfigBase + reg->Offset) >> 1;
+       mutex_unlock(&s->ops_mutex);
 
        switch (reg->Action) {
        case CS_READ:
@@ -190,6 +227,7 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
                        memreq_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
+       int ret;
 
        wh--;
        if (wh >= MAX_WIN)
@@ -198,12 +236,13 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
                dev_dbg(&s->dev, "failure: requested page is zero\n");
                return -EINVAL;
        }
+       mutex_lock(&s->ops_mutex);
        s->win[wh].card_start = req->CardOffset;
-       if (s->ops->set_mem_map(s, &s->win[wh]) != 0) {
-               dev_dbg(&s->dev, "failed to set_mem_map\n");
-               return -EIO;
-       }
-       return 0;
+       ret = s->ops->set_mem_map(s, &s->win[wh]);
+       if (ret)
+               dev_warn(&s->dev, "failed to set_mem_map\n");
+       mutex_unlock(&s->ops_mutex);
+       return ret;
 } /* pcmcia_map_mem_page */
 EXPORT_SYMBOL(pcmcia_map_mem_page);
 
@@ -219,14 +258,18 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
        config_t *c;
 
        s = p_dev->socket;
+
+       mutex_lock(&s->ops_mutex);
        c = p_dev->function_config;
 
        if (!(s->state & SOCKET_PRESENT)) {
                dev_dbg(&s->dev, "No card present\n");
+               mutex_unlock(&s->ops_mutex);
                return -ENODEV;
        }
        if (!(c->state & CONFIG_LOCKED)) {
                dev_dbg(&s->dev, "Configuration isnt't locked\n");
+               mutex_unlock(&s->ops_mutex);
                return -EACCES;
        }
 
@@ -251,10 +294,12 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
            (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
                if (mod->Vpp1 != mod->Vpp2) {
                        dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n");
+                       mutex_unlock(&s->ops_mutex);
                        return -EINVAL;
                }
                s->socket.Vpp = mod->Vpp1;
                if (s->ops->set_socket(s, &s->socket)) {
+                       mutex_unlock(&s->ops_mutex);
                        dev_printk(KERN_WARNING, &s->dev,
                                   "Unable to set VPP\n");
                        return -EIO;
@@ -262,6 +307,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
        } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
                   (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
                dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
+               mutex_unlock(&s->ops_mutex);
                return -EINVAL;
        }
 
@@ -286,6 +332,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
                        s->ops->set_io_map(s, &io_on);
                }
        }
+       mutex_unlock(&s->ops_mutex);
 
        return 0;
 } /* modify_configuration */
@@ -296,9 +343,11 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
 {
        pccard_io_map io = { 0, 0, 0, 0, 1 };
        struct pcmcia_socket *s = p_dev->socket;
-       config_t *c = p_dev->function_config;
+       config_t *c;
        int i;
 
+       mutex_lock(&s->ops_mutex);
+       c = p_dev->function_config;
        if (p_dev->_locked) {
                p_dev->_locked = 0;
                if (--(s->lock_count) == 0) {
@@ -321,6 +370,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
                                s->ops->set_io_map(s, &io);
                        }
        }
+       mutex_unlock(&s->ops_mutex);
 
        return 0;
 } /* pcmcia_release_configuration */
@@ -337,10 +387,14 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
 static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
-       config_t *c = p_dev->function_config;
+       int ret = -EINVAL;
+       config_t *c;
+
+       mutex_lock(&s->ops_mutex);
+       c = p_dev->function_config;
 
        if (!p_dev->_io)
-               return -EINVAL;
+               goto out;
 
        p_dev->_io = 0;
 
@@ -348,7 +402,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
            (c->io.NumPorts1 != req->NumPorts1) ||
            (c->io.BasePort2 != req->BasePort2) ||
            (c->io.NumPorts2 != req->NumPorts2))
-               return -EINVAL;
+               goto out;
 
        c->state &= ~CONFIG_IO_REQ;
 
@@ -356,28 +410,38 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
        if (req->NumPorts2)
                release_io_space(s, req->BasePort2, req->NumPorts2);
 
-       return 0;
+out:
+       mutex_unlock(&s->ops_mutex);
+
+       return ret;
 } /* pcmcia_release_io */
 
 
 static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
-       config_t *c = p_dev->function_config;
+       config_t *c;
+       int ret = -EINVAL;
+
+       mutex_lock(&s->ops_mutex);
+
+       c = p_dev->function_config;
 
        if (!p_dev->_irq)
-               return -EINVAL;
+               goto out;
+
        p_dev->_irq = 0;
 
        if (c->state & CONFIG_LOCKED)
-               return -EACCES;
+               goto out;
+
        if (c->irq.Attributes != req->Attributes) {
                dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n");
-               return -EINVAL;
+               goto out;
        }
        if (s->irq.AssignedIRQ != req->AssignedIRQ) {
                dev_dbg(&s->dev, "IRQ must match assigned one\n");
-               return -EINVAL;
+               goto out;
        }
        if (--s->irq.Config == 0) {
                c->state &= ~CONFIG_IRQ_REQ;
@@ -390,8 +454,12 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
 #ifdef CONFIG_PCMCIA_PROBE
        pcmcia_used_irq[req->AssignedIRQ]--;
 #endif
+       ret = 0;
 
-       return 0;
+out:
+       mutex_unlock(&s->ops_mutex);
+
+       return ret;
 } /* pcmcia_release_irq */
 
 
@@ -404,10 +472,12 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh)
        if (wh >= MAX_WIN)
                return -EINVAL;
 
+       mutex_lock(&s->ops_mutex);
        win = &s->win[wh];
 
        if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) {
                dev_dbg(&s->dev, "not releasing unknown window\n");
+               mutex_unlock(&s->ops_mutex);
                return -EINVAL;
        }
 
@@ -423,6 +493,7 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh)
                win->res = NULL;
        }
        p_dev->_win &= ~CLIENT_WIN_REQ(wh);
+       mutex_unlock(&s->ops_mutex);
 
        return 0;
 } /* pcmcia_release_window */
@@ -445,8 +516,11 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
                dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n");
                return -EINVAL;
        }
+
+       mutex_lock(&s->ops_mutex);
        c = p_dev->function_config;
        if (c->state & CONFIG_LOCKED) {
+               mutex_unlock(&s->ops_mutex);
                dev_dbg(&s->dev, "Configuration is locked\n");
                return -EACCES;
        }
@@ -454,6 +528,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
        /* Do power control.  We don't allow changes in Vcc. */
        s->socket.Vpp = req->Vpp;
        if (s->ops->set_socket(s, &s->socket)) {
+               mutex_unlock(&s->ops_mutex);
                dev_printk(KERN_WARNING, &s->dev,
                           "Unable to set socket state\n");
                return -EINVAL;
@@ -476,6 +551,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
                s->socket.io_irq = 0;
        s->ops->set_socket(s, &s->socket);
        s->lock_count++;
+       mutex_unlock(&s->ops_mutex);
 
        /* Set up CIS configuration registers */
        base = c->ConfigBase = req->ConfigBase;
@@ -524,6 +600,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
 
        /* Configure I/O windows */
        if (c->state & CONFIG_IO_REQ) {
+               mutex_lock(&s->ops_mutex);
                iomap.speed = io_speed;
                for (i = 0; i < MAX_IO_WIN; i++)
                        if (s->io[i].res) {
@@ -542,6 +619,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
                                s->ops->set_io_map(s, &iomap);
                                s->io[i].Config++;
                        }
+               mutex_unlock(&s->ops_mutex);
        }
 
        c->state |= CONFIG_LOCKED;
@@ -560,54 +638,65 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
 {
        struct pcmcia_socket *s = p_dev->socket;
        config_t *c;
+       int ret = -EINVAL;
+
+       mutex_lock(&s->ops_mutex);
 
        if (!(s->state & SOCKET_PRESENT)) {
                dev_dbg(&s->dev, "No card present\n");
-               return -ENODEV;
+               goto out;
        }
 
        if (!req)
-               return -EINVAL;
+               goto out;
+
        c = p_dev->function_config;
        if (c->state & CONFIG_LOCKED) {
                dev_dbg(&s->dev, "Configuration is locked\n");
-               return -EACCES;
+               goto out;
        }
        if (c->state & CONFIG_IO_REQ) {
                dev_dbg(&s->dev, "IO already configured\n");
-               return -EBUSY;
+               goto out;
        }
        if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
                dev_dbg(&s->dev, "bad attribute setting for IO region 1\n");
-               return -EINVAL;
+               goto out;
        }
        if ((req->NumPorts2 > 0) &&
            (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
                dev_dbg(&s->dev, "bad attribute setting for IO region 2\n");
-               return -EINVAL;
+               goto out;
        }
 
        dev_dbg(&s->dev, "trying to allocate resource 1\n");
-       if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
-                          req->NumPorts1, req->IOAddrLines)) {
+       ret = alloc_io_space(s, req->Attributes1, &req->BasePort1,
+                            req->NumPorts1, req->IOAddrLines);
+       if (ret) {
                dev_dbg(&s->dev, "allocation of resource 1 failed\n");
-               return -EBUSY;
+               goto out;
        }
 
        if (req->NumPorts2) {
                dev_dbg(&s->dev, "trying to allocate resource 2\n");
-               if (alloc_io_space(s, req->Attributes2, &req->BasePort2,
-                                  req->NumPorts2, req->IOAddrLines)) {
+               ret = alloc_io_space(s, req->Attributes2, &req->BasePort2,
+                                    req->NumPorts2, req->IOAddrLines);
+               if (ret) {
                        dev_dbg(&s->dev, "allocation of resource 2 failed\n");
                        release_io_space(s, req->BasePort1, req->NumPorts1);
-                       return -EBUSY;
+                       goto out;
                }
        }
 
        c->io = *req;
        c->state |= CONFIG_IO_REQ;
        p_dev->_io = 1;
-       return 0;
+       dev_dbg(&s->dev, "allocating resources succeeded: %d\n", ret);
+
+out:
+       mutex_unlock(&s->ops_mutex);
+
+       return ret;
 } /* pcmcia_request_io */
 EXPORT_SYMBOL(pcmcia_request_io);
 
@@ -636,18 +725,20 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
        int ret = -EINVAL, irq = 0;
        int type;
 
+       mutex_lock(&s->ops_mutex);
+
        if (!(s->state & SOCKET_PRESENT)) {
                dev_dbg(&s->dev, "No card present\n");
-               return -ENODEV;
+               goto out;
        }
        c = p_dev->function_config;
        if (c->state & CONFIG_LOCKED) {
                dev_dbg(&s->dev, "Configuration is locked\n");
-               return -EACCES;
+               goto out;
        }
        if (c->state & CONFIG_IRQ_REQ) {
                dev_dbg(&s->dev, "IRQ already configured\n");
-               return -EBUSY;
+               goto out;
        }
 
        /* Decide what type of interrupt we are registering */
@@ -708,7 +799,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
        if (ret && !s->irq.AssignedIRQ) {
                if (!s->pci_irq) {
                        dev_printk(KERN_INFO, &s->dev, "no IRQ found\n");
-                       return ret;
+                       goto out;
                }
                type = IRQF_SHARED;
                irq = s->pci_irq;
@@ -720,7 +811,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
                if (ret) {
                        dev_printk(KERN_INFO, &s->dev,
                                "request_irq() failed\n");
-                       return ret;
+                       goto out;
                }
        }
 
@@ -743,7 +834,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
        pcmcia_used_irq[irq]++;
 #endif
 
-       return 0;
+       ret = 0;
+out:
+       mutex_unlock(&s->ops_mutex);
+       return ret;
 } /* pcmcia_request_irq */
 EXPORT_SYMBOL(pcmcia_request_irq);
 
@@ -796,6 +890,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
                return -EINVAL;
        }
 
+       mutex_lock(&s->ops_mutex);
        win = &s->win[w];
 
        if (!(s->features & SS_CAP_STATIC_MAP)) {
@@ -803,6 +898,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
                                                      (req->Attributes & WIN_MAP_BELOW_1MB), s);
                if (!win->res) {
                        dev_dbg(&s->dev, "allocating mem region failed\n");
+                       mutex_unlock(&s->ops_mutex);
                        return -EINVAL;
                }
        }
@@ -821,8 +917,10 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
        if (req->Attributes & WIN_USE_WAIT)
                win->flags |= MAP_USE_WAIT;
        win->card_start = 0;
+
        if (s->ops->set_mem_map(s, win) != 0) {
                dev_dbg(&s->dev, "failed to set memory mapping\n");
+               mutex_unlock(&s->ops_mutex);
                return -EIO;
        }
        s->state |= SOCKET_WIN_REQ(w);
@@ -833,6 +931,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
        else
                req->Base = win->res->start;
 
+       mutex_unlock(&s->ops_mutex);
        *wh = w + 1;
 
        return 0;
index 52db17263d8bd9b0b7265040c0a3747ccc7be601..e6f7d410aed618a8f1a80d8bfcdd4715b5cb97da 100644 (file)
 #include <pcmcia/cistpl.h>
 #include "cs_internal.h"
 
-
-int pcmcia_validate_mem(struct pcmcia_socket *s)
-{
-       if (s->resource_ops->validate_mem)
-               return s->resource_ops->validate_mem(s);
-       /* if there is no callback, we can assume that everything is OK */
-       return 0;
-}
-EXPORT_SYMBOL(pcmcia_validate_mem);
-
-int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start,
-                    unsigned long r_end, struct pcmcia_socket *s)
-{
-       if (s->resource_ops->adjust_io_region)
-               return s->resource_ops->adjust_io_region(res, r_start, r_end, s);
-       return -ENOMEM;
-}
-EXPORT_SYMBOL(pcmcia_adjust_io_region);
-
-struct resource *pcmcia_find_io_region(unsigned long base, int num,
-                  unsigned long align, struct pcmcia_socket *s)
-{
-       if (s->resource_ops->find_io)
-               return s->resource_ops->find_io(base, num, align, s);
-       return NULL;
-}
-EXPORT_SYMBOL(pcmcia_find_io_region);
-
-struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
-                                int low, struct pcmcia_socket *s)
-{
-       if (s->resource_ops->find_mem)
-               return s->resource_ops->find_mem(base, num, align, low, s);
-       return NULL;
-}
-EXPORT_SYMBOL(pcmcia_find_mem_region);
-
-void release_resource_db(struct pcmcia_socket *s)
-{
-       if (s->resource_ops->exit)
-               s->resource_ops->exit(s);
-}
-
-
 static int static_init(struct pcmcia_socket *s)
 {
-       unsigned long flags;
-
        /* the good thing about SS_CAP_STATIC_MAP sockets is
         * that they don't need a resource database */
 
-       spin_lock_irqsave(&s->lock, flags);
        s->resource_setup_done = 1;
-       spin_unlock_irqrestore(&s->lock, flags);
 
        return 0;
 }
@@ -114,22 +66,21 @@ struct pcmcia_align_data {
        unsigned long   offset;
 };
 
-static void pcmcia_align(void *align_data, struct resource *res,
-                       unsigned long size, unsigned long align)
+static resource_size_t pcmcia_align(void *align_data,
+                               const struct resource *res,
+                               resource_size_t size, resource_size_t align)
 {
        struct pcmcia_align_data *data = align_data;
-       unsigned long start;
+       resource_size_t start;
 
        start = (res->start & ~data->mask) + data->offset;
        if (start < res->start)
                start += data->mask + 1;
-       res->start = start;
 
 #ifdef CONFIG_X86
        if (res->flags & IORESOURCE_IO) {
                if (start & 0x300) {
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
                }
        }
 #endif
@@ -137,9 +88,11 @@ static void pcmcia_align(void *align_data, struct resource *res,
 #ifdef CONFIG_M68K
        if (res->flags & IORESOURCE_IO) {
                if ((res->start + size - 1) >= 1024)
-                       res->start = res->end;
+                       start = res->end;
        }
 #endif
+
+       return start;
 }
 
 
index 9b0dc433a8c3a6953f223dd6160adbdc22db5b20..4663b3fa9f9616a66db5214fc6f5ef16c1b37dc0 100644 (file)
@@ -55,11 +55,10 @@ struct resource_map {
 
 struct socket_data {
        struct resource_map             mem_db;
+       struct resource_map             mem_db_valid;
        struct resource_map             io_db;
-       unsigned int                    rsrc_mem_probe;
 };
 
-static DEFINE_MUTEX(rsrc_mutex);
 #define MEM_PROBE_LOW  (1 << 0)
 #define MEM_PROBE_HIGH (1 << 1)
 
@@ -125,8 +124,10 @@ static int add_interval(struct resource_map *map, u_long base, u_long num)
        struct resource_map *p, *q;
 
        for (p = map; ; p = p->next) {
-               if ((p != map) && (p->base+p->num-1 >= base))
-                       return -1;
+               if ((p != map) && (p->base+p->num >= base)) {
+                       p->num = max(num + base - p->base, p->num);
+                       return 0;
+               }
                if ((p->next == map) || (p->next->base > base+num-1))
                        break;
        }
@@ -264,36 +265,44 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
 }
 #endif
 
-/*======================================================================
-
-    This is tricky... when we set up CIS memory, we try to validate
-    the memory window space allocations.
-
-======================================================================*/
+/*======================================================================*/
 
-/* Validation function for cards with a valid CIS */
+/**
+ * readable() - iomem validation function for cards with a valid CIS
+ */
 static int readable(struct pcmcia_socket *s, struct resource *res,
                    unsigned int *count)
 {
-       int ret = -1;
+       int ret = -EINVAL;
+
+       if (s->fake_cis) {
+               dev_dbg(&s->dev, "fake CIS is being used: can't validate mem\n");
+               return 0;
+       }
 
        s->cis_mem.res = res;
        s->cis_virt = ioremap(res->start, s->map_size);
        if (s->cis_virt) {
-               ret = pccard_validate_cis(s, count);
-               /* invalidate mapping and CIS cache */
+               mutex_unlock(&s->ops_mutex);
+               /* as we're only called from pcmcia.c, we're safe */
+               if (s->callback->validate)
+                       ret = s->callback->validate(s, count);
+               /* invalidate mapping */
+               mutex_lock(&s->ops_mutex);
                iounmap(s->cis_virt);
                s->cis_virt = NULL;
-               destroy_cis_cache(s);
        }
        s->cis_mem.res = NULL;
-       if ((ret != 0) || (*count == 0))
-               return 0;
-       return 1;
+       if ((ret) || (*count == 0))
+               return -EINVAL;
+       return 0;
 }
 
-/* Validation function for simple memory cards */
-static int checksum(struct pcmcia_socket *s, struct resource *res)
+/**
+ * checksum() - iomem validation function for simple memory cards
+ */
+static int checksum(struct pcmcia_socket *s, struct resource *res,
+                   unsigned int *value)
 {
        pccard_mem_map map;
        int i, a = 0, b = -1, d;
@@ -321,61 +330,90 @@ static int checksum(struct pcmcia_socket *s, struct resource *res)
                iounmap(virt);
        }
 
-       return (b == -1) ? -1 : (a>>1);
+       if (b == -1)
+               return -EINVAL;
+
+       *value = a;
+
+       return 0;
 }
 
-static int
-cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size)
+/**
+ * do_validate_mem() - low level validate a memory region for PCMCIA use
+ * @s:         PCMCIA socket to validate
+ * @base:      start address of resource to check
+ * @size:      size of resource to check
+ * @validate:  validation function to use
+ *
+ * do_validate_mem() splits up the memory region which is to be checked
+ * into two parts. Both are passed to the @validate() function. If
+ * @validate() returns non-zero, or the value parameter to @validate()
+ * is zero, or the value parameter is different between both calls,
+ * the check fails, and -EINVAL is returned. Else, 0 is returned.
+ */
+static int do_validate_mem(struct pcmcia_socket *s,
+                          unsigned long base, unsigned long size,
+                          int validate (struct pcmcia_socket *s,
+                                        struct resource *res,
+                                        unsigned int *value))
 {
+       struct socket_data *s_data = s->resource_data;
        struct resource *res1, *res2;
-       unsigned int info1, info2;
-       int ret = 0;
+       unsigned int info1 = 1, info2 = 1;
+       int ret = -EINVAL;
 
        res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "PCMCIA memprobe");
        res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM,
                        "PCMCIA memprobe");
 
        if (res1 && res2) {
-               ret = readable(s, res1, &info1);
-               ret += readable(s, res2, &info2);
+               ret = 0;
+               if (validate) {
+                       ret = validate(s, res1, &info1);
+                       ret += validate(s, res2, &info2);
+               }
        }
 
        free_region(res2);
        free_region(res1);
 
-       return (ret == 2) && (info1 == info2);
-}
-
-static int
-checksum_match(struct pcmcia_socket *s, unsigned long base, unsigned long size)
-{
-       struct resource *res1, *res2;
-       int a = -1, b = -1;
+       dev_dbg(&s->dev, "cs: memory probe 0x%06lx-0x%06lx: %p %p %u %u %u",
+               base, base+size-1, res1, res2, ret, info1, info2);
 
-       res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "PCMCIA memprobe");
-       res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM,
-                       "PCMCIA memprobe");
+       if ((ret) || (info1 != info2) || (info1 == 0))
+               return -EINVAL;
 
-       if (res1 && res2) {
-               a = checksum(s, res1);
-               b = checksum(s, res2);
+       if (validate && !s->fake_cis) {
+               /* move it to the validated data set */
+               add_interval(&s_data->mem_db_valid, base, size);
+               sub_interval(&s_data->mem_db, base, size);
        }
 
-       free_region(res2);
-       free_region(res1);
-
-       return (a == b) && (a >= 0);
+       return 0;
 }
 
-/*======================================================================
-
-    The memory probe.  If the memory list includes a 64K-aligned block
-    below 1MB, we probe in 64K chunks, and as soon as we accumulate at
-    least mem_limit free space, we quit.
 
-======================================================================*/
-
-static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
+/**
+ * do_mem_probe() - validate a memory region for PCMCIA use
+ * @s:         PCMCIA socket to validate
+ * @base:      start address of resource to check
+ * @num:       size of resource to check
+ * @validate:  validation function to use
+ * @fallback:  validation function to use if validate fails
+ *
+ * do_mem_probe() checks a memory region for use by the PCMCIA subsystem.
+ * To do so, the area is split up into sensible parts, and then passed
+ * into the @validate() function. Only if @validate() and @fallback() fail,
+ * the area is marked as unavaibale for use by the PCMCIA subsystem. The
+ * function returns the size of the usable memory area.
+ */
+static int do_mem_probe(struct pcmcia_socket *s, u_long base, u_long num,
+                       int validate (struct pcmcia_socket *s,
+                                     struct resource *res,
+                                     unsigned int *value),
+                       int fallback (struct pcmcia_socket *s,
+                                     struct resource *res,
+                                     unsigned int *value))
 {
        struct socket_data *s_data = s->resource_data;
        u_long i, j, bad, fail, step;
@@ -393,15 +431,14 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
        for (i = j = base; i < base+num; i = j + step) {
                if (!fail) {
                        for (j = i; j < base+num; j += step) {
-                               if (cis_readable(s, j, step))
+                               if (!do_validate_mem(s, j, step, validate))
                                        break;
                        }
                        fail = ((i == base) && (j == base+num));
                }
-               if (fail) {
-                       for (j = i; j < base+num; j += 2*step)
-                               if (checksum_match(s, j, step) &&
-                                       checksum_match(s, j + step, step))
+               if ((fail) && (fallback)) {
+                       for (j = i; j < base+num; j += step)
+                               if (!do_validate_mem(s, j, step, fallback))
                                        break;
                }
                if (i != j) {
@@ -416,8 +453,14 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
        return num - bad;
 }
 
+
 #ifdef CONFIG_PCMCIA_PROBE
 
+/**
+ * inv_probe() - top-to-bottom search for one usuable high memory area
+ * @s:         PCMCIA socket to validate
+ * @m:         resource_map to check
+ */
 static u_long inv_probe(struct resource_map *m, struct pcmcia_socket *s)
 {
        struct socket_data *s_data = s->resource_data;
@@ -432,9 +475,18 @@ static u_long inv_probe(struct resource_map *m, struct pcmcia_socket *s)
        }
        if (m->base < 0x100000)
                return 0;
-       return do_mem_probe(m->base, m->num, s);
+       return do_mem_probe(s, m->base, m->num, readable, checksum);
 }
 
+/**
+ * validate_mem() - memory probe function
+ * @s:         PCMCIA socket to validate
+ * @probe_mask: MEM_PROBE_LOW | MEM_PROBE_HIGH
+ *
+ * The memory probe.  If the memory list includes a 64K-aligned block
+ * below 1MB, we probe in 64K chunks, and as soon as we accumulate at
+ * least mem_limit free space, we quit. Returns 0 on usuable ports.
+ */
 static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
 {
        struct resource_map *m, mm;
@@ -446,6 +498,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
        if (probe_mask & MEM_PROBE_HIGH) {
                if (inv_probe(s_data->mem_db.next, s) > 0)
                        return 0;
+               if (s_data->mem_db_valid.next != &s_data->mem_db_valid)
+                       return 0;
                dev_printk(KERN_NOTICE, &s->dev,
                           "cs: warning: no high memory space available!\n");
                return -ENODEV;
@@ -457,7 +511,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
                if (mm.base >= 0x100000)
                        continue;
                if ((mm.base | mm.num) & 0xffff) {
-                       ok += do_mem_probe(mm.base, mm.num, s);
+                       ok += do_mem_probe(s, mm.base, mm.num, readable,
+                                          checksum);
                        continue;
                }
                /* Special probe for 64K-aligned block */
@@ -467,7 +522,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
                                if (ok >= mem_limit)
                                        sub_interval(&s_data->mem_db, b, 0x10000);
                                else
-                                       ok += do_mem_probe(b, 0x10000, s);
+                                       ok += do_mem_probe(s, b, 0x10000,
+                                                          readable, checksum);
                        }
                }
        }
@@ -480,6 +536,13 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
 
 #else /* CONFIG_PCMCIA_PROBE */
 
+/**
+ * validate_mem() - memory probe function
+ * @s:         PCMCIA socket to validate
+ * @probe_mask: ignored
+ *
+ * Returns 0 on usuable ports.
+ */
 static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
 {
        struct resource_map *m, mm;
@@ -488,7 +551,7 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
 
        for (m = s_data->mem_db.next; m != &s_data->mem_db; m = mm.next) {
                mm = *m;
-               ok += do_mem_probe(mm.base, mm.num, s);
+               ok += do_mem_probe(s, mm.base, mm.num, readable, checksum);
        }
        if (ok > 0)
                return 0;
@@ -498,31 +561,31 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
 #endif /* CONFIG_PCMCIA_PROBE */
 
 
-/*
+/**
+ * pcmcia_nonstatic_validate_mem() - try to validate iomem for PCMCIA use
+ * @s:         PCMCIA socket to validate
+ *
+ * This is tricky... when we set up CIS memory, we try to validate
+ * the memory window space allocations.
+ *
  * Locking note: Must be called with skt_mutex held!
  */
 static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s)
 {
        struct socket_data *s_data = s->resource_data;
        unsigned int probe_mask = MEM_PROBE_LOW;
-       int ret = 0;
+       int ret;
 
-       if (!probe_mem)
+       if (!probe_mem || !(s->state & SOCKET_PRESENT))
                return 0;
 
-       mutex_lock(&rsrc_mutex);
-
        if (s->features & SS_CAP_PAGE_REGS)
                probe_mask = MEM_PROBE_HIGH;
 
-       if (probe_mask & ~s_data->rsrc_mem_probe) {
-               if (s->state & SOCKET_PRESENT)
-                       ret = validate_mem(s, probe_mask);
-               if (!ret)
-                       s_data->rsrc_mem_probe |= probe_mask;
-       }
+       ret = validate_mem(s, probe_mask);
 
-       mutex_unlock(&rsrc_mutex);
+       if (s_data->mem_db_valid.next != &s_data->mem_db_valid)
+               return 0;
 
        return ret;
 }
@@ -533,8 +596,8 @@ struct pcmcia_align_data {
        struct resource_map     *map;
 };
 
-static void
-pcmcia_common_align(void *align_data, struct resource *res,
+static resource_size_t
+pcmcia_common_align(void *align_data, const struct resource *res,
                        resource_size_t size, resource_size_t align)
 {
        struct pcmcia_align_data *data = align_data;
@@ -545,17 +608,18 @@ pcmcia_common_align(void *align_data, struct resource *res,
        start = (res->start & ~data->mask) + data->offset;
        if (start < res->start)
                start += data->mask + 1;
-       res->start = start;
+       return start;
 }
 
-static void
-pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
-               resource_size_t align)
+static resource_size_t
+pcmcia_align(void *align_data, const struct resource *res,
+       resource_size_t size, resource_size_t align)
 {
        struct pcmcia_align_data *data = align_data;
        struct resource_map *m;
+       resource_size_t start;
 
-       pcmcia_common_align(data, res, size, align);
+       start = pcmcia_common_align(data, res, size, align);
 
        for (m = data->map->next; m != data->map; m = m->next) {
                unsigned long start = m->base;
@@ -567,8 +631,7 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
                 * fit here.
                 */
                if (res->start < start) {
-                       res->start = start;
-                       pcmcia_common_align(data, res, size, align);
+                       start = pcmcia_common_align(data, res, size, align);
                }
 
                /*
@@ -586,7 +649,9 @@ pcmcia_align(void *align_data, struct resource *res, resource_size_t size,
         * If we failed to find something suitable, ensure we fail.
         */
        if (m == data->map)
-               res->start = res->end;
+               start = res->end;
+
+       return start;
 }
 
 /*
@@ -600,7 +665,6 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star
        struct socket_data *s_data = s->resource_data;
        int ret = -ENOMEM;
 
-       mutex_lock(&rsrc_mutex);
        for (m = s_data->io_db.next; m != &s_data->io_db; m = m->next) {
                unsigned long start = m->base;
                unsigned long end = m->base + m->num - 1;
@@ -611,7 +675,6 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star
                ret = adjust_resource(res, r_start, r_end - r_start + 1);
                break;
        }
-       mutex_unlock(&rsrc_mutex);
 
        return ret;
 }
@@ -645,7 +708,6 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num,
        data.offset = base & data.mask;
        data.map = &s_data->io_db;
 
-       mutex_lock(&rsrc_mutex);
 #ifdef CONFIG_PCI
        if (s->cb_dev) {
                ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1,
@@ -654,7 +716,6 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num,
 #endif
                ret = allocate_resource(&ioport_resource, res, num, min, ~0UL,
                                        1, pcmcia_align, &data);
-       mutex_unlock(&rsrc_mutex);
 
        if (ret != 0) {
                kfree(res);
@@ -670,15 +731,15 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num,
        struct socket_data *s_data = s->resource_data;
        struct pcmcia_align_data data;
        unsigned long min, max;
-       int ret, i;
+       int ret, i, j;
 
        low = low || !(s->features & SS_CAP_PAGE_REGS);
 
        data.mask = align - 1;
        data.offset = base & data.mask;
-       data.map = &s_data->mem_db;
 
        for (i = 0; i < 2; i++) {
+               data.map = &s_data->mem_db_valid;
                if (low) {
                        max = 0x100000UL;
                        min = base < max ? base : 0;
@@ -687,17 +748,23 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num,
                        min = 0x100000UL + base;
                }
 
-               mutex_lock(&rsrc_mutex);
+               for (j = 0; j < 2; j++) {
 #ifdef CONFIG_PCI
-               if (s->cb_dev) {
-                       ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num,
-                                                    1, min, 0,
-                                                    pcmcia_align, &data);
-               } else
+                       if (s->cb_dev) {
+                               ret = pci_bus_alloc_resource(s->cb_dev->bus,
+                                                       res, num, 1, min, 0,
+                                                       pcmcia_align, &data);
+                       } else
 #endif
-                       ret = allocate_resource(&iomem_resource, res, num, min,
-                                               max, 1, pcmcia_align, &data);
-               mutex_unlock(&rsrc_mutex);
+                       {
+                               ret = allocate_resource(&iomem_resource,
+                                                       res, num, min, max, 1,
+                                                       pcmcia_align, &data);
+                       }
+                       if (ret == 0)
+                               break;
+                       data.map = &s_data->mem_db;
+               }
                if (ret == 0 || low)
                        break;
                low = 1;
@@ -720,25 +787,18 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned
        if (end < start)
                return -EINVAL;
 
-       mutex_lock(&rsrc_mutex);
        switch (action) {
        case ADD_MANAGED_RESOURCE:
                ret = add_interval(&data->mem_db, start, size);
+               if (!ret)
+                       do_mem_probe(s, start, size, NULL, NULL);
                break;
        case REMOVE_MANAGED_RESOURCE:
                ret = sub_interval(&data->mem_db, start, size);
-               if (!ret) {
-                       struct pcmcia_socket *socket;
-                       down_read(&pcmcia_socket_list_rwsem);
-                       list_for_each_entry(socket, &pcmcia_socket_list, socket_list)
-                               release_cis_mem(socket);
-                       up_read(&pcmcia_socket_list_rwsem);
-               }
                break;
        default:
                ret = -EINVAL;
        }
-       mutex_unlock(&rsrc_mutex);
 
        return ret;
 }
@@ -756,7 +816,6 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
        if (end > IO_SPACE_LIMIT)
                return -EINVAL;
 
-       mutex_lock(&rsrc_mutex);
        switch (action) {
        case ADD_MANAGED_RESOURCE:
                if (add_interval(&data->io_db, start, size) != 0) {
@@ -775,7 +834,6 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
                ret = -EINVAL;
                break;
        }
-       mutex_unlock(&rsrc_mutex);
 
        return ret;
 }
@@ -801,8 +859,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
                return -EINVAL;
 #endif
 
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               res = s->cb_dev->bus->resource[i];
+       pci_bus_for_each_resource(s->cb_dev->bus, res, i) {
                if (!res)
                        continue;
 
@@ -859,6 +916,7 @@ static int nonstatic_init(struct pcmcia_socket *s)
                return -ENOMEM;
 
        data->mem_db.next = &data->mem_db;
+       data->mem_db_valid.next = &data->mem_db_valid;
        data->io_db.next = &data->io_db;
 
        s->resource_data = (void *) data;
@@ -873,7 +931,10 @@ static void nonstatic_release_resource_db(struct pcmcia_socket *s)
        struct socket_data *data = s->resource_data;
        struct resource_map *p, *q;
 
-       mutex_lock(&rsrc_mutex);
+       for (p = data->mem_db_valid.next; p != &data->mem_db_valid; p = q) {
+               q = p->next;
+               kfree(p);
+       }
        for (p = data->mem_db.next; p != &data->mem_db; p = q) {
                q = p->next;
                kfree(p);
@@ -882,7 +943,6 @@ static void nonstatic_release_resource_db(struct pcmcia_socket *s)
                q = p->next;
                kfree(p);
        }
-       mutex_unlock(&rsrc_mutex);
 }
 
 
@@ -909,7 +969,7 @@ static ssize_t show_io_db(struct device *dev,
        struct resource_map *p;
        ssize_t ret = 0;
 
-       mutex_lock(&rsrc_mutex);
+       mutex_lock(&s->ops_mutex);
        data = s->resource_data;
 
        for (p = data->io_db.next; p != &data->io_db; p = p->next) {
@@ -921,7 +981,7 @@ static ssize_t show_io_db(struct device *dev,
                                ((unsigned long) p->base + p->num - 1));
        }
 
-       mutex_unlock(&rsrc_mutex);
+       mutex_unlock(&s->ops_mutex);
        return ret;
 }
 
@@ -949,9 +1009,11 @@ static ssize_t store_io_db(struct device *dev,
        if (end_addr < start_addr)
                return -EINVAL;
 
+       mutex_lock(&s->ops_mutex);
        ret = adjust_io(s, add, start_addr, end_addr);
        if (!ret)
                s->resource_setup_new = 1;
+       mutex_unlock(&s->ops_mutex);
 
        return ret ? ret : count;
 }
@@ -965,9 +1027,19 @@ static ssize_t show_mem_db(struct device *dev,
        struct resource_map *p;
        ssize_t ret = 0;
 
-       mutex_lock(&rsrc_mutex);
+       mutex_lock(&s->ops_mutex);
        data = s->resource_data;
 
+       for (p = data->mem_db_valid.next; p != &data->mem_db_valid;
+            p = p->next) {
+               if (ret > (PAGE_SIZE - 10))
+                       continue;
+               ret += snprintf(&buf[ret], (PAGE_SIZE - ret - 1),
+                               "0x%08lx - 0x%08lx\n",
+                               ((unsigned long) p->base),
+                               ((unsigned long) p->base + p->num - 1));
+       }
+
        for (p = data->mem_db.next; p != &data->mem_db; p = p->next) {
                if (ret > (PAGE_SIZE - 10))
                        continue;
@@ -977,7 +1049,7 @@ static ssize_t show_mem_db(struct device *dev,
                                ((unsigned long) p->base + p->num - 1));
        }
 
-       mutex_unlock(&rsrc_mutex);
+       mutex_unlock(&s->ops_mutex);
        return ret;
 }
 
@@ -1005,9 +1077,11 @@ static ssize_t store_mem_db(struct device *dev,
        if (end_addr < start_addr)
                return -EINVAL;
 
+       mutex_lock(&s->ops_mutex);
        ret = adjust_memory(s, add, start_addr, end_addr);
        if (!ret)
                s->resource_setup_new = 1;
+       mutex_unlock(&s->ops_mutex);
 
        return ret ? ret : count;
 }
index 7a456000332a77ada559a04c4c238cdabbc69e6f..08278016e58dde68a2d8526d6b3cf0d6e9c1a9ef 100644 (file)
@@ -88,15 +88,14 @@ static DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL);
 static ssize_t pccard_store_insert(struct device *dev, struct device_attribute *attr,
                                   const char *buf, size_t count)
 {
-       ssize_t ret;
        struct pcmcia_socket *s = to_socket(dev);
 
        if (!count)
                return -EINVAL;
 
-       ret = pcmcia_insert_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_INSERT);
 
-       return ret ? ret : count;
+       return count;
 }
 static DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert);
 
@@ -113,18 +112,22 @@ static ssize_t pccard_store_card_pm_state(struct device *dev,
                                          struct device_attribute *attr,
                                          const char *buf, size_t count)
 {
-       ssize_t ret = -EINVAL;
        struct pcmcia_socket *s = to_socket(dev);
+       ssize_t ret = count;
 
        if (!count)
                return -EINVAL;
 
-       if (!(s->state & SOCKET_SUSPEND) && !strncmp(buf, "off", 3))
-               ret = pcmcia_suspend_card(s);
-       else if ((s->state & SOCKET_SUSPEND) && !strncmp(buf, "on", 2))
-               ret = pcmcia_resume_card(s);
+       if (!strncmp(buf, "off", 3))
+               pcmcia_parse_uevents(s, PCMCIA_UEVENT_SUSPEND);
+       else {
+               if (!strncmp(buf, "on", 2))
+                       pcmcia_parse_uevents(s, PCMCIA_UEVENT_RESUME);
+               else
+                       ret = -EINVAL;
+       }
 
-       return ret ? -ENODEV : count;
+       return ret;
 }
 static DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state);
 
@@ -132,15 +135,14 @@ static ssize_t pccard_store_eject(struct device *dev,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       ssize_t ret;
        struct pcmcia_socket *s = to_socket(dev);
 
        if (!count)
                return -EINVAL;
 
-       ret = pcmcia_eject_card(s);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_EJECT);
 
-       return ret ? ret : count;
+       return count;
 }
 static DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject);
 
@@ -167,7 +169,9 @@ static ssize_t pccard_store_irq_mask(struct device *dev,
        ret = sscanf(buf, "0x%x\n", &mask);
 
        if (ret == 1) {
+               mutex_lock(&s->ops_mutex);
                s->irq_mask &= mask;
+               mutex_unlock(&s->ops_mutex);
                ret = 0;
        }
 
@@ -187,163 +191,21 @@ static ssize_t pccard_store_resource(struct device *dev,
                                     struct device_attribute *attr,
                                     const char *buf, size_t count)
 {
-       unsigned long flags;
        struct pcmcia_socket *s = to_socket(dev);
 
        if (!count)
                return -EINVAL;
 
-       spin_lock_irqsave(&s->lock, flags);
+       mutex_lock(&s->ops_mutex);
        if (!s->resource_setup_done)
                s->resource_setup_done = 1;
-       spin_unlock_irqrestore(&s->lock, flags);
-
-       mutex_lock(&s->skt_mutex);
-       if ((s->callback) &&
-           (s->state & SOCKET_PRESENT) &&
-           !(s->state & SOCKET_CARDBUS)) {
-               if (try_module_get(s->callback->owner)) {
-                       s->callback->requery(s, 0);
-                       module_put(s->callback->owner);
-               }
-       }
-       mutex_unlock(&s->skt_mutex);
-
-       return count;
-}
-static DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource);
+       mutex_unlock(&s->ops_mutex);
 
-
-static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count)
-{
-       tuple_t tuple;
-       int status, i;
-       loff_t pointer = 0;
-       ssize_t ret = 0;
-       u_char *tuplebuffer;
-       u_char *tempbuffer;
-
-       tuplebuffer = kmalloc(sizeof(u_char) * 256, GFP_KERNEL);
-       if (!tuplebuffer)
-               return -ENOMEM;
-
-       tempbuffer = kmalloc(sizeof(u_char) * 258, GFP_KERNEL);
-       if (!tempbuffer) {
-               ret = -ENOMEM;
-               goto free_tuple;
-       }
-
-       memset(&tuple, 0, sizeof(tuple_t));
-
-       tuple.Attributes = TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON;
-       tuple.DesiredTuple = RETURN_FIRST_TUPLE;
-       tuple.TupleOffset = 0;
-
-       status = pccard_get_first_tuple(s, BIND_FN_ALL, &tuple);
-       while (!status) {
-               tuple.TupleData = tuplebuffer;
-               tuple.TupleDataMax = 255;
-               memset(tuplebuffer, 0, sizeof(u_char) * 255);
-
-               status = pccard_get_tuple_data(s, &tuple);
-               if (status)
-                       break;
-
-               if (off < (pointer + 2 + tuple.TupleDataLen)) {
-                       tempbuffer[0] = tuple.TupleCode & 0xff;
-                       tempbuffer[1] = tuple.TupleLink & 0xff;
-                       for (i = 0; i < tuple.TupleDataLen; i++)
-                               tempbuffer[i + 2] = tuplebuffer[i] & 0xff;
-
-                       for (i = 0; i < (2 + tuple.TupleDataLen); i++) {
-                               if (((i + pointer) >= off) &&
-                                   (i + pointer) < (off + count)) {
-                                       buf[ret] = tempbuffer[i];
-                                       ret++;
-                               }
-                       }
-               }
-
-               pointer += 2 + tuple.TupleDataLen;
-
-               if (pointer >= (off + count))
-                       break;
-
-               if (tuple.TupleCode == CISTPL_END)
-                       break;
-               status = pccard_get_next_tuple(s, BIND_FN_ALL, &tuple);
-       }
-
-       kfree(tempbuffer);
- free_tuple:
-       kfree(tuplebuffer);
-
-       return ret;
-}
-
-static ssize_t pccard_show_cis(struct kobject *kobj,
-                              struct bin_attribute *bin_attr,
-                              char *buf, loff_t off, size_t count)
-{
-       unsigned int size = 0x200;
-
-       if (off >= size)
-               count = 0;
-       else {
-               struct pcmcia_socket *s;
-               unsigned int chains;
-
-               if (off + count > size)
-                       count = size - off;
-
-               s = to_socket(container_of(kobj, struct device, kobj));
-
-               if (!(s->state & SOCKET_PRESENT))
-                       return -ENODEV;
-               if (pccard_validate_cis(s, &chains))
-                       return -EIO;
-               if (!chains)
-                       return -ENODATA;
-
-               count = pccard_extract_cis(s, buf, off, count);
-       }
-
-       return count;
-}
-
-static ssize_t pccard_store_cis(struct kobject *kobj,
-                               struct bin_attribute *bin_attr,
-                               char *buf, loff_t off, size_t count)
-{
-       struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj));
-       int error;
-
-       if (off)
-               return -EINVAL;
-
-       if (count >= CISTPL_MAX_CIS_SIZE)
-               return -EINVAL;
-
-       if (!(s->state & SOCKET_PRESENT))
-               return -ENODEV;
-
-       error = pcmcia_replace_cis(s, buf, count);
-       if (error)
-               return -EIO;
-
-       mutex_lock(&s->skt_mutex);
-       if ((s->callback) && (s->state & SOCKET_PRESENT) &&
-           !(s->state & SOCKET_CARDBUS)) {
-               if (try_module_get(s->callback->owner)) {
-                       s->callback->requery(s, 1);
-                       module_put(s->callback->owner);
-               }
-       }
-       mutex_unlock(&s->skt_mutex);
+       pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY);
 
        return count;
 }
-
+static DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource);
 
 static struct attribute *pccard_socket_attributes[] = {
        &dev_attr_card_type.attr,
@@ -362,28 +224,12 @@ static const struct attribute_group socket_attrs = {
        .attrs = pccard_socket_attributes,
 };
 
-static struct bin_attribute pccard_cis_attr = {
-       .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
-       .size = 0x200,
-       .read = pccard_show_cis,
-       .write = pccard_store_cis,
-};
-
 int pccard_sysfs_add_socket(struct device *dev)
 {
-       int ret = 0;
-
-       ret = sysfs_create_group(&dev->kobj, &socket_attrs);
-       if (!ret) {
-               ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
-               if (ret)
-                       sysfs_remove_group(&dev->kobj, &socket_attrs);
-       }
-       return ret;
+       return sysfs_create_group(&dev->kobj, &socket_attrs);
 }
 
 void pccard_sysfs_remove_socket(struct device *dev)
 {
-       sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr);
        sysfs_remove_group(&dev->kobj, &socket_attrs);
 }
diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c
new file mode 100644 (file)
index 0000000..61560cd
--- /dev/null
@@ -0,0 +1,350 @@
+/*
+ * PCMCIA socket code for the MyCable XXS1500 system.
+ *
+ * Copyright (c) 2009 Manuel Lauss <manuel.lauss@gmail.com>
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
+#include <linux/resource.h>
+#include <linux/spinlock.h>
+
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/ss.h>
+#include <pcmcia/cistpl.h>
+
+#include <asm/irq.h>
+#include <asm/system.h>
+#include <asm/mach-au1x00/au1000.h>
+
+#define MEM_MAP_SIZE   0x400000
+#define IO_MAP_SIZE    0x1000
+
+
+/*
+ * 3.3V cards only; all interfacing is done via gpios:
+ *
+ * 0/1:  carddetect (00 = card present, xx = huh)
+ * 4:   card irq
+ * 204:  reset (high-act)
+ * 205:  buffer enable (low-act)
+ * 208/209: card voltage key (00,01,10,11)
+ * 210:  battwarn
+ * 211:  batdead
+ * 214:  power (low-act)
+ */
+#define GPIO_CDA       0
+#define GPIO_CDB       1
+#define GPIO_CARDIRQ   4
+#define GPIO_RESET     204
+#define GPIO_OUTEN     205
+#define GPIO_VSL       208
+#define GPIO_VSH       209
+#define GPIO_BATTDEAD  210
+#define GPIO_BATTWARN  211
+#define GPIO_POWER     214
+
+struct xxs1500_pcmcia_sock {
+       struct pcmcia_socket    socket;
+       void            *virt_io;
+
+       phys_addr_t     phys_io;
+       phys_addr_t     phys_attr;
+       phys_addr_t     phys_mem;
+
+       /* previous flags for set_socket() */
+       unsigned int old_flags;
+};
+
+#define to_xxs_socket(x) container_of(x, struct xxs1500_pcmcia_sock, socket)
+
+static irqreturn_t cdirq(int irq, void *data)
+{
+       struct xxs1500_pcmcia_sock *sock = data;
+
+       pcmcia_parse_events(&sock->socket, SS_DETECT);
+
+       return IRQ_HANDLED;
+}
+
+static int xxs1500_pcmcia_configure(struct pcmcia_socket *skt,
+                                   struct socket_state_t *state)
+{
+       struct xxs1500_pcmcia_sock *sock = to_xxs_socket(skt);
+       unsigned int changed;
+
+       /* power control */
+       switch (state->Vcc) {
+       case 0:
+               gpio_set_value(GPIO_POWER, 1);  /* power off */
+               break;
+       case 33:
+               gpio_set_value(GPIO_POWER, 0);  /* power on */
+               break;
+       case 50:
+       default:
+               return -EINVAL;
+       }
+
+       changed = state->flags ^ sock->old_flags;
+
+       if (changed & SS_RESET) {
+               if (state->flags & SS_RESET) {
+                       gpio_set_value(GPIO_RESET, 1);  /* assert reset */
+                       gpio_set_value(GPIO_OUTEN, 1);  /* buffers off */
+               } else {
+                       gpio_set_value(GPIO_RESET, 0);  /* deassert reset */
+                       gpio_set_value(GPIO_OUTEN, 0);  /* buffers on */
+                       msleep(500);
+               }
+       }
+
+       sock->old_flags = state->flags;
+
+       return 0;
+}
+
+static int xxs1500_pcmcia_get_status(struct pcmcia_socket *skt,
+                                    unsigned int *value)
+{
+       unsigned int status;
+       int i;
+
+       status = 0;
+
+       /* check carddetects: GPIO[0:1] must both be low */
+       if (!gpio_get_value(GPIO_CDA) && !gpio_get_value(GPIO_CDB))
+               status |= SS_DETECT;
+
+       /* determine card voltage: GPIO[208:209] binary value */
+       i = (!!gpio_get_value(GPIO_VSL)) | ((!!gpio_get_value(GPIO_VSH)) << 1);
+
+       switch (i) {
+       case 0:
+       case 1:
+       case 2:
+               status |= SS_3VCARD;    /* 3V card */
+               break;
+       case 3:                         /* 5V card, unsupported */
+       default:
+               status |= SS_XVCARD;    /* treated as unsupported in core */
+       }
+
+       /* GPIO214: low active power switch */
+       status |= gpio_get_value(GPIO_POWER) ? 0 : SS_POWERON;
+
+       /* GPIO204: high-active reset line */
+       status |= gpio_get_value(GPIO_RESET) ? SS_RESET : SS_READY;
+
+       /* other stuff */
+       status |= gpio_get_value(GPIO_BATTDEAD) ? 0 : SS_BATDEAD;
+       status |= gpio_get_value(GPIO_BATTWARN) ? 0 : SS_BATWARN;
+
+       *value = status;
+
+       return 0;
+}
+
+static int xxs1500_pcmcia_sock_init(struct pcmcia_socket *skt)
+{
+       gpio_direction_input(GPIO_CDA);
+       gpio_direction_input(GPIO_CDB);
+       gpio_direction_input(GPIO_VSL);
+       gpio_direction_input(GPIO_VSH);
+       gpio_direction_input(GPIO_BATTDEAD);
+       gpio_direction_input(GPIO_BATTWARN);
+       gpio_direction_output(GPIO_RESET, 1);   /* assert reset */
+       gpio_direction_output(GPIO_OUTEN, 1);   /* disable buffers */
+       gpio_direction_output(GPIO_POWER, 1);   /* power off */
+
+       return 0;
+}
+
+static int xxs1500_pcmcia_sock_suspend(struct pcmcia_socket *skt)
+{
+       return 0;
+}
+
+static int au1x00_pcmcia_set_io_map(struct pcmcia_socket *skt,
+                                   struct pccard_io_map *map)
+{
+       struct xxs1500_pcmcia_sock *sock = to_xxs_socket(skt);
+
+       map->start = (u32)sock->virt_io;
+       map->stop = map->start + IO_MAP_SIZE;
+
+       return 0;
+}
+
+static int au1x00_pcmcia_set_mem_map(struct pcmcia_socket *skt,
+                                    struct pccard_mem_map *map)
+{
+       struct xxs1500_pcmcia_sock *sock = to_xxs_socket(skt);
+
+       if (map->flags & MAP_ATTRIB)
+               map->static_start = sock->phys_attr + map->card_start;
+       else
+               map->static_start = sock->phys_mem + map->card_start;
+
+       return 0;
+}
+
+static struct pccard_operations xxs1500_pcmcia_operations = {
+       .init                   = xxs1500_pcmcia_sock_init,
+       .suspend                = xxs1500_pcmcia_sock_suspend,
+       .get_status             = xxs1500_pcmcia_get_status,
+       .set_socket             = xxs1500_pcmcia_configure,
+       .set_io_map             = au1x00_pcmcia_set_io_map,
+       .set_mem_map            = au1x00_pcmcia_set_mem_map,
+};
+
+static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev)
+{
+       struct xxs1500_pcmcia_sock *sock;
+       struct resource *r;
+       int ret, irq;
+
+       sock = kzalloc(sizeof(struct xxs1500_pcmcia_sock), GFP_KERNEL);
+       if (!sock)
+               return -ENOMEM;
+
+       ret = -ENODEV;
+
+       /*
+        * pseudo-attr:  The 32bit address of the PCMCIA attribute space
+        * for this socket (usually the 36bit address shifted 4 to the
+        * right).
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-attr");
+       if (!r) {
+               dev_err(&pdev->dev, "missing 'pcmcia-attr' resource!\n");
+               goto out0;
+       }
+       sock->phys_attr = r->start;
+
+       /*
+        * pseudo-mem:  The 32bit address of the PCMCIA memory space for
+        * this socket (usually the 36bit address shifted 4 to the right)
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-mem");
+       if (!r) {
+               dev_err(&pdev->dev, "missing 'pcmcia-mem' resource!\n");
+               goto out0;
+       }
+       sock->phys_mem = r->start;
+
+       /*
+        * pseudo-io:  The 32bit address of the PCMCIA IO space for this
+        * socket (usually the 36bit address shifted 4 to the right).
+        */
+       r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-io");
+       if (!r) {
+               dev_err(&pdev->dev, "missing 'pcmcia-io' resource!\n");
+               goto out0;
+       }
+       sock->phys_io = r->start;
+
+
+       /*
+        * PCMCIA client drivers use the inb/outb macros to access
+        * the IO registers.  Since mips_io_port_base is added
+        * to the access address of the mips implementation of
+        * inb/outb, we need to subtract it here because we want
+        * to access the I/O or MEM address directly, without
+        * going through this "mips_io_port_base" mechanism.
+        */
+       sock->virt_io = (void *)(ioremap(sock->phys_io, IO_MAP_SIZE) -
+                                mips_io_port_base);
+
+       if (!sock->virt_io) {
+               dev_err(&pdev->dev, "cannot remap IO area\n");
+               ret = -ENOMEM;
+               goto out0;
+       }
+
+       sock->socket.ops        = &xxs1500_pcmcia_operations;
+       sock->socket.owner      = THIS_MODULE;
+       sock->socket.pci_irq    = gpio_to_irq(GPIO_CARDIRQ);
+       sock->socket.features   = SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
+       sock->socket.map_size   = MEM_MAP_SIZE;
+       sock->socket.io_offset  = (unsigned long)sock->virt_io;
+       sock->socket.dev.parent = &pdev->dev;
+       sock->socket.resource_ops = &pccard_static_ops;
+
+       platform_set_drvdata(pdev, sock);
+
+       /* setup carddetect irq: use one of the 2 GPIOs as an
+        * edge detector.
+        */
+       irq = gpio_to_irq(GPIO_CDA);
+       set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
+       ret = request_irq(irq, cdirq, 0, "pcmcia_carddetect", sock);
+       if (ret) {
+               dev_err(&pdev->dev, "cannot setup cd irq\n");
+               goto out1;
+       }
+
+       ret = pcmcia_register_socket(&sock->socket);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to register\n");
+               goto out2;
+       }
+
+       printk(KERN_INFO "MyCable XXS1500 PCMCIA socket services\n");
+
+       return 0;
+
+out2:
+       free_irq(gpio_to_irq(GPIO_CDA), sock);
+out1:
+       iounmap((void *)(sock->virt_io + (u32)mips_io_port_base));
+out0:
+       kfree(sock);
+       return ret;
+}
+
+static int __devexit xxs1500_pcmcia_remove(struct platform_device *pdev)
+{
+       struct xxs1500_pcmcia_sock *sock = platform_get_drvdata(pdev);
+
+       pcmcia_unregister_socket(&sock->socket);
+       free_irq(gpio_to_irq(GPIO_CDA), sock);
+       iounmap((void *)(sock->virt_io + (u32)mips_io_port_base));
+       kfree(sock);
+
+       return 0;
+}
+
+static struct platform_driver xxs1500_pcmcia_socket_driver = {
+       .driver = {
+               .name   = "xxs1500_pcmcia",
+               .owner  = THIS_MODULE,
+       },
+       .probe          = xxs1500_pcmcia_probe,
+       .remove         = __devexit_p(xxs1500_pcmcia_remove),
+};
+
+int __init xxs1500_pcmcia_socket_load(void)
+{
+       return platform_driver_register(&xxs1500_pcmcia_socket_driver);
+}
+
+void  __exit xxs1500_pcmcia_socket_unload(void)
+{
+       platform_driver_unregister(&xxs1500_pcmcia_socket_driver);
+}
+
+module_init(xxs1500_pcmcia_socket_load);
+module_exit(xxs1500_pcmcia_socket_unload);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("PCMCIA Socket Services for MyCable XXS1500 systems");
+MODULE_AUTHOR("Manuel Lauss");
index e4d12acdd525d2a5acb1337f52d2c3a2fc441c9e..b85375f876228883e744d2c23ccc5b4c0667088f 100644 (file)
@@ -37,6 +37,11 @@ static int pwr_irqs_off;
 module_param(pwr_irqs_off, bool, 0644);
 MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!");
 
+static char o2_speedup[] = "default";
+module_param_string(o2_speedup, o2_speedup, sizeof(o2_speedup), 0444);
+MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' "
+       "or 'default' (uses recommended behaviour for the detected bridge)");
+
 #define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args)
 
 /* Don't ask.. */
@@ -649,9 +654,10 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
 static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
                            u32 min)
 {
+       struct resource *root;
        int i;
-       for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
-               struct resource *root = socket->dev->bus->resource[i];
+
+       pci_bus_for_each_resource(socket->dev->bus, root, i) {
                if (!root)
                        continue;
 
index db32c25e360591c7dd232e6463ca00d3001e00ae..6848f213eb5303f66f2e077907d532fa99e698cc 100644 (file)
@@ -79,6 +79,7 @@ config DELL_LAPTOP
        depends on BACKLIGHT_CLASS_DEVICE
        depends on RFKILL || RFKILL = n
        depends on POWER_SUPPLY
+       depends on SERIO_I8042
        default n
        ---help---
        This driver adds support for rfkill and backlight control to Dell
@@ -364,6 +365,7 @@ config EEEPC_LAPTOP
        select HWMON
        select LEDS_CLASS
        select NEW_LEDS
+       select INPUT_SPARSEKMAP
        ---help---
          This driver supports the Fn-Fx keys on Eee PC laptops.
 
index 07d14dfdf0b42f01caab15df68123f023219517c..226b3e93498c45d8f63fc2f67544950a512b20cd 100644 (file)
@@ -934,7 +934,7 @@ static int __devinit acer_backlight_init(struct device *dev)
        acer_backlight_device = bd;
 
        bd->props.power = FB_BLANK_UNBLANK;
-       bd->props.brightness = max_brightness;
+       bd->props.brightness = read_brightness(bd);
        bd->props.max_brightness = max_brightness;
        backlight_update_status(bd);
        return 0;
index ed90082cdf1db82ec7ed9d17782369088590e9b5..8cb20e45bad6b9b8a440255f8affc9e5f42e6bd9 100644 (file)
@@ -34,6 +34,11 @@ struct cmpc_accel {
 #define CMPC_ACCEL_SENSITIVITY_DEFAULT         5
 
 
+#define CMPC_ACCEL_HID         "ACCE0000"
+#define CMPC_TABLET_HID                "TBLT0000"
+#define CMPC_BL_HID            "IPML200"
+#define CMPC_KEYS_HID          "FnBT0000"
+
 /*
  * Generic input device code.
  */
@@ -282,10 +287,9 @@ static int cmpc_accel_remove(struct acpi_device *acpi, int type)
 }
 
 static const struct acpi_device_id cmpc_accel_device_ids[] = {
-       {"ACCE0000", 0},
+       {CMPC_ACCEL_HID, 0},
        {"", 0}
 };
-MODULE_DEVICE_TABLE(acpi, cmpc_accel_device_ids);
 
 static struct acpi_driver cmpc_accel_acpi_driver = {
        .owner = THIS_MODULE,
@@ -366,10 +370,9 @@ static int cmpc_tablet_resume(struct acpi_device *acpi)
 }
 
 static const struct acpi_device_id cmpc_tablet_device_ids[] = {
-       {"TBLT0000", 0},
+       {CMPC_TABLET_HID, 0},
        {"", 0}
 };
-MODULE_DEVICE_TABLE(acpi, cmpc_tablet_device_ids);
 
 static struct acpi_driver cmpc_tablet_acpi_driver = {
        .owner = THIS_MODULE,
@@ -477,17 +480,16 @@ static int cmpc_bl_remove(struct acpi_device *acpi, int type)
        return 0;
 }
 
-static const struct acpi_device_id cmpc_device_ids[] = {
-       {"IPML200", 0},
+static const struct acpi_device_id cmpc_bl_device_ids[] = {
+       {CMPC_BL_HID, 0},
        {"", 0}
 };
-MODULE_DEVICE_TABLE(acpi, cmpc_device_ids);
 
 static struct acpi_driver cmpc_bl_acpi_driver = {
        .owner = THIS_MODULE,
        .name = "cmpc",
        .class = "cmpc",
-       .ids = cmpc_device_ids,
+       .ids = cmpc_bl_device_ids,
        .ops = {
                .add = cmpc_bl_add,
                .remove = cmpc_bl_remove
@@ -540,10 +542,9 @@ static int cmpc_keys_remove(struct acpi_device *acpi, int type)
 }
 
 static const struct acpi_device_id cmpc_keys_device_ids[] = {
-       {"FnBT0000", 0},
+       {CMPC_KEYS_HID, 0},
        {"", 0}
 };
-MODULE_DEVICE_TABLE(acpi, cmpc_keys_device_ids);
 
 static struct acpi_driver cmpc_keys_acpi_driver = {
        .owner = THIS_MODULE,
@@ -607,3 +608,13 @@ static void cmpc_exit(void)
 
 module_init(cmpc_init);
 module_exit(cmpc_exit);
+
+static const struct acpi_device_id cmpc_device_ids[] = {
+       {CMPC_ACCEL_HID, 0},
+       {CMPC_TABLET_HID, 0},
+       {CMPC_BL_HID, 0},
+       {CMPC_KEYS_HID, 0},
+       {"", 0}
+};
+
+MODULE_DEVICE_TABLE(acpi, cmpc_device_ids);
index 1a387e79f71945ac92b6536643ec83ec8398be3e..2740b40aad9b318bbaf289357c197b6294323bf8 100644 (file)
 /*
  * comapl-laptop.c - Compal laptop support.
  *
- * This driver exports a few files in /sys/devices/platform/compal-laptop/:
- *
- *   wlan - wlan subsystem state: contains 0 or 1 (rw)
- *
- *   bluetooth - Bluetooth subsystem state: contains 0 or 1 (rw)
- *
- *   raw - raw value taken from embedded controller register (ro)
- *
- * In addition to these platform device attributes the driver
- * registers itself in the Linux backlight control subsystem and is
- * available to userspace under /sys/class/backlight/compal-laptop/.
+ * The driver registers itself with the rfkill subsystem and
+ * the Linux backlight control subsystem.
  *
  * This driver might work on other laptops produced by Compal. If you
  * want to try it you can pass force=1 as argument to the module which
@@ -51,6 +42,7 @@
 #include <linux/dmi.h>
 #include <linux/backlight.h>
 #include <linux/platform_device.h>
+#include <linux/rfkill.h>
 
 #define COMPAL_DRIVER_VERSION "0.2.6"
 
 #define WLAN_MASK      0x01
 #define BT_MASK        0x02
 
+static struct rfkill *wifi_rfkill;
+static struct rfkill *bt_rfkill;
+static struct platform_device *compal_device;
+
 static int force;
 module_param(force, bool, 0);
 MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
@@ -88,65 +84,75 @@ static int get_lcd_level(void)
        return (int) result;
 }
 
-static int set_wlan_state(int state)
+static int compal_rfkill_set(void *data, bool blocked)
 {
+       unsigned long radio = (unsigned long) data;
        u8 result, value;
 
        ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
 
-       if ((result & KILLSWITCH_MASK) == 0)
-               return -EINVAL;
-       else {
-               if (state)
-                       value = (u8) (result | WLAN_MASK);
-               else
-                       value = (u8) (result & ~WLAN_MASK);
-               ec_write(COMPAL_EC_COMMAND_WIRELESS, value);
-       }
+       if (!blocked)
+               value = (u8) (result | radio);
+       else
+               value = (u8) (result & ~radio);
+       ec_write(COMPAL_EC_COMMAND_WIRELESS, value);
 
        return 0;
 }
 
-static int set_bluetooth_state(int state)
+static void compal_rfkill_poll(struct rfkill *rfkill, void *data)
 {
-       u8 result, value;
+       u8 result;
+       bool hw_blocked;
 
        ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
 
-       if ((result & KILLSWITCH_MASK) == 0)
-               return -EINVAL;
-       else {
-               if (state)
-                       value = (u8) (result | BT_MASK);
-               else
-                       value = (u8) (result & ~BT_MASK);
-               ec_write(COMPAL_EC_COMMAND_WIRELESS, value);
-       }
-
-       return 0;
+       hw_blocked = !(result & KILLSWITCH_MASK);
+       rfkill_set_hw_state(rfkill, hw_blocked);
 }
 
-static int get_wireless_state(int *wlan, int *bluetooth)
+static const struct rfkill_ops compal_rfkill_ops = {
+       .poll = compal_rfkill_poll,
+       .set_block = compal_rfkill_set,
+};
+
+static int setup_rfkill(void)
 {
-       u8 result;
+       int ret;
 
-       ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
+       wifi_rfkill = rfkill_alloc("compal-wifi", &compal_device->dev,
+                               RFKILL_TYPE_WLAN, &compal_rfkill_ops,
+                               (void *) WLAN_MASK);
+       if (!wifi_rfkill)
+               return -ENOMEM;
 
-       if (wlan) {
-               if ((result & KILLSWITCH_MASK) == 0)
-                       *wlan = 0;
-               else
-                       *wlan = result & WLAN_MASK;
-       }
+       ret = rfkill_register(wifi_rfkill);
+       if (ret)
+               goto err_wifi;
 
-       if (bluetooth) {
-               if ((result & KILLSWITCH_MASK) == 0)
-                       *bluetooth = 0;
-               else
-                       *bluetooth = (result & BT_MASK) >> 1;
+       bt_rfkill = rfkill_alloc("compal-bluetooth", &compal_device->dev,
+                               RFKILL_TYPE_BLUETOOTH, &compal_rfkill_ops,
+                               (void *) BT_MASK);
+       if (!bt_rfkill) {
+               ret = -ENOMEM;
+               goto err_allocate_bt;
        }
+       ret = rfkill_register(bt_rfkill);
+       if (ret)
+               goto err_register_bt;
 
        return 0;
+
+err_register_bt:
+       rfkill_destroy(bt_rfkill);
+
+err_allocate_bt:
+       rfkill_unregister(wifi_rfkill);
+
+err_wifi:
+       rfkill_destroy(wifi_rfkill);
+
+       return ret;
 }
 
 /* Backlight device stuff */
@@ -169,86 +175,6 @@ static struct backlight_ops compalbl_ops = {
 
 static struct backlight_device *compalbl_device;
 
-/* Platform device */
-
-static ssize_t show_wlan(struct device *dev,
-       struct device_attribute *attr, char *buf)
-{
-       int ret, enabled;
-
-       ret = get_wireless_state(&enabled, NULL);
-       if (ret < 0)
-               return ret;
-
-       return sprintf(buf, "%i\n", enabled);
-}
-
-static ssize_t show_raw(struct device *dev,
-       struct device_attribute *attr, char *buf)
-{
-       u8 result;
-
-       ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
-
-       return sprintf(buf, "%i\n", result);
-}
-
-static ssize_t show_bluetooth(struct device *dev,
-       struct device_attribute *attr, char *buf)
-{
-       int ret, enabled;
-
-       ret = get_wireless_state(NULL, &enabled);
-       if (ret < 0)
-               return ret;
-
-       return sprintf(buf, "%i\n", enabled);
-}
-
-static ssize_t store_wlan_state(struct device *dev,
-       struct device_attribute *attr, const char *buf, size_t count)
-{
-       int state, ret;
-
-       if (sscanf(buf, "%i", &state) != 1 || (state < 0 || state > 1))
-               return -EINVAL;
-
-       ret = set_wlan_state(state);
-       if (ret < 0)
-               return ret;
-
-       return count;
-}
-
-static ssize_t store_bluetooth_state(struct device *dev,
-       struct device_attribute *attr, const char *buf, size_t count)
-{
-       int state, ret;
-
-       if (sscanf(buf, "%i", &state) != 1 || (state < 0 || state > 1))
-               return -EINVAL;
-
-       ret = set_bluetooth_state(state);
-       if (ret < 0)
-               return ret;
-
-       return count;
-}
-
-static DEVICE_ATTR(bluetooth, 0644, show_bluetooth, store_bluetooth_state);
-static DEVICE_ATTR(wlan, 0644, show_wlan, store_wlan_state);
-static DEVICE_ATTR(raw, 0444, show_raw, NULL);
-
-static struct attribute *compal_attributes[] = {
-       &dev_attr_bluetooth.attr,
-       &dev_attr_wlan.attr,
-       &dev_attr_raw.attr,
-       NULL
-};
-
-static struct attribute_group compal_attribute_group = {
-       .attrs = compal_attributes
-};
 
 static struct platform_driver compal_driver = {
        .driver = {
@@ -257,8 +183,6 @@ static struct platform_driver compal_driver = {
        }
 };
 
-static struct platform_device *compal_device;
-
 /* Initialization */
 
 static int dmi_check_cb(const struct dmi_system_id *id)
@@ -310,6 +234,47 @@ static struct dmi_system_id __initdata compal_dmi_table[] = {
                },
                .callback = dmi_check_cb
        },
+       {
+               .ident = "Dell Mini 9",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 910"),
+               },
+               .callback = dmi_check_cb
+       },
+       {
+               .ident = "Dell Mini 10",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1010"),
+               },
+               .callback = dmi_check_cb
+       },
+       {
+               .ident = "Dell Mini 10v",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1011"),
+               },
+               .callback = dmi_check_cb
+       },
+       {
+               .ident = "Dell Inspiron 11z",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1110"),
+               },
+               .callback = dmi_check_cb
+       },
+       {
+               .ident = "Dell Mini 12",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1210"),
+               },
+               .callback = dmi_check_cb
+       },
+
        { }
 };
 
@@ -348,23 +313,21 @@ static int __init compal_init(void)
 
        ret = platform_device_add(compal_device);
        if (ret)
-               goto fail_platform_device1;
+               goto fail_platform_device;
 
-       ret = sysfs_create_group(&compal_device->dev.kobj,
-               &compal_attribute_group);
+       ret = setup_rfkill();
        if (ret)
-               goto fail_platform_device2;
+               goto fail_rfkill;
 
        printk(KERN_INFO "compal-laptop: driver "COMPAL_DRIVER_VERSION
                " successfully loaded.\n");
 
        return 0;
 
-fail_platform_device2:
-
+fail_rfkill:
        platform_device_del(compal_device);
 
-fail_platform_device1:
+fail_platform_device:
 
        platform_device_put(compal_device);
 
@@ -382,10 +345,13 @@ fail_backlight:
 static void __exit compal_cleanup(void)
 {
 
-       sysfs_remove_group(&compal_device->dev.kobj, &compal_attribute_group);
        platform_device_unregister(compal_device);
        platform_driver_unregister(&compal_driver);
        backlight_device_unregister(compalbl_device);
+       rfkill_unregister(wifi_rfkill);
+       rfkill_destroy(wifi_rfkill);
+       rfkill_unregister(bt_rfkill);
+       rfkill_destroy(bt_rfkill);
 
        printk(KERN_INFO "compal-laptop: driver unloaded.\n");
 }
@@ -403,3 +369,8 @@ MODULE_ALIAS("dmi:*:rnIFL90:rvrREFERENCE:*");
 MODULE_ALIAS("dmi:*:rnIFL91:rvrIFT00:*");
 MODULE_ALIAS("dmi:*:rnJFL92:rvrIFT00:*");
 MODULE_ALIAS("dmi:*:rnIFT00:rvrIFT00:*");
+MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron910:*");
+MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1010:*");
+MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1011:*");
+MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1110:*");
+MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1210:*");
index 3780994dc8f2a533795397cce09aba310d950b0a..b7f4d27059160a3343cdd77a5e1592589f3032a5 100644 (file)
@@ -22,6 +22,8 @@
 #include <linux/rfkill.h>
 #include <linux/power_supply.h>
 #include <linux/acpi.h>
+#include <linux/mm.h>
+#include <linux/i8042.h>
 #include "../../firmware/dcdbas.h"
 
 #define BRIGHTNESS_TOKEN 0x7d
@@ -79,9 +81,73 @@ static const struct dmi_system_id __initdata dell_device_table[] = {
                        DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
                },
        },
+       {
+               .ident = "Dell Computer Corporation",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
+                       DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
+               },
+       },
        { }
 };
 
+static struct dmi_system_id __devinitdata dell_blacklist[] = {
+       /* Supported by compal-laptop */
+       {
+               .ident = "Dell Mini 9",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 910"),
+               },
+       },
+       {
+               .ident = "Dell Mini 10",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1010"),
+               },
+       },
+       {
+               .ident = "Dell Mini 10v",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1011"),
+               },
+       },
+       {
+               .ident = "Dell Inspiron 11z",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1110"),
+               },
+       },
+       {
+               .ident = "Dell Mini 12",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1210"),
+               },
+       },
+       {}
+};
+
+static struct calling_interface_buffer *buffer;
+struct page *bufferpage;
+DEFINE_MUTEX(buffer_mutex);
+
+static int hwswitch_state;
+
+static void get_buffer(void)
+{
+       mutex_lock(&buffer_mutex);
+       memset(buffer, 0, sizeof(struct calling_interface_buffer));
+}
+
+static void release_buffer(void)
+{
+       mutex_unlock(&buffer_mutex);
+}
+
 static void __init parse_da_table(const struct dmi_header *dm)
 {
        /* Final token is a terminator, so we don't want to copy it */
@@ -160,6 +226,8 @@ dell_send_request(struct calling_interface_buffer *buffer, int class,
 /* Derived from information in DellWirelessCtl.cpp:
    Class 17, select 11 is radio control. It returns an array of 32-bit values.
 
+   Input byte 0 = 0: Wireless information
+
    result[0]: return code
    result[1]:
      Bit 0:      Hardware switch supported
@@ -180,33 +248,62 @@ dell_send_request(struct calling_interface_buffer *buffer, int class,
      Bits 20-31: Reserved
    result[2]: NVRAM size in bytes
    result[3]: NVRAM format version number
+
+   Input byte 0 = 2: Wireless switch configuration
+   result[0]: return code
+   result[1]:
+     Bit 0:      Wifi controlled by switch
+     Bit 1:      Bluetooth controlled by switch
+     Bit 2:      WWAN controlled by switch
+     Bits 3-6:   Reserved
+     Bit 7:      Wireless switch config locked
+     Bit 8:      Wifi locator enabled
+     Bits 9-14:  Reserved
+     Bit 15:     Wifi locator setting locked
+     Bits 16-31: Reserved
 */
 
 static int dell_rfkill_set(void *data, bool blocked)
 {
-       struct calling_interface_buffer buffer;
        int disable = blocked ? 1 : 0;
        unsigned long radio = (unsigned long)data;
+       int hwswitch_bit = (unsigned long)data - 1;
+       int ret = 0;
+
+       get_buffer();
+       dell_send_request(buffer, 17, 11);
+
+       /* If the hardware switch controls this radio, and the hardware
+          switch is disabled, don't allow changing the software state */
+       if ((hwswitch_state & BIT(hwswitch_bit)) &&
+           !(buffer->output[1] & BIT(16))) {
+               ret = -EINVAL;
+               goto out;
+       }
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       buffer.input[0] = (1 | (radio<<8) | (disable << 16));
-       dell_send_request(&buffer, 17, 11);
+       buffer->input[0] = (1 | (radio<<8) | (disable << 16));
+       dell_send_request(buffer, 17, 11);
 
-       return 0;
+out:
+       release_buffer();
+       return ret;
 }
 
 static void dell_rfkill_query(struct rfkill *rfkill, void *data)
 {
-       struct calling_interface_buffer buffer;
        int status;
        int bit = (unsigned long)data + 16;
+       int hwswitch_bit = (unsigned long)data - 1;
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       dell_send_request(&buffer, 17, 11);
-       status = buffer.output[1];
+       get_buffer();
+       dell_send_request(buffer, 17, 11);
+       status = buffer->output[1];
+       release_buffer();
 
        rfkill_set_sw_state(rfkill, !!(status & BIT(bit)));
-       rfkill_set_hw_state(rfkill, !(status & BIT(16)));
+
+       if (hwswitch_state & (BIT(hwswitch_bit)))
+               rfkill_set_hw_state(rfkill, !(status & BIT(16)));
 }
 
 static const struct rfkill_ops dell_rfkill_ops = {
@@ -214,15 +311,36 @@ static const struct rfkill_ops dell_rfkill_ops = {
        .query = dell_rfkill_query,
 };
 
+static void dell_update_rfkill(struct work_struct *ignored)
+{
+       if (wifi_rfkill)
+               dell_rfkill_query(wifi_rfkill, (void *)1);
+       if (bluetooth_rfkill)
+               dell_rfkill_query(bluetooth_rfkill, (void *)2);
+       if (wwan_rfkill)
+               dell_rfkill_query(wwan_rfkill, (void *)3);
+}
+static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
+
+
 static int __init dell_setup_rfkill(void)
 {
-       struct calling_interface_buffer buffer;
        int status;
        int ret;
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       dell_send_request(&buffer, 17, 11);
-       status = buffer.output[1];
+       if (dmi_check_system(dell_blacklist)) {
+               printk(KERN_INFO "dell-laptop: Blacklisted hardware detected - "
+                               "not enabling rfkill\n");
+               return 0;
+       }
+
+       get_buffer();
+       dell_send_request(buffer, 17, 11);
+       status = buffer->output[1];
+       buffer->input[0] = 0x2;
+       dell_send_request(buffer, 17, 11);
+       hwswitch_state = buffer->output[1];
+       release_buffer();
 
        if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) {
                wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev,
@@ -298,39 +416,49 @@ static void dell_cleanup_rfkill(void)
 
 static int dell_send_intensity(struct backlight_device *bd)
 {
-       struct calling_interface_buffer buffer;
+       int ret = 0;
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
-       buffer.input[1] = bd->props.brightness;
+       get_buffer();
+       buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN);
+       buffer->input[1] = bd->props.brightness;
 
-       if (buffer.input[0] == -1)
-               return -ENODEV;
+       if (buffer->input[0] == -1) {
+               ret = -ENODEV;
+               goto out;
+       }
 
        if (power_supply_is_system_supplied() > 0)
-               dell_send_request(&buffer, 1, 2);
+               dell_send_request(buffer, 1, 2);
        else
-               dell_send_request(&buffer, 1, 1);
+               dell_send_request(buffer, 1, 1);
 
+out:
+       release_buffer();
        return 0;
 }
 
 static int dell_get_intensity(struct backlight_device *bd)
 {
-       struct calling_interface_buffer buffer;
+       int ret = 0;
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
+       get_buffer();
+       buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN);
 
-       if (buffer.input[0] == -1)
-               return -ENODEV;
+       if (buffer->input[0] == -1) {
+               ret = -ENODEV;
+               goto out;
+       }
 
        if (power_supply_is_system_supplied() > 0)
-               dell_send_request(&buffer, 0, 2);
+               dell_send_request(buffer, 0, 2);
        else
-               dell_send_request(&buffer, 0, 1);
+               dell_send_request(buffer, 0, 1);
 
-       return buffer.output[1];
+out:
+       release_buffer();
+       if (ret)
+               return ret;
+       return buffer->output[1];
 }
 
 static struct backlight_ops dell_ops = {
@@ -338,9 +466,32 @@ static struct backlight_ops dell_ops = {
        .update_status  = dell_send_intensity,
 };
 
+bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
+                             struct serio *port)
+{
+       static bool extended;
+
+       if (str & 0x20)
+               return false;
+
+       if (unlikely(data == 0xe0)) {
+               extended = true;
+               return false;
+       } else if (unlikely(extended)) {
+               switch (data) {
+               case 0x8:
+                       schedule_delayed_work(&dell_rfkill_work,
+                                             round_jiffies_relative(HZ));
+                       break;
+               }
+               extended = false;
+       }
+
+       return false;
+}
+
 static int __init dell_init(void)
 {
-       struct calling_interface_buffer buffer;
        int max_intensity = 0;
        int ret;
 
@@ -366,6 +517,17 @@ static int __init dell_init(void)
        if (ret)
                goto fail_platform_device2;
 
+       /*
+        * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
+        * is passed to SMI handler.
+        */
+       bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32);
+
+       if (!bufferpage)
+               goto fail_buffer;
+       buffer = page_address(bufferpage);
+       mutex_init(&buffer_mutex);
+
        ret = dell_setup_rfkill();
 
        if (ret) {
@@ -373,6 +535,13 @@ static int __init dell_init(void)
                goto fail_rfkill;
        }
 
+       ret = i8042_install_filter(dell_laptop_i8042_filter);
+       if (ret) {
+               printk(KERN_WARNING
+                      "dell-laptop: Unable to install key filter\n");
+               goto fail_filter;
+       }
+
 #ifdef CONFIG_ACPI
        /* In the event of an ACPI backlight being available, don't
         * register the platform controller.
@@ -381,13 +550,13 @@ static int __init dell_init(void)
                return 0;
 #endif
 
-       memset(&buffer, 0, sizeof(struct calling_interface_buffer));
-       buffer.input[0] = find_token_location(BRIGHTNESS_TOKEN);
-
-       if (buffer.input[0] != -1) {
-               dell_send_request(&buffer, 0, 2);
-               max_intensity = buffer.output[3];
+       get_buffer();
+       buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN);
+       if (buffer->input[0] != -1) {
+               dell_send_request(buffer, 0, 2);
+               max_intensity = buffer->output[3];
        }
+       release_buffer();
 
        if (max_intensity) {
                dell_backlight_device = backlight_device_register(
@@ -410,8 +579,12 @@ static int __init dell_init(void)
        return 0;
 
 fail_backlight:
+       i8042_remove_filter(dell_laptop_i8042_filter);
+fail_filter:
        dell_cleanup_rfkill();
 fail_rfkill:
+       free_page((unsigned long)bufferpage);
+fail_buffer:
        platform_device_del(platform_device);
 fail_platform_device2:
        platform_device_put(platform_device);
@@ -424,8 +597,16 @@ fail_platform_driver:
 
 static void __exit dell_exit(void)
 {
+       cancel_delayed_work_sync(&dell_rfkill_work);
+       i8042_remove_filter(dell_laptop_i8042_filter);
        backlight_device_unregister(dell_backlight_device);
        dell_cleanup_rfkill();
+       if (platform_device) {
+               platform_device_del(platform_device);
+               platform_driver_unregister(&platform_driver);
+       }
+       kfree(da_tokens);
+       free_page((unsigned long)buffer);
 }
 
 module_init(dell_init);
@@ -435,3 +616,4 @@ MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
 MODULE_DESCRIPTION("Dell laptop driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*");
+MODULE_ALIAS("dmi:*svnDellComputerCorporation.:*:ct8:*");
index 5838c69b2fb304937da89c53cab090bf6d9a65de..e2be6bb33d9226a66986e8424f3f57f0b7b98c61 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <linux/uaccess.h>
 #include <linux/input.h>
+#include <linux/input/sparse-keymap.h>
 #include <linux/rfkill.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
 #include <linux/leds.h>
+#include <linux/dmi.h>
 
 #define EEEPC_LAPTOP_VERSION   "0.1"
 #define EEEPC_LAPTOP_NAME      "Eee PC Hotkey Driver"
@@ -48,6 +50,14 @@ MODULE_AUTHOR("Corentin Chary, Eric Cooper");
 MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME);
 MODULE_LICENSE("GPL");
 
+static bool hotplug_disabled;
+
+module_param(hotplug_disabled, bool, 0644);
+MODULE_PARM_DESC(hotplug_disabled,
+                "Disable hotplug for wireless device. "
+                "If your laptop need that, please report to "
+                "acpi4asus-user@lists.sourceforge.net.");
+
 /*
  * Definitions for Asus EeePC
  */
@@ -120,38 +130,28 @@ static const char *cm_setv[] = {
        NULL, NULL, "PBPS", "TPDS"
 };
 
-struct key_entry {
-       char type;
-       u8 code;
-       u16 keycode;
-};
-
-enum { KE_KEY, KE_END };
-
 static const struct key_entry eeepc_keymap[] = {
-       /* Sleep already handled via generic ACPI code */
-       {KE_KEY, 0x10, KEY_WLAN },
-       {KE_KEY, 0x11, KEY_WLAN },
-       {KE_KEY, 0x12, KEY_PROG1 },
-       {KE_KEY, 0x13, KEY_MUTE },
-       {KE_KEY, 0x14, KEY_VOLUMEDOWN },
-       {KE_KEY, 0x15, KEY_VOLUMEUP },
-       {KE_KEY, 0x16, KEY_DISPLAY_OFF },
-       {KE_KEY, 0x1a, KEY_COFFEE },
-       {KE_KEY, 0x1b, KEY_ZOOM },
-       {KE_KEY, 0x1c, KEY_PROG2 },
-       {KE_KEY, 0x1d, KEY_PROG3 },
-       {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN },
-       {KE_KEY, NOTIFY_BRN_MAX, KEY_BRIGHTNESSUP },
-       {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
-       {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
-       {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
-       {KE_KEY, 0x37, KEY_F13 }, /* Disable Touchpad */
-       {KE_KEY, 0x38, KEY_F14 },
-       {KE_END, 0},
+       { KE_KEY, 0x10, { KEY_WLAN } },
+       { KE_KEY, 0x11, { KEY_WLAN } },
+       { KE_KEY, 0x12, { KEY_PROG1 } },
+       { KE_KEY, 0x13, { KEY_MUTE } },
+       { KE_KEY, 0x14, { KEY_VOLUMEDOWN } },
+       { KE_KEY, 0x15, { KEY_VOLUMEUP } },
+       { KE_KEY, 0x16, { KEY_DISPLAY_OFF } },
+       { KE_KEY, 0x1a, { KEY_COFFEE } },
+       { KE_KEY, 0x1b, { KEY_ZOOM } },
+       { KE_KEY, 0x1c, { KEY_PROG2 } },
+       { KE_KEY, 0x1d, { KEY_PROG3 } },
+       { KE_KEY, NOTIFY_BRN_MIN, { KEY_BRIGHTNESSDOWN } },
+       { KE_KEY, NOTIFY_BRN_MAX, { KEY_BRIGHTNESSUP } },
+       { KE_KEY, 0x30, { KEY_SWITCHVIDEOMODE } },
+       { KE_KEY, 0x31, { KEY_SWITCHVIDEOMODE } },
+       { KE_KEY, 0x32, { KEY_SWITCHVIDEOMODE } },
+       { KE_KEY, 0x37, { KEY_F13 } }, /* Disable Touchpad */
+       { KE_KEY, 0x38, { KEY_F14 } },
+       { KE_END, 0 },
 };
 
-
 /*
  * This is the main structure, we can use it to store useful information
  */
@@ -159,6 +159,8 @@ struct eeepc_laptop {
        acpi_handle handle;             /* the handle of the acpi device */
        u32 cm_supported;               /* the control methods supported
                                           by this BIOS */
+       bool cpufv_disabled;
+       bool hotplug_disabled;
        u16 event_count[128];           /* count for each event */
 
        struct platform_device *platform_device;
@@ -378,6 +380,8 @@ static ssize_t store_cpufv(struct device *dev,
        struct eeepc_cpufv c;
        int rv, value;
 
+       if (eeepc->cpufv_disabled)
+               return -EPERM;
        if (get_cpufv(eeepc, &c))
                return -ENODEV;
        rv = parse_arg(buf, count, &value);
@@ -389,6 +393,41 @@ static ssize_t store_cpufv(struct device *dev,
        return rv;
 }
 
+static ssize_t show_cpufv_disabled(struct device *dev,
+                         struct device_attribute *attr,
+                         char *buf)
+{
+       struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
+
+       return sprintf(buf, "%d\n", eeepc->cpufv_disabled);
+}
+
+static ssize_t store_cpufv_disabled(struct device *dev,
+                          struct device_attribute *attr,
+                          const char *buf, size_t count)
+{
+       struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
+       int rv, value;
+
+       rv = parse_arg(buf, count, &value);
+       if (rv < 0)
+               return rv;
+
+       switch (value) {
+       case 0:
+               if (eeepc->cpufv_disabled)
+                       pr_warning("cpufv enabled (not officially supported "
+                               "on this model)\n");
+               eeepc->cpufv_disabled = false;
+               return rv;
+       case 1:
+               return -EPERM;
+       default:
+               return -EINVAL;
+       }
+}
+
+
 static struct device_attribute dev_attr_cpufv = {
        .attr = {
                .name = "cpufv",
@@ -404,12 +443,22 @@ static struct device_attribute dev_attr_available_cpufv = {
        .show   = show_available_cpufv
 };
 
+static struct device_attribute dev_attr_cpufv_disabled = {
+       .attr = {
+               .name = "cpufv_disabled",
+               .mode = 0644 },
+       .show   = show_cpufv_disabled,
+       .store  = store_cpufv_disabled
+};
+
+
 static struct attribute *platform_attributes[] = {
        &dev_attr_camera.attr,
        &dev_attr_cardr.attr,
        &dev_attr_disp.attr,
        &dev_attr_cpufv.attr,
        &dev_attr_available_cpufv.attr,
+       &dev_attr_cpufv_disabled.attr,
        NULL
 };
 
@@ -796,6 +845,9 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
        if (result && result != -ENODEV)
                goto exit;
 
+       if (eeepc->hotplug_disabled)
+               return 0;
+
        result = eeepc_setup_pci_hotplug(eeepc);
        /*
         * If we get -EBUSY then something else is handling the PCI hotplug -
@@ -1090,120 +1142,42 @@ static void eeepc_backlight_exit(struct eeepc_laptop *eeepc)
 /*
  * Input device (i.e. hotkeys)
  */
-static struct key_entry *eeepc_get_entry_by_scancode(
-       struct eeepc_laptop *eeepc,
-       int code)
+static int eeepc_input_init(struct eeepc_laptop *eeepc)
 {
-       struct key_entry *key;
+       struct input_dev *input;
+       int error;
 
-       for (key = eeepc->keymap; key->type != KE_END; key++)
-               if (code == key->code)
-                       return key;
-
-       return NULL;
-}
-
-static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event)
-{
-       static struct key_entry *key;
-
-       key = eeepc_get_entry_by_scancode(eeepc, event);
-       if (key) {
-               switch (key->type) {
-               case KE_KEY:
-                       input_report_key(eeepc->inputdev, key->keycode,
-                                               1);
-                       input_sync(eeepc->inputdev);
-                       input_report_key(eeepc->inputdev, key->keycode,
-                                               0);
-                       input_sync(eeepc->inputdev);
-                       break;
-               }
+       input = input_allocate_device();
+       if (!input) {
+               pr_info("Unable to allocate input device\n");
+               return -ENOMEM;
        }
-}
-
-static struct key_entry *eeepc_get_entry_by_keycode(
-       struct eeepc_laptop *eeepc, int code)
-{
-       struct key_entry *key;
-
-       for (key = eeepc->keymap; key->type != KE_END; key++)
-               if (code == key->keycode && key->type == KE_KEY)
-                       return key;
 
-       return NULL;
-}
+       input->name = "Asus EeePC extra buttons";
+       input->phys = EEEPC_LAPTOP_FILE "/input0";
+       input->id.bustype = BUS_HOST;
+       input->dev.parent = &eeepc->platform_device->dev;
 
-static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
-{
-       struct eeepc_laptop *eeepc = input_get_drvdata(dev);
-       struct key_entry *key = eeepc_get_entry_by_scancode(eeepc, scancode);
-
-       if (key && key->type == KE_KEY) {
-               *keycode = key->keycode;
-               return 0;
+       error = sparse_keymap_setup(input, eeepc_keymap, NULL);
+       if (error) {
+               pr_err("Unable to setup input device keymap\n");
+               goto err_free_dev;
        }
 
-       return -EINVAL;
-}
-
-static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode)
-{
-       struct eeepc_laptop *eeepc = input_get_drvdata(dev);
-       struct key_entry *key;
-       int old_keycode;
-
-       if (keycode < 0 || keycode > KEY_MAX)
-               return -EINVAL;
-
-       key = eeepc_get_entry_by_scancode(eeepc, scancode);
-       if (key && key->type == KE_KEY) {
-               old_keycode = key->keycode;
-               key->keycode = keycode;
-               set_bit(keycode, dev->keybit);
-               if (!eeepc_get_entry_by_keycode(eeepc, old_keycode))
-                       clear_bit(old_keycode, dev->keybit);
-               return 0;
+       error = input_register_device(input);
+       if (error) {
+               pr_err("Unable to register input device\n");
+               goto err_free_keymap;
        }
 
-       return -EINVAL;
-}
-
-static int eeepc_input_init(struct eeepc_laptop *eeepc)
-{
-       const struct key_entry *key;
-       int result;
-
-       eeepc->inputdev = input_allocate_device();
-       if (!eeepc->inputdev) {
-               pr_info("Unable to allocate input device\n");
-               return -ENOMEM;
-       }
-       eeepc->inputdev->name = "Asus EeePC extra buttons";
-       eeepc->inputdev->dev.parent = &eeepc->platform_device->dev;
-       eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0";
-       eeepc->inputdev->id.bustype = BUS_HOST;
-       eeepc->inputdev->getkeycode = eeepc_getkeycode;
-       eeepc->inputdev->setkeycode = eeepc_setkeycode;
-       input_set_drvdata(eeepc->inputdev, eeepc);
-
-       eeepc->keymap = kmemdup(eeepc_keymap, sizeof(eeepc_keymap),
-                               GFP_KERNEL);
-       for (key = eeepc_keymap; key->type != KE_END; key++) {
-               switch (key->type) {
-               case KE_KEY:
-                       set_bit(EV_KEY, eeepc->inputdev->evbit);
-                       set_bit(key->keycode, eeepc->inputdev->keybit);
-                       break;
-               }
-       }
-       result = input_register_device(eeepc->inputdev);
-       if (result) {
-               pr_info("Unable to register input device\n");
-               input_free_device(eeepc->inputdev);
-               return result;
-       }
+       eeepc->inputdev = input;
        return 0;
+
+ err_free_keymap:
+       sparse_keymap_free(input);
+ err_free_dev:
+       input_free_device(input);
+       return error;
 }
 
 static void eeepc_input_exit(struct eeepc_laptop *eeepc)
@@ -1253,11 +1227,59 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event)
                                * event will be desired value (or else ignored)
                                */
                        }
-                       eeepc_input_notify(eeepc, event);
+                       sparse_keymap_report_event(eeepc->inputdev, event,
+                                                  1, true);
                }
        } else {
                /* Everything else is a bona-fide keypress event */
-               eeepc_input_notify(eeepc, event);
+               sparse_keymap_report_event(eeepc->inputdev, event, 1, true);
+       }
+}
+
+static void eeepc_dmi_check(struct eeepc_laptop *eeepc)
+{
+       const char *model;
+
+       model = dmi_get_system_info(DMI_PRODUCT_NAME);
+       if (!model)
+               return;
+
+       /*
+        * Blacklist for setting cpufv (cpu speed).
+        *
+        * EeePC 4G ("701") implements CFVS, but it is not supported
+        * by the pre-installed OS, and the original option to change it
+        * in the BIOS setup screen was removed in later versions.
+        *
+        * Judging by the lack of "Super Hybrid Engine" on Asus product pages,
+        * this applies to all "701" models (4G/4G Surf/2G Surf).
+        *
+        * So Asus made a deliberate decision not to support it on this model.
+        * We have several reports that using it can cause the system to hang
+        *
+        * The hang has also been reported on a "702" (Model name "8G"?).
+        *
+        * We avoid dmi_check_system() / dmi_match(), because they use
+        * substring matching.  We don't want to affect the "701SD"
+        * and "701SDX" models, because they do support S.H.E.
+        */
+       if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) {
+               eeepc->cpufv_disabled = true;
+               pr_info("model %s does not officially support setting cpu "
+                       "speed\n", model);
+               pr_info("cpufv disabled to avoid instability\n");
+       }
+
+       /*
+        * Blacklist for wlan hotplug
+        *
+        * Eeepc 1005HA doesn't work like others models and don't need the
+        * hotplug code. In fact, current hotplug code seems to unplug another
+        * device...
+        */
+       if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) {
+               eeepc->hotplug_disabled = true;
+               pr_info("wlan hotplug disabled\n");
        }
 }
 
@@ -1342,6 +1364,10 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device)
        strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS);
        device->driver_data = eeepc;
 
+       eeepc->hotplug_disabled = hotplug_disabled;
+
+       eeepc_dmi_check(eeepc);
+
        result = eeepc_acpi_init(eeepc, device);
        if (result)
                goto fail_platform;
@@ -1452,10 +1478,12 @@ static int __init eeepc_laptop_init(void)
        result = acpi_bus_register_driver(&eeepc_acpi_driver);
        if (result < 0)
                goto fail_acpi_driver;
+
        if (!eeepc_device_present) {
                result = -ENODEV;
                goto fail_no_device;
        }
+
        return 0;
 
 fail_no_device:
index ad4c414dbfbcd1e056fa26c7010fb03d975edf87..3aa57da8b43ba4f09b0523908f46cd903d1518b4 100644 (file)
@@ -89,6 +89,7 @@ static struct key_entry hp_wmi_keymap[] = {
        {KE_KEY, 0x20e6, KEY_PROG1},
        {KE_KEY, 0x2142, KEY_MEDIA},
        {KE_KEY, 0x213b, KEY_INFO},
+       {KE_KEY, 0x2169, KEY_DIRECTION},
        {KE_KEY, 0x231b, KEY_HELP},
        {KE_END, 0}
 };
index 5af53340da6f4736fb86c65c30fc296b2e5c97f7..3f71a605a49243e6a0ca121c5d5ec57e2a8e6757 100644 (file)
@@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
        /* the buffer is filled with magic numbers describing the devices
         * available, 0xff terminates the enumeration
         */
-       while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff &&
-                       i < device_enum->buffer.length) {
-               i++;
+       for (i = 0; i < device_enum->buffer.length; i++) {
+
+               dev_code = *(device_enum->buffer.pointer + i);
+               if (dev_code == 0xff)
+                       break;
+
                dprintk("Radio devices, looking at 0x%.2x\n", dev_code);
 
                if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])
index e67e4feb35cb814f85ad2df10bc1836c00cc79b6..eb603f1d55ca4ba0ecf4f2fa685cc7364142a740 100644 (file)
@@ -5771,7 +5771,7 @@ static void thermal_exit(void)
        case TPACPI_THERMAL_ACPI_TMP07:
        case TPACPI_THERMAL_ACPI_UPDT:
                sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
-                                  &thermal_temp_input16_group);
+                                  &thermal_temp_input8_group);
                break;
        case TPACPI_THERMAL_NONE:
        default:
index 77bf5d8f893aae8368f3ae6253c9f5c98e4d86a9..26c211724acf7cb2374f46a7ddfcdeabe6e3a1d0 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/backlight.h>
 #include <linux/platform_device.h>
 #include <linux/rfkill.h>
+#include <linux/input.h>
 
 #include <asm/uaccess.h>
 
@@ -62,9 +63,10 @@ MODULE_LICENSE("GPL");
 
 /* Toshiba ACPI method paths */
 #define METHOD_LCD_BRIGHTNESS  "\\_SB_.PCI0.VGA_.LCD_._BCM"
-#define METHOD_HCI_1           "\\_SB_.VALD.GHCI"
-#define METHOD_HCI_2           "\\_SB_.VALZ.GHCI"
+#define TOSH_INTERFACE_1       "\\_SB_.VALD"
+#define TOSH_INTERFACE_2       "\\_SB_.VALZ"
 #define METHOD_VIDEO_OUT       "\\_SB_.VALX.DSSX"
+#define GHCI_METHOD            ".GHCI"
 
 /* Toshiba HCI interface definitions
  *
@@ -116,6 +118,36 @@ static const struct acpi_device_id toshiba_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
 
+struct key_entry {
+       char type;
+       u16 code;
+       u16 keycode;
+};
+
+enum {KE_KEY, KE_END};
+
+static struct key_entry toshiba_acpi_keymap[]  = {
+       {KE_KEY, 0x101, KEY_MUTE},
+       {KE_KEY, 0x13b, KEY_COFFEE},
+       {KE_KEY, 0x13c, KEY_BATTERY},
+       {KE_KEY, 0x13d, KEY_SLEEP},
+       {KE_KEY, 0x13e, KEY_SUSPEND},
+       {KE_KEY, 0x13f, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x140, KEY_BRIGHTNESSDOWN},
+       {KE_KEY, 0x141, KEY_BRIGHTNESSUP},
+       {KE_KEY, 0x142, KEY_WLAN},
+       {KE_KEY, 0x143, KEY_PROG1},
+       {KE_KEY, 0xb05, KEY_PROG2},
+       {KE_KEY, 0xb06, KEY_WWW},
+       {KE_KEY, 0xb07, KEY_MAIL},
+       {KE_KEY, 0xb30, KEY_STOP},
+       {KE_KEY, 0xb31, KEY_PREVIOUSSONG},
+       {KE_KEY, 0xb32, KEY_NEXTSONG},
+       {KE_KEY, 0xb33, KEY_PLAYPAUSE},
+       {KE_KEY, 0xb5a, KEY_MEDIA},
+       {KE_END, 0, 0},
+};
+
 /* utility
  */
 
@@ -251,6 +283,8 @@ static acpi_status hci_read2(u32 reg, u32 *out1, u32 *out2, u32 *result)
 struct toshiba_acpi_dev {
        struct platform_device *p_dev;
        struct rfkill *bt_rfk;
+       struct input_dev *hotkey_dev;
+       acpi_handle handle;
 
        const char *bt_name;
 
@@ -711,8 +745,159 @@ static struct backlight_ops toshiba_backlight_data = {
         .update_status  = set_lcd_status,
 };
 
+static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
+{
+       struct key_entry *key;
+
+       for (key = toshiba_acpi_keymap; key->type != KE_END; key++)
+               if (code == key->code)
+                       return key;
+
+       return NULL;
+}
+
+static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
+{
+       struct key_entry *key;
+
+       for (key = toshiba_acpi_keymap; key->type != KE_END; key++)
+               if (code == key->keycode && key->type == KE_KEY)
+                       return key;
+
+       return NULL;
+}
+
+static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
+                                  int *keycode)
+{
+       struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
+
+       if (key && key->type == KE_KEY) {
+               *keycode = key->keycode;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode,
+                                  int keycode)
+{
+       struct key_entry *key;
+       int old_keycode;
+
+       if (keycode < 0 || keycode > KEY_MAX)
+               return -EINVAL;
+
+       key = toshiba_acpi_get_entry_by_scancode(scancode);
+       if (key && key->type == KE_KEY) {
+               old_keycode = key->keycode;
+               key->keycode = keycode;
+               set_bit(keycode, dev->keybit);
+               if (!toshiba_acpi_get_entry_by_keycode(old_keycode))
+                       clear_bit(old_keycode, dev->keybit);
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *context)
+{
+       u32 hci_result, value;
+       struct key_entry *key;
+
+       if (event != 0x80)
+               return;
+       do {
+               hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result);
+               if (hci_result == HCI_SUCCESS) {
+                       if (value == 0x100)
+                               continue;
+                       else if (value & 0x80) {
+                               key = toshiba_acpi_get_entry_by_scancode
+                                       (value & ~0x80);
+                               if (!key) {
+                                       printk(MY_INFO "Unknown key %x\n",
+                                              value & ~0x80);
+                                       continue;
+                               }
+                               input_report_key(toshiba_acpi.hotkey_dev,
+                                                key->keycode, 1);
+                               input_sync(toshiba_acpi.hotkey_dev);
+                               input_report_key(toshiba_acpi.hotkey_dev,
+                                                key->keycode, 0);
+                               input_sync(toshiba_acpi.hotkey_dev);
+                       }
+               } else if (hci_result == HCI_NOT_SUPPORTED) {
+                       /* This is a workaround for an unresolved issue on
+                        * some machines where system events sporadically
+                        * become disabled. */
+                       hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
+                       printk(MY_NOTICE "Re-enabled hotkeys\n");
+               }
+       } while (hci_result != HCI_EMPTY);
+}
+
+static int toshiba_acpi_setup_keyboard(char *device)
+{
+       acpi_status status;
+       acpi_handle handle;
+       int result;
+       const struct key_entry *key;
+
+       status = acpi_get_handle(NULL, device, &handle);
+       if (ACPI_FAILURE(status)) {
+               printk(MY_INFO "Unable to get notification device\n");
+               return -ENODEV;
+       }
+
+       toshiba_acpi.handle = handle;
+
+       status = acpi_evaluate_object(handle, "ENAB", NULL, NULL);
+       if (ACPI_FAILURE(status)) {
+               printk(MY_INFO "Unable to enable hotkeys\n");
+               return -ENODEV;
+       }
+
+       status = acpi_install_notify_handler(handle, ACPI_DEVICE_NOTIFY,
+                                             toshiba_acpi_notify, NULL);
+       if (ACPI_FAILURE(status)) {
+               printk(MY_INFO "Unable to install hotkey notification\n");
+               return -ENODEV;
+       }
+
+       toshiba_acpi.hotkey_dev = input_allocate_device();
+       if (!toshiba_acpi.hotkey_dev) {
+               printk(MY_INFO "Unable to register input device\n");
+               return -ENOMEM;
+       }
+
+       toshiba_acpi.hotkey_dev->name = "Toshiba input device";
+       toshiba_acpi.hotkey_dev->phys = device;
+       toshiba_acpi.hotkey_dev->id.bustype = BUS_HOST;
+       toshiba_acpi.hotkey_dev->getkeycode = toshiba_acpi_getkeycode;
+       toshiba_acpi.hotkey_dev->setkeycode = toshiba_acpi_setkeycode;
+
+       for (key = toshiba_acpi_keymap; key->type != KE_END; key++) {
+               set_bit(EV_KEY, toshiba_acpi.hotkey_dev->evbit);
+               set_bit(key->keycode, toshiba_acpi.hotkey_dev->keybit);
+       }
+
+       result = input_register_device(toshiba_acpi.hotkey_dev);
+       if (result) {
+               printk(MY_INFO "Unable to register input device\n");
+               return result;
+       }
+
+       return 0;
+}
+
 static void toshiba_acpi_exit(void)
 {
+       if (toshiba_acpi.hotkey_dev)
+               input_unregister_device(toshiba_acpi.hotkey_dev);
+
        if (toshiba_acpi.bt_rfk) {
                rfkill_unregister(toshiba_acpi.bt_rfk);
                rfkill_destroy(toshiba_acpi.bt_rfk);
@@ -726,6 +911,9 @@ static void toshiba_acpi_exit(void)
        if (toshiba_proc_dir)
                remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
 
+       acpi_remove_notify_handler(toshiba_acpi.handle, ACPI_DEVICE_NOTIFY,
+                                  toshiba_acpi_notify);
+
        platform_device_unregister(toshiba_acpi.p_dev);
 
        return;
@@ -742,11 +930,15 @@ static int __init toshiba_acpi_init(void)
                return -ENODEV;
 
        /* simple device detection: look for HCI method */
-       if (is_valid_acpi_path(METHOD_HCI_1))
-               method_hci = METHOD_HCI_1;
-       else if (is_valid_acpi_path(METHOD_HCI_2))
-               method_hci = METHOD_HCI_2;
-       else
+       if (is_valid_acpi_path(TOSH_INTERFACE_1 GHCI_METHOD)) {
+               method_hci = TOSH_INTERFACE_1 GHCI_METHOD;
+               if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_1))
+                       printk(MY_INFO "Unable to activate hotkeys\n");
+       } else if (is_valid_acpi_path(TOSH_INTERFACE_2 GHCI_METHOD)) {
+               method_hci = TOSH_INTERFACE_2 GHCI_METHOD;
+               if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_2))
+                       printk(MY_INFO "Unable to activate hotkeys\n");
+       } else
                return -ENODEV;
 
        printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n",
index fa39e759a275a2a49ef7a0ceb306c4eee9c5abbf..6ea3cb5837c707963784555aabafe14c35b0b48a 100644 (file)
@@ -175,8 +175,14 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)
                dev_err(&dev->dev, "Do not pass platform_data through "
                        "wm97xx_bat_set_pdata!\n");
                return -EINVAL;
-       } else
-               pdata = wmdata->batt_pdata;
+       }
+
+       if (!wmdata) {
+               dev_err(&dev->dev, "No platform data supplied\n");
+               return -EINVAL;
+       }
+
+       pdata = wmdata->batt_pdata;
 
        if (dev->id != -1)
                return -EINVAL;
index e82d8c9c6cda6a6c098ce2c7bd685d30515fcb5b..95a689befc84b5887ea0e629f85579006c4cf15c 100644 (file)
@@ -532,7 +532,7 @@ static void ps3av_set_videomode_packet(u32 id)
        res = ps3av_cmd_avb_param(&avb_param, len);
        if (res == PS3AV_STATUS_NO_SYNC_HEAD)
                printk(KERN_WARNING
-                      "%s: Command failed. Please try your request again. \n",
+                      "%s: Command failed. Please try your request again.\n",
                       __func__);
        else if (res)
                dev_dbg(&ps3av->dev->core, "ps3av_cmd_avb_param failed\n");
index 686ef270ecf7f01d23bf84a85b5f512be4566f10..b60a4c9f8f1680153e7c66c9c6fb5c72ec022dac 100644 (file)
@@ -661,7 +661,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
 static void print_constraints(struct regulator_dev *rdev)
 {
        struct regulation_constraints *constraints = rdev->constraints;
-       char buf[80];
+       char buf[80] = "";
        int count = 0;
        int ret;
 
index 76d08c282f9cac3a54133acc30b88fda81b37738..4f33a0f4a179669b1619991f0cb655f85193373b 100644 (file)
@@ -183,7 +183,7 @@ static int lp3971_ldo_set_voltage(struct regulator_dev *dev,
                if (vol_map[val] >= min_vol)
                        break;
 
-       if (vol_map[val] > max_vol)
+       if (val > LDO_VOL_MAX_IDX || vol_map[val] > max_vol)
                return -EINVAL;
 
        return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo),
@@ -272,7 +272,7 @@ static int lp3971_dcdc_set_voltage(struct regulator_dev *dev,
                if (vol_map[val] >= min_vol)
                        break;
 
-       if (vol_map[val] > max_vol)
+       if (val > BUCK_TARGET_VOL_MAX_IDX || vol_map[val] > max_vol)
                return -EINVAL;
 
        ret = lp3971_set_bits(lp3971, LP3971_BUCK_TARGET_VOL1_REG(buck),
index 1bbff099a546af37a1e4e2179ca52f9ffa478962..e7b89e704af671aeabe8ff193022af8048fbd0bc 100644 (file)
@@ -1504,7 +1504,8 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
        led->isink_init.consumer_supplies = &led->isink_consumer;
        led->isink_init.constraints.min_uA = 0;
        led->isink_init.constraints.max_uA = pdata->max_uA;
-       led->isink_init.constraints.valid_ops_mask = REGULATOR_CHANGE_CURRENT;
+       led->isink_init.constraints.valid_ops_mask
+               = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS;
        led->isink_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
        ret = wm8350_register_regulator(wm8350, isink, &led->isink_init);
        if (ret != 0) {
@@ -1517,6 +1518,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
        led->dcdc_init.num_consumer_supplies = 1;
        led->dcdc_init.consumer_supplies = &led->dcdc_consumer;
        led->dcdc_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
+       led->dcdc_init.constraints.valid_ops_mask =  REGULATOR_CHANGE_STATUS;
        ret = wm8350_register_regulator(wm8350, dcdc, &led->dcdc_init);
        if (ret != 0) {
                platform_device_put(pdev);
index 8167e9e6827aa589a4a936082ccabf8ff65976ac..2bb8a8b7ffafcfb2af0ac748e1d0ccca49ace3e3 100644 (file)
@@ -868,4 +868,14 @@ config RTC_DRV_MC13783
        help
          This enables support for the Freescale MC13783 PMIC RTC
 
+config RTC_DRV_MPC5121
+       tristate "Freescale MPC5121 built-in RTC"
+       depends on PPC_MPC512x && RTC_CLASS
+       help
+         If you say yes here you will get support for the
+         built-in RTC MPC5121.
+
+         This driver can also be built as a module. If so, the module
+         will be called rtc-mpc5121.
+
 endif # RTC_CLASS
index e5160fddc4463da7ea295452e80948d0447d4f03..b7148afb8f55a90b4cec3fa014c7e7c9aca3f14f 100644 (file)
@@ -55,6 +55,7 @@ obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o
 obj-$(CONFIG_RTC_DRV_MAX6902)  += rtc-max6902.o
 obj-$(CONFIG_RTC_DRV_MC13783)  += rtc-mc13783.o
 obj-$(CONFIG_RTC_DRV_MSM6242)  += rtc-msm6242.o
+obj-$(CONFIG_RTC_DRV_MPC5121)  += rtc-mpc5121.o
 obj-$(CONFIG_RTC_DRV_MV)       += rtc-mv.o
 obj-$(CONFIG_RTC_DRV_NUC900)   += rtc-nuc900.o
 obj-$(CONFIG_RTC_DRV_OMAP)     += rtc-omap.o
index 3a7be11cc6b93e1a5315a40ffc25624792679443..812c667550837ea6f12adaedcfbff41f32d2a30e 100644 (file)
@@ -376,20 +376,22 @@ static int __devinit fm3130_probe(struct i2c_client *client,
        }
 
        /* Disabling calibration mode */
-       if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL)
+       if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL) {
                i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
                        fm3130->regs[FM3130_RTC_CONTROL] &
                                ~(FM3130_RTC_CONTROL_BIT_CAL));
                dev_warn(&client->dev, "Disabling calibration mode!\n");
+       }
 
        /* Disabling read and write modes */
        if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE ||
-           fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ)
+           fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ) {
                i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
                        fm3130->regs[FM3130_RTC_CONTROL] &
                                ~(FM3130_RTC_CONTROL_BIT_READ |
                                        FM3130_RTC_CONTROL_BIT_WRITE));
                dev_warn(&client->dev, "Disabling READ or WRITE mode!\n");
+       }
 
        /* oscillator off?  turn it on, so clock can tick. */
        if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN)
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
new file mode 100644 (file)
index 0000000..4313ca0
--- /dev/null
@@ -0,0 +1,387 @@
+/*
+ * Real-time clock driver for MPC5121
+ *
+ * Copyright 2007, Domen Puncer <domen.puncer@telargo.com>
+ * Copyright 2008, Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/rtc.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/io.h>
+
+struct mpc5121_rtc_regs {
+       u8 set_time;            /* RTC + 0x00 */
+       u8 hour_set;            /* RTC + 0x01 */
+       u8 minute_set;          /* RTC + 0x02 */
+       u8 second_set;          /* RTC + 0x03 */
+
+       u8 set_date;            /* RTC + 0x04 */
+       u8 month_set;           /* RTC + 0x05 */
+       u8 weekday_set;         /* RTC + 0x06 */
+       u8 date_set;            /* RTC + 0x07 */
+
+       u8 write_sw;            /* RTC + 0x08 */
+       u8 sw_set;              /* RTC + 0x09 */
+       u16 year_set;           /* RTC + 0x0a */
+
+       u8 alm_enable;          /* RTC + 0x0c */
+       u8 alm_hour_set;        /* RTC + 0x0d */
+       u8 alm_min_set;         /* RTC + 0x0e */
+       u8 int_enable;          /* RTC + 0x0f */
+
+       u8 reserved1;
+       u8 hour;                /* RTC + 0x11 */
+       u8 minute;              /* RTC + 0x12 */
+       u8 second;              /* RTC + 0x13 */
+
+       u8 month;               /* RTC + 0x14 */
+       u8 wday_mday;           /* RTC + 0x15 */
+       u16 year;               /* RTC + 0x16 */
+
+       u8 int_alm;             /* RTC + 0x18 */
+       u8 int_sw;              /* RTC + 0x19 */
+       u8 alm_status;          /* RTC + 0x1a */
+       u8 sw_minute;           /* RTC + 0x1b */
+
+       u8 bus_error_1;         /* RTC + 0x1c */
+       u8 int_day;             /* RTC + 0x1d */
+       u8 int_min;             /* RTC + 0x1e */
+       u8 int_sec;             /* RTC + 0x1f */
+
+       /*
+        * target_time:
+        *      intended to be used for hibernation but hibernation
+        *      does not work on silicon rev 1.5 so use it for non-volatile
+        *      storage of offset between the actual_time register and linux
+        *      time
+        */
+       u32 target_time;        /* RTC + 0x20 */
+       /*
+        * actual_time:
+        *      readonly time since VBAT_RTC was last connected
+        */
+       u32 actual_time;        /* RTC + 0x24 */
+       u32 keep_alive;         /* RTC + 0x28 */
+};
+
+struct mpc5121_rtc_data {
+       unsigned irq;
+       unsigned irq_periodic;
+       struct mpc5121_rtc_regs __iomem *regs;
+       struct rtc_device *rtc;
+       struct rtc_wkalrm wkalarm;
+};
+
+/*
+ * Update second/minute/hour registers.
+ *
+ * This is just so alarm will work.
+ */
+static void mpc5121_rtc_update_smh(struct mpc5121_rtc_regs __iomem *regs,
+                                  struct rtc_time *tm)
+{
+       out_8(&regs->second_set, tm->tm_sec);
+       out_8(&regs->minute_set, tm->tm_min);
+       out_8(&regs->hour_set, tm->tm_hour);
+
+       /* set time sequence */
+       out_8(&regs->set_time, 0x1);
+       out_8(&regs->set_time, 0x3);
+       out_8(&regs->set_time, 0x1);
+       out_8(&regs->set_time, 0x0);
+}
+
+static int mpc5121_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+       unsigned long now;
+
+       /*
+        * linux time is actual_time plus the offset saved in target_time
+        */
+       now = in_be32(&regs->actual_time) + in_be32(&regs->target_time);
+
+       rtc_time_to_tm(now, tm);
+
+       /*
+        * update second minute hour registers
+        * so alarms will work
+        */
+       mpc5121_rtc_update_smh(regs, tm);
+
+       return rtc_valid_tm(tm);
+}
+
+static int mpc5121_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+       int ret;
+       unsigned long now;
+
+       /*
+        * The actual_time register is read only so we write the offset
+        * between it and linux time to the target_time register.
+        */
+       ret = rtc_tm_to_time(tm, &now);
+       if (ret == 0)
+               out_be32(&regs->target_time, now - in_be32(&regs->actual_time));
+
+       /*
+        * update second minute hour registers
+        * so alarms will work
+        */
+       mpc5121_rtc_update_smh(regs, tm);
+
+       return 0;
+}
+
+static int mpc5121_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+
+       *alarm = rtc->wkalarm;
+
+       alarm->pending = in_8(&regs->alm_status);
+
+       return 0;
+}
+
+static int mpc5121_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+
+       /*
+        * the alarm has no seconds so deal with it
+        */
+       if (alarm->time.tm_sec) {
+               alarm->time.tm_sec = 0;
+               alarm->time.tm_min++;
+               if (alarm->time.tm_min >= 60) {
+                       alarm->time.tm_min = 0;
+                       alarm->time.tm_hour++;
+                       if (alarm->time.tm_hour >= 24)
+                               alarm->time.tm_hour = 0;
+               }
+       }
+
+       alarm->time.tm_mday = -1;
+       alarm->time.tm_mon = -1;
+       alarm->time.tm_year = -1;
+
+       out_8(&regs->alm_min_set, alarm->time.tm_min);
+       out_8(&regs->alm_hour_set, alarm->time.tm_hour);
+
+       out_8(&regs->alm_enable, alarm->enabled);
+
+       rtc->wkalarm = *alarm;
+       return 0;
+}
+
+static irqreturn_t mpc5121_rtc_handler(int irq, void *dev)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+
+       if (in_8(&regs->int_alm)) {
+               /* acknowledge and clear status */
+               out_8(&regs->int_alm, 1);
+               out_8(&regs->alm_status, 1);
+
+               rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
+               return IRQ_HANDLED;
+       }
+
+       return IRQ_NONE;
+}
+
+static irqreturn_t mpc5121_rtc_handler_upd(int irq, void *dev)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+
+       if (in_8(&regs->int_sec) && (in_8(&regs->int_enable) & 0x1)) {
+               /* acknowledge */
+               out_8(&regs->int_sec, 1);
+
+               rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_UF);
+               return IRQ_HANDLED;
+       }
+
+       return IRQ_NONE;
+}
+
+static int mpc5121_rtc_alarm_irq_enable(struct device *dev,
+                                       unsigned int enabled)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+       int val;
+
+       if (enabled)
+               val = 1;
+       else
+               val = 0;
+
+       out_8(&regs->alm_enable, val);
+       rtc->wkalarm.enabled = val;
+
+       return 0;
+}
+
+static int mpc5121_rtc_update_irq_enable(struct device *dev,
+                                        unsigned int enabled)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+       int val;
+
+       val = in_8(&regs->int_enable);
+
+       if (enabled)
+               val = (val & ~0x8) | 0x1;
+       else
+               val &= ~0x1;
+
+       out_8(&regs->int_enable, val);
+
+       return 0;
+}
+
+static const struct rtc_class_ops mpc5121_rtc_ops = {
+       .read_time = mpc5121_rtc_read_time,
+       .set_time = mpc5121_rtc_set_time,
+       .read_alarm = mpc5121_rtc_read_alarm,
+       .set_alarm = mpc5121_rtc_set_alarm,
+       .alarm_irq_enable = mpc5121_rtc_alarm_irq_enable,
+       .update_irq_enable = mpc5121_rtc_update_irq_enable,
+};
+
+static int __devinit mpc5121_rtc_probe(struct of_device *op,
+                                       const struct of_device_id *match)
+{
+       struct mpc5121_rtc_data *rtc;
+       int err = 0;
+       u32 ka;
+
+       rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
+       if (!rtc)
+               return -ENOMEM;
+
+       rtc->regs = of_iomap(op->node, 0);
+       if (!rtc->regs) {
+               dev_err(&op->dev, "%s: couldn't map io space\n", __func__);
+               err = -ENOSYS;
+               goto out_free;
+       }
+
+       device_init_wakeup(&op->dev, 1);
+
+       dev_set_drvdata(&op->dev, rtc);
+
+       rtc->irq = irq_of_parse_and_map(op->node, 1);
+       err = request_irq(rtc->irq, mpc5121_rtc_handler, IRQF_DISABLED,
+                                               "mpc5121-rtc", &op->dev);
+       if (err) {
+               dev_err(&op->dev, "%s: could not request irq: %i\n",
+                                                       __func__, rtc->irq);
+               goto out_dispose;
+       }
+
+       rtc->irq_periodic = irq_of_parse_and_map(op->node, 0);
+       err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd,
+                               IRQF_DISABLED, "mpc5121-rtc_upd", &op->dev);
+       if (err) {
+               dev_err(&op->dev, "%s: could not request irq: %i\n",
+                                               __func__, rtc->irq_periodic);
+               goto out_dispose2;
+       }
+
+       ka = in_be32(&rtc->regs->keep_alive);
+       if (ka & 0x02) {
+               dev_warn(&op->dev,
+                       "mpc5121-rtc: Battery or oscillator failure!\n");
+               out_be32(&rtc->regs->keep_alive, ka);
+       }
+
+       rtc->rtc = rtc_device_register("mpc5121-rtc", &op->dev,
+                                       &mpc5121_rtc_ops, THIS_MODULE);
+       if (IS_ERR(rtc->rtc)) {
+               err = PTR_ERR(rtc->rtc);
+               goto out_free_irq;
+       }
+
+       return 0;
+
+out_free_irq:
+       free_irq(rtc->irq_periodic, &op->dev);
+out_dispose2:
+       irq_dispose_mapping(rtc->irq_periodic);
+       free_irq(rtc->irq, &op->dev);
+out_dispose:
+       irq_dispose_mapping(rtc->irq);
+       iounmap(rtc->regs);
+out_free:
+       kfree(rtc);
+
+       return err;
+}
+
+static int __devexit mpc5121_rtc_remove(struct of_device *op)
+{
+       struct mpc5121_rtc_data *rtc = dev_get_drvdata(&op->dev);
+       struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
+
+       /* disable interrupt, so there are no nasty surprises */
+       out_8(&regs->alm_enable, 0);
+       out_8(&regs->int_enable, in_8(&regs->int_enable) & ~0x1);
+
+       rtc_device_unregister(rtc->rtc);
+       iounmap(rtc->regs);
+       free_irq(rtc->irq, &op->dev);
+       free_irq(rtc->irq_periodic, &op->dev);
+       irq_dispose_mapping(rtc->irq);
+       irq_dispose_mapping(rtc->irq_periodic);
+       dev_set_drvdata(&op->dev, NULL);
+       kfree(rtc);
+
+       return 0;
+}
+
+static struct of_device_id mpc5121_rtc_match[] __devinitdata = {
+       { .compatible = "fsl,mpc5121-rtc", },
+       {},
+};
+
+static struct of_platform_driver mpc5121_rtc_driver = {
+       .owner = THIS_MODULE,
+       .name = "mpc5121-rtc",
+       .match_table = mpc5121_rtc_match,
+       .probe = mpc5121_rtc_probe,
+       .remove = __devexit_p(mpc5121_rtc_remove),
+};
+
+static int __init mpc5121_rtc_init(void)
+{
+       return of_register_platform_driver(&mpc5121_rtc_driver);
+}
+module_init(mpc5121_rtc_init);
+
+static void __exit mpc5121_rtc_exit(void)
+{
+       of_unregister_platform_driver(&mpc5121_rtc_driver);
+}
+module_exit(mpc5121_rtc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>");
index fdb2e7c14506297cab6e39f09aa52aceb5c8274b..9ab1ae40565fffc7342638a23ef895ad46eeab8a 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/buffer_head.h>
 #include <linux/hdreg.h>
 #include <linux/async.h>
+#include <linux/mutex.h>
 
 #include <asm/ccwdev.h>
 #include <asm/ebcdic.h>
@@ -112,6 +113,7 @@ struct dasd_device *dasd_alloc_device(void)
        INIT_WORK(&device->restore_device, do_restore_device);
        device->state = DASD_STATE_NEW;
        device->target = DASD_STATE_NEW;
+       mutex_init(&device->state_mutex);
 
        return device;
 }
@@ -321,8 +323,8 @@ static int dasd_state_ready_to_basic(struct dasd_device *device)
                        device->state = DASD_STATE_READY;
                        return rc;
                }
-               dasd_destroy_partitions(block);
                dasd_flush_request_queue(block);
+               dasd_destroy_partitions(block);
                block->blocks = 0;
                block->bp_block = 0;
                block->s2b_shift = 0;
@@ -484,10 +486,8 @@ static void dasd_change_state(struct dasd_device *device)
        if (rc)
                device->target = device->state;
 
-       if (device->state == device->target) {
+       if (device->state == device->target)
                wake_up(&dasd_init_waitq);
-               dasd_put_device(device);
-       }
 
        /* let user-space know that the device status changed */
        kobject_uevent(&device->cdev->dev.kobj, KOBJ_CHANGE);
@@ -502,7 +502,9 @@ static void dasd_change_state(struct dasd_device *device)
 static void do_kick_device(struct work_struct *work)
 {
        struct dasd_device *device = container_of(work, struct dasd_device, kick_work);
+       mutex_lock(&device->state_mutex);
        dasd_change_state(device);
+       mutex_unlock(&device->state_mutex);
        dasd_schedule_device_bh(device);
        dasd_put_device(device);
 }
@@ -539,18 +541,19 @@ void dasd_restore_device(struct dasd_device *device)
 void dasd_set_target_state(struct dasd_device *device, int target)
 {
        dasd_get_device(device);
+       mutex_lock(&device->state_mutex);
        /* If we are in probeonly mode stop at DASD_STATE_READY. */
        if (dasd_probeonly && target > DASD_STATE_READY)
                target = DASD_STATE_READY;
        if (device->target != target) {
-               if (device->state == target) {
+               if (device->state == target)
                        wake_up(&dasd_init_waitq);
-                       dasd_put_device(device);
-               }
                device->target = target;
        }
        if (device->state != device->target)
                dasd_change_state(device);
+       mutex_unlock(&device->state_mutex);
+       dasd_put_device(device);
 }
 
 /*
@@ -1000,12 +1003,20 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
                return;
        }
 
-       device = (struct dasd_device *) cqr->startdev;
-       if (device == NULL ||
-           device != dasd_device_from_cdev_locked(cdev) ||
-           strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
-               DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
-                             "bus_id %s", dev_name(&cdev->dev));
+       device = dasd_device_from_cdev_locked(cdev);
+       if (IS_ERR(device)) {
+               DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
+                               "unable to get device from cdev");
+               return;
+       }
+
+       if (!cqr->startdev ||
+           device != cqr->startdev ||
+           strncmp(cqr->startdev->discipline->ebcname,
+                   (char *) &cqr->magic, 4)) {
+               DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
+                               "invalid device in request");
+               dasd_put_device(device);
                return;
        }
 
@@ -1078,8 +1089,8 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
        device = (struct dasd_device *) cqr->startdev;
        if (!device ||
            strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
-               DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
-                             "bus_id %s", dev_name(&cdev->dev));
+               DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
+                               "invalid device in request");
                return;
        }
 
@@ -1692,7 +1703,6 @@ int dasd_cancel_req(struct dasd_ccw_req *cqr)
                                cqr, rc);
                } else {
                        cqr->stopclk = get_clock();
-                       rc = 1;
                }
                break;
        default: /* already finished or clear pending - do nothing */
@@ -2170,9 +2180,13 @@ static void dasd_flush_request_queue(struct dasd_block *block)
 static int dasd_open(struct block_device *bdev, fmode_t mode)
 {
        struct dasd_block *block = bdev->bd_disk->private_data;
-       struct dasd_device *base = block->base;
+       struct dasd_device *base;
        int rc;
 
+       if (!block)
+               return -ENODEV;
+
+       base = block->base;
        atomic_inc(&block->open_count);
        if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) {
                rc = -ENODEV;
@@ -2285,11 +2299,6 @@ static void dasd_generic_auto_online(void *data, async_cookie_t cookie)
        if (ret)
                pr_warning("%s: Setting the DASD online failed with rc=%d\n",
                           dev_name(&cdev->dev), ret);
-       else {
-               struct dasd_device *device = dasd_device_from_cdev(cdev);
-               wait_event(dasd_init_waitq, _wait_for_device(device));
-               dasd_put_device(device);
-       }
 }
 
 /*
@@ -2424,6 +2433,9 @@ int dasd_generic_set_online(struct ccw_device *cdev,
        } else
                pr_debug("dasd_generic device %s found\n",
                                dev_name(&cdev->dev));
+
+       wait_event(dasd_init_waitq, _wait_for_device(device));
+
        dasd_put_device(device);
        return rc;
 }
index 4cac5b54f26a6fff837c17983d4fe79a05811af5..d49766f3b9404129d3df5d87eb846278474ef9db 100644 (file)
@@ -874,12 +874,19 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr,
        ssize_t len;
 
        device = dasd_device_from_cdev(to_ccwdev(dev));
-       if (!IS_ERR(device) && device->discipline) {
+       if (IS_ERR(device))
+               goto out;
+       else if (!device->discipline) {
+               dasd_put_device(device);
+               goto out;
+       } else {
                len = snprintf(buf, PAGE_SIZE, "%s\n",
                               device->discipline->name);
                dasd_put_device(device);
-       } else
-               len = snprintf(buf, PAGE_SIZE, "none\n");
+               return len;
+       }
+out:
+       len = snprintf(buf, PAGE_SIZE, "none\n");
        return len;
 }
 
index 5819dc02a143652402d1ae63ddea9add07582f4d..1cca21aafaba30920ecd933324b25e7ebbf11122 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/debug.h>
 #include <asm/idals.h>
 #include <asm/ebcdic.h>
+#include <asm/compat.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/cio.h>
@@ -2844,13 +2845,16 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp)
        rc = -EFAULT;
        if (copy_from_user(&usrparm, argp, sizeof(usrparm)))
                goto out;
-#ifndef CONFIG_64BIT
-       /* Make sure pointers are sane even on 31 bit. */
-       if ((usrparm.psf_data >> 32) != 0 || (usrparm.rssd_result >> 32) != 0) {
+       if (is_compat_task() || sizeof(long) == 4) {
+               /* Make sure pointers are sane even on 31 bit. */
                rc = -EINVAL;
-               goto out;
+               if ((usrparm.psf_data >> 32) != 0)
+                       goto out;
+               if ((usrparm.rssd_result >> 32) != 0)
+                       goto out;
+               usrparm.psf_data &= 0x7fffffffULL;
+               usrparm.rssd_result &= 0x7fffffffULL;
        }
-#endif
        /* alloc I/O data area */
        psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA);
        rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
@@ -3029,7 +3033,7 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device,
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
                       " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d\n",
                       req, scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw),
-                      scsw_cc(&irb->scsw), req->intrc);
+                      scsw_cc(&irb->scsw), req ? req->intrc : 0);
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
                       " device %s: Failing CCW: %p\n",
                       dev_name(&device->cdev->dev),
index d3198303b93c5b004f0a14712fc39f6ef16ee0c0..94f92a1247f2039b19ae29581b7e7c63e155f418 100644 (file)
@@ -88,6 +88,7 @@ void dasd_gendisk_free(struct dasd_block *block)
        if (block->gdp) {
                del_gendisk(block->gdp);
                block->gdp->queue = NULL;
+               block->gdp->private_data = NULL;
                put_disk(block->gdp);
                block->gdp = NULL;
        }
index e4c2143dabf67835ac50b077a5740f60b6dcbe0e..ed73ce5508228e27f855f99a223d11c455951087 100644 (file)
@@ -368,6 +368,7 @@ struct dasd_device {
 
        /* Device state and target state. */
        int state, target;
+       struct mutex state_mutex;
        int stopped;            /* device (ccw_device_start) was stopped */
 
        /* reference count. */
index 478bcdb90b6fbb29b9afbc1a66e267c2200bd530..7039d9cf0fb4e22a6c557e857a2b785cf3f3d431 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/fs.h>
 #include <linux/blkpg.h>
 #include <linux/smp_lock.h>
-
+#include <asm/compat.h>
 #include <asm/ccwdev.h>
 #include <asm/cmb.h>
 #include <asm/uaccess.h>
@@ -260,7 +260,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
        struct ccw_dev_id dev_id;
 
        base = block->base;
-       if (!base->discipline->fill_info)
+       if (!base->discipline || !base->discipline->fill_info)
                return -EINVAL;
 
        dasd_info = kzalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
@@ -303,10 +303,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
        dasd_info->features |=
                ((base->features & DASD_FEATURE_READONLY) != 0);
 
-       if (base->discipline)
-               memcpy(dasd_info->type, base->discipline->name, 4);
-       else
-               memcpy(dasd_info->type, "none", 4);
+       memcpy(dasd_info->type, base->discipline->name, 4);
 
        if (block->request_queue->request_fn) {
                struct list_head *l;
@@ -358,9 +355,8 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp)
 }
 
 static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd,
-               unsigned long arg)
+                                 struct cmbdata __user *argp)
 {
-       struct cmbdata __user *argp = (void __user *) arg;
        size_t size = _IOC_SIZE(cmd);
        struct cmbdata data;
        int ret;
@@ -376,7 +372,12 @@ dasd_do_ioctl(struct block_device *bdev, fmode_t mode,
              unsigned int cmd, unsigned long arg)
 {
        struct dasd_block *block = bdev->bd_disk->private_data;
-       void __user *argp = (void __user *)arg;
+       void __user *argp;
+
+       if (is_compat_task())
+               argp = compat_ptr(arg);
+       else
+               argp = (void __user *)arg;
 
        if (!block)
                 return -ENODEV;
@@ -414,7 +415,7 @@ dasd_do_ioctl(struct block_device *bdev, fmode_t mode,
        case BIODASDCMFDISABLE:
                return disable_cmf(block->base->cdev);
        case BIODASDREADALLCMB:
-               return dasd_ioctl_readall_cmb(block, cmd, arg);
+               return dasd_ioctl_readall_cmb(block, cmd, argp);
        default:
                /* if the discipline has an ioctl method try it. */
                if (block->base->discipline->ioctl) {
index 6315fbd8e68bf0fe1d8bf557c7932adda91c752f..f13a0bdd148cae363315ef7d6f1ad895554e0568 100644 (file)
@@ -72,7 +72,7 @@ dasd_devices_show(struct seq_file *m, void *v)
        /* Print device number. */
        seq_printf(m, "%s", dev_name(&device->cdev->dev));
        /* Print discipline string. */
-       if (device != NULL && device->discipline != NULL)
+       if (device->discipline != NULL)
                seq_printf(m, "(%s)", device->discipline->name);
        else
                seq_printf(m, "(none)");
@@ -92,10 +92,7 @@ dasd_devices_show(struct seq_file *m, void *v)
        substr = (device->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
        seq_printf(m, "%4s: ", substr);
        /* Print device status information. */
-       switch ((device != NULL) ? device->state : -1) {
-       case -1:
-               seq_printf(m, "unknown");
-               break;
+       switch (device->state) {
        case DASD_STATE_NEW:
                seq_printf(m, "new");
                break;
@@ -168,51 +165,32 @@ static const struct file_operations dasd_devices_file_ops = {
        .release        = seq_release,
 };
 
-static int
-dasd_calc_metrics(char *page, char **start, off_t off,
-                 int count, int *eof, int len)
-{
-       len = (len > off) ? len - off : 0;
-       if (len > count)
-               len = count;
-       if (len < count)
-               *eof = 1;
-       *start = page + off;
-       return len;
-}
-
 #ifdef CONFIG_DASD_PROFILE
-static char *
-dasd_statistics_array(char *str, unsigned int *array, int factor)
+static void dasd_statistics_array(struct seq_file *m, unsigned int *array, int factor)
 {
        int i;
 
        for (i = 0; i < 32; i++) {
-               str += sprintf(str, "%7d ", array[i] / factor);
+               seq_printf(m, "%7d ", array[i] / factor);
                if (i == 15)
-                       str += sprintf(str, "\n");
+                       seq_putc(m, '\n');
        }
-       str += sprintf(str,"\n");
-       return str;
+       seq_putc(m, '\n');
 }
 #endif /* CONFIG_DASD_PROFILE */
 
-static int
-dasd_statistics_read(char *page, char **start, off_t off,
-                    int count, int *eof, void *data)
+static int dasd_stats_proc_show(struct seq_file *m, void *v)
 {
-       unsigned long len;
 #ifdef CONFIG_DASD_PROFILE
        struct dasd_profile_info_t *prof;
-       char *str;
        int factor;
 
        /* check for active profiling */
        if (dasd_profile_level == DASD_PROFILE_OFF) {
-               len = sprintf(page, "Statistics are off - they might be "
+               seq_printf(m, "Statistics are off - they might be "
                                    "switched on using 'echo set on > "
                                    "/proc/dasd/statistics'\n");
-               return dasd_calc_metrics(page, start, off, count, eof, len);
+               return 0;
        }
 
        prof = &dasd_global_profile;
@@ -220,47 +198,49 @@ dasd_statistics_read(char *page, char **start, off_t off,
        for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999;
             factor *= 10);
 
-       str = page;
-       str += sprintf(str, "%d dasd I/O requests\n", prof->dasd_io_reqs);
-       str += sprintf(str, "with %u sectors(512B each)\n",
+       seq_printf(m, "%d dasd I/O requests\n", prof->dasd_io_reqs);
+       seq_printf(m, "with %u sectors(512B each)\n",
                       prof->dasd_io_sects);
-       str += sprintf(str, "Scale Factor is  %d\n", factor);
-       str += sprintf(str,
+       seq_printf(m, "Scale Factor is  %d\n", factor);
+       seq_printf(m,
                       "   __<4    ___8    __16    __32    __64    _128 "
                       "   _256    _512    __1k    __2k    __4k    __8k "
                       "   _16k    _32k    _64k    128k\n");
-       str += sprintf(str,
+       seq_printf(m,
                       "   _256    _512    __1M    __2M    __4M    __8M "
                       "   _16M    _32M    _64M    128M    256M    512M "
                       "   __1G    __2G    __4G " "   _>4G\n");
 
-       str += sprintf(str, "Histogram of sizes (512B secs)\n");
-       str = dasd_statistics_array(str, prof->dasd_io_secs, factor);
-       str += sprintf(str, "Histogram of I/O times (microseconds)\n");
-       str = dasd_statistics_array(str, prof->dasd_io_times, factor);
-       str += sprintf(str, "Histogram of I/O times per sector\n");
-       str = dasd_statistics_array(str, prof->dasd_io_timps, factor);
-       str += sprintf(str, "Histogram of I/O time till ssch\n");
-       str = dasd_statistics_array(str, prof->dasd_io_time1, factor);
-       str += sprintf(str, "Histogram of I/O time between ssch and irq\n");
-       str = dasd_statistics_array(str, prof->dasd_io_time2, factor);
-       str += sprintf(str, "Histogram of I/O time between ssch "
+       seq_printf(m, "Histogram of sizes (512B secs)\n");
+       dasd_statistics_array(m, prof->dasd_io_secs, factor);
+       seq_printf(m, "Histogram of I/O times (microseconds)\n");
+       dasd_statistics_array(m, prof->dasd_io_times, factor);
+       seq_printf(m, "Histogram of I/O times per sector\n");
+       dasd_statistics_array(m, prof->dasd_io_timps, factor);
+       seq_printf(m, "Histogram of I/O time till ssch\n");
+       dasd_statistics_array(m, prof->dasd_io_time1, factor);
+       seq_printf(m, "Histogram of I/O time between ssch and irq\n");
+       dasd_statistics_array(m, prof->dasd_io_time2, factor);
+       seq_printf(m, "Histogram of I/O time between ssch "
                            "and irq per sector\n");
-       str = dasd_statistics_array(str, prof->dasd_io_time2ps, factor);
-       str += sprintf(str, "Histogram of I/O time between irq and end\n");
-       str = dasd_statistics_array(str, prof->dasd_io_time3, factor);
-       str += sprintf(str, "# of req in chanq at enqueuing (1..32) \n");
-       str = dasd_statistics_array(str, prof->dasd_io_nr_req, factor);
-       len = str - page;
+       dasd_statistics_array(m, prof->dasd_io_time2ps, factor);
+       seq_printf(m, "Histogram of I/O time between irq and end\n");
+       dasd_statistics_array(m, prof->dasd_io_time3, factor);
+       seq_printf(m, "# of req in chanq at enqueuing (1..32) \n");
+       dasd_statistics_array(m, prof->dasd_io_nr_req, factor);
 #else
-       len = sprintf(page, "Statistics are not activated in this kernel\n");
+       seq_printf(m, "Statistics are not activated in this kernel\n");
 #endif
-       return dasd_calc_metrics(page, start, off, count, eof, len);
+       return 0;
 }
 
-static int
-dasd_statistics_write(struct file *file, const char __user *user_buf,
-                     unsigned long user_len, void *data)
+static int dasd_stats_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, dasd_stats_proc_show, NULL);
+}
+
+static ssize_t dasd_stats_proc_write(struct file *file,
+               const char __user *user_buf, size_t user_len, loff_t *pos)
 {
 #ifdef CONFIG_DASD_PROFILE
        char *buffer, *str;
@@ -311,6 +291,15 @@ out_error:
 #endif                         /* CONFIG_DASD_PROFILE */
 }
 
+static const struct file_operations dasd_stats_proc_fops = {
+       .owner          = THIS_MODULE,
+       .open           = dasd_stats_proc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+       .write          = dasd_stats_proc_write,
+};
+
 /*
  * Create dasd proc-fs entries.
  * In case creation failed, cleanup and return -ENOENT.
@@ -327,13 +316,12 @@ dasd_proc_init(void)
                                         &dasd_devices_file_ops);
        if (!dasd_devices_entry)
                goto out_nodevices;
-       dasd_statistics_entry = create_proc_entry("statistics",
-                                                 S_IFREG | S_IRUGO | S_IWUSR,
-                                                 dasd_proc_root_entry);
+       dasd_statistics_entry = proc_create("statistics",
+                                           S_IFREG | S_IRUGO | S_IWUSR,
+                                           dasd_proc_root_entry,
+                                           &dasd_stats_proc_fops);
        if (!dasd_statistics_entry)
                goto out_nostatistics;
-       dasd_statistics_entry->read_proc = dasd_statistics_read;
-       dasd_statistics_entry->write_proc = dasd_statistics_write;
        return 0;
 
  out_nostatistics:
index 9d61683b56337a11410692399854b00724f719d5..59ec073724bff327327d1cc8f27108e14254a572 100644 (file)
@@ -1036,22 +1036,6 @@ static void tty3215_flush_buffer(struct tty_struct *tty)
        tty_wakeup(tty);
 }
 
-/*
- * Currently we don't have any io controls for 3215 ttys
- */
-static int tty3215_ioctl(struct tty_struct *tty, struct file * file,
-                        unsigned int cmd, unsigned long arg)
-{
-       if (tty->flags & (1 << TTY_IO_ERROR))
-               return -EIO;
-
-       switch (cmd) {
-       default:
-               return -ENOIOCTLCMD;
-       }
-       return 0;
-}
-
 /*
  * Disable reading from a 3215 tty
  */
@@ -1117,7 +1101,6 @@ static const struct tty_operations tty3215_ops = {
        .write_room = tty3215_write_room,
        .chars_in_buffer = tty3215_chars_in_buffer,
        .flush_buffer = tty3215_flush_buffer,
-       .ioctl = tty3215_ioctl,
        .throttle = tty3215_throttle,
        .unthrottle = tty3215_unthrottle,
        .stop = tty3215_stop,
index 247b2b934728bacbcc4974ec04c3939fbc5c4764..31c59b0d6df0c1509a191ece52a77c3ba4f6e0ae 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/smp_lock.h>
 
+#include <asm/compat.h>
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
 #include <asm/ebcdic.h>
@@ -322,6 +323,7 @@ fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *o
 static long
 fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
+       char __user *argp;
        struct fs3270 *fp;
        struct raw3270_iocb iocb;
        int rc;
@@ -329,6 +331,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        fp = filp->private_data;
        if (!fp)
                return -ENODEV;
+       if (is_compat_task())
+               argp = compat_ptr(arg);
+       else
+               argp = (char __user *)arg;
        rc = 0;
        mutex_lock(&fs3270_mutex);
        switch (cmd) {
@@ -339,10 +345,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                fp->write_command = arg;
                break;
        case TUBGETI:
-               rc = put_user(fp->read_command, (char __user *) arg);
+               rc = put_user(fp->read_command, argp);
                break;
        case TUBGETO:
-               rc = put_user(fp->write_command,(char __user *) arg);
+               rc = put_user(fp->write_command, argp);
                break;
        case TUBGETMOD:
                iocb.model = fp->view.model;
@@ -351,8 +357,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                iocb.pf_cnt = 24;
                iocb.re_cnt = 20;
                iocb.map = 0;
-               if (copy_to_user((char __user *) arg, &iocb,
-                                sizeof(struct raw3270_iocb)))
+               if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb)))
                        rc = -EFAULT;
                break;
        }
@@ -511,8 +516,8 @@ static const struct file_operations fs3270_fops = {
        .write           = fs3270_write,        /* write */
        .unlocked_ioctl  = fs3270_ioctl,        /* ioctl */
        .compat_ioctl    = fs3270_ioctl,        /* ioctl */
-       .open           = fs3270_open,          /* open */
-       .release        = fs3270_close,         /* release */
+       .open            = fs3270_open,         /* open */
+       .release         = fs3270_close,        /* release */
 };
 
 /*
index b9d2a007e93b651842a90c92af6bc773c817e456..3796ffdb847995c89ff74acf9bb5078f28a7eff5 100644 (file)
@@ -495,6 +495,10 @@ sclp_vt220_open(struct tty_struct *tty, struct file *filp)
                if (tty->driver_data == NULL)
                        return -ENOMEM;
                tty->low_latency = 0;
+               if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
+                       tty->winsize.ws_row = 24;
+                       tty->winsize.ws_col = 80;
+               }
        }
        return 0;
 }
index 96816149368a94ad396a86a2d6622c14d01ae04a..8d3d720737da20879f1ac85b1f9da6a7432e99cd 100644 (file)
@@ -46,8 +46,6 @@
  */
 static int tapeblock_open(struct block_device *, fmode_t);
 static int tapeblock_release(struct gendisk *, fmode_t);
-static int tapeblock_ioctl(struct block_device *, fmode_t, unsigned int,
-                               unsigned long);
 static int tapeblock_medium_changed(struct gendisk *);
 static int tapeblock_revalidate_disk(struct gendisk *);
 
@@ -55,7 +53,6 @@ static const struct block_device_operations tapeblock_fops = {
        .owner           = THIS_MODULE,
        .open            = tapeblock_open,
        .release         = tapeblock_release,
-       .ioctl           = tapeblock_ioctl,
        .media_changed   = tapeblock_medium_changed,
        .revalidate_disk = tapeblock_revalidate_disk,
 };
@@ -415,42 +412,6 @@ tapeblock_release(struct gendisk *disk, fmode_t mode)
        return 0;
 }
 
-/*
- * Support of some generic block device IOCTLs.
- */
-static int
-tapeblock_ioctl(
-       struct block_device *   bdev,
-       fmode_t                 mode,
-       unsigned int            command,
-       unsigned long           arg
-) {
-       int rc;
-       int minor;
-       struct gendisk *disk = bdev->bd_disk;
-       struct tape_device *device;
-
-       rc     = 0;
-       BUG_ON(!disk);
-       device = disk->private_data;
-       BUG_ON(!device);
-       minor  = MINOR(bdev->bd_dev);
-
-       DBF_LH(6, "tapeblock_ioctl(0x%0x)\n", command);
-       DBF_LH(6, "device = %d:%d\n", tapeblock_major, minor);
-
-       switch (command) {
-               /* Refuse some IOCTL calls without complaining (mount). */
-               case 0x5310:            /* CDROMMULTISESSION */
-                       rc = -EINVAL;
-                       break;
-               default:
-                       rc = -EINVAL;
-       }
-
-       return rc;
-}
-
 /*
  * Initialize block device frontend.
  */
index 2125ec7d95f0231223d5351b3e0daa7423f2594b..539045acaad42875e03f7225f0249b55251c8e30 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/proc_fs.h>
 #include <linux/mtio.h>
 #include <linux/smp_lock.h>
+#include <linux/compat.h>
 
 #include <asm/uaccess.h>
 
@@ -37,8 +38,9 @@ static ssize_t tapechar_write(struct file *, const char __user *, size_t, loff_t
 static int tapechar_open(struct inode *,struct file *);
 static int tapechar_release(struct inode *,struct file *);
 static long tapechar_ioctl(struct file *, unsigned int, unsigned long);
-static long tapechar_compat_ioctl(struct file *, unsigned int,
-                         unsigned long);
+#ifdef CONFIG_COMPAT
+static long tapechar_compat_ioctl(struct file *, unsigned int, unsigned long);
+#endif
 
 static const struct file_operations tape_fops =
 {
@@ -46,7 +48,9 @@ static const struct file_operations tape_fops =
        .read = tapechar_read,
        .write = tapechar_write,
        .unlocked_ioctl = tapechar_ioctl,
+#ifdef CONFIG_COMPAT
        .compat_ioctl = tapechar_compat_ioctl,
+#endif
        .open = tapechar_open,
        .release = tapechar_release,
 };
@@ -457,15 +461,22 @@ tapechar_ioctl(struct file *filp, unsigned int no, unsigned long data)
        return rc;
 }
 
+#ifdef CONFIG_COMPAT
 static long
 tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data)
 {
        struct tape_device *device = filp->private_data;
        int rval = -ENOIOCTLCMD;
+       unsigned long argp;
 
+       /* The 'arg' argument of any ioctl function may only be used for
+        * pointers because of the compat pointer conversion.
+        * Consider this when adding new ioctls.
+        */
+       argp = (unsigned long) compat_ptr(data);
        if (device->discipline->ioctl_fn) {
                mutex_lock(&device->mutex);
-               rval = device->discipline->ioctl_fn(device, no, data);
+               rval = device->discipline->ioctl_fn(device, no, argp);
                mutex_unlock(&device->mutex);
                if (rval == -EINVAL)
                        rval = -ENOIOCTLCMD;
@@ -473,6 +484,7 @@ tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data)
 
        return rval;
 }
+#endif /* CONFIG_COMPAT */
 
 /*
  * Initialize character device frontend.
index a6087cec55b463fc0237e1fe1774d010a69d038e..921dcda77676b1e94f6e857c695a8d36737c9c5c 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <linux/module.h>
+#include <asm/compat.h>
 #include <asm/cpcmd.h>
 #include <asm/debug.h>
 #include <asm/uaccess.h>
@@ -139,21 +140,26 @@ vmcp_write(struct file *file, const char __user *buff, size_t count,
 static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct vmcp_session *session;
+       int __user *argp;
        int temp;
 
        session = (struct vmcp_session *)file->private_data;
+       if (is_compat_task())
+               argp = compat_ptr(arg);
+       else
+               argp = (int __user *)arg;
        if (mutex_lock_interruptible(&session->mutex))
                return -ERESTARTSYS;
        switch (cmd) {
        case VMCP_GETCODE:
                temp = session->resp_code;
                mutex_unlock(&session->mutex);
-               return put_user(temp, (int __user *)arg);
+               return put_user(temp, argp);
        case VMCP_SETBUF:
                free_pages((unsigned long)session->response,
                                get_order(session->bufsize));
                session->response=NULL;
-               temp = get_user(session->bufsize, (int __user *)arg);
+               temp = get_user(session->bufsize, argp);
                if (get_order(session->bufsize) > 8) {
                        session->bufsize = PAGE_SIZE;
                        temp = -EINVAL;
@@ -163,7 +169,7 @@ static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case VMCP_GETSIZE:
                temp = session->resp_size;
                mutex_unlock(&session->mutex);
-               return put_user(temp, (int __user *)arg);
+               return put_user(temp, argp);
        default:
                mutex_unlock(&session->mutex);
                return -ENOIOCTLCMD;
index 82daa3c1dc9c45eb4619156f849f71902309c66d..3438658b66b76fb7f7aaf261310fe3512fa1cc70 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/miscdevice.h>
 #include <linux/debugfs.h>
+#include <asm/asm-offsets.h>
 #include <asm/ipl.h>
 #include <asm/sclp.h>
 #include <asm/setup.h>
@@ -40,12 +41,12 @@ enum arch_id {
 /* dump system info */
 
 struct sys_info {
-       enum arch_id    arch;
-       unsigned long   sa_base;
-       u32             sa_size;
-       int             cpu_map[NR_CPUS];
-       unsigned long   mem_size;
-       union save_area lc_mask;
+       enum arch_id     arch;
+       unsigned long    sa_base;
+       u32              sa_size;
+       int              cpu_map[NR_CPUS];
+       unsigned long    mem_size;
+       struct save_area lc_mask;
 };
 
 struct ipib_info {
@@ -183,52 +184,9 @@ static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
        return 0;
 }
 
-#ifdef __s390x__
-/*
- * Convert s390x (64 bit) cpu info to s390 (32 bit) cpu info
- */
-static void __init s390x_to_s390_regs(union save_area *out, union save_area *in,
-                                     int cpu)
-{
-       int i;
-
-       for (i = 0; i < 16; i++) {
-               out->s390.gp_regs[i] = in->s390x.gp_regs[i] & 0x00000000ffffffff;
-               out->s390.acc_regs[i] = in->s390x.acc_regs[i];
-               out->s390.ctrl_regs[i] =
-                       in->s390x.ctrl_regs[i] & 0x00000000ffffffff;
-       }
-       /* locore for 31 bit has only space for fpregs 0,2,4,6 */
-       out->s390.fp_regs[0] = in->s390x.fp_regs[0];
-       out->s390.fp_regs[1] = in->s390x.fp_regs[2];
-       out->s390.fp_regs[2] = in->s390x.fp_regs[4];
-       out->s390.fp_regs[3] = in->s390x.fp_regs[6];
-       memcpy(&(out->s390.psw[0]), &(in->s390x.psw[0]), 4);
-       out->s390.psw[1] |= 0x8; /* set bit 12 */
-       memcpy(&(out->s390.psw[4]),&(in->s390x.psw[12]), 4);
-       out->s390.psw[4] |= 0x80; /* set (31bit) addressing bit */
-       out->s390.pref_reg = in->s390x.pref_reg;
-       out->s390.timer = in->s390x.timer;
-       out->s390.clk_cmp = in->s390x.clk_cmp;
-}
-
-static void __init s390x_to_s390_save_areas(void)
-{
-       int i = 1;
-       static union save_area tmp;
-
-       while (zfcpdump_save_areas[i]) {
-               s390x_to_s390_regs(&tmp, zfcpdump_save_areas[i], i);
-               memcpy(zfcpdump_save_areas[i], &tmp, sizeof(tmp));
-               i++;
-       }
-}
-
-#endif /* __s390x__ */
-
 static int __init init_cpu_info(enum arch_id arch)
 {
-       union save_area *sa;
+       struct save_area *sa;
 
        /* get info for boot cpu from lowcore, stored in the HSA */
 
@@ -241,20 +199,12 @@ static int __init init_cpu_info(enum arch_id arch)
                return -EIO;
        }
        zfcpdump_save_areas[0] = sa;
-
-#ifdef __s390x__
-       /* convert s390x regs to s390, if we are dumping an s390 Linux */
-
-       if (arch == ARCH_S390)
-               s390x_to_s390_save_areas();
-#endif
-
        return 0;
 }
 
 static DEFINE_MUTEX(zcore_mutex);
 
-#define DUMP_VERSION   0x3
+#define DUMP_VERSION   0x5
 #define DUMP_MAGIC     0xa8190173618f23fdULL
 #define DUMP_ARCH_S390X        2
 #define DUMP_ARCH_S390 1
@@ -279,7 +229,14 @@ struct zcore_header {
        u32 volnr;
        u32 build_arch;
        u64 rmem_size;
-       char pad2[4016];
+       u8 mvdump;
+       u16 cpu_cnt;
+       u16 real_cpu_cnt;
+       u8 end_pad1[0x200-0x061];
+       u64 mvdump_sign;
+       u64 mvdump_zipl_time;
+       u8 end_pad2[0x800-0x210];
+       u32 lc_vec[512];
 } __attribute__((packed,__aligned__(16)));
 
 static struct zcore_header zcore_header = {
@@ -289,7 +246,7 @@ static struct zcore_header zcore_header = {
        .dump_level     = 0,
        .page_size      = PAGE_SIZE,
        .mem_start      = 0,
-#ifdef __s390x__
+#ifdef CONFIG_64BIT
        .build_arch     = DUMP_ARCH_S390X,
 #else
        .build_arch     = DUMP_ARCH_S390,
@@ -340,11 +297,7 @@ static int zcore_add_lc(char __user *buf, unsigned long start, size_t count)
                unsigned long prefix;
                unsigned long sa_off, len, buf_off;
 
-               if (sys_info.arch == ARCH_S390)
-                       prefix = zfcpdump_save_areas[i]->s390.pref_reg;
-               else
-                       prefix = zfcpdump_save_areas[i]->s390x.pref_reg;
-
+               prefix = zfcpdump_save_areas[i]->pref_reg;
                sa_start = prefix + sys_info.sa_base;
                sa_end = prefix + sys_info.sa_base + sys_info.sa_size;
 
@@ -561,34 +514,39 @@ static const struct file_operations zcore_reipl_fops = {
        .release        = zcore_reipl_release,
 };
 
+#ifdef CONFIG_32BIT
 
-static void __init set_s390_lc_mask(union save_area *map)
+static void __init set_lc_mask(struct save_area *map)
 {
-       memset(&map->s390.ext_save, 0xff, sizeof(map->s390.ext_save));
-       memset(&map->s390.timer, 0xff, sizeof(map->s390.timer));
-       memset(&map->s390.clk_cmp, 0xff, sizeof(map->s390.clk_cmp));
-       memset(&map->s390.psw, 0xff, sizeof(map->s390.psw));
-       memset(&map->s390.pref_reg, 0xff, sizeof(map->s390.pref_reg));
-       memset(&map->s390.acc_regs, 0xff, sizeof(map->s390.acc_regs));
-       memset(&map->s390.fp_regs, 0xff, sizeof(map->s390.fp_regs));
-       memset(&map->s390.gp_regs, 0xff, sizeof(map->s390.gp_regs));
-       memset(&map->s390.ctrl_regs, 0xff, sizeof(map->s390.ctrl_regs));
+       memset(&map->ext_save, 0xff, sizeof(map->ext_save));
+       memset(&map->timer, 0xff, sizeof(map->timer));
+       memset(&map->clk_cmp, 0xff, sizeof(map->clk_cmp));
+       memset(&map->psw, 0xff, sizeof(map->psw));
+       memset(&map->pref_reg, 0xff, sizeof(map->pref_reg));
+       memset(&map->acc_regs, 0xff, sizeof(map->acc_regs));
+       memset(&map->fp_regs, 0xff, sizeof(map->fp_regs));
+       memset(&map->gp_regs, 0xff, sizeof(map->gp_regs));
+       memset(&map->ctrl_regs, 0xff, sizeof(map->ctrl_regs));
 }
 
-static void __init set_s390x_lc_mask(union save_area *map)
+#else /* CONFIG_32BIT */
+
+static void __init set_lc_mask(struct save_area *map)
 {
-       memset(&map->s390x.fp_regs, 0xff, sizeof(map->s390x.fp_regs));
-       memset(&map->s390x.gp_regs, 0xff, sizeof(map->s390x.gp_regs));
-       memset(&map->s390x.psw, 0xff, sizeof(map->s390x.psw));
-       memset(&map->s390x.pref_reg, 0xff, sizeof(map->s390x.pref_reg));
-       memset(&map->s390x.fp_ctrl_reg, 0xff, sizeof(map->s390x.fp_ctrl_reg));
-       memset(&map->s390x.tod_reg, 0xff, sizeof(map->s390x.tod_reg));
-       memset(&map->s390x.timer, 0xff, sizeof(map->s390x.timer));
-       memset(&map->s390x.clk_cmp, 0xff, sizeof(map->s390x.clk_cmp));
-       memset(&map->s390x.acc_regs, 0xff, sizeof(map->s390x.acc_regs));
-       memset(&map->s390x.ctrl_regs, 0xff, sizeof(map->s390x.ctrl_regs));
+       memset(&map->fp_regs, 0xff, sizeof(map->fp_regs));
+       memset(&map->gp_regs, 0xff, sizeof(map->gp_regs));
+       memset(&map->psw, 0xff, sizeof(map->psw));
+       memset(&map->pref_reg, 0xff, sizeof(map->pref_reg));
+       memset(&map->fp_ctrl_reg, 0xff, sizeof(map->fp_ctrl_reg));
+       memset(&map->tod_reg, 0xff, sizeof(map->tod_reg));
+       memset(&map->timer, 0xff, sizeof(map->timer));
+       memset(&map->clk_cmp, 0xff, sizeof(map->clk_cmp));
+       memset(&map->acc_regs, 0xff, sizeof(map->acc_regs));
+       memset(&map->ctrl_regs, 0xff, sizeof(map->ctrl_regs));
 }
 
+#endif /* CONFIG_32BIT */
+
 /*
  * Initialize dump globals for a given architecture
  */
@@ -599,21 +557,18 @@ static int __init sys_info_init(enum arch_id arch)
        switch (arch) {
        case ARCH_S390X:
                pr_alert("DETECTED 'S390X (64 bit) OS'\n");
-               sys_info.sa_base = SAVE_AREA_BASE_S390X;
-               sys_info.sa_size = sizeof(struct save_area_s390x);
-               set_s390x_lc_mask(&sys_info.lc_mask);
                break;
        case ARCH_S390:
                pr_alert("DETECTED 'S390 (32 bit) OS'\n");
-               sys_info.sa_base = SAVE_AREA_BASE_S390;
-               sys_info.sa_size = sizeof(struct save_area_s390);
-               set_s390_lc_mask(&sys_info.lc_mask);
                break;
        default:
                pr_alert("0x%x is an unknown architecture.\n",arch);
                return -EINVAL;
        }
+       sys_info.sa_base = SAVE_AREA_BASE;
+       sys_info.sa_size = sizeof(struct save_area);
        sys_info.arch = arch;
+       set_lc_mask(&sys_info.lc_mask);
        rc = init_cpu_info(arch);
        if (rc)
                return rc;
@@ -660,8 +615,9 @@ static int __init get_mem_size(unsigned long *mem)
 
 static int __init zcore_header_init(int arch, struct zcore_header *hdr)
 {
-       int rc;
+       int rc, i;
        unsigned long memory = 0;
+       u32 prefix;
 
        if (arch == ARCH_S390X)
                hdr->arch_id = DUMP_ARCH_S390X;
@@ -676,6 +632,14 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr)
        hdr->num_pages = memory / PAGE_SIZE;
        hdr->tod = get_clock();
        get_cpu_id(&hdr->cpu_id);
+       for (i = 0; zfcpdump_save_areas[i]; i++) {
+               prefix = zfcpdump_save_areas[i]->pref_reg;
+               hdr->real_cpu_cnt++;
+               if (!prefix)
+                       continue;
+               hdr->lc_vec[hdr->cpu_cnt] = prefix;
+               hdr->cpu_cnt++;
+       }
        return 0;
 }
 
@@ -741,14 +705,21 @@ static int __init zcore_init(void)
        if (rc)
                goto fail;
 
-#ifndef __s390x__
+#ifdef CONFIG_64BIT
+       if (arch == ARCH_S390) {
+               pr_alert("The 64-bit dump tool cannot be used for a "
+                        "32-bit system\n");
+               rc = -EINVAL;
+               goto fail;
+       }
+#else /* CONFIG_64BIT */
        if (arch == ARCH_S390X) {
                pr_alert("The 32-bit dump tool cannot be used for a "
                         "64-bit system\n");
                rc = -EINVAL;
                goto fail;
        }
-#endif
+#endif /* CONFIG_64BIT */
 
        rc = sys_info_init(arch);
        if (rc)
index 7a28a3029a3f9d747a9ecf59d572c7146de74a1b..37df42af05ec604112871912cc58d57f47d19f19 100644 (file)
@@ -224,8 +224,8 @@ static void ccwreq_log_status(struct ccw_device *cdev, enum io_status status)
  */
 void ccw_request_handler(struct ccw_device *cdev)
 {
+       struct irb *irb = (struct irb *)&S390_lowcore.irb;
        struct ccw_request *req = &cdev->private->req;
-       struct irb *irb = (struct irb *) __LC_IRB;
        enum io_status status;
        int rc = -EOPNOTSUPP;
 
index 1ecd3e567648f0cf97dec1b0d63060450aae2037..4038f5b4f144e565bae3a5aac6201bce651b41bb 100644 (file)
@@ -574,7 +574,7 @@ int __chsc_do_secm(struct channel_subsystem *css, int enable, void *page)
        secm_area->request.length = 0x0050;
        secm_area->request.code = 0x0016;
 
-       secm_area->key = PAGE_DEFAULT_KEY;
+       secm_area->key = PAGE_DEFAULT_KEY >> 4;
        secm_area->cub_addr1 = (u64)(unsigned long)css->cub_addr1;
        secm_area->cub_addr2 = (u64)(unsigned long)css->cub_addr2;
 
index cc5144b6f9d9c590f56bdb9112774130f23f97ed..852612f5dba0607d81b29c8ae5ecd8c7ca44053d 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 
+#include <asm/compat.h>
 #include <asm/cio.h>
 #include <asm/chsc.h>
 #include <asm/isc.h>
@@ -50,7 +51,7 @@ static void chsc_subchannel_irq(struct subchannel *sch)
 {
        struct chsc_private *private = sch->private;
        struct chsc_request *request = private->request;
-       struct irb *irb = (struct irb *)__LC_IRB;
+       struct irb *irb = (struct irb *)&S390_lowcore.irb;
 
        CHSC_LOG(4, "irb");
        CHSC_LOG_HEX(4, irb, sizeof(*irb));
@@ -236,7 +237,7 @@ static int chsc_async(struct chsc_async_area *chsc_area,
        int ret = -ENODEV;
        char dbf[10];
 
-       chsc_area->header.key = PAGE_DEFAULT_KEY;
+       chsc_area->header.key = PAGE_DEFAULT_KEY >> 4;
        while ((sch = chsc_get_next_subchannel(sch))) {
                spin_lock(sch->lock);
                private = sch->private;
@@ -770,24 +771,30 @@ out_free:
 static long chsc_ioctl(struct file *filp, unsigned int cmd,
                       unsigned long arg)
 {
+       void __user *argp;
+
        CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd);
+       if (is_compat_task())
+               argp = compat_ptr(arg);
+       else
+               argp = (void __user *)arg;
        switch (cmd) {
        case CHSC_START:
-               return chsc_ioctl_start((void __user *)arg);
+               return chsc_ioctl_start(argp);
        case CHSC_INFO_CHANNEL_PATH:
-               return chsc_ioctl_info_channel_path((void __user *)arg);
+               return chsc_ioctl_info_channel_path(argp);
        case CHSC_INFO_CU:
-               return chsc_ioctl_info_cu((void __user *)arg);
+               return chsc_ioctl_info_cu(argp);
        case CHSC_INFO_SCH_CU:
-               return chsc_ioctl_info_sch_cu((void __user *)arg);
+               return chsc_ioctl_info_sch_cu(argp);
        case CHSC_INFO_CI:
-               return chsc_ioctl_conf_info((void __user *)arg);
+               return chsc_ioctl_conf_info(argp);
        case CHSC_INFO_CCL:
-               return chsc_ioctl_conf_comp_list((void __user *)arg);
+               return chsc_ioctl_conf_comp_list(argp);
        case CHSC_INFO_CPD:
-               return chsc_ioctl_chpd((void __user *)arg);
+               return chsc_ioctl_chpd(argp);
        case CHSC_INFO_DCAL:
-               return chsc_ioctl_dcal((void __user *)arg);
+               return chsc_ioctl_dcal(argp);
        default: /* unknown ioctl number */
                return -ENOIOCTLCMD;
        }
index 126f240715a426ecdc115f3fc514173c1442d5cb..f736cdcf08ad79ee5522b5143888933292c63ef7 100644 (file)
@@ -625,8 +625,8 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
        /*
         * Get interrupt information from lowcore
         */
-       tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
-       irb = (struct irb *) __LC_IRB;
+       tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id;
+       irb = (struct irb *)&S390_lowcore.irb;
        do {
                kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++;
                /*
@@ -661,7 +661,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
                 * We don't do this for VM because a tpi drops the cpu
                 * out of the sie which costs more cycles than it saves.
                 */
-       } while (!MACHINE_IS_VM && tpi (NULL) != 0);
+       } while (MACHINE_IS_LPAR && tpi(NULL) != 0);
        irq_exit();
        set_irq_regs(old_regs);
 }
@@ -682,10 +682,10 @@ static int cio_tpi(void)
        struct irb *irb;
        int irq_context;
 
-       tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
+       tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id;
        if (tpi(NULL) != 1)
                return 0;
-       irb = (struct irb *) __LC_IRB;
+       irb = (struct irb *)&S390_lowcore.irb;
        /* Store interrupt response block to lowcore. */
        if (tsch(tpi_info->schid, irb) != 0)
                /* Not status pending or not operational. */
@@ -885,7 +885,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid)
                struct tpi_info ti;
 
                if (tpi(&ti)) {
-                       tsch(ti.schid, (struct irb *)__LC_IRB);
+                       tsch(ti.schid, (struct irb *)&S390_lowcore.irb);
                        if (schid_equal(&ti.schid, &schid))
                                return 0;
                }
@@ -1083,7 +1083,7 @@ int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo)
        struct subchannel_id schid;
        struct schib schib;
 
-       schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID;
+       schid = *(struct subchannel_id *)&S390_lowcore.subchannel_id;
        if (!schid.one)
                return -ENODEV;
        if (stsch(schid, &schib))
index d157665d0e761a1521d07dc9785ca4e799d4b704..425f741a280c4668ba17befa8762b4bd227fcb24 100644 (file)
@@ -8,15 +8,16 @@
  *              Heiko Carstens <heiko.carstens@de.ibm.com>,
  */
 
-#include <linux/semaphore.h>
 #include <linux/mutex.h>
 #include <linux/kthread.h>
 #include <linux/init.h>
+#include <linux/wait.h>
 #include <asm/crw.h>
 
-static struct semaphore crw_semaphore;
 static DEFINE_MUTEX(crw_handler_mutex);
 static crw_handler_t crw_handlers[NR_RSCS];
+static atomic_t crw_nr_req = ATOMIC_INIT(0);
+static DECLARE_WAIT_QUEUE_HEAD(crw_handler_wait_q);
 
 /**
  * crw_register_handler() - register a channel report word handler
@@ -59,12 +60,14 @@ void crw_unregister_handler(int rsc)
 static int crw_collect_info(void *unused)
 {
        struct crw crw[2];
-       int ccode;
+       int ccode, signal;
        unsigned int chain;
-       int ignore;
 
 repeat:
-       ignore = down_interruptible(&crw_semaphore);
+       signal = wait_event_interruptible(crw_handler_wait_q,
+                                         atomic_read(&crw_nr_req) > 0);
+       if (unlikely(signal))
+               atomic_inc(&crw_nr_req);
        chain = 0;
        while (1) {
                crw_handler_t handler;
@@ -122,25 +125,23 @@ repeat:
                /* chain is always 0 or 1 here. */
                chain = crw[chain].chn ? chain + 1 : 0;
        }
+       if (atomic_dec_and_test(&crw_nr_req))
+               wake_up(&crw_handler_wait_q);
        goto repeat;
        return 0;
 }
 
 void crw_handle_channel_report(void)
 {
-       up(&crw_semaphore);
+       atomic_inc(&crw_nr_req);
+       wake_up(&crw_handler_wait_q);
 }
 
-/*
- * Separate initcall needed for semaphore initialization since
- * crw_handle_channel_report might be called before crw_machine_check_init.
- */
-static int __init crw_init_semaphore(void)
+void crw_wait_for_channel_report(void)
 {
-       init_MUTEX_LOCKED(&crw_semaphore);
-       return 0;
+       crw_handle_channel_report();
+       wait_event(crw_handler_wait_q, atomic_read(&crw_nr_req) == 0);
 }
-pure_initcall(crw_init_semaphore);
 
 /*
  * Machine checks for the channel subsystem must be enabled
index 7679aee6fa147af0459855a899888850752437a4..2769da54f2b96ebf9f26f86ff76c049ff71c5e82 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/list.h>
 #include <linux/reboot.h>
 #include <linux/suspend.h>
+#include <linux/proc_fs.h>
 #include <asm/isc.h>
 #include <asm/crw.h>
 
@@ -232,7 +233,7 @@ void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo)
        if (!get_device(&sch->dev))
                return;
        sch->todo = todo;
-       if (!queue_work(slow_path_wq, &sch->todo_work)) {
+       if (!queue_work(cio_work_q, &sch->todo_work)) {
                /* Already queued, release workqueue ref. */
                put_device(&sch->dev);
        }
@@ -543,7 +544,7 @@ static void css_slow_path_func(struct work_struct *unused)
 }
 
 static DECLARE_WORK(slow_path_work, css_slow_path_func);
-struct workqueue_struct *slow_path_wq;
+struct workqueue_struct *cio_work_q;
 
 void css_schedule_eval(struct subchannel_id schid)
 {
@@ -552,7 +553,7 @@ void css_schedule_eval(struct subchannel_id schid)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_sch_add(slow_subchannel_set, schid);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(slow_path_wq, &slow_path_work);
+       queue_work(cio_work_q, &slow_path_work);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
@@ -563,7 +564,7 @@ void css_schedule_eval_all(void)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_fill(slow_subchannel_set);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(slow_path_wq, &slow_path_work);
+       queue_work(cio_work_q, &slow_path_work);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
@@ -594,14 +595,14 @@ void css_schedule_eval_all_unreg(void)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_add_set(slow_subchannel_set, unreg_set);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(slow_path_wq, &slow_path_work);
+       queue_work(cio_work_q, &slow_path_work);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
        idset_free(unreg_set);
 }
 
 void css_wait_for_slow_path(void)
 {
-       flush_workqueue(slow_path_wq);
+       flush_workqueue(cio_work_q);
 }
 
 /* Schedule reprobing of all unregistered subchannels. */
@@ -992,12 +993,21 @@ static int __init channel_subsystem_init(void)
        ret = css_bus_init();
        if (ret)
                return ret;
-
+       cio_work_q = create_singlethread_workqueue("cio");
+       if (!cio_work_q) {
+               ret = -ENOMEM;
+               goto out_bus;
+       }
        ret = io_subchannel_init();
        if (ret)
-               css_bus_cleanup();
+               goto out_wq;
 
        return ret;
+out_wq:
+       destroy_workqueue(cio_work_q);
+out_bus:
+       css_bus_cleanup();
+       return ret;
 }
 subsys_initcall(channel_subsystem_init);
 
@@ -1006,10 +1016,25 @@ static int css_settle(struct device_driver *drv, void *unused)
        struct css_driver *cssdrv = to_cssdriver(drv);
 
        if (cssdrv->settle)
-               cssdrv->settle();
+               return cssdrv->settle();
        return 0;
 }
 
+int css_complete_work(void)
+{
+       int ret;
+
+       /* Wait for the evaluation of subchannels to finish. */
+       ret = wait_event_interruptible(css_eval_wq,
+                                      atomic_read(&css_eval_scheduled) == 0);
+       if (ret)
+               return -EINTR;
+       flush_workqueue(cio_work_q);
+       /* Wait for the subchannel type specific initialization to finish */
+       return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle);
+}
+
+
 /*
  * Wait for the initialization of devices to finish, to make sure we are
  * done with our setup if the search for the root device starts.
@@ -1018,13 +1043,41 @@ static int __init channel_subsystem_init_sync(void)
 {
        /* Start initial subchannel evaluation. */
        css_schedule_eval_all();
-       /* Wait for the evaluation of subchannels to finish. */
-       wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0);
-       /* Wait for the subchannel type specific initialization to finish */
-       return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle);
+       css_complete_work();
+       return 0;
 }
 subsys_initcall_sync(channel_subsystem_init_sync);
 
+#ifdef CONFIG_PROC_FS
+static ssize_t cio_settle_write(struct file *file, const char __user *buf,
+                               size_t count, loff_t *ppos)
+{
+       int ret;
+
+       /* Handle pending CRW's. */
+       crw_wait_for_channel_report();
+       ret = css_complete_work();
+
+       return ret ? ret : count;
+}
+
+static const struct file_operations cio_settle_proc_fops = {
+       .write = cio_settle_write,
+};
+
+static int __init cio_settle_init(void)
+{
+       struct proc_dir_entry *entry;
+
+       entry = proc_create("cio_settle", S_IWUSR, NULL,
+                           &cio_settle_proc_fops);
+       if (!entry)
+               return -ENOMEM;
+       return 0;
+}
+device_initcall(cio_settle_init);
+#endif /*CONFIG_PROC_FS*/
+
 int sch_is_pseudo_sch(struct subchannel *sch)
 {
        return sch == to_css(sch->dev.parent)->pseudo_subchannel;
index fe84b92cde60aa83f0e1affdb3c664ec16441123..7e37886de2310f0cabbf3fd51bfcd3987efc2090 100644 (file)
@@ -95,7 +95,7 @@ struct css_driver {
        int (*freeze)(struct subchannel *);
        int (*thaw) (struct subchannel *);
        int (*restore)(struct subchannel *);
-       void (*settle)(void);
+       int (*settle)(void);
        const char *name;
 };
 
@@ -146,12 +146,13 @@ extern struct channel_subsystem *channel_subsystems[];
 /* Helper functions to build lists for the slow path. */
 void css_schedule_eval(struct subchannel_id schid);
 void css_schedule_eval_all(void);
+int css_complete_work(void);
 
 int sch_is_pseudo_sch(struct subchannel *);
 struct schib;
 int css_sch_is_valid(struct schib *);
 
-extern struct workqueue_struct *slow_path_wq;
+extern struct workqueue_struct *cio_work_q;
 void css_wait_for_slow_path(void);
 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo);
 #endif
index a6c7d5426fb2ba4dd2bd24d349562f84a4893fcf..c6abb75c4615e2ff04d78edee05cce26a2d0c1c1 100644 (file)
@@ -136,7 +136,6 @@ static int io_subchannel_sch_event(struct subchannel *, int);
 static int io_subchannel_chp_event(struct subchannel *, struct chp_link *,
                                   int);
 static void recovery_func(unsigned long data);
-struct workqueue_struct *ccw_device_work;
 wait_queue_head_t ccw_device_init_wq;
 atomic_t ccw_device_init_count;
 
@@ -159,11 +158,16 @@ static int io_subchannel_prepare(struct subchannel *sch)
        return 0;
 }
 
-static void io_subchannel_settle(void)
+static int io_subchannel_settle(void)
 {
-       wait_event(ccw_device_init_wq,
-                  atomic_read(&ccw_device_init_count) == 0);
-       flush_workqueue(ccw_device_work);
+       int ret;
+
+       ret = wait_event_interruptible(ccw_device_init_wq,
+                               atomic_read(&ccw_device_init_count) == 0);
+       if (ret)
+               return -EINTR;
+       flush_workqueue(cio_work_q);
+       return 0;
 }
 
 static struct css_driver io_subchannel_driver = {
@@ -188,27 +192,13 @@ int __init io_subchannel_init(void)
        atomic_set(&ccw_device_init_count, 0);
        setup_timer(&recovery_timer, recovery_func, 0);
 
-       ccw_device_work = create_singlethread_workqueue("cio");
-       if (!ccw_device_work)
-               return -ENOMEM;
-       slow_path_wq = create_singlethread_workqueue("kslowcrw");
-       if (!slow_path_wq) {
-               ret = -ENOMEM;
-               goto out_err;
-       }
-       if ((ret = bus_register (&ccw_bus_type)))
-               goto out_err;
-
+       ret = bus_register(&ccw_bus_type);
+       if (ret)
+               return ret;
        ret = css_driver_register(&io_subchannel_driver);
        if (ret)
-               goto out_err;
+               bus_unregister(&ccw_bus_type);
 
-       return 0;
-out_err:
-       if (ccw_device_work)
-               destroy_workqueue(ccw_device_work);
-       if (slow_path_wq)
-               destroy_workqueue(slow_path_wq);
        return ret;
 }
 
@@ -1348,7 +1338,7 @@ static enum io_sch_action sch_get_action(struct subchannel *sch)
                /* Not operational. */
                if (!cdev)
                        return IO_SCH_UNREG;
-               if (!ccw_device_notify(cdev, CIO_GONE))
+               if (ccw_device_notify(cdev, CIO_GONE) != NOTIFY_OK)
                        return IO_SCH_UNREG;
                return IO_SCH_ORPH_UNREG;
        }
@@ -1356,12 +1346,12 @@ static enum io_sch_action sch_get_action(struct subchannel *sch)
        if (!cdev)
                return IO_SCH_ATTACH;
        if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
-               if (!ccw_device_notify(cdev, CIO_GONE))
+               if (ccw_device_notify(cdev, CIO_GONE) != NOTIFY_OK)
                        return IO_SCH_UNREG_ATTACH;
                return IO_SCH_ORPH_ATTACH;
        }
        if ((sch->schib.pmcw.pam & sch->opm) == 0) {
-               if (!ccw_device_notify(cdev, CIO_NO_PATH))
+               if (ccw_device_notify(cdev, CIO_NO_PATH) != NOTIFY_OK)
                        return IO_SCH_UNREG;
                return IO_SCH_DISC;
        }
@@ -1410,6 +1400,12 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
                rc = 0;
                goto out_unlock;
        case IO_SCH_VERIFY:
+               if (cdev->private->flags.resuming == 1) {
+                       if (cio_enable_subchannel(sch, (u32)(addr_t)sch)) {
+                               ccw_device_set_notoper(cdev);
+                               break;
+                       }
+               }
                /* Trigger path verification. */
                io_subchannel_verify(sch);
                rc = 0;
@@ -1448,7 +1444,8 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
                break;
        case IO_SCH_UNREG_ATTACH:
                /* Unregister ccw device. */
-               ccw_device_unregister(cdev);
+               if (!cdev->private->flags.resuming)
+                       ccw_device_unregister(cdev);
                break;
        default:
                break;
@@ -1457,7 +1454,8 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
        switch (action) {
        case IO_SCH_ORPH_UNREG:
        case IO_SCH_UNREG:
-               css_sch_device_unregister(sch);
+               if (!cdev || !cdev->private->flags.resuming)
+                       css_sch_device_unregister(sch);
                break;
        case IO_SCH_ORPH_ATTACH:
        case IO_SCH_UNREG_ATTACH:
@@ -1779,26 +1777,42 @@ static void __ccw_device_pm_restore(struct ccw_device *cdev)
 {
        struct subchannel *sch = to_subchannel(cdev->dev.parent);
 
-       if (cio_is_console(sch->schid))
-               goto out;
+       spin_lock_irq(sch->lock);
+       if (cio_is_console(sch->schid)) {
+               cio_enable_subchannel(sch, (u32)(addr_t)sch);
+               goto out_unlock;
+       }
        /*
         * While we were sleeping, devices may have gone or become
         * available again. Kick re-detection.
         */
-       spin_lock_irq(sch->lock);
        cdev->private->flags.resuming = 1;
+       css_schedule_eval(sch->schid);
+       spin_unlock_irq(sch->lock);
+       css_complete_work();
+
+       /* cdev may have been moved to a different subchannel. */
+       sch = to_subchannel(cdev->dev.parent);
+       spin_lock_irq(sch->lock);
+       if (cdev->private->state != DEV_STATE_ONLINE &&
+           cdev->private->state != DEV_STATE_OFFLINE)
+               goto out_unlock;
+
        ccw_device_recognition(cdev);
        spin_unlock_irq(sch->lock);
        wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev) ||
                   cdev->private->state == DEV_STATE_DISCONNECTED);
-out:
+       spin_lock_irq(sch->lock);
+
+out_unlock:
        cdev->private->flags.resuming = 0;
+       spin_unlock_irq(sch->lock);
 }
 
 static int resume_handle_boxed(struct ccw_device *cdev)
 {
        cdev->private->state = DEV_STATE_BOXED;
-       if (ccw_device_notify(cdev, CIO_BOXED))
+       if (ccw_device_notify(cdev, CIO_BOXED) == NOTIFY_OK)
                return 0;
        ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
        return -ENODEV;
@@ -1807,7 +1821,7 @@ static int resume_handle_boxed(struct ccw_device *cdev)
 static int resume_handle_disc(struct ccw_device *cdev)
 {
        cdev->private->state = DEV_STATE_DISCONNECTED;
-       if (ccw_device_notify(cdev, CIO_GONE))
+       if (ccw_device_notify(cdev, CIO_GONE) == NOTIFY_OK)
                return 0;
        ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
        return -ENODEV;
@@ -1816,40 +1830,31 @@ static int resume_handle_disc(struct ccw_device *cdev)
 static int ccw_device_pm_restore(struct device *dev)
 {
        struct ccw_device *cdev = to_ccwdev(dev);
-       struct subchannel *sch = to_subchannel(cdev->dev.parent);
-       int ret = 0, cm_enabled;
+       struct subchannel *sch;
+       int ret = 0;
 
        __ccw_device_pm_restore(cdev);
+       sch = to_subchannel(cdev->dev.parent);
        spin_lock_irq(sch->lock);
-       if (cio_is_console(sch->schid)) {
-               cio_enable_subchannel(sch, (u32)(addr_t)sch);
-               spin_unlock_irq(sch->lock);
+       if (cio_is_console(sch->schid))
                goto out_restore;
-       }
-       cdev->private->flags.donotify = 0;
+
        /* check recognition results */
        switch (cdev->private->state) {
        case DEV_STATE_OFFLINE:
+       case DEV_STATE_ONLINE:
+               cdev->private->flags.donotify = 0;
                break;
        case DEV_STATE_BOXED:
                ret = resume_handle_boxed(cdev);
-               spin_unlock_irq(sch->lock);
                if (ret)
-                       goto out;
+                       goto out_unlock;
                goto out_restore;
-       case DEV_STATE_DISCONNECTED:
-               goto out_disc_unlock;
        default:
-               goto out_unreg_unlock;
-       }
-       /* check if the device id has changed */
-       if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
-               CIO_MSG_EVENT(0, "resume: sch 0.%x.%04x: failed (devno "
-                             "changed from %04x to %04x)\n",
-                             sch->schid.ssid, sch->schid.sch_no,
-                             cdev->private->dev_id.devno,
-                             sch->schib.pmcw.dev);
-               goto out_unreg_unlock;
+               ret = resume_handle_disc(cdev);
+               if (ret)
+                       goto out_unlock;
+               goto out_restore;
        }
        /* check if the device type has changed */
        if (!ccw_device_test_sense_data(cdev)) {
@@ -1858,24 +1863,30 @@ static int ccw_device_pm_restore(struct device *dev)
                ret = -ENODEV;
                goto out_unlock;
        }
-       if (!cdev->online) {
-               ret = 0;
+       if (!cdev->online)
                goto out_unlock;
-       }
-       ret = ccw_device_online(cdev);
-       if (ret)
-               goto out_disc_unlock;
 
-       cm_enabled = cdev->private->cmb != NULL;
+       if (ccw_device_online(cdev)) {
+               ret = resume_handle_disc(cdev);
+               if (ret)
+                       goto out_unlock;
+               goto out_restore;
+       }
        spin_unlock_irq(sch->lock);
-
        wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
-       if (cdev->private->state != DEV_STATE_ONLINE) {
-               spin_lock_irq(sch->lock);
-               goto out_disc_unlock;
+       spin_lock_irq(sch->lock);
+
+       if (ccw_device_notify(cdev, CIO_OPER) == NOTIFY_BAD) {
+               ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
+               ret = -ENODEV;
+               goto out_unlock;
        }
-       if (cm_enabled) {
+
+       /* reenable cmf, if needed */
+       if (cdev->private->cmb) {
+               spin_unlock_irq(sch->lock);
                ret = ccw_set_cmf(cdev, 1);
+               spin_lock_irq(sch->lock);
                if (ret) {
                        CIO_MSG_EVENT(2, "resume: cdev 0.%x.%04x: cmf failed "
                                      "(rc=%d)\n", cdev->private->dev_id.ssid,
@@ -1885,21 +1896,11 @@ static int ccw_device_pm_restore(struct device *dev)
        }
 
 out_restore:
+       spin_unlock_irq(sch->lock);
        if (cdev->online && cdev->drv && cdev->drv->restore)
                ret = cdev->drv->restore(cdev);
-out:
        return ret;
 
-out_disc_unlock:
-       ret = resume_handle_disc(cdev);
-       spin_unlock_irq(sch->lock);
-       if (ret)
-               return ret;
-       goto out_restore;
-
-out_unreg_unlock:
-       ccw_device_sched_todo(cdev, CDEV_TODO_UNREG_EVAL);
-       ret = -ENODEV;
 out_unlock:
        spin_unlock_irq(sch->lock);
        return ret;
@@ -2028,7 +2029,7 @@ void ccw_device_sched_todo(struct ccw_device *cdev, enum cdev_todo todo)
        /* Get workqueue ref. */
        if (!get_device(&cdev->dev))
                return;
-       if (!queue_work(slow_path_wq, &cdev->private->todo_work)) {
+       if (!queue_work(cio_work_q, &cdev->private->todo_work)) {
                /* Already queued, release workqueue ref. */
                put_device(&cdev->dev);
        }
@@ -2041,5 +2042,4 @@ EXPORT_SYMBOL(ccw_driver_register);
 EXPORT_SYMBOL(ccw_driver_unregister);
 EXPORT_SYMBOL(get_ccwdev_by_busid);
 EXPORT_SYMBOL(ccw_bus_type);
-EXPORT_SYMBOL(ccw_device_work);
 EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id);
index bcfe13e426380de4d1376c9760bdfcf15c98fc21..379de2d1ec496a3895f42946b8080d99f88d1a71 100644 (file)
@@ -4,7 +4,7 @@
 #include <asm/ccwdev.h>
 #include <asm/atomic.h>
 #include <linux/wait.h>
-
+#include <linux/notifier.h>
 #include "io_sch.h"
 
 /*
@@ -71,7 +71,6 @@ dev_fsm_final_state(struct ccw_device *cdev)
                cdev->private->state == DEV_STATE_BOXED);
 }
 
-extern struct workqueue_struct *ccw_device_work;
 extern wait_queue_head_t ccw_device_init_wq;
 extern atomic_t ccw_device_init_count;
 int __init io_subchannel_init(void);
index ae760658a131f43ecbaa7cd49c1d20082364e742..c56ab94612f9c47697246eaff1daed49a4558028 100644 (file)
@@ -313,21 +313,43 @@ ccw_device_sense_id_done(struct ccw_device *cdev, int err)
        }
 }
 
+/**
+  * ccw_device_notify() - inform the device's driver about an event
+  * @cdev: device for which an event occured
+  * @event: event that occurred
+  *
+  * Returns:
+  *   -%EINVAL if the device is offline or has no driver.
+  *   -%EOPNOTSUPP if the device's driver has no notifier registered.
+  *   %NOTIFY_OK if the driver wants to keep the device.
+  *   %NOTIFY_BAD if the driver doesn't want to keep the device.
+  */
 int ccw_device_notify(struct ccw_device *cdev, int event)
 {
+       int ret = -EINVAL;
+
        if (!cdev->drv)
-               return 0;
+               goto out;
        if (!cdev->online)
-               return 0;
+               goto out;
        CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n",
                      cdev->private->dev_id.ssid, cdev->private->dev_id.devno,
                      event);
-       return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0;
+       if (!cdev->drv->notify) {
+               ret = -EOPNOTSUPP;
+               goto out;
+       }
+       if (cdev->drv->notify(cdev, event))
+               ret = NOTIFY_OK;
+       else
+               ret = NOTIFY_BAD;
+out:
+       return ret;
 }
 
 static void ccw_device_oper_notify(struct ccw_device *cdev)
 {
-       if (ccw_device_notify(cdev, CIO_OPER)) {
+       if (ccw_device_notify(cdev, CIO_OPER) == NOTIFY_OK) {
                /* Reenable channel measurements, if needed. */
                ccw_device_sched_todo(cdev, CDEV_TODO_ENABLE_CMF);
                return;
@@ -361,14 +383,15 @@ ccw_device_done(struct ccw_device *cdev, int state)
        case DEV_STATE_BOXED:
                CIO_MSG_EVENT(0, "Boxed device %04x on subchannel %04x\n",
                              cdev->private->dev_id.devno, sch->schid.sch_no);
-               if (cdev->online && !ccw_device_notify(cdev, CIO_BOXED))
+               if (cdev->online &&
+                   ccw_device_notify(cdev, CIO_BOXED) != NOTIFY_OK)
                        ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
                cdev->private->flags.donotify = 0;
                break;
        case DEV_STATE_NOT_OPER:
                CIO_MSG_EVENT(0, "Device %04x gone on subchannel %04x\n",
                              cdev->private->dev_id.devno, sch->schid.sch_no);
-               if (!ccw_device_notify(cdev, CIO_GONE))
+               if (ccw_device_notify(cdev, CIO_GONE) != NOTIFY_OK)
                        ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
                else
                        ccw_device_set_disconnected(cdev);
@@ -378,7 +401,7 @@ ccw_device_done(struct ccw_device *cdev, int state)
                CIO_MSG_EVENT(0, "Disconnected device %04x on subchannel "
                              "%04x\n", cdev->private->dev_id.devno,
                              sch->schid.sch_no);
-               if (!ccw_device_notify(cdev, CIO_NO_PATH))
+               if (ccw_device_notify(cdev, CIO_NO_PATH) != NOTIFY_OK)
                        ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
                else
                        ccw_device_set_disconnected(cdev);
@@ -586,7 +609,7 @@ ccw_device_offline(struct ccw_device *cdev)
 static void ccw_device_generic_notoper(struct ccw_device *cdev,
                                       enum dev_event dev_event)
 {
-       if (!ccw_device_notify(cdev, CIO_GONE))
+       if (ccw_device_notify(cdev, CIO_GONE) != NOTIFY_OK)
                ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
        else
                ccw_device_set_disconnected(cdev);
@@ -667,7 +690,7 @@ ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event)
        struct irb *irb;
        int is_cmd;
 
-       irb = (struct irb *) __LC_IRB;
+       irb = (struct irb *)&S390_lowcore.irb;
        is_cmd = !scsw_is_tm(&irb->scsw);
        /* Check for unsolicited interrupt. */
        if (!scsw_is_solicited(&irb->scsw)) {
@@ -732,7 +755,7 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event)
 {
        struct irb *irb;
 
-       irb = (struct irb *) __LC_IRB;
+       irb = (struct irb *)&S390_lowcore.irb;
        /* Check for unsolicited interrupt. */
        if (scsw_stctl(&irb->scsw) ==
            (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
index 44f2f6a97f33afeee0326a1e502c934313253209..48aa0647432bb258d5ce97aa8db72a497cc2a52e 100644 (file)
@@ -208,18 +208,27 @@ struct qdio_dev_perf_stat {
        unsigned int eqbs_partial;
        unsigned int sqbs;
        unsigned int sqbs_partial;
+} ____cacheline_aligned;
+
+struct qdio_queue_perf_stat {
+       /*
+        * Sorted into order-2 buckets: 1, 2-3, 4-7, ... 64-127, 128.
+        * Since max. 127 SBALs are scanned reuse entry for 128 as queue full
+        * aka 127 SBALs found.
+        */
+       unsigned int nr_sbals[8];
+       unsigned int nr_sbal_error;
+       unsigned int nr_sbal_nop;
+       unsigned int nr_sbal_total;
 };
 
 struct qdio_input_q {
        /* input buffer acknowledgement flag */
        int polling;
-
        /* first ACK'ed buffer */
        int ack_start;
-
        /* how much sbals are acknowledged with qebsm */
        int ack_count;
-
        /* last time of noticing incoming data */
        u64 timestamp;
 };
@@ -227,40 +236,27 @@ struct qdio_input_q {
 struct qdio_output_q {
        /* PCIs are enabled for the queue */
        int pci_out_enabled;
-
        /* IQDIO: output multiple buffers (enhanced SIGA) */
        int use_enh_siga;
-
        /* timer to check for more outbound work */
        struct timer_list timer;
 };
 
+/*
+ * Note on cache alignment: grouped slsb and write mostly data at the beginning
+ * sbal[] is read-only and starts on a new cacheline followed by read mostly.
+ */
 struct qdio_q {
        struct slsb slsb;
+
        union {
                struct qdio_input_q in;
                struct qdio_output_q out;
        } u;
 
-       /* queue number */
-       int nr;
-
-       /* bitmask of queue number */
-       int mask;
-
-       /* input or output queue */
-       int is_input_q;
-
-       /* list of thinint input queues */
-       struct list_head entry;
-
-       /* upper-layer program handler */
-       qdio_handler_t (*handler);
-
        /*
         * inbound: next buffer the program should check for
-        * outbound: next buffer to check for having been processed
-        * by the card
+        * outbound: next buffer to check if adapter processed it
         */
        int first_to_check;
 
@@ -273,16 +269,32 @@ struct qdio_q {
        /* number of buffers in use by the adapter */
        atomic_t nr_buf_used;
 
-       struct qdio_irq *irq_ptr;
-       struct dentry *debugfs_q;
-       struct tasklet_struct tasklet;
-
        /* error condition during a data transfer */
        unsigned int qdio_error;
 
-       struct sl *sl;
-       struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
+       struct tasklet_struct tasklet;
+       struct qdio_queue_perf_stat q_stats;
+
+       struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q] ____cacheline_aligned;
+
+       /* queue number */
+       int nr;
+
+       /* bitmask of queue number */
+       int mask;
+
+       /* input or output queue */
+       int is_input_q;
+
+       /* list of thinint input queues */
+       struct list_head entry;
 
+       /* upper-layer program handler */
+       qdio_handler_t (*handler);
+
+       struct dentry *debugfs_q;
+       struct qdio_irq *irq_ptr;
+       struct sl *sl;
        /*
         * Warning: Leave this member at the end so it won't be cleared in
         * qdio_fill_qs. A page is allocated under this pointer and used for
@@ -317,12 +329,8 @@ struct qdio_irq {
        struct qdio_ssqd_desc ssqd_desc;
        void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *);
 
-       struct qdio_dev_perf_stat perf_stat;
        int perf_stat_enabled;
-       /*
-        * Warning: Leave these members together at the end so they won't be
-        * cleared in qdio_setup_irq.
-        */
+
        struct qdr *qdr;
        unsigned long chsc_page;
 
@@ -331,6 +339,7 @@ struct qdio_irq {
 
        debug_info_t *debug_area;
        struct mutex setup_mutex;
+       struct qdio_dev_perf_stat perf_stat;
 };
 
 /* helper functions */
@@ -341,9 +350,20 @@ struct qdio_irq {
        (irq->qib.qfmt == QDIO_IQDIO_QFMT || \
         css_general_characteristics.aif_osa)
 
-#define qperf(qdev,attr)       qdev->perf_stat.attr
-#define qperf_inc(q,attr)      if (q->irq_ptr->perf_stat_enabled) \
-                                       q->irq_ptr->perf_stat.attr++
+#define qperf(__qdev, __attr)  ((__qdev)->perf_stat.(__attr))
+
+#define qperf_inc(__q, __attr)                                         \
+({                                                                     \
+       struct qdio_irq *qdev = (__q)->irq_ptr;                         \
+       if (qdev->perf_stat_enabled)                                    \
+               (qdev->perf_stat.__attr)++;                             \
+})
+
+static inline void account_sbals_error(struct qdio_q *q, int count)
+{
+       q->q_stats.nr_sbal_error += count;
+       q->q_stats.nr_sbal_total += count;
+}
 
 /* the highest iqdio queue is used for multicast */
 static inline int multicast_outbound(struct qdio_q *q)
index f49761ff9a00a648b5f70e5500c7efb70cac6277..c94eb2a0fa2ed2fb3c02f807b1dabc762a9d680f 100644 (file)
@@ -60,7 +60,7 @@ static int qstat_show(struct seq_file *m, void *v)
        seq_printf(m, "ftc: %d  last_move: %d\n", q->first_to_check, q->last_move);
        seq_printf(m, "polling: %d  ack start: %d  ack count: %d\n",
                   q->u.in.polling, q->u.in.ack_start, q->u.in.ack_count);
-       seq_printf(m, "slsb buffer states:\n");
+       seq_printf(m, "SBAL states:\n");
        seq_printf(m, "|0      |8      |16     |24     |32     |40     |48     |56  63|\n");
 
        for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) {
@@ -97,6 +97,20 @@ static int qstat_show(struct seq_file *m, void *v)
        }
        seq_printf(m, "\n");
        seq_printf(m, "|64     |72     |80     |88     |96     |104    |112    |   127|\n");
+
+       seq_printf(m, "\nSBAL statistics:");
+       if (!q->irq_ptr->perf_stat_enabled) {
+               seq_printf(m, " disabled\n");
+               return 0;
+       }
+
+       seq_printf(m, "\n1          2..        4..        8..        "
+                  "16..       32..       64..       127\n");
+       for (i = 0; i < ARRAY_SIZE(q->q_stats.nr_sbals); i++)
+               seq_printf(m, "%-10u ", q->q_stats.nr_sbals[i]);
+       seq_printf(m, "\nError      NOP        Total\n%-10u %-10u %-10u\n\n",
+                  q->q_stats.nr_sbal_error, q->q_stats.nr_sbal_nop,
+                  q->q_stats.nr_sbal_total);
        return 0;
 }
 
@@ -181,9 +195,10 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
 {
        struct seq_file *seq = file->private_data;
        struct qdio_irq *irq_ptr = seq->private;
+       struct qdio_q *q;
        unsigned long val;
        char buf[8];
-       int ret;
+       int ret, i;
 
        if (!irq_ptr)
                return 0;
@@ -201,6 +216,10 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
        case 0:
                irq_ptr->perf_stat_enabled = 0;
                memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat));
+               for_each_input_queue(irq_ptr, q, i)
+                       memset(&q->q_stats, 0, sizeof(q->q_stats));
+               for_each_output_queue(irq_ptr, q, i)
+                       memset(&q->q_stats, 0, sizeof(q->q_stats));
                break;
        case 1:
                irq_ptr->perf_stat_enabled = 1;
index 999fe80c40516983d68a6435b5718c5433af1737..232ef047ba34f1704ed1efd29f45dcf8516a6d64 100644 (file)
@@ -392,6 +392,20 @@ static inline void qdio_stop_polling(struct qdio_q *q)
                set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
 }
 
+static inline void account_sbals(struct qdio_q *q, int count)
+{
+       int pos = 0;
+
+       q->q_stats.nr_sbal_total += count;
+       if (count == QDIO_MAX_BUFFERS_MASK) {
+               q->q_stats.nr_sbals[7]++;
+               return;
+       }
+       while (count >>= 1)
+               pos++;
+       q->q_stats.nr_sbals[pos]++;
+}
+
 static void announce_buffer_error(struct qdio_q *q, int count)
 {
        q->qdio_error |= QDIO_ERROR_SLSB_STATE;
@@ -487,16 +501,22 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
                q->first_to_check = add_buf(q->first_to_check, count);
                if (atomic_sub(count, &q->nr_buf_used) == 0)
                        qperf_inc(q, inbound_queue_full);
+               if (q->irq_ptr->perf_stat_enabled)
+                       account_sbals(q, count);
                break;
        case SLSB_P_INPUT_ERROR:
                announce_buffer_error(q, count);
                /* process the buffer, the upper layer will take care of it */
                q->first_to_check = add_buf(q->first_to_check, count);
                atomic_sub(count, &q->nr_buf_used);
+               if (q->irq_ptr->perf_stat_enabled)
+                       account_sbals_error(q, count);
                break;
        case SLSB_CU_INPUT_EMPTY:
        case SLSB_P_INPUT_NOT_INIT:
        case SLSB_P_INPUT_ACK:
+               if (q->irq_ptr->perf_stat_enabled)
+                       q->q_stats.nr_sbal_nop++;
                DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in nop");
                break;
        default:
@@ -514,7 +534,7 @@ static int qdio_inbound_q_moved(struct qdio_q *q)
 
        if ((bufnr != q->last_move) || q->qdio_error) {
                q->last_move = bufnr;
-               if (!is_thinint_irq(q->irq_ptr) && !MACHINE_IS_VM)
+               if (!is_thinint_irq(q->irq_ptr) && MACHINE_IS_LPAR)
                        q->u.in.timestamp = get_usecs();
                return 1;
        } else
@@ -531,7 +551,7 @@ static inline int qdio_inbound_q_done(struct qdio_q *q)
        qdio_siga_sync_q(q);
        get_buf_state(q, q->first_to_check, &state, 0);
 
-       if (state == SLSB_P_INPUT_PRIMED)
+       if (state == SLSB_P_INPUT_PRIMED || state == SLSB_P_INPUT_ERROR)
                /* more work coming */
                return 0;
 
@@ -643,15 +663,21 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
 
                atomic_sub(count, &q->nr_buf_used);
                q->first_to_check = add_buf(q->first_to_check, count);
+               if (q->irq_ptr->perf_stat_enabled)
+                       account_sbals(q, count);
                break;
        case SLSB_P_OUTPUT_ERROR:
                announce_buffer_error(q, count);
                /* process the buffer, the upper layer will take care of it */
                q->first_to_check = add_buf(q->first_to_check, count);
                atomic_sub(count, &q->nr_buf_used);
+               if (q->irq_ptr->perf_stat_enabled)
+                       account_sbals_error(q, count);
                break;
        case SLSB_CU_OUTPUT_PRIMED:
                /* the adapter has not fetched the output yet */
+               if (q->irq_ptr->perf_stat_enabled)
+                       q->q_stats.nr_sbal_nop++;
                DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "out primed:%1d", q->nr);
                break;
        case SLSB_P_OUTPUT_NOT_INIT:
@@ -960,6 +986,8 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
                        qdio_handle_activate_check(cdev, intparm, cstat,
                                                   dstat);
                break;
+       case QDIO_IRQ_STATE_STOPPED:
+               break;
        default:
                WARN_ON(1);
        }
index 8c2dea5fa2b48b6bd559cc5e77c49c8f26e76956..7f4a75465140d768dff0f5729ceeaedfffddffb2 100644 (file)
@@ -333,10 +333,10 @@ static void __qdio_allocate_fill_qdr(struct qdio_irq *irq_ptr,
        irq_ptr->qdr->qdf0[i + nr].slsba =
                (unsigned long)&irq_ptr_qs[i]->slsb.val[0];
 
-       irq_ptr->qdr->qdf0[i + nr].akey = PAGE_DEFAULT_KEY;
-       irq_ptr->qdr->qdf0[i + nr].bkey = PAGE_DEFAULT_KEY;
-       irq_ptr->qdr->qdf0[i + nr].ckey = PAGE_DEFAULT_KEY;
-       irq_ptr->qdr->qdf0[i + nr].dkey = PAGE_DEFAULT_KEY;
+       irq_ptr->qdr->qdf0[i + nr].akey = PAGE_DEFAULT_KEY >> 4;
+       irq_ptr->qdr->qdf0[i + nr].bkey = PAGE_DEFAULT_KEY >> 4;
+       irq_ptr->qdr->qdf0[i + nr].ckey = PAGE_DEFAULT_KEY >> 4;
+       irq_ptr->qdr->qdf0[i + nr].dkey = PAGE_DEFAULT_KEY >> 4;
 }
 
 static void setup_qdr(struct qdio_irq *irq_ptr,
@@ -350,7 +350,7 @@ static void setup_qdr(struct qdio_irq *irq_ptr,
        irq_ptr->qdr->iqdsz = sizeof(struct qdesfmt0) / 4; /* size in words */
        irq_ptr->qdr->oqdsz = sizeof(struct qdesfmt0) / 4;
        irq_ptr->qdr->qiba = (unsigned long)&irq_ptr->qib;
-       irq_ptr->qdr->qkey = PAGE_DEFAULT_KEY;
+       irq_ptr->qdr->qkey = PAGE_DEFAULT_KEY >> 4;
 
        for (i = 0; i < qdio_init->no_input_qs; i++)
                __qdio_allocate_fill_qdr(irq_ptr, irq_ptr->input_qs, i, 0);
@@ -382,7 +382,15 @@ int qdio_setup_irq(struct qdio_initialize *init_data)
        struct qdio_irq *irq_ptr = init_data->cdev->private->qdio_data;
        int rc;
 
-       memset(irq_ptr, 0, ((char *)&irq_ptr->qdr) - ((char *)irq_ptr));
+       memset(&irq_ptr->qib, 0, sizeof(irq_ptr->qib));
+       memset(&irq_ptr->siga_flag, 0, sizeof(irq_ptr->siga_flag));
+       memset(&irq_ptr->ccw, 0, sizeof(irq_ptr->ccw));
+       memset(&irq_ptr->ssqd_desc, 0, sizeof(irq_ptr->ssqd_desc));
+       memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat));
+
+       irq_ptr->debugfs_dev = irq_ptr->debugfs_perf = NULL;
+       irq_ptr->sch_token = irq_ptr->state = irq_ptr->perf_stat_enabled = 0;
+
        /* wipes qib.ac, required by ar7063 */
        memset(irq_ptr->qdr, 0, sizeof(struct qdr));
 
index 091d904d3182a566fc059e11fd193adb5d574cbb..9942c1031b25332ba133ff4916907c395e4c0b7b 100644 (file)
@@ -198,8 +198,8 @@ static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset)
                .code   = 0x0021,
        };
        scssc_area->operation_code = 0;
-       scssc_area->ks = PAGE_DEFAULT_KEY;
-       scssc_area->kc = PAGE_DEFAULT_KEY;
+       scssc_area->ks = PAGE_DEFAULT_KEY >> 4;
+       scssc_area->kc = PAGE_DEFAULT_KEY >> 4;
        scssc_area->isc = QDIO_AIRQ_ISC;
        scssc_area->schid = irq_ptr->schid;
 
index 0d4d18bdd45ca26ab685fa112eb752be5a3ded5f..ba50fe02e572a40957780eebf825581e46c7c1c6 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/compat.h>
 #include <linux/smp_lock.h>
 #include <asm/atomic.h>
@@ -393,10 +394,12 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
                         * u_mult_inv > 128 bytes.
                         */
                        if (copied == 0) {
-                               int len;
+                               unsigned int len;
                                spin_unlock_bh(&zcrypt_device_lock);
                                /* len is max 256 / 2 - 120 = 8 */
                                len = crt->inputdatalength / 2 - 120;
+                               if (len > sizeof(z1))
+                                       return -EFAULT;
                                z1 = z2 = z3 = 0;
                                if (copy_from_user(&z1, crt->np_prime, len) ||
                                    copy_from_user(&z2, crt->bp_key, len) ||
@@ -910,126 +913,105 @@ static struct miscdevice zcrypt_misc_device = {
  */
 static struct proc_dir_entry *zcrypt_entry;
 
-static int sprintcl(unsigned char *outaddr, unsigned char *addr,
-                   unsigned int len)
+static void sprintcl(struct seq_file *m, unsigned char *addr, unsigned int len)
 {
-       int hl, i;
+       int i;
 
-       hl = 0;
        for (i = 0; i < len; i++)
-               hl += sprintf(outaddr+hl, "%01x", (unsigned int) addr[i]);
-       hl += sprintf(outaddr+hl, " ");
-       return hl;
+               seq_printf(m, "%01x", (unsigned int) addr[i]);
+       seq_putc(m, ' ');
 }
 
-static int sprintrw(unsigned char *outaddr, unsigned char *addr,
-                   unsigned int len)
+static void sprintrw(struct seq_file *m, unsigned char *addr, unsigned int len)
 {
-       int hl, inl, c, cx;
+       int inl, c, cx;
 
-       hl = sprintf(outaddr, "    ");
+       seq_printf(m, "    ");
        inl = 0;
        for (c = 0; c < (len / 16); c++) {
-               hl += sprintcl(outaddr+hl, addr+inl, 16);
+               sprintcl(m, addr+inl, 16);
                inl += 16;
        }
        cx = len%16;
        if (cx) {
-               hl += sprintcl(outaddr+hl, addr+inl, cx);
+               sprintcl(m, addr+inl, cx);
                inl += cx;
        }
-       hl += sprintf(outaddr+hl, "\n");
-       return hl;
+       seq_putc(m, '\n');
 }
 
-static int sprinthx(unsigned char *title, unsigned char *outaddr,
-                   unsigned char *addr, unsigned int len)
+static void sprinthx(unsigned char *title, struct seq_file *m,
+                    unsigned char *addr, unsigned int len)
 {
-       int hl, inl, r, rx;
+       int inl, r, rx;
 
-       hl = sprintf(outaddr, "\n%s\n", title);
+       seq_printf(m, "\n%s\n", title);
        inl = 0;
        for (r = 0; r < (len / 64); r++) {
-               hl += sprintrw(outaddr+hl, addr+inl, 64);
+               sprintrw(m, addr+inl, 64);
                inl += 64;
        }
        rx = len % 64;
        if (rx) {
-               hl += sprintrw(outaddr+hl, addr+inl, rx);
+               sprintrw(m, addr+inl, rx);
                inl += rx;
        }
-       hl += sprintf(outaddr+hl, "\n");
-       return hl;
+       seq_putc(m, '\n');
 }
 
-static int sprinthx4(unsigned char *title, unsigned char *outaddr,
-                    unsigned int *array, unsigned int len)
+static void sprinthx4(unsigned char *title, struct seq_file *m,
+                     unsigned int *array, unsigned int len)
 {
-       int hl, r;
+       int r;
 
-       hl = sprintf(outaddr, "\n%s\n", title);
+       seq_printf(m, "\n%s\n", title);
        for (r = 0; r < len; r++) {
                if ((r % 8) == 0)
-                       hl += sprintf(outaddr+hl, "    ");
-               hl += sprintf(outaddr+hl, "%08X ", array[r]);
+                       seq_printf(m, "    ");
+               seq_printf(m, "%08X ", array[r]);
                if ((r % 8) == 7)
-                       hl += sprintf(outaddr+hl, "\n");
+                       seq_putc(m, '\n');
        }
-       hl += sprintf(outaddr+hl, "\n");
-       return hl;
+       seq_putc(m, '\n');
 }
 
-static int zcrypt_status_read(char *resp_buff, char **start, off_t offset,
-                             int count, int *eof, void *data)
+static int zcrypt_proc_show(struct seq_file *m, void *v)
 {
-       unsigned char *workarea;
-       int len;
-
-       len = 0;
-
-       /* resp_buff is a page. Use the right half for a work area */
-       workarea = resp_buff + 2000;
-       len += sprintf(resp_buff + len, "\nzcrypt version: %d.%d.%d\n",
-               ZCRYPT_VERSION, ZCRYPT_RELEASE, ZCRYPT_VARIANT);
-       len += sprintf(resp_buff + len, "Cryptographic domain: %d\n",
-                      ap_domain_index);
-       len += sprintf(resp_buff + len, "Total device count: %d\n",
-                      zcrypt_device_count);
-       len += sprintf(resp_buff + len, "PCICA count: %d\n",
-                      zcrypt_count_type(ZCRYPT_PCICA));
-       len += sprintf(resp_buff + len, "PCICC count: %d\n",
-                      zcrypt_count_type(ZCRYPT_PCICC));
-       len += sprintf(resp_buff + len, "PCIXCC MCL2 count: %d\n",
-                      zcrypt_count_type(ZCRYPT_PCIXCC_MCL2));
-       len += sprintf(resp_buff + len, "PCIXCC MCL3 count: %d\n",
-                      zcrypt_count_type(ZCRYPT_PCIXCC_MCL3));
-       len += sprintf(resp_buff + len, "CEX2C count: %d\n",
-                      zcrypt_count_type(ZCRYPT_CEX2C));
-       len += sprintf(resp_buff + len, "CEX2A count: %d\n",
-                      zcrypt_count_type(ZCRYPT_CEX2A));
-       len += sprintf(resp_buff + len, "CEX3C count: %d\n",
-                      zcrypt_count_type(ZCRYPT_CEX3C));
-       len += sprintf(resp_buff + len, "CEX3A count: %d\n",
-                      zcrypt_count_type(ZCRYPT_CEX3A));
-       len += sprintf(resp_buff + len, "requestq count: %d\n",
-                      zcrypt_requestq_count());
-       len += sprintf(resp_buff + len, "pendingq count: %d\n",
-                      zcrypt_pendingq_count());
-       len += sprintf(resp_buff + len, "Total open handles: %d\n\n",
-                      atomic_read(&zcrypt_open_count));
+       char workarea[sizeof(int) * AP_DEVICES];
+
+       seq_printf(m, "\nzcrypt version: %d.%d.%d\n",
+                  ZCRYPT_VERSION, ZCRYPT_RELEASE, ZCRYPT_VARIANT);
+       seq_printf(m, "Cryptographic domain: %d\n", ap_domain_index);
+       seq_printf(m, "Total device count: %d\n", zcrypt_device_count);
+       seq_printf(m, "PCICA count: %d\n", zcrypt_count_type(ZCRYPT_PCICA));
+       seq_printf(m, "PCICC count: %d\n", zcrypt_count_type(ZCRYPT_PCICC));
+       seq_printf(m, "PCIXCC MCL2 count: %d\n",
+                  zcrypt_count_type(ZCRYPT_PCIXCC_MCL2));
+       seq_printf(m, "PCIXCC MCL3 count: %d\n",
+                  zcrypt_count_type(ZCRYPT_PCIXCC_MCL3));
+       seq_printf(m, "CEX2C count: %d\n", zcrypt_count_type(ZCRYPT_CEX2C));
+       seq_printf(m, "CEX2A count: %d\n", zcrypt_count_type(ZCRYPT_CEX2A));
+       seq_printf(m, "CEX3C count: %d\n", zcrypt_count_type(ZCRYPT_CEX3C));
+       seq_printf(m, "CEX3A count: %d\n", zcrypt_count_type(ZCRYPT_CEX3A));
+       seq_printf(m, "requestq count: %d\n", zcrypt_requestq_count());
+       seq_printf(m, "pendingq count: %d\n", zcrypt_pendingq_count());
+       seq_printf(m, "Total open handles: %d\n\n",
+                  atomic_read(&zcrypt_open_count));
        zcrypt_status_mask(workarea);
-       len += sprinthx("Online devices: 1=PCICA 2=PCICC 3=PCIXCC(MCL2) "
-                       "4=PCIXCC(MCL3) 5=CEX2C 6=CEX2A 7=CEX3C 8=CEX3A",
-                       resp_buff+len, workarea, AP_DEVICES);
+       sprinthx("Online devices: 1=PCICA 2=PCICC 3=PCIXCC(MCL2) "
+                "4=PCIXCC(MCL3) 5=CEX2C 6=CEX2A 7=CEX3C 8=CEX3A",
+                m, workarea, AP_DEVICES);
        zcrypt_qdepth_mask(workarea);
-       len += sprinthx("Waiting work element counts",
-                       resp_buff+len, workarea, AP_DEVICES);
+       sprinthx("Waiting work element counts", m, workarea, AP_DEVICES);
        zcrypt_perdev_reqcnt((int *) workarea);
-       len += sprinthx4("Per-device successfully completed request counts",
-                        resp_buff+len,(unsigned int *) workarea, AP_DEVICES);
-       *eof = 1;
-       memset((void *) workarea, 0x00, AP_DEVICES * sizeof(unsigned int));
-       return len;
+       sprinthx4("Per-device successfully completed request counts",
+                 m, (unsigned int *) workarea, AP_DEVICES);
+       return 0;
+}
+
+static int zcrypt_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, zcrypt_proc_show, NULL);
 }
 
 static void zcrypt_disable_card(int index)
@@ -1059,11 +1041,11 @@ static void zcrypt_enable_card(int index)
        spin_unlock_bh(&zcrypt_device_lock);
 }
 
-static int zcrypt_status_write(struct file *file, const char __user *buffer,
-                              unsigned long count, void *data)
+static ssize_t zcrypt_proc_write(struct file *file, const char __user *buffer,
+                                size_t count, loff_t *pos)
 {
        unsigned char *lbuf, *ptr;
-       unsigned long local_count;
+       size_t local_count;
        int j;
 
        if (count <= 0)
@@ -1113,6 +1095,15 @@ out:
        return count;
 }
 
+static const struct file_operations zcrypt_proc_fops = {
+       .owner          = THIS_MODULE,
+       .open           = zcrypt_proc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+       .write          = zcrypt_proc_write,
+};
+
 static int zcrypt_rng_device_count;
 static u32 *zcrypt_rng_buffer;
 static int zcrypt_rng_buffer_index;
@@ -1195,14 +1186,11 @@ int __init zcrypt_api_init(void)
                goto out;
 
        /* Set up the proc file system */
-       zcrypt_entry = create_proc_entry("driver/z90crypt", 0644, NULL);
+       zcrypt_entry = proc_create("driver/z90crypt", 0644, NULL, &zcrypt_proc_fops);
        if (!zcrypt_entry) {
                rc = -ENOMEM;
                goto out_misc;
        }
-       zcrypt_entry->data = NULL;
-       zcrypt_entry->read_proc = zcrypt_status_read;
-       zcrypt_entry->write_proc = zcrypt_status_write;
 
        return 0;
 
index a23726a0735c0c04c1f759138e563a8c9ddabe7d..142f72a2ca5a75ec7ea1bf4d2d3fa2a2219dad1f 100644 (file)
@@ -373,6 +373,8 @@ static int convert_type86(struct zcrypt_device *zdev,
                        zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
                        return -EAGAIN;
                }
+               if (service_rc == 8 && service_rs == 72)
+                       return -EINVAL;
                zdev->online = 0;
                return -EAGAIN; /* repeat the request on a different device. */
        }
index 79c120578e617e2141b6c4e88abac9e17a0505ee..68f3e6204db87079d5c1f49e700a1309026d3624 100644 (file)
@@ -470,6 +470,8 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
                }
                if (service_rc == 12 && service_rs == 769)
                        return -EINVAL;
+               if (service_rc == 8 && service_rs == 72)
+                       return -EINVAL;
                zdev->online = 0;
                return -EAGAIN; /* repeat the request on a different device. */
        }
index 2930fc763ac565957bff662d91b6747cee192801..b2fc4fd63f7f09b1be3ee84ac90d12287e6ec99e 100644 (file)
@@ -340,11 +340,11 @@ static void kvm_extint_handler(u16 code)
                return;
 
        /* The LSB might be overloaded, we have to mask it */
-       vq = (struct virtqueue *) ((*(long *) __LC_PFAULT_INTPARM) & ~1UL);
+       vq = (struct virtqueue *)(S390_lowcore.ext_params2 & ~1UL);
 
        /* We use the LSB of extparam, to decide, if this interrupt is a config
         * change or a "standard" interrupt */
-       config_changed =  (*(int *)  __LC_EXT_PARAMS & 1);
+       config_changed = S390_lowcore.ext_params & 1;
 
        if (config_changed) {
                struct virtio_driver *drv;
index 9d0c941b7d336b63736d3b16a029e3c1b04a6de6..66d6c01fcf3e32ed9e720ad4a3f58733f6c4798b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Module interface and handling of zfcp data structures.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 /*
@@ -32,6 +32,7 @@
 #include <linux/seq_file.h>
 #include "zfcp_ext.h"
 #include "zfcp_fc.h"
+#include "zfcp_reqlist.h"
 
 #define ZFCP_BUS_ID_SIZE       20
 
@@ -49,36 +50,6 @@ static struct kmem_cache *zfcp_cache_hw_align(const char *name,
        return kmem_cache_create(name, size, roundup_pow_of_two(size), 0, NULL);
 }
 
-static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
-{
-       int idx;
-
-       adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head),
-                                   GFP_KERNEL);
-       if (!adapter->req_list)
-               return -ENOMEM;
-
-       for (idx = 0; idx < REQUEST_LIST_SIZE; idx++)
-               INIT_LIST_HEAD(&adapter->req_list[idx]);
-       return 0;
-}
-
-/**
- * zfcp_reqlist_isempty - is the request list empty
- * @adapter: pointer to struct zfcp_adapter
- *
- * Returns: true if list is empty, false otherwise
- */
-int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
-{
-       unsigned int idx;
-
-       for (idx = 0; idx < REQUEST_LIST_SIZE; idx++)
-               if (!list_empty(&adapter->req_list[idx]))
-                       return 0;
-       return 1;
-}
-
 static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
 {
        struct ccw_device *cdev;
@@ -110,7 +81,7 @@ static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
        flush_work(&unit->scsi_work);
 
 out_unit:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 out_port:
        zfcp_ccw_adapter_put(adapter);
 out_ccw_device:
@@ -255,7 +226,7 @@ struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *port, u64 fcp_lun)
        read_lock_irqsave(&port->unit_list_lock, flags);
        list_for_each_entry(unit, &port->unit_list, list)
                if (unit->fcp_lun == fcp_lun) {
-                       if (!get_device(&unit->sysfs_device))
+                       if (!get_device(&unit->dev))
                                unit = NULL;
                        read_unlock_irqrestore(&port->unit_list_lock, flags);
                        return unit;
@@ -280,7 +251,7 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter,
        read_lock_irqsave(&adapter->port_list_lock, flags);
        list_for_each_entry(port, &adapter->port_list, list)
                if (port->wwpn == wwpn) {
-                       if (!get_device(&port->sysfs_device))
+                       if (!get_device(&port->dev))
                                port = NULL;
                        read_unlock_irqrestore(&adapter->port_list_lock, flags);
                        return port;
@@ -298,10 +269,9 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter,
  */
 static void zfcp_unit_release(struct device *dev)
 {
-       struct zfcp_unit *unit = container_of(dev, struct zfcp_unit,
-                                             sysfs_device);
+       struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
 
-       put_device(&unit->port->sysfs_device);
+       put_device(&unit->port->dev);
        kfree(unit);
 }
 
@@ -318,11 +288,11 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
        struct zfcp_unit *unit;
        int retval = -ENOMEM;
 
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
 
        unit = zfcp_get_unit_by_lun(port, fcp_lun);
        if (unit) {
-               put_device(&unit->sysfs_device);
+               put_device(&unit->dev);
                retval = -EEXIST;
                goto err_out;
        }
@@ -333,10 +303,10 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
 
        unit->port = port;
        unit->fcp_lun = fcp_lun;
-       unit->sysfs_device.parent = &port->sysfs_device;
-       unit->sysfs_device.release = zfcp_unit_release;
+       unit->dev.parent = &port->dev;
+       unit->dev.release = zfcp_unit_release;
 
-       if (dev_set_name(&unit->sysfs_device, "0x%016llx",
+       if (dev_set_name(&unit->dev, "0x%016llx",
                         (unsigned long long) fcp_lun)) {
                kfree(unit);
                goto err_out;
@@ -353,13 +323,12 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
        unit->latencies.cmd.channel.min = 0xFFFFFFFF;
        unit->latencies.cmd.fabric.min = 0xFFFFFFFF;
 
-       if (device_register(&unit->sysfs_device)) {
-               put_device(&unit->sysfs_device);
+       if (device_register(&unit->dev)) {
+               put_device(&unit->dev);
                goto err_out;
        }
 
-       if (sysfs_create_group(&unit->sysfs_device.kobj,
-                              &zfcp_sysfs_unit_attrs))
+       if (sysfs_create_group(&unit->dev.kobj, &zfcp_sysfs_unit_attrs))
                goto err_out_put;
 
        write_lock_irq(&port->unit_list_lock);
@@ -371,9 +340,9 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
        return unit;
 
 err_out_put:
-       device_unregister(&unit->sysfs_device);
+       device_unregister(&unit->dev);
 err_out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
        return ERR_PTR(retval);
 }
 
@@ -539,7 +508,8 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
        if (zfcp_allocate_low_mem_buffers(adapter))
                goto failed;
 
-       if (zfcp_reqlist_alloc(adapter))
+       adapter->req_list = zfcp_reqlist_alloc();
+       if (!adapter->req_list)
                goto failed;
 
        if (zfcp_dbf_adapter_register(adapter))
@@ -560,8 +530,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
        INIT_LIST_HEAD(&adapter->erp_ready_head);
        INIT_LIST_HEAD(&adapter->erp_running_head);
 
-       spin_lock_init(&adapter->req_list_lock);
-
        rwlock_init(&adapter->erp_lock);
        rwlock_init(&adapter->abort_lock);
 
@@ -640,8 +608,7 @@ void zfcp_device_unregister(struct device *dev,
 
 static void zfcp_port_release(struct device *dev)
 {
-       struct zfcp_port *port = container_of(dev, struct zfcp_port,
-                                             sysfs_device);
+       struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 
        zfcp_ccw_adapter_put(port->adapter);
        kfree(port);
@@ -669,7 +636,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
 
        port = zfcp_get_port_by_wwpn(adapter, wwpn);
        if (port) {
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
                retval = -EEXIST;
                goto err_out;
        }
@@ -689,22 +656,21 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
        port->d_id = d_id;
        port->wwpn = wwpn;
        port->rport_task = RPORT_NONE;
-       port->sysfs_device.parent = &adapter->ccw_device->dev;
-       port->sysfs_device.release = zfcp_port_release;
+       port->dev.parent = &adapter->ccw_device->dev;
+       port->dev.release = zfcp_port_release;
 
-       if (dev_set_name(&port->sysfs_device, "0x%016llx",
-                        (unsigned long long)wwpn)) {
+       if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) {
                kfree(port);
                goto err_out;
        }
        retval = -EINVAL;
 
-       if (device_register(&port->sysfs_device)) {
-               put_device(&port->sysfs_device);
+       if (device_register(&port->dev)) {
+               put_device(&port->dev);
                goto err_out;
        }
 
-       if (sysfs_create_group(&port->sysfs_device.kobj,
+       if (sysfs_create_group(&port->dev.kobj,
                               &zfcp_sysfs_port_attrs))
                goto err_out_put;
 
@@ -717,7 +683,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
        return port;
 
 err_out_put:
-       device_unregister(&port->sysfs_device);
+       device_unregister(&port->dev);
 err_out:
        zfcp_ccw_adapter_put(adapter);
        return ERR_PTR(retval);
index c22cb72a5ae8bdbe371ba8c5903b63c28d61a6e7..ce1cc7a11fb4334b2f25ea8407303df8b2db2027 100644 (file)
@@ -3,13 +3,14 @@
  *
  * Registration and callback for the s390 common I/O layer.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
 #include "zfcp_ext.h"
+#include "zfcp_reqlist.h"
 
 #define ZFCP_MODEL_PRIV 0x4
 
@@ -122,12 +123,10 @@ static void zfcp_ccw_remove(struct ccw_device *cdev)
        zfcp_ccw_adapter_put(adapter); /* put from zfcp_ccw_adapter_by_cdev */
 
        list_for_each_entry_safe(unit, u, &unit_remove_lh, list)
-               zfcp_device_unregister(&unit->sysfs_device,
-                                      &zfcp_sysfs_unit_attrs);
+               zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
 
        list_for_each_entry_safe(port, p, &port_remove_lh, list)
-               zfcp_device_unregister(&port->sysfs_device,
-                                      &zfcp_sysfs_port_attrs);
+               zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
 
        zfcp_adapter_unregister(adapter);
 }
@@ -162,7 +161,7 @@ static int zfcp_ccw_set_online(struct ccw_device *cdev)
        }
 
        /* initialize request counter */
-       BUG_ON(!zfcp_reqlist_isempty(adapter));
+       BUG_ON(!zfcp_reqlist_isempty(adapter->req_list));
        adapter->req_no = 0;
 
        zfcp_erp_modify_adapter_status(adapter, "ccsonl1", NULL,
index f932400e980a23dca4ac94cb318651771a9829cc..0eb6eefd2c1a0c457e7d19cdbe536af1f72fd941 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/types.h>
 #include <linux/miscdevice.h>
+#include <asm/compat.h>
 #include <asm/ccwdev.h>
 #include "zfcp_def.h"
 #include "zfcp_ext.h"
@@ -163,7 +164,7 @@ static void zfcp_cfdc_req_to_sense(struct zfcp_cfdc_data *data,
 }
 
 static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
-                               unsigned long buffer)
+                               unsigned long arg)
 {
        struct zfcp_cfdc_data *data;
        struct zfcp_cfdc_data __user *data_user;
@@ -175,7 +176,11 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
        if (command != ZFCP_CFDC_IOC)
                return -ENOTTY;
 
-       data_user = (void __user *) buffer;
+       if (is_compat_task())
+               data_user = compat_ptr(arg);
+       else
+               data_user = (void __user *)arg;
+
        if (!data_user)
                return -EINVAL;
 
index 84450955ae114acdb674dca6dfe3575caa3afde5..7a149fd85f6de3801e334df219809262742a987d 100644 (file)
@@ -140,9 +140,9 @@ void _zfcp_dbf_hba_fsf_response(const char *tag2, int level,
        memcpy(response->fsf_status_qual,
               fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE);
        response->fsf_req_status = fsf_req->status;
-       response->sbal_first = fsf_req->queue_req.sbal_first;
-       response->sbal_last = fsf_req->queue_req.sbal_last;
-       response->sbal_response = fsf_req->queue_req.sbal_response;
+       response->sbal_first = fsf_req->qdio_req.sbal_first;
+       response->sbal_last = fsf_req->qdio_req.sbal_last;
+       response->sbal_response = fsf_req->qdio_req.sbal_response;
        response->pool = fsf_req->pool != NULL;
        response->erp_action = (unsigned long)fsf_req->erp_action;
 
@@ -327,7 +327,7 @@ static void zfcp_dbf_hba_view_response(char **p,
                        break;
                zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd);
                zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial);
-               p += sprintf(*p, "\n");
+               *p += sprintf(*p, "\n");
                break;
 
        case FSF_QTCB_OPEN_PORT_WITH_DID:
@@ -576,7 +576,8 @@ void zfcp_dbf_rec_adapter(char *id, void *ref, struct zfcp_dbf *dbf)
        struct zfcp_adapter *adapter = dbf->adapter;
 
        zfcp_dbf_rec_target(id, ref, dbf, &adapter->status,
-                                 &adapter->erp_counter, 0, 0, 0);
+                           &adapter->erp_counter, 0, 0,
+                           ZFCP_DBF_INVALID_LUN);
 }
 
 /**
@@ -590,8 +591,8 @@ void zfcp_dbf_rec_port(char *id, void *ref, struct zfcp_port *port)
        struct zfcp_dbf *dbf = port->adapter->dbf;
 
        zfcp_dbf_rec_target(id, ref, dbf, &port->status,
-                                 &port->erp_counter, port->wwpn, port->d_id,
-                                 0);
+                           &port->erp_counter, port->wwpn, port->d_id,
+                           ZFCP_DBF_INVALID_LUN);
 }
 
 /**
@@ -642,10 +643,9 @@ void zfcp_dbf_rec_trigger(char *id2, void *ref, u8 want, u8 need, void *action,
                r->u.trigger.ps = atomic_read(&port->status);
                r->u.trigger.wwpn = port->wwpn;
        }
-       if (unit) {
+       if (unit)
                r->u.trigger.us = atomic_read(&unit->status);
-               r->u.trigger.fcp_lun = unit->fcp_lun;
-       }
+       r->u.trigger.fcp_lun = unit ? unit->fcp_lun : ZFCP_DBF_INVALID_LUN;
        debug_event(dbf->rec, action ? 1 : 4, r, sizeof(*r));
        spin_unlock_irqrestore(&dbf->rec_lock, flags);
 }
@@ -668,7 +668,7 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
        r->u.action.action = (unsigned long)erp_action;
        r->u.action.status = erp_action->status;
        r->u.action.step = erp_action->step;
-       r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
+       r->u.action.fsf_req = erp_action->fsf_req_id;
        debug_event(dbf->rec, 5, r, sizeof(*r));
        spin_unlock_irqrestore(&dbf->rec_lock, flags);
 }
index 8b7fd9a1033e014252dea2657f32f0902858c99f..457e046f2d286fa4131986122e399139d11a60fa 100644 (file)
@@ -30,6 +30,8 @@
 #define ZFCP_DBF_TAG_SIZE      4
 #define ZFCP_DBF_ID_SIZE       7
 
+#define ZFCP_DBF_INVALID_LUN   0xFFFFFFFFFFFFFFFFull
+
 struct zfcp_dbf_dump {
        u8 tag[ZFCP_DBF_TAG_SIZE];
        u32 total_size;         /* size of total dump data */
@@ -192,10 +194,10 @@ struct zfcp_dbf_san_record {
                struct zfcp_dbf_san_record_ct_response ct_resp;
                struct zfcp_dbf_san_record_els els;
        } u;
-#define ZFCP_DBF_SAN_MAX_PAYLOAD 1024
-       u8 payload[32];
 } __attribute__ ((packed));
 
+#define ZFCP_DBF_SAN_MAX_PAYLOAD 1024
+
 struct zfcp_dbf_scsi_record {
        u8 tag[ZFCP_DBF_TAG_SIZE];
        u8 tag2[ZFCP_DBF_TAG_SIZE];
@@ -301,17 +303,31 @@ void zfcp_dbf_scsi(const char *tag, const char *tag2, int level,
 
 /**
  * zfcp_dbf_scsi_result - trace event for SCSI command completion
- * @tag: tag indicating success or failure of SCSI command
- * @level: trace level applicable for this event
- * @adapter: adapter that has been used to issue the SCSI command
+ * @dbf: adapter dbf trace
+ * @scmd: SCSI command pointer
+ * @req: FSF request used to issue SCSI command
+ */
+static inline
+void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd,
+                         struct zfcp_fsf_req *req)
+{
+       if (scmd->result != 0)
+               zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0);
+       else if (scmd->retries > 0)
+               zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0);
+       else
+               zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0);
+}
+
+/**
+ * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command
+ * @dbf: adapter dbf trace
  * @scmd: SCSI command pointer
- * @fsf_req: request used to issue SCSI command (might be NULL)
  */
 static inline
-void zfcp_dbf_scsi_result(const char *tag, int level, struct zfcp_dbf *dbf,
-                         struct scsi_cmnd *scmd, struct zfcp_fsf_req *fsf_req)
+void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd)
 {
-       zfcp_dbf_scsi("rslt", tag, level, dbf, scmd, fsf_req, 0);
+       zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0);
 }
 
 /**
index e1b5b88e2ddbb37e7c68bb22b036606e11b94f80..7131c7db1f0478afb91614a23e01d95bcc615c52 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Global definitions for the zfcp device driver.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #ifndef ZFCP_DEF_H
 #include <scsi/scsi_transport_fc.h>
 #include <scsi/scsi_bsg_fc.h>
 #include <asm/ccwdev.h>
-#include <asm/qdio.h>
 #include <asm/debug.h>
 #include <asm/ebcdic.h>
 #include <asm/sysinfo.h>
 #include "zfcp_fsf.h"
+#include "zfcp_qdio.h"
 
-/********************* GENERAL DEFINES *********************************/
-
-#define REQUEST_LIST_SIZE 128
+struct zfcp_reqlist;
 
 /********************* SCSI SPECIFIC DEFINES *********************************/
 #define ZFCP_SCSI_ER_TIMEOUT                    (10*HZ)
@@ -129,12 +127,6 @@ struct zfcp_adapter_mempool {
        mempool_t *qtcb_pool;
 };
 
-struct zfcp_qdio_queue {
-       struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
-       u8                 first;       /* index of next free bfr in queue */
-       atomic_t           count;       /* number of free buffers in queue */
-};
-
 struct zfcp_erp_action {
        struct list_head list;
        int action;                   /* requested action code */
@@ -143,8 +135,7 @@ struct zfcp_erp_action {
        struct zfcp_unit *unit;
        u32             status;       /* recovery status */
        u32 step;                     /* active step of this erp action */
-       struct zfcp_fsf_req *fsf_req; /* fsf request currently pending
-                                        for this action */
+       unsigned long           fsf_req_id;
        struct timer_list timer;
 };
 
@@ -167,29 +158,6 @@ struct zfcp_latencies {
        spinlock_t lock;
 };
 
-/** struct zfcp_qdio - basic QDIO data structure
- * @resp_q: response queue
- * @req_q: request queue
- * @stat_lock: lock to protect req_q_util and req_q_time
- * @req_q_lock; lock to serialize access to request queue
- * @req_q_time: time of last fill level change
- * @req_q_util: used for accounting
- * @req_q_full: queue full incidents
- * @req_q_wq: used to wait for SBAL availability
- * @adapter: adapter used in conjunction with this QDIO structure
- */
-struct zfcp_qdio {
-       struct zfcp_qdio_queue  resp_q;
-       struct zfcp_qdio_queue  req_q;
-       spinlock_t              stat_lock;
-       spinlock_t              req_q_lock;
-       unsigned long long      req_q_time;
-       u64                     req_q_util;
-       atomic_t                req_q_full;
-       wait_queue_head_t       req_q_wq;
-       struct zfcp_adapter     *adapter;
-};
-
 struct zfcp_adapter {
        struct kref             ref;
        u64                     peer_wwnn;         /* P2P peer WWNN */
@@ -207,8 +175,7 @@ struct zfcp_adapter {
        struct list_head        port_list;         /* remote port list */
        rwlock_t                port_list_lock;    /* port list lock */
        unsigned long           req_no;            /* unique FSF req number */
-       struct list_head        *req_list;         /* list of pending reqs */
-       spinlock_t              req_list_lock;     /* request list lock */
+       struct zfcp_reqlist     *req_list;
        u32                     fsf_req_seq_no;    /* FSF cmnd seq number */
        rwlock_t                abort_lock;        /* Protects against SCSI
                                                      stack abort/command
@@ -241,7 +208,7 @@ struct zfcp_adapter {
 };
 
 struct zfcp_port {
-       struct device          sysfs_device;   /* sysfs device */
+       struct device          dev;
        struct fc_rport        *rport;         /* rport of fc transport class */
        struct list_head       list;           /* list of remote ports */
        struct zfcp_adapter    *adapter;       /* adapter used to access port */
@@ -263,7 +230,7 @@ struct zfcp_port {
 };
 
 struct zfcp_unit {
-       struct device          sysfs_device;   /* sysfs device */
+       struct device          dev;
        struct list_head       list;           /* list of logical units */
        struct zfcp_port       *port;          /* remote port of unit */
        atomic_t               status;         /* status of this logical unit */
@@ -276,34 +243,12 @@ struct zfcp_unit {
        struct work_struct      scsi_work;
 };
 
-/**
- * struct zfcp_queue_req - queue related values for a request
- * @sbal_number: number of free SBALs
- * @sbal_first: first SBAL for this request
- * @sbal_last: last SBAL for this request
- * @sbal_limit: last possible SBAL for this request
- * @sbale_curr: current SBALE at creation of this request
- * @sbal_response: SBAL used in interrupt
- * @qdio_outb_usage: usage of outbound queue
- * @qdio_inb_usage: usage of inbound queue
- */
-struct zfcp_queue_req {
-       u8                     sbal_number;
-       u8                     sbal_first;
-       u8                     sbal_last;
-       u8                     sbal_limit;
-       u8                     sbale_curr;
-       u8                     sbal_response;
-       u16                    qdio_outb_usage;
-       u16                    qdio_inb_usage;
-};
-
 /**
  * struct zfcp_fsf_req - basic FSF request structure
  * @list: list of FSF requests
  * @req_id: unique request ID
  * @adapter: adapter this request belongs to
- * @queue_req: queue related values
+ * @qdio_req: qdio queue related values
  * @completion: used to signal the completion of the request
  * @status: status of the request
  * @fsf_command: FSF command issued
@@ -321,7 +266,7 @@ struct zfcp_fsf_req {
        struct list_head        list;
        unsigned long           req_id;
        struct zfcp_adapter     *adapter;
-       struct zfcp_queue_req   queue_req;
+       struct zfcp_qdio_req    qdio_req;
        struct completion       completion;
        u32                     status;
        u32                     fsf_command;
@@ -352,45 +297,4 @@ struct zfcp_data {
 #define ZFCP_SET                0x00000100
 #define ZFCP_CLEAR              0x00000200
 
-/*
- * Helper functions for request ID management.
- */
-static inline int zfcp_reqlist_hash(unsigned long req_id)
-{
-       return req_id % REQUEST_LIST_SIZE;
-}
-
-static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter,
-                                      struct zfcp_fsf_req *fsf_req)
-{
-       list_del(&fsf_req->list);
-}
-
-static inline struct zfcp_fsf_req *
-zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
-{
-       struct zfcp_fsf_req *request;
-       unsigned int idx;
-
-       idx = zfcp_reqlist_hash(req_id);
-       list_for_each_entry(request, &adapter->req_list[idx], list)
-               if (request->req_id == req_id)
-                       return request;
-       return NULL;
-}
-
-static inline struct zfcp_fsf_req *
-zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
-{
-       struct zfcp_fsf_req *request;
-       unsigned int idx;
-
-       for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) {
-               list_for_each_entry(request, &adapter->req_list[idx], list)
-                       if (request == req)
-                               return request;
-       }
-       return NULL;
-}
-
 #endif /* ZFCP_DEF_H */
index b51a11a82e63bf37783e8287f1b1ba5cb8a04064..0be5e7ea2828704985e37aa620fe3ca5457aa6da 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Error Recovery Procedures (ERP).
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -11,6 +11,7 @@
 
 #include <linux/kthread.h>
 #include "zfcp_ext.h"
+#include "zfcp_reqlist.h"
 
 #define ZFCP_MAX_ERPS                   3
 
@@ -174,7 +175,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need,
 
        switch (need) {
        case ZFCP_ERP_ACTION_REOPEN_UNIT:
-               if (!get_device(&unit->sysfs_device))
+               if (!get_device(&unit->dev))
                        return NULL;
                atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status);
                erp_action = &unit->erp_action;
@@ -184,7 +185,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need,
 
        case ZFCP_ERP_ACTION_REOPEN_PORT:
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
-               if (!get_device(&port->sysfs_device))
+               if (!get_device(&port->dev))
                        return NULL;
                zfcp_erp_action_dismiss_port(port);
                atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status);
@@ -478,26 +479,27 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
 static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
 {
        struct zfcp_adapter *adapter = act->adapter;
+       struct zfcp_fsf_req *req;
 
-       if (!act->fsf_req)
+       if (!act->fsf_req_id)
                return;
 
-       spin_lock(&adapter->req_list_lock);
-       if (zfcp_reqlist_find_safe(adapter, act->fsf_req) &&
-           act->fsf_req->erp_action == act) {
+       spin_lock(&adapter->req_list->lock);
+       req = _zfcp_reqlist_find(adapter->req_list, act->fsf_req_id);
+       if (req && req->erp_action == act) {
                if (act->status & (ZFCP_STATUS_ERP_DISMISSED |
                                   ZFCP_STATUS_ERP_TIMEDOUT)) {
-                       act->fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
+                       req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
                        zfcp_dbf_rec_action("erscf_1", act);
-                       act->fsf_req->erp_action = NULL;
+                       req->erp_action = NULL;
                }
                if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
                        zfcp_dbf_rec_action("erscf_2", act);
-               if (act->fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
-                       act->fsf_req = NULL;
+               if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
+                       act->fsf_req_id = 0;
        } else
-               act->fsf_req = NULL;
-       spin_unlock(&adapter->req_list_lock);
+               act->fsf_req_id = 0;
+       spin_unlock(&adapter->req_list->lock);
 }
 
 /**
@@ -1179,19 +1181,19 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
        switch (act->action) {
        case ZFCP_ERP_ACTION_REOPEN_UNIT:
                if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) {
-                       get_device(&unit->sysfs_device);
+                       get_device(&unit->dev);
                        if (scsi_queue_work(unit->port->adapter->scsi_host,
                                            &unit->scsi_work) <= 0)
-                               put_device(&unit->sysfs_device);
+                               put_device(&unit->dev);
                }
-               put_device(&unit->sysfs_device);
+               put_device(&unit->dev);
                break;
 
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
        case ZFCP_ERP_ACTION_REOPEN_PORT:
                if (result == ZFCP_ERP_SUCCEEDED)
                        zfcp_scsi_schedule_rport_register(port);
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
                break;
 
        case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
index 03dec832b465421bef40a1612f2b6aa07d8af2f9..8786a79c7f8fd5b8c6874e017769b46fc8c07a3c 100644 (file)
@@ -21,7 +21,6 @@ extern struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *);
 extern struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *, u64, u32,
                                           u32);
 extern struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *, u64);
-extern int zfcp_reqlist_isempty(struct zfcp_adapter *);
 extern void zfcp_sg_free_table(struct scatterlist *, int);
 extern int zfcp_sg_setup_table(struct scatterlist *, int);
 extern void zfcp_device_unregister(struct device *,
@@ -108,6 +107,7 @@ extern void zfcp_fc_wka_ports_force_offline(struct zfcp_fc_wka_ports *);
 extern int zfcp_fc_gs_setup(struct zfcp_adapter *);
 extern void zfcp_fc_gs_destroy(struct zfcp_adapter *);
 extern int zfcp_fc_exec_bsg_job(struct fc_bsg_job *);
+extern int zfcp_fc_timeout_bsg_job(struct fc_bsg_job *);
 
 /* zfcp_fsf.c */
 extern int zfcp_fsf_open_port(struct zfcp_erp_action *);
@@ -129,9 +129,9 @@ extern void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *);
 extern int zfcp_fsf_status_read(struct zfcp_qdio *);
 extern int zfcp_status_read_refill(struct zfcp_adapter *adapter);
 extern int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *, struct zfcp_fsf_ct_els *,
-                           mempool_t *);
+                           mempool_t *, unsigned int);
 extern int zfcp_fsf_send_els(struct zfcp_adapter *, u32,
-                            struct zfcp_fsf_ct_els *);
+                            struct zfcp_fsf_ct_els *, unsigned int);
 extern int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *,
                                          struct scsi_cmnd *);
 extern void zfcp_fsf_req_free(struct zfcp_fsf_req *);
@@ -143,13 +143,9 @@ extern void zfcp_fsf_reqid_check(struct zfcp_qdio *, int);
 /* zfcp_qdio.c */
 extern int zfcp_qdio_setup(struct zfcp_adapter *);
 extern void zfcp_qdio_destroy(struct zfcp_qdio *);
-extern int zfcp_qdio_send(struct zfcp_qdio *, struct zfcp_queue_req *);
-extern struct qdio_buffer_element
-       *zfcp_qdio_sbale_req(struct zfcp_qdio *, struct zfcp_queue_req *);
-extern struct qdio_buffer_element
-       *zfcp_qdio_sbale_curr(struct zfcp_qdio *, struct zfcp_queue_req *);
+extern int zfcp_qdio_send(struct zfcp_qdio *, struct zfcp_qdio_req *);
 extern int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *,
-                                  struct zfcp_queue_req *, unsigned long,
+                                  struct zfcp_qdio_req *, unsigned long,
                                   struct scatterlist *, int);
 extern int zfcp_qdio_open(struct zfcp_qdio *);
 extern void zfcp_qdio_close(struct zfcp_qdio *);
index ac5e3b7a3576d85103a40f980c381ec5ee2ebfeb..5219670f0c99f015d61a5a8dea757c7c7c5061b5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Fibre Channel related functions for the zfcp device driver.
  *
- * Copyright IBM Corporation 2008, 2009
+ * Copyright IBM Corporation 2008, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -258,7 +258,8 @@ static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port,
        gid_pn->gid_pn_req.gid_pn.fn_wwpn = port->wwpn;
 
        ret = zfcp_fsf_send_ct(&adapter->gs->ds, &gid_pn->ct,
-                              adapter->pool.gid_pn_req);
+                              adapter->pool.gid_pn_req,
+                              ZFCP_FC_CTELS_TMO);
        if (!ret) {
                wait_for_completion(&completion);
                zfcp_fc_ns_gid_pn_eval(gid_pn);
@@ -315,7 +316,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
 
        zfcp_erp_port_reopen(port, 0, "fcgpn_3", NULL);
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 /**
@@ -324,9 +325,9 @@ out:
  */
 void zfcp_fc_trigger_did_lookup(struct zfcp_port *port)
 {
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
        if (!queue_work(port->adapter->work_queue, &port->gid_pn_work))
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
 }
 
 /**
@@ -388,7 +389,7 @@ static void zfcp_fc_adisc_handler(void *data)
        zfcp_scsi_schedule_rport_register(port);
  out:
        atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status);
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
        kmem_cache_free(zfcp_data.adisc_cache, adisc);
 }
 
@@ -421,7 +422,8 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
        hton24(adisc->adisc_req.adisc_port_id,
               fc_host_port_id(adapter->scsi_host));
 
-       ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els);
+       ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els,
+                               ZFCP_FC_CTELS_TMO);
        if (ret)
                kmem_cache_free(zfcp_data.adisc_cache, adisc);
 
@@ -434,7 +436,7 @@ void zfcp_fc_link_test_work(struct work_struct *work)
                container_of(work, struct zfcp_port, test_link_work);
        int retval;
 
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
        port->rport_task = RPORT_DEL;
        zfcp_scsi_rport_work(&port->rport_work);
 
@@ -453,7 +455,7 @@ void zfcp_fc_link_test_work(struct work_struct *work)
        zfcp_erp_port_forced_reopen(port, 0, "fcltwk1", NULL);
 
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 /**
@@ -466,9 +468,9 @@ out:
  */
 void zfcp_fc_test_link(struct zfcp_port *port)
 {
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
        if (!queue_work(port->adapter->work_queue, &port->test_link_work))
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
 }
 
 static void zfcp_free_sg_env(struct zfcp_fc_gpn_ft *gpn_ft, int buf_num)
@@ -532,7 +534,8 @@ static int zfcp_fc_send_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft,
        ct->req = &gpn_ft->sg_req;
        ct->resp = gpn_ft->sg_resp;
 
-       ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct, NULL);
+       ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct, NULL,
+                              ZFCP_FC_CTELS_TMO);
        if (!ret)
                wait_for_completion(&completion);
        return ret;
@@ -614,8 +617,7 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft,
 
        list_for_each_entry_safe(port, tmp, &remove_lh, list) {
                zfcp_erp_port_shutdown(port, 0, "fcegpf2", NULL);
-               zfcp_device_unregister(&port->sysfs_device,
-                                      &zfcp_sysfs_port_attrs);
+               zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
        }
 
        return ret;
@@ -668,15 +670,52 @@ static void zfcp_fc_ct_els_job_handler(void *data)
 {
        struct fc_bsg_job *job = data;
        struct zfcp_fsf_ct_els *zfcp_ct_els = job->dd_data;
-       int status = zfcp_ct_els->status;
-       int reply_status;
+       struct fc_bsg_reply *jr = job->reply;
 
-       reply_status = status ? FC_CTELS_STATUS_REJECT : FC_CTELS_STATUS_OK;
-       job->reply->reply_data.ctels_reply.status = reply_status;
-       job->reply->reply_payload_rcv_len = job->reply_payload.payload_len;
+       jr->reply_payload_rcv_len = job->reply_payload.payload_len;
+       jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
+       jr->result = zfcp_ct_els->status ? -EIO : 0;
        job->job_done(job);
 }
 
+static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
+{
+       u32 preamble_word1;
+       u8 gs_type;
+       struct zfcp_adapter *adapter;
+
+       preamble_word1 = job->request->rqst_data.r_ct.preamble_word1;
+       gs_type = (preamble_word1 & 0xff000000) >> 24;
+
+       adapter = (struct zfcp_adapter *) job->shost->hostdata[0];
+
+       switch (gs_type) {
+       case FC_FST_ALIAS:
+               return &adapter->gs->as;
+       case FC_FST_MGMT:
+               return &adapter->gs->ms;
+       case FC_FST_TIME:
+               return &adapter->gs->ts;
+               break;
+       case FC_FST_DIR:
+               return &adapter->gs->ds;
+               break;
+       default:
+               return NULL;
+       }
+}
+
+static void zfcp_fc_ct_job_handler(void *data)
+{
+       struct fc_bsg_job *job = data;
+       struct zfcp_fc_wka_port *wka_port;
+
+       wka_port = zfcp_fc_job_wka_port(job);
+       zfcp_fc_wka_port_put(wka_port);
+
+       zfcp_fc_ct_els_job_handler(data);
+}
+
 static int zfcp_fc_exec_els_job(struct fc_bsg_job *job,
                                struct zfcp_adapter *adapter)
 {
@@ -691,47 +730,31 @@ static int zfcp_fc_exec_els_job(struct fc_bsg_job *job,
                        return -EINVAL;
 
                d_id = port->d_id;
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
        } else
                d_id = ntoh24(job->request->rqst_data.h_els.port_id);
 
-       return zfcp_fsf_send_els(adapter, d_id, els);
+       els->handler = zfcp_fc_ct_els_job_handler;
+       return zfcp_fsf_send_els(adapter, d_id, els, job->req->timeout / HZ);
 }
 
 static int zfcp_fc_exec_ct_job(struct fc_bsg_job *job,
                               struct zfcp_adapter *adapter)
 {
        int ret;
-       u8 gs_type;
        struct zfcp_fsf_ct_els *ct = job->dd_data;
        struct zfcp_fc_wka_port *wka_port;
-       u32 preamble_word1;
 
-       preamble_word1 = job->request->rqst_data.r_ct.preamble_word1;
-       gs_type = (preamble_word1 & 0xff000000) >> 24;
-
-       switch (gs_type) {
-       case FC_FST_ALIAS:
-               wka_port = &adapter->gs->as;
-               break;
-       case FC_FST_MGMT:
-               wka_port = &adapter->gs->ms;
-               break;
-       case FC_FST_TIME:
-               wka_port = &adapter->gs->ts;
-               break;
-       case FC_FST_DIR:
-               wka_port = &adapter->gs->ds;
-               break;
-       default:
-               return -EINVAL; /* no such service */
-       }
+       wka_port = zfcp_fc_job_wka_port(job);
+       if (!wka_port)
+               return -EINVAL;
 
        ret = zfcp_fc_wka_port_get(wka_port);
        if (ret)
                return ret;
 
-       ret = zfcp_fsf_send_ct(wka_port, ct, NULL);
+       ct->handler = zfcp_fc_ct_job_handler;
+       ret = zfcp_fsf_send_ct(wka_port, ct, NULL, job->req->timeout / HZ);
        if (ret)
                zfcp_fc_wka_port_put(wka_port);
 
@@ -752,7 +775,6 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job)
 
        ct_els->req = job->request_payload.sg_list;
        ct_els->resp = job->reply_payload.sg_list;
-       ct_els->handler = zfcp_fc_ct_els_job_handler;
        ct_els->handler_data = job;
 
        switch (job->request->msgcode) {
@@ -767,6 +789,12 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job)
        }
 }
 
+int zfcp_fc_timeout_bsg_job(struct fc_bsg_job *job)
+{
+       /* hardware tracks timeout, reset bsg timeout to not interfere */
+       return -EAGAIN;
+}
+
 int zfcp_fc_gs_setup(struct zfcp_adapter *adapter)
 {
        struct zfcp_fc_wka_ports *wka_ports;
index cb2a3669a3849f2b18a9c5b2e4eee25126c1c431..0747b087390d77389553ad67b65029801b0efa55 100644 (file)
@@ -27,6 +27,8 @@
 #define ZFCP_FC_GPN_FT_MAX_ENT   (ZFCP_FC_GPN_FT_NUM_BUFS * \
                                        (ZFCP_FC_GPN_FT_ENT_PAGE + 1))
 
+#define ZFCP_FC_CTELS_TMO      (2 * FC_DEF_R_A_TOV / 1000)
+
 /**
  * struct zfcp_fc_gid_pn_req - container for ct header plus gid_pn request
  * @ct_hdr: FC GS common transport header
index 482dcd97aa5dbfe1415db51c0a833a71e94ae65a..6538742b421a1737ae84d766a34990ebfa484277 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Implementation of FSF commands.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -14,6 +14,8 @@
 #include "zfcp_ext.h"
 #include "zfcp_fc.h"
 #include "zfcp_dbf.h"
+#include "zfcp_qdio.h"
+#include "zfcp_reqlist.h"
 
 static void zfcp_fsf_request_timeout_handler(unsigned long data)
 {
@@ -393,7 +395,7 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
        case FSF_PROT_LINK_DOWN:
                zfcp_fsf_link_down_info_eval(req, "fspse_5",
                                             &psq->link_down_info);
-               /* FIXME: reopening adapter now? better wait for link up */
+               /* go through reopen to flush pending requests */
                zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req);
                break;
        case FSF_PROT_REEST_QUEUE:
@@ -457,15 +459,10 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
 void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
 {
        struct zfcp_fsf_req *req, *tmp;
-       unsigned long flags;
        LIST_HEAD(remove_queue);
-       unsigned int i;
 
        BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP);
-       spin_lock_irqsave(&adapter->req_list_lock, flags);
-       for (i = 0; i < REQUEST_LIST_SIZE; i++)
-               list_splice_init(&adapter->req_list[i], &remove_queue);
-       spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+       zfcp_reqlist_move(adapter->req_list, &remove_queue);
 
        list_for_each_entry_safe(req, tmp, &remove_queue, list) {
                list_del(&req->list);
@@ -495,8 +492,6 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
        fc_host_port_id(shost) = ntoh24(bottom->s_id);
        fc_host_speed(shost) = bottom->fc_link_speed;
        fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
-       fc_host_supported_fc4s(shost)[2] = 1; /* FCP */
-       fc_host_active_fc4s(shost)[2] = 1; /* FCP */
 
        adapter->hydra_version = bottom->adapter_type;
        adapter->timer_ticks = bottom->timer_interval;
@@ -619,6 +614,10 @@ static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req)
                fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
        fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
        fc_host_supported_speeds(shost) = bottom->supported_speed;
+       memcpy(fc_host_supported_fc4s(shost), bottom->supported_fc4_types,
+              FC_FC4_LIST_SIZE);
+       memcpy(fc_host_active_fc4s(shost), bottom->active_fc4_types,
+              FC_FC4_LIST_SIZE);
 }
 
 static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
@@ -725,12 +724,12 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
        req->adapter = adapter;
        req->fsf_command = fsf_cmd;
        req->req_id = adapter->req_no;
-       req->queue_req.sbal_number = 1;
-       req->queue_req.sbal_first = req_q->first;
-       req->queue_req.sbal_last = req_q->first;
-       req->queue_req.sbale_curr = 1;
+       req->qdio_req.sbal_number = 1;
+       req->qdio_req.sbal_first = req_q->first;
+       req->qdio_req.sbal_last = req_q->first;
+       req->qdio_req.sbale_curr = 1;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].addr = (void *) req->req_id;
        sbale[0].flags |= SBAL_FLAGS0_COMMAND;
 
@@ -745,6 +744,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
                        return ERR_PTR(-ENOMEM);
                }
 
+               req->seq_no = adapter->fsf_req_seq_no;
                req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
                req->qtcb->prefix.req_id = req->req_id;
                req->qtcb->prefix.ulp_info = 26;
@@ -752,8 +752,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
                req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION;
                req->qtcb->header.req_handle = req->req_id;
                req->qtcb->header.fsf_command = req->fsf_command;
-               req->seq_no = adapter->fsf_req_seq_no;
-               req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
                sbale[1].addr = (void *) req->qtcb;
                sbale[1].length = sizeof(struct fsf_qtcb);
        }
@@ -770,25 +768,17 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
 {
        struct zfcp_adapter *adapter = req->adapter;
        struct zfcp_qdio *qdio = adapter->qdio;
-       unsigned long        flags;
-       int                  idx;
-       int                  with_qtcb = (req->qtcb != NULL);
+       int with_qtcb = (req->qtcb != NULL);
+       int req_id = req->req_id;
 
-       /* put allocated FSF request into hash table */
-       spin_lock_irqsave(&adapter->req_list_lock, flags);
-       idx = zfcp_reqlist_hash(req->req_id);
-       list_add_tail(&req->list, &adapter->req_list[idx]);
-       spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+       zfcp_reqlist_add(adapter->req_list, req);
 
-       req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count);
+       req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q.count);
        req->issued = get_clock();
-       if (zfcp_qdio_send(qdio, &req->queue_req)) {
+       if (zfcp_qdio_send(qdio, &req->qdio_req)) {
                del_timer(&req->timer);
-               spin_lock_irqsave(&adapter->req_list_lock, flags);
                /* lookup request again, list might have changed */
-               if (zfcp_reqlist_find_safe(adapter, req))
-                       zfcp_reqlist_remove(adapter, req);
-               spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+               zfcp_reqlist_find_rm(adapter->req_list, req_id);
                zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req);
                return -EIO;
        }
@@ -826,9 +816,9 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
                goto out;
        }
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY;
-       req->queue_req.sbale_curr = 2;
+       req->qdio_req.sbale_curr = 2;
 
        sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC);
        if (!sr_buf) {
@@ -837,7 +827,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
        }
        memset(sr_buf, 0, sizeof(*sr_buf));
        req->data = sr_buf;
-       sbale = zfcp_qdio_sbale_curr(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_curr(qdio, &req->qdio_req);
        sbale->addr = (void *) sr_buf;
        sbale->length = sizeof(*sr_buf);
 
@@ -934,7 +924,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
                       ZFCP_STATUS_COMMON_UNBLOCKED)))
                goto out_error_free;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1029,7 +1019,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
 {
        struct zfcp_adapter *adapter = req->adapter;
        struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter->qdio,
-                                                              &req->queue_req);
+                                                              &req->qdio_req);
        u32 feat = adapter->adapter_features;
        int bytes;
 
@@ -1047,15 +1037,15 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
                return 0;
        }
 
-       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
                                        SBAL_FLAGS0_TYPE_WRITE_READ,
                                        sg_req, max_sbals);
        if (bytes <= 0)
                return -EIO;
        req->qtcb->bottom.support.req_buf_length = bytes;
-       req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
+       req->qdio_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
 
-       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
                                        SBAL_FLAGS0_TYPE_WRITE_READ,
                                        sg_resp, max_sbals);
        req->qtcb->bottom.support.resp_buf_length = bytes;
@@ -1068,20 +1058,20 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
                                 struct scatterlist *sg_req,
                                 struct scatterlist *sg_resp,
-                                int max_sbals)
+                                int max_sbals, unsigned int timeout)
 {
        int ret;
-       unsigned int fcp_chan_timeout;
 
        ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp, max_sbals);
        if (ret)
                return ret;
 
        /* common settings for ct/gs and els requests */
-       fcp_chan_timeout = 2 * FC_DEF_R_A_TOV / 1000;
+       if (timeout > 255)
+               timeout = 255; /* max value accepted by hardware */
        req->qtcb->bottom.support.service_class = FSF_CLASS_3;
-       req->qtcb->bottom.support.timeout = fcp_chan_timeout;
-       zfcp_fsf_start_timer(req, (fcp_chan_timeout + 10) * HZ);
+       req->qtcb->bottom.support.timeout = timeout;
+       zfcp_fsf_start_timer(req, (timeout + 10) * HZ);
 
        return 0;
 }
@@ -1092,7 +1082,8 @@ static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
  * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req
  */
 int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
-                    struct zfcp_fsf_ct_els *ct, mempool_t *pool)
+                    struct zfcp_fsf_ct_els *ct, mempool_t *pool,
+                    unsigned int timeout)
 {
        struct zfcp_qdio *qdio = wka_port->adapter->qdio;
        struct zfcp_fsf_req *req;
@@ -1111,7 +1102,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
        ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp,
-                                   FSF_MAX_SBALS_PER_REQ);
+                                   FSF_MAX_SBALS_PER_REQ, timeout);
        if (ret)
                goto failed_send;
 
@@ -1188,7 +1179,7 @@ skip_fsfstatus:
  * @els: pointer to struct zfcp_send_els with data for the command
  */
 int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
-                     struct zfcp_fsf_ct_els *els)
+                     struct zfcp_fsf_ct_els *els, unsigned int timeout)
 {
        struct zfcp_fsf_req *req;
        struct zfcp_qdio *qdio = adapter->qdio;
@@ -1206,7 +1197,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2);
+       ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2, timeout);
 
        if (ret)
                goto failed_send;
@@ -1250,7 +1241,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1261,13 +1252,13 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
                        FSF_FEATURE_UPDATE_ALERT;
        req->erp_action = erp_action;
        req->handler = zfcp_fsf_exchange_config_data_handler;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1292,7 +1283,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
                goto out_unlock;
        }
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
        req->handler = zfcp_fsf_exchange_config_data_handler;
@@ -1348,19 +1339,19 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
        req->handler = zfcp_fsf_exchange_port_data_handler;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1397,7 +1388,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
        if (data)
                req->data = data;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1483,7 +1474,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
        }
 
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 /**
@@ -1512,7 +1503,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
         sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
         sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1520,15 +1511,15 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
        hton24(req->qtcb->bottom.support.d_id, port->d_id);
        req->data = port;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
-       get_device(&port->sysfs_device);
+       erp_action->fsf_req_id = req->req_id;
+       get_device(&port->dev);
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
-               put_device(&port->sysfs_device);
+               erp_action->fsf_req_id = 0;
+               put_device(&port->dev);
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1582,7 +1573,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1590,13 +1581,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
        req->data = erp_action->port;
        req->erp_action = erp_action;
        req->qtcb->header.port_handle = erp_action->port->handle;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1659,7 +1650,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1714,7 +1705,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1808,7 +1799,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1816,13 +1807,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
        req->qtcb->header.port_handle = erp_action->port->handle;
        req->erp_action = erp_action;
        req->handler = zfcp_fsf_close_physical_port_handler;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1981,7 +1972,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
         sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
         sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1990,7 +1981,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        req->handler = zfcp_fsf_open_unit_handler;
        req->data = erp_action->unit;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
                req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING;
@@ -1999,7 +1990,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -2067,7 +2058,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -2076,13 +2067,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
        req->handler = zfcp_fsf_close_unit_handler;
        req->data = erp_action->unit;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -2110,8 +2101,8 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
        blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC;
        if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
                blktrc.flags |= ZFCP_BLK_REQ_ERROR;
-       blktrc.inb_usage = req->queue_req.qdio_inb_usage;
-       blktrc.outb_usage = req->queue_req.qdio_outb_usage;
+       blktrc.inb_usage = req->qdio_req.qdio_inb_usage;
+       blktrc.outb_usage = req->qdio_req.qdio_outb_usage;
 
        if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
                blktrc.flags |= ZFCP_BLK_LAT_VALID;
@@ -2168,12 +2159,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
        zfcp_fsf_req_trace(req, scpnt);
 
 skip_fsfstatus:
-       if (scpnt->result != 0)
-               zfcp_dbf_scsi_result("erro", 3, req->adapter->dbf, scpnt, req);
-       else if (scpnt->retries > 0)
-               zfcp_dbf_scsi_result("retr", 4, req->adapter->dbf, scpnt, req);
-       else
-               zfcp_dbf_scsi_result("norm", 6, req->adapter->dbf, scpnt, req);
+       zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
 
        scpnt->host_scribble = NULL;
        (scpnt->scsi_done) (scpnt);
@@ -2273,7 +2259,7 @@ skip_fsfstatus:
        else {
                zfcp_fsf_send_fcp_command_task_handler(req);
                req->unit = NULL;
-               put_device(&unit->sysfs_device);
+               put_device(&unit->dev);
        }
 }
 
@@ -2311,7 +2297,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       get_device(&unit->sysfs_device);
+       get_device(&unit->dev);
        req->unit = unit;
        req->data = scsi_cmnd;
        req->handler = zfcp_fsf_send_fcp_command_handler;
@@ -2345,11 +2331,11 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd;
        zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd);
 
-       real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, sbtype,
+       real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sbtype,
                                             scsi_sglist(scsi_cmnd),
                                             FSF_MAX_SBALS_PER_REQ);
        if (unlikely(real_bytes < 0)) {
-               if (req->queue_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
+               if (req->qdio_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
                        dev_err(&adapter->ccw_device->dev,
                                "Oversize data package, unit 0x%016Lx "
                                "on port 0x%016Lx closed\n",
@@ -2368,7 +2354,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        goto out;
 
 failed_scsi_cmnd:
-       put_device(&unit->sysfs_device);
+       put_device(&unit->dev);
        zfcp_fsf_req_free(req);
        scsi_cmnd->host_scribble = NULL;
 out:
@@ -2414,7 +2400,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags)
        req->qtcb->bottom.io.service_class = FSF_CLASS_3;
        req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -2477,14 +2463,14 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
 
        req->handler = zfcp_fsf_control_file_handler;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= direction;
 
        bottom = &req->qtcb->bottom.support;
        bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE;
        bottom->option = fsf_cfdc->option;
 
-       bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req,
                                        direction, fsf_cfdc->sg,
                                        FSF_MAX_SBALS_PER_REQ);
        if (bytes != ZFCP_CFDC_MAX_SIZE) {
@@ -2515,15 +2501,14 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
        struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx];
        struct qdio_buffer_element *sbale;
        struct zfcp_fsf_req *fsf_req;
-       unsigned long flags, req_id;
+       unsigned long req_id;
        int idx;
 
        for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
 
                sbale = &sbal->element[idx];
                req_id = (unsigned long) sbale->addr;
-               spin_lock_irqsave(&adapter->req_list_lock, flags);
-               fsf_req = zfcp_reqlist_find(adapter, req_id);
+               fsf_req = zfcp_reqlist_find_rm(adapter->req_list, req_id);
 
                if (!fsf_req)
                        /*
@@ -2533,11 +2518,8 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
                        panic("error: unknown req_id (%lx) on adapter %s.\n",
                              req_id, dev_name(&adapter->ccw_device->dev));
 
-               list_del(&fsf_req->list);
-               spin_unlock_irqrestore(&adapter->req_list_lock, flags);
-
-               fsf_req->queue_req.sbal_response = sbal_idx;
-               fsf_req->queue_req.qdio_inb_usage =
+               fsf_req->qdio_req.sbal_response = sbal_idx;
+               fsf_req->qdio_req.qdio_inb_usage =
                        atomic_read(&qdio->resp_q.count);
                zfcp_fsf_req_complete(fsf_req);
 
index 6c5228b627fc540bac927019bf0fb829bb9d4bf8..71b97ff77cf0a2d0885b89c96c1e0ac522ab55b7 100644 (file)
@@ -10,6 +10,7 @@
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
 #include "zfcp_ext.h"
+#include "zfcp_qdio.h"
 
 #define QBUFF_PER_PAGE         (PAGE_SIZE / sizeof(struct qdio_buffer))
 
@@ -28,12 +29,6 @@ static int zfcp_qdio_buffers_enqueue(struct qdio_buffer **sbal)
        return 0;
 }
 
-static struct qdio_buffer_element *
-zfcp_qdio_sbale(struct zfcp_qdio_queue *q, int sbal_idx, int sbale_idx)
-{
-       return &q->sbal[sbal_idx]->element[sbale_idx];
-}
-
 static void zfcp_qdio_handler_error(struct zfcp_qdio *qdio, char *id)
 {
        struct zfcp_adapter *adapter = qdio->adapter;
@@ -106,7 +101,7 @@ static void zfcp_qdio_resp_put_back(struct zfcp_qdio *qdio, int processed)
 
        if (unlikely(retval)) {
                atomic_set(&queue->count, count);
-               /* FIXME: Recover this with an adapter reopen? */
+               zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdrpb_1", NULL);
        } else {
                queue->first += count;
                queue->first %= QDIO_MAX_BUFFERS_PER_Q;
@@ -145,32 +140,8 @@ static void zfcp_qdio_int_resp(struct ccw_device *cdev, unsigned int qdio_err,
        zfcp_qdio_resp_put_back(qdio, count);
 }
 
-/**
- * zfcp_qdio_sbale_req - return ptr to SBALE of req_q for a struct zfcp_fsf_req
- * @qdio: pointer to struct zfcp_qdio
- * @q_rec: pointer to struct zfcp_queue_rec
- * Returns: pointer to qdio_buffer_element (SBALE) structure
- */
-struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_qdio *qdio,
-                                               struct zfcp_queue_req *q_req)
-{
-       return zfcp_qdio_sbale(&qdio->req_q, q_req->sbal_last, 0);
-}
-
-/**
- * zfcp_qdio_sbale_curr - return curr SBALE on req_q for a struct zfcp_fsf_req
- * @fsf_req: pointer to struct fsf_req
- * Returns: pointer to qdio_buffer_element (SBALE) structure
- */
-struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio,
-                                                struct zfcp_queue_req *q_req)
-{
-       return zfcp_qdio_sbale(&qdio->req_q, q_req->sbal_last,
-                              q_req->sbale_curr);
-}
-
 static void zfcp_qdio_sbal_limit(struct zfcp_qdio *qdio,
-                                struct zfcp_queue_req *q_req, int max_sbals)
+                                struct zfcp_qdio_req *q_req, int max_sbals)
 {
        int count = atomic_read(&qdio->req_q.count);
        count = min(count, max_sbals);
@@ -179,7 +150,7 @@ static void zfcp_qdio_sbal_limit(struct zfcp_qdio *qdio,
 }
 
 static struct qdio_buffer_element *
-zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req,
+zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
                     unsigned long sbtype)
 {
        struct qdio_buffer_element *sbale;
@@ -214,7 +185,7 @@ zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req,
 }
 
 static struct qdio_buffer_element *
-zfcp_qdio_sbale_next(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req,
+zfcp_qdio_sbale_next(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
                     unsigned int sbtype)
 {
        if (q_req->sbale_curr == ZFCP_LAST_SBALE_PER_SBAL)
@@ -224,7 +195,7 @@ zfcp_qdio_sbale_next(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req,
 }
 
 static void zfcp_qdio_undo_sbals(struct zfcp_qdio *qdio,
-                                struct zfcp_queue_req *q_req)
+                                struct zfcp_qdio_req *q_req)
 {
        struct qdio_buffer **sbal = qdio->req_q.sbal;
        int first = q_req->sbal_first;
@@ -235,7 +206,7 @@ static void zfcp_qdio_undo_sbals(struct zfcp_qdio *qdio,
 }
 
 static int zfcp_qdio_fill_sbals(struct zfcp_qdio *qdio,
-                               struct zfcp_queue_req *q_req,
+                               struct zfcp_qdio_req *q_req,
                                unsigned int sbtype, void *start_addr,
                                unsigned int total_length)
 {
@@ -271,8 +242,7 @@ static int zfcp_qdio_fill_sbals(struct zfcp_qdio *qdio,
  * @max_sbals: upper bound for number of SBALs to be used
  * Returns: number of bytes, or error (negativ)
  */
-int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio,
-                           struct zfcp_queue_req *q_req,
+int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
                            unsigned long sbtype, struct scatterlist *sg,
                            int max_sbals)
 {
@@ -304,10 +274,10 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio,
 /**
  * zfcp_qdio_send - set PCI flag in first SBALE and send req to QDIO
  * @qdio: pointer to struct zfcp_qdio
- * @q_req: pointer to struct zfcp_queue_req
+ * @q_req: pointer to struct zfcp_qdio_req
  * Returns: 0 on success, error otherwise
  */
-int zfcp_qdio_send(struct zfcp_qdio *qdio, struct zfcp_queue_req *q_req)
+int zfcp_qdio_send(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
 {
        struct zfcp_qdio_queue *req_q = &qdio->req_q;
        int first = q_req->sbal_first;
diff --git a/drivers/s390/scsi/zfcp_qdio.h b/drivers/s390/scsi/zfcp_qdio.h
new file mode 100644 (file)
index 0000000..8cca546
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * zfcp device driver
+ *
+ * Header file for zfcp qdio interface
+ *
+ * Copyright IBM Corporation 2010
+ */
+
+#ifndef ZFCP_QDIO_H
+#define ZFCP_QDIO_H
+
+#include <asm/qdio.h>
+
+/**
+ * struct zfcp_qdio_queue - qdio queue buffer, zfcp index and free count
+ * @sbal: qdio buffers
+ * @first: index of next free buffer in queue
+ * @count: number of free buffers in queue
+ */
+struct zfcp_qdio_queue {
+       struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
+       u8                 first;
+       atomic_t           count;
+};
+
+/**
+ * struct zfcp_qdio - basic qdio data structure
+ * @resp_q: response queue
+ * @req_q: request queue
+ * @stat_lock: lock to protect req_q_util and req_q_time
+ * @req_q_lock: lock to serialize access to request queue
+ * @req_q_time: time of last fill level change
+ * @req_q_util: used for accounting
+ * @req_q_full: queue full incidents
+ * @req_q_wq: used to wait for SBAL availability
+ * @adapter: adapter used in conjunction with this qdio structure
+ */
+struct zfcp_qdio {
+       struct zfcp_qdio_queue  resp_q;
+       struct zfcp_qdio_queue  req_q;
+       spinlock_t              stat_lock;
+       spinlock_t              req_q_lock;
+       unsigned long long      req_q_time;
+       u64                     req_q_util;
+       atomic_t                req_q_full;
+       wait_queue_head_t       req_q_wq;
+       struct zfcp_adapter     *adapter;
+};
+
+/**
+ * struct zfcp_qdio_req - qdio queue related values for a request
+ * @sbal_number: number of free sbals
+ * @sbal_first: first sbal for this request
+ * @sbal_last: last sbal for this request
+ * @sbal_limit: last possible sbal for this request
+ * @sbale_curr: current sbale at creation of this request
+ * @sbal_response: sbal used in interrupt
+ * @qdio_outb_usage: usage of outbound queue
+ * @qdio_inb_usage: usage of inbound queue
+ */
+struct zfcp_qdio_req {
+       u8      sbal_number;
+       u8      sbal_first;
+       u8      sbal_last;
+       u8      sbal_limit;
+       u8      sbale_curr;
+       u8      sbal_response;
+       u16     qdio_outb_usage;
+       u16     qdio_inb_usage;
+};
+
+/**
+ * zfcp_qdio_sbale - return pointer to sbale in qdio queue
+ * @q: queue where to find sbal
+ * @sbal_idx: sbal index in queue
+ * @sbale_idx: sbale index in sbal
+ */
+static inline struct qdio_buffer_element *
+zfcp_qdio_sbale(struct zfcp_qdio_queue *q, int sbal_idx, int sbale_idx)
+{
+       return &q->sbal[sbal_idx]->element[sbale_idx];
+}
+
+/**
+ * zfcp_qdio_sbale_req - return pointer to sbale on req_q for a request
+ * @qdio: pointer to struct zfcp_qdio
+ * @q_rec: pointer to struct zfcp_qdio_req
+ * Returns: pointer to qdio_buffer_element (sbale) structure
+ */
+static inline struct qdio_buffer_element *
+zfcp_qdio_sbale_req(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
+{
+       return zfcp_qdio_sbale(&qdio->req_q, q_req->sbal_last, 0);
+}
+
+/**
+ * zfcp_qdio_sbale_curr - return current sbale on req_q for a request
+ * @qdio: pointer to struct zfcp_qdio
+ * @fsf_req: pointer to struct zfcp_fsf_req
+ * Returns: pointer to qdio_buffer_element (sbale) structure
+ */
+static inline struct qdio_buffer_element *
+zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
+{
+       return zfcp_qdio_sbale(&qdio->req_q, q_req->sbal_last,
+                              q_req->sbale_curr);
+}
+
+#endif /* ZFCP_QDIO_H */
diff --git a/drivers/s390/scsi/zfcp_reqlist.h b/drivers/s390/scsi/zfcp_reqlist.h
new file mode 100644 (file)
index 0000000..a72d1b7
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * zfcp device driver
+ *
+ * Data structure and helper functions for tracking pending FSF
+ * requests.
+ *
+ * Copyright IBM Corporation 2009
+ */
+
+#ifndef ZFCP_REQLIST_H
+#define ZFCP_REQLIST_H
+
+/* number of hash buckets */
+#define ZFCP_REQ_LIST_BUCKETS 128
+
+/**
+ * struct zfcp_reqlist - Container for request list (reqlist)
+ * @lock: Spinlock for protecting the hash list
+ * @list: Array of hashbuckets, each is a list of requests in this bucket
+ */
+struct zfcp_reqlist {
+       spinlock_t lock;
+       struct list_head buckets[ZFCP_REQ_LIST_BUCKETS];
+};
+
+static inline int zfcp_reqlist_hash(unsigned long req_id)
+{
+       return req_id % ZFCP_REQ_LIST_BUCKETS;
+}
+
+/**
+ * zfcp_reqlist_alloc - Allocate and initialize reqlist
+ *
+ * Returns pointer to allocated reqlist on success, or NULL on
+ * allocation failure.
+ */
+static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
+{
+       unsigned int i;
+       struct zfcp_reqlist *rl;
+
+       rl = kzalloc(sizeof(struct zfcp_reqlist), GFP_KERNEL);
+       if (!rl)
+               return NULL;
+
+       spin_lock_init(&rl->lock);
+
+       for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
+               INIT_LIST_HEAD(&rl->buckets[i]);
+
+       return rl;
+}
+
+/**
+ * zfcp_reqlist_isempty - Check whether the request list empty
+ * @rl: pointer to reqlist
+ *
+ * Returns: 1 if list is empty, 0 if not
+ */
+static inline int zfcp_reqlist_isempty(struct zfcp_reqlist *rl)
+{
+       unsigned int i;
+
+       for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
+               if (!list_empty(&rl->buckets[i]))
+                       return 0;
+       return 1;
+}
+
+/**
+ * zfcp_reqlist_free - Free allocated memory for reqlist
+ * @rl: The reqlist where to free memory
+ */
+static inline void zfcp_reqlist_free(struct zfcp_reqlist *rl)
+{
+       /* sanity check */
+       BUG_ON(!zfcp_reqlist_isempty(rl));
+
+       kfree(rl);
+}
+
+static inline struct zfcp_fsf_req *
+_zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
+{
+       struct zfcp_fsf_req *req;
+       unsigned int i;
+
+       i = zfcp_reqlist_hash(req_id);
+       list_for_each_entry(req, &rl->buckets[i], list)
+               if (req->req_id == req_id)
+                       return req;
+       return NULL;
+}
+
+/**
+ * zfcp_reqlist_find - Lookup FSF request by its request id
+ * @rl: The reqlist where to lookup the FSF request
+ * @req_id: The request id to look for
+ *
+ * Returns a pointer to the FSF request with the specified request id
+ * or NULL if there is no known FSF request with this id.
+ */
+static inline struct zfcp_fsf_req *
+zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
+{
+       unsigned long flags;
+       struct zfcp_fsf_req *req;
+
+       spin_lock_irqsave(&rl->lock, flags);
+       req = _zfcp_reqlist_find(rl, req_id);
+       spin_unlock_irqrestore(&rl->lock, flags);
+
+       return req;
+}
+
+/**
+ * zfcp_reqlist_find_rm - Lookup request by id and remove it from reqlist
+ * @rl: reqlist where to search and remove entry
+ * @req_id: The request id of the request to look for
+ *
+ * This functions tries to find the FSF request with the specified
+ * id and then removes it from the reqlist. The reqlist lock is held
+ * during both steps of the operation.
+ *
+ * Returns: Pointer to the FSF request if the request has been found,
+ * NULL if it has not been found.
+ */
+static inline struct zfcp_fsf_req *
+zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
+{
+       unsigned long flags;
+       struct zfcp_fsf_req *req;
+
+       spin_lock_irqsave(&rl->lock, flags);
+       req = _zfcp_reqlist_find(rl, req_id);
+       if (req)
+               list_del(&req->list);
+       spin_unlock_irqrestore(&rl->lock, flags);
+
+       return req;
+}
+
+/**
+ * zfcp_reqlist_add - Add entry to reqlist
+ * @rl: reqlist where to add the entry
+ * @req: The entry to add
+ *
+ * The request id always increases. As an optimization new requests
+ * are added here with list_add_tail at the end of the bucket lists
+ * while old requests are looked up starting at the beginning of the
+ * lists.
+ */
+static inline void zfcp_reqlist_add(struct zfcp_reqlist *rl,
+                                   struct zfcp_fsf_req *req)
+{
+       unsigned int i;
+       unsigned long flags;
+
+       i = zfcp_reqlist_hash(req->req_id);
+
+       spin_lock_irqsave(&rl->lock, flags);
+       list_add_tail(&req->list, &rl->buckets[i]);
+       spin_unlock_irqrestore(&rl->lock, flags);
+}
+
+/**
+ * zfcp_reqlist_move - Move all entries from reqlist to simple list
+ * @rl: The zfcp_reqlist where to remove all entries
+ * @list: The list where to move all entries
+ */
+static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl,
+                                    struct list_head *list)
+{
+       unsigned int i;
+       unsigned long flags;
+
+       spin_lock_irqsave(&rl->lock, flags);
+       for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
+               list_splice_init(&rl->buckets[i], list);
+       spin_unlock_irqrestore(&rl->lock, flags);
+}
+
+#endif /* ZFCP_REQLIST_H */
index 771cc536a989f7a72578a80bd1cd078775408567..c3c4178888afbc2a344c708add3d936f8256b59e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interface to Linux SCSI midlayer.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -15,6 +15,7 @@
 #include "zfcp_ext.h"
 #include "zfcp_dbf.h"
 #include "zfcp_fc.h"
+#include "zfcp_reqlist.h"
 
 static unsigned int default_depth = 32;
 module_param_named(queue_depth, default_depth, uint, 0600);
@@ -43,7 +44,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
 {
        struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
        unit->device = NULL;
-       put_device(&unit->sysfs_device);
+       put_device(&unit->dev);
 }
 
 static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
@@ -59,10 +60,9 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
 {
        struct zfcp_adapter *adapter =
                (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
+
        set_host_byte(scpnt, result);
-       if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
-               zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
-       /* return directly */
+       zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt);
        scpnt->scsi_done(scpnt);
 }
 
@@ -86,18 +86,10 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
        adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
        unit = scpnt->device->hostdata;
 
-       BUG_ON(!adapter || (adapter != unit->port->adapter));
-       BUG_ON(!scpnt->scsi_done);
-
-       if (unlikely(!unit)) {
-               zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
-               return 0;
-       }
-
        scsi_result = fc_remote_port_chkready(rport);
        if (unlikely(scsi_result)) {
                scpnt->result = scsi_result;
-               zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
+               zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt);
                scpnt->scsi_done(scpnt);
                return 0;
        }
@@ -189,9 +181,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
        /* avoid race condition between late normal completion and abort */
        write_lock_irqsave(&adapter->abort_lock, flags);
 
-       spin_lock(&adapter->req_list_lock);
-       old_req = zfcp_reqlist_find(adapter, old_reqid);
-       spin_unlock(&adapter->req_list_lock);
+       old_req = zfcp_reqlist_find(adapter->req_list, old_reqid);
        if (!old_req) {
                write_unlock_irqrestore(&adapter->abort_lock, flags);
                zfcp_dbf_scsi_abort("lte1", adapter->dbf, scpnt, NULL,
@@ -521,7 +511,7 @@ static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
 
        if (port) {
                zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL);
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
        }
 }
 
@@ -563,23 +553,23 @@ static void zfcp_scsi_rport_block(struct zfcp_port *port)
 
 void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
 {
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
        port->rport_task = RPORT_ADD;
 
        if (!queue_work(port->adapter->work_queue, &port->rport_work))
-               put_device(&port->sysfs_device);
+               put_device(&port->dev);
 }
 
 void zfcp_scsi_schedule_rport_block(struct zfcp_port *port)
 {
-       get_device(&port->sysfs_device);
+       get_device(&port->dev);
        port->rport_task = RPORT_DEL;
 
        if (port->rport && queue_work(port->adapter->work_queue,
                                      &port->rport_work))
                return;
 
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *adapter)
@@ -608,7 +598,7 @@ void zfcp_scsi_rport_work(struct work_struct *work)
                }
        }
 
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 
@@ -626,7 +616,7 @@ void zfcp_scsi_scan(struct work_struct *work)
                                 scsilun_to_int((struct scsi_lun *)
                                                &unit->fcp_lun), 0);
 
-       put_device(&unit->sysfs_device);
+       put_device(&unit->dev);
 }
 
 struct fc_function_template zfcp_transport_functions = {
@@ -652,6 +642,7 @@ struct fc_function_template zfcp_transport_functions = {
        .show_host_port_state = 1,
        .show_host_active_fc4s = 1,
        .bsg_request = zfcp_fc_exec_bsg_job,
+       .bsg_timeout = zfcp_fc_timeout_bsg_job,
        /* no functions registered for following dynamic attributes but
           directly set by LLDD */
        .show_host_port_type = 1,
index f539e006683cdf3ef0aff3941bcd82cbcdae2266..a43035d4bd70d6b4bca8947b9060de52c8d374e5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * sysfs attributes.
  *
- * Copyright IBM Corporation 2008, 2009
+ * Copyright IBM Corporation 2008, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -19,8 +19,7 @@ static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev,               \
                                                   struct device_attribute *at,\
                                                   char *buf)                  \
 {                                                                             \
-       struct _feat_def *_feat = container_of(dev, struct _feat_def,          \
-                                              sysfs_device);                  \
+       struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
                                                                               \
        return sprintf(buf, _format, _value);                                  \
 }                                                                             \
@@ -87,8 +86,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev,          \
                                                struct device_attribute *attr, \
                                                char *buf)                     \
 {                                                                             \
-       struct _feat_def *_feat = container_of(dev, struct _feat_def,          \
-                                              sysfs_device);                  \
+       struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
                                                                               \
        if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED)       \
                return sprintf(buf, "1\n");                                    \
@@ -99,12 +97,11 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev,               \
                                                 struct device_attribute *attr,\
                                                 const char *buf, size_t count)\
 {                                                                             \
-       struct _feat_def *_feat = container_of(dev, struct _feat_def,          \
-                                              sysfs_device);                  \
+       struct _feat_def *_feat = container_of(dev, struct _feat_def, dev);    \
        unsigned long val;                                                     \
        int retval = 0;                                                        \
                                                                               \
-       if (!(_feat && get_device(&_feat->sysfs_device)))                      \
+       if (!(_feat && get_device(&_feat->dev)))                               \
                return -EBUSY;                                                 \
                                                                               \
        if (strict_strtoul(buf, 0, &val) || val != 0) {                        \
@@ -118,7 +115,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev,               \
                                  _reopen_id, NULL);                           \
        zfcp_erp_wait(_adapter);                                               \
 out:                                                                          \
-       put_device(&_feat->sysfs_device);                                      \
+       put_device(&_feat->dev);                                               \
        return retval ? retval : (ssize_t) count;                              \
 }                                                                             \
 static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO,                        \
@@ -224,10 +221,10 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
        list_del(&port->list);
        write_unlock_irq(&adapter->port_list_lock);
 
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 
        zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL);
-       zfcp_device_unregister(&port->sysfs_device, &zfcp_sysfs_port_attrs);
+       zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
  out:
        zfcp_ccw_adapter_put(adapter);
        return retval ? retval : (ssize_t) count;
@@ -258,13 +255,12 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
                                         struct device_attribute *attr,
                                         const char *buf, size_t count)
 {
-       struct zfcp_port *port = container_of(dev, struct zfcp_port,
-                                             sysfs_device);
+       struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
        struct zfcp_unit *unit;
        u64 fcp_lun;
        int retval = -EINVAL;
 
-       if (!(port && get_device(&port->sysfs_device)))
+       if (!(port && get_device(&port->dev)))
                return -EBUSY;
 
        if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
@@ -280,7 +276,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
        zfcp_erp_wait(unit->port->adapter);
        flush_work(&unit->scsi_work);
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
        return retval ? retval : (ssize_t) count;
 }
 static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store);
@@ -289,13 +285,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
                                            struct device_attribute *attr,
                                            const char *buf, size_t count)
 {
-       struct zfcp_port *port = container_of(dev, struct zfcp_port,
-                                             sysfs_device);
+       struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
        struct zfcp_unit *unit;
        u64 fcp_lun;
        int retval = -EINVAL;
 
-       if (!(port && get_device(&port->sysfs_device)))
+       if (!(port && get_device(&port->dev)))
                return -EBUSY;
 
        if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
@@ -314,12 +309,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
        list_del(&unit->list);
        write_unlock_irq(&port->unit_list_lock);
 
-       put_device(&unit->sysfs_device);
+       put_device(&unit->dev);
 
        zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL);
-       zfcp_device_unregister(&unit->sysfs_device, &zfcp_sysfs_unit_attrs);
+       zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
        return retval ? retval : (ssize_t) count;
 }
 static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
index 75ac19b1192ff40d144fec752b7937b158abe86e..fc2f676e984da2aaf9937f4662cff2e83a73dcb7 100644 (file)
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp
 
        ph = 0;
        if (dp)
-               ph = dp->node;
+               ph = dp->phandle;
 
        data->current_node = dp;
        *((int *) op->oprom_array) = ph;
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
 
                dp = pci_device_to_OF_node(pdev);
                data->current_node = dp;
-               *((int *)op->oprom_array) = dp->node;
+               *((int *)op->oprom_array) = dp->phandle;
                op->oprom_size = sizeof(int);
                err = copyout(argp, op, bufsize + sizeof(int));
 
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open
 
        dp = of_find_node_by_path(op->oprom_array);
        if (dp)
-               ph = dp->node;
+               ph = dp->phandle;
        data->current_node = dp;
        *((int *)op->oprom_array) = ph;
        op->oprom_size = sizeof(int);
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
                }
        }
        if (dp)
-               nd = dp->node;
+               nd = dp->phandle;
        if (copy_to_user(argp, &nd, sizeof(phandle)))
                return -EFAULT;
 
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
        case OPIOCGETOPTNODE:
                BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
 
-               if (copy_to_user(argp, &options_node->node, sizeof(phandle)))
+               if (copy_to_user(argp, &options_node->phandle, sizeof(phandle)))
                        return -EFAULT;
 
                return 0;
index b898d382b7b0768d93ed3250bb0782ba1d38c095..e40cdfb7541f102b8778df8f52007b708ebe42bf 100644 (file)
@@ -3924,7 +3924,7 @@ static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card)
 {
        struct sccb_mgr_tar_info *currTar_Info;
 
-       if ((p_sccb->TargID > MAX_SCSI_TAR) || (p_sccb->Lun > MAX_LUN)) {
+       if ((p_sccb->TargID >= MAX_SCSI_TAR) || (p_sccb->Lun >= MAX_LUN)) {
                return;
        }
        currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
index 2a889853a106b96227d203881b84880db254b378..7e26ebc266614ad18030622a4db2c7cc16c9f450 100644 (file)
@@ -293,7 +293,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
                        status = -EINVAL;
                }
        }
-       aac_fib_complete(fibptr);
+       /* Do not set XferState to zero unless receives a response from F/W */
+       if (status >= 0)
+               aac_fib_complete(fibptr);
+
        /* Send a CT_COMMIT_CONFIG to enable discovery of devices */
        if (status >= 0) {
                if ((aac_commit == 1) || commit_flag) {
@@ -310,13 +313,18 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
                                    FsaNormal,
                                    1, 1,
                                    NULL, NULL);
-                       aac_fib_complete(fibptr);
+                       /* Do not set XferState to zero unless
+                        * receives a response from F/W */
+                       if (status >= 0)
+                               aac_fib_complete(fibptr);
                } else if (aac_commit == 0) {
                        printk(KERN_WARNING
                          "aac_get_config_status: Foreign device configurations are being ignored\n");
                }
        }
-       aac_fib_free(fibptr);
+       /* FIB should be freed only after getting the response from the F/W */
+       if (status != -ERESTARTSYS)
+               aac_fib_free(fibptr);
        return status;
 }
 
@@ -355,7 +363,9 @@ int aac_get_containers(struct aac_dev *dev)
                maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries);
                aac_fib_complete(fibptr);
        }
-       aac_fib_free(fibptr);
+       /* FIB should be freed only after getting the response from the F/W */
+       if (status != -ERESTARTSYS)
+               aac_fib_free(fibptr);
 
        if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
                maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
@@ -1245,8 +1255,12 @@ int aac_get_adapter_info(struct aac_dev* dev)
                         NULL);
 
        if (rcode < 0) {
-               aac_fib_complete(fibptr);
-               aac_fib_free(fibptr);
+               /* FIB should be freed only after
+                * getting the response from the F/W */
+               if (rcode != -ERESTARTSYS) {
+                       aac_fib_complete(fibptr);
+                       aac_fib_free(fibptr);
+               }
                return rcode;
        }
        memcpy(&dev->adapter_info, info, sizeof(*info));
@@ -1270,6 +1284,12 @@ int aac_get_adapter_info(struct aac_dev* dev)
 
                if (rcode >= 0)
                        memcpy(&dev->supplement_adapter_info, sinfo, sizeof(*sinfo));
+               if (rcode == -ERESTARTSYS) {
+                       fibptr = aac_fib_alloc(dev);
+                       if (!fibptr)
+                               return -ENOMEM;
+               }
+
        }
 
 
@@ -1470,9 +1490,11 @@ int aac_get_adapter_info(struct aac_dev* dev)
                          (dev->scsi_host_ptr->sg_tablesize * 8) + 112;
                }
        }
-
-       aac_fib_complete(fibptr);
-       aac_fib_free(fibptr);
+       /* FIB should be freed only after getting the response from the F/W */
+       if (rcode != -ERESTARTSYS) {
+               aac_fib_complete(fibptr);
+               aac_fib_free(fibptr);
+       }
 
        return rcode;
 }
@@ -1633,6 +1655,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
         *      Alocate and initialize a Fib
         */
        if (!(cmd_fibcontext = aac_fib_alloc(dev))) {
+               printk(KERN_WARNING "aac_read: fib allocation failed\n");
                return -1;
        }
 
@@ -1712,9 +1735,14 @@ static int aac_write(struct scsi_cmnd * scsicmd)
         *      Allocate and initialize a Fib then setup a BlockWrite command
         */
        if (!(cmd_fibcontext = aac_fib_alloc(dev))) {
-               scsicmd->result = DID_ERROR << 16;
-               scsicmd->scsi_done(scsicmd);
-               return 0;
+               /* FIB temporarily unavailable,not catastrophic failure */
+
+               /* scsicmd->result = DID_ERROR << 16;
+                * scsicmd->scsi_done(scsicmd);
+                * return 0;
+                */
+               printk(KERN_WARNING "aac_write: fib allocation failed\n");
+               return -1;
        }
 
        status = aac_adapter_write(cmd_fibcontext, scsicmd, lba, count, fua);
index 83986ed865569f144b980fc975619704c85cd0bf..619c02d9c86227c5b423b663bb3737b02ebc5989 100644 (file)
@@ -12,7 +12,7 @@
  *----------------------------------------------------------------------------*/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 2461
+# define AAC_DRIVER_BUILD 24702
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -1036,6 +1036,9 @@ struct aac_dev
        u8                      printf_enabled;
        u8                      in_reset;
        u8                      msi;
+       int                     management_fib_count;
+       spinlock_t              manage_lock;
+
 };
 
 #define aac_adapter_interrupt(dev) \
index 0391d759dfdbd5fb1676f68920f67cec6d8ef37a..9c0c91178538f61c9df636777e672f965e49d3e3 100644 (file)
@@ -153,7 +153,7 @@ cleanup:
                fibptr->hw_fib_pa = hw_fib_pa;
                fibptr->hw_fib_va = hw_fib;
        }
-       if (retval != -EINTR)
+       if (retval != -ERESTARTSYS)
                aac_fib_free(fibptr);
        return retval;
 }
@@ -322,7 +322,7 @@ return_fib:
                }
                if (f.wait) {
                        if(down_interruptible(&fibctx->wait_sem) < 0) {
-                               status = -EINTR;
+                               status = -ERESTARTSYS;
                        } else {
                                /* Lock again and retry */
                                spin_lock_irqsave(&dev->fib_lock, flags);
@@ -593,10 +593,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                                u64 addr;
                                void* p;
                                if (upsg->sg[i].count >
-                                   (dev->adapter_info.options &
+                                   ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
-                                     65536) {
+                                     65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
                                }
@@ -645,10 +645,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                                u64 addr;
                                void* p;
                                if (usg->sg[i].count >
-                                   (dev->adapter_info.options &
+                                   ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
-                                     65536) {
+                                     65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
                                }
@@ -695,10 +695,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                                uintptr_t addr;
                                void* p;
                                if (usg->sg[i].count >
-                                   (dev->adapter_info.options &
+                                   ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
-                                     65536) {
+                                     65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
                                }
@@ -734,10 +734,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                                dma_addr_t addr;
                                void* p;
                                if (upsg->sg[i].count >
-                                   (dev->adapter_info.options &
+                                   ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
-                                     65536) {
+                                     65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
                                }
@@ -772,8 +772,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                psg->count = cpu_to_le32(sg_indx+1);
                status = aac_fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL);
        }
-       if (status == -EINTR) {
-               rcode = -EINTR;
+       if (status == -ERESTARTSYS) {
+               rcode = -ERESTARTSYS;
                goto cleanup;
        }
 
@@ -810,7 +810,7 @@ cleanup:
        for(i=0; i <= sg_indx; i++){
                kfree(sg_list[i]);
        }
-       if (rcode != -EINTR) {
+       if (rcode != -ERESTARTSYS) {
                aac_fib_complete(srbfib);
                aac_fib_free(srbfib);
        }
@@ -848,7 +848,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
         */
 
        status = aac_dev_ioctl(dev, cmd, arg);
-       if(status != -ENOTTY)
+       if (status != -ENOTTY)
                return status;
 
        switch (cmd) {
index 666d5151d628e81228732ca4b72c03b9852636ea..a7261486ccd49cb20cfcaa7bb53d82c6f706be25 100644 (file)
@@ -194,7 +194,9 @@ int aac_send_shutdown(struct aac_dev * dev)
 
        if (status >= 0)
                aac_fib_complete(fibctx);
-       aac_fib_free(fibctx);
+       /* FIB should be freed only after getting the response from the F/W */
+       if (status != -ERESTARTSYS)
+               aac_fib_free(fibctx);
        return status;
 }
 
@@ -304,6 +306,8 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
        /*
         *      Check the preferred comm settings, defaults from template.
         */
+       dev->management_fib_count = 0;
+       spin_lock_init(&dev->manage_lock);
        dev->max_fib_size = sizeof(struct hw_fib);
        dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
                - sizeof(struct aac_fibhdr)
index 956261f251817ea5ab0873a60c96835e1bcf13e1..94d2954d79ae0411a00507a8f5c7b4f0fa5bdf16 100644 (file)
@@ -189,7 +189,14 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
 
 void aac_fib_free(struct fib *fibptr)
 {
-       unsigned long flags;
+       unsigned long flags, flagsv;
+
+       spin_lock_irqsave(&fibptr->event_lock, flagsv);
+       if (fibptr->done == 2) {
+               spin_unlock_irqrestore(&fibptr->event_lock, flagsv);
+               return;
+       }
+       spin_unlock_irqrestore(&fibptr->event_lock, flagsv);
 
        spin_lock_irqsave(&fibptr->dev->fib_lock, flags);
        if (unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT))
@@ -390,6 +397,8 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
        struct hw_fib * hw_fib = fibptr->hw_fib_va;
        unsigned long flags = 0;
        unsigned long qflags;
+       unsigned long mflags = 0;
+
 
        if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned)))
                return -EBUSY;
@@ -471,9 +480,31 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
        if (!dev->queues)
                return -EBUSY;
 
-       if(wait)
+       if (wait) {
+
+               spin_lock_irqsave(&dev->manage_lock, mflags);
+               if (dev->management_fib_count >= AAC_NUM_MGT_FIB) {
+                       printk(KERN_INFO "No management Fibs Available:%d\n",
+                                               dev->management_fib_count);
+                       spin_unlock_irqrestore(&dev->manage_lock, mflags);
+                       return -EBUSY;
+               }
+               dev->management_fib_count++;
+               spin_unlock_irqrestore(&dev->manage_lock, mflags);
                spin_lock_irqsave(&fibptr->event_lock, flags);
-       aac_adapter_deliver(fibptr);
+       }
+
+       if (aac_adapter_deliver(fibptr) != 0) {
+               printk(KERN_ERR "aac_fib_send: returned -EBUSY\n");
+               if (wait) {
+                       spin_unlock_irqrestore(&fibptr->event_lock, flags);
+                       spin_lock_irqsave(&dev->manage_lock, mflags);
+                       dev->management_fib_count--;
+                       spin_unlock_irqrestore(&dev->manage_lock, mflags);
+               }
+               return -EBUSY;
+       }
+
 
        /*
         *      If the caller wanted us to wait for response wait now.
@@ -516,14 +547,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                                udelay(5);
                        }
                } else if (down_interruptible(&fibptr->event_wait)) {
-                       fibptr->done = 2;
-                       up(&fibptr->event_wait);
+                       /* Do nothing ... satisfy
+                        * down_interruptible must_check */
                }
+
                spin_lock_irqsave(&fibptr->event_lock, flags);
-               if ((fibptr->done == 0) || (fibptr->done == 2)) {
+               if (fibptr->done == 0) {
                        fibptr->done = 2; /* Tell interrupt we aborted */
                        spin_unlock_irqrestore(&fibptr->event_lock, flags);
-                       return -EINTR;
+                       return -ERESTARTSYS;
                }
                spin_unlock_irqrestore(&fibptr->event_lock, flags);
                BUG_ON(fibptr->done == 0);
@@ -689,6 +721,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
 
 int aac_fib_complete(struct fib *fibptr)
 {
+       unsigned long flags;
        struct hw_fib * hw_fib = fibptr->hw_fib_va;
 
        /*
@@ -709,6 +742,13 @@ int aac_fib_complete(struct fib *fibptr)
         *      command is complete that we had sent to the adapter and this
         *      cdb could be reused.
         */
+       spin_lock_irqsave(&fibptr->event_lock, flags);
+       if (fibptr->done == 2) {
+               spin_unlock_irqrestore(&fibptr->event_lock, flags);
+               return 0;
+       }
+       spin_unlock_irqrestore(&fibptr->event_lock, flags);
+
        if((hw_fib->header.XferState & cpu_to_le32(SentFromHost)) &&
                (hw_fib->header.XferState & cpu_to_le32(AdapterProcessed)))
        {
@@ -1355,7 +1395,10 @@ int aac_reset_adapter(struct aac_dev * aac, int forced)
 
                        if (status >= 0)
                                aac_fib_complete(fibctx);
-                       aac_fib_free(fibctx);
+                       /* FIB should be freed only after getting
+                        * the response from the F/W */
+                       if (status != -ERESTARTSYS)
+                               aac_fib_free(fibctx);
                }
        }
 
@@ -1759,6 +1802,7 @@ int aac_command_thread(void *data)
                                struct fib *fibptr;
 
                                if ((fibptr = aac_fib_alloc(dev))) {
+                                       int status;
                                        __le32 *info;
 
                                        aac_fib_init(fibptr);
@@ -1769,15 +1813,21 @@ int aac_command_thread(void *data)
 
                                        *info = cpu_to_le32(now.tv_sec);
 
-                                       (void)aac_fib_send(SendHostTime,
+                                       status = aac_fib_send(SendHostTime,
                                                fibptr,
                                                sizeof(*info),
                                                FsaNormal,
                                                1, 1,
                                                NULL,
                                                NULL);
-                                       aac_fib_complete(fibptr);
-                                       aac_fib_free(fibptr);
+                                       /* Do not set XferState to zero unless
+                                        * receives a response from F/W */
+                                       if (status >= 0)
+                                               aac_fib_complete(fibptr);
+                                       /* FIB should be freed only after
+                                        * getting the response from the F/W */
+                                       if (status != -ERESTARTSYS)
+                                               aac_fib_free(fibptr);
                                }
                                difference = (long)(unsigned)update_interval*HZ;
                        } else {
index abc9ef5d1b10371643049a95cb8eef0202d7b5c8..9c7408fe8c7d1cb2d630e40e245cc9e642912441 100644 (file)
@@ -57,9 +57,9 @@ unsigned int aac_response_normal(struct aac_queue * q)
        struct hw_fib * hwfib;
        struct fib * fib;
        int consumed = 0;
-       unsigned long flags;
+       unsigned long flags, mflags;
 
-       spin_lock_irqsave(q->lock, flags);      
+       spin_lock_irqsave(q->lock, flags);
        /*
         *      Keep pulling response QEs off the response queue and waking
         *      up the waiters until there are no more QEs. We then return
@@ -125,12 +125,21 @@ unsigned int aac_response_normal(struct aac_queue * q)
                } else {
                        unsigned long flagv;
                        spin_lock_irqsave(&fib->event_lock, flagv);
-                       if (!fib->done)
+                       if (!fib->done) {
                                fib->done = 1;
-                       up(&fib->event_wait);
+                               up(&fib->event_wait);
+                       }
                        spin_unlock_irqrestore(&fib->event_lock, flagv);
+
+                       spin_lock_irqsave(&dev->manage_lock, mflags);
+                       dev->management_fib_count--;
+                       spin_unlock_irqrestore(&dev->manage_lock, mflags);
+
                        FIB_COUNTER_INCREMENT(aac_config.NormalRecved);
                        if (fib->done == 2) {
+                               spin_lock_irqsave(&fib->event_lock, flagv);
+                               fib->done = 0;
+                               spin_unlock_irqrestore(&fib->event_lock, flagv);
                                aac_fib_complete(fib);
                                aac_fib_free(fib);
                        }
@@ -232,6 +241,7 @@ unsigned int aac_command_normal(struct aac_queue *q)
 
 unsigned int aac_intr_normal(struct aac_dev * dev, u32 index)
 {
+       unsigned long mflags;
        dprintk((KERN_INFO "aac_intr_normal(%p,%x)\n", dev, index));
        if ((index & 0x00000002L)) {
                struct hw_fib * hw_fib;
@@ -320,11 +330,25 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 index)
                        unsigned long flagv;
                        dprintk((KERN_INFO "event_wait up\n"));
                        spin_lock_irqsave(&fib->event_lock, flagv);
-                       if (!fib->done)
+                       if (!fib->done) {
                                fib->done = 1;
-                       up(&fib->event_wait);
+                               up(&fib->event_wait);
+                       }
                        spin_unlock_irqrestore(&fib->event_lock, flagv);
+
+                       spin_lock_irqsave(&dev->manage_lock, mflags);
+                       dev->management_fib_count--;
+                       spin_unlock_irqrestore(&dev->manage_lock, mflags);
+
                        FIB_COUNTER_INCREMENT(aac_config.NormalRecved);
+                       if (fib->done == 2) {
+                               spin_lock_irqsave(&fib->event_lock, flagv);
+                               fib->done = 0;
+                               spin_unlock_irqrestore(&fib->event_lock, flagv);
+                               aac_fib_complete(fib);
+                               aac_fib_free(fib);
+                       }
+
                }
                return 0;
        }
index 4d419c155ce921c7562fe62807a2342d32f9c81e..78971db5b60ead866758373ed1dbf1d318276eef 100644 (file)
@@ -3171,13 +3171,16 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
                                tinfo->curr.transport_version = 2;
                                tinfo->goal.transport_version = 2;
                                tinfo->goal.ppr_options = 0;
-                               /*
-                                * Remove any SCBs in the waiting for selection
-                                * queue that may also be for this target so
-                                * that command ordering is preserved.
-                                */
-                               ahd_freeze_devq(ahd, scb);
-                               ahd_qinfifo_requeue_tail(ahd, scb);
+                               if (scb != NULL) {
+                                       /*
+                                        * Remove any SCBs in the waiting
+                                        * for selection queue that may
+                                        * also be for this target so that
+                                        * command ordering is preserved.
+                                        */
+                                       ahd_freeze_devq(ahd, scb);
+                                       ahd_qinfifo_requeue_tail(ahd, scb);
+                               }
                                printerror = 0;
                        }
                } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_WDTR, FALSE)
@@ -3194,13 +3197,16 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
                                      MSG_EXT_WDTR_BUS_8_BIT,
                                      AHD_TRANS_CUR|AHD_TRANS_GOAL,
                                      /*paused*/TRUE);
-                       /*
-                        * Remove any SCBs in the waiting for selection
-                        * queue that may also be for this target so that
-                        * command ordering is preserved.
-                        */
-                       ahd_freeze_devq(ahd, scb);
-                       ahd_qinfifo_requeue_tail(ahd, scb);
+                       if (scb != NULL) {
+                               /*
+                                * Remove any SCBs in the waiting for
+                                * selection queue that may also be for
+                                * this target so that command ordering
+                                * is preserved.
+                                */
+                               ahd_freeze_devq(ahd, scb);
+                               ahd_qinfifo_requeue_tail(ahd, scb);
+                       }
                        printerror = 0;
                } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_SDTR, FALSE)
                        && ppr_busfree == 0) {
@@ -3217,13 +3223,16 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
                                        /*ppr_options*/0,
                                        AHD_TRANS_CUR|AHD_TRANS_GOAL,
                                        /*paused*/TRUE);
-                       /*
-                        * Remove any SCBs in the waiting for selection
-                        * queue that may also be for this target so that
-                        * command ordering is preserved.
-                        */
-                       ahd_freeze_devq(ahd, scb);
-                       ahd_qinfifo_requeue_tail(ahd, scb);
+                       if (scb != NULL) {
+                               /*
+                                * Remove any SCBs in the waiting for
+                                * selection queue that may also be for
+                                * this target so that command ordering
+                                * is preserved.
+                                */
+                               ahd_freeze_devq(ahd, scb);
+                               ahd_qinfifo_requeue_tail(ahd, scb);
+                       }
                        printerror = 0;
                } else if ((ahd->msg_flags & MSG_FLAG_EXPECT_IDE_BUSFREE) != 0
                        && ahd_sent_msg(ahd, AHDMSG_1B,
@@ -3251,7 +3260,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
         * the message phases.  We check it last in case we
         * had to send some other message that caused a busfree.
         */
-       if (printerror != 0
+       if (scb != NULL && printerror != 0
         && (lastphase == P_MESGIN || lastphase == P_MESGOUT)
         && ((ahd->msg_flags & MSG_FLAG_EXPECT_PPR_BUSFREE) != 0)) {
 
index 477542602284661dbcb7d0d65d65223d612d3ec4..9e71ac611146ab86432664af1c2a40c7d2070ea0 100644 (file)
@@ -2516,7 +2516,7 @@ int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)
                if (info->scsi.phase == PHASE_IDLE)
                        fas216_kick(info);
 
-               mod_timer(&info->eh_timer, 30 * HZ);
+               mod_timer(&info->eh_timer, jiffies + 30 * HZ);
                spin_unlock_irqrestore(&info->host_lock, flags);
 
                /*
index a93a5040f087532a94d2a86b31d99ac6715fae78..136b49cea79132f14710bf72d568e35511b76672 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
 #define FW_VER_LEN     32
 #define MCC_Q_LEN      128
 #define MCC_CQ_LEN     256
+#define MAX_MCC_CMD    16
+/* BladeEngine Generation numbers */
+#define BE_GEN2 2
+#define BE_GEN3 3
 
 struct be_dma_mem {
        void *va;
@@ -57,6 +61,11 @@ static inline void *queue_head_node(struct be_queue_info *q)
        return q->dma_mem.va + q->head * q->entry_size;
 }
 
+static inline void *queue_get_wrb(struct be_queue_info *q, unsigned int wrb_num)
+{
+       return q->dma_mem.va + wrb_num * q->entry_size;
+}
+
 static inline void *queue_tail_node(struct be_queue_info *q)
 {
        return q->dma_mem.va + q->tail * q->entry_size;
@@ -104,15 +113,19 @@ struct be_ctrl_info {
        spinlock_t mcc_lock;    /* For serializing mcc cmds to BE card */
        spinlock_t mcc_cq_lock;
 
-       /* MCC Async callback */
-       void (*async_cb) (void *adapter, bool link_up);
-       void *adapter_ctxt;
+       wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
+       unsigned int mcc_tag[MAX_MCC_CMD];
+       unsigned int mcc_numtag[MAX_MCC_CMD + 1];
+       unsigned short mcc_alloc_index;
+       unsigned short mcc_free_index;
+       unsigned int mcc_tag_available;
 };
 
 #include "be_cmds.h"
 
 #define PAGE_SHIFT_4K 12
 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
+#define mcc_timeout            120000 /* 5s timeout */
 
 /* Returns number of pages spanned by the data starting at the given addr */
 #define PAGES_4K_SPANNED(_address, size)                               \
index f008708f1b08e440bc0985ff03eec004cb4346ee..67098578fba480f423d1007288c8be5df5f2eb6b 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -19,7 +19,7 @@
 #include "be_mgmt.h"
 #include "be_main.h"
 
-static void be_mcc_notify(struct beiscsi_hba *phba)
+void be_mcc_notify(struct beiscsi_hba *phba)
 {
        struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
        u32 val = 0;
@@ -29,6 +29,52 @@ static void be_mcc_notify(struct beiscsi_hba *phba)
        iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
 }
 
+unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
+{
+       unsigned int tag = 0;
+       unsigned int num = 0;
+
+mcc_tag_rdy:
+       if (phba->ctrl.mcc_tag_available) {
+               tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
+               phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
+               phba->ctrl.mcc_numtag[tag] = 0;
+       } else {
+               udelay(100);
+               num++;
+               if (num < mcc_timeout)
+                       goto mcc_tag_rdy;
+       }
+       if (tag) {
+               phba->ctrl.mcc_tag_available--;
+               if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1))
+                       phba->ctrl.mcc_alloc_index = 0;
+               else
+                       phba->ctrl.mcc_alloc_index++;
+       }
+       return tag;
+}
+
+void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
+{
+       spin_lock(&ctrl->mbox_lock);
+       tag = tag & 0x000000FF;
+       ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
+       if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
+               ctrl->mcc_free_index = 0;
+       else
+               ctrl->mcc_free_index++;
+       ctrl->mcc_tag_available++;
+       spin_unlock(&ctrl->mbox_lock);
+}
+
+bool is_link_state_evt(u32 trailer)
+{
+       return (((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
+                 ASYNC_TRAILER_EVENT_CODE_MASK) ==
+                 ASYNC_EVENT_CODE_LINK_STATE);
+}
+
 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
 {
        if (compl->flags != 0) {
@@ -64,12 +110,30 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
        return 0;
 }
 
-
-static inline bool is_link_state_evt(u32 trailer)
+int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
+                                   struct be_mcc_compl *compl)
 {
-       return (((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) &
-                 ASYNC_TRAILER_EVENT_CODE_MASK) ==
-                 ASYNC_EVENT_CODE_LINK_STATE);
+       u16 compl_status, extd_status;
+       unsigned short tag;
+
+       be_dws_le_to_cpu(compl, 4);
+
+       compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
+                                       CQE_STATUS_COMPL_MASK;
+       /* The ctrl.mcc_numtag[tag] is filled with
+        * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
+        * [7:0] = compl_status
+        */
+       tag = (compl->tag0 & 0x000000FF);
+       extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
+                                       CQE_STATUS_EXTD_MASK;
+
+       ctrl->mcc_numtag[tag]  = 0x80000000;
+       ctrl->mcc_numtag[tag] |= (compl->tag0 & 0x00FF0000);
+       ctrl->mcc_numtag[tag] |= (extd_status & 0x000000FF) << 8;
+       ctrl->mcc_numtag[tag] |= (compl_status & 0x000000FF);
+       wake_up_interruptible(&ctrl->mcc_wait[tag]);
+       return 0;
 }
 
 static struct be_mcc_compl *be_mcc_compl_get(struct beiscsi_hba *phba)
@@ -89,7 +153,7 @@ static void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
        iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
 }
 
-static void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
+void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
                struct be_async_event_link_state *evt)
 {
        switch (evt->port_link_status) {
@@ -97,13 +161,13 @@ static void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
                SE_DEBUG(DBG_LVL_1, "Link Down on Physical Port %d \n",
                                                evt->physical_port);
                phba->state |= BE_ADAPTER_LINK_DOWN;
+               iscsi_host_for_each_session(phba->shost,
+                                           be2iscsi_fail_session);
                break;
        case ASYNC_EVENT_LINK_UP:
                phba->state = BE_ADAPTER_UP;
                SE_DEBUG(DBG_LVL_1, "Link UP on Physical Port %d \n",
                                                evt->physical_port);
-               iscsi_host_for_each_session(phba->shost,
-                                           be2iscsi_fail_session);
                break;
        default:
                SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on"
@@ -162,7 +226,6 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
 /* Wait till no more pending mcc requests are present */
 static int be_mcc_wait_compl(struct beiscsi_hba *phba)
 {
-#define mcc_timeout            120000 /* 5s timeout */
        int i, status;
        for (i = 0; i < mcc_timeout; i++) {
                status = beiscsi_process_mcc(phba);
@@ -372,9 +435,10 @@ struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
 
        BUG_ON(atomic_read(&mccq->used) >= mccq->len);
        wrb = queue_head_node(mccq);
+       memset(wrb, 0, sizeof(*wrb));
+       wrb->tag0 = (mccq->head & 0x000000FF) << 16;
        queue_head_inc(mccq);
        atomic_inc(&mccq->used);
-       memset(wrb, 0, sizeof(*wrb));
        return wrb;
 }
 
index 5de8acb924cbce4e93bde3ed286acee517906722..49fcc787ee8bd5516c7eea10cd93cb7fff1800d3 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -425,14 +425,20 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
 int be_poll_mcc(struct be_ctrl_info *ctrl);
 unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
                                      struct beiscsi_hba *phba);
-int be_cmd_get_mac_addr(struct beiscsi_hba *phba, u8 *mac_addr);
-
+unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba);
+void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
 /*ISCSI Functuions */
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
 
 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
 int be_mcc_notify_wait(struct beiscsi_hba *phba);
+void be_mcc_notify(struct beiscsi_hba *phba);
+unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
+void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
+               struct be_async_event_link_state *evt);
+int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
+                                   struct be_mcc_compl *compl);
 
 int be_mbox_notify(struct be_ctrl_info *ctrl);
 
@@ -448,6 +454,8 @@ int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
                       struct be_queue_info *wrbq);
 
+bool is_link_state_evt(u32 trailer);
+
 struct be_default_pdu_context {
        u32 dw[4];
 } __packed;
index d587b0362f188eb6e07727f042e95295aee598ad..29a3aaf35f9ff2573c9f39b5f12460766fe91baf 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -101,6 +101,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
        struct iscsi_session *sess = cls_session->dd_data;
        struct beiscsi_session *beiscsi_sess = sess->dd_data;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_session_destroy\n");
        pci_pool_destroy(beiscsi_sess->bhs_pool);
        iscsi_session_teardown(cls_session);
 }
@@ -224,6 +225,7 @@ int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
        struct beiscsi_conn *beiscsi_conn = conn->dd_data;
        int len = 0;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_param, param= %d\n", param);
        beiscsi_ep = beiscsi_conn->ep;
        if (!beiscsi_ep) {
                SE_DEBUG(DBG_LVL_1,
@@ -254,6 +256,7 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
        struct iscsi_session *session = conn->session;
        int ret;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_set_param, param= %d\n", param);
        ret = iscsi_set_param(cls_conn, param, buf, buflen);
        if (ret)
                return ret;
@@ -271,8 +274,8 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
                        conn->max_recv_dlength = 65536;
                break;
        case ISCSI_PARAM_MAX_BURST:
-               if (session->first_burst > 262144)
-                       session->first_burst = 262144;
+               if (session->max_burst > 262144)
+                       session->max_burst = 262144;
                break;
        default:
                return 0;
@@ -293,12 +296,41 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
                           enum iscsi_host_param param, char *buf)
 {
        struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost);
+       struct be_cmd_resp_get_mac_addr *resp;
+       struct be_mcc_wrb *wrb;
+       unsigned int tag, wrb_num;
        int len = 0;
+       unsigned short status, extd_status;
+       struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param);
        switch (param) {
        case ISCSI_HOST_PARAM_HWADDRESS:
-               be_cmd_get_mac_addr(phba, phba->mac_address);
-               len = sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
+               tag = be_cmd_get_mac_addr(phba);
+               if (!tag) {
+                       SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed \n");
+                       return -1;
+               } else
+                       wait_event_interruptible(phba->ctrl.mcc_wait[tag],
+                                                phba->ctrl.mcc_numtag[tag]);
+
+               wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
+               extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
+               status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
+               if (status || extd_status) {
+                       SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed"
+                                           " status = %d extd_status = %d \n",
+                                           status, extd_status);
+                       free_mcc_tag(&phba->ctrl, tag);
+                       return -1;
+               } else {
+                       wrb = queue_get_wrb(mccq, wrb_num);
+                       free_mcc_tag(&phba->ctrl, tag);
+                       resp = embedded_payload(wrb);
+                       memcpy(phba->mac_address, resp->mac_address, ETH_ALEN);
+                       len = sysfs_format_mac(buf, phba->mac_address,
+                                              ETH_ALEN);
+               }
                break;
        default:
                return iscsi_host_get_param(shost, param, buf);
@@ -378,6 +410,7 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
        struct beiscsi_endpoint *beiscsi_ep;
        struct beiscsi_offload_params params;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_start\n");
        memset(&params, 0, sizeof(struct beiscsi_offload_params));
        beiscsi_ep = beiscsi_conn->ep;
        if (!beiscsi_ep)
@@ -422,8 +455,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 {
        struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
        struct beiscsi_hba *phba = beiscsi_ep->phba;
+       struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
+       struct be_mcc_wrb *wrb;
+       struct tcp_connect_and_offload_out *ptcpcnct_out;
+       unsigned short status, extd_status;
+       unsigned int tag, wrb_num;
        int ret = -1;
 
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn\n");
        beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
        if (beiscsi_ep->ep_cid == 0xFFFF) {
                SE_DEBUG(DBG_LVL_1, "No free cid available\n");
@@ -431,15 +470,44 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
        }
        SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d ",
                 beiscsi_ep->ep_cid);
-       phba->ep_array[beiscsi_ep->ep_cid] = ep;
-       if (beiscsi_ep->ep_cid >
-           (phba->fw_config.iscsi_cid_start + phba->params.cxns_per_ctrl)) {
+       phba->ep_array[beiscsi_ep->ep_cid -
+                      phba->fw_config.iscsi_cid_start] = ep;
+       if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
+                                 phba->params.cxns_per_ctrl * 2)) {
                SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n");
                return ret;
        }
 
        beiscsi_ep->cid_vld = 0;
-       return mgmt_open_connection(phba, dst_addr, beiscsi_ep);
+       tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep);
+       if (!tag) {
+               SE_DEBUG(DBG_LVL_1,
+                        "mgmt_invalidate_connection Failed for cid=%d \n",
+                        beiscsi_ep->ep_cid);
+       } else {
+               wait_event_interruptible(phba->ctrl.mcc_wait[tag],
+                                        phba->ctrl.mcc_numtag[tag]);
+       }
+       wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
+       extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
+       status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
+       if (status || extd_status) {
+               SE_DEBUG(DBG_LVL_1, "mgmt_open_connection Failed"
+                                   " status = %d extd_status = %d \n",
+                                   status, extd_status);
+               free_mcc_tag(&phba->ctrl, tag);
+               return -1;
+       } else {
+               wrb = queue_get_wrb(mccq, wrb_num);
+               free_mcc_tag(&phba->ctrl, tag);
+
+               ptcpcnct_out =  embedded_payload(wrb);
+               beiscsi_ep = ep->dd_data;
+               beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
+               beiscsi_ep->cid_vld = 1;
+               SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n");
+       }
+       return 0;
 }
 
 /**
@@ -459,14 +527,12 @@ static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
  * beiscsi_free_ep - free endpoint
  * @ep:        pointer to iscsi endpoint structure
  */
-static void beiscsi_free_ep(struct iscsi_endpoint *ep)
+static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
 {
-       struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
        struct beiscsi_hba *phba = beiscsi_ep->phba;
 
        beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
        beiscsi_ep->phba = NULL;
-       iscsi_destroy_endpoint(ep);
 }
 
 /**
@@ -495,9 +561,9 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
                return ERR_PTR(ret);
        }
 
-       if (phba->state) {
+       if (phba->state != BE_ADAPTER_UP) {
                ret = -EBUSY;
-               SE_DEBUG(DBG_LVL_1, "The Adapet state is Not UP \n");
+               SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP \n");
                return ERR_PTR(ret);
        }
 
@@ -509,9 +575,9 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
 
        beiscsi_ep = ep->dd_data;
        beiscsi_ep->phba = phba;
-
+       beiscsi_ep->openiscsi_ep = ep;
        if (beiscsi_open_conn(ep, NULL, dst_addr, non_blocking)) {
-               SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n");
+               SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn \n");
                ret = -ENOMEM;
                goto free_ep;
        }
@@ -519,7 +585,7 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
        return ep;
 
 free_ep:
-       beiscsi_free_ep(ep);
+       beiscsi_free_ep(beiscsi_ep);
        return ERR_PTR(ret);
 }
 
@@ -546,20 +612,22 @@ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
  * @ep: The iscsi endpoint
  * @flag: The type of connection closure
  */
-static int beiscsi_close_conn(struct iscsi_endpoint *ep, int flag)
+static int beiscsi_close_conn(struct  beiscsi_endpoint *beiscsi_ep, int flag)
 {
        int ret = 0;
-       struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
+       unsigned int tag;
        struct beiscsi_hba *phba = beiscsi_ep->phba;
 
-       if (MGMT_STATUS_SUCCESS !=
-           mgmt_upload_connection(phba, beiscsi_ep->ep_cid,
-               CONNECTION_UPLOAD_GRACEFUL)) {
+       tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag);
+       if (!tag) {
                SE_DEBUG(DBG_LVL_8, "upload failed for cid 0x%x",
                         beiscsi_ep->ep_cid);
                ret = -1;
+       } else {
+               wait_event_interruptible(phba->ctrl.mcc_wait[tag],
+                                        phba->ctrl.mcc_numtag[tag]);
+               free_mcc_tag(&phba->ctrl, tag);
        }
-
        return ret;
 }
 
@@ -574,19 +642,17 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
        struct beiscsi_conn *beiscsi_conn;
        struct beiscsi_endpoint *beiscsi_ep;
        struct beiscsi_hba *phba;
-       int flag = 0;
 
        beiscsi_ep = ep->dd_data;
        phba = beiscsi_ep->phba;
-       SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect\n");
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect for ep_cid = %d\n",
+                            beiscsi_ep->ep_cid);
 
        if (beiscsi_ep->conn) {
                beiscsi_conn = beiscsi_ep->conn;
                iscsi_suspend_queue(beiscsi_conn->conn);
-               beiscsi_close_conn(ep, flag);
        }
 
-       beiscsi_free_ep(ep);
 }
 
 /**
@@ -619,23 +685,31 @@ void beiscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
        struct iscsi_session *session = conn->session;
        struct Scsi_Host *shost = iscsi_session_to_shost(session->cls_session);
        struct beiscsi_hba *phba = iscsi_host_priv(shost);
-       unsigned int status;
+       unsigned int tag;
        unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH;
 
-       SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_stop\n");
        beiscsi_ep = beiscsi_conn->ep;
        if (!beiscsi_ep) {
                SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_stop , no beiscsi_ep\n");
                return;
        }
-       status = mgmt_invalidate_connection(phba, beiscsi_ep,
+       SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_stop  ep_cid = %d\n",
+                            beiscsi_ep->ep_cid);
+       tag = mgmt_invalidate_connection(phba, beiscsi_ep,
                                            beiscsi_ep->ep_cid, 1,
                                            savecfg_flag);
-       if (status != MGMT_STATUS_SUCCESS) {
+       if (!tag) {
                SE_DEBUG(DBG_LVL_1,
                         "mgmt_invalidate_connection Failed for cid=%d \n",
                         beiscsi_ep->ep_cid);
+       } else {
+               wait_event_interruptible(phba->ctrl.mcc_wait[tag],
+                                        phba->ctrl.mcc_numtag[tag]);
+               free_mcc_tag(&phba->ctrl, tag);
        }
+       beiscsi_close_conn(beiscsi_ep, CONNECTION_UPLOAD_GRACEFUL);
+       beiscsi_free_ep(beiscsi_ep);
+       iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
        beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
        iscsi_conn_stop(cls_conn, flag);
 }
index f92ffc5349fb6634d48be93561d1ddf906da173f..1f512c28cbf942da401d9cec1df3e7b6b74abcc8 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
index 1a557fa778887700b42c99c4fe55fb1328039ab7..7c22616ab141795a70e070e074ab4855e59df0cc 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -40,7 +40,6 @@
 static unsigned int be_iopoll_budget = 10;
 static unsigned int be_max_phys_size = 64;
 static unsigned int enable_msix = 1;
-static unsigned int ring_mode;
 
 MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
 MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
@@ -62,10 +61,10 @@ static int beiscsi_slave_configure(struct scsi_device *sdev)
 /*------------------- PCI Driver operations and data ----------------- */
 static DEFINE_PCI_DEVICE_TABLE(beiscsi_pci_id_table) = {
        { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) },
+       { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) },
        { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
        { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
        { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID3) },
-       { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID4) },
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
@@ -112,6 +111,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
        memset(phba, 0, sizeof(*phba));
        phba->shost = shost;
        phba->pcidev = pci_dev_get(pcidev);
+       pci_set_drvdata(pcidev, phba);
 
        if (iscsi_host_add(shost, &phba->pcidev->dev))
                goto free_devices;
@@ -143,6 +143,7 @@ static int beiscsi_map_pci_bars(struct beiscsi_hba *phba,
                                struct pci_dev *pcidev)
 {
        u8 __iomem *addr;
+       int pcicfg_reg;
 
        addr = ioremap_nocache(pci_resource_start(pcidev, 2),
                               pci_resource_len(pcidev, 2));
@@ -159,13 +160,19 @@ static int beiscsi_map_pci_bars(struct beiscsi_hba *phba,
        phba->db_va = addr;
        phba->db_pa.u.a64.address =  pci_resource_start(pcidev, 4);
 
-       addr = ioremap_nocache(pci_resource_start(pcidev, 1),
-                              pci_resource_len(pcidev, 1));
+       if (phba->generation == BE_GEN2)
+               pcicfg_reg = 1;
+       else
+               pcicfg_reg = 0;
+
+       addr = ioremap_nocache(pci_resource_start(pcidev, pcicfg_reg),
+                              pci_resource_len(pcidev, pcicfg_reg));
+
        if (addr == NULL)
                goto pci_map_err;
        phba->ctrl.pcicfg = addr;
        phba->pci_va = addr;
-       phba->pci_pa.u.a64.address = pci_resource_start(pcidev, 1);
+       phba->pci_pa.u.a64.address = pci_resource_start(pcidev, pcicfg_reg);
        return 0;
 
 pci_map_err:
@@ -230,29 +237,27 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev)
 
 static void beiscsi_get_params(struct beiscsi_hba *phba)
 {
-       phba->params.ios_per_ctrl = BE2_IO_DEPTH;
-       phba->params.cxns_per_ctrl = BE2_MAX_SESSIONS;
-       phba->params.asyncpdus_per_ctrl = BE2_ASYNCPDUS;
-       phba->params.icds_per_ctrl = BE2_MAX_ICDS / 2;
+       phba->params.ios_per_ctrl = (phba->fw_config.iscsi_icd_count
+                                   - (phba->fw_config.iscsi_cid_count
+                                   + BE2_TMFS
+                                   + BE2_NOPOUT_REQ));
+       phba->params.cxns_per_ctrl = phba->fw_config.iscsi_cid_count;
+       phba->params.asyncpdus_per_ctrl = phba->fw_config.iscsi_cid_count;;
+       phba->params.icds_per_ctrl = phba->fw_config.iscsi_icd_count;;
        phba->params.num_sge_per_io = BE2_SGE;
        phba->params.defpdu_hdr_sz = BE2_DEFPDU_HDR_SZ;
        phba->params.defpdu_data_sz = BE2_DEFPDU_DATA_SZ;
        phba->params.eq_timer = 64;
        phba->params.num_eq_entries =
-           (((BE2_CMDS_PER_CXN * 2 + BE2_LOGOUTS + BE2_TMFS + BE2_ASYNCPDUS) /
-                                                               512) + 1) * 512;
+           (((BE2_CMDS_PER_CXN * 2 + phba->fw_config.iscsi_cid_count * 2
+                                   + BE2_TMFS) / 512) + 1) * 512;
        phba->params.num_eq_entries = (phba->params.num_eq_entries < 1024)
                                ? 1024 : phba->params.num_eq_entries;
        SE_DEBUG(DBG_LVL_8, "phba->params.num_eq_entries=%d \n",
-                phba->params.num_eq_entries);
+                            phba->params.num_eq_entries);
        phba->params.num_cq_entries =
-           (((BE2_CMDS_PER_CXN * 2 + BE2_LOGOUTS + BE2_TMFS + BE2_ASYNCPDUS) /
-                                                               512) + 1) * 512;
-       SE_DEBUG(DBG_LVL_8,
-               "phba->params.num_cq_entries=%d BE2_CMDS_PER_CXN=%d"
-               "BE2_LOGOUTS=%d BE2_TMFS=%d BE2_ASYNCPDUS=%d \n",
-               phba->params.num_cq_entries, BE2_CMDS_PER_CXN,
-               BE2_LOGOUTS, BE2_TMFS, BE2_ASYNCPDUS);
+           (((BE2_CMDS_PER_CXN * 2 +  phba->fw_config.iscsi_cid_count * 2
+                                   + BE2_TMFS) / 512) + 1) * 512;
        phba->params.wrbs_per_cxn = 256;
 }
 
@@ -443,7 +448,7 @@ static irqreturn_t be_isr(int irq, void *dev_id)
                        if (phba->todo_mcc_cq)
                                queue_work(phba->wq, &phba->work_cqs);
 
-               if ((num_mcceq_processed) && (!num_ioeq_processed))
+                       if ((num_mcceq_processed) && (!num_ioeq_processed))
                                hwi_ring_eq_db(phba, eq->id, 0,
                                              (num_ioeq_processed +
                                               num_mcceq_processed) , 1, 1);
@@ -561,6 +566,7 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn,
                SE_DEBUG(DBG_LVL_1, "In ISCSI_OP_REJECT\n");
                break;
        case ISCSI_OP_LOGIN_RSP:
+       case ISCSI_OP_TEXT_RSP:
                task = conn->login_task;
                io_task = task->dd_data;
                login_hdr = (struct iscsi_hdr *)ppdu;
@@ -631,29 +637,29 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
  * alloc_wrb_handle - To allocate a wrb handle
  * @phba: The hba pointer
  * @cid: The cid to use for allocation
- * @index: index allocation and wrb index
  *
  * This happens under session_lock until submission to chip
  */
-struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid,
-                                   int index)
+struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid)
 {
        struct hwi_wrb_context *pwrb_context;
        struct hwi_controller *phwi_ctrlr;
-       struct wrb_handle *pwrb_handle;
+       struct wrb_handle *pwrb_handle, *pwrb_handle_tmp;
 
        phwi_ctrlr = phba->phwi_ctrlr;
        pwrb_context = &phwi_ctrlr->wrb_context[cid];
-       if (pwrb_context->wrb_handles_available) {
+       if (pwrb_context->wrb_handles_available >= 2) {
                pwrb_handle = pwrb_context->pwrb_handle_base[
                                            pwrb_context->alloc_index];
                pwrb_context->wrb_handles_available--;
-               pwrb_handle->nxt_wrb_index = pwrb_handle->wrb_index;
                if (pwrb_context->alloc_index ==
                                                (phba->params.wrbs_per_cxn - 1))
                        pwrb_context->alloc_index = 0;
                else
                        pwrb_context->alloc_index++;
+               pwrb_handle_tmp = pwrb_context->pwrb_handle_base[
+                                               pwrb_context->alloc_index];
+               pwrb_handle->nxt_wrb_index = pwrb_handle_tmp->wrb_index;
        } else
                pwrb_handle = NULL;
        return pwrb_handle;
@@ -671,9 +677,7 @@ static void
 free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context,
                struct wrb_handle *pwrb_handle)
 {
-       if (!ring_mode)
-               pwrb_context->pwrb_handle_base[pwrb_context->free_index] =
-                                              pwrb_handle;
+       pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle;
        pwrb_context->wrb_handles_available++;
        if (pwrb_context->free_index == (phba->params.wrbs_per_cxn - 1))
                pwrb_context->free_index = 0;
@@ -790,6 +794,7 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
                memcpy(task->sc->sense_buffer, sense,
                       min_t(u16, sense_len, SCSI_SENSE_BUFFERSIZE));
        }
+
        if (io_task->cmd_bhs->iscsi_hdr.flags & ISCSI_FLAG_CMD_READ) {
                if (psol->dw[offsetof(struct amap_sol_cqe, i_res_cnt) / 32]
                                                        & SOL_RES_CNT_MASK)
@@ -811,6 +816,7 @@ be_complete_logout(struct beiscsi_conn *beiscsi_conn,
        struct iscsi_conn *conn = beiscsi_conn->conn;
 
        hdr = (struct iscsi_logout_rsp *)task->hdr;
+       hdr->opcode = ISCSI_OP_LOGOUT_RSP;
        hdr->t2wait = 5;
        hdr->t2retain = 0;
        hdr->flags = ((psol->dw[offsetof(struct amap_sol_cqe, i_flags) / 32]
@@ -825,6 +831,9 @@ be_complete_logout(struct beiscsi_conn *beiscsi_conn,
                                        & SOL_EXP_CMD_SN_MASK) +
                        ((psol->dw[offsetof(struct amap_sol_cqe, i_cmd_wnd)
                                        / 32] & SOL_CMD_WND_MASK) >> 24) - 1);
+       hdr->dlength[0] = 0;
+       hdr->dlength[1] = 0;
+       hdr->dlength[2] = 0;
        hdr->hlength = 0;
        hdr->itt = io_task->libiscsi_itt;
        __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0);
@@ -839,6 +848,7 @@ be_complete_tmf(struct beiscsi_conn *beiscsi_conn,
        struct beiscsi_io_task *io_task = task->dd_data;
 
        hdr = (struct iscsi_tm_rsp *)task->hdr;
+       hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP;
        hdr->flags = ((psol->dw[offsetof(struct amap_sol_cqe, i_flags) / 32]
                                        & SOL_FLAGS_MASK) >> 24) | 0x80;
        hdr->response = (psol->dw[offsetof(struct amap_sol_cqe, i_resp) /
@@ -859,7 +869,6 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
 {
        struct hwi_wrb_context *pwrb_context;
        struct wrb_handle *pwrb_handle = NULL;
-       struct sgl_handle *psgl_handle = NULL;
        struct hwi_controller *phwi_ctrlr;
        struct iscsi_task *task;
        struct beiscsi_io_task *io_task;
@@ -867,22 +876,14 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
        struct iscsi_session *session = conn->session;
 
        phwi_ctrlr = phba->phwi_ctrlr;
-       if (ring_mode) {
-               psgl_handle = phba->sgl_hndl_array[((psol->
-                             dw[offsetof(struct amap_sol_cqe_ring, icd_index) /
-                               32] & SOL_ICD_INDEX_MASK) >> 6)];
-               pwrb_context = &phwi_ctrlr->wrb_context[psgl_handle->cid];
-               task = psgl_handle->task;
-               pwrb_handle = NULL;
-       } else {
-               pwrb_context = &phwi_ctrlr->wrb_context[((psol->
+       pwrb_context = &phwi_ctrlr->wrb_context[((psol->
                                dw[offsetof(struct amap_sol_cqe, cid) / 32] &
-                               SOL_CID_MASK) >> 6)];
-               pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
+                               SOL_CID_MASK) >> 6) -
+                               phba->fw_config.iscsi_cid_start];
+       pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
                                dw[offsetof(struct amap_sol_cqe, wrb_index) /
                                32] & SOL_WRB_INDEX_MASK) >> 16)];
-               task = pwrb_handle->pio_handle;
-       }
+       task = pwrb_handle->pio_handle;
 
        io_task = task->dd_data;
        spin_lock(&phba->mgmt_sgl_lock);
@@ -923,31 +924,23 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
        struct iscsi_wrb *pwrb = NULL;
        struct hwi_controller *phwi_ctrlr;
        struct iscsi_task *task;
-       struct sgl_handle *psgl_handle = NULL;
        unsigned int type;
        struct iscsi_conn *conn = beiscsi_conn->conn;
        struct iscsi_session *session = conn->session;
 
        phwi_ctrlr = phba->phwi_ctrlr;
-       if (ring_mode) {
-               psgl_handle = phba->sgl_hndl_array[((psol->
-                             dw[offsetof(struct amap_sol_cqe_ring, icd_index) /
-                             32] & SOL_ICD_INDEX_MASK) >> 6)];
-               task = psgl_handle->task;
-               type = psgl_handle->type;
-       } else {
-               pwrb_context = &phwi_ctrlr->
-                               wrb_context[((psol->dw[offsetof
+       pwrb_context = &phwi_ctrlr->wrb_context[((psol->dw[offsetof
                                (struct amap_sol_cqe, cid) / 32]
-                               & SOL_CID_MASK) >> 6)];
-               pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
+                               & SOL_CID_MASK) >> 6) -
+                               phba->fw_config.iscsi_cid_start];
+       pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
                                dw[offsetof(struct amap_sol_cqe, wrb_index) /
                                32] & SOL_WRB_INDEX_MASK) >> 16)];
-               task = pwrb_handle->pio_handle;
-               pwrb = pwrb_handle->pwrb;
-               type = (pwrb->dw[offsetof(struct amap_iscsi_wrb, type) / 32] &
-                        WRB_TYPE_MASK) >> 28;
-       }
+       task = pwrb_handle->pio_handle;
+       pwrb = pwrb_handle->pwrb;
+       type = (pwrb->dw[offsetof(struct amap_iscsi_wrb, type) / 32] &
+                                WRB_TYPE_MASK) >> 28;
+
        spin_lock_bh(&session->lock);
        switch (type) {
        case HWH_TYPE_IO:
@@ -978,15 +971,7 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
                break;
 
        default:
-               if (ring_mode)
-                       shost_printk(KERN_WARNING, phba->shost,
-                               "In hwi_complete_cmd, unknown type = %d"
-                               "icd_index 0x%x CID 0x%x\n", type,
-                               ((psol->dw[offsetof(struct amap_sol_cqe_ring,
-                               icd_index) / 32] & SOL_ICD_INDEX_MASK) >> 6),
-                               psgl_handle->cid);
-               else
-                       shost_printk(KERN_WARNING, phba->shost,
+               shost_printk(KERN_WARNING, phba->shost,
                                "In hwi_complete_cmd, unknown type = %d"
                                "wrb_index 0x%x CID 0x%x\n", type,
                                ((psol->dw[offsetof(struct amap_iscsi_wrb,
@@ -1077,7 +1062,8 @@ hwi_get_async_handle(struct beiscsi_hba *phba,
 
        WARN_ON(!pasync_handle);
 
-       pasync_handle->cri = (unsigned short)beiscsi_conn->beiscsi_conn_cid;
+       pasync_handle->cri = (unsigned short)beiscsi_conn->beiscsi_conn_cid -
+                                            phba->fw_config.iscsi_cid_start;
        pasync_handle->is_header = is_header;
        pasync_handle->buffer_len = ((pdpdu_cqe->
                        dw[offsetof(struct amap_i_t_dpdu_cqe, dpl) / 32]
@@ -1327,9 +1313,10 @@ hwi_fwd_async_msg(struct beiscsi_conn *beiscsi_conn,
        }
 
        status = beiscsi_process_async_pdu(beiscsi_conn, phba,
-                                          beiscsi_conn->beiscsi_conn_cid,
-                                          phdr, hdr_len, pfirst_buffer,
-                                          buf_len);
+                                          (beiscsi_conn->beiscsi_conn_cid -
+                                           phba->fw_config.iscsi_cid_start),
+                                           phdr, hdr_len, pfirst_buffer,
+                                           buf_len);
 
        if (status == 0)
                hwi_free_async_msg(phba, cri);
@@ -1422,6 +1409,48 @@ static void hwi_process_default_pdu_ring(struct beiscsi_conn *beiscsi_conn,
        hwi_post_async_buffers(phba, pasync_handle->is_header);
 }
 
+static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
+{
+       struct be_queue_info *mcc_cq;
+       struct  be_mcc_compl *mcc_compl;
+       unsigned int num_processed = 0;
+
+       mcc_cq = &phba->ctrl.mcc_obj.cq;
+       mcc_compl = queue_tail_node(mcc_cq);
+       mcc_compl->flags = le32_to_cpu(mcc_compl->flags);
+       while (mcc_compl->flags & CQE_FLAGS_VALID_MASK) {
+
+               if (num_processed >= 32) {
+                       hwi_ring_cq_db(phba, mcc_cq->id,
+                                       num_processed, 0, 0);
+                       num_processed = 0;
+               }
+               if (mcc_compl->flags & CQE_FLAGS_ASYNC_MASK) {
+                       /* Interpret flags as an async trailer */
+                       if (is_link_state_evt(mcc_compl->flags))
+                               /* Interpret compl as a async link evt */
+                               beiscsi_async_link_state_process(phba,
+                               (struct be_async_event_link_state *) mcc_compl);
+                       else
+                               SE_DEBUG(DBG_LVL_1,
+                                       " Unsupported Async Event, flags"
+                                       " = 0x%08x \n", mcc_compl->flags);
+               } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
+                       be_mcc_compl_process_isr(&phba->ctrl, mcc_compl);
+                       atomic_dec(&phba->ctrl.mcc_obj.q.used);
+               }
+
+               mcc_compl->flags = 0;
+               queue_tail_inc(mcc_cq);
+               mcc_compl = queue_tail_node(mcc_cq);
+               mcc_compl->flags = le32_to_cpu(mcc_compl->flags);
+               num_processed++;
+       }
+
+       if (num_processed > 0)
+               hwi_ring_cq_db(phba, mcc_cq->id, num_processed, 1, 0);
+
+}
 
 static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
 {
@@ -1431,7 +1460,8 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
        unsigned int num_processed = 0;
        unsigned int tot_nump = 0;
        struct beiscsi_conn *beiscsi_conn;
-       struct sgl_handle *psgl_handle = NULL;
+       struct beiscsi_endpoint *beiscsi_ep;
+       struct iscsi_endpoint *ep;
        struct beiscsi_hba *phba;
 
        cq = pbe_eq->cq;
@@ -1442,32 +1472,13 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
               CQE_VALID_MASK) {
                be_dws_le_to_cpu(sol, sizeof(struct sol_cqe));
 
-               if (ring_mode) {
-                       psgl_handle = phba->sgl_hndl_array[((sol->
-                                     dw[offsetof(struct amap_sol_cqe_ring,
-                                     icd_index) / 32] & SOL_ICD_INDEX_MASK)
-                                     >> 6)];
-                       beiscsi_conn = phba->conn_table[psgl_handle->cid];
-                       if (!beiscsi_conn || !beiscsi_conn->ep) {
-                               shost_printk(KERN_WARNING, phba->shost,
-                                    "Connection table empty for cid = %d\n",
-                                     psgl_handle->cid);
-                               return 0;
-                       }
+               ep = phba->ep_array[(u32) ((sol->
+                                  dw[offsetof(struct amap_sol_cqe, cid) / 32] &
+                                  SOL_CID_MASK) >> 6) -
+                                  phba->fw_config.iscsi_cid_start];
 
-               } else {
-                       beiscsi_conn = phba->conn_table[(u32) (sol->
-                                dw[offsetof(struct amap_sol_cqe, cid) / 32] &
-                                SOL_CID_MASK) >> 6];
-
-                       if (!beiscsi_conn || !beiscsi_conn->ep) {
-                               shost_printk(KERN_WARNING, phba->shost,
-                                    "Connection table empty for cid = %d\n",
-                                    (u32)(sol->dw[offsetof(struct amap_sol_cqe,
-                                    cid) / 32] & SOL_CID_MASK) >> 6);
-                               return 0;
-                       }
-               }
+               beiscsi_ep = ep->dd_data;
+               beiscsi_conn = beiscsi_ep->conn;
 
                if (num_processed >= 32) {
                        hwi_ring_cq_db(phba, cq->id,
@@ -1511,21 +1522,13 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
                case CMD_CXN_KILLED_ITT_INVALID:
                case CMD_CXN_KILLED_SEQ_OUTOFORDER:
                case CMD_CXN_KILLED_INVALID_DATASN_RCVD:
-                       if (ring_mode) {
-                               SE_DEBUG(DBG_LVL_1,
-                                "CQ Error notification for cmd.. "
-                                "code %d cid 0x%x\n",
-                                sol->dw[offsetof(struct amap_sol_cqe, code) /
-                                32] & CQE_CODE_MASK, psgl_handle->cid);
-                       } else {
-                               SE_DEBUG(DBG_LVL_1,
+                       SE_DEBUG(DBG_LVL_1,
                                 "CQ Error notification for cmd.. "
                                 "code %d cid 0x%x\n",
                                 sol->dw[offsetof(struct amap_sol_cqe, code) /
                                 32] & CQE_CODE_MASK,
                                 (sol->dw[offsetof(struct amap_sol_cqe, cid) /
                                 32] & SOL_CID_MASK));
-                       }
                        break;
                case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
                        SE_DEBUG(DBG_LVL_1,
@@ -1547,37 +1550,23 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
                case CXN_KILLED_OVER_RUN_RESIDUAL:
                case CXN_KILLED_UNDER_RUN_RESIDUAL:
                case CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN:
-                       if (ring_mode) {
-                               SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
-                                "0x%x...\n",
-                                sol->dw[offsetof(struct amap_sol_cqe, code) /
-                                32] & CQE_CODE_MASK, psgl_handle->cid);
-                       } else {
-                               SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
+                       SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
                                 "0x%x...\n",
                                 sol->dw[offsetof(struct amap_sol_cqe, code) /
                                 32] & CQE_CODE_MASK,
-                                sol->dw[offsetof(struct amap_sol_cqe, cid) /
-                                32] & CQE_CID_MASK);
-                       }
+                                (sol->dw[offsetof(struct amap_sol_cqe, cid) /
+                                32] & CQE_CID_MASK));
                        iscsi_conn_failure(beiscsi_conn->conn,
                                           ISCSI_ERR_CONN_FAILED);
                        break;
                case CXN_KILLED_RST_SENT:
                case CXN_KILLED_RST_RCVD:
-                       if (ring_mode) {
-                               SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
-                               "received/sent on CID 0x%x...\n",
-                                sol->dw[offsetof(struct amap_sol_cqe, code) /
-                                32] & CQE_CODE_MASK, psgl_handle->cid);
-                       } else {
-                               SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
+                       SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
                                "received/sent on CID 0x%x...\n",
                                 sol->dw[offsetof(struct amap_sol_cqe, code) /
                                 32] & CQE_CODE_MASK,
-                                sol->dw[offsetof(struct amap_sol_cqe, cid) /
-                                32] & CQE_CID_MASK);
-                       }
+                                (sol->dw[offsetof(struct amap_sol_cqe, cid) /
+                                32] & CQE_CID_MASK));
                        iscsi_conn_failure(beiscsi_conn->conn,
                                           ISCSI_ERR_CONN_FAILED);
                        break;
@@ -1586,8 +1575,8 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
                                 "received on CID 0x%x...\n",
                                 sol->dw[offsetof(struct amap_sol_cqe, code) /
                                 32] & CQE_CODE_MASK,
-                                sol->dw[offsetof(struct amap_sol_cqe, cid) /
-                                32] & CQE_CID_MASK);
+                                (sol->dw[offsetof(struct amap_sol_cqe, cid) /
+                                32] & CQE_CID_MASK));
                        break;
                }
 
@@ -1604,7 +1593,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
        return tot_nump;
 }
 
-static void beiscsi_process_all_cqs(struct work_struct *work)
+void beiscsi_process_all_cqs(struct work_struct *work)
 {
        unsigned long flags;
        struct hwi_controller *phwi_ctrlr;
@@ -1624,6 +1613,7 @@ static void beiscsi_process_all_cqs(struct work_struct *work)
                spin_lock_irqsave(&phba->isr_lock, flags);
                phba->todo_mcc_cq = 0;
                spin_unlock_irqrestore(&phba->isr_lock, flags);
+               beiscsi_process_mcc_isr(phba);
        }
 
        if (phba->todo_cq) {
@@ -1668,7 +1658,8 @@ hwi_write_sgl(struct iscsi_wrb *pwrb, struct scatterlist *sg,
                                      io_task->bhs_pa.u.a32.address_hi);
 
        l_sg = sg;
-       for (index = 0; (index < num_sg) && (index < 2); index++, sg_next(sg)) {
+       for (index = 0; (index < num_sg) && (index < 2); index++,
+                                                        sg = sg_next(sg)) {
                if (index == 0) {
                        sg_len = sg_dma_len(sg);
                        addr = (u64) sg_dma_address(sg);
@@ -1679,11 +1670,7 @@ hwi_write_sgl(struct iscsi_wrb *pwrb, struct scatterlist *sg,
                        AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_len, pwrb,
                                                        sg_len);
                        sge_len = sg_len;
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_last, pwrb,
-                                                       1);
                } else {
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_last, pwrb,
-                                                       0);
                        AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_r2t_offset,
                                                        pwrb, sge_len);
                        sg_len = sg_dma_len(sg);
@@ -1706,13 +1693,27 @@ hwi_write_sgl(struct iscsi_wrb *pwrb, struct scatterlist *sg,
        AMAP_SET_BITS(struct amap_iscsi_sge, addr_lo, psgl,
                        io_task->bhs_pa.u.a32.address_lo);
 
-       if (num_sg == 2)
-               AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_last, pwrb, 1);
+       if (num_sg == 1) {
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_last, pwrb,
+                                                               1);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_last, pwrb,
+                                                               0);
+       } else if (num_sg == 2) {
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_last, pwrb,
+                                                               0);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_last, pwrb,
+                                                               1);
+       } else {
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_last, pwrb,
+                                                               0);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_last, pwrb,
+                                                               0);
+       }
        sg = l_sg;
        psgl++;
        psgl++;
        offset = 0;
-       for (index = 0; index < num_sg; index++, sg_next(sg), psgl++) {
+       for (index = 0; index < num_sg; index++, sg = sg_next(sg), psgl++) {
                sg_len = sg_dma_len(sg);
                addr = (u64) sg_dma_address(sg);
                AMAP_SET_BITS(struct amap_iscsi_sge, addr_lo, psgl,
@@ -2048,10 +2049,9 @@ static void beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
        }
        idx = 0;
        pwrb = mem_descr_wrb->mem_array[idx].virtual_address;
-       num_cxn_wrb =
-           ((mem_descr_wrb->mem_array[idx].size) / (sizeof(struct iscsi_wrb)) *
-            phba->params.wrbs_per_cxn);
-
+       num_cxn_wrb = (mem_descr_wrb->mem_array[idx].size) /
+                     ((sizeof(struct iscsi_wrb) *
+                       phba->params.wrbs_per_cxn));
        for (index = 0; index < phba->params.cxns_per_ctrl; index += 2) {
                pwrb_context = &phwi_ctrlr->wrb_context[index];
                if (num_cxn_wrb) {
@@ -2064,9 +2064,9 @@ static void beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
                } else {
                        idx++;
                        pwrb = mem_descr_wrb->mem_array[idx].virtual_address;
-                       num_cxn_wrb = ((mem_descr_wrb->mem_array[idx].size) /
-                                       (sizeof(struct iscsi_wrb)) *
-                                       phba->params.wrbs_per_cxn);
+                       num_cxn_wrb = (mem_descr_wrb->mem_array[idx].size) /
+                                     ((sizeof(struct iscsi_wrb) *
+                                       phba->params.wrbs_per_cxn));
                        for (j = 0; j < phba->params.wrbs_per_cxn; j++) {
                                pwrb_handle = pwrb_context->pwrb_handle_base[j];
                                pwrb_handle->pwrb = pwrb;
@@ -2383,7 +2383,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
                                                     &paddr);
                if (!cq_vaddress)
                        goto create_cq_error;
-               ret = be_fill_queue(cq, phba->params.icds_per_ctrl / 2,
+               ret = be_fill_queue(cq, phba->params.num_cq_entries,
                                    sizeof(struct sol_cqe), cq_vaddress);
                if (ret) {
                        shost_printk(KERN_ERR, phba->shost,
@@ -2634,7 +2634,8 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba,
                                     "wrbq create failed.");
                        return status;
                }
-               phwi_ctrlr->wrb_context[i].cid = phwi_context->be_wrbq[i].id;
+               phwi_ctrlr->wrb_context[i * 2].cid = phwi_context->be_wrbq[i].
+                                                                  id;
        }
        kfree(pwrb_arr);
        return 0;
@@ -2803,17 +2804,6 @@ static int hwi_init_port(struct beiscsi_hba *phba)
                goto error;
        }
 
-       if (phba->fw_config.iscsi_features == 0x1)
-               ring_mode = 1;
-       else
-               ring_mode = 0;
-       status = mgmt_get_fw_config(ctrl, phba);
-       if (status != 0) {
-               shost_printk(KERN_ERR, phba->shost,
-                            "Error getting fw config\n");
-               goto error;
-       }
-
        status = beiscsi_create_cqs(phba, phwi_context);
        if (status != 0) {
                shost_printk(KERN_ERR, phba->shost, "CQ not created\n");
@@ -2941,17 +2931,6 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
        phba->io_sgl_hndl_avbl = 0;
        phba->eh_sgl_hndl_avbl = 0;
 
-       if (ring_mode) {
-               phba->sgl_hndl_array = kzalloc(sizeof(struct sgl_handle *) *
-                                             phba->params.icds_per_ctrl,
-                                                GFP_KERNEL);
-               if (!phba->sgl_hndl_array) {
-                       shost_printk(KERN_ERR, phba->shost,
-                            "Mem Alloc Failed. Failing to load\n");
-                       return -ENOMEM;
-               }
-       }
-
        mem_descr_sglh = phba->init_mem;
        mem_descr_sglh += HWI_MEM_SGLH;
        if (1 == mem_descr_sglh->num_elements) {
@@ -2959,8 +2938,6 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
                                                 phba->params.ios_per_ctrl,
                                                 GFP_KERNEL);
                if (!phba->io_sgl_hndl_base) {
-                       if (ring_mode)
-                               kfree(phba->sgl_hndl_array);
                        shost_printk(KERN_ERR, phba->shost,
                                     "Mem Alloc Failed. Failing to load\n");
                        return -ENOMEM;
@@ -3032,7 +3009,7 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
                        AMAP_SET_BITS(struct amap_iscsi_sge, addr_lo, pfrag, 0);
                        pfrag += phba->params.num_sge_per_io;
                        psgl_handle->sgl_index =
-                               phba->fw_config.iscsi_cid_start + arr_index++;
+                               phba->fw_config.iscsi_icd_start + arr_index++;
                }
                idx++;
        }
@@ -3047,7 +3024,7 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
 {
        int i, new_cid;
 
-       phba->cid_array = kmalloc(sizeof(void *) * phba->params.cxns_per_ctrl,
+       phba->cid_array = kzalloc(sizeof(void *) * phba->params.cxns_per_ctrl,
                                  GFP_KERNEL);
        if (!phba->cid_array) {
                shost_printk(KERN_ERR, phba->shost,
@@ -3055,7 +3032,7 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
                             "hba_setup_cid_tbls\n");
                return -ENOMEM;
        }
-       phba->ep_array = kmalloc(sizeof(struct iscsi_endpoint *) *
+       phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) *
                                 phba->params.cxns_per_ctrl * 2, GFP_KERNEL);
        if (!phba->ep_array) {
                shost_printk(KERN_ERR, phba->shost,
@@ -3064,7 +3041,7 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
                kfree(phba->cid_array);
                return -ENOMEM;
        }
-       new_cid = phba->fw_config.iscsi_icd_start;
+       new_cid = phba->fw_config.iscsi_cid_start;
        for (i = 0; i < phba->params.cxns_per_ctrl; i++) {
                phba->cid_array[i] = new_cid;
                new_cid += 2;
@@ -3145,8 +3122,6 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
        if (hba_setup_cid_tbls(phba)) {
                shost_printk(KERN_ERR, phba->shost,
                             "Failed in hba_setup_cid_tbls\n");
-               if (ring_mode)
-                       kfree(phba->sgl_hndl_array);
                kfree(phba->io_sgl_hndl_base);
                kfree(phba->eh_sgl_hndl_base);
                goto do_cleanup_ctrlr;
@@ -3166,6 +3141,7 @@ static void hwi_purge_eq(struct beiscsi_hba *phba)
        struct be_queue_info *eq;
        struct be_eq_entry *eqe = NULL;
        int i, eq_msix;
+       unsigned int num_processed;
 
        phwi_ctrlr = phba->phwi_ctrlr;
        phwi_context = phwi_ctrlr->phwi_ctxt;
@@ -3177,13 +3153,17 @@ static void hwi_purge_eq(struct beiscsi_hba *phba)
        for (i = 0; i < (phba->num_cpus + eq_msix); i++) {
                eq = &phwi_context->be_eq[i].q;
                eqe = queue_tail_node(eq);
-
+               num_processed = 0;
                while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
                                        & EQE_VALID_MASK) {
                        AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
                        queue_tail_inc(eq);
                        eqe = queue_tail_node(eq);
+                       num_processed++;
                }
+
+               if (num_processed)
+                       hwi_ring_eq_db(phba, eq->id, 1, num_processed, 1, 1);
        }
 }
 
@@ -3195,10 +3175,9 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
        if (mgmt_status)
                shost_printk(KERN_WARNING, phba->shost,
                             "mgmt_epfw_cleanup FAILED \n");
-       hwi_cleanup(phba);
+
        hwi_purge_eq(phba);
-       if (ring_mode)
-               kfree(phba->sgl_hndl_array);
+       hwi_cleanup(phba);
        kfree(phba->io_sgl_hndl_base);
        kfree(phba->eh_sgl_hndl_base);
        kfree(phba->cid_array);
@@ -3219,7 +3198,8 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
         * We can always use 0 here because it is reserved by libiscsi for
         * login/startup related tasks.
         */
-       pwrb_handle = alloc_wrb_handle(phba, beiscsi_conn->beiscsi_conn_cid, 0);
+       pwrb_handle = alloc_wrb_handle(phba, (beiscsi_conn->beiscsi_conn_cid -
+                                      phba->fw_config.iscsi_cid_start));
        pwrb = (struct iscsi_target_context_update_wrb *)pwrb_handle->pwrb;
        memset(pwrb, 0, sizeof(*pwrb));
        AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb,
@@ -3283,8 +3263,7 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
        be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_target_context_update_wrb));
 
        doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK;
-       if (!ring_mode)
-               doorbell |= (pwrb_handle->wrb_index & DB_DEF_PDU_WRB_INDEX_MASK)
+       doorbell |= (pwrb_handle->wrb_index & DB_DEF_PDU_WRB_INDEX_MASK)
                             << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
 
@@ -3328,8 +3307,9 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
        io_task->bhs_pa.u.a64.address = paddr;
        io_task->libiscsi_itt = (itt_t)task->itt;
        io_task->pwrb_handle = alloc_wrb_handle(phba,
-                                               beiscsi_conn->beiscsi_conn_cid,
-                                               task->itt);
+                                               beiscsi_conn->beiscsi_conn_cid -
+                                               phba->fw_config.iscsi_cid_start
+                                               );
        io_task->conn = beiscsi_conn;
 
        task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr;
@@ -3343,7 +3323,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
                        goto free_hndls;
        } else {
                io_task->scsi_cmnd = NULL;
-               if ((task->hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
+               if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
                        if (!beiscsi_conn->login_in_progress) {
                                spin_lock(&phba->mgmt_sgl_lock);
                                io_task->psgl_handle = (struct sgl_handle *)
@@ -3370,21 +3350,16 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
        itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle->
                                 wrb_index << 16) | (unsigned int)
                                (io_task->psgl_handle->sgl_index));
-       if (ring_mode) {
-               phba->sgl_hndl_array[io_task->psgl_handle->sgl_index -
-                                    phba->fw_config.iscsi_cid_start] =
-                                    io_task->psgl_handle;
-               io_task->psgl_handle->task = task;
-               io_task->psgl_handle->cid = beiscsi_conn->beiscsi_conn_cid;
-       } else
-               io_task->pwrb_handle->pio_handle = task;
+       io_task->pwrb_handle->pio_handle = task;
 
        io_task->cmd_bhs->iscsi_hdr.itt = itt;
        return 0;
 
 free_hndls:
        phwi_ctrlr = phba->phwi_ctrlr;
-       pwrb_context = &phwi_ctrlr->wrb_context[beiscsi_conn->beiscsi_conn_cid];
+       pwrb_context = &phwi_ctrlr->wrb_context[
+                       beiscsi_conn->beiscsi_conn_cid -
+                       phba->fw_config.iscsi_cid_start];
        free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle);
        io_task->pwrb_handle = NULL;
        pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
@@ -3404,7 +3379,8 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
        struct hwi_controller *phwi_ctrlr;
 
        phwi_ctrlr = phba->phwi_ctrlr;
-       pwrb_context = &phwi_ctrlr->wrb_context[beiscsi_conn->beiscsi_conn_cid];
+       pwrb_context = &phwi_ctrlr->wrb_context[beiscsi_conn->beiscsi_conn_cid
+                       - phba->fw_config.iscsi_cid_start];
        if (io_task->pwrb_handle) {
                free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle);
                io_task->pwrb_handle = NULL;
@@ -3460,18 +3436,12 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
                              ISCSI_OPCODE_SCSI_DATA_OUT);
                AMAP_SET_BITS(struct amap_pdu_data_out, final_bit,
                              &io_task->cmd_bhs->iscsi_data_pdu, 1);
-               if (ring_mode)
-                       io_task->psgl_handle->type = INI_WR_CMD;
-               else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     INI_WR_CMD);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             INI_WR_CMD);
                AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);
        } else {
-               if (ring_mode)
-                       io_task->psgl_handle->type = INI_RD_CMD;
-               else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     INI_RD_CMD);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             INI_RD_CMD);
                AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 0);
        }
        memcpy(&io_task->cmd_bhs->iscsi_data_pdu.
@@ -3496,8 +3466,7 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
        be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
 
        doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK;
-       if (!ring_mode)
-               doorbell |= (io_task->pwrb_handle->wrb_index &
+       doorbell |= (io_task->pwrb_handle->wrb_index &
                     DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
 
@@ -3519,49 +3488,46 @@ static int beiscsi_mtask(struct iscsi_task *task)
        unsigned int doorbell = 0;
        unsigned int i, cid;
        struct iscsi_task *aborted_task;
+       unsigned int tag;
 
        cid = beiscsi_conn->beiscsi_conn_cid;
        pwrb = io_task->pwrb_handle->pwrb;
+       memset(pwrb, 0, sizeof(*pwrb));
        AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb,
                      be32_to_cpu(task->cmdsn));
        AMAP_SET_BITS(struct amap_iscsi_wrb, wrb_idx, pwrb,
                      io_task->pwrb_handle->wrb_index);
        AMAP_SET_BITS(struct amap_iscsi_wrb, sgl_icd_idx, pwrb,
                      io_task->psgl_handle->sgl_index);
-
        switch (task->hdr->opcode & ISCSI_OPCODE_MASK) {
        case ISCSI_OP_LOGIN:
-               if (ring_mode)
-                       io_task->psgl_handle->type = TGT_DM_CMD;
-               else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     TGT_DM_CMD);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             TGT_DM_CMD);
                AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
                AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb, 1);
                hwi_write_buffer(pwrb, task);
                break;
        case ISCSI_OP_NOOP_OUT:
-               if (ring_mode)
-                       io_task->psgl_handle->type = INI_RD_CMD;
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             INI_RD_CMD);
+               if (task->hdr->ttt == ISCSI_RESERVED_TAG)
+                       AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
                else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     INI_RD_CMD);
+                       AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 1);
                hwi_write_buffer(pwrb, task);
                break;
        case ISCSI_OP_TEXT:
-               if (ring_mode)
-                       io_task->psgl_handle->type = INI_WR_CMD;
-               else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     INI_WR_CMD);
-               AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             TGT_DM_CMD);
+               AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
                hwi_write_buffer(pwrb, task);
                break;
        case ISCSI_OP_SCSI_TMFUNC:
                session = conn->session;
                i = ((struct iscsi_tm *)task->hdr)->rtt;
                phwi_ctrlr = phba->phwi_ctrlr;
-               pwrb_context = &phwi_ctrlr->wrb_context[cid];
+               pwrb_context = &phwi_ctrlr->wrb_context[cid -
+                                           phba->fw_config.iscsi_cid_start];
                pwrb_handle = pwrb_context->pwrb_handle_basestd[be32_to_cpu(i)
                                                                >> 16];
                aborted_task = pwrb_handle->pio_handle;
@@ -3572,22 +3538,25 @@ static int beiscsi_mtask(struct iscsi_task *task)
                if (!aborted_io_task->scsi_cmnd)
                        return 0;
 
-               mgmt_invalidate_icds(phba,
+               tag = mgmt_invalidate_icds(phba,
                                     aborted_io_task->psgl_handle->sgl_index,
                                     cid);
-               if (ring_mode)
-                       io_task->psgl_handle->type = INI_TMF_CMD;
-               else
-                       AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
-                                     INI_TMF_CMD);
+               if (!tag) {
+                       shost_printk(KERN_WARNING, phba->shost,
+                                    "mgmt_invalidate_icds could not be"
+                                    " submitted\n");
+               } else {
+                       wait_event_interruptible(phba->ctrl.mcc_wait[tag],
+                                                phba->ctrl.mcc_numtag[tag]);
+                       free_mcc_tag(&phba->ctrl, tag);
+               }
+               AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
+                             INI_TMF_CMD);
                AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
                hwi_write_buffer(pwrb, task);
                break;
        case ISCSI_OP_LOGOUT:
                AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
-               if (ring_mode)
-                       io_task->psgl_handle->type = HWH_TYPE_LOGOUT;
-               else
                AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
                                HWH_TYPE_LOGOUT);
                hwi_write_buffer(pwrb, task);
@@ -3600,14 +3569,13 @@ static int beiscsi_mtask(struct iscsi_task *task)
        }
 
        AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb,
-                     be32_to_cpu(task->data_count));
+                     task->data_count);
        AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb,
                      io_task->pwrb_handle->nxt_wrb_index);
        be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
 
        doorbell |= cid & DB_WRB_POST_CID_MASK;
-       if (!ring_mode)
-               doorbell |= (io_task->pwrb_handle->wrb_index &
+       doorbell |= (io_task->pwrb_handle->wrb_index &
                     DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
        iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
@@ -3649,7 +3617,6 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
        return beiscsi_iotask(task, sg, num_sg, xferlen, writedir);
 }
 
-
 static void beiscsi_remove(struct pci_dev *pcidev)
 {
        struct beiscsi_hba *phba = NULL;
@@ -3734,7 +3701,20 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
        }
        SE_DEBUG(DBG_LVL_8, " phba = %p \n", phba);
 
-       pci_set_drvdata(pcidev, phba);
+       switch (pcidev->device) {
+       case BE_DEVICE_ID1:
+       case OC_DEVICE_ID1:
+       case OC_DEVICE_ID2:
+               phba->generation = BE_GEN2;
+               break;
+       case BE_DEVICE_ID2:
+       case OC_DEVICE_ID3:
+               phba->generation = BE_GEN3;
+               break;
+       default:
+               phba->generation = 0;
+       }
+
        if (enable_msix)
                num_cpus = find_num_cpus();
        else
@@ -3754,7 +3734,15 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
        spin_lock_init(&phba->io_sgl_lock);
        spin_lock_init(&phba->mgmt_sgl_lock);
        spin_lock_init(&phba->isr_lock);
+       ret = mgmt_get_fw_config(&phba->ctrl, phba);
+       if (ret != 0) {
+               shost_printk(KERN_ERR, phba->shost,
+                            "Error getting fw config\n");
+               goto free_port;
+       }
+       phba->shost->max_id = phba->fw_config.iscsi_cid_count;
        beiscsi_get_params(phba);
+       phba->shost->can_queue = phba->params.ios_per_ctrl;
        ret = beiscsi_init_port(phba);
        if (ret < 0) {
                shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-"
@@ -3762,6 +3750,15 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
                goto free_port;
        }
 
+       for (i = 0; i < MAX_MCC_CMD ; i++) {
+               init_waitqueue_head(&phba->ctrl.mcc_wait[i + 1]);
+               phba->ctrl.mcc_tag[i] = i + 1;
+               phba->ctrl.mcc_numtag[i + 1] = 0;
+               phba->ctrl.mcc_tag_available++;
+       }
+
+       phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0;
+
        snprintf(phba->wq_name, sizeof(phba->wq_name), "beiscsi_q_irq%u",
                 phba->shost->host_no);
        phba->wq = create_workqueue(phba->wq_name);
@@ -3836,7 +3833,7 @@ disable_pci:
 struct iscsi_transport beiscsi_iscsi_transport = {
        .owner = THIS_MODULE,
        .name = DRV_NAME,
-       .caps = CAP_RECOVERY_L0 | CAP_HDRDGST |
+       .caps = CAP_RECOVERY_L0 | CAP_HDRDGST | CAP_TEXT_NEGO |
                CAP_MULTI_R2T | CAP_DATADGST | CAP_DATA_PATH_OFFLOAD,
        .param_mask = ISCSI_MAX_RECV_DLENGTH |
                ISCSI_MAX_XMIT_DLENGTH |
@@ -3859,7 +3856,7 @@ struct iscsi_transport beiscsi_iscsi_transport = {
                ISCSI_USERNAME | ISCSI_PASSWORD |
                ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
                ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
-               ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
+               ISCSI_LU_RESET_TMO |
                ISCSI_PING_TMO | ISCSI_RECV_TMO |
                ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME,
        .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
@@ -3905,7 +3902,7 @@ static int __init beiscsi_module_init(void)
                SE_DEBUG(DBG_LVL_1,
                         "beiscsi_module_init - Unable to  register beiscsi"
                         "transport.\n");
-               ret = -ENOMEM;
+               return -ENOMEM;
        }
        SE_DEBUG(DBG_LVL_8, "In beiscsi_module_init, tt=%p \n",
                 &beiscsi_iscsi_transport);
@@ -3917,7 +3914,6 @@ static int __init beiscsi_module_init(void)
                         "beiscsi pci driver.\n");
                goto unregister_iscsi_transport;
        }
-       ring_mode = 0;
        return 0;
 
 unregister_iscsi_transport:
index 25e6b208b7718bee40a6ccf4e58cc168e01b6f78..c53a80ab796c1f84a789c7bb9c1e059568378647 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
 #define DRV_DESC               BE_NAME " " "Driver"
 
 #define BE_VENDOR_ID           0x19A2
+/* DEVICE ID's for BE2 */
 #define BE_DEVICE_ID1          0x212
 #define OC_DEVICE_ID1          0x702
 #define OC_DEVICE_ID2          0x703
+
+/* DEVICE ID's for BE3 */
+#define BE_DEVICE_ID2          0x222
 #define OC_DEVICE_ID3          0x712
-#define OC_DEVICE_ID4          0x222
 
-#define BE2_MAX_SESSIONS       64
+#define BE2_IO_DEPTH           1024
+#define BE2_MAX_SESSIONS       256
 #define BE2_CMDS_PER_CXN       128
-#define BE2_LOGOUTS            BE2_MAX_SESSIONS
 #define BE2_TMFS               16
 #define BE2_NOPOUT_REQ         16
-#define BE2_ASYNCPDUS          BE2_MAX_SESSIONS
-#define BE2_MAX_ICDS           2048
 #define BE2_SGE                        32
 #define BE2_DEFPDU_HDR_SZ      64
 #define BE2_DEFPDU_DATA_SZ     8192
-#define BE2_IO_DEPTH \
-       (BE2_MAX_ICDS / 2 - (BE2_LOGOUTS + BE2_TMFS + BE2_NOPOUT_REQ))
 
 #define MAX_CPUS               31
-#define BEISCSI_SGLIST_ELEMENTS        BE2_SGE
+#define BEISCSI_SGLIST_ELEMENTS        30
 
-#define BEISCSI_MAX_CMNDS      1024    /* Max IO's per Ctrlr sht->can_queue */
 #define BEISCSI_CMD_PER_LUN    128     /* scsi_host->cmd_per_lun */
-#define BEISCSI_MAX_SECTORS    2048    /* scsi_host->max_sectors */
+#define BEISCSI_MAX_SECTORS    256     /* scsi_host->max_sectors */
 
 #define BEISCSI_MAX_CMD_LEN    16      /* scsi_host->max_cmd_len */
 #define BEISCSI_NUM_MAX_LUN    256     /* scsi_host->max_lun */
@@ -330,6 +328,7 @@ struct beiscsi_hba {
        struct workqueue_struct *wq;    /* The actuak work queue */
        struct work_struct work_cqs;    /* The work being queued */
        struct be_ctrl_info ctrl;
+       unsigned int generation;
 };
 
 struct beiscsi_session {
@@ -656,11 +655,12 @@ struct amap_iscsi_wrb {
 
 } __packed;
 
-struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid,
-                                   int index);
+struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid);
 void
 free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle);
 
+void beiscsi_process_all_cqs(struct work_struct *work);
+
 struct pdu_nop_out {
        u32 dw[12];
 };
@@ -802,7 +802,6 @@ struct hwi_controller {
        struct be_ring default_pdu_hdr;
        struct be_ring default_pdu_data;
        struct hwi_context_memory *phwi_ctxt;
-       unsigned short cq_errors[CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN];
 };
 
 enum hwh_type_enum {
index 79c2bd525a84ee5842522b1f5e689abd97fd5112..317bcd042ced234d0df2ec0db9b0d3cb063a550d 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -48,6 +48,14 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl,
                                        pfw_cfg->ulp[0].sq_base;
                phba->fw_config.iscsi_cid_count =
                                        pfw_cfg->ulp[0].sq_count;
+               if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) {
+                       SE_DEBUG(DBG_LVL_8,
+                               "FW reported MAX CXNS as %d \t"
+                               "Max Supported = %d.\n",
+                               phba->fw_config.iscsi_cid_count,
+                               BE2_MAX_SESSIONS);
+                       phba->fw_config.iscsi_cid_count = BE2_MAX_SESSIONS / 2;
+               }
        } else {
                shost_printk(KERN_WARNING, phba->shost,
                             "Failed in mgmt_get_fw_config \n");
@@ -77,6 +85,7 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
        }
        nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes);
        req = nonemb_cmd.va;
+       memset(req, 0, sizeof(*req));
        spin_lock(&ctrl->mbox_lock);
        memset(wrb, 0, sizeof(*wrb));
        be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
@@ -140,10 +149,17 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
 {
        struct be_dma_mem nonemb_cmd;
        struct be_ctrl_info *ctrl = &phba->ctrl;
-       struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-       struct be_sge *sge = nonembedded_sgl(wrb);
+       struct be_mcc_wrb *wrb;
+       struct be_sge *sge;
        struct invalidate_commands_params_in *req;
-       int status = 0;
+       unsigned int tag = 0;
+
+       spin_lock(&ctrl->mbox_lock);
+       tag = alloc_mcc_tag(phba);
+       if (!tag) {
+               spin_unlock(&ctrl->mbox_lock);
+               return tag;
+       }
 
        nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev,
                                sizeof(struct invalidate_commands_params_in),
@@ -156,8 +172,10 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
        }
        nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
        req = nonemb_cmd.va;
-       spin_lock(&ctrl->mbox_lock);
-       memset(wrb, 0, sizeof(*wrb));
+       memset(req, 0, sizeof(*req));
+       wrb = wrb_from_mccq(phba);
+       sge = nonembedded_sgl(wrb);
+       wrb->tag0 |= tag;
 
        be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
        be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
@@ -172,14 +190,12 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
        sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF);
        sge->len = cpu_to_le32(nonemb_cmd.size);
 
-       status = be_mcc_notify_wait(phba);
-       if (status)
-               SE_DEBUG(DBG_LVL_1, "ICDS Invalidation Failed\n");
+       be_mcc_notify(phba);
        spin_unlock(&ctrl->mbox_lock);
        if (nonemb_cmd.va)
                pci_free_consistent(ctrl->pdev, nonemb_cmd.size,
                                    nonemb_cmd.va, nonemb_cmd.dma);
-       return status;
+       return tag;
 }
 
 unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
@@ -189,13 +205,19 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
                                         unsigned short savecfg_flag)
 {
        struct be_ctrl_info *ctrl = &phba->ctrl;
-       struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-       struct iscsi_invalidate_connection_params_in *req =
-                                               embedded_payload(wrb);
-       int status = 0;
+       struct be_mcc_wrb *wrb;
+       struct iscsi_invalidate_connection_params_in *req;
+       unsigned int tag = 0;
 
        spin_lock(&ctrl->mbox_lock);
-       memset(wrb, 0, sizeof(*wrb));
+       tag = alloc_mcc_tag(phba);
+       if (!tag) {
+               spin_unlock(&ctrl->mbox_lock);
+               return tag;
+       }
+       wrb = wrb_from_mccq(phba);
+       wrb->tag0 |= tag;
+       req = embedded_payload(wrb);
 
        be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
        be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
@@ -208,35 +230,37 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
        else
                req->cleanup_type = CMD_ISCSI_CONNECTION_INVALIDATE;
        req->save_cfg = savecfg_flag;
-       status =  be_mcc_notify_wait(phba);
-       if (status)
-               SE_DEBUG(DBG_LVL_1, "Invalidation Failed\n");
-
+       be_mcc_notify(phba);
        spin_unlock(&ctrl->mbox_lock);
-       return status;
+       return tag;
 }
 
 unsigned char mgmt_upload_connection(struct beiscsi_hba *phba,
                                unsigned short cid, unsigned int upload_flag)
 {
        struct be_ctrl_info *ctrl = &phba->ctrl;
-       struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-       struct tcp_upload_params_in *req = embedded_payload(wrb);
-       int status = 0;
+       struct be_mcc_wrb *wrb;
+       struct tcp_upload_params_in *req;
+       unsigned int tag = 0;
 
        spin_lock(&ctrl->mbox_lock);
-       memset(wrb, 0, sizeof(*wrb));
+       tag = alloc_mcc_tag(phba);
+       if (!tag) {
+               spin_unlock(&ctrl->mbox_lock);
+               return tag;
+       }
+       wrb = wrb_from_mccq(phba);
+       req = embedded_payload(wrb);
+       wrb->tag0 |= tag;
 
        be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
        be_cmd_hdr_prepare(&req->hdr, CMD_COMMON_TCP_UPLOAD,
                           OPCODE_COMMON_TCP_UPLOAD, sizeof(*req));
        req->id = (unsigned short)cid;
        req->upload_type = (unsigned char)upload_flag;
-       status = be_mcc_notify_wait(phba);
-       if (status)
-               SE_DEBUG(DBG_LVL_1, "mgmt_upload_connection Failed\n");
+       be_mcc_notify(phba);
        spin_unlock(&ctrl->mbox_lock);
-       return status;
+       return tag;
 }
 
 int mgmt_open_connection(struct beiscsi_hba *phba,
@@ -248,13 +272,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
        struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
        struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
        struct be_ctrl_info *ctrl = &phba->ctrl;
-       struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-       struct tcp_connect_and_offload_in *req = embedded_payload(wrb);
+       struct be_mcc_wrb *wrb;
+       struct tcp_connect_and_offload_in *req;
        unsigned short def_hdr_id;
        unsigned short def_data_id;
        struct phys_addr template_address = { 0, 0 };
        struct phys_addr *ptemplate_address;
-       int status = 0;
+       unsigned int tag = 0;
        unsigned int i;
        unsigned short cid = beiscsi_ep->ep_cid;
 
@@ -266,7 +290,14 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
        ptemplate_address = &template_address;
        ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
        spin_lock(&ctrl->mbox_lock);
-       memset(wrb, 0, sizeof(*wrb));
+       tag = alloc_mcc_tag(phba);
+       if (!tag) {
+               spin_unlock(&ctrl->mbox_lock);
+               return tag;
+       }
+       wrb = wrb_from_mccq(phba);
+       req = embedded_payload(wrb);
+       wrb->tag0 |= tag;
 
        be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
        be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
@@ -311,46 +342,36 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
        req->do_offload = 1;
        req->dataout_template_pa.lo = ptemplate_address->lo;
        req->dataout_template_pa.hi = ptemplate_address->hi;
-       status = be_mcc_notify_wait(phba);
-       if (!status) {
-               struct iscsi_endpoint *ep;
-               struct tcp_connect_and_offload_out *ptcpcnct_out =
-                                                       embedded_payload(wrb);
-
-               ep = phba->ep_array[ptcpcnct_out->cid];
-               beiscsi_ep = ep->dd_data;
-               beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
-               beiscsi_ep->cid_vld = 1;
-               SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n");
-       } else
-               SE_DEBUG(DBG_LVL_1, "mgmt_open_connection Failed\n");
+       be_mcc_notify(phba);
        spin_unlock(&ctrl->mbox_lock);
-       return status;
+       return tag;
 }
 
-int be_cmd_get_mac_addr(struct beiscsi_hba *phba, u8 *mac_addr)
+unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba)
 {
        struct be_ctrl_info *ctrl = &phba->ctrl;
-       struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-       struct be_cmd_req_get_mac_addr *req = embedded_payload(wrb);
-       int status;
+       struct be_mcc_wrb *wrb;
+       struct be_cmd_req_get_mac_addr *req;
+       unsigned int tag = 0;
 
        SE_DEBUG(DBG_LVL_8, "In be_cmd_get_mac_addr\n");
        spin_lock(&ctrl->mbox_lock);
-       memset(wrb, 0, sizeof(*wrb));
+       tag = alloc_mcc_tag(phba);
+       if (!tag) {
+               spin_unlock(&ctrl->mbox_lock);
+               return tag;
+       }
+
+       wrb = wrb_from_mccq(phba);
+       req = embedded_payload(wrb);
+       wrb->tag0 |= tag;
        be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
        be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
                           OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG,
                           sizeof(*req));
 
-       status = be_mcc_notify_wait(phba);
-       if (!status) {
-               struct be_cmd_resp_get_mac_addr *resp = embedded_payload(wrb);
-
-               memcpy(mac_addr, resp->mac_address, ETH_ALEN);
-       }
-
+       be_mcc_notify(phba);
        spin_unlock(&ctrl->mbox_lock);
-       return status;
+       return tag;
 }
 
index 24eaff923f85622e8e4d8701def9a508e14e7611..ecead6a5aa56f4e1597b69adc2003396a4e0eb0e 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2009 ServerEngines
+ * Copyright (C) 2005 - 2010 ServerEngines
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -231,6 +231,7 @@ struct beiscsi_endpoint {
        struct beiscsi_hba *phba;
        struct beiscsi_sess *sess;
        struct beiscsi_conn *conn;
+       struct iscsi_endpoint *openiscsi_ep;
        unsigned short ip_type;
        char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
        unsigned long dst_addr;
@@ -249,7 +250,4 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
                                         unsigned short issue_reset,
                                         unsigned short savecfg_flag);
 
-unsigned char mgmt_fw_cmd(struct be_ctrl_info *ctrl,
-                         struct beiscsi_hba *phba,
-                         char *buf, unsigned int len);
 #endif
index 33b2294625bbf336f308af94a37045b87012ec5e..1c4d1215769dc72704edc6d6dc8f85fd677086c8 100644 (file)
@@ -1426,8 +1426,8 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,
                break;
        case ISCSI_PARAM_CONN_ADDRESS:
                if (bnx2i_conn->ep)
-                       len = sprintf(buf, NIPQUAD_FMT "\n",
-                                     NIPQUAD(bnx2i_conn->ep->cm_sk->dst_ip));
+                       len = sprintf(buf, "%pI4\n",
+                                     &bnx2i_conn->ep->cm_sk->dst_ip);
                break;
        default:
                return iscsi_conn_get_param(cls_conn, param, buf);
@@ -1990,6 +1990,7 @@ static struct scsi_host_template bnx2i_host_template = {
        .eh_abort_handler       = iscsi_eh_abort,
        .eh_device_reset_handler = iscsi_eh_device_reset,
        .eh_target_reset_handler = iscsi_eh_target_reset,
+       .change_queue_depth     = iscsi_change_queue_depth,
        .can_queue              = 1024,
        .max_sectors            = 127,
        .cmd_per_lun            = 32,
index 9129bcf117cf9582da79971c3cfecdd8d6a0a831..cd05e049d5f6ad7164c6485ee336db00933c63b0 100644 (file)
@@ -219,18 +219,15 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len)
                        break;
                }
                sa = (cdbp[8] << 8) + cdbp[9];
-               name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa);
-               if (name) {
+               name = get_sa_name(variable_length_arr, VARIABLE_LENGTH_SZ, sa);
+               if (name)
                        printk("%s", name);
-                       if ((cdb_len > 0) && (len != cdb_len))
-                               printk(", in_cdb_len=%d, ext_len=%d",
-                                      len, cdb_len);
-               } else {
+               else
                        printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
-                       if ((cdb_len > 0) && (len != cdb_len))
-                               printk(", in_cdb_len=%d, ext_len=%d",
-                                      len, cdb_len);
-               }
+
+               if ((cdb_len > 0) && (len != cdb_len))
+                       printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len);
+
                break;
        case MAINTENANCE_IN:
                sa = cdbp[1] & 0x1f;
@@ -349,6 +346,9 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 {
        int k;
 
+       if (cmd->cmnd == NULL)
+               return;
+
        scmd_printk(KERN_INFO, cmd, "CDB: ");
        print_opcode_name(cmd->cmnd, cmd->cmd_len);
 
index 969c83162cc4bc10caf5cb90d9f65a2a20d74502..412853c653721bc9afbb7e95241be07dcb76a7cf 100644 (file)
@@ -591,8 +591,7 @@ static int cxgb3i_conn_bind(struct iscsi_cls_session *cls_session,
        cxgb3i_conn_max_recv_dlength(conn);
 
        spin_lock_bh(&conn->session->lock);
-       sprintf(conn->portal_address, NIPQUAD_FMT,
-               NIPQUAD(c3cn->daddr.sin_addr.s_addr));
+       sprintf(conn->portal_address, "%pI4", &c3cn->daddr.sin_addr.s_addr);
        conn->portal_port = ntohs(c3cn->daddr.sin_port);
        spin_unlock_bh(&conn->session->lock);
 
@@ -709,6 +708,12 @@ static int cxgb3i_host_set_param(struct Scsi_Host *shost,
 {
        struct cxgb3i_hba *hba = iscsi_host_priv(shost);
 
+       if (!hba->ndev) {
+               shost_printk(KERN_ERR, shost, "Could not set host param. "
+                            "Netdev for host not set.\n");
+               return -ENODEV;
+       }
+
        cxgb3i_api_debug("param %d, buf %s.\n", param, buf);
 
        switch (param) {
@@ -739,6 +744,12 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
        struct cxgb3i_hba *hba = iscsi_host_priv(shost);
        int len = 0;
 
+       if (!hba->ndev) {
+               shost_printk(KERN_ERR, shost, "Could not set host param. "
+                            "Netdev for host not set.\n");
+               return -ENODEV;
+       }
+
        cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param);
 
        switch (param) {
@@ -753,7 +764,7 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
                __be32 addr;
 
                addr = cxgb3i_get_private_ipv4addr(hba->ndev);
-               len = sprintf(buf, NIPQUAD_FMT, NIPQUAD(addr));
+               len = sprintf(buf, "%pI4", &addr);
                break;
        }
        default:
index 15a00e8b71225d535b64dc3e02c4c703cb48062d..3e08c430ff2997c25d2727d013f02f71aff0cb1c 100644 (file)
@@ -1675,10 +1675,11 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn,
        } else
                c3cn->saddr.sin_addr.s_addr = sipv4;
 
-       c3cn_conn_debug("c3cn 0x%p, %u.%u.%u.%u,%u-%u.%u.%u.%u,%u SYN_SENT.\n",
-                       c3cn, NIPQUAD(c3cn->saddr.sin_addr.s_addr),
+       c3cn_conn_debug("c3cn 0x%p, %pI4,%u-%pI4,%u SYN_SENT.\n",
+                       c3cn,
+                       &c3cn->saddr.sin_addr.s_addr,
                        ntohs(c3cn->saddr.sin_port),
-                       NIPQUAD(c3cn->daddr.sin_addr.s_addr),
+                       &c3cn->daddr.sin_addr.s_addr,
                        ntohs(c3cn->daddr.sin_port));
 
        c3cn_set_state(c3cn, C3CN_STATE_CONNECTING);
index 1fe3b0f1f3c94353fbda92df4769bfb82c28a0bc..9c38539557fc9fc356f383a91b8ebe121cd37bb7 100644 (file)
@@ -461,10 +461,8 @@ void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn)
                skb = skb_peek(&c3cn->receive_queue);
        }
        read_unlock(&c3cn->callback_lock);
-       if (c3cn) {
-               c3cn->copied_seq += read;
-               cxgb3i_c3cn_rx_credits(c3cn, read);
-       }
+       c3cn->copied_seq += read;
+       cxgb3i_c3cn_rx_credits(c3cn, read);
        conn->rxdata_octets += read;
 
        if (err) {
index 4f0d0138f48b8af3533b28390ef818567fb24d54..bc9e94f5915e1227a14262b907f14858711c134b 100644 (file)
@@ -717,6 +717,8 @@ static const struct scsi_dh_devlist alua_dev_list[] = {
        {"IBM", "2145" },
        {"Pillar", "Axiom" },
        {"Intel", "Multi-Flex"},
+       {"NETAPP", "LUN"},
+       {"AIX", "NVDISK"},
        {NULL, NULL}
 };
 
index c7076ce25e2121dcad840347314cea0ac2997890..3c5abf7cd762d0fa3229e37fc14914e86d64de89 100644 (file)
@@ -1509,7 +1509,7 @@ static int option_setup(char *str)
        char *cur = str;
        int i = 1;
 
-       while (cur && isdigit(*cur) && i <= MAX_INT_PARAM) {
+       while (cur && isdigit(*cur) && i < MAX_INT_PARAM) {
                ints[i++] = simple_strtoul(cur, NULL, 0);
 
                if ((cur = strchr(cur, ',')) != NULL)
index a680e18b5f3b9eac57b879b5c988aff38c13d6ef..e2bc779f86c1d4c7be559eb018904ac3d58ff0a6 100644 (file)
@@ -1449,9 +1449,6 @@ static void esp_msgin_sdtr(struct esp *esp, struct esp_target_data *tp)
        if (offset > 15)
                goto do_reject;
 
-       if (esp->flags & ESP_FLAG_DISABLE_SYNC)
-               offset = 0;
-
        if (offset) {
                int one_clock;
 
@@ -2405,12 +2402,6 @@ static int esp_slave_configure(struct scsi_device *dev)
        struct esp_target_data *tp = &esp->target[dev->id];
        int goal_tags, queue_depth;
 
-       if (esp->flags & ESP_FLAG_DISABLE_SYNC) {
-               /* Bypass async domain validation */
-               dev->ppr  = 0;
-               dev->sdtr = 0;
-       }
-
        goal_tags = 0;
 
        if (dev->tagged_supported) {
@@ -2660,7 +2651,10 @@ static void esp_set_offset(struct scsi_target *target, int offset)
        struct esp *esp = shost_priv(host);
        struct esp_target_data *tp = &esp->target[target->id];
 
-       tp->nego_goal_offset = offset;
+       if (esp->flags & ESP_FLAG_DISABLE_SYNC)
+               tp->nego_goal_offset = 0;
+       else
+               tp->nego_goal_offset = offset;
        tp->flags |= ESP_TGT_CHECK_NEGO;
 }
 
index 10be9f36a4cc01b3ce9ce14a0d78f88dd1a6a30a..2f47ae7cce91a21069d4335b603bc26aa6320613 100644 (file)
@@ -2009,6 +2009,8 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
        fcoe_interface_cleanup(fcoe);
        rtnl_unlock();
        fcoe_if_destroy(fcoe->ctlr.lp);
+       module_put(THIS_MODULE);
+
 out_putdev:
        dev_put(netdev);
 out_nodev:
@@ -2059,6 +2061,11 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
        }
 #endif
 
+       if (!try_module_get(THIS_MODULE)) {
+               rc = -EINVAL;
+               goto out_nomod;
+       }
+
        rtnl_lock();
        netdev = fcoe_if_to_netdev(buffer);
        if (!netdev) {
@@ -2099,17 +2106,24 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
        if (!fcoe_link_ok(lport))
                fcoe_ctlr_link_up(&fcoe->ctlr);
 
-       rc = 0;
-out_free:
        /*
         * Release from init in fcoe_interface_create(), on success lport
         * should be holding a reference taken in fcoe_if_create().
         */
        fcoe_interface_put(fcoe);
+       dev_put(netdev);
+       rtnl_unlock();
+       mutex_unlock(&fcoe_config_mutex);
+
+       return 0;
+out_free:
+       fcoe_interface_put(fcoe);
 out_putdev:
        dev_put(netdev);
 out_nodev:
        rtnl_unlock();
+       module_put(THIS_MODULE);
+out_nomod:
        mutex_unlock(&fcoe_config_mutex);
        return rc;
 }
index 9823291395ad677578c79d26fb3cdb67da46391b..511cb6b371eec6429b92cd7a9bfd7c626a1d0357 100644 (file)
@@ -1187,7 +1187,7 @@ static void fcoe_ctlr_timeout(unsigned long arg)
                        next_timer = fip->ctlr_ka_time;
 
                if (time_after_eq(jiffies, fip->port_ka_time)) {
-                       fip->port_ka_time += jiffies +
+                       fip->port_ka_time = jiffies +
                                msecs_to_jiffies(FIP_VN_KA_PERIOD);
                        fip->send_port_ka = 1;
                }
index bb208a6091e71a9c936c206e88768ada5e180231..3966c71d009566b7e48f1a04813c00fc421b38e1 100644 (file)
@@ -36,7 +36,7 @@
 
 #define DRV_NAME               "fnic"
 #define DRV_DESCRIPTION                "Cisco FCoE HBA Driver"
-#define DRV_VERSION            "1.0.0.1121"
+#define DRV_VERSION            "1.4.0.98"
 #define PFX                    DRV_NAME ": "
 #define DFX                     DRV_NAME "%d: "
 
index fe1b1031f7abf2ac4d2b99877096ed30f0f49b00..507e26c1c29f05c29727509ba3aaf8e363da5306 100644 (file)
@@ -620,6 +620,8 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
        if (fnic->config.flags & VFCF_FIP_CAPABLE) {
                shost_printk(KERN_INFO, fnic->lport->host,
                             "firmware supports FIP\n");
+               /* enable directed and multicast */
+               vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0);
                vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS);
                vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
        } else {
@@ -698,6 +700,8 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
                goto err_out_remove_scsi_host;
        }
 
+       fc_lport_init_stats(lp);
+
        fc_lport_config(lp);
 
        if (fc_set_mfs(lp, fnic->config.maxdatafieldsize +
index d62b9061bf12f5e1c302948def0e85e80c943452..7c9ccbd4134b722dad20643314fa719fdcffb89c 100644 (file)
@@ -94,7 +94,7 @@ enum vnic_devcmd_cmd {
        CMD_STATS_DUMP          = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 4),
 
        /* set Rx packet filter: (u32)a0=filters (see CMD_PFILTER_*) */
-       CMD_PACKET_FILTER       = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 7),
+       CMD_PACKET_FILTER       = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 7),
 
        /* hang detection notification */
        CMD_HANG_NOTIFY         = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 8),
index 9e8fce0f0c1b3f1022b5658a2ad503fcc810abf6..ba3c94c9c25f22cb00bbf2dd64db394e85c51944 100644 (file)
 #include "gdth.h"
 
 static void gdth_delay(int milliseconds);
-static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs);
+static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs);
 static irqreturn_t gdth_interrupt(int irq, void *dev_id);
 static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
                                     int gdth_from_wait, int* pIndex);
-static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
+static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
                                                                Scsi_Cmnd *scp);
 static int gdth_async_event(gdth_ha_str *ha);
 static void gdth_log_event(gdth_evt_data *dvr, char *buffer);
 
-static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar priority);
+static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 priority);
 static void gdth_next(gdth_ha_str *ha);
-static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b);
+static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 b);
 static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
-static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, ushort source,
-                                      ushort idx, gdth_evt_data *evt);
+static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source,
+                                      u16 idx, gdth_evt_data *evt);
 static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr);
-static void gdth_readapp_event(gdth_ha_str *ha, unchar application, 
+static void gdth_readapp_event(gdth_ha_str *ha, u8 application, 
                                gdth_evt_str *estr);
 static void gdth_clear_events(void);
 
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count);
+                                    char *buffer, u16 count);
 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
-static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
+static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u16 hdrive);
 
 static void gdth_enable_int(gdth_ha_str *ha);
 static int gdth_test_busy(gdth_ha_str *ha);
 static int gdth_get_cmd_index(gdth_ha_str *ha);
 static void gdth_release_event(gdth_ha_str *ha);
-static int gdth_wait(gdth_ha_str *ha, int index,ulong32 time);
-static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode,
-                                             ulong32 p1, ulong64 p2,ulong64 p3);
+static int gdth_wait(gdth_ha_str *ha, int index,u32 time);
+static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode,
+                                             u32 p1, u64 p2,u64 p3);
 static int gdth_search_drives(gdth_ha_str *ha);
-static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive);
+static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive);
 
 static const char *gdth_ctr_name(gdth_ha_str *ha);
 
@@ -189,7 +189,7 @@ static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
 static void gdth_scsi_done(struct scsi_cmnd *scp);
 
 #ifdef DEBUG_GDTH
-static unchar   DebugState = DEBUG_GDTH;
+static u8   DebugState = DEBUG_GDTH;
 
 #ifdef __SERIAL__
 #define MAX_SERBUF 160
@@ -270,30 +270,30 @@ static int ser_printk(const char *fmt, ...)
 #endif
 
 #ifdef GDTH_STATISTICS
-static ulong32 max_rq=0, max_index=0, max_sg=0;
+static u32 max_rq=0, max_index=0, max_sg=0;
 #ifdef INT_COAL
-static ulong32 max_int_coal=0;
+static u32 max_int_coal=0;
 #endif
-static ulong32 act_ints=0, act_ios=0, act_stats=0, act_rq=0;
+static u32 act_ints=0, act_ios=0, act_stats=0, act_rq=0;
 static struct timer_list gdth_timer;
 #endif
 
-#define PTR2USHORT(a)   (ushort)(ulong)(a)
+#define PTR2USHORT(a)   (u16)(unsigned long)(a)
 #define GDTOFFSOF(a,b)  (size_t)&(((a*)0)->b)
 #define INDEX_OK(i,t)   ((i)<ARRAY_SIZE(t))
 
 #define BUS_L2P(a,b)    ((b)>(a)->virt_bus ? (b-1):(b))
 
 #ifdef CONFIG_ISA
-static unchar   gdth_drq_tab[4] = {5,6,7,7};            /* DRQ table */
+static u8   gdth_drq_tab[4] = {5,6,7,7};            /* DRQ table */
 #endif
 #if defined(CONFIG_EISA) || defined(CONFIG_ISA)
-static unchar   gdth_irq_tab[6] = {0,10,11,12,14,0};    /* IRQ table */
+static u8   gdth_irq_tab[6] = {0,10,11,12,14,0};    /* IRQ table */
 #endif
-static unchar   gdth_polling;                           /* polling if TRUE */
+static u8   gdth_polling;                           /* polling if TRUE */
 static int      gdth_ctr_count  = 0;                    /* controller count */
 static LIST_HEAD(gdth_instances);                       /* controller list */
-static unchar   gdth_write_through = FALSE;             /* write through */
+static u8   gdth_write_through = FALSE;             /* write through */
 static gdth_evt_str ebuffer[MAX_EVENTS];                /* event buffer */
 static int elastidx;
 static int eoldidx;
@@ -303,7 +303,7 @@ static int major;
 #define DOU     2                               /* OUT data direction */
 #define DNO     DIN                             /* no data transfer */
 #define DUN     DIN                             /* unknown data direction */
-static unchar gdth_direction_tab[0x100] = {
+static u8 gdth_direction_tab[0x100] = {
     DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN,
     DNO,DIN,DIN,DOU,DIN,DOU,DNO,DNO,DOU,DNO,DIN,DNO,DIN,DOU,DNO,DUN,
     DIN,DUN,DIN,DUN,DOU,DIN,DUN,DUN,DIN,DIN,DOU,DNO,DUN,DIN,DOU,DOU,
@@ -390,7 +390,7 @@ static gdth_ha_str *gdth_find_ha(int hanum)
 static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha)
 {
        struct gdth_cmndinfo *priv = NULL;
-       ulong flags;
+       unsigned long flags;
        int i;
 
        spin_lock_irqsave(&ha->smp_lock, flags);
@@ -493,7 +493,7 @@ int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd,
     return rval;
 }
 
-static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs)
+static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs)
 {
     *cyls = size /HEADS/SECS;
     if (*cyls <= MAXCYLS) {
@@ -514,9 +514,9 @@ static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs
 
 /* controller search and initialization functions */
 #ifdef CONFIG_EISA
-static int __init gdth_search_eisa(ushort eisa_adr)
+static int __init gdth_search_eisa(u16 eisa_adr)
 {
-    ulong32 id;
+    u32 id;
     
     TRACE(("gdth_search_eisa() adr. %x\n",eisa_adr));
     id = inl(eisa_adr+ID0REG);
@@ -533,13 +533,13 @@ static int __init gdth_search_eisa(ushort eisa_adr)
 #endif /* CONFIG_EISA */
 
 #ifdef CONFIG_ISA
-static int __init gdth_search_isa(ulong32 bios_adr)
+static int __init gdth_search_isa(u32 bios_adr)
 {
     void __iomem *addr;
-    ulong32 id;
+    u32 id;
 
     TRACE(("gdth_search_isa() bios adr. %x\n",bios_adr));
-    if ((addr = ioremap(bios_adr+BIOS_ID_OFFS, sizeof(ulong32))) != NULL) {
+    if ((addr = ioremap(bios_adr+BIOS_ID_OFFS, sizeof(u32))) != NULL) {
         id = readl(addr);
         iounmap(addr);
         if (id == GDT2_ID)                          /* GDT2000 */
@@ -551,7 +551,7 @@ static int __init gdth_search_isa(ulong32 bios_adr)
 
 #ifdef CONFIG_PCI
 
-static bool gdth_search_vortex(ushort device)
+static bool gdth_search_vortex(u16 device)
 {
        if (device <= PCI_DEVICE_ID_VORTEX_GDT6555)
                return true;
@@ -603,9 +603,9 @@ static void __devexit gdth_pci_remove_one(struct pci_dev *pdev)
 static int __devinit gdth_pci_init_one(struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
 {
-       ushort vendor = pdev->vendor;
-       ushort device = pdev->device;
-       ulong base0, base1, base2;
+       u16 vendor = pdev->vendor;
+       u16 device = pdev->device;
+       unsigned long base0, base1, base2;
        int rc;
        gdth_pci_str gdth_pcistr;
        gdth_ha_str *ha = NULL;
@@ -658,10 +658,10 @@ static int __devinit gdth_pci_init_one(struct pci_dev *pdev,
 #endif /* CONFIG_PCI */
 
 #ifdef CONFIG_EISA
-static int __init gdth_init_eisa(ushort eisa_adr,gdth_ha_str *ha)
+static int __init gdth_init_eisa(u16 eisa_adr,gdth_ha_str *ha)
 {
-    ulong32 retries,id;
-    unchar prot_ver,eisacf,i,irq_found;
+    u32 retries,id;
+    u8 prot_ver,eisacf,i,irq_found;
 
     TRACE(("gdth_init_eisa() adr. %x\n",eisa_adr));
     
@@ -688,7 +688,7 @@ static int __init gdth_init_eisa(ushort eisa_adr,gdth_ha_str *ha)
         return 0;
     }
     ha->bmic = eisa_adr;
-    ha->brd_phys = (ulong32)eisa_adr >> 12;
+    ha->brd_phys = (u32)eisa_adr >> 12;
 
     outl(0,eisa_adr+MAILBOXREG);
     outl(0,eisa_adr+MAILBOXREG+4);
@@ -752,12 +752,12 @@ static int __init gdth_init_eisa(ushort eisa_adr,gdth_ha_str *ha)
 #endif /* CONFIG_EISA */
 
 #ifdef CONFIG_ISA
-static int __init gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha)
+static int __init gdth_init_isa(u32 bios_adr,gdth_ha_str *ha)
 {
     register gdt2_dpram_str __iomem *dp2_ptr;
     int i;
-    unchar irq_drq,prot_ver;
-    ulong32 retries;
+    u8 irq_drq,prot_ver;
+    u32 retries;
 
     TRACE(("gdth_init_isa() bios adr. %x\n",bios_adr));
 
@@ -812,7 +812,7 @@ static int __init gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha)
         }
         gdth_delay(1);
     }
-    prot_ver = (unchar)readl(&dp2_ptr->u.ic.S_Info[0]);
+    prot_ver = (u8)readl(&dp2_ptr->u.ic.S_Info[0]);
     writeb(0, &dp2_ptr->u.ic.Status);
     writeb(0xff, &dp2_ptr->io.irqdel);
     if (prot_ver != PROTOCOL_VERSION) {
@@ -859,9 +859,9 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
     register gdt6_dpram_str __iomem *dp6_ptr;
     register gdt6c_dpram_str __iomem *dp6c_ptr;
     register gdt6m_dpram_str __iomem *dp6m_ptr;
-    ulong32 retries;
-    unchar prot_ver;
-    ushort command;
+    u32 retries;
+    u8 prot_ver;
+    u16 command;
     int i, found = FALSE;
 
     TRACE(("gdth_init_pci()\n"));
@@ -871,7 +871,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
     else
         ha->oem_id = OEM_ID_ICP;
     ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8);
-    ha->stype = (ulong32)pdev->device;
+    ha->stype = (u32)pdev->device;
     ha->irq = pdev->irq;
     ha->pdev = pdev;
     
@@ -891,7 +891,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
                 iounmap(ha->brd);
-                ha->brd = ioremap(i, sizeof(ushort)); 
+                ha->brd = ioremap(i, sizeof(u16)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -947,7 +947,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             }
             gdth_delay(1);
         }
-        prot_ver = (unchar)readl(&dp6_ptr->u.ic.S_Info[0]);
+        prot_ver = (u8)readl(&dp6_ptr->u.ic.S_Info[0]);
         writeb(0, &dp6_ptr->u.ic.S_Status);
         writeb(0xff, &dp6_ptr->io.irqdel);
         if (prot_ver != PROTOCOL_VERSION) {
@@ -1000,7 +1000,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
                 iounmap(ha->brd);
-                ha->brd = ioremap(i, sizeof(ushort)); 
+                ha->brd = ioremap(i, sizeof(u16)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1059,7 +1059,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             }
             gdth_delay(1);
         }
-        prot_ver = (unchar)readl(&dp6c_ptr->u.ic.S_Info[0]);
+        prot_ver = (u8)readl(&dp6c_ptr->u.ic.S_Info[0]);
         writeb(0, &dp6c_ptr->u.ic.Status);
         if (prot_ver != PROTOCOL_VERSION) {
             printk("GDT-PCI: Illegal protocol version\n");
@@ -1128,7 +1128,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
                 iounmap(ha->brd);
-                ha->brd = ioremap(i, sizeof(ushort)); 
+                ha->brd = ioremap(i, sizeof(u16)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1180,7 +1180,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             }
             gdth_delay(1);
         }
-        prot_ver = (unchar)readl(&dp6m_ptr->u.ic.S_Info[0]);
+        prot_ver = (u8)readl(&dp6m_ptr->u.ic.S_Info[0]);
         writeb(0, &dp6m_ptr->u.ic.S_Status);
         if (prot_ver != PROTOCOL_VERSION) {
             printk("GDT-PCI: Illegal protocol version\n");
@@ -1223,7 +1223,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
             }
             gdth_delay(1);
         }
-        prot_ver = (unchar)(readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16);
+        prot_ver = (u8)(readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16);
         writeb(0, &dp6m_ptr->u.ic.S_Status);
         if (prot_ver < 0x2b)      /* FW < x.43: no 64-bit DMA support */
             ha->dma64_support = 0;
@@ -1239,7 +1239,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
 
 static void __devinit gdth_enable_int(gdth_ha_str *ha)
 {
-    ulong flags;
+    unsigned long flags;
     gdt2_dpram_str __iomem *dp2_ptr;
     gdt6_dpram_str __iomem *dp6_ptr;
     gdt6m_dpram_str __iomem *dp6m_ptr;
@@ -1274,14 +1274,14 @@ static void __devinit gdth_enable_int(gdth_ha_str *ha)
 }
 
 /* return IStatus if interrupt was from this card else 0 */
-static unchar gdth_get_status(gdth_ha_str *ha)
+static u8 gdth_get_status(gdth_ha_str *ha)
 {
-    unchar IStatus = 0;
+    u8 IStatus = 0;
 
     TRACE(("gdth_get_status() irq %d ctr_count %d\n", ha->irq, gdth_ctr_count));
 
         if (ha->type == GDT_EISA)
-            IStatus = inb((ushort)ha->bmic + EDOORREG);
+            IStatus = inb((u16)ha->bmic + EDOORREG);
         else if (ha->type == GDT_ISA)
             IStatus =
                 readb(&((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index);
@@ -1329,7 +1329,7 @@ static int gdth_get_cmd_index(gdth_ha_str *ha)
         if (ha->cmd_tab[i].cmnd == UNUSED_CMND) {
             ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer;
             ha->cmd_tab[i].service = ha->pccb->Service;
-            ha->pccb->CommandIndex = (ulong32)i+2;
+            ha->pccb->CommandIndex = (u32)i+2;
             return (i+2);
         }
     }
@@ -1362,7 +1362,7 @@ static void gdth_copy_command(gdth_ha_str *ha)
     register gdt6c_dpram_str __iomem *dp6c_ptr;
     gdt6_dpram_str __iomem *dp6_ptr;
     gdt2_dpram_str __iomem *dp2_ptr;
-    ushort cp_count,dp_offset,cmd_no;
+    u16 cp_count,dp_offset,cmd_no;
     
     TRACE(("gdth_copy_command() hanum %d\n", ha->hanum));
 
@@ -1386,28 +1386,28 @@ static void gdth_copy_command(gdth_ha_str *ha)
         dp2_ptr = ha->brd;
         writew(dp_offset + DPMEM_COMMAND_OFFSET,
                     &dp2_ptr->u.ic.comm_queue[cmd_no].offset);
-        writew((ushort)cmd_ptr->Service,
+        writew((u16)cmd_ptr->Service,
                     &dp2_ptr->u.ic.comm_queue[cmd_no].serv_id);
         memcpy_toio(&dp2_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
     } else if (ha->type == GDT_PCI) {
         dp6_ptr = ha->brd;
         writew(dp_offset + DPMEM_COMMAND_OFFSET,
                     &dp6_ptr->u.ic.comm_queue[cmd_no].offset);
-        writew((ushort)cmd_ptr->Service,
+        writew((u16)cmd_ptr->Service,
                     &dp6_ptr->u.ic.comm_queue[cmd_no].serv_id);
         memcpy_toio(&dp6_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
     } else if (ha->type == GDT_PCINEW) {
         dp6c_ptr = ha->brd;
         writew(dp_offset + DPMEM_COMMAND_OFFSET,
                     &dp6c_ptr->u.ic.comm_queue[cmd_no].offset);
-        writew((ushort)cmd_ptr->Service,
+        writew((u16)cmd_ptr->Service,
                     &dp6c_ptr->u.ic.comm_queue[cmd_no].serv_id);
         memcpy_toio(&dp6c_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
     } else if (ha->type == GDT_PCIMPR) {
         dp6m_ptr = ha->brd;
         writew(dp_offset + DPMEM_COMMAND_OFFSET,
                     &dp6m_ptr->u.ic.comm_queue[cmd_no].offset);
-        writew((ushort)cmd_ptr->Service,
+        writew((u16)cmd_ptr->Service,
                     &dp6m_ptr->u.ic.comm_queue[cmd_no].serv_id);
         memcpy_toio(&dp6m_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
     }
@@ -1420,14 +1420,14 @@ static void gdth_release_event(gdth_ha_str *ha)
 
 #ifdef GDTH_STATISTICS
     {
-        ulong32 i,j;
+        u32 i,j;
         for (i=0,j=0; j<GDTH_MAXCMDS; ++j) {
             if (ha->cmd_tab[j].cmnd != UNUSED_CMND)
                 ++i;
         }
         if (max_index < i) {
             max_index = i;
-            TRACE3(("GDT: max_index = %d\n",(ushort)i));
+            TRACE3(("GDT: max_index = %d\n",(u16)i));
         }
     }
 #endif
@@ -1450,7 +1450,7 @@ static void gdth_release_event(gdth_ha_str *ha)
     }
 }
 
-static int gdth_wait(gdth_ha_str *ha, int index, ulong32 time)
+static int gdth_wait(gdth_ha_str *ha, int index, u32 time)
 {
     int answer_found = FALSE;
     int wait_index = 0;
@@ -1476,8 +1476,8 @@ static int gdth_wait(gdth_ha_str *ha, int index, ulong32 time)
 }
 
 
-static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode,
-                                            ulong32 p1, ulong64 p2, ulong64 p3)
+static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode,
+                                            u32 p1, u64 p2, u64 p3)
 {
     register gdth_cmd_str *cmd_ptr;
     int retries,index;
@@ -1501,35 +1501,35 @@ static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode,
         if (service == CACHESERVICE) {
             if (opcode == GDT_IOCTL) {
                 cmd_ptr->u.ioctl.subfunc = p1;
-                cmd_ptr->u.ioctl.channel = (ulong32)p2;
-                cmd_ptr->u.ioctl.param_size = (ushort)p3;
+                cmd_ptr->u.ioctl.channel = (u32)p2;
+                cmd_ptr->u.ioctl.param_size = (u16)p3;
                 cmd_ptr->u.ioctl.p_param = ha->scratch_phys;
             } else {
                 if (ha->cache_feat & GDT_64BIT) {
-                    cmd_ptr->u.cache64.DeviceNo = (ushort)p1;
+                    cmd_ptr->u.cache64.DeviceNo = (u16)p1;
                     cmd_ptr->u.cache64.BlockNo  = p2;
                 } else {
-                    cmd_ptr->u.cache.DeviceNo = (ushort)p1;
-                    cmd_ptr->u.cache.BlockNo  = (ulong32)p2;
+                    cmd_ptr->u.cache.DeviceNo = (u16)p1;
+                    cmd_ptr->u.cache.BlockNo  = (u32)p2;
                 }
             }
         } else if (service == SCSIRAWSERVICE) {
             if (ha->raw_feat & GDT_64BIT) {
                 cmd_ptr->u.raw64.direction  = p1;
-                cmd_ptr->u.raw64.bus        = (unchar)p2;
-                cmd_ptr->u.raw64.target     = (unchar)p3;
-                cmd_ptr->u.raw64.lun        = (unchar)(p3 >> 8);
+                cmd_ptr->u.raw64.bus        = (u8)p2;
+                cmd_ptr->u.raw64.target     = (u8)p3;
+                cmd_ptr->u.raw64.lun        = (u8)(p3 >> 8);
             } else {
                 cmd_ptr->u.raw.direction  = p1;
-                cmd_ptr->u.raw.bus        = (unchar)p2;
-                cmd_ptr->u.raw.target     = (unchar)p3;
-                cmd_ptr->u.raw.lun        = (unchar)(p3 >> 8);
+                cmd_ptr->u.raw.bus        = (u8)p2;
+                cmd_ptr->u.raw.target     = (u8)p3;
+                cmd_ptr->u.raw.lun        = (u8)(p3 >> 8);
             }
         } else if (service == SCREENSERVICE) {
             if (opcode == GDT_REALTIME) {
-                *(ulong32 *)&cmd_ptr->u.screen.su.data[0] = p1;
-                *(ulong32 *)&cmd_ptr->u.screen.su.data[4] = (ulong32)p2;
-                *(ulong32 *)&cmd_ptr->u.screen.su.data[8] = (ulong32)p3;
+                *(u32 *)&cmd_ptr->u.screen.su.data[0] = p1;
+                *(u32 *)&cmd_ptr->u.screen.su.data[4] = (u32)p2;
+                *(u32 *)&cmd_ptr->u.screen.su.data[8] = (u32)p3;
             }
         }
         ha->cmd_len          = sizeof(gdth_cmd_str);
@@ -1555,9 +1555,9 @@ static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode,
 
 static int __devinit gdth_search_drives(gdth_ha_str *ha)
 {
-    ushort cdev_cnt, i;
+    u16 cdev_cnt, i;
     int ok;
-    ulong32 bus_no, drv_cnt, drv_no, j;
+    u32 bus_no, drv_cnt, drv_no, j;
     gdth_getch_str *chn;
     gdth_drlist_str *drl;
     gdth_iochan_str *ioc;
@@ -1570,8 +1570,8 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
 #endif
 
 #ifdef GDTH_RTC
-    unchar rtc[12];
-    ulong flags;
+    u8 rtc[12];
+    unsigned long flags;
 #endif     
    
     TRACE(("gdth_search_drives() hanum %d\n", ha->hanum));
@@ -1584,7 +1584,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         if (ok)
             ha->screen_feat = GDT_64BIT;
     }
-    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+    if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC))
         ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_INIT, 0, 0, 0);
     if (!ok) {
         printk("GDT-HA %d: Initialization error screen service (code %d)\n",
@@ -1609,11 +1609,11 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
             rtc[j] = CMOS_READ(j);
     } while (rtc[0] != CMOS_READ(0));
     spin_unlock_irqrestore(&rtc_lock, flags);
-    TRACE2(("gdth_search_drives(): RTC: %x/%x/%x\n",*(ulong32 *)&rtc[0],
-            *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8]));
+    TRACE2(("gdth_search_drives(): RTC: %x/%x/%x\n",*(u32 *)&rtc[0],
+            *(u32 *)&rtc[4], *(u32 *)&rtc[8]));
     /* 3. send to controller firmware */
-    gdth_internal_cmd(ha, SCREENSERVICE, GDT_REALTIME, *(ulong32 *)&rtc[0],
-                      *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8]);
+    gdth_internal_cmd(ha, SCREENSERVICE, GDT_REALTIME, *(u32 *)&rtc[0],
+                      *(u32 *)&rtc[4], *(u32 *)&rtc[8]);
 #endif  
  
     /* unfreeze all IOs */
@@ -1627,7 +1627,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         if (ok)
             ha->cache_feat = GDT_64BIT;
     }
-    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+    if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC))
         ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_INIT, LINUX_OS, 0, 0);
     if (!ok) {
         printk("GDT-HA %d: Initialization error cache service (code %d)\n",
@@ -1635,7 +1635,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         return 0;
     }
     TRACE2(("gdth_search_drives(): CACHESERVICE initialized\n"));
-    cdev_cnt = (ushort)ha->info;
+    cdev_cnt = (u16)ha->info;
     ha->fw_vers = ha->service;
 
 #ifdef INT_COAL
@@ -1644,7 +1644,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         pmod = (gdth_perf_modes *)ha->pscratch;
         pmod->version          = 1;
         pmod->st_mode          = 1;    /* enable one status buffer */
-        *((ulong64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys;
+        *((u64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys;
         pmod->st_buff_indx1    = COALINDEX;
         pmod->st_buff_addr2    = 0;
         pmod->st_buff_u_addr2  = 0;
@@ -1705,7 +1705,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
             else
                 ha->bus_id[bus_no] = 0xff;
         }       
-        ha->bus_cnt = (unchar)bus_no;
+        ha->bus_cnt = (u8)bus_no;
     }
     TRACE2(("gdth_search_drives() %d channels\n",ha->bus_cnt));
 
@@ -1789,12 +1789,12 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
 
         /* logical drives */
         if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_CNT,
-                              INVALID_CHANNEL,sizeof(ulong32))) {
-            drv_cnt = *(ulong32 *)ha->pscratch;
+                              INVALID_CHANNEL,sizeof(u32))) {
+            drv_cnt = *(u32 *)ha->pscratch;
             if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_LIST,
-                                  INVALID_CHANNEL,drv_cnt * sizeof(ulong32))) {
+                                  INVALID_CHANNEL,drv_cnt * sizeof(u32))) {
                 for (j = 0; j < drv_cnt; ++j) {
-                    drv_no = ((ulong32 *)ha->pscratch)[j];
+                    drv_no = ((u32 *)ha->pscratch)[j];
                     if (drv_no < MAX_LDRIVES) {
                         ha->hdr[drv_no].is_logdrv = TRUE;
                         TRACE2(("Drive %d is log. drive\n",drv_no));
@@ -1838,7 +1838,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         if (ok)
             ha->raw_feat = GDT_64BIT;
     }
-    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+    if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC))
         ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_INIT, 0, 0, 0);
     if (!ok) {
         printk("GDT-HA %d: Initialization error raw service (code %d)\n",
@@ -1854,7 +1854,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_GET_FEAT, 0, 0, 0)) {
             TRACE2(("gdth_search_dr(): get feat RAWSERVICE %d\n",
                     ha->info));
-            ha->raw_feat |= (ushort)ha->info;
+            ha->raw_feat |= (u16)ha->info;
         }
     } 
 
@@ -1865,7 +1865,7 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
         if (gdth_internal_cmd(ha, CACHESERVICE, GDT_GET_FEAT, 0, 0, 0)) {
             TRACE2(("gdth_search_dr(): get feat CACHESERV. %d\n",
                     ha->info));
-            ha->cache_feat |= (ushort)ha->info;
+            ha->cache_feat |= (u16)ha->info;
         }
     }
 
@@ -1923,9 +1923,9 @@ static int __devinit gdth_search_drives(gdth_ha_str *ha)
     return 1;
 }
 
-static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive)
+static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive)
 {
-    ulong32 drv_cyls;
+    u32 drv_cyls;
     int drv_hds, drv_secs;
 
     TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n", ha->hanum, hdrive));
@@ -1944,17 +1944,17 @@ static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive)
     } else {
         drv_hds = ha->info2 & 0xff;
         drv_secs = (ha->info2 >> 8) & 0xff;
-        drv_cyls = (ulong32)ha->hdr[hdrive].size / drv_hds / drv_secs;
+        drv_cyls = (u32)ha->hdr[hdrive].size / drv_hds / drv_secs;
     }
-    ha->hdr[hdrive].heads = (unchar)drv_hds;
-    ha->hdr[hdrive].secs  = (unchar)drv_secs;
+    ha->hdr[hdrive].heads = (u8)drv_hds;
+    ha->hdr[hdrive].secs  = (u8)drv_secs;
     /* round size */
     ha->hdr[hdrive].size  = drv_cyls * drv_hds * drv_secs;
     
     if (ha->cache_feat & GDT_64BIT) {
         if (gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INFO, hdrive, 0, 0)
             && ha->info2 != 0) {
-            ha->hdr[hdrive].size = ((ulong64)ha->info2 << 32) | ha->info;
+            ha->hdr[hdrive].size = ((u64)ha->info2 << 32) | ha->info;
         }
     }
     TRACE2(("gdth_search_dr() cdr. %d size %d hds %d scs %d\n",
@@ -1964,7 +1964,7 @@ static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive)
     if (gdth_internal_cmd(ha, CACHESERVICE, GDT_DEVTYPE, hdrive, 0, 0)) {
         TRACE2(("gdth_search_dr() cache drive %d devtype %d\n",
                 hdrive,ha->info));
-        ha->hdr[hdrive].devtype = (ushort)ha->info;
+        ha->hdr[hdrive].devtype = (u16)ha->info;
     }
 
     /* cluster info */
@@ -1972,14 +1972,14 @@ static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive)
         TRACE2(("gdth_search_dr() cache drive %d cluster info %d\n",
                 hdrive,ha->info));
         if (!shared_access)
-            ha->hdr[hdrive].cluster_type = (unchar)ha->info;
+            ha->hdr[hdrive].cluster_type = (u8)ha->info;
     }
 
     /* R/W attributes */
     if (gdth_internal_cmd(ha, CACHESERVICE, GDT_RW_ATTRIBS, hdrive, 0, 0)) {
         TRACE2(("gdth_search_dr() cache drive %d r/w attrib. %d\n",
                 hdrive,ha->info));
-        ha->hdr[hdrive].rw_attribs = (unchar)ha->info;
+        ha->hdr[hdrive].rw_attribs = (u8)ha->info;
     }
 
     return 1;
@@ -1988,12 +1988,12 @@ static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive)
 
 /* command queueing/sending functions */
 
-static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar priority)
+static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 priority)
 {
     struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
     register Scsi_Cmnd *pscp;
     register Scsi_Cmnd *nscp;
-    ulong flags;
+    unsigned long flags;
 
     TRACE(("gdth_putq() priority %d\n",priority));
     spin_lock_irqsave(&ha->smp_lock, flags);
@@ -2023,7 +2023,7 @@ static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar priority)
         ++flags;
     if (max_rq < flags) {
         max_rq = flags;
-        TRACE3(("GDT: max_rq = %d\n",(ushort)max_rq));
+        TRACE3(("GDT: max_rq = %d\n",(u16)max_rq));
     }
 #endif
 }
@@ -2032,9 +2032,9 @@ static void gdth_next(gdth_ha_str *ha)
 {
     register Scsi_Cmnd *pscp;
     register Scsi_Cmnd *nscp;
-    unchar b, t, l, firsttime;
-    unchar this_cmd, next_cmd;
-    ulong flags = 0;
+    u8 b, t, l, firsttime;
+    u8 this_cmd, next_cmd;
+    unsigned long flags = 0;
     int cmd_index;
 
     TRACE(("gdth_next() hanum %d\n", ha->hanum));
@@ -2282,20 +2282,20 @@ static void gdth_next(gdth_ha_str *ha)
  * buffers, kmap_atomic() as needed.
  */
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count)
+                                    char *buffer, u16 count)
 {
-    ushort cpcount,i, max_sg = scsi_sg_count(scp);
-    ushort cpsum,cpnow;
+    u16 cpcount,i, max_sg = scsi_sg_count(scp);
+    u16 cpsum,cpnow;
     struct scatterlist *sl;
     char *address;
 
-    cpcount = min_t(ushort, count, scsi_bufflen(scp));
+    cpcount = min_t(u16, count, scsi_bufflen(scp));
 
     if (cpcount) {
         cpsum=0;
         scsi_for_each_sg(scp, sl, max_sg, i) {
             unsigned long flags;
-            cpnow = (ushort)sl->length;
+            cpnow = (u16)sl->length;
             TRACE(("copy_internal() now %d sum %d count %d %d\n",
                           cpnow, cpsum, cpcount, scsi_bufflen(scp)));
             if (cpsum+cpnow > cpcount) 
@@ -2325,7 +2325,7 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
 
 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
 {
-    unchar t;
+    u8 t;
     gdth_inq_data inq;
     gdth_rdcap_data rdc;
     gdth_sense_data sd;
@@ -2389,7 +2389,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
 
       case READ_CAPACITY:
         TRACE2(("Read capacity hdrive %d\n",t));
-        if (ha->hdr[t].size > (ulong64)0xffffffff)
+        if (ha->hdr[t].size > (u64)0xffffffff)
             rdc.last_block_no = 0xffffffff;
         else
             rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1);
@@ -2425,12 +2425,12 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
     return 0;
 }
 
-static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
+static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u16 hdrive)
 {
     register gdth_cmd_str *cmdp;
     struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
-    ulong32 cnt, blockcnt;
-    ulong64 no, blockno;
+    u32 cnt, blockcnt;
+    u64 no, blockno;
     int i, cmd_index, read_write, sgcnt, mode64;
 
     cmdp = ha->pccb;
@@ -2498,17 +2498,17 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
 
     if (read_write) {
         if (scp->cmd_len == 16) {
-            memcpy(&no, &scp->cmnd[2], sizeof(ulong64));
+            memcpy(&no, &scp->cmnd[2], sizeof(u64));
             blockno = be64_to_cpu(no);
-            memcpy(&cnt, &scp->cmnd[10], sizeof(ulong32));
+            memcpy(&cnt, &scp->cmnd[10], sizeof(u32));
             blockcnt = be32_to_cpu(cnt);
         } else if (scp->cmd_len == 10) {
-            memcpy(&no, &scp->cmnd[2], sizeof(ulong32));
+            memcpy(&no, &scp->cmnd[2], sizeof(u32));
             blockno = be32_to_cpu(no);
-            memcpy(&cnt, &scp->cmnd[7], sizeof(ushort));
+            memcpy(&cnt, &scp->cmnd[7], sizeof(u16));
             blockcnt = be16_to_cpu(cnt);
         } else {
-            memcpy(&no, &scp->cmnd[0], sizeof(ulong32));
+            memcpy(&no, &scp->cmnd[0], sizeof(u32));
             blockno = be32_to_cpu(no) & 0x001fffffUL;
             blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4];
         }
@@ -2516,7 +2516,7 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
             cmdp->u.cache64.BlockNo = blockno;
             cmdp->u.cache64.BlockCnt = blockcnt;
         } else {
-            cmdp->u.cache.BlockNo = (ulong32)blockno;
+            cmdp->u.cache.BlockNo = (u32)blockno;
             cmdp->u.cache.BlockCnt = blockcnt;
         }
 
@@ -2528,12 +2528,12 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
             if (mode64) {
                 struct scatterlist *sl;
 
-                cmdp->u.cache64.DestAddr= (ulong64)-1;
+                cmdp->u.cache64.DestAddr= (u64)-1;
                 cmdp->u.cache64.sg_canz = sgcnt;
                 scsi_for_each_sg(scp, sl, sgcnt, i) {
                     cmdp->u.cache64.sg_lst[i].sg_ptr = sg_dma_address(sl);
 #ifdef GDTH_DMA_STATISTICS
-                    if (cmdp->u.cache64.sg_lst[i].sg_ptr > (ulong64)0xffffffff)
+                    if (cmdp->u.cache64.sg_lst[i].sg_ptr > (u64)0xffffffff)
                         ha->dma64_cnt++;
                     else
                         ha->dma32_cnt++;
@@ -2555,8 +2555,8 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
             }
 
 #ifdef GDTH_STATISTICS
-            if (max_sg < (ulong32)sgcnt) {
-                max_sg = (ulong32)sgcnt;
+            if (max_sg < (u32)sgcnt) {
+                max_sg = (u32)sgcnt;
                 TRACE3(("GDT: max_sg = %d\n",max_sg));
             }
 #endif
@@ -2572,7 +2572,7 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
         TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d\n",
                cmdp->OpCode,cmdp->u.cache64.BlockNo,cmdp->u.cache64.BlockCnt));
         ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) +
-            (ushort)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str);
+            (u16)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str);
     } else {
         TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
                cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz,
@@ -2581,7 +2581,7 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
         TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d\n",
                cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt));
         ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) +
-            (ushort)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str);
+            (u16)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str);
     }
     if (ha->cmd_len & 3)
         ha->cmd_len += (4 - (ha->cmd_len & 3));
@@ -2600,15 +2600,15 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
     return cmd_index;
 }
 
-static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
+static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 b)
 {
     register gdth_cmd_str *cmdp;
-    ushort i;
+    u16 i;
     dma_addr_t sense_paddr;
     int cmd_index, sgcnt, mode64;
-    unchar t,l;
+    u8 t,l;
     struct page *page;
-    ulong offset;
+    unsigned long offset;
     struct gdth_cmndinfo *cmndinfo;
 
     t = scp->device->id;
@@ -2654,7 +2654,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
 
     } else {
         page = virt_to_page(scp->sense_buffer);
-        offset = (ulong)scp->sense_buffer & ~PAGE_MASK;
+        offset = (unsigned long)scp->sense_buffer & ~PAGE_MASK;
         sense_paddr = pci_map_page(ha->pdev,page,offset,
                                    16,PCI_DMA_FROMDEVICE);
 
@@ -2703,12 +2703,12 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
             if (mode64) {
                 struct scatterlist *sl;
 
-                cmdp->u.raw64.sdata = (ulong64)-1;
+                cmdp->u.raw64.sdata = (u64)-1;
                 cmdp->u.raw64.sg_ranz = sgcnt;
                 scsi_for_each_sg(scp, sl, sgcnt, i) {
                     cmdp->u.raw64.sg_lst[i].sg_ptr = sg_dma_address(sl);
 #ifdef GDTH_DMA_STATISTICS
-                    if (cmdp->u.raw64.sg_lst[i].sg_ptr > (ulong64)0xffffffff)
+                    if (cmdp->u.raw64.sg_lst[i].sg_ptr > (u64)0xffffffff)
                         ha->dma64_cnt++;
                     else
                         ha->dma32_cnt++;
@@ -2744,7 +2744,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
                    cmdp->u.raw64.sg_lst[0].sg_len));
             /* evaluate command size */
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) +
-                (ushort)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str);
+                (u16)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str);
         } else {
             TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
                    cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz,
@@ -2752,7 +2752,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
                    cmdp->u.raw.sg_lst[0].sg_len));
             /* evaluate command size */
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) +
-                (ushort)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str);
+                (u16)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str);
         }
     }
     /* check space */
@@ -2802,7 +2802,7 @@ static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
     if (cmdp->OpCode == GDT_IOCTL) {
         TRACE2(("IOCTL\n"));
         ha->cmd_len = 
-            GDTOFFSOF(gdth_cmd_str,u.ioctl.p_param) + sizeof(ulong64);
+            GDTOFFSOF(gdth_cmd_str,u.ioctl.p_param) + sizeof(u64);
     } else if (cmdp->Service == CACHESERVICE) {
         TRACE2(("cache command %d\n",cmdp->OpCode));
         if (ha->cache_feat & GDT_64BIT)
@@ -2840,8 +2840,8 @@ static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
 
 
 /* Controller event handling functions */
-static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, ushort source, 
-                                      ushort idx, gdth_evt_data *evt)
+static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, 
+                                      u16 idx, gdth_evt_data *evt)
 {
     gdth_evt_str *e;
     struct timeval tv;
@@ -2890,7 +2890,7 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr)
 {
     gdth_evt_str *e;
     int eindex;
-    ulong flags;
+    unsigned long flags;
 
     TRACE2(("gdth_read_event() handle %d\n", handle));
     spin_lock_irqsave(&ha->smp_lock, flags);
@@ -2919,12 +2919,12 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr)
 }
 
 static void gdth_readapp_event(gdth_ha_str *ha,
-                               unchar application, gdth_evt_str *estr)
+                               u8 application, gdth_evt_str *estr)
 {
     gdth_evt_str *e;
     int eindex;
-    ulong flags;
-    unchar found = FALSE;
+    unsigned long flags;
+    u8 found = FALSE;
 
     TRACE2(("gdth_readapp_event() app. %d\n", application));
     spin_lock_irqsave(&ha->smp_lock, flags);
@@ -2969,9 +2969,9 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
     gdt2_dpram_str __iomem *dp2_ptr;
     Scsi_Cmnd *scp;
     int rval, i;
-    unchar IStatus;
-    ushort Service;
-    ulong flags = 0;
+    u8 IStatus;
+    u16 Service;
+    unsigned long flags = 0;
 #ifdef INT_COAL
     int coalesced = FALSE;
     int next = FALSE;
@@ -3018,7 +3018,7 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
         if (coalesced) {
             /* For coalesced requests all status
                information is found in the status buffer */
-            IStatus = (unchar)(pcs->status & 0xff);
+            IStatus = (u8)(pcs->status & 0xff);
         }
 #endif
     
@@ -3197,7 +3197,7 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
             ++act_int_coal;
             if (act_int_coal > max_int_coal) {
                 max_int_coal = act_int_coal;
-                printk("GDT: max_int_coal = %d\n",(ushort)max_int_coal);
+                printk("GDT: max_int_coal = %d\n",(u16)max_int_coal);
             }
 #endif      
             /* see if there is another status */
@@ -3225,12 +3225,12 @@ static irqreturn_t gdth_interrupt(int irq, void *dev_id)
        return __gdth_interrupt(ha, false, NULL);
 }
 
-static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
+static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
                                                               Scsi_Cmnd *scp)
 {
     gdth_msg_str *msg;
     gdth_cmd_str *cmdp;
-    unchar b, t;
+    u8 b, t;
     struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
 
     cmdp = ha->pccb;
@@ -3263,7 +3263,7 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
             cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong64);
+                + sizeof(u64);
             ha->cmd_cnt = 0;
             gdth_copy_command(ha);
             gdth_release_event(ha);
@@ -3297,7 +3297,7 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
             cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong64);
+                + sizeof(u64);
             ha->cmd_cnt = 0;
             gdth_copy_command(ha);
             gdth_release_event(ha);
@@ -3335,7 +3335,7 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
                         cmndinfo->OpCode));
                 /* special commands GDT_CLUST_INFO/GDT_MOUNT ? */
                 if (cmndinfo->OpCode == GDT_CLUST_INFO) {
-                    ha->hdr[t].cluster_type = (unchar)ha->info;
+                    ha->hdr[t].cluster_type = (u8)ha->info;
                     if (!(ha->hdr[t].cluster_type & 
                         CLUSTER_MOUNTED)) {
                         /* NOT MOUNTED -> MOUNT */
@@ -3397,7 +3397,7 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
                     ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED;
                 }
                 memset((char*)scp->sense_buffer,0,16);
-                if (ha->status == (ushort)S_CACHE_RESERV) {
+                if (ha->status == (u16)S_CACHE_RESERV) {
                     scp->result = (DID_OK << 16) | (RESERVATION_CONFLICT << 1);
                 } else {
                     scp->sense_buffer[0] = 0x70;
@@ -3614,16 +3614,16 @@ static int gdth_async_event(gdth_ha_str *ha)
             cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong64);
+                + sizeof(u64);
             ha->cmd_cnt = 0;
             gdth_copy_command(ha);
             if (ha->type == GDT_EISA)
-                printk("[EISA slot %d] ",(ushort)ha->brd_phys);
+                printk("[EISA slot %d] ",(u16)ha->brd_phys);
             else if (ha->type == GDT_ISA)
-                printk("[DPMEM 0x%4X] ",(ushort)ha->brd_phys);
+                printk("[DPMEM 0x%4X] ",(u16)ha->brd_phys);
             else 
-                printk("[PCI %d/%d] ",(ushort)(ha->brd_phys>>8),
-                       (ushort)((ha->brd_phys>>3)&0x1f));
+                printk("[PCI %d/%d] ",(u16)(ha->brd_phys>>8),
+                       (u16)((ha->brd_phys>>3)&0x1f));
             gdth_release_event(ha);
         }
 
@@ -3640,7 +3640,7 @@ static int gdth_async_event(gdth_ha_str *ha)
             ha->dvr.eu.async.service = ha->service;
             ha->dvr.eu.async.status  = ha->status;
             ha->dvr.eu.async.info    = ha->info;
-            *(ulong32 *)ha->dvr.eu.async.scsi_coord  = ha->info2;
+            *(u32 *)ha->dvr.eu.async.scsi_coord  = ha->info2;
         }
         gdth_store_event( ha, ES_ASYNC, ha->service, &ha->dvr );
         gdth_log_event( &ha->dvr, NULL );
@@ -3648,8 +3648,8 @@ static int gdth_async_event(gdth_ha_str *ha)
         /* new host drive from expand? */
         if (ha->service == CACHESERVICE && ha->status == 56) {
             TRACE2(("gdth_async_event(): new host drive %d created\n",
-                    (ushort)ha->info));
-            /* gdth_analyse_hdrive(hanum, (ushort)ha->info); */
+                    (u16)ha->info));
+            /* gdth_analyse_hdrive(hanum, (u16)ha->info); */
         }   
     }
     return 1;
@@ -3680,13 +3680,13 @@ static void gdth_log_event(gdth_evt_data *dvr, char *buffer)
         for (j=0,i=1; i < f[0]; i+=2) {
             switch (f[i+1]) {
               case 4:
-                stack.b[j++] = *(ulong32*)&dvr->eu.stream[(int)f[i]];
+                stack.b[j++] = *(u32*)&dvr->eu.stream[(int)f[i]];
                 break;
               case 2:
-                stack.b[j++] = *(ushort*)&dvr->eu.stream[(int)f[i]];
+                stack.b[j++] = *(u16*)&dvr->eu.stream[(int)f[i]];
                 break;
               case 1:
-                stack.b[j++] = *(unchar*)&dvr->eu.stream[(int)f[i]];
+                stack.b[j++] = *(u8*)&dvr->eu.stream[(int)f[i]];
                 break;
               default:
                 break;
@@ -3712,14 +3712,14 @@ static void gdth_log_event(gdth_evt_data *dvr, char *buffer)
 }
 
 #ifdef GDTH_STATISTICS
-static unchar  gdth_timer_running;
+static u8      gdth_timer_running;
 
-static void gdth_timeout(ulong data)
+static void gdth_timeout(unsigned long data)
 {
-    ulong32 i;
+    u32 i;
     Scsi_Cmnd *nscp;
     gdth_ha_str *ha;
-    ulong flags;
+    unsigned long flags;
 
     if(unlikely(list_empty(&gdth_instances))) {
            gdth_timer_running = 0;
@@ -3891,8 +3891,8 @@ static enum blk_eh_timer_return gdth_timed_out(struct scsi_cmnd *scp)
 {
        gdth_ha_str *ha = shost_priv(scp->device->host);
        struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
-       unchar b, t;
-       ulong flags;
+       u8 b, t;
+       unsigned long flags;
        enum blk_eh_timer_return retval = BLK_EH_NOT_HANDLED;
 
        TRACE(("%s() cmd 0x%x\n", scp->cmnd[0], __func__));
@@ -3924,9 +3924,9 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp)
 {
     gdth_ha_str *ha = shost_priv(scp->device->host);
     int i;
-    ulong flags;
+    unsigned long flags;
     Scsi_Cmnd *cmnd;
-    unchar b;
+    u8 b;
 
     TRACE2(("gdth_eh_bus_reset()\n"));
 
@@ -3974,7 +3974,7 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp)
 
 static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip)
 {
-    unchar b, t;
+    u8 b, t;
     gdth_ha_str *ha = shost_priv(sdev->host);
     struct scsi_device *sd;
     unsigned capacity;
@@ -4062,7 +4062,7 @@ static int ioc_event(void __user *arg)
 {
     gdth_ioctl_event evt;
     gdth_ha_str *ha;
-    ulong flags;
+    unsigned long flags;
 
     if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)))
         return -EFAULT;
@@ -4098,8 +4098,8 @@ static int ioc_event(void __user *arg)
 static int ioc_lockdrv(void __user *arg)
 {
     gdth_ioctl_lockdrv ldrv;
-    unchar i, j;
-    ulong flags;
+    u8 i, j;
+    unsigned long flags;
     gdth_ha_str *ha;
 
     if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)))
@@ -4165,7 +4165,7 @@ static int ioc_general(void __user *arg, char *cmnd)
 {
     gdth_ioctl_general gen;
     char *buf = NULL;
-    ulong64 paddr; 
+    u64 paddr; 
     gdth_ha_str *ha;
     int rval;
 
@@ -4194,7 +4194,7 @@ static int ioc_general(void __user *arg, char *cmnd)
                 gen.command.u.cache64.DeviceNo = gen.command.u.cache.DeviceNo;
                 /* addresses */
                 if (ha->cache_feat & SCATTER_GATHER) {
-                    gen.command.u.cache64.DestAddr = (ulong64)-1;
+                    gen.command.u.cache64.DestAddr = (u64)-1;
                     gen.command.u.cache64.sg_canz = 1;
                     gen.command.u.cache64.sg_lst[0].sg_ptr = paddr;
                     gen.command.u.cache64.sg_lst[0].sg_len = gen.data_len;
@@ -4207,7 +4207,7 @@ static int ioc_general(void __user *arg, char *cmnd)
                 if (ha->cache_feat & SCATTER_GATHER) {
                     gen.command.u.cache.DestAddr = 0xffffffff;
                     gen.command.u.cache.sg_canz = 1;
-                    gen.command.u.cache.sg_lst[0].sg_ptr = (ulong32)paddr;
+                    gen.command.u.cache.sg_lst[0].sg_ptr = (u32)paddr;
                     gen.command.u.cache.sg_lst[0].sg_len = gen.data_len;
                     gen.command.u.cache.sg_lst[1].sg_len = 0;
                 } else {
@@ -4230,7 +4230,7 @@ static int ioc_general(void __user *arg, char *cmnd)
                 gen.command.u.raw64.direction = gen.command.u.raw.direction;
                 /* addresses */
                 if (ha->raw_feat & SCATTER_GATHER) {
-                    gen.command.u.raw64.sdata = (ulong64)-1;
+                    gen.command.u.raw64.sdata = (u64)-1;
                     gen.command.u.raw64.sg_ranz = 1;
                     gen.command.u.raw64.sg_lst[0].sg_ptr = paddr;
                     gen.command.u.raw64.sg_lst[0].sg_len = gen.data_len;
@@ -4244,14 +4244,14 @@ static int ioc_general(void __user *arg, char *cmnd)
                 if (ha->raw_feat & SCATTER_GATHER) {
                     gen.command.u.raw.sdata = 0xffffffff;
                     gen.command.u.raw.sg_ranz = 1;
-                    gen.command.u.raw.sg_lst[0].sg_ptr = (ulong32)paddr;
+                    gen.command.u.raw.sg_lst[0].sg_ptr = (u32)paddr;
                     gen.command.u.raw.sg_lst[0].sg_len = gen.data_len;
                     gen.command.u.raw.sg_lst[1].sg_len = 0;
                 } else {
                     gen.command.u.raw.sdata = paddr;
                     gen.command.u.raw.sg_ranz = 0;
                 }
-                gen.command.u.raw.sense_data = (ulong32)paddr + gen.data_len;
+                gen.command.u.raw.sense_data = (u32)paddr + gen.data_len;
             }
         } else {
             gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr);
@@ -4283,7 +4283,7 @@ static int ioc_hdrlist(void __user *arg, char *cmnd)
     gdth_ioctl_rescan *rsc;
     gdth_cmd_str *cmd;
     gdth_ha_str *ha;
-    unchar i;
+    u8 i;
     int rc = -ENOMEM;
     u32 cluster_type = 0;
 
@@ -4335,11 +4335,11 @@ static int ioc_rescan(void __user *arg, char *cmnd)
 {
     gdth_ioctl_rescan *rsc;
     gdth_cmd_str *cmd;
-    ushort i, status, hdr_cnt;
-    ulong32 info;
+    u16 i, status, hdr_cnt;
+    u32 info;
     int cyls, hds, secs;
     int rc = -ENOMEM;
-    ulong flags;
+    unsigned long flags;
     gdth_ha_str *ha; 
 
     rsc = kmalloc(sizeof(*rsc), GFP_KERNEL);
@@ -4367,7 +4367,7 @@ static int ioc_rescan(void __user *arg, char *cmnd)
 
         status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
         i = 0;
-        hdr_cnt = (status == S_OK ? (ushort)info : 0);
+        hdr_cnt = (status == S_OK ? (u16)info : 0);
     } else {
         i = rsc->hdr_no;
         hdr_cnt = i + 1;
@@ -4418,7 +4418,7 @@ static int ioc_rescan(void __user *arg, char *cmnd)
         status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
 
         spin_lock_irqsave(&ha->smp_lock, flags);
-        ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0);
+        ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0);
         spin_unlock_irqrestore(&ha->smp_lock, flags);
 
         cmd->Service = CACHESERVICE;
@@ -4432,7 +4432,7 @@ static int ioc_rescan(void __user *arg, char *cmnd)
 
         spin_lock_irqsave(&ha->smp_lock, flags);
         ha->hdr[i].cluster_type = 
-            ((status == S_OK && !shared_access) ? (ushort)info : 0);
+            ((status == S_OK && !shared_access) ? (u16)info : 0);
         spin_unlock_irqrestore(&ha->smp_lock, flags);
         rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
 
@@ -4446,7 +4446,7 @@ static int ioc_rescan(void __user *arg, char *cmnd)
         status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
 
         spin_lock_irqsave(&ha->smp_lock, flags);
-        ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0);
+        ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0);
         spin_unlock_irqrestore(&ha->smp_lock, flags);
     }
  
@@ -4466,7 +4466,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
 {
     gdth_ha_str *ha; 
     Scsi_Cmnd *scp;
-    ulong flags;
+    unsigned long flags;
     char cmnd[MAX_COMMAND_SIZE];   
     void __user *argp = (void __user *)arg;
 
@@ -4495,9 +4495,9 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
       { 
         gdth_ioctl_osvers osv; 
 
-        osv.version = (unchar)(LINUX_VERSION_CODE >> 16);
-        osv.subversion = (unchar)(LINUX_VERSION_CODE >> 8);
-        osv.revision = (ushort)(LINUX_VERSION_CODE & 0xff);
+        osv.version = (u8)(LINUX_VERSION_CODE >> 16);
+        osv.subversion = (u8)(LINUX_VERSION_CODE >> 8);
+        osv.revision = (u16)(LINUX_VERSION_CODE & 0xff);
         if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers)))
                 return -EFAULT;
         break;
@@ -4512,10 +4512,10 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
             return -EFAULT;
 
         if (ha->type == GDT_ISA || ha->type == GDT_EISA) {
-            ctrt.type = (unchar)((ha->stype>>20) - 0x10);
+            ctrt.type = (u8)((ha->stype>>20) - 0x10);
         } else {
             if (ha->type != GDT_PCIMPR) {
-                ctrt.type = (unchar)((ha->stype<<4) + 6);
+                ctrt.type = (u8)((ha->stype<<4) + 6);
             } else {
                 ctrt.type = 
                     (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
@@ -4546,7 +4546,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
       case GDTIOCTL_LOCKCHN:
       {
         gdth_ioctl_lockchn lchn;
-        unchar i, j;
+        u8 i, j;
 
         if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) ||
             (NULL == (ha = gdth_find_ha(lchn.ionode))))
@@ -4670,7 +4670,7 @@ static struct scsi_host_template gdth_template = {
 };
 
 #ifdef CONFIG_ISA
-static int __init gdth_isa_probe_one(ulong32 isa_bios)
+static int __init gdth_isa_probe_one(u32 isa_bios)
 {
        struct Scsi_Host *shp;
        gdth_ha_str *ha;
@@ -4802,7 +4802,7 @@ static int __init gdth_isa_probe_one(ulong32 isa_bios)
 #endif /* CONFIG_ISA */
 
 #ifdef CONFIG_EISA
-static int __init gdth_eisa_probe_one(ushort eisa_slot)
+static int __init gdth_eisa_probe_one(u16 eisa_slot)
 {
        struct Scsi_Host *shp;
        gdth_ha_str *ha;
@@ -5120,7 +5120,7 @@ static void gdth_remove_one(gdth_ha_str *ha)
        scsi_host_put(shp);
 }
 
-static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
+static int gdth_halt(struct notifier_block *nb, unsigned long event, void *buf)
 {
        gdth_ha_str *ha;
 
@@ -5158,14 +5158,14 @@ static int __init gdth_init(void)
        if (probe_eisa_isa) {
                /* scanning for controllers, at first: ISA controller */
 #ifdef CONFIG_ISA
-               ulong32 isa_bios;
+               u32 isa_bios;
                for (isa_bios = 0xc8000UL; isa_bios <= 0xd8000UL;
                                isa_bios += 0x8000UL)
                        gdth_isa_probe_one(isa_bios);
 #endif
 #ifdef CONFIG_EISA
                {
-                       ushort eisa_slot;
+                       u16 eisa_slot;
                        for (eisa_slot = 0x1000; eisa_slot <= 0x8000;
                                                 eisa_slot += 0x1000)
                                gdth_eisa_probe_one(eisa_slot);
index 1646444e9bd58894ef8af3cadcfe3b2bd7287be0..120a0625a7b5d1ba61f556a020ba79aa8abe3f5b 100644 (file)
 
 /* screenservice message */
 typedef struct {                               
-    ulong32     msg_handle;                     /* message handle */
-    ulong32     msg_len;                        /* size of message */
-    ulong32     msg_alen;                       /* answer length */
-    unchar      msg_answer;                     /* answer flag */
-    unchar      msg_ext;                        /* more messages */
-    unchar      msg_reserved[2];
+    u32     msg_handle;                     /* message handle */
+    u32     msg_len;                        /* size of message */
+    u32     msg_alen;                       /* answer length */
+    u8      msg_answer;                     /* answer flag */
+    u8      msg_ext;                        /* more messages */
+    u8      msg_reserved[2];
     char        msg_text[MSGLEN+2];             /* the message text */
-} PACKED gdth_msg_str;
+} __attribute__((packed)) gdth_msg_str;
 
 
 /* IOCTL data structures */
 
 /* Status coalescing buffer for returning multiple requests per interrupt */
 typedef struct {
-    ulong32     status;
-    ulong32     ext_status;
-    ulong32     info0;
-    ulong32     info1;
-} PACKED gdth_coal_status;
+    u32     status;
+    u32     ext_status;
+    u32     info0;
+    u32     info1;
+} __attribute__((packed)) gdth_coal_status;
 
 /* performance mode data structure */
 typedef struct {
-    ulong32     version;            /* The version of this IOCTL structure. */
-    ulong32     st_mode;            /* 0=dis., 1=st_buf_addr1 valid, 2=both  */
-    ulong32     st_buff_addr1;      /* physical address of status buffer 1 */
-    ulong32     st_buff_u_addr1;    /* reserved for 64 bit addressing */
-    ulong32     st_buff_indx1;      /* reserved command idx. for this buffer */
-    ulong32     st_buff_addr2;      /* physical address of status buffer 1 */
-    ulong32     st_buff_u_addr2;    /* reserved for 64 bit addressing */
-    ulong32     st_buff_indx2;      /* reserved command idx. for this buffer */
-    ulong32     st_buff_size;       /* size of each buffer in bytes */
-    ulong32     cmd_mode;           /* 0 = mode disabled, 1 = cmd_buff_addr1 */ 
-    ulong32     cmd_buff_addr1;     /* physical address of cmd buffer 1 */   
-    ulong32     cmd_buff_u_addr1;   /* reserved for 64 bit addressing */
-    ulong32     cmd_buff_indx1;     /* cmd buf addr1 unique identifier */
-    ulong32     cmd_buff_addr2;     /* physical address of cmd buffer 1 */   
-    ulong32     cmd_buff_u_addr2;   /* reserved for 64 bit addressing */
-    ulong32     cmd_buff_indx2;     /* cmd buf addr1 unique identifier */
-    ulong32     cmd_buff_size;      /* size of each cmd bufer in bytes */
-    ulong32     reserved1;
-    ulong32     reserved2;
-} PACKED gdth_perf_modes;
+    u32     version;            /* The version of this IOCTL structure. */
+    u32     st_mode;            /* 0=dis., 1=st_buf_addr1 valid, 2=both  */
+    u32     st_buff_addr1;      /* physical address of status buffer 1 */
+    u32     st_buff_u_addr1;    /* reserved for 64 bit addressing */
+    u32     st_buff_indx1;      /* reserved command idx. for this buffer */
+    u32     st_buff_addr2;      /* physical address of status buffer 1 */
+    u32     st_buff_u_addr2;    /* reserved for 64 bit addressing */
+    u32     st_buff_indx2;      /* reserved command idx. for this buffer */
+    u32     st_buff_size;       /* size of each buffer in bytes */
+    u32     cmd_mode;           /* 0 = mode disabled, 1 = cmd_buff_addr1 */ 
+    u32     cmd_buff_addr1;     /* physical address of cmd buffer 1 */   
+    u32     cmd_buff_u_addr1;   /* reserved for 64 bit addressing */
+    u32     cmd_buff_indx1;     /* cmd buf addr1 unique identifier */
+    u32     cmd_buff_addr2;     /* physical address of cmd buffer 1 */   
+    u32     cmd_buff_u_addr2;   /* reserved for 64 bit addressing */
+    u32     cmd_buff_indx2;     /* cmd buf addr1 unique identifier */
+    u32     cmd_buff_size;      /* size of each cmd bufer in bytes */
+    u32     reserved1;
+    u32     reserved2;
+} __attribute__((packed)) gdth_perf_modes;
 
 /* SCSI drive info */
 typedef struct {
-    unchar      vendor[8];                      /* vendor string */
-    unchar      product[16];                    /* product string */
-    unchar      revision[4];                    /* revision */
-    ulong32     sy_rate;                        /* current rate for sync. tr. */
-    ulong32     sy_max_rate;                    /* max. rate for sync. tr. */
-    ulong32     no_ldrive;                      /* belongs to this log. drv.*/
-    ulong32     blkcnt;                         /* number of blocks */
-    ushort      blksize;                        /* size of block in bytes */
-    unchar      available;                      /* flag: access is available */
-    unchar      init;                           /* medium is initialized */
-    unchar      devtype;                        /* SCSI devicetype */
-    unchar      rm_medium;                      /* medium is removable */
-    unchar      wp_medium;                      /* medium is write protected */
-    unchar      ansi;                           /* SCSI I/II or III? */
-    unchar      protocol;                       /* same as ansi */
-    unchar      sync;                           /* flag: sync. transfer enab. */
-    unchar      disc;                           /* flag: disconnect enabled */
-    unchar      queueing;                       /* flag: command queing enab. */
-    unchar      cached;                         /* flag: caching enabled */
-    unchar      target_id;                      /* target ID of device */
-    unchar      lun;                            /* LUN id of device */
-    unchar      orphan;                         /* flag: drive fragment */
-    ulong32     last_error;                     /* sense key or drive state */
-    ulong32     last_result;                    /* result of last command */
-    ulong32     check_errors;                   /* err. in last surface check */
-    unchar      percent;                        /* progress for surface check */
-    unchar      last_check;                     /* IOCTRL operation */
-    unchar      res[2];
-    ulong32     flags;                          /* from 1.19/2.19: raw reserv.*/
-    unchar      multi_bus;                      /* multi bus dev? (fibre ch.) */
-    unchar      mb_status;                      /* status: available? */
-    unchar      res2[2];
-    unchar      mb_alt_status;                  /* status on second bus */
-    unchar      mb_alt_bid;                     /* number of second bus */
-    unchar      mb_alt_tid;                     /* target id on second bus */
-    unchar      res3;
-    unchar      fc_flag;                        /* from 1.22/2.22: info valid?*/
-    unchar      res4;
-    ushort      fc_frame_size;                  /* frame size (bytes) */
+    u8      vendor[8];                      /* vendor string */
+    u8      product[16];                    /* product string */
+    u8      revision[4];                    /* revision */
+    u32     sy_rate;                        /* current rate for sync. tr. */
+    u32     sy_max_rate;                    /* max. rate for sync. tr. */
+    u32     no_ldrive;                      /* belongs to this log. drv.*/
+    u32     blkcnt;                         /* number of blocks */
+    u16      blksize;                        /* size of block in bytes */
+    u8      available;                      /* flag: access is available */
+    u8      init;                           /* medium is initialized */
+    u8      devtype;                        /* SCSI devicetype */
+    u8      rm_medium;                      /* medium is removable */
+    u8      wp_medium;                      /* medium is write protected */
+    u8      ansi;                           /* SCSI I/II or III? */
+    u8      protocol;                       /* same as ansi */
+    u8      sync;                           /* flag: sync. transfer enab. */
+    u8      disc;                           /* flag: disconnect enabled */
+    u8      queueing;                       /* flag: command queing enab. */
+    u8      cached;                         /* flag: caching enabled */
+    u8      target_id;                      /* target ID of device */
+    u8      lun;                            /* LUN id of device */
+    u8      orphan;                         /* flag: drive fragment */
+    u32     last_error;                     /* sense key or drive state */
+    u32     last_result;                    /* result of last command */
+    u32     check_errors;                   /* err. in last surface check */
+    u8      percent;                        /* progress for surface check */
+    u8      last_check;                     /* IOCTRL operation */
+    u8      res[2];
+    u32     flags;                          /* from 1.19/2.19: raw reserv.*/
+    u8      multi_bus;                      /* multi bus dev? (fibre ch.) */
+    u8      mb_status;                      /* status: available? */
+    u8      res2[2];
+    u8      mb_alt_status;                  /* status on second bus */
+    u8      mb_alt_bid;                     /* number of second bus */
+    u8      mb_alt_tid;                     /* target id on second bus */
+    u8      res3;
+    u8      fc_flag;                        /* from 1.22/2.22: info valid?*/
+    u8      res4;
+    u16      fc_frame_size;                  /* frame size (bytes) */
     char        wwn[8];                         /* world wide name */
-} PACKED gdth_diskinfo_str;
+} __attribute__((packed)) gdth_diskinfo_str;
 
 /* get SCSI channel count  */
 typedef struct {
-    ulong32     channel_no;                     /* number of channel */
-    ulong32     drive_cnt;                      /* drive count */
-    unchar      siop_id;                        /* SCSI processor ID */
-    unchar      siop_state;                     /* SCSI processor state */ 
-} PACKED gdth_getch_str;
+    u32     channel_no;                     /* number of channel */
+    u32     drive_cnt;                      /* drive count */
+    u8      siop_id;                        /* SCSI processor ID */
+    u8      siop_state;                     /* SCSI processor state */ 
+} __attribute__((packed)) gdth_getch_str;
 
 /* get SCSI drive numbers */
 typedef struct {
-    ulong32     sc_no;                          /* SCSI channel */
-    ulong32     sc_cnt;                         /* sc_list[] elements */
-    ulong32     sc_list[MAXID];                 /* minor device numbers */
-} PACKED gdth_drlist_str;
+    u32     sc_no;                          /* SCSI channel */
+    u32     sc_cnt;                         /* sc_list[] elements */
+    u32     sc_list[MAXID];                 /* minor device numbers */
+} __attribute__((packed)) gdth_drlist_str;
 
 /* get grown/primary defect count */
 typedef struct {
-    unchar      sddc_type;                      /* 0x08: grown, 0x10: prim. */
-    unchar      sddc_format;                    /* list entry format */
-    unchar      sddc_len;                       /* list entry length */
-    unchar      sddc_res;
-    ulong32     sddc_cnt;                       /* entry count */
-} PACKED gdth_defcnt_str;
+    u8      sddc_type;                      /* 0x08: grown, 0x10: prim. */
+    u8      sddc_format;                    /* list entry format */
+    u8      sddc_len;                       /* list entry length */
+    u8      sddc_res;
+    u32     sddc_cnt;                       /* entry count */
+} __attribute__((packed)) gdth_defcnt_str;
 
 /* disk statistics */
 typedef struct {
-    ulong32     bid;                            /* SCSI channel */
-    ulong32     first;                          /* first SCSI disk */
-    ulong32     entries;                        /* number of elements */
-    ulong32     count;                          /* (R) number of init. el. */
-    ulong32     mon_time;                       /* time stamp */
+    u32     bid;                            /* SCSI channel */
+    u32     first;                          /* first SCSI disk */
+    u32     entries;                        /* number of elements */
+    u32     count;                          /* (R) number of init. el. */
+    u32     mon_time;                       /* time stamp */
     struct {
-        unchar  tid;                            /* target ID */
-        unchar  lun;                            /* LUN */
-        unchar  res[2];
-        ulong32 blk_size;                       /* block size in bytes */
-        ulong32 rd_count;                       /* bytes read */
-        ulong32 wr_count;                       /* bytes written */
-        ulong32 rd_blk_count;                   /* blocks read */
-        ulong32 wr_blk_count;                   /* blocks written */
-        ulong32 retries;                        /* retries */
-        ulong32 reassigns;                      /* reassigns */
-    } PACKED list[1];
-} PACKED gdth_dskstat_str;
+        u8  tid;                            /* target ID */
+        u8  lun;                            /* LUN */
+        u8  res[2];
+        u32 blk_size;                       /* block size in bytes */
+        u32 rd_count;                       /* bytes read */
+        u32 wr_count;                       /* bytes written */
+        u32 rd_blk_count;                   /* blocks read */
+        u32 wr_blk_count;                   /* blocks written */
+        u32 retries;                        /* retries */
+        u32 reassigns;                      /* reassigns */
+    } __attribute__((packed)) list[1];
+} __attribute__((packed)) gdth_dskstat_str;
 
 /* IO channel header */
 typedef struct {
-    ulong32     version;                        /* version (-1UL: newest) */
-    unchar      list_entries;                   /* list entry count */
-    unchar      first_chan;                     /* first channel number */
-    unchar      last_chan;                      /* last channel number */
-    unchar      chan_count;                     /* (R) channel count */
-    ulong32     list_offset;                    /* offset of list[0] */
-} PACKED gdth_iochan_header;
+    u32     version;                        /* version (-1UL: newest) */
+    u8      list_entries;                   /* list entry count */
+    u8      first_chan;                     /* first channel number */
+    u8      last_chan;                      /* last channel number */
+    u8      chan_count;                     /* (R) channel count */
+    u32     list_offset;                    /* offset of list[0] */
+} __attribute__((packed)) gdth_iochan_header;
 
 /* get IO channel description */
 typedef struct {
     gdth_iochan_header  hdr;
     struct {
-        ulong32         address;                /* channel address */
-        unchar          type;                   /* type (SCSI, FCAL) */
-        unchar          local_no;               /* local number */
-        ushort          features;               /* channel features */
-    } PACKED list[MAXBUS];
-} PACKED gdth_iochan_str;
+        u32         address;                /* channel address */
+        u8          type;                   /* type (SCSI, FCAL) */
+        u8          local_no;               /* local number */
+        u16          features;               /* channel features */
+    } __attribute__((packed)) list[MAXBUS];
+} __attribute__((packed)) gdth_iochan_str;
 
 /* get raw IO channel description */
 typedef struct {
     gdth_iochan_header  hdr;
     struct {
-        unchar      proc_id;                    /* processor id */
-        unchar      proc_defect;                /* defect ? */
-        unchar      reserved[2];
-    } PACKED list[MAXBUS];
-} PACKED gdth_raw_iochan_str;
+        u8      proc_id;                    /* processor id */
+        u8      proc_defect;                /* defect ? */
+        u8      reserved[2];
+    } __attribute__((packed)) list[MAXBUS];
+} __attribute__((packed)) gdth_raw_iochan_str;
 
 /* array drive component */
 typedef struct {
-    ulong32     al_controller;                  /* controller ID */
-    unchar      al_cache_drive;                 /* cache drive number */
-    unchar      al_status;                      /* cache drive state */
-    unchar      al_res[2];     
-} PACKED gdth_arraycomp_str;
+    u32     al_controller;                  /* controller ID */
+    u8      al_cache_drive;                 /* cache drive number */
+    u8      al_status;                      /* cache drive state */
+    u8      al_res[2];     
+} __attribute__((packed)) gdth_arraycomp_str;
 
 /* array drive information */
 typedef struct {
-    unchar      ai_type;                        /* array type (RAID0,4,5) */
-    unchar      ai_cache_drive_cnt;             /* active cachedrives */
-    unchar      ai_state;                       /* array drive state */
-    unchar      ai_master_cd;                   /* master cachedrive */
-    ulong32     ai_master_controller;           /* ID of master controller */
-    ulong32     ai_size;                        /* user capacity [sectors] */
-    ulong32     ai_striping_size;               /* striping size [sectors] */
-    ulong32     ai_secsize;                     /* sector size [bytes] */
-    ulong32     ai_err_info;                    /* failed cache drive */
-    unchar      ai_name[8];                     /* name of the array drive */
-    unchar      ai_controller_cnt;              /* number of controllers */
-    unchar      ai_removable;                   /* flag: removable */
-    unchar      ai_write_protected;             /* flag: write protected */
-    unchar      ai_devtype;                     /* type: always direct access */
+    u8      ai_type;                        /* array type (RAID0,4,5) */
+    u8      ai_cache_drive_cnt;             /* active cachedrives */
+    u8      ai_state;                       /* array drive state */
+    u8      ai_master_cd;                   /* master cachedrive */
+    u32     ai_master_controller;           /* ID of master controller */
+    u32     ai_size;                        /* user capacity [sectors] */
+    u32     ai_striping_size;               /* striping size [sectors] */
+    u32     ai_secsize;                     /* sector size [bytes] */
+    u32     ai_err_info;                    /* failed cache drive */
+    u8      ai_name[8];                     /* name of the array drive */
+    u8      ai_controller_cnt;              /* number of controllers */
+    u8      ai_removable;                   /* flag: removable */
+    u8      ai_write_protected;             /* flag: write protected */
+    u8      ai_devtype;                     /* type: always direct access */
     gdth_arraycomp_str  ai_drives[35];          /* drive components: */
-    unchar      ai_drive_entries;               /* number of drive components */
-    unchar      ai_protected;                   /* protection flag */
-    unchar      ai_verify_state;                /* state of a parity verify */
-    unchar      ai_ext_state;                   /* extended array drive state */
-    unchar      ai_expand_state;                /* array expand state (>=2.18)*/
-    unchar      ai_reserved[3];
-} PACKED gdth_arrayinf_str;
+    u8      ai_drive_entries;               /* number of drive components */
+    u8      ai_protected;                   /* protection flag */
+    u8      ai_verify_state;                /* state of a parity verify */
+    u8      ai_ext_state;                   /* extended array drive state */
+    u8      ai_expand_state;                /* array expand state (>=2.18)*/
+    u8      ai_reserved[3];
+} __attribute__((packed)) gdth_arrayinf_str;
 
 /* get array drive list */
 typedef struct {
-    ulong32     controller_no;                  /* controller no. */
-    unchar      cd_handle;                      /* master cachedrive */
-    unchar      is_arrayd;                      /* Flag: is array drive? */
-    unchar      is_master;                      /* Flag: is array master? */
-    unchar      is_parity;                      /* Flag: is parity drive? */
-    unchar      is_hotfix;                      /* Flag: is hotfix drive? */
-    unchar      res[3];
-} PACKED gdth_alist_str;
+    u32     controller_no;                  /* controller no. */
+    u8      cd_handle;                      /* master cachedrive */
+    u8      is_arrayd;                      /* Flag: is array drive? */
+    u8      is_master;                      /* Flag: is array master? */
+    u8      is_parity;                      /* Flag: is parity drive? */
+    u8      is_hotfix;                      /* Flag: is hotfix drive? */
+    u8      res[3];
+} __attribute__((packed)) gdth_alist_str;
 
 typedef struct {
-    ulong32     entries_avail;                  /* allocated entries */
-    ulong32     entries_init;                   /* returned entries */
-    ulong32     first_entry;                    /* first entry number */
-    ulong32     list_offset;                    /* offset of following list */
+    u32     entries_avail;                  /* allocated entries */
+    u32     entries_init;                   /* returned entries */
+    u32     first_entry;                    /* first entry number */
+    u32     list_offset;                    /* offset of following list */
     gdth_alist_str list[1];                     /* list */
-} PACKED gdth_arcdl_str;
+} __attribute__((packed)) gdth_arcdl_str;
 
 /* cache info/config IOCTL */
 typedef struct {
-    ulong32     version;                        /* firmware version */
-    ushort      state;                          /* cache state (on/off) */
-    ushort      strategy;                       /* cache strategy */
-    ushort      write_back;                     /* write back state (on/off) */
-    ushort      block_size;                     /* cache block size */
-} PACKED gdth_cpar_str;
+    u32     version;                        /* firmware version */
+    u16      state;                          /* cache state (on/off) */
+    u16      strategy;                       /* cache strategy */
+    u16      write_back;                     /* write back state (on/off) */
+    u16      block_size;                     /* cache block size */
+} __attribute__((packed)) gdth_cpar_str;
 
 typedef struct {
-    ulong32     csize;                          /* cache size */
-    ulong32     read_cnt;                       /* read/write counter */
-    ulong32     write_cnt;
-    ulong32     tr_hits;                        /* hits */
-    ulong32     sec_hits;
-    ulong32     sec_miss;                       /* misses */
-} PACKED gdth_cstat_str;
+    u32     csize;                          /* cache size */
+    u32     read_cnt;                       /* read/write counter */
+    u32     write_cnt;
+    u32     tr_hits;                        /* hits */
+    u32     sec_hits;
+    u32     sec_miss;                       /* misses */
+} __attribute__((packed)) gdth_cstat_str;
 
 typedef struct {
     gdth_cpar_str   cpar;
     gdth_cstat_str  cstat;
-} PACKED gdth_cinfo_str;
+} __attribute__((packed)) gdth_cinfo_str;
 
 /* cache drive info */
 typedef struct {
-    unchar      cd_name[8];                     /* cache drive name */
-    ulong32     cd_devtype;                     /* SCSI devicetype */
-    ulong32     cd_ldcnt;                       /* number of log. drives */
-    ulong32     cd_last_error;                  /* last error */
-    unchar      cd_initialized;                 /* drive is initialized */
-    unchar      cd_removable;                   /* media is removable */
-    unchar      cd_write_protected;             /* write protected */
-    unchar      cd_flags;                       /* Pool Hot Fix? */
-    ulong32     ld_blkcnt;                      /* number of blocks */
-    ulong32     ld_blksize;                     /* blocksize */
-    ulong32     ld_dcnt;                        /* number of disks */
-    ulong32     ld_slave;                       /* log. drive index */
-    ulong32     ld_dtype;                       /* type of logical drive */
-    ulong32     ld_last_error;                  /* last error */
-    unchar      ld_name[8];                     /* log. drive name */
-    unchar      ld_error;                       /* error */
-} PACKED gdth_cdrinfo_str;
+    u8      cd_name[8];                     /* cache drive name */
+    u32     cd_devtype;                     /* SCSI devicetype */
+    u32     cd_ldcnt;                       /* number of log. drives */
+    u32     cd_last_error;                  /* last error */
+    u8      cd_initialized;                 /* drive is initialized */
+    u8      cd_removable;                   /* media is removable */
+    u8      cd_write_protected;             /* write protected */
+    u8      cd_flags;                       /* Pool Hot Fix? */
+    u32     ld_blkcnt;                      /* number of blocks */
+    u32     ld_blksize;                     /* blocksize */
+    u32     ld_dcnt;                        /* number of disks */
+    u32     ld_slave;                       /* log. drive index */
+    u32     ld_dtype;                       /* type of logical drive */
+    u32     ld_last_error;                  /* last error */
+    u8      ld_name[8];                     /* log. drive name */
+    u8      ld_error;                       /* error */
+} __attribute__((packed)) gdth_cdrinfo_str;
 
 /* OEM string */
 typedef struct {
-    ulong32     ctl_version;
-    ulong32     file_major_version;
-    ulong32     file_minor_version;
-    ulong32     buffer_size;
-    ulong32     cpy_count;
-    ulong32     ext_error;
-    ulong32     oem_id;
-    ulong32     board_id;
-} PACKED gdth_oem_str_params;
-
-typedef struct {
-    unchar      product_0_1_name[16];
-    unchar      product_4_5_name[16];
-    unchar      product_cluster_name[16];
-    unchar      product_reserved[16];
-    unchar      scsi_cluster_target_vendor_id[16];
-    unchar      cluster_raid_fw_name[16];
-    unchar      oem_brand_name[16];
-    unchar      oem_raid_type[16];
-    unchar      bios_type[13];
-    unchar      bios_title[50];
-    unchar      oem_company_name[37];
-    ulong32     pci_id_1;
-    ulong32     pci_id_2;
-    unchar      validation_status[80];
-    unchar      reserved_1[4];
-    unchar      scsi_host_drive_inquiry_vendor_id[16];
-    unchar      library_file_template[16];
-    unchar      reserved_2[16];
-    unchar      tool_name_1[32];
-    unchar      tool_name_2[32];
-    unchar      tool_name_3[32];
-    unchar      oem_contact_1[84];
-    unchar      oem_contact_2[84];
-    unchar      oem_contact_3[84];
-} PACKED gdth_oem_str;
+    u32     ctl_version;
+    u32     file_major_version;
+    u32     file_minor_version;
+    u32     buffer_size;
+    u32     cpy_count;
+    u32     ext_error;
+    u32     oem_id;
+    u32     board_id;
+} __attribute__((packed)) gdth_oem_str_params;
+
+typedef struct {
+    u8      product_0_1_name[16];
+    u8      product_4_5_name[16];
+    u8      product_cluster_name[16];
+    u8      product_reserved[16];
+    u8      scsi_cluster_target_vendor_id[16];
+    u8      cluster_raid_fw_name[16];
+    u8      oem_brand_name[16];
+    u8      oem_raid_type[16];
+    u8      bios_type[13];
+    u8      bios_title[50];
+    u8      oem_company_name[37];
+    u32     pci_id_1;
+    u32     pci_id_2;
+    u8      validation_status[80];
+    u8      reserved_1[4];
+    u8      scsi_host_drive_inquiry_vendor_id[16];
+    u8      library_file_template[16];
+    u8      reserved_2[16];
+    u8      tool_name_1[32];
+    u8      tool_name_2[32];
+    u8      tool_name_3[32];
+    u8      oem_contact_1[84];
+    u8      oem_contact_2[84];
+    u8      oem_contact_3[84];
+} __attribute__((packed)) gdth_oem_str;
 
 typedef struct {
     gdth_oem_str_params params;
     gdth_oem_str        text;
-} PACKED gdth_oem_str_ioctl;
+} __attribute__((packed)) gdth_oem_str_ioctl;
 
 /* board features */
 typedef struct {
-    unchar      chaining;                       /* Chaining supported */
-    unchar      striping;                       /* Striping (RAID-0) supp. */
-    unchar      mirroring;                      /* Mirroring (RAID-1) supp. */
-    unchar      raid;                           /* RAID-4/5/10 supported */
-} PACKED gdth_bfeat_str;
+    u8      chaining;                       /* Chaining supported */
+    u8      striping;                       /* Striping (RAID-0) supp. */
+    u8      mirroring;                      /* Mirroring (RAID-1) supp. */
+    u8      raid;                           /* RAID-4/5/10 supported */
+} __attribute__((packed)) gdth_bfeat_str;
 
 /* board info IOCTL */
 typedef struct {
-    ulong32     ser_no;                         /* serial no. */
-    unchar      oem_id[2];                      /* OEM ID */
-    ushort      ep_flags;                       /* eprom flags */
-    ulong32     proc_id;                        /* processor ID */
-    ulong32     memsize;                        /* memory size (bytes) */
-    unchar      mem_banks;                      /* memory banks */
-    unchar      chan_type;                      /* channel type */
-    unchar      chan_count;                     /* channel count */
-    unchar      rdongle_pres;                   /* dongle present? */
-    ulong32     epr_fw_ver;                     /* (eprom) firmware version */
-    ulong32     upd_fw_ver;                     /* (update) firmware version */
-    ulong32     upd_revision;                   /* update revision */
+    u32     ser_no;                         /* serial no. */
+    u8      oem_id[2];                      /* OEM ID */
+    u16      ep_flags;                       /* eprom flags */
+    u32     proc_id;                        /* processor ID */
+    u32     memsize;                        /* memory size (bytes) */
+    u8      mem_banks;                      /* memory banks */
+    u8      chan_type;                      /* channel type */
+    u8      chan_count;                     /* channel count */
+    u8      rdongle_pres;                   /* dongle present? */
+    u32     epr_fw_ver;                     /* (eprom) firmware version */
+    u32     upd_fw_ver;                     /* (update) firmware version */
+    u32     upd_revision;                   /* update revision */
     char        type_string[16];                /* controller name */
     char        raid_string[16];                /* RAID firmware name */
-    unchar      update_pres;                    /* update present? */
-    unchar      xor_pres;                       /* XOR engine present? */
-    unchar      prom_type;                      /* ROM type (eprom/flash) */
-    unchar      prom_count;                     /* number of ROM devices */
-    ulong32     dup_pres;                       /* duplexing module present? */
-    ulong32     chan_pres;                      /* number of expansion chn. */
-    ulong32     mem_pres;                       /* memory expansion inst. ? */
-    unchar      ft_bus_system;                  /* fault bus supported? */
-    unchar      subtype_valid;                  /* board_subtype valid? */
-    unchar      board_subtype;                  /* subtype/hardware level */
-    unchar      ramparity_pres;                 /* RAM parity check hardware? */
-} PACKED gdth_binfo_str; 
+    u8      update_pres;                    /* update present? */
+    u8      xor_pres;                       /* XOR engine present? */
+    u8      prom_type;                      /* ROM type (eprom/flash) */
+    u8      prom_count;                     /* number of ROM devices */
+    u32     dup_pres;                       /* duplexing module present? */
+    u32     chan_pres;                      /* number of expansion chn. */
+    u32     mem_pres;                       /* memory expansion inst. ? */
+    u8      ft_bus_system;                  /* fault bus supported? */
+    u8      subtype_valid;                  /* board_subtype valid? */
+    u8      board_subtype;                  /* subtype/hardware level */
+    u8      ramparity_pres;                 /* RAM parity check hardware? */
+} __attribute__((packed)) gdth_binfo_str; 
 
 /* get host drive info */
 typedef struct {
     char        name[8];                        /* host drive name */
-    ulong32     size;                           /* size (sectors) */
-    unchar      host_drive;                     /* host drive number */
-    unchar      log_drive;                      /* log. drive (master) */
-    unchar      reserved;
-    unchar      rw_attribs;                     /* r/w attribs */
-    ulong32     start_sec;                      /* start sector */
-} PACKED gdth_hentry_str;
-
-typedef struct {
-    ulong32     entries;                        /* entry count */
-    ulong32     offset;                         /* offset of entries */
-    unchar      secs_p_head;                    /* sectors/head */
-    unchar      heads_p_cyl;                    /* heads/cylinder */
-    unchar      reserved;
-    unchar      clust_drvtype;                  /* cluster drive type */
-    ulong32     location;                       /* controller number */
+    u32     size;                           /* size (sectors) */
+    u8      host_drive;                     /* host drive number */
+    u8      log_drive;                      /* log. drive (master) */
+    u8      reserved;
+    u8      rw_attribs;                     /* r/w attribs */
+    u32     start_sec;                      /* start sector */
+} __attribute__((packed)) gdth_hentry_str;
+
+typedef struct {
+    u32     entries;                        /* entry count */
+    u32     offset;                         /* offset of entries */
+    u8      secs_p_head;                    /* sectors/head */
+    u8      heads_p_cyl;                    /* heads/cylinder */
+    u8      reserved;
+    u8      clust_drvtype;                  /* cluster drive type */
+    u32     location;                       /* controller number */
     gdth_hentry_str entry[MAX_HDRIVES];         /* entries */
-} PACKED gdth_hget_str;    
+} __attribute__((packed)) gdth_hget_str;    
 
 
 /* DPRAM structures */
 
 /* interface area ISA/PCI */
 typedef struct {
-    unchar              S_Cmd_Indx;             /* special command */
-    unchar volatile     S_Status;               /* status special command */
-    ushort              reserved1;
-    ulong32             S_Info[4];              /* add. info special command */
-    unchar volatile     Sema0;                  /* command semaphore */
-    unchar              reserved2[3];
-    unchar              Cmd_Index;              /* command number */
-    unchar              reserved3[3];
-    ushort volatile     Status;                 /* command status */
-    ushort              Service;                /* service(for async.events) */
-    ulong32             Info[2];                /* additional info */
+    u8              S_Cmd_Indx;             /* special command */
+    u8 volatile     S_Status;               /* status special command */
+    u16              reserved1;
+    u32             S_Info[4];              /* add. info special command */
+    u8 volatile     Sema0;                  /* command semaphore */
+    u8              reserved2[3];
+    u8              Cmd_Index;              /* command number */
+    u8              reserved3[3];
+    u16 volatile     Status;                 /* command status */
+    u16              Service;                /* service(for async.events) */
+    u32             Info[2];                /* additional info */
     struct {
-        ushort          offset;                 /* command offs. in the DPRAM*/
-        ushort          serv_id;                /* service */
-    } PACKED comm_queue[MAXOFFSETS];            /* command queue */
-    ulong32             bios_reserved[2];
-    unchar              gdt_dpr_cmd[1];         /* commands */
-} PACKED gdt_dpr_if;
+        u16          offset;                 /* command offs. in the DPRAM*/
+        u16          serv_id;                /* service */
+    } __attribute__((packed)) comm_queue[MAXOFFSETS];            /* command queue */
+    u32             bios_reserved[2];
+    u8              gdt_dpr_cmd[1];         /* commands */
+} __attribute__((packed)) gdt_dpr_if;
 
 /* SRAM structure PCI controllers */
 typedef struct {
-    ulong32     magic;                          /* controller ID from BIOS */
-    ushort      need_deinit;                    /* switch betw. BIOS/driver */
-    unchar      switch_support;                 /* see need_deinit */
-    unchar      padding[9];
-    unchar      os_used[16];                    /* OS code per service */
-    unchar      unused[28];
-    unchar      fw_magic;                       /* contr. ID from firmware */
-} PACKED gdt_pci_sram;
+    u32     magic;                          /* controller ID from BIOS */
+    u16      need_deinit;                    /* switch betw. BIOS/driver */
+    u8      switch_support;                 /* see need_deinit */
+    u8      padding[9];
+    u8      os_used[16];                    /* OS code per service */
+    u8      unused[28];
+    u8      fw_magic;                       /* contr. ID from firmware */
+} __attribute__((packed)) gdt_pci_sram;
 
 /* SRAM structure EISA controllers (but NOT GDT3000/3020) */
 typedef struct {
-    unchar      os_used[16];                    /* OS code per service */
-    ushort      need_deinit;                    /* switch betw. BIOS/driver */
-    unchar      switch_support;                 /* see need_deinit */
-    unchar      padding;
-} PACKED gdt_eisa_sram;
+    u8      os_used[16];                    /* OS code per service */
+    u16      need_deinit;                    /* switch betw. BIOS/driver */
+    u8      switch_support;                 /* see need_deinit */
+    u8      padding;
+} __attribute__((packed)) gdt_eisa_sram;
 
 
 /* DPRAM ISA controllers */
 typedef struct {
     union {
         struct {
-            unchar      bios_used[0x3c00-32];   /* 15KB - 32Bytes BIOS */
-            ulong32     magic;                  /* controller (EISA) ID */
-            ushort      need_deinit;            /* switch betw. BIOS/driver */
-            unchar      switch_support;         /* see need_deinit */
-            unchar      padding[9];
-            unchar      os_used[16];            /* OS code per service */
-        } PACKED dp_sram;
-        unchar          bios_area[0x4000];      /* 16KB reserved for BIOS */
+            u8      bios_used[0x3c00-32];   /* 15KB - 32Bytes BIOS */
+            u32     magic;                  /* controller (EISA) ID */
+            u16      need_deinit;            /* switch betw. BIOS/driver */
+            u8      switch_support;         /* see need_deinit */
+            u8      padding[9];
+            u8      os_used[16];            /* OS code per service */
+        } __attribute__((packed)) dp_sram;
+        u8          bios_area[0x4000];      /* 16KB reserved for BIOS */
     } bu;
     union {
         gdt_dpr_if      ic;                     /* interface area */
-        unchar          if_area[0x3000];        /* 12KB for interface */
+        u8          if_area[0x3000];        /* 12KB for interface */
     } u;
     struct {
-        unchar          memlock;                /* write protection DPRAM */
-        unchar          event;                  /* release event */
-        unchar          irqen;                  /* board interrupts enable */
-        unchar          irqdel;                 /* acknowledge board int. */
-        unchar volatile Sema1;                  /* status semaphore */
-        unchar          rq;                     /* IRQ/DRQ configuration */
-    } PACKED io;
-} PACKED gdt2_dpram_str;
+        u8          memlock;                /* write protection DPRAM */
+        u8          event;                  /* release event */
+        u8          irqen;                  /* board interrupts enable */
+        u8          irqdel;                 /* acknowledge board int. */
+        u8 volatile Sema1;                  /* status semaphore */
+        u8          rq;                     /* IRQ/DRQ configuration */
+    } __attribute__((packed)) io;
+} __attribute__((packed)) gdt2_dpram_str;
 
 /* DPRAM PCI controllers */
 typedef struct {
     union {
         gdt_dpr_if      ic;                     /* interface area */
-        unchar          if_area[0xff0-sizeof(gdt_pci_sram)];
+        u8          if_area[0xff0-sizeof(gdt_pci_sram)];
     } u;
     gdt_pci_sram        gdt6sr;                 /* SRAM structure */
     struct {
-        unchar          unused0[1];
-        unchar volatile Sema1;                  /* command semaphore */
-        unchar          unused1[3];
-        unchar          irqen;                  /* board interrupts enable */
-        unchar          unused2[2];
-        unchar          event;                  /* release event */
-        unchar          unused3[3];
-        unchar          irqdel;                 /* acknowledge board int. */
-        unchar          unused4[3];
-    } PACKED io;
-} PACKED gdt6_dpram_str;
+        u8          unused0[1];
+        u8 volatile Sema1;                  /* command semaphore */
+        u8          unused1[3];
+        u8          irqen;                  /* board interrupts enable */
+        u8          unused2[2];
+        u8          event;                  /* release event */
+        u8          unused3[3];
+        u8          irqdel;                 /* acknowledge board int. */
+        u8          unused4[3];
+    } __attribute__((packed)) io;
+} __attribute__((packed)) gdt6_dpram_str;
 
 /* PLX register structure (new PCI controllers) */
 typedef struct {
-    unchar              cfg_reg;        /* DPRAM cfg.(2:below 1MB,0:anywhere)*/
-    unchar              unused1[0x3f];
-    unchar volatile     sema0_reg;              /* command semaphore */
-    unchar volatile     sema1_reg;              /* status semaphore */
-    unchar              unused2[2];
-    ushort volatile     status;                 /* command status */
-    ushort              service;                /* service */
-    ulong32             info[2];                /* additional info */
-    unchar              unused3[0x10];
-    unchar              ldoor_reg;              /* PCI to local doorbell */
-    unchar              unused4[3];
-    unchar volatile     edoor_reg;              /* local to PCI doorbell */
-    unchar              unused5[3];
-    unchar              control0;               /* control0 register(unused) */
-    unchar              control1;               /* board interrupts enable */
-    unchar              unused6[0x16];
-} PACKED gdt6c_plx_regs;
+    u8              cfg_reg;        /* DPRAM cfg.(2:below 1MB,0:anywhere)*/
+    u8              unused1[0x3f];
+    u8 volatile     sema0_reg;              /* command semaphore */
+    u8 volatile     sema1_reg;              /* status semaphore */
+    u8              unused2[2];
+    u16 volatile     status;                 /* command status */
+    u16              service;                /* service */
+    u32             info[2];                /* additional info */
+    u8              unused3[0x10];
+    u8              ldoor_reg;              /* PCI to local doorbell */
+    u8              unused4[3];
+    u8 volatile     edoor_reg;              /* local to PCI doorbell */
+    u8              unused5[3];
+    u8              control0;               /* control0 register(unused) */
+    u8              control1;               /* board interrupts enable */
+    u8              unused6[0x16];
+} __attribute__((packed)) gdt6c_plx_regs;
 
 /* DPRAM new PCI controllers */
 typedef struct {
     union {
         gdt_dpr_if      ic;                     /* interface area */
-        unchar          if_area[0x4000-sizeof(gdt_pci_sram)];
+        u8          if_area[0x4000-sizeof(gdt_pci_sram)];
     } u;
     gdt_pci_sram        gdt6sr;                 /* SRAM structure */
-} PACKED gdt6c_dpram_str;
+} __attribute__((packed)) gdt6c_dpram_str;
 
 /* i960 register structure (PCI MPR controllers) */
 typedef struct {
-    unchar              unused1[16];
-    unchar volatile     sema0_reg;              /* command semaphore */
-    unchar              unused2;
-    unchar volatile     sema1_reg;              /* status semaphore */
-    unchar              unused3;
-    ushort volatile     status;                 /* command status */
-    ushort              service;                /* service */
-    ulong32             info[2];                /* additional info */
-    unchar              ldoor_reg;              /* PCI to local doorbell */
-    unchar              unused4[11];
-    unchar volatile     edoor_reg;              /* local to PCI doorbell */
-    unchar              unused5[7];
-    unchar              edoor_en_reg;           /* board interrupts enable */
-    unchar              unused6[27];
-    ulong32             unused7[939];         
-    ulong32             severity;       
+    u8              unused1[16];
+    u8 volatile     sema0_reg;              /* command semaphore */
+    u8              unused2;
+    u8 volatile     sema1_reg;              /* status semaphore */
+    u8              unused3;
+    u16 volatile     status;                 /* command status */
+    u16              service;                /* service */
+    u32             info[2];                /* additional info */
+    u8              ldoor_reg;              /* PCI to local doorbell */
+    u8              unused4[11];
+    u8 volatile     edoor_reg;              /* local to PCI doorbell */
+    u8              unused5[7];
+    u8              edoor_en_reg;           /* board interrupts enable */
+    u8              unused6[27];
+    u32             unused7[939];         
+    u32             severity;       
     char                evt_str[256];           /* event string */
-} PACKED gdt6m_i960_regs;
+} __attribute__((packed)) gdt6m_i960_regs;
 
 /* DPRAM PCI MPR controllers */
 typedef struct {
     gdt6m_i960_regs     i960r;                  /* 4KB i960 registers */
     union {
         gdt_dpr_if      ic;                     /* interface area */
-        unchar          if_area[0x3000-sizeof(gdt_pci_sram)];
+        u8          if_area[0x3000-sizeof(gdt_pci_sram)];
     } u;
     gdt_pci_sram        gdt6sr;                 /* SRAM structure */
-} PACKED gdt6m_dpram_str;
+} __attribute__((packed)) gdt6m_dpram_str;
 
 
 /* PCI resources */
 typedef struct {
     struct pci_dev      *pdev;
-    ulong               dpmem;                  /* DPRAM address */
-    ulong               io;                     /* IO address */
+    unsigned long               dpmem;                  /* DPRAM address */
+    unsigned long               io;                     /* IO address */
 } gdth_pci_str;
 
 
@@ -846,93 +846,93 @@ typedef struct {
 typedef struct {
     struct Scsi_Host    *shost;
     struct list_head    list;
-    ushort             hanum;
-    ushort              oem_id;                 /* OEM */
-    ushort              type;                   /* controller class */
-    ulong32             stype;                  /* subtype (PCI: device ID) */
-    ushort              fw_vers;                /* firmware version */
-    ushort              cache_feat;             /* feat. cache serv. (s/g,..)*/
-    ushort              raw_feat;               /* feat. raw service (s/g,..)*/
-    ushort              screen_feat;            /* feat. raw service (s/g,..)*/
-    ushort              bmic;                   /* BMIC address (EISA) */
+    u16        hanum;
+    u16              oem_id;                 /* OEM */
+    u16              type;                   /* controller class */
+    u32             stype;                  /* subtype (PCI: device ID) */
+    u16              fw_vers;                /* firmware version */
+    u16              cache_feat;             /* feat. cache serv. (s/g,..)*/
+    u16              raw_feat;               /* feat. raw service (s/g,..)*/
+    u16              screen_feat;            /* feat. raw service (s/g,..)*/
+    u16              bmic;                   /* BMIC address (EISA) */
     void __iomem        *brd;                   /* DPRAM address */
-    ulong32             brd_phys;               /* slot number/BIOS address */
+    u32             brd_phys;               /* slot number/BIOS address */
     gdt6c_plx_regs      *plx;                   /* PLX regs (new PCI contr.) */
     gdth_cmd_str        cmdext;
     gdth_cmd_str        *pccb;                  /* address command structure */
-    ulong32             ccb_phys;               /* phys. address */
+    u32             ccb_phys;               /* phys. address */
 #ifdef INT_COAL
     gdth_coal_status    *coal_stat;             /* buffer for coalescing int.*/
-    ulong64             coal_stat_phys;         /* phys. address */
+    u64             coal_stat_phys;         /* phys. address */
 #endif
     char                *pscratch;              /* scratch (DMA) buffer */
-    ulong64             scratch_phys;           /* phys. address */
-    unchar              scratch_busy;           /* in use? */
-    unchar              dma64_support;          /* 64-bit DMA supported? */
+    u64             scratch_phys;           /* phys. address */
+    u8              scratch_busy;           /* in use? */
+    u8              dma64_support;          /* 64-bit DMA supported? */
     gdth_msg_str        *pmsg;                  /* message buffer */
-    ulong64             msg_phys;               /* phys. address */
-    unchar              scan_mode;              /* current scan mode */
-    unchar              irq;                    /* IRQ */
-    unchar              drq;                    /* DRQ (ISA controllers) */
-    ushort              status;                 /* command status */
-    ushort              service;                /* service/firmware ver./.. */
-    ulong32             info;
-    ulong32             info2;                  /* additional info */
+    u64             msg_phys;               /* phys. address */
+    u8              scan_mode;              /* current scan mode */
+    u8              irq;                    /* IRQ */
+    u8              drq;                    /* DRQ (ISA controllers) */
+    u16              status;                 /* command status */
+    u16              service;                /* service/firmware ver./.. */
+    u32             info;
+    u32             info2;                  /* additional info */
     Scsi_Cmnd           *req_first;             /* top of request queue */
     struct {
-        unchar          present;                /* Flag: host drive present? */
-        unchar          is_logdrv;              /* Flag: log. drive (master)? */
-        unchar          is_arraydrv;            /* Flag: array drive? */
-        unchar          is_master;              /* Flag: array drive master? */
-        unchar          is_parity;              /* Flag: parity drive? */
-        unchar          is_hotfix;              /* Flag: hotfix drive? */
-        unchar          master_no;              /* number of master drive */
-        unchar          lock;                   /* drive locked? (hot plug) */
-        unchar          heads;                  /* mapping */
-        unchar          secs;
-        ushort          devtype;                /* further information */
-        ulong64         size;                   /* capacity */
-        unchar          ldr_no;                 /* log. drive no. */
-        unchar          rw_attribs;             /* r/w attributes */
-        unchar          cluster_type;           /* cluster properties */
-        unchar          media_changed;          /* Flag:MOUNT/UNMOUNT occured */
-        ulong32         start_sec;              /* start sector */
+        u8          present;                /* Flag: host drive present? */
+        u8          is_logdrv;              /* Flag: log. drive (master)? */
+        u8          is_arraydrv;            /* Flag: array drive? */
+        u8          is_master;              /* Flag: array drive master? */
+        u8          is_parity;              /* Flag: parity drive? */
+        u8          is_hotfix;              /* Flag: hotfix drive? */
+        u8          master_no;              /* number of master drive */
+        u8          lock;                   /* drive locked? (hot plug) */
+        u8          heads;                  /* mapping */
+        u8          secs;
+        u16          devtype;                /* further information */
+        u64         size;                   /* capacity */
+        u8          ldr_no;                 /* log. drive no. */
+        u8          rw_attribs;             /* r/w attributes */
+        u8          cluster_type;           /* cluster properties */
+        u8          media_changed;          /* Flag:MOUNT/UNMOUNT occured */
+        u32         start_sec;              /* start sector */
     } hdr[MAX_LDRIVES];                         /* host drives */
     struct {
-        unchar          lock;                   /* channel locked? (hot plug) */
-        unchar          pdev_cnt;               /* physical device count */
-        unchar          local_no;               /* local channel number */
-        unchar          io_cnt[MAXID];          /* current IO count */
-        ulong32         address;                /* channel address */
-        ulong32         id_list[MAXID];         /* IDs of the phys. devices */
+        u8          lock;                   /* channel locked? (hot plug) */
+        u8          pdev_cnt;               /* physical device count */
+        u8          local_no;               /* local channel number */
+        u8          io_cnt[MAXID];          /* current IO count */
+        u32         address;                /* channel address */
+        u32         id_list[MAXID];         /* IDs of the phys. devices */
     } raw[MAXBUS];                              /* SCSI channels */
     struct {
         Scsi_Cmnd       *cmnd;                  /* pending request */
-        ushort          service;                /* service */
+        u16          service;                /* service */
     } cmd_tab[GDTH_MAXCMDS];                    /* table of pend. requests */
     struct gdth_cmndinfo {                      /* per-command private info */
         int index;
         int internal_command;                   /* don't call scsi_done */
         gdth_cmd_str *internal_cmd_str;         /* crier for internal messages*/
         dma_addr_t sense_paddr;                 /* sense dma-addr */
-        unchar priority;
+        u8 priority;
        int timeout_count;                      /* # of timeout calls */
         volatile int wait_for_completion;
-        ushort status;
-        ulong32 info;
+        u16 status;
+        u32 info;
         enum dma_data_direction dma_dir;
         int phase;                              /* ???? */
         int OpCode;
     } cmndinfo[GDTH_MAXCMDS];                   /* index==0 is free */
-    unchar              bus_cnt;                /* SCSI bus count */
-    unchar              tid_cnt;                /* Target ID count */
-    unchar              bus_id[MAXBUS];         /* IOP IDs */
-    unchar              virt_bus;               /* number of virtual bus */
-    unchar              more_proc;              /* more /proc info supported */
-    ushort              cmd_cnt;                /* command count in DPRAM */
-    ushort              cmd_len;                /* length of actual command */
-    ushort              cmd_offs_dpmem;         /* actual offset in DPRAM */
-    ushort              ic_all_size;            /* sizeof DPRAM interf. area */
+    u8              bus_cnt;                /* SCSI bus count */
+    u8              tid_cnt;                /* Target ID count */
+    u8              bus_id[MAXBUS];         /* IOP IDs */
+    u8              virt_bus;               /* number of virtual bus */
+    u8              more_proc;              /* more /proc info supported */
+    u16              cmd_cnt;                /* command count in DPRAM */
+    u16              cmd_len;                /* length of actual command */
+    u16              cmd_offs_dpmem;         /* actual offset in DPRAM */
+    u16              ic_all_size;            /* sizeof DPRAM interf. area */
     gdth_cpar_str       cpar;                   /* controller cache par. */
     gdth_bfeat_str      bfeat;                  /* controller features */
     gdth_binfo_str      binfo;                  /* controller info */
@@ -941,7 +941,7 @@ typedef struct {
     struct pci_dev      *pdev;
     char                oem_name[8];
 #ifdef GDTH_DMA_STATISTICS
-    ulong               dma32_cnt, dma64_cnt;   /* statistics: DMA buffer */
+    unsigned long               dma32_cnt, dma64_cnt;   /* statistics: DMA buffer */
 #endif
     struct scsi_device         *sdev;
 } gdth_ha_str;
@@ -953,65 +953,65 @@ static inline struct gdth_cmndinfo *gdth_cmnd_priv(struct scsi_cmnd* cmd)
 
 /* INQUIRY data format */
 typedef struct {
-    unchar      type_qual;
-    unchar      modif_rmb;
-    unchar      version;
-    unchar      resp_aenc;
-    unchar      add_length;
-    unchar      reserved1;
-    unchar      reserved2;
-    unchar      misc;
-    unchar      vendor[8];
-    unchar      product[16];
-    unchar      revision[4];
-} PACKED gdth_inq_data;
+    u8      type_qual;
+    u8      modif_rmb;
+    u8      version;
+    u8      resp_aenc;
+    u8      add_length;
+    u8      reserved1;
+    u8      reserved2;
+    u8      misc;
+    u8      vendor[8];
+    u8      product[16];
+    u8      revision[4];
+} __attribute__((packed)) gdth_inq_data;
 
 /* READ_CAPACITY data format */
 typedef struct {
-    ulong32     last_block_no;
-    ulong32     block_length;
-} PACKED gdth_rdcap_data;
+    u32     last_block_no;
+    u32     block_length;
+} __attribute__((packed)) gdth_rdcap_data;
 
 /* READ_CAPACITY (16) data format */
 typedef struct {
-    ulong64     last_block_no;
-    ulong32     block_length;
-} PACKED gdth_rdcap16_data;
+    u64     last_block_no;
+    u32     block_length;
+} __attribute__((packed)) gdth_rdcap16_data;
 
 /* REQUEST_SENSE data format */
 typedef struct {
-    unchar      errorcode;
-    unchar      segno;
-    unchar      key;
-    ulong32     info;
-    unchar      add_length;
-    ulong32     cmd_info;
-    unchar      adsc;
-    unchar      adsq;
-    unchar      fruc;
-    unchar      key_spec[3];
-} PACKED gdth_sense_data;
+    u8      errorcode;
+    u8      segno;
+    u8      key;
+    u32     info;
+    u8      add_length;
+    u32     cmd_info;
+    u8      adsc;
+    u8      adsq;
+    u8      fruc;
+    u8      key_spec[3];
+} __attribute__((packed)) gdth_sense_data;
 
 /* MODE_SENSE data format */
 typedef struct {
     struct {
-        unchar  data_length;
-        unchar  med_type;
-        unchar  dev_par;
-        unchar  bd_length;
-    } PACKED hd;
+        u8  data_length;
+        u8  med_type;
+        u8  dev_par;
+        u8  bd_length;
+    } __attribute__((packed)) hd;
     struct {
-        unchar  dens_code;
-        unchar  block_count[3];
-        unchar  reserved;
-        unchar  block_length[3];
-    } PACKED bd;
-} PACKED gdth_modep_data;
+        u8  dens_code;
+        u8  block_count[3];
+        u8  reserved;
+        u8  block_length[3];
+    } __attribute__((packed)) bd;
+} __attribute__((packed)) gdth_modep_data;
 
 /* stack frame */
 typedef struct {
-    ulong       b[10];                          /* 32/64 bit compiler ! */
-} PACKED gdth_stackframe;
+    unsigned long       b[10];                          /* 32/64 bit compiler ! */
+} __attribute__((packed)) gdth_stackframe;
 
 
 /* function prototyping */
index 783fae737f177e5082cb19be73da87e556d2e0b5..b004c6165887f11647244aa755308ce6ee49e3e3 100644 (file)
 #define MAX_HDRIVES     MAX_LDRIVES             /* max. host drive count */
 #endif
 
-/* typedefs */
-#ifdef __KERNEL__
-typedef u32     ulong32;
-typedef u64     ulong64;
-#endif
-
-#define PACKED  __attribute__((packed))
-
 /* scatter/gather element */
 typedef struct {
-    ulong32     sg_ptr;                         /* address */
-    ulong32     sg_len;                         /* length */
-} PACKED gdth_sg_str;
+    u32     sg_ptr;                         /* address */
+    u32     sg_len;                         /* length */
+} __attribute__((packed)) gdth_sg_str;
 
 /* scatter/gather element - 64bit addresses */
 typedef struct {
-    ulong64     sg_ptr;                         /* address */
-    ulong32     sg_len;                         /* length */
-} PACKED gdth_sg64_str;
+    u64     sg_ptr;                         /* address */
+    u32     sg_len;                         /* length */
+} __attribute__((packed)) gdth_sg64_str;
 
 /* command structure */
 typedef struct {
-    ulong32     BoardNode;                      /* board node (always 0) */
-    ulong32     CommandIndex;                   /* command number */
-    ushort      OpCode;                         /* the command (READ,..) */
+    u32     BoardNode;                      /* board node (always 0) */
+    u32     CommandIndex;                   /* command number */
+    u16      OpCode;                         /* the command (READ,..) */
     union {
         struct {
-            ushort      DeviceNo;               /* number of cache drive */
-            ulong32     BlockNo;                /* block number */
-            ulong32     BlockCnt;               /* block count */
-            ulong32     DestAddr;               /* dest. addr. (if s/g: -1) */
-            ulong32     sg_canz;                /* s/g element count */
+            u16      DeviceNo;               /* number of cache drive */
+            u32     BlockNo;                /* block number */
+            u32     BlockCnt;               /* block count */
+            u32     DestAddr;               /* dest. addr. (if s/g: -1) */
+            u32     sg_canz;                /* s/g element count */
             gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
-        } PACKED cache;                         /* cache service cmd. str. */
+        } __attribute__((packed)) cache;                         /* cache service cmd. str. */
         struct {
-            ushort      DeviceNo;               /* number of cache drive */
-            ulong64     BlockNo;                /* block number */
-            ulong32     BlockCnt;               /* block count */
-            ulong64     DestAddr;               /* dest. addr. (if s/g: -1) */
-            ulong32     sg_canz;                /* s/g element count */
+            u16      DeviceNo;               /* number of cache drive */
+            u64     BlockNo;                /* block number */
+            u32     BlockCnt;               /* block count */
+            u64     DestAddr;               /* dest. addr. (if s/g: -1) */
+            u32     sg_canz;                /* s/g element count */
             gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
-        } PACKED cache64;                       /* cache service cmd. str. */
+        } __attribute__((packed)) cache64;                       /* cache service cmd. str. */
         struct {
-            ushort      param_size;             /* size of p_param buffer */
-            ulong32     subfunc;                /* IOCTL function */
-            ulong32     channel;                /* device */
-            ulong64     p_param;                /* buffer */
-        } PACKED ioctl;                         /* IOCTL command structure */
+            u16      param_size;             /* size of p_param buffer */
+            u32     subfunc;                /* IOCTL function */
+            u32     channel;                /* device */
+            u64     p_param;                /* buffer */
+        } __attribute__((packed)) ioctl;                         /* IOCTL command structure */
         struct {
-            ushort      reserved;
+            u16      reserved;
             union {
                 struct {
-                    ulong32  msg_handle;        /* message handle */
-                    ulong64  msg_addr;          /* message buffer address */
-                } PACKED msg;
-                unchar       data[12];          /* buffer for rtc data, ... */
+                    u32  msg_handle;        /* message handle */
+                    u64  msg_addr;          /* message buffer address */
+                } __attribute__((packed)) msg;
+                u8       data[12];          /* buffer for rtc data, ... */
             } su;
-        } PACKED screen;                        /* screen service cmd. str. */
+        } __attribute__((packed)) screen;                        /* screen service cmd. str. */
         struct {
-            ushort      reserved;
-            ulong32     direction;              /* data direction */
-            ulong32     mdisc_time;             /* disc. time (0: no timeout)*/
-            ulong32     mcon_time;              /* connect time(0: no to.) */
-            ulong32     sdata;                  /* dest. addr. (if s/g: -1) */
-            ulong32     sdlen;                  /* data length (bytes) */
-            ulong32     clen;                   /* SCSI cmd. length(6,10,12) */
-            unchar      cmd[12];                /* SCSI command */
-            unchar      target;                 /* target ID */
-            unchar      lun;                    /* LUN */
-            unchar      bus;                    /* SCSI bus number */
-            unchar      priority;               /* only 0 used */
-            ulong32     sense_len;              /* sense data length */
-            ulong32     sense_data;             /* sense data addr. */
-            ulong32     link_p;                 /* linked cmds (not supp.) */
-            ulong32     sg_ranz;                /* s/g element count */
+            u16      reserved;
+            u32     direction;              /* data direction */
+            u32     mdisc_time;             /* disc. time (0: no timeout)*/
+            u32     mcon_time;              /* connect time(0: no to.) */
+            u32     sdata;                  /* dest. addr. (if s/g: -1) */
+            u32     sdlen;                  /* data length (bytes) */
+            u32     clen;                   /* SCSI cmd. length(6,10,12) */
+            u8      cmd[12];                /* SCSI command */
+            u8      target;                 /* target ID */
+            u8      lun;                    /* LUN */
+            u8      bus;                    /* SCSI bus number */
+            u8      priority;               /* only 0 used */
+            u32     sense_len;              /* sense data length */
+            u32     sense_data;             /* sense data addr. */
+            u32     link_p;                 /* linked cmds (not supp.) */
+            u32     sg_ranz;                /* s/g element count */
             gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
-        } PACKED raw;                           /* raw service cmd. struct. */
+        } __attribute__((packed)) raw;                           /* raw service cmd. struct. */
         struct {
-            ushort      reserved;
-            ulong32     direction;              /* data direction */
-            ulong32     mdisc_time;             /* disc. time (0: no timeout)*/
-            ulong32     mcon_time;              /* connect time(0: no to.) */
-            ulong64     sdata;                  /* dest. addr. (if s/g: -1) */
-            ulong32     sdlen;                  /* data length (bytes) */
-            ulong32     clen;                   /* SCSI cmd. length(6,..,16) */
-            unchar      cmd[16];                /* SCSI command */
-            unchar      target;                 /* target ID */
-            unchar      lun;                    /* LUN */
-            unchar      bus;                    /* SCSI bus number */
-            unchar      priority;               /* only 0 used */
-            ulong32     sense_len;              /* sense data length */
-            ulong64     sense_data;             /* sense data addr. */
-            ulong32     sg_ranz;                /* s/g element count */
+            u16      reserved;
+            u32     direction;              /* data direction */
+            u32     mdisc_time;             /* disc. time (0: no timeout)*/
+            u32     mcon_time;              /* connect time(0: no to.) */
+            u64     sdata;                  /* dest. addr. (if s/g: -1) */
+            u32     sdlen;                  /* data length (bytes) */
+            u32     clen;                   /* SCSI cmd. length(6,..,16) */
+            u8      cmd[16];                /* SCSI command */
+            u8      target;                 /* target ID */
+            u8      lun;                    /* LUN */
+            u8      bus;                    /* SCSI bus number */
+            u8      priority;               /* only 0 used */
+            u32     sense_len;              /* sense data length */
+            u64     sense_data;             /* sense data addr. */
+            u32     sg_ranz;                /* s/g element count */
             gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
-        } PACKED raw64;                         /* raw service cmd. struct. */
+        } __attribute__((packed)) raw64;                         /* raw service cmd. struct. */
     } u;
     /* additional variables */
-    unchar      Service;                        /* controller service */
-    unchar      reserved;
-    ushort      Status;                         /* command result */
-    ulong32     Info;                           /* additional information */
+    u8      Service;                        /* controller service */
+    u8      reserved;
+    u16      Status;                         /* command result */
+    u32     Info;                           /* additional information */
     void        *RequestBuffer;                 /* request buffer */
-} PACKED gdth_cmd_str;
+} __attribute__((packed)) gdth_cmd_str;
 
 /* controller event structure */
 #define ES_ASYNC    1
@@ -142,129 +134,129 @@ typedef struct {
 #define ES_TEST     3
 #define ES_SYNC     4
 typedef struct {
-    ushort                  size;               /* size of structure */
+    u16                  size;               /* size of structure */
     union {
         char                stream[16];
         struct {
-            ushort          ionode;
-            ushort          service;
-            ulong32         index;
-        } PACKED driver;
+            u16          ionode;
+            u16          service;
+            u32         index;
+        } __attribute__((packed)) driver;
         struct {
-            ushort          ionode;
-            ushort          service;
-            ushort          status;
-            ulong32         info;
-            unchar          scsi_coord[3];
-        } PACKED async;
+            u16          ionode;
+            u16          service;
+            u16          status;
+            u32         info;
+            u8          scsi_coord[3];
+        } __attribute__((packed)) async;
         struct {
-            ushort          ionode;
-            ushort          service;
-            ushort          status;
-            ulong32         info;
-            ushort          hostdrive;
-            unchar          scsi_coord[3];
-            unchar          sense_key;
-        } PACKED sync;
+            u16          ionode;
+            u16          service;
+            u16          status;
+            u32         info;
+            u16          hostdrive;
+            u8          scsi_coord[3];
+            u8          sense_key;
+        } __attribute__((packed)) sync;
         struct {
-            ulong32         l1, l2, l3, l4;
-        } PACKED test;
+            u32         l1, l2, l3, l4;
+        } __attribute__((packed)) test;
     } eu;
-    ulong32                 severity;
-    unchar                  event_string[256];          
-} PACKED gdth_evt_data;
+    u32                 severity;
+    u8                  event_string[256];          
+} __attribute__((packed)) gdth_evt_data;
 
 typedef struct {
-    ulong32         first_stamp;
-    ulong32         last_stamp;
-    ushort          same_count;
-    ushort          event_source;
-    ushort          event_idx;
-    unchar          application;
-    unchar          reserved;
+    u32         first_stamp;
+    u32         last_stamp;
+    u16          same_count;
+    u16          event_source;
+    u16          event_idx;
+    u8          application;
+    u8          reserved;
     gdth_evt_data   event_data;
-} PACKED gdth_evt_str;
+} __attribute__((packed)) gdth_evt_str;
 
 
 #ifdef GDTH_IOCTL_PROC
 /* IOCTL structure (write) */
 typedef struct {
-    ulong32                 magic;              /* IOCTL magic */
-    ushort                  ioctl;              /* IOCTL */
-    ushort                  ionode;             /* controller number */
-    ushort                  service;            /* controller service */
-    ushort                  timeout;            /* timeout */
+    u32                 magic;              /* IOCTL magic */
+    u16                  ioctl;              /* IOCTL */
+    u16                  ionode;             /* controller number */
+    u16                  service;            /* controller service */
+    u16                  timeout;            /* timeout */
     union {
         struct {
-            unchar          command[512];       /* controller command */
-            unchar          data[1];            /* add. data */
+            u8          command[512];       /* controller command */
+            u8          data[1];            /* add. data */
         } general;
         struct {
-            unchar          lock;               /* lock/unlock */
-            unchar          drive_cnt;          /* drive count */
-            ushort          drives[MAX_HDRIVES];/* drives */
+            u8          lock;               /* lock/unlock */
+            u8          drive_cnt;          /* drive count */
+            u16          drives[MAX_HDRIVES];/* drives */
         } lockdrv;
         struct {
-            unchar          lock;               /* lock/unlock */
-            unchar          channel;            /* channel */
+            u8          lock;               /* lock/unlock */
+            u8          channel;            /* channel */
         } lockchn;
         struct {
             int             erase;              /* erase event ? */
             int             handle;
-            unchar          evt[EVENT_SIZE];    /* event structure */
+            u8          evt[EVENT_SIZE];    /* event structure */
         } event;
         struct {
-            unchar          bus;                /* SCSI bus */
-            unchar          target;             /* target ID */
-            unchar          lun;                /* LUN */
-            unchar          cmd_len;            /* command length */
-            unchar          cmd[12];            /* SCSI command */
+            u8          bus;                /* SCSI bus */
+            u8          target;             /* target ID */
+            u8          lun;                /* LUN */
+            u8          cmd_len;            /* command length */
+            u8          cmd[12];            /* SCSI command */
         } scsi;
         struct {
-            ushort          hdr_no;             /* host drive number */
-            unchar          flag;               /* old meth./add/remove */
+            u16          hdr_no;             /* host drive number */
+            u8          flag;               /* old meth./add/remove */
         } rescan;
     } iu;
 } gdth_iowr_str;
 
 /* IOCTL structure (read) */
 typedef struct {
-    ulong32                 size;               /* buffer size */
-    ulong32                 status;             /* IOCTL error code */
+    u32                 size;               /* buffer size */
+    u32                 status;             /* IOCTL error code */
     union {
         struct {
-            unchar          data[1];            /* data */
+            u8          data[1];            /* data */
         } general;
         struct {
-            ushort          version;            /* driver version */
+            u16          version;            /* driver version */
         } drvers;
         struct {
-            unchar          type;               /* controller type */
-            ushort          info;               /* slot etc. */
-            ushort          oem_id;             /* OEM ID */
-            ushort          bios_ver;           /* not used */
-            ushort          access;             /* not used */
-            ushort          ext_type;           /* extended type */
-            ushort          device_id;          /* device ID */
-            ushort          sub_device_id;      /* sub device ID */
+            u8          type;               /* controller type */
+            u16          info;               /* slot etc. */
+            u16          oem_id;             /* OEM ID */
+            u16          bios_ver;           /* not used */
+            u16          access;             /* not used */
+            u16          ext_type;           /* extended type */
+            u16          device_id;          /* device ID */
+            u16          sub_device_id;      /* sub device ID */
         } ctrtype;
         struct {
-            unchar          version;            /* OS version */
-            unchar          subversion;         /* OS subversion */
-            ushort          revision;           /* revision */
+            u8          version;            /* OS version */
+            u8          subversion;         /* OS subversion */
+            u16          revision;           /* revision */
         } osvers;
         struct {
-            ushort          count;              /* controller count */
+            u16          count;              /* controller count */
         } ctrcnt;
         struct {
             int             handle;
-            unchar          evt[EVENT_SIZE];    /* event structure */
+            u8          evt[EVENT_SIZE];    /* event structure */
         } event;
         struct {
-            unchar          bus;                /* SCSI bus, 0xff: invalid */
-            unchar          target;             /* target ID */
-            unchar          lun;                /* LUN */
-            unchar          cluster_type;       /* cluster properties */
+            u8          bus;                /* SCSI bus, 0xff: invalid */
+            u8          target;             /* target ID */
+            u8          lun;                /* LUN */
+            u8          cluster_type;       /* cluster properties */
         } hdr_list[MAX_HDRIVES];                /* index is host drive number */
     } iu;
 } gdth_iord_str;
@@ -272,53 +264,53 @@ typedef struct {
 
 /* GDTIOCTL_GENERAL */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    ushort timeout;                             /* timeout */
-    ulong32 info;                               /* error info */ 
-    ushort status;                              /* status */
-    ulong data_len;                             /* data buffer size */
-    ulong sense_len;                            /* sense buffer size */
+    u16 ionode;                              /* controller number */
+    u16 timeout;                             /* timeout */
+    u32 info;                               /* error info */ 
+    u16 status;                              /* status */
+    unsigned long data_len;                             /* data buffer size */
+    unsigned long sense_len;                            /* sense buffer size */
     gdth_cmd_str command;                       /* command */                   
 } gdth_ioctl_general;
 
 /* GDTIOCTL_LOCKDRV */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    unchar lock;                                /* lock/unlock */
-    unchar drive_cnt;                           /* drive count */
-    ushort drives[MAX_HDRIVES];                 /* drives */
+    u16 ionode;                              /* controller number */
+    u8 lock;                                /* lock/unlock */
+    u8 drive_cnt;                           /* drive count */
+    u16 drives[MAX_HDRIVES];                 /* drives */
 } gdth_ioctl_lockdrv;
 
 /* GDTIOCTL_LOCKCHN */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    unchar lock;                                /* lock/unlock */
-    unchar channel;                             /* channel */
+    u16 ionode;                              /* controller number */
+    u8 lock;                                /* lock/unlock */
+    u8 channel;                             /* channel */
 } gdth_ioctl_lockchn;
 
 /* GDTIOCTL_OSVERS */
 typedef struct {
-    unchar version;                             /* OS version */
-    unchar subversion;                          /* OS subversion */
-    ushort revision;                            /* revision */
+    u8 version;                             /* OS version */
+    u8 subversion;                          /* OS subversion */
+    u16 revision;                            /* revision */
 } gdth_ioctl_osvers;
 
 /* GDTIOCTL_CTRTYPE */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    unchar type;                                /* controller type */
-    ushort info;                                /* slot etc. */
-    ushort oem_id;                              /* OEM ID */
-    ushort bios_ver;                            /* not used */
-    ushort access;                              /* not used */
-    ushort ext_type;                            /* extended type */
-    ushort device_id;                           /* device ID */
-    ushort sub_device_id;                       /* sub device ID */
+    u16 ionode;                              /* controller number */
+    u8 type;                                /* controller type */
+    u16 info;                                /* slot etc. */
+    u16 oem_id;                              /* OEM ID */
+    u16 bios_ver;                            /* not used */
+    u16 access;                              /* not used */
+    u16 ext_type;                            /* extended type */
+    u16 device_id;                           /* device ID */
+    u16 sub_device_id;                       /* sub device ID */
 } gdth_ioctl_ctrtype;
 
 /* GDTIOCTL_EVENT */
 typedef struct {
-    ushort ionode;
+    u16 ionode;
     int erase;                                  /* erase event? */
     int handle;                                 /* event handle */
     gdth_evt_str event;
@@ -326,22 +318,22 @@ typedef struct {
 
 /* GDTIOCTL_RESCAN/GDTIOCTL_HDRLIST */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    unchar flag;                                /* add/remove */
-    ushort hdr_no;                              /* drive no. */
+    u16 ionode;                              /* controller number */
+    u8 flag;                                /* add/remove */
+    u16 hdr_no;                              /* drive no. */
     struct {
-        unchar bus;                             /* SCSI bus */
-        unchar target;                          /* target ID */
-        unchar lun;                             /* LUN */
-        unchar cluster_type;                    /* cluster properties */
+        u8 bus;                             /* SCSI bus */
+        u8 target;                          /* target ID */
+        u8 lun;                             /* LUN */
+        u8 cluster_type;                    /* cluster properties */
     } hdr_list[MAX_HDRIVES];                    /* index is host drive number */
 } gdth_ioctl_rescan;
 
 /* GDTIOCTL_RESET_BUS/GDTIOCTL_RESET_DRV */
 typedef struct {
-    ushort ionode;                              /* controller number */
-    ushort number;                              /* bus/host drive number */
-    ushort status;                              /* status */
+    u16 ionode;                              /* controller number */
+    u16 number;                              /* bus/host drive number */
+    u16 status;                              /* status */
 } gdth_ioctl_reset;
 
 #endif
index 1258da34fbc251bf779f85d1a2fdd0a015e51a34..ffb2b21992bae81dc7424b130489141aed80eb8a 100644 (file)
@@ -43,7 +43,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
     int i, found;
     gdth_cmd_str    gdtcmd;
     gdth_cpar_str   *pcpar;
-    ulong64         paddr;
+    u64         paddr;
 
     char            cmnd[MAX_COMMAND_SIZE];
     memset(cmnd, 0xff, 12);
@@ -156,8 +156,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
     off_t begin = 0,pos = 0;
     int id, i, j, k, sec, flag;
     int no_mdrv = 0, drv_no, is_mirr;
-    ulong32 cnt;
-    ulong64 paddr;
+    u32 cnt;
+    u64 paddr;
     int rc = -ENOMEM;
 
     gdth_cmd_str *gdtcmd;
@@ -220,14 +220,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
 
     if (ha->more_proc)
         sprintf(hrec, "%d.%02d.%02d-%c%03X", 
-                (unchar)(ha->binfo.upd_fw_ver>>24),
-                (unchar)(ha->binfo.upd_fw_ver>>16),
-                (unchar)(ha->binfo.upd_fw_ver),
+                (u8)(ha->binfo.upd_fw_ver>>24),
+                (u8)(ha->binfo.upd_fw_ver>>16),
+                (u8)(ha->binfo.upd_fw_ver),
                 ha->bfeat.raid ? 'R':'N',
                 ha->binfo.upd_revision);
     else
-        sprintf(hrec, "%d.%02d", (unchar)(ha->cpar.version>>8),
-                (unchar)(ha->cpar.version));
+        sprintf(hrec, "%d.%02d", (u8)(ha->cpar.version>>8),
+                (u8)(ha->cpar.version));
 
     size = sprintf(buffer+len,
                    " Driver Ver.:  \t%-10s\tFirmware Ver.: \t%s\n",
@@ -281,7 +281,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
             pds->bid = ha->raw[i].local_no;
             pds->first = 0;
             pds->entries = ha->raw[i].pdev_cnt;
-            cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(ulong32)) /
+            cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(u32)) /
                 sizeof(pds->list[0]);
             if (pds->entries > cnt)
                 pds->entries = cnt;
@@ -604,7 +604,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
 
             size = sprintf(buffer+len,
                            " Capacity [MB]:\t%-6d    \tStart Sector:  \t%d\n",
-                           (ulong32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec);
+                           (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec);
             len += size;  pos = begin + len;
             if (pos < offset) {
                 len = 0;
@@ -664,9 +664,9 @@ free_fail:
 }
 
 static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch,
-                              ulong64 *paddr)
+                              u64 *paddr)
 {
-    ulong flags;
+    unsigned long flags;
     char *ret_val;
 
     if (size == 0)
@@ -691,9 +691,9 @@ static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch,
     return ret_val;
 }
 
-static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr)
+static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, u64 paddr)
 {
-    ulong flags;
+    unsigned long flags;
 
     if (buf == ha->pscratch) {
        spin_lock_irqsave(&ha->smp_lock, flags);
@@ -705,16 +705,16 @@ static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr)
 }
 
 #ifdef GDTH_IOCTL_PROC
-static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size)
+static int gdth_ioctl_check_bin(gdth_ha_str *ha, u16 size)
 {
-    ulong flags;
+    unsigned long flags;
     int ret_val;
 
     spin_lock_irqsave(&ha->smp_lock, flags);
 
     ret_val = FALSE;
     if (ha->scratch_busy) {
-        if (((gdth_iord_str *)ha->pscratch)->size == (ulong32)size)
+        if (((gdth_iord_str *)ha->pscratch)->size == (u32)size)
             ret_val = TRUE;
     }
     spin_unlock_irqrestore(&ha->smp_lock, flags);
@@ -724,11 +724,11 @@ static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size)
 
 static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id)
 {
-    ulong flags;
+    unsigned long flags;
     int i;
     Scsi_Cmnd *scp;
     struct gdth_cmndinfo *cmndinfo;
-    unchar b, t;
+    u8 b, t;
 
     spin_lock_irqsave(&ha->smp_lock, flags);
 
@@ -738,8 +738,8 @@ static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id)
 
         b = scp->device->channel;
         t = scp->device->id;
-        if (!SPECIAL_SCP(scp) && t == (unchar)id && 
-            b == (unchar)busnum) {
+        if (!SPECIAL_SCP(scp) && t == (u8)id && 
+            b == (u8)busnum) {
             cmndinfo->wait_for_completion = 0;
             spin_unlock_irqrestore(&ha->smp_lock, flags);
             while (!cmndinfo->wait_for_completion)
index 9b900cc9ebe898dca7bb4ce12fd35851a6bb21bc..dab15f59f2ccb38797ab7b1e294d7e47f5abed59 100644 (file)
@@ -17,8 +17,8 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
                              int length, gdth_ha_str *ha);
 
 static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch,
-                              ulong64 *paddr);
-static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr);
+                              u64 *paddr);
+static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, u64 paddr);
 static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id);
 
 #endif
index 554626e1806256fb439d84ed681ee57d575180cc..09dbcb847b73c307ecb835e6463735f00ce9139c 100644 (file)
@@ -215,6 +215,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
                shost->shost_gendev.parent = dev ? dev : &platform_bus;
        shost->dma_dev = dma_dev;
 
+       device_enable_async_suspend(&shost->shost_gendev);
+
        error = device_add(&shost->shost_gendev);
        if (error)
                goto out;
@@ -222,6 +224,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
        scsi_host_set_state(shost, SHOST_RUNNING);
        get_device(shost->shost_gendev.parent);
 
+       device_enable_async_suspend(&shost->shost_dev);
+
        error = device_add(&shost->shost_dev);
        if (error)
                goto out_del_gendev;
index bb96fdd58e2389569d9b8128ff39cab30e759c8c..03697ba942510243de25b4f4d093605ac3c16366 100644 (file)
@@ -52,7 +52,7 @@
 #include "hpsa.h"
 
 /* HPSA_DRIVER_VERSION must be 3 byte values (0-255) separated by '.' */
-#define HPSA_DRIVER_VERSION "1.0.0"
+#define HPSA_DRIVER_VERSION "2.0.1-3"
 #define DRIVER_NAME "HP HPSA Driver (v " HPSA_DRIVER_VERSION ")"
 
 /* How long to wait (in milliseconds) for board to go into simple mode */
@@ -77,9 +77,6 @@ MODULE_PARM_DESC(hpsa_allow_any,
 
 /* define the PCI info for the cards we can control */
 static const struct pci_device_id hpsa_pci_device_id[] = {
-       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3223},
-       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3234},
-       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x323D},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3241},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3243},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3245},
@@ -87,6 +84,9 @@ static const struct pci_device_id hpsa_pci_device_id[] = {
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3249},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324a},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324b},
+       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3233},
+#define PCI_DEVICE_ID_HP_CISSF 0x333f
+       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x333F},
        {PCI_VENDOR_ID_HP,     PCI_ANY_ID,             PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
        {0,}
@@ -99,9 +99,6 @@ MODULE_DEVICE_TABLE(pci, hpsa_pci_device_id);
  *  access = Address of the struct of function pointers
  */
 static struct board_type products[] = {
-       {0x3223103C, "Smart Array P800", &SA5_access},
-       {0x3234103C, "Smart Array P400", &SA5_access},
-       {0x323d103c, "Smart Array P700M", &SA5_access},
        {0x3241103C, "Smart Array P212", &SA5_access},
        {0x3243103C, "Smart Array P410", &SA5_access},
        {0x3245103C, "Smart Array P410i", &SA5_access},
@@ -109,6 +106,8 @@ static struct board_type products[] = {
        {0x3249103C, "Smart Array P812", &SA5_access},
        {0x324a103C, "Smart Array P712m", &SA5_access},
        {0x324b103C, "Smart Array P711m", &SA5_access},
+       {0x3233103C, "StorageWorks P1210m", &SA5_access},
+       {0x333F103C, "StorageWorks P1210m", &SA5_access},
        {0xFFFF103C, "Unknown Smart Array", &SA5_access},
 };
 
@@ -126,12 +125,15 @@ static void cmd_free(struct ctlr_info *h, struct CommandList *c);
 static void cmd_special_free(struct ctlr_info *h, struct CommandList *c);
 static struct CommandList *cmd_alloc(struct ctlr_info *h);
 static struct CommandList *cmd_special_alloc(struct ctlr_info *h);
-static void fill_cmd(struct CommandList *c, __u8 cmd, struct ctlr_info *h,
-       void *buff, size_t size, __u8 page_code, unsigned char *scsi3addr,
+static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
+       void *buff, size_t size, u8 page_code, unsigned char *scsi3addr,
        int cmd_type);
 
 static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
                void (*done)(struct scsi_cmnd *));
+static void hpsa_scan_start(struct Scsi_Host *);
+static int hpsa_scan_finished(struct Scsi_Host *sh,
+       unsigned long elapsed_time);
 
 static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
 static int hpsa_slave_alloc(struct scsi_device *sdev);
@@ -150,6 +152,11 @@ static int check_for_unit_attention(struct ctlr_info *h,
        struct CommandList *c);
 static void check_ioctl_unit_attention(struct ctlr_info *h,
        struct CommandList *c);
+/* performant mode helper functions */
+static void calc_bucket_map(int *bucket, int num_buckets,
+       int nsgs, int *bucket_map);
+static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h);
+static inline u32 next_command(struct ctlr_info *h);
 
 static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
 static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
@@ -173,10 +180,10 @@ static struct scsi_host_template hpsa_driver_template = {
        .name                   = "hpsa",
        .proc_name              = "hpsa",
        .queuecommand           = hpsa_scsi_queue_command,
-       .can_queue              = 512,
+       .scan_start             = hpsa_scan_start,
+       .scan_finished          = hpsa_scan_finished,
        .this_id                = -1,
        .sg_tablesize           = MAXSGENTRIES,
-       .cmd_per_lun            = 512,
        .use_clustering         = ENABLE_CLUSTERING,
        .eh_device_reset_handler = hpsa_eh_device_reset_handler,
        .ioctl                  = hpsa_ioctl,
@@ -195,6 +202,12 @@ static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
        return (struct ctlr_info *) *priv;
 }
 
+static inline struct ctlr_info *shost_to_hba(struct Scsi_Host *sh)
+{
+       unsigned long *priv = shost_priv(sh);
+       return (struct ctlr_info *) *priv;
+}
+
 static struct task_struct *hpsa_scan_thread;
 static DEFINE_MUTEX(hpsa_scan_mutex);
 static LIST_HEAD(hpsa_scan_q);
@@ -312,7 +325,7 @@ static int hpsa_scan_func(__attribute__((unused)) void *data)
                        h->busy_scanning = 1;
                        mutex_unlock(&hpsa_scan_mutex);
                        host_no = h->scsi_host ?  h->scsi_host->host_no : -1;
-                       hpsa_update_scsi_devices(h, host_no);
+                       hpsa_scan_start(h->scsi_host);
                        complete_all(&h->scan_wait);
                        mutex_lock(&hpsa_scan_mutex);
                        h->busy_scanning = 0;
@@ -379,8 +392,7 @@ static ssize_t host_store_rescan(struct device *dev,
 {
        struct ctlr_info *h;
        struct Scsi_Host *shost = class_to_shost(dev);
-       unsigned long *priv = shost_priv(shost);
-       h = (struct ctlr_info *) *priv;
+       h = shost_to_hba(shost);
        if (add_to_scan_list(h)) {
                wake_up_process(hpsa_scan_thread);
                wait_for_completion_interruptible(&h->scan_wait);
@@ -394,10 +406,44 @@ static inline void addQ(struct hlist_head *list, struct CommandList *c)
        hlist_add_head(&c->list, list);
 }
 
+static inline u32 next_command(struct ctlr_info *h)
+{
+       u32 a;
+
+       if (unlikely(h->transMethod != CFGTBL_Trans_Performant))
+               return h->access.command_completed(h);
+
+       if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
+               a = *(h->reply_pool_head); /* Next cmd in ring buffer */
+               (h->reply_pool_head)++;
+               h->commands_outstanding--;
+       } else {
+               a = FIFO_EMPTY;
+       }
+       /* Check for wraparound */
+       if (h->reply_pool_head == (h->reply_pool + h->max_commands)) {
+               h->reply_pool_head = h->reply_pool;
+               h->reply_pool_wraparound ^= 1;
+       }
+       return a;
+}
+
+/* set_performant_mode: Modify the tag for cciss performant
+ * set bit 0 for pull model, bits 3-1 for block fetch
+ * register number
+ */
+static void set_performant_mode(struct ctlr_info *h, struct CommandList *c)
+{
+       if (likely(h->transMethod == CFGTBL_Trans_Performant))
+               c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1);
+}
+
 static void enqueue_cmd_and_start_io(struct ctlr_info *h,
        struct CommandList *c)
 {
        unsigned long flags;
+
+       set_performant_mode(h, c);
        spin_lock_irqsave(&h->lock, flags);
        addQ(&h->reqQ, c);
        h->Qdepth++;
@@ -422,6 +468,15 @@ static inline int is_logical_dev_addr_mode(unsigned char scsi3addr[])
        return (scsi3addr[3] & 0xC0) == 0x40;
 }
 
+static inline int is_scsi_rev_5(struct ctlr_info *h)
+{
+       if (!h->hba_inquiry_data)
+               return 0;
+       if ((h->hba_inquiry_data[2] & 0x07) == 5)
+               return 1;
+       return 0;
+}
+
 static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
        "UNKNOWN"
 };
@@ -431,7 +486,7 @@ static ssize_t raid_level_show(struct device *dev,
             struct device_attribute *attr, char *buf)
 {
        ssize_t l = 0;
-       int rlevel;
+       unsigned char rlevel;
        struct ctlr_info *h;
        struct scsi_device *sdev;
        struct hpsa_scsi_dev_t *hdev;
@@ -455,7 +510,7 @@ static ssize_t raid_level_show(struct device *dev,
 
        rlevel = hdev->raid_level;
        spin_unlock_irqrestore(&h->lock, flags);
-       if (rlevel < 0 || rlevel > RAID_UNKNOWN)
+       if (rlevel > RAID_UNKNOWN)
                rlevel = RAID_UNKNOWN;
        l = snprintf(buf, PAGE_SIZE, "RAID %s\n", raid_label[rlevel]);
        return l;
@@ -620,6 +675,24 @@ lun_assigned:
        return 0;
 }
 
+/* Replace an entry from h->dev[] array. */
+static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno,
+       int entry, struct hpsa_scsi_dev_t *new_entry,
+       struct hpsa_scsi_dev_t *added[], int *nadded,
+       struct hpsa_scsi_dev_t *removed[], int *nremoved)
+{
+       /* assumes h->devlock is held */
+       BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA);
+       removed[*nremoved] = h->dev[entry];
+       (*nremoved)++;
+       h->dev[entry] = new_entry;
+       added[*nadded] = new_entry;
+       (*nadded)++;
+       dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d changed.\n",
+               scsi_device_type(new_entry->devtype), hostno, new_entry->bus,
+                       new_entry->target, new_entry->lun);
+}
+
 /* Remove an entry from h->dev[] array. */
 static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry,
        struct hpsa_scsi_dev_t *removed[], int *nremoved)
@@ -628,8 +701,7 @@ static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry,
        int i;
        struct hpsa_scsi_dev_t *sd;
 
-       if (entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA)
-               BUG();
+       BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA);
 
        sd = h->dev[entry];
        removed[*nremoved] = h->dev[entry];
@@ -722,6 +794,8 @@ static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
 #define DEVICE_CHANGED 1
 #define DEVICE_SAME 2
        for (i = 0; i < haystack_size; i++) {
+               if (haystack[i] == NULL) /* previously removed. */
+                       continue;
                if (SCSI3ADDR_EQ(needle->scsi3addr, haystack[i]->scsi3addr)) {
                        *index = i;
                        if (device_is_the_same(needle, haystack[i]))
@@ -734,7 +808,7 @@ static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
        return DEVICE_NOT_FOUND;
 }
 
-static int adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
+static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
        struct hpsa_scsi_dev_t *sd[], int nsds)
 {
        /* sd contains scsi3 addresses and devtypes, and inquiry
@@ -779,12 +853,12 @@ static int adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
                        continue; /* remove ^^^, hence i not incremented */
                } else if (device_change == DEVICE_CHANGED) {
                        changes++;
-                       hpsa_scsi_remove_entry(h, hostno, i,
-                               removed, &nremoved);
-                       (void) hpsa_scsi_add_entry(h, hostno, sd[entry],
-                               added, &nadded);
-                       /* add can't fail, we just removed one. */
-                       sd[entry] = NULL; /* prevent it from being freed */
+                       hpsa_scsi_replace_entry(h, hostno, i, sd[entry],
+                               added, &nadded, removed, &nremoved);
+                       /* Set it to NULL to prevent it from being freed
+                        * at the bottom of hpsa_update_scsi_devices()
+                        */
+                       sd[entry] = NULL;
                }
                i++;
        }
@@ -860,7 +934,6 @@ static int adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
 free_and_out:
        kfree(added);
        kfree(removed);
-       return 0;
 }
 
 /*
@@ -900,7 +973,7 @@ static int hpsa_slave_alloc(struct scsi_device *sdev)
 
 static void hpsa_slave_destroy(struct scsi_device *sdev)
 {
-       return; /* nothing to do. */
+       /* nothing to do. */
 }
 
 static void hpsa_scsi_setup(struct ctlr_info *h)
@@ -908,11 +981,10 @@ static void hpsa_scsi_setup(struct ctlr_info *h)
        h->ndevices = 0;
        h->scsi_host = NULL;
        spin_lock_init(&h->devlock);
-       return;
 }
 
 static void complete_scsi_command(struct CommandList *cp,
-       int timeout, __u32 tag)
+       int timeout, u32 tag)
 {
        struct scsi_cmnd *cmd;
        struct ctlr_info *h;
@@ -987,7 +1059,6 @@ static void complete_scsi_command(struct CommandList *cp,
                                 * required
                                 */
                                if ((asc == 0x04) && (ascq == 0x03)) {
-                                       cmd->result = DID_NO_CONNECT << 16;
                                        dev_warn(&h->pdev->dev, "cp %p "
                                                "has check condition: unit "
                                                "not ready, manual "
@@ -995,14 +1066,22 @@ static void complete_scsi_command(struct CommandList *cp,
                                        break;
                                }
                        }
-
-
+                       if (sense_key == ABORTED_COMMAND) {
+                               /* Aborted command is retryable */
+                               dev_warn(&h->pdev->dev, "cp %p "
+                                       "has check condition: aborted command: "
+                                       "ASC: 0x%x, ASCQ: 0x%x\n",
+                                       cp, asc, ascq);
+                               cmd->result = DID_SOFT_ERROR << 16;
+                               break;
+                       }
                        /* Must be some other type of check condition */
                        dev_warn(&h->pdev->dev, "cp %p has check condition: "
                                        "unknown type: "
                                        "Sense: 0x%x, ASC: 0x%x, ASCQ: 0x%x, "
                                        "Returning result: 0x%x, "
                                        "cmd=[%02x %02x %02x %02x %02x "
+                                       "%02x %02x %02x %02x %02x %02x "
                                        "%02x %02x %02x %02x %02x]\n",
                                        cp, sense_key, asc, ascq,
                                        cmd->result,
@@ -1010,7 +1089,10 @@ static void complete_scsi_command(struct CommandList *cp,
                                        cmd->cmnd[2], cmd->cmnd[3],
                                        cmd->cmnd[4], cmd->cmnd[5],
                                        cmd->cmnd[6], cmd->cmnd[7],
-                                       cmd->cmnd[8], cmd->cmnd[9]);
+                                       cmd->cmnd[8], cmd->cmnd[9],
+                                       cmd->cmnd[10], cmd->cmnd[11],
+                                       cmd->cmnd[12], cmd->cmnd[13],
+                                       cmd->cmnd[14], cmd->cmnd[15]);
                        break;
                }
 
@@ -1086,7 +1168,7 @@ static void complete_scsi_command(struct CommandList *cp,
                dev_warn(&h->pdev->dev, "cp %p reports abort failed\n", cp);
                break;
        case CMD_UNSOLICITED_ABORT:
-               cmd->result = DID_ABORT << 16;
+               cmd->result = DID_RESET << 16;
                dev_warn(&h->pdev->dev, "cp %p aborted do to an unsolicited "
                        "abort\n", cp);
                break;
@@ -1119,9 +1201,11 @@ static int hpsa_scsi_detect(struct ctlr_info *h)
        sh->max_cmd_len = MAX_COMMAND_SIZE;
        sh->max_lun = HPSA_MAX_LUN;
        sh->max_id = HPSA_MAX_LUN;
+       sh->can_queue = h->nr_cmds;
+       sh->cmd_per_lun = h->nr_cmds;
        h->scsi_host = sh;
        sh->hostdata[0] = (unsigned long) h;
-       sh->irq = h->intr[SIMPLE_MODE_INT];
+       sh->irq = h->intr[PERF_MODE_INT];
        sh->unique_id = sh->irq;
        error = scsi_add_host(sh, &h->pdev->dev);
        if (error)
@@ -1133,11 +1217,11 @@ static int hpsa_scsi_detect(struct ctlr_info *h)
        dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_add_host"
                " failed for controller %d\n", h->ctlr);
        scsi_host_put(sh);
-       return -1;
+       return error;
  fail:
        dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_host_alloc"
                " failed for controller %d\n", h->ctlr);
-       return -1;
+       return -ENOMEM;
 }
 
 static void hpsa_pci_unmap(struct pci_dev *pdev,
@@ -1160,7 +1244,7 @@ static void hpsa_map_one(struct pci_dev *pdev,
                size_t buflen,
                int data_direction)
 {
-       __u64 addr64;
+       u64 addr64;
 
        if (buflen == 0 || data_direction == PCI_DMA_NONE) {
                cp->Header.SGList = 0;
@@ -1168,14 +1252,14 @@ static void hpsa_map_one(struct pci_dev *pdev,
                return;
        }
 
-       addr64 = (__u64) pci_map_single(pdev, buf, buflen, data_direction);
+       addr64 = (u64) pci_map_single(pdev, buf, buflen, data_direction);
        cp->SG[0].Addr.lower =
-         (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF);
+         (u32) (addr64 & (u64) 0x00000000FFFFFFFF);
        cp->SG[0].Addr.upper =
-         (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF);
+         (u32) ((addr64 >> 32) & (u64) 0x00000000FFFFFFFF);
        cp->SG[0].Len = buflen;
-       cp->Header.SGList = (__u8) 1;   /* no. SGs contig in this cmd */
-       cp->Header.SGTotal = (__u16) 1; /* total sgs in this cmd list */
+       cp->Header.SGList = (u8) 1;   /* no. SGs contig in this cmd */
+       cp->Header.SGTotal = (u16) 1; /* total sgs in this cmd list */
 }
 
 static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
@@ -1274,7 +1358,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
 
        if (c == NULL) {                        /* trouble... */
                dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
-               return -1;
+               return -ENOMEM;
        }
 
        fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize, page, scsi3addr, TYPE_CMD);
@@ -1366,9 +1450,8 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
                dev_err(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
                return -1;
        }
-
-       memset(&scsi3addr[0], 0, 8); /* address the controller */
-
+       /* address the controller */
+       memset(scsi3addr, 0, sizeof(scsi3addr));
        fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
                buf, bufsize, 0, scsi3addr, TYPE_CMD);
        if (extended_response)
@@ -1409,13 +1492,12 @@ static int hpsa_update_device_info(struct ctlr_info *h,
        unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device)
 {
 #define OBDR_TAPE_INQ_SIZE 49
-       unsigned char *inq_buff = NULL;
+       unsigned char *inq_buff;
 
-       inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
+       inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
        if (!inq_buff)
                goto bail_out;
 
-       memset(inq_buff, 0, OBDR_TAPE_INQ_SIZE);
        /* Do an inquiry to the device to see what it is. */
        if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
                (unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
@@ -1485,32 +1567,51 @@ static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
  * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.)
  */
 static void figure_bus_target_lun(struct ctlr_info *h,
-       __u8 *lunaddrbytes, int *bus, int *target, int *lun,
+       u8 *lunaddrbytes, int *bus, int *target, int *lun,
        struct hpsa_scsi_dev_t *device)
 {
-
-       __u32 lunid;
+       u32 lunid;
 
        if (is_logical_dev_addr_mode(lunaddrbytes)) {
                /* logical device */
-               memcpy(&lunid, lunaddrbytes, sizeof(lunid));
-               lunid = le32_to_cpu(lunid);
-
-               if (is_msa2xxx(h, device)) {
-                       *bus = 1;
-                       *target = (lunid >> 16) & 0x3fff;
-                       *lun = lunid & 0x00ff;
-               } else {
+               if (unlikely(is_scsi_rev_5(h))) {
+                       /* p1210m, logical drives lun assignments
+                        * match SCSI REPORT LUNS data.
+                        */
+                       lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
                        *bus = 0;
-                       *lun = 0;
-                       *target = lunid & 0x3fff;
+                       *target = 0;
+                       *lun = (lunid & 0x3fff) + 1;
+               } else {
+                       /* not p1210m... */
+                       lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
+                       if (is_msa2xxx(h, device)) {
+                               /* msa2xxx way, put logicals on bus 1
+                                * and match target/lun numbers box
+                                * reports.
+                                */
+                               *bus = 1;
+                               *target = (lunid >> 16) & 0x3fff;
+                               *lun = lunid & 0x00ff;
+                       } else {
+                               /* Traditional smart array way. */
+                               *bus = 0;
+                               *lun = 0;
+                               *target = lunid & 0x3fff;
+                       }
                }
        } else {
                /* physical device */
                if (is_hba_lunid(lunaddrbytes))
-                       *bus = 3;
+                       if (unlikely(is_scsi_rev_5(h))) {
+                               *bus = 0; /* put p1210m ctlr at 0,0,0 */
+                               *target = 0;
+                               *lun = 0;
+                               return;
+                       } else
+                               *bus = 3; /* traditional smartarray */
                else
-                       *bus = 2;
+                       *bus = 2; /* physical disk */
                *target = -1;
                *lun = -1; /* we will fill these in later. */
        }
@@ -1529,7 +1630,7 @@ static void figure_bus_target_lun(struct ctlr_info *h,
  */
 static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
        struct hpsa_scsi_dev_t *tmpdevice,
-       struct hpsa_scsi_dev_t *this_device, __u8 *lunaddrbytes,
+       struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes,
        int bus, int target, int lun, unsigned long lunzerobits[],
        int *nmsa2xxx_enclosures)
 {
@@ -1550,6 +1651,9 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
        if (is_hba_lunid(scsi3addr))
                return 0; /* Don't add the RAID controller here. */
 
+       if (is_scsi_rev_5(h))
+               return 0; /* p1210m doesn't need to do this. */
+
 #define MAX_MSA2XXX_ENCLOSURES 32
        if (*nmsa2xxx_enclosures >= MAX_MSA2XXX_ENCLOSURES) {
                dev_warn(&h->pdev->dev, "Maximum number of MSA2XXX "
@@ -1576,18 +1680,14 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
  */
 static int hpsa_gather_lun_info(struct ctlr_info *h,
        int reportlunsize,
-       struct ReportLUNdata *physdev, __u32 *nphysicals,
-       struct ReportLUNdata *logdev, __u32 *nlogicals)
+       struct ReportLUNdata *physdev, u32 *nphysicals,
+       struct ReportLUNdata *logdev, u32 *nlogicals)
 {
        if (hpsa_scsi_do_report_phys_luns(h, physdev, reportlunsize, 0)) {
                dev_err(&h->pdev->dev, "report physical LUNs failed.\n");
                return -1;
        }
-       memcpy(nphysicals, &physdev->LUNListLength[0], sizeof(*nphysicals));
-       *nphysicals = be32_to_cpu(*nphysicals) / 8;
-#ifdef DEBUG
-       dev_info(&h->pdev->dev, "number of physical luns is %d\n", *nphysicals);
-#endif
+       *nphysicals = be32_to_cpu(*((__be32 *)physdev->LUNListLength)) / 8;
        if (*nphysicals > HPSA_MAX_PHYS_LUN) {
                dev_warn(&h->pdev->dev, "maximum physical LUNs (%d) exceeded."
                        "  %d LUNs ignored.\n", HPSA_MAX_PHYS_LUN,
@@ -1598,11 +1698,7 @@ static int hpsa_gather_lun_info(struct ctlr_info *h,
                dev_err(&h->pdev->dev, "report logical LUNs failed.\n");
                return -1;
        }
-       memcpy(nlogicals, &logdev->LUNListLength[0], sizeof(*nlogicals));
-       *nlogicals = be32_to_cpu(*nlogicals) / 8;
-#ifdef DEBUG
-       dev_info(&h->pdev->dev, "number of logical luns is %d\n", *nlogicals);
-#endif
+       *nlogicals = be32_to_cpu(*((__be32 *) logdev->LUNListLength)) / 8;
        /* Reject Logicals in excess of our max capability. */
        if (*nlogicals > HPSA_MAX_LUN) {
                dev_warn(&h->pdev->dev,
@@ -1621,6 +1717,31 @@ static int hpsa_gather_lun_info(struct ctlr_info *h,
        return 0;
 }
 
+u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
+       int nphysicals, int nlogicals, struct ReportLUNdata *physdev_list,
+       struct ReportLUNdata *logdev_list)
+{
+       /* Helper function, figure out where the LUN ID info is coming from
+        * given index i, lists of physical and logical devices, where in
+        * the list the raid controller is supposed to appear (first or last)
+        */
+
+       int logicals_start = nphysicals + (raid_ctlr_position == 0);
+       int last_device = nphysicals + nlogicals + (raid_ctlr_position == 0);
+
+       if (i == raid_ctlr_position)
+               return RAID_CTLR_LUNID;
+
+       if (i < logicals_start)
+               return &physdev_list->LUN[i - (raid_ctlr_position == 0)][0];
+
+       if (i < last_device)
+               return &logdev_list->LUN[i - nphysicals -
+                       (raid_ctlr_position == 0)][0];
+       BUG();
+       return NULL;
+}
+
 static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
 {
        /* the idea here is we could get notified
@@ -1636,14 +1757,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
        struct ReportLUNdata *physdev_list = NULL;
        struct ReportLUNdata *logdev_list = NULL;
        unsigned char *inq_buff = NULL;
-       __u32 nphysicals = 0;
-       __u32 nlogicals = 0;
-       __u32 ndev_allocated = 0;
+       u32 nphysicals = 0;
+       u32 nlogicals = 0;
+       u32 ndev_allocated = 0;
        struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice;
        int ncurrent = 0;
        int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8;
        int i, nmsa2xxx_enclosures, ndevs_to_allocate;
        int bus, target, lun;
+       int raid_ctlr_position;
        DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR);
 
        currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_SCSI_DEVS_PER_HBA,
@@ -1681,23 +1803,22 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
                ndev_allocated++;
        }
 
+       if (unlikely(is_scsi_rev_5(h)))
+               raid_ctlr_position = 0;
+       else
+               raid_ctlr_position = nphysicals + nlogicals;
+
        /* adjust our table of devices */
        nmsa2xxx_enclosures = 0;
        for (i = 0; i < nphysicals + nlogicals + 1; i++) {
-               __u8 *lunaddrbytes;
+               u8 *lunaddrbytes;
 
                /* Figure out where the LUN ID info is coming from */
-               if (i < nphysicals)
-                       lunaddrbytes = &physdev_list->LUN[i][0];
-               else
-                       if (i < nphysicals + nlogicals)
-                               lunaddrbytes =
-                                       &logdev_list->LUN[i-nphysicals][0];
-                       else /* jam in the RAID controller at the end */
-                               lunaddrbytes = RAID_CTLR_LUNID;
-
+               lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
+                       i, nphysicals, nlogicals, physdev_list, logdev_list);
                /* skip masked physical devices. */
-               if (lunaddrbytes[3] & 0xC0 && i < nphysicals)
+               if (lunaddrbytes[3] & 0xC0 &&
+                       i < nphysicals + (raid_ctlr_position == 0))
                        continue;
 
                /* Get device type, vendor, model, device id */
@@ -1777,7 +1898,6 @@ out:
        kfree(inq_buff);
        kfree(physdev_list);
        kfree(logdev_list);
-       return;
 }
 
 /* hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
@@ -1790,7 +1910,7 @@ static int hpsa_scatter_gather(struct pci_dev *pdev,
 {
        unsigned int len;
        struct scatterlist *sg;
-       __u64 addr64;
+       u64 addr64;
        int use_sg, i;
 
        BUG_ON(scsi_sg_count(cmd) > MAXSGENTRIES);
@@ -1803,20 +1923,20 @@ static int hpsa_scatter_gather(struct pci_dev *pdev,
                goto sglist_finished;
 
        scsi_for_each_sg(cmd, sg, use_sg, i) {
-               addr64 = (__u64) sg_dma_address(sg);
+               addr64 = (u64) sg_dma_address(sg);
                len  = sg_dma_len(sg);
                cp->SG[i].Addr.lower =
-                       (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF);
+                       (u32) (addr64 & (u64) 0x00000000FFFFFFFF);
                cp->SG[i].Addr.upper =
-                       (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF);
+                       (u32) ((addr64 >> 32) & (u64) 0x00000000FFFFFFFF);
                cp->SG[i].Len = len;
                cp->SG[i].Ext = 0;  /* we are not chaining */
        }
 
 sglist_finished:
 
-       cp->Header.SGList = (__u8) use_sg;   /* no. SGs contig in this cmd */
-       cp->Header.SGTotal = (__u16) use_sg; /* total sgs in this cmd list */
+       cp->Header.SGList = (u8) use_sg;   /* no. SGs contig in this cmd */
+       cp->Header.SGTotal = (u16) use_sg; /* total sgs in this cmd list */
        return 0;
 }
 
@@ -1860,7 +1980,8 @@ static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
        c->scsi_cmd = cmd;
        c->Header.ReplyQueue = 0;  /* unused in simple mode */
        memcpy(&c->Header.LUN.LunAddrBytes[0], &scsi3addr[0], 8);
-       c->Header.Tag.lower = c->busaddr;  /* Use k. address of cmd as tag */
+       c->Header.Tag.lower = (c->cmdindex << DIRECT_LOOKUP_SHIFT);
+       c->Header.Tag.lower |= DIRECT_LOOKUP_BIT;
 
        /* Fill in the request block... */
 
@@ -1914,6 +2035,48 @@ static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
        return 0;
 }
 
+static void hpsa_scan_start(struct Scsi_Host *sh)
+{
+       struct ctlr_info *h = shost_to_hba(sh);
+       unsigned long flags;
+
+       /* wait until any scan already in progress is finished. */
+       while (1) {
+               spin_lock_irqsave(&h->scan_lock, flags);
+               if (h->scan_finished)
+                       break;
+               spin_unlock_irqrestore(&h->scan_lock, flags);
+               wait_event(h->scan_wait_queue, h->scan_finished);
+               /* Note: We don't need to worry about a race between this
+                * thread and driver unload because the midlayer will
+                * have incremented the reference count, so unload won't
+                * happen if we're in here.
+                */
+       }
+       h->scan_finished = 0; /* mark scan as in progress */
+       spin_unlock_irqrestore(&h->scan_lock, flags);
+
+       hpsa_update_scsi_devices(h, h->scsi_host->host_no);
+
+       spin_lock_irqsave(&h->scan_lock, flags);
+       h->scan_finished = 1; /* mark scan as finished. */
+       wake_up_all(&h->scan_wait_queue);
+       spin_unlock_irqrestore(&h->scan_lock, flags);
+}
+
+static int hpsa_scan_finished(struct Scsi_Host *sh,
+       unsigned long elapsed_time)
+{
+       struct ctlr_info *h = shost_to_hba(sh);
+       unsigned long flags;
+       int finished;
+
+       spin_lock_irqsave(&h->scan_lock, flags);
+       finished = h->scan_finished;
+       spin_unlock_irqrestore(&h->scan_lock, flags);
+       return finished;
+}
+
 static void hpsa_unregister_scsi(struct ctlr_info *h)
 {
        /* we are being forcibly unloaded, and may not refuse. */
@@ -1926,7 +2089,6 @@ static int hpsa_register_scsi(struct ctlr_info *h)
 {
        int rc;
 
-       hpsa_update_scsi_devices(h, -1);
        rc = hpsa_scsi_detect(h);
        if (rc != 0)
                dev_err(&h->pdev->dev, "hpsa_register_scsi: failed"
@@ -2003,14 +2165,14 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
        h = sdev_to_hba(scsicmd->device);
        if (h == NULL) /* paranoia */
                return FAILED;
-       dev_warn(&h->pdev->dev, "resetting drive\n");
-
        dev = scsicmd->device->hostdata;
        if (!dev) {
                dev_err(&h->pdev->dev, "hpsa_eh_device_reset_handler: "
                        "device lookup failed.\n");
                return FAILED;
        }
+       dev_warn(&h->pdev->dev, "resetting device %d:%d:%d:%d\n",
+               h->scsi_host->host_no, dev->bus, dev->target, dev->lun);
        /* send a reset to the SCSI LUN which the command was sent to */
        rc = hpsa_send_reset(h, dev->scsi3addr);
        if (rc == 0 && wait_for_device_to_become_ready(h, dev->scsi3addr) == 0)
@@ -2053,8 +2215,8 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
        c->cmdindex = i;
 
        INIT_HLIST_NODE(&c->list);
-       c->busaddr = (__u32) cmd_dma_handle;
-       temp64.val = (__u64) err_dma_handle;
+       c->busaddr = (u32) cmd_dma_handle;
+       temp64.val = (u64) err_dma_handle;
        c->ErrDesc.Addr.lower = temp64.val32.lower;
        c->ErrDesc.Addr.upper = temp64.val32.upper;
        c->ErrDesc.Len = sizeof(*c->err_info);
@@ -2091,8 +2253,8 @@ static struct CommandList *cmd_special_alloc(struct ctlr_info *h)
        memset(c->err_info, 0, sizeof(*c->err_info));
 
        INIT_HLIST_NODE(&c->list);
-       c->busaddr = (__u32) cmd_dma_handle;
-       temp64.val = (__u64) err_dma_handle;
+       c->busaddr = (u32) cmd_dma_handle;
+       temp64.val = (u64) err_dma_handle;
        c->ErrDesc.Addr.lower = temp64.val32.lower;
        c->ErrDesc.Addr.upper = temp64.val32.upper;
        c->ErrDesc.Len = sizeof(*c->err_info);
@@ -2125,50 +2287,6 @@ static void cmd_special_free(struct ctlr_info *h, struct CommandList *c)
 
 #ifdef CONFIG_COMPAT
 
-static int do_ioctl(struct scsi_device *dev, int cmd, void *arg)
-{
-       int ret;
-
-       lock_kernel();
-       ret = hpsa_ioctl(dev, cmd, arg);
-       unlock_kernel();
-       return ret;
-}
-
-static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg);
-static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
-       int cmd, void *arg);
-
-static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg)
-{
-       switch (cmd) {
-       case CCISS_GETPCIINFO:
-       case CCISS_GETINTINFO:
-       case CCISS_SETINTINFO:
-       case CCISS_GETNODENAME:
-       case CCISS_SETNODENAME:
-       case CCISS_GETHEARTBEAT:
-       case CCISS_GETBUSTYPES:
-       case CCISS_GETFIRMVER:
-       case CCISS_GETDRIVVER:
-       case CCISS_REVALIDVOLS:
-       case CCISS_DEREGDISK:
-       case CCISS_REGNEWDISK:
-       case CCISS_REGNEWD:
-       case CCISS_RESCANDISK:
-       case CCISS_GETLUNINFO:
-               return do_ioctl(dev, cmd, arg);
-
-       case CCISS_PASSTHRU32:
-               return hpsa_ioctl32_passthru(dev, cmd, arg);
-       case CCISS_BIG_PASSTHRU32:
-               return hpsa_ioctl32_big_passthru(dev, cmd, arg);
-
-       default:
-               return -ENOIOCTLCMD;
-       }
-}
-
 static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg)
 {
        IOCTL32_Command_struct __user *arg32 =
@@ -2193,7 +2311,7 @@ static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg)
        if (err)
                return -EFAULT;
 
-       err = do_ioctl(dev, CCISS_PASSTHRU, (void *)p);
+       err = hpsa_ioctl(dev, CCISS_PASSTHRU, (void *)p);
        if (err)
                return err;
        err |= copy_in_user(&arg32->error_info, &p->error_info,
@@ -2230,7 +2348,7 @@ static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
        if (err)
                return -EFAULT;
 
-       err = do_ioctl(dev, CCISS_BIG_PASSTHRU, (void *)p);
+       err = hpsa_ioctl(dev, CCISS_BIG_PASSTHRU, (void *)p);
        if (err)
                return err;
        err |= copy_in_user(&arg32->error_info, &p->error_info,
@@ -2239,6 +2357,36 @@ static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
                return -EFAULT;
        return err;
 }
+
+static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg)
+{
+       switch (cmd) {
+       case CCISS_GETPCIINFO:
+       case CCISS_GETINTINFO:
+       case CCISS_SETINTINFO:
+       case CCISS_GETNODENAME:
+       case CCISS_SETNODENAME:
+       case CCISS_GETHEARTBEAT:
+       case CCISS_GETBUSTYPES:
+       case CCISS_GETFIRMVER:
+       case CCISS_GETDRIVVER:
+       case CCISS_REVALIDVOLS:
+       case CCISS_DEREGDISK:
+       case CCISS_REGNEWDISK:
+       case CCISS_REGNEWD:
+       case CCISS_RESCANDISK:
+       case CCISS_GETLUNINFO:
+               return hpsa_ioctl(dev, cmd, arg);
+
+       case CCISS_PASSTHRU32:
+               return hpsa_ioctl32_passthru(dev, cmd, arg);
+       case CCISS_BIG_PASSTHRU32:
+               return hpsa_ioctl32_big_passthru(dev, cmd, arg);
+
+       default:
+               return -ENOIOCTLCMD;
+       }
+}
 #endif
 
 static int hpsa_getpciinfo_ioctl(struct ctlr_info *h, void __user *argp)
@@ -2378,8 +2526,8 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
        BYTE sg_used = 0;
        int status = 0;
        int i;
-       __u32 left;
-       __u32 sz;
+       u32 left;
+       u32 sz;
        BYTE __user *data_ptr;
 
        if (!argp)
@@ -2527,7 +2675,7 @@ static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
        case CCISS_DEREGDISK:
        case CCISS_REGNEWDISK:
        case CCISS_REGNEWD:
-               hpsa_update_scsi_devices(h, dev->host->host_no);
+               hpsa_scan_start(h->scsi_host);
                return 0;
        case CCISS_GETPCIINFO:
                return hpsa_getpciinfo_ioctl(h, argp);
@@ -2542,8 +2690,8 @@ static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
        }
 }
 
-static void fill_cmd(struct CommandList *c, __u8 cmd, struct ctlr_info *h,
-       void *buff, size_t size, __u8 page_code, unsigned char *scsi3addr,
+static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
+       void *buff, size_t size, u8 page_code, unsigned char *scsi3addr,
        int cmd_type)
 {
        int pci_dir = XFER_NONE;
@@ -2710,19 +2858,20 @@ static inline unsigned long get_next_completion(struct ctlr_info *h)
        return h->access.command_completed(h);
 }
 
-static inline int interrupt_pending(struct ctlr_info *h)
+static inline bool interrupt_pending(struct ctlr_info *h)
 {
        return h->access.intr_pending(h);
 }
 
 static inline long interrupt_not_for_us(struct ctlr_info *h)
 {
-       return ((h->access.intr_pending(h) == 0) ||
-                (h->interrupts_enabled == 0));
+       return !(h->msi_vector || h->msix_vector) &&
+               ((h->access.intr_pending(h) == 0) ||
+               (h->interrupts_enabled == 0));
 }
 
-static inline int bad_tag(struct ctlr_info *h, __u32 tag_index,
-       __u32 raw_tag)
+static inline int bad_tag(struct ctlr_info *h, u32 tag_index,
+       u32 raw_tag)
 {
        if (unlikely(tag_index >= h->nr_cmds)) {
                dev_warn(&h->pdev->dev, "bad tag 0x%08x ignored.\n", raw_tag);
@@ -2731,7 +2880,7 @@ static inline int bad_tag(struct ctlr_info *h, __u32 tag_index,
        return 0;
 }
 
-static inline void finish_cmd(struct CommandList *c, __u32 raw_tag)
+static inline void finish_cmd(struct CommandList *c, u32 raw_tag)
 {
        removeQ(c);
        if (likely(c->cmd_type == CMD_SCSI))
@@ -2740,42 +2889,79 @@ static inline void finish_cmd(struct CommandList *c, __u32 raw_tag)
                complete(c->waiting);
 }
 
+static inline u32 hpsa_tag_contains_index(u32 tag)
+{
+#define DIRECT_LOOKUP_BIT 0x10
+       return tag & DIRECT_LOOKUP_BIT;
+}
+
+static inline u32 hpsa_tag_to_index(u32 tag)
+{
+#define DIRECT_LOOKUP_SHIFT 5
+       return tag >> DIRECT_LOOKUP_SHIFT;
+}
+
+static inline u32 hpsa_tag_discard_error_bits(u32 tag)
+{
+#define HPSA_ERROR_BITS 0x03
+       return tag & ~HPSA_ERROR_BITS;
+}
+
+/* process completion of an indexed ("direct lookup") command */
+static inline u32 process_indexed_cmd(struct ctlr_info *h,
+       u32 raw_tag)
+{
+       u32 tag_index;
+       struct CommandList *c;
+
+       tag_index = hpsa_tag_to_index(raw_tag);
+       if (bad_tag(h, tag_index, raw_tag))
+               return next_command(h);
+       c = h->cmd_pool + tag_index;
+       finish_cmd(c, raw_tag);
+       return next_command(h);
+}
+
+/* process completion of a non-indexed command */
+static inline u32 process_nonindexed_cmd(struct ctlr_info *h,
+       u32 raw_tag)
+{
+       u32 tag;
+       struct CommandList *c = NULL;
+       struct hlist_node *tmp;
+
+       tag = hpsa_tag_discard_error_bits(raw_tag);
+       hlist_for_each_entry(c, tmp, &h->cmpQ, list) {
+               if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) {
+                       finish_cmd(c, raw_tag);
+                       return next_command(h);
+               }
+       }
+       bad_tag(h, h->nr_cmds + 1, raw_tag);
+       return next_command(h);
+}
+
 static irqreturn_t do_hpsa_intr(int irq, void *dev_id)
 {
        struct ctlr_info *h = dev_id;
-       struct CommandList *c;
        unsigned long flags;
-       __u32 raw_tag, tag, tag_index;
-       struct hlist_node *tmp;
+       u32 raw_tag;
 
        if (interrupt_not_for_us(h))
                return IRQ_NONE;
        spin_lock_irqsave(&h->lock, flags);
-       while (interrupt_pending(h)) {
-               while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) {
-                       if (likely(HPSA_TAG_CONTAINS_INDEX(raw_tag))) {
-                               tag_index = HPSA_TAG_TO_INDEX(raw_tag);
-                               if (bad_tag(h, tag_index, raw_tag))
-                                       return IRQ_HANDLED;
-                               c = h->cmd_pool + tag_index;
-                               finish_cmd(c, raw_tag);
-                               continue;
-                       }
-                       tag = HPSA_TAG_DISCARD_ERROR_BITS(raw_tag);
-                       c = NULL;
-                       hlist_for_each_entry(c, tmp, &h->cmpQ, list) {
-                               if (c->busaddr == tag) {
-                                       finish_cmd(c, raw_tag);
-                                       break;
-                               }
-                       }
-               }
+       raw_tag = get_next_completion(h);
+       while (raw_tag != FIFO_EMPTY) {
+               if (hpsa_tag_contains_index(raw_tag))
+                       raw_tag = process_indexed_cmd(h, raw_tag);
+               else
+                       raw_tag = process_nonindexed_cmd(h, raw_tag);
        }
        spin_unlock_irqrestore(&h->lock, flags);
        return IRQ_HANDLED;
 }
 
-/* Send a message CDB to the firmware. */
+/* Send a message CDB to the firmwart. */
 static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
                                                unsigned char type)
 {
@@ -2841,7 +3027,7 @@ static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
 
        for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) {
                tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);
-               if (HPSA_TAG_DISCARD_ERROR_BITS(tag) == paddr32)
+               if (hpsa_tag_discard_error_bits(tag) == paddr32)
                        break;
                msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS);
        }
@@ -3063,7 +3249,7 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
  */
 
 static void __devinit hpsa_interrupt_mode(struct ctlr_info *h,
-                                          struct pci_dev *pdev, __u32 board_id)
+                                          struct pci_dev *pdev, u32 board_id)
 {
 #ifdef CONFIG_PCI_MSI
        int err;
@@ -3107,22 +3293,22 @@ static void __devinit hpsa_interrupt_mode(struct ctlr_info *h,
 default_int_mode:
 #endif                         /* CONFIG_PCI_MSI */
        /* if we get here we're going to use the default interrupt mode */
-       h->intr[SIMPLE_MODE_INT] = pdev->irq;
-       return;
+       h->intr[PERF_MODE_INT] = pdev->irq;
 }
 
 static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
 {
        ushort subsystem_vendor_id, subsystem_device_id, command;
-       __u32 board_id, scratchpad = 0;
-       __u64 cfg_offset;
-       __u32 cfg_base_addr;
-       __u64 cfg_base_addr_index;
+       u32 board_id, scratchpad = 0;
+       u64 cfg_offset;
+       u32 cfg_base_addr;
+       u64 cfg_base_addr_index;
+       u32 trans_offset;
        int i, prod_index, err;
 
        subsystem_vendor_id = pdev->subsystem_vendor;
        subsystem_device_id = pdev->subsystem_device;
-       board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) |
+       board_id = (((u32) (subsystem_device_id << 16) & 0xffff0000) |
                    subsystem_vendor_id);
 
        for (i = 0; i < ARRAY_SIZE(products); i++)
@@ -3199,7 +3385,7 @@ static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
 
        /* get the address index number */
        cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET);
-       cfg_base_addr &= (__u32) 0x0000ffff;
+       cfg_base_addr &= (u32) 0x0000ffff;
        cfg_base_addr_index = find_PCI_BAR_index(pdev, cfg_base_addr);
        if (cfg_base_addr_index == -1) {
                dev_warn(&pdev->dev, "cannot find cfg_base_addr_index\n");
@@ -3211,11 +3397,14 @@ static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
        h->cfgtable = remap_pci_mem(pci_resource_start(pdev,
                               cfg_base_addr_index) + cfg_offset,
                                sizeof(h->cfgtable));
-       h->board_id = board_id;
-
-       /* Query controller for max supported commands: */
-       h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
+       /* Find performant mode table. */
+       trans_offset = readl(&(h->cfgtable->TransMethodOffset));
+       h->transtable = remap_pci_mem(pci_resource_start(pdev,
+                               cfg_base_addr_index)+cfg_offset+trans_offset,
+                               sizeof(*h->transtable));
 
+       h->board_id = board_id;
+       h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
        h->product_name = products[prod_index].product_name;
        h->access = *(products[prod_index].access);
        /* Allow room for some ioctls */
@@ -3232,7 +3421,7 @@ static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
 #ifdef CONFIG_X86
        {
                /* Need to enable prefetch in the SCSI core for 6400 in x86 */
-               __u32 prefetch;
+               u32 prefetch;
                prefetch = readl(&(h->cfgtable->SCSI_Prefetch));
                prefetch |= 0x100;
                writel(prefetch, &(h->cfgtable->SCSI_Prefetch));
@@ -3244,7 +3433,7 @@ static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
         * physical memory.
         */
        if (board_id == 0x3225103C) {
-               __u32 dma_prefetch;
+               u32 dma_prefetch;
                dma_prefetch = readl(h->vaddr + I2O_DMA1_CFG);
                dma_prefetch |= 0x8000;
                writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
@@ -3286,10 +3475,26 @@ err_out_free_res:
        return err;
 }
 
+static void __devinit hpsa_hba_inquiry(struct ctlr_info *h)
+{
+       int rc;
+
+#define HBA_INQUIRY_BYTE_COUNT 64
+       h->hba_inquiry_data = kmalloc(HBA_INQUIRY_BYTE_COUNT, GFP_KERNEL);
+       if (!h->hba_inquiry_data)
+               return;
+       rc = hpsa_scsi_do_inquiry(h, RAID_CTLR_LUNID, 0,
+               h->hba_inquiry_data, HBA_INQUIRY_BYTE_COUNT);
+       if (rc != 0) {
+               kfree(h->hba_inquiry_data);
+               h->hba_inquiry_data = NULL;
+       }
+}
+
 static int __devinit hpsa_init_one(struct pci_dev *pdev,
                                    const struct pci_device_id *ent)
 {
-       int i;
+       int i, rc;
        int dac;
        struct ctlr_info *h;
 
@@ -3314,17 +3519,23 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
                }
        }
 
-       BUILD_BUG_ON(sizeof(struct CommandList) % 8);
+       /* Command structures must be aligned on a 32-byte boundary because
+        * the 5 lower bits of the address are used by the hardware. and by
+        * the driver.  See comments in hpsa.h for more info.
+        */
+#define COMMANDLIST_ALIGNMENT 32
+       BUILD_BUG_ON(sizeof(struct CommandList) % COMMANDLIST_ALIGNMENT);
        h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return -1;
+               return -ENOMEM;
 
        h->busy_initializing = 1;
        INIT_HLIST_HEAD(&h->cmpQ);
        INIT_HLIST_HEAD(&h->reqQ);
        mutex_init(&h->busy_shutting_down);
        init_completion(&h->scan_wait);
-       if (hpsa_pci_init(h, pdev) != 0)
+       rc = hpsa_pci_init(h, pdev);
+       if (rc != 0)
                goto clean1;
 
        sprintf(h->devname, "hpsa%d", number_of_controllers);
@@ -3333,27 +3544,32 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
        h->pdev = pdev;
 
        /* configure PCI DMA stuff */
-       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
+       rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+       if (rc == 0) {
                dac = 1;
-       else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
-               dac = 0;
-       else {
-               dev_err(&pdev->dev, "no suitable DMA available\n");
-               goto clean1;
+       } else {
+               rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+               if (rc == 0) {
+                       dac = 0;
+               } else {
+                       dev_err(&pdev->dev, "no suitable DMA available\n");
+                       goto clean1;
+               }
        }
 
        /* make sure the board interrupts are off */
        h->access.set_intr_mask(h, HPSA_INTR_OFF);
-       if (request_irq(h->intr[SIMPLE_MODE_INT], do_hpsa_intr,
-                       IRQF_DISABLED | IRQF_SHARED, h->devname, h)) {
+       rc = request_irq(h->intr[PERF_MODE_INT], do_hpsa_intr,
+                       IRQF_DISABLED, h->devname, h);
+       if (rc) {
                dev_err(&pdev->dev, "unable to get irq %d for %s\n",
-                      h->intr[SIMPLE_MODE_INT], h->devname);
+                      h->intr[PERF_MODE_INT], h->devname);
                goto clean2;
        }
 
-       dev_info(&pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n",
-              h->devname, pdev->device, pci_name(pdev),
-              h->intr[SIMPLE_MODE_INT], dac ? "" : " not");
+       dev_info(&pdev->dev, "%s: <0x%x> at IRQ %d%s using DAC\n",
+              h->devname, pdev->device,
+              h->intr[PERF_MODE_INT], dac ? "" : " not");
 
        h->cmd_pool_bits =
            kmalloc(((h->nr_cmds + BITS_PER_LONG -
@@ -3368,9 +3584,13 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
            || (h->cmd_pool == NULL)
            || (h->errinfo_pool == NULL)) {
                dev_err(&pdev->dev, "out of memory");
+               rc = -ENOMEM;
                goto clean4;
        }
        spin_lock_init(&h->lock);
+       spin_lock_init(&h->scan_lock);
+       init_waitqueue_head(&h->scan_wait_queue);
+       h->scan_finished = 1; /* no scan currently in progress */
 
        pci_set_drvdata(pdev, h);
        memset(h->cmd_pool_bits, 0,
@@ -3382,6 +3602,8 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
        /* Turn the interrupts on so we can service requests */
        h->access.set_intr_mask(h, HPSA_INTR_ON);
 
+       hpsa_put_ctlr_into_performant_mode(h);
+       hpsa_hba_inquiry(h);
        hpsa_register_scsi(h);  /* hook ourselves into SCSI subsystem */
        h->busy_initializing = 0;
        return 1;
@@ -3397,12 +3619,12 @@ clean4:
                            h->nr_cmds * sizeof(struct ErrorInfo),
                            h->errinfo_pool,
                            h->errinfo_pool_dhandle);
-       free_irq(h->intr[SIMPLE_MODE_INT], h);
+       free_irq(h->intr[PERF_MODE_INT], h);
 clean2:
 clean1:
        h->busy_initializing = 0;
        kfree(h);
-       return -1;
+       return rc;
 }
 
 static void hpsa_flush_cache(struct ctlr_info *h)
@@ -3441,7 +3663,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
         */
        hpsa_flush_cache(h);
        h->access.set_intr_mask(h, HPSA_INTR_OFF);
-       free_irq(h->intr[2], h);
+       free_irq(h->intr[PERF_MODE_INT], h);
 #ifdef CONFIG_PCI_MSI
        if (h->msix_vector)
                pci_disable_msix(h->pdev);
@@ -3470,7 +3692,11 @@ static void __devexit hpsa_remove_one(struct pci_dev *pdev)
        pci_free_consistent(h->pdev,
                h->nr_cmds * sizeof(struct ErrorInfo),
                h->errinfo_pool, h->errinfo_pool_dhandle);
+       pci_free_consistent(h->pdev, h->reply_pool_size,
+               h->reply_pool, h->reply_pool_dhandle);
        kfree(h->cmd_pool_bits);
+       kfree(h->blockFetchTable);
+       kfree(h->hba_inquiry_data);
        /*
         * Deliberately omit pci_disable_device(): it does something nasty to
         * Smart Array controllers that pci_enable_device does not undo
@@ -3502,6 +3728,129 @@ static struct pci_driver hpsa_pci_driver = {
        .resume = hpsa_resume,
 };
 
+/* Fill in bucket_map[], given nsgs (the max number of
+ * scatter gather elements supported) and bucket[],
+ * which is an array of 8 integers.  The bucket[] array
+ * contains 8 different DMA transfer sizes (in 16
+ * byte increments) which the controller uses to fetch
+ * commands.  This function fills in bucket_map[], which
+ * maps a given number of scatter gather elements to one of
+ * the 8 DMA transfer sizes.  The point of it is to allow the
+ * controller to only do as much DMA as needed to fetch the
+ * command, with the DMA transfer size encoded in the lower
+ * bits of the command address.
+ */
+static void  calc_bucket_map(int bucket[], int num_buckets,
+       int nsgs, int *bucket_map)
+{
+       int i, j, b, size;
+
+       /* even a command with 0 SGs requires 4 blocks */
+#define MINIMUM_TRANSFER_BLOCKS 4
+#define NUM_BUCKETS 8
+       /* Note, bucket_map must have nsgs+1 entries. */
+       for (i = 0; i <= nsgs; i++) {
+               /* Compute size of a command with i SG entries */
+               size = i + MINIMUM_TRANSFER_BLOCKS;
+               b = num_buckets; /* Assume the biggest bucket */
+               /* Find the bucket that is just big enough */
+               for (j = 0; j < 8; j++) {
+                       if (bucket[j] >= size) {
+                               b = j;
+                               break;
+                       }
+               }
+               /* for a command with i SG entries, use bucket b. */
+               bucket_map[i] = b;
+       }
+}
+
+static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
+{
+       u32 trans_support;
+       u64 trans_offset;
+       /*  5 = 1 s/g entry or 4k
+        *  6 = 2 s/g entry or 8k
+        *  8 = 4 s/g entry or 16k
+        * 10 = 6 s/g entry or 24k
+        */
+       int bft[8] = {5, 6, 8, 10, 12, 20, 28, 35}; /* for scatter/gathers */
+       int i = 0;
+       int l = 0;
+       unsigned long register_value;
+
+       trans_support = readl(&(h->cfgtable->TransportSupport));
+       if (!(trans_support & PERFORMANT_MODE))
+               return;
+
+       h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
+       h->max_sg_entries = 32;
+       /* Performant mode ring buffer and supporting data structures */
+       h->reply_pool_size = h->max_commands * sizeof(u64);
+       h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size,
+                               &(h->reply_pool_dhandle));
+
+       /* Need a block fetch table for performant mode */
+       h->blockFetchTable = kmalloc(((h->max_sg_entries+1) *
+                               sizeof(u32)), GFP_KERNEL);
+
+       if ((h->reply_pool == NULL)
+               || (h->blockFetchTable == NULL))
+               goto clean_up;
+
+       h->reply_pool_wraparound = 1; /* spec: init to 1 */
+
+       /* Controller spec: zero out this buffer. */
+       memset(h->reply_pool, 0, h->reply_pool_size);
+       h->reply_pool_head = h->reply_pool;
+
+       trans_offset = readl(&(h->cfgtable->TransMethodOffset));
+       bft[7] = h->max_sg_entries + 4;
+       calc_bucket_map(bft, ARRAY_SIZE(bft), 32, h->blockFetchTable);
+       for (i = 0; i < 8; i++)
+               writel(bft[i], &h->transtable->BlockFetch[i]);
+
+       /* size of controller ring buffer */
+       writel(h->max_commands, &h->transtable->RepQSize);
+       writel(1, &h->transtable->RepQCount);
+       writel(0, &h->transtable->RepQCtrAddrLow32);
+       writel(0, &h->transtable->RepQCtrAddrHigh32);
+       writel(h->reply_pool_dhandle, &h->transtable->RepQAddr0Low32);
+       writel(0, &h->transtable->RepQAddr0High32);
+       writel(CFGTBL_Trans_Performant,
+               &(h->cfgtable->HostWrite.TransportRequest));
+       writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
+       /* under certain very rare conditions, this can take awhile.
+        * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
+        * as we enter this code.) */
+       for (l = 0; l < MAX_CONFIG_WAIT; l++) {
+               register_value = readl(h->vaddr + SA5_DOORBELL);
+               if (!(register_value & CFGTBL_ChangeReq))
+                       break;
+               /* delay and try again */
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(10);
+       }
+       register_value = readl(&(h->cfgtable->TransportActive));
+       if (!(register_value & CFGTBL_Trans_Performant)) {
+               dev_warn(&h->pdev->dev, "unable to get board into"
+                                       " performant mode\n");
+               return;
+       }
+
+       /* Change the access methods to the performant access methods */
+       h->access = SA5_performant_access;
+       h->transMethod = CFGTBL_Trans_Performant;
+
+       return;
+
+clean_up:
+       if (h->reply_pool)
+               pci_free_consistent(h->pdev, h->reply_pool_size,
+                       h->reply_pool, h->reply_pool_dhandle);
+       kfree(h->blockFetchTable);
+}
+
 /*
  *  This is it.  Register the PCI driver information for the cards we control
  *  the OS will call our registered routines when it finds one of our cards.
index 6bd1949144b567d5759cfba92333bbd84c5fe9ea..a0502b3ac17eb297eec8957ad38b9e57fe592d95 100644 (file)
@@ -33,7 +33,7 @@ struct access_method {
                struct CommandList *c);
        void (*set_intr_mask)(struct ctlr_info *h, unsigned long val);
        unsigned long (*fifo_full)(struct ctlr_info *h);
-       unsigned long (*intr_pending)(struct ctlr_info *h);
+       bool (*intr_pending)(struct ctlr_info *h);
        unsigned long (*command_completed)(struct ctlr_info *h);
 };
 
@@ -55,19 +55,20 @@ struct ctlr_info {
        char    *product_name;
        char    firm_ver[4]; /* Firmware version */
        struct pci_dev *pdev;
-       __u32   board_id;
+       u32     board_id;
        void __iomem *vaddr;
        unsigned long paddr;
        int     nr_cmds; /* Number of commands allowed on this controller */
        struct CfgTable __iomem *cfgtable;
+       int     max_sg_entries;
        int     interrupts_enabled;
        int     major;
        int     max_commands;
        int     commands_outstanding;
        int     max_outstanding; /* Debug */
        int     usage_count;  /* number of opens all all minor devices */
-#      define DOORBELL_INT     0
-#      define PERF_MODE_INT    1
+#      define PERF_MODE_INT    0
+#      define DOORBELL_INT     1
 #      define SIMPLE_MODE_INT  2
 #      define MEMQ_MODE_INT    3
        unsigned int intr[4];
@@ -93,6 +94,9 @@ struct ctlr_info {
        int                     nr_frees;
        int                     busy_initializing;
        int                     busy_scanning;
+       int                     scan_finished;
+       spinlock_t              scan_lock;
+       wait_queue_head_t       scan_wait_queue;
        struct mutex            busy_shutting_down;
        struct list_head        scan_list;
        struct completion       scan_wait;
@@ -102,6 +106,24 @@ struct ctlr_info {
        int ndevices; /* number of used elements in .dev[] array. */
 #define HPSA_MAX_SCSI_DEVS_PER_HBA 256
        struct hpsa_scsi_dev_t *dev[HPSA_MAX_SCSI_DEVS_PER_HBA];
+       /*
+        * Performant mode tables.
+        */
+       u32 trans_support;
+       u32 trans_offset;
+       struct TransTable_struct *transtable;
+       unsigned long transMethod;
+
+       /*
+        * Performant mode completion buffer
+        */
+       u64 *reply_pool;
+       dma_addr_t reply_pool_dhandle;
+       u64 *reply_pool_head;
+       size_t reply_pool_size;
+       unsigned char reply_pool_wraparound;
+       u32 *blockFetchTable;
+       unsigned char *hba_inquiry_data;
 };
 #define HPSA_ABORT_MSG 0
 #define HPSA_DEVICE_RESET_MSG 1
@@ -164,9 +186,16 @@ struct ctlr_info {
 #define HPSA_FIRMWARE_READY    0xffff0000 /* value in scratchpad register */
 
 #define HPSA_ERROR_BIT         0x02
-#define HPSA_TAG_CONTAINS_INDEX(tag) ((tag) & 0x04)
-#define HPSA_TAG_TO_INDEX(tag) ((tag) >> 3)
-#define HPSA_TAG_DISCARD_ERROR_BITS(tag) ((tag) & ~3)
+
+/* Performant mode flags */
+#define SA5_PERF_INTR_PENDING   0x04
+#define SA5_PERF_INTR_OFF       0x05
+#define SA5_OUTDB_STATUS_PERF_BIT       0x01
+#define SA5_OUTDB_CLEAR_PERF_BIT        0x01
+#define SA5_OUTDB_CLEAR         0xA0
+#define SA5_OUTDB_CLEAR_PERF_BIT        0x01
+#define SA5_OUTDB_STATUS        0x9C
+
 
 #define HPSA_INTR_ON   1
 #define HPSA_INTR_OFF  0
@@ -176,10 +205,8 @@ struct ctlr_info {
 static void SA5_submit_command(struct ctlr_info *h,
        struct CommandList *c)
 {
-#ifdef HPSA_DEBUG
-        printk(KERN_WARNING "hpsa: Sending %x - down to controller\n",
-               c->busaddr);
-#endif /* HPSA_DEBUG */
+       dev_dbg(&h->pdev->dev, "Sending %x, tag = %x\n", c->busaddr,
+               c->Header.Tag.lower);
        writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
        h->commands_outstanding++;
        if (h->commands_outstanding > h->max_outstanding)
@@ -202,6 +229,52 @@ static void SA5_intr_mask(struct ctlr_info *h, unsigned long val)
                        h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
        }
 }
+
+static void SA5_performant_intr_mask(struct ctlr_info *h, unsigned long val)
+{
+       if (val) { /* turn on interrupts */
+               h->interrupts_enabled = 1;
+               writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
+       } else {
+               h->interrupts_enabled = 0;
+               writel(SA5_PERF_INTR_OFF,
+                       h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
+       }
+}
+
+static unsigned long SA5_performant_completed(struct ctlr_info *h)
+{
+       unsigned long register_value = FIFO_EMPTY;
+
+       /* flush the controller write of the reply queue by reading
+        * outbound doorbell status register.
+        */
+       register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
+       /* msi auto clears the interrupt pending bit. */
+       if (!(h->msi_vector || h->msix_vector)) {
+               writel(SA5_OUTDB_CLEAR_PERF_BIT, h->vaddr + SA5_OUTDB_CLEAR);
+               /* Do a read in order to flush the write to the controller
+                * (as per spec.)
+                */
+               register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
+       }
+
+       if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
+               register_value = *(h->reply_pool_head);
+               (h->reply_pool_head)++;
+               h->commands_outstanding--;
+       } else {
+               register_value = FIFO_EMPTY;
+       }
+       /* Check for wraparound */
+       if (h->reply_pool_head == (h->reply_pool + h->max_commands)) {
+               h->reply_pool_head = h->reply_pool;
+               h->reply_pool_wraparound ^= 1;
+       }
+
+       return register_value;
+}
+
 /*
  *  Returns true if fifo is full.
  *
@@ -228,10 +301,10 @@ static unsigned long SA5_completed(struct ctlr_info *h)
 
 #ifdef HPSA_DEBUG
        if (register_value != FIFO_EMPTY)
-               printk(KERN_INFO "hpsa:  Read %lx back from board\n",
+               dev_dbg(&h->pdev->dev, "Read %lx back from board\n",
                        register_value);
        else
-               printk(KERN_INFO "hpsa:  FIFO Empty read\n");
+               dev_dbg(&h->pdev->dev, "hpsa: FIFO Empty read\n");
 #endif
 
        return register_value;
@@ -239,18 +312,28 @@ static unsigned long SA5_completed(struct ctlr_info *h)
 /*
  *     Returns true if an interrupt is pending..
  */
-static unsigned long SA5_intr_pending(struct ctlr_info *h)
+static bool SA5_intr_pending(struct ctlr_info *h)
 {
        unsigned long register_value  =
                readl(h->vaddr + SA5_INTR_STATUS);
-#ifdef HPSA_DEBUG
-       printk(KERN_INFO "hpsa: intr_pending %lx\n", register_value);
-#endif  /* HPSA_DEBUG */
-       if (register_value &  SA5_INTR_PENDING)
-               return  1;
-       return 0 ;
+       dev_dbg(&h->pdev->dev, "intr_pending %lx\n", register_value);
+       return register_value & SA5_INTR_PENDING;
 }
 
+static bool SA5_performant_intr_pending(struct ctlr_info *h)
+{
+       unsigned long register_value = readl(h->vaddr + SA5_INTR_STATUS);
+
+       if (!register_value)
+               return false;
+
+       if (h->msi_vector || h->msix_vector)
+               return true;
+
+       /* Read outbound doorbell to flush */
+       register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
+       return register_value & SA5_OUTDB_STATUS_PERF_BIT;
+}
 
 static struct access_method SA5_access = {
        SA5_submit_command,
@@ -260,14 +343,19 @@ static struct access_method SA5_access = {
        SA5_completed,
 };
 
+static struct access_method SA5_performant_access = {
+       SA5_submit_command,
+       SA5_performant_intr_mask,
+       SA5_fifo_full,
+       SA5_performant_intr_pending,
+       SA5_performant_completed,
+};
+
 struct board_type {
-       __u32   board_id;
+       u32     board_id;
        char    *product_name;
        struct access_method *access;
 };
 
-
-/* end of old hpsa_scsi.h file */
-
 #endif /* HPSA_H */
 
index 12d71387ed9a9008a1cf89855e5501be6d27a405..3e0abdf7668921005fd42bc58a26b2cc083a75ca 100644 (file)
 #define CFGTBL_AccCmds          0x00000001l
 
 #define CFGTBL_Trans_Simple     0x00000002l
+#define CFGTBL_Trans_Performant 0x00000004l
 
 #define CFGTBL_BusType_Ultra2   0x00000001l
 #define CFGTBL_BusType_Ultra3   0x00000002l
 #define CFGTBL_BusType_Fibre1G  0x00000100l
 #define CFGTBL_BusType_Fibre2G  0x00000200l
 struct vals32 {
-       __u32   lower;
-       __u32   upper;
+       u32   lower;
+       u32   upper;
 };
 
 union u64bit {
        struct vals32 val32;
-       __u64 val;
+       u64 val;
 };
 
 /* FIXME this is a per controller value (barf!) */
@@ -126,34 +127,34 @@ union u64bit {
 
 #define HPSA_INQUIRY 0x12
 struct InquiryData {
-       __u8 data_byte[36];
+       u8 data_byte[36];
 };
 
 #define HPSA_REPORT_LOG 0xc2    /* Report Logical LUNs */
 #define HPSA_REPORT_PHYS 0xc3   /* Report Physical LUNs */
 struct ReportLUNdata {
-       __u8 LUNListLength[4];
-       __u32 reserved;
-       __u8 LUN[HPSA_MAX_LUN][8];
+       u8 LUNListLength[4];
+       u32 reserved;
+       u8 LUN[HPSA_MAX_LUN][8];
 };
 
 struct ReportExtendedLUNdata {
-       __u8 LUNListLength[4];
-       __u8 extended_response_flag;
-       __u8 reserved[3];
-       __u8 LUN[HPSA_MAX_LUN][24];
+       u8 LUNListLength[4];
+       u8 extended_response_flag;
+       u8 reserved[3];
+       u8 LUN[HPSA_MAX_LUN][24];
 };
 
 struct SenseSubsystem_info {
-       __u8 reserved[36];
-       __u8 portname[8];
-       __u8 reserved1[1108];
+       u8 reserved[36];
+       u8 portname[8];
+       u8 reserved1[1108];
 };
 
 #define HPSA_READ_CAPACITY 0x25 /* Read Capacity */
 struct ReadCapdata {
-       __u8 total_size[4];     /* Total size in blocks */
-       __u8 block_size[4];     /* Size of blocks in bytes */
+       u8 total_size[4];       /* Total size in blocks */
+       u8 block_size[4];       /* Size of blocks in bytes */
 };
 
 #if 0
@@ -174,112 +175,131 @@ struct ReadCapdata {
 /* Command List Structure */
 union SCSI3Addr {
        struct {
-               __u8 Dev;
-               __u8 Bus:6;
-               __u8 Mode:2;        /* b00 */
+               u8 Dev;
+               u8 Bus:6;
+               u8 Mode:2;        /* b00 */
        } PeripDev;
        struct {
-               __u8 DevLSB;
-               __u8 DevMSB:6;
-               __u8 Mode:2;        /* b01 */
+               u8 DevLSB;
+               u8 DevMSB:6;
+               u8 Mode:2;        /* b01 */
        } LogDev;
        struct {
-               __u8 Dev:5;
-               __u8 Bus:3;
-               __u8 Targ:6;
-               __u8 Mode:2;        /* b10 */
+               u8 Dev:5;
+               u8 Bus:3;
+               u8 Targ:6;
+               u8 Mode:2;        /* b10 */
        } LogUnit;
 };
 
 struct PhysDevAddr {
-       __u32             TargetId:24;
-       __u32             Bus:6;
-       __u32             Mode:2;
+       u32             TargetId:24;
+       u32             Bus:6;
+       u32             Mode:2;
        /* 2 level target device addr */
        union SCSI3Addr  Target[2];
 };
 
 struct LogDevAddr {
-       __u32            VolId:30;
-       __u32            Mode:2;
-       __u8             reserved[4];
+       u32            VolId:30;
+       u32            Mode:2;
+       u8             reserved[4];
 };
 
 union LUNAddr {
-       __u8               LunAddrBytes[8];
+       u8               LunAddrBytes[8];
        union SCSI3Addr    SCSI3Lun[4];
        struct PhysDevAddr PhysDev;
        struct LogDevAddr  LogDev;
 };
 
 struct CommandListHeader {
-       __u8              ReplyQueue;
-       __u8              SGList;
-       __u16             SGTotal;
+       u8              ReplyQueue;
+       u8              SGList;
+       u16             SGTotal;
        struct vals32     Tag;
        union LUNAddr     LUN;
 };
 
 struct RequestBlock {
-       __u8   CDBLen;
+       u8   CDBLen;
        struct {
-               __u8 Type:3;
-               __u8 Attribute:3;
-               __u8 Direction:2;
+               u8 Type:3;
+               u8 Attribute:3;
+               u8 Direction:2;
        } Type;
-       __u16  Timeout;
-       __u8   CDB[16];
+       u16  Timeout;
+       u8   CDB[16];
 };
 
 struct ErrDescriptor {
        struct vals32 Addr;
-       __u32  Len;
+       u32  Len;
 };
 
 struct SGDescriptor {
        struct vals32 Addr;
-       __u32  Len;
-       __u32  Ext;
+       u32  Len;
+       u32  Ext;
 };
 
 union MoreErrInfo {
        struct {
-               __u8  Reserved[3];
-               __u8  Type;
-               __u32 ErrorInfo;
+               u8  Reserved[3];
+               u8  Type;
+               u32 ErrorInfo;
        } Common_Info;
        struct {
-               __u8  Reserved[2];
-               __u8  offense_size; /* size of offending entry */
-               __u8  offense_num;  /* byte # of offense 0-base */
-               __u32 offense_value;
+               u8  Reserved[2];
+               u8  offense_size; /* size of offending entry */
+               u8  offense_num;  /* byte # of offense 0-base */
+               u32 offense_value;
        } Invalid_Cmd;
 };
 struct ErrorInfo {
-       __u8               ScsiStatus;
-       __u8               SenseLen;
-       __u16              CommandStatus;
-       __u32              ResidualCnt;
+       u8               ScsiStatus;
+       u8               SenseLen;
+       u16              CommandStatus;
+       u32              ResidualCnt;
        union MoreErrInfo  MoreErrInfo;
-       __u8               SenseInfo[SENSEINFOBYTES];
+       u8               SenseInfo[SENSEINFOBYTES];
 };
 /* Command types */
 #define CMD_IOCTL_PEND  0x01
 #define CMD_SCSI       0x03
 
+/* This structure needs to be divisible by 32 for new
+ * indexing method and performant mode.
+ */
+#define PAD32 32
+#define PAD64DIFF 0
+#define USEEXTRA ((sizeof(void *) - 4)/4)
+#define PADSIZE (PAD32 + PAD64DIFF * USEEXTRA)
+
+#define DIRECT_LOOKUP_SHIFT 5
+#define DIRECT_LOOKUP_BIT 0x10
+
+#define HPSA_ERROR_BIT          0x02
 struct ctlr_info; /* defined in hpsa.h */
-/* The size of this structure needs to be divisible by 8
- * od on all architectures, because the controller uses 2
- * lower bits of the address, and the driver uses 1 lower
- * bit (3 bits total.)
+/* The size of this structure needs to be divisible by 32
+ * on all architectures because low 5 bits of the addresses
+ * are used as follows:
+ *
+ * bit 0: to device, used to indicate "performant mode" command
+ *        from device, indidcates error status.
+ * bit 1-3: to device, indicates block fetch table entry for
+ *          reducing DMA in fetching commands from host memory.
+ * bit 4: used to indicate whether tag is "direct lookup" (index),
+ *        or a bus address.
  */
+
 struct CommandList {
        struct CommandListHeader Header;
        struct RequestBlock      Request;
        struct ErrDescriptor     ErrDesc;
        struct SGDescriptor      SG[MAXSGENTRIES];
        /* information associated with the command */
-       __u32                      busaddr; /* physical addr of this record */
+       u32                        busaddr; /* physical addr of this record */
        struct ErrorInfo *err_info; /* pointer to the allocated mem */
        struct ctlr_info           *h;
        int                        cmd_type;
@@ -291,35 +311,63 @@ struct CommandList {
        struct completion *waiting;
        int      retry_count;
        void   *scsi_cmd;
+
+/* on 64 bit architectures, to get this to be 32-byte-aligned
+ * it so happens we need no padding, on 32 bit systems,
+ * we need 8 bytes of padding.   This does that.
+ */
+#define COMMANDLIST_PAD ((8 - sizeof(long))/4 * 8)
+       u8 pad[COMMANDLIST_PAD];
+
 };
 
 /* Configuration Table Structure */
 struct HostWrite {
-       __u32 TransportRequest;
-       __u32 Reserved;
-       __u32 CoalIntDelay;
-       __u32 CoalIntCount;
+       u32 TransportRequest;
+       u32 Reserved;
+       u32 CoalIntDelay;
+       u32 CoalIntCount;
 };
 
+#define SIMPLE_MODE     0x02
+#define PERFORMANT_MODE 0x04
+#define MEMQ_MODE       0x08
+
 struct CfgTable {
-       __u8             Signature[4];
-       __u32            SpecValence;
-       __u32            TransportSupport;
-       __u32            TransportActive;
-       struct HostWrite HostWrite;
-       __u32            CmdsOutMax;
-       __u32            BusTypes;
-       __u32            Reserved;
-       __u8             ServerName[16];
-       __u32            HeartBeat;
-       __u32            SCSI_Prefetch;
+       u8            Signature[4];
+       u32             SpecValence;
+       u32           TransportSupport;
+       u32           TransportActive;
+       struct          HostWrite HostWrite;
+       u32           CmdsOutMax;
+       u32           BusTypes;
+       u32           TransMethodOffset;
+       u8            ServerName[16];
+       u32           HeartBeat;
+       u32           SCSI_Prefetch;
+       u32             MaxScatterGatherElements;
+       u32             MaxLogicalUnits;
+       u32             MaxPhysicalDevices;
+       u32             MaxPhysicalDrivesPerLogicalUnit;
+       u32             MaxPerformantModeCommands;
+};
+
+#define NUM_BLOCKFETCH_ENTRIES 8
+struct TransTable_struct {
+       u32            BlockFetch[NUM_BLOCKFETCH_ENTRIES];
+       u32            RepQSize;
+       u32            RepQCount;
+       u32            RepQCtrAddrLow32;
+       u32            RepQCtrAddrHigh32;
+       u32            RepQAddr0Low32;
+       u32            RepQAddr0High32;
 };
 
 struct hpsa_pci_info {
        unsigned char   bus;
        unsigned char   dev_fn;
        unsigned short  domain;
-       __u32           board_id;
+       u32             board_id;
 };
 
 #pragma pack()
index 9c1e6a5b5af0ab9755f4fd69cda41f8fce91b9ca..9a4b69d4f4eb0d80c47117963cecbef3b2a1ebc2 100644 (file)
@@ -2336,7 +2336,7 @@ static int option_setup(char *str)
        char *cur = str;
        int i = 1;
 
-       while (cur && isdigit(*cur) && i <= IM_MAX_HOSTS) {
+       while (cur && isdigit(*cur) && i < IM_MAX_HOSTS) {
                ints[i++] = simple_strtoul(cur, NULL, 0);
                if ((cur = strchr(cur, ',')) != NULL)
                        cur++;
index e475b7957c2d03167dbc3a027b36f2b4a74802cd..e3a18e0ef276511e33061eb86b8cfb5f8f763241 100644 (file)
@@ -40,7 +40,7 @@
  * (CRQ), which is just a buffer of 16 byte entries in the receiver's 
  * Senders cannot access the buffer directly, but send messages by
  * making a hypervisor call and passing in the 16 bytes.  The hypervisor
- * puts the message in the next 16 byte space in round-robbin fashion,
+ * puts the message in the next 16 byte space in round-robin fashion,
  * turns on the high order bit of the message (the valid bit), and 
  * generates an interrupt to the receiver (if interrupts are turned on.) 
  * The receiver just turns off the valid bit when they have copied out
index 517da3fd89d30a24bb2c04c0c4a5d3ce86bbe26a..8a89ba9005881b9bd07a5e46d85346161cc7d9a4 100644 (file)
@@ -584,9 +584,10 @@ static void iscsi_sw_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
        struct iscsi_conn *conn = cls_conn->dd_data;
        struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
        struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
+       struct socket *sock = tcp_sw_conn->sock;
 
        /* userspace may have goofed up and not bound us */
-       if (!tcp_sw_conn->sock)
+       if (!sock)
                return;
        /*
         * Make sure our recv side is stopped.
@@ -597,6 +598,11 @@ static void iscsi_sw_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
        set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
        write_unlock_bh(&tcp_sw_conn->sock->sk->sk_callback_lock);
 
+       if (sock->sk->sk_sleep && waitqueue_active(sock->sk->sk_sleep)) {
+               sock->sk->sk_err = EIO;
+               wake_up_interruptible(sock->sk->sk_sleep);
+       }
+
        iscsi_conn_stop(cls_conn, flag);
        iscsi_sw_tcp_release_conn(conn);
 }
index 19d711cb938c72e7b2a096bde9eca85662e9c3f9..7f4364770e4a5b90050e28fbc5cbe8fb634e8e88 100644 (file)
@@ -1890,7 +1890,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
        fc_exch_setup_hdr(ep, fp, ep->f_ctl);
        sp->cnt++;
 
-       if (ep->xid <= lport->lro_xid)
+       if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD)
                fc_fcp_ddp_setup(fr_fsp(fp), ep->xid);
 
        if (unlikely(lport->tt.frame_send(lport, fp)))
index 881d5dfe8c74f5a37c58474690c832d1d1ac1a78..6fde2fabfd9bd920864ab18335093c03588ed8d7 100644 (file)
@@ -298,9 +298,6 @@ void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid)
 {
        struct fc_lport *lport;
 
-       if (!fsp)
-               return;
-
        lport = fsp->lp;
        if ((fsp->req_flags & FC_SRB_READ) &&
            (lport->lro_enabled) && (lport->tt.ddp_setup)) {
index 0b165024a2196a2458f546296bd3471b6e9dd8e3..7ec8ce75007c06ba4bcbe02b3dd81071818c394e 100644 (file)
@@ -1800,7 +1800,8 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
        u32 did;
 
        job->reply->reply_payload_rcv_len = 0;
-       rsp->resid_len = job->reply_payload.payload_len;
+       if (rsp)
+               rsp->resid_len = job->reply_payload.payload_len;
 
        mutex_lock(&lport->lp_mutex);
 
index 02300523b2341c77d9c4015bafab120f96d229ce..97923bb07765e60cc43c121666c0e9b19a4734fb 100644 (file)
@@ -623,7 +623,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
 
                tov = ntohl(plp->fl_csp.sp_e_d_tov);
                if (ntohs(plp->fl_csp.sp_features) & FC_SP_FT_EDTR)
-                       tov /= 1000;
+                       tov /= 1000000;
                if (tov > rdata->e_d_tov)
                        rdata->e_d_tov = tov;
                csp_seq = ntohs(plp->fl_csp.sp_tot_seq);
index c28a712fd4db58dfa0880d4df60cf17af0719622..703eb6a88790280c788b9fb88ce331d15ff282e1 100644 (file)
@@ -1919,10 +1919,11 @@ static int iscsi_has_ping_timed_out(struct iscsi_conn *conn)
 static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
 {
        enum blk_eh_timer_return rc = BLK_EH_NOT_HANDLED;
-       struct iscsi_task *task = NULL;
+       struct iscsi_task *task = NULL, *running_task;
        struct iscsi_cls_session *cls_session;
        struct iscsi_session *session;
        struct iscsi_conn *conn;
+       int i;
 
        cls_session = starget_to_session(scsi_target(sc->device));
        session = cls_session->dd_data;
@@ -1947,8 +1948,15 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
        }
 
        task = (struct iscsi_task *)sc->SCp.ptr;
-       if (!task)
+       if (!task) {
+               /*
+                * Raced with completion. Just reset timer, and let it
+                * complete normally
+                */
+               rc = BLK_EH_RESET_TIMER;
                goto done;
+       }
+
        /*
         * If we have sent (at least queued to the network layer) a pdu or
         * recvd one for the task since the last timeout ask for
@@ -1956,10 +1964,10 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
         * we can check if it is the task or connection when we send the
         * nop as a ping.
         */
-       if (time_after_eq(task->last_xfer, task->last_timeout)) {
+       if (time_after(task->last_xfer, task->last_timeout)) {
                ISCSI_DBG_EH(session, "Command making progress. Asking "
                             "scsi-ml for more time to complete. "
-                            "Last data recv at %lu. Last timeout was at "
+                            "Last data xfer at %lu. Last timeout was at "
                             "%lu\n.", task->last_xfer, task->last_timeout);
                task->have_checked_conn = false;
                rc = BLK_EH_RESET_TIMER;
@@ -1977,6 +1985,43 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
                goto done;
        }
 
+       for (i = 0; i < conn->session->cmds_max; i++) {
+               running_task = conn->session->cmds[i];
+               if (!running_task->sc || running_task == task ||
+                    running_task->state != ISCSI_TASK_RUNNING)
+                       continue;
+
+               /*
+                * Only check if cmds started before this one have made
+                * progress, or this could never fail
+                */
+               if (time_after(running_task->sc->jiffies_at_alloc,
+                              task->sc->jiffies_at_alloc))
+                       continue;
+
+               if (time_after(running_task->last_xfer, task->last_timeout)) {
+                       /*
+                        * This task has not made progress, but a task
+                        * started before us has transferred data since
+                        * we started/last-checked. We could be queueing
+                        * too many tasks or the LU is bad.
+                        *
+                        * If the device is bad the cmds ahead of us on
+                        * other devs will complete, and this loop will
+                        * eventually fail starting the scsi eh.
+                        */
+                       ISCSI_DBG_EH(session, "Command has not made progress "
+                                    "but commands ahead of it have. "
+                                    "Asking scsi-ml for more time to "
+                                    "complete. Our last xfer vs running task "
+                                    "last xfer %lu/%lu. Last check %lu.\n",
+                                    task->last_xfer, running_task->last_xfer,
+                                    task->last_timeout);
+                       rc = BLK_EH_RESET_TIMER;
+                       goto done;
+               }
+       }
+
        /* Assumes nop timeout is shorter than scsi cmd timeout */
        if (task->have_checked_conn)
                goto done;
index db6856c138fcd9d28af1c422bc2c0333540de328..4ad87fd74ddd926be593e684ca3d9c0f37bb9917 100644 (file)
@@ -992,12 +992,10 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task)
                if (r2t == NULL) {
                        if (kfifo_out(&tcp_task->r2tqueue,
                            (void *)&tcp_task->r2t, sizeof(void *)) !=
-                           sizeof(void *)) {
-                               WARN_ONCE(1, "unexpected fifo state");
+                           sizeof(void *))
                                r2t = NULL;
-                       }
-
-                       r2t = tcp_task->r2t;
+                       else
+                               r2t = tcp_task->r2t;
                }
                spin_unlock_bh(&session->lock);
        }
index ab19b3b4be524a679774601f2193da98bfa369d9..22775165bf6ad79371b72db2055ee5e93a465d23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SCSI RDAM Protocol lib functions
+ * SCSI RDMA Protocol lib functions
  *
  * Copyright (C) 2006 FUJITA Tomonori <tomof@acm.org>
  *
@@ -328,7 +328,7 @@ int srp_transfer_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
        int offset, err = 0;
        u8 format;
 
-       offset = cmd->add_cdb_len * 4;
+       offset = cmd->add_cdb_len & ~3;
 
        dir = srp_cmd_direction(cmd);
        if (dir == DMA_FROM_DEVICE)
@@ -366,7 +366,7 @@ static int vscsis_data_length(struct srp_cmd *cmd, enum dma_data_direction dir)
 {
        struct srp_direct_buf *md;
        struct srp_indirect_buf *id;
-       int len = 0, offset = cmd->add_cdb_len * 4;
+       int len = 0, offset = cmd->add_cdb_len & ~3;
        u8 fmt;
 
        if (dir == DMA_TO_DEVICE)
@@ -440,6 +440,6 @@ int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info,
 }
 EXPORT_SYMBOL_GPL(srp_cmd_queue);
 
-MODULE_DESCRIPTION("SCSI RDAM Protocol lib functions");
+MODULE_DESCRIPTION("SCSI RDMA Protocol lib functions");
 MODULE_AUTHOR("FUJITA Tomonori");
 MODULE_LICENSE("GPL");
index 1cc23a69db5e70aa8dfc7e0667612264090705a0..84b696463a585a684cc5055572a7953bb03da5f8 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
@@ -315,6 +315,9 @@ struct lpfc_vport {
 #define FC_VPORT_NEEDS_REG_VPI 0x80000  /* Needs to have its vpi registered */
 #define FC_RSCN_DEFERRED       0x100000 /* A deferred RSCN being processed */
 #define FC_VPORT_NEEDS_INIT_VPI 0x200000 /* Need to INIT_VPI before FDISC */
+#define FC_VPORT_CVL_RCVD      0x400000 /* VLink failed due to CVL      */
+#define FC_VFI_REGISTERED      0x800000 /* VFI is registered */
+#define FC_FDISC_COMPLETED     0x1000000/* FDISC completed */
 
        uint32_t ct_flags;
 #define FC_CT_RFF_ID           0x1      /* RFF_ID accepted by switch */
@@ -448,6 +451,8 @@ struct unsol_rcv_ct_ctx {
        uint32_t ctxt_id;
        uint32_t SID;
        uint32_t oxid;
+       uint32_t flags;
+#define UNSOL_VALID    0x00000001
 };
 
 struct lpfc_hba {
@@ -499,6 +504,10 @@ struct lpfc_hba {
                (struct lpfc_hba *);
        void (*lpfc_stop_port)
                (struct lpfc_hba *);
+       int (*lpfc_hba_init_link)
+               (struct lpfc_hba *);
+       int (*lpfc_hba_down_link)
+               (struct lpfc_hba *);
 
 
        /* SLI4 specific HBA data structure */
@@ -613,6 +622,7 @@ struct lpfc_hba {
        uint32_t cfg_enable_bg;
        uint32_t cfg_log_verbose;
        uint32_t cfg_aer_support;
+       uint32_t cfg_suppress_link_up;
 
        lpfc_vpd_t vpd;         /* vital product data */
 
@@ -790,7 +800,7 @@ struct lpfc_hba {
        uint16_t vlan_id;
        struct list_head fcf_conn_rec_list;
 
-       struct mutex ct_event_mutex; /* synchronize access to ct_ev_waiters */
+       spinlock_t ct_ev_lock; /* synchronize access to ct_ev_waiters */
        struct list_head ct_ev_waiters;
        struct unsol_rcv_ct_ctx ct_ctx[64];
        uint32_t ctx_idx;
index 91542f786edfb61500b7595d77ef20e78b8dea20..c992e8328f9e4a5fe6bd6bc428c89a819034e7c0 100644 (file)
@@ -481,6 +481,41 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr,
        return len;
 }
 
+/**
+ * lpfc_link_state_store - Transition the link_state on an HBA port
+ * @dev: class device that is converted into a Scsi_host.
+ * @attr: device attribute, not used.
+ * @buf: one or more lpfc_polling_flags values.
+ * @count: not used.
+ *
+ * Returns:
+ * -EINVAL if the buffer is not "up" or "down"
+ * return from link state change function if non-zero
+ * length of the buf on success
+ **/
+static ssize_t
+lpfc_link_state_store(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t count)
+{
+       struct Scsi_Host  *shost = class_to_shost(dev);
+       struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
+       struct lpfc_hba   *phba = vport->phba;
+
+       int status = -EINVAL;
+
+       if ((strncmp(buf, "up", sizeof("up") - 1) == 0) &&
+                       (phba->link_state == LPFC_LINK_DOWN))
+               status = phba->lpfc_hba_init_link(phba);
+       else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) &&
+                       (phba->link_state >= LPFC_LINK_UP))
+               status = phba->lpfc_hba_down_link(phba);
+
+       if (status == 0)
+               return strlen(buf);
+       else
+               return status;
+}
+
 /**
  * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
  * @dev: class device that is converted into a Scsi_host.
@@ -1219,7 +1254,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
        struct lpfc_hba   *phba = vport->phba;\
-       int val = 0;\
+       uint val = 0;\
        val = phba->cfg_##attr;\
        return snprintf(buf, PAGE_SIZE, "%d\n",\
                        phba->cfg_##attr);\
@@ -1247,7 +1282,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
        struct lpfc_hba   *phba = vport->phba;\
-       int val = 0;\
+       uint val = 0;\
        val = phba->cfg_##attr;\
        return snprintf(buf, PAGE_SIZE, "%#x\n",\
                        phba->cfg_##attr);\
@@ -1274,7 +1309,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
  **/
 #define lpfc_param_init(attr, default, minval, maxval) \
 static int \
-lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
+lpfc_##attr##_init(struct lpfc_hba *phba, uint val) \
 { \
        if (val >= minval && val <= maxval) {\
                phba->cfg_##attr = val;\
@@ -1309,7 +1344,7 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
  **/
 #define lpfc_param_set(attr, default, minval, maxval)  \
 static int \
-lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
+lpfc_##attr##_set(struct lpfc_hba *phba, uint val) \
 { \
        if (val >= minval && val <= maxval) {\
                phba->cfg_##attr = val;\
@@ -1350,7 +1385,7 @@ lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
        struct lpfc_hba   *phba = vport->phba;\
-       int val=0;\
+       uint val = 0;\
        if (!isdigit(buf[0]))\
                return -EINVAL;\
        if (sscanf(buf, "%i", &val) != 1)\
@@ -1382,7 +1417,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
 { \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
-       int val = 0;\
+       uint val = 0;\
        val = vport->cfg_##attr;\
        return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
 }
@@ -1409,7 +1444,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
 { \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
-       int val = 0;\
+       uint val = 0;\
        val = vport->cfg_##attr;\
        return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
 }
@@ -1434,7 +1469,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
  **/
 #define lpfc_vport_param_init(attr, default, minval, maxval)   \
 static int \
-lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
+lpfc_##attr##_init(struct lpfc_vport *vport, uint val) \
 { \
        if (val >= minval && val <= maxval) {\
                vport->cfg_##attr = val;\
@@ -1466,7 +1501,7 @@ lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
  **/
 #define lpfc_vport_param_set(attr, default, minval, maxval)    \
 static int \
-lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
+lpfc_##attr##_set(struct lpfc_vport *vport, uint val) \
 { \
        if (val >= minval && val <= maxval) {\
                vport->cfg_##attr = val;\
@@ -1502,7 +1537,7 @@ lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
 { \
        struct Scsi_Host  *shost = class_to_shost(dev);\
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
-       int val=0;\
+       uint val = 0;\
        if (!isdigit(buf[0]))\
                return -EINVAL;\
        if (sscanf(buf, "%i", &val) != 1)\
@@ -1515,22 +1550,22 @@ lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
 
 
 #define LPFC_ATTR(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_param_init(name, defval, minval, maxval)
 
 #define LPFC_ATTR_R(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_param_show(name)\
 lpfc_param_init(name, defval, minval, maxval)\
 static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
 
 #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_param_show(name)\
 lpfc_param_init(name, defval, minval, maxval)\
@@ -1540,16 +1575,16 @@ static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
                   lpfc_##name##_show, lpfc_##name##_store)
 
 #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_param_hex_show(name)\
 lpfc_param_init(name, defval, minval, maxval)\
 static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
 
 #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_param_hex_show(name)\
 lpfc_param_init(name, defval, minval, maxval)\
@@ -1559,22 +1594,22 @@ static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
                   lpfc_##name##_show, lpfc_##name##_store)
 
 #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_vport_param_init(name, defval, minval, maxval)
 
 #define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_vport_param_show(name)\
 lpfc_vport_param_init(name, defval, minval, maxval)\
 static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
 
 #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_vport_param_show(name)\
 lpfc_vport_param_init(name, defval, minval, maxval)\
@@ -1584,16 +1619,16 @@ static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
                   lpfc_##name##_show, lpfc_##name##_store)
 
 #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_vport_param_hex_show(name)\
 lpfc_vport_param_init(name, defval, minval, maxval)\
 static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
 
 #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
-static int lpfc_##name = defval;\
-module_param(lpfc_##name, int, 0);\
+static uint lpfc_##name = defval;\
+module_param(lpfc_##name, uint, 0);\
 MODULE_PARM_DESC(lpfc_##name, desc);\
 lpfc_vport_param_hex_show(name)\
 lpfc_vport_param_init(name, defval, minval, maxval)\
@@ -1614,7 +1649,8 @@ static DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL);
 static DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL);
 static DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL);
 static DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL);
-static DEVICE_ATTR(link_state, S_IRUGO, lpfc_link_state_show, NULL);
+static DEVICE_ATTR(link_state, S_IRUGO | S_IWUSR, lpfc_link_state_show,
+               lpfc_link_state_store);
 static DEVICE_ATTR(option_rom_version, S_IRUGO,
                   lpfc_option_rom_version_show, NULL);
 static DEVICE_ATTR(num_discovered_ports, S_IRUGO,
@@ -1896,6 +1932,15 @@ lpfc_param_init(enable_npiv, 0, 0, 1);
 static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO,
                         lpfc_enable_npiv_show, NULL);
 
+/*
+# lpfc_suppress_link_up:  Bring link up at initialization
+#            0x0  = bring link up (issue MBX_INIT_LINK)
+#            0x1  = do NOT bring link up at initialization(MBX_INIT_LINK)
+#            0x2  = never bring up link
+# Default value is 0.
+*/
+LPFC_ATTR_R(suppress_link_up, 0, 0, 2, "Suppress Link Up at initialization");
+
 /*
 # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
 # until the timer expires. Value range is [0,255]. Default value is 30.
@@ -3114,12 +3159,12 @@ LPFC_ATTR_RW(poll_tmo, 10, 1, 255,
 /*
 # lpfc_use_msi: Use MSI (Message Signaled Interrupts) in systems that
 #              support this feature
-#       0  = MSI disabled (default)
+#       0  = MSI disabled
 #       1  = MSI enabled
-#       2  = MSI-X enabled
-# Value range is [0,2]. Default value is 0.
+#       2  = MSI-X enabled (default)
+# Value range is [0,2]. Default value is 2.
 */
-LPFC_ATTR_R(use_msi, 0, 0, 2, "Use Message Signaled Interrupts (1) or "
+LPFC_ATTR_R(use_msi, 2, 0, 2, "Use Message Signaled Interrupts (1) or "
            "MSI-X (2), if possible");
 
 /*
@@ -3278,6 +3323,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_prot_sg_seg_cnt,
        &dev_attr_lpfc_aer_support,
        &dev_attr_lpfc_aer_state_cleanup,
+       &dev_attr_lpfc_suppress_link_up,
        NULL,
 };
 
@@ -4456,7 +4502,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
        lpfc_hba_log_verbose_init(phba, lpfc_log_verbose);
        lpfc_aer_support_init(phba, lpfc_aer_support);
-
+       lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);
        return;
 }
 
index a5d9048235d989ffc0f86721ff334e6d70c7d589..f3f1bf1a0a719e24c93962f1d2fc4e5e98fb340b 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2009 Emulex.  All rights reserved.                *
+ * Copyright (C) 2009-2010 Emulex.  All rights reserved.                *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/mempool.h>
 #include <linux/pci.h>
+#include <linux/delay.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
@@ -33,6 +34,7 @@
 #include "lpfc_sli.h"
 #include "lpfc_sli4.h"
 #include "lpfc_nl.h"
+#include "lpfc_bsg.h"
 #include "lpfc_disc.h"
 #include "lpfc_scsi.h"
 #include "lpfc.h"
 #include "lpfc_vport.h"
 #include "lpfc_version.h"
 
+struct lpfc_bsg_event {
+       struct list_head node;
+       struct kref kref;
+       wait_queue_head_t wq;
+
+       /* Event type and waiter identifiers */
+       uint32_t type_mask;
+       uint32_t req_id;
+       uint32_t reg_id;
+
+       /* next two flags are here for the auto-delete logic */
+       unsigned long wait_time_stamp;
+       int waiting;
+
+       /* seen and not seen events */
+       struct list_head events_to_get;
+       struct list_head events_to_see;
+
+       /* job waiting for this event to finish */
+       struct fc_bsg_job *set_job;
+};
+
+struct lpfc_bsg_iocb {
+       struct lpfc_iocbq *cmdiocbq;
+       struct lpfc_iocbq *rspiocbq;
+       struct lpfc_dmabuf *bmp;
+       struct lpfc_nodelist *ndlp;
+
+       /* job waiting for this iocb to finish */
+       struct fc_bsg_job *set_job;
+};
+
+struct lpfc_bsg_mbox {
+       LPFC_MBOXQ_t *pmboxq;
+       MAILBOX_t *mb;
+
+       /* job waiting for this mbox command to finish */
+       struct fc_bsg_job *set_job;
+};
+
+#define TYPE_EVT       1
+#define TYPE_IOCB      2
+#define TYPE_MBOX      3
+struct bsg_job_data {
+       uint32_t type;
+       union {
+               struct lpfc_bsg_event *evt;
+               struct lpfc_bsg_iocb iocb;
+               struct lpfc_bsg_mbox mbox;
+       } context_un;
+};
+
+struct event_data {
+       struct list_head node;
+       uint32_t type;
+       uint32_t immed_dat;
+       void *data;
+       uint32_t len;
+};
+
+#define BUF_SZ_4K 4096
+#define SLI_CT_ELX_LOOPBACK 0x10
+
+enum ELX_LOOPBACK_CMD {
+       ELX_LOOPBACK_XRI_SETUP,
+       ELX_LOOPBACK_DATA,
+};
+
+#define ELX_LOOPBACK_HEADER_SZ \
+       (size_t)(&((struct lpfc_sli_ct_request *)NULL)->un)
+
+struct lpfc_dmabufext {
+       struct lpfc_dmabuf dma;
+       uint32_t size;
+       uint32_t flag;
+};
+
+/**
+ * lpfc_bsg_send_mgmt_cmd_cmp - lpfc_bsg_send_mgmt_cmd's completion handler
+ * @phba: Pointer to HBA context object.
+ * @cmdiocbq: Pointer to command iocb.
+ * @rspiocbq: Pointer to response iocb.
+ *
+ * This function is the completion handler for iocbs issued using
+ * lpfc_bsg_send_mgmt_cmd function. This function is called by the
+ * ring event handler function without any lock held. This function
+ * can be called from both worker thread context and interrupt
+ * context. This function also can be called from another thread which
+ * cleans up the SLI layer objects.
+ * This function copies the contents of the response iocb to the
+ * response iocb memory object provided by the caller of
+ * lpfc_sli_issue_iocb_wait and then wakes up the thread which
+ * sleeps for the iocb completion.
+ **/
+static void
+lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
+                       struct lpfc_iocbq *cmdiocbq,
+                       struct lpfc_iocbq *rspiocbq)
+{
+       unsigned long iflags;
+       struct bsg_job_data *dd_data;
+       struct fc_bsg_job *job;
+       IOCB_t *rsp;
+       struct lpfc_dmabuf *bmp;
+       struct lpfc_nodelist *ndlp;
+       struct lpfc_bsg_iocb *iocb;
+       unsigned long flags;
+       int rc = 0;
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       dd_data = cmdiocbq->context1;
+       if (!dd_data) {
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               return;
+       }
+
+       iocb = &dd_data->context_un.iocb;
+       job = iocb->set_job;
+       job->dd_data = NULL; /* so timeout handler does not reply */
+
+       spin_lock_irqsave(&phba->hbalock, iflags);
+       cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
+       if (cmdiocbq->context2 && rspiocbq)
+               memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
+                      &rspiocbq->iocb, sizeof(IOCB_t));
+       spin_unlock_irqrestore(&phba->hbalock, iflags);
+
+       bmp = iocb->bmp;
+       rspiocbq = iocb->rspiocbq;
+       rsp = &rspiocbq->iocb;
+       ndlp = iocb->ndlp;
+
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                    job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
+                    job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+
+       if (rsp->ulpStatus) {
+               if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
+                       switch (rsp->un.ulpWord[4] & 0xff) {
+                       case IOERR_SEQUENCE_TIMEOUT:
+                               rc = -ETIMEDOUT;
+                               break;
+                       case IOERR_INVALID_RPI:
+                               rc = -EFAULT;
+                               break;
+                       default:
+                               rc = -EACCES;
+                               break;
+                       }
+               } else
+                       rc = -EACCES;
+       } else
+               job->reply->reply_payload_rcv_len =
+                       rsp->un.genreq64.bdl.bdeSize;
+
+       lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
+       lpfc_sli_release_iocbq(phba, rspiocbq);
+       lpfc_sli_release_iocbq(phba, cmdiocbq);
+       lpfc_nlp_put(ndlp);
+       kfree(bmp);
+       kfree(dd_data);
+       /* make error code available to userspace */
+       job->reply->result = rc;
+       /* complete the job back to userspace */
+       job->job_done(job);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       return;
+}
+
 /**
- * lpfc_bsg_rport_ct - send a CT command from a bsg request
+ * lpfc_bsg_send_mgmt_cmd - send a CT command from a bsg request
  * @job: fc_bsg_job to handle
- */
+ **/
 static int
-lpfc_bsg_rport_ct(struct fc_bsg_job *job)
+lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job)
 {
-       struct Scsi_Host *shost = job->shost;
        struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
        struct lpfc_hba *phba = vport->phba;
        struct lpfc_rport_data *rdata = job->rport->dd_data;
@@ -65,57 +236,60 @@ lpfc_bsg_rport_ct(struct fc_bsg_job *job)
        struct scatterlist *sgel = NULL;
        int numbde;
        dma_addr_t busaddr;
+       struct bsg_job_data *dd_data;
+       uint32_t creg_val;
        int rc = 0;
 
        /* in case no data is transferred */
        job->reply->reply_payload_rcv_len = 0;
 
+       /* allocate our bsg tracking structure */
+       dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
+       if (!dd_data) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2733 Failed allocation of dd_data\n");
+               rc = -ENOMEM;
+               goto no_dd_data;
+       }
+
        if (!lpfc_nlp_get(ndlp)) {
-               job->reply->result = -ENODEV;
-               return 0;
+               rc = -ENODEV;
+               goto no_ndlp;
+       }
+
+       bmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+       if (!bmp) {
+               rc = -ENOMEM;
+               goto free_ndlp;
        }
 
        if (ndlp->nlp_flag & NLP_ELS_SND_MASK) {
                rc = -ENODEV;
-               goto free_ndlp_exit;
+               goto free_bmp;
        }
 
-       spin_lock_irq(shost->host_lock);
        cmdiocbq = lpfc_sli_get_iocbq(phba);
        if (!cmdiocbq) {
                rc = -ENOMEM;
-               spin_unlock_irq(shost->host_lock);
-               goto free_ndlp_exit;
+               goto free_bmp;
        }
-       cmd = &cmdiocbq->iocb;
 
+       cmd = &cmdiocbq->iocb;
        rspiocbq = lpfc_sli_get_iocbq(phba);
        if (!rspiocbq) {
                rc = -ENOMEM;
                goto free_cmdiocbq;
        }
-       spin_unlock_irq(shost->host_lock);
 
        rsp = &rspiocbq->iocb;
-
-       bmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
-       if (!bmp) {
-               rc = -ENOMEM;
-               spin_lock_irq(shost->host_lock);
-               goto free_rspiocbq;
-       }
-
-       spin_lock_irq(shost->host_lock);
        bmp->virt = lpfc_mbuf_alloc(phba, 0, &bmp->phys);
        if (!bmp->virt) {
                rc = -ENOMEM;
-               goto free_bmp;
+               goto free_rspiocbq;
        }
-       spin_unlock_irq(shost->host_lock);
 
        INIT_LIST_HEAD(&bmp->list);
        bpl = (struct ulp_bde64 *) bmp->virt;
-
        request_nseg = pci_map_sg(phba->pcidev, job->request_payload.sg_list,
                                  job->request_payload.sg_cnt, DMA_TO_DEVICE);
        for_each_sg(job->request_payload.sg_list, sgel, request_nseg, numbde) {
@@ -157,78 +331,152 @@ lpfc_bsg_rport_ct(struct fc_bsg_job *job)
        cmd->ulpContext = ndlp->nlp_rpi;
        cmd->ulpOwner = OWN_CHIP;
        cmdiocbq->vport = phba->pport;
-       cmdiocbq->context1 = NULL;
-       cmdiocbq->context2 = NULL;
+       cmdiocbq->context3 = bmp;
        cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
-
        timeout = phba->fc_ratov * 2;
-       job->dd_data = cmdiocbq;
-
-       rc = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, rspiocbq,
-                                       timeout + LPFC_DRVR_TIMEOUT);
-
-       if (rc != IOCB_TIMEDOUT) {
-               pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
-                            job->request_payload.sg_cnt, DMA_TO_DEVICE);
-               pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
-                            job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+       cmd->ulpTimeout = timeout;
+
+       cmdiocbq->iocb_cmpl = lpfc_bsg_send_mgmt_cmd_cmp;
+       cmdiocbq->context1 = dd_data;
+       cmdiocbq->context2 = rspiocbq;
+       dd_data->type = TYPE_IOCB;
+       dd_data->context_un.iocb.cmdiocbq = cmdiocbq;
+       dd_data->context_un.iocb.rspiocbq = rspiocbq;
+       dd_data->context_un.iocb.set_job = job;
+       dd_data->context_un.iocb.bmp = bmp;
+       dd_data->context_un.iocb.ndlp = ndlp;
+
+       if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
+               creg_val = readl(phba->HCregaddr);
+               creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
+               writel(creg_val, phba->HCregaddr);
+               readl(phba->HCregaddr); /* flush */
        }
 
-       if (rc == IOCB_TIMEDOUT) {
-               lpfc_sli_release_iocbq(phba, rspiocbq);
-               rc = -EACCES;
-               goto free_ndlp_exit;
-       }
+       rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, cmdiocbq, 0);
 
-       if (rc != IOCB_SUCCESS) {
-               rc = -EACCES;
-               goto free_outdmp;
-       }
+       if (rc == IOCB_SUCCESS)
+               return 0; /* done for now */
 
-       if (rsp->ulpStatus) {
-               if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
-                       switch (rsp->un.ulpWord[4] & 0xff) {
-                       case IOERR_SEQUENCE_TIMEOUT:
-                               rc = -ETIMEDOUT;
-                               break;
-                       case IOERR_INVALID_RPI:
-                               rc = -EFAULT;
-                               break;
-                       default:
-                               rc = -EACCES;
-                               break;
-                       }
-                       goto free_outdmp;
-               }
-       } else
-               job->reply->reply_payload_rcv_len =
-                       rsp->un.genreq64.bdl.bdeSize;
+       /* iocb failed so cleanup */
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                    job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
+                    job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
 
-free_outdmp:
-       spin_lock_irq(shost->host_lock);
        lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
-free_bmp:
-       kfree(bmp);
+
 free_rspiocbq:
        lpfc_sli_release_iocbq(phba, rspiocbq);
 free_cmdiocbq:
        lpfc_sli_release_iocbq(phba, cmdiocbq);
-       spin_unlock_irq(shost->host_lock);
-free_ndlp_exit:
+free_bmp:
+       kfree(bmp);
+free_ndlp:
        lpfc_nlp_put(ndlp);
+no_ndlp:
+       kfree(dd_data);
+no_dd_data:
+       /* make error code available to userspace */
+       job->reply->result = rc;
+       job->dd_data = NULL;
+       return rc;
+}
+
+/**
+ * lpfc_bsg_rport_els_cmp - lpfc_bsg_rport_els's completion handler
+ * @phba: Pointer to HBA context object.
+ * @cmdiocbq: Pointer to command iocb.
+ * @rspiocbq: Pointer to response iocb.
+ *
+ * This function is the completion handler for iocbs issued using
+ * lpfc_bsg_rport_els_cmp function. This function is called by the
+ * ring event handler function without any lock held. This function
+ * can be called from both worker thread context and interrupt
+ * context. This function also can be called from other thread which
+ * cleans up the SLI layer objects.
+ * This function copies the contents of the response iocb to the
+ * response iocb memory object provided by the caller of
+ * lpfc_sli_issue_iocb_wait and then wakes up the thread which
+ * sleeps for the iocb completion.
+ **/
+static void
+lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
+                       struct lpfc_iocbq *cmdiocbq,
+                       struct lpfc_iocbq *rspiocbq)
+{
+       struct bsg_job_data *dd_data;
+       struct fc_bsg_job *job;
+       IOCB_t *rsp;
+       struct lpfc_nodelist *ndlp;
+       struct lpfc_dmabuf *pbuflist = NULL;
+       struct fc_bsg_ctels_reply *els_reply;
+       uint8_t *rjt_data;
+       unsigned long flags;
+       int rc = 0;
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       dd_data = cmdiocbq->context1;
+       /* normal completion and timeout crossed paths, already done */
+       if (!dd_data) {
+               spin_unlock_irqrestore(&phba->hbalock, flags);
+               return;
+       }
+
+       cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
+       if (cmdiocbq->context2 && rspiocbq)
+               memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
+                      &rspiocbq->iocb, sizeof(IOCB_t));
+
+       job = dd_data->context_un.iocb.set_job;
+       cmdiocbq = dd_data->context_un.iocb.cmdiocbq;
+       rspiocbq = dd_data->context_un.iocb.rspiocbq;
+       rsp = &rspiocbq->iocb;
+       ndlp = dd_data->context_un.iocb.ndlp;
 
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                    job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
+                    job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+
+       if (job->reply->result == -EAGAIN)
+               rc = -EAGAIN;
+       else if (rsp->ulpStatus == IOSTAT_SUCCESS)
+               job->reply->reply_payload_rcv_len =
+                       rsp->un.elsreq64.bdl.bdeSize;
+       else if (rsp->ulpStatus == IOSTAT_LS_RJT) {
+               job->reply->reply_payload_rcv_len =
+                       sizeof(struct fc_bsg_ctels_reply);
+               /* LS_RJT data returned in word 4 */
+               rjt_data = (uint8_t *)&rsp->un.ulpWord[4];
+               els_reply = &job->reply->reply_data.ctels_reply;
+               els_reply->status = FC_CTELS_STATUS_REJECT;
+               els_reply->rjt_data.action = rjt_data[3];
+               els_reply->rjt_data.reason_code = rjt_data[2];
+               els_reply->rjt_data.reason_explanation = rjt_data[1];
+               els_reply->rjt_data.vendor_unique = rjt_data[0];
+       } else
+               rc = -EIO;
+
+       pbuflist = (struct lpfc_dmabuf *) cmdiocbq->context3;
+       lpfc_mbuf_free(phba, pbuflist->virt, pbuflist->phys);
+       lpfc_sli_release_iocbq(phba, rspiocbq);
+       lpfc_sli_release_iocbq(phba, cmdiocbq);
+       lpfc_nlp_put(ndlp);
+       kfree(dd_data);
        /* make error code available to userspace */
        job->reply->result = rc;
+       job->dd_data = NULL;
        /* complete the job back to userspace */
        job->job_done(job);
-
-       return 0;
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       return;
 }
 
 /**
  * lpfc_bsg_rport_els - send an ELS command from a bsg request
  * @job: fc_bsg_job to handle
- */
+ **/
 static int
 lpfc_bsg_rport_els(struct fc_bsg_job *job)
 {
@@ -236,7 +484,6 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
        struct lpfc_hba *phba = vport->phba;
        struct lpfc_rport_data *rdata = job->rport->dd_data;
        struct lpfc_nodelist *ndlp = rdata->pnode;
-
        uint32_t elscmd;
        uint32_t cmdsize;
        uint32_t rspsize;
@@ -248,20 +495,30 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
        struct lpfc_dmabuf *prsp;
        struct lpfc_dmabuf *pbuflist = NULL;
        struct ulp_bde64 *bpl;
-       int iocb_status;
        int request_nseg;
        int reply_nseg;
        struct scatterlist *sgel = NULL;
        int numbde;
        dma_addr_t busaddr;
+       struct bsg_job_data *dd_data;
+       uint32_t creg_val;
        int rc = 0;
 
        /* in case no data is transferred */
        job->reply->reply_payload_rcv_len = 0;
 
+       /* allocate our bsg tracking structure */
+       dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
+       if (!dd_data) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2735 Failed allocation of dd_data\n");
+               rc = -ENOMEM;
+               goto no_dd_data;
+       }
+
        if (!lpfc_nlp_get(ndlp)) {
                rc = -ENODEV;
-               goto out;
+               goto free_dd_data;
        }
 
        elscmd = job->request->rqst_data.r_els.els_code;
@@ -271,24 +528,24 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
        if (!rspiocbq) {
                lpfc_nlp_put(ndlp);
                rc = -ENOMEM;
-               goto out;
+               goto free_dd_data;
        }
 
        rsp = &rspiocbq->iocb;
        rpi = ndlp->nlp_rpi;
 
-       cmdiocbq = lpfc_prep_els_iocb(phba->pport, 1, cmdsize, 0, ndlp,
+       cmdiocbq = lpfc_prep_els_iocb(vport, 1, cmdsize, 0, ndlp,
                                      ndlp->nlp_DID, elscmd);
-
        if (!cmdiocbq) {
-               lpfc_sli_release_iocbq(phba, rspiocbq);
-               return -EIO;
+               rc = -EIO;
+               goto free_rspiocbq;
        }
 
-       job->dd_data = cmdiocbq;
+       /* prep els iocb set context1 to the ndlp, context2 to the command
+        * dmabuf, context3 holds the data dmabuf
+        */
        pcmd = (struct lpfc_dmabuf *) cmdiocbq->context2;
        prsp = (struct lpfc_dmabuf *) pcmd->list.next;
-
        lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys);
        kfree(pcmd);
        lpfc_mbuf_free(phba, prsp->virt, prsp->phys);
@@ -300,7 +557,6 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
 
        request_nseg = pci_map_sg(phba->pcidev, job->request_payload.sg_list,
                                  job->request_payload.sg_cnt, DMA_TO_DEVICE);
-
        for_each_sg(job->request_payload.sg_list, sgel, request_nseg, numbde) {
                busaddr = sg_dma_address(sgel);
                bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
@@ -322,7 +578,6 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
                bpl->addrHigh = cpu_to_le32(putPaddrHigh(busaddr));
                bpl++;
        }
-
        cmdiocbq->iocb.un.elsreq64.bdl.bdeSize =
                (request_nseg + reply_nseg) * sizeof(struct ulp_bde64);
        cmdiocbq->iocb.ulpContext = rpi;
@@ -330,102 +585,62 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
        cmdiocbq->context1 = NULL;
        cmdiocbq->context2 = NULL;
 
-       iocb_status = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
-                                       rspiocbq, (phba->fc_ratov * 2)
-                                              + LPFC_DRVR_TIMEOUT);
-
-       /* release the new ndlp once the iocb completes */
-       lpfc_nlp_put(ndlp);
-       if (iocb_status != IOCB_TIMEDOUT) {
-               pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
-                            job->request_payload.sg_cnt, DMA_TO_DEVICE);
-               pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
-                            job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+       cmdiocbq->iocb_cmpl = lpfc_bsg_rport_els_cmp;
+       cmdiocbq->context1 = dd_data;
+       cmdiocbq->context2 = rspiocbq;
+       dd_data->type = TYPE_IOCB;
+       dd_data->context_un.iocb.cmdiocbq = cmdiocbq;
+       dd_data->context_un.iocb.rspiocbq = rspiocbq;
+       dd_data->context_un.iocb.set_job = job;
+       dd_data->context_un.iocb.bmp = NULL;;
+       dd_data->context_un.iocb.ndlp = ndlp;
+
+       if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
+               creg_val = readl(phba->HCregaddr);
+               creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
+               writel(creg_val, phba->HCregaddr);
+               readl(phba->HCregaddr); /* flush */
        }
+       rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, cmdiocbq, 0);
+       lpfc_nlp_put(ndlp);
+       if (rc == IOCB_SUCCESS)
+               return 0; /* done for now */
 
-       if (iocb_status == IOCB_SUCCESS) {
-               if (rsp->ulpStatus == IOSTAT_SUCCESS) {
-                       job->reply->reply_payload_rcv_len =
-                               rsp->un.elsreq64.bdl.bdeSize;
-                       rc = 0;
-               } else if (rsp->ulpStatus == IOSTAT_LS_RJT) {
-                       struct fc_bsg_ctels_reply *els_reply;
-                       /* LS_RJT data returned in word 4 */
-                       uint8_t *rjt_data = (uint8_t *)&rsp->un.ulpWord[4];
-
-                       els_reply = &job->reply->reply_data.ctels_reply;
-                       job->reply->result = 0;
-                       els_reply->status = FC_CTELS_STATUS_REJECT;
-                       els_reply->rjt_data.action = rjt_data[0];
-                       els_reply->rjt_data.reason_code = rjt_data[1];
-                       els_reply->rjt_data.reason_explanation = rjt_data[2];
-                       els_reply->rjt_data.vendor_unique = rjt_data[3];
-               } else
-                       rc = -EIO;
-       } else
-               rc = -EIO;
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                    job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
+                    job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
 
-       if (iocb_status != IOCB_TIMEDOUT)
-               lpfc_els_free_iocb(phba, cmdiocbq);
+       lpfc_mbuf_free(phba, pbuflist->virt, pbuflist->phys);
 
+       lpfc_sli_release_iocbq(phba, cmdiocbq);
+
+free_rspiocbq:
        lpfc_sli_release_iocbq(phba, rspiocbq);
 
-out:
+free_dd_data:
+       kfree(dd_data);
+
+no_dd_data:
        /* make error code available to userspace */
        job->reply->result = rc;
-       /* complete the job back to userspace */
-       job->job_done(job);
-
-       return 0;
-}
-
-struct lpfc_ct_event {
-       struct list_head node;
-       int ref;
-       wait_queue_head_t wq;
-
-       /* Event type and waiter identifiers */
-       uint32_t type_mask;
-       uint32_t req_id;
-       uint32_t reg_id;
-
-       /* next two flags are here for the auto-delete logic */
-       unsigned long wait_time_stamp;
-       int waiting;
-
-       /* seen and not seen events */
-       struct list_head events_to_get;
-       struct list_head events_to_see;
-};
-
-struct event_data {
-       struct list_head node;
-       uint32_t type;
-       uint32_t immed_dat;
-       void *data;
-       uint32_t len;
-};
-
-static struct lpfc_ct_event *
-lpfc_ct_event_new(int ev_reg_id, uint32_t ev_req_id)
-{
-       struct lpfc_ct_event *evt = kzalloc(sizeof(*evt), GFP_KERNEL);
-       if (!evt)
-               return NULL;
-
-       INIT_LIST_HEAD(&evt->events_to_get);
-       INIT_LIST_HEAD(&evt->events_to_see);
-       evt->req_id = ev_req_id;
-       evt->reg_id = ev_reg_id;
-       evt->wait_time_stamp = jiffies;
-       init_waitqueue_head(&evt->wq);
-
-       return evt;
+       job->dd_data = NULL;
+       return rc;
 }
 
+/**
+ * lpfc_bsg_event_free - frees an allocated event structure
+ * @kref: Pointer to a kref.
+ *
+ * Called from kref_put. Back cast the kref into an event structure address.
+ * Free any events to get, delete associated nodes, free any events to see,
+ * free any data then free the event itself.
+ **/
 static void
-lpfc_ct_event_free(struct lpfc_ct_event *evt)
+lpfc_bsg_event_free(struct kref *kref)
 {
+       struct lpfc_bsg_event *evt = container_of(kref, struct lpfc_bsg_event,
+                                                 kref);
        struct event_data *ed;
 
        list_del(&evt->node);
@@ -447,25 +662,82 @@ lpfc_ct_event_free(struct lpfc_ct_event *evt)
        kfree(evt);
 }
 
+/**
+ * lpfc_bsg_event_ref - increments the kref for an event
+ * @evt: Pointer to an event structure.
+ **/
 static inline void
-lpfc_ct_event_ref(struct lpfc_ct_event *evt)
+lpfc_bsg_event_ref(struct lpfc_bsg_event *evt)
 {
-       evt->ref++;
+       kref_get(&evt->kref);
 }
 
+/**
+ * lpfc_bsg_event_unref - Uses kref_put to free an event structure
+ * @evt: Pointer to an event structure.
+ **/
 static inline void
-lpfc_ct_event_unref(struct lpfc_ct_event *evt)
+lpfc_bsg_event_unref(struct lpfc_bsg_event *evt)
 {
-       if (--evt->ref < 0)
-               lpfc_ct_event_free(evt);
+       kref_put(&evt->kref, lpfc_bsg_event_free);
 }
 
-#define SLI_CT_ELX_LOOPBACK 0x10
+/**
+ * lpfc_bsg_event_new - allocate and initialize a event structure
+ * @ev_mask: Mask of events.
+ * @ev_reg_id: Event reg id.
+ * @ev_req_id: Event request id.
+ **/
+static struct lpfc_bsg_event *
+lpfc_bsg_event_new(uint32_t ev_mask, int ev_reg_id, uint32_t ev_req_id)
+{
+       struct lpfc_bsg_event *evt = kzalloc(sizeof(*evt), GFP_KERNEL);
 
-enum ELX_LOOPBACK_CMD {
-       ELX_LOOPBACK_XRI_SETUP,
-       ELX_LOOPBACK_DATA,
-};
+       if (!evt)
+               return NULL;
+
+       INIT_LIST_HEAD(&evt->events_to_get);
+       INIT_LIST_HEAD(&evt->events_to_see);
+       evt->type_mask = ev_mask;
+       evt->req_id = ev_req_id;
+       evt->reg_id = ev_reg_id;
+       evt->wait_time_stamp = jiffies;
+       init_waitqueue_head(&evt->wq);
+       kref_init(&evt->kref);
+       return evt;
+}
+
+/**
+ * diag_cmd_data_free - Frees an lpfc dma buffer extension
+ * @phba: Pointer to HBA context object.
+ * @mlist: Pointer to an lpfc dma buffer extension.
+ **/
+static int
+diag_cmd_data_free(struct lpfc_hba *phba, struct lpfc_dmabufext *mlist)
+{
+       struct lpfc_dmabufext *mlast;
+       struct pci_dev *pcidev;
+       struct list_head head, *curr, *next;
+
+       if ((!mlist) || (!lpfc_is_link_up(phba) &&
+               (phba->link_flag & LS_LOOPBACK_MODE))) {
+               return 0;
+       }
+
+       pcidev = phba->pcidev;
+       list_add_tail(&head, &mlist->dma.list);
+
+       list_for_each_safe(curr, next, &head) {
+               mlast = list_entry(curr, struct lpfc_dmabufext , dma.list);
+               if (mlast->dma.virt)
+                       dma_free_coherent(&pcidev->dev,
+                                         mlast->size,
+                                         mlast->dma.virt,
+                                         mlast->dma.phys);
+               kfree(mlast);
+       }
+       return 0;
+}
 
 /**
  * lpfc_bsg_ct_unsol_event - process an unsolicited CT command
@@ -474,9 +746,9 @@ enum ELX_LOOPBACK_CMD {
  * @piocbq:
  *
  * This function is called when an unsolicited CT command is received.  It
- * forwards the event to any processes registerd to receive CT events.
- */
-void
+ * forwards the event to any processes registered to receive CT events.
+ **/
+int
 lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                        struct lpfc_iocbq *piocbq)
 {
@@ -484,7 +756,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        uint32_t cmd;
        uint32_t len;
        struct lpfc_dmabuf *dmabuf = NULL;
-       struct lpfc_ct_event *evt;
+       struct lpfc_bsg_event *evt;
        struct event_data *evt_dat = NULL;
        struct lpfc_iocbq *iocbq;
        size_t offset = 0;
@@ -496,6 +768,9 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        struct lpfc_dmabuf *bdeBuf2 = piocbq->context3;
        struct lpfc_hbq_entry *hbqe;
        struct lpfc_sli_ct_request *ct_req;
+       struct fc_bsg_job *job = NULL;
+       unsigned long flags;
+       int size = 0;
 
        INIT_LIST_HEAD(&head);
        list_add_tail(&head, &piocbq->list);
@@ -504,6 +779,10 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
            piocbq->iocb.un.cont64[0].tus.f.bdeSize == 0)
                goto error_ct_unsol_exit;
 
+       if (phba->link_state == LPFC_HBA_ERROR ||
+               (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)))
+               goto error_ct_unsol_exit;
+
        if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)
                dmabuf = bdeBuf1;
        else {
@@ -511,7 +790,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                                    piocbq->iocb.un.cont64[0].addrLow);
                dmabuf = lpfc_sli_ringpostbuf_get(phba, pring, dma_addr);
        }
-
+       if (dmabuf == NULL)
+               goto error_ct_unsol_exit;
        ct_req = (struct lpfc_sli_ct_request *)dmabuf->virt;
        evt_req_id = ct_req->FsType;
        cmd = ct_req->CommandResponse.bits.CmdRsp;
@@ -519,24 +799,24 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED))
                lpfc_sli_ringpostbuf_put(phba, pring, dmabuf);
 
-       mutex_lock(&phba->ct_event_mutex);
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
        list_for_each_entry(evt, &phba->ct_ev_waiters, node) {
-               if (evt->req_id != evt_req_id)
+               if (!(evt->type_mask & FC_REG_CT_EVENT) ||
+                       evt->req_id != evt_req_id)
                        continue;
 
-               lpfc_ct_event_ref(evt);
-
+               lpfc_bsg_event_ref(evt);
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
                evt_dat = kzalloc(sizeof(*evt_dat), GFP_KERNEL);
-               if (!evt_dat) {
-                       lpfc_ct_event_unref(evt);
+               if (evt_dat == NULL) {
+                       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+                       lpfc_bsg_event_unref(evt);
                        lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
                                        "2614 Memory allocation failed for "
                                        "CT event\n");
                        break;
                }
 
-               mutex_unlock(&phba->ct_event_mutex);
-
                if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
                        /* take accumulated byte count from the last iocbq */
                        iocbq = list_entry(head.prev, typeof(*iocbq), list);
@@ -550,25 +830,25 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                }
 
                evt_dat->data = kzalloc(evt_dat->len, GFP_KERNEL);
-               if (!evt_dat->data) {
+               if (evt_dat->data == NULL) {
                        lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
                                        "2615 Memory allocation failed for "
                                        "CT event data, size %d\n",
                                        evt_dat->len);
                        kfree(evt_dat);
-                       mutex_lock(&phba->ct_event_mutex);
-                       lpfc_ct_event_unref(evt);
-                       mutex_unlock(&phba->ct_event_mutex);
+                       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+                       lpfc_bsg_event_unref(evt);
+                       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
                        goto error_ct_unsol_exit;
                }
 
                list_for_each_entry(iocbq, &head, list) {
+                       size = 0;
                        if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
                                bdeBuf1 = iocbq->context2;
                                bdeBuf2 = iocbq->context3;
                        }
                        for (i = 0; i < iocbq->iocb.ulpBdeCount; i++) {
-                               int size = 0;
                                if (phba->sli3_options &
                                    LPFC_SLI3_HBQ_ENABLED) {
                                        if (i == 0) {
@@ -601,9 +881,11 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                                                iocbq);
                                        kfree(evt_dat->data);
                                        kfree(evt_dat);
-                                       mutex_lock(&phba->ct_event_mutex);
-                                       lpfc_ct_event_unref(evt);
-                                       mutex_unlock(&phba->ct_event_mutex);
+                                       spin_lock_irqsave(&phba->ct_ev_lock,
+                                               flags);
+                                       lpfc_bsg_event_unref(evt);
+                                       spin_unlock_irqrestore(
+                                               &phba->ct_ev_lock, flags);
                                        goto error_ct_unsol_exit;
                                }
                                memcpy((char *)(evt_dat->data) + offset,
@@ -616,15 +898,24 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                                                                 dmabuf);
                                } else {
                                        switch (cmd) {
+                                       case ELX_LOOPBACK_DATA:
+                                               diag_cmd_data_free(phba,
+                                               (struct lpfc_dmabufext *)
+                                                       dmabuf);
+                                               break;
                                        case ELX_LOOPBACK_XRI_SETUP:
-                                               if (!(phba->sli3_options &
-                                                     LPFC_SLI3_HBQ_ENABLED))
+                                               if ((phba->sli_rev ==
+                                                       LPFC_SLI_REV2) ||
+                                                       (phba->sli3_options &
+                                                       LPFC_SLI3_HBQ_ENABLED
+                                                       )) {
+                                                       lpfc_in_buf_free(phba,
+                                                                       dmabuf);
+                                               } else {
                                                        lpfc_post_buffer(phba,
                                                                         pring,
                                                                         1);
-                                               else
-                                                       lpfc_in_buf_free(phba,
-                                                                       dmabuf);
+                                               }
                                                break;
                                        default:
                                                if (!(phba->sli3_options &
@@ -638,7 +929,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                        }
                }
 
-               mutex_lock(&phba->ct_event_mutex);
+               spin_lock_irqsave(&phba->ct_ev_lock, flags);
                if (phba->sli_rev == LPFC_SLI_REV4) {
                        evt_dat->immed_dat = phba->ctx_idx;
                        phba->ctx_idx = (phba->ctx_idx + 1) % 64;
@@ -651,122 +942,144 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
 
                evt_dat->type = FC_REG_CT_EVENT;
                list_add(&evt_dat->node, &evt->events_to_see);
-               wake_up_interruptible(&evt->wq);
-               lpfc_ct_event_unref(evt);
-               if (evt_req_id == SLI_CT_ELX_LOOPBACK)
+               if (evt_req_id == SLI_CT_ELX_LOOPBACK) {
+                       wake_up_interruptible(&evt->wq);
+                       lpfc_bsg_event_unref(evt);
                        break;
+               }
+
+               list_move(evt->events_to_see.prev, &evt->events_to_get);
+               lpfc_bsg_event_unref(evt);
+
+               job = evt->set_job;
+               evt->set_job = NULL;
+               if (job) {
+                       job->reply->reply_payload_rcv_len = size;
+                       /* make error code available to userspace */
+                       job->reply->result = 0;
+                       job->dd_data = NULL;
+                       /* complete the job back to userspace */
+                       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+                       job->job_done(job);
+                       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+               }
        }
-       mutex_unlock(&phba->ct_event_mutex);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
 
 error_ct_unsol_exit:
        if (!list_empty(&head))
                list_del(&head);
-
-       return;
+       if (evt_req_id == SLI_CT_ELX_LOOPBACK)
+               return 0;
+       return 1;
 }
 
 /**
- * lpfc_bsg_set_event - process a SET_EVENT bsg vendor command
+ * lpfc_bsg_hba_set_event - process a SET_EVENT bsg vendor command
  * @job: SET_EVENT fc_bsg_job
- */
+ **/
 static int
-lpfc_bsg_set_event(struct fc_bsg_job *job)
+lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
 {
        struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
        struct lpfc_hba *phba = vport->phba;
        struct set_ct_event *event_req;
-       struct lpfc_ct_event *evt;
+       struct lpfc_bsg_event *evt;
        int rc = 0;
+       struct bsg_job_data *dd_data = NULL;
+       uint32_t ev_mask;
+       unsigned long flags;
 
        if (job->request_len <
            sizeof(struct fc_bsg_request) + sizeof(struct set_ct_event)) {
                lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
                                "2612 Received SET_CT_EVENT below minimum "
                                "size\n");
-               return -EINVAL;
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
+       if (dd_data == NULL) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2734 Failed allocation of dd_data\n");
+               rc = -ENOMEM;
+               goto job_error;
        }
 
        event_req = (struct set_ct_event *)
                job->request->rqst_data.h_vendor.vendor_cmd;
-
-       mutex_lock(&phba->ct_event_mutex);
+       ev_mask = ((uint32_t)(unsigned long)event_req->type_mask &
+                               FC_REG_EVENT_MASK);
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
        list_for_each_entry(evt, &phba->ct_ev_waiters, node) {
                if (evt->reg_id == event_req->ev_reg_id) {
-                       lpfc_ct_event_ref(evt);
+                       lpfc_bsg_event_ref(evt);
                        evt->wait_time_stamp = jiffies;
                        break;
                }
        }
-       mutex_unlock(&phba->ct_event_mutex);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
 
        if (&evt->node == &phba->ct_ev_waiters) {
                /* no event waiting struct yet - first call */
-               evt = lpfc_ct_event_new(event_req->ev_reg_id,
+               evt = lpfc_bsg_event_new(ev_mask, event_req->ev_reg_id,
                                        event_req->ev_req_id);
                if (!evt) {
                        lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
                                        "2617 Failed allocation of event "
                                        "waiter\n");
-                       return -ENOMEM;
+                       rc = -ENOMEM;
+                       goto job_error;
                }
 
-               mutex_lock(&phba->ct_event_mutex);
+               spin_lock_irqsave(&phba->ct_ev_lock, flags);
                list_add(&evt->node, &phba->ct_ev_waiters);
-               lpfc_ct_event_ref(evt);
-               mutex_unlock(&phba->ct_event_mutex);
+               lpfc_bsg_event_ref(evt);
+               evt->wait_time_stamp = jiffies;
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
        }
 
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
        evt->waiting = 1;
-       if (wait_event_interruptible(evt->wq,
-                                    !list_empty(&evt->events_to_see))) {
-               mutex_lock(&phba->ct_event_mutex);
-               lpfc_ct_event_unref(evt); /* release ref */
-               lpfc_ct_event_unref(evt); /* delete */
-               mutex_unlock(&phba->ct_event_mutex);
-               rc = -EINTR;
-               goto set_event_out;
-       }
-
-       evt->wait_time_stamp = jiffies;
-       evt->waiting = 0;
-
-       mutex_lock(&phba->ct_event_mutex);
-       list_move(evt->events_to_see.prev, &evt->events_to_get);
-       lpfc_ct_event_unref(evt); /* release ref */
-       mutex_unlock(&phba->ct_event_mutex);
-
-set_event_out:
-       /* set_event carries no reply payload */
-       job->reply->reply_payload_rcv_len = 0;
-       /* make error code available to userspace */
-       job->reply->result = rc;
-       /* complete the job back to userspace */
-       job->job_done(job);
-
-       return 0;
+       dd_data->type = TYPE_EVT;
+       dd_data->context_un.evt = evt;
+       evt->set_job = job; /* for unsolicited command */
+       job->dd_data = dd_data; /* for fc transport timeout callback*/
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       return 0; /* call job done later */
+
+job_error:
+       if (dd_data != NULL)
+               kfree(dd_data);
+
+       job->dd_data = NULL;
+       return rc;
 }
 
 /**
- * lpfc_bsg_get_event - process a GET_EVENT bsg vendor command
+ * lpfc_bsg_hba_get_event - process a GET_EVENT bsg vendor command
  * @job: GET_EVENT fc_bsg_job
- */
+ **/
 static int
-lpfc_bsg_get_event(struct fc_bsg_job *job)
+lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
 {
        struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
        struct lpfc_hba *phba = vport->phba;
        struct get_ct_event *event_req;
        struct get_ct_event_reply *event_reply;
-       struct lpfc_ct_event *evt;
+       struct lpfc_bsg_event *evt;
        struct event_data *evt_dat = NULL;
-       int rc = 0;
+       unsigned long flags;
+       uint32_t rc = 0;
 
        if (job->request_len <
            sizeof(struct fc_bsg_request) + sizeof(struct get_ct_event)) {
                lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
                                "2613 Received GET_CT_EVENT request below "
                                "minimum size\n");
-               return -EINVAL;
+               rc = -EINVAL;
+               goto job_error;
        }
 
        event_req = (struct get_ct_event *)
@@ -774,13 +1087,12 @@ lpfc_bsg_get_event(struct fc_bsg_job *job)
 
        event_reply = (struct get_ct_event_reply *)
                job->reply->reply_data.vendor_reply.vendor_rsp;
-
-       mutex_lock(&phba->ct_event_mutex);
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
        list_for_each_entry(evt, &phba->ct_ev_waiters, node) {
                if (evt->reg_id == event_req->ev_reg_id) {
                        if (list_empty(&evt->events_to_get))
                                break;
-                       lpfc_ct_event_ref(evt);
+                       lpfc_bsg_event_ref(evt);
                        evt->wait_time_stamp = jiffies;
                        evt_dat = list_entry(evt->events_to_get.prev,
                                             struct event_data, node);
@@ -788,118 +1100,1689 @@ lpfc_bsg_get_event(struct fc_bsg_job *job)
                        break;
                }
        }
-       mutex_unlock(&phba->ct_event_mutex);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
 
-       if (!evt_dat) {
+       /* The app may continue to ask for event data until it gets
+        * an error indicating that there isn't anymore
+        */
+       if (evt_dat == NULL) {
                job->reply->reply_payload_rcv_len = 0;
                rc = -ENOENT;
-               goto error_get_event_exit;
+               goto job_error;
        }
 
-       if (evt_dat->len > job->reply_payload.payload_len) {
-               evt_dat->len = job->reply_payload.payload_len;
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
-                                       "2618 Truncated event data at %d "
-                                       "bytes\n",
-                                       job->reply_payload.payload_len);
+       if (evt_dat->len > job->request_payload.payload_len) {
+               evt_dat->len = job->request_payload.payload_len;
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2618 Truncated event data at %d "
+                               "bytes\n",
+                               job->request_payload.payload_len);
        }
 
+       event_reply->type = evt_dat->type;
        event_reply->immed_data = evt_dat->immed_dat;
-
        if (evt_dat->len > 0)
                job->reply->reply_payload_rcv_len =
-                       sg_copy_from_buffer(job->reply_payload.sg_list,
-                                           job->reply_payload.sg_cnt,
+                       sg_copy_from_buffer(job->request_payload.sg_list,
+                                           job->request_payload.sg_cnt,
                                            evt_dat->data, evt_dat->len);
        else
                job->reply->reply_payload_rcv_len = 0;
-       rc = 0;
 
-       if (evt_dat)
+       if (evt_dat) {
                kfree(evt_dat->data);
-       kfree(evt_dat);
-       mutex_lock(&phba->ct_event_mutex);
-       lpfc_ct_event_unref(evt);
-       mutex_unlock(&phba->ct_event_mutex);
+               kfree(evt_dat);
+       }
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       lpfc_bsg_event_unref(evt);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       job->dd_data = NULL;
+       job->reply->result = 0;
+       job->job_done(job);
+       return 0;
+
+job_error:
+       job->dd_data = NULL;
+       job->reply->result = rc;
+       return rc;
+}
+
+/**
+ * lpfc_issue_ct_rsp_cmp - lpfc_issue_ct_rsp's completion handler
+ * @phba: Pointer to HBA context object.
+ * @cmdiocbq: Pointer to command iocb.
+ * @rspiocbq: Pointer to response iocb.
+ *
+ * This function is the completion handler for iocbs issued using
+ * lpfc_issue_ct_rsp_cmp function. This function is called by the
+ * ring event handler function without any lock held. This function
+ * can be called from both worker thread context and interrupt
+ * context. This function also can be called from other thread which
+ * cleans up the SLI layer objects.
+ * This function copy the contents of the response iocb to the
+ * response iocb memory object provided by the caller of
+ * lpfc_sli_issue_iocb_wait and then wakes up the thread which
+ * sleeps for the iocb completion.
+ **/
+static void
+lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
+                       struct lpfc_iocbq *cmdiocbq,
+                       struct lpfc_iocbq *rspiocbq)
+{
+       struct bsg_job_data *dd_data;
+       struct fc_bsg_job *job;
+       IOCB_t *rsp;
+       struct lpfc_dmabuf *bmp;
+       struct lpfc_nodelist *ndlp;
+       unsigned long flags;
+       int rc = 0;
 
-error_get_event_exit:
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       dd_data = cmdiocbq->context1;
+       /* normal completion and timeout crossed paths, already done */
+       if (!dd_data) {
+               spin_unlock_irqrestore(&phba->hbalock, flags);
+               return;
+       }
+
+       job = dd_data->context_un.iocb.set_job;
+       bmp = dd_data->context_un.iocb.bmp;
+       rsp = &rspiocbq->iocb;
+       ndlp = dd_data->context_un.iocb.ndlp;
+
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                    job->request_payload.sg_cnt, DMA_TO_DEVICE);
+
+       if (rsp->ulpStatus) {
+               if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
+                       switch (rsp->un.ulpWord[4] & 0xff) {
+                       case IOERR_SEQUENCE_TIMEOUT:
+                               rc = -ETIMEDOUT;
+                               break;
+                       case IOERR_INVALID_RPI:
+                               rc = -EFAULT;
+                               break;
+                       default:
+                               rc = -EACCES;
+                               break;
+                       }
+               } else
+                       rc = -EACCES;
+       } else
+               job->reply->reply_payload_rcv_len =
+                       rsp->un.genreq64.bdl.bdeSize;
+
+       lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
+       lpfc_sli_release_iocbq(phba, cmdiocbq);
+       lpfc_nlp_put(ndlp);
+       kfree(bmp);
+       kfree(dd_data);
        /* make error code available to userspace */
        job->reply->result = rc;
+       job->dd_data = NULL;
        /* complete the job back to userspace */
        job->job_done(job);
-
-       return rc;
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       return;
 }
 
 /**
- * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job
- * @job: fc_bsg_job to handle
- */
+ * lpfc_issue_ct_rsp - issue a ct response
+ * @phba: Pointer to HBA context object.
+ * @job: Pointer to the job object.
+ * @tag: tag index value into the ports context exchange array.
+ * @bmp: Pointer to a dma buffer descriptor.
+ * @num_entry: Number of enties in the bde.
+ **/
 static int
-lpfc_bsg_hst_vendor(struct fc_bsg_job *job)
+lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct fc_bsg_job *job, uint32_t tag,
+                 struct lpfc_dmabuf *bmp, int num_entry)
 {
-       int command = job->request->rqst_data.h_vendor.vendor_cmd[0];
+       IOCB_t *icmd;
+       struct lpfc_iocbq *ctiocb = NULL;
+       int rc = 0;
+       struct lpfc_nodelist *ndlp = NULL;
+       struct bsg_job_data *dd_data;
+       uint32_t creg_val;
 
-       switch (command) {
-       case LPFC_BSG_VENDOR_SET_CT_EVENT:
-               return lpfc_bsg_set_event(job);
-               break;
+       /* allocate our bsg tracking structure */
+       dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
+       if (!dd_data) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2736 Failed allocation of dd_data\n");
+               rc = -ENOMEM;
+               goto no_dd_data;
+       }
 
-       case LPFC_BSG_VENDOR_GET_CT_EVENT:
-               return lpfc_bsg_get_event(job);
-               break;
+       /* Allocate buffer for  command iocb */
+       ctiocb = lpfc_sli_get_iocbq(phba);
+       if (!ctiocb) {
+               rc = ENOMEM;
+               goto no_ctiocb;
+       }
 
-       default:
-               return -EINVAL;
+       icmd = &ctiocb->iocb;
+       icmd->un.xseq64.bdl.ulpIoTag32 = 0;
+       icmd->un.xseq64.bdl.addrHigh = putPaddrHigh(bmp->phys);
+       icmd->un.xseq64.bdl.addrLow = putPaddrLow(bmp->phys);
+       icmd->un.xseq64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
+       icmd->un.xseq64.bdl.bdeSize = (num_entry * sizeof(struct ulp_bde64));
+       icmd->un.xseq64.w5.hcsw.Fctl = (LS | LA);
+       icmd->un.xseq64.w5.hcsw.Dfctl = 0;
+       icmd->un.xseq64.w5.hcsw.Rctl = FC_RCTL_DD_SOL_CTL;
+       icmd->un.xseq64.w5.hcsw.Type = FC_TYPE_CT;
+
+       /* Fill in rest of iocb */
+       icmd->ulpCommand = CMD_XMIT_SEQUENCE64_CX;
+       icmd->ulpBdeCount = 1;
+       icmd->ulpLe = 1;
+       icmd->ulpClass = CLASS3;
+       if (phba->sli_rev == LPFC_SLI_REV4) {
+               /* Do not issue unsol response if oxid not marked as valid */
+               if (!(phba->ct_ctx[tag].flags & UNSOL_VALID)) {
+                       rc = IOCB_ERROR;
+                       goto issue_ct_rsp_exit;
+               }
+               icmd->ulpContext = phba->ct_ctx[tag].oxid;
+               ndlp = lpfc_findnode_did(phba->pport, phba->ct_ctx[tag].SID);
+               if (!ndlp) {
+                       lpfc_printf_log(phba, KERN_WARNING, LOG_ELS,
+                                "2721 ndlp null for oxid %x SID %x\n",
+                                       icmd->ulpContext,
+                                       phba->ct_ctx[tag].SID);
+                       rc = IOCB_ERROR;
+                       goto issue_ct_rsp_exit;
+               }
+               icmd->un.ulpWord[3] = ndlp->nlp_rpi;
+               /* The exchange is done, mark the entry as invalid */
+               phba->ct_ctx[tag].flags &= ~UNSOL_VALID;
+       } else
+               icmd->ulpContext = (ushort) tag;
+
+       icmd->ulpTimeout = phba->fc_ratov * 2;
+
+       /* Xmit CT response on exchange <xid> */
+       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
+                       "2722 Xmit CT response on exchange x%x Data: x%x x%x\n",
+                       icmd->ulpContext, icmd->ulpIoTag, phba->link_state);
+
+       ctiocb->iocb_cmpl = NULL;
+       ctiocb->iocb_flag |= LPFC_IO_LIBDFC;
+       ctiocb->vport = phba->pport;
+       ctiocb->context3 = bmp;
+
+       ctiocb->iocb_cmpl = lpfc_issue_ct_rsp_cmp;
+       ctiocb->context1 = dd_data;
+       ctiocb->context2 = NULL;
+       dd_data->type = TYPE_IOCB;
+       dd_data->context_un.iocb.cmdiocbq = ctiocb;
+       dd_data->context_un.iocb.rspiocbq = NULL;
+       dd_data->context_un.iocb.set_job = job;
+       dd_data->context_un.iocb.bmp = bmp;
+       dd_data->context_un.iocb.ndlp = ndlp;
+
+       if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
+               creg_val = readl(phba->HCregaddr);
+               creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
+               writel(creg_val, phba->HCregaddr);
+               readl(phba->HCregaddr); /* flush */
        }
+
+       rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, ctiocb, 0);
+
+       if (rc == IOCB_SUCCESS)
+               return 0; /* done for now */
+
+issue_ct_rsp_exit:
+       lpfc_sli_release_iocbq(phba, ctiocb);
+no_ctiocb:
+       kfree(dd_data);
+no_dd_data:
+       return rc;
 }
 
 /**
- * lpfc_bsg_request - handle a bsg request from the FC transport
- * @job: fc_bsg_job to handle
- */
-int
-lpfc_bsg_request(struct fc_bsg_job *job)
+ * lpfc_bsg_send_mgmt_rsp - process a SEND_MGMT_RESP bsg vendor command
+ * @job: SEND_MGMT_RESP fc_bsg_job
+ **/
+static int
+lpfc_bsg_send_mgmt_rsp(struct fc_bsg_job *job)
 {
-       uint32_t msgcode;
-       int rc = -EINVAL;
+       struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+       struct lpfc_hba *phba = vport->phba;
+       struct send_mgmt_resp *mgmt_resp = (struct send_mgmt_resp *)
+               job->request->rqst_data.h_vendor.vendor_cmd;
+       struct ulp_bde64 *bpl;
+       struct lpfc_dmabuf *bmp = NULL;
+       struct scatterlist *sgel = NULL;
+       int request_nseg;
+       int numbde;
+       dma_addr_t busaddr;
+       uint32_t tag = mgmt_resp->tag;
+       unsigned long reqbfrcnt =
+                       (unsigned long)job->request_payload.payload_len;
+       int rc = 0;
 
-       msgcode = job->request->msgcode;
+       /* in case no data is transferred */
+       job->reply->reply_payload_rcv_len = 0;
 
-       switch (msgcode) {
-       case FC_BSG_HST_VENDOR:
-               rc = lpfc_bsg_hst_vendor(job);
-               break;
-       case FC_BSG_RPT_ELS:
-               rc = lpfc_bsg_rport_els(job);
-               break;
-       case FC_BSG_RPT_CT:
-               rc = lpfc_bsg_rport_ct(job);
-               break;
-       default:
-               break;
+       if (!reqbfrcnt || (reqbfrcnt > (80 * BUF_SZ_4K))) {
+               rc = -ERANGE;
+               goto send_mgmt_rsp_exit;
+       }
+
+       bmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+       if (!bmp) {
+               rc = -ENOMEM;
+               goto send_mgmt_rsp_exit;
+       }
+
+       bmp->virt = lpfc_mbuf_alloc(phba, 0, &bmp->phys);
+       if (!bmp->virt) {
+               rc = -ENOMEM;
+               goto send_mgmt_rsp_free_bmp;
+       }
+
+       INIT_LIST_HEAD(&bmp->list);
+       bpl = (struct ulp_bde64 *) bmp->virt;
+       request_nseg = pci_map_sg(phba->pcidev, job->request_payload.sg_list,
+                                 job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       for_each_sg(job->request_payload.sg_list, sgel, request_nseg, numbde) {
+               busaddr = sg_dma_address(sgel);
+               bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
+               bpl->tus.f.bdeSize = sg_dma_len(sgel);
+               bpl->tus.w = cpu_to_le32(bpl->tus.w);
+               bpl->addrLow = cpu_to_le32(putPaddrLow(busaddr));
+               bpl->addrHigh = cpu_to_le32(putPaddrHigh(busaddr));
+               bpl++;
        }
 
+       rc = lpfc_issue_ct_rsp(phba, job, tag, bmp, request_nseg);
+
+       if (rc == IOCB_SUCCESS)
+               return 0; /* done for now */
+
+       /* TBD need to handle a timeout */
+       pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
+                         job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       rc = -EACCES;
+       lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
+
+send_mgmt_rsp_free_bmp:
+       kfree(bmp);
+send_mgmt_rsp_exit:
+       /* make error code available to userspace */
+       job->reply->result = rc;
+       job->dd_data = NULL;
        return rc;
 }
 
 /**
- * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport
- * @job: fc_bsg_job that has timed out
+ * lpfc_bsg_diag_mode - process a LPFC_BSG_VENDOR_DIAG_MODE bsg vendor command
+ * @job: LPFC_BSG_VENDOR_DIAG_MODE
  *
- * This function just aborts the job's IOCB.  The aborted IOCB will return to
- * the waiting function which will handle passing the error back to userspace
+ * This function is responsible for placing a port into diagnostic loopback
+ * mode in order to perform a diagnostic loopback test.
+ * All new scsi requests are blocked, a small delay is used to allow the
+ * scsi requests to complete then the link is brought down. If the link is
+ * is placed in loopback mode then scsi requests are again allowed
+ * so the scsi mid-layer doesn't give up on the port.
+ * All of this is done in-line.
  */
-int
-lpfc_bsg_timeout(struct fc_bsg_job *job)
+static int
+lpfc_bsg_diag_mode(struct fc_bsg_job *job)
 {
+       struct Scsi_Host *shost = job->shost;
        struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
        struct lpfc_hba *phba = vport->phba;
-       struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *)job->dd_data;
-       struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
+       struct diag_mode_set *loopback_mode;
+       struct lpfc_sli *psli = &phba->sli;
+       struct lpfc_sli_ring *pring = &psli->ring[LPFC_FCP_RING];
+       uint32_t link_flags;
+       uint32_t timeout;
+       struct lpfc_vport **vports;
+       LPFC_MBOXQ_t *pmboxq;
+       int mbxstatus;
+       int i = 0;
+       int rc = 0;
 
-       if (cmdiocb)
-               lpfc_sli_issue_abort_iotag(phba, pring, cmdiocb);
+       /* no data to return just the return code */
+       job->reply->reply_payload_rcv_len = 0;
+
+       if (job->request_len <
+           sizeof(struct fc_bsg_request) + sizeof(struct diag_mode_set)) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2738 Received DIAG MODE request below minimum "
+                               "size\n");
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       loopback_mode = (struct diag_mode_set *)
+               job->request->rqst_data.h_vendor.vendor_cmd;
+       link_flags = loopback_mode->type;
+       timeout = loopback_mode->timeout;
+
+       if ((phba->link_state == LPFC_HBA_ERROR) ||
+           (psli->sli_flag & LPFC_BLOCK_MGMT_IO) ||
+           (!(psli->sli_flag & LPFC_SLI_ACTIVE))) {
+               rc = -EACCES;
+               goto job_error;
+       }
+
+       pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!pmboxq) {
+               rc = -ENOMEM;
+               goto job_error;
+       }
+
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports) {
+               for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) {
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       scsi_block_requests(shost);
+               }
+
+               lpfc_destroy_vport_work_array(phba, vports);
+       } else {
+               shost = lpfc_shost_from_vport(phba->pport);
+               scsi_block_requests(shost);
+       }
+
+       while (pring->txcmplq_cnt) {
+               if (i++ > 500)  /* wait up to 5 seconds */
+                       break;
+
+               msleep(10);
+       }
+
+       memset((void *)pmboxq, 0, sizeof(LPFC_MBOXQ_t));
+       pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK;
+       pmboxq->u.mb.mbxOwner = OWN_HOST;
+
+       mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO);
+
+       if ((mbxstatus == MBX_SUCCESS) && (pmboxq->u.mb.mbxStatus == 0)) {
+               /* wait for link down before proceeding */
+               i = 0;
+               while (phba->link_state != LPFC_LINK_DOWN) {
+                       if (i++ > timeout) {
+                               rc = -ETIMEDOUT;
+                               goto loopback_mode_exit;
+                       }
+
+                       msleep(10);
+               }
+
+               memset((void *)pmboxq, 0, sizeof(LPFC_MBOXQ_t));
+               if (link_flags == INTERNAL_LOOP_BACK)
+                       pmboxq->u.mb.un.varInitLnk.link_flags = FLAGS_LOCAL_LB;
+               else
+                       pmboxq->u.mb.un.varInitLnk.link_flags =
+                               FLAGS_TOPOLOGY_MODE_LOOP;
+
+               pmboxq->u.mb.mbxCommand = MBX_INIT_LINK;
+               pmboxq->u.mb.mbxOwner = OWN_HOST;
+
+               mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq,
+                                                    LPFC_MBOX_TMO);
+
+               if ((mbxstatus != MBX_SUCCESS) || (pmboxq->u.mb.mbxStatus))
+                       rc = -ENODEV;
+               else {
+                       phba->link_flag |= LS_LOOPBACK_MODE;
+                       /* wait for the link attention interrupt */
+                       msleep(100);
+
+                       i = 0;
+                       while (phba->link_state != LPFC_HBA_READY) {
+                               if (i++ > timeout) {
+                                       rc = -ETIMEDOUT;
+                                       break;
+                               }
+
+                               msleep(10);
+                       }
+               }
+
+       } else
+               rc = -ENODEV;
+
+loopback_mode_exit:
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports) {
+               for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) {
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       scsi_unblock_requests(shost);
+               }
+               lpfc_destroy_vport_work_array(phba, vports);
+       } else {
+               shost = lpfc_shost_from_vport(phba->pport);
+               scsi_unblock_requests(shost);
+       }
+
+       /*
+        * Let SLI layer release mboxq if mbox command completed after timeout.
+        */
+       if (mbxstatus != MBX_TIMEOUT)
+               mempool_free(pmboxq, phba->mbox_mem_pool);
+
+job_error:
+       /* make error code available to userspace */
+       job->reply->result = rc;
+       /* complete the job back to userspace if no error */
+       if (rc == 0)
+               job->job_done(job);
+       return rc;
+}
+
+/**
+ * lpfcdiag_loop_self_reg - obtains a remote port login id
+ * @phba: Pointer to HBA context object
+ * @rpi: Pointer to a remote port login id
+ *
+ * This function obtains a remote port login id so the diag loopback test
+ * can send and receive its own unsolicited CT command.
+ **/
+static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t * rpi)
+{
+       LPFC_MBOXQ_t *mbox;
+       struct lpfc_dmabuf *dmabuff;
+       int status;
+
+       mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!mbox)
+               return ENOMEM;
+
+       status = lpfc_reg_rpi(phba, 0, phba->pport->fc_myDID,
+                               (uint8_t *)&phba->pport->fc_sparam, mbox, 0);
+       if (status) {
+               mempool_free(mbox, phba->mbox_mem_pool);
+               return ENOMEM;
+       }
+
+       dmabuff = (struct lpfc_dmabuf *) mbox->context1;
+       mbox->context1 = NULL;
+       status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
+
+       if ((status != MBX_SUCCESS) || (mbox->u.mb.mbxStatus)) {
+               lpfc_mbuf_free(phba, dmabuff->virt, dmabuff->phys);
+               kfree(dmabuff);
+               if (status != MBX_TIMEOUT)
+                       mempool_free(mbox, phba->mbox_mem_pool);
+               return ENODEV;
+       }
+
+       *rpi = mbox->u.mb.un.varWords[0];
+
+       lpfc_mbuf_free(phba, dmabuff->virt, dmabuff->phys);
+       kfree(dmabuff);
+       mempool_free(mbox, phba->mbox_mem_pool);
+       return 0;
+}
+
+/**
+ * lpfcdiag_loop_self_unreg - unregs from the rpi
+ * @phba: Pointer to HBA context object
+ * @rpi: Remote port login id
+ *
+ * This function unregisters the rpi obtained in lpfcdiag_loop_self_reg
+ **/
+static int lpfcdiag_loop_self_unreg(struct lpfc_hba *phba, uint16_t rpi)
+{
+       LPFC_MBOXQ_t *mbox;
+       int status;
+
+       /* Allocate mboxq structure */
+       mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (mbox == NULL)
+               return ENOMEM;
+
+       lpfc_unreg_login(phba, 0, rpi, mbox);
+       status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
+
+       if ((status != MBX_SUCCESS) || (mbox->u.mb.mbxStatus)) {
+               if (status != MBX_TIMEOUT)
+                       mempool_free(mbox, phba->mbox_mem_pool);
+               return EIO;
+       }
+
+       mempool_free(mbox, phba->mbox_mem_pool);
+       return 0;
+}
+
+/**
+ * lpfcdiag_loop_get_xri - obtains the transmit and receive ids
+ * @phba: Pointer to HBA context object
+ * @rpi: Remote port login id
+ * @txxri: Pointer to transmit exchange id
+ * @rxxri: Pointer to response exchabge id
+ *
+ * This function obtains the transmit and receive ids required to send
+ * an unsolicited ct command with a payload. A special lpfc FsType and CmdRsp
+ * flags are used to the unsolicted response handler is able to process
+ * the ct command sent on the same port.
+ **/
+static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi,
+                        uint16_t *txxri, uint16_t * rxxri)
+{
+       struct lpfc_bsg_event *evt;
+       struct lpfc_iocbq *cmdiocbq, *rspiocbq;
+       IOCB_t *cmd, *rsp;
+       struct lpfc_dmabuf *dmabuf;
+       struct ulp_bde64 *bpl = NULL;
+       struct lpfc_sli_ct_request *ctreq = NULL;
+       int ret_val = 0;
+       unsigned long flags;
+
+       *txxri = 0;
+       *rxxri = 0;
+       evt = lpfc_bsg_event_new(FC_REG_CT_EVENT, current->pid,
+                               SLI_CT_ELX_LOOPBACK);
+       if (!evt)
+               return ENOMEM;
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       list_add(&evt->node, &phba->ct_ev_waiters);
+       lpfc_bsg_event_ref(evt);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+
+       cmdiocbq = lpfc_sli_get_iocbq(phba);
+       rspiocbq = lpfc_sli_get_iocbq(phba);
+
+       dmabuf = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+       if (dmabuf) {
+               dmabuf->virt = lpfc_mbuf_alloc(phba, 0, &dmabuf->phys);
+               INIT_LIST_HEAD(&dmabuf->list);
+               bpl = (struct ulp_bde64 *) dmabuf->virt;
+               memset(bpl, 0, sizeof(*bpl));
+               ctreq = (struct lpfc_sli_ct_request *)(bpl + 1);
+               bpl->addrHigh =
+                       le32_to_cpu(putPaddrHigh(dmabuf->phys + sizeof(*bpl)));
+               bpl->addrLow =
+                       le32_to_cpu(putPaddrLow(dmabuf->phys + sizeof(*bpl)));
+               bpl->tus.f.bdeFlags = 0;
+               bpl->tus.f.bdeSize = ELX_LOOPBACK_HEADER_SZ;
+               bpl->tus.w = le32_to_cpu(bpl->tus.w);
+       }
+
+       if (cmdiocbq == NULL || rspiocbq == NULL ||
+           dmabuf == NULL || bpl == NULL || ctreq == NULL) {
+               ret_val = ENOMEM;
+               goto err_get_xri_exit;
+       }
+
+       cmd = &cmdiocbq->iocb;
+       rsp = &rspiocbq->iocb;
+
+       memset(ctreq, 0, ELX_LOOPBACK_HEADER_SZ);
+
+       ctreq->RevisionId.bits.Revision = SLI_CT_REVISION;
+       ctreq->RevisionId.bits.InId = 0;
+       ctreq->FsType = SLI_CT_ELX_LOOPBACK;
+       ctreq->FsSubType = 0;
+       ctreq->CommandResponse.bits.CmdRsp = ELX_LOOPBACK_XRI_SETUP;
+       ctreq->CommandResponse.bits.Size = 0;
+
+
+       cmd->un.xseq64.bdl.addrHigh = putPaddrHigh(dmabuf->phys);
+       cmd->un.xseq64.bdl.addrLow = putPaddrLow(dmabuf->phys);
+       cmd->un.xseq64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
+       cmd->un.xseq64.bdl.bdeSize = sizeof(*bpl);
+
+       cmd->un.xseq64.w5.hcsw.Fctl = LA;
+       cmd->un.xseq64.w5.hcsw.Dfctl = 0;
+       cmd->un.xseq64.w5.hcsw.Rctl = FC_RCTL_DD_UNSOL_CTL;
+       cmd->un.xseq64.w5.hcsw.Type = FC_TYPE_CT;
+
+       cmd->ulpCommand = CMD_XMIT_SEQUENCE64_CR;
+       cmd->ulpBdeCount = 1;
+       cmd->ulpLe = 1;
+       cmd->ulpClass = CLASS3;
+       cmd->ulpContext = rpi;
+
+       cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
+       cmdiocbq->vport = phba->pport;
+
+       ret_val = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
+                               rspiocbq,
+                               (phba->fc_ratov * 2)
+                               + LPFC_DRVR_TIMEOUT);
+       if (ret_val)
+               goto err_get_xri_exit;
+
+       *txxri =  rsp->ulpContext;
+
+       evt->waiting = 1;
+       evt->wait_time_stamp = jiffies;
+       ret_val = wait_event_interruptible_timeout(
+               evt->wq, !list_empty(&evt->events_to_see),
+               ((phba->fc_ratov * 2) + LPFC_DRVR_TIMEOUT) * HZ);
+       if (list_empty(&evt->events_to_see))
+               ret_val = (ret_val) ? EINTR : ETIMEDOUT;
+       else {
+               ret_val = IOCB_SUCCESS;
+               spin_lock_irqsave(&phba->ct_ev_lock, flags);
+               list_move(evt->events_to_see.prev, &evt->events_to_get);
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               *rxxri = (list_entry(evt->events_to_get.prev,
+                                    typeof(struct event_data),
+                                    node))->immed_dat;
+       }
+       evt->waiting = 0;
+
+err_get_xri_exit:
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       lpfc_bsg_event_unref(evt); /* release ref */
+       lpfc_bsg_event_unref(evt); /* delete */
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+
+       if (dmabuf) {
+               if (dmabuf->virt)
+                       lpfc_mbuf_free(phba, dmabuf->virt, dmabuf->phys);
+               kfree(dmabuf);
+       }
+
+       if (cmdiocbq && (ret_val != IOCB_TIMEDOUT))
+               lpfc_sli_release_iocbq(phba, cmdiocbq);
+       if (rspiocbq)
+               lpfc_sli_release_iocbq(phba, rspiocbq);
+       return ret_val;
+}
+
+/**
+ * diag_cmd_data_alloc - fills in a bde struct with dma buffers
+ * @phba: Pointer to HBA context object
+ * @bpl: Pointer to 64 bit bde structure
+ * @size: Number of bytes to process
+ * @nocopydata: Flag to copy user data into the allocated buffer
+ *
+ * This function allocates page size buffers and populates an lpfc_dmabufext.
+ * If allowed the user data pointed to with indataptr is copied into the kernel
+ * memory. The chained list of page size buffers is returned.
+ **/
+static struct lpfc_dmabufext *
+diag_cmd_data_alloc(struct lpfc_hba *phba,
+                  struct ulp_bde64 *bpl, uint32_t size,
+                  int nocopydata)
+{
+       struct lpfc_dmabufext *mlist = NULL;
+       struct lpfc_dmabufext *dmp;
+       int cnt, offset = 0, i = 0;
+       struct pci_dev *pcidev;
+
+       pcidev = phba->pcidev;
+
+       while (size) {
+               /* We get chunks of 4K */
+               if (size > BUF_SZ_4K)
+                       cnt = BUF_SZ_4K;
+               else
+                       cnt = size;
+
+               /* allocate struct lpfc_dmabufext buffer header */
+               dmp = kmalloc(sizeof(struct lpfc_dmabufext), GFP_KERNEL);
+               if (!dmp)
+                       goto out;
+
+               INIT_LIST_HEAD(&dmp->dma.list);
+
+               /* Queue it to a linked list */
+               if (mlist)
+                       list_add_tail(&dmp->dma.list, &mlist->dma.list);
+               else
+                       mlist = dmp;
+
+               /* allocate buffer */
+               dmp->dma.virt = dma_alloc_coherent(&pcidev->dev,
+                                                  cnt,
+                                                  &(dmp->dma.phys),
+                                                  GFP_KERNEL);
+
+               if (!dmp->dma.virt)
+                       goto out;
+
+               dmp->size = cnt;
+
+               if (nocopydata) {
+                       bpl->tus.f.bdeFlags = 0;
+                       pci_dma_sync_single_for_device(phba->pcidev,
+                               dmp->dma.phys, LPFC_BPL_SIZE, PCI_DMA_TODEVICE);
+
+               } else {
+                       memset((uint8_t *)dmp->dma.virt, 0, cnt);
+                       bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I;
+               }
+
+               /* build buffer ptr list for IOCB */
+               bpl->addrLow = le32_to_cpu(putPaddrLow(dmp->dma.phys));
+               bpl->addrHigh = le32_to_cpu(putPaddrHigh(dmp->dma.phys));
+               bpl->tus.f.bdeSize = (ushort) cnt;
+               bpl->tus.w = le32_to_cpu(bpl->tus.w);
+               bpl++;
+
+               i++;
+               offset += cnt;
+               size -= cnt;
+       }
+
+       mlist->flag = i;
+       return mlist;
+out:
+       diag_cmd_data_free(phba, mlist);
+       return NULL;
+}
+
+/**
+ * lpfcdiag_loop_post_rxbufs - post the receive buffers for an unsol CT cmd
+ * @phba: Pointer to HBA context object
+ * @rxxri: Receive exchange id
+ * @len: Number of data bytes
+ *
+ * This function allocates and posts a data buffer of sufficient size to recieve
+ * an unsolicted CT command.
+ **/
+static int lpfcdiag_loop_post_rxbufs(struct lpfc_hba *phba, uint16_t rxxri,
+                            size_t len)
+{
+       struct lpfc_sli *psli = &phba->sli;
+       struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING];
+       struct lpfc_iocbq *cmdiocbq;
+       IOCB_t *cmd = NULL;
+       struct list_head head, *curr, *next;
+       struct lpfc_dmabuf *rxbmp;
+       struct lpfc_dmabuf *dmp;
+       struct lpfc_dmabuf *mp[2] = {NULL, NULL};
+       struct ulp_bde64 *rxbpl = NULL;
+       uint32_t num_bde;
+       struct lpfc_dmabufext *rxbuffer = NULL;
+       int ret_val = 0;
+       int i = 0;
+
+       cmdiocbq = lpfc_sli_get_iocbq(phba);
+       rxbmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+       if (rxbmp != NULL) {
+               rxbmp->virt = lpfc_mbuf_alloc(phba, 0, &rxbmp->phys);
+               INIT_LIST_HEAD(&rxbmp->list);
+               rxbpl = (struct ulp_bde64 *) rxbmp->virt;
+               rxbuffer = diag_cmd_data_alloc(phba, rxbpl, len, 0);
+       }
+
+       if (!cmdiocbq || !rxbmp || !rxbpl || !rxbuffer) {
+               ret_val = ENOMEM;
+               goto err_post_rxbufs_exit;
+       }
+
+       /* Queue buffers for the receive exchange */
+       num_bde = (uint32_t)rxbuffer->flag;
+       dmp = &rxbuffer->dma;
+
+       cmd = &cmdiocbq->iocb;
+       i = 0;
+
+       INIT_LIST_HEAD(&head);
+       list_add_tail(&head, &dmp->list);
+       list_for_each_safe(curr, next, &head) {
+               mp[i] = list_entry(curr, struct lpfc_dmabuf, list);
+               list_del(curr);
+
+               if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
+                       mp[i]->buffer_tag = lpfc_sli_get_buffer_tag(phba);
+                       cmd->un.quexri64cx.buff.bde.addrHigh =
+                               putPaddrHigh(mp[i]->phys);
+                       cmd->un.quexri64cx.buff.bde.addrLow =
+                               putPaddrLow(mp[i]->phys);
+                       cmd->un.quexri64cx.buff.bde.tus.f.bdeSize =
+                               ((struct lpfc_dmabufext *)mp[i])->size;
+                       cmd->un.quexri64cx.buff.buffer_tag = mp[i]->buffer_tag;
+                       cmd->ulpCommand = CMD_QUE_XRI64_CX;
+                       cmd->ulpPU = 0;
+                       cmd->ulpLe = 1;
+                       cmd->ulpBdeCount = 1;
+                       cmd->unsli3.que_xri64cx_ext_words.ebde_count = 0;
+
+               } else {
+                       cmd->un.cont64[i].addrHigh = putPaddrHigh(mp[i]->phys);
+                       cmd->un.cont64[i].addrLow = putPaddrLow(mp[i]->phys);
+                       cmd->un.cont64[i].tus.f.bdeSize =
+                               ((struct lpfc_dmabufext *)mp[i])->size;
+                                       cmd->ulpBdeCount = ++i;
+
+                       if ((--num_bde > 0) && (i < 2))
+                               continue;
+
+                       cmd->ulpCommand = CMD_QUE_XRI_BUF64_CX;
+                       cmd->ulpLe = 1;
+               }
+
+               cmd->ulpClass = CLASS3;
+               cmd->ulpContext = rxxri;
+
+               ret_val = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, cmdiocbq, 0);
+
+               if (ret_val == IOCB_ERROR) {
+                       diag_cmd_data_free(phba,
+                               (struct lpfc_dmabufext *)mp[0]);
+                       if (mp[1])
+                               diag_cmd_data_free(phba,
+                                         (struct lpfc_dmabufext *)mp[1]);
+                       dmp = list_entry(next, struct lpfc_dmabuf, list);
+                       ret_val = EIO;
+                       goto err_post_rxbufs_exit;
+               }
+
+               lpfc_sli_ringpostbuf_put(phba, pring, mp[0]);
+               if (mp[1]) {
+                       lpfc_sli_ringpostbuf_put(phba, pring, mp[1]);
+                       mp[1] = NULL;
+               }
+
+               /* The iocb was freed by lpfc_sli_issue_iocb */
+               cmdiocbq = lpfc_sli_get_iocbq(phba);
+               if (!cmdiocbq) {
+                       dmp = list_entry(next, struct lpfc_dmabuf, list);
+                       ret_val = EIO;
+                       goto err_post_rxbufs_exit;
+               }
+
+               cmd = &cmdiocbq->iocb;
+               i = 0;
+       }
+       list_del(&head);
+
+err_post_rxbufs_exit:
+
+       if (rxbmp) {
+               if (rxbmp->virt)
+                       lpfc_mbuf_free(phba, rxbmp->virt, rxbmp->phys);
+               kfree(rxbmp);
+       }
+
+       if (cmdiocbq)
+               lpfc_sli_release_iocbq(phba, cmdiocbq);
+       return ret_val;
+}
+
+/**
+ * lpfc_bsg_diag_test - with a port in loopback issues a Ct cmd to itself
+ * @job: LPFC_BSG_VENDOR_DIAG_TEST fc_bsg_job
+ *
+ * This function receives a user data buffer to be transmitted and received on
+ * the same port, the link must be up and in loopback mode prior
+ * to being called.
+ * 1. A kernel buffer is allocated to copy the user data into.
+ * 2. The port registers with "itself".
+ * 3. The transmit and receive exchange ids are obtained.
+ * 4. The receive exchange id is posted.
+ * 5. A new els loopback event is created.
+ * 6. The command and response iocbs are allocated.
+ * 7. The cmd iocb FsType is set to elx loopback and the CmdRsp to looppback.
+ *
+ * This function is meant to be called n times while the port is in loopback
+ * so it is the apps responsibility to issue a reset to take the port out
+ * of loopback mode.
+ **/
+static int
+lpfc_bsg_diag_test(struct fc_bsg_job *job)
+{
+       struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+       struct lpfc_hba *phba = vport->phba;
+       struct diag_mode_test *diag_mode;
+       struct lpfc_bsg_event *evt;
+       struct event_data *evdat;
+       struct lpfc_sli *psli = &phba->sli;
+       uint32_t size;
+       uint32_t full_size;
+       size_t segment_len = 0, segment_offset = 0, current_offset = 0;
+       uint16_t rpi;
+       struct lpfc_iocbq *cmdiocbq, *rspiocbq;
+       IOCB_t *cmd, *rsp;
+       struct lpfc_sli_ct_request *ctreq;
+       struct lpfc_dmabuf *txbmp;
+       struct ulp_bde64 *txbpl = NULL;
+       struct lpfc_dmabufext *txbuffer = NULL;
+       struct list_head head;
+       struct lpfc_dmabuf  *curr;
+       uint16_t txxri, rxxri;
+       uint32_t num_bde;
+       uint8_t *ptr = NULL, *rx_databuf = NULL;
+       int rc = 0;
+       unsigned long flags;
+       void *dataout = NULL;
+       uint32_t total_mem;
+
+       /* in case no data is returned return just the return code */
+       job->reply->reply_payload_rcv_len = 0;
+
+       if (job->request_len <
+           sizeof(struct fc_bsg_request) + sizeof(struct diag_mode_test)) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2739 Received DIAG TEST request below minimum "
+                               "size\n");
+               rc = -EINVAL;
+               goto loopback_test_exit;
+       }
+
+       if (job->request_payload.payload_len !=
+               job->reply_payload.payload_len) {
+               rc = -EINVAL;
+               goto loopback_test_exit;
+       }
+
+       diag_mode = (struct diag_mode_test *)
+               job->request->rqst_data.h_vendor.vendor_cmd;
+
+       if ((phba->link_state == LPFC_HBA_ERROR) ||
+           (psli->sli_flag & LPFC_BLOCK_MGMT_IO) ||
+           (!(psli->sli_flag & LPFC_SLI_ACTIVE))) {
+               rc = -EACCES;
+               goto loopback_test_exit;
+       }
+
+       if (!lpfc_is_link_up(phba) || !(phba->link_flag & LS_LOOPBACK_MODE)) {
+               rc = -EACCES;
+               goto loopback_test_exit;
+       }
+
+       size = job->request_payload.payload_len;
+       full_size = size + ELX_LOOPBACK_HEADER_SZ; /* plus the header */
+
+       if ((size == 0) || (size > 80 * BUF_SZ_4K)) {
+               rc = -ERANGE;
+               goto loopback_test_exit;
+       }
+
+       if (size >= BUF_SZ_4K) {
+               /*
+                * Allocate memory for ioctl data. If buffer is bigger than 64k,
+                * then we allocate 64k and re-use that buffer over and over to
+                * xfer the whole block. This is because Linux kernel has a
+                * problem allocating more than 120k of kernel space memory. Saw
+                * problem with GET_FCPTARGETMAPPING...
+                */
+               if (size <= (64 * 1024))
+                       total_mem = size;
+               else
+                       total_mem = 64 * 1024;
+       } else
+               /* Allocate memory for ioctl data */
+               total_mem = BUF_SZ_4K;
+
+       dataout = kmalloc(total_mem, GFP_KERNEL);
+       if (dataout == NULL) {
+               rc = -ENOMEM;
+               goto loopback_test_exit;
+       }
+
+       ptr = dataout;
+       ptr += ELX_LOOPBACK_HEADER_SZ;
+       sg_copy_to_buffer(job->request_payload.sg_list,
+                               job->request_payload.sg_cnt,
+                               ptr, size);
+
+       rc = lpfcdiag_loop_self_reg(phba, &rpi);
+       if (rc) {
+               rc = -ENOMEM;
+               goto loopback_test_exit;
+       }
+
+       rc = lpfcdiag_loop_get_xri(phba, rpi, &txxri, &rxxri);
+       if (rc) {
+               lpfcdiag_loop_self_unreg(phba, rpi);
+               rc = -ENOMEM;
+               goto loopback_test_exit;
+       }
+
+       rc = lpfcdiag_loop_post_rxbufs(phba, rxxri, full_size);
+       if (rc) {
+               lpfcdiag_loop_self_unreg(phba, rpi);
+               rc = -ENOMEM;
+               goto loopback_test_exit;
+       }
+
+       evt = lpfc_bsg_event_new(FC_REG_CT_EVENT, current->pid,
+                               SLI_CT_ELX_LOOPBACK);
+       if (!evt) {
+               lpfcdiag_loop_self_unreg(phba, rpi);
+               rc = -ENOMEM;
+               goto loopback_test_exit;
+       }
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       list_add(&evt->node, &phba->ct_ev_waiters);
+       lpfc_bsg_event_ref(evt);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+
+       cmdiocbq = lpfc_sli_get_iocbq(phba);
+       rspiocbq = lpfc_sli_get_iocbq(phba);
+       txbmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+
+       if (txbmp) {
+               txbmp->virt = lpfc_mbuf_alloc(phba, 0, &txbmp->phys);
+               INIT_LIST_HEAD(&txbmp->list);
+               txbpl = (struct ulp_bde64 *) txbmp->virt;
+               if (txbpl)
+                       txbuffer = diag_cmd_data_alloc(phba,
+                                                       txbpl, full_size, 0);
+       }
+
+       if (!cmdiocbq || !rspiocbq || !txbmp || !txbpl || !txbuffer) {
+               rc = -ENOMEM;
+               goto err_loopback_test_exit;
+       }
+
+       cmd = &cmdiocbq->iocb;
+       rsp = &rspiocbq->iocb;
+
+       INIT_LIST_HEAD(&head);
+       list_add_tail(&head, &txbuffer->dma.list);
+       list_for_each_entry(curr, &head, list) {
+               segment_len = ((struct lpfc_dmabufext *)curr)->size;
+               if (current_offset == 0) {
+                       ctreq = curr->virt;
+                       memset(ctreq, 0, ELX_LOOPBACK_HEADER_SZ);
+                       ctreq->RevisionId.bits.Revision = SLI_CT_REVISION;
+                       ctreq->RevisionId.bits.InId = 0;
+                       ctreq->FsType = SLI_CT_ELX_LOOPBACK;
+                       ctreq->FsSubType = 0;
+                       ctreq->CommandResponse.bits.CmdRsp = ELX_LOOPBACK_DATA;
+                       ctreq->CommandResponse.bits.Size   = size;
+                       segment_offset = ELX_LOOPBACK_HEADER_SZ;
+               } else
+                       segment_offset = 0;
+
+               BUG_ON(segment_offset >= segment_len);
+               memcpy(curr->virt + segment_offset,
+                       ptr + current_offset,
+                       segment_len - segment_offset);
+
+               current_offset += segment_len - segment_offset;
+               BUG_ON(current_offset > size);
+       }
+       list_del(&head);
+
+       /* Build the XMIT_SEQUENCE iocb */
+
+       num_bde = (uint32_t)txbuffer->flag;
+
+       cmd->un.xseq64.bdl.addrHigh = putPaddrHigh(txbmp->phys);
+       cmd->un.xseq64.bdl.addrLow = putPaddrLow(txbmp->phys);
+       cmd->un.xseq64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
+       cmd->un.xseq64.bdl.bdeSize = (num_bde * sizeof(struct ulp_bde64));
+
+       cmd->un.xseq64.w5.hcsw.Fctl = (LS | LA);
+       cmd->un.xseq64.w5.hcsw.Dfctl = 0;
+       cmd->un.xseq64.w5.hcsw.Rctl = FC_RCTL_DD_UNSOL_CTL;
+       cmd->un.xseq64.w5.hcsw.Type = FC_TYPE_CT;
+
+       cmd->ulpCommand = CMD_XMIT_SEQUENCE64_CX;
+       cmd->ulpBdeCount = 1;
+       cmd->ulpLe = 1;
+       cmd->ulpClass = CLASS3;
+       cmd->ulpContext = txxri;
+
+       cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
+       cmdiocbq->vport = phba->pport;
+
+       rc = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, rspiocbq,
+                                     (phba->fc_ratov * 2) + LPFC_DRVR_TIMEOUT);
+
+       if ((rc != IOCB_SUCCESS) || (rsp->ulpStatus != IOCB_SUCCESS)) {
+               rc = -EIO;
+               goto err_loopback_test_exit;
+       }
+
+       evt->waiting = 1;
+       rc = wait_event_interruptible_timeout(
+               evt->wq, !list_empty(&evt->events_to_see),
+               ((phba->fc_ratov * 2) + LPFC_DRVR_TIMEOUT) * HZ);
+       evt->waiting = 0;
+       if (list_empty(&evt->events_to_see))
+               rc = (rc) ? -EINTR : -ETIMEDOUT;
+       else {
+               spin_lock_irqsave(&phba->ct_ev_lock, flags);
+               list_move(evt->events_to_see.prev, &evt->events_to_get);
+               evdat = list_entry(evt->events_to_get.prev,
+                                  typeof(*evdat), node);
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               rx_databuf = evdat->data;
+               if (evdat->len != full_size) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
+                               "1603 Loopback test did not receive expected "
+                               "data length. actual length 0x%x expected "
+                               "length 0x%x\n",
+                               evdat->len, full_size);
+                       rc = -EIO;
+               } else if (rx_databuf == NULL)
+                       rc = -EIO;
+               else {
+                       rc = IOCB_SUCCESS;
+                       /* skip over elx loopback header */
+                       rx_databuf += ELX_LOOPBACK_HEADER_SZ;
+                       job->reply->reply_payload_rcv_len =
+                               sg_copy_from_buffer(job->reply_payload.sg_list,
+                                                   job->reply_payload.sg_cnt,
+                                                   rx_databuf, size);
+                       job->reply->reply_payload_rcv_len = size;
+               }
+       }
+
+err_loopback_test_exit:
+       lpfcdiag_loop_self_unreg(phba, rpi);
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       lpfc_bsg_event_unref(evt); /* release ref */
+       lpfc_bsg_event_unref(evt); /* delete */
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+
+       if (cmdiocbq != NULL)
+               lpfc_sli_release_iocbq(phba, cmdiocbq);
+
+       if (rspiocbq != NULL)
+               lpfc_sli_release_iocbq(phba, rspiocbq);
+
+       if (txbmp != NULL) {
+               if (txbpl != NULL) {
+                       if (txbuffer != NULL)
+                               diag_cmd_data_free(phba, txbuffer);
+                       lpfc_mbuf_free(phba, txbmp->virt, txbmp->phys);
+               }
+               kfree(txbmp);
+       }
+
+loopback_test_exit:
+       kfree(dataout);
+       /* make error code available to userspace */
+       job->reply->result = rc;
+       job->dd_data = NULL;
+       /* complete the job back to userspace if no error */
+       if (rc == 0)
+               job->job_done(job);
+       return rc;
+}
+
+/**
+ * lpfc_bsg_get_dfc_rev - process a GET_DFC_REV bsg vendor command
+ * @job: GET_DFC_REV fc_bsg_job
+ **/
+static int
+lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
+{
+       struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+       struct lpfc_hba *phba = vport->phba;
+       struct get_mgmt_rev *event_req;
+       struct get_mgmt_rev_reply *event_reply;
+       int rc = 0;
+
+       if (job->request_len <
+           sizeof(struct fc_bsg_request) + sizeof(struct get_mgmt_rev)) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2740 Received GET_DFC_REV request below "
+                               "minimum size\n");
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       event_req = (struct get_mgmt_rev *)
+               job->request->rqst_data.h_vendor.vendor_cmd;
+
+       event_reply = (struct get_mgmt_rev_reply *)
+               job->reply->reply_data.vendor_reply.vendor_rsp;
+
+       if (job->reply_len <
+           sizeof(struct fc_bsg_request) + sizeof(struct get_mgmt_rev_reply)) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2741 Received GET_DFC_REV reply below "
+                               "minimum size\n");
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       event_reply->info.a_Major = MANAGEMENT_MAJOR_REV;
+       event_reply->info.a_Minor = MANAGEMENT_MINOR_REV;
+job_error:
+       job->reply->result = rc;
+       if (rc == 0)
+               job->job_done(job);
+       return rc;
+}
+
+/**
+ * lpfc_bsg_wake_mbox_wait - lpfc_bsg_issue_mbox mbox completion handler
+ * @phba: Pointer to HBA context object.
+ * @pmboxq: Pointer to mailbox command.
+ *
+ * This is completion handler function for mailbox commands issued from
+ * lpfc_bsg_issue_mbox function. This function is called by the
+ * mailbox event handler function with no lock held. This function
+ * will wake up thread waiting on the wait queue pointed by context1
+ * of the mailbox.
+ **/
+void
+lpfc_bsg_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
+{
+       struct bsg_job_data *dd_data;
+       MAILBOX_t *pmb;
+       MAILBOX_t *mb;
+       struct fc_bsg_job *job;
+       uint32_t size;
+       unsigned long flags;
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       dd_data = pmboxq->context1;
+       if (!dd_data) {
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               return;
+       }
+
+       pmb = &dd_data->context_un.mbox.pmboxq->u.mb;
+       mb = dd_data->context_un.mbox.mb;
+       job = dd_data->context_un.mbox.set_job;
+       memcpy(mb, pmb, sizeof(*pmb));
+       size = job->request_payload.payload_len;
+       job->reply->reply_payload_rcv_len =
+               sg_copy_from_buffer(job->reply_payload.sg_list,
+                               job->reply_payload.sg_cnt,
+                               mb, size);
+       job->reply->result = 0;
+       dd_data->context_un.mbox.set_job = NULL;
+       job->dd_data = NULL;
+       job->job_done(job);
+       spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+       mempool_free(dd_data->context_un.mbox.pmboxq, phba->mbox_mem_pool);
+       kfree(mb);
+       kfree(dd_data);
+       return;
+}
+
+/**
+ * lpfc_bsg_check_cmd_access - test for a supported mailbox command
+ * @phba: Pointer to HBA context object.
+ * @mb: Pointer to a mailbox object.
+ * @vport: Pointer to a vport object.
+ *
+ * Some commands require the port to be offline, some may not be called from
+ * the application.
+ **/
+static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba,
+       MAILBOX_t *mb, struct lpfc_vport *vport)
+{
+       /* return negative error values for bsg job */
+       switch (mb->mbxCommand) {
+       /* Offline only */
+       case MBX_INIT_LINK:
+       case MBX_DOWN_LINK:
+       case MBX_CONFIG_LINK:
+       case MBX_CONFIG_RING:
+       case MBX_RESET_RING:
+       case MBX_UNREG_LOGIN:
+       case MBX_CLEAR_LA:
+       case MBX_DUMP_CONTEXT:
+       case MBX_RUN_DIAGS:
+       case MBX_RESTART:
+       case MBX_SET_MASK:
+               if (!(vport->fc_flag & FC_OFFLINE_MODE)) {
+                       lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2743 Command 0x%x is illegal in on-line "
+                               "state\n",
+                               mb->mbxCommand);
+                       return -EPERM;
+               }
+       case MBX_WRITE_NV:
+       case MBX_WRITE_VPARMS:
+       case MBX_LOAD_SM:
+       case MBX_READ_NV:
+       case MBX_READ_CONFIG:
+       case MBX_READ_RCONFIG:
+       case MBX_READ_STATUS:
+       case MBX_READ_XRI:
+       case MBX_READ_REV:
+       case MBX_READ_LNK_STAT:
+       case MBX_DUMP_MEMORY:
+       case MBX_DOWN_LOAD:
+       case MBX_UPDATE_CFG:
+       case MBX_KILL_BOARD:
+       case MBX_LOAD_AREA:
+       case MBX_LOAD_EXP_ROM:
+       case MBX_BEACON:
+       case MBX_DEL_LD_ENTRY:
+       case MBX_SET_DEBUG:
+       case MBX_WRITE_WWN:
+       case MBX_SLI4_CONFIG:
+       case MBX_READ_EVENT_LOG_STATUS:
+       case MBX_WRITE_EVENT_LOG:
+       case MBX_PORT_CAPABILITIES:
+       case MBX_PORT_IOV_CONTROL:
+               break;
+       case MBX_SET_VARIABLE:
+       case MBX_RUN_BIU_DIAG64:
+       case MBX_READ_EVENT_LOG:
+       case MBX_READ_SPARM64:
+       case MBX_READ_LA:
+       case MBX_READ_LA64:
+       case MBX_REG_LOGIN:
+       case MBX_REG_LOGIN64:
+       case MBX_CONFIG_PORT:
+       case MBX_RUN_BIU_DIAG:
+       default:
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                       "2742 Unknown Command 0x%x\n",
+                       mb->mbxCommand);
+               return -EPERM;
+       }
+
+       return 0; /* ok */
+}
+
+/**
+ * lpfc_bsg_issue_mbox - issues a mailbox command on behalf of an app
+ * @phba: Pointer to HBA context object.
+ * @mb: Pointer to a mailbox object.
+ * @vport: Pointer to a vport object.
+ *
+ * Allocate a tracking object, mailbox command memory, get a mailbox
+ * from the mailbox pool, copy the caller mailbox command.
+ *
+ * If offline and the sli is active we need to poll for the command (port is
+ * being reset) and com-plete the job, otherwise issue the mailbox command and
+ * let our completion handler finish the command.
+ **/
+static uint32_t
+lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job,
+       struct lpfc_vport *vport)
+{
+       LPFC_MBOXQ_t *pmboxq;
+       MAILBOX_t *pmb;
+       MAILBOX_t *mb;
+       struct bsg_job_data *dd_data;
+       uint32_t size;
+       int rc = 0;
+
+       /* allocate our bsg tracking structure */
+       dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
+       if (!dd_data) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2727 Failed allocation of dd_data\n");
+               return -ENOMEM;
+       }
+
+       mb = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       if (!mb) {
+               kfree(dd_data);
+               return -ENOMEM;
+       }
+
+       pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!pmboxq) {
+               kfree(dd_data);
+               kfree(mb);
+               return -ENOMEM;
+       }
+
+       size = job->request_payload.payload_len;
+       job->reply->reply_payload_rcv_len =
+               sg_copy_to_buffer(job->request_payload.sg_list,
+                               job->request_payload.sg_cnt,
+                               mb, size);
+
+       rc = lpfc_bsg_check_cmd_access(phba, mb, vport);
+       if (rc != 0) {
+               kfree(dd_data);
+               kfree(mb);
+               mempool_free(pmboxq, phba->mbox_mem_pool);
+               return rc; /* must be negative */
+       }
+
+       memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t));
+       pmb = &pmboxq->u.mb;
+       memcpy(pmb, mb, sizeof(*pmb));
+       pmb->mbxOwner = OWN_HOST;
+       pmboxq->context1 = NULL;
+       pmboxq->vport = vport;
+
+       if ((vport->fc_flag & FC_OFFLINE_MODE) ||
+           (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE))) {
+               rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL);
+               if (rc != MBX_SUCCESS) {
+                       if (rc != MBX_TIMEOUT) {
+                               kfree(dd_data);
+                               kfree(mb);
+                               mempool_free(pmboxq, phba->mbox_mem_pool);
+                       }
+                       return  (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV;
+               }
+
+               memcpy(mb, pmb, sizeof(*pmb));
+               job->reply->reply_payload_rcv_len =
+                       sg_copy_from_buffer(job->reply_payload.sg_list,
+                                       job->reply_payload.sg_cnt,
+                                       mb, size);
+               kfree(dd_data);
+               kfree(mb);
+               mempool_free(pmboxq, phba->mbox_mem_pool);
+               /* not waiting mbox already done */
+               return 0;
+       }
+
+       /* setup wake call as IOCB callback */
+       pmboxq->mbox_cmpl = lpfc_bsg_wake_mbox_wait;
+       /* setup context field to pass wait_queue pointer to wake function */
+       pmboxq->context1 = dd_data;
+       dd_data->type = TYPE_MBOX;
+       dd_data->context_un.mbox.pmboxq = pmboxq;
+       dd_data->context_un.mbox.mb = mb;
+       dd_data->context_un.mbox.set_job = job;
+       job->dd_data = dd_data;
+       rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT);
+       if ((rc != MBX_SUCCESS) && (rc != MBX_BUSY)) {
+               kfree(dd_data);
+               kfree(mb);
+               mempool_free(pmboxq, phba->mbox_mem_pool);
+               return -EIO;
+       }
+
+       return 1;
+}
+
+/**
+ * lpfc_bsg_mbox_cmd - process an fc bsg LPFC_BSG_VENDOR_MBOX command
+ * @job: MBOX fc_bsg_job for LPFC_BSG_VENDOR_MBOX.
+ **/
+static int
+lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
+{
+       struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+       struct lpfc_hba *phba = vport->phba;
+       int rc = 0;
+
+       /* in case no data is transferred */
+       job->reply->reply_payload_rcv_len = 0;
+       if (job->request_len <
+           sizeof(struct fc_bsg_request) + sizeof(struct dfc_mbox_req)) {
+               lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
+                               "2737 Received MBOX_REQ request below "
+                               "minimum size\n");
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       if (job->request_payload.payload_len != PAGE_SIZE) {
+               rc = -EINVAL;
+               goto job_error;
+       }
+
+       if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) {
+               rc = -EAGAIN;
+               goto job_error;
+       }
+
+       rc = lpfc_bsg_issue_mbox(phba, job, vport);
+
+job_error:
+       if (rc == 0) {
+               /* job done */
+               job->reply->result = 0;
+               job->dd_data = NULL;
+               job->job_done(job);
+       } else if (rc == 1)
+               /* job submitted, will complete later*/
+               rc = 0; /* return zero, no error */
+       else {
+               /* some error occurred */
+               job->reply->result = rc;
+               job->dd_data = NULL;
+       }
+
+       return rc;
+}
+
+/**
+ * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job
+ * @job: fc_bsg_job to handle
+ **/
+static int
+lpfc_bsg_hst_vendor(struct fc_bsg_job *job)
+{
+       int command = job->request->rqst_data.h_vendor.vendor_cmd[0];
+       int rc;
+
+       switch (command) {
+       case LPFC_BSG_VENDOR_SET_CT_EVENT:
+               rc = lpfc_bsg_hba_set_event(job);
+               break;
+       case LPFC_BSG_VENDOR_GET_CT_EVENT:
+               rc = lpfc_bsg_hba_get_event(job);
+               break;
+       case LPFC_BSG_VENDOR_SEND_MGMT_RESP:
+               rc = lpfc_bsg_send_mgmt_rsp(job);
+               break;
+       case LPFC_BSG_VENDOR_DIAG_MODE:
+               rc = lpfc_bsg_diag_mode(job);
+               break;
+       case LPFC_BSG_VENDOR_DIAG_TEST:
+               rc = lpfc_bsg_diag_test(job);
+               break;
+       case LPFC_BSG_VENDOR_GET_MGMT_REV:
+               rc = lpfc_bsg_get_dfc_rev(job);
+               break;
+       case LPFC_BSG_VENDOR_MBOX:
+               rc = lpfc_bsg_mbox_cmd(job);
+               break;
+       default:
+               rc = -EINVAL;
+               job->reply->reply_payload_rcv_len = 0;
+               /* make error code available to userspace */
+               job->reply->result = rc;
+               break;
+       }
+
+       return rc;
+}
+
+/**
+ * lpfc_bsg_request - handle a bsg request from the FC transport
+ * @job: fc_bsg_job to handle
+ **/
+int
+lpfc_bsg_request(struct fc_bsg_job *job)
+{
+       uint32_t msgcode;
+       int rc;
+
+       msgcode = job->request->msgcode;
+       switch (msgcode) {
+       case FC_BSG_HST_VENDOR:
+               rc = lpfc_bsg_hst_vendor(job);
+               break;
+       case FC_BSG_RPT_ELS:
+               rc = lpfc_bsg_rport_els(job);
+               break;
+       case FC_BSG_RPT_CT:
+               rc = lpfc_bsg_send_mgmt_cmd(job);
+               break;
+       default:
+               rc = -EINVAL;
+               job->reply->reply_payload_rcv_len = 0;
+               /* make error code available to userspace */
+               job->reply->result = rc;
+               break;
+       }
+
+       return rc;
+}
+
+/**
+ * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport
+ * @job: fc_bsg_job that has timed out
+ *
+ * This function just aborts the job's IOCB.  The aborted IOCB will return to
+ * the waiting function which will handle passing the error back to userspace
+ **/
+int
+lpfc_bsg_timeout(struct fc_bsg_job *job)
+{
+       struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+       struct lpfc_hba *phba = vport->phba;
+       struct lpfc_iocbq *cmdiocb;
+       struct lpfc_bsg_event *evt;
+       struct lpfc_bsg_iocb *iocb;
+       struct lpfc_bsg_mbox *mbox;
+       struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
+       struct bsg_job_data *dd_data;
+       unsigned long flags;
+
+       spin_lock_irqsave(&phba->ct_ev_lock, flags);
+       dd_data = (struct bsg_job_data *)job->dd_data;
+       /* timeout and completion crossed paths if no dd_data */
+       if (!dd_data) {
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               return 0;
+       }
+
+       switch (dd_data->type) {
+       case TYPE_IOCB:
+               iocb = &dd_data->context_un.iocb;
+               cmdiocb = iocb->cmdiocbq;
+               /* hint to completion handler that the job timed out */
+               job->reply->result = -EAGAIN;
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               /* this will call our completion handler */
+               spin_lock_irq(&phba->hbalock);
+               lpfc_sli_issue_abort_iotag(phba, pring, cmdiocb);
+               spin_unlock_irq(&phba->hbalock);
+               break;
+       case TYPE_EVT:
+               evt = dd_data->context_un.evt;
+               /* this event has no job anymore */
+               evt->set_job = NULL;
+               job->dd_data = NULL;
+               job->reply->reply_payload_rcv_len = 0;
+               /* Return -EAGAIN which is our way of signallying the
+                * app to retry.
+                */
+               job->reply->result = -EAGAIN;
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               job->job_done(job);
+               break;
+       case TYPE_MBOX:
+               mbox = &dd_data->context_un.mbox;
+               /* this mbox has no job anymore */
+               mbox->set_job = NULL;
+               job->dd_data = NULL;
+               job->reply->reply_payload_rcv_len = 0;
+               job->reply->result = -EAGAIN;
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               job->job_done(job);
+               break;
+       default:
+               spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
+               break;
+       }
 
+       /* scsi transport fc fc_bsg_job_timeout expects a zero return code,
+        * otherwise an error message will be displayed on the console
+        * so always return success (zero)
+        */
        return 0;
 }
diff --git a/drivers/scsi/lpfc/lpfc_bsg.h b/drivers/scsi/lpfc/lpfc_bsg.h
new file mode 100644 (file)
index 0000000..6c8f87e
--- /dev/null
@@ -0,0 +1,98 @@
+/*******************************************************************
+ * This file is part of the Emulex Linux Device Driver for         *
+ * Fibre Channel Host Bus Adapters.                                *
+ * Copyright (C) 2010 Emulex.  All rights reserved.                *
+ * EMULEX and SLI are trademarks of Emulex.                        *
+ * www.emulex.com                                                  *
+ *                                                                 *
+ * This program is free software; you can redistribute it and/or   *
+ * modify it under the terms of version 2 of the GNU General       *
+ * Public License as published by the Free Software Foundation.    *
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package.                                     *
+ *******************************************************************/
+/* bsg definitions
+ * No pointers to user data are allowed, all application buffers and sizes will
+ * derived through the bsg interface.
+ *
+ * These are the vendor unique structures passed in using the bsg
+ * FC_BSG_HST_VENDOR message code type.
+ */
+#define LPFC_BSG_VENDOR_SET_CT_EVENT   1
+#define LPFC_BSG_VENDOR_GET_CT_EVENT   2
+#define LPFC_BSG_VENDOR_SEND_MGMT_RESP 3
+#define LPFC_BSG_VENDOR_DIAG_MODE      4
+#define LPFC_BSG_VENDOR_DIAG_TEST      5
+#define LPFC_BSG_VENDOR_GET_MGMT_REV   6
+#define LPFC_BSG_VENDOR_MBOX           7
+
+struct set_ct_event {
+       uint32_t command;
+       uint32_t type_mask;
+       uint32_t ev_req_id;
+       uint32_t ev_reg_id;
+};
+
+struct get_ct_event {
+       uint32_t command;
+       uint32_t ev_reg_id;
+       uint32_t ev_req_id;
+};
+
+struct get_ct_event_reply {
+       uint32_t immed_data;
+       uint32_t type;
+};
+
+struct send_mgmt_resp {
+       uint32_t command;
+       uint32_t tag;
+};
+
+
+#define INTERNAL_LOOP_BACK 0x1 /* adapter short cuts the loop internally */
+#define EXTERNAL_LOOP_BACK 0x2 /* requires an external loopback plug */
+
+struct diag_mode_set {
+       uint32_t command;
+       uint32_t type;
+       uint32_t timeout;
+};
+
+struct diag_mode_test {
+       uint32_t command;
+};
+
+#define LPFC_WWNN_TYPE         0
+#define LPFC_WWPN_TYPE         1
+
+struct get_mgmt_rev {
+       uint32_t command;
+};
+
+#define MANAGEMENT_MAJOR_REV   1
+#define MANAGEMENT_MINOR_REV   0
+
+/* the MgmtRevInfo structure */
+struct MgmtRevInfo {
+       uint32_t a_Major;
+       uint32_t a_Minor;
+};
+
+struct get_mgmt_rev_reply {
+       struct MgmtRevInfo info;
+};
+
+struct dfc_mbox_req {
+       uint32_t command;
+       uint32_t inExtWLen;
+       uint32_t outExtWLen;
+       uint8_t mbOffset;
+};
+
index 650494d622c179140db6b7099fb7a75dfde11162..6f0fb51eb4616899538e7e3927d8876e4431d412 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2008 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -44,18 +44,26 @@ int lpfc_reg_rpi(struct lpfc_hba *, uint16_t, uint32_t, uint8_t *,
 void lpfc_unreg_login(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *);
 void lpfc_unreg_did(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *);
 void lpfc_reg_vpi(struct lpfc_vport *, LPFC_MBOXQ_t *);
+void lpfc_register_new_vport(struct lpfc_hba *, struct lpfc_vport *,
+                       struct lpfc_nodelist *);
 void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *);
 void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
 void lpfc_request_features(struct lpfc_hba *, struct lpfcMboxq *);
+void lpfc_supported_pages(struct lpfcMboxq *);
+void lpfc_sli4_params(struct lpfcMboxq *);
+int lpfc_pc_sli4_params_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
 
 struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t);
 void lpfc_cleanup_rcv_buffers(struct lpfc_vport *);
 void lpfc_rcv_seq_check_edtov(struct lpfc_vport *);
 void lpfc_cleanup_rpis(struct lpfc_vport *, int);
+void lpfc_cleanup_pending_mbox(struct lpfc_vport *);
 int lpfc_linkdown(struct lpfc_hba *);
 void lpfc_linkdown_port(struct lpfc_vport *);
 void lpfc_port_link_failure(struct lpfc_vport *);
 void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
+void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
+void lpfc_retry_pport_discovery(struct lpfc_hba *);
 
 void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
 void lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -73,6 +81,7 @@ void lpfc_set_disctmo(struct lpfc_vport *);
 int  lpfc_can_disctmo(struct lpfc_vport *);
 int  lpfc_unreg_rpi(struct lpfc_vport *, struct lpfc_nodelist *);
 void lpfc_unreg_all_rpis(struct lpfc_vport *);
+void lpfc_unreg_hba_rpis(struct lpfc_hba *);
 void lpfc_unreg_default_rpis(struct lpfc_vport *);
 void lpfc_issue_reg_vpi(struct lpfc_hba *, struct lpfc_vport *);
 
@@ -99,7 +108,7 @@ int lpfc_disc_state_machine(struct lpfc_vport *, struct lpfc_nodelist *, void *,
 
 void lpfc_do_scr_ns_plogi(struct lpfc_hba *, struct lpfc_vport *);
 int lpfc_check_sparm(struct lpfc_vport *, struct lpfc_nodelist *,
-                    struct serv_parm *, uint32_t);
+                    struct serv_parm *, uint32_t, int);
 int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist *);
 void lpfc_more_plogi(struct lpfc_vport *);
 void lpfc_more_adisc(struct lpfc_vport *);
@@ -197,6 +206,7 @@ void lpfc_reg_fcfi(struct lpfc_hba *, struct lpfcMboxq *);
 void lpfc_unreg_fcfi(struct lpfcMboxq *, uint16_t);
 void lpfc_resume_rpi(struct lpfcMboxq *, struct lpfc_nodelist *);
 int lpfc_check_pending_fcoe_event(struct lpfc_hba *, uint8_t);
+void lpfc_issue_init_vpi(struct lpfc_vport *);
 
 void lpfc_config_hbq(struct lpfc_hba *, uint32_t, struct lpfc_hbq_init *,
        uint32_t , LPFC_MBOXQ_t *);
@@ -206,7 +216,11 @@ struct hbq_dmabuf *lpfc_sli4_rb_alloc(struct lpfc_hba *);
 void lpfc_sli4_rb_free(struct lpfc_hba *, struct hbq_dmabuf *);
 void lpfc_sli4_build_dflt_fcf_record(struct lpfc_hba *, struct fcf_record *,
                        uint16_t);
+void lpfc_unregister_fcf(struct lpfc_hba *);
+void lpfc_unregister_fcf_rescan(struct lpfc_hba *);
 void lpfc_unregister_unused_fcf(struct lpfc_hba *);
+int lpfc_sli4_redisc_fcf_table(struct lpfc_hba *);
+void lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *);
 
 int lpfc_mem_alloc(struct lpfc_hba *, int align);
 void lpfc_mem_free(struct lpfc_hba *);
@@ -365,6 +379,8 @@ void lpfc_free_fast_evt(struct lpfc_hba *, struct lpfc_fast_path_event *);
 void lpfc_create_static_vport(struct lpfc_hba *);
 void lpfc_stop_hba_timers(struct lpfc_hba *);
 void lpfc_stop_port(struct lpfc_hba *);
+void __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *);
+void lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *);
 void lpfc_parse_fcoe_conf(struct lpfc_hba *, uint8_t *, uint32_t);
 int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int);
 void lpfc_start_fdiscs(struct lpfc_hba *phba);
@@ -378,5 +394,5 @@ struct lpfc_vport *lpfc_find_vport_by_vpid(struct lpfc_hba *, uint16_t);
 /* functions to support SGIOv4/bsg interface */
 int lpfc_bsg_request(struct fc_bsg_job *);
 int lpfc_bsg_timeout(struct fc_bsg_job *);
-void lpfc_bsg_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
+int lpfc_bsg_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
                             struct lpfc_iocbq *);
index 0ebcd9baca79455e47fecc64f22b577064d7204c..c7e921973f66adedf93bb087f229b4e3fc2485ea 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -97,7 +97,8 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        struct list_head head;
        struct lpfc_dmabuf *bdeBuf;
 
-       lpfc_bsg_ct_unsol_event(phba, pring, piocbq);
+       if (lpfc_bsg_ct_unsol_event(phba, pring, piocbq) == 0)
+               return;
 
        if (unlikely(icmd->ulpStatus == IOSTAT_NEED_BUFFER)) {
                lpfc_sli_hbqbuf_add_hbqs(phba, LPFC_ELS_HBQ);
@@ -181,7 +182,8 @@ lpfc_sli4_ct_abort_unsol_event(struct lpfc_hba *phba,
        uint32_t size;
 
        /* Forward abort event to any process registered to receive ct event */
-       lpfc_bsg_ct_unsol_event(phba, pring, piocbq);
+       if (lpfc_bsg_ct_unsol_event(phba, pring, piocbq) == 0)
+               return;
 
        /* If there is no BDE associated with IOCB, there is nothing to do */
        if (icmd->ulpBdeCount == 0)
@@ -1843,12 +1845,7 @@ lpfc_decode_firmware_rev(struct lpfc_hba *phba, char *fwrevision, int flag)
                c  = (rev & 0x0000ff00) >> 8;
                b4 = (rev & 0x000000ff);
 
-               if (flag)
-                       sprintf(fwrevision, "%d.%d%d%c%d ", b1,
-                               b2, b3, c, b4);
-               else
-                       sprintf(fwrevision, "%d.%d%d%c%d ", b1,
-                               b2, b3, c, b4);
+               sprintf(fwrevision, "%d.%d%d%c%d", b1, b2, b3, c, b4);
        }
        return;
 }
index 2cc39684ce97622f4db92d617a9d0c40cf3a7ff8..08b6634cb994a14ca93bfde822a19d9b61332ee8 100644 (file)
@@ -50,9 +50,6 @@ static int lpfc_issue_els_fdisc(struct lpfc_vport *vport,
                                struct lpfc_nodelist *ndlp, uint8_t retry);
 static int lpfc_issue_fabric_iocb(struct lpfc_hba *phba,
                                  struct lpfc_iocbq *iocb);
-static void lpfc_register_new_vport(struct lpfc_hba *phba,
-                                   struct lpfc_vport *vport,
-                                   struct lpfc_nodelist *ndlp);
 
 static int lpfc_max_els_tries = 3;
 
@@ -592,6 +589,15 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                        vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
                        spin_unlock_irq(shost->host_lock);
                }
+               /*
+                * If VPI is unreged, driver need to do INIT_VPI
+                * before re-registering
+                */
+               if (phba->sli_rev == LPFC_SLI_REV4) {
+                       spin_lock_irq(shost->host_lock);
+                       vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
+                       spin_unlock_irq(shost->host_lock);
+               }
        }
 
        if (phba->sli_rev < LPFC_SLI_REV4) {
@@ -604,10 +610,13 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        } else {
                ndlp->nlp_type |= NLP_FABRIC;
                lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
-               if (vport->vpi_state & LPFC_VPI_REGISTERED) {
+               if ((!(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) &&
+                       (vport->vpi_state & LPFC_VPI_REGISTERED)) {
                        lpfc_start_fdiscs(phba);
                        lpfc_do_scr_ns_plogi(phba, vport);
-               } else
+               } else if (vport->fc_flag & FC_VFI_REGISTERED)
+                       lpfc_issue_init_vpi(vport);
+               else
                        lpfc_issue_reg_vfi(vport);
        }
        return 0;
@@ -804,6 +813,9 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                                 irsp->ulpTimeout);
                goto flogifail;
        }
+       spin_lock_irq(shost->host_lock);
+       vport->fc_flag &= ~FC_VPORT_CVL_RCVD;
+       spin_unlock_irq(shost->host_lock);
 
        /*
         * The FLogI succeeded.  Sync the data for the CPU before
@@ -2720,7 +2732,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        if (did == FDMI_DID)
                retry = 1;
 
-       if ((cmd == ELS_CMD_FLOGI) &&
+       if (((cmd == ELS_CMD_FLOGI) || (cmd == ELS_CMD_FDISC)) &&
            (phba->fc_topology != TOPOLOGY_LOOP) &&
            !lpfc_error_lost_link(irsp)) {
                /* FLOGI retry policy */
@@ -4385,7 +4397,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        did = Fabric_DID;
 
-       if ((lpfc_check_sparm(vport, ndlp, sp, CLASS3))) {
+       if ((lpfc_check_sparm(vport, ndlp, sp, CLASS3, 1))) {
                /* For a FLOGI we accept, then if our portname is greater
                 * then the remote portname we initiate Nport login.
                 */
@@ -5915,6 +5927,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);
        struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2;
        MAILBOX_t *mb = &pmb->u.mb;
+       int rc;
 
        spin_lock_irq(shost->host_lock);
        vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
@@ -5936,6 +5949,26 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                        spin_unlock_irq(shost->host_lock);
                        lpfc_can_disctmo(vport);
                        break;
+               /* If reg_vpi fail with invalid VPI status, re-init VPI */
+               case 0x20:
+                       spin_lock_irq(shost->host_lock);
+                       vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
+                       spin_unlock_irq(shost->host_lock);
+                       lpfc_init_vpi(phba, pmb, vport->vpi);
+                       pmb->vport = vport;
+                       pmb->mbox_cmpl = lpfc_init_vpi_cmpl;
+                       rc = lpfc_sli_issue_mbox(phba, pmb,
+                               MBX_NOWAIT);
+                       if (rc == MBX_NOT_FINISHED) {
+                               lpfc_printf_vlog(vport,
+                                       KERN_ERR, LOG_MBOX,
+                                       "2732 Failed to issue INIT_VPI"
+                                       " mailbox command\n");
+                       } else {
+                               lpfc_nlp_put(ndlp);
+                               return;
+                       }
+
                default:
                        /* Try to recover from this error */
                        lpfc_mbx_unreg_vpi(vport);
@@ -5949,13 +5982,17 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                        break;
                }
        } else {
+               spin_lock_irq(shost->host_lock);
                vport->vpi_state |= LPFC_VPI_REGISTERED;
-               if (vport == phba->pport)
+               spin_unlock_irq(shost->host_lock);
+               if (vport == phba->pport) {
                        if (phba->sli_rev < LPFC_SLI_REV4)
                                lpfc_issue_fabric_reglogin(vport);
-                       else
-                               lpfc_issue_reg_vfi(vport);
-               else
+                       else {
+                               lpfc_start_fdiscs(phba);
+                               lpfc_do_scr_ns_plogi(phba, vport);
+                       }
+               } else
                        lpfc_do_scr_ns_plogi(phba, vport);
        }
 
@@ -5977,7 +6014,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
  * This routine registers the @vport as a new virtual port with a HBA.
  * It is done through a registering vpi mailbox command.
  **/
-static void
+void
 lpfc_register_new_vport(struct lpfc_hba *phba, struct lpfc_vport *vport,
                        struct lpfc_nodelist *ndlp)
 {
@@ -6017,6 +6054,78 @@ mbox_err_exit:
        return;
 }
 
+/**
+ * lpfc_retry_pport_discovery - Start timer to retry FLOGI.
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine abort all pending discovery commands and
+ * start a timer to retry FLOGI for the physical port
+ * discovery.
+ **/
+void
+lpfc_retry_pport_discovery(struct lpfc_hba *phba)
+{
+       struct lpfc_vport **vports;
+       struct lpfc_nodelist *ndlp;
+       struct Scsi_Host  *shost;
+       int i;
+       uint32_t link_state;
+
+       /* Treat this failure as linkdown for all vports */
+       link_state = phba->link_state;
+       lpfc_linkdown(phba);
+       phba->link_state = link_state;
+
+       vports = lpfc_create_vport_work_array(phba);
+
+       if (vports) {
+               for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
+                       ndlp = lpfc_findnode_did(vports[i], Fabric_DID);
+                       if (ndlp)
+                               lpfc_cancel_retry_delay_tmo(vports[i], ndlp);
+                       lpfc_els_flush_cmd(vports[i]);
+               }
+               lpfc_destroy_vport_work_array(phba, vports);
+       }
+
+       /* If fabric require FLOGI, then re-instantiate physical login */
+       ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
+       if (!ndlp)
+               return;
+
+
+       shost = lpfc_shost_from_vport(phba->pport);
+       mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
+       spin_lock_irq(shost->host_lock);
+       ndlp->nlp_flag |= NLP_DELAY_TMO;
+       spin_unlock_irq(shost->host_lock);
+       ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
+       phba->pport->port_state = LPFC_FLOGI;
+       return;
+}
+
+/**
+ * lpfc_fabric_login_reqd - Check if FLOGI required.
+ * @phba: pointer to lpfc hba data structure.
+ * @cmdiocb: pointer to FDISC command iocb.
+ * @rspiocb: pointer to FDISC response iocb.
+ *
+ * This routine checks if a FLOGI is reguired for FDISC
+ * to succeed.
+ **/
+static int
+lpfc_fabric_login_reqd(struct lpfc_hba *phba,
+               struct lpfc_iocbq *cmdiocb,
+               struct lpfc_iocbq *rspiocb)
+{
+
+       if ((rspiocb->iocb.ulpStatus != IOSTAT_FABRIC_RJT) ||
+               (rspiocb->iocb.un.ulpWord[4] != RJT_LOGIN_REQUIRED))
+               return 0;
+       else
+               return 1;
+}
+
 /**
  * lpfc_cmpl_els_fdisc - Completion function for fdisc iocb command
  * @phba: pointer to lpfc hba data structure.
@@ -6066,6 +6175,12 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_prevDID);
 
        if (irsp->ulpStatus) {
+
+               if (lpfc_fabric_login_reqd(phba, cmdiocb, rspiocb)) {
+                       lpfc_retry_pport_discovery(phba);
+                       goto out;
+               }
+
                /* Check for retry */
                if (lpfc_els_retry(phba, cmdiocb, rspiocb))
                        goto out;
@@ -6076,6 +6191,7 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                goto fdisc_failed;
        }
        spin_lock_irq(shost->host_lock);
+       vport->fc_flag &= ~FC_VPORT_CVL_RCVD;
        vport->fc_flag |= FC_FABRIC;
        if (vport->phba->fc_topology == TOPOLOGY_LOOP)
                vport->fc_flag |=  FC_PUBLIC_LOOP;
@@ -6103,10 +6219,13 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                lpfc_mbx_unreg_vpi(vport);
                spin_lock_irq(shost->host_lock);
                vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
+               vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
                spin_unlock_irq(shost->host_lock);
        }
 
-       if (vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)
+       if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI)
+               lpfc_issue_init_vpi(vport);
+       else if (vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)
                lpfc_register_new_vport(phba, vport, ndlp);
        else
                lpfc_do_scr_ns_plogi(phba, vport);
old mode 100755 (executable)
new mode 100644 (file)
index 2445e39..2359d0b
@@ -525,6 +525,8 @@ lpfc_work_done(struct lpfc_hba *phba)
                        spin_unlock_irq(&phba->hbalock);
                        lpfc_sli_hbqbuf_add_hbqs(phba, LPFC_ELS_HBQ);
                }
+               if (phba->fcf.fcf_flag & FCF_REDISC_EVT)
+                       lpfc_sli4_fcf_redisc_event_proc(phba);
        }
 
        vports = lpfc_create_vport_work_array(phba);
@@ -706,6 +708,8 @@ lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove)
 void
 lpfc_port_link_failure(struct lpfc_vport *vport)
 {
+       lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN);
+
        /* Cleanup any outstanding received buffers */
        lpfc_cleanup_rcv_buffers(vport);
 
@@ -752,12 +756,14 @@ lpfc_linkdown(struct lpfc_hba *phba)
        lpfc_scsi_dev_block(phba);
 
        spin_lock_irq(&phba->hbalock);
-       phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_DISCOVERED);
+       phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE);
+       spin_unlock_irq(&phba->hbalock);
        if (phba->link_state > LPFC_LINK_DOWN) {
                phba->link_state = LPFC_LINK_DOWN;
+               spin_lock_irq(shost->host_lock);
                phba->pport->fc_flag &= ~FC_LBIT;
+               spin_unlock_irq(shost->host_lock);
        }
-       spin_unlock_irq(&phba->hbalock);
        vports = lpfc_create_vport_work_array(phba);
        if (vports != NULL)
                for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
@@ -1023,7 +1029,7 @@ lpfc_mbx_cmpl_reg_fcfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                return;
        }
        spin_lock_irqsave(&phba->hbalock, flags);
-       phba->fcf.fcf_flag |= (FCF_DISCOVERED | FCF_IN_USE);
+       phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE);
        phba->hba_flag &= ~FCF_DISC_INPROGRESS;
        spin_unlock_irqrestore(&phba->hbalock, flags);
        if (vport->port_state != LPFC_FLOGI)
@@ -1045,25 +1051,23 @@ lpfc_mbx_cmpl_reg_fcfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 static uint32_t
 lpfc_fab_name_match(uint8_t *fab_name, struct fcf_record *new_fcf_record)
 {
-       if ((fab_name[0] ==
-               bf_get(lpfc_fcf_record_fab_name_0, new_fcf_record)) &&
-           (fab_name[1] ==
-               bf_get(lpfc_fcf_record_fab_name_1, new_fcf_record)) &&
-           (fab_name[2] ==
-               bf_get(lpfc_fcf_record_fab_name_2, new_fcf_record)) &&
-           (fab_name[3] ==
-               bf_get(lpfc_fcf_record_fab_name_3, new_fcf_record)) &&
-           (fab_name[4] ==
-               bf_get(lpfc_fcf_record_fab_name_4, new_fcf_record)) &&
-           (fab_name[5] ==
-               bf_get(lpfc_fcf_record_fab_name_5, new_fcf_record)) &&
-           (fab_name[6] ==
-               bf_get(lpfc_fcf_record_fab_name_6, new_fcf_record)) &&
-           (fab_name[7] ==
-               bf_get(lpfc_fcf_record_fab_name_7, new_fcf_record)))
-               return 1;
-       else
+       if (fab_name[0] != bf_get(lpfc_fcf_record_fab_name_0, new_fcf_record))
+               return 0;
+       if (fab_name[1] != bf_get(lpfc_fcf_record_fab_name_1, new_fcf_record))
+               return 0;
+       if (fab_name[2] != bf_get(lpfc_fcf_record_fab_name_2, new_fcf_record))
                return 0;
+       if (fab_name[3] != bf_get(lpfc_fcf_record_fab_name_3, new_fcf_record))
+               return 0;
+       if (fab_name[4] != bf_get(lpfc_fcf_record_fab_name_4, new_fcf_record))
+               return 0;
+       if (fab_name[5] != bf_get(lpfc_fcf_record_fab_name_5, new_fcf_record))
+               return 0;
+       if (fab_name[6] != bf_get(lpfc_fcf_record_fab_name_6, new_fcf_record))
+               return 0;
+       if (fab_name[7] != bf_get(lpfc_fcf_record_fab_name_7, new_fcf_record))
+               return 0;
+       return 1;
 }
 
 /**
@@ -1078,30 +1082,28 @@ lpfc_fab_name_match(uint8_t *fab_name, struct fcf_record *new_fcf_record)
 static uint32_t
 lpfc_sw_name_match(uint8_t *sw_name, struct fcf_record *new_fcf_record)
 {
-       if ((sw_name[0] ==
-               bf_get(lpfc_fcf_record_switch_name_0, new_fcf_record)) &&
-           (sw_name[1] ==
-               bf_get(lpfc_fcf_record_switch_name_1, new_fcf_record)) &&
-           (sw_name[2] ==
-               bf_get(lpfc_fcf_record_switch_name_2, new_fcf_record)) &&
-           (sw_name[3] ==
-               bf_get(lpfc_fcf_record_switch_name_3, new_fcf_record)) &&
-           (sw_name[4] ==
-               bf_get(lpfc_fcf_record_switch_name_4, new_fcf_record)) &&
-           (sw_name[5] ==
-               bf_get(lpfc_fcf_record_switch_name_5, new_fcf_record)) &&
-           (sw_name[6] ==
-               bf_get(lpfc_fcf_record_switch_name_6, new_fcf_record)) &&
-           (sw_name[7] ==
-               bf_get(lpfc_fcf_record_switch_name_7, new_fcf_record)))
-               return 1;
-       else
+       if (sw_name[0] != bf_get(lpfc_fcf_record_switch_name_0, new_fcf_record))
                return 0;
+       if (sw_name[1] != bf_get(lpfc_fcf_record_switch_name_1, new_fcf_record))
+               return 0;
+       if (sw_name[2] != bf_get(lpfc_fcf_record_switch_name_2, new_fcf_record))
+               return 0;
+       if (sw_name[3] != bf_get(lpfc_fcf_record_switch_name_3, new_fcf_record))
+               return 0;
+       if (sw_name[4] != bf_get(lpfc_fcf_record_switch_name_4, new_fcf_record))
+               return 0;
+       if (sw_name[5] != bf_get(lpfc_fcf_record_switch_name_5, new_fcf_record))
+               return 0;
+       if (sw_name[6] != bf_get(lpfc_fcf_record_switch_name_6, new_fcf_record))
+               return 0;
+       if (sw_name[7] != bf_get(lpfc_fcf_record_switch_name_7, new_fcf_record))
+               return 0;
+       return 1;
 }
 
 /**
  * lpfc_mac_addr_match - Check if the fcf mac address match.
- * @phba: pointer to lpfc hba data structure.
+ * @mac_addr: pointer to mac address.
  * @new_fcf_record: pointer to fcf record.
  *
  * This routine compare the fcf record's mac address with HBA's
@@ -1109,84 +1111,114 @@ lpfc_sw_name_match(uint8_t *sw_name, struct fcf_record *new_fcf_record)
  * returns 1 else return 0.
  **/
 static uint32_t
-lpfc_mac_addr_match(struct lpfc_hba *phba, struct fcf_record *new_fcf_record)
+lpfc_mac_addr_match(uint8_t *mac_addr, struct fcf_record *new_fcf_record)
 {
-       if ((phba->fcf.mac_addr[0] ==
-               bf_get(lpfc_fcf_record_mac_0, new_fcf_record)) &&
-           (phba->fcf.mac_addr[1] ==
-               bf_get(lpfc_fcf_record_mac_1, new_fcf_record)) &&
-           (phba->fcf.mac_addr[2] ==
-               bf_get(lpfc_fcf_record_mac_2, new_fcf_record)) &&
-           (phba->fcf.mac_addr[3] ==
-               bf_get(lpfc_fcf_record_mac_3, new_fcf_record)) &&
-           (phba->fcf.mac_addr[4] ==
-               bf_get(lpfc_fcf_record_mac_4, new_fcf_record)) &&
-           (phba->fcf.mac_addr[5] ==
-               bf_get(lpfc_fcf_record_mac_5, new_fcf_record)))
-               return 1;
-       else
+       if (mac_addr[0] != bf_get(lpfc_fcf_record_mac_0, new_fcf_record))
+               return 0;
+       if (mac_addr[1] != bf_get(lpfc_fcf_record_mac_1, new_fcf_record))
+               return 0;
+       if (mac_addr[2] != bf_get(lpfc_fcf_record_mac_2, new_fcf_record))
                return 0;
+       if (mac_addr[3] != bf_get(lpfc_fcf_record_mac_3, new_fcf_record))
+               return 0;
+       if (mac_addr[4] != bf_get(lpfc_fcf_record_mac_4, new_fcf_record))
+               return 0;
+       if (mac_addr[5] != bf_get(lpfc_fcf_record_mac_5, new_fcf_record))
+               return 0;
+       return 1;
+}
+
+static bool
+lpfc_vlan_id_match(uint16_t curr_vlan_id, uint16_t new_vlan_id)
+{
+       return (curr_vlan_id == new_vlan_id);
 }
 
 /**
  * lpfc_copy_fcf_record - Copy fcf information to lpfc_hba.
- * @phba: pointer to lpfc hba data structure.
+ * @fcf: pointer to driver fcf record.
  * @new_fcf_record: pointer to fcf record.
  *
  * This routine copies the FCF information from the FCF
  * record to lpfc_hba data structure.
  **/
 static void
-lpfc_copy_fcf_record(struct lpfc_hba *phba, struct fcf_record *new_fcf_record)
+lpfc_copy_fcf_record(struct lpfc_fcf_rec *fcf_rec,
+                    struct fcf_record *new_fcf_record)
 {
-       phba->fcf.fabric_name[0] =
+       /* Fabric name */
+       fcf_rec->fabric_name[0] =
                bf_get(lpfc_fcf_record_fab_name_0, new_fcf_record);
-       phba->fcf.fabric_name[1] =
+       fcf_rec->fabric_name[1] =
                bf_get(lpfc_fcf_record_fab_name_1, new_fcf_record);
-       phba->fcf.fabric_name[2] =
+       fcf_rec->fabric_name[2] =
                bf_get(lpfc_fcf_record_fab_name_2, new_fcf_record);
-       phba->fcf.fabric_name[3] =
+       fcf_rec->fabric_name[3] =
                bf_get(lpfc_fcf_record_fab_name_3, new_fcf_record);
-       phba->fcf.fabric_name[4] =
+       fcf_rec->fabric_name[4] =
                bf_get(lpfc_fcf_record_fab_name_4, new_fcf_record);
-       phba->fcf.fabric_name[5] =
+       fcf_rec->fabric_name[5] =
                bf_get(lpfc_fcf_record_fab_name_5, new_fcf_record);
-       phba->fcf.fabric_name[6] =
+       fcf_rec->fabric_name[6] =
                bf_get(lpfc_fcf_record_fab_name_6, new_fcf_record);
-       phba->fcf.fabric_name[7] =
+       fcf_rec->fabric_name[7] =
                bf_get(lpfc_fcf_record_fab_name_7, new_fcf_record);
-       phba->fcf.mac_addr[0] =
-               bf_get(lpfc_fcf_record_mac_0, new_fcf_record);
-       phba->fcf.mac_addr[1] =
-               bf_get(lpfc_fcf_record_mac_1, new_fcf_record);
-       phba->fcf.mac_addr[2] =
-               bf_get(lpfc_fcf_record_mac_2, new_fcf_record);
-       phba->fcf.mac_addr[3] =
-               bf_get(lpfc_fcf_record_mac_3, new_fcf_record);
-       phba->fcf.mac_addr[4] =
-               bf_get(lpfc_fcf_record_mac_4, new_fcf_record);
-       phba->fcf.mac_addr[5] =
-               bf_get(lpfc_fcf_record_mac_5, new_fcf_record);
-       phba->fcf.fcf_indx = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record);
-       phba->fcf.priority = new_fcf_record->fip_priority;
-       phba->fcf.switch_name[0] =
+       /* Mac address */
+       fcf_rec->mac_addr[0] = bf_get(lpfc_fcf_record_mac_0, new_fcf_record);
+       fcf_rec->mac_addr[1] = bf_get(lpfc_fcf_record_mac_1, new_fcf_record);
+       fcf_rec->mac_addr[2] = bf_get(lpfc_fcf_record_mac_2, new_fcf_record);
+       fcf_rec->mac_addr[3] = bf_get(lpfc_fcf_record_mac_3, new_fcf_record);
+       fcf_rec->mac_addr[4] = bf_get(lpfc_fcf_record_mac_4, new_fcf_record);
+       fcf_rec->mac_addr[5] = bf_get(lpfc_fcf_record_mac_5, new_fcf_record);
+       /* FCF record index */
+       fcf_rec->fcf_indx = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record);
+       /* FCF record priority */
+       fcf_rec->priority = new_fcf_record->fip_priority;
+       /* Switch name */
+       fcf_rec->switch_name[0] =
                bf_get(lpfc_fcf_record_switch_name_0, new_fcf_record);
-       phba->fcf.switch_name[1] =
+       fcf_rec->switch_name[1] =
                bf_get(lpfc_fcf_record_switch_name_1, new_fcf_record);
-       phba->fcf.switch_name[2] =
+       fcf_rec->switch_name[2] =
                bf_get(lpfc_fcf_record_switch_name_2, new_fcf_record);
-       phba->fcf.switch_name[3] =
+       fcf_rec->switch_name[3] =
                bf_get(lpfc_fcf_record_switch_name_3, new_fcf_record);
-       phba->fcf.switch_name[4] =
+       fcf_rec->switch_name[4] =
                bf_get(lpfc_fcf_record_switch_name_4, new_fcf_record);
-       phba->fcf.switch_name[5] =
+       fcf_rec->switch_name[5] =
                bf_get(lpfc_fcf_record_switch_name_5, new_fcf_record);
-       phba->fcf.switch_name[6] =
+       fcf_rec->switch_name[6] =
                bf_get(lpfc_fcf_record_switch_name_6, new_fcf_record);
-       phba->fcf.switch_name[7] =
+       fcf_rec->switch_name[7] =
                bf_get(lpfc_fcf_record_switch_name_7, new_fcf_record);
 }
 
+/**
+ * lpfc_update_fcf_record - Update driver fcf record
+ * @phba: pointer to lpfc hba data structure.
+ * @fcf_rec: pointer to driver fcf record.
+ * @new_fcf_record: pointer to hba fcf record.
+ * @addr_mode: address mode to be set to the driver fcf record.
+ * @vlan_id: vlan tag to be set to the driver fcf record.
+ * @flag: flag bits to be set to the driver fcf record.
+ *
+ * This routine updates the driver FCF record from the new HBA FCF record
+ * together with the address mode, vlan_id, and other informations. This
+ * routine is called with the host lock held.
+ **/
+static void
+__lpfc_update_fcf_record(struct lpfc_hba *phba, struct lpfc_fcf_rec *fcf_rec,
+                      struct fcf_record *new_fcf_record, uint32_t addr_mode,
+                      uint16_t vlan_id, uint32_t flag)
+{
+       /* Copy the fields from the HBA's FCF record */
+       lpfc_copy_fcf_record(fcf_rec, new_fcf_record);
+       /* Update other fields of driver FCF record */
+       fcf_rec->addr_mode = addr_mode;
+       fcf_rec->vlan_id = vlan_id;
+       fcf_rec->flag |= (flag | RECORD_VALID);
+}
+
 /**
  * lpfc_register_fcf - Register the FCF with hba.
  * @phba: pointer to lpfc hba data structure.
@@ -1212,7 +1244,7 @@ lpfc_register_fcf(struct lpfc_hba *phba)
 
        /* The FCF is already registered, start discovery */
        if (phba->fcf.fcf_flag & FCF_REGISTERED) {
-               phba->fcf.fcf_flag |= (FCF_DISCOVERED | FCF_IN_USE);
+               phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE);
                phba->hba_flag &= ~FCF_DISC_INPROGRESS;
                spin_unlock_irqrestore(&phba->hbalock, flags);
                if (phba->pport->port_state != LPFC_FLOGI)
@@ -1250,6 +1282,7 @@ lpfc_register_fcf(struct lpfc_hba *phba)
  * @new_fcf_record: pointer to fcf record.
  * @boot_flag: Indicates if this record used by boot bios.
  * @addr_mode: The address mode to be used by this FCF
+ * @vlan_id: The vlan id to be used as vlan tagging by this FCF.
  *
  * This routine compare the fcf record with connect list obtained from the
  * config region to decide if this FCF can be used for SAN discovery. It returns
@@ -1323,7 +1356,8 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
                return 1;
        }
 
-       list_for_each_entry(conn_entry, &phba->fcf_conn_rec_list, list) {
+       list_for_each_entry(conn_entry,
+                           &phba->fcf_conn_rec_list, list) {
                if (!(conn_entry->conn_rec.flags & FCFCNCT_VALID))
                        continue;
 
@@ -1470,6 +1504,7 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, uint8_t unreg_fcf)
                 */
                spin_lock_irq(&phba->hbalock);
                phba->hba_flag &= ~FCF_DISC_INPROGRESS;
+               phba->fcf.fcf_flag &= ~FCF_REDISC_FOV;
                spin_unlock_irq(&phba->hbalock);
        }
 
@@ -1524,11 +1559,12 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
        uint32_t shdr_status, shdr_add_status;
        union lpfc_sli4_cfg_shdr *shdr;
        struct fcf_record *new_fcf_record;
-       int rc;
        uint32_t boot_flag, addr_mode;
        uint32_t next_fcf_index;
-       unsigned long flags;
+       struct lpfc_fcf_rec *fcf_rec = NULL;
+       unsigned long iflags;
        uint16_t vlan_id;
+       int rc;
 
        /* If there is pending FCoE event restart FCF table scan */
        if (lpfc_check_pending_fcoe_event(phba, 0)) {
@@ -1583,9 +1619,8 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                              sizeof(struct fcf_record));
        bytep = virt_addr + sizeof(union lpfc_sli4_cfg_shdr);
 
-       rc = lpfc_match_fcf_conn_list(phba, new_fcf_record,
-                                     &boot_flag, &addr_mode,
-                                       &vlan_id);
+       rc = lpfc_match_fcf_conn_list(phba, new_fcf_record, &boot_flag,
+                                     &addr_mode, &vlan_id);
        /*
         * If the fcf record does not match with connect list entries
         * read the next entry.
@@ -1594,90 +1629,159 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                goto read_next_fcf;
        /*
         * If this is not the first FCF discovery of the HBA, use last
-        * FCF record for the discovery.
+        * FCF record for the discovery. The condition that a rescan
+        * matches the in-use FCF record: fabric name, switch name, mac
+        * address, and vlan_id.
         */
-       spin_lock_irqsave(&phba->hbalock, flags);
+       spin_lock_irqsave(&phba->hbalock, iflags);
        if (phba->fcf.fcf_flag & FCF_IN_USE) {
-               if (lpfc_fab_name_match(phba->fcf.fabric_name,
+               if (lpfc_fab_name_match(phba->fcf.current_rec.fabric_name,
                                        new_fcf_record) &&
-                   lpfc_sw_name_match(phba->fcf.switch_name,
+                   lpfc_sw_name_match(phba->fcf.current_rec.switch_name,
                                        new_fcf_record) &&
-                   lpfc_mac_addr_match(phba, new_fcf_record)) {
+                   lpfc_mac_addr_match(phba->fcf.current_rec.mac_addr,
+                                       new_fcf_record) &&
+                   lpfc_vlan_id_match(phba->fcf.current_rec.vlan_id,
+                                       vlan_id)) {
                        phba->fcf.fcf_flag |= FCF_AVAILABLE;
-                       spin_unlock_irqrestore(&phba->hbalock, flags);
+                       if (phba->fcf.fcf_flag & FCF_REDISC_PEND)
+                               /* Stop FCF redisc wait timer if pending */
+                               __lpfc_sli4_stop_fcf_redisc_wait_timer(phba);
+                       else if (phba->fcf.fcf_flag & FCF_REDISC_FOV)
+                               /* If in fast failover, mark it's completed */
+                               phba->fcf.fcf_flag &= ~FCF_REDISC_FOV;
+                       spin_unlock_irqrestore(&phba->hbalock, iflags);
                        goto out;
                }
-               spin_unlock_irqrestore(&phba->hbalock, flags);
-               goto read_next_fcf;
+               /*
+                * Read next FCF record from HBA searching for the matching
+                * with in-use record only if not during the fast failover
+                * period. In case of fast failover period, it shall try to
+                * determine whether the FCF record just read should be the
+                * next candidate.
+                */
+               if (!(phba->fcf.fcf_flag & FCF_REDISC_FOV)) {
+                       spin_unlock_irqrestore(&phba->hbalock, iflags);
+                       goto read_next_fcf;
+               }
        }
+       /*
+        * Update on failover FCF record only if it's in FCF fast-failover
+        * period; otherwise, update on current FCF record.
+        */
+       if (phba->fcf.fcf_flag & FCF_REDISC_FOV) {
+               /* Fast FCF failover only to the same fabric name */
+               if (lpfc_fab_name_match(phba->fcf.current_rec.fabric_name,
+                                       new_fcf_record))
+                       fcf_rec = &phba->fcf.failover_rec;
+               else
+                       goto read_next_fcf;
+       } else
+               fcf_rec = &phba->fcf.current_rec;
+
        if (phba->fcf.fcf_flag & FCF_AVAILABLE) {
                /*
-                * If the current FCF record does not have boot flag
-                * set and new fcf record has boot flag set, use the
-                * new fcf record.
+                * If the driver FCF record does not have boot flag
+                * set and new hba fcf record has boot flag set, use
+                * the new hba fcf record.
                 */
-               if (boot_flag && !(phba->fcf.fcf_flag & FCF_BOOT_ENABLE)) {
-                       /* Use this FCF record */
-                       lpfc_copy_fcf_record(phba, new_fcf_record);
-                       phba->fcf.addr_mode = addr_mode;
-                       phba->fcf.fcf_flag |= FCF_BOOT_ENABLE;
-                       if (vlan_id != 0xFFFF) {
-                               phba->fcf.fcf_flag |= FCF_VALID_VLAN;
-                               phba->fcf.vlan_id = vlan_id;
-                       }
-                       spin_unlock_irqrestore(&phba->hbalock, flags);
+               if (boot_flag && !(fcf_rec->flag & BOOT_ENABLE)) {
+                       /* Choose this FCF record */
+                       __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
+                                       addr_mode, vlan_id, BOOT_ENABLE);
+                       spin_unlock_irqrestore(&phba->hbalock, iflags);
                        goto read_next_fcf;
                }
                /*
-                * If the current FCF record has boot flag set and the
-                * new FCF record does not have boot flag, read the next
-                * FCF record.
+                * If the driver FCF record has boot flag set and the
+                * new hba FCF record does not have boot flag, read
+                * the next FCF record.
                 */
-               if (!boot_flag && (phba->fcf.fcf_flag & FCF_BOOT_ENABLE)) {
-                       spin_unlock_irqrestore(&phba->hbalock, flags);
+               if (!boot_flag && (fcf_rec->flag & BOOT_ENABLE)) {
+                       spin_unlock_irqrestore(&phba->hbalock, iflags);
                        goto read_next_fcf;
                }
                /*
-                * If there is a record with lower priority value for
-                * the current FCF, use that record.
+                * If the new hba FCF record has lower priority value
+                * than the driver FCF record, use the new record.
                 */
-               if (lpfc_fab_name_match(phba->fcf.fabric_name,
-                                       new_fcf_record) &&
-                   (new_fcf_record->fip_priority < phba->fcf.priority)) {
-                       /* Use this FCF record */
-                       lpfc_copy_fcf_record(phba, new_fcf_record);
-                       phba->fcf.addr_mode = addr_mode;
-                       if (vlan_id != 0xFFFF) {
-                               phba->fcf.fcf_flag |= FCF_VALID_VLAN;
-                               phba->fcf.vlan_id = vlan_id;
-                       }
-                       spin_unlock_irqrestore(&phba->hbalock, flags);
-                       goto read_next_fcf;
+               if (lpfc_fab_name_match(fcf_rec->fabric_name, new_fcf_record) &&
+                   (new_fcf_record->fip_priority < fcf_rec->priority)) {
+                       /* Choose this FCF record */
+                       __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
+                                       addr_mode, vlan_id, 0);
                }
-               spin_unlock_irqrestore(&phba->hbalock, flags);
+               spin_unlock_irqrestore(&phba->hbalock, iflags);
                goto read_next_fcf;
        }
        /*
-        * This is the first available FCF record, use this
-        * record.
+        * This is the first suitable FCF record, choose this record for
+        * initial best-fit FCF.
         */
-       lpfc_copy_fcf_record(phba, new_fcf_record);
-       phba->fcf.addr_mode = addr_mode;
-       if (boot_flag)
-               phba->fcf.fcf_flag |= FCF_BOOT_ENABLE;
-       phba->fcf.fcf_flag |= FCF_AVAILABLE;
-       if (vlan_id != 0xFFFF) {
-               phba->fcf.fcf_flag |= FCF_VALID_VLAN;
-               phba->fcf.vlan_id = vlan_id;
+       if (fcf_rec) {
+               __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
+                                        addr_mode, vlan_id, (boot_flag ?
+                                        BOOT_ENABLE : 0));
+               phba->fcf.fcf_flag |= FCF_AVAILABLE;
        }
-       spin_unlock_irqrestore(&phba->hbalock, flags);
+       spin_unlock_irqrestore(&phba->hbalock, iflags);
        goto read_next_fcf;
 
 read_next_fcf:
        lpfc_sli4_mbox_cmd_free(phba, mboxq);
-       if (next_fcf_index == LPFC_FCOE_FCF_NEXT_NONE || next_fcf_index == 0)
-               lpfc_register_fcf(phba);
-       else
+       if (next_fcf_index == LPFC_FCOE_FCF_NEXT_NONE || next_fcf_index == 0) {
+               if (phba->fcf.fcf_flag & FCF_REDISC_FOV) {
+                       /*
+                        * Case of FCF fast failover scan
+                        */
+
+                       /*
+                        * It has not found any suitable FCF record, cancel
+                        * FCF scan inprogress, and do nothing
+                        */
+                       if (!(phba->fcf.failover_rec.flag & RECORD_VALID)) {
+                               spin_lock_irqsave(&phba->hbalock, iflags);
+                               phba->hba_flag &= ~FCF_DISC_INPROGRESS;
+                               spin_unlock_irqrestore(&phba->hbalock, iflags);
+                               return;
+                       }
+                       /*
+                        * It has found a suitable FCF record that is not
+                        * the same as in-use FCF record, unregister the
+                        * in-use FCF record, replace the in-use FCF record
+                        * with the new FCF record, mark FCF fast failover
+                        * completed, and then start register the new FCF
+                        * record.
+                        */
+
+                       /* unregister the current in-use FCF record */
+                       lpfc_unregister_fcf(phba);
+                       /* replace in-use record with the new record */
+                       memcpy(&phba->fcf.current_rec,
+                              &phba->fcf.failover_rec,
+                              sizeof(struct lpfc_fcf_rec));
+                       /* mark the FCF fast failover completed */
+                       spin_lock_irqsave(&phba->hbalock, iflags);
+                       phba->fcf.fcf_flag &= ~FCF_REDISC_FOV;
+                       spin_unlock_irqrestore(&phba->hbalock, iflags);
+                       /* Register to the new FCF record */
+                       lpfc_register_fcf(phba);
+               } else {
+                       /*
+                        * In case of transaction period to fast FCF failover,
+                        * do nothing when search to the end of the FCF table.
+                        */
+                       if ((phba->fcf.fcf_flag & FCF_REDISC_EVT) ||
+                           (phba->fcf.fcf_flag & FCF_REDISC_PEND))
+                               return;
+                       /*
+                        * Otherwise, initial scan or post linkdown rescan,
+                        * register with the best fit FCF record found so
+                        * far through the scanning process.
+                        */
+                       lpfc_register_fcf(phba);
+               }
+       } else
                lpfc_sli4_read_fcf_record(phba, next_fcf_index);
        return;
 
@@ -1695,10 +1799,13 @@ out:
  *
  * This function handles completion of init vpi mailbox command.
  */
-static void
+void
 lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 {
        struct lpfc_vport *vport = mboxq->vport;
+       struct lpfc_nodelist *ndlp;
+       struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
+
        if (mboxq->u.mb.mbxStatus) {
                lpfc_printf_vlog(vport, KERN_ERR,
                                LOG_MBOX,
@@ -1708,9 +1815,23 @@ lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
                return;
        }
-       spin_lock_irq(&phba->hbalock);
+       spin_lock_irq(shost->host_lock);
        vport->fc_flag &= ~FC_VPORT_NEEDS_INIT_VPI;
-       spin_unlock_irq(&phba->hbalock);
+       spin_unlock_irq(shost->host_lock);
+
+       /* If this port is physical port or FDISC is done, do reg_vpi */
+       if ((phba->pport == vport) || (vport->port_state == LPFC_FDISC)) {
+                       ndlp = lpfc_findnode_did(vport, Fabric_DID);
+                       if (!ndlp)
+                               lpfc_printf_vlog(vport, KERN_ERR,
+                                       LOG_DISCOVERY,
+                                       "2731 Cannot find fabric "
+                                       "controller node\n");
+                       else
+                               lpfc_register_new_vport(phba, vport, ndlp);
+                       mempool_free(mboxq, phba->mbox_mem_pool);
+                       return;
+       }
 
        if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
                lpfc_initial_fdisc(vport);
@@ -1719,9 +1840,41 @@ lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
                                 "2606 No NPIV Fabric support\n");
        }
+       mempool_free(mboxq, phba->mbox_mem_pool);
        return;
 }
 
+/**
+ * lpfc_issue_init_vpi - Issue init_vpi mailbox command.
+ * @vport: pointer to lpfc_vport data structure.
+ *
+ * This function issue a init_vpi mailbox command to initialize
+ * VPI for the vport.
+ */
+void
+lpfc_issue_init_vpi(struct lpfc_vport *vport)
+{
+       LPFC_MBOXQ_t *mboxq;
+       int rc;
+
+       mboxq = mempool_alloc(vport->phba->mbox_mem_pool, GFP_KERNEL);
+       if (!mboxq) {
+               lpfc_printf_vlog(vport, KERN_ERR,
+                       LOG_MBOX, "2607 Failed to allocate "
+                       "init_vpi mailbox\n");
+               return;
+       }
+       lpfc_init_vpi(vport->phba, mboxq, vport->vpi);
+       mboxq->vport = vport;
+       mboxq->mbox_cmpl = lpfc_init_vpi_cmpl;
+       rc = lpfc_sli_issue_mbox(vport->phba, mboxq, MBX_NOWAIT);
+       if (rc == MBX_NOT_FINISHED) {
+               lpfc_printf_vlog(vport, KERN_ERR,
+                       LOG_MBOX, "2608 Failed to issue init_vpi mailbox\n");
+               mempool_free(mboxq, vport->phba->mbox_mem_pool);
+       }
+}
+
 /**
  * lpfc_start_fdiscs - send fdiscs for each vports on this port.
  * @phba: pointer to lpfc hba data structure.
@@ -1734,8 +1887,6 @@ lpfc_start_fdiscs(struct lpfc_hba *phba)
 {
        struct lpfc_vport **vports;
        int i;
-       LPFC_MBOXQ_t *mboxq;
-       int rc;
 
        vports = lpfc_create_vport_work_array(phba);
        if (vports != NULL) {
@@ -1754,26 +1905,7 @@ lpfc_start_fdiscs(struct lpfc_hba *phba)
                                continue;
                        }
                        if (vports[i]->fc_flag & FC_VPORT_NEEDS_INIT_VPI) {
-                               mboxq = mempool_alloc(phba->mbox_mem_pool,
-                                       GFP_KERNEL);
-                               if (!mboxq) {
-                                       lpfc_printf_vlog(vports[i], KERN_ERR,
-                                       LOG_MBOX, "2607 Failed to allocate "
-                                       "init_vpi mailbox\n");
-                                       continue;
-                               }
-                               lpfc_init_vpi(phba, mboxq, vports[i]->vpi);
-                               mboxq->vport = vports[i];
-                               mboxq->mbox_cmpl = lpfc_init_vpi_cmpl;
-                               rc = lpfc_sli_issue_mbox(phba, mboxq,
-                                       MBX_NOWAIT);
-                               if (rc == MBX_NOT_FINISHED) {
-                                       lpfc_printf_vlog(vports[i], KERN_ERR,
-                                       LOG_MBOX, "2608 Failed to issue "
-                                       "init_vpi mailbox\n");
-                                       mempool_free(mboxq,
-                                               phba->mbox_mem_pool);
-                               }
+                               lpfc_issue_init_vpi(vports[i]);
                                continue;
                        }
                        if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
@@ -1796,6 +1928,7 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 {
        struct lpfc_dmabuf *dmabuf = mboxq->context1;
        struct lpfc_vport *vport = mboxq->vport;
+       struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
 
        if (mboxq->u.mb.mbxStatus) {
                lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
@@ -1813,7 +1946,11 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                goto fail_free_mem;
        }
        /* The VPI is implicitly registered when the VFI is registered */
+       spin_lock_irq(shost->host_lock);
        vport->vpi_state |= LPFC_VPI_REGISTERED;
+       vport->fc_flag |= FC_VFI_REGISTERED;
+       vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
+       spin_unlock_irq(shost->host_lock);
 
        if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
                lpfc_start_fdiscs(phba);
@@ -2050,8 +2187,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
                        return;
                }
                spin_unlock_irq(&phba->hbalock);
-               rc = lpfc_sli4_read_fcf_record(phba,
-                                       LPFC_FCOE_FCF_GET_FIRST);
+               rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST);
                if (rc)
                        goto out;
        }
@@ -2139,10 +2275,12 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        }
 
        phba->fc_eventTag = la->eventTag;
+       spin_lock_irq(&phba->hbalock);
        if (la->mm)
                phba->sli.sli_flag |= LPFC_MENLO_MAINT;
        else
                phba->sli.sli_flag &= ~LPFC_MENLO_MAINT;
+       spin_unlock_irq(&phba->hbalock);
 
        phba->link_events++;
        if (la->attType == AT_LINK_UP && (!la->mm)) {
@@ -2271,10 +2409,10 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                                 mb->mbxStatus);
                break;
        }
-       spin_lock_irq(&phba->hbalock);
+       spin_lock_irq(shost->host_lock);
        vport->vpi_state &= ~LPFC_VPI_REGISTERED;
        vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
-       spin_unlock_irq(&phba->hbalock);
+       spin_unlock_irq(shost->host_lock);
        vport->unreg_vpi_cmpl = VPORT_OK;
        mempool_free(pmb, phba->mbox_mem_pool);
        /*
@@ -2332,7 +2470,10 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                goto out;
        }
 
+       spin_lock_irq(shost->host_lock);
        vport->vpi_state |= LPFC_VPI_REGISTERED;
+       vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
+       spin_unlock_irq(shost->host_lock);
        vport->num_disc_nodes = 0;
        /* go thru NPR list and issue ELS PLOGIs */
        if (vport->fc_npr_cnt)
@@ -3218,6 +3359,34 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
        return 0;
 }
 
+/**
+ * lpfc_unreg_hba_rpis - Unregister rpis registered to the hba.
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine is invoked to unregister all the currently registered RPIs
+ * to the HBA.
+ **/
+void
+lpfc_unreg_hba_rpis(struct lpfc_hba *phba)
+{
+       struct lpfc_vport **vports;
+       struct lpfc_nodelist *ndlp;
+       struct Scsi_Host *shost;
+       int i;
+
+       vports = lpfc_create_vport_work_array(phba);
+       for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
+               shost = lpfc_shost_from_vport(vports[i]);
+               spin_lock_irq(shost->host_lock);
+               list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) {
+                       if (ndlp->nlp_flag & NLP_RPI_VALID)
+                               lpfc_unreg_rpi(vports[i], ndlp);
+               }
+               spin_unlock_irq(shost->host_lock);
+       }
+       lpfc_destroy_vport_work_array(phba, vports);
+}
+
 void
 lpfc_unreg_all_rpis(struct lpfc_vport *vport)
 {
@@ -4448,63 +4617,56 @@ lpfc_unregister_fcfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 }
 
 /**
- * lpfc_unregister_unused_fcf - Unregister FCF if all devices are disconnected.
+ * lpfc_unregister_fcf_prep - Unregister fcf record preparation
  * @phba: Pointer to hba context object.
  *
- * This function check if there are any connected remote port for the FCF and
- * if all the devices are disconnected, this function unregister FCFI.
- * This function also tries to use another FCF for discovery.
+ * This function prepare the HBA for unregistering the currently registered
+ * FCF from the HBA. It performs unregistering, in order, RPIs, VPIs, and
+ * VFIs.
  */
-void
-lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
+int
+lpfc_unregister_fcf_prep(struct lpfc_hba *phba)
 {
        LPFC_MBOXQ_t *mbox;
-       int rc;
        struct lpfc_vport **vports;
-       int i;
-
-       spin_lock_irq(&phba->hbalock);
-       /*
-        * If HBA is not running in FIP mode or
-        * If HBA does not support FCoE or
-        * If FCF is not registered.
-        * do nothing.
-        */
-       if (!(phba->hba_flag & HBA_FCOE_SUPPORT) ||
-               !(phba->fcf.fcf_flag & FCF_REGISTERED) ||
-               (!(phba->hba_flag & HBA_FIP_SUPPORT))) {
-               spin_unlock_irq(&phba->hbalock);
-               return;
-       }
-       spin_unlock_irq(&phba->hbalock);
+       struct lpfc_nodelist *ndlp;
+       struct Scsi_Host *shost;
+       int i, rc;
 
+       /* Unregister RPIs */
        if (lpfc_fcf_inuse(phba))
-               return;
+               lpfc_unreg_hba_rpis(phba);
 
        /* At this point, all discovery is aborted */
        phba->pport->port_state = LPFC_VPORT_UNKNOWN;
 
        /* Unregister VPIs */
        vports = lpfc_create_vport_work_array(phba);
-       if (vports &&
-               (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))
+       if (vports && (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))
                for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
+                       /* Stop FLOGI/FDISC retries */
+                       ndlp = lpfc_findnode_did(vports[i], Fabric_DID);
+                       if (ndlp)
+                               lpfc_cancel_retry_delay_tmo(vports[i], ndlp);
                        lpfc_mbx_unreg_vpi(vports[i]);
-                       spin_lock_irq(&phba->hbalock);
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       spin_lock_irq(shost->host_lock);
                        vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
                        vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED;
-                       spin_unlock_irq(&phba->hbalock);
+                       spin_unlock_irq(shost->host_lock);
                }
        lpfc_destroy_vport_work_array(phba, vports);
 
+       /* Cleanup any outstanding ELS commands */
+       lpfc_els_flush_all_cmd(phba);
+
        /* Unregister VFI */
        mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (!mbox) {
                lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
-                       "2556 UNREG_VFI mbox allocation failed"
-                       "HBA state x%x\n",
-                       phba->pport->port_state);
-               return;
+                               "2556 UNREG_VFI mbox allocation failed"
+                               "HBA state x%x\n", phba->pport->port_state);
+               return -ENOMEM;
        }
 
        lpfc_unreg_vfi(mbox, phba->pport);
@@ -4514,58 +4676,163 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
        rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
        if (rc == MBX_NOT_FINISHED) {
                lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
-                       "2557 UNREG_VFI issue mbox failed rc x%x "
-                       "HBA state x%x\n",
-                       rc, phba->pport->port_state);
+                               "2557 UNREG_VFI issue mbox failed rc x%x "
+                               "HBA state x%x\n",
+                               rc, phba->pport->port_state);
                mempool_free(mbox, phba->mbox_mem_pool);
-               return;
+               return -EIO;
        }
 
-       /* Unregister FCF */
+       shost = lpfc_shost_from_vport(phba->pport);
+       spin_lock_irq(shost->host_lock);
+       phba->pport->fc_flag &= ~FC_VFI_REGISTERED;
+       spin_unlock_irq(shost->host_lock);
+
+       return 0;
+}
+
+/**
+ * lpfc_sli4_unregister_fcf - Unregister currently registered FCF record
+ * @phba: Pointer to hba context object.
+ *
+ * This function issues synchronous unregister FCF mailbox command to HBA to
+ * unregister the currently registered FCF record. The driver does not reset
+ * the driver FCF usage state flags.
+ *
+ * Return 0 if successfully issued, none-zero otherwise.
+ */
+int
+lpfc_sli4_unregister_fcf(struct lpfc_hba *phba)
+{
+       LPFC_MBOXQ_t *mbox;
+       int rc;
+
        mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (!mbox) {
                lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
-                       "2551 UNREG_FCFI mbox allocation failed"
-                       "HBA state x%x\n",
-                       phba->pport->port_state);
-               return;
+                               "2551 UNREG_FCFI mbox allocation failed"
+                               "HBA state x%x\n", phba->pport->port_state);
+               return -ENOMEM;
        }
-
        lpfc_unreg_fcfi(mbox, phba->fcf.fcfi);
        mbox->vport = phba->pport;
        mbox->mbox_cmpl = lpfc_unregister_fcfi_cmpl;
        rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
 
        if (rc == MBX_NOT_FINISHED) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
-                       "2552 UNREG_FCFI issue mbox failed rc x%x "
-                       "HBA state x%x\n",
-                       rc, phba->pport->port_state);
-               mempool_free(mbox, phba->mbox_mem_pool);
+               lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                               "2552 Unregister FCFI command failed rc x%x "
+                               "HBA state x%x\n",
+                               rc, phba->pport->port_state);
+               return -EINVAL;
+       }
+       return 0;
+}
+
+/**
+ * lpfc_unregister_fcf_rescan - Unregister currently registered fcf and rescan
+ * @phba: Pointer to hba context object.
+ *
+ * This function unregisters the currently reigstered FCF. This function
+ * also tries to find another FCF for discovery by rescan the HBA FCF table.
+ */
+void
+lpfc_unregister_fcf_rescan(struct lpfc_hba *phba)
+{
+       int rc;
+
+       /* Preparation for unregistering fcf */
+       rc = lpfc_unregister_fcf_prep(phba);
+       if (rc) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
+                               "2748 Failed to prepare for unregistering "
+                               "HBA's FCF record: rc=%d\n", rc);
                return;
        }
 
-       spin_lock_irq(&phba->hbalock);
-       phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_REGISTERED |
-               FCF_DISCOVERED | FCF_BOOT_ENABLE | FCF_IN_USE |
-               FCF_VALID_VLAN);
-       spin_unlock_irq(&phba->hbalock);
+       /* Now, unregister FCF record and reset HBA FCF state */
+       rc = lpfc_sli4_unregister_fcf(phba);
+       if (rc)
+               return;
+       /* Reset HBA FCF states after successful unregister FCF */
+       phba->fcf.fcf_flag = 0;
 
        /*
         * If driver is not unloading, check if there is any other
         * FCF record that can be used for discovery.
         */
        if ((phba->pport->load_flag & FC_UNLOADING) ||
-               (phba->link_state < LPFC_LINK_UP))
+           (phba->link_state < LPFC_LINK_UP))
                return;
 
        rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST);
 
        if (rc)
                lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
-                       "2553 lpfc_unregister_unused_fcf failed to read FCF"
-                       " record HBA state x%x\n",
-                       phba->pport->port_state);
+                               "2553 lpfc_unregister_unused_fcf failed "
+                               "to read FCF record HBA state x%x\n",
+                               phba->pport->port_state);
+}
+
+/**
+ * lpfc_unregister_fcf - Unregister the currently registered fcf record
+ * @phba: Pointer to hba context object.
+ *
+ * This function just unregisters the currently reigstered FCF. It does not
+ * try to find another FCF for discovery.
+ */
+void
+lpfc_unregister_fcf(struct lpfc_hba *phba)
+{
+       int rc;
+
+       /* Preparation for unregistering fcf */
+       rc = lpfc_unregister_fcf_prep(phba);
+       if (rc) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
+                               "2749 Failed to prepare for unregistering "
+                               "HBA's FCF record: rc=%d\n", rc);
+               return;
+       }
+
+       /* Now, unregister FCF record and reset HBA FCF state */
+       rc = lpfc_sli4_unregister_fcf(phba);
+       if (rc)
+               return;
+       /* Set proper HBA FCF states after successful unregister FCF */
+       spin_lock_irq(&phba->hbalock);
+       phba->fcf.fcf_flag &= ~FCF_REGISTERED;
+       spin_unlock_irq(&phba->hbalock);
+}
+
+/**
+ * lpfc_unregister_unused_fcf - Unregister FCF if all devices are disconnected.
+ * @phba: Pointer to hba context object.
+ *
+ * This function check if there are any connected remote port for the FCF and
+ * if all the devices are disconnected, this function unregister FCFI.
+ * This function also tries to use another FCF for discovery.
+ */
+void
+lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
+{
+       /*
+        * If HBA is not running in FIP mode or if HBA does not support
+        * FCoE or if FCF is not registered, do nothing.
+        */
+       spin_lock_irq(&phba->hbalock);
+       if (!(phba->hba_flag & HBA_FCOE_SUPPORT) ||
+           !(phba->fcf.fcf_flag & FCF_REGISTERED) ||
+           !(phba->hba_flag & HBA_FIP_SUPPORT)) {
+               spin_unlock_irq(&phba->hbalock);
+               return;
+       }
+       spin_unlock_irq(&phba->hbalock);
+
+       if (lpfc_fcf_inuse(phba))
+               return;
+
+       lpfc_unregister_fcf_rescan(phba);
 }
 
 /**
index c9faa1d8c3c8a97af2b9157ba217aa9f433285d3..89ff7c09e298cbaefa63a16e5b2da5853c34e510 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -1346,6 +1346,9 @@ typedef struct {          /* FireFly BIU registers */
 #define MBX_HEARTBEAT       0x31
 #define MBX_WRITE_VPARMS    0x32
 #define MBX_ASYNCEVT_ENABLE 0x33
+#define MBX_READ_EVENT_LOG_STATUS 0x37
+#define MBX_READ_EVENT_LOG  0x38
+#define MBX_WRITE_EVENT_LOG 0x39
 
 #define MBX_PORT_CAPABILITIES 0x3B
 #define MBX_PORT_IOV_CONTROL 0x3C
@@ -1465,17 +1468,13 @@ typedef struct {                /* FireFly BIU registers */
 #define CMD_IOCB_LOGENTRY_CN           0x94
 #define CMD_IOCB_LOGENTRY_ASYNC_CN     0x96
 
-/* Unhandled Data Security SLI Commands */
-#define DSSCMD_IWRITE64_CR             0xD8
-#define DSSCMD_IWRITE64_CX             0xD9
-#define DSSCMD_IREAD64_CR              0xDA
-#define DSSCMD_IREAD64_CX              0xDB
-#define DSSCMD_INVALIDATE_DEK          0xDC
-#define DSSCMD_SET_KEK                 0xDD
-#define DSSCMD_GET_KEK_ID              0xDE
-#define DSSCMD_GEN_XFER                        0xDF
-
-#define CMD_MAX_IOCB_CMD        0xE6
+/* Data Security SLI Commands */
+#define DSSCMD_IWRITE64_CR             0xF8
+#define DSSCMD_IWRITE64_CX             0xF9
+#define DSSCMD_IREAD64_CR              0xFA
+#define DSSCMD_IREAD64_CX              0xFB
+
+#define CMD_MAX_IOCB_CMD        0xFB
 #define CMD_IOCB_MASK           0xff
 
 #define MAX_MSG_DATA            28     /* max msg data in CMD_ADAPTER_MSG
old mode 100755 (executable)
new mode 100644 (file)
index 8a2a1c5..820015f
@@ -52,35 +52,37 @@ struct dma_address {
        uint32_t addr_hi;
 };
 
-#define LPFC_SLIREV_CONF_WORD  0x58
 struct lpfc_sli_intf {
        uint32_t word0;
-#define lpfc_sli_intf_iftype_MASK      0x00000007
-#define lpfc_sli_intf_iftype_SHIFT     0
-#define lpfc_sli_intf_iftype_WORD      word0
-#define lpfc_sli_intf_rev_MASK                 0x0000000f
-#define lpfc_sli_intf_rev_SHIFT                4
-#define lpfc_sli_intf_rev_WORD         word0
-#define LPFC_SLIREV_CONF_SLI4  4
-#define lpfc_sli_intf_family_MASK      0x000000ff
-#define lpfc_sli_intf_family_SHIFT     8
-#define lpfc_sli_intf_family_WORD      word0
-#define lpfc_sli_intf_feat1_MASK       0x000000ff
-#define lpfc_sli_intf_feat1_SHIFT      16
-#define lpfc_sli_intf_feat1_WORD       word0
-#define lpfc_sli_intf_feat2_MASK       0x0000001f
-#define lpfc_sli_intf_feat2_SHIFT      24
-#define lpfc_sli_intf_feat2_WORD       word0
-#define lpfc_sli_intf_valid_MASK       0x00000007
-#define lpfc_sli_intf_valid_SHIFT      29
-#define lpfc_sli_intf_valid_WORD       word0
+#define lpfc_sli_intf_valid_SHIFT              29
+#define lpfc_sli_intf_valid_MASK               0x00000007
+#define lpfc_sli_intf_valid_WORD               word0
 #define LPFC_SLI_INTF_VALID            6
+#define lpfc_sli_intf_featurelevel2_SHIFT      24
+#define lpfc_sli_intf_featurelevel2_MASK       0x0000001F
+#define lpfc_sli_intf_featurelevel2_WORD       word0
+#define lpfc_sli_intf_featurelevel1_SHIFT      16
+#define lpfc_sli_intf_featurelevel1_MASK       0x000000FF
+#define lpfc_sli_intf_featurelevel1_WORD       word0
+#define LPFC_SLI_INTF_FEATURELEVEL1_1  1
+#define LPFC_SLI_INTF_FEATURELEVEL1_2  2
+#define lpfc_sli_intf_sli_family_SHIFT         8
+#define lpfc_sli_intf_sli_family_MASK          0x000000FF
+#define lpfc_sli_intf_sli_family_WORD          word0
+#define LPFC_SLI_INTF_FAMILY_BE2       0
+#define LPFC_SLI_INTF_FAMILY_BE3       1
+#define lpfc_sli_intf_slirev_SHIFT             4
+#define lpfc_sli_intf_slirev_MASK              0x0000000F
+#define lpfc_sli_intf_slirev_WORD              word0
+#define LPFC_SLI_INTF_REV_SLI3         3
+#define LPFC_SLI_INTF_REV_SLI4         4
+#define lpfc_sli_intf_if_type_SHIFT            0
+#define lpfc_sli_intf_if_type_MASK             0x00000007
+#define lpfc_sli_intf_if_type_WORD             word0
+#define LPFC_SLI_INTF_IF_TYPE_0                0
+#define LPFC_SLI_INTF_IF_TYPE_1                1
 };
 
-#define LPFC_SLI4_BAR0         1
-#define LPFC_SLI4_BAR1         2
-#define LPFC_SLI4_BAR2         4
-
 #define LPFC_SLI4_MBX_EMBED    true
 #define LPFC_SLI4_MBX_NEMBED   false
 
@@ -161,6 +163,9 @@ struct lpfc_sli_intf {
 #define LPFC_FP_DEF_IMAX       10000
 #define LPFC_SP_DEF_IMAX       10000
 
+/* PORT_CAPABILITIES constants. */
+#define LPFC_MAX_SUPPORTED_PAGES       8
+
 struct ulp_bde64 {
        union ULP_BDE_TUS {
                uint32_t w;
@@ -516,7 +521,7 @@ struct lpfc_register {
 #define LPFC_UERR_STATUS_LO            0x00A0
 #define LPFC_UE_MASK_HI                        0x00AC
 #define LPFC_UE_MASK_LO                        0x00A8
-#define LPFC_SCRATCHPAD                        0x0058
+#define LPFC_SLI_INTF                  0x0058
 
 /* BAR0 Registers */
 #define LPFC_HST_STATE                 0x00AC
@@ -576,19 +581,6 @@ struct lpfc_register {
 #define LPFC_POST_STAGE_ARMFW_READY                    0xC000
 #define LPFC_POST_STAGE_ARMFW_UE                       0xF000
 
-#define lpfc_scratchpad_slirev_SHIFT                   4
-#define lpfc_scratchpad_slirev_MASK                    0xF
-#define lpfc_scratchpad_slirev_WORD                    word0
-#define lpfc_scratchpad_chiptype_SHIFT                 8
-#define lpfc_scratchpad_chiptype_MASK                  0xFF
-#define lpfc_scratchpad_chiptype_WORD                  word0
-#define lpfc_scratchpad_featurelevel1_SHIFT            16
-#define lpfc_scratchpad_featurelevel1_MASK             0xFF
-#define lpfc_scratchpad_featurelevel1_WORD             word0
-#define lpfc_scratchpad_featurelevel2_SHIFT            24
-#define lpfc_scratchpad_featurelevel2_MASK             0xFF
-#define lpfc_scratchpad_featurelevel2_WORD             word0
-
 /* BAR1 Registers */
 #define LPFC_IMR_MASK_ALL      0xFFFFFFFF
 #define LPFC_ISCR_CLEAR_ALL    0xFFFFFFFF
@@ -801,6 +793,7 @@ struct mbox_header {
 #define LPFC_MBOX_OPCODE_FCOE_ADD_FCF                  0x09
 #define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF               0x0A
 #define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE                0x0B
+#define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF           0x10
 
 /* Mailbox command structures */
 struct eq_context {
@@ -1149,10 +1142,7 @@ struct sli4_sge {        /* SLI-4 */
                                                this  flag !! */
 #define lpfc_sli4_sge_last_MASK                0x00000001
 #define lpfc_sli4_sge_last_WORD                word2
-       uint32_t word3;
-#define lpfc_sli4_sge_len_SHIFT                0
-#define lpfc_sli4_sge_len_MASK         0x0001FFFF
-#define lpfc_sli4_sge_len_WORD         word3
+       uint32_t sge_len;
 };
 
 struct fcf_record {
@@ -1301,6 +1291,19 @@ struct lpfc_mbx_del_fcf_tbl_entry {
 #define lpfc_mbx_del_fcf_tbl_index_WORD                word10
 };
 
+struct lpfc_mbx_redisc_fcf_tbl {
+       struct mbox_header header;
+       uint32_t word10;
+#define lpfc_mbx_redisc_fcf_count_SHIFT                0
+#define lpfc_mbx_redisc_fcf_count_MASK         0x0000FFFF
+#define lpfc_mbx_redisc_fcf_count_WORD         word10
+       uint32_t resvd;
+       uint32_t word12;
+#define lpfc_mbx_redisc_fcf_index_SHIFT                0
+#define lpfc_mbx_redisc_fcf_index_MASK         0x0000FFFF
+#define lpfc_mbx_redisc_fcf_index_WORD         word12
+};
+
 struct lpfc_mbx_query_fw_cfg {
        struct mbox_header header;
        uint32_t config_number;
@@ -1834,6 +1837,177 @@ struct lpfc_mbx_request_features {
 #define lpfc_mbx_rq_ftr_rsp_ifip_WORD          word3
 };
 
+struct lpfc_mbx_supp_pages {
+       uint32_t word1;
+#define qs_SHIFT                               0
+#define qs_MASK                                        0x00000001
+#define qs_WORD                                        word1
+#define wr_SHIFT                               1
+#define wr_MASK                                0x00000001
+#define wr_WORD                                        word1
+#define pf_SHIFT                               8
+#define pf_MASK                                        0x000000ff
+#define pf_WORD                                        word1
+#define cpn_SHIFT                              16
+#define cpn_MASK                               0x000000ff
+#define cpn_WORD                               word1
+       uint32_t word2;
+#define list_offset_SHIFT                      0
+#define list_offset_MASK                       0x000000ff
+#define list_offset_WORD                       word2
+#define next_offset_SHIFT                      8
+#define next_offset_MASK                       0x000000ff
+#define next_offset_WORD                       word2
+#define elem_cnt_SHIFT                         16
+#define elem_cnt_MASK                          0x000000ff
+#define elem_cnt_WORD                          word2
+       uint32_t word3;
+#define pn_0_SHIFT                             24
+#define pn_0_MASK                              0x000000ff
+#define pn_0_WORD                              word3
+#define pn_1_SHIFT                             16
+#define pn_1_MASK                              0x000000ff
+#define pn_1_WORD                              word3
+#define pn_2_SHIFT                             8
+#define pn_2_MASK                              0x000000ff
+#define pn_2_WORD                              word3
+#define pn_3_SHIFT                             0
+#define pn_3_MASK                              0x000000ff
+#define pn_3_WORD                              word3
+       uint32_t word4;
+#define pn_4_SHIFT                             24
+#define pn_4_MASK                              0x000000ff
+#define pn_4_WORD                              word4
+#define pn_5_SHIFT                             16
+#define pn_5_MASK                              0x000000ff
+#define pn_5_WORD                              word4
+#define pn_6_SHIFT                             8
+#define pn_6_MASK                              0x000000ff
+#define pn_6_WORD                              word4
+#define pn_7_SHIFT                             0
+#define pn_7_MASK                              0x000000ff
+#define pn_7_WORD                              word4
+       uint32_t rsvd[27];
+#define LPFC_SUPP_PAGES                        0
+#define LPFC_BLOCK_GUARD_PROFILES      1
+#define LPFC_SLI4_PARAMETERS           2
+};
+
+struct lpfc_mbx_sli4_params {
+       uint32_t word1;
+#define qs_SHIFT                               0
+#define qs_MASK                                        0x00000001
+#define qs_WORD                                        word1
+#define wr_SHIFT                               1
+#define wr_MASK                                        0x00000001
+#define wr_WORD                                        word1
+#define pf_SHIFT                               8
+#define pf_MASK                                        0x000000ff
+#define pf_WORD                                        word1
+#define cpn_SHIFT                              16
+#define cpn_MASK                               0x000000ff
+#define cpn_WORD                               word1
+       uint32_t word2;
+#define if_type_SHIFT                          0
+#define if_type_MASK                           0x00000007
+#define if_type_WORD                           word2
+#define sli_rev_SHIFT                          4
+#define sli_rev_MASK                           0x0000000f
+#define sli_rev_WORD                           word2
+#define sli_family_SHIFT                       8
+#define sli_family_MASK                                0x000000ff
+#define sli_family_WORD                                word2
+#define featurelevel_1_SHIFT                   16
+#define featurelevel_1_MASK                    0x000000ff
+#define featurelevel_1_WORD                    word2
+#define featurelevel_2_SHIFT                   24
+#define featurelevel_2_MASK                    0x0000001f
+#define featurelevel_2_WORD                    word2
+       uint32_t word3;
+#define fcoe_SHIFT                             0
+#define fcoe_MASK                              0x00000001
+#define fcoe_WORD                              word3
+#define fc_SHIFT                               1
+#define fc_MASK                                        0x00000001
+#define fc_WORD                                        word3
+#define nic_SHIFT                              2
+#define nic_MASK                               0x00000001
+#define nic_WORD                               word3
+#define iscsi_SHIFT                            3
+#define iscsi_MASK                             0x00000001
+#define iscsi_WORD                             word3
+#define rdma_SHIFT                             4
+#define rdma_MASK                              0x00000001
+#define rdma_WORD                              word3
+       uint32_t sge_supp_len;
+       uint32_t word5;
+#define if_page_sz_SHIFT                       0
+#define if_page_sz_MASK                                0x0000ffff
+#define if_page_sz_WORD                                word5
+#define loopbk_scope_SHIFT                     24
+#define loopbk_scope_MASK                      0x0000000f
+#define loopbk_scope_WORD                      word5
+#define rq_db_window_SHIFT                     28
+#define rq_db_window_MASK                      0x0000000f
+#define rq_db_window_WORD                      word5
+       uint32_t word6;
+#define eq_pages_SHIFT                         0
+#define eq_pages_MASK                          0x0000000f
+#define eq_pages_WORD                          word6
+#define eqe_size_SHIFT                         8
+#define eqe_size_MASK                          0x000000ff
+#define eqe_size_WORD                          word6
+       uint32_t word7;
+#define cq_pages_SHIFT                         0
+#define cq_pages_MASK                          0x0000000f
+#define cq_pages_WORD                          word7
+#define cqe_size_SHIFT                         8
+#define cqe_size_MASK                          0x000000ff
+#define cqe_size_WORD                          word7
+       uint32_t word8;
+#define mq_pages_SHIFT                         0
+#define mq_pages_MASK                          0x0000000f
+#define mq_pages_WORD                          word8
+#define mqe_size_SHIFT                         8
+#define mqe_size_MASK                          0x000000ff
+#define mqe_size_WORD                          word8
+#define mq_elem_cnt_SHIFT                      16
+#define mq_elem_cnt_MASK                       0x000000ff
+#define mq_elem_cnt_WORD                       word8
+       uint32_t word9;
+#define wq_pages_SHIFT                         0
+#define wq_pages_MASK                          0x0000ffff
+#define wq_pages_WORD                          word9
+#define wqe_size_SHIFT                         8
+#define wqe_size_MASK                          0x000000ff
+#define wqe_size_WORD                          word9
+       uint32_t word10;
+#define rq_pages_SHIFT                         0
+#define rq_pages_MASK                          0x0000ffff
+#define rq_pages_WORD                          word10
+#define rqe_size_SHIFT                         8
+#define rqe_size_MASK                          0x000000ff
+#define rqe_size_WORD                          word10
+       uint32_t word11;
+#define hdr_pages_SHIFT                                0
+#define hdr_pages_MASK                         0x0000000f
+#define hdr_pages_WORD                         word11
+#define hdr_size_SHIFT                         8
+#define hdr_size_MASK                          0x0000000f
+#define hdr_size_WORD                          word11
+#define hdr_pp_align_SHIFT                     16
+#define hdr_pp_align_MASK                      0x0000ffff
+#define hdr_pp_align_WORD                      word11
+       uint32_t word12;
+#define sgl_pages_SHIFT                                0
+#define sgl_pages_MASK                         0x0000000f
+#define sgl_pages_WORD                         word12
+#define sgl_pp_align_SHIFT                     16
+#define sgl_pp_align_MASK                      0x0000ffff
+#define sgl_pp_align_WORD                      word12
+       uint32_t rsvd_13_63[51];
+};
+
 /* Mailbox Completion Queue Error Messages */
 #define MB_CQE_STATUS_SUCCESS                  0x0
 #define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES  0x1
@@ -1863,6 +2037,7 @@ struct lpfc_mqe {
                struct lpfc_mbx_read_fcf_tbl read_fcf_tbl;
                struct lpfc_mbx_add_fcf_tbl_entry add_fcf_entry;
                struct lpfc_mbx_del_fcf_tbl_entry del_fcf_entry;
+               struct lpfc_mbx_redisc_fcf_tbl redisc_fcf_tbl;
                struct lpfc_mbx_reg_fcfi reg_fcfi;
                struct lpfc_mbx_unreg_fcfi unreg_fcfi;
                struct lpfc_mbx_mq_create mq_create;
@@ -1883,6 +2058,8 @@ struct lpfc_mqe {
                struct lpfc_mbx_request_features req_ftrs;
                struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
                struct lpfc_mbx_query_fw_cfg query_fw_cfg;
+               struct lpfc_mbx_supp_pages supp_pages;
+               struct lpfc_mbx_sli4_params sli4_params;
                struct lpfc_mbx_nop nop;
        } un;
 };
@@ -1959,6 +2136,9 @@ struct lpfc_acqe_link {
 #define LPFC_ASYNC_LINK_FAULT_NONE     0x0
 #define LPFC_ASYNC_LINK_FAULT_LOCAL    0x1
 #define LPFC_ASYNC_LINK_FAULT_REMOTE   0x2
+#define lpfc_acqe_qos_link_speed_SHIFT 16
+#define lpfc_acqe_qos_link_speed_MASK  0x0000FFFF
+#define lpfc_acqe_qos_link_speed_WORD  word1
        uint32_t event_tag;
        uint32_t trailer;
 };
@@ -1976,6 +2156,7 @@ struct lpfc_acqe_fcoe {
 #define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL    0x2
 #define LPFC_FCOE_EVENT_TYPE_FCF_DEAD          0x3
 #define LPFC_FCOE_EVENT_TYPE_CVL               0x4
+#define LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD     0x5
        uint32_t event_tag;
        uint32_t trailer;
 };
index b8eb1b6e5e77ea2522dfe93b76841454ceebfc5a..d29ac7c317d9d7324b13807f2329615320c2d37f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
@@ -544,7 +544,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
                        mempool_free(pmb, phba->mbox_mem_pool);
                        return -EIO;
                }
-       } else {
+       } else if (phba->cfg_suppress_link_up == 0) {
                lpfc_init_link(phba, pmb, phba->cfg_topology,
                        phba->cfg_link_speed);
                pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
@@ -602,6 +602,102 @@ lpfc_config_port_post(struct lpfc_hba *phba)
        return 0;
 }
 
+/**
+ * lpfc_hba_init_link - Initialize the FC link
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine will issue the INIT_LINK mailbox command call.
+ * It is available to other drivers through the lpfc_hba data
+ * structure for use as a delayed link up mechanism with the
+ * module parameter lpfc_suppress_link_up.
+ *
+ * Return code
+ *             0 - success
+ *             Any other value - error
+ **/
+int
+lpfc_hba_init_link(struct lpfc_hba *phba)
+{
+       struct lpfc_vport *vport = phba->pport;
+       LPFC_MBOXQ_t *pmb;
+       MAILBOX_t *mb;
+       int rc;
+
+       pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!pmb) {
+               phba->link_state = LPFC_HBA_ERROR;
+               return -ENOMEM;
+       }
+       mb = &pmb->u.mb;
+       pmb->vport = vport;
+
+       lpfc_init_link(phba, pmb, phba->cfg_topology,
+               phba->cfg_link_speed);
+       pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
+       lpfc_set_loopback_flag(phba);
+       rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
+       if (rc != MBX_SUCCESS) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+                       "0498 Adapter failed to init, mbxCmd x%x "
+                       "INIT_LINK, mbxStatus x%x\n",
+                       mb->mbxCommand, mb->mbxStatus);
+               /* Clear all interrupt enable conditions */
+               writel(0, phba->HCregaddr);
+               readl(phba->HCregaddr); /* flush */
+               /* Clear all pending interrupts */
+               writel(0xffffffff, phba->HAregaddr);
+               readl(phba->HAregaddr); /* flush */
+               phba->link_state = LPFC_HBA_ERROR;
+               if (rc != MBX_BUSY)
+                       mempool_free(pmb, phba->mbox_mem_pool);
+               return -EIO;
+       }
+       phba->cfg_suppress_link_up = 0;
+
+       return 0;
+}
+
+/**
+ * lpfc_hba_down_link - this routine downs the FC link
+ *
+ * This routine will issue the DOWN_LINK mailbox command call.
+ * It is available to other drivers through the lpfc_hba data
+ * structure for use to stop the link.
+ *
+ * Return code
+ *             0 - success
+ *             Any other value - error
+ **/
+int
+lpfc_hba_down_link(struct lpfc_hba *phba)
+{
+       LPFC_MBOXQ_t *pmb;
+       int rc;
+
+       pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!pmb) {
+               phba->link_state = LPFC_HBA_ERROR;
+               return -ENOMEM;
+       }
+
+       lpfc_printf_log(phba,
+               KERN_ERR, LOG_INIT,
+               "0491 Adapter Link is disabled.\n");
+       lpfc_down_link(phba, pmb);
+       pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
+       rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
+       if ((rc != MBX_SUCCESS) && (rc != MBX_BUSY)) {
+               lpfc_printf_log(phba,
+               KERN_ERR, LOG_INIT,
+               "2522 Adapter failed to issue DOWN_LINK"
+               " mbox command rc 0x%x\n", rc);
+
+               mempool_free(pmb, phba->mbox_mem_pool);
+               return -EIO;
+       }
+       return 0;
+}
+
 /**
  * lpfc_hba_down_prep - Perform lpfc uninitialization prior to HBA reset
  * @phba: pointer to lpfc HBA data structure.
@@ -2072,6 +2168,44 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport)
        return;
 }
 
+/**
+ * __lpfc_sli4_stop_fcf_redisc_wait_timer - Stop FCF rediscovery wait timer
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine stops the SLI4 FCF rediscover wait timer if it's on. The
+ * caller of this routine should already hold the host lock.
+ **/
+void
+__lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba)
+{
+       /* Clear pending FCF rediscovery wait timer */
+       phba->fcf.fcf_flag &= ~FCF_REDISC_PEND;
+       /* Now, try to stop the timer */
+       del_timer(&phba->fcf.redisc_wait);
+}
+
+/**
+ * lpfc_sli4_stop_fcf_redisc_wait_timer - Stop FCF rediscovery wait timer
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine stops the SLI4 FCF rediscover wait timer if it's on. It
+ * checks whether the FCF rediscovery wait timer is pending with the host
+ * lock held before proceeding with disabling the timer and clearing the
+ * wait timer pendig flag.
+ **/
+void
+lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba)
+{
+       spin_lock_irq(&phba->hbalock);
+       if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) {
+               /* FCF rediscovery timer already fired or stopped */
+               spin_unlock_irq(&phba->hbalock);
+               return;
+       }
+       __lpfc_sli4_stop_fcf_redisc_wait_timer(phba);
+       spin_unlock_irq(&phba->hbalock);
+}
+
 /**
  * lpfc_stop_hba_timers - Stop all the timers associated with an HBA
  * @phba: pointer to lpfc hba data structure.
@@ -2096,6 +2230,7 @@ lpfc_stop_hba_timers(struct lpfc_hba *phba)
                break;
        case LPFC_PCI_DEV_OC:
                /* Stop any OneConnect device sepcific driver timers */
+               lpfc_sli4_stop_fcf_redisc_wait_timer(phba);
                break;
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
@@ -2228,6 +2363,7 @@ lpfc_offline_prep(struct lpfc_hba * phba)
        struct lpfc_vport *vport = phba->pport;
        struct lpfc_nodelist  *ndlp, *next_ndlp;
        struct lpfc_vport **vports;
+       struct Scsi_Host *shost;
        int i;
 
        if (vport->fc_flag & FC_OFFLINE_MODE)
@@ -2241,11 +2377,15 @@ lpfc_offline_prep(struct lpfc_hba * phba)
        vports = lpfc_create_vport_work_array(phba);
        if (vports != NULL) {
                for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
-                       struct Scsi_Host *shost;
-
                        if (vports[i]->load_flag & FC_UNLOADING)
                                continue;
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       spin_lock_irq(shost->host_lock);
                        vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED;
+                       vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
+                       vports[i]->fc_flag &= ~FC_VFI_REGISTERED;
+                       spin_unlock_irq(shost->host_lock);
+
                        shost = lpfc_shost_from_vport(vports[i]);
                        list_for_each_entry_safe(ndlp, next_ndlp,
                                                 &vports[i]->fc_nodes,
@@ -2401,7 +2541,8 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
        shost->this_id = -1;
        shost->max_cmd_len = 16;
        if (phba->sli_rev == LPFC_SLI_REV4) {
-               shost->dma_boundary = LPFC_SLI4_MAX_SEGMENT_SIZE;
+               shost->dma_boundary =
+                       phba->sli4_hba.pc_sli4_params.sge_supp_len;
                shost->sg_tablesize = phba->cfg_sg_seg_cnt;
        }
 
@@ -2650,8 +2791,6 @@ lpfc_stop_port_s4(struct lpfc_hba *phba)
        lpfc_stop_hba_timers(phba);
        phba->pport->work_port_events = 0;
        phba->sli4_hba.intr_enable = 0;
-       /* Hard clear it for now, shall have more graceful way to wait later */
-       phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
 }
 
 /**
@@ -2703,7 +2842,7 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba)
        del_fcf_record = &mboxq->u.mqe.un.del_fcf_entry;
        bf_set(lpfc_mbx_del_fcf_tbl_count, del_fcf_record, 1);
        bf_set(lpfc_mbx_del_fcf_tbl_index, del_fcf_record,
-              phba->fcf.fcf_indx);
+              phba->fcf.current_rec.fcf_indx);
 
        if (!phba->sli4_hba.intr_enable)
                rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
@@ -2726,6 +2865,57 @@ lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba)
                mempool_free(mboxq, phba->mbox_mem_pool);
 }
 
+/**
+ * lpfc_fcf_redisc_wait_start_timer - Start fcf rediscover wait timer
+ * @phba: Pointer to hba for which this call is being executed.
+ *
+ * This routine starts the timer waiting for the FCF rediscovery to complete.
+ **/
+void
+lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba)
+{
+       unsigned long fcf_redisc_wait_tmo =
+               (jiffies + msecs_to_jiffies(LPFC_FCF_REDISCOVER_WAIT_TMO));
+       /* Start fcf rediscovery wait period timer */
+       mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo);
+       spin_lock_irq(&phba->hbalock);
+       /* Allow action to new fcf asynchronous event */
+       phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE);
+       /* Mark the FCF rediscovery pending state */
+       phba->fcf.fcf_flag |= FCF_REDISC_PEND;
+       spin_unlock_irq(&phba->hbalock);
+}
+
+/**
+ * lpfc_sli4_fcf_redisc_wait_tmo - FCF table rediscover wait timeout
+ * @ptr: Map to lpfc_hba data structure pointer.
+ *
+ * This routine is invoked when waiting for FCF table rediscover has been
+ * timed out. If new FCF record(s) has (have) been discovered during the
+ * wait period, a new FCF event shall be added to the FCOE async event
+ * list, and then worker thread shall be waked up for processing from the
+ * worker thread context.
+ **/
+void
+lpfc_sli4_fcf_redisc_wait_tmo(unsigned long ptr)
+{
+       struct lpfc_hba *phba = (struct lpfc_hba *)ptr;
+
+       /* Don't send FCF rediscovery event if timer cancelled */
+       spin_lock_irq(&phba->hbalock);
+       if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) {
+               spin_unlock_irq(&phba->hbalock);
+               return;
+       }
+       /* Clear FCF rediscovery timer pending flag */
+       phba->fcf.fcf_flag &= ~FCF_REDISC_PEND;
+       /* FCF rediscovery event to worker thread */
+       phba->fcf.fcf_flag |= FCF_REDISC_EVT;
+       spin_unlock_irq(&phba->hbalock);
+       /* wake up worker thread */
+       lpfc_worker_wake_up(phba);
+}
+
 /**
  * lpfc_sli4_fw_cfg_check - Read the firmware config and verify FCoE support
  * @phba: pointer to lpfc hba data structure.
@@ -2978,6 +3168,8 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
                                bf_get(lpfc_acqe_link_physical, acqe_link);
        phba->sli4_hba.link_state.fault =
                                bf_get(lpfc_acqe_link_fault, acqe_link);
+       phba->sli4_hba.link_state.logical_speed =
+                               bf_get(lpfc_acqe_qos_link_speed, acqe_link);
 
        /* Invoke the lpfc_handle_latt mailbox command callback function */
        lpfc_mbx_cmpl_read_la(phba, pmb);
@@ -3007,22 +3199,34 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
        struct lpfc_nodelist *ndlp;
        struct Scsi_Host  *shost;
        uint32_t link_state;
+       int active_vlink_present;
+       struct lpfc_vport **vports;
+       int i;
 
        phba->fc_eventTag = acqe_fcoe->event_tag;
        phba->fcoe_eventtag = acqe_fcoe->event_tag;
        switch (event_type) {
        case LPFC_FCOE_EVENT_TYPE_NEW_FCF:
+       case LPFC_FCOE_EVENT_TYPE_FCF_PARAM_MOD:
                lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
                        "2546 New FCF found index 0x%x tag 0x%x\n",
                        acqe_fcoe->index,
                        acqe_fcoe->event_tag);
-               /*
-                * If the current FCF is in discovered state, or
-                * FCF discovery is in progress do nothing.
-                */
                spin_lock_irq(&phba->hbalock);
-               if ((phba->fcf.fcf_flag & FCF_DISCOVERED) ||
-                  (phba->hba_flag & FCF_DISC_INPROGRESS)) {
+               if ((phba->fcf.fcf_flag & FCF_SCAN_DONE) ||
+                   (phba->hba_flag & FCF_DISC_INPROGRESS)) {
+                       /*
+                        * If the current FCF is in discovered state or
+                        * FCF discovery is in progress, do nothing.
+                        */
+                       spin_unlock_irq(&phba->hbalock);
+                       break;
+               }
+               if (phba->fcf.fcf_flag & FCF_REDISC_EVT) {
+                       /*
+                        * If fast FCF failover rescan event is pending,
+                        * do nothing.
+                        */
                        spin_unlock_irq(&phba->hbalock);
                        break;
                }
@@ -3049,7 +3253,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
                        " tag 0x%x\n", acqe_fcoe->index,
                        acqe_fcoe->event_tag);
                /* If the event is not for currently used fcf do nothing */
-               if (phba->fcf.fcf_indx != acqe_fcoe->index)
+               if (phba->fcf.current_rec.fcf_indx != acqe_fcoe->index)
                        break;
                /*
                 * Currently, driver support only one FCF - so treat this as
@@ -3074,14 +3278,58 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
                if (!ndlp)
                        break;
                shost = lpfc_shost_from_vport(vport);
+               if (phba->pport->port_state <= LPFC_FLOGI)
+                       break;
+               /* If virtual link is not yet instantiated ignore CVL */
+               if (vport->port_state <= LPFC_FDISC)
+                       break;
+
                lpfc_linkdown_port(vport);
-               if (vport->port_type != LPFC_NPIV_PORT) {
+               lpfc_cleanup_pending_mbox(vport);
+               spin_lock_irq(shost->host_lock);
+               vport->fc_flag |= FC_VPORT_CVL_RCVD;
+               spin_unlock_irq(shost->host_lock);
+               active_vlink_present = 0;
+
+               vports = lpfc_create_vport_work_array(phba);
+               if (vports) {
+                       for (i = 0; i <= phba->max_vports && vports[i] != NULL;
+                                       i++) {
+                               if ((!(vports[i]->fc_flag &
+                                       FC_VPORT_CVL_RCVD)) &&
+                                       (vports[i]->port_state > LPFC_FDISC)) {
+                                       active_vlink_present = 1;
+                                       break;
+                               }
+                       }
+                       lpfc_destroy_vport_work_array(phba, vports);
+               }
+
+               if (active_vlink_present) {
+                       /*
+                        * If there are other active VLinks present,
+                        * re-instantiate the Vlink using FDISC.
+                        */
                        mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
                        spin_lock_irq(shost->host_lock);
                        ndlp->nlp_flag |= NLP_DELAY_TMO;
                        spin_unlock_irq(shost->host_lock);
-                       ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
-                       vport->port_state = LPFC_FLOGI;
+                       ndlp->nlp_last_elscmd = ELS_CMD_FDISC;
+                       vport->port_state = LPFC_FDISC;
+               } else {
+                       /*
+                        * Otherwise, we request port to rediscover
+                        * the entire FCF table for a fast recovery
+                        * from possible case that the current FCF
+                        * is no longer valid.
+                        */
+                       rc = lpfc_sli4_redisc_fcf_table(phba);
+                       if (rc)
+                               /*
+                                * Last resort will be re-try on the
+                                * the current registered FCF entry.
+                                */
+                               lpfc_retry_pport_discovery(phba);
                }
                break;
        default:
@@ -3157,6 +3405,34 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba)
        }
 }
 
+/**
+ * lpfc_sli4_fcf_redisc_event_proc - Process fcf table rediscovery event
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine is invoked by the worker thread to process FCF table
+ * rediscovery pending completion event.
+ **/
+void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba)
+{
+       int rc;
+
+       spin_lock_irq(&phba->hbalock);
+       /* Clear FCF rediscovery timeout event */
+       phba->fcf.fcf_flag &= ~FCF_REDISC_EVT;
+       /* Clear driver fast failover FCF record flag */
+       phba->fcf.failover_rec.flag = 0;
+       /* Set state for FCF fast failover */
+       phba->fcf.fcf_flag |= FCF_REDISC_FOV;
+       spin_unlock_irq(&phba->hbalock);
+
+       /* Scan FCF table from the first entry to re-discover SAN */
+       rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST);
+       if (rc)
+               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
+                               "2747 Post FCF rediscovery read FCF record "
+                               "failed 0x%x\n", rc);
+}
+
 /**
  * lpfc_api_table_setup - Set up per hba pci-device group func api jump table
  * @phba: pointer to lpfc hba data structure.
@@ -3442,8 +3718,10 @@ static int
 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 {
        struct lpfc_sli *psli;
-       int rc;
-       int i, hbq_count;
+       LPFC_MBOXQ_t *mboxq;
+       int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size;
+       uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0};
+       struct lpfc_mqe *mqe;
 
        /* Before proceed, wait for POST done and device ready */
        rc = lpfc_sli4_post_status_check(phba);
@@ -3472,6 +3750,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
        init_timer(&phba->eratt_poll);
        phba->eratt_poll.function = lpfc_poll_eratt;
        phba->eratt_poll.data = (unsigned long) phba;
+       /* FCF rediscover timer */
+       init_timer(&phba->fcf.redisc_wait);
+       phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo;
+       phba->fcf.redisc_wait.data = (unsigned long)phba;
+
        /*
         * We need to do a READ_CONFIG mailbox command here before
         * calling lpfc_get_cfgparam. For VFs this will report the
@@ -3496,31 +3779,26 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
         * used to create the sg_dma_buf_pool must be dynamically calculated.
         * 2 segments are added since the IOCB needs a command and response bde.
         * To insure that the scsi sgl does not cross a 4k page boundary only
-        * sgl sizes of 1k, 2k, 4k, and 8k are supported.
-        * Table of sgl sizes and seg_cnt:
-        * sgl size,    sg_seg_cnt      total seg
-        * 1k           50              52
-        * 2k           114             116
-        * 4k           242             244
-        * 8k           498             500
-        * cmd(32) + rsp(160) + (52 * sizeof(sli4_sge)) = 1024
-        * cmd(32) + rsp(160) + (116 * sizeof(sli4_sge)) = 2048
-        * cmd(32) + rsp(160) + (244 * sizeof(sli4_sge)) = 4096
-        * cmd(32) + rsp(160) + (500 * sizeof(sli4_sge)) = 8192
+        * sgl sizes of must be a power of 2.
         */
-       if (phba->cfg_sg_seg_cnt <= LPFC_DEFAULT_SG_SEG_CNT)
-               phba->cfg_sg_seg_cnt = 50;
-       else if (phba->cfg_sg_seg_cnt <= 114)
-               phba->cfg_sg_seg_cnt = 114;
-       else if (phba->cfg_sg_seg_cnt <= 242)
-               phba->cfg_sg_seg_cnt = 242;
+       buf_size = (sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp) +
+                   ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct sli4_sge)));
+       /* Feature Level 1 hardware is limited to 2 pages */
+       if ((bf_get(lpfc_sli_intf_featurelevel1, &phba->sli4_hba.sli_intf) ==
+            LPFC_SLI_INTF_FEATURELEVEL1_1))
+               max_buf_size = LPFC_SLI4_FL1_MAX_BUF_SIZE;
        else
-               phba->cfg_sg_seg_cnt = 498;
-
-       phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd)
-                                       + sizeof(struct fcp_rsp);
-       phba->cfg_sg_dma_buf_size +=
-               ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct sli4_sge));
+               max_buf_size = LPFC_SLI4_MAX_BUF_SIZE;
+       for (dma_buf_size = LPFC_SLI4_MIN_BUF_SIZE;
+            dma_buf_size < max_buf_size && buf_size > dma_buf_size;
+            dma_buf_size = dma_buf_size << 1)
+               ;
+       if (dma_buf_size == max_buf_size)
+               phba->cfg_sg_seg_cnt = (dma_buf_size -
+                       sizeof(struct fcp_cmnd) - sizeof(struct fcp_rsp) -
+                       (2 * sizeof(struct sli4_sge))) /
+                               sizeof(struct sli4_sge);
+       phba->cfg_sg_dma_buf_size = dma_buf_size;
 
        /* Initialize buffer queue management fields */
        hbq_count = lpfc_sli_hbq_count();
@@ -3638,6 +3916,43 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
                goto out_free_fcp_eq_hdl;
        }
 
+       mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
+                                                      GFP_KERNEL);
+       if (!mboxq) {
+               rc = -ENOMEM;
+               goto out_free_fcp_eq_hdl;
+       }
+
+       /* Get the Supported Pages. It is always available. */
+       lpfc_supported_pages(mboxq);
+       rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
+       if (unlikely(rc)) {
+               rc = -EIO;
+               mempool_free(mboxq, phba->mbox_mem_pool);
+               goto out_free_fcp_eq_hdl;
+       }
+
+       mqe = &mboxq->u.mqe;
+       memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3),
+              LPFC_MAX_SUPPORTED_PAGES);
+       for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) {
+               switch (pn_page[i]) {
+               case LPFC_SLI4_PARAMETERS:
+                       phba->sli4_hba.pc_sli4_params.supported = 1;
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       /* Read the port's SLI4 Parameters capabilities if supported. */
+       if (phba->sli4_hba.pc_sli4_params.supported)
+               rc = lpfc_pc_sli4_params_get(phba, mboxq);
+       mempool_free(mboxq, phba->mbox_mem_pool);
+       if (rc) {
+               rc = -EIO;
+               goto out_free_fcp_eq_hdl;
+       }
        return rc;
 
 out_free_fcp_eq_hdl:
@@ -3733,6 +4048,8 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba)
 int
 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
 {
+       phba->lpfc_hba_init_link = lpfc_hba_init_link;
+       phba->lpfc_hba_down_link = lpfc_hba_down_link;
        switch (dev_grp) {
        case LPFC_PCI_DEV_LP:
                phba->lpfc_hba_down_post = lpfc_hba_down_post_s3;
@@ -4291,7 +4608,7 @@ lpfc_hba_alloc(struct pci_dev *pdev)
                return NULL;
        }
 
-       mutex_init(&phba->ct_event_mutex);
+       spin_lock_init(&phba->ct_ev_lock);
        INIT_LIST_HEAD(&phba->ct_ev_waiters);
 
        return phba;
@@ -4641,7 +4958,7 @@ lpfc_sli_pci_mem_unset(struct lpfc_hba *phba)
 int
 lpfc_sli4_post_status_check(struct lpfc_hba *phba)
 {
-       struct lpfc_register sta_reg, uerrlo_reg, uerrhi_reg, scratchpad;
+       struct lpfc_register sta_reg, uerrlo_reg, uerrhi_reg;
        int i, port_error = -ENODEV;
 
        if (!phba->sli4_hba.STAregaddr)
@@ -4677,14 +4994,21 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
                        bf_get(lpfc_hst_state_port_status, &sta_reg));
 
        /* Log device information */
-       scratchpad.word0 =  readl(phba->sli4_hba.SCRATCHPADregaddr);
-       lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                       "2534 Device Info: ChipType=0x%x, SliRev=0x%x, "
-                       "FeatureL1=0x%x, FeatureL2=0x%x\n",
-                       bf_get(lpfc_scratchpad_chiptype, &scratchpad),
-                       bf_get(lpfc_scratchpad_slirev, &scratchpad),
-                       bf_get(lpfc_scratchpad_featurelevel1, &scratchpad),
-                       bf_get(lpfc_scratchpad_featurelevel2, &scratchpad));
+       phba->sli4_hba.sli_intf.word0 = readl(phba->sli4_hba.SLIINTFregaddr);
+       if (bf_get(lpfc_sli_intf_valid,
+                  &phba->sli4_hba.sli_intf) == LPFC_SLI_INTF_VALID) {
+               lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+                               "2534 Device Info: ChipType=0x%x, SliRev=0x%x, "
+                               "FeatureL1=0x%x, FeatureL2=0x%x\n",
+                               bf_get(lpfc_sli_intf_sli_family,
+                                      &phba->sli4_hba.sli_intf),
+                               bf_get(lpfc_sli_intf_slirev,
+                                      &phba->sli4_hba.sli_intf),
+                               bf_get(lpfc_sli_intf_featurelevel1,
+                                      &phba->sli4_hba.sli_intf),
+                               bf_get(lpfc_sli_intf_featurelevel2,
+                                      &phba->sli4_hba.sli_intf));
+       }
        phba->sli4_hba.ue_mask_lo = readl(phba->sli4_hba.UEMASKLOregaddr);
        phba->sli4_hba.ue_mask_hi = readl(phba->sli4_hba.UEMASKHIregaddr);
        /* With uncoverable error, log the error message and return error */
@@ -4723,8 +5047,8 @@ lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba)
                                        LPFC_UE_MASK_LO;
        phba->sli4_hba.UEMASKHIregaddr = phba->sli4_hba.conf_regs_memmap_p +
                                        LPFC_UE_MASK_HI;
-       phba->sli4_hba.SCRATCHPADregaddr = phba->sli4_hba.conf_regs_memmap_p +
-                                       LPFC_SCRATCHPAD;
+       phba->sli4_hba.SLIINTFregaddr = phba->sli4_hba.conf_regs_memmap_p +
+                                       LPFC_SLI_INTF;
 }
 
 /**
@@ -5999,7 +6323,7 @@ lpfc_sli4_fcfi_unreg(struct lpfc_hba *phba, uint16_t fcfi)
                spin_lock_irqsave(&phba->hbalock, flags);
                /* Mark the FCFI is no longer registered */
                phba->fcf.fcf_flag &=
-                       ~(FCF_AVAILABLE | FCF_REGISTERED | FCF_DISCOVERED);
+                       ~(FCF_AVAILABLE | FCF_REGISTERED | FCF_SCAN_DONE);
                spin_unlock_irqrestore(&phba->hbalock, flags);
        }
 }
@@ -6039,16 +6363,20 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
 
        /* Get the bus address of SLI4 device Bar0, Bar1, and Bar2 and the
         * number of bytes required by each mapping. They are actually
-        * mapping to the PCI BAR regions 1, 2, and 4 by the SLI4 device.
+        * mapping to the PCI BAR regions 0 or 1, 2, and 4 by the SLI4 device.
         */
-       phba->pci_bar0_map = pci_resource_start(pdev, LPFC_SLI4_BAR0);
-       bar0map_len = pci_resource_len(pdev, LPFC_SLI4_BAR0);
-
-       phba->pci_bar1_map = pci_resource_start(pdev, LPFC_SLI4_BAR1);
-       bar1map_len = pci_resource_len(pdev, LPFC_SLI4_BAR1);
+       if (pci_resource_start(pdev, 0)) {
+               phba->pci_bar0_map = pci_resource_start(pdev, 0);
+               bar0map_len = pci_resource_len(pdev, 0);
+       } else {
+               phba->pci_bar0_map = pci_resource_start(pdev, 1);
+               bar0map_len = pci_resource_len(pdev, 1);
+       }
+       phba->pci_bar1_map = pci_resource_start(pdev, 2);
+       bar1map_len = pci_resource_len(pdev, 2);
 
-       phba->pci_bar2_map = pci_resource_start(pdev, LPFC_SLI4_BAR2);
-       bar2map_len = pci_resource_len(pdev, LPFC_SLI4_BAR2);
+       phba->pci_bar2_map = pci_resource_start(pdev, 4);
+       bar2map_len = pci_resource_len(pdev, 4);
 
        /* Map SLI4 PCI Config Space Register base to a kernel virtual addr */
        phba->sli4_hba.conf_regs_memmap_p =
@@ -6793,6 +7121,73 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba)
        phba->pport->work_port_events = 0;
 }
 
+ /**
+ * lpfc_pc_sli4_params_get - Get the SLI4_PARAMS port capabilities.
+ * @phba: Pointer to HBA context object.
+ * @mboxq: Pointer to the mailboxq memory for the mailbox command response.
+ *
+ * This function is called in the SLI4 code path to read the port's
+ * sli4 capabilities.
+ *
+ * This function may be be called from any context that can block-wait
+ * for the completion.  The expectation is that this routine is called
+ * typically from probe_one or from the online routine.
+ **/
+int
+lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
+{
+       int rc;
+       struct lpfc_mqe *mqe;
+       struct lpfc_pc_sli4_params *sli4_params;
+       uint32_t mbox_tmo;
+
+       rc = 0;
+       mqe = &mboxq->u.mqe;
+
+       /* Read the port's SLI4 Parameters port capabilities */
+       lpfc_sli4_params(mboxq);
+       if (!phba->sli4_hba.intr_enable)
+               rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
+       else {
+               mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_PORT_CAPABILITIES);
+               rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
+       }
+
+       if (unlikely(rc))
+               return 1;
+
+       sli4_params = &phba->sli4_hba.pc_sli4_params;
+       sli4_params->if_type = bf_get(if_type, &mqe->un.sli4_params);
+       sli4_params->sli_rev = bf_get(sli_rev, &mqe->un.sli4_params);
+       sli4_params->sli_family = bf_get(sli_family, &mqe->un.sli4_params);
+       sli4_params->featurelevel_1 = bf_get(featurelevel_1,
+                                            &mqe->un.sli4_params);
+       sli4_params->featurelevel_2 = bf_get(featurelevel_2,
+                                            &mqe->un.sli4_params);
+       sli4_params->proto_types = mqe->un.sli4_params.word3;
+       sli4_params->sge_supp_len = mqe->un.sli4_params.sge_supp_len;
+       sli4_params->if_page_sz = bf_get(if_page_sz, &mqe->un.sli4_params);
+       sli4_params->rq_db_window = bf_get(rq_db_window, &mqe->un.sli4_params);
+       sli4_params->loopbk_scope = bf_get(loopbk_scope, &mqe->un.sli4_params);
+       sli4_params->eq_pages_max = bf_get(eq_pages, &mqe->un.sli4_params);
+       sli4_params->eqe_size = bf_get(eqe_size, &mqe->un.sli4_params);
+       sli4_params->cq_pages_max = bf_get(cq_pages, &mqe->un.sli4_params);
+       sli4_params->cqe_size = bf_get(cqe_size, &mqe->un.sli4_params);
+       sli4_params->mq_pages_max = bf_get(mq_pages, &mqe->un.sli4_params);
+       sli4_params->mqe_size = bf_get(mqe_size, &mqe->un.sli4_params);
+       sli4_params->mq_elem_cnt = bf_get(mq_elem_cnt, &mqe->un.sli4_params);
+       sli4_params->wq_pages_max = bf_get(wq_pages, &mqe->un.sli4_params);
+       sli4_params->wqe_size = bf_get(wqe_size, &mqe->un.sli4_params);
+       sli4_params->rq_pages_max = bf_get(rq_pages, &mqe->un.sli4_params);
+       sli4_params->rqe_size = bf_get(rqe_size, &mqe->un.sli4_params);
+       sli4_params->hdr_pages_max = bf_get(hdr_pages, &mqe->un.sli4_params);
+       sli4_params->hdr_size = bf_get(hdr_size, &mqe->un.sli4_params);
+       sli4_params->hdr_pp_align = bf_get(hdr_pp_align, &mqe->un.sli4_params);
+       sli4_params->sgl_pages_max = bf_get(sgl_pages, &mqe->un.sli4_params);
+       sli4_params->sgl_pp_align = bf_get(sgl_pp_align, &mqe->un.sli4_params);
+       return rc;
+}
+
 /**
  * lpfc_pci_probe_one_s3 - PCI probe func to reg SLI-3 device to PCI subsystem.
  * @pdev: pointer to PCI device
@@ -7134,6 +7529,12 @@ lpfc_pci_resume_one_s3(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
+       /*
+        * As the new kernel behavior of pci_restore_state() API call clears
+        * device saved_state flag, need to save the restored state again.
+        */
+       pci_save_state(pdev);
+
        if (pdev->is_busmaster)
                pci_set_master(pdev);
 
@@ -7317,6 +7718,13 @@ lpfc_io_slot_reset_s3(struct pci_dev *pdev)
        }
 
        pci_restore_state(pdev);
+
+       /*
+        * As the new kernel behavior of pci_restore_state() API call clears
+        * device saved_state flag, need to save the restored state again.
+        */
+       pci_save_state(pdev);
+
        if (pdev->is_busmaster)
                pci_set_master(pdev);
 
@@ -7726,6 +8134,13 @@ lpfc_pci_resume_one_s4(struct pci_dev *pdev)
        /* Restore device state from PCI config space */
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
+
+       /*
+        * As the new kernel behavior of pci_restore_state() API call clears
+        * device saved_state flag, need to save the restored state again.
+        */
+       pci_save_state(pdev);
+
        if (pdev->is_busmaster)
                pci_set_master(pdev);
 
@@ -7845,11 +8260,11 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        int rc;
        struct lpfc_sli_intf intf;
 
-       if (pci_read_config_dword(pdev, LPFC_SLIREV_CONF_WORD, &intf.word0))
+       if (pci_read_config_dword(pdev, LPFC_SLI_INTF, &intf.word0))
                return -ENODEV;
 
        if ((bf_get(lpfc_sli_intf_valid, &intf) == LPFC_SLI_INTF_VALID) &&
-               (bf_get(lpfc_sli_intf_rev, &intf) == LPFC_SLIREV_CONF_SLI4))
+           (bf_get(lpfc_sli_intf_slirev, &intf) == LPFC_SLI_INTF_REV_SLI4))
                rc = lpfc_pci_probe_one_s4(pdev, pid);
        else
                rc = lpfc_pci_probe_one_s3(pdev, pid);
index a9afd8b94b6afa6eb52e30ab4520077d5c5ce0ed..6c4dce1a30ca70dded02523804b133cc169c40af 100644 (file)
@@ -1707,7 +1707,8 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
                                alloc_len - sizeof(union  lpfc_sli4_cfg_shdr);
        }
        /* The sub-header is in DMA memory, which needs endian converstion */
-       lpfc_sli_pcimem_bcopy(cfg_shdr, cfg_shdr,
+       if (cfg_shdr)
+               lpfc_sli_pcimem_bcopy(cfg_shdr, cfg_shdr,
                              sizeof(union  lpfc_sli4_cfg_shdr));
 
        return alloc_len;
@@ -1746,6 +1747,65 @@ lpfc_sli4_mbox_opcode_get(struct lpfc_hba *phba, struct lpfcMboxq *mbox)
        return bf_get(lpfc_mbox_hdr_opcode, &cfg_shdr->request);
 }
 
+/**
+ * lpfc_sli4_mbx_read_fcf_record - Allocate and construct read fcf mbox cmd
+ * @phba: pointer to lpfc hba data structure.
+ * @fcf_index: index to fcf table.
+ *
+ * This routine routine allocates and constructs non-embedded mailbox command
+ * for reading a FCF table entry refered by @fcf_index.
+ *
+ * Return: pointer to the mailbox command constructed if successful, otherwise
+ * NULL.
+ **/
+int
+lpfc_sli4_mbx_read_fcf_record(struct lpfc_hba *phba,
+                             struct lpfcMboxq *mboxq,
+                             uint16_t fcf_index)
+{
+       void *virt_addr;
+       dma_addr_t phys_addr;
+       uint8_t *bytep;
+       struct lpfc_mbx_sge sge;
+       uint32_t alloc_len, req_len;
+       struct lpfc_mbx_read_fcf_tbl *read_fcf;
+
+       if (!mboxq)
+               return -ENOMEM;
+
+       req_len = sizeof(struct fcf_record) +
+                 sizeof(union lpfc_sli4_cfg_shdr) + 2 * sizeof(uint32_t);
+
+       /* Set up READ_FCF SLI4_CONFIG mailbox-ioctl command */
+       alloc_len = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE,
+                       LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE, req_len,
+                       LPFC_SLI4_MBX_NEMBED);
+
+       if (alloc_len < req_len) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
+                               "0291 Allocated DMA memory size (x%x) is "
+                               "less than the requested DMA memory "
+                               "size (x%x)\n", alloc_len, req_len);
+               return -ENOMEM;
+       }
+
+       /* Get the first SGE entry from the non-embedded DMA memory. This
+        * routine only uses a single SGE.
+        */
+       lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
+       phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
+       virt_addr = mboxq->sge_array->addr[0];
+       read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr;
+
+       /* Set up command fields */
+       bf_set(lpfc_mbx_read_fcf_tbl_indx, &read_fcf->u.request, fcf_index);
+       /* Perform necessary endian conversion */
+       bytep = virt_addr + sizeof(union lpfc_sli4_cfg_shdr);
+       lpfc_sli_pcimem_bcopy(bytep, bytep, sizeof(uint32_t));
+
+       return 0;
+}
+
 /**
  * lpfc_request_features: Configure SLI4 REQUEST_FEATURES mailbox
  * @mboxq: pointer to lpfc mbox command.
@@ -1946,13 +2006,14 @@ lpfc_reg_fcfi(struct lpfc_hba *phba, struct lpfcMboxq *mbox)
        bf_set(lpfc_reg_fcfi_rq_id1, reg_fcfi, REG_FCF_INVALID_QID);
        bf_set(lpfc_reg_fcfi_rq_id2, reg_fcfi, REG_FCF_INVALID_QID);
        bf_set(lpfc_reg_fcfi_rq_id3, reg_fcfi, REG_FCF_INVALID_QID);
-       bf_set(lpfc_reg_fcfi_info_index, reg_fcfi, phba->fcf.fcf_indx);
+       bf_set(lpfc_reg_fcfi_info_index, reg_fcfi,
+              phba->fcf.current_rec.fcf_indx);
        /* reg_fcf addr mode is bit wise inverted value of fcf addr_mode */
-       bf_set(lpfc_reg_fcfi_mam, reg_fcfi,
-               (~phba->fcf.addr_mode) & 0x3);
-       if (phba->fcf.fcf_flag & FCF_VALID_VLAN) {
+       bf_set(lpfc_reg_fcfi_mam, reg_fcfi, (~phba->fcf.addr_mode) & 0x3);
+       if (phba->fcf.current_rec.vlan_id != 0xFFFF) {
                bf_set(lpfc_reg_fcfi_vv, reg_fcfi, 1);
-               bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi, phba->fcf.vlan_id);
+               bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi,
+                      phba->fcf.current_rec.vlan_id);
        }
 }
 
@@ -1992,3 +2053,41 @@ lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp)
        bf_set(lpfc_resume_rpi_ii, resume_rpi, RESUME_INDEX_RPI);
        resume_rpi->event_tag = ndlp->phba->fc_eventTag;
 }
+
+/**
+ * lpfc_supported_pages - Initialize the PORT_CAPABILITIES supported pages
+ *                        mailbox command.
+ * @mbox: pointer to lpfc mbox command to initialize.
+ *
+ * The PORT_CAPABILITIES supported pages mailbox command is issued to
+ * retrieve the particular feature pages supported by the port.
+ **/
+void
+lpfc_supported_pages(struct lpfcMboxq *mbox)
+{
+       struct lpfc_mbx_supp_pages *supp_pages;
+
+       memset(mbox, 0, sizeof(*mbox));
+       supp_pages = &mbox->u.mqe.un.supp_pages;
+       bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_PORT_CAPABILITIES);
+       bf_set(cpn, supp_pages, LPFC_SUPP_PAGES);
+}
+
+/**
+ * lpfc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params
+ *                    mailbox command.
+ * @mbox: pointer to lpfc mbox command to initialize.
+ *
+ * The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to
+ * retrieve the particular SLI4 features supported by the port.
+ **/
+void
+lpfc_sli4_params(struct lpfcMboxq *mbox)
+{
+       struct lpfc_mbx_sli4_params *sli4_params;
+
+       memset(mbox, 0, sizeof(*mbox));
+       sli4_params = &mbox->u.mqe.un.sli4_params;
+       bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_PORT_CAPABILITIES);
+       bf_set(cpn, sli4_params, LPFC_SLI4_PARAMETERS);
+}
index d655ed3eebef7fe78b714b4f6f7ac81ac0099645..f3cfbe2ce98697c22c4fa3970b30fb5cd8eededc 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2008 Emulex.  All rights reserved.                *
+ * Copyright (C) 2010 Emulex.  All rights reserved.                *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -177,23 +177,3 @@ struct temp_event {
        uint32_t data;
 };
 
-/* bsg definitions */
-#define LPFC_BSG_VENDOR_SET_CT_EVENT   1
-#define LPFC_BSG_VENDOR_GET_CT_EVENT   2
-
-struct set_ct_event {
-       uint32_t command;
-       uint32_t ev_req_id;
-       uint32_t ev_reg_id;
-};
-
-struct get_ct_event {
-       uint32_t command;
-       uint32_t ev_reg_id;
-       uint32_t ev_req_id;
-};
-
-struct get_ct_event_reply {
-       uint32_t immed_data;
-       uint32_t type;
-};
index 2ed6af1949327c75764b5804570b5f2d6081dcb5..d20ae6b3b3cf77552ad7061d8e311b34dd3f85b9 100644 (file)
@@ -62,7 +62,7 @@ lpfc_check_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 
 int
 lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
-                struct serv_parm * sp, uint32_t class)
+                struct serv_parm *sp, uint32_t class, int flogi)
 {
        volatile struct serv_parm *hsp = &vport->fc_sparam;
        uint16_t hsp_value, ssp_value = 0;
@@ -75,49 +75,56 @@ lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
         * correcting the byte values.
         */
        if (sp->cls1.classValid) {
-               hsp_value = (hsp->cls1.rcvDataSizeMsb << 8) |
-                               hsp->cls1.rcvDataSizeLsb;
-               ssp_value = (sp->cls1.rcvDataSizeMsb << 8) |
-                               sp->cls1.rcvDataSizeLsb;
-               if (!ssp_value)
-                       goto bad_service_param;
-               if (ssp_value > hsp_value) {
-                       sp->cls1.rcvDataSizeLsb = hsp->cls1.rcvDataSizeLsb;
-                       sp->cls1.rcvDataSizeMsb = hsp->cls1.rcvDataSizeMsb;
+               if (!flogi) {
+                       hsp_value = ((hsp->cls1.rcvDataSizeMsb << 8) |
+                                    hsp->cls1.rcvDataSizeLsb);
+                       ssp_value = ((sp->cls1.rcvDataSizeMsb << 8) |
+                                    sp->cls1.rcvDataSizeLsb);
+                       if (!ssp_value)
+                               goto bad_service_param;
+                       if (ssp_value > hsp_value) {
+                               sp->cls1.rcvDataSizeLsb =
+                                       hsp->cls1.rcvDataSizeLsb;
+                               sp->cls1.rcvDataSizeMsb =
+                                       hsp->cls1.rcvDataSizeMsb;
+                       }
                }
-       } else if (class == CLASS1) {
+       } else if (class == CLASS1)
                goto bad_service_param;
-       }
-
        if (sp->cls2.classValid) {
-               hsp_value = (hsp->cls2.rcvDataSizeMsb << 8) |
-                               hsp->cls2.rcvDataSizeLsb;
-               ssp_value = (sp->cls2.rcvDataSizeMsb << 8) |
-                               sp->cls2.rcvDataSizeLsb;
-               if (!ssp_value)
-                       goto bad_service_param;
-               if (ssp_value > hsp_value) {
-                       sp->cls2.rcvDataSizeLsb = hsp->cls2.rcvDataSizeLsb;
-                       sp->cls2.rcvDataSizeMsb = hsp->cls2.rcvDataSizeMsb;
+               if (!flogi) {
+                       hsp_value = ((hsp->cls2.rcvDataSizeMsb << 8) |
+                                    hsp->cls2.rcvDataSizeLsb);
+                       ssp_value = ((sp->cls2.rcvDataSizeMsb << 8) |
+                                    sp->cls2.rcvDataSizeLsb);
+                       if (!ssp_value)
+                               goto bad_service_param;
+                       if (ssp_value > hsp_value) {
+                               sp->cls2.rcvDataSizeLsb =
+                                       hsp->cls2.rcvDataSizeLsb;
+                               sp->cls2.rcvDataSizeMsb =
+                                       hsp->cls2.rcvDataSizeMsb;
+                       }
                }
-       } else if (class == CLASS2) {
+       } else if (class == CLASS2)
                goto bad_service_param;
-       }
-
        if (sp->cls3.classValid) {
-               hsp_value = (hsp->cls3.rcvDataSizeMsb << 8) |
-                               hsp->cls3.rcvDataSizeLsb;
-               ssp_value = (sp->cls3.rcvDataSizeMsb << 8) |
-                               sp->cls3.rcvDataSizeLsb;
-               if (!ssp_value)
-                       goto bad_service_param;
-               if (ssp_value > hsp_value) {
-                       sp->cls3.rcvDataSizeLsb = hsp->cls3.rcvDataSizeLsb;
-                       sp->cls3.rcvDataSizeMsb = hsp->cls3.rcvDataSizeMsb;
+               if (!flogi) {
+                       hsp_value = ((hsp->cls3.rcvDataSizeMsb << 8) |
+                                    hsp->cls3.rcvDataSizeLsb);
+                       ssp_value = ((sp->cls3.rcvDataSizeMsb << 8) |
+                                    sp->cls3.rcvDataSizeLsb);
+                       if (!ssp_value)
+                               goto bad_service_param;
+                       if (ssp_value > hsp_value) {
+                               sp->cls3.rcvDataSizeLsb =
+                                       hsp->cls3.rcvDataSizeLsb;
+                               sp->cls3.rcvDataSizeMsb =
+                                       hsp->cls3.rcvDataSizeMsb;
+                       }
                }
-       } else if (class == CLASS3) {
+       } else if (class == CLASS3)
                goto bad_service_param;
-       }
 
        /*
         * Preserve the upper four bits of the MSB from the PLOGI response.
@@ -247,7 +254,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        int rc;
 
        memset(&stat, 0, sizeof (struct ls_rjt));
-       if (vport->port_state <= LPFC_FLOGI) {
+       if (vport->port_state <= LPFC_FDISC) {
                /* Before responding to PLOGI, check for pt2pt mode.
                 * If we are pt2pt, with an outstanding FLOGI, abort
                 * the FLOGI and resend it first.
@@ -295,7 +302,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                        NULL);
                return 0;
        }
-       if ((lpfc_check_sparm(vport, ndlp, sp, CLASS3) == 0)) {
+       if ((lpfc_check_sparm(vport, ndlp, sp, CLASS3, 0) == 0)) {
                /* Reject this request because invalid parameters */
                stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
                stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS;
@@ -831,7 +838,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
                                 "0142 PLOGI RSP: Invalid WWN.\n");
                goto out;
        }
-       if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3))
+       if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3, 0))
                goto out;
        /* PLOGI chkparm OK */
        lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
index a246410ce9df1dad507dfb015cc4888a0ae5bf50..7f21b47db791bcd64ce068668cd1878e88fcfda7 100644 (file)
@@ -626,6 +626,7 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba,
                &phba->sli4_hba.lpfc_abts_scsi_buf_list, list) {
                if (psb->cur_iocbq.sli4_xritag == xri) {
                        list_del(&psb->list);
+                       psb->exch_busy = 0;
                        psb->status = IOSTAT_SUCCESS;
                        spin_unlock_irqrestore(
                                &phba->sli4_hba.abts_scsi_buf_list_lock,
@@ -688,11 +689,12 @@ lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *phba)
                                         list);
                        if (status) {
                                /* Put this back on the abort scsi list */
-                               psb->status = IOSTAT_LOCAL_REJECT;
-                               psb->result = IOERR_ABORT_REQUESTED;
+                               psb->exch_busy = 1;
                                rc++;
-                       } else
+                       } else {
+                               psb->exch_busy = 0;
                                psb->status = IOSTAT_SUCCESS;
+                       }
                        /* Put it back into the SCSI buffer list */
                        lpfc_release_scsi_buf_s4(phba, psb);
                }
@@ -796,19 +798,17 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
                 */
                sgl->addr_hi = cpu_to_le32(putPaddrHigh(pdma_phys_fcp_cmd));
                sgl->addr_lo = cpu_to_le32(putPaddrLow(pdma_phys_fcp_cmd));
-               bf_set(lpfc_sli4_sge_len, sgl, sizeof(struct fcp_cmnd));
                bf_set(lpfc_sli4_sge_last, sgl, 0);
                sgl->word2 = cpu_to_le32(sgl->word2);
-               sgl->word3 = cpu_to_le32(sgl->word3);
+               sgl->sge_len = cpu_to_le32(sizeof(struct fcp_cmnd));
                sgl++;
 
                /* Setup the physical region for the FCP RSP */
                sgl->addr_hi = cpu_to_le32(putPaddrHigh(pdma_phys_fcp_rsp));
                sgl->addr_lo = cpu_to_le32(putPaddrLow(pdma_phys_fcp_rsp));
-               bf_set(lpfc_sli4_sge_len, sgl, sizeof(struct fcp_rsp));
                bf_set(lpfc_sli4_sge_last, sgl, 1);
                sgl->word2 = cpu_to_le32(sgl->word2);
-               sgl->word3 = cpu_to_le32(sgl->word3);
+               sgl->sge_len = cpu_to_le32(sizeof(struct fcp_rsp));
 
                /*
                 * Since the IOCB for the FCP I/O is built into this
@@ -839,11 +839,12 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
                                                psb->cur_iocbq.sli4_xritag);
                        if (status) {
                                /* Put this back on the abort scsi list */
-                               psb->status = IOSTAT_LOCAL_REJECT;
-                               psb->result = IOERR_ABORT_REQUESTED;
+                               psb->exch_busy = 1;
                                rc++;
-                       } else
+                       } else {
+                               psb->exch_busy = 0;
                                psb->status = IOSTAT_SUCCESS;
+                       }
                        /* Put it back into the SCSI buffer list */
                        lpfc_release_scsi_buf_s4(phba, psb);
                        break;
@@ -857,11 +858,12 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
                                 list);
                        if (status) {
                                /* Put this back on the abort scsi list */
-                               psb->status = IOSTAT_LOCAL_REJECT;
-                               psb->result = IOERR_ABORT_REQUESTED;
+                               psb->exch_busy = 1;
                                rc++;
-                       } else
+                       } else {
+                               psb->exch_busy = 0;
                                psb->status = IOSTAT_SUCCESS;
+                       }
                        /* Put it back into the SCSI buffer list */
                        lpfc_release_scsi_buf_s4(phba, psb);
                }
@@ -951,8 +953,7 @@ lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
 {
        unsigned long iflag = 0;
 
-       if (psb->status == IOSTAT_LOCAL_REJECT
-               && psb->result == IOERR_ABORT_REQUESTED) {
+       if (psb->exch_busy) {
                spin_lock_irqsave(&phba->sli4_hba.abts_scsi_buf_list_lock,
                                        iflag);
                psb->pCmd = NULL;
@@ -1869,7 +1870,6 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
                scsi_for_each_sg(scsi_cmnd, sgel, nseg, num_bde) {
                        physaddr = sg_dma_address(sgel);
                        dma_len = sg_dma_len(sgel);
-                       bf_set(lpfc_sli4_sge_len, sgl, sg_dma_len(sgel));
                        sgl->addr_lo = cpu_to_le32(putPaddrLow(physaddr));
                        sgl->addr_hi = cpu_to_le32(putPaddrHigh(physaddr));
                        if ((num_bde + 1) == nseg)
@@ -1878,7 +1878,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
                                bf_set(lpfc_sli4_sge_last, sgl, 0);
                        bf_set(lpfc_sli4_sge_offset, sgl, dma_offset);
                        sgl->word2 = cpu_to_le32(sgl->word2);
-                       sgl->word3 = cpu_to_le32(sgl->word3);
+                       sgl->sge_len = cpu_to_le32(dma_len);
                        dma_offset += dma_len;
                        sgl++;
                }
@@ -2221,6 +2221,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
 
        lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4];
        lpfc_cmd->status = pIocbOut->iocb.ulpStatus;
+       /* pick up SLI4 exhange busy status from HBA */
+       lpfc_cmd->exch_busy = pIocbOut->iocb_flag & LPFC_EXCHANGE_BUSY;
+
        if (pnode && NLP_CHK_NODE_ACT(pnode))
                atomic_dec(&pnode->cmd_pending);
 
@@ -2637,6 +2640,7 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp)
        }
        phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf;
        phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth;
+       phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl;
        return 0;
 }
 
@@ -2695,6 +2699,13 @@ lpfc_info(struct Scsi_Host *host)
                                 " port %s",
                                 phba->Port);
                }
+               len = strlen(lpfcinfobuf);
+               if (phba->sli4_hba.link_state.logical_speed) {
+                       snprintf(lpfcinfobuf + len,
+                                384-len,
+                                " Logical Link Speed: %d Mbps",
+                                phba->sli4_hba.link_state.logical_speed * 10);
+               }
        }
        return lpfcinfobuf;
 }
@@ -2990,6 +3001,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
 
        /* ABTS WQE must go to the same WQ as the WQE to be aborted */
        abtsiocb->fcp_wqidx = iocb->fcp_wqidx;
+       abtsiocb->iocb_flag |= LPFC_USE_FCPWQIDX;
 
        if (lpfc_is_link_up(phba))
                icmd->ulpCommand = CMD_ABORT_XRI_CN;
index 65dfc8bd5b49ae385e6d15c51909c245aed71da0..5932273870a593b044d2cd77a3ac22a5b4996453 100644 (file)
@@ -118,6 +118,7 @@ struct lpfc_scsi_buf {
 
        uint32_t timeout;
 
+       uint16_t exch_busy;     /* SLI4 hba reported XB on complete WCQE */
        uint16_t status;        /* From IOCB Word 7- ulpStatus */
        uint32_t result;        /* From IOCB Word 4. */
 
index 589549b2bf0e2da65b38078c8ee005f0afcee822..35e3b96d4e079d2ae519dae5bb891fb955e9bcd6 100644 (file)
@@ -580,10 +580,7 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
        else
                sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_xritag);
        if (sglq)  {
-               if (iocbq->iocb_flag & LPFC_DRIVER_ABORTED
-                       && ((iocbq->iocb.ulpStatus == IOSTAT_LOCAL_REJECT)
-                       && (iocbq->iocb.un.ulpWord[4]
-                               == IOERR_ABORT_REQUESTED))) {
+               if (iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) {
                        spin_lock_irqsave(&phba->sli4_hba.abts_sgl_list_lock,
                                        iflag);
                        list_add(&sglq->list,
@@ -764,10 +761,6 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
        case DSSCMD_IWRITE64_CX:
        case DSSCMD_IREAD64_CR:
        case DSSCMD_IREAD64_CX:
-       case DSSCMD_INVALIDATE_DEK:
-       case DSSCMD_SET_KEK:
-       case DSSCMD_GET_KEK_ID:
-       case DSSCMD_GEN_XFER:
                type = LPFC_SOL_IOCB;
                break;
        case CMD_ABORT_XRI_CN:
@@ -1717,6 +1710,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        struct lpfc_dmabuf *mp;
        uint16_t rpi, vpi;
        int rc;
+       struct lpfc_vport  *vport = pmb->vport;
 
        mp = (struct lpfc_dmabuf *) (pmb->context1);
 
@@ -1745,6 +1739,18 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                        return;
        }
 
+       /* Unreg VPI, if the REG_VPI succeed after VLink failure */
+       if ((pmb->u.mb.mbxCommand == MBX_REG_VPI) &&
+               !(phba->pport->load_flag & FC_UNLOADING) &&
+               !pmb->u.mb.mbxStatus) {
+               lpfc_unreg_vpi(phba, pmb->u.mb.un.varRegVpi.vpi, pmb);
+               pmb->vport = vport;
+               pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
+               rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
+               if (rc != MBX_NOT_FINISHED)
+                       return;
+       }
+
        if (bf_get(lpfc_mqe_command, &pmb->u.mqe) == MBX_SLI4_CONFIG)
                lpfc_sli4_mbox_cmd_free(phba, pmb);
        else
@@ -2228,9 +2234,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                         * All other are passed to the completion callback.
                         */
                        if (pring->ringno == LPFC_ELS_RING) {
-                               if (cmdiocbp->iocb_flag & LPFC_DRIVER_ABORTED) {
+                               if ((phba->sli_rev < LPFC_SLI_REV4) &&
+                                   (cmdiocbp->iocb_flag &
+                                                       LPFC_DRIVER_ABORTED)) {
+                                       spin_lock_irqsave(&phba->hbalock,
+                                                         iflag);
                                        cmdiocbp->iocb_flag &=
                                                ~LPFC_DRIVER_ABORTED;
+                                       spin_unlock_irqrestore(&phba->hbalock,
+                                                              iflag);
                                        saveq->iocb.ulpStatus =
                                                IOSTAT_LOCAL_REJECT;
                                        saveq->iocb.un.ulpWord[4] =
@@ -2240,7 +2252,47 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                                         * of DMAing payload, so don't free data
                                         * buffer till after a hbeat.
                                         */
+                                       spin_lock_irqsave(&phba->hbalock,
+                                                         iflag);
                                        saveq->iocb_flag |= LPFC_DELAY_MEM_FREE;
+                                       spin_unlock_irqrestore(&phba->hbalock,
+                                                              iflag);
+                               }
+                               if ((phba->sli_rev == LPFC_SLI_REV4) &&
+                                   (saveq->iocb_flag & LPFC_EXCHANGE_BUSY)) {
+                                       /* Set cmdiocb flag for the exchange
+                                        * busy so sgl (xri) will not be
+                                        * released until the abort xri is
+                                        * received from hba, clear the
+                                        * LPFC_DRIVER_ABORTED bit in case
+                                        * it was driver initiated abort.
+                                        */
+                                       spin_lock_irqsave(&phba->hbalock,
+                                                         iflag);
+                                       cmdiocbp->iocb_flag &=
+                                               ~LPFC_DRIVER_ABORTED;
+                                       cmdiocbp->iocb_flag |=
+                                               LPFC_EXCHANGE_BUSY;
+                                       spin_unlock_irqrestore(&phba->hbalock,
+                                                              iflag);
+                                       cmdiocbp->iocb.ulpStatus =
+                                               IOSTAT_LOCAL_REJECT;
+                                       cmdiocbp->iocb.un.ulpWord[4] =
+                                               IOERR_ABORT_REQUESTED;
+                                       /*
+                                        * For SLI4, irsiocb contains NO_XRI
+                                        * in sli_xritag, it shall not affect
+                                        * releasing sgl (xri) process.
+                                        */
+                                       saveq->iocb.ulpStatus =
+                                               IOSTAT_LOCAL_REJECT;
+                                       saveq->iocb.un.ulpWord[4] =
+                                               IOERR_SLI_ABORTED;
+                                       spin_lock_irqsave(&phba->hbalock,
+                                                         iflag);
+                                       saveq->iocb_flag |= LPFC_DELAY_MEM_FREE;
+                                       spin_unlock_irqrestore(&phba->hbalock,
+                                                              iflag);
                                }
                        }
                        (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq);
@@ -5687,19 +5739,19 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
 
                for (i = 0; i < numBdes; i++) {
                        /* Should already be byte swapped. */
-                       sgl->addr_hi =  bpl->addrHigh;
-                       sgl->addr_lo =  bpl->addrLow;
-                       /* swap the size field back to the cpu so we
-                        * can assign it to the sgl.
-                        */
-                       bde.tus.w  = le32_to_cpu(bpl->tus.w);
-                       bf_set(lpfc_sli4_sge_len, sgl, bde.tus.f.bdeSize);
+                       sgl->addr_hi = bpl->addrHigh;
+                       sgl->addr_lo = bpl->addrLow;
+
                        if ((i+1) == numBdes)
                                bf_set(lpfc_sli4_sge_last, sgl, 1);
                        else
                                bf_set(lpfc_sli4_sge_last, sgl, 0);
                        sgl->word2 = cpu_to_le32(sgl->word2);
-                       sgl->word3 = cpu_to_le32(sgl->word3);
+                       /* swap the size field back to the cpu so we
+                        * can assign it to the sgl.
+                        */
+                       bde.tus.w = le32_to_cpu(bpl->tus.w);
+                       sgl->sge_len = cpu_to_le32(bde.tus.f.bdeSize);
                        bpl++;
                        sgl++;
                }
@@ -5712,11 +5764,10 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
                                cpu_to_le32(icmd->un.genreq64.bdl.addrHigh);
                        sgl->addr_lo =
                                cpu_to_le32(icmd->un.genreq64.bdl.addrLow);
-                       bf_set(lpfc_sli4_sge_len, sgl,
-                               icmd->un.genreq64.bdl.bdeSize);
                        bf_set(lpfc_sli4_sge_last, sgl, 1);
                        sgl->word2 = cpu_to_le32(sgl->word2);
-                       sgl->word3 = cpu_to_le32(sgl->word3);
+                       sgl->sge_len =
+                               cpu_to_le32(icmd->un.genreq64.bdl.bdeSize);
        }
        return sglq->sli4_xritag;
 }
@@ -5987,12 +6038,10 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                else
                        bf_set(abort_cmd_ia, &wqe->abort_cmd, 0);
                bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG);
-               abort_tag = iocbq->iocb.un.acxri.abortIoTag;
                wqe->words[5] = 0;
                bf_set(lpfc_wqe_gen_ct, &wqe->generic,
                        ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
                abort_tag = iocbq->iocb.un.acxri.abortIoTag;
-               wqe->generic.abort_tag = abort_tag;
                /*
                 * The abort handler will send us CMD_ABORT_XRI_CN or
                 * CMD_CLOSE_XRI_CN and the fw only accepts CMD_ABORT_XRI_CX
@@ -6121,15 +6170,15 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number,
        if (lpfc_sli4_iocb2wqe(phba, piocb, &wqe))
                return IOCB_ERROR;
 
-       if (piocb->iocb_flag &  LPFC_IO_FCP) {
+       if ((piocb->iocb_flag & LPFC_IO_FCP) ||
+               (piocb->iocb_flag & LPFC_USE_FCPWQIDX)) {
                /*
                 * For FCP command IOCB, get a new WQ index to distribute
                 * WQE across the WQsr. On the other hand, for abort IOCB,
                 * it carries the same WQ index to the original command
                 * IOCB.
                 */
-               if ((piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) &&
-                   (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN))
+               if (piocb->iocb_flag & LPFC_IO_FCP)
                        piocb->fcp_wqidx = lpfc_sli4_scmd_to_wqidx_distr(phba);
                if (lpfc_sli4_wq_put(phba->sli4_hba.fcp_wq[piocb->fcp_wqidx],
                                     &wqe))
@@ -7004,7 +7053,14 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                    abort_iocb->iocb.ulpContext != abort_context ||
                    (abort_iocb->iocb_flag & LPFC_DRIVER_ABORTED) == 0)
                        spin_unlock_irq(&phba->hbalock);
-               else {
+               else if (phba->sli_rev < LPFC_SLI_REV4) {
+                       /*
+                        * leave the SLI4 aborted command on the txcmplq
+                        * list and the command complete WCQE's XB bit
+                        * will tell whether the SGL (XRI) can be released
+                        * immediately or to the aborted SGL list for the
+                        * following abort XRI from the HBA.
+                        */
                        list_del_init(&abort_iocb->list);
                        pring->txcmplq_cnt--;
                        spin_unlock_irq(&phba->hbalock);
@@ -7013,11 +7069,13 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                         * payload, so don't free data buffer till after
                         * a hbeat.
                         */
+                       spin_lock_irq(&phba->hbalock);
                        abort_iocb->iocb_flag |= LPFC_DELAY_MEM_FREE;
-
                        abort_iocb->iocb_flag &= ~LPFC_DRIVER_ABORTED;
+                       spin_unlock_irq(&phba->hbalock);
+
                        abort_iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT;
-                       abort_iocb->iocb.un.ulpWord[4] = IOERR_SLI_ABORTED;
+                       abort_iocb->iocb.un.ulpWord[4] = IOERR_ABORT_REQUESTED;
                        (abort_iocb->iocb_cmpl)(phba, abort_iocb, abort_iocb);
                }
        }
@@ -7106,7 +7164,7 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                return 0;
 
        /* This signals the response to set the correct status
-        * before calling the completion handler.
+        * before calling the completion handler
         */
        cmdiocb->iocb_flag |= LPFC_DRIVER_ABORTED;
 
@@ -7124,6 +7182,8 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
 
        /* ABTS WQE must go to the same WQ as the WQE to be aborted */
        abtsiocbp->fcp_wqidx = cmdiocb->fcp_wqidx;
+       if (cmdiocb->iocb_flag & LPFC_IO_FCP)
+               abtsiocbp->iocb_flag |= LPFC_USE_FCPWQIDX;
 
        if (phba->link_state >= LPFC_LINK_UP)
                iabt->ulpCommand = CMD_ABORT_XRI_CN;
@@ -7330,6 +7390,8 @@ lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
 
                /* ABTS WQE must go to the same WQ as the WQE to be aborted */
                abtsiocb->fcp_wqidx = iocbq->fcp_wqidx;
+               if (iocbq->iocb_flag & LPFC_IO_FCP)
+                       abtsiocb->iocb_flag |= LPFC_USE_FCPWQIDX;
 
                if (lpfc_is_link_up(phba))
                        abtsiocb->iocb.ulpCommand = CMD_ABORT_XRI_CN;
@@ -8359,11 +8421,24 @@ void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba)
        }
 }
 
+/**
+ * lpfc_sli4_iocb_param_transfer - Transfer pIocbOut and cmpl status to pIocbIn
+ * @phba: pointer to lpfc hba data structure
+ * @pIocbIn: pointer to the rspiocbq
+ * @pIocbOut: pointer to the cmdiocbq
+ * @wcqe: pointer to the complete wcqe
+ *
+ * This routine transfers the fields of a command iocbq to a response iocbq
+ * by copying all the IOCB fields from command iocbq and transferring the
+ * completion status information from the complete wcqe.
+ **/
 static void
-lpfc_sli4_iocb_param_transfer(struct lpfc_iocbq *pIocbIn,
+lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba,
+                             struct lpfc_iocbq *pIocbIn,
                              struct lpfc_iocbq *pIocbOut,
                              struct lpfc_wcqe_complete *wcqe)
 {
+       unsigned long iflags;
        size_t offset = offsetof(struct lpfc_iocbq, iocb);
 
        memcpy((char *)pIocbIn + offset, (char *)pIocbOut + offset,
@@ -8377,8 +8452,17 @@ lpfc_sli4_iocb_param_transfer(struct lpfc_iocbq *pIocbIn,
                                        wcqe->total_data_placed;
                else
                        pIocbIn->iocb.un.ulpWord[4] = wcqe->parameter;
-       else
+       else {
                pIocbIn->iocb.un.ulpWord[4] = wcqe->parameter;
+               pIocbIn->iocb.un.genreq64.bdl.bdeSize = wcqe->total_data_placed;
+       }
+
+       /* Pick up HBA exchange busy condition */
+       if (bf_get(lpfc_wcqe_c_xb, wcqe)) {
+               spin_lock_irqsave(&phba->hbalock, iflags);
+               pIocbIn->iocb_flag |= LPFC_EXCHANGE_BUSY;
+               spin_unlock_irqrestore(&phba->hbalock, iflags);
+       }
 }
 
 /**
@@ -8419,7 +8503,7 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
        }
 
        /* Fake the irspiocbq and copy necessary response information */
-       lpfc_sli4_iocb_param_transfer(irspiocbq, cmdiocbq, wcqe);
+       lpfc_sli4_iocb_param_transfer(phba, irspiocbq, cmdiocbq, wcqe);
 
        return irspiocbq;
 }
@@ -8849,8 +8933,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe)
        int ecount = 0;
        uint16_t cqid;
 
-       if (bf_get(lpfc_eqe_major_code, eqe) != 0 ||
-           bf_get(lpfc_eqe_minor_code, eqe) != 0) {
+       if (bf_get(lpfc_eqe_major_code, eqe) != 0) {
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0359 Not a valid slow-path completion "
                                "event: majorcode=x%x, minorcode=x%x\n",
@@ -8976,7 +9059,7 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,
        }
 
        /* Fake the irspiocb and copy necessary response information */
-       lpfc_sli4_iocb_param_transfer(&irspiocbq, cmdiocbq, wcqe);
+       lpfc_sli4_iocb_param_transfer(phba, &irspiocbq, cmdiocbq, wcqe);
 
        /* Pass the cmd_iocb and the rsp state to the upper layer */
        (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, &irspiocbq);
@@ -9082,8 +9165,7 @@ lpfc_sli4_fp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
        uint16_t cqid;
        int ecount = 0;
 
-       if (unlikely(bf_get(lpfc_eqe_major_code, eqe) != 0) ||
-           unlikely(bf_get(lpfc_eqe_minor_code, eqe) != 0)) {
+       if (unlikely(bf_get(lpfc_eqe_major_code, eqe) != 0)) {
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0366 Not a valid fast-path completion "
                                "event: majorcode=x%x, minorcode=x%x\n",
@@ -11871,12 +11953,6 @@ lpfc_sli4_read_fcf_record(struct lpfc_hba *phba, uint16_t fcf_index)
 {
        int rc = 0, error;
        LPFC_MBOXQ_t *mboxq;
-       void *virt_addr;
-       dma_addr_t phys_addr;
-       uint8_t *bytep;
-       struct lpfc_mbx_sge sge;
-       uint32_t alloc_len, req_len;
-       struct lpfc_mbx_read_fcf_tbl *read_fcf;
 
        phba->fcoe_eventtag_at_fcf_scan = phba->fcoe_eventtag;
        mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@@ -11887,43 +11963,19 @@ lpfc_sli4_read_fcf_record(struct lpfc_hba *phba, uint16_t fcf_index)
                error = -ENOMEM;
                goto fail_fcfscan;
        }
-
-       req_len = sizeof(struct fcf_record) +
-                 sizeof(union lpfc_sli4_cfg_shdr) + 2 * sizeof(uint32_t);
-
-       /* Set up READ_FCF SLI4_CONFIG mailbox-ioctl command */
-       alloc_len = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE,
-                        LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE, req_len,
-                        LPFC_SLI4_MBX_NEMBED);
-
-       if (alloc_len < req_len) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "0291 Allocated DMA memory size (x%x) is "
-                               "less than the requested DMA memory "
-                               "size (x%x)\n", alloc_len, req_len);
-               error = -ENOMEM;
+       /* Construct the read FCF record mailbox command */
+       rc = lpfc_sli4_mbx_read_fcf_record(phba, mboxq, fcf_index);
+       if (rc) {
+               error = -EINVAL;
                goto fail_fcfscan;
        }
-
-       /* Get the first SGE entry from the non-embedded DMA memory. This
-        * routine only uses a single SGE.
-        */
-       lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
-       phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
-       virt_addr = mboxq->sge_array->addr[0];
-       read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr;
-
-       /* Set up command fields */
-       bf_set(lpfc_mbx_read_fcf_tbl_indx, &read_fcf->u.request, fcf_index);
-       /* Perform necessary endian conversion */
-       bytep = virt_addr + sizeof(union lpfc_sli4_cfg_shdr);
-       lpfc_sli_pcimem_bcopy(bytep, bytep, sizeof(uint32_t));
+       /* Issue the mailbox command asynchronously */
        mboxq->vport = phba->pport;
        mboxq->mbox_cmpl = lpfc_mbx_cmpl_read_fcf_record;
        rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
-       if (rc == MBX_NOT_FINISHED) {
+       if (rc == MBX_NOT_FINISHED)
                error = -EIO;
-       else {
+       else {
                spin_lock_irq(&phba->hbalock);
                phba->hba_flag |= FCF_DISC_INPROGRESS;
                spin_unlock_irq(&phba->hbalock);
@@ -11941,6 +11993,90 @@ fail_fcfscan:
        return error;
 }
 
+/**
+ * lpfc_mbx_cmpl_redisc_fcf_table - completion routine for rediscover FCF table
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine is the completion routine for the rediscover FCF table mailbox
+ * command. If the mailbox command returned failure, it will try to stop the
+ * FCF rediscover wait timer.
+ **/
+void
+lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
+{
+       struct lpfc_mbx_redisc_fcf_tbl *redisc_fcf;
+       uint32_t shdr_status, shdr_add_status;
+
+       redisc_fcf = &mbox->u.mqe.un.redisc_fcf_tbl;
+
+       shdr_status = bf_get(lpfc_mbox_hdr_status,
+                            &redisc_fcf->header.cfg_shdr.response);
+       shdr_add_status = bf_get(lpfc_mbox_hdr_add_status,
+                            &redisc_fcf->header.cfg_shdr.response);
+       if (shdr_status || shdr_add_status) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                               "2746 Requesting for FCF rediscovery failed "
+                               "status x%x add_status x%x\n",
+                               shdr_status, shdr_add_status);
+               /*
+                * Request failed, last resort to re-try current
+                * registered FCF entry
+                */
+               lpfc_retry_pport_discovery(phba);
+       } else
+               /*
+                * Start FCF rediscovery wait timer for pending FCF
+                * before rescan FCF record table.
+                */
+               lpfc_fcf_redisc_wait_start_timer(phba);
+
+       mempool_free(mbox, phba->mbox_mem_pool);
+}
+
+/**
+ * lpfc_sli4_redisc_all_fcf - Request to rediscover entire FCF table by port.
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine is invoked to request for rediscovery of the entire FCF table
+ * by the port.
+ **/
+int
+lpfc_sli4_redisc_fcf_table(struct lpfc_hba *phba)
+{
+       LPFC_MBOXQ_t *mbox;
+       struct lpfc_mbx_redisc_fcf_tbl *redisc_fcf;
+       int rc, length;
+
+       mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+       if (!mbox) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                               "2745 Failed to allocate mbox for "
+                               "requesting FCF rediscover.\n");
+               return -ENOMEM;
+       }
+
+       length = (sizeof(struct lpfc_mbx_redisc_fcf_tbl) -
+                 sizeof(struct lpfc_sli4_cfg_mhdr));
+       lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
+                        LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF,
+                        length, LPFC_SLI4_MBX_EMBED);
+
+       redisc_fcf = &mbox->u.mqe.un.redisc_fcf_tbl;
+       /* Set count to 0 for invalidating the entire FCF database */
+       bf_set(lpfc_mbx_redisc_fcf_count, redisc_fcf, 0);
+
+       /* Issue the mailbox command asynchronously */
+       mbox->vport = phba->pport;
+       mbox->mbox_cmpl = lpfc_mbx_cmpl_redisc_fcf_table;
+       rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
+
+       if (rc == MBX_NOT_FINISHED) {
+               mempool_free(mbox, phba->mbox_mem_pool);
+               return -EIO;
+       }
+       return 0;
+}
+
 /**
  * lpfc_sli_read_link_ste - Read region 23 to decide if link is disabled.
  * @phba: pointer to lpfc hba data structure.
@@ -12069,3 +12205,48 @@ out:
        kfree(rgn23_data);
        return;
 }
+
+/**
+ * lpfc_cleanup_pending_mbox - Free up vport discovery mailbox commands.
+ * @vport: pointer to vport data structure.
+ *
+ * This function iterate through the mailboxq and clean up all REG_LOGIN
+ * and REG_VPI mailbox commands associated with the vport. This function
+ * is called when driver want to restart discovery of the vport due to
+ * a Clear Virtual Link event.
+ **/
+void
+lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)
+{
+       struct lpfc_hba *phba = vport->phba;
+       LPFC_MBOXQ_t *mb, *nextmb;
+       struct lpfc_dmabuf *mp;
+
+       spin_lock_irq(&phba->hbalock);
+       list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) {
+               if (mb->vport != vport)
+                       continue;
+
+               if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) &&
+                       (mb->u.mb.mbxCommand != MBX_REG_VPI))
+                       continue;
+
+               if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) {
+                       mp = (struct lpfc_dmabuf *) (mb->context1);
+                       if (mp) {
+                               __lpfc_mbuf_free(phba, mp->virt, mp->phys);
+                               kfree(mp);
+                       }
+               }
+               list_del(&mb->list);
+               mempool_free(mb, phba->mbox_mem_pool);
+       }
+       mb = phba->sli.mbox_active;
+       if (mb && (mb->vport == vport)) {
+               if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) ||
+                       (mb->u.mb.mbxCommand == MBX_REG_VPI))
+                       mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
+       }
+       spin_unlock_irq(&phba->hbalock);
+}
+
index ba38de3c28f11488b28419600230e1c2fa2c8093..dfcf5437d1f53ce9f91001f1fbd1e9f66e4944a0 100644 (file)
@@ -53,17 +53,19 @@ struct lpfc_iocbq {
 
        IOCB_t iocb;            /* IOCB cmd */
        uint8_t retry;          /* retry counter for IOCB cmd - if needed */
-       uint8_t iocb_flag;
+       uint16_t iocb_flag;
 #define LPFC_IO_LIBDFC         1       /* libdfc iocb */
 #define LPFC_IO_WAKE           2       /* High Priority Queue signal flag */
 #define LPFC_IO_FCP            4       /* FCP command -- iocbq in scsi_buf */
 #define LPFC_DRIVER_ABORTED    8       /* driver aborted this request */
 #define LPFC_IO_FABRIC         0x10    /* Iocb send using fabric scheduler */
 #define LPFC_DELAY_MEM_FREE    0x20    /* Defer free'ing of FC data */
-#define LPFC_FIP_ELS_ID_MASK   0xc0    /* ELS_ID range 0-3 */
-#define LPFC_FIP_ELS_ID_SHIFT  6
+#define LPFC_EXCHANGE_BUSY     0x40    /* SLI4 hba reported XB in response */
+#define LPFC_USE_FCPWQIDX      0x80    /* Submit to specified FCPWQ index */
+
+#define LPFC_FIP_ELS_ID_MASK   0xc000  /* ELS_ID range 0-3, non-shifted mask */
+#define LPFC_FIP_ELS_ID_SHIFT  14
 
-       uint8_t abort_count;
        uint8_t rsvd2;
        uint32_t drvrTimeout;   /* driver timeout in seconds */
        uint32_t fcp_wqidx;     /* index to FCP work queue */
index 44e5f574236bf25322eb9d30ebebc3faa8ae9442..86308836600f29df3afb2da145c3f877b552498c 100644 (file)
 #define LPFC_RELEASE_NOTIFICATION_INTERVAL     32
 #define LPFC_GET_QE_REL_INT                    32
 #define LPFC_RPI_LOW_WATER_MARK                        10
+
+/* Amount of time in seconds for waiting FCF rediscovery to complete */
+#define LPFC_FCF_REDISCOVER_WAIT_TMO           2000 /* msec */
+
 /* Number of SGL entries can be posted in a 4KB nonembedded mbox command */
 #define LPFC_NEMBED_MBOX_SGL_CNT               254
 
@@ -126,24 +130,36 @@ struct lpfc_sli4_link {
        uint8_t status;
        uint8_t physical;
        uint8_t fault;
+       uint16_t logical_speed;
 };
 
-struct lpfc_fcf {
-       uint8_t  fabric_name[8];
-       uint8_t  switch_name[8];
+struct lpfc_fcf_rec {
+       uint8_t  fabric_name[8];
+       uint8_t  switch_name[8];
        uint8_t  mac_addr[6];
        uint16_t fcf_indx;
+       uint32_t priority;
+       uint16_t vlan_id;
+       uint32_t addr_mode;
+       uint32_t flag;
+#define BOOT_ENABLE    0x01
+#define RECORD_VALID   0x02
+};
+
+struct lpfc_fcf {
        uint16_t fcfi;
        uint32_t fcf_flag;
 #define FCF_AVAILABLE  0x01 /* FCF available for discovery */
 #define FCF_REGISTERED 0x02 /* FCF registered with FW */
-#define FCF_DISCOVERED 0x04 /* FCF discovery started  */
-#define FCF_BOOT_ENABLE 0x08 /* Boot bios use this FCF */
-#define FCF_IN_USE     0x10 /* Atleast one discovery completed */
-#define FCF_VALID_VLAN 0x20 /* Use the vlan id specified */
-       uint32_t priority;
+#define FCF_SCAN_DONE  0x04 /* FCF table scan done */
+#define FCF_IN_USE     0x08 /* Atleast one discovery completed */
+#define FCF_REDISC_PEND        0x10 /* FCF rediscovery pending */
+#define FCF_REDISC_EVT 0x20 /* FCF rediscovery event to worker thread */
+#define FCF_REDISC_FOV 0x40 /* Post FCF rediscovery fast failover */
        uint32_t addr_mode;
-       uint16_t vlan_id;
+       struct lpfc_fcf_rec current_rec;
+       struct lpfc_fcf_rec failover_rec;
+       struct timer_list redisc_wait;
 };
 
 #define LPFC_REGION23_SIGNATURE "RG23"
@@ -248,7 +264,10 @@ struct lpfc_bmbx {
 #define SLI4_CT_VFI 2
 #define SLI4_CT_FCFI 3
 
-#define LPFC_SLI4_MAX_SEGMENT_SIZE 0x10000
+#define LPFC_SLI4_FL1_MAX_SEGMENT_SIZE 0x10000
+#define LPFC_SLI4_FL1_MAX_BUF_SIZE     0X2000
+#define LPFC_SLI4_MIN_BUF_SIZE         0x400
+#define LPFC_SLI4_MAX_BUF_SIZE         0x20000
 
 /*
  * SLI4 specific data structures
@@ -282,6 +301,42 @@ struct lpfc_fcp_eq_hdl {
        struct lpfc_hba *phba;
 };
 
+/* Port Capabilities for SLI4 Parameters */
+struct lpfc_pc_sli4_params {
+       uint32_t supported;
+       uint32_t if_type;
+       uint32_t sli_rev;
+       uint32_t sli_family;
+       uint32_t featurelevel_1;
+       uint32_t featurelevel_2;
+       uint32_t proto_types;
+#define LPFC_SLI4_PROTO_FCOE   0x0000001
+#define LPFC_SLI4_PROTO_FC     0x0000002
+#define LPFC_SLI4_PROTO_NIC    0x0000004
+#define LPFC_SLI4_PROTO_ISCSI  0x0000008
+#define LPFC_SLI4_PROTO_RDMA   0x0000010
+       uint32_t sge_supp_len;
+       uint32_t if_page_sz;
+       uint32_t rq_db_window;
+       uint32_t loopbk_scope;
+       uint32_t eq_pages_max;
+       uint32_t eqe_size;
+       uint32_t cq_pages_max;
+       uint32_t cqe_size;
+       uint32_t mq_pages_max;
+       uint32_t mqe_size;
+       uint32_t mq_elem_cnt;
+       uint32_t wq_pages_max;
+       uint32_t wqe_size;
+       uint32_t rq_pages_max;
+       uint32_t rqe_size;
+       uint32_t hdr_pages_max;
+       uint32_t hdr_size;
+       uint32_t hdr_pp_align;
+       uint32_t sgl_pages_max;
+       uint32_t sgl_pp_align;
+};
+
 /* SLI4 HBA data structure entries */
 struct lpfc_sli4_hba {
        void __iomem *conf_regs_memmap_p; /* Kernel memory mapped address for
@@ -295,7 +350,7 @@ struct lpfc_sli4_hba {
        void __iomem *UERRHIregaddr; /* Address to UERR_STATUS_HI register */
        void __iomem *UEMASKLOregaddr; /* Address to UE_MASK_LO register */
        void __iomem *UEMASKHIregaddr; /* Address to UE_MASK_HI register */
-       void __iomem *SCRATCHPADregaddr; /* Address to scratchpad register */
+       void __iomem *SLIINTFregaddr; /* Address to SLI_INTF register */
        /* BAR1 FCoE function CSR register memory map */
        void __iomem *STAregaddr;    /* Address to HST_STATE register */
        void __iomem *ISRregaddr;    /* Address to HST_ISR register */
@@ -310,6 +365,8 @@ struct lpfc_sli4_hba {
 
        uint32_t ue_mask_lo;
        uint32_t ue_mask_hi;
+       struct lpfc_register sli_intf;
+       struct lpfc_pc_sli4_params pc_sli4_params;
        struct msix_entry *msix_entries;
        uint32_t cfg_eqn;
        struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */
@@ -406,6 +463,8 @@ void lpfc_sli4_mbox_cmd_free(struct lpfc_hba *, struct lpfcMboxq *);
 void lpfc_sli4_mbx_sge_set(struct lpfcMboxq *, uint32_t, dma_addr_t, uint32_t);
 void lpfc_sli4_mbx_sge_get(struct lpfcMboxq *, uint32_t,
                           struct lpfc_mbx_sge *);
+int lpfc_sli4_mbx_read_fcf_record(struct lpfc_hba *, struct lpfcMboxq *,
+                                 uint16_t);
 
 void lpfc_sli4_hba_reset(struct lpfc_hba *);
 struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t,
@@ -448,6 +507,7 @@ int lpfc_sli4_alloc_rpi(struct lpfc_hba *);
 void lpfc_sli4_free_rpi(struct lpfc_hba *, int);
 void lpfc_sli4_remove_rpis(struct lpfc_hba *);
 void lpfc_sli4_async_event_proc(struct lpfc_hba *);
+void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *);
 int lpfc_sli4_resume_rpi(struct lpfc_nodelist *);
 void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *);
 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *);
index 792f72263f1ae39a921db273897b11bd689e48d2..ac276aa46fba58489a893bdb66845caea6b6fa7e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2010 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
@@ -18,7 +18,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "8.3.7"
+#define LPFC_DRIVER_VERSION "8.3.9"
 #define LPFC_DRIVER_NAME               "lpfc"
 #define LPFC_SP_DRIVER_HANDLER_NAME    "lpfc:sp"
 #define LPFC_FP_DRIVER_HANDLER_NAME    "lpfc:fp"
index e3c7fa642306db2e64a12b27880442cc61316e89..dc86e873102a1763a445e285b9d671d7411058a8 100644 (file)
@@ -389,7 +389,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
         * by the port.
         */
        if ((phba->sli_rev == LPFC_SLI_REV4) &&
-           (pport->vpi_state & LPFC_VPI_REGISTERED)) {
+               (pport->fc_flag & FC_VFI_REGISTERED)) {
                rc = lpfc_sli4_init_vpi(phba, vpi);
                if (rc) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
@@ -505,6 +505,7 @@ enable_vport(struct fc_vport *fc_vport)
        struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
        struct lpfc_hba   *phba = vport->phba;
        struct lpfc_nodelist *ndlp = NULL;
+       struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
 
        if ((phba->link_state < LPFC_LINK_UP) ||
            (phba->fc_topology == TOPOLOGY_LOOP)) {
@@ -512,10 +513,10 @@ enable_vport(struct fc_vport *fc_vport)
                return VPORT_OK;
        }
 
-       spin_lock_irq(&phba->hbalock);
+       spin_lock_irq(shost->host_lock);
        vport->load_flag |= FC_LOADING;
        vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
-       spin_unlock_irq(&phba->hbalock);
+       spin_unlock_irq(shost->host_lock);
 
        /* Use the Physical nodes Fabric NDLP to determine if the link is
         * up and ready to FDISC.
index c24e86f07804fe5e77d01d6d4c828a72ca0bf7d1..4a90eaf7cb63ac5a7e8f874ca9868f596924567a 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <asm/irq.h>
 #include <asm/dma.h>
-
 #include <asm/macints.h>
 #include <asm/macintosh.h>
 
@@ -53,7 +52,6 @@ struct mac_esp_priv {
        void __iomem *pdma_io;
        int error;
 };
-static struct platform_device *internal_pdev, *external_pdev;
 static struct esp *esp_chips[2];
 
 #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
@@ -279,24 +277,27 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count,
  * Programmed IO routines follow.
  */
 
-static inline int mac_esp_wait_for_fifo(struct esp *esp)
+static inline unsigned int mac_esp_wait_for_fifo(struct esp *esp)
 {
        int i = 500000;
 
        do {
-               if (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES)
-                       return 0;
+               unsigned int fbytes = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES;
+
+               if (fbytes)
+                       return fbytes;
 
                udelay(2);
        } while (--i);
 
        printk(KERN_ERR PFX "FIFO is empty (sreg %02x)\n",
               esp_read8(ESP_STATUS));
-       return 1;
+       return 0;
 }
 
 static inline int mac_esp_wait_for_intr(struct esp *esp)
 {
+       struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
        int i = 500000;
 
        do {
@@ -308,6 +309,7 @@ static inline int mac_esp_wait_for_intr(struct esp *esp)
        } while (--i);
 
        printk(KERN_ERR PFX "IRQ timeout (sreg %02x)\n", esp->sreg);
+       mep->error = 1;
        return 1;
 }
 
@@ -347,11 +349,10 @@ static inline int mac_esp_wait_for_intr(struct esp *esp)
 static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
                                 u32 dma_count, int write, u8 cmd)
 {
-       unsigned long flags;
        struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
        u8 *fifo = esp->regs + ESP_FDATA * 16;
 
-       local_irq_save(flags);
+       disable_irq(esp->host->irq);
 
        cmd &= ~ESP_CMD_DMA;
        mep->error = 0;
@@ -359,11 +360,35 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
        if (write) {
                scsi_esp_cmd(esp, cmd);
 
-               if (!mac_esp_wait_for_intr(esp)) {
-                       if (mac_esp_wait_for_fifo(esp))
-                               esp_count = 0;
-               } else {
-                       esp_count = 0;
+               while (1) {
+                       unsigned int n;
+
+                       n = mac_esp_wait_for_fifo(esp);
+                       if (!n)
+                               break;
+
+                       if (n > esp_count)
+                               n = esp_count;
+                       esp_count -= n;
+
+                       MAC_ESP_PIO_LOOP("%2@,%0@+", n);
+
+                       if (!esp_count)
+                               break;
+
+                       if (mac_esp_wait_for_intr(esp))
+                               break;
+
+                       if (((esp->sreg & ESP_STAT_PMASK) != ESP_DIP) &&
+                           ((esp->sreg & ESP_STAT_PMASK) != ESP_MIP))
+                               break;
+
+                       esp->ireg = esp_read8(ESP_INTRPT);
+                       if ((esp->ireg & (ESP_INTR_DC | ESP_INTR_BSERV)) !=
+                           ESP_INTR_BSERV)
+                               break;
+
+                       scsi_esp_cmd(esp, ESP_CMD_TI);
                }
        } else {
                scsi_esp_cmd(esp, ESP_CMD_FLUSH);
@@ -374,47 +399,24 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
                        MAC_ESP_PIO_LOOP("%0@+,%2@", esp_count);
 
                scsi_esp_cmd(esp, cmd);
-       }
-
-       while (esp_count) {
-               unsigned int n;
 
-               if (mac_esp_wait_for_intr(esp)) {
-                       mep->error = 1;
-                       break;
-               }
-
-               if (esp->sreg & ESP_STAT_SPAM) {
-                       printk(KERN_ERR PFX "gross error\n");
-                       mep->error = 1;
-                       break;
-               }
-
-               n = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES;
-
-               if (write) {
-                       if (n > esp_count)
-                               n = esp_count;
-                       esp_count -= n;
-
-                       MAC_ESP_PIO_LOOP("%2@,%0@+", n);
+               while (esp_count) {
+                       unsigned int n;
 
-                       if ((esp->sreg & ESP_STAT_PMASK) == ESP_STATP)
+                       if (mac_esp_wait_for_intr(esp))
                                break;
 
-                       if (esp_count) {
-                               esp->ireg = esp_read8(ESP_INTRPT);
-                               if (esp->ireg & ESP_INTR_DC)
-                                       break;
+                       if (((esp->sreg & ESP_STAT_PMASK) != ESP_DOP) &&
+                           ((esp->sreg & ESP_STAT_PMASK) != ESP_MOP))
+                               break;
 
-                               scsi_esp_cmd(esp, ESP_CMD_TI);
-                       }
-               } else {
                        esp->ireg = esp_read8(ESP_INTRPT);
-                       if (esp->ireg & ESP_INTR_DC)
+                       if ((esp->ireg & (ESP_INTR_DC | ESP_INTR_BSERV)) !=
+                           ESP_INTR_BSERV)
                                break;
 
-                       n = MAC_ESP_FIFO_SIZE - n;
+                       n = MAC_ESP_FIFO_SIZE -
+                           (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES);
                        if (n > esp_count)
                                n = esp_count;
 
@@ -429,7 +431,7 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
                }
        }
 
-       local_irq_restore(flags);
+       enable_irq(esp->host->irq);
 }
 
 static int mac_esp_irq_pending(struct esp *esp)
@@ -492,29 +494,12 @@ static int __devinit esp_mac_probe(struct platform_device *dev)
        struct Scsi_Host *host;
        struct esp *esp;
        int err;
-       int chips_present;
        struct mac_esp_priv *mep;
 
        if (!MACH_IS_MAC)
                return -ENODEV;
 
-       switch (macintosh_config->scsi_type) {
-       case MAC_SCSI_QUADRA:
-       case MAC_SCSI_QUADRA3:
-               chips_present = 1;
-               break;
-       case MAC_SCSI_QUADRA2:
-               if ((macintosh_config->ident == MAC_MODEL_Q900) ||
-                   (macintosh_config->ident == MAC_MODEL_Q950))
-                       chips_present = 2;
-               else
-                       chips_present = 1;
-               break;
-       default:
-               chips_present = 0;
-       }
-
-       if (dev->id + 1 > chips_present)
+       if (dev->id > 1)
                return -ENODEV;
 
        host = scsi_host_alloc(tpnt, sizeof(struct esp));
@@ -639,55 +624,26 @@ static struct platform_driver esp_mac_driver = {
        .probe    = esp_mac_probe,
        .remove   = __devexit_p(esp_mac_remove),
        .driver   = {
-               .name     = DRV_MODULE_NAME,
+               .name   = DRV_MODULE_NAME,
+               .owner  = THIS_MODULE,
        },
 };
 
 static int __init mac_esp_init(void)
 {
-       int err;
-
-       err = platform_driver_register(&esp_mac_driver);
-       if (err)
-               return err;
-
-       internal_pdev = platform_device_alloc(DRV_MODULE_NAME, 0);
-       if (internal_pdev && platform_device_add(internal_pdev)) {
-               platform_device_put(internal_pdev);
-               internal_pdev = NULL;
-       }
-       external_pdev = platform_device_alloc(DRV_MODULE_NAME, 1);
-       if (external_pdev && platform_device_add(external_pdev)) {
-               platform_device_put(external_pdev);
-               external_pdev = NULL;
-       }
-
-       if (internal_pdev || external_pdev) {
-               return 0;
-       } else {
-               platform_driver_unregister(&esp_mac_driver);
-               return -ENOMEM;
-       }
+       return platform_driver_register(&esp_mac_driver);
 }
 
 static void __exit mac_esp_exit(void)
 {
        platform_driver_unregister(&esp_mac_driver);
-
-       if (internal_pdev) {
-               platform_device_unregister(internal_pdev);
-               internal_pdev = NULL;
-       }
-       if (external_pdev) {
-               platform_device_unregister(external_pdev);
-               external_pdev = NULL;
-       }
 }
 
 MODULE_DESCRIPTION("Mac ESP SCSI driver");
 MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>");
 MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("platform:" DRV_MODULE_NAME);
 
 module_init(mac_esp_init);
 module_exit(mac_esp_exit);
index 708ea3157b60295cd0ae806404ab4dd4e9bd3640..409648f5845f06c6ff3d0c435164efc060e561ba 100644 (file)
@@ -10,7 +10,7 @@
  *        2 of the License, or (at your option) any later version.
  *
  * FILE                : megaraid_sas.c
- * Version     : v00.00.04.12-rc1
+ * Version     : v00.00.04.17.1-rc1
  *
  * Authors:
  *     (email-id : megaraidlinux@lsi.com)
@@ -843,6 +843,7 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
        pthru->lun = scp->device->lun;
        pthru->cdb_len = scp->cmd_len;
        pthru->timeout = 0;
+       pthru->pad_0 = 0;
        pthru->flags = flags;
        pthru->data_xfer_len = scsi_bufflen(scp);
 
@@ -874,6 +875,12 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
                pthru->sge_count = megasas_make_sgl32(instance, scp,
                                                      &pthru->sgl);
 
+       if (pthru->sge_count > instance->max_num_sge) {
+               printk(KERN_ERR "megasas: DCDB two many SGE NUM=%x\n",
+                       pthru->sge_count);
+               return 0;
+       }
+
        /*
         * Sense info specific
         */
@@ -1000,6 +1007,12 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
        } else
                ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl);
 
+       if (ldio->sge_count > instance->max_num_sge) {
+               printk(KERN_ERR "megasas: build_ld_io: sge_count = %x\n",
+                       ldio->sge_count);
+               return 0;
+       }
+
        /*
         * Sense info specific
         */
@@ -2250,6 +2263,7 @@ megasas_get_pd_list(struct megasas_instance *instance)
        dcmd->sge_count = 1;
        dcmd->flags = MFI_FRAME_DIR_READ;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 0;
        dcmd->data_xfer_len = MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST);
        dcmd->opcode = MR_DCMD_PD_LIST_QUERY;
        dcmd->sgl.sge32[0].phys_addr = ci_h;
@@ -2294,6 +2308,86 @@ megasas_get_pd_list(struct megasas_instance *instance)
        return ret;
 }
 
+/*
+ * megasas_get_ld_list_info -  Returns FW's ld_list structure
+ * @instance:                          Adapter soft state
+ * @ld_list:                           ld_list structure
+ *
+ * Issues an internal command (DCMD) to get the FW's controller PD
+ * list structure.  This information is mainly used to find out SYSTEM
+ * supported by the FW.
+ */
+static int
+megasas_get_ld_list(struct megasas_instance *instance)
+{
+       int ret = 0, ld_index = 0, ids = 0;
+       struct megasas_cmd *cmd;
+       struct megasas_dcmd_frame *dcmd;
+       struct MR_LD_LIST *ci;
+       dma_addr_t ci_h = 0;
+
+       cmd = megasas_get_cmd(instance);
+
+       if (!cmd) {
+               printk(KERN_DEBUG "megasas_get_ld_list: Failed to get cmd\n");
+               return -ENOMEM;
+       }
+
+       dcmd = &cmd->frame->dcmd;
+
+       ci = pci_alloc_consistent(instance->pdev,
+                               sizeof(struct MR_LD_LIST),
+                               &ci_h);
+
+       if (!ci) {
+               printk(KERN_DEBUG "Failed to alloc mem in get_ld_list\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 MR_LD_LIST);
+       dcmd->opcode = MR_DCMD_LD_GET_LIST;
+       dcmd->sgl.sge32[0].phys_addr = ci_h;
+       dcmd->sgl.sge32[0].length = sizeof(struct MR_LD_LIST);
+       dcmd->pad_0  = 0;
+
+       if (!megasas_issue_polled(instance, cmd)) {
+               ret = 0;
+       } else {
+               ret = -1;
+       }
+
+       /* the following function will get the instance PD LIST */
+
+       if ((ret == 0) && (ci->ldCount < MAX_LOGICAL_DRIVES)) {
+               memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
+
+               for (ld_index = 0; ld_index < ci->ldCount; ld_index++) {
+                       if (ci->ldList[ld_index].state != 0) {
+                               ids = ci->ldList[ld_index].ref.targetId;
+                               instance->ld_ids[ids] =
+                                       ci->ldList[ld_index].ref.targetId;
+                       }
+               }
+       }
+
+       pci_free_consistent(instance->pdev,
+                               sizeof(struct MR_LD_LIST),
+                               ci,
+                               ci_h);
+
+       megasas_return_cmd(instance, cmd);
+       return ret;
+}
+
 /**
  * megasas_get_controller_info -       Returns FW's controller structure
  * @instance:                          Adapter soft state
@@ -2339,6 +2433,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance,
        dcmd->sge_count = 1;
        dcmd->flags = MFI_FRAME_DIR_READ;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 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;
@@ -2590,6 +2685,9 @@ static int megasas_init_mfi(struct megasas_instance *instance)
                (MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
        megasas_get_pd_list(instance);
 
+       memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
+       megasas_get_ld_list(instance);
+
        ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL);
 
        /*
@@ -2714,6 +2812,7 @@ megasas_get_seq_num(struct megasas_instance *instance,
        dcmd->sge_count = 1;
        dcmd->flags = MFI_FRAME_DIR_READ;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 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;
@@ -2828,6 +2927,7 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
        dcmd->sge_count = 1;
        dcmd->flags = MFI_FRAME_DIR_READ;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 0;
        dcmd->data_xfer_len = sizeof(struct megasas_evt_detail);
        dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT;
        dcmd->mbox.w[0] = seq_num;
@@ -3166,6 +3266,7 @@ static void megasas_flush_cache(struct megasas_instance *instance)
        dcmd->sge_count = 0;
        dcmd->flags = MFI_FRAME_DIR_NONE;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 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;
@@ -3205,6 +3306,7 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,
        dcmd->sge_count = 0;
        dcmd->flags = MFI_FRAME_DIR_NONE;
        dcmd->timeout = 0;
+       dcmd->pad_0 = 0;
        dcmd->data_xfer_len = 0;
        dcmd->opcode = opcode;
 
@@ -3781,6 +3883,7 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
            compat_alloc_user_space(sizeof(struct megasas_iocpacket));
        int i;
        int error = 0;
+       compat_uptr_t ptr;
 
        if (clear_user(ioc, sizeof(*ioc)))
                return -EFAULT;
@@ -3793,9 +3896,22 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
            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;
+       /*
+        * The sense_ptr is used in megasas_mgmt_fw_ioctl only when
+        * sense_len is not null, so prepare the 64bit value under
+        * the same condition.
+        */
+       if (ioc->sense_len) {
+               void __user **sense_ioc_ptr =
+                       (void __user **)(ioc->frame.raw + ioc->sense_off);
+               compat_uptr_t *sense_cioc_ptr =
+                       (compat_uptr_t *)(cioc->frame.raw + cioc->sense_off);
+               if (get_user(ptr, sense_cioc_ptr) ||
+                   put_user(compat_ptr(ptr), sense_ioc_ptr))
+                       return -EFAULT;
+       }
 
+       for (i = 0; i < MAX_IOCTL_SGE; i++) {
                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,
@@ -3970,6 +4086,7 @@ megasas_aen_polling(struct work_struct *work)
        struct  Scsi_Host *host;
        struct  scsi_device *sdev1;
        u16     pd_index = 0;
+       u16     ld_index = 0;
        int     i, j, doscan = 0;
        u32 seq_num;
        int error;
@@ -3985,8 +4102,124 @@ megasas_aen_polling(struct work_struct *work)
 
                switch (instance->evt_detail->code) {
                case MR_EVT_PD_INSERTED:
+                       if (megasas_get_pd_list(instance) == 0) {
+                       for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) {
+                               for (j = 0;
+                               j < MEGASAS_MAX_DEV_PER_CHANNEL;
+                               j++) {
+
+                               pd_index =
+                               (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
+
+                               sdev1 =
+                               scsi_device_lookup(host, i, j, 0);
+
+                               if (instance->pd_list[pd_index].driveState
+                                               == MR_PD_STATE_SYSTEM) {
+                                               if (!sdev1) {
+                                               scsi_add_device(host, i, j, 0);
+                                               }
+
+                                       if (sdev1)
+                                               scsi_device_put(sdev1);
+                                       }
+                               }
+                       }
+                       }
+                       doscan = 0;
+                       break;
+
                case MR_EVT_PD_REMOVED:
+                       if (megasas_get_pd_list(instance) == 0) {
+                       megasas_get_pd_list(instance);
+                       for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) {
+                               for (j = 0;
+                               j < MEGASAS_MAX_DEV_PER_CHANNEL;
+                               j++) {
+
+                               pd_index =
+                               (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
+
+                               sdev1 =
+                               scsi_device_lookup(host, i, j, 0);
+
+                               if (instance->pd_list[pd_index].driveState
+                                       == MR_PD_STATE_SYSTEM) {
+                                       if (sdev1) {
+                                               scsi_device_put(sdev1);
+                                       }
+                               } else {
+                                       if (sdev1) {
+                                               scsi_remove_device(sdev1);
+                                               scsi_device_put(sdev1);
+                                       }
+                               }
+                               }
+                       }
+                       }
+                       doscan = 0;
+                       break;
+
+               case MR_EVT_LD_OFFLINE:
+               case MR_EVT_LD_DELETED:
+                       megasas_get_ld_list(instance);
+                       for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
+                               for (j = 0;
+                               j < MEGASAS_MAX_DEV_PER_CHANNEL;
+                               j++) {
+
+                               ld_index =
+                               (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
+
+                               sdev1 = scsi_device_lookup(host,
+                                       i + MEGASAS_MAX_LD_CHANNELS,
+                                       j,
+                                       0);
+
+                               if (instance->ld_ids[ld_index] != 0xff) {
+                                       if (sdev1) {
+                                               scsi_device_put(sdev1);
+                                       }
+                               } else {
+                                       if (sdev1) {
+                                               scsi_remove_device(sdev1);
+                                               scsi_device_put(sdev1);
+                                       }
+                               }
+                               }
+                       }
+                       doscan = 0;
+                       break;
+               case MR_EVT_LD_CREATED:
+                       megasas_get_ld_list(instance);
+                       for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
+                               for (j = 0;
+                                       j < MEGASAS_MAX_DEV_PER_CHANNEL;
+                                       j++) {
+                                       ld_index =
+                                       (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
+
+                                       sdev1 = scsi_device_lookup(host,
+                                               i+MEGASAS_MAX_LD_CHANNELS,
+                                               j, 0);
+
+                                       if (instance->ld_ids[ld_index] !=
+                                                               0xff) {
+                                               if (!sdev1) {
+                                                       scsi_add_device(host,
+                                                               i + 2,
+                                                               j, 0);
+                                               }
+                                       }
+                                       if (sdev1) {
+                                               scsi_device_put(sdev1);
+                                       }
+                               }
+                       }
+                       doscan = 0;
+                       break;
                case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED:
+               case MR_EVT_FOREIGN_CFG_IMPORTED:
                        doscan = 1;
                        break;
                default:
@@ -4021,6 +4254,31 @@ megasas_aen_polling(struct work_struct *work)
                                }
                        }
                }
+
+               megasas_get_ld_list(instance);
+               for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
+                       for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) {
+                               ld_index =
+                               (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
+
+                               sdev1 = scsi_device_lookup(host,
+                                       i+MEGASAS_MAX_LD_CHANNELS, j, 0);
+                               if (instance->ld_ids[ld_index] != 0xff) {
+                                       if (!sdev1) {
+                                               scsi_add_device(host,
+                                                               i+2,
+                                                               j, 0);
+                                       } else {
+                                               scsi_device_put(sdev1);
+                                       }
+                               } else {
+                                       if (sdev1) {
+                                               scsi_remove_device(sdev1);
+                                               scsi_device_put(sdev1);
+                                       }
+                               }
+                       }
+               }
        }
 
        if ( instance->aen_cmd != NULL ) {
index 72b28e436e32330d513673dcc9adfa0530c6c179..9d8b6bf605aa39800a770cf1c4a2601b3f7b245c 100644 (file)
@@ -18,9 +18,9 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION                                "00.00.04.12-rc1"
-#define MEGASAS_RELDATE                                "Sep. 17, 2009"
-#define MEGASAS_EXT_VERSION                    "Thu Sep. 17 11:41:51 PST 2009"
+#define MEGASAS_VERSION                        "00.00.04.17.1-rc1"
+#define MEGASAS_RELDATE                        "Oct. 29, 2009"
+#define MEGASAS_EXT_VERSION            "Thu. Oct. 29, 11:41:51 PST 2009"
 
 /*
  * Device IDs
 #define MFI_CMD_STP                            0x08
 
 #define MR_DCMD_CTRL_GET_INFO                  0x01010000
+#define MR_DCMD_LD_GET_LIST                    0x03010000
 
 #define MR_DCMD_CTRL_CACHE_FLUSH               0x01101000
 #define MR_FLUSH_CTRL_CACHE                    0x01
@@ -349,6 +350,32 @@ struct megasas_pd_list {
        u8             driveState;
 } __packed;
 
+ /*
+ * defines the logical drive reference structure
+ */
+union  MR_LD_REF {
+       struct {
+               u8      targetId;
+               u8      reserved;
+               u16     seqNum;
+       };
+       u32     ref;
+} __packed;
+
+/*
+ * defines the logical drive list structure
+ */
+struct MR_LD_LIST {
+       u32     ldCount;
+       u32     reserved;
+       struct {
+               union MR_LD_REF   ref;
+               u8          state;
+               u8          reserved[3];
+               u64         size;
+       } ldList[MAX_LOGICAL_DRIVES];
+} __packed;
+
 /*
  * SAS controller properties
  */
@@ -637,6 +664,8 @@ struct megasas_ctrl_info {
 #define MEGASAS_MAX_LD                         64
 #define MEGASAS_MAX_PD                          (MEGASAS_MAX_PD_CHANNELS * \
                                                MEGASAS_MAX_DEV_PER_CHANNEL)
+#define MEGASAS_MAX_LD_IDS                     (MEGASAS_MAX_LD_CHANNELS * \
+                                               MEGASAS_MAX_DEV_PER_CHANNEL)
 
 #define MEGASAS_DBG_LVL                                1
 
@@ -1187,6 +1216,7 @@ struct megasas_instance {
        struct megasas_register_set __iomem *reg_set;
 
        struct megasas_pd_list          pd_list[MEGASAS_MAX_PD];
+       u8     ld_ids[MEGASAS_MAX_LD_IDS];
        s8 init_id;
 
        u16 max_num_sge;
index 70c4c2467dd870dea94f5e96d7b776410b00c059..ba8e128de2381e90ca0137bab06d402233f28d08 100644 (file)
@@ -44,6 +44,7 @@ config SCSI_MPT2SAS
        tristate "LSI MPT Fusion SAS 2.0 Device Driver"
        depends on PCI && SCSI
        select SCSI_SAS_ATTRS
+       select RAID_ATTRS
        ---help---
        This driver supports PCI-Express SAS 6Gb/s Host Adapters.
 
index 914168105297b657f952f654b81ddb02531548bb..9958d847a88dad016aa639388f299a15b068bb3e 100644 (file)
@@ -8,7 +8,7 @@
  *                  scatter/gather formats.
  *  Creation Date:  June 21, 2006
  *
- *  mpi2.h Version:  02.00.13
+ *  mpi2.h Version:  02.00.14
  *
  *  Version History
  *  ---------------
  *                      bytes reserved.
  *                      Added RAID Accelerator functionality.
  *  07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
+ *                      Added MSI-x index mask and shift for Reply Post Host
+ *                      Index register.
+ *                      Added function code for Host Based Discovery Action.
  *  --------------------------------------------------------------------------
  */
 
@@ -78,7 +82,7 @@
 #define MPI2_VERSION_02_00                  (0x0200)
 
 /* versioning for this MPI header set */
-#define MPI2_HEADER_VERSION_UNIT            (0x0D)
+#define MPI2_HEADER_VERSION_UNIT            (0x0E)
 #define MPI2_HEADER_VERSION_DEV             (0x00)
 #define MPI2_HEADER_VERSION_UNIT_MASK       (0xFF00)
 #define MPI2_HEADER_VERSION_UNIT_SHIFT      (8)
@@ -232,9 +236,12 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS
 #define MPI2_REPLY_FREE_HOST_INDEX_OFFSET       (0x00000048)
 
 /*
- * Offset for the Reply Descriptor Post Queue
+ * Defines for the Reply Descriptor Post Queue
  */
 #define MPI2_REPLY_POST_HOST_INDEX_OFFSET       (0x0000006C)
+#define MPI2_REPLY_POST_HOST_INDEX_MASK         (0x00FFFFFF)
+#define MPI2_RPHI_MSIX_INDEX_MASK               (0xFF000000)
+#define MPI2_RPHI_MSIX_INDEX_SHIFT              (24)
 
 /*
  * Defines for the HCBSize and address
@@ -497,12 +504,13 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UNION
 #define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST      (0x24) /* Target Command Buffer Post Base */
 #define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST      (0x25) /* Target Command Buffer Post List */
 #define MPI2_FUNCTION_RAID_ACCELERATOR              (0x2C) /* RAID Accelerator*/
+/* Host Based Discovery Action */
+#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION   (0x2F)
 
 
 
 /* Doorbell functions */
 #define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET        (0x40)
-/* #define MPI2_FUNCTION_IO_UNIT_RESET                 (0x41) */
 #define MPI2_FUNCTION_HANDSHAKE                     (0x42)
 
 
index 1611c57a6fdff2a64b868d1fcede2f958b1018d5..cf0ac9f40c97f360d1946610576212de247bba3f 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI Configuration messages and pages
  *  Creation Date:  November 10, 2006
  *
- *    mpi2_cnfg.h Version:  02.00.12
+ *    mpi2_cnfg.h Version:  02.00.13
  *
  *  Version History
  *  ---------------
  *                      to SAS Device Page 0 Flags field.
  *                      Added PhyInfo defines for power condition.
  *                      Added Ethernet configuration pages.
+ *  10-28-09  02.00.13  Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY.
+ *                      Added SAS PHY Page 4 structure and defines.
  *  --------------------------------------------------------------------------
  */
 
@@ -712,6 +714,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1
 #define MPI2_IOUNITPAGE1_PAGEVERSION                    (0x04)
 
 /* IO Unit Page 1 Flags defines */
+#define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY    (0x00000800)
 #define MPI2_IOUNITPAGE1_MASK_SATA_WRITE_CACHE          (0x00000600)
 #define MPI2_IOUNITPAGE1_ENABLE_SATA_WRITE_CACHE        (0x00000000)
 #define MPI2_IOUNITPAGE1_DISABLE_SATA_WRITE_CACHE       (0x00000200)
@@ -2291,6 +2294,26 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_PHY_3 {
 #define MPI2_SASPHY3_PAGEVERSION            (0x00)
 
 
+/* SAS PHY Page 4 */
+
+typedef struct _MPI2_CONFIG_PAGE_SAS_PHY_4 {
+    MPI2_CONFIG_EXTENDED_PAGE_HEADER    Header;                     /* 0x00 */
+    U16                                 Reserved1;                  /* 0x08 */
+    U8                                  Reserved2;                  /* 0x0A */
+    U8                                  Flags;                      /* 0x0B */
+    U8                                  InitialFrame[28];           /* 0x0C */
+} MPI2_CONFIG_PAGE_SAS_PHY_4, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SAS_PHY_4,
+  Mpi2SasPhyPage4_t, MPI2_POINTER pMpi2SasPhyPage4_t;
+
+#define MPI2_SASPHY4_PAGEVERSION            (0x00)
+
+/* values for the Flags field */
+#define MPI2_SASPHY4_FLAGS_FRAME_VALID        (0x02)
+#define MPI2_SASPHY4_FLAGS_SATA_FRAME         (0x01)
+
+
+
+
 /****************************************************************************
 *   SAS Port Config Pages
 ****************************************************************************/
index 65fcaa31cb303bc4a0f76e0bfdda78620915ad51..c4adf76b49d97821ee1466ae0739214329a83753 100644 (file)
@@ -5,23 +5,24 @@
  Copyright (c) 2000-2009 LSI Corporation.
 
  ---------------------------------------
- Header Set Release Version:    02.00.12
- Header Set Release Date:       05-06-09
+ Header Set Release Version:    02.00.14
+ Header Set Release Date:       10-28-09
  ---------------------------------------
 
  Filename               Current version     Prior version
  ----------             ---------------     -------------
- mpi2.h                 02.00.12            02.00.11
- mpi2_cnfg.h            02.00.11            02.00.10
- mpi2_init.h            02.00.07            02.00.06
- mpi2_ioc.h             02.00.11            02.00.10
- mpi2_raid.h            02.00.03            02.00.03
- mpi2_sas.h             02.00.02            02.00.02
+ mpi2.h                 02.00.14            02.00.13
+ mpi2_cnfg.h            02.00.13            02.00.12
+ mpi2_init.h            02.00.08            02.00.07
+ mpi2_ioc.h             02.00.13            02.00.12
+ mpi2_raid.h            02.00.04            02.00.04
+ mpi2_sas.h             02.00.03            02.00.02
  mpi2_targ.h            02.00.03            02.00.03
- mpi2_tool.h            02.00.03            02.00.02
+ mpi2_tool.h            02.00.04            02.00.04
  mpi2_type.h            02.00.00            02.00.00
- mpi2_ra.h              02.00.00
- mpi2_history.txt       02.00.11            02.00.12
+ mpi2_ra.h              02.00.00            02.00.00
+ mpi2_hbd.h             02.00.00
+ mpi2_history.txt       02.00.14            02.00.13
 
 
  *  Date      Version   Description
@@ -65,6 +66,11 @@ mpi2.h
  *                      MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
  *                      bytes reserved.
  *                      Added RAID Accelerator functionality.
+ *  07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
+ *                      Added MSI-x index mask and shift for Reply Post Host
+ *                      Index register.
+ *                      Added function code for Host Based Discovery Action.
  *  --------------------------------------------------------------------------
 
 mpi2_cnfg.h
@@ -155,6 +161,15 @@ mpi2_cnfg.h
  *                      Added expander reduced functionality data to SAS
  *                      Expander Page 0.
  *                      Added SAS PHY Page 2 and SAS PHY Page 3.
+ *  07-30-09  02.00.12  Added IO Unit Page 7.
+ *                      Added new device ids.
+ *                      Added SAS IO Unit Page 5.
+ *                      Added partial and slumber power management capable flags
+ *                      to SAS Device Page 0 Flags field.
+ *                      Added PhyInfo defines for power condition.
+ *                      Added Ethernet configuration pages.
+ *  10-28-09  02.00.13  Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY.
+ *                      Added SAS PHY Page 4 structure and defines.
  *  --------------------------------------------------------------------------
 
 mpi2_init.h
@@ -172,6 +187,10 @@ mpi2_init.h
  *                      Query Asynchronous Event.
  *                      Defined two new bits in the SlotStatus field of the SCSI
  *                      Enclosure Processor Request and Reply.
+ *  10-28-09  02.00.08  Added defines for decoding the ResponseInfo bytes for
+ *                      both SCSI IO Error Reply and SCSI Task Management Reply.
+ *                      Added ResponseInfo field to MPI2_SCSI_TASK_MANAGE_REPLY.
+ *                      Added MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG define.
  *  --------------------------------------------------------------------------
 
 mpi2_ioc.h
@@ -246,6 +265,20 @@ mpi2_ioc.h
  *                      Added two new reason codes for SAS Device Status Change
  *                      Event.
  *                      Added new event: SAS PHY Counter.
+ *  07-30-09  02.00.12  Added GPIO Interrupt event define and structure.
+ *                      Added MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER define.
+ *                      Added new product id family for 2208.
+ *  10-28-09  02.00.13  Added HostMSIxVectors field to MPI2_IOC_INIT_REQUEST.
+ *                      Added MaxMSIxVectors field to MPI2_IOC_FACTS_REPLY.
+ *                      Added MinDevHandle field to MPI2_IOC_FACTS_REPLY.
+ *                      Added MPI2_IOCFACTS_CAPABILITY_HOST_BASED_DISCOVERY.
+ *                      Added MPI2_EVENT_HOST_BASED_DISCOVERY_PHY define.
+ *                      Added MPI2_EVENT_SAS_TOPO_ES_NO_EXPANDER define.
+ *                      Added Host Based Discovery Phy Event data.
+ *                      Added defines for ProductID Product field
+ *                      (MPI2_FW_HEADER_PID_).
+ *                      Modified values for SAS ProductID Family
+ *                      (MPI2_FW_HEADER_PID_FAMILY_).
  *  --------------------------------------------------------------------------
 
 mpi2_raid.h
@@ -256,6 +289,8 @@ mpi2_raid.h
  *  05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
  *                      the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
  *                      can be sized by the build environment.
+ *  07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
+ *                      VolumeCreationFlags and marked the old one as obsolete.
  *  --------------------------------------------------------------------------
 
 mpi2_sas.h
@@ -264,6 +299,8 @@ mpi2_sas.h
  *                      Control Request.
  *  10-02-08  02.00.02  Added Set IOC Parameter Operation to SAS IO Unit Control
  *                      Request.
+ *  10-28-09  02.00.03  Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST
+ *                      to MPI2_SGE_IO_UNION since it supports chained SGLs.
  *  --------------------------------------------------------------------------
 
 mpi2_targ.h
@@ -283,6 +320,10 @@ mpi2_tool.h
  *                      structures and defines.
  *  02-29-08  02.00.02  Modified various names to make them 32-character unique.
  *  05-06-09  02.00.03  Added ISTWI Read Write Tool and Diagnostic CLI Tool.
+ *  07-30-09  02.00.04  Added ExtendedType field to DiagnosticBufferPost request
+ *                      and reply messages.
+ *                      Added MPI2_DIAG_BUF_TYPE_EXTENDED.
+ *                      Incremented MPI2_DIAG_BUF_TYPE_COUNT.
  *  --------------------------------------------------------------------------
 
 mpi2_type.h
@@ -293,20 +334,26 @@ mpi2_ra.h
  *  05-06-09  02.00.00  Initial version.
  *  --------------------------------------------------------------------------
 
+mpi2_hbd.h
+ *  10-28-09  02.00.00  Initial version.
+ *  --------------------------------------------------------------------------
+
+
 mpi2_history.txt         Parts list history
 
-Filename     02.00.12
-----------   --------
-mpi2.h       02.00.12
-mpi2_cnfg.h  02.00.11
-mpi2_init.h  02.00.07
-mpi2_ioc.h   02.00.11
-mpi2_raid.h  02.00.03
-mpi2_sas.h   02.00.02
-mpi2_targ.h  02.00.03
-mpi2_tool.h  02.00.03
-mpi2_type.h  02.00.00
-mpi2_ra.h    02.00.00
+Filename     02.00.14  02.00.13  02.00.12
+----------   --------  --------  --------
+mpi2.h       02.00.14  02.00.13  02.00.12
+mpi2_cnfg.h  02.00.13  02.00.12  02.00.11
+mpi2_init.h  02.00.08  02.00.07  02.00.07
+mpi2_ioc.h   02.00.13  02.00.12  02.00.11
+mpi2_raid.h  02.00.04  02.00.04  02.00.03
+mpi2_sas.h   02.00.03  02.00.02  02.00.02
+mpi2_targ.h  02.00.03  02.00.03  02.00.03
+mpi2_tool.h  02.00.04  02.00.04  02.00.03
+mpi2_type.h  02.00.00  02.00.00  02.00.00
+mpi2_ra.h    02.00.00  02.00.00  02.00.00
+mpi2_hbd.h   02.00.00
 
 Filename     02.00.11  02.00.10  02.00.09  02.00.08  02.00.07  02.00.06
 ----------   --------  --------  --------  --------  --------  --------
index 563e56d2e945ee1fdcedd390e26043e97446320d..6541945e97c3ee756843d95fec78e8af3b84f9ed 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI SCSI initiator mode messages and structures
  *  Creation Date:  June 23, 2006
  *
- *    mpi2_init.h Version:  02.00.07
+ *    mpi2_init.h Version:  02.00.08
  *
  *  Version History
  *  ---------------
  *                      Query Asynchronous Event.
  *                      Defined two new bits in the SlotStatus field of the SCSI
  *                      Enclosure Processor Request and Reply.
+ *  10-28-09  02.00.08  Added defines for decoding the ResponseInfo bytes for
+ *                      both SCSI IO Error Reply and SCSI Task Management Reply.
+ *                      Added ResponseInfo field to MPI2_SCSI_TASK_MANAGE_REPLY.
+ *                      Added MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG define.
  *  --------------------------------------------------------------------------
  */
 
@@ -254,6 +258,11 @@ typedef struct _MPI2_SCSI_IO_REPLY
 #define MPI2_SCSI_STATE_AUTOSENSE_FAILED        (0x02)
 #define MPI2_SCSI_STATE_AUTOSENSE_VALID         (0x01)
 
+/* masks and shifts for the ResponseInfo field */
+
+#define MPI2_SCSI_RI_MASK_REASONCODE            (0x000000FF)
+#define MPI2_SCSI_RI_SHIFT_REASONCODE           (0)
+
 #define MPI2_SCSI_TASKTAG_UNKNOWN               (0xFFFF)
 
 
@@ -327,6 +336,7 @@ typedef struct _MPI2_SCSI_TASK_MANAGE_REPLY
     U16                     IOCStatus;                      /* 0x0E */
     U32                     IOCLogInfo;                     /* 0x10 */
     U32                     TerminationCount;               /* 0x14 */
+    U32                     ResponseInfo;                   /* 0x18 */
 } MPI2_SCSI_TASK_MANAGE_REPLY,
   MPI2_POINTER PTR_MPI2_SCSI_TASK_MANAGE_REPLY,
   Mpi2SCSITaskManagementReply_t, MPI2_POINTER pMpi2SCSIManagementReply_t;
@@ -339,8 +349,20 @@ typedef struct _MPI2_SCSI_TASK_MANAGE_REPLY
 #define MPI2_SCSITASKMGMT_RSP_TM_FAILED                 (0x05)
 #define MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED              (0x08)
 #define MPI2_SCSITASKMGMT_RSP_TM_INVALID_LUN            (0x09)
+#define MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG         (0x0A)
 #define MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC          (0x80)
 
+/* masks and shifts for the ResponseInfo field */
+
+#define MPI2_SCSITASKMGMT_RI_MASK_REASONCODE            (0x000000FF)
+#define MPI2_SCSITASKMGMT_RI_SHIFT_REASONCODE           (0)
+#define MPI2_SCSITASKMGMT_RI_MASK_ARI2                  (0x0000FF00)
+#define MPI2_SCSITASKMGMT_RI_SHIFT_ARI2                 (8)
+#define MPI2_SCSITASKMGMT_RI_MASK_ARI1                  (0x00FF0000)
+#define MPI2_SCSITASKMGMT_RI_SHIFT_ARI1                 (16)
+#define MPI2_SCSITASKMGMT_RI_MASK_ARI0                  (0xFF000000)
+#define MPI2_SCSITASKMGMT_RI_SHIFT_ARI0                 (24)
+
 
 /****************************************************************************
 *  SCSI Enclosure Processor messages
index ea51ce8686908d28053136e4e1b6eb4f02924a8f..754938422f6abc7e501b2fae30d078412f40e9c7 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI IOC, Port, Event, FW Download, and FW Upload messages
  *  Creation Date:  October 11, 2006
  *
- *  mpi2_ioc.h Version:  02.00.12
+ *  mpi2_ioc.h Version:  02.00.13
  *
  *  Version History
  *  ---------------
  *  07-30-09  02.00.12  Added GPIO Interrupt event define and structure.
  *                      Added MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER define.
  *                      Added new product id family for 2208.
+ *  10-28-09  02.00.13  Added HostMSIxVectors field to MPI2_IOC_INIT_REQUEST.
+ *                      Added MaxMSIxVectors field to MPI2_IOC_FACTS_REPLY.
+ *                      Added MinDevHandle field to MPI2_IOC_FACTS_REPLY.
+ *                      Added MPI2_IOCFACTS_CAPABILITY_HOST_BASED_DISCOVERY.
+ *                      Added MPI2_EVENT_HOST_BASED_DISCOVERY_PHY define.
+ *                      Added MPI2_EVENT_SAS_TOPO_ES_NO_EXPANDER define.
+ *                      Added Host Based Discovery Phy Event data.
+ *                      Added defines for ProductID Product field
+ *                      (MPI2_FW_HEADER_PID_).
+ *                      Modified values for SAS ProductID Family
+ *                      (MPI2_FW_HEADER_PID_FAMILY_).
  *  --------------------------------------------------------------------------
  */
 
@@ -119,8 +130,10 @@ typedef struct _MPI2_IOC_INIT_REQUEST
     U16                     MsgVersion;                     /* 0x0C */
     U16                     HeaderVersion;                  /* 0x0E */
     U32                     Reserved5;                      /* 0x10 */
-    U32                     Reserved6;                      /* 0x14 */
-    U16                     Reserved7;                      /* 0x18 */
+    U16                     Reserved6;                      /* 0x14 */
+    U8                      Reserved7;                      /* 0x16 */
+    U8                      HostMSIxVectors;                /* 0x17 */
+    U16                     Reserved8;                      /* 0x18 */
     U16                     SystemRequestFrameSize;         /* 0x1A */
     U16                     ReplyDescriptorPostQueueDepth;  /* 0x1C */
     U16                     ReplyFreeQueueDepth;            /* 0x1E */
@@ -215,7 +228,7 @@ typedef struct _MPI2_IOC_FACTS_REPLY
     U8                      MaxChainDepth;                  /* 0x14 */
     U8                      WhoInit;                        /* 0x15 */
     U8                      NumberOfPorts;                  /* 0x16 */
-    U8                      Reserved2;                      /* 0x17 */
+    U8                      MaxMSIxVectors;                 /* 0x17 */
     U16                     RequestCredit;                  /* 0x18 */
     U16                     ProductID;                      /* 0x1A */
     U32                     IOCCapabilities;                /* 0x1C */
@@ -233,7 +246,8 @@ typedef struct _MPI2_IOC_FACTS_REPLY
     U8                      MaxVolumes;                     /* 0x37 */
     U16                     MaxDevHandle;                   /* 0x38 */
     U16                     MaxPersistentEntries;           /* 0x3A */
-    U32                     Reserved4;                      /* 0x3C */
+    U16                     MinDevHandle;                   /* 0x3C */
+    U16                     Reserved4;                      /* 0x3E */
 } MPI2_IOC_FACTS_REPLY, MPI2_POINTER PTR_MPI2_IOC_FACTS_REPLY,
   Mpi2IOCFactsReply_t, MPI2_POINTER pMpi2IOCFactsReply_t;
 
@@ -269,6 +283,7 @@ typedef struct _MPI2_IOC_FACTS_REPLY
 /* ProductID field uses MPI2_FW_HEADER_PID_ */
 
 /* IOCCapabilities */
+#define MPI2_IOCFACTS_CAPABILITY_HOST_BASED_DISCOVERY   (0x00010000)
 #define MPI2_IOCFACTS_CAPABILITY_MSI_X_INDEX            (0x00008000)
 #define MPI2_IOCFACTS_CAPABILITY_RAID_ACCELERATOR       (0x00004000)
 #define MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY           (0x00002000)
@@ -453,6 +468,7 @@ typedef struct _MPI2_EVENT_NOTIFICATION_REPLY
 #define MPI2_EVENT_LOG_ENTRY_ADDED                  (0x0021)
 #define MPI2_EVENT_SAS_PHY_COUNTER                  (0x0022)
 #define MPI2_EVENT_GPIO_INTERRUPT                   (0x0023)
+#define MPI2_EVENT_HOST_BASED_DISCOVERY_PHY         (0x0024)
 
 
 /* Log Entry Added Event data */
@@ -793,6 +809,7 @@ typedef struct _MPI2_EVENT_DATA_SAS_TOPOLOGY_CHANGE_LIST
   MPI2_POINTER pMpi2EventDataSasTopologyChangeList_t;
 
 /* values for the ExpStatus field */
+#define MPI2_EVENT_SAS_TOPO_ES_NO_EXPANDER                  (0x00)
 #define MPI2_EVENT_SAS_TOPO_ES_ADDED                        (0x01)
 #define MPI2_EVENT_SAS_TOPO_ES_NOT_RESPONDING               (0x02)
 #define MPI2_EVENT_SAS_TOPO_ES_RESPONDING                   (0x03)
@@ -878,6 +895,44 @@ typedef struct _MPI2_EVENT_DATA_SAS_PHY_COUNTER {
  * */
 
 
+/* Host Based Discovery Phy Event data */
+
+typedef struct _MPI2_EVENT_HBD_PHY_SAS {
+    U8          Flags;                      /* 0x00 */
+    U8          NegotiatedLinkRate;         /* 0x01 */
+    U8          PhyNum;                     /* 0x02 */
+    U8          PhysicalPort;               /* 0x03 */
+    U32         Reserved1;                  /* 0x04 */
+    U8          InitialFrame[28];           /* 0x08 */
+} MPI2_EVENT_HBD_PHY_SAS, MPI2_POINTER PTR_MPI2_EVENT_HBD_PHY_SAS,
+  Mpi2EventHbdPhySas_t, MPI2_POINTER pMpi2EventHbdPhySas_t;
+
+/* values for the Flags field */
+#define MPI2_EVENT_HBD_SAS_FLAGS_FRAME_VALID        (0x02)
+#define MPI2_EVENT_HBD_SAS_FLAGS_SATA_FRAME         (0x01)
+
+/* use MPI2_SAS_NEG_LINK_RATE_ defines from mpi2_cnfg.h for
+ * the NegotiatedLinkRate field */
+
+typedef union _MPI2_EVENT_HBD_DESCRIPTOR {
+    MPI2_EVENT_HBD_PHY_SAS      Sas;
+} MPI2_EVENT_HBD_DESCRIPTOR, MPI2_POINTER PTR_MPI2_EVENT_HBD_DESCRIPTOR,
+  Mpi2EventHbdDescriptor_t, MPI2_POINTER pMpi2EventHbdDescriptor_t;
+
+typedef struct _MPI2_EVENT_DATA_HBD_PHY {
+    U8                          DescriptorType;     /* 0x00 */
+    U8                          Reserved1;          /* 0x01 */
+    U16                         Reserved2;          /* 0x02 */
+    U32                         Reserved3;          /* 0x04 */
+    MPI2_EVENT_HBD_DESCRIPTOR   Descriptor;         /* 0x08 */
+} MPI2_EVENT_DATA_HBD_PHY, MPI2_POINTER PTR_MPI2_EVENT_DATA_HBD_PHY,
+  Mpi2EventDataHbdPhy_t, MPI2_POINTER pMpi2EventDataMpi2EventDataHbdPhy_t;
+
+/* values for the DescriptorType field */
+#define MPI2_EVENT_HBD_DT_SAS               (0x01)
+
+
+
 /****************************************************************************
 *  EventAck message
 ****************************************************************************/
@@ -1126,13 +1181,17 @@ typedef struct _MPI2_FW_IMAGE_HEADER
 #define MPI2_FW_HEADER_PID_TYPE_MASK            (0xF000)
 #define MPI2_FW_HEADER_PID_TYPE_SAS             (0x2000)
 
-#define MPI2_FW_HEADER_PID_PROD_MASK            (0x0F00)
-#define MPI2_FW_HEADER_PID_PROD_A               (0x0000)
+#define MPI2_FW_HEADER_PID_PROD_MASK                    (0x0F00)
+#define MPI2_FW_HEADER_PID_PROD_A                       (0x0000)
+#define MPI2_FW_HEADER_PID_PROD_MASK                    (0x0F00)
+#define MPI2_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI   (0x0200)
+#define MPI2_FW_HEADER_PID_PROD_IR_SCSI                 (0x0700)
+
 
 #define MPI2_FW_HEADER_PID_FAMILY_MASK          (0x00FF)
 /* SAS */
-#define MPI2_FW_HEADER_PID_FAMILY_2108_SAS      (0x0010)
-#define MPI2_FW_HEADER_PID_FAMILY_2208_SAS      (0x0011)
+#define MPI2_FW_HEADER_PID_FAMILY_2108_SAS      (0x0013)
+#define MPI2_FW_HEADER_PID_FAMILY_2208_SAS      (0x0014)
 
 /* use MPI2_IOCFACTS_PROTOCOL_ defines for ProtocolFlags field */
 
index 8a42b136cf5311c271a008e7c8f5389b9d5ca739..2d8aeed51392c566d2a1b4edfa14f847643662c0 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI Serial Attached SCSI structures and definitions
  *  Creation Date:  February 9, 2007
  *
- *  mpi2.h Version:  02.00.02
+ *  mpi2.h Version:  02.00.03
  *
  *  Version History
  *  ---------------
@@ -18,6 +18,8 @@
  *                      Control Request.
  *  10-02-08  02.00.02  Added Set IOC Parameter Operation to SAS IO Unit Control
  *                      Request.
+ *  10-28-09  02.00.03  Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST
+ *                      to MPI2_SGE_IO_UNION since it supports chained SGLs.
  *  --------------------------------------------------------------------------
  */
 
@@ -160,7 +162,7 @@ typedef struct _MPI2_SATA_PASSTHROUGH_REQUEST
     U32                     Reserved4;          /* 0x14 */
     U32                     DataLength;         /* 0x18 */
     U8                      CommandFIS[20];     /* 0x1C */
-    MPI2_SIMPLE_SGE_UNION   SGL;                /* 0x20 */
+    MPI2_SGE_IO_UNION       SGL;                /* 0x20 */
 } MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST,
   Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t;
 
index 89d02401b9eca54aa5c1de99eebdf73558e05bdc..88e6eebc31594a757ee8ebf925f62237591f6d80 100644 (file)
@@ -107,8 +107,7 @@ _scsih_set_fwfault_debug(const char *val, struct kernel_param *kp)
        if (ret)
                return ret;
 
-       printk(KERN_INFO "setting logging_level(0x%08x)\n",
-                               mpt2sas_fwfault_debug);
+       printk(KERN_INFO "setting fwfault_debug(%d)\n", mpt2sas_fwfault_debug);
        list_for_each_entry(ioc, &mpt2sas_ioc_list, list)
                ioc->fwfault_debug = mpt2sas_fwfault_debug;
        return 0;
@@ -1222,6 +1221,8 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
        u32 memap_sz;
        u32 pio_sz;
        int i, r = 0;
+       u64 pio_chip = 0;
+       u64 chip_phys = 0;
 
        dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n",
            ioc->name, __func__));
@@ -1255,12 +1256,13 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
                if (pci_resource_flags(pdev, i) & PCI_BASE_ADDRESS_SPACE_IO) {
                        if (pio_sz)
                                continue;
-                       ioc->pio_chip = pci_resource_start(pdev, i);
+                       pio_chip = (u64)pci_resource_start(pdev, i);
                        pio_sz = pci_resource_len(pdev, i);
                } else {
                        if (memap_sz)
                                continue;
                        ioc->chip_phys = pci_resource_start(pdev, i);
+                       chip_phys = (u64)ioc->chip_phys;
                        memap_sz = pci_resource_len(pdev, i);
                        ioc->chip = ioremap(ioc->chip_phys, memap_sz);
                        if (ioc->chip == NULL) {
@@ -1280,10 +1282,10 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
        printk(MPT2SAS_INFO_FMT "%s: IRQ %d\n",
            ioc->name,  ((ioc->msix_enable) ? "PCI-MSI-X enabled" :
            "IO-APIC enabled"), ioc->pci_irq);
-       printk(MPT2SAS_INFO_FMT "iomem(0x%lx), mapped(0x%p), size(%d)\n",
-           ioc->name, ioc->chip_phys, ioc->chip, memap_sz);
-       printk(MPT2SAS_INFO_FMT "ioport(0x%lx), size(%d)\n",
-           ioc->name, ioc->pio_chip, pio_sz);
+       printk(MPT2SAS_INFO_FMT "iomem(0x%016llx), mapped(0x%p), size(%d)\n",
+           ioc->name, (unsigned long long)chip_phys, ioc->chip, memap_sz);
+       printk(MPT2SAS_INFO_FMT "ioport(0x%016llx), size(%d)\n",
+           ioc->name, (unsigned long long)pio_chip, pio_sz);
 
        return 0;
 
@@ -3573,6 +3575,8 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 
        init_waitqueue_head(&ioc->reset_wq);
 
+       ioc->fwfault_debug = mpt2sas_fwfault_debug;
+
        /* base internal command bits */
        mutex_init(&ioc->base_cmds.mutex);
        ioc->base_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
index bb4f14656afa59b09ade8ab8e0a06b60aa5cc4d2..e18b0544c38f38603932d16b4c61be59352399f9 100644 (file)
 #define MPT2SAS_DRIVER_NAME            "mpt2sas"
 #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
 #define MPT2SAS_DESCRIPTION    "LSI MPT Fusion SAS 2.0 Device Driver"
-#define MPT2SAS_DRIVER_VERSION         "03.100.03.00"
-#define MPT2SAS_MAJOR_VERSION          03
+#define MPT2SAS_DRIVER_VERSION         "04.100.01.00"
+#define MPT2SAS_MAJOR_VERSION          04
 #define MPT2SAS_MINOR_VERSION          100
-#define MPT2SAS_BUILD_VERSION          03
+#define MPT2SAS_BUILD_VERSION          01
 #define MPT2SAS_RELEASE_VERSION                00
 
 /*
@@ -323,6 +323,7 @@ struct _sas_device {
  * @device_info: bitfield provides detailed info about the hidden components
  * @num_pds: number of hidden raid components
  * @responding: used in _scsih_raid_device_mark_responding
+ * @percent_complete: resync percent complete
  */
 struct _raid_device {
        struct list_head list;
@@ -336,6 +337,7 @@ struct _raid_device {
        u32     device_info;
        u8      num_pds;
        u8      responding;
+       u8      percent_complete;
 };
 
 /**
@@ -464,7 +466,6 @@ typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
  * @pdev: pci pdev object
  * @chip: memory mapped register space
  * @chip_phys: physical addrss prior to mapping
- * @pio_chip: I/O mapped register space
  * @logging_level: see mpt2sas_debug.h
  * @fwfault_debug: debuging FW timeouts
  * @ir_firmware: IR firmware present
@@ -587,8 +588,7 @@ struct MPT2SAS_ADAPTER {
        char            tmp_string[MPT_STRING_LENGTH];
        struct pci_dev  *pdev;
        Mpi2SystemInterfaceRegs_t __iomem *chip;
-       unsigned long   chip_phys;
-       unsigned long   pio_chip;
+       resource_size_t chip_phys;
        int             logging_level;
        int             fwfault_debug;
        u8              ir_firmware;
@@ -853,6 +853,8 @@ int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
     *mpi_reply, Mpi2IOUnitPage1_t *config_page);
 int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
     *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
+int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
+    Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
 int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
     *mpi_reply, Mpi2IOCPage8_t *config_page);
 int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
index 594a389c6526f265d9cc8b58d530702a3f1ba312..411c27d7f787f1bed4d85f7fd956d8f211709698 100644 (file)
@@ -324,7 +324,9 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
                if (r != 0)
                        goto out;
                if (mpi_request->Action ==
-                   MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT) {
+                   MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT ||
+                   mpi_request->Action ==
+                   MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM) {
                        ioc->base_add_sg_single(&mpi_request->PageBufferSGE,
                            MPT2_CONFIG_COMMON_WRITE_SGLFLAGS | mem.sz,
                            mem.page_dma);
@@ -882,7 +884,7 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
 }
 
 /**
- * mpt2sas_config_get_sas_iounit_pg1 - obtain sas iounit page 0
+ * mpt2sas_config_get_sas_iounit_pg1 - obtain sas iounit page 1
  * @ioc: per adapter object
  * @mpi_reply: reply mf payload returned from firmware
  * @config_page: contents of the config page
@@ -907,7 +909,7 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
        mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED;
        mpi_request.ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT;
        mpi_request.Header.PageNumber = 1;
-       mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE0_PAGEVERSION;
+       mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE1_PAGEVERSION;
        mpt2sas_base_build_zero_len_sge(ioc, &mpi_request.PageBufferSGE);
        r = _config_request(ioc, &mpi_request, mpi_reply,
            MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
@@ -921,6 +923,49 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
        return r;
 }
 
+/**
+ * mpt2sas_config_set_sas_iounit_pg1 - send sas iounit page 1
+ * @ioc: per adapter object
+ * @mpi_reply: reply mf payload returned from firmware
+ * @config_page: contents of the config page
+ * @sz: size of buffer passed in config_page
+ * Context: sleep.
+ *
+ * Calling function should call config_get_number_hba_phys prior to
+ * this function, so enough memory is allocated for config_page.
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+int
+mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
+    *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz)
+{
+       Mpi2ConfigRequest_t mpi_request;
+       int r;
+
+       memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
+       mpi_request.Function = MPI2_FUNCTION_CONFIG;
+       mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
+       mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED;
+       mpi_request.ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT;
+       mpi_request.Header.PageNumber = 1;
+       mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE1_PAGEVERSION;
+       mpt2sas_base_build_zero_len_sge(ioc, &mpi_request.PageBufferSGE);
+       r = _config_request(ioc, &mpi_request, mpi_reply,
+           MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
+       if (r)
+               goto out;
+
+       mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT;
+       _config_request(ioc, &mpi_request, mpi_reply,
+           MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page, sz);
+       mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM;
+       r = _config_request(ioc, &mpi_request, mpi_reply,
+           MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page, sz);
+ out:
+       return r;
+}
+
 /**
  * mpt2sas_config_get_expander_pg0 - obtain expander page 0
  * @ioc: per adapter object
index 84a124f8e21f040a0313cdd037c156233ebc00b0..fa9bf83819d50cc269f05db3f58f2ed10d86bda0 100644 (file)
@@ -891,6 +891,7 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
 
  issue_host_reset:
        if (issue_reset) {
+               ret = -ENODATA;
                if ((mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
                    mpi_request->Function ==
                    MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
@@ -2202,14 +2203,10 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg)
        karg.data_out_size = karg32.data_out_size;
        karg.max_sense_bytes = karg32.max_sense_bytes;
        karg.data_sge_offset = karg32.data_sge_offset;
-       memcpy(&karg.reply_frame_buf_ptr, &karg32.reply_frame_buf_ptr,
-           sizeof(uint32_t));
-       memcpy(&karg.data_in_buf_ptr, &karg32.data_in_buf_ptr,
-           sizeof(uint32_t));
-       memcpy(&karg.data_out_buf_ptr, &karg32.data_out_buf_ptr,
-           sizeof(uint32_t));
-       memcpy(&karg.sense_data_ptr, &karg32.sense_data_ptr,
-           sizeof(uint32_t));
+       karg.reply_frame_buf_ptr = compat_ptr(karg32.reply_frame_buf_ptr);
+       karg.data_in_buf_ptr = compat_ptr(karg32.data_in_buf_ptr);
+       karg.data_out_buf_ptr = compat_ptr(karg32.data_out_buf_ptr);
+       karg.sense_data_ptr = compat_ptr(karg32.sense_data_ptr);
        state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING;
        return _ctl_do_mpt_command(ioc, karg, &uarg->mf, state);
 }
index efabea1a3ce48647988fefe8986d892d24beee6e..c7ec3f17478220e5637750a52fc5621a38390443 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/raid_class.h>
 
 #include "mpt2sas_base.h"
 
@@ -133,6 +134,9 @@ struct fw_event_work {
        void                    *event_data;
 };
 
+/* raid transport support */
+static struct raid_template *mpt2sas_raid_template;
+
 /**
  * struct _scsi_io_transfer - scsi io transfer
  * @handle: sas device handle (assigned by firmware)
@@ -1305,7 +1309,6 @@ _scsih_slave_alloc(struct scsi_device *sdev)
        struct MPT2SAS_DEVICE *sas_device_priv_data;
        struct scsi_target *starget;
        struct _raid_device *raid_device;
-       struct _sas_device *sas_device;
        unsigned long flags;
 
        sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
@@ -1332,21 +1335,8 @@ _scsih_slave_alloc(struct scsi_device *sdev)
                if (raid_device)
                        raid_device->sdev = sdev; /* raid is single lun */
                spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
-       } else {
-               /* set TLR bit for SSP devices */
-               if (!(ioc->facts.IOCCapabilities &
-                    MPI2_IOCFACTS_CAPABILITY_TLR))
-                       goto out;
-               spin_lock_irqsave(&ioc->sas_device_lock, flags);
-               sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
-                  sas_device_priv_data->sas_target->sas_address);
-               spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
-               if (sas_device && sas_device->device_info &
-                   MPI2_SAS_DEVICE_INFO_SSP_TARGET)
-                       sas_device_priv_data->flags |= MPT_DEVICE_TLR_ON;
        }
 
- out:
        return 0;
 }
 
@@ -1418,6 +1408,140 @@ _scsih_display_sata_capabilities(struct MPT2SAS_ADAPTER *ioc,
            (flags & MPI2_SAS_DEVICE0_FLAGS_SATA_SW_PRESERVE) ? "y" : "n");
 }
 
+/**
+ * _scsih_is_raid - return boolean indicating device is raid volume
+ * @dev the device struct object
+ */
+static int
+_scsih_is_raid(struct device *dev)
+{
+       struct scsi_device *sdev = to_scsi_device(dev);
+
+       return (sdev->channel == RAID_CHANNEL) ? 1 : 0;
+}
+
+/**
+ * _scsih_get_resync - get raid volume resync percent complete
+ * @dev the device struct object
+ */
+static void
+_scsih_get_resync(struct device *dev)
+{
+       struct scsi_device *sdev = to_scsi_device(dev);
+       struct MPT2SAS_ADAPTER *ioc = shost_priv(sdev->host);
+       static struct _raid_device *raid_device;
+       unsigned long flags;
+       Mpi2RaidVolPage0_t vol_pg0;
+       Mpi2ConfigReply_t mpi_reply;
+       u32 volume_status_flags;
+       u8 percent_complete = 0;
+
+       spin_lock_irqsave(&ioc->raid_device_lock, flags);
+       raid_device = _scsih_raid_device_find_by_id(ioc, sdev->id,
+           sdev->channel);
+       spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
+
+       if (!raid_device)
+               goto out;
+
+       if (mpt2sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
+            MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle,
+            sizeof(Mpi2RaidVolPage0_t))) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               goto out;
+       }
+
+       volume_status_flags = le32_to_cpu(vol_pg0.VolumeStatusFlags);
+       if (volume_status_flags & MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS)
+               percent_complete = raid_device->percent_complete;
+ out:
+       raid_set_resync(mpt2sas_raid_template, dev, percent_complete);
+}
+
+/**
+ * _scsih_get_state - get raid volume level
+ * @dev the device struct object
+ */
+static void
+_scsih_get_state(struct device *dev)
+{
+       struct scsi_device *sdev = to_scsi_device(dev);
+       struct MPT2SAS_ADAPTER *ioc = shost_priv(sdev->host);
+       static struct _raid_device *raid_device;
+       unsigned long flags;
+       Mpi2RaidVolPage0_t vol_pg0;
+       Mpi2ConfigReply_t mpi_reply;
+       u32 volstate;
+       enum raid_state state = RAID_STATE_UNKNOWN;
+
+       spin_lock_irqsave(&ioc->raid_device_lock, flags);
+       raid_device = _scsih_raid_device_find_by_id(ioc, sdev->id,
+           sdev->channel);
+       spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
+
+       if (!raid_device)
+               goto out;
+
+       if (mpt2sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
+            MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle,
+            sizeof(Mpi2RaidVolPage0_t))) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               goto out;
+       }
+
+       volstate = le32_to_cpu(vol_pg0.VolumeStatusFlags);
+       if (volstate & MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) {
+               state = RAID_STATE_RESYNCING;
+               goto out;
+       }
+
+       switch (vol_pg0.VolumeState) {
+       case MPI2_RAID_VOL_STATE_OPTIMAL:
+       case MPI2_RAID_VOL_STATE_ONLINE:
+               state = RAID_STATE_ACTIVE;
+               break;
+       case  MPI2_RAID_VOL_STATE_DEGRADED:
+               state = RAID_STATE_DEGRADED;
+               break;
+       case MPI2_RAID_VOL_STATE_FAILED:
+       case MPI2_RAID_VOL_STATE_MISSING:
+               state = RAID_STATE_OFFLINE;
+               break;
+       }
+ out:
+       raid_set_state(mpt2sas_raid_template, dev, state);
+}
+
+/**
+ * _scsih_set_level - set raid level
+ * @sdev: scsi device struct
+ * @raid_device: raid_device object
+ */
+static void
+_scsih_set_level(struct scsi_device *sdev, struct _raid_device *raid_device)
+{
+       enum raid_level level = RAID_LEVEL_UNKNOWN;
+
+       switch (raid_device->volume_type) {
+       case MPI2_RAID_VOL_TYPE_RAID0:
+               level = RAID_LEVEL_0;
+               break;
+       case MPI2_RAID_VOL_TYPE_RAID10:
+               level = RAID_LEVEL_10;
+               break;
+       case MPI2_RAID_VOL_TYPE_RAID1E:
+               level = RAID_LEVEL_1E;
+               break;
+       case MPI2_RAID_VOL_TYPE_RAID1:
+               level = RAID_LEVEL_1;
+               break;
+       }
+
+       raid_set_level(mpt2sas_raid_template, &sdev->sdev_gendev, level);
+}
+
 /**
  * _scsih_get_volume_capabilities - volume capabilities
  * @ioc: per adapter object
@@ -1478,6 +1602,32 @@ _scsih_get_volume_capabilities(struct MPT2SAS_ADAPTER *ioc,
        kfree(vol_pg0);
 }
 
+/**
+ * _scsih_enable_tlr - setting TLR flags
+ * @ioc: per adapter object
+ * @sdev: scsi device struct
+ *
+ * Enabling Transaction Layer Retries for tape devices when
+ * vpd page 0x90 is present
+ *
+ */
+static void
+_scsih_enable_tlr(struct MPT2SAS_ADAPTER *ioc, struct scsi_device *sdev)
+{
+       /* only for TAPE */
+       if (sdev->type != TYPE_TAPE)
+               return;
+
+       if (!(ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR))
+               return;
+
+       sas_enable_tlr(sdev);
+       sdev_printk(KERN_INFO, sdev, "TLR %s\n",
+           sas_is_tlr_enabled(sdev) ? "Enabled" : "Disabled");
+       return;
+
+}
+
 /**
  * _scsih_slave_configure - device configure routine.
  * @sdev: scsi device struct
@@ -1574,6 +1724,8 @@ _scsih_slave_configure(struct scsi_device *sdev)
                    (unsigned long long)raid_device->wwid,
                    raid_device->num_pds, ds);
                _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
+               /* raid transport support */
+               _scsih_set_level(sdev, raid_device);
                return 0;
        }
 
@@ -1621,8 +1773,10 @@ _scsih_slave_configure(struct scsi_device *sdev)
 
        _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT);
 
-       if (ssp_target)
+       if (ssp_target) {
                sas_read_port_mode_page(sdev);
+               _scsih_enable_tlr(ioc, sdev);
+       }
        return 0;
 }
 
@@ -2908,8 +3062,9 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
 
        } else
                mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
-
-       if ((sas_device_priv_data->flags & MPT_DEVICE_TLR_ON))
+       /* Make sure Device is not raid volume */
+       if (!_scsih_is_raid(&scmd->device->sdev_gendev) &&
+           sas_is_tlr_enabled(scmd->device))
                mpi_control |= MPI2_SCSIIO_CONTROL_TLR_ON;
 
        smid = mpt2sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd);
@@ -3298,10 +3453,12 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
                    le32_to_cpu(mpi_reply->ResponseInfo) & 0xFF;
        if (!sas_device_priv_data->tlr_snoop_check) {
                sas_device_priv_data->tlr_snoop_check++;
-               if ((sas_device_priv_data->flags & MPT_DEVICE_TLR_ON) &&
-                   response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME)
-                       sas_device_priv_data->flags &=
-                           ~MPT_DEVICE_TLR_ON;
+       if (!_scsih_is_raid(&scmd->device->sdev_gendev) &&
+               sas_is_tlr_enabled(scmd->device) &&
+                   response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME) {
+                       sas_disable_tlr(scmd->device);
+                       sdev_printk(KERN_INFO, scmd->device, "TLR disabled\n");
+               }
        }
 
        xfer_cnt = le32_to_cpu(mpi_reply->TransferCount);
@@ -5170,11 +5327,33 @@ static void
 _scsih_sas_ir_operation_status_event(struct MPT2SAS_ADAPTER *ioc,
     struct fw_event_work *fw_event)
 {
+       Mpi2EventDataIrOperationStatus_t *event_data = fw_event->event_data;
+       static struct _raid_device *raid_device;
+       unsigned long flags;
+       u16 handle;
+
 #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
        if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
                _scsih_sas_ir_operation_status_event_debug(ioc,
-                    fw_event->event_data);
+                    event_data);
 #endif
+
+       /* code added for raid transport support */
+       if (event_data->RAIDOperation == MPI2_EVENT_IR_RAIDOP_RESYNC) {
+
+               handle = le16_to_cpu(event_data->VolDevHandle);
+
+               spin_lock_irqsave(&ioc->raid_device_lock, flags);
+               raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
+               spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
+
+               if (!raid_device)
+                       return;
+
+               if (event_data->RAIDOperation == MPI2_EVENT_IR_RAIDOP_RESYNC)
+                       raid_device->percent_complete =
+                           event_data->PercentComplete;
+       }
 }
 
 /**
@@ -5998,6 +6177,8 @@ _scsih_remove(struct pci_dev *pdev)
        struct _sas_port *mpt2sas_port;
        struct _sas_device *sas_device;
        struct _sas_node *expander_sibling;
+       struct _raid_device *raid_device, *next;
+       struct MPT2SAS_TARGET *sas_target_priv_data;
        struct workqueue_struct *wq;
        unsigned long flags;
 
@@ -6011,6 +6192,21 @@ _scsih_remove(struct pci_dev *pdev)
        if (wq)
                destroy_workqueue(wq);
 
+       /* release all the volumes */
+       list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list,
+           list) {
+               if (raid_device->starget) {
+                       sas_target_priv_data =
+                           raid_device->starget->hostdata;
+                       sas_target_priv_data->deleted = 1;
+                       scsi_remove_target(&raid_device->starget->dev);
+               }
+               printk(MPT2SAS_INFO_FMT "removing handle(0x%04x), wwid"
+                   "(0x%016llx)\n", ioc->name,  raid_device->handle,
+                   (unsigned long long) raid_device->wwid);
+               _scsih_raid_device_remove(ioc, raid_device);
+       }
+
        /* free ports attached to the sas_host */
  retry_again:
        list_for_each_entry(mpt2sas_port,
@@ -6373,6 +6569,13 @@ static struct pci_driver scsih_driver = {
 #endif
 };
 
+/* raid transport support */
+static struct raid_function_template mpt2sas_raid_functions = {
+       .cookie         = &scsih_driver_template,
+       .is_raid        = _scsih_is_raid,
+       .get_resync     = _scsih_get_resync,
+       .get_state      = _scsih_get_state,
+};
 
 /**
  * _scsih_init - main entry point for this driver.
@@ -6392,6 +6595,12 @@ _scsih_init(void)
            sas_attach_transport(&mpt2sas_transport_functions);
        if (!mpt2sas_transport_template)
                return -ENODEV;
+       /* raid transport support */
+       mpt2sas_raid_template = raid_class_attach(&mpt2sas_raid_functions);
+       if (!mpt2sas_raid_template) {
+               sas_release_transport(mpt2sas_transport_template);
+               return -ENODEV;
+       }
 
        mpt2sas_base_initialize_callback_handler();
 
@@ -6426,8 +6635,11 @@ _scsih_init(void)
        mpt2sas_ctl_init();
 
        error = pci_register_driver(&scsih_driver);
-       if (error)
+       if (error) {
+               /* raid transport support */
+               raid_class_release(mpt2sas_raid_template);
                sas_release_transport(mpt2sas_transport_template);
+       }
 
        return error;
 }
@@ -6445,7 +6657,8 @@ _scsih_exit(void)
 
        pci_unregister_driver(&scsih_driver);
 
-       sas_release_transport(mpt2sas_transport_template);
+       mpt2sas_ctl_exit();
+
        mpt2sas_base_release_callback_handler(scsi_io_cb_idx);
        mpt2sas_base_release_callback_handler(tm_cb_idx);
        mpt2sas_base_release_callback_handler(base_cb_idx);
@@ -6457,7 +6670,10 @@ _scsih_exit(void)
        mpt2sas_base_release_callback_handler(tm_tr_cb_idx);
        mpt2sas_base_release_callback_handler(tm_sas_control_cb_idx);
 
-       mpt2sas_ctl_exit();
+       /* raid transport support */
+       raid_class_release(mpt2sas_raid_template);
+       sas_release_transport(mpt2sas_transport_template);
+
 }
 
 module_init(_scsih_init);
index 3a82872bad441ae82474078567967613cb6f12ef..789f9ee7f00157fa10ec3f292725c9b1ee666d7c 100644 (file)
@@ -855,6 +855,17 @@ rphy_to_ioc(struct sas_rphy *rphy)
        return shost_priv(shost);
 }
 
+static struct _sas_phy *
+_transport_find_local_phy(struct MPT2SAS_ADAPTER *ioc, struct sas_phy *phy)
+{
+       int i;
+
+       for (i = 0; i < ioc->sas_hba.num_phys; i++)
+               if (ioc->sas_hba.phy[i].phy == phy)
+                       return(&ioc->sas_hba.phy[i]);
+       return NULL;
+}
+
 /**
  * _transport_get_linkerrors -
  * @phy: The sas phy object
@@ -870,14 +881,8 @@ _transport_get_linkerrors(struct sas_phy *phy)
        struct _sas_phy *mpt2sas_phy;
        Mpi2ConfigReply_t mpi_reply;
        Mpi2SasPhyPage1_t phy_pg1;
-       int i;
 
-       for (i = 0, mpt2sas_phy = NULL; i < ioc->sas_hba.num_phys &&
-           !mpt2sas_phy; i++) {
-               if (ioc->sas_hba.phy[i].phy != phy)
-                       continue;
-               mpt2sas_phy = &ioc->sas_hba.phy[i];
-       }
+       mpt2sas_phy = _transport_find_local_phy(ioc, phy);
 
        if (!mpt2sas_phy) /* this phy not on sas_host */
                return -EINVAL;
@@ -971,14 +976,8 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset)
        struct _sas_phy *mpt2sas_phy;
        Mpi2SasIoUnitControlReply_t mpi_reply;
        Mpi2SasIoUnitControlRequest_t mpi_request;
-       int i;
 
-       for (i = 0, mpt2sas_phy = NULL; i < ioc->sas_hba.num_phys &&
-           !mpt2sas_phy; i++) {
-               if (ioc->sas_hba.phy[i].phy != phy)
-                       continue;
-               mpt2sas_phy = &ioc->sas_hba.phy[i];
-       }
+       mpt2sas_phy = _transport_find_local_phy(ioc, phy);
 
        if (!mpt2sas_phy) /* this phy not on sas_host */
                return -EINVAL;
@@ -1005,6 +1004,173 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset)
        return 0;
 }
 
+/**
+ * _transport_phy_enable - enable/disable phys
+ * @phy: The sas phy object
+ * @enable: enable phy when true
+ *
+ * Only support sas_host direct attached phys.
+ * Returns 0 for success, non-zero for failure.
+ */
+static int
+_transport_phy_enable(struct sas_phy *phy, int enable)
+{
+       struct MPT2SAS_ADAPTER *ioc = phy_to_ioc(phy);
+       struct _sas_phy *mpt2sas_phy;
+       Mpi2SasIOUnitPage1_t *sas_iounit_pg1 = NULL;
+       Mpi2ConfigReply_t mpi_reply;
+       u16 ioc_status;
+       u16 sz;
+       int rc = 0;
+
+       mpt2sas_phy = _transport_find_local_phy(ioc, phy);
+
+       if (!mpt2sas_phy) /* this phy not on sas_host */
+               return -EINVAL;
+
+       /* sas_iounit page 1 */
+       sz = offsetof(Mpi2SasIOUnitPage1_t, PhyData) + (ioc->sas_hba.num_phys *
+           sizeof(Mpi2SasIOUnit1PhyData_t));
+       sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
+       if (!sas_iounit_pg1) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -ENOMEM;
+               goto out;
+       }
+       if ((mpt2sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
+           sas_iounit_pg1, sz))) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -ENXIO;
+               goto out;
+       }
+       ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+           MPI2_IOCSTATUS_MASK;
+       if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -EIO;
+               goto out;
+       }
+
+       if (enable)
+               sas_iounit_pg1->PhyData[mpt2sas_phy->phy_id].PhyFlags
+                   &= ~MPI2_SASIOUNIT1_PHYFLAGS_PHY_DISABLE;
+       else
+               sas_iounit_pg1->PhyData[mpt2sas_phy->phy_id].PhyFlags
+                   |= MPI2_SASIOUNIT1_PHYFLAGS_PHY_DISABLE;
+
+       mpt2sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1, sz);
+
+ out:
+       kfree(sas_iounit_pg1);
+       return rc;
+}
+
+/**
+ * _transport_phy_speed - set phy min/max link rates
+ * @phy: The sas phy object
+ * @rates: rates defined in sas_phy_linkrates
+ *
+ * Only support sas_host direct attached phys.
+ * Returns 0 for success, non-zero for failure.
+ */
+static int
+_transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates)
+{
+       struct MPT2SAS_ADAPTER *ioc = phy_to_ioc(phy);
+       struct _sas_phy *mpt2sas_phy;
+       Mpi2SasIOUnitPage1_t *sas_iounit_pg1 = NULL;
+       Mpi2SasPhyPage0_t phy_pg0;
+       Mpi2ConfigReply_t mpi_reply;
+       u16 ioc_status;
+       u16 sz;
+       int i;
+       int rc = 0;
+
+       mpt2sas_phy = _transport_find_local_phy(ioc, phy);
+
+       if (!mpt2sas_phy) /* this phy not on sas_host */
+               return -EINVAL;
+
+       if (!rates->minimum_linkrate)
+               rates->minimum_linkrate = phy->minimum_linkrate;
+       else if (rates->minimum_linkrate < phy->minimum_linkrate_hw)
+               rates->minimum_linkrate = phy->minimum_linkrate_hw;
+
+       if (!rates->maximum_linkrate)
+               rates->maximum_linkrate = phy->maximum_linkrate;
+       else if (rates->maximum_linkrate > phy->maximum_linkrate_hw)
+               rates->maximum_linkrate = phy->maximum_linkrate_hw;
+
+       /* sas_iounit page 1 */
+       sz = offsetof(Mpi2SasIOUnitPage1_t, PhyData) + (ioc->sas_hba.num_phys *
+           sizeof(Mpi2SasIOUnit1PhyData_t));
+       sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
+       if (!sas_iounit_pg1) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -ENOMEM;
+               goto out;
+       }
+       if ((mpt2sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
+           sas_iounit_pg1, sz))) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -ENXIO;
+               goto out;
+       }
+       ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+           MPI2_IOCSTATUS_MASK;
+       if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -EIO;
+               goto out;
+       }
+
+       for (i = 0; i < ioc->sas_hba.num_phys; i++) {
+               if (mpt2sas_phy->phy_id != i) {
+                       sas_iounit_pg1->PhyData[i].MaxMinLinkRate =
+                           (ioc->sas_hba.phy[i].phy->minimum_linkrate +
+                           (ioc->sas_hba.phy[i].phy->maximum_linkrate << 4));
+               } else {
+                       sas_iounit_pg1->PhyData[i].MaxMinLinkRate =
+                           (rates->minimum_linkrate +
+                           (rates->maximum_linkrate << 4));
+               }
+       }
+
+       if (mpt2sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,
+           sz)) {
+               printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               rc = -ENXIO;
+               goto out;
+       }
+
+       /* link reset */
+       _transport_phy_reset(phy, 0);
+
+       /* read phy page 0, then update the rates in the sas transport phy */
+       if (!mpt2sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0,
+           mpt2sas_phy->phy_id)) {
+               phy->minimum_linkrate = _transport_convert_phy_link_rate(
+                   phy_pg0.ProgrammedLinkRate & MPI2_SAS_PRATE_MIN_RATE_MASK);
+               phy->maximum_linkrate = _transport_convert_phy_link_rate(
+                   phy_pg0.ProgrammedLinkRate >> 4);
+               phy->negotiated_linkrate = _transport_convert_phy_link_rate(
+                   phy_pg0.NegotiatedLinkRate &
+                   MPI2_SAS_NEG_LINK_RATE_MASK_PHYSICAL);
+       }
+
+ out:
+       kfree(sas_iounit_pg1);
+       return rc;
+}
+
+
 /**
  * _transport_smp_handler - transport portal for smp passthru
  * @shost: shost object
@@ -1207,6 +1373,8 @@ struct sas_function_template mpt2sas_transport_functions = {
        .get_enclosure_identifier = _transport_get_enclosure_identifier,
        .get_bay_identifier     = _transport_get_bay_identifier,
        .phy_reset              = _transport_phy_reset,
+       .phy_enable             = _transport_phy_enable,
+       .set_phy_speed          = _transport_phy_speed,
        .smp_handler            = _transport_smp_handler,
 };
 
index c2f1032496cb6acac2bdd8dba7192e52c75970d2..f80c1da8f6ca340b187ae08fc3a09e3341fe99b7 100644 (file)
@@ -654,7 +654,7 @@ static int __devinit pm8001_pci_probe(struct pci_dev *pdev,
        }
        chip = &pm8001_chips[ent->driver_data];
        SHOST_TO_SAS_HA(shost) =
-               kcalloc(1, sizeof(struct sas_ha_struct), GFP_KERNEL);
+               kzalloc(sizeof(struct sas_ha_struct), GFP_KERNEL);
        if (!SHOST_TO_SAS_HA(shost)) {
                rc = -ENOMEM;
                goto err_out_free_host;
index 8371d917a9a2408242a2439c9c69f298cc012964..49ac4148493b9746a31cfdc50dcbe8a6d705f618 100644 (file)
@@ -1640,8 +1640,10 @@ qla1280_load_firmware_pio(struct scsi_qla_host *ha)
        uint16_t mb[MAILBOX_REGISTER_COUNT], i;
        int err;
 
+       spin_unlock_irq(ha->host->host_lock);
        err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname,
                               &ha->pdev->dev);
+       spin_lock_irq(ha->host->host_lock);
        if (err) {
                printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
                       ql1280_board_tbl[ha->devnum].fwname, err);
@@ -1699,8 +1701,10 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha)
                return -ENOMEM;
 #endif
 
+       spin_unlock_irq(ha->host->host_lock);
        err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname,
                               &ha->pdev->dev);
+       spin_lock_irq(ha->host->host_lock);
        if (err) {
                printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
                       ql1280_board_tbl[ha->devnum].fwname, err);
index 3a9f5b288aee40f6553b3dc2362efab9f0632c47..90d1e062ec4f13461bc428d41c17f4e03e007932 100644 (file)
@@ -11,7 +11,9 @@
 #include <linux/delay.h>
 
 static int qla24xx_vport_disable(struct fc_vport *, bool);
-
+static int qla84xx_reset(scsi_qla_host_t *, struct msg_echo_lb *, struct fc_bsg_job *);
+int qla84xx_reset_chip(scsi_qla_host_t *, uint16_t, uint16_t *);
+static int qla84xx_mgmt_cmd(scsi_qla_host_t *, struct msg_echo_lb *, struct fc_bsg_job *);
 /* SYSFS attributes --------------------------------------------------------- */
 
 static ssize_t
@@ -1167,6 +1169,28 @@ qla2x00_total_isp_aborts_show(struct device *dev,
            ha->qla_stats.total_isp_aborts);
 }
 
+static ssize_t
+qla24xx_84xx_fw_version_show(struct device *dev,
+       struct device_attribute *attr, char *buf)
+{
+       int rval = QLA_SUCCESS;
+       uint16_t status[2] = {0, 0};
+       scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
+       struct qla_hw_data *ha = vha->hw;
+
+       if (IS_QLA84XX(ha) && ha->cs84xx) {
+               if (ha->cs84xx->op_fw_version == 0) {
+                       rval = qla84xx_verify_chip(vha, status);
+       }
+
+       if ((rval == QLA_SUCCESS) && (status[0] == 0))
+               return snprintf(buf, PAGE_SIZE, "%u\n",
+                       (uint32_t)ha->cs84xx->op_fw_version);
+       }
+
+       return snprintf(buf, PAGE_SIZE, "\n");
+}
+
 static ssize_t
 qla2x00_mpi_version_show(struct device *dev, struct device_attribute *attr,
     char *buf)
@@ -1281,6 +1305,8 @@ static DEVICE_ATTR(optrom_fcode_version, S_IRUGO,
                   qla2x00_optrom_fcode_version_show, NULL);
 static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show,
                   NULL);
+static DEVICE_ATTR(84xx_fw_version, S_IRUGO, qla24xx_84xx_fw_version_show,
+                  NULL);
 static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show,
                   NULL);
 static DEVICE_ATTR(mpi_version, S_IRUGO, qla2x00_mpi_version_show, NULL);
@@ -1310,6 +1336,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
        &dev_attr_optrom_efi_version,
        &dev_attr_optrom_fcode_version,
        &dev_attr_optrom_fw_version,
+       &dev_attr_84xx_fw_version,
        &dev_attr_total_isp_aborts,
        &dev_attr_mpi_version,
        &dev_attr_phy_version,
@@ -1504,8 +1531,6 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
                fcport->vha->hw->isp_ops->fabric_logout(fcport->vha,
                        fcport->loop_id, fcport->d_id.b.domain,
                        fcport->d_id.b.area, fcport->d_id.b.al_pa);
-
-       qla2x00_abort_fcport_cmds(fcport);
 }
 
 static int
@@ -1795,6 +1820,581 @@ qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
        return 0;
 }
 
+/* BSG support for ELS/CT pass through */
+inline srb_t *
+qla2x00_get_ctx_bsg_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size)
+{
+       srb_t *sp;
+       struct qla_hw_data *ha = vha->hw;
+       struct srb_bsg_ctx *ctx;
+
+       sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL);
+       if (!sp)
+               goto done;
+       ctx = kzalloc(size, GFP_KERNEL);
+       if (!ctx) {
+               mempool_free(sp, ha->srb_mempool);
+               goto done;
+       }
+
+       memset(sp, 0, sizeof(*sp));
+       sp->fcport = fcport;
+       sp->ctx = ctx;
+done:
+       return sp;
+}
+
+static int
+qla2x00_process_els(struct fc_bsg_job *bsg_job)
+{
+       struct fc_rport *rport;
+       fc_port_t *fcport;
+       struct Scsi_Host *host;
+       scsi_qla_host_t *vha;
+       struct qla_hw_data *ha;
+       srb_t *sp;
+       const char *type;
+       int req_sg_cnt, rsp_sg_cnt;
+       int rval =  (DRIVER_ERROR << 16);
+       uint16_t nextlid = 0;
+       struct srb_bsg *els;
+
+       /*  Multiple SG's are not supported for ELS requests */
+        if (bsg_job->request_payload.sg_cnt > 1 ||
+               bsg_job->reply_payload.sg_cnt > 1) {
+               DEBUG2(printk(KERN_INFO
+                   "multiple SG's are not supported for ELS requests"
+                   " [request_sg_cnt: %x reply_sg_cnt: %x]\n",
+                   bsg_job->request_payload.sg_cnt,
+                   bsg_job->reply_payload.sg_cnt));
+               rval = -EPERM;
+               goto done;
+        }
+
+       /* ELS request for rport */
+       if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) {
+               rport = bsg_job->rport;
+               fcport = *(fc_port_t **) rport->dd_data;
+               host = rport_to_shost(rport);
+               vha = shost_priv(host);
+               ha = vha->hw;
+               type = "FC_BSG_RPT_ELS";
+
+               /* make sure the rport is logged in,
+                * if not perform fabric login
+                */
+               if (qla2x00_fabric_login(vha, fcport, &nextlid)) {
+                       DEBUG2(qla_printk(KERN_WARNING, ha,
+                           "failed to login port %06X for ELS passthru\n",
+                           fcport->d_id.b24));
+                       rval = -EIO;
+                       goto done;
+               }
+       } else {
+               host = bsg_job->shost;
+               vha = shost_priv(host);
+               ha = vha->hw;
+               type = "FC_BSG_HST_ELS_NOLOGIN";
+
+               /* Allocate a dummy fcport structure, since functions
+                * preparing the IOCB and mailbox command retrieves port
+                * specific information from fcport structure. For Host based
+                * ELS commands there will be no fcport structure allocated
+                */
+               fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
+               if (!fcport) {
+                       rval = -ENOMEM;
+                       goto done;
+               }
+
+               /* Initialize all required  fields of fcport */
+               fcport->vha = vha;
+               fcport->vp_idx = vha->vp_idx;
+               fcport->d_id.b.al_pa =
+                   bsg_job->request->rqst_data.h_els.port_id[0];
+               fcport->d_id.b.area =
+                   bsg_job->request->rqst_data.h_els.port_id[1];
+               fcport->d_id.b.domain =
+                   bsg_job->request->rqst_data.h_els.port_id[2];
+               fcport->loop_id =
+                   (fcport->d_id.b.al_pa == 0xFD) ?
+                   NPH_FABRIC_CONTROLLER : NPH_F_PORT;
+       }
+
+       if (!vha->flags.online) {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                   "host not online\n"));
+               rval = -EIO;
+               goto done;
+       }
+
+        req_sg_cnt =
+           dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+        if (!req_sg_cnt) {
+               rval = -ENOMEM;
+               goto done_free_fcport;
+       }
+        rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
+           bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+        if (!rsp_sg_cnt) {
+               rval = -ENOMEM;
+                goto done_free_fcport;
+       }
+
+       if ((req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
+           (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt))
+       {
+               DEBUG2(printk(KERN_INFO
+                   "dma mapping resulted in different sg counts \
+                   [request_sg_cnt: %x dma_request_sg_cnt: %x\
+                   reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
+                   bsg_job->request_payload.sg_cnt, req_sg_cnt,
+                   bsg_job->reply_payload.sg_cnt, rsp_sg_cnt));
+               rval = -EAGAIN;
+                goto done_unmap_sg;
+       }
+
+       /* Alloc SRB structure */
+       sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_bsg));
+       if (!sp) {
+               rval = -ENOMEM;
+                goto done_unmap_sg;
+       }
+
+       els = sp->ctx;
+       els->ctx.type =
+           (bsg_job->request->msgcode == FC_BSG_RPT_ELS ?
+           SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST);
+       els->bsg_job = bsg_job;
+
+       DEBUG2(qla_printk(KERN_INFO, ha,
+           "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x "
+           "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type,
+           bsg_job->request->rqst_data.h_els.command_code,
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa));
+
+       rval = qla2x00_start_sp(sp);
+       if (rval != QLA_SUCCESS) {
+               kfree(sp->ctx);
+               mempool_free(sp, ha->srb_mempool);
+               rval = -EIO;
+               goto done_unmap_sg;
+       }
+       return rval;
+
+done_unmap_sg:
+       dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
+               bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
+               bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+       goto done_free_fcport;
+
+done_free_fcport:
+       if (bsg_job->request->msgcode == FC_BSG_HST_ELS_NOLOGIN)
+               kfree(fcport);
+done:
+       return rval;
+}
+
+static int
+qla2x00_process_ct(struct fc_bsg_job *bsg_job)
+{
+       srb_t *sp;
+       struct Scsi_Host *host = bsg_job->shost;
+       scsi_qla_host_t *vha = shost_priv(host);
+       struct qla_hw_data *ha = vha->hw;
+       int rval = (DRIVER_ERROR << 16);
+       int req_sg_cnt, rsp_sg_cnt;
+       uint16_t loop_id;
+       struct fc_port *fcport;
+       char  *type = "FC_BSG_HST_CT";
+       struct srb_bsg *ct;
+
+       /* pass through is supported only for ISP 4Gb or higher */
+        if (!IS_FWI2_CAPABLE(ha)) {
+               DEBUG2(qla_printk(KERN_INFO, ha,
+                   "scsi(%ld):Firmware is not capable to support FC "
+                   "CT pass thru\n", vha->host_no));
+               rval = -EPERM;
+                goto done;
+       }
+
+        req_sg_cnt =
+           dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+        if (!req_sg_cnt) {
+               rval = -ENOMEM;
+               goto done;
+       }
+
+        rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
+            bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+        if (!rsp_sg_cnt) {
+               rval = -ENOMEM;
+                goto done;
+       }
+
+       if ((req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
+               (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt))
+       {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                   "dma mapping resulted in different sg counts \
+                   [request_sg_cnt: %x dma_request_sg_cnt: %x\
+                   reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
+                   bsg_job->request_payload.sg_cnt, req_sg_cnt,
+                   bsg_job->reply_payload.sg_cnt, rsp_sg_cnt));
+               rval = -EAGAIN;
+                goto done_unmap_sg;
+       }
+
+       if (!vha->flags.online) {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                   "host not online\n"));
+               rval = -EIO;
+                goto done_unmap_sg;
+       }
+
+       loop_id =
+           (bsg_job->request->rqst_data.h_ct.preamble_word1 & 0xFF000000)
+           >> 24;
+       switch (loop_id) {
+               case 0xFC:
+                       loop_id = cpu_to_le16(NPH_SNS);
+                       break;
+               case 0xFA:
+                       loop_id = vha->mgmt_svr_loop_id;
+                       break;
+               default:
+                       DEBUG2(qla_printk(KERN_INFO, ha,
+                           "Unknown loop id: %x\n", loop_id));
+                       rval = -EINVAL;
+                       goto done_unmap_sg;
+       }
+
+       /* Allocate a dummy fcport structure, since functions preparing the
+        * IOCB and mailbox command retrieves port specific information
+        * from fcport structure. For Host based ELS commands there will be
+        * no fcport structure allocated
+        */
+       fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
+       if (!fcport)
+       {
+               rval = -ENOMEM;
+               goto  done_unmap_sg;
+       }
+
+       /* Initialize all required  fields of fcport */
+       fcport->vha = vha;
+       fcport->vp_idx = vha->vp_idx;
+       fcport->d_id.b.al_pa = bsg_job->request->rqst_data.h_ct.port_id[0];
+       fcport->d_id.b.area = bsg_job->request->rqst_data.h_ct.port_id[1];
+       fcport->d_id.b.domain = bsg_job->request->rqst_data.h_ct.port_id[2];
+       fcport->loop_id = loop_id;
+
+       /* Alloc SRB structure */
+       sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_bsg));
+       if (!sp) {
+               rval = -ENOMEM;
+               goto done_free_fcport;
+       }
+
+       ct = sp->ctx;
+       ct->ctx.type = SRB_CT_CMD;
+       ct->bsg_job = bsg_job;
+
+       DEBUG2(qla_printk(KERN_INFO, ha,
+           "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x "
+           "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type,
+           (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16),
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa));
+
+       rval = qla2x00_start_sp(sp);
+       if (rval != QLA_SUCCESS) {
+               kfree(sp->ctx);
+               mempool_free(sp, ha->srb_mempool);
+               rval = -EIO;
+               goto done_free_fcport;
+       }
+       return rval;
+
+done_free_fcport:
+       kfree(fcport);
+done_unmap_sg:
+       dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
+           bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+done:
+       return rval;
+}
+
+static int
+qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
+{
+       struct Scsi_Host *host = bsg_job->shost;
+       scsi_qla_host_t *vha = shost_priv(host);
+       struct qla_hw_data *ha = vha->hw;
+       int rval;
+       uint8_t command_sent;
+       uint32_t vendor_cmd;
+       char *type;
+       struct msg_echo_lb elreq;
+       uint16_t response[MAILBOX_REGISTER_COUNT];
+       uint8_t* fw_sts_ptr;
+       uint8_t *req_data;
+       dma_addr_t req_data_dma;
+       uint32_t req_data_len;
+       uint8_t *rsp_data;
+       dma_addr_t rsp_data_dma;
+       uint32_t rsp_data_len;
+
+       if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
+           test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
+           test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
+               rval = -EBUSY;
+               goto done;
+       }
+
+       if (!vha->flags.online) {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                   "host not online\n"));
+               rval = -EIO;
+                goto done;
+       }
+
+        elreq.req_sg_cnt =
+           dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+        if (!elreq.req_sg_cnt) {
+               rval = -ENOMEM;
+               goto done;
+       }
+        elreq.rsp_sg_cnt =
+           dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
+           bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+        if (!elreq.rsp_sg_cnt) {
+               rval = -ENOMEM;
+                goto done;
+       }
+
+       if ((elreq.req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
+           (elreq.rsp_sg_cnt != bsg_job->reply_payload.sg_cnt))
+       {
+               DEBUG2(printk(KERN_INFO
+                   "dma mapping resulted in different sg counts \
+                   [request_sg_cnt: %x dma_request_sg_cnt: %x\
+                   reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
+                   bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt,
+                   bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt));
+               rval = -EAGAIN;
+                goto done_unmap_sg;
+       }
+       req_data_len = rsp_data_len = bsg_job->request_payload.payload_len;
+       req_data = dma_alloc_coherent(&ha->pdev->dev, req_data_len,
+           &req_data_dma, GFP_KERNEL);
+
+       rsp_data = dma_alloc_coherent(&ha->pdev->dev, rsp_data_len,
+           &rsp_data_dma, GFP_KERNEL);
+
+       /* Copy the request buffer in req_data now */
+       sg_copy_to_buffer(bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, req_data,
+           req_data_len);
+
+       elreq.send_dma = req_data_dma;
+       elreq.rcv_dma = rsp_data_dma;
+       elreq.transfer_size = req_data_len;
+
+       /* Vendor cmd : loopback or ECHO diagnostic
+        * Options:
+        *      Loopback : Either internal or external loopback
+        *      ECHO: ECHO ELS or Vendor specific FC4  link data
+        */
+       vendor_cmd = bsg_job->request->rqst_data.h_vendor.vendor_cmd[0];
+       elreq.options =
+           *(((uint32_t *)bsg_job->request->rqst_data.h_vendor.vendor_cmd)
+           + 1);
+
+       switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
+       case QL_VND_LOOPBACK:
+               if (ha->current_topology != ISP_CFG_F) {
+                       type = "FC_BSG_HST_VENDOR_LOOPBACK";
+
+                       DEBUG2(qla_printk(KERN_INFO, ha,
+                               "scsi(%ld) bsg rqst type: %s vendor rqst type: %x options: %x.\n",
+                               vha->host_no, type, vendor_cmd, elreq.options));
+
+                       command_sent = INT_DEF_LB_LOOPBACK_CMD;
+                       rval = qla2x00_loopback_test(vha, &elreq, response);
+                       if (IS_QLA81XX(ha)) {
+                               if (response[0] == MBS_COMMAND_ERROR && response[1] == MBS_LB_RESET) {
+                                       DEBUG2(printk(KERN_ERR "%s(%ld): ABORTing "
+                                               "ISP\n", __func__, vha->host_no));
+                                       set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
+                                       qla2xxx_wake_dpc(vha);
+                                }
+                       }
+               } else {
+                       type = "FC_BSG_HST_VENDOR_ECHO_DIAG";
+                       DEBUG2(qla_printk(KERN_INFO, ha,
+                               "scsi(%ld) bsg rqst type: %s vendor rqst type: %x options: %x.\n",
+                               vha->host_no, type, vendor_cmd, elreq.options));
+
+                       command_sent = INT_DEF_LB_ECHO_CMD;
+                       rval = qla2x00_echo_test(vha, &elreq, response);
+               }
+               break;
+       case QLA84_RESET:
+               if (!IS_QLA84XX(vha->hw)) {
+                       rval = -EINVAL;
+                       DEBUG16(printk(
+                               "%s(%ld): 8xxx exiting.\n",
+                               __func__, vha->host_no));
+                       return rval;
+               }
+               rval = qla84xx_reset(vha, &elreq, bsg_job);
+               break;
+       case QLA84_MGMT_CMD:
+               if (!IS_QLA84XX(vha->hw)) {
+                       rval = -EINVAL;
+                       DEBUG16(printk(
+                               "%s(%ld): 8xxx exiting.\n",
+                               __func__, vha->host_no));
+                       return rval;
+               }
+               rval = qla84xx_mgmt_cmd(vha, &elreq, bsg_job);
+               break;
+       default:
+               rval = -ENOSYS;
+       }
+
+       if (rval != QLA_SUCCESS) {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                       "scsi(%ld) Vendor request %s failed\n", vha->host_no, type));
+               rval = 0;
+               bsg_job->reply->result = (DID_ERROR << 16);
+               bsg_job->reply->reply_payload_rcv_len = 0;
+               fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
+               memcpy( fw_sts_ptr, response, sizeof(response));
+               fw_sts_ptr += sizeof(response);
+                *fw_sts_ptr = command_sent;
+       } else {
+               DEBUG2(qla_printk(KERN_WARNING, ha,
+                       "scsi(%ld) Vendor request %s completed\n", vha->host_no, type));
+               rval = bsg_job->reply->result = 0;
+               bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(response) + sizeof(uint8_t);
+               bsg_job->reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len;
+               fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
+               memcpy(fw_sts_ptr, response, sizeof(response));
+               fw_sts_ptr += sizeof(response);
+               *fw_sts_ptr = command_sent;
+               sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+               bsg_job->reply_payload.sg_cnt, rsp_data,
+               rsp_data_len);
+       }
+       bsg_job->job_done(bsg_job);
+
+done_unmap_sg:
+
+       if(req_data)
+               dma_free_coherent(&ha->pdev->dev, req_data_len,
+                       req_data, req_data_dma);
+       dma_unmap_sg(&ha->pdev->dev,
+           bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       dma_unmap_sg(&ha->pdev->dev,
+           bsg_job->reply_payload.sg_list,
+           bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+
+done:
+        return rval;
+}
+
+static int
+qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
+{
+        int ret = -EINVAL;
+
+        switch (bsg_job->request->msgcode) {
+               case FC_BSG_RPT_ELS:
+               case FC_BSG_HST_ELS_NOLOGIN:
+                       ret = qla2x00_process_els(bsg_job);
+                       break;
+               case FC_BSG_HST_CT:
+                       ret = qla2x00_process_ct(bsg_job);
+                       break;
+               case FC_BSG_HST_VENDOR:
+                       ret = qla2x00_process_vendor_specific(bsg_job);
+                       break;
+               case FC_BSG_HST_ADD_RPORT:
+               case FC_BSG_HST_DEL_RPORT:
+               case FC_BSG_RPT_CT:
+               default:
+                       DEBUG2(printk("qla2xxx: unsupported BSG request\n"));
+                       break;
+        }
+       return ret;
+}
+
+static int
+qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
+{
+        scsi_qla_host_t *vha = shost_priv(bsg_job->shost);
+        struct qla_hw_data *ha = vha->hw;
+        srb_t *sp;
+        int cnt, que;
+        unsigned long flags;
+        struct req_que *req;
+       struct srb_bsg *sp_bsg;
+
+       /* find the bsg job from the active list of commands */
+        spin_lock_irqsave(&ha->hardware_lock, flags);
+       for (que = 0; que < ha->max_req_queues; que++) {
+               req = ha->req_q_map[que];
+               if (!req)
+                       continue;
+
+               for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++ ) {
+                       sp = req->outstanding_cmds[cnt];
+
+                       if (sp) {
+                               sp_bsg = (struct srb_bsg*)sp->ctx;
+
+                               if (((sp_bsg->ctx.type == SRB_CT_CMD) ||
+                                   (sp_bsg->ctx.type == SRB_ELS_CMD_RPT)
+                                   || ( sp_bsg->ctx.type == SRB_ELS_CMD_HST)) &&
+                                   (sp_bsg->bsg_job == bsg_job)) {
+                                       if (ha->isp_ops->abort_command(sp)) {
+                                               DEBUG2(qla_printk(KERN_INFO, ha,
+                                               "scsi(%ld): mbx abort_command failed\n", vha->host_no));
+                                               bsg_job->req->errors = bsg_job->reply->result = -EIO;
+                                       } else {
+                                               DEBUG2(qla_printk(KERN_INFO, ha,
+                                               "scsi(%ld): mbx abort_command success\n", vha->host_no));
+                                               bsg_job->req->errors = bsg_job->reply->result = 0;
+                                       }
+                                       goto done;
+                               }
+                       }
+               }
+       }
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
+       DEBUG2(qla_printk(KERN_INFO, ha,
+               "scsi(%ld) SRB not found to abort\n", vha->host_no));
+       bsg_job->req->errors = bsg_job->reply->result = -ENXIO;
+       return 0;
+
+done:
+       if (bsg_job->request->msgcode == FC_BSG_HST_CT)
+               kfree(sp->fcport);
+       kfree(sp->ctx);
+       mempool_free(sp, ha->srb_mempool);
+       return 0;
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
        .show_host_node_name = 1,
@@ -1838,6 +2438,8 @@ struct fc_function_template qla2xxx_transport_functions = {
        .vport_create = qla24xx_vport_create,
        .vport_disable = qla24xx_vport_disable,
        .vport_delete = qla24xx_vport_delete,
+       .bsg_request = qla24xx_bsg_request,
+       .bsg_timeout = qla24xx_bsg_timeout,
 };
 
 struct fc_function_template qla2xxx_transport_vport_functions = {
@@ -1878,6 +2480,8 @@ struct fc_function_template qla2xxx_transport_vport_functions = {
        .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk,
        .terminate_rport_io = qla2x00_terminate_rport_io,
        .get_fc_host_stats = qla2x00_get_fc_host_stats,
+       .bsg_request = qla24xx_bsg_request,
+       .bsg_timeout = qla24xx_bsg_timeout,
 };
 
 void
@@ -1906,3 +2510,125 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
                speed = FC_PORTSPEED_1GBIT;
        fc_host_supported_speeds(vha->host) = speed;
 }
+static int
+qla84xx_reset(scsi_qla_host_t *ha, struct msg_echo_lb *mreq, struct fc_bsg_job *bsg_job)
+{
+       int             ret = 0;
+       int             cmd;
+       uint16_t        cmd_status;
+
+       DEBUG16(printk("%s(%ld): entered.\n", __func__, ha->host_no));
+
+       cmd = (*((bsg_job->request->rqst_data.h_vendor.vendor_cmd) + 2))
+                       == A84_RESET_FLAG_ENABLE_DIAG_FW ?
+                               A84_ISSUE_RESET_DIAG_FW : A84_ISSUE_RESET_OP_FW;
+       ret = qla84xx_reset_chip(ha, cmd == A84_ISSUE_RESET_DIAG_FW,
+       &cmd_status);
+       return ret;
+}
+
+static int
+qla84xx_mgmt_cmd(scsi_qla_host_t *ha, struct msg_echo_lb *mreq, struct fc_bsg_job *bsg_job)
+{
+       struct access_chip_84xx *mn;
+       dma_addr_t mn_dma, mgmt_dma;
+       void *mgmt_b = NULL;
+       int ret = 0;
+       int rsp_hdr_len, len = 0;
+       struct qla84_msg_mgmt *ql84_mgmt;
+
+       ql84_mgmt = (struct qla84_msg_mgmt *) vmalloc(sizeof(struct qla84_msg_mgmt));
+       ql84_mgmt->cmd =
+               *((uint16_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 2));
+       ql84_mgmt->mgmtp.u.mem.start_addr =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 3));
+       ql84_mgmt->len =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 4));
+       ql84_mgmt->mgmtp.u.config.id =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 5));
+       ql84_mgmt->mgmtp.u.config.param0 =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 6));
+       ql84_mgmt->mgmtp.u.config.param1 =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 7));
+       ql84_mgmt->mgmtp.u.info.type =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 8));
+       ql84_mgmt->mgmtp.u.info.context =
+               *((uint32_t *)(bsg_job->request->rqst_data.h_vendor.vendor_cmd + 9));
+
+       rsp_hdr_len = bsg_job->request_payload.payload_len;
+
+       mn = dma_pool_alloc(ha->hw->s_dma_pool, GFP_KERNEL, &mn_dma);
+       if (mn == NULL) {
+               DEBUG2(printk(KERN_ERR "%s: dma alloc for fw buffer "
+               "failed%lu\n", __func__, ha->host_no));
+               return -ENOMEM;
+       }
+
+       memset(mn, 0, sizeof (struct access_chip_84xx));
+
+       mn->entry_type = ACCESS_CHIP_IOCB_TYPE;
+       mn->entry_count = 1;
+
+       switch (ql84_mgmt->cmd) {
+       case QLA84_MGMT_READ_MEM:
+               mn->options = cpu_to_le16(ACO_DUMP_MEMORY);
+               mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmtp.u.mem.start_addr);
+               break;
+       case QLA84_MGMT_WRITE_MEM:
+               mn->options = cpu_to_le16(ACO_LOAD_MEMORY);
+               mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmtp.u.mem.start_addr);
+               break;
+       case QLA84_MGMT_CHNG_CONFIG:
+               mn->options = cpu_to_le16(ACO_CHANGE_CONFIG_PARAM);
+               mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmtp.u.config.id);
+               mn->parameter2 = cpu_to_le32(ql84_mgmt->mgmtp.u.config.param0);
+               mn->parameter3 = cpu_to_le32(ql84_mgmt->mgmtp.u.config.param1);
+               break;
+       case QLA84_MGMT_GET_INFO:
+               mn->options = cpu_to_le16(ACO_REQUEST_INFO);
+               mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmtp.u.info.type);
+               mn->parameter2 = cpu_to_le32(ql84_mgmt->mgmtp.u.info.context);
+               break;
+       default:
+               ret = -EIO;
+               goto exit_mgmt0;
+       }
+
+       if ((len == ql84_mgmt->len) &&
+               ql84_mgmt->cmd != QLA84_MGMT_CHNG_CONFIG) {
+               mgmt_b = dma_alloc_coherent(&ha->hw->pdev->dev, len,
+                               &mgmt_dma, GFP_KERNEL);
+               if (mgmt_b == NULL) {
+                       DEBUG2(printk(KERN_ERR "%s: dma alloc mgmt_b "
+                       "failed%lu\n", __func__, ha->host_no));
+                       ret = -ENOMEM;
+                       goto exit_mgmt0;
+               }
+               mn->total_byte_cnt = cpu_to_le32(ql84_mgmt->len);
+               mn->dseg_count = cpu_to_le16(1);
+               mn->dseg_address[0] = cpu_to_le32(LSD(mgmt_dma));
+               mn->dseg_address[1] = cpu_to_le32(MSD(mgmt_dma));
+               mn->dseg_length = cpu_to_le32(len);
+
+               if (ql84_mgmt->cmd == QLA84_MGMT_WRITE_MEM) {
+                       memcpy(mgmt_b, ql84_mgmt->payload, len);
+               }
+       }
+
+       ret = qla2x00_issue_iocb(ha, mn, mn_dma, 0);
+       if ((ret != QLA_SUCCESS) || (ql84_mgmt->cmd == QLA84_MGMT_WRITE_MEM)
+               || (ql84_mgmt->cmd == QLA84_MGMT_CHNG_CONFIG)) {
+                       if (ret != QLA_SUCCESS)
+                               DEBUG2(printk(KERN_ERR "%s(%lu): failed\n",
+                                       __func__, ha->host_no));
+       } else if ((ql84_mgmt->cmd == QLA84_MGMT_READ_MEM) ||
+                       (ql84_mgmt->cmd == QLA84_MGMT_GET_INFO)) {
+       }
+
+       if (mgmt_b)
+               dma_free_coherent(&ha->hw->pdev->dev, len, mgmt_b, mgmt_dma);
+
+exit_mgmt0:
+       dma_pool_free(ha->hw->s_dma_pool, mn, mn_dma);
+       return ret;
+}
index 608e675f68c8569b79ccfc2fb79a2965824de347..afa95614aaf8cec3a29ffc6977c273a152cb2d86 100644 (file)
@@ -31,6 +31,7 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_transport_fc.h>
+#include <scsi/scsi_bsg_fc.h>
 
 #define QLA2XXX_DRIVER_NAME  "qla2xxx"
 
@@ -228,6 +229,27 @@ struct srb_logio {
        uint16_t flags;
 };
 
+struct srb_bsg_ctx {
+#define SRB_ELS_CMD_RPT 3
+#define SRB_ELS_CMD_HST 4
+#define SRB_CT_CMD 5
+       uint16_t type;
+};
+
+struct srb_bsg {
+       struct srb_bsg_ctx ctx;
+       struct fc_bsg_job *bsg_job;
+};
+
+struct msg_echo_lb {
+       dma_addr_t send_dma;
+       dma_addr_t rcv_dma;
+       uint16_t req_sg_cnt;
+       uint16_t rsp_sg_cnt;
+       uint16_t options;
+       uint32_t transfer_size;
+};
+
 /*
  * ISP I/O Register Set structure definitions.
  */
@@ -522,6 +544,8 @@ typedef struct {
 #define MBA_DISCARD_RND_FRAME  0x8048  /* discard RND frame due to error. */
 #define MBA_REJECTED_FCP_CMD   0x8049  /* rejected FCP_CMD. */
 
+/* ISP mailbox loopback echo diagnostic error code */
+#define MBS_LB_RESET   0x17
 /*
  * Firmware options 1, 2, 3.
  */
@@ -1586,8 +1610,7 @@ typedef struct fc_port {
  */
 #define FCF_FABRIC_DEVICE      BIT_0
 #define FCF_LOGIN_NEEDED       BIT_1
-#define FCF_TAPE_PRESENT       BIT_2
-#define FCF_FCP2_DEVICE                BIT_3
+#define FCF_FCP2_DEVICE                BIT_2
 
 /* No loop ID flag. */
 #define FC_NO_LOOP_ID          0x1000
@@ -2231,6 +2254,13 @@ struct req_que {
        int max_q_depth;
 };
 
+/* Place holder for FW buffer parameters */
+struct qlfc_fw {
+       void *fw_buf;
+       dma_addr_t fw_dma;
+       uint32_t len;
+};
+
 /*
  * Qlogic host adapter specific data structure.
 */
@@ -2595,6 +2625,7 @@ struct qla_hw_data {
        struct qla_statistics qla_stats;
        struct isp_operations *isp_ops;
        struct workqueue_struct *wq;
+       struct qlfc_fw fw_buf;
 };
 
 /*
@@ -2767,4 +2798,127 @@ typedef struct scsi_qla_host {
 
 #define CMD_SP(Cmnd)           ((Cmnd)->SCp.ptr)
 
+/*
+ * BSG Vendor specific commands
+ */
+
+#define QL_VND_LOOPBACK                0x01
+#define QLA84_RESET            0x02
+#define QLA84_UPDATE_FW                0x03
+#define QLA84_MGMT_CMD         0x04
+
+/* BSG definations for interpreting CommandSent field */
+#define INT_DEF_LB_LOOPBACK_CMD         0
+#define INT_DEF_LB_ECHO_CMD             1
+
+/* BSG Vendor specific definations */
+typedef struct _A84_RESET {
+       uint16_t Flags;
+       uint16_t Reserved;
+#define A84_RESET_FLAG_ENABLE_DIAG_FW   1
+} __attribute__((packed)) A84_RESET, *PA84_RESET;
+
+#define A84_ISSUE_WRITE_TYPE_CMD        0
+#define A84_ISSUE_READ_TYPE_CMD         1
+#define A84_CLEANUP_CMD                 2
+#define A84_ISSUE_RESET_OP_FW           3
+#define A84_ISSUE_RESET_DIAG_FW         4
+#define A84_ISSUE_UPDATE_OPFW_CMD       5
+#define A84_ISSUE_UPDATE_DIAGFW_CMD     6
+
+struct qla84_mgmt_param {
+       union {
+               struct {
+                       uint32_t start_addr;
+               } mem; /* for QLA84_MGMT_READ/WRITE_MEM */
+               struct {
+                       uint32_t id;
+#define QLA84_MGMT_CONFIG_ID_UIF        1
+#define QLA84_MGMT_CONFIG_ID_FCOE_COS   2
+#define QLA84_MGMT_CONFIG_ID_PAUSE      3
+#define QLA84_MGMT_CONFIG_ID_TIMEOUTS   4
+
+               uint32_t param0;
+               uint32_t param1;
+       } config; /* for QLA84_MGMT_CHNG_CONFIG */
+
+       struct {
+               uint32_t type;
+#define QLA84_MGMT_INFO_CONFIG_LOG_DATA         1 /* Get Config Log Data */
+#define QLA84_MGMT_INFO_LOG_DATA                2 /* Get Log Data */
+#define QLA84_MGMT_INFO_PORT_STAT               3 /* Get Port Statistics */
+#define QLA84_MGMT_INFO_LIF_STAT                4 /* Get LIF Statistics  */
+#define QLA84_MGMT_INFO_ASIC_STAT               5 /* Get ASIC Statistics */
+#define QLA84_MGMT_INFO_CONFIG_PARAMS           6 /* Get Config Parameters */
+#define QLA84_MGMT_INFO_PANIC_LOG               7 /* Get Panic Log */
+
+               uint32_t context;
+/*
+* context definitions for QLA84_MGMT_INFO_CONFIG_LOG_DATA
+*/
+#define IC_LOG_DATA_LOG_ID_DEBUG_LOG                    0
+#define IC_LOG_DATA_LOG_ID_LEARN_LOG                    1
+#define IC_LOG_DATA_LOG_ID_FC_ACL_INGRESS_LOG           2
+#define IC_LOG_DATA_LOG_ID_FC_ACL_EGRESS_LOG            3
+#define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_INGRESS_LOG     4
+#define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_EGRESS_LOG      5
+#define IC_LOG_DATA_LOG_ID_MESSAGE_TRANSMIT_LOG         6
+#define IC_LOG_DATA_LOG_ID_MESSAGE_RECEIVE_LOG          7
+#define IC_LOG_DATA_LOG_ID_LINK_EVENT_LOG               8
+#define IC_LOG_DATA_LOG_ID_DCX_LOG                      9
+
+/*
+* context definitions for QLA84_MGMT_INFO_PORT_STAT
+*/
+#define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT0   0
+#define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT1   1
+#define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT0        2
+#define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT1        3
+#define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT0         4
+#define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT1         5
+
+
+/*
+* context definitions for QLA84_MGMT_INFO_LIF_STAT
+*/
+#define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT0     0
+#define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT1     1
+#define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT0           2
+#define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT1           3
+#define IC_LIF_STATISTICS_LIF_NUMBER_CPU                6
+
+               } info; /* for QLA84_MGMT_GET_INFO */
+       } u;
+};
+
+struct qla84_msg_mgmt {
+       uint16_t cmd;
+#define QLA84_MGMT_READ_MEM     0x00
+#define QLA84_MGMT_WRITE_MEM    0x01
+#define QLA84_MGMT_CHNG_CONFIG  0x02
+#define QLA84_MGMT_GET_INFO     0x03
+       uint16_t rsrvd;
+       struct qla84_mgmt_param mgmtp;/* parameters for cmd */
+       uint32_t len; /* bytes in payload following this struct */
+       uint8_t payload[0]; /* payload for cmd */
+};
+
+struct msg_update_fw {
+       /*
+       * diag_fw = 0  operational fw
+       *      otherwise diagnostic fw
+       * offset, len, fw_len are present to overcome the current limitation
+       * of 128Kb xfer size. The fw is sent in smaller chunks. Each chunk
+       * specifies the byte "offset" where it fits in the fw buffer. The
+       * number of bytes in each chunk is specified in "len". "fw_len"
+       * is the total size of fw. The first chunk should start at offset = 0.
+       * When offset+len == fw_len, the fw is written to the HBA.
+       */
+       uint32_t diag_fw;
+       uint32_t offset;/* start offset */
+       uint32_t len;   /* num bytes in cur xfer */
+       uint32_t fw_len; /* size of fw in bytes */
+       uint8_t fw_bytes[0];
+};
+
 #endif
index 66a8da5d7d082b950f853d86449e9be26be9d211..cebf4f1bb7d9686248a8abb6f787e75c2658ac00 100644 (file)
@@ -627,6 +627,39 @@ struct els_entry_24xx {
        uint32_t rx_len;                /* Data segment 1 length. */
 };
 
+struct els_sts_entry_24xx {
+       uint8_t entry_type;             /* Entry type. */
+       uint8_t entry_count;            /* Entry count. */
+       uint8_t sys_define;             /* System Defined. */
+       uint8_t entry_status;           /* Entry Status. */
+
+       uint32_t handle;                /* System handle. */
+
+       uint16_t comp_status;
+
+       uint16_t nport_handle;          /* N_PORT handle. */
+
+       uint16_t reserved_1;
+
+       uint8_t vp_index;
+       uint8_t sof_type;
+
+       uint32_t rx_xchg_address;       /* Receive exchange address. */
+       uint16_t reserved_2;
+
+       uint8_t opcode;
+       uint8_t reserved_3;
+
+       uint8_t port_id[3];
+       uint8_t reserved_4;
+
+       uint16_t reserved_5;
+
+       uint16_t control_flags;         /* Control flags. */
+       uint32_t total_byte_count;
+       uint32_t error_subcode_1;
+       uint32_t error_subcode_2;
+};
 /*
  * ISP queue - Mailbox Command entry structure definition.
  */
index f61fb8d01330948f1f8328523cf5eb9de7944dae..3a89bc514e2b7e17536a1b94ddb1e5944923c80c 100644 (file)
@@ -60,6 +60,8 @@ extern int qla2x00_async_login_done(struct scsi_qla_host *, fc_port_t *,
 extern int qla2x00_async_logout_done(struct scsi_qla_host *, fc_port_t *,
     uint16_t *);
 
+extern fc_port_t *
+qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t );
 /*
  * Global Data in qla_os.c source file.
  */
@@ -76,6 +78,7 @@ extern int ql2xiidmaenable;
 extern int ql2xmaxqueues;
 extern int ql2xmultique_tag;
 extern int ql2xfwloadbin;
+extern int ql2xetsenable;
 
 extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
@@ -94,7 +97,6 @@ extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
 
 extern int qla81xx_restart_mpi_firmware(scsi_qla_host_t *);
 
-extern void qla2x00_abort_fcport_cmds(fc_port_t *);
 extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *,
        struct qla_hw_data *);
 extern void qla2x00_free_host(struct scsi_qla_host *);
@@ -154,6 +156,7 @@ int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
 int __qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
                                                uint16_t, uint16_t, uint8_t);
 extern int qla2x00_start_sp(srb_t *);
+extern void qla2x00_ctx_sp_free(srb_t *);
 
 /*
  * Global Function Prototypes in qla_mbx.c source file.
@@ -426,6 +429,8 @@ extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
 extern void qla2x00_init_host_attr(scsi_qla_host_t *);
 extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
 extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
+extern int qla2x00_loopback_test(scsi_qla_host_t *, struct msg_echo_lb *, uint16_t *);
+extern int qla2x00_echo_test(scsi_qla_host_t *, struct msg_echo_lb *, uint16_t *);
 
 /*
  * Global Function Prototypes in qla_dfs.c source file.
@@ -453,6 +458,5 @@ extern void qla24xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
 extern void qla25xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
 extern void qla25xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
 extern void qla24xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
-extern struct scsi_qla_host * qla25xx_get_host(struct rsp_que *);
 
 #endif /* _QLA_GBL_H */
index b4a0eac8f96d845f34043da8e9eb7e65cd5e2b98..a67b2bafb88242201a047da0e47dc8880d9a6312 100644 (file)
@@ -62,7 +62,7 @@ qla2x00_ctx_sp_timeout(unsigned long __data)
        ctx->free(sp);
 }
 
-static void
+void
 qla2x00_ctx_sp_free(srb_t *sp)
 {
        struct srb_ctx *ctx = sp->ctx;
@@ -205,7 +205,7 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport,
 
        switch (data[0]) {
        case MBS_COMMAND_COMPLETE:
-               if (fcport->flags & FCF_TAPE_PRESENT)
+               if (fcport->flags & FCF_FCP2_DEVICE)
                        opts |= BIT_1;
                rval = qla2x00_get_port_database(vha, fcport, opts);
                if (rval != QLA_SUCCESS)
@@ -338,6 +338,16 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
        rval = qla2x00_init_rings(vha);
        ha->flags.chip_reset_done = 1;
 
+       if (rval == QLA_SUCCESS && IS_QLA84XX(ha)) {
+       /* Issue verify 84xx FW IOCB to complete 84xx initialization */
+               rval = qla84xx_init_chip(vha);
+               if (rval != QLA_SUCCESS) {
+                       qla_printk(KERN_ERR, ha,
+                               "Unable to initialize ISP84XX.\n");
+               qla84xx_put_chip(vha);
+               }
+       }
+
        return (rval);
 }
 
@@ -2216,7 +2226,7 @@ qla2x00_rport_del(void *data)
  *
  * Returns a pointer to the allocated fcport, or NULL, if none available.
  */
-static fc_port_t *
+fc_port_t *
 qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
 {
        fc_port_t *fcport;
@@ -2726,7 +2736,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
 
                /*
                 * Logout all previous fabric devices marked lost, except
-                * tape devices.
+                * FCP2 devices.
                 */
                list_for_each_entry(fcport, &vha->vp_fcports, list) {
                        if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
@@ -2739,7 +2749,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
                                qla2x00_mark_device_lost(vha, fcport,
                                    ql2xplogiabsentdevice, 0);
                                if (fcport->loop_id != FC_NO_LOOP_ID &&
-                                   (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
+                                   (fcport->flags & FCF_FCP2_DEVICE) == 0 &&
                                    fcport->port_type != FCT_INITIATOR &&
                                    fcport->port_type != FCT_BROADCAST) {
                                        ha->isp_ops->fabric_logout(vha,
@@ -2900,8 +2910,13 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
                if (qla2x00_is_reserved_id(vha, loop_id))
                        continue;
 
-               if (atomic_read(&vha->loop_down_timer) || LOOP_TRANSITION(vha))
+               if (atomic_read(&vha->loop_down_timer) ||
+                   LOOP_TRANSITION(vha)) {
+                       atomic_set(&vha->loop_down_timer, 0);
+                       set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
+                       set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
                        break;
+               }
 
                if (swl != NULL) {
                        if (last_dev) {
@@ -3018,7 +3033,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
                        fcport->d_id.b24 = new_fcport->d_id.b24;
                        fcport->flags |= FCF_LOGIN_NEEDED;
                        if (fcport->loop_id != FC_NO_LOOP_ID &&
-                           (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
+                           (fcport->flags & FCF_FCP2_DEVICE) == 0 &&
                            fcport->port_type != FCT_INITIATOR &&
                            fcport->port_type != FCT_BROADCAST) {
                                ha->isp_ops->fabric_logout(vha, fcport->loop_id,
@@ -3272,9 +3287,9 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *vha, fc_port_t *fcport,
 
        rval = qla2x00_fabric_login(vha, fcport, next_loopid);
        if (rval == QLA_SUCCESS) {
-               /* Send an ADISC to tape devices.*/
+               /* Send an ADISC to FCP2 devices.*/
                opts = 0;
-               if (fcport->flags & FCF_TAPE_PRESENT)
+               if (fcport->flags & FCF_FCP2_DEVICE)
                        opts |= BIT_1;
                rval = qla2x00_get_port_database(vha, fcport, opts);
                if (rval != QLA_SUCCESS) {
@@ -4877,6 +4892,15 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
 }
 
 void
-qla81xx_update_fw_options(scsi_qla_host_t *ha)
+qla81xx_update_fw_options(scsi_qla_host_t *vha)
 {
+       struct qla_hw_data *ha = vha->hw;
+
+       if (!ql2xetsenable)
+               return;
+
+       /* Enable ETS Burst. */
+       memset(ha->fw_options, 0, sizeof(ha->fw_options));
+       ha->fw_options[2] |= BIT_9;
+       qla2x00_set_fw_options(vha, ha->fw_options);
 }
index c5ccac0bef7698db6a2947b03f9ff37d6508fc0b..8299a9891bfef9b8d03f7350d3e11ef2d31aa562 100644 (file)
@@ -1025,6 +1025,119 @@ qla2x00_logout_iocb(srb_t *sp, struct mbx_entry *mbx)
        /* Implicit: mbx->mbx10 = 0. */
 }
 
+static void
+qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
+{
+       struct fc_bsg_job *bsg_job = ((struct srb_bsg*)sp->ctx)->bsg_job;
+
+        els_iocb->entry_type = ELS_IOCB_TYPE;
+        els_iocb->entry_count = 1;
+        els_iocb->sys_define = 0;
+        els_iocb->entry_status = 0;
+        els_iocb->handle = sp->handle;
+        els_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+        els_iocb->tx_dsd_count = __constant_cpu_to_le16(bsg_job->request_payload.sg_cnt);
+        els_iocb->vp_index = sp->fcport->vp_idx;
+        els_iocb->sof_type = EST_SOFI3;
+        els_iocb->rx_dsd_count = __constant_cpu_to_le16(bsg_job->reply_payload.sg_cnt);
+
+        els_iocb->opcode =(((struct srb_bsg*)sp->ctx)->ctx.type == SRB_ELS_CMD_RPT) ?
+           bsg_job->request->rqst_data.r_els.els_code : bsg_job->request->rqst_data.h_els.command_code;
+        els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
+        els_iocb->port_id[1] = sp->fcport->d_id.b.area;
+        els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
+        els_iocb->control_flags = 0;
+        els_iocb->rx_byte_count =
+            cpu_to_le32(bsg_job->reply_payload.payload_len);
+        els_iocb->tx_byte_count =
+            cpu_to_le32(bsg_job->request_payload.payload_len);
+
+        els_iocb->tx_address[0] = cpu_to_le32(LSD(sg_dma_address
+            (bsg_job->request_payload.sg_list)));
+        els_iocb->tx_address[1] = cpu_to_le32(MSD(sg_dma_address
+            (bsg_job->request_payload.sg_list)));
+        els_iocb->tx_len = cpu_to_le32(sg_dma_len
+            (bsg_job->request_payload.sg_list));
+
+        els_iocb->rx_address[0] = cpu_to_le32(LSD(sg_dma_address
+            (bsg_job->reply_payload.sg_list)));
+        els_iocb->rx_address[1] = cpu_to_le32(MSD(sg_dma_address
+            (bsg_job->reply_payload.sg_list)));
+        els_iocb->rx_len = cpu_to_le32(sg_dma_len
+            (bsg_job->reply_payload.sg_list));
+}
+
+static void
+qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb)
+{
+       uint16_t        avail_dsds;
+       uint32_t        *cur_dsd;
+       struct scatterlist *sg;
+       int index;
+       uint16_t tot_dsds;
+        scsi_qla_host_t *vha = sp->fcport->vha;
+       struct fc_bsg_job *bsg_job = ((struct srb_bsg*)sp->ctx)->bsg_job;
+       int loop_iterartion = 0;
+       int cont_iocb_prsnt = 0;
+       int entry_count = 1;
+
+       ct_iocb->entry_type = CT_IOCB_TYPE;
+        ct_iocb->entry_status = 0;
+        ct_iocb->sys_define = 0;
+        ct_iocb->handle = sp->handle;
+
+       ct_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+       ct_iocb->vp_index = sp->fcport->vp_idx;
+        ct_iocb->comp_status = __constant_cpu_to_le16(0);
+
+       ct_iocb->cmd_dsd_count =
+            __constant_cpu_to_le16(bsg_job->request_payload.sg_cnt);
+        ct_iocb->timeout = 0;
+        ct_iocb->rsp_dsd_count =
+            __constant_cpu_to_le16(bsg_job->reply_payload.sg_cnt);
+        ct_iocb->rsp_byte_count =
+            cpu_to_le32(bsg_job->reply_payload.payload_len);
+        ct_iocb->cmd_byte_count =
+            cpu_to_le32(bsg_job->request_payload.payload_len);
+        ct_iocb->dseg_0_address[0] = cpu_to_le32(LSD(sg_dma_address
+            (bsg_job->request_payload.sg_list)));
+        ct_iocb->dseg_0_address[1] = cpu_to_le32(MSD(sg_dma_address
+           (bsg_job->request_payload.sg_list)));
+        ct_iocb->dseg_0_len = cpu_to_le32(sg_dma_len
+            (bsg_job->request_payload.sg_list));
+
+       avail_dsds = 1;
+       cur_dsd = (uint32_t *)ct_iocb->dseg_1_address;
+       index = 0;
+       tot_dsds = bsg_job->reply_payload.sg_cnt;
+
+       for_each_sg(bsg_job->reply_payload.sg_list, sg, tot_dsds, index) {
+               dma_addr_t       sle_dma;
+               cont_a64_entry_t *cont_pkt;
+
+               /* Allocate additional continuation packets? */
+               if (avail_dsds == 0) {
+                       /*
+                       * Five DSDs are available in the Cont.
+                       * Type 1 IOCB.
+                              */
+                       cont_pkt = qla2x00_prep_cont_type1_iocb(vha);
+                       cur_dsd = (uint32_t *) cont_pkt->dseg_0_address;
+                       avail_dsds = 5;
+                       cont_iocb_prsnt = 1;
+                       entry_count++;
+               }
+
+               sle_dma = sg_dma_address(sg);
+               *cur_dsd++   = cpu_to_le32(LSD(sle_dma));
+               *cur_dsd++   = cpu_to_le32(MSD(sle_dma));
+               *cur_dsd++   = cpu_to_le32(sg_dma_len(sg));
+               loop_iterartion++;
+               avail_dsds--;
+       }
+        ct_iocb->entry_count = entry_count;
+}
+
 int
 qla2x00_start_sp(srb_t *sp)
 {
@@ -1052,6 +1165,13 @@ qla2x00_start_sp(srb_t *sp)
                    qla24xx_logout_iocb(sp, pkt):
                    qla2x00_logout_iocb(sp, pkt);
                break;
+       case SRB_ELS_CMD_RPT:
+       case SRB_ELS_CMD_HST:
+               qla24xx_els_iocb(sp, pkt);
+               break;
+       case SRB_CT_CMD:
+               qla24xx_ct_iocb(sp, pkt);
+               break;
        default:
                break;
        }
index ffd0efdff40e5f04504e2d148349e0909172364f..ab90329ff2e4877ce57ccd15e1a7ee28ab5acd9f 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/delay.h>
 #include <scsi/scsi_tcq.h>
+#include <scsi/scsi_bsg_fc.h>
 
 static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
 static void qla2x00_process_completed_request(struct scsi_qla_host *,
@@ -881,7 +882,9 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
                    index);
                return NULL;
        }
+
        req->outstanding_cmds[index] = NULL;
+
 done:
        return sp;
 }
@@ -981,6 +984,100 @@ done_post_logio_done_work:
        lio->ctx.free(sp);
 }
 
+static void
+qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
+    struct sts_entry_24xx *pkt, int iocb_type)
+{
+       const char func[] = "ELS_CT_IOCB";
+       const char *type;
+       struct qla_hw_data *ha = vha->hw;
+       srb_t *sp;
+       struct srb_bsg *sp_bsg;
+       struct fc_bsg_job *bsg_job;
+       uint16_t comp_status;
+       uint32_t fw_status[3];
+       uint8_t* fw_sts_ptr;
+
+       sp = qla2x00_get_sp_from_handle(vha, func, req, pkt);
+       if (!sp)
+               return;
+       sp_bsg = (struct srb_bsg*)sp->ctx;
+       bsg_job = sp_bsg->bsg_job;
+
+       type = NULL;
+       switch (sp_bsg->ctx.type) {
+       case SRB_ELS_CMD_RPT:
+       case SRB_ELS_CMD_HST:
+               type = "els";
+               break;
+       case SRB_CT_CMD:
+               type = "ct pass-through";
+               break;
+       default:
+               qla_printk(KERN_WARNING, ha,
+                   "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp,
+                   sp_bsg->ctx.type);
+               return;
+       }
+
+       comp_status = fw_status[0] = le16_to_cpu(pkt->comp_status);
+       fw_status[1] = le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_1);
+       fw_status[2] = le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_2);
+
+       /* return FC_CTELS_STATUS_OK and leave the decoding of the ELS/CT
+        * fc payload  to the caller
+        */
+       bsg_job->reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
+       bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(fw_status);
+
+       if (comp_status != CS_COMPLETE) {
+               if (comp_status == CS_DATA_UNDERRUN) {
+                       bsg_job->reply->result = DID_OK << 16;
+                       bsg_job->reply->reply_payload_rcv_len =
+                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->total_byte_count);
+
+                       DEBUG2(qla_printk(KERN_WARNING, ha,
+                           "scsi(%ld:0x%x): ELS-CT pass-through-%s error comp_status-status=0x%x "
+                           "error subcode 1=0x%x error subcode 2=0x%x total_byte = 0x%x.\n",
+                               vha->host_no, sp->handle, type, comp_status, fw_status[1], fw_status[2],
+                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->total_byte_count)));
+                       fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
+                       memcpy( fw_sts_ptr, fw_status, sizeof(fw_status));
+               }
+               else {
+                       DEBUG2(qla_printk(KERN_WARNING, ha,
+                           "scsi(%ld:0x%x): ELS-CT pass-through-%s error comp_status-status=0x%x "
+                           "error subcode 1=0x%x error subcode 2=0x%x.\n",
+                               vha->host_no, sp->handle, type, comp_status,
+                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_1),
+                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_2)));
+                       bsg_job->reply->result = DID_ERROR << 16;
+                       bsg_job->reply->reply_payload_rcv_len = 0;
+                       fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
+                       memcpy( fw_sts_ptr, fw_status, sizeof(fw_status));
+               }
+               DEBUG2(qla2x00_dump_buffer((uint8_t *)pkt, sizeof(*pkt)));
+       }
+       else {
+               bsg_job->reply->result =  DID_OK << 16;;
+               bsg_job->reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len;
+               bsg_job->reply_len = 0;
+       }
+
+       dma_unmap_sg(&ha->pdev->dev,
+           bsg_job->request_payload.sg_list,
+           bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
+       dma_unmap_sg(&ha->pdev->dev,
+           bsg_job->reply_payload.sg_list,
+           bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
+       if ((sp_bsg->ctx.type == SRB_ELS_CMD_HST) ||
+           (sp_bsg->ctx.type == SRB_CT_CMD))
+               kfree(sp->fcport);
+       kfree(sp->ctx);
+       mempool_free(sp, ha->srb_mempool);
+       bsg_job->job_done(bsg_job);
+}
+
 static void
 qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
     struct logio_entry_24xx *logio)
@@ -1749,6 +1846,13 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
                        qla24xx_logio_entry(vha, rsp->req,
                            (struct logio_entry_24xx *)pkt);
                        break;
+                case CT_IOCB_TYPE:
+                       qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
+                       clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags);
+                       break;
+                case ELS_IOCB_TYPE:
+                       qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE);
+                       break;
                default:
                        /* Type Not Supported. */
                        DEBUG4(printk(KERN_WARNING
@@ -1917,6 +2021,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
        struct rsp_que *rsp;
        struct device_reg_24xx __iomem *reg;
        struct scsi_qla_host *vha;
+       unsigned long flags;
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
@@ -1927,15 +2032,15 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
        ha = rsp->hw;
        reg = &ha->iobase->isp24;
 
-       spin_lock_irq(&ha->hardware_lock);
+       spin_lock_irqsave(&ha->hardware_lock, flags);
 
-       vha = qla25xx_get_host(rsp);
+       vha = pci_get_drvdata(ha->pdev);
        qla24xx_process_response_queue(vha, rsp);
        if (!ha->flags.disable_msix_handshake) {
                WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
                RD_REG_DWORD_RELAXED(&reg->hccr);
        }
-       spin_unlock_irq(&ha->hardware_lock);
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        return IRQ_HANDLED;
 }
@@ -1946,6 +2051,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
        struct qla_hw_data *ha;
        struct rsp_que *rsp;
        struct device_reg_24xx __iomem *reg;
+       unsigned long flags;
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
@@ -1958,10 +2064,10 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
        /* Clear the interrupt, if enabled, for this response queue */
        if (rsp->options & ~BIT_6) {
                reg = &ha->iobase->isp24;
-               spin_lock_irq(&ha->hardware_lock);
+               spin_lock_irqsave(&ha->hardware_lock, flags);
                WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
                RD_REG_DWORD_RELAXED(&reg->hccr);
-               spin_unlock_irq(&ha->hardware_lock);
+               spin_unlock_irqrestore(&ha->hardware_lock, flags);
        }
        queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);
 
@@ -1979,6 +2085,7 @@ qla24xx_msix_default(int irq, void *dev_id)
        uint32_t        stat;
        uint32_t        hccr;
        uint16_t        mb[4];
+       unsigned long flags;
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
@@ -1990,7 +2097,7 @@ qla24xx_msix_default(int irq, void *dev_id)
        reg = &ha->iobase->isp24;
        status = 0;
 
-       spin_lock_irq(&ha->hardware_lock);
+       spin_lock_irqsave(&ha->hardware_lock, flags);
        vha = pci_get_drvdata(ha->pdev);
        do {
                stat = RD_REG_DWORD(&reg->host_status);
@@ -2039,14 +2146,13 @@ qla24xx_msix_default(int irq, void *dev_id)
                }
                WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
        } while (0);
-       spin_unlock_irq(&ha->hardware_lock);
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
            (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
                set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
                complete(&ha->mbx_intr_comp);
        }
-
        return IRQ_HANDLED;
 }
 
@@ -2252,10 +2358,11 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
 
        if (ha->flags.msix_enabled)
                qla24xx_disable_msix(ha);
-       else if (ha->flags.inta_enabled) {
+       else if (ha->flags.msi_enabled) {
                free_irq(ha->pdev->irq, rsp);
                pci_disable_msi(ha->pdev);
-       }
+       } else
+               free_irq(ha->pdev->irq, rsp);
 }
 
 
@@ -2277,30 +2384,3 @@ int qla25xx_request_irq(struct rsp_que *rsp)
        msix->rsp = rsp;
        return ret;
 }
-
-struct scsi_qla_host *
-qla25xx_get_host(struct rsp_que *rsp)
-{
-       srb_t *sp;
-       struct qla_hw_data *ha = rsp->hw;
-       struct scsi_qla_host *vha = NULL;
-       struct sts_entry_24xx *pkt;
-       struct req_que *req;
-       uint16_t que;
-       uint32_t handle;
-
-       pkt = (struct sts_entry_24xx *) rsp->ring_ptr;
-       que = MSW(pkt->handle);
-       handle = (uint32_t) LSW(pkt->handle);
-       req = ha->req_q_map[que];
-       if (handle < MAX_OUTSTANDING_COMMANDS) {
-               sp = req->outstanding_cmds[handle];
-               if (sp)
-                       return  sp->fcport->vha;
-               else
-                       goto base_que;
-       }
-base_que:
-       vha = pci_get_drvdata(ha->pdev);
-       return vha;
-}
index 056e4d4505f369852788409a8b56ba913086d546..6e53bdbb1da8ffe3a3fb240a9867efd08fbf3efd 100644 (file)
@@ -3635,6 +3635,157 @@ qla2x00_read_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t *data)
        return rval;
 }
 
+int
+qla2x00_loopback_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq, uint16_t *mresp)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+       uint32_t iter_cnt = 0x1;
+
+       DEBUG11(printk("scsi(%ld): entered.\n", vha->host_no));
+
+       memset(mcp->mb, 0 , sizeof(mcp->mb));
+       mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK;
+       mcp->mb[1] = mreq->options | BIT_6;     // BIT_6 specifies 64 bit addressing
+
+       /* transfer count */
+       mcp->mb[10] = LSW(mreq->transfer_size);
+       mcp->mb[11] = MSW(mreq->transfer_size);
+
+       /* send data address */
+       mcp->mb[14] = LSW(mreq->send_dma);
+       mcp->mb[15] = MSW(mreq->send_dma);
+       mcp->mb[20] = LSW(MSD(mreq->send_dma));
+       mcp->mb[21] = MSW(MSD(mreq->send_dma));
+
+       /* recieve data address */
+       mcp->mb[16] = LSW(mreq->rcv_dma);
+       mcp->mb[17] = MSW(mreq->rcv_dma);
+       mcp->mb[6] = LSW(MSD(mreq->rcv_dma));
+       mcp->mb[7] = MSW(MSD(mreq->rcv_dma));
+
+       /* Iteration count */
+       mcp->mb[18] = LSW(iter_cnt);
+       mcp->mb[19] = MSW(iter_cnt);
+
+       mcp->out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15|
+           MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_7|MBX_6|MBX_1|MBX_0;
+       if (IS_QLA81XX(vha->hw))
+               mcp->out_mb |= MBX_2;
+       mcp->in_mb = MBX_19|MBX_18|MBX_3|MBX_2|MBX_1|MBX_0;
+
+       mcp->buf_size = mreq->transfer_size;
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
+
+       rval = qla2x00_mailbox_command(vha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               DEBUG2(printk(KERN_WARNING
+                   "(%ld): failed=%x mb[0]=0x%x "
+                       "mb[1]=0x%x mb[2]=0x%x mb[3]=0x%x mb[18]=0x%x mb[19]=0x%x. \n", vha->host_no, rval,
+                       mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], mcp->mb[18], mcp->mb[19]));
+       } else {
+               DEBUG2(printk(KERN_WARNING
+                   "scsi(%ld): done.\n", vha->host_no));
+       }
+
+       /* Copy mailbox information */
+       memcpy( mresp, mcp->mb, 64);
+       mresp[3] = mcp->mb[18];
+       mresp[4] = mcp->mb[19];
+       return rval;
+}
+
+int
+qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq, uint16_t *mresp)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+       struct qla_hw_data *ha = vha->hw;
+
+       DEBUG11(printk("scsi(%ld): entered.\n", vha->host_no));
+
+       memset(mcp->mb, 0 , sizeof(mcp->mb));
+       mcp->mb[0] = MBC_DIAGNOSTIC_ECHO;
+       mcp->mb[1] = mreq->options | BIT_6;     /* BIT_6 specifies 64bit address */
+       if (IS_QLA81XX(ha))
+               mcp->mb[1] |= BIT_15;
+       mcp->mb[2] = IS_QLA81XX(ha) ? vha->fcoe_fcf_idx : 0;
+       mcp->mb[16] = LSW(mreq->rcv_dma);
+       mcp->mb[17] = MSW(mreq->rcv_dma);
+       mcp->mb[6] = LSW(MSD(mreq->rcv_dma));
+       mcp->mb[7] = MSW(MSD(mreq->rcv_dma));
+
+       mcp->mb[10] = LSW(mreq->transfer_size);
+
+       mcp->mb[14] = LSW(mreq->send_dma);
+       mcp->mb[15] = MSW(mreq->send_dma);
+       mcp->mb[20] = LSW(MSD(mreq->send_dma));
+       mcp->mb[21] = MSW(MSD(mreq->send_dma));
+
+       mcp->out_mb = MBX_21|MBX_20|MBX_17|MBX_16|MBX_15|
+           MBX_14|MBX_10|MBX_7|MBX_6|MBX_1|MBX_0;
+       if (IS_QLA81XX(ha))
+               mcp->out_mb |= MBX_2;
+
+       mcp->in_mb = MBX_0;
+       if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha))
+               mcp->in_mb |= MBX_1;
+       if (IS_QLA81XX(ha))
+               mcp->in_mb |= MBX_3;
+
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
+       mcp->buf_size = mreq->transfer_size;
+
+       rval = qla2x00_mailbox_command(vha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               DEBUG2(printk(KERN_WARNING
+                   "(%ld): failed=%x mb[0]=0x%x mb[1]=0x%x.\n",
+                   vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+       } else {
+               DEBUG2(printk(KERN_WARNING
+                   "scsi(%ld): done.\n", vha->host_no));
+       }
+
+       /* Copy mailbox information */
+       memcpy( mresp, mcp->mb, 32);
+       return rval;
+}
+int
+qla84xx_reset_chip(scsi_qla_host_t *ha, uint16_t enable_diagnostic,
+    uint16_t *cmd_status)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+
+       DEBUG16(printk("%s(%ld): enable_diag=%d entered.\n", __func__,
+               ha->host_no, enable_diagnostic));
+
+       mcp->mb[0] = MBC_ISP84XX_RESET;
+       mcp->mb[1] = enable_diagnostic;
+       mcp->out_mb = MBX_1|MBX_0;
+       mcp->in_mb = MBX_1|MBX_0;
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
+       rval = qla2x00_mailbox_command(ha, mcp);
+
+       /* Return mailbox statuses. */
+       *cmd_status = mcp->mb[0];
+       if (rval != QLA_SUCCESS)
+               DEBUG16(printk("%s(%ld): failed=%x.\n", __func__, ha->host_no,
+                       rval));
+       else
+               DEBUG16(printk("%s(%ld): done.\n", __func__, ha->host_no));
+
+       return rval;
+}
+
 int
 qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data)
 {
index b901aa267e7d35e5fb1530056ceedab8d2c75b25..ff17dee286131f3c6ba49a9f5c1626bb93189b3a 100644 (file)
@@ -636,13 +636,15 @@ failed:
 
 static void qla_do_work(struct work_struct *work)
 {
+       unsigned long flags;
        struct rsp_que *rsp = container_of(work, struct rsp_que, q_work);
        struct scsi_qla_host *vha;
+       struct qla_hw_data *ha = rsp->hw;
 
-       spin_lock_irq(&rsp->hw->hardware_lock);
-       vha = qla25xx_get_host(rsp);
+       spin_lock_irqsave(&rsp->hw->hardware_lock, flags);
+       vha = pci_get_drvdata(ha->pdev);
        qla24xx_process_response_queue(vha, rsp);
-       spin_unlock_irq(&rsp->hw->hardware_lock);
+       spin_unlock_irqrestore(&rsp->hw->hardware_lock, flags);
 }
 
 /* create response queue */
index 209f50e788a1e893549e2caa365e23b03d897437..46720b23028f72850989cdef77b3a13cd477479f 100644 (file)
@@ -107,6 +107,12 @@ MODULE_PARM_DESC(ql2xfwloadbin,
                " 1 -- load firmware from flash.\n"
                " 0 -- use default semantics.\n");
 
+int ql2xetsenable;
+module_param(ql2xetsenable, int, S_IRUGO|S_IRUSR);
+MODULE_PARM_DESC(ql2xetsenable,
+               "Enables firmware ETS burst."
+               "Default is 0 - skip ETS enablement.");
+
 /*
  * SCSI host template entry points
  */
@@ -682,44 +688,6 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha)
        return (return_status);
 }
 
-void
-qla2x00_abort_fcport_cmds(fc_port_t *fcport)
-{
-       int cnt;
-       unsigned long flags;
-       srb_t *sp;
-       scsi_qla_host_t *vha = fcport->vha;
-       struct qla_hw_data *ha = vha->hw;
-       struct req_que *req;
-
-       spin_lock_irqsave(&ha->hardware_lock, flags);
-       req = vha->req;
-       for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
-               sp = req->outstanding_cmds[cnt];
-               if (!sp)
-                       continue;
-               if (sp->fcport != fcport)
-                       continue;
-               if (sp->ctx)
-                       continue;
-
-               spin_unlock_irqrestore(&ha->hardware_lock, flags);
-               if (ha->isp_ops->abort_command(sp)) {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                       "Abort failed --  %lx\n",
-                       sp->cmd->serial_number));
-               } else {
-                       if (qla2x00_eh_wait_on_command(sp->cmd) !=
-                               QLA_SUCCESS)
-                               DEBUG2(qla_printk(KERN_WARNING, ha,
-                               "Abort failed while waiting --  %lx\n",
-                               sp->cmd->serial_number));
-               }
-               spin_lock_irqsave(&ha->hardware_lock, flags);
-       }
-       spin_unlock_irqrestore(&ha->hardware_lock, flags);
-}
-
 /**************************************************************************
 * qla2xxx_eh_abort
 *
@@ -1095,6 +1063,20 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
        struct fc_port *fcport;
        struct qla_hw_data *ha = vha->hw;
 
+       if (ha->flags.enable_target_reset) {
+               list_for_each_entry(fcport, &vha->vp_fcports, list) {
+                       if (fcport->port_type != FCT_TARGET)
+                               continue;
+
+                       ret = ha->isp_ops->target_reset(fcport, 0, 0);
+                       if (ret != QLA_SUCCESS) {
+                               DEBUG2_3(printk("%s(%ld): bus_reset failed: "
+                                   "target_reset=%d d_id=%x.\n", __func__,
+                                   vha->host_no, ret, fcport->d_id.b24));
+                       }
+               }
+       }
+
        if (ha->flags.enable_lip_full_login && !IS_QLA81XX(ha)) {
                ret = qla2x00_full_login_lip(vha);
                if (ret != QLA_SUCCESS) {
@@ -1117,19 +1099,6 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
                        qla2x00_wait_for_loop_ready(vha);
        }
 
-       if (ha->flags.enable_target_reset) {
-               list_for_each_entry(fcport, &vha->vp_fcports, list) {
-                       if (fcport->port_type != FCT_TARGET)
-                               continue;
-
-                       ret = ha->isp_ops->target_reset(fcport, 0, 0);
-                       if (ret != QLA_SUCCESS) {
-                               DEBUG2_3(printk("%s(%ld): bus_reset failed: "
-                                   "target_reset=%d d_id=%x.\n", __func__,
-                                   vha->host_no, ret, fcport->d_id.b24));
-                       }
-               }
-       }
        /* Issue marker command only when we are going to start the I/O */
        vha->marker_needed = 1;
 
@@ -1160,8 +1129,19 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
                                        qla2x00_sp_compl(ha, sp);
                                } else {
                                        ctx = sp->ctx;
-                                       del_timer_sync(&ctx->timer);
-                                       ctx->free(sp);
+                                       if (ctx->type == SRB_LOGIN_CMD || ctx->type == SRB_LOGOUT_CMD) {
+                                               del_timer_sync(&ctx->timer);
+                                               ctx->free(sp);
+                                       } else {
+                                               struct srb_bsg* sp_bsg = (struct srb_bsg*)sp->ctx;
+                                               if (sp_bsg->bsg_job->request->msgcode == FC_BSG_HST_CT)
+                                                       kfree(sp->fcport);
+                                               sp_bsg->bsg_job->req->errors = 0;
+                                               sp_bsg->bsg_job->reply->result = res;
+                                               sp_bsg->bsg_job->job_done(sp_bsg->bsg_job);
+                                               kfree(sp->ctx);
+                                               mempool_free(sp, ha->srb_mempool);
+                                       }
                                }
                        }
                }
@@ -1188,7 +1168,6 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
        scsi_qla_host_t *vha = shost_priv(sdev->host);
        struct qla_hw_data *ha = vha->hw;
        struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
-       fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
        struct req_que *req = vha->req;
 
        if (sdev->tagged_supported)
@@ -1197,8 +1176,6 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
                scsi_deactivate_tcq(sdev, req->max_q_depth);
 
        rport->dev_loss_tmo = ha->port_down_retry_count;
-       if (sdev->type == TYPE_TAPE)
-               fcport->flags |= FCF_TAPE_PRESENT;
 
        return 0;
 }
@@ -1261,7 +1238,7 @@ qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
                qla2x00_adjust_sdev_qdepth_up(sdev, qdepth);
                break;
        default:
-               return EOPNOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        return sdev->queue_depth;
@@ -1821,7 +1798,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* Set EEH reset type to fundamental if required by hba */
        if ( IS_QLA24XX(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha)) {
                pdev->needs_freset = 1;
-               pci_save_state(pdev);
        }
 
        /* Configure PCI I/O space */
@@ -1973,11 +1949,15 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        host->max_channel = MAX_BUSES - 1;
        host->max_lun = MAX_LUNS;
        host->transportt = qla2xxx_transport_template;
+       sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC);
 
        /* Set up the irqs */
        ret = qla2x00_request_irqs(ha, rsp);
        if (ret)
                goto probe_init_failed;
+
+       pci_save_state(pdev);
+
        /* Alloc arrays of request and response ring ptrs */
 que_init:
        if (!qla2x00_alloc_queues(ha)) {
@@ -2179,6 +2159,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
        kfree(ha);
        ha = NULL;
 
+       pci_disable_pcie_error_reporting(pdev);
+
        pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
 }
@@ -2805,7 +2787,7 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
 
                        fcport->login_retry--;
                        if (fcport->flags & FCF_FABRIC_DEVICE) {
-                               if (fcport->flags & FCF_TAPE_PRESENT)
+                               if (fcport->flags & FCF_FCP2_DEVICE)
                                        ha->isp_ops->fabric_logout(vha,
                                                        fcport->loop_id,
                                                        fcport->d_id.b.domain,
@@ -3141,7 +3123,10 @@ qla2x00_timer(scsi_qla_host_t *vha)
                        if (!IS_QLA2100(ha) && vha->link_down_timeout)
                                atomic_set(&vha->loop_state, LOOP_DEAD);
 
-                       /* Schedule an ISP abort to return any tape commands. */
+                       /*
+                        * Schedule an ISP abort to return any FCP2-device
+                        * commands.
+                        */
                        /* NPIV - scan physical port only */
                        if (!vha->vp_idx) {
                                spin_lock_irqsave(&ha->hardware_lock,
@@ -3158,7 +3143,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
                                        if (sp->ctx)
                                                continue;
                                        sfcp = sp->fcport;
-                                       if (!(sfcp->flags & FCF_TAPE_PRESENT))
+                                       if (!(sfcp->flags & FCF_FCP2_DEVICE))
                                                continue;
 
                                        set_bit(ISP_ABORT_NEEDED,
@@ -3310,6 +3295,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
                return PCI_ERS_RESULT_CAN_RECOVER;
        case pci_channel_io_frozen:
                ha->flags.eeh_busy = 1;
+               qla2x00_free_irqs(vha);
                pci_disable_device(pdev);
                return PCI_ERS_RESULT_NEED_RESET;
        case pci_channel_io_perm_failure:
@@ -3363,10 +3349,24 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
        pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT;
        scsi_qla_host_t *base_vha = pci_get_drvdata(pdev);
        struct qla_hw_data *ha = base_vha->hw;
-       int rc;
+       struct rsp_que *rsp;
+       int rc, retries = 10;
 
        DEBUG17(qla_printk(KERN_WARNING, ha, "slot_reset\n"));
 
+       /* Workaround: qla2xxx driver which access hardware earlier
+        * needs error state to be pci_channel_io_online.
+        * Otherwise mailbox command timesout.
+        */
+       pdev->error_state = pci_channel_io_normal;
+
+       pci_restore_state(pdev);
+
+       /* pci_restore_state() clears the saved_state flag of the device
+        * save restored state which resets saved_state flag
+        */
+       pci_save_state(pdev);
+
        if (ha->mem_only)
                rc = pci_enable_device_mem(pdev);
        else
@@ -3378,27 +3378,23 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
                return ret;
        }
 
+       rsp = ha->rsp_q_map[0];
+       if (qla2x00_request_irqs(ha, rsp))
+               return ret;
+
        if (ha->isp_ops->pci_config(base_vha))
                return ret;
 
-#ifdef QL_DEBUG_LEVEL_17
-       {
-               uint8_t b;
-               uint32_t i;
+       while (ha->flags.mbox_busy && retries--)
+               msleep(1000);
 
-               printk("slot_reset_1: ");
-               for (i = 0; i < 256; i++) {
-                       pci_read_config_byte(ha->pdev, i, &b);
-                       printk("%s%02x", (i%16) ? " " : "\n", b);
-               }
-               printk("\n");
-       }
-#endif
        set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
        if (qla2x00_abort_isp(base_vha) == QLA_SUCCESS)
                ret =  PCI_ERS_RESULT_RECOVERED;
        clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
 
+       pci_cleanup_aer_uncorrect_error_status(pdev);
+
        DEBUG17(qla_printk(KERN_WARNING, ha,
            "slot_reset-return:ret=%x\n", ret));
 
@@ -3422,8 +3418,6 @@ qla2xxx_pci_resume(struct pci_dev *pdev)
        }
 
        ha->flags.eeh_busy = 0;
-
-       pci_cleanup_aer_uncorrect_error_status(pdev);
 }
 
 static struct pci_error_handlers qla2xxx_err_handler = {
@@ -3536,4 +3530,3 @@ MODULE_FIRMWARE(FW_FILE_ISP2300);
 MODULE_FIRMWARE(FW_FILE_ISP2322);
 MODULE_FIRMWARE(FW_FILE_ISP24XX);
 MODULE_FIRMWARE(FW_FILE_ISP25XX);
-MODULE_FIRMWARE(FW_FILE_ISP81XX);
index 010e69b29afed1a89c89e5186798a1021c1872f4..371dc895972ae349ffb878eff28b62b5015e8366 100644 (file)
@@ -2292,11 +2292,14 @@ qla25xx_read_optrom_data(struct scsi_qla_host *vha, uint8_t *buf,
        uint32_t faddr, left, burst;
        struct qla_hw_data *ha = vha->hw;
 
+       if (IS_QLA25XX(ha) || IS_QLA81XX(ha))
+               goto try_fast;
        if (offset & 0xfff)
                goto slow_read;
        if (length < OPTROM_BURST_SIZE)
                goto slow_read;
 
+try_fast:
        optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
            &optrom_dma, GFP_KERNEL);
        if (!optrom) {
index a65dd95507c6f6a012189a5a5447c6f54fbfdca1..8d2fc2fa7a6be830f5bedad880cf5e85c9891c05 100644 (file)
@@ -7,9 +7,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "8.03.01-k9"
+#define QLA2XXX_VERSION      "8.03.02-k1"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   3
-#define QLA_DRIVER_PATCH_VER   1
-#define QLA_DRIVER_BETA_VER    0
+#define QLA_DRIVER_PATCH_VER   2
+#define QLA_DRIVER_BETA_VER    1
index af8c3233e8aef9c3449917e9e3850e553a937ca3..92329a461c6891e1a068d692ea4d233670ce7184 100644 (file)
@@ -844,10 +844,10 @@ static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
        DEBUG2(printk("scsi%ld: %s: Get EEProm parameters \n", ha->host_no,
                      __func__));
        if (ql4xxx_lock_flash(ha) != QLA_SUCCESS)
-               return (QLA_ERROR);
+               return QLA_ERROR;
        if (ql4xxx_lock_nvram(ha) != QLA_SUCCESS) {
                ql4xxx_unlock_flash(ha);
-               return (QLA_ERROR);
+               return QLA_ERROR;
        }
 
        /* Get EEPRom Parameters from NVRAM and validate */
@@ -858,20 +858,18 @@ static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
                        rd_nvram_word(ha, eeprom_ext_hw_conf_offset(ha));
                spin_unlock_irqrestore(&ha->hardware_lock, flags);
        } else {
-               /*
-                * QLogic adapters should always have a valid NVRAM.
-                * If not valid, do not load.
-                */
                dev_warn(&ha->pdev->dev,
                           "scsi%ld: %s: EEProm checksum invalid.  "
                           "Please update your EEPROM\n", ha->host_no,
                           __func__);
 
-               /* set defaults */
+               /* Attempt to set defaults */
                if (is_qla4010(ha))
                        extHwConfig.Asuint32_t = 0x1912;
                else if (is_qla4022(ha) | is_qla4032(ha))
                        extHwConfig.Asuint32_t = 0x0023;
+               else
+                       return QLA_ERROR;
        }
        DEBUG(printk("scsi%ld: %s: Setting extHwConfig to 0xFFFF%04x\n",
                     ha->host_no, __func__, extHwConfig.Asuint32_t));
@@ -884,7 +882,7 @@ static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
        ql4xxx_unlock_nvram(ha);
        ql4xxx_unlock_flash(ha);
 
-       return (QLA_SUCCESS);
+       return QLA_SUCCESS;
 }
 
 static void qla4x00_pci_config(struct scsi_qla_host *ha)
index 8e5c169b03fb47e5b9439765f5d7091252fc8a5b..bd88349b852684d3d31f87d614f2c50947b86fe3 100644 (file)
@@ -149,6 +149,7 @@ static struct {
        { RAID_LEVEL_0, "raid0" },
        { RAID_LEVEL_1, "raid1" },
        { RAID_LEVEL_10, "raid10" },
+       { RAID_LEVEL_1E, "raid1e" },
        { RAID_LEVEL_3, "raid3" },
        { RAID_LEVEL_4, "raid4" },
        { RAID_LEVEL_5, "raid5" },
index a60da55555778822a3d96a5571646c865775f9ea..1c08f6164658155d370735e35cfbdf6b22ae7713 100644 (file)
@@ -1018,6 +1018,8 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
  * scsi_get_vpd_page - Get Vital Product Data from a SCSI device
  * @sdev: The device to ask
  * @page: Which Vital Product Data to return
+ * @buf: where to store the VPD
+ * @buf_len: number of bytes in the VPD buffer area
  *
  * SCSI devices may optionally supply Vital Product Data.  Each 'page'
  * of VPD is defined in the appropriate SCSI document (eg SPC, SBC).
@@ -1026,55 +1028,39 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
  * responsible for calling kfree() on this pointer when it is no longer
  * needed.  If we cannot retrieve the VPD page this routine returns %NULL.
  */
-unsigned char *scsi_get_vpd_page(struct scsi_device *sdev, u8 page)
+int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
+                     int buf_len)
 {
        int i, result;
-       unsigned int len;
-       const unsigned int init_vpd_len = 255;
-       unsigned char *buf = kmalloc(init_vpd_len, GFP_KERNEL);
-
-       if (!buf)
-               return NULL;
 
        /* Ask for all the pages supported by this device */
-       result = scsi_vpd_inquiry(sdev, buf, 0, init_vpd_len);
+       result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
        if (result)
                goto fail;
 
        /* If the user actually wanted this page, we can skip the rest */
        if (page == 0)
-               return buf;
+               return -EINVAL;
 
-       for (i = 0; i < buf[3]; i++)
+       for (i = 0; i < min((int)buf[3], buf_len - 4); i++)
                if (buf[i + 4] == page)
                        goto found;
+
+       if (i < buf[3] && i > buf_len)
+               /* ran off the end of the buffer, give us benefit of doubt */
+               goto found;
        /* The device claims it doesn't support the requested page */
        goto fail;
 
  found:
-       result = scsi_vpd_inquiry(sdev, buf, page, 255);
+       result = scsi_vpd_inquiry(sdev, buf, page, buf_len);
        if (result)
                goto fail;
 
-       /*
-        * Some pages are longer than 255 bytes.  The actual length of
-        * the page is returned in the header.
-        */
-       len = ((buf[2] << 8) | buf[3]) + 4;
-       if (len <= init_vpd_len)
-               return buf;
-
-       kfree(buf);
-       buf = kmalloc(len, GFP_KERNEL);
-       result = scsi_vpd_inquiry(sdev, buf, page, len);
-       if (result)
-               goto fail;
-
-       return buf;
+       return 0;
 
  fail:
-       kfree(buf);
-       return NULL;
+       return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(scsi_get_vpd_page);
 
index d8927681ec8837c5c227712688324473e2c729b6..56977097de9f84a5e10e560f787c51ad35861729 100644 (file)
@@ -749,9 +749,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
                         */
                        req->next_rq->resid_len = scsi_in(cmd)->resid;
 
+                       scsi_release_buffers(cmd);
                        blk_end_request_all(req, 0);
 
-                       scsi_release_buffers(cmd);
                        scsi_next_command(cmd);
                        return;
                }
@@ -773,8 +773,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
         * we already took a copy of the original into rq->errors which
         * is what gets returned to the user
         */
-       if (sense_valid && sshdr.sense_key == RECOVERED_ERROR) {
-               if (!(req->cmd_flags & REQ_QUIET))
+       if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
+               /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
+                * print since caller wants ATA registers. Only occurs on
+                * SCSI ATA PASS_THROUGH commands when CK_COND=1
+                */
+               if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
+                       ;
+               else if (!(req->cmd_flags & REQ_QUIET))
                        scsi_print_sense("", cmd);
                result = 0;
                /* BLOCK_PC may have set error */
index 998cb5be6833041fbaf2c1c32bfd58127ab6fa64..6266a5d73d0f956365505fad50dea949f676892c 100644 (file)
@@ -5,7 +5,7 @@
 #define SAS_PHY_ATTRS          17
 #define SAS_PORT_ATTRS         1
 #define SAS_RPORT_ATTRS                7
-#define SAS_END_DEV_ATTRS      3
+#define SAS_END_DEV_ATTRS      5
 #define SAS_EXPANDER_ATTRS     7
 
 struct sas_internal {
index 012f73a96880e8b67546caeab4211c0a8c65f523..f697229ae5a98a25b3620d114b1765a718c7c9fc 100644 (file)
@@ -1339,8 +1339,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
                sdev = scsi_alloc_sdev(starget, 0, NULL);
                if (!sdev)
                        return 0;
-               if (scsi_device_get(sdev))
+               if (scsi_device_get(sdev)) {
+                       __scsi_remove_device(sdev);
                        return 0;
+               }
        }
 
        sprintf(devname, "host %d channel %d id %d",
@@ -1907,10 +1909,9 @@ struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
                goto out;
 
        sdev = scsi_alloc_sdev(starget, 0, NULL);
-       if (sdev) {
-               sdev->sdev_gendev.parent = get_device(&starget->dev);
+       if (sdev)
                sdev->borken = 0;
-       else
+       else
                scsi_target_reap(starget);
        put_device(&starget->dev);
  out:
index 5a065055e68af76e9a61bdfe9c31da9a16842719..19ec9e2d3f391c1189e57b178173bd446ed14b20 100644 (file)
@@ -847,6 +847,8 @@ static int scsi_target_add(struct scsi_target *starget)
        if (starget->state != STARGET_CREATED)
                return 0;
 
+       device_enable_async_suspend(&starget->dev);
+
        error = device_add(&starget->dev);
        if (error) {
                dev_err(&starget->dev, "target device_add failed, error %d\n", error);
@@ -878,7 +880,8 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
        struct request_queue *rq = sdev->request_queue;
        struct scsi_target *starget = sdev->sdev_target;
 
-       if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
+       error = scsi_device_set_state(sdev, SDEV_RUNNING);
+       if (error)
                return error;
 
        error = scsi_target_add(starget);
@@ -886,16 +889,18 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
                return error;
 
        transport_configure_device(&starget->dev);
+       device_enable_async_suspend(&sdev->sdev_gendev);
        error = device_add(&sdev->sdev_gendev);
        if (error) {
                printk(KERN_INFO "error 1\n");
-               goto out_remove;
+               return error;
        }
+       device_enable_async_suspend(&sdev->sdev_dev);
        error = device_add(&sdev->sdev_dev);
        if (error) {
                printk(KERN_INFO "error 2\n");
                device_del(&sdev->sdev_gendev);
-               goto out_remove;
+               return error;
        }
        transport_add_device(&sdev->sdev_gendev);
        sdev->is_visible = 1;
@@ -910,14 +915,14 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
        else
                error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth);
        if (error)
-               goto out_remove;
+               return error;
 
        if (sdev->host->hostt->change_queue_type)
                error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw);
        else
                error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type);
        if (error)
-               goto out_remove;
+               return error;
 
        error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL);
 
@@ -933,16 +938,11 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
                        error = device_create_file(&sdev->sdev_gendev,
                                        sdev->host->hostt->sdev_attrs[i]);
                        if (error)
-                               goto out_remove;
+                               return error;
                }
        }
 
-       return 0;
-
- out_remove:
-       __scsi_remove_device(sdev);
        return error;
-
 }
 
 void __scsi_remove_device(struct scsi_device *sdev)
index ddfcecd5099f5688d1ec7667d050eb1671e78267..79660ee3e2113affe5735c4c97786f5142b1f10c 100644 (file)
@@ -475,7 +475,8 @@ MODULE_PARM_DESC(dev_loss_tmo,
                 "Maximum number of seconds that the FC transport should"
                 " insulate the loss of a remote port. Once this value is"
                 " exceeded, the scsi target is removed. Value should be"
-                " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT.");
+                " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if"
+                " fast_io_fail_tmo is not set.");
 
 /*
  * Netlink Infrastructure
@@ -842,9 +843,17 @@ store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
            (rport->port_state == FC_PORTSTATE_NOTPRESENT))
                return -EBUSY;
        val = simple_strtoul(buf, &cp, 0);
-       if ((*cp && (*cp != '\n')) ||
-           (val < 0) || (val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT))
+       if ((*cp && (*cp != '\n')) || (val < 0))
                return -EINVAL;
+
+       /*
+        * If fast_io_fail is off we have to cap
+        * dev_loss_tmo at SCSI_DEVICE_BLOCK_MAX_TIMEOUT
+        */
+       if (rport->fast_io_fail_tmo == -1 &&
+           val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT)
+               return -EINVAL;
+
        i->f->set_rport_dev_loss_tmo(rport, val);
        return count;
 }
@@ -925,9 +934,16 @@ store_fc_rport_fast_io_fail_tmo(struct device *dev,
                rport->fast_io_fail_tmo = -1;
        else {
                val = simple_strtoul(buf, &cp, 0);
-               if ((*cp && (*cp != '\n')) ||
-                   (val < 0) || (val >= rport->dev_loss_tmo))
+               if ((*cp && (*cp != '\n')) || (val < 0))
                        return -EINVAL;
+               /*
+                * Cap fast_io_fail by dev_loss_tmo or
+                * SCSI_DEVICE_BLOCK_MAX_TIMEOUT.
+                */
+               if ((val >= rport->dev_loss_tmo) ||
+                   (val > SCSI_DEVICE_BLOCK_MAX_TIMEOUT))
+                       return -EINVAL;
+
                rport->fast_io_fail_tmo = val;
        }
        return count;
@@ -3527,7 +3543,10 @@ fc_bsg_job_timeout(struct request *req)
        if (!done && i->f->bsg_timeout) {
                /* call LLDD to abort the i/o as it has timed out */
                err = i->f->bsg_timeout(job);
-               if (err)
+               if (err == -EAGAIN) {
+                       job->ref_cnt--;
+                       return BLK_EH_RESET_TIMER;
+               } else if (err)
                        printk(KERN_ERR "ERROR: FC BSG request timeout - LLD "
                                "abort failed with status %d\n", err);
        }
index f27e52d963d3db55086da4eeaf331fb2e8013dff..927e99cb72250c61154639ea8ca1eae2dd32b198 100644 (file)
@@ -155,6 +155,17 @@ static struct {
 sas_bitfield_name_search(linkspeed, sas_linkspeed_names)
 sas_bitfield_name_set(linkspeed, sas_linkspeed_names)
 
+static struct sas_end_device *sas_sdev_to_rdev(struct scsi_device *sdev)
+{
+       struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);
+       struct sas_end_device *rdev;
+
+       BUG_ON(rphy->identify.device_type != SAS_END_DEVICE);
+
+       rdev = rphy_to_end_device(rphy);
+       return rdev;
+}
+
 static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost,
                            struct sas_rphy *rphy)
 {
@@ -358,6 +369,85 @@ void sas_remove_host(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL(sas_remove_host);
 
+/**
+ * sas_tlr_supported - checking TLR bit in vpd 0x90
+ * @sdev: scsi device struct
+ *
+ * Check Transport Layer Retries are supported or not.
+ * If vpd page 0x90 is present, TRL is supported.
+ *
+ */
+unsigned int
+sas_tlr_supported(struct scsi_device *sdev)
+{
+       const int vpd_len = 32;
+       struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+       char *buffer = kzalloc(vpd_len, GFP_KERNEL);
+       int ret = 0;
+
+       if (scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len))
+               goto out;
+
+       /*
+        * Magic numbers: the VPD Protocol page (0x90)
+        * has a 4 byte header and then one entry per device port
+        * the TLR bit is at offset 8 on each port entry
+        * if we take the first port, that's at total offset 12
+        */
+       ret = buffer[12] & 0x01;
+
+ out:
+       kfree(buffer);
+       rdev->tlr_supported = ret;
+       return ret;
+
+}
+EXPORT_SYMBOL_GPL(sas_tlr_supported);
+
+/**
+ * sas_disable_tlr - setting TLR flags
+ * @sdev: scsi device struct
+ *
+ * Seting tlr_enabled flag to 0.
+ *
+ */
+void
+sas_disable_tlr(struct scsi_device *sdev)
+{
+       struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+
+       rdev->tlr_enabled = 0;
+}
+EXPORT_SYMBOL_GPL(sas_disable_tlr);
+
+/**
+ * sas_enable_tlr - setting TLR flags
+ * @sdev: scsi device struct
+ *
+ * Seting tlr_enabled flag 1.
+ *
+ */
+void sas_enable_tlr(struct scsi_device *sdev)
+{
+       unsigned int tlr_supported = 0;
+       tlr_supported  = sas_tlr_supported(sdev);
+
+       if (tlr_supported) {
+               struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+
+               rdev->tlr_enabled = 1;
+       }
+
+       return;
+}
+EXPORT_SYMBOL_GPL(sas_enable_tlr);
+
+unsigned int sas_is_tlr_enabled(struct scsi_device *sdev)
+{
+       struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
+       return rdev->tlr_enabled;
+}
+EXPORT_SYMBOL_GPL(sas_is_tlr_enabled);
 
 /*
  * SAS Phy attributes
@@ -1146,15 +1236,10 @@ sas_rphy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8);
 int sas_read_port_mode_page(struct scsi_device *sdev)
 {
        char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata;
-       struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);
-       struct sas_end_device *rdev;
+       struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
        struct scsi_mode_data mode_data;
        int res, error;
 
-       BUG_ON(rphy->identify.device_type != SAS_END_DEVICE);
-
-       rdev = rphy_to_end_device(rphy);
-
        if (!buffer)
                return -ENOMEM;
 
@@ -1207,6 +1292,10 @@ sas_end_dev_simple_attr(I_T_nexus_loss_timeout, I_T_nexus_loss_timeout,
                        "%d\n", int);
 sas_end_dev_simple_attr(initiator_response_timeout, initiator_response_timeout,
                        "%d\n", int);
+sas_end_dev_simple_attr(tlr_supported, tlr_supported,
+                       "%d\n", int);
+sas_end_dev_simple_attr(tlr_enabled, tlr_enabled,
+                       "%d\n", int);
 
 static DECLARE_TRANSPORT_CLASS(sas_expander_class,
                               "sas_expander", NULL, NULL, NULL);
@@ -1733,6 +1822,8 @@ sas_attach_transport(struct sas_function_template *ft)
        SETUP_END_DEV_ATTRIBUTE(end_dev_ready_led_meaning);
        SETUP_END_DEV_ATTRIBUTE(end_dev_I_T_nexus_loss_timeout);
        SETUP_END_DEV_ATTRIBUTE(end_dev_initiator_response_timeout);
+       SETUP_END_DEV_ATTRIBUTE(end_dev_tlr_supported);
+       SETUP_END_DEV_ATTRIBUTE(end_dev_tlr_enabled);
        i->end_dev_attrs[count] = NULL;
 
        count = 0;
index 255da53e5a01a1dd970fac95b2106888b6e91c6b..1dd4d8407694b44fac24501ffd0b8db5bf8cd7e5 100644 (file)
@@ -1196,19 +1196,10 @@ static int sd_done(struct scsi_cmnd *SCpnt)
                SCpnt->result = 0;
                memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
                break;
-       case ABORTED_COMMAND:
-               if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
-                       scsi_print_result(SCpnt);
-                       scsi_print_sense("sd", SCpnt);
+       case ABORTED_COMMAND: /* DIF: Target detected corruption */
+       case ILLEGAL_REQUEST: /* DIX: Host detected corruption */
+               if (sshdr.asc == 0x10)
                        good_bytes = sd_completed_bytes(SCpnt);
-               }
-               break;
-       case ILLEGAL_REQUEST:
-               if (sshdr.asc == 0x10) { /* DIX: HBA detected corruption */
-                       scsi_print_result(SCpnt);
-                       scsi_print_sense("sd", SCpnt);
-                       good_bytes = sd_completed_bytes(SCpnt);
-               }
                break;
        default:
                break;
@@ -1218,8 +1209,19 @@ static int sd_done(struct scsi_cmnd *SCpnt)
                sd_dif_complete(SCpnt, good_bytes);
 
        if (scsi_host_dif_capable(sdkp->device->host, sdkp->protection_type)
-           == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd)
+           == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) {
+
+               /* We have to print a failed command here as the
+                * extended CDB gets freed before scsi_io_completion()
+                * is called.
+                */
+               if (result)
+                       scsi_print_command(SCpnt);
+
                mempool_free(SCpnt->cmnd, sd_cdb_pool);
+               SCpnt->cmnd = NULL;
+               SCpnt->cmd_len = 0;
+       }
 
        return good_bytes;
 }
@@ -1946,13 +1948,13 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
 {
        struct request_queue *q = sdkp->disk->queue;
        unsigned int sector_sz = sdkp->device->sector_size;
-       char *buffer;
+       const int vpd_len = 32;
+       unsigned char *buffer = kmalloc(vpd_len, GFP_KERNEL);
 
-       /* Block Limits VPD */
-       buffer = scsi_get_vpd_page(sdkp->device, 0xb0);
-
-       if (buffer == NULL)
-               return;
+       if (!buffer ||
+           /* Block Limits VPD */
+           scsi_get_vpd_page(sdkp->device, 0xb0, buffer, vpd_len))
+               goto out;
 
        blk_queue_io_min(sdkp->disk->queue,
                         get_unaligned_be16(&buffer[6]) * sector_sz);
@@ -1984,6 +1986,7 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
                                get_unaligned_be32(&buffer[32]) & ~(1 << 31);
        }
 
+ out:
        kfree(buffer);
 }
 
@@ -1993,20 +1996,23 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
  */
 static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 {
-       char *buffer;
+       unsigned char *buffer;
        u16 rot;
+       const int vpd_len = 32;
 
-       /* Block Device Characteristics VPD */
-       buffer = scsi_get_vpd_page(sdkp->device, 0xb1);
+       buffer = kmalloc(vpd_len, GFP_KERNEL);
 
-       if (buffer == NULL)
-               return;
+       if (!buffer ||
+           /* Block Device Characteristics VPD */
+           scsi_get_vpd_page(sdkp->device, 0xb1, buffer, vpd_len))
+               goto out;
 
        rot = get_unaligned_be16(&buffer[4]);
 
        if (rot == 1)
                queue_flag_set_unlocked(QUEUE_FLAG_NONROT, sdkp->disk->queue);
 
+ out:
        kfree(buffer);
 }
 
index 55b034b72708e5f8b5cc873082e3a44003325ba7..1d7a8780e00cda01248a1854fe1e77c88c7f6d67 100644 (file)
@@ -448,13 +448,17 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
                .addr = 0,
        };
 
-       buf = scsi_get_vpd_page(sdev, 0x83);
-       if (!buf)
-               return;
+       buf = kmalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
+       if (!buf || scsi_get_vpd_page(sdev, 0x83, buf, INIT_ALLOC_SIZE))
+               goto free;
 
        ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
 
        vpd_len = ((buf[2] << 8) | buf[3]) + 4;
+       kfree(buf);
+       buf = kmalloc(vpd_len, GFP_KERNEL);
+       if (!buf ||scsi_get_vpd_page(sdev, 0x83, buf, vpd_len))
+               goto free;
 
        desc = buf + 4;
        while (desc < buf + vpd_len) {
index 54023d41fd15cdcd69b9391653f21f544927cb01..26e8e0e6b8ddeedd3b3c40b5d87a717ec84a5288 100644 (file)
@@ -1070,7 +1070,7 @@ static int option_setup(char *str) {
    char *cur = str;
    int i = 1;
 
-   while (cur && isdigit(*cur) && i <= MAX_INT_PARAM) {
+   while (cur && isdigit(*cur) && i < MAX_INT_PARAM) {
       ints[i++] = simple_strtoul(cur, NULL, 0);
 
       if ((cur = strchr(cur, ',')) != NULL) cur++;
index d2604c813a204d607169eb521487babadf178e82..e4ac5829b637b2c99e0cc7fdc37b7ba875bc1056 100644 (file)
@@ -1069,7 +1069,8 @@ static void pvscsi_free_sgls(const struct pvscsi_adapter *adapter)
                free_pages((unsigned long)ctx->sgl, get_order(SGL_SIZE));
 }
 
-static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter, int *irq)
+static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter,
+                            unsigned int *irq)
 {
        struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION };
        int ret;
index c3e37c8e7e26a8b8ecc4a767561aea15b2378909..a81ff7bc5fa109d7e9385016ed58d465fabce51d 100644 (file)
@@ -83,6 +83,9 @@ static unsigned int skip_txen_test; /* force skip of txen test at init time */
 
 #define PASS_LIMIT     256
 
+#define BOTH_EMPTY     (UART_LSR_TEMT | UART_LSR_THRE)
+
+
 /*
  * We default to IRQ0 for the "no irq" hack.   Some
  * machine types want others as well - they're free
@@ -1214,12 +1217,6 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
        }
 #endif
 
-#ifdef CONFIG_SERIAL_8250_AU1X00
-       /* if access method is AU, it is a 16550 with a quirk */
-       if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU)
-               up->bugs |= UART_BUG_NOMSR;
-#endif
-
        serial_outp(up, UART_LCR, save_lcr);
 
        if (up->capabilities != uart_config[up->port.type].flags) {
@@ -1792,7 +1789,7 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
        up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
        spin_unlock_irqrestore(&up->port.lock, flags);
 
-       return lsr & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
+       return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0;
 }
 
 static unsigned int serial8250_get_mctrl(struct uart_port *port)
@@ -1850,8 +1847,6 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state)
        spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 /*
  *     Wait for transmitter & holding register to empty
  */
@@ -2427,7 +2422,7 @@ serial8250_pm(struct uart_port *port, unsigned int state,
 static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
        if (pt->port.iotype == UPIO_AU)
-               return 0x100000;
+               return 0x1000;
 #ifdef CONFIG_ARCH_OMAP
        if (is_omap_port(pt))
                return 0x16 << pt->port.regshift;
@@ -2584,6 +2579,13 @@ static void serial8250_config_port(struct uart_port *port, int flags)
 
        if (flags & UART_CONFIG_TYPE)
                autoconfig(up, probeflags);
+
+#ifdef CONFIG_SERIAL_8250_AU1X00
+       /* if access method is AU, it is a 16550 with a quirk */
+       if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU)
+               up->bugs |= UART_BUG_NOMSR;
+#endif
+
        if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ)
                autoconfig_irq(up);
 
index 36ede02ceacf7d215282174b77b9f1a7ac849c43..24485cc62ff8255a6f56a38f95a6de83eb113600 100644 (file)
@@ -328,15 +328,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
        /* U.S. Robotics 56K Voice INT PnP*/
        {       "USR9190",              0       },
        /* Wacom tablets */
-       {       "WACF004",              0       },
-       {       "WACF005",              0       },
-       {       "WACF006",              0       },
-       {       "WACF007",              0       },
-       {       "WACF008",              0       },
-       {       "WACF009",              0       },
-       {       "WACF00A",              0       },
-       {       "WACF00B",              0       },
-       {       "WACF00C",              0       },
+       {       "WACFXXX",              0       },
        /* Compaq touchscreen */
        {       "FPI2002",              0 },
        /* Fujitsu Stylistic touchscreens */
@@ -354,6 +346,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
        {       "FUJ02E5",              0       },
        /* Fujitsu P-series tablet PC device */
        {       "FUJ02E6",              0       },
+       /* Fujitsu Wacom 2FGT Tablet PC device */
+       {       "FUJ02E7",              0       },
        /*
         * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
         * disguise)
index 9ff47db0b2ced375c7463a504625cd49f63c925f..888a0ce91c4be4a7eb064893f8d24d83570b4c08 100644 (file)
@@ -1086,12 +1086,12 @@ config SERIAL_68360
        default y
 
 config SERIAL_PMACZILOG
-       tristate "PowerMac z85c30 ESCC support"
-       depends on PPC_OF && PPC_PMAC
+       tristate "Mac or PowerMac z85c30 ESCC support"
+       depends on (M68K && MAC) || (PPC_OF && PPC_PMAC)
        select SERIAL_CORE
        help
          This driver supports the Zilog z85C30 serial ports found on
-         PowerMac machines.
+         (Power)Mac machines.
          Say Y or M if you want to be able to these serial ports.
 
 config SERIAL_PMACZILOG_TTYS
@@ -1116,16 +1116,16 @@ config SERIAL_PMACZILOG_TTYS
          unable to use the 8250 module for PCMCIA or other 16C550-style
          UARTs.
 
-         Say N unless you need the z85c30 ports on your powermac
+         Say N unless you need the z85c30 ports on your (Power)Mac
          to appear as /dev/ttySn.
 
 config SERIAL_PMACZILOG_CONSOLE
-       bool "Console on PowerMac z85c30 serial port"
+       bool "Console on Mac or PowerMac z85c30 serial port"
        depends on SERIAL_PMACZILOG=y
        select SERIAL_CORE_CONSOLE
        help
          If you would like to be able to use the z85c30 serial port
-         on your PowerMac as the console, you can do so by answering
+         on your (Power)Mac as the console, you can do so by answering
          Y to this option.
 
 config SERIAL_LH7A40X
index 18130f11238e6025b16682c9a00cca218727e370..60d665a17a885b280cd98b289dd783a58d9d4ac7 100644 (file)
@@ -1088,7 +1088,7 @@ imx_console_get_options(struct imx_port *sport, int *baud,
                           int *parity, int *bits)
 {
 
-       if ( readl(sport->port.membase + UCR1) | UCR1_UARTEN ) {
+       if (readl(sport->port.membase + UCR1) & UCR1_UARTEN) {
                /* ok, the port was enabled */
                unsigned int ucr2, ubir,ubmr, uartclk;
                unsigned int baud_raw;
index 7ce9e9f567a3ded5a3f1b336db531b0538981e94..3119fddaedb5708ec80346dfb239323365292608 100644 (file)
@@ -74,6 +74,7 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/clk.h>
 
 #include <asm/mpc52xx.h>
 #include <asm/mpc52xx_psc.h>
@@ -113,6 +114,7 @@ static void mpc52xx_uart_of_enumerate(void);
 
 /* Forward declaration of the interruption handling routine */
 static irqreturn_t mpc52xx_uart_int(int irq, void *dev_id);
+static irqreturn_t mpc5xxx_uart_process_int(struct uart_port *port);
 
 
 /* Simple macro to test if a port is console or not. This one is taken
@@ -145,6 +147,11 @@ struct psc_ops {
        void            (*cw_disable_ints)(struct uart_port *port);
        void            (*cw_restore_ints)(struct uart_port *port);
        unsigned long   (*getuartclk)(void *p);
+       int             (*clock)(struct uart_port *port, int enable);
+       int             (*fifoc_init)(void);
+       void            (*fifoc_uninit)(void);
+       void            (*get_irq)(struct uart_port *, struct device_node *);
+       irqreturn_t     (*handle_irq)(struct uart_port *port);
 };
 
 #ifdef CONFIG_PPC_MPC52xx
@@ -256,6 +263,18 @@ static unsigned long mpc52xx_getuartclk(void *p)
        return mpc5xxx_get_bus_frequency(p) / 2;
 }
 
+static void mpc52xx_psc_get_irq(struct uart_port *port, struct device_node *np)
+{
+       port->irqflags = IRQF_DISABLED;
+       port->irq = irq_of_parse_and_map(np, 0);
+}
+
+/* 52xx specific interrupt handler. The caller holds the port lock */
+static irqreturn_t mpc52xx_psc_handle_irq(struct uart_port *port)
+{
+       return mpc5xxx_uart_process_int(port);
+}
+
 static struct psc_ops mpc52xx_psc_ops = {
        .fifo_init = mpc52xx_psc_fifo_init,
        .raw_rx_rdy = mpc52xx_psc_raw_rx_rdy,
@@ -273,14 +292,32 @@ static struct psc_ops mpc52xx_psc_ops = {
        .cw_disable_ints = mpc52xx_psc_cw_disable_ints,
        .cw_restore_ints = mpc52xx_psc_cw_restore_ints,
        .getuartclk = mpc52xx_getuartclk,
+       .get_irq = mpc52xx_psc_get_irq,
+       .handle_irq = mpc52xx_psc_handle_irq,
 };
 
 #endif /* CONFIG_MPC52xx */
 
 #ifdef CONFIG_PPC_MPC512x
 #define FIFO_512x(port) ((struct mpc512x_psc_fifo __iomem *)(PSC(port)+1))
+
+/* PSC FIFO Controller for mpc512x */
+struct psc_fifoc {
+       u32 fifoc_cmd;
+       u32 fifoc_int;
+       u32 fifoc_dma;
+       u32 fifoc_axe;
+       u32 fifoc_debug;
+};
+
+static struct psc_fifoc __iomem *psc_fifoc;
+static unsigned int psc_fifoc_irq;
+
 static void mpc512x_psc_fifo_init(struct uart_port *port)
 {
+       /* /32 prescaler */
+       out_be16(&PSC(port)->mpc52xx_psc_clock_select, 0xdd00);
+
        out_be32(&FIFO_512x(port)->txcmd, MPC512x_PSC_FIFO_RESET_SLICE);
        out_be32(&FIFO_512x(port)->txcmd, MPC512x_PSC_FIFO_ENABLE_SLICE);
        out_be32(&FIFO_512x(port)->txalarm, 1);
@@ -393,6 +430,160 @@ static unsigned long mpc512x_getuartclk(void *p)
        return mpc5xxx_get_bus_frequency(p);
 }
 
+#define DEFAULT_FIFO_SIZE 16
+
+static unsigned int __init get_fifo_size(struct device_node *np,
+                                        char *fifo_name)
+{
+       const unsigned int *fp;
+
+       fp = of_get_property(np, fifo_name, NULL);
+       if (fp)
+               return *fp;
+
+       pr_warning("no %s property in %s node, defaulting to %d\n",
+                  fifo_name, np->full_name, DEFAULT_FIFO_SIZE);
+
+       return DEFAULT_FIFO_SIZE;
+}
+
+#define FIFOC(_base) ((struct mpc512x_psc_fifo __iomem *) \
+                   ((u32)(_base) + sizeof(struct mpc52xx_psc)))
+
+/* Init PSC FIFO Controller */
+static int __init mpc512x_psc_fifoc_init(void)
+{
+       struct device_node *np;
+       void __iomem *psc;
+       unsigned int tx_fifo_size;
+       unsigned int rx_fifo_size;
+       int fifobase = 0; /* current fifo address in 32 bit words */
+
+       np = of_find_compatible_node(NULL, NULL,
+                                    "fsl,mpc5121-psc-fifo");
+       if (!np) {
+               pr_err("%s: Can't find FIFOC node\n", __func__);
+               return -ENODEV;
+       }
+
+       psc_fifoc = of_iomap(np, 0);
+       if (!psc_fifoc) {
+               pr_err("%s: Can't map FIFOC\n", __func__);
+               return -ENODEV;
+       }
+
+       psc_fifoc_irq = irq_of_parse_and_map(np, 0);
+       of_node_put(np);
+       if (psc_fifoc_irq == NO_IRQ) {
+               pr_err("%s: Can't get FIFOC irq\n", __func__);
+               iounmap(psc_fifoc);
+               return -ENODEV;
+       }
+
+       for_each_compatible_node(np, NULL, "fsl,mpc5121-psc-uart") {
+               tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size");
+               rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size");
+
+               /* size in register is in 4 byte units */
+               tx_fifo_size /= 4;
+               rx_fifo_size /= 4;
+               if (!tx_fifo_size)
+                       tx_fifo_size = 1;
+               if (!rx_fifo_size)
+                       rx_fifo_size = 1;
+
+               psc = of_iomap(np, 0);
+               if (!psc) {
+                       pr_err("%s: Can't map %s device\n",
+                               __func__, np->full_name);
+                       continue;
+               }
+
+               /* FIFO space is 4KiB, check if requested size is available */
+               if ((fifobase + tx_fifo_size + rx_fifo_size) > 0x1000) {
+                       pr_err("%s: no fifo space available for %s\n",
+                               __func__, np->full_name);
+                       iounmap(psc);
+                       /*
+                        * chances are that another device requests less
+                        * fifo space, so we continue.
+                        */
+                       continue;
+               }
+               /* set tx and rx fifo size registers */
+               out_be32(&FIFOC(psc)->txsz, (fifobase << 16) | tx_fifo_size);
+               fifobase += tx_fifo_size;
+               out_be32(&FIFOC(psc)->rxsz, (fifobase << 16) | rx_fifo_size);
+               fifobase += rx_fifo_size;
+
+               /* reset and enable the slices */
+               out_be32(&FIFOC(psc)->txcmd, 0x80);
+               out_be32(&FIFOC(psc)->txcmd, 0x01);
+               out_be32(&FIFOC(psc)->rxcmd, 0x80);
+               out_be32(&FIFOC(psc)->rxcmd, 0x01);
+
+               iounmap(psc);
+       }
+
+       return 0;
+}
+
+static void __exit mpc512x_psc_fifoc_uninit(void)
+{
+       iounmap(psc_fifoc);
+}
+
+/* 512x specific interrupt handler. The caller holds the port lock */
+static irqreturn_t mpc512x_psc_handle_irq(struct uart_port *port)
+{
+       unsigned long fifoc_int;
+       int psc_num;
+
+       /* Read pending PSC FIFOC interrupts */
+       fifoc_int = in_be32(&psc_fifoc->fifoc_int);
+
+       /* Check if it is an interrupt for this port */
+       psc_num = (port->mapbase & 0xf00) >> 8;
+       if (test_bit(psc_num, &fifoc_int) ||
+           test_bit(psc_num + 16, &fifoc_int))
+               return mpc5xxx_uart_process_int(port);
+
+       return IRQ_NONE;
+}
+
+static int mpc512x_psc_clock(struct uart_port *port, int enable)
+{
+       struct clk *psc_clk;
+       int psc_num;
+       char clk_name[10];
+
+       if (uart_console(port))
+               return 0;
+
+       psc_num = (port->mapbase & 0xf00) >> 8;
+       snprintf(clk_name, sizeof(clk_name), "psc%d_clk", psc_num);
+       psc_clk = clk_get(port->dev, clk_name);
+       if (IS_ERR(psc_clk)) {
+               dev_err(port->dev, "Failed to get PSC clock entry!\n");
+               return -ENODEV;
+       }
+
+       dev_dbg(port->dev, "%s %sable\n", clk_name, enable ? "en" : "dis");
+
+       if (enable)
+               clk_enable(psc_clk);
+       else
+               clk_disable(psc_clk);
+
+       return 0;
+}
+
+static void mpc512x_psc_get_irq(struct uart_port *port, struct device_node *np)
+{
+       port->irqflags = IRQF_SHARED;
+       port->irq = psc_fifoc_irq;
+}
+
 static struct psc_ops mpc512x_psc_ops = {
        .fifo_init = mpc512x_psc_fifo_init,
        .raw_rx_rdy = mpc512x_psc_raw_rx_rdy,
@@ -410,6 +601,11 @@ static struct psc_ops mpc512x_psc_ops = {
        .cw_disable_ints = mpc512x_psc_cw_disable_ints,
        .cw_restore_ints = mpc512x_psc_cw_restore_ints,
        .getuartclk = mpc512x_getuartclk,
+       .clock = mpc512x_psc_clock,
+       .fifoc_init = mpc512x_psc_fifoc_init,
+       .fifoc_uninit = mpc512x_psc_fifoc_uninit,
+       .get_irq = mpc512x_psc_get_irq,
+       .handle_irq = mpc512x_psc_handle_irq,
 };
 #endif
 
@@ -519,10 +715,15 @@ mpc52xx_uart_startup(struct uart_port *port)
        struct mpc52xx_psc __iomem *psc = PSC(port);
        int ret;
 
+       if (psc_ops->clock) {
+               ret = psc_ops->clock(port, 1);
+               if (ret)
+                       return ret;
+       }
+
        /* Request IRQ */
        ret = request_irq(port->irq, mpc52xx_uart_int,
-               IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
-               "mpc52xx_psc_uart", port);
+                         port->irqflags, "mpc52xx_psc_uart", port);
        if (ret)
                return ret;
 
@@ -553,6 +754,9 @@ mpc52xx_uart_shutdown(struct uart_port *port)
        port->read_status_mask = 0;
        out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
 
+       if (psc_ops->clock)
+               psc_ops->clock(port, 0);
+
        /* Release interrupt */
        free_irq(port->irq, port);
 }
@@ -851,15 +1055,12 @@ mpc52xx_uart_int_tx_chars(struct uart_port *port)
 }
 
 static irqreturn_t
-mpc52xx_uart_int(int irq, void *dev_id)
+mpc5xxx_uart_process_int(struct uart_port *port)
 {
-       struct uart_port *port = dev_id;
        unsigned long pass = ISR_PASS_LIMIT;
        unsigned int keepgoing;
        u8 status;
 
-       spin_lock(&port->lock);
-
        /* While we have stuff to do, we continue */
        do {
                /* If we don't find anything to do, we stop */
@@ -886,11 +1087,23 @@ mpc52xx_uart_int(int irq, void *dev_id)
 
        } while (keepgoing);
 
-       spin_unlock(&port->lock);
-
        return IRQ_HANDLED;
 }
 
+static irqreturn_t
+mpc52xx_uart_int(int irq, void *dev_id)
+{
+       struct uart_port *port = dev_id;
+       irqreturn_t ret;
+
+       spin_lock(&port->lock);
+
+       ret = psc_ops->handle_irq(port);
+
+       spin_unlock(&port->lock);
+
+       return ret;
+}
 
 /* ======================================================================== */
 /* Console ( if applicable )                                                */
@@ -1152,7 +1365,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
                return -EINVAL;
        }
 
-       port->irq = irq_of_parse_and_map(op->node, 0);
+       psc_ops->get_irq(port, op->node);
        if (port->irq == NO_IRQ) {
                dev_dbg(&op->dev, "Could not get irq\n");
                return -EINVAL;
@@ -1163,10 +1376,8 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 
        /* Add the port to the uart sub-system */
        ret = uart_add_one_port(&mpc52xx_uart_driver, port);
-       if (ret) {
-               irq_dispose_mapping(port->irq);
+       if (ret)
                return ret;
-       }
 
        dev_set_drvdata(&op->dev, (void *)port);
        return 0;
@@ -1178,10 +1389,8 @@ mpc52xx_uart_of_remove(struct of_device *op)
        struct uart_port *port = dev_get_drvdata(&op->dev);
        dev_set_drvdata(&op->dev, NULL);
 
-       if (port) {
+       if (port)
                uart_remove_one_port(&mpc52xx_uart_driver, port);
-               irq_dispose_mapping(port->irq);
-       }
 
        return 0;
 }
@@ -1288,6 +1497,15 @@ mpc52xx_uart_init(void)
 
        mpc52xx_uart_of_enumerate();
 
+       /*
+        * Map the PSC FIFO Controller and init if on MPC512x.
+        */
+       if (psc_ops->fifoc_init) {
+               ret = psc_ops->fifoc_init();
+               if (ret)
+                       return ret;
+       }
+
        ret = of_register_platform_driver(&mpc52xx_uart_of_driver);
        if (ret) {
                printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n",
@@ -1302,6 +1520,9 @@ mpc52xx_uart_init(void)
 static void __exit
 mpc52xx_uart_exit(void)
 {
+       if (psc_ops->fifoc_uninit)
+               psc_ops->fifoc_uninit();
+
        of_unregister_platform_driver(&mpc52xx_uart_of_driver);
        uart_unregister_driver(&mpc52xx_uart_driver);
 }
index 0700cd10b97ccbbd49f889b5ab3af26435e3003f..f020de1cdd5035155bbb4f3c95ba847e81b1c52b 100644 (file)
 #include <asm/sections.h>
 #include <asm/io.h>
 #include <asm/irq.h>
+
+#ifdef CONFIG_PPC_PMAC
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/pmac_feature.h>
 #include <asm/dbdma.h>
 #include <asm/macio.h>
+#else
+#include <linux/platform_device.h>
+#define of_machine_is_compatible(x) (0)
+#endif
 
 #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
 
 static char version[] __initdata = "pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
-MODULE_DESCRIPTION("Driver for the PowerMac serial ports.");
+MODULE_DESCRIPTION("Driver for the Mac and PowerMac serial ports.");
 MODULE_LICENSE("GPL");
 
-#define PWRDBG(fmt, arg...)    printk(KERN_DEBUG fmt , ## arg)
-
 #ifdef CONFIG_SERIAL_PMACZILOG_TTYS
 #define PMACZILOG_MAJOR                TTY_MAJOR
 #define PMACZILOG_MINOR                64
@@ -153,8 +157,8 @@ static void pmz_load_zsregs(struct uart_pmac_port *uap, u8 *regs)
        write_zsreg(uap, R10, regs[R10]);
 
        /* Set TX/RX controls sans the enable bits.  */
-               write_zsreg(uap, R3, regs[R3] & ~RxENABLE);
-               write_zsreg(uap, R5, regs[R5] & ~TxENABLE);
+       write_zsreg(uap, R3, regs[R3] & ~RxENABLE);
+       write_zsreg(uap, R5, regs[R5] & ~TxENABLE);
 
        /* now set R7 "prime" on ESCC */
        write_zsreg(uap, R15, regs[R15] | EN85C30);
@@ -205,7 +209,7 @@ static void pmz_load_zsregs(struct uart_pmac_port *uap, u8 *regs)
  */
 static void pmz_maybe_update_regs(struct uart_pmac_port *uap)
 {
-               if (!ZS_REGS_HELD(uap)) {
+       if (!ZS_REGS_HELD(uap)) {
                if (ZS_TX_ACTIVE(uap)) {
                        uap->flags |= PMACZILOG_FLAG_REGS_HELD;
                } else {
@@ -281,7 +285,7 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
                        spin_lock(&uap->port.lock);
                        if (swallow)
                                goto next_char;
-               }
+               }
 #endif /* CONFIG_MAGIC_SYSRQ && CONFIG_SERIAL_CORE_CONSOLE */
 
                /* A real serial line, record the character and status.  */
@@ -317,7 +321,7 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
 
                if (uap->port.ignore_status_mask == 0xff ||
                    (r1 & uap->port.ignore_status_mask) == 0) {
-                       tty_insert_flip_char(tty, ch, flag);
+                       tty_insert_flip_char(tty, ch, flag);
                }
                if (r1 & Rx_OVR)
                        tty_insert_flip_char(tty, 0, TTY_OVERRUN);
@@ -341,7 +345,7 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
        uap->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK);
        write_zsreg(uap, R1, uap->curregs[R1]);
        zssync(uap);
-       dev_err(&uap->dev->ofdev.dev, "pmz: rx irq flood !\n");
+       pmz_error("pmz: rx irq flood !\n");
        return tty;
 }
 
@@ -411,6 +415,17 @@ static void pmz_transmit_chars(struct uart_pmac_port *uap)
                goto ack_tx_int;
        }
 
+       /* Under some circumstances, we see interrupts reported for
+        * a closed channel. The interrupt mask in R1 is clear, but
+        * R3 still signals the interrupts and we see them when taking
+        * an interrupt for the other channel (this could be a qemu
+        * bug but since the ESCC doc doesn't specify precsiely whether
+        * R3 interrup status bits are masked by R1 interrupt enable
+        * bits, better safe than sorry). --BenH.
+        */
+       if (!ZS_IS_OPEN(uap))
+               goto ack_tx_int;
+
        if (uap->port.x_char) {
                uap->flags |= PMACZILOG_FLAG_TX_ACTIVE;
                write_zsdata(uap, uap->port.x_char);
@@ -459,47 +474,47 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)
 
        uap_a = pmz_get_port_A(uap);
        uap_b = uap_a->mate;
-       
-               spin_lock(&uap_a->port.lock);
+
+       spin_lock(&uap_a->port.lock);
        r3 = read_zsreg(uap_a, R3);
 
 #ifdef DEBUG_HARD
        pmz_debug("irq, r3: %x\n", r3);
 #endif
-               /* Channel A */
+       /* Channel A */
        tty = NULL;
-               if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
+       if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
                write_zsreg(uap_a, R0, RES_H_IUS);
                zssync(uap_a);          
-                       if (r3 & CHAEXT)
-                               pmz_status_handle(uap_a);
+               if (r3 & CHAEXT)
+                       pmz_status_handle(uap_a);
                if (r3 & CHARxIP)
                        tty = pmz_receive_chars(uap_a);
-                       if (r3 & CHATxIP)
-                               pmz_transmit_chars(uap_a);
-               rc = IRQ_HANDLED;
-               }
-               spin_unlock(&uap_a->port.lock);
+               if (r3 & CHATxIP)
+                       pmz_transmit_chars(uap_a);
+               rc = IRQ_HANDLED;
+       }
+       spin_unlock(&uap_a->port.lock);
        if (tty != NULL)
                tty_flip_buffer_push(tty);
 
        if (uap_b->node == NULL)
                goto out;
 
-               spin_lock(&uap_b->port.lock);
+       spin_lock(&uap_b->port.lock);
        tty = NULL;
        if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
                write_zsreg(uap_b, R0, RES_H_IUS);
                zssync(uap_b);
-                       if (r3 & CHBEXT)
-                               pmz_status_handle(uap_b);
-                       if (r3 & CHBRxIP)
-                               tty = pmz_receive_chars(uap_b);
-                       if (r3 & CHBTxIP)
-                               pmz_transmit_chars(uap_b);
-               rc = IRQ_HANDLED;
-               }
-               spin_unlock(&uap_b->port.lock);
+               if (r3 & CHBEXT)
+                       pmz_status_handle(uap_b);
+               if (r3 & CHBRxIP)
+                       tty = pmz_receive_chars(uap_b);
+               if (r3 & CHBTxIP)
+                       pmz_transmit_chars(uap_b);
+               rc = IRQ_HANDLED;
+       }
+       spin_unlock(&uap_b->port.lock);
        if (tty != NULL)
                tty_flip_buffer_push(tty);
 
@@ -707,7 +722,7 @@ static void pmz_enable_ms(struct uart_port *port)
 
                if (ZS_IS_ASLEEP(uap))
                        return;
-               /* NOTE: Not subject to 'transmitter active' rule.  */ 
+               /* NOTE: Not subject to 'transmitter active' rule. */
                write_zsreg(uap, R15, uap->curregs[R15]);
        }
 }
@@ -737,7 +752,7 @@ static void pmz_break_ctl(struct uart_port *port, int break_state)
        if (new_reg != uap->curregs[R5]) {
                uap->curregs[R5] = new_reg;
 
-               /* NOTE: Not subject to 'transmitter active' rule.  */ 
+               /* NOTE: Not subject to 'transmitter active' rule. */
                if (ZS_IS_ASLEEP(uap))
                        return;
                write_zsreg(uap, R5, uap->curregs[R5]);
@@ -746,6 +761,8 @@ static void pmz_break_ctl(struct uart_port *port, int break_state)
        spin_unlock_irqrestore(&port->lock, flags);
 }
 
+#ifdef CONFIG_PPC_PMAC
+
 /*
  * Turn power on or off to the SCC and associated stuff
  * (port drivers, modem, IR port, etc.)
@@ -781,6 +798,15 @@ static int pmz_set_scc_power(struct uart_pmac_port *uap, int state)
        return delay;
 }
 
+#else
+
+static int pmz_set_scc_power(struct uart_pmac_port *uap, int state)
+{
+       return 0;
+}
+
+#endif /* !CONFIG_PPC_PMAC */
+
 /*
  * FixZeroBug....Works around a bug in the SCC receving channel.
  * Inspired from Darwin code, 15 Sept. 2000  -DanM
@@ -897,7 +923,6 @@ static int __pmz_startup(struct uart_pmac_port *uap)
        /* Remember status for DCD/CTS changes */
        uap->prev_status = read_zsreg(uap, R0);
 
-
        return pwr_delay;
 }
 
@@ -944,9 +969,9 @@ static int pmz_startup(struct uart_port *port)
        }       
 
        pmz_get_port_A(uap)->flags |= PMACZILOG_FLAG_IS_IRQ_ON;
-       if (request_irq(uap->port.irq, pmz_interrupt, IRQF_SHARED, "PowerMac Zilog", uap)) {
-               dev_err(&uap->dev->ofdev.dev,
-                       "Unable to register zs interrupt handler.\n");
+       if (request_irq(uap->port.irq, pmz_interrupt, IRQF_SHARED,
+                       "SCC", uap)) {
+               pmz_error("Unable to register zs interrupt handler.\n");
                pmz_set_scc_power(uap, 0);
                mutex_unlock(&pmz_irq_mutex);
                return -ENXIO;
@@ -972,7 +997,7 @@ static int pmz_startup(struct uart_port *port)
        if (!ZS_IS_EXTCLK(uap))
                uap->curregs[R1] |= EXT_INT_ENAB;
        write_zsreg(uap, R1, uap->curregs[R1]);
-               spin_unlock_irqrestore(&port->lock, flags);
+       spin_unlock_irqrestore(&port->lock, flags);
 
        pmz_debug("pmz: startup() done.\n");
 
@@ -992,7 +1017,7 @@ static void pmz_shutdown(struct uart_port *port)
        mutex_lock(&pmz_irq_mutex);
 
        /* Release interrupt handler */
-               free_irq(uap->port.irq, uap);
+       free_irq(uap->port.irq, uap);
 
        spin_lock_irqsave(&port->lock, flags);
 
@@ -1040,7 +1065,6 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag,
 {
        int brg;
 
-
        /* Switch to external clocking for IrDA high clock rates. That
         * code could be re-used for Midi interfaces with different
         * multipliers
@@ -1187,7 +1211,7 @@ static void pmz_irda_setup(struct uart_pmac_port *uap, unsigned long *baud)
        while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0
               || (read_zsreg(uap, R1) & ALL_SNT) == 0) {
                if (--t <= 0) {
-                       dev_err(&uap->dev->ofdev.dev, "transmitter didn't drain\n");
+                       pmz_error("transmitter didn't drain\n");
                        return;
                }
                udelay(10);
@@ -1203,7 +1227,7 @@ static void pmz_irda_setup(struct uart_pmac_port *uap, unsigned long *baud)
                read_zsdata(uap);
                mdelay(10);
                if (--t <= 0) {
-                       dev_err(&uap->dev->ofdev.dev, "receiver didn't drain\n");
+                       pmz_error("receiver didn't drain\n");
                        return;
                }
        }
@@ -1212,20 +1236,19 @@ static void pmz_irda_setup(struct uart_pmac_port *uap, unsigned long *baud)
        uap->curregs[R5] |= DTR;
        write_zsreg(uap, R5, uap->curregs[R5]);
        zssync(uap);
-               mdelay(1);
+       mdelay(1);
 
        /* Switch SCC to 19200 */
        pmz_convert_to_zs(uap, CS8, 0, 19200);          
        pmz_load_zsregs(uap, uap->curregs);
-               mdelay(1);
+       mdelay(1);
 
        /* Write get_version command byte */
        write_zsdata(uap, 1);
        t = 5000;
        while ((read_zsreg(uap, R0) & Rx_CH_AV) == 0) {
                if (--t <= 0) {
-                       dev_err(&uap->dev->ofdev.dev,
-                               "irda_setup timed out on get_version byte\n");
+                       pmz_error("irda_setup timed out on get_version byte\n");
                        goto out;
                }
                udelay(10);
@@ -1233,8 +1256,7 @@ static void pmz_irda_setup(struct uart_pmac_port *uap, unsigned long *baud)
        version = read_zsdata(uap);
 
        if (version < 4) {
-               dev_info(&uap->dev->ofdev.dev, "IrDA: dongle version %d not supported\n",
-                        version);
+               pmz_info("IrDA: dongle version %d not supported\n", version);
                goto out;
        }
 
@@ -1243,18 +1265,16 @@ static void pmz_irda_setup(struct uart_pmac_port *uap, unsigned long *baud)
        t = 5000;
        while ((read_zsreg(uap, R0) & Rx_CH_AV) == 0) {
                if (--t <= 0) {
-                       dev_err(&uap->dev->ofdev.dev,
-                               "irda_setup timed out on speed mode byte\n");
+                       pmz_error("irda_setup timed out on speed mode byte\n");
                        goto out;
                }
                udelay(10);
        }
        t = read_zsdata(uap);
        if (t != cmdbyte)
-               dev_err(&uap->dev->ofdev.dev,
-                       "irda_setup speed mode byte = %x (%x)\n", t, cmdbyte);
+               pmz_error("irda_setup speed mode byte = %x (%x)\n", t, cmdbyte);
 
-       dev_info(&uap->dev->ofdev.dev, "IrDA setup for %ld bps, dongle version: %d\n",
+       pmz_info("IrDA setup for %ld bps, dongle version: %d\n",
                 *baud, version);
 
        (void)read_zsdata(uap);
@@ -1404,7 +1424,7 @@ static void pmz_poll_put_char(struct uart_port *port, unsigned char c)
        write_zsdata(uap, c);
 }
 
-#endif
+#endif /* CONFIG_CONSOLE_POLL */
 
 static struct uart_ops pmz_pops = {
        .tx_empty       =       pmz_tx_empty,
@@ -1429,6 +1449,8 @@ static struct uart_ops pmz_pops = {
 #endif
 };
 
+#ifdef CONFIG_PPC_PMAC
+
 /*
  * Setup one port structure after probing, HW is down at this point,
  * Unlike sunzilog, we don't need to pre-init the spinlock as we don't
@@ -1452,7 +1474,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
                return -ENODEV;
        uap->port.mapbase = r_ports.start;
        uap->port.membase = ioremap(uap->port.mapbase, 0x1000);
-      
+
        uap->control_reg = uap->port.membase;
        uap->data_reg = uap->control_reg + 0x10;
        
@@ -1579,7 +1601,7 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
 }
 
 /*
- * Called upon match with an escc node in the devive-tree.
+ * Called upon match with an escc node in the device-tree.
  */
 static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
 {
@@ -1801,7 +1823,7 @@ static int __init pmz_probe(void)
                pmz_ports[count].node           = node_a;
                pmz_ports[count+1].node         = node_b;
                pmz_ports[count].port.line      = count;
-               pmz_ports[count+1].port.line    = count+1;
+               pmz_ports[count+1].port.line    = count+1;
 
                /*
                 * Setup the ports for real
@@ -1825,6 +1847,88 @@ next:
        return 0;
 }
 
+#else
+
+extern struct platform_device scc_a_pdev, scc_b_pdev;
+
+static int __init pmz_init_port(struct uart_pmac_port *uap)
+{
+       struct resource *r_ports;
+       int irq;
+
+       r_ports = platform_get_resource(uap->node, IORESOURCE_MEM, 0);
+       irq = platform_get_irq(uap->node, 0);
+       if (!r_ports || !irq)
+               return -ENODEV;
+
+       uap->port.mapbase  = r_ports->start;
+       uap->port.membase  = (unsigned char __iomem *) r_ports->start;
+       uap->port.iotype   = UPIO_MEM;
+       uap->port.irq      = irq;
+       uap->port.uartclk  = ZS_CLOCK;
+       uap->port.fifosize = 1;
+       uap->port.ops      = &pmz_pops;
+       uap->port.type     = PORT_PMAC_ZILOG;
+       uap->port.flags    = 0;
+
+       uap->control_reg   = uap->port.membase;
+       uap->data_reg      = uap->control_reg + 4;
+       uap->port_type     = 0;
+
+       pmz_convert_to_zs(uap, CS8, 0, 9600);
+
+       return 0;
+}
+
+static int __init pmz_probe(void)
+{
+       int err;
+
+       pmz_ports_count = 0;
+
+       pmz_ports[0].mate      = &pmz_ports[1];
+       pmz_ports[0].port.line = 0;
+       pmz_ports[0].flags     = PMACZILOG_FLAG_IS_CHANNEL_A;
+       pmz_ports[0].node      = &scc_a_pdev;
+       err = pmz_init_port(&pmz_ports[0]);
+       if (err)
+               return err;
+       pmz_ports_count++;
+
+       pmz_ports[1].mate      = &pmz_ports[0];
+       pmz_ports[1].port.line = 1;
+       pmz_ports[1].flags     = 0;
+       pmz_ports[1].node      = &scc_b_pdev;
+       err = pmz_init_port(&pmz_ports[1]);
+       if (err)
+               return err;
+       pmz_ports_count++;
+
+       return 0;
+}
+
+static void pmz_dispose_port(struct uart_pmac_port *uap)
+{
+       memset(uap, 0, sizeof(struct uart_pmac_port));
+}
+
+static int __init pmz_attach(struct platform_device *pdev)
+{
+       int i;
+
+       for (i = 0; i < pmz_ports_count; i++)
+               if (pmz_ports[i].node == pdev)
+                       return 0;
+       return -ENODEV;
+}
+
+static int __exit pmz_detach(struct platform_device *pdev)
+{
+       return 0;
+}
+
+#endif /* !CONFIG_PPC_PMAC */
+
 #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
 
 static void pmz_console_write(struct console *con, const char *s, unsigned int count);
@@ -1885,28 +1989,41 @@ err_out:
        return rc;
 }
 
+#ifdef CONFIG_PPC_PMAC
+
 static struct of_device_id pmz_match[] = 
 {
        {
-       .name           = "ch-a",
+       .name           = "ch-a",
        },
        {
-       .name           = "ch-b",
+       .name           = "ch-b",
        },
        {},
 };
 MODULE_DEVICE_TABLE (of, pmz_match);
 
-static struct macio_driver pmz_driver = 
-{
+static struct macio_driver pmz_driver = {
        .name           = "pmac_zilog",
        .match_table    = pmz_match,
        .probe          = pmz_attach,
        .remove         = pmz_detach,
        .suspend        = pmz_suspend,
-               .resume         = pmz_resume,
+       .resume         = pmz_resume,
 };
 
+#else
+
+static struct platform_driver pmz_driver = {
+       .remove         = __exit_p(pmz_detach),
+       .driver         = {
+               .name           = "scc",
+               .owner          = THIS_MODULE,
+       },
+};
+
+#endif /* !CONFIG_PPC_PMAC */
+
 static int __init init_pmz(void)
 {
        int rc, i;
@@ -1941,19 +2058,27 @@ static int __init init_pmz(void)
                        pmz_dispose_port(&pmz_ports[i]);
                return rc;
        }
-       
+
        /*
         * Then we register the macio driver itself
         */
+#ifdef CONFIG_PPC_PMAC
        return macio_register_driver(&pmz_driver);
+#else
+       return platform_driver_probe(&pmz_driver, pmz_attach);
+#endif
 }
 
 static void __exit exit_pmz(void)
 {
        int i;
 
+#ifdef CONFIG_PPC_PMAC
        /* Get rid of macio-driver (detach from macio) */
        macio_unregister_driver(&pmz_driver);
+#else
+       platform_driver_unregister(&pmz_driver);
+#endif
 
        for (i = 0; i < pmz_ports_count; i++) {
                struct uart_pmac_port *uport = &pmz_ports[i];
@@ -2020,10 +2145,10 @@ static int __init pmz_console_setup(struct console *co, char *options)
        /*
         * XServe's default to 57600 bps
         */
-       if (machine_is_compatible("RackMac1,1")
-           || machine_is_compatible("RackMac1,2")
-           || machine_is_compatible("MacRISC4"))
-               baud = 57600;
+       if (of_machine_is_compatible("RackMac1,1")
+           || of_machine_is_compatible("RackMac1,2")
+           || of_machine_is_compatible("MacRISC4"))
+               baud = 57600;
 
        /*
         * Check whether an invalid uart number has been specified, and
index f6e77f12acd5246fae120e8897de2b8b5c603f25..cbc34fbb1b20a408ad0c135549b190c8800a278f 100644 (file)
@@ -1,7 +1,15 @@
 #ifndef __PMAC_ZILOG_H__
 #define __PMAC_ZILOG_H__
 
-#define pmz_debug(fmt,arg...)  dev_dbg(&uap->dev->ofdev.dev, fmt, ## arg)
+#ifdef CONFIG_PPC_PMAC
+#define pmz_debug(fmt, arg...) dev_dbg(&uap->dev->ofdev.dev, fmt, ## arg)
+#define pmz_error(fmt, arg...) dev_err(&uap->dev->ofdev.dev, fmt, ## arg)
+#define pmz_info(fmt, arg...)  dev_info(&uap->dev->ofdev.dev, fmt, ## arg)
+#else
+#define pmz_debug(fmt, arg...) dev_dbg(&uap->node->dev, fmt, ## arg)
+#define pmz_error(fmt, arg...) dev_err(&uap->node->dev, fmt, ## arg)
+#define pmz_info(fmt, arg...)  dev_info(&uap->node->dev, fmt, ## arg)
+#endif
 
 /*
  * At most 2 ESCCs with 2 ports each
@@ -17,6 +25,7 @@ struct uart_pmac_port {
        struct uart_port                port;
        struct uart_pmac_port           *mate;
 
+#ifdef CONFIG_PPC_PMAC
        /* macio_dev for the escc holding this port (maybe be null on
         * early inited port)
         */
@@ -25,6 +34,9 @@ struct uart_pmac_port {
         * of "escc" node (ie. ch-a or ch-b)
         */
        struct device_node              *node;
+#else
+       struct platform_device          *node;
+#endif
 
        /* Port type as obtained from device tree (IRDA, modem, ...) */
        int                             port_type;
@@ -55,10 +67,12 @@ struct uart_pmac_port {
        volatile u8                     __iomem *control_reg;
        volatile u8                     __iomem *data_reg;
 
+#ifdef CONFIG_PPC_PMAC
        unsigned int                    tx_dma_irq;
        unsigned int                    rx_dma_irq;
        volatile struct dbdma_regs      __iomem *tx_dma_regs;
        volatile struct dbdma_regs      __iomem *rx_dma_regs;
+#endif
 
        struct ktermios                 termios_cache;
 };
@@ -113,7 +127,7 @@ static inline void zssync(struct uart_pmac_port *port)
 #define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
 #define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
 
-#define ZS_CLOCK         3686400       /* Z8530 RTxC input clock rate */
+#define ZS_CLOCK         3686400       /* Z8530 RTxC input clock rate */
 
 /* The Zilog register set */
 
@@ -171,7 +185,7 @@ static inline void zssync(struct uart_pmac_port *port)
 
 /* Write Register 3 */
 
-#define        RxENABLE        0x1     /* Rx Enable */
+#define        RxENABLE        0x1     /* Rx Enable */
 #define        SYNC_L_INH      0x2     /* Sync Character Load Inhibit */
 #define        ADD_SM          0x4     /* Address Search Mode (SDLC) */
 #define        RxCRC_ENAB      0x8     /* Rx CRC Enable */
@@ -185,7 +199,7 @@ static inline void zssync(struct uart_pmac_port *port)
 
 /* Write Register 4 */
 
-#define        PAR_ENAB        0x1     /* Parity Enable */
+#define        PAR_ENAB        0x1     /* Parity Enable */
 #define        PAR_EVEN        0x2     /* Parity Even/Odd* */
 
 #define        SYNC_ENAB       0       /* Sync Modes Enable */
@@ -210,7 +224,7 @@ static inline void zssync(struct uart_pmac_port *port)
 #define        TxCRC_ENAB      0x1     /* Tx CRC Enable */
 #define        RTS             0x2     /* RTS */
 #define        SDLC_CRC        0x4     /* SDLC/CRC-16 */
-#define        TxENABLE        0x8     /* Tx Enable */
+#define        TxENABLE        0x8     /* Tx Enable */
 #define        SND_BRK         0x10    /* Send Break */
 #define        Tx5             0x0     /* Tx 5 bits (or less)/character */
 #define        Tx7             0x20    /* Tx 7 bits/character */
@@ -372,11 +386,11 @@ static inline void zssync(struct uart_pmac_port *port)
 #define ZS_TX_ACTIVE(UP)               ((UP)->flags & PMACZILOG_FLAG_TX_ACTIVE)
 #define ZS_WANTS_MODEM_STATUS(UP)      ((UP)->flags & PMACZILOG_FLAG_MODEM_STATUS)
 #define ZS_IS_IRDA(UP)                 ((UP)->flags & PMACZILOG_FLAG_IS_IRDA)
-#define ZS_IS_INTMODEM(UP)             ((UP)->flags & PMACZILOG_FLAG_IS_INTMODEM)
+#define ZS_IS_INTMODEM(UP)             ((UP)->flags & PMACZILOG_FLAG_IS_INTMODEM)
 #define ZS_HAS_DMA(UP)                 ((UP)->flags & PMACZILOG_FLAG_HAS_DMA)
-#define ZS_IS_ASLEEP(UP)                       ((UP)->flags & PMACZILOG_FLAG_IS_ASLEEP)
-#define ZS_IS_OPEN(UP)                 ((UP)->flags & PMACZILOG_FLAG_IS_OPEN)
-#define ZS_IS_IRQ_ON(UP)                       ((UP)->flags & PMACZILOG_FLAG_IS_IRQ_ON)
-#define ZS_IS_EXTCLK(UP)                       ((UP)->flags & PMACZILOG_FLAG_IS_EXTCLK)
+#define ZS_IS_ASLEEP(UP)               ((UP)->flags & PMACZILOG_FLAG_IS_ASLEEP)
+#define ZS_IS_OPEN(UP)                 ((UP)->flags & PMACZILOG_FLAG_IS_OPEN)
+#define ZS_IS_IRQ_ON(UP)               ((UP)->flags & PMACZILOG_FLAG_IS_IRQ_ON)
+#define ZS_IS_EXTCLK(UP)               ((UP)->flags & PMACZILOG_FLAG_IS_EXTCLK)
 
 #endif /* __PMAC_ZILOG_H__ */
index 047530b285bb3a50ddf15d8804080980d9539978..7f28307095121766d685350dad865e72f7d312c2 100644 (file)
@@ -385,13 +385,20 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
                }
 
                /*
-                * As a last resort, if the quotient is zero,
-                * default to 9600 bps
+                * As a last resort, if the range cannot be met then clip to
+                * the nearest chip supported rate.
                 */
-               if (!hung_up)
-                       tty_termios_encode_baud_rate(termios, 9600, 9600);
+               if (!hung_up) {
+                       if (baud <= min)
+                               tty_termios_encode_baud_rate(termios,
+                                                       min + 1, min + 1);
+                       else
+                               tty_termios_encode_baud_rate(termios,
+                                                       max - 1, max - 1);
+               }
        }
-
+       /* Should never happen */
+       WARN_ON(1);
        return 0;
 }
 
@@ -2006,12 +2013,6 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
 
        mutex_lock(&port->mutex);
 
-       if (!console_suspend_enabled && uart_console(uport)) {
-               /* we're going to avoid suspending serial console */
-               mutex_unlock(&port->mutex);
-               return 0;
-       }
-
        tty_dev = device_find_child(uport->dev, &match, serial_match_port);
        if (device_may_wakeup(tty_dev)) {
                enable_irq_wake(uport->irq);
@@ -2019,20 +2020,23 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
                mutex_unlock(&port->mutex);
                return 0;
        }
-       uport->suspended = 1;
+       if (console_suspend_enabled || !uart_console(uport))
+               uport->suspended = 1;
 
        if (port->flags & ASYNC_INITIALIZED) {
                const struct uart_ops *ops = uport->ops;
                int tries;
 
-               set_bit(ASYNCB_SUSPENDED, &port->flags);
-               clear_bit(ASYNCB_INITIALIZED, &port->flags);
+               if (console_suspend_enabled || !uart_console(uport)) {
+                       set_bit(ASYNCB_SUSPENDED, &port->flags);
+                       clear_bit(ASYNCB_INITIALIZED, &port->flags);
 
-               spin_lock_irq(&uport->lock);
-               ops->stop_tx(uport);
-               ops->set_mctrl(uport, 0);
-               ops->stop_rx(uport);
-               spin_unlock_irq(&uport->lock);
+                       spin_lock_irq(&uport->lock);
+                       ops->stop_tx(uport);
+                       ops->set_mctrl(uport, 0);
+                       ops->stop_rx(uport);
+                       spin_unlock_irq(&uport->lock);
+               }
 
                /*
                 * Wait for the transmitter to empty.
@@ -2047,16 +2051,18 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
                               drv->dev_name,
                               drv->tty_driver->name_base + uport->line);
 
-               ops->shutdown(uport);
+               if (console_suspend_enabled || !uart_console(uport))
+                       ops->shutdown(uport);
        }
 
        /*
         * Disable the console device before suspending.
         */
-       if (uart_console(uport))
+       if (console_suspend_enabled && uart_console(uport))
                console_stop(uport->cons);
 
-       uart_change_pm(state, 3);
+       if (console_suspend_enabled || !uart_console(uport))
+               uart_change_pm(state, 3);
 
        mutex_unlock(&port->mutex);
 
@@ -2073,29 +2079,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 
        mutex_lock(&port->mutex);
 
-       if (!console_suspend_enabled && uart_console(uport)) {
-               /* no need to resume serial console, it wasn't suspended */
-               /*
-                * First try to use the console cflag setting.
-                */
-               memset(&termios, 0, sizeof(struct ktermios));
-               termios.c_cflag = uport->cons->cflag;
-               /*
-                * If that's unset, use the tty termios setting.
-                */
-               if (termios.c_cflag == 0)
-                       termios = *state->port.tty->termios;
-               else {
-                       termios.c_ispeed = termios.c_ospeed =
-                               tty_termios_input_baud_rate(&termios);
-                       termios.c_ispeed = termios.c_ospeed =
-                               tty_termios_baud_rate(&termios);
-               }
-               uport->ops->set_termios(uport, &termios, NULL);
-               mutex_unlock(&port->mutex);
-               return 0;
-       }
-
        tty_dev = device_find_child(uport->dev, &match, serial_match_port);
        if (!uport->suspended && device_may_wakeup(tty_dev)) {
                disable_irq_wake(uport->irq);
@@ -2121,21 +2104,23 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
                spin_lock_irq(&uport->lock);
                ops->set_mctrl(uport, 0);
                spin_unlock_irq(&uport->lock);
-               ret = ops->startup(uport);
-               if (ret == 0) {
-                       uart_change_speed(state, NULL);
-                       spin_lock_irq(&uport->lock);
-                       ops->set_mctrl(uport, uport->mctrl);
-                       ops->start_tx(uport);
-                       spin_unlock_irq(&uport->lock);
-                       set_bit(ASYNCB_INITIALIZED, &port->flags);
-               } else {
-                       /*
-                        * Failed to resume - maybe hardware went away?
-                        * Clear the "initialized" flag so we won't try
-                        * to call the low level drivers shutdown method.
-                        */
-                       uart_shutdown(state);
+               if (console_suspend_enabled || !uart_console(uport)) {
+                       ret = ops->startup(uport);
+                       if (ret == 0) {
+                               uart_change_speed(state, NULL);
+                               spin_lock_irq(&uport->lock);
+                               ops->set_mctrl(uport, uport->mctrl);
+                               ops->start_tx(uport);
+                               spin_unlock_irq(&uport->lock);
+                               set_bit(ASYNCB_INITIALIZED, &port->flags);
+                       } else {
+                               /*
+                                * Failed to resume - maybe hardware went away?
+                                * Clear the "initialized" flag so we won't try
+                                * to call the low level drivers shutdown method.
+                                */
+                               uart_shutdown(state);
+                       }
                }
 
                clear_bit(ASYNCB_SUSPENDED, &port->flags);
index 0ee7239c5d694aa3c5b05f1c05e246d975e11c35..e91db4b380120fb1eae857179c1d42006b545bb1 100644 (file)
@@ -146,7 +146,8 @@ static void quirk_wakeup_oxsemi(struct pcmcia_device *link)
 {
        struct serial_info *info = link->priv;
 
-       outb(12, info->c950ctrl + 1);
+       if (info->c950ctrl)
+               outb(12, info->c950ctrl + 1);
 }
 
 /* request_region? oxsemi branch does no request_region too... */
@@ -695,11 +696,11 @@ static int serial_config(struct pcmcia_device * link)
                info->multi = info->quirk->multi;
 
        if (info->multi > 1)
-               multi_config(link);
+               i = multi_config(link);
        else
-               simple_config(link);
+               i = simple_config(link);
 
-       if (info->ndev == 0)
+       if (i || info->ndev == 0)
                goto failed;
 
        /*
@@ -714,6 +715,7 @@ static int serial_config(struct pcmcia_device * link)
        return 0;
 
 failed:
+       dev_warn(&link->dev, "serial_cs: failed to initialize\n");
        serial_remove(link);
        return -ENODEV;
 }
@@ -757,6 +759,7 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
        PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
        PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
+       PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0e01),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0a05),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x1101),
        PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
index 37f0de9dd9ce555caff819a93b97148db4d61798..42f3333c4ad09c9ccaf38973b3722dbb68b5e2e6 100644 (file)
@@ -1052,7 +1052,18 @@ static void __devinit sci_init_single(struct platform_device *dev,
        sci_port->port.ops      = &sci_uart_ops;
        sci_port->port.iotype   = UPIO_MEM;
        sci_port->port.line     = index;
-       sci_port->port.fifosize = 1;
+
+       switch (p->type) {
+       case PORT_SCIFA:
+               sci_port->port.fifosize = 64;
+               break;
+       case PORT_SCIF:
+               sci_port->port.fifosize = 16;
+               break;
+       default:
+               sci_port->port.fifosize = 1;
+               break;
+       }
 
        if (dev) {
                sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL;
index 0efcded59ae613bdf1dd8aa906599bff9e5904f8..f7d2589926d22d35f37590ff1f3e94cb479edb6f 100644 (file)
@@ -518,34 +518,6 @@ static inline int sci_rxd_in(struct uart_port *port)
 {
        if (port->mapbase == 0xfffffe80)
                return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
-       if (port->mapbase == 0xa4000150)
-               return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xa4000140)
-               return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == SCIF0)
-               return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
-       if (port->mapbase == SCIF2)
-               return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-         return sci_in(port,SCxSR)&0x0010 ? 1 : 0;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7721)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xa4430000)
-               return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
-       else if (port->mapbase == 0xa4438000)
-               return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
        return 1;
 }
 #elif defined(CONFIG_CPU_SUBTYPE_SH7750)  || \
@@ -558,207 +530,17 @@ static inline int sci_rxd_in(struct uart_port *port)
 {
        if (port->mapbase == 0xffe00000)
                return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
-       if (port->mapbase == 0xffe80000)
-               return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe80000)
-               return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
        return 1;
 }
-#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xfe4b0000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0;
-       if (port->mapbase == 0xfe4c0000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0;
-       if (port->mapbase == 0xfe4d0000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xfe600000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfe610000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfe620000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe10000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe20000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe30000)
-               return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */
-       if (port->mapbase == 0xffe10000)
-               return __raw_readb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */
-       if (port->mapbase == 0xffe20000)
-               return __raw_readb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */
-
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-        if (port->mapbase == 0xffe00000)
-                return __raw_readb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */
-        if (port->mapbase == 0xffe10000)
-                return __raw_readb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */
-        if (port->mapbase == 0xffe20000)
-                return __raw_readb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */
-        if (port->mapbase == 0xa4e30000)
-                return __raw_readb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */
-        if (port->mapbase == 0xa4e40000)
-                return __raw_readb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */
-        if (port->mapbase == 0xa4e50000)
-                return __raw_readb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */
-        return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
-#  define SCFSR    0x0010
-#  define SCASSR   0x0014
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->type == PORT_SCIF)
-               return __raw_readw((port->mapbase + SCFSR))  & SCIF_BRK ? 1 : 0;
-       if (port->type == PORT_SCIFA)
-               return __raw_readw((port->mapbase + SCASSR)) & SCIF_BRK ? 1 : 0;
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-         return sci_in(port, SCSPTR)&0x0001 ? 1 : 0; /* SCIF */
-}
 #elif defined(__H8300H__) || defined(__H8300S__)
 static inline int sci_rxd_in(struct uart_port *port)
 {
        int ch = (port->mapbase - SMR0) >> 3;
        return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
 }
-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe08000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe10000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */
-
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xff923000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xff924000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xff925000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffe10000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7786)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffea0000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffeb0000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffec0000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffed0000)
-               return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffee0000)
-               return __raw_readw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffef0000)
-               return __raw_readw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7203) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7206) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7263)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xfffe8000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffe8800)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffe9000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffe9800)
-               return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
-#if defined(CONFIG_CPU_SUBTYPE_SH7201)
-       if (port->mapbase == 0xfffeA000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffeA800)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffeB000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xfffeB800)
-               return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
-#endif
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xf8400000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xf8410000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xf8420000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
+#else /* default case for non-SCI processors */
 static inline int sci_rxd_in(struct uart_port *port)
 {
-       if (port->mapbase == 0xffc30000)
-               return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffc40000)
-               return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffc50000)
-               return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-       if (port->mapbase == 0xffc60000)
-               return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
        return 1;
 }
 #endif
index 377f2712289e96b80f9cf6019d4b639df13311da..ab2ab3c818342d4cb9fd67e402523a26bd696a2f 100644 (file)
@@ -394,7 +394,7 @@ static void ulite_console_write(struct console *co, const char *s,
                spin_unlock_irqrestore(&port->lock, flags);
 }
 
-static int __init ulite_console_setup(struct console *co, char *options)
+static int __devinit ulite_console_setup(struct console *co, char *options)
 {
        struct uart_port *port;
        int baud = 9600;
index d5d7f23c19a5e5bdc399670994c324bb3e08dbff..3a5a17db94744d73d1086b0bc3e89ef6bdb62e52 100644 (file)
@@ -259,6 +259,43 @@ static void intc_disable(unsigned int irq)
        }
 }
 
+static void (*intc_enable_noprio_fns[])(unsigned long addr,
+                                       unsigned long handle,
+                                       void (*fn)(unsigned long,
+                                                  unsigned long,
+                                                  unsigned long),
+                                       unsigned int irq) = {
+       [MODE_ENABLE_REG] = intc_mode_field,
+       [MODE_MASK_REG] = intc_mode_zero,
+       [MODE_DUAL_REG] = intc_mode_field,
+       [MODE_PRIO_REG] = intc_mode_field,
+       [MODE_PCLR_REG] = intc_mode_field,
+};
+
+static void intc_enable_disable(struct intc_desc_int *d,
+                               unsigned long handle, int do_enable)
+{
+       unsigned long addr;
+       unsigned int cpu;
+       void (*fn)(unsigned long, unsigned long,
+                  void (*)(unsigned long, unsigned long, unsigned long),
+                  unsigned int);
+
+       if (do_enable) {
+               for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
+                       addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
+                       fn = intc_enable_noprio_fns[_INTC_MODE(handle)];
+                       fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
+               }
+       } else {
+               for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
+                       addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
+                       fn = intc_disable_fns[_INTC_MODE(handle)];
+                       fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
+               }
+       }
+}
+
 static int intc_set_wake(unsigned int irq, unsigned int on)
 {
        return 0; /* allow wakeup, but setup hardware in intc_suspend() */
@@ -400,11 +437,11 @@ static unsigned int __init intc_get_reg(struct intc_desc_int *d,
 static intc_enum __init intc_grp_id(struct intc_desc *desc,
                                    intc_enum enum_id)
 {
-       struct intc_group *g = desc->groups;
+       struct intc_group *g = desc->hw.groups;
        unsigned int i, j;
 
-       for (i = 0; g && enum_id && i < desc->nr_groups; i++) {
-               g = desc->groups + i;
+       for (i = 0; g && enum_id && i < desc->hw.nr_groups; i++) {
+               g = desc->hw.groups + i;
 
                for (j = 0; g->enum_ids[j]; j++) {
                        if (g->enum_ids[j] != enum_id)
@@ -417,19 +454,21 @@ static intc_enum __init intc_grp_id(struct intc_desc *desc,
        return 0;
 }
 
-static unsigned int __init intc_mask_data(struct intc_desc *desc,
-                                         struct intc_desc_int *d,
-                                         intc_enum enum_id, int do_grps)
+static unsigned int __init _intc_mask_data(struct intc_desc *desc,
+                                          struct intc_desc_int *d,
+                                          intc_enum enum_id,
+                                          unsigned int *reg_idx,
+                                          unsigned int *fld_idx)
 {
-       struct intc_mask_reg *mr = desc->mask_regs;
-       unsigned int i, j, fn, mode;
+       struct intc_mask_reg *mr = desc->hw.mask_regs;
+       unsigned int fn, mode;
        unsigned long reg_e, reg_d;
 
-       for (i = 0; mr && enum_id && i < desc->nr_mask_regs; i++) {
-               mr = desc->mask_regs + i;
+       while (mr && enum_id && *reg_idx < desc->hw.nr_mask_regs) {
+               mr = desc->hw.mask_regs + *reg_idx;
 
-               for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
-                       if (mr->enum_ids[j] != enum_id)
+               for (; *fld_idx < ARRAY_SIZE(mr->enum_ids); (*fld_idx)++) {
+                       if (mr->enum_ids[*fld_idx] != enum_id)
                                continue;
 
                        if (mr->set_reg && mr->clr_reg) {
@@ -455,29 +494,49 @@ static unsigned int __init intc_mask_data(struct intc_desc *desc,
                                        intc_get_reg(d, reg_e),
                                        intc_get_reg(d, reg_d),
                                        1,
-                                       (mr->reg_width - 1) - j);
+                                       (mr->reg_width - 1) - *fld_idx);
                }
+
+               *fld_idx = 0;
+               (*reg_idx)++;
        }
 
+       return 0;
+}
+
+static unsigned int __init intc_mask_data(struct intc_desc *desc,
+                                         struct intc_desc_int *d,
+                                         intc_enum enum_id, int do_grps)
+{
+       unsigned int i = 0;
+       unsigned int j = 0;
+       unsigned int ret;
+
+       ret = _intc_mask_data(desc, d, enum_id, &i, &j);
+       if (ret)
+               return ret;
+
        if (do_grps)
                return intc_mask_data(desc, d, intc_grp_id(desc, enum_id), 0);
 
        return 0;
 }
 
-static unsigned int __init intc_prio_data(struct intc_desc *desc,
-                                         struct intc_desc_int *d,
-                                         intc_enum enum_id, int do_grps)
+static unsigned int __init _intc_prio_data(struct intc_desc *desc,
+                                          struct intc_desc_int *d,
+                                          intc_enum enum_id,
+                                          unsigned int *reg_idx,
+                                          unsigned int *fld_idx)
 {
-       struct intc_prio_reg *pr = desc->prio_regs;
-       unsigned int i, j, fn, mode, bit;
+       struct intc_prio_reg *pr = desc->hw.prio_regs;
+       unsigned int fn, n, mode, bit;
        unsigned long reg_e, reg_d;
 
-       for (i = 0; pr && enum_id && i < desc->nr_prio_regs; i++) {
-               pr = desc->prio_regs + i;
+       while (pr && enum_id && *reg_idx < desc->hw.nr_prio_regs) {
+               pr = desc->hw.prio_regs + *reg_idx;
 
-               for (j = 0; j < ARRAY_SIZE(pr->enum_ids); j++) {
-                       if (pr->enum_ids[j] != enum_id)
+               for (; *fld_idx < ARRAY_SIZE(pr->enum_ids); (*fld_idx)++) {
+                       if (pr->enum_ids[*fld_idx] != enum_id)
                                continue;
 
                        if (pr->set_reg && pr->clr_reg) {
@@ -495,34 +554,79 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc,
                        }
 
                        fn += (pr->reg_width >> 3) - 1;
+                       n = *fld_idx + 1;
 
-                       BUG_ON((j + 1) * pr->field_width > pr->reg_width);
+                       BUG_ON(n * pr->field_width > pr->reg_width);
 
-                       bit = pr->reg_width - ((j + 1) * pr->field_width);
+                       bit = pr->reg_width - (n * pr->field_width);
 
                        return _INTC_MK(fn, mode,
                                        intc_get_reg(d, reg_e),
                                        intc_get_reg(d, reg_d),
                                        pr->field_width, bit);
                }
+
+               *fld_idx = 0;
+               (*reg_idx)++;
        }
 
+       return 0;
+}
+
+static unsigned int __init intc_prio_data(struct intc_desc *desc,
+                                         struct intc_desc_int *d,
+                                         intc_enum enum_id, int do_grps)
+{
+       unsigned int i = 0;
+       unsigned int j = 0;
+       unsigned int ret;
+
+       ret = _intc_prio_data(desc, d, enum_id, &i, &j);
+       if (ret)
+               return ret;
+
        if (do_grps)
                return intc_prio_data(desc, d, intc_grp_id(desc, enum_id), 0);
 
        return 0;
 }
 
+static void __init intc_enable_disable_enum(struct intc_desc *desc,
+                                           struct intc_desc_int *d,
+                                           intc_enum enum_id, int enable)
+{
+       unsigned int i, j, data;
+
+       /* go through and enable/disable all mask bits */
+       i = j = 0;
+       do {
+               data = _intc_mask_data(desc, d, enum_id, &i, &j);
+               if (data)
+                       intc_enable_disable(d, data, enable);
+               j++;
+       } while (data);
+
+       /* go through and enable/disable all priority fields */
+       i = j = 0;
+       do {
+               data = _intc_prio_data(desc, d, enum_id, &i, &j);
+               if (data)
+                       intc_enable_disable(d, data, enable);
+
+               j++;
+       } while (data);
+}
+
 static unsigned int __init intc_ack_data(struct intc_desc *desc,
                                          struct intc_desc_int *d,
                                          intc_enum enum_id)
 {
-       struct intc_mask_reg *mr = desc->ack_regs;
+       struct intc_mask_reg *mr = desc->hw.ack_regs;
        unsigned int i, j, fn, mode;
        unsigned long reg_e, reg_d;
 
-       for (i = 0; mr && enum_id && i < desc->nr_ack_regs; i++) {
-               mr = desc->ack_regs + i;
+       for (i = 0; mr && enum_id && i < desc->hw.nr_ack_regs; i++) {
+               mr = desc->hw.ack_regs + i;
 
                for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
                        if (mr->enum_ids[j] != enum_id)
@@ -549,11 +653,11 @@ static unsigned int __init intc_sense_data(struct intc_desc *desc,
                                           struct intc_desc_int *d,
                                           intc_enum enum_id)
 {
-       struct intc_sense_reg *sr = desc->sense_regs;
+       struct intc_sense_reg *sr = desc->hw.sense_regs;
        unsigned int i, j, fn, bit;
 
-       for (i = 0; sr && enum_id && i < desc->nr_sense_regs; i++) {
-               sr = desc->sense_regs + i;
+       for (i = 0; sr && enum_id && i < desc->hw.nr_sense_regs; i++) {
+               sr = desc->hw.sense_regs + i;
 
                for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) {
                        if (sr->enum_ids[j] != enum_id)
@@ -656,7 +760,7 @@ static void __init intc_register_irq(struct intc_desc *desc,
        /* irq should be disabled by default */
        d->chip.mask(irq);
 
-       if (desc->ack_regs)
+       if (desc->hw.ack_regs)
                ack_handle[irq] = intc_ack_data(desc, d, enum_id);
 }
 
@@ -684,6 +788,7 @@ static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
 void __init register_intc_controller(struct intc_desc *desc)
 {
        unsigned int i, k, smp;
+       struct intc_hw_desc *hw = &desc->hw;
        struct intc_desc_int *d;
 
        d = kzalloc(sizeof(*d), GFP_NOWAIT);
@@ -691,10 +796,10 @@ void __init register_intc_controller(struct intc_desc *desc)
        INIT_LIST_HEAD(&d->list);
        list_add(&d->list, &intc_list);
 
-       d->nr_reg = desc->mask_regs ? desc->nr_mask_regs * 2 : 0;
-       d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0;
-       d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0;
-       d->nr_reg += desc->ack_regs ? desc->nr_ack_regs : 0;
+       d->nr_reg = hw->mask_regs ? hw->nr_mask_regs * 2 : 0;
+       d->nr_reg += hw->prio_regs ? hw->nr_prio_regs * 2 : 0;
+       d->nr_reg += hw->sense_regs ? hw->nr_sense_regs : 0;
+       d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
 
        d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT);
 #ifdef CONFIG_SMP
@@ -702,30 +807,31 @@ void __init register_intc_controller(struct intc_desc *desc)
 #endif
        k = 0;
 
-       if (desc->mask_regs) {
-               for (i = 0; i < desc->nr_mask_regs; i++) {
-                       smp = IS_SMP(desc->mask_regs[i]);
-                       k += save_reg(d, k, desc->mask_regs[i].set_reg, smp);
-                       k += save_reg(d, k, desc->mask_regs[i].clr_reg, smp);
+       if (hw->mask_regs) {
+               for (i = 0; i < hw->nr_mask_regs; i++) {
+                       smp = IS_SMP(hw->mask_regs[i]);
+                       k += save_reg(d, k, hw->mask_regs[i].set_reg, smp);
+                       k += save_reg(d, k, hw->mask_regs[i].clr_reg, smp);
                }
        }
 
-       if (desc->prio_regs) {
-               d->prio = kzalloc(desc->nr_vectors * sizeof(*d->prio), GFP_NOWAIT);
+       if (hw->prio_regs) {
+               d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
+                                 GFP_NOWAIT);
 
-               for (i = 0; i < desc->nr_prio_regs; i++) {
-                       smp = IS_SMP(desc->prio_regs[i]);
-                       k += save_reg(d, k, desc->prio_regs[i].set_reg, smp);
-                       k += save_reg(d, k, desc->prio_regs[i].clr_reg, smp);
+               for (i = 0; i < hw->nr_prio_regs; i++) {
+                       smp = IS_SMP(hw->prio_regs[i]);
+                       k += save_reg(d, k, hw->prio_regs[i].set_reg, smp);
+                       k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp);
                }
        }
 
-       if (desc->sense_regs) {
-               d->sense = kzalloc(desc->nr_vectors * sizeof(*d->sense), GFP_NOWAIT);
+       if (hw->sense_regs) {
+               d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
+                                  GFP_NOWAIT);
 
-               for (i = 0; i < desc->nr_sense_regs; i++) {
-                       k += save_reg(d, k, desc->sense_regs[i].reg, 0);
-               }
+               for (i = 0; i < hw->nr_sense_regs; i++)
+                       k += save_reg(d, k, hw->sense_regs[i].reg, 0);
        }
 
        d->chip.name = desc->name;
@@ -738,18 +844,26 @@ void __init register_intc_controller(struct intc_desc *desc)
        d->chip.set_type = intc_set_sense;
        d->chip.set_wake = intc_set_wake;
 
-       if (desc->ack_regs) {
-               for (i = 0; i < desc->nr_ack_regs; i++)
-                       k += save_reg(d, k, desc->ack_regs[i].set_reg, 0);
+       if (hw->ack_regs) {
+               for (i = 0; i < hw->nr_ack_regs; i++)
+                       k += save_reg(d, k, hw->ack_regs[i].set_reg, 0);
 
                d->chip.mask_ack = intc_mask_ack;
        }
 
+       /* disable bits matching force_disable before registering irqs */
+       if (desc->force_disable)
+               intc_enable_disable_enum(desc, d, desc->force_disable, 0);
+
+       /* disable bits matching force_enable before registering irqs */
+       if (desc->force_enable)
+               intc_enable_disable_enum(desc, d, desc->force_enable, 0);
+
        BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */
 
        /* register the vectors one by one */
-       for (i = 0; i < desc->nr_vectors; i++) {
-               struct intc_vect *vect = desc->vectors + i;
+       for (i = 0; i < hw->nr_vectors; i++) {
+               struct intc_vect *vect = hw->vectors + i;
                unsigned int irq = evt2irq(vect->vect);
                struct irq_desc *irq_desc;
 
@@ -764,8 +878,8 @@ void __init register_intc_controller(struct intc_desc *desc)
 
                intc_register_irq(desc, d, vect->enum_id, irq);
 
-               for (k = i + 1; k < desc->nr_vectors; k++) {
-                       struct intc_vect *vect2 = desc->vectors + k;
+               for (k = i + 1; k < hw->nr_vectors; k++) {
+                       struct intc_vect *vect2 = hw->vectors + k;
                        unsigned int irq2 = evt2irq(vect2->vect);
 
                        if (vect->enum_id != vect2->enum_id)
@@ -785,11 +899,15 @@ void __init register_intc_controller(struct intc_desc *desc)
                        vect2->enum_id = 0;
 
                        /* redirect this interrupts to the first one */
-                       set_irq_chip_and_handler_name(irq2, &d->chip,
-                                       intc_redirect_irq, "redirect");
+                       set_irq_chip(irq2, &dummy_irq_chip);
+                       set_irq_chained_handler(irq2, intc_redirect_irq);
                        set_irq_data(irq2, (void *)irq);
                }
        }
+
+       /* enable bits matching force_enable after registering irqs */
+       if (desc->force_enable)
+               intc_enable_disable_enum(desc, d, desc->force_enable, 1);
 }
 
 static int intc_suspend(struct sys_device *dev, pm_message_t state)
@@ -872,7 +990,7 @@ device_initcall(register_intc_sysdevs);
 /*
  * Dynamic IRQ allocation and deallocation
  */
-static unsigned int create_irq_on_node(unsigned int irq_want, int node)
+unsigned int create_irq_nr(unsigned int irq_want, int node)
 {
        unsigned int irq = 0, new;
        unsigned long flags;
@@ -881,24 +999,28 @@ static unsigned int create_irq_on_node(unsigned int irq_want, int node)
        spin_lock_irqsave(&vector_lock, flags);
 
        /*
-        * First try the wanted IRQ, then scan.
+        * First try the wanted IRQ
         */
-       if (test_and_set_bit(irq_want, intc_irq_map)) {
+       if (test_and_set_bit(irq_want, intc_irq_map) == 0) {
+               new = irq_want;
+       } else {
+               /* .. then fall back to scanning. */
                new = find_first_zero_bit(intc_irq_map, nr_irqs);
                if (unlikely(new == nr_irqs))
                        goto out_unlock;
 
-               desc = irq_to_desc_alloc_node(new, node);
-               if (unlikely(!desc)) {
-                       pr_info("can't get irq_desc for %d\n", new);
-                       goto out_unlock;
-               }
-
-               desc = move_irq_desc(desc, node);
                __set_bit(new, intc_irq_map);
-               irq = new;
        }
 
+       desc = irq_to_desc_alloc_node(new, node);
+       if (unlikely(!desc)) {
+               pr_info("can't get irq_desc for %d\n", new);
+               goto out_unlock;
+       }
+
+       desc = move_irq_desc(desc, node);
+       irq = new;
+
 out_unlock:
        spin_unlock_irqrestore(&vector_lock, flags);
 
@@ -913,7 +1035,7 @@ int create_irq(void)
        int nid = cpu_to_node(smp_processor_id());
        int irq;
 
-       irq = create_irq_on_node(NR_IRQS_LEGACY, nid);
+       irq = create_irq_nr(NR_IRQS_LEGACY, nid);
        if (irq == 0)
                irq = -1;
 
index 082604edc4c2943d16678411498f33ddff560e46..cf0303acab8edb2f1e9d23e4f30cb12330635645 100644 (file)
@@ -337,12 +337,39 @@ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
                if (!enum_id)
                        break;
 
+               /* first check if this is a function enum */
                in_range = enum_in_range(enum_id, &gpioc->function);
-               if (!in_range && range) {
-                       in_range = enum_in_range(enum_id, range);
-
-                       if (in_range && enum_id == range->force)
-                               continue;
+               if (!in_range) {
+                       /* not a function enum */
+                       if (range) {
+                               /*
+                                * other range exists, so this pin is
+                                * a regular GPIO pin that now is being
+                                * bound to a specific direction.
+                                *
+                                * for this case we only allow function enums
+                                * and the enums that match the other range.
+                                */
+                               in_range = enum_in_range(enum_id, range);
+
+                               /*
+                                * special case pass through for fixed
+                                * input-only or output-only pins without
+                                * function enum register association.
+                                */
+                               if (in_range && enum_id == range->force)
+                                       continue;
+                       } else {
+                               /*
+                                * no other range exists, so this pin
+                                * must then be of the function type.
+                                *
+                                * allow function type pins to select
+                                * any combination of function/in/out
+                                * in their MARK lists.
+                                */
+                               in_range = 1;
+                       }
                }
 
                if (!in_range)
index f55eb0107336b0a66ca8f68dd41b9a3752d3bb3a..0fee95cd9a49dde3ae57af9911204cbc71b8baa2 100644 (file)
@@ -100,6 +100,23 @@ config SPI_BUTTERFLY
          inexpensive battery powered microcontroller evaluation board.
          This same cable can be used to flash new firmware.
 
+config SPI_COLDFIRE_QSPI
+       tristate "Freescale Coldfire QSPI controller"
+       depends on (M520x || M523x || M5249 || M527x || M528x || M532x)
+       help
+         This enables support for the Coldfire QSPI controller in master
+         mode.
+
+         This driver can also be built as a module.  If so, the module
+         will be called coldfire_qspi.
+
+config SPI_DAVINCI
+       tristate "SPI controller driver for DaVinci/DA8xx SoC's"
+       depends on SPI_MASTER && ARCH_DAVINCI
+       select SPI_BITBANG
+       help
+         SPI master controller for DaVinci and DA8xx SPI modules.
+
 config SPI_GPIO
        tristate "GPIO-based bitbanging SPI Master"
        depends on GENERIC_GPIO
@@ -308,7 +325,7 @@ config SPI_NUC900
 #
 
 config SPI_DESIGNWARE
-       bool "DesignWare SPI controller core support"
+       tristate "DesignWare SPI controller core support"
        depends on SPI_MASTER
        help
          general driver for SPI controller core from DesignWare
@@ -317,6 +334,10 @@ config SPI_DW_PCI
        tristate "PCI interface driver for DW SPI core"
        depends on SPI_DESIGNWARE && PCI
 
+config SPI_DW_MMIO
+       tristate "Memory-mapped io interface driver for DW SPI core"
+       depends on SPI_DESIGNWARE && HAVE_CLK
+
 #
 # There are lots of SPI device types, with sensors and memory
 # being probably the most widely used ones.
index f3d2810ba11c9f3fd11cbdaddf9b50431e70b70b..d7d0f89b797bbcf180475215cc64bc44d5c97400 100644 (file)
@@ -16,8 +16,11 @@ obj-$(CONFIG_SPI_BFIN)                       += spi_bfin5xx.o
 obj-$(CONFIG_SPI_BITBANG)              += spi_bitbang.o
 obj-$(CONFIG_SPI_AU1550)               += au1550_spi.o
 obj-$(CONFIG_SPI_BUTTERFLY)            += spi_butterfly.o
+obj-$(CONFIG_SPI_COLDFIRE_QSPI)                += coldfire_qspi.o
+obj-$(CONFIG_SPI_DAVINCI)              += davinci_spi.o
 obj-$(CONFIG_SPI_DESIGNWARE)           += dw_spi.o
 obj-$(CONFIG_SPI_DW_PCI)               += dw_spi_pci.o
+obj-$(CONFIG_SPI_DW_MMIO)              += dw_spi_mmio.o
 obj-$(CONFIG_SPI_GPIO)                 += spi_gpio.o
 obj-$(CONFIG_SPI_IMX)                  += spi_imx.o
 obj-$(CONFIG_SPI_LM70_LLP)             += spi_lm70llp.o
index cfd5ff9508fadd2f607d33495b5066cc34b1bbd1..ba8ac4f599d3966179eb1ce3847dd5a268a96d2a 100644 (file)
@@ -412,11 +412,13 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
        }
 
        /* put buffers on the ring */
-       res = au1xxx_dbdma_put_dest(hw->dma_rx_ch, hw->rx, t->len);
+       res = au1xxx_dbdma_put_dest(hw->dma_rx_ch, virt_to_phys(hw->rx),
+                                   t->len, DDMA_FLAGS_IE);
        if (!res)
                dev_err(hw->dev, "rx dma put dest error\n");
 
-       res = au1xxx_dbdma_put_source(hw->dma_tx_ch, (void *)hw->tx, t->len);
+       res = au1xxx_dbdma_put_source(hw->dma_tx_ch, virt_to_phys(hw->tx),
+                                     t->len, DDMA_FLAGS_IE);
        if (!res)
                dev_err(hw->dev, "tx dma put source error\n");
 
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/coldfire_qspi.c
new file mode 100644 (file)
index 0000000..59be3ef
--- /dev/null
@@ -0,0 +1,640 @@
+/*
+ * Freescale/Motorola Coldfire Queued SPI driver
+ *
+ * Copyright 2010 Steven King <sfking@fdwdc.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., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA
+ *
+*/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/errno.h>
+#include <linux/platform_device.h>
+#include <linux/workqueue.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/spi/spi.h>
+
+#include <asm/coldfire.h>
+#include <asm/mcfqspi.h>
+
+#define        DRIVER_NAME "mcfqspi"
+
+#define        MCFQSPI_BUSCLK                  (MCF_BUSCLK / 2)
+
+#define        MCFQSPI_QMR                     0x00
+#define                MCFQSPI_QMR_MSTR        0x8000
+#define                MCFQSPI_QMR_CPOL        0x0200
+#define                MCFQSPI_QMR_CPHA        0x0100
+#define        MCFQSPI_QDLYR                   0x04
+#define                MCFQSPI_QDLYR_SPE       0x8000
+#define        MCFQSPI_QWR                     0x08
+#define                MCFQSPI_QWR_HALT        0x8000
+#define                MCFQSPI_QWR_WREN        0x4000
+#define                MCFQSPI_QWR_CSIV        0x1000
+#define        MCFQSPI_QIR                     0x0C
+#define                MCFQSPI_QIR_WCEFB       0x8000
+#define                MCFQSPI_QIR_ABRTB       0x4000
+#define                MCFQSPI_QIR_ABRTL       0x1000
+#define                MCFQSPI_QIR_WCEFE       0x0800
+#define                MCFQSPI_QIR_ABRTE       0x0400
+#define                MCFQSPI_QIR_SPIFE       0x0100
+#define                MCFQSPI_QIR_WCEF        0x0008
+#define                MCFQSPI_QIR_ABRT        0x0004
+#define                MCFQSPI_QIR_SPIF        0x0001
+#define        MCFQSPI_QAR                     0x010
+#define                MCFQSPI_QAR_TXBUF       0x00
+#define                MCFQSPI_QAR_RXBUF       0x10
+#define                MCFQSPI_QAR_CMDBUF      0x20
+#define        MCFQSPI_QDR                     0x014
+#define        MCFQSPI_QCR                     0x014
+#define                MCFQSPI_QCR_CONT        0x8000
+#define                MCFQSPI_QCR_BITSE       0x4000
+#define                MCFQSPI_QCR_DT          0x2000
+
+struct mcfqspi {
+       void __iomem *iobase;
+       int irq;
+       struct clk *clk;
+       struct mcfqspi_cs_control *cs_control;
+
+       wait_queue_head_t waitq;
+
+       struct work_struct work;
+       struct workqueue_struct *workq;
+       spinlock_t lock;
+       struct list_head msgq;
+};
+
+static void mcfqspi_wr_qmr(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QMR);
+}
+
+static void mcfqspi_wr_qdlyr(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QDLYR);
+}
+
+static u16 mcfqspi_rd_qdlyr(struct mcfqspi *mcfqspi)
+{
+       return readw(mcfqspi->iobase + MCFQSPI_QDLYR);
+}
+
+static void mcfqspi_wr_qwr(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QWR);
+}
+
+static void mcfqspi_wr_qir(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QIR);
+}
+
+static void mcfqspi_wr_qar(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QAR);
+}
+
+static void mcfqspi_wr_qdr(struct mcfqspi *mcfqspi, u16 val)
+{
+       writew(val, mcfqspi->iobase + MCFQSPI_QDR);
+}
+
+static u16 mcfqspi_rd_qdr(struct mcfqspi *mcfqspi)
+{
+       return readw(mcfqspi->iobase + MCFQSPI_QDR);
+}
+
+static void mcfqspi_cs_select(struct mcfqspi *mcfqspi, u8 chip_select,
+                           bool cs_high)
+{
+       mcfqspi->cs_control->select(mcfqspi->cs_control, chip_select, cs_high);
+}
+
+static void mcfqspi_cs_deselect(struct mcfqspi *mcfqspi, u8 chip_select,
+                               bool cs_high)
+{
+       mcfqspi->cs_control->deselect(mcfqspi->cs_control, chip_select, cs_high);
+}
+
+static int mcfqspi_cs_setup(struct mcfqspi *mcfqspi)
+{
+       return (mcfqspi->cs_control && mcfqspi->cs_control->setup) ?
+               mcfqspi->cs_control->setup(mcfqspi->cs_control) : 0;
+}
+
+static void mcfqspi_cs_teardown(struct mcfqspi *mcfqspi)
+{
+       if (mcfqspi->cs_control && mcfqspi->cs_control->teardown)
+               mcfqspi->cs_control->teardown(mcfqspi->cs_control);
+}
+
+static u8 mcfqspi_qmr_baud(u32 speed_hz)
+{
+       return clamp((MCFQSPI_BUSCLK + speed_hz - 1) / speed_hz, 2u, 255u);
+}
+
+static bool mcfqspi_qdlyr_spe(struct mcfqspi *mcfqspi)
+{
+       return mcfqspi_rd_qdlyr(mcfqspi) & MCFQSPI_QDLYR_SPE;
+}
+
+static irqreturn_t mcfqspi_irq_handler(int this_irq, void *dev_id)
+{
+       struct mcfqspi *mcfqspi = dev_id;
+
+       /* clear interrupt */
+       mcfqspi_wr_qir(mcfqspi, MCFQSPI_QIR_SPIFE | MCFQSPI_QIR_SPIF);
+       wake_up(&mcfqspi->waitq);
+
+       return IRQ_HANDLED;
+}
+
+static void mcfqspi_transfer_msg8(struct mcfqspi *mcfqspi, unsigned count,
+                                 const u8 *txbuf, u8 *rxbuf)
+{
+       unsigned i, n, offset = 0;
+
+       n = min(count, 16u);
+
+       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_CMDBUF);
+       for (i = 0; i < n; ++i)
+               mcfqspi_wr_qdr(mcfqspi, MCFQSPI_QCR_BITSE);
+
+       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_TXBUF);
+       if (txbuf)
+               for (i = 0; i < n; ++i)
+                       mcfqspi_wr_qdr(mcfqspi, *txbuf++);
+       else
+               for (i = 0; i < count; ++i)
+                       mcfqspi_wr_qdr(mcfqspi, 0);
+
+       count -= n;
+       if (count) {
+               u16 qwr = 0xf08;
+               mcfqspi_wr_qwr(mcfqspi, 0x700);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+
+               do {
+                       wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+                       mcfqspi_wr_qwr(mcfqspi, qwr);
+                       mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+                       if (rxbuf) {
+                               mcfqspi_wr_qar(mcfqspi,
+                                              MCFQSPI_QAR_RXBUF + offset);
+                               for (i = 0; i < 8; ++i)
+                                       *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+                       }
+                       n = min(count, 8u);
+                       if (txbuf) {
+                               mcfqspi_wr_qar(mcfqspi,
+                                              MCFQSPI_QAR_TXBUF + offset);
+                               for (i = 0; i < n; ++i)
+                                       mcfqspi_wr_qdr(mcfqspi, *txbuf++);
+                       }
+                       qwr = (offset ? 0x808 : 0) + ((n - 1) << 8);
+                       offset ^= 8;
+                       count -= n;
+               } while (count);
+               wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+               mcfqspi_wr_qwr(mcfqspi, qwr);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+               if (rxbuf) {
+                       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_RXBUF + offset);
+                       for (i = 0; i < 8; ++i)
+                               *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+                       offset ^= 8;
+               }
+       } else {
+               mcfqspi_wr_qwr(mcfqspi, (n - 1) << 8);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+       }
+       wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+       if (rxbuf) {
+               mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_RXBUF + offset);
+               for (i = 0; i < n; ++i)
+                       *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+       }
+}
+
+static void mcfqspi_transfer_msg16(struct mcfqspi *mcfqspi, unsigned count,
+                                  const u16 *txbuf, u16 *rxbuf)
+{
+       unsigned i, n, offset = 0;
+
+       n = min(count, 16u);
+
+       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_CMDBUF);
+       for (i = 0; i < n; ++i)
+               mcfqspi_wr_qdr(mcfqspi, MCFQSPI_QCR_BITSE);
+
+       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_TXBUF);
+       if (txbuf)
+               for (i = 0; i < n; ++i)
+                       mcfqspi_wr_qdr(mcfqspi, *txbuf++);
+       else
+               for (i = 0; i < count; ++i)
+                       mcfqspi_wr_qdr(mcfqspi, 0);
+
+       count -= n;
+       if (count) {
+               u16 qwr = 0xf08;
+               mcfqspi_wr_qwr(mcfqspi, 0x700);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+
+               do {
+                       wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+                       mcfqspi_wr_qwr(mcfqspi, qwr);
+                       mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+                       if (rxbuf) {
+                               mcfqspi_wr_qar(mcfqspi,
+                                              MCFQSPI_QAR_RXBUF + offset);
+                               for (i = 0; i < 8; ++i)
+                                       *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+                       }
+                       n = min(count, 8u);
+                       if (txbuf) {
+                               mcfqspi_wr_qar(mcfqspi,
+                                              MCFQSPI_QAR_TXBUF + offset);
+                               for (i = 0; i < n; ++i)
+                                       mcfqspi_wr_qdr(mcfqspi, *txbuf++);
+                       }
+                       qwr = (offset ? 0x808 : 0x000) + ((n - 1) << 8);
+                       offset ^= 8;
+                       count -= n;
+               } while (count);
+               wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+               mcfqspi_wr_qwr(mcfqspi, qwr);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+               if (rxbuf) {
+                       mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_RXBUF + offset);
+                       for (i = 0; i < 8; ++i)
+                               *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+                       offset ^= 8;
+               }
+       } else {
+               mcfqspi_wr_qwr(mcfqspi, (n - 1) << 8);
+               mcfqspi_wr_qdlyr(mcfqspi, MCFQSPI_QDLYR_SPE);
+       }
+       wait_event(mcfqspi->waitq, !mcfqspi_qdlyr_spe(mcfqspi));
+       if (rxbuf) {
+               mcfqspi_wr_qar(mcfqspi, MCFQSPI_QAR_RXBUF + offset);
+               for (i = 0; i < n; ++i)
+                       *rxbuf++ = mcfqspi_rd_qdr(mcfqspi);
+       }
+}
+
+static void mcfqspi_work(struct work_struct *work)
+{
+       struct mcfqspi *mcfqspi = container_of(work, struct mcfqspi, work);
+       unsigned long flags;
+
+       spin_lock_irqsave(&mcfqspi->lock, flags);
+       while (!list_empty(&mcfqspi->msgq)) {
+               struct spi_message *msg;
+               struct spi_device *spi;
+               struct spi_transfer *xfer;
+               int status = 0;
+
+               msg = container_of(mcfqspi->msgq.next, struct spi_message,
+                                  queue);
+
+               list_del_init(&mcfqspi->msgq);
+               spin_unlock_irqrestore(&mcfqspi->lock, flags);
+
+               spi = msg->spi;
+
+               list_for_each_entry(xfer, &msg->transfers, transfer_list) {
+                       bool cs_high = spi->mode & SPI_CS_HIGH;
+                       u16 qmr = MCFQSPI_QMR_MSTR;
+
+                       if (xfer->bits_per_word)
+                               qmr |= xfer->bits_per_word << 10;
+                       else
+                               qmr |= spi->bits_per_word << 10;
+                       if (spi->mode & SPI_CPHA)
+                               qmr |= MCFQSPI_QMR_CPHA;
+                       if (spi->mode & SPI_CPOL)
+                               qmr |= MCFQSPI_QMR_CPOL;
+                       if (xfer->speed_hz)
+                               qmr |= mcfqspi_qmr_baud(xfer->speed_hz);
+                       else
+                               qmr |= mcfqspi_qmr_baud(spi->max_speed_hz);
+                       mcfqspi_wr_qmr(mcfqspi, qmr);
+
+                       mcfqspi_cs_select(mcfqspi, spi->chip_select, cs_high);
+
+                       mcfqspi_wr_qir(mcfqspi, MCFQSPI_QIR_SPIFE);
+                       if ((xfer->bits_per_word ? xfer->bits_per_word :
+                                               spi->bits_per_word) == 8)
+                               mcfqspi_transfer_msg8(mcfqspi, xfer->len,
+                                                     xfer->tx_buf,
+                                                     xfer->rx_buf);
+                       else
+                               mcfqspi_transfer_msg16(mcfqspi, xfer->len / 2,
+                                                      xfer->tx_buf,
+                                                      xfer->rx_buf);
+                       mcfqspi_wr_qir(mcfqspi, 0);
+
+                       if (xfer->delay_usecs)
+                               udelay(xfer->delay_usecs);
+                       if (xfer->cs_change) {
+                               if (!list_is_last(&xfer->transfer_list,
+                                                 &msg->transfers))
+                                       mcfqspi_cs_deselect(mcfqspi,
+                                                           spi->chip_select,
+                                                           cs_high);
+                       } else {
+                               if (list_is_last(&xfer->transfer_list,
+                                                &msg->transfers))
+                                       mcfqspi_cs_deselect(mcfqspi,
+                                                           spi->chip_select,
+                                                           cs_high);
+                       }
+                       msg->actual_length += xfer->len;
+               }
+               msg->status = status;
+               msg->complete(msg->context);
+
+               spin_lock_irqsave(&mcfqspi->lock, flags);
+       }
+       spin_unlock_irqrestore(&mcfqspi->lock, flags);
+}
+
+static int mcfqspi_transfer(struct spi_device *spi, struct spi_message *msg)
+{
+       struct mcfqspi *mcfqspi;
+       struct spi_transfer *xfer;
+       unsigned long flags;
+
+       mcfqspi = spi_master_get_devdata(spi->master);
+
+       list_for_each_entry(xfer, &msg->transfers, transfer_list) {
+               if (xfer->bits_per_word && ((xfer->bits_per_word < 8)
+                                       || (xfer->bits_per_word > 16))) {
+                       dev_dbg(&spi->dev,
+                               "%d bits per word is not supported\n",
+                               xfer->bits_per_word);
+                       goto fail;
+               }
+               if (xfer->speed_hz) {
+                       u32 real_speed = MCFQSPI_BUSCLK /
+                               mcfqspi_qmr_baud(xfer->speed_hz);
+                       if (real_speed != xfer->speed_hz)
+                               dev_dbg(&spi->dev,
+                                       "using speed %d instead of %d\n",
+                                       real_speed, xfer->speed_hz);
+               }
+       }
+       msg->status = -EINPROGRESS;
+       msg->actual_length = 0;
+
+       spin_lock_irqsave(&mcfqspi->lock, flags);
+       list_add_tail(&msg->queue, &mcfqspi->msgq);
+       queue_work(mcfqspi->workq, &mcfqspi->work);
+       spin_unlock_irqrestore(&mcfqspi->lock, flags);
+
+       return 0;
+fail:
+       msg->status = -EINVAL;
+       return -EINVAL;
+}
+
+static int mcfqspi_setup(struct spi_device *spi)
+{
+       if ((spi->bits_per_word < 8) || (spi->bits_per_word > 16)) {
+               dev_dbg(&spi->dev, "%d bits per word is not supported\n",
+                       spi->bits_per_word);
+               return -EINVAL;
+       }
+       if (spi->chip_select >= spi->master->num_chipselect) {
+               dev_dbg(&spi->dev, "%d chip select is out of range\n",
+                       spi->chip_select);
+               return -EINVAL;
+       }
+
+       mcfqspi_cs_deselect(spi_master_get_devdata(spi->master),
+                           spi->chip_select, spi->mode & SPI_CS_HIGH);
+
+       dev_dbg(&spi->dev,
+                       "bits per word %d, chip select %d, speed %d KHz\n",
+                       spi->bits_per_word, spi->chip_select,
+                       (MCFQSPI_BUSCLK / mcfqspi_qmr_baud(spi->max_speed_hz))
+                       / 1000);
+
+       return 0;
+}
+
+static int __devinit mcfqspi_probe(struct platform_device *pdev)
+{
+       struct spi_master *master;
+       struct mcfqspi *mcfqspi;
+       struct resource *res;
+       struct mcfqspi_platform_data *pdata;
+       int status;
+
+       master = spi_alloc_master(&pdev->dev, sizeof(*mcfqspi));
+       if (master == NULL) {
+               dev_dbg(&pdev->dev, "spi_alloc_master failed\n");
+               return -ENOMEM;
+       }
+
+       mcfqspi = spi_master_get_devdata(master);
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res) {
+               dev_dbg(&pdev->dev, "platform_get_resource failed\n");
+               status = -ENXIO;
+               goto fail0;
+       }
+
+       if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
+               dev_dbg(&pdev->dev, "request_mem_region failed\n");
+               status = -EBUSY;
+               goto fail0;
+       }
+
+       mcfqspi->iobase = ioremap(res->start, resource_size(res));
+       if (!mcfqspi->iobase) {
+               dev_dbg(&pdev->dev, "ioremap failed\n");
+               status = -ENOMEM;
+               goto fail1;
+       }
+
+       mcfqspi->irq = platform_get_irq(pdev, 0);
+       if (mcfqspi->irq < 0) {
+               dev_dbg(&pdev->dev, "platform_get_irq failed\n");
+               status = -ENXIO;
+               goto fail2;
+       }
+
+       status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, IRQF_DISABLED,
+                            pdev->name, mcfqspi);
+       if (status) {
+               dev_dbg(&pdev->dev, "request_irq failed\n");
+               goto fail2;
+       }
+
+       mcfqspi->clk = clk_get(&pdev->dev, "qspi_clk");
+       if (IS_ERR(mcfqspi->clk)) {
+               dev_dbg(&pdev->dev, "clk_get failed\n");
+               status = PTR_ERR(mcfqspi->clk);
+               goto fail3;
+       }
+       clk_enable(mcfqspi->clk);
+
+       mcfqspi->workq = create_singlethread_workqueue(dev_name(master->dev.parent));
+       if (!mcfqspi->workq) {
+               dev_dbg(&pdev->dev, "create_workqueue failed\n");
+               status = -ENOMEM;
+               goto fail4;
+       }
+       INIT_WORK(&mcfqspi->work, mcfqspi_work);
+       spin_lock_init(&mcfqspi->lock);
+       INIT_LIST_HEAD(&mcfqspi->msgq);
+       init_waitqueue_head(&mcfqspi->waitq);
+
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_dbg(&pdev->dev, "platform data is missing\n");
+               goto fail5;
+       }
+       master->bus_num = pdata->bus_num;
+       master->num_chipselect = pdata->num_chipselect;
+
+       mcfqspi->cs_control = pdata->cs_control;
+       status = mcfqspi_cs_setup(mcfqspi);
+       if (status) {
+               dev_dbg(&pdev->dev, "error initializing cs_control\n");
+               goto fail5;
+       }
+
+       master->mode_bits = SPI_CS_HIGH | SPI_CPOL | SPI_CPHA;
+       master->setup = mcfqspi_setup;
+       master->transfer = mcfqspi_transfer;
+
+       platform_set_drvdata(pdev, master);
+
+       status = spi_register_master(master);
+       if (status) {
+               dev_dbg(&pdev->dev, "spi_register_master failed\n");
+               goto fail6;
+       }
+       dev_info(&pdev->dev, "Coldfire QSPI bus driver\n");
+
+       return 0;
+
+fail6:
+       mcfqspi_cs_teardown(mcfqspi);
+fail5:
+       destroy_workqueue(mcfqspi->workq);
+fail4:
+       clk_disable(mcfqspi->clk);
+       clk_put(mcfqspi->clk);
+fail3:
+       free_irq(mcfqspi->irq, mcfqspi);
+fail2:
+       iounmap(mcfqspi->iobase);
+fail1:
+       release_mem_region(res->start, resource_size(res));
+fail0:
+       spi_master_put(master);
+
+       dev_dbg(&pdev->dev, "Coldfire QSPI probe failed\n");
+
+       return status;
+}
+
+static int __devexit mcfqspi_remove(struct platform_device *pdev)
+{
+       struct spi_master *master = platform_get_drvdata(pdev);
+       struct mcfqspi *mcfqspi = spi_master_get_devdata(master);
+       struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+       /* disable the hardware (set the baud rate to 0) */
+       mcfqspi_wr_qmr(mcfqspi, MCFQSPI_QMR_MSTR);
+
+       platform_set_drvdata(pdev, NULL);
+       mcfqspi_cs_teardown(mcfqspi);
+       destroy_workqueue(mcfqspi->workq);
+       clk_disable(mcfqspi->clk);
+       clk_put(mcfqspi->clk);
+       free_irq(mcfqspi->irq, mcfqspi);
+       iounmap(mcfqspi->iobase);
+       release_mem_region(res->start, resource_size(res));
+       spi_unregister_master(master);
+       spi_master_put(master);
+
+       return 0;
+}
+
+#ifdef CONFIG_PM
+
+static int mcfqspi_suspend(struct device *dev)
+{
+       struct mcfqspi *mcfqspi = platform_get_drvdata(to_platform_device(dev));
+
+       clk_disable(mcfqspi->clk);
+
+       return 0;
+}
+
+static int mcfqspi_resume(struct device *dev)
+{
+       struct mcfqspi *mcfqspi = platform_get_drvdata(to_platform_device(dev));
+
+       clk_enable(mcfqspi->clk);
+
+       return 0;
+}
+
+static struct dev_pm_ops mcfqspi_dev_pm_ops = {
+       .suspend        = mcfqspi_suspend,
+       .resume         = mcfqspi_resume,
+};
+
+#define        MCFQSPI_DEV_PM_OPS      (&mcfqspi_dev_pm_ops)
+#else
+#define        MCFQSPI_DEV_PM_OPS      NULL
+#endif
+
+static struct platform_driver mcfqspi_driver = {
+       .driver.name    = DRIVER_NAME,
+       .driver.owner   = THIS_MODULE,
+       .driver.pm      = MCFQSPI_DEV_PM_OPS,
+       .remove         = __devexit_p(mcfqspi_remove),
+};
+
+static int __init mcfqspi_init(void)
+{
+       return platform_driver_probe(&mcfqspi_driver, mcfqspi_probe);
+}
+module_init(mcfqspi_init);
+
+static void __exit mcfqspi_exit(void)
+{
+       platform_driver_unregister(&mcfqspi_driver);
+}
+module_exit(mcfqspi_exit);
+
+MODULE_AUTHOR("Steven King <sfking@fdwdc.com>");
+MODULE_DESCRIPTION("Coldfire QSPI Controller Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
new file mode 100644 (file)
index 0000000..225ab60
--- /dev/null
@@ -0,0 +1,1255 @@
+/*
+ * Copyright (C) 2009 Texas Instruments.
+ *
+ * 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
+ */
+
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/dma-mapping.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
+
+#include <mach/spi.h>
+#include <mach/edma.h>
+
+#define SPI_NO_RESOURCE                ((resource_size_t)-1)
+
+#define SPI_MAX_CHIPSELECT     2
+
+#define CS_DEFAULT     0xFF
+
+#define SPI_BUFSIZ     (SMP_CACHE_BYTES + 1)
+#define DAVINCI_DMA_DATA_TYPE_S8       0x01
+#define DAVINCI_DMA_DATA_TYPE_S16      0x02
+#define DAVINCI_DMA_DATA_TYPE_S32      0x04
+
+#define SPIFMT_PHASE_MASK      BIT(16)
+#define SPIFMT_POLARITY_MASK   BIT(17)
+#define SPIFMT_DISTIMER_MASK   BIT(18)
+#define SPIFMT_SHIFTDIR_MASK   BIT(20)
+#define SPIFMT_WAITENA_MASK    BIT(21)
+#define SPIFMT_PARITYENA_MASK  BIT(22)
+#define SPIFMT_ODD_PARITY_MASK BIT(23)
+#define SPIFMT_WDELAY_MASK     0x3f000000u
+#define SPIFMT_WDELAY_SHIFT    24
+#define SPIFMT_CHARLEN_MASK    0x0000001Fu
+
+/* SPIGCR1 */
+#define SPIGCR1_SPIENA_MASK    0x01000000u
+
+/* SPIPC0 */
+#define SPIPC0_DIFUN_MASK      BIT(11)         /* MISO */
+#define SPIPC0_DOFUN_MASK      BIT(10)         /* MOSI */
+#define SPIPC0_CLKFUN_MASK     BIT(9)          /* CLK */
+#define SPIPC0_SPIENA_MASK     BIT(8)          /* nREADY */
+#define SPIPC0_EN1FUN_MASK     BIT(1)
+#define SPIPC0_EN0FUN_MASK     BIT(0)
+
+#define SPIINT_MASKALL         0x0101035F
+#define SPI_INTLVL_1           0x000001FFu
+#define SPI_INTLVL_0           0x00000000u
+
+/* SPIDAT1 */
+#define SPIDAT1_CSHOLD_SHIFT   28
+#define SPIDAT1_CSNR_SHIFT     16
+#define SPIGCR1_CLKMOD_MASK    BIT(1)
+#define SPIGCR1_MASTER_MASK     BIT(0)
+#define SPIGCR1_LOOPBACK_MASK  BIT(16)
+
+/* SPIBUF */
+#define SPIBUF_TXFULL_MASK     BIT(29)
+#define SPIBUF_RXEMPTY_MASK    BIT(31)
+
+/* Error Masks */
+#define SPIFLG_DLEN_ERR_MASK           BIT(0)
+#define SPIFLG_TIMEOUT_MASK            BIT(1)
+#define SPIFLG_PARERR_MASK             BIT(2)
+#define SPIFLG_DESYNC_MASK             BIT(3)
+#define SPIFLG_BITERR_MASK             BIT(4)
+#define SPIFLG_OVRRUN_MASK             BIT(6)
+#define SPIFLG_RX_INTR_MASK            BIT(8)
+#define SPIFLG_TX_INTR_MASK            BIT(9)
+#define SPIFLG_BUF_INIT_ACTIVE_MASK    BIT(24)
+#define SPIFLG_MASK                    (SPIFLG_DLEN_ERR_MASK \
+                               | SPIFLG_TIMEOUT_MASK | SPIFLG_PARERR_MASK \
+                               | SPIFLG_DESYNC_MASK | SPIFLG_BITERR_MASK \
+                               | SPIFLG_OVRRUN_MASK | SPIFLG_RX_INTR_MASK \
+                               | SPIFLG_TX_INTR_MASK \
+                               | SPIFLG_BUF_INIT_ACTIVE_MASK)
+
+#define SPIINT_DLEN_ERR_INTR   BIT(0)
+#define SPIINT_TIMEOUT_INTR    BIT(1)
+#define SPIINT_PARERR_INTR     BIT(2)
+#define SPIINT_DESYNC_INTR     BIT(3)
+#define SPIINT_BITERR_INTR     BIT(4)
+#define SPIINT_OVRRUN_INTR     BIT(6)
+#define SPIINT_RX_INTR         BIT(8)
+#define SPIINT_TX_INTR         BIT(9)
+#define SPIINT_DMA_REQ_EN      BIT(16)
+#define SPIINT_ENABLE_HIGHZ    BIT(24)
+
+#define SPI_T2CDELAY_SHIFT     16
+#define SPI_C2TDELAY_SHIFT     24
+
+/* SPI Controller registers */
+#define SPIGCR0                0x00
+#define SPIGCR1                0x04
+#define SPIINT         0x08
+#define SPILVL         0x0c
+#define SPIFLG         0x10
+#define SPIPC0         0x14
+#define SPIPC1         0x18
+#define SPIPC2         0x1c
+#define SPIPC3         0x20
+#define SPIPC4         0x24
+#define SPIPC5         0x28
+#define SPIPC6         0x2c
+#define SPIPC7         0x30
+#define SPIPC8         0x34
+#define SPIDAT0                0x38
+#define SPIDAT1                0x3c
+#define SPIBUF         0x40
+#define SPIEMU         0x44
+#define SPIDELAY       0x48
+#define SPIDEF         0x4c
+#define SPIFMT0                0x50
+#define SPIFMT1                0x54
+#define SPIFMT2                0x58
+#define SPIFMT3                0x5c
+#define TGINTVEC0      0x60
+#define TGINTVEC1      0x64
+
+struct davinci_spi_slave {
+       u32     cmd_to_write;
+       u32     clk_ctrl_to_write;
+       u32     bytes_per_word;
+       u8      active_cs;
+};
+
+/* We have 2 DMA channels per CS, one for RX and one for TX */
+struct davinci_spi_dma {
+       int                     dma_tx_channel;
+       int                     dma_rx_channel;
+       int                     dma_tx_sync_dev;
+       int                     dma_rx_sync_dev;
+       enum dma_event_q        eventq;
+
+       struct completion       dma_tx_completion;
+       struct completion       dma_rx_completion;
+};
+
+/* SPI Controller driver's private data. */
+struct davinci_spi {
+       struct spi_bitbang      bitbang;
+       struct clk              *clk;
+
+       u8                      version;
+       resource_size_t         pbase;
+       void __iomem            *base;
+       size_t                  region_size;
+       u32                     irq;
+       struct completion       done;
+
+       const void              *tx;
+       void                    *rx;
+       u8                      *tmp_buf;
+       int                     count;
+       struct davinci_spi_dma  *dma_channels;
+       struct                  davinci_spi_platform_data *pdata;
+
+       void                    (*get_rx)(u32 rx_data, struct davinci_spi *);
+       u32                     (*get_tx)(struct davinci_spi *);
+
+       struct davinci_spi_slave slave[SPI_MAX_CHIPSELECT];
+};
+
+static unsigned use_dma;
+
+static void davinci_spi_rx_buf_u8(u32 data, struct davinci_spi *davinci_spi)
+{
+       u8 *rx = davinci_spi->rx;
+
+       *rx++ = (u8)data;
+       davinci_spi->rx = rx;
+}
+
+static void davinci_spi_rx_buf_u16(u32 data, struct davinci_spi *davinci_spi)
+{
+       u16 *rx = davinci_spi->rx;
+
+       *rx++ = (u16)data;
+       davinci_spi->rx = rx;
+}
+
+static u32 davinci_spi_tx_buf_u8(struct davinci_spi *davinci_spi)
+{
+       u32 data;
+       const u8 *tx = davinci_spi->tx;
+
+       data = *tx++;
+       davinci_spi->tx = tx;
+       return data;
+}
+
+static u32 davinci_spi_tx_buf_u16(struct davinci_spi *davinci_spi)
+{
+       u32 data;
+       const u16 *tx = davinci_spi->tx;
+
+       data = *tx++;
+       davinci_spi->tx = tx;
+       return data;
+}
+
+static inline void set_io_bits(void __iomem *addr, u32 bits)
+{
+       u32 v = ioread32(addr);
+
+       v |= bits;
+       iowrite32(v, addr);
+}
+
+static inline void clear_io_bits(void __iomem *addr, u32 bits)
+{
+       u32 v = ioread32(addr);
+
+       v &= ~bits;
+       iowrite32(v, addr);
+}
+
+static inline void set_fmt_bits(void __iomem *addr, u32 bits, int cs_num)
+{
+       set_io_bits(addr + SPIFMT0 + (0x4 * cs_num), bits);
+}
+
+static inline void clear_fmt_bits(void __iomem *addr, u32 bits, int cs_num)
+{
+       clear_io_bits(addr + SPIFMT0 + (0x4 * cs_num), bits);
+}
+
+static void davinci_spi_set_dma_req(const struct spi_device *spi, int enable)
+{
+       struct davinci_spi *davinci_spi = spi_master_get_devdata(spi->master);
+
+       if (enable)
+               set_io_bits(davinci_spi->base + SPIINT, SPIINT_DMA_REQ_EN);
+       else
+               clear_io_bits(davinci_spi->base + SPIINT, SPIINT_DMA_REQ_EN);
+}
+
+/*
+ * Interface to control the chip select signal
+ */
+static void davinci_spi_chipselect(struct spi_device *spi, int value)
+{
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_platform_data *pdata;
+       u32 data1_reg_val = 0;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       pdata = davinci_spi->pdata;
+
+       /*
+        * Board specific chip select logic decides the polarity and cs
+        * line for the controller
+        */
+       if (value == BITBANG_CS_INACTIVE) {
+               set_io_bits(davinci_spi->base + SPIDEF, CS_DEFAULT);
+
+               data1_reg_val |= CS_DEFAULT << SPIDAT1_CSNR_SHIFT;
+               iowrite32(data1_reg_val, davinci_spi->base + SPIDAT1);
+
+               while ((ioread32(davinci_spi->base + SPIBUF)
+                                       & SPIBUF_RXEMPTY_MASK) == 0)
+                       cpu_relax();
+       }
+}
+
+/**
+ * davinci_spi_setup_transfer - This functions will determine transfer method
+ * @spi: spi device on which data transfer to be done
+ * @t: spi transfer in which transfer info is filled
+ *
+ * This function determines data transfer method (8/16/32 bit transfer).
+ * It will also set the SPI Clock Control register according to
+ * SPI slave device freq.
+ */
+static int davinci_spi_setup_transfer(struct spi_device *spi,
+               struct spi_transfer *t)
+{
+
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_platform_data *pdata;
+       u8 bits_per_word = 0;
+       u32 hz = 0, prescale;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       pdata = davinci_spi->pdata;
+
+       if (t) {
+               bits_per_word = t->bits_per_word;
+               hz = t->speed_hz;
+       }
+
+       /* if bits_per_word is not set then set it default */
+       if (!bits_per_word)
+               bits_per_word = spi->bits_per_word;
+
+       /*
+        * Assign function pointer to appropriate transfer method
+        * 8bit, 16bit or 32bit transfer
+        */
+       if (bits_per_word <= 8 && bits_per_word >= 2) {
+               davinci_spi->get_rx = davinci_spi_rx_buf_u8;
+               davinci_spi->get_tx = davinci_spi_tx_buf_u8;
+               davinci_spi->slave[spi->chip_select].bytes_per_word = 1;
+       } else if (bits_per_word <= 16 && bits_per_word >= 2) {
+               davinci_spi->get_rx = davinci_spi_rx_buf_u16;
+               davinci_spi->get_tx = davinci_spi_tx_buf_u16;
+               davinci_spi->slave[spi->chip_select].bytes_per_word = 2;
+       } else
+               return -EINVAL;
+
+       if (!hz)
+               hz = spi->max_speed_hz;
+
+       clear_fmt_bits(davinci_spi->base, SPIFMT_CHARLEN_MASK,
+                       spi->chip_select);
+       set_fmt_bits(davinci_spi->base, bits_per_word & 0x1f,
+                       spi->chip_select);
+
+       prescale = ((clk_get_rate(davinci_spi->clk) / hz) - 1) & 0xff;
+
+       clear_fmt_bits(davinci_spi->base, 0x0000ff00, spi->chip_select);
+       set_fmt_bits(davinci_spi->base, prescale << 8, spi->chip_select);
+
+       return 0;
+}
+
+static void davinci_spi_dma_rx_callback(unsigned lch, u16 ch_status, void *data)
+{
+       struct spi_device *spi = (struct spi_device *)data;
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_dma *davinci_spi_dma;
+       struct davinci_spi_platform_data *pdata;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       davinci_spi_dma = &(davinci_spi->dma_channels[spi->chip_select]);
+       pdata = davinci_spi->pdata;
+
+       if (ch_status == DMA_COMPLETE)
+               edma_stop(davinci_spi_dma->dma_rx_channel);
+       else
+               edma_clean_channel(davinci_spi_dma->dma_rx_channel);
+
+       complete(&davinci_spi_dma->dma_rx_completion);
+       /* We must disable the DMA RX request */
+       davinci_spi_set_dma_req(spi, 0);
+}
+
+static void davinci_spi_dma_tx_callback(unsigned lch, u16 ch_status, void *data)
+{
+       struct spi_device *spi = (struct spi_device *)data;
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_dma *davinci_spi_dma;
+       struct davinci_spi_platform_data *pdata;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       davinci_spi_dma = &(davinci_spi->dma_channels[spi->chip_select]);
+       pdata = davinci_spi->pdata;
+
+       if (ch_status == DMA_COMPLETE)
+               edma_stop(davinci_spi_dma->dma_tx_channel);
+       else
+               edma_clean_channel(davinci_spi_dma->dma_tx_channel);
+
+       complete(&davinci_spi_dma->dma_tx_completion);
+       /* We must disable the DMA TX request */
+       davinci_spi_set_dma_req(spi, 0);
+}
+
+static int davinci_spi_request_dma(struct spi_device *spi)
+{
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_dma *davinci_spi_dma;
+       struct davinci_spi_platform_data *pdata;
+       struct device *sdev;
+       int r;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
+       pdata = davinci_spi->pdata;
+       sdev = davinci_spi->bitbang.master->dev.parent;
+
+       r = edma_alloc_channel(davinci_spi_dma->dma_rx_sync_dev,
+                               davinci_spi_dma_rx_callback, spi,
+                               davinci_spi_dma->eventq);
+       if (r < 0) {
+               dev_dbg(sdev, "Unable to request DMA channel for SPI RX\n");
+               return -EAGAIN;
+       }
+       davinci_spi_dma->dma_rx_channel = r;
+       r = edma_alloc_channel(davinci_spi_dma->dma_tx_sync_dev,
+                               davinci_spi_dma_tx_callback, spi,
+                               davinci_spi_dma->eventq);
+       if (r < 0) {
+               edma_free_channel(davinci_spi_dma->dma_rx_channel);
+               davinci_spi_dma->dma_rx_channel = -1;
+               dev_dbg(sdev, "Unable to request DMA channel for SPI TX\n");
+               return -EAGAIN;
+       }
+       davinci_spi_dma->dma_tx_channel = r;
+
+       return 0;
+}
+
+/**
+ * davinci_spi_setup - This functions will set default transfer method
+ * @spi: spi device on which data transfer to be done
+ *
+ * This functions sets the default transfer method.
+ */
+
+static int davinci_spi_setup(struct spi_device *spi)
+{
+       int retval;
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_dma *davinci_spi_dma;
+       struct device *sdev;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       sdev = davinci_spi->bitbang.master->dev.parent;
+
+       /* if bits per word length is zero then set it default 8 */
+       if (!spi->bits_per_word)
+               spi->bits_per_word = 8;
+
+       davinci_spi->slave[spi->chip_select].cmd_to_write = 0;
+
+       if (use_dma && davinci_spi->dma_channels) {
+               davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
+
+               if ((davinci_spi_dma->dma_rx_channel == -1)
+                               || (davinci_spi_dma->dma_tx_channel == -1)) {
+                       retval = davinci_spi_request_dma(spi);
+                       if (retval < 0)
+                               return retval;
+               }
+       }
+
+       /*
+        * SPI in DaVinci and DA8xx operate between
+        * 600 KHz and 50 MHz
+        */
+       if (spi->max_speed_hz < 600000 || spi->max_speed_hz > 50000000) {
+               dev_dbg(sdev, "Operating frequency is not in acceptable "
+                               "range\n");
+               return -EINVAL;
+       }
+
+       /*
+        * Set up SPIFMTn register, unique to this chipselect.
+        *
+        * NOTE: we could do all of these with one write.  Also, some
+        * of the "version 2" features are found in chips that don't
+        * support all of them...
+        */
+       if (spi->mode & SPI_LSB_FIRST)
+               set_fmt_bits(davinci_spi->base, SPIFMT_SHIFTDIR_MASK,
+                               spi->chip_select);
+       else
+               clear_fmt_bits(davinci_spi->base, SPIFMT_SHIFTDIR_MASK,
+                               spi->chip_select);
+
+       if (spi->mode & SPI_CPOL)
+               set_fmt_bits(davinci_spi->base, SPIFMT_POLARITY_MASK,
+                               spi->chip_select);
+       else
+               clear_fmt_bits(davinci_spi->base, SPIFMT_POLARITY_MASK,
+                               spi->chip_select);
+
+       if (!(spi->mode & SPI_CPHA))
+               set_fmt_bits(davinci_spi->base, SPIFMT_PHASE_MASK,
+                               spi->chip_select);
+       else
+               clear_fmt_bits(davinci_spi->base, SPIFMT_PHASE_MASK,
+                               spi->chip_select);
+
+       /*
+        * Version 1 hardware supports two basic SPI modes:
+        *  - Standard SPI mode uses 4 pins, with chipselect
+        *  - 3 pin SPI is a 4 pin variant without CS (SPI_NO_CS)
+        *      (distinct from SPI_3WIRE, with just one data wire;
+        *      or similar variants without MOSI or without MISO)
+        *
+        * Version 2 hardware supports an optional handshaking signal,
+        * so it can support two more modes:
+        *  - 5 pin SPI variant is standard SPI plus SPI_READY
+        *  - 4 pin with enable is (SPI_READY | SPI_NO_CS)
+        */
+
+       if (davinci_spi->version == SPI_VERSION_2) {
+               clear_fmt_bits(davinci_spi->base, SPIFMT_WDELAY_MASK,
+                               spi->chip_select);
+               set_fmt_bits(davinci_spi->base,
+                               (davinci_spi->pdata->wdelay
+                                               << SPIFMT_WDELAY_SHIFT)
+                                       & SPIFMT_WDELAY_MASK,
+                               spi->chip_select);
+
+               if (davinci_spi->pdata->odd_parity)
+                       set_fmt_bits(davinci_spi->base,
+                                       SPIFMT_ODD_PARITY_MASK,
+                                       spi->chip_select);
+               else
+                       clear_fmt_bits(davinci_spi->base,
+                                       SPIFMT_ODD_PARITY_MASK,
+                                       spi->chip_select);
+
+               if (davinci_spi->pdata->parity_enable)
+                       set_fmt_bits(davinci_spi->base,
+                                       SPIFMT_PARITYENA_MASK,
+                                       spi->chip_select);
+               else
+                       clear_fmt_bits(davinci_spi->base,
+                                       SPIFMT_PARITYENA_MASK,
+                                       spi->chip_select);
+
+               if (davinci_spi->pdata->wait_enable)
+                       set_fmt_bits(davinci_spi->base,
+                                       SPIFMT_WAITENA_MASK,
+                                       spi->chip_select);
+               else
+                       clear_fmt_bits(davinci_spi->base,
+                                       SPIFMT_WAITENA_MASK,
+                                       spi->chip_select);
+
+               if (davinci_spi->pdata->timer_disable)
+                       set_fmt_bits(davinci_spi->base,
+                                       SPIFMT_DISTIMER_MASK,
+                                       spi->chip_select);
+               else
+                       clear_fmt_bits(davinci_spi->base,
+                                       SPIFMT_DISTIMER_MASK,
+                                       spi->chip_select);
+       }
+
+       retval = davinci_spi_setup_transfer(spi, NULL);
+
+       return retval;
+}
+
+static void davinci_spi_cleanup(struct spi_device *spi)
+{
+       struct davinci_spi *davinci_spi = spi_master_get_devdata(spi->master);
+       struct davinci_spi_dma *davinci_spi_dma;
+
+       davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
+
+       if (use_dma && davinci_spi->dma_channels) {
+               davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
+
+               if ((davinci_spi_dma->dma_rx_channel != -1)
+                               && (davinci_spi_dma->dma_tx_channel != -1)) {
+                       edma_free_channel(davinci_spi_dma->dma_tx_channel);
+                       edma_free_channel(davinci_spi_dma->dma_rx_channel);
+               }
+       }
+}
+
+static int davinci_spi_bufs_prep(struct spi_device *spi,
+                                struct davinci_spi *davinci_spi)
+{
+       int op_mode = 0;
+
+       /*
+        * REVISIT  unless devices disagree about SPI_LOOP or
+        * SPI_READY (SPI_NO_CS only allows one device!), this
+        * should not need to be done before each message...
+        * optimize for both flags staying cleared.
+        */
+
+       op_mode = SPIPC0_DIFUN_MASK
+               | SPIPC0_DOFUN_MASK
+               | SPIPC0_CLKFUN_MASK;
+       if (!(spi->mode & SPI_NO_CS))
+               op_mode |= 1 << spi->chip_select;
+       if (spi->mode & SPI_READY)
+               op_mode |= SPIPC0_SPIENA_MASK;
+
+       iowrite32(op_mode, davinci_spi->base + SPIPC0);
+
+       if (spi->mode & SPI_LOOP)
+               set_io_bits(davinci_spi->base + SPIGCR1,
+                               SPIGCR1_LOOPBACK_MASK);
+       else
+               clear_io_bits(davinci_spi->base + SPIGCR1,
+                               SPIGCR1_LOOPBACK_MASK);
+
+       return 0;
+}
+
+static int davinci_spi_check_error(struct davinci_spi *davinci_spi,
+                                  int int_status)
+{
+       struct device *sdev = davinci_spi->bitbang.master->dev.parent;
+
+       if (int_status & SPIFLG_TIMEOUT_MASK) {
+               dev_dbg(sdev, "SPI Time-out Error\n");
+               return -ETIMEDOUT;
+       }
+       if (int_status & SPIFLG_DESYNC_MASK) {
+               dev_dbg(sdev, "SPI Desynchronization Error\n");
+               return -EIO;
+       }
+       if (int_status & SPIFLG_BITERR_MASK) {
+               dev_dbg(sdev, "SPI Bit error\n");
+               return -EIO;
+       }
+
+       if (davinci_spi->version == SPI_VERSION_2) {
+               if (int_status & SPIFLG_DLEN_ERR_MASK) {
+                       dev_dbg(sdev, "SPI Data Length Error\n");
+                       return -EIO;
+               }
+               if (int_status & SPIFLG_PARERR_MASK) {
+                       dev_dbg(sdev, "SPI Parity Error\n");
+                       return -EIO;
+               }
+               if (int_status & SPIFLG_OVRRUN_MASK) {
+                       dev_dbg(sdev, "SPI Data Overrun error\n");
+                       return -EIO;
+               }
+               if (int_status & SPIFLG_TX_INTR_MASK) {
+                       dev_dbg(sdev, "SPI TX intr bit set\n");
+                       return -EIO;
+               }
+               if (int_status & SPIFLG_BUF_INIT_ACTIVE_MASK) {
+                       dev_dbg(sdev, "SPI Buffer Init Active\n");
+                       return -EBUSY;
+               }
+       }
+
+       return 0;
+}
+
+/**
+ * davinci_spi_bufs - functions which will handle transfer data
+ * @spi: spi device on which data transfer to be done
+ * @t: spi transfer in which transfer info is filled
+ *
+ * This function will put data to be transferred into data register
+ * of SPI controller and then wait until the completion will be marked
+ * by the IRQ Handler.
+ */
+static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct davinci_spi *davinci_spi;
+       int int_status, count, ret;
+       u8 conv, tmp;
+       u32 tx_data, data1_reg_val;
+       u32 buf_val, flg_val;
+       struct davinci_spi_platform_data *pdata;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       pdata = davinci_spi->pdata;
+
+       davinci_spi->tx = t->tx_buf;
+       davinci_spi->rx = t->rx_buf;
+
+       /* convert len to words based on bits_per_word */
+       conv = davinci_spi->slave[spi->chip_select].bytes_per_word;
+       davinci_spi->count = t->len / conv;
+
+       INIT_COMPLETION(davinci_spi->done);
+
+       ret = davinci_spi_bufs_prep(spi, davinci_spi);
+       if (ret)
+               return ret;
+
+       /* Enable SPI */
+       set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
+
+       iowrite32(0 | (pdata->c2tdelay << SPI_C2TDELAY_SHIFT) |
+                       (pdata->t2cdelay << SPI_T2CDELAY_SHIFT),
+                       davinci_spi->base + SPIDELAY);
+
+       count = davinci_spi->count;
+       data1_reg_val = pdata->cs_hold << SPIDAT1_CSHOLD_SHIFT;
+       tmp = ~(0x1 << spi->chip_select);
+
+       clear_io_bits(davinci_spi->base + SPIDEF, ~tmp);
+
+       data1_reg_val |= tmp << SPIDAT1_CSNR_SHIFT;
+
+       while ((ioread32(davinci_spi->base + SPIBUF)
+                               & SPIBUF_RXEMPTY_MASK) == 0)
+               cpu_relax();
+
+       /* Determine the command to execute READ or WRITE */
+       if (t->tx_buf) {
+               clear_io_bits(davinci_spi->base + SPIINT, SPIINT_MASKALL);
+
+               while (1) {
+                       tx_data = davinci_spi->get_tx(davinci_spi);
+
+                       data1_reg_val &= ~(0xFFFF);
+                       data1_reg_val |= (0xFFFF & tx_data);
+
+                       buf_val = ioread32(davinci_spi->base + SPIBUF);
+                       if ((buf_val & SPIBUF_TXFULL_MASK) == 0) {
+                               iowrite32(data1_reg_val,
+                                               davinci_spi->base + SPIDAT1);
+
+                               count--;
+                       }
+                       while (ioread32(davinci_spi->base + SPIBUF)
+                                       & SPIBUF_RXEMPTY_MASK)
+                               cpu_relax();
+
+                       /* getting the returned byte */
+                       if (t->rx_buf) {
+                               buf_val = ioread32(davinci_spi->base + SPIBUF);
+                               davinci_spi->get_rx(buf_val, davinci_spi);
+                       }
+                       if (count <= 0)
+                               break;
+               }
+       } else {
+               if (pdata->poll_mode) {
+                       while (1) {
+                               /* keeps the serial clock going */
+                               if ((ioread32(davinci_spi->base + SPIBUF)
+                                               & SPIBUF_TXFULL_MASK) == 0)
+                                       iowrite32(data1_reg_val,
+                                               davinci_spi->base + SPIDAT1);
+
+                               while (ioread32(davinci_spi->base + SPIBUF) &
+                                               SPIBUF_RXEMPTY_MASK)
+                                       cpu_relax();
+
+                               flg_val = ioread32(davinci_spi->base + SPIFLG);
+                               buf_val = ioread32(davinci_spi->base + SPIBUF);
+
+                               davinci_spi->get_rx(buf_val, davinci_spi);
+
+                               count--;
+                               if (count <= 0)
+                                       break;
+                       }
+               } else {        /* Receive in Interrupt mode */
+                       int i;
+
+                       for (i = 0; i < davinci_spi->count; i++) {
+                               set_io_bits(davinci_spi->base + SPIINT,
+                                               SPIINT_BITERR_INTR
+                                               | SPIINT_OVRRUN_INTR
+                                               | SPIINT_RX_INTR);
+
+                               iowrite32(data1_reg_val,
+                                               davinci_spi->base + SPIDAT1);
+
+                               while (ioread32(davinci_spi->base + SPIINT) &
+                                               SPIINT_RX_INTR)
+                                       cpu_relax();
+                       }
+                       iowrite32((data1_reg_val & 0x0ffcffff),
+                                       davinci_spi->base + SPIDAT1);
+               }
+       }
+
+       /*
+        * Check for bit error, desync error,parity error,timeout error and
+        * receive overflow errors
+        */
+       int_status = ioread32(davinci_spi->base + SPIFLG);
+
+       ret = davinci_spi_check_error(davinci_spi, int_status);
+       if (ret != 0)
+               return ret;
+
+       /* SPI Framework maintains the count only in bytes so convert back */
+       davinci_spi->count *= conv;
+
+       return t->len;
+}
+
+#define DAVINCI_DMA_DATA_TYPE_S8       0x01
+#define DAVINCI_DMA_DATA_TYPE_S16      0x02
+#define DAVINCI_DMA_DATA_TYPE_S32      0x04
+
+static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct davinci_spi *davinci_spi;
+       int int_status = 0;
+       int count, temp_count;
+       u8 conv = 1;
+       u8 tmp;
+       u32 data1_reg_val;
+       struct davinci_spi_dma *davinci_spi_dma;
+       int word_len, data_type, ret;
+       unsigned long tx_reg, rx_reg;
+       struct davinci_spi_platform_data *pdata;
+       struct device *sdev;
+
+       davinci_spi = spi_master_get_devdata(spi->master);
+       pdata = davinci_spi->pdata;
+       sdev = davinci_spi->bitbang.master->dev.parent;
+
+       davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
+
+       tx_reg = (unsigned long)davinci_spi->pbase + SPIDAT1;
+       rx_reg = (unsigned long)davinci_spi->pbase + SPIBUF;
+
+       davinci_spi->tx = t->tx_buf;
+       davinci_spi->rx = t->rx_buf;
+
+       /* convert len to words based on bits_per_word */
+       conv = davinci_spi->slave[spi->chip_select].bytes_per_word;
+       davinci_spi->count = t->len / conv;
+
+       INIT_COMPLETION(davinci_spi->done);
+
+       init_completion(&davinci_spi_dma->dma_rx_completion);
+       init_completion(&davinci_spi_dma->dma_tx_completion);
+
+       word_len = conv * 8;
+
+       if (word_len <= 8)
+               data_type = DAVINCI_DMA_DATA_TYPE_S8;
+       else if (word_len <= 16)
+               data_type = DAVINCI_DMA_DATA_TYPE_S16;
+       else if (word_len <= 32)
+               data_type = DAVINCI_DMA_DATA_TYPE_S32;
+       else
+               return -EINVAL;
+
+       ret = davinci_spi_bufs_prep(spi, davinci_spi);
+       if (ret)
+               return ret;
+
+       /* Put delay val if required */
+       iowrite32(0 | (pdata->c2tdelay << SPI_C2TDELAY_SHIFT) |
+                       (pdata->t2cdelay << SPI_T2CDELAY_SHIFT),
+                       davinci_spi->base + SPIDELAY);
+
+       count = davinci_spi->count;     /* the number of elements */
+       data1_reg_val = pdata->cs_hold << SPIDAT1_CSHOLD_SHIFT;
+
+       /* CS default = 0xFF */
+       tmp = ~(0x1 << spi->chip_select);
+
+       clear_io_bits(davinci_spi->base + SPIDEF, ~tmp);
+
+       data1_reg_val |= tmp << SPIDAT1_CSNR_SHIFT;
+
+       /* disable all interrupts for dma transfers */
+       clear_io_bits(davinci_spi->base + SPIINT, SPIINT_MASKALL);
+       /* Disable SPI to write configuration bits in SPIDAT */
+       clear_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
+       iowrite32(data1_reg_val, davinci_spi->base + SPIDAT1);
+       /* Enable SPI */
+       set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
+
+       while ((ioread32(davinci_spi->base + SPIBUF)
+                               & SPIBUF_RXEMPTY_MASK) == 0)
+               cpu_relax();
+
+
+       if (t->tx_buf) {
+               t->tx_dma = dma_map_single(&spi->dev, (void *)t->tx_buf, count,
+                               DMA_TO_DEVICE);
+               if (dma_mapping_error(&spi->dev, t->tx_dma)) {
+                       dev_dbg(sdev, "Unable to DMA map a %d bytes"
+                               " TX buffer\n", count);
+                       return -ENOMEM;
+               }
+               temp_count = count;
+       } else {
+               /* We need TX clocking for RX transaction */
+               t->tx_dma = dma_map_single(&spi->dev,
+                               (void *)davinci_spi->tmp_buf, count + 1,
+                               DMA_TO_DEVICE);
+               if (dma_mapping_error(&spi->dev, t->tx_dma)) {
+                       dev_dbg(sdev, "Unable to DMA map a %d bytes"
+                               " TX tmp buffer\n", count);
+                       return -ENOMEM;
+               }
+               temp_count = count + 1;
+       }
+
+       edma_set_transfer_params(davinci_spi_dma->dma_tx_channel,
+                                       data_type, temp_count, 1, 0, ASYNC);
+       edma_set_dest(davinci_spi_dma->dma_tx_channel, tx_reg, INCR, W8BIT);
+       edma_set_src(davinci_spi_dma->dma_tx_channel, t->tx_dma, INCR, W8BIT);
+       edma_set_src_index(davinci_spi_dma->dma_tx_channel, data_type, 0);
+       edma_set_dest_index(davinci_spi_dma->dma_tx_channel, 0, 0);
+
+       if (t->rx_buf) {
+               /* initiate transaction */
+               iowrite32(data1_reg_val, davinci_spi->base + SPIDAT1);
+
+               t->rx_dma = dma_map_single(&spi->dev, (void *)t->rx_buf, count,
+                               DMA_FROM_DEVICE);
+               if (dma_mapping_error(&spi->dev, t->rx_dma)) {
+                       dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n",
+                                       count);
+                       if (t->tx_buf != NULL)
+                               dma_unmap_single(NULL, t->tx_dma,
+                                                count, DMA_TO_DEVICE);
+                       return -ENOMEM;
+               }
+               edma_set_transfer_params(davinci_spi_dma->dma_rx_channel,
+                               data_type, count, 1, 0, ASYNC);
+               edma_set_src(davinci_spi_dma->dma_rx_channel,
+                               rx_reg, INCR, W8BIT);
+               edma_set_dest(davinci_spi_dma->dma_rx_channel,
+                               t->rx_dma, INCR, W8BIT);
+               edma_set_src_index(davinci_spi_dma->dma_rx_channel, 0, 0);
+               edma_set_dest_index(davinci_spi_dma->dma_rx_channel,
+                               data_type, 0);
+       }
+
+       if ((t->tx_buf) || (t->rx_buf))
+               edma_start(davinci_spi_dma->dma_tx_channel);
+
+       if (t->rx_buf)
+               edma_start(davinci_spi_dma->dma_rx_channel);
+
+       if ((t->rx_buf) || (t->tx_buf))
+               davinci_spi_set_dma_req(spi, 1);
+
+       if (t->tx_buf)
+               wait_for_completion_interruptible(
+                               &davinci_spi_dma->dma_tx_completion);
+
+       if (t->rx_buf)
+               wait_for_completion_interruptible(
+                               &davinci_spi_dma->dma_rx_completion);
+
+       dma_unmap_single(NULL, t->tx_dma, temp_count, DMA_TO_DEVICE);
+
+       if (t->rx_buf)
+               dma_unmap_single(NULL, t->rx_dma, count, DMA_FROM_DEVICE);
+
+       /*
+        * Check for bit error, desync error,parity error,timeout error and
+        * receive overflow errors
+        */
+       int_status = ioread32(davinci_spi->base + SPIFLG);
+
+       ret = davinci_spi_check_error(davinci_spi, int_status);
+       if (ret != 0)
+               return ret;
+
+       /* SPI Framework maintains the count only in bytes so convert back */
+       davinci_spi->count *= conv;
+
+       return t->len;
+}
+
+/**
+ * davinci_spi_irq - IRQ handler for DaVinci SPI
+ * @irq: IRQ number for this SPI Master
+ * @context_data: structure for SPI Master controller davinci_spi
+ */
+static irqreturn_t davinci_spi_irq(s32 irq, void *context_data)
+{
+       struct davinci_spi *davinci_spi = context_data;
+       u32 int_status, rx_data = 0;
+       irqreturn_t ret = IRQ_NONE;
+
+       int_status = ioread32(davinci_spi->base + SPIFLG);
+
+       while ((int_status & SPIFLG_RX_INTR_MASK)) {
+               if (likely(int_status & SPIFLG_RX_INTR_MASK)) {
+                       ret = IRQ_HANDLED;
+
+                       rx_data = ioread32(davinci_spi->base + SPIBUF);
+                       davinci_spi->get_rx(rx_data, davinci_spi);
+
+                       /* Disable Receive Interrupt */
+                       iowrite32(~(SPIINT_RX_INTR | SPIINT_TX_INTR),
+                                       davinci_spi->base + SPIINT);
+               } else
+                       (void)davinci_spi_check_error(davinci_spi, int_status);
+
+               int_status = ioread32(davinci_spi->base + SPIFLG);
+       }
+
+       return ret;
+}
+
+/**
+ * davinci_spi_probe - probe function for SPI Master Controller
+ * @pdev: platform_device structure which contains plateform specific data
+ */
+static int davinci_spi_probe(struct platform_device *pdev)
+{
+       struct spi_master *master;
+       struct davinci_spi *davinci_spi;
+       struct davinci_spi_platform_data *pdata;
+       struct resource *r, *mem;
+       resource_size_t dma_rx_chan = SPI_NO_RESOURCE;
+       resource_size_t dma_tx_chan = SPI_NO_RESOURCE;
+       resource_size_t dma_eventq = SPI_NO_RESOURCE;
+       int i = 0, ret = 0;
+
+       pdata = pdev->dev.platform_data;
+       if (pdata == NULL) {
+               ret = -ENODEV;
+               goto err;
+       }
+
+       master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi));
+       if (master == NULL) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       dev_set_drvdata(&pdev->dev, master);
+
+       davinci_spi = spi_master_get_devdata(master);
+       if (davinci_spi == NULL) {
+               ret = -ENOENT;
+               goto free_master;
+       }
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (r == NULL) {
+               ret = -ENOENT;
+               goto free_master;
+       }
+
+       davinci_spi->pbase = r->start;
+       davinci_spi->region_size = resource_size(r);
+       davinci_spi->pdata = pdata;
+
+       mem = request_mem_region(r->start, davinci_spi->region_size,
+                                       pdev->name);
+       if (mem == NULL) {
+               ret = -EBUSY;
+               goto free_master;
+       }
+
+       davinci_spi->base = (struct davinci_spi_reg __iomem *)
+                       ioremap(r->start, davinci_spi->region_size);
+       if (davinci_spi->base == NULL) {
+               ret = -ENOMEM;
+               goto release_region;
+       }
+
+       davinci_spi->irq = platform_get_irq(pdev, 0);
+       if (davinci_spi->irq <= 0) {
+               ret = -EINVAL;
+               goto unmap_io;
+       }
+
+       ret = request_irq(davinci_spi->irq, davinci_spi_irq, IRQF_DISABLED,
+                         dev_name(&pdev->dev), davinci_spi);
+       if (ret)
+               goto unmap_io;
+
+       /* Allocate tmp_buf for tx_buf */
+       davinci_spi->tmp_buf = kzalloc(SPI_BUFSIZ, GFP_KERNEL);
+       if (davinci_spi->tmp_buf == NULL) {
+               ret = -ENOMEM;
+               goto irq_free;
+       }
+
+       davinci_spi->bitbang.master = spi_master_get(master);
+       if (davinci_spi->bitbang.master == NULL) {
+               ret = -ENODEV;
+               goto free_tmp_buf;
+       }
+
+       davinci_spi->clk = clk_get(&pdev->dev, NULL);
+       if (IS_ERR(davinci_spi->clk)) {
+               ret = -ENODEV;
+               goto put_master;
+       }
+       clk_enable(davinci_spi->clk);
+
+
+       master->bus_num = pdev->id;
+       master->num_chipselect = pdata->num_chipselect;
+       master->setup = davinci_spi_setup;
+       master->cleanup = davinci_spi_cleanup;
+
+       davinci_spi->bitbang.chipselect = davinci_spi_chipselect;
+       davinci_spi->bitbang.setup_transfer = davinci_spi_setup_transfer;
+
+       davinci_spi->version = pdata->version;
+       use_dma = pdata->use_dma;
+
+       davinci_spi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP;
+       if (davinci_spi->version == SPI_VERSION_2)
+               davinci_spi->bitbang.flags |= SPI_READY;
+
+       if (use_dma) {
+                       r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+                       if (r)
+                               dma_rx_chan = r->start;
+                       r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+                       if (r)
+                               dma_tx_chan = r->start;
+                       r = platform_get_resource(pdev, IORESOURCE_DMA, 2);
+                       if (r)
+                               dma_eventq = r->start;
+       }
+
+       if (!use_dma ||
+           dma_rx_chan == SPI_NO_RESOURCE ||
+           dma_tx_chan == SPI_NO_RESOURCE ||
+           dma_eventq  == SPI_NO_RESOURCE) {
+               davinci_spi->bitbang.txrx_bufs = davinci_spi_bufs_pio;
+               use_dma = 0;
+       } else {
+               davinci_spi->bitbang.txrx_bufs = davinci_spi_bufs_dma;
+               davinci_spi->dma_channels = kzalloc(master->num_chipselect
+                               * sizeof(struct davinci_spi_dma), GFP_KERNEL);
+               if (davinci_spi->dma_channels == NULL) {
+                       ret = -ENOMEM;
+                       goto free_clk;
+               }
+
+               for (i = 0; i < master->num_chipselect; i++) {
+                       davinci_spi->dma_channels[i].dma_rx_channel = -1;
+                       davinci_spi->dma_channels[i].dma_rx_sync_dev =
+                               dma_rx_chan;
+                       davinci_spi->dma_channels[i].dma_tx_channel = -1;
+                       davinci_spi->dma_channels[i].dma_tx_sync_dev =
+                               dma_tx_chan;
+                       davinci_spi->dma_channels[i].eventq = dma_eventq;
+               }
+               dev_info(&pdev->dev, "DaVinci SPI driver in EDMA mode\n"
+                               "Using RX channel = %d , TX channel = %d and "
+                               "event queue = %d", dma_rx_chan, dma_tx_chan,
+                               dma_eventq);
+       }
+
+       davinci_spi->get_rx = davinci_spi_rx_buf_u8;
+       davinci_spi->get_tx = davinci_spi_tx_buf_u8;
+
+       init_completion(&davinci_spi->done);
+
+       /* Reset In/OUT SPI module */
+       iowrite32(0, davinci_spi->base + SPIGCR0);
+       udelay(100);
+       iowrite32(1, davinci_spi->base + SPIGCR0);
+
+       /* Clock internal */
+       if (davinci_spi->pdata->clk_internal)
+               set_io_bits(davinci_spi->base + SPIGCR1,
+                               SPIGCR1_CLKMOD_MASK);
+       else
+               clear_io_bits(davinci_spi->base + SPIGCR1,
+                               SPIGCR1_CLKMOD_MASK);
+
+       /* master mode default */
+       set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_MASTER_MASK);
+
+       if (davinci_spi->pdata->intr_level)
+               iowrite32(SPI_INTLVL_1, davinci_spi->base + SPILVL);
+       else
+               iowrite32(SPI_INTLVL_0, davinci_spi->base + SPILVL);
+
+       ret = spi_bitbang_start(&davinci_spi->bitbang);
+       if (ret)
+               goto free_clk;
+
+       dev_info(&pdev->dev, "Controller at 0x%p \n", davinci_spi->base);
+
+       if (!pdata->poll_mode)
+               dev_info(&pdev->dev, "Operating in interrupt mode"
+                       " using IRQ %d\n", davinci_spi->irq);
+
+       return ret;
+
+free_clk:
+       clk_disable(davinci_spi->clk);
+       clk_put(davinci_spi->clk);
+put_master:
+       spi_master_put(master);
+free_tmp_buf:
+       kfree(davinci_spi->tmp_buf);
+irq_free:
+       free_irq(davinci_spi->irq, davinci_spi);
+unmap_io:
+       iounmap(davinci_spi->base);
+release_region:
+       release_mem_region(davinci_spi->pbase, davinci_spi->region_size);
+free_master:
+       kfree(master);
+err:
+       return ret;
+}
+
+/**
+ * davinci_spi_remove - remove function for SPI Master Controller
+ * @pdev: platform_device structure which contains plateform specific data
+ *
+ * This function will do the reverse action of davinci_spi_probe function
+ * It will free the IRQ and SPI controller's memory region.
+ * It will also call spi_bitbang_stop to destroy the work queue which was
+ * created by spi_bitbang_start.
+ */
+static int __exit davinci_spi_remove(struct platform_device *pdev)
+{
+       struct davinci_spi *davinci_spi;
+       struct spi_master *master;
+
+       master = dev_get_drvdata(&pdev->dev);
+       davinci_spi = spi_master_get_devdata(master);
+
+       spi_bitbang_stop(&davinci_spi->bitbang);
+
+       clk_disable(davinci_spi->clk);
+       clk_put(davinci_spi->clk);
+       spi_master_put(master);
+       kfree(davinci_spi->tmp_buf);
+       free_irq(davinci_spi->irq, davinci_spi);
+       iounmap(davinci_spi->base);
+       release_mem_region(davinci_spi->pbase, davinci_spi->region_size);
+
+       return 0;
+}
+
+static struct platform_driver davinci_spi_driver = {
+       .driver.name = "spi_davinci",
+       .remove = __exit_p(davinci_spi_remove),
+};
+
+static int __init davinci_spi_init(void)
+{
+       return platform_driver_probe(&davinci_spi_driver, davinci_spi_probe);
+}
+module_init(davinci_spi_init);
+
+static void __exit davinci_spi_exit(void)
+{
+       platform_driver_unregister(&davinci_spi_driver);
+}
+module_exit(davinci_spi_exit);
+
+MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver");
+MODULE_LICENSE("GPL");
index 31620fae77be607a469bbdc7baf3b314921a1ba9..8ed38f1d6c18d36daab177affb9fb1e015cd2c07 100644 (file)
@@ -152,6 +152,7 @@ static void mrst_spi_debugfs_remove(struct dw_spi *dws)
 #else
 static inline int mrst_spi_debugfs_init(struct dw_spi *dws)
 {
+       return 0;
 }
 
 static inline void mrst_spi_debugfs_remove(struct dw_spi *dws)
@@ -161,14 +162,14 @@ static inline void mrst_spi_debugfs_remove(struct dw_spi *dws)
 
 static void wait_till_not_busy(struct dw_spi *dws)
 {
-       unsigned long end = jiffies + usecs_to_jiffies(1000);
+       unsigned long end = jiffies + 1 + usecs_to_jiffies(1000);
 
        while (time_before(jiffies, end)) {
                if (!(dw_readw(dws, sr) & SR_BUSY))
                        return;
        }
        dev_err(&dws->master->dev,
-               "DW SPI: Stutus keeps busy for 1000us after a read/write!\n");
+               "DW SPI: Status keeps busy for 1000us after a read/write!\n");
 }
 
 static void flush(struct dw_spi *dws)
@@ -358,6 +359,8 @@ static void transfer_complete(struct dw_spi *dws)
 static irqreturn_t interrupt_transfer(struct dw_spi *dws)
 {
        u16 irq_status, irq_mask = 0x3f;
+       u32 int_level = dws->fifo_len / 2;
+       u32 left;
 
        irq_status = dw_readw(dws, isr) & irq_mask;
        /* Error handling */
@@ -369,22 +372,23 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
                return IRQ_HANDLED;
        }
 
-       /* INT comes from tx */
-       if (dws->tx && (irq_status & SPI_INT_TXEI)) {
-               while (dws->tx < dws->tx_end)
+       if (irq_status & SPI_INT_TXEI) {
+               spi_mask_intr(dws, SPI_INT_TXEI);
+
+               left = (dws->tx_end - dws->tx) / dws->n_bytes;
+               left = (left > int_level) ? int_level : left;
+
+               while (left--)
                        dws->write(dws);
+               dws->read(dws);
 
-               if (dws->tx == dws->tx_end) {
-                       spi_mask_intr(dws, SPI_INT_TXEI);
+               /* Re-enable the IRQ if there is still data left to tx */
+               if (dws->tx_end > dws->tx)
+                       spi_umask_intr(dws, SPI_INT_TXEI);
+               else
                        transfer_complete(dws);
-               }
        }
 
-       /* INT comes from rx */
-       if (dws->rx && (irq_status & SPI_INT_RXFI)) {
-               if (dws->read(dws))
-                       transfer_complete(dws);
-       }
        return IRQ_HANDLED;
 }
 
@@ -404,12 +408,9 @@ static irqreturn_t dw_spi_irq(int irq, void *dev_id)
 /* Must be called inside pump_transfers() */
 static void poll_transfer(struct dw_spi *dws)
 {
-       if (dws->tx) {
-               while (dws->write(dws))
-                       dws->read(dws);
-       }
+       while (dws->write(dws))
+               dws->read(dws);
 
-       dws->read(dws);
        transfer_complete(dws);
 }
 
@@ -428,6 +429,7 @@ static void pump_transfers(unsigned long data)
        u8 bits = 0;
        u8 imask = 0;
        u8 cs_change = 0;
+       u16 txint_level = 0;
        u16 clk_div = 0;
        u32 speed = 0;
        u32 cr0 = 0;
@@ -438,6 +440,9 @@ static void pump_transfers(unsigned long data)
        chip = dws->cur_chip;
        spi = message->spi;
 
+       if (unlikely(!chip->clk_div))
+               chip->clk_div = dws->max_freq / chip->speed_hz;
+
        if (message->state == ERROR_STATE) {
                message->status = -EIO;
                goto early_exit;
@@ -492,7 +497,7 @@ static void pump_transfers(unsigned long data)
 
                        /* clk_div doesn't support odd number */
                        clk_div = dws->max_freq / speed;
-                       clk_div = (clk_div >> 1) << 1;
+                       clk_div = (clk_div + 1) & 0xfffe;
 
                        chip->speed_hz = speed;
                        chip->clk_div = clk_div;
@@ -532,14 +537,35 @@ static void pump_transfers(unsigned long data)
        }
        message->state = RUNNING_STATE;
 
+       /*
+        * Adjust transfer mode if necessary. Requires platform dependent
+        * chipselect mechanism.
+        */
+       if (dws->cs_control) {
+               if (dws->rx && dws->tx)
+                       chip->tmode = 0x00;
+               else if (dws->rx)
+                       chip->tmode = 0x02;
+               else
+                       chip->tmode = 0x01;
+
+               cr0 &= ~(0x3 << SPI_MODE_OFFSET);
+               cr0 |= (chip->tmode << SPI_TMOD_OFFSET);
+       }
+
        /* Check if current transfer is a DMA transaction */
        dws->dma_mapped = map_dma_buffers(dws);
 
+       /*
+        * Interrupt mode
+        * we only need set the TXEI IRQ, as TX/RX always happen syncronizely
+        */
        if (!dws->dma_mapped && !chip->poll_mode) {
-               if (dws->rx)
-                       imask |= SPI_INT_RXFI;
-               if (dws->tx)
-                       imask |= SPI_INT_TXEI;
+               int templen = dws->len / dws->n_bytes;
+               txint_level = dws->fifo_len / 2;
+               txint_level = (templen > txint_level) ? txint_level : templen;
+
+               imask |= SPI_INT_TXEI;
                dws->transfer_handler = interrupt_transfer;
        }
 
@@ -549,21 +575,23 @@ static void pump_transfers(unsigned long data)
         *      2. clk_div is changed
         *      3. control value changes
         */
-       if (dw_readw(dws, ctrl0) != cr0 || cs_change || clk_div) {
+       if (dw_readw(dws, ctrl0) != cr0 || cs_change || clk_div || imask) {
                spi_enable_chip(dws, 0);
 
                if (dw_readw(dws, ctrl0) != cr0)
                        dw_writew(dws, ctrl0, cr0);
 
+               spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
+               spi_chip_sel(dws, spi->chip_select);
+
                /* Set the interrupt mask, for poll mode just diable all int */
                spi_mask_intr(dws, 0xff);
-               if (!chip->poll_mode)
+               if (imask)
                        spi_umask_intr(dws, imask);
+               if (txint_level)
+                       dw_writew(dws, txfltr, txint_level);
 
-               spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
-               spi_chip_sel(dws, spi->chip_select);
                spi_enable_chip(dws, 1);
-
                if (cs_change)
                        dws->prev_chip = chip;
        }
@@ -712,11 +740,11 @@ static int dw_spi_setup(struct spi_device *spi)
        }
        chip->bits_per_word = spi->bits_per_word;
 
+       if (!spi->max_speed_hz) {
+               dev_err(&spi->dev, "No max speed HZ parameter\n");
+               return -EINVAL;
+       }
        chip->speed_hz = spi->max_speed_hz;
-       if (chip->speed_hz)
-               chip->clk_div = 25000000 / chip->speed_hz;
-       else
-               chip->clk_div = 8;      /* default value */
 
        chip->tmode = 0; /* Tx & Rx */
        /* Default SPI mode is SCPOL = 0, SCPH = 0 */
@@ -735,7 +763,7 @@ static void dw_spi_cleanup(struct spi_device *spi)
        kfree(chip);
 }
 
-static int __init init_queue(struct dw_spi *dws)
+static int __devinit init_queue(struct dw_spi *dws)
 {
        INIT_LIST_HEAD(&dws->queue);
        spin_lock_init(&dws->lock);
@@ -817,6 +845,22 @@ static void spi_hw_init(struct dw_spi *dws)
        spi_mask_intr(dws, 0xff);
        spi_enable_chip(dws, 1);
        flush(dws);
+
+       /*
+        * Try to detect the FIFO depth if not set by interface driver,
+        * the depth could be from 2 to 256 from HW spec
+        */
+       if (!dws->fifo_len) {
+               u32 fifo;
+               for (fifo = 2; fifo <= 257; fifo++) {
+                       dw_writew(dws, txfltr, fifo);
+                       if (fifo != dw_readw(dws, txfltr))
+                               break;
+               }
+
+               dws->fifo_len = (fifo == 257) ? 0 : fifo;
+               dw_writew(dws, txfltr, 0);
+       }
 }
 
 int __devinit dw_spi_add_host(struct dw_spi *dws)
@@ -913,6 +957,7 @@ void __devexit dw_spi_remove_host(struct dw_spi *dws)
        /* Disconnect from the SPI framework */
        spi_unregister_master(dws->master);
 }
+EXPORT_SYMBOL(dw_spi_remove_host);
 
 int dw_spi_suspend_host(struct dw_spi *dws)
 {
diff --git a/drivers/spi/dw_spi_mmio.c b/drivers/spi/dw_spi_mmio.c
new file mode 100644 (file)
index 0000000..e35b45a
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * dw_spi_mmio.c - Memory-mapped interface driver for DW SPI Core
+ *
+ * Copyright (c) 2010, Octasic semiconductor.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/clk.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/spi/dw_spi.h>
+#include <linux/spi/spi.h>
+
+#define DRIVER_NAME "dw_spi_mmio"
+
+struct dw_spi_mmio {
+       struct dw_spi  dws;
+       struct clk     *clk;
+};
+
+static int __devinit dw_spi_mmio_probe(struct platform_device *pdev)
+{
+       struct dw_spi_mmio *dwsmmio;
+       struct dw_spi *dws;
+       struct resource *mem, *ioarea;
+       int ret;
+
+       dwsmmio = kzalloc(sizeof(struct dw_spi_mmio), GFP_KERNEL);
+       if (!dwsmmio) {
+               ret = -ENOMEM;
+               goto err_end;
+       }
+
+       dws = &dwsmmio->dws;
+
+       /* Get basic io resource and map it */
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!mem) {
+               dev_err(&pdev->dev, "no mem resource?\n");
+               ret = -EINVAL;
+               goto err_kfree;
+       }
+
+       ioarea = request_mem_region(mem->start, resource_size(mem),
+                       pdev->name);
+       if (!ioarea) {
+               dev_err(&pdev->dev, "SPI region already claimed\n");
+               ret = -EBUSY;
+               goto err_kfree;
+       }
+
+       dws->regs = ioremap_nocache(mem->start, resource_size(mem));
+       if (!dws->regs) {
+               dev_err(&pdev->dev, "SPI region already mapped\n");
+               ret = -ENOMEM;
+               goto err_release_reg;
+       }
+
+       dws->irq = platform_get_irq(pdev, 0);
+       if (dws->irq < 0) {
+               dev_err(&pdev->dev, "no irq resource?\n");
+               ret = dws->irq; /* -ENXIO */
+               goto err_unmap;
+       }
+
+       dwsmmio->clk = clk_get(&pdev->dev, NULL);
+       if (!dwsmmio->clk) {
+               ret = -ENODEV;
+               goto err_irq;
+       }
+       clk_enable(dwsmmio->clk);
+
+       dws->parent_dev = &pdev->dev;
+       dws->bus_num = 0;
+       dws->num_cs = 4;
+       dws->max_freq = clk_get_rate(dwsmmio->clk);
+
+       ret = dw_spi_add_host(dws);
+       if (ret)
+               goto err_clk;
+
+       platform_set_drvdata(pdev, dwsmmio);
+       return 0;
+
+err_clk:
+       clk_disable(dwsmmio->clk);
+       clk_put(dwsmmio->clk);
+       dwsmmio->clk = NULL;
+err_irq:
+       free_irq(dws->irq, dws);
+err_unmap:
+       iounmap(dws->regs);
+err_release_reg:
+       release_mem_region(mem->start, resource_size(mem));
+err_kfree:
+       kfree(dwsmmio);
+err_end:
+       return ret;
+}
+
+static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
+{
+       struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev);
+       struct resource *mem;
+
+       platform_set_drvdata(pdev, NULL);
+
+       clk_disable(dwsmmio->clk);
+       clk_put(dwsmmio->clk);
+       dwsmmio->clk = NULL;
+
+       free_irq(dwsmmio->dws.irq, &dwsmmio->dws);
+       dw_spi_remove_host(&dwsmmio->dws);
+       iounmap(dwsmmio->dws.regs);
+       kfree(dwsmmio);
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(mem->start, resource_size(mem));
+       return 0;
+}
+
+static struct platform_driver dw_spi_mmio_driver = {
+       .remove         = __devexit_p(dw_spi_mmio_remove),
+       .driver         = {
+               .name   = DRIVER_NAME,
+               .owner  = THIS_MODULE,
+       },
+};
+
+static int __init dw_spi_mmio_init(void)
+{
+       return platform_driver_probe(&dw_spi_mmio_driver, dw_spi_mmio_probe);
+}
+module_init(dw_spi_mmio_init);
+
+static void __exit dw_spi_mmio_exit(void)
+{
+       platform_driver_unregister(&dw_spi_mmio_driver);
+}
+module_exit(dw_spi_mmio_exit);
+
+MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>");
+MODULE_DESCRIPTION("Memory-mapped I/O interface driver for DW SPI Core");
+MODULE_LICENSE("GPL v2");
index 34ba69161734e19f5b1685a295ceab783cb4113e..1f0735f9cc76ab0232aa282f19f071b89be827ce 100644 (file)
@@ -73,6 +73,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev,
        dws->num_cs = 4;
        dws->max_freq = 25000000;       /* for Moorestwon */
        dws->irq = pdev->irq;
+       dws->fifo_len = 40;             /* FIFO has 40 words buffer */
 
        ret = dw_spi_add_host(dws);
        if (ret)
@@ -98,6 +99,7 @@ static void __devexit spi_pci_remove(struct pci_dev *pdev)
        struct dw_spi_pci *dwpci = pci_get_drvdata(pdev);
 
        pci_set_drvdata(pdev, NULL);
+       dw_spi_remove_host(&dwpci->dws);
        iounmap(dwpci->dws.regs);
        pci_release_region(pdev, 0);
        kfree(dwpci);
index f50c81df336a7831a76cdc85f92a1f3c2a7b7527..04747868d6c4d4605ec679f21306b650b4475657 100644 (file)
@@ -503,7 +503,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
        return mpc52xx_psc_spi_do_remove(&op->dev);
 }
 
-static struct of_device_id mpc52xx_psc_spi_of_match[] = {
+static const struct of_device_id mpc52xx_psc_spi_of_match[] = {
        { .compatible = "fsl,mpc5200-psc-spi", },
        { .compatible = "mpc5200-psc-spi", }, /* old */
        {}
index 45bfe645817332f7a3754237815c263e909582ea..6eab46537a0ae3a6bb1d52d9a9662fc24c60da18 100644 (file)
@@ -550,7 +550,7 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op)
        return 0;
 }
 
-static struct of_device_id mpc52xx_spi_match[] __devinitdata = {
+static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
        { .compatible = "fsl,mpc5200-spi", },
        {}
 };
index 1893f1e96dc4906da0a92d1d4de38492781faa53..0ddbbe45e83442f77f2334e7e84a87d5d77ac810 100644 (file)
@@ -469,7 +469,7 @@ static int spi_imx_setup(struct spi_device *spi)
        struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master);
        int gpio = spi_imx->chipselect[spi->chip_select];
 
-       pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__,
+       dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__,
                 spi->mode, spi->bits_per_word, spi->max_speed_hz);
 
        if (gpio >= 0)
index 1fb2a6ea328cfcff9ce8ec3a03700f3bec729947..4f0cc9d457e04b6c115d08a72014e83ff4e5bd58 100644 (file)
@@ -365,7 +365,7 @@ int mpc8xxx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 
        if ((mpc8xxx_spi->spibrg / hz) > 64) {
                cs->hw_mode |= SPMODE_DIV16;
-               pm = mpc8xxx_spi->spibrg / (hz * 64);
+               pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
 
                WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
                          "Will use %d Hz instead.\n", dev_name(&spi->dev),
@@ -373,7 +373,7 @@ int mpc8xxx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
                if (pm > 16)
                        pm = 16;
        } else
-               pm = mpc8xxx_spi->spibrg / (hz * 4);
+               pm = (mpc8xxx_spi->spibrg - 1) / (hz * 4) + 1;
        if (pm)
                pm--;
 
@@ -1328,7 +1328,7 @@ static struct of_platform_driver of_mpc8xxx_spi_driver = {
 static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev)
 {
        struct resource *mem;
-       unsigned int irq;
+       int irq;
        struct spi_master *master;
 
        if (!pdev->dev.platform_data)
@@ -1339,7 +1339,7 @@ static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev)
                return -EINVAL;
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq)
+       if (irq <= 0)
                return -EINVAL;
 
        master = mpc8xxx_spi_probe(&pdev->dev, mem, irq);
index 140a18d6cf3eba059fabbf122e65767ec04bb046..6d8d4026a07a6569e0ba2812a0ce705dc94c5b67 100644 (file)
@@ -578,7 +578,7 @@ static int __exit spi_ppc4xx_of_remove(struct of_device *op)
        return 0;
 }
 
-static struct of_device_id spi_ppc4xx_of_match[] = {
+static const struct of_device_id spi_ppc4xx_of_match[] = {
        { .compatible = "ibm,ppc4xx-spi", },
        {},
 };
index 88a456dba967c91091dbb7eb0a4321f5c5bbcd3d..97365815a729a2d3c17d47d3815ffa38ff6c6526 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/spi/spi.h>
 
 #include <mach/dma.h>
-#include <plat/spi.h>
+#include <plat/s3c64xx-spi.h>
 
 /* Registers and bit-fields */
 
 /**
  * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
  * @clk: Pointer to the spi clock.
+ * @src_clk: Pointer to the clock used to generate SPI signals.
  * @master: Pointer to the SPI Protocol master.
  * @workqueue: Work queue for the SPI xfer requests.
  * @cntrlr_info: Platform specific data for the controller this driver manages.
 struct s3c64xx_spi_driver_data {
        void __iomem                    *regs;
        struct clk                      *clk;
+       struct clk                      *src_clk;
        struct platform_device          *pdev;
        struct spi_master               *master;
        struct workqueue_struct         *workqueue;
-       struct s3c64xx_spi_cntrlr_info  *cntrlr_info;
+       struct s3c64xx_spi_info  *cntrlr_info;
        struct spi_device               *tgl_spi;
        struct work_struct              work;
        struct list_head                queue;
@@ -180,7 +182,7 @@ static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
 
 static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        void __iomem *regs = sdd->regs;
        unsigned long loops;
        u32 val;
@@ -225,7 +227,7 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
                                struct spi_device *spi,
                                struct spi_transfer *xfer, int dma_mode)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        void __iomem *regs = sdd->regs;
        u32 modecfg, chcfg;
 
@@ -298,19 +300,20 @@ static inline void enable_cs(struct s3c64xx_spi_driver_data *sdd,
                if (sdd->tgl_spi != spi) { /* if last mssg on diff device */
                        /* Deselect the last toggled device */
                        cs = sdd->tgl_spi->controller_data;
-                       cs->set_level(spi->mode & SPI_CS_HIGH ? 0 : 1);
+                       cs->set_level(cs->line,
+                                       spi->mode & SPI_CS_HIGH ? 0 : 1);
                }
                sdd->tgl_spi = NULL;
        }
 
        cs = spi->controller_data;
-       cs->set_level(spi->mode & SPI_CS_HIGH ? 1 : 0);
+       cs->set_level(cs->line, spi->mode & SPI_CS_HIGH ? 1 : 0);
 }
 
 static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
                                struct spi_transfer *xfer, int dma_mode)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        void __iomem *regs = sdd->regs;
        unsigned long val;
        int ms;
@@ -384,12 +387,11 @@ static inline void disable_cs(struct s3c64xx_spi_driver_data *sdd,
        if (sdd->tgl_spi == spi)
                sdd->tgl_spi = NULL;
 
-       cs->set_level(spi->mode & SPI_CS_HIGH ? 0 : 1);
+       cs->set_level(cs->line, spi->mode & SPI_CS_HIGH ? 0 : 1);
 }
 
 static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
        void __iomem *regs = sdd->regs;
        u32 val;
 
@@ -435,7 +437,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
        /* Configure Clock */
        val = readl(regs + S3C64XX_SPI_CLK_CFG);
        val &= ~S3C64XX_SPI_PSR_MASK;
-       val |= ((clk_get_rate(sci->src_clk) / sdd->cur_speed / 2 - 1)
+       val |= ((clk_get_rate(sdd->src_clk) / sdd->cur_speed / 2 - 1)
                        & S3C64XX_SPI_PSR_MASK);
        writel(val, regs + S3C64XX_SPI_CLK_CFG);
 
@@ -558,7 +560,7 @@ static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
 static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
                                        struct spi_message *msg)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        struct spi_device *spi = msg->spi;
        struct s3c64xx_spi_csinfo *cs = spi->controller_data;
        struct spi_transfer *xfer;
@@ -632,8 +634,8 @@ static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
                S3C64XX_SPI_DEACT(sdd);
 
                if (status) {
-                       dev_err(&spi->dev, "I/O Error: \
-                               rx-%d tx-%d res:rx-%c tx-%c len-%d\n",
+                       dev_err(&spi->dev, "I/O Error: "
+                               "rx-%d tx-%d res:rx-%c tx-%c len-%d\n",
                                xfer->rx_buf ? 1 : 0, xfer->tx_buf ? 1 : 0,
                                (sdd->state & RXBUSY) ? 'f' : 'p',
                                (sdd->state & TXBUSY) ? 'f' : 'p',
@@ -786,7 +788,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 {
        struct s3c64xx_spi_csinfo *cs = spi->controller_data;
        struct s3c64xx_spi_driver_data *sdd;
-       struct s3c64xx_spi_cntrlr_info *sci;
+       struct s3c64xx_spi_info *sci;
        struct spi_message *msg;
        u32 psr, speed;
        unsigned long flags;
@@ -831,17 +833,17 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
        }
 
        /* Check if we can provide the requested rate */
-       speed = clk_get_rate(sci->src_clk) / 2 / (0 + 1); /* Max possible */
+       speed = clk_get_rate(sdd->src_clk) / 2 / (0 + 1); /* Max possible */
 
        if (spi->max_speed_hz > speed)
                spi->max_speed_hz = speed;
 
-       psr = clk_get_rate(sci->src_clk) / 2 / spi->max_speed_hz - 1;
+       psr = clk_get_rate(sdd->src_clk) / 2 / spi->max_speed_hz - 1;
        psr &= S3C64XX_SPI_PSR_MASK;
        if (psr == S3C64XX_SPI_PSR_MASK)
                psr--;
 
-       speed = clk_get_rate(sci->src_clk) / 2 / (psr + 1);
+       speed = clk_get_rate(sdd->src_clk) / 2 / (psr + 1);
        if (spi->max_speed_hz < speed) {
                if (psr+1 < S3C64XX_SPI_PSR_MASK) {
                        psr++;
@@ -851,7 +853,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
                }
        }
 
-       speed = clk_get_rate(sci->src_clk) / 2 / (psr + 1);
+       speed = clk_get_rate(sdd->src_clk) / 2 / (psr + 1);
        if (spi->max_speed_hz >= speed)
                spi->max_speed_hz = speed;
        else
@@ -867,7 +869,7 @@ setup_exit:
 
 static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
 {
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        void __iomem *regs = sdd->regs;
        unsigned int val;
 
@@ -902,7 +904,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 {
        struct resource *mem_res, *dmatx_res, *dmarx_res;
        struct s3c64xx_spi_driver_data *sdd;
-       struct s3c64xx_spi_cntrlr_info *sci;
+       struct s3c64xx_spi_info *sci;
        struct spi_master *master;
        int ret;
 
@@ -1000,18 +1002,15 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
                goto err4;
        }
 
-       if (sci->src_clk_nr == S3C64XX_SPI_SRCCLK_PCLK)
-               sci->src_clk = sdd->clk;
-       else
-               sci->src_clk = clk_get(&pdev->dev, sci->src_clk_name);
-       if (IS_ERR(sci->src_clk)) {
+       sdd->src_clk = clk_get(&pdev->dev, sci->src_clk_name);
+       if (IS_ERR(sdd->src_clk)) {
                dev_err(&pdev->dev,
                        "Unable to acquire clock '%s'\n", sci->src_clk_name);
-               ret = PTR_ERR(sci->src_clk);
+               ret = PTR_ERR(sdd->src_clk);
                goto err5;
        }
 
-       if (sci->src_clk != sdd->clk && clk_enable(sci->src_clk)) {
+       if (clk_enable(sdd->src_clk)) {
                dev_err(&pdev->dev, "Couldn't enable clock '%s'\n",
                                                        sci->src_clk_name);
                ret = -EBUSY;
@@ -1040,11 +1039,10 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
                goto err8;
        }
 
-       dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d \
-                                       with %d Slaves attached\n",
+       dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d "
+                                       "with %d Slaves attached\n",
                                        pdev->id, master->num_chipselect);
-       dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\
-                                       \tDMA=[Rx-%d, Tx-%d]\n",
+       dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n",
                                        mem_res->end, mem_res->start,
                                        sdd->rx_dmach, sdd->tx_dmach);
 
@@ -1053,11 +1051,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 err8:
        destroy_workqueue(sdd->workqueue);
 err7:
-       if (sci->src_clk != sdd->clk)
-               clk_disable(sci->src_clk);
+       clk_disable(sdd->src_clk);
 err6:
-       if (sci->src_clk != sdd->clk)
-               clk_put(sci->src_clk);
+       clk_put(sdd->src_clk);
 err5:
        clk_disable(sdd->clk);
 err4:
@@ -1078,7 +1074,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 {
        struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
        struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
        struct resource *mem_res;
        unsigned long flags;
 
@@ -1093,11 +1088,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 
        destroy_workqueue(sdd->workqueue);
 
-       if (sci->src_clk != sdd->clk)
-               clk_disable(sci->src_clk);
-
-       if (sci->src_clk != sdd->clk)
-               clk_put(sci->src_clk);
+       clk_disable(sdd->src_clk);
+       clk_put(sdd->src_clk);
 
        clk_disable(sdd->clk);
        clk_put(sdd->clk);
@@ -1105,7 +1097,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
        iounmap((void *) sdd->regs);
 
        mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       release_mem_region(mem_res->start, resource_size(mem_res));
+       if (mem_res != NULL)
+               release_mem_region(mem_res->start, resource_size(mem_res));
 
        platform_set_drvdata(pdev, NULL);
        spi_master_put(master);
@@ -1118,8 +1111,6 @@ static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
        struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
-       struct s3c64xx_spi_csinfo *cs;
        unsigned long flags;
 
        spin_lock_irqsave(&sdd->lock, flags);
@@ -1130,9 +1121,7 @@ static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
                msleep(10);
 
        /* Disable the clock */
-       if (sci->src_clk != sdd->clk)
-               clk_disable(sci->src_clk);
-
+       clk_disable(sdd->src_clk);
        clk_disable(sdd->clk);
 
        sdd->cur_speed = 0; /* Output Clock is stopped */
@@ -1144,15 +1133,13 @@ static int s3c64xx_spi_resume(struct platform_device *pdev)
 {
        struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
        struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
-       struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
+       struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
        unsigned long flags;
 
        sci->cfg_gpio(pdev);
 
        /* Enable the clock */
-       if (sci->src_clk != sdd->clk)
-               clk_enable(sci->src_clk);
-
+       clk_enable(sdd->src_clk);
        clk_enable(sdd->clk);
 
        s3c64xx_spi_hwinit(sdd, pdev->id);
index 51e5e1dfa6e5229151e8217f139b613ed73b8794..d93b66743ba759fc70a55531699f23f00a81333a 100644 (file)
 #include <linux/bitmap.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/err.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
 #include <linux/spi/sh_msiof.h>
 
-#include <asm/spi.h>
 #include <asm/unaligned.h>
 
 struct sh_msiof_spi_priv {
@@ -173,15 +173,12 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
        int edge;
 
        /*
-        * CPOL CPHA     TSCKIZ RSCKIZ TEDG REDG(!)
-        *    0    0         10     10    1    0
-        *    0    1         10     10    0    1
-        *    1    0         11     11    0    1
-        *    1    1         11     11    1    0
-        *
-        * (!) Note: REDG is inverted recommended data sheet setting
+        * CPOL CPHA     TSCKIZ RSCKIZ TEDG REDG
+        *    0    0         10     10    1    1
+        *    0    1         10     10    0    0
+        *    1    0         11     11    0    0
+        *    1    1         11     11    1    1
         */
-
        sh_msiof_write(p, FCTR, 0);
        sh_msiof_write(p, TMDR1, 0xe2000005 | (lsb_first << 24));
        sh_msiof_write(p, RMDR1, 0x22000005 | (lsb_first << 24));
@@ -193,7 +190,7 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
        edge = cpol ? cpha : !cpha;
 
        tmp |= edge << 27; /* TEDG */
-       tmp |= !edge << 26; /* REDG */
+       tmp |= edge << 26; /* REDG */
        tmp |= (tx_hi_z ? 2 : 0) << 22; /* TXDIZ */
        sh_msiof_write(p, CTR, tmp);
 }
index 2552bb36400564f58a66285647a7faa951090be8..fadff76eb7e06807e5171dc074b5416db02d032b 100644 (file)
@@ -76,7 +76,7 @@ struct stmp_spi {
                        break;                                          \
                }                                                       \
                cpu_relax();                                            \
-       } while (time_before(end_jiffies, jiffies));                    \
+       } while (time_before(jiffies, end_jiffies));                    \
        succeeded;                                                      \
        })
 
index 9f386379c16974285c48c48932075d4025471b90..1b47363cb73f6d8c624b0af5bc44d2047e6ae8a7 100644 (file)
@@ -93,6 +93,26 @@ struct xilinx_spi {
        void (*rx_fn) (struct xilinx_spi *);
 };
 
+static void xspi_write32(u32 val, void __iomem *addr)
+{
+       iowrite32(val, addr);
+}
+
+static unsigned int xspi_read32(void __iomem *addr)
+{
+       return ioread32(addr);
+}
+
+static void xspi_write32_be(u32 val, void __iomem *addr)
+{
+       iowrite32be(val, addr);
+}
+
+static unsigned int xspi_read32_be(void __iomem *addr)
+{
+       return ioread32be(addr);
+}
+
 static void xspi_tx8(struct xilinx_spi *xspi)
 {
        xspi->write_fn(*xspi->tx_ptr, xspi->regs + XSPI_TXD_OFFSET);
@@ -374,11 +394,11 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
        xspi->mem = *mem;
        xspi->irq = irq;
        if (pdata->little_endian) {
-               xspi->read_fn = ioread32;
-               xspi->write_fn = iowrite32;
+               xspi->read_fn = xspi_read32;
+               xspi->write_fn = xspi_write32;
        } else {
-               xspi->read_fn = ioread32be;
-               xspi->write_fn = iowrite32be;
+               xspi->read_fn = xspi_read32_be;
+               xspi->write_fn = xspi_write32_be;
        }
        xspi->bits_per_word = pdata->bits_per_word;
        if (xspi->bits_per_word == 8) {
index 71dc3adc049577f0a5159fdca7864786218e1930..ed34a8d419c7545b1a3912d9737e48c100852fb2 100644 (file)
@@ -99,7 +99,7 @@ static int __exit xilinx_spi_of_remove(struct of_device *op)
        return xilinx_spi_remove(op);
 }
 
-static struct of_device_id xilinx_spi_of_match[] = {
+static const struct of_device_id xilinx_spi_of_match[] = {
        { .compatible = "xlnx,xps-spi-2.00.a", },
        { .compatible = "xlnx,xps-spi-2.00.b", },
        {}
index 5681ebed9c65d879132235a165af705d25cf37ab..03dfd27c4bfba8cb78df400a12589be531879f6b 100644 (file)
@@ -494,8 +494,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
 #endif
                        break;
                case SSB_BUSTYPE_SDIO:
-#ifdef CONFIG_SSB_SDIO
-                       sdev->irq = bus->host_sdio->dev.irq;
+#ifdef CONFIG_SSB_SDIOHOST
                        dev->parent = &bus->host_sdio->dev;
 #endif
                        break;
index 94eb86319ff34a91ed781d2f7ddfbe990f9d7d0b..fc2e963e65e9ec187086078744b60e32da68a0ea 100644 (file)
@@ -99,8 +99,6 @@ source "drivers/staging/line6/Kconfig"
 
 source "drivers/gpu/drm/vmwgfx/Kconfig"
 
-source "drivers/gpu/drm/radeon/Kconfig"
-
 source "drivers/gpu/drm/nouveau/Kconfig"
 
 source "drivers/staging/octeon/Kconfig"
index f4c26572c7dfa24a4a393c2b6892c04e2d7a74fe..43c57b7688abe658223c49834c56f6fb0be6d180 100644 (file)
@@ -194,9 +194,11 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr,
 {
        struct usb_interface *intf = to_usb_interface(dev);
        struct asus_oled_dev *odev = usb_get_intfdata(intf);
-       int temp = strict_strtoul(buf, 10, NULL);
+       unsigned long value;
+       if (strict_strtoul(buf, 10, &value))
+               return -EINVAL;
 
-       enable_oled(odev, temp);
+       enable_oled(odev, value);
 
        return count;
 }
@@ -207,10 +209,12 @@ static ssize_t class_set_enabled(struct device *device,
 {
        struct asus_oled_dev *odev =
                (struct asus_oled_dev *) dev_get_drvdata(device);
+       unsigned long value;
 
-       int temp = strict_strtoul(buf, 10, NULL);
+       if (strict_strtoul(buf, 10, &value))
+               return -EINVAL;
 
-       enable_oled(odev, temp);
+       enable_oled(odev, value);
 
        return count;
 }
index e4df8134f0594446294eacbb85d57cea2414cba2..1eb079b3d429dc48b8ef9b218e5b3df29c71c83f 100644 (file)
@@ -860,10 +860,8 @@ int medusa_video_init(struct cx25821_dev *dev)
 
        ret_val = medusa_set_videostandard(dev);
 
-       if (ret_val < 0) {
-               mutex_unlock(&dev->lock);
+       if (ret_val < 0)
                return -EINVAL;
-       }
 
        return 1;
 }
index 6da843cc343c4506c803d1e7d5e1b45d3e47ceb6..e715e4dcb5236d624c1b00e3601d4be43feb0dc2 100644 (file)
@@ -203,11 +203,14 @@ typedef struct _GLOBAL_t {                        /* Location: */
  * 9-0: pr ndes
  */
 
-#define ET_DMA10_MASK          0x3FF   /* 10 bit mask for DMA10W types */
-#define ET_DMA10_WRAP          0x400
-#define ET_DMA4_MASK           0x00F   /* 4 bit mask for DMA4W types */
-#define ET_DMA4_WRAP           0x010
-
+#define ET_DMA12_MASK          0x0FFF  /* 12 bit mask for DMA12W types */
+#define ET_DMA12_WRAP          0x1000
+#define ET_DMA10_MASK          0x03FF  /* 10 bit mask for DMA10W types */
+#define ET_DMA10_WRAP          0x0400
+#define ET_DMA4_MASK           0x000F  /* 4 bit mask for DMA4W types */
+#define ET_DMA4_WRAP           0x0010
+
+#define INDEX12(x)     ((x) & ET_DMA12_MASK)
 #define INDEX10(x)     ((x) & ET_DMA10_MASK)
 #define INDEX4(x)      ((x) & ET_DMA4_MASK)
 
@@ -216,6 +219,11 @@ extern inline void add_10bit(u32 *v, int n)
        *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
 }
 
+extern inline void add_12bit(u32 *v, int n)
+{
+       *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP);
+}
+
 /*
  * 10bit DMA with wrap
  * txdma tx queue write address reg in txdma address map at 0x1010
index 3ddc9b12b8db70ef9f2171481fcc5a1a5b60697d..81c1a7478ad68b520238283c03ba39f342f032b8 100644 (file)
@@ -831,10 +831,10 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
 
        /* Indicate that we have used this PSR entry. */
        /* FIXME wrap 12 */
-       rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF;
-       if (rx_local->local_psr_full  > rx_local->PsrNumEntries - 1) {
+       add_12bit(&rx_local->local_psr_full, 1);
+       if ((rx_local->local_psr_full & 0xFFF)  > rx_local->PsrNumEntries - 1) {
                /* Clear psr full and toggle the wrap bit */
-               rx_local->local_psr_full &=  0xFFF;
+               rx_local->local_psr_full &=  ~0xFFF;
                rx_local->local_psr_full ^= 0x1000;
        }
 
index 8cf7f2750b3fbf4585554d48c7d5451ab955acb1..c324f6ea002bb238ef90b204e79d187cc3f1428f 100644 (file)
@@ -159,7 +159,7 @@ static int write_reg(struct i2c_client *client, u8 reg, u8 value)
        struct go7007 *go = i2c_get_adapdata(client->adapter);
        struct go7007_usb *usb;
        int rc;
-       int dev_addr = client->addr;
+       int dev_addr = client->addr << 1;  /* firmware wants 8-bit address */
        u8 *buf;
 
        if (go == NULL)
index c5b6613f2f2f7963b07aecd8e9c3104cfedd4fca..c2809f2a2ce0e0e72b1b930f39929a50179d3cd5 100644 (file)
@@ -386,7 +386,7 @@ u16 HvSignalEvent(void)
  * retrieve the initialized message and event pages.  Otherwise, we create and
  * initialize the message and event pages.
  */
-int HvSynicInit(u32 irqVector)
+void HvSynicInit(void *irqarg)
 {
        u64 version;
        union hv_synic_simp simp;
@@ -394,13 +394,14 @@ int HvSynicInit(u32 irqVector)
        union hv_synic_sint sharedSint;
        union hv_synic_scontrol sctrl;
        u64 guestID;
-       int ret = 0;
+       u32 irqVector = *((u32 *)(irqarg));
+       int cpu = smp_processor_id();
 
        DPRINT_ENTER(VMBUS);
 
        if (!gHvContext.HypercallPage) {
                DPRINT_EXIT(VMBUS);
-               return ret;
+               return;
        }
 
        /* Check the version */
@@ -425,27 +426,27 @@ int HvSynicInit(u32 irqVector)
                 */
                rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID);
                if (guestID == HV_LINUX_GUEST_ID) {
-                       gHvContext.synICMessagePage[0] =
+                       gHvContext.synICMessagePage[cpu] =
                                phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT);
-                       gHvContext.synICEventPage[0] =
+                       gHvContext.synICEventPage[cpu] =
                                phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT);
                } else {
                        DPRINT_ERR(VMBUS, "unknown guest id!!");
                        goto Cleanup;
                }
                DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p",
-                          gHvContext.synICMessagePage[0],
-                          gHvContext.synICEventPage[0]);
+                          gHvContext.synICMessagePage[cpu],
+                          gHvContext.synICEventPage[cpu]);
        } else {
-               gHvContext.synICMessagePage[0] = osd_PageAlloc(1);
-               if (gHvContext.synICMessagePage[0] == NULL) {
+               gHvContext.synICMessagePage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
+               if (gHvContext.synICMessagePage[cpu] == NULL) {
                        DPRINT_ERR(VMBUS,
                                   "unable to allocate SYNIC message page!!");
                        goto Cleanup;
                }
 
-               gHvContext.synICEventPage[0] = osd_PageAlloc(1);
-               if (gHvContext.synICEventPage[0] == NULL) {
+               gHvContext.synICEventPage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
+               if (gHvContext.synICEventPage[cpu] == NULL) {
                        DPRINT_ERR(VMBUS,
                                   "unable to allocate SYNIC event page!!");
                        goto Cleanup;
@@ -454,7 +455,7 @@ int HvSynicInit(u32 irqVector)
                /* Setup the Synic's message page */
                rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64);
                simp.SimpEnabled = 1;
-               simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0])
+               simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu])
                                        >> PAGE_SHIFT;
 
                DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx",
@@ -465,7 +466,7 @@ int HvSynicInit(u32 irqVector)
                /* Setup the Synic's event page */
                rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
                siefp.SiefpEnabled = 1;
-               siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0])
+               siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu])
                                        >> PAGE_SHIFT;
 
                DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx",
@@ -501,32 +502,30 @@ int HvSynicInit(u32 irqVector)
 
        DPRINT_EXIT(VMBUS);
 
-       return ret;
+       return;
 
 Cleanup:
-       ret = -1;
-
        if (gHvContext.GuestId == HV_LINUX_GUEST_ID) {
-               if (gHvContext.synICEventPage[0])
-                       osd_PageFree(gHvContext.synICEventPage[0], 1);
+               if (gHvContext.synICEventPage[cpu])
+                       osd_PageFree(gHvContext.synICEventPage[cpu], 1);
 
-               if (gHvContext.synICMessagePage[0])
-                       osd_PageFree(gHvContext.synICMessagePage[0], 1);
+               if (gHvContext.synICMessagePage[cpu])
+                       osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
        }
 
        DPRINT_EXIT(VMBUS);
-
-       return ret;
+       return;
 }
 
 /**
  * HvSynicCleanup - Cleanup routine for HvSynicInit().
  */
-void HvSynicCleanup(void)
+void HvSynicCleanup(void *arg)
 {
        union hv_synic_sint sharedSint;
        union hv_synic_simp simp;
        union hv_synic_siefp siefp;
+       int cpu = smp_processor_id();
 
        DPRINT_ENTER(VMBUS);
 
@@ -539,6 +538,7 @@ void HvSynicCleanup(void)
 
        sharedSint.Masked = 1;
 
+       /* Need to correctly cleanup in the case of SMP!!! */
        /* Disable the interrupt */
        wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64);
 
@@ -560,8 +560,8 @@ void HvSynicCleanup(void)
 
                wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
 
-               osd_PageFree(gHvContext.synICMessagePage[0], 1);
-               osd_PageFree(gHvContext.synICEventPage[0], 1);
+               osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
+               osd_PageFree(gHvContext.synICEventPage[cpu], 1);
        }
 
        DPRINT_EXIT(VMBUS);
index 5379e4bfc56ecef14d6fef11c092f85986f9d749..fce4b5cdac30c63096d095f4851009f7a9e5d814 100644 (file)
@@ -93,7 +93,7 @@ static const struct hv_guid VMBUS_SERVICE_ID = {
        },
 };
 
-#define MAX_NUM_CPUS   1
+#define MAX_NUM_CPUS   32
 
 
 struct hv_input_signal_event_buffer {
@@ -137,8 +137,8 @@ extern u16 HvPostMessage(union hv_connection_id connectionId,
 
 extern u16 HvSignalEvent(void);
 
-extern int HvSynicInit(u32 irqVector);
+extern void HvSynicInit(void *irqarg);
 
-extern void HvSynicCleanup(void);
+extern void HvSynicCleanup(void *arg);
 
 #endif /* __HV_H__ */
index a4dd06f6d459bf39496c55ea9d4ca606e7c6bcf7..35a023e9f9d1dd66f5f3b137a42a5997fdf9846c 100644 (file)
@@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo)
 
        /* strcpy(dev->name, "vmbus"); */
        /* SynIC setup... */
-       ret = HvSynicInit(*irqvector);
+       on_each_cpu(HvSynicInit, (void *)irqvector, 1);
 
        /* Connect to VMBus in the root partition */
        ret = VmbusConnect();
@@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
        DPRINT_ENTER(VMBUS);
        VmbusChannelReleaseUnattachedChannels();
        VmbusDisconnect();
-       HvSynicCleanup();
+       on_each_cpu(HvSynicCleanup, NULL, 1);
        DPRINT_EXIT(VMBUS);
 
        return ret;
@@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv)
  */
 static void VmbusOnMsgDPC(struct hv_driver *drv)
 {
-       void *page_addr = gHvContext.synICMessagePage[0];
+       int cpu = smp_processor_id();
+       void *page_addr = gHvContext.synICMessagePage[cpu];
        struct hv_message *msg = (struct hv_message *)page_addr +
                                  VMBUS_MESSAGE_SINT;
        struct hv_message *copied;
@@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv)
 static int VmbusOnISR(struct hv_driver *drv)
 {
        int ret = 0;
+       int cpu = smp_processor_id();
        void *page_addr;
        struct hv_message *msg;
        union hv_synic_event_flags *event;
 
-       page_addr = gHvContext.synICMessagePage[0];
+       page_addr = gHvContext.synICMessagePage[cpu];
        msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
 
        DPRINT_ENTER(VMBUS);
@@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv)
        }
 
        /* TODO: Check if there are events to be process */
-       page_addr = gHvContext.synICEventPage[0];
+       page_addr = gHvContext.synICEventPage[cpu];
        event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
 
        /* Since we are a child, we only need to check bit 0 */
index c0a583cc22274e6b29e82d344c3c630c12e5801f..87447c102fa0b5a401efe8dc10fb5ebb3132f1c6 100644 (file)
@@ -14,7 +14,6 @@ obj-${CONFIG_OCTEON_ETHERNET} :=  octeon-ethernet.o
 octeon-ethernet-objs := ethernet.o
 octeon-ethernet-objs += ethernet-mdio.o
 octeon-ethernet-objs += ethernet-mem.o
-octeon-ethernet-objs += ethernet-proc.o
 octeon-ethernet-objs += ethernet-rgmii.o
 octeon-ethernet-objs += ethernet-rx.o
 octeon-ethernet-objs += ethernet-sgmii.o
index f13131b03c333912e8bbbd0fe44d3ace7df52ec2..6a2cd50a17dfe0e4f76747ea67d10f6285c597c2 100644 (file)
  *      Tells the driver to populate the packet buffers with kernel skbuffs.
  *      This allows the driver to receive packets without copying them. It also
  *      means that 32bit userspace can't access the packet buffers.
- *  USE_32BIT_SHARED
- *      This define tells the driver to allocate memory for buffers from the
- *      32bit sahred region instead of the kernel memory space.
  *  USE_HW_TCPUDP_CHECKSUM
  *      Controls if the Octeon TCP/UDP checksum engine is used for packet
  *      output. If this is zero, the kernel will perform the checksum in
  *      software.
- *  USE_MULTICORE_RECEIVE
- *      Process receive interrupts on multiple cores. This spreads the network
- *      load across the first 8 processors. If ths is zero, only one core
- *      processes incomming packets.
  *  USE_ASYNC_IOBDMA
  *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
  *      IOBDMAs to issue IO accesses without stalling. Set this to zero
 #define CONFIG_CAVIUM_RESERVE32 0
 #endif
 
-#if CONFIG_CAVIUM_RESERVE32
-#define USE_32BIT_SHARED            1
-#define USE_SKBUFFS_IN_HW           0
-#define REUSE_SKBUFFS_WITHOUT_FREE  0
-#else
-#define USE_32BIT_SHARED            0
 #define USE_SKBUFFS_IN_HW           1
 #ifdef CONFIG_NETFILTER
 #define REUSE_SKBUFFS_WITHOUT_FREE  0
 #else
 #define REUSE_SKBUFFS_WITHOUT_FREE  1
 #endif
-#endif
-
-/* Max interrupts per second per core */
-#define INTERRUPT_LIMIT             10000
 
-/* Don't limit the number of interrupts */
-/*#define INTERRUPT_LIMIT             0     */
 #define USE_HW_TCPUDP_CHECKSUM      1
 
-#define USE_MULTICORE_RECEIVE       1
-
 /* Enable Random Early Dropping under load */
 #define USE_RED                     1
 #define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
 /* Use this to not have FPA frees control L2 */
 /*#define DONT_WRITEBACK(x)         0   */
 
-/* Maximum number of packets to process per interrupt. */
-#define MAX_RX_PACKETS 120
 /* Maximum number of SKBs to try to free per xmit packet. */
-#define MAX_SKB_TO_FREE 10
 #define MAX_OUT_QUEUE_DEPTH 1000
 
-#ifndef CONFIG_SMP
-#undef USE_MULTICORE_RECEIVE
-#define USE_MULTICORE_RECEIVE 0
-#endif
-
-#define IP_PROTOCOL_TCP             6
-#define IP_PROTOCOL_UDP             0x11
+#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(uint32_t))
+#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(uint32_t))
 
-#define FAU_NUM_PACKET_BUFFERS_TO_FREE (CVMX_FAU_REG_END - sizeof(uint32_t))
 #define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS+1)
 
 
index 05a5cc0f43eda40a1b358edec808dfad7ce039b7..7e0be8d00dc3a55c2d4cb031c443d8c43c0de164 100644 (file)
@@ -96,11 +96,11 @@ const struct ethtool_ops cvm_oct_ethtool_ops = {
 };
 
 /**
- * IOCTL support for PHY control
- *
+ * cvm_oct_ioctl - IOCTL support for PHY control
  * @dev:    Device to change
  * @rq:     the request
  * @cmd:    the command
+ *
  * Returns Zero on success
  */
 int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -153,7 +153,7 @@ static void cvm_oct_adjust_link(struct net_device *dev)
 
 
 /**
- * Setup the PHY
+ * cvm_oct_phy_setup_device - setup the PHY
  *
  * @dev:    Device to setup
  *
index 55d0614a7cd94f67e867e8b6eb2f8f498405f722..a417d4fce12c1c8a5813d5c9b6d3f9ebc577f32b 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/ip.h>
 #include <linux/string.h>
 #include <linux/ethtool.h>
-#include <linux/mii.h>
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
 #include <net/dst.h>
index b595903e2af1f98ac2616b4d41a100f9c6ca2c22..00cc91df6b46a2448d2da9040fa3ba196644b2a2 100644 (file)
@@ -4,7 +4,7 @@
  * Contact: support@caviumnetworks.com
  * This file is part of the OCTEON SDK
  *
- * Copyright (c) 2003-2007 Cavium Networks
+ * Copyright (c) 2003-2010 Cavium Networks
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, Version 2, as
@@ -26,8 +26,6 @@
 **********************************************************************/
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <linux/mii.h>
-#include <net/dst.h>
 
 #include <asm/octeon/octeon.h>
 
 #include "cvmx-fpa.h"
 
 /**
- * Fill the supplied hardware pool with skbuffs
- *
+ * cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
  * @pool:     Pool to allocate an skbuff for
  * @size:     Size of the buffer needed for the pool
  * @elements: Number of buffers to allocate
+ *
+ * Returns the actual number of buffers allocated.
  */
 static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
 {
        int freed = elements;
        while (freed) {
 
-               struct sk_buff *skb = dev_alloc_skb(size + 128);
+               struct sk_buff *skb = dev_alloc_skb(size + 256);
                if (unlikely(skb == NULL)) {
                        pr_warning
                            ("Failed to allocate skb for hardware pool %d\n",
@@ -55,7 +54,7 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
                        break;
                }
 
-               skb_reserve(skb, 128 - (((unsigned long)skb->data) & 0x7f));
+               skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f));
                *(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
                cvmx_fpa_free(skb->data, pool, DONT_WRITEBACK(size / 128));
                freed--;
@@ -64,8 +63,7 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
 }
 
 /**
- * Free the supplied hardware pool of skbuffs
- *
+ * cvm_oct_free_hw_skbuff- free hardware pool skbuffs
  * @pool:     Pool to allocate an skbuff for
  * @size:     Size of the buffer needed for the pool
  * @elements: Number of buffers to allocate
@@ -93,96 +91,76 @@ static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
 }
 
 /**
- * This function fills a hardware pool with memory. Depending
- * on the config defines, this memory might come from the
- * kernel or global 32bit memory allocated with
- * cvmx_bootmem_alloc.
- *
+ * cvm_oct_fill_hw_memory - fill a hardware pool with memory.
  * @pool:     Pool to populate
  * @size:     Size of each buffer in the pool
  * @elements: Number of buffers to allocate
+ *
+ * Returns the actual number of buffers allocated.
  */
 static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
 {
        char *memory;
+       char *fpa;
        int freed = elements;
 
-       if (USE_32BIT_SHARED) {
-               extern uint64_t octeon_reserve32_memory;
-
-               memory =
-                   cvmx_bootmem_alloc_range(elements * size, 128,
-                                            octeon_reserve32_memory,
-                                            octeon_reserve32_memory +
-                                            (CONFIG_CAVIUM_RESERVE32 << 20) -
-                                            1);
-               if (memory == NULL)
-                       panic("Unable to allocate %u bytes for FPA pool %d\n",
-                             elements * size, pool);
-
-               pr_notice("Memory range %p - %p reserved for "
-                         "hardware\n", memory,
-                         memory + elements * size - 1);
-
-               while (freed) {
-                       cvmx_fpa_free(memory, pool, 0);
-                       memory += size;
-                       freed--;
-               }
-       } else {
-               while (freed) {
-                       /* We need to force alignment to 128 bytes here */
-                       memory = kmalloc(size + 127, GFP_ATOMIC);
-                       if (unlikely(memory == NULL)) {
-                               pr_warning("Unable to allocate %u bytes for "
-                                          "FPA pool %d\n",
-                                    elements * size, pool);
-                               break;
-                       }
-                       memory = (char *)(((unsigned long)memory + 127) & -128);
-                       cvmx_fpa_free(memory, pool, 0);
-                       freed--;
+       while (freed) {
+               /*
+                * FPA memory must be 128 byte aligned.  Since we are
+                * aligning we need to save the original pointer so we
+                * can feed it to kfree when the memory is returned to
+                * the kernel.
+                *
+                * We allocate an extra 256 bytes to allow for
+                * alignment and space for the original pointer saved
+                * just before the block.
+                */
+               memory = kmalloc(size + 256, GFP_ATOMIC);
+               if (unlikely(memory == NULL)) {
+                       pr_warning("Unable to allocate %u bytes for FPA pool %d\n",
+                                  elements * size, pool);
+                       break;
                }
+               fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
+               *((char **)fpa - 1) = memory;
+               cvmx_fpa_free(fpa, pool, 0);
+               freed--;
        }
        return elements - freed;
 }
 
 /**
- * Free memory previously allocated with cvm_oct_fill_hw_memory
- *
+ * cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
  * @pool:     FPA pool to free
  * @size:     Size of each buffer in the pool
  * @elements: Number of buffers that should be in the pool
  */
 static void cvm_oct_free_hw_memory(int pool, int size, int elements)
 {
-       if (USE_32BIT_SHARED) {
-               pr_warning("Warning: 32 shared memory is not freeable\n");
-       } else {
-               char *memory;
-               do {
-                       memory = cvmx_fpa_alloc(pool);
-                       if (memory) {
-                               elements--;
-                               kfree(phys_to_virt(cvmx_ptr_to_phys(memory)));
-                       }
-               } while (memory);
+       char *memory;
+       char *fpa;
+       do {
+               fpa = cvmx_fpa_alloc(pool);
+               if (fpa) {
+                       elements--;
+                       fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
+                       memory = *((char **)fpa - 1);
+                       kfree(memory);
+               }
+       } while (fpa);
 
-               if (elements < 0)
-                       pr_warning("Freeing of pool %u had too many "
-                                  "buffers (%d)\n",
-                              pool, elements);
-               else if (elements > 0)
-                       pr_warning("Warning: Freeing of pool %u is "
-                               "missing %d buffers\n",
-                            pool, elements);
-       }
+       if (elements < 0)
+               pr_warning("Freeing of pool %u had too many buffers (%d)\n",
+                       pool, elements);
+       else if (elements > 0)
+               pr_warning("Warning: Freeing of pool %u is missing %d buffers\n",
+                       pool, elements);
 }
 
 int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
 {
        int freed;
-       if (USE_SKBUFFS_IN_HW)
+       if (USE_SKBUFFS_IN_HW && pool == CVMX_FPA_PACKET_POOL)
                freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
        else
                freed = cvm_oct_fill_hw_memory(pool, size, elements);
@@ -191,7 +169,7 @@ int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
 
 void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
 {
-       if (USE_SKBUFFS_IN_HW)
+       if (USE_SKBUFFS_IN_HW && pool == CVMX_FPA_PACKET_POOL)
                cvm_oct_free_hw_skbuff(pool, size, elements);
        else
                cvm_oct_free_hw_memory(pool, size, elements);
diff --git a/drivers/staging/octeon/ethernet-proc.c b/drivers/staging/octeon/ethernet-proc.c
deleted file mode 100644 (file)
index 16308d4..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/**********************************************************************
- * Author: Cavium Networks
- *
- * Contact: support@caviumnetworks.com
- * This file is part of the OCTEON SDK
- *
- * Copyright (c) 2003-2007 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- *
- * This file is distributed in the hope that it will be useful, but
- * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
- * NONINFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- * or visit http://www.gnu.org/licenses/.
- *
- * This file may also be available under a different license from Cavium.
- * Contact Cavium Networks for more information
-**********************************************************************/
-#include <linux/kernel.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-
-#include <asm/octeon/octeon.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-
-#include "cvmx-helper.h"
-#include "cvmx-pip.h"
-
-/**
- * User is reading /proc/octeon_ethernet_stats
- *
- * @m:
- * @v:
- * Returns
- */
-static int cvm_oct_stats_show(struct seq_file *m, void *v)
-{
-       struct octeon_ethernet *priv;
-       int port;
-
-       for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
-
-               if (cvm_oct_device[port]) {
-                       priv = netdev_priv(cvm_oct_device[port]);
-
-                       seq_printf(m, "\nOcteon Port %d (%s)\n", port,
-                                  cvm_oct_device[port]->name);
-                       seq_printf(m,
-                                  "rx_packets:             %12lu\t"
-                                  "tx_packets:             %12lu\n",
-                                  priv->stats.rx_packets,
-                                  priv->stats.tx_packets);
-                       seq_printf(m,
-                                  "rx_bytes:               %12lu\t"
-                                  "tx_bytes:               %12lu\n",
-                                  priv->stats.rx_bytes, priv->stats.tx_bytes);
-                       seq_printf(m,
-                                  "rx_errors:              %12lu\t"
-                                  "tx_errors:              %12lu\n",
-                                  priv->stats.rx_errors,
-                                  priv->stats.tx_errors);
-                       seq_printf(m,
-                                  "rx_dropped:             %12lu\t"
-                                  "tx_dropped:             %12lu\n",
-                                  priv->stats.rx_dropped,
-                                  priv->stats.tx_dropped);
-                       seq_printf(m,
-                                  "rx_length_errors:       %12lu\t"
-                                  "tx_aborted_errors:      %12lu\n",
-                                  priv->stats.rx_length_errors,
-                                  priv->stats.tx_aborted_errors);
-                       seq_printf(m,
-                                  "rx_over_errors:         %12lu\t"
-                                  "tx_carrier_errors:      %12lu\n",
-                                  priv->stats.rx_over_errors,
-                                  priv->stats.tx_carrier_errors);
-                       seq_printf(m,
-                                  "rx_crc_errors:          %12lu\t"
-                                  "tx_fifo_errors:         %12lu\n",
-                                  priv->stats.rx_crc_errors,
-                                  priv->stats.tx_fifo_errors);
-                       seq_printf(m,
-                                  "rx_frame_errors:        %12lu\t"
-                                  "tx_heartbeat_errors:    %12lu\n",
-                                  priv->stats.rx_frame_errors,
-                                  priv->stats.tx_heartbeat_errors);
-                       seq_printf(m,
-                                  "rx_fifo_errors:         %12lu\t"
-                                  "tx_window_errors:       %12lu\n",
-                                  priv->stats.rx_fifo_errors,
-                                  priv->stats.tx_window_errors);
-                       seq_printf(m,
-                                  "rx_missed_errors:       %12lu\t"
-                                  "multicast:              %12lu\n",
-                                  priv->stats.rx_missed_errors,
-                                  priv->stats.multicast);
-               }
-       }
-
-       return 0;
-}
-
-/**
- * /proc/octeon_ethernet_stats was openned. Use the single_open iterator
- *
- * @inode:
- * @file:
- * Returns
- */
-static int cvm_oct_stats_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, cvm_oct_stats_show, NULL);
-}
-
-static const struct file_operations cvm_oct_stats_operations = {
-       .open = cvm_oct_stats_open,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-void cvm_oct_proc_initialize(void)
-{
-       struct proc_dir_entry *entry =
-           create_proc_entry("octeon_ethernet_stats", 0, NULL);
-       if (entry)
-               entry->proc_fops = &cvm_oct_stats_operations;
-}
-
-void cvm_oct_proc_shutdown(void)
-{
-       remove_proc_entry("octeon_ethernet_stats", NULL);
-}
diff --git a/drivers/staging/octeon/ethernet-proc.h b/drivers/staging/octeon/ethernet-proc.h
deleted file mode 100644 (file)
index 82c7d9f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*********************************************************************
- * Author: Cavium Networks
- *
- * Contact: support@caviumnetworks.com
- * This file is part of the OCTEON SDK
- *
- * Copyright (c) 2003-2007 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- *
- * This file is distributed in the hope that it will be useful, but
- * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
- * NONINFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- * or visit http://www.gnu.org/licenses/.
- *
- * This file may also be available under a different license from Cavium.
- * Contact Cavium Networks for more information
-*********************************************************************/
-
-void cvm_oct_proc_initialize(void);
-void cvm_oct_proc_shutdown(void);
index 3820f1ec11d16a98dd24357f4c32e5036178b1ac..a0d4d4b98bdc95d4a2b83d9da4ea2398163f200f 100644 (file)
@@ -26,7 +26,7 @@
 **********************************************************************/
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <linux/mii.h>
+#include <linux/phy.h>
 #include <net/dst.h>
 
 #include <asm/octeon/octeon.h>
@@ -48,14 +48,20 @@ static int number_rgmii_ports;
 static void cvm_oct_rgmii_poll(struct net_device *dev)
 {
        struct octeon_ethernet *priv = netdev_priv(dev);
-       unsigned long flags;
+       unsigned long flags = 0;
        cvmx_helper_link_info_t link_info;
+       int use_global_register_lock = (priv->phydev == NULL);
 
-       /*
-        * Take the global register lock since we are going to touch
-        * registers that affect more than one port.
-        */
-       spin_lock_irqsave(&global_register_lock, flags);
+       BUG_ON(in_interrupt());
+       if (use_global_register_lock) {
+               /*
+                * Take the global register lock since we are going to
+                * touch registers that affect more than one port.
+                */
+               spin_lock_irqsave(&global_register_lock, flags);
+       } else {
+               mutex_lock(&priv->phydev->bus->mdio_lock);
+       }
 
        link_info = cvmx_helper_link_get(priv->port);
        if (link_info.u64 == priv->link_info) {
@@ -115,7 +121,11 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
                                     dev->name);
                        }
                }
-               spin_unlock_irqrestore(&global_register_lock, flags);
+
+               if (use_global_register_lock)
+                       spin_unlock_irqrestore(&global_register_lock, flags);
+               else
+                       mutex_unlock(&priv->phydev->bus->mdio_lock);
                return;
        }
 
@@ -151,7 +161,12 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
                link_info = cvmx_helper_link_autoconf(priv->port);
                priv->link_info = link_info.u64;
        }
-       spin_unlock_irqrestore(&global_register_lock, flags);
+
+       if (use_global_register_lock)
+               spin_unlock_irqrestore(&global_register_lock, flags);
+       else {
+               mutex_unlock(&priv->phydev->bus->mdio_lock);
+       }
 
        if (priv->phydev == NULL) {
                /* Tell core. */
@@ -213,8 +228,11 @@ static irqreturn_t cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
                                struct net_device *dev =
                                    cvm_oct_device[cvmx_helper_get_ipd_port
                                                   (interface, index)];
-                               if (dev)
-                                       cvm_oct_rgmii_poll(dev);
+                               struct octeon_ethernet *priv = netdev_priv(dev);
+
+                               if (dev && !atomic_read(&cvm_oct_poll_queue_stopping))
+                                       queue_work(cvm_oct_poll_queue, &priv->port_work);
+
                                gmx_rx_int_reg.u64 = 0;
                                gmx_rx_int_reg.s.phy_dupx = 1;
                                gmx_rx_int_reg.s.phy_link = 1;
@@ -252,8 +270,11 @@ static irqreturn_t cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
                                struct net_device *dev =
                                    cvm_oct_device[cvmx_helper_get_ipd_port
                                                   (interface, index)];
-                               if (dev)
-                                       cvm_oct_rgmii_poll(dev);
+                               struct octeon_ethernet *priv = netdev_priv(dev);
+
+                               if (dev && !atomic_read(&cvm_oct_poll_queue_stopping))
+                                       queue_work(cvm_oct_poll_queue, &priv->port_work);
+
                                gmx_rx_int_reg.u64 = 0;
                                gmx_rx_int_reg.s.phy_dupx = 1;
                                gmx_rx_int_reg.s.phy_link = 1;
@@ -302,6 +323,12 @@ int cvm_oct_rgmii_stop(struct net_device *dev)
        return 0;
 }
 
+static void cvm_oct_rgmii_immediate_poll(struct work_struct *work)
+{
+       struct octeon_ethernet *priv = container_of(work, struct octeon_ethernet, port_work);
+       cvm_oct_rgmii_poll(cvm_oct_device[priv->port]);
+}
+
 int cvm_oct_rgmii_init(struct net_device *dev)
 {
        struct octeon_ethernet *priv = netdev_priv(dev);
@@ -309,7 +336,7 @@ int cvm_oct_rgmii_init(struct net_device *dev)
 
        cvm_oct_common_init(dev);
        dev->netdev_ops->ndo_stop(dev);
-
+       INIT_WORK(&priv->port_work, cvm_oct_rgmii_immediate_poll);
        /*
         * Due to GMX errata in CN3XXX series chips, it is necessary
         * to take the link down immediately when the PHY changes
@@ -397,4 +424,5 @@ void cvm_oct_rgmii_uninit(struct net_device *dev)
        number_rgmii_ports--;
        if (number_rgmii_ports == 0)
                free_irq(OCTEON_IRQ_RML, &number_rgmii_ports);
+       cancel_work_sync(&priv->port_work);
 }
index 1b237b7e689de30c22c3bb4e4a58f46c5c97789d..cb38f9eb2cc079c6822485cc225dcc9fe5bf049c 100644 (file)
@@ -4,7 +4,7 @@
  * Contact: support@caviumnetworks.com
  * This file is part of the OCTEON SDK
  *
- * Copyright (c) 2003-2007 Cavium Networks
+ * Copyright (c) 2003-2010 Cavium Networks
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, Version 2, as
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/cache.h>
+#include <linux/cpumask.h>
 #include <linux/netdevice.h>
 #include <linux/init.h>
 #include <linux/etherdevice.h>
 #include <linux/ip.h>
 #include <linux/string.h>
 #include <linux/prefetch.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
+#include <linux/smp.h>
 #include <net/dst.h>
 #ifdef CONFIG_XFRM
 #include <linux/xfrm.h>
@@ -48,8 +46,9 @@
 #include <asm/octeon/octeon.h>
 
 #include "ethernet-defines.h"
-#include "octeon-ethernet.h"
 #include "ethernet-mem.h"
+#include "ethernet-rx.h"
+#include "octeon-ethernet.h"
 #include "ethernet-util.h"
 
 #include "cvmx-helper.h"
 
 #include "cvmx-gmxx-defs.h"
 
-struct cvm_tasklet_wrapper {
-       struct tasklet_struct t;
-};
+struct cvm_napi_wrapper {
+       struct napi_struct napi;
+} ____cacheline_aligned_in_smp;
 
-/*
- * Aligning the tasklet_struct on cachline boundries seems to decrease
- * throughput even though in theory it would reduce contantion on the
- * cache lines containing the locks.
- */
+static struct cvm_napi_wrapper cvm_oct_napi[NR_CPUS] __cacheline_aligned_in_smp;
 
-static struct cvm_tasklet_wrapper cvm_oct_tasklet[NR_CPUS];
+struct cvm_oct_core_state {
+       int baseline_cores;
+       /*
+        * The number of additional cores that could be processing
+        * input packtes.
+        */
+       atomic_t available_cores;
+       cpumask_t cpu_state;
+} ____cacheline_aligned_in_smp;
 
-/**
- * Interrupt handler. The interrupt occurs whenever the POW
- * transitions from 0->1 packets in our group.
- *
- * @cpl:
- * @dev_id:
- * @regs:
- * Returns
- */
-irqreturn_t cvm_oct_do_interrupt(int cpl, void *dev_id)
+static struct cvm_oct_core_state core_state __cacheline_aligned_in_smp;
+
+static void cvm_oct_enable_napi(void *_)
 {
-       /* Acknowledge the interrupt */
-       if (INTERRUPT_LIMIT)
-               cvmx_write_csr(CVMX_POW_WQ_INT, 1 << pow_receive_group);
-       else
-               cvmx_write_csr(CVMX_POW_WQ_INT, 0x10001 << pow_receive_group);
-       preempt_disable();
-       tasklet_schedule(&cvm_oct_tasklet[smp_processor_id()].t);
-       preempt_enable();
-       return IRQ_HANDLED;
+       int cpu = smp_processor_id();
+       napi_schedule(&cvm_oct_napi[cpu].napi);
+}
+
+static void cvm_oct_enable_one_cpu(void)
+{
+       int v;
+       int cpu;
+
+       /* Check to see if more CPUs are available for receive processing... */
+       v = atomic_sub_if_positive(1, &core_state.available_cores);
+       if (v < 0)
+               return;
+
+       /* ... if a CPU is available, Turn on NAPI polling for that CPU.  */
+       for_each_online_cpu(cpu) {
+               if (!cpu_test_and_set(cpu, core_state.cpu_state)) {
+                       v = smp_call_function_single(cpu, cvm_oct_enable_napi,
+                                                    NULL, 0);
+                       if (v)
+                               panic("Can't enable NAPI.");
+                       break;
+               }
+       }
+}
+
+static void cvm_oct_no_more_work(void)
+{
+       int cpu = smp_processor_id();
+
+       /*
+        * CPU zero is special.  It always has the irq enabled when
+        * waiting for incoming packets.
+        */
+       if (cpu == 0) {
+               enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group);
+               return;
+       }
+
+       cpu_clear(cpu, core_state.cpu_state);
+       atomic_add(1, &core_state.available_cores);
 }
 
-#ifdef CONFIG_NET_POLL_CONTROLLER
 /**
- * This is called when the kernel needs to manually poll the
- * device. For Octeon, this is simply calling the interrupt
- * handler. We actually poll all the devices, not just the
- * one supplied.
+ * cvm_oct_do_interrupt - interrupt handler.
+ *
+ * The interrupt occurs whenever the POW has packets in our group.
  *
- * @dev:    Device to poll. Unused
  */
-void cvm_oct_poll_controller(struct net_device *dev)
+static irqreturn_t cvm_oct_do_interrupt(int cpl, void *dev_id)
 {
-       preempt_disable();
-       tasklet_schedule(&cvm_oct_tasklet[smp_processor_id()].t);
-       preempt_enable();
+       /* Disable the IRQ and start napi_poll. */
+       disable_irq_nosync(OCTEON_IRQ_WORKQ0 + pow_receive_group);
+       cvm_oct_enable_napi(NULL);
+
+       return IRQ_HANDLED;
 }
-#endif
 
 /**
- * This is called on receive errors, and determines if the packet
- * can be dropped early-on in cvm_oct_tasklet_rx().
- *
+ * cvm_oct_check_rcv_error - process receive errors
  * @work: Work queue entry pointing to the packet.
+ *
  * Returns Non-zero if the packet can be dropped, zero otherwise.
  */
 static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
@@ -199,19 +224,20 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 }
 
 /**
- * Tasklet function that is scheduled on a core when an interrupt occurs.
+ * cvm_oct_napi_poll - the NAPI poll function.
+ * @napi: The NAPI instance, or null if called from cvm_oct_poll_controller
+ * @budget: Maximum number of packets to receive.
  *
- * @unused:
+ * Returns the number of packets processed.
  */
-void cvm_oct_tasklet_rx(unsigned long unused)
+static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 {
-       const int coreid = cvmx_get_core_num();
-       uint64_t old_group_mask;
-       uint64_t old_scratch;
-       int rx_count = 0;
-       int number_to_free;
-       int num_freed;
-       int packet_not_copied;
+       const int       coreid = cvmx_get_core_num();
+       uint64_t        old_group_mask;
+       uint64_t        old_scratch;
+       int             rx_count = 0;
+       int             did_work_request = 0;
+       int             packet_not_copied;
 
        /* Prefetch cvm_oct_device since we know we need it soon */
        prefetch(cvm_oct_device);
@@ -227,59 +253,63 @@ void cvm_oct_tasklet_rx(unsigned long unused)
        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
                       (old_group_mask & ~0xFFFFull) | 1 << pow_receive_group);
 
-       if (USE_ASYNC_IOBDMA)
+       if (USE_ASYNC_IOBDMA) {
                cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
+               did_work_request = 1;
+       }
 
-       while (1) {
+       while (rx_count < budget) {
                struct sk_buff *skb = NULL;
+               struct sk_buff **pskb = NULL;
                int skb_in_hw;
                cvmx_wqe_t *work;
 
-               if (USE_ASYNC_IOBDMA) {
+               if (USE_ASYNC_IOBDMA && did_work_request)
                        work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
-               } else {
-                       if ((INTERRUPT_LIMIT == 0)
-                           || likely(rx_count < MAX_RX_PACKETS))
-                               work =
-                                   cvmx_pow_work_request_sync
-                                   (CVMX_POW_NO_WAIT);
-                       else
-                               work = NULL;
-               }
+               else
+                       work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
+
                prefetch(work);
-               if (work == NULL)
+               did_work_request = 0;
+               if (work == NULL) {
+                       union cvmx_pow_wq_int wq_int;
+                       wq_int.u64 = 0;
+                       wq_int.s.iq_dis = 1 << pow_receive_group;
+                       wq_int.s.wq_int = 1 << pow_receive_group;
+                       cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
                        break;
+               }
+               pskb = (struct sk_buff **)(cvm_oct_get_buffer_ptr(work->packet_ptr) - sizeof(void *));
+               prefetch(pskb);
 
-               /*
-                * Limit each core to processing MAX_RX_PACKETS
-                * packets without a break.  This way the RX can't
-                * starve the TX task.
-                */
-               if (USE_ASYNC_IOBDMA) {
-
-                       if ((INTERRUPT_LIMIT == 0)
-                           || likely(rx_count < MAX_RX_PACKETS))
-                               cvmx_pow_work_request_async_nocheck
-                                   (CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
-                       else {
-                               cvmx_scratch_write64(CVMX_SCR_SCRATCH,
-                                                    0x8000000000000000ull);
-                               cvmx_pow_tag_sw_null_nocheck();
-                       }
+               if (USE_ASYNC_IOBDMA && rx_count < (budget - 1)) {
+                       cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
+                       did_work_request = 1;
+               }
+
+               if (rx_count == 0) {
+                       /*
+                        * First time through, see if there is enough
+                        * work waiting to merit waking another
+                        * CPU.
+                        */
+                       union cvmx_pow_wq_int_cntx counts;
+                       int backlog;
+                       int cores_in_use = core_state.baseline_cores - atomic_read(&core_state.available_cores);
+                       counts.u64 = cvmx_read_csr(CVMX_POW_WQ_INT_CNTX(pow_receive_group));
+                       backlog = counts.s.iq_cnt + counts.s.ds_cnt;
+                       if (backlog > budget * cores_in_use && napi != NULL)
+                               cvm_oct_enable_one_cpu();
                }
 
                skb_in_hw = USE_SKBUFFS_IN_HW && work->word2.s.bufs == 1;
                if (likely(skb_in_hw)) {
-                       skb =
-                           *(struct sk_buff
-                             **)(cvm_oct_get_buffer_ptr(work->packet_ptr) -
-                                 sizeof(void *));
+                       skb = *pskb;
                        prefetch(&skb->head);
                        prefetch(&skb->len);
                }
                prefetch(cvm_oct_device[work->ipprt]);
 
-               rx_count++;
                /* Immediately throw away all packets with receive errors */
                if (unlikely(work->word2.snoip.rcv_error)) {
                        if (cvm_oct_check_rcv_error(work))
@@ -292,39 +322,27 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                 * buffer.
                 */
                if (likely(skb_in_hw)) {
-                       /*
-                        * This calculation was changed in case the
-                        * skb header is using a different address
-                        * aliasing type than the buffer. It doesn't
-                        * make any differnece now, but the new one is
-                        * more correct.
-                        */
-                       skb->data =
-                           skb->head + work->packet_ptr.s.addr -
-                           cvmx_ptr_to_phys(skb->head);
+                       skb->data = skb->head + work->packet_ptr.s.addr - cvmx_ptr_to_phys(skb->head);
                        prefetch(skb->data);
                        skb->len = work->len;
                        skb_set_tail_pointer(skb, skb->len);
                        packet_not_copied = 1;
                } else {
-
                        /*
                         * We have to copy the packet. First allocate
                         * an skbuff for it.
                         */
                        skb = dev_alloc_skb(work->len);
                        if (!skb) {
-                               DEBUGPRINT("Port %d failed to allocate "
-                                          "skbuff, packet dropped\n",
-                                    work->ipprt);
+                               DEBUGPRINT("Port %d failed to allocate skbuff, packet dropped\n",
+                                          work->ipprt);
                                cvm_oct_free_work(work);
                                continue;
                        }
 
                        /*
                         * Check if we've received a packet that was
-                        * entirely stored in the work entry. This is
-                        * untested.
+                        * entirely stored in the work entry.
                         */
                        if (unlikely(work->word2.s.bufs == 0)) {
                                uint8_t *ptr = work->packet_data;
@@ -343,15 +361,13 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                                /* No packet buffers to free */
                        } else {
                                int segments = work->word2.s.bufs;
-                               union cvmx_buf_ptr segment_ptr =
-                                       work->packet_ptr;
+                               union cvmx_buf_ptr segment_ptr = work->packet_ptr;
                                int len = work->len;
 
                                while (segments--) {
                                        union cvmx_buf_ptr next_ptr =
-                                           *(union cvmx_buf_ptr *)
-                                           cvmx_phys_to_ptr(segment_ptr.s.
-                                                            addr - 8);
+                                           *(union cvmx_buf_ptr *)cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
+
                        /*
                         * Octeon Errata PKI-100: The segment size is
                         * wrong. Until it is fixed, calculate the
@@ -361,22 +377,18 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                         * one: int segment_size =
                         * segment_ptr.s.size;
                         */
-                                       int segment_size =
-                                           CVMX_FPA_PACKET_POOL_SIZE -
-                                           (segment_ptr.s.addr -
-                                            (((segment_ptr.s.addr >> 7) -
-                                              segment_ptr.s.back) << 7));
-                                       /* Don't copy more than what is left
-                                          in the packet */
+                                       int segment_size = CVMX_FPA_PACKET_POOL_SIZE -
+                                               (segment_ptr.s.addr - (((segment_ptr.s.addr >> 7) - segment_ptr.s.back) << 7));
+                                       /*
+                                        * Don't copy more than what
+                                        * is left in the packet.
+                                        */
                                        if (segment_size > len)
                                                segment_size = len;
                                        /* Copy the data into the packet */
                                        memcpy(skb_put(skb, segment_size),
-                                              cvmx_phys_to_ptr(segment_ptr.s.
-                                                               addr),
+                                              cvmx_phys_to_ptr(segment_ptr.s.addr),
                                               segment_size);
-                                       /* Reduce the amount of bytes left
-                                          to copy */
                                        len -= segment_size;
                                        segment_ptr = next_ptr;
                                }
@@ -389,16 +401,15 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                        struct net_device *dev = cvm_oct_device[work->ipprt];
                        struct octeon_ethernet *priv = netdev_priv(dev);
 
-                       /* Only accept packets for devices
-                          that are currently up */
+                       /*
+                        * Only accept packets for devices that are
+                        * currently up.
+                        */
                        if (likely(dev->flags & IFF_UP)) {
                                skb->protocol = eth_type_trans(skb, dev);
                                skb->dev = dev;
 
-                               if (unlikely
-                                   (work->word2.s.not_IP
-                                    || work->word2.s.IP_exc
-                                    || work->word2.s.L4_error))
+                               if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error))
                                        skb->ip_summed = CHECKSUM_NONE;
                                else
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -414,15 +425,13 @@ void cvm_oct_tasklet_rx(unsigned long unused)
 #endif
                                }
                                netif_receive_skb(skb);
+                               rx_count++;
                        } else {
+                               /* Drop any packet received for a device that isn't up */
                                /*
-                                * Drop any packet received for a
-                                * device that isn't up.
-                                */
-                               /*
-                                  DEBUGPRINT("%s: Device not up, packet dropped\n",
-                                  dev->name);
-                                */
+                               DEBUGPRINT("%s: Device not up, packet dropped\n",
+                                          dev->name);
+                               */
 #ifdef CONFIG_64BIT
                                atomic64_add(1, (atomic64_t *)&priv->stats.rx_dropped);
 #else
@@ -435,9 +444,8 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                         * Drop any packet received for a device that
                         * doesn't exist.
                         */
-                       DEBUGPRINT("Port %d not controlled by Linux, packet "
-                                  "dropped\n",
-                            work->ipprt);
+                       DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n",
+                                  work->ipprt);
                        dev_kfree_skb_irq(skb);
                }
                /*
@@ -459,47 +467,93 @@ void cvm_oct_tasklet_rx(unsigned long unused)
                        cvm_oct_free_work(work);
                }
        }
-
        /* Restore the original POW group mask */
        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
        if (USE_ASYNC_IOBDMA) {
                /* Restore the scratch area */
                cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
        }
+       cvm_oct_rx_refill_pool(0);
 
-       if (USE_SKBUFFS_IN_HW) {
-               /* Refill the packet buffer pool */
-               number_to_free =
-                   cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-
-               if (number_to_free > 0) {
-                       cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-                                             -number_to_free);
-                       num_freed =
-                           cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
-                                                CVMX_FPA_PACKET_POOL_SIZE,
-                                                number_to_free);
-                       if (num_freed != number_to_free) {
-                               cvmx_fau_atomic_add32
-                                   (FAU_NUM_PACKET_BUFFERS_TO_FREE,
-                                    number_to_free - num_freed);
-                       }
-               }
+       if (rx_count < budget && napi != NULL) {
+               /* No more work */
+               napi_complete(napi);
+               cvm_oct_no_more_work();
        }
+       return rx_count;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/**
+ * cvm_oct_poll_controller - poll for receive packets
+ * device.
+ *
+ * @dev:    Device to poll. Unused
+ */
+void cvm_oct_poll_controller(struct net_device *dev)
+{
+       cvm_oct_napi_poll(NULL, 16);
+}
+#endif
+
 void cvm_oct_rx_initialize(void)
 {
        int i;
-       /* Initialize all of the tasklets */
-       for (i = 0; i < NR_CPUS; i++)
-               tasklet_init(&cvm_oct_tasklet[i].t, cvm_oct_tasklet_rx, 0);
+       struct net_device *dev_for_napi = NULL;
+       union cvmx_pow_wq_int_thrx int_thr;
+       union cvmx_pow_wq_int_pc int_pc;
+
+       for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
+               if (cvm_oct_device[i]) {
+                       dev_for_napi = cvm_oct_device[i];
+                       break;
+               }
+       }
+
+       if (NULL == dev_for_napi)
+               panic("No net_devices were allocated.");
+
+       if (max_rx_cpus > 1  && max_rx_cpus < num_online_cpus())
+               atomic_set(&core_state.available_cores, max_rx_cpus);
+       else
+               atomic_set(&core_state.available_cores, num_online_cpus());
+       core_state.baseline_cores = atomic_read(&core_state.available_cores);
+
+       core_state.cpu_state = CPU_MASK_NONE;
+       for_each_possible_cpu(i) {
+               netif_napi_add(dev_for_napi, &cvm_oct_napi[i].napi,
+                              cvm_oct_napi_poll, rx_napi_weight);
+               napi_enable(&cvm_oct_napi[i].napi);
+       }
+       /* Register an IRQ hander for to receive POW interrupts */
+       i = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group,
+                       cvm_oct_do_interrupt, 0, "Ethernet", cvm_oct_device);
+
+       if (i)
+               panic("Could not acquire Ethernet IRQ %d\n",
+                     OCTEON_IRQ_WORKQ0 + pow_receive_group);
+
+       disable_irq_nosync(OCTEON_IRQ_WORKQ0 + pow_receive_group);
+
+       int_thr.u64 = 0;
+       int_thr.s.tc_en = 1;
+       int_thr.s.tc_thr = 1;
+       /* Enable POW interrupt when our port has at least one packet */
+       cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), int_thr.u64);
+
+       int_pc.u64 = 0;
+       int_pc.s.pc_thr = 5;
+       cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
+
+
+       /* Scheduld NAPI now.  This will indirectly enable interrupts. */
+       cvm_oct_enable_one_cpu();
 }
 
 void cvm_oct_rx_shutdown(void)
 {
        int i;
-       /* Shutdown all of the tasklets */
-       for (i = 0; i < NR_CPUS; i++)
-               tasklet_kill(&cvm_oct_tasklet[i].t);
+       /* Shutdown all of the NAPIs */
+       for_each_possible_cpu(i)
+               netif_napi_del(&cvm_oct_napi[i].napi);
 }
index a9b72b87a7a675115d2f898c36587eb41917f013..a0743b85d54e754aa05014645f2f1e55678da7e2 100644 (file)
  * This file may also be available under a different license from Cavium.
  * Contact Cavium Networks for more information
 *********************************************************************/
+#include "cvmx-fau.h"
 
-irqreturn_t cvm_oct_do_interrupt(int cpl, void *dev_id);
 void cvm_oct_poll_controller(struct net_device *dev);
-void cvm_oct_tasklet_rx(unsigned long unused);
-
 void cvm_oct_rx_initialize(void);
 void cvm_oct_rx_shutdown(void);
+
+static inline void cvm_oct_rx_refill_pool(int fill_threshold)
+{
+       int number_to_free;
+       int num_freed;
+       /* Refill the packet buffer pool */
+       number_to_free =
+               cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
+
+       if (number_to_free > fill_threshold) {
+               cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
+                                     -number_to_free);
+               num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
+                                                CVMX_FPA_PACKET_POOL_SIZE,
+                                                number_to_free);
+               if (num_freed != number_to_free) {
+                       cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
+                                       number_to_free - num_freed);
+               }
+       }
+}
index 6061d01eca2daf067fe091f96545f356b99f1280..2d8589eb461e9cdf3fdfc1ace1dc552f930a91d3 100644 (file)
@@ -26,7 +26,6 @@
 **********************************************************************/
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <linux/mii.h>
 #include <net/dst.h>
 
 #include <asm/octeon/octeon.h>
index 00dc0f4bad19933b0dd2d48ce9c1bc61faf3f173..b58b8971f93938327e28e0c9761024ce7913ca2d 100644 (file)
@@ -26,7 +26,6 @@
 **********************************************************************/
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <linux/mii.h>
 #include <net/dst.h>
 
 #include <asm/octeon/octeon.h>
index 535294105f6585e37f45e9acb1c5f4bb27e90cfc..afc2b734d554fdd598292ccb42eb67af42fac56b 100644 (file)
@@ -4,7 +4,7 @@
  * Contact: support@caviumnetworks.com
  * This file is part of the OCTEON SDK
  *
- * Copyright (c) 2003-2007 Cavium Networks
+ * Copyright (c) 2003-2010 Cavium Networks
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, Version 2, as
 #include <linux/etherdevice.h>
 #include <linux/ip.h>
 #include <linux/string.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
 #include <net/dst.h>
 #ifdef CONFIG_XFRM
 #include <linux/xfrm.h>
 
 #include "cvmx-wqe.h"
 #include "cvmx-fau.h"
+#include "cvmx-pip.h"
 #include "cvmx-pko.h"
 #include "cvmx-helper.h"
 
 #include "cvmx-gmxx-defs.h"
 
+#define CVM_OCT_SKB_CB(skb)    ((u64 *)((skb)->cb))
+
 /*
  * You can define GET_SKBUFF_QOS() to override how the skbuff output
  * function determines which output queue is used. The default
 #define GET_SKBUFF_QOS(skb) 0
 #endif
 
+static void cvm_oct_tx_do_cleanup(unsigned long arg);
+static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
+
+/* Maximum number of SKBs to try to free per xmit packet. */
+#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
+
+static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
+{
+       int32_t undo;
+       undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free + MAX_SKB_TO_FREE;
+       if (undo > 0)
+               cvmx_fau_atomic_add32(fau, -undo);
+       skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ? MAX_SKB_TO_FREE : -skb_to_free;
+       return skb_to_free;
+}
+
+static void cvm_oct_kick_tx_poll_watchdog(void)
+{
+       union cvmx_ciu_timx ciu_timx;
+       ciu_timx.u64 = 0;
+       ciu_timx.s.one_shot = 1;
+       ciu_timx.s.len = cvm_oct_tx_poll_interval;
+       cvmx_write_csr(CVMX_CIU_TIMX(1), ciu_timx.u64);
+}
+
+void cvm_oct_free_tx_skbs(struct net_device *dev)
+{
+       int32_t skb_to_free;
+       int qos, queues_per_port;
+       int total_freed = 0;
+       int total_remaining = 0;
+       unsigned long flags;
+       struct octeon_ethernet *priv = netdev_priv(dev);
+
+       queues_per_port = cvmx_pko_get_num_queues(priv->port);
+       /* Drain any pending packets in the free list */
+       for (qos = 0; qos < queues_per_port; qos++) {
+               if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
+                       continue;
+               skb_to_free = cvmx_fau_fetch_and_add32(priv->fau+qos*4, MAX_SKB_TO_FREE);
+               skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free, priv->fau+qos*4);
+
+
+               total_freed += skb_to_free;
+               if (skb_to_free > 0) {
+                       struct sk_buff *to_free_list = NULL;
+                       spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
+                       while (skb_to_free > 0) {
+                               struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
+                               t->next = to_free_list;
+                               to_free_list = t;
+                               skb_to_free--;
+                       }
+                       spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
+                       /* Do the actual freeing outside of the lock. */
+                       while (to_free_list) {
+                               struct sk_buff *t = to_free_list;
+                               to_free_list = to_free_list->next;
+                               dev_kfree_skb_any(t);
+                       }
+               }
+               total_remaining += skb_queue_len(&priv->tx_free_list[qos]);
+       }
+       if (total_freed >= 0 && netif_queue_stopped(dev))
+               netif_wake_queue(dev);
+       if (total_remaining)
+               cvm_oct_kick_tx_poll_watchdog();
+}
+
 /**
- * Packet transmit
- *
+ * cvm_oct_xmit - transmit a packet
  * @skb:    Packet to send
  * @dev:    Device info structure
- * Returns Always returns zero
+ *
+ * Returns Always returns NETDEV_TX_OK
  */
 int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
 {
@@ -81,13 +149,15 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
        union cvmx_buf_ptr hw_buffer;
        uint64_t old_scratch;
        uint64_t old_scratch2;
-       int dropped;
        int qos;
-       int queue_it_up;
+       int i;
+       enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type;
        struct octeon_ethernet *priv = netdev_priv(dev);
+       struct sk_buff *to_free_list;
        int32_t skb_to_free;
-       int32_t undo;
        int32_t buffers_to_free;
+       u32 total_to_clean;
+       unsigned long flags;
 #if REUSE_SKBUFFS_WITHOUT_FREE
        unsigned char *fpa_head;
 #endif
@@ -98,9 +168,6 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
         */
        prefetch(priv);
 
-       /* Start off assuming no drop */
-       dropped = 0;
-
        /*
         * The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to
         * completely remove "qos" in the event neither interface
@@ -134,6 +201,28 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
                                               MAX_SKB_TO_FREE);
        }
 
+       /*
+        * We have space for 6 segment pointers, If there will be more
+        * than that, we must linearize.
+        */
+       if (unlikely(skb_shinfo(skb)->nr_frags > 5)) {
+               if (unlikely(__skb_linearize(skb))) {
+                       queue_type = QUEUE_DROP;
+                       if (USE_ASYNC_IOBDMA) {
+                               /* Get the number of skbuffs in use by the hardware */
+                               CVMX_SYNCIOBDMA;
+                               skb_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
+                       } else {
+                               /* Get the number of skbuffs in use by the hardware */
+                               skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
+                                                                      MAX_SKB_TO_FREE);
+                       }
+                       skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free, priv->fau + qos * 4);
+                       spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
+                       goto skip_xmit;
+               }
+       }
+
        /*
         * The CN3XXX series of parts has an errata (GMX-401) which
         * causes the GMX block to hang if a collision occurs towards
@@ -162,13 +251,6 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
                }
        }
 
-       /* Build the PKO buffer pointer */
-       hw_buffer.u64 = 0;
-       hw_buffer.s.addr = cvmx_ptr_to_phys(skb->data);
-       hw_buffer.s.pool = 0;
-       hw_buffer.s.size =
-           (unsigned long)skb_end_pointer(skb) - (unsigned long)skb->head;
-
        /* Build the PKO command */
        pko_command.u64 = 0;
        pko_command.s.n2 = 1;   /* Don't pollute L2 with the outgoing packet */
@@ -178,7 +260,31 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
        pko_command.s.subone0 = 1;
 
        pko_command.s.dontfree = 1;
-       pko_command.s.reg0 = priv->fau + qos * 4;
+
+       /* Build the PKO buffer pointer */
+       hw_buffer.u64 = 0;
+       if (skb_shinfo(skb)->nr_frags == 0) {
+               hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data);
+               hw_buffer.s.pool = 0;
+               hw_buffer.s.size = skb->len;
+       } else {
+               hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data);
+               hw_buffer.s.pool = 0;
+               hw_buffer.s.size = skb_headlen(skb);
+               CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
+               for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+                       struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
+                       hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)(page_address(fs->page) + fs->page_offset));
+                       hw_buffer.s.size = fs->size;
+                       CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
+               }
+               hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)CVM_OCT_SKB_CB(skb));
+               hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1;
+               pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1;
+               pko_command.s.gather = 1;
+               goto dont_put_skbuff_in_hw;
+       }
+
        /*
         * See if we can put this skb in the FPA pool. Any strange
         * behavior from the Linux networking stack will most likely
@@ -190,7 +296,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
         * shown a 25% increase in performance under some loads.
         */
 #if REUSE_SKBUFFS_WITHOUT_FREE
-       fpa_head = skb->head + 128 - ((unsigned long)skb->head & 0x7f);
+       fpa_head = skb->head + 256 - ((unsigned long)skb->head & 0x7f);
        if (unlikely(skb->data < fpa_head)) {
                /*
                 * printk("TX buffer beginning can't meet FPA
@@ -248,10 +354,9 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
         * We can use this buffer in the FPA.  We don't need the FAU
         * update anymore
         */
-       pko_command.s.reg0 = 0;
        pko_command.s.dontfree = 0;
 
-       hw_buffer.s.back = (skb->data - fpa_head) >> 7;
+       hw_buffer.s.back = ((unsigned long)skb->data >> 7) - ((unsigned long)fpa_head >> 7);
        *(struct sk_buff **)(fpa_head - sizeof(void *)) = skb;
 
        /*
@@ -272,16 +377,16 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
        skb->tc_verd = 0;
 #endif /* CONFIG_NET_CLS_ACT */
 #endif /* CONFIG_NET_SCHED */
+#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
 
 dont_put_skbuff_in_hw:
-#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
 
        /* Check if we can use the hardware checksumming */
        if (USE_HW_TCPUDP_CHECKSUM && (skb->protocol == htons(ETH_P_IP)) &&
            (ip_hdr(skb)->version == 4) && (ip_hdr(skb)->ihl == 5) &&
            ((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == 1 << 14))
-           && ((ip_hdr(skb)->protocol == IP_PROTOCOL_TCP)
-               || (ip_hdr(skb)->protocol == IP_PROTOCOL_UDP))) {
+           && ((ip_hdr(skb)->protocol == IPPROTO_TCP)
+               || (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
                /* Use hardware checksum calc */
                pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1;
        }
@@ -299,89 +404,116 @@ dont_put_skbuff_in_hw:
                    cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
        }
 
-       /*
-        * We try to claim MAX_SKB_TO_FREE buffers.  If there were not
-        * that many available, we have to un-claim (undo) any that
-        * were in excess.  If skb_to_free is positive we will free
-        * that many buffers.
-        */
-       undo = skb_to_free > 0 ?
-               MAX_SKB_TO_FREE : skb_to_free + MAX_SKB_TO_FREE;
-       if (undo > 0)
-               cvmx_fau_atomic_add32(priv->fau+qos*4, -undo);
-       skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ?
-               MAX_SKB_TO_FREE : -skb_to_free;
+       skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free, priv->fau+qos*4);
 
        /*
         * If we're sending faster than the receive can free them then
         * don't do the HW free.
         */
-       if ((buffers_to_free < -100) && !pko_command.s.dontfree) {
+       if ((buffers_to_free < -100) && !pko_command.s.dontfree)
                pko_command.s.dontfree = 1;
-               pko_command.s.reg0 = priv->fau + qos * 4;
+
+       if (pko_command.s.dontfree) {
+               queue_type = QUEUE_CORE;
+               pko_command.s.reg0 = priv->fau+qos*4;
+       } else {
+               queue_type = QUEUE_HW;
        }
+       if (USE_ASYNC_IOBDMA)
+               cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH, FAU_TOTAL_TX_TO_CLEAN, 1);
 
-       cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
-                                    CVMX_PKO_LOCK_CMD_QUEUE);
+       spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
 
        /* Drop this packet if we have too many already queued to the HW */
-       if (unlikely
-           (skb_queue_len(&priv->tx_free_list[qos]) >= MAX_OUT_QUEUE_DEPTH)) {
-               /*
-                  DEBUGPRINT("%s: Tx dropped. Too many queued\n", dev->name);
-                */
-               dropped = 1;
+       if (unlikely(skb_queue_len(&priv->tx_free_list[qos]) >= MAX_OUT_QUEUE_DEPTH)) {
+               if (dev->tx_queue_len != 0) {
+                       /* Drop the lock when notifying the core.  */
+                       spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
+                       netif_stop_queue(dev);
+                       spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
+               } else {
+                       /* If not using normal queueing.  */
+                       queue_type = QUEUE_DROP;
+                       goto skip_xmit;
+               }
        }
+
+       cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
+                                    CVMX_PKO_LOCK_NONE);
+
        /* Send the packet to the output queue */
-       else if (unlikely
-                (cvmx_pko_send_packet_finish
-                 (priv->port, priv->queue + qos, pko_command, hw_buffer,
-                  CVMX_PKO_LOCK_CMD_QUEUE))) {
+       if (unlikely(cvmx_pko_send_packet_finish(priv->port,
+                                                priv->queue + qos,
+                                                pko_command, hw_buffer,
+                                                CVMX_PKO_LOCK_NONE))) {
                DEBUGPRINT("%s: Failed to send the packet\n", dev->name);
-               dropped = 1;
+               queue_type = QUEUE_DROP;
+       }
+skip_xmit:
+       to_free_list = NULL;
+
+       switch (queue_type) {
+       case QUEUE_DROP:
+               skb->next = to_free_list;
+               to_free_list = skb;
+               priv->stats.tx_dropped++;
+               break;
+       case QUEUE_HW:
+               cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
+               break;
+       case QUEUE_CORE:
+               __skb_queue_tail(&priv->tx_free_list[qos], skb);
+               break;
+       default:
+               BUG();
+       }
+
+       while (skb_to_free > 0) {
+               struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
+               t->next = to_free_list;
+               to_free_list = t;
+               skb_to_free--;
+       }
+
+       spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
+
+       /* Do the actual freeing outside of the lock. */
+       while (to_free_list) {
+               struct sk_buff *t = to_free_list;
+               to_free_list = to_free_list->next;
+               dev_kfree_skb_any(t);
        }
 
        if (USE_ASYNC_IOBDMA) {
+               CVMX_SYNCIOBDMA;
+               total_to_clean = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
                /* Restore the scratch area */
                cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
                cvmx_scratch_write64(CVMX_SCR_SCRATCH + 8, old_scratch2);
-       }
-
-       queue_it_up = 0;
-       if (unlikely(dropped)) {
-               dev_kfree_skb_any(skb);
-               priv->stats.tx_dropped++;
        } else {
-               if (USE_SKBUFFS_IN_HW) {
-                       /* Put this packet on the queue to be freed later */
-                       if (pko_command.s.dontfree)
-                               queue_it_up = 1;
-                       else
-                               cvmx_fau_atomic_add32
-                                   (FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
-               } else {
-                       /* Put this packet on the queue to be freed later */
-                       queue_it_up = 1;
-               }
+               total_to_clean = cvmx_fau_fetch_and_add32(FAU_TOTAL_TX_TO_CLEAN, 1);
        }
 
-       if (queue_it_up) {
-               spin_lock(&priv->tx_free_list[qos].lock);
-               __skb_queue_tail(&priv->tx_free_list[qos], skb);
-               cvm_oct_free_tx_skbs(priv, skb_to_free, qos, 0);
-               spin_unlock(&priv->tx_free_list[qos].lock);
-       } else {
-               cvm_oct_free_tx_skbs(priv, skb_to_free, qos, 1);
+       if (total_to_clean & 0x3ff) {
+               /*
+                * Schedule the cleanup tasklet every 1024 packets for
+                * the pathological case of high traffic on one port
+                * delaying clean up of packets on a different port
+                * that is blocked waiting for the cleanup.
+                */
+               tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
        }
 
-       return 0;
+       cvm_oct_kick_tx_poll_watchdog();
+
+       return NETDEV_TX_OK;
 }
 
 /**
- * Packet transmit to the POW
- *
+ * cvm_oct_xmit_pow - transmit a packet to the POW
  * @skb:    Packet to send
  * @dev:    Device info structure
+
  * Returns Always returns zero
  */
 int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
@@ -459,8 +591,8 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
                work->word2.s.dec_ipcomp = 0;   /* FIXME */
 #endif
                work->word2.s.tcp_or_udp =
-                   (ip_hdr(skb)->protocol == IP_PROTOCOL_TCP)
-                   || (ip_hdr(skb)->protocol == IP_PROTOCOL_UDP);
+                   (ip_hdr(skb)->protocol == IPPROTO_TCP)
+                   || (ip_hdr(skb)->protocol == IPPROTO_UDP);
 #if 0
                /* FIXME */
                work->word2.s.dec_ipsec = 0;
@@ -529,116 +661,63 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
 }
 
 /**
- * Transmit a work queue entry out of the ethernet port. Both
- * the work queue entry and the packet data can optionally be
- * freed. The work will be freed on error as well.
- *
- * @dev:     Device to transmit out.
- * @work_queue_entry:
- *                Work queue entry to send
- * @do_free: True if the work queue entry and packet data should be
- *                freed. If false, neither will be freed.
- * @qos:     Index into the queues for this port to transmit on. This
- *                is used to implement QoS if their are multiple queues per
- *                port. This parameter must be between 0 and the number of
- *                queues per port minus 1. Values outside of this range will
- *                be change to zero.
+ * cvm_oct_tx_shutdown_dev - free all skb that are currently queued for TX.
+ * @dev:    Device being shutdown
  *
- * Returns Zero on success, negative on failure.
  */
-int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
-                        int do_free, int qos)
+void cvm_oct_tx_shutdown_dev(struct net_device *dev)
 {
-       unsigned long flags;
-       union cvmx_buf_ptr hw_buffer;
-       cvmx_pko_command_word0_t pko_command;
-       int dropped;
        struct octeon_ethernet *priv = netdev_priv(dev);
-       cvmx_wqe_t *work = work_queue_entry;
+       unsigned long flags;
+       int qos;
 
-       if (!(dev->flags & IFF_UP)) {
-               DEBUGPRINT("%s: Device not up\n", dev->name);
-               if (do_free)
-                       cvm_oct_free_work(work);
-               return -1;
+       for (qos = 0; qos < 16; qos++) {
+               spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
+               while (skb_queue_len(&priv->tx_free_list[qos]))
+                       dev_kfree_skb_any(__skb_dequeue
+                                         (&priv->tx_free_list[qos]));
+               spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
        }
+}
 
-       /* The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to completely
-          remove "qos" in the event neither interface supports
-          multiple queues per port */
-       if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) ||
-           (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) {
-               if (qos <= 0)
-                       qos = 0;
-               else if (qos >= cvmx_pko_get_num_queues(priv->port))
-                       qos = 0;
-       } else
-               qos = 0;
-
-       /* Start off assuming no drop */
-       dropped = 0;
-
-       local_irq_save(flags);
-       cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
-                                    CVMX_PKO_LOCK_CMD_QUEUE);
-
-       /* Build the PKO buffer pointer */
-       hw_buffer.u64 = 0;
-       hw_buffer.s.addr = work->packet_ptr.s.addr;
-       hw_buffer.s.pool = CVMX_FPA_PACKET_POOL;
-       hw_buffer.s.size = CVMX_FPA_PACKET_POOL_SIZE;
-       hw_buffer.s.back = work->packet_ptr.s.back;
+static void cvm_oct_tx_do_cleanup(unsigned long arg)
+{
+       int port;
 
-       /* Build the PKO command */
-       pko_command.u64 = 0;
-       pko_command.s.n2 = 1;   /* Don't pollute L2 with the outgoing packet */
-       pko_command.s.dontfree = !do_free;
-       pko_command.s.segs = work->word2.s.bufs;
-       pko_command.s.total_bytes = work->len;
+       for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
+               if (cvm_oct_device[port]) {
+                       struct net_device *dev = cvm_oct_device[port];
+                       cvm_oct_free_tx_skbs(dev);
+               }
+       }
+}
 
-       /* Check if we can use the hardware checksumming */
-       if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc))
-               pko_command.s.ipoffp1 = 0;
-       else
-               pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1;
+static irqreturn_t cvm_oct_tx_cleanup_watchdog(int cpl, void *dev_id)
+{
+       /* Disable the interrupt.  */
+       cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
+       /* Do the work in the tasklet.  */
+       tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
+       return IRQ_HANDLED;
+}
 
-       /* Send the packet to the output queue */
-       if (unlikely
-           (cvmx_pko_send_packet_finish
-            (priv->port, priv->queue + qos, pko_command, hw_buffer,
-             CVMX_PKO_LOCK_CMD_QUEUE))) {
-               DEBUGPRINT("%s: Failed to send the packet\n", dev->name);
-               dropped = -1;
-       }
-       local_irq_restore(flags);
+void cvm_oct_tx_initialize(void)
+{
+       int i;
 
-       if (unlikely(dropped)) {
-               if (do_free)
-                       cvm_oct_free_work(work);
-               priv->stats.tx_dropped++;
-       } else if (do_free)
-               cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
+       /* Disable the interrupt.  */
+       cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
+       /* Register an IRQ hander for to receive CIU_TIMX(1) interrupts */
+       i = request_irq(OCTEON_IRQ_TIMER1,
+                       cvm_oct_tx_cleanup_watchdog, 0,
+                       "Ethernet", cvm_oct_device);
 
-       return dropped;
+       if (i)
+               panic("Could not acquire Ethernet IRQ %d\n", OCTEON_IRQ_TIMER1);
 }
-EXPORT_SYMBOL(cvm_oct_transmit_qos);
 
-/**
- * This function frees all skb that are currently queued for TX.
- *
- * @dev:    Device being shutdown
- */
-void cvm_oct_tx_shutdown(struct net_device *dev)
+void cvm_oct_tx_shutdown(void)
 {
-       struct octeon_ethernet *priv = netdev_priv(dev);
-       unsigned long flags;
-       int qos;
-
-       for (qos = 0; qos < 16; qos++) {
-               spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-               while (skb_queue_len(&priv->tx_free_list[qos]))
-                       dev_kfree_skb_any(__skb_dequeue
-                                         (&priv->tx_free_list[qos]));
-               spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
-       }
+       /* Free the interrupt handler */
+       free_irq(OCTEON_IRQ_TIMER1, cvm_oct_device);
 }
index c0bebf750bc059acc8d4a8a52b4ab3451e81250d..547680c6c371e0691fbf1af167b17b690c87589a 100644 (file)
@@ -29,29 +29,6 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
 int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
 int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
                         int do_free, int qos);
-void cvm_oct_tx_shutdown(struct net_device *dev);
-
-/**
- * Free dead transmit skbs.
- *
- * @priv:              The driver data
- * @skb_to_free:       The number of SKBs to free (free none if negative).
- * @qos:               The queue to free from.
- * @take_lock:         If true, acquire the skb list lock.
- */
-static inline void cvm_oct_free_tx_skbs(struct octeon_ethernet *priv,
-                                       int skb_to_free,
-                                       int qos, int take_lock)
-{
-       /* Free skbuffs not in use by the hardware.  */
-       if (skb_to_free > 0) {
-               if (take_lock)
-                       spin_lock(&priv->tx_free_list[qos].lock);
-               while (skb_to_free > 0) {
-                       dev_kfree_skb(__skb_dequeue(&priv->tx_free_list[qos]));
-                       skb_to_free--;
-               }
-               if (take_lock)
-                       spin_unlock(&priv->tx_free_list[qos].lock);
-       }
-}
+void cvm_oct_tx_initialize(void);
+void cvm_oct_tx_shutdown(void);
+void cvm_oct_tx_shutdown_dev(struct net_device *dev);
index 37b665918000fb8ff2a986b662c0b63b943e7ef3..23467563fe572509b2d3c67fb16129469b6c8802 100644 (file)
                                } while (0)
 
 /**
- * Given a packet data address, return a pointer to the
- * beginning of the packet buffer.
- *
+ * cvm_oct_get_buffer_ptr - convert packet data address to pointer
  * @packet_ptr: Packet data hardware address
+ *
  * Returns Packet buffer pointer
  */
 static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
@@ -43,9 +42,7 @@ static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
 }
 
 /**
- * Given an IPD/PKO port number, return the logical interface it is
- * on.
- *
+ * INTERFACE - convert IPD port to locgical interface
  * @ipd_port: Port to check
  *
  * Returns Logical interface
@@ -65,9 +62,7 @@ static inline int INTERFACE(int ipd_port)
 }
 
 /**
- * Given an IPD/PKO port number, return the port's index on a
- * logical interface.
- *
+ * INDEX - convert IPD/PKO port number to the port's interface index
  * @ipd_port: Port to check
  *
  * Returns Index into interface port list
index ee3dc41b2c53cd7331a856e78678298518360cd7..3fca1cc31ed82dfc79bcaf1cf72b177694c110c0 100644 (file)
@@ -26,7 +26,6 @@
 **********************************************************************/
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <linux/mii.h>
 #include <net/dst.h>
 
 #include <asm/octeon/octeon.h>
index 4cfd4b136b328697f36ba3294f3273bf76bd1142..02b63678811a1281869b31e9693bac8982c77da1 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/delay.h>
 #include <linux/phy.h>
 
 #include <net/dst.h>
@@ -43,8 +42,6 @@
 #include "ethernet-tx.h"
 #include "ethernet-mdio.h"
 #include "ethernet-util.h"
-#include "ethernet-proc.h"
-
 
 #include "cvmx-pip.h"
 #include "cvmx-pko.h"
@@ -104,13 +101,15 @@ MODULE_PARM_DESC(pow_send_list, "\n"
        "\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
        "\tusing the pow_send_group.");
 
-static int disable_core_queueing = 1;
-module_param(disable_core_queueing, int, 0444);
-MODULE_PARM_DESC(disable_core_queueing, "\n"
-       "\tWhen set the networking core's tx_queue_len is set to zero.  This\n"
-       "\tallows packets to be sent without lock contention in the packet\n"
-       "\tscheduler resulting in some cases in improved throughput.\n");
+int max_rx_cpus = -1;
+module_param(max_rx_cpus, int, 0444);
+MODULE_PARM_DESC(max_rx_cpus, "\n"
+       "\t\tThe maximum number of CPUs to use for packet reception.\n"
+       "\t\tUse -1 to use all available CPUs.");
 
+int rx_napi_weight = 32;
+module_param(rx_napi_weight, int, 0444);
+MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
 
 /*
  * The offset from mac_addr_base that should be used for the next port
@@ -122,9 +121,16 @@ MODULE_PARM_DESC(disable_core_queueing, "\n"
 static unsigned int cvm_oct_mac_addr_offset;
 
 /**
- * Periodic timer to check auto negotiation
+ * cvm_oct_poll_queue - Workqueue for polling operations.
+ */
+struct workqueue_struct *cvm_oct_poll_queue;
+
+/**
+ * cvm_oct_poll_queue_stopping - flag to indicate polling should stop.
+ *
+ * Set to one right before cvm_oct_poll_queue is destroyed.
  */
-static struct timer_list cvm_oct_poll_timer;
+atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0);
 
 /**
  * Array of every ethernet device owned by this driver indexed by
@@ -132,65 +138,44 @@ static struct timer_list cvm_oct_poll_timer;
  */
 struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
 
-/**
- * Periodic timer tick for slow management operations
- *
- * @arg:    Device to check
- */
-static void cvm_do_timer(unsigned long arg)
+u64 cvm_oct_tx_poll_interval;
+
+static void cvm_oct_rx_refill_worker(struct work_struct *work);
+static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
+
+static void cvm_oct_rx_refill_worker(struct work_struct *work)
 {
-       int32_t skb_to_free, undo;
-       int queues_per_port;
-       int qos;
-       struct octeon_ethernet *priv;
-       static int port;
+       /*
+        * FPA 0 may have been drained, try to refill it if we need
+        * more than num_packet_buffers / 2, otherwise normal receive
+        * processing will refill it.  If it were drained, no packets
+        * could be received so cvm_oct_napi_poll would never be
+        * invoked to do the refill.
+        */
+       cvm_oct_rx_refill_pool(num_packet_buffers / 2);
 
-       if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
-               /*
-                * All ports have been polled. Start the next
-                * iteration through the ports in one second.
-                */
-               port = 0;
-               mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
-               return;
-       }
-       if (!cvm_oct_device[port])
-               goto out;
+       if (!atomic_read(&cvm_oct_poll_queue_stopping))
+               queue_delayed_work(cvm_oct_poll_queue,
+                                  &cvm_oct_rx_refill_work, HZ);
+}
+
+static void cvm_oct_periodic_worker(struct work_struct *work)
+{
+       struct octeon_ethernet *priv = container_of(work,
+                                                   struct octeon_ethernet,
+                                                   port_periodic_work.work);
 
-       priv = netdev_priv(cvm_oct_device[port]);
        if (priv->poll)
-               priv->poll(cvm_oct_device[port]);
-
-       queues_per_port = cvmx_pko_get_num_queues(port);
-       /* Drain any pending packets in the free list */
-       for (qos = 0; qos < queues_per_port; qos++) {
-               if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
-                       continue;
-               skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
-                                                      MAX_SKB_TO_FREE);
-               undo = skb_to_free > 0 ?
-                       MAX_SKB_TO_FREE : skb_to_free + MAX_SKB_TO_FREE;
-               if (undo > 0)
-                       cvmx_fau_atomic_add32(priv->fau+qos*4, -undo);
-               skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ?
-                       MAX_SKB_TO_FREE : -skb_to_free;
-               cvm_oct_free_tx_skbs(priv, skb_to_free, qos, 1);
-       }
-       cvm_oct_device[port]->netdev_ops->ndo_get_stats(cvm_oct_device[port]);
+               priv->poll(cvm_oct_device[priv->port]);
 
-out:
-       port++;
-       /* Poll the next port in a 50th of a second.
-          This spreads the polling of ports out a little bit */
-       mod_timer(&cvm_oct_poll_timer, jiffies + HZ / 50);
-}
+       cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats(cvm_oct_device[priv->port]);
+
+       if (!atomic_read(&cvm_oct_poll_queue_stopping))
+               queue_delayed_work(cvm_oct_poll_queue, &priv->port_periodic_work, HZ);
+ }
 
-/**
- * Configure common hardware for all interfaces
- */
 static __init void cvm_oct_configure_common_hw(void)
 {
-       int r;
        /* Setup the FPA */
        cvmx_fpa_enable();
        cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
@@ -205,28 +190,13 @@ static __init void cvm_oct_configure_common_hw(void)
                cvmx_helper_setup_red(num_packet_buffers / 4,
                                      num_packet_buffers / 8);
 
-       /* Enable the MII interface */
-       if (!octeon_is_simulation())
-               cvmx_write_csr(CVMX_SMIX_EN(0), 1);
-
-       /* Register an IRQ hander for to receive POW interrupts */
-       r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group,
-                       cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet",
-                       cvm_oct_device);
-
-#if defined(CONFIG_SMP) && 0
-       if (USE_MULTICORE_RECEIVE) {
-               irq_set_affinity(OCTEON_IRQ_WORKQ0 + pow_receive_group,
-                                cpu_online_mask);
-       }
-#endif
 }
 
 /**
- * Free a work queue entry received in a intercept callback.
+ * cvm_oct_free_work- Free a work queue entry
+ *
+ * @work_queue_entry: Work queue entry to free
  *
- * @work_queue_entry:
- *               Work queue entry to free
  * Returns Zero on success, Negative on failure.
  */
 int cvm_oct_free_work(void *work_queue_entry)
@@ -253,9 +223,9 @@ int cvm_oct_free_work(void *work_queue_entry)
 EXPORT_SYMBOL(cvm_oct_free_work);
 
 /**
- * Get the low level ethernet statistics
- *
+ * cvm_oct_common_get_stats - get the low level ethernet statistics
  * @dev:    Device to get the statistics from
+ *
  * Returns Pointer to the statistics
  */
 static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
@@ -299,8 +269,7 @@ static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
 }
 
 /**
- * Change the link MTU. Unimplemented
- *
+ * cvm_oct_common_change_mtu - change the link MTU
  * @dev:     Device to change
  * @new_mtu: The new MTU
  *
@@ -364,8 +333,7 @@ static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
 }
 
 /**
- * Set the multicast list. Currently unimplemented.
- *
+ * cvm_oct_common_set_multicast_list - set the multicast list
  * @dev:    Device to work on
  */
 static void cvm_oct_common_set_multicast_list(struct net_device *dev)
@@ -420,10 +388,10 @@ static void cvm_oct_common_set_multicast_list(struct net_device *dev)
 }
 
 /**
- * Set the hardware MAC address for a device
- *
- * @dev:    Device to change the MAC address for
- * @addr:   Address structure to change it too. MAC address is addr + 2.
+ * cvm_oct_common_set_mac_address - set the hardware MAC address for a device
+ * @dev:    The device in question.
+ * @addr:   Address structure to change it too.
+
  * Returns Zero on success
  */
 static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
@@ -470,9 +438,9 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
 }
 
 /**
- * Per network device initialization
- *
+ * cvm_oct_common_init - per network device initialization
  * @dev:    Device to initialize
+ *
  * Returns Zero on success
  */
 int cvm_oct_common_init(struct net_device *dev)
@@ -510,8 +478,11 @@ int cvm_oct_common_init(struct net_device *dev)
            && (always_use_pow || strstr(pow_send_list, dev->name)))
                priv->queue = -1;
 
-       if (priv->queue != -1 && USE_HW_TCPUDP_CHECKSUM)
-               dev->features |= NETIF_F_IP_CSUM;
+       if (priv->queue != -1) {
+               dev->features |= NETIF_F_SG;
+               if (USE_HW_TCPUDP_CHECKSUM)
+                       dev->features |= NETIF_F_IP_CSUM;
+       }
 
        /* We do our own locking, Linux doesn't need to */
        dev->features |= NETIF_F_LLTX;
@@ -625,12 +596,6 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = {
 
 extern void octeon_mdiobus_force_mod_depencency(void);
 
-/**
- * Module/ driver initialization. Creates the linux network
- * devices.
- *
- * Returns Zero on success
- */
 static int __init cvm_oct_init_module(void)
 {
        int num_interfaces;
@@ -648,8 +613,12 @@ static int __init cvm_oct_init_module(void)
        else
                cvm_oct_mac_addr_offset = 0;
 
-       cvm_oct_proc_initialize();
-       cvm_oct_rx_initialize();
+       cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet");
+       if (cvm_oct_poll_queue == NULL) {
+               pr_err("octeon-ethernet: Cannot create workqueue");
+               return -ENOMEM;
+       }
+
        cvm_oct_configure_common_hw();
 
        cvmx_helper_initialize_packet_io_global();
@@ -682,6 +651,9 @@ static int __init cvm_oct_init_module(void)
         */
        cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
 
+       /* Initialize the FAU used for counting tx SKBs that need to be freed */
+       cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
+
        if ((pow_send_group != -1)) {
                struct net_device *dev;
                pr_info("\tConfiguring device for POW only access\n");
@@ -689,7 +661,6 @@ static int __init cvm_oct_init_module(void)
                if (dev) {
                        /* Initialize the device private structure. */
                        struct octeon_ethernet *priv = netdev_priv(dev);
-                       memset(priv, 0, sizeof(struct octeon_ethernet));
 
                        dev->netdev_ops = &cvm_oct_pow_netdev_ops;
                        priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
@@ -700,19 +671,16 @@ static int __init cvm_oct_init_module(void)
                                skb_queue_head_init(&priv->tx_free_list[qos]);
 
                        if (register_netdev(dev) < 0) {
-                               pr_err("Failed to register ethernet "
-                                        "device for POW\n");
+                               pr_err("Failed to register ethernet device for POW\n");
                                kfree(dev);
                        } else {
                                cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
-                               pr_info("%s: POW send group %d, receive "
-                                       "group %d\n",
-                                    dev->name, pow_send_group,
-                                    pow_receive_group);
+                               pr_info("%s: POW send group %d, receive group %d\n",
+                                       dev->name, pow_send_group,
+                                       pow_receive_group);
                        }
                } else {
-                       pr_err("Failed to allocate ethernet device "
-                                "for POW\n");
+                       pr_err("Failed to allocate ethernet device for POW\n");
                }
        }
 
@@ -730,17 +698,15 @@ static int __init cvm_oct_init_module(void)
                        struct net_device *dev =
                            alloc_etherdev(sizeof(struct octeon_ethernet));
                        if (!dev) {
-                               pr_err("Failed to allocate ethernet device "
-                                        "for port %d\n", port);
+                               pr_err("Failed to allocate ethernet device for port %d\n", port);
                                continue;
                        }
-                       if (disable_core_queueing)
-                               dev->tx_queue_len = 0;
 
                        /* Initialize the device private structure. */
                        priv = netdev_priv(dev);
-                       memset(priv, 0, sizeof(struct octeon_ethernet));
 
+                       INIT_DELAYED_WORK(&priv->port_periodic_work,
+                                         cvm_oct_periodic_worker);
                        priv->imode = imode;
                        priv->port = port;
                        priv->queue = cvmx_pko_get_base_queue(priv->port);
@@ -803,44 +769,25 @@ static int __init cvm_oct_init_module(void)
                                fau -=
                                    cvmx_pko_get_num_queues(priv->port) *
                                    sizeof(uint32_t);
+                               queue_delayed_work(cvm_oct_poll_queue,
+                                                  &priv->port_periodic_work, HZ);
                        }
                }
        }
 
-       if (INTERRUPT_LIMIT) {
-               /*
-                * Set the POW timer rate to give an interrupt at most
-                * INTERRUPT_LIMIT times per second.
-                */
-               cvmx_write_csr(CVMX_POW_WQ_INT_PC,
-                              octeon_bootinfo->eclock_hz / (INTERRUPT_LIMIT *
-                                                            16 * 256) << 8);
+       cvm_oct_tx_initialize();
+       cvm_oct_rx_initialize();
 
-               /*
-                * Enable POW timer interrupt. It will count when
-                * there are packets available.
-                */
-               cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group),
-                              0x1ful << 24);
-       } else {
-               /* Enable POW interrupt when our port has at least one packet */
-               cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0x1001);
-       }
+       /*
+        * 150 uS: about 10 1500-byte packtes at 1GE.
+        */
+       cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
 
-       /* Enable the poll timer for checking RGMII status */
-       init_timer(&cvm_oct_poll_timer);
-       cvm_oct_poll_timer.data = 0;
-       cvm_oct_poll_timer.function = cvm_do_timer;
-       mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
+       queue_delayed_work(cvm_oct_poll_queue, &cvm_oct_rx_refill_work, HZ);
 
        return 0;
 }
 
-/**
- * Module / driver shutdown
- *
- * Returns Zero on success
- */
 static void __exit cvm_oct_cleanup_module(void)
 {
        int port;
@@ -853,22 +800,31 @@ static void __exit cvm_oct_cleanup_module(void)
        /* Free the interrupt handler */
        free_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, cvm_oct_device);
 
-       del_timer(&cvm_oct_poll_timer);
+       atomic_inc_return(&cvm_oct_poll_queue_stopping);
+       cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
+
        cvm_oct_rx_shutdown();
+       cvm_oct_tx_shutdown();
+
        cvmx_pko_disable();
 
        /* Free the ethernet devices */
        for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
                if (cvm_oct_device[port]) {
-                       cvm_oct_tx_shutdown(cvm_oct_device[port]);
-                       unregister_netdev(cvm_oct_device[port]);
-                       kfree(cvm_oct_device[port]);
+                       struct net_device *dev = cvm_oct_device[port];
+                       struct octeon_ethernet *priv = netdev_priv(dev);
+                       cancel_delayed_work_sync(&priv->port_periodic_work);
+
+                       cvm_oct_tx_shutdown_dev(dev);
+                       unregister_netdev(dev);
+                       kfree(dev);
                        cvm_oct_device[port] = NULL;
                }
        }
 
+       destroy_workqueue(cvm_oct_poll_queue);
+
        cvmx_pko_shutdown();
-       cvm_oct_proc_shutdown();
 
        cvmx_ipd_free_ptr();
 
index 402a15b9bb0ee1d2ffa725be0d4b71d93c0c7162..d58192563552db54a555f489c97ca675d8f822cd 100644 (file)
@@ -4,7 +4,7 @@
  * Contact: support@caviumnetworks.com
  * This file is part of the OCTEON SDK
  *
- * Copyright (c) 2003-2007 Cavium Networks
+ * Copyright (c) 2003-2010 Cavium Networks
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, Version 2, as
@@ -57,58 +57,12 @@ struct octeon_ethernet {
        uint64_t link_info;
        /* Called periodically to check link status */
        void (*poll) (struct net_device *dev);
+       struct delayed_work     port_periodic_work;
+       struct work_struct      port_work;      /* may be unused. */
 };
 
-/**
- * Free a work queue entry received in a intercept callback.
- *
- * @work_queue_entry:
- *               Work queue entry to free
- * Returns Zero on success, Negative on failure.
- */
 int cvm_oct_free_work(void *work_queue_entry);
 
-/**
- * Transmit a work queue entry out of the ethernet port. Both
- * the work queue entry and the packet data can optionally be
- * freed. The work will be freed on error as well.
- *
- * @dev:     Device to transmit out.
- * @work_queue_entry:
- *                Work queue entry to send
- * @do_free: True if the work queue entry and packet data should be
- *                freed. If false, neither will be freed.
- * @qos:     Index into the queues for this port to transmit on. This
- *                is used to implement QoS if their are multiple queues per
- *                port. This parameter must be between 0 and the number of
- *                queues per port minus 1. Values outside of this range will
- *                be change to zero.
- *
- * Returns Zero on success, negative on failure.
- */
-int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
-                        int do_free, int qos);
-
-/**
- * Transmit a work queue entry out of the ethernet port. Both
- * the work queue entry and the packet data can optionally be
- * freed. The work will be freed on error as well. This simply
- * wraps cvmx_oct_transmit_qos() for backwards compatability.
- *
- * @dev:     Device to transmit out.
- * @work_queue_entry:
- *                Work queue entry to send
- * @do_free: True if the work queue entry and packet data should be
- *                freed. If false, neither will be freed.
- *
- * Returns Zero on success, negative on failure.
- */
-static inline int cvm_oct_transmit(struct net_device *dev,
-                                  void *work_queue_entry, int do_free)
-{
-       return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0);
-}
-
 extern int cvm_oct_rgmii_init(struct net_device *dev);
 extern void cvm_oct_rgmii_uninit(struct net_device *dev);
 extern int cvm_oct_rgmii_open(struct net_device *dev);
@@ -134,5 +88,11 @@ extern int pow_send_group;
 extern int pow_receive_group;
 extern char pow_send_list[];
 extern struct net_device *cvm_oct_device[];
+extern struct workqueue_struct *cvm_oct_poll_queue;
+extern atomic_t cvm_oct_poll_queue_stopping;
+extern u64 cvm_oct_tx_poll_interval;
+
+extern int max_rx_cpus;
+extern int rx_napi_weight;
 
 #endif
index 133b86c6a678b114c29c66f10552d43f8788bf1f..2fff0a0052d1ffe2f34e0d1677d60f459603ab27 100644 (file)
@@ -5,7 +5,7 @@
  * Author: Boyod boyod.yang@siliconmotion.com.cn
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.com
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License. See the file COPYING in the main directory of this archive for
index 38d0c335322bcc93d9883770426e23dca4e51f45..02b4fa29136cc67a9961749badbb9243d2a9f618 100644 (file)
@@ -5,7 +5,7 @@
  * Author: Ge Wang, gewang@siliconmotion.com
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.com
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License. See the file COPYING in the main directory of this archive for
index 161dbc9c1397d2a27d367ef4eb9404f762d234af..a4f6f49aef48ab8312ca18ed42011abc16537228 100644 (file)
@@ -6,7 +6,7 @@
  *         Boyod boyod.yang@siliconmotion.com.cn
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.com
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License. See the file COPYING in the main directory of this archive for
index 7f2c34138215e69cb9ec227cf20926c7e9eabd0b..7ee565c2c95292af91b90a246edd285c5808ae61 100644 (file)
@@ -6,7 +6,7 @@
  *             Boyod boyod.yang@siliconmotion.com.cn
  *
  * Copyright (C) 2009 Lemote, Inc.
- * Author: Wu Zhangjin, wuzj@lemote.com
+ * Author: Wu Zhangjin, wuzhangjin@gmail.com
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License. See the file COPYING in the main directory of this archive for
index 96f11715cd269b4cb8594c12c4c027ae50350af8..355dffcc23b0f33a341e53d8b27218b175f7e221 100644 (file)
@@ -494,7 +494,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
                return 0;
        /* allocate 2^1 pages = 8K (on i386);
         * should be more than enough for one device */
-       pages_start = (char *)__get_free_pages(GFP_KERNEL, 1);
+       pages_start = (char *)__get_free_pages(GFP_NOIO, 1);
        if (!pages_start)
                return -ENOMEM;
 
index 6e8bcdfd23b41ee8435efbbb5e6bfadeb8095eb3..a678186f218fa84dc8b5fadcb8b196ff54898b06 100644 (file)
@@ -1312,9 +1312,9 @@ static int processcompl(struct async *as, void __user * __user *arg)
        void __user *addr = as->userurb;
        unsigned int i;
 
-       if (as->userbuffer)
+       if (as->userbuffer && urb->actual_length)
                if (copy_to_user(as->userbuffer, urb->transfer_buffer,
-                                urb->transfer_buffer_length))
+                                urb->actual_length))
                        goto err_out;
        if (put_user(as->status, &userurb->status))
                goto err_out;
@@ -1334,14 +1334,11 @@ static int processcompl(struct async *as, void __user * __user *arg)
                }
        }
 
-       free_async(as);
-
        if (put_user(addr, (void __user * __user *)arg))
                return -EFAULT;
        return 0;
 
 err_out:
-       free_async(as);
        return -EFAULT;
 }
 
@@ -1371,8 +1368,11 @@ static struct async *reap_as(struct dev_state *ps)
 static int proc_reapurb(struct dev_state *ps, void __user *arg)
 {
        struct async *as = reap_as(ps);
-       if (as)
-               return processcompl(as, (void __user * __user *)arg);
+       if (as) {
+               int retval = processcompl(as, (void __user * __user *)arg);
+               free_async(as);
+               return retval;
+       }
        if (signal_pending(current))
                return -EINTR;
        return -EIO;
@@ -1380,11 +1380,16 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg)
 
 static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
 {
+       int retval;
        struct async *as;
 
-       if (!(as = async_getcompleted(ps)))
-               return -EAGAIN;
-       return processcompl(as, (void __user * __user *)arg);
+       as = async_getcompleted(ps);
+       retval = -EAGAIN;
+       if (as) {
+               retval = processcompl(as, (void __user * __user *)arg);
+               free_async(as);
+       }
+       return retval;
 }
 
 #ifdef CONFIG_COMPAT
@@ -1475,9 +1480,9 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
        void __user *addr = as->userurb;
        unsigned int i;
 
-       if (as->userbuffer)
+       if (as->userbuffer && urb->actual_length)
                if (copy_to_user(as->userbuffer, urb->transfer_buffer,
-                                urb->transfer_buffer_length))
+                                urb->actual_length))
                        return -EFAULT;
        if (put_user(as->status, &userurb->status))
                return -EFAULT;
@@ -1497,7 +1502,6 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
                }
        }
 
-       free_async(as);
        if (put_user(ptr_to_compat(addr), (u32 __user *)arg))
                return -EFAULT;
        return 0;
@@ -1506,8 +1510,11 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
 static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)
 {
        struct async *as = reap_as(ps);
-       if (as)
-               return processcompl_compat(as, (void __user * __user *)arg);
+       if (as) {
+               int retval = processcompl_compat(as, (void __user * __user *)arg);
+               free_async(as);
+               return retval;
+       }
        if (signal_pending(current))
                return -EINTR;
        return -EIO;
@@ -1515,11 +1522,16 @@ static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)
 
 static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
 {
+       int retval;
        struct async *as;
 
-       if (!(as = async_getcompleted(ps)))
-               return -EAGAIN;
-       return processcompl_compat(as, (void __user * __user *)arg);
+       retval = -EAGAIN;
+       as = async_getcompleted(ps);
+       if (as) {
+               retval = processcompl_compat(as, (void __user * __user *)arg);
+               free_async(as);
+       }
+       return retval;
 }
 
 
index 60a45f1e3a67e13b41fd41770d51cbe83b39f730..f2f055eb6831d73dc006b7e3f54e1e954437c6f4 100644 (file)
@@ -1022,6 +1022,14 @@ static int usb_resume_device(struct usb_device *udev, pm_message_t msg)
                goto done;
        }
 
+       /* Non-root devices on a full/low-speed bus must wait for their
+        * companion high-speed root hub, in case a handoff is needed.
+        */
+       if (!(msg.event & PM_EVENT_AUTO) && udev->parent &&
+                       udev->bus->hs_companion)
+               device_pm_wait_for_dev(&udev->dev,
+                               &udev->bus->hs_companion->root_hub->dev);
+
        if (udev->quirks & USB_QUIRK_RESET_RESUME)
                udev->reset_resume = 1;
 
index fdfaa7885515d075330921d17442bbc80f1dcf06..d26b9ea981f92f322c5c402f38e53d7c075e7e52 100644 (file)
@@ -186,6 +186,7 @@ int usb_create_ep_devs(struct device *parent,
        ep_dev->dev.parent = parent;
        ep_dev->dev.release = ep_device_release;
        dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress);
+       device_enable_async_suspend(&ep_dev->dev);
 
        retval = device_register(&ep_dev->dev);
        if (retval)
index 2dcf906df569440d18a0cecb9b4801dec581e77f..15286533c15ac5c315712d30ed3a23c2e7bf3a73 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/pm_runtime.h>
 #include <linux/usb.h>
 
 #include <asm/io.h>
 
 /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
 
+#ifdef CONFIG_PM_SLEEP
+
+/* Coordinate handoffs between EHCI and companion controllers
+ * during system resume
+ */
+
+static DEFINE_MUTEX(companions_mutex);
+
+#define CL_UHCI                PCI_CLASS_SERIAL_USB_UHCI
+#define CL_OHCI                PCI_CLASS_SERIAL_USB_OHCI
+#define CL_EHCI                PCI_CLASS_SERIAL_USB_EHCI
+
+enum companion_action {
+       SET_HS_COMPANION, CLEAR_HS_COMPANION, WAIT_FOR_COMPANIONS
+};
+
+static void companion_common(struct pci_dev *pdev, struct usb_hcd *hcd,
+               enum companion_action action)
+{
+       struct pci_dev          *companion;
+       struct usb_hcd          *companion_hcd;
+       unsigned int            slot = PCI_SLOT(pdev->devfn);
+
+       /* Iterate through other PCI functions in the same slot.
+        * If pdev is OHCI or UHCI then we are looking for EHCI, and
+        * vice versa.
+        */
+       companion = NULL;
+       for (;;) {
+               companion = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, companion);
+               if (!companion)
+                       break;
+               if (companion->bus != pdev->bus ||
+                               PCI_SLOT(companion->devfn) != slot)
+                       continue;
+
+               companion_hcd = pci_get_drvdata(companion);
+               if (!companion_hcd)
+                       continue;
+
+               /* For SET_HS_COMPANION, store a pointer to the EHCI bus in
+                * the OHCI/UHCI companion bus structure.
+                * For CLEAR_HS_COMPANION, clear the pointer to the EHCI bus
+                * in the OHCI/UHCI companion bus structure.
+                * For WAIT_FOR_COMPANIONS, wait until the OHCI/UHCI
+                * companion controllers have fully resumed.
+                */
+
+               if ((pdev->class == CL_OHCI || pdev->class == CL_UHCI) &&
+                               companion->class == CL_EHCI) {
+                       /* action must be SET_HS_COMPANION */
+                       dev_dbg(&companion->dev, "HS companion for %s\n",
+                                       dev_name(&pdev->dev));
+                       hcd->self.hs_companion = &companion_hcd->self;
+
+               } else if (pdev->class == CL_EHCI &&
+                               (companion->class == CL_OHCI ||
+                               companion->class == CL_UHCI)) {
+                       switch (action) {
+                       case SET_HS_COMPANION:
+                               dev_dbg(&pdev->dev, "HS companion for %s\n",
+                                               dev_name(&companion->dev));
+                               companion_hcd->self.hs_companion = &hcd->self;
+                               break;
+                       case CLEAR_HS_COMPANION:
+                               companion_hcd->self.hs_companion = NULL;
+                               break;
+                       case WAIT_FOR_COMPANIONS:
+                               device_pm_wait_for_dev(&pdev->dev,
+                                               &companion->dev);
+                               break;
+                       }
+               }
+       }
+}
+
+static void set_hs_companion(struct pci_dev *pdev, struct usb_hcd *hcd)
+{
+       mutex_lock(&companions_mutex);
+       dev_set_drvdata(&pdev->dev, hcd);
+       companion_common(pdev, hcd, SET_HS_COMPANION);
+       mutex_unlock(&companions_mutex);
+}
+
+static void clear_hs_companion(struct pci_dev *pdev, struct usb_hcd *hcd)
+{
+       mutex_lock(&companions_mutex);
+       dev_set_drvdata(&pdev->dev, NULL);
+
+       /* If pdev is OHCI or UHCI, just clear its hs_companion pointer */
+       if (pdev->class == CL_OHCI || pdev->class == CL_UHCI)
+               hcd->self.hs_companion = NULL;
+
+       /* Otherwise search for companion buses and clear their pointers */
+       else
+               companion_common(pdev, hcd, CLEAR_HS_COMPANION);
+       mutex_unlock(&companions_mutex);
+}
+
+static void wait_for_companions(struct pci_dev *pdev, struct usb_hcd *hcd)
+{
+       /* Only EHCI controllers need to wait.
+        * No locking is needed because a controller cannot be resumed
+        * while one of its companions is getting unbound.
+        */
+       if (pdev->class == CL_EHCI)
+               companion_common(pdev, hcd, WAIT_FOR_COMPANIONS);
+}
+
+#else /* !CONFIG_PM_SLEEP */
+
+static inline void set_hs_companion(struct pci_dev *d, struct usb_hcd *h) {}
+static inline void clear_hs_companion(struct pci_dev *d, struct usb_hcd *h) {}
+static inline void wait_for_companions(struct pci_dev *d, struct usb_hcd *h) {}
+
+#endif /* !CONFIG_PM_SLEEP */
 
 /*-------------------------------------------------------------------------*/
 
@@ -123,7 +240,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                if (region == PCI_ROM_RESOURCE) {
                        dev_dbg(&dev->dev, "no i/o regions available\n");
                        retval = -EBUSY;
-                       goto err1;
+                       goto err2;
                }
        }
 
@@ -132,6 +249,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
                goto err4;
+       set_hs_companion(dev, hcd);
        return retval;
 
  err4:
@@ -142,6 +260,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        } else
                release_region(hcd->rsrc_start, hcd->rsrc_len);
  err2:
+       clear_hs_companion(dev, hcd);
        usb_put_hcd(hcd);
  err1:
        pci_disable_device(dev);
@@ -180,6 +299,7 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
        } else {
                release_region(hcd->rsrc_start, hcd->rsrc_len);
        }
+       clear_hs_companion(dev, hcd);
        usb_put_hcd(hcd);
        pci_disable_device(dev);
 }
@@ -344,6 +464,11 @@ static int resume_common(struct device *dev, bool hibernated)
        clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
 
        if (hcd->driver->pci_resume) {
+               /* This call should be made only during system resume,
+                * not during runtime resume.
+                */
+               wait_for_companions(pci_dev, hcd);
+
                retval = hcd->driver->pci_resume(hcd, hibernated);
                if (retval) {
                        dev_err(dev, "PCI post-resume error %d!\n", retval);
index 0495fa651225546836af7ac78bad141df77eaf91..80995ef0868c17e553dd6575a951b71973df27f1 100644 (file)
@@ -1684,6 +1684,24 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev,
                }
        }
        if (cur_alt && new_alt) {
+               struct usb_interface *iface = usb_ifnum_to_if(udev,
+                               cur_alt->desc.bInterfaceNumber);
+
+               if (iface->resetting_device) {
+                       /*
+                        * The USB core just reset the device, so the xHCI host
+                        * and the device will think alt setting 0 is installed.
+                        * However, the USB core will pass in the alternate
+                        * setting installed before the reset as cur_alt.  Dig
+                        * out the alternate setting 0 structure, or the first
+                        * alternate setting if a broken device doesn't have alt
+                        * setting 0.
+                        */
+                       cur_alt = usb_altnum_to_altsetting(iface, 0);
+                       if (!cur_alt)
+                               cur_alt = &iface->altsetting[0];
+               }
+
                /* Drop all the endpoints in the current alt setting */
                for (i = 0; i < cur_alt->desc.bNumEndpoints; i++) {
                        ret = hcd->driver->drop_endpoint(hcd, udev,
index 0cec6caf6e9b26ca385927c6e6b19b67fabbfae2..20ecb4cec8de56540f507d459c205b51151da148 100644 (file)
@@ -1817,6 +1817,7 @@ int usb_new_device(struct usb_device *udev)
        /* Tell the world! */
        announce_device(udev);
 
+       device_enable_async_suspend(&udev->dev);
        /* Register the device.  The device driver is responsible
         * for configuring the device and invoking the add-device
         * notifier chain (used by usbfs and possibly others).
@@ -3347,6 +3348,9 @@ static void hub_events(void)
                                        USB_PORT_FEAT_C_SUSPEND);
                                udev = hdev->children[i-1];
                                if (udev) {
+                                       /* TRSMRCY = 10 msec */
+                                       msleep(10);
+
                                        usb_lock_device(udev);
                                        ret = remote_wakeup(hdev->
                                                        children[i-1]);
@@ -3692,19 +3696,14 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
                        usb_enable_interface(udev, intf, true);
                        ret = 0;
                } else {
-                       /* We've just reset the device, so it will think alt
-                        * setting 0 is installed.  For usb_set_interface() to
-                        * work properly, we need to set the current alternate
-                        * interface setting to 0 (or the first alt setting, if
-                        * the device doesn't have alt setting 0).
+                       /* Let the bandwidth allocation function know that this
+                        * device has been reset, and it will have to use
+                        * alternate setting 0 as the current alternate setting.
                         */
-                       intf->cur_altsetting =
-                               usb_find_alt_setting(config, i, 0);
-                       if (!intf->cur_altsetting)
-                               intf->cur_altsetting =
-                                       &config->intf_cache[i]->altsetting[0];
+                       intf->resetting_device = 1;
                        ret = usb_set_interface(udev, desc->bInterfaceNumber,
                                        desc->bAlternateSetting);
+                       intf->resetting_device = 0;
                }
                if (ret < 0) {
                        dev_err(&udev->dev, "failed to restore interface %d "
index 1b994846e8e01bec12219873eb6926e97cbc3e81..df73574a9cc9e567fc621a00d935f423923ac762 100644 (file)
@@ -906,11 +906,11 @@ char *usb_cache_string(struct usb_device *udev, int index)
        if (index <= 0)
                return NULL;
 
-       buf = kmalloc(MAX_USB_STRING_SIZE, GFP_KERNEL);
+       buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO);
        if (buf) {
                len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE);
                if (len > 0) {
-                       smallbuf = kmalloc(++len, GFP_KERNEL);
+                       smallbuf = kmalloc(++len, GFP_NOIO);
                        if (!smallbuf)
                                return buf;
                        memcpy(smallbuf, buf, len);
@@ -1731,7 +1731,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
        if (cp) {
                nintf = cp->desc.bNumInterfaces;
                new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
-                               GFP_KERNEL);
+                               GFP_NOIO);
                if (!new_interfaces) {
                        dev_err(&dev->dev, "Out of memory\n");
                        return -ENOMEM;
@@ -1740,7 +1740,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
                for (; n < nintf; ++n) {
                        new_interfaces[n] = kzalloc(
                                        sizeof(struct usb_interface),
-                                       GFP_KERNEL);
+                                       GFP_NOIO);
                        if (!new_interfaces[n]) {
                                dev_err(&dev->dev, "Out of memory\n");
                                ret = -ENOMEM;
@@ -1867,6 +1867,7 @@ free_interfaces:
                        "adding %s (config #%d, interface %d)\n",
                        dev_name(&intf->dev), configuration,
                        intf->cur_altsetting->desc.bInterfaceNumber);
+               device_enable_async_suspend(&intf->dev);
                ret = device_add(&intf->dev);
                if (ret != 0) {
                        dev_err(&dev->dev, "device_add(%s) --> %d\n",
index 485edf937f257ae846b921eae465f2655841f1b7..5f3908f6e2dc12f455b9036da9621478976a3dd9 100644 (file)
@@ -115,6 +115,12 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf)
        case USB_SPEED_HIGH:
                speed = "480";
                break;
+       case USB_SPEED_VARIABLE:
+               speed = "480";
+               break;
+       case USB_SPEED_SUPER:
+               speed = "5000";
+               break;
        default:
                speed = "unknown";
        }
index 0a577d5694fdb9b379d2533335c2f03ad394b65b..d4f0db58a8ad11238ee9ded4995f4f5780b863ab 100644 (file)
@@ -358,7 +358,7 @@ done:
         * b15:         bmType (0 == data)
         */
        len = skb->len;
-       put_unaligned_le16((len & 0x3FFF) | BIT(14), skb_push(skb, 2));
+       put_unaligned_le16(len & 0x3FFF, skb_push(skb, 2));
 
        /* add a zero-length EEM packet, if needed */
        if (padlen)
@@ -464,7 +464,6 @@ static int eem_unwrap(struct gether *port,
                        }
 
                        /* validate CRC */
-                       crc = get_unaligned_le32(skb->data + len - ETH_FCS_LEN);
                        if (header & BIT(14)) {
                                crc = get_unaligned_le32(skb->data + len
                                                        - ETH_FCS_LEN);
index 429560100b10fc048a9e6c92d65efeac51effe20..76496f5d272c59cebd3856aa8cce245d5c4352f3 100644 (file)
@@ -29,7 +29,7 @@
 #if defined USB_ETH_RNDIS
 #  undef USB_ETH_RNDIS
 #endif
-#ifdef CONFIG_USB_ETH_RNDIS
+#ifdef CONFIG_USB_G_MULTI_RNDIS
 #  define USB_ETH_RNDIS y
 #endif
 
index e220fb8091a3618d536123f86c724d95bc7e8325..8b45145b913618ea302bf062e905a67ed87baaf2 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
index 4b5dbd0127f500a458094d4e7fc4fc267de146be..5fc80a104150aef353391596fc0ed17c476136c6 100644 (file)
@@ -2582,6 +2582,7 @@ err:
        hsotg->gadget.dev.driver = NULL;
        return ret;
 }
+EXPORT_SYMBOL(usb_gadget_register_driver);
 
 int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 {
index 5859522d6edd9f0dde4fc8241d5398b0f4381698..1ec3857f22e65c3cb9474529eea85e62a377b722 100644 (file)
@@ -787,9 +787,10 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 
                        /* start 20 msec resume signaling from this port,
                         * and make khubd collect PORT_STAT_C_SUSPEND to
-                        * stop that signaling.
+                        * stop that signaling.  Use 5 ms extra for safety,
+                        * like usb_port_resume() does.
                         */
-                       ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
+                       ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
                        ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
                        mod_timer(&hcd->rh_timer, ehci->reset_done[i]);
                }
index 2c6571c05f35c99398d973382680137f56363dcb..19372673bf09aadffc955c2ca531b8133b219149 100644 (file)
@@ -120,9 +120,26 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
        del_timer_sync(&ehci->watchdog);
        del_timer_sync(&ehci->iaa_watchdog);
 
-       port = HCS_N_PORTS (ehci->hcs_params);
        spin_lock_irq (&ehci->lock);
 
+       /* Once the controller is stopped, port resumes that are already
+        * in progress won't complete.  Hence if remote wakeup is enabled
+        * for the root hub and any ports are in the middle of a resume or
+        * remote wakeup, we must fail the suspend.
+        */
+       if (hcd->self.root_hub->do_remote_wakeup) {
+               port = HCS_N_PORTS(ehci->hcs_params);
+               while (port--) {
+                       if (ehci->reset_done[port] != 0) {
+                               spin_unlock_irq(&ehci->lock);
+                               ehci_dbg(ehci, "suspend failed because "
+                                               "port %d is resuming\n",
+                                               port + 1);
+                               return -EBUSY;
+                       }
+               }
+       }
+
        /* stop schedules, clean any completed work */
        if (HC_IS_RUNNING(hcd->state)) {
                ehci_quiesce (ehci);
@@ -138,6 +155,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
         */
        ehci->bus_suspended = 0;
        ehci->owned_ports = 0;
+       port = HCS_N_PORTS(ehci->hcs_params);
        while (port--) {
                u32 __iomem     *reg = &ehci->regs->port_status [port];
                u32             t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
@@ -178,7 +196,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
                        if (hostpc_reg) {
                                u32     t3;
 
+                               spin_unlock_irq(&ehci->lock);
                                msleep(5);/* 5ms for HCD enter low pwr mode */
+                               spin_lock_irq(&ehci->lock);
                                t3 = ehci_readl(ehci, hostpc_reg);
                                ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);
                                t3 = ehci_readl(ehci, hostpc_reg);
@@ -886,17 +906,18 @@ static int ehci_hub_control (
                        if ((temp & PORT_PE) == 0
                                        || (temp & PORT_RESET) != 0)
                                goto error;
-                       ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
+
                        /* After above check the port must be connected.
                         * Set appropriate bit thus could put phy into low power
                         * mode if we have hostpc feature
                         */
+                       temp &= ~PORT_WKCONN_E;
+                       temp |= PORT_WKDISC_E | PORT_WKOC_E;
+                       ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
                        if (hostpc_reg) {
-                               temp &= ~PORT_WKCONN_E;
-                               temp |= (PORT_WKDISC_E | PORT_WKOC_E);
-                               ehci_writel(ehci, temp | PORT_SUSPEND,
-                                                       status_reg);
+                               spin_unlock_irqrestore(&ehci->lock, flags);
                                msleep(5);/* 5ms for HCD enter low pwr mode */
+                               spin_lock_irqsave(&ehci->lock, flags);
                                temp1 = ehci_readl(ehci, hostpc_reg);
                                ehci_writel(ehci, temp1 | HOSTPC_PHCD,
                                        hostpc_reg);
index a427d3b0063468659bd73351ecf6aba86e9210fb..89521775c567abeaeb856e2ca3106ec4996ef9e0 100644 (file)
@@ -849,9 +849,10 @@ qh_make (
                                 * But interval 1 scheduling is simpler, and
                                 * includes high bandwidth.
                                 */
-                               dbg ("intr period %d uframes, NYET!",
-                                               urb->interval);
-                               goto done;
+                               urb->interval = 1;
+                       } else if (qh->period > ehci->periodic_size) {
+                               qh->period = ehci->periodic_size;
+                               urb->interval = qh->period << 3;
                        }
                } else {
                        int             think_time;
@@ -874,6 +875,10 @@ qh_make (
                                        usb_calc_bus_time (urb->dev->speed,
                                        is_input, 0, max_packet (maxp)));
                        qh->period = urb->interval;
+                       if (qh->period > ehci->periodic_size) {
+                               qh->period = ehci->periodic_size;
+                               urb->interval = qh->period;
+                       }
                }
        }
 
index 0951818ef93b8838651597b3acef7795a193eca3..78e7c3cfcb7282757d85fc331de14ab559580e4c 100644 (file)
@@ -242,9 +242,10 @@ err:
 static void fhci_usb_free(void *lld)
 {
        struct fhci_usb *usb = lld;
-       struct fhci_hcd *fhci = usb->fhci;
+       struct fhci_hcd *fhci;
 
        if (usb) {
+               fhci = usb->fhci;
                fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF);
                fhci_ep0_free(usb);
                kfree(usb->actual_frame);
index d224ab467a401d729b13b2d8c9f44f380616f184..e1232890c78bb9f9f4d931589dc14adeb363f2ba 100644 (file)
@@ -105,7 +105,7 @@ void fhci_ep0_free(struct fhci_usb *usb)
                if (ep->td_base)
                        cpm_muram_free(cpm_muram_offset(ep->td_base));
 
-               if (ep->conf_frame_Q) {
+               if (kfifo_initialized(&ep->conf_frame_Q)) {
                        size = cq_howmany(&ep->conf_frame_Q);
                        for (; size; size--) {
                                struct packet *pkt = cq_get(&ep->conf_frame_Q);
@@ -115,7 +115,7 @@ void fhci_ep0_free(struct fhci_usb *usb)
                        cq_delete(&ep->conf_frame_Q);
                }
 
-               if (ep->empty_frame_Q) {
+               if (kfifo_initialized(&ep->empty_frame_Q)) {
                        size = cq_howmany(&ep->empty_frame_Q);
                        for (; size; size--) {
                                struct packet *pkt = cq_get(&ep->empty_frame_Q);
@@ -125,7 +125,7 @@ void fhci_ep0_free(struct fhci_usb *usb)
                        cq_delete(&ep->empty_frame_Q);
                }
 
-               if (ep->dummy_packets_Q) {
+               if (kfifo_initialized(&ep->dummy_packets_Q)) {
                        size = cq_howmany(&ep->dummy_packets_Q);
                        for (; size; size--) {
                                u8 *buff = cq_get(&ep->dummy_packets_Q);
index 73352f3739b5ee654cdcd24f0be85495eeebcc58..42971657fde2953f2d7798e5b45d4d14796fb16d 100644 (file)
@@ -2270,10 +2270,10 @@ static int isp1362_mem_config(struct usb_hcd *hcd)
        dev_info(hcd->self.controller, "ISP1362 Memory usage:\n");
        dev_info(hcd->self.controller, "  ISTL:    2 * %4d:     %4d @ $%04x:$%04x\n",
                 istl_size / 2, istl_size, 0, istl_size / 2);
-       dev_info(hcd->self.controller, "  INTL: %4d * (%3lu+8):  %4d @ $%04x\n",
+       dev_info(hcd->self.controller, "  INTL: %4d * (%3zu+8):  %4d @ $%04x\n",
                 ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE,
                 intl_size, istl_size);
-       dev_info(hcd->self.controller, "  ATL : %4d * (%3lu+8):  %4d @ $%04x\n",
+       dev_info(hcd->self.controller, "  ATL : %4d * (%3zu+8):  %4d @ $%04x\n",
                 atl_buffers, atl_blksize - PTD_HEADER_SIZE,
                 atl_size, istl_size + intl_size);
        dev_info(hcd->self.controller, "  USED/FREE:   %4d      %4d\n", total,
@@ -2697,6 +2697,8 @@ static int __init isp1362_probe(struct platform_device *pdev)
        void __iomem *data_reg;
        int irq;
        int retval = 0;
+       struct resource *irq_res;
+       unsigned int irq_flags = 0;
 
        /* basic sanity checks first.  board-specific init logic should
         * have initialized this the three resources and probably board
@@ -2710,11 +2712,12 @@ static int __init isp1362_probe(struct platform_device *pdev)
 
        data = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        addr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       irq = platform_get_irq(pdev, 0);
-       if (!addr || !data || irq < 0) {
+       irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!addr || !data || !irq_res) {
                retval = -ENODEV;
                goto err1;
        }
+       irq = irq_res->start;
 
 #ifdef CONFIG_USB_HCD_DMA
        if (pdev->dev.dma_mask) {
@@ -2781,12 +2784,16 @@ static int __init isp1362_probe(struct platform_device *pdev)
        }
 #endif
 
-#ifdef CONFIG_ARM
-       if (isp1362_hcd->board)
-               set_irq_type(irq, isp1362_hcd->board->int_act_high ? IRQT_RISING : IRQT_FALLING);
-#endif
+       if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE)
+               irq_flags |= IRQF_TRIGGER_RISING;
+       if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE)
+               irq_flags |= IRQF_TRIGGER_FALLING;
+       if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL)
+               irq_flags |= IRQF_TRIGGER_HIGH;
+       if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL)
+               irq_flags |= IRQF_TRIGGER_LOW;
 
-       retval = usb_add_hcd(hcd, irq, IRQF_TRIGGER_LOW | IRQF_DISABLED | IRQF_SHARED);
+       retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
                goto err6;
        pr_info("%s, irq %d\n", hcd->product_desc, irq);
index 9600a58299db3f8c29ac575fccda0d97dacccbc2..27b8f7cb4471e8399f8262feaca409388b11957f 100644 (file)
@@ -1039,12 +1039,12 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
                if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) {
                        u32 buffstatus;
 
-                       /* XXX
+                       /*
                         * NAKs are handled in HW by the chip. Usually if the
                         * device is not able to send data fast enough.
-                        * This did not trigger for a long time now.
+                        * This happens mostly on slower hardware.
                         */
-                       printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: "
+                       printk(KERN_NOTICE "Reloading ptd %p/%p... qh %p read: "
                                        "%d of %zu done: %08x cur: %08x\n", qtd,
                                        urb, qh, PTD_XFERRED_LENGTH(dw3),
                                        qtd->length, done_map,
index b7a661c02bcdb5d3edf0a84b39a50a41f2bf411c..bee558aed42778ce153b5a1db9c4c55376575431 100644 (file)
@@ -35,7 +35,9 @@
 #include <linux/usb.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/mm.h>
 #include <linux/irq.h>
+#include <asm/cacheflush.h>
 
 #include "../core/hcd.h"
 #include "r8a66597.h"
@@ -216,8 +218,17 @@ static void disable_controller(struct r8a66597 *r8a66597)
 {
        int port;
 
+       /* disable interrupts */
        r8a66597_write(r8a66597, 0, INTENB0);
-       r8a66597_write(r8a66597, 0, INTSTS0);
+       r8a66597_write(r8a66597, 0, INTENB1);
+       r8a66597_write(r8a66597, 0, BRDYENB);
+       r8a66597_write(r8a66597, 0, BEMPENB);
+       r8a66597_write(r8a66597, 0, NRDYENB);
+
+       /* clear status */
+       r8a66597_write(r8a66597, 0, BRDYSTS);
+       r8a66597_write(r8a66597, 0, NRDYSTS);
+       r8a66597_write(r8a66597, 0, BEMPSTS);
 
        for (port = 0; port < r8a66597->max_root_hub; port++)
                r8a66597_disable_port(r8a66597, port);
@@ -811,6 +822,26 @@ static void enable_r8a66597_pipe(struct r8a66597 *r8a66597, struct urb *urb,
        enable_r8a66597_pipe_dma(r8a66597, dev, pipe, urb);
 }
 
+static void r8a66597_urb_done(struct r8a66597 *r8a66597, struct urb *urb,
+                             int status)
+__releases(r8a66597->lock)
+__acquires(r8a66597->lock)
+{
+       if (usb_pipein(urb->pipe) && usb_pipetype(urb->pipe) != PIPE_CONTROL) {
+               void *ptr;
+
+               for (ptr = urb->transfer_buffer;
+                    ptr < urb->transfer_buffer + urb->transfer_buffer_length;
+                    ptr += PAGE_SIZE)
+                       flush_dcache_page(virt_to_page(ptr));
+       }
+
+       usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597), urb);
+       spin_unlock(&r8a66597->lock);
+       usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb, status);
+       spin_lock(&r8a66597->lock);
+}
+
 /* this function must be called with interrupt disabled */
 static void force_dequeue(struct r8a66597 *r8a66597, u16 pipenum, u16 address)
 {
@@ -829,15 +860,9 @@ static void force_dequeue(struct r8a66597 *r8a66597, u16 pipenum, u16 address)
                list_del(&td->queue);
                kfree(td);
 
-               if (urb) {
-                       usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597),
-                                       urb);
+               if (urb)
+                       r8a66597_urb_done(r8a66597, urb, -ENODEV);
 
-                       spin_unlock(&r8a66597->lock);
-                       usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb,
-                                       -ENODEV);
-                       spin_lock(&r8a66597->lock);
-               }
                break;
        }
 }
@@ -997,6 +1022,8 @@ static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port,
 /* this function must be called with interrupt disabled */
 static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port,
                                        u16 syssts)
+__releases(r8a66597->lock)
+__acquires(r8a66597->lock)
 {
        if (syssts == SE0) {
                r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
@@ -1014,7 +1041,9 @@ static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port,
                        usb_hcd_resume_root_hub(r8a66597_to_hcd(r8a66597));
        }
 
+       spin_unlock(&r8a66597->lock);
        usb_hcd_poll_rh_status(r8a66597_to_hcd(r8a66597));
+       spin_lock(&r8a66597->lock);
 }
 
 /* this function must be called with interrupt disabled */
@@ -1274,10 +1303,7 @@ __releases(r8a66597->lock) __acquires(r8a66597->lock)
                if (usb_pipeisoc(urb->pipe))
                        urb->start_frame = r8a66597_get_frame(hcd);
 
-               usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597), urb);
-               spin_unlock(&r8a66597->lock);
-               usb_hcd_giveback_urb(hcd, urb, status);
-               spin_lock(&r8a66597->lock);
+               r8a66597_urb_done(r8a66597, urb, status);
        }
 
        if (restart) {
@@ -2466,6 +2492,12 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
        r8a66597->rh_timer.data = (unsigned long)r8a66597;
        r8a66597->reg = (unsigned long)reg;
 
+       /* make sure no interrupts are pending */
+       ret = r8a66597_clock_enable(r8a66597);
+       if (ret < 0)
+               goto clean_up3;
+       disable_controller(r8a66597);
+
        for (i = 0; i < R8A66597_MAX_NUM_PIPE; i++) {
                INIT_LIST_HEAD(&r8a66597->pipe_queue[i]);
                init_timer(&r8a66597->td_timer[i]);
index 5cd0e48f67fb13b3df18ed077cd72a76995ae10c..99cd00fd3514c7f25abb0b42977e14c61edbb6ca 100644 (file)
@@ -749,7 +749,20 @@ static int uhci_rh_suspend(struct usb_hcd *hcd)
        spin_lock_irq(&uhci->lock);
        if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
                rc = -ESHUTDOWN;
-       else if (!uhci->dead)
+       else if (uhci->dead)
+               ;               /* Dead controllers tell no tales */
+
+       /* Once the controller is stopped, port resumes that are already
+        * in progress won't complete.  Hence if remote wakeup is enabled
+        * for the root hub and any ports are in the middle of a resume or
+        * remote wakeup, we must fail the suspend.
+        */
+       else if (hcd->self.root_hub->do_remote_wakeup &&
+                       uhci->resuming_ports) {
+               dev_dbg(uhci_dev(uhci), "suspend failed because a port "
+                               "is resuming\n");
+               rc = -EBUSY;
+       } else
                suspend_rh(uhci, UHCI_RH_SUSPENDED);
        spin_unlock_irq(&uhci->lock);
        return rc;
index 885b585360b967f23661c015dd8945371f5fa058..8270055848cacd2a8e32379d873b1f624006db71 100644 (file)
@@ -167,7 +167,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
                                /* Port received a wakeup request */
                                set_bit(port, &uhci->resuming_ports);
                                uhci->ports_timeout = jiffies +
-                                               msecs_to_jiffies(20);
+                                               msecs_to_jiffies(25);
 
                                /* Make sure we see the port again
                                 * after the resuming period is over. */
index 0025847743f30fc12500045e7980bd5568e4e83c..8b37a4b9839edcbc047258f391c73a8a16a82263 100644 (file)
@@ -3245,6 +3245,7 @@ static struct usb_device_id sisusb_table [] = {
        { USB_DEVICE(0x0711, 0x0902) },
        { USB_DEVICE(0x0711, 0x0903) },
        { USB_DEVICE(0x0711, 0x0918) },
+       { USB_DEVICE(0x0711, 0x0920) },
        { USB_DEVICE(0x182d, 0x021c) },
        { USB_DEVICE(0x182d, 0x0269) },
        { }
index de56b3d743d781a4294801e32af9341967943d06..3d2d3e549bd18cbe8392b72b212209e79c8a1b7f 100644 (file)
@@ -44,6 +44,7 @@ config ISP1301_OMAP
 config USB_ULPI
        bool "Generic ULPI Transceiver Driver"
        depends on ARM
+       select USB_OTG_UTILS
        help
          Enable this to support ULPI connected USB OTG transceivers which
          are likely found on embedded boards.
index 216f187582ab4ea17ffe40234a2300c78f3d99a5..7638828e7317787bbd8905f426032c3dbbaa2dce 100644 (file)
@@ -50,7 +50,7 @@
  * Version Information
  */
 #define DRIVER_VERSION "v1.5.0"
-#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>"
+#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>, Andreas Mohr"
 #define DRIVER_DESC "USB FTDI Serial Converters Driver"
 
 static int debug;
@@ -145,10 +145,15 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
 
 
 
+/*
+ * Device ID not listed? Test via module params product/vendor or
+ * /sys/bus/usb/ftdi_sio/new_id, then send patch/report!
+ */
 static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) },
@@ -552,9 +557,16 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
        /*
-        * Due to many user requests for multiple ELV devices we enable
-        * them by default.
+        * ELV devices:
         */
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_WS550_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_EC3000_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_WS888_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_TWS550_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_FEM_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_CLI7000_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_PPS7330_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_TFM100_PID) },
@@ -571,11 +583,17 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_RFP500_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_UTP8_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_WS444PC_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_HS485_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_UMS100_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) },
        { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
        { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
        { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
@@ -697,6 +715,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
        { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
        { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
+       { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
        { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
index da92b4952ffb0bdc855f3a8186181aa7ae55ec85..c8951aeed98379d93d3793a70440eb426ffb2286 100644 (file)
@@ -38,6 +38,8 @@
 /* www.candapter.com Ewert Energy Systems CANdapter device */
 #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
 
+#define FTDI_NXTCAM_PID                0xABB8 /* NXTCam for Mindstorms NXT */
+
 /* OOCDlink by Joern Kaipf <joernk@web.de>
  * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */
 #define FTDI_OOCDLINK_PID      0xbaf8  /* Amontec JTAGkey */
 /*
  * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).
  * All of these devices use FTDI's vendor ID (0x0403).
+ * Further IDs taken from ELV Windows .inf file.
  *
  * The previously included PID for the UO 100 module was incorrect.
  * In fact, that PID was for ELV's UR 100 USB-RS232 converter (0xFB58).
  *
  * Armin Laeuger originally sent the PID for the UM 100 module.
  */
+#define FTDI_ELV_USR_PID       0xE000  /* ELV Universal-Sound-Recorder */
+#define FTDI_ELV_MSM1_PID      0xE001  /* ELV Mini-Sound-Modul */
+#define FTDI_ELV_KL100_PID     0xE002  /* ELV Kfz-Leistungsmesser KL 100 */
+#define FTDI_ELV_WS550_PID     0xE004  /* WS 550 */
+#define FTDI_ELV_EC3000_PID    0xE006  /* ENERGY CONTROL 3000 USB */
+#define FTDI_ELV_WS888_PID     0xE008  /* WS 888 */
+#define FTDI_ELV_TWS550_PID    0xE009  /* Technoline WS 550 */
+#define FTDI_ELV_FEM_PID       0xE00A  /* Funk Energie Monitor */
 #define FTDI_ELV_FHZ1300PC_PID 0xE0E8  /* FHZ 1300 PC */
 #define FTDI_ELV_WS500_PID     0xE0E9  /* PC-Wetterstation (WS 500) */
 #define FTDI_ELV_HS485_PID     0xE0EA  /* USB to RS-485 adapter */
+#define FTDI_ELV_UMS100_PID    0xE0EB  /* ELV USB Master-Slave Schaltsteckdose UMS 100 */
+#define FTDI_ELV_TFD128_PID    0xE0EC  /* ELV Temperatur-Feuchte-Datenlogger TFD 128 */
+#define FTDI_ELV_FM3RX_PID     0xE0ED  /* ELV Messwertuebertragung FM3 RX */
+#define FTDI_ELV_WS777_PID     0xE0EE  /* Conrad WS 777 */
 #define FTDI_ELV_EM1010PC_PID  0xE0EF  /* Engery monitor EM 1010 PC */
 #define FTDI_ELV_CSI8_PID      0xE0F0  /* Computer-Schalt-Interface (CSI 8) */
 #define FTDI_ELV_EM1000DL_PID  0xE0F1  /* PC-Datenlogger fuer Energiemonitor (EM 1000 DL) */
 #define FTDI_ELV_PCK100_PID    0xE0F2  /* PC-Kabeltester (PCK 100) */
 #define FTDI_ELV_RFP500_PID    0xE0F3  /* HF-Leistungsmesser (RFP 500) */
 #define FTDI_ELV_FS20SIG_PID   0xE0F4  /* Signalgeber (FS 20 SIG) */
+#define FTDI_ELV_UTP8_PID      0xE0F5  /* ELV UTP 8 */
 #define FTDI_ELV_WS300PC_PID   0xE0F6  /* PC-Wetterstation (WS 300 PC) */
+#define FTDI_ELV_WS444PC_PID   0xE0F7  /* Conrad WS 444 PC */
 #define FTDI_PHI_FISCO_PID      0xE40B  /* PHI Fisco USB to Serial cable */
 #define FTDI_ELV_UAD8_PID      0xF068  /* USB-AD-Wandler (UAD 8) */
 #define FTDI_ELV_UDA7_PID      0xF069  /* USB-DA-Wandler (UDA 7) */
 #define PAPOUCH_VID                    0x5050  /* Vendor ID */
 #define PAPOUCH_TMU_PID                        0x0400  /* TMU USB Thermometer */
 #define PAPOUCH_QUIDO4x4_PID           0x0900  /* Quido 4/4 Module */
+#define PAPOUCH_AD4USB_PID             0x8003  /* AD4USB Measurement Module */
 
 /*
  * Marvell SheevaPlug
index f1ea3a33b6e6378ad767e7c4783cebf8defb34a6..83443d6306d60e03f5b60ea0f9c4b70ae01f292b 100644 (file)
@@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
 
        dbg("%s - port %d", __func__, port->number);
 
-       if (serial->type->max_in_flight_urbs) {
-               spin_lock_irqsave(&port->lock, flags);
+       spin_lock_irqsave(&port->lock, flags);
+       if (serial->type->max_in_flight_urbs)
                chars = port->tx_bytes_flight;
-               spin_unlock_irqrestore(&port->lock, flags);
-       } else if (serial->num_bulk_out)
+       else if (serial->num_bulk_out)
                chars = kfifo_len(&port->write_fifo);
+       spin_unlock_irqrestore(&port->lock, flags);
 
        dbg("%s - returns %d", __func__, chars);
        return chars;
@@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
        dbg("%s - port %d", __func__, port->number);
 
        if (port->serial->type->max_in_flight_urbs) {
+               kfree(urb->transfer_buffer);
+
                spin_lock_irqsave(&port->lock, flags);
                --port->urbs_in_flight;
                port->tx_bytes_flight -= urb->transfer_buffer_length;
index ac1b6449fb6abc779f6904cd4899508f466426de..3eb6143bb6468135fe45f64af73b41a1a12f7845 100644 (file)
@@ -298,6 +298,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x68A3),   /* Sierra Wireless Direct IP modems */
          .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
        },
+       { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */
 
        { }
 };
index 64a0a2c27e12b4478734ae9683fead5750abfe67..49575fba37560424fa6959f827577089995be580 100644 (file)
@@ -941,7 +941,7 @@ UNUSUAL_DEV(  0x07ab, 0xfccd, 0x0000, 0x9999,
 UNUSUAL_DEV(  0x07af, 0x0004, 0x0100, 0x0133,
                "Microtech",
                "USB-SCSI-DB25",
-               US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init,
+               US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init,
                US_FL_SCM_MULT_TARG ), 
 
 UNUSUAL_DEV(  0x07af, 0x0005, 0x0100, 0x0100,
@@ -1807,13 +1807,6 @@ UNUSUAL_DEV(  0x2735, 0x100b, 0x0000, 0x9999,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_GO_SLOW ),
 
-/* Reported by Rohan Hart <rohan.hart17@gmail.com> */
-UNUSUAL_DEV(  0x2770, 0x915d, 0x0010, 0x0010,
-               "INTOVA",
-               "Pixtreme",
-               US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_FIX_CAPACITY ),
-
 /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
  * Mio Moov 330
  */
index 5a53d4f0dd11cb547f58430afc17c8501ef4a8a7..bbeeb92a213101d7eeab4314c91532da707247f7 100644 (file)
@@ -78,7 +78,7 @@ MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
 MODULE_DESCRIPTION("USB Mass Storage driver for Linux");
 MODULE_LICENSE("GPL");
 
-static unsigned int delay_use = 5;
+static unsigned int delay_use = 1;
 module_param(delay_use, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
 
@@ -434,7 +434,8 @@ static void adjust_quirks(struct us_data *us)
        u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor);
        u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
        unsigned f = 0;
-       unsigned int mask = (US_FL_SANE_SENSE | US_FL_FIX_CAPACITY |
+       unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE |
+                       US_FL_FIX_CAPACITY |
                        US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
                        US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
                        US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
index e4e4d433b00701a16bac2255bd54a1a10b928188..9ee67d6da7101f1d3b0f714553792f60015b4c02 100644 (file)
@@ -1931,22 +1931,22 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
                         * PowerMac2,2 summer 2000 iMacs
                         * PowerMac4,1 january 2001 iMacs "flower power"
                         */
-                       if (machine_is_compatible("PowerMac2,1") ||
-                           machine_is_compatible("PowerMac2,2") ||
-                           machine_is_compatible("PowerMac4,1"))
+                       if (of_machine_is_compatible("PowerMac2,1") ||
+                           of_machine_is_compatible("PowerMac2,2") ||
+                           of_machine_is_compatible("PowerMac4,1"))
                                default_vmode = VMODE_1024_768_75;
 
                        /* iBook SE */
-                       if (machine_is_compatible("PowerBook2,2"))
+                       if (of_machine_is_compatible("PowerBook2,2"))
                                default_vmode = VMODE_800_600_60;
 
                        /* PowerBook Firewire (Pismo), iBook Dual USB */
-                       if (machine_is_compatible("PowerBook3,1") ||
-                           machine_is_compatible("PowerBook4,1"))
+                       if (of_machine_is_compatible("PowerBook3,1") ||
+                           of_machine_is_compatible("PowerBook4,1"))
                                default_vmode = VMODE_1024_768_60;
 
                        /* PowerBook Titanium */
-                       if (machine_is_compatible("PowerBook3,2"))
+                       if (of_machine_is_compatible("PowerBook3,2"))
                                default_vmode = VMODE_1152_768_60;
        
                        if (default_cmode > 16) 
index 1ddeb4c34763a3db66b6f2e3c863ff56747c300e..e45ab8db2ddc6f7f46d98ff09504dcc8c45ff2e6 100644 (file)
@@ -2439,7 +2439,7 @@ static int __devinit aty_init(struct fb_info *info)
         * The Apple iBook1 uses non-standard memory frequencies.
         * We detect it and set the frequency manually.
         */
-       if (machine_is_compatible("PowerBook2,1")) {
+       if (of_machine_is_compatible("PowerBook2,1")) {
                par->pll_limits.mclk = 70;
                par->pll_limits.xclk = 53;
        }
@@ -2659,7 +2659,7 @@ static int __devinit aty_init(struct fb_info *info)
                      FBINFO_HWACCEL_YPAN;
 
 #ifdef CONFIG_PMAC_BACKLIGHT
-       if (M64_HAS(G3_PB_1_1) && machine_is_compatible("PowerBook1,1")) {
+       if (M64_HAS(G3_PB_1_1) && of_machine_is_compatible("PowerBook1,1")) {
                /*
                 * these bits let the 101 powerbook
                 * wake up from sleep -- paulus
@@ -2690,9 +2690,9 @@ static int __devinit aty_init(struct fb_info *info)
                                if (M64_HAS(G3_PB_1024x768))
                                        /* G3 PowerBook with 1024x768 LCD */
                                        default_vmode = VMODE_1024_768_60;
-                               else if (machine_is_compatible("iMac"))
+                               else if (of_machine_is_compatible("iMac"))
                                        default_vmode = VMODE_1024_768_75;
-                               else if (machine_is_compatible("PowerBook2,1"))
+                               else if (of_machine_is_compatible("PowerBook2,1"))
                                        /* iBook with 800x600 LCD */
                                        default_vmode = VMODE_800_600_60;
                                else
@@ -3104,7 +3104,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
        }
 
        dp = pci_device_to_OF_node(pdev);
-       if (node == dp->node) {
+       if (node == dp->phandle) {
                struct fb_var_screeninfo *var = &default_var;
                unsigned int N, P, Q, M, T, R;
                u32 v_total, h_total;
index 1a056adb61c836784fce99d1c0314e710f4948e8..fa1198c4ccc5d0041072b5ca95913134e3531ee3 100644 (file)
@@ -175,9 +175,9 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
 
 #ifdef CONFIG_PMAC_BACKLIGHT
        pdata->negative = pdata->negative ||
-               machine_is_compatible("PowerBook4,3") ||
-               machine_is_compatible("PowerBook6,3") ||
-               machine_is_compatible("PowerBook6,5");
+               of_machine_is_compatible("PowerBook4,3") ||
+               of_machine_is_compatible("PowerBook6,3") ||
+               of_machine_is_compatible("PowerBook6,5");
 #endif
 
        rinfo->info->bl_dev = bd;
index eb12182b20598861937b46496b8716efcae1e366..d25df51bb0d2b3160efe478fb4e64f968014ea04 100644 (file)
@@ -161,8 +161,17 @@ static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
        return 0;
 }
 
+static void efifb_destroy(struct fb_info *info)
+{
+       if (info->screen_base)
+               iounmap(info->screen_base);
+       release_mem_region(info->aperture_base, info->aperture_size);
+       framebuffer_release(info);
+}
+
 static struct fb_ops efifb_ops = {
        .owner          = THIS_MODULE,
+       .fb_destroy     = efifb_destroy,
        .fb_setcolreg   = efifb_setcolreg,
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
@@ -281,7 +290,7 @@ static int __init efifb_probe(struct platform_device *dev)
        info->par = NULL;
 
        info->aperture_base = efifb_fix.smem_start;
-       info->aperture_size = size_total;
+       info->aperture_size = size_remap;
 
        info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len);
        if (!info->screen_base) {
index 72d68b3dc478ec4292b6eef69025de3d25a43a52..4637bcbe03a4bcd462a86c52c34338e26f003e46 100644 (file)
@@ -1633,6 +1633,11 @@ static int __init fsl_diu_setup(char *options)
 #endif
 
 static struct of_device_id fsl_diu_match[] = {
+#ifdef CONFIG_PPC_MPC512x
+       {
+               .compatible = "fsl,mpc5121-diu",
+       },
+#endif
        {
                .compatible = "fsl,diu",
        },
index 66358fa825f3888b763a4e513fece8869c6f602f..b4b6deceed153ae1b11bab3384249113359ec2c0 100644 (file)
@@ -593,7 +593,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
  */
 static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
 {
-       struct imxfb_info *fbi = platform_get_drvdata(dev);
+       struct fb_info *info = platform_get_drvdata(dev);
+       struct imxfb_info *fbi = info->par;
 
        pr_debug("%s\n", __func__);
 
@@ -603,7 +604,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
 
 static int imxfb_resume(struct platform_device *dev)
 {
-       struct imxfb_info *fbi = platform_get_drvdata(dev);
+       struct fb_info *info = platform_get_drvdata(dev);
+       struct imxfb_info *fbi = info->par;
 
        pr_debug("%s\n", __func__);
 
index d66887e8cbb177c6bec6512066de84617be56d15..43207cc6cc1953099b2804717e173e47ad7e27f1 100644 (file)
@@ -1,29 +1,33 @@
-/* macfb.c: Generic framebuffer for Macs whose colourmaps/modes we
-   don't know how to set */
-
-/* (c) 1999 David Huggins-Daines <dhd@debian.org>
-
-   Primarily based on vesafb.c, by Gerd Knorr
-   (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
-
-   Also uses information and code from:
-   
-   The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen
-   Mellinger, Mikael Forselius, Michael Schmitz, and others.
-
-   valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan
-   Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven.
-   
-   This code is free software.  You may copy, modify, and distribute
-   it subject to the terms and conditions of the GNU General Public
-   License, version 2, or any later version, at your convenience. */
+/*
+ * macfb.c: Generic framebuffer for Macs whose colourmaps/modes we
+ * don't know how to set.
+ *
+ * (c) 1999 David Huggins-Daines <dhd@debian.org>
+ *
+ * Primarily based on vesafb.c, by Gerd Knorr
+ * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
+ *
+ * Also uses information and code from:
+ *
+ * The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen
+ * Mellinger, Mikael Forselius, Michael Schmitz, and others.
+ *
+ * valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan
+ * Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven.
+ *
+ * The VideoToolbox "Bugs" web page at
+ * http://rajsky.psych.nyu.edu/Tips/VideoBugs.html
+ *
+ * This code is free software.  You may copy, modify, and distribute
+ * it subject to the terms and conditions of the GNU General Public
+ * License, version 2, or any later version, at your convenience.
+ */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/nubus.h>
 #include <linux/init.h>
@@ -31,9 +35,6 @@
 
 #include <asm/setup.h>
 #include <asm/bootinfo.h>
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/irq.h>
 #include <asm/macintosh.h>
 #include <asm/io.h>
 
@@ -44,7 +45,7 @@
 #define DAFB_BASE 0xf9800200
 
 /* Address for the built-in Civic framebuffer in Quadra AVs */
-#define CIVIC_BASE 0x50f30800  /* Only tested on 660AV! */
+#define CIVIC_BASE 0x50f30800
 
 /* GSC (Gray Scale Controller) base address */
 #define GSC_BASE 0x50F20000
 /* CSC (Color Screen Controller) base address */
 #define CSC_BASE 0x50F20000
 
-static int (*macfb_setpalette) (unsigned int regno, unsigned int red,
-                               unsigned int green, unsigned int blue,
-                               struct fb_info *info) = NULL;
-static int valkyrie_setpalette (unsigned int regno, unsigned int red,
-                               unsigned int green, unsigned int blue,
-                               struct fb_info *info);
-static int dafb_setpalette (unsigned int regno, unsigned int red,
-                           unsigned int green, unsigned int blue,
-                           struct fb_info *fb_info);
-static int rbv_setpalette (unsigned int regno, unsigned int red,
-                          unsigned int green, unsigned int blue,
-                          struct fb_info *fb_info);
-static int mdc_setpalette (unsigned int regno, unsigned int red,
-                          unsigned int green, unsigned int blue,
-                          struct fb_info *fb_info);
-static int toby_setpalette (unsigned int regno, unsigned int red,
-                           unsigned int green, unsigned int blue,
-                           struct fb_info *fb_info);
-static int civic_setpalette (unsigned int regno, unsigned int red,
-                            unsigned int green, unsigned int blue,
-                            struct fb_info *fb_info);
-static int csc_setpalette (unsigned int regno, unsigned int red,
-                          unsigned int green, unsigned int blue,
-                          struct fb_info *fb_info);
-
-static struct {
-       unsigned char addr;
-       /* Note: word-aligned */
-       char pad[3];
-       unsigned char lut;
-} __iomem *valkyrie_cmap_regs;
+static int (*macfb_setpalette)(unsigned int regno, unsigned int red,
+                              unsigned int green, unsigned int blue,
+                              struct fb_info *info);
 
 static struct {
        unsigned char addr;
@@ -116,15 +89,15 @@ static struct {
 } __iomem *civic_cmap_regs;
 
 static struct {
-       char    pad1[0x40];
-        unsigned char  clut_waddr;     /* 0x40 */
-        char    pad2;
-        unsigned char  clut_data;      /* 0x42 */
-        char   pad3[0x3];
-        unsigned char  clut_raddr;     /* 0x46 */
+       char pad1[0x40];
+       unsigned char clut_waddr;       /* 0x40 */
+       char pad2;
+       unsigned char clut_data;        /* 0x42 */
+       char pad3[0x3];
+       unsigned char clut_raddr;       /* 0x46 */
 } __iomem *csc_cmap_regs;
 
-/* We will leave these the way they are for the time being */
+/* The registers in these structs are in NuBus slot space */
 struct mdc_cmap_regs {
        char pad1[0x200200];
        unsigned char addr;
@@ -145,13 +118,10 @@ struct jet_cmap_regs {
        unsigned char lut;
 };
 
-#define PIXEL_TO_MM(a) (((a)*10)/28)   /* width in mm at 72 dpi */     
-
-/* mode */
-static int  video_slot = 0;
+#define PIXEL_TO_MM(a) (((a)*10)/28)   /* width in mm at 72 dpi */
 
 static struct fb_var_screeninfo macfb_defined = {
-       .bits_per_pixel = 8,    
+       .bits_per_pixel = 8,
        .activate       = FB_ACTIVATE_NOW,
        .width          = -1,
        .height         = -1,
@@ -167,181 +137,152 @@ static struct fb_fix_screeninfo macfb_fix = {
        .accel  = FB_ACCEL_NONE,
 };
 
+static void *slot_addr;
 static struct fb_info fb_info;
 static u32 pseudo_palette[16];
-static int inverse   = 0;
-static int vidtest   = 0;
+static int inverse;
+static int vidtest;
 
-static int valkyrie_setpalette (unsigned int regno, unsigned int red,
-                               unsigned int green, unsigned int blue,
-                               struct fb_info *info)
-{
-       unsigned long flags;
-       
-       red >>= 8;
-       green >>= 8;
-       blue >>= 8;
-
-       local_irq_save(flags);
-       
-       /* tell clut which address to fill */
-       nubus_writeb(regno, &valkyrie_cmap_regs->addr);
-       nop();
-
-       /* send one color channel at a time */
-       nubus_writeb(red, &valkyrie_cmap_regs->lut);
-       nop();
-       nubus_writeb(green, &valkyrie_cmap_regs->lut);
-       nop();
-       nubus_writeb(blue, &valkyrie_cmap_regs->lut);
-
-       local_irq_restore(flags);
-       return 0;
-}
-
-/* Unlike the Valkyrie, the DAFB cannot set individual colormap
-   registers.  Therefore, we do what the MacOS driver does (no
-   kidding!) and simply set them one by one until we hit the one we
-   want. */
-static int dafb_setpalette (unsigned int regno, unsigned int red,
-                           unsigned int green, unsigned int blue,
-                           struct fb_info *info)
+/*
+ * Unlike the Valkyrie, the DAFB cannot set individual colormap
+ * registers.  Therefore, we do what the MacOS driver does (no
+ * kidding!) and simply set them one by one until we hit the one we
+ * want.
+ */
+static int dafb_setpalette(unsigned int regno, unsigned int red,
+                          unsigned int green, unsigned int blue,
+                          struct fb_info *info)
 {
-       /* FIXME: really, really need to use ioremap() here,
-           phys_to_virt() doesn't work anymore */
        static int lastreg = -1;
        unsigned long flags;
-       
-       red >>= 8;
-       green >>= 8;
-       blue >>= 8;
 
        local_irq_save(flags);
-       
-       /* fbdev will set an entire colourmap, but X won't.  Hopefully
-          this should accommodate both of them */
-       if (regno != lastreg+1) {
+
+       /*
+        * fbdev will set an entire colourmap, but X won't.  Hopefully
+        * this should accommodate both of them
+        */
+       if (regno != lastreg + 1) {
                int i;
-               
+
                /* Stab in the dark trying to reset the CLUT pointer */
                nubus_writel(0, &dafb_cmap_regs->reset);
                nop();
-               
+
                /* Loop until we get to the register we want */
                for (i = 0; i < regno; i++) {
-                       nubus_writeb(info->cmap.red[i] >> 8, &dafb_cmap_regs->lut);
+                       nubus_writeb(info->cmap.red[i] >> 8,
+                                    &dafb_cmap_regs->lut);
                        nop();
-                       nubus_writeb(info->cmap.green[i] >> 8, &dafb_cmap_regs->lut);
+                       nubus_writeb(info->cmap.green[i] >> 8,
+                                    &dafb_cmap_regs->lut);
                        nop();
-                       nubus_writeb(info->cmap.blue[i] >> 8, &dafb_cmap_regs->lut);
+                       nubus_writeb(info->cmap.blue[i] >> 8,
+                                    &dafb_cmap_regs->lut);
                        nop();
                }
        }
-               
+
        nubus_writeb(red, &dafb_cmap_regs->lut);
        nop();
        nubus_writeb(green, &dafb_cmap_regs->lut);
        nop();
        nubus_writeb(blue, &dafb_cmap_regs->lut);
-       
+
        local_irq_restore(flags);
        lastreg = regno;
        return 0;
 }
 
 /* V8 and Brazil seem to use the same DAC.  Sonora does as well. */
-static int v8_brazil_setpalette (unsigned int regno, unsigned int red,
-                                unsigned int green, unsigned int blue,
-                                struct fb_info *info)  
+static int v8_brazil_setpalette(unsigned int regno, unsigned int red,
+                               unsigned int green, unsigned int blue,
+                               struct fb_info *info)
 {
        unsigned int bpp = info->var.bits_per_pixel;
-       unsigned char _red  =red>>8;
-       unsigned char _green=green>>8;
-       unsigned char _blue =blue>>8;
-       unsigned char _regno;
        unsigned long flags;
 
-       if (bpp > 8) return 1; /* failsafe */
+       if (bpp > 8)
+               return 1; /* failsafe */
 
        local_irq_save(flags);
 
        /* On these chips, the CLUT register numbers are spread out
-          across the register space.  Thus:
-
-          In 8bpp, all regnos are valid.
-          
-          In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc
-          
-          In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff */
-       _regno = (regno << (8 - bpp)) | (0xFF >> bpp);
-       nubus_writeb(_regno, &v8_brazil_cmap_regs->addr); nop();
+        * across the register space.  Thus:
+        * In 8bpp, all regnos are valid.
+        * In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc
+        * In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff
+        */
+       regno = (regno << (8 - bpp)) | (0xFF >> bpp);
+       nubus_writeb(regno, &v8_brazil_cmap_regs->addr);
+       nop();
 
        /* send one color channel at a time */
-       nubus_writeb(_red, &v8_brazil_cmap_regs->lut); nop();
-       nubus_writeb(_green, &v8_brazil_cmap_regs->lut); nop();
-       nubus_writeb(_blue, &v8_brazil_cmap_regs->lut);
+       nubus_writeb(red, &v8_brazil_cmap_regs->lut);
+       nop();
+       nubus_writeb(green, &v8_brazil_cmap_regs->lut);
+       nop();
+       nubus_writeb(blue, &v8_brazil_cmap_regs->lut);
 
-       local_irq_restore(flags);       
+       local_irq_restore(flags);
        return 0;
 }
 
-static int rbv_setpalette (unsigned int regno, unsigned int red,
-                          unsigned int green, unsigned int blue,
-                          struct fb_info *info)
+/* RAM-Based Video */
+static int rbv_setpalette(unsigned int regno, unsigned int red,
+                         unsigned int green, unsigned int blue,
+                         struct fb_info *info)
 {
-       /* use MSBs */
-       unsigned char _red  =red>>8;
-       unsigned char _green=green>>8;
-       unsigned char _blue =blue>>8;
-       unsigned char _regno;
        unsigned long flags;
 
-       if (info->var.bits_per_pixel > 8) return 1; /* failsafe */
+       if (info->var.bits_per_pixel > 8)
+               return 1; /* failsafe */
 
        local_irq_save(flags);
-       
+
        /* From the VideoToolbox driver.  Seems to be saying that
         * regno #254 and #255 are the important ones for 1-bit color,
         * regno #252-255 are the important ones for 2-bit color, etc.
         */
-       _regno = regno + (256-(1 << info->var.bits_per_pixel));
+       regno += 256 - (1 << info->var.bits_per_pixel);
 
        /* reset clut? (VideoToolbox sez "not necessary") */
-       nubus_writeb(0xFF, &rbv_cmap_regs->cntl); nop();
-       
+       nubus_writeb(0xFF, &rbv_cmap_regs->cntl);
+       nop();
+
        /* tell clut which address to use. */
-       nubus_writeb(_regno, &rbv_cmap_regs->addr); nop();
-       
+       nubus_writeb(regno, &rbv_cmap_regs->addr);
+       nop();
+
        /* send one color channel at a time. */
-       nubus_writeb(_red,   &rbv_cmap_regs->lut); nop();
-       nubus_writeb(_green, &rbv_cmap_regs->lut); nop();
-       nubus_writeb(_blue,  &rbv_cmap_regs->lut);
-       
-       local_irq_restore(flags); /* done. */
+       nubus_writeb(red, &rbv_cmap_regs->lut);
+       nop();
+       nubus_writeb(green, &rbv_cmap_regs->lut);
+       nop();
+       nubus_writeb(blue, &rbv_cmap_regs->lut);
+
+       local_irq_restore(flags);
        return 0;
 }
 
-/* Macintosh Display Card (8x24) */
+/* Macintosh Display Card (8*24) */
 static int mdc_setpalette(unsigned int regno, unsigned int red,
                          unsigned int green, unsigned int blue,
                          struct fb_info *info)
 {
-       volatile struct mdc_cmap_regs *cmap_regs =
-               nubus_slot_addr(video_slot);
-       /* use MSBs */
-       unsigned char _red  =red>>8;
-       unsigned char _green=green>>8;
-       unsigned char _blue =blue>>8;
-       unsigned char _regno=regno;
+       struct mdc_cmap_regs *cmap_regs = slot_addr;
        unsigned long flags;
 
        local_irq_save(flags);
-       
+
        /* the nop's are there to order writes. */
-       nubus_writeb(_regno, &cmap_regs->addr); nop();
-       nubus_writeb(_red, &cmap_regs->lut);    nop();
-       nubus_writeb(_green, &cmap_regs->lut);  nop();
-       nubus_writeb(_blue, &cmap_regs->lut);
+       nubus_writeb(regno, &cmap_regs->addr);
+       nop();
+       nubus_writeb(red, &cmap_regs->lut);
+       nop();
+       nubus_writeb(green, &cmap_regs->lut);
+       nop();
+       nubus_writeb(blue, &cmap_regs->lut);
 
        local_irq_restore(flags);
        return 0;
@@ -350,24 +291,26 @@ static int mdc_setpalette(unsigned int regno, unsigned int red,
 /* Toby frame buffer */
 static int toby_setpalette(unsigned int regno, unsigned int red,
                           unsigned int green, unsigned int blue,
-                          struct fb_info *info) 
+                          struct fb_info *info)
 {
-       volatile struct toby_cmap_regs *cmap_regs =
-               nubus_slot_addr(video_slot);
+       struct toby_cmap_regs *cmap_regs = slot_addr;
        unsigned int bpp = info->var.bits_per_pixel;
-       /* use MSBs */
-       unsigned char _red  =~(red>>8);
-       unsigned char _green=~(green>>8);
-       unsigned char _blue =~(blue>>8);
-       unsigned char _regno = (regno << (8 - bpp)) | (0xFF >> bpp);
        unsigned long flags;
 
+       red = ~red;
+       green = ~green;
+       blue = ~blue;
+       regno = (regno << (8 - bpp)) | (0xFF >> bpp);
+
        local_irq_save(flags);
-               
-       nubus_writeb(_regno, &cmap_regs->addr); nop();
-       nubus_writeb(_red, &cmap_regs->lut);    nop();
-       nubus_writeb(_green, &cmap_regs->lut);  nop();
-       nubus_writeb(_blue, &cmap_regs->lut);
+
+       nubus_writeb(regno, &cmap_regs->addr);
+       nop();
+       nubus_writeb(red, &cmap_regs->lut);
+       nop();
+       nubus_writeb(green, &cmap_regs->lut);
+       nop();
+       nubus_writeb(blue, &cmap_regs->lut);
 
        local_irq_restore(flags);
        return 0;
@@ -378,20 +321,18 @@ static int jet_setpalette(unsigned int regno, unsigned int red,
                          unsigned int green, unsigned int blue,
                          struct fb_info *info)
 {
-       volatile struct jet_cmap_regs *cmap_regs =
-               nubus_slot_addr(video_slot);
-       /* use MSBs */
-       unsigned char _red   = (red>>8);
-       unsigned char _green = (green>>8);
-       unsigned char _blue  = (blue>>8);
+       struct jet_cmap_regs *cmap_regs = slot_addr;
        unsigned long flags;
 
        local_irq_save(flags);
-       
-       nubus_writeb(regno, &cmap_regs->addr); nop();
-       nubus_writeb(_red, &cmap_regs->lut); nop();
-       nubus_writeb(_green, &cmap_regs->lut); nop();
-       nubus_writeb(_blue, &cmap_regs->lut);
+
+       nubus_writeb(regno, &cmap_regs->addr);
+       nop();
+       nubus_writeb(red, &cmap_regs->lut);
+       nop();
+       nubus_writeb(green, &cmap_regs->lut);
+       nop();
+       nubus_writeb(blue, &cmap_regs->lut);
 
        local_irq_restore(flags);
        return 0;
@@ -400,53 +341,27 @@ static int jet_setpalette(unsigned int regno, unsigned int red,
 /*
  * Civic framebuffer -- Quadra AV built-in video.  A chip
  * called Sebastian holds the actual color palettes, and
- * apparently, there are two different banks of 512K RAM 
+ * apparently, there are two different banks of 512K RAM
  * which can act as separate framebuffers for doing video
  * input and viewing the screen at the same time!  The 840AV
- * Can add another 1MB RAM to give the two framebuffers 
+ * Can add another 1MB RAM to give the two framebuffers
  * 1MB RAM apiece.
- *
- * FIXME: this doesn't seem to work anymore.
  */
-static int civic_setpalette (unsigned int regno, unsigned int red,
-                            unsigned int green, unsigned int blue,
-                            struct fb_info *info)
+static int civic_setpalette(unsigned int regno, unsigned int red,
+                           unsigned int green, unsigned int blue,
+                           struct fb_info *info)
 {
-       static int lastreg = -1;
        unsigned long flags;
        int clut_status;
        
-       if (info->var.bits_per_pixel > 8) return 1; /* failsafe */
-
-       red   >>= 8;
-       green >>= 8;
-       blue  >>= 8;
+       if (info->var.bits_per_pixel > 8)
+               return 1; /* failsafe */
 
        local_irq_save(flags);
-       
-       /*
-        * Set the register address
-        */
-       nubus_writeb(regno, &civic_cmap_regs->addr); nop();
 
-       /*
-        * Wait for VBL interrupt here;
-        * They're usually not enabled from Penguin, so we won't check
-        */
-#if 0
-       {
-#define CIVIC_VBL_OFFSET       0x120
-               volatile unsigned long *vbl = nubus_readl(civic_cmap_regs->vbl_addr + CIVIC_VBL_OFFSET);
-               /* do interrupt setup stuff here? */
-               *vbl = 0L; nop();       /* clear */
-               *vbl = 1L; nop();       /* set */
-               while (*vbl != 0L)      /* wait for next vbl */
-               {
-                       usleep(10);     /* needed? */
-               }
-               /* do interrupt shutdown stuff here? */
-       }
-#endif
+       /* Set the register address */
+       nubus_writeb(regno, &civic_cmap_regs->addr);
+       nop();
 
        /*
         * Grab a status word and do some checking;
@@ -459,39 +374,52 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
 #if 0
                if ((clut_status & 0x000D) != 0)
                {
-                       nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
-                       nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
+                       nubus_writeb(0x00, &civic_cmap_regs->lut);
+                       nop();
+                       nubus_writeb(0x00, &civic_cmap_regs->lut);
+                       nop();
                }
 #endif
 
-               nubus_writeb(  red, &civic_cmap_regs->lut); nop();
-               nubus_writeb(green, &civic_cmap_regs->lut); nop();
-               nubus_writeb( blue, &civic_cmap_regs->lut); nop();
-               nubus_writeb( 0x00, &civic_cmap_regs->lut); nop();
+               nubus_writeb(red, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(green, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(blue, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(0x00, &civic_cmap_regs->lut);
        }
        else
        {
                unsigned char junk;
 
-               junk = nubus_readb(&civic_cmap_regs->lut); nop();
-               junk = nubus_readb(&civic_cmap_regs->lut); nop();
-               junk = nubus_readb(&civic_cmap_regs->lut); nop();
-               junk = nubus_readb(&civic_cmap_regs->lut); nop();
+               junk = nubus_readb(&civic_cmap_regs->lut);
+               nop();
+               junk = nubus_readb(&civic_cmap_regs->lut);
+               nop();
+               junk = nubus_readb(&civic_cmap_regs->lut);
+               nop();
+               junk = nubus_readb(&civic_cmap_regs->lut);
+               nop();
 
                if ((clut_status & 0x000D) != 0)
                {
-                       nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
-                       nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
+                       nubus_writeb(0x00, &civic_cmap_regs->lut);
+                       nop();
+                       nubus_writeb(0x00, &civic_cmap_regs->lut);
+                       nop();
                }
 
-               nubus_writeb(  red, &civic_cmap_regs->lut); nop();
-               nubus_writeb(green, &civic_cmap_regs->lut); nop();
-               nubus_writeb( blue, &civic_cmap_regs->lut); nop();
-               nubus_writeb( junk, &civic_cmap_regs->lut); nop();
+               nubus_writeb(red, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(green, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(blue, &civic_cmap_regs->lut);
+               nop();
+               nubus_writeb(junk, &civic_cmap_regs->lut);
        }
 
        local_irq_restore(flags);
-       lastreg = regno;
        return 0;
 }
 
@@ -500,16 +428,21 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
  * (and the 5300 too, but that's a PowerMac). This function
  * brought to you in part by the ECSC driver for MkLinux.
  */
-
-static int csc_setpalette (unsigned int regno, unsigned int red,
-                          unsigned int green, unsigned int blue,
-                          struct fb_info *info)
+static int csc_setpalette(unsigned int regno, unsigned int red,
+                         unsigned int green, unsigned int blue,
+                         struct fb_info *info)
 {
-       mdelay(1);
+       unsigned long flags;
+
+       local_irq_save(flags);
+
+       udelay(1); /* mklinux on PB 5300 waits for 260 ns */
        nubus_writeb(regno, &csc_cmap_regs->clut_waddr);
-       nubus_writeb(red,   &csc_cmap_regs->clut_data);
+       nubus_writeb(red, &csc_cmap_regs->clut_data);
        nubus_writeb(green, &csc_cmap_regs->clut_data);
-       nubus_writeb(blue,  &csc_cmap_regs->clut_data);
+       nubus_writeb(blue, &csc_cmap_regs->clut_data);
+
+       local_irq_restore(flags);
        return 0;
 }
 
@@ -518,10 +451,10 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
                           struct fb_info *fb_info)
 {
        /*
-        *  Set a single color register. The values supplied are
-        *  already rounded down to the hardware's capabilities
-        *  (according to the entries in the `var' structure). Return
-        *  != 0 for invalid regno.
+        * Set a single color register. The values supplied are
+        * already rounded down to the hardware's capabilities
+        * (according to the entries in the `var' structure).
+        * Return non-zero for invalid regno.
         */
        
        if (regno >= fb_info->cmap.len)
@@ -536,8 +469,8 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
                case 4:
                case 8:
                        if (macfb_setpalette)
-                               macfb_setpalette(regno, red, green, blue,
-                                                fb_info);
+                               macfb_setpalette(regno, red >> 8, green >> 8,
+                                                blue >> 8, fb_info);
                        else
                                return 1;
                        break;
@@ -555,28 +488,22 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
                        } else {
                                /* 0:5:6:5 */
                                ((u32*) (fb_info->pseudo_palette))[regno] =
-                                       ((red   & 0xf800)      ) |
+                                       ((red   & 0xf800) >>  0) |
                                        ((green & 0xfc00) >>  5) |
                                        ((blue  & 0xf800) >> 11);
                        }
                        break;
-                       /* I'm pretty sure that one or the other of these
-                          doesn't exist on 68k Macs */
+               /*
+                * 24-bit colour almost doesn't exist on 68k Macs --
+                * http://support.apple.com/kb/TA28634 (Old Article: 10992)
+                */
                case 24:
-                       red   >>= 8;
-                       green >>= 8;
-                       blue  >>= 8;
-                       ((u32 *)(fb_info->pseudo_palette))[regno] =
-                               (red   << fb_info->var.red.offset)   |
-                               (green << fb_info->var.green.offset) |
-                               (blue  << fb_info->var.blue.offset);
-                       break;
                case 32:
                        red   >>= 8;
                        green >>= 8;
                        blue  >>= 8;
                        ((u32 *)(fb_info->pseudo_palette))[regno] =
-                               (red   << fb_info->var.red.offset)   |
+                               (red   << fb_info->var.red.offset) |
                                (green << fb_info->var.green.offset) |
                                (blue  << fb_info->var.blue.offset);
                        break;
@@ -597,25 +524,24 @@ static struct fb_ops macfb_ops = {
 static void __init macfb_setup(char *options)
 {
        char *this_opt;
-       
+
        if (!options || !*options)
                return;
-       
+
        while ((this_opt = strsep(&options, ",")) != NULL) {
-               if (!*this_opt) continue;
-               
-               if (! strcmp(this_opt, "inverse"))
-                       inverse=1;
-               /* This means "turn on experimental CLUT code" */
-               else if (!strcmp(this_opt, "vidtest"))
-                       vidtest=1;
+               if (!*this_opt)
+                       continue;
+
+               if (!strcmp(this_opt, "inverse"))
+                       inverse = 1;
+               else
+                       if (!strcmp(this_opt, "vidtest"))
+                               vidtest = 1; /* enable experimental CLUT code */
        }
 }
 
 static void __init iounmap_macfb(void)
 {
-       if (valkyrie_cmap_regs)
-               iounmap(valkyrie_cmap_regs);
        if (dafb_cmap_regs)
                iounmap(dafb_cmap_regs);
        if (v8_brazil_cmap_regs)
@@ -642,48 +568,55 @@ static int __init macfb_init(void)
        if (!MACH_IS_MAC) 
                return -ENODEV;
 
-       /* There can only be one internal video controller anyway so
-          we're not too worried about this */
+       if (mac_bi_data.id == MAC_MODEL_Q630 ||
+           mac_bi_data.id == MAC_MODEL_P588)
+               return -ENODEV; /* See valkyriefb.c */
+
        macfb_defined.xres = mac_bi_data.dimensions & 0xFFFF;
        macfb_defined.yres = mac_bi_data.dimensions >> 16;
        macfb_defined.bits_per_pixel = mac_bi_data.videodepth;
+
        macfb_fix.line_length = mac_bi_data.videorow;
-       macfb_fix.smem_len = macfb_fix.line_length * macfb_defined.yres;
+       macfb_fix.smem_len    = macfb_fix.line_length * macfb_defined.yres;
        /* Note: physical address (since 2.1.127) */
-       macfb_fix.smem_start = mac_bi_data.videoaddr;
-       /* This is actually redundant with the initial mappings.
-          However, there are some non-obvious aspects to the way
-          those mappings are set up, so this is in fact the safest
-          way to ensure that this driver will work on every possible
-          Mac */
-       fb_info.screen_base = ioremap(mac_bi_data.videoaddr, macfb_fix.smem_len);
-       
-       printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
-              macfb_fix.smem_start, fb_info.screen_base, macfb_fix.smem_len/1024);
-       printk("macfb: mode is %dx%dx%d, linelength=%d\n",
-              macfb_defined.xres, macfb_defined.yres, macfb_defined.bits_per_pixel, macfb_fix.line_length);
-       
+       macfb_fix.smem_start  = mac_bi_data.videoaddr;
+
        /*
-        *      Fill in the available video resolution
+        * This is actually redundant with the initial mappings.
+        * However, there are some non-obvious aspects to the way
+        * those mappings are set up, so this is in fact the safest
+        * way to ensure that this driver will work on every possible Mac
         */
-        
-       macfb_defined.xres_virtual   = macfb_defined.xres;
-       macfb_defined.yres_virtual   = macfb_defined.yres;
-       macfb_defined.height = PIXEL_TO_MM(macfb_defined.yres);
-       macfb_defined.width  = PIXEL_TO_MM(macfb_defined.xres);  
+       fb_info.screen_base = ioremap(mac_bi_data.videoaddr,
+                                     macfb_fix.smem_len);
+       if (!fb_info.screen_base)
+               return -ENODEV;
 
-       printk("macfb: scrolling: redraw\n");
+       printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
+              macfb_fix.smem_start, fb_info.screen_base,
+              macfb_fix.smem_len / 1024);
+       printk("macfb: mode is %dx%dx%d, linelength=%d\n",
+              macfb_defined.xres, macfb_defined.yres,
+              macfb_defined.bits_per_pixel, macfb_fix.line_length);
+
+       /* Fill in the available video resolution */
+       macfb_defined.xres_virtual = macfb_defined.xres;
        macfb_defined.yres_virtual = macfb_defined.yres;
+       macfb_defined.height       = PIXEL_TO_MM(macfb_defined.yres);
+       macfb_defined.width        = PIXEL_TO_MM(macfb_defined.xres);
 
-       /* some dummy values for timing to make fbset happy */
-       macfb_defined.pixclock     = 10000000 / macfb_defined.xres * 1000 / macfb_defined.yres;
+       /* Some dummy values for timing to make fbset happy */
+       macfb_defined.pixclock     = 10000000 / macfb_defined.xres *
+                                    1000 / macfb_defined.yres;
        macfb_defined.left_margin  = (macfb_defined.xres / 8) & 0xf8;
        macfb_defined.hsync_len    = (macfb_defined.xres / 8) & 0xf8;
 
        switch (macfb_defined.bits_per_pixel) {
        case 1:
-               /* XXX: I think this will catch any program that tries
-                  to do FBIO_PUTCMAP when the visual is monochrome */
+               /*
+                * XXX: I think this will catch any program that tries
+                * to do FBIO_PUTCMAP when the visual is monochrome.
+                */
                macfb_defined.red.length = macfb_defined.bits_per_pixel;
                macfb_defined.green.length = macfb_defined.bits_per_pixel;
                macfb_defined.blue.length = macfb_defined.bits_per_pixel;
@@ -708,53 +641,52 @@ static int __init macfb_init(void)
                macfb_defined.green.length = 5;
                macfb_defined.blue.offset = 0;
                macfb_defined.blue.length = 5;
-               printk("macfb: directcolor: "
-                      "size=1:5:5:5, shift=15:10:5:0\n");
                video_cmap_len = 16;
-               /* Should actually be FB_VISUAL_DIRECTCOLOR, but this
-                  works too */
+               /*
+                * Should actually be FB_VISUAL_DIRECTCOLOR, but this
+                * works too
+                */
                macfb_fix.visual = FB_VISUAL_TRUECOLOR;
                break;
        case 24:
        case 32:
-               /* XXX: have to test these... can any 68k Macs
-                  actually do this on internal video? */
                macfb_defined.red.offset = 16;
                macfb_defined.red.length = 8;
                macfb_defined.green.offset = 8;
                macfb_defined.green.length = 8;
                macfb_defined.blue.offset = 0;
                macfb_defined.blue.length = 8;
-               printk("macfb: truecolor: "
-                      "size=0:8:8:8, shift=0:16:8:0\n");
                video_cmap_len = 16;
                macfb_fix.visual = FB_VISUAL_TRUECOLOR;
+               break;
        default:
                video_cmap_len = 0;
                macfb_fix.visual = FB_VISUAL_MONO01;
-               printk("macfb: unknown or unsupported bit depth: %d\n", macfb_defined.bits_per_pixel);
+               printk("macfb: unknown or unsupported bit depth: %d\n",
+                      macfb_defined.bits_per_pixel);
                break;
        }
        
-       /* Hardware dependent stuff */
-       /*  We take a wild guess that if the video physical address is
-        *  in nubus slot space, that the nubus card is driving video.
-        *  Penguin really ought to tell us whether we are using internal
-        *  video or not.
+       /*
+        * We take a wild guess that if the video physical address is
+        * in nubus slot space, that the nubus card is driving video.
+        * Penguin really ought to tell us whether we are using internal
+        * video or not.
+        * Hopefully we only find one of them.  Otherwise our NuBus
+        * code is really broken :-)
         */
-       /* Hopefully we only find one of them.  Otherwise our NuBus
-           code is really broken :-) */
 
-       while ((ndev = nubus_find_type(NUBUS_CAT_DISPLAY, NUBUS_TYPE_VIDEO, ndev))
-               != NULL)
+       while ((ndev = nubus_find_type(NUBUS_CAT_DISPLAY,
+                                      NUBUS_TYPE_VIDEO, ndev)))
        {
-               if (!(mac_bi_data.videoaddr >= ndev->board->slot_addr
-                     && (mac_bi_data.videoaddr <
-                         (unsigned long)nubus_slot_addr(ndev->board->slot+1))))
+               unsigned long base = ndev->board->slot_addr;
+
+               if (mac_bi_data.videoaddr < base ||
+                   mac_bi_data.videoaddr - base > 0xFFFFFF)
                        continue;
+
                video_is_nubus = 1;
-               /* We should probably just use the slot address... */
-               video_slot = ndev->board->slot;
+               slot_addr = (unsigned char *)base;
 
                switch(ndev->dr_hw) {
                case NUBUS_DRHW_APPLE_MDC:
@@ -771,7 +703,7 @@ static int __init macfb_init(void)
                        strcpy(macfb_fix.id, "Jet");
                        macfb_setpalette = jet_setpalette;
                        macfb_defined.activate = FB_ACTIVATE_NOW;
-                       break;                  
+                       break;
                default:
                        strcpy(macfb_fix.id, "Generic NuBus");
                        break;
@@ -779,30 +711,19 @@ static int __init macfb_init(void)
        }
 
        /* If it's not a NuBus card, it must be internal video */
-       /* FIXME: this function is getting way too big.  (this driver
-           is too...) */
        if (!video_is_nubus)
-               switch( mac_bi_data.id )
-               {
-                       /* Valkyrie Quadras */
-               case MAC_MODEL_Q630:
-                       /* I'm not sure about this one */
-               case MAC_MODEL_P588:
-                       strcpy(macfb_fix.id, "Valkyrie");
-                       macfb_setpalette = valkyrie_setpalette;
-                       macfb_defined.activate = FB_ACTIVATE_NOW;
-                       valkyrie_cmap_regs = ioremap(DAC_BASE, 0x1000);
-                       break;
-
-                       /* DAFB Quadras */
-                       /* Note: these first four have the v7 DAFB, which is
-                          known to be rather unlike the ones used in the
-                          other models */
+               switch (mac_bi_data.id) {
+               /*
+                * DAFB Quadras
+                * Note: these first four have the v7 DAFB, which is
+                * known to be rather unlike the ones used in the
+                * other models
+                */
                case MAC_MODEL_P475:
                case MAC_MODEL_P475F:
                case MAC_MODEL_P575:
                case MAC_MODEL_Q605:
-       
+
                case MAC_MODEL_Q800:
                case MAC_MODEL_Q650:
                case MAC_MODEL_Q610:
@@ -817,17 +738,21 @@ static int __init macfb_init(void)
                        dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
                        break;
 
-                       /* LC II uses the V8 framebuffer */
+               /*
+                * LC II uses the V8 framebuffer
+                */
                case MAC_MODEL_LCII:
                        strcpy(macfb_fix.id, "V8");
                        macfb_setpalette = v8_brazil_setpalette;
                        macfb_defined.activate = FB_ACTIVATE_NOW;
                        v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
                        break;
-               
-                       /* IIvi, IIvx use the "Brazil" framebuffer (which is
-                          very much like the V8, it seems, and probably uses
-                          the same DAC) */
+
+               /*
+                * IIvi, IIvx use the "Brazil" framebuffer (which is
+                * very much like the V8, it seems, and probably uses
+                * the same DAC)
+                */
                case MAC_MODEL_IIVI:
                case MAC_MODEL_IIVX:
                case MAC_MODEL_P600:
@@ -836,12 +761,14 @@ static int __init macfb_init(void)
                        macfb_defined.activate = FB_ACTIVATE_NOW;
                        v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
                        break;
-               
-                       /* LC III (and friends) use the Sonora framebuffer */
-                       /* Incidentally this is also used in the non-AV models
-                          of the x100 PowerMacs */
-                       /* These do in fact seem to use the same DAC interface
-                          as the LC II. */
+
+               /*
+                * LC III (and friends) use the Sonora framebuffer
+                * Incidentally this is also used in the non-AV models
+                * of the x100 PowerMacs
+                * These do in fact seem to use the same DAC interface
+                * as the LC II.
+                */
                case MAC_MODEL_LCIII:
                case MAC_MODEL_P520:
                case MAC_MODEL_P550:
@@ -852,9 +779,11 @@ static int __init macfb_init(void)
                        v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
                        break;
 
-                       /* IIci and IIsi use the infamous RBV chip
-                           (the IIsi is just a rebadged and crippled
-                           IIci in a different case, BTW) */
+               /*
+                * IIci and IIsi use the infamous RBV chip
+                * (the IIsi is just a rebadged and crippled
+                * IIci in a different case, BTW)
+                */
                case MAC_MODEL_IICI:
                case MAC_MODEL_IISI:
                        macfb_setpalette = rbv_setpalette;
@@ -863,7 +792,9 @@ static int __init macfb_init(void)
                        rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
                        break;
 
-                       /* AVs use the Civic framebuffer */
+               /*
+                * AVs use the Civic framebuffer
+                */
                case MAC_MODEL_Q840:
                case MAC_MODEL_C660:
                        macfb_setpalette = civic_setpalette;
@@ -873,15 +804,10 @@ static int __init macfb_init(void)
                        break;
 
                
-                       /* Write a setpalette function for your machine, then
-                          you can add something similar here.  These are
-                          grouped by classes of video chipsets.  Some of this
-                          information is from the VideoToolbox "Bugs" web
-                          page at
-                          http://rajsky.psych.nyu.edu/Tips/VideoBugs.html */
-
-                       /* Assorted weirdos */
-                       /* We think this may be like the LC II */
+               /*
+                * Assorted weirdos
+                * We think this may be like the LC II
+                */
                case MAC_MODEL_LC:
                        if (vidtest) {
                                macfb_setpalette = v8_brazil_setpalette;
@@ -891,7 +817,10 @@ static int __init macfb_init(void)
                        }
                        strcpy(macfb_fix.id, "LC");
                        break;
-                       /* We think this may be like the LC II */
+
+               /*
+                * We think this may be like the LC II
+                */
                case MAC_MODEL_CCL:
                        if (vidtest) {
                                macfb_setpalette = v8_brazil_setpalette;
@@ -902,31 +831,42 @@ static int __init macfb_init(void)
                        strcpy(macfb_fix.id, "Color Classic");
                        break;
 
-                       /* And we *do* mean "weirdos" */
+               /*
+                * And we *do* mean "weirdos"
+                */
                case MAC_MODEL_TV:
                        strcpy(macfb_fix.id, "Mac TV");
                        break;
 
-                       /* These don't have colour, so no need to worry */
+               /*
+                * These don't have colour, so no need to worry
+                */
                case MAC_MODEL_SE30:
                case MAC_MODEL_CLII:
                        strcpy(macfb_fix.id, "Monochrome");
                        break;
 
-                       /* Powerbooks are particularly difficult.  Many of
-                          them have separate framebuffers for external and
-                          internal video, which is admittedly pretty cool,
-                          but will be a bit of a headache to support here.
-                          Also, many of them are grayscale, and we don't
-                          really support that. */
-
+               /*
+                * Powerbooks are particularly difficult.  Many of
+                * them have separate framebuffers for external and
+                * internal video, which is admittedly pretty cool,
+                * but will be a bit of a headache to support here.
+                * Also, many of them are grayscale, and we don't
+                * really support that.
+                */
+
+               /*
+                * Slot 0 ROM says TIM. No external video. B&W.
+                */
                case MAC_MODEL_PB140:
                case MAC_MODEL_PB145:
                case MAC_MODEL_PB170:
                        strcpy(macfb_fix.id, "DDC");
                        break;
 
-                       /* Internal is GSC, External (if present) is ViSC */
+               /*
+                * Internal is GSC, External (if present) is ViSC
+                */
                case MAC_MODEL_PB150:   /* no external video */
                case MAC_MODEL_PB160:
                case MAC_MODEL_PB165:
@@ -936,13 +876,17 @@ static int __init macfb_init(void)
                        strcpy(macfb_fix.id, "GSC");
                        break;
 
-                       /* Internal is TIM, External is ViSC */
+               /*
+                * Internal is TIM, External is ViSC
+                */
                case MAC_MODEL_PB165C:
                case MAC_MODEL_PB180C:
                        strcpy(macfb_fix.id, "TIM");
                        break;
 
-                       /* Internal is CSC, External is Keystone+Ariel. */
+               /*
+                * Internal is CSC, External is Keystone+Ariel.
+                */
                case MAC_MODEL_PB190:   /* external video is optional */
                case MAC_MODEL_PB520:
                case MAC_MODEL_PB250:
@@ -954,7 +898,7 @@ static int __init macfb_init(void)
                        strcpy(macfb_fix.id, "CSC");
                        csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
                        break;
-               
+
                default:
                        strcpy(macfb_fix.id, "Unknown");
                        break;
@@ -969,7 +913,7 @@ static int __init macfb_init(void)
        err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
        if (err)
                goto fail_unmap;
-       
+
        err = register_framebuffer(&fb_info);
        if (err)
                goto fail_dealloc;
index 083f60321ed857dca7c9e5632d770e930f6270bd..af86c081d2bebd73b9ea97e429b730881b75e824 100644 (file)
 
 static const struct fb_videomode mac_modedb[] = {
     {
+       /* 512x384, 60Hz, Non-Interlaced (15.67 MHz dot clock) */
+       "mac2", 60, 512, 384, 63828, 80, 16, 19, 1, 32, 3,
+       0, FB_VMODE_NONINTERLACED
+    }, {
        /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
        "mac5", 60, 640, 480, 39722, 32, 32, 33, 10, 96, 2,
        0, FB_VMODE_NONINTERLACED
@@ -40,6 +44,10 @@ static const struct fb_videomode mac_modedb[] = {
        /* 640x480, 67Hz, Non-Interlaced (30.0 MHz dotclock) */
        "mac6", 67, 640, 480, 33334, 80, 80, 39, 3, 64, 3,
        0, FB_VMODE_NONINTERLACED
+    }, {
+       /* 640x870, 75Hz (portrait), Non-Interlaced (57.28 MHz dot clock) */
+       "mac7", 75, 640, 870, 17457, 80, 32, 42, 3, 80, 3,
+       0, FB_VMODE_NONINTERLACED
     }, {
        /* 800x600, 56 Hz, Non-Interlaced (36.00 MHz dotclock) */
        "mac9", 56, 800, 600, 27778, 112, 40, 22, 1, 72, 2,
@@ -104,10 +112,6 @@ static const struct fb_videomode mac_modedb[] = {
        /* VMODE_512_384_60I: 512x384, 60Hz, Interlaced (NTSC) */
        "mac1", 60, 512, 384, pixclock, left, right, upper, lower, hslen, vslen,
        sync, FB_VMODE_INTERLACED
-    }, {
-       /* VMODE_512_384_60: 512x384, 60Hz, Non-Interlaced */
-       "mac2", 60, 512, 384, pixclock, left, right, upper, lower, hslen, vslen,
-       sync, FB_VMODE_NONINTERLACED
     }, {
        /* VMODE_640_480_50I: 640x480, 50Hz, Interlaced (PAL) */
        "mac3", 50, 640, 480, pixclock, left, right, upper, lower, hslen, vslen,
@@ -116,10 +120,6 @@ static const struct fb_videomode mac_modedb[] = {
        /* VMODE_640_480_60I: 640x480, 60Hz, Interlaced (NTSC) */
        "mac4", 60, 640, 480, pixclock, left, right, upper, lower, hslen, vslen,
        sync, FB_VMODE_INTERLACED
-    }, {
-       /* VMODE_640_870_75P: 640x870, 75Hz (portrait), Non-Interlaced */
-       "mac7", 75, 640, 870, pixclock, left, right, upper, lower, hslen, vslen,
-       sync, FB_VMODE_NONINTERLACED
     }, {
        /* VMODE_768_576_50I: 768x576, 50Hz (PAL full frame), Interlaced */
        "mac8", 50, 768, 576, pixclock, left, right, upper, lower, hslen, vslen,
@@ -134,38 +134,42 @@ static const struct fb_videomode mac_modedb[] = {
      *
      *  These MUST be ordered in
      *    - increasing resolution
-     *    - decreasing refresh rate
+     *    - decreasing pixel clock period
      */
 
 static const struct mode_map {
     int vmode;
     const struct fb_videomode *mode;
 } mac_modes[] = {
+    /* 512x384 */
+    { VMODE_512_384_60, &mac_modedb[0] },
     /* 640x480 */
-    { VMODE_640_480_67, &mac_modedb[1] },
-    { VMODE_640_480_60, &mac_modedb[0] },
+    { VMODE_640_480_60, &mac_modedb[1] },
+    { VMODE_640_480_67, &mac_modedb[2] },
+    /* 640x870 */
+    { VMODE_640_870_75P, &mac_modedb[3] },
     /* 800x600 */
-    { VMODE_800_600_75, &mac_modedb[5] },
-    { VMODE_800_600_72, &mac_modedb[4] },
-    { VMODE_800_600_60, &mac_modedb[3] },
-    { VMODE_800_600_56, &mac_modedb[2] },
+    { VMODE_800_600_56, &mac_modedb[4] },
+    { VMODE_800_600_60, &mac_modedb[5] },
+    { VMODE_800_600_75, &mac_modedb[7] },
+    { VMODE_800_600_72, &mac_modedb[6] },
     /* 832x624 */
-    { VMODE_832_624_75, &mac_modedb[6] },
+    { VMODE_832_624_75, &mac_modedb[8] },
     /* 1024x768 */
-    { VMODE_1024_768_75, &mac_modedb[10] },
-    { VMODE_1024_768_75V, &mac_modedb[9] },
-    { VMODE_1024_768_70, &mac_modedb[8] },
-    { VMODE_1024_768_60, &mac_modedb[7] },
+    { VMODE_1024_768_60, &mac_modedb[9] },
+    { VMODE_1024_768_70, &mac_modedb[10] },
+    { VMODE_1024_768_75V, &mac_modedb[11] },
+    { VMODE_1024_768_75, &mac_modedb[12] },
     /* 1152x768 */
-    { VMODE_1152_768_60, &mac_modedb[14] },
+    { VMODE_1152_768_60, &mac_modedb[16] },
     /* 1152x870 */
-    { VMODE_1152_870_75, &mac_modedb[11] },
+    { VMODE_1152_870_75, &mac_modedb[13] },
     /* 1280x960 */
-    { VMODE_1280_960_75, &mac_modedb[12] },
+    { VMODE_1280_960_75, &mac_modedb[14] },
     /* 1280x1024 */
-    { VMODE_1280_1024_75, &mac_modedb[13] },
+    { VMODE_1280_1024_75, &mac_modedb[15] },
     /* 1600x1024 */
-    { VMODE_1600_1024_60, &mac_modedb[15] },
+    { VMODE_1600_1024_60, &mac_modedb[17] },
     { -1, NULL }
 };
 
@@ -299,7 +303,6 @@ EXPORT_SYMBOL(mac_vmode_to_var);
 int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
                     int *cmode)
 {
-    const struct fb_videomode *mode = NULL;
     const struct mode_map *map;
 
     if (var->bits_per_pixel <= 8)
@@ -311,8 +314,13 @@ int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
     else
        return -EINVAL;
 
+    /*
+     * Find the mac_mode with a matching resolution or failing that, the
+     * closest larger resolution. Skip modes with a shorter pixel clock period.
+     */
     for (map = mac_modes; map->vmode != -1; map++) {
-       mode = map->mode;
+       const struct fb_videomode *mode = map->mode;
+
        if (var->xres > mode->xres || var->yres > mode->yres)
            continue;
        if (var->xres_virtual > mode->xres || var->yres_virtual > mode->yres)
@@ -322,6 +330,24 @@ int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
        if ((var->vmode & FB_VMODE_MASK) != mode->vmode)
            continue;
        *vmode = map->vmode;
+
+       /*
+        * Having found a good resolution, find the matching pixel clock
+        * or failing that, the closest longer pixel clock period.
+        */
+       map++;
+       while (map->vmode != -1) {
+           const struct fb_videomode *clk_mode = map->mode;
+
+           if (mode->xres != clk_mode->xres || mode->yres != clk_mode->yres)
+               break;
+           if (var->pixclock > mode->pixclock)
+               break;
+           if (mode->vmode != clk_mode->vmode)
+               continue;
+           *vmode = map->vmode;
+           map++;
+       }
        return 0;
     }
     return -EINVAL;
index 054ef29be4795dd75900b9b48e66db9494fbb725..772ba3f45e6f511d78bf2035046dd7829244277b 100644 (file)
@@ -324,8 +324,11 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi)
        unsigned long flags;
        dma_cookie_t cookie;
 
-       dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
-               to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
+       if (mx3_fbi->txd)
+               dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
+                       to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
+       else
+               dev_dbg(mx3fb->dev, "mx3fbi %p, txd = NULL\n", mx3_fbi);
 
        /* This enables the channel */
        if (mx3_fbi->cookie < 0) {
@@ -646,6 +649,7 @@ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t a
 
 static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value)
 {
+       dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value);
        /* This might be board-specific */
        mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL);
        return;
@@ -1486,12 +1490,12 @@ static int mx3fb_probe(struct platform_device *pdev)
                goto ersdc0;
        }
 
+       mx3fb->backlight_level = 255;
+
        ret = init_fb_chan(mx3fb, to_idmac_chan(chan));
        if (ret < 0)
                goto eisdc0;
 
-       mx3fb->backlight_level = 255;
-
        return 0;
 
 eisdc0:
index 53f8f1100e81c671cc63c10814467dcb1e0275d9..f9975100d56d3f311e812c71ad4cd8219e0a797f 100644 (file)
@@ -831,7 +831,7 @@ static int __devinit pvr2fb_common_init(void)
        printk(KERN_NOTICE "fb%d: registering with SQ API\n", fb_info->node);
 
        pvr2fb_map = sq_remap(fb_info->fix.smem_start, fb_info->fix.smem_len,
-                             fb_info->fix.id, pgprot_val(PAGE_SHARED));
+                             fb_info->fix.id, PAGE_SHARED);
 
        printk(KERN_NOTICE "fb%d: Mapped video memory to SQ addr 0x%lx\n",
               fb_info->node, pvr2fb_map);
index adf9632c6b1f5db885bfc31274e0f712b4014163..53cb722c45a02f37e23403e2b0874d110c8e25c5 100644 (file)
@@ -211,21 +211,23 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
 
 /**
  * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock.
- * @id: window id.
  * @sfb: The hardware state.
  * @pixclock: The pixel clock wanted, in picoseconds.
  *
  * Given the specified pixel clock, work out the necessary divider to get
  * close to the output frequency.
  */
-static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int pixclk)
+static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk)
 {
-       struct s3c_fb_pd_win *win = sfb->pdata->win[id];
        unsigned long clk = clk_get_rate(sfb->bus_clk);
+       unsigned long long tmp;
        unsigned int result;
 
-       pixclk *= win->win_mode.refresh;
-       result = clk / pixclk;
+       tmp = (unsigned long long)clk;
+       tmp *= pixclk;
+
+       do_div(tmp, 1000000000UL);
+       result = (unsigned int)tmp / 1000;
 
        dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n",
                pixclk, clk, result, clk / result);
@@ -301,7 +303,7 @@ static int s3c_fb_set_par(struct fb_info *info)
        /* use window 0 as the basis for the lcd output timings */
 
        if (win_no == 0) {
-               clkdiv = s3c_fb_calc_pixclk(win_no, sfb, var->pixclock);
+               clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock);
 
                data = sfb->pdata->vidcon0;
                data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR);
index a69830d26f7fbdd7a050ef5daa39522b1962b60a..8d7653e56df5e0ebe6a28cebf14c481304688102 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
 #include <linux/vmalloc.h>
+#include <linux/ioctl.h>
 #include <video/sh_mobile_lcdc.h>
 #include <asm/atomic.h>
 
@@ -106,6 +107,7 @@ static unsigned long lcdc_offs_sublcd[NR_CH_REGS] = {
 #define LDRCNTR_SRC    0x00010000
 #define LDRCNTR_MRS    0x00000002
 #define LDRCNTR_MRC    0x00000001
+#define LDSR_MRS       0x00000100
 
 struct sh_mobile_lcdc_priv;
 struct sh_mobile_lcdc_chan {
@@ -122,8 +124,8 @@ struct sh_mobile_lcdc_chan {
        struct scatterlist *sglist;
        unsigned long frame_end;
        unsigned long pan_offset;
-       unsigned long new_pan_offset;
        wait_queue_head_t frame_end_wait;
+       struct completion vsync_completion;
 };
 
 struct sh_mobile_lcdc_priv {
@@ -366,19 +368,8 @@ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
                }
 
                /* VSYNC End */
-               if (ldintr & LDINTR_VES) {
-                       unsigned long ldrcntr = lcdc_read(priv, _LDRCNTR);
-                       /* Set the source address for the next refresh */
-                       lcdc_write_chan_mirror(ch, LDSA1R, ch->dma_handle +
-                                              ch->new_pan_offset);
-                       if (lcdc_chan_is_sublcd(ch))
-                               lcdc_write(ch->lcdc, _LDRCNTR,
-                                          ldrcntr ^ LDRCNTR_SRS);
-                       else
-                               lcdc_write(ch->lcdc, _LDRCNTR,
-                                          ldrcntr ^ LDRCNTR_MRS);
-                       ch->pan_offset = ch->new_pan_offset;
-               }
+               if (ldintr & LDINTR_VES)
+                       complete(&ch->vsync_completion);
        }
 
        return IRQ_HANDLED;
@@ -767,25 +758,69 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
                                     struct fb_info *info)
 {
        struct sh_mobile_lcdc_chan *ch = info->par;
+       struct sh_mobile_lcdc_priv *priv = ch->lcdc;
+       unsigned long ldrcntr;
+       unsigned long new_pan_offset;
+
+       new_pan_offset = (var->yoffset * info->fix.line_length) +
+               (var->xoffset * (info->var.bits_per_pixel / 8));
 
-       if (info->var.xoffset == var->xoffset &&
-           info->var.yoffset == var->yoffset)
+       if (new_pan_offset == ch->pan_offset)
                return 0;       /* No change, do nothing */
 
-       ch->new_pan_offset = (var->yoffset * info->fix.line_length) +
-               (var->xoffset * (info->var.bits_per_pixel / 8));
+       ldrcntr = lcdc_read(priv, _LDRCNTR);
 
-       if (ch->new_pan_offset != ch->pan_offset) {
-               unsigned long ldintr;
-               ldintr = lcdc_read(ch->lcdc, _LDINTR);
-               ldintr |= LDINTR_VEE;
-               lcdc_write(ch->lcdc, _LDINTR, ldintr);
-               sh_mobile_lcdc_deferred_io_touch(info);
-       }
+       /* Set the source address for the next refresh */
+       lcdc_write_chan_mirror(ch, LDSA1R, ch->dma_handle + new_pan_offset);
+       if (lcdc_chan_is_sublcd(ch))
+               lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS);
+       else
+               lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_MRS);
+
+       ch->pan_offset = new_pan_offset;
+
+       sh_mobile_lcdc_deferred_io_touch(info);
+
+       return 0;
+}
+
+static int sh_mobile_wait_for_vsync(struct fb_info *info)
+{
+       struct sh_mobile_lcdc_chan *ch = info->par;
+       unsigned long ldintr;
+       int ret;
+
+       /* Enable VSync End interrupt */
+       ldintr = lcdc_read(ch->lcdc, _LDINTR);
+       ldintr |= LDINTR_VEE;
+       lcdc_write(ch->lcdc, _LDINTR, ldintr);
+
+       ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion,
+                                                       msecs_to_jiffies(100));
+       if (!ret)
+               return -ETIMEDOUT;
 
        return 0;
 }
 
+static int sh_mobile_ioctl(struct fb_info *info, unsigned int cmd,
+                      unsigned long arg)
+{
+       int retval;
+
+       switch (cmd) {
+       case FBIO_WAITFORVSYNC:
+               retval = sh_mobile_wait_for_vsync(info);
+               break;
+
+       default:
+               retval = -ENOIOCTLCMD;
+               break;
+       }
+       return retval;
+}
+
+
 static struct fb_ops sh_mobile_lcdc_ops = {
        .owner          = THIS_MODULE,
        .fb_setcolreg   = sh_mobile_lcdc_setcolreg,
@@ -795,6 +830,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
        .fb_copyarea    = sh_mobile_lcdc_copyarea,
        .fb_imageblit   = sh_mobile_lcdc_imageblit,
        .fb_pan_display = sh_mobile_fb_pan_display,
+       .fb_ioctl       = sh_mobile_ioctl,
 };
 
 static int sh_mobile_lcdc_set_bpp(struct fb_var_screeninfo *var, int bpp)
@@ -962,8 +998,8 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev)
                        goto err1;
                }
                init_waitqueue_head(&priv->ch[i].frame_end_wait);
+               init_completion(&priv->ch[i].vsync_completion);
                priv->ch[j].pan_offset = 0;
-               priv->ch[j].new_pan_offset = 0;
 
                switch (pdata->ch[i].chan) {
                case LCDC_CHAN_MAINLCD:
index 4bb9a0b18950028b21546eb443ac9f215bf97f8e..6b52bf65f0b57fc3ddced265a76a8ce5b03b0f6e 100644 (file)
@@ -69,7 +69,7 @@
 #ifdef CONFIG_MAC
 /* We don't yet have functions to read the PRAM... perhaps we can
    adapt them from the PPC code? */
-static int default_vmode = VMODE_640_480_67;
+static int default_vmode = VMODE_CHOOSE;
 static int default_cmode = CMODE_8;
 #else
 static int default_vmode = VMODE_NVRAM;
@@ -326,11 +326,11 @@ int __init valkyriefb_init(void)
 
 #ifdef CONFIG_MAC
        if (!MACH_IS_MAC)
-               return 0;
+               return -ENODEV;
        if (!(mac_bi_data.id == MAC_MODEL_Q630
              /* I'm not sure about this one */
            || mac_bi_data.id == MAC_MODEL_P588))
-               return 0;
+               return -ENODEV;
 
        /* Hardcoded addresses... welcome to 68k Macintosh country :-) */
        frame_buffer_phys = 0xf9000000;
index 97aaf7bb6417310be94448db6faa1865ddd27b10..d787441e5a42a489c9075900f846afd37597716a 100644 (file)
@@ -134,15 +134,7 @@ static struct valkyrie_regvals valkyrie_reg_init_14 = {
     { 1024, 0 },
        1024, 768
 };
-
-/* Register values for 800x600, 72Hz mode (11) */
-static struct valkyrie_regvals valkyrie_reg_init_11 = {
-    13,
-    { 17, 27, 3 },  /* pixel clock = 49.63MHz for V=71.66Hz */
-    { 800, 0 },
-       800, 600
-};
-#endif /* CONFIG_MAC */
+#endif /* !defined CONFIG_MAC */
 
 /* Register values for 832x624, 75Hz mode (13) */
 static struct valkyrie_regvals valkyrie_reg_init_13 = {
@@ -152,6 +144,14 @@ static struct valkyrie_regvals valkyrie_reg_init_13 = {
        832, 624
 };
 
+/* Register values for 800x600, 72Hz mode (11) */
+static struct valkyrie_regvals valkyrie_reg_init_11 = {
+    13,
+    { 17, 27, 3 },  /* pixel clock = 49.63MHz for V=71.66Hz */
+    { 800, 0 },
+       800, 600
+};
+
 /* Register values for 800x600, 60Hz mode (10) */
 static struct valkyrie_regvals valkyrie_reg_init_10 = {
     12,
@@ -188,24 +188,13 @@ static struct valkyrie_regvals *valkyrie_reg_init[VMODE_MAX] = {
        NULL,
        NULL,
        &valkyrie_reg_init_10,
-#ifdef CONFIG_MAC
-       NULL,
-       NULL,
-       &valkyrie_reg_init_13,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-#else
        &valkyrie_reg_init_11,
        NULL,
        &valkyrie_reg_init_13,
+#ifndef CONFIG_MAC
        &valkyrie_reg_init_14,
        &valkyrie_reg_init_15,
        NULL,
        &valkyrie_reg_init_17,
 #endif
-       NULL,
-       NULL,
-       NULL
 };
index 9d4f3a49ba4a5038a333c940351dd85cf5df0deb..d5077dfa9e00ea1172faeb14470bf96c6c569edb 100644 (file)
@@ -137,7 +137,7 @@ static int hw_bitblt_1(void __iomem *engine, u8 op, u32 width, u32 height,
                        tmp, dst_pitch);
                return -EINVAL;
        }
-       tmp = (tmp >> 3) | (dst_pitch << (16 - 3));
+       tmp = VIA_PITCH_ENABLE | (tmp >> 3) | (dst_pitch << (16 - 3));
        writel(tmp, engine + 0x38);
 
        if (op == VIA_BITBLT_FILL)
@@ -352,6 +352,9 @@ int viafb_init_engine(struct fb_info *info)
        viapar->shared->vq_vram_addr = viapar->fbmem_free;
        viapar->fbmem_used += VQ_SIZE;
 
+       /* Init 2D engine reg to reset 2D engine */
+       writel(0x0, engine + VIA_REG_KEYCONTROL);
+
        /* Init AGP and VQ regs */
        switch (chip_name) {
        case UNICHROME_K8M890:
index d8df17a7d5fce50a0f2566f5ee06713eb0ae96bd..3028e7ddc3b5a6026ba4d44e75209d3ba690711c 100644 (file)
@@ -177,16 +177,15 @@ static int viafb_set_par(struct fb_info *info)
        }
 
        if (vmode_index != VIA_RES_INVALID) {
-               viafb_setmode(vmode_index, info->var.xres, info->var.yres,
-                       info->var.bits_per_pixel, vmode_index1,
-                       viafb_second_xres, viafb_second_yres, viafb_bpp1);
-
                viafb_update_fix(info);
                viafb_bpp = info->var.bits_per_pixel;
                if (info->var.accel_flags & FB_ACCELF_TEXT)
                        info->flags &= ~FBINFO_HWACCEL_DISABLED;
                else
                        info->flags |= FBINFO_HWACCEL_DISABLED;
+               viafb_setmode(vmode_index, info->var.xres, info->var.yres,
+                       info->var.bits_per_pixel, vmode_index1,
+                       viafb_second_xres, viafb_second_yres, viafb_bpp1);
        }
 
        return 0;
@@ -872,7 +871,9 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
        if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo)
                return -ENODEV;
 
-       if (chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2)
+       /* LCD ouput does not support hw cursors (at least on VN896) */
+       if ((chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2) ||
+               viafb_LCD_ON)
                return -ENODEV;
 
        viafb_show_hw_cursor(info, HW_Cursor_OFF);
index 9dd5880428803d78a3ad349d43aae049dd4f4344..369f2eebbad14d5a2999712549894260f4e407e4 100644 (file)
@@ -28,7 +28,7 @@
 struct virtio_balloon
 {
        struct virtio_device *vdev;
-       struct virtqueue *inflate_vq, *deflate_vq;
+       struct virtqueue *inflate_vq, *deflate_vq, *stats_vq;
 
        /* Where the ballooning thread waits for config to change. */
        wait_queue_head_t config_change;
@@ -49,6 +49,10 @@ struct virtio_balloon
        /* The array of pfns we tell the Host about. */
        unsigned int num_pfns;
        u32 pfns[256];
+
+       /* Memory statistics */
+       int need_stats_update;
+       struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR];
 };
 
 static struct virtio_device_id id_table[] = {
@@ -154,6 +158,72 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
        }
 }
 
+static inline void update_stat(struct virtio_balloon *vb, int idx,
+                              u16 tag, u64 val)
+{
+       BUG_ON(idx >= VIRTIO_BALLOON_S_NR);
+       vb->stats[idx].tag = tag;
+       vb->stats[idx].val = val;
+}
+
+#define pages_to_bytes(x) ((u64)(x) << PAGE_SHIFT)
+
+static void update_balloon_stats(struct virtio_balloon *vb)
+{
+       unsigned long events[NR_VM_EVENT_ITEMS];
+       struct sysinfo i;
+       int idx = 0;
+
+       all_vm_events(events);
+       si_meminfo(&i);
+
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,
+                               pages_to_bytes(events[PSWPIN]));
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT,
+                               pages_to_bytes(events[PSWPOUT]));
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]);
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]);
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMFREE,
+                               pages_to_bytes(i.freeram));
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT,
+                               pages_to_bytes(i.totalram));
+}
+
+/*
+ * While most virtqueues communicate guest-initiated requests to the hypervisor,
+ * the stats queue operates in reverse.  The driver initializes the virtqueue
+ * with a single buffer.  From that point forward, all conversations consist of
+ * a hypervisor request (a call to this function) which directs us to refill
+ * the virtqueue with a fresh stats buffer.  Since stats collection can sleep,
+ * we notify our kthread which does the actual work via stats_handle_request().
+ */
+static void stats_request(struct virtqueue *vq)
+{
+       struct virtio_balloon *vb;
+       unsigned int len;
+
+       vb = vq->vq_ops->get_buf(vq, &len);
+       if (!vb)
+               return;
+       vb->need_stats_update = 1;
+       wake_up(&vb->config_change);
+}
+
+static void stats_handle_request(struct virtio_balloon *vb)
+{
+       struct virtqueue *vq;
+       struct scatterlist sg;
+
+       vb->need_stats_update = 0;
+       update_balloon_stats(vb);
+
+       vq = vb->stats_vq;
+       sg_init_one(&sg, vb->stats, sizeof(vb->stats));
+       if (vq->vq_ops->add_buf(vq, &sg, 1, 0, vb) < 0)
+               BUG();
+       vq->vq_ops->kick(vq);
+}
+
 static void virtballoon_changed(struct virtio_device *vdev)
 {
        struct virtio_balloon *vb = vdev->priv;
@@ -190,8 +260,11 @@ static int balloon(void *_vballoon)
                try_to_freeze();
                wait_event_interruptible(vb->config_change,
                                         (diff = towards_target(vb)) != 0
+                                        || vb->need_stats_update
                                         || kthread_should_stop()
                                         || freezing(current));
+               if (vb->need_stats_update)
+                       stats_handle_request(vb);
                if (diff > 0)
                        fill_balloon(vb, diff);
                else if (diff < 0)
@@ -204,10 +277,10 @@ static int balloon(void *_vballoon)
 static int virtballoon_probe(struct virtio_device *vdev)
 {
        struct virtio_balloon *vb;
-       struct virtqueue *vqs[2];
-       vq_callback_t *callbacks[] = { balloon_ack, balloon_ack };
-       const char *names[] = { "inflate", "deflate" };
-       int err;
+       struct virtqueue *vqs[3];
+       vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request };
+       const char *names[] = { "inflate", "deflate", "stats" };
+       int err, nvqs;
 
        vdev->priv = vb = kmalloc(sizeof(*vb), GFP_KERNEL);
        if (!vb) {
@@ -219,14 +292,31 @@ static int virtballoon_probe(struct virtio_device *vdev)
        vb->num_pages = 0;
        init_waitqueue_head(&vb->config_change);
        vb->vdev = vdev;
+       vb->need_stats_update = 0;
 
-       /* We expect two virtqueues. */
-       err = vdev->config->find_vqs(vdev, 2, vqs, callbacks, names);
+       /* We expect two virtqueues: inflate and deflate,
+        * and optionally stat. */
+       nvqs = virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ) ? 3 : 2;
+       err = vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names);
        if (err)
                goto out_free_vb;
 
        vb->inflate_vq = vqs[0];
        vb->deflate_vq = vqs[1];
+       if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ)) {
+               struct scatterlist sg;
+               vb->stats_vq = vqs[2];
+
+               /*
+                * Prime this virtqueue with one buffer so the hypervisor can
+                * use it to signal us later.
+                */
+               sg_init_one(&sg, vb->stats, sizeof vb->stats);
+               if (vb->stats_vq->vq_ops->add_buf(vb->stats_vq,
+                                                 &sg, 1, 0, vb) < 0)
+                       BUG();
+               vb->stats_vq->vq_ops->kick(vb->stats_vq);
+       }
 
        vb->thread = kthread_run(balloon, vb, "vballoon");
        if (IS_ERR(vb->thread)) {
@@ -264,9 +354,12 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
        kfree(vb);
 }
 
-static unsigned int features[] = { VIRTIO_BALLOON_F_MUST_TELL_HOST };
+static unsigned int features[] = {
+       VIRTIO_BALLOON_F_MUST_TELL_HOST,
+       VIRTIO_BALLOON_F_STATS_VQ,
+};
 
-static struct virtio_driver virtio_balloon = {
+static struct virtio_driver virtio_balloon_driver = {
        .feature_table = features,
        .feature_table_size = ARRAY_SIZE(features),
        .driver.name =  KBUILD_MODNAME,
@@ -279,12 +372,12 @@ static struct virtio_driver virtio_balloon = {
 
 static int __init init(void)
 {
-       return register_virtio_driver(&virtio_balloon);
+       return register_virtio_driver(&virtio_balloon_driver);
 }
 
 static void __exit fini(void)
 {
-       unregister_virtio_driver(&virtio_balloon);
+       unregister_virtio_driver(&virtio_balloon_driver);
 }
 module_init(init);
 module_exit(fini);
index 28d9cf7cf72f9fd1ee8aeea96085da394d48702e..1d5191fab62e440928376f33666a92a15d7be5df 100644 (file)
@@ -702,7 +702,7 @@ static struct pci_driver virtio_pci_driver = {
        .name           = "virtio-pci",
        .id_table       = virtio_pci_id_table,
        .probe          = virtio_pci_probe,
-       .remove         = virtio_pci_remove,
+       .remove         = __devexit_p(virtio_pci_remove),
 #ifdef CONFIG_PM
        .suspend        = virtio_pci_suspend,
        .resume         = virtio_pci_resume,
index fbd2ecde93e409ea9287d068d3f2322297c910cc..0db906b3c95d71bd985fa97b2fc62c52a7244104 100644 (file)
 #include <linux/virtio_config.h>
 #include <linux/device.h>
 
+/* virtio guest is communicating with a virtual "device" that actually runs on
+ * a host processor.  Memory barriers are used to control SMP effects. */
+#ifdef CONFIG_SMP
+/* Where possible, use SMP barriers which are more lightweight than mandatory
+ * barriers, because mandatory barriers control MMIO effects on accesses
+ * through relaxed memory I/O windows (which virtio does not use). */
+#define virtio_mb() smp_mb()
+#define virtio_rmb() smp_rmb()
+#define virtio_wmb() smp_wmb()
+#else
+/* We must force memory ordering even if guest is UP since host could be
+ * running on another CPU, but SMP barriers are defined to barrier() in that
+ * configuration. So fall back to mandatory barriers instead. */
+#define virtio_mb() mb()
+#define virtio_rmb() rmb()
+#define virtio_wmb() wmb()
+#endif
+
 #ifdef DEBUG
 /* For development, we want to crash whenever the ring is screwed. */
 #define BAD_RING(_vq, fmt, args...)                            \
                        panic("%s:in_use = %i\n",               \
                              (_vq)->vq.name, (_vq)->in_use);   \
                (_vq)->in_use = __LINE__;                       \
-               mb();                                           \
        } while (0)
 #define END_USE(_vq) \
-       do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0)
+       do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; } while(0)
 #else
 #define BAD_RING(_vq, fmt, args...)                            \
        do {                                                    \
@@ -221,13 +238,13 @@ static void vring_kick(struct virtqueue *_vq)
        START_USE(vq);
        /* Descriptors and available array need to be set before we expose the
         * new available array entries. */
-       wmb();
+       virtio_wmb();
 
        vq->vring.avail->idx += vq->num_added;
        vq->num_added = 0;
 
        /* Need to update avail index before checking if we should notify */
-       mb();
+       virtio_mb();
 
        if (!(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY))
                /* Prod other side to tell it about changes. */
@@ -286,7 +303,7 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
        }
 
        /* Only get used array entries after they have been exposed by host. */
-       rmb();
+       virtio_rmb();
 
        i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id;
        *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len;
@@ -324,7 +341,7 @@ static bool vring_enable_cb(struct virtqueue *_vq)
        /* We optimistically turn back on interrupts, then check if there was
         * more to do. */
        vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
-       mb();
+       virtio_mb();
        if (unlikely(more_used(vq))) {
                END_USE(vq);
                return false;
@@ -334,6 +351,30 @@ static bool vring_enable_cb(struct virtqueue *_vq)
        return true;
 }
 
+static void *vring_detach_unused_buf(struct virtqueue *_vq)
+{
+       struct vring_virtqueue *vq = to_vvq(_vq);
+       unsigned int i;
+       void *buf;
+
+       START_USE(vq);
+
+       for (i = 0; i < vq->vring.num; i++) {
+               if (!vq->data[i])
+                       continue;
+               /* detach_buf clears data, so grab it now. */
+               buf = vq->data[i];
+               detach_buf(vq, i);
+               END_USE(vq);
+               return buf;
+       }
+       /* That should have freed everything. */
+       BUG_ON(vq->num_free != vq->vring.num);
+
+       END_USE(vq);
+       return NULL;
+}
+
 irqreturn_t vring_interrupt(int irq, void *_vq)
 {
        struct vring_virtqueue *vq = to_vvq(_vq);
@@ -360,6 +401,7 @@ static struct virtqueue_ops vring_vq_ops = {
        .kick = vring_kick,
        .disable_cb = vring_disable_cb,
        .enable_cb = vring_enable_cb,
+       .detach_unused_buf = vring_detach_unused_buf,
 };
 
 struct virtqueue *vring_new_virtqueue(unsigned int num,
@@ -406,8 +448,11 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
        /* Put everything in free lists. */
        vq->num_free = num;
        vq->free_head = 0;
-       for (i = 0; i < num-1; i++)
+       for (i = 0; i < num-1; i++) {
                vq->vring.desc[i].next = i+1;
+               vq->data[i] = NULL;
+       }
+       vq->data[i] = NULL;
 
        return &vq->vq;
 }
index 088f32f29a6e9fa9b1563b765394539537c5ba30..050ee147592fcd39b66641ad0bf2e41d53713487 100644 (file)
@@ -396,8 +396,8 @@ config SBC_FITPC2_WATCHDOG
        tristate "Compulab SBC-FITPC2 watchdog"
        depends on X86
        ---help---
-         This is the driver for the built-in watchdog timer on the fit-PC2
-         Single-board computer made by Compulab.
+         This is the driver for the built-in watchdog timer on the fit-PC2,
+         fit-PC2i, CM-iAM single-board computers made by Compulab.
 
          It`s possible to enable watchdog timer either from BIOS (F2) or from booted Linux.
          When "Watchdog Timer Value" enabled one can set 31-255 s operational range.
index 2e94b71b20d994e94863a8eb2ede232da4528f6e..2bb95cd308c14bacde5733dde0276be71902e0ea 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
+#include <linux/clk.h>
 
 #include <asm/addrspace.h>
 #include <asm/mach-ar7/ar7.h>
@@ -80,6 +81,8 @@ static struct resource *ar7_regs_wdt;
 /* Pointer to the remapped WDT IO space */
 static struct ar7_wdt *ar7_wdt;
 
+static struct clk *vbus_clk;
+
 static void ar7_wdt_kick(u32 value)
 {
        WRITE_REG(ar7_wdt->kick_lock, 0x5555);
@@ -138,17 +141,19 @@ static void ar7_wdt_disable(u32 value)
 static void ar7_wdt_update_margin(int new_margin)
 {
        u32 change;
+       u32 vbus_rate;
 
-       change = new_margin * (ar7_vbus_freq() / prescale_value);
+       vbus_rate = clk_get_rate(vbus_clk);
+       change = new_margin * (vbus_rate / prescale_value);
        if (change < 1)
                change = 1;
        if (change > 0xffff)
                change = 0xffff;
        ar7_wdt_change(change);
-       margin = change * prescale_value / ar7_vbus_freq();
+       margin = change * prescale_value / vbus_rate;
        printk(KERN_INFO DRVNAME
               ": timer margin %d seconds (prescale %d, change %d, freq %d)\n",
-              margin, prescale_value, change, ar7_vbus_freq());
+              margin, prescale_value, change, vbus_rate);
 }
 
 static void ar7_wdt_enable_wdt(void)
@@ -298,6 +303,13 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)
                goto out_mem_region;
        }
 
+       vbus_clk = clk_get(NULL, "vbus");
+       if (IS_ERR(vbus_clk)) {
+               printk(KERN_ERR DRVNAME ": could not get vbus clock\n");
+               rc = PTR_ERR(vbus_clk);
+               goto out_mem_region;
+       }
+
        ar7_wdt_disable_wdt();
        ar7_wdt_prescale(prescale_value);
        ar7_wdt_update_margin(margin);
index c7b3f9df2317387401961450f9746ed093a97e27..2159e668751cd7db5e9ddfb39c96984573801539 100644 (file)
@@ -1,9 +1,8 @@
 /*
  * Blackfin On-Chip Watchdog Driver
- *  Supports BF53[123]/BF53[467]/BF54[2489]/BF561
  *
  * Originally based on softdog.c
- * Copyright 2006-2007 Analog Devices Inc.
+ * Copyright 2006-2010 Analog Devices Inc.
  * Copyright 2006-2007 Michele d'Amico
  * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
  *
@@ -137,13 +136,15 @@ static int bfin_wdt_running(void)
  */
 static int bfin_wdt_set_timeout(unsigned long t)
 {
-       u32 cnt;
+       u32 cnt, max_t, sclk;
        unsigned long flags;
 
-       stampit();
+       sclk = get_sclk();
+       max_t = -1 / sclk;
+       cnt = t * sclk;
+       stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt);
 
-       cnt = t * get_sclk();
-       if (cnt < get_sclk()) {
+       if (t > max_t) {
                printk(KERN_WARNING PFX "timeout value is too large\n");
                return -EINVAL;
        }
index c8a3bec26830ae73416b03e24d5f90edc0d84646..4bdb7f1a90772d780037bf2456e3656c1ad6a1ae 100644 (file)
@@ -29,8 +29,9 @@
  *     document number 313056-003, 313057-017: 82801H (ICH8)
  *     document number 316972-004, 316973-012: 82801I (ICH9)
  *     document number 319973-002, 319974-002: 82801J (ICH10)
- *     document number 322169-001, 322170-001: 5 Series, 3400 Series (PCH)
+ *     document number 322169-001, 322170-003: 5 Series, 3400 Series (PCH)
  *     document number 320066-003, 320257-008: EP80597 (IICH)
+ *     document number TBD                   : Cougar Point (CPT)
  */
 
 /*
@@ -100,8 +101,22 @@ enum iTCO_chipsets {
        TCO_ICH10DO,    /* ICH10DO */
        TCO_PCH,        /* PCH Desktop Full Featured */
        TCO_PCHM,       /* PCH Mobile Full Featured */
+       TCO_P55,        /* P55 */
+       TCO_PM55,       /* PM55 */
+       TCO_H55,        /* H55 */
+       TCO_QM57,       /* QM57 */
+       TCO_H57,        /* H57 */
+       TCO_HM55,       /* HM55 */
+       TCO_Q57,        /* Q57 */
+       TCO_HM57,       /* HM57 */
        TCO_PCHMSFF,    /* PCH Mobile SFF Full Featured */
+       TCO_QS57,       /* QS57 */
+       TCO_3400,       /* 3400 */
+       TCO_3420,       /* 3420 */
+       TCO_3450,       /* 3450 */
        TCO_EP80579,    /* EP80579 */
+       TCO_CPTD,       /* CPT Desktop */
+       TCO_CPTM,       /* CPT Mobile */
 };
 
 static struct {
@@ -144,8 +159,22 @@ static struct {
        {"ICH10DO", 2},
        {"PCH Desktop Full Featured", 2},
        {"PCH Mobile Full Featured", 2},
+       {"P55", 2},
+       {"PM55", 2},
+       {"H55", 2},
+       {"QM57", 2},
+       {"H57", 2},
+       {"HM55", 2},
+       {"Q57", 2},
+       {"HM57", 2},
        {"PCH Mobile SFF Full Featured", 2},
+       {"QS57", 2},
+       {"3400", 2},
+       {"3420", 2},
+       {"3450", 2},
        {"EP80579", 2},
+       {"CPT Desktop", 2},
+       {"CPT Mobile", 2},
        {NULL, 0}
 };
 
@@ -216,8 +245,22 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
        { ITCO_PCI_DEVICE(0x3a14,                               TCO_ICH10DO)},
        { ITCO_PCI_DEVICE(0x3b00,                               TCO_PCH)},
        { ITCO_PCI_DEVICE(0x3b01,                               TCO_PCHM)},
+       { ITCO_PCI_DEVICE(0x3b02,                               TCO_P55)},
+       { ITCO_PCI_DEVICE(0x3b03,                               TCO_PM55)},
+       { ITCO_PCI_DEVICE(0x3b06,                               TCO_H55)},
+       { ITCO_PCI_DEVICE(0x3b07,                               TCO_QM57)},
+       { ITCO_PCI_DEVICE(0x3b08,                               TCO_H57)},
+       { ITCO_PCI_DEVICE(0x3b09,                               TCO_HM55)},
+       { ITCO_PCI_DEVICE(0x3b0a,                               TCO_Q57)},
+       { ITCO_PCI_DEVICE(0x3b0b,                               TCO_HM57)},
        { ITCO_PCI_DEVICE(0x3b0d,                               TCO_PCHMSFF)},
+       { ITCO_PCI_DEVICE(0x3b0f,                               TCO_QS57)},
+       { ITCO_PCI_DEVICE(0x3b12,                               TCO_3400)},
+       { ITCO_PCI_DEVICE(0x3b14,                               TCO_3420)},
+       { ITCO_PCI_DEVICE(0x3b16,                               TCO_3450)},
        { ITCO_PCI_DEVICE(0x5031,                               TCO_EP80579)},
+       { ITCO_PCI_DEVICE(0x1c42,                               TCO_CPTD)},
+       { ITCO_PCI_DEVICE(0x1c43,                               TCO_CPTM)},
        { 0, },                 /* End of list */
 };
 MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
index 4f4b35a20d84ed6642fb789b49e6c601b8742d86..3c79dc587958fcd8cea4e9508a7fe00b008a422b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
+#include <linux/timer.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
index 91430a89107c0ce0f31f9a2d92edac9ac5c8d893..e6763d2a567b92eb43beb1e236daa282d6662a50 100644 (file)
@@ -46,9 +46,9 @@ static DEFINE_SPINLOCK(wdt_lock);
 static void wdt_send_data(unsigned char command, unsigned char data)
 {
        outb(command, COMMAND_PORT);
-       mdelay(100);
+       msleep(100);
        outb(data, DATA_PORT);
-       mdelay(200);
+       msleep(200);
 }
 
 static void wdt_enable(void)
@@ -202,11 +202,10 @@ static int __init fitpc2_wdt_init(void)
 {
        int err;
 
-       if (strcmp("SBC-FITPC2", dmi_get_system_info(DMI_BOARD_NAME))) {
-               pr_info("board name is: %s. Should be SBC-FITPC2\n",
-                       dmi_get_system_info(DMI_BOARD_NAME));
+       if (!strstr(dmi_get_system_info(DMI_BOARD_NAME), "SBC-FITPC2"))
                return -ENODEV;
-       }
+
+       pr_info("%s found\n", dmi_get_system_info(DMI_BOARD_NAME));
 
        if (!request_region(COMMAND_PORT, 1, WATCHDOG_NAME)) {
                pr_err("I/O address 0x%04x already in use\n", COMMAND_PORT);
index c4997930afc71a741a429df77b7e98f7b5d58872..5d42d55e299bd39cbb869fdc264532fb3b06e9dc 100644 (file)
@@ -102,15 +102,15 @@ static void do_suspend(void)
                goto out_thaw;
        }
 
+       printk(KERN_DEBUG "suspending xenstore...\n");
+       xs_suspend();
+
        err = dpm_suspend_noirq(PMSG_SUSPEND);
        if (err) {
                printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
                goto out_resume;
        }
 
-       printk(KERN_DEBUG "suspending xenstore...\n");
-       xs_suspend();
-
        err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
 
        dpm_resume_noirq(PMSG_RESUME);
@@ -120,13 +120,13 @@ static void do_suspend(void)
                cancelled = 1;
        }
 
+out_resume:
        if (!cancelled) {
                xen_arch_resume();
                xs_resume();
        } else
                xs_suspend_cancel();
 
-out_resume:
        dpm_resume_end(PMSG_RESUME);
 
        /* Make sure timer events get retriggered on all CPUs */
index cf62b05e296a67af103178e0b86e673cb1d16031..7d6c2139891db0d04673c6078d6a3f85c446dbb6 100644 (file)
@@ -84,7 +84,7 @@ static const match_table_t tokens = {
 
 static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 {
-       char *options;
+       char *options, *tmp_options;
        substring_t args[MAX_OPT_ARGS];
        char *p;
        int option = 0;
@@ -102,9 +102,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
        if (!opts)
                return 0;
 
-       options = kstrdup(opts, GFP_KERNEL);
-       if (!options)
+       tmp_options = kstrdup(opts, GFP_KERNEL);
+       if (!tmp_options) {
+               ret = -ENOMEM;
                goto fail_option_alloc;
+       }
+       options = tmp_options;
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
@@ -159,8 +162,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
                        break;
                case Opt_cache:
                        s = match_strdup(&args[0]);
-                       if (!s)
-                               goto fail_option_alloc;
+                       if (!s) {
+                               ret = -ENOMEM;
+                               P9_DPRINTK(P9_DEBUG_ERROR,
+                                 "problem allocating copy of cache arg\n");
+                               goto free_and_return;
+                       }
 
                        if (strcmp(s, "loose") == 0)
                                v9ses->cache = CACHE_LOOSE;
@@ -173,8 +180,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 
                case Opt_access:
                        s = match_strdup(&args[0]);
-                       if (!s)
-                               goto fail_option_alloc;
+                       if (!s) {
+                               ret = -ENOMEM;
+                               P9_DPRINTK(P9_DEBUG_ERROR,
+                                 "problem allocating copy of access arg\n");
+                               goto free_and_return;
+                       }
 
                        v9ses->flags &= ~V9FS_ACCESS_MASK;
                        if (strcmp(s, "user") == 0)
@@ -194,13 +205,11 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
                        continue;
                }
        }
-       kfree(options);
-       return ret;
 
+free_and_return:
+       kfree(tmp_options);
 fail_option_alloc:
-       P9_DPRINTK(P9_DEBUG_ERROR,
-                  "failed to allocate copy of option argument\n");
-       return -ENOMEM;
+       return ret;
 }
 
 /**
index 3a7560e358657f059897e6f27aaa3ce4a20c0953..ed835836e0dc35f9eab51e2a86d611d8c5d6808f 100644 (file)
@@ -60,3 +60,4 @@ void v9fs_dentry_release(struct dentry *);
 int v9fs_uflags2omode(int uflags, int extended);
 
 ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64);
+void v9fs_blank_wstat(struct p9_wstat *wstat);
index 3902bf43a0883bfe4b92d384170362e53c910e0d..74a0461a9ac0dfabd95ca360fa2fa58e32d2e779 100644 (file)
@@ -257,6 +257,23 @@ v9fs_file_write(struct file *filp, const char __user * data,
        return total;
 }
 
+static int v9fs_file_fsync(struct file *filp, struct dentry *dentry,
+                                       int datasync)
+{
+       struct p9_fid *fid;
+       struct p9_wstat wstat;
+       int retval;
+
+       P9_DPRINTK(P9_DEBUG_VFS, "filp %p dentry %p datasync %x\n", filp,
+                                               dentry, datasync);
+
+       fid = filp->private_data;
+       v9fs_blank_wstat(&wstat);
+
+       retval = p9_client_wstat(fid, &wstat);
+       return retval;
+}
+
 static const struct file_operations v9fs_cached_file_operations = {
        .llseek = generic_file_llseek,
        .read = do_sync_read,
@@ -266,6 +283,7 @@ static const struct file_operations v9fs_cached_file_operations = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
+       .fsync = v9fs_file_fsync,
 };
 
 const struct file_operations v9fs_file_operations = {
@@ -276,4 +294,5 @@ const struct file_operations v9fs_file_operations = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
+       .fsync = v9fs_file_fsync,
 };
index 18f74ec4dce922da7ff4d6f88638e7aa4077ae8a..a407fa3388c0c560a7ff754066dfa9606380bef5 100644 (file)
@@ -176,7 +176,7 @@ int v9fs_uflags2omode(int uflags, int extended)
  *
  */
 
-static void
+void
 v9fs_blank_wstat(struct p9_wstat *wstat)
 {
        wstat->type = ~0;
@@ -1000,44 +1000,6 @@ done:
        return retval;
 }
 
-/**
- * v9fs_vfs_readlink - read a symlink's location
- * @dentry: dentry for symlink
- * @buffer: buffer to load symlink location into
- * @buflen: length of buffer
- *
- */
-
-static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer,
-                            int buflen)
-{
-       int retval;
-       int ret;
-       char *link = __getname();
-
-       if (unlikely(!link))
-               return -ENOMEM;
-
-       if (buflen > PATH_MAX)
-               buflen = PATH_MAX;
-
-       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
-                                                                       dentry);
-
-       retval = v9fs_readlink(dentry, link, buflen);
-
-       if (retval > 0) {
-               if ((ret = copy_to_user(buffer, link, retval)) != 0) {
-                       P9_DPRINTK(P9_DEBUG_ERROR,
-                                       "problem copying to user: %d\n", ret);
-                       retval = ret;
-               }
-       }
-
-       __putname(link);
-       return retval;
-}
-
 /**
  * v9fs_vfs_follow_link - follow a symlink path
  * @dentry: dentry for symlink
@@ -1230,7 +1192,6 @@ static const struct inode_operations v9fs_dir_inode_operations_ext = {
        .rmdir = v9fs_vfs_rmdir,
        .mknod = v9fs_vfs_mknod,
        .rename = v9fs_vfs_rename,
-       .readlink = v9fs_vfs_readlink,
        .getattr = v9fs_vfs_getattr,
        .setattr = v9fs_vfs_setattr,
 };
@@ -1253,7 +1214,7 @@ static const struct inode_operations v9fs_file_inode_operations = {
 };
 
 static const struct inode_operations v9fs_symlink_inode_operations = {
-       .readlink = v9fs_vfs_readlink,
+       .readlink = generic_readlink,
        .follow_link = v9fs_vfs_follow_link,
        .put_link = v9fs_vfs_put_link,
        .getattr = v9fs_vfs_getattr,
index 14a86448572cc0eb0de2e472e47cf2fdd80466b5..69357c0d9899c1c3e52e090b0ce3d4725b18c41b 100644 (file)
@@ -188,7 +188,8 @@ static void v9fs_kill_super(struct super_block *s)
 
        P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
 
-       v9fs_dentry_release(s->s_root); /* clunk root */
+       if (s->s_root)
+               v9fs_dentry_release(s->s_root); /* clunk root */
 
        kill_anon_super(s);
 
index e511dc621a2e64a45b09bcf21777e72d86added9..0e40caaba456c064a4960a7f98450a3498bd8cb8 100644 (file)
@@ -106,8 +106,8 @@ struct affs_sb_info {
        u32 s_last_bmap;
        struct buffer_head *s_bmap_bh;
        char *s_prefix;                 /* Prefix for volumes and assigns. */
-       int s_prefix_len;               /* Length of prefix. */
        char s_volume[32];              /* Volume prefix for absolute symlinks. */
+       spinlock_t symlink_lock;        /* protects the previous two */
 };
 
 #define SF_INTL                0x0001          /* International filesystem. */
index 960d336ec694c3d1dc83c7941753a2c7199f317a..d70bbbac6b7be31709f407f081672d0d6893fda5 100644 (file)
@@ -341,10 +341,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
        p  = (char *)AFFS_HEAD(bh)->table;
        lc = '/';
        if (*symname == '/') {
+               struct affs_sb_info *sbi = AFFS_SB(sb);
                while (*symname == '/')
                        symname++;
-               while (AFFS_SB(sb)->s_volume[i])        /* Cannot overflow */
-                       *p++ = AFFS_SB(sb)->s_volume[i++];
+               spin_lock(&sbi->symlink_lock);
+               while (sbi->s_volume[i])        /* Cannot overflow */
+                       *p++ = sbi->s_volume[i++];
+               spin_unlock(&sbi->symlink_lock);
        }
        while (i < maxlen && (c = *symname++)) {
                if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') {
index 104fdcb3a7fca3997d8740e2ed2d14ba283338c7..d41e9673cd9736fae4efb1db81accbeec6c1f7eb 100644 (file)
@@ -203,7 +203,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
                switch (token) {
                case Opt_bs:
                        if (match_int(&args[0], &n))
-                               return -EINVAL;
+                               return 0;
                        if (n != 512 && n != 1024 && n != 2048
                            && n != 4096) {
                                printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n");
@@ -213,7 +213,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
                        break;
                case Opt_mode:
                        if (match_octal(&args[0], &option))
-                               return 1;
+                               return 0;
                        *mode = option & 0777;
                        *mount_opts |= SF_SETMODE;
                        break;
@@ -221,8 +221,6 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
                        *mount_opts |= SF_MUFS;
                        break;
                case Opt_prefix:
-                       /* Free any previous prefix */
-                       kfree(*prefix);
                        *prefix = match_strdup(&args[0]);
                        if (!*prefix)
                                return 0;
@@ -233,21 +231,21 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
                        break;
                case Opt_reserved:
                        if (match_int(&args[0], reserved))
-                               return 1;
+                               return 0;
                        break;
                case Opt_root:
                        if (match_int(&args[0], root))
-                               return 1;
+                               return 0;
                        break;
                case Opt_setgid:
                        if (match_int(&args[0], &option))
-                               return 1;
+                               return 0;
                        *gid = option;
                        *mount_opts |= SF_SETGID;
                        break;
                case Opt_setuid:
                        if (match_int(&args[0], &option))
-                               return -EINVAL;
+                               return 0;
                        *uid = option;
                        *mount_opts |= SF_SETUID;
                        break;
@@ -311,11 +309,14 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
                return -ENOMEM;
        sb->s_fs_info = sbi;
        mutex_init(&sbi->s_bmlock);
+       spin_lock_init(&sbi->symlink_lock);
 
        if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
                                &blocksize,&sbi->s_prefix,
                                sbi->s_volume, &mount_flags)) {
                printk(KERN_ERR "AFFS: Error parsing options\n");
+               kfree(sbi->s_prefix);
+               kfree(sbi);
                return -EINVAL;
        }
        /* N.B. after this point s_prefix must be released */
@@ -516,14 +517,18 @@ affs_remount(struct super_block *sb, int *flags, char *data)
        unsigned long            mount_flags;
        int                      res = 0;
        char                    *new_opts = kstrdup(data, GFP_KERNEL);
+       char                     volume[32];
+       char                    *prefix = NULL;
 
        pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
 
        *flags |= MS_NODIRATIME;
 
+       memcpy(volume, sbi->s_volume, 32);
        if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block,
-                          &blocksize, &sbi->s_prefix, sbi->s_volume,
+                          &blocksize, &prefix, volume,
                           &mount_flags)) {
+               kfree(prefix);
                kfree(new_opts);
                return -EINVAL;
        }
@@ -534,6 +539,14 @@ affs_remount(struct super_block *sb, int *flags, char *data)
        sbi->s_mode  = mode;
        sbi->s_uid   = uid;
        sbi->s_gid   = gid;
+       /* protect against readers */
+       spin_lock(&sbi->symlink_lock);
+       if (prefix) {
+               kfree(sbi->s_prefix);
+               sbi->s_prefix = prefix;
+       }
+       memcpy(sbi->s_volume, volume, 32);
+       spin_unlock(&sbi->symlink_lock);
 
        if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
                unlock_kernel();
index 41782539c907b0cd1697ac161e20cfec22a76202..ee00f08c4f534c5669ba4c57178cb292511aae35 100644 (file)
@@ -20,7 +20,6 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
        int                      i, j;
        char                     c;
        char                     lc;
-       char                    *pf;
 
        pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino);
 
@@ -32,11 +31,15 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
        j  = 0;
        lf = (struct slink_front *)bh->b_data;
        lc = 0;
-       pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/";
 
        if (strchr(lf->symname,':')) {  /* Handle assign or volume name */
+               struct affs_sb_info *sbi = AFFS_SB(inode->i_sb);
+               char *pf;
+               spin_lock(&sbi->symlink_lock);
+               pf = sbi->s_prefix ? sbi->s_prefix : "/";
                while (i < 1023 && (c = pf[i]))
                        link[i++] = c;
+               spin_unlock(&sbi->symlink_lock);
                while (i < 1023 && lf->symname[j] != ':')
                        link[i++] = lf->symname[j++];
                if (i < 1023)
index 33baf27fac78e5c4fbc36e12e3a4a16b2322afe4..34ddda888e631e8ad338b1271a25efe10e93477d 100644 (file)
@@ -873,6 +873,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
        brelse(bh);
 
       unacquire_priv_sbp:
+       kfree(befs_sb->mount_opts.iocharset);
        kfree(sb->s_fs_info);
 
       unacquire_none:
index 6f60336c6628182804aa39086040968f174fbba7..8f3d9fd896044ffa718b3fc569a613b310c1c3ec 100644 (file)
@@ -353,35 +353,35 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
        struct inode *inode;
        unsigned i, imap_len;
        struct bfs_sb_info *info;
-       long ret = -EINVAL;
+       int ret = -EINVAL;
        unsigned long i_sblock, i_eblock, i_eoff, s_size;
 
        info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return -ENOMEM;
+       mutex_init(&info->bfs_lock);
        s->s_fs_info = info;
 
        sb_set_blocksize(s, BFS_BSIZE);
 
-       bh = sb_bread(s, 0);
-       if(!bh)
+       info->si_sbh = sb_bread(s, 0);
+       if (!info->si_sbh)
                goto out;
-       bfs_sb = (struct bfs_super_block *)bh->b_data;
+       bfs_sb = (struct bfs_super_block *)info->si_sbh->b_data;
        if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) {
                if (!silent)
                        printf("No BFS filesystem on %s (magic=%08x)\n", 
                                s->s_id,  le32_to_cpu(bfs_sb->s_magic));
-               goto out;
+               goto out1;
        }
        if (BFS_UNCLEAN(bfs_sb, s) && !silent)
                printf("%s is unclean, continuing\n", s->s_id);
 
        s->s_magic = BFS_MAGIC;
-       info->si_sbh = bh;
 
        if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) {
                printf("Superblock is corrupted\n");
-               goto out;
+               goto out1;
        }
 
        info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) /
@@ -390,7 +390,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
        imap_len = (info->si_lasti / 8) + 1;
        info->si_imap = kzalloc(imap_len, GFP_KERNEL);
        if (!info->si_imap)
-               goto out;
+               goto out1;
        for (i = 0; i < BFS_ROOT_INO; i++)
                set_bit(i, info->si_imap);
 
@@ -398,15 +398,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
        inode = bfs_iget(s, BFS_ROOT_INO);
        if (IS_ERR(inode)) {
                ret = PTR_ERR(inode);
-               kfree(info->si_imap);
-               goto out;
+               goto out2;
        }
        s->s_root = d_alloc_root(inode);
        if (!s->s_root) {
                iput(inode);
                ret = -ENOMEM;
-               kfree(info->si_imap);
-               goto out;
+               goto out2;
        }
 
        info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS;
@@ -419,10 +417,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
        bh = sb_bread(s, info->si_blocks - 1);
        if (!bh) {
                printf("Last block not available: %lu\n", info->si_blocks - 1);
-               iput(inode);
                ret = -EIO;
-               kfree(info->si_imap);
-               goto out;
+               goto out3;
        }
        brelse(bh);
 
@@ -459,11 +455,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
                        printf("Inode 0x%08x corrupted\n", i);
 
                        brelse(bh);
-                       s->s_root = NULL;
-                       kfree(info->si_imap);
-                       kfree(info);
-                       s->s_fs_info = NULL;
-                       return -EIO;
+                       ret = -EIO;
+                       goto out3;
                }
 
                if (!di->i_ino) {
@@ -483,11 +476,17 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
                s->s_dirt = 1;
        } 
        dump_imap("read_super", s);
-       mutex_init(&info->bfs_lock);
        return 0;
 
+out3:
+       dput(s->s_root);
+       s->s_root = NULL;
+out2:
+       kfree(info->si_imap);
+out1:
+       brelse(info->si_sbh);
 out:
-       brelse(bh);
+       mutex_destroy(&info->bfs_lock);
        kfree(info);
        s->s_fs_info = NULL;
        return ret;
index 346b69405363b7419d7d4b591b240074d72bff6b..fdd3970991722d9ff70306cb6a6635c832c11ea8 100644 (file)
@@ -264,6 +264,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 #else
        set_personality(PER_LINUX);
 #endif
+       setup_new_exec(bprm);
 
        current->mm->end_code = ex.a_text +
                (current->mm->start_code = N_TXTADDR(ex));
index edd90c49003cff3b2fdf62ecb0e406007369eedb..fd5b2ea5d2993bbafa4b370fee3aba3f172577c0 100644 (file)
@@ -662,27 +662,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
                        if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
                                goto out_free_interp;
 
-                       /*
-                        * The early SET_PERSONALITY here is so that the lookup
-                        * for the interpreter happens in the namespace of the 
-                        * to-be-execed image.  SET_PERSONALITY can select an
-                        * alternate root.
-                        *
-                        * However, SET_PERSONALITY is NOT allowed to switch
-                        * this task into the new images's memory mapping
-                        * policy - that is, TASK_SIZE must still evaluate to
-                        * that which is appropriate to the execing application.
-                        * This is because exit_mmap() needs to have TASK_SIZE
-                        * evaluate to the size of the old image.
-                        *
-                        * So if (say) a 64-bit application is execing a 32-bit
-                        * application it is the architecture's responsibility
-                        * to defer changing the value of TASK_SIZE until the
-                        * switch really is going to happen - do this in
-                        * flush_thread().      - akpm
-                        */
-                       SET_PERSONALITY(loc->elf_ex);
-
                        interpreter = open_exec(elf_interpreter);
                        retval = PTR_ERR(interpreter);
                        if (IS_ERR(interpreter))
@@ -730,9 +709,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
                /* Verify the interpreter has a valid arch */
                if (!elf_check_arch(&loc->interp_elf_ex))
                        goto out_free_dentry;
-       } else {
-               /* Executables without an interpreter also need a personality  */
-               SET_PERSONALITY(loc->elf_ex);
        }
 
        /* Flush all traces of the currently running executable */
@@ -752,7 +728,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
 
        if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
                current->flags |= PF_RANDOMIZE;
-       arch_pick_mmap_layout(current->mm);
+
+       setup_new_exec(bprm);
 
        /* Do this so that we can load the interpreter, if need be.  We will
           change some of these later */
index c57d9ce5ff7ef85605786fc26200b3fe76df93df..18d77297ccc8ae470a12078d496e7519e443d012 100644 (file)
@@ -321,6 +321,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
        set_personality(PER_LINUX_FDPIC);
        if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
                current->personality |= READ_IMPLIES_EXEC;
+
+       setup_new_exec(bprm);
+
        set_binfmt(&elf_fdpic_format);
 
        current->mm->start_code = 0;
index d4a00ea1054c63f0401bb0b1ef0e78a245df8851..42c6b4a54445620856c1e0ab7814bf7f763dba9c 100644 (file)
@@ -519,6 +519,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 
                /* OK, This is the point of no return */
                set_personality(PER_LINUX_32BIT);
+               setup_new_exec(bprm);
        }
 
        /*
index 2a9b5330cc5e9ada9c23f41c6007996f58b6b938..cc8560f6c9b06f93aea947744c737b62c19c1eb3 100644 (file)
@@ -227,6 +227,7 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        /* OK, This is the point of no return */
        current->flags &= ~PF_FORKNOEXEC;
        current->personality = PER_HPUX;
+       setup_new_exec(bprm);
 
        /* Set the task size for HP-UX processes such that
         * the gateway page is outside the address space.
index 49a34e7f7306d49af72b6d84fda277b82d01cc01..a16f29e888cd837dd1de4669755c0883bfeb715a 100644 (file)
@@ -61,7 +61,7 @@ static inline unsigned int vecs_to_idx(unsigned int nr)
 
 static inline int use_bip_pool(unsigned int idx)
 {
-       if (idx == BIOVEC_NR_POOLS)
+       if (idx == BIOVEC_MAX_IDX)
                return 1;
 
        return 0;
@@ -95,6 +95,7 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio,
 
        /* Use mempool if lower order alloc failed or max vecs were requested */
        if (bip == NULL) {
+               idx = BIOVEC_MAX_IDX;  /* so we free the payload properly later */
                bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask);
 
                if (unlikely(bip == NULL)) {
index 76e6713abf94a5454284d16dc125cecb90de50c2..88094afc29ea38c13906d861ca9bb7dd67c463a2 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -78,7 +78,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)
 
        i = 0;
        while (i < bio_slab_nr) {
-               struct bio_slab *bslab = &bio_slabs[i];
+               bslab = &bio_slabs[i];
 
                if (!bslab->slab && entry == -1)
                        entry = i;
@@ -542,13 +542,18 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
 
                if (page == prev->bv_page &&
                    offset == prev->bv_offset + prev->bv_len) {
+                       unsigned int prev_bv_len = prev->bv_len;
                        prev->bv_len += len;
 
                        if (q->merge_bvec_fn) {
                                struct bvec_merge_data bvm = {
+                                       /* prev_bvec is already charged in
+                                          bi_size, discharge it in order to
+                                          simulate merging updated prev_bvec
+                                          as new bvec. */
                                        .bi_bdev = bio->bi_bdev,
                                        .bi_sector = bio->bi_sector,
-                                       .bi_size = bio->bi_size,
+                                       .bi_size = bio->bi_size - prev_bv_len,
                                        .bi_rw = bio->bi_rw,
                                };
 
index 73d6a735b8f311cc62fe5b22c626a7a4baa9c452..d11d0289f3d24bf9489acba6059c5d8ada9eda52 100644 (file)
@@ -246,7 +246,8 @@ struct super_block *freeze_bdev(struct block_device *bdev)
        if (!sb)
                goto out;
        if (sb->s_flags & MS_RDONLY) {
-               deactivate_locked_super(sb);
+               sb->s_frozen = SB_FREEZE_TRANS;
+               up_write(&sb->s_umount);
                mutex_unlock(&bdev->bd_fsfreeze_mutex);
                return sb;
        }
@@ -307,7 +308,7 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
        BUG_ON(sb->s_bdev != bdev);
        down_write(&sb->s_umount);
        if (sb->s_flags & MS_RDONLY)
-               goto out_deactivate;
+               goto out_unfrozen;
 
        if (sb->s_op->unfreeze_fs) {
                error = sb->s_op->unfreeze_fs(sb);
@@ -321,11 +322,11 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
                }
        }
 
+out_unfrozen:
        sb->s_frozen = SB_UNFROZEN;
        smp_wmb();
        wake_up(&sb->s_wait_unfrozen);
 
-out_deactivate:
        if (sb)
                deactivate_locked_super(sb);
 out_unlock:
index 2e9e69987a82973208724b58899b3479d77feaff..6df6d6ed74fd9e6296f1249cbd37d8d1885a552c 100644 (file)
@@ -112,12 +112,14 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans,
        switch (type) {
        case ACL_TYPE_ACCESS:
                mode = inode->i_mode;
-               ret = posix_acl_equiv_mode(acl, &mode);
-               if (ret < 0)
-                       return ret;
-               ret = 0;
-               inode->i_mode = mode;
                name = POSIX_ACL_XATTR_ACCESS;
+               if (acl) {
+                       ret = posix_acl_equiv_mode(acl, &mode);
+                       if (ret < 0)
+                               return ret;
+                       inode->i_mode = mode;
+               }
+               ret = 0;
                break;
        case ACL_TYPE_DEFAULT:
                if (!S_ISDIR(inode->i_mode))
@@ -242,6 +244,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
                                                    ACL_TYPE_ACCESS);
                        }
                }
+               posix_acl_release(clone);
        }
 failed:
        posix_acl_release(acl);
index 9f806dd04c2704899bf28e5324eebaa14a923e27..2aa8ec6a09812051ba5578092c608c3d0c460535 100644 (file)
@@ -1161,6 +1161,7 @@ struct btrfs_root {
 #define BTRFS_MOUNT_SSD_SPREAD         (1 << 8)
 #define BTRFS_MOUNT_NOSSD              (1 << 9)
 #define BTRFS_MOUNT_DISCARD            (1 << 10)
+#define BTRFS_MOUNT_FORCE_COMPRESS      (1 << 11)
 
 #define btrfs_clear_opt(o, opt)                ((o) &= ~BTRFS_MOUNT_##opt)
 #define btrfs_set_opt(o, opt)          ((o) |= BTRFS_MOUNT_##opt)
index 009e3bd18f23d986a685c50f60e3be73a5020f31..2b59201b955ca533bcb10a251df07ff2d7c549d2 100644 (file)
@@ -1982,7 +1982,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
 
        if (!(sb->s_flags & MS_RDONLY)) {
                ret = btrfs_recover_relocation(tree_root);
-               BUG_ON(ret);
+               if (ret < 0) {
+                       printk(KERN_WARNING
+                              "btrfs: failed to recover relocation\n");
+                       err = -EINVAL;
+                       goto fail_trans_kthread;
+               }
        }
 
        location.objectid = BTRFS_FS_TREE_OBJECTID;
@@ -1993,6 +1998,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        if (!fs_info->fs_root)
                goto fail_trans_kthread;
 
+       if (!(sb->s_flags & MS_RDONLY)) {
+               down_read(&fs_info->cleanup_work_sem);
+               btrfs_orphan_cleanup(fs_info->fs_root);
+               up_read(&fs_info->cleanup_work_sem);
+       }
+
        return tree_root;
 
 fail_trans_kthread:
index 56e50137d0e6d066266c074b1e07e10d10cb1b5f..559f72489b3bf02b4477369da854bf371cbbd0e4 100644 (file)
@@ -83,6 +83,17 @@ static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits)
        return (cache->flags & bits) == bits;
 }
 
+void btrfs_get_block_group(struct btrfs_block_group_cache *cache)
+{
+       atomic_inc(&cache->count);
+}
+
+void btrfs_put_block_group(struct btrfs_block_group_cache *cache)
+{
+       if (atomic_dec_and_test(&cache->count))
+               kfree(cache);
+}
+
 /*
  * this adds the block group to the fs_info rb tree for the block group
  * cache
@@ -156,7 +167,7 @@ block_group_cache_tree_search(struct btrfs_fs_info *info, u64 bytenr,
                }
        }
        if (ret)
-               atomic_inc(&ret->count);
+               btrfs_get_block_group(ret);
        spin_unlock(&info->block_group_cache_lock);
 
        return ret;
@@ -407,6 +418,8 @@ err:
 
        put_caching_control(caching_ctl);
        atomic_dec(&block_group->space_info->caching_threads);
+       btrfs_put_block_group(block_group);
+
        return 0;
 }
 
@@ -447,6 +460,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache)
        up_write(&fs_info->extent_commit_sem);
 
        atomic_inc(&cache->space_info->caching_threads);
+       btrfs_get_block_group(cache);
 
        tsk = kthread_run(caching_kthread, cache, "btrfs-cache-%llu\n",
                          cache->key.objectid);
@@ -486,12 +500,6 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(
        return cache;
 }
 
-void btrfs_put_block_group(struct btrfs_block_group_cache *cache)
-{
-       if (atomic_dec_and_test(&cache->count))
-               kfree(cache);
-}
-
 static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
                                                  u64 flags)
 {
@@ -2582,7 +2590,7 @@ next_block_group(struct btrfs_root *root,
        if (node) {
                cache = rb_entry(node, struct btrfs_block_group_cache,
                                 cache_node);
-               atomic_inc(&cache->count);
+               btrfs_get_block_group(cache);
        } else
                cache = NULL;
        spin_unlock(&root->fs_info->block_group_cache_lock);
@@ -4227,7 +4235,7 @@ search:
                u64 offset;
                int cached;
 
-               atomic_inc(&block_group->count);
+               btrfs_get_block_group(block_group);
                search_start = block_group->key.objectid;
 
 have_block_group:
@@ -4315,7 +4323,7 @@ have_block_group:
 
                                btrfs_put_block_group(block_group);
                                block_group = last_ptr->block_group;
-                               atomic_inc(&block_group->count);
+                               btrfs_get_block_group(block_group);
                                spin_unlock(&last_ptr->lock);
                                spin_unlock(&last_ptr->refill_lock);
 
@@ -5394,10 +5402,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
        int ret;
 
        while (level >= 0) {
-               if (path->slots[level] >=
-                   btrfs_header_nritems(path->nodes[level]))
-                       break;
-
                ret = walk_down_proc(trans, root, path, wc, lookup_info);
                if (ret > 0)
                        break;
@@ -5405,6 +5409,10 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
                if (level == 0)
                        break;
 
+               if (path->slots[level] >=
+                   btrfs_header_nritems(path->nodes[level]))
+                       break;
+
                ret = do_walk_down(trans, root, path, wc, &lookup_info);
                if (ret > 0) {
                        path->slots[level]++;
@@ -7395,9 +7403,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
                        wait_block_group_cache_done(block_group);
 
                btrfs_remove_free_space_cache(block_group);
-
-               WARN_ON(atomic_read(&block_group->count) != 1);
-               kfree(block_group);
+               btrfs_put_block_group(block_group);
 
                spin_lock(&info->block_group_cache_lock);
        }
index 96577e8bf9fdb62819ab2dbd5f9da91200624596..b177ed3196126d9fe8e5d0f1507075a421e535b9 100644 (file)
@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
                spin_unlock(&tree->buffer_lock);
                goto free_eb;
        }
-       spin_unlock(&tree->buffer_lock);
-
        /* add one reference for the tree */
        atomic_inc(&eb->refs);
+       spin_unlock(&tree->buffer_lock);
        return eb;
 
 free_eb:
index 46bea0f4dc7bdd4e5f0193ec852aa5354d9d87d7..428fcac45f90ec105226d66de2efe3c4ee43d421 100644 (file)
@@ -155,20 +155,6 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset,
        return NULL;
 }
 
-/*
- * look for an offset in the tree, and if it can't be found, return
- * the first offset we can find smaller than 'offset'.
- */
-static inline struct rb_node *tree_search(struct rb_root *root, u64 offset)
-{
-       struct rb_node *prev;
-       struct rb_node *ret;
-       ret = __tree_search(root, offset, &prev, NULL);
-       if (!ret)
-               return prev;
-       return ret;
-}
-
 /* check to see if two extent_map structs are adjacent and safe to merge */
 static int mergable_maps(struct extent_map *prev, struct extent_map *next)
 {
index feaa13b105d953f1be72c50897fafa6943cd5e50..6ed434ac037faac00117e5d633478bd7a2e0805b 100644 (file)
@@ -506,7 +506,8 @@ next_slot:
 }
 
 static int extent_mergeable(struct extent_buffer *leaf, int slot,
-                           u64 objectid, u64 bytenr, u64 *start, u64 *end)
+                           u64 objectid, u64 bytenr, u64 orig_offset,
+                           u64 *start, u64 *end)
 {
        struct btrfs_file_extent_item *fi;
        struct btrfs_key key;
@@ -522,6 +523,7 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot,
        fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
        if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG ||
            btrfs_file_extent_disk_bytenr(leaf, fi) != bytenr ||
+           btrfs_file_extent_offset(leaf, fi) != key.offset - orig_offset ||
            btrfs_file_extent_compression(leaf, fi) ||
            btrfs_file_extent_encryption(leaf, fi) ||
            btrfs_file_extent_other_encoding(leaf, fi))
@@ -561,6 +563,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
        u64 split;
        int del_nr = 0;
        int del_slot = 0;
+       int recow;
        int ret;
 
        btrfs_drop_extent_cache(inode, start, end - 1, 0);
@@ -568,6 +571,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
        path = btrfs_alloc_path();
        BUG_ON(!path);
 again:
+       recow = 0;
        split = start;
        key.objectid = inode->i_ino;
        key.type = BTRFS_EXTENT_DATA_KEY;
@@ -591,12 +595,60 @@ again:
        bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
        num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi);
        orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi);
+       memcpy(&new_key, &key, sizeof(new_key));
+
+       if (start == key.offset && end < extent_end) {
+               other_start = 0;
+               other_end = start;
+               if (extent_mergeable(leaf, path->slots[0] - 1,
+                                    inode->i_ino, bytenr, orig_offset,
+                                    &other_start, &other_end)) {
+                       new_key.offset = end;
+                       btrfs_set_item_key_safe(trans, root, path, &new_key);
+                       fi = btrfs_item_ptr(leaf, path->slots[0],
+                                           struct btrfs_file_extent_item);
+                       btrfs_set_file_extent_num_bytes(leaf, fi,
+                                                       extent_end - end);
+                       btrfs_set_file_extent_offset(leaf, fi,
+                                                    end - orig_offset);
+                       fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
+                                           struct btrfs_file_extent_item);
+                       btrfs_set_file_extent_num_bytes(leaf, fi,
+                                                       end - other_start);
+                       btrfs_mark_buffer_dirty(leaf);
+                       goto out;
+               }
+       }
+
+       if (start > key.offset && end == extent_end) {
+               other_start = end;
+               other_end = 0;
+               if (extent_mergeable(leaf, path->slots[0] + 1,
+                                    inode->i_ino, bytenr, orig_offset,
+                                    &other_start, &other_end)) {
+                       fi = btrfs_item_ptr(leaf, path->slots[0],
+                                           struct btrfs_file_extent_item);
+                       btrfs_set_file_extent_num_bytes(leaf, fi,
+                                                       start - key.offset);
+                       path->slots[0]++;
+                       new_key.offset = start;
+                       btrfs_set_item_key_safe(trans, root, path, &new_key);
+
+                       fi = btrfs_item_ptr(leaf, path->slots[0],
+                                           struct btrfs_file_extent_item);
+                       btrfs_set_file_extent_num_bytes(leaf, fi,
+                                                       other_end - start);
+                       btrfs_set_file_extent_offset(leaf, fi,
+                                                    start - orig_offset);
+                       btrfs_mark_buffer_dirty(leaf);
+                       goto out;
+               }
+       }
 
        while (start > key.offset || end < extent_end) {
                if (key.offset == start)
                        split = end;
 
-               memcpy(&new_key, &key, sizeof(new_key));
                new_key.offset = split;
                ret = btrfs_duplicate_item(trans, root, path, &new_key);
                if (ret == -EAGAIN) {
@@ -631,15 +683,18 @@ again:
                        path->slots[0]--;
                        extent_end = end;
                }
+               recow = 1;
        }
 
-       fi = btrfs_item_ptr(leaf, path->slots[0],
-                           struct btrfs_file_extent_item);
-
        other_start = end;
        other_end = 0;
-       if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino,
-                            bytenr, &other_start, &other_end)) {
+       if (extent_mergeable(leaf, path->slots[0] + 1,
+                            inode->i_ino, bytenr, orig_offset,
+                            &other_start, &other_end)) {
+               if (recow) {
+                       btrfs_release_path(root, path);
+                       goto again;
+               }
                extent_end = other_end;
                del_slot = path->slots[0] + 1;
                del_nr++;
@@ -650,8 +705,13 @@ again:
        }
        other_start = 0;
        other_end = start;
-       if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino,
-                            bytenr, &other_start, &other_end)) {
+       if (extent_mergeable(leaf, path->slots[0] - 1,
+                            inode->i_ino, bytenr, orig_offset,
+                            &other_start, &other_end)) {
+               if (recow) {
+                       btrfs_release_path(root, path);
+                       goto again;
+               }
                key.offset = other_start;
                del_slot = path->slots[0];
                del_nr++;
@@ -661,21 +721,23 @@ again:
                BUG_ON(ret);
        }
        if (del_nr == 0) {
+               fi = btrfs_item_ptr(leaf, path->slots[0],
+                          struct btrfs_file_extent_item);
                btrfs_set_file_extent_type(leaf, fi,
                                           BTRFS_FILE_EXTENT_REG);
                btrfs_mark_buffer_dirty(leaf);
-               goto out;
-       }
-
-       fi = btrfs_item_ptr(leaf, del_slot - 1,
-                           struct btrfs_file_extent_item);
-       btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG);
-       btrfs_set_file_extent_num_bytes(leaf, fi,
-                                       extent_end - key.offset);
-       btrfs_mark_buffer_dirty(leaf);
+       } else {
+               fi = btrfs_item_ptr(leaf, del_slot - 1,
+                          struct btrfs_file_extent_item);
+               btrfs_set_file_extent_type(leaf, fi,
+                                          BTRFS_FILE_EXTENT_REG);
+               btrfs_set_file_extent_num_bytes(leaf, fi,
+                                               extent_end - key.offset);
+               btrfs_mark_buffer_dirty(leaf);
 
-       ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
-       BUG_ON(ret);
+               ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
+               BUG_ON(ret);
+       }
 out:
        btrfs_free_path(path);
        return 0;
@@ -1073,7 +1135,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
        }
        mutex_lock(&dentry->d_inode->i_mutex);
 out:
-       return ret > 0 ? EIO : ret;
+       return ret > 0 ? -EIO : ret;
 }
 
 static const struct vm_operations_struct btrfs_file_vm_ops = {
index 5440bab2363565e5c50399eb32b9f6e8ed103728..4deb280f8969b78e373257d394106895d0ea82a6 100644 (file)
@@ -483,7 +483,8 @@ again:
                nr_pages_ret = 0;
 
                /* flag the file so we don't compress in the future */
-               BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
+               if (!btrfs_test_opt(root, FORCE_COMPRESS))
+                       BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
        }
        if (will_compress) {
                *num_added += 1;
@@ -1680,24 +1681,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
  * before we start the transaction.  It limits the amount of btree
  * reads required while inside the transaction.
  */
-static noinline void reada_csum(struct btrfs_root *root,
-                               struct btrfs_path *path,
-                               struct btrfs_ordered_extent *ordered_extent)
-{
-       struct btrfs_ordered_sum *sum;
-       u64 bytenr;
-
-       sum = list_entry(ordered_extent->list.next, struct btrfs_ordered_sum,
-                        list);
-       bytenr = sum->sums[0].bytenr;
-
-       /*
-        * we don't care about the results, the point of this search is
-        * just to get the btree leaves into ram
-        */
-       btrfs_lookup_csum(NULL, root->fs_info->csum_root, path, bytenr, 0);
-}
-
 /* as ordered data IO finishes, this gets called so we can finish
  * an ordered extent if the range of bytes in the file it covers are
  * fully written.
@@ -1708,7 +1691,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
        struct btrfs_trans_handle *trans;
        struct btrfs_ordered_extent *ordered_extent = NULL;
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
-       struct btrfs_path *path;
        int compressed = 0;
        int ret;
 
@@ -1716,32 +1698,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
        if (!ret)
                return 0;
 
-       /*
-        * before we join the transaction, try to do some of our IO.
-        * This will limit the amount of IO that we have to do with
-        * the transaction running.  We're unlikely to need to do any
-        * IO if the file extents are new, the disk_i_size checks
-        * covers the most common case.
-        */
-       if (start < BTRFS_I(inode)->disk_i_size) {
-               path = btrfs_alloc_path();
-               if (path) {
-                       ret = btrfs_lookup_file_extent(NULL, root, path,
-                                                      inode->i_ino,
-                                                      start, 0);
-                       ordered_extent = btrfs_lookup_ordered_extent(inode,
-                                                                    start);
-                       if (!list_empty(&ordered_extent->list)) {
-                               btrfs_release_path(root, path);
-                               reada_csum(root, path, ordered_extent);
-                       }
-                       btrfs_free_path(path);
-               }
-       }
-
-       if (!ordered_extent)
-               ordered_extent = btrfs_lookup_ordered_extent(inode, start);
+       ordered_extent = btrfs_lookup_ordered_extent(inode, start);
        BUG_ON(!ordered_extent);
+
        if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
                BUG_ON(!list_empty(&ordered_extent->list));
                ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent);
@@ -3995,7 +3954,11 @@ skip:
 
        /* Reached end of directory/root. Bump pos past the last item. */
        if (key_type == BTRFS_DIR_INDEX_KEY)
-               filp->f_pos = INT_LIMIT(off_t);
+               /*
+                * 32-bit glibc will use getdents64, but then strtol -
+                * so the last number we can serve is this.
+                */
+               filp->f_pos = 0x7fffffff;
        else
                filp->f_pos++;
 nopos:
@@ -5789,7 +5752,7 @@ out_fail:
 }
 
 static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
-                              u64 alloc_hint, int mode)
+                       u64 alloc_hint, int mode, loff_t actual_len)
 {
        struct btrfs_trans_handle *trans;
        struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -5798,6 +5761,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
        u64 cur_offset = start;
        u64 num_bytes = end - start;
        int ret = 0;
+       u64 i_size;
 
        while (num_bytes > 0) {
                alloc_size = min(num_bytes, root->fs_info->max_extent);
@@ -5835,9 +5799,15 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
                inode->i_ctime = CURRENT_TIME;
                BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
                if (!(mode & FALLOC_FL_KEEP_SIZE) &&
-                   cur_offset > inode->i_size) {
-                       i_size_write(inode, cur_offset);
-                       btrfs_ordered_update_i_size(inode, cur_offset, NULL);
+                       (actual_len > inode->i_size) &&
+                       (cur_offset > inode->i_size)) {
+
+                       if (cur_offset > actual_len)
+                               i_size  = actual_len;
+                       else
+                               i_size = cur_offset;
+                       i_size_write(inode, i_size);
+                       btrfs_ordered_update_i_size(inode, i_size, NULL);
                }
 
                ret = btrfs_update_inode(trans, root, inode);
@@ -5930,7 +5900,7 @@ static long btrfs_fallocate(struct inode *inode, int mode,
                     !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) {
                        ret = prealloc_file_range(inode,
                                                  cur_offset, last_byte,
-                                                 alloc_hint, mode);
+                                               alloc_hint, mode, offset+len);
                        if (ret < 0) {
                                free_extent_map(em);
                                break;
index b10a49d4bc6a258d1439825388e4685fbb7abb8a..5c2a9e78a949a03ff239db3b99843c258ce7cd84 100644 (file)
@@ -626,6 +626,8 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
 
        if (ordered)
                offset = entry_end(ordered);
+       else
+               offset = ALIGN(offset, BTRFS_I(inode)->root->sectorsize);
 
        mutex_lock(&tree->mutex);
        disk_i_size = BTRFS_I(inode)->disk_i_size;
index a9728680eca8ed299deb7fc322be97deeeb6f51b..ab7ab53187452aa7794bfcdfb5596385d3cc77b2 100644 (file)
@@ -3281,8 +3281,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
                return -ENOMEM;
 
        path = btrfs_alloc_path();
-       if (!path)
+       if (!path) {
+               kfree(cluster);
                return -ENOMEM;
+       }
 
        rc->extents_found = 0;
        rc->extents_skipped = 0;
@@ -3762,7 +3764,8 @@ out:
                                       BTRFS_DATA_RELOC_TREE_OBJECTID);
                if (IS_ERR(fs_root))
                        err = PTR_ERR(fs_root);
-               btrfs_orphan_cleanup(fs_root);
+               else
+                       btrfs_orphan_cleanup(fs_root);
        }
        return err;
 }
index 3f9b45704fcdfb83eeda6a55740c56de7a048ce5..8a1ea6e64575a34c507c29cd8c84ec4944885583 100644 (file)
@@ -66,7 +66,8 @@ enum {
        Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow,
        Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
        Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl,
-       Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
+       Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio,
+       Opt_flushoncommit,
        Opt_discard, Opt_err,
 };
 
@@ -82,6 +83,7 @@ static match_table_t tokens = {
        {Opt_alloc_start, "alloc_start=%s"},
        {Opt_thread_pool, "thread_pool=%d"},
        {Opt_compress, "compress"},
+       {Opt_compress_force, "compress-force"},
        {Opt_ssd, "ssd"},
        {Opt_ssd_spread, "ssd_spread"},
        {Opt_nossd, "nossd"},
@@ -173,6 +175,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                        printk(KERN_INFO "btrfs: use compression\n");
                        btrfs_set_opt(info->mount_opt, COMPRESS);
                        break;
+               case Opt_compress_force:
+                       printk(KERN_INFO "btrfs: forcing compression\n");
+                       btrfs_set_opt(info->mount_opt, FORCE_COMPRESS);
+                       btrfs_set_opt(info->mount_opt, COMPRESS);
+                       break;
                case Opt_ssd:
                        printk(KERN_INFO "btrfs: use ssd allocation scheme\n");
                        btrfs_set_opt(info->mount_opt, SSD);
index 198cff28766d494f3a919673775fe679d560722f..41ecbb2347f2d3171f7645782ab4e5a39621c84d 100644 (file)
@@ -1135,7 +1135,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
                root->fs_info->avail_metadata_alloc_bits;
 
        if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) &&
-           root->fs_info->fs_devices->rw_devices <= 4) {
+           root->fs_info->fs_devices->num_devices <= 4) {
                printk(KERN_ERR "btrfs: unable to go below four devices "
                       "on raid10\n");
                ret = -EINVAL;
@@ -1143,7 +1143,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
        }
 
        if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) &&
-           root->fs_info->fs_devices->rw_devices <= 2) {
+           root->fs_info->fs_devices->num_devices <= 2) {
                printk(KERN_ERR "btrfs: unable to go below two "
                       "devices on raid1\n");
                ret = -EINVAL;
@@ -1434,8 +1434,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
                return -EINVAL;
 
        bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder);
-       if (!bdev)
-               return -EIO;
+       if (IS_ERR(bdev))
+               return PTR_ERR(bdev);
 
        if (root->fs_info->fs_devices->seeding) {
                seeding_dev = 1;
@@ -2538,6 +2538,11 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
        if (!em)
                return 1;
 
+       if (btrfs_test_opt(root, DEGRADED)) {
+               free_extent_map(em);
+               return 0;
+       }
+
        map = (struct map_lookup *)em->bdev;
        for (i = 0; i < map->num_stripes; i++) {
                if (!map->stripes[i].dev->writeable) {
@@ -2649,8 +2654,10 @@ again:
        em = lookup_extent_mapping(em_tree, logical, *length);
        read_unlock(&em_tree->lock);
 
-       if (!em && unplug_page)
+       if (!em && unplug_page) {
+               kfree(multi);
                return 0;
+       }
 
        if (!em) {
                printk(KERN_CRIT "unable to find logical %llu len %llu\n",
index 14ac4806e2913f8c37e76d95dc1d0274f4bbd027..eeb4986ea7db7cbb65b0b48685ae0a0d3f6a1a7e 100644 (file)
@@ -348,7 +348,17 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
        dir = dget_parent(object->dentry);
 
        mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
-       ret = cachefiles_bury_object(cache, dir, object->dentry);
+
+       /* we need to check that our parent is _still_ our parent - it may have
+        * been renamed */
+       if (dir == object->dentry->d_parent) {
+               ret = cachefiles_bury_object(cache, dir, object->dentry);
+       } else {
+               /* it got moved, presumably by cachefilesd culling it, so it's
+                * no longer in the key path and we can ignore it */
+               mutex_unlock(&dir->d_inode->i_mutex);
+               ret = 0;
+       }
 
        dput(dir);
        _leave(" = %d", ret);
index 7b2600b380d7c74f4aa398378012cf1e8bccfed7..49503d2edc7eb74ff8277f946979c7b183ec1def 100644 (file)
@@ -1,3 +1,7 @@
+Version 1.62
+------------
+Add sockopt=TCP_NODELAY mount option.
+
 Version 1.61
 ------------
 Fix append problem to Samba servers (files opened with O_APPEND could
index fea9e898c4ba52ef453eda892115908f0290d2d9..b44ce0a0711c9d4bb98670d82ee45d14bf192093 100644 (file)
@@ -269,7 +269,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
        int err;
 
        mntget(newmnt);
-       err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
+       err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags | MNT_SHRINKABLE, mntlist);
        switch (err) {
        case 0:
                path_put(&nd->path);
@@ -371,7 +371,6 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
        if (IS_ERR(mnt))
                goto out_err;
 
-       nd->path.mnt->mnt_flags |= MNT_SHRINKABLE;
        rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list);
 
 out:
index ac2b24c192f881d229ccf5fb64e99dfe07b2a76a..78c1b86d55f6fcf3a42eeec70968e9f7efc69b3b 100644 (file)
@@ -113,5 +113,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
 extern const struct export_operations cifs_export_ops;
 #endif /* EXPERIMENTAL */
 
-#define CIFS_VERSION   "1.61"
+#define CIFS_VERSION   "1.62"
 #endif                         /* _CIFSFS_H */
index 4b35f7ec0583148ac0fe00c3ebf388c83dbb3ebf..ed751bb657db1a1961a0c590a56f0386c926b8b0 100644 (file)
@@ -149,6 +149,7 @@ struct TCP_Server_Info {
        bool svlocal:1;                 /* local server or remote */
        bool noblocksnd;                /* use blocking sendmsg */
        bool noautotune;                /* do not autotune send buf sizes */
+       bool tcp_nodelay;
        atomic_t inFlight;  /* number of requests on the wire to server */
 #ifdef CONFIG_CIFS_STATS2
        atomic_t inSend; /* requests trying to send */
index 3bbcaa716b3c7afb18ee5826261ed11e5cb32aed..2e9e09ca0e30ef8eb2555cffd8298276e0bf04f0 100644 (file)
@@ -98,7 +98,7 @@ struct smb_vol {
        bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
        unsigned int rsize;
        unsigned int wsize;
-       unsigned int sockopt;
+       bool sockopt_tcp_nodelay:1;
        unsigned short int port;
        char *prepath;
 };
@@ -1142,9 +1142,11 @@ cifs_parse_mount_options(char *options, const char *devname,
                                        simple_strtoul(value, &value, 0);
                        }
                } else if (strnicmp(data, "sockopt", 5) == 0) {
-                       if (value && *value) {
-                               vol->sockopt =
-                                       simple_strtoul(value, &value, 0);
+                       if (!value || !*value) {
+                               cERROR(1, ("no socket option specified"));
+                               continue;
+                       } else if (strnicmp(value, "TCP_NODELAY", 11) == 0) {
+                               vol->sockopt_tcp_nodelay = 1;
                        }
                } else if (strnicmp(data, "netbiosname", 4) == 0) {
                        if (!value || !*value || (*value == ' ')) {
@@ -1514,6 +1516,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
 
        tcp_ses->noblocksnd = volume_info->noblocksnd;
        tcp_ses->noautotune = volume_info->noautotune;
+       tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
        atomic_set(&tcp_ses->inFlight, 0);
        init_waitqueue_head(&tcp_ses->response_q);
        init_waitqueue_head(&tcp_ses->request_q);
@@ -1764,6 +1767,7 @@ static int
 ipv4_connect(struct TCP_Server_Info *server)
 {
        int rc = 0;
+       int val;
        bool connected = false;
        __be16 orig_port = 0;
        struct socket *socket = server->ssocket;
@@ -1845,6 +1849,14 @@ ipv4_connect(struct TCP_Server_Info *server)
                        socket->sk->sk_rcvbuf = 140 * 1024;
        }
 
+       if (server->tcp_nodelay) {
+               val = 1;
+               rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY,
+                               (char *)&val, sizeof(val));
+               if (rc)
+                       cFYI(1, ("set TCP_NODELAY socket option error %d", rc));
+       }
+
         cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx",
                 socket->sk->sk_sndbuf,
                 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo));
@@ -1916,6 +1928,7 @@ static int
 ipv6_connect(struct TCP_Server_Info *server)
 {
        int rc = 0;
+       int val;
        bool connected = false;
        __be16 orig_port = 0;
        struct socket *socket = server->ssocket;
@@ -1987,6 +2000,15 @@ ipv6_connect(struct TCP_Server_Info *server)
         */
        socket->sk->sk_rcvtimeo = 7 * HZ;
        socket->sk->sk_sndtimeo = 5 * HZ;
+
+       if (server->tcp_nodelay) {
+               val = 1;
+               rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY,
+                               (char *)&val, sizeof(val));
+               if (rc)
+                       cFYI(1, ("set TCP_NODELAY socket option error %d", rc));
+       }
+
        server->ssocket = socket;
 
        return rc;
index cf18ee7655902210240ea0c5281e546370b9d22d..e3fda978f4816eca17b9f5e4194fd161a224c5fe 100644 (file)
@@ -1762,8 +1762,18 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
        }
 
-       if (!rc)
+       if (!rc) {
                rc = inode_setattr(inode, attrs);
+
+               /* force revalidate when any of these times are set since some
+                  of the fs types (eg ext3, fat) do not have fine enough
+                  time granularity to match protocol, and we do not have a
+                  a way (yet) to query the server fs's time granularity (and
+                  whether it rounds times down).
+               */
+               if (!rc && (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME)))
+                       cifsInode->time = 0;
+       }
 out:
        kfree(args);
        kfree(full_path);
index f84062f9a9850a9fa4f38a5b4ec9f657c42ae474..c343b14ba2d3eea99e7de45c7eed87311668e873 100644 (file)
@@ -77,6 +77,11 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
 
        cFYI(1, ("For %s", name->name));
 
+       if (parent->d_op && parent->d_op->d_hash)
+               parent->d_op->d_hash(parent, name);
+       else
+               name->hash = full_name_hash(name->name, name->len);
+
        dentry = d_lookup(parent, name);
        if (dentry) {
                /* FIXME: check for inode number changes? */
@@ -666,12 +671,11 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
                                           min(len, max_len), nlt,
                                           cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
+               pqst->len -= nls_nullsize(nlt);
        } else {
                pqst->name = filename;
                pqst->len = len;
        }
-       pqst->hash = full_name_hash(pqst->name, pqst->len);
-/*     cFYI(1, ("filldir on %s",pqst->name));  */
        return rc;
 }
 
index 7085a6275c4c9f0635383033dde2ee572bb046b0..aaa9c1c5a5bd243e398b96fe6a278c85595c64c9 100644 (file)
@@ -223,9 +223,9 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
                /* null user mount */
                *bcc_ptr = 0;
                *(bcc_ptr+1) = 0;
-       } else { /* 300 should be long enough for any conceivable user name */
+       } else {
                bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->userName,
-                                         300, nls_cp);
+                                         MAX_USERNAME_SIZE, nls_cp);
        }
        bcc_ptr += 2 * bytes_ret;
        bcc_ptr += 2; /* account for null termination */
@@ -246,11 +246,10 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
        /* copy user */
        if (ses->userName == NULL) {
                /* BB what about null user mounts - check that we do this BB */
-       } else { /* 300 should be long enough for any conceivable user name */
-               strncpy(bcc_ptr, ses->userName, 300);
+       } else {
+               strncpy(bcc_ptr, ses->userName, MAX_USERNAME_SIZE);
        }
-       /* BB improve check for overflow */
-       bcc_ptr += strnlen(ses->userName, 300);
+       bcc_ptr += strnlen(ses->userName, MAX_USERNAME_SIZE);
        *bcc_ptr = 0;
        bcc_ptr++; /* account for null termination */
 
index 332dd00f08944c375f2f335dff4dcb3bfd5b3ab5..0ca9ec4a79c3146355f5f206fbaa4524c256ca08 100644 (file)
@@ -301,6 +301,12 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd,
        u32 data;
        void __user *dxferp;
        int err;
+       int interface_id;
+
+       if (get_user(interface_id, &sgio32->interface_id))
+               return -EFAULT;
+       if (interface_id != 'S')
+               return sys_ioctl(fd, cmd, (unsigned long)sgio32);
 
        if (get_user(iovec_count, &sgio32->iovec_count))
                return -EFAULT;
@@ -936,6 +942,7 @@ COMPATIBLE_IOCTL(TCSETSF)
 COMPATIBLE_IOCTL(TIOCLINUX)
 COMPATIBLE_IOCTL(TIOCSBRK)
 COMPATIBLE_IOCTL(TIOCCBRK)
+COMPATIBLE_IOCTL(TIOCGSID)
 COMPATIBLE_IOCTL(TIOCGICOUNT)
 /* Little t */
 COMPATIBLE_IOCTL(TIOCGETD)
@@ -1005,6 +1012,9 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND)
 COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST)
 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI)
 #endif
+/* Big V (don't complain on serial console) */
+IGNORE_IOCTL(VT_OPENQRY)
+IGNORE_IOCTL(VT_GETMODE)
 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
 COMPATIBLE_IOCTL(RTC_AIE_ON)
 COMPATIBLE_IOCTL(RTC_AIE_OFF)
@@ -1035,6 +1045,8 @@ COMPATIBLE_IOCTL(FIOQSIZE)
 #ifdef CONFIG_BLOCK
 /* loop */
 IGNORE_IOCTL(LOOP_CLR_FD)
+/* md calls this on random blockdevs */
+IGNORE_IOCTL(RAID_VERSION)
 /* SG stuff */
 COMPATIBLE_IOCTL(SG_SET_TIMEOUT)
 COMPATIBLE_IOCTL(SG_GET_TIMEOUT)
index c8afa6b1d91d67e73266c2e3287c63f23c9d1be9..32a5f46b11578d2f0b319379cc8f2b940508a2f4 100644 (file)
@@ -121,8 +121,10 @@ static int get_target(const char *symname, struct path *path,
                                ret = -ENOENT;
                                path_put(path);
                        }
-               } else
+               } else {
                        ret = -EPERM;
+                       path_put(path);
+               }
        }
 
        return ret;
index b486169f42bf997e9e620f12996f7711070140e2..274ac865bae8c776180bc28a19d589f902a090c0 100644 (file)
@@ -160,15 +160,8 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
         * block. A pointer to that is in the struct vfsmount that we
         * have around.
         */
-       if (!parent) {
-               if (debugfs_mount && debugfs_mount->mnt_sb) {
-                       parent = debugfs_mount->mnt_sb->s_root;
-               }
-       }
-       if (!parent) {
-               pr_debug("debugfs: Ah! can not find a parent!\n");
-               return -EFAULT;
-       }
+       if (!parent)
+               parent = debugfs_mount->mnt_sb->s_root;
 
        *dentry = NULL;
        mutex_lock(&parent->d_inode->i_mutex);
index dc2ad6008b2d08a354ce23507c44febb121b6466..4314f0d48d85668e0d0af943cdb2b7d8fde4863a 100644 (file)
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -33,10 +33,10 @@ void dlm_del_ast(struct dlm_lkb *lkb)
        spin_unlock(&ast_queue_lock);
 }
 
-void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
+void dlm_add_ast(struct dlm_lkb *lkb, int type, int mode)
 {
        if (lkb->lkb_flags & DLM_IFL_USER) {
-               dlm_user_add_ast(lkb, type, bastmode);
+               dlm_user_add_ast(lkb, type, mode);
                return;
        }
 
@@ -44,10 +44,21 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
        if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) {
                kref_get(&lkb->lkb_ref);
                list_add_tail(&lkb->lkb_astqueue, &ast_queue);
+               lkb->lkb_ast_first = type;
        }
+
+       /* sanity check, this should not happen */
+
+       if ((type == AST_COMP) && (lkb->lkb_ast_type & AST_COMP))
+               log_print("repeat cast %d castmode %d lock %x %s",
+                         mode, lkb->lkb_castmode,
+                         lkb->lkb_id, lkb->lkb_resource->res_name);
+
        lkb->lkb_ast_type |= type;
-       if (bastmode)
-               lkb->lkb_bastmode = bastmode;
+       if (type == AST_BAST)
+               lkb->lkb_bastmode = mode;
+       else
+               lkb->lkb_castmode = mode;
        spin_unlock(&ast_queue_lock);
 
        set_bit(WAKE_ASTS, &astd_wakeflags);
@@ -59,9 +70,9 @@ static void process_asts(void)
        struct dlm_ls *ls = NULL;
        struct dlm_rsb *r = NULL;
        struct dlm_lkb *lkb;
-       void (*cast) (void *astparam);
-       void (*bast) (void *astparam, int mode);
-       int type = 0, bastmode;
+       void (*castfn) (void *astparam);
+       void (*bastfn) (void *astparam, int mode);
+       int type, first, bastmode, castmode, do_bast, do_cast, last_castmode;
 
 repeat:
        spin_lock(&ast_queue_lock);
@@ -75,17 +86,48 @@ repeat:
                list_del(&lkb->lkb_astqueue);
                type = lkb->lkb_ast_type;
                lkb->lkb_ast_type = 0;
+               first = lkb->lkb_ast_first;
+               lkb->lkb_ast_first = 0;
                bastmode = lkb->lkb_bastmode;
-
+               castmode = lkb->lkb_castmode;
+               castfn = lkb->lkb_astfn;
+               bastfn = lkb->lkb_bastfn;
                spin_unlock(&ast_queue_lock);
-               cast = lkb->lkb_astfn;
-               bast = lkb->lkb_bastfn;
-
-               if ((type & AST_COMP) && cast)
-                       cast(lkb->lkb_astparam);
 
-               if ((type & AST_BAST) && bast)
-                       bast(lkb->lkb_astparam, bastmode);
+               do_cast = (type & AST_COMP) && castfn;
+               do_bast = (type & AST_BAST) && bastfn;
+
+               /* Skip a bast if its blocking mode is compatible with the
+                  granted mode of the preceding cast. */
+
+               if (do_bast) {
+                       if (first == AST_COMP)
+                               last_castmode = castmode;
+                       else
+                               last_castmode = lkb->lkb_castmode_done;
+                       if (dlm_modes_compat(bastmode, last_castmode))
+                               do_bast = 0;
+               }
+
+               if (first == AST_COMP) {
+                       if (do_cast)
+                               castfn(lkb->lkb_astparam);
+                       if (do_bast)
+                               bastfn(lkb->lkb_astparam, bastmode);
+               } else if (first == AST_BAST) {
+                       if (do_bast)
+                               bastfn(lkb->lkb_astparam, bastmode);
+                       if (do_cast)
+                               castfn(lkb->lkb_astparam);
+               } else {
+                       log_error(ls, "bad ast_first %d ast_type %d",
+                                 first, type);
+               }
+
+               if (do_cast)
+                       lkb->lkb_castmode_done = castmode;
+               if (do_bast)
+                       lkb->lkb_bastmode_done = bastmode;
 
                /* this removes the reference added by dlm_add_ast
                   and may result in the lkb being freed */
index 1b5fc5f428fdd2d0dc01050be27de84c65a2b659..bcb1aaba519d97c031b06b356e7aa9051a7ecb76 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2005-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2005-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -13,7 +13,7 @@
 #ifndef __ASTD_DOT_H__
 #define __ASTD_DOT_H__
 
-void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode);
+void dlm_add_ast(struct dlm_lkb *lkb, int type, int mode);
 void dlm_del_ast(struct dlm_lkb *lkb);
 
 void dlm_astd_wake(void);
index 375a2359b3bfa526fd6c4950a024dfd83ce98d56..29d6139c35fcc1b3b51f62082a778ec3c5018038 100644 (file)
@@ -256,7 +256,7 @@ static int print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb,
                        lkb->lkb_status,
                        lkb->lkb_grmode,
                        lkb->lkb_rqmode,
-                       lkb->lkb_highbast,
+                       lkb->lkb_bastmode,
                        rsb_lookup,
                        lkb->lkb_wait_type,
                        lkb->lkb_lvbseq,
index 826d3dc6e0ab50db977500844ddc62cdcede83ad..f632b58cd2221c71fd7c6454cf70f9d17dfa7e1e 100644 (file)
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -232,11 +232,17 @@ struct dlm_lkb {
        int8_t                  lkb_status;     /* granted, waiting, convert */
        int8_t                  lkb_rqmode;     /* requested lock mode */
        int8_t                  lkb_grmode;     /* granted lock mode */
-       int8_t                  lkb_bastmode;   /* requested mode */
        int8_t                  lkb_highbast;   /* highest mode bast sent for */
+
        int8_t                  lkb_wait_type;  /* type of reply waiting for */
        int8_t                  lkb_wait_count;
        int8_t                  lkb_ast_type;   /* type of ast queued for */
+       int8_t                  lkb_ast_first;  /* type of first ast queued */
+
+       int8_t                  lkb_bastmode;   /* req mode of queued bast */
+       int8_t                  lkb_castmode;   /* gr mode of queued cast */
+       int8_t                  lkb_bastmode_done; /* last delivered bastmode */
+       int8_t                  lkb_castmode_done; /* last delivered castmode */
 
        struct list_head        lkb_idtbl_list; /* lockspace lkbtbl */
        struct list_head        lkb_statequeue; /* rsb g/c/w list */
index 9c0c1db1e10534aa2a44b9634ff9790859d542cc..46ffd3eeaaf7350cf1b9b5969722abfe2f9a89b7 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2005-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2005-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -307,7 +307,7 @@ static void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv)
        lkb->lkb_lksb->sb_status = rv;
        lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags;
 
-       dlm_add_ast(lkb, AST_COMP, 0);
+       dlm_add_ast(lkb, AST_COMP, lkb->lkb_grmode);
 }
 
 static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb)
@@ -320,10 +320,12 @@ static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode)
 {
        lkb->lkb_time_bast = ktime_get();
 
-       if (is_master_copy(lkb))
+       if (is_master_copy(lkb)) {
+               lkb->lkb_bastmode = rqmode; /* printed by debugfs */
                send_bast(r, lkb, rqmode);
-       else
+       } else {
                dlm_add_ast(lkb, AST_BAST, rqmode);
+       }
 }
 
 /*
@@ -2280,20 +2282,30 @@ static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb)
        if (can_be_queued(lkb)) {
                error = -EINPROGRESS;
                add_lkb(r, lkb, DLM_LKSTS_WAITING);
-               send_blocking_asts(r, lkb);
                add_timeout(lkb);
                goto out;
        }
 
        error = -EAGAIN;
-       if (force_blocking_asts(lkb))
-               send_blocking_asts_all(r, lkb);
        queue_cast(r, lkb, -EAGAIN);
-
  out:
        return error;
 }
 
+static void do_request_effects(struct dlm_rsb *r, struct dlm_lkb *lkb,
+                              int error)
+{
+       switch (error) {
+       case -EAGAIN:
+               if (force_blocking_asts(lkb))
+                       send_blocking_asts_all(r, lkb);
+               break;
+       case -EINPROGRESS:
+               send_blocking_asts(r, lkb);
+               break;
+       }
+}
+
 static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
        int error = 0;
@@ -2304,7 +2316,6 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
        if (can_be_granted(r, lkb, 1, &deadlk)) {
                grant_lock(r, lkb);
                queue_cast(r, lkb, 0);
-               grant_pending_locks(r);
                goto out;
        }
 
@@ -2334,7 +2345,6 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
                if (_can_be_granted(r, lkb, 1)) {
                        grant_lock(r, lkb);
                        queue_cast(r, lkb, 0);
-                       grant_pending_locks(r);
                        goto out;
                }
                /* else fall through and move to convert queue */
@@ -2344,28 +2354,47 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
                error = -EINPROGRESS;
                del_lkb(r, lkb);
                add_lkb(r, lkb, DLM_LKSTS_CONVERT);
-               send_blocking_asts(r, lkb);
                add_timeout(lkb);
                goto out;
        }
 
        error = -EAGAIN;
-       if (force_blocking_asts(lkb))
-               send_blocking_asts_all(r, lkb);
        queue_cast(r, lkb, -EAGAIN);
-
  out:
        return error;
 }
 
+static void do_convert_effects(struct dlm_rsb *r, struct dlm_lkb *lkb,
+                              int error)
+{
+       switch (error) {
+       case 0:
+               grant_pending_locks(r);
+               /* grant_pending_locks also sends basts */
+               break;
+       case -EAGAIN:
+               if (force_blocking_asts(lkb))
+                       send_blocking_asts_all(r, lkb);
+               break;
+       case -EINPROGRESS:
+               send_blocking_asts(r, lkb);
+               break;
+       }
+}
+
 static int do_unlock(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
        remove_lock(r, lkb);
        queue_cast(r, lkb, -DLM_EUNLOCK);
-       grant_pending_locks(r);
        return -DLM_EUNLOCK;
 }
 
+static void do_unlock_effects(struct dlm_rsb *r, struct dlm_lkb *lkb,
+                             int error)
+{
+       grant_pending_locks(r);
+}
+
 /* returns: 0 did nothing, -DLM_ECANCEL canceled lock */
  
 static int do_cancel(struct dlm_rsb *r, struct dlm_lkb *lkb)
@@ -2375,12 +2404,18 @@ static int do_cancel(struct dlm_rsb *r, struct dlm_lkb *lkb)
        error = revert_lock(r, lkb);
        if (error) {
                queue_cast(r, lkb, -DLM_ECANCEL);
-               grant_pending_locks(r);
                return -DLM_ECANCEL;
        }
        return 0;
 }
 
+static void do_cancel_effects(struct dlm_rsb *r, struct dlm_lkb *lkb,
+                             int error)
+{
+       if (error)
+               grant_pending_locks(r);
+}
+
 /*
  * Four stage 3 varieties:
  * _request_lock(), _convert_lock(), _unlock_lock(), _cancel_lock()
@@ -2402,11 +2437,15 @@ static int _request_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
                goto out;
        }
 
-       if (is_remote(r))
+       if (is_remote(r)) {
                /* receive_request() calls do_request() on remote node */
                error = send_request(r, lkb);
-       else
+       } else {
                error = do_request(r, lkb);
+               /* for remote locks the request_reply is sent
+                  between do_request and do_request_effects */
+               do_request_effects(r, lkb, error);
+       }
  out:
        return error;
 }
@@ -2417,11 +2456,15 @@ static int _convert_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
        int error;
 
-       if (is_remote(r))
+       if (is_remote(r)) {
                /* receive_convert() calls do_convert() on remote node */
                error = send_convert(r, lkb);
-       else
+       } else {
                error = do_convert(r, lkb);
+               /* for remote locks the convert_reply is sent
+                  between do_convert and do_convert_effects */
+               do_convert_effects(r, lkb, error);
+       }
 
        return error;
 }
@@ -2432,11 +2475,15 @@ static int _unlock_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
        int error;
 
-       if (is_remote(r))
+       if (is_remote(r)) {
                /* receive_unlock() calls do_unlock() on remote node */
                error = send_unlock(r, lkb);
-       else
+       } else {
                error = do_unlock(r, lkb);
+               /* for remote locks the unlock_reply is sent
+                  between do_unlock and do_unlock_effects */
+               do_unlock_effects(r, lkb, error);
+       }
 
        return error;
 }
@@ -2447,11 +2494,15 @@ static int _cancel_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
        int error;
 
-       if (is_remote(r))
+       if (is_remote(r)) {
                /* receive_cancel() calls do_cancel() on remote node */
                error = send_cancel(r, lkb);
-       else
+       } else {
                error = do_cancel(r, lkb);
+               /* for remote locks the cancel_reply is sent
+                  between do_cancel and do_cancel_effects */
+               do_cancel_effects(r, lkb, error);
+       }
 
        return error;
 }
@@ -3191,6 +3242,7 @@ static void receive_request(struct dlm_ls *ls, struct dlm_message *ms)
        attach_lkb(r, lkb);
        error = do_request(r, lkb);
        send_request_reply(r, lkb, error);
+       do_request_effects(r, lkb, error);
 
        unlock_rsb(r);
        put_rsb(r);
@@ -3226,15 +3278,19 @@ static void receive_convert(struct dlm_ls *ls, struct dlm_message *ms)
                goto out;
 
        receive_flags(lkb, ms);
+
        error = receive_convert_args(ls, lkb, ms);
-       if (error)
-               goto out_reply;
+       if (error) {
+               send_convert_reply(r, lkb, error);
+               goto out;
+       }
+
        reply = !down_conversion(lkb);
 
        error = do_convert(r, lkb);
- out_reply:
        if (reply)
                send_convert_reply(r, lkb, error);
+       do_convert_effects(r, lkb, error);
  out:
        unlock_rsb(r);
        put_rsb(r);
@@ -3266,13 +3322,16 @@ static void receive_unlock(struct dlm_ls *ls, struct dlm_message *ms)
                goto out;
 
        receive_flags(lkb, ms);
+
        error = receive_unlock_args(ls, lkb, ms);
-       if (error)
-               goto out_reply;
+       if (error) {
+               send_unlock_reply(r, lkb, error);
+               goto out;
+       }
 
        error = do_unlock(r, lkb);
- out_reply:
        send_unlock_reply(r, lkb, error);
+       do_unlock_effects(r, lkb, error);
  out:
        unlock_rsb(r);
        put_rsb(r);
@@ -3307,6 +3366,7 @@ static void receive_cancel(struct dlm_ls *ls, struct dlm_message *ms)
 
        error = do_cancel(r, lkb);
        send_cancel_reply(r, lkb, error);
+       do_cancel_effects(r, lkb, error);
  out:
        unlock_rsb(r);
        put_rsb(r);
index c010ecfc0d295525de2455b02bf8a94dd8dbedea..26a8bd40400af4418d7ea9f7b6a6d6605c54f287 100644 (file)
@@ -191,6 +191,18 @@ static int do_uevent(struct dlm_ls *ls, int in)
        return error;
 }
 
+static int dlm_uevent(struct kset *kset, struct kobject *kobj,
+                     struct kobj_uevent_env *env)
+{
+       struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);
+
+       add_uevent_var(env, "LOCKSPACE=%s", ls->ls_name);
+       return 0;
+}
+
+static struct kset_uevent_ops dlm_uevent_ops = {
+       .uevent = dlm_uevent,
+};
 
 int __init dlm_lockspace_init(void)
 {
@@ -199,7 +211,7 @@ int __init dlm_lockspace_init(void)
        INIT_LIST_HEAD(&lslist);
        spin_lock_init(&lslist_lock);
 
-       dlm_kset = kset_create_and_add("dlm", NULL, kernel_kobj);
+       dlm_kset = kset_create_and_add("dlm", &dlm_uevent_ops, kernel_kobj);
        if (!dlm_kset) {
                printk(KERN_WARNING "%s: can not create kset\n", __func__);
                return -ENOMEM;
index e73a4bb572aa2de896c3e493bf7545f8f2358434..a4bfd31ac45bec4ad5e1010e0ad6a386a338f18b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2009 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2006-2010 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -173,7 +173,7 @@ static int lkb_is_endoflife(struct dlm_lkb *lkb, int sb_status, int type)
 /* we could possibly check if the cancel of an orphan has resulted in the lkb
    being removed and then remove that lkb from the orphans list and free it */
 
-void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
+void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int mode)
 {
        struct dlm_ls *ls;
        struct dlm_user_args *ua;
@@ -206,8 +206,10 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
 
        ast_type = lkb->lkb_ast_type;
        lkb->lkb_ast_type |= type;
-       if (bastmode)
-               lkb->lkb_bastmode = bastmode;
+       if (type == AST_BAST)
+               lkb->lkb_bastmode = mode;
+       else
+               lkb->lkb_castmode = mode;
 
        if (!ast_type) {
                kref_get(&lkb->lkb_ref);
index 1c96864922869b396bcbf2cab5a70c2eb32c064b..f196091dd7ff8d31c687526d973c404d30098f00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2008 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2006-2010 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -9,7 +9,7 @@
 #ifndef __USER_DOT_H__
 #define __USER_DOT_H__
 
-void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode);
+void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int mode);
 int dlm_user_init(void);
 void dlm_user_exit(void);
 int dlm_device_deregister(struct dlm_ls *ls);
index fbb6e5eed6971a5a3b68e0e6c55bfa26fc8ec623..7cb0a59f4b9d2e7e6576be83d4787e599f9dd834 100644 (file)
@@ -1748,7 +1748,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
                            char *cipher_name, size_t *key_size)
 {
        char dummy_key[ECRYPTFS_MAX_KEY_BYTES];
-       char *full_alg_name;
+       char *full_alg_name = NULL;
        int rc;
 
        *key_tfm = NULL;
@@ -1763,7 +1763,6 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
        if (rc)
                goto out;
        *key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC);
-       kfree(full_alg_name);
        if (IS_ERR(*key_tfm)) {
                rc = PTR_ERR(*key_tfm);
                printk(KERN_ERR "Unable to allocate crypto cipher with name "
@@ -1786,6 +1785,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
                goto out;
        }
 out:
+       kfree(full_alg_name);
        return rc;
 }
 
index 9e944057001bfb83bc484b2136e628d2282c089f..678172b61be2a676de90fa8d7e5101e04f566ed4 100644 (file)
@@ -158,7 +158,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
        struct dentry *ecryptfs_dentry = file->f_path.dentry;
        /* Private value of ecryptfs_dentry allocated in
         * ecryptfs_lookup() */
-       struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
+       struct dentry *lower_dentry;
        struct ecryptfs_file_info *file_info;
 
        mount_crypt_stat = &ecryptfs_superblock_to_private(
@@ -191,13 +191,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
                                      | ECRYPTFS_ENCRYPTED);
        }
        mutex_unlock(&crypt_stat->cs_mutex);
-       if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
-           && !(file->f_flags & O_RDONLY)) {
-               rc = -EPERM;
-               printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
-                      "file must hence be opened RO\n", __func__);
-               goto out;
-       }
        if (!ecryptfs_inode_to_private(inode)->lower_file) {
                rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
                if (rc) {
@@ -208,6 +201,13 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
                        goto out;
                }
        }
+       if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
+           && !(file->f_flags & O_RDONLY)) {
+               rc = -EPERM;
+               printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
+                      "file must hence be opened RO\n", __func__);
+               goto out;
+       }
        ecryptfs_set_file_lower(
                file, ecryptfs_inode_to_private(inode)->lower_file);
        if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
@@ -299,7 +299,6 @@ static int ecryptfs_ioctl(struct inode *inode, struct file *file,
 const struct file_operations ecryptfs_dir_fops = {
        .readdir = ecryptfs_readdir,
        .ioctl = ecryptfs_ioctl,
-       .mmap = generic_file_mmap,
        .open = ecryptfs_open,
        .flush = ecryptfs_flush,
        .release = ecryptfs_release,
index 429ca0b3ba0872f3be95bfc08417d0b8647298f5..4a430ab4115c056851a9a98788417a44751e6205 100644 (file)
@@ -282,7 +282,8 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
                goto out;
        }
        rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
-                               ecryptfs_dir_inode->i_sb, 1);
+                               ecryptfs_dir_inode->i_sb,
+                               ECRYPTFS_INTERPOSE_FLAG_D_ADD);
        if (rc) {
                printk(KERN_ERR "%s: Error interposing; rc = [%d]\n",
                       __func__, rc);
@@ -463,9 +464,6 @@ out_lock:
        unlock_dir(lower_dir_dentry);
        dput(lower_new_dentry);
        dput(lower_old_dentry);
-       d_drop(lower_old_dentry);
-       d_drop(new_dentry);
-       d_drop(old_dentry);
        return rc;
 }
 
@@ -614,6 +612,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct dentry *lower_new_dentry;
        struct dentry *lower_old_dir_dentry;
        struct dentry *lower_new_dir_dentry;
+       struct dentry *trap = NULL;
 
        lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
        lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
@@ -621,7 +620,17 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        dget(lower_new_dentry);
        lower_old_dir_dentry = dget_parent(lower_old_dentry);
        lower_new_dir_dentry = dget_parent(lower_new_dentry);
-       lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
+       trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
+       /* source should not be ancestor of target */
+       if (trap == lower_old_dentry) {
+               rc = -EINVAL;
+               goto out_lock;
+       }
+       /* target should not be ancestor of source */
+       if (trap == lower_new_dentry) {
+               rc = -ENOTEMPTY;
+               goto out_lock;
+       }
        rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry,
                        lower_new_dir_dentry->d_inode, lower_new_dentry);
        if (rc)
@@ -715,31 +724,31 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
        /* Released in ecryptfs_put_link(); only release here on error */
        buf = kmalloc(len, GFP_KERNEL);
        if (!buf) {
-               rc = -ENOMEM;
+               buf = ERR_PTR(-ENOMEM);
                goto out;
        }
        old_fs = get_fs();
        set_fs(get_ds());
        rc = dentry->d_inode->i_op->readlink(dentry, (char __user *)buf, len);
        set_fs(old_fs);
-       if (rc < 0)
-               goto out_free;
-       else
+       if (rc < 0) {
+               kfree(buf);
+               buf = ERR_PTR(rc);
+       } else
                buf[rc] = '\0';
-       rc = 0;
-       nd_set_link(nd, buf);
-       goto out;
-out_free:
-       kfree(buf);
 out:
-       return ERR_PTR(rc);
+       nd_set_link(nd, buf);
+       return NULL;
 }
 
 static void
 ecryptfs_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
 {
-       /* Free the char* */
-       kfree(nd_get_link(nd));
+       char *buf = nd_get_link(nd);
+       if (!IS_ERR(buf)) {
+               /* Free the char* */
+               kfree(buf);
+       }
 }
 
 /**
@@ -772,18 +781,23 @@ upper_size_to_lower_size(struct ecryptfs_crypt_stat *crypt_stat,
 }
 
 /**
- * ecryptfs_truncate
+ * truncate_upper
  * @dentry: The ecryptfs layer dentry
- * @new_length: The length to expand the file to
+ * @ia: Address of the ecryptfs inode's attributes
+ * @lower_ia: Address of the lower inode's attributes
  *
  * Function to handle truncations modifying the size of the file. Note
  * that the file sizes are interpolated. When expanding, we are simply
- * writing strings of 0's out. When truncating, we need to modify the
- * underlying file size according to the page index interpolations.
+ * writing strings of 0's out. When truncating, we truncate the upper
+ * inode and update the lower_ia according to the page index
+ * interpolations. If ATTR_SIZE is set in lower_ia->ia_valid upon return,
+ * the caller must use lower_ia in a call to notify_change() to perform
+ * the truncation of the lower inode.
  *
  * Returns zero on success; non-zero otherwise
  */
-int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
+static int truncate_upper(struct dentry *dentry, struct iattr *ia,
+                         struct iattr *lower_ia)
 {
        int rc = 0;
        struct inode *inode = dentry->d_inode;
@@ -794,8 +808,10 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
        loff_t lower_size_before_truncate;
        loff_t lower_size_after_truncate;
 
-       if (unlikely((new_length == i_size)))
+       if (unlikely((ia->ia_size == i_size))) {
+               lower_ia->ia_valid &= ~ATTR_SIZE;
                goto out;
+       }
        crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
        /* Set up a fake ecryptfs file, this is used to interface with
         * the file in the underlying filesystem so that the
@@ -815,28 +831,30 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
                &fake_ecryptfs_file,
                ecryptfs_inode_to_private(dentry->d_inode)->lower_file);
        /* Switch on growing or shrinking file */
-       if (new_length > i_size) {
+       if (ia->ia_size > i_size) {
                char zero[] = { 0x00 };
 
+               lower_ia->ia_valid &= ~ATTR_SIZE;
                /* Write a single 0 at the last position of the file;
                 * this triggers code that will fill in 0's throughout
                 * the intermediate portion of the previous end of the
                 * file and the new and of the file */
                rc = ecryptfs_write(&fake_ecryptfs_file, zero,
-                                   (new_length - 1), 1);
-       } else { /* new_length < i_size_read(inode) */
-               /* We're chopping off all the pages down do the page
-                * in which new_length is located. Fill in the end of
-                * that page from (new_length & ~PAGE_CACHE_MASK) to
+                                   (ia->ia_size - 1), 1);
+       } else { /* ia->ia_size < i_size_read(inode) */
+               /* We're chopping off all the pages down to the page
+                * in which ia->ia_size is located. Fill in the end of
+                * that page from (ia->ia_size & ~PAGE_CACHE_MASK) to
                 * PAGE_CACHE_SIZE with zeros. */
                size_t num_zeros = (PAGE_CACHE_SIZE
-                                   - (new_length & ~PAGE_CACHE_MASK));
+                                   - (ia->ia_size & ~PAGE_CACHE_MASK));
 
                if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
-                       rc = vmtruncate(inode, new_length);
+                       rc = vmtruncate(inode, ia->ia_size);
                        if (rc)
                                goto out_free;
-                       rc = vmtruncate(lower_dentry->d_inode, new_length);
+                       lower_ia->ia_size = ia->ia_size;
+                       lower_ia->ia_valid |= ATTR_SIZE;
                        goto out_free;
                }
                if (num_zeros) {
@@ -848,7 +866,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
                                goto out_free;
                        }
                        rc = ecryptfs_write(&fake_ecryptfs_file, zeros_virt,
-                                           new_length, num_zeros);
+                                           ia->ia_size, num_zeros);
                        kfree(zeros_virt);
                        if (rc) {
                                printk(KERN_ERR "Error attempting to zero out "
@@ -857,7 +875,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
                                goto out_free;
                        }
                }
-               vmtruncate(inode, new_length);
+               vmtruncate(inode, ia->ia_size);
                rc = ecryptfs_write_inode_size_to_metadata(inode);
                if (rc) {
                        printk(KERN_ERR "Problem with "
@@ -870,10 +888,12 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
                lower_size_before_truncate =
                    upper_size_to_lower_size(crypt_stat, i_size);
                lower_size_after_truncate =
-                   upper_size_to_lower_size(crypt_stat, new_length);
-               if (lower_size_after_truncate < lower_size_before_truncate)
-                       vmtruncate(lower_dentry->d_inode,
-                                  lower_size_after_truncate);
+                   upper_size_to_lower_size(crypt_stat, ia->ia_size);
+               if (lower_size_after_truncate < lower_size_before_truncate) {
+                       lower_ia->ia_size = lower_size_after_truncate;
+                       lower_ia->ia_valid |= ATTR_SIZE;
+               } else
+                       lower_ia->ia_valid &= ~ATTR_SIZE;
        }
 out_free:
        if (ecryptfs_file_to_private(&fake_ecryptfs_file))
@@ -883,6 +903,33 @@ out:
        return rc;
 }
 
+/**
+ * ecryptfs_truncate
+ * @dentry: The ecryptfs layer dentry
+ * @new_length: The length to expand the file to
+ *
+ * Simple function that handles the truncation of an eCryptfs inode and
+ * its corresponding lower inode.
+ *
+ * Returns zero on success; non-zero otherwise
+ */
+int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
+{
+       struct iattr ia = { .ia_valid = ATTR_SIZE, .ia_size = new_length };
+       struct iattr lower_ia = { .ia_valid = 0 };
+       int rc;
+
+       rc = truncate_upper(dentry, &ia, &lower_ia);
+       if (!rc && lower_ia.ia_valid & ATTR_SIZE) {
+               struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
+
+               mutex_lock(&lower_dentry->d_inode->i_mutex);
+               rc = notify_change(lower_dentry, &lower_ia);
+               mutex_unlock(&lower_dentry->d_inode->i_mutex);
+       }
+       return rc;
+}
+
 static int
 ecryptfs_permission(struct inode *inode, int mask)
 {
@@ -905,6 +952,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
 {
        int rc = 0;
        struct dentry *lower_dentry;
+       struct iattr lower_ia;
        struct inode *inode;
        struct inode *lower_inode;
        struct ecryptfs_crypt_stat *crypt_stat;
@@ -943,15 +991,11 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
                }
        }
        mutex_unlock(&crypt_stat->cs_mutex);
+       memcpy(&lower_ia, ia, sizeof(lower_ia));
+       if (ia->ia_valid & ATTR_FILE)
+               lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file);
        if (ia->ia_valid & ATTR_SIZE) {
-               ecryptfs_printk(KERN_DEBUG,
-                               "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n",
-                               ia->ia_valid, ATTR_SIZE);
-               rc = ecryptfs_truncate(dentry, ia->ia_size);
-               /* ecryptfs_truncate handles resizing of the lower file */
-               ia->ia_valid &= ~ATTR_SIZE;
-               ecryptfs_printk(KERN_DEBUG, "ia->ia_valid = [%x]\n",
-                               ia->ia_valid);
+               rc = truncate_upper(dentry, ia, &lower_ia);
                if (rc < 0)
                        goto out;
        }
@@ -960,17 +1004,32 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
         * mode change is for clearing setuid/setgid bits. Allow lower fs
         * to interpret this in its own way.
         */
-       if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
-               ia->ia_valid &= ~ATTR_MODE;
+       if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
+               lower_ia.ia_valid &= ~ATTR_MODE;
 
        mutex_lock(&lower_dentry->d_inode->i_mutex);
-       rc = notify_change(lower_dentry, ia);
+       rc = notify_change(lower_dentry, &lower_ia);
        mutex_unlock(&lower_dentry->d_inode->i_mutex);
 out:
        fsstack_copy_attr_all(inode, lower_inode);
        return rc;
 }
 
+int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
+                    struct kstat *stat)
+{
+       struct kstat lower_stat;
+       int rc;
+
+       rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry),
+                        ecryptfs_dentry_to_lower(dentry), &lower_stat);
+       if (!rc) {
+               generic_fillattr(dentry->d_inode, stat);
+               stat->blocks = lower_stat.blocks;
+       }
+       return rc;
+}
+
 int
 ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
                  size_t size, int flags)
@@ -1100,6 +1159,7 @@ const struct inode_operations ecryptfs_dir_iops = {
 const struct inode_operations ecryptfs_main_iops = {
        .permission = ecryptfs_permission,
        .setattr = ecryptfs_setattr,
+       .getattr = ecryptfs_getattr,
        .setxattr = ecryptfs_setxattr,
        .getxattr = ecryptfs_getxattr,
        .listxattr = ecryptfs_listxattr,
index 567bc4b9f70a52029b4e6095a522a0b2f944b307..ea2f92101dfedab1101d98d5a4a8b88010d35897 100644 (file)
@@ -585,8 +585,8 @@ out:
  *                        with as much information as it can before needing
  *                        the lower filesystem.
  * ecryptfs_read_super(): this accesses the lower filesystem and uses
- *                        ecryptfs_interpolate to perform most of the linking
- * ecryptfs_interpolate(): links the lower filesystem into ecryptfs
+ *                        ecryptfs_interpose to perform most of the linking
+ * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c)
  */
 static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
                        const char *dev_name, void *raw_data,
index d26402ff06eaa1fbef5e347e627b029cc8239e8c..7758cc382ef0a80b56dc6e9687838f3a5d5468c0 100644 (file)
@@ -135,26 +135,71 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait)
        return events;
 }
 
-static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count,
-                           loff_t *ppos)
+static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt)
+{
+       *cnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count;
+       ctx->count -= *cnt;
+}
+
+/**
+ * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue.
+ * @ctx: [in] Pointer to eventfd context.
+ * @wait: [in] Wait queue to be removed.
+ * @cnt: [out] Pointer to the 64bit conter value.
+ *
+ * Returns zero if successful, or the following error codes:
+ *
+ * -EAGAIN      : The operation would have blocked.
+ *
+ * This is used to atomically remove a wait queue entry from the eventfd wait
+ * queue head, and read/reset the counter value.
+ */
+int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait,
+                                 __u64 *cnt)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&ctx->wqh.lock, flags);
+       eventfd_ctx_do_read(ctx, cnt);
+       __remove_wait_queue(&ctx->wqh, wait);
+       if (*cnt != 0 && waitqueue_active(&ctx->wqh))
+               wake_up_locked_poll(&ctx->wqh, POLLOUT);
+       spin_unlock_irqrestore(&ctx->wqh.lock, flags);
+
+       return *cnt != 0 ? 0 : -EAGAIN;
+}
+EXPORT_SYMBOL_GPL(eventfd_ctx_remove_wait_queue);
+
+/**
+ * eventfd_ctx_read - Reads the eventfd counter or wait if it is zero.
+ * @ctx: [in] Pointer to eventfd context.
+ * @no_wait: [in] Different from zero if the operation should not block.
+ * @cnt: [out] Pointer to the 64bit conter value.
+ *
+ * Returns zero if successful, or the following error codes:
+ *
+ * -EAGAIN      : The operation would have blocked but @no_wait was nonzero.
+ * -ERESTARTSYS : A signal interrupted the wait operation.
+ *
+ * If @no_wait is zero, the function might sleep until the eventfd internal
+ * counter becomes greater than zero.
+ */
+ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt)
 {
-       struct eventfd_ctx *ctx = file->private_data;
        ssize_t res;
-       __u64 ucnt = 0;
        DECLARE_WAITQUEUE(wait, current);
 
-       if (count < sizeof(ucnt))
-               return -EINVAL;
        spin_lock_irq(&ctx->wqh.lock);
+       *cnt = 0;
        res = -EAGAIN;
        if (ctx->count > 0)
-               res = sizeof(ucnt);
-       else if (!(file->f_flags & O_NONBLOCK)) {
+               res = 0;
+       else if (!no_wait) {
                __add_wait_queue(&ctx->wqh, &wait);
-               for (res = 0;;) {
+               for (;;) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        if (ctx->count > 0) {
-                               res = sizeof(ucnt);
+                               res = 0;
                                break;
                        }
                        if (signal_pending(current)) {
@@ -168,18 +213,32 @@ static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count,
                __remove_wait_queue(&ctx->wqh, &wait);
                __set_current_state(TASK_RUNNING);
        }
-       if (likely(res > 0)) {
-               ucnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count;
-               ctx->count -= ucnt;
+       if (likely(res == 0)) {
+               eventfd_ctx_do_read(ctx, cnt);
                if (waitqueue_active(&ctx->wqh))
                        wake_up_locked_poll(&ctx->wqh, POLLOUT);
        }
        spin_unlock_irq(&ctx->wqh.lock);
-       if (res > 0 && put_user(ucnt, (__u64 __user *) buf))
-               return -EFAULT;
 
        return res;
 }
+EXPORT_SYMBOL_GPL(eventfd_ctx_read);
+
+static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count,
+                           loff_t *ppos)
+{
+       struct eventfd_ctx *ctx = file->private_data;
+       ssize_t res;
+       __u64 cnt;
+
+       if (count < sizeof(cnt))
+               return -EINVAL;
+       res = eventfd_ctx_read(ctx, file->f_flags & O_NONBLOCK, &cnt);
+       if (res < 0)
+               return res;
+
+       return put_user(cnt, (__u64 __user *) buf) ? -EFAULT : sizeof(cnt);
+}
 
 static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count,
                             loff_t *ppos)
index 632b02e34ec72b17564602f9c944996e4889a9cf..cce6bbdbdbb11705afbe6c729007ede3b8714e92 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -571,6 +571,9 @@ int setup_arg_pages(struct linux_binprm *bprm,
        struct vm_area_struct *prev = NULL;
        unsigned long vm_flags;
        unsigned long stack_base;
+       unsigned long stack_size;
+       unsigned long stack_expand;
+       unsigned long rlim_stack;
 
 #ifdef CONFIG_STACK_GROWSUP
        /* Limit stack size to 1GB */
@@ -627,10 +630,23 @@ int setup_arg_pages(struct linux_binprm *bprm,
                        goto out_unlock;
        }
 
+       stack_expand = EXTRA_STACK_VM_PAGES * PAGE_SIZE;
+       stack_size = vma->vm_end - vma->vm_start;
+       /*
+        * Align this down to a page boundary as expand_stack
+        * will align it up.
+        */
+       rlim_stack = rlimit(RLIMIT_STACK) & PAGE_MASK;
 #ifdef CONFIG_STACK_GROWSUP
-       stack_base = vma->vm_end + EXTRA_STACK_VM_PAGES * PAGE_SIZE;
+       if (stack_size + stack_expand > rlim_stack)
+               stack_base = vma->vm_start + rlim_stack;
+       else
+               stack_base = vma->vm_end + stack_expand;
 #else
-       stack_base = vma->vm_start - EXTRA_STACK_VM_PAGES * PAGE_SIZE;
+       if (stack_size + stack_expand > rlim_stack)
+               stack_base = vma->vm_end - rlim_stack;
+       else
+               stack_base = vma->vm_start - stack_expand;
 #endif
        ret = expand_stack(vma, stack_base);
        if (ret)
@@ -941,9 +957,7 @@ void set_task_comm(struct task_struct *tsk, char *buf)
 
 int flush_old_exec(struct linux_binprm * bprm)
 {
-       char * name;
-       int i, ch, retval;
-       char tcomm[sizeof(current->comm)];
+       int retval;
 
        /*
         * Make sure we have a private signal table and that
@@ -964,6 +978,25 @@ int flush_old_exec(struct linux_binprm * bprm)
 
        bprm->mm = NULL;                /* We're using it now */
 
+       current->flags &= ~PF_RANDOMIZE;
+       flush_thread();
+       current->personality &= ~bprm->per_clear;
+
+       return 0;
+
+out:
+       return retval;
+}
+EXPORT_SYMBOL(flush_old_exec);
+
+void setup_new_exec(struct linux_binprm * bprm)
+{
+       int i, ch;
+       char * name;
+       char tcomm[sizeof(current->comm)];
+
+       arch_pick_mmap_layout(current->mm);
+
        /* This is the point of no return */
        current->sas_ss_sp = current->sas_ss_size = 0;
 
@@ -985,9 +1018,6 @@ int flush_old_exec(struct linux_binprm * bprm)
        tcomm[i] = '\0';
        set_task_comm(current, tcomm);
 
-       current->flags &= ~PF_RANDOMIZE;
-       flush_thread();
-
        /* Set the new mm task size. We have to do that late because it may
         * depend on TIF_32BIT which is only updated in flush_thread() on
         * some architectures like powerpc
@@ -1003,8 +1033,6 @@ int flush_old_exec(struct linux_binprm * bprm)
                set_dumpable(current->mm, suid_dumpable);
        }
 
-       current->personality &= ~bprm->per_clear;
-
        /*
         * Flush performance counters when crossing a
         * security domain:
@@ -1019,14 +1047,8 @@ int flush_old_exec(struct linux_binprm * bprm)
                        
        flush_signal_handlers(current, 0);
        flush_old_files(current->files);
-
-       return 0;
-
-out:
-       return retval;
 }
-
-EXPORT_SYMBOL(flush_old_exec);
+EXPORT_SYMBOL(setup_new_exec);
 
 /*
  * Prepare credentials and lock ->cred_guard_mutex.
index af7b62699ea94d3aa1ca358869dc32e2b3ba1eb7..874d169a193e44b7f91432d44f1802b24a9f2a98 100644 (file)
@@ -361,14 +361,11 @@ struct ext4_new_group_data {
           so set the magic i_delalloc_reserve_flag after taking the 
           inode allocation semaphore for */
 #define EXT4_GET_BLOCKS_DELALLOC_RESERVE       0x0004
-       /* Call ext4_da_update_reserve_space() after successfully 
-          allocating the blocks */
-#define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE   0x0008
        /* caller is from the direct IO path, request to creation of an
        unitialized extents if not allocated, split the uninitialized
        extent if blocks has been preallocated already*/
-#define EXT4_GET_BLOCKS_DIO                    0x0010
-#define EXT4_GET_BLOCKS_CONVERT                        0x0020
+#define EXT4_GET_BLOCKS_DIO                    0x0008
+#define EXT4_GET_BLOCKS_CONVERT                        0x0010
 #define EXT4_GET_BLOCKS_DIO_CREATE_EXT         (EXT4_GET_BLOCKS_DIO|\
                                         EXT4_GET_BLOCKS_CREATE_UNINIT_EXT)
        /* Convert extent to initialized after direct IO complete */
@@ -1443,6 +1440,8 @@ extern int ext4_block_truncate_page(handle_t *handle,
 extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
 extern qsize_t *ext4_get_reserved_space(struct inode *inode);
 extern int flush_aio_dio_completed_IO(struct inode *inode);
+extern void ext4_da_update_reserve_space(struct inode *inode,
+                                       int used, int quota_claim);
 /* ioctl.c */
 extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
 extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
index 7d7b74e9468757a241959fd9903d7e5951ab5843..765a4826b118b949a448097d614698d4c7bc4621 100644 (file)
@@ -3132,7 +3132,19 @@ out:
                unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
                                        newblock + max_blocks,
                                        allocated - max_blocks);
+               allocated = max_blocks;
        }
+
+       /*
+        * If we have done fallocate with the offset that is already
+        * delayed allocated, we would have block reservation
+        * and quota reservation done in the delayed write path.
+        * But fallocate would have already updated quota and block
+        * count for this offset. So cancel these reservation
+        */
+       if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
+               ext4_da_update_reserve_space(inode, allocated, 0);
+
 map_out:
        set_buffer_mapped(bh_result);
 out1:
@@ -3368,8 +3380,17 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
        /* previous routine could use block we allocated */
        newblock = ext_pblock(&newex);
        allocated = ext4_ext_get_actual_len(&newex);
+       if (allocated > max_blocks)
+               allocated = max_blocks;
        set_buffer_new(bh_result);
 
+       /*
+        * Update reserved blocks/metadata blocks after successful
+        * block allocation which had been deferred till now.
+        */
+       if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
+               ext4_da_update_reserve_space(inode, allocated, 1);
+
        /*
         * Cache the extent and update transaction to commit on fdatasync only
         * when it is _not_ an uninitialized extent.
index c818972c830231fe6ae3ec47b09f6c23b35481b9..e11952404e02eea921717f4ff43721ffdc1e8857 100644 (file)
@@ -1053,11 +1053,12 @@ static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
  * Called with i_data_sem down, which is important since we can call
  * ext4_discard_preallocations() from here.
  */
-static void ext4_da_update_reserve_space(struct inode *inode, int used)
+void ext4_da_update_reserve_space(struct inode *inode,
+                                       int used, int quota_claim)
 {
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
        struct ext4_inode_info *ei = EXT4_I(inode);
-       int mdb_free = 0;
+       int mdb_free = 0, allocated_meta_blocks = 0;
 
        spin_lock(&ei->i_block_reservation_lock);
        if (unlikely(used > ei->i_reserved_data_blocks)) {
@@ -1073,6 +1074,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
        ei->i_reserved_data_blocks -= used;
        used += ei->i_allocated_meta_blocks;
        ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
+       allocated_meta_blocks = ei->i_allocated_meta_blocks;
        ei->i_allocated_meta_blocks = 0;
        percpu_counter_sub(&sbi->s_dirtyblocks_counter, used);
 
@@ -1090,9 +1092,23 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
        spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
 
        /* Update quota subsystem */
-       vfs_dq_claim_block(inode, used);
-       if (mdb_free)
-               vfs_dq_release_reservation_block(inode, mdb_free);
+       if (quota_claim) {
+               vfs_dq_claim_block(inode, used);
+               if (mdb_free)
+                       vfs_dq_release_reservation_block(inode, mdb_free);
+       } else {
+               /*
+                * We did fallocate with an offset that is already delayed
+                * allocated. So on delayed allocated writeback we should
+                * not update the quota for allocated blocks. But then
+                * converting an fallocate region to initialized region would
+                * have caused a metadata allocation. So claim quota for
+                * that
+                */
+               if (allocated_meta_blocks)
+                       vfs_dq_claim_block(inode, allocated_meta_blocks);
+               vfs_dq_release_reservation_block(inode, mdb_free + used);
+       }
 
        /*
         * If we have done all the pending block allocations and if
@@ -1292,18 +1308,20 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
                         */
                        EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE;
                }
-       }
 
+               /*
+                * Update reserved blocks/metadata blocks after successful
+                * block allocation which had been deferred till now. We don't
+                * support fallocate for non extent files. So we can update
+                * reserve space here.
+                */
+               if ((retval > 0) &&
+                       (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE))
+                       ext4_da_update_reserve_space(inode, retval, 1);
+       }
        if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
                EXT4_I(inode)->i_delalloc_reserved_flag = 0;
 
-       /*
-        * Update reserved blocks/metadata blocks after successful
-        * block allocation which had been deferred till now.
-        */
-       if ((retval > 0) && (flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE))
-               ext4_da_update_reserve_space(inode, retval);
-
        up_write((&EXT4_I(inode)->i_data_sem));
        if (retval > 0 && buffer_mapped(bh)) {
                int ret = check_block_validity(inode, "file system "
@@ -1835,24 +1853,12 @@ repeat:
         * later. Real quota accounting is done at pages writeout
         * time.
         */
-       if (vfs_dq_reserve_block(inode, md_needed + 1)) {
-               /* 
-                * We tend to badly over-estimate the amount of
-                * metadata blocks which are needed, so if we have
-                * reserved any metadata blocks, try to force out the
-                * inode and see if we have any better luck.
-                */
-               if (md_reserved && retries++ <= 3)
-                       goto retry;
+       if (vfs_dq_reserve_block(inode, md_needed + 1))
                return -EDQUOT;
-       }
 
        if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
                vfs_dq_release_reservation_block(inode, md_needed + 1);
                if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
-               retry:
-                       if (md_reserved)
-                               write_inode_now(inode, (retries == 3));
                        yield();
                        goto repeat;
                }
@@ -2213,10 +2219,10 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
         * variables are updated after the blocks have been allocated.
         */
        new.b_state = 0;
-       get_blocks_flags = (EXT4_GET_BLOCKS_CREATE |
-                           EXT4_GET_BLOCKS_DELALLOC_RESERVE);
+       get_blocks_flags = EXT4_GET_BLOCKS_CREATE;
        if (mpd->b_state & (1 << BH_Delay))
-               get_blocks_flags |= EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE;
+               get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE;
+
        blks = ext4_get_blocks(handle, mpd->inode, next, max_blocks,
                               &new, get_blocks_flags);
        if (blks < 0) {
@@ -3032,7 +3038,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
                               loff_t pos, unsigned len, unsigned flags,
                               struct page **pagep, void **fsdata)
 {
-       int ret, retries = 0;
+       int ret, retries = 0, quota_retries = 0;
        struct page *page;
        pgoff_t index;
        unsigned from, to;
@@ -3091,6 +3097,22 @@ retry:
 
        if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
                goto retry;
+
+       if ((ret == -EDQUOT) &&
+           EXT4_I(inode)->i_reserved_meta_blocks &&
+           (quota_retries++ < 3)) {
+               /*
+                * Since we often over-estimate the number of meta
+                * data blocks required, we may sometimes get a
+                * spurios out of quota error even though there would
+                * be enough space once we write the data blocks and
+                * find out how many meta data blocks were _really_
+                * required.  So try forcing the inode write to see if
+                * that helps.
+                */
+               write_inode_now(inode, (quota_retries == 3));
+               goto retry;
+       }
 out:
        return ret;
 }
index 2cf93ec40a677f1e4569f5dbd37ca979e8fc31ef..97e01dc0d95fc4fe8464d729ce94d32b888b567d 100644 (file)
@@ -618,60 +618,90 @@ static DEFINE_RWLOCK(fasync_lock);
 static struct kmem_cache *fasync_cache __read_mostly;
 
 /*
- * fasync_helper() is used by almost all character device drivers
- * to set up the fasync queue. It returns negative on error, 0 if it did
- * no changes and positive if it added/deleted the entry.
+ * Remove a fasync entry. If successfully removed, return
+ * positive and clear the FASYNC flag. If no entry exists,
+ * do nothing and return 0.
+ *
+ * NOTE! It is very important that the FASYNC flag always
+ * match the state "is the filp on a fasync list".
+ *
+ * We always take the 'filp->f_lock', in since fasync_lock
+ * needs to be irq-safe.
  */
-int fasync_helper(int fd, struct file * filp, int on, struct fasync_struct **fapp)
+static int fasync_remove_entry(struct file *filp, struct fasync_struct **fapp)
 {
        struct fasync_struct *fa, **fp;
-       struct fasync_struct *new = NULL;
        int result = 0;
 
-       if (on) {
-               new = kmem_cache_alloc(fasync_cache, GFP_KERNEL);
-               if (!new)
-                       return -ENOMEM;
+       spin_lock(&filp->f_lock);
+       write_lock_irq(&fasync_lock);
+       for (fp = fapp; (fa = *fp) != NULL; fp = &fa->fa_next) {
+               if (fa->fa_file != filp)
+                       continue;
+               *fp = fa->fa_next;
+               kmem_cache_free(fasync_cache, fa);
+               filp->f_flags &= ~FASYNC;
+               result = 1;
+               break;
        }
+       write_unlock_irq(&fasync_lock);
+       spin_unlock(&filp->f_lock);
+       return result;
+}
+
+/*
+ * Add a fasync entry. Return negative on error, positive if
+ * added, and zero if did nothing but change an existing one.
+ *
+ * NOTE! It is very important that the FASYNC flag always
+ * match the state "is the filp on a fasync list".
+ */
+static int fasync_add_entry(int fd, struct file *filp, struct fasync_struct **fapp)
+{
+       struct fasync_struct *new, *fa, **fp;
+       int result = 0;
+
+       new = kmem_cache_alloc(fasync_cache, GFP_KERNEL);
+       if (!new)
+               return -ENOMEM;
 
-       /*
-        * We need to take f_lock first since it's not an IRQ-safe
-        * lock.
-        */
        spin_lock(&filp->f_lock);
        write_lock_irq(&fasync_lock);
        for (fp = fapp; (fa = *fp) != NULL; fp = &fa->fa_next) {
-               if (fa->fa_file == filp) {
-                       if(on) {
-                               fa->fa_fd = fd;
-                               kmem_cache_free(fasync_cache, new);
-                       } else {
-                               *fp = fa->fa_next;
-                               kmem_cache_free(fasync_cache, fa);
-                               result = 1;
-                       }
-                       goto out;
-               }
+               if (fa->fa_file != filp)
+                       continue;
+               fa->fa_fd = fd;
+               kmem_cache_free(fasync_cache, new);
+               goto out;
        }
 
-       if (on) {
-               new->magic = FASYNC_MAGIC;
-               new->fa_file = filp;
-               new->fa_fd = fd;
-               new->fa_next = *fapp;
-               *fapp = new;
-               result = 1;
-       }
+       new->magic = FASYNC_MAGIC;
+       new->fa_file = filp;
+       new->fa_fd = fd;
+       new->fa_next = *fapp;
+       *fapp = new;
+       result = 1;
+       filp->f_flags |= FASYNC;
+
 out:
-       if (on)
-               filp->f_flags |= FASYNC;
-       else
-               filp->f_flags &= ~FASYNC;
        write_unlock_irq(&fasync_lock);
        spin_unlock(&filp->f_lock);
        return result;
 }
 
+/*
+ * fasync_helper() is used by almost all character device drivers
+ * to set up the fasync queue, and for regular files by the file
+ * lease code. It returns negative on error, 0 if it did no changes
+ * and positive if it added/deleted the entry.
+ */
+int fasync_helper(int fd, struct file * filp, int on, struct fasync_struct **fapp)
+{
+       if (!on)
+               return fasync_remove_entry(filp, fapp);
+       return fasync_add_entry(fd, filp, fapp);
+}
+
 EXPORT_SYMBOL(fasync_helper);
 
 void __kill_fasync(struct fasync_struct *fa, int sig, int band)
index 87e129030ab1564a69061b82b9608c59cced9f1a..38039af67663fd615ec80420e39d736687a5fa91 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -478,7 +478,7 @@ repeat:
        error = fd;
 #if 1
        /* Sanity check */
-       if (rcu_dereference(fdt->fd[fd]) != NULL) {
+       if (rcu_dereference_raw(fdt->fd[fd]) != NULL) {
                printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
                rcu_assign_pointer(fdt->fd[fd], NULL);
        }
index 69652c5bd5f0ad83b983324d4dc2d31b7a1cd689..b98404b5438385dc803498ba5e0c710a7244ed60 100644 (file)
@@ -253,6 +253,7 @@ void __fput(struct file *file)
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);
+       ima_file_free(file);
        if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
                cdev_put(inode->i_cdev);
        fops_put(file->f_op);
index c18913a777ae3865148c9bbd679d0c09ff092f4f..a9f5e137f1d31547f86bbfdb87df11c07daf963f 100644 (file)
@@ -828,6 +828,9 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
                if (!page)
                        break;
 
+               if (mapping_writably_mapped(mapping))
+                       flush_dcache_page(page);
+
                pagefault_disable();
                tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes);
                pagefault_enable();
index 6d47379e794bc4a6b8a9f665aa3546da36dde441..583e823307ae7a17cd58b34027f11cea4e3f6437 100644 (file)
@@ -541,7 +541,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
                                *ptr++ = cpu_to_be64(bn++);
                        break;
                }
-       } while (state != ALLOC_DATA);
+       } while ((state != ALLOC_DATA) || !dblock);
 
        ip->i_height = height;
        gfs2_add_inode_blocks(&ip->i_inode, alloced);
index f455a03a09e29d0394d996bc7302f2888081fbf8..f42663325931c3c41be0a084f5869dba8ed86344 100644 (file)
@@ -769,6 +769,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
        if (!gl)
                return -ENOMEM;
 
+       atomic_inc(&sdp->sd_glock_disposal);
        gl->gl_flags = 0;
        gl->gl_name = name;
        atomic_set(&gl->gl_ref, 1);
@@ -1538,6 +1539,9 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
                up_write(&gfs2_umount_flush_sem);
                msleep(10);
        }
+       flush_workqueue(glock_workqueue);
+       wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0);
+       gfs2_dump_lockstate(sdp);
 }
 
 void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
index 13f0bd228132a4539442f396e95cd6b256fd2961..c0262faf472572d8ee16809ce86e12807af7c68b 100644 (file)
@@ -123,7 +123,7 @@ struct lm_lockops {
        int (*lm_mount) (struct gfs2_sbd *sdp, const char *fsname);
        void (*lm_unmount) (struct gfs2_sbd *sdp);
        void (*lm_withdraw) (struct gfs2_sbd *sdp);
-       void (*lm_put_lock) (struct kmem_cache *cachep, void *gl);
+       void (*lm_put_lock) (struct kmem_cache *cachep, struct gfs2_glock *gl);
        unsigned int (*lm_lock) (struct gfs2_glock *gl,
                                 unsigned int req_state, unsigned int flags);
        void (*lm_cancel) (struct gfs2_glock *gl);
index 4792200978c82ef16378a81487016814251fe1ae..bc0ad158e6b4925bc22579d9dff295b1b9fa22f6 100644 (file)
@@ -544,6 +544,8 @@ struct gfs2_sbd {
        struct gfs2_holder sd_live_gh;
        struct gfs2_glock *sd_rename_gl;
        struct gfs2_glock *sd_trans_gl;
+       wait_queue_head_t sd_glock_wait;
+       atomic_t sd_glock_disposal;
 
        /* Inode Stuff */
 
index 46df988323bc035285d5663429588038df6d6b9c..0e5e0e7022e59a0552987644d1a8953e3dc476c0 100644 (file)
@@ -21,6 +21,7 @@ static void gdlm_ast(void *arg)
 {
        struct gfs2_glock *gl = arg;
        unsigned ret = gl->gl_state;
+       struct gfs2_sbd *sdp = gl->gl_sbd;
 
        BUG_ON(gl->gl_lksb.sb_flags & DLM_SBF_DEMOTED);
 
@@ -30,6 +31,8 @@ static void gdlm_ast(void *arg)
        switch (gl->gl_lksb.sb_status) {
        case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */
                kmem_cache_free(gfs2_glock_cachep, gl);
+               if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+                       wake_up(&sdp->sd_glock_wait);
                return;
        case -DLM_ECANCEL: /* Cancel while getting lock */
                ret |= LM_OUT_CANCELED;
@@ -164,14 +167,16 @@ static unsigned int gdlm_lock(struct gfs2_glock *gl,
        return LM_OUT_ASYNC;
 }
 
-static void gdlm_put_lock(struct kmem_cache *cachep, void *ptr)
+static void gdlm_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl)
 {
-       struct gfs2_glock *gl = ptr;
-       struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct;
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+       struct lm_lockstruct *ls = &sdp->sd_lockstruct;
        int error;
 
        if (gl->gl_lksb.sb_lkid == 0) {
                kmem_cache_free(cachep, gl);
+               if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+                       wake_up(&sdp->sd_glock_wait);
                return;
        }
 
index edfee24f3636d9c6db41cc756622b20cfabb1c3c..a86ed63815667f456a88e24cad30e3a60bb67e34 100644 (file)
@@ -82,6 +82,8 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
 
        gfs2_tune_init(&sdp->sd_tune);
 
+       init_waitqueue_head(&sdp->sd_glock_wait);
+       atomic_set(&sdp->sd_glock_disposal, 0);
        spin_lock_init(&sdp->sd_statfs_spin);
 
        spin_lock_init(&sdp->sd_rindex_spin);
@@ -723,7 +725,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                goto fail;
        }
 
-       error = -EINVAL;
+       error = -EUSERS;
        if (!gfs2_jindex_size(sdp)) {
                fs_err(sdp, "no journals!\n");
                goto fail_jindex;
@@ -983,9 +985,17 @@ static const match_table_t nolock_tokens = {
        { Opt_err, NULL },
 };
 
+static void nolock_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl)
+{
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+       kmem_cache_free(cachep, gl);
+       if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+               wake_up(&sdp->sd_glock_wait);
+}
+
 static const struct lm_lockops nolock_ops = {
        .lm_proto_name = "lock_nolock",
-       .lm_put_lock = kmem_cache_free,
+       .lm_put_lock = nolock_put_lock,
        .lm_tokens = &nolock_tokens,
 };
 
index 78f73ca1ef3e8ac9ce5af97b43eccec7e8f7be68..84350e1be66d2b286e306b13395953557ace4be8 100644 (file)
@@ -1088,7 +1088,8 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
                error = vfs_follow_link(nd, buf);
                if (buf != array)
                        kfree(buf);
-       }
+       } else
+               path_put(&nd->path);
 
        return ERR_PTR(error);
 }
index 0608f490c295dae79b49cf496bffd0fa79e2c849..503b842f3ba2c0bd3e433cc9fed031436511b852 100644 (file)
@@ -591,11 +591,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
        u64 rgrp_count = ip->i_disksize;
        int error;
 
-       if (do_div(rgrp_count, sizeof(struct gfs2_rindex))) {
-               gfs2_consist_inode(ip);
-               return -EIO;
-       }
-
+       do_div(rgrp_count, sizeof(struct gfs2_rindex));
        clear_rgrpdi(sdp);
 
        file_ra_state_init(&ra_state, inode->i_mapping);
@@ -915,7 +911,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd)
 struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip)
 {
        BUG_ON(ip->i_alloc != NULL);
-       ip->i_alloc = kzalloc(sizeof(struct gfs2_alloc), GFP_KERNEL);
+       ip->i_alloc = kzalloc(sizeof(struct gfs2_alloc), GFP_NOFS);
        return ip->i_alloc;
 }
 
index c282ad41f3d1860bba4301495a7303de40b57d06..b9dd3da22c0a3fc5452a018cb25dfab89fa6ecf0 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/time.h>
+#include <linux/wait.h>
 
 #include "gfs2.h"
 #include "incore.h"
index a5089a6dd67a741b79279ffb435d94e2162f510e..7239efc690d833cf9e4a507916a5819270c1f267 100644 (file)
@@ -646,22 +646,27 @@ static const struct super_operations hppfs_sbops = {
 static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
                          int buflen)
 {
-       struct dentry *proc_dentry;
-
-       proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
+       struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
        return proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer,
                                                    buflen);
 }
 
 static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
-       struct dentry *proc_dentry;
-
-       proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
+       struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
 
        return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
 }
 
+static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd,
+                          void *cookie)
+{
+       struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
+
+       if (proc_dentry->d_inode->i_op->put_link)
+               proc_dentry->d_inode->i_op->put_link(proc_dentry, nd, cookie);
+}
+
 static const struct inode_operations hppfs_dir_iops = {
        .lookup         = hppfs_lookup,
 };
@@ -669,6 +674,7 @@ static const struct inode_operations hppfs_dir_iops = {
 static const struct inode_operations hppfs_link_iops = {
        .readlink       = hppfs_readlink,
        .follow_link    = hppfs_follow_link,
+       .put_link       = hppfs_put_link,
 };
 
 static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
index b55440baf7ab832e9d05ae8fdddc2337da57b5ed..a4855af776a8b6670b753aa3af71203519de94a7 100644 (file)
@@ -561,6 +561,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
                dget(dentry);
        }
        mntget(path->mnt);
+       nd->last_type = LAST_BIND;
        cookie = dentry->d_inode->i_op->follow_link(dentry, nd);
        error = PTR_ERR(cookie);
        if (!IS_ERR(cookie)) {
@@ -821,6 +822,17 @@ fail:
        return PTR_ERR(dentry);
 }
 
+/*
+ * This is a temporary kludge to deal with "automount" symlinks; proper
+ * solution is to trigger them on follow_mount(), so that do_lookup()
+ * would DTRT.  To be killed before 2.6.34-final.
+ */
+static inline int follow_on_final(struct inode *inode, unsigned lookup_flags)
+{
+       return inode && unlikely(inode->i_op->follow_link) &&
+               ((lookup_flags & LOOKUP_FOLLOW) || S_ISDIR(inode->i_mode));
+}
+
 /*
  * Name resolution.
  * This is the basic name resolution function, turning a pathname into
@@ -941,8 +953,7 @@ last_component:
                if (err)
                        break;
                inode = next.dentry->d_inode;
-               if ((lookup_flags & LOOKUP_FOLLOW)
-                   && inode && inode->i_op->follow_link) {
+               if (follow_on_final(inode, lookup_flags)) {
                        err = do_follow_link(&next, nd);
                        if (err)
                                goto return_err;
@@ -1603,11 +1614,12 @@ struct file *do_filp_open(int dfd, const char *pathname,
        struct file *filp;
        struct nameidata nd;
        int error;
-       struct path path, save;
+       struct path path;
        struct dentry *dir;
        int count = 0;
        int will_truncate;
        int flag = open_to_namei_flags(open_flag);
+       int force_reval = 0;
 
        /*
         * O_SYNC is implemented as __O_SYNC|O_DSYNC.  As many places only
@@ -1619,7 +1631,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
                open_flag |= O_DSYNC;
 
        if (!acc_mode)
-               acc_mode = MAY_OPEN | ACC_MODE(flag);
+               acc_mode = MAY_OPEN | ACC_MODE(open_flag);
 
        /* O_TRUNC implies we need access checks for write permissions */
        if (flag & O_TRUNC)
@@ -1659,9 +1671,12 @@ struct file *do_filp_open(int dfd, const char *pathname,
        /*
         * Create - we need to know the parent.
         */
+reval:
        error = path_init(dfd, pathname, LOOKUP_PARENT, &nd);
        if (error)
                return ERR_PTR(error);
+       if (force_reval)
+               nd.flags |= LOOKUP_REVAL;
        error = path_walk(pathname, &nd);
        if (error) {
                if (nd.root.mnt)
@@ -1731,8 +1746,7 @@ do_last:
                if (nd.root.mnt)
                        path_put(&nd.root);
                if (!IS_ERR(filp)) {
-                       error = ima_path_check(&filp->f_path, filp->f_mode &
-                                      (MAY_READ | MAY_WRITE | MAY_EXEC));
+                       error = ima_file_check(filp, acc_mode);
                        if (error) {
                                fput(filp);
                                filp = ERR_PTR(error);
@@ -1792,8 +1806,7 @@ ok:
        }
        filp = nameidata_to_filp(&nd);
        if (!IS_ERR(filp)) {
-               error = ima_path_check(&filp->f_path, filp->f_mode &
-                              (MAY_READ | MAY_WRITE | MAY_EXEC));
+               error = ima_file_check(filp, acc_mode);
                if (error) {
                        fput(filp);
                        filp = ERR_PTR(error);
@@ -1853,17 +1866,7 @@ do_link:
        error = security_inode_follow_link(path.dentry, &nd);
        if (error)
                goto exit_dput;
-       save = nd.path;
-       path_get(&save);
        error = __do_follow_link(&path, &nd);
-       if (error == -ESTALE) {
-               /* nd.path had been dropped */
-               nd.path = save;
-               path_get(&nd.path);
-               nd.flags |= LOOKUP_REVAL;
-               error = __do_follow_link(&path, &nd);
-       }
-       path_put(&save);
        path_put(&path);
        if (error) {
                /* Does someone understand code flow here? Or it is only
@@ -1873,6 +1876,10 @@ do_link:
                release_open_intent(&nd);
                if (nd.root.mnt)
                        path_put(&nd.root);
+               if (error == -ESTALE && !force_reval) {
+                       force_reval = 1;
+                       goto reval;
+               }
                return ERR_PTR(error);
        }
        nd.flags &= ~LOOKUP_PARENT;
index 7d70d63ceb2948c6b8e25ef7628314a4c0eab3b8..c768f733c8d6585a87551190bdf1b71a14cab9fe 100644 (file)
@@ -965,10 +965,12 @@ EXPORT_SYMBOL(may_umount_tree);
 int may_umount(struct vfsmount *mnt)
 {
        int ret = 1;
+       down_read(&namespace_sem);
        spin_lock(&vfsmount_lock);
        if (propagate_mount_busy(mnt, 2))
                ret = 0;
        spin_unlock(&vfsmount_lock);
+       up_read(&namespace_sem);
        return ret;
 }
 
@@ -1352,12 +1354,12 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
        if (err)
                goto out_cleanup_ids;
 
+       spin_lock(&vfsmount_lock);
+
        if (IS_MNT_SHARED(dest_mnt)) {
                for (p = source_mnt; p; p = next_mnt(p, source_mnt))
                        set_mnt_shared(p);
        }
-
-       spin_lock(&vfsmount_lock);
        if (parent_path) {
                detach_mnt(source_mnt, parent_path);
                attach_mnt(source_mnt, path);
@@ -1534,8 +1536,12 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
                err = change_mount_flags(path->mnt, flags);
        else
                err = do_remount_sb(sb, flags, data, 0);
-       if (!err)
+       if (!err) {
+               spin_lock(&vfsmount_lock);
+               mnt_flags |= path->mnt->mnt_flags & MNT_PNODE_MASK;
                path->mnt->mnt_flags = mnt_flags;
+               spin_unlock(&vfsmount_lock);
+       }
        up_write(&sb->s_umount);
        if (!err) {
                security_sb_post_remount(path->mnt, flags, data);
@@ -1665,6 +1671,8 @@ int do_add_mount(struct vfsmount *newmnt, struct path *path,
 {
        int err;
 
+       mnt_flags &= ~(MNT_SHARED | MNT_WRITE_HOLD);
+
        down_write(&namespace_sem);
        /* Something was mounted here while we slept */
        while (d_mountpoint(path->dentry) &&
index 59e5673b45975f03fdd2ea0f24b4541ba9c2dfc2..a43d07e7b9242addd57f704f5a65d15e0bae9813 100644 (file)
@@ -95,8 +95,7 @@ config ROOT_NFS
          Most people say N here.
 
 config NFS_FSCACHE
-       bool "Provide NFS client caching support (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
+       bool "Provide NFS client caching support"
        depends on NFS_FS=m && FSCACHE || NFS_FS=y && FSCACHE=y
        help
          Say Y here if you want NFS data to be cached locally on disc through
index e1d415e97849a882052914509abaf59804d47b43..0d289823e8564b49969710e4c16688abbc61b15d 100644 (file)
@@ -342,6 +342,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
                data->res.fattr = &data->fattr;
                data->res.eof = 0;
                data->res.count = bytes;
+               nfs_fattr_init(&data->fattr);
                msg.rpc_argp = &data->args;
                msg.rpc_resp = &data->res;
 
@@ -575,6 +576,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
        data->res.count = 0;
        data->res.fattr = &data->fattr;
        data->res.verf = &data->verf;
+       nfs_fattr_init(&data->fattr);
 
        NFS_PROTO(data->inode)->commit_setup(data, &msg);
 
@@ -766,6 +768,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
                data->res.fattr = &data->fattr;
                data->res.count = bytes;
                data->res.verf = &data->verf;
+               nfs_fattr_init(&data->fattr);
 
                task_setup_data.task = &data->task;
                task_setup_data.callback_data = data;
index 6b891328f332cfcf73e1e965a0e4b3912c56dce1..63f2071d6445784899985823cb416dc9861351b7 100644 (file)
@@ -486,6 +486,8 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
 {
        dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
 
+       if (gfp & __GFP_WAIT)
+               nfs_wb_page(page->mapping->host, page);
        /* If PagePrivate() is set, then the page is not freeable */
        if (PagePrivate(page))
                return 0;
index fa588006588dd3403bb9a883eedc79ddc4588655..237874f1af23697d3d092147eaa39bcf25958006 100644 (file)
@@ -354,12 +354,11 @@ void nfs_fscache_reset_inode_cookie(struct inode *inode)
  */
 int nfs_fscache_release_page(struct page *page, gfp_t gfp)
 {
-       struct nfs_inode *nfsi = NFS_I(page->mapping->host);
-       struct fscache_cookie *cookie = nfsi->fscache;
-
-       BUG_ON(!cookie);
-
        if (PageFsCache(page)) {
+               struct nfs_inode *nfsi = NFS_I(page->mapping->host);
+               struct fscache_cookie *cookie = nfsi->fscache;
+
+               BUG_ON(!cookie);
                dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n",
                         cookie, page, nfsi);
 
index faa091865ad05c956114ab7c7642994845717382..f141bde7756af861f1853a04bb919a78e377fe81 100644 (file)
@@ -1261,8 +1261,10 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 
        if (fattr->valid & NFS_ATTR_FATTR_MODE) {
                if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)) {
+                       umode_t newmode = inode->i_mode & S_IFMT;
+                       newmode |= fattr->mode & S_IALLUGO;
+                       inode->i_mode = newmode;
                        invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
-                       inode->i_mode = fattr->mode;
                }
        } else if (server->caps & NFS_CAP_MODE)
                invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
index 0adefc40cc8929677a6a2257b2090222d764d569..59047f8d7d72885869c748721a389307e34e7eca 100644 (file)
@@ -120,7 +120,7 @@ static struct {
        { .status = MNT3ERR_INVAL,              .errno = -EINVAL,       },
        { .status = MNT3ERR_NAMETOOLONG,        .errno = -ENAMETOOLONG, },
        { .status = MNT3ERR_NOTSUPP,            .errno = -ENOTSUPP,     },
-       { .status = MNT3ERR_SERVERFAULT,        .errno = -ESERVERFAULT, },
+       { .status = MNT3ERR_SERVERFAULT,        .errno = -EREMOTEIO,    },
 };
 
 struct mountres {
index 5e078b222b4e976a63ad37904a5b594134051f81..7bc2da8efd4a352a962d8aac259cd6279fe3f6eb 100644 (file)
@@ -699,7 +699,7 @@ static struct {
        { NFSERR_BAD_COOKIE,    -EBADCOOKIE     },
        { NFSERR_NOTSUPP,       -ENOTSUPP       },
        { NFSERR_TOOSMALL,      -ETOOSMALL      },
-       { NFSERR_SERVERFAULT,   -ESERVERFAULT   },
+       { NFSERR_SERVERFAULT,   -EREMOTEIO      },
        { NFSERR_BADTYPE,       -EBADTYPE       },
        { NFSERR_JUKEBOX,       -EJUKEBOX       },
        { -1,                   -EIO            }
index 865265bdca03acc9f1e106593304a6daf99ef0bd..0c6fda33d66ec170a6ecd00a03ba600168b34e70 100644 (file)
@@ -146,6 +146,7 @@ enum {
        NFS_O_RDWR_STATE,               /* OPEN stateid has read/write state */
        NFS_STATE_RECLAIM_REBOOT,       /* OPEN stateid server rebooted */
        NFS_STATE_RECLAIM_NOGRACE,      /* OPEN stateid needs to recover state */
+       NFS_STATE_POSIX_LOCKS,          /* Posix locks are supported */
 };
 
 struct nfs4_state {
@@ -277,6 +278,7 @@ extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t);
 extern void nfs4_schedule_state_recovery(struct nfs_client *);
 extern void nfs4_schedule_state_manager(struct nfs_client *);
 extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state);
+extern int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state);
 extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags);
 extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
 extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
index 198d51d17c135e1b41564636511ff0119e0a7219..375f0fae2c6a9a4b9536ad416fdc011661ffa28b 100644 (file)
@@ -249,19 +249,15 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
                        if (state == NULL)
                                break;
                        nfs4_state_mark_reclaim_nograce(clp, state);
-               case -NFS4ERR_STALE_CLIENTID:
+                       goto do_state_recovery;
                case -NFS4ERR_STALE_STATEID:
-               case -NFS4ERR_EXPIRED:
-                       nfs4_schedule_state_recovery(clp);
-                       ret = nfs4_wait_clnt_recover(clp);
-                       if (ret == 0)
-                               exception->retry = 1;
-#if !defined(CONFIG_NFS_V4_1)
-                       break;
-#else /* !defined(CONFIG_NFS_V4_1) */
-                       if (!nfs4_has_session(server->nfs_client))
+                       if (state == NULL)
                                break;
-                       /* FALLTHROUGH */
+                       nfs4_state_mark_reclaim_reboot(clp, state);
+               case -NFS4ERR_STALE_CLIENTID:
+               case -NFS4ERR_EXPIRED:
+                       goto do_state_recovery;
+#if defined(CONFIG_NFS_V4_1)
                case -NFS4ERR_BADSESSION:
                case -NFS4ERR_BADSLOT:
                case -NFS4ERR_BAD_HIGH_SLOT:
@@ -274,7 +270,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
                        nfs4_schedule_state_recovery(clp);
                        exception->retry = 1;
                        break;
-#endif /* !defined(CONFIG_NFS_V4_1) */
+#endif /* defined(CONFIG_NFS_V4_1) */
                case -NFS4ERR_FILE_OPEN:
                        if (exception->timeout > HZ) {
                                /* We have retried a decent amount, time to
@@ -293,6 +289,12 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
        }
        /* We failed to handle the error */
        return nfs4_map_errors(ret);
+do_state_recovery:
+       nfs4_schedule_state_recovery(clp);
+       ret = nfs4_wait_clnt_recover(clp);
+       if (ret == 0)
+               exception->retry = 1;
+       return ret;
 }
 
 
@@ -1658,6 +1660,8 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, in
        status = PTR_ERR(state);
        if (IS_ERR(state))
                goto err_opendata_put;
+       if ((opendata->o_res.rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) != 0)
+               set_bit(NFS_STATE_POSIX_LOCKS, &state->flags);
        nfs4_opendata_put(opendata);
        nfs4_put_state_owner(sp);
        *res = state;
@@ -3422,15 +3426,14 @@ _nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
                        if (state == NULL)
                                break;
                        nfs4_state_mark_reclaim_nograce(clp, state);
-               case -NFS4ERR_STALE_CLIENTID:
+                       goto do_state_recovery;
                case -NFS4ERR_STALE_STATEID:
+                       if (state == NULL)
+                               break;
+                       nfs4_state_mark_reclaim_reboot(clp, state);
+               case -NFS4ERR_STALE_CLIENTID:
                case -NFS4ERR_EXPIRED:
-                       rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL);
-                       nfs4_schedule_state_recovery(clp);
-                       if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0)
-                               rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task);
-                       task->tk_status = 0;
-                       return -EAGAIN;
+                       goto do_state_recovery;
 #if defined(CONFIG_NFS_V4_1)
                case -NFS4ERR_BADSESSION:
                case -NFS4ERR_BADSLOT:
@@ -3458,6 +3461,13 @@ _nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
        }
        task->tk_status = nfs4_map_errors(task->tk_status);
        return 0;
+do_state_recovery:
+       rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL);
+       nfs4_schedule_state_recovery(clp);
+       if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0)
+               rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task);
+       task->tk_status = 0;
+       return -EAGAIN;
 }
 
 static int
@@ -4088,6 +4098,28 @@ static const struct rpc_call_ops nfs4_recover_lock_ops = {
        .rpc_release = nfs4_lock_release,
 };
 
+static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error)
+{
+       struct nfs_client *clp = server->nfs_client;
+       struct nfs4_state *state = lsp->ls_state;
+
+       switch (error) {
+       case -NFS4ERR_ADMIN_REVOKED:
+       case -NFS4ERR_BAD_STATEID:
+       case -NFS4ERR_EXPIRED:
+               if (new_lock_owner != 0 ||
+                  (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0)
+                       nfs4_state_mark_reclaim_nograce(clp, state);
+               lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED;
+               break;
+       case -NFS4ERR_STALE_STATEID:
+               if (new_lock_owner != 0 ||
+                   (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0)
+                       nfs4_state_mark_reclaim_reboot(clp, state);
+               lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED;
+       };
+}
+
 static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int recovery_type)
 {
        struct nfs4_lockdata *data;
@@ -4126,6 +4158,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
        ret = nfs4_wait_for_completion_rpc_task(task);
        if (ret == 0) {
                ret = data->rpc_status;
+               if (ret)
+                       nfs4_handle_setlk_error(data->server, data->lsp,
+                                       data->arg.new_lock_owner, ret);
        } else
                data->cancelled = 1;
        rpc_put_task(task);
@@ -4181,8 +4216,11 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
 {
        struct nfs_inode *nfsi = NFS_I(state->inode);
        unsigned char fl_flags = request->fl_flags;
-       int status;
+       int status = -ENOLCK;
 
+       if ((fl_flags & FL_POSIX) &&
+                       !test_bit(NFS_STATE_POSIX_LOCKS, &state->flags))
+               goto out;
        /* Is this a delegated open? */
        status = nfs4_set_lock_state(state, request);
        if (status != 0)
index 6d263ed79e92d56f8e65deca2ff12d24226f7926..c1e2733f4fa44d400c53e3e7f2b7fc6f2c30756a 100644 (file)
@@ -901,7 +901,7 @@ void nfs4_schedule_state_recovery(struct nfs_client *clp)
        nfs4_schedule_state_manager(clp);
 }
 
-static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
+int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
 {
 
        set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
index e437fd6a819f6f5a3ea5bd7c303a3c3e6b260638..5cd5184b56dbad12a8e204ecd22adcb94c3dadf1 100644 (file)
@@ -4631,7 +4631,7 @@ static int decode_sequence(struct xdr_stream *xdr,
         * If the server returns different values for sessionID, slotID or
         * sequence number, the server is looney tunes.
         */
-       status = -ESERVERFAULT;
+       status = -EREMOTEIO;
 
        if (memcmp(id.data, res->sr_session->sess_id.data,
                   NFS4_MAX_SESSIONID_LEN)) {
@@ -5774,7 +5774,7 @@ static struct {
        { NFS4ERR_BAD_COOKIE,   -EBADCOOKIE     },
        { NFS4ERR_NOTSUPP,      -ENOTSUPP       },
        { NFS4ERR_TOOSMALL,     -ETOOSMALL      },
-       { NFS4ERR_SERVERFAULT,  -ESERVERFAULT   },
+       { NFS4ERR_SERVERFAULT,  -EREMOTEIO      },
        { NFS4ERR_BADTYPE,      -EBADTYPE       },
        { NFS4ERR_LOCKED,       -EAGAIN         },
        { NFS4ERR_SYMLINK,      -ELOOP          },
@@ -5801,7 +5801,7 @@ nfs4_stat_to_errno(int stat)
        }
        if (stat <= 10000 || stat > 10100) {
                /* The server is looney tunes. */
-               return -ESERVERFAULT;
+               return -EREMOTEIO;
        }
        /* If we cannot translate the error, the recovery routines should
         * handle it.
index e2975939126abe4b949e3e7f0d09f8790ba81260..a12c45b65dd42bc1712f23c7050923a6d83eed28 100644 (file)
@@ -176,6 +176,12 @@ void nfs_release_request(struct nfs_page *req)
        kref_put(&req->wb_kref, nfs_free_request);
 }
 
+static int nfs_wait_bit_uninterruptible(void *word)
+{
+       io_schedule();
+       return 0;
+}
+
 /**
  * nfs_wait_on_request - Wait for a request to complete.
  * @req: request to wait upon.
@@ -186,14 +192,9 @@ void nfs_release_request(struct nfs_page *req)
 int
 nfs_wait_on_request(struct nfs_page *req)
 {
-       int ret = 0;
-
-       if (!test_bit(PG_BUSY, &req->wb_flags))
-               goto out;
-       ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY,
-                       nfs_wait_bit_killable, TASK_KILLABLE);
-out:
-       return ret;
+       return wait_on_bit(&req->wb_flags, PG_BUSY,
+                       nfs_wait_bit_uninterruptible,
+                       TASK_UNINTERRUPTIBLE);
 }
 
 /**
index ce907efc5508f049a9ff000a28f8d082159704ce..f1afee4eea77b8eaf9229897a7d23d61e12007b8 100644 (file)
@@ -243,6 +243,7 @@ static int  nfs_show_stats(struct seq_file *, struct vfsmount *);
 static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
 static int nfs_xdev_get_sb(struct file_system_type *fs_type,
                int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
+static void nfs_put_super(struct super_block *);
 static void nfs_kill_super(struct super_block *);
 static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
 
@@ -266,6 +267,7 @@ static const struct super_operations nfs_sops = {
        .alloc_inode    = nfs_alloc_inode,
        .destroy_inode  = nfs_destroy_inode,
        .write_inode    = nfs_write_inode,
+       .put_super      = nfs_put_super,
        .statfs         = nfs_statfs,
        .clear_inode    = nfs_clear_inode,
        .umount_begin   = nfs_umount_begin,
@@ -335,6 +337,7 @@ static const struct super_operations nfs4_sops = {
        .alloc_inode    = nfs_alloc_inode,
        .destroy_inode  = nfs_destroy_inode,
        .write_inode    = nfs_write_inode,
+       .put_super      = nfs_put_super,
        .statfs         = nfs_statfs,
        .clear_inode    = nfs4_clear_inode,
        .umount_begin   = nfs_umount_begin,
@@ -2257,6 +2260,17 @@ error_splat_super:
        goto out;
 }
 
+/*
+ * Ensure that we unregister the bdi before kill_anon_super
+ * releases the device name
+ */
+static void nfs_put_super(struct super_block *s)
+{
+       struct nfs_server *server = NFS_SB(s);
+
+       bdi_unregister(&server->backing_dev_info);
+}
+
 /*
  * Destroy an NFS2/3 superblock
  */
@@ -2265,7 +2279,6 @@ static void nfs_kill_super(struct super_block *s)
        struct nfs_server *server = NFS_SB(s);
 
        kill_anon_super(s);
-       bdi_unregister(&server->backing_dev_info);
        nfs_fscache_release_super_cookie(s);
        nfs_free_server(server);
 }
index 70e1fbbaaeab09f2efe99884c5036d794fec3ee3..ad4d2e787b2041d17eaacc4a1ce8097f0cc13aca 100644 (file)
 
 #include "callback.h"
 
+#ifdef CONFIG_NFS_V4
 static const int nfs_set_port_min = 0;
 static const int nfs_set_port_max = 65535;
+#endif
 static struct ctl_table_header *nfs_callback_sysctl_table;
 
 static ctl_table nfs_cb_sysctls[] = {
index d171696017f4befe44f85ffd79b138f88db7c214..d63d964a0392ed9a73e759b18c34e1ecfe2368c0 100644 (file)
@@ -1233,7 +1233,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 
 
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
-void nfs_commitdata_release(void *data)
+static void nfs_commitdata_release(void *data)
 {
        struct nfs_write_data *wdata = data;
 
@@ -1541,6 +1541,7 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
                        break;
                }
                ret = nfs_wait_on_request(req);
+               nfs_release_request(req);
                if (ret < 0)
                        goto out;
        }
@@ -1597,8 +1598,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
        struct nfs_page *req;
        int ret;
 
-       if (PageFsCache(page))
-               nfs_fscache_release_page(page, GFP_KERNEL);
+       nfs_fscache_release_page(page, GFP_KERNEL);
 
        req = nfs_find_and_lock_request(page);
        ret = PTR_ERR(req);
index c487810a2366feed1d7018085296ccf371ab0947..a0c4016413f16117c1c5141fd01d3b27eabf871e 100644 (file)
@@ -1316,19 +1316,11 @@ rqst_exp_parent(struct svc_rqst *rqstp, struct path *path)
 
 static struct svc_export *find_fsidzero_export(struct svc_rqst *rqstp)
 {
-       struct svc_export *exp;
        u32 fsidv[2];
 
        mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
 
-       exp = rqst_exp_find(rqstp, FSID_NUM, fsidv);
-       /*
-        * We shouldn't have accepting an nfsv4 request at all if we
-        * don't have a pseudoexport!:
-        */
-       if (IS_ERR(exp) && PTR_ERR(exp) == -ENOENT)
-               exp = ERR_PTR(-ESERVERFAULT);
-       return exp;
+       return rqst_exp_find(rqstp, FSID_NUM, fsidv);
 }
 
 /*
index c194793b642b8f5e35175ac52fed9c104606d274..8715d194561aa626bff1d18991a2ac667be00715 100644 (file)
@@ -752,6 +752,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                            flags, current_cred());
        if (IS_ERR(*filp))
                host_err = PTR_ERR(*filp);
+       else
+               host_err = ima_file_check(*filp, access);
 out_nfserr:
        err = nfserrno(host_err);
 out:
@@ -2127,7 +2129,6 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
         */
        path.mnt = exp->ex_path.mnt;
        path.dentry = dentry;
-       err = ima_path_check(&path, acc & (MAY_READ | MAY_WRITE | MAY_EXEC));
 nfsd_out:
        return err? nfserrno(err) : 0;
 }
index 17584c524486c1b732c78d181ec7fb8d61ee1989..105b508b47a8530166199edc48f7267b826e52df 100644 (file)
@@ -2829,7 +2829,7 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
                || sci->sc_seq_request != sci->sc_seq_done);
        spin_unlock(&sci->sc_state_lock);
 
-       if (flag || nilfs_segctor_confirm(sci))
+       if (flag || !nilfs_segctor_confirm(sci))
                nilfs_segctor_write_out(sci);
 
        WARN_ON(!list_empty(&sci->sc_copied_buffers));
index c9ee67b442e17b7713c8d1ca481b0ec22271b0f8..1afb0a10229f448b55be812d2d1939817250cf77 100644 (file)
@@ -121,7 +121,7 @@ static int idr_callback(int id, void *p, void *data)
        if (warned)
                return 0;
 
-       warned = false;
+       warned = true;
        entry = p;
        ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry);
 
index 8271cf05c9577856e427fcd8046be33497ba9265..a94e8bd8eb1f8274372940271970e0506ac3df50 100644 (file)
@@ -552,7 +552,7 @@ retry:
 
        spin_lock(&group->inotify_data.idr_lock);
        ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry,
-                               group->inotify_data.last_wd,
+                               group->inotify_data.last_wd+1,
                                &tmp_ientry->wd);
        spin_unlock(&group->inotify_data.idr_lock);
        if (ret) {
@@ -632,7 +632,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
 
        spin_lock_init(&group->inotify_data.idr_lock);
        idr_init(&group->inotify_data.idr);
-       group->inotify_data.last_wd = 1;
+       group->inotify_data.last_wd = 0;
        group->inotify_data.user = user;
        group->inotify_data.fa = NULL;
 
index 3dae4a13f6e48c968dcad4ddcf28672c807068c6..7e9df11260f40b4326947c96e65d5a5e2c44cc1c 100644 (file)
@@ -599,7 +599,7 @@ bail:
        return ret;
 }
 
-/* 
+/*
  * ocfs2_dio_end_io is called by the dio core when a dio is finished.  We're
  * particularly interested in the aio/dio case.  Like the core uses
  * i_alloc_sem, we use the rw_lock DLM lock to protect io on one node from
@@ -670,7 +670,7 @@ static ssize_t ocfs2_direct_IO(int rw,
 
        ret = blockdev_direct_IO_no_locking(rw, iocb, inode,
                                            inode->i_sb->s_bdev, iov, offset,
-                                           nr_segs, 
+                                           nr_segs,
                                            ocfs2_direct_IO_get_blocks,
                                            ocfs2_dio_end_io);
 
index d43d34a1dd31aa3225673cdbcaf7ed07620a0388..21c808f752d8dc42381ce556547d7ae60c4c82bb 100644 (file)
@@ -368,7 +368,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
        }
        ocfs2_metadata_cache_io_unlock(ci);
 
-       mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", 
+       mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n",
             (unsigned long long)block, nr,
             ((flags & OCFS2_BH_IGNORE_CACHE) || ignore_cache) ? "no" : "yes",
             flags);
index eda5b8bcddd5db3a43a56a7965b9dffeeb193e16..5c98900067082d6066b26e50cc33dec31e7a769d 100644 (file)
@@ -78,7 +78,7 @@ static struct o2hb_callback *hbcall_from_type(enum o2hb_callback_type type);
 
 unsigned int o2hb_dead_threshold = O2HB_DEFAULT_DEAD_THRESHOLD;
 
-/* Only sets a new threshold if there are no active regions. 
+/* Only sets a new threshold if there are no active regions.
  *
  * No locking or otherwise interesting code is required for reading
  * o2hb_dead_threshold as it can't change once regions are active and
@@ -170,7 +170,7 @@ static void o2hb_write_timeout(struct work_struct *work)
 
        mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
             "milliseconds\n", reg->hr_dev_name,
-            jiffies_to_msecs(jiffies - reg->hr_last_timeout_start)); 
+            jiffies_to_msecs(jiffies - reg->hr_last_timeout_start));
        o2quo_disk_timeout();
 }
 
@@ -624,7 +624,7 @@ static int o2hb_check_slot(struct o2hb_region *reg,
             "seq %llu last %llu changed %u equal %u\n",
             slot->ds_node_num, (long long)slot->ds_last_generation,
             le32_to_cpu(hb_block->hb_cksum),
-            (unsigned long long)le64_to_cpu(hb_block->hb_seq), 
+            (unsigned long long)le64_to_cpu(hb_block->hb_seq),
             (unsigned long long)slot->ds_last_time, slot->ds_changed_samples,
             slot->ds_equal_samples);
 
index 334f231a422c732db5a9364596f9d9655f5dee79..d8d0c65ac03cc98feaefdd8a9df941613b482837 100644 (file)
@@ -485,7 +485,7 @@ static void o2net_set_nn_state(struct o2net_node *nn,
        }
 
        if (was_valid && !valid) {
-               printk(KERN_INFO "o2net: no longer connected to "
+               printk(KERN_NOTICE "o2net: no longer connected to "
                       SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc));
                o2net_complete_nodes_nsw(nn);
        }
@@ -493,7 +493,7 @@ static void o2net_set_nn_state(struct o2net_node *nn,
        if (!was_valid && valid) {
                o2quo_conn_up(o2net_num_from_nn(nn));
                cancel_delayed_work(&nn->nn_connect_expired);
-               printk(KERN_INFO "o2net: %s " SC_NODEF_FMT "\n",
+               printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n",
                       o2nm_this_node() > sc->sc_node->nd_num ?
                                "connected to" : "accepted connection from",
                       SC_NODEF_ARGS(sc));
@@ -930,7 +930,7 @@ static void o2net_sendpage(struct o2net_sock_container *sc,
                        cond_resched();
                        continue;
                }
-               mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 
+               mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT
                     " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret);
                o2net_ensure_shutdown(nn, sc, 0);
                break;
@@ -1476,14 +1476,14 @@ static void o2net_idle_timer(unsigned long data)
 
        do_gettimeofday(&now);
 
-       printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u "
+       printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u "
             "seconds, shutting it down.\n", SC_NODEF_ARGS(sc),
                     o2net_idle_timeout() / 1000,
                     o2net_idle_timeout() % 1000);
        mlog(ML_NOTICE, "here are some times that might help debug the "
             "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv "
             "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n",
-            sc->sc_tv_timer.tv_sec, (long) sc->sc_tv_timer.tv_usec, 
+            sc->sc_tv_timer.tv_sec, (long) sc->sc_tv_timer.tv_usec,
             now.tv_sec, (long) now.tv_usec,
             sc->sc_tv_data_ready.tv_sec, (long) sc->sc_tv_data_ready.tv_usec,
             sc->sc_tv_advance_start.tv_sec,
index 8d58cfe410b13babe15d68c35b3f62a6be7331c3..96fa7ebc530cf8fce66f4ccae2aa1fcc53f5f340 100644 (file)
  * on their number */
 #define O2NET_QUORUM_DELAY_MS  ((o2hb_dead_threshold + 2) * O2HB_REGION_TIMEOUT_MS)
 
-/* 
+/*
  * This version number represents quite a lot, unfortunately.  It not
  * only represents the raw network message protocol on the wire but also
- * locking semantics of the file system using the protocol.  It should 
+ * locking semantics of the file system using the protocol.  It should
  * be somewhere else, I'm sure, but right now it isn't.
  *
  * With version 11, we separate out the filesystem locking portion.  The
index b5786a787fabe7d2a46930c278456f91d05343f8..3cfa114aa3910479f844648d92546878fff23c2d 100644 (file)
@@ -95,7 +95,7 @@ const char *dlm_errname(enum dlm_status err);
                mlog(ML_ERROR, "dlm status = %s\n", dlm_errname((st))); \
 } while (0)
 
-#define DLM_LKSB_UNUSED1           0x01  
+#define DLM_LKSB_UNUSED1           0x01
 #define DLM_LKSB_PUT_LVB           0x02
 #define DLM_LKSB_GET_LVB           0x04
 #define DLM_LKSB_UNUSED2           0x08
index 01cf8cc3d286f483d5c405d35dc574ec0fb095b7..dccc439fa087ce65a202ed7a5aa994dd79fa6e9e 100644 (file)
@@ -123,7 +123,7 @@ static void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock)
                dlm_lock_put(lock);
                /* free up the reserved bast that we are cancelling.
                 * guaranteed that this will not be the last reserved
-                * ast because *both* an ast and a bast were reserved 
+                * ast because *both* an ast and a bast were reserved
                 * to get to this point.  the res->spinlock will not be
                 * taken here */
                dlm_lockres_release_ast(dlm, res);
index ca96bce50e18cb6629343f6a0436b8bec2aa20a6..f283bce776b48e4d916cd4a6b4d84c7b38775c69 100644 (file)
@@ -396,7 +396,7 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm,
                        /* instead of logging the same network error over
                         * and over, sleep here and wait for the heartbeat
                         * to notice the node is dead.  times out after 5s. */
-                       dlm_wait_for_node_death(dlm, res->owner, 
+                       dlm_wait_for_node_death(dlm, res->owner,
                                                DLM_NODE_DEATH_WAIT_MAX);
                        ret = DLM_RECOVERING;
                        mlog(0, "node %u died so returning DLM_RECOVERING "
index 42b0bad7a612459c8f3e6857cbf829cab964bd57..0cd24cf543962dc5251622c531fb3ad9ad2d0324 100644 (file)
@@ -102,7 +102,7 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
        assert_spin_locked(&res->spinlock);
 
        stringify_lockname(res->lockname.name, res->lockname.len,
-                          buf, sizeof(buf) - 1);
+                          buf, sizeof(buf));
        printk("lockres: %s, owner=%u, state=%u\n",
               buf, res->owner, res->state);
        printk("  last used: %lu, refcnt: %u, on purge list: %s\n",
index 0334000676d3ad7f48765ff1fcde2e6d8e1f3a03..988c9055fd4e6c98888ab3a53072eed309f88b6d 100644 (file)
@@ -816,7 +816,7 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data,
        }
 
        /* Once the dlm ctxt is marked as leaving then we don't want
-        * to be put in someone's domain map. 
+        * to be put in someone's domain map.
         * Also, explicitly disallow joining at certain troublesome
         * times (ie. during recovery). */
        if (dlm && dlm->dlm_state != DLM_CTXT_LEAVING) {
index 437698e9465fd01114fd117228cd39095445f795..73333777267154750e5f505a0272f328e8d23455 100644 (file)
@@ -269,7 +269,7 @@ static enum dlm_status dlmlock_remote(struct dlm_ctxt *dlm,
                }
                dlm_revert_pending_lock(res, lock);
                dlm_lock_put(lock);
-       } else if (dlm_is_recovery_lock(res->lockname.name, 
+       } else if (dlm_is_recovery_lock(res->lockname.name,
                                        res->lockname.len)) {
                /* special case for the $RECOVERY lock.
                 * there will never be an AST delivered to put
index 03ccf9a7b1f48506fd659a46903f826bd1adcfbe..a659606dcb9592f1d0c719ed7167b1fe158296f2 100644 (file)
@@ -366,7 +366,7 @@ void dlm_hb_event_notify_attached(struct dlm_ctxt *dlm, int idx, int node_up)
        struct dlm_master_list_entry *mle;
 
        assert_spin_locked(&dlm->spinlock);
-       
+
        list_for_each_entry(mle, &dlm->mle_hb_events, hb_events) {
                if (node_up)
                        dlm_mle_node_up(dlm, mle, NULL, idx);
@@ -833,7 +833,7 @@ lookup:
                __dlm_insert_mle(dlm, mle);
 
                /* still holding the dlm spinlock, check the recovery map
-                * to see if there are any nodes that still need to be 
+                * to see if there are any nodes that still need to be
                 * considered.  these will not appear in the mle nodemap
                 * but they might own this lockres.  wait on them. */
                bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0);
@@ -883,7 +883,7 @@ redo_request:
                                msleep(500);
                        }
                        continue;
-               } 
+               }
 
                dlm_kick_recovery_thread(dlm);
                msleep(1000);
@@ -939,8 +939,8 @@ wait:
                     res->lockname.name, blocked);
                if (++tries > 20) {
                        mlog(ML_ERROR, "%s:%.*s: spinning on "
-                            "dlm_wait_for_lock_mastery, blocked=%d\n", 
-                            dlm->name, res->lockname.len, 
+                            "dlm_wait_for_lock_mastery, blocked=%d\n",
+                            dlm->name, res->lockname.len,
                             res->lockname.name, blocked);
                        dlm_print_one_lock_resource(res);
                        dlm_print_one_mle(mle);
@@ -1029,7 +1029,7 @@ recheck:
                ret = dlm_restart_lock_mastery(dlm, res, mle, *blocked);
                b = (mle->type == DLM_MLE_BLOCK);
                if ((*blocked && !b) || (!*blocked && b)) {
-                       mlog(0, "%s:%.*s: status change: old=%d new=%d\n", 
+                       mlog(0, "%s:%.*s: status change: old=%d new=%d\n",
                             dlm->name, res->lockname.len, res->lockname.name,
                             *blocked, b);
                        *blocked = b;
@@ -1602,7 +1602,7 @@ send_response:
                }
                mlog(0, "%u is the owner of %.*s, cleaning everyone else\n",
                             dlm->node_num, res->lockname.len, res->lockname.name);
-               ret = dlm_dispatch_assert_master(dlm, res, 0, request->node_idx, 
+               ret = dlm_dispatch_assert_master(dlm, res, 0, request->node_idx,
                                                 DLM_ASSERT_MASTER_MLE_CLEANUP);
                if (ret < 0) {
                        mlog(ML_ERROR, "failed to dispatch assert master work\n");
@@ -1701,7 +1701,7 @@ again:
 
                if (r & DLM_ASSERT_RESPONSE_REASSERT) {
                        mlog(0, "%.*s: node %u create mles on other "
-                            "nodes and requests a re-assert\n", 
+                            "nodes and requests a re-assert\n",
                             namelen, lockname, to);
                        reassert = 1;
                }
@@ -1812,7 +1812,7 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data,
                                spin_unlock(&dlm->master_lock);
                                spin_unlock(&dlm->spinlock);
                                goto done;
-                       }       
+                       }
                }
        }
        spin_unlock(&dlm->master_lock);
@@ -1883,7 +1883,7 @@ ok:
                int extra_ref = 0;
                int nn = -1;
                int rr, err = 0;
-               
+
                spin_lock(&mle->spinlock);
                if (mle->type == DLM_MLE_BLOCK || mle->type == DLM_MLE_MIGRATION)
                        extra_ref = 1;
@@ -1891,7 +1891,7 @@ ok:
                        /* MASTER mle: if any bits set in the response map
                         * then the calling node needs to re-assert to clear
                         * up nodes that this node contacted */
-                       while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES, 
+                       while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES,
                                                    nn+1)) < O2NM_MAX_NODES) {
                                if (nn != dlm->node_num && nn != assert->node_idx)
                                        master_request = 1;
@@ -2002,7 +2002,7 @@ kill:
        __dlm_print_one_lock_resource(res);
        spin_unlock(&res->spinlock);
        spin_unlock(&dlm->spinlock);
-       *ret_data = (void *)res; 
+       *ret_data = (void *)res;
        dlm_put(dlm);
        return -EINVAL;
 }
@@ -2040,10 +2040,10 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
        item->u.am.request_from = request_from;
        item->u.am.flags = flags;
 
-       if (ignore_higher) 
-               mlog(0, "IGNORE HIGHER: %.*s\n", res->lockname.len, 
+       if (ignore_higher)
+               mlog(0, "IGNORE HIGHER: %.*s\n", res->lockname.len,
                     res->lockname.name);
-               
+
        spin_lock(&dlm->work_lock);
        list_add_tail(&item->list, &dlm->work_list);
        spin_unlock(&dlm->work_lock);
@@ -2133,7 +2133,7 @@ put:
  * think that $RECOVERY is currently mastered by a dead node.  If so,
  * we wait a short time to allow that node to get notified by its own
  * heartbeat stack, then check again.  All $RECOVERY lock resources
- * mastered by dead nodes are purged when the hearbeat callback is 
+ * mastered by dead nodes are purged when the hearbeat callback is
  * fired, so we can know for sure that it is safe to continue once
  * the node returns a live node or no node.  */
 static int dlm_pre_master_reco_lockres(struct dlm_ctxt *dlm,
@@ -2174,7 +2174,7 @@ static int dlm_pre_master_reco_lockres(struct dlm_ctxt *dlm,
                                ret = -EAGAIN;
                        }
                        spin_unlock(&dlm->spinlock);
-                       mlog(0, "%s: reco lock master is %u\n", dlm->name, 
+                       mlog(0, "%s: reco lock master is %u\n", dlm->name,
                             master);
                        break;
                }
@@ -2602,7 +2602,7 @@ fail:
 
                        mlog(0, "%s:%.*s: timed out during migration\n",
                             dlm->name, res->lockname.len, res->lockname.name);
-                       /* avoid hang during shutdown when migrating lockres 
+                       /* avoid hang during shutdown when migrating lockres
                         * to a node which also goes down */
                        if (dlm_is_node_dead(dlm, target)) {
                                mlog(0, "%s:%.*s: expected migration "
@@ -2738,7 +2738,7 @@ static int dlm_migration_can_proceed(struct dlm_ctxt *dlm,
        can_proceed = !!(res->state & DLM_LOCK_RES_MIGRATING);
        spin_unlock(&res->spinlock);
 
-       /* target has died, so make the caller break out of the 
+       /* target has died, so make the caller break out of the
         * wait_event, but caller must recheck the domain_map */
        spin_lock(&dlm->spinlock);
        if (!test_bit(mig_target, dlm->domain_map))
index 2f9e4e19a4f2a3ca95bc82607ce369fd1dd43b59..344bcf90cbf4966af4821accc0e61183e6b4be56 100644 (file)
@@ -1050,7 +1050,7 @@ static void dlm_move_reco_locks_to_list(struct dlm_ctxt *dlm,
                                if (lock->ml.node == dead_node) {
                                        mlog(0, "AHA! there was "
                                             "a $RECOVERY lock for dead "
-                                            "node %u (%s)!\n", 
+                                            "node %u (%s)!\n",
                                             dead_node, dlm->name);
                                        list_del_init(&lock->list);
                                        dlm_lock_put(lock);
@@ -1164,6 +1164,39 @@ static void dlm_init_migratable_lockres(struct dlm_migratable_lockres *mres,
        mres->master = master;
 }
 
+static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock,
+                                         struct dlm_migratable_lockres *mres,
+                                         int queue)
+{
+       if (!lock->lksb)
+              return;
+
+       /* Ignore lvb in all locks in the blocked list */
+       if (queue == DLM_BLOCKED_LIST)
+               return;
+
+       /* Only consider lvbs in locks with granted EX or PR lock levels */
+       if (lock->ml.type != LKM_EXMODE && lock->ml.type != LKM_PRMODE)
+               return;
+
+       if (dlm_lvb_is_empty(mres->lvb)) {
+               memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+               return;
+       }
+
+       /* Ensure the lvb copied for migration matches in other valid locks */
+       if (!memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))
+               return;
+
+       mlog(ML_ERROR, "Mismatched lvb in lock cookie=%u:%llu, name=%.*s, "
+            "node=%u\n",
+            dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
+            dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
+            lock->lockres->lockname.len, lock->lockres->lockname.name,
+            lock->ml.node);
+       dlm_print_one_lock_resource(lock->lockres);
+       BUG();
+}
 
 /* returns 1 if this lock fills the network structure,
  * 0 otherwise */
@@ -1181,20 +1214,7 @@ static int dlm_add_lock_to_array(struct dlm_lock *lock,
        ml->list = queue;
        if (lock->lksb) {
                ml->flags = lock->lksb->flags;
-               /* send our current lvb */
-               if (ml->type == LKM_EXMODE ||
-                   ml->type == LKM_PRMODE) {
-                       /* if it is already set, this had better be a PR
-                        * and it has to match */
-                       if (!dlm_lvb_is_empty(mres->lvb) &&
-                           (ml->type == LKM_EXMODE ||
-                            memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))) {
-                               mlog(ML_ERROR, "mismatched lvbs!\n");
-                               dlm_print_one_lock_resource(lock->lockres);
-                               BUG();
-                       }
-                       memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
-               }
+               dlm_prepare_lvb_for_migration(lock, mres, queue);
        }
        ml->node = lock->ml.node;
        mres->num_locks++;
@@ -1730,6 +1750,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
        struct dlm_lock *lock = NULL;
        u8 from = O2NM_MAX_NODES;
        unsigned int added = 0;
+       __be64 c;
 
        mlog(0, "running %d locks for this lockres\n", mres->num_locks);
        for (i=0; i<mres->num_locks; i++) {
@@ -1777,19 +1798,48 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
                        /* lock is always created locally first, and
                         * destroyed locally last.  it must be on the list */
                        if (!lock) {
-                               __be64 c = ml->cookie;
-                               mlog(ML_ERROR, "could not find local lock "
-                                              "with cookie %u:%llu!\n",
+                               c = ml->cookie;
+                               mlog(ML_ERROR, "Could not find local lock "
+                                              "with cookie %u:%llu, node %u, "
+                                              "list %u, flags 0x%x, type %d, "
+                                              "conv %d, highest blocked %d\n",
                                     dlm_get_lock_cookie_node(be64_to_cpu(c)),
-                                    dlm_get_lock_cookie_seq(be64_to_cpu(c)));
+                                    dlm_get_lock_cookie_seq(be64_to_cpu(c)),
+                                    ml->node, ml->list, ml->flags, ml->type,
+                                    ml->convert_type, ml->highest_blocked);
+                               __dlm_print_one_lock_resource(res);
+                               BUG();
+                       }
+
+                       if (lock->ml.node != ml->node) {
+                               c = lock->ml.cookie;
+                               mlog(ML_ERROR, "Mismatched node# in lock "
+                                    "cookie %u:%llu, name %.*s, node %u\n",
+                                    dlm_get_lock_cookie_node(be64_to_cpu(c)),
+                                    dlm_get_lock_cookie_seq(be64_to_cpu(c)),
+                                    res->lockname.len, res->lockname.name,
+                                    lock->ml.node);
+                               c = ml->cookie;
+                               mlog(ML_ERROR, "Migrate lock cookie %u:%llu, "
+                                    "node %u, list %u, flags 0x%x, type %d, "
+                                    "conv %d, highest blocked %d\n",
+                                    dlm_get_lock_cookie_node(be64_to_cpu(c)),
+                                    dlm_get_lock_cookie_seq(be64_to_cpu(c)),
+                                    ml->node, ml->list, ml->flags, ml->type,
+                                    ml->convert_type, ml->highest_blocked);
                                __dlm_print_one_lock_resource(res);
                                BUG();
                        }
-                       BUG_ON(lock->ml.node != ml->node);
 
                        if (tmpq != queue) {
-                               mlog(0, "lock was on %u instead of %u for %.*s\n",
-                                    j, ml->list, res->lockname.len, res->lockname.name);
+                               c = ml->cookie;
+                               mlog(0, "Lock cookie %u:%llu was on list %u "
+                                    "instead of list %u for %.*s\n",
+                                    dlm_get_lock_cookie_node(be64_to_cpu(c)),
+                                    dlm_get_lock_cookie_seq(be64_to_cpu(c)),
+                                    j, ml->list, res->lockname.len,
+                                    res->lockname.name);
+                               __dlm_print_one_lock_resource(res);
                                spin_unlock(&res->spinlock);
                                continue;
                        }
@@ -1839,7 +1889,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
                                 * the lvb. */
                                memcpy(res->lvb, mres->lvb, DLM_LVB_LEN);
                        } else {
-                               /* otherwise, the node is sending its 
+                               /* otherwise, the node is sending its
                                 * most recent valid lvb info */
                                BUG_ON(ml->type != LKM_EXMODE &&
                                       ml->type != LKM_PRMODE);
@@ -1886,7 +1936,7 @@ skip_lvb:
                spin_lock(&res->spinlock);
                list_for_each_entry(lock, queue, list) {
                        if (lock->ml.cookie == ml->cookie) {
-                               __be64 c = lock->ml.cookie;
+                               c = lock->ml.cookie;
                                mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already "
                                     "exists on this lockres!\n", dlm->name,
                                     res->lockname.len, res->lockname.name,
@@ -2114,7 +2164,7 @@ static void dlm_revalidate_lvb(struct dlm_ctxt *dlm,
        assert_spin_locked(&res->spinlock);
 
        if (res->owner == dlm->node_num)
-               /* if this node owned the lockres, and if the dead node 
+               /* if this node owned the lockres, and if the dead node
                 * had an EX when he died, blank out the lvb */
                search_node = dead_node;
        else {
@@ -2152,7 +2202,7 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm,
 
        /* this node is the lockres master:
         * 1) remove any stale locks for the dead node
-        * 2) if the dead node had an EX when he died, blank out the lvb 
+        * 2) if the dead node had an EX when he died, blank out the lvb
         */
        assert_spin_locked(&dlm->spinlock);
        assert_spin_locked(&res->spinlock);
@@ -2193,7 +2243,12 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm,
                mlog(0, "%s:%.*s: freed %u locks for dead node %u, "
                     "dropping ref from lockres\n", dlm->name,
                     res->lockname.len, res->lockname.name, freed, dead_node);
-               BUG_ON(!test_bit(dead_node, res->refmap));
+               if(!test_bit(dead_node, res->refmap)) {
+                       mlog(ML_ERROR, "%s:%.*s: freed %u locks for dead node %u, "
+                            "but ref was not set\n", dlm->name,
+                            res->lockname.len, res->lockname.name, freed, dead_node);
+                       __dlm_print_one_lock_resource(res);
+               }
                dlm_lockres_clear_refmap_bit(dead_node, res);
        } else if (test_bit(dead_node, res->refmap)) {
                mlog(0, "%s:%.*s: dead node %u had a ref, but had "
@@ -2260,7 +2315,7 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
                                }
                                spin_unlock(&res->spinlock);
                                continue;
-                       }                       
+                       }
                        spin_lock(&res->spinlock);
                        /* zero the lvb if necessary */
                        dlm_revalidate_lvb(dlm, res, dead_node);
@@ -2411,7 +2466,7 @@ static void dlm_reco_unlock_ast(void *astdata, enum dlm_status st)
  * this function on each node racing to become the recovery
  * master will not stop attempting this until either:
  * a) this node gets the EX (and becomes the recovery master),
- * or b) dlm->reco.new_master gets set to some nodenum 
+ * or b) dlm->reco.new_master gets set to some nodenum
  * != O2NM_INVALID_NODE_NUM (another node will do the reco).
  * so each time a recovery master is needed, the entire cluster
  * will sync at this point.  if the new master dies, that will
@@ -2424,7 +2479,7 @@ static int dlm_pick_recovery_master(struct dlm_ctxt *dlm)
 
        mlog(0, "starting recovery of %s at %lu, dead=%u, this=%u\n",
             dlm->name, jiffies, dlm->reco.dead_node, dlm->node_num);
-again: 
+again:
        memset(&lksb, 0, sizeof(lksb));
 
        ret = dlmlock(dlm, LKM_EXMODE, &lksb, LKM_NOQUEUE|LKM_RECOVERY,
@@ -2437,8 +2492,8 @@ again:
        if (ret == DLM_NORMAL) {
                mlog(0, "dlm=%s dlmlock says I got it (this=%u)\n",
                     dlm->name, dlm->node_num);
-               
-               /* got the EX lock.  check to see if another node 
+
+               /* got the EX lock.  check to see if another node
                 * just became the reco master */
                if (dlm_reco_master_ready(dlm)) {
                        mlog(0, "%s: got reco EX lock, but %u will "
@@ -2451,12 +2506,12 @@ again:
                        /* see if recovery was already finished elsewhere */
                        spin_lock(&dlm->spinlock);
                        if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) {
-                               status = -EINVAL;       
+                               status = -EINVAL;
                                mlog(0, "%s: got reco EX lock, but "
                                     "node got recovered already\n", dlm->name);
                                if (dlm->reco.new_master != O2NM_INVALID_NODE_NUM) {
                                        mlog(ML_ERROR, "%s: new master is %u "
-                                            "but no dead node!\n", 
+                                            "but no dead node!\n",
                                             dlm->name, dlm->reco.new_master);
                                        BUG();
                                }
@@ -2468,7 +2523,7 @@ again:
                 * set the master and send the messages to begin recovery */
                if (!status) {
                        mlog(0, "%s: dead=%u, this=%u, sending "
-                            "begin_reco now\n", dlm->name, 
+                            "begin_reco now\n", dlm->name,
                             dlm->reco.dead_node, dlm->node_num);
                        status = dlm_send_begin_reco_message(dlm,
                                      dlm->reco.dead_node);
@@ -2501,7 +2556,7 @@ again:
                mlog(0, "dlm=%s dlmlock says another node got it (this=%u)\n",
                     dlm->name, dlm->node_num);
                /* another node is master. wait on
-                * reco.new_master != O2NM_INVALID_NODE_NUM 
+                * reco.new_master != O2NM_INVALID_NODE_NUM
                 * for at most one second */
                wait_event_timeout(dlm->dlm_reco_thread_wq,
                                         dlm_reco_master_ready(dlm),
@@ -2589,7 +2644,13 @@ retry:
                             "begin reco msg (%d)\n", dlm->name, nodenum, ret);
                        ret = 0;
                }
-               if (ret == -EAGAIN) {
+
+               /*
+                * Prior to commit aad1b15310b9bcd59fa81ab8f2b1513b59553ea8,
+                * dlm_begin_reco_handler() returned EAGAIN and not -EAGAIN.
+                * We are handling both for compatibility reasons.
+                */
+               if (ret == -EAGAIN || ret == EAGAIN) {
                        mlog(0, "%s: trying to start recovery of node "
                             "%u, but node %u is waiting for last recovery "
                             "to complete, backoff for a bit\n", dlm->name,
@@ -2599,7 +2660,7 @@ retry:
                }
                if (ret < 0) {
                        struct dlm_lock_resource *res;
-                       /* this is now a serious problem, possibly ENOMEM 
+                       /* this is now a serious problem, possibly ENOMEM
                         * in the network stack.  must retry */
                        mlog_errno(ret);
                        mlog(ML_ERROR, "begin reco of dlm %s to node %u "
@@ -2612,7 +2673,7 @@ retry:
                        } else {
                                mlog(ML_ERROR, "recovery lock not found\n");
                        }
-                       /* sleep for a bit in hopes that we can avoid 
+                       /* sleep for a bit in hopes that we can avoid
                         * another ENOMEM */
                        msleep(100);
                        goto retry;
@@ -2664,7 +2725,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
        }
        if (dlm->reco.dead_node != O2NM_INVALID_NODE_NUM) {
                mlog(ML_NOTICE, "%s: dead_node previously set to %u, "
-                    "node %u changing it to %u\n", dlm->name, 
+                    "node %u changing it to %u\n", dlm->name,
                     dlm->reco.dead_node, br->node_idx, br->dead_node);
        }
        dlm_set_reco_master(dlm, br->node_idx);
@@ -2730,8 +2791,8 @@ stage2:
                if (ret < 0) {
                        mlog_errno(ret);
                        if (dlm_is_host_down(ret)) {
-                               /* this has no effect on this recovery 
-                                * session, so set the status to zero to 
+                               /* this has no effect on this recovery
+                                * session, so set the status to zero to
                                 * finish out the last recovery */
                                mlog(ML_ERROR, "node %u went down after this "
                                     "node finished recovery.\n", nodenum);
@@ -2768,7 +2829,7 @@ int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data,
        mlog(0, "%s: node %u finalizing recovery stage%d of "
             "node %u (%u:%u)\n", dlm->name, fr->node_idx, stage,
             fr->dead_node, dlm->reco.dead_node, dlm->reco.new_master);
+
        spin_lock(&dlm->spinlock);
 
        if (dlm->reco.new_master != fr->node_idx) {
index 00f53b2aea76a21a955eeac0c403a81c954947e8..49e29ecd02017be2144c2f50df76b8b0f761ad2d 100644 (file)
@@ -190,8 +190,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
                        actions &= ~(DLM_UNLOCK_REMOVE_LOCK|
                                     DLM_UNLOCK_REGRANT_LOCK|
                                     DLM_UNLOCK_CLEAR_CONVERT_TYPE);
-               } else if (status == DLM_RECOVERING || 
-                          status == DLM_MIGRATING || 
+               } else if (status == DLM_RECOVERING ||
+                          status == DLM_MIGRATING ||
                           status == DLM_FORWARD) {
                        /* must clear the actions because this unlock
                         * is about to be retried.  cannot free or do
@@ -661,14 +661,14 @@ retry:
        if (call_ast) {
                mlog(0, "calling unlockast(%p, %d)\n", data, status);
                if (is_master) {
-                       /* it is possible that there is one last bast 
+                       /* it is possible that there is one last bast
                         * pending.  make sure it is flushed, then
                         * call the unlockast.
                         * not an issue if this is a mastered remotely,
                         * since this lock has been removed from the
                         * lockres queues and cannot be found. */
                        dlm_kick_thread(dlm, NULL);
-                       wait_event(dlm->ast_wq, 
+                       wait_event(dlm->ast_wq,
                                   dlm_lock_basts_flushed(dlm, lock));
                }
                (*unlockast)(data, status);
index c5e4a49e3a1257b48a08abe717236cd713b4dd1f..e044019cb3b12e41da5ca6139d3bd79a778bbf85 100644 (file)
@@ -875,6 +875,14 @@ static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lo
                lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH);
 
        lockres->l_level = lockres->l_requested;
+
+       /*
+        * We set the OCFS2_LOCK_UPCONVERT_FINISHING flag before clearing
+        * the OCFS2_LOCK_BUSY flag to prevent the dc thread from
+        * downconverting the lock before the upconvert has fully completed.
+        */
+       lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
+
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
 
        mlog_exit_void();
@@ -907,8 +915,6 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
 
        assert_spin_locked(&lockres->l_lock);
 
-       lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED);
-
        if (level > lockres->l_blocking) {
                /* only schedule a downconvert if we haven't already scheduled
                 * one that goes low enough to satisfy the level we're
@@ -921,6 +927,9 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
                lockres->l_blocking = level;
        }
 
+       if (needs_downconvert)
+               lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED);
+
        mlog_exit(needs_downconvert);
        return needs_downconvert;
 }
@@ -1133,6 +1142,7 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
        mlog_entry_void();
        spin_lock_irqsave(&lockres->l_lock, flags);
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
+       lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
        if (convert)
                lockres->l_action = OCFS2_AST_INVALID;
        else
@@ -1323,13 +1333,13 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
 again:
        wait = 0;
 
+       spin_lock_irqsave(&lockres->l_lock, flags);
+
        if (catch_signals && signal_pending(current)) {
                ret = -ERESTARTSYS;
-               goto out;
+               goto unlock;
        }
 
-       spin_lock_irqsave(&lockres->l_lock, flags);
-
        mlog_bug_on_msg(lockres->l_flags & OCFS2_LOCK_FREEING,
                        "Cluster lock called on freeing lockres %s! flags "
                        "0x%lx\n", lockres->l_name, lockres->l_flags);
@@ -1346,6 +1356,25 @@ again:
                goto unlock;
        }
 
+       if (lockres->l_flags & OCFS2_LOCK_UPCONVERT_FINISHING) {
+               /*
+                * We've upconverted. If the lock now has a level we can
+                * work with, we take it. If, however, the lock is not at the
+                * required level, we go thru the full cycle. One way this could
+                * happen is if a process requesting an upconvert to PR is
+                * closely followed by another requesting upconvert to an EX.
+                * If the process requesting EX lands here, we want it to
+                * continue attempting to upconvert and let the process
+                * requesting PR take the lock.
+                * If multiple processes request upconvert to PR, the first one
+                * here will take the lock. The others will have to go thru the
+                * OCFS2_LOCK_BLOCKED check to ensure that there is no pending
+                * downconvert request.
+                */
+               if (level <= lockres->l_level)
+                       goto update_holders;
+       }
+
        if (lockres->l_flags & OCFS2_LOCK_BLOCKED &&
            !ocfs2_may_continue_on_blocked_lock(lockres, level)) {
                /* is the lock is currently blocked on behalf of
@@ -1416,11 +1445,14 @@ again:
                goto again;
        }
 
+update_holders:
        /* Ok, if we get here then we're good to go. */
        ocfs2_inc_holders(lockres, level);
 
        ret = 0;
 unlock:
+       lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
+
        spin_unlock_irqrestore(&lockres->l_lock, flags);
 out:
        /*
@@ -3155,7 +3187,7 @@ out:
 /* Mark the lockres as being dropped. It will no longer be
  * queued if blocking, but we still may have to wait on it
  * being dequeued from the downconvert thread before we can consider
- * it safe to drop. 
+ * it safe to drop.
  *
  * You can *not* attempt to call cluster_lock on this lockres anymore. */
 void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres)
@@ -3352,6 +3384,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
        unsigned long flags;
        int blocking;
        int new_level;
+       int level;
        int ret = 0;
        int set_lvb = 0;
        unsigned int gen;
@@ -3360,9 +3393,17 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
 
        spin_lock_irqsave(&lockres->l_lock, flags);
 
-       BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED));
-
 recheck:
+       /*
+        * Is it still blocking? If not, we have no more work to do.
+        */
+       if (!(lockres->l_flags & OCFS2_LOCK_BLOCKED)) {
+               BUG_ON(lockres->l_blocking != DLM_LOCK_NL);
+               spin_unlock_irqrestore(&lockres->l_lock, flags);
+               ret = 0;
+               goto leave;
+       }
+
        if (lockres->l_flags & OCFS2_LOCK_BUSY) {
                /* XXX
                 * This is a *big* race.  The OCFS2_LOCK_PENDING flag
@@ -3401,6 +3442,31 @@ recheck:
                goto leave;
        }
 
+       /*
+        * This prevents livelocks. OCFS2_LOCK_UPCONVERT_FINISHING flag is
+        * set when the ast is received for an upconvert just before the
+        * OCFS2_LOCK_BUSY flag is cleared. Now if the fs received a bast
+        * on the heels of the ast, we want to delay the downconvert just
+        * enough to allow the up requestor to do its task. Because this
+        * lock is in the blocked queue, the lock will be downconverted
+        * as soon as the requestor is done with the lock.
+        */
+       if (lockres->l_flags & OCFS2_LOCK_UPCONVERT_FINISHING)
+               goto leave_requeue;
+
+       /*
+        * How can we block and yet be at NL?  We were trying to upconvert
+        * from NL and got canceled.  The code comes back here, and now
+        * we notice and clear BLOCKING.
+        */
+       if (lockres->l_level == DLM_LOCK_NL) {
+               BUG_ON(lockres->l_ex_holders || lockres->l_ro_holders);
+               lockres->l_blocking = DLM_LOCK_NL;
+               lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED);
+               spin_unlock_irqrestore(&lockres->l_lock, flags);
+               goto leave;
+       }
+
        /* if we're blocking an exclusive and we have *any* holders,
         * then requeue. */
        if ((lockres->l_blocking == DLM_LOCK_EX)
@@ -3438,6 +3504,7 @@ recheck:
         * may sleep, so we save off a copy of what we're blocking as
         * it may change while we're not holding the spin lock. */
        blocking = lockres->l_blocking;
+       level = lockres->l_level;
        spin_unlock_irqrestore(&lockres->l_lock, flags);
 
        ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking);
@@ -3446,7 +3513,7 @@ recheck:
                goto leave;
 
        spin_lock_irqsave(&lockres->l_lock, flags);
-       if (blocking != lockres->l_blocking) {
+       if ((blocking != lockres->l_blocking) || (level != lockres->l_level)) {
                /* If this changed underneath us, then we can't drop
                 * it just yet. */
                goto recheck;
index 15713cbb865c8ee66cde272a2e95bfb47ceb3429..19ad145d2af3171aaab2be2580dc89549ac37eeb 100644 (file)
@@ -239,7 +239,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
                mlog(0, "Encoding parent: blkno: %llu, generation: %u\n",
                     (unsigned long long)blkno, generation);
        }
-       
+
        *max_len = len;
 
 bail:
index d35a27f4523e13e2ec00411e08e6ebb2e1afbf76..5328529e7fd289e963da8cfa7b66d5706babb00c 100644 (file)
@@ -192,7 +192,7 @@ static int ocfs2_try_to_merge_extent_map(struct ocfs2_extent_map_item *emi,
                emi->ei_clusters += ins->ei_clusters;
                return 1;
        } else if ((ins->ei_phys + ins->ei_clusters) == emi->ei_phys &&
-                  (ins->ei_cpos + ins->ei_clusters) == emi->ei_phys &&
+                  (ins->ei_cpos + ins->ei_clusters) == emi->ei_cpos &&
                   ins->ei_flags == emi->ei_flags) {
                emi->ei_phys = ins->ei_phys;
                emi->ei_cpos = ins->ei_cpos;
index 06ccf6a86d35ca01a8f80e5a997a30ea8820f30a..558ce03124210049742360210efff968232c668f 100644 (file)
@@ -749,7 +749,7 @@ static int ocfs2_write_zero_page(struct inode *inode,
        int ret;
 
        offset = (size & (PAGE_CACHE_SIZE-1)); /* Within page */
-       /* ugh.  in prepare/commit_write, if from==to==start of block, we 
+       /* ugh.  in prepare/commit_write, if from==to==start of block, we
        ** skip the prepare.  make sure we never send an offset for the start
        ** of a block
        */
@@ -1779,7 +1779,7 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
        struct inode *inode = dentry->d_inode;
        loff_t saved_pos, end;
 
-       /* 
+       /*
         * We start with a read level meta lock and only jump to an ex
         * if we need to make modifications here.
         */
@@ -2013,8 +2013,8 @@ out_dio:
        /* buffered aio wouldn't have proper lock coverage today */
        BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
 
-       if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode) ||
-           (file->f_flags & O_DIRECT && has_refcount)) {
+       if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
+           ((file->f_flags & O_DIRECT) && has_refcount)) {
                ret = filemap_fdatawrite_range(file->f_mapping, pos,
                                               pos + count - 1);
                if (ret < 0)
@@ -2033,7 +2033,7 @@ out_dio:
                                                      pos + count - 1);
        }
 
-       /* 
+       /*
         * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
         * function pointer which is called when o_direct io completes so that
         * it can unlock our rw lock.  (it's the clustered equivalent of
@@ -2198,7 +2198,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
                goto bail;
        }
 
-       /* 
+       /*
         * buffered reads protect themselves in ->readpage().  O_DIRECT reads
         * need locks to protect pending reads from racing with truncate.
         */
@@ -2220,10 +2220,10 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
         * We're fine letting folks race truncates and extending
         * writes with read across the cluster, just like they can
         * locally. Hence no rw_lock during read.
-        * 
+        *
         * Take and drop the meta data lock to update inode fields
         * like i_size. This allows the checks down below
-        * generic_file_aio_read() a chance of actually working. 
+        * generic_file_aio_read() a chance of actually working.
         */
        ret = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
        if (ret < 0) {
@@ -2248,7 +2248,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 bail:
        if (have_alloc_sem)
                up_read(&inode->i_alloc_sem);
-       if (rw_level != -1) 
+       if (rw_level != -1)
                ocfs2_rw_unlock(inode, rw_level);
        mlog_exit(ret);
 
index 0297fb8982b861afdae1d974e9fdae96bf0a1f13..88459bdd1ff37eb538485b796174086ffd421138 100644 (file)
@@ -475,7 +475,7 @@ static int ocfs2_read_locked_inode(struct inode *inode,
        if (args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY) {
                status = ocfs2_try_open_lock(inode, 0);
                if (status) {
-                       make_bad_inode(inode);  
+                       make_bad_inode(inode);
                        return status;
                }
        }
@@ -684,7 +684,7 @@ bail:
        return status;
 }
 
-/* 
+/*
  * Serialize with orphan dir recovery. If the process doing
  * recovery on this orphan dir does an iget() with the dir
  * i_mutex held, we'll deadlock here. Instead we detect this
index 31fbb061951035d3211e1041e5b39bb6ed8d6db9..7d9d9c132cef3a5d59a412aa4d0d3c26c10a5fb0 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/fs.h>
 #include <linux/mount.h>
+#include <linux/compat.h>
 
 #define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
@@ -181,6 +182,10 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 #ifdef CONFIG_COMPAT
 long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 {
+       bool preserve;
+       struct reflink_arguments args;
+       struct inode *inode = file->f_path.dentry->d_inode;
+
        switch (cmd) {
        case OCFS2_IOC32_GETFLAGS:
                cmd = OCFS2_IOC_GETFLAGS;
@@ -195,8 +200,15 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
        case OCFS2_IOC_GROUP_EXTEND:
        case OCFS2_IOC_GROUP_ADD:
        case OCFS2_IOC_GROUP_ADD64:
-       case OCFS2_IOC_REFLINK:
                break;
+       case OCFS2_IOC_REFLINK:
+               if (copy_from_user(&args, (struct reflink_arguments *)arg,
+                                  sizeof(args)))
+                       return -EFAULT;
+               preserve = (args.preserve != 0);
+
+               return ocfs2_reflink_ioctl(inode, compat_ptr(args.old_path),
+                                          compat_ptr(args.new_path), preserve);
        default:
                return -ENOIOCTLCMD;
        }
index bf34c491ae966601f61f05897db6567fc216e6c8..9336c60e3a36a9bd72b155b5cf68ba8b20b4aa90 100644 (file)
@@ -2034,7 +2034,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb,
                status = -ENOENT;
                mlog_errno(status);
                return status;
-       }       
+       }
 
        mutex_lock(&orphan_dir_inode->i_mutex);
        status = ocfs2_inode_lock(orphan_dir_inode, NULL, 0);
index 9362eea7424be2421b461b76032d85733573c731..740f448041e2e66bef6792166f93c0df838a6785 100644 (file)
@@ -136,6 +136,10 @@ enum ocfs2_unlock_action {
 #define OCFS2_LOCK_PENDING       (0x00000400) /* This lockres is pending a
                                                 call to dlm_lock.  Only
                                                 exists with BUSY set. */
+#define OCFS2_LOCK_UPCONVERT_FINISHING (0x00000800) /* blocks the dc thread
+                                                    * from downconverting
+                                                    * before the upconvert
+                                                    * has completed */
 
 struct ocfs2_lock_res_ops;
 
index 1a1a679e51b5dd235a8bef0d45212fb8626eae9b..7638a38c32bc61659995bb7c1d476e54f7b08963 100644 (file)
@@ -1417,9 +1417,16 @@ static inline int ocfs2_fast_symlink_chars(int blocksize)
        return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);
 }
 
-static inline int ocfs2_max_inline_data(int blocksize)
+static inline int ocfs2_max_inline_data_with_xattr(int blocksize,
+                                                  struct ocfs2_dinode *di)
 {
-       return blocksize - offsetof(struct ocfs2_dinode, id2.i_data.id_data);
+       if (di && (di->i_dyn_features & OCFS2_INLINE_XATTR_FL))
+               return blocksize -
+                       offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
+                       di->i_xattr_inline_size;
+       else
+               return blocksize -
+                       offsetof(struct ocfs2_dinode, id2.i_data.id_data);
 }
 
 static inline int ocfs2_extent_recs_per_inode(int blocksize)
index 74db2be75dd686220913207662dd0c04ea7c755d..8ae65c9c020c7f2769472a09668aad6737d933df 100644 (file)
@@ -2945,7 +2945,7 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
 
        while (offset < end) {
                page_index = offset >> PAGE_CACHE_SHIFT;
-               map_end = (page_index + 1) << PAGE_CACHE_SHIFT;
+               map_end = ((loff_t)page_index + 1) << PAGE_CACHE_SHIFT;
                if (map_end > end)
                        map_end = end;
 
@@ -2957,8 +2957,12 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
 
                page = grab_cache_page(mapping, page_index);
 
-               /* This page can't be dirtied before we CoW it out. */
-               BUG_ON(PageDirty(page));
+               /*
+                * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
+                * can't be dirtied before we CoW it out.
+                */
+               if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize)
+                       BUG_ON(PageDirty(page));
 
                if (!PageUptodate(page)) {
                        ret = block_read_full_page(page, ocfs2_get_block);
@@ -3170,7 +3174,7 @@ static int ocfs2_cow_sync_writeback(struct super_block *sb,
 
        while (offset < end) {
                page_index = offset >> PAGE_CACHE_SHIFT;
-               map_end = (page_index + 1) << PAGE_CACHE_SHIFT;
+               map_end = ((loff_t)page_index + 1) << PAGE_CACHE_SHIFT;
                if (map_end > end)
                        map_end = end;
 
index e49c41050264dfa9d36afc48e742b626ee9d2755..3038c92af4939438ab065f9f8cb123bc3c66a8b6 100644 (file)
@@ -277,7 +277,7 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
        u32 dlm_key;
        struct dlm_ctxt *dlm;
        struct o2dlm_private *priv;
-       struct dlm_protocol_version dlm_version;
+       struct dlm_protocol_version fs_version;
 
        BUG_ON(conn == NULL);
        BUG_ON(o2cb_stack.sp_proto == NULL);
@@ -304,18 +304,18 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn)
        /* used by the dlm code to make message headers unique, each
         * node in this domain must agree on this. */
        dlm_key = crc32_le(0, conn->cc_name, conn->cc_namelen);
-       dlm_version.pv_major = conn->cc_version.pv_major;
-       dlm_version.pv_minor = conn->cc_version.pv_minor;
+       fs_version.pv_major = conn->cc_version.pv_major;
+       fs_version.pv_minor = conn->cc_version.pv_minor;
 
-       dlm = dlm_register_domain(conn->cc_name, dlm_key, &dlm_version);
+       dlm = dlm_register_domain(conn->cc_name, dlm_key, &fs_version);
        if (IS_ERR(dlm)) {
                rc = PTR_ERR(dlm);
                mlog_errno(rc);
                goto out_free;
        }
 
-       conn->cc_version.pv_major = dlm_version.pv_major;
-       conn->cc_version.pv_minor = dlm_version.pv_minor;
+       conn->cc_version.pv_major = fs_version.pv_major;
+       conn->cc_version.pv_minor = fs_version.pv_minor;
        conn->cc_lockspace = dlm;
 
        dlm_register_eviction_cb(dlm, &priv->op_eviction_cb);
index 26069917a9f51752a18c8dea60940d0b00ca1054..755cd49a5ef3c41e535de82a36d4d534f1f06dfa 100644 (file)
@@ -1062,7 +1062,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
                                     "file system, but write access is "
                                     "unavailable.\n");
                        else
-                               mlog_errno(status);                     
+                               mlog_errno(status);
                        goto read_super_error;
                }
 
index 49b133ccbf113f79a62b58298b2e65405f3e4601..32499d213fc4f80f37efde6f71196283236896bf 100644 (file)
@@ -137,20 +137,20 @@ static void *ocfs2_fast_follow_link(struct dentry *dentry,
        }
 
        memcpy(link, target, len);
-       nd_set_link(nd, link);
 
 bail:
+       nd_set_link(nd, status ? ERR_PTR(status) : link);
        brelse(bh);
 
        mlog_exit(status);
-       return status ? ERR_PTR(status) : link;
+       return NULL;
 }
 
 static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
 {
-       char *link = cookie;
-
-       kfree(link);
+       char *link = nd_get_link(nd);
+       if (!IS_ERR(link))
+               kfree(link);
 }
 
 const struct inode_operations ocfs2_symlink_inode_operations = {
index c61369342a276e17a6e35fcc79df544a2bd4419c..a0a120e82b9712fce6d128a4ab536be2b9dd2d0a 100644 (file)
@@ -267,8 +267,8 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci,
 }
 
 /* Warning: even if it returns true, this does *not* guarantee that
- * the block is stored in our inode metadata cache. 
- * 
+ * the block is stored in our inode metadata cache.
+ *
  * This can be called under lock_buffer()
  */
 int ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci,
index 13b5d07081751e1cb42aca4ce491c9a52b70ab4f..18e20feee251b22fb7d89f5b220e46267621573d 100644 (file)
@@ -270,7 +270,9 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
                blocked = p->blocked;
                collect_sigign_sigcatch(p, &ignored, &caught);
                num_threads = atomic_read(&p->signal->count);
+               rcu_read_lock();  /* FIXME: is this correct? */
                qsize = atomic_read(&__task_cred(p)->user->sigpending);
+               rcu_read_unlock();
                qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
                unlock_task_sighand(p, &flags);
        }
index 18d5cc62d8ed92ebefb2a85cb26642ecc78d796d..623e2ffb5d2bb5ae7fbb153af881a24f6f9932a0 100644 (file)
@@ -1095,8 +1095,12 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
        if (!capable(CAP_AUDIT_CONTROL))
                return -EPERM;
 
-       if (current != pid_task(proc_pid(inode), PIDTYPE_PID))
+       rcu_read_lock();
+       if (current != pid_task(proc_pid(inode), PIDTYPE_PID)) {
+               rcu_read_unlock();
                return -EPERM;
+       }
+       rcu_read_unlock();
 
        if (count >= PAGE_SIZE)
                count = PAGE_SIZE - 1;
@@ -1419,7 +1423,6 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
                goto out;
 
        error = PROC_I(inode)->op.proc_get_link(inode, &nd->path);
-       nd->last_type = LAST_BIND;
 out:
        return ERR_PTR(error);
 }
@@ -2370,16 +2373,30 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
        struct pid_namespace *ns = dentry->d_sb->s_fs_info;
        pid_t tgid = task_tgid_nr_ns(current, ns);
-       char tmp[PROC_NUMBUF];
-       if (!tgid)
-               return ERR_PTR(-ENOENT);
-       sprintf(tmp, "%d", task_tgid_nr_ns(current, ns));
-       return ERR_PTR(vfs_follow_link(nd,tmp));
+       char *name = ERR_PTR(-ENOENT);
+       if (tgid) {
+               name = __getname();
+               if (!name)
+                       name = ERR_PTR(-ENOMEM);
+               else
+                       sprintf(name, "%d", tgid);
+       }
+       nd_set_link(nd, name);
+       return NULL;
+}
+
+static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
+                               void *cookie)
+{
+       char *s = nd_get_link(nd);
+       if (!IS_ERR(s))
+               __putname(s);
 }
 
 static const struct inode_operations proc_self_inode_operations = {
        .readlink       = proc_self_readlink,
        .follow_link    = proc_self_follow_link,
+       .put_link       = proc_self_put_link,
 };
 
 /*
index 123257bb356b38bc8fe614b101a2354a24c82e47..f8650dce74fb069c6a66a497c4933cc50e630539 100644 (file)
 #include <linux/seq_file.h>
 #include <linux/stat.h>
 #include <linux/string.h>
+#include <linux/of.h>
+#include <linux/module.h>
 #include <asm/prom.h>
 #include <asm/uaccess.h>
 #include "internal.h"
 
-#ifndef HAVE_ARCH_DEVTREE_FIXUPS
 static inline void set_node_proc_entry(struct device_node *np,
                                       struct proc_dir_entry *de)
 {
-}
+#ifdef HAVE_ARCH_DEVTREE_FIXUPS
+       np->pde = de;
 #endif
+}
 
 static struct proc_dir_entry *proc_device_tree;
 
index 2efc57173fd703b74bfc1adaad5289df1ff1f179..1739a4aba25fc02cee3bbbec52354940fb0166dd 100644 (file)
@@ -121,30 +121,6 @@ add_error:
        return ret;
 }
 
-/*****************************************************************************/
-/*
- * check that file shrinkage doesn't leave any VMAs dangling in midair
- */
-static int ramfs_nommu_check_mappings(struct inode *inode,
-                                     size_t newsize, size_t size)
-{
-       struct vm_area_struct *vma;
-       struct prio_tree_iter iter;
-
-       /* search for VMAs that fall within the dead zone */
-       vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap,
-                             newsize >> PAGE_SHIFT,
-                             (size + PAGE_SIZE - 1) >> PAGE_SHIFT
-                             ) {
-               /* found one - only interested if it's shared out of the page
-                * cache */
-               if (vma->vm_flags & VM_SHARED)
-                       return -ETXTBSY; /* not quite true, but near enough */
-       }
-
-       return 0;
-}
-
 /*****************************************************************************/
 /*
  *
@@ -164,7 +140,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
 
        /* check that a decrease in size doesn't cut off any shared mappings */
        if (newsize < size) {
-               ret = ramfs_nommu_check_mappings(inode, newsize, size);
+               ret = nommu_shrink_inode_mappings(inode, size, newsize);
                if (ret < 0)
                        return ret;
        }
index 9087b10209e634c4f694aceaad2e14bde7e01ba2..2df0f5c7c60bf37b69b7949e239e2d81a57b0ab5 100644 (file)
@@ -1497,9 +1497,11 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key)
 
        args.objectid = key->on_disk_key.k_objectid;
        args.dirid = key->on_disk_key.k_dir_id;
+       reiserfs_write_unlock(s);
        inode = iget5_locked(s, key->on_disk_key.k_objectid,
                             reiserfs_find_actor, reiserfs_init_locked_inode,
                             (void *)(&args));
+       reiserfs_write_lock(s);
        if (!inode)
                return ERR_PTR(-ENOMEM);
 
index 83ac4d3b3cb0f019f128b30c81f6e2e94e8b5a98..ba98546fabbd1921beedc54074f7399115f14f54 100644 (file)
@@ -2913,7 +2913,9 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
        journal->j_mount_id = 10;
        journal->j_state = 0;
        atomic_set(&(journal->j_jlock), 0);
+       reiserfs_write_unlock(sb);
        journal->j_cnode_free_list = allocate_cnodes(num_cnodes);
+       reiserfs_write_lock(sb);
        journal->j_cnode_free_orig = journal->j_cnode_free_list;
        journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0;
        journal->j_cnode_used = 0;
index c117fa80d1e9b9ddc9be29a7d412022b9d158010..42d213546894a3b412bea8634f7c9535f25cdb19 100644 (file)
@@ -544,6 +544,7 @@ error:
 error_rsb_inval:
        ret = -EINVAL;
 error_rsb:
+       kfree(rsb);
        return ret;
 }
 
index 220b758523aed175e426a9e61a2085430e034364..6a06a1d1ea7b1c31a19997fb04e01aac1afb7137 100644 (file)
@@ -81,24 +81,23 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
                if (!sd_attrs)
                        return -ENOMEM;
                sd->s_iattr = sd_attrs;
-       } else {
-               /* attributes were changed at least once in past */
-               iattrs = &sd_attrs->ia_iattr;
-
-               if (ia_valid & ATTR_UID)
-                       iattrs->ia_uid = iattr->ia_uid;
-               if (ia_valid & ATTR_GID)
-                       iattrs->ia_gid = iattr->ia_gid;
-               if (ia_valid & ATTR_ATIME)
-                       iattrs->ia_atime = iattr->ia_atime;
-               if (ia_valid & ATTR_MTIME)
-                       iattrs->ia_mtime = iattr->ia_mtime;
-               if (ia_valid & ATTR_CTIME)
-                       iattrs->ia_ctime = iattr->ia_ctime;
-               if (ia_valid & ATTR_MODE) {
-                       umode_t mode = iattr->ia_mode;
-                       iattrs->ia_mode = sd->s_mode = mode;
-               }
+       }
+       /* attributes were changed at least once in past */
+       iattrs = &sd_attrs->ia_iattr;
+
+       if (ia_valid & ATTR_UID)
+               iattrs->ia_uid = iattr->ia_uid;
+       if (ia_valid & ATTR_GID)
+               iattrs->ia_gid = iattr->ia_gid;
+       if (ia_valid & ATTR_ATIME)
+               iattrs->ia_atime = iattr->ia_atime;
+       if (ia_valid & ATTR_MTIME)
+               iattrs->ia_mtime = iattr->ia_mtime;
+       if (ia_valid & ATTR_CTIME)
+               iattrs->ia_ctime = iattr->ia_ctime;
+       if (ia_valid & ATTR_MODE) {
+               umode_t mode = iattr->ia_mode;
+               iattrs->ia_mode = sd->s_mode = mode;
        }
        return 0;
 }
index 56641fe52a23be696f492639fe19ebbaf97466e5..5c5a366aa332ca656e4594ee7dfd21a2182d4e92 100644 (file)
@@ -16,7 +16,7 @@
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 
-EXTRA_CFLAGS +=         -I$(src) -I$(src)/linux-2.6 -funsigned-char
+EXTRA_CFLAGS +=         -I$(src) -I$(src)/linux-2.6
 
 XFS_LINUX := linux-2.6
 
index 2d3f90afe5f14ee6ef3543d0bd6e01be014952ba..bc7405585defce739ac13a6668aadf33856305da 100644 (file)
@@ -16,7 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/mm.h>
-#include <linux/vmalloc.h>
 #include <linux/highmem.h>
 #include <linux/swap.h>
 #include <linux/blkdev.h>
 #include "time.h"
 #include "kmem.h"
 
-#define MAX_VMALLOCS   6
-#define MAX_SLAB_SIZE  0x20000
+/*
+ * Greedy allocation.  May fail and may return vmalloced memory.
+ *
+ * Must be freed using kmem_free_large.
+ */
+void *
+kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize)
+{
+       void            *ptr;
+       size_t          kmsize = maxsize;
+
+       while (!(ptr = kmem_zalloc_large(kmsize))) {
+               if ((kmsize >>= 1) <= minsize)
+                       kmsize = minsize;
+       }
+       if (ptr)
+               *size = kmsize;
+       return ptr;
+}
 
 void *
 kmem_alloc(size_t size, unsigned int __nocast flags)
@@ -34,19 +50,8 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
        gfp_t   lflags = kmem_flags_convert(flags);
        void    *ptr;
 
-#ifdef DEBUG
-       if (unlikely(!(flags & KM_LARGE) && (size > PAGE_SIZE))) {
-               printk(KERN_WARNING "Large %s attempt, size=%ld\n",
-                       __func__, (long)size);
-               dump_stack();
-       }
-#endif
-
        do {
-               if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS)
-                       ptr = kmalloc(size, lflags);
-               else
-                       ptr = __vmalloc(size, lflags, PAGE_KERNEL);
+               ptr = kmalloc(size, lflags);
                if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
                        return ptr;
                if (!(++retries % 100))
@@ -68,27 +73,6 @@ kmem_zalloc(size_t size, unsigned int __nocast flags)
        return ptr;
 }
 
-void *
-kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize,
-                  unsigned int __nocast flags)
-{
-       void            *ptr;
-       size_t          kmsize = maxsize;
-       unsigned int    kmflags = (flags & ~KM_SLEEP) | KM_NOSLEEP;
-
-       while (!(ptr = kmem_zalloc(kmsize, kmflags))) {
-               if ((kmsize <= minsize) && (flags & KM_NOSLEEP))
-                       break;
-               if ((kmsize >>= 1) <= minsize) {
-                       kmsize = minsize;
-                       kmflags = flags;
-               }
-       }
-       if (ptr)
-               *size = kmsize;
-       return ptr;
-}
-
 void
 kmem_free(const void *ptr)
 {
index 179cbd630f692f6c0220112d6ba01cda65ef67d9..f7c8f7a9ea6d5dab0e86ae3b60daf90931ec5f86 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/vmalloc.h>
 
 /*
  * General memory allocation interfaces
@@ -30,7 +31,6 @@
 #define KM_NOSLEEP     0x0002u
 #define KM_NOFS                0x0004u
 #define KM_MAYFAIL     0x0008u
-#define KM_LARGE       0x0010u
 
 /*
  * We use a special process flag to avoid recursive callbacks into
@@ -42,7 +42,7 @@ kmem_flags_convert(unsigned int __nocast flags)
 {
        gfp_t   lflags;
 
-       BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL|KM_LARGE));
+       BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL));
 
        if (flags & KM_NOSLEEP) {
                lflags = GFP_ATOMIC | __GFP_NOWARN;
@@ -56,10 +56,25 @@ kmem_flags_convert(unsigned int __nocast flags)
 
 extern void *kmem_alloc(size_t, unsigned int __nocast);
 extern void *kmem_zalloc(size_t, unsigned int __nocast);
-extern void *kmem_zalloc_greedy(size_t *, size_t, size_t, unsigned int __nocast);
 extern void *kmem_realloc(const void *, size_t, size_t, unsigned int __nocast);
 extern void  kmem_free(const void *);
 
+static inline void *kmem_zalloc_large(size_t size)
+{
+       void *ptr;
+
+       ptr = vmalloc(size);
+       if (ptr)
+               memset(ptr, 0, size);
+       return ptr;
+}
+static inline void kmem_free_large(void *ptr)
+{
+       vfree(ptr);
+}
+
+extern void *kmem_zalloc_greedy(size_t *, size_t, size_t);
+
 /*
  * Zone interfaces
  */
index 883ca5ab8af572f4daa961e3e0fb1a6777bd3a3c..bf85bbe4a9aedd8b43ac57829024fc94095ac91f 100644 (file)
@@ -106,7 +106,7 @@ xfs_get_acl(struct inode *inode, int type)
        struct posix_acl *acl;
        struct xfs_acl *xfs_acl;
        int len = sizeof(struct xfs_acl);
-       char *ea_name;
+       unsigned char *ea_name;
        int error;
 
        acl = get_cached_acl(inode, type);
@@ -133,7 +133,8 @@ xfs_get_acl(struct inode *inode, int type)
        if (!xfs_acl)
                return ERR_PTR(-ENOMEM);
 
-       error = -xfs_attr_get(ip, ea_name, (char *)xfs_acl, &len, ATTR_ROOT);
+       error = -xfs_attr_get(ip, ea_name, (unsigned char *)xfs_acl,
+                                                       &len, ATTR_ROOT);
        if (error) {
                /*
                 * If the attribute doesn't exist make sure we have a negative
@@ -162,7 +163,7 @@ STATIC int
 xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
        struct xfs_inode *ip = XFS_I(inode);
-       char *ea_name;
+       unsigned char *ea_name;
        int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -194,7 +195,7 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
                        (sizeof(struct xfs_acl_entry) *
                         (XFS_ACL_MAX_ENTRIES - acl->a_count));
 
-               error = -xfs_attr_set(ip, ea_name, (char *)xfs_acl,
+               error = -xfs_attr_set(ip, ea_name, (unsigned char *)xfs_acl,
                                len, ATTR_ROOT);
 
                kfree(xfs_acl);
@@ -262,7 +263,7 @@ xfs_set_mode(struct inode *inode, mode_t mode)
 }
 
 static int
-xfs_acl_exists(struct inode *inode, char *name)
+xfs_acl_exists(struct inode *inode, unsigned char *name)
 {
        int len = sizeof(struct xfs_acl);
 
index 77b8be81c76900559d8e382ee9e7a42710ae86e5..6f76ba85f193e724e8bba96d5c8cc07e40fb1c50 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/migrate.h>
 #include <linux/backing-dev.h>
 #include <linux/freezer.h>
+#include <linux/list_sort.h>
 
 #include "xfs_sb.h"
 #include "xfs_inum.h"
@@ -76,6 +77,27 @@ struct workqueue_struct *xfsconvertd_workqueue;
 #define xfs_buf_deallocate(bp) \
        kmem_zone_free(xfs_buf_zone, (bp));
 
+static inline int
+xfs_buf_is_vmapped(
+       struct xfs_buf  *bp)
+{
+       /*
+        * Return true if the buffer is vmapped.
+        *
+        * The XBF_MAPPED flag is set if the buffer should be mapped, but the
+        * code is clever enough to know it doesn't have to map a single page,
+        * so the check has to be both for XBF_MAPPED and bp->b_page_count > 1.
+        */
+       return (bp->b_flags & XBF_MAPPED) && bp->b_page_count > 1;
+}
+
+static inline int
+xfs_buf_vmap_len(
+       struct xfs_buf  *bp)
+{
+       return (bp->b_page_count * PAGE_SIZE) - bp->b_offset;
+}
+
 /*
  *     Page Region interfaces.
  *
@@ -314,7 +336,7 @@ xfs_buf_free(
        if (bp->b_flags & (_XBF_PAGE_CACHE|_XBF_PAGES)) {
                uint            i;
 
-               if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1))
+               if (xfs_buf_is_vmapped(bp))
                        free_address(bp->b_addr - bp->b_offset);
 
                for (i = 0; i < bp->b_page_count; i++) {
@@ -1051,22 +1073,30 @@ xfs_buf_ioerror(
 }
 
 int
-xfs_bawrite(
-       void                    *mp,
+xfs_bwrite(
+       struct xfs_mount        *mp,
        struct xfs_buf          *bp)
 {
-       trace_xfs_buf_bawrite(bp, _RET_IP_);
+       int                     iowait = (bp->b_flags & XBF_ASYNC) == 0;
+       int                     error = 0;
 
-       ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL);
+       bp->b_strat = xfs_bdstrat_cb;
+       bp->b_mount = mp;
+       bp->b_flags |= XBF_WRITE;
+       if (!iowait)
+               bp->b_flags |= _XBF_RUN_QUEUES;
 
        xfs_buf_delwri_dequeue(bp);
+       xfs_buf_iostrategy(bp);
 
-       bp->b_flags &= ~(XBF_READ | XBF_DELWRI | XBF_READ_AHEAD);
-       bp->b_flags |= (XBF_WRITE | XBF_ASYNC | _XBF_RUN_QUEUES);
+       if (iowait) {
+               error = xfs_buf_iowait(bp);
+               if (error)
+                       xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
+               xfs_buf_relse(bp);
+       }
 
-       bp->b_mount = mp;
-       bp->b_strat = xfs_bdstrat_cb;
-       return xfs_bdstrat_cb(bp);
+       return error;
 }
 
 void
@@ -1085,6 +1115,126 @@ xfs_bdwrite(
        xfs_buf_delwri_queue(bp, 1);
 }
 
+/*
+ * Called when we want to stop a buffer from getting written or read.
+ * We attach the EIO error, muck with its flags, and call biodone
+ * so that the proper iodone callbacks get called.
+ */
+STATIC int
+xfs_bioerror(
+       xfs_buf_t *bp)
+{
+#ifdef XFSERRORDEBUG
+       ASSERT(XFS_BUF_ISREAD(bp) || bp->b_iodone);
+#endif
+
+       /*
+        * No need to wait until the buffer is unpinned, we aren't flushing it.
+        */
+       XFS_BUF_ERROR(bp, EIO);
+
+       /*
+        * We're calling biodone, so delete XBF_DONE flag.
+        */
+       XFS_BUF_UNREAD(bp);
+       XFS_BUF_UNDELAYWRITE(bp);
+       XFS_BUF_UNDONE(bp);
+       XFS_BUF_STALE(bp);
+
+       XFS_BUF_CLR_BDSTRAT_FUNC(bp);
+       xfs_biodone(bp);
+
+       return EIO;
+}
+
+/*
+ * Same as xfs_bioerror, except that we are releasing the buffer
+ * here ourselves, and avoiding the biodone call.
+ * This is meant for userdata errors; metadata bufs come with
+ * iodone functions attached, so that we can track down errors.
+ */
+STATIC int
+xfs_bioerror_relse(
+       struct xfs_buf  *bp)
+{
+       int64_t         fl = XFS_BUF_BFLAGS(bp);
+       /*
+        * No need to wait until the buffer is unpinned.
+        * We aren't flushing it.
+        *
+        * chunkhold expects B_DONE to be set, whether
+        * we actually finish the I/O or not. We don't want to
+        * change that interface.
+        */
+       XFS_BUF_UNREAD(bp);
+       XFS_BUF_UNDELAYWRITE(bp);
+       XFS_BUF_DONE(bp);
+       XFS_BUF_STALE(bp);
+       XFS_BUF_CLR_IODONE_FUNC(bp);
+       XFS_BUF_CLR_BDSTRAT_FUNC(bp);
+       if (!(fl & XBF_ASYNC)) {
+               /*
+                * Mark b_error and B_ERROR _both_.
+                * Lot's of chunkcache code assumes that.
+                * There's no reason to mark error for
+                * ASYNC buffers.
+                */
+               XFS_BUF_ERROR(bp, EIO);
+               XFS_BUF_FINISH_IOWAIT(bp);
+       } else {
+               xfs_buf_relse(bp);
+       }
+
+       return EIO;
+}
+
+
+/*
+ * All xfs metadata buffers except log state machine buffers
+ * get this attached as their b_bdstrat callback function.
+ * This is so that we can catch a buffer
+ * after prematurely unpinning it to forcibly shutdown the filesystem.
+ */
+int
+xfs_bdstrat_cb(
+       struct xfs_buf  *bp)
+{
+       if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
+               trace_xfs_bdstrat_shut(bp, _RET_IP_);
+               /*
+                * Metadata write that didn't get logged but
+                * written delayed anyway. These aren't associated
+                * with a transaction, and can be ignored.
+                */
+               if (!bp->b_iodone && !XFS_BUF_ISREAD(bp))
+                       return xfs_bioerror_relse(bp);
+               else
+                       return xfs_bioerror(bp);
+       }
+
+       xfs_buf_iorequest(bp);
+       return 0;
+}
+
+/*
+ * Wrapper around bdstrat so that we can stop data from going to disk in case
+ * we are shutting down the filesystem.  Typically user data goes thru this
+ * path; one of the exceptions is the superblock.
+ */
+void
+xfsbdstrat(
+       struct xfs_mount        *mp,
+       struct xfs_buf          *bp)
+{
+       if (XFS_FORCED_SHUTDOWN(mp)) {
+               trace_xfs_bdstrat_shut(bp, _RET_IP_);
+               xfs_bioerror_relse(bp);
+               return;
+       }
+
+       xfs_buf_iorequest(bp);
+}
+
 STATIC void
 _xfs_buf_ioend(
        xfs_buf_t               *bp,
@@ -1107,6 +1257,9 @@ xfs_buf_bio_end_io(
 
        xfs_buf_ioerror(bp, -error);
 
+       if (!error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
+               invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
+
        do {
                struct page     *page = bvec->bv_page;
 
@@ -1216,6 +1369,10 @@ next_chunk:
 
 submit_io:
        if (likely(bio->bi_size)) {
+               if (xfs_buf_is_vmapped(bp)) {
+                       flush_kernel_vmap_range(bp->b_addr,
+                                               xfs_buf_vmap_len(bp));
+               }
                submit_bio(rw, bio);
                if (size)
                        goto next_chunk;
@@ -1296,7 +1453,7 @@ xfs_buf_iomove(
        xfs_buf_t               *bp,    /* buffer to process            */
        size_t                  boff,   /* starting buffer offset       */
        size_t                  bsize,  /* length to copy               */
-       caddr_t                 data,   /* data address                 */
+       void                    *data,  /* data address                 */
        xfs_buf_rw_t            mode)   /* read/write/zero flag         */
 {
        size_t                  bend, cpoff, csize;
@@ -1378,8 +1535,8 @@ xfs_alloc_bufhash(
 
        btp->bt_hashshift = external ? 3 : 8;   /* 8 or 256 buckets */
        btp->bt_hashmask = (1 << btp->bt_hashshift) - 1;
-       btp->bt_hash = kmem_zalloc((1 << btp->bt_hashshift) *
-                                       sizeof(xfs_bufhash_t), KM_SLEEP | KM_LARGE);
+       btp->bt_hash = kmem_zalloc_large((1 << btp->bt_hashshift) *
+                                        sizeof(xfs_bufhash_t));
        for (i = 0; i < (1 << btp->bt_hashshift); i++) {
                spin_lock_init(&btp->bt_hash[i].bh_lock);
                INIT_LIST_HEAD(&btp->bt_hash[i].bh_list);
@@ -1390,7 +1547,7 @@ STATIC void
 xfs_free_bufhash(
        xfs_buftarg_t           *btp)
 {
-       kmem_free(btp->bt_hash);
+       kmem_free_large(btp->bt_hash);
        btp->bt_hash = NULL;
 }
 
@@ -1595,6 +1752,11 @@ xfs_buf_delwri_queue(
                list_del(&bp->b_list);
        }
 
+       if (list_empty(dwq)) {
+               /* start xfsbufd as it is about to have something to do */
+               wake_up_process(bp->b_target->bt_task);
+       }
+
        bp->b_flags |= _XBF_DELWRI_Q;
        list_add_tail(&bp->b_list, dwq);
        bp->b_queuetime = jiffies;
@@ -1626,6 +1788,35 @@ xfs_buf_delwri_dequeue(
        trace_xfs_buf_delwri_dequeue(bp, _RET_IP_);
 }
 
+/*
+ * If a delwri buffer needs to be pushed before it has aged out, then promote
+ * it to the head of the delwri queue so that it will be flushed on the next
+ * xfsbufd run. We do this by resetting the queuetime of the buffer to be older
+ * than the age currently needed to flush the buffer. Hence the next time the
+ * xfsbufd sees it is guaranteed to be considered old enough to flush.
+ */
+void
+xfs_buf_delwri_promote(
+       struct xfs_buf  *bp)
+{
+       struct xfs_buftarg *btp = bp->b_target;
+       long            age = xfs_buf_age_centisecs * msecs_to_jiffies(10) + 1;
+
+       ASSERT(bp->b_flags & XBF_DELWRI);
+       ASSERT(bp->b_flags & _XBF_DELWRI_Q);
+
+       /*
+        * Check the buffer age before locking the delayed write queue as we
+        * don't need to promote buffers that are already past the flush age.
+        */
+       if (bp->b_queuetime < jiffies - age)
+               return;
+       bp->b_queuetime = jiffies - age;
+       spin_lock(&btp->bt_delwrite_lock);
+       list_move(&bp->b_list, &btp->bt_delwrite_queue);
+       spin_unlock(&btp->bt_delwrite_lock);
+}
+
 STATIC void
 xfs_buf_runall_queues(
        struct workqueue_struct *queue)
@@ -1644,6 +1835,8 @@ xfsbufd_wakeup(
        list_for_each_entry(btp, &xfs_buftarg_list, bt_list) {
                if (test_bit(XBT_FORCE_SLEEP, &btp->bt_flags))
                        continue;
+               if (list_empty(&btp->bt_delwrite_queue))
+                       continue;
                set_bit(XBT_FORCE_FLUSH, &btp->bt_flags);
                wake_up_process(btp->bt_task);
        }
@@ -1694,20 +1887,53 @@ xfs_buf_delwri_split(
 
 }
 
+/*
+ * Compare function is more complex than it needs to be because
+ * the return value is only 32 bits and we are doing comparisons
+ * on 64 bit values
+ */
+static int
+xfs_buf_cmp(
+       void            *priv,
+       struct list_head *a,
+       struct list_head *b)
+{
+       struct xfs_buf  *ap = container_of(a, struct xfs_buf, b_list);
+       struct xfs_buf  *bp = container_of(b, struct xfs_buf, b_list);
+       xfs_daddr_t             diff;
+
+       diff = ap->b_bn - bp->b_bn;
+       if (diff < 0)
+               return -1;
+       if (diff > 0)
+               return 1;
+       return 0;
+}
+
+void
+xfs_buf_delwri_sort(
+       xfs_buftarg_t   *target,
+       struct list_head *list)
+{
+       list_sort(NULL, list, xfs_buf_cmp);
+}
+
 STATIC int
 xfsbufd(
        void            *data)
 {
-       struct list_head tmp;
-       xfs_buftarg_t   *target = (xfs_buftarg_t *)data;
-       int             count;
-       xfs_buf_t       *bp;
+       xfs_buftarg_t   *target = (xfs_buftarg_t *)data;
 
        current->flags |= PF_MEMALLOC;
 
        set_freezable();
 
        do {
+               long    age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
+               long    tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
+               int     count = 0;
+               struct list_head tmp;
+
                if (unlikely(freezing(current))) {
                        set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
                        refrigerator();
@@ -1715,17 +1941,16 @@ xfsbufd(
                        clear_bit(XBT_FORCE_SLEEP, &target->bt_flags);
                }
 
-               schedule_timeout_interruptible(
-                       xfs_buf_timer_centisecs * msecs_to_jiffies(10));
+               /* sleep for a long time if there is nothing to do. */
+               if (list_empty(&target->bt_delwrite_queue))
+                       tout = MAX_SCHEDULE_TIMEOUT;
+               schedule_timeout_interruptible(tout);
 
-               xfs_buf_delwri_split(target, &tmp,
-                               xfs_buf_age_centisecs * msecs_to_jiffies(10));
-
-               count = 0;
+               xfs_buf_delwri_split(target, &tmp, age);
+               list_sort(NULL, &tmp, xfs_buf_cmp);
                while (!list_empty(&tmp)) {
-                       bp = list_entry(tmp.next, xfs_buf_t, b_list);
-                       ASSERT(target == bp->b_target);
-
+                       struct xfs_buf *bp;
+                       bp = list_first_entry(&tmp, struct xfs_buf, b_list);
                        list_del_init(&bp->b_list);
                        xfs_buf_iostrategy(bp);
                        count++;
@@ -1751,42 +1976,45 @@ xfs_flush_buftarg(
        xfs_buftarg_t   *target,
        int             wait)
 {
-       struct list_head tmp;
-       xfs_buf_t       *bp, *n;
+       xfs_buf_t       *bp;
        int             pincount = 0;
+       LIST_HEAD(tmp_list);
+       LIST_HEAD(wait_list);
 
        xfs_buf_runall_queues(xfsconvertd_workqueue);
        xfs_buf_runall_queues(xfsdatad_workqueue);
        xfs_buf_runall_queues(xfslogd_workqueue);
 
        set_bit(XBT_FORCE_FLUSH, &target->bt_flags);
-       pincount = xfs_buf_delwri_split(target, &tmp, 0);
+       pincount = xfs_buf_delwri_split(target, &tmp_list, 0);
 
        /*
-        * Dropped the delayed write list lock, now walk the temporary list
+        * Dropped the delayed write list lock, now walk the temporary list.
+        * All I/O is issued async and then if we need to wait for completion
+        * we do that after issuing all the IO.
         */
-       list_for_each_entry_safe(bp, n, &tmp, b_list) {
+       list_sort(NULL, &tmp_list, xfs_buf_cmp);
+       while (!list_empty(&tmp_list)) {
+               bp = list_first_entry(&tmp_list, struct xfs_buf, b_list);
                ASSERT(target == bp->b_target);
-               if (wait)
+               list_del_init(&bp->b_list);
+               if (wait) {
                        bp->b_flags &= ~XBF_ASYNC;
-               else
-                       list_del_init(&bp->b_list);
-
+                       list_add(&bp->b_list, &wait_list);
+               }
                xfs_buf_iostrategy(bp);
        }
 
-       if (wait)
+       if (wait) {
+               /* Expedite and wait for IO to complete. */
                blk_run_address_space(target->bt_mapping);
+               while (!list_empty(&wait_list)) {
+                       bp = list_first_entry(&wait_list, struct xfs_buf, b_list);
 
-       /*
-        * Remaining list items must be flushed before returning
-        */
-       while (!list_empty(&tmp)) {
-               bp = list_entry(tmp.next, xfs_buf_t, b_list);
-
-               list_del_init(&bp->b_list);
-               xfs_iowait(bp);
-               xfs_buf_relse(bp);
+                       list_del_init(&bp->b_list);
+                       xfs_iowait(bp);
+                       xfs_buf_relse(bp);
+               }
        }
 
        return pincount;
index a34c7b54822ddac53adff85f9c27ae045835e31c..386e7361e50eadcee276ceba70c5dc12c49ebe63 100644 (file)
@@ -232,13 +232,17 @@ extern void xfs_buf_lock(xfs_buf_t *);
 extern void xfs_buf_unlock(xfs_buf_t *);
 
 /* Buffer Read and Write Routines */
-extern int xfs_bawrite(void *mp, xfs_buf_t *bp);
+extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp);
 extern void xfs_bdwrite(void *mp, xfs_buf_t *bp);
+
+extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
+extern int xfs_bdstrat_cb(struct xfs_buf *);
+
 extern void xfs_buf_ioend(xfs_buf_t *, int);
 extern void xfs_buf_ioerror(xfs_buf_t *, int);
 extern int xfs_buf_iorequest(xfs_buf_t *);
 extern int xfs_buf_iowait(xfs_buf_t *);
-extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, xfs_caddr_t,
+extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *,
                                xfs_buf_rw_t);
 
 static inline int xfs_buf_iostrategy(xfs_buf_t *bp)
@@ -261,6 +265,7 @@ extern int xfs_buf_ispin(xfs_buf_t *);
 
 /* Delayed Write Buffer Routines */
 extern void xfs_buf_delwri_dequeue(xfs_buf_t *);
+extern void xfs_buf_delwri_promote(xfs_buf_t *);
 
 /* Buffer Daemon Setup Routines */
 extern int xfs_buf_init(void);
@@ -270,33 +275,19 @@ extern void xfs_buf_terminate(void);
        ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; })
 
 
-#define XFS_B_ASYNC            XBF_ASYNC
-#define XFS_B_DELWRI           XBF_DELWRI
-#define XFS_B_READ             XBF_READ
-#define XFS_B_WRITE            XBF_WRITE
-#define XFS_B_STALE            XBF_STALE
-
-#define XFS_BUF_TRYLOCK                XBF_TRYLOCK
-#define XFS_INCORE_TRYLOCK     XBF_TRYLOCK
-#define XFS_BUF_LOCK           XBF_LOCK
-#define XFS_BUF_MAPPED         XBF_MAPPED
-
-#define BUF_BUSY               XBF_DONT_BLOCK
-
 #define XFS_BUF_BFLAGS(bp)     ((bp)->b_flags)
 #define XFS_BUF_ZEROFLAGS(bp)  ((bp)->b_flags &= \
                ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI|XBF_ORDERED))
 
-#define XFS_BUF_STALE(bp)      ((bp)->b_flags |= XFS_B_STALE)
-#define XFS_BUF_UNSTALE(bp)    ((bp)->b_flags &= ~XFS_B_STALE)
-#define XFS_BUF_ISSTALE(bp)    ((bp)->b_flags & XFS_B_STALE)
+#define XFS_BUF_STALE(bp)      ((bp)->b_flags |= XBF_STALE)
+#define XFS_BUF_UNSTALE(bp)    ((bp)->b_flags &= ~XBF_STALE)
+#define XFS_BUF_ISSTALE(bp)    ((bp)->b_flags & XBF_STALE)
 #define XFS_BUF_SUPER_STALE(bp)        do {                            \
                                        XFS_BUF_STALE(bp);      \
                                        xfs_buf_delwri_dequeue(bp);     \
                                        XFS_BUF_DONE(bp);       \
                                } while (0)
 
-#define XFS_BUF_MANAGE         XBF_FS_MANAGED
 #define XFS_BUF_UNMANAGE(bp)   ((bp)->b_flags &= ~XBF_FS_MANAGED)
 
 #define XFS_BUF_DELAYWRITE(bp)         ((bp)->b_flags |= XBF_DELWRI)
@@ -385,31 +376,11 @@ static inline void xfs_buf_relse(xfs_buf_t *bp)
 
 #define xfs_biomove(bp, off, len, data, rw) \
            xfs_buf_iomove((bp), (off), (len), (data), \
-               ((rw) == XFS_B_WRITE) ? XBRW_WRITE : XBRW_READ)
+               ((rw) == XBF_WRITE) ? XBRW_WRITE : XBRW_READ)
 
 #define xfs_biozero(bp, off, len) \
            xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
 
-
-static inline int XFS_bwrite(xfs_buf_t *bp)
-{
-       int     iowait = (bp->b_flags & XBF_ASYNC) == 0;
-       int     error = 0;
-
-       if (!iowait)
-               bp->b_flags |= _XBF_RUN_QUEUES;
-
-       xfs_buf_delwri_dequeue(bp);
-       xfs_buf_iostrategy(bp);
-       if (iowait) {
-               error = xfs_buf_iowait(bp);
-               xfs_buf_relse(bp);
-       }
-       return error;
-}
-
-#define XFS_bdstrat(bp) xfs_buf_iorequest(bp)
-
 #define xfs_iowait(bp) xfs_buf_iowait(bp)
 
 #define xfs_baread(target, rablkno, ralen)  \
@@ -424,6 +395,7 @@ extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *);
 extern void xfs_wait_buftarg(xfs_buftarg_t *);
 extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
 extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
+
 #ifdef CONFIG_KDB_MODULES
 extern struct list_head *xfs_get_buftarg_list(void);
 #endif
index 7501b85fd8606bb94d8983f3175505bf580ec456..b6918d76bc7bbdf9740a07955c0e1694a6bf9825 100644 (file)
@@ -79,7 +79,7 @@ xfs_flush_pages(
                xfs_iflags_clear(ip, XFS_ITRUNCATED);
                ret = -filemap_fdatawrite(mapping);
        }
-       if (flags & XFS_B_ASYNC)
+       if (flags & XBF_ASYNC)
                return ret;
        ret2 = xfs_wait_on_pages(ip, first, last);
        if (!ret)
index a034cf62443702283af914a073239a1ee530a8da..4ea1ee18adede8a266504f970c1db3d8b26f5065 100644 (file)
@@ -447,12 +447,12 @@ xfs_attrlist_by_handle(
 int
 xfs_attrmulti_attr_get(
        struct inode            *inode,
-       char                    *name,
-       char                    __user *ubuf,
+       unsigned char           *name,
+       unsigned char           __user *ubuf,
        __uint32_t              *len,
        __uint32_t              flags)
 {
-       char                    *kbuf;
+       unsigned char           *kbuf;
        int                     error = EFAULT;
 
        if (*len > XATTR_SIZE_MAX)
@@ -476,12 +476,12 @@ xfs_attrmulti_attr_get(
 int
 xfs_attrmulti_attr_set(
        struct inode            *inode,
-       char                    *name,
-       const char              __user *ubuf,
+       unsigned char           *name,
+       const unsigned char     __user *ubuf,
        __uint32_t              len,
        __uint32_t              flags)
 {
-       char                    *kbuf;
+       unsigned char           *kbuf;
        int                     error = EFAULT;
 
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -501,7 +501,7 @@ xfs_attrmulti_attr_set(
 int
 xfs_attrmulti_attr_remove(
        struct inode            *inode,
-       char                    *name,
+       unsigned char           *name,
        __uint32_t              flags)
 {
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -519,7 +519,7 @@ xfs_attrmulti_by_handle(
        xfs_fsop_attrmulti_handlereq_t am_hreq;
        struct dentry           *dentry;
        unsigned int            i, size;
-       char                    *attr_name;
+       unsigned char           *attr_name;
 
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
@@ -547,7 +547,7 @@ xfs_attrmulti_by_handle(
 
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
-               ops[i].am_error = strncpy_from_user(attr_name,
+               ops[i].am_error = strncpy_from_user((char *)attr_name,
                                ops[i].am_attrname, MAXNAMELEN);
                if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
                        error = -ERANGE;
@@ -1431,6 +1431,9 @@ xfs_file_ioctl(
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
 
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
+                       return -XFS_ERROR(EROFS);
+
                if (copy_from_user(&inout, arg, sizeof(inout)))
                        return -XFS_ERROR(EFAULT);
 
index 7bd7c6afc1ebd0c44ac6836109f4559f54593d62..d56173b34a2a55662575f79a4ba5426662b647c9 100644 (file)
@@ -45,23 +45,23 @@ xfs_readlink_by_handle(
 extern int
 xfs_attrmulti_attr_get(
        struct inode            *inode,
-       char                    *name,
-       char                    __user *ubuf,
+       unsigned char           *name,
+       unsigned char           __user *ubuf,
        __uint32_t              *len,
        __uint32_t              flags);
 
 extern int
-       xfs_attrmulti_attr_set(
+xfs_attrmulti_attr_set(
        struct inode            *inode,
-       char                    *name,
-       const char              __user *ubuf,
+       unsigned char           *name,
+       const unsigned char     __user *ubuf,
        __uint32_t              len,
        __uint32_t              flags);
 
 extern int
 xfs_attrmulti_attr_remove(
        struct inode            *inode,
-       char                    *name,
+       unsigned char           *name,
        __uint32_t              flags);
 
 extern struct dentry *
index be1527b1670ccbb36e2dc1c963133efa75975405..0bf6d61f0528510249fe0de99b5ec3053744b83f 100644 (file)
@@ -411,7 +411,7 @@ xfs_compat_attrmulti_by_handle(
        compat_xfs_fsop_attrmulti_handlereq_t   am_hreq;
        struct dentry                           *dentry;
        unsigned int                            i, size;
-       char                                    *attr_name;
+       unsigned char                           *attr_name;
 
        if (!capable(CAP_SYS_ADMIN))
                return -XFS_ERROR(EPERM);
@@ -440,7 +440,7 @@ xfs_compat_attrmulti_by_handle(
 
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
-               ops[i].am_error = strncpy_from_user(attr_name,
+               ops[i].am_error = strncpy_from_user((char *)attr_name,
                                compat_ptr(ops[i].am_attrname),
                                MAXNAMELEN);
                if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
index 225946012d0b3d2015e72a81d62a751ac0a1df84..e8566bbf0f00ffeb2154bee1b351cdcf402c4985 100644 (file)
@@ -140,10 +140,10 @@ xfs_init_security(
        struct xfs_inode *ip = XFS_I(inode);
        size_t          length;
        void            *value;
-       char            *name;
+       unsigned char   *name;
        int             error;
 
-       error = security_inode_init_security(inode, dir, &name,
+       error = security_inode_init_security(inode, dir, (char **)&name,
                                             &value, &length);
        if (error) {
                if (error == -EOPNOTSUPP)
index 0d32457abef16cc557c691d5e037e2853a0367da..eac6f80d786d5fa63834460c2f85ec905c8a99d4 100644 (file)
@@ -630,18 +630,9 @@ start:
         * by root.  This keeps people from modifying setuid and
         * setgid binaries.
         */
-
-       if (((xip->i_d.di_mode & S_ISUID) ||
-           ((xip->i_d.di_mode & (S_ISGID | S_IXGRP)) ==
-               (S_ISGID | S_IXGRP))) &&
-            !capable(CAP_FSETID)) {
-               error = xfs_write_clear_setuid(xip);
-               if (likely(!error))
-                       error = -file_remove_suid(file);
-               if (unlikely(error)) {
-                       goto out_unlock_internal;
-               }
-       }
+       error = -file_remove_suid(file);
+       if (unlikely(error))
+               goto out_unlock_internal;
 
        /* We can write back this queue in page reclaim */
        current->backing_dev_info = mapping->backing_dev_info;
@@ -783,53 +774,6 @@ write_retry:
        return -error;
 }
 
-/*
- * All xfs metadata buffers except log state machine buffers
- * get this attached as their b_bdstrat callback function.
- * This is so that we can catch a buffer
- * after prematurely unpinning it to forcibly shutdown the filesystem.
- */
-int
-xfs_bdstrat_cb(struct xfs_buf *bp)
-{
-       if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
-               trace_xfs_bdstrat_shut(bp, _RET_IP_);
-               /*
-                * Metadata write that didn't get logged but
-                * written delayed anyway. These aren't associated
-                * with a transaction, and can be ignored.
-                */
-               if (XFS_BUF_IODONE_FUNC(bp) == NULL &&
-                   (XFS_BUF_ISREAD(bp)) == 0)
-                       return (xfs_bioerror_relse(bp));
-               else
-                       return (xfs_bioerror(bp));
-       }
-
-       xfs_buf_iorequest(bp);
-       return 0;
-}
-
-/*
- * Wrapper around bdstrat so that we can stop data from going to disk in case
- * we are shutting down the filesystem.  Typically user data goes thru this
- * path; one of the exceptions is the superblock.
- */
-void
-xfsbdstrat(
-       struct xfs_mount        *mp,
-       struct xfs_buf          *bp)
-{
-       ASSERT(mp);
-       if (!XFS_FORCED_SHUTDOWN(mp)) {
-               xfs_buf_iorequest(bp);
-               return;
-       }
-
-       trace_xfs_bdstrat_shut(bp, _RET_IP_);
-       xfs_bioerror_relse(bp);
-}
-
 /*
  * If the underlying (data/log/rt) device is readonly, there are some
  * operations that cannot proceed.
index d1f7789c7ffb74994932015a48c133fda97054e9..342ae8c0d011399e3b6f274aaf9e2df35efee9cf 100644 (file)
@@ -22,9 +22,6 @@ struct xfs_mount;
 struct xfs_inode;
 struct xfs_buf;
 
-/* errors from xfsbdstrat() must be extracted from the buffer */
-extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
-extern int xfs_bdstrat_cb(struct xfs_buf *);
 extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
 
 extern int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
index 09783cc444ac036cc3782d65f3dde39565e75e40..25ea2408118fb0fba760ef955922eed742116ee2 100644 (file)
@@ -877,12 +877,11 @@ xfsaild(
 {
        struct xfs_ail  *ailp = data;
        xfs_lsn_t       last_pushed_lsn = 0;
-       long            tout = 0;
+       long            tout = 0; /* milliseconds */
 
        while (!kthread_should_stop()) {
-               if (tout)
-                       schedule_timeout_interruptible(msecs_to_jiffies(tout));
-               tout = 1000;
+               schedule_timeout_interruptible(tout ?
+                               msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);
 
                /* swsusp */
                try_to_freeze();
@@ -954,16 +953,14 @@ xfs_fs_destroy_inode(
        ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIM));
 
        /*
-        * If we have nothing to flush with this inode then complete the
-        * teardown now, otherwise delay the flush operation.
+        * We always use background reclaim here because even if the
+        * inode is clean, it still may be under IO and hence we have
+        * to take the flush lock. The background reclaim path handles
+        * this more efficiently than we can here, so simply let background
+        * reclaim tear down all inodes.
         */
-       if (!xfs_inode_clean(ip)) {
-               xfs_inode_set_reclaim_tag(ip);
-               return;
-       }
-
 out_reclaim:
-       xfs_ireclaim(ip);
+       xfs_inode_set_reclaim_tag(ip);
 }
 
 /*
@@ -1024,12 +1021,45 @@ xfs_fs_dirty_inode(
        XFS_I(inode)->i_update_core = 1;
 }
 
-/*
- * Attempt to flush the inode, this will actually fail
- * if the inode is pinned, but we dirty the inode again
- * at the point when it is unpinned after a log write,
- * since this is when the inode itself becomes flushable.
- */
+STATIC int
+xfs_log_inode(
+       struct xfs_inode        *ip)
+{
+       struct xfs_mount        *mp = ip->i_mount;
+       struct xfs_trans        *tp;
+       int                     error;
+
+       xfs_iunlock(ip, XFS_ILOCK_SHARED);
+       tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
+       error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
+
+       if (error) {
+               xfs_trans_cancel(tp, 0);
+               /* we need to return with the lock hold shared */
+               xfs_ilock(ip, XFS_ILOCK_SHARED);
+               return error;
+       }
+
+       xfs_ilock(ip, XFS_ILOCK_EXCL);
+
+       /*
+        * Note - it's possible that we might have pushed ourselves out of the
+        * way during trans_reserve which would flush the inode.  But there's
+        * no guarantee that the inode buffer has actually gone out yet (it's
+        * delwri).  Plus the buffer could be pinned anyway if it's part of
+        * an inode in another recent transaction.  So we play it safe and
+        * fire off the transaction anyway.
+        */
+       xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
+       xfs_trans_ihold(tp, ip);
+       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+       xfs_trans_set_sync(tp);
+       error = xfs_trans_commit(tp, 0);
+       xfs_ilock_demote(ip, XFS_ILOCK_EXCL);
+
+       return error;
+}
+
 STATIC int
 xfs_fs_write_inode(
        struct inode            *inode,
@@ -1037,7 +1067,7 @@ xfs_fs_write_inode(
 {
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
-       int                     error = 0;
+       int                     error = EAGAIN;
 
        xfs_itrace_entry(ip);
 
@@ -1048,35 +1078,55 @@ xfs_fs_write_inode(
                error = xfs_wait_on_pages(ip, 0, -1);
                if (error)
                        goto out;
-       }
 
-       /*
-        * Bypass inodes which have already been cleaned by
-        * the inode flush clustering code inside xfs_iflush
-        */
-       if (xfs_inode_clean(ip))
-               goto out;
-
-       /*
-        * We make this non-blocking if the inode is contended, return
-        * EAGAIN to indicate to the caller that they did not succeed.
-        * This prevents the flush path from blocking on inodes inside
-        * another operation right now, they get caught later by xfs_sync.
-        */
-       if (sync) {
+               /*
+                * Make sure the inode has hit stable storage.  By using the
+                * log and the fsync transactions we reduce the IOs we have
+                * to do here from two (log and inode) to just the log.
+                *
+                * Note: We still need to do a delwri write of the inode after
+                * this to flush it to the backing buffer so that bulkstat
+                * works properly if this is the first time the inode has been
+                * written.  Because we hold the ilock atomically over the
+                * transaction commit and the inode flush we are guaranteed
+                * that the inode is not pinned when it returns. If the flush
+                * lock is already held, then the inode has already been
+                * flushed once and we don't need to flush it again.  Hence
+                * the code will only flush the inode if it isn't already
+                * being flushed.
+                */
                xfs_ilock(ip, XFS_ILOCK_SHARED);
-               xfs_iflock(ip);
-
-               error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
+               if (ip->i_update_core) {
+                       error = xfs_log_inode(ip);
+                       if (error)
+                               goto out_unlock;
+               }
        } else {
-               error = EAGAIN;
+               /*
+                * We make this non-blocking if the inode is contended, return
+                * EAGAIN to indicate to the caller that they did not succeed.
+                * This prevents the flush path from blocking on inodes inside
+                * another operation right now, they get caught later by xfs_sync.
+                */
                if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
                        goto out;
-               if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
-                       goto out_unlock;
+       }
+
+       if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
+               goto out_unlock;
 
-               error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK);
+       /*
+        * Now we have the flush lock and the inode is not pinned, we can check
+        * if the inode is really clean as we know that there are no pending
+        * transaction completions, it is not waiting on the delayed write
+        * queue and there is no IO in progress.
+        */
+       if (xfs_inode_clean(ip)) {
+               xfs_ifunlock(ip);
+               error = 0;
+               goto out_unlock;
        }
+       error = xfs_iflush(ip, 0);
 
  out_unlock:
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
@@ -1259,6 +1309,29 @@ xfs_fs_statfs(
        return 0;
 }
 
+STATIC void
+xfs_save_resvblks(struct xfs_mount *mp)
+{
+       __uint64_t resblks = 0;
+
+       mp->m_resblks_save = mp->m_resblks;
+       xfs_reserve_blocks(mp, &resblks, NULL);
+}
+
+STATIC void
+xfs_restore_resvblks(struct xfs_mount *mp)
+{
+       __uint64_t resblks;
+
+       if (mp->m_resblks_save) {
+               resblks = mp->m_resblks_save;
+               mp->m_resblks_save = 0;
+       } else
+               resblks = xfs_default_resblks(mp);
+
+       xfs_reserve_blocks(mp, &resblks, NULL);
+}
+
 STATIC int
 xfs_fs_remount(
        struct super_block      *sb,
@@ -1338,11 +1411,27 @@ xfs_fs_remount(
                        }
                        mp->m_update_flags = 0;
                }
+
+               /*
+                * Fill out the reserve pool if it is empty. Use the stashed
+                * value if it is non-zero, otherwise go with the default.
+                */
+               xfs_restore_resvblks(mp);
        }
 
        /* rw -> ro */
        if (!(mp->m_flags & XFS_MOUNT_RDONLY) && (*flags & MS_RDONLY)) {
+               /*
+                * After we have synced the data but before we sync the
+                * metadata, we need to free up the reserve block pool so that
+                * the used block count in the superblock on disk is correct at
+                * the end of the remount. Stash the current reserve pool size
+                * so that if we get remounted rw, we can return it to the same
+                * size.
+                */
+
                xfs_quiesce_data(mp);
+               xfs_save_resvblks(mp);
                xfs_quiesce_attr(mp);
                mp->m_flags |= XFS_MOUNT_RDONLY;
        }
@@ -1361,10 +1450,21 @@ xfs_fs_freeze(
 {
        struct xfs_mount        *mp = XFS_M(sb);
 
+       xfs_save_resvblks(mp);
        xfs_quiesce_attr(mp);
        return -xfs_fs_log_dummy(mp);
 }
 
+STATIC int
+xfs_fs_unfreeze(
+       struct super_block      *sb)
+{
+       struct xfs_mount        *mp = XFS_M(sb);
+
+       xfs_restore_resvblks(mp);
+       return 0;
+}
+
 STATIC int
 xfs_fs_show_options(
        struct seq_file         *m,
@@ -1587,6 +1687,7 @@ static const struct super_operations xfs_super_operations = {
        .put_super              = xfs_fs_put_super,
        .sync_fs                = xfs_fs_sync_fs,
        .freeze_fs              = xfs_fs_freeze,
+       .unfreeze_fs            = xfs_fs_unfreeze,
        .statfs                 = xfs_fs_statfs,
        .remount_fs             = xfs_fs_remount,
        .show_options           = xfs_fs_show_options,
index 6fed97a8cd3e29ef46791c24ebecf16b6ef5ba11..a9f6d20aff4152e23029b2e3fa96a8836aa117b0 100644 (file)
@@ -65,7 +65,6 @@ xfs_inode_ag_lookup(
         * as the tree is sparse and a gang lookup walks to find
         * the number of objects requested.
         */
-       read_lock(&pag->pag_ici_lock);
        if (tag == XFS_ICI_NO_TAG) {
                nr_found = radix_tree_gang_lookup(&pag->pag_ici_root,
                                (void **)&ip, *first_index, 1);
@@ -74,7 +73,7 @@ xfs_inode_ag_lookup(
                                (void **)&ip, *first_index, 1, tag);
        }
        if (!nr_found)
-               goto unlock;
+               return NULL;
 
        /*
         * Update the index for the next lookup. Catch overflows
@@ -84,25 +83,20 @@ xfs_inode_ag_lookup(
         */
        *first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1);
        if (*first_index < XFS_INO_TO_AGINO(mp, ip->i_ino))
-               goto unlock;
-
+               return NULL;
        return ip;
-
-unlock:
-       read_unlock(&pag->pag_ici_lock);
-       return NULL;
 }
 
 STATIC int
 xfs_inode_ag_walk(
        struct xfs_mount        *mp,
-       xfs_agnumber_t          ag,
+       struct xfs_perag        *pag,
        int                     (*execute)(struct xfs_inode *ip,
                                           struct xfs_perag *pag, int flags),
        int                     flags,
-       int                     tag)
+       int                     tag,
+       int                     exclusive)
 {
-       struct xfs_perag        *pag = &mp->m_perag[ag];
        uint32_t                first_index;
        int                     last_error = 0;
        int                     skipped;
@@ -114,10 +108,20 @@ restart:
                int             error = 0;
                xfs_inode_t     *ip;
 
+               if (exclusive)
+                       write_lock(&pag->pag_ici_lock);
+               else
+                       read_lock(&pag->pag_ici_lock);
                ip = xfs_inode_ag_lookup(mp, pag, &first_index, tag);
-               if (!ip)
+               if (!ip) {
+                       if (exclusive)
+                               write_unlock(&pag->pag_ici_lock);
+                       else
+                               read_unlock(&pag->pag_ici_lock);
                        break;
+               }
 
+               /* execute releases pag->pag_ici_lock */
                error = execute(ip, pag, flags);
                if (error == EAGAIN) {
                        skipped++;
@@ -125,9 +129,8 @@ restart:
                }
                if (error)
                        last_error = error;
-               /*
-                * bail out if the filesystem is corrupted.
-                */
+
+               /* bail out if the filesystem is corrupted.  */
                if (error == EFSCORRUPTED)
                        break;
 
@@ -137,8 +140,6 @@ restart:
                delay(1);
                goto restart;
        }
-
-       xfs_put_perag(mp, pag);
        return last_error;
 }
 
@@ -148,16 +149,24 @@ xfs_inode_ag_iterator(
        int                     (*execute)(struct xfs_inode *ip,
                                           struct xfs_perag *pag, int flags),
        int                     flags,
-       int                     tag)
+       int                     tag,
+       int                     exclusive)
 {
        int                     error = 0;
        int                     last_error = 0;
        xfs_agnumber_t          ag;
 
        for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
-               if (!mp->m_perag[ag].pag_ici_init)
+               struct xfs_perag        *pag;
+
+               pag = xfs_perag_get(mp, ag);
+               if (!pag->pag_ici_init) {
+                       xfs_perag_put(pag);
                        continue;
-               error = xfs_inode_ag_walk(mp, ag, execute, flags, tag);
+               }
+               error = xfs_inode_ag_walk(mp, pag, execute, flags, tag,
+                                               exclusive);
+               xfs_perag_put(pag);
                if (error) {
                        last_error = error;
                        if (error == EFSCORRUPTED)
@@ -174,30 +183,31 @@ xfs_sync_inode_valid(
        struct xfs_perag        *pag)
 {
        struct inode            *inode = VFS_I(ip);
+       int                     error = EFSCORRUPTED;
 
        /* nothing to sync during shutdown */
-       if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-               read_unlock(&pag->pag_ici_lock);
-               return EFSCORRUPTED;
-       }
+       if (XFS_FORCED_SHUTDOWN(ip->i_mount))
+               goto out_unlock;
 
-       /*
-        * If we can't get a reference on the inode, it must be in reclaim.
-        * Leave it for the reclaim code to flush. Also avoid inodes that
-        * haven't been fully initialised.
-        */
-       if (!igrab(inode)) {
-               read_unlock(&pag->pag_ici_lock);
-               return ENOENT;
-       }
-       read_unlock(&pag->pag_ici_lock);
+       /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
+       error = ENOENT;
+       if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
+               goto out_unlock;
+
+       /* If we can't grab the inode, it must on it's way to reclaim. */
+       if (!igrab(inode))
+               goto out_unlock;
 
-       if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) {
+       if (is_bad_inode(inode)) {
                IRELE(ip);
-               return ENOENT;
+               goto out_unlock;
        }
 
-       return 0;
+       /* inode is valid */
+       error = 0;
+out_unlock:
+       read_unlock(&pag->pag_ici_lock);
+       return error;
 }
 
 STATIC int
@@ -224,7 +234,7 @@ xfs_sync_inode_data(
        }
 
        error = xfs_flush_pages(ip, 0, -1, (flags & SYNC_WAIT) ?
-                               0 : XFS_B_ASYNC, FI_NONE);
+                               0 : XBF_ASYNC, FI_NONE);
        xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 
  out_wait:
@@ -260,8 +270,7 @@ xfs_sync_inode_attr(
                goto out_unlock;
        }
 
-       error = xfs_iflush(ip, (flags & SYNC_WAIT) ?
-                          XFS_IFLUSH_SYNC : XFS_IFLUSH_DELWRI);
+       error = xfs_iflush(ip, flags);
 
  out_unlock:
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
@@ -282,14 +291,11 @@ xfs_sync_data(
        ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT)) == 0);
 
        error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags,
-                                     XFS_ICI_NO_TAG);
+                                     XFS_ICI_NO_TAG, 0);
        if (error)
                return XFS_ERROR(error);
 
-       xfs_log_force(mp, 0,
-                     (flags & SYNC_WAIT) ?
-                      XFS_LOG_FORCE | XFS_LOG_SYNC :
-                      XFS_LOG_FORCE);
+       xfs_log_force(mp, (flags & SYNC_WAIT) ? XFS_LOG_SYNC : 0);
        return 0;
 }
 
@@ -304,7 +310,7 @@ xfs_sync_attr(
        ASSERT((flags & ~SYNC_WAIT) == 0);
 
        return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags,
-                                    XFS_ICI_NO_TAG);
+                                    XFS_ICI_NO_TAG, 0);
 }
 
 STATIC int
@@ -315,10 +321,6 @@ xfs_commit_dummy_trans(
        struct xfs_inode        *ip = mp->m_rootip;
        struct xfs_trans        *tp;
        int                     error;
-       int                     log_flags = XFS_LOG_FORCE;
-
-       if (flags & SYNC_WAIT)
-               log_flags |= XFS_LOG_SYNC;
 
        /*
         * Put a dummy transaction in the log to tell recovery
@@ -340,11 +342,11 @@ xfs_commit_dummy_trans(
        xfs_iunlock(ip, XFS_ILOCK_EXCL);
 
        /* the log force ensures this transaction is pushed to disk */
-       xfs_log_force(mp, 0, log_flags);
+       xfs_log_force(mp, (flags & SYNC_WAIT) ? XFS_LOG_SYNC : 0);
        return error;
 }
 
-int
+STATIC int
 xfs_sync_fsdata(
        struct xfs_mount        *mp,
        int                     flags)
@@ -360,7 +362,7 @@ xfs_sync_fsdata(
        if (flags & SYNC_TRYLOCK) {
                ASSERT(!(flags & SYNC_WAIT));
 
-               bp = xfs_getsb(mp, XFS_BUF_TRYLOCK);
+               bp = xfs_getsb(mp, XBF_TRYLOCK);
                if (!bp)
                        goto out;
 
@@ -380,7 +382,7 @@ xfs_sync_fsdata(
                 * become pinned in between there and here.
                 */
                if (XFS_BUF_ISPINNED(bp))
-                       xfs_log_force(mp, 0, XFS_LOG_FORCE);
+                       xfs_log_force(mp, 0);
        }
 
 
@@ -441,9 +443,6 @@ xfs_quiesce_data(
        xfs_sync_data(mp, SYNC_WAIT);
        xfs_qm_sync(mp, SYNC_WAIT);
 
-       /* drop inode references pinned by filestreams */
-       xfs_filestream_flush(mp);
-
        /* write superblock and hoover up shutdown errors */
        error = xfs_sync_fsdata(mp, SYNC_WAIT);
 
@@ -460,16 +459,18 @@ xfs_quiesce_fs(
 {
        int     count = 0, pincount;
 
+       xfs_reclaim_inodes(mp, 0);
        xfs_flush_buftarg(mp->m_ddev_targp, 0);
-       xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
 
        /*
         * This loop must run at least twice.  The first instance of the loop
         * will flush most meta data but that will generate more meta data
         * (typically directory updates).  Which then must be flushed and
-        * logged before we can write the unmount record.
+        * logged before we can write the unmount record. We also so sync
+        * reclaim of inodes to catch any that the above delwri flush skipped.
         */
        do {
+               xfs_reclaim_inodes(mp, SYNC_WAIT);
                xfs_sync_attr(mp, SYNC_WAIT);
                pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
                if (!pincount) {
@@ -568,7 +569,7 @@ xfs_flush_inodes(
        igrab(inode);
        xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inodes_work, &completion);
        wait_for_completion(&completion);
-       xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
+       xfs_log_force(ip->i_mount, XFS_LOG_SYNC);
 }
 
 /*
@@ -584,8 +585,8 @@ xfs_sync_worker(
        int             error;
 
        if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
-               xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
-               xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
+               xfs_log_force(mp, 0);
+               xfs_reclaim_inodes(mp, 0);
                /* dgc: errors ignored here */
                error = xfs_qm_sync(mp, SYNC_TRYLOCK);
                error = xfs_sync_fsdata(mp, SYNC_TRYLOCK);
@@ -664,60 +665,6 @@ xfs_syncd_stop(
        kthread_stop(mp->m_sync_task);
 }
 
-STATIC int
-xfs_reclaim_inode(
-       xfs_inode_t     *ip,
-       int             sync_mode)
-{
-       xfs_perag_t     *pag = xfs_get_perag(ip->i_mount, ip->i_ino);
-
-       /* The hash lock here protects a thread in xfs_iget_core from
-        * racing with us on linking the inode back with a vnode.
-        * Once we have the XFS_IRECLAIM flag set it will not touch
-        * us.
-        */
-       write_lock(&pag->pag_ici_lock);
-       spin_lock(&ip->i_flags_lock);
-       if (__xfs_iflags_test(ip, XFS_IRECLAIM) ||
-           !__xfs_iflags_test(ip, XFS_IRECLAIMABLE)) {
-               spin_unlock(&ip->i_flags_lock);
-               write_unlock(&pag->pag_ici_lock);
-               return -EAGAIN;
-       }
-       __xfs_iflags_set(ip, XFS_IRECLAIM);
-       spin_unlock(&ip->i_flags_lock);
-       write_unlock(&pag->pag_ici_lock);
-       xfs_put_perag(ip->i_mount, pag);
-
-       /*
-        * If the inode is still dirty, then flush it out.  If the inode
-        * is not in the AIL, then it will be OK to flush it delwri as
-        * long as xfs_iflush() does not keep any references to the inode.
-        * We leave that decision up to xfs_iflush() since it has the
-        * knowledge of whether it's OK to simply do a delwri flush of
-        * the inode or whether we need to wait until the inode is
-        * pulled from the AIL.
-        * We get the flush lock regardless, though, just to make sure
-        * we don't free it while it is being flushed.
-        */
-       xfs_ilock(ip, XFS_ILOCK_EXCL);
-       xfs_iflock(ip);
-
-       /*
-        * In the case of a forced shutdown we rely on xfs_iflush() to
-        * wait for the inode to be unpinned before returning an error.
-        */
-       if (!is_bad_inode(VFS_I(ip)) && xfs_iflush(ip, sync_mode) == 0) {
-               /* synchronize with xfs_iflush_done */
-               xfs_iflock(ip);
-               xfs_ifunlock(ip);
-       }
-
-       xfs_iunlock(ip, XFS_ILOCK_EXCL);
-       xfs_ireclaim(ip);
-       return 0;
-}
-
 void
 __xfs_inode_set_reclaim_tag(
        struct xfs_perag        *pag,
@@ -737,16 +684,17 @@ void
 xfs_inode_set_reclaim_tag(
        xfs_inode_t     *ip)
 {
-       xfs_mount_t     *mp = ip->i_mount;
-       xfs_perag_t     *pag = xfs_get_perag(mp, ip->i_ino);
+       struct xfs_mount *mp = ip->i_mount;
+       struct xfs_perag *pag;
 
+       pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
        read_lock(&pag->pag_ici_lock);
        spin_lock(&ip->i_flags_lock);
        __xfs_inode_set_reclaim_tag(pag, ip);
        __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
        spin_unlock(&ip->i_flags_lock);
        read_unlock(&pag->pag_ici_lock);
-       xfs_put_perag(mp, pag);
+       xfs_perag_put(pag);
 }
 
 void
@@ -759,20 +707,145 @@ __xfs_inode_clear_reclaim_tag(
                        XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
 }
 
+/*
+ * Inodes in different states need to be treated differently, and the return
+ * value of xfs_iflush is not sufficient to get this right. The following table
+ * lists the inode states and the reclaim actions necessary for non-blocking
+ * reclaim:
+ *
+ *
+ *     inode state          iflush ret         required action
+ *      ---------------      ----------         ---------------
+ *     bad                     -               reclaim
+ *     shutdown                EIO             unpin and reclaim
+ *     clean, unpinned         0               reclaim
+ *     stale, unpinned         0               reclaim
+ *     clean, pinned(*)        0               requeue
+ *     stale, pinned           EAGAIN          requeue
+ *     dirty, delwri ok        0               requeue
+ *     dirty, delwri blocked   EAGAIN          requeue
+ *     dirty, sync flush       0               reclaim
+ *
+ * (*) dgc: I don't think the clean, pinned state is possible but it gets
+ * handled anyway given the order of checks implemented.
+ *
+ * As can be seen from the table, the return value of xfs_iflush() is not
+ * sufficient to correctly decide the reclaim action here. The checks in
+ * xfs_iflush() might look like duplicates, but they are not.
+ *
+ * Also, because we get the flush lock first, we know that any inode that has
+ * been flushed delwri has had the flush completed by the time we check that
+ * the inode is clean. The clean inode check needs to be done before flushing
+ * the inode delwri otherwise we would loop forever requeuing clean inodes as
+ * we cannot tell apart a successful delwri flush and a clean inode from the
+ * return value of xfs_iflush().
+ *
+ * Note that because the inode is flushed delayed write by background
+ * writeback, the flush lock may already be held here and waiting on it can
+ * result in very long latencies. Hence for sync reclaims, where we wait on the
+ * flush lock, the caller should push out delayed write inodes first before
+ * trying to reclaim them to minimise the amount of time spent waiting. For
+ * background relaim, we just requeue the inode for the next pass.
+ *
+ * Hence the order of actions after gaining the locks should be:
+ *     bad             => reclaim
+ *     shutdown        => unpin and reclaim
+ *     pinned, delwri  => requeue
+ *     pinned, sync    => unpin
+ *     stale           => reclaim
+ *     clean           => reclaim
+ *     dirty, delwri   => flush and requeue
+ *     dirty, sync     => flush, wait and reclaim
+ */
 STATIC int
-xfs_reclaim_inode_now(
+xfs_reclaim_inode(
        struct xfs_inode        *ip,
        struct xfs_perag        *pag,
-       int                     flags)
+       int                     sync_mode)
 {
-       /* ignore if already under reclaim */
-       if (xfs_iflags_test(ip, XFS_IRECLAIM)) {
-               read_unlock(&pag->pag_ici_lock);
+       int     error = 0;
+
+       /*
+        * The radix tree lock here protects a thread in xfs_iget from racing
+        * with us starting reclaim on the inode.  Once we have the
+        * XFS_IRECLAIM flag set it will not touch us.
+        */
+       spin_lock(&ip->i_flags_lock);
+       ASSERT_ALWAYS(__xfs_iflags_test(ip, XFS_IRECLAIMABLE));
+       if (__xfs_iflags_test(ip, XFS_IRECLAIM)) {
+               /* ignore as it is already under reclaim */
+               spin_unlock(&ip->i_flags_lock);
+               write_unlock(&pag->pag_ici_lock);
                return 0;
        }
-       read_unlock(&pag->pag_ici_lock);
+       __xfs_iflags_set(ip, XFS_IRECLAIM);
+       spin_unlock(&ip->i_flags_lock);
+       write_unlock(&pag->pag_ici_lock);
+
+       xfs_ilock(ip, XFS_ILOCK_EXCL);
+       if (!xfs_iflock_nowait(ip)) {
+               if (!(sync_mode & SYNC_WAIT))
+                       goto out;
+               xfs_iflock(ip);
+       }
+
+       if (is_bad_inode(VFS_I(ip)))
+               goto reclaim;
+       if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
+               xfs_iunpin_wait(ip);
+               goto reclaim;
+       }
+       if (xfs_ipincount(ip)) {
+               if (!(sync_mode & SYNC_WAIT)) {
+                       xfs_ifunlock(ip);
+                       goto out;
+               }
+               xfs_iunpin_wait(ip);
+       }
+       if (xfs_iflags_test(ip, XFS_ISTALE))
+               goto reclaim;
+       if (xfs_inode_clean(ip))
+               goto reclaim;
+
+       /* Now we have an inode that needs flushing */
+       error = xfs_iflush(ip, sync_mode);
+       if (sync_mode & SYNC_WAIT) {
+               xfs_iflock(ip);
+               goto reclaim;
+       }
+
+       /*
+        * When we have to flush an inode but don't have SYNC_WAIT set, we
+        * flush the inode out using a delwri buffer and wait for the next
+        * call into reclaim to find it in a clean state instead of waiting for
+        * it now. We also don't return errors here - if the error is transient
+        * then the next reclaim pass will flush the inode, and if the error
+        * is permanent then the next sync reclaim will relcaim the inode and
+        * pass on the error.
+        */
+       if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {
+               xfs_fs_cmn_err(CE_WARN, ip->i_mount,
+                       "inode 0x%llx background reclaim flush failed with %d",
+                       (long long)ip->i_ino, error);
+       }
+out:
+       xfs_iflags_clear(ip, XFS_IRECLAIM);
+       xfs_iunlock(ip, XFS_ILOCK_EXCL);
+       /*
+        * We could return EAGAIN here to make reclaim rescan the inode tree in
+        * a short while. However, this just burns CPU time scanning the tree
+        * waiting for IO to complete and xfssyncd never goes back to the idle
+        * state. Instead, return 0 to let the next scheduled background reclaim
+        * attempt to reclaim the inode again.
+        */
+       return 0;
+
+reclaim:
+       xfs_ifunlock(ip);
+       xfs_iunlock(ip, XFS_ILOCK_EXCL);
+       xfs_ireclaim(ip);
+       return error;
 
-       return xfs_reclaim_inode(ip, flags);
 }
 
 int
@@ -780,6 +853,6 @@ xfs_reclaim_inodes(
        xfs_mount_t     *mp,
        int             mode)
 {
-       return xfs_inode_ag_iterator(mp, xfs_reclaim_inode_now, mode,
-                                       XFS_ICI_RECLAIM_TAG);
+       return xfs_inode_ag_iterator(mp, xfs_reclaim_inode, mode,
+                                       XFS_ICI_RECLAIM_TAG, 1);
 }
index a500b4d91835b39c587ef414a948c8ce96d6d562..d480c346cabbb124a0d48ab4e017ef6fefae062e 100644 (file)
@@ -37,7 +37,6 @@ void xfs_syncd_stop(struct xfs_mount *mp);
 
 int xfs_sync_attr(struct xfs_mount *mp, int flags);
 int xfs_sync_data(struct xfs_mount *mp, int flags);
-int xfs_sync_fsdata(struct xfs_mount *mp, int flags);
 
 int xfs_quiesce_data(struct xfs_mount *mp);
 void xfs_quiesce_attr(struct xfs_mount *mp);
@@ -54,6 +53,6 @@ void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag,
 int xfs_sync_inode_valid(struct xfs_inode *ip, struct xfs_perag *pag);
 int xfs_inode_ag_iterator(struct xfs_mount *mp,
        int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags),
-       int flags, int tag);
+       int flags, int tag, int write_lock);
 
 #endif
index c22a608321a34e19466e6f5453bf860a518610e2..a4574dcf5065f9ac9f0b7a98059c37fb5d4b3ab9 100644 (file)
@@ -78,6 +78,33 @@ DECLARE_EVENT_CLASS(xfs_attr_list_class,
        )
 )
 
+#define DEFINE_PERAG_REF_EVENT(name) \
+TRACE_EVENT(name, \
+       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
+                unsigned long caller_ip), \
+       TP_ARGS(mp, agno, refcount, caller_ip), \
+       TP_STRUCT__entry( \
+               __field(dev_t, dev) \
+               __field(xfs_agnumber_t, agno) \
+               __field(int, refcount) \
+               __field(unsigned long, caller_ip) \
+       ), \
+       TP_fast_assign( \
+               __entry->dev = mp->m_super->s_dev; \
+               __entry->agno = agno; \
+               __entry->refcount = refcount; \
+               __entry->caller_ip = caller_ip; \
+       ), \
+       TP_printk("dev %d:%d agno %u refcount %d caller %pf", \
+                 MAJOR(__entry->dev), MINOR(__entry->dev), \
+                 __entry->agno, \
+                 __entry->refcount, \
+                 (char *)__entry->caller_ip) \
+);
+
+DEFINE_PERAG_REF_EVENT(xfs_perag_get)
+DEFINE_PERAG_REF_EVENT(xfs_perag_put)
+
 #define DEFINE_ATTR_LIST_EVENT(name) \
 DEFINE_EVENT(xfs_attr_list_class, name, \
        TP_PROTO(struct xfs_attr_list_context *ctx), \
@@ -456,6 +483,7 @@ DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
+DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pushbuf);
 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
@@ -1414,6 +1442,59 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
                  __entry->count)
 );
 
+#define XFS_SWAPEXT_INODES \
+       { 0,    "target" }, \
+       { 1,    "temp" }
+
+#define XFS_INODE_FORMAT_STR \
+       { 0,    "invalid" }, \
+       { 1,    "local" }, \
+       { 2,    "extent" }, \
+       { 3,    "btree" }
+
+DECLARE_EVENT_CLASS(xfs_swap_extent_class,
+       TP_PROTO(struct xfs_inode *ip, int which),
+       TP_ARGS(ip, which),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(int, which)
+               __field(xfs_ino_t, ino)
+               __field(int, format)
+               __field(int, nex)
+               __field(int, max_nex)
+               __field(int, broot_size)
+               __field(int, fork_off)
+       ),
+       TP_fast_assign(
+               __entry->dev = VFS_I(ip)->i_sb->s_dev;
+               __entry->which = which;
+               __entry->ino = ip->i_ino;
+               __entry->format = ip->i_d.di_format;
+               __entry->nex = ip->i_d.di_nextents;
+               __entry->max_nex = ip->i_df.if_ext_max;
+               __entry->broot_size = ip->i_df.if_broot_bytes;
+               __entry->fork_off = XFS_IFORK_BOFF(ip);
+       ),
+       TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
+                 "Max in-fork extents %d, broot size %d, fork offset %d",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->ino,
+                 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
+                 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
+                 __entry->nex,
+                 __entry->max_nex,
+                 __entry->broot_size,
+                 __entry->fork_off)
+)
+
+#define DEFINE_SWAPEXT_EVENT(name) \
+DEFINE_EVENT(xfs_swap_extent_class, name, \
+       TP_PROTO(struct xfs_inode *ip, int which), \
+       TP_ARGS(ip, which))
+
+DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
+DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
+
 #endif /* _TRACE_XFS_H */
 
 #undef TRACE_INCLUDE_PATH
index 0b1878857fc3cb56ca31e7dbe27a901a2243dfce..fa01b9daba6b0b66ad12450d185840da66374b69 100644 (file)
@@ -45,7 +45,7 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
                value = NULL;
        }
 
-       error = -xfs_attr_get(ip, name, value, &asize, xflags);
+       error = -xfs_attr_get(ip, (unsigned char *)name, value, &asize, xflags);
        if (error)
                return error;
        return asize;
@@ -67,8 +67,9 @@ xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
                xflags |= ATTR_REPLACE;
 
        if (!value)
-               return -xfs_attr_remove(ip, name, xflags);
-       return -xfs_attr_set(ip, name, (void *)value, size, xflags);
+               return -xfs_attr_remove(ip, (unsigned char *)name, xflags);
+       return -xfs_attr_set(ip, (unsigned char *)name,
+                               (void *)value, size, xflags);
 }
 
 static struct xattr_handler xfs_xattr_user_handler = {
@@ -124,8 +125,13 @@ static const char *xfs_xattr_prefix(int flags)
 }
 
 static int
-xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
-               char *name, int namelen, int valuelen, char *value)
+xfs_xattr_put_listent(
+       struct xfs_attr_list_context *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        unsigned int prefix_len = xfs_xattr_prefix_len(flags);
        char *offset;
@@ -148,7 +154,7 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
        offset = (char *)context->alist + context->count;
        strncpy(offset, xfs_xattr_prefix(flags), prefix_len);
        offset += prefix_len;
-       strncpy(offset, name, namelen);                 /* real name */
+       strncpy(offset, (char *)name, namelen);                 /* real name */
        offset += namelen;
        *offset = '\0';
        context->count += prefix_len + namelen + 1;
@@ -156,8 +162,13 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
 }
 
 static int
-xfs_xattr_put_listent_sizes(struct xfs_attr_list_context *context, int flags,
-               char *name, int namelen, int valuelen, char *value)
+xfs_xattr_put_listent_sizes(
+       struct xfs_attr_list_context *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        context->count += xfs_xattr_prefix_len(flags) + namelen + 1;
        return 0;
index d7c7eea09fc2083cc10d7249f5ed6d219e66db18..5f79dd78626b486b0b98fd033d81e1d425fc14dd 100644 (file)
@@ -1187,7 +1187,7 @@ xfs_qm_dqflush(
         * block, nada.
         */
        if (!XFS_DQ_IS_DIRTY(dqp) ||
-           (!(flags & XFS_QMOPT_SYNC) && atomic_read(&dqp->q_pincount) > 0)) {
+           (!(flags & SYNC_WAIT) && atomic_read(&dqp->q_pincount) > 0)) {
                xfs_dqfunlock(dqp);
                return 0;
        }
@@ -1248,23 +1248,20 @@ xfs_qm_dqflush(
         */
        if (XFS_BUF_ISPINNED(bp)) {
                trace_xfs_dqflush_force(dqp);
-               xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
+               xfs_log_force(mp, 0);
        }
 
-       if (flags & XFS_QMOPT_DELWRI) {
-               xfs_bdwrite(mp, bp);
-       } else if (flags & XFS_QMOPT_ASYNC) {
-               error = xfs_bawrite(mp, bp);
-       } else {
+       if (flags & SYNC_WAIT)
                error = xfs_bwrite(mp, bp);
-       }
+       else
+               xfs_bdwrite(mp, bp);
 
        trace_xfs_dqflush_done(dqp);
 
        /*
         * dqp is still locked, but caller is free to unlock it now.
         */
-       return (error);
+       return error;
 
 }
 
@@ -1445,7 +1442,7 @@ xfs_qm_dqpurge(
                 * We don't care about getting disk errors here. We need
                 * to purge this dquot anyway, so we go ahead regardless.
                 */
-               error = xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC);
+               error = xfs_qm_dqflush(dqp, SYNC_WAIT);
                if (error)
                        xfs_fs_cmn_err(CE_WARN, mp,
                                "xfs_qm_dqpurge: dquot %p flush failed", dqp);
@@ -1529,25 +1526,17 @@ xfs_qm_dqflock_pushbuf_wait(
         * the flush lock when the I/O completes.
         */
        bp = xfs_incore(dqp->q_mount->m_ddev_targp, dqp->q_blkno,
-                   XFS_QI_DQCHUNKLEN(dqp->q_mount),
-                   XFS_INCORE_TRYLOCK);
-       if (bp != NULL) {
-               if (XFS_BUF_ISDELAYWRITE(bp)) {
-                       int     error;
-                       if (XFS_BUF_ISPINNED(bp)) {
-                               xfs_log_force(dqp->q_mount,
-                                             (xfs_lsn_t)0,
-                                             XFS_LOG_FORCE);
-                       }
-                       error = xfs_bawrite(dqp->q_mount, bp);
-                       if (error)
-                               xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
-                                       "xfs_qm_dqflock_pushbuf_wait: "
-                                       "pushbuf error %d on dqp %p, bp %p",
-                                       error, dqp, bp);
-               } else {
-                       xfs_buf_relse(bp);
-               }
+                   XFS_QI_DQCHUNKLEN(dqp->q_mount), XBF_TRYLOCK);
+       if (!bp)
+               goto out_lock;
+
+       if (XFS_BUF_ISDELAYWRITE(bp)) {
+               if (XFS_BUF_ISPINNED(bp))
+                       xfs_log_force(dqp->q_mount, 0);
+               xfs_buf_delwri_promote(bp);
+               wake_up_process(bp->b_target->bt_task);
        }
+       xfs_buf_relse(bp);
+out_lock:
        xfs_dqflock(dqp);
 }
index d0d4a9a0bbd792d23058c6afb10c9a4472f14f32..4e4ee9a571944a8e129f980335080ad1cba32276 100644 (file)
@@ -74,11 +74,11 @@ xfs_qm_dquot_logitem_format(
 
        logvec->i_addr = (xfs_caddr_t)&logitem->qli_format;
        logvec->i_len  = sizeof(xfs_dq_logformat_t);
-       XLOG_VEC_SET_TYPE(logvec, XLOG_REG_TYPE_QFORMAT);
+       logvec->i_type = XLOG_REG_TYPE_QFORMAT;
        logvec++;
        logvec->i_addr = (xfs_caddr_t)&logitem->qli_dquot->q_core;
        logvec->i_len  = sizeof(xfs_disk_dquot_t);
-       XLOG_VEC_SET_TYPE(logvec, XLOG_REG_TYPE_DQUOT);
+       logvec->i_type = XLOG_REG_TYPE_DQUOT;
 
        ASSERT(2 == logitem->qli_item.li_desc->lid_size);
        logitem->qli_format.qlf_size = 2;
@@ -153,7 +153,7 @@ xfs_qm_dquot_logitem_push(
         * lock without sleeping, then there must not have been
         * anyone in the process of flushing the dquot.
         */
-       error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
+       error = xfs_qm_dqflush(dqp, 0);
        if (error)
                xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
                        "xfs_qm_dquot_logitem_push: push error %d on dqp %p",
@@ -190,7 +190,7 @@ xfs_qm_dqunpin_wait(
        /*
         * Give the log a push so we don't wait here too long.
         */
-       xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE);
+       xfs_log_force(dqp->q_mount, 0);
        wait_event(dqp->q_pinwait, (atomic_read(&dqp->q_pincount) == 0));
 }
 
@@ -212,18 +212,10 @@ xfs_qm_dquot_logitem_pushbuf(
        xfs_dquot_t     *dqp;
        xfs_mount_t     *mp;
        xfs_buf_t       *bp;
-       uint            dopush;
 
        dqp = qip->qli_dquot;
        ASSERT(XFS_DQ_IS_LOCKED(dqp));
 
-       /*
-        * The qli_pushbuf_flag keeps others from
-        * trying to duplicate our effort.
-        */
-       ASSERT(qip->qli_pushbuf_flag != 0);
-       ASSERT(qip->qli_push_owner == current_pid());
-
        /*
         * If flushlock isn't locked anymore, chances are that the
         * inode flush completed and the inode was taken off the AIL.
@@ -231,49 +223,20 @@ xfs_qm_dquot_logitem_pushbuf(
         */
        if (completion_done(&dqp->q_flush)  ||
            ((qip->qli_item.li_flags & XFS_LI_IN_AIL) == 0)) {
-               qip->qli_pushbuf_flag = 0;
                xfs_dqunlock(dqp);
                return;
        }
        mp = dqp->q_mount;
        bp = xfs_incore(mp->m_ddev_targp, qip->qli_format.qlf_blkno,
-                   XFS_QI_DQCHUNKLEN(mp),
-                   XFS_INCORE_TRYLOCK);
-       if (bp != NULL) {
-               if (XFS_BUF_ISDELAYWRITE(bp)) {
-                       dopush = ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
-                                 !completion_done(&dqp->q_flush));
-                       qip->qli_pushbuf_flag = 0;
-                       xfs_dqunlock(dqp);
-
-                       if (XFS_BUF_ISPINNED(bp)) {
-                               xfs_log_force(mp, (xfs_lsn_t)0,
-                                             XFS_LOG_FORCE);
-                       }
-                       if (dopush) {
-                               int     error;
-#ifdef XFSRACEDEBUG
-                               delay_for_intr();
-                               delay(300);
-#endif
-                               error = xfs_bawrite(mp, bp);
-                               if (error)
-                                       xfs_fs_cmn_err(CE_WARN, mp,
-       "xfs_qm_dquot_logitem_pushbuf: pushbuf error %d on qip %p, bp %p",
-                                                       error, qip, bp);
-                       } else {
-                               xfs_buf_relse(bp);
-                       }
-               } else {
-                       qip->qli_pushbuf_flag = 0;
-                       xfs_dqunlock(dqp);
-                       xfs_buf_relse(bp);
-               }
+                   XFS_QI_DQCHUNKLEN(mp), XBF_TRYLOCK);
+       xfs_dqunlock(dqp);
+       if (!bp)
                return;
-       }
+       if (XFS_BUF_ISDELAYWRITE(bp))
+               xfs_buf_delwri_promote(bp);
+       xfs_buf_relse(bp);
+       return;
 
-       qip->qli_pushbuf_flag = 0;
-       xfs_dqunlock(dqp);
 }
 
 /*
@@ -291,50 +254,24 @@ xfs_qm_dquot_logitem_trylock(
        xfs_dq_logitem_t        *qip)
 {
        xfs_dquot_t             *dqp;
-       uint                    retval;
 
        dqp = qip->qli_dquot;
        if (atomic_read(&dqp->q_pincount) > 0)
-               return (XFS_ITEM_PINNED);
+               return XFS_ITEM_PINNED;
 
        if (! xfs_qm_dqlock_nowait(dqp))
-               return (XFS_ITEM_LOCKED);
+               return XFS_ITEM_LOCKED;
 
-       retval = XFS_ITEM_SUCCESS;
        if (!xfs_dqflock_nowait(dqp)) {
                /*
-                * The dquot is already being flushed.  It may have been
-                * flushed delayed write, however, and we don't want to
-                * get stuck waiting for that to complete.  So, we want to check
-                * to see if we can lock the dquot's buffer without sleeping.
-                * If we can and it is marked for delayed write, then we
-                * hold it and send it out from the push routine.  We don't
-                * want to do that now since we might sleep in the device
-                * strategy routine.  We also don't want to grab the buffer lock
-                * here because we'd like not to call into the buffer cache
-                * while holding the AIL lock.
-                * Make sure to only return PUSHBUF if we set pushbuf_flag
-                * ourselves.  If someone else is doing it then we don't
-                * want to go to the push routine and duplicate their efforts.
+                * dquot has already been flushed to the backing buffer,
+                * leave it locked, pushbuf routine will unlock it.
                 */
-               if (qip->qli_pushbuf_flag == 0) {
-                       qip->qli_pushbuf_flag = 1;
-                       ASSERT(qip->qli_format.qlf_blkno == dqp->q_blkno);
-#ifdef DEBUG
-                       qip->qli_push_owner = current_pid();
-#endif
-                       /*
-                        * The dquot is left locked.
-                        */
-                       retval = XFS_ITEM_PUSHBUF;
-               } else {
-                       retval = XFS_ITEM_FLUSHING;
-                       xfs_dqunlock_nonotify(dqp);
-               }
+               return XFS_ITEM_PUSHBUF;
        }
 
        ASSERT(qip->qli_item.li_flags & XFS_LI_IN_AIL);
-       return (retval);
+       return XFS_ITEM_SUCCESS;
 }
 
 
@@ -467,7 +404,7 @@ xfs_qm_qoff_logitem_format(xfs_qoff_logitem_t       *qf,
 
        log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format);
        log_vector->i_len = sizeof(xfs_qoff_logitem_t);
-       XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_QUOTAOFF);
+       log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF;
        qf->qql_format.qf_size = 1;
 }
 
index 5a632531f843d23ab436aaae20c9df3197f9facf..5acae2ada70b0343e9f7d58f11b85d74259e62fb 100644 (file)
@@ -27,10 +27,6 @@ typedef struct xfs_dq_logitem {
        xfs_log_item_t           qli_item;         /* common portion */
        struct xfs_dquot        *qli_dquot;        /* dquot ptr */
        xfs_lsn_t                qli_flush_lsn;    /* lsn at last flush */
-       unsigned short           qli_pushbuf_flag; /* 1 bit used in push_ail */
-#ifdef DEBUG
-       uint64_t                 qli_push_owner;
-#endif
        xfs_dq_logformat_t       qli_format;       /* logged structure */
 } xfs_dq_logitem_t;
 
index 9e627a8b5b0e08284b03c3643e4c3219c252fba7..417e61e3d9dda0f18434498e51252fd08eca0473 100644 (file)
@@ -118,9 +118,14 @@ xfs_Gqm_init(void)
         */
        udqhash = kmem_zalloc_greedy(&hsize,
                                     XFS_QM_HASHSIZE_LOW * sizeof(xfs_dqhash_t),
-                                    XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t),
-                                    KM_SLEEP | KM_MAYFAIL | KM_LARGE);
-       gdqhash = kmem_zalloc(hsize, KM_SLEEP | KM_LARGE);
+                                    XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t));
+       if (!udqhash)
+               goto out;
+
+       gdqhash = kmem_zalloc_large(hsize);
+       if (!gdqhash)
+               goto out_free_udqhash;
+
        hsize /= sizeof(xfs_dqhash_t);
        ndquot = hsize << 8;
 
@@ -170,6 +175,11 @@ xfs_Gqm_init(void)
        mutex_init(&qcheck_lock);
 #endif
        return xqm;
+
+ out_free_udqhash:
+       kmem_free_large(udqhash);
+ out:
+       return NULL;
 }
 
 /*
@@ -189,8 +199,8 @@ xfs_qm_destroy(
                xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
                xfs_qm_list_destroy(&(xqm->qm_grp_dqhtable[i]));
        }
-       kmem_free(xqm->qm_usr_dqhtable);
-       kmem_free(xqm->qm_grp_dqhtable);
+       kmem_free_large(xqm->qm_usr_dqhtable);
+       kmem_free_large(xqm->qm_grp_dqhtable);
        xqm->qm_usr_dqhtable = NULL;
        xqm->qm_grp_dqhtable = NULL;
        xqm->qm_dqhashmask = 0;
@@ -219,8 +229,12 @@ xfs_qm_hold_quotafs_ref(
         */
        mutex_lock(&xfs_Gqm_lock);
 
-       if (xfs_Gqm == NULL)
+       if (!xfs_Gqm) {
                xfs_Gqm = xfs_Gqm_init();
+               if (!xfs_Gqm)
+                       return ENOMEM;
+       }
+
        /*
         * We can keep a list of all filesystems with quotas mounted for
         * debugging and statistical purposes, but ...
@@ -436,7 +450,7 @@ xfs_qm_unmount_quotas(
 STATIC int
 xfs_qm_dqflush_all(
        xfs_mount_t     *mp,
-       int             flags)
+       int             sync_mode)
 {
        int             recl;
        xfs_dquot_t     *dqp;
@@ -472,7 +486,7 @@ again:
                 * across a disk write.
                 */
                xfs_qm_mplist_unlock(mp);
-               error = xfs_qm_dqflush(dqp, flags);
+               error = xfs_qm_dqflush(dqp, sync_mode);
                xfs_dqunlock(dqp);
                if (error)
                        return error;
@@ -912,13 +926,11 @@ xfs_qm_sync(
 {
        int             recl, restarts;
        xfs_dquot_t     *dqp;
-       uint            flush_flags;
        int             error;
 
        if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
                return 0;
 
-       flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI;
        restarts = 0;
 
   again:
@@ -978,7 +990,7 @@ xfs_qm_sync(
                 * across a disk write
                 */
                xfs_qm_mplist_unlock(mp);
-               error = xfs_qm_dqflush(dqp, flush_flags);
+               error = xfs_qm_dqflush(dqp, flags);
                xfs_dqunlock(dqp);
                if (error && XFS_FORCED_SHUTDOWN(mp))
                        return 0;       /* Need to prevent umount failure */
@@ -1782,7 +1794,7 @@ xfs_qm_quotacheck(
         * successfully.
         */
        if (!error)
-               error = xfs_qm_dqflush_all(mp, XFS_QMOPT_DELWRI);
+               error = xfs_qm_dqflush_all(mp, 0);
 
        /*
         * We can get this error if we couldn't do a dquot allocation inside
@@ -2004,7 +2016,7 @@ xfs_qm_shake_freelist(
                         * We flush it delayed write, so don't bother
                         * releasing the mplock.
                         */
-                       error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
+                       error = xfs_qm_dqflush(dqp, 0);
                        if (error) {
                                xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
                        "xfs_qm_dqflush_all: dquot %p flush failed", dqp);
@@ -2187,7 +2199,7 @@ xfs_qm_dqreclaim_one(void)
                         * We flush it delayed write, so don't bother
                         * releasing the freelist lock.
                         */
-                       error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
+                       error = xfs_qm_dqflush(dqp, 0);
                        if (error) {
                                xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
                        "xfs_qm_dqreclaim: dquot %p flush failed", dqp);
index a5346630dfae05d639a0cee2a24cadbaac057cad..97b410c12794d5ddf52579625d4a256ed384d872 100644 (file)
@@ -59,7 +59,7 @@ xfs_fill_statvfs_from_dquot(
                be64_to_cpu(dp->d_blk_hardlimit);
        if (limit && statp->f_blocks > limit) {
                statp->f_blocks = limit;
-               statp->f_bfree =
+               statp->f_bfree = statp->f_bavail =
                        (statp->f_blocks > be64_to_cpu(dp->d_bcount)) ?
                         (statp->f_blocks - be64_to_cpu(dp->d_bcount)) : 0;
        }
index 71af76fe8a2369e47fbbc9f3dcb6ebd547bfc449..5d0ee8d492dbc21f9e04e9dd661bf3c35862e607 100644 (file)
@@ -891,7 +891,7 @@ xfs_qm_dqrele_all_inodes(
        uint             flags)
 {
        ASSERT(mp->m_quotainfo);
-       xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags, XFS_ICI_NO_TAG);
+       xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags, XFS_ICI_NO_TAG, 0);
 }
 
 /*------------------------------------------------------------------------*/
@@ -1192,9 +1192,9 @@ xfs_qm_internalqcheck(
        if (! XFS_IS_QUOTA_ON(mp))
                return XFS_ERROR(ESRCH);
 
-       xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
+       xfs_log_force(mp, XFS_LOG_SYNC);
        XFS_bflush(mp->m_ddev_targp);
-       xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
+       xfs_log_force(mp, XFS_LOG_SYNC);
        XFS_bflush(mp->m_ddev_targp);
 
        mutex_lock(&qcheck_lock);
index 97ac9640be989226a71035489cf677533b4830c1..c3ab75cb1d9aaea549dfc6da0fb207f5f3bf31bc 100644 (file)
@@ -589,12 +589,18 @@ xfs_trans_unreserve_and_mod_dquots(
        }
 }
 
-STATIC int
-xfs_quota_error(uint flags)
+STATIC void
+xfs_quota_warn(
+       struct xfs_mount        *mp,
+       struct xfs_dquot        *dqp,
+       int                     type)
 {
-       if (flags & XFS_QMOPT_ENOSPC)
-               return ENOSPC;
-       return EDQUOT;
+       /* no warnings for project quotas - we just return ENOSPC later */
+       if (dqp->dq_flags & XFS_DQ_PROJ)
+               return;
+       quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
+                          be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
+                          type);
 }
 
 /*
@@ -612,7 +618,6 @@ xfs_trans_dqresv(
        long            ninos,
        uint            flags)
 {
-       int             error;
        xfs_qcnt_t      hardlimit;
        xfs_qcnt_t      softlimit;
        time_t          timer;
@@ -649,7 +654,6 @@ xfs_trans_dqresv(
                warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
                resbcountp = &dqp->q_res_rtbcount;
        }
-       error = 0;
 
        if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
            dqp->q_core.d_id &&
@@ -667,18 +671,20 @@ xfs_trans_dqresv(
                         * nblks.
                         */
                        if (hardlimit > 0ULL &&
-                            (hardlimit <= nblks + *resbcountp)) {
-                               error = xfs_quota_error(flags);
+                           hardlimit <= nblks + *resbcountp) {
+                               xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
                                goto error_return;
                        }
-
                        if (softlimit > 0ULL &&
-                            (softlimit <= nblks + *resbcountp)) {
+                           softlimit <= nblks + *resbcountp) {
                                if ((timer != 0 && get_seconds() > timer) ||
                                    (warns != 0 && warns >= warnlimit)) {
-                                       error = xfs_quota_error(flags);
+                                       xfs_quota_warn(mp, dqp,
+                                                      QUOTA_NL_BSOFTLONGWARN);
                                        goto error_return;
                                }
+
+                               xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
                        }
                }
                if (ninos > 0) {
@@ -692,15 +698,19 @@ xfs_trans_dqresv(
                        softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
                        if (!softlimit)
                                softlimit = q->qi_isoftlimit;
+
                        if (hardlimit > 0ULL && count >= hardlimit) {
-                               error = xfs_quota_error(flags);
+                               xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
                                goto error_return;
-                       } else if (softlimit > 0ULL && count >= softlimit) {
-                               if ((timer != 0 && get_seconds() > timer) ||
+                       }
+                       if (softlimit > 0ULL && count >= softlimit) {
+                               if  ((timer != 0 && get_seconds() > timer) ||
                                     (warns != 0 && warns >= warnlimit)) {
-                                       error = xfs_quota_error(flags);
+                                       xfs_quota_warn(mp, dqp,
+                                                      QUOTA_NL_ISOFTLONGWARN);
                                        goto error_return;
                                }
+                               xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
                        }
                }
        }
@@ -736,9 +746,14 @@ xfs_trans_dqresv(
        ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
        ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
 
+       xfs_dqunlock(dqp);
+       return 0;
+
 error_return:
        xfs_dqunlock(dqp);
-       return error;
+       if (flags & XFS_QMOPT_ENOSPC)
+               return ENOSPC;
+       return EDQUOT;
 }
 
 
index 00fd357c3e46104aeb7349d69931b9c58d2fa8f9..d13eeba2c8f8a725821a145d8843eb4efa21a787 100644 (file)
@@ -36,8 +36,8 @@ struct xfs_acl {
 };
 
 /* On-disk XFS extended attribute names */
-#define SGI_ACL_FILE           "SGI_ACL_FILE"
-#define SGI_ACL_DEFAULT                "SGI_ACL_DEFAULT"
+#define SGI_ACL_FILE           (unsigned char *)"SGI_ACL_FILE"
+#define SGI_ACL_DEFAULT                (unsigned char *)"SGI_ACL_DEFAULT"
 #define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)
 #define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
 
index 6702bd865811d49fc09cda25bb176da256153599..b1a5a1ff88eac58f3618a977b1c3ce0e23e10b0b 100644 (file)
@@ -187,17 +187,13 @@ typedef struct xfs_perag_busy {
 /*
  * Per-ag incore structure, copies of information in agf and agi,
  * to improve the performance of allocation group selection.
- *
- * pick sizes which fit in allocation buckets well
  */
-#if (BITS_PER_LONG == 32)
-#define XFS_PAGB_NUM_SLOTS     84
-#elif (BITS_PER_LONG == 64)
 #define XFS_PAGB_NUM_SLOTS     128
-#endif
 
-typedef struct xfs_perag
-{
+typedef struct xfs_perag {
+       struct xfs_mount *pag_mount;    /* owner filesystem */
+       xfs_agnumber_t  pag_agno;       /* AG this structure belongs to */
+       atomic_t        pag_ref;        /* perag reference count */
        char            pagf_init;      /* this agf's entry is initialized */
        char            pagi_init;      /* this agi's entry is initialized */
        char            pagf_metadata;  /* the agf is preferred to be metadata */
@@ -210,8 +206,6 @@ typedef struct xfs_perag
        __uint32_t      pagf_btreeblks; /* # of blocks held in AGF btrees */
        xfs_agino_t     pagi_freecount; /* number of free inodes */
        xfs_agino_t     pagi_count;     /* number of allocated inodes */
-       int             pagb_count;     /* pagb slots in use */
-       xfs_perag_busy_t *pagb_list;    /* unstable blocks */
 
        /*
         * Inode allocation search lookup optimisation.
@@ -230,6 +224,8 @@ typedef struct xfs_perag
        rwlock_t        pag_ici_lock;   /* incore inode lock */
        struct radix_tree_root pag_ici_root;    /* incore inode cache root */
 #endif
+       int             pagb_count;     /* pagb slots in use */
+       xfs_perag_busy_t pagb_list[XFS_PAGB_NUM_SLOTS]; /* unstable blocks */
 } xfs_perag_t;
 
 /*
index 275b1f4f9430d5c214fba1703b3724b0de631f8a..94cddbfb25604abed1495b488799b13e10bbead0 100644 (file)
@@ -1662,11 +1662,13 @@ xfs_free_ag_extent(
                xfs_agf_t       *agf;
                xfs_perag_t     *pag;           /* per allocation group data */
 
+               pag = xfs_perag_get(mp, agno);
+               pag->pagf_freeblks += len;
+               xfs_perag_put(pag);
+
                agf = XFS_BUF_TO_AGF(agbp);
-               pag = &mp->m_perag[agno];
                be32_add_cpu(&agf->agf_freeblks, len);
                xfs_trans_agblocks_delta(tp, len);
-               pag->pagf_freeblks += len;
                XFS_WANT_CORRUPTED_GOTO(
                        be32_to_cpu(agf->agf_freeblks) <=
                        be32_to_cpu(agf->agf_length),
@@ -1969,10 +1971,12 @@ xfs_alloc_get_freelist(
        xfs_trans_brelse(tp, agflbp);
        if (be32_to_cpu(agf->agf_flfirst) == XFS_AGFL_SIZE(mp))
                agf->agf_flfirst = 0;
-       pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
+
+       pag = xfs_perag_get(mp, be32_to_cpu(agf->agf_seqno));
        be32_add_cpu(&agf->agf_flcount, -1);
        xfs_trans_agflist_delta(tp, -1);
        pag->pagf_flcount--;
+       xfs_perag_put(pag);
 
        logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
        if (btreeblk) {
@@ -2078,7 +2082,8 @@ xfs_alloc_put_freelist(
        be32_add_cpu(&agf->agf_fllast, 1);
        if (be32_to_cpu(agf->agf_fllast) == XFS_AGFL_SIZE(mp))
                agf->agf_fllast = 0;
-       pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
+
+       pag = xfs_perag_get(mp, be32_to_cpu(agf->agf_seqno));
        be32_add_cpu(&agf->agf_flcount, 1);
        xfs_trans_agflist_delta(tp, 1);
        pag->pagf_flcount++;
@@ -2089,6 +2094,7 @@ xfs_alloc_put_freelist(
                pag->pagf_btreeblks--;
                logflags |= XFS_AGF_BTREEBLKS;
        }
+       xfs_perag_put(pag);
 
        xfs_alloc_log_agf(tp, agbp, logflags);
 
@@ -2152,7 +2158,6 @@ xfs_read_agf(
                xfs_trans_brelse(tp, *bpp);
                return XFS_ERROR(EFSCORRUPTED);
        }
-
        XFS_BUF_SET_VTYPE_REF(*bpp, B_FS_AGF, XFS_AGF_REF);
        return 0;
 }
@@ -2175,7 +2180,7 @@ xfs_alloc_read_agf(
        ASSERT(agno != NULLAGNUMBER);
 
        error = xfs_read_agf(mp, tp, agno,
-                       (flags & XFS_ALLOC_FLAG_TRYLOCK) ? XFS_BUF_TRYLOCK : 0,
+                       (flags & XFS_ALLOC_FLAG_TRYLOCK) ? XBF_TRYLOCK : 0,
                        bpp);
        if (error)
                return error;
@@ -2184,7 +2189,7 @@ xfs_alloc_read_agf(
        ASSERT(!XFS_BUF_GETERROR(*bpp));
 
        agf = XFS_BUF_TO_AGF(*bpp);
-       pag = &mp->m_perag[agno];
+       pag = xfs_perag_get(mp, agno);
        if (!pag->pagf_init) {
                pag->pagf_freeblks = be32_to_cpu(agf->agf_freeblks);
                pag->pagf_btreeblks = be32_to_cpu(agf->agf_btreeblks);
@@ -2195,8 +2200,8 @@ xfs_alloc_read_agf(
                pag->pagf_levels[XFS_BTNUM_CNTi] =
                        be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
                spin_lock_init(&pag->pagb_lock);
-               pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
-                                       sizeof(xfs_perag_busy_t), KM_SLEEP);
+               pag->pagb_count = 0;
+               memset(pag->pagb_list, 0, sizeof(pag->pagb_list));
                pag->pagf_init = 1;
        }
 #ifdef DEBUG
@@ -2211,6 +2216,7 @@ xfs_alloc_read_agf(
                       be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]));
        }
 #endif
+       xfs_perag_put(pag);
        return 0;
 }
 
@@ -2270,8 +2276,7 @@ xfs_alloc_vextent(
                 * These three force us into a single a.g.
                 */
                args->agno = XFS_FSB_TO_AGNO(mp, args->fsbno);
-               down_read(&mp->m_peraglock);
-               args->pag = &mp->m_perag[args->agno];
+               args->pag = xfs_perag_get(mp, args->agno);
                args->minleft = 0;
                error = xfs_alloc_fix_freelist(args, 0);
                args->minleft = minleft;
@@ -2280,14 +2285,12 @@ xfs_alloc_vextent(
                        goto error0;
                }
                if (!args->agbp) {
-                       up_read(&mp->m_peraglock);
                        trace_xfs_alloc_vextent_noagbp(args);
                        break;
                }
                args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno);
                if ((error = xfs_alloc_ag_vextent(args)))
                        goto error0;
-               up_read(&mp->m_peraglock);
                break;
        case XFS_ALLOCTYPE_START_BNO:
                /*
@@ -2339,9 +2342,8 @@ xfs_alloc_vextent(
                 * Loop over allocation groups twice; first time with
                 * trylock set, second time without.
                 */
-               down_read(&mp->m_peraglock);
                for (;;) {
-                       args->pag = &mp->m_perag[args->agno];
+                       args->pag = xfs_perag_get(mp, args->agno);
                        if (no_min) args->minleft = 0;
                        error = xfs_alloc_fix_freelist(args, flags);
                        args->minleft = minleft;
@@ -2400,8 +2402,8 @@ xfs_alloc_vextent(
                                        }
                                }
                        }
+                       xfs_perag_put(args->pag);
                }
-               up_read(&mp->m_peraglock);
                if (bump_rotor || (type == XFS_ALLOCTYPE_ANY_AG)) {
                        if (args->agno == sagno)
                                mp->m_agfrotor = (mp->m_agfrotor + 1) %
@@ -2427,9 +2429,10 @@ xfs_alloc_vextent(
                        args->len);
 #endif
        }
+       xfs_perag_put(args->pag);
        return 0;
 error0:
-       up_read(&mp->m_peraglock);
+       xfs_perag_put(args->pag);
        return error;
 }
 
@@ -2454,8 +2457,7 @@ xfs_free_extent(
        args.agno = XFS_FSB_TO_AGNO(args.mp, bno);
        ASSERT(args.agno < args.mp->m_sb.sb_agcount);
        args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno);
-       down_read(&args.mp->m_peraglock);
-       args.pag = &args.mp->m_perag[args.agno];
+       args.pag = xfs_perag_get(args.mp, args.agno);
        if ((error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING)))
                goto error0;
 #ifdef DEBUG
@@ -2465,7 +2467,7 @@ xfs_free_extent(
 #endif
        error = xfs_free_ag_extent(tp, args.agbp, args.agno, args.agbno, len, 0);
 error0:
-       up_read(&args.mp->m_peraglock);
+       xfs_perag_put(args.pag);
        return error;
 }
 
@@ -2486,15 +2488,15 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
                    xfs_agblock_t bno,
                    xfs_extlen_t len)
 {
-       xfs_mount_t             *mp;
        xfs_perag_busy_t        *bsy;
+       struct xfs_perag        *pag;
        int                     n;
 
-       mp = tp->t_mountp;
-       spin_lock(&mp->m_perag[agno].pagb_lock);
+       pag = xfs_perag_get(tp->t_mountp, agno);
+       spin_lock(&pag->pagb_lock);
 
        /* search pagb_list for an open slot */
-       for (bsy = mp->m_perag[agno].pagb_list, n = 0;
+       for (bsy = pag->pagb_list, n = 0;
             n < XFS_PAGB_NUM_SLOTS;
             bsy++, n++) {
                if (bsy->busy_tp == NULL) {
@@ -2502,11 +2504,11 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
                }
        }
 
-       trace_xfs_alloc_busy(mp, agno, bno, len, n);
+       trace_xfs_alloc_busy(tp->t_mountp, agno, bno, len, n);
 
        if (n < XFS_PAGB_NUM_SLOTS) {
-               bsy = &mp->m_perag[agno].pagb_list[n];
-               mp->m_perag[agno].pagb_count++;
+               bsy = &pag->pagb_list[n];
+               pag->pagb_count++;
                bsy->busy_start = bno;
                bsy->busy_length = len;
                bsy->busy_tp = tp;
@@ -2521,7 +2523,8 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
                xfs_trans_set_sync(tp);
        }
 
-       spin_unlock(&mp->m_perag[agno].pagb_lock);
+       spin_unlock(&pag->pagb_lock);
+       xfs_perag_put(pag);
 }
 
 void
@@ -2529,24 +2532,23 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
                     xfs_agnumber_t agno,
                     int idx)
 {
-       xfs_mount_t             *mp;
+       struct xfs_perag        *pag;
        xfs_perag_busy_t        *list;
 
-       mp = tp->t_mountp;
-
-       spin_lock(&mp->m_perag[agno].pagb_lock);
-       list = mp->m_perag[agno].pagb_list;
-
        ASSERT(idx < XFS_PAGB_NUM_SLOTS);
+       pag = xfs_perag_get(tp->t_mountp, agno);
+       spin_lock(&pag->pagb_lock);
+       list = pag->pagb_list;
 
-       trace_xfs_alloc_unbusy(mp, agno, idx, list[idx].busy_tp == tp);
+       trace_xfs_alloc_unbusy(tp->t_mountp, agno, idx, list[idx].busy_tp == tp);
 
        if (list[idx].busy_tp == tp) {
                list[idx].busy_tp = NULL;
-               mp->m_perag[agno].pagb_count--;
+               pag->pagb_count--;
        }
 
-       spin_unlock(&mp->m_perag[agno].pagb_lock);
+       spin_unlock(&pag->pagb_lock);
+       xfs_perag_put(pag);
 }
 
 
@@ -2560,17 +2562,15 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
                    xfs_agblock_t bno,
                    xfs_extlen_t len)
 {
-       xfs_mount_t             *mp;
+       struct xfs_perag        *pag;
        xfs_perag_busy_t        *bsy;
        xfs_agblock_t           uend, bend;
        xfs_lsn_t               lsn = 0;
        int                     cnt;
 
-       mp = tp->t_mountp;
-
-       spin_lock(&mp->m_perag[agno].pagb_lock);
-
-       uend = bno + len - 1;
+       pag = xfs_perag_get(tp->t_mountp, agno);
+       spin_lock(&pag->pagb_lock);
+       cnt = pag->pagb_count;
 
        /*
         * search pagb_list for this slot, skipping open slots. We have to
@@ -2578,8 +2578,9 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
         * we have to get the most recent LSN for the log force to push out
         * all the transactions that span the range.
         */
-       for (cnt = 0; cnt < mp->m_perag[agno].pagb_count; cnt++) {
-               bsy = &mp->m_perag[agno].pagb_list[cnt];
+       uend = bno + len - 1;
+       for (cnt = 0; cnt < pag->pagb_count; cnt++) {
+               bsy = &pag->pagb_list[cnt];
                if (!bsy->busy_tp)
                        continue;
 
@@ -2591,7 +2592,8 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
                if (XFS_LSN_CMP(bsy->busy_tp->t_commit_lsn, lsn) > 0)
                        lsn = bsy->busy_tp->t_commit_lsn;
        }
-       spin_unlock(&mp->m_perag[agno].pagb_lock);
+       spin_unlock(&pag->pagb_lock);
+       xfs_perag_put(pag);
        trace_xfs_alloc_busysearch(tp->t_mountp, agno, bno, len, lsn);
 
        /*
@@ -2599,5 +2601,5 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
         * transaction that freed the block
         */
        if (lsn)
-               xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC);
+               xfs_log_force_lsn(tp->t_mountp, lsn, XFS_LOG_SYNC);
 }
index adbd9141aea165158b490cb3d3bbed19aa0a3bb7..b726e10d2c1c18bafa355663d822f8b9ef441d67 100644 (file)
@@ -61,12 +61,14 @@ xfs_allocbt_set_root(
        struct xfs_agf          *agf = XFS_BUF_TO_AGF(agbp);
        xfs_agnumber_t          seqno = be32_to_cpu(agf->agf_seqno);
        int                     btnum = cur->bc_btnum;
+       struct xfs_perag        *pag = xfs_perag_get(cur->bc_mp, seqno);
 
        ASSERT(ptr->s != 0);
 
        agf->agf_roots[btnum] = ptr->s;
        be32_add_cpu(&agf->agf_levels[btnum], inc);
-       cur->bc_mp->m_perag[seqno].pagf_levels[btnum] += inc;
+       pag->pagf_levels[btnum] += inc;
+       xfs_perag_put(pag);
 
        xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_ROOTS | XFS_AGF_LEVELS);
 }
@@ -150,6 +152,7 @@ xfs_allocbt_update_lastrec(
 {
        struct xfs_agf          *agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp);
        xfs_agnumber_t          seqno = be32_to_cpu(agf->agf_seqno);
+       struct xfs_perag        *pag;
        __be32                  len;
        int                     numrecs;
 
@@ -193,7 +196,9 @@ xfs_allocbt_update_lastrec(
        }
 
        agf->agf_longest = len;
-       cur->bc_mp->m_perag[seqno].pagf_longest = be32_to_cpu(len);
+       pag = xfs_perag_get(cur->bc_mp, seqno);
+       pag->pagf_longest = be32_to_cpu(len);
+       xfs_perag_put(pag);
        xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, XFS_AGF_LONGEST);
 }
 
index e953b6cfb2a85e3f35116180e52ae473e26466a9..b9c196a53c42e219a6cca9113d95be704ecc8f9e 100644 (file)
@@ -93,12 +93,12 @@ STATIC int xfs_attr_rmtval_remove(xfs_da_args_t *args);
 STATIC int
 xfs_attr_name_to_xname(
        struct xfs_name *xname,
-       const char      *aname)
+       const unsigned char *aname)
 {
        if (!aname)
                return EINVAL;
        xname->name = aname;
-       xname->len = strlen(aname);
+       xname->len = strlen((char *)aname);
        if (xname->len >= MAXNAMELEN)
                return EFAULT;          /* match IRIX behaviour */
 
@@ -124,7 +124,7 @@ STATIC int
 xfs_attr_get_int(
        struct xfs_inode        *ip,
        struct xfs_name         *name,
-       char                    *value,
+       unsigned char           *value,
        int                     *valuelenp,
        int                     flags)
 {
@@ -171,8 +171,8 @@ xfs_attr_get_int(
 int
 xfs_attr_get(
        xfs_inode_t     *ip,
-       const char      *name,
-       char            *value,
+       const unsigned char *name,
+       unsigned char   *value,
        int             *valuelenp,
        int             flags)
 {
@@ -197,7 +197,7 @@ xfs_attr_get(
 /*
  * Calculate how many blocks we need for the new attribute,
  */
-int
+STATIC int
 xfs_attr_calc_size(
        struct xfs_inode        *ip,
        int                     namelen,
@@ -235,8 +235,12 @@ xfs_attr_calc_size(
 }
 
 STATIC int
-xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
-               char *value, int valuelen, int flags)
+xfs_attr_set_int(
+       struct xfs_inode *dp,
+       struct xfs_name *name,
+       unsigned char   *value,
+       int             valuelen,
+       int             flags)
 {
        xfs_da_args_t   args;
        xfs_fsblock_t   firstblock;
@@ -452,8 +456,8 @@ out:
 int
 xfs_attr_set(
        xfs_inode_t     *dp,
-       const char      *name,
-       char            *value,
+       const unsigned char *name,
+       unsigned char   *value,
        int             valuelen,
        int             flags)
 {
@@ -600,7 +604,7 @@ out:
 int
 xfs_attr_remove(
        xfs_inode_t     *dp,
-       const char      *name,
+       const unsigned char *name,
        int             flags)
 {
        int             error;
@@ -669,9 +673,13 @@ xfs_attr_list_int(xfs_attr_list_context_t *context)
  */
 /*ARGSUSED*/
 STATIC int
-xfs_attr_put_listent(xfs_attr_list_context_t *context, int flags,
-                    char *name, int namelen,
-                    int valuelen, char *value)
+xfs_attr_put_listent(
+       xfs_attr_list_context_t *context,
+       int             flags,
+       unsigned char   *name,
+       int             namelen,
+       int             valuelen,
+       unsigned char   *value)
 {
        struct attrlist *alist = (struct attrlist *)context->alist;
        attrlist_ent_t *aep;
@@ -1980,7 +1988,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
        xfs_bmbt_irec_t map[ATTR_RMTVALUE_MAPSIZE];
        xfs_mount_t *mp;
        xfs_daddr_t dblkno;
-       xfs_caddr_t dst;
+       void *dst;
        xfs_buf_t *bp;
        int nmap, error, tmp, valuelen, blkcnt, i;
        xfs_dablk_t lblkno;
@@ -2007,15 +2015,14 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
                        dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
                        blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
                        error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno,
-                                            blkcnt,
-                                            XFS_BUF_LOCK | XBF_DONT_BLOCK,
+                                            blkcnt, XBF_LOCK | XBF_DONT_BLOCK,
                                             &bp);
                        if (error)
                                return(error);
 
                        tmp = (valuelen < XFS_BUF_SIZE(bp))
                                ? valuelen : XFS_BUF_SIZE(bp);
-                       xfs_biomove(bp, 0, tmp, dst, XFS_B_READ);
+                       xfs_biomove(bp, 0, tmp, dst, XBF_READ);
                        xfs_buf_relse(bp);
                        dst += tmp;
                        valuelen -= tmp;
@@ -2039,7 +2046,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
        xfs_inode_t *dp;
        xfs_bmbt_irec_t map;
        xfs_daddr_t dblkno;
-       xfs_caddr_t src;
+       void *src;
        xfs_buf_t *bp;
        xfs_dablk_t lblkno;
        int blkcnt, valuelen, nmap, error, tmp, committed;
@@ -2141,13 +2148,13 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
                blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
 
                bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt,
-                                XFS_BUF_LOCK | XBF_DONT_BLOCK);
+                                XBF_LOCK | XBF_DONT_BLOCK);
                ASSERT(bp);
                ASSERT(!XFS_BUF_GETERROR(bp));
 
                tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen :
                                                        XFS_BUF_SIZE(bp);
-               xfs_biomove(bp, 0, tmp, src, XFS_B_WRITE);
+               xfs_biomove(bp, 0, tmp, src, XBF_WRITE);
                if (tmp < XFS_BUF_SIZE(bp))
                        xfs_biozero(bp, tmp, XFS_BUF_SIZE(bp) - tmp);
                if ((error = xfs_bwrite(mp, bp))) {/* GROT: NOTE: synchronous write */
@@ -2208,8 +2215,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
                /*
                 * If the "remote" value is in the cache, remove it.
                 */
-               bp = xfs_incore(mp->m_ddev_targp, dblkno, blkcnt,
-                               XFS_INCORE_TRYLOCK);
+               bp = xfs_incore(mp->m_ddev_targp, dblkno, blkcnt, XBF_TRYLOCK);
                if (bp) {
                        XFS_BUF_STALE(bp);
                        XFS_BUF_UNDELAYWRITE(bp);
index 59b410ce69a1e631ac11aa6f2c447c4e2bac8805..e920d68ef509548fc8c48e091ce42c57b5682d35 100644 (file)
@@ -113,7 +113,7 @@ typedef struct attrlist_cursor_kern {
 
 
 typedef int (*put_listent_func_t)(struct xfs_attr_list_context *, int,
-                                     char *, int, int, char *);
+                             unsigned char *, int, int, unsigned char *);
 
 typedef struct xfs_attr_list_context {
        struct xfs_inode                *dp;            /* inode */
@@ -139,7 +139,6 @@ typedef struct xfs_attr_list_context {
 /*
  * Overall external interface routines.
  */
-int xfs_attr_calc_size(struct xfs_inode *, int, int, int *);
 int xfs_attr_inactive(struct xfs_inode *dp);
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
 int xfs_attr_list_int(struct xfs_attr_list_context *);
index baf41b5af756fdd4da628b45f64ad805e913cba0..a90ce74fc256904837381f61e49c0e569818e89f 100644 (file)
@@ -521,11 +521,11 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
 
        sfe = &sf->list[0];
        for (i = 0; i < sf->hdr.count; i++) {
-               nargs.name = (char *)sfe->nameval;
+               nargs.name = sfe->nameval;
                nargs.namelen = sfe->namelen;
-               nargs.value = (char *)&sfe->nameval[nargs.namelen];
+               nargs.value = &sfe->nameval[nargs.namelen];
                nargs.valuelen = sfe->valuelen;
-               nargs.hashval = xfs_da_hashname((char *)sfe->nameval,
+               nargs.hashval = xfs_da_hashname(sfe->nameval,
                                                sfe->namelen);
                nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);
                error = xfs_attr_leaf_lookup_int(bp, &nargs); /* set a->index */
@@ -612,10 +612,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
                        error = context->put_listent(context,
                                           sfe->flags,
-                                          (char *)sfe->nameval,
+                                          sfe->nameval,
                                           (int)sfe->namelen,
                                           (int)sfe->valuelen,
-                                          (char*)&sfe->nameval[sfe->namelen]);
+                                          &sfe->nameval[sfe->namelen]);
 
                        /*
                         * Either search callback finished early or
@@ -659,8 +659,8 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                }
 
                sbp->entno = i;
-               sbp->hash = xfs_da_hashname((char *)sfe->nameval, sfe->namelen);
-               sbp->name = (char *)sfe->nameval;
+               sbp->hash = xfs_da_hashname(sfe->nameval, sfe->namelen);
+               sbp->name = sfe->nameval;
                sbp->namelen = sfe->namelen;
                /* These are bytes, and both on-disk, don't endian-flip */
                sbp->valuelen = sfe->valuelen;
@@ -818,9 +818,9 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
                        continue;
                ASSERT(entry->flags & XFS_ATTR_LOCAL);
                name_loc = xfs_attr_leaf_name_local(leaf, i);
-               nargs.name = (char *)name_loc->nameval;
+               nargs.name = name_loc->nameval;
                nargs.namelen = name_loc->namelen;
-               nargs.value = (char *)&name_loc->nameval[nargs.namelen];
+               nargs.value = &name_loc->nameval[nargs.namelen];
                nargs.valuelen = be16_to_cpu(name_loc->valuelen);
                nargs.hashval = be32_to_cpu(entry->hashval);
                nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
@@ -2370,10 +2370,10 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
 
                        retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_loc->nameval,
+                                               name_loc->nameval,
                                                (int)name_loc->namelen,
                                                be16_to_cpu(name_loc->valuelen),
-                                               (char *)&name_loc->nameval[name_loc->namelen]);
+                                               &name_loc->nameval[name_loc->namelen]);
                        if (retval)
                                return retval;
                } else {
@@ -2397,15 +2397,15 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
                                        return retval;
                                retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_rmt->name,
+                                               name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
-                                               (char*)args.value);
+                                               args.value);
                                kmem_free(args.value);
                        } else {
                                retval = context->put_listent(context,
                                                entry->flags,
-                                               (char *)name_rmt->name,
+                                               name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
                                                NULL);
@@ -2950,7 +2950,7 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
                                                map.br_blockcount);
                        bp = xfs_trans_get_buf(*trans,
                                        dp->i_mount->m_ddev_targp,
-                                       dblkno, dblkcnt, XFS_BUF_LOCK);
+                                       dblkno, dblkcnt, XBF_LOCK);
                        xfs_trans_binval(*trans, bp);
                        /*
                         * Roll to next transaction.
index 76ab7b0cbb3adac0c0d7e42eac9c364e913e382b..919756e3ba53591a9132849a6dc7c57771f1aebb 100644 (file)
@@ -52,7 +52,7 @@ typedef struct xfs_attr_sf_sort {
        __uint8_t       valuelen;       /* length of value */
        __uint8_t       flags;          /* flags bits (see xfs_attr_leaf.h) */
        xfs_dahash_t    hash;           /* this entry's hash value */
-       char            *name;          /* name value, pointer into buffer */
+       unsigned char   *name;          /* name value, pointer into buffer */
 } xfs_attr_sf_sort_t;
 
 #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen)  /* space name/value uses */ \
index 98251cdc52aa92e2c1557ce71dfd0d9382935887..1869fb97381968046491d9349684ff12bc038cee 100644 (file)
@@ -2629,13 +2629,12 @@ xfs_bmap_btalloc(
                if (startag == NULLAGNUMBER)
                        startag = ag = 0;
                notinit = 0;
-               down_read(&mp->m_peraglock);
+               pag = xfs_perag_get(mp, ag);
                while (blen < ap->alen) {
-                       pag = &mp->m_perag[ag];
                        if (!pag->pagf_init &&
                            (error = xfs_alloc_pagf_init(mp, args.tp,
                                    ag, XFS_ALLOC_FLAG_TRYLOCK))) {
-                               up_read(&mp->m_peraglock);
+                               xfs_perag_put(pag);
                                return error;
                        }
                        /*
@@ -2667,13 +2666,13 @@ xfs_bmap_btalloc(
                                                break;
 
                                        error = xfs_filestream_new_ag(ap, &ag);
-                                       if (error) {
-                                               up_read(&mp->m_peraglock);
+                                       xfs_perag_put(pag);
+                                       if (error)
                                                return error;
-                                       }
 
                                        /* loop again to set 'blen'*/
                                        startag = NULLAGNUMBER;
+                                       pag = xfs_perag_get(mp, ag);
                                        continue;
                                }
                        }
@@ -2681,8 +2680,10 @@ xfs_bmap_btalloc(
                                ag = 0;
                        if (ag == startag)
                                break;
+                       xfs_perag_put(pag);
+                       pag = xfs_perag_get(mp, ag);
                }
-               up_read(&mp->m_peraglock);
+               xfs_perag_put(pag);
                /*
                 * Since the above loop did a BUF_TRYLOCK, it is
                 * possible that there is space for this request.
@@ -4470,7 +4471,7 @@ xfs_bmapi(
        xfs_fsblock_t   abno;           /* allocated block number */
        xfs_extlen_t    alen;           /* allocated extent length */
        xfs_fileoff_t   aoff;           /* allocated file offset */
-       xfs_bmalloca_t  bma;            /* args for xfs_bmap_alloc */
+       xfs_bmalloca_t  bma = { 0 };    /* args for xfs_bmap_alloc */
        xfs_btree_cur_t *cur;           /* bmap btree cursor */
        xfs_fileoff_t   end;            /* end of mapped file region */
        int             eof;            /* we've hit the end of extents */
index 38751d5fac6fdf5486568728ed5c11c26dd4a067..416e47e54b83fc79f2472f59de81d8a34769e940 100644 (file)
@@ -334,7 +334,7 @@ xfs_bmbt_disk_set_allf(
 /*
  * Set all the fields in a bmap extent record from the uncompressed form.
  */
-void
+STATIC void
 xfs_bmbt_disk_set_all(
        xfs_bmbt_rec_t  *r,
        xfs_bmbt_irec_t *s)
index cf07ca7c22e73e70340da1d061e09b33c1234f4f..0e66c4ea0f8581ef06f2248d72953a84b4cbafbf 100644 (file)
@@ -223,7 +223,6 @@ extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v);
 extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v);
 extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v);
 
-extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
 extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
                        xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
 
index 36a0992dd66991d1cd9c1908398eb7ea42b15c46..96be4b0f249613fef3b0cc8ab0ae443dafc3d2f4 100644 (file)
@@ -977,7 +977,7 @@ xfs_btree_get_buf_block(
        xfs_daddr_t             d;
 
        /* need to sort out how callers deal with failures first */
-       ASSERT(!(flags & XFS_BUF_TRYLOCK));
+       ASSERT(!(flags & XBF_TRYLOCK));
 
        d = xfs_btree_ptr_to_daddr(cur, ptr);
        *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d,
@@ -1008,7 +1008,7 @@ xfs_btree_read_buf_block(
        int                     error;
 
        /* need to sort out how callers deal with failures first */
-       ASSERT(!(flags & XFS_BUF_TRYLOCK));
+       ASSERT(!(flags & XBF_TRYLOCK));
 
        d = xfs_btree_ptr_to_daddr(cur, ptr);
        error = xfs_trans_read_buf(mp, cur->bc_tp, mp->m_ddev_targp, d,
index a30f7e9eb2b96df6ab35aeb349430d4ddcc3a77a..f3c49e69eab9fe3b1f27f7aeaafbaefefccbd4f4 100644 (file)
@@ -250,7 +250,7 @@ xfs_buf_item_format(
                       ((bip->bli_format.blf_map_size - 1) * sizeof(uint)));
        vecp->i_addr = (xfs_caddr_t)&bip->bli_format;
        vecp->i_len = base_size;
-       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BFORMAT);
+       vecp->i_type = XLOG_REG_TYPE_BFORMAT;
        vecp++;
        nvecs = 1;
 
@@ -297,14 +297,14 @@ xfs_buf_item_format(
                        buffer_offset = first_bit * XFS_BLI_CHUNK;
                        vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
                        vecp->i_len = nbits * XFS_BLI_CHUNK;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
+                       vecp->i_type = XLOG_REG_TYPE_BCHUNK;
                        nvecs++;
                        break;
                } else if (next_bit != last_bit + 1) {
                        buffer_offset = first_bit * XFS_BLI_CHUNK;
                        vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
                        vecp->i_len = nbits * XFS_BLI_CHUNK;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
+                       vecp->i_type = XLOG_REG_TYPE_BCHUNK;
                        nvecs++;
                        vecp++;
                        first_bit = next_bit;
@@ -316,7 +316,7 @@ xfs_buf_item_format(
                        buffer_offset = first_bit * XFS_BLI_CHUNK;
                        vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
                        vecp->i_len = nbits * XFS_BLI_CHUNK;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
+                       vecp->i_type = XLOG_REG_TYPE_BCHUNK;
 /* You would think we need to bump the nvecs here too, but we do not
  * this number is used by recovery, and it gets confused by the boundary
  * split here
@@ -467,8 +467,10 @@ xfs_buf_item_unpin_remove(
 /*
  * This is called to attempt to lock the buffer associated with this
  * buf log item.  Don't sleep on the buffer lock.  If we can't get
- * the lock right away, return 0.  If we can get the lock, pull the
- * buffer from the free list, mark it busy, and return 1.
+ * the lock right away, return 0.  If we can get the lock, take a
+ * reference to the buffer. If this is a delayed write buffer that
+ * needs AIL help to be written back, invoke the pushbuf routine
+ * rather than the normal success path.
  */
 STATIC uint
 xfs_buf_item_trylock(
@@ -477,24 +479,18 @@ xfs_buf_item_trylock(
        xfs_buf_t       *bp;
 
        bp = bip->bli_buf;
-
-       if (XFS_BUF_ISPINNED(bp)) {
+       if (XFS_BUF_ISPINNED(bp))
                return XFS_ITEM_PINNED;
-       }
-
-       if (!XFS_BUF_CPSEMA(bp)) {
+       if (!XFS_BUF_CPSEMA(bp))
                return XFS_ITEM_LOCKED;
-       }
 
-       /*
-        * Remove the buffer from the free list.  Only do this
-        * if it's on the free list.  Private buffers like the
-        * superblock buffer are not.
-        */
+       /* take a reference to the buffer.  */
        XFS_BUF_HOLD(bp);
 
        ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
        trace_xfs_buf_item_trylock(bip);
+       if (XFS_BUF_ISDELAYWRITE(bp))
+               return XFS_ITEM_PUSHBUF;
        return XFS_ITEM_SUCCESS;
 }
 
@@ -626,11 +622,9 @@ xfs_buf_item_committed(
 }
 
 /*
- * This is called to asynchronously write the buffer associated with this
- * buf log item out to disk. The buffer will already have been locked by
- * a successful call to xfs_buf_item_trylock().  If the buffer still has
- * B_DELWRI set, then get it going out to disk with a call to bawrite().
- * If not, then just release the buffer.
+ * The buffer is locked, but is not a delayed write buffer. This happens
+ * if we race with IO completion and hence we don't want to try to write it
+ * again. Just release the buffer.
  */
 STATIC void
 xfs_buf_item_push(
@@ -642,17 +636,29 @@ xfs_buf_item_push(
        trace_xfs_buf_item_push(bip);
 
        bp = bip->bli_buf;
+       ASSERT(!XFS_BUF_ISDELAYWRITE(bp));
+       xfs_buf_relse(bp);
+}
 
-       if (XFS_BUF_ISDELAYWRITE(bp)) {
-               int     error;
-               error = xfs_bawrite(bip->bli_item.li_mountp, bp);
-               if (error)
-                       xfs_fs_cmn_err(CE_WARN, bip->bli_item.li_mountp,
-                       "xfs_buf_item_push: pushbuf error %d on bip %p, bp %p",
-                                       error, bip, bp);
-       } else {
-               xfs_buf_relse(bp);
-       }
+/*
+ * The buffer is locked and is a delayed write buffer. Promote the buffer
+ * in the delayed write queue as the caller knows that they must invoke
+ * the xfsbufd to get this buffer written. We have to unlock the buffer
+ * to allow the xfsbufd to write it, too.
+ */
+STATIC void
+xfs_buf_item_pushbuf(
+       xfs_buf_log_item_t      *bip)
+{
+       xfs_buf_t       *bp;
+
+       ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
+       trace_xfs_buf_item_pushbuf(bip);
+
+       bp = bip->bli_buf;
+       ASSERT(XFS_BUF_ISDELAYWRITE(bp));
+       xfs_buf_delwri_promote(bp);
+       xfs_buf_relse(bp);
 }
 
 /* ARGSUSED */
@@ -677,7 +683,7 @@ static struct xfs_item_ops xfs_buf_item_ops = {
        .iop_committed  = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
                                        xfs_buf_item_committed,
        .iop_push       = (void(*)(xfs_log_item_t*))xfs_buf_item_push,
-       .iop_pushbuf    = NULL,
+       .iop_pushbuf    = (void(*)(xfs_log_item_t*))xfs_buf_item_pushbuf,
        .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
                                        xfs_buf_item_committing
 };
index c0c8869115b1644c1512485464fb383a830faf8c..0ca556b4bf313bf8526769ff051f188df5a3066e 100644 (file)
@@ -1534,8 +1534,8 @@ xfs_da_hashname(const __uint8_t *name, int namelen)
 enum xfs_dacmp
 xfs_da_compname(
        struct xfs_da_args *args,
-       const char      *name,
-       int             len)
+       const unsigned char *name,
+       int             len)
 {
        return (args->namelen == len && memcmp(args->name, name, len) == 0) ?
                                        XFS_CMP_EXACT : XFS_CMP_DIFFERENT;
index 30cd08f56a3a0c7cce557a5535b6fcccceaa6239..fe9f5a8c1d2a56794e083465ff54280cb49450d5 100644 (file)
@@ -209,7 +209,8 @@ typedef struct xfs_da_state {
  */
 struct xfs_nameops {
        xfs_dahash_t    (*hashname)(struct xfs_name *);
-       enum xfs_dacmp  (*compname)(struct xfs_da_args *, const char *, int);
+       enum xfs_dacmp  (*compname)(struct xfs_da_args *,
+                                       const unsigned char *, int);
 };
 
 
@@ -260,7 +261,7 @@ int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
 
 uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
 enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
-                               const char *name, int len);
+                               const unsigned char *name, int len);
 
 
 xfs_da_state_t *xfs_da_state_alloc(void);
index d1483a4f71b8d2cb4adac62e88945a1dcc273a72..cd27c9d6c71f8b9014183fb504bc5183a8785a56 100644 (file)
 #include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
+
+static int xfs_swap_extents(
+       xfs_inode_t     *ip,    /* target inode */
+       xfs_inode_t     *tip,   /* tmp inode */
+       xfs_swapext_t   *sxp);
+
 /*
- * Syssgi interface for swapext
+ * ioctl interface for swapext
  */
 int
 xfs_swapext(
        xfs_swapext_t   *sxp)
 {
        xfs_inode_t     *ip, *tip;
-       struct file     *file, *target_file;
+       struct file     *file, *tmp_file;
        int             error = 0;
 
        /* Pull information for the target fd */
@@ -68,56 +74,128 @@ xfs_swapext(
                goto out_put_file;
        }
 
-       target_file = fget((int)sxp->sx_fdtmp);
-       if (!target_file) {
+       tmp_file = fget((int)sxp->sx_fdtmp);
+       if (!tmp_file) {
                error = XFS_ERROR(EINVAL);
                goto out_put_file;
        }
 
-       if (!(target_file->f_mode & FMODE_WRITE) ||
-           (target_file->f_flags & O_APPEND)) {
+       if (!(tmp_file->f_mode & FMODE_WRITE) ||
+           (tmp_file->f_flags & O_APPEND)) {
                error = XFS_ERROR(EBADF);
-               goto out_put_target_file;
+               goto out_put_tmp_file;
        }
 
        if (IS_SWAPFILE(file->f_path.dentry->d_inode) ||
-           IS_SWAPFILE(target_file->f_path.dentry->d_inode)) {
+           IS_SWAPFILE(tmp_file->f_path.dentry->d_inode)) {
                error = XFS_ERROR(EINVAL);
-               goto out_put_target_file;
+               goto out_put_tmp_file;
        }
 
        ip = XFS_I(file->f_path.dentry->d_inode);
-       tip = XFS_I(target_file->f_path.dentry->d_inode);
+       tip = XFS_I(tmp_file->f_path.dentry->d_inode);
 
        if (ip->i_mount != tip->i_mount) {
                error = XFS_ERROR(EINVAL);
-               goto out_put_target_file;
+               goto out_put_tmp_file;
        }
 
        if (ip->i_ino == tip->i_ino) {
                error = XFS_ERROR(EINVAL);
-               goto out_put_target_file;
+               goto out_put_tmp_file;
        }
 
        if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
                error = XFS_ERROR(EIO);
-               goto out_put_target_file;
+               goto out_put_tmp_file;
        }
 
        error = xfs_swap_extents(ip, tip, sxp);
 
- out_put_target_file:
-       fput(target_file);
+ out_put_tmp_file:
+       fput(tmp_file);
  out_put_file:
        fput(file);
  out:
        return error;
 }
 
-int
+/*
+ * We need to check that the format of the data fork in the temporary inode is
+ * valid for the target inode before doing the swap. This is not a problem with
+ * attr1 because of the fixed fork offset, but attr2 has a dynamically sized
+ * data fork depending on the space the attribute fork is taking so we can get
+ * invalid formats on the target inode.
+ *
+ * E.g. target has space for 7 extents in extent format, temp inode only has
+ * space for 6.  If we defragment down to 7 extents, then the tmp format is a
+ * btree, but when swapped it needs to be in extent format. Hence we can't just
+ * blindly swap data forks on attr2 filesystems.
+ *
+ * Note that we check the swap in both directions so that we don't end up with
+ * a corrupt temporary inode, either.
+ *
+ * Note that fixing the way xfs_fsr sets up the attribute fork in the source
+ * inode will prevent this situation from occurring, so all we do here is
+ * reject and log the attempt. basically we are putting the responsibility on
+ * userspace to get this right.
+ */
+static int
+xfs_swap_extents_check_format(
+       xfs_inode_t     *ip,    /* target inode */
+       xfs_inode_t     *tip)   /* tmp inode */
+{
+
+       /* Should never get a local format */
+       if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
+           tip->i_d.di_format == XFS_DINODE_FMT_LOCAL)
+               return EINVAL;
+
+       /*
+        * if the target inode has less extents that then temporary inode then
+        * why did userspace call us?
+        */
+       if (ip->i_d.di_nextents < tip->i_d.di_nextents)
+               return EINVAL;
+
+       /*
+        * if the target inode is in extent form and the temp inode is in btree
+        * form then we will end up with the target inode in the wrong format
+        * as we already know there are less extents in the temp inode.
+        */
+       if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
+           tip->i_d.di_format == XFS_DINODE_FMT_BTREE)
+               return EINVAL;
+
+       /* Check temp in extent form to max in target */
+       if (tip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
+           XFS_IFORK_NEXTENTS(tip, XFS_DATA_FORK) > ip->i_df.if_ext_max)
+               return EINVAL;
+
+       /* Check target in extent form to max in temp */
+       if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
+           XFS_IFORK_NEXTENTS(ip, XFS_DATA_FORK) > tip->i_df.if_ext_max)
+               return EINVAL;
+
+       /* Check root block of temp in btree form to max in target */
+       if (tip->i_d.di_format == XFS_DINODE_FMT_BTREE &&
+           XFS_IFORK_BOFF(ip) &&
+           tip->i_df.if_broot_bytes > XFS_IFORK_BOFF(ip))
+               return EINVAL;
+
+       /* Check root block of target in btree form to max in temp */
+       if (ip->i_d.di_format == XFS_DINODE_FMT_BTREE &&
+           XFS_IFORK_BOFF(tip) &&
+           ip->i_df.if_broot_bytes > XFS_IFORK_BOFF(tip))
+               return EINVAL;
+
+       return 0;
+}
+
+static int
 xfs_swap_extents(
-       xfs_inode_t     *ip,
-       xfs_inode_t     *tip,
+       xfs_inode_t     *ip,    /* target inode */
+       xfs_inode_t     *tip,   /* tmp inode */
        xfs_swapext_t   *sxp)
 {
        xfs_mount_t     *mp;
@@ -161,13 +239,6 @@ xfs_swap_extents(
                goto out_unlock;
        }
 
-       /* Should never get a local format */
-       if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
-           tip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
-               error = XFS_ERROR(EINVAL);
-               goto out_unlock;
-       }
-
        if (VN_CACHED(VFS_I(tip)) != 0) {
                error = xfs_flushinval_pages(tip, 0, -1,
                                FI_REMAPF_LOCKED);
@@ -189,13 +260,15 @@ xfs_swap_extents(
                goto out_unlock;
        }
 
-       /*
-        * If the target has extended attributes, the tmp file
-        * must also in order to ensure the correct data fork
-        * format.
-        */
-       if ( XFS_IFORK_Q(ip) != XFS_IFORK_Q(tip) ) {
-               error = XFS_ERROR(EINVAL);
+       trace_xfs_swap_extent_before(ip, 0);
+       trace_xfs_swap_extent_before(tip, 1);
+
+       /* check inode formats now that data is flushed */
+       error = xfs_swap_extents_check_format(ip, tip);
+       if (error) {
+               xfs_fs_cmn_err(CE_NOTE, mp,
+                   "%s: inode 0x%llx format is incompatible for exchanging.",
+                               __FILE__, ip->i_ino);
                goto out_unlock;
        }
 
@@ -275,6 +348,16 @@ xfs_swap_extents(
        *ifp = *tifp;           /* struct copy */
        *tifp = *tempifp;       /* struct copy */
 
+       /*
+        * Fix the in-memory data fork values that are dependent on the fork
+        * offset in the inode. We can't assume they remain the same as attr2
+        * has dynamic fork offsets.
+        */
+       ifp->if_ext_max = XFS_IFORK_SIZE(ip, XFS_DATA_FORK) /
+                                       (uint)sizeof(xfs_bmbt_rec_t);
+       tifp->if_ext_max = XFS_IFORK_SIZE(tip, XFS_DATA_FORK) /
+                                       (uint)sizeof(xfs_bmbt_rec_t);
+
        /*
         * Fix the on-disk inode values
         */
@@ -347,6 +430,8 @@ xfs_swap_extents(
 
        error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
 
+       trace_xfs_swap_extent_after(ip, 0);
+       trace_xfs_swap_extent_after(tip, 1);
 out:
        kmem_free(tempifp);
        return error;
index 4f55a630655889714d437ce0ff69d978a6624846..20bdd935c121336736ea83e00bbe487fda3ad12a 100644 (file)
@@ -48,9 +48,6 @@ typedef struct xfs_swapext
  */
 int    xfs_swapext(struct xfs_swapext *sx);
 
-int    xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
-               struct xfs_swapext *sxp);
-
 #endif /* __KERNEL__ */
 
 #endif /* __XFS_DFRAG_H__ */
index 93634a7e90e9c84ad1319e0e862e7c3e40839678..42520f041265fea2d7df1d02bc8a4e3e82215337 100644 (file)
@@ -44,7 +44,7 @@
 #include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
-struct xfs_name xfs_name_dotdot = {"..", 2};
+struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2};
 
 /*
  * ASCII case-insensitive (ie. A-Z) support for directories that was
@@ -66,8 +66,8 @@ xfs_ascii_ci_hashname(
 STATIC enum xfs_dacmp
 xfs_ascii_ci_compname(
        struct xfs_da_args *args,
-       const char      *name,
-       int             len)
+       const unsigned char *name,
+       int             len)
 {
        enum xfs_dacmp  result;
        int             i;
@@ -247,7 +247,7 @@ xfs_dir_createname(
 int
 xfs_dir_cilookup_result(
        struct xfs_da_args *args,
-       const char      *name,
+       const unsigned char *name,
        int             len)
 {
        if (args->cmpresult == XFS_CMP_DIFFERENT)
index 1d9ef96f33aa736beeeeda6b368453cecbe774e6..74a3b1057685c8d93db3494669d762ccc4da8a43 100644 (file)
@@ -100,7 +100,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,
 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
                                struct xfs_dabuf *bp);
 
-extern int xfs_dir_cilookup_result(struct xfs_da_args *args, const char *name,
-                               int len);
+extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
+                               const unsigned char *name, int len);
 
 #endif /* __XFS_DIR2_H__ */
index ddc4ecc7807fdabf748b621557bece3cfc22c10a..779a267b0a84c55a83764d25d469493b24ca0a7f 100644 (file)
@@ -57,8 +57,8 @@ static xfs_dahash_t xfs_dir_hash_dot, xfs_dir_hash_dotdot;
 void
 xfs_dir_startup(void)
 {
-       xfs_dir_hash_dot = xfs_da_hashname(".", 1);
-       xfs_dir_hash_dotdot = xfs_da_hashname("..", 2);
+       xfs_dir_hash_dot = xfs_da_hashname((unsigned char *)".", 1);
+       xfs_dir_hash_dotdot = xfs_da_hashname((unsigned char *)"..", 2);
 }
 
 /*
@@ -513,8 +513,9 @@ xfs_dir2_block_getdents(
                /*
                 * If it didn't fit, set the final offset to here & return.
                 */
-               if (filldir(dirent, dep->name, dep->namelen, cook & 0x7fffffff,
-                           be64_to_cpu(dep->inumber), DT_UNKNOWN)) {
+               if (filldir(dirent, (char *)dep->name, dep->namelen,
+                           cook & 0x7fffffff, be64_to_cpu(dep->inumber),
+                           DT_UNKNOWN)) {
                        *offset = cook & 0x7fffffff;
                        xfs_da_brelse(NULL, bp);
                        return 0;
index 29f484c11b3ac11f5f9f89d7e54cf5e332aab2f6..e2d89854ec9ec4649f2016d3c2592832bb5ee403 100644 (file)
@@ -1081,7 +1081,7 @@ xfs_dir2_leaf_getdents(
                dep = (xfs_dir2_data_entry_t *)ptr;
                length = xfs_dir2_data_entsize(dep->namelen);
 
-               if (filldir(dirent, dep->name, dep->namelen,
+               if (filldir(dirent, (char *)dep->name, dep->namelen,
                            xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff,
                            be64_to_cpu(dep->inumber), DT_UNKNOWN))
                        break;
index ce6e355199b5fa4edfd0977480916408e3e4085e..78fc4d9ae7562d02ea2068132ac44a81e9dfa776 100644 (file)
@@ -65,7 +65,7 @@ static int xfs_dir2_node_addname_int(xfs_da_args_t *args,
 /*
  * Log entries from a freespace block.
  */
-void
+STATIC void
 xfs_dir2_free_log_bests(
        xfs_trans_t             *tp,            /* transaction pointer */
        xfs_dabuf_t             *bp,            /* freespace buffer */
index dde72db3d695404ece0eb94716c6748336909d9a..82dfe7147195a46b6aaa0fd12f292d1f6beca1c2 100644 (file)
@@ -75,8 +75,6 @@ xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
        return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp));
 }
 
-extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
-                                   int first, int last);
 extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
                                 struct xfs_dabuf *lbp);
 extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
index 9d4f17a69676bfb01d2fe698353ceea501c14deb..c1a5945d463a3d4ff3abd6aca0beb42f535f6988 100644 (file)
@@ -782,7 +782,7 @@ xfs_dir2_sf_getdents(
                }
 
                ino = xfs_dir2_sf_get_inumber(sfp, xfs_dir2_sf_inumberp(sfep));
-               if (filldir(dirent, sfep->name, sfep->namelen,
+               if (filldir(dirent, (char *)sfep->name, sfep->namelen,
                            off & 0x7fffffff, ino, DT_UNKNOWN)) {
                        *offset = off & 0x7fffffff;
                        return 0;
index 05a4bdd4be39a09db4cec3f18e7d9200838ec6b4..6f35ed1b39b9b753a1895b53f1332ce0db185531 100644 (file)
@@ -82,7 +82,7 @@ xfs_efi_item_format(xfs_efi_log_item_t        *efip,
 
        log_vector->i_addr = (xfs_caddr_t)&(efip->efi_format);
        log_vector->i_len = size;
-       XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFI_FORMAT);
+       log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT;
        ASSERT(size >= sizeof(xfs_efi_log_format_t));
 }
 
@@ -406,7 +406,7 @@ xfs_efd_item_format(xfs_efd_log_item_t      *efdp,
 
        log_vector->i_addr = (xfs_caddr_t)&(efdp->efd_format);
        log_vector->i_len = size;
-       XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_EFD_FORMAT);
+       log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT;
        ASSERT(size >= sizeof(xfs_efd_log_format_t));
 }
 
index a631e1451abb992e21d08639e1f9fcfc428b86c4..390850ee6603922651e9ceebfc0f160ce7ff9495 100644 (file)
@@ -140,6 +140,7 @@ _xfs_filestream_pick_ag(
        int             flags,
        xfs_extlen_t    minlen)
 {
+       int             streams, max_streams;
        int             err, trylock, nscan;
        xfs_extlen_t    longest, free, minfree, maxfree = 0;
        xfs_agnumber_t  ag, max_ag = NULLAGNUMBER;
@@ -155,15 +156,15 @@ _xfs_filestream_pick_ag(
        trylock = XFS_ALLOC_FLAG_TRYLOCK;
 
        for (nscan = 0; 1; nscan++) {
-
-               TRACE_AG_SCAN(mp, ag, xfs_filestream_peek_ag(mp, ag));
-
-               pag = mp->m_perag + ag;
+               pag = xfs_perag_get(mp, ag);
+               TRACE_AG_SCAN(mp, ag, atomic_read(&pag->pagf_fstrms));
 
                if (!pag->pagf_init) {
                        err = xfs_alloc_pagf_init(mp, NULL, ag, trylock);
-                       if (err && !trylock)
+                       if (err && !trylock) {
+                               xfs_perag_put(pag);
                                return err;
+                       }
                }
 
                /* Might fail sometimes during the 1st pass with trylock set. */
@@ -173,6 +174,7 @@ _xfs_filestream_pick_ag(
                /* Keep track of the AG with the most free blocks. */
                if (pag->pagf_freeblks > maxfree) {
                        maxfree = pag->pagf_freeblks;
+                       max_streams = atomic_read(&pag->pagf_fstrms);
                        max_ag = ag;
                }
 
@@ -195,6 +197,8 @@ _xfs_filestream_pick_ag(
 
                        /* Break out, retaining the reference on the AG. */
                        free = pag->pagf_freeblks;
+                       streams = atomic_read(&pag->pagf_fstrms);
+                       xfs_perag_put(pag);
                        *agp = ag;
                        break;
                }
@@ -202,6 +206,7 @@ _xfs_filestream_pick_ag(
                /* Drop the reference on this AG, it's not usable. */
                xfs_filestream_put_ag(mp, ag);
 next_ag:
+               xfs_perag_put(pag);
                /* Move to the next AG, wrapping to AG 0 if necessary. */
                if (++ag >= mp->m_sb.sb_agcount)
                        ag = 0;
@@ -229,6 +234,7 @@ next_ag:
                if (max_ag != NULLAGNUMBER) {
                        xfs_filestream_get_ag(mp, max_ag);
                        TRACE_AG_PICK1(mp, max_ag, maxfree);
+                       streams = max_streams;
                        free = maxfree;
                        *agp = max_ag;
                        break;
@@ -240,16 +246,14 @@ next_ag:
                return 0;
        }
 
-       TRACE_AG_PICK2(mp, startag, *agp, xfs_filestream_peek_ag(mp, *agp),
-                       free, nscan, flags);
+       TRACE_AG_PICK2(mp, startag, *agp, streams, free, nscan, flags);
 
        return 0;
 }
 
 /*
  * Set the allocation group number for a file or a directory, updating inode
- * references and per-AG references as appropriate.  Must be called with the
- * m_peraglock held in read mode.
+ * references and per-AG references as appropriate.
  */
 static int
 _xfs_filestream_update_ag(
@@ -450,20 +454,6 @@ xfs_filestream_unmount(
        xfs_mru_cache_destroy(mp->m_filestream);
 }
 
-/*
- * If the mount point's m_perag array is going to be reallocated, all
- * outstanding cache entries must be flushed to avoid accessing reference count
- * addresses that have been freed.  The call to xfs_filestream_flush() must be
- * made inside the block that holds the m_peraglock in write mode to do the
- * reallocation.
- */
-void
-xfs_filestream_flush(
-       xfs_mount_t     *mp)
-{
-       xfs_mru_cache_flush(mp->m_filestream);
-}
-
 /*
  * Return the AG of the filestream the file or directory belongs to, or
  * NULLAGNUMBER otherwise.
@@ -526,7 +516,6 @@ xfs_filestream_associate(
 
        mp = pip->i_mount;
        cache = mp->m_filestream;
-       down_read(&mp->m_peraglock);
 
        /*
         * We have a problem, Houston.
@@ -543,10 +532,8 @@ xfs_filestream_associate(
         *
         * So, if we can't get the iolock without sleeping then just give up
         */
-       if (!xfs_ilock_nowait(pip, XFS_IOLOCK_EXCL)) {
-               up_read(&mp->m_peraglock);
+       if (!xfs_ilock_nowait(pip, XFS_IOLOCK_EXCL))
                return 1;
-       }
 
        /* If the parent directory is already in the cache, use its AG. */
        item = xfs_mru_cache_lookup(cache, pip->i_ino);
@@ -601,7 +588,6 @@ exit_did_pick:
 
 exit:
        xfs_iunlock(pip, XFS_IOLOCK_EXCL);
-       up_read(&mp->m_peraglock);
        return -err;
 }
 
index 4aba67c5f64f733f896872520aa71484ed2823e5..260f757bbc5dd0dcea68e6fc6f0200cf2548e930 100644 (file)
@@ -79,12 +79,21 @@ extern ktrace_t *xfs_filestreams_trace_buf;
  * the cache that reference per-ag array elements that have since been
  * reallocated.
  */
+/*
+ * xfs_filestream_peek_ag is only used in tracing code
+ */
 static inline int
 xfs_filestream_peek_ag(
        xfs_mount_t     *mp,
        xfs_agnumber_t  agno)
 {
-       return atomic_read(&mp->m_perag[agno].pagf_fstrms);
+       struct xfs_perag *pag;
+       int             ret;
+
+       pag = xfs_perag_get(mp, agno);
+       ret = atomic_read(&pag->pagf_fstrms);
+       xfs_perag_put(pag);
+       return ret;
 }
 
 static inline int
@@ -92,7 +101,13 @@ xfs_filestream_get_ag(
        xfs_mount_t     *mp,
        xfs_agnumber_t  agno)
 {
-       return atomic_inc_return(&mp->m_perag[agno].pagf_fstrms);
+       struct xfs_perag *pag;
+       int             ret;
+
+       pag = xfs_perag_get(mp, agno);
+       ret = atomic_inc_return(&pag->pagf_fstrms);
+       xfs_perag_put(pag);
+       return ret;
 }
 
 static inline int
@@ -100,7 +115,13 @@ xfs_filestream_put_ag(
        xfs_mount_t     *mp,
        xfs_agnumber_t  agno)
 {
-       return atomic_dec_return(&mp->m_perag[agno].pagf_fstrms);
+       struct xfs_perag *pag;
+       int             ret;
+
+       pag = xfs_perag_get(mp, agno);
+       ret = atomic_dec_return(&pag->pagf_fstrms);
+       xfs_perag_put(pag);
+       return ret;
 }
 
 /* allocation selection flags */
@@ -114,7 +135,6 @@ int xfs_filestream_init(void);
 void xfs_filestream_uninit(void);
 int xfs_filestream_mount(struct xfs_mount *mp);
 void xfs_filestream_unmount(struct xfs_mount *mp);
-void xfs_filestream_flush(struct xfs_mount *mp);
 xfs_agnumber_t xfs_filestream_lookup_ag(struct xfs_inode *ip);
 int xfs_filestream_associate(struct xfs_inode *dip, struct xfs_inode *ip);
 void xfs_filestream_deassociate(struct xfs_inode *ip);
index a13919a6a364124d45ea209f77f863d1e268144c..37a6f62c57b6f89cd93ca38ed6099c5952367401 100644 (file)
@@ -167,27 +167,14 @@ xfs_growfs_data_private(
        }
        new = nb - mp->m_sb.sb_dblocks;
        oagcount = mp->m_sb.sb_agcount;
-       if (nagcount > oagcount) {
-               void *new_perag, *old_perag;
-
-               xfs_filestream_flush(mp);
-
-               new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount,
-                                       KM_MAYFAIL);
-               if (!new_perag)
-                       return XFS_ERROR(ENOMEM);
-
-               down_write(&mp->m_peraglock);
-               memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount);
-               old_perag = mp->m_perag;
-               mp->m_perag = new_perag;
-
-               mp->m_flags |= XFS_MOUNT_32BITINODES;
-               nagimax = xfs_initialize_perag(mp, nagcount);
-               up_write(&mp->m_peraglock);
 
-               kmem_free(old_perag);
+       /* allocate the new per-ag structures */
+       if (nagcount > oagcount) {
+               error = xfs_initialize_perag(mp, nagcount, &nagimax);
+               if (error)
+                       return error;
        }
+
        tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
        tp->t_flags |= XFS_TRANS_RESERVE;
        if ((error = xfs_trans_reserve(tp, XFS_GROWFS_SPACE_RES(mp),
@@ -196,6 +183,11 @@ xfs_growfs_data_private(
                return error;
        }
 
+       /*
+        * Write new AG headers to disk. Non-transactional, but written
+        * synchronously so they are completed prior to the growfs transaction
+        * being logged.
+        */
        nfree = 0;
        for (agno = nagcount - 1; agno >= oagcount; agno--, new -= agsize) {
                /*
@@ -359,6 +351,12 @@ xfs_growfs_data_private(
                        goto error0;
                }
        }
+
+       /*
+        * Update changed superblock fields transactionally. These are not
+        * seen by the rest of the world until the transaction commit applies
+        * them atomically to the superblock.
+        */
        if (nagcount > oagcount)
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_AGCOUNT, nagcount - oagcount);
        if (nb > mp->m_sb.sb_dblocks)
@@ -369,9 +367,9 @@ xfs_growfs_data_private(
        if (dpct)
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_IMAXPCT, dpct);
        error = xfs_trans_commit(tp, 0);
-       if (error) {
+       if (error)
                return error;
-       }
+
        /* New allocation groups fully initialized, so update mount struct */
        if (nagimax)
                mp->m_maxagi = nagimax;
@@ -381,6 +379,8 @@ xfs_growfs_data_private(
                mp->m_maxicount = icount << mp->m_sb.sb_inopblog;
        } else
                mp->m_maxicount = 0;
+
+       /* update secondary superblocks. */
        for (agno = 1; agno < nagcount; agno++) {
                error = xfs_read_buf(mp, mp->m_ddev_targp,
                                  XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
index cb907ba69c4c1806f27121c7904b8040928c0f8f..9d884c127bb980c9c24b934113be222a4fc1093d 100644 (file)
@@ -205,7 +205,7 @@ xfs_ialloc_inode_init(
                d = XFS_AGB_TO_DADDR(mp, agno, agbno + (j * blks_per_cluster));
                fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
                                         mp->m_bsize * blks_per_cluster,
-                                        XFS_BUF_LOCK);
+                                        XBF_LOCK);
                ASSERT(fbuf);
                ASSERT(!XFS_BUF_GETERROR(fbuf));
 
@@ -253,6 +253,7 @@ xfs_ialloc_ag_alloc(
        xfs_agino_t     thisino;        /* current inode number, for loop */
        int             isaligned = 0;  /* inode allocation at stripe unit */
                                        /* boundary */
+       struct xfs_perag *pag;
 
        args.tp = tp;
        args.mp = tp->t_mountp;
@@ -382,9 +383,9 @@ xfs_ialloc_ag_alloc(
        newino = XFS_OFFBNO_TO_AGINO(args.mp, args.agbno, 0);
        be32_add_cpu(&agi->agi_count, newlen);
        be32_add_cpu(&agi->agi_freecount, newlen);
-       down_read(&args.mp->m_peraglock);
-       args.mp->m_perag[agno].pagi_freecount += newlen;
-       up_read(&args.mp->m_peraglock);
+       pag = xfs_perag_get(args.mp, agno);
+       pag->pagi_freecount += newlen;
+       xfs_perag_put(pag);
        agi->agi_newino = cpu_to_be32(newino);
 
        /*
@@ -486,9 +487,8 @@ xfs_ialloc_ag_select(
         */
        agno = pagno;
        flags = XFS_ALLOC_FLAG_TRYLOCK;
-       down_read(&mp->m_peraglock);
        for (;;) {
-               pag = &mp->m_perag[agno];
+               pag = xfs_perag_get(mp, agno);
                if (!pag->pagi_init) {
                        if (xfs_ialloc_read_agi(mp, tp, agno, &agbp)) {
                                agbp = NULL;
@@ -527,7 +527,7 @@ xfs_ialloc_ag_select(
                                        agbp = NULL;
                                        goto nextag;
                                }
-                               up_read(&mp->m_peraglock);
+                               xfs_perag_put(pag);
                                return agbp;
                        }
                }
@@ -535,22 +535,19 @@ unlock_nextag:
                if (agbp)
                        xfs_trans_brelse(tp, agbp);
 nextag:
+               xfs_perag_put(pag);
                /*
                 * No point in iterating over the rest, if we're shutting
                 * down.
                 */
-               if (XFS_FORCED_SHUTDOWN(mp)) {
-                       up_read(&mp->m_peraglock);
+               if (XFS_FORCED_SHUTDOWN(mp))
                        return NULL;
-               }
                agno++;
                if (agno >= agcount)
                        agno = 0;
                if (agno == pagno) {
-                       if (flags == 0) {
-                               up_read(&mp->m_peraglock);
+                       if (flags == 0)
                                return NULL;
-                       }
                        flags = 0;
                }
        }
@@ -672,6 +669,7 @@ xfs_dialloc(
        xfs_agnumber_t  tagno;          /* testing allocation group number */
        xfs_btree_cur_t *tcur;          /* temp cursor */
        xfs_inobt_rec_incore_t trec;    /* temp inode allocation record */
+       struct xfs_perag *pag;
 
 
        if (*IO_agbp == NULL) {
@@ -771,13 +769,13 @@ nextag:
                        *inop = NULLFSINO;
                        return noroom ? ENOSPC : 0;
                }
-               down_read(&mp->m_peraglock);
-               if (mp->m_perag[tagno].pagi_inodeok == 0) {
-                       up_read(&mp->m_peraglock);
+               pag = xfs_perag_get(mp, tagno);
+               if (pag->pagi_inodeok == 0) {
+                       xfs_perag_put(pag);
                        goto nextag;
                }
                error = xfs_ialloc_read_agi(mp, tp, tagno, &agbp);
-               up_read(&mp->m_peraglock);
+               xfs_perag_put(pag);
                if (error)
                        goto nextag;
                agi = XFS_BUF_TO_AGI(agbp);
@@ -790,6 +788,7 @@ nextag:
         */
        agno = tagno;
        *IO_agbp = NULL;
+       pag = xfs_perag_get(mp, agno);
 
  restart_pagno:
        cur = xfs_inobt_init_cursor(mp, tp, agbp, be32_to_cpu(agi->agi_seqno));
@@ -808,7 +807,6 @@ nextag:
         * If in the same AG as the parent, try to get near the parent.
         */
        if (pagno == agno) {
-               xfs_perag_t     *pag = &mp->m_perag[agno];
                int             doneleft;       /* done, to the left */
                int             doneright;      /* done, to the right */
                int             searchdistance = 10;
@@ -1006,9 +1004,7 @@ alloc_inode:
                goto error0;
        be32_add_cpu(&agi->agi_freecount, -1);
        xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
-       down_read(&mp->m_peraglock);
-       mp->m_perag[tagno].pagi_freecount--;
-       up_read(&mp->m_peraglock);
+       pag->pagi_freecount--;
 
        error = xfs_check_agi_freecount(cur, agi);
        if (error)
@@ -1016,12 +1012,14 @@ alloc_inode:
 
        xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
        xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -1);
+       xfs_perag_put(pag);
        *inop = ino;
        return 0;
 error1:
        xfs_btree_del_cursor(tcur, XFS_BTREE_ERROR);
 error0:
        xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
+       xfs_perag_put(pag);
        return error;
 }
 
@@ -1052,6 +1050,7 @@ xfs_difree(
        xfs_mount_t     *mp;    /* mount structure for filesystem */
        int             off;    /* offset of inode in inode chunk */
        xfs_inobt_rec_incore_t rec;     /* btree record */
+       struct xfs_perag *pag;
 
        mp = tp->t_mountp;
 
@@ -1088,9 +1087,7 @@ xfs_difree(
        /*
         * Get the allocation group header.
         */
-       down_read(&mp->m_peraglock);
        error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
-       up_read(&mp->m_peraglock);
        if (error) {
                cmn_err(CE_WARN,
                        "xfs_difree: xfs_ialloc_read_agi() returned an error %d on %s.  Returning error.",
@@ -1157,9 +1154,9 @@ xfs_difree(
                be32_add_cpu(&agi->agi_count, -ilen);
                be32_add_cpu(&agi->agi_freecount, -(ilen - 1));
                xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
-               down_read(&mp->m_peraglock);
-               mp->m_perag[agno].pagi_freecount -= ilen - 1;
-               up_read(&mp->m_peraglock);
+               pag = xfs_perag_get(mp, agno);
+               pag->pagi_freecount -= ilen - 1;
+               xfs_perag_put(pag);
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_ICOUNT, -ilen);
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -(ilen - 1));
 
@@ -1188,9 +1185,9 @@ xfs_difree(
                 */
                be32_add_cpu(&agi->agi_freecount, 1);
                xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
-               down_read(&mp->m_peraglock);
-               mp->m_perag[agno].pagi_freecount++;
-               up_read(&mp->m_peraglock);
+               pag = xfs_perag_get(mp, agno);
+               pag->pagi_freecount++;
+               xfs_perag_put(pag);
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, 1);
        }
 
@@ -1312,9 +1309,7 @@ xfs_imap(
                xfs_buf_t       *agbp;  /* agi buffer */
                int             i;      /* temp state */
 
-               down_read(&mp->m_peraglock);
                error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
-               up_read(&mp->m_peraglock);
                if (error) {
                        xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
                                        "xfs_ialloc_read_agi() returned "
@@ -1379,7 +1374,6 @@ xfs_imap(
                        XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
                return XFS_ERROR(EINVAL);
        }
-
        return 0;
 }
 
@@ -1523,8 +1517,7 @@ xfs_ialloc_read_agi(
                return error;
 
        agi = XFS_BUF_TO_AGI(*bpp);
-       pag = &mp->m_perag[agno];
-
+       pag = xfs_perag_get(mp, agno);
        if (!pag->pagi_init) {
                pag->pagi_freecount = be32_to_cpu(agi->agi_freecount);
                pag->pagi_count = be32_to_cpu(agi->agi_count);
@@ -1537,6 +1530,7 @@ xfs_ialloc_read_agi(
         */
        ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) ||
                XFS_FORCED_SHUTDOWN(mp));
+       xfs_perag_put(pag);
        return 0;
 }
 
index fa402a6bbbcf3272ee002700aa85ca118cbbc86e..e281eb4a1c4978791b511acf94ac07cb86efca1c 100644 (file)
@@ -73,7 +73,6 @@ xfs_inode_alloc(
        ASSERT(atomic_read(&ip->i_pincount) == 0);
        ASSERT(!spin_is_locked(&ip->i_flags_lock));
        ASSERT(completion_done(&ip->i_flush));
-       ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock));
 
        mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
 
@@ -375,7 +374,7 @@ xfs_iget(
                return EINVAL;
 
        /* get the perag structure and ensure that it's inode capable */
-       pag = xfs_get_perag(mp, ino);
+       pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino));
        if (!pag->pagi_inodeok)
                return EINVAL;
        ASSERT(pag->pag_ici_init);
@@ -399,7 +398,7 @@ again:
                if (error)
                        goto out_error_or_again;
        }
-       xfs_put_perag(mp, pag);
+       xfs_perag_put(pag);
 
        *ipp = ip;
 
@@ -418,7 +417,7 @@ out_error_or_again:
                delay(1);
                goto again;
        }
-       xfs_put_perag(mp, pag);
+       xfs_perag_put(pag);
        return error;
 }
 
@@ -489,12 +488,12 @@ xfs_ireclaim(
         * added to the tree assert that it's been there before to catch
         * problems with the inode life time early on.
         */
-       pag = xfs_get_perag(mp, ip->i_ino);
+       pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
        write_lock(&pag->pag_ici_lock);
        if (!radix_tree_delete(&pag->pag_ici_root, agino))
                ASSERT(0);
        write_unlock(&pag->pag_ici_lock);
-       xfs_put_perag(mp, pag);
+       xfs_perag_put(pag);
 
        /*
         * Here we do an (almost) spurious inode lock in order to coordinate
index 391d36b0e68c2a33b769dd66540148e94e7da3f2..fa31360046d48a1c07d999da3157740bf4729999 100644 (file)
@@ -151,7 +151,7 @@ xfs_imap_to_bp(
                                "an error %d on %s.  Returning error.",
                                error, mp->m_fsname);
                } else {
-                       ASSERT(buf_flags & XFS_BUF_TRYLOCK);
+                       ASSERT(buf_flags & XBF_TRYLOCK);
                }
                return error;
        }
@@ -239,7 +239,7 @@ xfs_inotobp(
        if (error)
                return error;
 
-       error = xfs_imap_to_bp(mp, tp, &imap, &bp, XFS_BUF_LOCK, imap_flags);
+       error = xfs_imap_to_bp(mp, tp, &imap, &bp, XBF_LOCK, imap_flags);
        if (error)
                return error;
 
@@ -285,7 +285,7 @@ xfs_itobp(
                return error;
 
        if (!bp) {
-               ASSERT(buf_flags & XFS_BUF_TRYLOCK);
+               ASSERT(buf_flags & XBF_TRYLOCK);
                ASSERT(tp == NULL);
                *bpp = NULL;
                return EAGAIN;
@@ -807,7 +807,7 @@ xfs_iread(
         * Get pointers to the on-disk inode and the buffer containing it.
         */
        error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp,
-                              XFS_BUF_LOCK, iget_flags);
+                              XBF_LOCK, iget_flags);
        if (error)
                return error;
        dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
@@ -1751,7 +1751,7 @@ xfs_iunlink(
                 * Here we put the head pointer into our next pointer,
                 * and then we fall through to point the head at us.
                 */
-               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XFS_BUF_LOCK);
+               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XBF_LOCK);
                if (error)
                        return error;
 
@@ -1833,7 +1833,7 @@ xfs_iunlink_remove(
                 * of dealing with the buffer when there is no need to
                 * change it.
                 */
-               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XFS_BUF_LOCK);
+               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XBF_LOCK);
                if (error) {
                        cmn_err(CE_WARN,
                                "xfs_iunlink_remove: xfs_itobp()  returned an error %d on %s.  Returning error.",
@@ -1895,7 +1895,7 @@ xfs_iunlink_remove(
                 * Now last_ibp points to the buffer previous to us on
                 * the unlinked list.  Pull us from the list.
                 */
-               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XFS_BUF_LOCK);
+               error = xfs_itobp(mp, tp, ip, &dip, &ibp, XBF_LOCK);
                if (error) {
                        cmn_err(CE_WARN,
                                "xfs_iunlink_remove: xfs_itobp()  returned an error %d on %s.  Returning error.",
@@ -1946,8 +1946,9 @@ xfs_ifree_cluster(
        xfs_inode_t             *ip, **ip_found;
        xfs_inode_log_item_t    *iip;
        xfs_log_item_t          *lip;
-       xfs_perag_t             *pag = xfs_get_perag(mp, inum);
+       struct xfs_perag        *pag;
 
+       pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum));
        if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
                blks_per_cluster = 1;
                ninodes = mp->m_sb.sb_inopblock;
@@ -2039,7 +2040,7 @@ xfs_ifree_cluster(
 
                bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, 
                                        mp->m_bsize * blks_per_cluster,
-                                       XFS_BUF_LOCK);
+                                       XBF_LOCK);
 
                pre_flushed = 0;
                lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
@@ -2088,7 +2089,7 @@ xfs_ifree_cluster(
        }
 
        kmem_free(ip_found);
-       xfs_put_perag(mp, pag);
+       xfs_perag_put(pag);
 }
 
 /*
@@ -2150,7 +2151,7 @@ xfs_ifree(
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
-       error = xfs_itobp(ip->i_mount, tp, ip, &dip, &ibp, XFS_BUF_LOCK);
+       error = xfs_itobp(ip->i_mount, tp, ip, &dip, &ibp, XBF_LOCK);
        if (error)
                return error;
 
@@ -2483,13 +2484,16 @@ __xfs_iunpin_wait(
                return;
 
        /* Give the log a push to start the unpinning I/O */
-       xfs_log_force(ip->i_mount, (iip && iip->ili_last_lsn) ?
-                               iip->ili_last_lsn : 0, XFS_LOG_FORCE);
+       if (iip && iip->ili_last_lsn)
+               xfs_log_force_lsn(ip->i_mount, iip->ili_last_lsn, 0);
+       else
+               xfs_log_force(ip->i_mount, 0);
+
        if (wait)
                wait_event(ip->i_ipin_wait, (atomic_read(&ip->i_pincount) == 0));
 }
 
-static inline void
+void
 xfs_iunpin_wait(
        xfs_inode_t     *ip)
 {
@@ -2675,7 +2679,7 @@ xfs_iflush_cluster(
        xfs_buf_t       *bp)
 {
        xfs_mount_t             *mp = ip->i_mount;
-       xfs_perag_t             *pag = xfs_get_perag(mp, ip->i_ino);
+       struct xfs_perag        *pag;
        unsigned long           first_index, mask;
        unsigned long           inodes_per_cluster;
        int                     ilist_size;
@@ -2686,6 +2690,7 @@ xfs_iflush_cluster(
        int                     bufwasdelwri;
        int                     i;
 
+       pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
        ASSERT(pag->pagi_inodeok);
        ASSERT(pag->pag_ici_init);
 
@@ -2693,7 +2698,7 @@ xfs_iflush_cluster(
        ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *);
        ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS);
        if (!ilist)
-               return 0;
+               goto out_put;
 
        mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1);
        first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask;
@@ -2762,6 +2767,8 @@ xfs_iflush_cluster(
 out_free:
        read_unlock(&pag->pag_ici_lock);
        kmem_free(ilist);
+out_put:
+       xfs_perag_put(pag);
        return 0;
 
 
@@ -2805,6 +2812,7 @@ cluster_corrupt_out:
         */
        xfs_iflush_abort(iq);
        kmem_free(ilist);
+       xfs_perag_put(pag);
        return XFS_ERROR(EFSCORRUPTED);
 }
 
@@ -2827,8 +2835,6 @@ xfs_iflush(
        xfs_dinode_t            *dip;
        xfs_mount_t             *mp;
        int                     error;
-       int                     noblock = (flags == XFS_IFLUSH_ASYNC_NOBLOCK);
-       enum { INT_DELWRI = (1 << 0), INT_ASYNC = (1 << 1) };
 
        XFS_STATS_INC(xs_iflush_count);
 
@@ -2840,19 +2846,6 @@ xfs_iflush(
        iip = ip->i_itemp;
        mp = ip->i_mount;
 
-       /*
-        * If the inode isn't dirty, then just release the inode flush lock and
-        * do nothing. Treat stale inodes the same; we cannot rely on the
-        * backing buffer remaining stale in cache for the remaining life of
-        * the stale inode and so xfs_itobp() below may give us a buffer that
-        * no longer contains inodes below. Doing this stale check here also
-        * avoids forcing the log on pinned, stale inodes.
-        */
-       if (xfs_inode_clean(ip) || xfs_iflags_test(ip, XFS_ISTALE)) {
-               xfs_ifunlock(ip);
-               return 0;
-       }
-
        /*
         * We can't flush the inode until it is unpinned, so wait for it if we
         * are allowed to block.  We know noone new can pin it, because we are
@@ -2864,13 +2857,26 @@ xfs_iflush(
         * in the same cluster are dirty, they will probably write the inode
         * out for us if they occur after the log force completes.
         */
-       if (noblock && xfs_ipincount(ip)) {
+       if (!(flags & SYNC_WAIT) && xfs_ipincount(ip)) {
                xfs_iunpin_nowait(ip);
                xfs_ifunlock(ip);
                return EAGAIN;
        }
        xfs_iunpin_wait(ip);
 
+       /*
+        * For stale inodes we cannot rely on the backing buffer remaining
+        * stale in cache for the remaining life of the stale inode and so
+        * xfs_itobp() below may give us a buffer that no longer contains
+        * inodes below. We have to check this after ensuring the inode is
+        * unpinned so that it is safe to reclaim the stale inode after the
+        * flush call.
+        */
+       if (xfs_iflags_test(ip, XFS_ISTALE)) {
+               xfs_ifunlock(ip);
+               return 0;
+       }
+
        /*
         * This may have been unpinned because the filesystem is shutting
         * down forcibly. If that's the case we must not write this inode
@@ -2884,61 +2890,11 @@ xfs_iflush(
                return XFS_ERROR(EIO);
        }
 
-       /*
-        * Decide how buffer will be flushed out.  This is done before
-        * the call to xfs_iflush_int because this field is zeroed by it.
-        */
-       if (iip != NULL && iip->ili_format.ilf_fields != 0) {
-               /*
-                * Flush out the inode buffer according to the directions
-                * of the caller.  In the cases where the caller has given
-                * us a choice choose the non-delwri case.  This is because
-                * the inode is in the AIL and we need to get it out soon.
-                */
-               switch (flags) {
-               case XFS_IFLUSH_SYNC:
-               case XFS_IFLUSH_DELWRI_ELSE_SYNC:
-                       flags = 0;
-                       break;
-               case XFS_IFLUSH_ASYNC_NOBLOCK:
-               case XFS_IFLUSH_ASYNC:
-               case XFS_IFLUSH_DELWRI_ELSE_ASYNC:
-                       flags = INT_ASYNC;
-                       break;
-               case XFS_IFLUSH_DELWRI:
-                       flags = INT_DELWRI;
-                       break;
-               default:
-                       ASSERT(0);
-                       flags = 0;
-                       break;
-               }
-       } else {
-               switch (flags) {
-               case XFS_IFLUSH_DELWRI_ELSE_SYNC:
-               case XFS_IFLUSH_DELWRI_ELSE_ASYNC:
-               case XFS_IFLUSH_DELWRI:
-                       flags = INT_DELWRI;
-                       break;
-               case XFS_IFLUSH_ASYNC_NOBLOCK:
-               case XFS_IFLUSH_ASYNC:
-                       flags = INT_ASYNC;
-                       break;
-               case XFS_IFLUSH_SYNC:
-                       flags = 0;
-                       break;
-               default:
-                       ASSERT(0);
-                       flags = 0;
-                       break;
-               }
-       }
-
        /*
         * Get the buffer containing the on-disk inode.
         */
        error = xfs_itobp(mp, NULL, ip, &dip, &bp,
-                               noblock ? XFS_BUF_TRYLOCK : XFS_BUF_LOCK);
+                               (flags & SYNC_WAIT) ? XBF_LOCK : XBF_TRYLOCK);
        if (error || !bp) {
                xfs_ifunlock(ip);
                return error;
@@ -2956,7 +2912,7 @@ xfs_iflush(
         * get stuck waiting in the write for too long.
         */
        if (XFS_BUF_ISPINNED(bp))
-               xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
+               xfs_log_force(mp, 0);
 
        /*
         * inode clustering:
@@ -2966,13 +2922,10 @@ xfs_iflush(
        if (error)
                goto cluster_corrupt_out;
 
-       if (flags & INT_DELWRI) {
-               xfs_bdwrite(mp, bp);
-       } else if (flags & INT_ASYNC) {
-               error = xfs_bawrite(mp, bp);
-       } else {
+       if (flags & SYNC_WAIT)
                error = xfs_bwrite(mp, bp);
-       }
+       else
+               xfs_bdwrite(mp, bp);
        return error;
 
 corrupt_out:
@@ -3007,16 +2960,6 @@ xfs_iflush_int(
        iip = ip->i_itemp;
        mp = ip->i_mount;
 
-
-       /*
-        * If the inode isn't dirty, then just release the inode
-        * flush lock and do nothing.
-        */
-       if (xfs_inode_clean(ip)) {
-               xfs_ifunlock(ip);
-               return 0;
-       }
-
        /* set *dip = inode's place in the buffer */
        dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
 
index ec1f28c4fc4f695753c41d5e3ed8c678d3e9bb0b..6c912b02759603ddab355edf6afe4c9dd0269796 100644 (file)
@@ -419,16 +419,6 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
 #define XFS_IOLOCK_DEP(flags)  (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLOCK_SHIFT)
 #define XFS_ILOCK_DEP(flags)   (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT)
 
-/*
- * Flags for xfs_iflush()
- */
-#define        XFS_IFLUSH_DELWRI_ELSE_SYNC     1
-#define        XFS_IFLUSH_DELWRI_ELSE_ASYNC    2
-#define        XFS_IFLUSH_SYNC                 3
-#define        XFS_IFLUSH_ASYNC                4
-#define        XFS_IFLUSH_DELWRI               5
-#define        XFS_IFLUSH_ASYNC_NOBLOCK        6
-
 /*
  * Flags for xfs_itruncate_start().
  */
@@ -483,6 +473,7 @@ int         xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
 void           xfs_iext_realloc(xfs_inode_t *, int, int);
 void           xfs_ipin(xfs_inode_t *);
 void           xfs_iunpin(xfs_inode_t *);
+void           xfs_iunpin_wait(xfs_inode_t *);
 int            xfs_iflush(xfs_inode_t *, uint);
 void           xfs_ichgtime(xfs_inode_t *, int);
 void           xfs_lock_inodes(xfs_inode_t **, int, uint);
index f38855d21ea5a87cd8aa83304f9b8644f2cbfe6a..d4dc063111f8f612d55413292cc1b3f90ee386a0 100644 (file)
@@ -228,7 +228,7 @@ xfs_inode_item_format(
 
        vecp->i_addr = (xfs_caddr_t)&iip->ili_format;
        vecp->i_len  = sizeof(xfs_inode_log_format_t);
-       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IFORMAT);
+       vecp->i_type = XLOG_REG_TYPE_IFORMAT;
        vecp++;
        nvecs        = 1;
 
@@ -279,7 +279,7 @@ xfs_inode_item_format(
 
        vecp->i_addr = (xfs_caddr_t)&ip->i_d;
        vecp->i_len  = sizeof(struct xfs_icdinode);
-       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ICORE);
+       vecp->i_type = XLOG_REG_TYPE_ICORE;
        vecp++;
        nvecs++;
        iip->ili_format.ilf_fields |= XFS_ILOG_CORE;
@@ -336,7 +336,7 @@ xfs_inode_item_format(
                                vecp->i_addr =
                                        (char *)(ip->i_df.if_u1.if_extents);
                                vecp->i_len = ip->i_df.if_bytes;
-                               XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
+                               vecp->i_type = XLOG_REG_TYPE_IEXT;
                        } else
 #endif
                        {
@@ -355,7 +355,7 @@ xfs_inode_item_format(
                                vecp->i_addr = (xfs_caddr_t)ext_buffer;
                                vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
                                                XFS_DATA_FORK);
-                               XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
+                               vecp->i_type = XLOG_REG_TYPE_IEXT;
                        }
                        ASSERT(vecp->i_len <= ip->i_df.if_bytes);
                        iip->ili_format.ilf_dsize = vecp->i_len;
@@ -373,7 +373,7 @@ xfs_inode_item_format(
                        ASSERT(ip->i_df.if_broot != NULL);
                        vecp->i_addr = (xfs_caddr_t)ip->i_df.if_broot;
                        vecp->i_len = ip->i_df.if_broot_bytes;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IBROOT);
+                       vecp->i_type = XLOG_REG_TYPE_IBROOT;
                        vecp++;
                        nvecs++;
                        iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes;
@@ -399,7 +399,7 @@ xfs_inode_item_format(
                        ASSERT((ip->i_df.if_real_bytes == 0) ||
                               (ip->i_df.if_real_bytes == data_bytes));
                        vecp->i_len = (int)data_bytes;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ILOCAL);
+                       vecp->i_type = XLOG_REG_TYPE_ILOCAL;
                        vecp++;
                        nvecs++;
                        iip->ili_format.ilf_dsize = (unsigned)data_bytes;
@@ -477,7 +477,7 @@ xfs_inode_item_format(
                        vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
                                        XFS_ATTR_FORK);
 #endif
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_EXT);
+                       vecp->i_type = XLOG_REG_TYPE_IATTR_EXT;
                        iip->ili_format.ilf_asize = vecp->i_len;
                        vecp++;
                        nvecs++;
@@ -492,7 +492,7 @@ xfs_inode_item_format(
                        ASSERT(ip->i_afp->if_broot != NULL);
                        vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_broot;
                        vecp->i_len = ip->i_afp->if_broot_bytes;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_BROOT);
+                       vecp->i_type = XLOG_REG_TYPE_IATTR_BROOT;
                        vecp++;
                        nvecs++;
                        iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes;
@@ -516,7 +516,7 @@ xfs_inode_item_format(
                        ASSERT((ip->i_afp->if_real_bytes == 0) ||
                               (ip->i_afp->if_real_bytes == data_bytes));
                        vecp->i_len = (int)data_bytes;
-                       XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_LOCAL);
+                       vecp->i_type = XLOG_REG_TYPE_IATTR_LOCAL;
                        vecp++;
                        nvecs++;
                        iip->ili_format.ilf_asize = (unsigned)data_bytes;
@@ -602,33 +602,20 @@ xfs_inode_item_trylock(
 
        if (!xfs_iflock_nowait(ip)) {
                /*
-                * If someone else isn't already trying to push the inode
-                * buffer, we get to do it.
+                * inode has already been flushed to the backing buffer,
+                * leave it locked in shared mode, pushbuf routine will
+                * unlock it.
                 */
-               if (iip->ili_pushbuf_flag == 0) {
-                       iip->ili_pushbuf_flag = 1;
-#ifdef DEBUG
-                       iip->ili_push_owner = current_pid();
-#endif
-                       /*
-                        * Inode is left locked in shared mode.
-                        * Pushbuf routine gets to unlock it.
-                        */
-                       return XFS_ITEM_PUSHBUF;
-               } else {
-                       /*
-                        * We hold the AIL lock, so we must specify the
-                        * NONOTIFY flag so that we won't double trip.
-                        */
-                       xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
-                       return XFS_ITEM_FLUSHING;
-               }
-               /* NOTREACHED */
+               return XFS_ITEM_PUSHBUF;
        }
 
        /* Stale items should force out the iclog */
        if (ip->i_flags & XFS_ISTALE) {
                xfs_ifunlock(ip);
+               /*
+                * we hold the AIL lock - notify the unlock routine of this
+                * so it doesn't try to get the lock again.
+                */
                xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
                return XFS_ITEM_PINNED;
        }
@@ -746,11 +733,8 @@ xfs_inode_item_committed(
  * This gets called by xfs_trans_push_ail(), when IOP_TRYLOCK
  * failed to get the inode flush lock but did get the inode locked SHARED.
  * Here we're trying to see if the inode buffer is incore, and if so whether it's
- * marked delayed write. If that's the case, we'll initiate a bawrite on that
- * buffer to expedite the process.
- *
- * We aren't holding the AIL lock (or the flush lock) when this gets called,
- * so it is inherently race-y.
+ * marked delayed write. If that's the case, we'll promote it and that will
+ * allow the caller to write the buffer by triggering the xfsbufd to run.
  */
 STATIC void
 xfs_inode_item_pushbuf(
@@ -759,82 +743,30 @@ xfs_inode_item_pushbuf(
        xfs_inode_t     *ip;
        xfs_mount_t     *mp;
        xfs_buf_t       *bp;
-       uint            dopush;
 
        ip = iip->ili_inode;
-
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
 
-       /*
-        * The ili_pushbuf_flag keeps others from
-        * trying to duplicate our effort.
-        */
-       ASSERT(iip->ili_pushbuf_flag != 0);
-       ASSERT(iip->ili_push_owner == current_pid());
-
        /*
         * If a flush is not in progress anymore, chances are that the
         * inode was taken off the AIL. So, just get out.
         */
        if (completion_done(&ip->i_flush) ||
            ((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) {
-               iip->ili_pushbuf_flag = 0;
                xfs_iunlock(ip, XFS_ILOCK_SHARED);
                return;
        }
 
        mp = ip->i_mount;
        bp = xfs_incore(mp->m_ddev_targp, iip->ili_format.ilf_blkno,
-                   iip->ili_format.ilf_len, XFS_INCORE_TRYLOCK);
+                   iip->ili_format.ilf_len, XBF_TRYLOCK);
 
-       if (bp != NULL) {
-               if (XFS_BUF_ISDELAYWRITE(bp)) {
-                       /*
-                        * We were racing with iflush because we don't hold
-                        * the AIL lock or the flush lock. However, at this point,
-                        * we have the buffer, and we know that it's dirty.
-                        * So, it's possible that iflush raced with us, and
-                        * this item is already taken off the AIL.
-                        * If not, we can flush it async.
-                        */
-                       dopush = ((iip->ili_item.li_flags & XFS_LI_IN_AIL) &&
-                                 !completion_done(&ip->i_flush));
-                       iip->ili_pushbuf_flag = 0;
-                       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
-                       trace_xfs_inode_item_push(bp, _RET_IP_);
-
-                       if (XFS_BUF_ISPINNED(bp)) {
-                               xfs_log_force(mp, (xfs_lsn_t)0,
-                                             XFS_LOG_FORCE);
-                       }
-                       if (dopush) {
-                               int     error;
-                               error = xfs_bawrite(mp, bp);
-                               if (error)
-                                       xfs_fs_cmn_err(CE_WARN, mp,
-               "xfs_inode_item_pushbuf: pushbuf error %d on iip %p, bp %p",
-                                                       error, iip, bp);
-                       } else {
-                               xfs_buf_relse(bp);
-                       }
-               } else {
-                       iip->ili_pushbuf_flag = 0;
-                       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-                       xfs_buf_relse(bp);
-               }
-               return;
-       }
-       /*
-        * We have to be careful about resetting pushbuf flag too early (above).
-        * Even though in theory we can do it as soon as we have the buflock,
-        * we don't want others to be doing work needlessly. They'll come to
-        * this function thinking that pushing the buffer is their
-        * responsibility only to find that the buffer is still locked by
-        * another doing the same thing
-        */
-       iip->ili_pushbuf_flag = 0;
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
+       if (!bp)
+               return;
+       if (XFS_BUF_ISDELAYWRITE(bp))
+               xfs_buf_delwri_promote(bp);
+       xfs_buf_relse(bp);
        return;
 }
 
@@ -867,10 +799,14 @@ xfs_inode_item_push(
               iip->ili_format.ilf_fields != 0);
 
        /*
-        * Write out the inode.  The completion routine ('iflush_done') will
-        * pull it from the AIL, mark it clean, unlock the flush lock.
+        * Push the inode to it's backing buffer. This will not remove the
+        * inode from the AIL - a further push will be required to trigger a
+        * buffer push. However, this allows all the dirty inodes to be pushed
+        * to the buffer before it is pushed to disk. THe buffer IO completion
+        * will pull th einode from the AIL, mark it clean and unlock the flush
+        * lock.
         */
-       (void) xfs_iflush(ip, XFS_IFLUSH_ASYNC);
+       (void) xfs_iflush(ip, 0);
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
        return;
@@ -934,7 +870,6 @@ xfs_inode_item_init(
        /*
           We have zeroed memory. No need ...
           iip->ili_extents_buf = NULL;
-          iip->ili_pushbuf_flag = 0;
         */
 
        iip->ili_format.ilf_type = XFS_LI_INODE;
index cc8df1ac7783e7407b235f4eeddd8e43f5fb10e6..9a467958ecdd4706e22c5f16faf212b7fda7f3ad 100644 (file)
@@ -144,12 +144,6 @@ typedef struct xfs_inode_log_item {
                                                      data exts */
        struct xfs_bmbt_rec     *ili_aextents_buf; /* array of logged
                                                      attr exts */
-       unsigned int            ili_pushbuf_flag;  /* one bit used in push_ail */
-
-#ifdef DEBUG
-       uint64_t                ili_push_owner;    /* one who sets pushbuf_flag
-                                                     above gets to push the buf */
-#endif
 #ifdef XFS_TRANS_DEBUG
        int                     ili_root_size;
        char                    *ili_orig_root;
index 62efab2f38392e845bf82fc8ba48825f3c016727..3af02314c605b47bf32d07605800bfdcdea6b0ff 100644 (file)
@@ -408,8 +408,10 @@ xfs_bulkstat(
                (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog);
        nimask = ~(nicluster - 1);
        nbcluster = nicluster >> mp->m_sb.sb_inopblog;
-       irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4,
-                                  KM_SLEEP | KM_MAYFAIL | KM_LARGE);
+       irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
+       if (!irbuf)
+               return ENOMEM;
+
        nirbuf = irbsize / sizeof(*irbuf);
 
        /*
@@ -420,9 +422,7 @@ xfs_bulkstat(
        while (XFS_BULKSTAT_UBLEFT(ubleft) && agno < mp->m_sb.sb_agcount) {
                cond_resched();
                bp = NULL;
-               down_read(&mp->m_peraglock);
                error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
-               up_read(&mp->m_peraglock);
                if (error) {
                        /*
                         * Skip this allocation group and go to the next one.
@@ -729,7 +729,7 @@ xfs_bulkstat(
        /*
         * Done, we're either out of filesystem or space to put the data.
         */
-       kmem_free(irbuf);
+       kmem_free_large(irbuf);
        *ubcountp = ubelem;
        /*
         * Found some inodes, return them now and return the error next time.
@@ -849,9 +849,7 @@ xfs_inumbers(
        agbp = NULL;
        while (left > 0 && agno < mp->m_sb.sb_agcount) {
                if (agbp == NULL) {
-                       down_read(&mp->m_peraglock);
                        error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
-                       up_read(&mp->m_peraglock);
                        if (error) {
                                /*
                                 * If we can't read the AGI of this ag,
index 600b5b06aaebb405420524c1c6f50ed17e199ef3..4f16be4b6ee5907295fcba07a2aac778866b68c3 100644 (file)
@@ -50,7 +50,6 @@ kmem_zone_t   *xfs_log_ticket_zone;
          (off) += (bytes);}
 
 /* Local miscellaneous function prototypes */
-STATIC int      xlog_bdstrat_cb(struct xfs_buf *);
 STATIC int      xlog_commit_record(xfs_mount_t *mp, xlog_ticket_t *ticket,
                                    xlog_in_core_t **, xfs_lsn_t *);
 STATIC xlog_t *  xlog_alloc_log(xfs_mount_t    *mp,
@@ -80,11 +79,6 @@ STATIC int  xlog_state_release_iclog(xlog_t          *log,
 STATIC void xlog_state_switch_iclogs(xlog_t            *log,
                                     xlog_in_core_t *iclog,
                                     int                eventual_size);
-STATIC int  xlog_state_sync(xlog_t                     *log,
-                           xfs_lsn_t                   lsn,
-                           uint                        flags,
-                           int                         *log_flushed);
-STATIC int  xlog_state_sync_all(xlog_t *log, uint flags, int *log_flushed);
 STATIC void xlog_state_want_sync(xlog_t        *log, xlog_in_core_t *iclog);
 
 /* local functions to manipulate grant head */
@@ -297,65 +291,6 @@ xfs_log_done(xfs_mount_t   *mp,
        return lsn;
 }      /* xfs_log_done */
 
-
-/*
- * Force the in-core log to disk.  If flags == XFS_LOG_SYNC,
- *     the force is done synchronously.
- *
- * Asynchronous forces are implemented by setting the WANT_SYNC
- * bit in the appropriate in-core log and then returning.
- *
- * Synchronous forces are implemented with a signal variable. All callers
- * to force a given lsn to disk will wait on a the sv attached to the
- * specific in-core log.  When given in-core log finally completes its
- * write to disk, that thread will wake up all threads waiting on the
- * sv.
- */
-int
-_xfs_log_force(
-       xfs_mount_t     *mp,
-       xfs_lsn_t       lsn,
-       uint            flags,
-       int             *log_flushed)
-{
-       xlog_t          *log = mp->m_log;
-       int             dummy;
-
-       if (!log_flushed)
-               log_flushed = &dummy;
-
-       ASSERT(flags & XFS_LOG_FORCE);
-
-       XFS_STATS_INC(xs_log_force);
-
-       if (log->l_flags & XLOG_IO_ERROR)
-               return XFS_ERROR(EIO);
-       if (lsn == 0)
-               return xlog_state_sync_all(log, flags, log_flushed);
-       else
-               return xlog_state_sync(log, lsn, flags, log_flushed);
-}      /* _xfs_log_force */
-
-/*
- * Wrapper for _xfs_log_force(), to be used when caller doesn't care
- * about errors or whether the log was flushed or not. This is the normal
- * interface to use when trying to unpin items or move the log forward.
- */
-void
-xfs_log_force(
-       xfs_mount_t     *mp,
-       xfs_lsn_t       lsn,
-       uint            flags)
-{
-       int     error;
-       error = _xfs_log_force(mp, lsn, flags, NULL);
-       if (error) {
-               xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: "
-                       "error %d returned.", error);
-       }
-}
-
-
 /*
  * Attaches a new iclog I/O completion callback routine during
  * transaction commit.  If the log is in error state, a non-zero
@@ -602,7 +537,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
        if (mp->m_flags & XFS_MOUNT_RDONLY)
                return 0;
 
-       error = _xfs_log_force(mp, 0, XFS_LOG_FORCE|XFS_LOG_SYNC, NULL);
+       error = _xfs_log_force(mp, XFS_LOG_SYNC, NULL);
        ASSERT(error || !(XLOG_FORCED_SHUTDOWN(log)));
 
 #ifdef DEBUG
@@ -618,7 +553,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
        if (! (XLOG_FORCED_SHUTDOWN(log))) {
                reg[0].i_addr = (void*)&magic;
                reg[0].i_len  = sizeof(magic);
-               XLOG_VEC_SET_TYPE(&reg[0], XLOG_REG_TYPE_UNMOUNT);
+               reg[0].i_type = XLOG_REG_TYPE_UNMOUNT;
 
                error = xfs_log_reserve(mp, 600, 1, &tic,
                                        XFS_LOG, 0, XLOG_UNMOUNT_REC_TYPE);
@@ -987,35 +922,6 @@ xlog_iodone(xfs_buf_t *bp)
 
 }      /* xlog_iodone */
 
-/*
- * The bdstrat callback function for log bufs. This gives us a central
- * place to trap bufs in case we get hit by a log I/O error and need to
- * shutdown. Actually, in practice, even when we didn't get a log error,
- * we transition the iclogs to IOERROR state *after* flushing all existing
- * iclogs to disk. This is because we don't want anymore new transactions to be
- * started or completed afterwards.
- */
-STATIC int
-xlog_bdstrat_cb(struct xfs_buf *bp)
-{
-       xlog_in_core_t *iclog;
-
-       iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
-
-       if ((iclog->ic_state & XLOG_STATE_IOERROR) == 0) {
-         /* note for irix bstrat will need  struct bdevsw passed
-          * Fix the following macro if the code ever is merged
-          */
-           XFS_bdstrat(bp);
-               return 0;
-       }
-
-       XFS_BUF_ERROR(bp, EIO);
-       XFS_BUF_STALE(bp);
-       xfs_biodone(bp);
-       return XFS_ERROR(EIO);
-}
-
 /*
  * Return size of each in-core log record buffer.
  *
@@ -1158,7 +1064,6 @@ xlog_alloc_log(xfs_mount_t        *mp,
        if (!bp)
                goto out_free_log;
        XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
-       XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
        XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
        ASSERT(XFS_BUF_ISBUSY(bp));
        ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
@@ -1196,7 +1101,6 @@ xlog_alloc_log(xfs_mount_t        *mp,
                if (!XFS_BUF_CPSEMA(bp))
                        ASSERT(0);
                XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
-               XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
                XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
                iclog->ic_bp = bp;
                iclog->ic_data = bp->b_addr;
@@ -1268,7 +1172,7 @@ xlog_commit_record(xfs_mount_t  *mp,
 
        reg[0].i_addr = NULL;
        reg[0].i_len = 0;
-       XLOG_VEC_SET_TYPE(&reg[0], XLOG_REG_TYPE_COMMIT);
+       reg[0].i_type = XLOG_REG_TYPE_COMMIT;
 
        ASSERT_ALWAYS(iclog);
        if ((error = xlog_write(mp, reg, 1, ticket, commitlsnp,
@@ -1343,6 +1247,37 @@ xlog_grant_push_ail(xfs_mount_t  *mp,
            xfs_trans_ail_push(log->l_ailp, threshold_lsn);
 }      /* xlog_grant_push_ail */
 
+/*
+ * The bdstrat callback function for log bufs. This gives us a central
+ * place to trap bufs in case we get hit by a log I/O error and need to
+ * shutdown. Actually, in practice, even when we didn't get a log error,
+ * we transition the iclogs to IOERROR state *after* flushing all existing
+ * iclogs to disk. This is because we don't want anymore new transactions to be
+ * started or completed afterwards.
+ */
+STATIC int
+xlog_bdstrat(
+       struct xfs_buf          *bp)
+{
+       struct xlog_in_core     *iclog;
+
+       iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
+       if (iclog->ic_state & XLOG_STATE_IOERROR) {
+               XFS_BUF_ERROR(bp, EIO);
+               XFS_BUF_STALE(bp);
+               xfs_biodone(bp);
+               /*
+                * It would seem logical to return EIO here, but we rely on
+                * the log state machine to propagate I/O errors instead of
+                * doing it here.
+                */
+               return 0;
+       }
+
+       bp->b_flags |= _XBF_RUN_QUEUES;
+       xfs_buf_iorequest(bp);
+       return 0;
+}
 
 /*
  * Flush out the in-core log (iclog) to the on-disk log in an asynchronous 
@@ -1462,7 +1397,7 @@ xlog_sync(xlog_t          *log,
         */
        XFS_BUF_WRITE(bp);
 
-       if ((error = XFS_bwrite(bp))) {
+       if ((error = xlog_bdstrat(bp))) {
                xfs_ioerror_alert("xlog_sync", log->l_mp, bp,
                                  XFS_BUF_ADDR(bp));
                return error;
@@ -1502,7 +1437,7 @@ xlog_sync(xlog_t          *log,
                /* account for internal log which doesn't start at block #0 */
                XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart);
                XFS_BUF_WRITE(bp);
-               if ((error = XFS_bwrite(bp))) {
+               if ((error = xlog_bdstrat(bp))) {
                        xfs_ioerror_alert("xlog_sync (split)", log->l_mp,
                                          bp, XFS_BUF_ADDR(bp));
                        return error;
@@ -2854,7 +2789,6 @@ xlog_state_switch_iclogs(xlog_t           *log,
        log->l_iclog = iclog->ic_next;
 }      /* xlog_state_switch_iclogs */
 
-
 /*
  * Write out all data in the in-core log as of this exact moment in time.
  *
@@ -2882,11 +2816,17 @@ xlog_state_switch_iclogs(xlog_t         *log,
  *        b) when we return from flushing out this iclog, it is still
  *             not in the active nor dirty state.
  */
-STATIC int
-xlog_state_sync_all(xlog_t *log, uint flags, int *log_flushed)
+int
+_xfs_log_force(
+       struct xfs_mount        *mp,
+       uint                    flags,
+       int                     *log_flushed)
 {
-       xlog_in_core_t  *iclog;
-       xfs_lsn_t       lsn;
+       struct log              *log = mp->m_log;
+       struct xlog_in_core     *iclog;
+       xfs_lsn_t               lsn;
+
+       XFS_STATS_INC(xs_log_force);
 
        spin_lock(&log->l_icloglock);
 
@@ -2932,7 +2872,9 @@ xlog_state_sync_all(xlog_t *log, uint flags, int *log_flushed)
 
                                if (xlog_state_release_iclog(log, iclog))
                                        return XFS_ERROR(EIO);
-                               *log_flushed = 1;
+
+                               if (log_flushed)
+                                       *log_flushed = 1;
                                spin_lock(&log->l_icloglock);
                                if (be64_to_cpu(iclog->ic_header.h_lsn) == lsn &&
                                    iclog->ic_state != XLOG_STATE_DIRTY)
@@ -2976,19 +2918,37 @@ maybe_sleep:
                 */
                if (iclog->ic_state & XLOG_STATE_IOERROR)
                        return XFS_ERROR(EIO);
-               *log_flushed = 1;
-
+               if (log_flushed)
+                       *log_flushed = 1;
        } else {
 
 no_sleep:
                spin_unlock(&log->l_icloglock);
        }
        return 0;
-}      /* xlog_state_sync_all */
+}
 
+/*
+ * Wrapper for _xfs_log_force(), to be used when caller doesn't care
+ * about errors or whether the log was flushed or not. This is the normal
+ * interface to use when trying to unpin items or move the log forward.
+ */
+void
+xfs_log_force(
+       xfs_mount_t     *mp,
+       uint            flags)
+{
+       int     error;
+
+       error = _xfs_log_force(mp, flags, NULL);
+       if (error) {
+               xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: "
+                       "error %d returned.", error);
+       }
+}
 
 /*
- * Used by code which implements synchronous log forces.
+ * Force the in-core log to disk for a specific LSN.
  *
  * Find in-core log with lsn.
  *     If it is in the DIRTY state, just return.
@@ -2996,109 +2956,142 @@ no_sleep:
  *             state and go to sleep or return.
  *     If it is in any other state, go to sleep or return.
  *
- * If filesystem activity goes to zero, the iclog will get flushed only by
- * bdflush().
+ * Synchronous forces are implemented with a signal variable. All callers
+ * to force a given lsn to disk will wait on a the sv attached to the
+ * specific in-core log.  When given in-core log finally completes its
+ * write to disk, that thread will wake up all threads waiting on the
+ * sv.
  */
-STATIC int
-xlog_state_sync(xlog_t   *log,
-               xfs_lsn_t lsn,
-               uint      flags,
-               int       *log_flushed)
+int
+_xfs_log_force_lsn(
+       struct xfs_mount        *mp,
+       xfs_lsn_t               lsn,
+       uint                    flags,
+       int                     *log_flushed)
 {
-    xlog_in_core_t     *iclog;
-    int                        already_slept = 0;
+       struct log              *log = mp->m_log;
+       struct xlog_in_core     *iclog;
+       int                     already_slept = 0;
 
-try_again:
-    spin_lock(&log->l_icloglock);
-    iclog = log->l_iclog;
+       ASSERT(lsn != 0);
 
-    if (iclog->ic_state & XLOG_STATE_IOERROR) {
-           spin_unlock(&log->l_icloglock);
-           return XFS_ERROR(EIO);
-    }
-
-    do {
-       if (be64_to_cpu(iclog->ic_header.h_lsn) != lsn) {
-               iclog = iclog->ic_next;
-               continue;
-       }
+       XFS_STATS_INC(xs_log_force);
 
-       if (iclog->ic_state == XLOG_STATE_DIRTY) {
+try_again:
+       spin_lock(&log->l_icloglock);
+       iclog = log->l_iclog;
+       if (iclog->ic_state & XLOG_STATE_IOERROR) {
                spin_unlock(&log->l_icloglock);
-               return 0;
+               return XFS_ERROR(EIO);
        }
 
-       if (iclog->ic_state == XLOG_STATE_ACTIVE) {
-               /*
-                * We sleep here if we haven't already slept (e.g.
-                * this is the first time we've looked at the correct
-                * iclog buf) and the buffer before us is going to
-                * be sync'ed. The reason for this is that if we
-                * are doing sync transactions here, by waiting for
-                * the previous I/O to complete, we can allow a few
-                * more transactions into this iclog before we close
-                * it down.
-                *
-                * Otherwise, we mark the buffer WANT_SYNC, and bump
-                * up the refcnt so we can release the log (which drops
-                * the ref count).  The state switch keeps new transaction
-                * commits from using this buffer.  When the current commits
-                * finish writing into the buffer, the refcount will drop to
-                * zero and the buffer will go out then.
-                */
-               if (!already_slept &&
-                   (iclog->ic_prev->ic_state & (XLOG_STATE_WANT_SYNC |
-                                                XLOG_STATE_SYNCING))) {
-                       ASSERT(!(iclog->ic_state & XLOG_STATE_IOERROR));
-                       XFS_STATS_INC(xs_log_force_sleep);
-                       sv_wait(&iclog->ic_prev->ic_write_wait, PSWP,
-                               &log->l_icloglock, s);
-                       *log_flushed = 1;
-                       already_slept = 1;
-                       goto try_again;
-               } else {
+       do {
+               if (be64_to_cpu(iclog->ic_header.h_lsn) != lsn) {
+                       iclog = iclog->ic_next;
+                       continue;
+               }
+
+               if (iclog->ic_state == XLOG_STATE_DIRTY) {
+                       spin_unlock(&log->l_icloglock);
+                       return 0;
+               }
+
+               if (iclog->ic_state == XLOG_STATE_ACTIVE) {
+                       /*
+                        * We sleep here if we haven't already slept (e.g.
+                        * this is the first time we've looked at the correct
+                        * iclog buf) and the buffer before us is going to
+                        * be sync'ed. The reason for this is that if we
+                        * are doing sync transactions here, by waiting for
+                        * the previous I/O to complete, we can allow a few
+                        * more transactions into this iclog before we close
+                        * it down.
+                        *
+                        * Otherwise, we mark the buffer WANT_SYNC, and bump
+                        * up the refcnt so we can release the log (which
+                        * drops the ref count).  The state switch keeps new
+                        * transaction commits from using this buffer.  When
+                        * the current commits finish writing into the buffer,
+                        * the refcount will drop to zero and the buffer will
+                        * go out then.
+                        */
+                       if (!already_slept &&
+                           (iclog->ic_prev->ic_state &
+                            (XLOG_STATE_WANT_SYNC | XLOG_STATE_SYNCING))) {
+                               ASSERT(!(iclog->ic_state & XLOG_STATE_IOERROR));
+
+                               XFS_STATS_INC(xs_log_force_sleep);
+
+                               sv_wait(&iclog->ic_prev->ic_write_wait,
+                                       PSWP, &log->l_icloglock, s);
+                               if (log_flushed)
+                                       *log_flushed = 1;
+                               already_slept = 1;
+                               goto try_again;
+                       }
                        atomic_inc(&iclog->ic_refcnt);
                        xlog_state_switch_iclogs(log, iclog, 0);
                        spin_unlock(&log->l_icloglock);
                        if (xlog_state_release_iclog(log, iclog))
                                return XFS_ERROR(EIO);
-                       *log_flushed = 1;
+                       if (log_flushed)
+                               *log_flushed = 1;
                        spin_lock(&log->l_icloglock);
                }
-       }
 
-       if ((flags & XFS_LOG_SYNC) && /* sleep */
-           !(iclog->ic_state & (XLOG_STATE_ACTIVE | XLOG_STATE_DIRTY))) {
+               if ((flags & XFS_LOG_SYNC) && /* sleep */
+                   !(iclog->ic_state &
+                     (XLOG_STATE_ACTIVE | XLOG_STATE_DIRTY))) {
+                       /*
+                        * Don't wait on completion if we know that we've
+                        * gotten a log write error.
+                        */
+                       if (iclog->ic_state & XLOG_STATE_IOERROR) {
+                               spin_unlock(&log->l_icloglock);
+                               return XFS_ERROR(EIO);
+                       }
+                       XFS_STATS_INC(xs_log_force_sleep);
+                       sv_wait(&iclog->ic_force_wait, PSWP, &log->l_icloglock, s);
+                       /*
+                        * No need to grab the log lock here since we're
+                        * only deciding whether or not to return EIO
+                        * and the memory read should be atomic.
+                        */
+                       if (iclog->ic_state & XLOG_STATE_IOERROR)
+                               return XFS_ERROR(EIO);
 
-               /*
-                * Don't wait on completion if we know that we've
-                * gotten a log write error.
-                */
-               if (iclog->ic_state & XLOG_STATE_IOERROR) {
+                       if (log_flushed)
+                               *log_flushed = 1;
+               } else {                /* just return */
                        spin_unlock(&log->l_icloglock);
-                       return XFS_ERROR(EIO);
                }
-               XFS_STATS_INC(xs_log_force_sleep);
-               sv_wait(&iclog->ic_force_wait, PSWP, &log->l_icloglock, s);
-               /*
-                * No need to grab the log lock here since we're
-                * only deciding whether or not to return EIO
-                * and the memory read should be atomic.
-                */
-               if (iclog->ic_state & XLOG_STATE_IOERROR)
-                       return XFS_ERROR(EIO);
-               *log_flushed = 1;
-       } else {                /* just return */
-               spin_unlock(&log->l_icloglock);
-       }
-       return 0;
 
-    } while (iclog != log->l_iclog);
+               return 0;
+       } while (iclog != log->l_iclog);
 
-    spin_unlock(&log->l_icloglock);
-    return 0;
-}      /* xlog_state_sync */
+       spin_unlock(&log->l_icloglock);
+       return 0;
+}
 
+/*
+ * Wrapper for _xfs_log_force_lsn(), to be used when caller doesn't care
+ * about errors or whether the log was flushed or not. This is the normal
+ * interface to use when trying to unpin items or move the log forward.
+ */
+void
+xfs_log_force_lsn(
+       xfs_mount_t     *mp,
+       xfs_lsn_t       lsn,
+       uint            flags)
+{
+       int     error;
+
+       error = _xfs_log_force_lsn(mp, lsn, flags, NULL);
+       if (error) {
+               xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: "
+                       "error %d returned.", error);
+       }
+}
 
 /*
  * Called when we want to mark the current iclog as being ready to sync to
@@ -3463,7 +3456,6 @@ xfs_log_force_umount(
        xlog_ticket_t   *tic;
        xlog_t          *log;
        int             retval;
-       int             dummy;
 
        log = mp->m_log;
 
@@ -3537,13 +3529,14 @@ xfs_log_force_umount(
        }
        spin_unlock(&log->l_grant_lock);
 
-       if (! (log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
+       if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
                ASSERT(!logerror);
                /*
                 * Force the incore logs to disk before shutting the
                 * log down completely.
                 */
-               xlog_state_sync_all(log, XFS_LOG_FORCE|XFS_LOG_SYNC, &dummy);
+               _xfs_log_force(mp, XFS_LOG_SYNC, NULL);
+
                spin_lock(&log->l_icloglock);
                retval = xlog_state_ioerror(log);
                spin_unlock(&log->l_icloglock);
index d0c9baa50b1adec129a74586558595672577c536..7074be9d13e99113d45f48c469ba7b266b13fe4a 100644 (file)
@@ -70,14 +70,8 @@ static inline xfs_lsn_t      _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
  * Flags to xfs_log_force()
  *
  *     XFS_LOG_SYNC:   Synchronous force in-core log to disk
- *     XFS_LOG_FORCE:  Start in-core log write now.
- *     XFS_LOG_URGE:   Start write within some window of time.
- *
- * Note: Either XFS_LOG_FORCE or XFS_LOG_URGE must be set.
  */
 #define XFS_LOG_SYNC           0x1
-#define XFS_LOG_FORCE          0x2
-#define XFS_LOG_URGE           0x4
 
 #endif /* __KERNEL__ */
 
@@ -110,10 +104,8 @@ static inline xfs_lsn_t    _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
 #define XLOG_REG_TYPE_TRANSHDR         19
 #define XLOG_REG_TYPE_MAX              19
 
-#define XLOG_VEC_SET_TYPE(vecp, t) ((vecp)->i_type = (t))
-
 typedef struct xfs_log_iovec {
-       xfs_caddr_t             i_addr;         /* beginning address of region */
+       xfs_caddr_t     i_addr;         /* beginning address of region */
        int             i_len;          /* length in bytes of region */
        uint            i_type;         /* type of region */
 } xfs_log_iovec_t;
@@ -140,12 +132,17 @@ xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
                       void             **iclog,
                       uint             flags);
 int      _xfs_log_force(struct xfs_mount *mp,
-                        xfs_lsn_t      lsn,
                         uint           flags,
                         int            *log_forced);
 void     xfs_log_force(struct xfs_mount        *mp,
-                       xfs_lsn_t               lsn,
                        uint                    flags);
+int      _xfs_log_force_lsn(struct xfs_mount *mp,
+                            xfs_lsn_t          lsn,
+                            uint               flags,
+                            int                *log_forced);
+void     xfs_log_force_lsn(struct xfs_mount    *mp,
+                           xfs_lsn_t           lsn,
+                           uint                flags);
 int      xfs_log_mount(struct xfs_mount        *mp,
                        struct xfs_buftarg      *log_target,
                        xfs_daddr_t             start_block,
index d55662db7077780fd83619f046dd93693b3aad14..fd02a18facd5d74d704d39bd1a93d3e8da26e6ab 100644 (file)
@@ -443,14 +443,9 @@ typedef struct log {
 
 /* common routines */
 extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
-extern int      xlog_find_tail(xlog_t  *log,
-                               xfs_daddr_t *head_blk,
-                               xfs_daddr_t *tail_blk);
 extern int      xlog_recover(xlog_t *log);
 extern int      xlog_recover_finish(xlog_t *log);
 extern void     xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int);
-extern struct xfs_buf *xlog_get_bp(xlog_t *, int);
-extern void     xlog_put_bp(struct xfs_buf *);
 
 extern kmem_zone_t     *xfs_log_ticket_zone;
 
index 69ac2e5ef20c6197d0ef47225ddeda77897e1743..22e6efdc17eae253dbe6517c1c02b4ddc7eee825 100644 (file)
@@ -50,8 +50,6 @@
 
 STATIC int     xlog_find_zeroed(xlog_t *, xfs_daddr_t *);
 STATIC int     xlog_clear_stale_blocks(xlog_t *, xfs_lsn_t);
-STATIC void    xlog_recover_insert_item_backq(xlog_recover_item_t **q,
-                                              xlog_recover_item_t *item);
 #if defined(DEBUG)
 STATIC void    xlog_recover_check_summary(xlog_t *);
 #else
@@ -68,7 +66,7 @@ STATIC void   xlog_recover_check_summary(xlog_t *);
        ((bbs + (log)->l_sectbb_mask + 1) & ~(log)->l_sectbb_mask) : (bbs) )
 #define XLOG_SECTOR_ROUNDDOWN_BLKNO(log, bno)  ((bno) & ~(log)->l_sectbb_mask)
 
-xfs_buf_t *
+STATIC xfs_buf_t *
 xlog_get_bp(
        xlog_t          *log,
        int             nbblks)
@@ -88,7 +86,7 @@ xlog_get_bp(
        return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
 }
 
-void
+STATIC void
 xlog_put_bp(
        xfs_buf_t       *bp)
 {
@@ -805,7 +803,7 @@ xlog_find_head(
  * We could speed up search by using current head_blk buffer, but it is not
  * available.
  */
-int
+STATIC int
 xlog_find_tail(
        xlog_t                  *log,
        xfs_daddr_t             *head_blk,
@@ -1367,36 +1365,45 @@ xlog_clear_stale_blocks(
 
 STATIC xlog_recover_t *
 xlog_recover_find_tid(
-       xlog_recover_t          *q,
+       struct hlist_head       *head,
        xlog_tid_t              tid)
 {
-       xlog_recover_t          *p = q;
+       xlog_recover_t          *trans;
+       struct hlist_node       *n;
 
-       while (p != NULL) {
-               if (p->r_log_tid == tid)
-                   break;
-               p = p->r_next;
+       hlist_for_each_entry(trans, n, head, r_list) {
+               if (trans->r_log_tid == tid)
+                       return trans;
        }
-       return p;
+       return NULL;
 }
 
 STATIC void
-xlog_recover_put_hashq(
-       xlog_recover_t          **q,
-       xlog_recover_t          *trans)
+xlog_recover_new_tid(
+       struct hlist_head       *head,
+       xlog_tid_t              tid,
+       xfs_lsn_t               lsn)
 {
-       trans->r_next = *q;
-       *q = trans;
+       xlog_recover_t          *trans;
+
+       trans = kmem_zalloc(sizeof(xlog_recover_t), KM_SLEEP);
+       trans->r_log_tid   = tid;
+       trans->r_lsn       = lsn;
+       INIT_LIST_HEAD(&trans->r_itemq);
+
+       INIT_HLIST_NODE(&trans->r_list);
+       hlist_add_head(&trans->r_list, head);
 }
 
 STATIC void
 xlog_recover_add_item(
-       xlog_recover_item_t     **itemq)
+       struct list_head        *head)
 {
        xlog_recover_item_t     *item;
 
        item = kmem_zalloc(sizeof(xlog_recover_item_t), KM_SLEEP);
-       xlog_recover_insert_item_backq(itemq, item);
+       INIT_LIST_HEAD(&item->ri_list);
+       list_add_tail(&item->ri_list, head);
 }
 
 STATIC int
@@ -1409,8 +1416,7 @@ xlog_recover_add_to_cont_trans(
        xfs_caddr_t             ptr, old_ptr;
        int                     old_len;
 
-       item = trans->r_itemq;
-       if (item == NULL) {
+       if (list_empty(&trans->r_itemq)) {
                /* finish copying rest of trans header */
                xlog_recover_add_item(&trans->r_itemq);
                ptr = (xfs_caddr_t) &trans->r_theader +
@@ -1418,7 +1424,8 @@ xlog_recover_add_to_cont_trans(
                memcpy(ptr, dp, len); /* d, s, l */
                return 0;
        }
-       item = item->ri_prev;
+       /* take the tail entry */
+       item = list_entry(trans->r_itemq.prev, xlog_recover_item_t, ri_list);
 
        old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
        old_len = item->ri_buf[item->ri_cnt-1].i_len;
@@ -1455,8 +1462,7 @@ xlog_recover_add_to_trans(
 
        if (!len)
                return 0;
-       item = trans->r_itemq;
-       if (item == NULL) {
+       if (list_empty(&trans->r_itemq)) {
                /* we need to catch log corruptions here */
                if (*(uint *)dp != XFS_TRANS_HEADER_MAGIC) {
                        xlog_warn("XFS: xlog_recover_add_to_trans: "
@@ -1474,12 +1480,15 @@ xlog_recover_add_to_trans(
        memcpy(ptr, dp, len);
        in_f = (xfs_inode_log_format_t *)ptr;
 
-       if (item->ri_prev->ri_total != 0 &&
-            item->ri_prev->ri_total == item->ri_prev->ri_cnt) {
+       /* take the tail entry */
+       item = list_entry(trans->r_itemq.prev, xlog_recover_item_t, ri_list);
+       if (item->ri_total != 0 &&
+            item->ri_total == item->ri_cnt) {
+               /* tail item is in use, get a new one */
                xlog_recover_add_item(&trans->r_itemq);
+               item = list_entry(trans->r_itemq.prev,
+                                       xlog_recover_item_t, ri_list);
        }
-       item = trans->r_itemq;
-       item = item->ri_prev;
 
        if (item->ri_total == 0) {              /* first region to be added */
                if (in_f->ilf_size == 0 ||
@@ -1504,96 +1513,29 @@ xlog_recover_add_to_trans(
        return 0;
 }
 
-STATIC void
-xlog_recover_new_tid(
-       xlog_recover_t          **q,
-       xlog_tid_t              tid,
-       xfs_lsn_t               lsn)
-{
-       xlog_recover_t          *trans;
-
-       trans = kmem_zalloc(sizeof(xlog_recover_t), KM_SLEEP);
-       trans->r_log_tid   = tid;
-       trans->r_lsn       = lsn;
-       xlog_recover_put_hashq(q, trans);
-}
-
-STATIC int
-xlog_recover_unlink_tid(
-       xlog_recover_t          **q,
-       xlog_recover_t          *trans)
-{
-       xlog_recover_t          *tp;
-       int                     found = 0;
-
-       ASSERT(trans != NULL);
-       if (trans == *q) {
-               *q = (*q)->r_next;
-       } else {
-               tp = *q;
-               while (tp) {
-                       if (tp->r_next == trans) {
-                               found = 1;
-                               break;
-                       }
-                       tp = tp->r_next;
-               }
-               if (!found) {
-                       xlog_warn(
-                            "XFS: xlog_recover_unlink_tid: trans not found");
-                       ASSERT(0);
-                       return XFS_ERROR(EIO);
-               }
-               tp->r_next = tp->r_next->r_next;
-       }
-       return 0;
-}
-
-STATIC void
-xlog_recover_insert_item_backq(
-       xlog_recover_item_t     **q,
-       xlog_recover_item_t     *item)
-{
-       if (*q == NULL) {
-               item->ri_prev = item->ri_next = item;
-               *q = item;
-       } else {
-               item->ri_next           = *q;
-               item->ri_prev           = (*q)->ri_prev;
-               (*q)->ri_prev           = item;
-               item->ri_prev->ri_next  = item;
-       }
-}
-
-STATIC void
-xlog_recover_insert_item_frontq(
-       xlog_recover_item_t     **q,
-       xlog_recover_item_t     *item)
-{
-       xlog_recover_insert_item_backq(q, item);
-       *q = item;
-}
-
+/*
+ * Sort the log items in the transaction. Cancelled buffers need
+ * to be put first so they are processed before any items that might
+ * modify the buffers. If they are cancelled, then the modifications
+ * don't need to be replayed.
+ */
 STATIC int
 xlog_recover_reorder_trans(
        xlog_recover_t          *trans)
 {
-       xlog_recover_item_t     *first_item, *itemq, *itemq_next;
-       xfs_buf_log_format_t    *buf_f;
-       ushort                  flags = 0;
+       xlog_recover_item_t     *item, *n;
+       LIST_HEAD(sort_list);
 
-       first_item = itemq = trans->r_itemq;
-       trans->r_itemq = NULL;
-       do {
-               itemq_next = itemq->ri_next;
-               buf_f = (xfs_buf_log_format_t *)itemq->ri_buf[0].i_addr;
+       list_splice_init(&trans->r_itemq, &sort_list);
+       list_for_each_entry_safe(item, n, &sort_list, ri_list) {
+               xfs_buf_log_format_t    *buf_f;
 
-               switch (ITEM_TYPE(itemq)) {
+               buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr;
+
+               switch (ITEM_TYPE(item)) {
                case XFS_LI_BUF:
-                       flags = buf_f->blf_flags;
-                       if (!(flags & XFS_BLI_CANCEL)) {
-                               xlog_recover_insert_item_frontq(&trans->r_itemq,
-                                                               itemq);
+                       if (!(buf_f->blf_flags & XFS_BLI_CANCEL)) {
+                               list_move(&item->ri_list, &trans->r_itemq);
                                break;
                        }
                case XFS_LI_INODE:
@@ -1601,7 +1543,7 @@ xlog_recover_reorder_trans(
                case XFS_LI_QUOTAOFF:
                case XFS_LI_EFD:
                case XFS_LI_EFI:
-                       xlog_recover_insert_item_backq(&trans->r_itemq, itemq);
+                       list_move_tail(&item->ri_list, &trans->r_itemq);
                        break;
                default:
                        xlog_warn(
@@ -1609,8 +1551,8 @@ xlog_recover_reorder_trans(
                        ASSERT(0);
                        return XFS_ERROR(EIO);
                }
-               itemq = itemq_next;
-       } while (first_item != itemq);
+       }
+       ASSERT(list_empty(&sort_list));
        return 0;
 }
 
@@ -2242,9 +2184,9 @@ xlog_recover_do_buffer_trans(
        }
 
        mp = log->l_mp;
-       buf_flags = XFS_BUF_LOCK;
+       buf_flags = XBF_LOCK;
        if (!(flags & XFS_BLI_INODE_BUF))
-               buf_flags |= XFS_BUF_MAPPED;
+               buf_flags |= XBF_MAPPED;
 
        bp = xfs_buf_read(mp->m_ddev_targp, blkno, len, buf_flags);
        if (XFS_BUF_ISERROR(bp)) {
@@ -2346,7 +2288,7 @@ xlog_recover_do_inode_trans(
        }
 
        bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,
-                         XFS_BUF_LOCK);
+                         XBF_LOCK);
        if (XFS_BUF_ISERROR(bp)) {
                xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
                                  bp, in_f->ilf_blkno);
@@ -2814,14 +2756,13 @@ xlog_recover_do_trans(
        int                     pass)
 {
        int                     error = 0;
-       xlog_recover_item_t     *item, *first_item;
+       xlog_recover_item_t     *item;
 
        error = xlog_recover_reorder_trans(trans);
        if (error)
                return error;
 
-       first_item = item = trans->r_itemq;
-       do {
+       list_for_each_entry(item, &trans->r_itemq, ri_list) {
                switch (ITEM_TYPE(item)) {
                case XFS_LI_BUF:
                        error = xlog_recover_do_buffer_trans(log, item, pass);
@@ -2854,8 +2795,7 @@ xlog_recover_do_trans(
 
                if (error)
                        return error;
-               item = item->ri_next;
-       } while (first_item != item);
+       }
 
        return 0;
 }
@@ -2869,21 +2809,18 @@ STATIC void
 xlog_recover_free_trans(
        xlog_recover_t          *trans)
 {
-       xlog_recover_item_t     *first_item, *item, *free_item;
+       xlog_recover_item_t     *item, *n;
        int                     i;
 
-       item = first_item = trans->r_itemq;
-       do {
-               free_item = item;
-               item = item->ri_next;
-                /* Free the regions in the item. */
-               for (i = 0; i < free_item->ri_cnt; i++) {
-                       kmem_free(free_item->ri_buf[i].i_addr);
-               }
+       list_for_each_entry_safe(item, n, &trans->r_itemq, ri_list) {
+               /* Free the regions in the item. */
+               list_del(&item->ri_list);
+               for (i = 0; i < item->ri_cnt; i++)
+                       kmem_free(item->ri_buf[i].i_addr);
                /* Free the item itself */
-               kmem_free(free_item->ri_buf);
-               kmem_free(free_item);
-       } while (first_item != item);
+               kmem_free(item->ri_buf);
+               kmem_free(item);
+       }
        /* Free the transaction recover structure */
        kmem_free(trans);
 }
@@ -2891,14 +2828,12 @@ xlog_recover_free_trans(
 STATIC int
 xlog_recover_commit_trans(
        xlog_t                  *log,
-       xlog_recover_t          **q,
        xlog_recover_t          *trans,
        int                     pass)
 {
        int                     error;
 
-       if ((error = xlog_recover_unlink_tid(q, trans)))
-               return error;
+       hlist_del(&trans->r_list);
        if ((error = xlog_recover_do_trans(log, trans, pass)))
                return error;
        xlog_recover_free_trans(trans);                 /* no error */
@@ -2926,7 +2861,7 @@ xlog_recover_unmount_trans(
 STATIC int
 xlog_recover_process_data(
        xlog_t                  *log,
-       xlog_recover_t          *rhash[],
+       struct hlist_head       rhash[],
        xlog_rec_header_t       *rhead,
        xfs_caddr_t             dp,
        int                     pass)
@@ -2960,7 +2895,7 @@ xlog_recover_process_data(
                }
                tid = be32_to_cpu(ohead->oh_tid);
                hash = XLOG_RHASH(tid);
-               trans = xlog_recover_find_tid(rhash[hash], tid);
+               trans = xlog_recover_find_tid(&rhash[hash], tid);
                if (trans == NULL) {               /* not found; add new tid */
                        if (ohead->oh_flags & XLOG_START_TRANS)
                                xlog_recover_new_tid(&rhash[hash], tid,
@@ -2978,7 +2913,7 @@ xlog_recover_process_data(
                        switch (flags) {
                        case XLOG_COMMIT_TRANS:
                                error = xlog_recover_commit_trans(log,
-                                               &rhash[hash], trans, pass);
+                                                               trans, pass);
                                break;
                        case XLOG_UNMOUNT_TRANS:
                                error = xlog_recover_unmount_trans(trans);
@@ -3211,7 +3146,7 @@ xlog_recover_process_one_iunlink(
        /*
         * Get the on disk inode to find the next inode in the bucket.
         */
-       error = xfs_itobp(mp, NULL, ip, &dip, &ibp, XFS_BUF_LOCK);
+       error = xfs_itobp(mp, NULL, ip, &dip, &ibp, XBF_LOCK);
        if (error)
                goto fail_iput;
 
@@ -3517,7 +3452,7 @@ xlog_do_recovery_pass(
        int                     error = 0, h_size;
        int                     bblks, split_bblks;
        int                     hblks, split_hblks, wrapped_hblks;
-       xlog_recover_t          *rhash[XLOG_RHASH_SIZE];
+       struct hlist_head       rhash[XLOG_RHASH_SIZE];
 
        ASSERT(head_blk != tail_blk);
 
@@ -3978,8 +3913,7 @@ xlog_recover_finish(
                 * case the unlink transactions would have problems
                 * pushing the EFIs out of the way.
                 */
-               xfs_log_force(log->l_mp, (xfs_lsn_t)0,
-                             (XFS_LOG_FORCE | XFS_LOG_SYNC));
+               xfs_log_force(log->l_mp, XFS_LOG_SYNC);
 
                xlog_recover_process_iunlinks(log);
 
index b2254555530106dc907f58cecf3099bcbae56619..75d749207258b7208acdea39347e45395236e607 100644 (file)
  * item headers are in ri_buf[0].  Additional buffers follow.
  */
 typedef struct xlog_recover_item {
-       struct xlog_recover_item *ri_next;
-       struct xlog_recover_item *ri_prev;
-       int                      ri_type;
-       int                      ri_cnt;        /* count of regions found */
-       int                      ri_total;      /* total regions */
-       xfs_log_iovec_t          *ri_buf;       /* ptr to regions buffer */
+       struct list_head        ri_list;
+       int                     ri_type;
+       int                     ri_cnt; /* count of regions found */
+       int                     ri_total;       /* total regions */
+       xfs_log_iovec_t         *ri_buf;        /* ptr to regions buffer */
 } xlog_recover_item_t;
 
 struct xlog_tid;
 typedef struct xlog_recover {
-       struct xlog_recover *r_next;
-       xlog_tid_t          r_log_tid;          /* log's transaction id */
-       xfs_trans_header_t  r_theader;          /* trans header for partial */
-       int                 r_state;            /* not needed */
-       xfs_lsn_t           r_lsn;              /* xact lsn */
-       xlog_recover_item_t *r_itemq;           /* q for items */
+       struct hlist_node       r_list;
+       xlog_tid_t              r_log_tid;      /* log's transaction id */
+       xfs_trans_header_t      r_theader;      /* trans header for partial */
+       int                     r_state;        /* not needed */
+       xfs_lsn_t               r_lsn;          /* xact lsn */
+       struct list_head        r_itemq;        /* q for items */
 } xlog_recover_t;
 
 #define ITEM_TYPE(i)   (*(ushort *)(i)->ri_buf[0].i_addr)
index eb403b40e120d5f20661445b7fab21a58a8c31bd..6afaaeb2950abb5c2f15586865789547dfaee6b3 100644 (file)
@@ -200,6 +200,38 @@ xfs_uuid_unmount(
 }
 
 
+/*
+ * Reference counting access wrappers to the perag structures.
+ */
+struct xfs_perag *
+xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno)
+{
+       struct xfs_perag        *pag;
+       int                     ref = 0;
+
+       spin_lock(&mp->m_perag_lock);
+       pag = radix_tree_lookup(&mp->m_perag_tree, agno);
+       if (pag) {
+               ASSERT(atomic_read(&pag->pag_ref) >= 0);
+               /* catch leaks in the positive direction during testing */
+               ASSERT(atomic_read(&pag->pag_ref) < 1000);
+               ref = atomic_inc_return(&pag->pag_ref);
+       }
+       spin_unlock(&mp->m_perag_lock);
+       trace_xfs_perag_get(mp, agno, ref, _RET_IP_);
+       return pag;
+}
+
+void
+xfs_perag_put(struct xfs_perag *pag)
+{
+       int     ref;
+
+       ASSERT(atomic_read(&pag->pag_ref) > 0);
+       ref = atomic_dec_return(&pag->pag_ref);
+       trace_xfs_perag_put(pag->pag_mount, pag->pag_agno, ref, _RET_IP_);
+}
+
 /*
  * Free up the resources associated with a mount structure.  Assume that
  * the structure was initially zeroed, so we can tell which fields got
@@ -209,13 +241,16 @@ STATIC void
 xfs_free_perag(
        xfs_mount_t     *mp)
 {
-       if (mp->m_perag) {
-               int     agno;
+       xfs_agnumber_t  agno;
+       struct xfs_perag *pag;
 
-               for (agno = 0; agno < mp->m_maxagi; agno++)
-                       if (mp->m_perag[agno].pagb_list)
-                               kmem_free(mp->m_perag[agno].pagb_list);
-               kmem_free(mp->m_perag);
+       for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
+               spin_lock(&mp->m_perag_lock);
+               pag = radix_tree_delete(&mp->m_perag_tree, agno);
+               ASSERT(pag);
+               ASSERT(atomic_read(&pag->pag_ref) == 0);
+               spin_unlock(&mp->m_perag_lock);
+               kmem_free(pag);
        }
 }
 
@@ -389,22 +424,57 @@ xfs_initialize_perag_icache(
        }
 }
 
-xfs_agnumber_t
+int
 xfs_initialize_perag(
        xfs_mount_t     *mp,
-       xfs_agnumber_t  agcount)
+       xfs_agnumber_t  agcount,
+       xfs_agnumber_t  *maxagi)
 {
        xfs_agnumber_t  index, max_metadata;
+       xfs_agnumber_t  first_initialised = 0;
        xfs_perag_t     *pag;
        xfs_agino_t     agino;
        xfs_ino_t       ino;
        xfs_sb_t        *sbp = &mp->m_sb;
        xfs_ino_t       max_inum = XFS_MAXINUMBER_32;
+       int             error = -ENOMEM;
 
        /* Check to see if the filesystem can overflow 32 bit inodes */
        agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0);
        ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino);
 
+       /*
+        * Walk the current per-ag tree so we don't try to initialise AGs
+        * that already exist (growfs case). Allocate and insert all the
+        * AGs we don't find ready for initialisation.
+        */
+       for (index = 0; index < agcount; index++) {
+               pag = xfs_perag_get(mp, index);
+               if (pag) {
+                       xfs_perag_put(pag);
+                       continue;
+               }
+               if (!first_initialised)
+                       first_initialised = index;
+               pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL);
+               if (!pag)
+                       goto out_unwind;
+               if (radix_tree_preload(GFP_NOFS))
+                       goto out_unwind;
+               spin_lock(&mp->m_perag_lock);
+               if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
+                       BUG();
+                       spin_unlock(&mp->m_perag_lock);
+                       radix_tree_preload_end();
+                       error = -EEXIST;
+                       goto out_unwind;
+               }
+               pag->pag_agno = index;
+               pag->pag_mount = mp;
+               spin_unlock(&mp->m_perag_lock);
+               radix_tree_preload_end();
+       }
+
        /* Clear the mount flag if no inode can overflow 32 bits
         * on this filesystem, or if specifically requested..
         */
@@ -438,21 +508,33 @@ xfs_initialize_perag(
                        }
 
                        /* This ag is preferred for inodes */
-                       pag = &mp->m_perag[index];
+                       pag = xfs_perag_get(mp, index);
                        pag->pagi_inodeok = 1;
                        if (index < max_metadata)
                                pag->pagf_metadata = 1;
                        xfs_initialize_perag_icache(pag);
+                       xfs_perag_put(pag);
                }
        } else {
                /* Setup default behavior for smaller filesystems */
                for (index = 0; index < agcount; index++) {
-                       pag = &mp->m_perag[index];
+                       pag = xfs_perag_get(mp, index);
                        pag->pagi_inodeok = 1;
                        xfs_initialize_perag_icache(pag);
+                       xfs_perag_put(pag);
                }
        }
-       return index;
+       if (maxagi)
+               *maxagi = index;
+       return 0;
+
+out_unwind:
+       kmem_free(pag);
+       for (; index > first_initialised; index--) {
+               pag = radix_tree_delete(&mp->m_perag_tree, index);
+               kmem_free(pag);
+       }
+       return error;
 }
 
 void
@@ -583,7 +665,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
         * access to the superblock.
         */
        sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);
-       extra_flags = XFS_BUF_LOCK | XFS_BUF_MANAGE | XFS_BUF_MAPPED;
+       extra_flags = XBF_LOCK | XBF_FS_MANAGED | XBF_MAPPED;
 
        bp = xfs_buf_read(mp->m_ddev_targp, XFS_SB_DADDR, BTOBB(sector_size),
                          extra_flags);
@@ -731,12 +813,13 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
                error = xfs_ialloc_pagi_init(mp, NULL, index);
                if (error)
                        return error;
-               pag = &mp->m_perag[index];
+               pag = xfs_perag_get(mp, index);
                ifree += pag->pagi_freecount;
                ialloc += pag->pagi_count;
                bfree += pag->pagf_freeblks;
                bfreelst += pag->pagf_flcount;
                btree += pag->pagf_btreeblks;
+               xfs_perag_put(pag);
        }
        /*
         * Overwrite incore superblock counters with just-read data
@@ -1008,6 +1091,22 @@ xfs_mount_reset_sbqflags(
        return xfs_trans_commit(tp, 0);
 }
 
+__uint64_t
+xfs_default_resblks(xfs_mount_t *mp)
+{
+       __uint64_t resblks;
+
+       /*
+        * We default to 5% or 1024 fsbs of space reserved, whichever is smaller.
+        * This may drive us straight to ENOSPC on mount, but that implies
+        * we were already there on the last unmount. Warn if this occurs.
+        */
+       resblks = mp->m_sb.sb_dblocks;
+       do_div(resblks, 20);
+       resblks = min_t(__uint64_t, resblks, 1024);
+       return resblks;
+}
+
 /*
  * This function does the following on an initial mount of a file system:
  *     - reads the superblock from disk and init the mount struct
@@ -1152,13 +1251,13 @@ xfs_mountfs(
        /*
         * Allocate and initialize the per-ag data.
         */
-       init_rwsem(&mp->m_peraglock);
-       mp->m_perag = kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t),
-                                 KM_MAYFAIL);
-       if (!mp->m_perag)
+       spin_lock_init(&mp->m_perag_lock);
+       INIT_RADIX_TREE(&mp->m_perag_tree, GFP_NOFS);
+       error = xfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi);
+       if (error) {
+               cmn_err(CE_WARN, "XFS: Failed per-ag init: %d", error);
                goto out_remove_uuid;
-
-       mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
+       }
 
        if (!sbp->sb_logblocks) {
                cmn_err(CE_WARN, "XFS: no log defined");
@@ -1318,18 +1417,14 @@ xfs_mountfs(
         * when at ENOSPC. This is needed for operations like create with
         * attr, unwritten extent conversion at ENOSPC, etc. Data allocations
         * are not allowed to use this reserved space.
-        *
-        * We default to 5% or 1024 fsbs of space reserved, whichever is smaller.
-        * This may drive us straight to ENOSPC on mount, but that implies
-        * we were already there on the last unmount. Warn if this occurs.
         */
-       resblks = mp->m_sb.sb_dblocks;
-       do_div(resblks, 20);
-       resblks = min_t(__uint64_t, resblks, 1024);
-       error = xfs_reserve_blocks(mp, &resblks, NULL);
-       if (error)
-               cmn_err(CE_WARN, "XFS: Unable to allocate reserve blocks. "
-                               "Continuing without a reserve pool.");
+       if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
+               resblks = xfs_default_resblks(mp);
+               error = xfs_reserve_blocks(mp, &resblks, NULL);
+               if (error)
+                       cmn_err(CE_WARN, "XFS: Unable to allocate reserve "
+                               "blocks. Continuing without a reserve pool.");
+       }
 
        return 0;
 
@@ -1372,8 +1467,19 @@ xfs_unmountfs(
         * push out the iclog we will never get that unlocked. hence we
         * need to force the log first.
         */
-       xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
-       xfs_reclaim_inodes(mp, XFS_IFLUSH_ASYNC);
+       xfs_log_force(mp, XFS_LOG_SYNC);
+
+       /*
+        * Do a delwri reclaim pass first so that as many dirty inodes are
+        * queued up for IO as possible. Then flush the buffers before making
+        * a synchronous path to catch all the remaining inodes are reclaimed.
+        * This makes the reclaim process as quick as possible by avoiding
+        * synchronous writeout and blocking on inodes already in the delwri
+        * state as much as possible.
+        */
+       xfs_reclaim_inodes(mp, 0);
+       XFS_bflush(mp->m_ddev_targp);
+       xfs_reclaim_inodes(mp, SYNC_WAIT);
 
        xfs_qm_unmount(mp);
 
@@ -1382,7 +1488,7 @@ xfs_unmountfs(
         * that nothing is pinned.  This is important because bflush()
         * will skip pinned buffers.
         */
-       xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
+       xfs_log_force(mp, XFS_LOG_SYNC);
 
        xfs_binval(mp->m_ddev_targp);
        if (mp->m_rtdev_targp) {
@@ -1548,15 +1654,14 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
        xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);
 
        /* find modified range */
+       f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
+       ASSERT((1LL << f) & XFS_SB_MOD_BITS);
+       last = xfs_sb_info[f + 1].offset - 1;
 
        f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
        ASSERT((1LL << f) & XFS_SB_MOD_BITS);
        first = xfs_sb_info[f].offset;
 
-       f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
-       ASSERT((1LL << f) & XFS_SB_MOD_BITS);
-       last = xfs_sb_info[f + 1].offset - 1;
-
        xfs_trans_log_buf(tp, bp, first, last);
 }
 
@@ -1887,7 +1992,7 @@ xfs_getsb(
 
        ASSERT(mp->m_sb_bp != NULL);
        bp = mp->m_sb_bp;
-       if (flags & XFS_BUF_TRYLOCK) {
+       if (flags & XBF_TRYLOCK) {
                if (!XFS_BUF_CPSEMA(bp)) {
                        return NULL;
                }
index 1df7e4502967a2623a9e5fa79f9f1556ae55e136..70504fcf14cd3e9ab63ce32cbeb4a2d77ea3436e 100644 (file)
@@ -78,7 +78,8 @@ typedef int   (*xfs_send_destroy_t)(struct xfs_inode *, dm_right_t);
 typedef int    (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *,
                        struct xfs_inode *, dm_right_t,
                        struct xfs_inode *, dm_right_t,
-                       const char *, const char *, mode_t, int, int);
+                       const unsigned char *, const unsigned char *,
+                       mode_t, int, int);
 typedef int    (*xfs_send_mount_t)(struct xfs_mount *, dm_right_t,
                        char *, char *);
 typedef void   (*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *,
@@ -207,8 +208,8 @@ typedef struct xfs_mount {
        uint                    m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
        uint                    m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
        uint                    m_in_maxlevels; /* max inobt btree levels. */
-       struct xfs_perag        *m_perag;       /* per-ag accounting info */
-       struct rw_semaphore     m_peraglock;    /* lock for m_perag (pointer) */
+       struct radix_tree_root  m_perag_tree;   /* per-ag accounting info */
+       spinlock_t              m_perag_lock;   /* lock for m_perag_tree */
        struct mutex            m_growlock;     /* growfs mutex */
        int                     m_fixedfsid[2]; /* unchanged for life of FS */
        uint                    m_dmevmask;     /* DMI events for this FS */
@@ -224,6 +225,7 @@ typedef struct xfs_mount {
        __uint64_t              m_maxioffset;   /* maximum inode offset */
        __uint64_t              m_resblks;      /* total reserved blocks */
        __uint64_t              m_resblks_avail;/* available reserved blocks */
+       __uint64_t              m_resblks_save; /* reserved blks @ remount,ro */
        int                     m_dalign;       /* stripe unit */
        int                     m_swidth;       /* stripe width */
        int                     m_sinoalign;    /* stripe unit inode alignment */
@@ -384,19 +386,10 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
 }
 
 /*
- * perag get/put wrappers for eventual ref counting
+ * perag get/put wrappers for ref counting
  */
-static inline xfs_perag_t *
-xfs_get_perag(struct xfs_mount *mp, xfs_ino_t ino)
-{
-       return &mp->m_perag[XFS_INO_TO_AGNO(mp, ino)];
-}
-
-static inline void
-xfs_put_perag(struct xfs_mount *mp, xfs_perag_t *pag)
-{
-       /* nothing to see here, move along */
-}
+struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
+void   xfs_perag_put(struct xfs_perag *pag);
 
 /*
  * Per-cpu superblock locking functions
@@ -428,6 +421,7 @@ typedef struct xfs_mod_sb {
 } xfs_mod_sb_t;
 
 extern int     xfs_log_sbcount(xfs_mount_t *, uint);
+extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
 extern int     xfs_mountfs(xfs_mount_t *mp);
 
 extern void    xfs_unmountfs(xfs_mount_t *);
@@ -450,7 +444,8 @@ extern struct xfs_dmops xfs_dmcore_xfs;
 #endif /* __KERNEL__ */
 
 extern void    xfs_mod_sb(struct xfs_trans *, __int64_t);
-extern xfs_agnumber_t  xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t);
+extern int     xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
+                                       xfs_agnumber_t *);
 extern void    xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
 extern void    xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);
 
index 4b0613d99faa9f70533df36ff2c8834535181313..45ce15dc5b2b05a7447e6ad2a9834dd0bf5b6dec 100644 (file)
@@ -398,7 +398,7 @@ exit:
  * guaranteed that all the free functions for all the elements have finished
  * executing and the reaper is not running.
  */
-void
+static void
 xfs_mru_cache_flush(
        xfs_mru_cache_t         *mru)
 {
index 5d439f34b0c9bf68ee84e22f7535c0fc0aa4a57d..36dd3ec8b4eb17fdbdf83dfd8496e46a1409c30b 100644 (file)
@@ -42,7 +42,6 @@ void xfs_mru_cache_uninit(void);
 int xfs_mru_cache_create(struct xfs_mru_cache **mrup, unsigned int lifetime_ms,
                             unsigned int grp_count,
                             xfs_mru_cache_free_func_t free_func);
-void xfs_mru_cache_flush(xfs_mru_cache_t *mru);
 void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
 int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
                                void *value);
index 91bfd60f4c74b582bf3c0a0e17197537dfcb20cf..fdcab3f81dde6f14d4f429ba97ef24c6cd17caf5 100644 (file)
@@ -222,17 +222,10 @@ typedef struct xfs_qoff_logformat {
 #define XFS_QMOPT_DELRTBCOUNT  0x0400000
 #define XFS_QMOPT_RES_INOS     0x0800000
 
-/*
- * flags for dqflush and dqflush_all.
- */
-#define XFS_QMOPT_SYNC         0x1000000
-#define XFS_QMOPT_ASYNC                0x2000000
-#define XFS_QMOPT_DELWRI       0x4000000
-
 /*
  * flags for dqalloc.
  */
-#define XFS_QMOPT_INHERIT      0x8000000
+#define XFS_QMOPT_INHERIT      0x1000000
 
 /*
  * flags to xfs_trans_mod_dquot.
index 9e15a11853623838b91894b2a89f3778211511f4..6be05f756d59d544c82576d307266ce5b739f893 100644 (file)
@@ -1517,6 +1517,8 @@ xfs_rtfree_range(
         */
        error = xfs_rtfind_forw(mp, tp, end, mp->m_sb.sb_rextents - 1,
                &postblock);
+       if (error)
+               return error;
        /*
         * If there are blocks not being freed at the front of the
         * old extent, add summary data for them to be allocated.
index 5aa07caea5f15b06b607f222be591f49e16ff7bd..e336742a58a47a467a24abb0688b8c1fe7853207 100644 (file)
 #include "xfs_rw.h"
 #include "xfs_trace.h"
 
-/*
- * This is a subroutine for xfs_write() and other writers (xfs_ioctl)
- * which clears the setuid and setgid bits when a file is written.
- */
-int
-xfs_write_clear_setuid(
-       xfs_inode_t     *ip)
-{
-       xfs_mount_t     *mp;
-       xfs_trans_t     *tp;
-       int             error;
-
-       mp = ip->i_mount;
-       tp = xfs_trans_alloc(mp, XFS_TRANS_WRITEID);
-       if ((error = xfs_trans_reserve(tp, 0,
-                                     XFS_WRITEID_LOG_RES(mp),
-                                     0, 0, 0))) {
-               xfs_trans_cancel(tp, 0);
-               return error;
-       }
-       xfs_ilock(ip, XFS_ILOCK_EXCL);
-       xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
-       xfs_trans_ihold(tp, ip);
-       ip->i_d.di_mode &= ~S_ISUID;
-
-       /*
-        * Note that we don't have to worry about mandatory
-        * file locking being disabled here because we only
-        * clear the S_ISGID bit if the Group execute bit is
-        * on, but if it was on then mandatory locking wouldn't
-        * have been enabled.
-        */
-       if (ip->i_d.di_mode & S_IXGRP) {
-               ip->i_d.di_mode &= ~S_ISGID;
-       }
-       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-       xfs_trans_set_sync(tp);
-       error = xfs_trans_commit(tp, 0);
-       xfs_iunlock(ip, XFS_ILOCK_EXCL);
-       return 0;
-}
-
 /*
  * Force a shutdown of the filesystem instantly while keeping
  * the filesystem consistent. We don't do an unmount here; just shutdown
@@ -153,88 +111,6 @@ xfs_do_force_shutdown(
        }
 }
 
-
-/*
- * Called when we want to stop a buffer from getting written or read.
- * We attach the EIO error, muck with its flags, and call biodone
- * so that the proper iodone callbacks get called.
- */
-int
-xfs_bioerror(
-       xfs_buf_t *bp)
-{
-
-#ifdef XFSERRORDEBUG
-       ASSERT(XFS_BUF_ISREAD(bp) || bp->b_iodone);
-#endif
-
-       /*
-        * No need to wait until the buffer is unpinned.
-        * We aren't flushing it.
-        */
-       XFS_BUF_ERROR(bp, EIO);
-       /*
-        * We're calling biodone, so delete B_DONE flag. Either way
-        * we have to call the iodone callback, and calling biodone
-        * probably is the best way since it takes care of
-        * GRIO as well.
-        */
-       XFS_BUF_UNREAD(bp);
-       XFS_BUF_UNDELAYWRITE(bp);
-       XFS_BUF_UNDONE(bp);
-       XFS_BUF_STALE(bp);
-
-       XFS_BUF_CLR_BDSTRAT_FUNC(bp);
-       xfs_biodone(bp);
-
-       return (EIO);
-}
-
-/*
- * Same as xfs_bioerror, except that we are releasing the buffer
- * here ourselves, and avoiding the biodone call.
- * This is meant for userdata errors; metadata bufs come with
- * iodone functions attached, so that we can track down errors.
- */
-int
-xfs_bioerror_relse(
-       xfs_buf_t *bp)
-{
-       int64_t fl;
-
-       ASSERT(XFS_BUF_IODONE_FUNC(bp) != xfs_buf_iodone_callbacks);
-       ASSERT(XFS_BUF_IODONE_FUNC(bp) != xlog_iodone);
-
-       fl = XFS_BUF_BFLAGS(bp);
-       /*
-        * No need to wait until the buffer is unpinned.
-        * We aren't flushing it.
-        *
-        * chunkhold expects B_DONE to be set, whether
-        * we actually finish the I/O or not. We don't want to
-        * change that interface.
-        */
-       XFS_BUF_UNREAD(bp);
-       XFS_BUF_UNDELAYWRITE(bp);
-       XFS_BUF_DONE(bp);
-       XFS_BUF_STALE(bp);
-       XFS_BUF_CLR_IODONE_FUNC(bp);
-       XFS_BUF_CLR_BDSTRAT_FUNC(bp);
-       if (!(fl & XFS_B_ASYNC)) {
-               /*
-                * Mark b_error and B_ERROR _both_.
-                * Lot's of chunkcache code assumes that.
-                * There's no reason to mark error for
-                * ASYNC buffers.
-                */
-               XFS_BUF_ERROR(bp, EIO);
-               XFS_BUF_FINISH_IOWAIT(bp);
-       } else {
-               xfs_buf_relse(bp);
-       }
-       return (EIO);
-}
-
 /*
  * Prints out an ALERT message about I/O error.
  */
@@ -305,37 +181,6 @@ xfs_read_buf(
        return (error);
 }
 
-/*
- * Wrapper around bwrite() so that we can trap
- * write errors, and act accordingly.
- */
-int
-xfs_bwrite(
-       struct xfs_mount *mp,
-       struct xfs_buf   *bp)
-{
-       int     error;
-
-       /*
-        * XXXsup how does this work for quotas.
-        */
-       XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
-       bp->b_mount = mp;
-       XFS_BUF_WRITE(bp);
-
-       if ((error = XFS_bwrite(bp))) {
-               ASSERT(mp);
-               /*
-                * Cannot put a buftrace here since if the buffer is not
-                * B_HOLD then we will brelse() the buffer before returning
-                * from bwrite and we could be tracing a buffer that has
-                * been reused.
-                */
-               xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
-       }
-       return (error);
-}
-
 /*
  * helper function to extract extent size hint from inode
  */
index 571f2174435c5c04ad843d3860cd9558236e7046..11c41ec6ed75854dd0f59a974a2618c4c6c5f948 100644 (file)
@@ -39,10 +39,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
 /*
  * Prototypes for functions in xfs_rw.c.
  */
-extern int xfs_write_clear_setuid(struct xfs_inode *ip);
-extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp);
-extern int xfs_bioerror(struct xfs_buf *bp);
-extern int xfs_bioerror_relse(struct xfs_buf *bp);
 extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp,
                        xfs_daddr_t blkno, int len, uint flags,
                        struct xfs_buf **bpp);
index 237badcbac3bcbbc9fbbba8ecea9229cdac80f08..be942d4e3324335eef40a443a0c9e7132b2bc908 100644 (file)
@@ -981,9 +981,8 @@ shut_us_down:
         */
        if (sync) {
                if (!error) {
-                       error = _xfs_log_force(mp, commit_lsn,
-                                     XFS_LOG_FORCE | XFS_LOG_SYNC,
-                                     log_flushed);
+                       error = _xfs_log_force_lsn(mp, commit_lsn,
+                                     XFS_LOG_SYNC, log_flushed);
                }
                XFS_STATS_INC(xs_trans_sync);
        } else {
@@ -1121,7 +1120,7 @@ xfs_trans_fill_vecs(
        tp->t_header.th_num_items = nitems;
        log_vector->i_addr = (xfs_caddr_t)&tp->t_header;
        log_vector->i_len = sizeof(xfs_trans_header_t);
-       XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_TRANSHDR);
+       log_vector->i_type = XLOG_REG_TYPE_TRANSHDR;
 }
 
 
index ca64f33c63a30530666b7b9ee0a681765929072f..c93e3a10285705db91a93a3354eaabafbafe77ce 100644 (file)
@@ -861,8 +861,7 @@ typedef struct xfs_item_ops {
 #define        XFS_ITEM_SUCCESS        0
 #define        XFS_ITEM_PINNED         1
 #define        XFS_ITEM_LOCKED         2
-#define        XFS_ITEM_FLUSHING       3
-#define XFS_ITEM_PUSHBUF       4
+#define XFS_ITEM_PUSHBUF       3
 
 /*
  * This structure is used to maintain a list of block ranges that have been
index 2ffc570679bef017199f59fafa64b9e9c9433797..e799824f72451ff017175144994c3322040945a6 100644 (file)
@@ -237,14 +237,15 @@ out:
 }
 
 /*
- * Function that does the work of pushing on the AIL
+ * xfsaild_push does the work of pushing on the AIL.  Returning a timeout of
+ * zero indicates that the caller should sleep until woken.
  */
 long
 xfsaild_push(
        struct xfs_ail  *ailp,
        xfs_lsn_t       *last_lsn)
 {
-       long            tout = 1000; /* milliseconds */
+       long            tout = 0;
        xfs_lsn_t       last_pushed_lsn = *last_lsn;
        xfs_lsn_t       target =  ailp->xa_target;
        xfs_lsn_t       lsn;
@@ -252,6 +253,7 @@ xfsaild_push(
        int             flush_log, count, stuck;
        xfs_mount_t     *mp = ailp->xa_mount;
        struct xfs_ail_cursor   *cur = &ailp->xa_cursors;
+       int             push_xfsbufd = 0;
 
        spin_lock(&ailp->xa_lock);
        xfs_trans_ail_cursor_init(ailp, cur);
@@ -262,7 +264,7 @@ xfsaild_push(
                 */
                xfs_trans_ail_cursor_done(ailp, cur);
                spin_unlock(&ailp->xa_lock);
-               last_pushed_lsn = 0;
+               *last_lsn = 0;
                return tout;
        }
 
@@ -279,7 +281,6 @@ xfsaild_push(
         * prevents use from spinning when we can't do anything or there is
         * lots of contention on the AIL lists.
         */
-       tout = 10;
        lsn = lip->li_lsn;
        flush_log = stuck = count = 0;
        while ((XFS_LSN_CMP(lip->li_lsn, target) < 0)) {
@@ -308,6 +309,7 @@ xfsaild_push(
                        XFS_STATS_INC(xs_push_ail_pushbuf);
                        IOP_PUSHBUF(lip);
                        last_pushed_lsn = lsn;
+                       push_xfsbufd = 1;
                        break;
 
                case XFS_ITEM_PINNED:
@@ -322,12 +324,6 @@ xfsaild_push(
                        stuck++;
                        break;
 
-               case XFS_ITEM_FLUSHING:
-                       XFS_STATS_INC(xs_push_ail_flushing);
-                       last_pushed_lsn = lsn;
-                       stuck++;
-                       break;
-
                default:
                        ASSERT(0);
                        break;
@@ -371,19 +367,24 @@ xfsaild_push(
                 * move forward in the AIL.
                 */
                XFS_STATS_INC(xs_push_ail_flush);
-               xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
+               xfs_log_force(mp, 0);
+       }
+
+       if (push_xfsbufd) {
+               /* we've got delayed write buffers to flush */
+               wake_up_process(mp->m_ddev_targp->bt_task);
        }
 
        if (!count) {
                /* We're past our target or empty, so idle */
-               tout = 1000;
+               last_pushed_lsn = 0;
        } else if (XFS_LSN_CMP(lsn, target) >= 0) {
                /*
                 * We reached the target so wait a bit longer for I/O to
                 * complete and remove pushed items from the AIL before we
                 * start the next scan from the start of the AIL.
                 */
-               tout += 20;
+               tout = 50;
                last_pushed_lsn = 0;
        } else if ((stuck * 100) / count > 90) {
                /*
@@ -395,11 +396,14 @@ xfsaild_push(
                 * Backoff a bit more to allow some I/O to complete before
                 * continuing from where we were.
                 */
-               tout += 10;
+               tout = 20;
+       } else {
+               /* more to do, but wait a short while before continuing */
+               tout = 10;
        }
        *last_lsn = last_pushed_lsn;
        return tout;
-}      /* xfsaild_push */
+}
 
 
 /*
index 49130628d5efdbcc961dbe0e66e64fd5397846de..5ffd544434eb8eaf4d79a439ad6400df2cbbf47a 100644 (file)
@@ -75,13 +75,14 @@ xfs_trans_get_buf(xfs_trans_t       *tp,
        xfs_buf_log_item_t      *bip;
 
        if (flags == 0)
-               flags = XFS_BUF_LOCK | XFS_BUF_MAPPED;
+               flags = XBF_LOCK | XBF_MAPPED;
 
        /*
         * Default to a normal get_buf() call if the tp is NULL.
         */
        if (tp == NULL)
-               return xfs_buf_get(target_dev, blkno, len, flags | BUF_BUSY);
+               return xfs_buf_get(target_dev, blkno, len,
+                                  flags | XBF_DONT_BLOCK);
 
        /*
         * If we find the buffer in the cache with this transaction
@@ -117,14 +118,14 @@ xfs_trans_get_buf(xfs_trans_t     *tp,
        }
 
        /*
-        * We always specify the BUF_BUSY flag within a transaction so
-        * that get_buf does not try to push out a delayed write buffer
+        * We always specify the XBF_DONT_BLOCK flag within a transaction
+        * so that get_buf does not try to push out a delayed write buffer
         * which might cause another transaction to take place (if the
         * buffer was delayed alloc).  Such recursive transactions can
         * easily deadlock with our current transaction as well as cause
         * us to run out of stack space.
         */
-       bp = xfs_buf_get(target_dev, blkno, len, flags | BUF_BUSY);
+       bp = xfs_buf_get(target_dev, blkno, len, flags | XBF_DONT_BLOCK);
        if (bp == NULL) {
                return NULL;
        }
@@ -290,15 +291,15 @@ xfs_trans_read_buf(
        int                     error;
 
        if (flags == 0)
-               flags = XFS_BUF_LOCK | XFS_BUF_MAPPED;
+               flags = XBF_LOCK | XBF_MAPPED;
 
        /*
         * Default to a normal get_buf() call if the tp is NULL.
         */
        if (tp == NULL) {
-               bp = xfs_buf_read(target, blkno, len, flags | BUF_BUSY);
+               bp = xfs_buf_read(target, blkno, len, flags | XBF_DONT_BLOCK);
                if (!bp)
-                       return (flags & XFS_BUF_TRYLOCK) ?
+                       return (flags & XBF_TRYLOCK) ?
                                        EAGAIN : XFS_ERROR(ENOMEM);
 
                if (XFS_BUF_GETERROR(bp) != 0) {
@@ -385,14 +386,14 @@ xfs_trans_read_buf(
        }
 
        /*
-        * We always specify the BUF_BUSY flag within a transaction so
-        * that get_buf does not try to push out a delayed write buffer
+        * We always specify the XBF_DONT_BLOCK flag within a transaction
+        * so that get_buf does not try to push out a delayed write buffer
         * which might cause another transaction to take place (if the
         * buffer was delayed alloc).  Such recursive transactions can
         * easily deadlock with our current transaction as well as cause
         * us to run out of stack space.
         */
-       bp = xfs_buf_read(target, blkno, len, flags | BUF_BUSY);
+       bp = xfs_buf_read(target, blkno, len, flags | XBF_DONT_BLOCK);
        if (bp == NULL) {
                *bpp = NULL;
                return 0;
@@ -472,8 +473,8 @@ shutdown_abort:
        if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))
                cmn_err(CE_NOTE, "about to pop assert, bp == 0x%p", bp);
 #endif
-       ASSERT((XFS_BUF_BFLAGS(bp) & (XFS_B_STALE|XFS_B_DELWRI)) !=
-                                               (XFS_B_STALE|XFS_B_DELWRI));
+       ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) !=
+                                    (XBF_STALE|XBF_DELWRI));
 
        trace_xfs_trans_read_buf_shut(bp, _RET_IP_);
        xfs_buf_relse(bp);
index d725428c9df6f64734591ed3366932e7550fe2d9..b09904555d07c43b4cdd4c336c177614702b665d 100644 (file)
@@ -151,8 +151,8 @@ typedef enum {
 } xfs_btnum_t;
 
 struct xfs_name {
-       const char      *name;
-       int             len;
+       const unsigned char     *name;
+       int                     len;
 };
 
 #endif /* __XFS_TYPES_H__ */
index 6f268756bf3632e376035e3b7402e29fb0319920..ddd2c5d1b854b73eacb8803bee64a75b9aff7f72 100644 (file)
@@ -256,7 +256,7 @@ xfs_setattr(
                    iattr->ia_size > ip->i_d.di_size) {
                        code = xfs_flush_pages(ip,
                                        ip->i_d.di_size, iattr->ia_size,
-                                       XFS_B_ASYNC, FI_NONE);
+                                       XBF_ASYNC, FI_NONE);
                }
 
                /* wait for all I/O to complete */
@@ -597,7 +597,7 @@ xfs_fsync(
 {
        xfs_trans_t     *tp;
        int             error = 0;
-       int             log_flushed = 0, changed = 1;
+       int             log_flushed = 0;
 
        xfs_itrace_entry(ip);
 
@@ -627,19 +627,16 @@ xfs_fsync(
                 * disk yet, the inode will be still be pinned.  If it is,
                 * force the log.
                 */
-
                xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
                if (xfs_ipincount(ip)) {
-                       error = _xfs_log_force(ip->i_mount, (xfs_lsn_t)0,
-                                     XFS_LOG_FORCE | XFS_LOG_SYNC,
-                                     &log_flushed);
-               } else {
-                       /*
-                        * If the inode is not pinned and nothing has changed
-                        * we don't need to flush the cache.
-                        */
-                       changed = 0;
+                       if (ip->i_itemp->ili_last_lsn) {
+                               error = _xfs_log_force_lsn(ip->i_mount,
+                                               ip->i_itemp->ili_last_lsn,
+                                               XFS_LOG_SYNC, &log_flushed);
+                       } else {
+                               error = _xfs_log_force(ip->i_mount,
+                                               XFS_LOG_SYNC, &log_flushed);
+                       }
                }
        } else  {
                /*
@@ -674,7 +671,7 @@ xfs_fsync(
                xfs_iunlock(ip, XFS_ILOCK_EXCL);
        }
 
-       if ((ip->i_mount->m_flags & XFS_MOUNT_BARRIER) && changed) {
+       if (ip->i_mount->m_flags & XFS_MOUNT_BARRIER) {
                /*
                 * If the log write didn't issue an ordered tag we need
                 * to flush the disk cache for the data device now.
@@ -1096,7 +1093,7 @@ xfs_release(
                 */
                truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
                if (truncated && VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0)
-                       xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
+                       xfs_flush_pages(ip, 0, -1, XBF_ASYNC, FI_NONE);
        }
 
        if (ip->i_d.di_nlink != 0) {
@@ -2199,7 +2196,8 @@ xfs_symlink(
        if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp,
                                        DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
-                                       link_name->name, target_path, 0, 0, 0);
+                                       link_name->name,
+                                       (unsigned char *)target_path, 0, 0, 0);
                if (error)
                        return error;
        }
@@ -2395,7 +2393,8 @@ std_return:
                                        dp, DM_RIGHT_NULL,
                                        error ? NULL : ip,
                                        DM_RIGHT_NULL, link_name->name,
-                                       target_path, 0, error, 0);
+                                       (unsigned char *)target_path,
+                                       0, error, 0);
        }
 
        if (!error)
index 167a467403a59f0c4327bb0a23cbb369e0e9d7af..774f40729ca13ea25e17a057a1b25606d7109ca0 100644 (file)
@@ -43,11 +43,11 @@ int xfs_change_file_space(struct xfs_inode *ip, int cmd,
 int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name,
                struct xfs_inode *src_ip, struct xfs_inode *target_dp,
                struct xfs_name *target_name, struct xfs_inode *target_ip);
-int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value,
-               int *valuelenp, int flags);
-int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value,
-               int valuelen, int flags);
-int xfs_attr_remove(struct xfs_inode *dp, const char *name, int flags);
+int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name,
+               unsigned char *value, int *valuelenp, int flags);
+int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name,
+               unsigned char *value, int valuelen, int flags);
+int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags);
 int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
                int flags, struct attrlist_cursor_kern *cursor);
 ssize_t xfs_read(struct xfs_inode *ip, struct kiocb *iocb,
index 3cd9ccdcbd8f90a7440e6f51acbcbb85e4ecad17..54508ccea023f563c840639915c22c981e7cfe76 100644 (file)
@@ -242,6 +242,8 @@ struct acpi_device_perf {
 struct acpi_device_wakeup_flags {
        u8 valid:1;             /* Can successfully enable wakeup? */
        u8 run_wake:1;          /* Run-Wake GPE devices */
+       u8 always_enabled:1;    /* Run-wake devices that are always enabled */
+       u8 notifier_present:1;  /* Wake-up notify handler has been installed */
 };
 
 struct acpi_device_wakeup_state {
@@ -256,6 +258,7 @@ struct acpi_device_wakeup {
        struct acpi_device_wakeup_state state;
        struct acpi_device_wakeup_flags flags;
        int prepare_count;
+       int run_wake_count;
 };
 
 /* Device */
@@ -386,6 +389,9 @@ acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
+int acpi_disable_wakeup_device_power(struct acpi_device *dev);
+
 #ifdef CONFIG_PM_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int *);
 int acpi_pm_device_sleep_wake(struct device *, bool);
index f4906f6568d4142d1eb77c12f5997ba5da8ce5f7..3a4767c01c5fd6ecee67d409fdf4a906bbe5da5f 100644 (file)
@@ -104,6 +104,7 @@ int acpi_pci_bind_root(struct acpi_device *device);
 
 struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
                                   int bus);
+void pci_acpi_crs_quirks(void);
 
 /* --------------------------------------------------------------------------
                                     Processor
index 86e9735a96bd3df7a57e8af1a44a3eca78715fe5..3988f93b9c66fcdfe542d57e4e3da08624458a29 100644 (file)
@@ -281,11 +281,11 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
 /*
  * GPE Interfaces
  */
-acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type);
+acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action);
 
-acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
+acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type);
 
-acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number);
+acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type);
 
 acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
 
index 153f12dc3373802798a59a8e595bb722f9b42d79..73af408633719733fe1c405b0cc895df3bb2e819 100644 (file)
@@ -668,15 +668,16 @@ typedef u32 acpi_event_status;
 
 /*
  * GPE info flags - Per GPE
- * +-+-+-+---+---+-+
- * |7|6|5|4:3|2:1|0|
- * +-+-+-+---+---+-+
- *  | | |  |   |  |
- *  | | |  |   |  +--- Interrupt type: Edge or Level Triggered
- *  | | |  |   +--- Type: Wake-only, Runtime-only, or wake/runtime
+ * +-+-+-+---+-+-+-+
+ * |7|6|5|4:3|2|1|0|
+ * +-+-+-+---+-+-+-+
+ *  | | |  |  | | |
+ *  | | |  |  | | +--- Interrupt type: Edge or Level Triggered
+ *  | | |  |  | +--- GPE can wake the system
+ *  | | |  |  +--- Unused
  *  | | |  +--- Type of dispatch -- to method, handler, or none
- *  | | +--- Enabled for runtime?
- *  | +--- Enabled for wake?
+ *  | | +--- Unused
+ *  | +--- Unused
  *  +--- Unused
  */
 #define ACPI_GPE_XRUPT_TYPE_MASK        (u8) 0x01
@@ -687,22 +688,13 @@ typedef u32 acpi_event_status;
 #define ACPI_GPE_TYPE_WAKE_RUN          (u8) 0x06
 #define ACPI_GPE_TYPE_WAKE              (u8) 0x02
 #define ACPI_GPE_TYPE_RUNTIME           (u8) 0x04      /* Default */
+#define ACPI_GPE_CAN_WAKE              (u8) 0x02
 
 #define ACPI_GPE_DISPATCH_MASK          (u8) 0x18
 #define ACPI_GPE_DISPATCH_HANDLER       (u8) 0x08
 #define ACPI_GPE_DISPATCH_METHOD        (u8) 0x10
 #define ACPI_GPE_DISPATCH_NOT_USED      (u8) 0x00      /* Default */
 
-#define ACPI_GPE_RUN_ENABLE_MASK        (u8) 0x20
-#define ACPI_GPE_RUN_ENABLED            (u8) 0x20
-#define ACPI_GPE_RUN_DISABLED           (u8) 0x00      /* Default */
-
-#define ACPI_GPE_WAKE_ENABLE_MASK       (u8) 0x40
-#define ACPI_GPE_WAKE_ENABLED           (u8) 0x40
-#define ACPI_GPE_WAKE_DISABLED          (u8) 0x00      /* Default */
-
-#define ACPI_GPE_ENABLE_MASK            (u8) 0x60      /* Both run/wake */
-
 /*
  * Flags for GPE and Lock interfaces
  */
index 9d7febde10a172f7bc22f7b72e7ffa6456836788..09469971472fb5587207d5f1517342e479c5abb2 100644 (file)
@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
 #include <linux/hardirq.h>
 #define ACPI_PREEMPTION_POINT() \
        do { \
-               if (!in_atomic_preempt_off()) \
+               if (!in_atomic_preempt_off() && !irqs_disabled()) \
                        cond_resched(); \
        } while (0)
 
diff --git a/include/crypto/md5.h b/include/crypto/md5.h
new file mode 100644 (file)
index 0000000..65f299b
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _CRYPTO_MD5_H
+#define _CRYPTO_MD5_H
+
+#include <linux/types.h>
+
+#define MD5_DIGEST_SIZE                16
+#define MD5_HMAC_BLOCK_SIZE    64
+#define MD5_BLOCK_WORDS                16
+#define MD5_HASH_WORDS         4
+
+struct md5_state {
+       u32 hash[MD5_HASH_WORDS];
+       u32 block[MD5_BLOCK_WORDS];
+       u64 byte_count;
+};
+
+#endif
diff --git a/include/crypto/pcrypt.h b/include/crypto/pcrypt.h
new file mode 100644 (file)
index 0000000..d7d8bd8
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * pcrypt - Parallel crypto engine.
+ *
+ * Copyright (C) 2009 secunet Security Networks AG
+ * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTO_PCRYPT_H
+#define _CRYPTO_PCRYPT_H
+
+#include <linux/crypto.h>
+#include <linux/kernel.h>
+#include <linux/padata.h>
+
+struct pcrypt_request {
+       struct padata_priv      padata;
+       void                    *data;
+       void                    *__ctx[] CRYPTO_MINALIGN_ATTR;
+};
+
+static inline void *pcrypt_request_ctx(struct pcrypt_request *req)
+{
+       return req->__ctx;
+}
+
+static inline
+struct padata_priv *pcrypt_request_padata(struct pcrypt_request *req)
+{
+       return &req->padata;
+}
+
+static inline
+struct pcrypt_request *pcrypt_padata_request(struct padata_priv *padata)
+{
+       return container_of(padata, struct pcrypt_request, padata);
+}
+
+#endif
index bc4fdf27bd2ec36ea884c2b0537eee1418117f1b..c5ba1636613c0baac637fb169b28a17fb6a08aa0 100644 (file)
@@ -85,7 +85,7 @@ struct drm_mode_modeinfo {
        __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
        __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
 
-       __u32 vrefresh; /* vertical refresh * 1000 */
+       __u32 vrefresh;
 
        __u32 flags;
        __u32 type;
index 1e67c441ea823d619a38d8c2437f6ecb6a138250..f745948b61e480e31bca363a033f7a622487dabe 100644 (file)
@@ -77,6 +77,7 @@ struct drm_nouveau_gpuobj_free {
 #define NOUVEAU_GETPARAM_PCI_PHYSICAL    10
 #define NOUVEAU_GETPARAM_CHIPSET_ID      11
 #define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
 struct drm_nouveau_getparam {
        uint64_t param;
        uint64_t value;
index ff7664e0c3cdbe78a856ff1b6448baf98eaf77a2..4c4e0f8375b397ff521455c2e92d9383cade07d3 100644 (file)
@@ -353,6 +353,11 @@ struct ttm_bo_driver {
        /* notify the driver we are taking a fault on this BO
         * and have reserved it */
        void (*fault_reserve_notify)(struct ttm_buffer_object *bo);
+
+       /**
+        * notify the driver that we're about to swap out this bo
+        */
+       void (*swap_notify) (struct ttm_buffer_object *bo);
 };
 
 /**
index 2be7e1249b6f60d18cf006f454fc4e6cd4d9df6b..c7645f480d1219cb84c765e5962d86cdd470ec54 100644 (file)
@@ -68,7 +68,8 @@
 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
 #define DRM_VMW_PARAM_3D               2
 #define DRM_VMW_PARAM_FIFO_OFFSET      3
-
+#define DRM_VMW_PARAM_HW_CAPS          4
+#define DRM_VMW_PARAM_FIFO_CAPS        5
 
 /**
  * struct drm_vmw_getparam_arg
@@ -181,6 +182,8 @@ struct drm_vmw_context_arg {
  * The size of the array should equal the total number of mipmap levels.
  * @shareable: Boolean whether other clients (as identified by file descriptors)
  * may reference this surface.
+ * @scanout: Boolean whether the surface is intended to be used as a
+ * scanout.
  *
  * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
  * Output data from the DRM_VMW_REF_SURFACE Ioctl.
@@ -192,7 +195,7 @@ struct drm_vmw_surface_create_req {
        uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
        uint64_t size_addr;
        int32_t shareable;
-       uint32_t pad64;
+       int32_t scanout;
 };
 
 /**
@@ -295,17 +298,28 @@ union drm_vmw_surface_reference_arg {
  *
  * @commands: User-space address of a command buffer cast to an uint64_t.
  * @command-size: Size in bytes of the command buffer.
+ * @throttle-us: Sleep until software is less than @throttle_us
+ * microseconds ahead of hardware. The driver may round this value
+ * to the nearest kernel tick.
  * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
  * uint64_t.
+ * @version: Allows expanding the execbuf ioctl parameters without breaking
+ * backwards compatibility, since user-space will always tell the kernel
+ * which version it uses.
+ * @flags: Execbuf flags. None currently.
  *
  * Argument to the DRM_VMW_EXECBUF Ioctl.
  */
 
+#define DRM_VMW_EXECBUF_VERSION 0
+
 struct drm_vmw_execbuf_arg {
        uint64_t commands;
        uint32_t command_size;
-       uint32_t pad64;
+       uint32_t throttle_us;
        uint64_t fence_rep;
+        uint32_t version;
+        uint32_t flags;
 };
 
 /**
index 36924255c0d541ad97dc0d8525c3481a7d60478f..b926afe8c03e7f846043ec78e2bbfb0cc021497e 100644 (file)
@@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 void __acpi_unmap_table(char *map, unsigned long size);
 int early_acpi_boot_init(void);
 int acpi_boot_init (void);
-int acpi_boot_table_init (void);
+void acpi_boot_table_init (void);
 int acpi_mps_check (void);
 int acpi_numa_init (void);
 
@@ -321,9 +321,9 @@ static inline int acpi_boot_init(void)
        return 0;
 }
 
-static inline int acpi_boot_table_init(void)
+static inline void acpi_boot_table_init(void)
 {
-       return 0;
+       return;
 }
 
 static inline int acpi_mps_check(void)
index ab94335b4bb9e55d661df26a7aca0a8d4b44c86d..6816be6c3f7798bd64ec1d05a27d95f4b9e27c80 100644 (file)
@@ -1,5 +1,9 @@
 /*
- *  linux/include/asm-arm/hardware/amba.h
+ *  linux/include/amba/bus.h
+ *
+ *  This device type deals with ARM PrimeCells and anything else that
+ *  presents a proper CID (0xB105F00D) at the end of the I/O register
+ *  region or that is derived from a PrimeCell.
  *
  *  Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
  *
index 38a6948ce0c2cd7a50917c1a82570d851196f053..20f31567ccee324d4218dc65527412c4bf032c9a 100644 (file)
@@ -647,9 +647,9 @@ static inline int ata_id_has_large_logical_sectors(const u16 *id)
        return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
 }
 
-static inline u8 ata_id_logical_per_physical_sectors(const u16 *id)
+static inline u16 ata_id_logical_per_physical_sectors(const u16 *id)
 {
-       return id[ATA_ID_SECTOR_SIZE] & 0xf;
+       return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf);
 }
 
 static inline int ata_id_has_lba48(const u16 *id)
index cd4349bdc34efd2b5044eb8f83e0e4f98e211817..89c6249fc561a0eaf38f5d01e850f70d52726dd5 100644 (file)
@@ -109,6 +109,7 @@ extern int prepare_binprm(struct linux_binprm *);
 extern int __must_check remove_arg_zero(struct linux_binprm *);
 extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
 extern int flush_old_exec(struct linux_binprm * bprm);
+extern void setup_new_exec(struct linux_binprm * bprm);
 
 extern int suid_dumpable;
 #define SUID_DUMP_DISABLE      0       /* No setuid dumping */
index c05a29cb9bb2540902fa1d553905cd3c7252e25a..25b8b2f33ae947c0aedc9ab59c0ce88326da024c 100644 (file)
@@ -25,7 +25,7 @@
 static __inline__ int get_bitmask_order(unsigned int count)
 {
        int order;
-       
+
        order = fls(count);
        return order;   /* We could be slightly more clever with -1 here... */
 }
@@ -33,7 +33,7 @@ static __inline__ int get_bitmask_order(unsigned int count)
 static __inline__ int get_count_order(unsigned int count)
 {
        int order;
-       
+
        order = fls(count) - 1;
        if (count & (count - 1))
                order++;
@@ -45,6 +45,31 @@ static inline unsigned long hweight_long(unsigned long w)
        return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
+/*
+ * Clearly slow versions of the hweightN() functions, their benefit is
+ * of course compile time evaluation of constant arguments.
+ */
+#define HWEIGHT8(w)                                    \
+      (        BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) +   \
+       (!!((w) & (1ULL << 0))) +                       \
+       (!!((w) & (1ULL << 1))) +                       \
+       (!!((w) & (1ULL << 2))) +                       \
+       (!!((w) & (1ULL << 3))) +                       \
+       (!!((w) & (1ULL << 4))) +                       \
+       (!!((w) & (1ULL << 5))) +                       \
+       (!!((w) & (1ULL << 6))) +                       \
+       (!!((w) & (1ULL << 7))) )
+
+#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8((w) >> 8))
+#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
+#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
+
+/*
+ * Type invariant version that simply casts things to the
+ * largest type.
+ */
+#define HWEIGHT(w)   HWEIGHT64((u64)(w))
+
 /**
  * rol32 - rotate a 32-bit value left
  * @word: value to rotate
index 9b98173a81845bc4dc61b0bb30a516e738c4ec5d..1896e868854f949ed12c1ef38eb145b7c3633801 100644 (file)
@@ -461,8 +461,7 @@ struct request_queue
 #define QUEUE_FLAG_NONROT      14      /* non-rotational device (SSD) */
 #define QUEUE_FLAG_VIRT        QUEUE_FLAG_NONROT /* paravirt device */
 #define QUEUE_FLAG_IO_STAT     15      /* do IO stats */
-#define QUEUE_FLAG_CQ         16       /* hardware does queuing */
-#define QUEUE_FLAG_DISCARD     17      /* supports DISCARD */
+#define QUEUE_FLAG_DISCARD     16      /* supports DISCARD */
 
 #define QUEUE_FLAG_DEFAULT     ((1 << QUEUE_FLAG_IO_STAT) |            \
                                 (1 << QUEUE_FLAG_CLUSTER) |            \
@@ -586,7 +585,6 @@ enum {
 
 #define blk_queue_plugged(q)   test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
 #define blk_queue_tagged(q)    test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
-#define blk_queue_queuing(q)   test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags)
 #define blk_queue_stopped(q)   test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
 #define blk_queue_nomerges(q)  test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
 #define blk_queue_nonrot(q)    test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
@@ -938,6 +936,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
 extern void blk_set_default_limits(struct queue_limits *lim);
 extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                            sector_t offset);
+extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
+                           sector_t offset);
 extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
                              sector_t offset);
 extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
@@ -1148,8 +1148,11 @@ static inline int queue_discard_alignment(struct request_queue *q)
 static inline int queue_sector_discard_alignment(struct request_queue *q,
                                                 sector_t sector)
 {
-       return ((sector << 9) - q->limits.discard_alignment)
-               & (q->limits.discard_granularity - 1);
+       struct queue_limits *lim = &q->limits;
+       unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
+
+       return (lim->discard_granularity + lim->discard_alignment - alignment)
+               & (lim->discard_granularity - 1);
 }
 
 static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)
index 0008dee665148850f2b46af2918b23635cedc7c0..c9bbcb2a75aecbacdb1463cf08a2b0a26d0f264b 100644 (file)
@@ -28,6 +28,7 @@ struct css_id;
 extern int cgroup_init_early(void);
 extern int cgroup_init(void);
 extern void cgroup_lock(void);
+extern int cgroup_lock_is_held(void);
 extern bool cgroup_lock_live_group(struct cgroup *cgrp);
 extern void cgroup_unlock(void);
 extern void cgroup_fork(struct task_struct *p);
@@ -486,7 +487,9 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
 static inline struct cgroup_subsys_state *task_subsys_state(
        struct task_struct *task, int subsys_id)
 {
-       return rcu_dereference(task->cgroups->subsys[subsys_id]);
+       return rcu_dereference_check(task->cgroups->subsys[subsys_id],
+                                    rcu_read_lock_held() ||
+                                    cgroup_lock_is_held());
 }
 
 static inline struct cgroup* task_cgroup(struct task_struct *task,
index 8a4a130cc19698ab8a03c6c6344e3b24f42932f8..4bca8b60cdf79c52b30a53add160ab7e0c0bfa3d 100644 (file)
@@ -154,6 +154,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
  * @max_idle_ns:       max idle time permitted by the clocksource (nsecs)
  * @flags:             flags describing special properties
  * @vread:             vsyscall based read
+ * @suspend:           suspend function for the clocksource, if necessary
  * @resume:            resume function for the clocksource, if necessary
  */
 struct clocksource {
@@ -172,7 +173,8 @@ struct clocksource {
        u64 max_idle_ns;
        unsigned long flags;
        cycle_t (*vread)(void);
-       void (*resume)(void);
+       void (*suspend)(struct clocksource *cs);
+       void (*resume)(struct clocksource *cs);
 #ifdef CONFIG_IA64
        void *fsys_mmio;        /* used by fsyscall asm code */
 #define CLKSRC_FSYS_MMIO_SET(mmio, addr)      ((mmio) = (addr))
@@ -277,6 +279,7 @@ extern void clocksource_unregister(struct clocksource*);
 extern void clocksource_touch_watchdog(void);
 extern struct clocksource* clocksource_get_next(void);
 extern void clocksource_change_rating(struct clocksource *cs, int rating);
+extern void clocksource_suspend(void);
 extern void clocksource_resume(void);
 extern struct clocksource * __init __weak clocksource_default_clock(void);
 extern void clocksource_mark_unstable(struct clocksource *cs);
index 5be3dab4a69547bf6bb378a45d73e553166c5b12..188fcae10a995f3509fe54eb4035e21259359692 100644 (file)
@@ -15,6 +15,7 @@
 # define __acquire(x)  __context__(x,1)
 # define __release(x)  __context__(x,-1)
 # define __cond_lock(x,c)      ((c) ? ({ __acquire(x); 1; }) : 0)
+# define __percpu      __attribute__((noderef, address_space(3)))
 extern void __chk_user_ptr(const volatile void __user *);
 extern void __chk_io_ptr(const volatile void __iomem *);
 #else
@@ -32,6 +33,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 # define __acquire(x) (void)0
 # define __release(x) (void)0
 # define __cond_lock(x,c) (c)
+# define __percpu
 #endif
 
 #ifdef __KERNEL__
index 72ba63eb83c50d38b06d53a96955919ce3a17dfc..3a779ffba60bca25ac850637e85cd6fd8ab14642 100644 (file)
@@ -24,9 +24,6 @@
 
 #include <linux/types.h>
 
-#define CN_IDX_CONNECTOR               0xffffffff
-#define CN_VAL_CONNECTOR               0xffffffff
-
 /*
  * Process Events connector unique ids -- used for message routing
  */
@@ -75,30 +72,6 @@ struct cn_msg {
        __u8 data[0];
 };
 
-/*
- * Notify structure - requests notification about
- * registering/unregistering idx/val in range [first, first+range].
- */
-struct cn_notify_req {
-       __u32 first;
-       __u32 range;
-};
-
-/*
- * Main notification control message
- * *_notify_num        - number of appropriate cn_notify_req structures after 
- *                             this struct.
- * group               - notification receiver's idx.
- * len                         - total length of the attached data.
- */
-struct cn_ctl_msg {
-       __u32 idx_notify_num;
-       __u32 val_notify_num;
-       __u32 group;
-       __u32 len;
-       __u8 data[0];
-};
-
 #ifdef __KERNEL__
 
 #include <asm/atomic.h>
@@ -151,11 +124,6 @@ struct cn_callback_entry {
        u32 seq, group;
 };
 
-struct cn_ctl_entry {
-       struct list_head notify_entry;
-       struct cn_ctl_msg *msg;
-};
-
 struct cn_dev {
        struct cb_id id;
 
index d77b54733c5b63980c51fe354ee91de1a41ce81a..dbcee7647d9a3a9c54dcf3c960d3828ad01ef314 100644 (file)
@@ -143,6 +143,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
 
 #define for_each_cpu(cpu, mask)                        \
        for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
+#define for_each_cpu_not(cpu, mask)            \
+       for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
 #define for_each_cpu_and(cpu, mask, and)       \
        for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and)
 #else
@@ -202,6 +204,18 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
                (cpu) = cpumask_next((cpu), (mask)),    \
                (cpu) < nr_cpu_ids;)
 
+/**
+ * for_each_cpu_not - iterate over every cpu in a complemented mask
+ * @cpu: the (optionally unsigned) integer iterator
+ * @mask: the cpumask pointer
+ *
+ * After the loop, cpu is >= nr_cpu_ids.
+ */
+#define for_each_cpu_not(cpu, mask)                            \
+       for ((cpu) = -1;                                        \
+               (cpu) = cpumask_next_zero((cpu), (mask)),       \
+               (cpu) < nr_cpu_ids;)
+
 /**
  * for_each_cpu_and - iterate over every cpu in both masks
  * @cpu: the (optionally unsigned) integer iterator
index 4e3387a89cb92a8549e2c2479c37ac7fd2443956..4db09f89b637539e3d3e76bdc8565d51c0f11a7b 100644 (file)
@@ -280,7 +280,7 @@ static inline void put_cred(const struct cred *_cred)
  * task or by holding tasklist_lock to prevent it from being unlinked.
  */
 #define __task_cred(task) \
-       ((const struct cred *)(rcu_dereference((task)->real_cred)))
+       ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock))))
 
 /**
  * get_task_cred - Get another task's objective credentials
index a62799f2ab0019863d30e4f55f7677c5bd97d124..b30527db3ac0f69ed95089f79c1e1dd7965479fc 100644 (file)
@@ -472,6 +472,23 @@ static inline int device_is_registered(struct device *dev)
        return dev->kobj.state_in_sysfs;
 }
 
+static inline void device_enable_async_suspend(struct device *dev)
+{
+       if (dev->power.status == DPM_ON)
+               dev->power.async_suspend = true;
+}
+
+static inline void device_disable_async_suspend(struct device *dev)
+{
+       if (dev->power.status == DPM_ON)
+               dev->power.async_suspend = false;
+}
+
+static inline bool device_async_suspend_enabled(struct device *dev)
+{
+       return !!dev->power.async_suspend;
+}
+
 void driver_init(void);
 
 /*
index e84f4733cb55393a67ae15362dd2d7d8eb2aae8d..78962272338a757b1eb17b2cb167b30e1090b3ed 100644 (file)
@@ -53,7 +53,7 @@
 
 
 extern const char *drbd_buildtag(void);
-#define REL_VERSION "8.3.6"
+#define REL_VERSION "8.3.7"
 #define API_VERSION 88
 #define PRO_VERSION_MIN 86
 #define PRO_VERSION_MAX 91
index db5721ad50d12c2cd3f58c2c482a33db008938d7..a4d82f8959942be17b948f06af29ceb07e58f5d1 100644 (file)
@@ -69,6 +69,7 @@ NL_PACKET(disconnect, 6, )
 
 NL_PACKET(resize, 7,
        NL_INT64(               29,     T_MAY_IGNORE,   resize_size)
+       NL_BIT(                 68,     T_MAY_IGNORE,   resize_force)
 )
 
 NL_PACKET(syncer_conf, 8,
index 0cc4d55151b7cbcc37071ea04fe6f57f94401bca..ad990c5f63f657180b4a72e627e25573653531fb 100644 (file)
@@ -349,7 +349,11 @@ typedef struct elf64_shdr {
 #define ELF_OSABI ELFOSABI_NONE
 #endif
 
-/* Notes used in ET_CORE */
+/*
+ * Notes used in ET_CORE. Architectures export some of the arch register sets
+ * using the corresponding note types via the PTRACE_GETREGSET and
+ * PTRACE_SETREGSET requests.
+ */
 #define NT_PRSTATUS    1
 #define NT_PRFPREG     2
 #define NT_PRPSINFO    3
@@ -361,7 +365,13 @@ typedef struct elf64_shdr {
 #define NT_PPC_VSX     0x102           /* PowerPC VSX registers */
 #define NT_386_TLS     0x200           /* i386 TLS slots (struct user_desc) */
 #define NT_386_IOPERM  0x201           /* x86 io permission bitmap (1=deny) */
+#define NT_X86_XSTATE  0x202           /* x86 extended state using xsave */
 #define NT_S390_HIGH_GPRS      0x300   /* s390 upper register halves */
+#define NT_S390_TIMER  0x301           /* s390 timer register */
+#define NT_S390_TODCMP 0x302           /* s390 TOD clock comparator register */
+#define NT_S390_TODPREG        0x303           /* s390 TOD programmable register */
+#define NT_S390_CTRS   0x304           /* s390 control registers */
+#define NT_S390_PREFIX 0x305           /* s390 prefix register */
 
 
 /* Note header in a PT_NOTE section */
index 94dd10366a78ead79b7cb42dc15d7fb89bdc787a..91bb4f27238cf156cb3ecc3daac22d37684aebd3 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/fcntl.h>
 #include <linux/file.h>
+#include <linux/wait.h>
 
 /*
  * CAREFUL: Check include/asm-generic/fcntl.h when defining
@@ -34,6 +35,9 @@ struct file *eventfd_fget(int fd);
 struct eventfd_ctx *eventfd_ctx_fdget(int fd);
 struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
 int eventfd_signal(struct eventfd_ctx *ctx, int n);
+ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt);
+int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait,
+                                 __u64 *cnt);
 
 #else /* CONFIG_EVENTFD */
 
@@ -61,6 +65,18 @@ static inline void eventfd_ctx_put(struct eventfd_ctx *ctx)
 
 }
 
+static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait,
+                                      __u64 *cnt)
+{
+       return -ENOSYS;
+}
+
+static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx,
+                                               wait_queue_t *wait, __u64 *cnt)
+{
+       return -ENOSYS;
+}
+
 #endif
 
 #endif /* _LINUX_EVENTFD_H */
index a2ec74bc4812ff3242d22277870fc12ceae755a0..013dc529e95ffc43121fbf8cfbac9d432fa29bc6 100644 (file)
@@ -57,7 +57,14 @@ struct files_struct {
        struct file * fd_array[NR_OPEN_DEFAULT];
 };
 
-#define files_fdtable(files) (rcu_dereference((files)->fdt))
+#define rcu_dereference_check_fdtable(files, fdtfd) \
+       (rcu_dereference_check((fdtfd), \
+                              rcu_read_lock_held() || \
+                              lockdep_is_held(&(files)->file_lock) || \
+                              atomic_read(&(files)->count) == 1))
+
+#define files_fdtable(files) \
+               (rcu_dereference_check_fdtable((files), (files)->fdt))
 
 struct file_operations;
 struct vfsmount;
@@ -78,7 +85,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
        struct fdtable *fdt = files_fdtable(files);
 
        if (fd < fdt->max_fds)
-               file = rcu_dereference(fdt->fd[fd]);
+               file = rcu_dereference_check_fdtable(files, fdt->fd[fd]);
        return file;
 }
 
index 1f716d9f714b05b00d949891fd0b550e48fbee36..520ecf86cbb37b00bc7ec893bac4843b452fdeed 100644 (file)
@@ -380,7 +380,7 @@ struct fw_cdev_initiate_bus_reset {
  * @immediate: If non-zero, immediate key to insert before pointer
  * @key:       Upper 8 bits of root directory pointer
  * @data:      Userspace pointer to contents of descriptor block
- * @length:    Length of descriptor block data, in bytes
+ * @length:    Length of descriptor block data, in quadlets
  * @handle:    Handle to the descriptor, written by the kernel
  *
  * Add a descriptor block and optionally a preceding immediate key to the local
@@ -394,6 +394,8 @@ struct fw_cdev_initiate_bus_reset {
  * If not 0, the @immediate field specifies an immediate key which will be
  * inserted before the root directory pointer.
  *
+ * @immediate, @key, and @data array elements are CPU-endian quadlets.
+ *
  * If successful, the kernel adds the descriptor and writes back a handle to the
  * kernel-side object to be used for later removal of the descriptor block and
  * immediate key.
index 9147ca88f253ec1bd35b70b5313cd9f63c0a61d5..ebb1cd5bc2419c7fad8b421178021d52ac005fea 100644 (file)
@@ -729,6 +729,7 @@ struct inode {
        uid_t                   i_uid;
        gid_t                   i_gid;
        dev_t                   i_rdev;
+       unsigned int            i_blkbits;
        u64                     i_version;
        loff_t                  i_size;
 #ifdef __NEED_I_SIZE_ORDERED
@@ -738,7 +739,6 @@ struct inode {
        struct timespec         i_mtime;
        struct timespec         i_ctime;
        blkcnt_t                i_blocks;
-       unsigned int            i_blkbits;
        unsigned short          i_bytes;
        umode_t                 i_mode;
        spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
@@ -2463,7 +2463,7 @@ int proc_nr_files(struct ctl_table *table, int write,
 
 int __init get_filesystem_list(char *buf);
 
-#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
+#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
 #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE))
 
 #endif /* __KERNEL__ */
index 0b4f97d24d7f510b243bdd8cd461daa2786eaa19..01e6adea07ecf798a0a45331a297e8ea5b481e42 100644 (file)
@@ -134,6 +134,8 @@ extern void
 unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
 extern void unregister_ftrace_function_probe_all(char *glob);
 
+extern int ftrace_text_reserved(void *start, void *end);
+
 enum {
        FTRACE_FL_FREE          = (1 << 0),
        FTRACE_FL_FAILED        = (1 << 1),
@@ -141,7 +143,6 @@ enum {
        FTRACE_FL_ENABLED       = (1 << 3),
        FTRACE_FL_NOTRACE       = (1 << 4),
        FTRACE_FL_CONVERTED     = (1 << 5),
-       FTRACE_FL_FROZEN        = (1 << 6),
 };
 
 struct dyn_ftrace {
@@ -250,6 +251,10 @@ static inline int unregister_ftrace_command(char *cmd_name)
 {
        return -EINVAL;
 }
+static inline int ftrace_text_reserved(void *start, void *end)
+{
+       return 0;
+}
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 /* totally disable ftrace - can not re-enable after this */
@@ -511,4 +516,10 @@ static inline void trace_hw_branch_oops(void) {}
 
 #endif /* CONFIG_HW_BRANCH_TRACER */
 
+#ifdef CONFIG_FTRACE_SYSCALLS
+
+unsigned long arch_syscall_addr(int nr);
+
+#endif /* CONFIG_FTRACE_SYSCALLS */
+
 #endif /* _LINUX_FTRACE_H */
index 2233c98d80df5f473ba2f8616f8f3b55e6afd0a4..6b7c444ab8f6fcc84b6d7a1194902ab7a72f7ac6 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/trace_seq.h>
 #include <linux/percpu.h>
 #include <linux/hardirq.h>
+#include <linux/perf_event.h>
 
 struct trace_array;
 struct tracer;
@@ -121,9 +122,8 @@ struct ftrace_event_call {
        int                     (*regfunc)(struct ftrace_event_call *);
        void                    (*unregfunc)(struct ftrace_event_call *);
        int                     id;
+       const char              *print_fmt;
        int                     (*raw_init)(struct ftrace_event_call *);
-       int                     (*show_format)(struct ftrace_event_call *,
-                                              struct trace_seq *);
        int                     (*define_fields)(struct ftrace_event_call *);
        struct list_head        fields;
        int                     filter_active;
@@ -138,9 +138,6 @@ struct ftrace_event_call {
 
 #define FTRACE_MAX_PROFILE_SIZE        2048
 
-extern char *perf_trace_buf;
-extern char *perf_trace_buf_nmi;
-
 #define MAX_FILTER_PRED                32
 #define MAX_FILTER_STR_VAL     256     /* Should handle KSYM_SYMBOL_LEN */
 
@@ -188,13 +185,27 @@ do {                                                                      \
                __trace_printk(ip, fmt, ##args);                        \
 } while (0)
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 struct perf_event;
 extern int ftrace_profile_enable(int event_id);
 extern void ftrace_profile_disable(int event_id);
 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
                                     char *filter_str);
 extern void ftrace_profile_free_filter(struct perf_event *event);
+extern void *
+ftrace_perf_buf_prepare(int size, unsigned short type, int *rctxp,
+                        unsigned long *irq_flags);
+
+static inline void
+ftrace_perf_buf_submit(void *raw_data, int size, int rctx, u64 addr,
+                      u64 count, unsigned long irq_flags)
+{
+       struct trace_entry *entry = raw_data;
+
+       perf_tp_event(entry->type, addr, count, raw_data, size);
+       perf_swevent_put_recursion_context(rctx);
+       local_irq_restore(irq_flags);
+}
 #endif
 
 #endif /* _LINUX_FTRACE_EVENT_H */
index c6c0c41af35fda29c5f9e1429bd3db4784780bf8..9717081c75ad559df73fbb1cd683e541f05a3c96 100644 (file)
@@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
 #define part_stat_read(part, field)                                    \
 ({                                                                     \
        typeof((part)->dkstats->field) res = 0;                         \
-       int i;                                                          \
-       for_each_possible_cpu(i)                                        \
-               res += per_cpu_ptr((part)->dkstats, i)->field;          \
+       unsigned int _cpu;                                              \
+       for_each_possible_cpu(_cpu)                                     \
+               res += per_cpu_ptr((part)->dkstats, _cpu)->field;       \
        res;                                                            \
 })
 
index 87093652dda8d00ee341132f40eb17d5b46171be..b1344ec4b7fc9fe93305eaf2d96cfed494bb3de7 100644 (file)
@@ -501,7 +501,7 @@ struct hid_device {                                                 /* device report descriptor */
        void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
 
        /* handler for raw output data, used by hidraw */
-       int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
+       int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
 
        /* debugging support via debugfs */
        unsigned short debug;
@@ -663,7 +663,7 @@ struct hid_ll_driver {
 
 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
 /* We ignore a few input applications that are not widely used */
-#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
+#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
 
 /* HID core API */
 
@@ -690,6 +690,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
 int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
 void hid_output_report(struct hid_report *report, __u8 *data);
 struct hid_device *hid_allocate_device(void);
+struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
 int hid_check_keys_pressed(struct hid_device *hid);
 int hid_connect(struct hid_device *hid, unsigned int connect_mask);
index ab2cc20e21a5c381a1912a5bfe54aa7bdb293c50..74152c08ad0753be98d05b627eb4a035a68624c9 100644 (file)
@@ -17,6 +17,12 @@ static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page
 static inline void flush_kernel_dcache_page(struct page *page)
 {
 }
+static inline void flush_kernel_vmap_range(void *vaddr, int size)
+{
+}
+static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
+{
+}
 #endif
 
 #include <asm/kmap_types.h>
index 41235c93e4e95400bf0db52bf2f7b84399d22a39..5977b724f7c6884ee19ee6d657f91eaf84f9bde0 100644 (file)
@@ -44,7 +44,7 @@ static inline int hw_breakpoint_type(struct perf_event *bp)
        return bp->attr.bp_type;
 }
 
-static inline int hw_breakpoint_len(struct perf_event *bp)
+static inline unsigned long hw_breakpoint_len(struct perf_event *bp)
 {
        return bp->attr.bp_len;
 }
@@ -75,6 +75,8 @@ extern int __register_perf_hw_breakpoint(struct perf_event *bp);
 extern void unregister_hw_breakpoint(struct perf_event *bp);
 extern void unregister_wide_hw_breakpoint(struct perf_event **cpu_events);
 
+extern int dbg_reserve_bp_slot(struct perf_event *bp);
+extern int dbg_release_bp_slot(struct perf_event *bp);
 extern int reserve_bp_slot(struct perf_event *bp);
 extern void release_bp_slot(struct perf_event *bp);
 
index 99dc6d5cf7e59bc0412fbbd7afad788f04db933f..975837e7d6c093392d57e93b2374d669d245eeca 100644 (file)
@@ -17,7 +17,7 @@ struct linux_binprm;
 extern int ima_bprm_check(struct linux_binprm *bprm);
 extern int ima_inode_alloc(struct inode *inode);
 extern void ima_inode_free(struct inode *inode);
-extern int ima_path_check(struct path *path, int mask);
+extern int ima_file_check(struct file *file, int mask);
 extern void ima_file_free(struct file *file);
 extern int ima_file_mmap(struct file *file, unsigned long prot);
 extern void ima_counts_get(struct file *file);
@@ -38,7 +38,7 @@ static inline void ima_inode_free(struct inode *inode)
        return;
 }
 
-static inline int ima_path_check(struct path *path, int mask)
+static inline int ima_file_check(struct file *file, int mask)
 {
        return 0;
 }
index 7be8a6537b5700055b1f90ab2e84aa4df23354c9..f44ee9114401777eb5f0628a03fa074084a23ca9 100644 (file)
@@ -376,6 +376,7 @@ struct input_absinfo {
 #define KEY_DISPLAY_OFF                245     /* display device to off state */
 
 #define KEY_WIMAX              246
+#define KEY_RFKILL             247     /* Key that controls all radios */
 
 /* Range 248 - 255 is reserved for special needs of AT keyboard driver */
 
@@ -597,6 +598,48 @@ struct input_absinfo {
 
 #define KEY_CAMERA_FOCUS       0x210
 
+#define BTN_TRIGGER_HAPPY              0x2c0
+#define BTN_TRIGGER_HAPPY1             0x2c0
+#define BTN_TRIGGER_HAPPY2             0x2c1
+#define BTN_TRIGGER_HAPPY3             0x2c2
+#define BTN_TRIGGER_HAPPY4             0x2c3
+#define BTN_TRIGGER_HAPPY5             0x2c4
+#define BTN_TRIGGER_HAPPY6             0x2c5
+#define BTN_TRIGGER_HAPPY7             0x2c6
+#define BTN_TRIGGER_HAPPY8             0x2c7
+#define BTN_TRIGGER_HAPPY9             0x2c8
+#define BTN_TRIGGER_HAPPY10            0x2c9
+#define BTN_TRIGGER_HAPPY11            0x2ca
+#define BTN_TRIGGER_HAPPY12            0x2cb
+#define BTN_TRIGGER_HAPPY13            0x2cc
+#define BTN_TRIGGER_HAPPY14            0x2cd
+#define BTN_TRIGGER_HAPPY15            0x2ce
+#define BTN_TRIGGER_HAPPY16            0x2cf
+#define BTN_TRIGGER_HAPPY17            0x2d0
+#define BTN_TRIGGER_HAPPY18            0x2d1
+#define BTN_TRIGGER_HAPPY19            0x2d2
+#define BTN_TRIGGER_HAPPY20            0x2d3
+#define BTN_TRIGGER_HAPPY21            0x2d4
+#define BTN_TRIGGER_HAPPY22            0x2d5
+#define BTN_TRIGGER_HAPPY23            0x2d6
+#define BTN_TRIGGER_HAPPY24            0x2d7
+#define BTN_TRIGGER_HAPPY25            0x2d8
+#define BTN_TRIGGER_HAPPY26            0x2d9
+#define BTN_TRIGGER_HAPPY27            0x2da
+#define BTN_TRIGGER_HAPPY28            0x2db
+#define BTN_TRIGGER_HAPPY29            0x2dc
+#define BTN_TRIGGER_HAPPY30            0x2dd
+#define BTN_TRIGGER_HAPPY31            0x2de
+#define BTN_TRIGGER_HAPPY32            0x2df
+#define BTN_TRIGGER_HAPPY33            0x2e0
+#define BTN_TRIGGER_HAPPY34            0x2e1
+#define BTN_TRIGGER_HAPPY35            0x2e2
+#define BTN_TRIGGER_HAPPY36            0x2e3
+#define BTN_TRIGGER_HAPPY37            0x2e4
+#define BTN_TRIGGER_HAPPY38            0x2e5
+#define BTN_TRIGGER_HAPPY39            0x2e6
+#define BTN_TRIGGER_HAPPY40            0x2e7
+
 /* We avoid low common keys in module aliases so they don't get huge. */
 #define KEY_MIN_INTERESTING    KEY_MUTE
 #define KEY_MAX                        0x2ff
@@ -660,6 +703,7 @@ struct input_absinfo {
 #define ABS_MT_TOOL_TYPE       0x37    /* Type of touching device */
 #define ABS_MT_BLOB_ID         0x38    /* Group a set of packets as a blob */
 #define ABS_MT_TRACKING_ID     0x39    /* Unique ID of initiated contact */
+#define ABS_MT_PRESSURE                0x3a    /* Pressure on contact area */
 
 #define ABS_MAX                        0x3f
 #define ABS_CNT                        (ABS_MAX+1)
index a63235996309cee04c7343d7eed480779bd9b994..78ef023227d4bbcabc5e5d72d3126462c9b9ca26 100644 (file)
@@ -4,32 +4,6 @@
 #include <linux/radix-tree.h>
 #include <linux/rcupdate.h>
 
-/*
- * This is the per-process anticipatory I/O scheduler state.
- */
-struct as_io_context {
-       spinlock_t lock;
-
-       void (*dtor)(struct as_io_context *aic); /* destructor */
-       void (*exit)(struct as_io_context *aic); /* called on task exit */
-
-       unsigned long state;
-       atomic_t nr_queued; /* queued reads & sync writes */
-       atomic_t nr_dispatched; /* number of requests gone to the drivers */
-
-       /* IO History tracking */
-       /* Thinktime */
-       unsigned long last_end_request;
-       unsigned long ttime_total;
-       unsigned long ttime_samples;
-       unsigned long ttime_mean;
-       /* Layout pattern */
-       unsigned int seek_samples;
-       sector_t last_request_pos;
-       u64 seek_total;
-       sector_t seek_mean;
-};
-
 struct cfq_queue;
 struct cfq_io_context {
        void *key;
@@ -78,7 +52,6 @@ struct io_context {
        unsigned long last_waited; /* Time last woken after wait for request */
        int nr_batch_requests;     /* Number of requests left in the batch */
 
-       struct as_io_context *aic;
        struct radix_tree_root radix_root;
        struct hlist_head cic_list;
        void *ioc_data;
index 7129504e053d29c722706990059c77596f3e7c2d..dda98410d588c1741dd9edbcd484d07f3e99aeec 100644 (file)
@@ -112,6 +112,7 @@ extern struct resource iomem_resource;
 
 extern int request_resource(struct resource *root, struct resource *new);
 extern int release_resource(struct resource *new);
+void release_child_resources(struct resource *new);
 extern void reserve_region_with_split(struct resource *root,
                             resource_size_t start, resource_size_t end,
                             const char *name);
@@ -120,8 +121,10 @@ extern void insert_resource_expand_to_fit(struct resource *root, struct resource
 extern int allocate_resource(struct resource *root, struct resource *new,
                             resource_size_t size, resource_size_t min,
                             resource_size_t max, resource_size_t align,
-                            void (*alignf)(void *, struct resource *,
-                                           resource_size_t, resource_size_t),
+                            resource_size_t (*alignf)(void *,
+                                                      const struct resource *,
+                                                      resource_size_t,
+                                                      resource_size_t),
                             void *alignf_data);
 int adjust_resource(struct resource *res, resource_size_t start,
                    resource_size_t size);
index 3fc9f5aab5f8fd5f6deb82d464bf78f72940b40d..1221d2331a6dff1783f8cbe9caff2a2aed28d26b 100644 (file)
@@ -124,7 +124,7 @@ extern int _cond_resched(void);
 #endif
 
 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
-  void __might_sleep(char *file, int line, int preempt_offset);
+  void __might_sleep(const char *file, int line, int preempt_offset);
 /**
  * might_sleep - annotation for functions that can sleep
  *
@@ -138,7 +138,8 @@ extern int _cond_resched(void);
 # define might_sleep() \
        do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
 #else
-  static inline void __might_sleep(char *file, int line, int preempt_offset) { }
+  static inline void __might_sleep(const char *file, int line,
+                                  int preempt_offset) { }
 # define might_sleep() do { might_resched(); } while (0)
 #endif
 
@@ -734,6 +735,10 @@ struct sysinfo {
 /* Force a compilation error if condition is constant and true */
 #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
 
+/* Force a compilation error if a constant expression is not a power of 2 */
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n)                 \
+       BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
+
 /* Force a compilation error if condition is true, but also produce a
    result (of value 0 and type size_t), so the expression can be used
    e.g. in a structure initializer (or where-ever else comma expressions
index 7c6b32a1421c000b33f1fa924f3f7ec43b32c551..bc0fc795bd3536c90feb50b0ce4226c6461447e5 100644 (file)
@@ -67,7 +67,7 @@ struct kfifo {
 /**
  * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer
  * @name: name of the declared kfifo datatype
- * @size: size of the fifo buffer
+ * @size: size of the fifo buffer. Must be a power of two.
  *
  * Note1: the macro can be used inside struct or union declaration
  * Note2: the macro creates two objects:
@@ -91,7 +91,7 @@ union { \
 /**
  * DEFINE_KFIFO - macro to define and initialize a kfifo
  * @name: name of the declared kfifo datatype
- * @size: size of the fifo buffer
+ * @size: size of the fifo buffer. Must be a power of two.
  *
  * Note1: the macro can be used for global and local kfifo data type variables
  * Note2: the macro creates two objects:
@@ -104,15 +104,28 @@ union { \
 
 #undef __kfifo_initializer
 
-extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer,
+extern void kfifo_init(struct kfifo *fifo, void *buffer,
                        unsigned int size);
 extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size,
                        gfp_t gfp_mask);
 extern void kfifo_free(struct kfifo *fifo);
 extern unsigned int kfifo_in(struct kfifo *fifo,
-                               const unsigned char *from, unsigned int len);
+                               const void *from, unsigned int len);
 extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
-                               unsigned char *to, unsigned int len);
+                               void *to, unsigned int len);
+extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
+                               void *to, unsigned int len, unsigned offset);
+
+/**
+ * kfifo_initialized - Check if kfifo is initialized.
+ * @fifo: fifo to check
+ * Return %true if FIFO is initialized, otherwise %false.
+ * Assumes the fifo was 0 before.
+ */
+static inline bool kfifo_initialized(struct kfifo *fifo)
+{
+       return fifo->buffer != NULL;
+}
 
 /**
  * kfifo_reset - removes the entire FIFO contents
@@ -194,7 +207,7 @@ static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo)
  * bytes copied.
  */
 static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
-               const unsigned char *from, unsigned int n, spinlock_t *lock)
+               const void *from, unsigned int n, spinlock_t *lock)
 {
        unsigned long flags;
        unsigned int ret;
@@ -219,7 +232,7 @@ static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
  * @to buffer and returns the number of copied bytes.
  */
 static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
-       unsigned char *to, unsigned int n, spinlock_t *lock)
+       void *to, unsigned int n, spinlock_t *lock)
 {
        unsigned long flags;
        unsigned int ret;
@@ -228,13 +241,6 @@ static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
 
        ret = kfifo_out(fifo, to, n);
 
-       /*
-        * optimization: if the FIFO is empty, set the indices to 0
-        * so we don't wrap the next time
-        */
-       if (kfifo_is_empty(fifo))
-               kfifo_reset(fifo);
-
        spin_unlock_irqrestore(lock, flags);
 
        return ret;
@@ -242,11 +248,11 @@ static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
 
 extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
 
-extern __must_check unsigned int kfifo_from_user(struct kfifo *fifo,
-       const void __user *from, unsigned int n);
+extern __must_check int kfifo_from_user(struct kfifo *fifo,
+       const void __user *from, unsigned int n, unsigned *lenout);
 
-extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo,
-       void __user *to, unsigned int n);
+extern __must_check int kfifo_to_user(struct kfifo *fifo,
+       void __user *to, unsigned int n, unsigned *lenout);
 
 /*
  * __kfifo_add_out internal helper function for updating the out offset
index e32aa268efacd6bce48356ddda9fe2d126adfc27..24b44145a886f75115ce0dc8b4c70d6a67aca163 100644 (file)
@@ -17,6 +17,7 @@
 enum kmsg_dump_reason {
        KMSG_DUMP_OOPS,
        KMSG_DUMP_PANIC,
+       KMSG_DUMP_KEXEC,
 };
 
 /**
index 969f6e92d0895a93b593829159bdef20220b0dcb..5d9c6558e8abf44d19326170e834aaac079581e0 100644 (file)
@@ -205,6 +205,20 @@ static inline int list_empty_careful(const struct list_head *head)
        return (next == head) && (next == head->prev);
 }
 
+/**
+ * list_rotate_left - rotate the list to the left
+ * @head: the head of the list
+ */
+static inline void list_rotate_left(struct list_head *head)
+{
+       struct list_head *first;
+
+       if (!list_empty(head)) {
+               first = head->next;
+               list_move_tail(first, head);
+       }
+}
+
 /**
  * list_is_singular - tests whether a list has just one entry.
  * @head: the list to test.
index ef82b8fcbddbdf169d9c71eae0db4b78c5e4b110..f3d14333ebedeca7ea467aeb99227878c23330b0 100644 (file)
@@ -42,6 +42,7 @@ extern void __init lmb_init(void);
 extern void __init lmb_analyze(void);
 extern long lmb_add(u64 base, u64 size);
 extern long lmb_remove(u64 base, u64 size);
+extern long __init lmb_free(u64 base, u64 size);
 extern long __init lmb_reserve(u64 base, u64 size);
 extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
                                u64 (*nid_range)(u64, u64, int *));
index 9ccf0e286b2a9dc3cd6b78cb18243a21e5768de1..10206a87da19647ef0120b1fa3f94bd744632dc8 100644 (file)
@@ -534,4 +534,8 @@ do {                                                                        \
 # define might_lock_read(lock) do { } while (0)
 #endif
 
+#ifdef CONFIG_PROVE_RCU
+extern void lockdep_rcu_dereference(const char *file, const int line);
+#endif
+
 #endif /* __LINUX_LOCKDEP_H */
index 6b9c5d06690c8d9f82bd99a19e215b9fc8e1a683..9cb1834deffae2a6a028409009f7222c71801711 100644 (file)
@@ -2,6 +2,8 @@
 #define MFD_TMIO_H
 
 #include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
 
 #define tmio_ioread8(addr) readb(addr)
 #define tmio_ioread16(addr) readw(addr)
        writew((val) >> 16, (addr) + 2); \
        } while (0)
 
+#define CNF_CMD     0x04
+#define CNF_CTL_BASE   0x10
+#define CNF_INT_PIN  0x3d
+#define CNF_STOP_CLK_CTL 0x40
+#define CNF_GCLK_CTL 0x41
+#define CNF_SD_CLK_MODE 0x42
+#define CNF_PIN_STATUS 0x44
+#define CNF_PWR_CTL_1 0x48
+#define CNF_PWR_CTL_2 0x49
+#define CNF_PWR_CTL_3 0x4a
+#define CNF_CARD_DETECT_MODE 0x4c
+#define CNF_SD_SLOT 0x50
+#define CNF_EXT_GCLK_CTL_1 0xf0
+#define CNF_EXT_GCLK_CTL_2 0xf1
+#define CNF_EXT_GCLK_CTL_3 0xf9
+#define CNF_SD_LED_EN_1 0xfa
+#define CNF_SD_LED_EN_2 0xfe
+
+#define   SDCREN 0x2   /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/
+
+#define sd_config_write8(base, shift, reg, val) \
+       tmio_iowrite8((val), (base) + ((reg) << (shift)))
+#define sd_config_write16(base, shift, reg, val) \
+       tmio_iowrite16((val), (base) + ((reg) << (shift)))
+#define sd_config_write32(base, shift, reg, val) \
+       do { \
+               tmio_iowrite16((val), (base) + ((reg) << (shift)));   \
+               tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
+       } while (0)
+
+int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
+int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
+void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
+void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
+
 /*
  * data for the MMC controller
  */
 struct tmio_mmc_data {
        const unsigned int              hclk;
+       void (*set_pwr)(struct platform_device *host, int state);
+       void (*set_clk_div)(struct platform_device *host, int state);
 };
 
 /*
index be3264e286e0199588ee651c772ad16552ac70a5..e786fe9841ef41aa44e497fea46e837c611ace3d 100644 (file)
 #define WM8350_ISINK_FLASH_DUR_64MS            (1 << 8)
 #define WM8350_ISINK_FLASH_DUR_96MS            (2 << 8)
 #define WM8350_ISINK_FLASH_DUR_1024MS          (3 << 8)
-#define WM8350_ISINK_FLASH_ON_INSTANT          (0 << 4)
-#define WM8350_ISINK_FLASH_ON_0_25S            (1 << 4)
-#define WM8350_ISINK_FLASH_ON_0_50S            (2 << 4)
-#define WM8350_ISINK_FLASH_ON_1_00S            (3 << 4)
-#define WM8350_ISINK_FLASH_ON_1_95S            (1 << 4)
-#define WM8350_ISINK_FLASH_ON_3_91S            (2 << 4)
-#define WM8350_ISINK_FLASH_ON_7_80S            (3 << 4)
-#define WM8350_ISINK_FLASH_OFF_INSTANT         (0 << 0)
-#define WM8350_ISINK_FLASH_OFF_0_25S           (1 << 0)
-#define WM8350_ISINK_FLASH_OFF_0_50S           (2 << 0)
-#define WM8350_ISINK_FLASH_OFF_1_00S           (3 << 0)
-#define WM8350_ISINK_FLASH_OFF_1_95S           (1 << 0)
-#define WM8350_ISINK_FLASH_OFF_3_91S           (2 << 0)
-#define WM8350_ISINK_FLASH_OFF_7_80S           (3 << 0)
+#define WM8350_ISINK_FLASH_ON_INSTANT          (0 << 0)
+#define WM8350_ISINK_FLASH_ON_0_25S            (1 << 0)
+#define WM8350_ISINK_FLASH_ON_0_50S            (2 << 0)
+#define WM8350_ISINK_FLASH_ON_1_00S            (3 << 0)
+#define WM8350_ISINK_FLASH_ON_1_95S            (1 << 0)
+#define WM8350_ISINK_FLASH_ON_3_91S            (2 << 0)
+#define WM8350_ISINK_FLASH_ON_7_80S            (3 << 0)
+#define WM8350_ISINK_FLASH_OFF_INSTANT         (0 << 4)
+#define WM8350_ISINK_FLASH_OFF_0_25S           (1 << 4)
+#define WM8350_ISINK_FLASH_OFF_0_50S           (2 << 4)
+#define WM8350_ISINK_FLASH_OFF_1_00S           (3 << 4)
+#define WM8350_ISINK_FLASH_OFF_1_95S           (1 << 4)
+#define WM8350_ISINK_FLASH_OFF_3_91S           (2 << 4)
+#define WM8350_ISINK_FLASH_OFF_7_80S           (3 << 4)
 
 /*
  * Regulator Interrupts.
index 2265f28eb47a92bd858c0bf664b37a46d41b1831..8b2fa8593c61935f36ffa128d72c7236c198e119 100644 (file)
@@ -265,6 +265,8 @@ static inline int get_page_unless_zero(struct page *page)
        return atomic_inc_not_zero(&page->_count);
 }
 
+extern int page_is_ram(unsigned long pfn);
+
 /* Support for virtually mapped pages */
 struct page *vmalloc_to_page(const void *addr);
 unsigned long vmalloc_to_pfn(const void *addr);
@@ -1089,6 +1091,7 @@ extern void zone_pcp_update(struct zone *zone);
 
 /* nommu.c */
 extern atomic_long_t mmap_pages_allocated;
+extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
 
 /* prio_tree.c */
 void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
index 84d020bed0830eecb4ffd3e678d2c64f7ff4ddc1..36f96271306c728f17ebfc23f538acd092ed2dac 100644 (file)
@@ -122,7 +122,7 @@ struct vm_region {
        unsigned long   vm_pgoff;       /* the offset in vm_file corresponding to vm_start */
        struct file     *vm_file;       /* the backing file or NULL */
 
-       atomic_t        vm_usage;       /* region usage count */
+       int             vm_usage;       /* region usage count (access under nommu_region_sem) */
        bool            vm_icache_flushed : 1; /* true if the icache has been flushed for
                                                * this region */
 };
@@ -205,10 +205,12 @@ struct mm_struct {
        struct vm_area_struct * mmap;           /* list of VMAs */
        struct rb_root mm_rb;
        struct vm_area_struct * mmap_cache;     /* last find_vma result */
+#ifdef CONFIG_MMU
        unsigned long (*get_unmapped_area) (struct file *filp,
                                unsigned long addr, unsigned long len,
                                unsigned long pgoff, unsigned long flags);
        void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
+#endif
        unsigned long mmap_base;                /* base of mmap area */
        unsigned long task_size;                /* size of task vm space */
        unsigned long cached_hole_size;         /* if non-zero, the largest hole below free_area_cache */
diff --git a/include/linux/mtd/pismo.h b/include/linux/mtd/pismo.h
new file mode 100644 (file)
index 0000000..8dfb7e1
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * PISMO memory driver - http://www.pismoworld.org/
+ *
+ * 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.
+ */
+#ifndef __LINUX_MTD_PISMO_H
+#define __LINUX_MTD_PISMO_H
+
+struct pismo_pdata {
+       void                    (*set_vpp)(void *, int);
+       void                    *vpp_data;
+       phys_addr_t             cs_addrs[5];
+};
+
+#endif
index e77c1cea404df8c8ba8b6c253b592bbe2dbfd7e1..ab77609ec33738f555eeb48518c28915d71d8d78 100644 (file)
@@ -51,6 +51,8 @@
 #define _4ECCCNTEN     (0x1 << 24)
 #define _4ECCEN                (0x1 << 23)
 #define _4ECCCORRECT   (0x1 << 22)
+#define SHBUSSEL       (0x1 << 20)
+#define SEL_16BIT      (0x1 << 19)
 #define SNAND_E                (0x1 << 18)     /* SNAND (0=512 1=2048)*/
 #define QTSEL_E                (0x1 << 17)
 #define ENDIAN         (0x1 << 16)     /* 1 = little endian */
@@ -96,6 +98,7 @@
 struct sh_flctl {
        struct mtd_info         mtd;
        struct nand_chip        chip;
+       struct platform_device  *pdev;
        void __iomem            *reg;
 
        uint8_t done_buff[2048 + 64];   /* max size 2048 + 64 */
index e7facd8fbce87a35aa25ccd1d2af5121dbba71a0..f6d9cbc39c9ca684907940822ead7425c9f2c5da 100644 (file)
 #include <linux/bitops.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
+#include <linux/spinlock.h>
+
+#include <asm/byteorder.h>
+
+#ifdef CONFIG_OF
 
 typedef u32 phandle;
 typedef u32 ihandle;
@@ -39,10 +44,7 @@ struct of_irq_controller;
 struct device_node {
        const char *name;
        const char *type;
-       phandle node;
-#if !defined(CONFIG_SPARC)
-       phandle linux_phandle;
-#endif
+       phandle phandle;
        char    *full_name;
 
        struct  property *properties;
@@ -63,6 +65,11 @@ struct device_node {
 #endif
 };
 
+/* Pointer for first entry in chain of all nodes. */
+extern struct device_node *allnodes;
+extern struct device_node *of_chosen;
+extern rwlock_t devtree_lock;
+
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
        return test_bit(flag, &n->_flags);
@@ -73,12 +80,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
        set_bit(flag, &n->_flags);
 }
 
-static inline void
-set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
-{
-       dn->pde = de;
-}
-
 extern struct device_node *of_find_all_nodes(struct device_node *prev);
 
 #if defined(CONFIG_SPARC)
@@ -101,26 +102,36 @@ extern void of_node_put(struct device_node *node);
  */
 
 /* Helper to read a big number; size is in cells (not bytes) */
-static inline u64 of_read_number(const u32 *cell, int size)
+static inline u64 of_read_number(const __be32 *cell, int size)
 {
        u64 r = 0;
        while (size--)
-               r = (r << 32) | *(cell++);
+               r = (r << 32) | be32_to_cpu(*(cell++));
        return r;
 }
 
 /* Like of_read_number, but we want an unsigned long result */
-#ifdef CONFIG_PPC32
-static inline unsigned long of_read_ulong(const u32 *cell, int size)
+static inline unsigned long of_read_ulong(const __be32 *cell, int size)
 {
-       return cell[size-1];
+       /* toss away upper bits if unsigned long is smaller than u64 */
+       return of_read_number(cell, size);
 }
-#else
-#define of_read_ulong(cell, size)      of_read_number(cell, size)
-#endif
 
 #include <asm/prom.h>
 
+/* Default #address and #size cells.  Allow arch asm/prom.h to override */
+#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+#endif
+
+/* Default string compare functions, Allow arch asm/prom.h to override */
+#if !defined(of_compat_cmp)
+#define of_compat_cmp(s1, s2, l)       strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)            strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)            strcasecmp((s1), (s2))
+#endif
+
 /* flag descriptions */
 #define OF_DYNAMIC     1 /* node and properties were allocated via kmalloc */
 #define OF_DETACHED    2 /* node has been detached from the device tree */
@@ -187,4 +198,19 @@ extern int of_parse_phandles_with_args(struct device_node *np,
        const char *list_name, const char *cells_name, int index,
        struct device_node **out_node, const void **out_args);
 
+extern int of_machine_is_compatible(const char *compat);
+
+extern int prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+                               struct property *newprop,
+                               struct property *oldprop);
+
+#if defined(CONFIG_OF_DYNAMIC)
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+#endif
+
+#endif /* CONFIG_OF */
 #endif /* _LINUX_OF_H */
index 41d432b13553ad32799962e69235f324ca5c56a0..a1ca92ccb0ff65dc06241ab2ac7bb04bf44c7f92 100644 (file)
  * ends when size is 0
  */
 struct boot_param_header {
-       u32     magic;                  /* magic word OF_DT_HEADER */
-       u32     totalsize;              /* total size of DT block */
-       u32     off_dt_struct;          /* offset to structure */
-       u32     off_dt_strings;         /* offset to strings */
-       u32     off_mem_rsvmap;         /* offset to memory reserve map */
-       u32     version;                /* format version */
-       u32     last_comp_version;      /* last compatible version */
+       __be32  magic;                  /* magic word OF_DT_HEADER */
+       __be32  totalsize;              /* total size of DT block */
+       __be32  off_dt_struct;          /* offset to structure */
+       __be32  off_dt_strings;         /* offset to strings */
+       __be32  off_mem_rsvmap;         /* offset to memory reserve map */
+       __be32  version;                /* format version */
+       __be32  last_comp_version;      /* last compatible version */
        /* version 2 fields below */
-       u32     boot_cpuid_phys;        /* Physical CPU id we're booting on */
+       __be32  boot_cpuid_phys;        /* Physical CPU id we're booting on */
        /* version 3 fields below */
-       u32     dt_strings_size;        /* size of the DT strings block */
+       __be32  dt_strings_size;        /* size of the DT strings block */
        /* version 17 fields below */
-       u32     dt_struct_size;         /* size of the DT structure block */
+       __be32  dt_struct_size;         /* size of the DT structure block */
 };
 
+/* TBD: Temporary export of fdt globals - remove when code fully merged */
+extern int __initdata dt_root_addr_cells;
+extern int __initdata dt_root_size_cells;
+extern struct boot_param_header *initial_boot_params;
+
 /* For scanning the flat device-tree at boot time */
-extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
-                                           const char *uname, int depth,
-                                           void *data),
-                                 void *data);
-extern void __init *of_get_flat_dt_prop(unsigned long node, const char *name,
-                                       unsigned long *size);
-extern int __init of_flat_dt_is_compatible(unsigned long node,
-                                          const char *name);
-extern unsigned long __init of_get_flat_dt_root(void);
+extern char *find_flat_dt_string(u32 offset);
+extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
+                                    int depth, void *data),
+                          void *data);
+extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
+                                unsigned long *size);
+extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
+extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_scan_chosen_arch(unsigned long node);
+extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
+                                    int depth, void *data);
+extern void early_init_dt_check_for_initrd(unsigned long node);
+extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
+                                    int depth, void *data);
+extern void early_init_dt_add_memory_arch(u64 base, u64 size);
+extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
+extern u64 dt_mem_next_cell(int s, __be32 **cellp);
+
+/*
+ * If BLK_DEV_INITRD, the fdt early init code will call this function,
+ * to be provided by the arch code. start and end are specified as
+ * physical addresses.
+ */
+#ifdef CONFIG_BLK_DEV_INITRD
+extern void early_init_dt_setup_initrd_arch(unsigned long start,
+                                           unsigned long end);
+#endif
+
+/* Early flat tree scan hooks */
+extern int early_init_dt_scan_root(unsigned long node, const char *uname,
+                                  int depth, void *data);
 
 /* Other Prototypes */
-extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);
 extern void early_init_devtree(void *);
-extern int machine_is_compatible(const char *compat);
-extern void print_properties(struct device_node *node);
-extern int prom_n_intr_cells(struct device_node* np);
-extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern int prom_add_property(struct device_node* np, struct property* prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
-                               struct property *newprop,
-                               struct property *oldprop);
 
 #endif /* __ASSEMBLY__ */
 #endif /* _LINUX_OF_FDT_H */
diff --git a/include/linux/padata.h b/include/linux/padata.h
new file mode 100644 (file)
index 0000000..51611da
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * padata.h - header for the padata parallelization interface
+ *
+ * Copyright (C) 2008, 2009 secunet Security Networks AG
+ * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PADATA_H
+#define PADATA_H
+
+#include <linux/workqueue.h>
+#include <linux/spinlock.h>
+#include <linux/list.h>
+
+struct padata_priv {
+       struct list_head        list;
+       struct parallel_data    *pd;
+       int                     cb_cpu;
+       int                     seq_nr;
+       int                     info;
+       void                    (*parallel)(struct padata_priv *padata);
+       void                    (*serial)(struct padata_priv *padata);
+};
+
+struct padata_list {
+       struct list_head        list;
+       spinlock_t              lock;
+};
+
+struct padata_queue {
+       struct padata_list      parallel;
+       struct padata_list      reorder;
+       struct padata_list      serial;
+       struct work_struct      pwork;
+       struct work_struct      swork;
+       struct parallel_data    *pd;
+       atomic_t                num_obj;
+       int                     cpu_index;
+};
+
+struct parallel_data {
+       struct padata_instance  *pinst;
+       struct padata_queue     *queue;
+       atomic_t                seq_nr;
+       atomic_t                reorder_objects;
+       atomic_t                refcnt;
+       unsigned int            max_seq_nr;
+       cpumask_var_t           cpumask;
+       spinlock_t              lock;
+};
+
+struct padata_instance {
+       struct notifier_block   cpu_notifier;
+       struct workqueue_struct *wq;
+       struct parallel_data    *pd;
+       cpumask_var_t           cpumask;
+       struct mutex            lock;
+       u8                      flags;
+#define        PADATA_INIT             1
+#define        PADATA_RESET            2
+};
+
+extern struct padata_instance *padata_alloc(const struct cpumask *cpumask,
+                                           struct workqueue_struct *wq);
+extern void padata_free(struct padata_instance *pinst);
+extern int padata_do_parallel(struct padata_instance *pinst,
+                             struct padata_priv *padata, int cb_cpu);
+extern void padata_do_serial(struct padata_priv *padata);
+extern int padata_set_cpumask(struct padata_instance *pinst,
+                             cpumask_var_t cpumask);
+extern int padata_add_cpu(struct padata_instance *pinst, int cpu);
+extern int padata_remove_cpu(struct padata_instance *pinst, int cpu);
+extern void padata_start(struct padata_instance *pinst);
+extern void padata_stop(struct padata_instance *pinst);
+#endif
index ed5d7501e1819f217912808d6f6fc9e6f1f6f28e..3c62ed4084922c4f01977bb48ceb18ab4ce805d8 100644 (file)
@@ -253,6 +253,8 @@ extern struct page * read_cache_page_async(struct address_space *mapping,
 extern struct page * read_cache_page(struct address_space *mapping,
                                pgoff_t index, filler_t *filler,
                                void *data);
+extern struct page * read_cache_page_gfp(struct address_space *mapping,
+                               pgoff_t index, gfp_t gfp_mask);
 extern int read_cache_pages(struct address_space *mapping,
                struct list_head *pages, filler_t *filler, void *data);
 
index 93a7c08f869d4fcc7017862505156fdd21e24433..c8b6473c5f42a74ef58913836c24b54f8500fd2a 100644 (file)
 #include <linux/acpi.h>
 
 #ifdef CONFIG_ACPI
+extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev,
+                                                struct pci_bus *pci_bus);
+extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev);
+extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
+                                            struct pci_dev *pci_dev);
+extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev);
+
 static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
 {
        struct pci_bus *pbus = pdev->bus;
index 174e5392e51ed29975ed0439facc0d6e77af600c..25813738c71af86070065af9dd664f6c765c6e2d 100644 (file)
@@ -187,6 +187,33 @@ enum pci_bus_flags {
        PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
 };
 
+/* Based on the PCI Hotplug Spec, but some values are made up by us */
+enum pci_bus_speed {
+       PCI_SPEED_33MHz                 = 0x00,
+       PCI_SPEED_66MHz                 = 0x01,
+       PCI_SPEED_66MHz_PCIX            = 0x02,
+       PCI_SPEED_100MHz_PCIX           = 0x03,
+       PCI_SPEED_133MHz_PCIX           = 0x04,
+       PCI_SPEED_66MHz_PCIX_ECC        = 0x05,
+       PCI_SPEED_100MHz_PCIX_ECC       = 0x06,
+       PCI_SPEED_133MHz_PCIX_ECC       = 0x07,
+       PCI_SPEED_66MHz_PCIX_266        = 0x09,
+       PCI_SPEED_100MHz_PCIX_266       = 0x0a,
+       PCI_SPEED_133MHz_PCIX_266       = 0x0b,
+       AGP_UNKNOWN                     = 0x0c,
+       AGP_1X                          = 0x0d,
+       AGP_2X                          = 0x0e,
+       AGP_4X                          = 0x0f,
+       AGP_8X                          = 0x10,
+       PCI_SPEED_66MHz_PCIX_533        = 0x11,
+       PCI_SPEED_100MHz_PCIX_533       = 0x12,
+       PCI_SPEED_133MHz_PCIX_533       = 0x13,
+       PCIE_SPEED_2_5GT                = 0x14,
+       PCIE_SPEED_5_0GT                = 0x15,
+       PCIE_SPEED_8_0GT                = 0x16,
+       PCI_SPEED_UNKNOWN               = 0xff,
+};
+
 struct pci_cap_saved_state {
        struct hlist_node next;
        char cap_nr;
@@ -239,6 +266,7 @@ struct pci_dev {
                                           configuration space */
        unsigned int    pme_support:5;  /* Bitmask of states from which PME#
                                           can be generated */
+       unsigned int    pme_interrupt:1;
        unsigned int    d1_support:1;   /* Low power state D1 is supported */
        unsigned int    d2_support:1;   /* Low power state D2 is supported */
        unsigned int    no_d1d2:1;      /* Only allow D0 and D3 */
@@ -275,7 +303,8 @@ struct pci_dev {
        unsigned int    msix_enabled:1;
        unsigned int    ari_enabled:1;  /* ARI forwarding */
        unsigned int    is_managed:1;
-       unsigned int    is_pcie:1;
+       unsigned int    is_pcie:1;      /* Obsolete. Will be removed.
+                                          Use pci_is_pcie() instead */
        unsigned int    needs_freset:1; /* Dev requires fundamental reset */
        unsigned int    state_saved:1;
        unsigned int    is_physfn:1;
@@ -335,9 +364,26 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
        hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
 }
 
-#ifndef PCI_BUS_NUM_RESOURCES
-#define PCI_BUS_NUM_RESOURCES  16
-#endif
+/*
+ * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
+ * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
+ * buses below host bridges or subtractive decode bridges) go in the list.
+ * Use pci_bus_for_each_resource() to iterate through all the resources.
+ */
+
+/*
+ * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly
+ * and there's no way to program the bridge with the details of the window.
+ * This does not apply to ACPI _CRS windows, even with the _DEC subtractive-
+ * decode bit set, because they are explicit and can be programmed with _SRS.
+ */
+#define PCI_SUBTRACTIVE_DECODE 0x1
+
+struct pci_bus_resource {
+       struct list_head list;
+       struct resource *res;
+       unsigned int flags;
+};
 
 #define PCI_REGION_FLAG_MASK   0x0fU   /* These bits of resource flags tell us the PCI region flags */
 
@@ -348,8 +394,8 @@ struct pci_bus {
        struct list_head devices;       /* list of devices on this bus */
        struct pci_dev  *self;          /* bridge device as seen by parent */
        struct list_head slots;         /* list of slots on this bus */
-       struct resource *resource[PCI_BUS_NUM_RESOURCES];
-                                       /* address space routed to this bus */
+       struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
+       struct list_head resources;     /* address space routed to this bus */
 
        struct pci_ops  *ops;           /* configuration access functions */
        void            *sysdata;       /* hook for sys-specific extension */
@@ -359,6 +405,8 @@ struct pci_bus {
        unsigned char   primary;        /* number of primary bridge */
        unsigned char   secondary;      /* number of secondary bridge */
        unsigned char   subordinate;    /* max number of subordinate buses */
+       unsigned char   max_bus_speed;  /* enum pci_bus_speed */
+       unsigned char   cur_bus_speed;  /* enum pci_bus_speed */
 
        char            name[48];
 
@@ -563,7 +611,8 @@ int __must_check pcibios_enable_device(struct pci_dev *, int mask);
 char *pcibios_setup(char *str);
 
 /* Used only when drivers/pci/setup.c is used */
-void pcibios_align_resource(void *, struct resource *, resource_size_t,
+resource_size_t pcibios_align_resource(void *, const struct resource *,
+                               resource_size_t,
                                resource_size_t);
 void pcibios_update_irq(struct pci_dev *, int irq);
 
@@ -589,6 +638,7 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
                               struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
                                int busnr);
+void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
 struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
                                 const char *name,
                                 struct hotplug_slot *hotplug);
@@ -615,12 +665,6 @@ extern void pci_sort_breadthfirst(void);
 
 /* Generic PCI functions exported to card drivers */
 
-#ifdef CONFIG_PCI_LEGACY
-struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
-                                            unsigned int device,
-                                            struct pci_dev *from);
-#endif /* CONFIG_PCI_LEGACY */
-
 enum pci_lost_interrupt_reason {
        PCI_LOST_IRQ_NO_INFORMATION = 0,
        PCI_LOST_IRQ_DISABLE_MSI,
@@ -750,11 +794,23 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
 void pci_pme_active(struct pci_dev *dev, bool enable);
-int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable);
+int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
+                     bool runtime, bool enable);
 int pci_wake_from_d3(struct pci_dev *dev, bool enable);
 pci_power_t pci_target_state(struct pci_dev *dev);
 int pci_prepare_to_sleep(struct pci_dev *dev);
 int pci_back_from_sleep(struct pci_dev *dev);
+bool pci_dev_run_wake(struct pci_dev *dev);
+
+static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
+                                 bool enable)
+{
+       return __pci_enable_wake(dev, state, false, enable);
+}
+
+/* For use by arch with custom probe code */
+void set_pcie_port_type(struct pci_dev *pdev);
+void set_pcie_hotplug_bridge(struct pci_dev *pdev);
 
 /* Functions for PCI Hotplug drivers to use */
 int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
@@ -772,6 +828,7 @@ void pci_bus_assign_resources(const struct pci_bus *bus);
 void pci_bus_size_bridges(struct pci_bus *bus);
 int pci_claim_resource(struct pci_dev *, int);
 void pci_assign_unassigned_resources(void);
+void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
 void pdev_enable_device(struct pci_dev *);
 void pdev_sort_resources(struct pci_dev *, struct resource_list *);
 int pci_enable_resources(struct pci_dev *, int mask);
@@ -789,12 +846,23 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
 void pci_release_selected_regions(struct pci_dev *, int);
 
 /* drivers/pci/bus.c */
+void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
+struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
+void pci_bus_remove_resources(struct pci_bus *bus);
+
+#define pci_bus_for_each_resource(bus, res, i)                         \
+       for (i = 0;                                                     \
+           (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \
+            i++)
+
 int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
                        struct resource *res, resource_size_t size,
                        resource_size_t align, resource_size_t min,
                        unsigned int type_mask,
-                       void (*alignf)(void *, struct resource *,
-                               resource_size_t, resource_size_t),
+                       resource_size_t (*alignf)(void *,
+                                                 const struct resource *,
+                                                 resource_size_t,
+                                                 resource_size_t),
                        void *alignf_data);
 void pci_enable_bridges(struct pci_bus *bus);
 
@@ -955,6 +1023,11 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 }
 #endif /* CONFIG_PCI_DOMAINS */
 
+/* some architectures require additional setup to direct VGA traffic */
+typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
+                     unsigned int command_bits, bool change_bridge);
+extern void pci_register_set_vga_state(arch_set_vga_state_t func);
+
 #else /* CONFIG_PCI is not enabled */
 
 /*
@@ -973,13 +1046,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 _PCI_NOP_ALL(read, *)
 _PCI_NOP_ALL(write,)
 
-static inline struct pci_dev *pci_find_device(unsigned int vendor,
-                                             unsigned int device,
-                                             struct pci_dev *from)
-{
-       return NULL;
-}
-
 static inline struct pci_dev *pci_get_device(unsigned int vendor,
                                             unsigned int device,
                                             struct pci_dev *from)
@@ -1237,8 +1303,12 @@ enum pci_fixup_pass {
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend,                   \
                        suspend##vendor##device##hook, vendor, device, hook)
 
-
+#ifdef CONFIG_PCI_QUIRKS
 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
+#else
+static inline void pci_fixup_device(enum pci_fixup_pass pass,
+                                   struct pci_dev *dev) {}
+#endif
 
 void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
 void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
index 652ba797696dd7c5274abb292cc30e1ba6e34081..5d09cbafa7dbfa17b814866e6f56e306f75351d7 100644 (file)
 #ifndef _PCI_HOTPLUG_H
 #define _PCI_HOTPLUG_H
 
-
-/* These values come from the PCI Hotplug Spec */
-enum pci_bus_speed {
-       PCI_SPEED_33MHz                 = 0x00,
-       PCI_SPEED_66MHz                 = 0x01,
-       PCI_SPEED_66MHz_PCIX            = 0x02,
-       PCI_SPEED_100MHz_PCIX           = 0x03,
-       PCI_SPEED_133MHz_PCIX           = 0x04,
-       PCI_SPEED_66MHz_PCIX_ECC        = 0x05,
-       PCI_SPEED_100MHz_PCIX_ECC       = 0x06,
-       PCI_SPEED_133MHz_PCIX_ECC       = 0x07,
-       PCI_SPEED_66MHz_PCIX_266        = 0x09,
-       PCI_SPEED_100MHz_PCIX_266       = 0x0a,
-       PCI_SPEED_133MHz_PCIX_266       = 0x0b,
-       PCI_SPEED_66MHz_PCIX_533        = 0x11,
-       PCI_SPEED_100MHz_PCIX_533       = 0x12,
-       PCI_SPEED_133MHz_PCIX_533       = 0x13,
-       PCI_SPEED_UNKNOWN               = 0xff,
-};
-
 /* These values come from the PCI Express Spec */
 enum pcie_link_width {
        PCIE_LNK_WIDTH_RESRV    = 0x00,
@@ -61,12 +41,6 @@ enum pcie_link_width {
        PCIE_LNK_WIDTH_UNKNOWN  = 0xFF,
 };
 
-enum pcie_link_speed {
-       PCIE_2_5GB              = 0x14,
-       PCIE_5_0GB              = 0x15,
-       PCIE_LNK_SPEED_UNKNOWN  = 0xFF,
-};
-
 /**
  * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
  * @owner: The module owner of this structure
@@ -89,12 +63,6 @@ enum pcie_link_speed {
  * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
  *     If this field is NULL, the value passed in the struct hotplug_slot_info
  *     will be used when this value is requested by a user.
- * @get_max_bus_speed: Called to get the max bus speed for a slot.
- *     If this field is NULL, the value passed in the struct hotplug_slot_info
- *     will be used when this value is requested by a user.
- * @get_cur_bus_speed: Called to get the current bus speed for a slot.
- *     If this field is NULL, the value passed in the struct hotplug_slot_info
- *     will be used when this value is requested by a user.
  *
  * The table of function pointers that is passed to the hotplug pci core by a
  * hotplug pci driver.  These functions are called by the hotplug pci core when
@@ -112,17 +80,14 @@ struct hotplug_slot_ops {
        int (*get_attention_status)     (struct hotplug_slot *slot, u8 *value);
        int (*get_latch_status)         (struct hotplug_slot *slot, u8 *value);
        int (*get_adapter_status)       (struct hotplug_slot *slot, u8 *value);
-       int (*get_max_bus_speed)        (struct hotplug_slot *slot, enum pci_bus_speed *value);
-       int (*get_cur_bus_speed)        (struct hotplug_slot *slot, enum pci_bus_speed *value);
 };
 
 /**
  * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot
- * @power: if power is enabled or not (1/0)
+ * @power_status: if power is enabled or not (1/0)
  * @attention_status: if the attention light is enabled or not (1/0)
  * @latch_status: if the latch (if any) is open or closed (1/0)
- * @adapter_present: if there is a pci board present in the slot or not (1/0)
- * @address: (domain << 16 | bus << 8 | dev)
+ * @adapter_status: if there is a pci board present in the slot or not (1/0)
  *
  * Used to notify the hotplug pci core of the status of a specific slot.
  */
@@ -131,8 +96,6 @@ struct hotplug_slot_info {
        u8      attention_status;
        u8      latch_status;
        u8      adapter_status;
-       enum pci_bus_speed      max_bus_speed;
-       enum pci_bus_speed      cur_bus_speed;
 };
 
 /**
index cca8a044e2b6b34d12fa8d215341e37dc8bfaa2e..0be82432058027a776709c590f51e24991aca869 100644 (file)
 #define PCI_DEVICE_ID_INTEL_82840_HB   0x1a21
 #define PCI_DEVICE_ID_INTEL_82845_HB   0x1a30
 #define PCI_DEVICE_ID_INTEL_IOAT       0x1a38
+#define PCI_DEVICE_ID_INTEL_CPT_SMBUS  0x1c22
+#define PCI_DEVICE_ID_INTEL_CPT_LPC1   0x1c42
+#define PCI_DEVICE_ID_INTEL_CPT_LPC2   0x1c43
 #define PCI_DEVICE_ID_INTEL_82801AA_0  0x2410
 #define PCI_DEVICE_ID_INTEL_82801AA_1  0x2411
 #define PCI_DEVICE_ID_INTEL_82801AA_3  0x2413
index a7684a513994725335ac078d457c6a7a02d78455..794662b2be5df175e81ad86840ede63bdf244370 100644 (file)
@@ -98,9 +98,6 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
        fbc->count = amount;
 }
 
-#define __percpu_counter_add(fbc, amount, batch) \
-       percpu_counter_add(fbc, amount)
-
 static inline void
 percpu_counter_add(struct percpu_counter *fbc, s64 amount)
 {
@@ -109,6 +106,12 @@ percpu_counter_add(struct percpu_counter *fbc, s64 amount)
        preempt_enable();
 }
 
+static inline void
+__percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
+{
+       percpu_counter_add(fbc, amount);
+}
+
 static inline s64 percpu_counter_read(struct percpu_counter *fbc)
 {
        return fbc->count;
index c66b34f75eea5f82662cbe3dcba81198248ee56e..7b18b4fd5df7b80686e8db84e2b912a9e1a05ae1 100644 (file)
@@ -211,11 +211,9 @@ struct perf_event_attr {
                __u32           wakeup_watermark; /* bytes before wakeup   */
        };
 
-       __u32                   __reserved_2;
-
-       __u64                   bp_addr;
        __u32                   bp_type;
-       __u32                   bp_len;
+       __u64                   bp_addr;
+       __u64                   bp_len;
 };
 
 /*
@@ -290,7 +288,7 @@ struct perf_event_mmap_page {
 };
 
 #define PERF_RECORD_MISC_CPUMODE_MASK          (3 << 0)
-#define PERF_RECORD_MISC_CPUMODE_UNKNOWN               (0 << 0)
+#define PERF_RECORD_MISC_CPUMODE_UNKNOWN       (0 << 0)
 #define PERF_RECORD_MISC_KERNEL                        (1 << 0)
 #define PERF_RECORD_MISC_USER                  (2 << 0)
 #define PERF_RECORD_MISC_HYPERVISOR            (3 << 0)
@@ -356,8 +354,8 @@ enum perf_event_type {
         *      u64                             stream_id;
         * };
         */
-       PERF_RECORD_THROTTLE            = 5,
-       PERF_RECORD_UNTHROTTLE          = 6,
+       PERF_RECORD_THROTTLE                    = 5,
+       PERF_RECORD_UNTHROTTLE                  = 6,
 
        /*
         * struct {
@@ -371,10 +369,10 @@ enum perf_event_type {
 
        /*
         * struct {
-        *      struct perf_event_header        header;
-        *      u32                             pid, tid;
+        *      struct perf_event_header        header;
+        *      u32                             pid, tid;
         *
-        *      struct read_format              values;
+        *      struct read_format              values;
         * };
         */
        PERF_RECORD_READ                        = 8,
@@ -412,7 +410,7 @@ enum perf_event_type {
         *        char                  data[size];}&& PERF_SAMPLE_RAW
         * };
         */
-       PERF_RECORD_SAMPLE              = 9,
+       PERF_RECORD_SAMPLE                      = 9,
 
        PERF_RECORD_MAX,                        /* non-ABI */
 };
@@ -478,9 +476,11 @@ struct hw_perf_event {
        union {
                struct { /* hardware */
                        u64             config;
+                       u64             last_tag;
                        unsigned long   config_base;
                        unsigned long   event_base;
                        int             idx;
+                       int             last_cpu;
                };
                struct { /* software */
                        s64             remaining;
@@ -498,9 +498,8 @@ struct hw_perf_event {
        atomic64_t                      period_left;
        u64                             interrupts;
 
-       u64                             freq_count;
-       u64                             freq_interrupts;
-       u64                             freq_stamp;
+       u64                             freq_time_stamp;
+       u64                             freq_count_stamp;
 #endif
 };
 
@@ -512,6 +511,8 @@ struct perf_event;
 struct pmu {
        int (*enable)                   (struct perf_event *event);
        void (*disable)                 (struct perf_event *event);
+       int (*start)                    (struct perf_event *event);
+       void (*stop)                    (struct perf_event *event);
        void (*read)                    (struct perf_event *event);
        void (*unthrottle)              (struct perf_event *event);
 };
@@ -565,6 +566,10 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
                                        struct perf_sample_data *,
                                        struct pt_regs *regs);
 
+enum perf_group_flag {
+       PERF_GROUP_SOFTWARE = 0x1,
+};
+
 /**
  * struct perf_event - performance event kernel representation:
  */
@@ -574,6 +579,7 @@ struct perf_event {
        struct list_head                event_entry;
        struct list_head                sibling_list;
        int                             nr_siblings;
+       int                             group_flags;
        struct perf_event               *group_leader;
        struct perf_event               *output;
        const struct pmu                *pmu;
@@ -658,7 +664,7 @@ struct perf_event {
 
        perf_overflow_handler_t         overflow_handler;
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_EVENT_TRACING
        struct event_filter             *filter;
 #endif
 
@@ -683,7 +689,8 @@ struct perf_event_context {
         */
        struct mutex                    mutex;
 
-       struct list_head                group_list;
+       struct list_head                pinned_groups;
+       struct list_head                flexible_groups;
        struct list_head                event_list;
        int                             nr_events;
        int                             nr_active;
@@ -746,10 +753,9 @@ extern int perf_max_events;
 
 extern const struct pmu *hw_perf_event_init(struct perf_event *event);
 
-extern void perf_event_task_sched_in(struct task_struct *task, int cpu);
-extern void perf_event_task_sched_out(struct task_struct *task,
-                                       struct task_struct *next, int cpu);
-extern void perf_event_task_tick(struct task_struct *task, int cpu);
+extern void perf_event_task_sched_in(struct task_struct *task);
+extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
+extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
@@ -764,7 +770,7 @@ extern int perf_event_task_disable(void);
 extern int perf_event_task_enable(void);
 extern int hw_perf_group_sched_in(struct perf_event *group_leader,
               struct perf_cpu_context *cpuctx,
-              struct perf_event_context *ctx, int cpu);
+              struct perf_event_context *ctx);
 extern void perf_event_update_userpage(struct perf_event *event);
 extern int perf_event_release_kernel(struct perf_event *event);
 extern struct perf_event *
@@ -814,9 +820,14 @@ extern int perf_event_overflow(struct perf_event *event, int nmi,
  */
 static inline int is_software_event(struct perf_event *event)
 {
-       return (event->attr.type != PERF_TYPE_RAW) &&
-               (event->attr.type != PERF_TYPE_HARDWARE) &&
-               (event->attr.type != PERF_TYPE_HW_CACHE);
+       switch (event->attr.type) {
+       case PERF_TYPE_SOFTWARE:
+       case PERF_TYPE_TRACEPOINT:
+       /* for now the breakpoint stuff also works as software event */
+       case PERF_TYPE_BREAKPOINT:
+               return 1;
+       }
+       return 0;
 }
 
 extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
@@ -848,8 +859,7 @@ extern int sysctl_perf_event_mlock;
 extern int sysctl_perf_event_sample_rate;
 
 extern void perf_event_init(void);
-extern void perf_tp_event(int event_id, u64 addr, u64 count,
-                                void *record, int entry_size);
+extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
@@ -870,12 +880,12 @@ extern void perf_event_enable(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 #else
 static inline void
-perf_event_task_sched_in(struct task_struct *task, int cpu)            { }
+perf_event_task_sched_in(struct task_struct *task)                     { }
 static inline void
 perf_event_task_sched_out(struct task_struct *task,
-                           struct task_struct *next, int cpu)          { }
+                           struct task_struct *next)                   { }
 static inline void
-perf_event_task_tick(struct task_struct *task, int cpu)                        { }
+perf_event_task_tick(struct task_struct *task                        { }
 static inline int perf_event_init_task(struct task_struct *child)      { return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)     { }
 static inline void perf_event_free_task(struct task_struct *task)      { }
@@ -890,13 +900,13 @@ static inline void
 perf_sw_event(u32 event_id, u64 nr, int nmi,
                     struct pt_regs *regs, u64 addr)                    { }
 static inline void
-perf_bp_event(struct perf_event *event, void *data)            { }
+perf_bp_event(struct perf_event *event, void *data)                    { }
 
 static inline void perf_event_mmap(struct vm_area_struct *vma)         { }
 static inline void perf_event_comm(struct task_struct *tsk)            { }
 static inline void perf_event_fork(struct task_struct *tsk)            { }
 static inline void perf_event_init(void)                               { }
-static inline int  perf_swevent_get_recursion_context(void)  { return -1; }
+static inline int  perf_swevent_get_recursion_context(void)            { return -1; }
 static inline void perf_swevent_put_recursion_context(int rctx)                { }
 static inline void perf_event_enable(struct perf_event *event)         { }
 static inline void perf_event_disable(struct perf_event *event)                { }
index 228b0b6306b04dcdaf7578606a4b4214b10c92a1..0b80c806631fc12d26a11d9f6e5d1f3b65e9066a 100644 (file)
@@ -315,6 +315,7 @@ struct sadb_x_kmaddress {
 #define SADB_X_EALG_AES_GCM_ICV12      19
 #define SADB_X_EALG_AES_GCM_ICV16      20
 #define SADB_X_EALG_CAMELLIACBC                22
+#define SADB_X_EALG_NULL_AES_GMAC      23
 #define SADB_EALG_MAX                   253 /* last EALG */
 /* private allocations should use 249-255 (RFC2407) */
 #define SADB_X_EALG_SERPENTCBC  252     /* draft-ietf-ipsec-ciph-aes-cbc-00 */
index 7968defd2fa7a45dbf06724410fb69d3f6c1f3af..6a7eb402165d0f6c4dfb8d647f3b2afe725ab4e7 100644 (file)
@@ -485,6 +485,7 @@ void phy_driver_unregister(struct phy_driver *drv);
 int phy_driver_register(struct phy_driver *new_driver);
 void phy_prepare_link(struct phy_device *phydev,
                void (*adjust_link)(struct net_device *));
+void phy_state_machine(struct work_struct *work);
 void phy_start_machine(struct phy_device *phydev,
                void (*handler)(struct net_device *));
 void phy_stop_machine(struct phy_device *phydev);
index 8227f717c70fbf021fd16c104e2950b646ccdc6e..6898985e7b387b6d9175827641be6ad82e51f409 100644 (file)
@@ -45,7 +45,7 @@
  * the insertion of new nodes. There are no nodes with duplicate
  * priorites on the list.
  *
- * The nodes on the node_list is ordered by priority and can contain
+ * The nodes on the node_list are ordered by priority and can contain
  * entries which have the same priority. Those entries are ordered
  * FIFO
  *
@@ -265,7 +265,7 @@ static inline int plist_node_empty(const struct plist_node *node)
  *
  * Assumes the plist is _not_ empty.
  */
-static inline struct plist_nodeplist_first(const struct plist_head *head)
+static inline struct plist_node *plist_first(const struct plist_head *head)
 {
        return list_entry(head->node_list.next,
                          struct plist_node, plist.node_list);
index 198b8f9fe05ec2ab97d351fbfba053f980869100..e80df06ad22ab1aaa7d86a76434a4a5b9a2aadf8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/spinlock.h>
 #include <linux/wait.h>
 #include <linux/timer.h>
+#include <linux/completion.h>
 
 /*
  * Callbacks for platform drivers to implement.
@@ -412,9 +413,11 @@ struct dev_pm_info {
        pm_message_t            power_state;
        unsigned int            can_wakeup:1;
        unsigned int            should_wakeup:1;
+       unsigned                async_suspend:1;
        enum dpm_state          status;         /* Owned by the PM core */
 #ifdef CONFIG_PM_SLEEP
        struct list_head        entry;
+       struct completion       completion;
 #endif
 #ifdef CONFIG_PM_RUNTIME
        struct timer_list       suspend_timer;
@@ -430,6 +433,7 @@ struct dev_pm_info {
        unsigned int            request_pending:1;
        unsigned int            deferred_resume:1;
        unsigned int            run_wake:1;
+       unsigned int            runtime_auto:1;
        enum rpm_request        request;
        enum rpm_status         runtime_status;
        int                     runtime_error;
@@ -508,6 +512,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
                __suspend_report_result(__func__, fn, ret);             \
        } while (0)
 
+extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
 #else /* !CONFIG_PM_SLEEP */
 
 #define device_pm_lock() do {} while (0)
@@ -520,6 +525,7 @@ static inline int dpm_suspend_start(pm_message_t state)
 
 #define suspend_report_result(fn, ret)         do {} while (0)
 
+static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
 #endif /* !CONFIG_PM_SLEEP */
 
 /* How to reorder dpm_list after device_move() */
index 370ce0a6fe4a8702f9c4f25de37f49c217dfd158..7d773aac5314765f131fd5f108a55f800ee3e589 100644 (file)
@@ -28,6 +28,8 @@ extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
 extern int pm_runtime_barrier(struct device *dev);
 extern void pm_runtime_enable(struct device *dev);
 extern void __pm_runtime_disable(struct device *dev, bool check_resume);
+extern void pm_runtime_allow(struct device *dev);
+extern void pm_runtime_forbid(struct device *dev);
 
 static inline bool pm_children_suspended(struct device *dev)
 {
@@ -78,6 +80,8 @@ static inline int __pm_runtime_set_status(struct device *dev,
 static inline int pm_runtime_barrier(struct device *dev) { return 0; }
 static inline void pm_runtime_enable(struct device *dev) {}
 static inline void __pm_runtime_disable(struct device *dev, bool c) {}
+static inline void pm_runtime_allow(struct device *dev) {}
+static inline void pm_runtime_forbid(struct device *dev) {}
 
 static inline bool pm_children_suspended(struct device *dev) { return false; }
 static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
index 56f2d63a5cbb6b6794959fe1553aa779e79912dd..c5eab89da51ecb10e57341a956b1f095fcff9f98 100644 (file)
 #define PTRACE_GETSIGINFO      0x4202
 #define PTRACE_SETSIGINFO      0x4203
 
+/*
+ * Generic ptrace interface that exports the architecture specific regsets
+ * using the corresponding NT_* types (which are also used in the core dump).
+ * Please note that the NT_PRSTATUS note type in a core dump contains a full
+ * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
+ * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
+ * other user_regset flavors, the user_regset layout and the ELF core dump note
+ * payload are exactly the same layout.
+ *
+ * This interface usage is as follows:
+ *     struct iovec iov = { buf, len};
+ *
+ *     ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
+ *
+ * On the successful completion, iov.len will be updated by the kernel,
+ * specifying how much the kernel has written/read to/from the user's iov.buf.
+ */
+#define PTRACE_GETREGSET       0x4204
+#define PTRACE_SETREGSET       0x4205
+
 /* options set using PTRACE_SETOPTIONS */
 #define PTRACE_O_TRACESYSGOOD  0x00000001
 #define PTRACE_O_TRACEFORK     0x00000002
index 6b537f1ac96c1caabf6a86ac57313b61cd963361..31e1ff69efc8c700b6ab3d8ed396f37813db18a3 100644 (file)
@@ -32,6 +32,7 @@ enum raid_level {
        RAID_LEVEL_0,
        RAID_LEVEL_1,
        RAID_LEVEL_10,
+       RAID_LEVEL_1E,
        RAID_LEVEL_3,
        RAID_LEVEL_4,
        RAID_LEVEL_5,
index 1bf0f708c4fcd61950e8b6e1ef8e504588317257..779d70749beb5318087a676a83929fa7b9309544 100644 (file)
@@ -208,7 +208,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
  * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
  */
 #define list_entry_rcu(ptr, type, member) \
-       container_of(rcu_dereference(ptr), type, member)
+       container_of(rcu_dereference_raw(ptr), type, member)
 
 /**
  * list_first_entry_rcu - get the first element from a list
@@ -225,9 +225,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
        list_entry_rcu((ptr)->next, type, member)
 
 #define __list_for_each_rcu(pos, head) \
-       for (pos = rcu_dereference((head)->next); \
+       for (pos = rcu_dereference_raw((head)->next); \
                pos != (head); \
-               pos = rcu_dereference(pos->next))
+               pos = rcu_dereference_raw(pos->next))
 
 /**
  * list_for_each_entry_rcu     -       iterate over rcu list of given type
@@ -257,9 +257,9 @@ static inline void list_splice_init_rcu(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) = rcu_dereference((pos)->next); \
+       for ((pos) = rcu_dereference_raw((pos)->next); \
                prefetch((pos)->next), (pos) != (head); \
-               (pos) = rcu_dereference((pos)->next))
+               (pos) = rcu_dereference_raw((pos)->next))
 
 /**
  * list_for_each_entry_continue_rcu - continue iteration over list of given type
@@ -418,10 +418,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
  * as long as the traversal is guarded by rcu_read_lock().
  */
 #define hlist_for_each_entry_rcu(tpos, pos, head, member)               \
-       for (pos = rcu_dereference((head)->first);                       \
+       for (pos = rcu_dereference_raw((head)->first);                   \
                pos && ({ prefetch(pos->next); 1; }) &&                  \
                ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
-               pos = rcu_dereference(pos->next))
+               pos = rcu_dereference_raw(pos->next))
 
 #endif /* __KERNEL__ */
 #endif
index 589a40919f01fb81a460d18b90a793ee6e9c439f..b70ffe53cb9fe77a668f57c2bc584216f90f95b6 100644 (file)
@@ -101,10 +101,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
  *
  */
 #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
-       for (pos = rcu_dereference((head)->first);                       \
+       for (pos = rcu_dereference_raw((head)->first);                   \
                (!is_a_nulls(pos)) &&                   \
                ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
-               pos = rcu_dereference(pos->next))
+               pos = rcu_dereference_raw(pos->next))
 
 #endif
 #endif
index 24440f4bf476cf6083b34b8cb9d1a06f57bcfd82..c84373626336c8afa29e14d14a0868034394ffe6 100644 (file)
@@ -62,6 +62,8 @@ extern int sched_expedited_torture_stats(char *page);
 
 /* Internal to kernel */
 extern void rcu_init(void);
+extern int rcu_scheduler_active;
+extern void rcu_scheduler_starting(void);
 
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
 #include <linux/rcutree.h>
@@ -78,14 +80,120 @@ extern void rcu_init(void);
 } while (0)
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
+
 extern struct lockdep_map rcu_lock_map;
-# define rcu_read_acquire()    \
-                       lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
+# define rcu_read_acquire() \
+               lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
 # define rcu_read_release()    lock_release(&rcu_lock_map, 1, _THIS_IP_)
-#else
-# define rcu_read_acquire()    do { } while (0)
-# define rcu_read_release()    do { } while (0)
-#endif
+
+extern struct lockdep_map rcu_bh_lock_map;
+# define rcu_read_acquire_bh() \
+               lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
+# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_)
+
+extern struct lockdep_map rcu_sched_lock_map;
+# define rcu_read_acquire_sched() \
+               lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
+# define rcu_read_release_sched() \
+               lock_release(&rcu_sched_lock_map, 1, _THIS_IP_)
+
+/**
+ * rcu_read_lock_held - might we be in RCU read-side critical section?
+ *
+ * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
+ * an RCU read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * this assumes we are in an RCU read-side critical section unless it can
+ * prove otherwise.
+ */
+static inline int rcu_read_lock_held(void)
+{
+       if (debug_locks)
+               return lock_is_held(&rcu_lock_map);
+       return 1;
+}
+
+/**
+ * rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section?
+ *
+ * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
+ * an RCU-bh read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * this assumes we are in an RCU-bh read-side critical section unless it can
+ * prove otherwise.
+ */
+static inline int rcu_read_lock_bh_held(void)
+{
+       if (debug_locks)
+               return lock_is_held(&rcu_bh_lock_map);
+       return 1;
+}
+
+/**
+ * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
+ *
+ * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an
+ * RCU-sched read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * this assumes we are in an RCU-sched read-side critical section unless it
+ * can prove otherwise.  Note that disabling of preemption (including
+ * disabling irqs) counts as an RCU-sched read-side critical section.
+ */
+static inline int rcu_read_lock_sched_held(void)
+{
+       int lockdep_opinion = 0;
+
+       if (debug_locks)
+               lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
+       return lockdep_opinion || preempt_count() != 0 || !rcu_scheduler_active;
+}
+
+#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
+# define rcu_read_acquire()            do { } while (0)
+# define rcu_read_release()            do { } while (0)
+# define rcu_read_acquire_bh()         do { } while (0)
+# define rcu_read_release_bh()         do { } while (0)
+# define rcu_read_acquire_sched()      do { } while (0)
+# define rcu_read_release_sched()      do { } while (0)
+
+static inline int rcu_read_lock_held(void)
+{
+       return 1;
+}
+
+static inline int rcu_read_lock_bh_held(void)
+{
+       return 1;
+}
+
+static inline int rcu_read_lock_sched_held(void)
+{
+       return preempt_count() != 0 || !rcu_scheduler_active;
+}
+
+#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
+#ifdef CONFIG_PROVE_RCU
+
+/**
+ * rcu_dereference_check - rcu_dereference with debug checking
+ *
+ * Do an rcu_dereference(), but check that the context is correct.
+ * For example, rcu_dereference_check(gp, rcu_read_lock_held()) to
+ * ensure that the rcu_dereference_check() executes within an RCU
+ * read-side critical section.  It is also possible to check for
+ * locks being held, for example, by using lockdep_is_held().
+ */
+#define rcu_dereference_check(p, c) \
+       ({ \
+               if (debug_locks && !(c)) \
+                       lockdep_rcu_dereference(__FILE__, __LINE__); \
+               rcu_dereference_raw(p); \
+       })
+
+#else /* #ifdef CONFIG_PROVE_RCU */
+
+#define rcu_dereference_check(p, c)    rcu_dereference_raw(p)
+
+#endif /* #else #ifdef CONFIG_PROVE_RCU */
 
 /**
  * rcu_read_lock - mark the beginning of an RCU read-side critical section.
@@ -160,7 +268,7 @@ static inline void rcu_read_lock_bh(void)
 {
        __rcu_read_lock_bh();
        __acquire(RCU_BH);
-       rcu_read_acquire();
+       rcu_read_acquire_bh();
 }
 
 /*
@@ -170,7 +278,7 @@ static inline void rcu_read_lock_bh(void)
  */
 static inline void rcu_read_unlock_bh(void)
 {
-       rcu_read_release();
+       rcu_read_release_bh();
        __release(RCU_BH);
        __rcu_read_unlock_bh();
 }
@@ -188,7 +296,7 @@ static inline void rcu_read_lock_sched(void)
 {
        preempt_disable();
        __acquire(RCU_SCHED);
-       rcu_read_acquire();
+       rcu_read_acquire_sched();
 }
 
 /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -205,7 +313,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
  */
 static inline void rcu_read_unlock_sched(void)
 {
-       rcu_read_release();
+       rcu_read_release_sched();
        __release(RCU_SCHED);
        preempt_enable();
 }
@@ -219,21 +327,48 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
 
 
 /**
- * rcu_dereference - fetch an RCU-protected pointer in an
- * RCU read-side critical section.  This pointer may later
- * be safely dereferenced.
+ * rcu_dereference_raw - fetch an RCU-protected pointer
+ *
+ * The caller must be within some flavor of RCU read-side critical
+ * section, or must be otherwise preventing the pointer from changing,
+ * for example, by holding an appropriate lock.  This pointer may later
+ * be safely dereferenced.  It is the caller's responsibility to have
+ * done the right thing, as this primitive does no checking of any kind.
  *
  * Inserts memory barriers on architectures that require them
  * (currently only the Alpha), and, more importantly, documents
  * exactly which pointers are protected by RCU.
  */
-
-#define rcu_dereference(p)     ({ \
+#define rcu_dereference_raw(p) ({ \
                                typeof(p) _________p1 = ACCESS_ONCE(p); \
                                smp_read_barrier_depends(); \
                                (_________p1); \
                                })
 
+/**
+ * rcu_dereference - fetch an RCU-protected pointer, checking for RCU
+ *
+ * Makes rcu_dereference_check() do the dirty work.
+ */
+#define rcu_dereference(p) \
+       rcu_dereference_check(p, rcu_read_lock_held())
+
+/**
+ * rcu_dereference_bh - fetch an RCU-protected pointer, checking for RCU-bh
+ *
+ * Makes rcu_dereference_check() do the dirty work.
+ */
+#define rcu_dereference_bh(p) \
+               rcu_dereference_check(p, rcu_read_lock_bh_held())
+
+/**
+ * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched
+ *
+ * Makes rcu_dereference_check() do the dirty work.
+ */
+#define rcu_dereference_sched(p) \
+               rcu_dereference_check(p, rcu_read_lock_sched_held())
+
 /**
  * rcu_assign_pointer - assign (publicize) a pointer to a newly
  * initialized structure that will be dereferenced by RCU read-side
index 96cc307ed9f4ef0c85ffdf7509ad107dd73f77f2..a5195875480aa299d96e0649f524a184cdd88413 100644 (file)
@@ -62,6 +62,18 @@ static inline long rcu_batches_completed_bh(void)
 
 extern int rcu_expedited_torture_stats(char *page);
 
+static inline void rcu_force_quiescent_state(void)
+{
+}
+
+static inline void rcu_bh_force_quiescent_state(void)
+{
+}
+
+static inline void rcu_sched_force_quiescent_state(void)
+{
+}
+
 #define synchronize_rcu synchronize_sched
 
 static inline void synchronize_rcu_expedited(void)
@@ -93,10 +105,6 @@ static inline void rcu_exit_nohz(void)
 
 #endif /* #else #ifdef CONFIG_NO_HZ */
 
-static inline void rcu_scheduler_starting(void)
-{
-}
-
 static inline void exit_rcu(void)
 {
 }
index 8044b1b9433381ebd77dfa11cf4838c37690facb..42cc3a04779ee1376adce84aeb57655df656d06f 100644 (file)
@@ -35,7 +35,6 @@ struct notifier_block;
 extern void rcu_sched_qs(int cpu);
 extern void rcu_bh_qs(int cpu);
 extern int rcu_needs_cpu(int cpu);
-extern void rcu_scheduler_starting(void);
 extern int rcu_expedited_torture_stats(char *page);
 
 #ifdef CONFIG_TREE_PREEMPT_RCU
@@ -99,6 +98,9 @@ extern void rcu_check_callbacks(int cpu, int user);
 extern long rcu_batches_completed(void);
 extern long rcu_batches_completed_bh(void);
 extern long rcu_batches_completed_sched(void);
+extern void rcu_force_quiescent_state(void);
+extern void rcu_bh_force_quiescent_state(void);
+extern void rcu_sched_force_quiescent_state(void);
 
 #ifdef CONFIG_NO_HZ
 void rcu_enter_nohz(void);
index c9ba2fdf807d5cbca878d5873ef38ca50332a201..bc8c3881c729fb29128b373b8fb6e0ad68feac45 100644 (file)
@@ -6,6 +6,11 @@
 
 extern int pm_trace_enabled;
 
+static inline int pm_trace_is_enabled(void)
+{
+       return pm_trace_enabled;
+}
+
 struct device;
 extern void set_trace_device(struct device *);
 extern void generate_resume_trace(const void *tracedata, unsigned int user);
@@ -17,6 +22,8 @@ extern void generate_resume_trace(const void *tracedata, unsigned int user);
 
 #else
 
+static inline int pm_trace_is_enabled(void) { return 0; }
+
 #define TRACE_DEVICE(dev) do { } while (0)
 #define TRACE_RESUME(dev) do { } while (0)
 
index 05330fc5b436034aa1b361934e2180bd96266938..5c52fa43785c905f50dc78df6e5795bd54ee6da7 100644 (file)
@@ -735,6 +735,9 @@ extern void rtnl_lock(void);
 extern void rtnl_unlock(void);
 extern int rtnl_trylock(void);
 extern int rtnl_is_locked(void);
+#ifdef CONFIG_PROVE_LOCKING
+extern int lockdep_rtnl_is_held(void);
+#endif /* #ifdef CONFIG_PROVE_LOCKING */
 
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
index 8d4991be9d53800a8c3cfd4a67cf0879d9ea62e7..0eef87b58ea5271bdc3d904324ce0c788fbc6c49 100644 (file)
@@ -310,6 +310,7 @@ extern void sched_show_task(struct task_struct *p);
 #ifdef CONFIG_DETECT_SOFTLOCKUP
 extern void softlockup_tick(void);
 extern void touch_softlockup_watchdog(void);
+extern void touch_softlockup_watchdog_sync(void);
 extern void touch_all_softlockup_watchdogs(void);
 extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
                                    void __user *buffer,
@@ -323,6 +324,9 @@ static inline void softlockup_tick(void)
 static inline void touch_softlockup_watchdog(void)
 {
 }
+static inline void touch_softlockup_watchdog_sync(void)
+{
+}
 static inline void touch_all_softlockup_watchdogs(void)
 {
 }
@@ -377,6 +381,8 @@ extern int sysctl_max_map_count;
 
 #include <linux/aio.h>
 
+#ifdef CONFIG_MMU
+extern void arch_pick_mmap_layout(struct mm_struct *mm);
 extern unsigned long
 arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
                       unsigned long, unsigned long);
@@ -386,6 +392,9 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
                          unsigned long flags);
 extern void arch_unmap_area(struct mm_struct *, unsigned long);
 extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
+#else
+static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
+#endif
 
 #if USE_SPLIT_PTLOCKS
 /*
@@ -731,14 +740,6 @@ struct user_struct {
        uid_t uid;
        struct user_namespace *user_ns;
 
-#ifdef CONFIG_USER_SCHED
-       struct task_group *tg;
-#ifdef CONFIG_SYSFS
-       struct kobject kobj;
-       struct delayed_work work;
-#endif
-#endif
-
 #ifdef CONFIG_PERF_EVENTS
        atomic_long_t locked_vm;
 #endif
@@ -869,7 +870,10 @@ static inline int sd_balance_for_mc_power(void)
        if (sched_smt_power_savings)
                return SD_POWERSAVINGS_BALANCE;
 
-       return SD_PREFER_SIBLING;
+       if (!sched_mc_power_savings)
+               return SD_PREFER_SIBLING;
+
+       return 0;
 }
 
 static inline int sd_balance_for_package_power(void)
@@ -1075,7 +1079,8 @@ struct sched_domain;
 struct sched_class {
        const struct sched_class *next;
 
-       void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
+       void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup,
+                             bool head);
        void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
        void (*yield_task) (struct rq *rq);
 
@@ -1087,14 +1092,6 @@ struct sched_class {
 #ifdef CONFIG_SMP
        int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
 
-       unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
-                       struct rq *busiest, unsigned long max_load_move,
-                       struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *all_pinned, int *this_best_prio);
-
-       int (*move_one_task) (struct rq *this_rq, int this_cpu,
-                             struct rq *busiest, struct sched_domain *sd,
-                             enum cpu_idle_type idle);
        void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
        void (*post_schedule) (struct rq *this_rq);
        void (*task_waking) (struct rq *this_rq, struct task_struct *task);
@@ -1364,7 +1361,7 @@ struct task_struct {
        char comm[TASK_COMM_LEN]; /* executable name excluding path
                                     - access with [gs]et_task_comm (which lock
                                       it with task_lock())
-                                    - initialized normally by flush_old_exec */
+                                    - initialized normally by setup_new_exec */
 /* file system info */
        int link_count, total_link_count;
 #ifdef CONFIG_SYSVIPC
@@ -2491,8 +2488,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
 
 #endif /* CONFIG_SMP */
 
-extern void arch_pick_mmap_layout(struct mm_struct *mm);
-
 #ifdef CONFIG_TRACING
 extern void
 __trace_special(void *__tr, void *__data,
@@ -2510,13 +2505,9 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
 
 extern void normalize_rt_tasks(void);
 
-#ifdef CONFIG_GROUP_SCHED
+#ifdef CONFIG_CGROUP_SCHED
 
 extern struct task_group init_task_group;
-#ifdef CONFIG_USER_SCHED
-extern struct task_group root_task_group;
-extern void set_tg_uid(struct user_struct *user);
-#endif
 
 extern struct task_group *sched_create_group(struct task_group *parent);
 extern void sched_destroy_group(struct task_group *tg);
index e2f3044d4a4a1cc55cb6202aec65eda4f904fd52..813d26c247ece48b709a14a427f655a2c04442fc 100644 (file)
@@ -136,25 +136,6 @@ static inline void serio_continue_rx(struct serio *serio)
        spin_unlock_irq(&serio->lock);
 }
 
-/*
- * Use the following functions to pin serio's driver in process context
- */
-static inline int serio_pin_driver(struct serio *serio)
-{
-       return mutex_lock_interruptible(&serio->drv_mutex);
-}
-
-static inline void serio_pin_driver_uninterruptible(struct serio *serio)
-{
-       mutex_lock(&serio->drv_mutex);
-}
-
-static inline void serio_unpin_driver(struct serio *serio)
-{
-       mutex_unlock(&serio->drv_mutex);
-}
-
-
 #endif
 
 /*
index 4ef246f14654f389197738105c5d5a75a2965e74..51d288d8ac883d0fbb2b2e1b8e073346ebc72038 100644 (file)
@@ -45,7 +45,7 @@ struct intc_sense_reg {
 #define INTC_SMP(stride, nr)
 #endif
 
-struct intc_desc {
+struct intc_hw_desc {
        struct intc_vect *vectors;
        unsigned int nr_vectors;
        struct intc_group *groups;
@@ -56,29 +56,40 @@ struct intc_desc {
        unsigned int nr_prio_regs;
        struct intc_sense_reg *sense_regs;
        unsigned int nr_sense_regs;
-       char *name;
        struct intc_mask_reg *ack_regs;
        unsigned int nr_ack_regs;
 };
 
 #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
+#define INTC_HW_DESC(vectors, groups, mask_regs,       \
+                    prio_regs, sense_regs, ack_regs)   \
+{                                                      \
+       _INTC_ARRAY(vectors), _INTC_ARRAY(groups),      \
+       _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
+       _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \
+}
+
+struct intc_desc {
+       char *name;
+       intc_enum force_enable;
+       intc_enum force_disable;
+       struct intc_hw_desc hw;
+};
+
 #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups,           \
        mask_regs, prio_regs, sense_regs)                               \
 struct intc_desc symbol __initdata = {                                 \
-       _INTC_ARRAY(vectors), _INTC_ARRAY(groups),                      \
-       _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs),                 \
-       _INTC_ARRAY(sense_regs),                                        \
-       chipname,                                                       \
+       .name = chipname,                                               \
+       .hw = INTC_HW_DESC(vectors, groups, mask_regs,                  \
+                          prio_regs, sense_regs, NULL),                \
 }
 
 #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups,       \
        mask_regs, prio_regs, sense_regs, ack_regs)                     \
 struct intc_desc symbol __initdata = {                                 \
-       _INTC_ARRAY(vectors), _INTC_ARRAY(groups),                      \
-       _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs),                 \
-       _INTC_ARRAY(sense_regs),                                        \
-       chipname,                                                       \
-       _INTC_ARRAY(ack_regs),                                          \
+       .name = chipname,                                               \
+       .hw = INTC_HW_DESC(vectors, groups, mask_regs,                  \
+                          prio_regs, sense_regs, ack_regs),            \
 }
 
 void __init register_intc_controller(struct intc_desc *desc);
index 4231104c9afaf312c74916c9c31c87ef05cce941..6334cee1a3be6b601e4d0c1665878edbea20e2a9 100644 (file)
@@ -28,8 +28,12 @@ struct ad7879_platform_data {
         * 1 = 4, 2 = 8, 3 = 16 (median > averaging)
         */
        u8      median;
-       /* 1 = AUX/VBAT/GPIO set to GPIO Output */
-       u8      gpio_output;
-       /* Initial GPIO pin state (valid if gpio_output = 1) */
-       u8      gpio_default;
+       /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib
+        * requires CONFIG_GPIOLIB
+        */
+       bool    gpio_export;
+       /* identifies the first GPIO number handled by this chip;
+        * or, if negative, requests dynamic ID allocation.
+        */
+       s32     gpio_base;
 };
index 51b3e771a9a3f832b062fe4cde257c07bf204606..cc813f95a2f2b6a4ddf19d04ed1b60fc321c9712 100644 (file)
@@ -90,6 +90,7 @@ struct dw_spi {
        unsigned long           paddr;
        u32                     iolen;
        int                     irq;
+       u32                     fifo_len;       /* depth of the FIFO buffer */
        u32                     max_freq;       /* max bus freq supported */
 
        u16                     bus_num;
@@ -171,6 +172,10 @@ static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
 {
        if (cs > dws->num_cs)
                return;
+
+       if (dws->cs_control)
+               dws->cs_control(1);
+
        dw_writel(dws, ser, 1 << cs);
 }
 
index 4765d97dcafb98a5e8fde93684f9293c08d88804..3084f80909cd91bf684dea1c1dcae3fb4f2d2292 100644 (file)
@@ -35,6 +35,9 @@ struct srcu_struct {
        int completed;
        struct srcu_struct_array *per_cpu_ref;
        struct mutex mutex;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       struct lockdep_map dep_map;
+#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 };
 
 #ifndef CONFIG_PREEMPT
@@ -43,12 +46,100 @@ struct srcu_struct {
 #define srcu_barrier()
 #endif /* #else #ifndef CONFIG_PREEMPT */
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+
+int __init_srcu_struct(struct srcu_struct *sp, const char *name,
+                      struct lock_class_key *key);
+
+#define init_srcu_struct(sp) \
+({ \
+       static struct lock_class_key __srcu_key; \
+       \
+       __init_srcu_struct((sp), #sp, &__srcu_key); \
+})
+
+# define srcu_read_acquire(sp) \
+               lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_)
+# define srcu_read_release(sp) \
+               lock_release(&(sp)->dep_map, 1, _THIS_IP_)
+
+#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 int init_srcu_struct(struct srcu_struct *sp);
+
+# define srcu_read_acquire(sp)  do { } while (0)
+# define srcu_read_release(sp)  do { } while (0)
+
+#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 void cleanup_srcu_struct(struct srcu_struct *sp);
-int srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
-void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
+int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
+void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
 void synchronize_srcu(struct srcu_struct *sp);
 void synchronize_srcu_expedited(struct srcu_struct *sp);
 long srcu_batches_completed(struct srcu_struct *sp);
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+
+/**
+ * srcu_read_lock_held - might we be in SRCU read-side critical section?
+ *
+ * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
+ * an SRCU read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * this assumes we are in an SRCU read-side critical section unless it can
+ * prove otherwise.
+ */
+static inline int srcu_read_lock_held(struct srcu_struct *sp)
+{
+       if (debug_locks)
+               return lock_is_held(&sp->dep_map);
+       return 1;
+}
+
+#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
+static inline int srcu_read_lock_held(struct srcu_struct *sp)
+{
+       return 1;
+}
+
+#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
+/**
+ * srcu_dereference - fetch SRCU-protected pointer with checking
+ *
+ * Makes rcu_dereference_check() do the dirty work.
+ */
+#define srcu_dereference(p, sp) \
+               rcu_dereference_check(p, srcu_read_lock_held(sp))
+
+/**
+ * srcu_read_lock - register a new reader for an SRCU-protected structure.
+ * @sp: srcu_struct in which to register the new reader.
+ *
+ * Enter an SRCU read-side critical section.  Note that SRCU read-side
+ * critical sections may be nested.
+ */
+static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
+{
+       int retval = __srcu_read_lock(sp);
+
+       srcu_read_acquire(sp);
+       return retval;
+}
+
+/**
+ * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
+ * @sp: srcu_struct in which to unregister the old reader.
+ * @idx: return value from corresponding srcu_read_lock().
+ *
+ * Exit an SRCU read-side critical section.
+ */
+static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
+       __releases(sp)
+{
+       srcu_read_release(sp);
+       __srcu_read_unlock(sp, idx);
+}
+
 #endif
index 651839a2a755ffa63aa862367fb502897df94e3c..a716ee2a8adb8df5cf545a9e9638e733fba777e7 100644 (file)
@@ -72,7 +72,10 @@ static inline __must_check char *strstrip(char *str)
 }
 
 #ifndef __HAVE_ARCH_STRSTR
-extern char * strstr(const char *,const char *);
+extern char * strstr(const char *, const char *);
+#endif
+#ifndef __HAVE_ARCH_STRNSTR
+extern char * strnstr(const char *, const char *, size_t);
 #endif
 #ifndef __HAVE_ARCH_STRLEN
 extern __kernel_size_t strlen(const char *);
index 207466a49f3d59b9d0927670c379d8be091a4d37..8126f239edf08410cedc96c0638a5d4f1c3168b5 100644 (file)
@@ -99,7 +99,7 @@ struct perf_event_attr;
 #define __SC_TEST5(t5, a5, ...)        __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
 #define __SC_TEST6(t6, a6, ...)        __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 #define TRACE_SYS_ENTER_PROFILE_INIT(sname)                                   \
        .profile_enable = prof_sysenter_enable,                                \
@@ -113,7 +113,7 @@ struct perf_event_attr;
 #define TRACE_SYS_ENTER_PROFILE_INIT(sname)
 #define TRACE_SYS_EXIT_PROFILE(sname)
 #define TRACE_SYS_EXIT_PROFILE_INIT(sname)
-#endif
+#endif /* CONFIG_PERF_EVENTS */
 
 #ifdef CONFIG_FTRACE_SYSCALLS
 #define __SC_STR_ADECL1(t, a)          #a
@@ -132,7 +132,8 @@ struct perf_event_attr;
 
 #define SYSCALL_TRACE_ENTER_EVENT(sname)                               \
        static const struct syscall_metadata __syscall_meta_##sname;    \
-       static struct ftrace_event_call event_enter_##sname;            \
+       static struct ftrace_event_call                                 \
+       __attribute__((__aligned__(4))) event_enter_##sname;            \
        static struct trace_event enter_syscall_print_##sname = {       \
                .trace                  = print_syscall_enter,          \
        };                                                              \
@@ -143,8 +144,7 @@ struct perf_event_attr;
                .name                   = "sys_enter"#sname,            \
                .system                 = "syscalls",                   \
                .event                  = &enter_syscall_print_##sname, \
-               .raw_init               = trace_event_raw_init,         \
-               .show_format            = syscall_enter_format,         \
+               .raw_init               = init_syscall_trace,           \
                .define_fields          = syscall_enter_define_fields,  \
                .regfunc                = reg_event_syscall_enter,      \
                .unregfunc              = unreg_event_syscall_enter,    \
@@ -154,7 +154,8 @@ struct perf_event_attr;
 
 #define SYSCALL_TRACE_EXIT_EVENT(sname)                                        \
        static const struct syscall_metadata __syscall_meta_##sname;    \
-       static struct ftrace_event_call event_exit_##sname;             \
+       static struct ftrace_event_call                                 \
+       __attribute__((__aligned__(4))) event_exit_##sname;             \
        static struct trace_event exit_syscall_print_##sname = {        \
                .trace                  = print_syscall_exit,           \
        };                                                              \
@@ -165,8 +166,7 @@ struct perf_event_attr;
                .name                   = "sys_exit"#sname,             \
                .system                 = "syscalls",                   \
                .event                  = &exit_syscall_print_##sname,  \
-               .raw_init               = trace_event_raw_init,         \
-               .show_format            = syscall_exit_format,          \
+               .raw_init               = init_syscall_trace,           \
                .define_fields          = syscall_exit_define_fields,   \
                .regfunc                = reg_event_syscall_exit,       \
                .unregfunc              = unreg_event_syscall_exit,     \
index 94f8faecdcbc75bc9a10ffc9fb2a97465480b76e..7a082b32d8e13ac98fe5b04b962f2f44a4f9ecc7 100644 (file)
@@ -238,9 +238,6 @@ extern int tickadj;                 /* amount of adjustment per tick */
  * phase-lock loop variables
  */
 extern int time_status;                /* clock synchronization status bits */
-extern long time_maxerror;     /* maximum error */
-extern long time_esterror;     /* estimated error */
-
 extern long time_adjust;       /* The amount of adjtime left */
 
 extern void ntp_init(void);
index 57e63579bfdd7f193511675fc9ed26141b586638..5b81156780b17f8bf52608ca7b8230dd638a530a 100644 (file)
@@ -99,7 +99,7 @@ int arch_update_cpu_topology(void);
                                | 1*SD_WAKE_AFFINE                      \
                                | 1*SD_SHARE_CPUPOWER                   \
                                | 0*SD_POWERSAVINGS_BALANCE             \
-                               | 0*SD_SHARE_PKG_RESOURCES              \
+                               | 1*SD_SHARE_PKG_RESOURCES              \
                                | 0*SD_SERIALIZE                        \
                                | 0*SD_PREFER_SIBLING                   \
                                ,                                       \
index ef3a2947b1026a43dfebf0945132d0b1e1fc91c2..6abfcf5b5887c030bfea8b4162a006d3f21a2502 100644 (file)
@@ -464,7 +464,7 @@ extern int tty_port_alloc_xmit_buf(struct tty_port *port);
 extern void tty_port_free_xmit_buf(struct tty_port *port);
 extern void tty_port_put(struct tty_port *port);
 
-extern inline struct tty_port *tty_port_get(struct tty_port *port)
+static inline struct tty_port *tty_port_get(struct tty_port *port)
 {
        if (port)
                kref_get(&port->kref);
@@ -486,7 +486,7 @@ extern void tty_port_close(struct tty_port *port,
                                struct tty_struct *tty, struct file *filp);
 extern int tty_port_open(struct tty_port *port,
                                struct tty_struct *tty, struct file *filp);
-extern inline int tty_port_users(struct tty_port *port)
+static inline int tty_port_users(struct tty_port *port)
 {
        return port->count + port->blocked_open;
 }
index e101a2d04d7588843083bfd466831e4fb807347e..332eaea610217aab63378e27daf8afe3720b6a6c 100644 (file)
@@ -192,6 +192,7 @@ struct usb_interface {
        unsigned needs_altsetting0:1;   /* switch to altsetting 0 is pending */
        unsigned needs_binding:1;       /* needs delayed unbind/rebind */
        unsigned reset_running:1;
+       unsigned resetting_device:1;    /* true: bandwidth alloc after reset */
 
        struct device dev;              /* interface specific device info */
        struct device *usb_dev;
@@ -338,6 +339,7 @@ struct usb_bus {
 
        struct usb_devmap devmap;       /* device address allocation map */
        struct usb_device *root_hub;    /* Root hub */
+       struct usb_bus *hs_companion;   /* Companion EHCI bus, if any */
        struct list_head bus_list;      /* list of busses */
 
        int bandwidth_allocated;        /* on this bus: how much of the time
index d4962a782b8abbb8db66c30db0f42ab4129658d2..3793d168b44d028d7e1125eaab81afefe53fa174 100644 (file)
@@ -350,6 +350,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4    */
 
 /*  Vendor-specific formats   */
+#define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
 #define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
 #define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
 #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
@@ -362,6 +363,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SPCA561  v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
 #define V4L2_PIX_FMT_PAC207   v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
 #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
+#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
 #define V4L2_PIX_FMT_SQ905C   v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
 #define V4L2_PIX_FMT_PJPG     v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
 #define V4L2_PIX_FMT_OV511    v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
index 057a2e0107589763411cfeea1bd6e7e4b189a24c..f508c651e53dec96f7d27a840979fd80a42e0d10 100644 (file)
@@ -51,6 +51,9 @@ struct virtqueue {
  *     This re-enables callbacks; it returns "false" if there are pending
  *     buffers in the queue, to detect a possible race between the driver
  *     checking for more work, and enabling callbacks.
+ * @detach_unused_buf: detach first unused buffer
+ *     vq: the struct virtqueue we're talking about.
+ *     Returns NULL or the "data" token handed to add_buf
  *
  * Locking rules are straightforward: the driver is responsible for
  * locking.  No two operations may be invoked simultaneously, with the exception
@@ -71,6 +74,7 @@ struct virtqueue_ops {
 
        void (*disable_cb)(struct virtqueue *vq);
        bool (*enable_cb)(struct virtqueue *vq);
+       void *(*detach_unused_buf)(struct virtqueue *vq);
 };
 
 /**
index 1418f048cb34741919b788160a4657eba462b2fe..a50ecd1b81a2acce1da35758767d3abcf0b06a99 100644 (file)
@@ -7,6 +7,7 @@
 
 /* The feature bitmap for virtio balloon */
 #define VIRTIO_BALLOON_F_MUST_TELL_HOST        0 /* Tell before reclaiming pages */
+#define VIRTIO_BALLOON_F_STATS_VQ      1 /* Memory Stats virtqueue */
 
 /* Size of a PFN in the balloon interface. */
 #define VIRTIO_BALLOON_PFN_SHIFT 12
@@ -18,4 +19,18 @@ struct virtio_balloon_config
        /* Number of pages we've actually got in balloon. */
        __le32 actual;
 };
+
+#define VIRTIO_BALLOON_S_SWAP_IN  0   /* Amount of memory swapped in */
+#define VIRTIO_BALLOON_S_SWAP_OUT 1   /* Amount of memory swapped out */
+#define VIRTIO_BALLOON_S_MAJFLT   2   /* Number of major faults */
+#define VIRTIO_BALLOON_S_MINFLT   3   /* Number of minor faults */
+#define VIRTIO_BALLOON_S_MEMFREE  4   /* Total amount of free memory */
+#define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
+#define VIRTIO_BALLOON_S_NR       6
+
+struct virtio_balloon_stat {
+       u16 tag;
+       u64 val;
+} __attribute__((packed));
+
 #endif /* _LINUX_VIRTIO_BALLOON_H */
index fd294c56d5717d56bc0df1412d621cc059673e1e..e52029e98919bb38401dd1848de418277ba271a9 100644 (file)
@@ -15,6 +15,7 @@
 #define VIRTIO_BLK_F_BLK_SIZE  6       /* Block size of disk is available*/
 #define VIRTIO_BLK_F_SCSI      7       /* Supports scsi command passthru */
 #define VIRTIO_BLK_F_FLUSH     9       /* Cache flush command support */
+#define VIRTIO_BLK_F_TOPOLOGY  10      /* Topology information is available */
 
 struct virtio_blk_config {
        /* The capacity (in 512-byte sectors). */
@@ -29,8 +30,20 @@ struct virtio_blk_config {
                __u8 heads;
                __u8 sectors;
        } geometry;
+
        /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
        __u32 blk_size;
+
+       /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY  */
+       /* exponent for physical block per logical block. */
+       __u8 physical_block_exp;
+       /* alignment offset in logical blocks. */
+       __u8 alignment_offset;
+       /* minimum I/O size without performance penalty in logical blocks. */
+       __u16 min_io_size;
+       /* optimal sustained I/O size in logical blocks. */
+       __u32 opt_io_size;
+
 } __attribute__((packed));
 
 /*
index fe885174cc1f061ef8d0b706a362d27574ca616f..ae4f039515b441f3407d88da1e2172a78bab2e5b 100644 (file)
@@ -3,19 +3,45 @@
 #include <linux/types.h>
 #include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
-/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
- * anyone can use the definitions to implement compatible drivers/servers. */
+/*
+ * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
+ * anyone can use the definitions to implement compatible drivers/servers.
+ *
+ * Copyright (C) Red Hat, Inc., 2009, 2010
+ */
 
 /* Feature bits */
 #define VIRTIO_CONSOLE_F_SIZE  0       /* Does host provide console size? */
+#define VIRTIO_CONSOLE_F_MULTIPORT 1   /* Does host provide multiple ports? */
 
 struct virtio_console_config {
        /* colums of the screens */
        __u16 cols;
        /* rows of the screens */
        __u16 rows;
+       /* max. number of ports this device can hold */
+       __u32 max_nr_ports;
+       /* number of ports added so far */
+       __u32 nr_ports;
 } __attribute__((packed));
 
+/*
+ * A message that's passed between the Host and the Guest for a
+ * particular port.
+ */
+struct virtio_console_control {
+       __u32 id;               /* Port number */
+       __u16 event;            /* The kind of control event (see below) */
+       __u16 value;            /* Extra information for the key */
+};
+
+/* Some events for control messages */
+#define VIRTIO_CONSOLE_PORT_READY      0
+#define VIRTIO_CONSOLE_CONSOLE_PORT    1
+#define VIRTIO_CONSOLE_RESIZE          2
+#define VIRTIO_CONSOLE_PORT_OPEN       3
+#define VIRTIO_CONSOLE_PORT_NAME       4
+#define VIRTIO_CONSOLE_PORT_REMOVE     5
 
 #ifdef __KERNEL__
 int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
diff --git a/include/media/davinci/isif.h b/include/media/davinci/isif.h
new file mode 100644 (file)
index 0000000..b0b74ad
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+ * Copyright (C) 2008-2009 Texas Instruments Inc
+ *
+ * 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
+ *
+ * isif header file
+ */
+#ifndef _ISIF_H
+#define _ISIF_H
+
+#include <media/davinci/ccdc_types.h>
+#include <media/davinci/vpfe_types.h>
+
+/* isif float type S8Q8/U8Q8 */
+struct isif_float_8 {
+       /* 8 bit integer part */
+       __u8 integer;
+       /* 8 bit decimal part */
+       __u8 decimal;
+};
+
+/* isif float type U16Q16/S16Q16 */
+struct isif_float_16 {
+       /* 16 bit integer part */
+       __u16 integer;
+       /* 16 bit decimal part */
+       __u16 decimal;
+};
+
+/************************************************************************
+ *   Vertical Defect Correction parameters
+ ***********************************************************************/
+/* Defect Correction (DFC) table entry */
+struct isif_vdfc_entry {
+       /* vertical position of defect */
+       __u16 pos_vert;
+       /* horizontal position of defect */
+       __u16 pos_horz;
+       /*
+        * Defect level of Vertical line defect position. This is subtracted
+        * from the data at the defect position
+        */
+       __u8 level_at_pos;
+       /*
+        * Defect level of the pixels upper than the vertical line defect.
+        * This is subtracted from the data
+        */
+       __u8 level_up_pixels;
+       /*
+        * Defect level of the pixels lower than the vertical line defect.
+        * This is subtracted from the data
+        */
+       __u8 level_low_pixels;
+};
+
+#define ISIF_VDFC_TABLE_SIZE           8
+struct isif_dfc {
+       /* enable vertical defect correction */
+       __u8 en;
+       /* Defect level subtraction. Just fed through if saturating */
+#define        ISIF_VDFC_NORMAL                0
+       /*
+        * Defect level subtraction. Horizontal interpolation ((i-2)+(i+2))/2
+        * if data saturating
+        */
+#define ISIF_VDFC_HORZ_INTERPOL_IF_SAT 1
+       /* Horizontal interpolation (((i-2)+(i+2))/2) */
+#define        ISIF_VDFC_HORZ_INTERPOL         2
+       /* one of the vertical defect correction modes above */
+       __u8 corr_mode;
+       /* 0 - whole line corrected, 1 - not pixels upper than the defect */
+       __u8 corr_whole_line;
+#define ISIF_VDFC_NO_SHIFT             0
+#define ISIF_VDFC_SHIFT_1              1
+#define ISIF_VDFC_SHIFT_2              2
+#define ISIF_VDFC_SHIFT_3              3
+#define ISIF_VDFC_SHIFT_4              4
+       /*
+        * defect level shift value. level_at_pos, level_upper_pos,
+        * and level_lower_pos can be shifted up by this value. Choose
+        * one of the values above
+        */
+       __u8 def_level_shift;
+       /* defect saturation level */
+       __u16 def_sat_level;
+       /* number of vertical defects. Max is ISIF_VDFC_TABLE_SIZE */
+       __u16 num_vdefects;
+       /* VDFC table ptr */
+       struct isif_vdfc_entry table[ISIF_VDFC_TABLE_SIZE];
+};
+
+struct isif_horz_bclamp {
+
+       /* Horizontal clamp disabled. Only vertical clamp value is subtracted */
+#define        ISIF_HORZ_BC_DISABLE            0
+       /*
+        * Horizontal clamp value is calculated and subtracted from image data
+        * along with vertical clamp value
+        */
+#define ISIF_HORZ_BC_CLAMP_CALC_ENABLED        1
+       /*
+        * Horizontal clamp value calculated from previous image is subtracted
+        * from image data along with vertical clamp value.
+        */
+#define ISIF_HORZ_BC_CLAMP_NOT_UPDATED 2
+       /* horizontal clamp mode. One of the values above */
+       __u8 mode;
+       /*
+        * pixel value limit enable.
+        *  0 - limit disabled
+        *  1 - pixel value limited to 1023
+        */
+       __u8 clamp_pix_limit;
+       /* Select Most left window for bc calculation */
+#define        ISIF_SEL_MOST_LEFT_WIN          0
+       /* Select Most right window for bc calculation */
+#define ISIF_SEL_MOST_RIGHT_WIN                1
+       /* Select most left or right window for clamp val calculation */
+       __u8 base_win_sel_calc;
+       /* Window count per color for calculation. range 1-32 */
+       __u8 win_count_calc;
+       /* Window start position - horizontal for calculation. 0 - 8191 */
+       __u16 win_start_h_calc;
+       /* Window start position - vertical for calculation 0 - 8191 */
+       __u16 win_start_v_calc;
+#define ISIF_HORZ_BC_SZ_H_2PIXELS      0
+#define ISIF_HORZ_BC_SZ_H_4PIXELS      1
+#define ISIF_HORZ_BC_SZ_H_8PIXELS      2
+#define ISIF_HORZ_BC_SZ_H_16PIXELS     3
+       /* Width of the sample window in pixels for calculation */
+       __u8 win_h_sz_calc;
+#define ISIF_HORZ_BC_SZ_V_32PIXELS     0
+#define ISIF_HORZ_BC_SZ_V_64PIXELS     1
+#define        ISIF_HORZ_BC_SZ_V_128PIXELS     2
+#define ISIF_HORZ_BC_SZ_V_256PIXELS    3
+       /* Height of the sample window in pixels for calculation */
+       __u8 win_v_sz_calc;
+};
+
+/************************************************************************
+ *  Black Clamp parameters
+ ***********************************************************************/
+struct isif_vert_bclamp {
+       /* Reset value used is the clamp value calculated */
+#define        ISIF_VERT_BC_USE_HORZ_CLAMP_VAL         0
+       /* Reset value used is reset_clamp_val configured */
+#define        ISIF_VERT_BC_USE_CONFIG_CLAMP_VAL       1
+       /* No update, previous image value is used */
+#define        ISIF_VERT_BC_NO_UPDATE                  2
+       /*
+        * Reset value selector for vertical clamp calculation. Use one of
+        * the above values
+        */
+       __u8 reset_val_sel;
+       /* U8Q8. Line average coefficient used in vertical clamp calculation */
+       __u8 line_ave_coef;
+       /* Height of the optical black region for calculation */
+       __u16 ob_v_sz_calc;
+       /* Optical black region start position - horizontal. 0 - 8191 */
+       __u16 ob_start_h;
+       /* Optical black region start position - vertical 0 - 8191 */
+       __u16 ob_start_v;
+};
+
+struct isif_black_clamp {
+       /*
+        * This offset value is added irrespective of the clamp enable status.
+        * S13
+        */
+       __u16 dc_offset;
+       /*
+        * Enable black/digital clamp value to be subtracted from the image data
+        */
+       __u8 en;
+       /*
+        * black clamp mode. same/separate clamp for 4 colors
+        * 0 - disable - same clamp value for all colors
+        * 1 - clamp value calculated separately for all colors
+        */
+       __u8 bc_mode_color;
+       /* Vrtical start position for bc subtraction */
+       __u16 vert_start_sub;
+       /* Black clamp for horizontal direction */
+       struct isif_horz_bclamp horz;
+       /* Black clamp for vertical direction */
+       struct isif_vert_bclamp vert;
+};
+
+/*************************************************************************
+** Color Space Convertion (CSC)
+*************************************************************************/
+#define ISIF_CSC_NUM_COEFF     16
+struct isif_color_space_conv {
+       /* Enable color space conversion */
+       __u8 en;
+       /*
+        * csc coeffient table. S8Q5, M00 at index 0, M01 at index 1, and
+        * so forth
+        */
+       struct isif_float_8 coeff[ISIF_CSC_NUM_COEFF];
+};
+
+
+/*************************************************************************
+**  Black  Compensation parameters
+*************************************************************************/
+struct isif_black_comp {
+       /* Comp for Red */
+       __s8 r_comp;
+       /* Comp for Gr */
+       __s8 gr_comp;
+       /* Comp for Blue */
+       __s8 b_comp;
+       /* Comp for Gb */
+       __s8 gb_comp;
+};
+
+/*************************************************************************
+**  Gain parameters
+*************************************************************************/
+struct isif_gain {
+       /* Gain for Red or ye */
+       struct isif_float_16 r_ye;
+       /* Gain for Gr or cy */
+       struct isif_float_16 gr_cy;
+       /* Gain for Gb or g */
+       struct isif_float_16 gb_g;
+       /* Gain for Blue or mg */
+       struct isif_float_16 b_mg;
+};
+
+#define ISIF_LINEAR_TAB_SIZE   192
+/*************************************************************************
+**  Linearization parameters
+*************************************************************************/
+struct isif_linearize {
+       /* Enable or Disable linearization of data */
+       __u8 en;
+       /* Shift value applied */
+       __u8 corr_shft;
+       /* scale factor applied U11Q10 */
+       struct isif_float_16 scale_fact;
+       /* Size of the linear table */
+       __u16 table[ISIF_LINEAR_TAB_SIZE];
+};
+
+/* Color patterns */
+#define ISIF_RED       0
+#define        ISIF_GREEN_RED  1
+#define ISIF_GREEN_BLUE        2
+#define ISIF_BLUE      3
+struct isif_col_pat {
+       __u8 olop;
+       __u8 olep;
+       __u8 elop;
+       __u8 elep;
+};
+
+/*************************************************************************
+**  Data formatter parameters
+*************************************************************************/
+struct isif_fmtplen {
+       /*
+        * number of program entries for SET0, range 1 - 16
+        * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
+        * ISIF_COMBINE
+        */
+       __u16 plen0;
+       /*
+        * number of program entries for SET1, range 1 - 16
+        * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
+        * ISIF_COMBINE
+        */
+       __u16 plen1;
+       /**
+        * number of program entries for SET2, range 1 - 16
+        * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
+        * ISIF_COMBINE
+        */
+       __u16 plen2;
+       /**
+        * number of program entries for SET3, range 1 - 16
+        * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
+        * ISIF_COMBINE
+        */
+       __u16 plen3;
+};
+
+struct isif_fmt_cfg {
+#define ISIF_SPLIT             0
+#define ISIF_COMBINE           1
+       /* Split or combine or line alternate */
+       __u8 fmtmode;
+       /* enable or disable line alternating mode */
+       __u8 ln_alter_en;
+#define ISIF_1LINE             0
+#define        ISIF_2LINES             1
+#define        ISIF_3LINES             2
+#define        ISIF_4LINES             3
+       /* Split/combine line number */
+       __u8 lnum;
+       /* Address increment Range 1 - 16 */
+       __u8 addrinc;
+};
+
+struct isif_fmt_addr_ptr {
+       /* Initial address */
+       __u32 init_addr;
+       /* output line number */
+#define ISIF_1STLINE           0
+#define        ISIF_2NDLINE            1
+#define        ISIF_3RDLINE            2
+#define        ISIF_4THLINE            3
+       __u8 out_line;
+};
+
+struct isif_fmtpgm_ap {
+       /* program address pointer */
+       __u8 pgm_aptr;
+       /* program address increment or decrement */
+       __u8 pgmupdt;
+};
+
+struct isif_data_formatter {
+       /* Enable/Disable data formatter */
+       __u8 en;
+       /* data formatter configuration */
+       struct isif_fmt_cfg cfg;
+       /* Formatter program entries length */
+       struct isif_fmtplen plen;
+       /* first pixel in a line fed to formatter */
+       __u16 fmtrlen;
+       /* HD interval for output line. Only valid when split line */
+       __u16 fmthcnt;
+       /* formatter address pointers */
+       struct isif_fmt_addr_ptr fmtaddr_ptr[16];
+       /* program enable/disable */
+       __u8 pgm_en[32];
+       /* program address pointers */
+       struct isif_fmtpgm_ap fmtpgm_ap[32];
+};
+
+struct isif_df_csc {
+       /* Color Space Conversion confguration, 0 - csc, 1 - df */
+       __u8 df_or_csc;
+       /* csc configuration valid if df_or_csc is 0 */
+       struct isif_color_space_conv csc;
+       /* data formatter configuration valid if df_or_csc is 1 */
+       struct isif_data_formatter df;
+       /* start pixel in a line at the input */
+       __u32 start_pix;
+       /* number of pixels in input line */
+       __u32 num_pixels;
+       /* start line at the input */
+       __u32 start_line;
+       /* number of lines at the input */
+       __u32 num_lines;
+};
+
+struct isif_gain_offsets_adj {
+       /* Gain adjustment per color */
+       struct isif_gain gain;
+       /* Offset adjustment */
+       __u16 offset;
+       /* Enable or Disable Gain adjustment for SDRAM data */
+       __u8 gain_sdram_en;
+       /* Enable or Disable Gain adjustment for IPIPE data */
+       __u8 gain_ipipe_en;
+       /* Enable or Disable Gain adjustment for H3A data */
+       __u8 gain_h3a_en;
+       /* Enable or Disable Gain adjustment for SDRAM data */
+       __u8 offset_sdram_en;
+       /* Enable or Disable Gain adjustment for IPIPE data */
+       __u8 offset_ipipe_en;
+       /* Enable or Disable Gain adjustment for H3A data */
+       __u8 offset_h3a_en;
+};
+
+struct isif_cul {
+       /* Horizontal Cull pattern for odd lines */
+       __u8 hcpat_odd;
+       /* Horizontal Cull pattern for even lines */
+       __u8 hcpat_even;
+       /* Vertical Cull pattern */
+       __u8 vcpat;
+       /* Enable or disable lpf. Apply when cull is enabled */
+       __u8 en_lpf;
+};
+
+struct isif_compress {
+#define ISIF_ALAW              0
+#define ISIF_DPCM              1
+#define ISIF_NO_COMPRESSION    2
+       /* Compression Algorithm used */
+       __u8 alg;
+       /* Choose Predictor1 for DPCM compression */
+#define ISIF_DPCM_PRED1                0
+       /* Choose Predictor2 for DPCM compression */
+#define ISIF_DPCM_PRED2                1
+       /* Predictor for DPCM compression */
+       __u8 pred;
+};
+
+/* all the stuff in this struct will be provided by userland */
+struct isif_config_params_raw {
+       /* Linearization parameters for image sensor data input */
+       struct isif_linearize linearize;
+       /* Data formatter or CSC */
+       struct isif_df_csc df_csc;
+       /* Defect Pixel Correction (DFC) confguration */
+       struct isif_dfc dfc;
+       /* Black/Digital Clamp configuration */
+       struct isif_black_clamp bclamp;
+       /* Gain, offset adjustments */
+       struct isif_gain_offsets_adj gain_offset;
+       /* Culling */
+       struct isif_cul culling;
+       /* A-Law and DPCM compression options */
+       struct isif_compress compress;
+       /* horizontal offset for Gain/LSC/DFC */
+       __u16 horz_offset;
+       /* vertical offset for Gain/LSC/DFC */
+       __u16 vert_offset;
+       /* color pattern for field 0 */
+       struct isif_col_pat col_pat_field0;
+       /* color pattern for field 1 */
+       struct isif_col_pat col_pat_field1;
+#define ISIF_NO_SHIFT          0
+#define        ISIF_1BIT_SHIFT         1
+#define        ISIF_2BIT_SHIFT         2
+#define        ISIF_3BIT_SHIFT         3
+#define        ISIF_4BIT_SHIFT         4
+#define ISIF_5BIT_SHIFT                5
+#define ISIF_6BIT_SHIFT                6
+       /* Data shift applied before storing to SDRAM */
+       __u8 data_shift;
+       /* enable input test pattern generation */
+       __u8 test_pat_gen;
+};
+
+#ifdef __KERNEL__
+struct isif_ycbcr_config {
+       /* isif pixel format */
+       enum ccdc_pixfmt pix_fmt;
+       /* isif frame format */
+       enum ccdc_frmfmt frm_fmt;
+       /* ISIF crop window */
+       struct v4l2_rect win;
+       /* field polarity */
+       enum vpfe_pin_pol fid_pol;
+       /* interface VD polarity */
+       enum vpfe_pin_pol vd_pol;
+       /* interface HD polarity */
+       enum vpfe_pin_pol hd_pol;
+       /* isif pix order. Only used for ycbcr capture */
+       enum ccdc_pixorder pix_order;
+       /* isif buffer type. Only used for ycbcr capture */
+       enum ccdc_buftype buf_type;
+};
+
+/* MSB of image data connected to sensor port */
+enum isif_data_msb {
+       ISIF_BIT_MSB_15,
+       ISIF_BIT_MSB_14,
+       ISIF_BIT_MSB_13,
+       ISIF_BIT_MSB_12,
+       ISIF_BIT_MSB_11,
+       ISIF_BIT_MSB_10,
+       ISIF_BIT_MSB_9,
+       ISIF_BIT_MSB_8,
+       ISIF_BIT_MSB_7
+};
+
+enum isif_cfa_pattern {
+       ISIF_CFA_PAT_MOSAIC,
+       ISIF_CFA_PAT_STRIPE
+};
+
+struct isif_params_raw {
+       /* isif pixel format */
+       enum ccdc_pixfmt pix_fmt;
+       /* isif frame format */
+       enum ccdc_frmfmt frm_fmt;
+       /* video window */
+       struct v4l2_rect win;
+       /* field polarity */
+       enum vpfe_pin_pol fid_pol;
+       /* interface VD polarity */
+       enum vpfe_pin_pol vd_pol;
+       /* interface HD polarity */
+       enum vpfe_pin_pol hd_pol;
+       /* buffer type. Applicable for interlaced mode */
+       enum ccdc_buftype buf_type;
+       /* Gain values */
+       struct isif_gain gain;
+       /* cfa pattern */
+       enum isif_cfa_pattern cfa_pat;
+       /* Data MSB position */
+       enum isif_data_msb data_msb;
+       /* Enable horizontal flip */
+       unsigned char horz_flip_en;
+       /* Enable image invert vertically */
+       unsigned char image_invert_en;
+
+       /* all the userland defined stuff*/
+       struct isif_config_params_raw config_params;
+};
+
+enum isif_data_pack {
+       ISIF_PACK_16BIT,
+       ISIF_PACK_12BIT,
+       ISIF_PACK_8BIT
+};
+
+#define ISIF_WIN_NTSC                          {0, 0, 720, 480}
+#define ISIF_WIN_VGA                           {0, 0, 640, 480}
+
+#endif
+#endif
index fcdff745fae2380d03421cc6d2498a2387320b77..c59cc029c74ae3ab64b93a0293bbdd03b162ef51 100644 (file)
 /* selector for ccdc input selection on DM355 */
 enum vpss_ccdc_source_sel {
        VPSS_CCDCIN,
-       VPSS_HSSIIN
+       VPSS_HSSIIN,
+       VPSS_PGLPBK,    /* for DM365 only */
+       VPSS_CCDCPG     /* for DM365 only */
+};
+
+struct vpss_sync_pol {
+       unsigned int ccdpg_hdpol:1;
+       unsigned int ccdpg_vdpol:1;
+};
+
+struct vpss_pg_frame_size {
+       short hlpfr;
+       short pplen;
 };
 
 /* Used for enable/diable VPSS Clock */
@@ -47,12 +59,38 @@ enum vpss_clock_sel {
         */
        VPSS_VENC_CLOCK_SEL,
        VPSS_VPBE_CLOCK,
+       /* DM365 only clocks */
+       VPSS_IPIPEIF_CLOCK,
+       VPSS_RSZ_CLOCK,
+       VPSS_BL_CLOCK,
+       /*
+        * When using VPSS_PCLK_INTERNAL in vpss_enable_clock() api
+        * following applies:-
+        * en = 0 disable internal PCLK
+        * en = 1 enables internal PCLK
+        */
+       VPSS_PCLK_INTERNAL,
+       /*
+        * When using VPSS_PSYNC_CLOCK_SEL in vpss_enable_clock() api
+        * following applies:-
+        * en = 0 enables MMR clock
+        * en = 1 enables VPSS clock
+        */
+       VPSS_PSYNC_CLOCK_SEL,
+       VPSS_LDC_CLOCK_SEL,
+       VPSS_OSD_CLOCK_SEL,
+       VPSS_FDIF_CLOCK,
+       VPSS_LDC_CLOCK
 };
 
 /* select input to ccdc on dm355 */
 int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel);
 /* enable/disable a vpss clock, 0 - success, -1 - failure */
 int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en);
+/* set sync polarity, only for DM365*/
+void dm365_vpss_set_sync_pol(struct vpss_sync_pol);
+/* set the PG_FRAME_SIZE register, only for DM365 */
+void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size);
 
 /* wbl reset for dm644x */
 enum vpss_wbl_sel {
@@ -65,5 +103,6 @@ enum vpss_wbl_sel {
        VPSS_PCR_PREV_WBL_0,
        VPSS_PCR_CCDC_WBL_O,
 };
+/* clear wbl overflow flag for DM6446 */
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
 #endif
index 2c6af24b905e364097acc57209c236f31cf31268..c66298062d397ae4bbfcb14caef9cf10a8507581 100644 (file)
@@ -35,7 +35,7 @@
 
 struct ir_input_state {
        /* configuration */
-       int                ir_type;
+       u64      ir_type;
 
        /* key info */
        u32                ir_key;      /* ir scancode */
@@ -84,7 +84,7 @@ struct card_ir {
 /* Routines from ir-functions.c */
 
 int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
-                  int ir_type);
+                  const u64 ir_type);
 void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
 void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
                      u32 ir_key);
@@ -162,4 +162,6 @@ extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
 extern struct ir_scancode_table ir_codes_videomate_s350_table;
 extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
 extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table;
+extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table;
+extern struct ir_scancode_table ir_codes_kworld_315u_table;
 #endif
index 299d201e13396998835cb8be4c08c9c48be5777d..61c223bc39537b3b5da43c920da746b97c7ea18f 100644 (file)
@@ -21,13 +21,11 @@ extern int ir_core_debug;
 #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
        printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
 
-enum ir_type {
-       IR_TYPE_UNKNOWN = 0,
-       IR_TYPE_RC5     = 1,
-       IR_TYPE_PD      = 2,             /* Pulse distance encoded IR */
-       IR_TYPE_NEC     = 3,
-       IR_TYPE_OTHER   = 99,
-};
+#define IR_TYPE_UNKNOWN        0
+#define IR_TYPE_RC5    (1  << 0)       /* Philips RC5 protocol */
+#define IR_TYPE_PD     (1  << 1)       /* Pulse distance encoded IR */
+#define IR_TYPE_NEC    (1  << 2)
+#define IR_TYPE_OTHER  (((u64)1) << 63l)
 
 struct ir_scancode {
        u16     scancode;
@@ -37,26 +35,40 @@ struct ir_scancode {
 struct ir_scancode_table {
        struct ir_scancode      *scan;
        int                     size;
-       enum                    ir_type ir_type;
+       u64             ir_type;
        spinlock_t              lock;
 };
 
+struct ir_dev_props {
+       unsigned long allowed_protos;
+       void            *priv;
+       int (*change_protocol)(void *priv, u64 ir_type);
+};
+
+
 struct ir_input_dev {
-       struct input_dev                *dev;
-       struct ir_scancode_table        rc_tab;
+       struct input_dev                *dev;           /* Input device*/
+       struct ir_scancode_table        rc_tab;         /* scan/key table */
+       unsigned long                   devno;          /* device number */
+       struct attribute_group          attr;           /* IR attributes */
+       struct device                   *class_dev;     /* virtual class dev */
+       const struct ir_dev_props       *props;         /* Device properties */
 };
+#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
 
 /* Routines from ir-keytable.c */
 
 u32 ir_g_keycode_from_table(struct input_dev *input_dev,
                            u32 scancode);
 
-int ir_set_keycode_table(struct input_dev *input_dev,
-                        struct ir_scancode_table *rc_tab);
-
-int ir_roundup_tablesize(int n_elems);
 int ir_input_register(struct input_dev *dev,
-                     struct ir_scancode_table *ir_codes);
+                     const struct ir_scancode_table *ir_codes,
+                     const struct ir_dev_props *props);
 void ir_input_unregister(struct input_dev *input_dev);
 
+/* Routines from ir-sysfs.c */
+
+int ir_register_class(struct input_dev *input_dev);
+void ir_unregister_class(struct input_dev *input_dev);
+
 #endif
index aaf65e8b1a40a57697eed7f261e8778d1638fe19..9142936603cc89fc29cf911e4f8b2bdb29a6cf3b 100644 (file)
@@ -36,7 +36,7 @@ enum ir_kbd_get_key_fn {
 struct IR_i2c_init_data {
        struct ir_scancode_table *ir_codes;
        const char             *name;
-       int                    type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
+       u64          type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
        /*
         * Specify either a function pointer or a value indicating one of
         * ir_kbd_i2c's internal get_key functions
index 14c77efd6a85297e2599da5cc08ad30a8f9ce83e..548bf1155c83209f4444d6fc5546eccfb3a2a3df 100644 (file)
@@ -15,8 +15,9 @@
 #include <media/soc_camera.h>
 
 /* for flags */
-#define OV772X_FLAG_VFLIP     0x00000001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP     0x00000002 /* Horizontal flip image */
+#define OV772X_FLAG_VFLIP      (1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP      (1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_8BIT       (1 << 2) /* default 10 bit */
 
 /*
  * for Edge ctrl
@@ -53,9 +54,8 @@ struct ov772x_edge_ctrl {
  * ov772x camera info
  */
 struct ov772x_camera_info {
-       unsigned long          buswidth;
-       unsigned long          flags;
-       struct ov772x_edge_ctrl edgectrl;
+       unsigned long           flags;
+       struct ov772x_edge_ctrl edgectrl;
 };
 
 #endif /* __OV772X_H__ */
index 4aeff96ff7d8105f7bfe5e97b69ec94e1db6d4e8..b9da1f5591e780337b05631a245f9218e65606f0 100644 (file)
@@ -188,6 +188,7 @@ void saa7146_buffer_timeout(unsigned long data);
 void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
                                                struct saa7146_buf *buf);
 
+int saa7146_vv_devinit(struct saa7146_dev *dev);
 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
 int saa7146_vv_release(struct saa7146_dev* dev);
 
index dcc5b86bcb6cce2cd9efa685b25252df5b3abd10..9d69f01b6fa222c4922185df44b2f6fedeed2d22 100644 (file)
@@ -81,6 +81,8 @@ struct soc_camera_host_ops {
        int (*set_bus_param)(struct soc_camera_device *, __u32);
        int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
        int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
+       int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
+       int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
        unsigned int (*poll)(struct file *, poll_table *);
        const struct v4l2_queryctrl *controls;
        int num_controls;
diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h
new file mode 100644 (file)
index 0000000..fcd32a3
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * timb_radio.h Platform struct for the Timberdale radio driver
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _TIMB_RADIO_
+#define _TIMB_RADIO_ 1
+
+#include <linux/i2c.h>
+
+struct timb_radio_platform_data {
+       int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */
+       struct {
+               const char *module_name;
+               struct i2c_board_info *info;
+       } tuner;
+       struct {
+               const char *module_name;
+               struct i2c_board_info *info;
+       } dsp;
+};
+
+#endif
index 4d5b53ff17db3509da5dcb78db4533d7cffc0f6f..5505c5360ca31288f4d00e5098939f87d546c789 100644 (file)
 #define TUNER_PARTSNIC_PTI_5NF05       81
 #define TUNER_PHILIPS_CU1216L           82
 #define TUNER_NXP_TDA18271             83
+#define TUNER_SONY_BTF_PXN01Z          84
 
 /* tv card specific */
 #define TDA9887_PRESENT                (1<<0)
diff --git a/include/media/tvp7002.h b/include/media/tvp7002.h
new file mode 100644 (file)
index 0000000..ee43534
--- /dev/null
@@ -0,0 +1,56 @@
+/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
+ * Digitizer with Horizontal PLL registers
+ *
+ * Copyright (C) 2009 Texas Instruments Inc
+ * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
+ *
+ * This code is partially based upon the TVP5150 driver
+ * written by Mauro Carvalho Chehab (mchehab@infradead.org),
+ * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
+ * and the TVP7002 driver in the TI LSP 2.10.00.14
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef _TVP7002_H_
+#define _TVP7002_H_
+
+/* Platform-dependent data
+ *
+ * clk_polarity:
+ *                     0 -> data clocked out on rising edge of DATACLK signal
+ *                     1 -> data clocked out on falling edge of DATACLK signal
+ * hs_polarity:
+ *                     0 -> active low HSYNC output
+ *                     1 -> active high HSYNC output
+ * sog_polarity:
+ *                     0 -> normal operation
+ *                     1 -> operation with polarity inverted
+ * vs_polarity:
+ *                     0 -> active low VSYNC output
+ *                     1 -> active high VSYNC output
+ * fid_polarity:
+ *                     0 -> the field ID output is set to logic 1 for an odd
+ *                          field (field 1) and set to logic 0 for an even
+ *                          field (field 0).
+ *                     1 -> operation with polarity inverted.
+ */
+struct tvp7002_config {
+       u8 clk_polarity;
+       u8 hs_polarity;
+       u8 vs_polarity;
+       u8 fid_polarity;
+       u8 sog_polarity;
+};
+#endif
index 5e2895a05e6b258e42bb74fdef9af3e4f4044098..90bcf1fa5421baba1498de32ed2558d4e8d08907 100644 (file)
@@ -30,8 +30,8 @@ enum tw9910_mpout_pin {
 };
 
 struct tw9910_video_info {
-       unsigned long          buswidth;
-       enum tw9910_mpout_pin  mpout;
+       unsigned long           buswidth;
+       enum tw9910_mpout_pin   mpout;
 };
 
 
index 6cc107d198a0dc28afe231427feb22edd668280b..56abf21dd7868c6f3480107d7def618acda9c4ae 100644 (file)
@@ -39,6 +39,7 @@ enum {
 
        /* module saa7115: reserved range 101-149 */
        V4L2_IDENT_SAA7111 = 101,
+       V4L2_IDENT_SAA7111A = 102,
        V4L2_IDENT_SAA7113 = 103,
        V4L2_IDENT_SAA7114 = 104,
        V4L2_IDENT_SAA7115 = 105,
@@ -134,6 +135,9 @@ enum {
        /* modules tef6862: just ident 6862 */
        V4L2_IDENT_TEF6862 = 6862,
 
+       /* module tvp7002: just ident 7002 */
+       V4L2_IDENT_TVP7002 = 7002,
+
        /* module adv7170: just ident 7170 */
        V4L2_IDENT_ADV7170 = 7170,
 
@@ -155,6 +159,9 @@ enum {
        /* module adv7343: just ident 7343 */
        V4L2_IDENT_ADV7343 = 7343,
 
+       /* module saa7706h: just ident 7706 */
+       V4L2_IDENT_SAA7706H = 7706,
+
        /* module wm8739: just ident 8739 */
        V4L2_IDENT_WM8739 = 8739,
 
index 9ba99cd39ee7815c121e2be2f06f787bb1bffc30..2bcdca0a57fc6f5a5b4f4b0231bdc298fee3787f 100644 (file)
@@ -180,6 +180,7 @@ struct v4l2_subdev_audio_ops {
        int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
        int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
        int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
+       int (*s_stream)(struct v4l2_subdev *sd, int enable);
 };
 
 /*
index 0f7c37825fc146ae6a8ceee0ce269af3b4ef65eb..45375b41a2a0d44e62a370813ab4fdcbe046e3b3 100644 (file)
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);
 static inline struct inet6_dev *
 __in6_dev_get(struct net_device *dev)
 {
-       return rcu_dereference(dev->ip6_ptr);
+       return rcu_dereference_check(dev->ip6_ptr,
+                                    rcu_read_lock_held() ||
+                                    lockdep_rtnl_is_held());
 }
 
 static inline struct inet6_dev *
index d9a0e74d8923731ff60c41fde87b48ec936f59d1..fb63371c07a8e90ab277add8153dea6b5b2a0371 100644 (file)
@@ -338,7 +338,7 @@ static inline int sk_mc_loop(struct sock *sk)
                return inet6_sk(sk)->mc_loop;
 #endif
        }
-       __WARN();
+       WARN_ON(1);
        return 1;
 }
 
index ba1ba0c5efd1b5047d9251acee2211043e4d0805..63d449807d9b0aaa7a65c743f518cf180761fd59 100644 (file)
@@ -11,6 +11,8 @@ struct nf_conntrack_ecache;
 struct netns_ct {
        atomic_t                count;
        unsigned int            expect_count;
+       unsigned int            htable_size;
+       struct kmem_cache       *nf_conntrack_cachep;
        struct hlist_nulls_head *hash;
        struct hlist_head       *expect_hash;
        struct hlist_nulls_head unconfirmed;
@@ -28,5 +30,6 @@ struct netns_ct {
 #endif
        int                     hash_vmalloc;
        int                     expect_vmalloc;
+       char                    *slabname;
 };
 #endif
index 2eb3814d6258e8d0f9da0be8c81560b20af5b9cf..9a4b8b7140794f3aab802d4a5d8264b53da169bc 100644 (file)
@@ -40,6 +40,7 @@ struct netns_ipv4 {
        struct xt_table         *iptable_security;
        struct xt_table         *nat_table;
        struct hlist_head       *nat_bysource;
+       unsigned int            nat_htable_size;
        int                     nat_vmalloced;
 #endif
 
index 56f8e5585df7c8f66a1cc70eb01748591b6c68c1..74f119a2829a2fe8749e28fdccd99822e58e76dc 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/xfrm.h>
+#include <net/dst_ops.h>
 
 struct ctl_table_header;
 
@@ -42,6 +43,11 @@ struct netns_xfrm {
        unsigned int            policy_count[XFRM_POLICY_MAX * 2];
        struct work_struct      policy_hash_work;
 
+       struct dst_ops          xfrm4_dst_ops;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+       struct dst_ops          xfrm6_dst_ops;
+#endif
+
        struct sock             *nlsk;
        struct sock             *nlsk_stash;
 
index 15696b1fd30fbe85c248ad95fba4a4e7db4f4454..ab170a60e7d31a6a72b2f88fd7e3696007abb039 100644 (file)
@@ -132,6 +132,8 @@ static __inline__ void nr_node_put(struct nr_node *nr_node)
 static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
 {
        if (atomic_dec_and_test(&nr_neigh->refcount)) {
+               if (nr_neigh->ax25)
+                       ax25_cb_put(nr_neigh->ax25);
                kfree(nr_neigh->digipeat);
                kfree(nr_neigh);
        }
index 6d85861ab9909f4017b79d5be6a3884a685c21be..60c27706e7b99fcce2d7df451564ae4569d394f4 100644 (file)
@@ -1367,8 +1367,8 @@ struct xfrmk_spdinfo {
 extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq);
 extern int xfrm_state_delete(struct xfrm_state *x);
 extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
-extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
-extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
+extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
+extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
 extern int xfrm_replay_check(struct xfrm_state *x,
                             struct sk_buff *skb, __be32 seq);
 extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
index ee148573c11435750dc26e12d135b03a584d3e08..d57847f2f6c115549d477cf745547550ba1b1bf5 100644 (file)
@@ -40,7 +40,7 @@ struct net_device;
  * Documentation/pcmcia/driver.txt for details.
 */
 struct pcmcia_dynids {
-       spinlock_t              lock;
+       struct mutex            lock;
        struct list_head        list;
 };
 
index cbfba885eb85b8376dcc60bb0fb4608944b35015..32896a77391054babaeb60482ad121a4864329af 100644 (file)
@@ -134,9 +134,9 @@ struct pccard_operations {
 
 struct pcmcia_socket {
        struct module                   *owner;
-       spinlock_t                      lock;
        socket_state_t                  socket;
        u_int                           state;
+       u_int                           suspended_state;        /* state before suspend */
        u_short                         functions;
        u_short                         lock_count;
        pccard_mem_map                  cis_mem;
@@ -200,9 +200,14 @@ struct pcmcia_socket {
        struct task_struct              *thread;
        struct completion               thread_done;
        unsigned int                    thread_events;
-       /* protects socket h/w state */
+       unsigned int                    sysfs_events;
+
+       /* For the non-trivial interaction between these locks,
+        * see Documentation/pcmcia/locking.txt */
        struct mutex                    skt_mutex;
-       /* protects thread_events */
+       struct mutex                    ops_mutex;
+
+       /* protects thread_events and sysfs_events */
        spinlock_t                      thread_lock;
 
        /* pcmcia (16-bit) */
@@ -225,30 +230,19 @@ struct pcmcia_socket {
                u8                      busy:1;
                /* pcmcia module is being unloaded */
                u8                      dead:1;
-               /* a multifunction-device add event is pending */
-               u8                      device_add_pending:1;
-               /* the pending event adds a mfc (1) or pfc (0) */
-               u8                      mfc_pfc:1;
+               /* the PCMCIA card consists of two pseudo devices */
+               u8                      has_pfc:1;
 
-               u8                      reserved:3;
+               u8                      reserved:4;
        } pcmcia_state;
 
 
-       /* for adding further pseudo-multifunction devices */
-       struct work_struct              device_add;
-
 #ifdef CONFIG_PCMCIA_IOCTL
        struct user_info_t              *user;
        wait_queue_head_t               queue;
 #endif /* CONFIG_PCMCIA_IOCTL */
 #endif /* CONFIG_PCMCIA */
 
-       /* cardbus (32-bit) */
-#ifdef CONFIG_CARDBUS
-       struct resource                 *cb_cis_res;
-       void __iomem                    *cb_cis_virt;
-#endif /* CONFIG_CARDBUS */
-
        /* socket device */
        struct device                   dev;
        /* data internal to the socket driver */
@@ -263,13 +257,25 @@ struct pcmcia_socket {
  * - pccard_static_ops         iomem and ioport areas are assigned statically
  * - pccard_iodyn_ops          iomem areas is assigned statically, ioport
  *                             areas dynamically
+ *                             If this option is selected, use
+ *                             "select PCCARD_IODYN" in Kconfig.
  * - pccard_nonstatic_ops      iomem and ioport areas are assigned dynamically.
  *                             If this option is selected, use
  *                             "select PCCARD_NONSTATIC" in Kconfig.
+ *
  */
 extern struct pccard_resource_ops pccard_static_ops;
+#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
 extern struct pccard_resource_ops pccard_iodyn_ops;
 extern struct pccard_resource_ops pccard_nonstatic_ops;
+#else
+/* If PCMCIA is not used, but only CARDBUS, these functions are not used
+ * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module
+ */
+#define pccard_iodyn_ops pccard_static_ops
+#define pccard_nonstatic_ops pccard_static_ops
+#endif
+
 
 /* socket drivers are expected to use these callbacks in their .drv struct */
 extern int pcmcia_socket_dev_suspend(struct device *dev);
index a4b233318179b16e80997723b82959a45b89df90..91a4e4ff9a9bbeb28d66394299e3ef3c938e5b0c 100644 (file)
@@ -292,7 +292,7 @@ struct fc_bsg_request {
                struct fc_bsg_rport_els         r_els;
                struct fc_bsg_rport_ct          r_ct;
        } rqst_data;
-};
+} __attribute__((packed));
 
 
 /* response (request sense data) structure of the sg_io_v4 */
index 7c4449900c24510b60eb40d1f1e27d329db4795f..d80b6dbed1cac2a34c2cf7655590cd1473a9e378 100644 (file)
@@ -348,7 +348,8 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
                            struct scsi_sense_hdr *);
 extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
                                int retries, struct scsi_sense_hdr *sshdr);
-extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page);
+extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf,
+                            int buf_len);
 extern int scsi_device_set_state(struct scsi_device *sdev,
                                 enum scsi_device_state state);
 extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
index 61ad3594aad65c3fc4259e7d4a112c161a9e83bb..ffeebc34a4f7b27ce3ab3cbd75d8f41d0f4edf54 100644 (file)
@@ -107,6 +107,8 @@ struct sas_end_device {
        struct sas_rphy         rphy;
        /* flags */
        unsigned                ready_led_meaning:1;
+       unsigned                tlr_supported:1;
+       unsigned                tlr_enabled:1;
        /* parameters */
        u16                     I_T_nexus_loss_timeout;
        u16                     initiator_response_timeout;
@@ -181,6 +183,11 @@ extern int sas_phy_add(struct sas_phy *);
 extern void sas_phy_delete(struct sas_phy *);
 extern int scsi_is_sas_phy(const struct device *);
 
+unsigned int sas_tlr_supported(struct scsi_device *);
+unsigned int sas_is_tlr_enabled(struct scsi_device *);
+void sas_disable_tlr(struct scsi_device *);
+void sas_enable_tlr(struct scsi_device *);
+
 extern struct sas_rphy *sas_end_device_alloc(struct sas_port *);
 extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type);
 void sas_rphy_free(struct sas_rphy *);
index a870ba125aa87509c6a49c0036e3c801d7159aea..5c1dcfc16c6037019d8bcecf4e7c2fa4f3649505 100644 (file)
@@ -20,14 +20,17 @@ TRACE_EVENT(lock_acquire,
        TP_STRUCT__entry(
                __field(unsigned int, flags)
                __string(name, lock->name)
+               __field(void *, lockdep_addr)
        ),
 
        TP_fast_assign(
                __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
                __assign_str(name, lock->name);
+               __entry->lockdep_addr = lock;
        ),
 
-       TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "",
+       TP_printk("%p %s%s%s", __entry->lockdep_addr,
+                 (__entry->flags & 1) ? "try " : "",
                  (__entry->flags & 2) ? "read " : "",
                  __get_str(name))
 );
@@ -40,13 +43,16 @@ TRACE_EVENT(lock_release,
 
        TP_STRUCT__entry(
                __string(name, lock->name)
+               __field(void *, lockdep_addr)
        ),
 
        TP_fast_assign(
                __assign_str(name, lock->name);
+               __entry->lockdep_addr = lock;
        ),
 
-       TP_printk("%s", __get_str(name))
+       TP_printk("%p %s",
+                 __entry->lockdep_addr, __get_str(name))
 );
 
 #ifdef CONFIG_LOCK_STAT
@@ -59,13 +65,16 @@ TRACE_EVENT(lock_contended,
 
        TP_STRUCT__entry(
                __string(name, lock->name)
+               __field(void *, lockdep_addr)
        ),
 
        TP_fast_assign(
                __assign_str(name, lock->name);
+               __entry->lockdep_addr = lock;
        ),
 
-       TP_printk("%s", __get_str(name))
+       TP_printk("%p %s",
+                 __entry->lockdep_addr, __get_str(name))
 );
 
 TRACE_EVENT(lock_acquired,
@@ -75,16 +84,18 @@ TRACE_EVENT(lock_acquired,
 
        TP_STRUCT__entry(
                __string(name, lock->name)
-               __field(unsigned long, wait_usec)
-               __field(unsigned long, wait_nsec_rem)
+               __field(s64, wait_nsec)
+               __field(void *, lockdep_addr)
        ),
+
        TP_fast_assign(
                __assign_str(name, lock->name);
-               __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
-               __entry->wait_usec = (unsigned long) waittime;
+               __entry->wait_nsec = waittime;
+               __entry->lockdep_addr = lock;
        ),
-       TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec,
-                                      __entry->wait_nsec_rem)
+       TP_printk("%p %s (%llu ns)", __entry->lockdep_addr,
+                 __get_str(name),
+                 __entry->wait_nsec)
 );
 
 #endif
index c6fe03e902ca2c4502c984b79645d1d3648f2640..0804cd5948035d9dd8d59084e946c1d32cad330c 100644 (file)
@@ -65,7 +65,8 @@
        };
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args)      \
-       static struct ftrace_event_call event_##name
+       static struct ftrace_event_call                 \
+       __attribute__((__aligned__(4))) event_##name
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-/*
- * Setup the showing format of trace point.
- *
- * int
- * ftrace_format_##call(struct trace_seq *s)
- * {
- *     struct ftrace_raw_##call field;
- *     int ret;
- *
- *     ret = trace_seq_printf(s, #type " " #item ";"
- *                            " offset:%u; size:%u;\n",
- *                            offsetof(struct ftrace_raw_##call, item),
- *                            sizeof(field.type));
- *
- * }
- */
-
-#undef TP_STRUCT__entry
-#define TP_STRUCT__entry(args...) args
-
-#undef __field
-#define __field(type, item)                                    \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%u;\tsize:%u;\tsigned:%u;\n",    \
-                              (unsigned int)offsetof(typeof(field), item), \
-                              (unsigned int)sizeof(field.item),        \
-                              (unsigned int)is_signed_type(type));     \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __field_ext
-#define __field_ext(type, item, filter_type)   __field(type, item)
-
-#undef __array
-#define __array(type, item, len)                                               \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t"    \
-                              "offset:%u;\tsize:%u;\tsigned:%u;\n",    \
-                              (unsigned int)offsetof(typeof(field), item), \
-                              (unsigned int)sizeof(field.item),        \
-                              (unsigned int)is_signed_type(type));     \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __dynamic_array
-#define __dynamic_array(type, item, len)                                      \
-       ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
-                              "offset:%u;\tsize:%u;\tsigned:%u;\n",           \
-                              (unsigned int)offsetof(typeof(field),           \
-                                       __data_loc_##item),                    \
-                              (unsigned int)sizeof(field.__data_loc_##item), \
-                              (unsigned int)is_signed_type(type));     \
-       if (!ret)                                                              \
-               return 0;
-
-#undef __string
-#define __string(item, src) __dynamic_array(char, item, -1)
-
-#undef __entry
-#define __entry REC
-
-#undef __print_symbolic
-#undef __get_dynamic_array
-#undef __get_str
-
-#undef TP_printk
-#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)
-
-#undef TP_fast_assign
-#define TP_fast_assign(args...) args
-
-#undef TP_perf_assign
-#define TP_perf_assign(args...)
-
-#undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)   \
-static int                                                             \
-ftrace_format_setup_##call(struct ftrace_event_call *unused,           \
-                          struct trace_seq *s)                         \
-{                                                                      \
-       struct ftrace_raw_##call field __attribute__((unused));         \
-       int ret = 0;                                                    \
-                                                                       \
-       tstruct;                                                        \
-                                                                       \
-       return ret;                                                     \
-}                                                                      \
-                                                                       \
-static int                                                             \
-ftrace_format_##call(struct ftrace_event_call *unused,                 \
-                    struct trace_seq *s)                               \
-{                                                                      \
-       int ret = 0;                                                    \
-                                                                       \
-       ret = ftrace_format_setup_##call(unused, s);                    \
-       if (!ret)                                                       \
-               return ret;                                             \
-                                                                       \
-       ret = trace_seq_printf(s, "\nprint fmt: " print);               \
-                                                                       \
-       return ret;                                                     \
-}
-
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(template, name, proto, args)
-
-#undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)         \
-static int                                                             \
-ftrace_format_##name(struct ftrace_event_call *unused,                 \
-                     struct trace_seq *s)                              \
-{                                                                      \
-       int ret = 0;                                                    \
-                                                                       \
-       ret = ftrace_format_setup_##template(unused, s);                \
-       if (!ret)                                                       \
-               return ret;                                             \
-                                                                       \
-       trace_seq_printf(s, "\nprint fmt: " print);                     \
-                                                                       \
-       return ret;                                                     \
-}
-
-#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
-
 /*
  * Stage 3 of the trace events.
  *
@@ -323,7 +200,7 @@ ftrace_format_##name(struct ftrace_event_call *unused,                      \
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
-static enum print_line_t                                               \
+static notrace enum print_line_t                                       \
 ftrace_raw_output_id_##call(int event_id, const char *name,            \
                            struct trace_iterator *iter, int flags)     \
 {                                                                      \
@@ -356,7 +233,7 @@ ftrace_raw_output_id_##call(int event_id, const char *name,         \
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args)                      \
-static enum print_line_t                                               \
+static notrace enum print_line_t                                       \
 ftrace_raw_output_##name(struct trace_iterator *iter, int flags)       \
 {                                                                      \
        return ftrace_raw_output_id_##template(event_##name.id,         \
@@ -365,7 +242,7 @@ ftrace_raw_output_##name(struct trace_iterator *iter, int flags)    \
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, call, proto, args, print)         \
-static enum print_line_t                                               \
+static notrace enum print_line_t                                       \
 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)       \
 {                                                                      \
        struct trace_seq *s = &iter->seq;                               \
@@ -431,7 +308,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)    \
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)   \
-static int                                                             \
+static int notrace                                                     \
 ftrace_define_fields_##call(struct ftrace_event_call *event_call)      \
 {                                                                      \
        struct ftrace_raw_##call field;                                 \
@@ -479,7 +356,7 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call)   \
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
-static inline int ftrace_get_offsets_##call(                           \
+static inline notrace int ftrace_get_offsets_##call(                   \
        struct ftrace_data_offsets_##call *__data_offsets, proto)       \
 {                                                                      \
        int __data_size = 0;                                            \
@@ -499,7 +376,7 @@ static inline int ftrace_get_offsets_##call(                                \
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 /*
  * Generate the functions needed for tracepoint perf_event support.
@@ -526,12 +403,14 @@ static inline int ftrace_get_offsets_##call(                              \
                                                                        \
 static void ftrace_profile_##name(proto);                              \
                                                                        \
-static int ftrace_profile_enable_##name(struct ftrace_event_call *unused)\
+static notrace int                                                     \
+ftrace_profile_enable_##name(struct ftrace_event_call *unused)         \
 {                                                                      \
        return register_trace_##name(ftrace_profile_##name);            \
 }                                                                      \
                                                                        \
-static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
+static notrace void                                                    \
+ftrace_profile_disable_##name(struct ftrace_event_call *unused)                \
 {                                                                      \
        unregister_trace_##name(ftrace_profile_##name);                 \
 }
@@ -542,7 +421,7 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#endif
+#endif /* CONFIG_PERF_EVENTS */
 
 /*
  * Stage 4 of the trace events.
@@ -622,12 +501,11 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
  *     .raw_init               = trace_event_raw_init,
  *     .regfunc                = ftrace_reg_event_<call>,
  *     .unregfunc              = ftrace_unreg_event_<call>,
- *     .show_format            = ftrace_format_<call>,
  * }
  *
  */
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 #define _TRACE_PROFILE_INIT(call)                                      \
        .profile_enable = ftrace_profile_enable_##call,                 \
@@ -635,7 +513,7 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 
 #else
 #define _TRACE_PROFILE_INIT(call)
-#endif
+#endif /* CONFIG_PERF_EVENTS */
 
 #undef __entry
 #define __entry entry
@@ -657,10 +535,17 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 #define __assign_str(dst, src)                                         \
        strcpy(__get_str(dst), src);
 
+#undef TP_fast_assign
+#define TP_fast_assign(args...) args
+
+#undef TP_perf_assign
+#define TP_perf_assign(args...)
+
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
                                                                        \
-static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
+static notrace void                                                    \
+ftrace_raw_event_id_##call(struct ftrace_event_call *event_call,       \
                                       proto)                           \
 {                                                                      \
        struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
@@ -697,17 +582,19 @@ static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, call, proto, args)                      \
                                                                        \
-static void ftrace_raw_event_##call(proto)                             \
+static notrace void ftrace_raw_event_##call(proto)                     \
 {                                                                      \
        ftrace_raw_event_id_##template(&event_##call, args);            \
 }                                                                      \
                                                                        \
-static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\
+static notrace int                                                     \
+ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)          \
 {                                                                      \
        return register_trace_##call(ftrace_raw_event_##call);          \
 }                                                                      \
                                                                        \
-static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
+static notrace void                                                    \
+ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)                \
 {                                                                      \
        unregister_trace_##call(ftrace_raw_event_##call);               \
 }                                                                      \
@@ -722,8 +609,20 @@ static struct trace_event ftrace_event_type_##call = {                     \
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
+#undef __entry
+#define __entry REC
+
+#undef __print_flags
+#undef __print_symbolic
+#undef __get_dynamic_array
+#undef __get_str
+
+#undef TP_printk
+#define TP_printk(fmt, args...) "\"" fmt "\", "  __stringify(args)
+
 #undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
+#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
+static const char print_fmt_##call[] = print;
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, call, proto, args)                      \
@@ -737,7 +636,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
-       .show_format            = ftrace_format_##template,             \
+       .print_fmt              = print_fmt_##template,                 \
        .define_fields          = ftrace_define_fields_##template,      \
        _TRACE_PROFILE_INIT(call)                                       \
 }
@@ -745,6 +644,8 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, call, proto, args, print)         \
                                                                        \
+static const char print_fmt_##call[] = print;                          \
+                                                                       \
 static struct ftrace_event_call __used                                 \
 __attribute__((__aligned__(4)))                                                \
 __attribute__((section("_ftrace_events"))) event_##call = {            \
@@ -754,7 +655,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
-       .show_format            = ftrace_format_##call,                 \
+       .print_fmt              = print_fmt_##call,                     \
        .define_fields          = ftrace_define_fields_##template,      \
        _TRACE_PROFILE_INIT(call)                                       \
 }
@@ -835,7 +736,17 @@ __attribute__((section("_ftrace_events"))) event_##call = {                \
  * }
  */
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
+
+#undef __entry
+#define __entry entry
+
+#undef __get_dynamic_array
+#define __get_dynamic_array(field)     \
+               ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
+
+#undef __get_str
+#define __get_str(field) (char *)__get_dynamic_array(field)
 
 #undef __perf_addr
 #define __perf_addr(a) __addr = (a)
@@ -845,27 +756,17 @@ __attribute__((section("_ftrace_events"))) event_##call = {               \
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
-static void                                                            \
+static notrace void                                                    \
 ftrace_profile_templ_##call(struct ftrace_event_call *event_call,      \
                            proto)                                      \
 {                                                                      \
        struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
-       extern int perf_swevent_get_recursion_context(void);            \
-       extern void perf_swevent_put_recursion_context(int rctx);       \
-       extern void perf_tp_event(int, u64, u64, void *, int);          \
        struct ftrace_raw_##call *entry;                                \
        u64 __addr = 0, __count = 1;                                    \
        unsigned long irq_flags;                                        \
-       struct trace_entry *ent;                                        \
        int __entry_size;                                               \
        int __data_size;                                                \
-       char *trace_buf;                                                \
-       char *raw_data;                                                 \
-       int __cpu;                                                      \
        int rctx;                                                       \
-       int pc;                                                         \
-                                                                       \
-       pc = preempt_count();                                           \
                                                                        \
        __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
        __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
@@ -875,47 +776,21 @@ ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \
        if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE,           \
                      "profile buffer not large enough"))               \
                return;                                                 \
-                                                                       \
-       local_irq_save(irq_flags);                                      \
-                                                                       \
-       rctx = perf_swevent_get_recursion_context();                    \
-       if (rctx < 0)                                                   \
-               goto end_recursion;                                     \
-                                                                       \
-       __cpu = smp_processor_id();                                     \
-                                                                       \
-       if (in_nmi())                                                   \
-               trace_buf = rcu_dereference(perf_trace_buf_nmi);        \
-       else                                                            \
-               trace_buf = rcu_dereference(perf_trace_buf);            \
-                                                                       \
-       if (!trace_buf)                                                 \
-               goto end;                                               \
-                                                                       \
-       raw_data = per_cpu_ptr(trace_buf, __cpu);                       \
-                                                                       \
-       *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;         \
-       entry = (struct ftrace_raw_##call *)raw_data;                   \
-       ent = &entry->ent;                                              \
-       tracing_generic_entry_update(ent, irq_flags, pc);               \
-       ent->type = event_call->id;                                     \
-                                                                       \
+       entry = (struct ftrace_raw_##call *)ftrace_perf_buf_prepare(    \
+               __entry_size, event_call->id, &rctx, &irq_flags);       \
+       if (!entry)                                                     \
+               return;                                                 \
        tstruct                                                         \
                                                                        \
        { assign; }                                                     \
                                                                        \
-       perf_tp_event(event_call->id, __addr, __count, entry,           \
-                            __entry_size);                             \
-                                                                       \
-end:                                                                   \
-       perf_swevent_put_recursion_context(rctx);                       \
-end_recursion:                                                         \
-       local_irq_restore(irq_flags);                                   \
+       ftrace_perf_buf_submit(entry, __entry_size, rctx, __addr,       \
+                              __count, irq_flags);                     \
 }
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, call, proto, args)              \
-static void ftrace_profile_##call(proto)                       \
+static notrace void ftrace_profile_##call(proto)               \
 {                                                              \
        struct ftrace_event_call *event_call = &event_##call;   \
                                                                \
@@ -927,7 +802,7 @@ static void ftrace_profile_##call(proto)                    \
        DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
-#endif /* CONFIG_EVENT_PROFILE */
+#endif /* CONFIG_PERF_EVENTS */
 
 #undef _TRACE_PROFILE_INIT
 
index 961fda3556bb828f62508dc3acb440c90f21e32d..0387100752f06836981f0afa7c761d2b270786e8 100644 (file)
@@ -34,10 +34,6 @@ struct syscall_metadata {
 extern unsigned long arch_syscall_addr(int nr);
 extern int init_syscall_trace(struct ftrace_event_call *call);
 
-extern int syscall_enter_format(struct ftrace_event_call *call,
-                               struct trace_seq *s);
-extern int syscall_exit_format(struct ftrace_event_call *call,
-                               struct trace_seq *s);
 extern int syscall_enter_define_fields(struct ftrace_event_call *call);
 extern int syscall_exit_define_fields(struct ftrace_event_call *call);
 extern int reg_event_syscall_enter(struct ftrace_event_call *call);
@@ -49,12 +45,12 @@ ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
 enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
 enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
 #endif
-#ifdef CONFIG_EVENT_PROFILE
+
+#ifdef CONFIG_PERF_EVENTS
 int prof_sysenter_enable(struct ftrace_event_call *call);
 void prof_sysenter_disable(struct ftrace_event_call *call);
 int prof_sysexit_enable(struct ftrace_event_call *call);
 void prof_sysexit_disable(struct ftrace_event_call *call);
-
 #endif
 
 #endif /* _TRACE_SYSCALL_H */
index 288205457713bab6191e42e7a8f99bd01861ec51..2cc893fc1f8515364ce480a5c6c827a1dc58428e 100644 (file)
@@ -34,6 +34,8 @@ enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
 #define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
 #define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */
 
+#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
+
 struct sh_mobile_lcdc_sys_bus_cfg {
        unsigned long ldmt2r;
        unsigned long ldmt3r;
index d95ca7cd5d45f092fe33e175a577e0a94675c549..089a230e565271c960f952cb279ac43571fb99f3 100644 (file)
@@ -396,6 +396,22 @@ config RCU_FANOUT_EXACT
 
          Say N if unsure.
 
+config RCU_FAST_NO_HZ
+       bool "Accelerate last non-dyntick-idle CPU's grace periods"
+       depends on TREE_RCU && NO_HZ && SMP
+       default n
+       help
+         This option causes RCU to attempt to accelerate grace periods
+         in order to allow the final CPU to enter dynticks-idle state
+         more quickly.  On the other hand, this option increases the
+         overhead of the dynticks-idle checking, particularly on systems
+         with large numbers of CPUs.
+
+         Say Y if energy efficiency is critically important, particularly
+               if you have relatively few CPUs.
+
+         Say N if you are unsure.
+
 config TREE_RCU_TRACE
        def_bool RCU_TRACE && ( TREE_RCU || TREE_PREEMPT_RCU )
        select DEBUG_FS
@@ -445,57 +461,6 @@ config LOG_BUF_SHIFT
 config HAVE_UNSTABLE_SCHED_CLOCK
        bool
 
-config GROUP_SCHED
-       bool "Group CPU scheduler"
-       depends on EXPERIMENTAL
-       default n
-       help
-         This feature lets CPU scheduler recognize task groups and control CPU
-         bandwidth allocation to such task groups.
-         In order to create a group from arbitrary set of processes, use
-         CONFIG_CGROUPS. (See Control Group support.)
-
-config FAIR_GROUP_SCHED
-       bool "Group scheduling for SCHED_OTHER"
-       depends on GROUP_SCHED
-       default GROUP_SCHED
-
-config RT_GROUP_SCHED
-       bool "Group scheduling for SCHED_RR/FIFO"
-       depends on EXPERIMENTAL
-       depends on GROUP_SCHED
-       default n
-       help
-         This feature lets you explicitly allocate real CPU bandwidth
-         to users or control groups (depending on the "Basis for grouping tasks"
-         setting below. If enabled, it will also make it impossible to
-         schedule realtime tasks for non-root users until you allocate
-         realtime bandwidth for them.
-         See Documentation/scheduler/sched-rt-group.txt for more information.
-
-choice
-       depends on GROUP_SCHED
-       prompt "Basis for grouping tasks"
-       default USER_SCHED
-
-config USER_SCHED
-       bool "user id"
-       help
-         This option will choose userid as the basis for grouping
-         tasks, thus providing equal CPU bandwidth to each user.
-
-config CGROUP_SCHED
-       bool "Control groups"
-       depends on CGROUPS
-       help
-         This option allows you to create arbitrary task groups
-         using the "cgroup" pseudo filesystem and control
-         the cpu bandwidth allocated to each such task group.
-         Refer to Documentation/cgroups/cgroups.txt for more
-         information on "cgroup" pseudo filesystem.
-
-endchoice
-
 menuconfig CGROUPS
        boolean "Control Group support"
        help
@@ -616,6 +581,36 @@ config CGROUP_MEM_RES_CTLR_SWAP
          Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page
          size is 4096bytes, 512k per 1Gbytes of swap.
 
+menuconfig CGROUP_SCHED
+       bool "Group CPU scheduler"
+       depends on EXPERIMENTAL && CGROUPS
+       default n
+       help
+         This feature lets CPU scheduler recognize task groups and control CPU
+         bandwidth allocation to such task groups. It uses cgroups to group
+         tasks.
+
+if CGROUP_SCHED
+config FAIR_GROUP_SCHED
+       bool "Group scheduling for SCHED_OTHER"
+       depends on CGROUP_SCHED
+       default CGROUP_SCHED
+
+config RT_GROUP_SCHED
+       bool "Group scheduling for SCHED_RR/FIFO"
+       depends on EXPERIMENTAL
+       depends on CGROUP_SCHED
+       default n
+       help
+         This feature lets you explicitly allocate real CPU bandwidth
+         to users or control groups (depending on the "Basis for grouping tasks"
+         setting below. If enabled, it will also make it impossible to
+         schedule realtime tasks for non-root users until you allocate
+         realtime bandwidth for them.
+         See Documentation/scheduler/sched-rt-group.txt for more information.
+
+endif #CGROUP_SCHED
+
 endif # CGROUPS
 
 config MM_OWNER
@@ -976,19 +971,6 @@ config PERF_EVENTS
 
          Say Y if unsure.
 
-config EVENT_PROFILE
-       bool "Tracepoint profiling sources"
-       depends on PERF_EVENTS && EVENT_TRACING
-       default y
-       help
-        Allow the use of tracepoints as software performance events.
-
-        When this is enabled, you can create perf events based on
-        tracepoints using PERF_TYPE_TRACEPOINT and the tracepoint ID
-        found in debugfs://tracing/events/*/*/id. (The -e/--events
-        option to the perf tool can parse and interpret symbolic
-        tracepoints, in the subsystem:tracepoint_name format.)
-
 config PERF_COUNTERS
        bool "Kernel performance counters (old config option)"
        depends on HAVE_PERF_EVENTS
@@ -1112,7 +1094,7 @@ config MMAP_ALLOW_UNINITIALIZED
          See Documentation/nommu-mmap.txt for more information.
 
 config PROFILING
-       bool "Profiling support (EXPERIMENTAL)"
+       bool "Profiling support"
        help
          Say Y here to enable the extended profiling support mechanisms used
          by profilers such as OProfile.
@@ -1262,4 +1244,8 @@ source "block/Kconfig"
 config PREEMPT_NOTIFIERS
        bool
 
+config PADATA
+       depends on SMP
+       bool
+
 source "kernel/Kconfig.locks"
index dac44a9356a52637e56669989c303f0b792aaa11..c75dcd6eef091061e78b306ce3944958b5b9b30d 100644 (file)
@@ -416,7 +416,9 @@ static noinline void __init_refok rest_init(void)
        kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
        numa_default_policy();
        pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
+       rcu_read_lock();
        kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
+       rcu_read_unlock();
        unlock_kernel();
 
        /*
@@ -657,9 +659,9 @@ asmlinkage void __init start_kernel(void)
        proc_caches_init();
        buffer_init();
        key_init();
+       radix_tree_init();
        security_init();
        vfs_caches_init(totalram_pages);
-       radix_tree_init();
        signals_init();
        /* rootfs populating might need page-writeback */
        page_writeback_init();
index 92fe9236258b15192fe78ae615891c624b91c036..23256b8558193c9fcdaa2761c1b81345af090b0d 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -298,6 +298,9 @@ static const struct file_operations shm_file_operations = {
        .mmap           = shm_mmap,
        .fsync          = shm_fsync,
        .release        = shm_release,
+#ifndef CONFIG_MMU
+       .get_unmapped_area      = shm_get_unmapped_area,
+#endif
 };
 
 static const struct file_operations shm_file_operations_huge = {
index 864ff75d65f23da5a5556a8883d06f7aa6169ac8..6aebdeb2aa348ded8253bdd54fda9f7ee3a47991 100644 (file)
@@ -100,6 +100,7 @@ obj-$(CONFIG_SLOW_WORK_DEBUG) += slow-work-debugfs.o
 obj-$(CONFIG_PERF_EVENTS) += perf_event.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
 obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o
+obj-$(CONFIG_PADATA) += padata.o
 
 ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
 # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
index 1fbcc748044a7f3dc367381838289ecce3992652..4fd90e12977236f54a4dd29168bc2db04bb1cdbc 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/cgroup.h>
+#include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -166,6 +167,20 @@ static DEFINE_SPINLOCK(hierarchy_id_lock);
  */
 static int need_forkexit_callback __read_mostly;
 
+#ifdef CONFIG_PROVE_LOCKING
+int cgroup_lock_is_held(void)
+{
+       return lockdep_is_held(&cgroup_mutex);
+}
+#else /* #ifdef CONFIG_PROVE_LOCKING */
+int cgroup_lock_is_held(void)
+{
+       return mutex_is_locked(&cgroup_mutex);
+}
+#endif /* #else #ifdef CONFIG_PROVE_LOCKING */
+
+EXPORT_SYMBOL_GPL(cgroup_lock_is_held);
+
 /* convenient tests for these bits */
 inline int cgroup_is_removed(const struct cgroup *cgrp)
 {
@@ -2936,14 +2951,17 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
 
        for_each_subsys(root, ss) {
                struct cgroup_subsys_state *css = ss->create(ss, cgrp);
+
                if (IS_ERR(css)) {
                        err = PTR_ERR(css);
                        goto err_destroy;
                }
                init_cgroup_css(css, ss, cgrp);
-               if (ss->use_id)
-                       if (alloc_css_id(ss, parent, cgrp))
+               if (ss->use_id) {
+                       err = alloc_css_id(ss, parent, cgrp);
+                       if (err)
                                goto err_destroy;
+               }
                /* At error, ->destroy() callback has to free assigned ID. */
        }
 
index 1c8ddd6ee9402fdf2f6853c6142f3a8d0cb57da6..677f25376a381ed909d431267ab891524313fe2a 100644 (file)
@@ -151,13 +151,13 @@ static inline void check_for_tasks(int cpu)
 
        write_lock_irq(&tasklist_lock);
        for_each_process(p) {
-               if (task_cpu(p) == cpu &&
+               if (task_cpu(p) == cpu && p->state == TASK_RUNNING &&
                    (!cputime_eq(p->utime, cputime_zero) ||
                     !cputime_eq(p->stime, cputime_zero)))
-                       printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
-                               (state = %ld, flags = %x) \n",
-                                p->comm, task_pid_nr(p), cpu,
-                                p->state, p->flags);
+                       printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d "
+                               "(state = %ld, flags = %x)\n",
+                               p->comm, task_pid_nr(p), cpu,
+                               p->state, p->flags);
        }
        write_unlock_irq(&tasklist_lock);
 }
index dd76cfe5f5b038dbd4fe804a5bfbd6663dd634ce..1ed8ca18790c1e937208af47bed6695f4218858b 100644 (file)
@@ -224,7 +224,7 @@ struct cred *cred_alloc_blank(void)
 #ifdef CONFIG_KEYS
        new->tgcred = kzalloc(sizeof(*new->tgcred), GFP_KERNEL);
        if (!new->tgcred) {
-               kfree(new);
+               kmem_cache_free(cred_jar, new);
                return NULL;
        }
        atomic_set(&new->tgcred->usage, 1);
index 546774a31a66752a698faa02c4e54f7c39fbef9e..45ed043b8bf59b8704b7cc13f19b1b13824b7ce4 100644 (file)
@@ -85,7 +85,9 @@ static void __exit_signal(struct task_struct *tsk)
        BUG_ON(!sig);
        BUG_ON(!atomic_read(&sig->count));
 
-       sighand = rcu_dereference(tsk->sighand);
+       sighand = rcu_dereference_check(tsk->sighand,
+                                       rcu_read_lock_held() ||
+                                       lockdep_is_held(&tasklist_lock));
        spin_lock(&sighand->siglock);
 
        posix_cpu_timers_exit(tsk);
@@ -170,8 +172,10 @@ void release_task(struct task_struct * p)
 repeat:
        tracehook_prepare_release_task(p);
        /* don't need to get the RCU readlock here - the process is dead and
-        * can't be modifying its own credentials */
+        * can't be modifying its own credentials. But shut RCU-lockdep up */
+       rcu_read_lock();
        atomic_dec(&__task_cred(p)->user->processes);
+       rcu_read_unlock();
 
        proc_flush_task(p);
 
@@ -473,9 +477,11 @@ static void close_files(struct files_struct * files)
        /*
         * It is safe to dereference the fd table without RCU or
         * ->file_lock because this is the last reference to the
-        * files structure.
+        * files structure.  But use RCU to shut RCU-lockdep up.
         */
+       rcu_read_lock();
        fdt = files_fdtable(files);
+       rcu_read_unlock();
        for (;;) {
                unsigned long set;
                i = j * __NFDBITS;
@@ -521,10 +527,12 @@ void put_files_struct(struct files_struct *files)
                 * at the end of the RCU grace period. Otherwise,
                 * you can free files immediately.
                 */
+               rcu_read_lock();
                fdt = files_fdtable(files);
                if (fdt != &files->fdtab)
                        kmem_cache_free(files_cachep, files);
                free_fdtable(fdt);
+               rcu_read_unlock();
        }
 }
 
index 5b2959b3ffc2c239244c25548f3d5c5506baf674..17bbf093356d085123b83fa93c05a89e380fb53e 100644 (file)
@@ -86,6 +86,7 @@ int max_threads;              /* tunable limit on nr_threads */
 DEFINE_PER_CPU(unsigned long, process_counts) = 0;
 
 __cacheline_aligned DEFINE_RWLOCK(tasklist_lock);  /* outer */
+EXPORT_SYMBOL_GPL(tasklist_lock);
 
 int nr_processes(void)
 {
@@ -1241,21 +1242,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        /* Need tasklist lock for parent etc handling! */
        write_lock_irq(&tasklist_lock);
 
-       /*
-        * The task hasn't been attached yet, so its cpus_allowed mask will
-        * not be changed, nor will its assigned CPU.
-        *
-        * The cpus_allowed mask of the parent may have changed after it was
-        * copied first time - so re-copy it here, then check the child's CPU
-        * to ensure it is on a valid CPU (and if not, just force it back to
-        * parent's CPU). This avoids alot of nasty races.
-        */
-       p->cpus_allowed = current->cpus_allowed;
-       p->rt.nr_cpus_allowed = current->rt.nr_cpus_allowed;
-       if (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed) ||
-                       !cpu_online(task_cpu(p))))
-               set_task_cpu(p, smp_processor_id());
-
        /* CLONE_PARENT re-uses the old parent */
        if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
                p->real_parent = current->real_parent;
index 8e3c3ffe1b9a57ea0110b36c089a5131760d0314..e7a35f1039e785464b318d3713557e9d2db6a591 100644 (file)
@@ -203,8 +203,6 @@ static void drop_futex_key_refs(union futex_key *key)
  * @uaddr:     virtual address of the futex
  * @fshared:   0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED
  * @key:       address where result is stored.
- * @rw:                mapping needs to be read/write (values: VERIFY_READ,
- *             VERIFY_WRITE)
  *
  * Returns a negative error code or 0
  * The key words are stored in *key on success.
@@ -216,7 +214,7 @@ static void drop_futex_key_refs(union futex_key *key)
  * lock_page() might sleep, the caller should not hold a spinlock.
  */
 static int
-get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
+get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key)
 {
        unsigned long address = (unsigned long)uaddr;
        struct mm_struct *mm = current->mm;
@@ -239,7 +237,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
         *        but access_ok() should be faster than find_vma()
         */
        if (!fshared) {
-               if (unlikely(!access_ok(rw, uaddr, sizeof(u32))))
+               if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))))
                        return -EFAULT;
                key->private.mm = mm;
                key->private.address = address;
@@ -248,7 +246,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
        }
 
 again:
-       err = get_user_pages_fast(address, 1, rw == VERIFY_WRITE, &page);
+       err = get_user_pages_fast(address, 1, 1, &page);
        if (err < 0)
                return err;
 
@@ -532,8 +530,25 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
                                return -EINVAL;
 
                        WARN_ON(!atomic_read(&pi_state->refcount));
-                       WARN_ON(pid && pi_state->owner &&
-                               pi_state->owner->pid != pid);
+
+                       /*
+                        * When pi_state->owner is NULL then the owner died
+                        * and another waiter is on the fly. pi_state->owner
+                        * is fixed up by the task which acquires
+                        * pi_state->rt_mutex.
+                        *
+                        * We do not check for pid == 0 which can happen when
+                        * the owner died and robust_list_exit() cleared the
+                        * TID.
+                        */
+                       if (pid && pi_state->owner) {
+                               /*
+                                * Bail out if user space manipulated the
+                                * futex value.
+                                */
+                               if (pid != task_pid_vnr(pi_state->owner))
+                                       return -EINVAL;
+                       }
 
                        atomic_inc(&pi_state->refcount);
                        *ps = pi_state;
@@ -760,6 +775,13 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
        if (!pi_state)
                return -EINVAL;
 
+       /*
+        * If current does not own the pi_state then the futex is
+        * inconsistent and user space fiddled with the futex value.
+        */
+       if (pi_state->owner != current)
+               return -EINVAL;
+
        raw_spin_lock(&pi_state->pi_mutex.wait_lock);
        new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
 
@@ -867,7 +889,7 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)
        if (!bitset)
                return -EINVAL;
 
-       ret = get_futex_key(uaddr, fshared, &key, VERIFY_READ);
+       ret = get_futex_key(uaddr, fshared, &key);
        if (unlikely(ret != 0))
                goto out;
 
@@ -913,10 +935,10 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
        int ret, op_ret;
 
 retry:
-       ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
+       ret = get_futex_key(uaddr1, fshared, &key1);
        if (unlikely(ret != 0))
                goto out;
-       ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
+       ret = get_futex_key(uaddr2, fshared, &key2);
        if (unlikely(ret != 0))
                goto out_put_key1;
 
@@ -1175,11 +1197,10 @@ retry:
                pi_state = NULL;
        }
 
-       ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
+       ret = get_futex_key(uaddr1, fshared, &key1);
        if (unlikely(ret != 0))
                goto out;
-       ret = get_futex_key(uaddr2, fshared, &key2,
-                           requeue_pi ? VERIFY_WRITE : VERIFY_READ);
+       ret = get_futex_key(uaddr2, fshared, &key2);
        if (unlikely(ret != 0))
                goto out_put_key1;
 
@@ -1738,7 +1759,7 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, int fshared,
         */
 retry:
        q->key = FUTEX_KEY_INIT;
-       ret = get_futex_key(uaddr, fshared, &q->key, VERIFY_READ);
+       ret = get_futex_key(uaddr, fshared, &q->key);
        if (unlikely(ret != 0))
                return ret;
 
@@ -1904,7 +1925,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
        q.requeue_pi_key = NULL;
 retry:
        q.key = FUTEX_KEY_INIT;
-       ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
+       ret = get_futex_key(uaddr, fshared, &q.key);
        if (unlikely(ret != 0))
                goto out;
 
@@ -1974,7 +1995,7 @@ retry_private:
        /* Unqueue and drop the lock */
        unqueue_me_pi(&q);
 
-       goto out;
+       goto out_put_key;
 
 out_unlock_put_key:
        queue_unlock(&q, hb);
@@ -2023,7 +2044,7 @@ retry:
        if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current))
                return -EPERM;
 
-       ret = get_futex_key(uaddr, fshared, &key, VERIFY_WRITE);
+       ret = get_futex_key(uaddr, fshared, &key);
        if (unlikely(ret != 0))
                goto out;
 
@@ -2215,7 +2236,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
        rt_waiter.task = NULL;
 
        key2 = FUTEX_KEY_INIT;
-       ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
+       ret = get_futex_key(uaddr2, fshared, &key2);
        if (unlikely(ret != 0))
                goto out;
 
index 235716556bf16ed9b97c19a9578ef24dec19edb1..d49afb2395e5cab17dd85417c95741c60c12a4cf 100644 (file)
@@ -146,7 +146,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
                struct task_struct *p;
 
                ret = -ESRCH;
-               read_lock(&tasklist_lock);
+               rcu_read_lock();
                p = find_task_by_vpid(pid);
                if (!p)
                        goto err_unlock;
@@ -157,7 +157,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
                    !capable(CAP_SYS_PTRACE))
                        goto err_unlock;
                head = p->compat_robust_list;
-               read_unlock(&tasklist_lock);
+               rcu_read_unlock();
        }
 
        if (put_user(sizeof(*head), len_ptr))
@@ -165,7 +165,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
        return put_user(ptr_to_compat(head), head_ptr);
 
 err_unlock:
-       read_unlock(&tasklist_lock);
+       rcu_read_unlock();
 
        return ret;
 }
index 50dbd599958838cdfeaf1512fcfd36135b97ebf2..967e66143e117096262c65fa646a1570e5f035d3 100644 (file)
@@ -243,38 +243,70 @@ static void toggle_bp_slot(struct perf_event *bp, bool enable)
  *       ((per_cpu(nr_bp_flexible, *) > 1) + max(per_cpu(nr_cpu_bp_pinned, *))
  *            + max(per_cpu(nr_task_bp_pinned, *))) < HBP_NUM
  */
-int reserve_bp_slot(struct perf_event *bp)
+static int __reserve_bp_slot(struct perf_event *bp)
 {
        struct bp_busy_slots slots = {0};
-       int ret = 0;
-
-       mutex_lock(&nr_bp_mutex);
 
        fetch_bp_busy_slots(&slots, bp);
 
        /* Flexible counters need to keep at least one slot */
-       if (slots.pinned + (!!slots.flexible) == HBP_NUM) {
-               ret = -ENOSPC;
-               goto end;
-       }
+       if (slots.pinned + (!!slots.flexible) == HBP_NUM)
+               return -ENOSPC;
 
        toggle_bp_slot(bp, true);
 
-end:
+       return 0;
+}
+
+int reserve_bp_slot(struct perf_event *bp)
+{
+       int ret;
+
+       mutex_lock(&nr_bp_mutex);
+
+       ret = __reserve_bp_slot(bp);
+
        mutex_unlock(&nr_bp_mutex);
 
        return ret;
 }
 
+static void __release_bp_slot(struct perf_event *bp)
+{
+       toggle_bp_slot(bp, false);
+}
+
 void release_bp_slot(struct perf_event *bp)
 {
        mutex_lock(&nr_bp_mutex);
 
-       toggle_bp_slot(bp, false);
+       __release_bp_slot(bp);
 
        mutex_unlock(&nr_bp_mutex);
 }
 
+/*
+ * Allow the kernel debugger to reserve breakpoint slots without
+ * taking a lock using the dbg_* variant of for the reserve and
+ * release breakpoint slots.
+ */
+int dbg_reserve_bp_slot(struct perf_event *bp)
+{
+       if (mutex_is_locked(&nr_bp_mutex))
+               return -1;
+
+       return __reserve_bp_slot(bp);
+}
+
+int dbg_release_bp_slot(struct perf_event *bp)
+{
+       if (mutex_is_locked(&nr_bp_mutex))
+               return -1;
+
+       __release_bp_slot(bp);
+
+       return 0;
+}
 
 int register_perf_hw_breakpoint(struct perf_event *bp)
 {
@@ -296,6 +328,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp)
        if (!bp->attr.disabled || !bp->overflow_handler)
                ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
+       /* if arch_validate_hwbkpt_settings() fails then release bp slot */
+       if (ret)
+               release_bp_slot(bp);
+
        return ret;
 }
 
@@ -324,8 +360,8 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint);
 int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr)
 {
        u64 old_addr = bp->attr.bp_addr;
+       u64 old_len = bp->attr.bp_len;
        int old_type = bp->attr.bp_type;
-       int old_len = bp->attr.bp_len;
        int err = 0;
 
        perf_event_disable(bp);
index a9a93d9ee7a78e70068bca678826873376afd8a7..ef077fb73155f8b9e7a6e96197554feacd735f4b 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/console.h>
 #include <linux/vmalloc.h>
 #include <linux/swap.h>
+#include <linux/kmsg_dump.h>
 
 #include <asm/page.h>
 #include <asm/uaccess.h>
@@ -1074,6 +1075,9 @@ void crash_kexec(struct pt_regs *regs)
        if (mutex_trylock(&kexec_mutex)) {
                if (kexec_crash_image) {
                        struct pt_regs fixed_regs;
+
+                       kmsg_dump(KMSG_DUMP_KEXEC);
+
                        crash_setup_regs(&fixed_regs, regs);
                        crash_save_vmcoreinfo();
                        machine_crash_shutdown(&fixed_regs);
index e92d519f93b13e2721f25fb6e1b5d6cbf2af0125..35edbe22e9a955a1a69cdad290f4861dd76c33e1 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/log2.h>
 #include <linux/uaccess.h>
 
-static void _kfifo_init(struct kfifo *fifo, unsigned char *buffer,
+static void _kfifo_init(struct kfifo *fifo, void *buffer,
                unsigned int size)
 {
        fifo->buffer = buffer;
@@ -41,10 +41,10 @@ static void _kfifo_init(struct kfifo *fifo, unsigned char *buffer,
  * kfifo_init - initialize a FIFO using a preallocated buffer
  * @fifo: the fifo to assign the buffer
  * @buffer: the preallocated buffer to be used.
- * @size: the size of the internal buffer, this have to be a power of 2.
+ * @size: the size of the internal buffer, this has to be a power of 2.
  *
  */
-void kfifo_init(struct kfifo *fifo, unsigned char *buffer, unsigned int size)
+void kfifo_init(struct kfifo *fifo, void *buffer, unsigned int size)
 {
        /* size must be a power of 2 */
        BUG_ON(!is_power_of_2(size));
@@ -80,7 +80,7 @@ int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask)
 
        buffer = kmalloc(size, gfp_mask);
        if (!buffer) {
-               _kfifo_init(fifo, 0, 0);
+               _kfifo_init(fifo, NULL, 0);
                return -ENOMEM;
        }
 
@@ -97,6 +97,7 @@ EXPORT_SYMBOL(kfifo_alloc);
 void kfifo_free(struct kfifo *fifo)
 {
        kfree(fifo->buffer);
+       _kfifo_init(fifo, NULL, 0);
 }
 EXPORT_SYMBOL(kfifo_free);
 
@@ -159,8 +160,9 @@ static inline void __kfifo_out_data(struct kfifo *fifo,
        memcpy(to + l, fifo->buffer, len - l);
 }
 
-static inline unsigned int __kfifo_from_user_data(struct kfifo *fifo,
-        const void __user *from, unsigned int len, unsigned int off)
+static inline int __kfifo_from_user_data(struct kfifo *fifo,
+        const void __user *from, unsigned int len, unsigned int off,
+        unsigned *lenout)
 {
        unsigned int l;
        int ret;
@@ -177,16 +179,20 @@ static inline unsigned int __kfifo_from_user_data(struct kfifo *fifo,
        /* first put the data starting from fifo->in to buffer end */
        l = min(len, fifo->size - off);
        ret = copy_from_user(fifo->buffer + off, from, l);
-
-       if (unlikely(ret))
-               return ret + len - l;
+       if (unlikely(ret)) {
+               *lenout = ret;
+               return -EFAULT;
+       }
+       *lenout = l;
 
        /* then put the rest (if any) at the beginning of the buffer */
-       return copy_from_user(fifo->buffer, from + l, len - l);
+       ret = copy_from_user(fifo->buffer, from + l, len - l);
+       *lenout += ret ? ret : len - l;
+       return ret ? -EFAULT : 0;
 }
 
-static inline unsigned int __kfifo_to_user_data(struct kfifo *fifo,
-               void __user *to, unsigned int len, unsigned int off)
+static inline int __kfifo_to_user_data(struct kfifo *fifo,
+               void __user *to, unsigned int len, unsigned int off, unsigned *lenout)
 {
        unsigned int l;
        int ret;
@@ -203,12 +209,21 @@ static inline unsigned int __kfifo_to_user_data(struct kfifo *fifo,
        /* first get the data from fifo->out until the end of the buffer */
        l = min(len, fifo->size - off);
        ret = copy_to_user(to, fifo->buffer + off, l);
-
-       if (unlikely(ret))
-               return ret + len - l;
+       *lenout = l;
+       if (unlikely(ret)) {
+               *lenout -= ret;
+               return -EFAULT;
+       }
 
        /* then get the rest (if any) from the beginning of the buffer */
-       return copy_to_user(to + l, fifo->buffer, len - l);
+       len -= l;
+       ret = copy_to_user(to + l, fifo->buffer, len);
+       if (unlikely(ret)) {
+               *lenout += len - ret;
+               return -EFAULT;
+       }
+       *lenout += len;
+       return 0;
 }
 
 unsigned int __kfifo_in_n(struct kfifo *fifo,
@@ -235,7 +250,7 @@ EXPORT_SYMBOL(__kfifo_in_n);
  * Note that with only one concurrent reader and one concurrent
  * writer, you don't need extra locking to use these functions.
  */
-unsigned int kfifo_in(struct kfifo *fifo, const unsigned char *from,
+unsigned int kfifo_in(struct kfifo *fifo, const void *from,
                                unsigned int len)
 {
        len = min(kfifo_avail(fifo), len);
@@ -277,7 +292,7 @@ EXPORT_SYMBOL(__kfifo_out_n);
  * Note that with only one concurrent reader and one concurrent
  * writer, you don't need extra locking to use these functions.
  */
-unsigned int kfifo_out(struct kfifo *fifo, unsigned char *to, unsigned int len)
+unsigned int kfifo_out(struct kfifo *fifo, void *to, unsigned int len)
 {
        len = min(kfifo_len(fifo), len);
 
@@ -288,6 +303,27 @@ unsigned int kfifo_out(struct kfifo *fifo, unsigned char *to, unsigned int len)
 }
 EXPORT_SYMBOL(kfifo_out);
 
+/**
+ * kfifo_out_peek - copy some data from the FIFO, but do not remove it
+ * @fifo: the fifo to be used.
+ * @to: where the data must be copied.
+ * @len: the size of the destination buffer.
+ * @offset: offset into the fifo
+ *
+ * This function copies at most @len bytes at @offset from the FIFO
+ * into the @to buffer and returns the number of copied bytes.
+ * The data is not removed from the FIFO.
+ */
+unsigned int kfifo_out_peek(struct kfifo *fifo, void *to, unsigned int len,
+                           unsigned offset)
+{
+       len = min(kfifo_len(fifo), len + offset);
+
+       __kfifo_out_data(fifo, to, len, offset);
+       return len;
+}
+EXPORT_SYMBOL(kfifo_out_peek);
+
 unsigned int __kfifo_out_generic(struct kfifo *fifo,
        void *to, unsigned int len, unsigned int recsize,
        unsigned int *total)
@@ -299,10 +335,13 @@ EXPORT_SYMBOL(__kfifo_out_generic);
 unsigned int __kfifo_from_user_n(struct kfifo *fifo,
        const void __user *from, unsigned int len, unsigned int recsize)
 {
+       unsigned total;
+
        if (kfifo_avail(fifo) < len + recsize)
                return len + 1;
 
-       return __kfifo_from_user_data(fifo, from, len, recsize);
+       __kfifo_from_user_data(fifo, from, len, recsize, &total);
+       return total;
 }
 EXPORT_SYMBOL(__kfifo_from_user_n);
 
@@ -311,20 +350,24 @@ EXPORT_SYMBOL(__kfifo_from_user_n);
  * @fifo: the fifo to be used.
  * @from: pointer to the data to be added.
  * @len: the length of the data to be added.
+ * @total: the actual returned data length.
  *
  * This function copies at most @len bytes from the @from into the
- * FIFO depending and returns the number of copied bytes.
+ * FIFO depending and returns -EFAULT/0.
  *
  * Note that with only one concurrent reader and one concurrent
  * writer, you don't need extra locking to use these functions.
  */
-unsigned int kfifo_from_user(struct kfifo *fifo,
-       const void __user *from, unsigned int len)
+int kfifo_from_user(struct kfifo *fifo,
+        const void __user *from, unsigned int len, unsigned *total)
 {
+       int ret;
        len = min(kfifo_avail(fifo), len);
-       len -= __kfifo_from_user_data(fifo, from, len, 0);
+       ret = __kfifo_from_user_data(fifo, from, len, 0, total);
+       if (ret)
+               return ret;
        __kfifo_add_in(fifo, len);
-       return len;
+       return 0;
 }
 EXPORT_SYMBOL(kfifo_from_user);
 
@@ -339,17 +382,17 @@ unsigned int __kfifo_to_user_n(struct kfifo *fifo,
        void __user *to, unsigned int len, unsigned int reclen,
        unsigned int recsize)
 {
-       unsigned int ret;
+       unsigned int ret, total;
 
        if (kfifo_len(fifo) < reclen + recsize)
                return len;
 
-       ret = __kfifo_to_user_data(fifo, to, reclen, recsize);
+       ret = __kfifo_to_user_data(fifo, to, reclen, recsize, &total);
 
        if (likely(ret == 0))
                __kfifo_add_out(fifo, reclen + recsize);
 
-       return ret;
+       return total;
 }
 EXPORT_SYMBOL(__kfifo_to_user_n);
 
@@ -358,20 +401,22 @@ EXPORT_SYMBOL(__kfifo_to_user_n);
  * @fifo: the fifo to be used.
  * @to: where the data must be copied.
  * @len: the size of the destination buffer.
+ * @lenout: pointer to output variable with copied data
  *
  * This function copies at most @len bytes from the FIFO into the
- * @to buffer and returns the number of copied bytes.
+ * @to buffer and 0 or -EFAULT.
  *
  * Note that with only one concurrent reader and one concurrent
  * writer, you don't need extra locking to use these functions.
  */
-unsigned int kfifo_to_user(struct kfifo *fifo,
-       void __user *to, unsigned int len)
+int kfifo_to_user(struct kfifo *fifo,
+       void __user *to, unsigned int len, unsigned *lenout)
 {
+       int ret;
        len = min(kfifo_len(fifo), len);
-       len -= __kfifo_to_user_data(fifo, to, len, 0);
-       __kfifo_add_out(fifo, len);
-       return len;
+       ret = __kfifo_to_user_data(fifo, to, len, 0, lenout);
+       __kfifo_add_out(fifo, *lenout);
+       return ret;
 }
 EXPORT_SYMBOL(kfifo_to_user);
 
index 2eb517e2351462bd263d8976cf3d2108ecfeebc2..761fdd2b3034ae87272578fe1314680af5c0d71f 100644 (file)
@@ -583,6 +583,9 @@ static void kgdb_wait(struct pt_regs *regs)
        smp_wmb();
        atomic_set(&cpu_in_kgdb[cpu], 1);
 
+       /* Disable any cpu specific hw breakpoints */
+       kgdb_disable_hw_debug(regs);
+
        /* Wait till primary CPU is done with debugging */
        while (atomic_read(&passive_cpu_wait[cpu]))
                cpu_relax();
@@ -596,7 +599,7 @@ static void kgdb_wait(struct pt_regs *regs)
 
        /* Signal the primary CPU that we are done: */
        atomic_set(&cpu_in_kgdb[cpu], 0);
-       touch_softlockup_watchdog();
+       touch_softlockup_watchdog_sync();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 }
@@ -1450,7 +1453,7 @@ acquirelock:
            (kgdb_info[cpu].task &&
             kgdb_info[cpu].task->pid != kgdb_sstep_pid) && --sstep_tries) {
                atomic_set(&kgdb_active, -1);
-               touch_softlockup_watchdog();
+               touch_softlockup_watchdog_sync();
                clocksource_touch_watchdog();
                local_irq_restore(flags);
 
@@ -1550,7 +1553,7 @@ kgdb_restore:
        }
        /* Free kgdb_active */
        atomic_set(&kgdb_active, -1);
-       touch_softlockup_watchdog();
+       touch_softlockup_watchdog_sync();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 
index b7df302a02046e2b9404d8267a66a6300ffd831a..ccec774c716d82d631d291e8c8693fb3da307b55 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/debugfs.h>
 #include <linux/kdebug.h>
 #include <linux/memory.h>
+#include <linux/ftrace.h>
 
 #include <asm-generic/sections.h>
 #include <asm/cacheflush.h>
@@ -93,6 +94,7 @@ static struct kprobe_blackpoint kprobe_blacklist[] = {
        {"native_get_debugreg",},
        {"irq_entries_start",},
        {"common_interrupt",},
+       {"mcount",},    /* mcount can be called from everywhere */
        {NULL}    /* Terminator */
 };
 
@@ -124,30 +126,6 @@ static LIST_HEAD(kprobe_insn_pages);
 static int kprobe_garbage_slots;
 static int collect_garbage_slots(void);
 
-static int __kprobes check_safety(void)
-{
-       int ret = 0;
-#if defined(CONFIG_PREEMPT) && defined(CONFIG_FREEZER)
-       ret = freeze_processes();
-       if (ret == 0) {
-               struct task_struct *p, *q;
-               do_each_thread(p, q) {
-                       if (p != current && p->state == TASK_RUNNING &&
-                           p->pid != 0) {
-                               printk("Check failed: %s is running\n",p->comm);
-                               ret = -1;
-                               goto loop_end;
-                       }
-               } while_each_thread(p, q);
-       }
-loop_end:
-       thaw_processes();
-#else
-       synchronize_sched();
-#endif
-       return ret;
-}
-
 /**
  * __get_insn_slot() - Find a slot on an executable page for an instruction.
  * We allocate an executable page if there's no room on existing ones.
@@ -235,9 +213,8 @@ static int __kprobes collect_garbage_slots(void)
 {
        struct kprobe_insn_page *kip, *next;
 
-       /* Ensure no-one is preepmted on the garbages */
-       if (check_safety())
-               return -EAGAIN;
+       /* Ensure no-one is interrupted on the garbages */
+       synchronize_sched();
 
        list_for_each_entry_safe(kip, next, &kprobe_insn_pages, list) {
                int i;
@@ -728,7 +705,8 @@ int __kprobes register_kprobe(struct kprobe *p)
 
        preempt_disable();
        if (!kernel_text_address((unsigned long) p->addr) ||
-           in_kprobes_functions((unsigned long) p->addr)) {
+           in_kprobes_functions((unsigned long) p->addr) ||
+           ftrace_text_reserved(p->addr, p->addr)) {
                preempt_enable();
                return -EINVAL;
        }
index 3feaf5a745140512f1e13a0bf6a6e46683ab4915..6b1ccc3f020585a06d454178bf050bce4b25b805 100644 (file)
@@ -197,16 +197,8 @@ static int __init ksysfs_init(void)
                        goto group_exit;
        }
 
-       /* create the /sys/kernel/uids/ directory */
-       error = uids_sysfs_init();
-       if (error)
-               goto notes_exit;
-
        return 0;
 
-notes_exit:
-       if (notes_size > 0)
-               sysfs_remove_bin_file(kernel_kobj, &notes_attr);
 group_exit:
        sysfs_remove_group(kernel_kobj, &kernel_attr_group);
 kset_exit:
index fbb6222fe7e04d6dd863ea7975e70c4f3f78636d..82ed0ea15194caf27c72dd3a40d459731eb718df 100644 (file)
@@ -101,7 +101,7 @@ static void create_kthread(struct kthread_create_info *create)
  *
  * Description: This helper function creates and names a kernel
  * thread.  The thread will be stopped: use wake_up_process() to start
- * it.  See also kthread_run(), kthread_create_on_cpu().
+ * it.  See also kthread_run().
  *
  * When woken, the thread will run @threadfn() with @data as its
  * argument. @threadfn() can either call do_exit() directly if it is a
index 5feaddcdbe492f6fb3cb49f4175a0434d5b9c2a8..0c30d0455de12e02bad459a1da7cd0641ef4d76e 100644 (file)
@@ -2147,7 +2147,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
                return ret;
 
        return print_irq_inversion_bug(curr, &root, target_entry,
-                                       this, 1, irqclass);
+                                       this, 0, irqclass);
 }
 
 void print_irqtrace_events(struct task_struct *curr)
@@ -3809,3 +3809,21 @@ void lockdep_sys_exit(void)
                lockdep_print_held_locks(curr);
        }
 }
+
+void lockdep_rcu_dereference(const char *file, const int line)
+{
+       struct task_struct *curr = current;
+
+       if (!debug_locks_off())
+               return;
+       printk("\n===================================================\n");
+       printk(  "[ INFO: suspicious rcu_dereference_check() usage. ]\n");
+       printk(  "---------------------------------------------------\n");
+       printk("%s:%d invoked rcu_dereference_check() without protection!\n",
+                       file, line);
+       printk("\nother info that might help us debug this:\n\n");
+       lockdep_print_held_locks(curr);
+       printk("\nstack backtrace:\n");
+       dump_stack();
+}
+EXPORT_SYMBOL_GPL(lockdep_rcu_dereference);
index acd24e7643eb8ebdb9a0386b65931294b37c7eaf..2488ba7eb568784eb5c13b57247918409c4caf13 100644 (file)
@@ -78,10 +78,10 @@ static int __kprobes notifier_call_chain(struct notifier_block **nl,
        int ret = NOTIFY_DONE;
        struct notifier_block *nb, *next_nb;
 
-       nb = rcu_dereference(*nl);
+       nb = rcu_dereference_raw(*nl);
 
        while (nb && nr_to_call) {
-               next_nb = rcu_dereference(nb->next);
+               next_nb = rcu_dereference_raw(nb->next);
 
 #ifdef CONFIG_DEBUG_NOTIFIERS
                if (unlikely(!func_ptr_is_kernel_text(nb->notifier_call))) {
@@ -309,7 +309,7 @@ int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,
         * racy then it does not matter what the result of the test
         * is, we re-check the list after having taken the lock anyway:
         */
-       if (rcu_dereference(nh->head)) {
+       if (rcu_dereference_raw(nh->head)) {
                down_read(&nh->rwsem);
                ret = notifier_call_chain(&nh->head, val, v, nr_to_call,
                                        nr_calls);
diff --git a/kernel/padata.c b/kernel/padata.c
new file mode 100644 (file)
index 0000000..6f9bcb8
--- /dev/null
@@ -0,0 +1,690 @@
+/*
+ * padata.c - generic interface to process data streams in parallel
+ *
+ * Copyright (C) 2008, 2009 secunet Security Networks AG
+ * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <linux/module.h>
+#include <linux/cpumask.h>
+#include <linux/err.h>
+#include <linux/cpu.h>
+#include <linux/padata.h>
+#include <linux/mutex.h>
+#include <linux/sched.h>
+#include <linux/rcupdate.h>
+
+#define MAX_SEQ_NR INT_MAX - NR_CPUS
+#define MAX_OBJ_NUM 10000 * NR_CPUS
+
+static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index)
+{
+       int cpu, target_cpu;
+
+       target_cpu = cpumask_first(pd->cpumask);
+       for (cpu = 0; cpu < cpu_index; cpu++)
+               target_cpu = cpumask_next(target_cpu, pd->cpumask);
+
+       return target_cpu;
+}
+
+static int padata_cpu_hash(struct padata_priv *padata)
+{
+       int cpu_index;
+       struct parallel_data *pd;
+
+       pd =  padata->pd;
+
+       /*
+        * Hash the sequence numbers to the cpus by taking
+        * seq_nr mod. number of cpus in use.
+        */
+       cpu_index =  padata->seq_nr % cpumask_weight(pd->cpumask);
+
+       return padata_index_to_cpu(pd, cpu_index);
+}
+
+static void padata_parallel_worker(struct work_struct *work)
+{
+       struct padata_queue *queue;
+       struct parallel_data *pd;
+       struct padata_instance *pinst;
+       LIST_HEAD(local_list);
+
+       local_bh_disable();
+       queue = container_of(work, struct padata_queue, pwork);
+       pd = queue->pd;
+       pinst = pd->pinst;
+
+       spin_lock(&queue->parallel.lock);
+       list_replace_init(&queue->parallel.list, &local_list);
+       spin_unlock(&queue->parallel.lock);
+
+       while (!list_empty(&local_list)) {
+               struct padata_priv *padata;
+
+               padata = list_entry(local_list.next,
+                                   struct padata_priv, list);
+
+               list_del_init(&padata->list);
+
+               padata->parallel(padata);
+       }
+
+       local_bh_enable();
+}
+
+/*
+ * padata_do_parallel - padata parallelization function
+ *
+ * @pinst: padata instance
+ * @padata: object to be parallelized
+ * @cb_cpu: cpu the serialization callback function will run on,
+ *          must be in the cpumask of padata.
+ *
+ * The parallelization callback function will run with BHs off.
+ * Note: Every object which is parallelized by padata_do_parallel
+ * must be seen by padata_do_serial.
+ */
+int padata_do_parallel(struct padata_instance *pinst,
+                      struct padata_priv *padata, int cb_cpu)
+{
+       int target_cpu, err;
+       struct padata_queue *queue;
+       struct parallel_data *pd;
+
+       rcu_read_lock_bh();
+
+       pd = rcu_dereference(pinst->pd);
+
+       err = 0;
+       if (!(pinst->flags & PADATA_INIT))
+               goto out;
+
+       err =  -EBUSY;
+       if ((pinst->flags & PADATA_RESET))
+               goto out;
+
+       if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM)
+               goto out;
+
+       err = -EINVAL;
+       if (!cpumask_test_cpu(cb_cpu, pd->cpumask))
+               goto out;
+
+       err = -EINPROGRESS;
+       atomic_inc(&pd->refcnt);
+       padata->pd = pd;
+       padata->cb_cpu = cb_cpu;
+
+       if (unlikely(atomic_read(&pd->seq_nr) == pd->max_seq_nr))
+               atomic_set(&pd->seq_nr, -1);
+
+       padata->seq_nr = atomic_inc_return(&pd->seq_nr);
+
+       target_cpu = padata_cpu_hash(padata);
+       queue = per_cpu_ptr(pd->queue, target_cpu);
+
+       spin_lock(&queue->parallel.lock);
+       list_add_tail(&padata->list, &queue->parallel.list);
+       spin_unlock(&queue->parallel.lock);
+
+       queue_work_on(target_cpu, pinst->wq, &queue->pwork);
+
+out:
+       rcu_read_unlock_bh();
+
+       return err;
+}
+EXPORT_SYMBOL(padata_do_parallel);
+
+static struct padata_priv *padata_get_next(struct parallel_data *pd)
+{
+       int cpu, num_cpus, empty, calc_seq_nr;
+       int seq_nr, next_nr, overrun, next_overrun;
+       struct padata_queue *queue, *next_queue;
+       struct padata_priv *padata;
+       struct padata_list *reorder;
+
+       empty = 0;
+       next_nr = -1;
+       next_overrun = 0;
+       next_queue = NULL;
+
+       num_cpus = cpumask_weight(pd->cpumask);
+
+       for_each_cpu(cpu, pd->cpumask) {
+               queue = per_cpu_ptr(pd->queue, cpu);
+               reorder = &queue->reorder;
+
+               /*
+                * Calculate the seq_nr of the object that should be
+                * next in this queue.
+                */
+               overrun = 0;
+               calc_seq_nr = (atomic_read(&queue->num_obj) * num_cpus)
+                              + queue->cpu_index;
+
+               if (unlikely(calc_seq_nr > pd->max_seq_nr)) {
+                       calc_seq_nr = calc_seq_nr - pd->max_seq_nr - 1;
+                       overrun = 1;
+               }
+
+               if (!list_empty(&reorder->list)) {
+                       padata = list_entry(reorder->list.next,
+                                           struct padata_priv, list);
+
+                       seq_nr  = padata->seq_nr;
+                       BUG_ON(calc_seq_nr != seq_nr);
+               } else {
+                       seq_nr = calc_seq_nr;
+                       empty++;
+               }
+
+               if (next_nr < 0 || seq_nr < next_nr
+                   || (next_overrun && !overrun)) {
+                       next_nr = seq_nr;
+                       next_overrun = overrun;
+                       next_queue = queue;
+               }
+       }
+
+       padata = NULL;
+
+       if (empty == num_cpus)
+               goto out;
+
+       reorder = &next_queue->reorder;
+
+       if (!list_empty(&reorder->list)) {
+               padata = list_entry(reorder->list.next,
+                                   struct padata_priv, list);
+
+               if (unlikely(next_overrun)) {
+                       for_each_cpu(cpu, pd->cpumask) {
+                               queue = per_cpu_ptr(pd->queue, cpu);
+                               atomic_set(&queue->num_obj, 0);
+                       }
+               }
+
+               spin_lock(&reorder->lock);
+               list_del_init(&padata->list);
+               atomic_dec(&pd->reorder_objects);
+               spin_unlock(&reorder->lock);
+
+               atomic_inc(&next_queue->num_obj);
+
+               goto out;
+       }
+
+       if (next_nr % num_cpus == next_queue->cpu_index) {
+               padata = ERR_PTR(-ENODATA);
+               goto out;
+       }
+
+       padata = ERR_PTR(-EINPROGRESS);
+out:
+       return padata;
+}
+
+static void padata_reorder(struct parallel_data *pd)
+{
+       struct padata_priv *padata;
+       struct padata_queue *queue;
+       struct padata_instance *pinst = pd->pinst;
+
+try_again:
+       if (!spin_trylock_bh(&pd->lock))
+               goto out;
+
+       while (1) {
+               padata = padata_get_next(pd);
+
+               if (!padata || PTR_ERR(padata) == -EINPROGRESS)
+                       break;
+
+               if (PTR_ERR(padata) == -ENODATA) {
+                       spin_unlock_bh(&pd->lock);
+                       goto out;
+               }
+
+               queue = per_cpu_ptr(pd->queue, padata->cb_cpu);
+
+               spin_lock(&queue->serial.lock);
+               list_add_tail(&padata->list, &queue->serial.list);
+               spin_unlock(&queue->serial.lock);
+
+               queue_work_on(padata->cb_cpu, pinst->wq, &queue->swork);
+       }
+
+       spin_unlock_bh(&pd->lock);
+
+       if (atomic_read(&pd->reorder_objects))
+               goto try_again;
+
+out:
+       return;
+}
+
+static void padata_serial_worker(struct work_struct *work)
+{
+       struct padata_queue *queue;
+       struct parallel_data *pd;
+       LIST_HEAD(local_list);
+
+       local_bh_disable();
+       queue = container_of(work, struct padata_queue, swork);
+       pd = queue->pd;
+
+       spin_lock(&queue->serial.lock);
+       list_replace_init(&queue->serial.list, &local_list);
+       spin_unlock(&queue->serial.lock);
+
+       while (!list_empty(&local_list)) {
+               struct padata_priv *padata;
+
+               padata = list_entry(local_list.next,
+                                   struct padata_priv, list);
+
+               list_del_init(&padata->list);
+
+               padata->serial(padata);
+               atomic_dec(&pd->refcnt);
+       }
+       local_bh_enable();
+}
+
+/*
+ * padata_do_serial - padata serialization function
+ *
+ * @padata: object to be serialized.
+ *
+ * padata_do_serial must be called for every parallelized object.
+ * The serialization callback function will run with BHs off.
+ */
+void padata_do_serial(struct padata_priv *padata)
+{
+       int cpu;
+       struct padata_queue *queue;
+       struct parallel_data *pd;
+
+       pd = padata->pd;
+
+       cpu = get_cpu();
+       queue = per_cpu_ptr(pd->queue, cpu);
+
+       spin_lock(&queue->reorder.lock);
+       atomic_inc(&pd->reorder_objects);
+       list_add_tail(&padata->list, &queue->reorder.list);
+       spin_unlock(&queue->reorder.lock);
+
+       put_cpu();
+
+       padata_reorder(pd);
+}
+EXPORT_SYMBOL(padata_do_serial);
+
+static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst,
+                                            const struct cpumask *cpumask)
+{
+       int cpu, cpu_index, num_cpus;
+       struct padata_queue *queue;
+       struct parallel_data *pd;
+
+       cpu_index = 0;
+
+       pd = kzalloc(sizeof(struct parallel_data), GFP_KERNEL);
+       if (!pd)
+               goto err;
+
+       pd->queue = alloc_percpu(struct padata_queue);
+       if (!pd->queue)
+               goto err_free_pd;
+
+       if (!alloc_cpumask_var(&pd->cpumask, GFP_KERNEL))
+               goto err_free_queue;
+
+       for_each_possible_cpu(cpu) {
+               queue = per_cpu_ptr(pd->queue, cpu);
+
+               queue->pd = pd;
+
+               if (cpumask_test_cpu(cpu, cpumask)
+                   && cpumask_test_cpu(cpu, cpu_active_mask)) {
+                       queue->cpu_index = cpu_index;
+                       cpu_index++;
+               } else
+                       queue->cpu_index = -1;
+
+               INIT_LIST_HEAD(&queue->reorder.list);
+               INIT_LIST_HEAD(&queue->parallel.list);
+               INIT_LIST_HEAD(&queue->serial.list);
+               spin_lock_init(&queue->reorder.lock);
+               spin_lock_init(&queue->parallel.lock);
+               spin_lock_init(&queue->serial.lock);
+
+               INIT_WORK(&queue->pwork, padata_parallel_worker);
+               INIT_WORK(&queue->swork, padata_serial_worker);
+               atomic_set(&queue->num_obj, 0);
+       }
+
+       cpumask_and(pd->cpumask, cpumask, cpu_active_mask);
+
+       num_cpus = cpumask_weight(pd->cpumask);
+       pd->max_seq_nr = (MAX_SEQ_NR / num_cpus) * num_cpus - 1;
+
+       atomic_set(&pd->seq_nr, -1);
+       atomic_set(&pd->reorder_objects, 0);
+       atomic_set(&pd->refcnt, 0);
+       pd->pinst = pinst;
+       spin_lock_init(&pd->lock);
+
+       return pd;
+
+err_free_queue:
+       free_percpu(pd->queue);
+err_free_pd:
+       kfree(pd);
+err:
+       return NULL;
+}
+
+static void padata_free_pd(struct parallel_data *pd)
+{
+       free_cpumask_var(pd->cpumask);
+       free_percpu(pd->queue);
+       kfree(pd);
+}
+
+static void padata_replace(struct padata_instance *pinst,
+                          struct parallel_data *pd_new)
+{
+       struct parallel_data *pd_old = pinst->pd;
+
+       pinst->flags |= PADATA_RESET;
+
+       rcu_assign_pointer(pinst->pd, pd_new);
+
+       synchronize_rcu();
+
+       while (atomic_read(&pd_old->refcnt) != 0)
+               yield();
+
+       flush_workqueue(pinst->wq);
+
+       padata_free_pd(pd_old);
+
+       pinst->flags &= ~PADATA_RESET;
+}
+
+/*
+ * padata_set_cpumask - set the cpumask that padata should use
+ *
+ * @pinst: padata instance
+ * @cpumask: the cpumask to use
+ */
+int padata_set_cpumask(struct padata_instance *pinst,
+                       cpumask_var_t cpumask)
+{
+       struct parallel_data *pd;
+       int err = 0;
+
+       might_sleep();
+
+       mutex_lock(&pinst->lock);
+
+       pd = padata_alloc_pd(pinst, cpumask);
+       if (!pd) {
+               err = -ENOMEM;
+               goto out;
+       }
+
+       cpumask_copy(pinst->cpumask, cpumask);
+
+       padata_replace(pinst, pd);
+
+out:
+       mutex_unlock(&pinst->lock);
+
+       return err;
+}
+EXPORT_SYMBOL(padata_set_cpumask);
+
+static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
+{
+       struct parallel_data *pd;
+
+       if (cpumask_test_cpu(cpu, cpu_active_mask)) {
+               pd = padata_alloc_pd(pinst, pinst->cpumask);
+               if (!pd)
+                       return -ENOMEM;
+
+               padata_replace(pinst, pd);
+       }
+
+       return 0;
+}
+
+/*
+ * padata_add_cpu - add a cpu to the padata cpumask
+ *
+ * @pinst: padata instance
+ * @cpu: cpu to add
+ */
+int padata_add_cpu(struct padata_instance *pinst, int cpu)
+{
+       int err;
+
+       might_sleep();
+
+       mutex_lock(&pinst->lock);
+
+       cpumask_set_cpu(cpu, pinst->cpumask);
+       err = __padata_add_cpu(pinst, cpu);
+
+       mutex_unlock(&pinst->lock);
+
+       return err;
+}
+EXPORT_SYMBOL(padata_add_cpu);
+
+static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
+{
+       struct parallel_data *pd;
+
+       if (cpumask_test_cpu(cpu, cpu_online_mask)) {
+               pd = padata_alloc_pd(pinst, pinst->cpumask);
+               if (!pd)
+                       return -ENOMEM;
+
+               padata_replace(pinst, pd);
+       }
+
+       return 0;
+}
+
+/*
+ * padata_remove_cpu - remove a cpu from the padata cpumask
+ *
+ * @pinst: padata instance
+ * @cpu: cpu to remove
+ */
+int padata_remove_cpu(struct padata_instance *pinst, int cpu)
+{
+       int err;
+
+       might_sleep();
+
+       mutex_lock(&pinst->lock);
+
+       cpumask_clear_cpu(cpu, pinst->cpumask);
+       err = __padata_remove_cpu(pinst, cpu);
+
+       mutex_unlock(&pinst->lock);
+
+       return err;
+}
+EXPORT_SYMBOL(padata_remove_cpu);
+
+/*
+ * padata_start - start the parallel processing
+ *
+ * @pinst: padata instance to start
+ */
+void padata_start(struct padata_instance *pinst)
+{
+       might_sleep();
+
+       mutex_lock(&pinst->lock);
+       pinst->flags |= PADATA_INIT;
+       mutex_unlock(&pinst->lock);
+}
+EXPORT_SYMBOL(padata_start);
+
+/*
+ * padata_stop - stop the parallel processing
+ *
+ * @pinst: padata instance to stop
+ */
+void padata_stop(struct padata_instance *pinst)
+{
+       might_sleep();
+
+       mutex_lock(&pinst->lock);
+       pinst->flags &= ~PADATA_INIT;
+       mutex_unlock(&pinst->lock);
+}
+EXPORT_SYMBOL(padata_stop);
+
+static int __cpuinit padata_cpu_callback(struct notifier_block *nfb,
+                                        unsigned long action, void *hcpu)
+{
+       int err;
+       struct padata_instance *pinst;
+       int cpu = (unsigned long)hcpu;
+
+       pinst = container_of(nfb, struct padata_instance, cpu_notifier);
+
+       switch (action) {
+       case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
+               if (!cpumask_test_cpu(cpu, pinst->cpumask))
+                       break;
+               mutex_lock(&pinst->lock);
+               err = __padata_add_cpu(pinst, cpu);
+               mutex_unlock(&pinst->lock);
+               if (err)
+                       return NOTIFY_BAD;
+               break;
+
+       case CPU_DOWN_PREPARE:
+       case CPU_DOWN_PREPARE_FROZEN:
+               if (!cpumask_test_cpu(cpu, pinst->cpumask))
+                       break;
+               mutex_lock(&pinst->lock);
+               err = __padata_remove_cpu(pinst, cpu);
+               mutex_unlock(&pinst->lock);
+               if (err)
+                       return NOTIFY_BAD;
+               break;
+
+       case CPU_UP_CANCELED:
+       case CPU_UP_CANCELED_FROZEN:
+               if (!cpumask_test_cpu(cpu, pinst->cpumask))
+                       break;
+               mutex_lock(&pinst->lock);
+               __padata_remove_cpu(pinst, cpu);
+               mutex_unlock(&pinst->lock);
+
+       case CPU_DOWN_FAILED:
+       case CPU_DOWN_FAILED_FROZEN:
+               if (!cpumask_test_cpu(cpu, pinst->cpumask))
+                       break;
+               mutex_lock(&pinst->lock);
+               __padata_add_cpu(pinst, cpu);
+               mutex_unlock(&pinst->lock);
+       }
+
+       return NOTIFY_OK;
+}
+
+/*
+ * padata_alloc - allocate and initialize a padata instance
+ *
+ * @cpumask: cpumask that padata uses for parallelization
+ * @wq: workqueue to use for the allocated padata instance
+ */
+struct padata_instance *padata_alloc(const struct cpumask *cpumask,
+                                    struct workqueue_struct *wq)
+{
+       int err;
+       struct padata_instance *pinst;
+       struct parallel_data *pd;
+
+       pinst = kzalloc(sizeof(struct padata_instance), GFP_KERNEL);
+       if (!pinst)
+               goto err;
+
+       pd = padata_alloc_pd(pinst, cpumask);
+       if (!pd)
+               goto err_free_inst;
+
+       rcu_assign_pointer(pinst->pd, pd);
+
+       pinst->wq = wq;
+
+       cpumask_copy(pinst->cpumask, cpumask);
+
+       pinst->flags = 0;
+
+       pinst->cpu_notifier.notifier_call = padata_cpu_callback;
+       pinst->cpu_notifier.priority = 0;
+       err = register_hotcpu_notifier(&pinst->cpu_notifier);
+       if (err)
+               goto err_free_pd;
+
+       mutex_init(&pinst->lock);
+
+       return pinst;
+
+err_free_pd:
+       padata_free_pd(pd);
+err_free_inst:
+       kfree(pinst);
+err:
+       return NULL;
+}
+EXPORT_SYMBOL(padata_alloc);
+
+/*
+ * padata_free - free a padata instance
+ *
+ * @ padata_inst: padata instance to free
+ */
+void padata_free(struct padata_instance *pinst)
+{
+       padata_stop(pinst);
+
+       synchronize_rcu();
+
+       while (atomic_read(&pinst->pd->refcnt) != 0)
+               yield();
+
+       unregister_hotcpu_notifier(&pinst->cpu_notifier);
+       padata_free_pd(pinst->pd);
+       kfree(pinst);
+}
+EXPORT_SYMBOL(padata_free);
index 5827f7b972542f10d9accb69e218af4f7b105c91..c787333282b8c4e82a5eb125ca99efd480a94f7a 100644 (file)
@@ -75,7 +75,6 @@ NORET_TYPE void panic(const char * fmt, ...)
        dump_stack();
 #endif
 
-       kmsg_dump(KMSG_DUMP_PANIC);
        /*
         * If we have crashed and we have a crash kernel loaded let it handle
         * everything else.
@@ -83,6 +82,8 @@ NORET_TYPE void panic(const char * fmt, ...)
         */
        crash_kexec(NULL);
 
+       kmsg_dump(KMSG_DUMP_PANIC);
+
        /*
         * Note smp_send_stop is the usual smp shutdown function, which
         * unfortunately means it may not be hardened to work in a panic
index 603c0d8b5df17a93c8b9679be42dd8905b5eaf97..a661e7991865bdeb22d6631b01a96d8a4b6c3047 100644 (file)
@@ -98,11 +98,12 @@ void __weak hw_perf_enable(void)            { barrier(); }
 
 void __weak hw_perf_event_setup(int cpu)       { barrier(); }
 void __weak hw_perf_event_setup_online(int cpu)        { barrier(); }
+void __weak hw_perf_event_setup_offline(int cpu)       { barrier(); }
 
 int __weak
 hw_perf_group_sched_in(struct perf_event *group_leader,
               struct perf_cpu_context *cpuctx,
-              struct perf_event_context *ctx, int cpu)
+              struct perf_event_context *ctx)
 {
        return 0;
 }
@@ -248,7 +249,7 @@ static void perf_unpin_context(struct perf_event_context *ctx)
 
 static inline u64 perf_clock(void)
 {
-       return cpu_clock(smp_processor_id());
+       return cpu_clock(raw_smp_processor_id());
 }
 
 /*
@@ -289,6 +290,15 @@ static void update_event_times(struct perf_event *event)
        event->total_time_running = run_end - event->tstamp_running;
 }
 
+static struct list_head *
+ctx_group_list(struct perf_event *event, struct perf_event_context *ctx)
+{
+       if (event->attr.pinned)
+               return &ctx->pinned_groups;
+       else
+               return &ctx->flexible_groups;
+}
+
 /*
  * Add a event from the lists for its context.
  * Must be called with ctx->mutex and ctx->lock held.
@@ -303,9 +313,19 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
         * add it straight to the context's event list, or to the group
         * leader's sibling list:
         */
-       if (group_leader == event)
-               list_add_tail(&event->group_entry, &ctx->group_list);
-       else {
+       if (group_leader == event) {
+               struct list_head *list;
+
+               if (is_software_event(event))
+                       event->group_flags |= PERF_GROUP_SOFTWARE;
+
+               list = ctx_group_list(event, ctx);
+               list_add_tail(&event->group_entry, list);
+       } else {
+               if (group_leader->group_flags & PERF_GROUP_SOFTWARE &&
+                   !is_software_event(event))
+                       group_leader->group_flags &= ~PERF_GROUP_SOFTWARE;
+
                list_add_tail(&event->group_entry, &group_leader->sibling_list);
                group_leader->nr_siblings++;
        }
@@ -355,9 +375,14 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
         * to the context list directly:
         */
        list_for_each_entry_safe(sibling, tmp, &event->sibling_list, group_entry) {
+               struct list_head *list;
 
-               list_move_tail(&sibling->group_entry, &ctx->group_list);
+               list = ctx_group_list(event, ctx);
+               list_move_tail(&sibling->group_entry, list);
                sibling->group_leader = sibling;
+
+               /* Inherit group flags from the previous leader */
+               sibling->group_flags = event->group_flags;
        }
 }
 
@@ -608,14 +633,13 @@ void perf_event_disable(struct perf_event *event)
 static int
 event_sched_in(struct perf_event *event,
                 struct perf_cpu_context *cpuctx,
-                struct perf_event_context *ctx,
-                int cpu)
+                struct perf_event_context *ctx)
 {
        if (event->state <= PERF_EVENT_STATE_OFF)
                return 0;
 
        event->state = PERF_EVENT_STATE_ACTIVE;
-       event->oncpu = cpu;     /* TODO: put 'cpu' into cpuctx->cpu */
+       event->oncpu = smp_processor_id();
        /*
         * The new state must be visible before we turn it on in the hardware:
         */
@@ -642,8 +666,7 @@ event_sched_in(struct perf_event *event,
 static int
 group_sched_in(struct perf_event *group_event,
               struct perf_cpu_context *cpuctx,
-              struct perf_event_context *ctx,
-              int cpu)
+              struct perf_event_context *ctx)
 {
        struct perf_event *event, *partial_group;
        int ret;
@@ -651,18 +674,18 @@ group_sched_in(struct perf_event *group_event,
        if (group_event->state == PERF_EVENT_STATE_OFF)
                return 0;
 
-       ret = hw_perf_group_sched_in(group_event, cpuctx, ctx, cpu);
+       ret = hw_perf_group_sched_in(group_event, cpuctx, ctx);
        if (ret)
                return ret < 0 ? ret : 0;
 
-       if (event_sched_in(group_event, cpuctx, ctx, cpu))
+       if (event_sched_in(group_event, cpuctx, ctx))
                return -EAGAIN;
 
        /*
         * Schedule in siblings as one group (if any):
         */
        list_for_each_entry(event, &group_event->sibling_list, group_entry) {
-               if (event_sched_in(event, cpuctx, ctx, cpu)) {
+               if (event_sched_in(event, cpuctx, ctx)) {
                        partial_group = event;
                        goto group_error;
                }
@@ -685,24 +708,6 @@ group_error:
        return -EAGAIN;
 }
 
-/*
- * Return 1 for a group consisting entirely of software events,
- * 0 if the group contains any hardware events.
- */
-static int is_software_only_group(struct perf_event *leader)
-{
-       struct perf_event *event;
-
-       if (!is_software_event(leader))
-               return 0;
-
-       list_for_each_entry(event, &leader->sibling_list, group_entry)
-               if (!is_software_event(event))
-                       return 0;
-
-       return 1;
-}
-
 /*
  * Work out whether we can put this event group on the CPU now.
  */
@@ -713,7 +718,7 @@ static int group_can_go_on(struct perf_event *event,
        /*
         * Groups consisting entirely of software events can always go on.
         */
-       if (is_software_only_group(event))
+       if (event->group_flags & PERF_GROUP_SOFTWARE)
                return 1;
        /*
         * If an exclusive group is already on, no other hardware
@@ -754,7 +759,6 @@ static void __perf_install_in_context(void *info)
        struct perf_event *event = info;
        struct perf_event_context *ctx = event->ctx;
        struct perf_event *leader = event->group_leader;
-       int cpu = smp_processor_id();
        int err;
 
        /*
@@ -801,7 +805,7 @@ static void __perf_install_in_context(void *info)
        if (!group_can_go_on(event, cpuctx, 1))
                err = -EEXIST;
        else
-               err = event_sched_in(event, cpuctx, ctx, cpu);
+               err = event_sched_in(event, cpuctx, ctx);
 
        if (err) {
                /*
@@ -943,11 +947,9 @@ static void __perf_event_enable(void *info)
        } else {
                perf_disable();
                if (event == leader)
-                       err = group_sched_in(event, cpuctx, ctx,
-                                            smp_processor_id());
+                       err = group_sched_in(event, cpuctx, ctx);
                else
-                       err = event_sched_in(event, cpuctx, ctx,
-                                              smp_processor_id());
+                       err = event_sched_in(event, cpuctx, ctx);
                perf_enable();
        }
 
@@ -1043,8 +1045,15 @@ static int perf_event_refresh(struct perf_event *event, int refresh)
        return 0;
 }
 
-void __perf_event_sched_out(struct perf_event_context *ctx,
-                             struct perf_cpu_context *cpuctx)
+enum event_type_t {
+       EVENT_FLEXIBLE = 0x1,
+       EVENT_PINNED = 0x2,
+       EVENT_ALL = EVENT_FLEXIBLE | EVENT_PINNED,
+};
+
+static void ctx_sched_out(struct perf_event_context *ctx,
+                         struct perf_cpu_context *cpuctx,
+                         enum event_type_t event_type)
 {
        struct perf_event *event;
 
@@ -1055,10 +1064,18 @@ void __perf_event_sched_out(struct perf_event_context *ctx,
        update_context_time(ctx);
 
        perf_disable();
-       if (ctx->nr_active) {
-               list_for_each_entry(event, &ctx->group_list, group_entry)
+       if (!ctx->nr_active)
+               goto out_enable;
+
+       if (event_type & EVENT_PINNED)
+               list_for_each_entry(event, &ctx->pinned_groups, group_entry)
                        group_sched_out(event, cpuctx, ctx);
-       }
+
+       if (event_type & EVENT_FLEXIBLE)
+               list_for_each_entry(event, &ctx->flexible_groups, group_entry)
+                       group_sched_out(event, cpuctx, ctx);
+
+ out_enable:
        perf_enable();
  out:
        raw_spin_unlock(&ctx->lock);
@@ -1170,9 +1187,9 @@ static void perf_event_sync_stat(struct perf_event_context *ctx,
  * not restart the event.
  */
 void perf_event_task_sched_out(struct task_struct *task,
-                                struct task_struct *next, int cpu)
+                                struct task_struct *next)
 {
-       struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+       struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
        struct perf_event_context *ctx = task->perf_event_ctxp;
        struct perf_event_context *next_ctx;
        struct perf_event_context *parent;
@@ -1220,15 +1237,13 @@ void perf_event_task_sched_out(struct task_struct *task,
        rcu_read_unlock();
 
        if (do_switch) {
-               __perf_event_sched_out(ctx, cpuctx);
+               ctx_sched_out(ctx, cpuctx, EVENT_ALL);
                cpuctx->task_ctx = NULL;
        }
 }
 
-/*
- * Called with IRQs disabled
- */
-static void __perf_event_task_sched_out(struct perf_event_context *ctx)
+static void task_ctx_sched_out(struct perf_event_context *ctx,
+                              enum event_type_t event_type)
 {
        struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 
@@ -1238,47 +1253,41 @@ static void __perf_event_task_sched_out(struct perf_event_context *ctx)
        if (WARN_ON_ONCE(ctx != cpuctx->task_ctx))
                return;
 
-       __perf_event_sched_out(ctx, cpuctx);
+       ctx_sched_out(ctx, cpuctx, event_type);
        cpuctx->task_ctx = NULL;
 }
 
 /*
  * Called with IRQs disabled
  */
-static void perf_event_cpu_sched_out(struct perf_cpu_context *cpuctx)
+static void __perf_event_task_sched_out(struct perf_event_context *ctx)
+{
+       task_ctx_sched_out(ctx, EVENT_ALL);
+}
+
+/*
+ * Called with IRQs disabled
+ */
+static void cpu_ctx_sched_out(struct perf_cpu_context *cpuctx,
+                             enum event_type_t event_type)
 {
-       __perf_event_sched_out(&cpuctx->ctx, cpuctx);
+       ctx_sched_out(&cpuctx->ctx, cpuctx, event_type);
 }
 
 static void
-__perf_event_sched_in(struct perf_event_context *ctx,
-                       struct perf_cpu_context *cpuctx, int cpu)
+ctx_pinned_sched_in(struct perf_event_context *ctx,
+                   struct perf_cpu_context *cpuctx)
 {
        struct perf_event *event;
-       int can_add_hw = 1;
-
-       raw_spin_lock(&ctx->lock);
-       ctx->is_active = 1;
-       if (likely(!ctx->nr_events))
-               goto out;
-
-       ctx->timestamp = perf_clock();
 
-       perf_disable();
-
-       /*
-        * First go through the list and put on any pinned groups
-        * in order to give them the best chance of going on.
-        */
-       list_for_each_entry(event, &ctx->group_list, group_entry) {
-               if (event->state <= PERF_EVENT_STATE_OFF ||
-                   !event->attr.pinned)
+       list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
+               if (event->state <= PERF_EVENT_STATE_OFF)
                        continue;
-               if (event->cpu != -1 && event->cpu != cpu)
+               if (event->cpu != -1 && event->cpu != smp_processor_id())
                        continue;
 
                if (group_can_go_on(event, cpuctx, 1))
-                       group_sched_in(event, cpuctx, ctx, cpu);
+                       group_sched_in(event, cpuctx, ctx);
 
                /*
                 * If this pinned group hasn't been scheduled,
@@ -1289,32 +1298,83 @@ __perf_event_sched_in(struct perf_event_context *ctx,
                        event->state = PERF_EVENT_STATE_ERROR;
                }
        }
+}
 
-       list_for_each_entry(event, &ctx->group_list, group_entry) {
-               /*
-                * Ignore events in OFF or ERROR state, and
-                * ignore pinned events since we did them already.
-                */
-               if (event->state <= PERF_EVENT_STATE_OFF ||
-                   event->attr.pinned)
-                       continue;
+static void
+ctx_flexible_sched_in(struct perf_event_context *ctx,
+                     struct perf_cpu_context *cpuctx)
+{
+       struct perf_event *event;
+       int can_add_hw = 1;
 
+       list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
+               /* Ignore events in OFF or ERROR state */
+               if (event->state <= PERF_EVENT_STATE_OFF)
+                       continue;
                /*
                 * Listen to the 'cpu' scheduling filter constraint
                 * of events:
                 */
-               if (event->cpu != -1 && event->cpu != cpu)
+               if (event->cpu != -1 && event->cpu != smp_processor_id())
                        continue;
 
                if (group_can_go_on(event, cpuctx, can_add_hw))
-                       if (group_sched_in(event, cpuctx, ctx, cpu))
+                       if (group_sched_in(event, cpuctx, ctx))
                                can_add_hw = 0;
        }
+}
+
+static void
+ctx_sched_in(struct perf_event_context *ctx,
+            struct perf_cpu_context *cpuctx,
+            enum event_type_t event_type)
+{
+       raw_spin_lock(&ctx->lock);
+       ctx->is_active = 1;
+       if (likely(!ctx->nr_events))
+               goto out;
+
+       ctx->timestamp = perf_clock();
+
+       perf_disable();
+
+       /*
+        * First go through the list and put on any pinned groups
+        * in order to give them the best chance of going on.
+        */
+       if (event_type & EVENT_PINNED)
+               ctx_pinned_sched_in(ctx, cpuctx);
+
+       /* Then walk through the lower prio flexible groups */
+       if (event_type & EVENT_FLEXIBLE)
+               ctx_flexible_sched_in(ctx, cpuctx);
+
        perf_enable();
  out:
        raw_spin_unlock(&ctx->lock);
 }
 
+static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx,
+                            enum event_type_t event_type)
+{
+       struct perf_event_context *ctx = &cpuctx->ctx;
+
+       ctx_sched_in(ctx, cpuctx, event_type);
+}
+
+static void task_ctx_sched_in(struct task_struct *task,
+                             enum event_type_t event_type)
+{
+       struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+       struct perf_event_context *ctx = task->perf_event_ctxp;
+
+       if (likely(!ctx))
+               return;
+       if (cpuctx->task_ctx == ctx)
+               return;
+       ctx_sched_in(ctx, cpuctx, event_type);
+       cpuctx->task_ctx = ctx;
+}
 /*
  * Called from scheduler to add the events of the current task
  * with interrupts disabled.
@@ -1326,38 +1386,128 @@ __perf_event_sched_in(struct perf_event_context *ctx,
  * accessing the event control register. If a NMI hits, then it will
  * keep the event running.
  */
-void perf_event_task_sched_in(struct task_struct *task, int cpu)
+void perf_event_task_sched_in(struct task_struct *task)
 {
-       struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+       struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
        struct perf_event_context *ctx = task->perf_event_ctxp;
 
        if (likely(!ctx))
                return;
+
        if (cpuctx->task_ctx == ctx)
                return;
-       __perf_event_sched_in(ctx, cpuctx, cpu);
+
+       /*
+        * We want to keep the following priority order:
+        * cpu pinned (that don't need to move), task pinned,
+        * cpu flexible, task flexible.
+        */
+       cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
+
+       ctx_sched_in(ctx, cpuctx, EVENT_PINNED);
+       cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
+       ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE);
+
        cpuctx->task_ctx = ctx;
 }
 
-static void perf_event_cpu_sched_in(struct perf_cpu_context *cpuctx, int cpu)
+#define MAX_INTERRUPTS (~0ULL)
+
+static void perf_log_throttle(struct perf_event *event, int enable);
+
+static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)
 {
-       struct perf_event_context *ctx = &cpuctx->ctx;
+       u64 frequency = event->attr.sample_freq;
+       u64 sec = NSEC_PER_SEC;
+       u64 divisor, dividend;
+
+       int count_fls, nsec_fls, frequency_fls, sec_fls;
+
+       count_fls = fls64(count);
+       nsec_fls = fls64(nsec);
+       frequency_fls = fls64(frequency);
+       sec_fls = 30;
+
+       /*
+        * We got @count in @nsec, with a target of sample_freq HZ
+        * the target period becomes:
+        *
+        *             @count * 10^9
+        * period = -------------------
+        *          @nsec * sample_freq
+        *
+        */
+
+       /*
+        * Reduce accuracy by one bit such that @a and @b converge
+        * to a similar magnitude.
+        */
+#define REDUCE_FLS(a, b)               \
+do {                                   \
+       if (a##_fls > b##_fls) {        \
+               a >>= 1;                \
+               a##_fls--;              \
+       } else {                        \
+               b >>= 1;                \
+               b##_fls--;              \
+       }                               \
+} while (0)
+
+       /*
+        * Reduce accuracy until either term fits in a u64, then proceed with
+        * the other, so that finally we can do a u64/u64 division.
+        */
+       while (count_fls + sec_fls > 64 && nsec_fls + frequency_fls > 64) {
+               REDUCE_FLS(nsec, frequency);
+               REDUCE_FLS(sec, count);
+       }
+
+       if (count_fls + sec_fls > 64) {
+               divisor = nsec * frequency;
+
+               while (count_fls + sec_fls > 64) {
+                       REDUCE_FLS(count, sec);
+                       divisor >>= 1;
+               }
+
+               dividend = count * sec;
+       } else {
+               dividend = count * sec;
+
+               while (nsec_fls + frequency_fls > 64) {
+                       REDUCE_FLS(nsec, frequency);
+                       dividend >>= 1;
+               }
 
-       __perf_event_sched_in(ctx, cpuctx, cpu);
+               divisor = nsec * frequency;
+       }
+
+       return div64_u64(dividend, divisor);
 }
 
-#define MAX_INTERRUPTS (~0ULL)
+static void perf_event_stop(struct perf_event *event)
+{
+       if (!event->pmu->stop)
+               return event->pmu->disable(event);
 
-static void perf_log_throttle(struct perf_event *event, int enable);
+       return event->pmu->stop(event);
+}
+
+static int perf_event_start(struct perf_event *event)
+{
+       if (!event->pmu->start)
+               return event->pmu->enable(event);
 
-static void perf_adjust_period(struct perf_event *event, u64 events)
+       return event->pmu->start(event);
+}
+
+static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 {
        struct hw_perf_event *hwc = &event->hw;
        u64 period, sample_period;
        s64 delta;
 
-       events *= hwc->sample_period;
-       period = div64_u64(events, event->attr.sample_freq);
+       period = perf_calculate_period(event, nsec, count);
 
        delta = (s64)(period - hwc->sample_period);
        delta = (delta + 7) / 8; /* low pass filter */
@@ -1368,13 +1518,22 @@ static void perf_adjust_period(struct perf_event *event, u64 events)
                sample_period = 1;
 
        hwc->sample_period = sample_period;
+
+       if (atomic64_read(&hwc->period_left) > 8*sample_period) {
+               perf_disable();
+               perf_event_stop(event);
+               atomic64_set(&hwc->period_left, 0);
+               perf_event_start(event);
+               perf_enable();
+       }
 }
 
 static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 {
        struct perf_event *event;
        struct hw_perf_event *hwc;
-       u64 interrupts, freq;
+       u64 interrupts, now;
+       s64 delta;
 
        raw_spin_lock(&ctx->lock);
        list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
@@ -1395,44 +1554,18 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
                if (interrupts == MAX_INTERRUPTS) {
                        perf_log_throttle(event, 1);
                        event->pmu->unthrottle(event);
-                       interrupts = 2*sysctl_perf_event_sample_rate/HZ;
                }
 
                if (!event->attr.freq || !event->attr.sample_freq)
                        continue;
 
-               /*
-                * if the specified freq < HZ then we need to skip ticks
-                */
-               if (event->attr.sample_freq < HZ) {
-                       freq = event->attr.sample_freq;
-
-                       hwc->freq_count += freq;
-                       hwc->freq_interrupts += interrupts;
-
-                       if (hwc->freq_count < HZ)
-                               continue;
-
-                       interrupts = hwc->freq_interrupts;
-                       hwc->freq_interrupts = 0;
-                       hwc->freq_count -= HZ;
-               } else
-                       freq = HZ;
-
-               perf_adjust_period(event, freq * interrupts);
+               event->pmu->read(event);
+               now = atomic64_read(&event->count);
+               delta = now - hwc->freq_count_stamp;
+               hwc->freq_count_stamp = now;
 
-               /*
-                * In order to avoid being stalled by an (accidental) huge
-                * sample period, force reset the sample period if we didn't
-                * get any events in this freq period.
-                */
-               if (!interrupts) {
-                       perf_disable();
-                       event->pmu->disable(event);
-                       atomic64_set(&hwc->period_left, 0);
-                       event->pmu->enable(event);
-                       perf_enable();
-               }
+               if (delta > 0)
+                       perf_adjust_period(event, TICK_NSEC, delta);
        }
        raw_spin_unlock(&ctx->lock);
 }
@@ -1442,26 +1575,18 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
  */
 static void rotate_ctx(struct perf_event_context *ctx)
 {
-       struct perf_event *event;
-
        if (!ctx->nr_events)
                return;
 
        raw_spin_lock(&ctx->lock);
-       /*
-        * Rotate the first entry last (works just fine for group events too):
-        */
-       perf_disable();
-       list_for_each_entry(event, &ctx->group_list, group_entry) {
-               list_move_tail(&event->group_entry, &ctx->group_list);
-               break;
-       }
-       perf_enable();
+
+       /* Rotate the first entry last of non-pinned groups */
+       list_rotate_left(&ctx->flexible_groups);
 
        raw_spin_unlock(&ctx->lock);
 }
 
-void perf_event_task_tick(struct task_struct *curr, int cpu)
+void perf_event_task_tick(struct task_struct *curr)
 {
        struct perf_cpu_context *cpuctx;
        struct perf_event_context *ctx;
@@ -1469,24 +1594,43 @@ void perf_event_task_tick(struct task_struct *curr, int cpu)
        if (!atomic_read(&nr_events))
                return;
 
-       cpuctx = &per_cpu(perf_cpu_context, cpu);
+       cpuctx = &__get_cpu_var(perf_cpu_context);
        ctx = curr->perf_event_ctxp;
 
+       perf_disable();
+
        perf_ctx_adjust_freq(&cpuctx->ctx);
        if (ctx)
                perf_ctx_adjust_freq(ctx);
 
-       perf_event_cpu_sched_out(cpuctx);
+       cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
        if (ctx)
-               __perf_event_task_sched_out(ctx);
+               task_ctx_sched_out(ctx, EVENT_FLEXIBLE);
 
        rotate_ctx(&cpuctx->ctx);
        if (ctx)
                rotate_ctx(ctx);
 
-       perf_event_cpu_sched_in(cpuctx, cpu);
+       cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
        if (ctx)
-               perf_event_task_sched_in(curr, cpu);
+               task_ctx_sched_in(curr, EVENT_FLEXIBLE);
+
+       perf_enable();
+}
+
+static int event_enable_on_exec(struct perf_event *event,
+                               struct perf_event_context *ctx)
+{
+       if (!event->attr.enable_on_exec)
+               return 0;
+
+       event->attr.enable_on_exec = 0;
+       if (event->state >= PERF_EVENT_STATE_INACTIVE)
+               return 0;
+
+       __perf_event_mark_enabled(event, ctx);
+
+       return 1;
 }
 
 /*
@@ -1499,6 +1643,7 @@ static void perf_event_enable_on_exec(struct task_struct *task)
        struct perf_event *event;
        unsigned long flags;
        int enabled = 0;
+       int ret;
 
        local_irq_save(flags);
        ctx = task->perf_event_ctxp;
@@ -1509,14 +1654,16 @@ static void perf_event_enable_on_exec(struct task_struct *task)
 
        raw_spin_lock(&ctx->lock);
 
-       list_for_each_entry(event, &ctx->group_list, group_entry) {
-               if (!event->attr.enable_on_exec)
-                       continue;
-               event->attr.enable_on_exec = 0;
-               if (event->state >= PERF_EVENT_STATE_INACTIVE)
-                       continue;
-               __perf_event_mark_enabled(event, ctx);
-               enabled = 1;
+       list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
+               ret = event_enable_on_exec(event, ctx);
+               if (ret)
+                       enabled = 1;
+       }
+
+       list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
+               ret = event_enable_on_exec(event, ctx);
+               if (ret)
+                       enabled = 1;
        }
 
        /*
@@ -1527,7 +1674,7 @@ static void perf_event_enable_on_exec(struct task_struct *task)
 
        raw_spin_unlock(&ctx->lock);
 
-       perf_event_task_sched_in(task, smp_processor_id());
+       perf_event_task_sched_in(task);
  out:
        local_irq_restore(flags);
 }
@@ -1590,7 +1737,8 @@ __perf_event_init_context(struct perf_event_context *ctx,
 {
        raw_spin_lock_init(&ctx->lock);
        mutex_init(&ctx->mutex);
-       INIT_LIST_HEAD(&ctx->group_list);
+       INIT_LIST_HEAD(&ctx->pinned_groups);
+       INIT_LIST_HEAD(&ctx->flexible_groups);
        INIT_LIST_HEAD(&ctx->event_list);
        atomic_set(&ctx->refcount, 1);
        ctx->task = task;
@@ -3259,8 +3407,6 @@ static void perf_event_task_output(struct perf_event *event,
        task_event->event_id.tid = perf_event_tid(event, task);
        task_event->event_id.ptid = perf_event_tid(event, current);
 
-       task_event->event_id.time = perf_clock();
-
        perf_output_put(&handle, task_event->event_id);
 
        perf_output_end(&handle);
@@ -3268,6 +3414,9 @@ static void perf_event_task_output(struct perf_event *event,
 
 static int perf_event_task_match(struct perf_event *event)
 {
+       if (event->state < PERF_EVENT_STATE_INACTIVE)
+               return 0;
+
        if (event->cpu != -1 && event->cpu != smp_processor_id())
                return 0;
 
@@ -3297,7 +3446,7 @@ static void perf_event_task_event(struct perf_task_event *task_event)
        cpuctx = &get_cpu_var(perf_cpu_context);
        perf_event_task_ctx(&cpuctx->ctx, task_event);
        if (!ctx)
-               ctx = rcu_dereference(task_event->task->perf_event_ctxp);
+               ctx = rcu_dereference(current->perf_event_ctxp);
        if (ctx)
                perf_event_task_ctx(ctx, task_event);
        put_cpu_var(perf_cpu_context);
@@ -3328,6 +3477,7 @@ static void perf_event_task(struct task_struct *task,
                        /* .ppid */
                        /* .tid  */
                        /* .ptid */
+                       .time = perf_clock(),
                },
        };
 
@@ -3377,6 +3527,9 @@ static void perf_event_comm_output(struct perf_event *event,
 
 static int perf_event_comm_match(struct perf_event *event)
 {
+       if (event->state < PERF_EVENT_STATE_INACTIVE)
+               return 0;
+
        if (event->cpu != -1 && event->cpu != smp_processor_id())
                return 0;
 
@@ -3494,6 +3647,9 @@ static void perf_event_mmap_output(struct perf_event *event,
 static int perf_event_mmap_match(struct perf_event *event,
                                   struct perf_mmap_event *mmap_event)
 {
+       if (event->state < PERF_EVENT_STATE_INACTIVE)
+               return 0;
+
        if (event->cpu != -1 && event->cpu != smp_processor_id())
                return 0;
 
@@ -3600,7 +3756,7 @@ void __perf_event_mmap(struct vm_area_struct *vma)
                        /* .tid */
                        .start  = vma->vm_start,
                        .len    = vma->vm_end - vma->vm_start,
-                       .pgoff  = vma->vm_pgoff,
+                       .pgoff  = (u64)vma->vm_pgoff << PAGE_SHIFT,
                },
        };
 
@@ -3680,12 +3836,12 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
 
        if (event->attr.freq) {
                u64 now = perf_clock();
-               s64 delta = now - hwc->freq_stamp;
+               s64 delta = now - hwc->freq_time_stamp;
 
-               hwc->freq_stamp = now;
+               hwc->freq_time_stamp = now;
 
-               if (delta > 0 && delta < TICK_NSEC)
-                       perf_adjust_period(event, NSEC_PER_SEC / (int)delta);
+               if (delta > 0 && delta < 2*TICK_NSEC)
+                       perf_adjust_period(event, delta, hwc->last_period);
        }
 
        /*
@@ -4176,7 +4332,7 @@ static const struct pmu perf_ops_task_clock = {
        .read           = task_clock_perf_event_read,
 };
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_EVENT_TRACING
 
 void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
                          int entry_size)
@@ -4281,7 +4437,7 @@ static void perf_event_free_filter(struct perf_event *event)
 {
 }
 
-#endif /* CONFIG_EVENT_PROFILE */
+#endif /* CONFIG_EVENT_TRACING */
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 static void bp_perf_event_destroy(struct perf_event *event)
@@ -4571,7 +4727,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
        if (attr->type >= PERF_TYPE_MAX)
                return -EINVAL;
 
-       if (attr->__reserved_1 || attr->__reserved_2)
+       if (attr->__reserved_1)
                return -EINVAL;
 
        if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))
@@ -4862,8 +5018,15 @@ inherit_event(struct perf_event *parent_event,
        else
                child_event->state = PERF_EVENT_STATE_OFF;
 
-       if (parent_event->attr.freq)
-               child_event->hw.sample_period = parent_event->hw.sample_period;
+       if (parent_event->attr.freq) {
+               u64 sample_period = parent_event->hw.sample_period;
+               struct hw_perf_event *hwc = &child_event->hw;
+
+               hwc->sample_period = sample_period;
+               hwc->last_period   = sample_period;
+
+               atomic64_set(&hwc->period_left, sample_period);
+       }
 
        child_event->overflow_handler = parent_event->overflow_handler;
 
@@ -5031,7 +5194,11 @@ void perf_event_exit_task(struct task_struct *child)
        mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING);
 
 again:
-       list_for_each_entry_safe(child_event, tmp, &child_ctx->group_list,
+       list_for_each_entry_safe(child_event, tmp, &child_ctx->pinned_groups,
+                                group_entry)
+               __perf_event_exit_task(child_event, child_ctx, child);
+
+       list_for_each_entry_safe(child_event, tmp, &child_ctx->flexible_groups,
                                 group_entry)
                __perf_event_exit_task(child_event, child_ctx, child);
 
@@ -5040,7 +5207,8 @@ again:
         * its siblings to the list, but we obtained 'tmp' before that which
         * will still point to the list head terminating the iteration.
         */
-       if (!list_empty(&child_ctx->group_list))
+       if (!list_empty(&child_ctx->pinned_groups) ||
+           !list_empty(&child_ctx->flexible_groups))
                goto again;
 
        mutex_unlock(&child_ctx->mutex);
@@ -5048,6 +5216,24 @@ again:
        put_ctx(child_ctx);
 }
 
+static void perf_free_event(struct perf_event *event,
+                           struct perf_event_context *ctx)
+{
+       struct perf_event *parent = event->parent;
+
+       if (WARN_ON_ONCE(!parent))
+               return;
+
+       mutex_lock(&parent->child_mutex);
+       list_del_init(&event->child_list);
+       mutex_unlock(&parent->child_mutex);
+
+       fput(parent->filp);
+
+       list_del_event(event, ctx);
+       free_event(event);
+}
+
 /*
  * free an unexposed, unused context as created by inheritance by
  * init_task below, used by fork() in case of fail.
@@ -5062,36 +5248,70 @@ void perf_event_free_task(struct task_struct *task)
 
        mutex_lock(&ctx->mutex);
 again:
-       list_for_each_entry_safe(event, tmp, &ctx->group_list, group_entry) {
-               struct perf_event *parent = event->parent;
+       list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
+               perf_free_event(event, ctx);
 
-               if (WARN_ON_ONCE(!parent))
-                       continue;
+       list_for_each_entry_safe(event, tmp, &ctx->flexible_groups,
+                                group_entry)
+               perf_free_event(event, ctx);
+
+       if (!list_empty(&ctx->pinned_groups) ||
+           !list_empty(&ctx->flexible_groups))
+               goto again;
 
-               mutex_lock(&parent->child_mutex);
-               list_del_init(&event->child_list);
-               mutex_unlock(&parent->child_mutex);
+       mutex_unlock(&ctx->mutex);
 
-               fput(parent->filp);
+       put_ctx(ctx);
+}
 
-               list_del_event(event, ctx);
-               free_event(event);
+static int
+inherit_task_group(struct perf_event *event, struct task_struct *parent,
+                  struct perf_event_context *parent_ctx,
+                  struct task_struct *child,
+                  int *inherited_all)
+{
+       int ret;
+       struct perf_event_context *child_ctx = child->perf_event_ctxp;
+
+       if (!event->attr.inherit) {
+               *inherited_all = 0;
+               return 0;
        }
 
-       if (!list_empty(&ctx->group_list))
-               goto again;
+       if (!child_ctx) {
+               /*
+                * This is executed from the parent task context, so
+                * inherit events that have been marked for cloning.
+                * First allocate and initialize a context for the
+                * child.
+                */
 
-       mutex_unlock(&ctx->mutex);
+               child_ctx = kzalloc(sizeof(struct perf_event_context),
+                                   GFP_KERNEL);
+               if (!child_ctx)
+                       return -ENOMEM;
 
-       put_ctx(ctx);
+               __perf_event_init_context(child_ctx, child);
+               child->perf_event_ctxp = child_ctx;
+               get_task_struct(child);
+       }
+
+       ret = inherit_group(event, parent, parent_ctx,
+                           child, child_ctx);
+
+       if (ret)
+               *inherited_all = 0;
+
+       return ret;
 }
 
+
 /*
  * Initialize the perf_event context in task_struct
  */
 int perf_event_init_task(struct task_struct *child)
 {
-       struct perf_event_context *child_ctx = NULL, *parent_ctx;
+       struct perf_event_context *child_ctx, *parent_ctx;
        struct perf_event_context *cloned_ctx;
        struct perf_event *event;
        struct task_struct *parent = current;
@@ -5129,41 +5349,22 @@ int perf_event_init_task(struct task_struct *child)
         * We dont have to disable NMIs - we are only looking at
         * the list, not manipulating it:
         */
-       list_for_each_entry(event, &parent_ctx->group_list, group_entry) {
-
-               if (!event->attr.inherit) {
-                       inherited_all = 0;
-                       continue;
-               }
-
-               if (!child->perf_event_ctxp) {
-                       /*
-                        * This is executed from the parent task context, so
-                        * inherit events that have been marked for cloning.
-                        * First allocate and initialize a context for the
-                        * child.
-                        */
-
-                       child_ctx = kzalloc(sizeof(struct perf_event_context),
-                                           GFP_KERNEL);
-                       if (!child_ctx) {
-                               ret = -ENOMEM;
-                               break;
-                       }
-
-                       __perf_event_init_context(child_ctx, child);
-                       child->perf_event_ctxp = child_ctx;
-                       get_task_struct(child);
-               }
+       list_for_each_entry(event, &parent_ctx->pinned_groups, group_entry) {
+               ret = inherit_task_group(event, parent, parent_ctx, child,
+                                        &inherited_all);
+               if (ret)
+                       break;
+       }
 
-               ret = inherit_group(event, parent, parent_ctx,
-                                            child, child_ctx);
-               if (ret) {
-                       inherited_all = 0;
+       list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) {
+               ret = inherit_task_group(event, parent, parent_ctx, child,
+                                        &inherited_all);
+               if (ret)
                        break;
-               }
        }
 
+       child_ctx = child->perf_event_ctxp;
+
        if (child_ctx && inherited_all) {
                /*
                 * Mark the child context as a clone of the parent
@@ -5212,7 +5413,9 @@ static void __perf_event_exit_cpu(void *info)
        struct perf_event_context *ctx = &cpuctx->ctx;
        struct perf_event *event, *tmp;
 
-       list_for_each_entry_safe(event, tmp, &ctx->group_list, group_entry)
+       list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
+               __perf_event_remove_from_context(event);
+       list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry)
                __perf_event_remove_from_context(event);
 }
 static void perf_event_exit_cpu(int cpu)
@@ -5250,6 +5453,10 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
                perf_event_exit_cpu(cpu);
                break;
 
+       case CPU_DEAD:
+               hw_perf_event_setup_offline(cpu);
+               break;
+
        default:
                break;
        }
index 2e17c9c92cbec3ff3ab5afbb9ec30ce0fbafcb21..b08e697cd83f0944747d5624698d356cf0288090 100644 (file)
@@ -367,7 +367,7 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type)
        struct task_struct *result = NULL;
        if (pid) {
                struct hlist_node *first;
-               first = rcu_dereference(pid->tasks[type].first);
+               first = rcu_dereference_check(pid->tasks[type].first, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock));
                if (first)
                        result = hlist_entry(first, struct task_struct, pids[(type)].node);
        }
index 495440779ce3b91c9927b98c61a83922b8578a31..00d1fda58ab6a270c42b7ad252e21ff36b4dce96 100644 (file)
@@ -256,7 +256,7 @@ static int posix_get_monotonic_coarse(clockid_t which_clock,
        return 0;
 }
 
-int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp)
+static int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp)
 {
        *tp = ktime_to_timespec(KTIME_LOW_RES);
        return 0;
index 91e09d3b2eb2276e22897b523f9988304df49d04..5c36ea9d55d22ccf5a27d542b262968a13489d57 100644 (file)
@@ -27,6 +27,15 @@ config PM_DEBUG
        code. This is helpful when debugging and reporting PM bugs, like
        suspend support.
 
+config PM_ADVANCED_DEBUG
+       bool "Extra PM attributes in sysfs for low-level debugging/testing"
+       depends on PM_DEBUG
+       default n
+       ---help---
+       Add extra sysfs attributes allowing one to access some Power Management
+       fields of device objects from user space.  If you are not a kernel
+       developer interested in debugging/testing Power Management, say "no".
+
 config PM_VERBOSE
        bool "Verbose Power Management debugging"
        depends on PM_DEBUG
@@ -85,6 +94,11 @@ config PM_SLEEP
        depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE
        default y
 
+config PM_SLEEP_ADVANCED_DEBUG
+       bool
+       depends on PM_ADVANCED_DEBUG
+       default n
+
 config SUSPEND
        bool "Suspend to RAM and standby"
        depends on PM && ARCH_SUSPEND_POSSIBLE
@@ -222,3 +236,8 @@ config PM_RUNTIME
          and the bus type drivers of the buses the devices are on are
          responsible for the actual handling of the autosuspend requests and
          wake-up events.
+
+config PM_OPS
+       bool
+       depends on PM_SLEEP || PM_RUNTIME
+       default y
index 0998c7139053c8c5ec46165d32327bba42f2ecce..b58800b21fc01b98fc8af60c2b9ab16385256cc7 100644 (file)
@@ -44,6 +44,32 @@ int pm_notifier_call_chain(unsigned long val)
                        == NOTIFY_BAD) ? -EINVAL : 0;
 }
 
+/* If set, devices may be suspended and resumed asynchronously. */
+int pm_async_enabled = 1;
+
+static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
+                            char *buf)
+{
+       return sprintf(buf, "%d\n", pm_async_enabled);
+}
+
+static ssize_t pm_async_store(struct kobject *kobj, struct kobj_attribute *attr,
+                             const char *buf, size_t n)
+{
+       unsigned long val;
+
+       if (strict_strtoul(buf, 10, &val))
+               return -EINVAL;
+
+       if (val > 1)
+               return -EINVAL;
+
+       pm_async_enabled = val;
+       return n;
+}
+
+power_attr(pm_async);
+
 #ifdef CONFIG_PM_DEBUG
 int pm_test_level = TEST_NONE;
 
@@ -208,8 +234,11 @@ static struct attribute * g[] = {
 #ifdef CONFIG_PM_TRACE
        &pm_trace_attr.attr,
 #endif
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PM_DEBUG)
+#ifdef CONFIG_PM_SLEEP
+       &pm_async_attr.attr,
+#ifdef CONFIG_PM_DEBUG
        &pm_test_attr.attr,
+#endif
 #endif
        NULL,
 };
index 36cb168e4330936a9120691fd19e80ddb8d2db9d..830cadecbdfcf2c9f7adedeca5cb6e1f169f8e87 100644 (file)
@@ -1181,7 +1181,7 @@ static void free_unnecessary_pages(void)
 
        memory_bm_position_reset(&copy_bm);
 
-       while (to_free_normal > 0 && to_free_highmem > 0) {
+       while (to_free_normal > 0 || to_free_highmem > 0) {
                unsigned long pfn = memory_bm_next_pfn(&copy_bm);
                struct page *page = pfn_to_page(pfn);
 
@@ -1500,7 +1500,7 @@ asmlinkage int swsusp_save(void)
 {
        unsigned int nr_pages, nr_highmem;
 
-       printk(KERN_INFO "PM: Creating hibernation image: \n");
+       printk(KERN_INFO "PM: Creating hibernation image:\n");
 
        drain_local_pages(NULL);
        nr_pages = count_data_pages();
index 09b2b0ae9e9d474fdc2f459f9741ab5545c4cf6c..1d575733d4e142f68ee3a43ea033ccb1882111c7 100644 (file)
@@ -657,10 +657,6 @@ int swsusp_read(unsigned int *flags_p)
        struct swsusp_info *header;
 
        *flags_p = swsusp_header->flags;
-       if (IS_ERR(resume_bdev)) {
-               pr_debug("PM: Image device not initialised\n");
-               return PTR_ERR(resume_bdev);
-       }
 
        memset(&snapshot, 0, sizeof(struct snapshot_handle));
        error = snapshot_write_next(&snapshot, PAGE_SIZE);
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
deleted file mode 100644 (file)
index 5b3601b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * linux/kernel/power/swsusp.c
- *
- * This file provides code to write suspend image to swap and read it back.
- *
- * Copyright (C) 1998-2001 Gabor Kuti <seasons@fornax.hu>
- * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@suse.cz>
- *
- * This file is released under the GPLv2.
- *
- * I'd like to thank the following people for their work:
- *
- * Pavel Machek <pavel@ucw.cz>:
- * Modifications, defectiveness pointing, being with me at the very beginning,
- * suspend to swap space, stop all tasks. Port to 2.4.18-ac and 2.5.17.
- *
- * Steve Doddi <dirk@loth.demon.co.uk>:
- * Support the possibility of hardware state restoring.
- *
- * Raph <grey.havens@earthling.net>:
- * Support for preserving states of network devices and virtual console
- * (including X and svgatextmode)
- *
- * Kurt Garloff <garloff@suse.de>:
- * Straightened the critical function in order to prevent compilers from
- * playing tricks with local variables.
- *
- * Andreas Mohr <a.mohr@mailto.de>
- *
- * Alex Badea <vampire@go.ro>:
- * Fixed runaway init
- *
- * Rafael J. Wysocki <rjw@sisk.pl>
- * Reworked the freeing of memory and the handling of swap
- *
- * More state savers are welcome. Especially for the scsi layer...
- *
- * For TODOs,FIXMEs also look in Documentation/power/swsusp.txt
- */
-
-#include <linux/mm.h>
-#include <linux/suspend.h>
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/swap.h>
-#include <linux/pm.h>
-#include <linux/swapops.h>
-#include <linux/bootmem.h>
-#include <linux/syscalls.h>
-#include <linux/highmem.h>
-#include <linux/time.h>
-#include <linux/rbtree.h>
-#include <linux/io.h>
-
-#include "power.h"
-
-int in_suspend __nosavedata = 0;
index bf0014d6a5f0972a1b2352d35a09eb82296164d1..4d2289626a84e6d03dbc618db13fbb8af4bd6092 100644 (file)
@@ -195,6 +195,15 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
        return res;
 }
 
+static void snapshot_deprecated_ioctl(unsigned int cmd)
+{
+       if (printk_ratelimit())
+               printk(KERN_NOTICE "%pf: ioctl '%.8x' is deprecated and will "
+                               "be removed soon, update your suspend-to-disk "
+                               "utilities\n",
+                               __builtin_return_address(0), cmd);
+}
+
 static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                                                        unsigned long arg)
 {
@@ -246,8 +255,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                data->frozen = 0;
                break;
 
-       case SNAPSHOT_CREATE_IMAGE:
        case SNAPSHOT_ATOMIC_SNAPSHOT:
+               snapshot_deprecated_ioctl(cmd);
+       case SNAPSHOT_CREATE_IMAGE:
                if (data->mode != O_RDONLY || !data->frozen  || data->ready) {
                        error = -EPERM;
                        break;
@@ -275,8 +285,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                data->ready = 0;
                break;
 
-       case SNAPSHOT_PREF_IMAGE_SIZE:
        case SNAPSHOT_SET_IMAGE_SIZE:
+               snapshot_deprecated_ioctl(cmd);
+       case SNAPSHOT_PREF_IMAGE_SIZE:
                image_size = arg;
                break;
 
@@ -290,15 +301,17 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                error = put_user(size, (loff_t __user *)arg);
                break;
 
-       case SNAPSHOT_AVAIL_SWAP_SIZE:
        case SNAPSHOT_AVAIL_SWAP:
+               snapshot_deprecated_ioctl(cmd);
+       case SNAPSHOT_AVAIL_SWAP_SIZE:
                size = count_swap_pages(data->swap, 1);
                size <<= PAGE_SHIFT;
                error = put_user(size, (loff_t __user *)arg);
                break;
 
-       case SNAPSHOT_ALLOC_SWAP_PAGE:
        case SNAPSHOT_GET_SWAP_PAGE:
+               snapshot_deprecated_ioctl(cmd);
+       case SNAPSHOT_ALLOC_SWAP_PAGE:
                if (data->swap < 0 || data->swap >= MAX_SWAPFILES) {
                        error = -ENODEV;
                        break;
@@ -321,6 +334,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                break;
 
        case SNAPSHOT_SET_SWAP_FILE: /* This ioctl is deprecated */
+               snapshot_deprecated_ioctl(cmd);
                if (!swsusp_swap_in_use()) {
                        /*
                         * User space encodes device types as two-byte values,
@@ -362,6 +376,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
                break;
 
        case SNAPSHOT_PMOPS: /* This ioctl is deprecated */
+               snapshot_deprecated_ioctl(cmd);
                error = -EINVAL;
 
                switch (arg) {
index 17463ca2e2292038027318222177979f83ee6bdb..1751c456b71ff6ee071f729a8375009e979faf7e 100644 (file)
@@ -1467,6 +1467,7 @@ EXPORT_SYMBOL_GPL(kmsg_dump_unregister);
 static const char const *kmsg_reasons[] = {
        [KMSG_DUMP_OOPS]        = "oops",
        [KMSG_DUMP_PANIC]       = "panic",
+       [KMSG_DUMP_KEXEC]       = "kexec",
 };
 
 static const char *kmsg_to_str(enum kmsg_dump_reason reason)
index 23bd09cd042ea9e6987763bb4261a331de24e4a7..42ad8ae729a0b9d594a9c28afb2a22cb9c20197d 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/pid_namespace.h>
 #include <linux/syscalls.h>
 #include <linux/uaccess.h>
+#include <linux/regset.h>
 
 
 /*
@@ -511,6 +512,47 @@ static int ptrace_resume(struct task_struct *child, long request, long data)
        return 0;
 }
 
+#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
+
+static const struct user_regset *
+find_regset(const struct user_regset_view *view, unsigned int type)
+{
+       const struct user_regset *regset;
+       int n;
+
+       for (n = 0; n < view->n; ++n) {
+               regset = view->regsets + n;
+               if (regset->core_note_type == type)
+                       return regset;
+       }
+
+       return NULL;
+}
+
+static int ptrace_regset(struct task_struct *task, int req, unsigned int type,
+                        struct iovec *kiov)
+{
+       const struct user_regset_view *view = task_user_regset_view(task);
+       const struct user_regset *regset = find_regset(view, type);
+       int regset_no;
+
+       if (!regset || (kiov->iov_len % regset->size) != 0)
+               return -EINVAL;
+
+       regset_no = regset - view->regsets;
+       kiov->iov_len = min(kiov->iov_len,
+                           (__kernel_size_t) (regset->n * regset->size));
+
+       if (req == PTRACE_GETREGSET)
+               return copy_regset_to_user(task, view, regset_no, 0,
+                                          kiov->iov_len, kiov->iov_base);
+       else
+               return copy_regset_from_user(task, view, regset_no, 0,
+                                            kiov->iov_len, kiov->iov_base);
+}
+
+#endif
+
 int ptrace_request(struct task_struct *child, long request,
                   long addr, long data)
 {
@@ -573,6 +615,26 @@ int ptrace_request(struct task_struct *child, long request,
                        return 0;
                return ptrace_resume(child, request, SIGKILL);
 
+#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
+       case PTRACE_GETREGSET:
+       case PTRACE_SETREGSET:
+       {
+               struct iovec kiov;
+               struct iovec __user *uiov = (struct iovec __user *) data;
+
+               if (!access_ok(VERIFY_WRITE, uiov, sizeof(*uiov)))
+                       return -EFAULT;
+
+               if (__get_user(kiov.iov_base, &uiov->iov_base) ||
+                   __get_user(kiov.iov_len, &uiov->iov_len))
+                       return -EFAULT;
+
+               ret = ptrace_regset(child, request, addr, &kiov);
+               if (!ret)
+                       ret = __put_user(kiov.iov_len, &uiov->iov_len);
+               break;
+       }
+#endif
        default:
                break;
        }
@@ -711,6 +773,32 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
                else
                        ret = ptrace_setsiginfo(child, &siginfo);
                break;
+#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
+       case PTRACE_GETREGSET:
+       case PTRACE_SETREGSET:
+       {
+               struct iovec kiov;
+               struct compat_iovec __user *uiov =
+                       (struct compat_iovec __user *) datap;
+               compat_uptr_t ptr;
+               compat_size_t len;
+
+               if (!access_ok(VERIFY_WRITE, uiov, sizeof(*uiov)))
+                       return -EFAULT;
+
+               if (__get_user(ptr, &uiov->iov_base) ||
+                   __get_user(len, &uiov->iov_len))
+                       return -EFAULT;
+
+               kiov.iov_base = compat_ptr(ptr);
+               kiov.iov_len = len;
+
+               ret = ptrace_regset(child, request, addr, &kiov);
+               if (!ret)
+                       ret = __put_user(kiov.iov_len, &uiov->iov_len);
+               break;
+       }
+#endif
 
        default:
                ret = ptrace_request(child, request, addr, data);
index 9b7fd4723878da6c3b5d2526cd0bc15550cce9a9..f1125c1a6321950030c42e8e5e2df2689d068a94 100644 (file)
 #include <linux/cpu.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
+#include <linux/kernel_stat.h>
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 static struct lock_class_key rcu_lock_key;
 struct lockdep_map rcu_lock_map =
        STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key);
 EXPORT_SYMBOL_GPL(rcu_lock_map);
+
+static struct lock_class_key rcu_bh_lock_key;
+struct lockdep_map rcu_bh_lock_map =
+       STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_bh", &rcu_bh_lock_key);
+EXPORT_SYMBOL_GPL(rcu_bh_lock_map);
+
+static struct lock_class_key rcu_sched_lock_key;
+struct lockdep_map rcu_sched_lock_map =
+       STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_sched", &rcu_sched_lock_key);
+EXPORT_SYMBOL_GPL(rcu_sched_lock_map);
 #endif
 
+int rcu_scheduler_active __read_mostly;
+EXPORT_SYMBOL_GPL(rcu_scheduler_active);
+
+/*
+ * This function is invoked towards the end of the scheduler's initialization
+ * process.  Before this is called, the idle task might contain
+ * RCU read-side critical sections (during which time, this idle
+ * task is booting the system).  After this function is called, the
+ * idle tasks are prohibited from containing RCU read-side critical
+ * sections.
+ */
+void rcu_scheduler_starting(void)
+{
+       WARN_ON(num_online_cpus() != 1);
+       WARN_ON(nr_context_switches() > 0);
+       rcu_scheduler_active = 1;
+}
+
 /*
  * Awaken the corresponding synchronize_rcu() instance now that a
  * grace period has elapsed.
index 9bb52177af02a3e20aa347e3b65c0a236caa1922..258cdf0a91eb78efcda53b91aaa845f7045066b7 100644 (file)
@@ -61,6 +61,9 @@ static int test_no_idle_hz;   /* Test RCU's support for tickless idle CPUs. */
 static int shuffle_interval = 3; /* Interval between shuffles (in sec)*/
 static int stutter = 5;                /* Start/stop testing interval (in sec) */
 static int irqreader = 1;      /* RCU readers from irq (timers). */
+static int fqs_duration = 0;   /* Duration of bursts (us), 0 to disable. */
+static int fqs_holdoff = 0;    /* Hold time within burst (us). */
+static int fqs_stutter = 3;    /* Wait time between bursts (s). */
 static char *torture_type = "rcu"; /* What RCU implementation to torture. */
 
 module_param(nreaders, int, 0444);
@@ -79,6 +82,12 @@ module_param(stutter, int, 0444);
 MODULE_PARM_DESC(stutter, "Number of seconds to run/halt test");
 module_param(irqreader, int, 0444);
 MODULE_PARM_DESC(irqreader, "Allow RCU readers from irq handlers");
+module_param(fqs_duration, int, 0444);
+MODULE_PARM_DESC(fqs_duration, "Duration of fqs bursts (us)");
+module_param(fqs_holdoff, int, 0444);
+MODULE_PARM_DESC(fqs_holdoff, "Holdoff time within fqs bursts (us)");
+module_param(fqs_stutter, int, 0444);
+MODULE_PARM_DESC(fqs_stutter, "Wait time between fqs bursts (s)");
 module_param(torture_type, charp, 0444);
 MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, srcu)");
 
@@ -99,6 +108,7 @@ static struct task_struct **reader_tasks;
 static struct task_struct *stats_task;
 static struct task_struct *shuffler_task;
 static struct task_struct *stutter_task;
+static struct task_struct *fqs_task;
 
 #define RCU_TORTURE_PIPE_LEN 10
 
@@ -263,6 +273,7 @@ struct rcu_torture_ops {
        void (*deferred_free)(struct rcu_torture *p);
        void (*sync)(void);
        void (*cb_barrier)(void);
+       void (*fqs)(void);
        int (*stats)(char *page);
        int irq_capable;
        char *name;
@@ -347,6 +358,7 @@ static struct rcu_torture_ops rcu_ops = {
        .deferred_free  = rcu_torture_deferred_free,
        .sync           = synchronize_rcu,
        .cb_barrier     = rcu_barrier,
+       .fqs            = rcu_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "rcu"
@@ -388,6 +400,7 @@ static struct rcu_torture_ops rcu_sync_ops = {
        .deferred_free  = rcu_sync_torture_deferred_free,
        .sync           = synchronize_rcu,
        .cb_barrier     = NULL,
+       .fqs            = rcu_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "rcu_sync"
@@ -403,6 +416,7 @@ static struct rcu_torture_ops rcu_expedited_ops = {
        .deferred_free  = rcu_sync_torture_deferred_free,
        .sync           = synchronize_rcu_expedited,
        .cb_barrier     = NULL,
+       .fqs            = rcu_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "rcu_expedited"
@@ -465,6 +479,7 @@ static struct rcu_torture_ops rcu_bh_ops = {
        .deferred_free  = rcu_bh_torture_deferred_free,
        .sync           = rcu_bh_torture_synchronize,
        .cb_barrier     = rcu_barrier_bh,
+       .fqs            = rcu_bh_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "rcu_bh"
@@ -480,6 +495,7 @@ static struct rcu_torture_ops rcu_bh_sync_ops = {
        .deferred_free  = rcu_sync_torture_deferred_free,
        .sync           = rcu_bh_torture_synchronize,
        .cb_barrier     = NULL,
+       .fqs            = rcu_bh_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "rcu_bh_sync"
@@ -621,6 +637,7 @@ static struct rcu_torture_ops sched_ops = {
        .deferred_free  = rcu_sched_torture_deferred_free,
        .sync           = sched_torture_synchronize,
        .cb_barrier     = rcu_barrier_sched,
+       .fqs            = rcu_sched_force_quiescent_state,
        .stats          = NULL,
        .irq_capable    = 1,
        .name           = "sched"
@@ -636,6 +653,7 @@ static struct rcu_torture_ops sched_sync_ops = {
        .deferred_free  = rcu_sync_torture_deferred_free,
        .sync           = sched_torture_synchronize,
        .cb_barrier     = NULL,
+       .fqs            = rcu_sched_force_quiescent_state,
        .stats          = NULL,
        .name           = "sched_sync"
 };
@@ -650,11 +668,44 @@ static struct rcu_torture_ops sched_expedited_ops = {
        .deferred_free  = rcu_sync_torture_deferred_free,
        .sync           = synchronize_sched_expedited,
        .cb_barrier     = NULL,
+       .fqs            = rcu_sched_force_quiescent_state,
        .stats          = rcu_expedited_torture_stats,
        .irq_capable    = 1,
        .name           = "sched_expedited"
 };
 
+/*
+ * RCU torture force-quiescent-state kthread.  Repeatedly induces
+ * bursts of calls to force_quiescent_state(), increasing the probability
+ * of occurrence of some important types of race conditions.
+ */
+static int
+rcu_torture_fqs(void *arg)
+{
+       unsigned long fqs_resume_time;
+       int fqs_burst_remaining;
+
+       VERBOSE_PRINTK_STRING("rcu_torture_fqs task started");
+       do {
+               fqs_resume_time = jiffies + fqs_stutter * HZ;
+               while (jiffies - fqs_resume_time > LONG_MAX) {
+                       schedule_timeout_interruptible(1);
+               }
+               fqs_burst_remaining = fqs_duration;
+               while (fqs_burst_remaining > 0) {
+                       cur_ops->fqs();
+                       udelay(fqs_holdoff);
+                       fqs_burst_remaining -= fqs_holdoff;
+               }
+               rcu_stutter_wait("rcu_torture_fqs");
+       } while (!kthread_should_stop() && fullstop == FULLSTOP_DONTSTOP);
+       VERBOSE_PRINTK_STRING("rcu_torture_fqs task stopping");
+       rcutorture_shutdown_absorb("rcu_torture_fqs");
+       while (!kthread_should_stop())
+               schedule_timeout_uninterruptible(1);
+       return 0;
+}
+
 /*
  * RCU torture writer kthread.  Repeatedly substitutes a new structure
  * for that pointed to by rcu_torture_current, freeing the old structure
@@ -745,7 +796,11 @@ static void rcu_torture_timer(unsigned long unused)
 
        idx = cur_ops->readlock();
        completed = cur_ops->completed();
-       p = rcu_dereference(rcu_torture_current);
+       p = rcu_dereference_check(rcu_torture_current,
+                                 rcu_read_lock_held() ||
+                                 rcu_read_lock_bh_held() ||
+                                 rcu_read_lock_sched_held() ||
+                                 srcu_read_lock_held(&srcu_ctl));
        if (p == NULL) {
                /* Leave because rcu_torture_writer is not yet underway */
                cur_ops->readunlock(idx);
@@ -798,11 +853,15 @@ rcu_torture_reader(void *arg)
        do {
                if (irqreader && cur_ops->irq_capable) {
                        if (!timer_pending(&t))
-                               mod_timer(&t, 1);
+                               mod_timer(&t, jiffies + 1);
                }
                idx = cur_ops->readlock();
                completed = cur_ops->completed();
-               p = rcu_dereference(rcu_torture_current);
+               p = rcu_dereference_check(rcu_torture_current,
+                                         rcu_read_lock_held() ||
+                                         rcu_read_lock_bh_held() ||
+                                         rcu_read_lock_sched_held() ||
+                                         srcu_read_lock_held(&srcu_ctl));
                if (p == NULL) {
                        /* Wait for rcu_torture_writer to get underway */
                        cur_ops->readunlock(idx);
@@ -1030,10 +1089,11 @@ rcu_torture_print_module_parms(char *tag)
        printk(KERN_ALERT "%s" TORTURE_FLAG
                "--- %s: nreaders=%d nfakewriters=%d "
                "stat_interval=%d verbose=%d test_no_idle_hz=%d "
-               "shuffle_interval=%d stutter=%d irqreader=%d\n",
+               "shuffle_interval=%d stutter=%d irqreader=%d "
+               "fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d\n",
                torture_type, tag, nrealreaders, nfakewriters,
                stat_interval, verbose, test_no_idle_hz, shuffle_interval,
-               stutter, irqreader);
+               stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter);
 }
 
 static struct notifier_block rcutorture_nb = {
@@ -1109,6 +1169,12 @@ rcu_torture_cleanup(void)
        }
        stats_task = NULL;
 
+       if (fqs_task) {
+               VERBOSE_PRINTK_STRING("Stopping rcu_torture_fqs task");
+               kthread_stop(fqs_task);
+       }
+       fqs_task = NULL;
+
        /* Wait for all RCU callbacks to fire.  */
 
        if (cur_ops->cb_barrier != NULL)
@@ -1154,6 +1220,11 @@ rcu_torture_init(void)
                mutex_unlock(&fullstop_mutex);
                return -EINVAL;
        }
+       if (cur_ops->fqs == NULL && fqs_duration != 0) {
+               printk(KERN_ALERT "rcu-torture: ->fqs NULL and non-zero "
+                                 "fqs_duration, fqs disabled.\n");
+               fqs_duration = 0;
+       }
        if (cur_ops->init)
                cur_ops->init(); /* no "goto unwind" prior to this point!!! */
 
@@ -1282,6 +1353,19 @@ rcu_torture_init(void)
                        goto unwind;
                }
        }
+       if (fqs_duration < 0)
+               fqs_duration = 0;
+       if (fqs_duration) {
+               /* Create the stutter thread */
+               fqs_task = kthread_run(rcu_torture_fqs, NULL,
+                                      "rcu_torture_fqs");
+               if (IS_ERR(fqs_task)) {
+                       firsterr = PTR_ERR(fqs_task);
+                       VERBOSE_PRINTK_ERRSTRING("Failed to create fqs");
+                       fqs_task = NULL;
+                       goto unwind;
+               }
+       }
        register_reboot_notifier(&rcutorture_nb);
        mutex_unlock(&fullstop_mutex);
        return 0;
index 53ae9598f798c61398578b39f6d5f4969601961f..3ec8160fc75ffa76121cb5d04c948b0f16f3e317 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/cpu.h>
 #include <linux/mutex.h>
 #include <linux/time.h>
-#include <linux/kernel_stat.h>
 
 #include "rcutree.h"
 
@@ -66,11 +65,11 @@ static struct lock_class_key rcu_node_class[NUM_RCU_LVLS];
        .signaled = RCU_GP_IDLE, \
        .gpnum = -300, \
        .completed = -300, \
-       .onofflock = __SPIN_LOCK_UNLOCKED(&name.onofflock), \
+       .onofflock = __RAW_SPIN_LOCK_UNLOCKED(&name.onofflock), \
        .orphan_cbs_list = NULL, \
        .orphan_cbs_tail = &name.orphan_cbs_list, \
        .orphan_qlen = 0, \
-       .fqslock = __SPIN_LOCK_UNLOCKED(&name.fqslock), \
+       .fqslock = __RAW_SPIN_LOCK_UNLOCKED(&name.fqslock), \
        .n_force_qs = 0, \
        .n_force_qs_ngp = 0, \
 }
@@ -81,9 +80,6 @@ DEFINE_PER_CPU(struct rcu_data, rcu_sched_data);
 struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
 DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
 
-static int rcu_scheduler_active __read_mostly;
-
-
 /*
  * Return true if an RCU grace period is in progress.  The ACCESS_ONCE()s
  * permit this function to be invoked without holding the root rcu_node
@@ -156,6 +152,24 @@ long rcu_batches_completed_bh(void)
 }
 EXPORT_SYMBOL_GPL(rcu_batches_completed_bh);
 
+/*
+ * Force a quiescent state for RCU BH.
+ */
+void rcu_bh_force_quiescent_state(void)
+{
+       force_quiescent_state(&rcu_bh_state, 0);
+}
+EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state);
+
+/*
+ * Force a quiescent state for RCU-sched.
+ */
+void rcu_sched_force_quiescent_state(void)
+{
+       force_quiescent_state(&rcu_sched_state, 0);
+}
+EXPORT_SYMBOL_GPL(rcu_sched_force_quiescent_state);
+
 /*
  * Does the CPU have callbacks ready to be invoked?
  */
@@ -439,10 +453,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 
        /* Only let one CPU complain about others per time interval. */
 
-       spin_lock_irqsave(&rnp->lock, flags);
+       raw_spin_lock_irqsave(&rnp->lock, flags);
        delta = jiffies - rsp->jiffies_stall;
        if (delta < RCU_STALL_RAT_DELAY || !rcu_gp_in_progress(rsp)) {
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                return;
        }
        rsp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
@@ -452,13 +466,15 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
         * due to CPU offlining.
         */
        rcu_print_task_stall(rnp);
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 
        /* OK, time to rat on our buddy... */
 
        printk(KERN_ERR "INFO: RCU detected CPU stalls:");
        rcu_for_each_leaf_node(rsp, rnp) {
+               raw_spin_lock_irqsave(&rnp->lock, flags);
                rcu_print_task_stall(rnp);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                if (rnp->qsmask == 0)
                        continue;
                for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++)
@@ -469,6 +485,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
               smp_processor_id(), (long)(jiffies - rsp->gp_start));
        trigger_all_cpu_backtrace();
 
+       /* If so configured, complain about tasks blocking the grace period. */
+
+       rcu_print_detail_task_stall(rsp);
+
        force_quiescent_state(rsp, 0);  /* Kick them all. */
 }
 
@@ -481,11 +501,11 @@ static void print_cpu_stall(struct rcu_state *rsp)
                        smp_processor_id(), jiffies - rsp->gp_start);
        trigger_all_cpu_backtrace();
 
-       spin_lock_irqsave(&rnp->lock, flags);
-       if ((long)(jiffies - rsp->jiffies_stall) >= 0)
+       raw_spin_lock_irqsave(&rnp->lock, flags);
+       if (ULONG_CMP_GE(jiffies, rsp->jiffies_stall))
                rsp->jiffies_stall =
                        jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 
        set_need_resched();  /* kick ourselves to get things going. */
 }
@@ -545,12 +565,12 @@ static void note_new_gpnum(struct rcu_state *rsp, struct rcu_data *rdp)
        local_irq_save(flags);
        rnp = rdp->mynode;
        if (rdp->gpnum == ACCESS_ONCE(rnp->gpnum) || /* outside lock. */
-           !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
+           !raw_spin_trylock(&rnp->lock)) { /* irqs already off, so later. */
                local_irq_restore(flags);
                return;
        }
        __note_new_gpnum(rsp, rnp, rdp);
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 }
 
 /*
@@ -609,12 +629,12 @@ rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp)
        local_irq_save(flags);
        rnp = rdp->mynode;
        if (rdp->completed == ACCESS_ONCE(rnp->completed) || /* outside lock. */
-           !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
+           !raw_spin_trylock(&rnp->lock)) { /* irqs already off, so later. */
                local_irq_restore(flags);
                return;
        }
        __rcu_process_gp_end(rsp, rnp, rdp);
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 }
 
 /*
@@ -659,12 +679,14 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
        struct rcu_data *rdp = rsp->rda[smp_processor_id()];
        struct rcu_node *rnp = rcu_get_root(rsp);
 
-       if (!cpu_needs_another_gp(rsp, rdp)) {
+       if (!cpu_needs_another_gp(rsp, rdp) || rsp->fqs_active) {
+               if (cpu_needs_another_gp(rsp, rdp))
+                       rsp->fqs_need_gp = 1;
                if (rnp->completed == rsp->completed) {
-                       spin_unlock_irqrestore(&rnp->lock, flags);
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
                        return;
                }
-               spin_unlock(&rnp->lock);         /* irqs remain disabled. */
+               raw_spin_unlock(&rnp->lock);     /* irqs remain disabled. */
 
                /*
                 * Propagate new ->completed value to rcu_node structures
@@ -672,9 +694,9 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
                 * of the next grace period to process their callbacks.
                 */
                rcu_for_each_node_breadth_first(rsp, rnp) {
-                       spin_lock(&rnp->lock);   /* irqs already disabled. */
+                       raw_spin_lock(&rnp->lock); /* irqs already disabled. */
                        rnp->completed = rsp->completed;
-                       spin_unlock(&rnp->lock); /* irqs remain disabled. */
+                       raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */
                }
                local_irq_restore(flags);
                return;
@@ -695,15 +717,15 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
                rnp->completed = rsp->completed;
                rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */
                rcu_start_gp_per_cpu(rsp, rnp, rdp);
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                return;
        }
 
-       spin_unlock(&rnp->lock);  /* leave irqs disabled. */
+       raw_spin_unlock(&rnp->lock);  /* leave irqs disabled. */
 
 
        /* Exclude any concurrent CPU-hotplug operations. */
-       spin_lock(&rsp->onofflock);  /* irqs already disabled. */
+       raw_spin_lock(&rsp->onofflock);  /* irqs already disabled. */
 
        /*
         * Set the quiescent-state-needed bits in all the rcu_node
@@ -723,21 +745,21 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
         * irqs disabled.
         */
        rcu_for_each_node_breadth_first(rsp, rnp) {
-               spin_lock(&rnp->lock);          /* irqs already disabled. */
+               raw_spin_lock(&rnp->lock);      /* irqs already disabled. */
                rcu_preempt_check_blocked_tasks(rnp);
                rnp->qsmask = rnp->qsmaskinit;
                rnp->gpnum = rsp->gpnum;
                rnp->completed = rsp->completed;
                if (rnp == rdp->mynode)
                        rcu_start_gp_per_cpu(rsp, rnp, rdp);
-               spin_unlock(&rnp->lock);        /* irqs remain disabled. */
+               raw_spin_unlock(&rnp->lock);    /* irqs remain disabled. */
        }
 
        rnp = rcu_get_root(rsp);
-       spin_lock(&rnp->lock);                  /* irqs already disabled. */
+       raw_spin_lock(&rnp->lock);              /* irqs already disabled. */
        rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state now OK. */
-       spin_unlock(&rnp->lock);                /* irqs remain disabled. */
-       spin_unlock_irqrestore(&rsp->onofflock, flags);
+       raw_spin_unlock(&rnp->lock);            /* irqs remain disabled. */
+       raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
 }
 
 /*
@@ -776,14 +798,14 @@ rcu_report_qs_rnp(unsigned long mask, struct rcu_state *rsp,
                if (!(rnp->qsmask & mask)) {
 
                        /* Our bit has already been cleared, so done. */
-                       spin_unlock_irqrestore(&rnp->lock, flags);
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
                        return;
                }
                rnp->qsmask &= ~mask;
                if (rnp->qsmask != 0 || rcu_preempted_readers(rnp)) {
 
                        /* Other bits still set at this level, so done. */
-                       spin_unlock_irqrestore(&rnp->lock, flags);
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
                        return;
                }
                mask = rnp->grpmask;
@@ -793,10 +815,10 @@ rcu_report_qs_rnp(unsigned long mask, struct rcu_state *rsp,
 
                        break;
                }
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                rnp_c = rnp;
                rnp = rnp->parent;
-               spin_lock_irqsave(&rnp->lock, flags);
+               raw_spin_lock_irqsave(&rnp->lock, flags);
                WARN_ON_ONCE(rnp_c->qsmask);
        }
 
@@ -825,7 +847,7 @@ rcu_report_qs_rdp(int cpu, struct rcu_state *rsp, struct rcu_data *rdp, long las
        struct rcu_node *rnp;
 
        rnp = rdp->mynode;
-       spin_lock_irqsave(&rnp->lock, flags);
+       raw_spin_lock_irqsave(&rnp->lock, flags);
        if (lastcomp != rnp->completed) {
 
                /*
@@ -837,12 +859,12 @@ rcu_report_qs_rdp(int cpu, struct rcu_state *rsp, struct rcu_data *rdp, long las
                 * race occurred.
                 */
                rdp->passed_quiesc = 0; /* try again later! */
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                return;
        }
        mask = rdp->grpmask;
        if ((rnp->qsmask & mask) == 0) {
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
        } else {
                rdp->qs_pending = 0;
 
@@ -906,7 +928,7 @@ static void rcu_send_cbs_to_orphanage(struct rcu_state *rsp)
 
        if (rdp->nxtlist == NULL)
                return;  /* irqs disabled, so comparison is stable. */
-       spin_lock(&rsp->onofflock);  /* irqs already disabled. */
+       raw_spin_lock(&rsp->onofflock);  /* irqs already disabled. */
        *rsp->orphan_cbs_tail = rdp->nxtlist;
        rsp->orphan_cbs_tail = rdp->nxttail[RCU_NEXT_TAIL];
        rdp->nxtlist = NULL;
@@ -914,7 +936,7 @@ static void rcu_send_cbs_to_orphanage(struct rcu_state *rsp)
                rdp->nxttail[i] = &rdp->nxtlist;
        rsp->orphan_qlen += rdp->qlen;
        rdp->qlen = 0;
-       spin_unlock(&rsp->onofflock);  /* irqs remain disabled. */
+       raw_spin_unlock(&rsp->onofflock);  /* irqs remain disabled. */
 }
 
 /*
@@ -925,10 +947,10 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp)
        unsigned long flags;
        struct rcu_data *rdp;
 
-       spin_lock_irqsave(&rsp->onofflock, flags);
+       raw_spin_lock_irqsave(&rsp->onofflock, flags);
        rdp = rsp->rda[smp_processor_id()];
        if (rsp->orphan_cbs_list == NULL) {
-               spin_unlock_irqrestore(&rsp->onofflock, flags);
+               raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
                return;
        }
        *rdp->nxttail[RCU_NEXT_TAIL] = rsp->orphan_cbs_list;
@@ -937,7 +959,7 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp)
        rsp->orphan_cbs_list = NULL;
        rsp->orphan_cbs_tail = &rsp->orphan_cbs_list;
        rsp->orphan_qlen = 0;
-       spin_unlock_irqrestore(&rsp->onofflock, flags);
+       raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
 }
 
 /*
@@ -953,23 +975,23 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp)
        struct rcu_node *rnp;
 
        /* Exclude any attempts to start a new grace period. */
-       spin_lock_irqsave(&rsp->onofflock, flags);
+       raw_spin_lock_irqsave(&rsp->onofflock, flags);
 
        /* Remove the outgoing CPU from the masks in the rcu_node hierarchy. */
        rnp = rdp->mynode;      /* this is the outgoing CPU's rnp. */
        mask = rdp->grpmask;    /* rnp->grplo is constant. */
        do {
-               spin_lock(&rnp->lock);          /* irqs already disabled. */
+               raw_spin_lock(&rnp->lock);      /* irqs already disabled. */
                rnp->qsmaskinit &= ~mask;
                if (rnp->qsmaskinit != 0) {
                        if (rnp != rdp->mynode)
-                               spin_unlock(&rnp->lock); /* irqs remain disabled. */
+                               raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */
                        break;
                }
                if (rnp == rdp->mynode)
                        need_report = rcu_preempt_offline_tasks(rsp, rnp, rdp);
                else
-                       spin_unlock(&rnp->lock); /* irqs remain disabled. */
+                       raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */
                mask = rnp->grpmask;
                rnp = rnp->parent;
        } while (rnp != NULL);
@@ -980,12 +1002,12 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp)
         * because invoking rcu_report_unblock_qs_rnp() with ->onofflock
         * held leads to deadlock.
         */
-       spin_unlock(&rsp->onofflock); /* irqs remain disabled. */
+       raw_spin_unlock(&rsp->onofflock); /* irqs remain disabled. */
        rnp = rdp->mynode;
        if (need_report & RCU_OFL_TASKS_NORM_GP)
                rcu_report_unblock_qs_rnp(rnp, flags);
        else
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
        if (need_report & RCU_OFL_TASKS_EXP_GP)
                rcu_report_exp_rnp(rsp, rnp);
 
@@ -1144,11 +1166,9 @@ void rcu_check_callbacks(int cpu, int user)
 /*
  * Scan the leaf rcu_node structures, processing dyntick state for any that
  * have not yet encountered a quiescent state, using the function specified.
- * Returns 1 if the current grace period ends while scanning (possibly
- * because we made it end).
+ * The caller must have suppressed start of new grace periods.
  */
-static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp,
-                              int (*f)(struct rcu_data *))
+static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *))
 {
        unsigned long bit;
        int cpu;
@@ -1158,13 +1178,13 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp,
 
        rcu_for_each_leaf_node(rsp, rnp) {
                mask = 0;
-               spin_lock_irqsave(&rnp->lock, flags);
-               if (rnp->completed != lastcomp) {
-                       spin_unlock_irqrestore(&rnp->lock, flags);
-                       return 1;
+               raw_spin_lock_irqsave(&rnp->lock, flags);
+               if (!rcu_gp_in_progress(rsp)) {
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
+                       return;
                }
                if (rnp->qsmask == 0) {
-                       spin_unlock_irqrestore(&rnp->lock, flags);
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
                        continue;
                }
                cpu = rnp->grplo;
@@ -1173,15 +1193,14 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp,
                        if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu]))
                                mask |= bit;
                }
-               if (mask != 0 && rnp->completed == lastcomp) {
+               if (mask != 0) {
 
                        /* rcu_report_qs_rnp() releases rnp->lock. */
                        rcu_report_qs_rnp(mask, rsp, rnp, flags);
                        continue;
                }
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
        }
-       return 0;
 }
 
 /*
@@ -1191,32 +1210,26 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp,
 static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 {
        unsigned long flags;
-       long lastcomp;
        struct rcu_node *rnp = rcu_get_root(rsp);
-       u8 signaled;
-       u8 forcenow;
 
        if (!rcu_gp_in_progress(rsp))
                return;  /* No grace period in progress, nothing to force. */
-       if (!spin_trylock_irqsave(&rsp->fqslock, flags)) {
+       if (!raw_spin_trylock_irqsave(&rsp->fqslock, flags)) {
                rsp->n_force_qs_lh++; /* Inexact, can lose counts.  Tough! */
                return; /* Someone else is already on the job. */
        }
-       if (relaxed &&
-           (long)(rsp->jiffies_force_qs - jiffies) >= 0)
-               goto unlock_ret; /* no emergency and done recently. */
+       if (relaxed && ULONG_CMP_GE(rsp->jiffies_force_qs, jiffies))
+               goto unlock_fqs_ret; /* no emergency and done recently. */
        rsp->n_force_qs++;
-       spin_lock(&rnp->lock);
-       lastcomp = rsp->gpnum - 1;
-       signaled = rsp->signaled;
+       raw_spin_lock(&rnp->lock);  /* irqs already disabled */
        rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS;
        if(!rcu_gp_in_progress(rsp)) {
                rsp->n_force_qs_ngp++;
-               spin_unlock(&rnp->lock);
-               goto unlock_ret;  /* no GP in progress, time updated. */
+               raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
+               goto unlock_fqs_ret;  /* no GP in progress, time updated. */
        }
-       spin_unlock(&rnp->lock);
-       switch (signaled) {
+       rsp->fqs_active = 1;
+       switch (rsp->signaled) {
        case RCU_GP_IDLE:
        case RCU_GP_INIT:
 
@@ -1224,45 +1237,38 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 
        case RCU_SAVE_DYNTICK:
 
+               raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
                if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
                        break; /* So gcc recognizes the dead code. */
 
                /* Record dyntick-idle state. */
-               if (rcu_process_dyntick(rsp, lastcomp,
-                                       dyntick_save_progress_counter))
-                       goto unlock_ret;
-               /* fall into next case. */
-
-       case RCU_SAVE_COMPLETED:
-
-               /* Update state, record completion counter. */
-               forcenow = 0;
-               spin_lock(&rnp->lock);
-               if (lastcomp + 1 == rsp->gpnum &&
-                   lastcomp == rsp->completed &&
-                   rsp->signaled == signaled) {
+               force_qs_rnp(rsp, dyntick_save_progress_counter);
+               raw_spin_lock(&rnp->lock);  /* irqs already disabled */
+               if (rcu_gp_in_progress(rsp))
                        rsp->signaled = RCU_FORCE_QS;
-                       rsp->completed_fqs = lastcomp;
-                       forcenow = signaled == RCU_SAVE_COMPLETED;
-               }
-               spin_unlock(&rnp->lock);
-               if (!forcenow)
-                       break;
-               /* fall into next case. */
+               break;
 
        case RCU_FORCE_QS:
 
                /* Check dyntick-idle state, send IPI to laggarts. */
-               if (rcu_process_dyntick(rsp, rsp->completed_fqs,
-                                       rcu_implicit_dynticks_qs))
-                       goto unlock_ret;
+               raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
+               force_qs_rnp(rsp, rcu_implicit_dynticks_qs);
 
                /* Leave state in case more forcing is required. */
 
+               raw_spin_lock(&rnp->lock);  /* irqs already disabled */
                break;
        }
-unlock_ret:
-       spin_unlock_irqrestore(&rsp->fqslock, flags);
+       rsp->fqs_active = 0;
+       if (rsp->fqs_need_gp) {
+               raw_spin_unlock(&rsp->fqslock); /* irqs remain disabled */
+               rsp->fqs_need_gp = 0;
+               rcu_start_gp(rsp, flags); /* releases rnp->lock */
+               return;
+       }
+       raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
+unlock_fqs_ret:
+       raw_spin_unlock_irqrestore(&rsp->fqslock, flags);
 }
 
 #else /* #ifdef CONFIG_SMP */
@@ -1290,7 +1296,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
         * If an RCU GP has gone long enough, go check for dyntick
         * idle CPUs and, if needed, send resched IPIs.
         */
-       if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0)
+       if (ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies))
                force_quiescent_state(rsp, 1);
 
        /*
@@ -1304,7 +1310,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 
        /* Does this CPU require a not-yet-started grace period? */
        if (cpu_needs_another_gp(rsp, rdp)) {
-               spin_lock_irqsave(&rcu_get_root(rsp)->lock, flags);
+               raw_spin_lock_irqsave(&rcu_get_root(rsp)->lock, flags);
                rcu_start_gp(rsp, flags);  /* releases above lock */
        }
 
@@ -1335,6 +1341,9 @@ static void rcu_process_callbacks(struct softirq_action *unused)
         * grace-period manipulations above.
         */
        smp_mb(); /* See above block comment. */
+
+       /* If we are last CPU on way to dyntick-idle mode, accelerate it. */
+       rcu_needs_cpu_flush();
 }
 
 static void
@@ -1369,7 +1378,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
                unsigned long nestflag;
                struct rcu_node *rnp_root = rcu_get_root(rsp);
 
-               spin_lock_irqsave(&rnp_root->lock, nestflag);
+               raw_spin_lock_irqsave(&rnp_root->lock, nestflag);
                rcu_start_gp(rsp, nestflag);  /* releases rnp_root->lock. */
        }
 
@@ -1387,7 +1396,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
                        force_quiescent_state(rsp, 0);
                rdp->n_force_qs_snap = rsp->n_force_qs;
                rdp->qlen_last_fqs_check = rdp->qlen;
-       } else if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0)
+       } else if (ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies))
                force_quiescent_state(rsp, 1);
        local_irq_restore(flags);
 }
@@ -1520,7 +1529,7 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
 
        /* Has an RCU GP gone long enough to send resched IPIs &c? */
        if (rcu_gp_in_progress(rsp) &&
-           ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0)) {
+           ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies)) {
                rdp->n_rp_need_fqs++;
                return 1;
        }
@@ -1545,10 +1554,9 @@ static int rcu_pending(int cpu)
 /*
  * Check to see if any future RCU-related work will need to be done
  * by the current CPU, even if none need be done immediately, returning
- * 1 if so.  This function is part of the RCU implementation; it is -not-
- * an exported member of the RCU API.
+ * 1 if so.
  */
-int rcu_needs_cpu(int cpu)
+static int rcu_needs_cpu_quick_check(int cpu)
 {
        /* RCU callbacks either ready or pending? */
        return per_cpu(rcu_sched_data, cpu).nxtlist ||
@@ -1556,21 +1564,6 @@ int rcu_needs_cpu(int cpu)
               rcu_preempt_needs_cpu(cpu);
 }
 
-/*
- * This function is invoked towards the end of the scheduler's initialization
- * process.  Before this is called, the idle task might contain
- * RCU read-side critical sections (during which time, this idle
- * task is booting the system).  After this function is called, the
- * idle tasks are prohibited from containing RCU read-side critical
- * sections.
- */
-void rcu_scheduler_starting(void)
-{
-       WARN_ON(num_online_cpus() != 1);
-       WARN_ON(nr_context_switches() > 0);
-       rcu_scheduler_active = 1;
-}
-
 static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL};
 static atomic_t rcu_barrier_cpu_count;
 static DEFINE_MUTEX(rcu_barrier_mutex);
@@ -1659,7 +1652,7 @@ rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp)
        struct rcu_node *rnp = rcu_get_root(rsp);
 
        /* Set up local state, ensuring consistent view of global state. */
-       spin_lock_irqsave(&rnp->lock, flags);
+       raw_spin_lock_irqsave(&rnp->lock, flags);
        rdp->grpmask = 1UL << (cpu - rdp->mynode->grplo);
        rdp->nxtlist = NULL;
        for (i = 0; i < RCU_NEXT_SIZE; i++)
@@ -1669,7 +1662,7 @@ rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp)
        rdp->dynticks = &per_cpu(rcu_dynticks, cpu);
 #endif /* #ifdef CONFIG_NO_HZ */
        rdp->cpu = cpu;
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 }
 
 /*
@@ -1687,7 +1680,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
        struct rcu_node *rnp = rcu_get_root(rsp);
 
        /* Set up local state, ensuring consistent view of global state. */
-       spin_lock_irqsave(&rnp->lock, flags);
+       raw_spin_lock_irqsave(&rnp->lock, flags);
        rdp->passed_quiesc = 0;  /* We could be racing with new GP, */
        rdp->qs_pending = 1;     /*  so set up to respond to current GP. */
        rdp->beenonline = 1;     /* We have now been online. */
@@ -1695,7 +1688,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
        rdp->qlen_last_fqs_check = 0;
        rdp->n_force_qs_snap = rsp->n_force_qs;
        rdp->blimit = blimit;
-       spin_unlock(&rnp->lock);                /* irqs remain disabled. */
+       raw_spin_unlock(&rnp->lock);            /* irqs remain disabled. */
 
        /*
         * A new grace period might start here.  If so, we won't be part
@@ -1703,14 +1696,14 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
         */
 
        /* Exclude any attempts to start a new GP on large systems. */
-       spin_lock(&rsp->onofflock);             /* irqs already disabled. */
+       raw_spin_lock(&rsp->onofflock);         /* irqs already disabled. */
 
        /* Add CPU to rcu_node bitmasks. */
        rnp = rdp->mynode;
        mask = rdp->grpmask;
        do {
                /* Exclude any attempts to start a new GP on small systems. */
-               spin_lock(&rnp->lock);  /* irqs already disabled. */
+               raw_spin_lock(&rnp->lock);      /* irqs already disabled. */
                rnp->qsmaskinit |= mask;
                mask = rnp->grpmask;
                if (rnp == rdp->mynode) {
@@ -1718,11 +1711,11 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
                        rdp->completed = rnp->completed;
                        rdp->passed_quiesc_completed = rnp->completed - 1;
                }
-               spin_unlock(&rnp->lock); /* irqs already disabled. */
+               raw_spin_unlock(&rnp->lock); /* irqs already disabled. */
                rnp = rnp->parent;
        } while (rnp != NULL && !(rnp->qsmaskinit & mask));
 
-       spin_unlock_irqrestore(&rsp->onofflock, flags);
+       raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
 }
 
 static void __cpuinit rcu_online_cpu(int cpu)
@@ -1806,11 +1799,17 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp)
  */
 static void __init rcu_init_one(struct rcu_state *rsp)
 {
+       static char *buf[] = { "rcu_node_level_0",
+                              "rcu_node_level_1",
+                              "rcu_node_level_2",
+                              "rcu_node_level_3" };  /* Match MAX_RCU_LVLS */
        int cpustride = 1;
        int i;
        int j;
        struct rcu_node *rnp;
 
+       BUILD_BUG_ON(MAX_RCU_LVLS > ARRAY_SIZE(buf));  /* Fix buf[] init! */
+
        /* Initialize the level-tracking arrays. */
 
        for (i = 1; i < NUM_RCU_LVLS; i++)
@@ -1823,8 +1822,9 @@ static void __init rcu_init_one(struct rcu_state *rsp)
                cpustride *= rsp->levelspread[i];
                rnp = rsp->level[i];
                for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) {
-                       spin_lock_init(&rnp->lock);
-                       lockdep_set_class(&rnp->lock, &rcu_node_class[i]);
+                       raw_spin_lock_init(&rnp->lock);
+                       lockdep_set_class_and_name(&rnp->lock,
+                                                  &rcu_node_class[i], buf[i]);
                        rnp->gpnum = 0;
                        rnp->qsmask = 0;
                        rnp->qsmaskinit = 0;
@@ -1876,7 +1876,7 @@ do { \
 
 void __init rcu_init(void)
 {
-       int i;
+       int cpu;
 
        rcu_bootup_announce();
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
@@ -1896,8 +1896,8 @@ void __init rcu_init(void)
         * or the scheduler are operational.
         */
        cpu_notifier(rcu_cpu_notify, 0);
-       for_each_online_cpu(i)
-               rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)i);
+       for_each_online_cpu(cpu)
+               rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
 }
 
 #include "rcutree_plugin.h"
index d2a0046f63b297b41e4605b25ae178ee57883367..1439eb504c22475b59e17bc4da21831bb9f7b8ca 100644 (file)
@@ -90,12 +90,12 @@ struct rcu_dynticks {
  * Definition for node within the RCU grace-period-detection hierarchy.
  */
 struct rcu_node {
-       spinlock_t lock;        /* Root rcu_node's lock protects some */
+       raw_spinlock_t lock;    /* Root rcu_node's lock protects some */
                                /*  rcu_state fields as well as following. */
-       long    gpnum;          /* Current grace period for this node. */
+       unsigned long gpnum;    /* Current grace period for this node. */
                                /*  This will either be equal to or one */
                                /*  behind the root rcu_node's gpnum. */
-       long    completed;      /* Last grace period completed for this node. */
+       unsigned long completed; /* Last GP completed for this node. */
                                /*  This will either be equal to or one */
                                /*  behind the root rcu_node's gpnum. */
        unsigned long qsmask;   /* CPUs or groups that need to switch in */
@@ -161,11 +161,11 @@ struct rcu_node {
 /* Per-CPU data for read-copy update. */
 struct rcu_data {
        /* 1) quiescent-state and grace-period handling : */
-       long            completed;      /* Track rsp->completed gp number */
+       unsigned long   completed;      /* Track rsp->completed gp number */
                                        /*  in order to detect GP end. */
-       long            gpnum;          /* Highest gp number that this CPU */
+       unsigned long   gpnum;          /* Highest gp number that this CPU */
                                        /*  is aware of having started. */
-       long            passed_quiesc_completed;
+       unsigned long   passed_quiesc_completed;
                                        /* Value of completed at time of qs. */
        bool            passed_quiesc;  /* User-mode/idle loop etc. */
        bool            qs_pending;     /* Core waits for quiesc state. */
@@ -221,14 +221,14 @@ struct rcu_data {
        unsigned long resched_ipi;      /* Sent a resched IPI. */
 
        /* 5) __rcu_pending() statistics. */
-       long n_rcu_pending;             /* rcu_pending() calls since boot. */
-       long n_rp_qs_pending;
-       long n_rp_cb_ready;
-       long n_rp_cpu_needs_gp;
-       long n_rp_gp_completed;
-       long n_rp_gp_started;
-       long n_rp_need_fqs;
-       long n_rp_need_nothing;
+       unsigned long n_rcu_pending;    /* rcu_pending() calls since boot. */
+       unsigned long n_rp_qs_pending;
+       unsigned long n_rp_cb_ready;
+       unsigned long n_rp_cpu_needs_gp;
+       unsigned long n_rp_gp_completed;
+       unsigned long n_rp_gp_started;
+       unsigned long n_rp_need_fqs;
+       unsigned long n_rp_need_nothing;
 
        int cpu;
 };
@@ -237,12 +237,11 @@ struct rcu_data {
 #define RCU_GP_IDLE            0       /* No grace period in progress. */
 #define RCU_GP_INIT            1       /* Grace period being initialized. */
 #define RCU_SAVE_DYNTICK       2       /* Need to scan dyntick state. */
-#define RCU_SAVE_COMPLETED     3       /* Need to save rsp->completed. */
-#define RCU_FORCE_QS           4       /* Need to force quiescent state. */
+#define RCU_FORCE_QS           3       /* Need to force quiescent state. */
 #ifdef CONFIG_NO_HZ
 #define RCU_SIGNAL_INIT                RCU_SAVE_DYNTICK
 #else /* #ifdef CONFIG_NO_HZ */
-#define RCU_SIGNAL_INIT                RCU_SAVE_COMPLETED
+#define RCU_SIGNAL_INIT                RCU_FORCE_QS
 #endif /* #else #ifdef CONFIG_NO_HZ */
 
 #define RCU_JIFFIES_TILL_FORCE_QS       3      /* for rsp->jiffies_force_qs */
@@ -256,6 +255,9 @@ struct rcu_data {
 
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 
+#define ULONG_CMP_GE(a, b)     (ULONG_MAX / 2 >= (a) - (b))
+#define ULONG_CMP_LT(a, b)     (ULONG_MAX / 2 < (a) - (b))
+
 /*
  * RCU global state, including node hierarchy.  This hierarchy is
  * represented in "heap" form in a dense array.  The root (first level)
@@ -277,12 +279,19 @@ struct rcu_state {
 
        u8      signaled ____cacheline_internodealigned_in_smp;
                                                /* Force QS state. */
-       long    gpnum;                          /* Current gp number. */
-       long    completed;                      /* # of last completed gp. */
+       u8      fqs_active;                     /* force_quiescent_state() */
+                                               /*  is running. */
+       u8      fqs_need_gp;                    /* A CPU was prevented from */
+                                               /*  starting a new grace */
+                                               /*  period because */
+                                               /*  force_quiescent_state() */
+                                               /*  was running. */
+       unsigned long gpnum;                    /* Current gp number. */
+       unsigned long completed;                /* # of last completed gp. */
 
        /* End of fields guarded by root rcu_node's lock. */
 
-       spinlock_t onofflock;                   /* exclude on/offline and */
+       raw_spinlock_t onofflock;               /* exclude on/offline and */
                                                /*  starting new GP.  Also */
                                                /*  protects the following */
                                                /*  orphan_cbs fields. */
@@ -292,10 +301,8 @@ struct rcu_state {
                                                /*  going offline. */
        struct rcu_head **orphan_cbs_tail;      /* And tail pointer. */
        long orphan_qlen;                       /* Number of orphaned cbs. */
-       spinlock_t fqslock;                     /* Only one task forcing */
+       raw_spinlock_t fqslock;                 /* Only one task forcing */
                                                /*  quiescent states. */
-       long    completed_fqs;                  /* Value of completed @ snap. */
-                                               /*  Protected by fqslock. */
        unsigned long jiffies_force_qs;         /* Time at which to invoke */
                                                /*  force_quiescent_state(). */
        unsigned long n_force_qs;               /* Number of calls to */
@@ -319,8 +326,6 @@ struct rcu_state {
 #define RCU_OFL_TASKS_EXP_GP   0x2             /* Tasks blocking expedited */
                                                /*  GP were moved to root. */
 
-#ifdef RCU_TREE_NONCORE
-
 /*
  * RCU implementation internal declarations:
  */
@@ -335,7 +340,7 @@ extern struct rcu_state rcu_preempt_state;
 DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data);
 #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
 
-#else /* #ifdef RCU_TREE_NONCORE */
+#ifndef RCU_TREE_NONCORE
 
 /* Forward declarations for rcutree_plugin.h */
 static void rcu_bootup_announce(void);
@@ -347,6 +352,7 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp,
                                      unsigned long flags);
 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
+static void rcu_print_detail_task_stall(struct rcu_state *rsp);
 static void rcu_print_task_stall(struct rcu_node *rnp);
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
@@ -367,5 +373,6 @@ static int rcu_preempt_needs_cpu(int cpu);
 static void __cpuinit rcu_preempt_init_percpu_data(int cpu);
 static void rcu_preempt_send_cbs_to_orphanage(void);
 static void __init __rcu_init_preempt(void);
+static void rcu_needs_cpu_flush(void);
 
-#endif /* #else #ifdef RCU_TREE_NONCORE */
+#endif /* #ifndef RCU_TREE_NONCORE */
index 37fbccdf41d58d4dda85cc1788d972b6602d79b2..464ad2cdee00a22bfbfe258853770f3bb60e3f5d 100644 (file)
@@ -61,6 +61,15 @@ long rcu_batches_completed(void)
 }
 EXPORT_SYMBOL_GPL(rcu_batches_completed);
 
+/*
+ * Force a quiescent state for preemptible RCU.
+ */
+void rcu_force_quiescent_state(void)
+{
+       force_quiescent_state(&rcu_preempt_state, 0);
+}
+EXPORT_SYMBOL_GPL(rcu_force_quiescent_state);
+
 /*
  * Record a preemptable-RCU quiescent state for the specified CPU.  Note
  * that this just means that the task currently running on the CPU is
@@ -102,7 +111,7 @@ static void rcu_preempt_note_context_switch(int cpu)
                /* Possibly blocking in an RCU read-side critical section. */
                rdp = rcu_preempt_state.rda[cpu];
                rnp = rdp->mynode;
-               spin_lock_irqsave(&rnp->lock, flags);
+               raw_spin_lock_irqsave(&rnp->lock, flags);
                t->rcu_read_unlock_special |= RCU_READ_UNLOCK_BLOCKED;
                t->rcu_blocked_node = rnp;
 
@@ -123,7 +132,7 @@ static void rcu_preempt_note_context_switch(int cpu)
                WARN_ON_ONCE(!list_empty(&t->rcu_node_entry));
                phase = (rnp->gpnum + !(rnp->qsmask & rdp->grpmask)) & 0x1;
                list_add(&t->rcu_node_entry, &rnp->blocked_tasks[phase]);
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
        }
 
        /*
@@ -180,7 +189,7 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
        struct rcu_node *rnp_p;
 
        if (rnp->qsmask != 0 || rcu_preempted_readers(rnp)) {
-               spin_unlock_irqrestore(&rnp->lock, flags);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
                return;  /* Still need more quiescent states! */
        }
 
@@ -197,8 +206,8 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
 
        /* Report up the rest of the hierarchy. */
        mask = rnp->grpmask;
-       spin_unlock(&rnp->lock);        /* irqs remain disabled. */
-       spin_lock(&rnp_p->lock);        /* irqs already disabled. */
+       raw_spin_unlock(&rnp->lock);    /* irqs remain disabled. */
+       raw_spin_lock(&rnp_p->lock);    /* irqs already disabled. */
        rcu_report_qs_rnp(mask, &rcu_preempt_state, rnp_p, flags);
 }
 
@@ -248,10 +257,10 @@ static void rcu_read_unlock_special(struct task_struct *t)
                 */
                for (;;) {
                        rnp = t->rcu_blocked_node;
-                       spin_lock(&rnp->lock);  /* irqs already disabled. */
+                       raw_spin_lock(&rnp->lock);  /* irqs already disabled. */
                        if (rnp == t->rcu_blocked_node)
                                break;
-                       spin_unlock(&rnp->lock);  /* irqs remain disabled. */
+                       raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */
                }
                empty = !rcu_preempted_readers(rnp);
                empty_exp = !rcu_preempted_readers_exp(rnp);
@@ -265,7 +274,7 @@ static void rcu_read_unlock_special(struct task_struct *t)
                 * Note that rcu_report_unblock_qs_rnp() releases rnp->lock.
                 */
                if (empty)
-                       spin_unlock_irqrestore(&rnp->lock, flags);
+                       raw_spin_unlock_irqrestore(&rnp->lock, flags);
                else
                        rcu_report_unblock_qs_rnp(rnp, flags);
 
@@ -295,29 +304,73 @@ void __rcu_read_unlock(void)
        if (--ACCESS_ONCE(t->rcu_read_lock_nesting) == 0 &&
            unlikely(ACCESS_ONCE(t->rcu_read_unlock_special)))
                rcu_read_unlock_special(t);
+#ifdef CONFIG_PROVE_LOCKING
+       WARN_ON_ONCE(ACCESS_ONCE(t->rcu_read_lock_nesting) < 0);
+#endif /* #ifdef CONFIG_PROVE_LOCKING */
 }
 EXPORT_SYMBOL_GPL(__rcu_read_unlock);
 
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
 
+#ifdef CONFIG_RCU_CPU_STALL_VERBOSE
+
+/*
+ * Dump detailed information for all tasks blocking the current RCU
+ * grace period on the specified rcu_node structure.
+ */
+static void rcu_print_detail_task_stall_rnp(struct rcu_node *rnp)
+{
+       unsigned long flags;
+       struct list_head *lp;
+       int phase;
+       struct task_struct *t;
+
+       if (rcu_preempted_readers(rnp)) {
+               raw_spin_lock_irqsave(&rnp->lock, flags);
+               phase = rnp->gpnum & 0x1;
+               lp = &rnp->blocked_tasks[phase];
+               list_for_each_entry(t, lp, rcu_node_entry)
+                       sched_show_task(t);
+               raw_spin_unlock_irqrestore(&rnp->lock, flags);
+       }
+}
+
+/*
+ * Dump detailed information for all tasks blocking the current RCU
+ * grace period.
+ */
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+       struct rcu_node *rnp = rcu_get_root(rsp);
+
+       rcu_print_detail_task_stall_rnp(rnp);
+       rcu_for_each_leaf_node(rsp, rnp)
+               rcu_print_detail_task_stall_rnp(rnp);
+}
+
+#else /* #ifdef CONFIG_RCU_CPU_STALL_VERBOSE */
+
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+}
+
+#endif /* #else #ifdef CONFIG_RCU_CPU_STALL_VERBOSE */
+
 /*
  * Scan the current list of tasks blocked within RCU read-side critical
  * sections, printing out the tid of each.
  */
 static void rcu_print_task_stall(struct rcu_node *rnp)
 {
-       unsigned long flags;
        struct list_head *lp;
        int phase;
        struct task_struct *t;
 
        if (rcu_preempted_readers(rnp)) {
-               spin_lock_irqsave(&rnp->lock, flags);
                phase = rnp->gpnum & 0x1;
                lp = &rnp->blocked_tasks[phase];
                list_for_each_entry(t, lp, rcu_node_entry)
                        printk(" P%d", t->pid);
-               spin_unlock_irqrestore(&rnp->lock, flags);
        }
 }
 
@@ -388,11 +441,11 @@ static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
                lp_root = &rnp_root->blocked_tasks[i];
                while (!list_empty(lp)) {
                        tp = list_entry(lp->next, typeof(*tp), rcu_node_entry);
-                       spin_lock(&rnp_root->lock); /* irqs already disabled */
+                       raw_spin_lock(&rnp_root->lock); /* irqs already disabled */
                        list_del(&tp->rcu_node_entry);
                        tp->rcu_blocked_node = rnp_root;
                        list_add(&tp->rcu_node_entry, lp_root);
-                       spin_unlock(&rnp_root->lock); /* irqs remain disabled */
+                       raw_spin_unlock(&rnp_root->lock); /* irqs remain disabled */
                }
        }
        return retval;
@@ -516,7 +569,7 @@ static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp)
        unsigned long flags;
        unsigned long mask;
 
-       spin_lock_irqsave(&rnp->lock, flags);
+       raw_spin_lock_irqsave(&rnp->lock, flags);
        for (;;) {
                if (!sync_rcu_preempt_exp_done(rnp))
                        break;
@@ -525,12 +578,12 @@ static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp)
                        break;
                }
                mask = rnp->grpmask;
-               spin_unlock(&rnp->lock); /* irqs remain disabled */
+               raw_spin_unlock(&rnp->lock); /* irqs remain disabled */
                rnp = rnp->parent;
-               spin_lock(&rnp->lock); /* irqs already disabled */
+               raw_spin_lock(&rnp->lock); /* irqs already disabled */
                rnp->expmask &= ~mask;
        }
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 }
 
 /*
@@ -545,11 +598,11 @@ sync_rcu_preempt_exp_init(struct rcu_state *rsp, struct rcu_node *rnp)
 {
        int must_wait;
 
-       spin_lock(&rnp->lock); /* irqs already disabled */
+       raw_spin_lock(&rnp->lock); /* irqs already disabled */
        list_splice_init(&rnp->blocked_tasks[0], &rnp->blocked_tasks[2]);
        list_splice_init(&rnp->blocked_tasks[1], &rnp->blocked_tasks[3]);
        must_wait = rcu_preempted_readers_exp(rnp);
-       spin_unlock(&rnp->lock); /* irqs remain disabled */
+       raw_spin_unlock(&rnp->lock); /* irqs remain disabled */
        if (!must_wait)
                rcu_report_exp_rnp(rsp, rnp);
 }
@@ -594,13 +647,13 @@ void synchronize_rcu_expedited(void)
        /* force all RCU readers onto blocked_tasks[]. */
        synchronize_sched_expedited();
 
-       spin_lock_irqsave(&rsp->onofflock, flags);
+       raw_spin_lock_irqsave(&rsp->onofflock, flags);
 
        /* Initialize ->expmask for all non-leaf rcu_node structures. */
        rcu_for_each_nonleaf_node_breadth_first(rsp, rnp) {
-               spin_lock(&rnp->lock); /* irqs already disabled. */
+               raw_spin_lock(&rnp->lock); /* irqs already disabled. */
                rnp->expmask = rnp->qsmaskinit;
-               spin_unlock(&rnp->lock); /* irqs remain disabled. */
+               raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */
        }
 
        /* Snapshot current state of ->blocked_tasks[] lists. */
@@ -609,7 +662,7 @@ void synchronize_rcu_expedited(void)
        if (NUM_RCU_NODES > 1)
                sync_rcu_preempt_exp_init(rsp, rcu_get_root(rsp));
 
-       spin_unlock_irqrestore(&rsp->onofflock, flags);
+       raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
 
        /* Wait for snapshotted ->blocked_tasks[] lists to drain. */
        rnp = rcu_get_root(rsp);
@@ -712,6 +765,16 @@ long rcu_batches_completed(void)
 }
 EXPORT_SYMBOL_GPL(rcu_batches_completed);
 
+/*
+ * Force a quiescent state for RCU, which, because there is no preemptible
+ * RCU, becomes the same as rcu-sched.
+ */
+void rcu_force_quiescent_state(void)
+{
+       rcu_sched_force_quiescent_state();
+}
+EXPORT_SYMBOL_GPL(rcu_force_quiescent_state);
+
 /*
  * Because preemptable RCU does not exist, we never have to check for
  * CPUs being in quiescent states.
@@ -734,13 +797,21 @@ static int rcu_preempted_readers(struct rcu_node *rnp)
 /* Because preemptible RCU does not exist, no quieting of tasks. */
 static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
 {
-       spin_unlock_irqrestore(&rnp->lock, flags);
+       raw_spin_unlock_irqrestore(&rnp->lock, flags);
 }
 
 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
 
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
 
+/*
+ * Because preemptable RCU does not exist, we never have to check for
+ * tasks blocked within RCU read-side critical sections.
+ */
+static void rcu_print_detail_task_stall(struct rcu_state *rsp)
+{
+}
+
 /*
  * Because preemptable RCU does not exist, we never have to check for
  * tasks blocked within RCU read-side critical sections.
@@ -884,3 +955,113 @@ static void __init __rcu_init_preempt(void)
 }
 
 #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
+
+#if !defined(CONFIG_RCU_FAST_NO_HZ)
+
+/*
+ * Check to see if any future RCU-related work will need to be done
+ * by the current CPU, even if none need be done immediately, returning
+ * 1 if so.  This function is part of the RCU implementation; it is -not-
+ * an exported member of the RCU API.
+ *
+ * Because we have preemptible RCU, just check whether this CPU needs
+ * any flavor of RCU.  Do not chew up lots of CPU cycles with preemption
+ * disabled in a most-likely vain attempt to cause RCU not to need this CPU.
+ */
+int rcu_needs_cpu(int cpu)
+{
+       return rcu_needs_cpu_quick_check(cpu);
+}
+
+/*
+ * Check to see if we need to continue a callback-flush operations to
+ * allow the last CPU to enter dyntick-idle mode.  But fast dyntick-idle
+ * entry is not configured, so we never do need to.
+ */
+static void rcu_needs_cpu_flush(void)
+{
+}
+
+#else /* #if !defined(CONFIG_RCU_FAST_NO_HZ) */
+
+#define RCU_NEEDS_CPU_FLUSHES 5
+static DEFINE_PER_CPU(int, rcu_dyntick_drain);
+static DEFINE_PER_CPU(unsigned long, rcu_dyntick_holdoff);
+
+/*
+ * Check to see if any future RCU-related work will need to be done
+ * by the current CPU, even if none need be done immediately, returning
+ * 1 if so.  This function is part of the RCU implementation; it is -not-
+ * an exported member of the RCU API.
+ *
+ * Because we are not supporting preemptible RCU, attempt to accelerate
+ * any current grace periods so that RCU no longer needs this CPU, but
+ * only if all other CPUs are already in dynticks-idle mode.  This will
+ * allow the CPU cores to be powered down immediately, as opposed to after
+ * waiting many milliseconds for grace periods to elapse.
+ *
+ * Because it is not legal to invoke rcu_process_callbacks() with irqs
+ * disabled, we do one pass of force_quiescent_state(), then do a
+ * raise_softirq() to cause rcu_process_callbacks() to be invoked later.
+ * The per-cpu rcu_dyntick_drain variable controls the sequencing.
+ */
+int rcu_needs_cpu(int cpu)
+{
+       int c = 0;
+       int thatcpu;
+
+       /* Don't bother unless we are the last non-dyntick-idle CPU. */
+       for_each_cpu_not(thatcpu, nohz_cpu_mask)
+               if (thatcpu != cpu) {
+                       per_cpu(rcu_dyntick_drain, cpu) = 0;
+                       per_cpu(rcu_dyntick_holdoff, cpu) = jiffies - 1;
+                       return rcu_needs_cpu_quick_check(cpu);
+               }
+
+       /* Check and update the rcu_dyntick_drain sequencing. */
+       if (per_cpu(rcu_dyntick_drain, cpu) <= 0) {
+               /* First time through, initialize the counter. */
+               per_cpu(rcu_dyntick_drain, cpu) = RCU_NEEDS_CPU_FLUSHES;
+       } else if (--per_cpu(rcu_dyntick_drain, cpu) <= 0) {
+               /* We have hit the limit, so time to give up. */
+               per_cpu(rcu_dyntick_holdoff, cpu) = jiffies;
+               return rcu_needs_cpu_quick_check(cpu);
+       }
+
+       /* Do one step pushing remaining RCU callbacks through. */
+       if (per_cpu(rcu_sched_data, cpu).nxtlist) {
+               rcu_sched_qs(cpu);
+               force_quiescent_state(&rcu_sched_state, 0);
+               c = c || per_cpu(rcu_sched_data, cpu).nxtlist;
+       }
+       if (per_cpu(rcu_bh_data, cpu).nxtlist) {
+               rcu_bh_qs(cpu);
+               force_quiescent_state(&rcu_bh_state, 0);
+               c = c || per_cpu(rcu_bh_data, cpu).nxtlist;
+       }
+
+       /* If RCU callbacks are still pending, RCU still needs this CPU. */
+       if (c) {
+               raise_softirq(RCU_SOFTIRQ);
+               per_cpu(rcu_dyntick_holdoff, cpu) = jiffies;
+       }
+       return c;
+}
+
+/*
+ * Check to see if we need to continue a callback-flush operations to
+ * allow the last CPU to enter dyntick-idle mode.
+ */
+static void rcu_needs_cpu_flush(void)
+{
+       int cpu = smp_processor_id();
+       unsigned long flags;
+
+       if (per_cpu(rcu_dyntick_drain, cpu) <= 0)
+               return;
+       local_irq_save(flags);
+       (void)rcu_needs_cpu(cpu);
+       local_irq_restore(flags);
+}
+
+#endif /* #else #if !defined(CONFIG_RCU_FAST_NO_HZ) */
index 9d2c88423b31abfd6a0a350659a9f3ddf98cbd0e..d45db2e35d27a1c3aea36ad6ff299fdf73cb7e74 100644 (file)
@@ -50,7 +50,7 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 {
        if (!rdp->beenonline)
                return;
-       seq_printf(m, "%3d%cc=%ld g=%ld pq=%d pqc=%ld qp=%d",
+       seq_printf(m, "%3d%cc=%lu g=%lu pq=%d pqc=%lu qp=%d",
                   rdp->cpu,
                   cpu_is_offline(rdp->cpu) ? '!' : ' ',
                   rdp->completed, rdp->gpnum,
@@ -105,7 +105,7 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp)
 {
        if (!rdp->beenonline)
                return;
-       seq_printf(m, "%d,%s,%ld,%ld,%d,%ld,%d",
+       seq_printf(m, "%d,%s,%lu,%lu,%d,%lu,%d",
                   rdp->cpu,
                   cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"",
                   rdp->completed, rdp->gpnum,
@@ -155,13 +155,13 @@ static const struct file_operations rcudata_csv_fops = {
 
 static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
 {
-       long gpnum;
+       unsigned long gpnum;
        int level = 0;
        int phase;
        struct rcu_node *rnp;
 
        gpnum = rsp->gpnum;
-       seq_printf(m, "c=%ld g=%ld s=%d jfq=%ld j=%x "
+       seq_printf(m, "c=%lu g=%lu s=%d jfq=%ld j=%x "
                      "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu oqlen=%ld\n",
                   rsp->completed, gpnum, rsp->signaled,
                   (long)(rsp->jiffies_force_qs - jiffies),
@@ -215,12 +215,12 @@ static const struct file_operations rcuhier_fops = {
 static int show_rcugp(struct seq_file *m, void *unused)
 {
 #ifdef CONFIG_TREE_PREEMPT_RCU
-       seq_printf(m, "rcu_preempt: completed=%ld  gpnum=%ld\n",
+       seq_printf(m, "rcu_preempt: completed=%ld  gpnum=%lu\n",
                   rcu_preempt_state.completed, rcu_preempt_state.gpnum);
 #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
-       seq_printf(m, "rcu_sched: completed=%ld  gpnum=%ld\n",
+       seq_printf(m, "rcu_sched: completed=%ld  gpnum=%lu\n",
                   rcu_sched_state.completed, rcu_sched_state.gpnum);
-       seq_printf(m, "rcu_bh: completed=%ld  gpnum=%ld\n",
+       seq_printf(m, "rcu_bh: completed=%ld  gpnum=%lu\n",
                   rcu_bh_state.completed, rcu_bh_state.gpnum);
        return 0;
 }
index af96c1e4b54b11b27fe445b834e3106b5b76b472..4e9d87fd7bc5609f86d2cd7b96f8fb3889dc63b7 100644 (file)
@@ -188,6 +188,36 @@ static int __release_resource(struct resource *old)
        return -EINVAL;
 }
 
+static void __release_child_resources(struct resource *r)
+{
+       struct resource *tmp, *p;
+       resource_size_t size;
+
+       p = r->child;
+       r->child = NULL;
+       while (p) {
+               tmp = p;
+               p = p->sibling;
+
+               tmp->parent = NULL;
+               tmp->sibling = NULL;
+               __release_child_resources(tmp);
+
+               printk(KERN_DEBUG "release child resource %pR\n", tmp);
+               /* need to restore size, and keep flags */
+               size = resource_size(tmp);
+               tmp->start = 0;
+               tmp->end = size - 1;
+       }
+}
+
+void release_child_resources(struct resource *r)
+{
+       write_lock(&resource_lock);
+       __release_child_resources(r);
+       write_unlock(&resource_lock);
+}
+
 /**
  * request_resource - request and reserve an I/O or memory resource
  * @root: root resource descriptor
@@ -297,14 +327,29 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
 
 #endif
 
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+       return 1;
+}
+/*
+ * This generic page_is_ram() returns true if specified address is
+ * registered as "System RAM" in iomem_resource list.
+ */
+int __weak page_is_ram(unsigned long pfn)
+{
+       return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
+}
+
 /*
  * Find empty slot in the resource tree given range and alignment.
  */
 static int find_resource(struct resource *root, struct resource *new,
                         resource_size_t size, resource_size_t min,
                         resource_size_t max, resource_size_t align,
-                        void (*alignf)(void *, struct resource *,
-                                       resource_size_t, resource_size_t),
+                        resource_size_t (*alignf)(void *,
+                                                  const struct resource *,
+                                                  resource_size_t,
+                                                  resource_size_t),
                         void *alignf_data)
 {
        struct resource *this = root->child;
@@ -330,7 +375,7 @@ static int find_resource(struct resource *root, struct resource *new,
                        tmp.end = max;
                tmp.start = ALIGN(tmp.start, align);
                if (alignf)
-                       alignf(alignf_data, &tmp, size, align);
+                       tmp.start = alignf(alignf_data, &tmp, size, align);
                if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
                        new->start = tmp.start;
                        new->end = tmp.start + size - 1;
@@ -358,8 +403,10 @@ static int find_resource(struct resource *root, struct resource *new,
 int allocate_resource(struct resource *root, struct resource *new,
                      resource_size_t size, resource_size_t min,
                      resource_size_t max, resource_size_t align,
-                     void (*alignf)(void *, struct resource *,
-                                    resource_size_t, resource_size_t),
+                     resource_size_t (*alignf)(void *,
+                                               const struct resource *,
+                                               resource_size_t,
+                                               resource_size_t),
                      void *alignf_data)
 {
        int err;
index c535cc4f6428bcd09405c2f4a3322f9b41de7eaa..6a212c97f52394b780c52bf100e61a88ef856aab 100644 (file)
@@ -233,7 +233,7 @@ static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b)
  */
 static DEFINE_MUTEX(sched_domains_mutex);
 
-#ifdef CONFIG_GROUP_SCHED
+#ifdef CONFIG_CGROUP_SCHED
 
 #include <linux/cgroup.h>
 
@@ -243,13 +243,7 @@ static LIST_HEAD(task_groups);
 
 /* task group related information */
 struct task_group {
-#ifdef CONFIG_CGROUP_SCHED
        struct cgroup_subsys_state css;
-#endif
-
-#ifdef CONFIG_USER_SCHED
-       uid_t uid;
-#endif
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
        /* schedulable entities of this group on each cpu */
@@ -274,35 +268,7 @@ struct task_group {
        struct list_head children;
 };
 
-#ifdef CONFIG_USER_SCHED
-
-/* Helper function to pass uid information to create_sched_user() */
-void set_tg_uid(struct user_struct *user)
-{
-       user->tg->uid = user->uid;
-}
-
-/*
- * Root task group.
- *     Every UID task group (including init_task_group aka UID-0) will
- *     be a child to this group.
- */
-struct task_group root_task_group;
-
-#ifdef CONFIG_FAIR_GROUP_SCHED
-/* Default task group's sched entity on each cpu */
-static DEFINE_PER_CPU(struct sched_entity, init_sched_entity);
-/* Default task group's cfs_rq on each cpu */
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct cfs_rq, init_tg_cfs_rq);
-#endif /* CONFIG_FAIR_GROUP_SCHED */
-
-#ifdef CONFIG_RT_GROUP_SCHED
-static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct rt_rq, init_rt_rq_var);
-#endif /* CONFIG_RT_GROUP_SCHED */
-#else /* !CONFIG_USER_SCHED */
 #define root_task_group init_task_group
-#endif /* CONFIG_USER_SCHED */
 
 /* task_group_lock serializes add/remove of task groups and also changes to
  * a task group's cpu shares.
@@ -318,11 +284,7 @@ static int root_task_group_empty(void)
 }
 #endif
 
-#ifdef CONFIG_USER_SCHED
-# define INIT_TASK_GROUP_LOAD  (2*NICE_0_LOAD)
-#else /* !CONFIG_USER_SCHED */
 # define INIT_TASK_GROUP_LOAD  NICE_0_LOAD
-#endif /* CONFIG_USER_SCHED */
 
 /*
  * A weight of 0 or 1 can cause arithmetics problems.
@@ -348,11 +310,7 @@ static inline struct task_group *task_group(struct task_struct *p)
 {
        struct task_group *tg;
 
-#ifdef CONFIG_USER_SCHED
-       rcu_read_lock();
-       tg = __task_cred(p)->user->tg;
-       rcu_read_unlock();
-#elif defined(CONFIG_CGROUP_SCHED)
+#ifdef CONFIG_CGROUP_SCHED
        tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
                                struct task_group, css);
 #else
@@ -383,7 +341,7 @@ static inline struct task_group *task_group(struct task_struct *p)
        return NULL;
 }
 
-#endif /* CONFIG_GROUP_SCHED */
+#endif /* CONFIG_CGROUP_SCHED */
 
 /* CFS-related fields in a runqueue */
 struct cfs_rq {
@@ -478,7 +436,6 @@ struct rt_rq {
        struct rq *rq;
        struct list_head leaf_rt_rq_list;
        struct task_group *tg;
-       struct sched_rt_entity *rt_se;
 #endif
 };
 
@@ -645,6 +602,11 @@ static inline int cpu_of(struct rq *rq)
 #endif
 }
 
+#define rcu_dereference_check_sched_domain(p) \
+       rcu_dereference_check((p), \
+                             rcu_read_lock_sched_held() || \
+                             lockdep_is_held(&sched_domains_mutex))
+
 /*
  * The domain tree (rq->sd) is protected by RCU's quiescent state transition.
  * See detach_destroy_domains: synchronize_sched for details.
@@ -653,7 +615,7 @@ static inline int cpu_of(struct rq *rq)
  * preempt-disabled sections.
  */
 #define for_each_domain(cpu, __sd) \
-       for (__sd = rcu_dereference(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent)
+       for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent)
 
 #define cpu_rq(cpu)            (&per_cpu(runqueues, (cpu)))
 #define this_rq()              (&__get_cpu_var(runqueues))
@@ -940,6 +902,19 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
 }
 #endif /* __ARCH_WANT_UNLOCKED_CTXSW */
 
+/*
+ * Check whether the task is waking, we use this to synchronize against
+ * ttwu() so that task_cpu() reports a stable number.
+ *
+ * We need to make an exception for PF_STARTING tasks because the fork
+ * path might require task_rq_lock() to work, eg. it can call
+ * set_cpus_allowed_ptr() from the cpuset clone_ns code.
+ */
+static inline int task_is_waking(struct task_struct *p)
+{
+       return unlikely((p->state == TASK_WAKING) && !(p->flags & PF_STARTING));
+}
+
 /*
  * __task_rq_lock - lock the runqueue a given task resides on.
  * Must be called interrupts disabled.
@@ -947,10 +922,14 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
 static inline struct rq *__task_rq_lock(struct task_struct *p)
        __acquires(rq->lock)
 {
+       struct rq *rq;
+
        for (;;) {
-               struct rq *rq = task_rq(p);
+               while (task_is_waking(p))
+                       cpu_relax();
+               rq = task_rq(p);
                raw_spin_lock(&rq->lock);
-               if (likely(rq == task_rq(p)))
+               if (likely(rq == task_rq(p) && !task_is_waking(p)))
                        return rq;
                raw_spin_unlock(&rq->lock);
        }
@@ -967,10 +946,12 @@ static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags)
        struct rq *rq;
 
        for (;;) {
+               while (task_is_waking(p))
+                       cpu_relax();
                local_irq_save(*flags);
                rq = task_rq(p);
                raw_spin_lock(&rq->lock);
-               if (likely(rq == task_rq(p)))
+               if (likely(rq == task_rq(p) && !task_is_waking(p)))
                        return rq;
                raw_spin_unlock_irqrestore(&rq->lock, *flags);
        }
@@ -1390,32 +1371,6 @@ static const u32 prio_to_wmult[40] = {
  /*  15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
 };
 
-static void activate_task(struct rq *rq, struct task_struct *p, int wakeup);
-
-/*
- * runqueue iterator, to support SMP load-balancing between different
- * scheduling classes, without having to expose their internal data
- * structures to the load-balancing proper:
- */
-struct rq_iterator {
-       void *arg;
-       struct task_struct *(*start)(void *);
-       struct task_struct *(*next)(void *);
-};
-
-#ifdef CONFIG_SMP
-static unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-             unsigned long max_load_move, struct sched_domain *sd,
-             enum cpu_idle_type idle, int *all_pinned,
-             int *this_best_prio, struct rq_iterator *iterator);
-
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                  struct sched_domain *sd, enum cpu_idle_type idle,
-                  struct rq_iterator *iterator);
-#endif
-
 /* Time spent by the tasks of the cpu accounting group executing in ... */
 enum cpuacct_stat_index {
        CPUACCT_STAT_USER,      /* ... user mode */
@@ -1531,7 +1486,7 @@ static unsigned long target_load(int cpu, int type)
 
 static struct sched_group *group_of(int cpu)
 {
-       struct sched_domain *sd = rcu_dereference(cpu_rq(cpu)->sd);
+       struct sched_domain *sd = rcu_dereference_sched(cpu_rq(cpu)->sd);
 
        if (!sd)
                return NULL;
@@ -1701,16 +1656,6 @@ static void update_shares(struct sched_domain *sd)
        }
 }
 
-static void update_shares_locked(struct rq *rq, struct sched_domain *sd)
-{
-       if (root_task_group_empty())
-               return;
-
-       raw_spin_unlock(&rq->lock);
-       update_shares(sd);
-       raw_spin_lock(&rq->lock);
-}
-
 static void update_h_load(long cpu)
 {
        if (root_task_group_empty())
@@ -1725,10 +1670,6 @@ static inline void update_shares(struct sched_domain *sd)
 {
 }
 
-static inline void update_shares_locked(struct rq *rq, struct sched_domain *sd)
-{
-}
-
 #endif
 
 #ifdef CONFIG_PREEMPT
@@ -1805,6 +1746,51 @@ static inline void double_unlock_balance(struct rq *this_rq, struct rq *busiest)
        raw_spin_unlock(&busiest->lock);
        lock_set_subclass(&this_rq->lock.dep_map, 0, _RET_IP_);
 }
+
+/*
+ * double_rq_lock - safely lock two runqueues
+ *
+ * Note this does not disable interrupts like task_rq_lock,
+ * you need to do so manually before calling.
+ */
+static void double_rq_lock(struct rq *rq1, struct rq *rq2)
+       __acquires(rq1->lock)
+       __acquires(rq2->lock)
+{
+       BUG_ON(!irqs_disabled());
+       if (rq1 == rq2) {
+               raw_spin_lock(&rq1->lock);
+               __acquire(rq2->lock);   /* Fake it out ;) */
+       } else {
+               if (rq1 < rq2) {
+                       raw_spin_lock(&rq1->lock);
+                       raw_spin_lock_nested(&rq2->lock, SINGLE_DEPTH_NESTING);
+               } else {
+                       raw_spin_lock(&rq2->lock);
+                       raw_spin_lock_nested(&rq1->lock, SINGLE_DEPTH_NESTING);
+               }
+       }
+       update_rq_clock(rq1);
+       update_rq_clock(rq2);
+}
+
+/*
+ * double_rq_unlock - safely unlock two runqueues
+ *
+ * Note this does not restore interrupts like task_rq_unlock,
+ * you need to do so manually after calling.
+ */
+static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
+       __releases(rq1->lock)
+       __releases(rq2->lock)
+{
+       raw_spin_unlock(&rq1->lock);
+       if (rq1 != rq2)
+               raw_spin_unlock(&rq2->lock);
+       else
+               __release(rq2->lock);
+}
+
 #endif
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1834,18 +1820,14 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
 #endif
 }
 
-#include "sched_stats.h"
-#include "sched_idletask.c"
-#include "sched_fair.c"
-#include "sched_rt.c"
-#ifdef CONFIG_SCHED_DEBUG
-# include "sched_debug.c"
-#endif
+static const struct sched_class rt_sched_class;
 
 #define sched_class_highest (&rt_sched_class)
 #define for_each_class(class) \
    for (class = sched_class_highest; class; class = class->next)
 
+#include "sched_stats.h"
+
 static void inc_nr_running(struct rq *rq)
 {
        rq->nr_running++;
@@ -1883,13 +1865,14 @@ static void update_avg(u64 *avg, u64 sample)
        *avg += diff >> 3;
 }
 
-static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
+static void
+enqueue_task(struct rq *rq, struct task_struct *p, int wakeup, bool head)
 {
        if (wakeup)
                p->se.start_runtime = p->se.sum_exec_runtime;
 
        sched_info_queued(p);
-       p->sched_class->enqueue_task(rq, p, wakeup);
+       p->sched_class->enqueue_task(rq, p, wakeup, head);
        p->se.on_rq = 1;
 }
 
@@ -1911,6 +1894,37 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
        p->se.on_rq = 0;
 }
 
+/*
+ * activate_task - move a task to the runqueue.
+ */
+static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
+{
+       if (task_contributes_to_load(p))
+               rq->nr_uninterruptible--;
+
+       enqueue_task(rq, p, wakeup, false);
+       inc_nr_running(rq);
+}
+
+/*
+ * deactivate_task - remove a task from the runqueue.
+ */
+static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
+{
+       if (task_contributes_to_load(p))
+               rq->nr_uninterruptible++;
+
+       dequeue_task(rq, p, sleep);
+       dec_nr_running(rq);
+}
+
+#include "sched_idletask.c"
+#include "sched_fair.c"
+#include "sched_rt.c"
+#ifdef CONFIG_SCHED_DEBUG
+# include "sched_debug.c"
+#endif
+
 /*
  * __normal_prio - return the priority that is based on the static prio
  */
@@ -1957,30 +1971,6 @@ static int effective_prio(struct task_struct *p)
        return p->prio;
 }
 
-/*
- * activate_task - move a task to the runqueue.
- */
-static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
-{
-       if (task_contributes_to_load(p))
-               rq->nr_uninterruptible--;
-
-       enqueue_task(rq, p, wakeup);
-       inc_nr_running(rq);
-}
-
-/*
- * deactivate_task - remove a task from the runqueue.
- */
-static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
-{
-       if (task_contributes_to_load(p))
-               rq->nr_uninterruptible++;
-
-       dequeue_task(rq, p, sleep);
-       dec_nr_running(rq);
-}
-
 /**
  * task_curr - is this task currently executing on a CPU?
  * @p: the task in question.
@@ -2320,14 +2310,12 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
 }
 
 /*
- * Called from:
+ * Gets called from 3 sites (exec, fork, wakeup), since it is called without
+ * holding rq->lock we need to ensure ->cpus_allowed is stable, this is done
+ * by:
  *
- *  - fork, @p is stable because it isn't on the tasklist yet
- *
- *  - exec, @p is unstable, retry loop
- *
- *  - wake-up, we serialize ->cpus_allowed against TASK_WAKING so
- *             we should be good.
+ *  exec:           is unstable, retry loop
+ *  fork & wake-up: serialize ->cpus_allowed against TASK_WAKING
  */
 static inline
 int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
@@ -2410,14 +2398,27 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
        __task_rq_unlock(rq);
 
        cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
-       if (cpu != orig_cpu)
+       if (cpu != orig_cpu) {
+               /*
+                * Since we migrate the task without holding any rq->lock,
+                * we need to be careful with task_rq_lock(), since that
+                * might end up locking an invalid rq.
+                */
                set_task_cpu(p, cpu);
+       }
 
-       rq = __task_rq_lock(p);
+       rq = cpu_rq(cpu);
+       raw_spin_lock(&rq->lock);
        update_rq_clock(rq);
 
+       /*
+        * We migrated the task without holding either rq->lock, however
+        * since the task is not on the task list itself, nobody else
+        * will try and migrate the task, hence the rq should match the
+        * cpu we just moved it to.
+        */
+       WARN_ON(task_cpu(p) != cpu);
        WARN_ON(p->state != TASK_WAKING);
-       cpu = task_cpu(p);
 
 #ifdef CONFIG_SCHEDSTATS
        schedstat_inc(rq, ttwu_count);
@@ -2620,9 +2621,6 @@ void sched_fork(struct task_struct *p, int clone_flags)
        if (p->sched_class->task_fork)
                p->sched_class->task_fork(p);
 
-#ifdef CONFIG_SMP
-       cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
-#endif
        set_task_cpu(p, cpu);
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
@@ -2652,8 +2650,29 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
 {
        unsigned long flags;
        struct rq *rq;
+       int cpu = get_cpu();
+
+#ifdef CONFIG_SMP
+       /*
+        * Fork balancing, do it here and not earlier because:
+        *  - cpus_allowed can change in the fork path
+        *  - any previously selected cpu might disappear through hotplug
+        *
+        * We still have TASK_WAKING but PF_STARTING is gone now, meaning
+        * ->cpus_allowed is stable, we have preemption disabled, meaning
+        * cpu_online_mask is stable.
+        */
+       cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
+       set_task_cpu(p, cpu);
+#endif
+
+       /*
+        * Since the task is not on the rq and we still have TASK_WAKING set
+        * nobody else will migrate this task.
+        */
+       rq = cpu_rq(cpu);
+       raw_spin_lock_irqsave(&rq->lock, flags);
 
-       rq = task_rq_lock(p, &flags);
        BUG_ON(p->state != TASK_WAKING);
        p->state = TASK_RUNNING;
        update_rq_clock(rq);
@@ -2665,6 +2684,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
                p->sched_class->task_woken(rq, p);
 #endif
        task_rq_unlock(rq, &flags);
+       put_cpu();
 }
 
 #ifdef CONFIG_PREEMPT_NOTIFIERS
@@ -2783,7 +2803,13 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
         */
        prev_state = prev->state;
        finish_arch_switch(prev);
-       perf_event_task_sched_in(current, cpu_of(rq));
+#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
+       local_irq_disable();
+#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */
+       perf_event_task_sched_in(current);
+#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
+       local_irq_enable();
+#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */
        finish_lock_switch(rq, prev);
 
        fire_sched_in_preempt_notifiers(current);
@@ -2931,2017 +2957,208 @@ unsigned long nr_running(void)
        return sum;
 }
 
-unsigned long nr_uninterruptible(void)
-{
-       unsigned long i, sum = 0;
-
-       for_each_possible_cpu(i)
-               sum += cpu_rq(i)->nr_uninterruptible;
-
-       /*
-        * Since we read the counters lockless, it might be slightly
-        * inaccurate. Do not allow it to go below zero though:
-        */
-       if (unlikely((long)sum < 0))
-               sum = 0;
-
-       return sum;
-}
-
-unsigned long long nr_context_switches(void)
-{
-       int i;
-       unsigned long long sum = 0;
-
-       for_each_possible_cpu(i)
-               sum += cpu_rq(i)->nr_switches;
-
-       return sum;
-}
-
-unsigned long nr_iowait(void)
-{
-       unsigned long i, sum = 0;
-
-       for_each_possible_cpu(i)
-               sum += atomic_read(&cpu_rq(i)->nr_iowait);
-
-       return sum;
-}
-
-unsigned long nr_iowait_cpu(void)
-{
-       struct rq *this = this_rq();
-       return atomic_read(&this->nr_iowait);
-}
-
-unsigned long this_cpu_load(void)
-{
-       struct rq *this = this_rq();
-       return this->cpu_load[0];
-}
-
-
-/* Variables and functions for calc_load */
-static atomic_long_t calc_load_tasks;
-static unsigned long calc_load_update;
-unsigned long avenrun[3];
-EXPORT_SYMBOL(avenrun);
-
-/**
- * get_avenrun - get the load average array
- * @loads:     pointer to dest load array
- * @offset:    offset to add
- * @shift:     shift count to shift the result left
- *
- * These values are estimates at best, so no need for locking.
- */
-void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
-{
-       loads[0] = (avenrun[0] + offset) << shift;
-       loads[1] = (avenrun[1] + offset) << shift;
-       loads[2] = (avenrun[2] + offset) << shift;
-}
-
-static unsigned long
-calc_load(unsigned long load, unsigned long exp, unsigned long active)
-{
-       load *= exp;
-       load += active * (FIXED_1 - exp);
-       return load >> FSHIFT;
-}
-
-/*
- * calc_load - update the avenrun load estimates 10 ticks after the
- * CPUs have updated calc_load_tasks.
- */
-void calc_global_load(void)
-{
-       unsigned long upd = calc_load_update + 10;
-       long active;
-
-       if (time_before(jiffies, upd))
-               return;
-
-       active = atomic_long_read(&calc_load_tasks);
-       active = active > 0 ? active * FIXED_1 : 0;
-
-       avenrun[0] = calc_load(avenrun[0], EXP_1, active);
-       avenrun[1] = calc_load(avenrun[1], EXP_5, active);
-       avenrun[2] = calc_load(avenrun[2], EXP_15, active);
-
-       calc_load_update += LOAD_FREQ;
-}
-
-/*
- * Either called from update_cpu_load() or from a cpu going idle
- */
-static void calc_load_account_active(struct rq *this_rq)
-{
-       long nr_active, delta;
-
-       nr_active = this_rq->nr_running;
-       nr_active += (long) this_rq->nr_uninterruptible;
-
-       if (nr_active != this_rq->calc_load_active) {
-               delta = nr_active - this_rq->calc_load_active;
-               this_rq->calc_load_active = nr_active;
-               atomic_long_add(delta, &calc_load_tasks);
-       }
-}
-
-/*
- * Update rq->cpu_load[] statistics. This function is usually called every
- * scheduler tick (TICK_NSEC).
- */
-static void update_cpu_load(struct rq *this_rq)
-{
-       unsigned long this_load = this_rq->load.weight;
-       int i, scale;
-
-       this_rq->nr_load_updates++;
-
-       /* Update our load: */
-       for (i = 0, scale = 1; i < CPU_LOAD_IDX_MAX; i++, scale += scale) {
-               unsigned long old_load, new_load;
-
-               /* scale is effectively 1 << i now, and >> i divides by scale */
-
-               old_load = this_rq->cpu_load[i];
-               new_load = this_load;
-               /*
-                * Round up the averaging division if load is increasing. This
-                * prevents us from getting stuck on 9 if the load is 10, for
-                * example.
-                */
-               if (new_load > old_load)
-                       new_load += scale-1;
-               this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i;
-       }
-
-       if (time_after_eq(jiffies, this_rq->calc_load_update)) {
-               this_rq->calc_load_update += LOAD_FREQ;
-               calc_load_account_active(this_rq);
-       }
-}
-
-#ifdef CONFIG_SMP
-
-/*
- * double_rq_lock - safely lock two runqueues
- *
- * Note this does not disable interrupts like task_rq_lock,
- * you need to do so manually before calling.
- */
-static void double_rq_lock(struct rq *rq1, struct rq *rq2)
-       __acquires(rq1->lock)
-       __acquires(rq2->lock)
-{
-       BUG_ON(!irqs_disabled());
-       if (rq1 == rq2) {
-               raw_spin_lock(&rq1->lock);
-               __acquire(rq2->lock);   /* Fake it out ;) */
-       } else {
-               if (rq1 < rq2) {
-                       raw_spin_lock(&rq1->lock);
-                       raw_spin_lock_nested(&rq2->lock, SINGLE_DEPTH_NESTING);
-               } else {
-                       raw_spin_lock(&rq2->lock);
-                       raw_spin_lock_nested(&rq1->lock, SINGLE_DEPTH_NESTING);
-               }
-       }
-       update_rq_clock(rq1);
-       update_rq_clock(rq2);
-}
-
-/*
- * double_rq_unlock - safely unlock two runqueues
- *
- * Note this does not restore interrupts like task_rq_unlock,
- * you need to do so manually after calling.
- */
-static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
-       __releases(rq1->lock)
-       __releases(rq2->lock)
-{
-       raw_spin_unlock(&rq1->lock);
-       if (rq1 != rq2)
-               raw_spin_unlock(&rq2->lock);
-       else
-               __release(rq2->lock);
-}
-
-/*
- * sched_exec - execve() is a valuable balancing opportunity, because at
- * this point the task has the smallest effective memory and cache footprint.
- */
-void sched_exec(void)
-{
-       struct task_struct *p = current;
-       struct migration_req req;
-       int dest_cpu, this_cpu;
-       unsigned long flags;
-       struct rq *rq;
-
-again:
-       this_cpu = get_cpu();
-       dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0);
-       if (dest_cpu == this_cpu) {
-               put_cpu();
-               return;
-       }
-
-       rq = task_rq_lock(p, &flags);
-       put_cpu();
-
-       /*
-        * select_task_rq() can race against ->cpus_allowed
-        */
-       if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)
-           || unlikely(!cpu_active(dest_cpu))) {
-               task_rq_unlock(rq, &flags);
-               goto again;
-       }
-
-       /* force the process onto the specified CPU */
-       if (migrate_task(p, dest_cpu, &req)) {
-               /* Need to wait for migration thread (might exit: take ref). */
-               struct task_struct *mt = rq->migration_thread;
-
-               get_task_struct(mt);
-               task_rq_unlock(rq, &flags);
-               wake_up_process(mt);
-               put_task_struct(mt);
-               wait_for_completion(&req.done);
-
-               return;
-       }
-       task_rq_unlock(rq, &flags);
-}
-
-/*
- * pull_task - move a task from a remote runqueue to the local runqueue.
- * Both runqueues must be locked.
- */
-static void pull_task(struct rq *src_rq, struct task_struct *p,
-                     struct rq *this_rq, int this_cpu)
-{
-       deactivate_task(src_rq, p, 0);
-       set_task_cpu(p, this_cpu);
-       activate_task(this_rq, p, 0);
-       check_preempt_curr(this_rq, p, 0);
-}
-
-/*
- * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
- */
-static
-int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
-                    struct sched_domain *sd, enum cpu_idle_type idle,
-                    int *all_pinned)
-{
-       int tsk_cache_hot = 0;
-       /*
-        * We do not migrate tasks that are:
-        * 1) running (obviously), or
-        * 2) cannot be migrated to this CPU due to cpus_allowed, or
-        * 3) are cache-hot on their current CPU.
-        */
-       if (!cpumask_test_cpu(this_cpu, &p->cpus_allowed)) {
-               schedstat_inc(p, se.nr_failed_migrations_affine);
-               return 0;
-       }
-       *all_pinned = 0;
-
-       if (task_running(rq, p)) {
-               schedstat_inc(p, se.nr_failed_migrations_running);
-               return 0;
-       }
-
-       /*
-        * Aggressive migration if:
-        * 1) task is cache cold, or
-        * 2) too many balance attempts have failed.
-        */
-
-       tsk_cache_hot = task_hot(p, rq->clock, sd);
-       if (!tsk_cache_hot ||
-               sd->nr_balance_failed > sd->cache_nice_tries) {
-#ifdef CONFIG_SCHEDSTATS
-               if (tsk_cache_hot) {
-                       schedstat_inc(sd, lb_hot_gained[idle]);
-                       schedstat_inc(p, se.nr_forced_migrations);
-               }
-#endif
-               return 1;
-       }
-
-       if (tsk_cache_hot) {
-               schedstat_inc(p, se.nr_failed_migrations_hot);
-               return 0;
-       }
-       return 1;
-}
-
-static unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-             unsigned long max_load_move, struct sched_domain *sd,
-             enum cpu_idle_type idle, int *all_pinned,
-             int *this_best_prio, struct rq_iterator *iterator)
-{
-       int loops = 0, pulled = 0, pinned = 0;
-       struct task_struct *p;
-       long rem_load_move = max_load_move;
-
-       if (max_load_move == 0)
-               goto out;
-
-       pinned = 1;
-
-       /*
-        * Start the load-balancing iterator:
-        */
-       p = iterator->start(iterator->arg);
-next:
-       if (!p || loops++ > sysctl_sched_nr_migrate)
-               goto out;
-
-       if ((p->se.load.weight >> 1) > rem_load_move ||
-           !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-               p = iterator->next(iterator->arg);
-               goto next;
-       }
-
-       pull_task(busiest, p, this_rq, this_cpu);
-       pulled++;
-       rem_load_move -= p->se.load.weight;
-
-#ifdef CONFIG_PREEMPT
-       /*
-        * NEWIDLE balancing is a source of latency, so preemptible kernels
-        * will stop after the first task is pulled to minimize the critical
-        * section.
-        */
-       if (idle == CPU_NEWLY_IDLE)
-               goto out;
-#endif
-
-       /*
-        * We only want to steal up to the prescribed amount of weighted load.
-        */
-       if (rem_load_move > 0) {
-               if (p->prio < *this_best_prio)
-                       *this_best_prio = p->prio;
-               p = iterator->next(iterator->arg);
-               goto next;
-       }
-out:
-       /*
-        * Right now, this is one of only two places pull_task() is called,
-        * so we can safely collect pull_task() stats here rather than
-        * inside pull_task().
-        */
-       schedstat_add(sd, lb_gained[idle], pulled);
-
-       if (all_pinned)
-               *all_pinned = pinned;
-
-       return max_load_move - rem_load_move;
-}
-
-/*
- * move_tasks tries to move up to max_load_move weighted load from busiest to
- * this_rq, as part of a balancing operation within domain "sd".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                     unsigned long max_load_move,
-                     struct sched_domain *sd, enum cpu_idle_type idle,
-                     int *all_pinned)
-{
-       const struct sched_class *class = sched_class_highest;
-       unsigned long total_load_moved = 0;
-       int this_best_prio = this_rq->curr->prio;
-
-       do {
-               total_load_moved +=
-                       class->load_balance(this_rq, this_cpu, busiest,
-                               max_load_move - total_load_moved,
-                               sd, idle, all_pinned, &this_best_prio);
-               class = class->next;
-
-#ifdef CONFIG_PREEMPT
-               /*
-                * NEWIDLE balancing is a source of latency, so preemptible
-                * kernels will stop after the first task is pulled to minimize
-                * the critical section.
-                */
-               if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
-                       break;
-#endif
-       } while (class && max_load_move > total_load_moved);
-
-       return total_load_moved > 0;
-}
-
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                  struct sched_domain *sd, enum cpu_idle_type idle,
-                  struct rq_iterator *iterator)
-{
-       struct task_struct *p = iterator->start(iterator->arg);
-       int pinned = 0;
-
-       while (p) {
-               if (can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-                       pull_task(busiest, p, this_rq, this_cpu);
-                       /*
-                        * Right now, this is only the second place pull_task()
-                        * is called, so we can safely collect pull_task()
-                        * stats here rather than inside pull_task().
-                        */
-                       schedstat_inc(sd, lb_gained[idle]);
-
-                       return 1;
-               }
-               p = iterator->next(iterator->arg);
-       }
-
-       return 0;
-}
-
-/*
- * move_one_task tries to move exactly one task from busiest to this_rq, as
- * part of active balancing operations within "domain".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                        struct sched_domain *sd, enum cpu_idle_type idle)
-{
-       const struct sched_class *class;
-
-       for_each_class(class) {
-               if (class->move_one_task(this_rq, this_cpu, busiest, sd, idle))
-                       return 1;
-       }
-
-       return 0;
-}
-/********** Helpers for find_busiest_group ************************/
-/*
- * sd_lb_stats - Structure to store the statistics of a sched_domain
- *             during load balancing.
- */
-struct sd_lb_stats {
-       struct sched_group *busiest; /* Busiest group in this sd */
-       struct sched_group *this;  /* Local group in this sd */
-       unsigned long total_load;  /* Total load of all groups in sd */
-       unsigned long total_pwr;   /*   Total power of all groups in sd */
-       unsigned long avg_load;    /* Average load across all groups in sd */
-
-       /** Statistics of this group */
-       unsigned long this_load;
-       unsigned long this_load_per_task;
-       unsigned long this_nr_running;
-
-       /* Statistics of the busiest group */
-       unsigned long max_load;
-       unsigned long busiest_load_per_task;
-       unsigned long busiest_nr_running;
-
-       int group_imb; /* Is there imbalance in this sd */
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-       int power_savings_balance; /* Is powersave balance needed for this sd */
-       struct sched_group *group_min; /* Least loaded group in sd */
-       struct sched_group *group_leader; /* Group which relieves group_min */
-       unsigned long min_load_per_task; /* load_per_task in group_min */
-       unsigned long leader_nr_running; /* Nr running of group_leader */
-       unsigned long min_nr_running; /* Nr running of group_min */
-#endif
-};
-
-/*
- * sg_lb_stats - stats of a sched_group required for load_balancing
- */
-struct sg_lb_stats {
-       unsigned long avg_load; /*Avg load across the CPUs of the group */
-       unsigned long group_load; /* Total load over the CPUs of the group */
-       unsigned long sum_nr_running; /* Nr tasks running in the group */
-       unsigned long sum_weighted_load; /* Weighted load of group's tasks */
-       unsigned long group_capacity;
-       int group_imb; /* Is there an imbalance in the group ? */
-};
-
-/**
- * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
- * @group: The group whose first cpu is to be returned.
- */
-static inline unsigned int group_first_cpu(struct sched_group *group)
-{
-       return cpumask_first(sched_group_cpus(group));
-}
-
-/**
- * get_sd_load_idx - Obtain the load index for a given sched domain.
- * @sd: The sched_domain whose load_idx is to be obtained.
- * @idle: The Idle status of the CPU for whose sd load_icx is obtained.
- */
-static inline int get_sd_load_idx(struct sched_domain *sd,
-                                       enum cpu_idle_type idle)
-{
-       int load_idx;
-
-       switch (idle) {
-       case CPU_NOT_IDLE:
-               load_idx = sd->busy_idx;
-               break;
-
-       case CPU_NEWLY_IDLE:
-               load_idx = sd->newidle_idx;
-               break;
-       default:
-               load_idx = sd->idle_idx;
-               break;
-       }
-
-       return load_idx;
-}
-
-
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-/**
- * init_sd_power_savings_stats - Initialize power savings statistics for
- * the given sched_domain, during load balancing.
- *
- * @sd: Sched domain whose power-savings statistics are to be initialized.
- * @sds: Variable containing the statistics for sd.
- * @idle: Idle status of the CPU at which we're performing load-balancing.
- */
-static inline void init_sd_power_savings_stats(struct sched_domain *sd,
-       struct sd_lb_stats *sds, enum cpu_idle_type idle)
-{
-       /*
-        * Busy processors will not participate in power savings
-        * balance.
-        */
-       if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
-               sds->power_savings_balance = 0;
-       else {
-               sds->power_savings_balance = 1;
-               sds->min_nr_running = ULONG_MAX;
-               sds->leader_nr_running = 0;
-       }
-}
-
-/**
- * update_sd_power_savings_stats - Update the power saving stats for a
- * sched_domain while performing load balancing.
- *
- * @group: sched_group belonging to the sched_domain under consideration.
- * @sds: Variable containing the statistics of the sched_domain
- * @local_group: Does group contain the CPU for which we're performing
- *             load balancing ?
- * @sgs: Variable containing the statistics of the group.
- */
-static inline void update_sd_power_savings_stats(struct sched_group *group,
-       struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
-{
-
-       if (!sds->power_savings_balance)
-               return;
-
-       /*
-        * If the local group is idle or completely loaded
-        * no need to do power savings balance at this domain
-        */
-       if (local_group && (sds->this_nr_running >= sgs->group_capacity ||
-                               !sds->this_nr_running))
-               sds->power_savings_balance = 0;
-
-       /*
-        * If a group is already running at full capacity or idle,
-        * don't include that group in power savings calculations
-        */
-       if (!sds->power_savings_balance ||
-               sgs->sum_nr_running >= sgs->group_capacity ||
-               !sgs->sum_nr_running)
-               return;
-
-       /*
-        * Calculate the group which has the least non-idle load.
-        * This is the group from where we need to pick up the load
-        * for saving power
-        */
-       if ((sgs->sum_nr_running < sds->min_nr_running) ||
-           (sgs->sum_nr_running == sds->min_nr_running &&
-            group_first_cpu(group) > group_first_cpu(sds->group_min))) {
-               sds->group_min = group;
-               sds->min_nr_running = sgs->sum_nr_running;
-               sds->min_load_per_task = sgs->sum_weighted_load /
-                                               sgs->sum_nr_running;
-       }
-
-       /*
-        * Calculate the group which is almost near its
-        * capacity but still has some space to pick up some load
-        * from other group and save more power
-        */
-       if (sgs->sum_nr_running + 1 > sgs->group_capacity)
-               return;
-
-       if (sgs->sum_nr_running > sds->leader_nr_running ||
-           (sgs->sum_nr_running == sds->leader_nr_running &&
-            group_first_cpu(group) < group_first_cpu(sds->group_leader))) {
-               sds->group_leader = group;
-               sds->leader_nr_running = sgs->sum_nr_running;
-       }
-}
-
-/**
- * check_power_save_busiest_group - see if there is potential for some power-savings balance
- * @sds: Variable containing the statistics of the sched_domain
- *     under consideration.
- * @this_cpu: Cpu at which we're currently performing load-balancing.
- * @imbalance: Variable to store the imbalance.
- *
- * Description:
- * Check if we have potential to perform some power-savings balance.
- * If yes, set the busiest group to be the least loaded group in the
- * sched_domain, so that it's CPUs can be put to idle.
- *
- * Returns 1 if there is potential to perform power-savings balance.
- * Else returns 0.
- */
-static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
-                                       int this_cpu, unsigned long *imbalance)
-{
-       if (!sds->power_savings_balance)
-               return 0;
-
-       if (sds->this != sds->group_leader ||
-                       sds->group_leader == sds->group_min)
-               return 0;
-
-       *imbalance = sds->min_load_per_task;
-       sds->busiest = sds->group_min;
-
-       return 1;
-
-}
-#else /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
-static inline void init_sd_power_savings_stats(struct sched_domain *sd,
-       struct sd_lb_stats *sds, enum cpu_idle_type idle)
-{
-       return;
-}
-
-static inline void update_sd_power_savings_stats(struct sched_group *group,
-       struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
-{
-       return;
-}
-
-static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
-                                       int this_cpu, unsigned long *imbalance)
-{
-       return 0;
-}
-#endif /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
-
-
-unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
-{
-       return SCHED_LOAD_SCALE;
-}
-
-unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
-{
-       return default_scale_freq_power(sd, cpu);
-}
-
-unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
-{
-       unsigned long weight = cpumask_weight(sched_domain_span(sd));
-       unsigned long smt_gain = sd->smt_gain;
-
-       smt_gain /= weight;
-
-       return smt_gain;
-}
-
-unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
-{
-       return default_scale_smt_power(sd, cpu);
-}
-
-unsigned long scale_rt_power(int cpu)
-{
-       struct rq *rq = cpu_rq(cpu);
-       u64 total, available;
-
-       sched_avg_update(rq);
-
-       total = sched_avg_period() + (rq->clock - rq->age_stamp);
-       available = total - rq->rt_avg;
-
-       if (unlikely((s64)total < SCHED_LOAD_SCALE))
-               total = SCHED_LOAD_SCALE;
-
-       total >>= SCHED_LOAD_SHIFT;
-
-       return div_u64(available, total);
-}
-
-static void update_cpu_power(struct sched_domain *sd, int cpu)
-{
-       unsigned long weight = cpumask_weight(sched_domain_span(sd));
-       unsigned long power = SCHED_LOAD_SCALE;
-       struct sched_group *sdg = sd->groups;
-
-       if (sched_feat(ARCH_POWER))
-               power *= arch_scale_freq_power(sd, cpu);
-       else
-               power *= default_scale_freq_power(sd, cpu);
-
-       power >>= SCHED_LOAD_SHIFT;
-
-       if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
-               if (sched_feat(ARCH_POWER))
-                       power *= arch_scale_smt_power(sd, cpu);
-               else
-                       power *= default_scale_smt_power(sd, cpu);
-
-               power >>= SCHED_LOAD_SHIFT;
-       }
-
-       power *= scale_rt_power(cpu);
-       power >>= SCHED_LOAD_SHIFT;
-
-       if (!power)
-               power = 1;
-
-       sdg->cpu_power = power;
-}
-
-static void update_group_power(struct sched_domain *sd, int cpu)
-{
-       struct sched_domain *child = sd->child;
-       struct sched_group *group, *sdg = sd->groups;
-       unsigned long power;
-
-       if (!child) {
-               update_cpu_power(sd, cpu);
-               return;
-       }
-
-       power = 0;
-
-       group = child->groups;
-       do {
-               power += group->cpu_power;
-               group = group->next;
-       } while (group != child->groups);
-
-       sdg->cpu_power = power;
-}
-
-/**
- * update_sg_lb_stats - Update sched_group's statistics for load balancing.
- * @sd: The sched_domain whose statistics are to be updated.
- * @group: sched_group whose statistics are to be updated.
- * @this_cpu: Cpu for which load balance is currently performed.
- * @idle: Idle status of this_cpu
- * @load_idx: Load index of sched_domain of this_cpu for load calc.
- * @sd_idle: Idle status of the sched_domain containing group.
- * @local_group: Does group contain this_cpu.
- * @cpus: Set of cpus considered for load balancing.
- * @balance: Should we balance.
- * @sgs: variable to hold the statistics for this group.
- */
-static inline void update_sg_lb_stats(struct sched_domain *sd,
-                       struct sched_group *group, int this_cpu,
-                       enum cpu_idle_type idle, int load_idx, int *sd_idle,
-                       int local_group, const struct cpumask *cpus,
-                       int *balance, struct sg_lb_stats *sgs)
-{
-       unsigned long load, max_cpu_load, min_cpu_load;
-       int i;
-       unsigned int balance_cpu = -1, first_idle_cpu = 0;
-       unsigned long sum_avg_load_per_task;
-       unsigned long avg_load_per_task;
-
-       if (local_group) {
-               balance_cpu = group_first_cpu(group);
-               if (balance_cpu == this_cpu)
-                       update_group_power(sd, this_cpu);
-       }
-
-       /* Tally up the load of all CPUs in the group */
-       sum_avg_load_per_task = avg_load_per_task = 0;
-       max_cpu_load = 0;
-       min_cpu_load = ~0UL;
-
-       for_each_cpu_and(i, sched_group_cpus(group), cpus) {
-               struct rq *rq = cpu_rq(i);
-
-               if (*sd_idle && rq->nr_running)
-                       *sd_idle = 0;
-
-               /* Bias balancing toward cpus of our domain */
-               if (local_group) {
-                       if (idle_cpu(i) && !first_idle_cpu) {
-                               first_idle_cpu = 1;
-                               balance_cpu = i;
-                       }
-
-                       load = target_load(i, load_idx);
-               } else {
-                       load = source_load(i, load_idx);
-                       if (load > max_cpu_load)
-                               max_cpu_load = load;
-                       if (min_cpu_load > load)
-                               min_cpu_load = load;
-               }
-
-               sgs->group_load += load;
-               sgs->sum_nr_running += rq->nr_running;
-               sgs->sum_weighted_load += weighted_cpuload(i);
-
-               sum_avg_load_per_task += cpu_avg_load_per_task(i);
-       }
-
-       /*
-        * First idle cpu or the first cpu(busiest) in this sched group
-        * is eligible for doing load balancing at this and above
-        * domains. In the newly idle case, we will allow all the cpu's
-        * to do the newly idle load balance.
-        */
-       if (idle != CPU_NEWLY_IDLE && local_group &&
-           balance_cpu != this_cpu && balance) {
-               *balance = 0;
-               return;
-       }
-
-       /* Adjust by relative CPU power of the group */
-       sgs->avg_load = (sgs->group_load * SCHED_LOAD_SCALE) / group->cpu_power;
-
-
-       /*
-        * Consider the group unbalanced when the imbalance is larger
-        * than the average weight of two tasks.
-        *
-        * APZ: with cgroup the avg task weight can vary wildly and
-        *      might not be a suitable number - should we keep a
-        *      normalized nr_running number somewhere that negates
-        *      the hierarchy?
-        */
-       avg_load_per_task = (sum_avg_load_per_task * SCHED_LOAD_SCALE) /
-               group->cpu_power;
-
-       if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task)
-               sgs->group_imb = 1;
-
-       sgs->group_capacity =
-               DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
-}
-
-/**
- * update_sd_lb_stats - Update sched_group's statistics for load balancing.
- * @sd: sched_domain whose statistics are to be updated.
- * @this_cpu: Cpu for which load balance is currently performed.
- * @idle: Idle status of this_cpu
- * @sd_idle: Idle status of the sched_domain containing group.
- * @cpus: Set of cpus considered for load balancing.
- * @balance: Should we balance.
- * @sds: variable to hold the statistics for this sched_domain.
- */
-static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
-                       enum cpu_idle_type idle, int *sd_idle,
-                       const struct cpumask *cpus, int *balance,
-                       struct sd_lb_stats *sds)
-{
-       struct sched_domain *child = sd->child;
-       struct sched_group *group = sd->groups;
-       struct sg_lb_stats sgs;
-       int load_idx, prefer_sibling = 0;
-
-       if (child && child->flags & SD_PREFER_SIBLING)
-               prefer_sibling = 1;
-
-       init_sd_power_savings_stats(sd, sds, idle);
-       load_idx = get_sd_load_idx(sd, idle);
-
-       do {
-               int local_group;
-
-               local_group = cpumask_test_cpu(this_cpu,
-                                              sched_group_cpus(group));
-               memset(&sgs, 0, sizeof(sgs));
-               update_sg_lb_stats(sd, group, this_cpu, idle, load_idx, sd_idle,
-                               local_group, cpus, balance, &sgs);
-
-               if (local_group && balance && !(*balance))
-                       return;
-
-               sds->total_load += sgs.group_load;
-               sds->total_pwr += group->cpu_power;
-
-               /*
-                * In case the child domain prefers tasks go to siblings
-                * first, lower the group capacity to one so that we'll try
-                * and move all the excess tasks away.
-                */
-               if (prefer_sibling)
-                       sgs.group_capacity = min(sgs.group_capacity, 1UL);
-
-               if (local_group) {
-                       sds->this_load = sgs.avg_load;
-                       sds->this = group;
-                       sds->this_nr_running = sgs.sum_nr_running;
-                       sds->this_load_per_task = sgs.sum_weighted_load;
-               } else if (sgs.avg_load > sds->max_load &&
-                          (sgs.sum_nr_running > sgs.group_capacity ||
-                               sgs.group_imb)) {
-                       sds->max_load = sgs.avg_load;
-                       sds->busiest = group;
-                       sds->busiest_nr_running = sgs.sum_nr_running;
-                       sds->busiest_load_per_task = sgs.sum_weighted_load;
-                       sds->group_imb = sgs.group_imb;
-               }
-
-               update_sd_power_savings_stats(group, sds, local_group, &sgs);
-               group = group->next;
-       } while (group != sd->groups);
-}
-
-/**
- * fix_small_imbalance - Calculate the minor imbalance that exists
- *                     amongst the groups of a sched_domain, during
- *                     load balancing.
- * @sds: Statistics of the sched_domain whose imbalance is to be calculated.
- * @this_cpu: The cpu at whose sched_domain we're performing load-balance.
- * @imbalance: Variable to store the imbalance.
- */
-static inline void fix_small_imbalance(struct sd_lb_stats *sds,
-                               int this_cpu, unsigned long *imbalance)
-{
-       unsigned long tmp, pwr_now = 0, pwr_move = 0;
-       unsigned int imbn = 2;
-
-       if (sds->this_nr_running) {
-               sds->this_load_per_task /= sds->this_nr_running;
-               if (sds->busiest_load_per_task >
-                               sds->this_load_per_task)
-                       imbn = 1;
-       } else
-               sds->this_load_per_task =
-                       cpu_avg_load_per_task(this_cpu);
-
-       if (sds->max_load - sds->this_load + sds->busiest_load_per_task >=
-                       sds->busiest_load_per_task * imbn) {
-               *imbalance = sds->busiest_load_per_task;
-               return;
-       }
-
-       /*
-        * OK, we don't have enough imbalance to justify moving tasks,
-        * however we may be able to increase total CPU power used by
-        * moving them.
-        */
-
-       pwr_now += sds->busiest->cpu_power *
-                       min(sds->busiest_load_per_task, sds->max_load);
-       pwr_now += sds->this->cpu_power *
-                       min(sds->this_load_per_task, sds->this_load);
-       pwr_now /= SCHED_LOAD_SCALE;
-
-       /* Amount of load we'd subtract */
-       tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
-               sds->busiest->cpu_power;
-       if (sds->max_load > tmp)
-               pwr_move += sds->busiest->cpu_power *
-                       min(sds->busiest_load_per_task, sds->max_load - tmp);
-
-       /* Amount of load we'd add */
-       if (sds->max_load * sds->busiest->cpu_power <
-               sds->busiest_load_per_task * SCHED_LOAD_SCALE)
-               tmp = (sds->max_load * sds->busiest->cpu_power) /
-                       sds->this->cpu_power;
-       else
-               tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
-                       sds->this->cpu_power;
-       pwr_move += sds->this->cpu_power *
-                       min(sds->this_load_per_task, sds->this_load + tmp);
-       pwr_move /= SCHED_LOAD_SCALE;
-
-       /* Move if we gain throughput */
-       if (pwr_move > pwr_now)
-               *imbalance = sds->busiest_load_per_task;
-}
-
-/**
- * calculate_imbalance - Calculate the amount of imbalance present within the
- *                      groups of a given sched_domain during load balance.
- * @sds: statistics of the sched_domain whose imbalance is to be calculated.
- * @this_cpu: Cpu for which currently load balance is being performed.
- * @imbalance: The variable to store the imbalance.
- */
-static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu,
-               unsigned long *imbalance)
-{
-       unsigned long max_pull;
-       /*
-        * In the presence of smp nice balancing, certain scenarios can have
-        * max load less than avg load(as we skip the groups at or below
-        * its cpu_power, while calculating max_load..)
-        */
-       if (sds->max_load < sds->avg_load) {
-               *imbalance = 0;
-               return fix_small_imbalance(sds, this_cpu, imbalance);
-       }
-
-       /* Don't want to pull so many tasks that a group would go idle */
-       max_pull = min(sds->max_load - sds->avg_load,
-                       sds->max_load - sds->busiest_load_per_task);
-
-       /* How much load to actually move to equalise the imbalance */
-       *imbalance = min(max_pull * sds->busiest->cpu_power,
-               (sds->avg_load - sds->this_load) * sds->this->cpu_power)
-                       / SCHED_LOAD_SCALE;
-
-       /*
-        * if *imbalance is less than the average load per runnable task
-        * there is no gaurantee that any tasks will be moved so we'll have
-        * a think about bumping its value to force at least one task to be
-        * moved
-        */
-       if (*imbalance < sds->busiest_load_per_task)
-               return fix_small_imbalance(sds, this_cpu, imbalance);
-
-}
-/******* find_busiest_group() helpers end here *********************/
-
-/**
- * find_busiest_group - Returns the busiest group within the sched_domain
- * if there is an imbalance. If there isn't an imbalance, and
- * the user has opted for power-savings, it returns a group whose
- * CPUs can be put to idle by rebalancing those tasks elsewhere, if
- * such a group exists.
- *
- * Also calculates the amount of weighted load which should be moved
- * to restore balance.
- *
- * @sd: The sched_domain whose busiest group is to be returned.
- * @this_cpu: The cpu for which load balancing is currently being performed.
- * @imbalance: Variable which stores amount of weighted load which should
- *             be moved to restore balance/put a group to idle.
- * @idle: The idle status of this_cpu.
- * @sd_idle: The idleness of sd
- * @cpus: The set of CPUs under consideration for load-balancing.
- * @balance: Pointer to a variable indicating if this_cpu
- *     is the appropriate cpu to perform load balancing at this_level.
- *
- * Returns:    - the busiest group if imbalance exists.
- *             - If no imbalance and user has opted for power-savings balance,
- *                return the least loaded group whose CPUs can be
- *                put to idle by rebalancing its tasks onto our group.
- */
-static struct sched_group *
-find_busiest_group(struct sched_domain *sd, int this_cpu,
-                  unsigned long *imbalance, enum cpu_idle_type idle,
-                  int *sd_idle, const struct cpumask *cpus, int *balance)
-{
-       struct sd_lb_stats sds;
-
-       memset(&sds, 0, sizeof(sds));
-
-       /*
-        * Compute the various statistics relavent for load balancing at
-        * this level.
-        */
-       update_sd_lb_stats(sd, this_cpu, idle, sd_idle, cpus,
-                                       balance, &sds);
-
-       /* Cases where imbalance does not exist from POV of this_cpu */
-       /* 1) this_cpu is not the appropriate cpu to perform load balancing
-        *    at this level.
-        * 2) There is no busy sibling group to pull from.
-        * 3) This group is the busiest group.
-        * 4) This group is more busy than the avg busieness at this
-        *    sched_domain.
-        * 5) The imbalance is within the specified limit.
-        * 6) Any rebalance would lead to ping-pong
-        */
-       if (balance && !(*balance))
-               goto ret;
-
-       if (!sds.busiest || sds.busiest_nr_running == 0)
-               goto out_balanced;
-
-       if (sds.this_load >= sds.max_load)
-               goto out_balanced;
-
-       sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr;
-
-       if (sds.this_load >= sds.avg_load)
-               goto out_balanced;
-
-       if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
-               goto out_balanced;
-
-       sds.busiest_load_per_task /= sds.busiest_nr_running;
-       if (sds.group_imb)
-               sds.busiest_load_per_task =
-                       min(sds.busiest_load_per_task, sds.avg_load);
-
-       /*
-        * We're trying to get all the cpus to the average_load, so we don't
-        * want to push ourselves above the average load, nor do we wish to
-        * reduce the max loaded cpu below the average load, as either of these
-        * actions would just result in more rebalancing later, and ping-pong
-        * tasks around. Thus we look for the minimum possible imbalance.
-        * Negative imbalances (*we* are more loaded than anyone else) will
-        * be counted as no imbalance for these purposes -- we can't fix that
-        * by pulling tasks to us. Be careful of negative numbers as they'll
-        * appear as very large values with unsigned longs.
-        */
-       if (sds.max_load <= sds.busiest_load_per_task)
-               goto out_balanced;
-
-       /* Looks like there is an imbalance. Compute it */
-       calculate_imbalance(&sds, this_cpu, imbalance);
-       return sds.busiest;
-
-out_balanced:
-       /*
-        * There is no obvious imbalance. But check if we can do some balancing
-        * to save power.
-        */
-       if (check_power_save_busiest_group(&sds, this_cpu, imbalance))
-               return sds.busiest;
-ret:
-       *imbalance = 0;
-       return NULL;
-}
-
-/*
- * find_busiest_queue - find the busiest runqueue among the cpus in group.
- */
-static struct rq *
-find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
-                  unsigned long imbalance, const struct cpumask *cpus)
-{
-       struct rq *busiest = NULL, *rq;
-       unsigned long max_load = 0;
-       int i;
-
-       for_each_cpu(i, sched_group_cpus(group)) {
-               unsigned long power = power_of(i);
-               unsigned long capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
-               unsigned long wl;
-
-               if (!cpumask_test_cpu(i, cpus))
-                       continue;
-
-               rq = cpu_rq(i);
-               wl = weighted_cpuload(i) * SCHED_LOAD_SCALE;
-               wl /= power;
-
-               if (capacity && rq->nr_running == 1 && wl > imbalance)
-                       continue;
-
-               if (wl > max_load) {
-                       max_load = wl;
-                       busiest = rq;
-               }
-       }
-
-       return busiest;
-}
-
-/*
- * Max backoff if we encounter pinned tasks. Pretty arbitrary value, but
- * so long as it is large enough.
- */
-#define MAX_PINNED_INTERVAL    512
-
-/* Working cpumask for load_balance and load_balance_newidle. */
-static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
-
-/*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- */
-static int load_balance(int this_cpu, struct rq *this_rq,
-                       struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *balance)
-{
-       int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
-       struct sched_group *group;
-       unsigned long imbalance;
-       struct rq *busiest;
-       unsigned long flags;
-       struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
-
-       cpumask_copy(cpus, cpu_active_mask);
-
-       /*
-        * When power savings policy is enabled for the parent domain, idle
-        * sibling can pick up load irrespective of busy siblings. In this case,
-        * let the state of idle sibling percolate up as CPU_IDLE, instead of
-        * portraying it as CPU_NOT_IDLE.
-        */
-       if (idle != CPU_NOT_IDLE && sd->flags & SD_SHARE_CPUPOWER &&
-           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-               sd_idle = 1;
-
-       schedstat_inc(sd, lb_count[idle]);
-
-redo:
-       update_shares(sd);
-       group = find_busiest_group(sd, this_cpu, &imbalance, idle, &sd_idle,
-                                  cpus, balance);
-
-       if (*balance == 0)
-               goto out_balanced;
-
-       if (!group) {
-               schedstat_inc(sd, lb_nobusyg[idle]);
-               goto out_balanced;
-       }
-
-       busiest = find_busiest_queue(group, idle, imbalance, cpus);
-       if (!busiest) {
-               schedstat_inc(sd, lb_nobusyq[idle]);
-               goto out_balanced;
-       }
-
-       BUG_ON(busiest == this_rq);
-
-       schedstat_add(sd, lb_imbalance[idle], imbalance);
-
-       ld_moved = 0;
-       if (busiest->nr_running > 1) {
-               /*
-                * Attempt to move tasks. If find_busiest_group has found
-                * an imbalance but busiest->nr_running <= 1, the group is
-                * still unbalanced. ld_moved simply stays zero, so it is
-                * correctly treated as an imbalance.
-                */
-               local_irq_save(flags);
-               double_rq_lock(this_rq, busiest);
-               ld_moved = move_tasks(this_rq, this_cpu, busiest,
-                                     imbalance, sd, idle, &all_pinned);
-               double_rq_unlock(this_rq, busiest);
-               local_irq_restore(flags);
-
-               /*
-                * some other cpu did the load balance for us.
-                */
-               if (ld_moved && this_cpu != smp_processor_id())
-                       resched_cpu(this_cpu);
-
-               /* All tasks on this runqueue were pinned by CPU affinity */
-               if (unlikely(all_pinned)) {
-                       cpumask_clear_cpu(cpu_of(busiest), cpus);
-                       if (!cpumask_empty(cpus))
-                               goto redo;
-                       goto out_balanced;
-               }
-       }
-
-       if (!ld_moved) {
-               schedstat_inc(sd, lb_failed[idle]);
-               sd->nr_balance_failed++;
-
-               if (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {
-
-                       raw_spin_lock_irqsave(&busiest->lock, flags);
-
-                       /* don't kick the migration_thread, if the curr
-                        * task on busiest cpu can't be moved to this_cpu
-                        */
-                       if (!cpumask_test_cpu(this_cpu,
-                                             &busiest->curr->cpus_allowed)) {
-                               raw_spin_unlock_irqrestore(&busiest->lock,
-                                                           flags);
-                               all_pinned = 1;
-                               goto out_one_pinned;
-                       }
-
-                       if (!busiest->active_balance) {
-                               busiest->active_balance = 1;
-                               busiest->push_cpu = this_cpu;
-                               active_balance = 1;
-                       }
-                       raw_spin_unlock_irqrestore(&busiest->lock, flags);
-                       if (active_balance)
-                               wake_up_process(busiest->migration_thread);
-
-                       /*
-                        * We've kicked active balancing, reset the failure
-                        * counter.
-                        */
-                       sd->nr_balance_failed = sd->cache_nice_tries+1;
-               }
-       } else
-               sd->nr_balance_failed = 0;
-
-       if (likely(!active_balance)) {
-               /* We were unbalanced, so reset the balancing interval */
-               sd->balance_interval = sd->min_interval;
-       } else {
-               /*
-                * If we've begun active balancing, start to back off. This
-                * case may not be covered by the all_pinned logic if there
-                * is only 1 task on the busy runqueue (because we don't call
-                * move_tasks).
-                */
-               if (sd->balance_interval < sd->max_interval)
-                       sd->balance_interval *= 2;
-       }
-
-       if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-               ld_moved = -1;
-
-       goto out;
-
-out_balanced:
-       schedstat_inc(sd, lb_balanced[idle]);
-
-       sd->nr_balance_failed = 0;
-
-out_one_pinned:
-       /* tune up the balancing interval */
-       if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
-                       (sd->balance_interval < sd->max_interval))
-               sd->balance_interval *= 2;
-
-       if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-               ld_moved = -1;
-       else
-               ld_moved = 0;
-out:
-       if (ld_moved)
-               update_shares(sd);
-       return ld_moved;
-}
-
-/*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- *
- * Called from schedule when this_rq is about to become idle (CPU_NEWLY_IDLE).
- * this_rq is locked.
- */
-static int
-load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
-{
-       struct sched_group *group;
-       struct rq *busiest = NULL;
-       unsigned long imbalance;
-       int ld_moved = 0;
-       int sd_idle = 0;
-       int all_pinned = 0;
-       struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
-
-       cpumask_copy(cpus, cpu_active_mask);
-
-       /*
-        * When power savings policy is enabled for the parent domain, idle
-        * sibling can pick up load irrespective of busy siblings. In this case,
-        * let the state of idle sibling percolate up as IDLE, instead of
-        * portraying it as CPU_NOT_IDLE.
-        */
-       if (sd->flags & SD_SHARE_CPUPOWER &&
-           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-               sd_idle = 1;
-
-       schedstat_inc(sd, lb_count[CPU_NEWLY_IDLE]);
-redo:
-       update_shares_locked(this_rq, sd);
-       group = find_busiest_group(sd, this_cpu, &imbalance, CPU_NEWLY_IDLE,
-                                  &sd_idle, cpus, NULL);
-       if (!group) {
-               schedstat_inc(sd, lb_nobusyg[CPU_NEWLY_IDLE]);
-               goto out_balanced;
-       }
-
-       busiest = find_busiest_queue(group, CPU_NEWLY_IDLE, imbalance, cpus);
-       if (!busiest) {
-               schedstat_inc(sd, lb_nobusyq[CPU_NEWLY_IDLE]);
-               goto out_balanced;
-       }
-
-       BUG_ON(busiest == this_rq);
-
-       schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
-
-       ld_moved = 0;
-       if (busiest->nr_running > 1) {
-               /* Attempt to move tasks */
-               double_lock_balance(this_rq, busiest);
-               /* this_rq->clock is already updated */
-               update_rq_clock(busiest);
-               ld_moved = move_tasks(this_rq, this_cpu, busiest,
-                                       imbalance, sd, CPU_NEWLY_IDLE,
-                                       &all_pinned);
-               double_unlock_balance(this_rq, busiest);
-
-               if (unlikely(all_pinned)) {
-                       cpumask_clear_cpu(cpu_of(busiest), cpus);
-                       if (!cpumask_empty(cpus))
-                               goto redo;
-               }
-       }
-
-       if (!ld_moved) {
-               int active_balance = 0;
-
-               schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
-               if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-                   !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-                       return -1;
-
-               if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
-                       return -1;
-
-               if (sd->nr_balance_failed++ < 2)
-                       return -1;
-
-               /*
-                * The only task running in a non-idle cpu can be moved to this
-                * cpu in an attempt to completely freeup the other CPU
-                * package. The same method used to move task in load_balance()
-                * have been extended for load_balance_newidle() to speedup
-                * consolidation at sched_mc=POWERSAVINGS_BALANCE_WAKEUP (2)
-                *
-                * The package power saving logic comes from
-                * find_busiest_group().  If there are no imbalance, then
-                * f_b_g() will return NULL.  However when sched_mc={1,2} then
-                * f_b_g() will select a group from which a running task may be
-                * pulled to this cpu in order to make the other package idle.
-                * If there is no opportunity to make a package idle and if
-                * there are no imbalance, then f_b_g() will return NULL and no
-                * action will be taken in load_balance_newidle().
-                *
-                * Under normal task pull operation due to imbalance, there
-                * will be more than one task in the source run queue and
-                * move_tasks() will succeed.  ld_moved will be true and this
-                * active balance code will not be triggered.
-                */
-
-               /* Lock busiest in correct order while this_rq is held */
-               double_lock_balance(this_rq, busiest);
-
-               /*
-                * don't kick the migration_thread, if the curr
-                * task on busiest cpu can't be moved to this_cpu
-                */
-               if (!cpumask_test_cpu(this_cpu, &busiest->curr->cpus_allowed)) {
-                       double_unlock_balance(this_rq, busiest);
-                       all_pinned = 1;
-                       return ld_moved;
-               }
-
-               if (!busiest->active_balance) {
-                       busiest->active_balance = 1;
-                       busiest->push_cpu = this_cpu;
-                       active_balance = 1;
-               }
-
-               double_unlock_balance(this_rq, busiest);
-               /*
-                * Should not call ttwu while holding a rq->lock
-                */
-               raw_spin_unlock(&this_rq->lock);
-               if (active_balance)
-                       wake_up_process(busiest->migration_thread);
-               raw_spin_lock(&this_rq->lock);
-
-       } else
-               sd->nr_balance_failed = 0;
-
-       update_shares_locked(this_rq, sd);
-       return ld_moved;
-
-out_balanced:
-       schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
-       if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-               return -1;
-       sd->nr_balance_failed = 0;
-
-       return 0;
-}
-
-/*
- * idle_balance is called by schedule() if this_cpu is about to become
- * idle. Attempts to pull tasks from other CPUs.
- */
-static void idle_balance(int this_cpu, struct rq *this_rq)
-{
-       struct sched_domain *sd;
-       int pulled_task = 0;
-       unsigned long next_balance = jiffies + HZ;
-
-       this_rq->idle_stamp = this_rq->clock;
-
-       if (this_rq->avg_idle < sysctl_sched_migration_cost)
-               return;
-
-       for_each_domain(this_cpu, sd) {
-               unsigned long interval;
-
-               if (!(sd->flags & SD_LOAD_BALANCE))
-                       continue;
-
-               if (sd->flags & SD_BALANCE_NEWIDLE)
-                       /* If we've pulled tasks over stop searching: */
-                       pulled_task = load_balance_newidle(this_cpu, this_rq,
-                                                          sd);
-
-               interval = msecs_to_jiffies(sd->balance_interval);
-               if (time_after(next_balance, sd->last_balance + interval))
-                       next_balance = sd->last_balance + interval;
-               if (pulled_task) {
-                       this_rq->idle_stamp = 0;
-                       break;
-               }
-       }
-       if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
-               /*
-                * We are going idle. next_balance may be set based on
-                * a busy processor. So reset next_balance.
-                */
-               this_rq->next_balance = next_balance;
-       }
-}
-
-/*
- * active_load_balance is run by migration threads. It pushes running tasks
- * off the busiest CPU onto idle CPUs. It requires at least 1 task to be
- * running on each physical CPU where possible, and avoids physical /
- * logical imbalances.
- *
- * Called with busiest_rq locked.
- */
-static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
-{
-       int target_cpu = busiest_rq->push_cpu;
-       struct sched_domain *sd;
-       struct rq *target_rq;
-
-       /* Is there any task to move? */
-       if (busiest_rq->nr_running <= 1)
-               return;
-
-       target_rq = cpu_rq(target_cpu);
-
-       /*
-        * This condition is "impossible", if it occurs
-        * we need to fix it. Originally reported by
-        * Bjorn Helgaas on a 128-cpu setup.
-        */
-       BUG_ON(busiest_rq == target_rq);
-
-       /* move a task from busiest_rq to target_rq */
-       double_lock_balance(busiest_rq, target_rq);
-       update_rq_clock(busiest_rq);
-       update_rq_clock(target_rq);
-
-       /* Search for an sd spanning us and the target CPU. */
-       for_each_domain(target_cpu, sd) {
-               if ((sd->flags & SD_LOAD_BALANCE) &&
-                   cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
-                               break;
-       }
-
-       if (likely(sd)) {
-               schedstat_inc(sd, alb_count);
-
-               if (move_one_task(target_rq, target_cpu, busiest_rq,
-                                 sd, CPU_IDLE))
-                       schedstat_inc(sd, alb_pushed);
-               else
-                       schedstat_inc(sd, alb_failed);
-       }
-       double_unlock_balance(busiest_rq, target_rq);
-}
-
-#ifdef CONFIG_NO_HZ
-static struct {
-       atomic_t load_balancer;
-       cpumask_var_t cpu_mask;
-       cpumask_var_t ilb_grp_nohz_mask;
-} nohz ____cacheline_aligned = {
-       .load_balancer = ATOMIC_INIT(-1),
-};
-
-int get_nohz_load_balancer(void)
-{
-       return atomic_read(&nohz.load_balancer);
-}
-
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-/**
- * lowest_flag_domain - Return lowest sched_domain containing flag.
- * @cpu:       The cpu whose lowest level of sched domain is to
- *             be returned.
- * @flag:      The flag to check for the lowest sched_domain
- *             for the given cpu.
- *
- * Returns the lowest sched_domain of a cpu which contains the given flag.
- */
-static inline struct sched_domain *lowest_flag_domain(int cpu, int flag)
-{
-       struct sched_domain *sd;
-
-       for_each_domain(cpu, sd)
-               if (sd && (sd->flags & flag))
-                       break;
-
-       return sd;
-}
-
-/**
- * for_each_flag_domain - Iterates over sched_domains containing the flag.
- * @cpu:       The cpu whose domains we're iterating over.
- * @sd:                variable holding the value of the power_savings_sd
- *             for cpu.
- * @flag:      The flag to filter the sched_domains to be iterated.
- *
- * Iterates over all the scheduler domains for a given cpu that has the 'flag'
- * set, starting from the lowest sched_domain to the highest.
- */
-#define for_each_flag_domain(cpu, sd, flag) \
-       for (sd = lowest_flag_domain(cpu, flag); \
-               (sd && (sd->flags & flag)); sd = sd->parent)
-
-/**
- * is_semi_idle_group - Checks if the given sched_group is semi-idle.
- * @ilb_group: group to be checked for semi-idleness
- *
- * Returns:    1 if the group is semi-idle. 0 otherwise.
- *
- * We define a sched_group to be semi idle if it has atleast one idle-CPU
- * and atleast one non-idle CPU. This helper function checks if the given
- * sched_group is semi-idle or not.
- */
-static inline int is_semi_idle_group(struct sched_group *ilb_group)
-{
-       cpumask_and(nohz.ilb_grp_nohz_mask, nohz.cpu_mask,
-                                       sched_group_cpus(ilb_group));
-
-       /*
-        * A sched_group is semi-idle when it has atleast one busy cpu
-        * and atleast one idle cpu.
-        */
-       if (cpumask_empty(nohz.ilb_grp_nohz_mask))
-               return 0;
-
-       if (cpumask_equal(nohz.ilb_grp_nohz_mask, sched_group_cpus(ilb_group)))
-               return 0;
-
-       return 1;
-}
-/**
- * find_new_ilb - Finds the optimum idle load balancer for nomination.
- * @cpu:       The cpu which is nominating a new idle_load_balancer.
- *
- * Returns:    Returns the id of the idle load balancer if it exists,
- *             Else, returns >= nr_cpu_ids.
- *
- * This algorithm picks the idle load balancer such that it belongs to a
- * semi-idle powersavings sched_domain. The idea is to try and avoid
- * completely idle packages/cores just for the purpose of idle load balancing
- * when there are other idle cpu's which are better suited for that job.
- */
-static int find_new_ilb(int cpu)
-{
-       struct sched_domain *sd;
-       struct sched_group *ilb_group;
-
-       /*
-        * Have idle load balancer selection from semi-idle packages only
-        * when power-aware load balancing is enabled
-        */
-       if (!(sched_smt_power_savings || sched_mc_power_savings))
-               goto out_done;
-
-       /*
-        * Optimize for the case when we have no idle CPUs or only one
-        * idle CPU. Don't walk the sched_domain hierarchy in such cases
-        */
-       if (cpumask_weight(nohz.cpu_mask) < 2)
-               goto out_done;
-
-       for_each_flag_domain(cpu, sd, SD_POWERSAVINGS_BALANCE) {
-               ilb_group = sd->groups;
-
-               do {
-                       if (is_semi_idle_group(ilb_group))
-                               return cpumask_first(nohz.ilb_grp_nohz_mask);
+unsigned long nr_uninterruptible(void)
+{
+       unsigned long i, sum = 0;
 
-                       ilb_group = ilb_group->next;
+       for_each_possible_cpu(i)
+               sum += cpu_rq(i)->nr_uninterruptible;
 
-               } while (ilb_group != sd->groups);
-       }
+       /*
+        * Since we read the counters lockless, it might be slightly
+        * inaccurate. Do not allow it to go below zero though:
+        */
+       if (unlikely((long)sum < 0))
+               sum = 0;
 
-out_done:
-       return cpumask_first(nohz.cpu_mask);
-}
-#else /*  (CONFIG_SCHED_MC || CONFIG_SCHED_SMT) */
-static inline int find_new_ilb(int call_cpu)
-{
-       return cpumask_first(nohz.cpu_mask);
+       return sum;
 }
-#endif
 
-/*
- * This routine will try to nominate the ilb (idle load balancing)
- * owner among the cpus whose ticks are stopped. ilb owner will do the idle
- * load balancing on behalf of all those cpus. If all the cpus in the system
- * go into this tickless mode, then there will be no ilb owner (as there is
- * no need for one) and all the cpus will sleep till the next wakeup event
- * arrives...
- *
- * For the ilb owner, tick is not stopped. And this tick will be used
- * for idle load balancing. ilb owner will still be part of
- * nohz.cpu_mask..
- *
- * While stopping the tick, this cpu will become the ilb owner if there
- * is no other owner. And will be the owner till that cpu becomes busy
- * or if all cpus in the system stop their ticks at which point
- * there is no need for ilb owner.
- *
- * When the ilb owner becomes busy, it nominates another owner, during the
- * next busy scheduler_tick()
- */
-int select_nohz_load_balancer(int stop_tick)
+unsigned long long nr_context_switches(void)
 {
-       int cpu = smp_processor_id();
+       int i;
+       unsigned long long sum = 0;
 
-       if (stop_tick) {
-               cpu_rq(cpu)->in_nohz_recently = 1;
+       for_each_possible_cpu(i)
+               sum += cpu_rq(i)->nr_switches;
 
-               if (!cpu_active(cpu)) {
-                       if (atomic_read(&nohz.load_balancer) != cpu)
-                               return 0;
+       return sum;
+}
 
-                       /*
-                        * If we are going offline and still the leader,
-                        * give up!
-                        */
-                       if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
-                               BUG();
+unsigned long nr_iowait(void)
+{
+       unsigned long i, sum = 0;
 
-                       return 0;
-               }
+       for_each_possible_cpu(i)
+               sum += atomic_read(&cpu_rq(i)->nr_iowait);
 
-               cpumask_set_cpu(cpu, nohz.cpu_mask);
+       return sum;
+}
 
-               /* time for ilb owner also to sleep */
-               if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
-                       if (atomic_read(&nohz.load_balancer) == cpu)
-                               atomic_set(&nohz.load_balancer, -1);
-                       return 0;
-               }
+unsigned long nr_iowait_cpu(void)
+{
+       struct rq *this = this_rq();
+       return atomic_read(&this->nr_iowait);
+}
 
-               if (atomic_read(&nohz.load_balancer) == -1) {
-                       /* make me the ilb owner */
-                       if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
-                               return 1;
-               } else if (atomic_read(&nohz.load_balancer) == cpu) {
-                       int new_ilb;
+unsigned long this_cpu_load(void)
+{
+       struct rq *this = this_rq();
+       return this->cpu_load[0];
+}
 
-                       if (!(sched_smt_power_savings ||
-                                               sched_mc_power_savings))
-                               return 1;
-                       /*
-                        * Check to see if there is a more power-efficient
-                        * ilb.
-                        */
-                       new_ilb = find_new_ilb(cpu);
-                       if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
-                               atomic_set(&nohz.load_balancer, -1);
-                               resched_cpu(new_ilb);
-                               return 0;
-                       }
-                       return 1;
-               }
-       } else {
-               if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
-                       return 0;
 
-               cpumask_clear_cpu(cpu, nohz.cpu_mask);
+/* Variables and functions for calc_load */
+static atomic_long_t calc_load_tasks;
+static unsigned long calc_load_update;
+unsigned long avenrun[3];
+EXPORT_SYMBOL(avenrun);
 
-               if (atomic_read(&nohz.load_balancer) == cpu)
-                       if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
-                               BUG();
-       }
-       return 0;
+/**
+ * get_avenrun - get the load average array
+ * @loads:     pointer to dest load array
+ * @offset:    offset to add
+ * @shift:     shift count to shift the result left
+ *
+ * These values are estimates at best, so no need for locking.
+ */
+void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
+{
+       loads[0] = (avenrun[0] + offset) << shift;
+       loads[1] = (avenrun[1] + offset) << shift;
+       loads[2] = (avenrun[2] + offset) << shift;
 }
-#endif
 
-static DEFINE_SPINLOCK(balancing);
+static unsigned long
+calc_load(unsigned long load, unsigned long exp, unsigned long active)
+{
+       load *= exp;
+       load += active * (FIXED_1 - exp);
+       return load >> FSHIFT;
+}
 
 /*
- * It checks each scheduling domain to see if it is due to be balanced,
- * and initiates a balancing operation if so.
- *
- * Balancing parameters are set up in arch_init_sched_domains.
+ * calc_load - update the avenrun load estimates 10 ticks after the
+ * CPUs have updated calc_load_tasks.
  */
-static void rebalance_domains(int cpu, enum cpu_idle_type idle)
+void calc_global_load(void)
 {
-       int balance = 1;
-       struct rq *rq = cpu_rq(cpu);
-       unsigned long interval;
-       struct sched_domain *sd;
-       /* Earliest time when we have to do rebalance again */
-       unsigned long next_balance = jiffies + 60*HZ;
-       int update_next_balance = 0;
-       int need_serialize;
+       unsigned long upd = calc_load_update + 10;
+       long active;
 
-       for_each_domain(cpu, sd) {
-               if (!(sd->flags & SD_LOAD_BALANCE))
-                       continue;
+       if (time_before(jiffies, upd))
+               return;
 
-               interval = sd->balance_interval;
-               if (idle != CPU_IDLE)
-                       interval *= sd->busy_factor;
+       active = atomic_long_read(&calc_load_tasks);
+       active = active > 0 ? active * FIXED_1 : 0;
 
-               /* scale ms to jiffies */
-               interval = msecs_to_jiffies(interval);
-               if (unlikely(!interval))
-                       interval = 1;
-               if (interval > HZ*NR_CPUS/10)
-                       interval = HZ*NR_CPUS/10;
+       avenrun[0] = calc_load(avenrun[0], EXP_1, active);
+       avenrun[1] = calc_load(avenrun[1], EXP_5, active);
+       avenrun[2] = calc_load(avenrun[2], EXP_15, active);
 
-               need_serialize = sd->flags & SD_SERIALIZE;
+       calc_load_update += LOAD_FREQ;
+}
 
-               if (need_serialize) {
-                       if (!spin_trylock(&balancing))
-                               goto out;
-               }
+/*
+ * Either called from update_cpu_load() or from a cpu going idle
+ */
+static void calc_load_account_active(struct rq *this_rq)
+{
+       long nr_active, delta;
 
-               if (time_after_eq(jiffies, sd->last_balance + interval)) {
-                       if (load_balance(cpu, rq, sd, idle, &balance)) {
-                               /*
-                                * We've pulled tasks over so either we're no
-                                * longer idle, or one of our SMT siblings is
-                                * not idle.
-                                */
-                               idle = CPU_NOT_IDLE;
-                       }
-                       sd->last_balance = jiffies;
-               }
-               if (need_serialize)
-                       spin_unlock(&balancing);
-out:
-               if (time_after(next_balance, sd->last_balance + interval)) {
-                       next_balance = sd->last_balance + interval;
-                       update_next_balance = 1;
-               }
+       nr_active = this_rq->nr_running;
+       nr_active += (long) this_rq->nr_uninterruptible;
 
-               /*
-                * Stop the load balance at this level. There is another
-                * CPU in our sched group which is doing load balancing more
-                * actively.
-                */
-               if (!balance)
-                       break;
+       if (nr_active != this_rq->calc_load_active) {
+               delta = nr_active - this_rq->calc_load_active;
+               this_rq->calc_load_active = nr_active;
+               atomic_long_add(delta, &calc_load_tasks);
        }
-
-       /*
-        * next_balance will be updated only when there is a need.
-        * When the cpu is attached to null domain for ex, it will not be
-        * updated.
-        */
-       if (likely(update_next_balance))
-               rq->next_balance = next_balance;
 }
 
 /*
- * run_rebalance_domains is triggered when needed from the scheduler tick.
- * In CONFIG_NO_HZ case, the idle load balance owner will do the
- * rebalancing for all the cpus for whom scheduler ticks are stopped.
+ * Update rq->cpu_load[] statistics. This function is usually called every
+ * scheduler tick (TICK_NSEC).
  */
-static void run_rebalance_domains(struct softirq_action *h)
+static void update_cpu_load(struct rq *this_rq)
 {
-       int this_cpu = smp_processor_id();
-       struct rq *this_rq = cpu_rq(this_cpu);
-       enum cpu_idle_type idle = this_rq->idle_at_tick ?
-                                               CPU_IDLE : CPU_NOT_IDLE;
-
-       rebalance_domains(this_cpu, idle);
+       unsigned long this_load = this_rq->load.weight;
+       int i, scale;
 
-#ifdef CONFIG_NO_HZ
-       /*
-        * If this cpu is the owner for idle load balancing, then do the
-        * balancing on behalf of the other idle cpus whose ticks are
-        * stopped.
-        */
-       if (this_rq->idle_at_tick &&
-           atomic_read(&nohz.load_balancer) == this_cpu) {
-               struct rq *rq;
-               int balance_cpu;
+       this_rq->nr_load_updates++;
 
-               for_each_cpu(balance_cpu, nohz.cpu_mask) {
-                       if (balance_cpu == this_cpu)
-                               continue;
+       /* Update our load: */
+       for (i = 0, scale = 1; i < CPU_LOAD_IDX_MAX; i++, scale += scale) {
+               unsigned long old_load, new_load;
 
-                       /*
-                        * If this cpu gets work to do, stop the load balancing
-                        * work being done for other cpus. Next load
-                        * balancing owner will pick it up.
-                        */
-                       if (need_resched())
-                               break;
+               /* scale is effectively 1 << i now, and >> i divides by scale */
 
-                       rebalance_domains(balance_cpu, CPU_IDLE);
+               old_load = this_rq->cpu_load[i];
+               new_load = this_load;
+               /*
+                * Round up the averaging division if load is increasing. This
+                * prevents us from getting stuck on 9 if the load is 10, for
+                * example.
+                */
+               if (new_load > old_load)
+                       new_load += scale-1;
+               this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i;
+       }
 
-                       rq = cpu_rq(balance_cpu);
-                       if (time_after(this_rq->next_balance, rq->next_balance))
-                               this_rq->next_balance = rq->next_balance;
-               }
+       if (time_after_eq(jiffies, this_rq->calc_load_update)) {
+               this_rq->calc_load_update += LOAD_FREQ;
+               calc_load_account_active(this_rq);
        }
-#endif
 }
 
-static inline int on_null_domain(int cpu)
-{
-       return !rcu_dereference(cpu_rq(cpu)->sd);
-}
+#ifdef CONFIG_SMP
 
 /*
- * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing.
- *
- * In case of CONFIG_NO_HZ, this is the place where we nominate a new
- * idle load balancing owner or decide to stop the periodic load balancing,
- * if the whole system is idle.
+ * sched_exec - execve() is a valuable balancing opportunity, because at
+ * this point the task has the smallest effective memory and cache footprint.
  */
-static inline void trigger_load_balance(struct rq *rq, int cpu)
+void sched_exec(void)
 {
-#ifdef CONFIG_NO_HZ
-       /*
-        * If we were in the nohz mode recently and busy at the current
-        * scheduler tick, then check if we need to nominate new idle
-        * load balancer.
-        */
-       if (rq->in_nohz_recently && !rq->idle_at_tick) {
-               rq->in_nohz_recently = 0;
-
-               if (atomic_read(&nohz.load_balancer) == cpu) {
-                       cpumask_clear_cpu(cpu, nohz.cpu_mask);
-                       atomic_set(&nohz.load_balancer, -1);
-               }
-
-               if (atomic_read(&nohz.load_balancer) == -1) {
-                       int ilb = find_new_ilb(cpu);
+       struct task_struct *p = current;
+       struct migration_req req;
+       int dest_cpu, this_cpu;
+       unsigned long flags;
+       struct rq *rq;
 
-                       if (ilb < nr_cpu_ids)
-                               resched_cpu(ilb);
-               }
+again:
+       this_cpu = get_cpu();
+       dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0);
+       if (dest_cpu == this_cpu) {
+               put_cpu();
+               return;
        }
 
+       rq = task_rq_lock(p, &flags);
+       put_cpu();
+
        /*
-        * If this cpu is idle and doing idle load balancing for all the
-        * cpus with ticks stopped, is it time for that to stop?
+        * select_task_rq() can race against ->cpus_allowed
         */
-       if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) == cpu &&
-           cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
-               resched_cpu(cpu);
-               return;
+       if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)
+           || unlikely(!cpu_active(dest_cpu))) {
+               task_rq_unlock(rq, &flags);
+               goto again;
        }
 
-       /*
-        * If this cpu is idle and the idle load balancing is done by
-        * someone else, then no need raise the SCHED_SOFTIRQ
-        */
-       if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) != cpu &&
-           cpumask_test_cpu(cpu, nohz.cpu_mask))
-               return;
-#endif
-       /* Don't need to rebalance while attached to NULL domain */
-       if (time_after_eq(jiffies, rq->next_balance) &&
-           likely(!on_null_domain(cpu)))
-               raise_softirq(SCHED_SOFTIRQ);
-}
+       /* force the process onto the specified CPU */
+       if (migrate_task(p, dest_cpu, &req)) {
+               /* Need to wait for migration thread (might exit: take ref). */
+               struct task_struct *mt = rq->migration_thread;
 
-#else  /* CONFIG_SMP */
+               get_task_struct(mt);
+               task_rq_unlock(rq, &flags);
+               wake_up_process(mt);
+               put_task_struct(mt);
+               wait_for_completion(&req.done);
 
-/*
- * on UP we do not need to balance between CPUs:
- */
-static inline void idle_balance(int cpu, struct rq *rq)
-{
+               return;
+       }
+       task_rq_unlock(rq, &flags);
 }
 
 #endif
@@ -5298,7 +3515,7 @@ void scheduler_tick(void)
        curr->sched_class->task_tick(rq, curr, 0);
        raw_spin_unlock(&rq->lock);
 
-       perf_event_task_tick(curr, cpu);
+       perf_event_task_tick(curr);
 
 #ifdef CONFIG_SMP
        rq->idle_at_tick = idle_cpu(cpu);
@@ -5512,7 +3729,7 @@ need_resched_nonpreemptible:
 
        if (likely(prev != next)) {
                sched_info_switch(prev, next);
-               perf_event_task_sched_out(prev, next, cpu);
+               perf_event_task_sched_out(prev, next);
 
                rq->nr_switches++;
                rq->curr = next;
@@ -5530,8 +3747,11 @@ need_resched_nonpreemptible:
 
        post_schedule(rq);
 
-       if (unlikely(reacquire_kernel_lock(current) < 0))
+       if (unlikely(reacquire_kernel_lock(current) < 0)) {
+               prev = rq->curr;
+               switch_count = &prev->nivcsw;
                goto need_resched_nonpreemptible;
+       }
 
        preempt_enable_no_resched();
        if (need_resched())
@@ -6040,7 +4260,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
        unsigned long flags;
        int oldprio, on_rq, running;
        struct rq *rq;
-       const struct sched_class *prev_class = p->sched_class;
+       const struct sched_class *prev_class;
 
        BUG_ON(prio < 0 || prio > MAX_PRIO);
 
@@ -6048,6 +4268,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
        update_rq_clock(rq);
 
        oldprio = p->prio;
+       prev_class = p->sched_class;
        on_rq = p->se.on_rq;
        running = task_current(rq, p);
        if (on_rq)
@@ -6065,7 +4286,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
        if (running)
                p->sched_class->set_curr_task(rq);
        if (on_rq) {
-               enqueue_task(rq, p, 0);
+               enqueue_task(rq, p, 0, oldprio < prio);
 
                check_class_changed(rq, p, prev_class, oldprio, running);
        }
@@ -6109,7 +4330,7 @@ void set_user_nice(struct task_struct *p, long nice)
        delta = p->prio - old_prio;
 
        if (on_rq) {
-               enqueue_task(rq, p, 0);
+               enqueue_task(rq, p, 0, false);
                /*
                 * If the task increased its priority or is running and
                 * lowered its priority, then reschedule its CPU:
@@ -6267,7 +4488,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
 {
        int retval, oldprio, oldpolicy = -1, on_rq, running;
        unsigned long flags;
-       const struct sched_class *prev_class = p->sched_class;
+       const struct sched_class *prev_class;
        struct rq *rq;
        int reset_on_fork;
 
@@ -6381,6 +4602,7 @@ recheck:
        p->sched_reset_on_fork = reset_on_fork;
 
        oldprio = p->prio;
+       prev_class = p->sched_class;
        __setscheduler(rq, p, policy, param->sched_priority);
 
        if (running)
@@ -7131,23 +5353,8 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
        struct rq *rq;
        int ret = 0;
 
-       /*
-        * Since we rely on wake-ups to migrate sleeping tasks, don't change
-        * the ->cpus_allowed mask from under waking tasks, which would be
-        * possible when we change rq->lock in ttwu(), so synchronize against
-        * TASK_WAKING to avoid that.
-        */
-again:
-       while (p->state == TASK_WAKING)
-               cpu_relax();
-
        rq = task_rq_lock(p, &flags);
 
-       if (p->state == TASK_WAKING) {
-               task_rq_unlock(rq, &flags);
-               goto again;
-       }
-
        if (!cpumask_intersects(new_mask, cpu_active_mask)) {
                ret = -EINVAL;
                goto out;
@@ -9434,7 +7641,6 @@ static void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
        tg->rt_rq[cpu] = rt_rq;
        init_rt_rq(rt_rq, rq);
        rt_rq->tg = tg;
-       rt_rq->rt_se = rt_se;
        rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
        if (add)
                list_add(&rt_rq->leaf_rt_rq_list, &rq->leaf_rt_rq_list);
@@ -9465,9 +7671,6 @@ void __init sched_init(void)
 #ifdef CONFIG_RT_GROUP_SCHED
        alloc_size += 2 * nr_cpu_ids * sizeof(void **);
 #endif
-#ifdef CONFIG_USER_SCHED
-       alloc_size *= 2;
-#endif
 #ifdef CONFIG_CPUMASK_OFFSTACK
        alloc_size += num_possible_cpus() * cpumask_size();
 #endif
@@ -9481,13 +7684,6 @@ void __init sched_init(void)
                init_task_group.cfs_rq = (struct cfs_rq **)ptr;
                ptr += nr_cpu_ids * sizeof(void **);
 
-#ifdef CONFIG_USER_SCHED
-               root_task_group.se = (struct sched_entity **)ptr;
-               ptr += nr_cpu_ids * sizeof(void **);
-
-               root_task_group.cfs_rq = (struct cfs_rq **)ptr;
-               ptr += nr_cpu_ids * sizeof(void **);
-#endif /* CONFIG_USER_SCHED */
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 #ifdef CONFIG_RT_GROUP_SCHED
                init_task_group.rt_se = (struct sched_rt_entity **)ptr;
@@ -9496,13 +7692,6 @@ void __init sched_init(void)
                init_task_group.rt_rq = (struct rt_rq **)ptr;
                ptr += nr_cpu_ids * sizeof(void **);
 
-#ifdef CONFIG_USER_SCHED
-               root_task_group.rt_se = (struct sched_rt_entity **)ptr;
-               ptr += nr_cpu_ids * sizeof(void **);
-
-               root_task_group.rt_rq = (struct rt_rq **)ptr;
-               ptr += nr_cpu_ids * sizeof(void **);
-#endif /* CONFIG_USER_SCHED */
 #endif /* CONFIG_RT_GROUP_SCHED */
 #ifdef CONFIG_CPUMASK_OFFSTACK
                for_each_possible_cpu(i) {
@@ -9522,22 +7711,13 @@ void __init sched_init(void)
 #ifdef CONFIG_RT_GROUP_SCHED
        init_rt_bandwidth(&init_task_group.rt_bandwidth,
                        global_rt_period(), global_rt_runtime());
-#ifdef CONFIG_USER_SCHED
-       init_rt_bandwidth(&root_task_group.rt_bandwidth,
-                       global_rt_period(), RUNTIME_INF);
-#endif /* CONFIG_USER_SCHED */
 #endif /* CONFIG_RT_GROUP_SCHED */
 
-#ifdef CONFIG_GROUP_SCHED
+#ifdef CONFIG_CGROUP_SCHED
        list_add(&init_task_group.list, &task_groups);
        INIT_LIST_HEAD(&init_task_group.children);
 
-#ifdef CONFIG_USER_SCHED
-       INIT_LIST_HEAD(&root_task_group.children);
-       init_task_group.parent = &root_task_group;
-       list_add(&init_task_group.siblings, &root_task_group.children);
-#endif /* CONFIG_USER_SCHED */
-#endif /* CONFIG_GROUP_SCHED */
+#endif /* CONFIG_CGROUP_SCHED */
 
 #if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP
        update_shares_data = __alloc_percpu(nr_cpu_ids * sizeof(unsigned long),
@@ -9577,25 +7757,6 @@ void __init sched_init(void)
                 * directly in rq->cfs (i.e init_task_group->se[] = NULL).
                 */
                init_tg_cfs_entry(&init_task_group, &rq->cfs, NULL, i, 1, NULL);
-#elif defined CONFIG_USER_SCHED
-               root_task_group.shares = NICE_0_LOAD;
-               init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, 0, NULL);
-               /*
-                * In case of task-groups formed thr' the user id of tasks,
-                * init_task_group represents tasks belonging to root user.
-                * Hence it forms a sibling of all subsequent groups formed.
-                * In this case, init_task_group gets only a fraction of overall
-                * system cpu resource, based on the weight assigned to root
-                * user's cpu share (INIT_TASK_GROUP_LOAD). This is accomplished
-                * by letting tasks of init_task_group sit in a separate cfs_rq
-                * (init_tg_cfs_rq) and having one entity represent this group of
-                * tasks in rq->cfs (i.e init_task_group->se[] != NULL).
-                */
-               init_tg_cfs_entry(&init_task_group,
-                               &per_cpu(init_tg_cfs_rq, i),
-                               &per_cpu(init_sched_entity, i), i, 1,
-                               root_task_group.se[i]);
-
 #endif
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 
@@ -9604,12 +7765,6 @@ void __init sched_init(void)
                INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
 #ifdef CONFIG_CGROUP_SCHED
                init_tg_rt_entry(&init_task_group, &rq->rt, NULL, i, 1, NULL);
-#elif defined CONFIG_USER_SCHED
-               init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, 0, NULL);
-               init_tg_rt_entry(&init_task_group,
-                               &per_cpu(init_rt_rq_var, i),
-                               &per_cpu(init_sched_rt_entity, i), i, 1,
-                               root_task_group.rt_se[i]);
 #endif
 #endif
 
@@ -9694,7 +7849,7 @@ static inline int preempt_count_equals(int preempt_offset)
        return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
 }
 
-void __might_sleep(char *file, int line, int preempt_offset)
+void __might_sleep(const char *file, int line, int preempt_offset)
 {
 #ifdef in_atomic
        static unsigned long prev_jiffy;        /* ratelimiting */
@@ -10005,7 +8160,7 @@ static inline void unregister_rt_sched_group(struct task_group *tg, int cpu)
 }
 #endif /* CONFIG_RT_GROUP_SCHED */
 
-#ifdef CONFIG_GROUP_SCHED
+#ifdef CONFIG_CGROUP_SCHED
 static void free_sched_group(struct task_group *tg)
 {
        free_fair_sched_group(tg);
@@ -10110,11 +8265,11 @@ void sched_move_task(struct task_struct *tsk)
        if (unlikely(running))
                tsk->sched_class->set_curr_task(rq);
        if (on_rq)
-               enqueue_task(rq, tsk, 0);
+               enqueue_task(rq, tsk, 0, false);
 
        task_rq_unlock(rq, &flags);
 }
-#endif /* CONFIG_GROUP_SCHED */
+#endif /* CONFIG_CGROUP_SCHED */
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
 static void __set_se_shares(struct sched_entity *se, unsigned long shares)
@@ -10256,13 +8411,6 @@ static int tg_schedulable(struct task_group *tg, void *data)
                runtime = d->rt_runtime;
        }
 
-#ifdef CONFIG_USER_SCHED
-       if (tg == &root_task_group) {
-               period = global_rt_period();
-               runtime = global_rt_runtime();
-       }
-#endif
-
        /*
         * Cannot have more runtime than the period.
         */
@@ -10881,6 +9029,23 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
        rcu_read_unlock();
 }
 
+/*
+ * When CONFIG_VIRT_CPU_ACCOUNTING is enabled one jiffy can be very large
+ * in cputime_t units. As a result, cpuacct_update_stats calls
+ * percpu_counter_add with values large enough to always overflow the
+ * per cpu batch limit causing bad SMP scalability.
+ *
+ * To fix this we scale percpu_counter_batch by cputime_one_jiffy so we
+ * batch the same amount of time with CONFIG_VIRT_CPU_ACCOUNTING disabled
+ * and enabled. We cap it at INT_MAX which is the largest allowed batch value.
+ */
+#ifdef CONFIG_SMP
+#define CPUACCT_BATCH  \
+       min_t(long, percpu_counter_batch * cputime_one_jiffy, INT_MAX)
+#else
+#define CPUACCT_BATCH  0
+#endif
+
 /*
  * Charge the system/user time to the task's accounting group.
  */
@@ -10888,6 +9053,7 @@ static void cpuacct_update_stats(struct task_struct *tsk,
                enum cpuacct_stat_index idx, cputime_t val)
 {
        struct cpuacct *ca;
+       int batch = CPUACCT_BATCH;
 
        if (unlikely(!cpuacct_subsys.active))
                return;
@@ -10896,7 +9062,7 @@ static void cpuacct_update_stats(struct task_struct *tsk,
        ca = task_ca(tsk);
 
        do {
-               percpu_counter_add(&ca->cpustat[idx], val);
+               __percpu_counter_add(&ca->cpustat[idx], val, batch);
                ca = ca->parent;
        } while (ca);
        rcu_read_unlock();
index 597b33099dfa690617a812b3899e731bf7d5c792..eeb3506c4834e167d531c5bf62409ae9322c450f 100644 (file)
@@ -47,9 +47,7 @@ static int convert_prio(int prio)
 }
 
 #define for_each_cpupri_active(array, idx)                    \
-  for (idx = find_first_bit(array, CPUPRI_NR_PRIORITIES);     \
-       idx < CPUPRI_NR_PRIORITIES;                            \
-       idx = find_next_bit(array, CPUPRI_NR_PRIORITIES, idx+1))
+       for_each_bit(idx, array, CPUPRI_NR_PRIORITIES)
 
 /**
  * cpupri_find - find the best (lowest-pri) CPU in the system
index 42ac3c9f66f68868bb651f6c163483d6713b6eea..3e1fd96c6cf9cef8de27f7ba41dad905986f1959 100644 (file)
@@ -1053,7 +1053,8 @@ static inline void hrtick_update(struct rq *rq)
  * increased. Here we update the fair scheduling stats and
  * then put the task into the rbtree:
  */
-static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
+static void
+enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, bool head)
 {
        struct cfs_rq *cfs_rq;
        struct sched_entity *se = &p->se;
@@ -1508,7 +1509,7 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
                         * If there's an idle sibling in this domain, make that
                         * the wake_affine target instead of the current cpu.
                         */
-                       if (tmp->flags & SD_PREFER_SIBLING)
+                       if (tmp->flags & SD_SHARE_PKG_RESOURCES)
                                target = select_idle_sibling(p, tmp, target);
 
                        if (target >= 0) {
@@ -1815,57 +1816,164 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
  */
 
 /*
- * Load-balancing iterator. Note: while the runqueue stays locked
- * during the whole iteration, the current task might be
- * dequeued so the iterator has to be dequeue-safe. Here we
- * achieve that by always pre-iterating before returning
- * the current task:
+ * pull_task - move a task from a remote runqueue to the local runqueue.
+ * Both runqueues must be locked.
  */
-static struct task_struct *
-__load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next)
+static void pull_task(struct rq *src_rq, struct task_struct *p,
+                     struct rq *this_rq, int this_cpu)
 {
-       struct task_struct *p = NULL;
-       struct sched_entity *se;
+       deactivate_task(src_rq, p, 0);
+       set_task_cpu(p, this_cpu);
+       activate_task(this_rq, p, 0);
+       check_preempt_curr(this_rq, p, 0);
+}
 
-       if (next == &cfs_rq->tasks)
-               return NULL;
+/*
+ * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
+ */
+static
+int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
+                    struct sched_domain *sd, enum cpu_idle_type idle,
+                    int *all_pinned)
+{
+       int tsk_cache_hot = 0;
+       /*
+        * We do not migrate tasks that are:
+        * 1) running (obviously), or
+        * 2) cannot be migrated to this CPU due to cpus_allowed, or
+        * 3) are cache-hot on their current CPU.
+        */
+       if (!cpumask_test_cpu(this_cpu, &p->cpus_allowed)) {
+               schedstat_inc(p, se.nr_failed_migrations_affine);
+               return 0;
+       }
+       *all_pinned = 0;
 
-       se = list_entry(next, struct sched_entity, group_node);
-       p = task_of(se);
-       cfs_rq->balance_iterator = next->next;
+       if (task_running(rq, p)) {
+               schedstat_inc(p, se.nr_failed_migrations_running);
+               return 0;
+       }
 
-       return p;
-}
+       /*
+        * Aggressive migration if:
+        * 1) task is cache cold, or
+        * 2) too many balance attempts have failed.
+        */
 
-static struct task_struct *load_balance_start_fair(void *arg)
-{
-       struct cfs_rq *cfs_rq = arg;
+       tsk_cache_hot = task_hot(p, rq->clock, sd);
+       if (!tsk_cache_hot ||
+               sd->nr_balance_failed > sd->cache_nice_tries) {
+#ifdef CONFIG_SCHEDSTATS
+               if (tsk_cache_hot) {
+                       schedstat_inc(sd, lb_hot_gained[idle]);
+                       schedstat_inc(p, se.nr_forced_migrations);
+               }
+#endif
+               return 1;
+       }
 
-       return __load_balance_iterator(cfs_rq, cfs_rq->tasks.next);
+       if (tsk_cache_hot) {
+               schedstat_inc(p, se.nr_failed_migrations_hot);
+               return 0;
+       }
+       return 1;
 }
 
-static struct task_struct *load_balance_next_fair(void *arg)
+/*
+ * move_one_task tries to move exactly one task from busiest to this_rq, as
+ * part of active balancing operations within "domain".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int
+move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+             struct sched_domain *sd, enum cpu_idle_type idle)
 {
-       struct cfs_rq *cfs_rq = arg;
+       struct task_struct *p, *n;
+       struct cfs_rq *cfs_rq;
+       int pinned = 0;
+
+       for_each_leaf_cfs_rq(busiest, cfs_rq) {
+               list_for_each_entry_safe(p, n, &cfs_rq->tasks, se.group_node) {
+
+                       if (!can_migrate_task(p, busiest, this_cpu,
+                                               sd, idle, &pinned))
+                               continue;
+
+                       pull_task(busiest, p, this_rq, this_cpu);
+                       /*
+                        * Right now, this is only the second place pull_task()
+                        * is called, so we can safely collect pull_task()
+                        * stats here rather than inside pull_task().
+                        */
+                       schedstat_inc(sd, lb_gained[idle]);
+                       return 1;
+               }
+       }
 
-       return __load_balance_iterator(cfs_rq, cfs_rq->balance_iterator);
+       return 0;
 }
 
 static unsigned long
-__load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-               unsigned long max_load_move, struct sched_domain *sd,
-               enum cpu_idle_type idle, int *all_pinned, int *this_best_prio,
-               struct cfs_rq *cfs_rq)
+balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
+             unsigned long max_load_move, struct sched_domain *sd,
+             enum cpu_idle_type idle, int *all_pinned,
+             int *this_best_prio, struct cfs_rq *busiest_cfs_rq)
 {
-       struct rq_iterator cfs_rq_iterator;
+       int loops = 0, pulled = 0, pinned = 0;
+       long rem_load_move = max_load_move;
+       struct task_struct *p, *n;
 
-       cfs_rq_iterator.start = load_balance_start_fair;
-       cfs_rq_iterator.next = load_balance_next_fair;
-       cfs_rq_iterator.arg = cfs_rq;
+       if (max_load_move == 0)
+               goto out;
 
-       return balance_tasks(this_rq, this_cpu, busiest,
-                       max_load_move, sd, idle, all_pinned,
-                       this_best_prio, &cfs_rq_iterator);
+       pinned = 1;
+
+       list_for_each_entry_safe(p, n, &busiest_cfs_rq->tasks, se.group_node) {
+               if (loops++ > sysctl_sched_nr_migrate)
+                       break;
+
+               if ((p->se.load.weight >> 1) > rem_load_move ||
+                   !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned))
+                       continue;
+
+               pull_task(busiest, p, this_rq, this_cpu);
+               pulled++;
+               rem_load_move -= p->se.load.weight;
+
+#ifdef CONFIG_PREEMPT
+               /*
+                * NEWIDLE balancing is a source of latency, so preemptible
+                * kernels will stop after the first task is pulled to minimize
+                * the critical section.
+                */
+               if (idle == CPU_NEWLY_IDLE)
+                       break;
+#endif
+
+               /*
+                * We only want to steal up to the prescribed amount of
+                * weighted load.
+                */
+               if (rem_load_move <= 0)
+                       break;
+
+               if (p->prio < *this_best_prio)
+                       *this_best_prio = p->prio;
+       }
+out:
+       /*
+        * Right now, this is one of only two places pull_task() is called,
+        * so we can safely collect pull_task() stats here rather than
+        * inside pull_task().
+        */
+       schedstat_add(sd, lb_gained[idle], pulled);
+
+       if (all_pinned)
+               *all_pinned = pinned;
+
+       return max_load_move - rem_load_move;
 }
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1897,9 +2005,9 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
                rem_load = (u64)rem_load_move * busiest_weight;
                rem_load = div_u64(rem_load, busiest_h_load + 1);
 
-               moved_load = __load_balance_fair(this_rq, this_cpu, busiest,
+               moved_load = balance_tasks(this_rq, this_cpu, busiest,
                                rem_load, sd, idle, all_pinned, this_best_prio,
-                               tg->cfs_rq[busiest_cpu]);
+                               busiest_cfs_rq);
 
                if (!moved_load)
                        continue;
@@ -1922,44 +2030,1527 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
                  struct sched_domain *sd, enum cpu_idle_type idle,
                  int *all_pinned, int *this_best_prio)
 {
-       return __load_balance_fair(this_rq, this_cpu, busiest,
+       return balance_tasks(this_rq, this_cpu, busiest,
                        max_load_move, sd, idle, all_pinned,
                        this_best_prio, &busiest->cfs);
 }
 #endif
 
-static int
-move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                  struct sched_domain *sd, enum cpu_idle_type idle)
+/*
+ * move_tasks tries to move up to max_load_move weighted load from busiest to
+ * this_rq, as part of a balancing operation within domain "sd".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
+                     unsigned long max_load_move,
+                     struct sched_domain *sd, enum cpu_idle_type idle,
+                     int *all_pinned)
 {
-       struct cfs_rq *busy_cfs_rq;
-       struct rq_iterator cfs_rq_iterator;
+       unsigned long total_load_moved = 0, load_moved;
+       int this_best_prio = this_rq->curr->prio;
+
+       do {
+               load_moved = load_balance_fair(this_rq, this_cpu, busiest,
+                               max_load_move - total_load_moved,
+                               sd, idle, all_pinned, &this_best_prio);
 
-       cfs_rq_iterator.start = load_balance_start_fair;
-       cfs_rq_iterator.next = load_balance_next_fair;
+               total_load_moved += load_moved;
 
-       for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
+#ifdef CONFIG_PREEMPT
                /*
-                * pass busy_cfs_rq argument into
-                * load_balance_[start|next]_fair iterators
+                * NEWIDLE balancing is a source of latency, so preemptible
+                * kernels will stop after the first task is pulled to minimize
+                * the critical section.
                 */
-               cfs_rq_iterator.arg = busy_cfs_rq;
-               if (iter_move_one_task(this_rq, this_cpu, busiest, sd, idle,
-                                      &cfs_rq_iterator))
-                   return 1;
+               if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
+                       break;
+
+               if (raw_spin_is_contended(&this_rq->lock) ||
+                               raw_spin_is_contended(&busiest->lock))
+                       break;
+#endif
+       } while (load_moved && max_load_move > total_load_moved);
+
+       return total_load_moved > 0;
+}
+
+/********** Helpers for find_busiest_group ************************/
+/*
+ * sd_lb_stats - Structure to store the statistics of a sched_domain
+ *             during load balancing.
+ */
+struct sd_lb_stats {
+       struct sched_group *busiest; /* Busiest group in this sd */
+       struct sched_group *this;  /* Local group in this sd */
+       unsigned long total_load;  /* Total load of all groups in sd */
+       unsigned long total_pwr;   /*   Total power of all groups in sd */
+       unsigned long avg_load;    /* Average load across all groups in sd */
+
+       /** Statistics of this group */
+       unsigned long this_load;
+       unsigned long this_load_per_task;
+       unsigned long this_nr_running;
+
+       /* Statistics of the busiest group */
+       unsigned long max_load;
+       unsigned long busiest_load_per_task;
+       unsigned long busiest_nr_running;
+       unsigned long busiest_group_capacity;
+
+       int group_imb; /* Is there imbalance in this sd */
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+       int power_savings_balance; /* Is powersave balance needed for this sd */
+       struct sched_group *group_min; /* Least loaded group in sd */
+       struct sched_group *group_leader; /* Group which relieves group_min */
+       unsigned long min_load_per_task; /* load_per_task in group_min */
+       unsigned long leader_nr_running; /* Nr running of group_leader */
+       unsigned long min_nr_running; /* Nr running of group_min */
+#endif
+};
+
+/*
+ * sg_lb_stats - stats of a sched_group required for load_balancing
+ */
+struct sg_lb_stats {
+       unsigned long avg_load; /*Avg load across the CPUs of the group */
+       unsigned long group_load; /* Total load over the CPUs of the group */
+       unsigned long sum_nr_running; /* Nr tasks running in the group */
+       unsigned long sum_weighted_load; /* Weighted load of group's tasks */
+       unsigned long group_capacity;
+       int group_imb; /* Is there an imbalance in the group ? */
+};
+
+/**
+ * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
+ * @group: The group whose first cpu is to be returned.
+ */
+static inline unsigned int group_first_cpu(struct sched_group *group)
+{
+       return cpumask_first(sched_group_cpus(group));
+}
+
+/**
+ * get_sd_load_idx - Obtain the load index for a given sched domain.
+ * @sd: The sched_domain whose load_idx is to be obtained.
+ * @idle: The Idle status of the CPU for whose sd load_icx is obtained.
+ */
+static inline int get_sd_load_idx(struct sched_domain *sd,
+                                       enum cpu_idle_type idle)
+{
+       int load_idx;
+
+       switch (idle) {
+       case CPU_NOT_IDLE:
+               load_idx = sd->busy_idx;
+               break;
+
+       case CPU_NEWLY_IDLE:
+               load_idx = sd->newidle_idx;
+               break;
+       default:
+               load_idx = sd->idle_idx;
+               break;
+       }
+
+       return load_idx;
+}
+
+
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+/**
+ * init_sd_power_savings_stats - Initialize power savings statistics for
+ * the given sched_domain, during load balancing.
+ *
+ * @sd: Sched domain whose power-savings statistics are to be initialized.
+ * @sds: Variable containing the statistics for sd.
+ * @idle: Idle status of the CPU at which we're performing load-balancing.
+ */
+static inline void init_sd_power_savings_stats(struct sched_domain *sd,
+       struct sd_lb_stats *sds, enum cpu_idle_type idle)
+{
+       /*
+        * Busy processors will not participate in power savings
+        * balance.
+        */
+       if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
+               sds->power_savings_balance = 0;
+       else {
+               sds->power_savings_balance = 1;
+               sds->min_nr_running = ULONG_MAX;
+               sds->leader_nr_running = 0;
+       }
+}
+
+/**
+ * update_sd_power_savings_stats - Update the power saving stats for a
+ * sched_domain while performing load balancing.
+ *
+ * @group: sched_group belonging to the sched_domain under consideration.
+ * @sds: Variable containing the statistics of the sched_domain
+ * @local_group: Does group contain the CPU for which we're performing
+ *             load balancing ?
+ * @sgs: Variable containing the statistics of the group.
+ */
+static inline void update_sd_power_savings_stats(struct sched_group *group,
+       struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
+{
+
+       if (!sds->power_savings_balance)
+               return;
+
+       /*
+        * If the local group is idle or completely loaded
+        * no need to do power savings balance at this domain
+        */
+       if (local_group && (sds->this_nr_running >= sgs->group_capacity ||
+                               !sds->this_nr_running))
+               sds->power_savings_balance = 0;
+
+       /*
+        * If a group is already running at full capacity or idle,
+        * don't include that group in power savings calculations
+        */
+       if (!sds->power_savings_balance ||
+               sgs->sum_nr_running >= sgs->group_capacity ||
+               !sgs->sum_nr_running)
+               return;
+
+       /*
+        * Calculate the group which has the least non-idle load.
+        * This is the group from where we need to pick up the load
+        * for saving power
+        */
+       if ((sgs->sum_nr_running < sds->min_nr_running) ||
+           (sgs->sum_nr_running == sds->min_nr_running &&
+            group_first_cpu(group) > group_first_cpu(sds->group_min))) {
+               sds->group_min = group;
+               sds->min_nr_running = sgs->sum_nr_running;
+               sds->min_load_per_task = sgs->sum_weighted_load /
+                                               sgs->sum_nr_running;
+       }
+
+       /*
+        * Calculate the group which is almost near its
+        * capacity but still has some space to pick up some load
+        * from other group and save more power
+        */
+       if (sgs->sum_nr_running + 1 > sgs->group_capacity)
+               return;
+
+       if (sgs->sum_nr_running > sds->leader_nr_running ||
+           (sgs->sum_nr_running == sds->leader_nr_running &&
+            group_first_cpu(group) < group_first_cpu(sds->group_leader))) {
+               sds->group_leader = group;
+               sds->leader_nr_running = sgs->sum_nr_running;
        }
+}
+
+/**
+ * check_power_save_busiest_group - see if there is potential for some power-savings balance
+ * @sds: Variable containing the statistics of the sched_domain
+ *     under consideration.
+ * @this_cpu: Cpu at which we're currently performing load-balancing.
+ * @imbalance: Variable to store the imbalance.
+ *
+ * Description:
+ * Check if we have potential to perform some power-savings balance.
+ * If yes, set the busiest group to be the least loaded group in the
+ * sched_domain, so that it's CPUs can be put to idle.
+ *
+ * Returns 1 if there is potential to perform power-savings balance.
+ * Else returns 0.
+ */
+static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
+                                       int this_cpu, unsigned long *imbalance)
+{
+       if (!sds->power_savings_balance)
+               return 0;
+
+       if (sds->this != sds->group_leader ||
+                       sds->group_leader == sds->group_min)
+               return 0;
+
+       *imbalance = sds->min_load_per_task;
+       sds->busiest = sds->group_min;
+
+       return 1;
+
+}
+#else /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
+static inline void init_sd_power_savings_stats(struct sched_domain *sd,
+       struct sd_lb_stats *sds, enum cpu_idle_type idle)
+{
+       return;
+}
+
+static inline void update_sd_power_savings_stats(struct sched_group *group,
+       struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
+{
+       return;
+}
 
+static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
+                                       int this_cpu, unsigned long *imbalance)
+{
        return 0;
 }
+#endif /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
 
-static void rq_online_fair(struct rq *rq)
+
+unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
 {
-       update_sysctl();
+       return SCHED_LOAD_SCALE;
 }
 
-static void rq_offline_fair(struct rq *rq)
+unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+       return default_scale_freq_power(sd, cpu);
+}
+
+unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+       unsigned long weight = cpumask_weight(sched_domain_span(sd));
+       unsigned long smt_gain = sd->smt_gain;
+
+       smt_gain /= weight;
+
+       return smt_gain;
+}
+
+unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+       return default_scale_smt_power(sd, cpu);
+}
+
+unsigned long scale_rt_power(int cpu)
+{
+       struct rq *rq = cpu_rq(cpu);
+       u64 total, available;
+
+       sched_avg_update(rq);
+
+       total = sched_avg_period() + (rq->clock - rq->age_stamp);
+       available = total - rq->rt_avg;
+
+       if (unlikely((s64)total < SCHED_LOAD_SCALE))
+               total = SCHED_LOAD_SCALE;
+
+       total >>= SCHED_LOAD_SHIFT;
+
+       return div_u64(available, total);
+}
+
+static void update_cpu_power(struct sched_domain *sd, int cpu)
+{
+       unsigned long weight = cpumask_weight(sched_domain_span(sd));
+       unsigned long power = SCHED_LOAD_SCALE;
+       struct sched_group *sdg = sd->groups;
+
+       if (sched_feat(ARCH_POWER))
+               power *= arch_scale_freq_power(sd, cpu);
+       else
+               power *= default_scale_freq_power(sd, cpu);
+
+       power >>= SCHED_LOAD_SHIFT;
+
+       if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
+               if (sched_feat(ARCH_POWER))
+                       power *= arch_scale_smt_power(sd, cpu);
+               else
+                       power *= default_scale_smt_power(sd, cpu);
+
+               power >>= SCHED_LOAD_SHIFT;
+       }
+
+       power *= scale_rt_power(cpu);
+       power >>= SCHED_LOAD_SHIFT;
+
+       if (!power)
+               power = 1;
+
+       sdg->cpu_power = power;
+}
+
+static void update_group_power(struct sched_domain *sd, int cpu)
+{
+       struct sched_domain *child = sd->child;
+       struct sched_group *group, *sdg = sd->groups;
+       unsigned long power;
+
+       if (!child) {
+               update_cpu_power(sd, cpu);
+               return;
+       }
+
+       power = 0;
+
+       group = child->groups;
+       do {
+               power += group->cpu_power;
+               group = group->next;
+       } while (group != child->groups);
+
+       sdg->cpu_power = power;
+}
+
+/**
+ * update_sg_lb_stats - Update sched_group's statistics for load balancing.
+ * @sd: The sched_domain whose statistics are to be updated.
+ * @group: sched_group whose statistics are to be updated.
+ * @this_cpu: Cpu for which load balance is currently performed.
+ * @idle: Idle status of this_cpu
+ * @load_idx: Load index of sched_domain of this_cpu for load calc.
+ * @sd_idle: Idle status of the sched_domain containing group.
+ * @local_group: Does group contain this_cpu.
+ * @cpus: Set of cpus considered for load balancing.
+ * @balance: Should we balance.
+ * @sgs: variable to hold the statistics for this group.
+ */
+static inline void update_sg_lb_stats(struct sched_domain *sd,
+                       struct sched_group *group, int this_cpu,
+                       enum cpu_idle_type idle, int load_idx, int *sd_idle,
+                       int local_group, const struct cpumask *cpus,
+                       int *balance, struct sg_lb_stats *sgs)
+{
+       unsigned long load, max_cpu_load, min_cpu_load;
+       int i;
+       unsigned int balance_cpu = -1, first_idle_cpu = 0;
+       unsigned long avg_load_per_task = 0;
+
+       if (local_group)
+               balance_cpu = group_first_cpu(group);
+
+       /* Tally up the load of all CPUs in the group */
+       max_cpu_load = 0;
+       min_cpu_load = ~0UL;
+
+       for_each_cpu_and(i, sched_group_cpus(group), cpus) {
+               struct rq *rq = cpu_rq(i);
+
+               if (*sd_idle && rq->nr_running)
+                       *sd_idle = 0;
+
+               /* Bias balancing toward cpus of our domain */
+               if (local_group) {
+                       if (idle_cpu(i) && !first_idle_cpu) {
+                               first_idle_cpu = 1;
+                               balance_cpu = i;
+                       }
+
+                       load = target_load(i, load_idx);
+               } else {
+                       load = source_load(i, load_idx);
+                       if (load > max_cpu_load)
+                               max_cpu_load = load;
+                       if (min_cpu_load > load)
+                               min_cpu_load = load;
+               }
+
+               sgs->group_load += load;
+               sgs->sum_nr_running += rq->nr_running;
+               sgs->sum_weighted_load += weighted_cpuload(i);
+
+       }
+
+       /*
+        * First idle cpu or the first cpu(busiest) in this sched group
+        * is eligible for doing load balancing at this and above
+        * domains. In the newly idle case, we will allow all the cpu's
+        * to do the newly idle load balance.
+        */
+       if (idle != CPU_NEWLY_IDLE && local_group &&
+           balance_cpu != this_cpu) {
+               *balance = 0;
+               return;
+       }
+
+       update_group_power(sd, this_cpu);
+
+       /* Adjust by relative CPU power of the group */
+       sgs->avg_load = (sgs->group_load * SCHED_LOAD_SCALE) / group->cpu_power;
+
+       /*
+        * Consider the group unbalanced when the imbalance is larger
+        * than the average weight of two tasks.
+        *
+        * APZ: with cgroup the avg task weight can vary wildly and
+        *      might not be a suitable number - should we keep a
+        *      normalized nr_running number somewhere that negates
+        *      the hierarchy?
+        */
+       if (sgs->sum_nr_running)
+               avg_load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running;
+
+       if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task)
+               sgs->group_imb = 1;
+
+       sgs->group_capacity =
+               DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
+}
+
+/**
+ * update_sd_lb_stats - Update sched_group's statistics for load balancing.
+ * @sd: sched_domain whose statistics are to be updated.
+ * @this_cpu: Cpu for which load balance is currently performed.
+ * @idle: Idle status of this_cpu
+ * @sd_idle: Idle status of the sched_domain containing group.
+ * @cpus: Set of cpus considered for load balancing.
+ * @balance: Should we balance.
+ * @sds: variable to hold the statistics for this sched_domain.
+ */
+static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
+                       enum cpu_idle_type idle, int *sd_idle,
+                       const struct cpumask *cpus, int *balance,
+                       struct sd_lb_stats *sds)
+{
+       struct sched_domain *child = sd->child;
+       struct sched_group *group = sd->groups;
+       struct sg_lb_stats sgs;
+       int load_idx, prefer_sibling = 0;
+
+       if (child && child->flags & SD_PREFER_SIBLING)
+               prefer_sibling = 1;
+
+       init_sd_power_savings_stats(sd, sds, idle);
+       load_idx = get_sd_load_idx(sd, idle);
+
+       do {
+               int local_group;
+
+               local_group = cpumask_test_cpu(this_cpu,
+                                              sched_group_cpus(group));
+               memset(&sgs, 0, sizeof(sgs));
+               update_sg_lb_stats(sd, group, this_cpu, idle, load_idx, sd_idle,
+                               local_group, cpus, balance, &sgs);
+
+               if (local_group && !(*balance))
+                       return;
+
+               sds->total_load += sgs.group_load;
+               sds->total_pwr += group->cpu_power;
+
+               /*
+                * In case the child domain prefers tasks go to siblings
+                * first, lower the group capacity to one so that we'll try
+                * and move all the excess tasks away.
+                */
+               if (prefer_sibling)
+                       sgs.group_capacity = min(sgs.group_capacity, 1UL);
+
+               if (local_group) {
+                       sds->this_load = sgs.avg_load;
+                       sds->this = group;
+                       sds->this_nr_running = sgs.sum_nr_running;
+                       sds->this_load_per_task = sgs.sum_weighted_load;
+               } else if (sgs.avg_load > sds->max_load &&
+                          (sgs.sum_nr_running > sgs.group_capacity ||
+                               sgs.group_imb)) {
+                       sds->max_load = sgs.avg_load;
+                       sds->busiest = group;
+                       sds->busiest_nr_running = sgs.sum_nr_running;
+                       sds->busiest_group_capacity = sgs.group_capacity;
+                       sds->busiest_load_per_task = sgs.sum_weighted_load;
+                       sds->group_imb = sgs.group_imb;
+               }
+
+               update_sd_power_savings_stats(group, sds, local_group, &sgs);
+               group = group->next;
+       } while (group != sd->groups);
+}
+
+/**
+ * fix_small_imbalance - Calculate the minor imbalance that exists
+ *                     amongst the groups of a sched_domain, during
+ *                     load balancing.
+ * @sds: Statistics of the sched_domain whose imbalance is to be calculated.
+ * @this_cpu: The cpu at whose sched_domain we're performing load-balance.
+ * @imbalance: Variable to store the imbalance.
+ */
+static inline void fix_small_imbalance(struct sd_lb_stats *sds,
+                               int this_cpu, unsigned long *imbalance)
+{
+       unsigned long tmp, pwr_now = 0, pwr_move = 0;
+       unsigned int imbn = 2;
+       unsigned long scaled_busy_load_per_task;
+
+       if (sds->this_nr_running) {
+               sds->this_load_per_task /= sds->this_nr_running;
+               if (sds->busiest_load_per_task >
+                               sds->this_load_per_task)
+                       imbn = 1;
+       } else
+               sds->this_load_per_task =
+                       cpu_avg_load_per_task(this_cpu);
+
+       scaled_busy_load_per_task = sds->busiest_load_per_task
+                                                * SCHED_LOAD_SCALE;
+       scaled_busy_load_per_task /= sds->busiest->cpu_power;
+
+       if (sds->max_load - sds->this_load + scaled_busy_load_per_task >=
+                       (scaled_busy_load_per_task * imbn)) {
+               *imbalance = sds->busiest_load_per_task;
+               return;
+       }
+
+       /*
+        * OK, we don't have enough imbalance to justify moving tasks,
+        * however we may be able to increase total CPU power used by
+        * moving them.
+        */
+
+       pwr_now += sds->busiest->cpu_power *
+                       min(sds->busiest_load_per_task, sds->max_load);
+       pwr_now += sds->this->cpu_power *
+                       min(sds->this_load_per_task, sds->this_load);
+       pwr_now /= SCHED_LOAD_SCALE;
+
+       /* Amount of load we'd subtract */
+       tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
+               sds->busiest->cpu_power;
+       if (sds->max_load > tmp)
+               pwr_move += sds->busiest->cpu_power *
+                       min(sds->busiest_load_per_task, sds->max_load - tmp);
+
+       /* Amount of load we'd add */
+       if (sds->max_load * sds->busiest->cpu_power <
+               sds->busiest_load_per_task * SCHED_LOAD_SCALE)
+               tmp = (sds->max_load * sds->busiest->cpu_power) /
+                       sds->this->cpu_power;
+       else
+               tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
+                       sds->this->cpu_power;
+       pwr_move += sds->this->cpu_power *
+                       min(sds->this_load_per_task, sds->this_load + tmp);
+       pwr_move /= SCHED_LOAD_SCALE;
+
+       /* Move if we gain throughput */
+       if (pwr_move > pwr_now)
+               *imbalance = sds->busiest_load_per_task;
+}
+
+/**
+ * calculate_imbalance - Calculate the amount of imbalance present within the
+ *                      groups of a given sched_domain during load balance.
+ * @sds: statistics of the sched_domain whose imbalance is to be calculated.
+ * @this_cpu: Cpu for which currently load balance is being performed.
+ * @imbalance: The variable to store the imbalance.
+ */
+static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu,
+               unsigned long *imbalance)
+{
+       unsigned long max_pull, load_above_capacity = ~0UL;
+
+       sds->busiest_load_per_task /= sds->busiest_nr_running;
+       if (sds->group_imb) {
+               sds->busiest_load_per_task =
+                       min(sds->busiest_load_per_task, sds->avg_load);
+       }
+
+       /*
+        * In the presence of smp nice balancing, certain scenarios can have
+        * max load less than avg load(as we skip the groups at or below
+        * its cpu_power, while calculating max_load..)
+        */
+       if (sds->max_load < sds->avg_load) {
+               *imbalance = 0;
+               return fix_small_imbalance(sds, this_cpu, imbalance);
+       }
+
+       if (!sds->group_imb) {
+               /*
+                * Don't want to pull so many tasks that a group would go idle.
+                */
+               load_above_capacity = (sds->busiest_nr_running -
+                                               sds->busiest_group_capacity);
+
+               load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_LOAD_SCALE);
+
+               load_above_capacity /= sds->busiest->cpu_power;
+       }
+
+       /*
+        * We're trying to get all the cpus to the average_load, so we don't
+        * want to push ourselves above the average load, nor do we wish to
+        * reduce the max loaded cpu below the average load. At the same time,
+        * we also don't want to reduce the group load below the group capacity
+        * (so that we can implement power-savings policies etc). Thus we look
+        * for the minimum possible imbalance.
+        * Be careful of negative numbers as they'll appear as very large values
+        * with unsigned longs.
+        */
+       max_pull = min(sds->max_load - sds->avg_load, load_above_capacity);
+
+       /* How much load to actually move to equalise the imbalance */
+       *imbalance = min(max_pull * sds->busiest->cpu_power,
+               (sds->avg_load - sds->this_load) * sds->this->cpu_power)
+                       / SCHED_LOAD_SCALE;
+
+       /*
+        * if *imbalance is less than the average load per runnable task
+        * there is no gaurantee that any tasks will be moved so we'll have
+        * a think about bumping its value to force at least one task to be
+        * moved
+        */
+       if (*imbalance < sds->busiest_load_per_task)
+               return fix_small_imbalance(sds, this_cpu, imbalance);
+
+}
+/******* find_busiest_group() helpers end here *********************/
+
+/**
+ * find_busiest_group - Returns the busiest group within the sched_domain
+ * if there is an imbalance. If there isn't an imbalance, and
+ * the user has opted for power-savings, it returns a group whose
+ * CPUs can be put to idle by rebalancing those tasks elsewhere, if
+ * such a group exists.
+ *
+ * Also calculates the amount of weighted load which should be moved
+ * to restore balance.
+ *
+ * @sd: The sched_domain whose busiest group is to be returned.
+ * @this_cpu: The cpu for which load balancing is currently being performed.
+ * @imbalance: Variable which stores amount of weighted load which should
+ *             be moved to restore balance/put a group to idle.
+ * @idle: The idle status of this_cpu.
+ * @sd_idle: The idleness of sd
+ * @cpus: The set of CPUs under consideration for load-balancing.
+ * @balance: Pointer to a variable indicating if this_cpu
+ *     is the appropriate cpu to perform load balancing at this_level.
+ *
+ * Returns:    - the busiest group if imbalance exists.
+ *             - If no imbalance and user has opted for power-savings balance,
+ *                return the least loaded group whose CPUs can be
+ *                put to idle by rebalancing its tasks onto our group.
+ */
+static struct sched_group *
+find_busiest_group(struct sched_domain *sd, int this_cpu,
+                  unsigned long *imbalance, enum cpu_idle_type idle,
+                  int *sd_idle, const struct cpumask *cpus, int *balance)
+{
+       struct sd_lb_stats sds;
+
+       memset(&sds, 0, sizeof(sds));
+
+       /*
+        * Compute the various statistics relavent for load balancing at
+        * this level.
+        */
+       update_sd_lb_stats(sd, this_cpu, idle, sd_idle, cpus,
+                                       balance, &sds);
+
+       /* Cases where imbalance does not exist from POV of this_cpu */
+       /* 1) this_cpu is not the appropriate cpu to perform load balancing
+        *    at this level.
+        * 2) There is no busy sibling group to pull from.
+        * 3) This group is the busiest group.
+        * 4) This group is more busy than the avg busieness at this
+        *    sched_domain.
+        * 5) The imbalance is within the specified limit.
+        */
+       if (!(*balance))
+               goto ret;
+
+       if (!sds.busiest || sds.busiest_nr_running == 0)
+               goto out_balanced;
+
+       if (sds.this_load >= sds.max_load)
+               goto out_balanced;
+
+       sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr;
+
+       if (sds.this_load >= sds.avg_load)
+               goto out_balanced;
+
+       if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
+               goto out_balanced;
+
+       /* Looks like there is an imbalance. Compute it */
+       calculate_imbalance(&sds, this_cpu, imbalance);
+       return sds.busiest;
+
+out_balanced:
+       /*
+        * There is no obvious imbalance. But check if we can do some balancing
+        * to save power.
+        */
+       if (check_power_save_busiest_group(&sds, this_cpu, imbalance))
+               return sds.busiest;
+ret:
+       *imbalance = 0;
+       return NULL;
+}
+
+/*
+ * find_busiest_queue - find the busiest runqueue among the cpus in group.
+ */
+static struct rq *
+find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
+                  unsigned long imbalance, const struct cpumask *cpus)
+{
+       struct rq *busiest = NULL, *rq;
+       unsigned long max_load = 0;
+       int i;
+
+       for_each_cpu(i, sched_group_cpus(group)) {
+               unsigned long power = power_of(i);
+               unsigned long capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
+               unsigned long wl;
+
+               if (!cpumask_test_cpu(i, cpus))
+                       continue;
+
+               rq = cpu_rq(i);
+               wl = weighted_cpuload(i);
+
+               /*
+                * When comparing with imbalance, use weighted_cpuload()
+                * which is not scaled with the cpu power.
+                */
+               if (capacity && rq->nr_running == 1 && wl > imbalance)
+                       continue;
+
+               /*
+                * For the load comparisons with the other cpu's, consider
+                * the weighted_cpuload() scaled with the cpu power, so that
+                * the load can be moved away from the cpu that is potentially
+                * running at a lower capacity.
+                */
+               wl = (wl * SCHED_LOAD_SCALE) / power;
+
+               if (wl > max_load) {
+                       max_load = wl;
+                       busiest = rq;
+               }
+       }
+
+       return busiest;
+}
+
+/*
+ * Max backoff if we encounter pinned tasks. Pretty arbitrary value, but
+ * so long as it is large enough.
+ */
+#define MAX_PINNED_INTERVAL    512
+
+/* Working cpumask for load_balance and load_balance_newidle. */
+static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
+
+static int need_active_balance(struct sched_domain *sd, int sd_idle, int idle)
+{
+       if (idle == CPU_NEWLY_IDLE) {
+               /*
+                * The only task running in a non-idle cpu can be moved to this
+                * cpu in an attempt to completely freeup the other CPU
+                * package.
+                *
+                * The package power saving logic comes from
+                * find_busiest_group(). If there are no imbalance, then
+                * f_b_g() will return NULL. However when sched_mc={1,2} then
+                * f_b_g() will select a group from which a running task may be
+                * pulled to this cpu in order to make the other package idle.
+                * If there is no opportunity to make a package idle and if
+                * there are no imbalance, then f_b_g() will return NULL and no
+                * action will be taken in load_balance_newidle().
+                *
+                * Under normal task pull operation due to imbalance, there
+                * will be more than one task in the source run queue and
+                * move_tasks() will succeed.  ld_moved will be true and this
+                * active balance code will not be triggered.
+                */
+               if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+                   !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+                       return 0;
+
+               if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
+                       return 0;
+       }
+
+       return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2);
+}
+
+/*
+ * Check this_cpu to ensure it is balanced within domain. Attempt to move
+ * tasks if there is an imbalance.
+ */
+static int load_balance(int this_cpu, struct rq *this_rq,
+                       struct sched_domain *sd, enum cpu_idle_type idle,
+                       int *balance)
+{
+       int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
+       struct sched_group *group;
+       unsigned long imbalance;
+       struct rq *busiest;
+       unsigned long flags;
+       struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
+
+       cpumask_copy(cpus, cpu_active_mask);
+
+       /*
+        * When power savings policy is enabled for the parent domain, idle
+        * sibling can pick up load irrespective of busy siblings. In this case,
+        * let the state of idle sibling percolate up as CPU_IDLE, instead of
+        * portraying it as CPU_NOT_IDLE.
+        */
+       if (idle != CPU_NOT_IDLE && sd->flags & SD_SHARE_CPUPOWER &&
+           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+               sd_idle = 1;
+
+       schedstat_inc(sd, lb_count[idle]);
+
+redo:
+       update_shares(sd);
+       group = find_busiest_group(sd, this_cpu, &imbalance, idle, &sd_idle,
+                                  cpus, balance);
+
+       if (*balance == 0)
+               goto out_balanced;
+
+       if (!group) {
+               schedstat_inc(sd, lb_nobusyg[idle]);
+               goto out_balanced;
+       }
+
+       busiest = find_busiest_queue(group, idle, imbalance, cpus);
+       if (!busiest) {
+               schedstat_inc(sd, lb_nobusyq[idle]);
+               goto out_balanced;
+       }
+
+       BUG_ON(busiest == this_rq);
+
+       schedstat_add(sd, lb_imbalance[idle], imbalance);
+
+       ld_moved = 0;
+       if (busiest->nr_running > 1) {
+               /*
+                * Attempt to move tasks. If find_busiest_group has found
+                * an imbalance but busiest->nr_running <= 1, the group is
+                * still unbalanced. ld_moved simply stays zero, so it is
+                * correctly treated as an imbalance.
+                */
+               local_irq_save(flags);
+               double_rq_lock(this_rq, busiest);
+               ld_moved = move_tasks(this_rq, this_cpu, busiest,
+                                     imbalance, sd, idle, &all_pinned);
+               double_rq_unlock(this_rq, busiest);
+               local_irq_restore(flags);
+
+               /*
+                * some other cpu did the load balance for us.
+                */
+               if (ld_moved && this_cpu != smp_processor_id())
+                       resched_cpu(this_cpu);
+
+               /* All tasks on this runqueue were pinned by CPU affinity */
+               if (unlikely(all_pinned)) {
+                       cpumask_clear_cpu(cpu_of(busiest), cpus);
+                       if (!cpumask_empty(cpus))
+                               goto redo;
+                       goto out_balanced;
+               }
+       }
+
+       if (!ld_moved) {
+               schedstat_inc(sd, lb_failed[idle]);
+               sd->nr_balance_failed++;
+
+               if (need_active_balance(sd, sd_idle, idle)) {
+                       raw_spin_lock_irqsave(&busiest->lock, flags);
+
+                       /* don't kick the migration_thread, if the curr
+                        * task on busiest cpu can't be moved to this_cpu
+                        */
+                       if (!cpumask_test_cpu(this_cpu,
+                                             &busiest->curr->cpus_allowed)) {
+                               raw_spin_unlock_irqrestore(&busiest->lock,
+                                                           flags);
+                               all_pinned = 1;
+                               goto out_one_pinned;
+                       }
+
+                       if (!busiest->active_balance) {
+                               busiest->active_balance = 1;
+                               busiest->push_cpu = this_cpu;
+                               active_balance = 1;
+                       }
+                       raw_spin_unlock_irqrestore(&busiest->lock, flags);
+                       if (active_balance)
+                               wake_up_process(busiest->migration_thread);
+
+                       /*
+                        * We've kicked active balancing, reset the failure
+                        * counter.
+                        */
+                       sd->nr_balance_failed = sd->cache_nice_tries+1;
+               }
+       } else
+               sd->nr_balance_failed = 0;
+
+       if (likely(!active_balance)) {
+               /* We were unbalanced, so reset the balancing interval */
+               sd->balance_interval = sd->min_interval;
+       } else {
+               /*
+                * If we've begun active balancing, start to back off. This
+                * case may not be covered by the all_pinned logic if there
+                * is only 1 task on the busy runqueue (because we don't call
+                * move_tasks).
+                */
+               if (sd->balance_interval < sd->max_interval)
+                       sd->balance_interval *= 2;
+       }
+
+       if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+               ld_moved = -1;
+
+       goto out;
+
+out_balanced:
+       schedstat_inc(sd, lb_balanced[idle]);
+
+       sd->nr_balance_failed = 0;
+
+out_one_pinned:
+       /* tune up the balancing interval */
+       if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
+                       (sd->balance_interval < sd->max_interval))
+               sd->balance_interval *= 2;
+
+       if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+           !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+               ld_moved = -1;
+       else
+               ld_moved = 0;
+out:
+       if (ld_moved)
+               update_shares(sd);
+       return ld_moved;
+}
+
+/*
+ * idle_balance is called by schedule() if this_cpu is about to become
+ * idle. Attempts to pull tasks from other CPUs.
+ */
+static void idle_balance(int this_cpu, struct rq *this_rq)
+{
+       struct sched_domain *sd;
+       int pulled_task = 0;
+       unsigned long next_balance = jiffies + HZ;
+
+       this_rq->idle_stamp = this_rq->clock;
+
+       if (this_rq->avg_idle < sysctl_sched_migration_cost)
+               return;
+
+       /*
+        * Drop the rq->lock, but keep IRQ/preempt disabled.
+        */
+       raw_spin_unlock(&this_rq->lock);
+
+       for_each_domain(this_cpu, sd) {
+               unsigned long interval;
+               int balance = 1;
+
+               if (!(sd->flags & SD_LOAD_BALANCE))
+                       continue;
+
+               if (sd->flags & SD_BALANCE_NEWIDLE) {
+                       /* If we've pulled tasks over stop searching: */
+                       pulled_task = load_balance(this_cpu, this_rq,
+                                                  sd, CPU_NEWLY_IDLE, &balance);
+               }
+
+               interval = msecs_to_jiffies(sd->balance_interval);
+               if (time_after(next_balance, sd->last_balance + interval))
+                       next_balance = sd->last_balance + interval;
+               if (pulled_task) {
+                       this_rq->idle_stamp = 0;
+                       break;
+               }
+       }
+
+       raw_spin_lock(&this_rq->lock);
+
+       if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
+               /*
+                * We are going idle. next_balance may be set based on
+                * a busy processor. So reset next_balance.
+                */
+               this_rq->next_balance = next_balance;
+       }
+}
+
+/*
+ * active_load_balance is run by migration threads. It pushes running tasks
+ * off the busiest CPU onto idle CPUs. It requires at least 1 task to be
+ * running on each physical CPU where possible, and avoids physical /
+ * logical imbalances.
+ *
+ * Called with busiest_rq locked.
+ */
+static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
+{
+       int target_cpu = busiest_rq->push_cpu;
+       struct sched_domain *sd;
+       struct rq *target_rq;
+
+       /* Is there any task to move? */
+       if (busiest_rq->nr_running <= 1)
+               return;
+
+       target_rq = cpu_rq(target_cpu);
+
+       /*
+        * This condition is "impossible", if it occurs
+        * we need to fix it. Originally reported by
+        * Bjorn Helgaas on a 128-cpu setup.
+        */
+       BUG_ON(busiest_rq == target_rq);
+
+       /* move a task from busiest_rq to target_rq */
+       double_lock_balance(busiest_rq, target_rq);
+       update_rq_clock(busiest_rq);
+       update_rq_clock(target_rq);
+
+       /* Search for an sd spanning us and the target CPU. */
+       for_each_domain(target_cpu, sd) {
+               if ((sd->flags & SD_LOAD_BALANCE) &&
+                   cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
+                               break;
+       }
+
+       if (likely(sd)) {
+               schedstat_inc(sd, alb_count);
+
+               if (move_one_task(target_rq, target_cpu, busiest_rq,
+                                 sd, CPU_IDLE))
+                       schedstat_inc(sd, alb_pushed);
+               else
+                       schedstat_inc(sd, alb_failed);
+       }
+       double_unlock_balance(busiest_rq, target_rq);
+}
+
+#ifdef CONFIG_NO_HZ
+static struct {
+       atomic_t load_balancer;
+       cpumask_var_t cpu_mask;
+       cpumask_var_t ilb_grp_nohz_mask;
+} nohz ____cacheline_aligned = {
+       .load_balancer = ATOMIC_INIT(-1),
+};
+
+int get_nohz_load_balancer(void)
+{
+       return atomic_read(&nohz.load_balancer);
+}
+
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+/**
+ * lowest_flag_domain - Return lowest sched_domain containing flag.
+ * @cpu:       The cpu whose lowest level of sched domain is to
+ *             be returned.
+ * @flag:      The flag to check for the lowest sched_domain
+ *             for the given cpu.
+ *
+ * Returns the lowest sched_domain of a cpu which contains the given flag.
+ */
+static inline struct sched_domain *lowest_flag_domain(int cpu, int flag)
+{
+       struct sched_domain *sd;
+
+       for_each_domain(cpu, sd)
+               if (sd && (sd->flags & flag))
+                       break;
+
+       return sd;
+}
+
+/**
+ * for_each_flag_domain - Iterates over sched_domains containing the flag.
+ * @cpu:       The cpu whose domains we're iterating over.
+ * @sd:                variable holding the value of the power_savings_sd
+ *             for cpu.
+ * @flag:      The flag to filter the sched_domains to be iterated.
+ *
+ * Iterates over all the scheduler domains for a given cpu that has the 'flag'
+ * set, starting from the lowest sched_domain to the highest.
+ */
+#define for_each_flag_domain(cpu, sd, flag) \
+       for (sd = lowest_flag_domain(cpu, flag); \
+               (sd && (sd->flags & flag)); sd = sd->parent)
+
+/**
+ * is_semi_idle_group - Checks if the given sched_group is semi-idle.
+ * @ilb_group: group to be checked for semi-idleness
+ *
+ * Returns:    1 if the group is semi-idle. 0 otherwise.
+ *
+ * We define a sched_group to be semi idle if it has atleast one idle-CPU
+ * and atleast one non-idle CPU. This helper function checks if the given
+ * sched_group is semi-idle or not.
+ */
+static inline int is_semi_idle_group(struct sched_group *ilb_group)
+{
+       cpumask_and(nohz.ilb_grp_nohz_mask, nohz.cpu_mask,
+                                       sched_group_cpus(ilb_group));
+
+       /*
+        * A sched_group is semi-idle when it has atleast one busy cpu
+        * and atleast one idle cpu.
+        */
+       if (cpumask_empty(nohz.ilb_grp_nohz_mask))
+               return 0;
+
+       if (cpumask_equal(nohz.ilb_grp_nohz_mask, sched_group_cpus(ilb_group)))
+               return 0;
+
+       return 1;
+}
+/**
+ * find_new_ilb - Finds the optimum idle load balancer for nomination.
+ * @cpu:       The cpu which is nominating a new idle_load_balancer.
+ *
+ * Returns:    Returns the id of the idle load balancer if it exists,
+ *             Else, returns >= nr_cpu_ids.
+ *
+ * This algorithm picks the idle load balancer such that it belongs to a
+ * semi-idle powersavings sched_domain. The idea is to try and avoid
+ * completely idle packages/cores just for the purpose of idle load balancing
+ * when there are other idle cpu's which are better suited for that job.
+ */
+static int find_new_ilb(int cpu)
+{
+       struct sched_domain *sd;
+       struct sched_group *ilb_group;
+
+       /*
+        * Have idle load balancer selection from semi-idle packages only
+        * when power-aware load balancing is enabled
+        */
+       if (!(sched_smt_power_savings || sched_mc_power_savings))
+               goto out_done;
+
+       /*
+        * Optimize for the case when we have no idle CPUs or only one
+        * idle CPU. Don't walk the sched_domain hierarchy in such cases
+        */
+       if (cpumask_weight(nohz.cpu_mask) < 2)
+               goto out_done;
+
+       for_each_flag_domain(cpu, sd, SD_POWERSAVINGS_BALANCE) {
+               ilb_group = sd->groups;
+
+               do {
+                       if (is_semi_idle_group(ilb_group))
+                               return cpumask_first(nohz.ilb_grp_nohz_mask);
+
+                       ilb_group = ilb_group->next;
+
+               } while (ilb_group != sd->groups);
+       }
+
+out_done:
+       return cpumask_first(nohz.cpu_mask);
+}
+#else /*  (CONFIG_SCHED_MC || CONFIG_SCHED_SMT) */
+static inline int find_new_ilb(int call_cpu)
+{
+       return cpumask_first(nohz.cpu_mask);
+}
+#endif
+
+/*
+ * This routine will try to nominate the ilb (idle load balancing)
+ * owner among the cpus whose ticks are stopped. ilb owner will do the idle
+ * load balancing on behalf of all those cpus. If all the cpus in the system
+ * go into this tickless mode, then there will be no ilb owner (as there is
+ * no need for one) and all the cpus will sleep till the next wakeup event
+ * arrives...
+ *
+ * For the ilb owner, tick is not stopped. And this tick will be used
+ * for idle load balancing. ilb owner will still be part of
+ * nohz.cpu_mask..
+ *
+ * While stopping the tick, this cpu will become the ilb owner if there
+ * is no other owner. And will be the owner till that cpu becomes busy
+ * or if all cpus in the system stop their ticks at which point
+ * there is no need for ilb owner.
+ *
+ * When the ilb owner becomes busy, it nominates another owner, during the
+ * next busy scheduler_tick()
+ */
+int select_nohz_load_balancer(int stop_tick)
+{
+       int cpu = smp_processor_id();
+
+       if (stop_tick) {
+               cpu_rq(cpu)->in_nohz_recently = 1;
+
+               if (!cpu_active(cpu)) {
+                       if (atomic_read(&nohz.load_balancer) != cpu)
+                               return 0;
+
+                       /*
+                        * If we are going offline and still the leader,
+                        * give up!
+                        */
+                       if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
+                               BUG();
+
+                       return 0;
+               }
+
+               cpumask_set_cpu(cpu, nohz.cpu_mask);
+
+               /* time for ilb owner also to sleep */
+               if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
+                       if (atomic_read(&nohz.load_balancer) == cpu)
+                               atomic_set(&nohz.load_balancer, -1);
+                       return 0;
+               }
+
+               if (atomic_read(&nohz.load_balancer) == -1) {
+                       /* make me the ilb owner */
+                       if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
+                               return 1;
+               } else if (atomic_read(&nohz.load_balancer) == cpu) {
+                       int new_ilb;
+
+                       if (!(sched_smt_power_savings ||
+                                               sched_mc_power_savings))
+                               return 1;
+                       /*
+                        * Check to see if there is a more power-efficient
+                        * ilb.
+                        */
+                       new_ilb = find_new_ilb(cpu);
+                       if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
+                               atomic_set(&nohz.load_balancer, -1);
+                               resched_cpu(new_ilb);
+                               return 0;
+                       }
+                       return 1;
+               }
+       } else {
+               if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
+                       return 0;
+
+               cpumask_clear_cpu(cpu, nohz.cpu_mask);
+
+               if (atomic_read(&nohz.load_balancer) == cpu)
+                       if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
+                               BUG();
+       }
+       return 0;
+}
+#endif
+
+static DEFINE_SPINLOCK(balancing);
+
+/*
+ * It checks each scheduling domain to see if it is due to be balanced,
+ * and initiates a balancing operation if so.
+ *
+ * Balancing parameters are set up in arch_init_sched_domains.
+ */
+static void rebalance_domains(int cpu, enum cpu_idle_type idle)
+{
+       int balance = 1;
+       struct rq *rq = cpu_rq(cpu);
+       unsigned long interval;
+       struct sched_domain *sd;
+       /* Earliest time when we have to do rebalance again */
+       unsigned long next_balance = jiffies + 60*HZ;
+       int update_next_balance = 0;
+       int need_serialize;
+
+       for_each_domain(cpu, sd) {
+               if (!(sd->flags & SD_LOAD_BALANCE))
+                       continue;
+
+               interval = sd->balance_interval;
+               if (idle != CPU_IDLE)
+                       interval *= sd->busy_factor;
+
+               /* scale ms to jiffies */
+               interval = msecs_to_jiffies(interval);
+               if (unlikely(!interval))
+                       interval = 1;
+               if (interval > HZ*NR_CPUS/10)
+                       interval = HZ*NR_CPUS/10;
+
+               need_serialize = sd->flags & SD_SERIALIZE;
+
+               if (need_serialize) {
+                       if (!spin_trylock(&balancing))
+                               goto out;
+               }
+
+               if (time_after_eq(jiffies, sd->last_balance + interval)) {
+                       if (load_balance(cpu, rq, sd, idle, &balance)) {
+                               /*
+                                * We've pulled tasks over so either we're no
+                                * longer idle, or one of our SMT siblings is
+                                * not idle.
+                                */
+                               idle = CPU_NOT_IDLE;
+                       }
+                       sd->last_balance = jiffies;
+               }
+               if (need_serialize)
+                       spin_unlock(&balancing);
+out:
+               if (time_after(next_balance, sd->last_balance + interval)) {
+                       next_balance = sd->last_balance + interval;
+                       update_next_balance = 1;
+               }
+
+               /*
+                * Stop the load balance at this level. There is another
+                * CPU in our sched group which is doing load balancing more
+                * actively.
+                */
+               if (!balance)
+                       break;
+       }
+
+       /*
+        * next_balance will be updated only when there is a need.
+        * When the cpu is attached to null domain for ex, it will not be
+        * updated.
+        */
+       if (likely(update_next_balance))
+               rq->next_balance = next_balance;
+}
+
+/*
+ * run_rebalance_domains is triggered when needed from the scheduler tick.
+ * In CONFIG_NO_HZ case, the idle load balance owner will do the
+ * rebalancing for all the cpus for whom scheduler ticks are stopped.
+ */
+static void run_rebalance_domains(struct softirq_action *h)
+{
+       int this_cpu = smp_processor_id();
+       struct rq *this_rq = cpu_rq(this_cpu);
+       enum cpu_idle_type idle = this_rq->idle_at_tick ?
+                                               CPU_IDLE : CPU_NOT_IDLE;
+
+       rebalance_domains(this_cpu, idle);
+
+#ifdef CONFIG_NO_HZ
+       /*
+        * If this cpu is the owner for idle load balancing, then do the
+        * balancing on behalf of the other idle cpus whose ticks are
+        * stopped.
+        */
+       if (this_rq->idle_at_tick &&
+           atomic_read(&nohz.load_balancer) == this_cpu) {
+               struct rq *rq;
+               int balance_cpu;
+
+               for_each_cpu(balance_cpu, nohz.cpu_mask) {
+                       if (balance_cpu == this_cpu)
+                               continue;
+
+                       /*
+                        * If this cpu gets work to do, stop the load balancing
+                        * work being done for other cpus. Next load
+                        * balancing owner will pick it up.
+                        */
+                       if (need_resched())
+                               break;
+
+                       rebalance_domains(balance_cpu, CPU_IDLE);
+
+                       rq = cpu_rq(balance_cpu);
+                       if (time_after(this_rq->next_balance, rq->next_balance))
+                               this_rq->next_balance = rq->next_balance;
+               }
+       }
+#endif
+}
+
+static inline int on_null_domain(int cpu)
+{
+       return !rcu_dereference(cpu_rq(cpu)->sd);
+}
+
+/*
+ * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing.
+ *
+ * In case of CONFIG_NO_HZ, this is the place where we nominate a new
+ * idle load balancing owner or decide to stop the periodic load balancing,
+ * if the whole system is idle.
+ */
+static inline void trigger_load_balance(struct rq *rq, int cpu)
+{
+#ifdef CONFIG_NO_HZ
+       /*
+        * If we were in the nohz mode recently and busy at the current
+        * scheduler tick, then check if we need to nominate new idle
+        * load balancer.
+        */
+       if (rq->in_nohz_recently && !rq->idle_at_tick) {
+               rq->in_nohz_recently = 0;
+
+               if (atomic_read(&nohz.load_balancer) == cpu) {
+                       cpumask_clear_cpu(cpu, nohz.cpu_mask);
+                       atomic_set(&nohz.load_balancer, -1);
+               }
+
+               if (atomic_read(&nohz.load_balancer) == -1) {
+                       int ilb = find_new_ilb(cpu);
+
+                       if (ilb < nr_cpu_ids)
+                               resched_cpu(ilb);
+               }
+       }
+
+       /*
+        * If this cpu is idle and doing idle load balancing for all the
+        * cpus with ticks stopped, is it time for that to stop?
+        */
+       if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) == cpu &&
+           cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
+               resched_cpu(cpu);
+               return;
+       }
+
+       /*
+        * If this cpu is idle and the idle load balancing is done by
+        * someone else, then no need raise the SCHED_SOFTIRQ
+        */
+       if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) != cpu &&
+           cpumask_test_cpu(cpu, nohz.cpu_mask))
+               return;
+#endif
+       /* Don't need to rebalance while attached to NULL domain */
+       if (time_after_eq(jiffies, rq->next_balance) &&
+           likely(!on_null_domain(cpu)))
+               raise_softirq(SCHED_SOFTIRQ);
+}
+
+static void rq_online_fair(struct rq *rq)
+{
+       update_sysctl();
+}
+
+static void rq_offline_fair(struct rq *rq)
+{
+       update_sysctl();
+}
+
+#else  /* CONFIG_SMP */
+
+/*
+ * on UP we do not need to balance between CPUs:
+ */
+static inline void idle_balance(int cpu, struct rq *rq)
 {
-       update_sysctl();
 }
 
 #endif /* CONFIG_SMP */
@@ -2076,7 +3667,7 @@ static void moved_group_fair(struct task_struct *p, int on_rq)
 }
 #endif
 
-unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task)
+static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task)
 {
        struct sched_entity *se = &task->se;
        unsigned int rr_interval = 0;
@@ -2108,8 +3699,6 @@ static const struct sched_class fair_sched_class = {
 #ifdef CONFIG_SMP
        .select_task_rq         = select_task_rq_fair,
 
-       .load_balance           = load_balance_fair,
-       .move_one_task          = move_one_task_fair,
        .rq_online              = rq_online_fair,
        .rq_offline             = rq_offline_fair,
 
index 5f93b570d3832cf47068e01942cdd8f36685a078..a8a6d8a50947f11e9bb1f8a9e782effffe4468f7 100644 (file)
@@ -44,24 +44,6 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
 {
 }
 
-#ifdef CONFIG_SMP
-static unsigned long
-load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                 unsigned long max_load_move,
-                 struct sched_domain *sd, enum cpu_idle_type idle,
-                 int *all_pinned, int *this_best_prio)
-{
-       return 0;
-}
-
-static int
-move_one_task_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                  struct sched_domain *sd, enum cpu_idle_type idle)
-{
-       return 0;
-}
-#endif
-
 static void task_tick_idle(struct rq *rq, struct task_struct *curr, int queued)
 {
 }
@@ -97,7 +79,7 @@ static void prio_changed_idle(struct rq *rq, struct task_struct *p,
                check_preempt_curr(rq, p, 0);
 }
 
-unsigned int get_rr_interval_idle(struct rq *rq, struct task_struct *task)
+static unsigned int get_rr_interval_idle(struct rq *rq, struct task_struct *task)
 {
        return 0;
 }
@@ -119,9 +101,6 @@ static const struct sched_class idle_sched_class = {
 
 #ifdef CONFIG_SMP
        .select_task_rq         = select_task_rq_idle,
-
-       .load_balance           = load_balance_idle,
-       .move_one_task          = move_one_task_idle,
 #endif
 
        .set_curr_task          = set_curr_task_idle,
index f48328ac216f7769e6e456bda664e48e28ff9fbe..bf3e38fdbe6dc6ca0160d7f408881525928da21a 100644 (file)
@@ -194,17 +194,20 @@ static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se)
        return rt_se->my_q;
 }
 
-static void enqueue_rt_entity(struct sched_rt_entity *rt_se);
+static void enqueue_rt_entity(struct sched_rt_entity *rt_se, bool head);
 static void dequeue_rt_entity(struct sched_rt_entity *rt_se);
 
 static void sched_rt_rq_enqueue(struct rt_rq *rt_rq)
 {
+       int this_cpu = smp_processor_id();
        struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr;
-       struct sched_rt_entity *rt_se = rt_rq->rt_se;
+       struct sched_rt_entity *rt_se;
+
+       rt_se = rt_rq->tg->rt_se[this_cpu];
 
        if (rt_rq->rt_nr_running) {
                if (rt_se && !on_rt_rq(rt_se))
-                       enqueue_rt_entity(rt_se);
+                       enqueue_rt_entity(rt_se, false);
                if (rt_rq->highest_prio.curr < curr->prio)
                        resched_task(curr);
        }
@@ -212,7 +215,10 @@ static void sched_rt_rq_enqueue(struct rt_rq *rt_rq)
 
 static void sched_rt_rq_dequeue(struct rt_rq *rt_rq)
 {
-       struct sched_rt_entity *rt_se = rt_rq->rt_se;
+       int this_cpu = smp_processor_id();
+       struct sched_rt_entity *rt_se;
+
+       rt_se = rt_rq->tg->rt_se[this_cpu];
 
        if (rt_se && on_rt_rq(rt_se))
                dequeue_rt_entity(rt_se);
@@ -803,7 +809,7 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
        dec_rt_group(rt_se, rt_rq);
 }
 
-static void __enqueue_rt_entity(struct sched_rt_entity *rt_se)
+static void __enqueue_rt_entity(struct sched_rt_entity *rt_se, bool head)
 {
        struct rt_rq *rt_rq = rt_rq_of_se(rt_se);
        struct rt_prio_array *array = &rt_rq->active;
@@ -819,7 +825,10 @@ static void __enqueue_rt_entity(struct sched_rt_entity *rt_se)
        if (group_rq && (rt_rq_throttled(group_rq) || !group_rq->rt_nr_running))
                return;
 
-       list_add_tail(&rt_se->run_list, queue);
+       if (head)
+               list_add(&rt_se->run_list, queue);
+       else
+               list_add_tail(&rt_se->run_list, queue);
        __set_bit(rt_se_prio(rt_se), array->bitmap);
 
        inc_rt_tasks(rt_se, rt_rq);
@@ -856,11 +865,11 @@ static void dequeue_rt_stack(struct sched_rt_entity *rt_se)
        }
 }
 
-static void enqueue_rt_entity(struct sched_rt_entity *rt_se)
+static void enqueue_rt_entity(struct sched_rt_entity *rt_se, bool head)
 {
        dequeue_rt_stack(rt_se);
        for_each_sched_rt_entity(rt_se)
-               __enqueue_rt_entity(rt_se);
+               __enqueue_rt_entity(rt_se, head);
 }
 
 static void dequeue_rt_entity(struct sched_rt_entity *rt_se)
@@ -871,21 +880,22 @@ static void dequeue_rt_entity(struct sched_rt_entity *rt_se)
                struct rt_rq *rt_rq = group_rt_rq(rt_se);
 
                if (rt_rq && rt_rq->rt_nr_running)
-                       __enqueue_rt_entity(rt_se);
+                       __enqueue_rt_entity(rt_se, false);
        }
 }
 
 /*
  * Adding/removing a task to/from a priority array:
  */
-static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
+static void
+enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, bool head)
 {
        struct sched_rt_entity *rt_se = &p->rt;
 
        if (wakeup)
                rt_se->timeout = 0;
 
-       enqueue_rt_entity(rt_se);
+       enqueue_rt_entity(rt_se, head);
 
        if (!task_current(rq, p) && p->rt.nr_cpus_allowed > 1)
                enqueue_pushable_task(rq, p);
@@ -1481,24 +1491,6 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
                push_rt_tasks(rq);
 }
 
-static unsigned long
-load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
-               unsigned long max_load_move,
-               struct sched_domain *sd, enum cpu_idle_type idle,
-               int *all_pinned, int *this_best_prio)
-{
-       /* don't touch RT tasks */
-       return 0;
-}
-
-static int
-move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                struct sched_domain *sd, enum cpu_idle_type idle)
-{
-       /* don't touch RT tasks */
-       return 0;
-}
-
 static void set_cpus_allowed_rt(struct task_struct *p,
                                const struct cpumask *new_mask)
 {
@@ -1721,7 +1713,7 @@ static void set_curr_task_rt(struct rq *rq)
        dequeue_pushable_task(rq, p);
 }
 
-unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task)
+static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task)
 {
        /*
         * Time slice is 0 for SCHED_FIFO tasks
@@ -1746,8 +1738,6 @@ static const struct sched_class rt_sched_class = {
 #ifdef CONFIG_SMP
        .select_task_rq         = select_task_rq_rt,
 
-       .load_balance           = load_balance_rt,
-       .move_one_task          = move_one_task_rt,
        .set_cpus_allowed       = set_cpus_allowed_rt,
        .rq_online              = rq_online_rt,
        .rq_offline             = rq_offline_rt,
index de735a6637d0cddafc39f5f80fa571e5a9145936..9867b6bfefce7f1d20d342149984ca40e0dbd3ab 100644 (file)
@@ -12,8 +12,6 @@
 #include <linux/smp.h>
 #include <linux/cpu.h>
 
-static DEFINE_PER_CPU(struct call_single_queue, call_single_queue);
-
 static struct {
        struct list_head        queue;
        raw_spinlock_t          lock;
@@ -33,12 +31,14 @@ struct call_function_data {
        cpumask_var_t           cpumask;
 };
 
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
+
 struct call_single_queue {
        struct list_head        list;
        raw_spinlock_t          lock;
 };
 
-static DEFINE_PER_CPU(struct call_function_data, cfd_data);
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_single_queue, call_single_queue);
 
 static int
 hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
@@ -256,7 +256,7 @@ void generic_smp_call_function_single_interrupt(void)
        }
 }
 
-static DEFINE_PER_CPU(struct call_single_data, csd_data);
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_single_data, csd_data);
 
 /*
  * smp_call_function_single - Run a function on a specific CPU
@@ -347,7 +347,7 @@ int smp_call_function_any(const struct cpumask *mask,
                goto call;
 
        /* Try for same node. */
-       nodemask = cpumask_of_node(cpu);
+       nodemask = cpumask_of_node(cpu_to_node(cpu));
        for (cpu = cpumask_first_and(nodemask, mask); cpu < nr_cpu_ids;
             cpu = cpumask_next_and(cpu, nodemask, mask)) {
                if (cpu_online(cpu))
index a09502e2ef758721917ab537e345da0036197628..7c1a67ef027431e8f82d341ed7e729b9c0eec044 100644 (file)
@@ -500,22 +500,17 @@ EXPORT_SYMBOL(tasklet_kill);
  */
 
 /*
- * The trampoline is called when the hrtimer expires. If this is
- * called from the hrtimer interrupt then we schedule the tasklet as
- * the timer callback function expects to run in softirq context. If
- * it's called in softirq context anyway (i.e. high resolution timers
- * disabled) then the hrtimer callback is called right away.
+ * The trampoline is called when the hrtimer expires. It schedules a tasklet
+ * to run __tasklet_hrtimer_trampoline() which in turn will call the intended
+ * hrtimer callback, but from softirq context.
  */
 static enum hrtimer_restart __hrtimer_tasklet_trampoline(struct hrtimer *timer)
 {
        struct tasklet_hrtimer *ttimer =
                container_of(timer, struct tasklet_hrtimer, timer);
 
-       if (hrtimer_is_hres_active(timer)) {
-               tasklet_hi_schedule(&ttimer->tasklet);
-               return HRTIMER_NORESTART;
-       }
-       return ttimer->function(timer);
+       tasklet_hi_schedule(&ttimer->tasklet);
+       return HRTIMER_NORESTART;
 }
 
 /*
index d22579087e27a5bdb04e3962b117432c29497b33..0d4c7898ab805dd868880e7deca2d0d69d88fc67 100644 (file)
@@ -25,6 +25,7 @@ static DEFINE_SPINLOCK(print_lock);
 static DEFINE_PER_CPU(unsigned long, softlockup_touch_ts); /* touch timestamp */
 static DEFINE_PER_CPU(unsigned long, softlockup_print_ts); /* print timestamp */
 static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog);
+static DEFINE_PER_CPU(bool, softlock_touch_sync);
 
 static int __read_mostly did_panic;
 int __read_mostly softlockup_thresh = 60;
@@ -79,6 +80,12 @@ void touch_softlockup_watchdog(void)
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 
+void touch_softlockup_watchdog_sync(void)
+{
+       __raw_get_cpu_var(softlock_touch_sync) = true;
+       __raw_get_cpu_var(softlockup_touch_ts) = 0;
+}
+
 void touch_all_softlockup_watchdogs(void)
 {
        int cpu;
@@ -118,6 +125,14 @@ void softlockup_tick(void)
        }
 
        if (touch_ts == 0) {
+               if (unlikely(per_cpu(softlock_touch_sync, this_cpu))) {
+                       /*
+                        * If the time stamp was touched atomically
+                        * make sure the scheduler tick is up to date.
+                        */
+                       per_cpu(softlock_touch_sync, this_cpu) = false;
+                       sched_clock_tick();
+               }
                __touch_softlockup_watchdog();
                return;
        }
index 818d7d9aa03c5f73a765f91dc0e56852960a93c4..bde4295774c8f921f235fd4d2efebbd726132b38 100644 (file)
 #include <linux/smp.h>
 #include <linux/srcu.h>
 
+static int init_srcu_struct_fields(struct srcu_struct *sp)
+{
+       sp->completed = 0;
+       mutex_init(&sp->mutex);
+       sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array);
+       return sp->per_cpu_ref ? 0 : -ENOMEM;
+}
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+
+int __init_srcu_struct(struct srcu_struct *sp, const char *name,
+                      struct lock_class_key *key)
+{
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       /* Don't re-initialize a lock while it is held. */
+       debug_check_no_locks_freed((void *)sp, sizeof(*sp));
+       lockdep_init_map(&sp->dep_map, name, key, 0);
+#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+       return init_srcu_struct_fields(sp);
+}
+EXPORT_SYMBOL_GPL(__init_srcu_struct);
+
+#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 /**
  * init_srcu_struct - initialize a sleep-RCU structure
  * @sp: structure to initialize.
  */
 int init_srcu_struct(struct srcu_struct *sp)
 {
-       sp->completed = 0;
-       mutex_init(&sp->mutex);
-       sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array);
-       return (sp->per_cpu_ref ? 0 : -ENOMEM);
+       return init_srcu_struct_fields(sp);
 }
 EXPORT_SYMBOL_GPL(init_srcu_struct);
 
+#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 /*
  * srcu_readers_active_idx -- returns approximate number of readers
  *     active on the specified rank of per-CPU counters.
@@ -100,15 +123,12 @@ void cleanup_srcu_struct(struct srcu_struct *sp)
 }
 EXPORT_SYMBOL_GPL(cleanup_srcu_struct);
 
-/**
- * srcu_read_lock - register a new reader for an SRCU-protected structure.
- * @sp: srcu_struct in which to register the new reader.
- *
+/*
  * Counts the new reader in the appropriate per-CPU element of the
  * srcu_struct.  Must be called from process context.
  * Returns an index that must be passed to the matching srcu_read_unlock().
  */
-int srcu_read_lock(struct srcu_struct *sp)
+int __srcu_read_lock(struct srcu_struct *sp)
 {
        int idx;
 
@@ -120,31 +140,27 @@ int srcu_read_lock(struct srcu_struct *sp)
        preempt_enable();
        return idx;
 }
-EXPORT_SYMBOL_GPL(srcu_read_lock);
+EXPORT_SYMBOL_GPL(__srcu_read_lock);
 
-/**
- * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
- * @sp: srcu_struct in which to unregister the old reader.
- * @idx: return value from corresponding srcu_read_lock().
- *
+/*
  * Removes the count for the old reader from the appropriate per-CPU
  * element of the srcu_struct.  Note that this may well be a different
  * CPU than that which was incremented by the corresponding srcu_read_lock().
  * Must be called from process context.
  */
-void srcu_read_unlock(struct srcu_struct *sp, int idx)
+void __srcu_read_unlock(struct srcu_struct *sp, int idx)
 {
        preempt_disable();
        srcu_barrier();  /* ensure compiler won't misorder critical section. */
        per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]--;
        preempt_enable();
 }
-EXPORT_SYMBOL_GPL(srcu_read_unlock);
+EXPORT_SYMBOL_GPL(__srcu_read_unlock);
 
 /*
  * Helper function for synchronize_srcu() and synchronize_srcu_expedited().
  */
-void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void))
+static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void))
 {
        int idx;
 
index 26a6b73a6b85bbc2a4ee1e1392d3aa86d1e9a850..877fe4f8e05e0439e58edae684bf6a57c6e9e3a9 100644 (file)
@@ -222,6 +222,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
        if (which > PRIO_USER || which < PRIO_PROCESS)
                return -EINVAL;
 
+       rcu_read_lock();
        read_lock(&tasklist_lock);
        switch (which) {
                case PRIO_PROCESS:
@@ -267,6 +268,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
        }
 out_unlock:
        read_unlock(&tasklist_lock);
+       rcu_read_unlock();
 
        return retval;
 }
@@ -569,11 +571,6 @@ static int set_user(struct cred *new)
        if (!new_user)
                return -EAGAIN;
 
-       if (!task_can_switch_user(new_user, current)) {
-               free_uid(new_user);
-               return -EINVAL;
-       }
-
        if (atomic_read(&new_user->processes) >=
                                current->signal->rlim[RLIMIT_NPROC].rlim_cur &&
                        new_user != INIT_USER) {
index 6f740d9f09485a3843086d20472c169b86c232aa..d7395fdfb9f38f931761e29d14534143dbe3799c 100644 (file)
@@ -259,7 +259,8 @@ void clockevents_notify(unsigned long reason, void *arg)
                cpu = *((int *)arg);
                list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
                        if (cpumask_test_cpu(cpu, dev->cpumask) &&
-                           cpumask_weight(dev->cpumask) == 1) {
+                           cpumask_weight(dev->cpumask) == 1 &&
+                           !tick_is_broadcast_device(dev)) {
                                BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
                                list_del(&dev->list);
                        }
index e85c23404d34526acfc9359a530ec23044aa0b7e..1f663d23e85e940d71716627d2de509143a88bfb 100644 (file)
@@ -343,7 +343,19 @@ static void clocksource_resume_watchdog(void)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&watchdog_lock, flags);
+       /*
+        * We use trylock here to avoid a potential dead lock when
+        * kgdb calls this code after the kernel has been stopped with
+        * watchdog_lock held. When watchdog_lock is held we just
+        * return and accept, that the watchdog might trigger and mark
+        * the monitored clock source (usually TSC) unstable.
+        *
+        * This does not affect the other caller clocksource_resume()
+        * because at this point the kernel is UP, interrupts are
+        * disabled and nothing can hold watchdog_lock.
+        */
+       if (!spin_trylock_irqsave(&watchdog_lock, flags))
+               return;
        clocksource_reset_watchdog();
        spin_unlock_irqrestore(&watchdog_lock, flags);
 }
@@ -440,6 +452,18 @@ static inline int clocksource_watchdog_kthread(void *data) { return 0; }
 
 #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
 
+/**
+ * clocksource_suspend - suspend the clocksource(s)
+ */
+void clocksource_suspend(void)
+{
+       struct clocksource *cs;
+
+       list_for_each_entry_reverse(cs, &clocksource_list, list)
+               if (cs->suspend)
+                       cs->suspend(cs);
+}
+
 /**
  * clocksource_resume - resume the clocksource(s)
  */
@@ -449,7 +473,7 @@ void clocksource_resume(void)
 
        list_for_each_entry(cs, &clocksource_list, list)
                if (cs->resume)
-                       cs->resume();
+                       cs->resume(cs);
 
        clocksource_resume_watchdog();
 }
@@ -458,8 +482,8 @@ void clocksource_resume(void)
  * clocksource_touch_watchdog - Update watchdog
  *
  * Update the watchdog after exception contexts such as kgdb so as not
- * to incorrectly trip the watchdog.
- *
+ * to incorrectly trip the watchdog. This might fail when the kernel
+ * was stopped in code which holds watchdog_lock.
  */
 void clocksource_touch_watchdog(void)
 {
index 4800f933910ea4ed8f0f2d8ad4d2f660eb4a3467..7c0f180d6e9d59053740fed37d39ae5374cb3720 100644 (file)
@@ -58,10 +58,10 @@ static s64                  time_offset;
 static long                    time_constant = 2;
 
 /* maximum error (usecs):                                              */
-long                           time_maxerror = NTP_PHASE_LIMIT;
+static long                    time_maxerror = NTP_PHASE_LIMIT;
 
 /* estimated error (usecs):                                            */
-long                           time_esterror = NTP_PHASE_LIMIT;
+static long                    time_esterror = NTP_PHASE_LIMIT;
 
 /* frequency offset (scaled nsecs/secs):                               */
 static s64                     time_freq;
@@ -142,11 +142,11 @@ static void ntp_update_offset(long offset)
         * Select how the frequency is to be controlled
         * and in which mode (PLL or FLL).
         */
-       secs = xtime.tv_sec - time_reftime;
+       secs = get_seconds() - time_reftime;
        if (unlikely(time_status & STA_FREQHOLD))
                secs = 0;
 
-       time_reftime = xtime.tv_sec;
+       time_reftime = get_seconds();
 
        offset64    = offset;
        freq_adj    = (offset64 * secs) <<
@@ -368,7 +368,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts)
         * reference time to current time.
         */
        if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
-               time_reftime = xtime.tv_sec;
+               time_reftime = get_seconds();
 
        /* only set allowed bits */
        time_status &= STA_RONLY;
index 7faaa32fbf4f37d1d2efdedf9a3087a98455f7b6..16736379a9caaba6320f32f3df6e94cb5a9abbda 100644 (file)
@@ -622,6 +622,7 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
        write_sequnlock_irqrestore(&xtime_lock, flags);
 
        clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
+       clocksource_suspend();
 
        return 0;
 }
@@ -880,6 +881,7 @@ void getboottime(struct timespec *ts)
 
        set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
 }
+EXPORT_SYMBOL_GPL(getboottime);
 
 /**
  * monotonic_to_bootbased - Convert the monotonic time to boot based.
@@ -889,6 +891,7 @@ void monotonic_to_bootbased(struct timespec *ts)
 {
        *ts = timespec_add_safe(*ts, total_sleep_time);
 }
+EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
 
 unsigned long get_seconds(void)
 {
index 15533b792397be532ddcce7f2d24c04f78efba75..c61a7949387f93e69b1a4979eff1a03c7e7131b4 100644 (file)
@@ -1198,6 +1198,7 @@ void update_process_times(int user_tick)
        run_local_timers();
        rcu_check_callbacks(cpu, user_tick);
        printk_tick();
+       perf_event_do_pending();
        scheduler_tick();
        run_posix_cpu_timers(p);
 }
@@ -1209,8 +1210,6 @@ static void run_timer_softirq(struct softirq_action *h)
 {
        struct tvec_base *base = __get_cpu_var(tvec_bases);
 
-       perf_event_do_pending();
-
        hrtimer_run_pending();
 
        if (time_after_eq(jiffies, base->timer_jiffies))
index 6c22d8a2f289e81de4af3ccff97996f752a06583..13e13d428cd37b96ca144b733c4c98fa4c7f257d 100644 (file)
@@ -27,9 +27,7 @@ config HAVE_FUNCTION_GRAPH_TRACER
 config HAVE_FUNCTION_GRAPH_FP_TEST
        bool
        help
-        An arch may pass in a unique value (frame pointer) to both the
-        entering and exiting of a function. On exit, the value is compared
-        and if it does not match, then it will panic the kernel.
+         See Documentation/trace/ftrace-design.txt
 
 config HAVE_FUNCTION_TRACE_MCOUNT_TEST
        bool
@@ -330,15 +328,6 @@ config BRANCH_TRACER
 
          Say N if unsure.
 
-config POWER_TRACER
-       bool "Trace power consumption behavior"
-       depends on X86
-       select GENERIC_TRACER
-       help
-         This tracer helps developers to analyze and optimize the kernel's
-         power management decisions, specifically the C-state and P-state
-         behavior.
-
 config KSYM_TRACER
        bool "Trace read and write access on kernel memory locations"
        depends on HAVE_HW_BREAKPOINT
@@ -451,7 +440,7 @@ config BLK_DEV_IO_TRACE
 
 config KPROBE_EVENT
        depends on KPROBES
-       depends on X86
+       depends on HAVE_REGS_AND_STACK_ACCESS_API
        bool "Enable kprobes-based dynamic events"
        select TRACING
        default y
index cd9ecd89ec7714d34f16fd541beabd9ce0e504d2..d00c6fe23f54aec4176db3139deee574ed42557b 100644 (file)
@@ -51,7 +51,9 @@ endif
 obj-$(CONFIG_EVENT_TRACING) += trace_events.o
 obj-$(CONFIG_EVENT_TRACING) += trace_export.o
 obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
-obj-$(CONFIG_EVENT_PROFILE) += trace_event_profile.o
+ifeq ($(CONFIG_PERF_EVENTS),y)
+obj-$(CONFIG_EVENT_TRACING) += trace_event_profile.o
+endif
 obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
 obj-$(CONFIG_KSYM_TRACER) += trace_ksym.o
index 7968762c8167062d1f05d2e14531b349ba840518..83783579378f3a19b0a13ac3a4ea1b3bd6f4a0b6 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/hardirq.h>
 #include <linux/kthread.h>
 #include <linux/uaccess.h>
-#include <linux/kprobes.h>
 #include <linux/ftrace.h>
 #include <linux/sysctl.h>
 #include <linux/ctype.h>
@@ -898,36 +897,6 @@ static struct dyn_ftrace *ftrace_free_records;
                }                               \
        }
 
-#ifdef CONFIG_KPROBES
-
-static int frozen_record_count;
-
-static inline void freeze_record(struct dyn_ftrace *rec)
-{
-       if (!(rec->flags & FTRACE_FL_FROZEN)) {
-               rec->flags |= FTRACE_FL_FROZEN;
-               frozen_record_count++;
-       }
-}
-
-static inline void unfreeze_record(struct dyn_ftrace *rec)
-{
-       if (rec->flags & FTRACE_FL_FROZEN) {
-               rec->flags &= ~FTRACE_FL_FROZEN;
-               frozen_record_count--;
-       }
-}
-
-static inline int record_frozen(struct dyn_ftrace *rec)
-{
-       return rec->flags & FTRACE_FL_FROZEN;
-}
-#else
-# define freeze_record(rec)                    ({ 0; })
-# define unfreeze_record(rec)                  ({ 0; })
-# define record_frozen(rec)                    ({ 0; })
-#endif /* CONFIG_KPROBES */
-
 static void ftrace_free_rec(struct dyn_ftrace *rec)
 {
        rec->freelist = ftrace_free_records;
@@ -1025,6 +994,21 @@ static void ftrace_bug(int failed, unsigned long ip)
 }
 
 
+/* Return 1 if the address range is reserved for ftrace */
+int ftrace_text_reserved(void *start, void *end)
+{
+       struct dyn_ftrace *rec;
+       struct ftrace_page *pg;
+
+       do_for_each_ftrace_rec(pg, rec) {
+               if (rec->ip <= (unsigned long)end &&
+                   rec->ip + MCOUNT_INSN_SIZE > (unsigned long)start)
+                       return 1;
+       } while_for_each_ftrace_rec();
+       return 0;
+}
+
+
 static int
 __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
 {
@@ -1076,14 +1060,6 @@ static void ftrace_replace_code(int enable)
                    !(rec->flags & FTRACE_FL_CONVERTED))
                        continue;
 
-               /* ignore updates to this record's mcount site */
-               if (get_kprobe((void *)rec->ip)) {
-                       freeze_record(rec);
-                       continue;
-               } else {
-                       unfreeze_record(rec);
-               }
-
                failed = __ftrace_replace_code(rec, enable);
                if (failed) {
                        rec->flags |= FTRACE_FL_FAILED;
@@ -1690,7 +1666,7 @@ ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
 static int ftrace_match(char *str, char *regex, int len, int type)
 {
        int matched = 0;
-       char *ptr;
+       int slen;
 
        switch (type) {
        case MATCH_FULL:
@@ -1706,8 +1682,8 @@ static int ftrace_match(char *str, char *regex, int len, int type)
                        matched = 1;
                break;
        case MATCH_END_ONLY:
-               ptr = strstr(str, regex);
-               if (ptr && (ptr[len] == 0))
+               slen = strlen(str);
+               if (slen >= len && memcmp(str + slen - len, regex, len) == 0)
                        matched = 1;
                break;
        }
@@ -2426,6 +2402,7 @@ static const struct file_operations ftrace_notrace_fops = {
 static DEFINE_MUTEX(graph_lock);
 
 int ftrace_graph_count;
+int ftrace_graph_filter_enabled;
 unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly;
 
 static void *
@@ -2448,7 +2425,7 @@ static void *g_start(struct seq_file *m, loff_t *pos)
        mutex_lock(&graph_lock);
 
        /* Nothing, tell g_show to print all functions are enabled */
-       if (!ftrace_graph_count && !*pos)
+       if (!ftrace_graph_filter_enabled && !*pos)
                return (void *)1;
 
        return __g_next(m, pos);
@@ -2494,6 +2471,7 @@ ftrace_graph_open(struct inode *inode, struct file *file)
        mutex_lock(&graph_lock);
        if ((file->f_mode & FMODE_WRITE) &&
            (file->f_flags & O_TRUNC)) {
+               ftrace_graph_filter_enabled = 0;
                ftrace_graph_count = 0;
                memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs));
        }
@@ -2519,7 +2497,7 @@ ftrace_set_func(unsigned long *array, int *idx, char *buffer)
        struct dyn_ftrace *rec;
        struct ftrace_page *pg;
        int search_len;
-       int found = 0;
+       int fail = 1;
        int type, not;
        char *search;
        bool exists;
@@ -2530,37 +2508,51 @@ ftrace_set_func(unsigned long *array, int *idx, char *buffer)
 
        /* decode regex */
        type = filter_parse_regex(buffer, strlen(buffer), &search, &not);
-       if (not)
-               return -EINVAL;
+       if (!not && *idx >= FTRACE_GRAPH_MAX_FUNCS)
+               return -EBUSY;
 
        search_len = strlen(search);
 
        mutex_lock(&ftrace_lock);
        do_for_each_ftrace_rec(pg, rec) {
 
-               if (*idx >= FTRACE_GRAPH_MAX_FUNCS)
-                       break;
-
                if (rec->flags & (FTRACE_FL_FAILED | FTRACE_FL_FREE))
                        continue;
 
                if (ftrace_match_record(rec, search, search_len, type)) {
-                       /* ensure it is not already in the array */
+                       /* if it is in the array */
                        exists = false;
-                       for (i = 0; i < *idx; i++)
+                       for (i = 0; i < *idx; i++) {
                                if (array[i] == rec->ip) {
                                        exists = true;
                                        break;
                                }
-                       if (!exists)
-                               array[(*idx)++] = rec->ip;
-                       found = 1;
+                       }
+
+                       if (!not) {
+                               fail = 0;
+                               if (!exists) {
+                                       array[(*idx)++] = rec->ip;
+                                       if (*idx >= FTRACE_GRAPH_MAX_FUNCS)
+                                               goto out;
+                               }
+                       } else {
+                               if (exists) {
+                                       array[i] = array[--(*idx)];
+                                       array[*idx] = 0;
+                                       fail = 0;
+                               }
+                       }
                }
        } while_for_each_ftrace_rec();
-
+out:
        mutex_unlock(&ftrace_lock);
 
-       return found ? 0 : -EINVAL;
+       if (fail)
+               return -EINVAL;
+
+       ftrace_graph_filter_enabled = 1;
+       return 0;
 }
 
 static ssize_t
@@ -2570,16 +2562,11 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
        struct trace_parser parser;
        ssize_t read, ret;
 
-       if (!cnt || cnt < 0)
+       if (!cnt)
                return 0;
 
        mutex_lock(&graph_lock);
 
-       if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
-               ret = -EBUSY;
-               goto out_unlock;
-       }
-
        if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
                ret = -ENOMEM;
                goto out_unlock;
index 2326b04c95c493fec48418746c0194980ad4b4fa..8c1b2d290718cfc1a14c99b8ab1ca5408821b4b5 100644 (file)
@@ -464,6 +464,8 @@ struct ring_buffer_iter {
        struct ring_buffer_per_cpu      *cpu_buffer;
        unsigned long                   head;
        struct buffer_page              *head_page;
+       struct buffer_page              *cache_reader_page;
+       unsigned long                   cache_read;
        u64                             read_stamp;
 };
 
@@ -2716,6 +2718,8 @@ static void rb_iter_reset(struct ring_buffer_iter *iter)
                iter->read_stamp = cpu_buffer->read_stamp;
        else
                iter->read_stamp = iter->head_page->page->time_stamp;
+       iter->cache_reader_page = cpu_buffer->reader_page;
+       iter->cache_read = cpu_buffer->read;
 }
 
 /**
@@ -2869,7 +2873,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
         * Splice the empty reader page into the list around the head.
         */
        reader = rb_set_head_page(cpu_buffer);
-       cpu_buffer->reader_page->list.next = reader->list.next;
+       cpu_buffer->reader_page->list.next = rb_list_head(reader->list.next);
        cpu_buffer->reader_page->list.prev = reader->list.prev;
 
        /*
@@ -2906,7 +2910,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
         *
         * Now make the new head point back to the reader page.
         */
-       reader->list.next->prev = &cpu_buffer->reader_page->list;
+       rb_list_head(reader->list.next)->prev = &cpu_buffer->reader_page->list;
        rb_inc_page(cpu_buffer, &cpu_buffer->head_page);
 
        /* Finally update the reader page to the new head */
@@ -3060,13 +3064,22 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts)
        struct ring_buffer_event *event;
        int nr_loops = 0;
 
-       if (ring_buffer_iter_empty(iter))
-               return NULL;
-
        cpu_buffer = iter->cpu_buffer;
        buffer = cpu_buffer->buffer;
 
+       /*
+        * Check if someone performed a consuming read to
+        * the buffer. A consuming read invalidates the iterator
+        * and we need to reset the iterator in this case.
+        */
+       if (unlikely(iter->cache_read != cpu_buffer->read ||
+                    iter->cache_reader_page != cpu_buffer->reader_page))
+               rb_iter_reset(iter);
+
  again:
+       if (ring_buffer_iter_empty(iter))
+               return NULL;
+
        /*
         * We repeat when a timestamp is encountered.
         * We can get multiple timestamps by nested interrupts or also
@@ -3081,6 +3094,11 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts)
        if (rb_per_cpu_empty(cpu_buffer))
                return NULL;
 
+       if (iter->head >= local_read(&iter->head_page->page->commit)) {
+               rb_inc_iter(iter);
+               goto again;
+       }
+
        event = rb_iter_head_event(iter);
 
        switch (event->type_len) {
index 0df1b0f2cb9e0717f2a21f6923389c1978a1fa04..032c57ca6502d462772be1250e66fbd905342f5c 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/splice.h>
 #include <linux/kdebug.h>
 #include <linux/string.h>
+#include <linux/rwsem.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
 #include <linux/poll.h>
@@ -102,9 +103,6 @@ static inline void ftrace_enable_cpu(void)
 
 static cpumask_var_t __read_mostly     tracing_buffer_mask;
 
-/* Define which cpu buffers are currently read in trace_pipe */
-static cpumask_var_t                   tracing_reader_cpumask;
-
 #define for_each_tracing_cpu(cpu)      \
        for_each_cpu(cpu, tracing_buffer_mask)
 
@@ -243,12 +241,91 @@ static struct tracer              *current_trace __read_mostly;
 
 /*
  * trace_types_lock is used to protect the trace_types list.
- * This lock is also used to keep user access serialized.
- * Accesses from userspace will grab this lock while userspace
- * activities happen inside the kernel.
  */
 static DEFINE_MUTEX(trace_types_lock);
 
+/*
+ * serialize the access of the ring buffer
+ *
+ * ring buffer serializes readers, but it is low level protection.
+ * The validity of the events (which returns by ring_buffer_peek() ..etc)
+ * are not protected by ring buffer.
+ *
+ * The content of events may become garbage if we allow other process consumes
+ * these events concurrently:
+ *   A) the page of the consumed events may become a normal page
+ *      (not reader page) in ring buffer, and this page will be rewrited
+ *      by events producer.
+ *   B) The page of the consumed events may become a page for splice_read,
+ *      and this page will be returned to system.
+ *
+ * These primitives allow multi process access to different cpu ring buffer
+ * concurrently.
+ *
+ * These primitives don't distinguish read-only and read-consume access.
+ * Multi read-only access are also serialized.
+ */
+
+#ifdef CONFIG_SMP
+static DECLARE_RWSEM(all_cpu_access_lock);
+static DEFINE_PER_CPU(struct mutex, cpu_access_lock);
+
+static inline void trace_access_lock(int cpu)
+{
+       if (cpu == TRACE_PIPE_ALL_CPU) {
+               /* gain it for accessing the whole ring buffer. */
+               down_write(&all_cpu_access_lock);
+       } else {
+               /* gain it for accessing a cpu ring buffer. */
+
+               /* Firstly block other trace_access_lock(TRACE_PIPE_ALL_CPU). */
+               down_read(&all_cpu_access_lock);
+
+               /* Secondly block other access to this @cpu ring buffer. */
+               mutex_lock(&per_cpu(cpu_access_lock, cpu));
+       }
+}
+
+static inline void trace_access_unlock(int cpu)
+{
+       if (cpu == TRACE_PIPE_ALL_CPU) {
+               up_write(&all_cpu_access_lock);
+       } else {
+               mutex_unlock(&per_cpu(cpu_access_lock, cpu));
+               up_read(&all_cpu_access_lock);
+       }
+}
+
+static inline void trace_access_lock_init(void)
+{
+       int cpu;
+
+       for_each_possible_cpu(cpu)
+               mutex_init(&per_cpu(cpu_access_lock, cpu));
+}
+
+#else
+
+static DEFINE_MUTEX(access_lock);
+
+static inline void trace_access_lock(int cpu)
+{
+       (void)cpu;
+       mutex_lock(&access_lock);
+}
+
+static inline void trace_access_unlock(int cpu)
+{
+       (void)cpu;
+       mutex_unlock(&access_lock);
+}
+
+static inline void trace_access_lock_init(void)
+{
+}
+
+#endif
+
 /* trace_wait is a waitqueue for tasks blocked on trace_poll */
 static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
 
@@ -951,6 +1028,11 @@ void trace_find_cmdline(int pid, char comm[])
                return;
        }
 
+       if (WARN_ON_ONCE(pid < 0)) {
+               strcpy(comm, "<XXX>");
+               return;
+       }
+
        if (pid > PID_MAX_DEFAULT) {
                strcpy(comm, "<...>");
                return;
@@ -1315,8 +1397,10 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
        entry->fmt                      = fmt;
 
        memcpy(entry->buf, trace_buf, sizeof(u32) * len);
-       if (!filter_check_discard(call, entry, buffer, event))
+       if (!filter_check_discard(call, entry, buffer, event)) {
                ring_buffer_unlock_commit(buffer, event);
+               ftrace_trace_stack(buffer, flags, 6, pc);
+       }
 
 out_unlock:
        arch_spin_unlock(&trace_buf_lock);
@@ -1389,8 +1473,10 @@ int trace_array_vprintk(struct trace_array *tr,
 
        memcpy(&entry->buf, trace_buf, len);
        entry->buf[len] = '\0';
-       if (!filter_check_discard(call, entry, buffer, event))
+       if (!filter_check_discard(call, entry, buffer, event)) {
                ring_buffer_unlock_commit(buffer, event);
+               ftrace_trace_stack(buffer, irq_flags, 6, pc);
+       }
 
  out_unlock:
        arch_spin_unlock(&trace_buf_lock);
@@ -1580,12 +1666,6 @@ static void tracing_iter_reset(struct trace_iterator *iter, int cpu)
 }
 
 /*
- * No necessary locking here. The worst thing which can
- * happen is loosing events consumed at the same time
- * by a trace_pipe reader.
- * Other than that, we don't risk to crash the ring buffer
- * because it serializes the readers.
- *
  * The current tracer is copied to avoid a global locking
  * all around.
  */
@@ -1640,12 +1720,16 @@ static void *s_start(struct seq_file *m, loff_t *pos)
        }
 
        trace_event_read_lock();
+       trace_access_lock(cpu_file);
        return p;
 }
 
 static void s_stop(struct seq_file *m, void *p)
 {
+       struct trace_iterator *iter = m->private;
+
        atomic_dec(&trace_record_cmdline_disabled);
+       trace_access_unlock(iter->cpu_file);
        trace_event_read_unlock();
 }
 
@@ -2836,22 +2920,6 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
 
        mutex_lock(&trace_types_lock);
 
-       /* We only allow one reader per cpu */
-       if (cpu_file == TRACE_PIPE_ALL_CPU) {
-               if (!cpumask_empty(tracing_reader_cpumask)) {
-                       ret = -EBUSY;
-                       goto out;
-               }
-               cpumask_setall(tracing_reader_cpumask);
-       } else {
-               if (!cpumask_test_cpu(cpu_file, tracing_reader_cpumask))
-                       cpumask_set_cpu(cpu_file, tracing_reader_cpumask);
-               else {
-                       ret = -EBUSY;
-                       goto out;
-               }
-       }
-
        /* create a buffer to store the information to pass to userspace */
        iter = kzalloc(sizeof(*iter), GFP_KERNEL);
        if (!iter) {
@@ -2907,12 +2975,6 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
 
        mutex_lock(&trace_types_lock);
 
-       if (iter->cpu_file == TRACE_PIPE_ALL_CPU)
-               cpumask_clear(tracing_reader_cpumask);
-       else
-               cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
-
-
        if (iter->trace->pipe_close)
                iter->trace->pipe_close(iter);
 
@@ -3074,6 +3136,7 @@ waitagain:
        iter->pos = -1;
 
        trace_event_read_lock();
+       trace_access_lock(iter->cpu_file);
        while (find_next_entry_inc(iter) != NULL) {
                enum print_line_t ret;
                int len = iter->seq.len;
@@ -3090,6 +3153,7 @@ waitagain:
                if (iter->seq.len >= cnt)
                        break;
        }
+       trace_access_unlock(iter->cpu_file);
        trace_event_read_unlock();
 
        /* Now copy what we have to the user */
@@ -3215,6 +3279,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
        }
 
        trace_event_read_lock();
+       trace_access_lock(iter->cpu_file);
 
        /* Fill as many pages as possible. */
        for (i = 0, rem = len; i < PIPE_BUFFERS && rem; i++) {
@@ -3238,6 +3303,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
                trace_seq_init(&iter->seq);
        }
 
+       trace_access_unlock(iter->cpu_file);
        trace_event_read_unlock();
        mutex_unlock(&iter->mutex);
 
@@ -3539,10 +3605,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
 
        info->read = 0;
 
+       trace_access_lock(info->cpu);
        ret = ring_buffer_read_page(info->tr->buffer,
                                    &info->spare,
                                    count,
                                    info->cpu, 0);
+       trace_access_unlock(info->cpu);
        if (ret < 0)
                return 0;
 
@@ -3670,6 +3738,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
                len &= PAGE_MASK;
        }
 
+       trace_access_lock(info->cpu);
        entries = ring_buffer_entries_cpu(info->tr->buffer, info->cpu);
 
        for (i = 0; i < PIPE_BUFFERS && len && entries; i++, len -= PAGE_SIZE) {
@@ -3717,6 +3786,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
                entries = ring_buffer_entries_cpu(info->tr->buffer, info->cpu);
        }
 
+       trace_access_unlock(info->cpu);
        spd.nr_pages = i;
 
        /* did we read anything? */
@@ -4153,6 +4223,8 @@ static __init int tracer_init_debugfs(void)
        struct dentry *d_tracer;
        int cpu;
 
+       trace_access_lock_init();
+
        d_tracer = tracing_init_dentry();
 
        trace_create_file("tracing_enabled", 0644, d_tracer,
@@ -4387,9 +4459,6 @@ __init static int tracer_alloc_buffers(void)
        if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL))
                goto out_free_buffer_mask;
 
-       if (!zalloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL))
-               goto out_free_tracing_cpumask;
-
        /* To save memory, keep the ring buffer size to its minimum */
        if (ring_buffer_expanded)
                ring_buf_size = trace_buf_size;
@@ -4447,8 +4516,6 @@ __init static int tracer_alloc_buffers(void)
        return 0;
 
 out_free_cpumask:
-       free_cpumask_var(tracing_reader_cpumask);
-out_free_tracing_cpumask:
        free_cpumask_var(tracing_cpumask);
 out_free_buffer_mask:
        free_cpumask_var(tracing_buffer_mask);
index 4df6a77eb1966bd4ea12779121f12e96ddf1d3f6..fd05bcaf91b06cc8c979d02bb3decb1f3696df3a 100644 (file)
@@ -497,6 +497,7 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
 #ifdef CONFIG_DYNAMIC_FTRACE
 /* TODO: make this variable */
 #define FTRACE_GRAPH_MAX_FUNCS         32
+extern int ftrace_graph_filter_enabled;
 extern int ftrace_graph_count;
 extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS];
 
@@ -504,7 +505,7 @@ static inline int ftrace_graph_addr(unsigned long addr)
 {
        int i;
 
-       if (!ftrace_graph_count || test_tsk_trace_graph(current))
+       if (!ftrace_graph_filter_enabled)
                return 1;
 
        for (i = 0; i < ftrace_graph_count; i++) {
@@ -791,7 +792,8 @@ extern const char *__stop___trace_bprintk_fmt[];
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, id, tstruct, print)            \
-       extern struct ftrace_event_call event_##call;
+       extern struct ftrace_event_call                                 \
+       __attribute__((__aligned__(4))) event_##call;
 #undef FTRACE_ENTRY_DUP
 #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print)                \
        FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
index 4a194f08f88cc8d7143d5fbd1d43c0efc2013292..b9bc4d47017724a5dc278b910f1b2c4fff443741 100644 (file)
@@ -307,8 +307,23 @@ static int annotated_branch_stat_cmp(void *p1, void *p2)
                return -1;
        if (percent_a > percent_b)
                return 1;
-       else
-               return 0;
+
+       if (a->incorrect < b->incorrect)
+               return -1;
+       if (a->incorrect > b->incorrect)
+               return 1;
+
+       /*
+        * Since the above shows worse (incorrect) cases
+        * first, we continue that by showing best (correct)
+        * cases last.
+        */
+       if (a->correct > b->correct)
+               return -1;
+       if (a->correct < b->correct)
+               return 1;
+
+       return 0;
 }
 
 static struct tracer_stat annotated_branch_stats = {
index 9e25573242cff54733fee9a49a820b1bf5f29d52..f0d693005075c938a7163e38f67171587814f0cc 100644 (file)
@@ -6,14 +6,12 @@
  */
 
 #include <linux/module.h>
+#include <linux/kprobes.h>
 #include "trace.h"
 
 
-char *perf_trace_buf;
-EXPORT_SYMBOL_GPL(perf_trace_buf);
-
-char *perf_trace_buf_nmi;
-EXPORT_SYMBOL_GPL(perf_trace_buf_nmi);
+static char *perf_trace_buf;
+static char *perf_trace_buf_nmi;
 
 typedef typeof(char [FTRACE_MAX_PROFILE_SIZE]) perf_trace_t ;
 
@@ -120,3 +118,47 @@ void ftrace_profile_disable(int event_id)
        }
        mutex_unlock(&event_mutex);
 }
+
+__kprobes void *ftrace_perf_buf_prepare(int size, unsigned short type,
+                                       int *rctxp, unsigned long *irq_flags)
+{
+       struct trace_entry *entry;
+       char *trace_buf, *raw_data;
+       int pc, cpu;
+
+       pc = preempt_count();
+
+       /* Protect the per cpu buffer, begin the rcu read side */
+       local_irq_save(*irq_flags);
+
+       *rctxp = perf_swevent_get_recursion_context();
+       if (*rctxp < 0)
+               goto err_recursion;
+
+       cpu = smp_processor_id();
+
+       if (in_nmi())
+               trace_buf = rcu_dereference(perf_trace_buf_nmi);
+       else
+               trace_buf = rcu_dereference(perf_trace_buf);
+
+       if (!trace_buf)
+               goto err;
+
+       raw_data = per_cpu_ptr(trace_buf, cpu);
+
+       /* zero the dead bytes from align to not leak stack to user */
+       *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;
+
+       entry = (struct trace_entry *)raw_data;
+       tracing_generic_entry_update(entry, *irq_flags, pc);
+       entry->type = type;
+
+       return raw_data;
+err:
+       perf_swevent_put_recursion_context(*rctxp);
+err_recursion:
+       local_irq_restore(*irq_flags);
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(ftrace_perf_buf_prepare);
index 189b09baf4fbfd1bb6a2340897c477d83d6de800..3f972ad98d04f48926edaf6953ea74d22bd32eab 100644 (file)
@@ -60,10 +60,8 @@ int trace_define_field(struct ftrace_event_call *call, const char *type,
        return 0;
 
 err:
-       if (field) {
+       if (field)
                kfree(field->name);
-               kfree(field->type);
-       }
        kfree(field);
 
        return -ENOMEM;
@@ -520,41 +518,16 @@ out:
        return ret;
 }
 
-extern char *__bad_type_size(void);
-
-#undef FIELD
-#define FIELD(type, name)                                              \
-       sizeof(type) != sizeof(field.name) ? __bad_type_size() :        \
-       #type, "common_" #name, offsetof(typeof(field), name),          \
-               sizeof(field.name), is_signed_type(type)
-
-static int trace_write_header(struct trace_seq *s)
-{
-       struct trace_entry field;
-
-       /* struct trace_entry */
-       return trace_seq_printf(s,
-                       "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\tsigned:%u;\n"
-                       "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\tsigned:%u;\n"
-                       "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\tsigned:%u;\n"
-                       "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\tsigned:%u;\n"
-                       "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\tsigned:%u;\n"
-                       "\n",
-                       FIELD(unsigned short, type),
-                       FIELD(unsigned char, flags),
-                       FIELD(unsigned char, preempt_count),
-                       FIELD(int, pid),
-                       FIELD(int, lock_depth));
-}
-
 static ssize_t
 event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
                  loff_t *ppos)
 {
        struct ftrace_event_call *call = filp->private_data;
+       struct ftrace_event_field *field;
        struct trace_seq *s;
+       int common_field_count = 5;
        char *buf;
-       int r;
+       int r = 0;
 
        if (*ppos)
                return 0;
@@ -565,14 +538,48 @@ event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
 
        trace_seq_init(s);
 
-       /* If any of the first writes fail, so will the show_format. */
-
        trace_seq_printf(s, "name: %s\n", call->name);
        trace_seq_printf(s, "ID: %d\n", call->id);
        trace_seq_printf(s, "format:\n");
-       trace_write_header(s);
 
-       r = call->show_format(call, s);
+       list_for_each_entry_reverse(field, &call->fields, link) {
+               /*
+                * Smartly shows the array type(except dynamic array).
+                * Normal:
+                *      field:TYPE VAR
+                * If TYPE := TYPE[LEN], it is shown:
+                *      field:TYPE VAR[LEN]
+                */
+               const char *array_descriptor = strchr(field->type, '[');
+
+               if (!strncmp(field->type, "__data_loc", 10))
+                       array_descriptor = NULL;
+
+               if (!array_descriptor) {
+                       r = trace_seq_printf(s, "\tfield:%s %s;\toffset:%u;"
+                                       "\tsize:%u;\tsigned:%d;\n",
+                                       field->type, field->name, field->offset,
+                                       field->size, !!field->is_signed);
+               } else {
+                       r = trace_seq_printf(s, "\tfield:%.*s %s%s;\toffset:%u;"
+                                       "\tsize:%u;\tsigned:%d;\n",
+                                       (int)(array_descriptor - field->type),
+                                       field->type, field->name,
+                                       array_descriptor, field->offset,
+                                       field->size, !!field->is_signed);
+               }
+
+               if (--common_field_count == 0)
+                       r = trace_seq_printf(s, "\n");
+
+               if (!r)
+                       break;
+       }
+
+       if (r)
+               r = trace_seq_printf(s, "\nprint fmt: %s\n",
+                               call->print_fmt);
+
        if (!r) {
                /*
                 * ug!  The format output is bigger than a PAGE!!
@@ -948,10 +955,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
                                  filter);
        }
 
-       /* A trace may not want to export its format */
-       if (!call->show_format)
-               return 0;
-
        trace_create_file("format", 0444, call->dir, call,
                          format);
 
index 50504cb228deded61a141aca151c3d802719b2c2..4615f62a04f185bf5d38b89162ca223884954385 100644 (file)
@@ -211,8 +211,9 @@ static int filter_pred_pchar(struct filter_pred *pred, void *event,
 {
        char **addr = (char **)(event + pred->offset);
        int cmp, match;
+       int len = strlen(*addr) + 1;    /* including tailing '\0' */
 
-       cmp = pred->regex.match(*addr, &pred->regex, pred->regex.field_len);
+       cmp = pred->regex.match(*addr, &pred->regex, len);
 
        match = cmp ^ pred->not;
 
@@ -251,7 +252,18 @@ static int filter_pred_none(struct filter_pred *pred, void *event,
        return 0;
 }
 
-/* Basic regex callbacks */
+/*
+ * regex_match_foo - Basic regex callbacks
+ *
+ * @str: the string to be searched
+ * @r:   the regex structure containing the pattern string
+ * @len: the length of the string to be searched (including '\0')
+ *
+ * Note:
+ * - @str might not be NULL-terminated if it's of type DYN_STRING
+ *   or STATIC_STRING
+ */
+
 static int regex_match_full(char *str, struct regex *r, int len)
 {
        if (strncmp(str, r->pattern, len) == 0)
@@ -261,23 +273,24 @@ static int regex_match_full(char *str, struct regex *r, int len)
 
 static int regex_match_front(char *str, struct regex *r, int len)
 {
-       if (strncmp(str, r->pattern, len) == 0)
+       if (strncmp(str, r->pattern, r->len) == 0)
                return 1;
        return 0;
 }
 
 static int regex_match_middle(char *str, struct regex *r, int len)
 {
-       if (strstr(str, r->pattern))
+       if (strnstr(str, r->pattern, len))
                return 1;
        return 0;
 }
 
 static int regex_match_end(char *str, struct regex *r, int len)
 {
-       char *ptr = strstr(str, r->pattern);
+       int strlen = len - 1;
 
-       if (ptr && (ptr[r->len] == 0))
+       if (strlen >= r->len &&
+           memcmp(str + strlen - r->len, r->pattern, r->len) == 0)
                return 1;
        return 0;
 }
@@ -781,10 +794,8 @@ static int filter_add_pred(struct filter_parse_state *ps,
                        pred->regex.field_len = field->size;
                } else if (field->filter_type == FILTER_DYN_STRING)
                        fn = filter_pred_strloc;
-               else {
+               else
                        fn = filter_pred_pchar;
-                       pred->regex.field_len = strlen(pred->regex.pattern);
-               }
        } else {
                if (field->is_signed)
                        ret = strict_strtoll(pred->regex.pattern, 0, &val);
@@ -1360,7 +1371,7 @@ out_unlock:
        return err;
 }
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 void ftrace_profile_free_filter(struct perf_event *event)
 {
@@ -1428,5 +1439,5 @@ out_unlock:
        return err;
 }
 
-#endif /* CONFIG_EVENT_PROFILE */
+#endif /* CONFIG_PERF_EVENTS */
 
index d4fa5dc1ee4e0763a54224654129ded7c9ec48f1..e091f64ba6ce04dc6437276bbb2cadd4fe39de4f 100644 (file)
@@ -62,78 +62,6 @@ static void __always_unused ____ftrace_check_##name(void)    \
 
 #include "trace_entries.h"
 
-
-#undef __field
-#define __field(type, item)                                            \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:%zu;\tsigned:%u;\n",  \
-                              offsetof(typeof(field), item),           \
-                              sizeof(field.item), is_signed_type(type)); \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __field_desc
-#define __field_desc(type, container, item)                            \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:%zu;\tsigned:%u;\n",  \
-                              offsetof(typeof(field), container.item), \
-                              sizeof(field.container.item),            \
-                              is_signed_type(type));                   \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __array
-#define __array(type, item, len)                                       \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
-                              "offset:%zu;\tsize:%zu;\tsigned:%u;\n",  \
-                              offsetof(typeof(field), item),           \
-                              sizeof(field.item), is_signed_type(type)); \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __array_desc
-#define __array_desc(type, container, item, len)                       \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
-                              "offset:%zu;\tsize:%zu;\tsigned:%u;\n",  \
-                              offsetof(typeof(field), container.item), \
-                              sizeof(field.container.item),            \
-                              is_signed_type(type));                   \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __dynamic_array
-#define __dynamic_array(type, item)                                    \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:0;\tsigned:%u;\n",    \
-                              offsetof(typeof(field), item),           \
-                              is_signed_type(type));                   \
-       if (!ret)                                                       \
-               return 0;
-
-#undef F_printk
-#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
-
-#undef __entry
-#define __entry REC
-
-#undef FTRACE_ENTRY
-#define FTRACE_ENTRY(name, struct_name, id, tstruct, print)            \
-static int                                                             \
-ftrace_format_##name(struct ftrace_event_call *unused,                 \
-                    struct trace_seq *s)                               \
-{                                                                      \
-       struct struct_name field __attribute__((unused));               \
-       int ret = 0;                                                    \
-                                                                       \
-       tstruct;                                                        \
-                                                                       \
-       trace_seq_printf(s, "\nprint fmt: " print);                     \
-                                                                       \
-       return ret;                                                     \
-}
-
-#include "trace_entries.h"
-
 #undef __field
 #define __field(type, item)                                            \
        ret = trace_define_field(event_call, #type, #item,              \
@@ -175,7 +103,12 @@ ftrace_format_##name(struct ftrace_event_call *unused,                     \
                return ret;
 
 #undef __dynamic_array
-#define __dynamic_array(type, item)
+#define __dynamic_array(type, item)                                    \
+       ret = trace_define_field(event_call, #type, #item,              \
+                                offsetof(typeof(field), item),         \
+                                0, is_signed_type(type), FILTER_OTHER);\
+       if (ret)                                                        \
+               return ret;
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(name, struct_name, id, tstruct, print)            \
@@ -198,6 +131,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
        return 0;
 }
 
+#undef __entry
+#define __entry REC
+
 #undef __field
 #define __field(type, item)
 
@@ -213,6 +149,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
 #undef __dynamic_array
 #define __dynamic_array(type, item)
 
+#undef F_printk
+#define F_printk(fmt, args...) #fmt ", "  __stringify(args)
+
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, type, tstruct, print)          \
                                                                        \
@@ -223,7 +162,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .id                     = type,                                 \
        .system                 = __stringify(TRACE_SYSTEM),            \
        .raw_init               = ftrace_raw_init_event,                \
-       .show_format            = ftrace_format_##call,                 \
+       .print_fmt              = print,                                \
        .define_fields          = ftrace_define_fields_##call,          \
 };                                                                     \
 
index b1342c5d37cfb821cfb96fcfd610cb95cdfb1082..e998a824e9db5480f7e9b43bb74f2856a1f1d921 100644 (file)
@@ -18,6 +18,7 @@ struct fgraph_cpu_data {
        pid_t           last_pid;
        int             depth;
        int             ignore;
+       unsigned long   enter_funcs[FTRACE_RETFUNC_DEPTH];
 };
 
 struct fgraph_data {
@@ -212,13 +213,11 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
        int cpu;
        int pc;
 
-       if (unlikely(!tr))
-               return 0;
-
        if (!ftrace_trace_task(current))
                return 0;
 
-       if (!ftrace_graph_addr(trace->func))
+       /* trace it when it is-nested-in or is a function enabled. */
+       if (!(trace->depth || ftrace_graph_addr(trace->func)))
                return 0;
 
        local_irq_save(flags);
@@ -231,9 +230,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
        } else {
                ret = 0;
        }
-       /* Only do the atomic if it is not already set */
-       if (!test_tsk_trace_graph(current))
-               set_tsk_trace_graph(current);
 
        atomic_dec(&data->disabled);
        local_irq_restore(flags);
@@ -281,17 +277,24 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
                pc = preempt_count();
                __trace_graph_return(tr, trace, flags, pc);
        }
-       if (!trace->depth)
-               clear_tsk_trace_graph(current);
        atomic_dec(&data->disabled);
        local_irq_restore(flags);
 }
 
+void set_graph_array(struct trace_array *tr)
+{
+       graph_array = tr;
+
+       /* Make graph_array visible before we start tracing */
+
+       smp_mb();
+}
+
 static int graph_trace_init(struct trace_array *tr)
 {
        int ret;
 
-       graph_array = tr;
+       set_graph_array(tr);
        ret = register_ftrace_graph(&trace_graph_return,
                                    &trace_graph_entry);
        if (ret)
@@ -301,11 +304,6 @@ static int graph_trace_init(struct trace_array *tr)
        return 0;
 }
 
-void set_graph_array(struct trace_array *tr)
-{
-       graph_array = tr;
-}
-
 static void graph_trace_reset(struct trace_array *tr)
 {
        tracing_stop_cmdline_record();
@@ -673,15 +671,21 @@ print_graph_entry_leaf(struct trace_iterator *iter,
        duration = graph_ret->rettime - graph_ret->calltime;
 
        if (data) {
+               struct fgraph_cpu_data *cpu_data;
                int cpu = iter->cpu;
-               int *depth = &(per_cpu_ptr(data->cpu_data, cpu)->depth);
+
+               cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 
                /*
                 * Comments display at + 1 to depth. Since
                 * this is a leaf function, keep the comments
                 * equal to this depth.
                 */
-               *depth = call->depth - 1;
+               cpu_data->depth = call->depth - 1;
+
+               /* No need to keep this function around for this depth */
+               if (call->depth < FTRACE_RETFUNC_DEPTH)
+                       cpu_data->enter_funcs[call->depth] = 0;
        }
 
        /* Overhead */
@@ -721,10 +725,15 @@ print_graph_entry_nested(struct trace_iterator *iter,
        int i;
 
        if (data) {
+               struct fgraph_cpu_data *cpu_data;
                int cpu = iter->cpu;
-               int *depth = &(per_cpu_ptr(data->cpu_data, cpu)->depth);
 
-               *depth = call->depth;
+               cpu_data = per_cpu_ptr(data->cpu_data, cpu);
+               cpu_data->depth = call->depth;
+
+               /* Save this function pointer to see if the exit matches */
+               if (call->depth < FTRACE_RETFUNC_DEPTH)
+                       cpu_data->enter_funcs[call->depth] = call->func;
        }
 
        /* No overhead */
@@ -854,19 +863,28 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
        struct fgraph_data *data = iter->private;
        pid_t pid = ent->pid;
        int cpu = iter->cpu;
+       int func_match = 1;
        int ret;
        int i;
 
        if (data) {
+               struct fgraph_cpu_data *cpu_data;
                int cpu = iter->cpu;
-               int *depth = &(per_cpu_ptr(data->cpu_data, cpu)->depth);
+
+               cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 
                /*
                 * Comments display at + 1 to depth. This is the
                 * return from a function, we now want the comments
                 * to display at the same level of the bracket.
                 */
-               *depth = trace->depth - 1;
+               cpu_data->depth = trace->depth - 1;
+
+               if (trace->depth < FTRACE_RETFUNC_DEPTH) {
+                       if (cpu_data->enter_funcs[trace->depth] != trace->func)
+                               func_match = 0;
+                       cpu_data->enter_funcs[trace->depth] = 0;
+               }
        }
 
        if (print_graph_prologue(iter, s, 0, 0))
@@ -891,9 +909,21 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
                        return TRACE_TYPE_PARTIAL_LINE;
        }
 
-       ret = trace_seq_printf(s, "}\n");
-       if (!ret)
-               return TRACE_TYPE_PARTIAL_LINE;
+       /*
+        * If the return function does not have a matching entry,
+        * then the entry was lost. Instead of just printing
+        * the '}' and letting the user guess what function this
+        * belongs to, write out the function name.
+        */
+       if (func_match) {
+               ret = trace_seq_printf(s, "}\n");
+               if (!ret)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       } else {
+               ret = trace_seq_printf(s, "} (%ps)\n", (void *)trace->func);
+               if (!ret)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       }
 
        /* Overrun */
        if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERRUN) {
index 6ea90c0e2c96a89835216314f3b9f792161c49de..505c92273b1a51b98370221dcd30cd9234d36d06 100644 (file)
@@ -91,11 +91,6 @@ static __kprobes unsigned long fetch_memory(struct pt_regs *regs, void *addr)
        return retval;
 }
 
-static __kprobes unsigned long fetch_argument(struct pt_regs *regs, void *num)
-{
-       return regs_get_argument_nth(regs, (unsigned int)((unsigned long)num));
-}
-
 static __kprobes unsigned long fetch_retvalue(struct pt_regs *regs,
                                              void *dummy)
 {
@@ -231,9 +226,7 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
 {
        int ret = -EINVAL;
 
-       if (ff->func == fetch_argument)
-               ret = snprintf(buf, n, "$arg%lu", (unsigned long)ff->data);
-       else if (ff->func == fetch_register) {
+       if (ff->func == fetch_register) {
                const char *name;
                name = regs_query_register_name((unsigned int)((long)ff->data));
                ret = snprintf(buf, n, "%%%s", name);
@@ -489,14 +482,6 @@ static int parse_probe_vars(char *arg, struct fetch_func *ff, int is_return)
                        }
                } else
                        ret = -EINVAL;
-       } else if (strncmp(arg, "arg", 3) == 0 && isdigit(arg[3])) {
-               ret = strict_strtoul(arg + 3, 10, &param);
-               if (ret || param > PARAM_MAX_ARGS)
-                       ret = -EINVAL;
-               else {
-                       ff->func = fetch_argument;
-                       ff->data = (void *)param;
-               }
        } else
                ret = -EINVAL;
        return ret;
@@ -611,7 +596,6 @@ static int create_trace_probe(int argc, char **argv)
         *  - Add kprobe: p[:[GRP/]EVENT] KSYM[+OFFS]|KADDR [FETCHARGS]
         *  - Add kretprobe: r[:[GRP/]EVENT] KSYM[+0] [FETCHARGS]
         * Fetch args:
-        *  $argN       : fetch Nth of function argument. (N:0-)
         *  $retval     : fetch return value
         *  $stack      : fetch stack address
         *  $stackN     : fetch Nth of stack (N:0-)
@@ -651,12 +635,12 @@ static int create_trace_probe(int argc, char **argv)
                        event = strchr(group, '/') + 1;
                        event[-1] = '\0';
                        if (strlen(group) == 0) {
-                               pr_info("Group name is not specifiled\n");
+                               pr_info("Group name is not specified\n");
                                return -EINVAL;
                        }
                }
                if (strlen(event) == 0) {
-                       pr_info("Event name is not specifiled\n");
+                       pr_info("Event name is not specified\n");
                        return -EINVAL;
                }
        }
@@ -689,7 +673,7 @@ static int create_trace_probe(int argc, char **argv)
                        return -EINVAL;
                }
                /* an address specified */
-               ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr);
+               ret = strict_strtoul(&argv[1][0], 0, (unsigned long *)&addr);
                if (ret) {
                        pr_info("Failed to parse address.\n");
                        return ret;
@@ -958,7 +942,7 @@ static const struct file_operations kprobe_profile_ops = {
 };
 
 /* Kprobe handler */
-static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
+static __kprobes void kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
 {
        struct trace_probe *tp = container_of(kp, struct trace_probe, rp.kp);
        struct kprobe_trace_entry *entry;
@@ -978,7 +962,7 @@ static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
        event = trace_current_buffer_lock_reserve(&buffer, call->id, size,
                                                  irq_flags, pc);
        if (!event)
-               return 0;
+               return;
 
        entry = ring_buffer_event_data(event);
        entry->nargs = tp->nr_args;
@@ -988,11 +972,10 @@ static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
 
        if (!filter_current_check_discard(buffer, call, entry, event))
                trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc);
-       return 0;
 }
 
 /* Kretprobe handler */
-static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
+static __kprobes void kretprobe_trace_func(struct kretprobe_instance *ri,
                                          struct pt_regs *regs)
 {
        struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
@@ -1011,7 +994,7 @@ static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
        event = trace_current_buffer_lock_reserve(&buffer, call->id, size,
                                                  irq_flags, pc);
        if (!event)
-               return 0;
+               return;
 
        entry = ring_buffer_event_data(event);
        entry->nargs = tp->nr_args;
@@ -1022,8 +1005,6 @@ static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
 
        if (!filter_current_check_discard(buffer, call, entry, event))
                trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc);
-
-       return 0;
 }
 
 /* Event entry printers */
@@ -1174,213 +1155,123 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
        return 0;
 }
 
-static int __probe_event_show_format(struct trace_seq *s,
-                                    struct trace_probe *tp, const char *fmt,
-                                    const char *arg)
+static int __set_print_fmt(struct trace_probe *tp, char *buf, int len)
 {
        int i;
+       int pos = 0;
 
-       /* Show format */
-       if (!trace_seq_printf(s, "\nprint fmt: \"%s", fmt))
-               return 0;
+       const char *fmt, *arg;
 
-       for (i = 0; i < tp->nr_args; i++)
-               if (!trace_seq_printf(s, " %s=%%lx", tp->args[i].name))
-                       return 0;
+       if (!probe_is_return(tp)) {
+               fmt = "(%lx)";
+               arg = "REC->" FIELD_STRING_IP;
+       } else {
+               fmt = "(%lx <- %lx)";
+               arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
+       }
 
-       if (!trace_seq_printf(s, "\", %s", arg))
-               return 0;
+       /* When len=0, we just calculate the needed length */
+#define LEN_OR_ZERO (len ? len - pos : 0)
 
-       for (i = 0; i < tp->nr_args; i++)
-               if (!trace_seq_printf(s, ", REC->%s", tp->args[i].name))
-                       return 0;
-
-       return trace_seq_puts(s, "\n");
-}
+       pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
 
-#undef SHOW_FIELD
-#define SHOW_FIELD(type, item, name)                                   \
-       do {                                                            \
-               ret = trace_seq_printf(s, "\tfield:" #type " %s;\t"     \
-                               "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\
-                               (unsigned int)offsetof(typeof(field), item),\
-                               (unsigned int)sizeof(type),             \
-                               is_signed_type(type));                  \
-               if (!ret)                                               \
-                       return 0;                                       \
-       } while (0)
+       for (i = 0; i < tp->nr_args; i++) {
+               pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%%lx",
+                               tp->args[i].name);
+       }
 
-static int kprobe_event_show_format(struct ftrace_event_call *call,
-                                   struct trace_seq *s)
-{
-       struct kprobe_trace_entry field __attribute__((unused));
-       int ret, i;
-       struct trace_probe *tp = (struct trace_probe *)call->data;
+       pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
 
-       SHOW_FIELD(unsigned long, ip, FIELD_STRING_IP);
-       SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
+       for (i = 0; i < tp->nr_args; i++) {
+               pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s",
+                               tp->args[i].name);
+       }
 
-       /* Show fields */
-       for (i = 0; i < tp->nr_args; i++)
-               SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
-       trace_seq_puts(s, "\n");
+#undef LEN_OR_ZERO
 
-       return __probe_event_show_format(s, tp, "(%lx)",
-                                        "REC->" FIELD_STRING_IP);
+       /* return the length of print_fmt */
+       return pos;
 }
 
-static int kretprobe_event_show_format(struct ftrace_event_call *call,
-                                      struct trace_seq *s)
+static int set_print_fmt(struct trace_probe *tp)
 {
-       struct kretprobe_trace_entry field __attribute__((unused));
-       int ret, i;
-       struct trace_probe *tp = (struct trace_probe *)call->data;
+       int len;
+       char *print_fmt;
 
-       SHOW_FIELD(unsigned long, func, FIELD_STRING_FUNC);
-       SHOW_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP);
-       SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
+       /* First: called with 0 length to calculate the needed length */
+       len = __set_print_fmt(tp, NULL, 0);
+       print_fmt = kmalloc(len + 1, GFP_KERNEL);
+       if (!print_fmt)
+               return -ENOMEM;
 
-       /* Show fields */
-       for (i = 0; i < tp->nr_args; i++)
-               SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
-       trace_seq_puts(s, "\n");
+       /* Second: actually write the @print_fmt */
+       __set_print_fmt(tp, print_fmt, len + 1);
+       tp->call.print_fmt = print_fmt;
 
-       return __probe_event_show_format(s, tp, "(%lx <- %lx)",
-                                        "REC->" FIELD_STRING_FUNC
-                                        ", REC->" FIELD_STRING_RETIP);
+       return 0;
 }
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 /* Kprobe profile handler */
-static __kprobes int kprobe_profile_func(struct kprobe *kp,
+static __kprobes void kprobe_profile_func(struct kprobe *kp,
                                         struct pt_regs *regs)
 {
        struct trace_probe *tp = container_of(kp, struct trace_probe, rp.kp);
        struct ftrace_event_call *call = &tp->call;
        struct kprobe_trace_entry *entry;
-       struct trace_entry *ent;
-       int size, __size, i, pc, __cpu;
+       int size, __size, i;
        unsigned long irq_flags;
-       char *trace_buf;
-       char *raw_data;
        int rctx;
 
-       pc = preempt_count();
        __size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args);
        size = ALIGN(__size + sizeof(u32), sizeof(u64));
        size -= sizeof(u32);
        if (WARN_ONCE(size > FTRACE_MAX_PROFILE_SIZE,
                     "profile buffer not large enough"))
-               return 0;
-
-       /*
-        * Protect the non nmi buffer
-        * This also protects the rcu read side
-        */
-       local_irq_save(irq_flags);
-
-       rctx = perf_swevent_get_recursion_context();
-       if (rctx < 0)
-               goto end_recursion;
-
-       __cpu = smp_processor_id();
-
-       if (in_nmi())
-               trace_buf = rcu_dereference(perf_trace_buf_nmi);
-       else
-               trace_buf = rcu_dereference(perf_trace_buf);
+               return;
 
-       if (!trace_buf)
-               goto end;
-
-       raw_data = per_cpu_ptr(trace_buf, __cpu);
-
-       /* Zero dead bytes from alignment to avoid buffer leak to userspace */
-       *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;
-       entry = (struct kprobe_trace_entry *)raw_data;
-       ent = &entry->ent;
+       entry = ftrace_perf_buf_prepare(size, call->id, &rctx, &irq_flags);
+       if (!entry)
+               return;
 
-       tracing_generic_entry_update(ent, irq_flags, pc);
-       ent->type = call->id;
        entry->nargs = tp->nr_args;
        entry->ip = (unsigned long)kp->addr;
        for (i = 0; i < tp->nr_args; i++)
                entry->args[i] = call_fetch(&tp->args[i].fetch, regs);
-       perf_tp_event(call->id, entry->ip, 1, entry, size);
-
-end:
-       perf_swevent_put_recursion_context(rctx);
-end_recursion:
-       local_irq_restore(irq_flags);
 
-       return 0;
+       ftrace_perf_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags);
 }
 
 /* Kretprobe profile handler */
-static __kprobes int kretprobe_profile_func(struct kretprobe_instance *ri,
+static __kprobes void kretprobe_profile_func(struct kretprobe_instance *ri,
                                            struct pt_regs *regs)
 {
        struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
        struct ftrace_event_call *call = &tp->call;
        struct kretprobe_trace_entry *entry;
-       struct trace_entry *ent;
-       int size, __size, i, pc, __cpu;
+       int size, __size, i;
        unsigned long irq_flags;
-       char *trace_buf;
-       char *raw_data;
        int rctx;
 
-       pc = preempt_count();
        __size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args);
        size = ALIGN(__size + sizeof(u32), sizeof(u64));
        size -= sizeof(u32);
        if (WARN_ONCE(size > FTRACE_MAX_PROFILE_SIZE,
                     "profile buffer not large enough"))
-               return 0;
-
-       /*
-        * Protect the non nmi buffer
-        * This also protects the rcu read side
-        */
-       local_irq_save(irq_flags);
-
-       rctx = perf_swevent_get_recursion_context();
-       if (rctx < 0)
-               goto end_recursion;
-
-       __cpu = smp_processor_id();
+               return;
 
-       if (in_nmi())
-               trace_buf = rcu_dereference(perf_trace_buf_nmi);
-       else
-               trace_buf = rcu_dereference(perf_trace_buf);
-
-       if (!trace_buf)
-               goto end;
-
-       raw_data = per_cpu_ptr(trace_buf, __cpu);
-
-       /* Zero dead bytes from alignment to avoid buffer leak to userspace */
-       *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;
-       entry = (struct kretprobe_trace_entry *)raw_data;
-       ent = &entry->ent;
+       entry = ftrace_perf_buf_prepare(size, call->id, &rctx, &irq_flags);
+       if (!entry)
+               return;
 
-       tracing_generic_entry_update(ent, irq_flags, pc);
-       ent->type = call->id;
        entry->nargs = tp->nr_args;
        entry->func = (unsigned long)tp->rp.kp.addr;
        entry->ret_ip = (unsigned long)ri->ret_addr;
        for (i = 0; i < tp->nr_args; i++)
                entry->args[i] = call_fetch(&tp->args[i].fetch, regs);
-       perf_tp_event(call->id, entry->ret_ip, 1, entry, size);
-
-end:
-       perf_swevent_put_recursion_context(rctx);
-end_recursion:
-       local_irq_restore(irq_flags);
 
-       return 0;
+       ftrace_perf_buf_submit(entry, size, rctx, entry->ret_ip, 1, irq_flags);
 }
 
 static int probe_profile_enable(struct ftrace_event_call *call)
@@ -1408,7 +1299,7 @@ static void probe_profile_disable(struct ftrace_event_call *call)
                        disable_kprobe(&tp->rp.kp);
        }
 }
-#endif /* CONFIG_EVENT_PROFILE */
+#endif /* CONFIG_PERF_EVENTS */
 
 
 static __kprobes
@@ -1418,10 +1309,10 @@ int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
 
        if (tp->flags & TP_FLAG_TRACE)
                kprobe_trace_func(kp, regs);
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
        if (tp->flags & TP_FLAG_PROFILE)
                kprobe_profile_func(kp, regs);
-#endif /* CONFIG_EVENT_PROFILE */
+#endif
        return 0;       /* We don't tweek kernel, so just return 0 */
 }
 
@@ -1432,10 +1323,10 @@ int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
 
        if (tp->flags & TP_FLAG_TRACE)
                kretprobe_trace_func(ri, regs);
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
        if (tp->flags & TP_FLAG_PROFILE)
                kretprobe_profile_func(ri, regs);
-#endif /* CONFIG_EVENT_PROFILE */
+#endif
        return 0;       /* We don't tweek kernel, so just return 0 */
 }
 
@@ -1448,23 +1339,25 @@ static int register_probe_event(struct trace_probe *tp)
        if (probe_is_return(tp)) {
                tp->event.trace = print_kretprobe_event;
                call->raw_init = probe_event_raw_init;
-               call->show_format = kretprobe_event_show_format;
                call->define_fields = kretprobe_event_define_fields;
        } else {
                tp->event.trace = print_kprobe_event;
                call->raw_init = probe_event_raw_init;
-               call->show_format = kprobe_event_show_format;
                call->define_fields = kprobe_event_define_fields;
        }
+       if (set_print_fmt(tp) < 0)
+               return -ENOMEM;
        call->event = &tp->event;
        call->id = register_ftrace_event(&tp->event);
-       if (!call->id)
+       if (!call->id) {
+               kfree(call->print_fmt);
                return -ENODEV;
+       }
        call->enabled = 0;
        call->regfunc = probe_event_enable;
        call->unregfunc = probe_event_disable;
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
        call->profile_enable = probe_profile_enable;
        call->profile_disable = probe_profile_disable;
 #endif
@@ -1472,6 +1365,7 @@ static int register_probe_event(struct trace_probe *tp)
        ret = trace_add_event_call(call);
        if (ret) {
                pr_info("Failed to register kprobe event: %s\n", call->name);
+               kfree(call->print_fmt);
                unregister_ftrace_event(&tp->event);
        }
        return ret;
@@ -1481,6 +1375,7 @@ static void unregister_probe_event(struct trace_probe *tp)
 {
        /* tp->event is unregistered in trace_remove_event_call() */
        trace_remove_event_call(&tp->call);
+       kfree(tp->call.print_fmt);
 }
 
 /* Make a debugfs interface for controling probe points */
@@ -1523,28 +1418,67 @@ static int kprobe_trace_selftest_target(int a1, int a2, int a3,
 
 static __init int kprobe_trace_self_tests_init(void)
 {
-       int ret;
+       int ret, warn = 0;
        int (*target)(int, int, int, int, int, int);
+       struct trace_probe *tp;
 
        target = kprobe_trace_selftest_target;
 
        pr_info("Testing kprobe tracing: ");
 
        ret = command_trace_probe("p:testprobe kprobe_trace_selftest_target "
-                                 "$arg1 $arg2 $arg3 $arg4 $stack $stack0");
-       if (WARN_ON_ONCE(ret))
-               pr_warning("error enabling function entry\n");
+                                 "$stack $stack0 +0($stack)");
+       if (WARN_ON_ONCE(ret)) {
+               pr_warning("error on probing function entry.\n");
+               warn++;
+       } else {
+               /* Enable trace point */
+               tp = find_probe_event("testprobe", KPROBE_EVENT_SYSTEM);
+               if (WARN_ON_ONCE(tp == NULL)) {
+                       pr_warning("error on getting new probe.\n");
+                       warn++;
+               } else
+                       probe_event_enable(&tp->call);
+       }
 
        ret = command_trace_probe("r:testprobe2 kprobe_trace_selftest_target "
                                  "$retval");
-       if (WARN_ON_ONCE(ret))
-               pr_warning("error enabling function return\n");
+       if (WARN_ON_ONCE(ret)) {
+               pr_warning("error on probing function return.\n");
+               warn++;
+       } else {
+               /* Enable trace point */
+               tp = find_probe_event("testprobe2", KPROBE_EVENT_SYSTEM);
+               if (WARN_ON_ONCE(tp == NULL)) {
+                       pr_warning("error on getting new probe.\n");
+                       warn++;
+               } else
+                       probe_event_enable(&tp->call);
+       }
+
+       if (warn)
+               goto end;
 
        ret = target(1, 2, 3, 4, 5, 6);
 
-       cleanup_all_probes();
+       ret = command_trace_probe("-:testprobe");
+       if (WARN_ON_ONCE(ret)) {
+               pr_warning("error on deleting a probe.\n");
+               warn++;
+       }
 
-       pr_cont("OK\n");
+       ret = command_trace_probe("-:testprobe2");
+       if (WARN_ON_ONCE(ret)) {
+               pr_warning("error on deleting a probe.\n");
+               warn++;
+       }
+
+end:
+       cleanup_all_probes();
+       if (warn)
+               pr_cont("NG: Some tests are failed. Please check them.\n");
+       else
+               pr_cont("OK\n");
        return 0;
 }
 
index 678a5120ee301bf1d22d051f710c03ccff60f236..f4bc9b27de5fd13d131dd13b204b1e5432a4283a 100644 (file)
@@ -157,6 +157,7 @@ stack_max_size_write(struct file *filp, const char __user *ubuf,
        unsigned long val, flags;
        char buf[64];
        int ret;
+       int cpu;
 
        if (count >= sizeof(buf))
                return -EINVAL;
@@ -171,9 +172,20 @@ stack_max_size_write(struct file *filp, const char __user *ubuf,
                return ret;
 
        local_irq_save(flags);
+
+       /*
+        * In case we trace inside arch_spin_lock() or after (NMI),
+        * we will cause circular lock, so we also need to increase
+        * the percpu trace_active here.
+        */
+       cpu = smp_processor_id();
+       per_cpu(trace_active, cpu)++;
+
        arch_spin_lock(&max_stack_lock);
        *ptr = val;
        arch_spin_unlock(&max_stack_lock);
+
+       per_cpu(trace_active, cpu)--;
        local_irq_restore(flags);
 
        return count;
@@ -206,7 +218,13 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
 
 static void *t_start(struct seq_file *m, loff_t *pos)
 {
+       int cpu;
+
        local_irq_disable();
+
+       cpu = smp_processor_id();
+       per_cpu(trace_active, cpu)++;
+
        arch_spin_lock(&max_stack_lock);
 
        if (*pos == 0)
@@ -217,7 +235,13 @@ static void *t_start(struct seq_file *m, loff_t *pos)
 
 static void t_stop(struct seq_file *m, void *p)
 {
+       int cpu;
+
        arch_spin_unlock(&max_stack_lock);
+
+       cpu = smp_processor_id();
+       per_cpu(trace_active, cpu)--;
+
        local_irq_enable();
 }
 
index 75289f372dd270816742e7dd94c1d5c2474442d8..cba47d7935cc96fb8d27ea7015afdbcf7eded882 100644 (file)
@@ -143,70 +143,65 @@ extern char *__bad_type_size(void);
                #type, #name, offsetof(typeof(trace), name),            \
                sizeof(trace.name), is_signed_type(type)
 
-int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s)
+static
+int  __set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
 {
        int i;
-       int ret;
-       struct syscall_metadata *entry = call->data;
-       struct syscall_trace_enter trace;
-       int offset = offsetof(struct syscall_trace_enter, args);
+       int pos = 0;
 
-       ret = trace_seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
-                              "\tsigned:%u;\n",
-                              SYSCALL_FIELD(int, nr));
-       if (!ret)
-               return 0;
+       /* When len=0, we just calculate the needed length */
+#define LEN_OR_ZERO (len ? len - pos : 0)
 
+       pos += snprintf(buf + pos, LEN_OR_ZERO, "\"");
        for (i = 0; i < entry->nb_args; i++) {
-               ret = trace_seq_printf(s, "\tfield:%s %s;", entry->types[i],
-                                       entry->args[i]);
-               if (!ret)
-                       return 0;
-               ret = trace_seq_printf(s, "\toffset:%d;\tsize:%zu;"
-                                      "\tsigned:%u;\n", offset,
-                                      sizeof(unsigned long),
-                                      is_signed_type(unsigned long));
-               if (!ret)
-                       return 0;
-               offset += sizeof(unsigned long);
+               pos += snprintf(buf + pos, LEN_OR_ZERO, "%s: 0x%%0%zulx%s",
+                               entry->args[i], sizeof(unsigned long),
+                               i == entry->nb_args - 1 ? "" : ", ");
        }
+       pos += snprintf(buf + pos, LEN_OR_ZERO, "\"");
 
-       trace_seq_puts(s, "\nprint fmt: \"");
        for (i = 0; i < entry->nb_args; i++) {
-               ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i],
-                                       sizeof(unsigned long),
-                                       i == entry->nb_args - 1 ? "" : ", ");
-               if (!ret)
-                       return 0;
+               pos += snprintf(buf + pos, LEN_OR_ZERO,
+                               ", ((unsigned long)(REC->%s))", entry->args[i]);
        }
-       trace_seq_putc(s, '"');
 
-       for (i = 0; i < entry->nb_args; i++) {
-               ret = trace_seq_printf(s, ", ((unsigned long)(REC->%s))",
-                                      entry->args[i]);
-               if (!ret)
-                       return 0;
-       }
+#undef LEN_OR_ZERO
 
-       return trace_seq_putc(s, '\n');
+       /* return the length of print_fmt */
+       return pos;
 }
 
-int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
+static int set_syscall_print_fmt(struct ftrace_event_call *call)
 {
-       int ret;
-       struct syscall_trace_exit trace;
+       char *print_fmt;
+       int len;
+       struct syscall_metadata *entry = call->data;
 
-       ret = trace_seq_printf(s,
-                              "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
-                              "\tsigned:%u;\n"
-                              "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
-                              "\tsigned:%u;\n",
-                              SYSCALL_FIELD(int, nr),
-                              SYSCALL_FIELD(long, ret));
-       if (!ret)
+       if (entry->enter_event != call) {
+               call->print_fmt = "\"0x%lx\", REC->ret";
                return 0;
+       }
+
+       /* First: called with 0 length to calculate the needed length */
+       len = __set_enter_print_fmt(entry, NULL, 0);
+
+       print_fmt = kmalloc(len + 1, GFP_KERNEL);
+       if (!print_fmt)
+               return -ENOMEM;
+
+       /* Second: actually write the @print_fmt */
+       __set_enter_print_fmt(entry, print_fmt, len + 1);
+       call->print_fmt = print_fmt;
 
-       return trace_seq_printf(s, "\nprint fmt: \"0x%%lx\", REC->ret\n");
+       return 0;
+}
+
+static void free_syscall_print_fmt(struct ftrace_event_call *call)
+{
+       struct syscall_metadata *entry = call->data;
+
+       if (entry->enter_event == call)
+               kfree(call->print_fmt);
 }
 
 int syscall_enter_define_fields(struct ftrace_event_call *call)
@@ -386,12 +381,22 @@ int init_syscall_trace(struct ftrace_event_call *call)
 {
        int id;
 
-       id = register_ftrace_event(call->event);
-       if (!id)
-               return -ENODEV;
-       call->id = id;
-       INIT_LIST_HEAD(&call->fields);
-       return 0;
+       if (set_syscall_print_fmt(call) < 0)
+               return -ENOMEM;
+
+       id = trace_event_raw_init(call);
+
+       if (id < 0) {
+               free_syscall_print_fmt(call);
+               return id;
+       }
+
+       return id;
+}
+
+unsigned long __init arch_syscall_addr(int nr)
+{
+       return (unsigned long)sys_call_table[nr];
 }
 
 int __init init_ftrace_syscalls(void)
@@ -421,7 +426,7 @@ int __init init_ftrace_syscalls(void)
 }
 core_initcall(init_ftrace_syscalls);
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 
 static DECLARE_BITMAP(enabled_prof_enter_syscalls, NR_syscalls);
 static DECLARE_BITMAP(enabled_prof_exit_syscalls, NR_syscalls);
@@ -433,12 +438,9 @@ static void prof_syscall_enter(struct pt_regs *regs, long id)
        struct syscall_metadata *sys_data;
        struct syscall_trace_enter *rec;
        unsigned long flags;
-       char *trace_buf;
-       char *raw_data;
        int syscall_nr;
        int rctx;
        int size;
-       int cpu;
 
        syscall_nr = syscall_get_nr(current, regs);
        if (!test_bit(syscall_nr, enabled_prof_enter_syscalls))
@@ -457,37 +459,15 @@ static void prof_syscall_enter(struct pt_regs *regs, long id)
                      "profile buffer not large enough"))
                return;
 
-       /* Protect the per cpu buffer, begin the rcu read side */
-       local_irq_save(flags);
-
-       rctx = perf_swevent_get_recursion_context();
-       if (rctx < 0)
-               goto end_recursion;
-
-       cpu = smp_processor_id();
-
-       trace_buf = rcu_dereference(perf_trace_buf);
-
-       if (!trace_buf)
-               goto end;
-
-       raw_data = per_cpu_ptr(trace_buf, cpu);
-
-       /* zero the dead bytes from align to not leak stack to user */
-       *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;
+       rec = (struct syscall_trace_enter *)ftrace_perf_buf_prepare(size,
+                               sys_data->enter_event->id, &rctx, &flags);
+       if (!rec)
+               return;
 
-       rec = (struct syscall_trace_enter *) raw_data;
-       tracing_generic_entry_update(&rec->ent, 0, 0);
-       rec->ent.type = sys_data->enter_event->id;
        rec->nr = syscall_nr;
        syscall_get_arguments(current, regs, 0, sys_data->nb_args,
                               (unsigned long *)&rec->args);
-       perf_tp_event(sys_data->enter_event->id, 0, 1, rec, size);
-
-end:
-       perf_swevent_put_recursion_context(rctx);
-end_recursion:
-       local_irq_restore(flags);
+       ftrace_perf_buf_submit(rec, size, rctx, 0, 1, flags);
 }
 
 int prof_sysenter_enable(struct ftrace_event_call *call)
@@ -531,11 +511,8 @@ static void prof_syscall_exit(struct pt_regs *regs, long ret)
        struct syscall_trace_exit *rec;
        unsigned long flags;
        int syscall_nr;
-       char *trace_buf;
-       char *raw_data;
        int rctx;
        int size;
-       int cpu;
 
        syscall_nr = syscall_get_nr(current, regs);
        if (!test_bit(syscall_nr, enabled_prof_exit_syscalls))
@@ -557,38 +534,15 @@ static void prof_syscall_exit(struct pt_regs *regs, long ret)
                "exit event has grown above profile buffer size"))
                return;
 
-       /* Protect the per cpu buffer, begin the rcu read side */
-       local_irq_save(flags);
-
-       rctx = perf_swevent_get_recursion_context();
-       if (rctx < 0)
-               goto end_recursion;
-
-       cpu = smp_processor_id();
-
-       trace_buf = rcu_dereference(perf_trace_buf);
-
-       if (!trace_buf)
-               goto end;
-
-       raw_data = per_cpu_ptr(trace_buf, cpu);
-
-       /* zero the dead bytes from align to not leak stack to user */
-       *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;
-
-       rec = (struct syscall_trace_exit *)raw_data;
+       rec = (struct syscall_trace_exit *)ftrace_perf_buf_prepare(size,
+                               sys_data->exit_event->id, &rctx, &flags);
+       if (!rec)
+               return;
 
-       tracing_generic_entry_update(&rec->ent, 0, 0);
-       rec->ent.type = sys_data->exit_event->id;
        rec->nr = syscall_nr;
        rec->ret = syscall_get_return_value(current, regs);
 
-       perf_tp_event(sys_data->exit_event->id, 0, 1, rec, size);
-
-end:
-       perf_swevent_put_recursion_context(rctx);
-end_recursion:
-       local_irq_restore(flags);
+       ftrace_perf_buf_submit(rec, size, rctx, 0, 1, flags);
 }
 
 int prof_sysexit_enable(struct ftrace_event_call *call)
@@ -603,7 +557,7 @@ int prof_sysexit_enable(struct ftrace_event_call *call)
                ret = register_trace_sys_exit(prof_syscall_exit);
        if (ret) {
                pr_info("event trace: Could not activate"
-                               "syscall entry trace point");
+                               "syscall exit trace point");
        } else {
                set_bit(num, enabled_prof_exit_syscalls);
                sys_prof_refcount_exit++;
@@ -626,6 +580,5 @@ void prof_sysexit_disable(struct ftrace_event_call *call)
        mutex_unlock(&syscall_trace_lock);
 }
 
-#endif
-
+#endif /* CONFIG_PERF_EVENTS */
 
index 46d0165ca70c6b10240256fb1ccc2b3420c6c91e..766467b3bcb7f1e42da792bece602ec8404135a2 100644 (file)
@@ -56,9 +56,6 @@ struct user_struct root_user = {
        .sigpending     = ATOMIC_INIT(0),
        .locked_shm     = 0,
        .user_ns        = &init_user_ns,
-#ifdef CONFIG_USER_SCHED
-       .tg             = &init_task_group,
-#endif
 };
 
 /*
@@ -75,268 +72,6 @@ static void uid_hash_remove(struct user_struct *up)
        put_user_ns(up->user_ns);
 }
 
-#ifdef CONFIG_USER_SCHED
-
-static void sched_destroy_user(struct user_struct *up)
-{
-       sched_destroy_group(up->tg);
-}
-
-static int sched_create_user(struct user_struct *up)
-{
-       int rc = 0;
-
-       up->tg = sched_create_group(&root_task_group);
-       if (IS_ERR(up->tg))
-               rc = -ENOMEM;
-
-       set_tg_uid(up);
-
-       return rc;
-}
-
-#else  /* CONFIG_USER_SCHED */
-
-static void sched_destroy_user(struct user_struct *up) { }
-static int sched_create_user(struct user_struct *up) { return 0; }
-
-#endif /* CONFIG_USER_SCHED */
-
-#if defined(CONFIG_USER_SCHED) && defined(CONFIG_SYSFS)
-
-static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
-{
-       struct user_struct *user;
-       struct hlist_node *h;
-
-       hlist_for_each_entry(user, h, hashent, uidhash_node) {
-               if (user->uid == uid) {
-                       /* possibly resurrect an "almost deleted" object */
-                       if (atomic_inc_return(&user->__count) == 1)
-                               cancel_delayed_work(&user->work);
-                       return user;
-               }
-       }
-
-       return NULL;
-}
-
-static struct kset *uids_kset; /* represents the /sys/kernel/uids/ directory */
-static DEFINE_MUTEX(uids_mutex);
-
-static inline void uids_mutex_lock(void)
-{
-       mutex_lock(&uids_mutex);
-}
-
-static inline void uids_mutex_unlock(void)
-{
-       mutex_unlock(&uids_mutex);
-}
-
-/* uid directory attributes */
-#ifdef CONFIG_FAIR_GROUP_SCHED
-static ssize_t cpu_shares_show(struct kobject *kobj,
-                              struct kobj_attribute *attr,
-                              char *buf)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-
-       return sprintf(buf, "%lu\n", sched_group_shares(up->tg));
-}
-
-static ssize_t cpu_shares_store(struct kobject *kobj,
-                               struct kobj_attribute *attr,
-                               const char *buf, size_t size)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-       unsigned long shares;
-       int rc;
-
-       sscanf(buf, "%lu", &shares);
-
-       rc = sched_group_set_shares(up->tg, shares);
-
-       return (rc ? rc : size);
-}
-
-static struct kobj_attribute cpu_share_attr =
-       __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store);
-#endif
-
-#ifdef CONFIG_RT_GROUP_SCHED
-static ssize_t cpu_rt_runtime_show(struct kobject *kobj,
-                                  struct kobj_attribute *attr,
-                                  char *buf)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-
-       return sprintf(buf, "%ld\n", sched_group_rt_runtime(up->tg));
-}
-
-static ssize_t cpu_rt_runtime_store(struct kobject *kobj,
-                                   struct kobj_attribute *attr,
-                                   const char *buf, size_t size)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-       unsigned long rt_runtime;
-       int rc;
-
-       sscanf(buf, "%ld", &rt_runtime);
-
-       rc = sched_group_set_rt_runtime(up->tg, rt_runtime);
-
-       return (rc ? rc : size);
-}
-
-static struct kobj_attribute cpu_rt_runtime_attr =
-       __ATTR(cpu_rt_runtime, 0644, cpu_rt_runtime_show, cpu_rt_runtime_store);
-
-static ssize_t cpu_rt_period_show(struct kobject *kobj,
-                                  struct kobj_attribute *attr,
-                                  char *buf)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-
-       return sprintf(buf, "%lu\n", sched_group_rt_period(up->tg));
-}
-
-static ssize_t cpu_rt_period_store(struct kobject *kobj,
-                                   struct kobj_attribute *attr,
-                                   const char *buf, size_t size)
-{
-       struct user_struct *up = container_of(kobj, struct user_struct, kobj);
-       unsigned long rt_period;
-       int rc;
-
-       sscanf(buf, "%lu", &rt_period);
-
-       rc = sched_group_set_rt_period(up->tg, rt_period);
-
-       return (rc ? rc : size);
-}
-
-static struct kobj_attribute cpu_rt_period_attr =
-       __ATTR(cpu_rt_period, 0644, cpu_rt_period_show, cpu_rt_period_store);
-#endif
-
-/* default attributes per uid directory */
-static struct attribute *uids_attributes[] = {
-#ifdef CONFIG_FAIR_GROUP_SCHED
-       &cpu_share_attr.attr,
-#endif
-#ifdef CONFIG_RT_GROUP_SCHED
-       &cpu_rt_runtime_attr.attr,
-       &cpu_rt_period_attr.attr,
-#endif
-       NULL
-};
-
-/* the lifetime of user_struct is not managed by the core (now) */
-static void uids_release(struct kobject *kobj)
-{
-       return;
-}
-
-static struct kobj_type uids_ktype = {
-       .sysfs_ops = &kobj_sysfs_ops,
-       .default_attrs = uids_attributes,
-       .release = uids_release,
-};
-
-/*
- * Create /sys/kernel/uids/<uid>/cpu_share file for this user
- * We do not create this file for users in a user namespace (until
- * sysfs tagging is implemented).
- *
- * See Documentation/scheduler/sched-design-CFS.txt for ramifications.
- */
-static int uids_user_create(struct user_struct *up)
-{
-       struct kobject *kobj = &up->kobj;
-       int error;
-
-       memset(kobj, 0, sizeof(struct kobject));
-       if (up->user_ns != &init_user_ns)
-               return 0;
-       kobj->kset = uids_kset;
-       error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid);
-       if (error) {
-               kobject_put(kobj);
-               goto done;
-       }
-
-       kobject_uevent(kobj, KOBJ_ADD);
-done:
-       return error;
-}
-
-/* create these entries in sysfs:
- *     "/sys/kernel/uids" directory
- *     "/sys/kernel/uids/0" directory (for root user)
- *     "/sys/kernel/uids/0/cpu_share" file (for root user)
- */
-int __init uids_sysfs_init(void)
-{
-       uids_kset = kset_create_and_add("uids", NULL, kernel_kobj);
-       if (!uids_kset)
-               return -ENOMEM;
-
-       return uids_user_create(&root_user);
-}
-
-/* delayed work function to remove sysfs directory for a user and free up
- * corresponding structures.
- */
-static void cleanup_user_struct(struct work_struct *w)
-{
-       struct user_struct *up = container_of(w, struct user_struct, work.work);
-       unsigned long flags;
-       int remove_user = 0;
-
-       /* Make uid_hash_remove() + sysfs_remove_file() + kobject_del()
-        * atomic.
-        */
-       uids_mutex_lock();
-
-       spin_lock_irqsave(&uidhash_lock, flags);
-       if (atomic_read(&up->__count) == 0) {
-               uid_hash_remove(up);
-               remove_user = 1;
-       }
-       spin_unlock_irqrestore(&uidhash_lock, flags);
-
-       if (!remove_user)
-               goto done;
-
-       if (up->user_ns == &init_user_ns) {
-               kobject_uevent(&up->kobj, KOBJ_REMOVE);
-               kobject_del(&up->kobj);
-               kobject_put(&up->kobj);
-       }
-
-       sched_destroy_user(up);
-       key_put(up->uid_keyring);
-       key_put(up->session_keyring);
-       kmem_cache_free(uid_cachep, up);
-
-done:
-       uids_mutex_unlock();
-}
-
-/* IRQs are disabled and uidhash_lock is held upon function entry.
- * IRQ state (as stored in flags) is restored and uidhash_lock released
- * upon function exit.
- */
-static void free_user(struct user_struct *up, unsigned long flags)
-{
-       INIT_DELAYED_WORK(&up->work, cleanup_user_struct);
-       schedule_delayed_work(&up->work, msecs_to_jiffies(1000));
-       spin_unlock_irqrestore(&uidhash_lock, flags);
-}
-
-#else  /* CONFIG_USER_SCHED && CONFIG_SYSFS */
-
 static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
 {
        struct user_struct *user;
@@ -352,11 +87,6 @@ static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
        return NULL;
 }
 
-int uids_sysfs_init(void) { return 0; }
-static inline int uids_user_create(struct user_struct *up) { return 0; }
-static inline void uids_mutex_lock(void) { }
-static inline void uids_mutex_unlock(void) { }
-
 /* IRQs are disabled and uidhash_lock is held upon function entry.
  * IRQ state (as stored in flags) is restored and uidhash_lock released
  * upon function exit.
@@ -365,32 +95,11 @@ static void free_user(struct user_struct *up, unsigned long flags)
 {
        uid_hash_remove(up);
        spin_unlock_irqrestore(&uidhash_lock, flags);
-       sched_destroy_user(up);
        key_put(up->uid_keyring);
        key_put(up->session_keyring);
        kmem_cache_free(uid_cachep, up);
 }
 
-#endif
-
-#if defined(CONFIG_RT_GROUP_SCHED) && defined(CONFIG_USER_SCHED)
-/*
- * We need to check if a setuid can take place. This function should be called
- * before successfully completing the setuid.
- */
-int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
-{
-
-       return sched_rt_can_attach(up->tg, tsk);
-
-}
-#else
-int task_can_switch_user(struct user_struct *up, struct task_struct *tsk)
-{
-       return 1;
-}
-#endif
-
 /*
  * Locate the user_struct for the passed UID.  If found, take a ref on it.  The
  * caller must undo that ref with free_uid().
@@ -431,8 +140,6 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
        /* Make uid_hash_find() + uids_user_create() + uid_hash_insert()
         * atomic.
         */
-       uids_mutex_lock();
-
        spin_lock_irq(&uidhash_lock);
        up = uid_hash_find(uid, hashent);
        spin_unlock_irq(&uidhash_lock);
@@ -445,14 +152,8 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
                new->uid = uid;
                atomic_set(&new->__count, 1);
 
-               if (sched_create_user(new) < 0)
-                       goto out_free_user;
-
                new->user_ns = get_user_ns(ns);
 
-               if (uids_user_create(new))
-                       goto out_destoy_sched;
-
                /*
                 * Before adding this, check whether we raced
                 * on adding the same user already..
@@ -475,17 +176,11 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
                spin_unlock_irq(&uidhash_lock);
        }
 
-       uids_mutex_unlock();
-
        return up;
 
-out_destoy_sched:
-       sched_destroy_user(new);
        put_user_ns(new->user_ns);
-out_free_user:
        kmem_cache_free(uid_cachep, new);
 out_unlock:
-       uids_mutex_unlock();
        return NULL;
 }
 
index 25c3ed594c547966c1c291750d8adeb3b9e5674b..5e3407d997b2717dee3ef7dee03a503dba980513 100644 (file)
@@ -355,7 +355,7 @@ config SLUB_STATS
 config DEBUG_KMEMLEAK
        bool "Kernel memory leak detector"
        depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \
-               (X86 || ARM || PPC || S390)
+               (X86 || ARM || PPC || S390 || SUPERH)
 
        select DEBUG_FS if SYSFS
        select STACKTRACE if STACKTRACE_SUPPORT
@@ -499,6 +499,18 @@ config PROVE_LOCKING
 
         For more details, see Documentation/lockdep-design.txt.
 
+config PROVE_RCU
+       bool "RCU debugging: prove RCU correctness"
+       depends on PROVE_LOCKING
+       default n
+       help
+        This feature enables lockdep extensions that check for correct
+        use of RCU APIs.  This is currently under development.  Say Y
+        if you want to debug RCU usage or help work on the PROVE_RCU
+        feature.
+
+        Say N if you are unsure.
+
 config LOCKDEP
        bool
        depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
@@ -765,10 +777,22 @@ config RCU_CPU_STALL_DETECTOR
          CPUs are delaying the current grace period, but only when
          the grace period extends for excessive time periods.
 
-         Say Y if you want RCU to perform such checks.
+         Say N if you want to disable such checks.
+
+         Say Y if you are unsure.
+
+config RCU_CPU_STALL_VERBOSE
+       bool "Print additional per-task information for RCU_CPU_STALL_DETECTOR"
+       depends on RCU_CPU_STALL_DETECTOR && TREE_PREEMPT_RCU
+       default n
+       help
+         This option causes RCU to printk detailed per-task information
+         for any tasks that are stalling the current RCU grace period.
 
          Say N if you are unsure.
 
+         Say Y if you want to enable such checks.
+
 config KPROBES_SANITY_TEST
        bool "Kprobes sanity tests"
        depends on DEBUG_KERNEL
index bc3b11731b9ce4160ff770058f9ebc440c441351..5bf0020b9248801236d1a1ca7a3233e1bf2b2bb7 100644 (file)
@@ -23,6 +23,7 @@
  * shut up after that.
  */
 int debug_locks = 1;
+EXPORT_SYMBOL_GPL(debug_locks);
 
 /*
  * The locking-testsuite uses <debug_locks_silent> to get a
index 7d2f0b33e5a82937d2fb615fe5bbbb0de3884777..ba8b67039d13eac2a81835a92d3241375fb43d3d 100644 (file)
@@ -587,7 +587,7 @@ out_unlock:
        return count;
 }
 
-const struct file_operations filter_fops = {
+static const struct file_operations filter_fops = {
        .read  = filter_read,
        .write = filter_write,
 };
index 389424ecb129f13760de1677bd297b392264c953..63ee4eb1228d13ff4b712cb8f1dd8385bf9c1bcb 100644 (file)
 
 unsigned int hweight32(unsigned int w)
 {
+#ifdef ARCH_HAS_FAST_MULTIPLIER
+       w -= (w >> 1) & 0x55555555;
+       w =  (w & 0x33333333) + ((w >> 2) & 0x33333333);
+       w =  (w + (w >> 4)) & 0x0f0f0f0f;
+       return (w * 0x01010101) >> 24;
+#else
        unsigned int res = w - ((w >> 1) & 0x55555555);
        res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
        res = (res + (res >> 4)) & 0x0F0F0F0F;
        res = res + (res >> 8);
        return (res + (res >> 16)) & 0x000000FF;
+#endif
 }
 EXPORT_SYMBOL(hweight32);
 
index 1cac726c44bc17cc6fa1a7b5ab6358279a0c9a5d..2eb1dca03681b00eaa0e94cadc2ca18df0678f7b 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -156,10 +156,12 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
                        id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
 
                        /* if already at the top layer, we need to grow */
-                       if (!(p = pa[l])) {
+                       if (id >= 1 << (idp->layers * IDR_BITS)) {
                                *starting_id = id;
                                return IDR_NEED_TO_GROW;
                        }
+                       p = pa[l];
+                       BUG_ON(!p);
 
                        /* If we need to go up one layer, continue the
                         * loop; otherwise, restart from the top.
@@ -502,7 +504,7 @@ void *idr_find(struct idr *idp, int id)
        int n;
        struct idr_layer *p;
 
-       p = rcu_dereference(idp->top);
+       p = rcu_dereference_raw(idp->top);
        if (!p)
                return NULL;
        n = (p->layer+1) * IDR_BITS;
@@ -517,7 +519,7 @@ void *idr_find(struct idr *idp, int id)
        while (n > 0 && p) {
                n -= IDR_BITS;
                BUG_ON(n != p->layer*IDR_BITS);
-               p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+               p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
        }
        return((void *)p);
 }
@@ -550,7 +552,7 @@ int idr_for_each(struct idr *idp,
        struct idr_layer **paa = &pa[0];
 
        n = idp->layers * IDR_BITS;
-       p = rcu_dereference(idp->top);
+       p = rcu_dereference_raw(idp->top);
        max = 1 << n;
 
        id = 0;
@@ -558,7 +560,7 @@ int idr_for_each(struct idr *idp,
                while (n > 0 && p) {
                        n -= IDR_BITS;
                        *paa++ = p;
-                       p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+                       p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
                }
 
                if (p) {
index 9cee17142b2cdc6d2d7a78c8b6ca5fd6573eb4b8..b1fc526065245fc5cf34cf7af25d1d6e061014c7 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -205,9 +205,8 @@ long lmb_add(u64 base, u64 size)
 
 }
 
-long lmb_remove(u64 base, u64 size)
+static long __lmb_remove(struct lmb_region *rgn, u64 base, u64 size)
 {
-       struct lmb_region *rgn = &(lmb.memory);
        u64 rgnbegin, rgnend;
        u64 end = base + size;
        int i;
@@ -254,6 +253,16 @@ long lmb_remove(u64 base, u64 size)
        return lmb_add_region(rgn, end, rgnend - end);
 }
 
+long lmb_remove(u64 base, u64 size)
+{
+       return __lmb_remove(&lmb.memory, base, size);
+}
+
+long __init lmb_free(u64 base, u64 size)
+{
+       return __lmb_remove(&lmb.reserved, base, size);
+}
+
 long __init lmb_reserve(u64 base, u64 size)
 {
        struct lmb_region *_rgn = &lmb.reserved;
index 92cdd9936e3d2797f4d9b3804ad648b6bbec3c1b..6b9670d6bbf9e669c5e833514ccb41cb83f014da 100644 (file)
@@ -364,7 +364,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root,
        unsigned int height, shift;
        struct radix_tree_node *node, **slot;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (node == NULL)
                return NULL;
 
@@ -384,7 +384,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root,
        do {
                slot = (struct radix_tree_node **)
                        (node->slots + ((index>>shift) & RADIX_TREE_MAP_MASK));
-               node = rcu_dereference(*slot);
+               node = rcu_dereference_raw(*slot);
                if (node == NULL)
                        return NULL;
 
@@ -568,7 +568,7 @@ int radix_tree_tag_get(struct radix_tree_root *root,
        if (!root_tag_get(root, tag))
                return 0;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (node == NULL)
                return 0;
 
@@ -602,7 +602,7 @@ int radix_tree_tag_get(struct radix_tree_root *root,
                        BUG_ON(ret && saw_unset_tag);
                        return !!ret;
                }
-               node = rcu_dereference(node->slots[offset]);
+               node = rcu_dereference_raw(node->slots[offset]);
                shift -= RADIX_TREE_MAP_SHIFT;
                height--;
        }
@@ -711,7 +711,7 @@ __lookup(struct radix_tree_node *slot, void ***results, unsigned long index,
                }
 
                shift -= RADIX_TREE_MAP_SHIFT;
-               slot = rcu_dereference(slot->slots[i]);
+               slot = rcu_dereference_raw(slot->slots[i]);
                if (slot == NULL)
                        goto out;
        }
@@ -758,7 +758,7 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
        unsigned long cur_index = first_index;
        unsigned int ret;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (!node)
                return 0;
 
@@ -787,7 +787,7 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
                        slot = *(((void ***)results)[ret + i]);
                        if (!slot)
                                continue;
-                       results[ret + nr_found] = rcu_dereference(slot);
+                       results[ret + nr_found] = rcu_dereference_raw(slot);
                        nr_found++;
                }
                ret += nr_found;
@@ -826,7 +826,7 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
        unsigned long cur_index = first_index;
        unsigned int ret;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (!node)
                return 0;
 
@@ -915,7 +915,7 @@ __lookup_tag(struct radix_tree_node *slot, void ***results, unsigned long index,
                        }
                }
                shift -= RADIX_TREE_MAP_SHIFT;
-               slot = rcu_dereference(slot->slots[i]);
+               slot = rcu_dereference_raw(slot->slots[i]);
                if (slot == NULL)
                        break;
        }
@@ -951,7 +951,7 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
        if (!root_tag_get(root, tag))
                return 0;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (!node)
                return 0;
 
@@ -980,7 +980,7 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
                        slot = *(((void ***)results)[ret + i]);
                        if (!slot)
                                continue;
-                       results[ret + nr_found] = rcu_dereference(slot);
+                       results[ret + nr_found] = rcu_dereference_raw(slot);
                        nr_found++;
                }
                ret += nr_found;
@@ -1020,7 +1020,7 @@ radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
        if (!root_tag_get(root, tag))
                return 0;
 
-       node = rcu_dereference(root->rnode);
+       node = rcu_dereference_raw(root->rnode);
        if (!node)
                return 0;
 
index 9f75b4ec50b87a7f337ccd200098816bdee2cce6..a1cdcfcc42d06db93e81928f022d4c70b82959be 100644 (file)
@@ -667,7 +667,7 @@ EXPORT_SYMBOL(memscan);
  */
 char *strstr(const char *s1, const char *s2)
 {
-       int l1, l2;
+       size_t l1, l2;
 
        l2 = strlen(s2);
        if (!l2)
@@ -684,6 +684,31 @@ char *strstr(const char *s1, const char *s2)
 EXPORT_SYMBOL(strstr);
 #endif
 
+#ifndef __HAVE_ARCH_STRNSTR
+/**
+ * strnstr - Find the first substring in a length-limited string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ * @len: the maximum number of characters to search
+ */
+char *strnstr(const char *s1, const char *s2, size_t len)
+{
+       size_t l1 = len, l2;
+
+       l2 = strlen(s2);
+       if (!l2)
+               return (char *)s1;
+       while (l1 >= l2) {
+               l1--;
+               if (!memcmp(s1, s2, l2))
+                       return (char *)s1;
+               s1++;
+       }
+       return NULL;
+}
+EXPORT_SYMBOL(strnstr);
+#endif
+
 #ifndef __HAVE_ARCH_MEMCHR
 /**
  * memchr - Find a character in an area of memory.
index 05e1559fa156f3b2cc81e2f6af32b11b0ee061f3..215447c552619168fe22055f9531569c6fca7e75 100644 (file)
@@ -4,12 +4,25 @@
  */
 
 #include <linux/zutil.h>
-#include <asm/unaligned.h>
-#include <asm/byteorder.h>
 #include "inftrees.h"
 #include "inflate.h"
 #include "inffast.h"
 
+/* Only do the unaligned "Faster" variant when
+ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set
+ *
+ * On powerpc, it won't be as we don't include autoconf.h
+ * automatically for the boot wrapper, which is intended as
+ * we run in an environment where we may not be able to deal
+ * with (even rare) alignment faults. In addition, we do not
+ * define __KERNEL__ for arch/powerpc/boot unlike x86
+ */
+
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+#include <asm/unaligned.h>
+#include <asm/byteorder.h>
+#endif
+
 #ifndef ASMINF
 
 /* Allow machine dependent optimization for post-increment or pre-increment.
@@ -243,6 +256,7 @@ void inflate_fast(z_streamp strm, unsigned start)
                     }
                 }
                 else {
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
                    unsigned short *sout;
                    unsigned long loops;
 
@@ -284,6 +298,20 @@ void inflate_fast(z_streamp strm, unsigned start)
                    }
                    if (len & 1)
                        PUP(out) = PUP(from);
+#else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
+                    from = out - dist;          /* copy direct from output */
+                    do {                        /* minimum length is three */
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        PUP(out) = PUP(from);
+                        len -= 3;
+                    } while (len > 2);
+                    if (len) {
+                        PUP(out) = PUP(from);
+                        if (len > 1)
+                            PUP(out) = PUP(from);
+                    }
+#endif /* !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
                 }
             }
             else if ((op & 64) == 0) {          /* 2nd level distance code */
index 17b8947aa7daff59f0a92713f1fe97c8cf9fa721..d34c2b971032af55b99c18ef547735275e8de1d4 100644 (file)
@@ -195,7 +195,7 @@ config BOUNCE
 config NR_QUICK
        int
        depends on QUICKLIST
-       default "2" if SUPERH || AVR32
+       default "2" if AVR32
        default "1"
 
 config VIRT_TO_BUS
index 96ac6b0eb6cb2e542f52d13d99d544a986dfde28..698ea80f21022bf709dacc1101c614327109d828 100644 (file)
@@ -1634,14 +1634,15 @@ EXPORT_SYMBOL(generic_file_readonly_mmap);
 static struct page *__read_cache_page(struct address_space *mapping,
                                pgoff_t index,
                                int (*filler)(void *,struct page*),
-                               void *data)
+                               void *data,
+                               gfp_t gfp)
 {
        struct page *page;
        int err;
 repeat:
        page = find_get_page(mapping, index);
        if (!page) {
-               page = page_cache_alloc_cold(mapping);
+               page = __page_cache_alloc(gfp | __GFP_COLD);
                if (!page)
                        return ERR_PTR(-ENOMEM);
                err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
@@ -1661,31 +1662,18 @@ repeat:
        return page;
 }
 
-/**
- * read_cache_page_async - read into page cache, fill it if needed
- * @mapping:   the page's address_space
- * @index:     the page index
- * @filler:    function to perform the read
- * @data:      destination for read data
- *
- * Same as read_cache_page, but don't wait for page to become unlocked
- * after submitting it to the filler.
- *
- * Read into the page cache. If a page already exists, and PageUptodate() is
- * not set, try to fill the page but don't wait for it to become unlocked.
- *
- * If the page does not get brought uptodate, return -EIO.
- */
-struct page *read_cache_page_async(struct address_space *mapping,
+static struct page *do_read_cache_page(struct address_space *mapping,
                                pgoff_t index,
                                int (*filler)(void *,struct page*),
-                               void *data)
+                               void *data,
+                               gfp_t gfp)
+
 {
        struct page *page;
        int err;
 
 retry:
-       page = __read_cache_page(mapping, index, filler, data);
+       page = __read_cache_page(mapping, index, filler, data, gfp);
        if (IS_ERR(page))
                return page;
        if (PageUptodate(page))
@@ -1710,8 +1698,67 @@ out:
        mark_page_accessed(page);
        return page;
 }
+
+/**
+ * read_cache_page_async - read into page cache, fill it if needed
+ * @mapping:   the page's address_space
+ * @index:     the page index
+ * @filler:    function to perform the read
+ * @data:      destination for read data
+ *
+ * Same as read_cache_page, but don't wait for page to become unlocked
+ * after submitting it to the filler.
+ *
+ * Read into the page cache. If a page already exists, and PageUptodate() is
+ * not set, try to fill the page but don't wait for it to become unlocked.
+ *
+ * If the page does not get brought uptodate, return -EIO.
+ */
+struct page *read_cache_page_async(struct address_space *mapping,
+                               pgoff_t index,
+                               int (*filler)(void *,struct page*),
+                               void *data)
+{
+       return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping));
+}
 EXPORT_SYMBOL(read_cache_page_async);
 
+static struct page *wait_on_page_read(struct page *page)
+{
+       if (!IS_ERR(page)) {
+               wait_on_page_locked(page);
+               if (!PageUptodate(page)) {
+                       page_cache_release(page);
+                       page = ERR_PTR(-EIO);
+               }
+       }
+       return page;
+}
+
+/**
+ * read_cache_page_gfp - read into page cache, using specified page allocation flags.
+ * @mapping:   the page's address_space
+ * @index:     the page index
+ * @gfp:       the page allocator flags to use if allocating
+ *
+ * This is the same as "read_mapping_page(mapping, index, NULL)", but with
+ * any new page allocations done using the specified allocation flags. Note
+ * that the Radix tree operations will still use GFP_KERNEL, so you can't
+ * expect to do this atomically or anything like that - but you can pass in
+ * other page requirements.
+ *
+ * If the page does not get brought uptodate, return -EIO.
+ */
+struct page *read_cache_page_gfp(struct address_space *mapping,
+                               pgoff_t index,
+                               gfp_t gfp)
+{
+       filler_t *filler = (filler_t *)mapping->a_ops->readpage;
+
+       return wait_on_page_read(do_read_cache_page(mapping, index, filler, NULL, gfp));
+}
+EXPORT_SYMBOL(read_cache_page_gfp);
+
 /**
  * read_cache_page - read into page cache, fill it if needed
  * @mapping:   the page's address_space
@@ -1729,18 +1776,7 @@ struct page *read_cache_page(struct address_space *mapping,
                                int (*filler)(void *,struct page*),
                                void *data)
 {
-       struct page *page;
-
-       page = read_cache_page_async(mapping, index, filler, data);
-       if (IS_ERR(page))
-               goto out;
-       wait_on_page_locked(page);
-       if (!PageUptodate(page)) {
-               page_cache_release(page);
-               page = ERR_PTR(-EIO);
-       }
- out:
-       return page;
+       return wait_on_page_read(read_cache_page_async(mapping, index, filler, data));
 }
 EXPORT_SYMBOL(read_cache_page);
 
@@ -2196,6 +2232,9 @@ again:
                if (unlikely(status))
                        break;
 
+               if (mapping_writably_mapped(mapping))
+                       flush_dcache_page(page);
+
                pagefault_disable();
                copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
                pagefault_enable();
index e91b81b636700befc4ce10c5286e9a0e6512df7e..2d16fa6b8c2d8fb6a40ea5b3f9ea57c77a34d1af 100644 (file)
@@ -1515,10 +1515,9 @@ static struct attribute_group hstate_attr_group = {
        .attrs = hstate_attrs,
 };
 
-static int __init hugetlb_sysfs_add_hstate(struct hstate *h,
-                               struct kobject *parent,
-                               struct kobject **hstate_kobjs,
-                               struct attribute_group *hstate_attr_group)
+static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent,
+                                   struct kobject **hstate_kobjs,
+                                   struct attribute_group *hstate_attr_group)
 {
        int retval;
        int hi = h - hstates;
index 488b644e0e8ef8f55ddc877b5359567b9cb82874..954032b80bedd0f761d66ba8c984dc88207c9584 100644 (file)
@@ -2586,7 +2586,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *mem, bool free_all)
        if (free_all)
                goto try_to_free;
 move_account:
-       while (mem->res.usage > 0) {
+       do {
                ret = -EBUSY;
                if (cgroup_task_count(cgrp) || !list_empty(&cgrp->children))
                        goto out;
@@ -2614,8 +2614,8 @@ move_account:
                if (ret == -ENOMEM)
                        goto try_to_free;
                cond_resched();
-       }
-       ret = 0;
+       /* "ret" should also be checked to ensure all lists are empty. */
+       } while (mem->res.usage > 0 || ret);
 out:
        css_put(&mem->css);
        return ret;
@@ -2648,10 +2648,7 @@ try_to_free:
        }
        lru_add_drain();
        /* try move_account...there may be some *locked* pages. */
-       if (mem->res.usage)
-               goto move_account;
-       ret = 0;
-       goto out;
+       goto move_account;
 }
 
 int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
index efddbf0926b283ae5ef292e076ff9900842c4dd5..880bd592d38ea47af36f5f9b64323e8814d09f24 100644 (file)
@@ -912,6 +912,9 @@ static int do_pages_move(struct mm_struct *mm, struct task_struct *task,
                                goto out_pm;
 
                        err = -ENODEV;
+                       if (node < 0 || node >= MAX_NUMNODES)
+                               goto out_pm;
+
                        if (!node_state(node, N_HIGH_MEMORY))
                                goto out_pm;
 
@@ -999,33 +1002,27 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
 #define DO_PAGES_STAT_CHUNK_NR 16
        const void __user *chunk_pages[DO_PAGES_STAT_CHUNK_NR];
        int chunk_status[DO_PAGES_STAT_CHUNK_NR];
-       unsigned long i, chunk_nr = DO_PAGES_STAT_CHUNK_NR;
-       int err;
 
-       for (i = 0; i < nr_pages; i += chunk_nr) {
-               if (chunk_nr > nr_pages - i)
-                       chunk_nr = nr_pages - i;
+       while (nr_pages) {
+               unsigned long chunk_nr;
 
-               err = copy_from_user(chunk_pages, &pages[i],
-                                    chunk_nr * sizeof(*chunk_pages));
-               if (err) {
-                       err = -EFAULT;
-                       goto out;
-               }
+               chunk_nr = nr_pages;
+               if (chunk_nr > DO_PAGES_STAT_CHUNK_NR)
+                       chunk_nr = DO_PAGES_STAT_CHUNK_NR;
+
+               if (copy_from_user(chunk_pages, pages, chunk_nr * sizeof(*chunk_pages)))
+                       break;
 
                do_pages_stat_array(mm, chunk_nr, chunk_pages, chunk_status);
 
-               err = copy_to_user(&status[i], chunk_status,
-                                  chunk_nr * sizeof(*chunk_status));
-               if (err) {
-                       err = -EFAULT;
-                       goto out;
-               }
-       }
-       err = 0;
+               if (copy_to_user(status, chunk_status, chunk_nr * sizeof(*status)))
+                       break;
 
-out:
-       return err;
+               pages += chunk_nr;
+               status += chunk_nr;
+               nr_pages -= chunk_nr;
+       }
+       return nr_pages ? -EFAULT : 0;
 }
 
 /*
index 17773862619b5334832b76a062411c830e90135b..48a2ecfaf05947230d32db3f54c49a3b0ba58b1d 100644 (file)
@@ -552,11 +552,11 @@ static void free_page_series(unsigned long from, unsigned long to)
 static void __put_nommu_region(struct vm_region *region)
        __releases(nommu_region_sem)
 {
-       kenter("%p{%d}", region, atomic_read(&region->vm_usage));
+       kenter("%p{%d}", region, region->vm_usage);
 
        BUG_ON(!nommu_region_tree.rb_node);
 
-       if (atomic_dec_and_test(&region->vm_usage)) {
+       if (--region->vm_usage == 0) {
                if (region->vm_top > region->vm_start)
                        delete_nommu_region(region);
                up_write(&nommu_region_sem);
@@ -1205,7 +1205,7 @@ unsigned long do_mmap_pgoff(struct file *file,
        if (!vma)
                goto error_getting_vma;
 
-       atomic_set(&region->vm_usage, 1);
+       region->vm_usage = 1;
        region->vm_flags = vm_flags;
        region->vm_pgoff = pgoff;
 
@@ -1272,7 +1272,7 @@ unsigned long do_mmap_pgoff(struct file *file,
                        }
 
                        /* we've found a region we can share */
-                       atomic_inc(&pregion->vm_usage);
+                       pregion->vm_usage++;
                        vma->vm_region = pregion;
                        start = pregion->vm_start;
                        start += (pgoff - pregion->vm_pgoff) << PAGE_SHIFT;
@@ -1289,7 +1289,7 @@ unsigned long do_mmap_pgoff(struct file *file,
                                        vma->vm_region = NULL;
                                        vma->vm_start = 0;
                                        vma->vm_end = 0;
-                                       atomic_dec(&pregion->vm_usage);
+                                       pregion->vm_usage--;
                                        pregion = NULL;
                                        goto error_just_free;
                                }
@@ -1441,10 +1441,9 @@ int split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
 
        kenter("");
 
-       /* we're only permitted to split anonymous regions that have a single
-        * owner */
-       if (vma->vm_file ||
-           atomic_read(&vma->vm_region->vm_usage) != 1)
+       /* we're only permitted to split anonymous regions (these should have
+        * only a single usage on the region) */
+       if (vma->vm_file)
                return -ENOMEM;
 
        if (mm->map_count >= sysctl_max_map_count)
@@ -1518,7 +1517,7 @@ static int shrink_vma(struct mm_struct *mm,
 
        /* cut the backing region down to size */
        region = vma->vm_region;
-       BUG_ON(atomic_read(&region->vm_usage) != 1);
+       BUG_ON(region->vm_usage != 1);
 
        down_write(&nommu_region_sem);
        delete_nommu_region(region);
@@ -1761,27 +1760,6 @@ void unmap_mapping_range(struct address_space *mapping,
 }
 EXPORT_SYMBOL(unmap_mapping_range);
 
-/*
- * ask for an unmapped area at which to create a mapping on a file
- */
-unsigned long get_unmapped_area(struct file *file, unsigned long addr,
-                               unsigned long len, unsigned long pgoff,
-                               unsigned long flags)
-{
-       unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
-                                 unsigned long, unsigned long);
-
-       get_area = current->mm->get_unmapped_area;
-       if (file && file->f_op && file->f_op->get_unmapped_area)
-               get_area = file->f_op->get_unmapped_area;
-
-       if (!get_area)
-               return -ENOSYS;
-
-       return get_area(file, addr, len, pgoff, flags);
-}
-EXPORT_SYMBOL(get_unmapped_area);
-
 /*
  * Check that a process has enough memory to allocate a new virtual
  * mapping. 0 means there is enough memory for the allocation to
@@ -1936,3 +1914,65 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
        mmput(mm);
        return len;
 }
+
+/**
+ * nommu_shrink_inode_mappings - Shrink the shared mappings on an inode
+ * @inode: The inode to check
+ * @size: The current filesize of the inode
+ * @newsize: The proposed filesize of the inode
+ *
+ * Check the shared mappings on an inode on behalf of a shrinking truncate to
+ * make sure that that any outstanding VMAs aren't broken and then shrink the
+ * vm_regions that extend that beyond so that do_mmap_pgoff() doesn't
+ * automatically grant mappings that are too large.
+ */
+int nommu_shrink_inode_mappings(struct inode *inode, size_t size,
+                               size_t newsize)
+{
+       struct vm_area_struct *vma;
+       struct prio_tree_iter iter;
+       struct vm_region *region;
+       pgoff_t low, high;
+       size_t r_size, r_top;
+
+       low = newsize >> PAGE_SHIFT;
+       high = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+
+       down_write(&nommu_region_sem);
+
+       /* search for VMAs that fall within the dead zone */
+       vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap,
+                             low, high) {
+               /* found one - only interested if it's shared out of the page
+                * cache */
+               if (vma->vm_flags & VM_SHARED) {
+                       up_write(&nommu_region_sem);
+                       return -ETXTBSY; /* not quite true, but near enough */
+               }
+       }
+
+       /* reduce any regions that overlap the dead zone - if in existence,
+        * these will be pointed to by VMAs that don't overlap the dead zone
+        *
+        * we don't check for any regions that start beyond the EOF as there
+        * shouldn't be any
+        */
+       vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap,
+                             0, ULONG_MAX) {
+               if (!(vma->vm_flags & VM_SHARED))
+                       continue;
+
+               region = vma->vm_region;
+               r_size = region->vm_top - region->vm_start;
+               r_top = (region->vm_pgoff << PAGE_SHIFT) + r_size;
+
+               if (r_top > newsize) {
+                       region->vm_top -= r_top - newsize;
+                       if (region->vm_end > region->vm_top)
+                               region->vm_end = region->vm_top;
+               }
+       }
+
+       up_write(&nommu_region_sem);
+       return 0;
+}
index f52481b1c1e5442c9a5b16b06b22221b75b9bb7c..237050478f28f46fc59c5c9984337f1c3d60de08 100644 (file)
@@ -459,6 +459,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
        list_for_each_entry(c, &p->children, sibling) {
                if (c->mm == p->mm)
                        continue;
+               if (mem && !task_in_mem_cgroup(c, mem))
+                       continue;
                if (!oom_kill_task(c))
                        return 0;
        }
index 4e9f5cc5fb59d166c57477771790106d1818c059..8deb9d0fd5b1781cac582487fbbb11bb28129b0b 100644 (file)
@@ -556,8 +556,9 @@ static void free_pcppages_bulk(struct zone *zone, int count,
                        page = list_entry(list->prev, struct page, lru);
                        /* must delete as __free_one_page list manipulates */
                        list_del(&page->lru);
-                       __free_one_page(page, zone, 0, migratetype);
-                       trace_mm_page_pcpu_drain(page, 0, migratetype);
+                       /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
+                       __free_one_page(page, zone, 0, page_private(page));
+                       trace_mm_page_pcpu_drain(page, 0, page_private(page));
                } while (--count && --batch_free && !list_empty(list));
        }
        spin_unlock(&zone->lock);
@@ -1222,10 +1223,10 @@ again:
                }
                spin_lock_irqsave(&zone->lock, flags);
                page = __rmqueue(zone, order, migratetype);
-               __mod_zone_page_state(zone, NR_FREE_PAGES, -(1 << order));
                spin_unlock(&zone->lock);
                if (!page)
                        goto failed;
+               __mod_zone_page_state(zone, NR_FREE_PAGES, -(1 << order));
        }
 
        __count_zone_vm_events(PGALLOC, zone, 1 << order);
@@ -3998,7 +3999,7 @@ void __init add_active_range(unsigned int nid, unsigned long start_pfn,
                }
 
                /* Merge backward if suitable */
-               if (start_pfn < early_node_map[i].end_pfn &&
+               if (start_pfn < early_node_map[i].start_pfn &&
                                end_pfn >= early_node_map[i].start_pfn) {
                        early_node_map[i].start_pfn = start_pfn;
                        return;
index 342deee22684ffdfded563506d684ef0f2b18191..e87e37244829ce03abc22673cda7eeb37f6fff0a 100644 (file)
@@ -522,22 +522,20 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
  */
 void truncate_pagecache(struct inode *inode, loff_t old, loff_t new)
 {
-       if (new < old) {
-               struct address_space *mapping = inode->i_mapping;
-
-               /*
-                * unmap_mapping_range is called twice, first simply for
-                * efficiency so that truncate_inode_pages does fewer
-                * single-page unmaps.  However after this first call, and
-                * before truncate_inode_pages finishes, it is possible for
-                * private pages to be COWed, which remain after
-                * truncate_inode_pages finishes, hence the second
-                * unmap_mapping_range call must be made for correctness.
-                */
-               unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
-               truncate_inode_pages(mapping, new);
-               unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
-       }
+       struct address_space *mapping = inode->i_mapping;
+
+       /*
+        * unmap_mapping_range is called twice, first simply for
+        * efficiency so that truncate_inode_pages does fewer
+        * single-page unmaps.  However after this first call, and
+        * before truncate_inode_pages finishes, it is possible for
+        * private pages to be COWed, which remain after
+        * truncate_inode_pages finishes, hence the second
+        * unmap_mapping_range call must be made for correctness.
+        */
+       unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
+       truncate_inode_pages(mapping, new);
+       unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
 }
 EXPORT_SYMBOL(truncate_pagecache);
 
index 7c35ad95f92756d1473bbc2ae658f5bb27de2ca9..834db7be240f3e10769166396fdec9b2620eeb82 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -220,7 +220,7 @@ char *strndup_user(const char __user *s, long n)
 }
 EXPORT_SYMBOL(strndup_user);
 
-#ifndef HAVE_ARCH_PICK_MMAP_LAYOUT
+#if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT)
 void arch_pick_mmap_layout(struct mm_struct *mm)
 {
        mm->mmap_base = TASK_UNMAPPED_BASE;
index 37e69295f250d585b1a2f7e9bf38f80b7186cdbb..ae007462b7f6e8c2463d83edc2d202107f996a32 100644 (file)
@@ -509,6 +509,9 @@ static unsigned long lazy_max_pages(void)
 
 static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
 
+/* for per-CPU blocks */
+static void purge_fragmented_blocks_allcpus(void);
+
 /*
  * Purges all lazily-freed vmap areas.
  *
@@ -539,6 +542,9 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
        } else
                spin_lock(&purge_lock);
 
+       if (sync)
+               purge_fragmented_blocks_allcpus();
+
        rcu_read_lock();
        list_for_each_entry_rcu(va, &vmap_area_list, list) {
                if (va->flags & VM_LAZY_FREE) {
@@ -555,10 +561,8 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
        }
        rcu_read_unlock();
 
-       if (nr) {
-               BUG_ON(nr > atomic_read(&vmap_lazy_nr));
+       if (nr)
                atomic_sub(nr, &vmap_lazy_nr);
-       }
 
        if (nr || force_flush)
                flush_tlb_kernel_range(*start, *end);
@@ -669,8 +673,6 @@ static bool vmap_initialized __read_mostly = false;
 struct vmap_block_queue {
        spinlock_t lock;
        struct list_head free;
-       struct list_head dirty;
-       unsigned int nr_dirty;
 };
 
 struct vmap_block {
@@ -680,10 +682,9 @@ struct vmap_block {
        unsigned long free, dirty;
        DECLARE_BITMAP(alloc_map, VMAP_BBMAP_BITS);
        DECLARE_BITMAP(dirty_map, VMAP_BBMAP_BITS);
-       union {
-               struct list_head free_list;
-               struct rcu_head rcu_head;
-       };
+       struct list_head free_list;
+       struct rcu_head rcu_head;
+       struct list_head purge;
 };
 
 /* Queue of free and dirty vmap blocks, for allocation and flushing purposes */
@@ -759,7 +760,7 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
        vbq = &get_cpu_var(vmap_block_queue);
        vb->vbq = vbq;
        spin_lock(&vbq->lock);
-       list_add(&vb->free_list, &vbq->free);
+       list_add_rcu(&vb->free_list, &vbq->free);
        spin_unlock(&vbq->lock);
        put_cpu_var(vmap_block_queue);
 
@@ -778,8 +779,6 @@ static void free_vmap_block(struct vmap_block *vb)
        struct vmap_block *tmp;
        unsigned long vb_idx;
 
-       BUG_ON(!list_empty(&vb->free_list));
-
        vb_idx = addr_to_vb_idx(vb->va->va_start);
        spin_lock(&vmap_block_tree_lock);
        tmp = radix_tree_delete(&vmap_block_tree, vb_idx);
@@ -790,12 +789,61 @@ static void free_vmap_block(struct vmap_block *vb)
        call_rcu(&vb->rcu_head, rcu_free_vb);
 }
 
+static void purge_fragmented_blocks(int cpu)
+{
+       LIST_HEAD(purge);
+       struct vmap_block *vb;
+       struct vmap_block *n_vb;
+       struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(vb, &vbq->free, free_list) {
+
+               if (!(vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS))
+                       continue;
+
+               spin_lock(&vb->lock);
+               if (vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS) {
+                       vb->free = 0; /* prevent further allocs after releasing lock */
+                       vb->dirty = VMAP_BBMAP_BITS; /* prevent purging it again */
+                       bitmap_fill(vb->alloc_map, VMAP_BBMAP_BITS);
+                       bitmap_fill(vb->dirty_map, VMAP_BBMAP_BITS);
+                       spin_lock(&vbq->lock);
+                       list_del_rcu(&vb->free_list);
+                       spin_unlock(&vbq->lock);
+                       spin_unlock(&vb->lock);
+                       list_add_tail(&vb->purge, &purge);
+               } else
+                       spin_unlock(&vb->lock);
+       }
+       rcu_read_unlock();
+
+       list_for_each_entry_safe(vb, n_vb, &purge, purge) {
+               list_del(&vb->purge);
+               free_vmap_block(vb);
+       }
+}
+
+static void purge_fragmented_blocks_thiscpu(void)
+{
+       purge_fragmented_blocks(smp_processor_id());
+}
+
+static void purge_fragmented_blocks_allcpus(void)
+{
+       int cpu;
+
+       for_each_possible_cpu(cpu)
+               purge_fragmented_blocks(cpu);
+}
+
 static void *vb_alloc(unsigned long size, gfp_t gfp_mask)
 {
        struct vmap_block_queue *vbq;
        struct vmap_block *vb;
        unsigned long addr = 0;
        unsigned int order;
+       int purge = 0;
 
        BUG_ON(size & ~PAGE_MASK);
        BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC);
@@ -808,24 +856,38 @@ again:
                int i;
 
                spin_lock(&vb->lock);
+               if (vb->free < 1UL << order)
+                       goto next;
+
                i = bitmap_find_free_region(vb->alloc_map,
                                                VMAP_BBMAP_BITS, order);
 
-               if (i >= 0) {
-                       addr = vb->va->va_start + (i << PAGE_SHIFT);
-                       BUG_ON(addr_to_vb_idx(addr) !=
-                                       addr_to_vb_idx(vb->va->va_start));
-                       vb->free -= 1UL << order;
-                       if (vb->free == 0) {
-                               spin_lock(&vbq->lock);
-                               list_del_init(&vb->free_list);
-                               spin_unlock(&vbq->lock);
+               if (i < 0) {
+                       if (vb->free + vb->dirty == VMAP_BBMAP_BITS) {
+                               /* fragmented and no outstanding allocations */
+                               BUG_ON(vb->dirty != VMAP_BBMAP_BITS);
+                               purge = 1;
                        }
-                       spin_unlock(&vb->lock);
-                       break;
+                       goto next;
+               }
+               addr = vb->va->va_start + (i << PAGE_SHIFT);
+               BUG_ON(addr_to_vb_idx(addr) !=
+                               addr_to_vb_idx(vb->va->va_start));
+               vb->free -= 1UL << order;
+               if (vb->free == 0) {
+                       spin_lock(&vbq->lock);
+                       list_del_rcu(&vb->free_list);
+                       spin_unlock(&vbq->lock);
                }
                spin_unlock(&vb->lock);
+               break;
+next:
+               spin_unlock(&vb->lock);
        }
+
+       if (purge)
+               purge_fragmented_blocks_thiscpu();
+
        put_cpu_var(vmap_block_queue);
        rcu_read_unlock();
 
@@ -862,11 +924,11 @@ static void vb_free(const void *addr, unsigned long size)
        BUG_ON(!vb);
 
        spin_lock(&vb->lock);
-       bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order);
+       BUG_ON(bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order));
 
        vb->dirty += 1UL << order;
        if (vb->dirty == VMAP_BBMAP_BITS) {
-               BUG_ON(vb->free || !list_empty(&vb->free_list));
+               BUG_ON(vb->free);
                spin_unlock(&vb->lock);
                free_vmap_block(vb);
        } else
@@ -1035,8 +1097,6 @@ void __init vmalloc_init(void)
                vbq = &per_cpu(vmap_block_queue, i);
                spin_lock_init(&vbq->lock);
                INIT_LIST_HEAD(&vbq->free);
-               INIT_LIST_HEAD(&vbq->dirty);
-               vbq->nr_dirty = 0;
        }
 
        /* Import existing vmlist entries. */
index 885207a6b6b735cb7ca0dd276b907312300b5df1..c26986c85ce01b1d15a8914065a829890054c210 100644 (file)
@@ -1922,6 +1922,9 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining)
                if (!populated_zone(zone))
                        continue;
 
+               if (zone_is_all_unreclaimable(zone))
+                       continue;
+
                if (!zone_watermark_ok(zone, order, high_wmark_pages(zone),
                                                                0, 0))
                        return 1;
index b7889782047e90b66b6ea8bd722d6340dc16ca2e..c1b92cab46c70d777f3b48b8307ad7cb877e258c 100644 (file)
@@ -163,7 +163,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
                goto err_unlock;
        }
 
-       rx_stats = per_cpu_ptr(vlan_dev_info(dev)->vlan_rx_stats,
+       rx_stats = per_cpu_ptr(vlan_dev_info(skb->dev)->vlan_rx_stats,
                               smp_processor_id());
        rx_stats->rx_packets++;
        rx_stats->rx_bytes += skb->len;
index 8af95b2dddd62eb4baa6205c776681bf09b91a64..09d4f1e2e4a8cef1974929198e8df452597c40f6 100644 (file)
@@ -69,7 +69,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...);
 
 static int parse_opts(char *opts, struct p9_client *clnt)
 {
-       char *options;
+       char *options, *tmp_options;
        char *p;
        substring_t args[MAX_OPT_ARGS];
        int option;
@@ -81,12 +81,13 @@ static int parse_opts(char *opts, struct p9_client *clnt)
        if (!opts)
                return 0;
 
-       options = kstrdup(opts, GFP_KERNEL);
-       if (!options) {
+       tmp_options = kstrdup(opts, GFP_KERNEL);
+       if (!tmp_options) {
                P9_DPRINTK(P9_DEBUG_ERROR,
                                "failed to allocate copy of option string\n");
                return -ENOMEM;
        }
+       options = tmp_options;
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
@@ -108,6 +109,13 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        break;
                case Opt_trans:
                        clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
+                       if(clnt->trans_mod == NULL) {
+                               P9_DPRINTK(P9_DEBUG_ERROR,
+                                  "Could not find request transport: %s\n",
+                                  (char *) &args[0]);
+                               ret = -EINVAL;
+                               goto free_and_return;
+                       }
                        break;
                case Opt_legacy:
                        clnt->dotu = 0;
@@ -117,7 +125,8 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                }
        }
 
-       kfree(options);
+free_and_return:
+       kfree(tmp_options);
        return ret;
 }
 
@@ -667,18 +676,12 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
        clnt->trans = NULL;
        spin_lock_init(&clnt->lock);
        INIT_LIST_HEAD(&clnt->fidlist);
-       clnt->fidpool = p9_idpool_create();
-       if (IS_ERR(clnt->fidpool)) {
-               err = PTR_ERR(clnt->fidpool);
-               clnt->fidpool = NULL;
-               goto error;
-       }
 
        p9_tag_init(clnt);
 
        err = parse_opts(options, clnt);
        if (err < 0)
-               goto error;
+               goto free_client;
 
        if (!clnt->trans_mod)
                clnt->trans_mod = v9fs_get_default_trans();
@@ -687,7 +690,14 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
                err = -EPROTONOSUPPORT;
                P9_DPRINTK(P9_DEBUG_ERROR,
                                "No transport defined or default transport\n");
-               goto error;
+               goto free_client;
+       }
+
+       clnt->fidpool = p9_idpool_create();
+       if (IS_ERR(clnt->fidpool)) {
+               err = PTR_ERR(clnt->fidpool);
+               clnt->fidpool = NULL;
+               goto put_trans;
        }
 
        P9_DPRINTK(P9_DEBUG_MUX, "clnt %p trans %p msize %d dotu %d\n",
@@ -695,19 +705,25 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
 
        err = clnt->trans_mod->create(clnt, dev_name, options);
        if (err)
-               goto error;
+               goto destroy_fidpool;
 
        if ((clnt->msize+P9_IOHDRSZ) > clnt->trans_mod->maxsize)
                clnt->msize = clnt->trans_mod->maxsize-P9_IOHDRSZ;
 
        err = p9_client_version(clnt);
        if (err)
-               goto error;
+               goto close_trans;
 
        return clnt;
 
-error:
-       p9_client_destroy(clnt);
+close_trans:
+       clnt->trans_mod->close(clnt);
+destroy_fidpool:
+       p9_idpool_destroy(clnt->fidpool);
+put_trans:
+       v9fs_put_trans(clnt->trans_mod);
+free_client:
+       kfree(clnt);
        return ERR_PTR(err);
 }
 EXPORT_SYMBOL(p9_client_create);
@@ -1214,10 +1230,11 @@ static int p9_client_statsize(struct p9_wstat *wst, int optional)
 {
        int ret;
 
+       /* NOTE: size shouldn't include its own length */
        /* size[2] type[2] dev[4] qid[13] */
        /* mode[4] atime[4] mtime[4] length[8]*/
        /* name[s] uid[s] gid[s] muid[s] */
-       ret = 2+2+4+13+4+4+4+8+2+2+2+2;
+       ret = 2+4+13+4+4+4+8+2+2+2+2;
 
        if (wst->name)
                ret += strlen(wst->name);
@@ -1258,7 +1275,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
                wst->name, wst->uid, wst->gid, wst->muid, wst->extension,
                wst->n_uid, wst->n_gid, wst->n_muid);
 
-       req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size, wst);
+       req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size+2, wst);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                goto error;
index be1cb909d8c00e5e9cac2a910fa2d8f793249779..31d0b05582a970e9c35b5e01e7d90d36ac25fd6b 100644 (file)
@@ -714,7 +714,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
        char *p;
        substring_t args[MAX_OPT_ARGS];
        int option;
-       char *options;
+       char *options, *tmp_options;
        int ret;
 
        opts->port = P9_PORT;
@@ -724,12 +724,13 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
        if (!params)
                return 0;
 
-       options = kstrdup(params, GFP_KERNEL);
-       if (!options) {
+       tmp_options = kstrdup(params, GFP_KERNEL);
+       if (!tmp_options) {
                P9_DPRINTK(P9_DEBUG_ERROR,
                                "failed to allocate copy of option string\n");
                return -ENOMEM;
        }
+       options = tmp_options;
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
@@ -760,7 +761,8 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
                        continue;
                }
        }
-       kfree(options);
+
+       kfree(tmp_options);
        return 0;
 }
 
index 65cb29db03f8cbd1440e62dfece699e4c8ff4c4f..2c95a89c0f46464e379bb15ca79622149e9f051e 100644 (file)
@@ -166,7 +166,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
        char *p;
        substring_t args[MAX_OPT_ARGS];
        int option;
-       char *options;
+       char *options, *tmp_options;
        int ret;
 
        opts->port = P9_PORT;
@@ -177,12 +177,13 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
        if (!params)
                return 0;
 
-       options = kstrdup(params, GFP_KERNEL);
-       if (!options) {
+       tmp_options = kstrdup(params, GFP_KERNEL);
+       if (!tmp_options) {
                P9_DPRINTK(P9_DEBUG_ERROR,
                           "failed to allocate copy of option string\n");
                return -ENOMEM;
        }
+       options = tmp_options;
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
@@ -216,7 +217,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
        }
        /* RQ must be at least as large as the SQ */
        opts->rq_depth = max(opts->rq_depth, opts->sq_depth);
-       kfree(options);
+       kfree(tmp_options);
        return 0;
 }
 
index ea1e3daabefeddb1dc6f46ddf5538b33cc3c0317..cb50f4ae5eefa1f5cde720f43daaf6f19e9034eb 100644 (file)
@@ -102,7 +102,8 @@ static void p9_virtio_close(struct p9_client *client)
        struct virtio_chan *chan = client->trans;
 
        mutex_lock(&virtio_9p_lock);
-       chan->inuse = false;
+       if (chan)
+               chan->inuse = false;
        mutex_unlock(&virtio_9p_lock);
 }
 
@@ -311,6 +312,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
        }
 
        client->trans = (void *)chan;
+       client->status = Connected;
        chan->client = client;
 
        return 0;
index 9d4adfd22757fbc3f750b594ec341f0527d7fb33..f2b3b56aa779305623fc4c919bae37a7a24c0b41 100644 (file)
@@ -819,7 +819,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
                                ma = &ifa->address;
                        else { /* We need to make a copy of the entry. */
                                da.s_node = sa.s_node;
-                               da.s_net = da.s_net;
+                               da.s_net = sa.s_net;
                                ma = &da;
                        }
 
index bf706f83a5c9b123d2a14f210a7fe19510030590..14912600ec57e6e961ee7de20dc2eebbb9a4013c 100644 (file)
@@ -92,6 +92,12 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax2
 #endif
        }
 
+       /*
+        * There is one ref for the state machine; a caller needs
+        * one more to put it back, just like with the existing one.
+        */
+       ax25_cb_hold(ax25);
+
        ax25_cb_add(ax25);
 
        ax25->state = AX25_STATE_1;
index b7c4224f4e7dee01288dd31f4581f7a8821c7a21..b10e3cdb08f87358ca64d0db8cf83c27f5ad624a 100644 (file)
@@ -377,6 +377,9 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
 
        if (acl->state == BT_CONNECTED &&
                        (sco->state == BT_OPEN || sco->state == BT_CLOSED)) {
+               acl->power_save = 1;
+               hci_conn_enter_active_mode(acl);
+
                if (lmp_esco_capable(hdev))
                        hci_setup_sync(sco, acl->handle);
                else
index 28517bad796c3181251bf76b1ddc459090d45deb..592da5c909c1bb482b8358c93ef213f41d7a4e70 100644 (file)
@@ -1699,6 +1699,7 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
                break;
 
        case 0x1c:      /* SCO interval rejected */
+       case 0x1a:      /* Unsupported Remote Feature */
        case 0x1f:      /* Unspecified error */
                if (conn->out && conn->attempt < 2) {
                        conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
index 18e7f5a43dc4fd8eda8d34a7b65e98752c86946f..280529ad9274afe107dc4b566f25768c4c044d73 100644 (file)
@@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb)
        input_sync(dev);
 }
 
+static int __hidp_send_ctrl_message(struct hidp_session *session,
+                       unsigned char hdr, unsigned char *data, int size)
+{
+       struct sk_buff *skb;
+
+       BT_DBG("session %p data %p size %d", session, data, size);
+
+       if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
+               BT_ERR("Can't allocate memory for new frame");
+               return -ENOMEM;
+       }
+
+       *skb_put(skb, 1) = hdr;
+       if (data && size > 0)
+               memcpy(skb_put(skb, size), data, size);
+
+       skb_queue_tail(&session->ctrl_transmit, skb);
+
+       return 0;
+}
+
+static inline int hidp_send_ctrl_message(struct hidp_session *session,
+                       unsigned char hdr, unsigned char *data, int size)
+{
+       int err;
+
+       err = __hidp_send_ctrl_message(session, hdr, data, size);
+
+       hidp_schedule(session);
+
+       return err;
+}
+
 static int hidp_queue_report(struct hidp_session *session,
                                unsigned char *data, int size)
 {
@@ -280,9 +313,22 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep
        return hidp_queue_report(session, buf, rsize);
 }
 
-static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
+static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
+               unsigned char report_type)
 {
-       if (hidp_queue_report(hid->driver_data, data, count))
+       switch (report_type) {
+       case HID_FEATURE_REPORT:
+               report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE;
+               break;
+       case HID_OUTPUT_REPORT:
+               report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (hidp_send_ctrl_message(hid->driver_data, report_type,
+                       data, count))
                return -ENOMEM;
        return count;
 }
@@ -307,39 +353,6 @@ static inline void hidp_del_timer(struct hidp_session *session)
                del_timer(&session->timer);
 }
 
-static int __hidp_send_ctrl_message(struct hidp_session *session,
-                       unsigned char hdr, unsigned char *data, int size)
-{
-       struct sk_buff *skb;
-
-       BT_DBG("session %p data %p size %d", session, data, size);
-
-       if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
-               BT_ERR("Can't allocate memory for new frame");
-               return -ENOMEM;
-       }
-
-       *skb_put(skb, 1) = hdr;
-       if (data && size > 0)
-               memcpy(skb_put(skb, size), data, size);
-
-       skb_queue_tail(&session->ctrl_transmit, skb);
-
-       return 0;
-}
-
-static inline int hidp_send_ctrl_message(struct hidp_session *session,
-                       unsigned char hdr, unsigned char *data, int size)
-{
-       int err;
-
-       err = __hidp_send_ctrl_message(session, hdr, data, size);
-
-       hidp_schedule(session);
-
-       return err;
-}
-
 static void hidp_process_handshake(struct hidp_session *session,
                                        unsigned char param)
 {
@@ -701,29 +714,9 @@ static void hidp_close(struct hid_device *hid)
 static int hidp_parse(struct hid_device *hid)
 {
        struct hidp_session *session = hid->driver_data;
-       struct hidp_connadd_req *req = session->req;
-       unsigned char *buf;
-       int ret;
-
-       buf = kmalloc(req->rd_size, GFP_KERNEL);
-       if (!buf)
-               return -ENOMEM;
-
-       if (copy_from_user(buf, req->rd_data, req->rd_size)) {
-               kfree(buf);
-               return -EFAULT;
-       }
-
-       ret = hid_parse_report(session->hid, buf, req->rd_size);
-
-       kfree(buf);
-
-       if (ret)
-               return ret;
-
-       session->req = NULL;
 
-       return 0;
+       return hid_parse_report(session->hid, session->rd_data,
+                       session->rd_size);
 }
 
 static int hidp_start(struct hid_device *hid)
@@ -768,12 +761,24 @@ static int hidp_setup_hid(struct hidp_session *session,
        bdaddr_t src, dst;
        int err;
 
+       session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
+       if (!session->rd_data)
+               return -ENOMEM;
+
+       if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) {
+               err = -EFAULT;
+               goto fault;
+       }
+       session->rd_size = req->rd_size;
+
        hid = hid_allocate_device();
-       if (IS_ERR(hid))
-               return PTR_ERR(hid);
+       if (IS_ERR(hid)) {
+               err = PTR_ERR(hid);
+               goto fault;
+       }
 
        session->hid = hid;
-       session->req = req;
+
        hid->driver_data = session;
 
        baswap(&src, &bt_sk(session->ctrl_sock->sk)->src);
@@ -804,6 +809,10 @@ failed:
        hid_destroy_device(hid);
        session->hid = NULL;
 
+fault:
+       kfree(session->rd_data);
+       session->rd_data = NULL;
+
        return err;
 }
 
@@ -898,6 +907,9 @@ unlink:
                session->hid = NULL;
        }
 
+       kfree(session->rd_data);
+       session->rd_data = NULL;
+
 purge:
        skb_queue_purge(&session->ctrl_transmit);
        skb_queue_purge(&session->intr_transmit);
index faf3d74c35863aeb24aff69033e1f4b9f9768219..a4e215d50c10ba23190c402f9b3d66a27d454bcb 100644 (file)
@@ -154,7 +154,9 @@ struct hidp_session {
        struct sk_buff_head ctrl_transmit;
        struct sk_buff_head intr_transmit;
 
-       struct hidp_connadd_req *req;
+       /* Report descriptor */
+       __u8 *rd_data;
+       uint rd_size;
 };
 
 static inline void hidp_schedule(struct hidp_session *session)
index 1120cf14a5484b0bd9ac3ba331874e81121c1182..400efa26ddbab7474fdfc1d1992eb204b4104f20 100644 (file)
@@ -1368,7 +1368,6 @@ static int l2cap_ertm_send(struct sock *sk)
 
        while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) &&
               !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) {
-               tx_skb = skb_clone(skb, GFP_ATOMIC);
 
                if (pi->remote_max_tx &&
                                bt_cb(skb)->retries == pi->remote_max_tx) {
@@ -1376,6 +1375,8 @@ static int l2cap_ertm_send(struct sock *sk)
                        break;
                }
 
+               tx_skb = skb_clone(skb, GFP_ATOMIC);
+
                bt_cb(skb)->retries++;
 
                control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
@@ -3518,7 +3519,6 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
        struct l2cap_pinfo *pi;
        u16 control, len;
        u8 tx_seq;
-       int err;
 
        sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
        if (!sk) {
@@ -3570,13 +3570,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
                        goto drop;
 
                if (__is_iframe(control))
-                       err = l2cap_data_channel_iframe(sk, control, skb);
+                       l2cap_data_channel_iframe(sk, control, skb);
                else
-                       err = l2cap_data_channel_sframe(sk, control, skb);
+                       l2cap_data_channel_sframe(sk, control, skb);
 
-               if (!err)
-                       goto done;
-               break;
+               goto done;
 
        case L2CAP_MODE_STREAMING:
                control = get_unaligned_le16(skb->data);
@@ -3602,7 +3600,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
                else
                        pi->expected_tx_seq = tx_seq + 1;
 
-               err = l2cap_sar_reassembly_sdu(sk, skb, control);
+               l2cap_sar_reassembly_sdu(sk, skb, control);
 
                goto done;
 
index fc5ee3296e224f4144a08ddc2ba0f01bb6b31895..89f4a59eb82b9a520886a35e6b3aa65a6286ea70 100644 (file)
@@ -252,7 +252,6 @@ static void rfcomm_session_timeout(unsigned long arg)
        BT_DBG("session %p state %ld", s, s->state);
 
        set_bit(RFCOMM_TIMED_OUT, &s->flags);
-       rfcomm_session_put(s);
        rfcomm_schedule(RFCOMM_SCHED_TIMEO);
 }
 
@@ -1151,7 +1150,11 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
                        break;
 
                case BT_DISCONN:
-                       rfcomm_session_put(s);
+                       /* When socket is closed and we are not RFCOMM
+                        * initiator rfcomm_process_rx already calls
+                        * rfcomm_session_put() */
+                       if (s->sock->sk->sk_state != BT_CLOSED)
+                               rfcomm_session_put(s);
                        break;
                }
        }
@@ -1920,6 +1923,7 @@ static inline void rfcomm_process_sessions(void)
                if (test_and_clear_bit(RFCOMM_TIMED_OUT, &s->flags)) {
                        s->state = BT_DISCONN;
                        rfcomm_send_disc(s, 0);
+                       rfcomm_session_put(s);
                        continue;
                }
 
index be9924f60ec34bafa135916455595e794a7fe86c..bb1f1da2b8a7bff45c9ac95515ebd10e7bec2145 100644 (file)
@@ -2041,7 +2041,7 @@ gso:
        rcu_read_lock_bh();
 
        txq = dev_pick_tx(dev, skb);
-       q = rcu_dereference(txq->qdisc);
+       q = rcu_dereference_bh(txq->qdisc);
 
 #ifdef CONFIG_NET_CLS_ACT
        skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS);
@@ -2761,7 +2761,7 @@ gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb,
        switch (ret) {
        case GRO_NORMAL:
        case GRO_HELD:
-               skb->protocol = eth_type_trans(skb, napi->dev);
+               skb->protocol = eth_type_trans(skb, skb->dev);
 
                if (ret == GRO_HELD)
                        skb_gro_pull(skb, -ETH_HLEN);
index 57bc4d5b8d084c053cded6ebddfe66bf6255d9f5..cb1b3488b739837fcff71c10d36694f2ea3ab393 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/string.h>
 #include <linux/types.h>
 #include <net/net_namespace.h>
+#include <linux/sched.h>
 
 #include <net/dst.h>
 
@@ -79,6 +80,7 @@ loop:
        while ((dst = next) != NULL) {
                next = dst->next;
                prefetch(&next->next);
+               cond_resched();
                if (likely(atomic_read(&dst->__refcnt))) {
                        last->next = dst;
                        last = dst;
index d8aee584e8d1fe17edc534e2aba7c27b080bfa8b..236a9988ea91443ebee44141935239a267c2b027 100644 (file)
@@ -927,6 +927,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
        case ETHTOOL_GPERMADDR:
        case ETHTOOL_GUFO:
        case ETHTOOL_GGSO:
+       case ETHTOOL_GGRO:
        case ETHTOOL_GFLAGS:
        case ETHTOOL_GPFLAGS:
        case ETHTOOL_GRXFH:
index 08db7b9143a35709f61babe2932e5d7ff6754cea..3541aa48d21d9a8e575f67fba50d5988e73f7533 100644 (file)
@@ -86,7 +86,7 @@ int sk_filter(struct sock *sk, struct sk_buff *skb)
                return err;
 
        rcu_read_lock_bh();
-       filter = rcu_dereference(sk->sk_filter);
+       filter = rcu_dereference_bh(sk->sk_filter);
        if (filter) {
                unsigned int pkt_len = sk_run_filter(skb, filter->insns,
                                filter->len);
@@ -521,7 +521,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
        }
 
        rcu_read_lock_bh();
-       old_fp = rcu_dereference(sk->sk_filter);
+       old_fp = rcu_dereference_bh(sk->sk_filter);
        rcu_assign_pointer(sk->sk_filter, fp);
        rcu_read_unlock_bh();
 
@@ -536,7 +536,7 @@ int sk_detach_filter(struct sock *sk)
        struct sk_filter *filter;
 
        rcu_read_lock_bh();
-       filter = rcu_dereference(sk->sk_filter);
+       filter = rcu_dereference_bh(sk->sk_filter);
        if (filter) {
                rcu_assign_pointer(sk->sk_filter, NULL);
                sk_filter_delayed_uncharge(sk, filter);
index fbc1c7472c5e4cafffb5f1455895907c45ade25e..099c753c4213ae814b51bf4e149eeb4f79836224 100644 (file)
@@ -410,7 +410,8 @@ static ssize_t wireless_show(struct device *d, char *buf,
        const struct iw_statistics *iw;
        ssize_t ret = -EINVAL;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        if (dev_isalive(dev)) {
                iw = get_wireless_stats(dev);
                if (iw)
index de0c2c726420e2044c55fd6235e15e915de16a51..2e692afdc55da7225570469c75cff9e34905dbb0 100644 (file)
@@ -3524,6 +3524,7 @@ static int pktgen_thread_worker(void *arg)
                        wait_event_interruptible_timeout(t->queue,
                                                         t->control != 0,
                                                         HZ/10);
+                       try_to_freeze();
                        continue;
                }
 
index 794bcb897ff000eeff119df41e72864958b304d3..4c7d3f635ba7ab97dbc76b55f000ccb398bd2dbc 100644 (file)
@@ -89,6 +89,14 @@ int rtnl_is_locked(void)
 }
 EXPORT_SYMBOL(rtnl_is_locked);
 
+#ifdef CONFIG_PROVE_LOCKING
+int lockdep_rtnl_is_held(void)
+{
+       return lockdep_is_held(&rtnl_mutex);
+}
+EXPORT_SYMBOL(lockdep_rtnl_is_held);
+#endif /* #ifdef CONFIG_PROVE_LOCKING */
+
 static struct rtnl_link *rtnl_msg_handlers[NPROTO];
 
 static inline int rtm_msgindex(int msgtype)
index e1f6f225f012eaa513ba556c8833fb85a5b5f575..305cba401ae6bcd298e1b10004e536eebb3a9107 100644 (file)
@@ -1073,7 +1073,8 @@ static void __sk_free(struct sock *sk)
        if (sk->sk_destruct)
                sk->sk_destruct(sk);
 
-       filter = rcu_dereference(sk->sk_filter);
+       filter = rcu_dereference_check(sk->sk_filter,
+                                      atomic_read(&sk->sk_wmem_alloc) == 0);
        if (filter) {
                sk_filter_uncharge(sk, filter);
                rcu_assign_pointer(sk->sk_filter, NULL);
index f3e9ba1cfd01479b222720359a142547786c0cca..ff16e9df196972fef0c097c3aa464438a2ad556b 100644 (file)
@@ -77,34 +77,24 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
        return err;
 }
 
-static struct kmem_cache *ccid_kmem_cache_create(int obj_size, const char *fmt,...)
+static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...)
 {
        struct kmem_cache *slab;
-       char slab_name_fmt[32], *slab_name;
        va_list args;
 
        va_start(args, fmt);
-       vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args);
+       vsnprintf(slab_name_fmt, CCID_SLAB_NAME_LENGTH, fmt, args);
        va_end(args);
 
-       slab_name = kstrdup(slab_name_fmt, GFP_KERNEL);
-       if (slab_name == NULL)
-               return NULL;
-       slab = kmem_cache_create(slab_name, sizeof(struct ccid) + obj_size, 0,
+       slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0,
                                 SLAB_HWCACHE_ALIGN, NULL);
-       if (slab == NULL)
-               kfree(slab_name);
        return slab;
 }
 
 static void ccid_kmem_cache_destroy(struct kmem_cache *slab)
 {
-       if (slab != NULL) {
-               const char *name = kmem_cache_name(slab);
-
+       if (slab != NULL)
                kmem_cache_destroy(slab);
-               kfree(name);
-       }
 }
 
 static int ccid_activate(struct ccid_operations *ccid_ops)
@@ -113,6 +103,7 @@ static int ccid_activate(struct ccid_operations *ccid_ops)
 
        ccid_ops->ccid_hc_rx_slab =
                        ccid_kmem_cache_create(ccid_ops->ccid_hc_rx_obj_size,
+                                              ccid_ops->ccid_hc_rx_slab_name,
                                               "ccid%u_hc_rx_sock",
                                               ccid_ops->ccid_id);
        if (ccid_ops->ccid_hc_rx_slab == NULL)
@@ -120,6 +111,7 @@ static int ccid_activate(struct ccid_operations *ccid_ops)
 
        ccid_ops->ccid_hc_tx_slab =
                        ccid_kmem_cache_create(ccid_ops->ccid_hc_tx_obj_size,
+                                              ccid_ops->ccid_hc_tx_slab_name,
                                               "ccid%u_hc_tx_sock",
                                               ccid_ops->ccid_id);
        if (ccid_ops->ccid_hc_tx_slab == NULL)
index facedd20b531a0ce42fb03f5afccef290f11f7bc..6df6f8ac963664e2174b55c890ce7f45cbe05128 100644 (file)
@@ -19,7 +19,9 @@
 #include <linux/list.h>
 #include <linux/module.h>
 
-#define CCID_MAX 255
+/* maximum value for a CCID (RFC 4340, 19.5) */
+#define CCID_MAX               255
+#define CCID_SLAB_NAME_LENGTH  32
 
 struct tcp_info;
 
@@ -49,6 +51,8 @@ struct ccid_operations {
        const char              *ccid_name;
        struct kmem_cache       *ccid_hc_rx_slab,
                                *ccid_hc_tx_slab;
+       char                    ccid_hc_rx_slab_name[CCID_SLAB_NAME_LENGTH];
+       char                    ccid_hc_tx_slab_name[CCID_SLAB_NAME_LENGTH];
        __u32                   ccid_hc_rx_obj_size,
                                ccid_hc_tx_obj_size;
        /* Interface Routines */
index a1362dc8abb0778716c296f767c8d4714225bc32..f5b3464f124292ef26dcbaf7562355e7ab5d5a63 100644 (file)
@@ -161,7 +161,8 @@ static __init int dccpprobe_init(void)
        if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
                goto err0;
 
-       ret = register_jprobe(&dccp_send_probe);
+       try_then_request_module((ret = register_jprobe(&dccp_send_probe)) == 0,
+                               "dccp");
        if (ret)
                goto err1;
 
index a03284061a3191e0019e6a32cd4c340019853c16..a7bf03ca0a36a7566c3e3c8c934f819131b34ea0 100644 (file)
@@ -1155,8 +1155,8 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
 
        if (!(flags & MSG_TRYHARD)) {
                rcu_read_lock_bh();
-               for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
-                       rt = rcu_dereference(rt->u.dst.dn_next)) {
+               for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt;
+                       rt = rcu_dereference_bh(rt->u.dst.dn_next)) {
                        if ((flp->fld_dst == rt->fl.fld_dst) &&
                            (flp->fld_src == rt->fl.fld_src) &&
                            (flp->mark == rt->fl.mark) &&
@@ -1618,9 +1618,9 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
                if (h > s_h)
                        s_idx = 0;
                rcu_read_lock_bh();
-               for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
+               for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0;
                        rt;
-                       rt = rcu_dereference(rt->u.dst.dn_next), idx++) {
+                       rt = rcu_dereference_bh(rt->u.dst.dn_next), idx++) {
                        if (idx < s_idx)
                                continue;
                        skb_dst_set(skb, dst_clone(&rt->u.dst));
@@ -1654,12 +1654,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
 
        for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) {
                rcu_read_lock_bh();
-               rt = dn_rt_hash_table[s->bucket].chain;
+               rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain);
                if (rt)
                        break;
                rcu_read_unlock_bh();
        }
-       return rcu_dereference(rt);
+       return rt;
 }
 
 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
@@ -1674,7 +1674,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
                rcu_read_lock_bh();
                rt = dn_rt_hash_table[s->bucket].chain;
        }
-       return rcu_dereference(rt);
+       return rcu_dereference_bh(rt);
 }
 
 static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
index 040c4f05b65321b6b2c6023bb0eba66eecb7c26a..26dec2be96152aa88b3b8893f1fe175a9eb8a418 100644 (file)
@@ -1317,14 +1317,19 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
 {
        int *valp = ctl->data;
        int val = *valp;
+       loff_t pos = *ppos;
        int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
 
        if (write && *valp != val) {
                struct net *net = ctl->extra2;
 
                if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) {
-                       if (!rtnl_trylock())
+                       if (!rtnl_trylock()) {
+                               /* Restore the original values before restarting */
+                               *valp = val;
+                               *ppos = pos;
                                return restart_syscall();
+                       }
                        if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) {
                                inet_forward_change(net);
                        } else if (*valp) {
index 76c08402c933941ea475045545ff3206cc0cadb8..a42f658e756aef0428cec2602a9295a9f6855a19 100644 (file)
@@ -946,7 +946,6 @@ int igmp_rcv(struct sk_buff *skb)
                break;
        case IGMP_HOST_MEMBERSHIP_REPORT:
        case IGMPV2_HOST_MEMBERSHIP_REPORT:
-       case IGMPV3_HOST_MEMBERSHIP_REPORT:
                /* Is it our report looped back? */
                if (skb_rtable(skb)->fl.iif == 0)
                        break;
@@ -960,6 +959,7 @@ int igmp_rcv(struct sk_buff *skb)
                in_dev_put(in_dev);
                return pim_rcv_v1(skb);
 #endif
+       case IGMPV3_HOST_MEMBERSHIP_REPORT:
        case IGMP_DVMRP:
        case IGMP_TRACE:
        case IGMP_HOST_LEAVE_MESSAGE:
index bdb78dd180cec71a1005df9f51794f8ba26154e6..1aaa8110d84be07d51d0bff955056e33db34e001 100644 (file)
@@ -368,7 +368,7 @@ static int inet_diag_bc_run(const void *bc, int len,
                        yes = entry->sport >= op[1].no;
                        break;
                case INET_DIAG_BC_S_LE:
-                       yes = entry->dport <= op[1].no;
+                       yes = entry->sport <= op[1].no;
                        break;
                case INET_DIAG_BC_D_GE:
                        yes = entry->dport >= op[1].no;
index 38fbf04150ae7ec60ccafa1a4bd740995fb13427..544ce0876f12dcd78cfcf0d777e1b78bab5b4acf 100644 (file)
@@ -124,16 +124,12 @@ static int ipcomp4_init_state(struct xfrm_state *x)
        if (x->props.mode == XFRM_MODE_TUNNEL) {
                err = ipcomp_tunnel_attach(x);
                if (err)
-                       goto error_tunnel;
+                       goto out;
        }
 
        err = 0;
 out:
        return err;
-
-error_tunnel:
-       ipcomp_destroy(x);
-       goto out;
 }
 
 static const struct xfrm_type ipcomp_type = {
index 06632762ba5f9150818040c19c7cb210e0edede5..90203e1b9187eac858d566cbfcd8bde09e604ab5 100644 (file)
@@ -925,10 +925,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
        if (t && !IS_ERR(t)) {
                struct arpt_getinfo info;
                const struct xt_table_info *private = t->private;
-
 #ifdef CONFIG_COMPAT
+               struct xt_table_info tmp;
+
                if (compat) {
-                       struct xt_table_info tmp;
                        ret = compat_table_info(private, &tmp);
                        xt_compat_flush_offsets(NFPROTO_ARP);
                        private = &tmp;
index 572330a552ef4e7f73f51f1ef23667baf28b645e..3ce53cf13d5a71d5068e96e593f0e65a3d5033f8 100644 (file)
@@ -1132,10 +1132,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
        if (t && !IS_ERR(t)) {
                struct ipt_getinfo info;
                const struct xt_table_info *private = t->private;
-
 #ifdef CONFIG_COMPAT
+               struct xt_table_info tmp;
+
                if (compat) {
-                       struct xt_table_info tmp;
                        ret = compat_table_info(private, &tmp);
                        xt_compat_flush_offsets(AF_INET);
                        private = &tmp;
index d171b123a656dd9aba7d8e7d52d7f43c92a410e7..d1ea38a7c490befaaf23456ea8b774aa6ada6fd9 100644 (file)
@@ -210,7 +210,7 @@ static ctl_table ip_ct_sysctl_table[] = {
        },
        {
                .procname       = "ip_conntrack_buckets",
-               .data           = &nf_conntrack_htable_size,
+               .data           = &init_net.ct.htable_size,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0444,
                .proc_handler   = proc_dointvec,
index 8668a3defda6bd212170ff0b26b400bb60274f9d..2fb7b76da94fafed76c19f9a0fe8396ae5bbf321 100644 (file)
@@ -32,7 +32,7 @@ static struct hlist_nulls_node *ct_get_first(struct seq_file *seq)
        struct hlist_nulls_node *n;
 
        for (st->bucket = 0;
-            st->bucket < nf_conntrack_htable_size;
+            st->bucket < net->ct.htable_size;
             st->bucket++) {
                n = rcu_dereference(net->ct.hash[st->bucket].first);
                if (!is_a_nulls(n))
@@ -50,7 +50,7 @@ static struct hlist_nulls_node *ct_get_next(struct seq_file *seq,
        head = rcu_dereference(head->next);
        while (is_a_nulls(head)) {
                if (likely(get_nulls_value(head) == st->bucket)) {
-                       if (++st->bucket >= nf_conntrack_htable_size)
+                       if (++st->bucket >= net->ct.htable_size)
                                return NULL;
                }
                head = rcu_dereference(net->ct.hash[st->bucket].first);
index fe1a64479dd088de80cd51226db941609bfff658..26066a2327ad3dadba650ff0a8524a9069441f24 100644 (file)
@@ -35,9 +35,6 @@ static DEFINE_SPINLOCK(nf_nat_lock);
 
 static struct nf_conntrack_l3proto *l3proto __read_mostly;
 
-/* Calculated at init based on memory size */
-static unsigned int nf_nat_htable_size __read_mostly;
-
 #define MAX_IP_NAT_PROTO 256
 static const struct nf_nat_protocol *nf_nat_protos[MAX_IP_NAT_PROTO]
                                                __read_mostly;
@@ -72,7 +69,7 @@ EXPORT_SYMBOL_GPL(nf_nat_proto_put);
 
 /* We keep an extra hash for each conntrack, for fast searching. */
 static inline unsigned int
-hash_by_src(const struct nf_conntrack_tuple *tuple)
+hash_by_src(const struct net *net, const struct nf_conntrack_tuple *tuple)
 {
        unsigned int hash;
 
@@ -80,7 +77,7 @@ hash_by_src(const struct nf_conntrack_tuple *tuple)
        hash = jhash_3words((__force u32)tuple->src.u3.ip,
                            (__force u32)tuple->src.u.all,
                            tuple->dst.protonum, 0);
-       return ((u64)hash * nf_nat_htable_size) >> 32;
+       return ((u64)hash * net->ipv4.nat_htable_size) >> 32;
 }
 
 /* Is this tuple already taken? (not by us) */
@@ -147,7 +144,7 @@ find_appropriate_src(struct net *net,
                     struct nf_conntrack_tuple *result,
                     const struct nf_nat_range *range)
 {
-       unsigned int h = hash_by_src(tuple);
+       unsigned int h = hash_by_src(net, tuple);
        const struct nf_conn_nat *nat;
        const struct nf_conn *ct;
        const struct hlist_node *n;
@@ -330,7 +327,7 @@ nf_nat_setup_info(struct nf_conn *ct,
        if (have_to_hash) {
                unsigned int srchash;
 
-               srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
+               srchash = hash_by_src(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
                spin_lock_bh(&nf_nat_lock);
                /* nf_conntrack_alter_reply might re-allocate exntension aera */
                nat = nfct_nat(ct);
@@ -679,8 +676,10 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,
 
 static int __net_init nf_nat_net_init(struct net *net)
 {
-       net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size,
-                                                     &net->ipv4.nat_vmalloced, 0);
+       /* Leave them the same for the moment. */
+       net->ipv4.nat_htable_size = net->ct.htable_size;
+       net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&net->ipv4.nat_htable_size,
+                                                      &net->ipv4.nat_vmalloced, 0);
        if (!net->ipv4.nat_bysource)
                return -ENOMEM;
        return 0;
@@ -703,7 +702,7 @@ static void __net_exit nf_nat_net_exit(struct net *net)
        nf_ct_iterate_cleanup(net, &clean_nat, NULL);
        synchronize_rcu();
        nf_ct_free_hashtable(net->ipv4.nat_bysource, net->ipv4.nat_vmalloced,
-                            nf_nat_htable_size);
+                            net->ipv4.nat_htable_size);
 }
 
 static struct pernet_operations nf_nat_net_ops = {
@@ -724,9 +723,6 @@ static int __init nf_nat_init(void)
                return ret;
        }
 
-       /* Leave them the same for the moment. */
-       nf_nat_htable_size = nf_conntrack_htable_size;
-
        ret = register_pernet_subsys(&nf_nat_net_ops);
        if (ret < 0)
                goto cleanup_extend;
index e446496f564fef91a2e6b03fd5b00ab872ef40c0..4f11faa5c82496294a7be672c64ab3ecf433a227 100644 (file)
@@ -287,12 +287,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
                if (!rt_hash_table[st->bucket].chain)
                        continue;
                rcu_read_lock_bh();
-               r = rcu_dereference(rt_hash_table[st->bucket].chain);
+               r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
                while (r) {
                        if (dev_net(r->u.dst.dev) == seq_file_net(seq) &&
                            r->rt_genid == st->genid)
                                return r;
-                       r = rcu_dereference(r->u.dst.rt_next);
+                       r = rcu_dereference_bh(r->u.dst.rt_next);
                }
                rcu_read_unlock_bh();
        }
@@ -314,7 +314,7 @@ static struct rtable *__rt_cache_get_next(struct seq_file *seq,
                rcu_read_lock_bh();
                r = rt_hash_table[st->bucket].chain;
        }
-       return rcu_dereference(r);
+       return rcu_dereference_bh(r);
 }
 
 static struct rtable *rt_cache_get_next(struct seq_file *seq,
@@ -586,7 +586,9 @@ static void __net_exit ip_rt_do_proc_exit(struct net *net)
 {
        remove_proc_entry("rt_cache", net->proc_net_stat);
        remove_proc_entry("rt_cache", net->proc_net);
+#ifdef CONFIG_NET_CLS_ROUTE
        remove_proc_entry("rt_acct", net->proc_net);
+#endif
 }
 
 static struct pernet_operations ip_rt_proc_ops __net_initdata =  {
@@ -2687,8 +2689,8 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
        hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net));
 
        rcu_read_lock_bh();
-       for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
-               rth = rcu_dereference(rth->u.dst.rt_next)) {
+       for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
+               rth = rcu_dereference_bh(rth->u.dst.rt_next)) {
                if (rth->fl.fl4_dst == flp->fl4_dst &&
                    rth->fl.fl4_src == flp->fl4_src &&
                    rth->fl.iif == 0 &&
@@ -3006,8 +3008,8 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
                if (!rt_hash_table[h].chain)
                        continue;
                rcu_read_lock_bh();
-               for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
-                    rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
+               for (rt = rcu_dereference_bh(rt_hash_table[h].chain), idx = 0; rt;
+                    rt = rcu_dereference_bh(rt->u.dst.rt_next), idx++) {
                        if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx)
                                continue;
                        if (rt_is_expired(rt))
index 28e029632493629ca409b02d094c18de56279eaf..3fddc69ccccc5a10032c2b50aff50ebd38a8c137 100644 (file)
@@ -5783,11 +5783,9 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 
                                /* tcp_ack considers this ACK as duplicate
                                 * and does not calculate rtt.
-                                * Fix it at least with timestamps.
+                                * Force it here.
                                 */
-                               if (tp->rx_opt.saw_tstamp &&
-                                   tp->rx_opt.rcv_tsecr && !tp->srtt)
-                                       tcp_ack_saw_tstamp(sk, 0);
+                               tcp_ack_update_rtt(sk, 0, 0);
 
                                if (tp->rx_opt.tstamp_ok)
                                        tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
index bb110c5ce1d2cd5229411ff59a755d01ccd8518b..9bc805df95d2374369e7dd3d2f1f526f581996f5 100644 (file)
@@ -39,9 +39,9 @@ static int port __read_mostly = 0;
 MODULE_PARM_DESC(port, "Port to match (0=all)");
 module_param(port, int, 0);
 
-static int bufsize __read_mostly = 4096;
+static unsigned int bufsize __read_mostly = 4096;
 MODULE_PARM_DESC(bufsize, "Log buffer size in packets (4096)");
-module_param(bufsize, int, 0);
+module_param(bufsize, uint, 0);
 
 static int full __read_mostly;
 MODULE_PARM_DESC(full, "Full log (1=every ack packet received,  0=only cwnd changes)");
@@ -75,12 +75,12 @@ static struct {
 
 static inline int tcp_probe_used(void)
 {
-       return (tcp_probe.head - tcp_probe.tail) % bufsize;
+       return (tcp_probe.head - tcp_probe.tail) & (bufsize - 1);
 }
 
 static inline int tcp_probe_avail(void)
 {
-       return bufsize - tcp_probe_used();
+       return bufsize - tcp_probe_used() - 1;
 }
 
 /*
@@ -116,7 +116,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
                        p->ssthresh = tcp_current_ssthresh(sk);
                        p->srtt = tp->srtt >> 3;
 
-                       tcp_probe.head = (tcp_probe.head + 1) % bufsize;
+                       tcp_probe.head = (tcp_probe.head + 1) & (bufsize - 1);
                }
                tcp_probe.lastcwnd = tp->snd_cwnd;
                spin_unlock(&tcp_probe.lock);
@@ -149,7 +149,7 @@ static int tcpprobe_open(struct inode * inode, struct file * file)
 static int tcpprobe_sprint(char *tbuf, int n)
 {
        const struct tcp_log *p
-               = tcp_probe.log + tcp_probe.tail % bufsize;
+               = tcp_probe.log + tcp_probe.tail;
        struct timespec tv
                = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start));
 
@@ -192,7 +192,7 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf,
                width = tcpprobe_sprint(tbuf, sizeof(tbuf));
 
                if (cnt + width < len)
-                       tcp_probe.tail = (tcp_probe.tail + 1) % bufsize;
+                       tcp_probe.tail = (tcp_probe.tail + 1) & (bufsize - 1);
 
                spin_unlock_bh(&tcp_probe.lock);
 
@@ -222,9 +222,10 @@ static __init int tcpprobe_init(void)
        init_waitqueue_head(&tcp_probe.wait);
        spin_lock_init(&tcp_probe.lock);
 
-       if (bufsize < 0)
+       if (bufsize == 0)
                return -EINVAL;
 
+       bufsize = roundup_pow_of_two(bufsize);
        tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL);
        if (!tcp_probe.log)
                goto err0;
@@ -236,7 +237,7 @@ static __init int tcpprobe_init(void)
        if (ret)
                goto err1;
 
-       pr_info("TCP probe registered (port=%d)\n", port);
+       pr_info("TCP probe registered (port=%d) bufsize=%u\n", port, bufsize);
        return 0;
  err1:
        proc_net_remove(&init_net, procname);
index 8c08a28d8f832f5369d89eee7d9bfd27e363e082..67107d63c1cd5318545aebe0072459bf0869fba3 100644 (file)
@@ -15,7 +15,6 @@
 #include <net/xfrm.h>
 #include <net/ip.h>
 
-static struct dst_ops xfrm4_dst_ops;
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo;
 
 static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos,
@@ -190,8 +189,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
 
 static inline int xfrm4_garbage_collect(struct dst_ops *ops)
 {
-       xfrm4_policy_afinfo.garbage_collect(&init_net);
-       return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2);
+       struct net *net = container_of(ops, struct net, xfrm.xfrm4_dst_ops);
+
+       xfrm4_policy_afinfo.garbage_collect(net);
+       return (atomic_read(&ops->entries) > ops->gc_thresh * 2);
 }
 
 static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -268,7 +269,7 @@ static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
 static struct ctl_table xfrm4_policy_table[] = {
        {
                .procname       = "xfrm4_gc_thresh",
-               .data           = &xfrm4_dst_ops.gc_thresh,
+               .data           = &init_net.xfrm.xfrm4_dst_ops.gc_thresh,
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
@@ -295,8 +296,6 @@ static void __exit xfrm4_policy_fini(void)
 
 void __init xfrm4_init(int rt_max_size)
 {
-       xfrm4_state_init();
-       xfrm4_policy_init();
        /*
         * Select a default value for the gc_thresh based on the main route
         * table hash size.  It seems to me the worst case scenario is when
@@ -308,6 +307,9 @@ void __init xfrm4_init(int rt_max_size)
         * and start cleaning when were 1/2 full
         */
        xfrm4_dst_ops.gc_thresh = rt_max_size/2;
+
+       xfrm4_state_init();
+       xfrm4_policy_init();
 #ifdef CONFIG_SYSCTL
        sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path,
                                                xfrm4_policy_table);
index de7a194a64ab4fa0cf864d1fe3f83a3974e3b727..143791da062c5118656f826033bb673435ab09f2 100644 (file)
@@ -502,8 +502,11 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
        if (p == &net->ipv6.devconf_dflt->forwarding)
                return 0;
 
-       if (!rtnl_trylock())
+       if (!rtnl_trylock()) {
+               /* Restore the original values before restarting */
+               *p = old;
                return restart_syscall();
+       }
 
        if (p == &net->ipv6.devconf_all->forwarding) {
                __s32 newf = net->ipv6.devconf_all->forwarding;
@@ -4028,12 +4031,15 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write,
 {
        int *valp = ctl->data;
        int val = *valp;
+       loff_t pos = *ppos;
        int ret;
 
        ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
 
        if (write)
                ret = addrconf_fixup_forwarding(ctl, valp, val);
+       if (ret)
+               *ppos = pos;
        return ret;
 }
 
@@ -4075,8 +4081,11 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int old)
        if (p == &net->ipv6.devconf_dflt->disable_ipv6)
                return 0;
 
-       if (!rtnl_trylock())
+       if (!rtnl_trylock()) {
+               /* Restore the original values before restarting */
+               *p = old;
                return restart_syscall();
+       }
 
        if (p == &net->ipv6.devconf_all->disable_ipv6) {
                __s32 newf = net->ipv6.devconf_all->disable_ipv6;
@@ -4095,12 +4104,15 @@ int addrconf_sysctl_disable(ctl_table *ctl, int write,
 {
        int *valp = ctl->data;
        int val = *valp;
+       loff_t pos = *ppos;
        int ret;
 
        ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
 
        if (write)
                ret = addrconf_disable_ipv6(ctl, valp, val);
+       if (ret)
+               *ppos = pos;
        return ret;
 }
 
index df159fffe4bca2c373bb1d78bf03959244019bd2..4bac362b1335631df954b296023f7bb4befd9f14 100644 (file)
@@ -559,6 +559,11 @@ static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
        return skb_dst(skb) ? ip6_dst_idev(skb_dst(skb)) : __in6_dev_get(skb->dev);
 }
 
+static inline struct net *ipv6_skb_net(struct sk_buff *skb)
+{
+       return skb_dst(skb) ? dev_net(skb_dst(skb)->dev) : dev_net(skb->dev);
+}
+
 /* Router Alert as of RFC 2711 */
 
 static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
@@ -580,8 +585,8 @@ static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
 static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
 {
        const unsigned char *nh = skb_network_header(skb);
+       struct net *net = ipv6_skb_net(skb);
        u32 pkt_len;
-       struct net *net = dev_net(skb_dst(skb)->dev);
 
        if (nh[optoff + 1] != 4 || (optoff & 3) != 2) {
                LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
index 2f2a5ca2c8786599560f7328d64401f837ab5e38..002e6eef91204ea9f21e49a36660fc0e3952fd81 100644 (file)
@@ -154,16 +154,12 @@ static int ipcomp6_init_state(struct xfrm_state *x)
        if (x->props.mode == XFRM_MODE_TUNNEL) {
                err = ipcomp6_tunnel_attach(x);
                if (err)
-                       goto error_tunnel;
+                       goto out;
        }
 
        err = 0;
 out:
        return err;
-error_tunnel:
-       ipcomp_destroy(x);
-
-       goto out;
 }
 
 static const struct xfrm_type ipcomp6_type =
index 480d7f8c9802083660c19ca20d225254b40b3b18..8a7e0f52e17792ff994dd3b7d02d0f9c0654c6d9 100644 (file)
@@ -1164,10 +1164,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
        if (t && !IS_ERR(t)) {
                struct ip6t_getinfo info;
                const struct xt_table_info *private = t->private;
-
 #ifdef CONFIG_COMPAT
+               struct xt_table_info tmp;
+
                if (compat) {
-                       struct xt_table_info tmp;
                        ret = compat_table_info(private, &tmp);
                        xt_compat_flush_offsets(AF_INET6);
                        private = &tmp;
index 312c20adc83f4fe93469010c511acf6b82aa42d2..624a54832a7caa13a5f7fabf9e373e256772db53 100644 (file)
@@ -63,6 +63,7 @@ struct nf_ct_frag6_queue
        struct inet_frag_queue  q;
 
        __be32                  id;             /* fragment id          */
+       u32                     user;
        struct in6_addr         saddr;
        struct in6_addr         daddr;
 
index 7254e3f899a733e09ad878497a9b75fba9e23d26..dbdc696f5fc5b5fbc207b48135fa768028f7e7f4 100644 (file)
@@ -24,7 +24,6 @@
 #include <net/mip6.h>
 #endif
 
-static struct dst_ops xfrm6_dst_ops;
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
 
 static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
@@ -224,8 +223,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
 
 static inline int xfrm6_garbage_collect(struct dst_ops *ops)
 {
-       xfrm6_policy_afinfo.garbage_collect(&init_net);
-       return (atomic_read(&xfrm6_dst_ops.entries) > xfrm6_dst_ops.gc_thresh*2);
+       struct net *net = container_of(ops, struct net, xfrm.xfrm6_dst_ops);
+
+       xfrm6_policy_afinfo.garbage_collect(net);
+       return (atomic_read(&ops->entries) > ops->gc_thresh * 2);
 }
 
 static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -310,7 +311,7 @@ static void xfrm6_policy_fini(void)
 static struct ctl_table xfrm6_policy_table[] = {
        {
                .procname       = "xfrm6_gc_thresh",
-               .data           = &xfrm6_dst_ops.gc_thresh,
+               .data           = &init_net.xfrm.xfrm6_dst_ops.gc_thresh,
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
@@ -326,13 +327,6 @@ int __init xfrm6_init(void)
        int ret;
        unsigned int gc_thresh;
 
-       ret = xfrm6_policy_init();
-       if (ret)
-               goto out;
-
-       ret = xfrm6_state_init();
-       if (ret)
-               goto out_policy;
        /*
         * We need a good default value for the xfrm6 gc threshold.
         * In ipv4 we set it to the route hash table size * 8, which
@@ -346,6 +340,15 @@ int __init xfrm6_init(void)
         */
        gc_thresh = FIB6_TABLE_HASHSZ * 8;
        xfrm6_dst_ops.gc_thresh = (gc_thresh < 1024) ? 1024 : gc_thresh;
+
+       ret = xfrm6_policy_init();
+       if (ret)
+               goto out;
+
+       ret = xfrm6_state_init();
+       if (ret)
+               goto out_policy;
+
 #ifdef CONFIG_SYSCTL
        sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv6_ctl_path,
                                                xfrm6_policy_table);
index 156020d138b507685633feda14fa747d11c90538..6b3602de359ae556761ec10effa42151c0a92817 100644 (file)
@@ -698,15 +698,18 @@ dev_irnet_ioctl(
 
       /* Query PPP channel and unit number */
     case PPPIOCGCHAN:
+      lock_kernel();
       if(ap->ppp_open && !put_user(ppp_channel_index(&ap->chan),
                                                (int __user *)argp))
        err = 0;
+      unlock_kernel();
       break;
     case PPPIOCGUNIT:
       lock_kernel();
       if(ap->ppp_open && !put_user(ppp_unit_number(&ap->chan),
                                                (int __user *)argp))
-      err = 0;
+        err = 0;
+      unlock_kernel();
       break;
 
       /* All these ioctls can be passed both directly and from ppp_generic,
index 76fa6fef64739c3fb881dafc92947a5e5c1c054c..539f43bc97db79955925b4b6e6442df64548fffc 100644 (file)
@@ -3794,9 +3794,9 @@ static struct pernet_operations pfkey_net_ops = {
 
 static void __exit ipsec_pfkey_exit(void)
 {
-       unregister_pernet_subsys(&pfkey_net_ops);
        xfrm_unregister_km(&pfkeyv2_mgr);
        sock_unregister(PF_KEY);
+       unregister_pernet_subsys(&pfkey_net_ops);
        proto_unregister(&key_proto);
 }
 
@@ -3807,21 +3807,22 @@ static int __init ipsec_pfkey_init(void)
        if (err != 0)
                goto out;
 
-       err = sock_register(&pfkey_family_ops);
+       err = register_pernet_subsys(&pfkey_net_ops);
        if (err != 0)
                goto out_unregister_key_proto;
+       err = sock_register(&pfkey_family_ops);
+       if (err != 0)
+               goto out_unregister_pernet;
        err = xfrm_register_km(&pfkeyv2_mgr);
        if (err != 0)
                goto out_sock_unregister;
-       err = register_pernet_subsys(&pfkey_net_ops);
-       if (err != 0)
-               goto out_xfrm_unregister_km;
 out:
        return err;
-out_xfrm_unregister_km:
-       xfrm_unregister_km(&pfkeyv2_mgr);
+
 out_sock_unregister:
        sock_unregister(PF_KEY);
+out_unregister_pernet:
+       unregister_pernet_subsys(&pfkey_net_ops);
 out_unregister_key_proto:
        proto_unregister(&key_proto);
        goto out;
index 6dc3579c0ac5444a0d8811504aefd6c620c9d1f1..9ae1a4760b58b76ffa991031329b10e23cb51778 100644 (file)
@@ -1331,6 +1331,9 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
        struct ieee80211_conf *conf = &local->hw.conf;
 
+       if (sdata->vif.type != NL80211_IFTYPE_STATION)
+               return -EOPNOTSUPP;
+
        if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
                return -EOPNOTSUPP;
 
index ee94ea0c67e9f164c71d359b9c4dbb3812d25541..da8497ef7063944a191653b1145a6b6a74627139 100644 (file)
@@ -680,7 +680,7 @@ TRACE_EVENT(drv_ampdu_action,
                __entry->ret = ret;
                __entry->action = action;
                __entry->tid = tid;
-               __entry->ssn = *ssn;
+               __entry->ssn = ssn ? *ssn : 0;
        ),
 
        TP_printk(
index 1f2db647bb5ccd3526d8fc40ef3e6aeb3cb68da6..22f0c2aa7a89b393437e8bacc5dd15cf3eee1c6d 100644 (file)
@@ -647,7 +647,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
        }
        if (pos[1] != 0 &&
            (pos[1] != ifibss->ssid_len ||
-            !memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) {
+            memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) {
                /* Ignore ProbeReq for foreign SSID */
                return;
        }
index 80c16f6e2af67e2798da4c417d69ce94dae86b71..32abae3ce32a52a4b126a8a26368b327d0771a21 100644 (file)
 #include <linux/netdevice.h>
 #include <linux/rtnetlink.h>
 #include <net/mac80211.h>
+#include <net/ieee80211_radiotap.h>
 #include "ieee80211_i.h"
 #include "sta_info.h"
 #include "debugfs_netdev.h"
 #include "mesh.h"
 #include "led.h"
 #include "driver-ops.h"
+#include "wme.h"
 
 /**
  * DOC: Interface list locking
@@ -314,7 +316,7 @@ static int ieee80211_open(struct net_device *dev)
        if (sdata->vif.type == NL80211_IFTYPE_STATION)
                ieee80211_queue_work(&local->hw, &sdata->u.mgd.work);
 
-       netif_start_queue(dev);
+       netif_tx_start_all_queues(dev);
 
        return 0;
  err_del_interface:
@@ -343,7 +345,7 @@ static int ieee80211_stop(struct net_device *dev)
        /*
         * Stop TX on this interface first.
         */
-       netif_stop_queue(dev);
+       netif_tx_stop_all_queues(dev);
 
        /*
         * Now delete all active aggregation sessions.
@@ -644,6 +646,12 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
        WARN_ON(flushed);
 }
 
+static u16 ieee80211_netdev_select_queue(struct net_device *dev,
+                                        struct sk_buff *skb)
+{
+       return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
+}
+
 static const struct net_device_ops ieee80211_dataif_ops = {
        .ndo_open               = ieee80211_open,
        .ndo_stop               = ieee80211_stop,
@@ -652,8 +660,38 @@ static const struct net_device_ops ieee80211_dataif_ops = {
        .ndo_set_multicast_list = ieee80211_set_multicast_list,
        .ndo_change_mtu         = ieee80211_change_mtu,
        .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_select_queue       = ieee80211_netdev_select_queue,
 };
 
+static u16 ieee80211_monitor_select_queue(struct net_device *dev,
+                                         struct sk_buff *skb)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_hdr *hdr;
+       struct ieee80211_radiotap_header *rtap = (void *)skb->data;
+       u8 *p;
+
+       if (local->hw.queues < 4)
+               return 0;
+
+       if (skb->len < 4 ||
+           skb->len < le16_to_cpu(rtap->it_len) + 2 /* frame control */)
+               return 0; /* doesn't matter, frame will be dropped */
+
+       hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len));
+
+       if (!ieee80211_is_data_qos(hdr->frame_control)) {
+               skb->priority = 7;
+               return ieee802_1d_to_ac[skb->priority];
+       }
+
+       p = ieee80211_get_qos_ctl(hdr);
+       skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
+
+       return ieee80211_downgrade_queue(local, skb);
+}
+
 static const struct net_device_ops ieee80211_monitorif_ops = {
        .ndo_open               = ieee80211_open,
        .ndo_stop               = ieee80211_stop,
@@ -662,6 +700,7 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
        .ndo_set_multicast_list = ieee80211_set_multicast_list,
        .ndo_change_mtu         = ieee80211_change_mtu,
        .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_select_queue       = ieee80211_monitor_select_queue,
 };
 
 static void ieee80211_if_setup(struct net_device *dev)
@@ -768,8 +807,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
        ASSERT_RTNL();
 
-       ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size,
-                           name, ieee80211_if_setup);
+       ndev = alloc_netdev_mq(sizeof(*sdata) + local->hw.vif_data_size,
+                              name, ieee80211_if_setup, local->hw.queues);
        if (!ndev)
                return -ENOMEM;
        dev_net_set(ndev, wiphy_net(local->hw.wiphy));
index c79e59f82fd9933bd98024d4d9b8551244c1f4a6..05a18f43e1bf73fd34f029b1e35aa0a0193f7162 100644 (file)
@@ -942,7 +942,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        ieee80211_recalc_ps(local, -1);
        mutex_unlock(&local->iflist_mtx);
 
-       netif_start_queue(sdata->dev);
+       netif_tx_start_all_queues(sdata->dev);
        netif_carrier_on(sdata->dev);
 }
 
@@ -1074,7 +1074,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
         * time -- we don't want the scan code to enable queues.
         */
 
-       netif_stop_queue(sdata->dev);
+       netif_tx_stop_all_queues(sdata->dev);
        netif_carrier_off(sdata->dev);
 
        rcu_read_lock();
@@ -1963,7 +1963,9 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
                        rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len);
                        break;
                case IEEE80211_STYPE_ACTION:
-                       /* XXX: differentiate, can only happen for CSA now! */
+                       if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT)
+                               break;
+
                        ieee80211_sta_process_chanswitch(sdata,
                                        &mgmt->u.action.u.chan_switch.sw_elem,
                                        ifmgd->associated);
index b9007f80cb9231bb99bb9a726d3e286ccabfb8ff..12a2bff7dcdbc1959b2cb0792d4f0508f63a2fdc 100644 (file)
@@ -245,6 +245,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
                info->control.rates[i].count = 1;
        }
 
+       if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
+               return;
+
        if (sta && sdata->force_unicast_rateidx > -1) {
                info->control.rates[0].idx = sdata->force_unicast_rateidx;
        } else {
index 699d3ed869c4114a95f7a29f8adbea036d2c61a3..29bc4c516238ed9cfafbd5c7416c0bdc13d528fd 100644 (file)
@@ -190,7 +190,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
        rate_control_pid_normalize(pinfo, sband->n_bitrates);
 
        /* Compute the proportional, integral and derivative errors. */
-       err_prop = (pinfo->target << RC_PID_ARITH_SHIFT) - pf;
+       err_prop = (pinfo->target - pf) << RC_PID_ARITH_SHIFT;
 
        err_avg = spinfo->err_avg_sc >> pinfo->smoothing_shift;
        spinfo->err_avg_sc = spinfo->err_avg_sc - err_avg + err_prop;
index 9f2807aeaf52d6a7c3ed00134051bf050c2ec5fe..82a30c1bf3abf6c2874b9aff0088bf250e4a8f64 100644 (file)
@@ -1746,7 +1746,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
                        memset(info, 0, sizeof(*info));
                        info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
                        info->control.vif = &rx->sdata->vif;
-                       ieee80211_select_queue(local, fwd_skb);
+                       skb_set_queue_mapping(skb,
+                               ieee80211_select_queue(rx->sdata, fwd_skb));
+                       ieee80211_set_qos_hdr(local, skb);
                        if (is_multicast_ether_addr(fwd_hdr->addr1))
                                IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
                                                                fwded_mcast);
@@ -2013,6 +2015,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                }
                break;
        default:
+               /* do not process rejected action frames */
+               if (mgmt->u.action.category & 0x80)
+                       return RX_DROP_MONITOR;
+
                return RX_CONTINUE;
        }
 
index f1a4c7160300a93e8aad02b45a00f3657577574e..bc17cf7d68dba0b124304c5d9fced8f271e24edc 100644 (file)
@@ -353,10 +353,10 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
                if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                        if (sdata->u.mgd.associated) {
                                ieee80211_scan_ps_disable(sdata);
-                               netif_wake_queue(sdata->dev);
+                               netif_tx_wake_all_queues(sdata->dev);
                        }
                } else
-                       netif_wake_queue(sdata->dev);
+                       netif_tx_wake_all_queues(sdata->dev);
 
                /* re-enable beaconing */
                if (sdata->vif.type == NL80211_IFTYPE_AP ||
@@ -411,7 +411,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
                 * are handled in the scan state machine
                 */
                if (sdata->vif.type != NL80211_IFTYPE_STATION)
-                       netif_stop_queue(sdata->dev);
+                       netif_tx_stop_all_queues(sdata->dev);
        }
        mutex_unlock(&local->iflist_mtx);
 
@@ -439,6 +439,16 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
        if (local->scan_req)
                return -EBUSY;
 
+       if (req != local->int_scan_req &&
+           sdata->vif.type == NL80211_IFTYPE_STATION &&
+           !list_empty(&ifmgd->work_list)) {
+               /* actually wait for the work it's doing to finish/time out */
+               set_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request);
+               local->scan_req = req;
+               local->scan_sdata = sdata;
+               return 0;
+       }
+
        if (local->ops->hw_scan) {
                u8 *ies;
 
@@ -463,14 +473,6 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
        local->scan_req = req;
        local->scan_sdata = sdata;
 
-       if (req != local->int_scan_req &&
-           sdata->vif.type == NL80211_IFTYPE_STATION &&
-           !list_empty(&ifmgd->work_list)) {
-               /* actually wait for the work it's doing to finish/time out */
-               set_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request);
-               return 0;
-       }
-
        if (local->ops->hw_scan)
                __set_bit(SCAN_HW_SCANNING, &local->scanning);
        else
@@ -575,7 +577,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca
                        continue;
 
                if (sdata->vif.type == NL80211_IFTYPE_STATION) {
-                       netif_stop_queue(sdata->dev);
+                       netif_tx_stop_all_queues(sdata->dev);
                        if (sdata->u.mgd.associated)
                                ieee80211_scan_ps_enable(sdata);
                }
@@ -610,7 +612,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca
                if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                        if (sdata->u.mgd.associated)
                                ieee80211_scan_ps_disable(sdata);
-                       netif_wake_queue(sdata->dev);
+                       netif_tx_wake_all_queues(sdata->dev);
                }
        }
        mutex_unlock(&local->iflist_mtx);
index 27ceaefd7bc8d3cb71a49bf51626192e8aacd3bd..ac210b58670223bdee80d46b8a9792a2a9115d80 100644 (file)
@@ -1512,7 +1512,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
                                return;
                        }
 
-       ieee80211_select_queue(local, skb);
+       ieee80211_set_qos_hdr(local, skb);
        ieee80211_tx(sdata, skb, false);
        rcu_read_unlock();
 }
@@ -2291,6 +2291,9 @@ void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
        skb_set_network_header(skb, 0);
        skb_set_transport_header(skb, 0);
 
+       /* send all internal mgmt frames on VO */
+       skb_set_queue_mapping(skb, 0);
+
        /*
         * The other path calling ieee80211_xmit is from the tasklet,
         * and while we can handle concurrent transmissions locking
index dc76267e436ece4f322187d0170593ad5d9598d1..3848140313f50dad60759e5fd55a7923fa46f5ff 100644 (file)
@@ -269,6 +269,7 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
                                   enum queue_stop_reason reason)
 {
        struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_sub_if_data *sdata;
 
        if (WARN_ON(queue >= hw->queues))
                return;
@@ -281,6 +282,11 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
 
        if (!skb_queue_empty(&local->pending[queue]))
                tasklet_schedule(&local->tx_pending_tasklet);
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(sdata, &local->interfaces, list)
+               netif_tx_wake_queue(netdev_get_tx_queue(sdata->dev, queue));
+       rcu_read_unlock();
 }
 
 void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
@@ -305,11 +311,17 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue,
                                   enum queue_stop_reason reason)
 {
        struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_sub_if_data *sdata;
 
        if (WARN_ON(queue >= hw->queues))
                return;
 
        __set_bit(reason, &local->queue_stop_reasons[queue]);
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(sdata, &local->interfaces, list)
+               netif_tx_stop_queue(netdev_get_tx_queue(sdata->dev, queue));
+       rcu_read_unlock();
 }
 
 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
index b19b7696f3a2a7dc98445694522db8ef25c101df..79d887dae7381b841d6ca8ea25ddf9694e6ba768 100644 (file)
@@ -44,22 +44,69 @@ static int wme_downgrade_ac(struct sk_buff *skb)
 }
 
 
-/* Indicate which queue to use.  */
-static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
+/* Indicate which queue to use. */
+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
+                          struct sk_buff *skb)
 {
-       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+       struct ieee80211_local *local = sdata->local;
+       struct sta_info *sta = NULL;
+       u32 sta_flags = 0;
+       const u8 *ra = NULL;
+       bool qos = false;
 
-       if (!ieee80211_is_data(hdr->frame_control)) {
-               /* management frames go on AC_VO queue, but are sent
-               * without QoS control fields */
-               return 0;
+       if (local->hw.queues < 4 || skb->len < 6) {
+               skb->priority = 0; /* required for correct WPA/11i MIC */
+               return min_t(u16, local->hw.queues - 1,
+                            ieee802_1d_to_ac[skb->priority]);
+       }
+
+       rcu_read_lock();
+       switch (sdata->vif.type) {
+       case NL80211_IFTYPE_AP_VLAN:
+               rcu_read_lock();
+               sta = rcu_dereference(sdata->u.vlan.sta);
+               if (sta)
+                       sta_flags = get_sta_flags(sta);
+               rcu_read_unlock();
+               if (sta)
+                       break;
+       case NL80211_IFTYPE_AP:
+               ra = skb->data;
+               break;
+       case NL80211_IFTYPE_WDS:
+               ra = sdata->u.wds.remote_addr;
+               break;
+#ifdef CONFIG_MAC80211_MESH
+       case NL80211_IFTYPE_MESH_POINT:
+               /*
+                * XXX: This is clearly broken ... but already was before,
+                * because ieee80211_fill_mesh_addresses() would clear A1
+                * except for multicast addresses.
+                */
+               break;
+#endif
+       case NL80211_IFTYPE_STATION:
+               ra = sdata->u.mgd.bssid;
+               break;
+       case NL80211_IFTYPE_ADHOC:
+               ra = skb->data;
+               break;
+       default:
+               break;
        }
 
-       if (0 /* injected */) {
-               /* use AC from radiotap */
+       if (!sta && ra && !is_multicast_ether_addr(ra)) {
+               sta = sta_info_get(local, ra);
+               if (sta)
+                       sta_flags = get_sta_flags(sta);
        }
 
-       if (!ieee80211_is_data_qos(hdr->frame_control)) {
+       if (sta_flags & WLAN_STA_WME)
+               qos = true;
+
+       rcu_read_unlock();
+
+       if (!qos) {
                skb->priority = 0; /* required for correct WPA/11i MIC */
                return ieee802_1d_to_ac[skb->priority];
        }
@@ -68,6 +115,12 @@ static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
         * data frame has */
        skb->priority = cfg80211_classify8021d(skb);
 
+       return ieee80211_downgrade_queue(local, skb);
+}
+
+u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
+                             struct sk_buff *skb)
+{
        /* in case we are a client verify acm is not set for this ac */
        while (unlikely(local->wmm_acm & BIT(skb->priority))) {
                if (wme_downgrade_ac(skb)) {
@@ -85,24 +138,17 @@ static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
        return ieee802_1d_to_ac[skb->priority];
 }
 
-void ieee80211_select_queue(struct ieee80211_local *local, struct sk_buff *skb)
+void ieee80211_set_qos_hdr(struct ieee80211_local *local, struct sk_buff *skb)
 {
-       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-       u16 queue;
-       u8 tid;
-
-       queue = classify80211(local, skb);
-       if (unlikely(queue >= local->hw.queues))
-               queue = local->hw.queues - 1;
-
-       /*
-        * Now we know the 1d priority, fill in the QoS header if
-        * there is one (and we haven't done this before).
-        */
+       struct ieee80211_hdr *hdr = (void *)skb->data;
+
+       /* Fill in the QoS header if there is one. */
        if (ieee80211_is_data_qos(hdr->frame_control)) {
                u8 *p = ieee80211_get_qos_ctl(hdr);
-               u8 ack_policy = 0;
+               u8 ack_policy = 0, tid;
+
                tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
+
                if (unlikely(local->wifi_wme_noack_test))
                        ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK <<
                                        QOS_CONTROL_ACK_POLICY_SHIFT;
@@ -110,6 +156,4 @@ void ieee80211_select_queue(struct ieee80211_local *local, struct sk_buff *skb)
                *p++ = ack_policy | tid;
                *p = 0;
        }
-
-       skb_set_queue_mapping(skb, queue);
 }
index d4fd87ca51184764a3c6085496e4e4a04686d8f1..6053b1c9feee161da93c056f611a9046028da85c 100644 (file)
 
 extern const int ieee802_1d_to_ac[8];
 
-void ieee80211_select_queue(struct ieee80211_local *local,
-                           struct sk_buff *skb);
+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
+                          struct sk_buff *skb);
+void ieee80211_set_qos_hdr(struct ieee80211_local *local, struct sk_buff *skb);
+u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
+                              struct sk_buff *skb);
+
 
 #endif /* _WME_H */
index 0e98c3282d42fe546562454084469a680077847f..4d79e3c1616ce57ff2335487f2492afea9ebead2 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/netdevice.h>
 #include <linux/socket.h>
 #include <linux/mm.h>
+#include <linux/nsproxy.h>
 #include <linux/rculist_nulls.h>
 
 #include <net/netfilter/nf_conntrack.h>
@@ -63,8 +64,6 @@ EXPORT_SYMBOL_GPL(nf_conntrack_max);
 struct nf_conn nf_conntrack_untracked __read_mostly;
 EXPORT_SYMBOL_GPL(nf_conntrack_untracked);
 
-static struct kmem_cache *nf_conntrack_cachep __read_mostly;
-
 static int nf_conntrack_hash_rnd_initted;
 static unsigned int nf_conntrack_hash_rnd;
 
@@ -86,9 +85,10 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
        return ((u64)h * size) >> 32;
 }
 
-static inline u_int32_t hash_conntrack(const struct nf_conntrack_tuple *tuple)
+static inline u_int32_t hash_conntrack(const struct net *net,
+                                      const struct nf_conntrack_tuple *tuple)
 {
-       return __hash_conntrack(tuple, nf_conntrack_htable_size,
+       return __hash_conntrack(tuple, net->ct.htable_size,
                                nf_conntrack_hash_rnd);
 }
 
@@ -296,7 +296,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple)
 {
        struct nf_conntrack_tuple_hash *h;
        struct hlist_nulls_node *n;
-       unsigned int hash = hash_conntrack(tuple);
+       unsigned int hash = hash_conntrack(net, tuple);
 
        /* Disable BHs the entire time since we normally need to disable them
         * at least once for the stats anyway.
@@ -366,10 +366,11 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
 
 void nf_conntrack_hash_insert(struct nf_conn *ct)
 {
+       struct net *net = nf_ct_net(ct);
        unsigned int hash, repl_hash;
 
-       hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
-       repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
+       hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
+       repl_hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
 
        __nf_conntrack_hash_insert(ct, hash, repl_hash);
 }
@@ -397,8 +398,8 @@ __nf_conntrack_confirm(struct sk_buff *skb)
        if (CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
                return NF_ACCEPT;
 
-       hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
-       repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
+       hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
+       repl_hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
 
        /* We're not in hash table, and we refuse to set up related
           connections for unconfirmed conns.  But packet copies and
@@ -468,7 +469,7 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
        struct net *net = nf_ct_net(ignored_conntrack);
        struct nf_conntrack_tuple_hash *h;
        struct hlist_nulls_node *n;
-       unsigned int hash = hash_conntrack(tuple);
+       unsigned int hash = hash_conntrack(net, tuple);
 
        /* Disable BHs the entire time since we need to disable them at
         * least once for the stats anyway.
@@ -503,7 +504,7 @@ static noinline int early_drop(struct net *net, unsigned int hash)
        int dropped = 0;
 
        rcu_read_lock();
-       for (i = 0; i < nf_conntrack_htable_size; i++) {
+       for (i = 0; i < net->ct.htable_size; i++) {
                hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[hash],
                                         hnnode) {
                        tmp = nf_ct_tuplehash_to_ctrack(h);
@@ -523,7 +524,7 @@ static noinline int early_drop(struct net *net, unsigned int hash)
                if (cnt >= NF_CT_EVICTION_RANGE)
                        break;
 
-               hash = (hash + 1) % nf_conntrack_htable_size;
+               hash = (hash + 1) % net->ct.htable_size;
        }
        rcu_read_unlock();
 
@@ -557,7 +558,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
 
        if (nf_conntrack_max &&
            unlikely(atomic_read(&net->ct.count) > nf_conntrack_max)) {
-               unsigned int hash = hash_conntrack(orig);
+               unsigned int hash = hash_conntrack(net, orig);
                if (!early_drop(net, hash)) {
                        atomic_dec(&net->ct.count);
                        if (net_ratelimit())
@@ -572,7 +573,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
         * Do not use kmem_cache_zalloc(), as this cache uses
         * SLAB_DESTROY_BY_RCU.
         */
-       ct = kmem_cache_alloc(nf_conntrack_cachep, gfp);
+       ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp);
        if (ct == NULL) {
                pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
                atomic_dec(&net->ct.count);
@@ -611,7 +612,7 @@ void nf_conntrack_free(struct nf_conn *ct)
        nf_ct_ext_destroy(ct);
        atomic_dec(&net->ct.count);
        nf_ct_ext_free(ct);
-       kmem_cache_free(nf_conntrack_cachep, ct);
+       kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_free);
 
@@ -1014,7 +1015,7 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
        struct hlist_nulls_node *n;
 
        spin_lock_bh(&nf_conntrack_lock);
-       for (; *bucket < nf_conntrack_htable_size; (*bucket)++) {
+       for (; *bucket < net->ct.htable_size; (*bucket)++) {
                hlist_nulls_for_each_entry(h, n, &net->ct.hash[*bucket], hnnode) {
                        ct = nf_ct_tuplehash_to_ctrack(h);
                        if (iter(ct, data))
@@ -1113,9 +1114,12 @@ static void nf_ct_release_dying_list(struct net *net)
 
 static void nf_conntrack_cleanup_init_net(void)
 {
+       /* wait until all references to nf_conntrack_untracked are dropped */
+       while (atomic_read(&nf_conntrack_untracked.ct_general.use) > 1)
+               schedule();
+
        nf_conntrack_helper_fini();
        nf_conntrack_proto_fini();
-       kmem_cache_destroy(nf_conntrack_cachep);
 }
 
 static void nf_conntrack_cleanup_net(struct net *net)
@@ -1127,15 +1131,14 @@ static void nf_conntrack_cleanup_net(struct net *net)
                schedule();
                goto i_see_dead_people;
        }
-       /* wait until all references to nf_conntrack_untracked are dropped */
-       while (atomic_read(&nf_conntrack_untracked.ct_general.use) > 1)
-               schedule();
 
        nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,
-                            nf_conntrack_htable_size);
+                            net->ct.htable_size);
        nf_conntrack_ecache_fini(net);
        nf_conntrack_acct_fini(net);
        nf_conntrack_expect_fini(net);
+       kmem_cache_destroy(net->ct.nf_conntrack_cachep);
+       kfree(net->ct.slabname);
        free_percpu(net->ct.stat);
 }
 
@@ -1190,10 +1193,12 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
        int i, bucket, vmalloced, old_vmalloced;
        unsigned int hashsize, old_size;
-       int rnd;
        struct hlist_nulls_head *hash, *old_hash;
        struct nf_conntrack_tuple_hash *h;
 
+       if (current->nsproxy->net_ns != &init_net)
+               return -EOPNOTSUPP;
+
        /* On boot, we can set this without any fancy locking. */
        if (!nf_conntrack_htable_size)
                return param_set_uint(val, kp);
@@ -1206,33 +1211,29 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
        if (!hash)
                return -ENOMEM;
 
-       /* We have to rehahs for the new table anyway, so we also can
-        * use a newrandom seed */
-       get_random_bytes(&rnd, sizeof(rnd));
-
        /* Lookups in the old hash might happen in parallel, which means we
         * might get false negatives during connection lookup. New connections
         * created because of a false negative won't make it into the hash
         * though since that required taking the lock.
         */
        spin_lock_bh(&nf_conntrack_lock);
-       for (i = 0; i < nf_conntrack_htable_size; i++) {
+       for (i = 0; i < init_net.ct.htable_size; i++) {
                while (!hlist_nulls_empty(&init_net.ct.hash[i])) {
                        h = hlist_nulls_entry(init_net.ct.hash[i].first,
                                        struct nf_conntrack_tuple_hash, hnnode);
                        hlist_nulls_del_rcu(&h->hnnode);
-                       bucket = __hash_conntrack(&h->tuple, hashsize, rnd);
+                       bucket = __hash_conntrack(&h->tuple, hashsize,
+                                                 nf_conntrack_hash_rnd);
                        hlist_nulls_add_head_rcu(&h->hnnode, &hash[bucket]);
                }
        }
-       old_size = nf_conntrack_htable_size;
+       old_size = init_net.ct.htable_size;
        old_vmalloced = init_net.ct.hash_vmalloc;
        old_hash = init_net.ct.hash;
 
-       nf_conntrack_htable_size = hashsize;
+       init_net.ct.htable_size = nf_conntrack_htable_size = hashsize;
        init_net.ct.hash_vmalloc = vmalloced;
        init_net.ct.hash = hash;
-       nf_conntrack_hash_rnd = rnd;
        spin_unlock_bh(&nf_conntrack_lock);
 
        nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
@@ -1271,15 +1272,6 @@ static int nf_conntrack_init_init_net(void)
               NF_CONNTRACK_VERSION, nf_conntrack_htable_size,
               nf_conntrack_max);
 
-       nf_conntrack_cachep = kmem_cache_create("nf_conntrack",
-                                               sizeof(struct nf_conn),
-                                               0, SLAB_DESTROY_BY_RCU, NULL);
-       if (!nf_conntrack_cachep) {
-               printk(KERN_ERR "Unable to create nf_conn slab cache\n");
-               ret = -ENOMEM;
-               goto err_cache;
-       }
-
        ret = nf_conntrack_proto_init();
        if (ret < 0)
                goto err_proto;
@@ -1288,13 +1280,19 @@ static int nf_conntrack_init_init_net(void)
        if (ret < 0)
                goto err_helper;
 
+       /* Set up fake conntrack: to never be deleted, not in any hashes */
+#ifdef CONFIG_NET_NS
+       nf_conntrack_untracked.ct_net = &init_net;
+#endif
+       atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
+       /*  - and look it like as a confirmed connection */
+       set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status);
+
        return 0;
 
 err_helper:
        nf_conntrack_proto_fini();
 err_proto:
-       kmem_cache_destroy(nf_conntrack_cachep);
-err_cache:
        return ret;
 }
 
@@ -1316,7 +1314,24 @@ static int nf_conntrack_init_net(struct net *net)
                ret = -ENOMEM;
                goto err_stat;
        }
-       net->ct.hash = nf_ct_alloc_hashtable(&nf_conntrack_htable_size,
+
+       net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%p", net);
+       if (!net->ct.slabname) {
+               ret = -ENOMEM;
+               goto err_slabname;
+       }
+
+       net->ct.nf_conntrack_cachep = kmem_cache_create(net->ct.slabname,
+                                                       sizeof(struct nf_conn), 0,
+                                                       SLAB_DESTROY_BY_RCU, NULL);
+       if (!net->ct.nf_conntrack_cachep) {
+               printk(KERN_ERR "Unable to create nf_conn slab cache\n");
+               ret = -ENOMEM;
+               goto err_cache;
+       }
+
+       net->ct.htable_size = nf_conntrack_htable_size;
+       net->ct.hash = nf_ct_alloc_hashtable(&net->ct.htable_size,
                                             &net->ct.hash_vmalloc, 1);
        if (!net->ct.hash) {
                ret = -ENOMEM;
@@ -1333,15 +1348,6 @@ static int nf_conntrack_init_net(struct net *net)
        if (ret < 0)
                goto err_ecache;
 
-       /* Set up fake conntrack:
-           - to never be deleted, not in any hashes */
-#ifdef CONFIG_NET_NS
-       nf_conntrack_untracked.ct_net = &init_net;
-#endif
-       atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
-       /*  - and look it like as a confirmed connection */
-       set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status);
-
        return 0;
 
 err_ecache:
@@ -1350,8 +1356,12 @@ err_acct:
        nf_conntrack_expect_fini(net);
 err_expect:
        nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,
-                            nf_conntrack_htable_size);
+                            net->ct.htable_size);
 err_hash:
+       kmem_cache_destroy(net->ct.nf_conntrack_cachep);
+err_cache:
+       kfree(net->ct.slabname);
+err_slabname:
        free_percpu(net->ct.stat);
 err_stat:
        return ret;
index fdf5d2a1d9b4cb7f620b6e8521eb5f0193720b9e..2f25ff61098298b40f1014988591b10ec0fbae77 100644 (file)
@@ -569,7 +569,7 @@ static void exp_proc_remove(struct net *net)
 #endif /* CONFIG_PROC_FS */
 }
 
-module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0600);
+module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0400);
 
 int nf_conntrack_expect_init(struct net *net)
 {
@@ -577,7 +577,7 @@ int nf_conntrack_expect_init(struct net *net)
 
        if (net_eq(net, &init_net)) {
                if (!nf_ct_expect_hsize) {
-                       nf_ct_expect_hsize = nf_conntrack_htable_size / 256;
+                       nf_ct_expect_hsize = net->ct.htable_size / 256;
                        if (!nf_ct_expect_hsize)
                                nf_ct_expect_hsize = 1;
                }
index 65c2a7bc3afcdccef4ce0eefb35b38f6beda99d7..4b1a56bd074c40762515fea27f56a035cd471ec0 100644 (file)
@@ -192,7 +192,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,
        /* Get rid of expecteds, set helpers to NULL. */
        hlist_nulls_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode)
                unhelp(h, me);
-       for (i = 0; i < nf_conntrack_htable_size; i++) {
+       for (i = 0; i < net->ct.htable_size; i++) {
                hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode)
                        unhelp(h, me);
        }
index 59d8064eb5224b8b1278c2275b0af31573be3575..0ffe689dfe973b009a23282375f8ccfbcc80a13f 100644 (file)
@@ -594,7 +594,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
 
        rcu_read_lock();
        last = (struct nf_conn *)cb->args[1];
-       for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
+       for (; cb->args[0] < init_net.ct.htable_size; cb->args[0]++) {
 restart:
                hlist_nulls_for_each_entry_rcu(h, n, &init_net.ct.hash[cb->args[0]],
                                         hnnode) {
@@ -1437,8 +1437,9 @@ ctnetlink_exp_dump_mask(struct sk_buff *skb,
        struct nlattr *nest_parms;
 
        memset(&m, 0xFF, sizeof(m));
-       m.src.u.all = mask->src.u.all;
        memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3));
+       m.src.u.all = mask->src.u.all;
+       m.dst.protonum = tuple->dst.protonum;
 
        nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK | NLA_F_NESTED);
        if (!nest_parms)
index 4b572163784b338b1efa430713e1ae73d5da38b2..023966b569bf5166f92379f7db46651d1ed91567 100644 (file)
@@ -376,7 +376,7 @@ int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
                        dptr += hdr->len;
                else if (hdr->cname && limit - dptr >= hdr->clen + 1 &&
                         strnicmp(dptr, hdr->cname, hdr->clen) == 0 &&
-                        !isalpha(*(dptr + hdr->clen + 1)))
+                        !isalpha(*(dptr + hdr->clen)))
                        dptr += hdr->clen;
                else
                        continue;
index 028aba667ef70de96e03322890b2a63badd50215..e310f1561bb294945166db4d0f867934afe6fdd3 100644 (file)
@@ -51,7 +51,7 @@ static struct hlist_nulls_node *ct_get_first(struct seq_file *seq)
        struct hlist_nulls_node *n;
 
        for (st->bucket = 0;
-            st->bucket < nf_conntrack_htable_size;
+            st->bucket < net->ct.htable_size;
             st->bucket++) {
                n = rcu_dereference(net->ct.hash[st->bucket].first);
                if (!is_a_nulls(n))
@@ -69,7 +69,7 @@ static struct hlist_nulls_node *ct_get_next(struct seq_file *seq,
        head = rcu_dereference(head->next);
        while (is_a_nulls(head)) {
                if (likely(get_nulls_value(head) == st->bucket)) {
-                       if (++st->bucket >= nf_conntrack_htable_size)
+                       if (++st->bucket >= net->ct.htable_size)
                                return NULL;
                }
                head = rcu_dereference(net->ct.hash[st->bucket].first);
@@ -355,7 +355,7 @@ static ctl_table nf_ct_sysctl_table[] = {
        },
        {
                .procname       = "nf_conntrack_buckets",
-               .data           = &nf_conntrack_htable_size,
+               .data           = &init_net.ct.htable_size,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0444,
                .proc_handler   = proc_dointvec,
@@ -421,6 +421,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
                goto out_kmemdup;
 
        table[1].data = &net->ct.count;
+       table[2].data = &net->ct.htable_size;
        table[3].data = &net->ct.sysctl_checksum;
        table[4].data = &net->ct.sysctl_log_invalid;
 
index a4957bf2ca60d6963e2d94f9b2e7679df3a0b4b6..4c5972ba8c78c00bb35519cae8e927ae84e8a1d0 100644 (file)
@@ -455,9 +455,14 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol,
        if (nl_table[protocol].registered &&
            try_module_get(nl_table[protocol].module))
                module = nl_table[protocol].module;
+       else
+               err = -EPROTONOSUPPORT;
        cb_mutex = nl_table[protocol].cb_mutex;
        netlink_unlock_table();
 
+       if (err < 0)
+               goto out;
+
        err = __netlink_create(net, sock, cb_mutex, protocol);
        if (err < 0)
                goto out_module;
index aacba76070fc75986638073678f3604fd64947dc..e2e2d33cafdf6f98dfdc2fb47acfa39e736bb90d 100644 (file)
@@ -843,12 +843,13 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
        dptr  = skb_push(skb, 1);
        *dptr = AX25_P_NETROM;
 
-       ax25s = ax25_send_frame(skb, 256, (ax25_address *)dev->dev_addr, &nr_neigh->callsign, nr_neigh->digipeat, nr_neigh->dev);
-       if (nr_neigh->ax25 && ax25s) {
-               /* We were already holding this ax25_cb */
+       ax25s = nr_neigh->ax25;
+       nr_neigh->ax25 = ax25_send_frame(skb, 256,
+                                        (ax25_address *)dev->dev_addr,
+                                        &nr_neigh->callsign,
+                                        nr_neigh->digipeat, nr_neigh->dev);
+       if (ax25s)
                ax25_cb_put(ax25s);
-       }
-       nr_neigh->ax25 = ax25s;
 
        dev_put(dev);
        ret = (nr_neigh->ax25 != NULL);
index f126d18dbdc481598fcd4de58c74fd434b0a18f9..939471ef8d5082bd8880ff3153270b488954de16 100644 (file)
@@ -508,7 +508,7 @@ static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
        struct sk_filter *filter;
 
        rcu_read_lock_bh();
-       filter = rcu_dereference(sk->sk_filter);
+       filter = rcu_dereference_bh(sk->sk_filter);
        if (filter != NULL)
                res = sk_run_filter(skb, filter->insns, filter->len);
        rcu_read_unlock_bh();
index bd86a63960ce3114ad4c6c3ae8a90804d6b66d66..5ef5f6988a2e1aa892539e0c7c53364d7f796808 100644 (file)
@@ -101,13 +101,17 @@ static void rose_t0timer_expiry(unsigned long param)
 static int rose_send_frame(struct sk_buff *skb, struct rose_neigh *neigh)
 {
        ax25_address *rose_call;
+       ax25_cb *ax25s;
 
        if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
                rose_call = (ax25_address *)neigh->dev->dev_addr;
        else
                rose_call = &rose_callsign;
 
+       ax25s = neigh->ax25;
        neigh->ax25 = ax25_send_frame(skb, 260, rose_call, &neigh->callsign, neigh->digipeat, neigh->dev);
+       if (ax25s)
+               ax25_cb_put(ax25s);
 
        return (neigh->ax25 != NULL);
 }
@@ -120,13 +124,17 @@ static int rose_send_frame(struct sk_buff *skb, struct rose_neigh *neigh)
 static int rose_link_up(struct rose_neigh *neigh)
 {
        ax25_address *rose_call;
+       ax25_cb *ax25s;
 
        if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
                rose_call = (ax25_address *)neigh->dev->dev_addr;
        else
                rose_call = &rose_callsign;
 
+       ax25s = neigh->ax25;
        neigh->ax25 = ax25_find_cb(rose_call, &neigh->callsign, neigh->digipeat, neigh->dev);
+       if (ax25s)
+               ax25_cb_put(ax25s);
 
        return (neigh->ax25 != NULL);
 }
index 795c4b025e3145162ad7073da6ca5c846b0e3f05..70a0b3b4b4d2903b7bd74d1e783e819a561c32ce 100644 (file)
@@ -235,6 +235,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
 
        if ((s = rose_neigh_list) == rose_neigh) {
                rose_neigh_list = rose_neigh->next;
+               if (rose_neigh->ax25)
+                       ax25_cb_put(rose_neigh->ax25);
                kfree(rose_neigh->digipeat);
                kfree(rose_neigh);
                return;
@@ -243,6 +245,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
        while (s != NULL && s->next != NULL) {
                if (s->next == rose_neigh) {
                        s->next = rose_neigh->next;
+                       if (rose_neigh->ax25)
+                               ax25_cb_put(rose_neigh->ax25);
                        kfree(rose_neigh->digipeat);
                        kfree(rose_neigh);
                        return;
@@ -812,6 +816,7 @@ void rose_link_failed(ax25_cb *ax25, int reason)
 
        if (rose_neigh != NULL) {
                rose_neigh->ax25 = NULL;
+               ax25_cb_put(ax25);
 
                rose_del_route_by_neigh(rose_neigh);
                rose_kill_by_neigh(rose_neigh);
index 929218a4762060ee2052370eb70fe955c418211a..21f9c7678aa3ea903a9741305c22b6157e8637c3 100644 (file)
@@ -433,7 +433,7 @@ config NET_ACT_POLICE
          module.
 
          To compile this code as a module, choose M here: the
-         module will be called police.
+         module will be called act_police.
 
 config NET_ACT_GACT
         tristate "Generic actions"
@@ -443,7 +443,7 @@ config NET_ACT_GACT
          accepting packets.
 
          To compile this code as a module, choose M here: the
-         module will be called gact.
+         module will be called act_gact.
 
 config GACT_PROB
         bool "Probability support"
@@ -459,7 +459,7 @@ config NET_ACT_MIRRED
          other devices.
 
          To compile this code as a module, choose M here: the
-         module will be called mirred.
+         module will be called act_mirred.
 
 config NET_ACT_IPT
         tristate "IPtables targets"
@@ -469,7 +469,7 @@ config NET_ACT_IPT
          classification.
 
          To compile this code as a module, choose M here: the
-         module will be called ipt.
+         module will be called act_ipt.
 
 config NET_ACT_NAT
         tristate "Stateless NAT"
@@ -479,7 +479,7 @@ config NET_ACT_NAT
          netfilter for NAT unless you know what you are doing.
 
          To compile this code as a module, choose M here: the
-         module will be called nat.
+         module will be called act_nat.
 
 config NET_ACT_PEDIT
         tristate "Packet Editing"
@@ -488,7 +488,7 @@ config NET_ACT_PEDIT
          Say Y here if you want to mangle the content of packets.
 
          To compile this code as a module, choose M here: the
-         module will be called pedit.
+         module will be called act_pedit.
 
 config NET_ACT_SIMP
         tristate "Simple Example (Debug)"
@@ -502,7 +502,7 @@ config NET_ACT_SIMP
          If unsure, say N.
 
          To compile this code as a module, choose M here: the
-         module will be called simple.
+         module will be called act_simple.
 
 config NET_ACT_SKBEDIT
         tristate "SKB Editing"
@@ -513,7 +513,7 @@ config NET_ACT_SKBEDIT
          If unsure, say N.
 
          To compile this code as a module, choose M here: the
-         module will be called skbedit.
+         module will be called act_skbedit.
 
 config NET_CLS_IND
        bool "Incoming device classification"
index c2a2c563d21af2456aa261838285b4c6a49db786..92b81244248840fa9ff4437dddf02cbd4beda711 100644 (file)
@@ -745,9 +745,9 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                        mutex_unlock(&rdev->devlist_mtx);
                        dev_put(dev);
                }
-#ifdef CONFIG_CFG80211_WEXT
                cfg80211_lock_rdev(rdev);
                mutex_lock(&rdev->devlist_mtx);
+#ifdef CONFIG_CFG80211_WEXT
                wdev_lock(wdev);
                switch (wdev->iftype) {
                case NL80211_IFTYPE_ADHOC:
@@ -760,10 +760,10 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                        break;
                }
                wdev_unlock(wdev);
+#endif
                rdev->opencount++;
                mutex_unlock(&rdev->devlist_mtx);
                cfg80211_unlock_rdev(rdev);
-#endif
                break;
        case NETDEV_UNREGISTER:
                /*
index baa898add28760d8c13642c47cdb1f1c4a49c0c5..7a0754c92df4702ed1c72c2cdb10945dd1eb56fd 100644 (file)
@@ -1690,7 +1690,7 @@ int regulatory_hint_user(const char *alpha2)
        request->wiphy_idx = WIPHY_IDX_STALE;
        request->alpha2[0] = alpha2[0];
        request->alpha2[1] = alpha2[1];
-       request->initiator = NL80211_REGDOM_SET_BY_USER,
+       request->initiator = NL80211_REGDOM_SET_BY_USER;
 
        queue_regulatory_request(request);
 
index 2333d78187e4a0f2d48572fb9786110ed87f137a..dc0fc4989d54b1f92738ead9f911f309db863372 100644 (file)
@@ -655,6 +655,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
        memset(&wrqu, 0, sizeof(wrqu));
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
        wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
+       wdev->wext.connect.ssid_len = 0;
 #endif
 }
 
index 743c0134a6a91d1ab1df29cbc32550a2ac3fb05b..8b4d6e3246e50fd07657c39733d19697fd0b68c0 100644 (file)
@@ -125,6 +125,22 @@ static struct xfrm_algo_desc aead_list[] = {
                .sadb_alg_maxbits = 256
        }
 },
+{
+       .name = "rfc4543(gcm(aes))",
+
+       .uinfo = {
+               .aead = {
+                       .icv_truncbits = 128,
+               }
+       },
+
+       .desc = {
+               .sadb_alg_id = SADB_X_EALG_NULL_AES_GMAC,
+               .sadb_alg_ivlen = 8,
+               .sadb_alg_minbits = 128,
+               .sadb_alg_maxbits = 256
+       }
+},
 };
 
 static struct xfrm_algo_desc aalg_list[] = {
index 4725a549ad4d52bc1c791425413b21bfe9af9929..0ecb16a9a8831b9c145a3db4d2e142331061d776 100644 (file)
@@ -469,16 +469,16 @@ static inline int xfrm_byidx_should_resize(struct net *net, int total)
        return 0;
 }
 
-void xfrm_spd_getinfo(struct xfrmk_spdinfo *si)
+void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si)
 {
        read_lock_bh(&xfrm_policy_lock);
-       si->incnt = init_net.xfrm.policy_count[XFRM_POLICY_IN];
-       si->outcnt = init_net.xfrm.policy_count[XFRM_POLICY_OUT];
-       si->fwdcnt = init_net.xfrm.policy_count[XFRM_POLICY_FWD];
-       si->inscnt = init_net.xfrm.policy_count[XFRM_POLICY_IN+XFRM_POLICY_MAX];
-       si->outscnt = init_net.xfrm.policy_count[XFRM_POLICY_OUT+XFRM_POLICY_MAX];
-       si->fwdscnt = init_net.xfrm.policy_count[XFRM_POLICY_FWD+XFRM_POLICY_MAX];
-       si->spdhcnt = init_net.xfrm.policy_idx_hmask;
+       si->incnt = net->xfrm.policy_count[XFRM_POLICY_IN];
+       si->outcnt = net->xfrm.policy_count[XFRM_POLICY_OUT];
+       si->fwdcnt = net->xfrm.policy_count[XFRM_POLICY_FWD];
+       si->inscnt = net->xfrm.policy_count[XFRM_POLICY_IN+XFRM_POLICY_MAX];
+       si->outscnt = net->xfrm.policy_count[XFRM_POLICY_OUT+XFRM_POLICY_MAX];
+       si->fwdscnt = net->xfrm.policy_count[XFRM_POLICY_FWD+XFRM_POLICY_MAX];
+       si->spdhcnt = net->xfrm.policy_idx_hmask;
        si->spdhmcnt = xfrm_policy_hashmax;
        read_unlock_bh(&xfrm_policy_lock);
 }
@@ -1309,15 +1309,28 @@ static inline int xfrm_get_tos(struct flowi *fl, int family)
        return tos;
 }
 
-static inline struct xfrm_dst *xfrm_alloc_dst(int family)
+static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
 {
        struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
+       struct dst_ops *dst_ops;
        struct xfrm_dst *xdst;
 
        if (!afinfo)
                return ERR_PTR(-EINVAL);
 
-       xdst = dst_alloc(afinfo->dst_ops) ?: ERR_PTR(-ENOBUFS);
+       switch (family) {
+       case AF_INET:
+               dst_ops = &net->xfrm.xfrm4_dst_ops;
+               break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+       case AF_INET6:
+               dst_ops = &net->xfrm.xfrm6_dst_ops;
+               break;
+#endif
+       default:
+               BUG();
+       }
+       xdst = dst_alloc(dst_ops) ?: ERR_PTR(-ENOBUFS);
 
        xfrm_policy_put_afinfo(afinfo);
 
@@ -1366,6 +1379,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
                                            struct flowi *fl,
                                            struct dst_entry *dst)
 {
+       struct net *net = xp_net(policy);
        unsigned long now = jiffies;
        struct net_device *dev;
        struct dst_entry *dst_prev = NULL;
@@ -1389,7 +1403,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
        dst_hold(dst);
 
        for (; i < nx; i++) {
-               struct xfrm_dst *xdst = xfrm_alloc_dst(family);
+               struct xfrm_dst *xdst = xfrm_alloc_dst(net, family);
                struct dst_entry *dst1 = &xdst->u.dst;
 
                err = PTR_ERR(xdst);
@@ -2279,6 +2293,7 @@ EXPORT_SYMBOL(xfrm_bundle_ok);
 
 int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 {
+       struct net *net;
        int err = 0;
        if (unlikely(afinfo == NULL))
                return -EINVAL;
@@ -2302,6 +2317,27 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
                xfrm_policy_afinfo[afinfo->family] = afinfo;
        }
        write_unlock_bh(&xfrm_policy_afinfo_lock);
+
+       rtnl_lock();
+       for_each_net(net) {
+               struct dst_ops *xfrm_dst_ops;
+
+               switch (afinfo->family) {
+               case AF_INET:
+                       xfrm_dst_ops = &net->xfrm.xfrm4_dst_ops;
+                       break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+               case AF_INET6:
+                       xfrm_dst_ops = &net->xfrm.xfrm6_dst_ops;
+                       break;
+#endif
+               default:
+                       BUG();
+               }
+               *xfrm_dst_ops = *afinfo->dst_ops;
+       }
+       rtnl_unlock();
+
        return err;
 }
 EXPORT_SYMBOL(xfrm_policy_register_afinfo);
@@ -2332,6 +2368,22 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
 }
 EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
 
+static void __net_init xfrm_dst_ops_init(struct net *net)
+{
+       struct xfrm_policy_afinfo *afinfo;
+
+       read_lock_bh(&xfrm_policy_afinfo_lock);
+       afinfo = xfrm_policy_afinfo[AF_INET];
+       if (afinfo)
+               net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+       afinfo = xfrm_policy_afinfo[AF_INET6];
+       if (afinfo)
+               net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops;
+#endif
+       read_unlock_bh(&xfrm_policy_afinfo_lock);
+}
+
 static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family)
 {
        struct xfrm_policy_afinfo *afinfo;
@@ -2494,6 +2546,7 @@ static int __net_init xfrm_net_init(struct net *net)
        rv = xfrm_policy_init(net);
        if (rv < 0)
                goto out_policy;
+       xfrm_dst_ops_init(net);
        rv = xfrm_sysctl_init(net);
        if (rv < 0)
                goto out_sysctl;
index d847f1a52b446e567366f236645f1291efe71cd6..f445ea1c5f52b46392a2860c4381d626da893ff3 100644 (file)
@@ -641,11 +641,11 @@ out:
 }
 EXPORT_SYMBOL(xfrm_state_flush);
 
-void xfrm_sad_getinfo(struct xfrmk_sadinfo *si)
+void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si)
 {
        spin_lock_bh(&xfrm_state_lock);
-       si->sadcnt = init_net.xfrm.state_num;
-       si->sadhcnt = init_net.xfrm.state_hmask;
+       si->sadcnt = net->xfrm.state_num;
+       si->sadhcnt = net->xfrm.state_hmask;
        si->sadhmcnt = xfrm_state_hashmax;
        spin_unlock_bh(&xfrm_state_lock);
 }
@@ -1102,7 +1102,7 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
        int err = -ENOMEM;
        struct xfrm_state *x = xfrm_state_alloc(net);
        if (!x)
-               goto error;
+               goto out;
 
        memcpy(&x->id, &orig->id, sizeof(x->id));
        memcpy(&x->sel, &orig->sel, sizeof(x->sel));
@@ -1160,16 +1160,10 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
        return x;
 
  error:
+       xfrm_state_put(x);
+out:
        if (errp)
                *errp = err;
-       if (x) {
-               kfree(x->aalg);
-               kfree(x->ealg);
-               kfree(x->calg);
-               kfree(x->encap);
-               kfree(x->coaddr);
-       }
-       kfree(x);
        return NULL;
 }
 
index 1ada6186933c24256c92bfee4db98eafde653a03..d5a712976004cdc4c8fbdfcd53baa501abd59b39 100644 (file)
@@ -781,7 +781,8 @@ static inline size_t xfrm_spdinfo_msgsize(void)
               + nla_total_size(sizeof(struct xfrmu_spdhinfo));
 }
 
-static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
+static int build_spdinfo(struct sk_buff *skb, struct net *net,
+                        u32 pid, u32 seq, u32 flags)
 {
        struct xfrmk_spdinfo si;
        struct xfrmu_spdinfo spc;
@@ -795,7 +796,7 @@ static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
 
        f = nlmsg_data(nlh);
        *f = flags;
-       xfrm_spd_getinfo(&si);
+       xfrm_spd_getinfo(net, &si);
        spc.incnt = si.incnt;
        spc.outcnt = si.outcnt;
        spc.fwdcnt = si.fwdcnt;
@@ -828,7 +829,7 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (r_skb == NULL)
                return -ENOMEM;
 
-       if (build_spdinfo(r_skb, spid, seq, *flags) < 0)
+       if (build_spdinfo(r_skb, net, spid, seq, *flags) < 0)
                BUG();
 
        return nlmsg_unicast(net->xfrm.nlsk, r_skb, spid);
@@ -841,7 +842,8 @@ static inline size_t xfrm_sadinfo_msgsize(void)
               + nla_total_size(4); /* XFRMA_SAD_CNT */
 }
 
-static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
+static int build_sadinfo(struct sk_buff *skb, struct net *net,
+                        u32 pid, u32 seq, u32 flags)
 {
        struct xfrmk_sadinfo si;
        struct xfrmu_sadhinfo sh;
@@ -854,7 +856,7 @@ static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
 
        f = nlmsg_data(nlh);
        *f = flags;
-       xfrm_sad_getinfo(&si);
+       xfrm_sad_getinfo(net, &si);
 
        sh.sadhmcnt = si.sadhmcnt;
        sh.sadhcnt = si.sadhcnt;
@@ -882,7 +884,7 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (r_skb == NULL)
                return -ENOMEM;
 
-       if (build_sadinfo(r_skb, spid, seq, *flags) < 0)
+       if (build_sadinfo(r_skb, net, spid, seq, *flags) < 0)
                BUG();
 
        return nlmsg_unicast(net->xfrm.nlsk, r_skb, spid);
index 52cab46ae35a3be5a6a1869ce2b01aa9c4e06190..c5d5db54c009994c5945200b055e56b4869e7fff 100644 (file)
@@ -6,5 +6,4 @@ kallsyms
 pnmtologo
 bin2c
 unifdef
-binoffset
 ihex2fw
index 0fe48cd91ffad42d80d8890c04fbd3f90f8869cd..f9bdf264473db421f4a720eaca0d4c5456e4d7e6 100644 (file)
@@ -219,8 +219,13 @@ for F in $1; do                                                            \
        fsize=$$(stat -c "%s" $$F);                                     \
        dec_size=$$(expr $$dec_size + $$fsize);                         \
 done;                                                                  \
-printf "%08x" $$dec_size |                                             \
-       sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g' \
+printf "%08x\n" $$dec_size |                                           \
+       sed 's/\(..\)/\1 /g' | {                                        \
+               read ch0 ch1 ch2 ch3;                                   \
+               for ch in $$ch3 $$ch2 $$ch1 $$ch0; do                   \
+                       printf '%s%03o' '\\' $$((0x$$ch));              \
+               done;                                                   \
+       }                                                               \
 )
 
 quiet_cmd_bzip2 = BZIP2   $@
diff --git a/scripts/binoffset.c b/scripts/binoffset.c
deleted file mode 100644 (file)
index 1a2e39b..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/***************************************************************************
- * binoffset.c
- * (C) 2002 Randy Dunlap <rdunlap@xenotime.net>
-
-#   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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# binoffset.c:
-# - searches a (binary) file for a specified (binary) pattern
-# - returns the offset of the located pattern or ~0 if not found
-# - exits with exit status 0 normally or non-0 if pattern is not found
-#   or any other error occurs.
-
-****************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#define VERSION                "0.1"
-#define BUF_SIZE       (16 * 1024)
-#define PAT_SIZE       100
-
-char           *progname;
-char           *inputname;
-int            inputfd;
-unsigned int   bix;                    /* buf index */
-unsigned char  patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */
-int            pat_len;                /* actual number of pattern bytes */
-unsigned char  *madr;                  /* mmap address */
-size_t         filesize;
-int            num_matches = 0;
-off_t          firstloc = 0;
-
-void usage (void)
-{
-       fprintf (stderr, "%s ver. %s\n", progname, VERSION);
-       fprintf (stderr, "usage:  %s filename pattern_bytes\n",
-                       progname);
-       fprintf (stderr, "        [prints location of pattern_bytes in file]\n");
-       exit (1);
-}
-
-void get_pattern (int pat_count, char *pats [])
-{
-       int ix, err, tmp;
-
-#ifdef DEBUG
-       fprintf (stderr,"get_pattern: count = %d\n", pat_count);
-       for (ix = 0; ix < pat_count; ix++)
-               fprintf (stderr, "  pat # %d:  [%s]\n", ix, pats[ix]);
-#endif
-
-       for (ix = 0; ix < pat_count; ix++) {
-               tmp = 0;
-               err = sscanf (pats[ix], "%5i", &tmp);
-               if (err != 1 || tmp > 0xff) {
-                       fprintf (stderr, "pattern or value error in pattern # %d [%s]\n",
-                                       ix, pats[ix]);
-                       usage ();
-               }
-               patterns [ix] = tmp;
-       }
-       pat_len = pat_count;
-}
-
-void search_pattern (void)
-{
-       for (bix = 0; bix < filesize; bix++) {
-               if (madr[bix] == patterns[0]) {
-                       if (memcmp (&madr[bix], patterns, pat_len) == 0) {
-                               if (num_matches == 0)
-                                       firstloc = bix;
-                               num_matches++;
-                       }
-               }
-       }
-}
-
-#ifdef NOTDEF
-size_t get_filesize (int fd)
-{
-       off_t end_off = lseek (fd, 0, SEEK_END);
-       lseek (fd, 0, SEEK_SET);
-       return (size_t) end_off;
-}
-#endif
-
-size_t get_filesize (int fd)
-{
-       int err;
-       struct stat stat;
-
-       err = fstat (fd, &stat);
-       fprintf (stderr, "filesize: %ld\n", err < 0 ? (long)err : stat.st_size);
-       if (err < 0)
-               return err;
-       return (size_t) stat.st_size;
-}
-
-int main (int argc, char *argv [])
-{
-       progname = argv[0];
-
-       if (argc < 3)
-               usage ();
-
-       get_pattern (argc - 2, argv + 2);
-
-       inputname = argv[1];
-
-       inputfd = open (inputname, O_RDONLY);
-       if (inputfd == -1) {
-               fprintf (stderr, "%s: cannot open '%s'\n",
-                               progname, inputname);
-               exit (3);
-       }
-
-       filesize = get_filesize (inputfd);
-
-       madr = mmap (0, filesize, PROT_READ, MAP_PRIVATE, inputfd, 0);
-       if (madr == MAP_FAILED) {
-               fprintf (stderr, "mmap error = %d\n", errno);
-               close (inputfd);
-               exit (4);
-       }
-
-       search_pattern ();
-
-       if (munmap (madr, filesize))
-               fprintf (stderr, "munmap error = %d\n", errno);
-
-       if (close (inputfd))
-               fprintf (stderr, "%s: error %d closing '%s'\n",
-                               progname, errno, inputname);
-
-       fprintf (stderr, "number of pattern matches = %d\n", num_matches);
-       if (num_matches == 0)
-               firstloc = ~0;
-       printf ("%ld\n", firstloc);
-       fprintf (stderr, "%ld\n", firstloc);
-
-       exit (num_matches ? 0 : 2);
-}
-
-/* end binoffset.c */
index de233ff43c1c3e73b0b93cf04bcbb9105db16570..37f30d36c944645988c722d81e854744a5a18f39 100755 (executable)
@@ -1,92 +1,53 @@
 #!/bin/sh
-# extracts .config info from a [b]zImage file
-# uses: binoffset (new), dd, zcat, strings, grep
-# $arg1 is [b]zImage filename
-
-binoffset="./scripts/binoffset"
-test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
-
-IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
-IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
-dump_config() {
-    file="$1"
-
-    start=`$binoffset $file $IKCFG_ST 2>/dev/null`
-    [ "$?" != "0" ] && start="-1"
-    if [ "$start" -eq "-1" ]; then
-       return
-    fi
-    end=`$binoffset $file $IKCFG_ED 2>/dev/null`
-    [ "$?" != "0" ] && end="-1"
-    if [ "$end" -eq "-1" ]; then
-       return
-    fi
-
-    start=`expr $start + 8`
-    size=`expr $end - $start`
-
-    dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
-
-    clean_up
-    exit 0
-}
-
-
-usage()
-{
-       echo "  usage: extract-ikconfig [b]zImage_filename"
-}
-
-clean_up()
+# ----------------------------------------------------------------------
+# extract-ikconfig - Extract the .config file from a kernel image
+#
+# This will only work when the kernel was compiled with CONFIG_IKCONFIG.
+#
+# The obscure use of the "tr" filter is to work around older versions of
+# "grep" that report the byte offset of the line instead of the pattern.
+#
+# (c) 2009, Dick Streefland <dick@streefland.net>
+# Licensed under the terms of the GNU General Public License.
+# ----------------------------------------------------------------------
+
+gz1='\037\213\010'
+gz2='01'
+cf1='IKCFG_ST\037\213\010'
+cf2='0123456789'
+
+dump_config()
 {
-       if [ "$TMPFILE" != "" ]; then
-               rm -f $TMPFILE
+       if      pos=`tr "$cf1\n$cf2" "\n$cf2=" < "$1" | grep -abo "^$cf2"`
+       then
+               pos=${pos%%:*}
+               tail -c+$(($pos+8)) "$1" | zcat -q
+               exit 0
        fi
 }
 
-if [ $# -lt 1 ]
+# Check invocation:
+me=${0##*/}
+img=$1
+if     [ $# -ne 1 -o ! -s "$img" ]
 then
-       usage
-       exit 1
+       echo "Usage: $me <kernel-image>" >&2
+       exit 2
 fi
 
-TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1
-image="$1"
-
-# vmlinux: Attempt to dump the configuration from the file directly
-dump_config "$image"
-
-GZHDR1="0x1f 0x8b 0x08 0x00"
-GZHDR2="0x1f 0x8b 0x08 0x08"
-
-ELFHDR="0x7f 0x45 0x4c 0x46"
-
-# vmlinux.gz: Check for a compressed images
-off=`$binoffset "$image" $GZHDR1 2>/dev/null`
-[ "$?" != "0" ] && off="-1"
-if [ "$off" -eq "-1" ]; then
-       off=`$binoffset "$image" $GZHDR2 2>/dev/null`
-       [ "$?" != "0" ] && off="-1"
-fi
-if [ "$off" -eq "0" ]; then
-       zcat <"$image" >"$TMPFILE"
-       dump_config "$TMPFILE"
-elif [ "$off" -ne "-1" ]; then
-       (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \
-               zcat >"$TMPFILE"
-       dump_config "$TMPFILE"
-
-# check if this is simply an ELF file
-else
-       off=`$binoffset "$image" $ELFHDR 2>/dev/null`
-       [ "$?" != "0" ] && off="-1"
-       if [ "$off" -eq "0" ]; then
-               dump_config "$image"
-       fi
-fi
-
-echo "ERROR: Unable to extract kernel configuration information."
-echo "       This kernel image may not have the config info."
-
-clean_up
+# Initial attempt for uncompressed images or objects:
+dump_config "$img"
+
+# That didn't work, so decompress and try again:
+tmp=/tmp/ikconfig$$
+trap "rm -f $tmp" 0
+for    pos in `tr "$gz1\n$gz2" "\n$gz2=" < "$img" | grep -abo "^$gz2"`
+do
+       pos=${pos%%:*}
+       tail -c+$pos "$img" | zcat 2> /dev/null > $tmp
+       dump_config $tmp
+done
+
+# Bail out:
+echo "$me: Cannot find kernel config." >&2
 exit 1
index 090f2483970038e074d7be9593d635a6f1303e6a..2f3230db7ffbfd3044ceba5888e14bd77dc23148 100755 (executable)
@@ -74,8 +74,8 @@ my %VCS_cmds;
 my %VCS_cmds_git = (
     "execute_cmd" => \&git_execute_cmd,
     "available" => '(which("git") ne "") && (-d ".git")',
-    "find_signers_cmd" => "git log --since=\$email_git_since -- \$file",
-    "find_commit_signers_cmd" => "git log -1 \$commit",
+    "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file",
+    "find_commit_signers_cmd" => "git log --no-color -1 \$commit",
     "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
     "blame_file_cmd" => "git blame -l \$file",
     "commit_pattern" => "^commit [0-9a-f]{40,40}",
index 999e8a7d5bf7e1be6aa473bc865c4a4d2df36d75..186c46604d0669f8f1d4cfbcaf7ad0cdc6d658fa 100644 (file)
@@ -30,8 +30,17 @@ silentoldconfig: $(obj)/conf
        $(Q)mkdir -p include/generated
        $< -s $(Kconfig)
 
+# if no path is given, then use src directory to find file
+ifdef LSMOD
+LSMOD_F := $(LSMOD)
+ifeq ($(findstring /,$(LSMOD)),)
+  LSMOD_F := $(objtree)/$(LSMOD)
+endif
+endif
+
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
-       $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
+       $(Q)mkdir -p include/generated
+       $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
        $(Q)if [ -f .config ]; then                             \
                        cmp -s .tmp.config .config ||           \
                        (mv -f .config .config.old.1;           \
@@ -45,7 +54,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
        $(Q)rm -f .tmp.config
 
 localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
-       $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
+       $(Q)mkdir -p include/generated
+       $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
        $(Q)sed -i s/=m/=y/ .tmp.config
        $(Q)if [ -f .config ]; then                             \
                        cmp -s .tmp.config .config ||           \
index 0d800820c3cd72d6408079b6dbdec96eac954515..afbd54ac1d832ed758bf959f6bbc6ae5fc59f6aa 100644 (file)
@@ -113,6 +113,7 @@ find_config;
 # Get the build source and top level Kconfig file (passed in)
 my $ksource = $ARGV[0];
 my $kconfig = $ARGV[1];
+my $lsmod_file = $ARGV[2];
 
 my @makefiles = `find $ksource -name Makefile`;
 my %depends;
@@ -121,6 +122,8 @@ my %prompts;
 my %objects;
 my $var;
 my $cont = 0;
+my $iflevel = 0;
+my @ifdeps;
 
 # prevent recursion
 my %read_kconfigs;
@@ -146,6 +149,15 @@ sub read_kconfig {
            $state = "NEW";
            $config = $1;
 
+           for (my $i = 0; $i < $iflevel; $i++) {
+               if ($i) {
+                   $depends{$config} .= " " . $ifdeps[$i];
+               } else {
+                   $depends{$config} = $ifdeps[$i];
+               }
+               $state = "DEP";
+           }
+
        # collect the depends for the config
        } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
            $state = "DEP";
@@ -166,6 +178,21 @@ sub read_kconfig {
            # note if the config has a prompt
            $prompt{$config} = 1;
 
+       # Check for if statements
+       } elsif (/^if\s+(.*\S)\s*$/) {
+           my $deps = $1;
+           # remove beginning and ending non text
+           $deps =~ s/^[^a-zA-Z0-9_]*//;
+           $deps =~ s/[^a-zA-Z0-9_]*$//;
+
+           my @deps = split /[^a-zA-Z0-9_]+/, $deps;
+
+           $ifdeps[$iflevel++] = join ':', @deps;
+
+       } elsif (/^endif/) {
+
+           $iflevel-- if ($iflevel);
+
        # stop on "help"
        } elsif (/^\s*help\s*$/) {
            $state = "NONE";
@@ -237,8 +264,36 @@ foreach my $makefile (@makefiles) {
 
 my %modules;
 
-# see what modules are loaded on this system
-open(LIN,"/sbin/lsmod|") || die "Cant lsmod";
+if (defined($lsmod_file)) {
+    if ( ! -f $lsmod_file) {
+       die "$lsmod_file not found";
+    }
+    if ( -x $lsmod_file) {
+       # the file is executable, run it
+       open(LIN, "$lsmod_file|");
+    } else {
+       # Just read the contents
+       open(LIN, "$lsmod_file");
+    }
+} else {
+
+    # see what modules are loaded on this system
+    my $lsmod;
+
+    foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
+       if ( -x "$dir/lsmod" ) {
+           $lsmod = "$dir/lsmod";
+           last;
+       }
+}
+    if (!defined($lsmod)) {
+       # try just the path
+       $lsmod = "lsmod";
+    }
+
+    open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
+}
+
 while (<LIN>) {
        next if (/^Module/);  # Skip the first line.
        if (/^(\S+)/) {
index 241310e59cd6e6db33a24761a74cfda3254969f1..208ad3b0ca51baf955dc59a750f8d848c8465e01 100755 (executable)
@@ -13,8 +13,6 @@ use strict;
 ## This software falls under the GNU General Public License.     ##
 ## Please read the COPYING file for more information             ##
 
-# w.o. 03-11-2000: added the '-filelist' option.
-
 # 18/01/2001 -         Cleanups
 #              Functions prototyped as foo(void) same as foo()
 #              Stop eval'ing where we don't need to.
@@ -245,7 +243,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
 # could cause "use of undefined value" or other bugs.
 my ($function, %function_table, %parametertypes, $declaration_purpose);
 my ($type, $declaration_name, $return_type);
-my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map);
+my ($newsection, $newcontents, $prototype, $brcount, %source_map);
 
 if (defined($ENV{'KBUILD_VERBOSE'})) {
        $verbose = "$ENV{'KBUILD_VERBOSE'}";
@@ -338,8 +336,6 @@ while ($ARGV[0] =~ m/^-(.*)/) {
        $verbose = 1;
     } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
        usage();
-    } elsif ($cmd eq '-filelist') {
-           $filelist = shift @ARGV;
     } elsif ($cmd eq '-no-doc-sections') {
            $no_doc_sections = 1;
     }
@@ -1811,14 +1807,6 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
        close(SOURCE_MAP);
 }
 
-if ($filelist) {
-       open(FLIST,"<$filelist") or die "Can't open file list $filelist";
-       while(<FLIST>) {
-               chop;
-               process_file($_);
-       }
-}
-
 foreach (@ARGV) {
     chomp;
     process_file($_);
@@ -2023,6 +2011,8 @@ sub process_file($) {
        return;
     }
 
+    $. = 1;
+
     $section_counter = 0;
     while (<IN>) {
        if ($state == 0) {
index 5f0fcb712e2992229eeb3606a3e425bcf4115218..e950f9cde0199194f8db3e0ceb4579178f186bbe 100644 (file)
@@ -154,11 +154,11 @@ while (<STDIN>) {
        if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) {
                $target = $1;
        }
-       if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
+       if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) {
                $function = $1;
                $func_offset = $2;
        }
-       if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\]  \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
+       if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\]  \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) {
                $function = $1;
                $func_offset = $2;
        }
index 6f426afbc52230cf01613c420994443e7bdf08af..220213e603db4320e8c1ea88d8c557652085bfe5 100644 (file)
@@ -804,7 +804,7 @@ static inline int sym_is(const char *symbol, const char *name)
        match = strstr(symbol, name);
        if (!match)
                return 0;
-       return match[strlen(symbol)] == '\0';
+       return match[strlen(name)] == '\0';
 }
 
 static void do_table(void *symval, unsigned long size,
index 92f09fe9639ecdab0884330d049ae6b391765be7..f3c9c0a90b98cad68389da5d591a9921e1cb8f39 100755 (executable)
@@ -136,13 +136,14 @@ my %text_sections = (
      ".text.unlikely" => 1,
 );
 
-$objdump = "objdump" if ((length $objdump) == 0);
-$objcopy = "objcopy" if ((length $objcopy) == 0);
-$cc = "gcc" if ((length $cc) == 0);
-$ld = "ld" if ((length $ld) == 0);
-$nm = "nm" if ((length $nm) == 0);
-$rm = "rm" if ((length $rm) == 0);
-$mv = "mv" if ((length $mv) == 0);
+# Note: we are nice to C-programmers here, thus we skip the '||='-idiom.
+$objdump = 'objdump' if (!$objdump);
+$objcopy = 'objcopy' if (!$objcopy);
+$cc = 'gcc' if (!$cc);
+$ld = 'ld' if (!$ld);
+$nm = 'nm' if (!$nm);
+$rm = 'rm' if (!$rm);
+$mv = 'mv' if (!$mv);
 
 #print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " .
 #    "'$nm' '$rm' '$mv' '$inputfile'\n";
@@ -194,7 +195,7 @@ sub check_objcopy
     }
 }
 
-if ($arch eq "x86") {
+if ($arch =~ /(x86(_64)?)|(i386)/) {
     if ($bits == 64) {
        $arch = "x86_64";
     } else {
@@ -432,14 +433,14 @@ sub update_funcs
 
     # Loop through all the mcount caller offsets and print a reference
     # to the caller based from the ref_func.
-    for (my $i=0; $i <= $#offsets; $i++) {
-       if (!$opened) {
-           open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
-           $opened = 1;
-           print FILE "\t.section $mcount_section,\"a\",$section_type\n";
-           print FILE "\t.align $alignment\n" if (defined($alignment));
-       }
-       printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
+    if (!$opened) {
+       open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
+       $opened = 1;
+       print FILE "\t.section $mcount_section,\"a\",$section_type\n";
+       print FILE "\t.align $alignment\n" if (defined($alignment));
+    }
+    foreach my $cur_offset (@offsets) {
+       printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset;
     }
 }
 
@@ -476,11 +477,7 @@ while (<IN>) {
        $read_headers = 0;
 
        # Only record text sections that we know are safe
-       if (defined($text_sections{$1})) {
-           $read_function = 1;
-       } else {
-           $read_function = 0;
-       }
+       $read_function = defined($text_sections{$1});
        # print out any recorded offsets
        update_funcs();
 
@@ -514,7 +511,7 @@ while (<IN>) {
     }
     # is this a call site to mcount? If so, record it to print later
     if ($text_found && /$mcount_regex/) {
-       $offsets[$#offsets + 1] = hex $1;
+       push(@offsets, hex $1);
     }
 }
 
index f7496c6a022b7c2213f061c17b435bf0328085ed..c3a793881d04f0c578049f986ce98cb778d71895 100644 (file)
@@ -156,15 +156,8 @@ static int create_by_name(const char *name, mode_t mode,
         * block. A pointer to that is in the struct vfsmount that we
         * have around.
         */
-       if (!parent ) {
-               if (mount && mount->mnt_sb) {
-                       parent = mount->mnt_sb->s_root;
-               }
-       }
-       if (!parent) {
-               pr_debug("securityfs: Ah! can not find a parent!\n");
-               return -EFAULT;
-       }
+       if (!parent)
+               parent = mount->mnt_sb->s_root;
 
        mutex_lock(&parent->d_inode->i_mutex);
        *dentry = lookup_one_len(name, parent, strlen(name));
index c41afe6639a09559248f36eb672bcedf141eca49..47fb65d1fcbd216c1ee307afc1c11ce449378d93 100644 (file)
@@ -65,7 +65,6 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
                         const char *cause, int result, int info);
 
 /* Internal IMA function definitions */
-void ima_iintcache_init(void);
 int ima_init(void);
 void ima_cleanup(void);
 int ima_fs_init(void);
@@ -131,7 +130,7 @@ void iint_free(struct kref *kref);
 void iint_rcu_free(struct rcu_head *rcu);
 
 /* IMA policy related functions */
-enum ima_hooks { PATH_CHECK = 1, FILE_MMAP, BPRM_CHECK };
+enum ima_hooks { FILE_CHECK = 1, FILE_MMAP, BPRM_CHECK };
 
 int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask);
 void ima_init_policy(void);
index 3cd58b60afd26d20c2aa546707ab8f37a1498ee0..2a5e0bcf38873f85188b75c75252e343cf2db12c 100644 (file)
@@ -95,12 +95,12 @@ err_out:
  * ima_must_measure - measure decision based on policy.
  * @inode: pointer to inode to measure
  * @mask: contains the permission mask (MAY_READ, MAY_WRITE, MAY_EXECUTE)
- * @function: calling function (PATH_CHECK, BPRM_CHECK, FILE_MMAP)
+ * @function: calling function (FILE_CHECK, BPRM_CHECK, FILE_MMAP)
  *
  * The policy is defined in terms of keypairs:
  *             subj=, obj=, type=, func=, mask=, fsmagic=
  *     subj,obj, and type: are LSM specific.
- *     func: PATH_CHECK | BPRM_CHECK | FILE_MMAP
+ *     func: FILE_CHECK | BPRM_CHECK | FILE_MMAP
  *     mask: contains the permission mask
  *     fsmagic: hex value
  *
index fa592ff1ac1c4f7b24394baf6a2155dc1fb911a6..2d4d05d92fdacf01048ac9857541e8d17a3f0855 100644 (file)
@@ -52,9 +52,6 @@ int ima_inode_alloc(struct inode *inode)
        struct ima_iint_cache *iint = NULL;
        int rc = 0;
 
-       if (!ima_initialized)
-               return 0;
-
        iint = kmem_cache_alloc(iint_cache, GFP_NOFS);
        if (!iint)
                return -ENOMEM;
@@ -66,12 +63,11 @@ int ima_inode_alloc(struct inode *inode)
        spin_lock(&ima_iint_lock);
        rc = radix_tree_insert(&ima_iint_store, (unsigned long)inode, iint);
        spin_unlock(&ima_iint_lock);
+       radix_tree_preload_end();
 out:
        if (rc < 0)
                kmem_cache_free(iint_cache, iint);
 
-       radix_tree_preload_end();
-
        return rc;
 }
 
@@ -118,8 +114,6 @@ void ima_inode_free(struct inode *inode)
 {
        struct ima_iint_cache *iint;
 
-       if (!ima_initialized)
-               return;
        spin_lock(&ima_iint_lock);
        iint = radix_tree_delete(&ima_iint_store, (unsigned long)inode);
        spin_unlock(&ima_iint_lock);
@@ -141,9 +135,11 @@ static void init_once(void *foo)
        kref_set(&iint->refcount, 1);
 }
 
-void __init ima_iintcache_init(void)
+static int __init ima_iintcache_init(void)
 {
        iint_cache =
            kmem_cache_create("iint_cache", sizeof(struct ima_iint_cache), 0,
                              SLAB_PANIC, init_once);
+       return 0;
 }
+security_initcall(ima_iintcache_init);
index a89f44d5e0306fe173b14a8120919cb6ad805093..294b005d65206edb7219989c033c4bbe34eb3cbd 100644 (file)
@@ -14,7 +14,7 @@
  *
  * File: ima_main.c
  *     implements the IMA hooks: ima_bprm_check, ima_file_mmap,
- *     and ima_path_check.
+ *     and ima_file_check.
  */
 #include <linux/module.h>
 #include <linux/file.h>
@@ -84,6 +84,36 @@ out:
        return found;
 }
 
+/* ima_read_write_check - reflect possible reading/writing errors in the PCR.
+ *
+ * When opening a file for read, if the file is already open for write,
+ * the file could change, resulting in a file measurement error.
+ *
+ * Opening a file for write, if the file is already open for read, results
+ * in a time of measure, time of use (ToMToU) error.
+ *
+ * In either case invalidate the PCR.
+ */
+enum iint_pcr_error { TOMTOU, OPEN_WRITERS };
+static void ima_read_write_check(enum iint_pcr_error error,
+                                struct ima_iint_cache *iint,
+                                struct inode *inode,
+                                const unsigned char *filename)
+{
+       switch (error) {
+       case TOMTOU:
+               if (iint->readcount > 0)
+                       ima_add_violation(inode, filename, "invalid_pcr",
+                                         "ToMToU");
+               break;
+       case OPEN_WRITERS:
+               if (iint->writecount > 0)
+                       ima_add_violation(inode, filename, "invalid_pcr",
+                                         "open_writers");
+               break;
+       }
+}
+
 /*
  * Update the counts given an fmode_t
  */
@@ -98,6 +128,47 @@ static void ima_inc_counts(struct ima_iint_cache *iint, fmode_t mode)
                iint->writecount++;
 }
 
+/*
+ * ima_counts_get - increment file counts
+ *
+ * Maintain read/write counters for all files, but only
+ * invalidate the PCR for measured files:
+ *     - Opening a file for write when already open for read,
+ *       results in a time of measure, time of use (ToMToU) error.
+ *     - Opening a file for read when already open for write,
+ *       could result in a file measurement error.
+ *
+ */
+void ima_counts_get(struct file *file)
+{
+       struct dentry *dentry = file->f_path.dentry;
+       struct inode *inode = dentry->d_inode;
+       fmode_t mode = file->f_mode;
+       struct ima_iint_cache *iint;
+       int rc;
+
+       if (!ima_initialized || !S_ISREG(inode->i_mode))
+               return;
+       iint = ima_iint_find_get(inode);
+       if (!iint)
+               return;
+       mutex_lock(&iint->mutex);
+       rc = ima_must_measure(iint, inode, MAY_READ, FILE_CHECK);
+       if (rc < 0)
+               goto out;
+
+       if (mode & FMODE_WRITE) {
+               ima_read_write_check(TOMTOU, iint, inode, dentry->d_name.name);
+               goto out;
+       }
+       ima_read_write_check(OPEN_WRITERS, iint, inode, dentry->d_name.name);
+out:
+       ima_inc_counts(iint, file->f_mode);
+       mutex_unlock(&iint->mutex);
+
+       kref_put(&iint->refcount, iint_free);
+}
+
 /*
  * Decrement ima counts
  */
@@ -153,123 +224,6 @@ void ima_file_free(struct file *file)
        kref_put(&iint->refcount, iint_free);
 }
 
-/* ima_read_write_check - reflect possible reading/writing errors in the PCR.
- *
- * When opening a file for read, if the file is already open for write,
- * the file could change, resulting in a file measurement error.
- *
- * Opening a file for write, if the file is already open for read, results
- * in a time of measure, time of use (ToMToU) error.
- *
- * In either case invalidate the PCR.
- */
-enum iint_pcr_error { TOMTOU, OPEN_WRITERS };
-static void ima_read_write_check(enum iint_pcr_error error,
-                                struct ima_iint_cache *iint,
-                                struct inode *inode,
-                                const unsigned char *filename)
-{
-       switch (error) {
-       case TOMTOU:
-               if (iint->readcount > 0)
-                       ima_add_violation(inode, filename, "invalid_pcr",
-                                         "ToMToU");
-               break;
-       case OPEN_WRITERS:
-               if (iint->writecount > 0)
-                       ima_add_violation(inode, filename, "invalid_pcr",
-                                         "open_writers");
-               break;
-       }
-}
-
-static int get_path_measurement(struct ima_iint_cache *iint, struct file *file,
-                               const unsigned char *filename)
-{
-       int rc = 0;
-
-       ima_inc_counts(iint, file->f_mode);
-
-       rc = ima_collect_measurement(iint, file);
-       if (!rc)
-               ima_store_measurement(iint, file, filename);
-       return rc;
-}
-
-/**
- * ima_path_check - based on policy, collect/store measurement.
- * @path: contains a pointer to the path to be measured
- * @mask: contains MAY_READ, MAY_WRITE or MAY_EXECUTE
- *
- * Measure the file being open for readonly, based on the
- * ima_must_measure() policy decision.
- *
- * Keep read/write counters for all files, but only
- * invalidate the PCR for measured files:
- *     - Opening a file for write when already open for read,
- *       results in a time of measure, time of use (ToMToU) error.
- *     - Opening a file for read when already open for write,
- *       could result in a file measurement error.
- *
- * Always return 0 and audit dentry_open failures.
- * (Return code will be based upon measurement appraisal.)
- */
-int ima_path_check(struct path *path, int mask)
-{
-       struct inode *inode = path->dentry->d_inode;
-       struct ima_iint_cache *iint;
-       struct file *file = NULL;
-       int rc;
-
-       if (!ima_initialized || !S_ISREG(inode->i_mode))
-               return 0;
-       iint = ima_iint_find_get(inode);
-       if (!iint)
-               return 0;
-
-       mutex_lock(&iint->mutex);
-
-       rc = ima_must_measure(iint, inode, MAY_READ, PATH_CHECK);
-       if (rc < 0)
-               goto out;
-
-       if ((mask & MAY_WRITE) || (mask == 0))
-               ima_read_write_check(TOMTOU, iint, inode,
-                                    path->dentry->d_name.name);
-
-       if ((mask & (MAY_WRITE | MAY_READ | MAY_EXEC)) != MAY_READ)
-               goto out;
-
-       ima_read_write_check(OPEN_WRITERS, iint, inode,
-                            path->dentry->d_name.name);
-       if (!(iint->flags & IMA_MEASURED)) {
-               struct dentry *dentry = dget(path->dentry);
-               struct vfsmount *mnt = mntget(path->mnt);
-
-               file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE,
-                                  current_cred());
-               if (IS_ERR(file)) {
-                       int audit_info = 0;
-
-                       integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode,
-                                           dentry->d_name.name,
-                                           "add_measurement",
-                                           "dentry_open failed",
-                                           1, audit_info);
-                       file = NULL;
-                       goto out;
-               }
-               rc = get_path_measurement(iint, file, dentry->d_name.name);
-       }
-out:
-       mutex_unlock(&iint->mutex);
-       if (file)
-               fput(file);
-       kref_put(&iint->refcount, iint_free);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(ima_path_check);
-
 static int process_measurement(struct file *file, const unsigned char *filename,
                               int mask, int function)
 {
@@ -297,33 +251,6 @@ out:
        return rc;
 }
 
-/*
- * ima_counts_get - increment file counts
- *
- * - for IPC shm and shmat file.
- * - for nfsd exported files.
- *
- * Increment the counts for these files to prevent unnecessary
- * imbalance messages.
- */
-void ima_counts_get(struct file *file)
-{
-       struct inode *inode = file->f_dentry->d_inode;
-       struct ima_iint_cache *iint;
-
-       if (!ima_initialized || !S_ISREG(inode->i_mode))
-               return;
-       iint = ima_iint_find_get(inode);
-       if (!iint)
-               return;
-       mutex_lock(&iint->mutex);
-       ima_inc_counts(iint, file->f_mode);
-       mutex_unlock(&iint->mutex);
-
-       kref_put(&iint->refcount, iint_free);
-}
-EXPORT_SYMBOL_GPL(ima_counts_get);
-
 /**
  * ima_file_mmap - based on policy, collect/store measurement.
  * @file: pointer to the file to be measured (May be NULL)
@@ -369,11 +296,31 @@ int ima_bprm_check(struct linux_binprm *bprm)
        return 0;
 }
 
+/**
+ * ima_path_check - based on policy, collect/store measurement.
+ * @file: pointer to the file to be measured
+ * @mask: contains MAY_READ, MAY_WRITE or MAY_EXECUTE
+ *
+ * Measure files based on the ima_must_measure() policy decision.
+ *
+ * Always return 0 and audit dentry_open failures.
+ * (Return code will be based upon measurement appraisal.)
+ */
+int ima_file_check(struct file *file, int mask)
+{
+       int rc;
+
+       rc = process_measurement(file, file->f_dentry->d_name.name,
+                                mask & (MAY_READ | MAY_WRITE | MAY_EXEC),
+                                FILE_CHECK);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(ima_file_check);
+
 static int __init init_ima(void)
 {
        int error;
 
-       ima_iintcache_init();
        error = ima_init();
        ima_initialized = 1;
        return error;
index e1278399b34546a8ba5bbb4e8fdb90f9a8ec009f..4759d0f99335c5d8e06d44fa4993f4b65f061bb8 100644 (file)
@@ -67,7 +67,7 @@ static struct ima_measure_rule_entry default_rules[] = {
         .flags = IMA_FUNC | IMA_MASK},
        {.action = MEASURE,.func = BPRM_CHECK,.mask = MAY_EXEC,
         .flags = IMA_FUNC | IMA_MASK},
-       {.action = MEASURE,.func = PATH_CHECK,.mask = MAY_READ,.uid = 0,
+       {.action = MEASURE,.func = FILE_CHECK,.mask = MAY_READ,.uid = 0,
         .flags = IMA_FUNC | IMA_MASK | IMA_UID},
 };
 
@@ -282,8 +282,11 @@ static int ima_parse_rule(char *rule, struct ima_measure_rule_entry *entry)
                        break;
                case Opt_func:
                        audit_log_format(ab, "func=%s ", args[0].from);
-                       if (strcmp(args[0].from, "PATH_CHECK") == 0)
-                               entry->func = PATH_CHECK;
+                       if (strcmp(args[0].from, "FILE_CHECK") == 0)
+                               entry->func = FILE_CHECK;
+                       /* PATH_CHECK is for backwards compat */
+                       else if (strcmp(args[0].from, "PATH_CHECK") == 0)
+                               entry->func = FILE_CHECK;
                        else if (strcmp(args[0].from, "FILE_MMAP") == 0)
                                entry->func = FILE_MMAP;
                        else if (strcmp(args[0].from, "BPRM_CHECK") == 0)
index 4770be375ffece3d506ea86b769aee3bf8607595..19902319d097acc75ef6246d6981e33b43a8c69f 100644 (file)
@@ -77,7 +77,8 @@ static bool key_gc_keyring(struct key *keyring, time_t limit)
                goto dont_gc;
 
        /* scan the keyring looking for dead keys */
-       klist = rcu_dereference(keyring->payload.subscriptions);
+       klist = rcu_dereference_check(keyring->payload.subscriptions,
+                                     lockdep_is_held(&key_serial_lock));
        if (!klist)
                goto dont_gc;
 
index 8ec02746ca993fa697da600757fbcd21b319e2f7..e814d2109f8ef170ea60043fa83b1f37c3e35de1 100644 (file)
@@ -151,7 +151,9 @@ static void keyring_destroy(struct key *keyring)
                write_unlock(&keyring_name_lock);
        }
 
-       klist = rcu_dereference(keyring->payload.subscriptions);
+       klist = rcu_dereference_check(keyring->payload.subscriptions,
+                                     rcu_read_lock_held() ||
+                                     atomic_read(&keyring->usage) == 0);
        if (klist) {
                for (loop = klist->nkeys - 1; loop >= 0; loop--)
                        key_put(klist->keys[loop]);
index 24e060be9fa54b64994b6e5fe65674b42a90928c..122b748d0f4c5cbb11b04fd11a954429136586c2 100644 (file)
@@ -666,8 +666,6 @@ int security_file_alloc(struct file *file)
 void security_file_free(struct file *file)
 {
        security_ops->file_free_security(file);
-       if (file->f_dentry)
-               ima_file_free(file);
 }
 
 int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
index 68c7348d1acc6628f4c6121207edc34f6a7f707a..04b6145d767f96093423d5f733e6fe1b6a4e5687 100644 (file)
@@ -128,7 +128,7 @@ int ebitmap_netlbl_export(struct ebitmap *ebmap,
                        cmap_idx = delta / NETLBL_CATMAP_MAPSIZE;
                        cmap_sft = delta % NETLBL_CATMAP_MAPSIZE;
                        c_iter->bitmap[cmap_idx]
-                               |= e_iter->maps[cmap_idx] << cmap_sft;
+                               |= e_iter->maps[i] << cmap_sft;
                }
                e_iter = e_iter->next;
        }
index 8a00ade85166615a67fc768f595e00ac782b0863..2aceebf5f3546f1dffa2594d04fa12cc0702923b 100644 (file)
@@ -80,9 +80,8 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm)
                return tomoyo_find_next_domain(bprm);
        /*
         * Read permission is checked against interpreters using next domain.
-        * '1' is the result of open_to_namei_flags(O_RDONLY).
         */
-       return tomoyo_check_open_permission(domain, &bprm->file->f_path, 1);
+       return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY);
 }
 
 static int tomoyo_path_truncate(struct path *path, loff_t length,
@@ -184,10 +183,6 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
 static int tomoyo_dentry_open(struct file *f, const struct cred *cred)
 {
        int flags = f->f_flags;
-
-       if ((flags + 1) & O_ACCMODE)
-               flags++;
-       flags |= f->f_flags & (O_APPEND | O_TRUNC);
        /* Don't check read permission here if called from do_execve(). */
        if (current->in_execve)
                return 0;
index 586965f9605fd55d4a6cf9c8f804f01d373647bb..7a437da056465dc189619231d63dc1d0b6fb79dc 100644 (file)
@@ -768,7 +768,7 @@ static int check_codec(struct aoa_codec *codec,
                                "required property %s not present\n", propname);
                        return -ENODEV;
                }
-               if (*ref != codec->node->linux_phandle) {
+               if (*ref != codec->node->phandle) {
                        printk(KERN_INFO "snd-aoa-fabric-layout: "
                                "%s doesn't match!\n", propname);
                        return -ENODEV;
index 7872a02f6ca998602b588dc6ba4d7741c3e08c1b..563d1967a0ad9dedea75893570757cc765125b19 100644 (file)
@@ -468,5 +468,5 @@ static void __exit alsa_sound_exit(void)
        unregister_chrdev(major, "alsa");
 }
 
-module_init(alsa_sound_init)
-module_exit(alsa_sound_exit)
+subsys_initcall(alsa_sound_init);
+module_exit(alsa_sound_exit);
index 7fe12264ff80d60cba667b37804e082dc82d8ef3..0c164e5e43222b1787463fbb265084b4142d4953 100644 (file)
@@ -93,7 +93,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
        default:
                return -EINVAL;
        }
-       if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OSS_MINORS))
+       if (minor < 0 || minor >= SNDRV_OSS_MINORS)
                return -EINVAL;
        return minor;
 }
index 4191acccbcdb93fab12373847688b91103d52c65..c1070e33b32ff04a7ca3aed2f89f5532fd7ce7b0 100644 (file)
@@ -614,7 +614,8 @@ start_adc(struct au1550_state *s)
        /* Put two buffers on the ring to get things started.
        */
        for (i=0; i<2; i++) {
-               au1xxx_dbdma_put_dest(db->dmanr, db->nextIn, db->dma_fragsize);
+               au1xxx_dbdma_put_dest(db->dmanr, virt_to_phys(db->nextIn),
+                               db->dma_fragsize, DDMA_FLAGS_IE);
 
                db->nextIn += db->dma_fragsize;
                if (db->nextIn >= db->rawbuf + db->dmasize)
@@ -732,8 +733,9 @@ static void dac_dma_interrupt(int irq, void *dev_id)
        db->dma_qcount--;
 
        if (db->count >= db->fragsize) {
-               if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut,
-                                                       db->fragsize) == 0) {
+               if (au1xxx_dbdma_put_source(db->dmanr,
+                               virt_to_phys(db->nextOut), db->fragsize,
+                               DDMA_FLAGS_IE) == 0) {
                        err("qcount < 2 and no ring room!");
                }
                db->nextOut += db->fragsize;
@@ -777,7 +779,8 @@ static void adc_dma_interrupt(int irq, void *dev_id)
 
        /* Put a new empty buffer on the destination DMA.
        */
-       au1xxx_dbdma_put_dest(dp->dmanr, dp->nextIn, dp->dma_fragsize);
+       au1xxx_dbdma_put_dest(dp->dmanr, virt_to_phys(dp->nextIn),
+                             dp->dma_fragsize, DDMA_FLAGS_IE);
 
        dp->nextIn += dp->dma_fragsize;
        if (dp->nextIn >= dp->rawbuf + dp->dmasize)
@@ -1177,8 +1180,9 @@ au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos)
                 * we know the dma has stopped.
                 */
                while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) {
-                       if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut,
-                                                       db->fragsize) == 0) {
+                       if (au1xxx_dbdma_put_source(db->dmanr,
+                               virt_to_phys(db->nextOut), db->fragsize,
+                               DDMA_FLAGS_IE) == 0) {
                                err("qcount < 2 and no ring room!");
                        }
                        db->nextOut += db->fragsize;
index cb65bd0dd35ba5ccb4a0c56a40892335b7a9a706..459c1f62783b627c2988c7d95ce5935c31e698f4 100644 (file)
@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
 
 static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
 {
-       struct ct_vm *vm;
-       void *kvirt_addr;
-       unsigned long phys_addr;
-
-       vm = atc->vm;
-       kvirt_addr = vm->get_ptp_virt(vm, index);
-       if (kvirt_addr == NULL)
-               phys_addr = (~0UL);
-       else
-               phys_addr = virt_to_phys(kvirt_addr);
-
-       return phys_addr;
+       return atc->vm->get_ptp_phys(atc->vm, index);
 }
 
 static unsigned int convert_format(snd_pcm_format_t snd_format)
@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
        }
 
        /* Set up device virtual memory management object */
-       err = ct_vm_create(&atc->vm);
+       err = ct_vm_create(&atc->vm, pci);
        if (err < 0)
                goto error1;
 
index 6b78752e95036b2a4010cb6a66b39f5e3b5f708c..65da6e466f80bb27af0d466239a473436e8f40ac 100644 (file)
@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size)
                return NULL;
        }
 
-       ptp = vm->ptp[0];
+       ptp = (unsigned long *)vm->ptp[0].area;
        pte_start = (block->addr >> CT_PAGE_SHIFT);
        pages = block->size >> CT_PAGE_SHIFT;
        for (i = 0; i < pages; i++) {
@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
 }
 
 /* *
- * return the host (kmalloced) addr of the @index-th device
- * page talbe page on success, or NULL on failure.
- * The first returned NULL indicates the termination.
+ * return the host physical addr of the @index-th device
+ * page table page on success, or ~0UL on failure.
+ * The first returned ~0UL indicates the termination.
  * */
-static void *
-ct_get_ptp_virt(struct ct_vm *vm, int index)
+static dma_addr_t
+ct_get_ptp_phys(struct ct_vm *vm, int index)
 {
-       void *addr;
+       dma_addr_t addr;
 
-       addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index];
+       addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
 
        return addr;
 }
 
-int ct_vm_create(struct ct_vm **rvm)
+int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
 {
        struct ct_vm *vm;
        struct ct_vm_block *block;
-       int i;
+       int i, err = 0;
 
        *rvm = NULL;
 
@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm)
 
        /* Allocate page table pages */
        for (i = 0; i < CT_PTP_NUM; i++) {
-               vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL);
-               if (!vm->ptp[i])
+               err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
+                                         snd_dma_pci_data(pci),
+                                         PAGE_SIZE, &vm->ptp[i]);
+               if (err < 0)
                        break;
        }
-       if (!i) {
+       if (err < 0) {
                /* no page table pages are allocated */
-               kfree(vm);
+               ct_vm_destroy(vm);
                return -ENOMEM;
        }
        vm->size = CT_ADDRS_PER_PAGE * i;
-       /* Initialise remaining ptps */
-       for (; i < CT_PTP_NUM; i++)
-               vm->ptp[i] = NULL;
-
        vm->map = ct_vm_map;
        vm->unmap = ct_vm_unmap;
-       vm->get_ptp_virt = ct_get_ptp_virt;
+       vm->get_ptp_phys = ct_get_ptp_phys;
        INIT_LIST_HEAD(&vm->unused);
        INIT_LIST_HEAD(&vm->used);
        block = kzalloc(sizeof(*block), GFP_KERNEL);
@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm)
 
        /* free allocated page table pages */
        for (i = 0; i < CT_PTP_NUM; i++)
-               kfree(vm->ptp[i]);
+               snd_dma_free_pages(&vm->ptp[i]);
 
        vm->size = 0;
 
index 01e4fd0386a332193dfaa834516a79e25c10e970..b23adfca4de6eb90f0dbbf08fda38696df5cac61 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <linux/mutex.h>
 #include <linux/list.h>
+#include <linux/pci.h>
+#include <sound/memalloc.h>
 
 /* The chip can handle the page table of 4k pages
  * (emu20k1 can handle even 8k pages, but we don't use it right now)
@@ -41,7 +43,7 @@ struct snd_pcm_substream;
 
 /* Virtual memory management object for card device */
 struct ct_vm {
-       void *ptp[CT_PTP_NUM];          /* Device page table pages */
+       struct snd_dma_buffer ptp[CT_PTP_NUM];  /* Device page table pages */
        unsigned int size;              /* Available addr space in bytes */
        struct list_head unused;        /* List of unused blocks */
        struct list_head used;          /* List of used blocks */
@@ -52,10 +54,10 @@ struct ct_vm {
                                   int size);
        /* Unmap device logical addr area. */
        void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
-       void *(*get_ptp_virt)(struct ct_vm *vm, int index);
+       dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
 };
 
-int ct_vm_create(struct ct_vm **rvm);
+int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
 void ct_vm_destroy(struct ct_vm *vm);
 
 #endif /* CTVMEM_H */
index ec9c348336cc383d5bb2902bc1e525bdda1afd96..ff6da6f386d14c7ecdd0975723552680d5080b46 100644 (file)
@@ -426,6 +426,7 @@ struct azx {
 
        /* flags */
        int position_fix;
+       int poll_count;
        unsigned int running :1;
        unsigned int initialized :1;
        unsigned int single_cmd :1;
@@ -506,7 +507,7 @@ static char *driver_short_names[] __devinitdata = {
 #define get_azx_dev(substream) (substream->runtime->private_data)
 
 static int azx_acquire_irq(struct azx *chip, int do_disconnect);
-
+static int azx_send_cmd(struct hda_bus *bus, unsigned int val);
 /*
  * Interface for HD codec
  */
@@ -664,11 +665,12 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
 {
        struct azx *chip = bus->private_data;
        unsigned long timeout;
+       int do_poll = 0;
 
  again:
        timeout = jiffies + msecs_to_jiffies(1000);
        for (;;) {
-               if (chip->polling_mode) {
+               if (chip->polling_mode || do_poll) {
                        spin_lock_irq(&chip->reg_lock);
                        azx_update_rirb(chip);
                        spin_unlock_irq(&chip->reg_lock);
@@ -676,6 +678,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
                if (!chip->rirb.cmds[addr]) {
                        smp_rmb();
                        bus->rirb_error = 0;
+
+                       if (!do_poll)
+                               chip->poll_count = 0;
                        return chip->rirb.res[addr]; /* the last value */
                }
                if (time_after(jiffies, timeout))
@@ -688,6 +693,16 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
                }
        }
 
+       if (!chip->polling_mode && chip->poll_count < 2) {
+               snd_printdd(SFX "azx_get_response timeout, "
+                          "polling the codec once: last cmd=0x%08x\n",
+                          chip->last_cmd[addr]);
+               do_poll = 1;
+               chip->poll_count++;
+               goto again;
+       }
+
+
        if (!chip->polling_mode) {
                snd_printk(KERN_WARNING SFX "azx_get_response timeout, "
                           "switching to polling mode: last cmd=0x%08x\n",
@@ -1878,6 +1893,9 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
 
        if (!bdl_pos_adj[chip->dev_index])
                return 1; /* no delayed ack */
+       if (WARN_ONCE(!azx_dev->period_bytes,
+                     "hda-intel: zero azx_dev->period_bytes"))
+               return 0; /* this shouldn't happen! */
        if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
                return 0; /* NG - it's below the period boundary */
        return 1; /* OK, it's fine */
@@ -2043,7 +2061,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 {
        if (request_irq(chip->pci->irq, azx_interrupt,
                        chip->msi ? 0 : IRQF_SHARED,
-                       "HDA Intel", chip)) {
+                       "hda_intel", chip)) {
                printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
                       "disabling device\n", chip->pci->irq);
                if (do_disconnect)
@@ -2332,6 +2350,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
  */
 static struct snd_pci_quirk msi_black_list[] __devinitdata = {
        SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
+       SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
        {}
 };
 
index e3caa78ccd547b2acf046fddfe24d25a9e22cb86..da34095c707fd7b19fb33156248fc6461a7090e0 100644 (file)
@@ -1093,6 +1093,16 @@ static void alc889_coef_init(struct hda_codec *codec)
        snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
 }
 
+/* turn on/off EAPD control (only if available) */
+static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
+{
+       if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
+               return;
+       if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
+               snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
+                                   on ? 2 : 0);
+}
+
 static void alc_auto_init_amp(struct hda_codec *codec, int type)
 {
        unsigned int tmp;
@@ -1110,25 +1120,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
        case ALC_INIT_DEFAULT:
                switch (codec->vendor_id) {
                case 0x10ec0260:
-                       snd_hda_codec_write(codec, 0x0f, 0,
-                                           AC_VERB_SET_EAPD_BTLENABLE, 2);
-                       snd_hda_codec_write(codec, 0x10, 0,
-                                           AC_VERB_SET_EAPD_BTLENABLE, 2);
+                       set_eapd(codec, 0x0f, 1);
+                       set_eapd(codec, 0x10, 1);
                        break;
                case 0x10ec0262:
                case 0x10ec0267:
                case 0x10ec0268:
                case 0x10ec0269:
+               case 0x10ec0270:
                case 0x10ec0272:
                case 0x10ec0660:
                case 0x10ec0662:
                case 0x10ec0663:
                case 0x10ec0862:
                case 0x10ec0889:
-                       snd_hda_codec_write(codec, 0x14, 0,
-                                           AC_VERB_SET_EAPD_BTLENABLE, 2);
-                       snd_hda_codec_write(codec, 0x15, 0,
-                                           AC_VERB_SET_EAPD_BTLENABLE, 2);
+                       set_eapd(codec, 0x14, 1);
+                       set_eapd(codec, 0x15, 1);
                        break;
                }
                switch (codec->vendor_id) {
@@ -1230,6 +1237,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
                        return; /* invalid entry */
                }
        }
+       if (!ext || !fixed)
+               return;
        if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
                return; /* no unsol support */
        snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -1834,10 +1843,8 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 static void alc889_power_eapd(struct hda_codec *codec, int power)
 {
-       snd_hda_codec_write(codec, 0x14, 0,
-                           AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
-       snd_hda_codec_write(codec, 0x15, 0,
-                           AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
+       set_eapd(codec, 0x14, power);
+       set_eapd(codec, 0x15, power);
 }
 #endif
 
@@ -4812,6 +4819,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
        spec->auto_mic = 0; /* disable auto-mic to be sure */
 }
 
+/* choose the ADC/MUX containing the input pin and initialize the setup */
+static void fixup_single_adc(struct hda_codec *codec)
+{
+       struct alc_spec *spec = codec->spec;
+       hda_nid_t pin;
+       int i;
+
+       /* search for the input pin; there must be only one */
+       for (i = 0; i < AUTO_PIN_LAST; i++) {
+               if (spec->autocfg.input_pins[i]) {
+                       pin = spec->autocfg.input_pins[i];
+                       break;
+               }
+       }
+       if (!pin)
+               return;
+
+       /* set the default connection to that pin */
+       for (i = 0; i < spec->num_adc_nids; i++) {
+               hda_nid_t cap = spec->capsrc_nids ?
+                       spec->capsrc_nids[i] : spec->adc_nids[i];
+               int idx;
+
+               idx = get_connection_index(codec, cap, pin);
+               if (idx < 0)
+                       continue;
+               /* use only this ADC */
+               if (spec->capsrc_nids)
+                       spec->capsrc_nids += i;
+               spec->adc_nids += i;
+               spec->num_adc_nids = 1;
+               /* select or unmute this route */
+               if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
+                       snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
+                                                HDA_AMP_MUTE, 0);
+               } else {
+                       snd_hda_codec_write_cache(codec, cap, 0,
+                                         AC_VERB_SET_CONNECT_SEL, idx);
+               }
+               return;
+       }
+}
+
 static void set_capture_mixer(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
@@ -4824,14 +4874,15 @@ static void set_capture_mixer(struct hda_codec *codec)
                  alc_capture_mixer3 },
        };
        if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
-               int mux;
-               if (spec->auto_mic) {
-                       mux = 0;
+               int mux = 0;
+               if (spec->auto_mic)
                        fixup_automic_adc(codec);
-               } else if (spec->input_mux && spec->input_mux->num_items > 1)
-                       mux = 1;
-               else
-                       mux = 0;
+               else if (spec->input_mux) {
+                       if (spec->input_mux->num_items > 1)
+                               mux = 1;
+                       else if (spec->input_mux->num_items == 1)
+                               fixup_single_adc(codec);
+               }
                spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
        }
 }
@@ -7094,8 +7145,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
        HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
        HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
        HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
-       HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
-       HDA_BIND_MUTE   ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
+       HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
+       HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
        HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7496,6 +7547,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
        {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
+       {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
        /* Front Mic pin: input vref at 80% */
        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7680,6 +7732,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
        spec->autocfg.speaker_pins[0] = 0x14;
 }
 
+static void alc885_mb5_automute(struct hda_codec *codec)
+{
+       unsigned int present;
+
+       present = snd_hda_codec_read(codec, 0x14, 0,
+                                    AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+       snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
+                                HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
+       snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
+                                HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
+
+}
+
+static void alc885_mb5_unsol_event(struct hda_codec *codec,
+                                   unsigned int res)
+{
+       /* Headphone insertion or removal. */
+       if ((res >> 26) == ALC880_HP_EVENT)
+               alc885_mb5_automute(codec);
+}
+
 static void alc885_imac91_automute(struct hda_codec *codec)
 {
        unsigned int present;
@@ -9126,6 +9199,8 @@ static struct alc_config_preset alc882_presets[] = {
                .input_mux = &mb5_capture_source,
                .dig_out_nid = ALC882_DIGOUT_NID,
                .dig_in_nid = ALC882_DIGIN_NID,
+               .unsol_event = alc885_mb5_unsol_event,
+               .init_hook = alc885_mb5_automute,
        },
        [ALC885_MACPRO] = {
                .mixers = { alc882_macpro_mixer },
@@ -9403,6 +9478,7 @@ static struct alc_config_preset alc882_presets[] = {
                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
                .channel_mode = alc883_3ST_6ch_modes,
                .need_dac_fix = 1,
+               .const_channel_count = 6,
                .num_mux_defs =
                        ARRAY_SIZE(alc888_2_capture_sources),
                .input_mux = alc888_2_capture_sources,
@@ -10307,7 +10383,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
        struct alc_spec *spec = codec->spec;
 
        spec->autocfg.hp_pins[0] = 0x15;
-       spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
+       spec->autocfg.speaker_pins[0] = 0x14;
 }
 
 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
@@ -11179,7 +11255,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
 }
 
 #define alc262_auto_create_input_ctls \
-       alc880_auto_create_input_ctls
+       alc882_auto_create_input_ctls
 
 /*
  * generic initialization of ADC, input mixers and output mixers
@@ -11718,9 +11794,9 @@ static struct alc_config_preset alc262_presets[] = {
                .num_channel_mode = ARRAY_SIZE(alc262_modes),
                .channel_mode = alc262_modes,
                .input_mux = &alc262_capture_source,
-               .unsol_event = alc_automute_amp_unsol_event,
+               .unsol_event = alc_sku_unsol_event,
                .setup = alc262_hp_t5735_setup,
-               .init_hook = alc_automute_amp,
+               .init_hook = alc_inithook,
        },
        [ALC262_HP_RP5700] = {
                .mixers = { alc262_hp_rp5700_mixer },
@@ -12471,6 +12547,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
                dac = 0x02;
                break;
        case 0x15:
+       case 0x21:
                dac = 0x03;
                break;
        default:
@@ -14855,6 +14932,8 @@ static int patch_alc861(struct hda_codec *codec)
        spec->stream_digital_playback = &alc861_pcm_digital_playback;
        spec->stream_digital_capture = &alc861_pcm_digital_capture;
 
+       if (!spec->cap_mixer)
+               set_capture_mixer(codec);
        set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
 
        spec->vmaster_nid = 0x03;
@@ -17251,7 +17330,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
        SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
        SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
                      ALC662_3ST_6ch_DIG),
-       SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
+       SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
        SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
                      ALC662_3ST_6ch_DIG),
index 2291a839681795606ee9333920627966c577069d..799ba2570902a066ead90e38a1ce17e5b351f4e8 100644 (file)
@@ -4730,6 +4730,26 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
        }
 }
 
+static int hp_blike_system(u32 subsystem_id);
+
+static void set_hp_led_gpio(struct hda_codec *codec)
+{
+       struct sigmatel_spec *spec = codec->spec;
+       switch (codec->vendor_id) {
+       case 0x111d7608:
+               /* GPIO 0 */
+               spec->gpio_led = 0x01;
+               break;
+       case 0x111d7600:
+       case 0x111d7601:
+       case 0x111d7602:
+       case 0x111d7603:
+               /* GPIO 3 */
+               spec->gpio_led = 0x08;
+               break;
+       }
+}
+
 /*
  * This method searches for the mute LED GPIO configuration
  * provided as OEM string in SMBIOS. The format of that string
@@ -4741,6 +4761,14 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
  *
  * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
  * or  HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
+ *
+ *
+ * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
+ * SMBIOS - at least the ones I have seen do not have them - which include
+ * my own system (HP Pavilion dv6-1110ax) and my cousin's
+ * HP Pavilion dv9500t CTO.
+ * Need more information on whether it is true across the entire series.
+ * -- kunal
  */
 static int find_mute_led_gpio(struct hda_codec *codec)
 {
@@ -4751,28 +4779,27 @@ static int find_mute_led_gpio(struct hda_codec *codec)
                while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
                                                                NULL, dev))) {
                        if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
-                             &spec->gpio_led_polarity,
-                             &spec->gpio_led) == 2) {
+                                 &spec->gpio_led_polarity,
+                                 &spec->gpio_led) == 2) {
                                spec->gpio_led = 1 << spec->gpio_led;
                                return 1;
                        }
                        if (sscanf(dev->name, "HP_Mute_LED_%d",
-                             &spec->gpio_led_polarity) == 1) {
-                               switch (codec->vendor_id) {
-                               case 0x111d7608:
-                                       /* GPIO 0 */
-                                       spec->gpio_led = 0x01;
-                                       return 1;
-                               case 0x111d7600:
-                               case 0x111d7601:
-                               case 0x111d7602:
-                               case 0x111d7603:
-                                       /* GPIO 3 */
-                                       spec->gpio_led = 0x08;
-                                       return 1;
-                               }
+                                 &spec->gpio_led_polarity) == 1) {
+                               set_hp_led_gpio(codec);
+                               return 1;
                        }
                }
+
+               /*
+                * Fallback case - if we don't find the DMI strings,
+                * we statically set the GPIO - if not a B-series system.
+                */
+               if (!hp_blike_system(codec->subsystem_id)) {
+                       set_hp_led_gpio(codec);
+                       spec->gpio_led_polarity = 1;
+                       return 1;
+               }
        }
        return 0;
 }
@@ -5548,6 +5575,8 @@ again:
        spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
        spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
 
+       snd_printdd("Found board config: %d\n", spec->board_config);
+
        switch (spec->board_config) {
        case STAC_HP_M4:
                /* enable internal microphone */
index 765d7bd4c3d4c34e1df1421adc3a5d598760ec81..9e66f6d306f8fb91aed0b45f2a7168706278edb4 100644 (file)
@@ -703,11 +703,13 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
 {
        unsigned char nvol;
 
-       if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE))
+       if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) {
                nvol = 0;
-       else
+       } else {
                nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
                                                                WM_VOL_MAX;
+               nvol += 0x1b;
+       }
 
        wm_put(ice, index, nvol);
        wm_put_nocache(ice, index, 0x180 | nvol);
@@ -778,7 +780,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        for (ch = 0; ch < 2; ch++) {
                unsigned int vol = ucontrol->value.integer.value[ch];
                if (vol > WM_VOL_MAX)
-                       continue;
+                       vol = WM_VOL_MAX;
                vol |= spec->master[ch] & WM_VOL_MUTE;
                if (vol != spec->master[ch]) {
                        int dac;
@@ -834,8 +836,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
        for (i = 0; i < voices; i++) {
                unsigned int vol = ucontrol->value.integer.value[i];
                if (vol > WM_VOL_MAX)
-                       continue;
-               vol |= spec->vol[ofs+i];
+                       vol = WM_VOL_MAX;
+               vol |= spec->vol[ofs+i] & WM_VOL_MUTE;
                if (vol != spec->vol[ofs+i]) {
                        spec->vol[ofs+i] = vol;
                        idx  = WM_DAC_ATTEN + ofs + i;
index 2e156467b814bf48c94ee902f363995a49cde6f6..b36679384b27b6ab1486481d15a6e779c9c6a126 100644 (file)
@@ -751,8 +751,8 @@ static void snd_pmac_awacs_suspend(struct snd_pmac *chip)
 
 static void snd_pmac_awacs_resume(struct snd_pmac *chip)
 {
-       if (machine_is_compatible("PowerBook3,1")
-           || machine_is_compatible("PowerBook3,2")) {
+       if (of_machine_is_compatible("PowerBook3,1")
+           || of_machine_is_compatible("PowerBook3,2")) {
                msleep(100);
                snd_pmac_awacs_write_reg(chip, 1,
                        chip->awacs_reg[1] & ~MASK_PAROUT);
@@ -780,16 +780,16 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
 }
 #endif /* CONFIG_PM */
 
-#define IS_PM7500 (machine_is_compatible("AAPL,7500") \
-               || machine_is_compatible("AAPL,8500") \
-               || machine_is_compatible("AAPL,9500"))
-#define IS_PM5500 (machine_is_compatible("AAPL,e411"))
-#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
-#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
-#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
-               || machine_is_compatible("PowerMac4,1"))
-#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
-#define IS_LOMBARD (machine_is_compatible("PowerBook1,1"))
+#define IS_PM7500 (of_machine_is_compatible("AAPL,7500") \
+               || of_machine_is_compatible("AAPL,8500") \
+               || of_machine_is_compatible("AAPL,9500"))
+#define IS_PM5500 (of_machine_is_compatible("AAPL,e411"))
+#define IS_BEIGE (of_machine_is_compatible("AAPL,Gossamer"))
+#define IS_IMAC1 (of_machine_is_compatible("PowerMac2,1"))
+#define IS_IMAC2 (of_machine_is_compatible("PowerMac2,2") \
+               || of_machine_is_compatible("PowerMac4,1"))
+#define IS_G4AGP (of_machine_is_compatible("PowerMac3,1"))
+#define IS_LOMBARD (of_machine_is_compatible("PowerBook1,1"))
 
 static int imac1, imac2;
 
index 0accfe49735bad21718be559ae110c657f15ceb0..1f72e1c786bf2f389e18788bd3b304287312617a 100644 (file)
@@ -582,7 +582,7 @@ static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip)
 static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify)
 {
        if (chip->auto_mute) {
-               int imac = machine_is_compatible("iMac");
+               int imac = of_machine_is_compatible("iMac");
                int reg, oreg;
                reg = oreg = snd_pmac_burgundy_rcb(chip,
                                MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES);
@@ -620,7 +620,7 @@ static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_noti
  */
 int __devinit snd_pmac_burgundy_init(struct snd_pmac *chip)
 {
-       int imac = machine_is_compatible("iMac");
+       int imac = of_machine_is_compatible("iMac");
        int i, err;
 
        /* Checks to see the chip is alive and kicking */
index 7bc492ee77ecf1978f659e5180e62e55fb990cd9..85081172403f25ec056a99eb58a341fbd5d57370 100644 (file)
@@ -922,11 +922,11 @@ static void __devinit detect_byte_swap(struct snd_pmac *chip)
        }
 
        /* it seems the Pismo & iBook can't byte-swap in hardware. */
-       if (machine_is_compatible("PowerBook3,1") ||
-           machine_is_compatible("PowerBook2,1"))
+       if (of_machine_is_compatible("PowerBook3,1") ||
+           of_machine_is_compatible("PowerBook2,1"))
                chip->can_byte_swap = 0 ;
 
-       if (machine_is_compatible("PowerBook2,1"))
+       if (of_machine_is_compatible("PowerBook2,1"))
                chip->can_duplex = 0;
 }
 
@@ -959,11 +959,11 @@ static int __devinit snd_pmac_detect(struct snd_pmac *chip)
        chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */
 
        /* check machine type */
-       if (machine_is_compatible("AAPL,3400/2400")
-           || machine_is_compatible("AAPL,3500"))
+       if (of_machine_is_compatible("AAPL,3400/2400")
+           || of_machine_is_compatible("AAPL,3500"))
                chip->is_pbook_3400 = 1;
-       else if (machine_is_compatible("PowerBook1,1")
-                || machine_is_compatible("AAPL,PowerBook1998"))
+       else if (of_machine_is_compatible("PowerBook1,1")
+                || of_machine_is_compatible("AAPL,PowerBook1998"))
                chip->is_pbook_G3 = 1;
        chip->node = of_find_node_by_name(NULL, "awacs");
        sound = of_node_get(chip->node);
@@ -1033,8 +1033,8 @@ static int __devinit snd_pmac_detect(struct snd_pmac *chip)
        }
        if (of_device_is_compatible(sound, "tumbler")) {
                chip->model = PMAC_TUMBLER;
-               chip->can_capture = machine_is_compatible("PowerMac4,2")
-                               || machine_is_compatible("PowerBook4,1");
+               chip->can_capture = of_machine_is_compatible("PowerMac4,2")
+                               || of_machine_is_compatible("PowerBook4,1");
                chip->can_duplex = 0;
                // chip->can_byte_swap = 0; /* FIXME: check this */
                chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
index 410a893aa66be2252273cf17864a029675d72944..4b67140fdec3cb8e98b8ecc39dc54c8e8160ea86 100644 (file)
@@ -22,11 +22,13 @@ config SND_SOC_AU1XPSC_AC97
 ##
 ## Boards
 ##
-config SND_SOC_SAMPLE_PSC_AC97
-       tristate "Sample Au12x0/Au1550 PSC AC97 sound machine"
+config SND_SOC_DB1200
+       tristate "DB1200 AC97+I2S audio support"
        depends on SND_SOC_AU1XPSC
        select SND_SOC_AU1XPSC_AC97
        select SND_SOC_AC97_CODEC
+       select SND_SOC_AU1XPSC_I2S
+       select SND_SOC_WM8731
        help
-         This is a sample AC97 sound machine for use in Au12x0/Au1550
-         based systems which have audio on PSC1 (e.g. Db1200 demoboard).
+         Select this option to enable audio (AC97 or I2S) on the
+         Alchemy/AMD/RMI DB1200 demoboard.
index 6c6950b8003a834b9064ef7e6ffab77a11c211fc..16873076e8c44044a803076eff2cfabcd53cc000 100644 (file)
@@ -8,6 +8,6 @@ obj-$(CONFIG_SND_SOC_AU1XPSC_I2S) += snd-soc-au1xpsc-i2s.o
 obj-$(CONFIG_SND_SOC_AU1XPSC_AC97) += snd-soc-au1xpsc-ac97.o
 
 # Boards
-snd-soc-sample-ac97-objs := sample-ac97.o
+snd-soc-db1200-objs := db1200.o
 
-obj-$(CONFIG_SND_SOC_SAMPLE_PSC_AC97) += snd-soc-sample-ac97.o
+obj-$(CONFIG_SND_SOC_DB1200) += snd-soc-db1200.o
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
new file mode 100644 (file)
index 0000000..cdf7be1
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * DB1200 ASoC audio fabric support code.
+ *
+ * (c) 2008-9 Manuel Lauss <manuel.lauss@gmail.com>
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-au1x00/au1xxx_psc.h>
+#include <asm/mach-au1x00/au1xxx_dbdma.h>
+#include <asm/mach-db1x00/bcsr.h>
+
+#include "../codecs/ac97.h"
+#include "../codecs/wm8731.h"
+#include "psc.h"
+
+/*-------------------------  AC97 PART  ---------------------------*/
+
+static struct snd_soc_dai_link db1200_ac97_dai = {
+       .name           = "AC97",
+       .stream_name    = "AC97 HiFi",
+       .cpu_dai        = &au1xpsc_ac97_dai,
+       .codec_dai      = &ac97_dai,
+};
+
+static struct snd_soc_card db1200_ac97_machine = {
+       .name           = "DB1200_AC97",
+       .dai_link       = &db1200_ac97_dai,
+       .num_links      = 1,
+       .platform       = &au1xpsc_soc_platform,
+};
+
+static struct snd_soc_device db1200_ac97_devdata = {
+       .card           = &db1200_ac97_machine,
+       .codec_dev      = &soc_codec_dev_ac97,
+};
+
+/*-------------------------  I2S PART  ---------------------------*/
+
+static int db1200_i2s_startup(struct snd_pcm_substream *substream)
+{
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+       struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+       int ret;
+
+       /* WM8731 has its own 12MHz crystal */
+       snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK,
+                               12000000, SND_SOC_CLOCK_IN);
+
+       /* codec is bitclock and lrclk master */
+       ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J |
+                       SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
+       if (ret < 0)
+               goto out;
+
+       ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_LEFT_J |
+                       SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
+       if (ret < 0)
+               goto out;
+
+       ret = 0;
+out:
+       return ret;
+}
+
+static struct snd_soc_ops db1200_i2s_wm8731_ops = {
+       .startup        = db1200_i2s_startup,
+};
+
+static struct snd_soc_dai_link db1200_i2s_dai = {
+       .name           = "WM8731",
+       .stream_name    = "WM8731 PCM",
+       .cpu_dai        = &au1xpsc_i2s_dai,
+       .codec_dai      = &wm8731_dai,
+       .ops            = &db1200_i2s_wm8731_ops,
+};
+
+static struct snd_soc_card db1200_i2s_machine = {
+       .name           = "DB1200_I2S",
+       .dai_link       = &db1200_i2s_dai,
+       .num_links      = 1,
+       .platform       = &au1xpsc_soc_platform,
+};
+
+static struct snd_soc_device db1200_i2s_devdata = {
+       .card           = &db1200_i2s_machine,
+       .codec_dev      = &soc_codec_dev_wm8731,
+};
+
+/*-------------------------  COMMON PART  ---------------------------*/
+
+static struct platform_device *db1200_asoc_dev;
+
+static int __init db1200_audio_load(void)
+{
+       int ret;
+
+       ret = -ENOMEM;
+       db1200_asoc_dev = platform_device_alloc("soc-audio", -1);
+       if (!db1200_asoc_dev)
+               goto out;
+
+       /* DB1200 board setup set PSC1MUX to preferred audio device */
+       if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX)
+               platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_devdata);
+       else
+               platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_devdata);
+
+       db1200_ac97_devdata.dev = &db1200_asoc_dev->dev;
+       db1200_i2s_devdata.dev = &db1200_asoc_dev->dev;
+       ret = platform_device_add(db1200_asoc_dev);
+
+       if (ret) {
+               platform_device_put(db1200_asoc_dev);
+               db1200_asoc_dev = NULL;
+       }
+out:
+       return ret;
+}
+
+static void __exit db1200_audio_unload(void)
+{
+       platform_device_unregister(db1200_asoc_dev);
+}
+
+module_init(db1200_audio_load);
+module_exit(db1200_audio_unload);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("DB1200 ASoC audio support");
+MODULE_AUTHOR("Manuel Lauss");
index 19e4d37eba1cf2c253c1e098aa52b8798d3b766a..6d9f4c624949ed65906433a2efc2caa33bde841d 100644 (file)
@@ -51,8 +51,8 @@ struct au1xpsc_audio_dmadata {
        struct snd_pcm_substream *substream;
        unsigned long curr_period;      /* current segment DDMA is working on */
        unsigned long q_period;         /* queue period(s) */
-       unsigned long dma_area;         /* address of queued DMA area */
-       unsigned long dma_area_s;       /* start address of DMA area */
+       dma_addr_t dma_area;            /* address of queued DMA area */
+       dma_addr_t dma_area_s;          /* start address of DMA area */
        unsigned long pos;              /* current byte position being played */
        unsigned long periods;          /* number of SG segments in total */
        unsigned long period_bytes;     /* size in bytes of one SG segment */
@@ -94,8 +94,7 @@ static const struct snd_pcm_hardware au1xpsc_pcm_hardware = {
 
 static void au1x_pcm_queue_tx(struct au1xpsc_audio_dmadata *cd)
 {
-       au1xxx_dbdma_put_source_flags(cd->ddma_chan,
-                               (void *)phys_to_virt(cd->dma_area),
+       au1xxx_dbdma_put_source(cd->ddma_chan, cd->dma_area,
                                cd->period_bytes, DDMA_FLAGS_IE);
 
        /* update next-to-queue period */
@@ -109,9 +108,8 @@ static void au1x_pcm_queue_tx(struct au1xpsc_audio_dmadata *cd)
 
 static void au1x_pcm_queue_rx(struct au1xpsc_audio_dmadata *cd)
 {
-       au1xxx_dbdma_put_dest_flags(cd->ddma_chan,
-                               (void *)phys_to_virt(cd->dma_area),
-                               cd->period_bytes, DDMA_FLAGS_IE);
+       au1xxx_dbdma_put_dest(cd->ddma_chan, cd->dma_area,
+                             cd->period_bytes, DDMA_FLAGS_IE);
 
        /* update next-to-queue period */
        ++cd->q_period;
@@ -233,7 +231,7 @@ static int au1xpsc_pcm_hw_params(struct snd_pcm_substream *substream,
        pcd->substream = substream;
        pcd->period_bytes = params_period_bytes(params);
        pcd->periods = params_periods(params);
-       pcd->dma_area_s = pcd->dma_area = (unsigned long)runtime->dma_addr;
+       pcd->dma_area_s = pcd->dma_area = runtime->dma_addr;
        pcd->q_period = 0;
        pcd->curr_period = 0;
        pcd->pos = 0;
diff --git a/sound/soc/au1x/sample-ac97.c b/sound/soc/au1x/sample-ac97.c
deleted file mode 100644 (file)
index 27683eb..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Sample Au12x0/Au1550 PSC AC97 sound machine.
- *
- * Copyright (c) 2007-2008 Manuel Lauss <mano@roarinelk.homelinux.net>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms outlined in the file COPYING at the root of this
- *  source archive.
- *
- * This is a very generic AC97 sound machine driver for boards which
- * have (AC97) audio at PSC1 (e.g. DB1200 demoboards).
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-au1x00/au1xxx_psc.h>
-#include <asm/mach-au1x00/au1xxx_dbdma.h>
-
-#include "../codecs/ac97.h"
-#include "psc.h"
-
-static int au1xpsc_sample_ac97_init(struct snd_soc_codec *codec)
-{
-       snd_soc_dapm_sync(codec);
-       return 0;
-}
-
-static struct snd_soc_dai_link au1xpsc_sample_ac97_dai = {
-       .name           = "AC97",
-       .stream_name    = "AC97 HiFi",
-       .cpu_dai        = &au1xpsc_ac97_dai,    /* see psc-ac97.c */
-       .codec_dai      = &ac97_dai,            /* see codecs/ac97.c */
-       .init           = au1xpsc_sample_ac97_init,
-       .ops            = NULL,
-};
-
-static struct snd_soc_card au1xpsc_sample_ac97_machine = {
-       .name           = "Au1xxx PSC AC97 Audio",
-       .dai_link       = &au1xpsc_sample_ac97_dai,
-       .num_links      = 1,
-};
-
-static struct snd_soc_device au1xpsc_sample_ac97_devdata = {
-       .card           = &au1xpsc_sample_ac97_machine,
-       .platform       = &au1xpsc_soc_platform, /* see dbdma2.c */
-       .codec_dev      = &soc_codec_dev_ac97,
-};
-
-static struct resource au1xpsc_psc1_res[] = {
-       [0] = {
-               .start  = CPHYSADDR(PSC1_BASE_ADDR),
-               .end    = CPHYSADDR(PSC1_BASE_ADDR) + 0x000fffff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-#ifdef CONFIG_SOC_AU1200
-               .start  = AU1200_PSC1_INT,
-               .end    = AU1200_PSC1_INT,
-#elif defined(CONFIG_SOC_AU1550)
-               .start  = AU1550_PSC1_INT,
-               .end    = AU1550_PSC1_INT,
-#endif
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = {
-               .start  = DSCR_CMD0_PSC1_TX,
-               .end    = DSCR_CMD0_PSC1_TX,
-               .flags  = IORESOURCE_DMA,
-       },
-       [3] = {
-               .start  = DSCR_CMD0_PSC1_RX,
-               .end    = DSCR_CMD0_PSC1_RX,
-               .flags  = IORESOURCE_DMA,
-       },
-};
-
-static struct platform_device *au1xpsc_sample_ac97_dev;
-
-static int __init au1xpsc_sample_ac97_load(void)
-{
-       int ret;
-
-#ifdef CONFIG_SOC_AU1200
-       unsigned long io;
-
-       /* modify sys_pinfunc for AC97 on PSC1 */
-       io = au_readl(SYS_PINFUNC);
-       io |= SYS_PINFUNC_P1C;
-       io &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B);
-       au_writel(io, SYS_PINFUNC);
-       au_sync();
-#endif
-
-       ret = -ENOMEM;
-
-       /* setup PSC clock source for AC97 part: external clock provided
-        * by codec.  The psc-ac97.c driver depends on this setting!
-        */
-       au_writel(PSC_SEL_CLK_SERCLK, PSC1_BASE_ADDR + PSC_SEL_OFFSET);
-       au_sync();
-
-       au1xpsc_sample_ac97_dev = platform_device_alloc("soc-audio", -1);
-       if (!au1xpsc_sample_ac97_dev)
-               goto out;
-
-       au1xpsc_sample_ac97_dev->resource =
-               kmemdup(au1xpsc_psc1_res, sizeof(struct resource) *
-                       ARRAY_SIZE(au1xpsc_psc1_res), GFP_KERNEL);
-       au1xpsc_sample_ac97_dev->num_resources = ARRAY_SIZE(au1xpsc_psc1_res);
-       au1xpsc_sample_ac97_dev->id = 1;
-
-       platform_set_drvdata(au1xpsc_sample_ac97_dev,
-                            &au1xpsc_sample_ac97_devdata);
-       au1xpsc_sample_ac97_devdata.dev = &au1xpsc_sample_ac97_dev->dev;
-       ret = platform_device_add(au1xpsc_sample_ac97_dev);
-
-       if (ret) {
-               platform_device_put(au1xpsc_sample_ac97_dev);
-               au1xpsc_sample_ac97_dev = NULL;
-       }
-
-out:
-       return ret;
-}
-
-static void __exit au1xpsc_sample_ac97_exit(void)
-{
-       platform_device_unregister(au1xpsc_sample_ac97_dev);
-}
-
-module_init(au1xpsc_sample_ac97_load);
-module_exit(au1xpsc_sample_ac97_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Au1xxx PSC sample AC97 machine");
-MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
index a9dc5fb54774e6fd373433e3c85acece1083c283..da589d8664d0d52ce44d6cc0efc7f57981cfdd69 100644 (file)
@@ -627,7 +627,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
        u16 reg;
 
        /* Sync reg_cache with the hardware */
-       for (reg = 0; reg < TLV320AIC23_RESET; reg++) {
+       for (reg = 0; reg <= TLV320AIC23_ACTIVE; reg++) {
                u16 val = tlv320aic23_read_reg_cache(codec, reg);
                tlv320aic23_write(codec, reg, val);
        }
index ce5515e3f2b0bb9852e856b49e1ddec0fa430511..3595bd57c4eb8911bf7a63a8122028a746aaf931 100644 (file)
@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev)
        struct i2c_client *i2c = codec->control_data;
        int i;
        u16 *reg_cache = codec->reg_cache;
-       u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults),
+       u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
                                 GFP_KERNEL);
 
        /* Bring the codec back up to standby first to minimise pop/clicks */
@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev)
                for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
                        if (tmp_cache[i] != reg_cache[i])
                                snd_soc_write(codec, i, tmp_cache[i]);
+               kfree(tmp_cache);
        } else {
                dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
        }
index 3326e2a1e8633a9ee357541c687536ec701f6f62..1a5b8e0d6a34d986fcfb62c5ac0c7cdc6ad9f2b7 100644 (file)
@@ -55,7 +55,7 @@ static __init int efika_fabric_init(void)
        struct platform_device *pdev;
        int rc;
 
-       if (!machine_is_compatible("bplan,efika"))
+       if (!of_machine_is_compatible("bplan,efika"))
                return -ENODEV;
 
        card.platform = &mpc5200_audio_dma_platform;
index b928ef7d28eb82461e7ac3513bef6534d2addf75..6644cba7cbf20e5a16e75ad459df1c2663afcc93 100644 (file)
@@ -55,7 +55,7 @@ static __init int pcm030_fabric_init(void)
        struct platform_device *pdev;
        int rc;
 
-       if (!machine_is_compatible("phytec,pcm030"))
+       if (!of_machine_is_compatible("phytec,pcm030"))
                return -ENODEV;
 
        card.platform = &mpc5200_audio_dma_platform;
index 3db8a6c523f466e0bf491a82a99853bbd2be784a..19283e5edfbf8b4fbcb9af817408bb954f23bd39 100644 (file)
@@ -25,7 +25,7 @@ obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
 obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o
-obj-$(CONFIG_SND_OMAP_SOC_OMAP3517EVM) += snd-soc-am3517evm.o
+obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
 obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
index 71b2c161158d5fb5c3271bdf0211efc2a9656719..68980c19a3bced48ed463460ba9e40454d36fcc4 100644 (file)
@@ -145,6 +145,7 @@ static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
 };
 
 static const struct snd_soc_dapm_route omap3pandora_out_map[] = {
+       {"PCM DAC", NULL, "APLL Enable"},
        {"Headphone Amplifier", NULL, "PCM DAC"},
        {"Line Out", NULL, "PCM DAC"},
        {"Headphone Jack", NULL, "Headphone Amplifier"},
index dbca7c909a31ea305fe5fa543c6ca9c930fee794..7c2d677a2df529d1055d3727f3158f2cbda8e73b 100644 (file)
@@ -61,7 +61,7 @@ static void __exit cleanup_soundcore(void)
        class_destroy(sound_class);
 }
 
-module_init(init_soundcore);
+subsys_initcall(init_soundcore);
 module_exit(cleanup_soundcore);
 
 
index fe08660ce0bd05841869ed59f762eceed7c089d7..e1d60d780784b8dd5ecedb42760a7802478276c1 100644 (file)
@@ -13,6 +13,8 @@ perf*.xml
 perf*.html
 common-cmds.h
 perf.data
+perf.data.old
+perf-archive
 tags
 TAGS
 cscope*
diff --git a/tools/perf/Documentation/perf-archive.txt b/tools/perf/Documentation/perf-archive.txt
new file mode 100644 (file)
index 0000000..fae174d
--- /dev/null
@@ -0,0 +1,22 @@
+perf-archive(1)
+===============
+
+NAME
+----
+perf-archive - Create archive with object files with build-ids found in perf.data file
+
+SYNOPSIS
+--------
+[verse]
+'perf archive' [file]
+
+DESCRIPTION
+-----------
+This command runs runs perf-buildid-list --with-hits, and collects the files
+with the buildids found so that analisys of perf.data contents can be possible
+on another machine.
+
+
+SEE ALSO
+--------
+linkperf:perf-record[1], linkperf:perf-buildid-list[1], linkperf:perf-report[1]
diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt
new file mode 100644 (file)
index 0000000..88bc3b5
--- /dev/null
@@ -0,0 +1,33 @@
+perf-buildid-cache(1)
+=====================
+
+NAME
+----
+perf-buildid-cache - Manage build-id cache.
+
+SYNOPSIS
+--------
+[verse]
+'perf buildid-list <options>'
+
+DESCRIPTION
+-----------
+This command manages the build-id cache. It can add and remove files to the
+cache. In the future it should as well purge older entries, set upper limits
+for the space used by the cache, etc.
+
+OPTIONS
+-------
+-a::
+--add=::
+        Add specified file to the cache.
+-r::
+--remove=::
+        Remove specified file to the cache.
+-v::
+--verbose::
+       Be more verbose.
+
+SEE ALSO
+--------
+linkperf:perf-record[1], linkperf:perf-report[1]
index 250e391b4bc838691f13e4c407193935ccfb83e8..2de34075f6a49dd443929bc9408f8887fb66812b 100644 (file)
@@ -15,6 +15,8 @@ or
 'perf probe' [options] --del='[GROUP:]EVENT' [...]
 or
 'perf probe' --list
+or
+'perf probe' --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]'
 
 DESCRIPTION
 -----------
@@ -45,6 +47,11 @@ OPTIONS
 --list::
        List up current probe events.
 
+-L::
+--line=::
+       Show source code lines which can be probed. This needs an argument
+       which specifies a range of the source code.
+
 PROBE SYNTAX
 ------------
 Probe points are defined by following syntax.
@@ -56,6 +63,19 @@ Probe points are defined by following syntax.
 It is also possible to specify a probe point by the source line number by using 'SRC:ALN' syntax, where 'SRC' is the source file path and 'ALN' is the line number.
 'ARG' specifies the arguments of this probe point. You can use the name of local variable, or kprobe-tracer argument format (e.g. $retval, %ax, etc).
 
+LINE SYNTAX
+-----------
+Line range is descripted by following syntax.
+
+ "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]"
+
+FUNC specifies the function name of showing lines. 'RLN' is the start line
+number from function entry line, and 'RLN2' is the end line number. As same as
+probe syntax, 'SRC' means the source file path, 'ALN' is start line number,
+and 'ALN2' is end line number in the file. It is also possible to specify how
+many lines to show by using 'NUM'.
+So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function.
+
 SEE ALSO
 --------
 linkperf:perf-trace[1], linkperf:perf-record[1]
index 4a7d558dc309c731c91559e1d81c24ca2874246e..785b9fc32a46f45559a77c193ed56fdf9bfc7702 100644 (file)
@@ -74,7 +74,7 @@ OPTIONS
 
 -s <symbol>::
 --sym-annotate=<symbol>::
-        Annotate this symbol.  Requires -k option.
+        Annotate this symbol.
 
 -v::
 --verbose::
index c5f55f43909177fbbc456c8eb3dd5727337db98e..d729cee8d987cf1b7c025811cbb697e3fad471c6 100644 (file)
@@ -8,7 +8,7 @@ perf-trace-perl - Process trace data with a Perl script
 SYNOPSIS
 --------
 [verse]
-'perf trace' [-s [lang]:script[.ext] ]
+'perf trace' [-s [Perl]:script[.pl] ]
 
 DESCRIPTION
 -----------
diff --git a/tools/perf/Documentation/perf-trace-python.txt b/tools/perf/Documentation/perf-trace-python.txt
new file mode 100644 (file)
index 0000000..a241aca
--- /dev/null
@@ -0,0 +1,625 @@
+perf-trace-python(1)
+==================
+
+NAME
+----
+perf-trace-python - Process trace data with a Python script
+
+SYNOPSIS
+--------
+[verse]
+'perf trace' [-s [Python]:script[.py] ]
+
+DESCRIPTION
+-----------
+
+This perf trace option is used to process perf trace data using perf's
+built-in Python interpreter.  It reads and processes the input file and
+displays the results of the trace analysis implemented in the given
+Python script, if any.
+
+A QUICK EXAMPLE
+---------------
+
+This section shows the process, start to finish, of creating a working
+Python script that aggregates and extracts useful information from a
+raw perf trace stream.  You can avoid reading the rest of this
+document if an example is enough for you; the rest of the document
+provides more details on each step and lists the library functions
+available to script writers.
+
+This example actually details the steps that were used to create the
+'syscall-counts' script you see when you list the available perf trace
+scripts via 'perf trace -l'.  As such, this script also shows how to
+integrate your script into the list of general-purpose 'perf trace'
+scripts listed by that command.
+
+The syscall-counts script is a simple script, but demonstrates all the
+basic ideas necessary to create a useful script.  Here's an example
+of its output (syscall names are not yet supported, they will appear
+as numbers):
+
+----
+syscall events:
+
+event                                          count
+----------------------------------------  -----------
+sys_write                                     455067
+sys_getdents                                    4072
+sys_close                                       3037
+sys_swapoff                                     1769
+sys_read                                         923
+sys_sched_setparam                               826
+sys_open                                         331
+sys_newfstat                                     326
+sys_mmap                                         217
+sys_munmap                                       216
+sys_futex                                        141
+sys_select                                       102
+sys_poll                                          84
+sys_setitimer                                     12
+sys_writev                                         8
+15                                                 8
+sys_lseek                                          7
+sys_rt_sigprocmask                                 6
+sys_wait4                                          3
+sys_ioctl                                          3
+sys_set_robust_list                                1
+sys_exit                                           1
+56                                                 1
+sys_access                                         1
+----
+
+Basically our task is to keep a per-syscall tally that gets updated
+every time a system call occurs in the system.  Our script will do
+that, but first we need to record the data that will be processed by
+that script.  Theoretically, there are a couple of ways we could do
+that:
+
+- we could enable every event under the tracing/events/syscalls
+  directory, but this is over 600 syscalls, well beyond the number
+  allowable by perf.  These individual syscall events will however be
+  useful if we want to later use the guidance we get from the
+  general-purpose scripts to drill down and get more detail about
+  individual syscalls of interest.
+
+- we can enable the sys_enter and/or sys_exit syscalls found under
+  tracing/events/raw_syscalls.  These are called for all syscalls; the
+  'id' field can be used to distinguish between individual syscall
+  numbers.
+
+For this script, we only need to know that a syscall was entered; we
+don't care how it exited, so we'll use 'perf record' to record only
+the sys_enter events:
+
+----
+# perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter
+
+^C[ perf record: Woken up 1 times to write data ]
+[ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ]
+----
+
+The options basically say to collect data for every syscall event
+system-wide and multiplex the per-cpu output into a single stream.
+That single stream will be recorded in a file in the current directory
+called perf.data.
+
+Once we have a perf.data file containing our data, we can use the -g
+'perf trace' option to generate a Python script that will contain a
+callback handler for each event type found in the perf.data trace
+stream (for more details, see the STARTER SCRIPTS section).
+
+----
+# perf trace -g python
+generated Python script: perf-trace.py
+
+The output file created also in the current directory is named
+perf-trace.py.  Here's the file in its entirety:
+
+# perf trace event handlers, generated by perf trace -g python
+# Licensed under the terms of the GNU GPL License version 2
+
+# The common_* event handler fields are the most useful fields common to
+# all events.  They don't necessarily correspond to the 'common_*' fields
+# in the format files.  Those fields not available as handler params can
+# be retrieved using Python functions of the form common_*(context).
+# See the perf-trace-python Documentation for the list of available functions.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+def trace_begin():
+       print "in trace_begin"
+
+def trace_end():
+       print "in trace_end"
+
+def raw_syscalls__sys_enter(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, args):
+               print_header(event_name, common_cpu, common_secs, common_nsecs,
+                       common_pid, common_comm)
+
+               print "id=%d, args=%s\n" % \
+               (id, args),
+
+def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
+               common_pid, common_comm):
+               print_header(event_name, common_cpu, common_secs, common_nsecs,
+               common_pid, common_comm)
+
+def print_header(event_name, cpu, secs, nsecs, pid, comm):
+       print "%-20s %5u %05u.%09u %8u %-20s " % \
+       (event_name, cpu, secs, nsecs, pid, comm),
+----
+
+At the top is a comment block followed by some import statements and a
+path append which every perf trace script should include.
+
+Following that are a couple generated functions, trace_begin() and
+trace_end(), which are called at the beginning and the end of the
+script respectively (for more details, see the SCRIPT_LAYOUT section
+below).
+
+Following those are the 'event handler' functions generated one for
+every event in the 'perf record' output.  The handler functions take
+the form subsystem__event_name, and contain named parameters, one for
+each field in the event; in this case, there's only one event,
+raw_syscalls__sys_enter().  (see the EVENT HANDLERS section below for
+more info on event handlers).
+
+The final couple of functions are, like the begin and end functions,
+generated for every script.  The first, trace_unhandled(), is called
+every time the script finds an event in the perf.data file that
+doesn't correspond to any event handler in the script.  This could
+mean either that the record step recorded event types that it wasn't
+really interested in, or the script was run against a trace file that
+doesn't correspond to the script.
+
+The script generated by -g option option simply prints a line for each
+event found in the trace stream i.e. it basically just dumps the event
+and its parameter values to stdout.  The print_header() function is
+simply a utility function used for that purpose.  Let's rename the
+script and run it to see the default output:
+
+----
+# mv perf-trace.py syscall-counts.py
+# perf trace -s syscall-counts.py
+
+raw_syscalls__sys_enter     1 00840.847582083     7506 perf                  id=1, args=
+raw_syscalls__sys_enter     1 00840.847595764     7506 perf                  id=1, args=
+raw_syscalls__sys_enter     1 00840.847620860     7506 perf                  id=1, args=
+raw_syscalls__sys_enter     1 00840.847710478     6533 npviewer.bin          id=78, args=
+raw_syscalls__sys_enter     1 00840.847719204     6533 npviewer.bin          id=142, args=
+raw_syscalls__sys_enter     1 00840.847755445     6533 npviewer.bin          id=3, args=
+raw_syscalls__sys_enter     1 00840.847775601     6533 npviewer.bin          id=3, args=
+raw_syscalls__sys_enter     1 00840.847781820     6533 npviewer.bin          id=3, args=
+.
+.
+.
+----
+
+Of course, for this script, we're not interested in printing every
+trace event, but rather aggregating it in a useful way.  So we'll get
+rid of everything to do with printing as well as the trace_begin() and
+trace_unhandled() functions, which we won't be using.  That leaves us
+with this minimalistic skeleton:
+
+----
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+def trace_end():
+       print "in trace_end"
+
+def raw_syscalls__sys_enter(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, args):
+----
+
+In trace_end(), we'll simply print the results, but first we need to
+generate some results to print.  To do that we need to have our
+sys_enter() handler do the necessary tallying until all events have
+been counted.  A hash table indexed by syscall id is a good way to
+store that information; every time the sys_enter() handler is called,
+we simply increment a count associated with that hash entry indexed by
+that syscall id:
+
+----
+  syscalls = autodict()
+
+  try:
+    syscalls[id] += 1
+  except TypeError:
+    syscalls[id] = 1
+----
+
+The syscalls 'autodict' object is a special kind of Python dictionary
+(implemented in Core.py) that implements Perl's 'autovivifying' hashes
+in Python i.e. with autovivifying hashes, you can assign nested hash
+values without having to go to the trouble of creating intermediate
+levels if they don't exist e.g syscalls[comm][pid][id] = 1 will create
+the intermediate hash levels and finally assign the value 1 to the
+hash entry for 'id' (because the value being assigned isn't a hash
+object itself, the initial value is assigned in the TypeError
+exception.  Well, there may be a better way to do this in Python but
+that's what works for now).
+
+Putting that code into the raw_syscalls__sys_enter() handler, we
+effectively end up with a single-level dictionary keyed on syscall id
+and having the counts we've tallied as values.
+
+The print_syscall_totals() function iterates over the entries in the
+dictionary and displays a line for each entry containing the syscall
+name (the dictonary keys contain the syscall ids, which are passed to
+the Util function syscall_name(), which translates the raw syscall
+numbers to the corresponding syscall name strings).  The output is
+displayed after all the events in the trace have been processed, by
+calling the print_syscall_totals() function from the trace_end()
+handler called at the end of script processing.
+
+The final script producing the output shown above is shown in its
+entirety below (syscall_name() helper is not yet available, you can
+only deal with id's for now):
+
+----
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+from Util import *
+
+syscalls = autodict()
+
+def trace_end():
+       print_syscall_totals()
+
+def raw_syscalls__sys_enter(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, args):
+       try:
+               syscalls[id] += 1
+       except TypeError:
+               syscalls[id] = 1
+
+def print_syscall_totals():
+    if for_comm is not None:
+           print "\nsyscall events for %s:\n\n" % (for_comm),
+    else:
+           print "\nsyscall events:\n\n",
+
+    print "%-40s  %10s\n" % ("event", "count"),
+    print "%-40s  %10s\n" % ("----------------------------------------", \
+                                 "-----------"),
+
+    for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
+                                 reverse = True):
+           print "%-40s  %10d\n" % (syscall_name(id), val),
+----
+
+The script can be run just as before:
+
+  # perf trace -s syscall-counts.py
+
+So those are the essential steps in writing and running a script.  The
+process can be generalized to any tracepoint or set of tracepoints
+you're interested in - basically find the tracepoint(s) you're
+interested in by looking at the list of available events shown by
+'perf list' and/or look in /sys/kernel/debug/tracing events for
+detailed event and field info, record the corresponding trace data
+using 'perf record', passing it the list of interesting events,
+generate a skeleton script using 'perf trace -g python' and modify the
+code to aggregate and display it for your particular needs.
+
+After you've done that you may end up with a general-purpose script
+that you want to keep around and have available for future use.  By
+writing a couple of very simple shell scripts and putting them in the
+right place, you can have your script listed alongside the other
+scripts listed by the 'perf trace -l' command e.g.:
+
+----
+root@tropicana:~# perf trace -l
+List of available trace scripts:
+  workqueue-stats                      workqueue stats (ins/exe/create/destroy)
+  wakeup-latency                       system-wide min/max/avg wakeup latency
+  rw-by-file <comm>                    r/w activity for a program, by file
+  rw-by-pid                            system-wide r/w activity
+----
+
+A nice side effect of doing this is that you also then capture the
+probably lengthy 'perf record' command needed to record the events for
+the script.
+
+To have the script appear as a 'built-in' script, you write two simple
+scripts, one for recording and one for 'reporting'.
+
+The 'record' script is a shell script with the same base name as your
+script, but with -record appended.  The shell script should be put
+into the perf/scripts/python/bin directory in the kernel source tree.
+In that script, you write the 'perf record' command-line needed for
+your script:
+
+----
+# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record
+
+#!/bin/bash
+perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter
+----
+
+The 'report' script is also a shell script with the same base name as
+your script, but with -report appended.  It should also be located in
+the perf/scripts/python/bin directory.  In that script, you write the
+'perf trace -s' command-line needed for running your script:
+
+----
+# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-report
+
+#!/bin/bash
+# description: system-wide syscall counts
+perf trace -s ~/libexec/perf-core/scripts/python/syscall-counts.py
+----
+
+Note that the location of the Python script given in the shell script
+is in the libexec/perf-core/scripts/python directory - this is where
+the script will be copied by 'make install' when you install perf.
+For the installation to install your script there, your script needs
+to be located in the perf/scripts/python directory in the kernel
+source tree:
+
+----
+# ls -al kernel-source/tools/perf/scripts/python
+
+root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
+total 32
+drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
+drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
+drwxr-xr-x 2 trz trz 4096 2010-01-26 22:29 bin
+-rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-trace.py
+drwxr-xr-x 3 trz trz 4096 2010-01-26 22:49 Perf-Trace-Util
+-rw-r--r-- 1 trz trz 1462 2010-01-26 22:30 syscall-counts.py
+----
+
+Once you've done that (don't forget to do a new 'make install',
+otherwise your script won't show up at run-time), 'perf trace -l'
+should show a new entry for your script:
+
+----
+root@tropicana:~# perf trace -l
+List of available trace scripts:
+  workqueue-stats                      workqueue stats (ins/exe/create/destroy)
+  wakeup-latency                       system-wide min/max/avg wakeup latency
+  rw-by-file <comm>                    r/w activity for a program, by file
+  rw-by-pid                            system-wide r/w activity
+  syscall-counts                       system-wide syscall counts
+----
+
+You can now perform the record step via 'perf trace record':
+
+  # perf trace record syscall-counts
+
+and display the output using 'perf trace report':
+
+  # perf trace report syscall-counts
+
+STARTER SCRIPTS
+---------------
+
+You can quickly get started writing a script for a particular set of
+trace data by generating a skeleton script using 'perf trace -g
+python' in the same directory as an existing perf.data trace file.
+That will generate a starter script containing a handler for each of
+the event types in the trace file; it simply prints every available
+field for each event in the trace file.
+
+You can also look at the existing scripts in
+~/libexec/perf-core/scripts/python for typical examples showing how to
+do basic things like aggregate event data, print results, etc.  Also,
+the check-perf-trace.py script, while not interesting for its results,
+attempts to exercise all of the main scripting features.
+
+EVENT HANDLERS
+--------------
+
+When perf trace is invoked using a trace script, a user-defined
+'handler function' is called for each event in the trace.  If there's
+no handler function defined for a given event type, the event is
+ignored (or passed to a 'trace_handled' function, see below) and the
+next event is processed.
+
+Most of the event's field values are passed as arguments to the
+handler function; some of the less common ones aren't - those are
+available as calls back into the perf executable (see below).
+
+As an example, the following perf record command can be used to record
+all sched_wakeup events in the system:
+
+ # perf record -c 1 -f -a -M -R -e sched:sched_wakeup
+
+Traces meant to be processed using a script should be recorded with
+the above options: -c 1 says to sample every event, -a to enable
+system-wide collection, -M to multiplex the output, and -R to collect
+raw samples.
+
+The format file for the sched_wakep event defines the following fields
+(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
+
+----
+ format:
+        field:unsigned short common_type;
+        field:unsigned char common_flags;
+        field:unsigned char common_preempt_count;
+        field:int common_pid;
+        field:int common_lock_depth;
+
+        field:char comm[TASK_COMM_LEN];
+        field:pid_t pid;
+        field:int prio;
+        field:int success;
+        field:int target_cpu;
+----
+
+The handler function for this event would be defined as:
+
+----
+def sched__sched_wakeup(event_name, context, common_cpu, common_secs,
+       common_nsecs, common_pid, common_comm,
+       comm, pid, prio, success, target_cpu):
+       pass
+----
+
+The handler function takes the form subsystem__event_name.
+
+The common_* arguments in the handler's argument list are the set of
+arguments passed to all event handlers; some of the fields correspond
+to the common_* fields in the format file, but some are synthesized,
+and some of the common_* fields aren't common enough to to be passed
+to every event as arguments but are available as library functions.
+
+Here's a brief description of each of the invariant event args:
+
+ event_name                the name of the event as text
+ context                   an opaque 'cookie' used in calls back into perf
+ common_cpu                the cpu the event occurred on
+ common_secs               the secs portion of the event timestamp
+ common_nsecs              the nsecs portion of the event timestamp
+ common_pid                the pid of the current task
+ common_comm               the name of the current process
+
+All of the remaining fields in the event's format file have
+counterparts as handler function arguments of the same name, as can be
+seen in the example above.
+
+The above provides the basics needed to directly access every field of
+every event in a trace, which covers 90% of what you need to know to
+write a useful trace script.  The sections below cover the rest.
+
+SCRIPT LAYOUT
+-------------
+
+Every perf trace Python script should start by setting up a Python
+module search path and 'import'ing a few support modules (see module
+descriptions below):
+
+----
+ import os
+ import sys
+
+ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+             '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+ from perf_trace_context import *
+ from Core import *
+----
+
+The rest of the script can contain handler functions and support
+functions in any order.
+
+Aside from the event handler functions discussed above, every script
+can implement a set of optional functions:
+
+*trace_begin*, if defined, is called before any event is processed and
+gives scripts a chance to do setup tasks:
+
+----
+def trace_begin:
+    pass
+----
+
+*trace_end*, if defined, is called after all events have been
+ processed and gives scripts a chance to do end-of-script tasks, such
+ as display results:
+
+----
+def trace_end:
+    pass
+----
+
+*trace_unhandled*, if defined, is called after for any event that
+ doesn't have a handler explicitly defined for it.  The standard set
+ of common arguments are passed into it:
+
+----
+def trace_unhandled(event_name, context, common_cpu, common_secs,
+        common_nsecs, common_pid, common_comm):
+    pass
+----
+
+The remaining sections provide descriptions of each of the available
+built-in perf trace Python modules and their associated functions.
+
+AVAILABLE MODULES AND FUNCTIONS
+-------------------------------
+
+The following sections describe the functions and variables available
+via the various perf trace Python modules.  To use the functions and
+variables from the given module, add the corresponding 'from XXXX
+import' line to your perf trace script.
+
+Core.py Module
+~~~~~~~~~~~~~~
+
+These functions provide some essential functions to user scripts.
+
+The *flag_str* and *symbol_str* functions provide human-readable
+strings for flag and symbolic fields.  These correspond to the strings
+and values parsed from the 'print fmt' fields of the event format
+files:
+
+  flag_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the flag field field_name of event event_name
+  symbol_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the symbolic field field_name of event event_name
+
+The *autodict* function returns a special special kind of Python
+dictionary that implements Perl's 'autovivifying' hashes in Python
+i.e. with autovivifying hashes, you can assign nested hash values
+without having to go to the trouble of creating intermediate levels if
+they don't exist.
+
+  autodict() - returns an autovivifying dictionary instance
+
+
+perf_trace_context Module
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some of the 'common' fields in the event format file aren't all that
+common, but need to be made accessible to user scripts nonetheless.
+
+perf_trace_context defines a set of functions that can be used to
+access this data in the context of the current event.  Each of these
+functions expects a context variable, which is the same as the
+context variable passed into every event handler as the second
+argument.
+
+ common_pc(context) - returns common_preempt count for the current event
+ common_flags(context) - returns common_flags for the current event
+ common_lock_depth(context) - returns common_lock_depth for the current event
+
+Util.py Module
+~~~~~~~~~~~~~~
+
+Various utility functions for use with perf trace:
+
+  nsecs(secs, nsecs) - returns total nsecs given secs/nsecs pair
+  nsecs_secs(nsecs) - returns whole secs portion given nsecs
+  nsecs_nsecs(nsecs) - returns nsecs remainder given nsecs
+  nsecs_str(nsecs) - returns printable string in the form secs.nsecs
+  avg(total, n) - returns average given a sum and a total number of values
+
+SEE ALSO
+--------
+linkperf:perf-trace[1]
index 60e5900da483edb91da41dc3a149aff62092c7a8..8879299cd9dfe7e274a475eb1042c63ba875b42a 100644 (file)
@@ -19,6 +19,11 @@ There are several variants of perf trace:
   'perf trace' to see a detailed trace of the workload that was
   recorded.
 
+  You can also run a set of pre-canned scripts that aggregate and
+  summarize the raw trace data in various ways (the list of scripts is
+  available via 'perf trace -l').  The following variants allow you to
+  record and run those scripts:
+
   'perf trace record <script>' to record the events required for 'perf
   trace report'.  <script> is the name displayed in the output of
   'perf trace --list' i.e. the actual script name minus any language
@@ -31,6 +36,9 @@ There are several variants of perf trace:
   record <script>' is used and should be present for this command to
   succeed.
 
+  See the 'SEE ALSO' section for links to language-specific
+  information on how to write and run your own trace scripts.
+
 OPTIONS
 -------
 -D::
@@ -45,9 +53,11 @@ OPTIONS
 --list=::
         Display a list of available trace scripts.
 
--s::
+-s ['lang']::
 --script=::
         Process trace data with the given script ([lang]:script[.ext]).
+       If the string 'lang' is specified in place of a script name, a
+        list of supported languages will be displayed instead.
 
 -g::
 --gen-script=::
@@ -56,4 +66,5 @@ OPTIONS
 
 SEE ALSO
 --------
-linkperf:perf-record[1], linkperf:perf-trace-perl[1]
+linkperf:perf-record[1], linkperf:perf-trace-perl[1],
+linkperf:perf-trace-python[1]
index 69c832557199d1a1bd1fb82a25e10a557acc49b7..0eeb247dc7d270dcc3709bbacee67d9d9c0be3c6 100644 (file)
@@ -12,7 +12,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Performance counters for Linux are are a new kernel-based subsystem
+Performance counters for Linux are a new kernel-based subsystem
 that provide a framework for all things performance analysis. It
 covers hardware level (CPU/PMU, Performance Monitoring Unit) features
 and software features (software counters, tracepoints) as well.
index 652a470b5f749aeadc05e33f617bf18a588b3162..54a5b50ff312c70efe7f1e66cc84f8f2dce9cf55 100644 (file)
@@ -250,7 +250,19 @@ PTHREAD_LIBS = -lpthread
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
-ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y)
+ifeq ($(V), 2)
+       QUIET_STDERR = ">/dev/null"
+else
+       QUIET_STDERR = ">/dev/null 2>&1"
+endif
+
+BITBUCKET = "/dev/null"
+
+ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
+       BITBUCKET = .perf.dev.null
+endif
+
+ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
   CFLAGS := $(CFLAGS) -fstack-protector-all
 endif
 
@@ -274,11 +286,7 @@ SCRIPT_PERL =
 SCRIPT_SH =
 TEST_PROGRAMS =
 
-#
-# No scripts right now:
-#
-
-# SCRIPT_SH += perf-am.sh
+SCRIPT_SH += perf-archive.sh
 
 #
 # No Perl scripts right now:
@@ -303,9 +311,6 @@ PROGRAMS += perf
 # List built-in command $C whose implementation cmd_$C() is not in
 # builtin-$C.o but is linked in as part of some other command.
 #
-# None right now:
-#
-# BUILT_INS += perf-init $X
 
 # what 'all' will build and 'install' will install, in perfexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
@@ -328,6 +333,7 @@ LIB_FILE=libperf.a
 LIB_H += ../../include/linux/perf_event.h
 LIB_H += ../../include/linux/rbtree.h
 LIB_H += ../../include/linux/list.h
+LIB_H += ../../include/linux/hash.h
 LIB_H += ../../include/linux/stringify.h
 LIB_H += util/include/linux/bitmap.h
 LIB_H += util/include/linux/bitops.h
@@ -351,12 +357,14 @@ LIB_H += util/include/asm/uaccess.h
 LIB_H += perf.h
 LIB_H += util/cache.h
 LIB_H += util/callchain.h
+LIB_H += util/build-id.h
 LIB_H += util/debug.h
 LIB_H += util/debugfs.h
 LIB_H += util/event.h
 LIB_H += util/exec_cmd.h
 LIB_H += util/types.h
 LIB_H += util/levenshtein.h
+LIB_H += util/map.h
 LIB_H += util/parse-options.h
 LIB_H += util/parse-events.h
 LIB_H += util/quote.h
@@ -377,12 +385,12 @@ LIB_H += util/sort.h
 LIB_H += util/hist.h
 LIB_H += util/thread.h
 LIB_H += util/trace-event.h
-LIB_H += util/trace-event-perl.h
 LIB_H += util/probe-finder.h
 LIB_H += util/probe-event.h
 
 LIB_OBJS += util/abspath.o
 LIB_OBJS += util/alias.o
+LIB_OBJS += util/build-id.o
 LIB_OBJS += util/config.o
 LIB_OBJS += util/ctype.o
 LIB_OBJS += util/debugfs.o
@@ -419,12 +427,12 @@ LIB_OBJS += util/thread.o
 LIB_OBJS += util/trace-event-parse.o
 LIB_OBJS += util/trace-event-read.o
 LIB_OBJS += util/trace-event-info.o
-LIB_OBJS += util/trace-event-perl.o
+LIB_OBJS += util/trace-event-scripting.o
 LIB_OBJS += util/svghelper.o
 LIB_OBJS += util/sort.o
 LIB_OBJS += util/hist.o
-LIB_OBJS += util/data_map.o
 LIB_OBJS += util/probe-event.o
+LIB_OBJS += util/util.o
 
 BUILTIN_OBJS += builtin-annotate.o
 
@@ -439,6 +447,7 @@ BUILTIN_OBJS += builtin-diff.o
 BUILTIN_OBJS += builtin-help.o
 BUILTIN_OBJS += builtin-sched.o
 BUILTIN_OBJS += builtin-buildid-list.o
+BUILTIN_OBJS += builtin-buildid-cache.o
 BUILTIN_OBJS += builtin-list.o
 BUILTIN_OBJS += builtin-record.o
 BUILTIN_OBJS += builtin-report.o
@@ -448,14 +457,10 @@ BUILTIN_OBJS += builtin-top.o
 BUILTIN_OBJS += builtin-trace.o
 BUILTIN_OBJS += builtin-probe.o
 BUILTIN_OBJS += builtin-kmem.o
+BUILTIN_OBJS += builtin-lock.o
 
 PERFLIBS = $(LIB_FILE)
 
-ifeq ($(V), 2)
-       QUIET_STDERR = ">/dev/null"
-else
-       QUIET_STDERR = ">/dev/null 2>&1"
-endif
 #
 # Platform specific tweaks
 #
@@ -483,19 +488,19 @@ ifeq ($(uname_S),Darwin)
        PTHREAD_LIBS =
 endif
 
-ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
-ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
        msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
 endif
 
-       ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+       ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
                BASIC_CFLAGS += -DLIBELF_NO_MMAP
        endif
 else
        msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
 endif
 
-ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
        msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
        BASIC_CFLAGS += -DNO_LIBDWARF
 else
@@ -509,30 +514,44 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
 endif
 
-ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
        BASIC_CFLAGS += -DNO_LIBPERL
 else
        ALL_LDFLAGS += $(PERL_EMBED_LDOPTS)
+       LIB_OBJS += util/scripting-engines/trace-event-perl.o
        LIB_OBJS += scripts/perl/Perf-Trace-Util/Context.o
 endif
 
+ifndef NO_LIBPYTHON
+PYTHON_EMBED_LDOPTS = `python-config --ldflags 2>/dev/null`
+PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null`
+endif
+
+ifneq ($(shell sh -c "(echo '\#include <Python.h>'; echo 'int main(void) { Py_Initialize(); return 0; }') | $(CC) -x c - $(PYTHON_EMBED_CCOPTS) -o /dev/null $(PYTHON_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
+       BASIC_CFLAGS += -DNO_LIBPYTHON
+else
+       ALL_LDFLAGS += $(PYTHON_EMBED_LDOPTS)
+       LIB_OBJS += util/scripting-engines/trace-event-python.o
+       LIB_OBJS += scripts/python/Perf-Trace-Util/Context.o
+endif
+
 ifdef NO_DEMANGLE
        BASIC_CFLAGS += -DNO_DEMANGLE
 else
-       has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
+       has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
 
        ifeq ($(has_bfd),y)
                EXTLIBS += -lbfd
        else
-               has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
+               has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
                ifeq ($(has_bfd_iberty),y)
                        EXTLIBS += -lbfd -liberty
                else
-                       has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
+                       has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
                        ifeq ($(has_bfd_iberty_z),y)
                                EXTLIBS += -lbfd -liberty -lz
                        else
-                               has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
+                               has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
                                ifeq ($(has_cplus_demangle),y)
                                        EXTLIBS += -liberty
                                        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
@@ -780,7 +799,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
 
 SHELL = $(SHELL_PATH)
 
-all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
+all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
 ifneq (,$X)
        $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
 endif
@@ -887,12 +906,18 @@ util/hweight.o: ../../lib/hweight.c PERF-CFLAGS
 util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS
        $(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
-util/trace-event-perl.o: util/trace-event-perl.c PERF-CFLAGS
-       $(QUIET_CC)$(CC) -o util/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
+util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c PERF-CFLAGS
+       $(QUIET_CC)$(CC) -o util/scripting-engines/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
 
 scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c PERF-CFLAGS
        $(QUIET_CC)$(CC) -o scripts/perl/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
 
+util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c PERF-CFLAGS
+       $(QUIET_CC)$(CC) -o util/scripting-engines/trace-event-python.o -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
+
+scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c PERF-CFLAGS
+       $(QUIET_CC)$(CC) -o scripts/python/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
+
 perf-%$X: %.o $(PERFLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
@@ -1002,9 +1027,16 @@ install: all
        $(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)'
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+       $(INSTALL) perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
        $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
        $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
        $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+       $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+       $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+       $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+       $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
+       $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+
 ifdef BUILT_INS
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
        $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
@@ -1107,6 +1139,11 @@ clean:
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
 .PHONY: .FORCE-PERF-BUILD-OPTIONS
 
+.perf.dev.null:
+               touch .perf.dev.null
+
+.INTERMEDIATE: .perf.dev.null
+
 ### Make sure built-ins do not have dups and listed in perf.c
 #
 check-builtins::
index 593ff25006defbd405713e1c1c24653911760a4f..5ec5de995872a262e398b20da5440921fb3e51f2 100644 (file)
@@ -53,32 +53,20 @@ struct sym_priv {
 
 static const char *sym_hist_filter;
 
-static int symbol_filter(struct map *map __used, struct symbol *sym)
+static int sym__alloc_hist(struct symbol *self)
 {
-       if (sym_hist_filter == NULL ||
-           strcmp(sym->name, sym_hist_filter) == 0) {
-               struct sym_priv *priv = symbol__priv(sym);
-               const int size = (sizeof(*priv->hist) +
-                                 (sym->end - sym->start) * sizeof(u64));
+       struct sym_priv *priv = symbol__priv(self);
+       const int size = (sizeof(*priv->hist) +
+                         (self->end - self->start) * sizeof(u64));
 
-               priv->hist = malloc(size);
-               if (priv->hist)
-                       memset(priv->hist, 0, size);
-               return 0;
-       }
-       /*
-        * FIXME: We should really filter it out, as we don't want to go thru symbols
-        * we're not interested, and if a DSO ends up with no symbols, delete it too,
-        * but right now the kernel loading routines in symbol.c bail out if no symbols
-        * are found, fix it later.
-        */
-       return 0;
+       priv->hist = zalloc(size);
+       return priv->hist == NULL ? -1 : 0;
 }
 
 /*
  * collect histogram counts
  */
-static void hist_hit(struct hist_entry *he, u64 ip)
+static int annotate__hist_hit(struct hist_entry *he, u64 ip)
 {
        unsigned int sym_size, offset;
        struct symbol *sym = he->sym;
@@ -88,83 +76,127 @@ static void hist_hit(struct hist_entry *he, u64 ip)
        he->count++;
 
        if (!sym || !he->map)
-               return;
+               return 0;
 
        priv = symbol__priv(sym);
-       if (!priv->hist)
-               return;
+       if (priv->hist == NULL && sym__alloc_hist(sym) < 0)
+               return -ENOMEM;
 
        sym_size = sym->end - sym->start;
        offset = ip - sym->start;
 
-       if (verbose)
-               fprintf(stderr, "%s: ip=%Lx\n", __func__,
-                       he->map->unmap_ip(he->map, ip));
+       pr_debug3("%s: ip=%#Lx\n", __func__, he->map->unmap_ip(he->map, ip));
 
        if (offset >= sym_size)
-               return;
+               return 0;
 
        h = priv->hist;
        h->sum++;
        h->ip[offset]++;
 
-       if (verbose >= 3)
-               printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n",
-                       (void *)(unsigned long)he->sym->start,
-                       he->sym->name,
-                       (void *)(unsigned long)ip, ip - he->sym->start,
-                       h->ip[offset]);
+       pr_debug3("%#Lx %s: count++ [ip: %#Lx, %#Lx] => %Ld\n", he->sym->start,
+                 he->sym->name, ip, ip - he->sym->start, h->ip[offset]);
+       return 0;
 }
 
 static int perf_session__add_hist_entry(struct perf_session *self,
                                        struct addr_location *al, u64 count)
 {
        bool hit;
-       struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL,
-                                                              count, &hit);
+       struct hist_entry *he;
+
+       if (sym_hist_filter != NULL &&
+           (al->sym == NULL || strcmp(sym_hist_filter, al->sym->name) != 0)) {
+               /* We're only interested in a symbol named sym_hist_filter */
+               if (al->sym != NULL) {
+                       rb_erase(&al->sym->rb_node,
+                                &al->map->dso->symbols[al->map->type]);
+                       symbol__delete(al->sym);
+               }
+               return 0;
+       }
+
+       he = __perf_session__add_hist_entry(self, al, NULL, count, &hit);
        if (he == NULL)
                return -ENOMEM;
-       hist_hit(he, al->addr);
-       return 0;
+
+       return annotate__hist_hit(he, al->addr);
 }
 
 static int process_sample_event(event_t *event, struct perf_session *session)
 {
        struct addr_location al;
 
-       dump_printf("(IP, %d): %d: %p\n", event->header.misc,
-                   event->ip.pid, (void *)(long)event->ip.ip);
+       dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
+                   event->ip.pid, event->ip.ip);
 
-       if (event__preprocess_sample(event, session, &al, symbol_filter) < 0) {
-               fprintf(stderr, "problem processing %d event, skipping it.\n",
-                       event->header.type);
+       if (event__preprocess_sample(event, session, &al, NULL) < 0) {
+               pr_warning("problem processing %d event, skipping it.\n",
+                          event->header.type);
                return -1;
        }
 
        if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) {
-               fprintf(stderr, "problem incrementing symbol count, "
-                               "skipping event\n");
+               pr_warning("problem incrementing symbol count, "
+                          "skipping event\n");
                return -1;
        }
 
        return 0;
 }
 
-static int parse_line(FILE *file, struct hist_entry *he, u64 len)
+struct objdump_line {
+       struct list_head node;
+       s64              offset;
+       char             *line;
+};
+
+static struct objdump_line *objdump_line__new(s64 offset, char *line)
+{
+       struct objdump_line *self = malloc(sizeof(*self));
+
+       if (self != NULL) {
+               self->offset = offset;
+               self->line = line;
+       }
+
+       return self;
+}
+
+static void objdump_line__free(struct objdump_line *self)
+{
+       free(self->line);
+       free(self);
+}
+
+static void objdump__add_line(struct list_head *head, struct objdump_line *line)
+{
+       list_add_tail(&line->node, head);
+}
+
+static struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
+                                                     struct objdump_line *pos)
+{
+       list_for_each_entry_continue(pos, head, node)
+               if (pos->offset >= 0)
+                       return pos;
+
+       return NULL;
+}
+
+static int parse_line(FILE *file, struct hist_entry *he,
+                     struct list_head *head)
 {
        struct symbol *sym = he->sym;
+       struct objdump_line *objdump_line;
        char *line = NULL, *tmp, *tmp2;
-       static const char *prev_line;
-       static const char *prev_color;
-       unsigned int offset;
        size_t line_len;
-       u64 start;
-       s64 line_ip;
-       int ret;
+       s64 line_ip, offset = -1;
        char *c;
 
        if (getline(&line, &line_len, file) < 0)
                return -1;
+
        if (!line)
                return -1;
 
@@ -173,8 +205,6 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
                *c = 0;
 
        line_ip = -1;
-       offset = 0;
-       ret = -2;
 
        /*
         * Strip leading spaces:
@@ -195,9 +225,30 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
                        line_ip = -1;
        }
 
-       start = he->map->unmap_ip(he->map, sym->start);
-
        if (line_ip != -1) {
+               u64 start = map__rip_2objdump(he->map, sym->start);
+               offset = line_ip - start;
+       }
+
+       objdump_line = objdump_line__new(offset, line);
+       if (objdump_line == NULL) {
+               free(line);
+               return -1;
+       }
+       objdump__add_line(head, objdump_line);
+
+       return 0;
+}
+
+static int objdump_line__print(struct objdump_line *self,
+                              struct list_head *head,
+                              struct hist_entry *he, u64 len)
+{
+       struct symbol *sym = he->sym;
+       static const char *prev_line;
+       static const char *prev_color;
+
+       if (self->offset != -1) {
                const char *path = NULL;
                unsigned int hits = 0;
                double percent = 0.0;
@@ -205,15 +256,22 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
                struct sym_priv *priv = symbol__priv(sym);
                struct sym_ext *sym_ext = priv->ext;
                struct sym_hist *h = priv->hist;
+               s64 offset = self->offset;
+               struct objdump_line *next = objdump__get_next_ip_line(head, self);
+
+               while (offset < (s64)len &&
+                      (next == NULL || offset < next->offset)) {
+                       if (sym_ext) {
+                               if (path == NULL)
+                                       path = sym_ext[offset].path;
+                               percent += sym_ext[offset].percent;
+                       } else
+                               hits += h->ip[offset];
+
+                       ++offset;
+               }
 
-               offset = line_ip - start;
-               if (offset < len)
-                       hits = h->ip[offset];
-
-               if (offset < len && sym_ext) {
-                       path = sym_ext[offset].path;
-                       percent = sym_ext[offset].percent;
-               } else if (h->sum)
+               if (sym_ext == NULL && h->sum)
                        percent = 100.0 * hits / h->sum;
 
                color = get_percent_color(percent);
@@ -234,12 +292,12 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
 
                color_fprintf(stdout, color, " %7.2f", percent);
                printf(" :      ");
-               color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", line);
+               color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", self->line);
        } else {
-               if (!*line)
+               if (!*self->line)
                        printf("         :\n");
                else
-                       printf("         :      %s\n", line);
+                       printf("         :      %s\n", self->line);
        }
 
        return 0;
@@ -365,6 +423,20 @@ static void print_summary(const char *filename)
        }
 }
 
+static void hist_entry__print_hits(struct hist_entry *self)
+{
+       struct symbol *sym = self->sym;
+       struct sym_priv *priv = symbol__priv(sym);
+       struct sym_hist *h = priv->hist;
+       u64 len = sym->end - sym->start, offset;
+
+       for (offset = 0; offset < len; ++offset)
+               if (h->ip[offset] != 0)
+                       printf("%*Lx: %Lu\n", BITS_PER_LONG / 2,
+                              sym->start + offset, h->ip[offset]);
+       printf("%*s: %Lu\n", BITS_PER_LONG / 2, "h->sum", h->sum);
+}
+
 static void annotate_sym(struct hist_entry *he)
 {
        struct map *map = he->map;
@@ -374,15 +446,15 @@ static void annotate_sym(struct hist_entry *he)
        u64 len;
        char command[PATH_MAX*2];
        FILE *file;
+       LIST_HEAD(head);
+       struct objdump_line *pos, *n;
 
        if (!filename)
                return;
 
-       if (verbose)
-               fprintf(stderr, "%s: filename=%s, sym=%s, start=%Lx, end=%Lx\n",
-                       __func__, filename, sym->name,
-                       map->unmap_ip(map, sym->start),
-                       map->unmap_ip(map, sym->end));
+       pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__,
+                filename, sym->name, map->unmap_ip(map, sym->start),
+                map->unmap_ip(map, sym->end));
 
        if (full_paths)
                d_filename = filename;
@@ -405,7 +477,8 @@ static void annotate_sym(struct hist_entry *he)
                       dso, dso->long_name, sym, sym->name);
 
        sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s|grep -v %s",
-               map->unmap_ip(map, sym->start), map->unmap_ip(map, sym->end),
+               map__rip_2objdump(map, sym->start),
+               map__rip_2objdump(map, sym->end),
                filename, filename);
 
        if (verbose >= 3)
@@ -416,11 +489,21 @@ static void annotate_sym(struct hist_entry *he)
                return;
 
        while (!feof(file)) {
-               if (parse_line(file, he, len) < 0)
+               if (parse_line(file, he, &head) < 0)
                        break;
        }
 
        pclose(file);
+
+       if (verbose)
+               hist_entry__print_hits(he);
+
+       list_for_each_entry_safe(pos, n, &head, node) {
+               objdump_line__print(pos, &head, he, len);
+               list_del(&pos->node);
+               objdump_line__free(pos);
+       }
+
        if (print_line)
                free_source_line(he, len);
 }
@@ -451,10 +534,10 @@ static void perf_session__find_annotations(struct perf_session *self)
 }
 
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_mmap_event     = event__process_mmap,
-       .process_comm_event     = event__process_comm,
-       .process_fork_event     = event__process_task,
+       .sample = process_sample_event,
+       .mmap   = event__process_mmap,
+       .comm   = event__process_comm,
+       .fork   = event__process_task,
 };
 
 static int __cmd_annotate(void)
@@ -542,9 +625,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
        setup_pager();
 
        if (field_sep && *field_sep == '.') {
-               fputs("'.' is the only non valid --field-separator argument\n",
-                               stderr);
-               exit(129);
+               pr_err("'.' is the only non valid --field-separator argument\n");
+               return -1;
        }
 
        return __cmd_annotate();
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
new file mode 100644 (file)
index 0000000..30a05f5
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * builtin-buildid-cache.c
+ *
+ * Builtin buildid-cache command: Manages build-id cache
+ *
+ * Copyright (C) 2010, Red Hat Inc.
+ * Copyright (C) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
+ */
+#include "builtin.h"
+#include "perf.h"
+#include "util/cache.h"
+#include "util/debug.h"
+#include "util/header.h"
+#include "util/parse-options.h"
+#include "util/strlist.h"
+#include "util/symbol.h"
+
+static char const *add_name_list_str, *remove_name_list_str;
+
+static const char * const buildid_cache_usage[] = {
+       "perf buildid-cache [<options>]",
+       NULL
+};
+
+static const struct option buildid_cache_options[] = {
+       OPT_STRING('a', "add", &add_name_list_str,
+                  "file list", "file(s) to add"),
+       OPT_STRING('r', "remove", &remove_name_list_str, "file list",
+                   "file(s) to remove"),
+       OPT_BOOLEAN('v', "verbose", &verbose, "be more verbose"),
+       OPT_END()
+};
+
+static int build_id_cache__add_file(const char *filename, const char *debugdir)
+{
+       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+       u8 build_id[BUILD_ID_SIZE];
+       int err;
+
+       if (filename__read_build_id(filename, &build_id, sizeof(build_id)) < 0) {
+               pr_debug("Couldn't read a build-id in %s\n", filename);
+               return -1;
+       }
+
+       build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
+       err = build_id_cache__add_s(sbuild_id, debugdir, filename, false);
+       if (verbose)
+               pr_info("Adding %s %s: %s\n", sbuild_id, filename,
+                       err ? "FAIL" : "Ok");
+       return err;
+}
+
+static int build_id_cache__remove_file(const char *filename __used,
+                                      const char *debugdir __used)
+{
+       u8 build_id[BUILD_ID_SIZE];
+       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+
+       int err;
+
+       if (filename__read_build_id(filename, &build_id, sizeof(build_id)) < 0) {
+               pr_debug("Couldn't read a build-id in %s\n", filename);
+               return -1;
+       }
+
+       build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
+       err = build_id_cache__remove_s(sbuild_id, debugdir);
+       if (verbose)
+               pr_info("Removing %s %s: %s\n", sbuild_id, filename,
+                       err ? "FAIL" : "Ok");
+
+       return err;
+}
+
+static int __cmd_buildid_cache(void)
+{
+       struct strlist *list;
+       struct str_node *pos;
+       char debugdir[PATH_MAX];
+
+       snprintf(debugdir, sizeof(debugdir), "%s/%s", getenv("HOME"),
+                DEBUG_CACHE_DIR);
+
+       if (add_name_list_str) {
+               list = strlist__new(true, add_name_list_str);
+               if (list) {
+                       strlist__for_each(pos, list)
+                               if (build_id_cache__add_file(pos->s, debugdir)) {
+                                       if (errno == EEXIST) {
+                                               pr_debug("%s already in the cache\n",
+                                                        pos->s);
+                                               continue;
+                                       }
+                                       pr_warning("Couldn't add %s: %s\n",
+                                                  pos->s, strerror(errno));
+                               }
+
+                       strlist__delete(list);
+               }
+       }
+
+       if (remove_name_list_str) {
+               list = strlist__new(true, remove_name_list_str);
+               if (list) {
+                       strlist__for_each(pos, list)
+                               if (build_id_cache__remove_file(pos->s, debugdir)) {
+                                       if (errno == ENOENT) {
+                                               pr_debug("%s wasn't in the cache\n",
+                                                        pos->s);
+                                               continue;
+                                       }
+                                       pr_warning("Couldn't remove %s: %s\n",
+                                                  pos->s, strerror(errno));
+                               }
+
+                       strlist__delete(list);
+               }
+       }
+
+       return 0;
+}
+
+int cmd_buildid_cache(int argc, const char **argv, const char *prefix __used)
+{
+       argc = parse_options(argc, argv, buildid_cache_options,
+                            buildid_cache_usage, 0);
+
+       if (symbol__init() < 0)
+               return -1;
+
+       setup_pager();
+       return __cmd_buildid_cache();
+}
index 1e99ac806913679d963ae8043f6035f844ea2bc2..d0675c02f81eb0a45f5d2b8185dc6b26a15f98fd 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include "builtin.h"
 #include "perf.h"
+#include "util/build-id.h"
 #include "util/cache.h"
 #include "util/debug.h"
 #include "util/parse-options.h"
@@ -16,6 +17,7 @@
 
 static char const *input_name = "perf.data";
 static int force;
+static bool with_hits;
 
 static const char * const buildid_list_usage[] = {
        "perf buildid-list [<options>]",
@@ -23,6 +25,7 @@ static const char * const buildid_list_usage[] = {
 };
 
 static const struct option options[] = {
+       OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"),
        OPT_STRING('i', "input", &input_name, "file",
                    "input file name"),
        OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
@@ -31,26 +34,6 @@ static const struct option options[] = {
        OPT_END()
 };
 
-static int perf_file_section__process_buildids(struct perf_file_section *self,
-                                              int feat, int fd)
-{
-       if (feat != HEADER_BUILD_ID)
-               return 0;
-
-       if (lseek(fd, self->offset, SEEK_SET) < 0) {
-               pr_warning("Failed to lseek to %Ld offset for buildids!\n",
-                          self->offset);
-               return -1;
-       }
-
-       if (perf_header__read_build_ids(fd, self->offset, self->size)) {
-               pr_warning("Failed to read buildids!\n");
-               return -1;
-       }
-
-       return 0;
-}
-
 static int __cmd_buildid_list(void)
 {
        int err = -1;
@@ -60,10 +43,10 @@ static int __cmd_buildid_list(void)
        if (session == NULL)
                return -1;
 
-       err = perf_header__process_sections(&session->header, session->fd,
-                                        perf_file_section__process_buildids);
-       if (err >= 0)
-               dsos__fprintf_buildid(stdout);
+       if (with_hits)
+               perf_session__process_events(session, &build_id__mark_dso_hit_ops);
+
+       dsos__fprintf_buildid(stdout, with_hits);
 
        perf_session__delete(session);
        return err;
index bd71b8ceafb78d0c0e6f05e2daa266b2d4758d88..18b3f505f9db947012bfb247791f6c0edc13082c 100644 (file)
@@ -42,8 +42,8 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
        struct addr_location al;
        struct sample_data data = { .period = 1, };
 
-       dump_printf("(IP, %d): %d: %p\n", event->header.misc,
-                   event->ip.pid, (void *)(long)event->ip.ip);
+       dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
+                   event->ip.pid, event->ip.ip);
 
        if (event__preprocess_sample(event, session, &al, NULL) < 0) {
                pr_warning("problem processing %d event, skipping it.\n",
@@ -51,12 +51,12 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
                return -1;
        }
 
-       if (al.filtered)
+       if (al.filtered || al.sym == NULL)
                return 0;
 
        event__parse_sample(event, session->sample_type, &data);
 
-       if (al.sym && perf_session__add_hist_entry(session, &al, data.period)) {
+       if (perf_session__add_hist_entry(session, &al, data.period)) {
                pr_warning("problem incrementing symbol count, skipping event\n");
                return -1;
        }
@@ -66,12 +66,12 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
 }
 
 static struct perf_event_ops event_ops = {
-       .process_sample_event = diff__process_sample_event,
-       .process_mmap_event   = event__process_mmap,
-       .process_comm_event   = event__process_comm,
-       .process_exit_event   = event__process_task,
-       .process_fork_event   = event__process_task,
-       .process_lost_event   = event__process_lost,
+       .sample = diff__process_sample_event,
+       .mmap   = event__process_mmap,
+       .comm   = event__process_comm,
+       .exit   = event__process_task,
+       .fork   = event__process_task,
+       .lost   = event__process_lost,
 };
 
 static void perf_session__insert_hist_entry_by_name(struct rb_root *root,
@@ -82,29 +82,19 @@ static void perf_session__insert_hist_entry_by_name(struct rb_root *root,
        struct hist_entry *iter;
 
        while (*p != NULL) {
-               int cmp;
                parent = *p;
                iter = rb_entry(parent, struct hist_entry, rb_node);
-
-               cmp = strcmp(he->map->dso->name, iter->map->dso->name);
-               if (cmp > 0)
+               if (hist_entry__cmp(he, iter) < 0)
                        p = &(*p)->rb_left;
-               else if (cmp < 0)
+               else
                        p = &(*p)->rb_right;
-               else {
-                       cmp = strcmp(he->sym->name, iter->sym->name);
-                       if (cmp > 0)
-                               p = &(*p)->rb_left;
-                       else
-                               p = &(*p)->rb_right;
-               }
        }
 
        rb_link_node(&he->rb_node, parent, p);
        rb_insert_color(&he->rb_node, root);
 }
 
-static void perf_session__resort_by_name(struct perf_session *self)
+static void perf_session__resort_hist_entries(struct perf_session *self)
 {
        unsigned long position = 1;
        struct rb_root tmp = RB_ROOT;
@@ -122,29 +112,28 @@ static void perf_session__resort_by_name(struct perf_session *self)
        self->hists = tmp;
 }
 
+static void perf_session__set_hist_entries_positions(struct perf_session *self)
+{
+       perf_session__output_resort(self, self->events_stats.total);
+       perf_session__resort_hist_entries(self);
+}
+
 static struct hist_entry *
-perf_session__find_hist_entry_by_name(struct perf_session *self,
-                                     struct hist_entry *he)
+perf_session__find_hist_entry(struct perf_session *self,
+                             struct hist_entry *he)
 {
        struct rb_node *n = self->hists.rb_node;
 
        while (n) {
                struct hist_entry *iter = rb_entry(n, struct hist_entry, rb_node);
-               int cmp = strcmp(he->map->dso->name, iter->map->dso->name);
+               int64_t cmp = hist_entry__cmp(he, iter);
 
-               if (cmp > 0)
+               if (cmp < 0)
                        n = n->rb_left;
-               else if (cmp < 0)
+               else if (cmp > 0)
                        n = n->rb_right;
-               else {
-                       cmp = strcmp(he->sym->name, iter->sym->name);
-                       if (cmp > 0)
-                               n = n->rb_left;
-                       else if (cmp < 0)
-                               n = n->rb_right;
-                       else
-                               return iter;
-               }
+               else 
+                       return iter;
        }
 
        return NULL;
@@ -155,11 +144,9 @@ static void perf_session__match_hists(struct perf_session *old_session,
 {
        struct rb_node *nd;
 
-       perf_session__resort_by_name(old_session);
-
        for (nd = rb_first(&new_session->hists); nd; nd = rb_next(nd)) {
                struct hist_entry *pos = rb_entry(nd, struct hist_entry, rb_node);
-               pos->pair = perf_session__find_hist_entry_by_name(old_session, pos);
+               pos->pair = perf_session__find_hist_entry(old_session, pos);
        }
 }
 
@@ -177,9 +164,12 @@ static int __cmd_diff(void)
                ret = perf_session__process_events(session[i], &event_ops);
                if (ret)
                        goto out_delete;
-               perf_session__output_resort(session[i], session[i]->events_stats.total);
        }
 
+       perf_session__output_resort(session[1], session[1]->events_stats.total);
+       if (show_displacement)
+               perf_session__set_hist_entries_positions(session[0]);
+
        perf_session__match_hists(session[0], session[1]);
        perf_session__fprintf_hists(session[1], session[0],
                                    show_displacement, stdout);
@@ -204,7 +194,7 @@ static const struct option options[] = {
        OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
        OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
                    "load module symbols - WARNING: use only with -k and LIVE kernel"),
-       OPT_BOOLEAN('P', "full-paths", &event_ops.full_paths,
+       OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
                    "Don't shorten the pathnames taking into account the cwd"),
        OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
                   "only consider symbols in these dsos"),
index 9f810b17c25c58bfb1af1522dc6ec3d4eee85362..215b584007b19f8ccccc7951c5ee9eebabda3bf7 100644 (file)
@@ -286,8 +286,7 @@ void list_common_cmds_help(void)
 
        puts(" The most commonly used perf commands are:");
        for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-               printf("   %s   ", common_cmds[i].name);
-               mput_char(' ', longest - strlen(common_cmds[i].name));
+               printf("   %-*s   ", longest, common_cmds[i].name);
                puts(common_cmds[i].help);
        }
 }
@@ -314,8 +313,6 @@ static const char *cmd_to_page(const char *perf_cmd)
                return "perf";
        else if (!prefixcmp(perf_cmd, "perf"))
                return perf_cmd;
-       else if (is_perf_command(perf_cmd))
-               return prepend("perf-", perf_cmd);
        else
                return prepend("perf-", perf_cmd);
 }
index 7ceb7416c3169dadb71fbf44de7246a4e25c5f2a..924a9518931ade8eb51e17eb36fc38024c556c79 100644 (file)
@@ -92,23 +92,18 @@ static void setup_cpunode_map(void)
        if (!dir1)
                return;
 
-       while (true) {
-               dent1 = readdir(dir1);
-               if (!dent1)
-                       break;
-
-               if (sscanf(dent1->d_name, "node%u", &mem) < 1)
+       while ((dent1 = readdir(dir1)) != NULL) {
+               if (dent1->d_type != DT_DIR ||
+                   sscanf(dent1->d_name, "node%u", &mem) < 1)
                        continue;
 
                snprintf(buf, PATH_MAX, "%s/%s", PATH_SYS_NODE, dent1->d_name);
                dir2 = opendir(buf);
                if (!dir2)
                        continue;
-               while (true) {
-                       dent2 = readdir(dir2);
-                       if (!dent2)
-                               break;
-                       if (sscanf(dent2->d_name, "cpu%u", &cpu) < 1)
+               while ((dent2 = readdir(dir2)) != NULL) {
+                       if (dent2->d_type != DT_LNK ||
+                           sscanf(dent2->d_name, "cpu%u", &cpu) < 1)
                                continue;
                        cpunode_map[cpu] = mem;
                }
@@ -321,11 +316,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 
        event__parse_sample(event, session->sample_type, &data);
 
-       dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
-               event->header.misc,
-               data.pid, data.tid,
-               (void *)(long)data.ip,
-               (long long)data.period);
+       dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+                   data.pid, data.tid, data.ip, data.period);
 
        thread = perf_session__findnew(session, event->ip.pid);
        if (thread == NULL) {
@@ -342,22 +334,9 @@ static int process_sample_event(event_t *event, struct perf_session *session)
        return 0;
 }
 
-static int sample_type_check(struct perf_session *session)
-{
-       if (!(session->sample_type & PERF_SAMPLE_RAW)) {
-               fprintf(stderr,
-                       "No trace sample to read. Did you call perf record "
-                       "without -R?");
-               return -1;
-       }
-
-       return 0;
-}
-
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_comm_event     = event__process_comm,
-       .sample_type_check      = sample_type_check,
+       .sample = process_sample_event,
+       .comm   = event__process_comm,
 };
 
 static double fragmentation(unsigned long n_req, unsigned long n_alloc)
@@ -375,7 +354,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
 
        printf("%.102s\n", graph_dotted_line);
        printf(" %-34s |",  is_caller ? "Callsite": "Alloc Ptr");
-       printf(" Total_alloc/Per | Total_req/Per   | Hit   | Ping-pong | Frag\n");
+       printf(" Total_alloc/Per | Total_req/Per   | Hit      | Ping-pong | Frag\n");
        printf("%.102s\n", graph_dotted_line);
 
        next = rb_first(root);
@@ -390,7 +369,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
                if (is_caller) {
                        addr = data->call_site;
                        if (!raw_ip)
-                               sym = map_groups__find_function(&session->kmaps, session, addr, NULL);
+                               sym = map_groups__find_function(&session->kmaps, addr, NULL);
                } else
                        addr = data->ptr;
 
@@ -401,7 +380,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
                        snprintf(buf, sizeof(buf), "%#Lx", addr);
                printf(" %-34s |", buf);
 
-               printf(" %9llu/%-5lu | %9llu/%-5lu | %6lu | %8lu | %6.3f%%\n",
+               printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n",
                       (unsigned long long)data->bytes_alloc,
                       (unsigned long)data->bytes_alloc / data->hit,
                       (unsigned long long)data->bytes_req,
@@ -504,11 +483,14 @@ static void sort_result(void)
 
 static int __cmd_kmem(void)
 {
-       int err;
+       int err = -EINVAL;
        struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
        if (session == NULL)
                return -ENOMEM;
 
+       if (!perf_session__has_traces(session, "kmem record"))
+               goto out_delete;
+
        setup_pager();
        err = perf_session__process_events(session, &event_ops);
        if (err != 0)
@@ -784,7 +766,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __used)
                        setup_sorting(&alloc_sort, default_sort_order);
 
                return __cmd_kmem();
-       }
+       } else
+               usage_with_options(kmem_usage, kmem_options);
 
        return 0;
 }
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
new file mode 100644 (file)
index 0000000..fb9ab2a
--- /dev/null
@@ -0,0 +1,678 @@
+#include "builtin.h"
+#include "perf.h"
+
+#include "util/util.h"
+#include "util/cache.h"
+#include "util/symbol.h"
+#include "util/thread.h"
+#include "util/header.h"
+
+#include "util/parse-options.h"
+#include "util/trace-event.h"
+
+#include "util/debug.h"
+#include "util/session.h"
+
+#include <sys/types.h>
+#include <sys/prctl.h>
+#include <semaphore.h>
+#include <pthread.h>
+#include <math.h>
+#include <limits.h>
+
+#include <linux/list.h>
+#include <linux/hash.h>
+
+/* based on kernel/lockdep.c */
+#define LOCKHASH_BITS          12
+#define LOCKHASH_SIZE          (1UL << LOCKHASH_BITS)
+
+static struct list_head lockhash_table[LOCKHASH_SIZE];
+
+#define __lockhashfn(key)      hash_long((unsigned long)key, LOCKHASH_BITS)
+#define lockhashentry(key)     (lockhash_table + __lockhashfn((key)))
+
+#define LOCK_STATE_UNLOCKED    0              /* initial state */
+#define LOCK_STATE_LOCKED      1
+
+struct lock_stat {
+       struct list_head        hash_entry;
+       struct rb_node          rb;             /* used for sorting */
+
+       /*
+        * FIXME: raw_field_value() returns unsigned long long,
+        * so address of lockdep_map should be dealed as 64bit.
+        * Is there more better solution?
+        */
+       void                    *addr;          /* address of lockdep_map, used as ID */
+       char                    *name;          /* for strcpy(), we cannot use const */
+
+       int                     state;
+       u64                     prev_event_time; /* timestamp of previous event */
+
+       unsigned int            nr_acquired;
+       unsigned int            nr_acquire;
+       unsigned int            nr_contended;
+       unsigned int            nr_release;
+
+       /* these times are in nano sec. */
+       u64                     wait_time_total;
+       u64                     wait_time_min;
+       u64                     wait_time_max;
+};
+
+/* build simple key function one is bigger than two */
+#define SINGLE_KEY(member)                                             \
+       static int lock_stat_key_ ## member(struct lock_stat *one,      \
+                                        struct lock_stat *two)         \
+       {                                                               \
+               return one->member > two->member;                       \
+       }
+
+SINGLE_KEY(nr_acquired)
+SINGLE_KEY(nr_contended)
+SINGLE_KEY(wait_time_total)
+SINGLE_KEY(wait_time_min)
+SINGLE_KEY(wait_time_max)
+
+struct lock_key {
+       /*
+        * name: the value for specify by user
+        * this should be simpler than raw name of member
+        * e.g. nr_acquired -> acquired, wait_time_total -> wait_total
+        */
+       const char              *name;
+       int                     (*key)(struct lock_stat*, struct lock_stat*);
+};
+
+static const char              *sort_key = "acquired";
+
+static int                     (*compare)(struct lock_stat *, struct lock_stat *);
+
+static struct rb_root          result; /* place to store sorted data */
+
+#define DEF_KEY_LOCK(name, fn_suffix)  \
+       { #name, lock_stat_key_ ## fn_suffix }
+struct lock_key keys[] = {
+       DEF_KEY_LOCK(acquired, nr_acquired),
+       DEF_KEY_LOCK(contended, nr_contended),
+       DEF_KEY_LOCK(wait_total, wait_time_total),
+       DEF_KEY_LOCK(wait_min, wait_time_min),
+       DEF_KEY_LOCK(wait_max, wait_time_max),
+
+       /* extra comparisons much complicated should be here */
+
+       { NULL, NULL }
+};
+
+static void select_key(void)
+{
+       int i;
+
+       for (i = 0; keys[i].name; i++) {
+               if (!strcmp(keys[i].name, sort_key)) {
+                       compare = keys[i].key;
+                       return;
+               }
+       }
+
+       die("Unknown compare key:%s\n", sort_key);
+}
+
+static void insert_to_result(struct lock_stat *st,
+                            int (*bigger)(struct lock_stat *, struct lock_stat *))
+{
+       struct rb_node **rb = &result.rb_node;
+       struct rb_node *parent = NULL;
+       struct lock_stat *p;
+
+       while (*rb) {
+               p = container_of(*rb, struct lock_stat, rb);
+               parent = *rb;
+
+               if (bigger(st, p))
+                       rb = &(*rb)->rb_left;
+               else
+                       rb = &(*rb)->rb_right;
+       }
+
+       rb_link_node(&st->rb, parent, rb);
+       rb_insert_color(&st->rb, &result);
+}
+
+/* returns left most element of result, and erase it */
+static struct lock_stat *pop_from_result(void)
+{
+       struct rb_node *node = result.rb_node;
+
+       if (!node)
+               return NULL;
+
+       while (node->rb_left)
+               node = node->rb_left;
+
+       rb_erase(node, &result);
+       return container_of(node, struct lock_stat, rb);
+}
+
+static struct lock_stat *lock_stat_findnew(void *addr, const char *name)
+{
+       struct list_head *entry = lockhashentry(addr);
+       struct lock_stat *ret, *new;
+
+       list_for_each_entry(ret, entry, hash_entry) {
+               if (ret->addr == addr)
+                       return ret;
+       }
+
+       new = zalloc(sizeof(struct lock_stat));
+       if (!new)
+               goto alloc_failed;
+
+       new->addr = addr;
+       new->name = zalloc(sizeof(char) * strlen(name) + 1);
+       if (!new->name)
+               goto alloc_failed;
+       strcpy(new->name, name);
+
+       /* LOCK_STATE_UNLOCKED == 0 isn't guaranteed forever */
+       new->state = LOCK_STATE_UNLOCKED;
+       new->wait_time_min = ULLONG_MAX;
+
+       list_add(&new->hash_entry, entry);
+       return new;
+
+alloc_failed:
+       die("memory allocation failed\n");
+}
+
+static char                    const *input_name = "perf.data";
+
+static int                     profile_cpu = -1;
+
+struct raw_event_sample {
+       u32                     size;
+       char                    data[0];
+};
+
+struct trace_acquire_event {
+       void                    *addr;
+       const char              *name;
+};
+
+struct trace_acquired_event {
+       void                    *addr;
+       const char              *name;
+};
+
+struct trace_contended_event {
+       void                    *addr;
+       const char              *name;
+};
+
+struct trace_release_event {
+       void                    *addr;
+       const char              *name;
+};
+
+struct trace_lock_handler {
+       void (*acquire_event)(struct trace_acquire_event *,
+                             struct event *,
+                             int cpu,
+                             u64 timestamp,
+                             struct thread *thread);
+
+       void (*acquired_event)(struct trace_acquired_event *,
+                              struct event *,
+                              int cpu,
+                              u64 timestamp,
+                              struct thread *thread);
+
+       void (*contended_event)(struct trace_contended_event *,
+                               struct event *,
+                               int cpu,
+                               u64 timestamp,
+                               struct thread *thread);
+
+       void (*release_event)(struct trace_release_event *,
+                             struct event *,
+                             int cpu,
+                             u64 timestamp,
+                             struct thread *thread);
+};
+
+static void
+report_lock_acquire_event(struct trace_acquire_event *acquire_event,
+                       struct event *__event __used,
+                       int cpu __used,
+                       u64 timestamp,
+                       struct thread *thread __used)
+{
+       struct lock_stat *st;
+
+       st = lock_stat_findnew(acquire_event->addr, acquire_event->name);
+
+       switch (st->state) {
+       case LOCK_STATE_UNLOCKED:
+               break;
+       case LOCK_STATE_LOCKED:
+               break;
+       default:
+               BUG_ON(1);
+               break;
+       }
+
+       st->prev_event_time = timestamp;
+}
+
+static void
+report_lock_acquired_event(struct trace_acquired_event *acquired_event,
+                        struct event *__event __used,
+                        int cpu __used,
+                        u64 timestamp,
+                        struct thread *thread __used)
+{
+       struct lock_stat *st;
+
+       st = lock_stat_findnew(acquired_event->addr, acquired_event->name);
+
+       switch (st->state) {
+       case LOCK_STATE_UNLOCKED:
+               st->state = LOCK_STATE_LOCKED;
+               st->nr_acquired++;
+               break;
+       case LOCK_STATE_LOCKED:
+               break;
+       default:
+               BUG_ON(1);
+               break;
+       }
+
+       st->prev_event_time = timestamp;
+}
+
+static void
+report_lock_contended_event(struct trace_contended_event *contended_event,
+                         struct event *__event __used,
+                         int cpu __used,
+                         u64 timestamp,
+                         struct thread *thread __used)
+{
+       struct lock_stat *st;
+
+       st = lock_stat_findnew(contended_event->addr, contended_event->name);
+
+       switch (st->state) {
+       case LOCK_STATE_UNLOCKED:
+               break;
+       case LOCK_STATE_LOCKED:
+               st->nr_contended++;
+               break;
+       default:
+               BUG_ON(1);
+               break;
+       }
+
+       st->prev_event_time = timestamp;
+}
+
+static void
+report_lock_release_event(struct trace_release_event *release_event,
+                       struct event *__event __used,
+                       int cpu __used,
+                       u64 timestamp,
+                       struct thread *thread __used)
+{
+       struct lock_stat *st;
+       u64 hold_time;
+
+       st = lock_stat_findnew(release_event->addr, release_event->name);
+
+       switch (st->state) {
+       case LOCK_STATE_UNLOCKED:
+               break;
+       case LOCK_STATE_LOCKED:
+               st->state = LOCK_STATE_UNLOCKED;
+               hold_time = timestamp - st->prev_event_time;
+
+               if (timestamp < st->prev_event_time) {
+                       /* terribly, this can happen... */
+                       goto end;
+               }
+
+               if (st->wait_time_min > hold_time)
+                       st->wait_time_min = hold_time;
+               if (st->wait_time_max < hold_time)
+                       st->wait_time_max = hold_time;
+               st->wait_time_total += hold_time;
+
+               st->nr_release++;
+               break;
+       default:
+               BUG_ON(1);
+               break;
+       }
+
+end:
+       st->prev_event_time = timestamp;
+}
+
+/* lock oriented handlers */
+/* TODO: handlers for CPU oriented, thread oriented */
+static struct trace_lock_handler report_lock_ops  = {
+       .acquire_event          = report_lock_acquire_event,
+       .acquired_event         = report_lock_acquired_event,
+       .contended_event        = report_lock_contended_event,
+       .release_event          = report_lock_release_event,
+};
+
+static struct trace_lock_handler *trace_handler;
+
+static void
+process_lock_acquire_event(void *data,
+                          struct event *event __used,
+                          int cpu __used,
+                          u64 timestamp __used,
+                          struct thread *thread __used)
+{
+       struct trace_acquire_event acquire_event;
+       u64 tmp;                /* this is required for casting... */
+
+       tmp = raw_field_value(event, "lockdep_addr", data);
+       memcpy(&acquire_event.addr, &tmp, sizeof(void *));
+       acquire_event.name = (char *)raw_field_ptr(event, "name", data);
+
+       if (trace_handler->acquire_event)
+               trace_handler->acquire_event(&acquire_event, event, cpu, timestamp, thread);
+}
+
+static void
+process_lock_acquired_event(void *data,
+                           struct event *event __used,
+                           int cpu __used,
+                           u64 timestamp __used,
+                           struct thread *thread __used)
+{
+       struct trace_acquired_event acquired_event;
+       u64 tmp;                /* this is required for casting... */
+
+       tmp = raw_field_value(event, "lockdep_addr", data);
+       memcpy(&acquired_event.addr, &tmp, sizeof(void *));
+       acquired_event.name = (char *)raw_field_ptr(event, "name", data);
+
+       if (trace_handler->acquire_event)
+               trace_handler->acquired_event(&acquired_event, event, cpu, timestamp, thread);
+}
+
+static void
+process_lock_contended_event(void *data,
+                            struct event *event __used,
+                            int cpu __used,
+                            u64 timestamp __used,
+                            struct thread *thread __used)
+{
+       struct trace_contended_event contended_event;
+       u64 tmp;                /* this is required for casting... */
+
+       tmp = raw_field_value(event, "lockdep_addr", data);
+       memcpy(&contended_event.addr, &tmp, sizeof(void *));
+       contended_event.name = (char *)raw_field_ptr(event, "name", data);
+
+       if (trace_handler->acquire_event)
+               trace_handler->contended_event(&contended_event, event, cpu, timestamp, thread);
+}
+
+static void
+process_lock_release_event(void *data,
+                          struct event *event __used,
+                          int cpu __used,
+                          u64 timestamp __used,
+                          struct thread *thread __used)
+{
+       struct trace_release_event release_event;
+       u64 tmp;                /* this is required for casting... */
+
+       tmp = raw_field_value(event, "lockdep_addr", data);
+       memcpy(&release_event.addr, &tmp, sizeof(void *));
+       release_event.name = (char *)raw_field_ptr(event, "name", data);
+
+       if (trace_handler->acquire_event)
+               trace_handler->release_event(&release_event, event, cpu, timestamp, thread);
+}
+
+static void
+process_raw_event(void *data, int cpu,
+                 u64 timestamp, struct thread *thread)
+{
+       struct event *event;
+       int type;
+
+       type = trace_parse_common_type(data);
+       event = trace_find_event(type);
+
+       if (!strcmp(event->name, "lock_acquire"))
+               process_lock_acquire_event(data, event, cpu, timestamp, thread);
+       if (!strcmp(event->name, "lock_acquired"))
+               process_lock_acquired_event(data, event, cpu, timestamp, thread);
+       if (!strcmp(event->name, "lock_contended"))
+               process_lock_contended_event(data, event, cpu, timestamp, thread);
+       if (!strcmp(event->name, "lock_release"))
+               process_lock_release_event(data, event, cpu, timestamp, thread);
+}
+
+static int process_sample_event(event_t *event, struct perf_session *session)
+{
+       struct thread *thread;
+       struct sample_data data;
+
+       bzero(&data, sizeof(struct sample_data));
+       event__parse_sample(event, session->sample_type, &data);
+       thread = perf_session__findnew(session, data.pid);
+
+       if (thread == NULL) {
+               pr_debug("problem processing %d event, skipping it.\n",
+                        event->header.type);
+               return -1;
+       }
+
+       dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
+       if (profile_cpu != -1 && profile_cpu != (int) data.cpu)
+               return 0;
+
+       process_raw_event(data.raw_data, data.cpu, data.time, thread);
+
+       return 0;
+}
+
+/* TODO: various way to print, coloring, nano or milli sec */
+static void print_result(void)
+{
+       struct lock_stat *st;
+       char cut_name[20];
+
+       printf("%18s ", "ID");
+       printf("%20s ", "Name");
+       printf("%10s ", "acquired");
+       printf("%10s ", "contended");
+
+       printf("%15s ", "total wait (ns)");
+       printf("%15s ", "max wait (ns)");
+       printf("%15s ", "min wait (ns)");
+
+       printf("\n\n");
+
+       while ((st = pop_from_result())) {
+               bzero(cut_name, 20);
+
+               printf("%p ", st->addr);
+
+               if (strlen(st->name) < 16) {
+                       /* output raw name */
+                       printf("%20s ", st->name);
+               } else {
+                       strncpy(cut_name, st->name, 16);
+                       cut_name[16] = '.';
+                       cut_name[17] = '.';
+                       cut_name[18] = '.';
+                       cut_name[19] = '\0';
+                       /* cut off name for saving output style */
+                       printf("%20s ", cut_name);
+               }
+
+               printf("%10u ", st->nr_acquired);
+               printf("%10u ", st->nr_contended);
+
+               printf("%15llu ", st->wait_time_total);
+               printf("%15llu ", st->wait_time_max);
+               printf("%15llu ", st->wait_time_min == ULLONG_MAX ?
+                      0 : st->wait_time_min);
+               printf("\n");
+       }
+}
+
+static void dump_map(void)
+{
+       unsigned int i;
+       struct lock_stat *st;
+
+       for (i = 0; i < LOCKHASH_SIZE; i++) {
+               list_for_each_entry(st, &lockhash_table[i], hash_entry) {
+                       printf("%p: %s\n", st->addr, st->name);
+               }
+       }
+}
+
+static struct perf_event_ops eops = {
+       .sample                 = process_sample_event,
+       .comm                   = event__process_comm,
+};
+
+static struct perf_session *session;
+
+static int read_events(void)
+{
+       session = perf_session__new(input_name, O_RDONLY, 0);
+       if (!session)
+               die("Initializing perf session failed\n");
+
+       return perf_session__process_events(session, &eops);
+}
+
+static void sort_result(void)
+{
+       unsigned int i;
+       struct lock_stat *st;
+
+       for (i = 0; i < LOCKHASH_SIZE; i++) {
+               list_for_each_entry(st, &lockhash_table[i], hash_entry) {
+                       insert_to_result(st, compare);
+               }
+       }
+}
+
+static void __cmd_report(void)
+{
+       setup_pager();
+       select_key();
+       read_events();
+       sort_result();
+       print_result();
+}
+
+static const char * const report_usage[] = {
+       "perf lock report [<options>]",
+       NULL
+};
+
+static const struct option report_options[] = {
+       OPT_STRING('k', "key", &sort_key, "acquired",
+                   "key for sorting"),
+       /* TODO: type */
+       OPT_END()
+};
+
+static const char * const lock_usage[] = {
+       "perf lock [<options>] {record|trace|report}",
+       NULL
+};
+
+static const struct option lock_options[] = {
+       OPT_STRING('i', "input", &input_name, "file", "input file name"),
+       OPT_BOOLEAN('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"),
+       OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"),
+       OPT_END()
+};
+
+static const char *record_args[] = {
+       "record",
+       "-a",
+       "-R",
+       "-M",
+       "-f",
+       "-m", "1024",
+       "-c", "1",
+       "-e", "lock:lock_acquire:r",
+       "-e", "lock:lock_acquired:r",
+       "-e", "lock:lock_contended:r",
+       "-e", "lock:lock_release:r",
+};
+
+static int __cmd_record(int argc, const char **argv)
+{
+       unsigned int rec_argc, i, j;
+       const char **rec_argv;
+
+       rec_argc = ARRAY_SIZE(record_args) + argc - 1;
+       rec_argv = calloc(rec_argc + 1, sizeof(char *));
+
+       for (i = 0; i < ARRAY_SIZE(record_args); i++)
+               rec_argv[i] = strdup(record_args[i]);
+
+       for (j = 1; j < (unsigned int)argc; j++, i++)
+               rec_argv[i] = argv[j];
+
+       BUG_ON(i != rec_argc);
+
+       return cmd_record(i, rec_argv, NULL);
+}
+
+int cmd_lock(int argc, const char **argv, const char *prefix __used)
+{
+       unsigned int i;
+
+       symbol__init();
+       for (i = 0; i < LOCKHASH_SIZE; i++)
+               INIT_LIST_HEAD(lockhash_table + i);
+
+       argc = parse_options(argc, argv, lock_options, lock_usage,
+                            PARSE_OPT_STOP_AT_NON_OPTION);
+       if (!argc)
+               usage_with_options(lock_usage, lock_options);
+
+       if (!strncmp(argv[0], "rec", 3)) {
+               return __cmd_record(argc, argv);
+       } else if (!strncmp(argv[0], "report", 6)) {
+               trace_handler = &report_lock_ops;
+               if (argc) {
+                       argc = parse_options(argc, argv,
+                                            report_options, report_usage, 0);
+                       if (argc)
+                               usage_with_options(report_usage, report_options);
+               }
+               __cmd_report();
+       } else if (!strcmp(argv[0], "trace")) {
+               /* Aliased to 'perf trace' */
+               return cmd_trace(argc, argv, prefix);
+       } else if (!strcmp(argv[0], "map")) {
+               /* recycling report_lock_ops */
+               trace_handler = &report_lock_ops;
+               setup_pager();
+               read_events();
+               dump_map();
+       } else {
+               usage_with_options(lock_usage, lock_options);
+       }
+
+       return 0;
+}
index c1e6774fd3ed316171118cb6598ac8e2dbf7a36c..ad47bd4c50efa5354aed01e5ff081836028c7638 100644 (file)
@@ -41,7 +41,6 @@
 #include "util/debugfs.h"
 #include "util/symbol.h"
 #include "util/thread.h"
-#include "util/session.h"
 #include "util/parse-options.h"
 #include "util/parse-events.h" /* For debugfs_path */
 #include "util/probe-finder.h"
@@ -55,11 +54,13 @@ static struct {
        bool need_dwarf;
        bool list_events;
        bool force_add;
+       bool show_lines;
        int nr_probe;
        struct probe_point probes[MAX_PROBES];
        struct strlist *dellist;
-       struct perf_session *psession;
-       struct map *kmap;
+       struct map_groups kmap_groups;
+       struct map *kmaps[MAP__NR_TYPES];
+       struct line_range line_range;
 } session;
 
 
@@ -120,8 +121,8 @@ static int opt_del_probe_event(const struct option *opt __used,
 static void evaluate_probe_point(struct probe_point *pp)
 {
        struct symbol *sym;
-       sym = map__find_symbol_by_name(session.kmap, pp->function,
-                                      session.psession, NULL);
+       sym = map__find_symbol_by_name(session.kmaps[MAP__FUNCTION],
+                                      pp->function, NULL);
        if (!sym)
                die("Kernel symbol \'%s\' not found - probe not added.",
                    pp->function);
@@ -130,12 +131,23 @@ static void evaluate_probe_point(struct probe_point *pp)
 #ifndef NO_LIBDWARF
 static int open_vmlinux(void)
 {
-       if (map__load(session.kmap, session.psession, NULL) < 0) {
+       if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) {
                pr_debug("Failed to load kernel map.\n");
                return -EINVAL;
        }
-       pr_debug("Try to open %s\n", session.kmap->dso->long_name);
-       return open(session.kmap->dso->long_name, O_RDONLY);
+       pr_debug("Try to open %s\n",
+                session.kmaps[MAP__FUNCTION]->dso->long_name);
+       return open(session.kmaps[MAP__FUNCTION]->dso->long_name, O_RDONLY);
+}
+
+static int opt_show_lines(const struct option *opt __used,
+                         const char *str, int unset __used)
+{
+       if (str)
+               parse_line_range_desc(str, &session.line_range);
+       INIT_LIST_HEAD(&session.line_range.line_list);
+       session.show_lines = true;
+       return 0;
 }
 #endif
 
@@ -144,6 +156,7 @@ static const char * const probe_usage[] = {
        "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
        "perf probe [<options>] --del '[GROUP:]EVENT' ...",
        "perf probe --list",
+       "perf probe --line 'LINEDESC'",
        NULL
 };
 
@@ -182,9 +195,31 @@ static const struct option options[] = {
                opt_add_probe_event),
        OPT_BOOLEAN('f', "force", &session.force_add, "forcibly add events"
                    " with existing name"),
+#ifndef NO_LIBDWARF
+       OPT_CALLBACK('L', "line", NULL,
+                    "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]",
+                    "Show source code lines.", opt_show_lines),
+#endif
        OPT_END()
 };
 
+/* Initialize symbol maps for vmlinux */
+static void init_vmlinux(void)
+{
+       symbol_conf.sort_by_name = true;
+       if (symbol_conf.vmlinux_name == NULL)
+               symbol_conf.try_vmlinux_path = true;
+       else
+               pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name);
+       if (symbol__init() < 0)
+               die("Failed to init symbol map.");
+
+       map_groups__init(&session.kmap_groups);
+       if (map_groups__create_kernel_maps(&session.kmap_groups,
+                                          session.kmaps) < 0)
+               die("Failed to create kernel maps.");
+}
+
 int cmd_probe(int argc, const char **argv, const char *prefix __used)
 {
        int i, ret;
@@ -203,7 +238,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
                parse_probe_event_argv(argc, argv);
        }
 
-       if ((!session.nr_probe && !session.dellist && !session.list_events))
+       if ((!session.nr_probe && !session.dellist && !session.list_events &&
+            !session.show_lines))
                usage_with_options(probe_usage, options);
 
        if (debugfs_valid_mountpoint(debugfs_path) < 0)
@@ -215,10 +251,34 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
                                   " --add/--del.\n");
                        usage_with_options(probe_usage, options);
                }
+               if (session.show_lines) {
+                       pr_warning("  Error: Don't use --list with --line.\n");
+                       usage_with_options(probe_usage, options);
+               }
                show_perf_probe_events();
                return 0;
        }
 
+#ifndef NO_LIBDWARF
+       if (session.show_lines) {
+               if (session.nr_probe != 0 || session.dellist) {
+                       pr_warning("  Error: Don't use --line with"
+                                  " --add/--del.\n");
+                       usage_with_options(probe_usage, options);
+               }
+               init_vmlinux();
+               fd = open_vmlinux();
+               if (fd < 0)
+                       die("Could not open debuginfo file.");
+               ret = find_line_range(fd, &session.line_range);
+               if (ret <= 0)
+                       die("Source line is not found.\n");
+               close(fd);
+               show_line_range(&session.line_range);
+               return 0;
+       }
+#endif
+
        if (session.dellist) {
                del_trace_kprobe_events(session.dellist);
                strlist__delete(session.dellist);
@@ -226,20 +286,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
                        return 0;
        }
 
-       /* Initialize symbol maps for vmlinux */
-       symbol_conf.sort_by_name = true;
-       if (symbol_conf.vmlinux_name == NULL)
-               symbol_conf.try_vmlinux_path = true;
-       if (symbol__init() < 0)
-               die("Failed to init symbol map.");
-       session.psession = perf_session__new(NULL, O_WRONLY, false);
-       if (session.psession == NULL)
-               die("Failed to init perf_session.");
-       session.kmap = map_groups__find_by_name(&session.psession->kmaps,
-                                               MAP__FUNCTION,
-                                               "[kernel.kallsyms]");
-       if (!session.kmap)
-               die("Could not find kernel map.\n");
+       /* Add probes */
+       init_vmlinux();
 
        if (session.need_dwarf)
 #ifdef NO_LIBDWARF
index 265425322734eecfc3087a7be42a60960c89f2b0..771533ced6a803d23886214d5551df1f0db440b1 100644 (file)
@@ -5,10 +5,13 @@
  * (or a CPU, or a PID) into the perf.data output file - for
  * later analysis via perf report.
  */
+#define _FILE_OFFSET_BITS 64
+
 #include "builtin.h"
 
 #include "perf.h"
 
+#include "util/build-id.h"
 #include "util/util.h"
 #include "util/parse-options.h"
 #include "util/parse-events.h"
@@ -62,6 +65,7 @@ static int                    nr_poll                         =      0;
 static int                     nr_cpu                          =      0;
 
 static int                     file_new                        =      1;
+static off_t                   post_processing_offset;
 
 static struct perf_session     *session;
 
@@ -111,22 +115,10 @@ static void write_output(void *buf, size_t size)
        }
 }
 
-static void write_event(event_t *buf, size_t size)
-{
-       /*
-       * Add it to the list of DSOs, so that when we finish this
-        * record session we can pick the available build-ids.
-        */
-       if (buf->header.type == PERF_RECORD_MMAP)
-               dsos__findnew(buf->mmap.filename);
-
-       write_output(buf, size);
-}
-
 static int process_synthesized_event(event_t *event,
                                     struct perf_session *self __used)
 {
-       write_event(event, event->header.size);
+       write_output(event, event->header.size);
        return 0;
 }
 
@@ -178,14 +170,14 @@ static void mmap_read(struct mmap_data *md)
                size = md->mask + 1 - (old & md->mask);
                old += size;
 
-               write_event(buf, size);
+               write_output(buf, size);
        }
 
        buf = &data[old & md->mask];
        size = head - old;
        old += size;
 
-       write_event(buf, size);
+       write_output(buf, size);
 
        md->prev = old;
        mmap_write_tail(md, old);
@@ -395,10 +387,21 @@ static void open_counters(int cpu, pid_t pid)
        nr_cpu++;
 }
 
+static int process_buildids(void)
+{
+       u64 size = lseek(output, 0, SEEK_CUR);
+
+       session->fd = output;
+       return __perf_session__process_events(session, post_processing_offset,
+                                             size - post_processing_offset,
+                                             size, &build_id__mark_dso_hit_ops);
+}
+
 static void atexit_header(void)
 {
        session->header.data_size += bytes_written;
 
+       process_buildids();
        perf_header__write(&session->header, output, true);
 }
 
@@ -551,8 +554,23 @@ static int __cmd_record(int argc, const char **argv)
                        return err;
        }
 
+       post_processing_offset = lseek(output, 0, SEEK_CUR);
+
+       err = event__synthesize_kernel_mmap(process_synthesized_event,
+                                           session, "_text");
+       if (err < 0) {
+               pr_err("Couldn't record kernel reference relocation symbol.\n");
+               return err;
+       }
+
+       err = event__synthesize_modules(process_synthesized_event, session);
+       if (err < 0) {
+               pr_err("Couldn't record kernel reference relocation symbol.\n");
+               return err;
+       }
+
        if (!system_wide && profile_cpu == -1)
-               event__synthesize_thread(pid, process_synthesized_event,
+               event__synthesize_thread(target_pid, process_synthesized_event,
                                         session);
        else
                event__synthesize_threads(process_synthesized_event, session);
index db10c0e8ecae7ee18f4ce352256bed5516fd4024..cfc655d40bb7b4a88f37c068aef908e76e408a4c 100644 (file)
@@ -34,6 +34,8 @@
 static char            const *input_name = "perf.data";
 
 static int             force;
+static bool            hide_unresolved;
+static bool            dont_use_callchains;
 
 static int             show_threads;
 static struct perf_read_values show_threads_values;
@@ -91,11 +93,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 
        event__parse_sample(event, session->sample_type, &data);
 
-       dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
-               event->header.misc,
-               data.pid, data.tid,
-               (void *)(long)data.ip,
-               (long long)data.period);
+       dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+                   data.pid, data.tid, data.ip, data.period);
 
        if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
                unsigned int i;
@@ -121,7 +120,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
                return -1;
        }
 
-       if (al.filtered)
+       if (al.filtered || (hide_unresolved && al.sym == NULL))
                return 0;
 
        if (perf_session__add_hist_entry(session, &al, data.callchain, data.period)) {
@@ -156,14 +155,14 @@ static int process_read_event(event_t *event, struct perf_session *session __use
        return 0;
 }
 
-static int sample_type_check(struct perf_session *session)
+static int perf_session__setup_sample_type(struct perf_session *self)
 {
-       if (!(session->sample_type & PERF_SAMPLE_CALLCHAIN)) {
+       if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
                if (sort__has_parent) {
                        fprintf(stderr, "selected --sort parent, but no"
                                        " callchain data. Did you call"
                                        " perf record without -g?\n");
-                       return -1;
+                       return -EINVAL;
                }
                if (symbol_conf.use_callchain) {
                        fprintf(stderr, "selected -g but no callchain data."
@@ -171,12 +170,13 @@ static int sample_type_check(struct perf_session *session)
                                        " -g?\n");
                        return -1;
                }
-       } else if (callchain_param.mode != CHAIN_NONE && !symbol_conf.use_callchain) {
+       } else if (!dont_use_callchains && callchain_param.mode != CHAIN_NONE &&
+                  !symbol_conf.use_callchain) {
                        symbol_conf.use_callchain = true;
                        if (register_callchain_param(&callchain_param) < 0) {
                                fprintf(stderr, "Can't register callchain"
                                                " params\n");
-                               return -1;
+                               return -EINVAL;
                        }
        }
 
@@ -184,20 +184,18 @@ static int sample_type_check(struct perf_session *session)
 }
 
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_mmap_event     = event__process_mmap,
-       .process_comm_event     = event__process_comm,
-       .process_exit_event     = event__process_task,
-       .process_fork_event     = event__process_task,
-       .process_lost_event     = event__process_lost,
-       .process_read_event     = process_read_event,
-       .sample_type_check      = sample_type_check,
+       .sample = process_sample_event,
+       .mmap   = event__process_mmap,
+       .comm   = event__process_comm,
+       .exit   = event__process_task,
+       .fork   = event__process_task,
+       .lost   = event__process_lost,
+       .read   = process_read_event,
 };
 
-
 static int __cmd_report(void)
 {
-       int ret;
+       int ret = -EINVAL;
        struct perf_session *session;
 
        session = perf_session__new(input_name, O_RDONLY, force);
@@ -207,6 +205,10 @@ static int __cmd_report(void)
        if (show_threads)
                perf_read_values_init(&show_threads_values);
 
+       ret = perf_session__setup_sample_type(session);
+       if (ret)
+               goto out_delete;
+
        ret = perf_session__process_events(session, &event_ops);
        if (ret)
                goto out_delete;
@@ -243,11 +245,19 @@ out_delete:
 
 static int
 parse_callchain_opt(const struct option *opt __used, const char *arg,
-                   int unset __used)
+                   int unset)
 {
        char *tok;
        char *endptr;
 
+       /*
+        * --no-call-graph
+        */
+       if (unset) {
+               dont_use_callchains = true;
+               return 0;
+       }
+
        symbol_conf.use_callchain = true;
 
        if (!arg)
@@ -269,7 +279,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
 
        else if (!strncmp(tok, "none", strlen(arg))) {
                callchain_param.mode = CHAIN_NONE;
-               symbol_conf.use_callchain = true;
+               symbol_conf.use_callchain = false;
 
                return 0;
        }
@@ -319,7 +329,7 @@ static const struct option options[] = {
                   "pretty printing style key: normal raw"),
        OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
                   "sort by key(s): pid, comm, dso, symbol, parent"),
-       OPT_BOOLEAN('P', "full-paths", &event_ops.full_paths,
+       OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
                    "Don't shorten the pathnames taking into account the cwd"),
        OPT_STRING('p', "parent", &parent_pattern, "regex",
                   "regex filter to identify parent, see: '--sort parent'"),
@@ -340,6 +350,8 @@ static const struct option options[] = {
        OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
                   "separator for columns, no spaces will be added between "
                   "columns '.' is reserved."),
+       OPT_BOOLEAN('U', "hide-unresolved", &hide_unresolved,
+                   "Only display entries resolved to a symbol"),
        OPT_END()
 };
 
index 80209df6cfe8df3267050c8bb64f5974748a8ce7..4f5a03e43444ef2b9f02551557aae18dddf9ace7 100644 (file)
@@ -1621,11 +1621,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 
        event__parse_sample(event, session->sample_type, &data);
 
-       dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
-               event->header.misc,
-               data.pid, data.tid,
-               (void *)(long)data.ip,
-               (long long)data.period);
+       dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+                   data.pid, data.tid, data.ip, data.period);
 
        thread = perf_session__findnew(session, data.pid);
        if (thread == NULL) {
@@ -1653,33 +1650,22 @@ static int process_lost_event(event_t *event __used,
        return 0;
 }
 
-static int sample_type_check(struct perf_session *session __used)
-{
-       if (!(session->sample_type & PERF_SAMPLE_RAW)) {
-               fprintf(stderr,
-                       "No trace sample to read. Did you call perf record "
-                       "without -R?");
-               return -1;
-       }
-
-       return 0;
-}
-
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_comm_event     = event__process_comm,
-       .process_lost_event     = process_lost_event,
-       .sample_type_check      = sample_type_check,
+       .sample = process_sample_event,
+       .comm   = event__process_comm,
+       .lost   = process_lost_event,
 };
 
 static int read_events(void)
 {
-       int err;
+       int err = -EINVAL;
        struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
        if (session == NULL)
                return -ENOMEM;
 
-       err = perf_session__process_events(session, &event_ops);
+       if (perf_session__has_traces(session, "record -R"))
+               err = perf_session__process_events(session, &event_ops);
+
        perf_session__delete(session);
        return err;
 }
index c70d72003557f17f29345b0f219dc5ca9f572d75..e8c85d5aec4151fc965f2b16063c60da456d6e67 100644 (file)
@@ -44,6 +44,7 @@
 #include "util/parse-events.h"
 #include "util/event.h"
 #include "util/debug.h"
+#include "util/header.h"
 
 #include <sys/prctl.h>
 #include <math.h>
@@ -79,6 +80,8 @@ static int                    fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static int                     event_scaled[MAX_COUNTERS];
 
+static volatile int done = 0;
+
 struct stats
 {
        double n, mean, M2;
@@ -247,61 +250,64 @@ static int run_perf_stat(int argc __used, const char **argv)
        unsigned long long t0, t1;
        int status = 0;
        int counter;
-       int pid;
+       int pid = target_pid;
        int child_ready_pipe[2], go_pipe[2];
+       const bool forks = (target_pid == -1 && argc > 0);
        char buf;
 
        if (!system_wide)
                nr_cpus = 1;
 
-       if (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0) {
+       if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
                perror("failed to create pipes");
                exit(1);
        }
 
-       if ((pid = fork()) < 0)
-               perror("failed to fork");
+       if (forks) {
+               if ((pid = fork()) < 0)
+                       perror("failed to fork");
+
+               if (!pid) {
+                       close(child_ready_pipe[0]);
+                       close(go_pipe[1]);
+                       fcntl(go_pipe[0], F_SETFD, FD_CLOEXEC);
+
+                       /*
+                        * Do a dummy execvp to get the PLT entry resolved,
+                        * so we avoid the resolver overhead on the real
+                        * execvp call.
+                        */
+                       execvp("", (char **)argv);
+
+                       /*
+                        * Tell the parent we're ready to go
+                        */
+                       close(child_ready_pipe[1]);
+
+                       /*
+                        * Wait until the parent tells us to go.
+                        */
+                       if (read(go_pipe[0], &buf, 1) == -1)
+                               perror("unable to read pipe");
+
+                       execvp(argv[0], (char **)argv);
+
+                       perror(argv[0]);
+                       exit(-1);
+               }
 
-       if (!pid) {
-               close(child_ready_pipe[0]);
-               close(go_pipe[1]);
-               fcntl(go_pipe[0], F_SETFD, FD_CLOEXEC);
+               child_pid = pid;
 
                /*
-                * Do a dummy execvp to get the PLT entry resolved,
-                * so we avoid the resolver overhead on the real
-                * execvp call.
-                */
-               execvp("", (char **)argv);
-
-               /*
-                * Tell the parent we're ready to go
+                * Wait for the child to be ready to exec.
                 */
                close(child_ready_pipe[1]);
-
-               /*
-                * Wait until the parent tells us to go.
-                */
-               if (read(go_pipe[0], &buf, 1) == -1)
+               close(go_pipe[0]);
+               if (read(child_ready_pipe[0], &buf, 1) == -1)
                        perror("unable to read pipe");
-
-               execvp(argv[0], (char **)argv);
-
-               perror(argv[0]);
-               exit(-1);
+               close(child_ready_pipe[0]);
        }
 
-       child_pid = pid;
-
-       /*
-        * Wait for the child to be ready to exec.
-        */
-       close(child_ready_pipe[1]);
-       close(go_pipe[0]);
-       if (read(child_ready_pipe[0], &buf, 1) == -1)
-               perror("unable to read pipe");
-       close(child_ready_pipe[0]);
-
        for (counter = 0; counter < nr_counters; counter++)
                create_perf_stat_counter(counter, pid);
 
@@ -310,8 +316,12 @@ static int run_perf_stat(int argc __used, const char **argv)
         */
        t0 = rdclock();
 
-       close(go_pipe[1]);
-       wait(&status);
+       if (forks) {
+               close(go_pipe[1]);
+               wait(&status);
+       } else {
+               while(!done);
+       }
 
        t1 = rdclock();
 
@@ -417,10 +427,13 @@ static void print_stat(int argc, const char **argv)
        fflush(stdout);
 
        fprintf(stderr, "\n");
-       fprintf(stderr, " Performance counter stats for \'%s", argv[0]);
-
-       for (i = 1; i < argc; i++)
-               fprintf(stderr, " %s", argv[i]);
+       fprintf(stderr, " Performance counter stats for ");
+       if(target_pid == -1) {
+               fprintf(stderr, "\'%s", argv[0]);
+               for (i = 1; i < argc; i++)
+                       fprintf(stderr, " %s", argv[i]);
+       }else
+               fprintf(stderr, "task pid \'%d", target_pid);
 
        fprintf(stderr, "\'");
        if (run_count > 1)
@@ -445,6 +458,9 @@ static volatile int signr = -1;
 
 static void skip_signal(int signo)
 {
+       if(target_pid != -1)
+               done = 1;
+
        signr = signo;
 }
 
@@ -461,7 +477,7 @@ static void sig_atexit(void)
 }
 
 static const char * const stat_usage[] = {
-       "perf stat [<options>] <command>",
+       "perf stat [<options>] [<command>]",
        NULL
 };
 
@@ -492,7 +508,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 
        argc = parse_options(argc, argv, options, stat_usage,
                PARSE_OPT_STOP_AT_NON_OPTION);
-       if (!argc)
+       if (!argc && target_pid == -1)
                usage_with_options(stat_usage, options);
        if (run_count <= 0)
                usage_with_options(stat_usage, options);
index a589a43112d67f7b764ae02365a1b53e2e8119a7..0d4d8ff7914b029423dba4e742c7343925519043 100644 (file)
@@ -280,7 +280,7 @@ static u64 cpus_pstate_state[MAX_CPUS];
 
 static int process_comm_event(event_t *event, struct perf_session *session __used)
 {
-       pid_set_comm(event->comm.pid, event->comm.comm);
+       pid_set_comm(event->comm.tid, event->comm.comm);
        return 0;
 }
 
@@ -1029,33 +1029,24 @@ static void process_samples(struct perf_session *session)
        }
 }
 
-static int sample_type_check(struct perf_session *session)
-{
-       if (!(session->sample_type & PERF_SAMPLE_RAW)) {
-               fprintf(stderr, "No trace samples found in the file.\n"
-                               "Have you used 'perf timechart record' to record it?\n");
-               return -1;
-       }
-
-       return 0;
-}
-
 static struct perf_event_ops event_ops = {
-       .process_comm_event     = process_comm_event,
-       .process_fork_event     = process_fork_event,
-       .process_exit_event     = process_exit_event,
-       .process_sample_event   = queue_sample_event,
-       .sample_type_check      = sample_type_check,
+       .comm   = process_comm_event,
+       .fork   = process_fork_event,
+       .exit   = process_exit_event,
+       .sample = queue_sample_event,
 };
 
 static int __cmd_timechart(void)
 {
        struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
-       int ret;
+       int ret = -EINVAL;
 
        if (session == NULL)
                return -ENOMEM;
 
+       if (!perf_session__has_traces(session, "timechart record"))
+               goto out_delete;
+
        ret = perf_session__process_events(session, &event_ops);
        if (ret)
                goto out_delete;
index ddc584b64871019f0eb08dcd447ff511ce639983..31f2e597800c7f4331a9aa97ec9045f04a52306b 100644 (file)
@@ -94,6 +94,7 @@ struct source_line {
 
 static char                    *sym_filter                     =   NULL;
 struct sym_entry               *sym_filter_entry               =   NULL;
+struct sym_entry               *sym_filter_entry_sched         =   NULL;
 static int                     sym_pcnt_filter                 =      5;
 static int                     sym_counter                     =      0;
 static int                     display_weighted                =     -1;
@@ -201,10 +202,9 @@ static void parse_source(struct sym_entry *syme)
        len = sym->end - sym->start;
 
        sprintf(command,
-               "objdump --start-address=0x%016Lx "
-                        "--stop-address=0x%016Lx -dS %s",
-               map->unmap_ip(map, sym->start),
-               map->unmap_ip(map, sym->end), path);
+               "objdump --start-address=%#0*Lx --stop-address=%#0*Lx -dS %s",
+               BITS_PER_LONG / 4, map__rip_2objdump(map, sym->start),
+               BITS_PER_LONG / 4, map__rip_2objdump(map, sym->end), path);
 
        file = popen(command, "r");
        if (!file)
@@ -215,7 +215,7 @@ static void parse_source(struct sym_entry *syme)
        while (!feof(file)) {
                struct source_line *src;
                size_t dummy = 0;
-               char *c;
+               char *c, *sep;
 
                src = malloc(sizeof(struct source_line));
                assert(src != NULL);
@@ -234,14 +234,11 @@ static void parse_source(struct sym_entry *syme)
                *source->lines_tail = src;
                source->lines_tail = &src->next;
 
-               if (strlen(src->line)>8 && src->line[8] == ':') {
-                       src->eip = strtoull(src->line, NULL, 16);
-                       src->eip = map->unmap_ip(map, src->eip);
-               }
-               if (strlen(src->line)>8 && src->line[16] == ':') {
-                       src->eip = strtoull(src->line, NULL, 16);
-                       src->eip = map->unmap_ip(map, src->eip);
-               }
+               src->eip = strtoull(src->line, &sep, 16);
+               if (*sep == ':')
+                       src->eip = map__objdump_2ip(map, src->eip);
+               else /* this line has no ip info (e.g. source line) */
+                       src->eip = 0;
        }
        pclose(file);
 out_assign:
@@ -276,6 +273,9 @@ static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip)
                goto out_unlock;
 
        for (line = syme->src->lines; line; line = line->next) {
+               /* skip lines without IP info */
+               if (line->eip == 0)
+                       continue;
                if (line->eip == ip) {
                        line->count[counter]++;
                        break;
@@ -287,17 +287,20 @@ out_unlock:
        pthread_mutex_unlock(&syme->src->lock);
 }
 
+#define PATTERN_LEN            (BITS_PER_LONG / 4 + 2)
+
 static void lookup_sym_source(struct sym_entry *syme)
 {
        struct symbol *symbol = sym_entry__symbol(syme);
        struct source_line *line;
-       char pattern[PATH_MAX];
+       char pattern[PATTERN_LEN + 1];
 
-       sprintf(pattern, "<%s>:", symbol->name);
+       sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4,
+               map__rip_2objdump(syme->map, symbol->start));
 
        pthread_mutex_lock(&syme->src->lock);
        for (line = syme->src->lines; line; line = line->next) {
-               if (strstr(line->line, pattern)) {
+               if (memcmp(line->line, pattern, PATTERN_LEN) == 0) {
                        syme->src->source = line;
                        break;
                }
@@ -667,7 +670,7 @@ static void prompt_symbol(struct sym_entry **target, const char *msg)
        }
 
        if (!found) {
-               fprintf(stderr, "Sorry, %s is not active.\n", sym_filter);
+               fprintf(stderr, "Sorry, %s is not active.\n", buf);
                sleep(1);
                return;
        } else
@@ -695,17 +698,15 @@ static void print_mapped_keys(void)
 
        fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
 
-       if (symbol_conf.vmlinux_name) {
-               fprintf(stdout, "\t[F]     annotate display filter (percent). \t(%d%%)\n", sym_pcnt_filter);
-               fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
-               fprintf(stdout, "\t[S]     stop annotation.\n");
-       }
+       fprintf(stdout, "\t[F]     annotate display filter (percent). \t(%d%%)\n", sym_pcnt_filter);
+       fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
+       fprintf(stdout, "\t[S]     stop annotation.\n");
 
        if (nr_counters > 1)
                fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
 
        fprintf(stdout,
-               "\t[K]     hide kernel_symbols symbols.             \t(%s)\n",
+               "\t[K]     hide kernel_symbols symbols.     \t(%s)\n",
                hide_kernel_symbols ? "yes" : "no");
        fprintf(stdout,
                "\t[U]     hide user symbols.               \t(%s)\n",
@@ -725,14 +726,13 @@ static int key_mapped(int c)
                case 'Q':
                case 'K':
                case 'U':
+               case 'F':
+               case 's':
+               case 'S':
                        return 1;
                case 'E':
                case 'w':
                        return nr_counters > 1 ? 1 : 0;
-               case 'F':
-               case 's':
-               case 'S':
-                       return symbol_conf.vmlinux_name ? 1 : 0;
                default:
                        break;
        }
@@ -910,8 +910,12 @@ static int symbol_filter(struct map *map, struct symbol *sym)
        syme = symbol__priv(sym);
        syme->map = map;
        syme->src = NULL;
-       if (!sym_filter_entry && sym_filter && !strcmp(name, sym_filter))
-               sym_filter_entry = syme;
+
+       if (!sym_filter_entry && sym_filter && !strcmp(name, sym_filter)) {
+               /* schedule initial sym_filter_entry setup */
+               sym_filter_entry_sched = syme;
+               sym_filter = NULL;
+       }
 
        for (i = 0; skip_symbols[i]; i++) {
                if (!strcmp(skip_symbols[i], name)) {
@@ -934,8 +938,11 @@ static void event__process_sample(const event_t *self,
        struct addr_location al;
        u8 origin = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
+       ++samples;
+
        switch (origin) {
        case PERF_RECORD_MISC_USER:
+               ++userspace_samples;
                if (hide_user_symbols)
                        return;
                break;
@@ -948,9 +955,38 @@ static void event__process_sample(const event_t *self,
        }
 
        if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
-           al.sym == NULL || al.filtered)
+           al.filtered)
                return;
 
+       if (al.sym == NULL) {
+               /*
+                * As we do lazy loading of symtabs we only will know if the
+                * specified vmlinux file is invalid when we actually have a
+                * hit in kernel space and then try to load it. So if we get
+                * here and there are _no_ symbols in the DSO backing the
+                * kernel map, bail out.
+                *
+                * We may never get here, for instance, if we use -K/
+                * --hide-kernel-symbols, even if the user specifies an
+                * invalid --vmlinux ;-)
+                */
+               if (al.map == session->vmlinux_maps[MAP__FUNCTION] &&
+                   RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) {
+                       pr_err("The %s file can't be used\n",
+                              symbol_conf.vmlinux_name);
+                       exit(1);
+               }
+
+               return;
+       }
+
+       /* let's see, whether we need to install initial sym_filter_entry */
+       if (sym_filter_entry_sched) {
+               sym_filter_entry = sym_filter_entry_sched;
+               sym_filter_entry_sched = NULL;
+               parse_source(sym_filter_entry);
+       }
+
        syme = symbol__priv(al.sym);
        if (!syme->skip) {
                syme->count[counter]++;
@@ -960,9 +996,6 @@ static void event__process_sample(const event_t *self,
                if (list_empty(&syme->node) || !syme->node.next)
                        __list_insert_active_sym(syme);
                pthread_mutex_unlock(&active_symbols_lock);
-               if (origin == PERF_RECORD_MISC_USER)
-                       ++userspace_samples;
-               ++samples;
        }
 }
 
@@ -975,6 +1008,10 @@ static int event__process(event_t *event, struct perf_session *session)
        case PERF_RECORD_MMAP:
                event__process_mmap(event, session);
                break;
+       case PERF_RECORD_FORK:
+       case PERF_RECORD_EXIT:
+               event__process_task(event, session);
+               break;
        default:
                break;
        }
@@ -1244,7 +1281,7 @@ static const struct option options[] = {
        OPT_BOOLEAN('i', "inherit", &inherit,
                    "child tasks inherit counters"),
        OPT_STRING('s', "sym-annotate", &sym_filter, "symbol name",
-                   "symbol to annotate - requires -k option"),
+                   "symbol to annotate"),
        OPT_BOOLEAN('z', "zero", &zero,
                    "zero history across updates"),
        OPT_INTEGER('F', "freq", &freq,
@@ -1280,16 +1317,14 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 
        symbol_conf.priv_size = (sizeof(struct sym_entry) +
                                 (nr_counters + 1) * sizeof(unsigned long));
-       if (symbol_conf.vmlinux_name == NULL)
-               symbol_conf.try_vmlinux_path = true;
+
+       symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
        if (symbol__init() < 0)
                return -1;
 
        if (delay_secs < 1)
                delay_secs = 1;
 
-       parse_source(sym_filter_entry);
-
        /*
         * User specified count overrides default frequency.
         */
index 574a215e800b502abeb05fa9e874421db8e3f79a..5db687fc13dee2c007e51530cdeb5ac00c37e200 100644 (file)
@@ -44,6 +44,7 @@ static void setup_scripting(void)
        perf_set_argv_exec_path(perf_exec_path());
 
        setup_perl_scripting();
+       setup_python_scripting();
 
        scripting_ops = &default_scripting_ops;
 }
@@ -75,11 +76,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 
        event__parse_sample(event, session->sample_type, &data);
 
-       dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
-               event->header.misc,
-               data.pid, data.tid,
-               (void *)(long)data.ip,
-               (long long)data.period);
+       dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+                   data.pid, data.tid, data.ip, data.period);
 
        thread = perf_session__findnew(session, event->ip.pid);
        if (thread == NULL) {
@@ -103,22 +101,9 @@ static int process_sample_event(event_t *event, struct perf_session *session)
        return 0;
 }
 
-static int sample_type_check(struct perf_session *session)
-{
-       if (!(session->sample_type & PERF_SAMPLE_RAW)) {
-               fprintf(stderr,
-                       "No trace sample to read. Did you call perf record "
-                       "without -R?");
-               return -1;
-       }
-
-       return 0;
-}
-
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_comm_event     = event__process_comm,
-       .sample_type_check      = sample_type_check,
+       .sample = process_sample_event,
+       .comm   = event__process_comm,
 };
 
 static int __cmd_trace(struct perf_session *session)
@@ -235,9 +220,9 @@ static int parse_scriptname(const struct option *opt __used,
        const char *script, *ext;
        int len;
 
-       if (strcmp(str, "list") == 0) {
+       if (strcmp(str, "lang") == 0) {
                list_available_languages();
-               return 0;
+               exit(0);
        }
 
        script = strchr(str, ':');
@@ -531,6 +516,8 @@ static const struct option options[] = {
                     parse_scriptname),
        OPT_STRING('g', "gen-script", &generate_script_lang, "lang",
                   "generate perf-trace.xx script in specified language"),
+       OPT_STRING('i', "input", &input_name, "file",
+                   "input file name"),
 
        OPT_END()
 };
@@ -592,6 +579,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
        if (session == NULL)
                return -ENOMEM;
 
+       if (!perf_session__has_traces(session, "record -R"))
+               return -EINVAL;
+
        if (generate_script_lang) {
                struct stat perf_stat;
 
index 18035b1f16c79eca09add0eb9a34c5540823faf1..10fe49e7048a986888f56830a5562e206c967331 100644 (file)
@@ -16,6 +16,7 @@ extern int check_pager_config(const char *cmd);
 
 extern int cmd_annotate(int argc, const char **argv, const char *prefix);
 extern int cmd_bench(int argc, const char **argv, const char *prefix);
+extern int cmd_buildid_cache(int argc, const char **argv, const char *prefix);
 extern int cmd_buildid_list(int argc, const char **argv, const char *prefix);
 extern int cmd_diff(int argc, const char **argv, const char *prefix);
 extern int cmd_help(int argc, const char **argv, const char *prefix);
@@ -30,5 +31,6 @@ extern int cmd_trace(int argc, const char **argv, const char *prefix);
 extern int cmd_version(int argc, const char **argv, const char *prefix);
 extern int cmd_probe(int argc, const char **argv, const char *prefix);
 extern int cmd_kmem(int argc, const char **argv, const char *prefix);
+extern int cmd_lock(int argc, const char **argv, const char *prefix);
 
 #endif
index 71dc7c3fe7b266c1ba8bca6cb05dc34de3044b1f..9afcff2e3ae5ba5d54901fb6a32f449cf0b52dc3 100644 (file)
@@ -3,7 +3,9 @@
 # command name                 category [deprecated] [common]
 #
 perf-annotate                  mainporcelain common
+perf-archive                   mainporcelain common
 perf-bench                     mainporcelain common
+perf-buildid-cache             mainporcelain common
 perf-buildid-list              mainporcelain common
 perf-diff                      mainporcelain common
 perf-list                      mainporcelain common
index 8d0de5130db3a2d006e1e04497ba41fcf09e7247..bd0bb1b1279b8ec258cc40a231fc4a9d289abd96 100644 (file)
@@ -101,10 +101,10 @@ enum hw_event_ids {
         */
        PERF_COUNT_HW_CPU_CYCLES                = 0,
        PERF_COUNT_HW_INSTRUCTIONS              = 1,
-       PERF_COUNT_HW_CACHE_REFERENCES  = 2,
+       PERF_COUNT_HW_CACHE_REFERENCES          = 2,
        PERF_COUNT_HW_CACHE_MISSES              = 3,
        PERF_COUNT_HW_BRANCH_INSTRUCTIONS       = 4,
-       PERF_COUNT_HW_BRANCH_MISSES     = 5,
+       PERF_COUNT_HW_BRANCH_MISSES             = 5,
        PERF_COUNT_HW_BUS_CYCLES                = 6,
 };
 
@@ -131,8 +131,8 @@ software events, selected by 'event_id':
  */
 enum sw_event_ids {
        PERF_COUNT_SW_CPU_CLOCK         = 0,
-       PERF_COUNT_SW_TASK_CLOCK                = 1,
-       PERF_COUNT_SW_PAGE_FAULTS               = 2,
+       PERF_COUNT_SW_TASK_CLOCK        = 1,
+       PERF_COUNT_SW_PAGE_FAULTS       = 2,
        PERF_COUNT_SW_CONTEXT_SWITCHES  = 3,
        PERF_COUNT_SW_CPU_MIGRATIONS    = 4,
        PERF_COUNT_SW_PAGE_FAULTS_MIN   = 5,
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
new file mode 100644 (file)
index 0000000..45fbe2f
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+# perf archive
+# Arnaldo Carvalho de Melo <acme@redhat.com>
+
+PERF_DATA=perf.data
+if [ $# -ne 0 ] ; then
+       PERF_DATA=$1
+fi
+
+DEBUGDIR=~/.debug/
+BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
+
+perf buildid-list -i $PERF_DATA --with-hits > $BUILDIDS
+if [ ! -s $BUILDIDS ] ; then
+       echo "perf archive: no build-ids found"
+       rm -f $BUILDIDS
+       exit 1
+fi
+
+MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
+
+cut -d ' ' -f 1 $BUILDIDS | \
+while read build_id ; do
+       linkname=$DEBUGDIR.build-id/${build_id:0:2}/${build_id:2}
+       filename=$(readlink -f $linkname)
+       echo ${linkname#$DEBUGDIR} >> $MANIFEST
+       echo ${filename#$DEBUGDIR} >> $MANIFEST
+done
+
+tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
+rm -f $MANIFEST $BUILDIDS
+exit 0
index 873e55fab375d253d4b80d4fb1862053f21080a4..57cb107c1f13291a7c94272d473bfea5862f6281 100644 (file)
@@ -48,7 +48,8 @@ int check_pager_config(const char *cmd)
        return c.val;
 }
 
-static void commit_pager_choice(void) {
+static void commit_pager_choice(void)
+{
        switch (use_pager) {
        case 0:
                setenv("PERF_PAGER", "cat", 1);
@@ -70,7 +71,7 @@ static void set_debugfs_path(void)
                 "tracing/events");
 }
 
-static int handle_options(const char*** argv, int* argc, int* envchanged)
+static int handle_options(const char ***argv, int *argc, int *envchanged)
 {
        int handled = 0;
 
@@ -109,7 +110,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
                                *envchanged = 1;
                } else if (!strcmp(cmd, "--perf-dir")) {
                        if (*argc < 2) {
-                               fprintf(stderr, "No directory given for --perf-dir.\n" );
+                               fprintf(stderr, "No directory given for --perf-dir.\n");
                                usage(perf_usage_string);
                        }
                        setenv(PERF_DIR_ENVIRONMENT, (*argv)[1], 1);
@@ -124,7 +125,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
                                *envchanged = 1;
                } else if (!strcmp(cmd, "--work-tree")) {
                        if (*argc < 2) {
-                               fprintf(stderr, "No directory given for --work-tree.\n" );
+                               fprintf(stderr, "No directory given for --work-tree.\n");
                                usage(perf_usage_string);
                        }
                        setenv(PERF_WORK_TREE_ENVIRONMENT, (*argv)[1], 1);
@@ -168,7 +169,7 @@ static int handle_alias(int *argcp, const char ***argv)
 {
        int envchanged = 0, ret = 0, saved_errno = errno;
        int count, option_count;
-       const char** new_argv;
+       const char **new_argv;
        const char *alias_command;
        char *alias_string;
 
@@ -210,11 +211,11 @@ static int handle_alias(int *argcp, const char ***argv)
                if (!strcmp(alias_command, new_argv[0]))
                        die("recursive alias: %s", alias_command);
 
-               new_argv = realloc(new_argv, sizeof(char*) *
+               new_argv = realloc(new_argv, sizeof(char *) *
                                    (count + *argcp + 1));
                /* insert after command name */
-               memcpy(new_argv + count, *argv + 1, sizeof(char*) * *argcp);
-               new_argv[count+*argcp] = NULL;
+               memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp);
+               new_argv[count + *argcp] = NULL;
 
                *argv = new_argv;
                *argcp += count - 1;
@@ -285,6 +286,7 @@ static void handle_internal_command(int argc, const char **argv)
 {
        const char *cmd = argv[0];
        static struct cmd_struct commands[] = {
+               { "buildid-cache", cmd_buildid_cache, 0 },
                { "buildid-list", cmd_buildid_list, 0 },
                { "diff",       cmd_diff,       0 },
                { "help",       cmd_help,       0 },
@@ -301,6 +303,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "sched",      cmd_sched,      0 },
                { "probe",      cmd_probe,      0 },
                { "kmem",       cmd_kmem,       0 },
+               { "lock",       cmd_lock,       0 },
        };
        unsigned int i;
        static const char ext[] = STRIP_EXTENSION;
@@ -388,7 +391,7 @@ static int run_argv(int *argcp, const char ***argv)
 /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */
 static void get_debugfs_mntpt(void)
 {
-       const char *path = debugfs_find_mountpoint();
+       const char *path = debugfs_mount(NULL);
 
        if (path)
                strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt));
@@ -449,8 +452,8 @@ int main(int argc, const char **argv)
        setup_path();
 
        while (1) {
-               static int done_help = 0;
-               static int was_alias = 0;
+               static int done_help;
+               static int was_alias;
 
                was_alias = run_argv(&argc, &argv);
                if (errno != ENOENT)
index af78d9a52a7d080d31a1d652c04081d9e8a63f92..01a64ad693f2a7c4ac8600e8d37f9a90ffad1b00 100644 (file)
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
-#include "../../../util/trace-event-perl.h"
+#include "../../../perf.h"
+#include "../../../util/trace-event.h"
 
 #ifndef PERL_UNUSED_VAR
 #  define PERL_UNUSED_VAR(var) if (0) var = var
 #endif
 
-#line 41 "Context.c"
+#line 42 "Context.c"
 
 XS(XS_Perf__Trace__Context_common_pc); /* prototype to pass -Wmissing-prototypes */
 XS(XS_Perf__Trace__Context_common_pc)
index fb78006c165e5f56eda50fd25402ab14e0558ea6..549cf0467d309eda5be9c0faee7897a5608371b4 100644 (file)
@@ -22,7 +22,8 @@
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
-#include "../../../util/trace-event-perl.h"
+#include "../../../perf.h"
+#include "../../../util/trace-event.h"
 
 MODULE = Perf::Trace::Context          PACKAGE = Perf::Trace::Context
 PROTOTYPES: ENABLE
index 052f132ced24b313d0823161507e9f664c870601..f869c48dc9b0ae920a250832d8804f97303ea8df 100644 (file)
@@ -44,7 +44,7 @@ sub nsecs_secs {
 sub nsecs_nsecs {
     my ($nsecs) = @_;
 
-    return $nsecs - nsecs_secs($nsecs);
+    return $nsecs % $NSECS_PER_SEC;
 }
 
 sub nsecs_str {
index c7ec5de2f535934f6029931be2ab8608da8b484a..e6cb1474f8e88525c0d9f7cbe742dc91bea2cf2d 100644 (file)
@@ -1,7 +1,2 @@
 #!/bin/bash
-perf record -c 1 -f -a -M -R -e kmem:kmalloc -e irq:softirq_entry
-
-
-
-
-
+perf record -c 1 -f -a -M -R -e kmem:kmalloc -e irq:softirq_entry -e kmem:kfree
diff --git a/tools/perf/scripts/perl/bin/check-perf-trace-report b/tools/perf/scripts/perl/bin/check-perf-trace-report
deleted file mode 100644 (file)
index 7fc4a03..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-# description: useless but exhaustive test script
-perf trace -s ~/libexec/perf-core/scripts/perl/check-perf-trace.pl
-
-
-
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-record b/tools/perf/scripts/perl/bin/failed-syscalls-record
new file mode 100644 (file)
index 0000000..f8885d3
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -c 1 -f -a -M -R -e raw_syscalls:sys_exit
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-report b/tools/perf/scripts/perl/bin/failed-syscalls-report
new file mode 100644 (file)
index 0000000..8bfc660
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: system-wide failed syscalls
+# args: [comm]
+perf trace -s ~/libexec/perf-core/scripts/perl/failed-syscalls.pl $1
diff --git a/tools/perf/scripts/perl/failed-syscalls.pl b/tools/perf/scripts/perl/failed-syscalls.pl
new file mode 100644 (file)
index 0000000..c18e7e2
--- /dev/null
@@ -0,0 +1,38 @@
+# failed system call counts
+# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Displays system-wide failed system call totals
+# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+
+use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";
+use lib "./Perf-Trace-Util/lib";
+use Perf::Trace::Core;
+use Perf::Trace::Context;
+use Perf::Trace::Util;
+
+my %failed_syscalls;
+
+sub raw_syscalls::sys_exit
+{
+       my ($event_name, $context, $common_cpu, $common_secs, $common_nsecs,
+           $common_pid, $common_comm,
+           $id, $ret) = @_;
+
+       if ($ret < 0) {
+           $failed_syscalls{$common_comm}++;
+       }
+}
+
+sub trace_end
+{
+    printf("\nfailed syscalls by comm:\n\n");
+
+    printf("%-20s  %10s\n", "comm", "# errors");
+    printf("%-20s  %6s  %10s\n", "--------------------", "----------");
+
+    foreach my $comm (sort {$failed_syscalls{$b} <=> $failed_syscalls{$a}}
+                     keys %failed_syscalls) {
+           printf("%-20s  %10s\n", $comm, $failed_syscalls{$comm});
+    }
+}
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
new file mode 100644 (file)
index 0000000..957085d
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Context.c.  Python interfaces for perf trace.
+ *
+ * Copyright (C) 2010 Tom Zanussi <tzanussi@gmail.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
+ *
+ */
+
+#include <Python.h>
+#include "../../../perf.h"
+#include "../../../util/trace-event.h"
+
+PyMODINIT_FUNC initperf_trace_context(void);
+
+static PyObject *perf_trace_context_common_pc(PyObject *self, PyObject *args)
+{
+       static struct scripting_context *scripting_context;
+       PyObject *context;
+       int retval;
+
+       if (!PyArg_ParseTuple(args, "O", &context))
+               return NULL;
+
+       scripting_context = PyCObject_AsVoidPtr(context);
+       retval = common_pc(scripting_context);
+
+       return Py_BuildValue("i", retval);
+}
+
+static PyObject *perf_trace_context_common_flags(PyObject *self,
+                                                PyObject *args)
+{
+       static struct scripting_context *scripting_context;
+       PyObject *context;
+       int retval;
+
+       if (!PyArg_ParseTuple(args, "O", &context))
+               return NULL;
+
+       scripting_context = PyCObject_AsVoidPtr(context);
+       retval = common_flags(scripting_context);
+
+       return Py_BuildValue("i", retval);
+}
+
+static PyObject *perf_trace_context_common_lock_depth(PyObject *self,
+                                                     PyObject *args)
+{
+       static struct scripting_context *scripting_context;
+       PyObject *context;
+       int retval;
+
+       if (!PyArg_ParseTuple(args, "O", &context))
+               return NULL;
+
+       scripting_context = PyCObject_AsVoidPtr(context);
+       retval = common_lock_depth(scripting_context);
+
+       return Py_BuildValue("i", retval);
+}
+
+static PyMethodDef ContextMethods[] = {
+       { "common_pc", perf_trace_context_common_pc, METH_VARARGS,
+         "Get the common preempt count event field value."},
+       { "common_flags", perf_trace_context_common_flags, METH_VARARGS,
+         "Get the common flags event field value."},
+       { "common_lock_depth", perf_trace_context_common_lock_depth,
+         METH_VARARGS, "Get the common lock depth event field value."},
+       { NULL, NULL, 0, NULL}
+};
+
+PyMODINIT_FUNC initperf_trace_context(void)
+{
+       (void) Py_InitModule("perf_trace_context", ContextMethods);
+}
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
new file mode 100644 (file)
index 0000000..1dc464e
--- /dev/null
@@ -0,0 +1,91 @@
+# Core.py - Python extension for perf trace, core functions
+#
+# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
+#
+# This software may be distributed under the terms of the GNU General
+# Public License ("GPL") version 2 as published by the Free Software
+# Foundation.
+
+from collections import defaultdict
+
+def autodict():
+    return defaultdict(autodict)
+
+flag_fields = autodict()
+symbolic_fields = autodict()
+
+def define_flag_field(event_name, field_name, delim):
+    flag_fields[event_name][field_name]['delim'] = delim
+
+def define_flag_value(event_name, field_name, value, field_str):
+    flag_fields[event_name][field_name]['values'][value] = field_str
+
+def define_symbolic_field(event_name, field_name):
+    # nothing to do, really
+    pass
+
+def define_symbolic_value(event_name, field_name, value, field_str):
+    symbolic_fields[event_name][field_name]['values'][value] = field_str
+
+def flag_str(event_name, field_name, value):
+    string = ""
+
+    if flag_fields[event_name][field_name]:
+       print_delim = 0
+        keys = flag_fields[event_name][field_name]['values'].keys()
+        keys.sort()
+        for idx in keys:
+            if not value and not idx:
+                string += flag_fields[event_name][field_name]['values'][idx]
+                break
+            if idx and (value & idx) == idx:
+                if print_delim and flag_fields[event_name][field_name]['delim']:
+                    string += " " + flag_fields[event_name][field_name]['delim'] + " "
+                string += flag_fields[event_name][field_name]['values'][idx]
+                print_delim = 1
+                value &= ~idx
+
+    return string
+
+def symbol_str(event_name, field_name, value):
+    string = ""
+
+    if symbolic_fields[event_name][field_name]:
+        keys = symbolic_fields[event_name][field_name]['values'].keys()
+        keys.sort()
+        for idx in keys:
+            if not value and not idx:
+               string = symbolic_fields[event_name][field_name]['values'][idx]
+                break
+           if (value == idx):
+               string = symbolic_fields[event_name][field_name]['values'][idx]
+                break
+
+    return string
+
+trace_flags = { 0x00: "NONE", \
+                    0x01: "IRQS_OFF", \
+                    0x02: "IRQS_NOSUPPORT", \
+                    0x04: "NEED_RESCHED", \
+                    0x08: "HARDIRQ", \
+                    0x10: "SOFTIRQ" }
+
+def trace_flag_str(value):
+    string = ""
+    print_delim = 0
+
+    keys = trace_flags.keys()
+
+    for idx in keys:
+       if not value and not idx:
+           string += "NONE"
+           break
+
+       if idx and (value & idx) == idx:
+           if print_delim:
+               string += " | ";
+           string += trace_flags[idx]
+           print_delim = 1
+           value &= ~idx
+
+    return string
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
new file mode 100644 (file)
index 0000000..83e9143
--- /dev/null
@@ -0,0 +1,25 @@
+# Util.py - Python extension for perf trace, miscellaneous utility code
+#
+# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
+#
+# This software may be distributed under the terms of the GNU General
+# Public License ("GPL") version 2 as published by the Free Software
+# Foundation.
+
+NSECS_PER_SEC    = 1000000000
+
+def avg(total, n):
+    return total / n
+
+def nsecs(secs, nsecs):
+    return secs * NSECS_PER_SEC + nsecs
+
+def nsecs_secs(nsecs):
+    return nsecs / NSECS_PER_SEC
+
+def nsecs_nsecs(nsecs):
+    return nsecs % NSECS_PER_SEC
+
+def nsecs_str(nsecs):
+    str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
+    return str
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record
new file mode 100644 (file)
index 0000000..f8885d3
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -c 1 -f -a -M -R -e raw_syscalls:sys_exit
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
new file mode 100644 (file)
index 0000000..1e0c0a8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: system-wide failed syscalls, by pid
+# args: [comm]
+perf trace -s ~/libexec/perf-core/scripts/python/failed-syscalls-by-pid.py $1
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-record b/tools/perf/scripts/python/bin/syscall-counts-by-pid-record
new file mode 100644 (file)
index 0000000..45a8c50
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
new file mode 100644 (file)
index 0000000..f8044d1
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: system-wide syscall counts, by pid
+# args: [comm]
+perf trace -s ~/libexec/perf-core/scripts/python/syscall-counts-by-pid.py $1
diff --git a/tools/perf/scripts/python/bin/syscall-counts-record b/tools/perf/scripts/python/bin/syscall-counts-record
new file mode 100644 (file)
index 0000000..45a8c50
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter
diff --git a/tools/perf/scripts/python/bin/syscall-counts-report b/tools/perf/scripts/python/bin/syscall-counts-report
new file mode 100644 (file)
index 0000000..a366aa6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: system-wide syscall counts
+# args: [comm]
+perf trace -s ~/libexec/perf-core/scripts/python/syscall-counts.py $1
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
new file mode 100644 (file)
index 0000000..964d934
--- /dev/null
@@ -0,0 +1,83 @@
+# perf trace event handlers, generated by perf trace -g python
+# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# This script tests basic functionality such as flag and symbol
+# strings, common_xxx() calls back into perf, begin, end, unhandled
+# events, etc.  Basically, if this script runs successfully and
+# displays expected results, Python scripting support should be ok.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from Core import *
+from perf_trace_context import *
+
+unhandled = autodict()
+
+def trace_begin():
+       print "trace_begin"
+       pass
+
+def trace_end():
+        print_unhandled()
+
+def irq__softirq_entry(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       vec):
+               print_header(event_name, common_cpu, common_secs, common_nsecs,
+                       common_pid, common_comm)
+
+                print_uncommon(context)
+
+               print "vec=%s\n" % \
+               (symbol_str("irq__softirq_entry", "vec", vec)),
+
+def kmem__kmalloc(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       call_site, ptr, bytes_req, bytes_alloc,
+       gfp_flags):
+               print_header(event_name, common_cpu, common_secs, common_nsecs,
+                       common_pid, common_comm)
+
+                print_uncommon(context)
+
+               print "call_site=%u, ptr=%u, bytes_req=%u, " \
+               "bytes_alloc=%u, gfp_flags=%s\n" % \
+               (call_site, ptr, bytes_req, bytes_alloc,
+
+               flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
+
+def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
+               common_pid, common_comm):
+    try:
+        unhandled[event_name] += 1
+    except TypeError:
+        unhandled[event_name] = 1
+
+def print_header(event_name, cpu, secs, nsecs, pid, comm):
+       print "%-20s %5u %05u.%09u %8u %-20s " % \
+       (event_name, cpu, secs, nsecs, pid, comm),
+
+# print trace fields not included in handler args
+def print_uncommon(context):
+    print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
+        % (common_pc(context), trace_flag_str(common_flags(context)), \
+               common_lock_depth(context))
+
+def print_unhandled():
+    keys = unhandled.keys()
+    if not keys:
+        return
+
+    print "\nunhandled events:\n\n",
+
+    print "%-40s  %10s\n" % ("event", "count"),
+    print "%-40s  %10s\n" % ("----------------------------------------", \
+                                 "-----------"),
+
+    for event_name in keys:
+       print "%-40s  %10d\n" % (event_name, unhandled[event_name])
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py
new file mode 100644 (file)
index 0000000..0ca0227
--- /dev/null
@@ -0,0 +1,68 @@
+# failed system call counts, by pid
+# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Displays system-wide failed system call totals, broken down by pid.
+# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
+
+for_comm = None
+
+if len(sys.argv) > 2:
+       sys.exit(usage)
+
+if len(sys.argv) > 1:
+       for_comm = sys.argv[1]
+
+syscalls = autodict()
+
+def trace_begin():
+       pass
+
+def trace_end():
+       print_error_totals()
+
+def raw_syscalls__sys_exit(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, ret):
+       if for_comm is not None:
+               if common_comm != for_comm:
+                       return
+
+       if ret < 0:
+               try:
+                       syscalls[common_comm][common_pid][id][ret] += 1
+               except TypeError:
+                       syscalls[common_comm][common_pid][id][ret] = 1
+
+def print_error_totals():
+    if for_comm is not None:
+           print "\nsyscall errors for %s:\n\n" % (for_comm),
+    else:
+           print "\nsyscall errors:\n\n",
+
+    print "%-30s  %10s\n" % ("comm [pid]", "count"),
+    print "%-30s  %10s\n" % ("------------------------------", \
+                                 "----------"),
+
+    comm_keys = syscalls.keys()
+    for comm in comm_keys:
+           pid_keys = syscalls[comm].keys()
+           for pid in pid_keys:
+                   print "\n%s [%d]\n" % (comm, pid),
+                   id_keys = syscalls[comm][pid].keys()
+                   for id in id_keys:
+                           print "  syscall: %-16d\n" % (id),
+                           ret_keys = syscalls[comm][pid][id].keys()
+                           for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k),  reverse = True):
+                                   print "    err = %-20d  %10d\n" % (ret, val),
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py
new file mode 100644 (file)
index 0000000..af722d6
--- /dev/null
@@ -0,0 +1,64 @@
+# system call counts, by pid
+# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Displays system-wide system call totals, broken down by syscall.
+# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
+
+for_comm = None
+
+if len(sys.argv) > 2:
+       sys.exit(usage)
+
+if len(sys.argv) > 1:
+       for_comm = sys.argv[1]
+
+syscalls = autodict()
+
+def trace_begin():
+       pass
+
+def trace_end():
+       print_syscall_totals()
+
+def raw_syscalls__sys_enter(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, args):
+       if for_comm is not None:
+               if common_comm != for_comm:
+                       return
+       try:
+               syscalls[common_comm][common_pid][id] += 1
+       except TypeError:
+               syscalls[common_comm][common_pid][id] = 1
+
+def print_syscall_totals():
+    if for_comm is not None:
+           print "\nsyscall events for %s:\n\n" % (for_comm),
+    else:
+           print "\nsyscall events by comm/pid:\n\n",
+
+    print "%-40s  %10s\n" % ("comm [pid]/syscalls", "count"),
+    print "%-40s  %10s\n" % ("----------------------------------------", \
+                                 "----------"),
+
+    comm_keys = syscalls.keys()
+    for comm in comm_keys:
+           pid_keys = syscalls[comm].keys()
+           for pid in pid_keys:
+                   print "\n%s [%d]\n" % (comm, pid),
+                   id_keys = syscalls[comm][pid].keys()
+                   for id, val in sorted(syscalls[comm][pid].iteritems(), \
+                                 key = lambda(k, v): (v, k),  reverse = True):
+                           print "  %-38d  %10d\n" % (id, val),
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
new file mode 100644 (file)
index 0000000..f977e85
--- /dev/null
@@ -0,0 +1,58 @@
+# system call counts
+# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Displays system-wide system call totals, broken down by syscall.
+# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+       '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+usage = "perf trace -s syscall-counts.py [comm]\n";
+
+for_comm = None
+
+if len(sys.argv) > 2:
+       sys.exit(usage)
+
+if len(sys.argv) > 1:
+       for_comm = sys.argv[1]
+
+syscalls = autodict()
+
+def trace_begin():
+       pass
+
+def trace_end():
+       print_syscall_totals()
+
+def raw_syscalls__sys_enter(event_name, context, common_cpu,
+       common_secs, common_nsecs, common_pid, common_comm,
+       id, args):
+       if for_comm is not None:
+               if common_comm != for_comm:
+                       return
+       try:
+               syscalls[id] += 1
+       except TypeError:
+               syscalls[id] = 1
+
+def print_syscall_totals():
+    if for_comm is not None:
+           print "\nsyscall events for %s:\n\n" % (for_comm),
+    else:
+           print "\nsyscall events:\n\n",
+
+    print "%-40s  %10s\n" % ("event", "count"),
+    print "%-40s  %10s\n" % ("----------------------------------------", \
+                                 "-----------"),
+
+    for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
+                                 reverse = True):
+           print "%-40d  %10d\n" % (id, val),
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
new file mode 100644 (file)
index 0000000..04904b3
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * build-id.c
+ *
+ * build-id support
+ *
+ * Copyright (C) 2009, 2010 Red Hat Inc.
+ * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
+ */
+#include "build-id.h"
+#include "event.h"
+#include "symbol.h"
+#include <linux/kernel.h>
+
+static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
+{
+       struct addr_location al;
+       u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
+       struct thread *thread = perf_session__findnew(session, event->ip.pid);
+
+       if (thread == NULL) {
+               pr_err("problem processing %d event, skipping it.\n",
+                       event->header.type);
+               return -1;
+       }
+
+       thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
+                             event->ip.ip, &al);
+
+       if (al.map != NULL)
+               al.map->dso->hit = 1;
+
+       return 0;
+}
+
+struct perf_event_ops build_id__mark_dso_hit_ops = {
+       .sample = build_id__mark_dso_hit,
+       .mmap   = event__process_mmap,
+       .fork   = event__process_task,
+};
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
new file mode 100644 (file)
index 0000000..1d981d6
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef PERF_BUILD_ID_H_
+#define PERF_BUILD_ID_H_ 1
+
+#include "session.h"
+
+extern struct perf_event_ops build_id__mark_dso_hit_ops;
+
+#endif
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c
deleted file mode 100644 (file)
index b557b83..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-#include "symbol.h"
-#include "util.h"
-#include "debug.h"
-#include "thread.h"
-#include "session.h"
-
-static int process_event_stub(event_t *event __used,
-                             struct perf_session *session __used)
-{
-       dump_printf(": unhandled!\n");
-       return 0;
-}
-
-static void perf_event_ops__fill_defaults(struct perf_event_ops *handler)
-{
-       if (!handler->process_sample_event)
-               handler->process_sample_event = process_event_stub;
-       if (!handler->process_mmap_event)
-               handler->process_mmap_event = process_event_stub;
-       if (!handler->process_comm_event)
-               handler->process_comm_event = process_event_stub;
-       if (!handler->process_fork_event)
-               handler->process_fork_event = process_event_stub;
-       if (!handler->process_exit_event)
-               handler->process_exit_event = process_event_stub;
-       if (!handler->process_lost_event)
-               handler->process_lost_event = process_event_stub;
-       if (!handler->process_read_event)
-               handler->process_read_event = process_event_stub;
-       if (!handler->process_throttle_event)
-               handler->process_throttle_event = process_event_stub;
-       if (!handler->process_unthrottle_event)
-               handler->process_unthrottle_event = process_event_stub;
-}
-
-static const char *event__name[] = {
-       [0]                      = "TOTAL",
-       [PERF_RECORD_MMAP]       = "MMAP",
-       [PERF_RECORD_LOST]       = "LOST",
-       [PERF_RECORD_COMM]       = "COMM",
-       [PERF_RECORD_EXIT]       = "EXIT",
-       [PERF_RECORD_THROTTLE]   = "THROTTLE",
-       [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
-       [PERF_RECORD_FORK]       = "FORK",
-       [PERF_RECORD_READ]       = "READ",
-       [PERF_RECORD_SAMPLE]     = "SAMPLE",
-};
-
-unsigned long event__total[PERF_RECORD_MAX];
-
-void event__print_totals(void)
-{
-       int i;
-       for (i = 0; i < PERF_RECORD_MAX; ++i)
-               pr_info("%10s events: %10ld\n",
-                       event__name[i], event__total[i]);
-}
-
-static int process_event(event_t *event, struct perf_session *session,
-                        struct perf_event_ops *ops,
-                        unsigned long offset, unsigned long head)
-{
-       trace_event(event);
-
-       if (event->header.type < PERF_RECORD_MAX) {
-               dump_printf("%p [%p]: PERF_RECORD_%s",
-                           (void *)(offset + head),
-                           (void *)(long)(event->header.size),
-                           event__name[event->header.type]);
-               ++event__total[0];
-               ++event__total[event->header.type];
-       }
-
-       switch (event->header.type) {
-       case PERF_RECORD_SAMPLE:
-               return ops->process_sample_event(event, session);
-       case PERF_RECORD_MMAP:
-               return ops->process_mmap_event(event, session);
-       case PERF_RECORD_COMM:
-               return ops->process_comm_event(event, session);
-       case PERF_RECORD_FORK:
-               return ops->process_fork_event(event, session);
-       case PERF_RECORD_EXIT:
-               return ops->process_exit_event(event, session);
-       case PERF_RECORD_LOST:
-               return ops->process_lost_event(event, session);
-       case PERF_RECORD_READ:
-               return ops->process_read_event(event, session);
-       case PERF_RECORD_THROTTLE:
-               return ops->process_throttle_event(event, session);
-       case PERF_RECORD_UNTHROTTLE:
-               return ops->process_unthrottle_event(event, session);
-       default:
-               ops->total_unknown++;
-               return -1;
-       }
-}
-
-int perf_header__read_build_ids(int input, u64 offset, u64 size)
-{
-       struct build_id_event bev;
-       char filename[PATH_MAX];
-       u64 limit = offset + size;
-       int err = -1;
-
-       while (offset < limit) {
-               struct dso *dso;
-               ssize_t len;
-
-               if (read(input, &bev, sizeof(bev)) != sizeof(bev))
-                       goto out;
-
-               len = bev.header.size - sizeof(bev);
-               if (read(input, filename, len) != len)
-                       goto out;
-
-               dso = dsos__findnew(filename);
-               if (dso != NULL)
-                       dso__set_build_id(dso, &bev.build_id);
-
-               offset += bev.header.size;
-       }
-       err = 0;
-out:
-       return err;
-}
-
-static struct thread *perf_session__register_idle_thread(struct perf_session *self)
-{
-       struct thread *thread = perf_session__findnew(self, 0);
-
-       if (!thread || thread__set_comm(thread, "swapper")) {
-               pr_err("problem inserting idle task.\n");
-               thread = NULL;
-       }
-
-       return thread;
-}
-
-int perf_session__process_events(struct perf_session *self,
-                                struct perf_event_ops *ops)
-{
-       int err;
-       unsigned long head, shift;
-       unsigned long offset = 0;
-       size_t  page_size;
-       event_t *event;
-       uint32_t size;
-       char *buf;
-
-       if (perf_session__register_idle_thread(self) == NULL)
-               return -ENOMEM;
-
-       perf_event_ops__fill_defaults(ops);
-
-       page_size = getpagesize();
-
-       head = self->header.data_offset;
-       self->sample_type = perf_header__sample_type(&self->header);
-
-       err = -EINVAL;
-       if (ops->sample_type_check && ops->sample_type_check(self) < 0)
-               goto out_err;
-
-       if (!ops->full_paths) {
-               char bf[PATH_MAX];
-
-               if (getcwd(bf, sizeof(bf)) == NULL) {
-                       err = -errno;
-out_getcwd_err:
-                       pr_err("failed to get the current directory\n");
-                       goto out_err;
-               }
-               self->cwd = strdup(bf);
-               if (self->cwd == NULL) {
-                       err = -ENOMEM;
-                       goto out_getcwd_err;
-               }
-               self->cwdlen = strlen(self->cwd);
-       }
-
-       shift = page_size * (head / page_size);
-       offset += shift;
-       head -= shift;
-
-remap:
-       buf = mmap(NULL, page_size * self->mmap_window, PROT_READ,
-                  MAP_SHARED, self->fd, offset);
-       if (buf == MAP_FAILED) {
-               pr_err("failed to mmap file\n");
-               err = -errno;
-               goto out_err;
-       }
-
-more:
-       event = (event_t *)(buf + head);
-
-       size = event->header.size;
-       if (!size)
-               size = 8;
-
-       if (head + event->header.size >= page_size * self->mmap_window) {
-               int munmap_ret;
-
-               shift = page_size * (head / page_size);
-
-               munmap_ret = munmap(buf, page_size * self->mmap_window);
-               assert(munmap_ret == 0);
-
-               offset += shift;
-               head -= shift;
-               goto remap;
-       }
-
-       size = event->header.size;
-
-       dump_printf("\n%p [%p]: event: %d\n",
-                       (void *)(offset + head),
-                       (void *)(long)event->header.size,
-                       event->header.type);
-
-       if (!size || process_event(event, self, ops, offset, head) < 0) {
-
-               dump_printf("%p [%p]: skipping unknown header type: %d\n",
-                       (void *)(offset + head),
-                       (void *)(long)(event->header.size),
-                       event->header.type);
-
-               /*
-                * assume we lost track of the stream, check alignment, and
-                * increment a single u64 in the hope to catch on again 'soon'.
-                */
-
-               if (unlikely(head & 7))
-                       head &= ~7ULL;
-
-               size = 8;
-       }
-
-       head += size;
-
-       if (offset + head >= self->header.data_offset + self->header.data_size)
-               goto done;
-
-       if (offset + head < self->size)
-               goto more;
-
-done:
-       err = 0;
-out_err:
-       return err;
-}
index 28d520d5a1fbe823cd29f5fc11c2a7cc92735038..0905600c3851b51ec6b52f716e33f797c1da1032 100644 (file)
@@ -9,6 +9,7 @@
 #include "color.h"
 #include "event.h"
 #include "debug.h"
+#include "util.h"
 
 int verbose = 0;
 int dump_trace = 0;
index 06b73ee02c49ced2696d4ead2fcd31480d76193d..a88fefc0cc0ada1afdbf8fc133cca9f8d49fe5a3 100644 (file)
@@ -106,16 +106,14 @@ int debugfs_valid_entry(const char *path)
        return 0;
 }
 
-/* mount the debugfs somewhere */
+/* mount the debugfs somewhere if it's not mounted */
 
-int debugfs_mount(const char *mountpoint)
+char *debugfs_mount(const char *mountpoint)
 {
-       char mountcmd[128];
-
        /* see if it's already mounted */
        if (debugfs_find_mountpoint()) {
                debugfs_premounted = 1;
-               return 0;
+               return debugfs_mountpoint;
        }
 
        /* if not mounted and no argument */
@@ -127,13 +125,14 @@ int debugfs_mount(const char *mountpoint)
                        mountpoint = "/sys/kernel/debug";
        }
 
+       if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
+               return NULL;
+
        /* save the mountpoint */
        strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
+       debugfs_found = 1;
 
-       /* mount it */
-       snprintf(mountcmd, sizeof(mountcmd),
-                "/bin/mount -t debugfs debugfs %s", mountpoint);
-       return system(mountcmd);
+       return debugfs_mountpoint;
 }
 
 /* umount the debugfs */
index 3cd14f9ae784533de54c314d015ea73a48bff769..83a02879745f5392bd065db31c522a98cf2a7165 100644 (file)
@@ -15,7 +15,7 @@
 extern const char *debugfs_find_mountpoint(void);
 extern int debugfs_valid_mountpoint(const char *debugfs);
 extern int debugfs_valid_entry(const char *path);
-extern int debugfs_mount(const char *mountpoint);
+extern char *debugfs_mount(const char *mountpoint);
 extern int debugfs_umount(void);
 extern int debugfs_write(const char *entry, const char *value);
 extern int debugfs_read(const char *entry, char *buffer, size_t size);
index bb0fd6da2d56f3850885d1d51df089dccc15d1d6..705ec63548b4e66d6502eecf7b3a24a38ec81f8c 100644 (file)
@@ -8,8 +8,7 @@
 #include "thread.h"
 
 static pid_t event__synthesize_comm(pid_t pid, int full,
-                                   int (*process)(event_t *event,
-                                                  struct perf_session *session),
+                                   event__handler_t process,
                                    struct perf_session *session)
 {
        event_t ev;
@@ -91,8 +90,7 @@ out_failure:
 }
 
 static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
-                                        int (*process)(event_t *event,
-                                                       struct perf_session *session),
+                                        event__handler_t process,
                                         struct perf_session *session)
 {
        char filename[PATH_MAX];
@@ -112,7 +110,10 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
        while (1) {
                char bf[BUFSIZ], *pbf = bf;
                event_t ev = {
-                       .header = { .type = PERF_RECORD_MMAP },
+                       .header = {
+                               .type = PERF_RECORD_MMAP,
+                               .misc = 0, /* Just like the kernel, see kernel/perf_event.c __perf_event_mmap */
+                        },
                };
                int n;
                size_t size;
@@ -156,9 +157,38 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
        return 0;
 }
 
-int event__synthesize_thread(pid_t pid,
-                            int (*process)(event_t *event,
-                                           struct perf_session *session),
+int event__synthesize_modules(event__handler_t process,
+                             struct perf_session *session)
+{
+       struct rb_node *nd;
+
+       for (nd = rb_first(&session->kmaps.maps[MAP__FUNCTION]);
+            nd; nd = rb_next(nd)) {
+               event_t ev;
+               size_t size;
+               struct map *pos = rb_entry(nd, struct map, rb_node);
+
+               if (pos->dso->kernel)
+                       continue;
+
+               size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
+               memset(&ev, 0, sizeof(ev));
+               ev.mmap.header.misc = 1; /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */
+               ev.mmap.header.type = PERF_RECORD_MMAP;
+               ev.mmap.header.size = (sizeof(ev.mmap) -
+                                       (sizeof(ev.mmap.filename) - size));
+               ev.mmap.start = pos->start;
+               ev.mmap.len   = pos->end - pos->start;
+
+               memcpy(ev.mmap.filename, pos->dso->long_name,
+                      pos->dso->long_name_len + 1);
+               process(&ev, session);
+       }
+
+       return 0;
+}
+
+int event__synthesize_thread(pid_t pid, event__handler_t process,
                             struct perf_session *session)
 {
        pid_t tgid = event__synthesize_comm(pid, 1, process, session);
@@ -167,8 +197,7 @@ int event__synthesize_thread(pid_t pid,
        return event__synthesize_mmap_events(pid, tgid, process, session);
 }
 
-void event__synthesize_threads(int (*process)(event_t *event,
-                                             struct perf_session *session),
+void event__synthesize_threads(event__handler_t process,
                               struct perf_session *session)
 {
        DIR *proc;
@@ -189,6 +218,59 @@ void event__synthesize_threads(int (*process)(event_t *event,
        closedir(proc);
 }
 
+struct process_symbol_args {
+       const char *name;
+       u64        start;
+};
+
+static int find_symbol_cb(void *arg, const char *name, char type, u64 start)
+{
+       struct process_symbol_args *args = arg;
+
+       /*
+        * Must be a function or at least an alias, as in PARISC64, where "_text" is
+        * an 'A' to the same address as "_stext".
+        */
+       if (!(symbol_type__is_a(type, MAP__FUNCTION) ||
+             type == 'A') || strcmp(name, args->name))
+               return 0;
+
+       args->start = start;
+       return 1;
+}
+
+int event__synthesize_kernel_mmap(event__handler_t process,
+                                 struct perf_session *session,
+                                 const char *symbol_name)
+{
+       size_t size;
+       event_t ev = {
+               .header = {
+                       .type = PERF_RECORD_MMAP,
+                       .misc = 1, /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */
+               },
+       };
+       /*
+        * We should get this from /sys/kernel/sections/.text, but till that is
+        * available use this, and after it is use this as a fallback for older
+        * kernels.
+        */
+       struct process_symbol_args args = { .name = symbol_name, };
+
+       if (kallsyms__parse("/proc/kallsyms", &args, find_symbol_cb) <= 0)
+               return -ENOENT;
+
+       size = snprintf(ev.mmap.filename, sizeof(ev.mmap.filename),
+                       "[kernel.kallsyms.%s]", symbol_name) + 1;
+       size = ALIGN(size, sizeof(u64));
+       ev.mmap.header.size = (sizeof(ev.mmap) - (sizeof(ev.mmap.filename) - size));
+       ev.mmap.pgoff = args.start;
+       ev.mmap.start = session->vmlinux_maps[MAP__FUNCTION]->start;
+       ev.mmap.len   = session->vmlinux_maps[MAP__FUNCTION]->end - ev.mmap.start ;
+
+       return process(&ev, session);
+}
+
 static void thread__comm_adjust(struct thread *self)
 {
        char *comm = self->comm;
@@ -240,22 +322,88 @@ int event__process_lost(event_t *self, struct perf_session *session)
 
 int event__process_mmap(event_t *self, struct perf_session *session)
 {
-       struct thread *thread = perf_session__findnew(session, self->mmap.pid);
-       struct map *map = map__new(&self->mmap, MAP__FUNCTION,
-                                  session->cwd, session->cwdlen);
+       struct thread *thread;
+       struct map *map;
+
+       dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n",
+                   self->mmap.pid, self->mmap.tid, self->mmap.start,
+                   self->mmap.len, self->mmap.pgoff, self->mmap.filename);
+
+       if (self->mmap.pid == 0) {
+               static const char kmmap_prefix[] = "[kernel.kallsyms.";
+
+               if (self->mmap.filename[0] == '/') {
+                       char short_module_name[1024];
+                       char *name = strrchr(self->mmap.filename, '/'), *dot;
+
+                       if (name == NULL)
+                               goto out_problem;
+
+                       ++name; /* skip / */
+                       dot = strrchr(name, '.');
+                       if (dot == NULL)
+                               goto out_problem;
+
+                       snprintf(short_module_name, sizeof(short_module_name),
+                                "[%.*s]", (int)(dot - name), name);
+                       strxfrchar(short_module_name, '-', '_');
+
+                       map = perf_session__new_module_map(session,
+                                                          self->mmap.start,
+                                                          self->mmap.filename);
+                       if (map == NULL)
+                               goto out_problem;
+
+                       name = strdup(short_module_name);
+                       if (name == NULL)
+                               goto out_problem;
+
+                       map->dso->short_name = name;
+                       map->end = map->start + self->mmap.len;
+               } else if (memcmp(self->mmap.filename, kmmap_prefix,
+                               sizeof(kmmap_prefix) - 1) == 0) {
+                       const char *symbol_name = (self->mmap.filename +
+                                                  sizeof(kmmap_prefix) - 1);
+                       /*
+                        * Should be there already, from the build-id table in
+                        * the header.
+                        */
+                       struct dso *kernel = __dsos__findnew(&dsos__kernel,
+                                                            "[kernel.kallsyms]");
+                       if (kernel == NULL)
+                               goto out_problem;
+
+                       kernel->kernel = 1;
+                       if (__perf_session__create_kernel_maps(session, kernel) < 0)
+                               goto out_problem;
+
+                       session->vmlinux_maps[MAP__FUNCTION]->start = self->mmap.start;
+                       session->vmlinux_maps[MAP__FUNCTION]->end   = self->mmap.start + self->mmap.len;
+                       /*
+                        * Be a bit paranoid here, some perf.data file came with
+                        * a zero sized synthesized MMAP event for the kernel.
+                        */
+                       if (session->vmlinux_maps[MAP__FUNCTION]->end == 0)
+                               session->vmlinux_maps[MAP__FUNCTION]->end = ~0UL;
+
+                       perf_session__set_kallsyms_ref_reloc_sym(session, symbol_name,
+                                                                self->mmap.pgoff);
+               }
+               return 0;
+       }
 
-       dump_printf(" %d/%d: [%p(%p) @ %p]: %s\n",
-                   self->mmap.pid, self->mmap.tid,
-                   (void *)(long)self->mmap.start,
-                   (void *)(long)self->mmap.len,
-                   (void *)(long)self->mmap.pgoff,
-                   self->mmap.filename);
+       thread = perf_session__findnew(session, self->mmap.pid);
+       map = map__new(&self->mmap, MAP__FUNCTION,
+                      session->cwd, session->cwdlen);
 
        if (thread == NULL || map == NULL)
-               dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
-       else
-               thread__insert_map(thread, map);
+               goto out_problem;
 
+       thread__insert_map(thread, map);
+       return 0;
+
+out_problem:
+       dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
        return 0;
 }
 
@@ -284,26 +432,24 @@ int event__process_task(event_t *self, struct perf_session *session)
        return 0;
 }
 
-void thread__find_addr_location(struct thread *self,
-                               struct perf_session *session, u8 cpumode,
-                               enum map_type type, u64 addr,
-                               struct addr_location *al,
-                               symbol_filter_t filter)
+void thread__find_addr_map(struct thread *self,
+                          struct perf_session *session, u8 cpumode,
+                          enum map_type type, u64 addr,
+                          struct addr_location *al)
 {
        struct map_groups *mg = &self->mg;
 
        al->thread = self;
        al->addr = addr;
 
-       if (cpumode & PERF_RECORD_MISC_KERNEL) {
+       if (cpumode == PERF_RECORD_MISC_KERNEL) {
                al->level = 'k';
                mg = &session->kmaps;
-       } else if (cpumode & PERF_RECORD_MISC_USER)
+       } else if (cpumode == PERF_RECORD_MISC_USER)
                al->level = '.';
        else {
                al->level = 'H';
                al->map = NULL;
-               al->sym = NULL;
                return;
        }
 try_again:
@@ -322,11 +468,21 @@ try_again:
                        mg = &session->kmaps;
                        goto try_again;
                }
-               al->sym = NULL;
-       } else {
+       } else
                al->addr = al->map->map_ip(al->map, al->addr);
-               al->sym = map__find_symbol(al->map, session, al->addr, filter);
-       }
+}
+
+void thread__find_addr_location(struct thread *self,
+                               struct perf_session *session, u8 cpumode,
+                               enum map_type type, u64 addr,
+                               struct addr_location *al,
+                               symbol_filter_t filter)
+{
+       thread__find_addr_map(self, session, cpumode, type, addr, al);
+       if (al->map != NULL)
+               al->sym = map__find_symbol(al->map, al->addr, filter);
+       else
+               al->sym = NULL;
 }
 
 static void dso__calc_col_width(struct dso *self)
index 690a96d0467c2325f4162092a2c2698f61f427f7..50a7132887f57eab20c6e57b70fb1258cd8f259b 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef __PERF_RECORD_H
 #define __PERF_RECORD_H
 
+#include <limits.h>
+
 #include "../perf.h"
-#include "util.h"
-#include <linux/list.h>
-#include <linux/rbtree.h>
+#include "map.h"
 
 /*
  * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
@@ -101,74 +101,19 @@ struct events_stats {
 
 void event__print_totals(void);
 
-enum map_type {
-       MAP__FUNCTION = 0,
-       MAP__VARIABLE,
-};
-
-#define MAP__NR_TYPES (MAP__VARIABLE + 1)
-
-struct map {
-       union {
-               struct rb_node  rb_node;
-               struct list_head node;
-       };
-       u64                     start;
-       u64                     end;
-       enum map_type           type;
-       u64                     pgoff;
-       u64                     (*map_ip)(struct map *, u64);
-       u64                     (*unmap_ip)(struct map *, u64);
-       struct dso              *dso;
-};
-
-static inline u64 map__map_ip(struct map *map, u64 ip)
-{
-       return ip - map->start + map->pgoff;
-}
-
-static inline u64 map__unmap_ip(struct map *map, u64 ip)
-{
-       return ip + map->start - map->pgoff;
-}
-
-static inline u64 identity__map_ip(struct map *map __used, u64 ip)
-{
-       return ip;
-}
-
-struct symbol;
-
-typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
-
-void map__init(struct map *self, enum map_type type,
-              u64 start, u64 end, u64 pgoff, struct dso *dso);
-struct map *map__new(struct mmap_event *event, enum map_type,
-                    char *cwd, int cwdlen);
-void map__delete(struct map *self);
-struct map *map__clone(struct map *self);
-int map__overlap(struct map *l, struct map *r);
-size_t map__fprintf(struct map *self, FILE *fp);
-
 struct perf_session;
 
-int map__load(struct map *self, struct perf_session *session,
-             symbol_filter_t filter);
-struct symbol *map__find_symbol(struct map *self, struct perf_session *session,
-                               u64 addr, symbol_filter_t filter);
-struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
-                                       struct perf_session *session,
-                                       symbol_filter_t filter);
-void map__fixup_start(struct map *self);
-void map__fixup_end(struct map *self);
-
-int event__synthesize_thread(pid_t pid,
-                            int (*process)(event_t *event,
-                                           struct perf_session *session),
+typedef int (*event__handler_t)(event_t *event, struct perf_session *session);
+
+int event__synthesize_thread(pid_t pid, event__handler_t process,
                             struct perf_session *session);
-void event__synthesize_threads(int (*process)(event_t *event,
-                                             struct perf_session *session),
+void event__synthesize_threads(event__handler_t process,
                               struct perf_session *session);
+int event__synthesize_kernel_mmap(event__handler_t process,
+                                 struct perf_session *session,
+                                 const char *symbol_name);
+int event__synthesize_modules(event__handler_t process,
+                             struct perf_session *session);
 
 int event__process_comm(event_t *self, struct perf_session *session);
 int event__process_lost(event_t *self, struct perf_session *session);
index 8a0bca55106f8d4ddb15492404367ef5b3f3de88..6c9aa16ee51fce97747cb9c9ea493e717b45b953 100644 (file)
@@ -1,8 +1,12 @@
+#define _FILE_OFFSET_BITS 64
+
 #include <sys/types.h>
+#include <byteswap.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <linux/list.h>
+#include <linux/kernel.h>
 
 #include "util.h"
 #include "header.h"
@@ -105,24 +109,28 @@ struct perf_trace_event_type {
 static int event_count;
 static struct perf_trace_event_type *events;
 
-void perf_header__push_event(u64 id, const char *name)
+int perf_header__push_event(u64 id, const char *name)
 {
        if (strlen(name) > MAX_EVENT_NAME)
                pr_warning("Event %s will be truncated\n", name);
 
        if (!events) {
                events = malloc(sizeof(struct perf_trace_event_type));
-               if (!events)
-                       die("nomem");
+               if (events == NULL)
+                       return -ENOMEM;
        } else {
-               events = realloc(events, (event_count + 1) * sizeof(struct perf_trace_event_type));
-               if (!events)
-                       die("nomem");
+               struct perf_trace_event_type *nevents;
+
+               nevents = realloc(events, (event_count + 1) * sizeof(*events));
+               if (nevents == NULL)
+                       return -ENOMEM;
+               events = nevents;
        }
        memset(&events[event_count], 0, sizeof(struct perf_trace_event_type));
        events[event_count].event_id = id;
        strncpy(events[event_count].name, name, MAX_EVENT_NAME - 1);
        event_count++;
+       return 0;
 }
 
 char *perf_header__find_event(u64 id)
@@ -169,31 +177,48 @@ static int do_write(int fd, const void *buf, size_t size)
        return 0;
 }
 
-static int __dsos__write_buildid_table(struct list_head *head, int fd)
+#define NAME_ALIGN 64
+
+static int write_padded(int fd, const void *bf, size_t count,
+                       size_t count_aligned)
 {
-#define NAME_ALIGN     64
-       struct dso *pos;
        static const char zero_buf[NAME_ALIGN];
+       int err = do_write(fd, bf, count);
+
+       if (!err)
+               err = do_write(fd, zero_buf, count_aligned - count);
+
+       return err;
+}
 
-       list_for_each_entry(pos, head, node) {
+#define dsos__for_each_with_build_id(pos, head)        \
+       list_for_each_entry(pos, head, node)    \
+               if (!pos->has_build_id)         \
+                       continue;               \
+               else
+
+static int __dsos__write_buildid_table(struct list_head *head, u16 misc, int fd)
+{
+       struct dso *pos;
+
+       dsos__for_each_with_build_id(pos, head) {
                int err;
                struct build_id_event b;
                size_t len;
 
-               if (!pos->has_build_id)
+               if (!pos->hit)
                        continue;
                len = pos->long_name_len + 1;
                len = ALIGN(len, NAME_ALIGN);
                memset(&b, 0, sizeof(b));
                memcpy(&b.build_id, pos->build_id, sizeof(pos->build_id));
+               b.header.misc = misc;
                b.header.size = sizeof(b) + len;
                err = do_write(fd, &b, sizeof(b));
                if (err < 0)
                        return err;
-               err = do_write(fd, pos->long_name, pos->long_name_len + 1);
-               if (err < 0)
-                       return err;
-               err = do_write(fd, zero_buf, len - pos->long_name_len - 1);
+               err = write_padded(fd, pos->long_name,
+                                  pos->long_name_len + 1, len);
                if (err < 0)
                        return err;
        }
@@ -203,12 +228,143 @@ static int __dsos__write_buildid_table(struct list_head *head, int fd)
 
 static int dsos__write_buildid_table(int fd)
 {
-       int err = __dsos__write_buildid_table(&dsos__kernel, fd);
+       int err = __dsos__write_buildid_table(&dsos__kernel,
+                                             PERF_RECORD_MISC_KERNEL, fd);
        if (err == 0)
-               err = __dsos__write_buildid_table(&dsos__user, fd);
+               err = __dsos__write_buildid_table(&dsos__user,
+                                                 PERF_RECORD_MISC_USER, fd);
        return err;
 }
 
+int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
+                         const char *name, bool is_kallsyms)
+{
+       const size_t size = PATH_MAX;
+       char *filename = malloc(size),
+            *linkname = malloc(size), *targetname;
+       int len, err = -1;
+
+       if (filename == NULL || linkname == NULL)
+               goto out_free;
+
+       len = snprintf(filename, size, "%s%s%s",
+                      debugdir, is_kallsyms ? "/" : "", name);
+       if (mkdir_p(filename, 0755))
+               goto out_free;
+
+       snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id);
+
+       if (access(filename, F_OK)) {
+               if (is_kallsyms) {
+                        if (copyfile("/proc/kallsyms", filename))
+                               goto out_free;
+               } else if (link(name, filename) && copyfile(name, filename))
+                       goto out_free;
+       }
+
+       len = snprintf(linkname, size, "%s/.build-id/%.2s",
+                      debugdir, sbuild_id);
+
+       if (access(linkname, X_OK) && mkdir_p(linkname, 0755))
+               goto out_free;
+
+       snprintf(linkname + len, size - len, "/%s", sbuild_id + 2);
+       targetname = filename + strlen(debugdir) - 5;
+       memcpy(targetname, "../..", 5);
+
+       if (symlink(targetname, linkname) == 0)
+               err = 0;
+out_free:
+       free(filename);
+       free(linkname);
+       return err;
+}
+
+static int build_id_cache__add_b(const u8 *build_id, size_t build_id_size,
+                                const char *name, const char *debugdir,
+                                bool is_kallsyms)
+{
+       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+
+       build_id__sprintf(build_id, build_id_size, sbuild_id);
+
+       return build_id_cache__add_s(sbuild_id, debugdir, name, is_kallsyms);
+}
+
+int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir)
+{
+       const size_t size = PATH_MAX;
+       char *filename = malloc(size),
+            *linkname = malloc(size);
+       int err = -1;
+
+       if (filename == NULL || linkname == NULL)
+               goto out_free;
+
+       snprintf(linkname, size, "%s/.build-id/%.2s/%s",
+                debugdir, sbuild_id, sbuild_id + 2);
+
+       if (access(linkname, F_OK))
+               goto out_free;
+
+       if (readlink(linkname, filename, size) < 0)
+               goto out_free;
+
+       if (unlink(linkname))
+               goto out_free;
+
+       /*
+        * Since the link is relative, we must make it absolute:
+        */
+       snprintf(linkname, size, "%s/.build-id/%.2s/%s",
+                debugdir, sbuild_id, filename);
+
+       if (unlink(linkname))
+               goto out_free;
+
+       err = 0;
+out_free:
+       free(filename);
+       free(linkname);
+       return err;
+}
+
+static int dso__cache_build_id(struct dso *self, const char *debugdir)
+{
+       bool is_kallsyms = self->kernel && self->long_name[0] != '/';
+
+       return build_id_cache__add_b(self->build_id, sizeof(self->build_id),
+                                    self->long_name, debugdir, is_kallsyms);
+}
+
+static int __dsos__cache_build_ids(struct list_head *head, const char *debugdir)
+{
+       struct dso *pos;
+       int err = 0;
+
+       dsos__for_each_with_build_id(pos, head)
+               if (dso__cache_build_id(pos, debugdir))
+                       err = -1;
+
+       return err;
+}
+
+static int dsos__cache_build_ids(void)
+{
+       int err_kernel, err_user;
+       char debugdir[PATH_MAX];
+
+       snprintf(debugdir, sizeof(debugdir), "%s/%s", getenv("HOME"),
+                DEBUG_CACHE_DIR);
+
+       if (mkdir(debugdir, 0755) != 0 && errno != EEXIST)
+               return -1;
+
+       err_kernel = __dsos__cache_build_ids(&dsos__kernel, debugdir);
+       err_user   = __dsos__cache_build_ids(&dsos__user, debugdir);
+       return err_kernel || err_user ? -1 : 0;
+}
+
 static int perf_header__adds_write(struct perf_header *self, int fd)
 {
        int nr_sections;
@@ -217,7 +373,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
        u64 sec_start;
        int idx = 0, err;
 
-       if (dsos__read_build_ids())
+       if (dsos__read_build_ids(true))
                perf_header__set_feat(self, HEADER_BUILD_ID);
 
        nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
@@ -257,7 +413,9 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
                        pr_debug("failed to write buildid table\n");
                        goto out_free;
                }
-               buildid_sec->size = lseek(fd, 0, SEEK_CUR) - buildid_sec->offset;
+               buildid_sec->size = lseek(fd, 0, SEEK_CUR) -
+                                         buildid_sec->offset;
+               dsos__cache_build_ids();
        }
 
        lseek(fd, sec_start, SEEK_SET);
@@ -360,30 +518,43 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit)
        return 0;
 }
 
-static void do_read(int fd, void *buf, size_t size)
+static int do_read(int fd, void *buf, size_t size)
 {
        while (size) {
                int ret = read(fd, buf, size);
 
-               if (ret < 0)
-                       die("failed to read");
-               if (ret == 0)
-                       die("failed to read: missing data");
+               if (ret <= 0)
+                       return -1;
 
                size -= ret;
                buf += ret;
        }
+
+       return 0;
+}
+
+static int perf_header__getbuffer64(struct perf_header *self,
+                                   int fd, void *buf, size_t size)
+{
+       if (do_read(fd, buf, size))
+               return -1;
+
+       if (self->needs_swap)
+               mem_bswap_64(buf, size);
+
+       return 0;
 }
 
 int perf_header__process_sections(struct perf_header *self, int fd,
                                  int (*process)(struct perf_file_section *self,
+                                                struct perf_header *ph,
                                                 int feat, int fd))
 {
        struct perf_file_section *feat_sec;
        int nr_sections;
        int sec_size;
        int idx = 0;
-       int err = 0, feat = 1;
+       int err = -1, feat = 1;
 
        nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
        if (!nr_sections)
@@ -397,33 +568,45 @@ int perf_header__process_sections(struct perf_header *self, int fd,
 
        lseek(fd, self->data_offset + self->data_size, SEEK_SET);
 
-       do_read(fd, feat_sec, sec_size);
+       if (perf_header__getbuffer64(self, fd, feat_sec, sec_size))
+               goto out_free;
 
+       err = 0;
        while (idx < nr_sections && feat < HEADER_LAST_FEATURE) {
                if (perf_header__has_feat(self, feat)) {
                        struct perf_file_section *sec = &feat_sec[idx++];
 
-                       err = process(sec, feat, fd);
+                       err = process(sec, self, feat, fd);
                        if (err < 0)
                                break;
                }
                ++feat;
        }
-
+out_free:
        free(feat_sec);
        return err;
-};
+}
 
 int perf_file_header__read(struct perf_file_header *self,
                           struct perf_header *ph, int fd)
 {
        lseek(fd, 0, SEEK_SET);
-       do_read(fd, self, sizeof(*self));
 
-       if (self->magic     != PERF_MAGIC ||
-           self->attr_size != sizeof(struct perf_file_attr))
+       if (do_read(fd, self, sizeof(*self)) ||
+           memcmp(&self->magic, __perf_magic, sizeof(self->magic)))
                return -1;
 
+       if (self->attr_size != sizeof(struct perf_file_attr)) {
+               u64 attr_size = bswap_64(self->attr_size);
+
+               if (attr_size != sizeof(struct perf_file_attr))
+                       return -1;
+
+               mem_bswap_64(self, offsetof(struct perf_file_header,
+                                           adds_features));
+               ph->needs_swap = true;
+       }
+
        if (self->size != sizeof(*self)) {
                /* Support the previous format */
                if (self->size == offsetof(typeof(*self), adds_features))
@@ -433,19 +616,31 @@ int perf_file_header__read(struct perf_file_header *self,
        }
 
        memcpy(&ph->adds_features, &self->adds_features,
-              sizeof(self->adds_features));
+              sizeof(ph->adds_features));
+       /*
+        * FIXME: hack that assumes that if we need swap the perf.data file
+        * may be coming from an arch with a different word-size, ergo different
+        * DEFINE_BITMAP format, investigate more later, but for now its mostly
+        * safe to assume that we have a build-id section. Trace files probably
+        * have several other issues in this realm anyway...
+        */
+       if (ph->needs_swap) {
+               memset(&ph->adds_features, 0, sizeof(ph->adds_features));
+               perf_header__set_feat(ph, HEADER_BUILD_ID);
+       }
 
        ph->event_offset = self->event_types.offset;
-       ph->event_size   = self->event_types.size;
-       ph->data_offset  = self->data.offset;
+       ph->event_size   = self->event_types.size;
+       ph->data_offset  = self->data.offset;
        ph->data_size    = self->data.size;
        return 0;
 }
 
 static int perf_file_section__process(struct perf_file_section *self,
+                                     struct perf_header *ph,
                                      int feat, int fd)
 {
-       if (lseek(fd, self->offset, SEEK_SET) < 0) {
+       if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) {
                pr_debug("Failed to lseek to %Ld offset for feature %d, "
                         "continuing...\n", self->offset, feat);
                return 0;
@@ -457,7 +652,7 @@ static int perf_file_section__process(struct perf_file_section *self,
                break;
 
        case HEADER_BUILD_ID:
-               if (perf_header__read_build_ids(fd, self->offset, self->size))
+               if (perf_header__read_build_ids(ph, fd, self->offset, self->size))
                        pr_debug("Failed to read buildids, continuing...\n");
                break;
        default:
@@ -469,7 +664,7 @@ static int perf_file_section__process(struct perf_file_section *self,
 
 int perf_header__read(struct perf_header *self, int fd)
 {
-       struct perf_file_header f_header;
+       struct perf_file_header f_header;
        struct perf_file_attr   f_attr;
        u64                     f_id;
        int nr_attrs, nr_ids, i, j;
@@ -486,7 +681,9 @@ int perf_header__read(struct perf_header *self, int fd)
                struct perf_header_attr *attr;
                off_t tmp;
 
-               do_read(fd, &f_attr, sizeof(f_attr));
+               if (perf_header__getbuffer64(self, fd, &f_attr, sizeof(f_attr)))
+                       goto out_errno;
+
                tmp = lseek(fd, 0, SEEK_CUR);
 
                attr = perf_header_attr__new(&f_attr.attr);
@@ -497,7 +694,8 @@ int perf_header__read(struct perf_header *self, int fd)
                lseek(fd, f_attr.ids.offset, SEEK_SET);
 
                for (j = 0; j < nr_ids; j++) {
-                       do_read(fd, &f_id, sizeof(f_id));
+                       if (perf_header__getbuffer64(self, fd, &f_id, sizeof(f_id)))
+                               goto out_errno;
 
                        if (perf_header_attr__add_id(attr, f_id) < 0) {
                                perf_header_attr__delete(attr);
@@ -517,7 +715,9 @@ int perf_header__read(struct perf_header *self, int fd)
                events = malloc(f_header.event_types.size);
                if (events == NULL)
                        return -ENOMEM;
-               do_read(fd, events, f_header.event_types.size);
+               if (perf_header__getbuffer64(self, fd, events,
+                                            f_header.event_types.size))
+                       goto out_errno;
                event_count =  f_header.event_types.size / sizeof(struct perf_trace_event_type);
        }
 
@@ -527,6 +727,8 @@ int perf_header__read(struct perf_header *self, int fd)
 
        self->frozen = 1;
        return 0;
+out_errno:
+       return -errno;
 }
 
 u64 perf_header__sample_type(struct perf_header *header)
index d118d05d3abe772f1feeb0fb1d425d75de687df0..82a6af72d4ccd7d1bac9d80d7e0fd7b2d0751a32 100644 (file)
@@ -5,6 +5,7 @@
 #include <sys/types.h>
 #include <stdbool.h>
 #include "types.h"
+#include "event.h"
 
 #include <linux/bitmap.h>
 
@@ -52,6 +53,7 @@ struct perf_header {
        u64                     data_size;
        u64                     event_offset;
        u64                     event_size;
+       bool                    needs_swap;
        DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
 };
 
@@ -64,7 +66,7 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit);
 int perf_header__add_attr(struct perf_header *self,
                          struct perf_header_attr *attr);
 
-void perf_header__push_event(u64 id, const char *name);
+int perf_header__push_event(u64 id, const char *name);
 char *perf_header__find_event(u64 id);
 
 struct perf_header_attr *perf_header_attr__new(struct perf_event_attr *attr);
@@ -80,6 +82,11 @@ bool perf_header__has_feat(const struct perf_header *self, int feat);
 
 int perf_header__process_sections(struct perf_header *self, int fd,
                                  int (*process)(struct perf_file_section *self,
+                                                struct perf_header *ph,
                                                 int feat, int fd));
 
+int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
+                         const char *name, bool is_kallsyms);
+int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
+
 #endif /* __PERF_HEADER_H */
diff --git a/tools/perf/util/include/linux/hash.h b/tools/perf/util/include/linux/hash.h
new file mode 100644 (file)
index 0000000..201f573
--- /dev/null
@@ -0,0 +1,5 @@
+#include "../../../../include/linux/hash.h"
+
+#ifndef PERF_HASH_H
+#define PERF_HASH_H
+#endif
index 21c0274c02fa3a5010c99711dab9fe3cd5e15bff..f2611655ab5176b09117aef19eba27f1f940e2be 100644 (file)
@@ -101,5 +101,6 @@ simple_strtoul(const char *nptr, char **endptr, int base)
        eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
 #endif
index c4d55a0da2eae66ff2ba31fe0fcfa9293604e50f..e509cd59c67d985a2ecb9946b61e7ae7065efca4 100644 (file)
@@ -5,6 +5,11 @@
 #include <stdio.h>
 #include "debug.h"
 
+const char *map_type__name[MAP__NR_TYPES] = {
+       [MAP__FUNCTION] = "Functions",
+       [MAP__VARIABLE] = "Variables",
+};
+
 static inline int is_anon_memory(const char *filename)
 {
        return strcmp(filename, "//anon") == 0;
@@ -68,8 +73,13 @@ struct map *map__new(struct mmap_event *event, enum map_type type,
                map__init(self, type, event->start, event->start + event->len,
                          event->pgoff, dso);
 
-               if (self->dso == vdso || anon)
+               if (anon) {
+set_identity:
                        self->map_ip = self->unmap_ip = identity__map_ip;
+               } else if (strcmp(filename, "[vdso]") == 0) {
+                       dso__set_loaded(dso, self->type);
+                       goto set_identity;
+               }
        }
        return self;
 out_delete:
@@ -104,8 +114,7 @@ void map__fixup_end(struct map *self)
 
 #define DSO__DELETED "(deleted)"
 
-int map__load(struct map *self, struct perf_session *session,
-             symbol_filter_t filter)
+int map__load(struct map *self, symbol_filter_t filter)
 {
        const char *name = self->dso->long_name;
        int nr;
@@ -113,7 +122,7 @@ int map__load(struct map *self, struct perf_session *session,
        if (dso__loaded(self->dso, self->type))
                return 0;
 
-       nr = dso__load(self->dso, self, session, filter);
+       nr = dso__load(self->dso, self, filter);
        if (nr < 0) {
                if (self->dso->has_build_id) {
                        char sbuild_id[BUILD_ID_SIZE * 2 + 1];
@@ -144,24 +153,29 @@ int map__load(struct map *self, struct perf_session *session,
 
                return -1;
        }
+       /*
+        * Only applies to the kernel, as its symtabs aren't relative like the
+        * module ones.
+        */
+       if (self->dso->kernel)
+               map__reloc_vmlinux(self);
 
        return 0;
 }
 
-struct symbol *map__find_symbol(struct map *self, struct perf_session *session,
-                               u64 addr, symbol_filter_t filter)
+struct symbol *map__find_symbol(struct map *self, u64 addr,
+                               symbol_filter_t filter)
 {
-       if (map__load(self, session, filter) < 0)
+       if (map__load(self, filter) < 0)
                return NULL;
 
        return dso__find_symbol(self->dso, self->type, addr);
 }
 
 struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
-                                       struct perf_session *session,
                                        symbol_filter_t filter)
 {
-       if (map__load(self, session, filter) < 0)
+       if (map__load(self, filter) < 0)
                return NULL;
 
        if (!dso__sorted_by_name(self->dso, self->type))
@@ -201,3 +215,23 @@ size_t map__fprintf(struct map *self, FILE *fp)
        return fprintf(fp, " %Lx-%Lx %Lx %s\n",
                       self->start, self->end, self->pgoff, self->dso->name);
 }
+
+/*
+ * objdump wants/reports absolute IPs for ET_EXEC, and RIPs for ET_DYN.
+ * map->dso->adjust_symbols==1 for ET_EXEC-like cases.
+ */
+u64 map__rip_2objdump(struct map *map, u64 rip)
+{
+       u64 addr = map->dso->adjust_symbols ?
+                       map->unmap_ip(map, rip) :       /* RIP -> IP */
+                       rip;
+       return addr;
+}
+
+u64 map__objdump_2ip(struct map *map, u64 addr)
+{
+       u64 ip = map->dso->adjust_symbols ?
+                       addr :
+                       map->unmap_ip(map, addr);       /* RIP -> IP */
+       return ip;
+}
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
new file mode 100644 (file)
index 0000000..b756368
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __PERF_MAP_H
+#define __PERF_MAP_H
+
+#include <linux/compiler.h>
+#include <linux/list.h>
+#include <linux/rbtree.h>
+#include <linux/types.h>
+
+enum map_type {
+       MAP__FUNCTION = 0,
+       MAP__VARIABLE,
+};
+
+#define MAP__NR_TYPES (MAP__VARIABLE + 1)
+
+extern const char *map_type__name[MAP__NR_TYPES];
+
+struct dso;
+struct ref_reloc_sym;
+struct map_groups;
+
+struct map {
+       union {
+               struct rb_node  rb_node;
+               struct list_head node;
+       };
+       u64                     start;
+       u64                     end;
+       enum map_type           type;
+       u64                     pgoff;
+
+       /* ip -> dso rip */
+       u64                     (*map_ip)(struct map *, u64);
+       /* dso rip -> ip */
+       u64                     (*unmap_ip)(struct map *, u64);
+
+       struct dso              *dso;
+};
+
+struct kmap {
+       struct ref_reloc_sym    *ref_reloc_sym;
+       struct map_groups       *kmaps;
+};
+
+static inline struct kmap *map__kmap(struct map *self)
+{
+       return (struct kmap *)(self + 1);
+}
+
+static inline u64 map__map_ip(struct map *map, u64 ip)
+{
+       return ip - map->start + map->pgoff;
+}
+
+static inline u64 map__unmap_ip(struct map *map, u64 ip)
+{
+       return ip + map->start - map->pgoff;
+}
+
+static inline u64 identity__map_ip(struct map *map __used, u64 ip)
+{
+       return ip;
+}
+
+
+/* rip/ip <-> addr suitable for passing to `objdump --start-address=` */
+u64 map__rip_2objdump(struct map *map, u64 rip);
+u64 map__objdump_2ip(struct map *map, u64 addr);
+
+struct symbol;
+struct mmap_event;
+
+typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
+
+void map__init(struct map *self, enum map_type type,
+              u64 start, u64 end, u64 pgoff, struct dso *dso);
+struct map *map__new(struct mmap_event *event, enum map_type,
+                    char *cwd, int cwdlen);
+void map__delete(struct map *self);
+struct map *map__clone(struct map *self);
+int map__overlap(struct map *l, struct map *r);
+size_t map__fprintf(struct map *self, FILE *fp);
+
+int map__load(struct map *self, symbol_filter_t filter);
+struct symbol *map__find_symbol(struct map *self,
+                               u64 addr, symbol_filter_t filter);
+struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
+                                       symbol_filter_t filter);
+void map__fixup_start(struct map *self);
+void map__fixup_end(struct map *self);
+
+void map__reloc_vmlinux(struct map *self);
+
+#endif /* __PERF_MAP_H */
index e5bc0fb016b2c130b873ba5808f4ed3d33896400..05d0c5c2030cbd5d8bfac67c00fc341404419465 100644 (file)
@@ -450,7 +450,8 @@ parse_single_tracepoint_event(char *sys_name,
 /* sys + ':' + event + ':' + flags*/
 #define MAX_EVOPT_LEN  (MAX_EVENT_LENGTH * 2 + 2 + 128)
 static enum event_result
-parse_subsystem_tracepoint_event(char *sys_name, char *flags)
+parse_multiple_tracepoint_event(char *sys_name, const char *evt_exp,
+                               char *flags)
 {
        char evt_path[MAXPATHLEN];
        struct dirent *evt_ent;
@@ -474,6 +475,9 @@ parse_subsystem_tracepoint_event(char *sys_name, char *flags)
                    || !strcmp(evt_ent->d_name, "filter"))
                        continue;
 
+               if (!strglobmatch(evt_ent->d_name, evt_exp))
+                       continue;
+
                len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name,
                               evt_ent->d_name, flags ? ":" : "",
                               flags ?: "");
@@ -522,9 +526,10 @@ static enum event_result parse_tracepoint_event(const char **strp,
        if (evt_length >= MAX_EVENT_LENGTH)
                return EVT_FAILED;
 
-       if (!strcmp(evt_name, "*")) {
+       if (strpbrk(evt_name, "*?")) {
                *strp = evt_name + evt_length;
-               return parse_subsystem_tracepoint_event(sys_name, flags);
+               return parse_multiple_tracepoint_event(sys_name, evt_name,
+                                                      flags);
        } else
                return parse_single_tracepoint_event(sys_name, evt_name,
                                                     evt_length, flags,
@@ -753,11 +758,11 @@ modifier:
        return ret;
 }
 
-static void store_event_type(const char *orgname)
+static int store_event_type(const char *orgname)
 {
        char filename[PATH_MAX], *c;
        FILE *file;
-       int id;
+       int id, n;
 
        sprintf(filename, "%s/", debugfs_path);
        strncat(filename, orgname, strlen(orgname));
@@ -769,11 +774,14 @@ static void store_event_type(const char *orgname)
 
        file = fopen(filename, "r");
        if (!file)
-               return;
-       if (fscanf(file, "%i", &id) < 1)
-               die("cannot store event ID");
+               return 0;
+       n = fscanf(file, "%i", &id);
        fclose(file);
-       perf_header__push_event(id, orgname);
+       if (n < 1) {
+               pr_err("cannot store event ID\n");
+               return -EINVAL;
+       }
+       return perf_header__push_event(id, orgname);
 }
 
 int parse_events(const struct option *opt __used, const char *str, int unset __used)
@@ -782,7 +790,8 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
        enum event_result ret;
 
        if (strchr(str, ':'))
-               store_event_type(str);
+               if (store_event_type(str) < 0)
+                       return -1;
 
        for (;;) {
                if (nr_counters == MAX_COUNTERS)
@@ -835,11 +844,12 @@ int parse_filter(const struct option *opt __used, const char *str,
 }
 
 static const char * const event_type_descriptors[] = {
-       "",
        "Hardware event",
        "Software event",
        "Tracepoint event",
        "Hardware cache event",
+       "Raw hardware event descriptor",
+       "Hardware breakpoint",
 };
 
 /*
@@ -872,7 +882,7 @@ static void print_tracepoint_events(void)
                        snprintf(evt_path, MAXPATHLEN, "%s:%s",
                                 sys_dirent.d_name, evt_dirent.d_name);
                        printf("  %-42s [%s]\n", evt_path,
-                               event_type_descriptors[PERF_TYPE_TRACEPOINT+1]);
+                               event_type_descriptors[PERF_TYPE_TRACEPOINT]);
                }
                closedir(evt_dir);
        }
@@ -892,9 +902,7 @@ void print_events(void)
        printf("List of pre-defined events (to be used in -e):\n");
 
        for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
-               type = syms->type + 1;
-               if (type >= ARRAY_SIZE(event_type_descriptors))
-                       type = 0;
+               type = syms->type;
 
                if (type != prev_type)
                        printf("\n");
@@ -919,17 +927,19 @@ void print_events(void)
                        for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
                                printf("  %-42s [%s]\n",
                                        event_cache_name(type, op, i),
-                                       event_type_descriptors[4]);
+                                       event_type_descriptors[PERF_TYPE_HW_CACHE]);
                        }
                }
        }
 
        printf("\n");
-       printf("  %-42s [raw hardware event descriptor]\n",
-               "rNNN");
+       printf("  %-42s [%s]\n",
+               "rNNN", event_type_descriptors[PERF_TYPE_RAW]);
        printf("\n");
 
-       printf("  %-42s [hardware breakpoint]\n", "mem:<addr>[:access]");
+       printf("  %-42s [%s]\n",
+                       "mem:<addr>[:access]",
+                       event_type_descriptors[PERF_TYPE_BREAKPOINT]);
        printf("\n");
 
        print_tracepoint_events();
index 29465d440043587462c61cb7dc3483bc68203b07..8f05688496919d6e46dcf55b60856d8896ef9b24 100644 (file)
@@ -37,6 +37,8 @@
 #include "string.h"
 #include "strlist.h"
 #include "debug.h"
+#include "cache.h"
+#include "color.h"
 #include "parse-events.h"  /* For debugfs_path */
 #include "probe-event.h"
 
@@ -62,6 +64,42 @@ static int e_snprintf(char *str, size_t size, const char *format, ...)
        return ret;
 }
 
+void parse_line_range_desc(const char *arg, struct line_range *lr)
+{
+       const char *ptr;
+       char *tmp;
+       /*
+        * <Syntax>
+        * SRC:SLN[+NUM|-ELN]
+        * FUNC[:SLN[+NUM|-ELN]]
+        */
+       ptr = strchr(arg, ':');
+       if (ptr) {
+               lr->start = (unsigned int)strtoul(ptr + 1, &tmp, 0);
+               if (*tmp == '+')
+                       lr->end = lr->start + (unsigned int)strtoul(tmp + 1,
+                                                                   &tmp, 0);
+               else if (*tmp == '-')
+                       lr->end = (unsigned int)strtoul(tmp + 1, &tmp, 0);
+               else
+                       lr->end = 0;
+               pr_debug("Line range is %u to %u\n", lr->start, lr->end);
+               if (lr->end && lr->start > lr->end)
+                       semantic_error("Start line must be smaller"
+                                      " than end line.");
+               if (*tmp != '\0')
+                       semantic_error("Tailing with invalid character '%d'.",
+                                      *tmp);
+               tmp = strndup(arg, (ptr - arg));
+       } else
+               tmp = strdup(arg);
+
+       if (strchr(tmp, '.'))
+               lr->file = tmp;
+       else
+               lr->function = tmp;
+}
+
 /* Check the name is good for event/group */
 static bool check_event_name(const char *name)
 {
@@ -272,6 +310,7 @@ int synthesize_perf_probe_point(struct probe_point *pp)
        int ret;
 
        pp->probes[0] = buf = zalloc(MAX_CMDLEN);
+       pp->found = 1;
        if (!buf)
                die("Failed to allocate memory by zalloc.");
        if (pp->offset) {
@@ -294,6 +333,7 @@ int synthesize_perf_probe_point(struct probe_point *pp)
 error:
                free(pp->probes[0]);
                pp->probes[0] = NULL;
+               pp->found = 0;
        }
        return ret;
 }
@@ -368,7 +408,7 @@ static int open_kprobe_events(int flags, int mode)
        if (ret < 0) {
                if (errno == ENOENT)
                        die("kprobe_events file does not exist -"
-                           " please rebuild with CONFIG_KPROBE_TRACER.");
+                           " please rebuild with CONFIG_KPROBE_EVENT.");
                else
                        die("Could not open kprobe_events file: %s",
                            strerror(errno));
@@ -455,6 +495,9 @@ void show_perf_probe_events(void)
        struct strlist *rawlist;
        struct str_node *ent;
 
+       setup_pager();
+
+       memset(&pp, 0, sizeof(pp));
        fd = open_kprobe_events(O_RDONLY, 0);
        rawlist = get_trace_kprobe_event_rawlist(fd);
        close(fd);
@@ -675,3 +718,66 @@ void del_trace_kprobe_events(struct strlist *dellist)
        close(fd);
 }
 
+#define LINEBUF_SIZE 256
+
+static void show_one_line(FILE *fp, unsigned int l, bool skip, bool show_num)
+{
+       char buf[LINEBUF_SIZE];
+       const char *color = PERF_COLOR_BLUE;
+
+       if (fgets(buf, LINEBUF_SIZE, fp) == NULL)
+               goto error;
+       if (!skip) {
+               if (show_num)
+                       fprintf(stdout, "%7u  %s", l, buf);
+               else
+                       color_fprintf(stdout, color, "         %s", buf);
+       }
+
+       while (strlen(buf) == LINEBUF_SIZE - 1 &&
+              buf[LINEBUF_SIZE - 2] != '\n') {
+               if (fgets(buf, LINEBUF_SIZE, fp) == NULL)
+                       goto error;
+               if (!skip) {
+                       if (show_num)
+                               fprintf(stdout, "%s", buf);
+                       else
+                               color_fprintf(stdout, color, "%s", buf);
+               }
+       }
+       return;
+error:
+       if (feof(fp))
+               die("Source file is shorter than expected.");
+       else
+               die("File read error: %s", strerror(errno));
+}
+
+void show_line_range(struct line_range *lr)
+{
+       unsigned int l = 1;
+       struct line_node *ln;
+       FILE *fp;
+
+       setup_pager();
+
+       if (lr->function)
+               fprintf(stdout, "<%s:%d>\n", lr->function,
+                       lr->start - lr->offset);
+       else
+               fprintf(stdout, "<%s:%d>\n", lr->file, lr->start);
+
+       fp = fopen(lr->path, "r");
+       if (fp == NULL)
+               die("Failed to open %s: %s", lr->path, strerror(errno));
+       /* Skip to starting line number */
+       while (l < lr->start)
+               show_one_line(fp, l++, true, false);
+
+       list_for_each_entry(ln, &lr->line_list, list) {
+               while (ln->line > l)
+                       show_one_line(fp, (l++) - lr->offset, false, false);
+               show_one_line(fp, (l++) - lr->offset, false, true);
+       }
+       fclose(fp);
+}
index 7f1d499118c0d421920e97c5b4e1ebda06cfdd3e..711287d4baead5024a3b48f41ad47d267e0124fd 100644 (file)
@@ -5,6 +5,7 @@
 #include "probe-finder.h"
 #include "strlist.h"
 
+extern void parse_line_range_desc(const char *arg, struct line_range *lr);
 extern void parse_perf_probe_event(const char *str, struct probe_point *pp,
                                   bool *need_dwarf);
 extern int synthesize_perf_probe_point(struct probe_point *pp);
@@ -15,6 +16,7 @@ extern void add_trace_kprobe_events(struct probe_point *probes, int nr_probes,
                                    bool force_add);
 extern void del_trace_kprobe_events(struct strlist *dellist);
 extern void show_perf_probe_events(void);
+extern void show_line_range(struct line_range *lr);
 
 /* Maximum index number of event-name postfix */
 #define MAX_EVENT_INDEX        1024
index 4b852c0d16a5b24a37589b2dd8a2f52f40c28169..1b2124d12f6831fad08e9a0a0edddd148a4576c2 100644 (file)
@@ -140,6 +140,31 @@ static Dwarf_Unsigned cu_find_fileno(Dwarf_Die cu_die, const char *fname)
        return found;
 }
 
+static int cu_get_filename(Dwarf_Die cu_die, Dwarf_Unsigned fno, char **buf)
+{
+       Dwarf_Signed cnt, i;
+       char **srcs;
+       int ret = 0;
+
+       if (!buf || !fno)
+               return -EINVAL;
+
+       ret = dwarf_srcfiles(cu_die, &srcs, &cnt, &__dw_error);
+       if (ret == DW_DLV_OK) {
+               if ((Dwarf_Unsigned)cnt > fno - 1) {
+                       *buf = strdup(srcs[fno - 1]);
+                       ret = 0;
+                       pr_debug("found filename: %s\n", *buf);
+               } else
+                       ret = -ENOENT;
+               for (i = 0; i < cnt; i++)
+                       dwarf_dealloc(__dw_debug, srcs[i], DW_DLA_STRING);
+               dwarf_dealloc(__dw_debug, srcs, DW_DLA_LIST);
+       } else
+               ret = -EINVAL;
+       return ret;
+}
+
 /* Compare diename and tname */
 static int die_compare_name(Dwarf_Die dw_die, const char *tname)
 {
@@ -402,11 +427,11 @@ static void show_location(Dwarf_Loc *loc, struct probe_finder *pf)
        } else if (op == DW_OP_regx) {
                regn = loc->lr_number;
        } else
-               die("Dwarf_OP %d is not supported.\n", op);
+               die("Dwarf_OP %d is not supported.", op);
 
        regs = get_arch_regstr(regn);
        if (!regs)
-               die("%lld exceeds max register number.\n", regn);
+               die("%lld exceeds max register number.", regn);
 
        if (deref)
                ret = snprintf(pf->buf, pf->len,
@@ -438,7 +463,7 @@ static void show_variable(Dwarf_Die vr_die, struct probe_finder *pf)
        return ;
 error:
        die("Failed to find the location of %s at this address.\n"
-           " Perhaps, it has been optimized out.\n", pf->var);
+           " Perhaps, it has been optimized out.", pf->var);
 }
 
 static int variable_callback(struct die_link *dlink, void *data)
@@ -476,7 +501,7 @@ static void find_variable(Dwarf_Die sp_die, struct probe_finder *pf)
        /* Search child die for local variables and parameters. */
        ret = search_die_from_children(sp_die, variable_callback, pf);
        if (!ret)
-               die("Failed to find '%s' in this function.\n", pf->var);
+               die("Failed to find '%s' in this function.", pf->var);
 }
 
 /* Get a frame base on the address */
@@ -567,7 +592,7 @@ static int probeaddr_callback(struct die_link *dlink, void *data)
 }
 
 /* Find probe point from its line number */
-static void find_by_line(struct probe_finder *pf)
+static void find_probe_point_by_line(struct probe_finder *pf)
 {
        Dwarf_Signed cnt, i, clm;
        Dwarf_Line *lines;
@@ -602,7 +627,7 @@ static void find_by_line(struct probe_finder *pf)
                ret = search_die_from_children(pf->cu_die,
                                               probeaddr_callback, pf);
                if (ret == 0)
-                       die("Probe point is not found in subprograms.\n");
+                       die("Probe point is not found in subprograms.");
                /* Continuing, because target line might be inlined. */
        }
        dwarf_srclines_dealloc(__dw_debug, lines, cnt);
@@ -626,7 +651,7 @@ static int probefunc_callback(struct die_link *dlink, void *data)
                                pf->fno = die_get_decl_file(dlink->die);
                                pf->lno = die_get_decl_line(dlink->die)
                                         + pp->line;
-                               find_by_line(pf);
+                               find_probe_point_by_line(pf);
                                return 1;
                        }
                        if (die_inlined_subprogram(dlink->die)) {
@@ -661,7 +686,7 @@ static int probefunc_callback(struct die_link *dlink, void *data)
                                    !die_inlined_subprogram(lk->die))
                                        goto found;
                        }
-                       die("Failed to find real subprogram.\n");
+                       die("Failed to find real subprogram.");
 found:
                        /* Get offset from subprogram */
                        ret = die_within_subprogram(lk->die, pf->addr, &offs);
@@ -673,7 +698,7 @@ found:
        return 0;
 }
 
-static void find_by_func(struct probe_finder *pf)
+static void find_probe_point_by_func(struct probe_finder *pf)
 {
        search_die_from_children(pf->cu_die, probefunc_callback, pf);
 }
@@ -714,10 +739,10 @@ int find_probepoint(int fd, struct probe_point *pp)
                        if (ret == DW_DLV_NO_ENTRY)
                                pf.cu_base = 0;
                        if (pp->function)
-                               find_by_func(&pf);
+                               find_probe_point_by_func(&pf);
                        else {
                                pf.lno = pp->line;
-                               find_by_line(&pf);
+                               find_probe_point_by_line(&pf);
                        }
                }
                dwarf_dealloc(__dw_debug, pf.cu_die, DW_DLA_DIE);
@@ -728,3 +753,159 @@ int find_probepoint(int fd, struct probe_point *pp)
        return pp->found;
 }
 
+
+static void line_range_add_line(struct line_range *lr, unsigned int line)
+{
+       struct line_node *ln;
+       struct list_head *p;
+
+       /* Reverse search, because new line will be the last one */
+       list_for_each_entry_reverse(ln, &lr->line_list, list) {
+               if (ln->line < line) {
+                       p = &ln->list;
+                       goto found;
+               } else if (ln->line == line)    /* Already exist */
+                       return ;
+       }
+       /* List is empty, or the smallest entry */
+       p = &lr->line_list;
+found:
+       pr_debug("Debug: add a line %u\n", line);
+       ln = zalloc(sizeof(struct line_node));
+       DIE_IF(ln == NULL);
+       ln->line = line;
+       INIT_LIST_HEAD(&ln->list);
+       list_add(&ln->list, p);
+}
+
+/* Find line range from its line number */
+static void find_line_range_by_line(struct line_finder *lf)
+{
+       Dwarf_Signed cnt, i;
+       Dwarf_Line *lines;
+       Dwarf_Unsigned lineno = 0;
+       Dwarf_Unsigned fno;
+       Dwarf_Addr addr;
+       int ret;
+
+       ret = dwarf_srclines(lf->cu_die, &lines, &cnt, &__dw_error);
+       DIE_IF(ret != DW_DLV_OK);
+
+       for (i = 0; i < cnt; i++) {
+               ret = dwarf_line_srcfileno(lines[i], &fno, &__dw_error);
+               DIE_IF(ret != DW_DLV_OK);
+               if (fno != lf->fno)
+                       continue;
+
+               ret = dwarf_lineno(lines[i], &lineno, &__dw_error);
+               DIE_IF(ret != DW_DLV_OK);
+               if (lf->lno_s > lineno || lf->lno_e < lineno)
+                       continue;
+
+               /* Filter line in the function address range */
+               if (lf->addr_s && lf->addr_e) {
+                       ret = dwarf_lineaddr(lines[i], &addr, &__dw_error);
+                       DIE_IF(ret != DW_DLV_OK);
+                       if (lf->addr_s > addr || lf->addr_e <= addr)
+                               continue;
+               }
+               line_range_add_line(lf->lr, (unsigned int)lineno);
+       }
+       dwarf_srclines_dealloc(__dw_debug, lines, cnt);
+       if (!list_empty(&lf->lr->line_list))
+               lf->found = 1;
+}
+
+/* Search function from function name */
+static int linefunc_callback(struct die_link *dlink, void *data)
+{
+       struct line_finder *lf = (struct line_finder *)data;
+       struct line_range *lr = lf->lr;
+       Dwarf_Half tag;
+       int ret;
+
+       ret = dwarf_tag(dlink->die, &tag, &__dw_error);
+       DIE_IF(ret == DW_DLV_ERROR);
+       if (tag == DW_TAG_subprogram &&
+           die_compare_name(dlink->die, lr->function) == 0) {
+               /* Get the address range of this function */
+               ret = dwarf_highpc(dlink->die, &lf->addr_e, &__dw_error);
+               if (ret == DW_DLV_OK)
+                       ret = dwarf_lowpc(dlink->die, &lf->addr_s, &__dw_error);
+               DIE_IF(ret == DW_DLV_ERROR);
+               if (ret == DW_DLV_NO_ENTRY) {
+                       lf->addr_s = 0;
+                       lf->addr_e = 0;
+               }
+
+               lf->fno = die_get_decl_file(dlink->die);
+               lr->offset = die_get_decl_line(dlink->die);;
+               lf->lno_s = lr->offset + lr->start;
+               if (!lr->end)
+                       lf->lno_e = (Dwarf_Unsigned)-1;
+               else
+                       lf->lno_e = lr->offset + lr->end;
+               lr->start = lf->lno_s;
+               lr->end = lf->lno_e;
+               find_line_range_by_line(lf);
+               /* If we find a target function, this should be end. */
+               lf->found = 1;
+               return 1;
+       }
+       return 0;
+}
+
+static void find_line_range_by_func(struct line_finder *lf)
+{
+       search_die_from_children(lf->cu_die, linefunc_callback, lf);
+}
+
+int find_line_range(int fd, struct line_range *lr)
+{
+       Dwarf_Half addr_size = 0;
+       Dwarf_Unsigned next_cuh = 0;
+       int ret;
+       struct line_finder lf = {.lr = lr};
+
+       ret = dwarf_init(fd, DW_DLC_READ, 0, 0, &__dw_debug, &__dw_error);
+       if (ret != DW_DLV_OK)
+               return -ENOENT;
+
+       while (!lf.found) {
+               /* Search CU (Compilation Unit) */
+               ret = dwarf_next_cu_header(__dw_debug, NULL, NULL, NULL,
+                       &addr_size, &next_cuh, &__dw_error);
+               DIE_IF(ret == DW_DLV_ERROR);
+               if (ret == DW_DLV_NO_ENTRY)
+                       break;
+
+               /* Get the DIE(Debugging Information Entry) of this CU */
+               ret = dwarf_siblingof(__dw_debug, 0, &lf.cu_die, &__dw_error);
+               DIE_IF(ret != DW_DLV_OK);
+
+               /* Check if target file is included. */
+               if (lr->file)
+                       lf.fno = cu_find_fileno(lf.cu_die, lr->file);
+
+               if (!lr->file || lf.fno) {
+                       if (lr->function)
+                               find_line_range_by_func(&lf);
+                       else {
+                               lf.lno_s = lr->start;
+                               if (!lr->end)
+                                       lf.lno_e = (Dwarf_Unsigned)-1;
+                               else
+                                       lf.lno_e = lr->end;
+                               find_line_range_by_line(&lf);
+                       }
+                       /* Get the real file path */
+                       if (lf.found)
+                               cu_get_filename(lf.cu_die, lf.fno, &lr->path);
+               }
+               dwarf_dealloc(__dw_debug, lf.cu_die, DW_DLA_DIE);
+       }
+       ret = dwarf_finish(__dw_debug, &__dw_error);
+       DIE_IF(ret != DW_DLV_OK);
+       return lf.found;
+}
+
index a4086aaddb73da2458047d13209a897e7faec172..972b386116f1b080bb96c5f38b96739ba0307f49 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _PROBE_FINDER_H
 #define _PROBE_FINDER_H
 
+#include "util.h"
+
 #define MAX_PATH_LEN            256
 #define MAX_PROBE_BUFFER       1024
 #define MAX_PROBES              128
@@ -32,8 +34,26 @@ struct probe_point {
        char                    *probes[MAX_PROBES];    /* Output buffers (will be allocated)*/
 };
 
+/* Line number container */
+struct line_node {
+       struct list_head        list;
+       unsigned int            line;
+};
+
+/* Line range */
+struct line_range {
+       char                    *file;                  /* File name */
+       char                    *function;              /* Function name */
+       unsigned int            start;                  /* Start line number */
+       unsigned int            end;                    /* End line number */
+       unsigned int            offset;                 /* Start line offset */
+       char                    *path;                  /* Real path name */
+       struct list_head        line_list;              /* Visible lines */
+};
+
 #ifndef NO_LIBDWARF
 extern int find_probepoint(int fd, struct probe_point *pp);
+extern int find_line_range(int fd, struct line_range *lr);
 
 /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */
 #ifndef _MIPS_SZLONG
@@ -60,6 +80,19 @@ struct probe_finder {
        char                    *buf;                   /* Current output buffer */
        int                     len;                    /* Length of output buffer */
 };
+
+struct line_finder {
+       struct line_range       *lr;                    /* Target line range */
+
+       Dwarf_Unsigned          fno;                    /* File number */
+       Dwarf_Unsigned          lno_s;                  /* Start line number */
+       Dwarf_Unsigned          lno_e;                  /* End line number */
+       Dwarf_Addr              addr_s;                 /* Start address */
+       Dwarf_Addr              addr_e;                 /* End address */
+       Dwarf_Die               cu_die;                 /* Current CU */
+       int                     found;
+};
+
 #endif /* NO_LIBDWARF */
 
 #endif /*_PROBE_FINDER_H */
similarity index 85%
rename from tools/perf/util/trace-event-perl.c
rename to tools/perf/util/scripting-engines/trace-event-perl.c
index 6d6d76b8a21e5d1b2af22f2c3995c669d27b967b..5376378e0cfcaf25fef5e684b5e172785c7990cd 100644 (file)
 #include <ctype.h>
 #include <errno.h>
 
-#include "../perf.h"
-#include "util.h"
-#include "trace-event.h"
-#include "trace-event-perl.h"
+#include "../../perf.h"
+#include "../util.h"
+#include "../trace-event.h"
+
+#include <EXTERN.h>
+#include <perl.h>
+
+void boot_Perf__Trace__Context(pTHX_ CV *cv);
+void boot_DynaLoader(pTHX_ CV *cv);
+typedef PerlInterpreter * INTERP;
 
 void xs_init(pTHX);
 
@@ -49,7 +55,7 @@ INTERP my_perl;
 
 struct event *events[FTRACE_MAX_EVENT];
 
-static struct scripting_context *scripting_context;
+extern struct scripting_context *scripting_context;
 
 static char *cur_field_name;
 static int zero_flag_atom;
@@ -239,33 +245,6 @@ static inline struct event *find_cache_event(int type)
        return event;
 }
 
-int common_pc(struct scripting_context *context)
-{
-       int pc;
-
-       pc = parse_common_pc(context->event_data);
-
-       return pc;
-}
-
-int common_flags(struct scripting_context *context)
-{
-       int flags;
-
-       flags = parse_common_flags(context->event_data);
-
-       return flags;
-}
-
-int common_lock_depth(struct scripting_context *context)
-{
-       int lock_depth;
-
-       lock_depth = parse_common_lock_depth(context->event_data);
-
-       return lock_depth;
-}
-
 static void perl_process_event(int cpu, void *data,
                               int size __unused,
                               unsigned long long nsecs, char *comm)
@@ -587,75 +566,3 @@ struct scripting_ops perl_scripting_ops = {
        .process_event = perl_process_event,
        .generate_script = perl_generate_script,
 };
-
-static void print_unsupported_msg(void)
-{
-       fprintf(stderr, "Perl scripting not supported."
-               "  Install libperl and rebuild perf to enable it.\n"
-               "For example:\n  # apt-get install libperl-dev (ubuntu)"
-               "\n  # yum install perl-ExtUtils-Embed (Fedora)"
-               "\n  etc.\n");
-}
-
-static int perl_start_script_unsupported(const char *script __unused,
-                                        int argc __unused,
-                                        const char **argv __unused)
-{
-       print_unsupported_msg();
-
-       return -1;
-}
-
-static int perl_stop_script_unsupported(void)
-{
-       return 0;
-}
-
-static void perl_process_event_unsupported(int cpu __unused,
-                                          void *data __unused,
-                                          int size __unused,
-                                          unsigned long long nsecs __unused,
-                                          char *comm __unused)
-{
-}
-
-static int perl_generate_script_unsupported(const char *outfile __unused)
-{
-       print_unsupported_msg();
-
-       return -1;
-}
-
-struct scripting_ops perl_scripting_unsupported_ops = {
-       .name = "Perl",
-       .start_script = perl_start_script_unsupported,
-       .stop_script = perl_stop_script_unsupported,
-       .process_event = perl_process_event_unsupported,
-       .generate_script = perl_generate_script_unsupported,
-};
-
-static void register_perl_scripting(struct scripting_ops *scripting_ops)
-{
-       int err;
-       err = script_spec_register("Perl", scripting_ops);
-       if (err)
-               die("error registering Perl script extension");
-
-       err = script_spec_register("pl", scripting_ops);
-       if (err)
-               die("error registering pl script extension");
-
-       scripting_context = malloc(sizeof(struct scripting_context));
-}
-
-#ifdef NO_LIBPERL
-void setup_perl_scripting(void)
-{
-       register_perl_scripting(&perl_scripting_unsupported_ops);
-}
-#else
-void setup_perl_scripting(void)
-{
-       register_perl_scripting(&perl_scripting_ops);
-}
-#endif
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
new file mode 100644 (file)
index 0000000..33a414b
--- /dev/null
@@ -0,0 +1,573 @@
+/*
+ * trace-event-python.  Feed trace events to an embedded Python interpreter.
+ *
+ * Copyright (C) 2010 Tom Zanussi <tzanussi@gmail.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
+ *
+ */
+
+#include <Python.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "../../perf.h"
+#include "../util.h"
+#include "../trace-event.h"
+
+PyMODINIT_FUNC initperf_trace_context(void);
+
+#define FTRACE_MAX_EVENT                               \
+       ((1 << (sizeof(unsigned short) * 8)) - 1)
+
+struct event *events[FTRACE_MAX_EVENT];
+
+#define MAX_FIELDS     64
+#define N_COMMON_FIELDS        7
+
+extern struct scripting_context *scripting_context;
+
+static char *cur_field_name;
+static int zero_flag_atom;
+
+static PyObject *main_module, *main_dict;
+
+static void handler_call_die(const char *handler_name)
+{
+       PyErr_Print();
+       Py_FatalError("problem in Python trace event handler");
+}
+
+static void define_value(enum print_arg_type field_type,
+                        const char *ev_name,
+                        const char *field_name,
+                        const char *field_value,
+                        const char *field_str)
+{
+       const char *handler_name = "define_flag_value";
+       PyObject *handler, *t, *retval;
+       unsigned long long value;
+       unsigned n = 0;
+
+       if (field_type == PRINT_SYMBOL)
+               handler_name = "define_symbolic_value";
+
+       t = PyTuple_New(4);
+       if (!t)
+               Py_FatalError("couldn't create Python tuple");
+
+       value = eval_flag(field_value);
+
+       PyTuple_SetItem(t, n++, PyString_FromString(ev_name));
+       PyTuple_SetItem(t, n++, PyString_FromString(field_name));
+       PyTuple_SetItem(t, n++, PyInt_FromLong(value));
+       PyTuple_SetItem(t, n++, PyString_FromString(field_str));
+
+       handler = PyDict_GetItemString(main_dict, handler_name);
+       if (handler && PyCallable_Check(handler)) {
+               retval = PyObject_CallObject(handler, t);
+               if (retval == NULL)
+                       handler_call_die(handler_name);
+       }
+
+       Py_DECREF(t);
+}
+
+static void define_values(enum print_arg_type field_type,
+                         struct print_flag_sym *field,
+                         const char *ev_name,
+                         const char *field_name)
+{
+       define_value(field_type, ev_name, field_name, field->value,
+                    field->str);
+
+       if (field->next)
+               define_values(field_type, field->next, ev_name, field_name);
+}
+
+static void define_field(enum print_arg_type field_type,
+                        const char *ev_name,
+                        const char *field_name,
+                        const char *delim)
+{
+       const char *handler_name = "define_flag_field";
+       PyObject *handler, *t, *retval;
+       unsigned n = 0;
+
+       if (field_type == PRINT_SYMBOL)
+               handler_name = "define_symbolic_field";
+
+       if (field_type == PRINT_FLAGS)
+               t = PyTuple_New(3);
+       else
+               t = PyTuple_New(2);
+       if (!t)
+               Py_FatalError("couldn't create Python tuple");
+
+       PyTuple_SetItem(t, n++, PyString_FromString(ev_name));
+       PyTuple_SetItem(t, n++, PyString_FromString(field_name));
+       if (field_type == PRINT_FLAGS)
+               PyTuple_SetItem(t, n++, PyString_FromString(delim));
+
+       handler = PyDict_GetItemString(main_dict, handler_name);
+       if (handler && PyCallable_Check(handler)) {
+               retval = PyObject_CallObject(handler, t);
+               if (retval == NULL)
+                       handler_call_die(handler_name);
+       }
+
+       Py_DECREF(t);
+}
+
+static void define_event_symbols(struct event *event,
+                                const char *ev_name,
+                                struct print_arg *args)
+{
+       switch (args->type) {
+       case PRINT_NULL:
+               break;
+       case PRINT_ATOM:
+               define_value(PRINT_FLAGS, ev_name, cur_field_name, "0",
+                            args->atom.atom);
+               zero_flag_atom = 0;
+               break;
+       case PRINT_FIELD:
+               if (cur_field_name)
+                       free(cur_field_name);
+               cur_field_name = strdup(args->field.name);
+               break;
+       case PRINT_FLAGS:
+               define_event_symbols(event, ev_name, args->flags.field);
+               define_field(PRINT_FLAGS, ev_name, cur_field_name,
+                            args->flags.delim);
+               define_values(PRINT_FLAGS, args->flags.flags, ev_name,
+                             cur_field_name);
+               break;
+       case PRINT_SYMBOL:
+               define_event_symbols(event, ev_name, args->symbol.field);
+               define_field(PRINT_SYMBOL, ev_name, cur_field_name, NULL);
+               define_values(PRINT_SYMBOL, args->symbol.symbols, ev_name,
+                             cur_field_name);
+               break;
+       case PRINT_STRING:
+               break;
+       case PRINT_TYPE:
+               define_event_symbols(event, ev_name, args->typecast.item);
+               break;
+       case PRINT_OP:
+               if (strcmp(args->op.op, ":") == 0)
+                       zero_flag_atom = 1;
+               define_event_symbols(event, ev_name, args->op.left);
+               define_event_symbols(event, ev_name, args->op.right);
+               break;
+       default:
+               /* we should warn... */
+               return;
+       }
+
+       if (args->next)
+               define_event_symbols(event, ev_name, args->next);
+}
+
+static inline struct event *find_cache_event(int type)
+{
+       static char ev_name[256];
+       struct event *event;
+
+       if (events[type])
+               return events[type];
+
+       events[type] = event = trace_find_event(type);
+       if (!event)
+               return NULL;
+
+       sprintf(ev_name, "%s__%s", event->system, event->name);
+
+       define_event_symbols(event, ev_name, event->print_fmt.args);
+
+       return event;
+}
+
+static void python_process_event(int cpu, void *data,
+                                int size __unused,
+                                unsigned long long nsecs, char *comm)
+{
+       PyObject *handler, *retval, *context, *t;
+       static char handler_name[256];
+       struct format_field *field;
+       unsigned long long val;
+       unsigned long s, ns;
+       struct event *event;
+       unsigned n = 0;
+       int type;
+       int pid;
+
+       t = PyTuple_New(MAX_FIELDS);
+       if (!t)
+               Py_FatalError("couldn't create Python tuple");
+
+       type = trace_parse_common_type(data);
+
+       event = find_cache_event(type);
+       if (!event)
+               die("ug! no event found for type %d", type);
+
+       pid = trace_parse_common_pid(data);
+
+       sprintf(handler_name, "%s__%s", event->system, event->name);
+
+       s = nsecs / NSECS_PER_SEC;
+       ns = nsecs - s * NSECS_PER_SEC;
+
+       scripting_context->event_data = data;
+
+       context = PyCObject_FromVoidPtr(scripting_context, NULL);
+
+       PyTuple_SetItem(t, n++, PyString_FromString(handler_name));
+       PyTuple_SetItem(t, n++,
+                       PyCObject_FromVoidPtr(scripting_context, NULL));
+       PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
+       PyTuple_SetItem(t, n++, PyInt_FromLong(s));
+       PyTuple_SetItem(t, n++, PyInt_FromLong(ns));
+       PyTuple_SetItem(t, n++, PyInt_FromLong(pid));
+       PyTuple_SetItem(t, n++, PyString_FromString(comm));
+
+       for (field = event->format.fields; field; field = field->next) {
+               if (field->flags & FIELD_IS_STRING) {
+                       int offset;
+                       if (field->flags & FIELD_IS_DYNAMIC) {
+                               offset = *(int *)(data + field->offset);
+                               offset &= 0xffff;
+                       } else
+                               offset = field->offset;
+                       PyTuple_SetItem(t, n++,
+                               PyString_FromString((char *)data + offset));
+               } else { /* FIELD_IS_NUMERIC */
+                       val = read_size(data + field->offset, field->size);
+                       if (field->flags & FIELD_IS_SIGNED) {
+                               PyTuple_SetItem(t, n++, PyInt_FromLong(val));
+                       } else {
+                               PyTuple_SetItem(t, n++, PyInt_FromLong(val));
+                       }
+               }
+       }
+
+       if (_PyTuple_Resize(&t, n) == -1)
+               Py_FatalError("error resizing Python tuple");
+
+       handler = PyDict_GetItemString(main_dict, handler_name);
+       if (handler && PyCallable_Check(handler)) {
+               retval = PyObject_CallObject(handler, t);
+               if (retval == NULL)
+                       handler_call_die(handler_name);
+       } else {
+               handler = PyDict_GetItemString(main_dict, "trace_unhandled");
+               if (handler && PyCallable_Check(handler)) {
+                       if (_PyTuple_Resize(&t, N_COMMON_FIELDS) == -1)
+                               Py_FatalError("error resizing Python tuple");
+
+                       retval = PyObject_CallObject(handler, t);
+                       if (retval == NULL)
+                               handler_call_die("trace_unhandled");
+               }
+       }
+
+       Py_DECREF(t);
+}
+
+static int run_start_sub(void)
+{
+       PyObject *handler, *retval;
+       int err = 0;
+
+       main_module = PyImport_AddModule("__main__");
+       if (main_module == NULL)
+               return -1;
+       Py_INCREF(main_module);
+
+       main_dict = PyModule_GetDict(main_module);
+       if (main_dict == NULL) {
+               err = -1;
+               goto error;
+       }
+       Py_INCREF(main_dict);
+
+       handler = PyDict_GetItemString(main_dict, "trace_begin");
+       if (handler == NULL || !PyCallable_Check(handler))
+               goto out;
+
+       retval = PyObject_CallObject(handler, NULL);
+       if (retval == NULL)
+               handler_call_die("trace_begin");
+
+       Py_DECREF(retval);
+       return err;
+error:
+       Py_XDECREF(main_dict);
+       Py_XDECREF(main_module);
+out:
+       return err;
+}
+
+/*
+ * Start trace script
+ */
+static int python_start_script(const char *script, int argc, const char **argv)
+{
+       const char **command_line;
+       char buf[PATH_MAX];
+       int i, err = 0;
+       FILE *fp;
+
+       command_line = malloc((argc + 1) * sizeof(const char *));
+       command_line[0] = script;
+       for (i = 1; i < argc + 1; i++)
+               command_line[i] = argv[i - 1];
+
+       Py_Initialize();
+
+       initperf_trace_context();
+
+       PySys_SetArgv(argc + 1, (char **)command_line);
+
+       fp = fopen(script, "r");
+       if (!fp) {
+               sprintf(buf, "Can't open python script \"%s\"", script);
+               perror(buf);
+               err = -1;
+               goto error;
+       }
+
+       err = PyRun_SimpleFile(fp, script);
+       if (err) {
+               fprintf(stderr, "Error running python script %s\n", script);
+               goto error;
+       }
+
+       err = run_start_sub();
+       if (err) {
+               fprintf(stderr, "Error starting python script %s\n", script);
+               goto error;
+       }
+
+       free(command_line);
+       fprintf(stderr, "perf trace started with Python script %s\n\n",
+               script);
+
+       return err;
+error:
+       Py_Finalize();
+       free(command_line);
+
+       return err;
+}
+
+/*
+ * Stop trace script
+ */
+static int python_stop_script(void)
+{
+       PyObject *handler, *retval;
+       int err = 0;
+
+       handler = PyDict_GetItemString(main_dict, "trace_end");
+       if (handler == NULL || !PyCallable_Check(handler))
+               goto out;
+
+       retval = PyObject_CallObject(handler, NULL);
+       if (retval == NULL)
+               handler_call_die("trace_end");
+       else
+               Py_DECREF(retval);
+out:
+       Py_XDECREF(main_dict);
+       Py_XDECREF(main_module);
+       Py_Finalize();
+
+       fprintf(stderr, "\nperf trace Python script stopped\n");
+
+       return err;
+}
+
+static int python_generate_script(const char *outfile)
+{
+       struct event *event = NULL;
+       struct format_field *f;
+       char fname[PATH_MAX];
+       int not_first, count;
+       FILE *ofp;
+
+       sprintf(fname, "%s.py", outfile);
+       ofp = fopen(fname, "w");
+       if (ofp == NULL) {
+               fprintf(stderr, "couldn't open %s\n", fname);
+               return -1;
+       }
+       fprintf(ofp, "# perf trace event handlers, "
+               "generated by perf trace -g python\n");
+
+       fprintf(ofp, "# Licensed under the terms of the GNU GPL"
+               " License version 2\n\n");
+
+       fprintf(ofp, "# The common_* event handler fields are the most useful "
+               "fields common to\n");
+
+       fprintf(ofp, "# all events.  They don't necessarily correspond to "
+               "the 'common_*' fields\n");
+
+       fprintf(ofp, "# in the format files.  Those fields not available as "
+               "handler params can\n");
+
+       fprintf(ofp, "# be retrieved using Python functions of the form "
+               "common_*(context).\n");
+
+       fprintf(ofp, "# See the perf-trace-python Documentation for the list "
+               "of available functions.\n\n");
+
+       fprintf(ofp, "import os\n");
+       fprintf(ofp, "import sys\n\n");
+
+       fprintf(ofp, "sys.path.append(os.environ['PERF_EXEC_PATH'] + \\\n");
+       fprintf(ofp, "\t'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')\n");
+       fprintf(ofp, "\nfrom perf_trace_context import *\n");
+       fprintf(ofp, "from Core import *\n\n\n");
+
+       fprintf(ofp, "def trace_begin():\n");
+       fprintf(ofp, "\tprint \"in trace_begin\"\n\n");
+
+       fprintf(ofp, "def trace_end():\n");
+       fprintf(ofp, "\tprint \"in trace_end\"\n\n");
+
+       while ((event = trace_find_next_event(event))) {
+               fprintf(ofp, "def %s__%s(", event->system, event->name);
+               fprintf(ofp, "event_name, ");
+               fprintf(ofp, "context, ");
+               fprintf(ofp, "common_cpu,\n");
+               fprintf(ofp, "\tcommon_secs, ");
+               fprintf(ofp, "common_nsecs, ");
+               fprintf(ofp, "common_pid, ");
+               fprintf(ofp, "common_comm,\n\t");
+
+               not_first = 0;
+               count = 0;
+
+               for (f = event->format.fields; f; f = f->next) {
+                       if (not_first++)
+                               fprintf(ofp, ", ");
+                       if (++count % 5 == 0)
+                               fprintf(ofp, "\n\t");
+
+                       fprintf(ofp, "%s", f->name);
+               }
+               fprintf(ofp, "):\n");
+
+               fprintf(ofp, "\t\tprint_header(event_name, common_cpu, "
+                       "common_secs, common_nsecs,\n\t\t\t"
+                       "common_pid, common_comm)\n\n");
+
+               fprintf(ofp, "\t\tprint \"");
+
+               not_first = 0;
+               count = 0;
+
+               for (f = event->format.fields; f; f = f->next) {
+                       if (not_first++)
+                               fprintf(ofp, ", ");
+                       if (count && count % 3 == 0) {
+                               fprintf(ofp, "\" \\\n\t\t\"");
+                       }
+                       count++;
+
+                       fprintf(ofp, "%s=", f->name);
+                       if (f->flags & FIELD_IS_STRING ||
+                           f->flags & FIELD_IS_FLAG ||
+                           f->flags & FIELD_IS_SYMBOLIC)
+                               fprintf(ofp, "%%s");
+                       else if (f->flags & FIELD_IS_SIGNED)
+                               fprintf(ofp, "%%d");
+                       else
+                               fprintf(ofp, "%%u");
+               }
+
+               fprintf(ofp, "\\n\" %% \\\n\t\t(");
+
+               not_first = 0;
+               count = 0;
+
+               for (f = event->format.fields; f; f = f->next) {
+                       if (not_first++)
+                               fprintf(ofp, ", ");
+
+                       if (++count % 5 == 0)
+                               fprintf(ofp, "\n\t\t");
+
+                       if (f->flags & FIELD_IS_FLAG) {
+                               if ((count - 1) % 5 != 0) {
+                                       fprintf(ofp, "\n\t\t");
+                                       count = 4;
+                               }
+                               fprintf(ofp, "flag_str(\"");
+                               fprintf(ofp, "%s__%s\", ", event->system,
+                                       event->name);
+                               fprintf(ofp, "\"%s\", %s)", f->name,
+                                       f->name);
+                       } else if (f->flags & FIELD_IS_SYMBOLIC) {
+                               if ((count - 1) % 5 != 0) {
+                                       fprintf(ofp, "\n\t\t");
+                                       count = 4;
+                               }
+                               fprintf(ofp, "symbol_str(\"");
+                               fprintf(ofp, "%s__%s\", ", event->system,
+                                       event->name);
+                               fprintf(ofp, "\"%s\", %s)", f->name,
+                                       f->name);
+                       } else
+                               fprintf(ofp, "%s", f->name);
+               }
+
+               fprintf(ofp, "),\n\n");
+       }
+
+       fprintf(ofp, "def trace_unhandled(event_name, context, "
+               "common_cpu, common_secs, common_nsecs,\n\t\t"
+               "common_pid, common_comm):\n");
+
+       fprintf(ofp, "\t\tprint_header(event_name, common_cpu, "
+               "common_secs, common_nsecs,\n\t\tcommon_pid, "
+               "common_comm)\n\n");
+
+       fprintf(ofp, "def print_header("
+               "event_name, cpu, secs, nsecs, pid, comm):\n"
+               "\tprint \"%%-20s %%5u %%05u.%%09u %%8u %%-20s \" %% \\\n\t"
+               "(event_name, cpu, secs, nsecs, pid, comm),\n");
+
+       fclose(ofp);
+
+       fprintf(stderr, "generated Python script: %s\n", fname);
+
+       return 0;
+}
+
+struct scripting_ops python_scripting_ops = {
+       .name = "Python",
+       .start_script = python_start_script,
+       .stop_script = python_stop_script,
+       .process_event = python_process_event,
+       .generate_script = python_generate_script,
+};
index ce3a6c8abe76c93fd5791aa295ef338f83db69ae..0de7258e70a5bfc2373bc73787b0da5e65ed4d76 100644 (file)
@@ -1,5 +1,8 @@
+#define _FILE_OFFSET_BITS 64
+
 #include <linux/kernel.h>
 
+#include <byteswap.h>
 #include <unistd.h>
 #include <sys/types.h>
 
@@ -49,6 +52,11 @@ out_close:
        return -1;
 }
 
+static inline int perf_session__create_kernel_maps(struct perf_session *self)
+{
+       return map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps);
+}
+
 struct perf_session *perf_session__new(const char *filename, int mode, bool force)
 {
        size_t len = filename ? strlen(filename) + 1 : 0;
@@ -66,13 +74,22 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
        self->mmap_window = 32;
        self->cwd = NULL;
        self->cwdlen = 0;
+       self->unknown_events = 0;
        map_groups__init(&self->kmaps);
 
-       if (perf_session__create_kernel_maps(self) < 0)
-               goto out_delete;
+       if (mode == O_RDONLY) {
+               if (perf_session__open(self, force) < 0)
+                       goto out_delete;
+       } else if (mode == O_WRONLY) {
+               /*
+                * In O_RDONLY mode this will be performed when reading the
+                * kernel MMAP event, in event__process_mmap().
+                */
+               if (perf_session__create_kernel_maps(self) < 0)
+                       goto out_delete;
+       }
 
-       if (mode == O_RDONLY && perf_session__open(self, force) < 0)
-               goto out_delete;
+       self->sample_type = perf_header__sample_type(&self->header);
 out:
        return self;
 out_free:
@@ -148,3 +165,409 @@ struct symbol **perf_session__resolve_callchain(struct perf_session *self,
 
        return syms;
 }
+
+static int process_event_stub(event_t *event __used,
+                             struct perf_session *session __used)
+{
+       dump_printf(": unhandled!\n");
+       return 0;
+}
+
+static void perf_event_ops__fill_defaults(struct perf_event_ops *handler)
+{
+       if (handler->sample == NULL)
+               handler->sample = process_event_stub;
+       if (handler->mmap == NULL)
+               handler->mmap = process_event_stub;
+       if (handler->comm == NULL)
+               handler->comm = process_event_stub;
+       if (handler->fork == NULL)
+               handler->fork = process_event_stub;
+       if (handler->exit == NULL)
+               handler->exit = process_event_stub;
+       if (handler->lost == NULL)
+               handler->lost = process_event_stub;
+       if (handler->read == NULL)
+               handler->read = process_event_stub;
+       if (handler->throttle == NULL)
+               handler->throttle = process_event_stub;
+       if (handler->unthrottle == NULL)
+               handler->unthrottle = process_event_stub;
+}
+
+static const char *event__name[] = {
+       [0]                      = "TOTAL",
+       [PERF_RECORD_MMAP]       = "MMAP",
+       [PERF_RECORD_LOST]       = "LOST",
+       [PERF_RECORD_COMM]       = "COMM",
+       [PERF_RECORD_EXIT]       = "EXIT",
+       [PERF_RECORD_THROTTLE]   = "THROTTLE",
+       [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
+       [PERF_RECORD_FORK]       = "FORK",
+       [PERF_RECORD_READ]       = "READ",
+       [PERF_RECORD_SAMPLE]     = "SAMPLE",
+};
+
+unsigned long event__total[PERF_RECORD_MAX];
+
+void event__print_totals(void)
+{
+       int i;
+       for (i = 0; i < PERF_RECORD_MAX; ++i)
+               pr_info("%10s events: %10ld\n",
+                       event__name[i], event__total[i]);
+}
+
+void mem_bswap_64(void *src, int byte_size)
+{
+       u64 *m = src;
+
+       while (byte_size > 0) {
+               *m = bswap_64(*m);
+               byte_size -= sizeof(u64);
+               ++m;
+       }
+}
+
+static void event__all64_swap(event_t *self)
+{
+       struct perf_event_header *hdr = &self->header;
+       mem_bswap_64(hdr + 1, self->header.size - sizeof(*hdr));
+}
+
+static void event__comm_swap(event_t *self)
+{
+       self->comm.pid = bswap_32(self->comm.pid);
+       self->comm.tid = bswap_32(self->comm.tid);
+}
+
+static void event__mmap_swap(event_t *self)
+{
+       self->mmap.pid   = bswap_32(self->mmap.pid);
+       self->mmap.tid   = bswap_32(self->mmap.tid);
+       self->mmap.start = bswap_64(self->mmap.start);
+       self->mmap.len   = bswap_64(self->mmap.len);
+       self->mmap.pgoff = bswap_64(self->mmap.pgoff);
+}
+
+static void event__task_swap(event_t *self)
+{
+       self->fork.pid  = bswap_32(self->fork.pid);
+       self->fork.tid  = bswap_32(self->fork.tid);
+       self->fork.ppid = bswap_32(self->fork.ppid);
+       self->fork.ptid = bswap_32(self->fork.ptid);
+       self->fork.time = bswap_64(self->fork.time);
+}
+
+static void event__read_swap(event_t *self)
+{
+       self->read.pid          = bswap_32(self->read.pid);
+       self->read.tid          = bswap_32(self->read.tid);
+       self->read.value        = bswap_64(self->read.value);
+       self->read.time_enabled = bswap_64(self->read.time_enabled);
+       self->read.time_running = bswap_64(self->read.time_running);
+       self->read.id           = bswap_64(self->read.id);
+}
+
+typedef void (*event__swap_op)(event_t *self);
+
+static event__swap_op event__swap_ops[] = {
+       [PERF_RECORD_MMAP]   = event__mmap_swap,
+       [PERF_RECORD_COMM]   = event__comm_swap,
+       [PERF_RECORD_FORK]   = event__task_swap,
+       [PERF_RECORD_EXIT]   = event__task_swap,
+       [PERF_RECORD_LOST]   = event__all64_swap,
+       [PERF_RECORD_READ]   = event__read_swap,
+       [PERF_RECORD_SAMPLE] = event__all64_swap,
+       [PERF_RECORD_MAX]    = NULL,
+};
+
+static int perf_session__process_event(struct perf_session *self,
+                                      event_t *event,
+                                      struct perf_event_ops *ops,
+                                      u64 offset, u64 head)
+{
+       trace_event(event);
+
+       if (event->header.type < PERF_RECORD_MAX) {
+               dump_printf("%#Lx [%#x]: PERF_RECORD_%s",
+                           offset + head, event->header.size,
+                           event__name[event->header.type]);
+               ++event__total[0];
+               ++event__total[event->header.type];
+       }
+
+       if (self->header.needs_swap && event__swap_ops[event->header.type])
+               event__swap_ops[event->header.type](event);
+
+       switch (event->header.type) {
+       case PERF_RECORD_SAMPLE:
+               return ops->sample(event, self);
+       case PERF_RECORD_MMAP:
+               return ops->mmap(event, self);
+       case PERF_RECORD_COMM:
+               return ops->comm(event, self);
+       case PERF_RECORD_FORK:
+               return ops->fork(event, self);
+       case PERF_RECORD_EXIT:
+               return ops->exit(event, self);
+       case PERF_RECORD_LOST:
+               return ops->lost(event, self);
+       case PERF_RECORD_READ:
+               return ops->read(event, self);
+       case PERF_RECORD_THROTTLE:
+               return ops->throttle(event, self);
+       case PERF_RECORD_UNTHROTTLE:
+               return ops->unthrottle(event, self);
+       default:
+               self->unknown_events++;
+               return -1;
+       }
+}
+
+void perf_event_header__bswap(struct perf_event_header *self)
+{
+       self->type = bswap_32(self->type);
+       self->misc = bswap_16(self->misc);
+       self->size = bswap_16(self->size);
+}
+
+int perf_header__read_build_ids(struct perf_header *self,
+                               int input, u64 offset, u64 size)
+{
+       struct build_id_event bev;
+       char filename[PATH_MAX];
+       u64 limit = offset + size;
+       int err = -1;
+
+       while (offset < limit) {
+               struct dso *dso;
+               ssize_t len;
+               struct list_head *head = &dsos__user;
+
+               if (read(input, &bev, sizeof(bev)) != sizeof(bev))
+                       goto out;
+
+               if (self->needs_swap)
+                       perf_event_header__bswap(&bev.header);
+
+               len = bev.header.size - sizeof(bev);
+               if (read(input, filename, len) != len)
+                       goto out;
+
+               if (bev.header.misc & PERF_RECORD_MISC_KERNEL)
+                       head = &dsos__kernel;
+
+               dso = __dsos__findnew(head, filename);
+               if (dso != NULL) {
+                       dso__set_build_id(dso, &bev.build_id);
+                       if (head == &dsos__kernel && filename[0] == '[')
+                               dso->kernel = 1;
+               }
+
+               offset += bev.header.size;
+       }
+       err = 0;
+out:
+       return err;
+}
+
+static struct thread *perf_session__register_idle_thread(struct perf_session *self)
+{
+       struct thread *thread = perf_session__findnew(self, 0);
+
+       if (thread == NULL || thread__set_comm(thread, "swapper")) {
+               pr_err("problem inserting idle task.\n");
+               thread = NULL;
+       }
+
+       return thread;
+}
+
+int __perf_session__process_events(struct perf_session *self,
+                                  u64 data_offset, u64 data_size,
+                                  u64 file_size, struct perf_event_ops *ops)
+{
+       int err, mmap_prot, mmap_flags;
+       u64 head, shift;
+       u64 offset = 0;
+       size_t  page_size;
+       event_t *event;
+       uint32_t size;
+       char *buf;
+
+       perf_event_ops__fill_defaults(ops);
+
+       page_size = sysconf(_SC_PAGESIZE);
+
+       head = data_offset;
+       shift = page_size * (head / page_size);
+       offset += shift;
+       head -= shift;
+
+       mmap_prot  = PROT_READ;
+       mmap_flags = MAP_SHARED;
+
+       if (self->header.needs_swap) {
+               mmap_prot  |= PROT_WRITE;
+               mmap_flags = MAP_PRIVATE;
+       }
+remap:
+       buf = mmap(NULL, page_size * self->mmap_window, mmap_prot,
+                  mmap_flags, self->fd, offset);
+       if (buf == MAP_FAILED) {
+               pr_err("failed to mmap file\n");
+               err = -errno;
+               goto out_err;
+       }
+
+more:
+       event = (event_t *)(buf + head);
+
+       if (self->header.needs_swap)
+               perf_event_header__bswap(&event->header);
+       size = event->header.size;
+       if (size == 0)
+               size = 8;
+
+       if (head + event->header.size >= page_size * self->mmap_window) {
+               int munmap_ret;
+
+               shift = page_size * (head / page_size);
+
+               munmap_ret = munmap(buf, page_size * self->mmap_window);
+               assert(munmap_ret == 0);
+
+               offset += shift;
+               head -= shift;
+               goto remap;
+       }
+
+       size = event->header.size;
+
+       dump_printf("\n%#Lx [%#x]: event: %d\n",
+                   offset + head, event->header.size, event->header.type);
+
+       if (size == 0 ||
+           perf_session__process_event(self, event, ops, offset, head) < 0) {
+               dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n",
+                           offset + head, event->header.size,
+                           event->header.type);
+               /*
+                * assume we lost track of the stream, check alignment, and
+                * increment a single u64 in the hope to catch on again 'soon'.
+                */
+               if (unlikely(head & 7))
+                       head &= ~7ULL;
+
+               size = 8;
+       }
+
+       head += size;
+
+       if (offset + head >= data_offset + data_size)
+               goto done;
+
+       if (offset + head < file_size)
+               goto more;
+done:
+       err = 0;
+out_err:
+       return err;
+}
+
+int perf_session__process_events(struct perf_session *self,
+                                struct perf_event_ops *ops)
+{
+       int err;
+
+       if (perf_session__register_idle_thread(self) == NULL)
+               return -ENOMEM;
+
+       if (!symbol_conf.full_paths) {
+               char bf[PATH_MAX];
+
+               if (getcwd(bf, sizeof(bf)) == NULL) {
+                       err = -errno;
+out_getcwd_err:
+                       pr_err("failed to get the current directory\n");
+                       goto out_err;
+               }
+               self->cwd = strdup(bf);
+               if (self->cwd == NULL) {
+                       err = -ENOMEM;
+                       goto out_getcwd_err;
+               }
+               self->cwdlen = strlen(self->cwd);
+       }
+
+       err = __perf_session__process_events(self, self->header.data_offset,
+                                            self->header.data_size,
+                                            self->size, ops);
+out_err:
+       return err;
+}
+
+bool perf_session__has_traces(struct perf_session *self, const char *msg)
+{
+       if (!(self->sample_type & PERF_SAMPLE_RAW)) {
+               pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
+               return false;
+       }
+
+       return true;
+}
+
+int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
+                                            const char *symbol_name,
+                                            u64 addr)
+{
+       char *bracket;
+       enum map_type i;
+
+       self->ref_reloc_sym.name = strdup(symbol_name);
+       if (self->ref_reloc_sym.name == NULL)
+               return -ENOMEM;
+
+       bracket = strchr(self->ref_reloc_sym.name, ']');
+       if (bracket)
+               *bracket = '\0';
+
+       self->ref_reloc_sym.addr = addr;
+
+       for (i = 0; i < MAP__NR_TYPES; ++i) {
+               struct kmap *kmap = map__kmap(self->vmlinux_maps[i]);
+               kmap->ref_reloc_sym = &self->ref_reloc_sym;
+       }
+
+       return 0;
+}
+
+static u64 map__reloc_map_ip(struct map *map, u64 ip)
+{
+       return ip + (s64)map->pgoff;
+}
+
+static u64 map__reloc_unmap_ip(struct map *map, u64 ip)
+{
+       return ip - (s64)map->pgoff;
+}
+
+void map__reloc_vmlinux(struct map *self)
+{
+       struct kmap *kmap = map__kmap(self);
+       s64 reloc;
+
+       if (!kmap->ref_reloc_sym || !kmap->ref_reloc_sym->unrelocated_addr)
+               return;
+
+       reloc = (kmap->ref_reloc_sym->unrelocated_addr -
+                kmap->ref_reloc_sym->addr);
+
+       if (!reloc)
+               return;
+
+       self->map_ip   = map__reloc_map_ip;
+       self->unmap_ip = map__reloc_unmap_ip;
+       self->pgoff    = reloc;
+}
index 32eaa1bada062a108ddaebed928489b5bf3d5da6..31950fcd8a4d4cfcb5db948ad41a7f7371c2b584 100644 (file)
@@ -3,13 +3,13 @@
 
 #include "event.h"
 #include "header.h"
+#include "symbol.h"
 #include "thread.h"
 #include <linux/rbtree.h>
 #include "../../../include/linux/perf_event.h"
 
 struct ip_callchain;
 struct thread;
-struct symbol;
 
 struct perf_session {
        struct perf_header      header;
@@ -18,10 +18,13 @@ struct perf_session {
        struct map_groups       kmaps;
        struct rb_root          threads;
        struct thread           *last_match;
+       struct map              *vmlinux_maps[MAP__NR_TYPES];
        struct events_stats     events_stats;
        unsigned long           event_total[PERF_RECORD_MAX];
+       unsigned long           unknown_events;
        struct rb_root          hists;
        u64                     sample_type;
+       struct ref_reloc_sym    ref_reloc_sym;
        int                     fd;
        int                     cwdlen;
        char                    *cwd;
@@ -31,23 +34,25 @@ struct perf_session {
 typedef int (*event_op)(event_t *self, struct perf_session *session);
 
 struct perf_event_ops {
-       event_op        process_sample_event;
-       event_op        process_mmap_event;
-       event_op        process_comm_event;
-       event_op        process_fork_event;
-       event_op        process_exit_event;
-       event_op        process_lost_event;
-       event_op        process_read_event;
-       event_op        process_throttle_event;
-       event_op        process_unthrottle_event;
-       int             (*sample_type_check)(struct perf_session *session);
-       unsigned long   total_unknown;
-       bool            full_paths;
+       event_op sample,
+                mmap,
+                comm,
+                fork,
+                exit,
+                lost,
+                read,
+                throttle,
+                unthrottle;
 };
 
 struct perf_session *perf_session__new(const char *filename, int mode, bool force);
 void perf_session__delete(struct perf_session *self);
 
+void perf_event_header__bswap(struct perf_event_header *self);
+
+int __perf_session__process_events(struct perf_session *self,
+                                  u64 data_offset, u64 data_size, u64 size,
+                                  struct perf_event_ops *ops);
 int perf_session__process_events(struct perf_session *self,
                                 struct perf_event_ops *event_ops);
 
@@ -56,6 +61,28 @@ struct symbol **perf_session__resolve_callchain(struct perf_session *self,
                                                struct ip_callchain *chain,
                                                struct symbol **parent);
 
-int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
+bool perf_session__has_traces(struct perf_session *self, const char *msg);
+
+int perf_header__read_build_ids(struct perf_header *self, int input,
+                               u64 offset, u64 file_size);
+
+int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
+                                            const char *symbol_name,
+                                            u64 addr);
+
+void mem_bswap_64(void *src, int byte_size);
+
+static inline int __perf_session__create_kernel_maps(struct perf_session *self,
+                                               struct dso *kernel)
+{
+       return __map_groups__create_kernel_maps(&self->kmaps,
+                                               self->vmlinux_maps, kernel);
+}
 
+static inline struct map *
+       perf_session__new_module_map(struct perf_session *self,
+                                    u64 start, const char *filename)
+{
+       return map_groups__new_module(&self->kmaps, start, filename);
+}
 #endif /* __PERF_SESSION_H */
index 5352d7dccc61adab23a12ad60b9ec982e280d97e..c397d4f6f748279ee35b9b931e8e83add8e75967 100644 (file)
@@ -227,16 +227,73 @@ fail:
        return NULL;
 }
 
-/* Glob expression pattern matching */
+/* Character class matching */
+static bool __match_charclass(const char *pat, char c, const char **npat)
+{
+       bool complement = false, ret = true;
+
+       if (*pat == '!') {
+               complement = true;
+               pat++;
+       }
+       if (*pat++ == c)        /* First character is special */
+               goto end;
+
+       while (*pat && *pat != ']') {   /* Matching */
+               if (*pat == '-' && *(pat + 1) != ']') { /* Range */
+                       if (*(pat - 1) <= c && c <= *(pat + 1))
+                               goto end;
+                       if (*(pat - 1) > *(pat + 1))
+                               goto error;
+                       pat += 2;
+               } else if (*pat++ == c)
+                       goto end;
+       }
+       if (!*pat)
+               goto error;
+       ret = false;
+
+end:
+       while (*pat && *pat != ']')     /* Searching closing */
+               pat++;
+       if (!*pat)
+               goto error;
+       *npat = pat + 1;
+       return complement ? !ret : ret;
+
+error:
+       return false;
+}
+
+/**
+ * strglobmatch - glob expression pattern matching
+ * @str: the target string to match
+ * @pat: the pattern string to match
+ *
+ * This returns true if the @str matches @pat. @pat can includes wildcards
+ * ('*','?') and character classes ([CHARS], complementation and ranges are
+ * also supported). Also, this supports escape character ('\') to use special
+ * characters as normal character.
+ *
+ * Note: if @pat syntax is broken, this always returns false.
+ */
 bool strglobmatch(const char *str, const char *pat)
 {
        while (*str && *pat && *pat != '*') {
-               if (*pat == '?') {
+               if (*pat == '?') {      /* Matches any single character */
                        str++;
                        pat++;
-               } else
-                       if (*str++ != *pat++)
+                       continue;
+               } else if (*pat == '[') /* Character classes/Ranges */
+                       if (__match_charclass(pat + 1, *str, &pat)) {
+                               str++;
+                               continue;
+                       } else
                                return false;
+               else if (*pat == '\\') /* Escaped char match as normal char */
+                       pat++;
+               if (*str++ != *pat++)
+                       return false;
        }
        /* Check wild card */
        if (*pat == '*') {
index ab92763edb03f757e2941f95040133f96f84da02..323c0aea0a91172cced9261cdfd966cd2c0aa57d 100644 (file)
@@ -1,6 +1,5 @@
 #include "util.h"
 #include "../perf.h"
-#include "session.h"
 #include "sort.h"
 #include "string.h"
 #include "symbol.h"
@@ -22,6 +21,7 @@
 enum dso_origin {
        DSO__ORIG_KERNEL = 0,
        DSO__ORIG_JAVA_JIT,
+       DSO__ORIG_BUILD_ID_CACHE,
        DSO__ORIG_FEDORA,
        DSO__ORIG_UBUNTU,
        DSO__ORIG_BUILDID,
@@ -33,7 +33,7 @@ enum dso_origin {
 static void dsos__add(struct list_head *head, struct dso *dso);
 static struct map *map__new2(u64 start, struct dso *dso, enum map_type type);
 static int dso__load_kernel_sym(struct dso *self, struct map *map,
-                               struct perf_session *session, symbol_filter_t filter);
+                               symbol_filter_t filter);
 static int vmlinux_path__nr_entries;
 static char **vmlinux_path;
 
@@ -53,17 +53,12 @@ bool dso__sorted_by_name(const struct dso *self, enum map_type type)
        return self->sorted_by_name & (1 << type);
 }
 
-static void dso__set_loaded(struct dso *self, enum map_type type)
-{
-       self->loaded |= (1 << type);
-}
-
 static void dso__set_sorted_by_name(struct dso *self, enum map_type type)
 {
        self->sorted_by_name |= (1 << type);
 }
 
-static bool symbol_type__is_a(char symbol_type, enum map_type map_type)
+bool symbol_type__is_a(char symbol_type, enum map_type map_type)
 {
        switch (map_type) {
        case MAP__FUNCTION:
@@ -142,14 +137,14 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name)
        self->start = start;
        self->end   = len ? start + len - 1 : start;
 
-       pr_debug3("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
+       pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
 
        memcpy(self->name, name, namelen);
 
        return self;
 }
 
-static void symbol__delete(struct symbol *self)
+void symbol__delete(struct symbol *self)
 {
        free(((void *)self) - symbol_conf.priv_size);
 }
@@ -160,7 +155,7 @@ static size_t symbol__fprintf(struct symbol *self, FILE *fp)
                       self->start, self->end, self->name);
 }
 
-static void dso__set_long_name(struct dso *self, char *name)
+void dso__set_long_name(struct dso *self, char *name)
 {
        if (name == NULL)
                return;
@@ -175,7 +170,7 @@ static void dso__set_basename(struct dso *self)
 
 struct dso *dso__new(const char *name)
 {
-       struct dso *self = malloc(sizeof(*self) + strlen(name) + 1);
+       struct dso *self = zalloc(sizeof(*self) + strlen(name) + 1);
 
        if (self != NULL) {
                int i;
@@ -344,10 +339,10 @@ void dso__sort_by_name(struct dso *self, enum map_type type)
                                     &self->symbols[type]);
 }
 
-int build_id__sprintf(u8 *self, int len, char *bf)
+int build_id__sprintf(const u8 *self, int len, char *bf)
 {
        char *bid = bf;
-       u8 *raw = self;
+       const u8 *raw = self;
        int i;
 
        for (i = 0; i < len; ++i) {
@@ -372,6 +367,10 @@ size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
        struct rb_node *nd;
        size_t ret = fprintf(fp, "dso: %s (", self->short_name);
 
+       if (self->short_name != self->long_name)
+               ret += fprintf(fp, "%s, ", self->long_name);
+       ret += fprintf(fp, "%s, %sloaded, ", map_type__name[type],
+                      self->loaded ? "" : "NOT ");
        ret += dso__fprintf_buildid(self, fp);
        ret += fprintf(fp, ")\n");
        for (nd = rb_first(&self->symbols[type]); nd; nd = rb_next(nd)) {
@@ -382,24 +381,20 @@ size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
        return ret;
 }
 
-/*
- * Loads the function entries in /proc/kallsyms into kernel_map->dso,
- * so that we can in the next step set the symbol ->end address and then
- * call kernel_maps__split_kallsyms.
- */
-static int dso__load_all_kallsyms(struct dso *self, struct map *map)
+int kallsyms__parse(const char *filename, void *arg,
+                   int (*process_symbol)(void *arg, const char *name,
+                                                    char type, u64 start))
 {
        char *line = NULL;
        size_t n;
-       struct rb_root *root = &self->symbols[map->type];
-       FILE *file = fopen("/proc/kallsyms", "r");
+       int err = 0;
+       FILE *file = fopen(filename, "r");
 
        if (file == NULL)
                goto out_failure;
 
        while (!feof(file)) {
                u64 start;
-               struct symbol *sym;
                int line_len, len;
                char symbol_type;
                char *symbol_name;
@@ -420,43 +415,72 @@ static int dso__load_all_kallsyms(struct dso *self, struct map *map)
                        continue;
 
                symbol_type = toupper(line[len]);
-               if (!symbol_type__is_a(symbol_type, map->type))
-                       continue;
-
                symbol_name = line + len + 2;
-               /*
-                * Will fix up the end later, when we have all symbols sorted.
-                */
-               sym = symbol__new(start, 0, symbol_name);
 
-               if (sym == NULL)
-                       goto out_delete_line;
-               /*
-                * We will pass the symbols to the filter later, in
-                * map__split_kallsyms, when we have split the maps per module
-                */
-               symbols__insert(root, sym);
+               err = process_symbol(arg, symbol_name, symbol_type, start);
+               if (err)
+                       break;
        }
 
        free(line);
        fclose(file);
+       return err;
 
-       return 0;
-
-out_delete_line:
-       free(line);
 out_failure:
        return -1;
 }
 
+struct process_kallsyms_args {
+       struct map *map;
+       struct dso *dso;
+};
+
+static int map__process_kallsym_symbol(void *arg, const char *name,
+                                      char type, u64 start)
+{
+       struct symbol *sym;
+       struct process_kallsyms_args *a = arg;
+       struct rb_root *root = &a->dso->symbols[a->map->type];
+
+       if (!symbol_type__is_a(type, a->map->type))
+               return 0;
+
+       /*
+        * Will fix up the end later, when we have all symbols sorted.
+        */
+       sym = symbol__new(start, 0, name);
+
+       if (sym == NULL)
+               return -ENOMEM;
+       /*
+        * We will pass the symbols to the filter later, in
+        * map__split_kallsyms, when we have split the maps per module
+        */
+       symbols__insert(root, sym);
+       return 0;
+}
+
+/*
+ * Loads the function entries in /proc/kallsyms into kernel_map->dso,
+ * so that we can in the next step set the symbol ->end address and then
+ * call kernel_maps__split_kallsyms.
+ */
+static int dso__load_all_kallsyms(struct dso *self, const char *filename,
+                                 struct map *map)
+{
+       struct process_kallsyms_args args = { .map = map, .dso = self, };
+       return kallsyms__parse(filename, &args, map__process_kallsym_symbol);
+}
+
 /*
  * Split the symbols into maps, making sure there are no overlaps, i.e. the
  * kernel range is broken in several maps, named [kernel].N, as we don't have
  * the original ELF section names vmlinux have.
  */
 static int dso__split_kallsyms(struct dso *self, struct map *map,
-                              struct perf_session *session, symbol_filter_t filter)
+                              symbol_filter_t filter)
 {
+       struct map_groups *kmaps = map__kmap(map)->kmaps;
        struct map *curr_map = map;
        struct symbol *pos;
        int count = 0;
@@ -477,13 +501,17 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
 
                        *module++ = '\0';
 
-                       if (strcmp(self->name, module)) {
-                               curr_map = map_groups__find_by_name(&session->kmaps, map->type, module);
+                       if (strcmp(curr_map->dso->short_name, module)) {
+                               curr_map = map_groups__find_by_name(kmaps, map->type, module);
                                if (curr_map == NULL) {
                                        pr_debug("/proc/{kallsyms,modules} "
-                                                "inconsistency!\n");
+                                                "inconsistency while looking "
+                                                "for \"%s\" module!\n", module);
                                        return -1;
                                }
+
+                               if (curr_map->dso->loaded)
+                                       goto discard_symbol;
                        }
                        /*
                         * So that we look just like we get from .ko files,
@@ -503,13 +531,13 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
                                return -1;
 
                        curr_map = map__new2(pos->start, dso, map->type);
-                       if (map == NULL) {
+                       if (curr_map == NULL) {
                                dso__delete(dso);
                                return -1;
                        }
 
                        curr_map->map_ip = curr_map->unmap_ip = identity__map_ip;
-                       map_groups__insert(&session->kmaps, curr_map);
+                       map_groups__insert(kmaps, curr_map);
                        ++kernel_range;
                }
 
@@ -528,17 +556,16 @@ discard_symbol:           rb_erase(&pos->rb_node, root);
        return count;
 }
 
-
-static int dso__load_kallsyms(struct dso *self, struct map *map,
-                             struct perf_session *session, symbol_filter_t filter)
+int dso__load_kallsyms(struct dso *self, const char *filename,
+                      struct map *map, symbol_filter_t filter)
 {
-       if (dso__load_all_kallsyms(self, map) < 0)
+       if (dso__load_all_kallsyms(self, filename, map) < 0)
                return -1;
 
        symbols__fixup_end(&self->symbols[map->type]);
        self->origin = DSO__ORIG_KERNEL;
 
-       return dso__split_kallsyms(self, map, session, filter);
+       return dso__split_kallsyms(self, map, filter);
 }
 
 static int dso__load_perf_map(struct dso *self, struct map *map,
@@ -864,10 +891,10 @@ static bool elf_sec__is_a(GElf_Shdr *self, Elf_Data *secstrs, enum map_type type
        }
 }
 
-static int dso__load_sym(struct dso *self, struct map *map,
-                        struct perf_session *session, const char *name, int fd,
-                        symbol_filter_t filter, int kernel, int kmodule)
+static int dso__load_sym(struct dso *self, struct map *map, const char *name,
+                        int fd, symbol_filter_t filter, int kmodule)
 {
+       struct kmap *kmap = self->kernel ? map__kmap(map) : NULL;
        struct map *curr_map = map;
        struct dso *curr_dso = self;
        size_t dso_name_len = strlen(self->short_name);
@@ -924,7 +951,7 @@ static int dso__load_sym(struct dso *self, struct map *map,
        nr_syms = shdr.sh_size / shdr.sh_entsize;
 
        memset(&sym, 0, sizeof(sym));
-       if (!kernel) {
+       if (!self->kernel) {
                self->adjust_symbols = (ehdr.e_type == ET_EXEC ||
                                elf_section_by_name(elf, &ehdr, &shdr,
                                                     ".gnu.prelink_undo",
@@ -933,11 +960,15 @@ static int dso__load_sym(struct dso *self, struct map *map,
 
        elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
                struct symbol *f;
-               const char *elf_name;
+               const char *elf_name = elf_sym__name(&sym, symstrs);
                char *demangled = NULL;
                int is_label = elf_sym__is_label(&sym);
                const char *section_name;
 
+               if (kmap && kmap->ref_reloc_sym && kmap->ref_reloc_sym->name &&
+                   strcmp(elf_name, kmap->ref_reloc_sym->name) == 0)
+                       kmap->ref_reloc_sym->unrelocated_addr = sym.st_value;
+
                if (!is_label && !elf_sym__is_a(&sym, map->type))
                        continue;
 
@@ -950,10 +981,9 @@ static int dso__load_sym(struct dso *self, struct map *map,
                if (is_label && !elf_sec__is_a(&shdr, secstrs, map->type))
                        continue;
 
-               elf_name = elf_sym__name(&sym, symstrs);
                section_name = elf_sec__name(&shdr, secstrs);
 
-               if (kernel || kmodule) {
+               if (self->kernel || kmodule) {
                        char dso_name[PATH_MAX];
 
                        if (strcmp(section_name,
@@ -969,7 +999,7 @@ static int dso__load_sym(struct dso *self, struct map *map,
                        snprintf(dso_name, sizeof(dso_name),
                                 "%s%s", self->short_name, section_name);
 
-                       curr_map = map_groups__find_by_name(&session->kmaps, map->type, dso_name);
+                       curr_map = map_groups__find_by_name(kmap->kmaps, map->type, dso_name);
                        if (curr_map == NULL) {
                                u64 start = sym.st_value;
 
@@ -980,7 +1010,7 @@ static int dso__load_sym(struct dso *self, struct map *map,
                                if (curr_dso == NULL)
                                        goto out_elf_end;
                                curr_map = map__new2(start, curr_dso,
-                                                    MAP__FUNCTION);
+                                                    map->type);
                                if (curr_map == NULL) {
                                        dso__delete(curr_dso);
                                        goto out_elf_end;
@@ -988,8 +1018,9 @@ static int dso__load_sym(struct dso *self, struct map *map,
                                curr_map->map_ip = identity__map_ip;
                                curr_map->unmap_ip = identity__map_ip;
                                curr_dso->origin = DSO__ORIG_KERNEL;
-                               map_groups__insert(&session->kmaps, curr_map);
+                               map_groups__insert(kmap->kmaps, curr_map);
                                dsos__add(&dsos__kernel, curr_dso);
+                               dso__set_loaded(curr_dso, map->type);
                        } else
                                curr_dso = curr_map->dso;
 
@@ -997,9 +1028,10 @@ static int dso__load_sym(struct dso *self, struct map *map,
                }
 
                if (curr_dso->adjust_symbols) {
-                       pr_debug2("adjusting symbol: st_value: %Lx sh_addr: "
-                                 "%Lx sh_offset: %Lx\n", (u64)sym.st_value,
-                                 (u64)shdr.sh_addr, (u64)shdr.sh_offset);
+                       pr_debug4("%s: adjusting symbol: st_value: %#Lx "
+                                 "sh_addr: %#Lx sh_offset: %#Lx\n", __func__,
+                                 (u64)sym.st_value, (u64)shdr.sh_addr,
+                                 (u64)shdr.sh_offset);
                        sym.st_value -= shdr.sh_addr - shdr.sh_offset;
                }
                /*
@@ -1027,8 +1059,16 @@ new_symbol:
        /*
         * For misannotated, zeroed, ASM function sizes.
         */
-       if (nr > 0)
+       if (nr > 0) {
                symbols__fixup_end(&self->symbols[map->type]);
+               if (kmap) {
+                       /*
+                        * We need to fixup this here too because we create new
+                        * maps here, for things like vsyscall sections.
+                        */
+                       __map_groups__fixup_end(kmap->kmaps, map->type);
+               }
+       }
        err = nr;
 out_elf_end:
        elf_end(elf);
@@ -1041,25 +1081,28 @@ static bool dso__build_id_equal(const struct dso *self, u8 *build_id)
        return memcmp(self->build_id, build_id, sizeof(self->build_id)) == 0;
 }
 
-static bool __dsos__read_build_ids(struct list_head *head)
+static bool __dsos__read_build_ids(struct list_head *head, bool with_hits)
 {
        bool have_build_id = false;
        struct dso *pos;
 
-       list_for_each_entry(pos, head, node)
+       list_for_each_entry(pos, head, node) {
+               if (with_hits && !pos->hit)
+                       continue;
                if (filename__read_build_id(pos->long_name, pos->build_id,
                                            sizeof(pos->build_id)) > 0) {
                        have_build_id     = true;
                        pos->has_build_id = true;
                }
+       }
 
        return have_build_id;
 }
 
-bool dsos__read_build_ids(void)
+bool dsos__read_build_ids(bool with_hits)
 {
-       bool kbuildids = __dsos__read_build_ids(&dsos__kernel),
-            ubuildids = __dsos__read_build_ids(&dsos__user);
+       bool kbuildids = __dsos__read_build_ids(&dsos__kernel, with_hits),
+            ubuildids = __dsos__read_build_ids(&dsos__user, with_hits);
        return kbuildids || ubuildids;
 }
 
@@ -1191,6 +1234,7 @@ char dso__symtab_origin(const struct dso *self)
        static const char origin[] = {
                [DSO__ORIG_KERNEL] =   'k',
                [DSO__ORIG_JAVA_JIT] = 'j',
+               [DSO__ORIG_BUILD_ID_CACHE] = 'B',
                [DSO__ORIG_FEDORA] =   'f',
                [DSO__ORIG_UBUNTU] =   'u',
                [DSO__ORIG_BUILDID] =  'b',
@@ -1203,19 +1247,19 @@ char dso__symtab_origin(const struct dso *self)
        return origin[self->origin];
 }
 
-int dso__load(struct dso *self, struct map *map, struct perf_session *session,
-             symbol_filter_t filter)
+int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
 {
        int size = PATH_MAX;
        char *name;
        u8 build_id[BUILD_ID_SIZE];
+       char build_id_hex[BUILD_ID_SIZE * 2 + 1];
        int ret = -1;
        int fd;
 
        dso__set_loaded(self, map->type);
 
        if (self->kernel)
-               return dso__load_kernel_sym(self, map, session, filter);
+               return dso__load_kernel_sym(self, map, filter);
 
        name = malloc(size);
        if (!name)
@@ -1230,8 +1274,16 @@ int dso__load(struct dso *self, struct map *map, struct perf_session *session,
                return ret;
        }
 
-       self->origin = DSO__ORIG_FEDORA - 1;
+       self->origin = DSO__ORIG_BUILD_ID_CACHE;
 
+       if (self->has_build_id) {
+               build_id__sprintf(self->build_id, sizeof(self->build_id),
+                                 build_id_hex);
+               snprintf(name, size, "%s/%s/.build-id/%.2s/%s",
+                        getenv("HOME"), DEBUG_CACHE_DIR,
+                        build_id_hex, build_id_hex + 2);
+               goto open_file;
+       }
 more:
        do {
                self->origin++;
@@ -1247,8 +1299,6 @@ more:
                case DSO__ORIG_BUILDID:
                        if (filename__read_build_id(self->long_name, build_id,
                                                    sizeof(build_id))) {
-                               char build_id_hex[BUILD_ID_SIZE * 2 + 1];
-
                                build_id__sprintf(build_id, sizeof(build_id),
                                                  build_id_hex);
                                snprintf(name, size,
@@ -1276,11 +1326,11 @@ compare_build_id:
                        if (!dso__build_id_equal(self, build_id))
                                goto more;
                }
-
+open_file:
                fd = open(name, O_RDONLY);
        } while (fd < 0);
 
-       ret = dso__load_sym(self, map, NULL, name, fd, filter, 0, 0);
+       ret = dso__load_sym(self, map, name, fd, filter, 0);
        close(fd);
 
        /*
@@ -1309,14 +1359,34 @@ struct map *map_groups__find_by_name(struct map_groups *self,
        for (nd = rb_first(&self->maps[type]); nd; nd = rb_next(nd)) {
                struct map *map = rb_entry(nd, struct map, rb_node);
 
-               if (map->dso && strcmp(map->dso->name, name) == 0)
+               if (map->dso && strcmp(map->dso->short_name, name) == 0)
                        return map;
        }
 
        return NULL;
 }
 
-static int perf_session__set_modules_path_dir(struct perf_session *self, char *dirname)
+static int dso__kernel_module_get_build_id(struct dso *self)
+{
+       char filename[PATH_MAX];
+       /*
+        * kernel module short names are of the form "[module]" and
+        * we need just "module" here.
+        */
+       const char *name = self->short_name + 1;
+
+       snprintf(filename, sizeof(filename),
+                "/sys/module/%.*s/notes/.note.gnu.build-id",
+                (int)strlen(name - 1), name);
+
+       if (sysfs__read_build_id(filename, self->build_id,
+                                sizeof(self->build_id)) == 0)
+               self->has_build_id = true;
+
+       return 0;
+}
+
+static int map_groups__set_modules_path_dir(struct map_groups *self, char *dirname)
 {
        struct dirent *dent;
        DIR *dir = opendir(dirname);
@@ -1336,7 +1406,7 @@ static int perf_session__set_modules_path_dir(struct perf_session *self, char *d
 
                        snprintf(path, sizeof(path), "%s/%s",
                                 dirname, dent->d_name);
-                       if (perf_session__set_modules_path_dir(self, path) < 0)
+                       if (map_groups__set_modules_path_dir(self, path) < 0)
                                goto failure;
                } else {
                        char *dot = strrchr(dent->d_name, '.'),
@@ -1350,7 +1420,7 @@ static int perf_session__set_modules_path_dir(struct perf_session *self, char *d
                                 (int)(dot - dent->d_name), dent->d_name);
 
                        strxfrchar(dso_name, '-', '_');
-                       map = map_groups__find_by_name(&self->kmaps, MAP__FUNCTION, dso_name);
+                       map = map_groups__find_by_name(self, MAP__FUNCTION, dso_name);
                        if (map == NULL)
                                continue;
 
@@ -1361,6 +1431,7 @@ static int perf_session__set_modules_path_dir(struct perf_session *self, char *d
                        if (long_name == NULL)
                                goto failure;
                        dso__set_long_name(map->dso, long_name);
+                       dso__kernel_module_get_build_id(map->dso);
                }
        }
 
@@ -1370,7 +1441,7 @@ failure:
        return -1;
 }
 
-static int perf_session__set_modules_path(struct perf_session *self)
+static int map_groups__set_modules_path(struct map_groups *self)
 {
        struct utsname uts;
        char modules_path[PATH_MAX];
@@ -1381,7 +1452,7 @@ static int perf_session__set_modules_path(struct perf_session *self)
        snprintf(modules_path, sizeof(modules_path), "/lib/modules/%s/kernel",
                 uts.release);
 
-       return perf_session__set_modules_path_dir(self, modules_path);
+       return map_groups__set_modules_path_dir(self, modules_path);
 }
 
 /*
@@ -1391,8 +1462,8 @@ static int perf_session__set_modules_path(struct perf_session *self)
  */
 static struct map *map__new2(u64 start, struct dso *dso, enum map_type type)
 {
-       struct map *self = malloc(sizeof(*self));
-
+       struct map *self = zalloc(sizeof(*self) +
+                                 (dso->kernel ? sizeof(struct kmap) : 0));
        if (self != NULL) {
                /*
                 * ->end will be filled after we load all the symbols
@@ -1403,7 +1474,25 @@ static struct map *map__new2(u64 start, struct dso *dso, enum map_type type)
        return self;
 }
 
-static int perf_session__create_module_maps(struct perf_session *self)
+struct map *map_groups__new_module(struct map_groups *self, u64 start,
+                                  const char *filename)
+{
+       struct map *map;
+       struct dso *dso = __dsos__findnew(&dsos__kernel, filename);
+
+       if (dso == NULL)
+               return NULL;
+
+       map = map__new2(start, dso, MAP__FUNCTION);
+       if (map == NULL)
+               return NULL;
+
+       dso->origin = DSO__ORIG_KMODULE;
+       map_groups__insert(self, map);
+       return map;
+}
+
+static int map_groups__create_modules(struct map_groups *self)
 {
        char *line = NULL;
        size_t n;
@@ -1416,7 +1505,6 @@ static int perf_session__create_module_maps(struct perf_session *self)
        while (!feof(file)) {
                char name[PATH_MAX];
                u64 start;
-               struct dso *dso;
                char *sep;
                int line_len;
 
@@ -1442,32 +1530,16 @@ static int perf_session__create_module_maps(struct perf_session *self)
                *sep = '\0';
 
                snprintf(name, sizeof(name), "[%s]", line);
-               dso = dso__new(name);
-
-               if (dso == NULL)
-                       goto out_delete_line;
-
-               map = map__new2(start, dso, MAP__FUNCTION);
-               if (map == NULL) {
-                       dso__delete(dso);
+               map = map_groups__new_module(self, start, name);
+               if (map == NULL)
                        goto out_delete_line;
-               }
-
-               snprintf(name, sizeof(name),
-                        "/sys/module/%s/notes/.note.gnu.build-id", line);
-               if (sysfs__read_build_id(name, dso->build_id,
-                                        sizeof(dso->build_id)) == 0)
-                       dso->has_build_id = true;
-
-               dso->origin = DSO__ORIG_KMODULE;
-               map_groups__insert(&self->kmaps, map);
-               dsos__add(&dsos__kernel, dso);
+               dso__kernel_module_get_build_id(map->dso);
        }
 
        free(line);
        fclose(file);
 
-       return perf_session__set_modules_path(self);
+       return map_groups__set_modules_path(self);
 
 out_delete_line:
        free(line);
@@ -1476,7 +1548,6 @@ out_failure:
 }
 
 static int dso__load_vmlinux(struct dso *self, struct map *map,
-                            struct perf_session *session,
                             const char *vmlinux, symbol_filter_t filter)
 {
        int err = -1, fd;
@@ -1510,51 +1581,124 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
                return -1;
 
        dso__set_loaded(self, map->type);
-       err = dso__load_sym(self, map, session, self->long_name, fd, filter, 1, 0);
+       err = dso__load_sym(self, map, vmlinux, fd, filter, 0);
        close(fd);
 
+       if (err > 0)
+               pr_debug("Using %s for symbols\n", vmlinux);
+
+       return err;
+}
+
+int dso__load_vmlinux_path(struct dso *self, struct map *map,
+                          symbol_filter_t filter)
+{
+       int i, err = 0;
+
+       pr_debug("Looking at the vmlinux_path (%d entries long)\n",
+                vmlinux_path__nr_entries);
+
+       for (i = 0; i < vmlinux_path__nr_entries; ++i) {
+               err = dso__load_vmlinux(self, map, vmlinux_path[i], filter);
+               if (err > 0) {
+                       dso__set_long_name(self, strdup(vmlinux_path[i]));
+                       break;
+               }
+       }
+
        return err;
 }
 
 static int dso__load_kernel_sym(struct dso *self, struct map *map,
-                               struct perf_session *session, symbol_filter_t filter)
+                               symbol_filter_t filter)
 {
        int err;
-       bool is_kallsyms;
+       const char *kallsyms_filename = NULL;
+       char *kallsyms_allocated_filename = NULL;
+       /*
+        * Step 1: if the user specified a vmlinux filename, use it and only
+        * it, reporting errors to the user if it cannot be used.
+        *
+        * For instance, try to analyse an ARM perf.data file _without_ a
+        * build-id, or if the user specifies the wrong path to the right
+        * vmlinux file, obviously we can't fallback to another vmlinux (a
+        * x86_86 one, on the machine where analysis is being performed, say),
+        * or worse, /proc/kallsyms.
+        *
+        * If the specified file _has_ a build-id and there is a build-id
+        * section in the perf.data file, we will still do the expected
+        * validation in dso__load_vmlinux and will bail out if they don't
+        * match.
+        */
+       if (symbol_conf.vmlinux_name != NULL) {
+               err = dso__load_vmlinux(self, map,
+                                       symbol_conf.vmlinux_name, filter);
+               goto out_try_fixup;
+       }
 
        if (vmlinux_path != NULL) {
-               int i;
-               pr_debug("Looking at the vmlinux_path (%d entries long)\n",
-                        vmlinux_path__nr_entries);
-               for (i = 0; i < vmlinux_path__nr_entries; ++i) {
-                       err = dso__load_vmlinux(self, map, session,
-                                               vmlinux_path[i], filter);
-                       if (err > 0) {
-                               pr_debug("Using %s for symbols\n",
-                                        vmlinux_path[i]);
-                               dso__set_long_name(self,
-                                                  strdup(vmlinux_path[i]));
-                               goto out_fixup;
+               err = dso__load_vmlinux_path(self, map, filter);
+               if (err > 0)
+                       goto out_fixup;
+       }
+
+       /*
+        * Say the kernel DSO was created when processing the build-id header table,
+        * we have a build-id, so check if it is the same as the running kernel,
+        * using it if it is.
+        */
+       if (self->has_build_id) {
+               u8 kallsyms_build_id[BUILD_ID_SIZE];
+               char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+
+               if (sysfs__read_build_id("/sys/kernel/notes", kallsyms_build_id,
+                                        sizeof(kallsyms_build_id)) == 0) {
+                       if (dso__build_id_equal(self, kallsyms_build_id)) {
+                               kallsyms_filename = "/proc/kallsyms";
+                               goto do_kallsyms;
                        }
                }
-       }
+               /*
+                * Now look if we have it on the build-id cache in
+                * $HOME/.debug/[kernel.kallsyms].
+                */
+               build_id__sprintf(self->build_id, sizeof(self->build_id),
+                                 sbuild_id);
 
-       is_kallsyms = self->long_name[0] == '[';
-       if (is_kallsyms)
-               goto do_kallsyms;
+               if (asprintf(&kallsyms_allocated_filename,
+                            "%s/.debug/[kernel.kallsyms]/%s",
+                            getenv("HOME"), sbuild_id) == -1) {
+                       pr_err("Not enough memory for kallsyms file lookup\n");
+                       return -1;
+               }
 
-       err = dso__load_vmlinux(self, map, session, self->long_name, filter);
-       if (err <= 0) {
-               pr_info("The file %s cannot be used, "
-                       "trying to use /proc/kallsyms...", self->long_name);
-do_kallsyms:
-               err = dso__load_kallsyms(self, map, session, filter);
-               if (err > 0 && !is_kallsyms)
-                        dso__set_long_name(self, strdup("[kernel.kallsyms]"));
+               kallsyms_filename = kallsyms_allocated_filename;
+
+               if (access(kallsyms_filename, F_OK)) {
+                       pr_err("No kallsyms or vmlinux with build-id %s "
+                              "was found\n", sbuild_id);
+                       free(kallsyms_allocated_filename);
+                       return -1;
+               }
+       } else {
+               /*
+                * Last resort, if we don't have a build-id and couldn't find
+                * any vmlinux file, try the running kernel kallsyms table.
+                */
+               kallsyms_filename = "/proc/kallsyms";
        }
 
+do_kallsyms:
+       err = dso__load_kallsyms(self, kallsyms_filename, map, filter);
+       if (err > 0)
+               pr_debug("Using %s for symbols\n", kallsyms_filename);
+       free(kallsyms_allocated_filename);
+
+out_try_fixup:
        if (err > 0) {
 out_fixup:
+               if (kallsyms_filename != NULL)
+                       dso__set_long_name(self, strdup("[kernel.kallsyms]"));
                map__fixup_start(map);
                map__fixup_end(map);
        }
@@ -1564,7 +1708,6 @@ out_fixup:
 
 LIST_HEAD(dsos__user);
 LIST_HEAD(dsos__kernel);
-struct dso *vdso;
 
 static void dsos__add(struct list_head *head, struct dso *dso)
 {
@@ -1576,19 +1719,19 @@ static struct dso *dsos__find(struct list_head *head, const char *name)
        struct dso *pos;
 
        list_for_each_entry(pos, head, node)
-               if (strcmp(pos->name, name) == 0)
+               if (strcmp(pos->long_name, name) == 0)
                        return pos;
        return NULL;
 }
 
-struct dso *dsos__findnew(const char *name)
+struct dso *__dsos__findnew(struct list_head *head, const char *name)
 {
-       struct dso *dso = dsos__find(&dsos__user, name);
+       struct dso *dso = dsos__find(head, name);
 
        if (!dso) {
                dso = dso__new(name);
                if (dso != NULL) {
-                       dsos__add(&dsos__user, dso);
+                       dsos__add(head, dso);
                        dso__set_basename(dso);
                }
        }
@@ -1613,75 +1756,78 @@ void dsos__fprintf(FILE *fp)
        __dsos__fprintf(&dsos__user, fp);
 }
 
-static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp)
+static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
+                                     bool with_hits)
 {
        struct dso *pos;
        size_t ret = 0;
 
        list_for_each_entry(pos, head, node) {
+               if (with_hits && !pos->hit)
+                       continue;
                ret += dso__fprintf_buildid(pos, fp);
                ret += fprintf(fp, " %s\n", pos->long_name);
        }
        return ret;
 }
 
-size_t dsos__fprintf_buildid(FILE *fp)
+size_t dsos__fprintf_buildid(FILE *fp, bool with_hits)
 {
-       return (__dsos__fprintf_buildid(&dsos__kernel, fp) +
-               __dsos__fprintf_buildid(&dsos__user, fp));
+       return (__dsos__fprintf_buildid(&dsos__kernel, fp, with_hits) +
+               __dsos__fprintf_buildid(&dsos__user, fp, with_hits));
 }
 
-static struct dso *dsos__create_kernel( const char *vmlinux)
+struct dso *dso__new_kernel(const char *name)
 {
-       struct dso *kernel = dso__new(vmlinux ?: "[kernel.kallsyms]");
+       struct dso *self = dso__new(name ?: "[kernel.kallsyms]");
 
-       if (kernel == NULL)
-               return NULL;
+       if (self != NULL) {
+               self->short_name = "[kernel]";
+               self->kernel     = 1;
+       }
 
-       kernel->short_name = "[kernel]";
-       kernel->kernel     = 1;
+       return self;
+}
 
-       vdso = dso__new("[vdso]");
-       if (vdso == NULL)
-               goto out_delete_kernel_dso;
-       dso__set_loaded(vdso, MAP__FUNCTION);
+void dso__read_running_kernel_build_id(struct dso *self)
+{
+       if (sysfs__read_build_id("/sys/kernel/notes", self->build_id,
+                                sizeof(self->build_id)) == 0)
+               self->has_build_id = true;
+}
 
-       if (sysfs__read_build_id("/sys/kernel/notes", kernel->build_id,
-                                sizeof(kernel->build_id)) == 0)
-               kernel->has_build_id = true;
+static struct dso *dsos__create_kernel(const char *vmlinux)
+{
+       struct dso *kernel = dso__new_kernel(vmlinux);
 
-       dsos__add(&dsos__kernel, kernel);
-       dsos__add(&dsos__user, vdso);
+       if (kernel != NULL) {
+               dso__read_running_kernel_build_id(kernel);
+               dsos__add(&dsos__kernel, kernel);
+       }
 
        return kernel;
-
-out_delete_kernel_dso:
-       dso__delete(kernel);
-       return NULL;
 }
 
-static int map_groups__create_kernel_maps(struct map_groups *self, const char *vmlinux)
+int __map_groups__create_kernel_maps(struct map_groups *self,
+                                    struct map *vmlinux_maps[MAP__NR_TYPES],
+                                    struct dso *kernel)
 {
-       struct map *functions, *variables;
-       struct dso *kernel = dsos__create_kernel(vmlinux);
+       enum map_type type;
 
-       if (kernel == NULL)
-               return -1;
+       for (type = 0; type < MAP__NR_TYPES; ++type) {
+               struct kmap *kmap;
 
-       functions = map__new2(0, kernel, MAP__FUNCTION);
-       if (functions == NULL)
-               return -1;
+               vmlinux_maps[type] = map__new2(0, kernel, type);
+               if (vmlinux_maps[type] == NULL)
+                       return -1;
 
-       variables = map__new2(0, kernel, MAP__VARIABLE);
-       if (variables == NULL) {
-               map__delete(functions);
-               return -1;
-       }
+               vmlinux_maps[type]->map_ip =
+                       vmlinux_maps[type]->unmap_ip = identity__map_ip;
 
-       functions->map_ip = functions->unmap_ip =
-               variables->map_ip = variables->unmap_ip = identity__map_ip;
-       map_groups__insert(self, functions);
-       map_groups__insert(self, variables);
+               kmap = map__kmap(vmlinux_maps[type]);
+               kmap->kmaps = self;
+               map_groups__insert(self, vmlinux_maps[type]);
+       }
 
        return 0;
 }
@@ -1791,19 +1937,22 @@ out_free_comm_list:
        return -1;
 }
 
-int perf_session__create_kernel_maps(struct perf_session *self)
+int map_groups__create_kernel_maps(struct map_groups *self,
+                                  struct map *vmlinux_maps[MAP__NR_TYPES])
 {
-       if (map_groups__create_kernel_maps(&self->kmaps,
-                                          symbol_conf.vmlinux_name) < 0)
+       struct dso *kernel = dsos__create_kernel(symbol_conf.vmlinux_name);
+
+       if (kernel == NULL)
+               return -1;
+
+       if (__map_groups__create_kernel_maps(self, vmlinux_maps, kernel) < 0)
                return -1;
 
-       if (symbol_conf.use_modules &&
-           perf_session__create_module_maps(self) < 0)
-               pr_debug("Failed to load list of modules for session %s, "
-                        "continuing...\n", self->filename);
+       if (symbol_conf.use_modules && map_groups__create_modules(self) < 0)
+               pr_debug("Problems creating module maps, continuing anyway...\n");
        /*
         * Now that we have all the maps created, just set the ->end of them:
         */
-       map_groups__fixup_end(&self->kmaps);
+       map_groups__fixup_end(self);
        return 0;
 }
index 8aded2356f7961458b8a3d18635a0ca4c66d2ae2..280dadd32a08972f59bde677d4f7bc6c14a0da36 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/rbtree.h>
 #include "event.h"
 
+#define DEBUG_CACHE_DIR ".debug"
+
 #ifdef HAVE_CPLUS_DEMANGLE
 extern char *cplus_demangle(const char *, int);
 
@@ -49,6 +51,8 @@ struct symbol {
        char            name[0];
 };
 
+void symbol__delete(struct symbol *self);
+
 struct strlist;
 
 struct symbol_conf {
@@ -58,7 +62,8 @@ struct symbol_conf {
                        sort_by_name,
                        show_nr_samples,
                        use_callchain,
-                       exclude_other;
+                       exclude_other,
+                       full_paths;
        const char      *vmlinux_name,
                        *field_sep;
        char            *dso_list_str,
@@ -77,6 +82,12 @@ static inline void *symbol__priv(struct symbol *self)
        return ((void *)self) - symbol_conf.priv_size;
 }
 
+struct ref_reloc_sym {
+       const char      *name;
+       u64             addr;
+       u64             unrelocated_addr;
+};
+
 struct addr_location {
        struct thread *thread;
        struct map    *map;
@@ -94,6 +105,7 @@ struct dso {
        u8               slen_calculated:1;
        u8               has_build_id:1;
        u8               kernel:1;
+       u8               hit:1;
        unsigned char    origin;
        u8               sorted_by_name;
        u8               loaded;
@@ -105,37 +117,55 @@ struct dso {
 };
 
 struct dso *dso__new(const char *name);
+struct dso *dso__new_kernel(const char *name);
 void dso__delete(struct dso *self);
 
 bool dso__loaded(const struct dso *self, enum map_type type);
 bool dso__sorted_by_name(const struct dso *self, enum map_type type);
 
+static inline void dso__set_loaded(struct dso *self, enum map_type type)
+{
+       self->loaded |= (1 << type);
+}
+
 void dso__sort_by_name(struct dso *self, enum map_type type);
 
-struct perf_session;
+extern struct list_head dsos__user, dsos__kernel;
+
+struct dso *__dsos__findnew(struct list_head *head, const char *name);
+
+static inline struct dso *dsos__findnew(const char *name)
+{
+       return __dsos__findnew(&dsos__user, name);
+}
 
-struct dso *dsos__findnew(const char *name);
-int dso__load(struct dso *self, struct map *map, struct perf_session *session,
-             symbol_filter_t filter);
+int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
+int dso__load_vmlinux_path(struct dso *self, struct map *map,
+                          symbol_filter_t filter);
+int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map,
+                      symbol_filter_t filter);
 void dsos__fprintf(FILE *fp);
-size_t dsos__fprintf_buildid(FILE *fp);
+size_t dsos__fprintf_buildid(FILE *fp, bool with_hits);
 
 size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
 size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);
 char dso__symtab_origin(const struct dso *self);
+void dso__set_long_name(struct dso *self, char *name);
 void dso__set_build_id(struct dso *self, void *build_id);
+void dso__read_running_kernel_build_id(struct dso *self);
 struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr);
 struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type,
                                        const char *name);
 
 int filename__read_build_id(const char *filename, void *bf, size_t size);
 int sysfs__read_build_id(const char *filename, void *bf, size_t size);
-bool dsos__read_build_ids(void);
-int build_id__sprintf(u8 *self, int len, char *bf);
+bool dsos__read_build_ids(bool with_hits);
+int build_id__sprintf(const u8 *self, int len, char *bf);
+int kallsyms__parse(const char *filename, void *arg,
+                   int (*process_symbol)(void *arg, const char *name,
+                                         char type, u64 start));
 
 int symbol__init(void);
-int perf_session__create_kernel_maps(struct perf_session *self);
+bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 
-extern struct list_head dsos__user, dsos__kernel;
-extern struct dso *vdso;
 #endif /* __PERF_SYMBOL */
index 4a08dcf50b68c4bd9858c17fd569ae6acdec8257..21b92162282b8d70b23be3ef889bdf690b96070c 100644 (file)
@@ -31,12 +31,41 @@ static struct thread *thread__new(pid_t pid)
        return self;
 }
 
+static void map_groups__flush(struct map_groups *self)
+{
+       int type;
+
+       for (type = 0; type < MAP__NR_TYPES; type++) {
+               struct rb_root *root = &self->maps[type];
+               struct rb_node *next = rb_first(root);
+
+               while (next) {
+                       struct map *pos = rb_entry(next, struct map, rb_node);
+                       next = rb_next(&pos->rb_node);
+                       rb_erase(&pos->rb_node, root);
+                       /*
+                        * We may have references to this map, for
+                        * instance in some hist_entry instances, so
+                        * just move them to a separate list.
+                        */
+                       list_add_tail(&pos->node, &self->removed_maps[pos->type]);
+               }
+       }
+}
+
 int thread__set_comm(struct thread *self, const char *comm)
 {
+       int err;
+
        if (self->comm)
                free(self->comm);
        self->comm = strdup(comm);
-       return self->comm ? 0 : -ENOMEM;
+       err = self->comm == NULL ? -ENOMEM : 0;
+       if (!err) {
+               self->comm_set = true;
+               map_groups__flush(&self->mg);
+       }
+       return err;
 }
 
 int thread__comm_len(struct thread *self)
@@ -50,11 +79,6 @@ int thread__comm_len(struct thread *self)
        return self->comm_len;
 }
 
-static const char *map_type__name[MAP__NR_TYPES] = {
-       [MAP__FUNCTION] = "Functions",
-       [MAP__VARIABLE] = "Variables",
-};
-
 static size_t __map_groups__fprintf_maps(struct map_groups *self,
                                         enum map_type type, FILE *fp)
 {
@@ -255,11 +279,14 @@ int thread__fork(struct thread *self, struct thread *parent)
 {
        int i;
 
-       if (self->comm)
-               free(self->comm);
-       self->comm = strdup(parent->comm);
-       if (!self->comm)
-               return -ENOMEM;
+       if (parent->comm_set) {
+               if (self->comm)
+                       free(self->comm);
+               self->comm = strdup(parent->comm);
+               if (!self->comm)
+                       return -ENOMEM;
+               self->comm_set = true;
+       }
 
        for (i = 0; i < MAP__NR_TYPES; ++i)
                if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
@@ -282,14 +309,13 @@ size_t perf_session__fprintf(struct perf_session *self, FILE *fp)
 }
 
 struct symbol *map_groups__find_symbol(struct map_groups *self,
-                                      struct perf_session *session,
                                       enum map_type type, u64 addr,
                                       symbol_filter_t filter)
 {
        struct map *map = map_groups__find(self, type, addr);
 
        if (map != NULL)
-               return map__find_symbol(map, session, map->map_ip(map, addr), filter);
+               return map__find_symbol(map, map->map_ip(map, addr), filter);
 
        return NULL;
 }
index c206f72c88811fb959d26d984b2e7a3506621d9a..0a28f39de545f5810893fe44b87af0f895000037 100644 (file)
@@ -15,6 +15,7 @@ struct thread {
        struct map_groups       mg;
        pid_t                   pid;
        char                    shortname[3];
+       bool                    comm_set;
        char                    *comm;
        int                     comm_len;
 };
@@ -48,23 +49,36 @@ static inline struct map *thread__find_map(struct thread *self,
        return self ? map_groups__find(&self->mg, type, addr) : NULL;
 }
 
+void thread__find_addr_map(struct thread *self,
+                          struct perf_session *session, u8 cpumode,
+                          enum map_type type, u64 addr,
+                          struct addr_location *al);
+
 void thread__find_addr_location(struct thread *self,
                                struct perf_session *session, u8 cpumode,
                                enum map_type type, u64 addr,
                                struct addr_location *al,
                                symbol_filter_t filter);
 struct symbol *map_groups__find_symbol(struct map_groups *self,
-                                      struct perf_session *session,
                                       enum map_type type, u64 addr,
                                       symbol_filter_t filter);
 
-static inline struct symbol *
-map_groups__find_function(struct map_groups *self, struct perf_session *session,
-                         u64 addr, symbol_filter_t filter)
+static inline struct symbol *map_groups__find_function(struct map_groups *self,
+                                                      u64 addr,
+                                                      symbol_filter_t filter)
 {
-       return map_groups__find_symbol(self, session, MAP__FUNCTION, addr, filter);
+       return map_groups__find_symbol(self, MAP__FUNCTION, addr, filter);
 }
 
 struct map *map_groups__find_by_name(struct map_groups *self,
                                     enum map_type type, const char *name);
+
+int __map_groups__create_kernel_maps(struct map_groups *self,
+                                    struct map *vmlinux_maps[MAP__NR_TYPES],
+                                    struct dso *kernel);
+int map_groups__create_kernel_maps(struct map_groups *self,
+                                  struct map *vmlinux_maps[MAP__NR_TYPES]);
+
+struct map *map_groups__new_module(struct map_groups *self, u64 start,
+                                  const char *filename);
 #endif /* __PERF_THREAD_H */
index cace35595530a1dedeb283b0adb651a3af32cd4c..5ea8973ad331d48e1d4d9e9c94cc65d27a816599 100644 (file)
@@ -20,6 +20,7 @@
  */
 #define _GNU_SOURCE
 #include <dirent.h>
+#include <mntent.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -37,6 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
+#include "debugfs.h"
 
 #define VERSION "0.5"
 
@@ -101,32 +103,12 @@ void *malloc_or_die(unsigned int size)
 
 static const char *find_debugfs(void)
 {
-       static char debugfs[MAX_PATH+1];
-       static int debugfs_found;
-       char type[100];
-       FILE *fp;
-
-       if (debugfs_found)
-               return debugfs;
-
-       if ((fp = fopen("/proc/mounts","r")) == NULL)
-               die("Can't open /proc/mounts for read");
-
-       while (fscanf(fp, "%*s %"
-                     STR(MAX_PATH)
-                     "s %99s %*s %*d %*d\n",
-                     debugfs, type) == 2) {
-               if (strcmp(type, "debugfs") == 0)
-                       break;
-       }
-       fclose(fp);
-
-       if (strcmp(type, "debugfs") != 0)
-               die("debugfs not mounted, please mount");
+       const char *path = debugfs_mount(NULL);
 
-       debugfs_found = 1;
+       if (!path)
+               die("Your kernel not support debugfs filesystem");
 
-       return debugfs;
+       return path;
 }
 
 /*
@@ -271,6 +253,8 @@ static void read_header_files(void)
        write_or_die("header_page", 12);
        write_or_die(&size, 8);
        check_size = copy_file_fd(fd);
+       close(fd);
+
        if (size != check_size)
                die("wrong size for '%s' size=%lld read=%lld",
                    path, size, check_size);
@@ -289,6 +273,7 @@ static void read_header_files(void)
        if (size != check_size)
                die("wrong size for '%s'", path);
        put_tracing_file(path);
+       close(fd);
 }
 
 static bool name_in_tp_list(char *sys, struct tracepoint_path *tps)
@@ -317,7 +302,8 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
                die("can't read directory '%s'", sys);
 
        while ((dent = readdir(dir))) {
-               if (strcmp(dent->d_name, ".") == 0 ||
+               if (dent->d_type != DT_DIR ||
+                   strcmp(dent->d_name, ".") == 0 ||
                    strcmp(dent->d_name, "..") == 0 ||
                    !name_in_tp_list(dent->d_name, tps))
                        continue;
@@ -334,7 +320,8 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
 
        rewinddir(dir);
        while ((dent = readdir(dir))) {
-               if (strcmp(dent->d_name, ".") == 0 ||
+               if (dent->d_type != DT_DIR ||
+                   strcmp(dent->d_name, ".") == 0 ||
                    strcmp(dent->d_name, "..") == 0 ||
                    !name_in_tp_list(dent->d_name, tps))
                        continue;
@@ -353,6 +340,7 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
 
                free(format);
        }
+       closedir(dir);
 }
 
 static void read_ftrace_files(struct tracepoint_path *tps)
@@ -394,26 +382,21 @@ static void read_event_files(struct tracepoint_path *tps)
                die("can't read directory '%s'", path);
 
        while ((dent = readdir(dir))) {
-               if (strcmp(dent->d_name, ".") == 0 ||
+               if (dent->d_type != DT_DIR ||
+                   strcmp(dent->d_name, ".") == 0 ||
                    strcmp(dent->d_name, "..") == 0 ||
                    strcmp(dent->d_name, "ftrace") == 0 ||
                    !system_in_tp_list(dent->d_name, tps))
                        continue;
-               sys = malloc_or_die(strlen(path) + strlen(dent->d_name) + 2);
-               sprintf(sys, "%s/%s", path, dent->d_name);
-               ret = stat(sys, &st);
-               free(sys);
-               if (ret < 0)
-                       continue;
-               if (S_ISDIR(st.st_mode))
-                       count++;
+               count++;
        }
 
        write_or_die(&count, 4);
 
        rewinddir(dir);
        while ((dent = readdir(dir))) {
-               if (strcmp(dent->d_name, ".") == 0 ||
+               if (dent->d_type != DT_DIR ||
+                   strcmp(dent->d_name, ".") == 0 ||
                    strcmp(dent->d_name, "..") == 0 ||
                    strcmp(dent->d_name, "ftrace") == 0 ||
                    !system_in_tp_list(dent->d_name, tps))
@@ -422,14 +405,13 @@ static void read_event_files(struct tracepoint_path *tps)
                sprintf(sys, "%s/%s", path, dent->d_name);
                ret = stat(sys, &st);
                if (ret >= 0) {
-                       if (S_ISDIR(st.st_mode)) {
-                               write_or_die(dent->d_name, strlen(dent->d_name) + 1);
-                               copy_event_system(sys, tps);
-                       }
+                       write_or_die(dent->d_name, strlen(dent->d_name) + 1);
+                       copy_event_system(sys, tps);
                }
                free(sys);
        }
 
+       closedir(dir);
        put_tracing_file(path);
 }
 
@@ -533,7 +515,7 @@ int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
        write_or_die(buf, 1);
 
        /* save page_size */
-       page_size = getpagesize();
+       page_size = sysconf(_SC_PAGESIZE);
        write_or_die(&page_size, 4);
 
        read_header_files();
index c5c32be040bfe85767a155bb951db828aff4e49a..9b3c20f42f98a2ab0b4157ca8f03d0f0477c7b75 100644 (file)
@@ -1925,6 +1925,15 @@ void *raw_field_ptr(struct event *event, const char *name, void *data)
        if (!field)
                return NULL;
 
+       if (field->flags & FIELD_IS_STRING) {
+               int offset;
+
+               offset = *(int *)(data + field->offset);
+               offset &= 0xffff;
+
+               return data + offset;
+       }
+
        return data + field->offset;
 }
 
@@ -3277,3 +3286,18 @@ void parse_set_info(int nr_cpus, int long_sz)
        cpus = nr_cpus;
        long_size = long_sz;
 }
+
+int common_pc(struct scripting_context *context)
+{
+       return parse_common_pc(context->event_data);
+}
+
+int common_flags(struct scripting_context *context)
+{
+       return parse_common_flags(context->event_data);
+}
+
+int common_lock_depth(struct scripting_context *context)
+{
+       return parse_common_lock_depth(context->event_data);
+}
diff --git a/tools/perf/util/trace-event-perl.h b/tools/perf/util/trace-event-perl.h
deleted file mode 100644 (file)
index e88fb26..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __PERF_TRACE_EVENT_PERL_H
-#define __PERF_TRACE_EVENT_PERL_H
-#ifdef NO_LIBPERL
-typedef int INTERP;
-#define dSP
-#define ENTER
-#define SAVETMPS
-#define PUTBACK
-#define SPAGAIN
-#define FREETMPS
-#define LEAVE
-#define SP
-#define ERRSV
-#define G_SCALAR               (0)
-#define G_DISCARD              (0)
-#define G_NOARGS               (0)
-#define PUSHMARK(a)
-#define SvTRUE(a)              (0)
-#define XPUSHs(s)
-#define sv_2mortal(a)
-#define newSVpv(a,b)
-#define newSVuv(a)
-#define newSViv(a)
-#define get_cv(a,b)            (0)
-#define call_pv(a,b)           (0)
-#define perl_alloc()           (0)
-#define perl_construct(a)      (0)
-#define perl_parse(a,b,c,d,e)  (0)
-#define perl_run(a)            (0)
-#define perl_destruct(a)       (0)
-#define perl_free(a)           (0)
-#define pTHX                   void
-#define CV                     void
-#define dXSUB_SYS
-#define pTHX_
-static inline void newXS(const char *a, void *b, const char *c) {}
-static void boot_Perf__Trace__Context(pTHX_ CV *cv) {}
-static void boot_DynaLoader(pTHX_ CV *cv) {}
-#else
-#include <EXTERN.h>
-#include <perl.h>
-void boot_Perf__Trace__Context(pTHX_ CV *cv);
-void boot_DynaLoader(pTHX_ CV *cv);
-typedef PerlInterpreter * INTERP;
-#endif
-
-struct scripting_context {
-       void *event_data;
-};
-
-int common_pc(struct scripting_context *context);
-int common_flags(struct scripting_context *context);
-int common_lock_depth(struct scripting_context *context);
-
-#endif /* __PERF_TRACE_EVENT_PERL_H */
index 1744422cafcb43cf7872b2d7daf67c4409f56e3c..7cd1193918c76ccef904e03c7ed6f37fcc66a5b8 100644 (file)
@@ -18,7 +18,7 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
-#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
 
 #include <dirent.h>
 #include <stdio.h>
@@ -83,7 +83,7 @@ static char *read_string(void)
        char *str = NULL;
        int size = 0;
        int i;
-       int r;
+       off_t r;
 
        for (;;) {
                r = read(input_fd, buf, BUFSIZ);
@@ -118,7 +118,7 @@ static char *read_string(void)
 
        /* move the file descriptor to the end of the string */
        r = lseek(input_fd, -(r - i), SEEK_CUR);
-       if (r < 0)
+       if (r == (off_t)-1)
                die("lseek");
 
        if (str) {
@@ -282,8 +282,8 @@ static void update_cpu_data_index(int cpu)
 
 static void get_next_page(int cpu)
 {
-       off64_t save_seek;
-       off64_t ret;
+       off_t save_seek;
+       off_t ret;
 
        if (!cpu_data[cpu].page)
                return;
@@ -298,17 +298,17 @@ static void get_next_page(int cpu)
                update_cpu_data_index(cpu);
 
                /* other parts of the code may expect the pointer to not move */
-               save_seek = lseek64(input_fd, 0, SEEK_CUR);
+               save_seek = lseek(input_fd, 0, SEEK_CUR);
 
-               ret = lseek64(input_fd, cpu_data[cpu].offset, SEEK_SET);
-               if (ret < 0)
+               ret = lseek(input_fd, cpu_data[cpu].offset, SEEK_SET);
+               if (ret == (off_t)-1)
                        die("failed to lseek");
                ret = read(input_fd, cpu_data[cpu].page, page_size);
                if (ret < 0)
                        die("failed to read page");
 
                /* reset the file pointer back */
-               lseek64(input_fd, save_seek, SEEK_SET);
+               lseek(input_fd, save_seek, SEEK_SET);
 
                return;
        }
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
new file mode 100644 (file)
index 0000000..7ea983a
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * trace-event-scripting.  Scripting engine common and initialization code.
+ *
+ * Copyright (C) 2009-2010 Tom Zanussi <tzanussi@gmail.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
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "../perf.h"
+#include "util.h"
+#include "trace-event.h"
+
+struct scripting_context *scripting_context;
+
+static int stop_script_unsupported(void)
+{
+       return 0;
+}
+
+static void process_event_unsupported(int cpu __unused,
+                                     void *data __unused,
+                                     int size __unused,
+                                     unsigned long long nsecs __unused,
+                                     char *comm __unused)
+{
+}
+
+static void print_python_unsupported_msg(void)
+{
+       fprintf(stderr, "Python scripting not supported."
+               "  Install libpython and rebuild perf to enable it.\n"
+               "For example:\n  # apt-get install python-dev (ubuntu)"
+               "\n  # yum install python-devel (Fedora)"
+               "\n  etc.\n");
+}
+
+static int python_start_script_unsupported(const char *script __unused,
+                                          int argc __unused,
+                                          const char **argv __unused)
+{
+       print_python_unsupported_msg();
+
+       return -1;
+}
+
+static int python_generate_script_unsupported(const char *outfile __unused)
+{
+       print_python_unsupported_msg();
+
+       return -1;
+}
+
+struct scripting_ops python_scripting_unsupported_ops = {
+       .name = "Python",
+       .start_script = python_start_script_unsupported,
+       .stop_script = stop_script_unsupported,
+       .process_event = process_event_unsupported,
+       .generate_script = python_generate_script_unsupported,
+};
+
+static void register_python_scripting(struct scripting_ops *scripting_ops)
+{
+       int err;
+       err = script_spec_register("Python", scripting_ops);
+       if (err)
+               die("error registering Python script extension");
+
+       err = script_spec_register("py", scripting_ops);
+       if (err)
+               die("error registering py script extension");
+
+       scripting_context = malloc(sizeof(struct scripting_context));
+}
+
+#ifdef NO_LIBPYTHON
+void setup_python_scripting(void)
+{
+       register_python_scripting(&python_scripting_unsupported_ops);
+}
+#else
+struct scripting_ops python_scripting_ops;
+
+void setup_python_scripting(void)
+{
+       register_python_scripting(&python_scripting_ops);
+}
+#endif
+
+static void print_perl_unsupported_msg(void)
+{
+       fprintf(stderr, "Perl scripting not supported."
+               "  Install libperl and rebuild perf to enable it.\n"
+               "For example:\n  # apt-get install libperl-dev (ubuntu)"
+               "\n  # yum install 'perl(ExtUtils::Embed)' (Fedora)"
+               "\n  etc.\n");
+}
+
+static int perl_start_script_unsupported(const char *script __unused,
+                                        int argc __unused,
+                                        const char **argv __unused)
+{
+       print_perl_unsupported_msg();
+
+       return -1;
+}
+
+static int perl_generate_script_unsupported(const char *outfile __unused)
+{
+       print_perl_unsupported_msg();
+
+       return -1;
+}
+
+struct scripting_ops perl_scripting_unsupported_ops = {
+       .name = "Perl",
+       .start_script = perl_start_script_unsupported,
+       .stop_script = stop_script_unsupported,
+       .process_event = process_event_unsupported,
+       .generate_script = perl_generate_script_unsupported,
+};
+
+static void register_perl_scripting(struct scripting_ops *scripting_ops)
+{
+       int err;
+       err = script_spec_register("Perl", scripting_ops);
+       if (err)
+               die("error registering Perl script extension");
+
+       err = script_spec_register("pl", scripting_ops);
+       if (err)
+               die("error registering pl script extension");
+
+       scripting_context = malloc(sizeof(struct scripting_context));
+}
+
+#ifdef NO_LIBPERL
+void setup_perl_scripting(void)
+{
+       register_perl_scripting(&perl_scripting_unsupported_ops);
+}
+#else
+struct scripting_ops perl_scripting_ops;
+
+void setup_perl_scripting(void)
+{
+       register_perl_scripting(&perl_scripting_ops);
+}
+#endif
index 6ad405620c9b835852becb0e4d363b4d5c5990f5..c3269b937db42d103d2bd3a37789d535445a8153 100644 (file)
@@ -279,7 +279,15 @@ struct scripting_ops {
 
 int script_spec_register(const char *spec, struct scripting_ops *ops);
 
-extern struct scripting_ops perl_scripting_ops;
 void setup_perl_scripting(void);
+void setup_python_scripting(void);
+
+struct scripting_context {
+       void *event_data;
+};
+
+int common_pc(struct scripting_context *context);
+int common_flags(struct scripting_context *context);
+int common_lock_depth(struct scripting_context *context);
 
 #endif /* __PERF_TRACE_EVENTS_H */
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
new file mode 100644 (file)
index 0000000..f9b890f
--- /dev/null
@@ -0,0 +1,94 @@
+#include "util.h"
+#include <sys/mman.h>
+
+int mkdir_p(char *path, mode_t mode)
+{
+       struct stat st;
+       int err;
+       char *d = path;
+
+       if (*d != '/')
+               return -1;
+
+       if (stat(path, &st) == 0)
+               return 0;
+
+       while (*++d == '/');
+
+       while ((d = strchr(d, '/'))) {
+               *d = '\0';
+               err = stat(path, &st) && mkdir(path, mode);
+               *d++ = '/';
+               if (err)
+                       return -1;
+               while (*d == '/')
+                       ++d;
+       }
+       return (stat(path, &st) && mkdir(path, mode)) ? -1 : 0;
+}
+
+static int slow_copyfile(const char *from, const char *to)
+{
+       int err = 0;
+       char *line = NULL;
+       size_t n;
+       FILE *from_fp = fopen(from, "r"), *to_fp;
+
+       if (from_fp == NULL)
+               goto out;
+
+       to_fp = fopen(to, "w");
+       if (to_fp == NULL)
+               goto out_fclose_from;
+
+       while (getline(&line, &n, from_fp) > 0)
+               if (fputs(line, to_fp) == EOF)
+                       goto out_fclose_to;
+       err = 0;
+out_fclose_to:
+       fclose(to_fp);
+       free(line);
+out_fclose_from:
+       fclose(from_fp);
+out:
+       return err;
+}
+
+int copyfile(const char *from, const char *to)
+{
+       int fromfd, tofd;
+       struct stat st;
+       void *addr;
+       int err = -1;
+
+       if (stat(from, &st))
+               goto out;
+
+       if (st.st_size == 0) /* /proc? do it slowly... */
+               return slow_copyfile(from, to);
+
+       fromfd = open(from, O_RDONLY);
+       if (fromfd < 0)
+               goto out;
+
+       tofd = creat(to, 0755);
+       if (tofd < 0)
+               goto out_close_from;
+
+       addr = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fromfd, 0);
+       if (addr == MAP_FAILED)
+               goto out_close_to;
+
+       if (write(tofd, addr, st.st_size) == st.st_size)
+               err = 0;
+
+       munmap(addr, st.st_size);
+out_close_to:
+       close(tofd);
+       if (err)
+               unlink(to);
+out_close_from:
+       close(fromfd);
+out:
+       return err;
+}
index c673d8825883ce2bec91b03f5c1e474a756fde19..0f5b2a6f1080f6cd6a75f265ea2aa20787fc98e2 100644 (file)
@@ -403,4 +403,7 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #endif
 #endif
 
+int mkdir_p(char *path, mode_t mode);
+int copyfile(const char *from, const char *to);
+
 #endif
index 1c15e39f99e3c90b4b6b974078685e45269491bc..cfa55d686e3b9689fd6bfce089fb9d7207e85ab9 100644 (file)
@@ -169,6 +169,7 @@ static void perf_read_values__display_pretty(FILE *fp,
                                counterwidth[j], values->value[i][j]);
                fprintf(fp, "\n");
        }
+       free(counterwidth);
 }
 
 static void perf_read_values__display_raw(FILE *fp,
index 30f70fd511c4da7d91b83ad3aefb873134818ba8..a9d3fc6c681c5ab01bec43975d50ef93408c88e1 100644 (file)
@@ -72,12 +72,13 @@ static void
 irqfd_shutdown(struct work_struct *work)
 {
        struct _irqfd *irqfd = container_of(work, struct _irqfd, shutdown);
+       u64 cnt;
 
        /*
         * Synchronize with the wait-queue and unhook ourselves to prevent
         * further events.
         */
-       remove_wait_queue(irqfd->wqh, &irqfd->wait);
+       eventfd_ctx_remove_wait_queue(irqfd->eventfd, &irqfd->wait, &cnt);
 
        /*
         * We know no new events will be scheduled at this point, so block
@@ -166,7 +167,7 @@ irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh,
 static int
 kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
 {
-       struct _irqfd *irqfd;
+       struct _irqfd *irqfd, *tmp;
        struct file *file = NULL;
        struct eventfd_ctx *eventfd = NULL;
        int ret;
@@ -203,9 +204,20 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
        init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup);
        init_poll_funcptr(&irqfd->pt, irqfd_ptable_queue_proc);
 
+       spin_lock_irq(&kvm->irqfds.lock);
+
+       ret = 0;
+       list_for_each_entry(tmp, &kvm->irqfds.items, list) {
+               if (irqfd->eventfd != tmp->eventfd)
+                       continue;
+               /* This fd is used for another irq already. */
+               ret = -EBUSY;
+               spin_unlock_irq(&kvm->irqfds.lock);
+               goto fail;
+       }
+
        events = file->f_op->poll(file, &irqfd->pt);
 
-       spin_lock_irq(&kvm->irqfds.lock);
        list_add_tail(&irqfd->list, &kvm->irqfds.items);
        spin_unlock_irq(&kvm->irqfds.lock);
 
index 9b077342ab54c93e79266cf7d48c56a14466c802..9fd5b3ebc5175b193e083e45d594dcf34c4e04ab 100644 (file)
@@ -302,6 +302,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
 {
        int r = -EINVAL;
        int delta;
+       unsigned max_pin;
        struct kvm_kernel_irq_routing_entry *ei;
        struct hlist_node *n;
 
@@ -322,12 +323,15 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
                switch (ue->u.irqchip.irqchip) {
                case KVM_IRQCHIP_PIC_MASTER:
                        e->set = kvm_set_pic_irq;
+                       max_pin = 16;
                        break;
                case KVM_IRQCHIP_PIC_SLAVE:
                        e->set = kvm_set_pic_irq;
+                       max_pin = 16;
                        delta = 8;
                        break;
                case KVM_IRQCHIP_IOAPIC:
+                       max_pin = KVM_IOAPIC_NUM_PINS;
                        e->set = kvm_set_ioapic_irq;
                        break;
                default:
@@ -335,7 +339,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
                }
                e->irqchip.irqchip = ue->u.irqchip.irqchip;
                e->irqchip.pin = ue->u.irqchip.pin + delta;
-               if (e->irqchip.pin >= KVM_IOAPIC_NUM_PINS)
+               if (e->irqchip.pin >= max_pin)
                        goto out;
                rt->chip[ue->u.irqchip.irqchip][e->irqchip.pin] = ue->gsi;
                break;